From 5df1d8be6c1c55292824c698761159dc29b384d6 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 17 Jan 2022 14:23:24 +1100 Subject: [PATCH 0001/1712] tests/run-multitests.py: Ignore lld_pdu_get_tx_flush_nb msgs from IDF. BLE still functions correctly even though these messages are sometimes printed by the IDF. Ignoring them allows the multi_bluetooth tests to pass on an esp32 board. Signed-off-by: Damien George --- tests/run-multitests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/run-multitests.py b/tests/run-multitests.py index 34389e4292..20ef4a7aa6 100755 --- a/tests/run-multitests.py +++ b/tests/run-multitests.py @@ -76,12 +76,14 @@ multitest.flush() """ # The btstack implementation on Unix generates some spurious output that we -# can't control. +# can't control. Also other platforms may output certain warnings/errors that +# can be safely ignored. IGNORE_OUTPUT_MATCHES = ( "libusb: error ", # It tries to open devices that it doesn't have access to (libusb prints unconditionally). "hci_transport_h2_libusb.c", # Same issue. We enable LOG_ERROR in btstack. "USB Path: ", # Hardcoded in btstack's libusb transport. "hci_number_completed_packet", # Warning from btstack. + "lld_pdu_get_tx_flush_nb HCI packet count mismatch (", # From ESP-IDF, see https://github.com/espressif/esp-idf/issues/5105 ) From c54717a78f8640cbf4ae6c824569df253ffb689c Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 17 Jan 2022 17:15:31 +1100 Subject: [PATCH 0002/1712] tests/run-multitests.py: Set HOST_IP so tests work between PC and board. Signed-off-by: Damien George --- tests/run-multitests.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/run-multitests.py b/tests/run-multitests.py index 20ef4a7aa6..f55d52b6e9 100755 --- a/tests/run-multitests.py +++ b/tests/run-multitests.py @@ -66,7 +66,7 @@ class multitest: import network ip = network.WLAN().ifconfig()[0] except: - ip = "127.0.0.1" + ip = HOST_IP return ip {} @@ -87,6 +87,20 @@ IGNORE_OUTPUT_MATCHES = ( ) +def get_host_ip(_ip_cache=[]): + if not _ip_cache: + try: + import socket + + s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + s.connect(("8.8.8.8", 80)) + _ip_cache.append(s.getsockname()[0]) + s.close() + except: + _ip_cache.append("127.0.0.1") + return _ip_cache[0] + + class PyInstance: def __init__(self): pass @@ -274,6 +288,13 @@ def run_test_on_instances(test_file, num_instances, instances): injected_globals = "" output = [[] for _ in range(num_instances)] + # If the test calls get_network_ip() then inject HOST_IP so that devices can know + # the IP address of the host. Do this lazily to not require a TCP/IP connection + # on the host if it's not needed. + with open(test_file, "rb") as f: + if b"get_network_ip" in f.read(): + injected_globals += "HOST_IP = '" + get_host_ip() + "'\n" + if cmd_args.trace_output: print("TRACE {}:".format("|".join(str(i) for i in instances))) From 2c9dc5742abf1f3c787f166d2cbffb4b556ff77b Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 17 Jan 2022 17:20:06 +1100 Subject: [PATCH 0003/1712] tests/multi_net: Add testing key/cert to SSL server/client test. So that this tests works with mbedtls. Signed-off-by: Damien George --- tests/multi_net/ssl_data.py | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/tests/multi_net/ssl_data.py b/tests/multi_net/ssl_data.py index 81239b454c..cf2f96e0f3 100644 --- a/tests/multi_net/ssl_data.py +++ b/tests/multi_net/ssl_data.py @@ -1,10 +1,39 @@ # Simple test creating an SSL connection and transferring some data # This test won't run under CPython because it requires key/cert -import usocket as socket, ussl as ssl +import ubinascii as binascii, usocket as socket, ussl as ssl PORT = 8000 +# This self-signed key/cert pair is randomly generated and to be used for +# testing/demonstration only. You should always generate your own key/cert. +key = binascii.unhexlify( + b"3082013b020100024100cc20643fd3d9c21a0acba4f48f61aadd675f52175a9dcf07fbef" + b"610a6a6ba14abb891745cd18a1d4c056580d8ff1a639460f867013c8391cdc9f2e573b0f" + b"872d0203010001024100bb17a54aeb3dd7ae4edec05e775ca9632cf02d29c2a089b563b0" + b"d05cdf95aeca507de674553f28b4eadaca82d5549a86058f9996b07768686a5b02cb240d" + b"d9f1022100f4a63f5549e817547dca97b5c658038e8593cb78c5aba3c4642cc4cd031d86" + b"8f022100d598d870ffe4a34df8de57047a50b97b71f4d23e323f527837c9edae88c79483" + b"02210098560c89a70385c36eb07fd7083235c4c1184e525d838aedf7128958bedfdbb102" + b"2051c0dab7057a8176ca966f3feb81123d4974a733df0f958525f547dfd1c271f9022044" + b"6c2cafad455a671a8cf398e642e1be3b18a3d3aec2e67a9478f83c964c4f1f" +) +cert = binascii.unhexlify( + b"308201d53082017f020203e8300d06092a864886f70d01010505003075310b3009060355" + b"0406130258583114301206035504080c0b54686550726f76696e63653110300e06035504" + b"070c075468654369747931133011060355040a0c0a436f6d70616e7958595a3113301106" + b"0355040b0c0a436f6d70616e7958595a3114301206035504030c0b546865486f73744e61" + b"6d65301e170d3139313231383033333935355a170d3239313231353033333935355a3075" + b"310b30090603550406130258583114301206035504080c0b54686550726f76696e636531" + b"10300e06035504070c075468654369747931133011060355040a0c0a436f6d70616e7958" + b"595a31133011060355040b0c0a436f6d70616e7958595a3114301206035504030c0b5468" + b"65486f73744e616d65305c300d06092a864886f70d0101010500034b003048024100cc20" + b"643fd3d9c21a0acba4f48f61aadd675f52175a9dcf07fbef610a6a6ba14abb891745cd18" + b"a1d4c056580d8ff1a639460f867013c8391cdc9f2e573b0f872d0203010001300d06092a" + b"864886f70d0101050500034100b0513fe2829e9ecbe55b6dd14c0ede7502bde5d46153c8" + b"e960ae3ebc247371b525caeb41bbcf34686015a44c50d226e66aef0a97a63874ca5944ef" + b"979b57f0b3" +) # Server def instance0(): @@ -15,7 +44,7 @@ def instance0(): s.listen(1) multitest.next() s2, _ = s.accept() - s2 = ssl.wrap_socket(s2, server_side=True) + s2 = ssl.wrap_socket(s2, server_side=True, key=key, cert=cert) print(s2.read(16)) s2.write(b"server to client") s.close() From 5e506567a390db1b1d2df39ae192f39ed9f617c3 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 17 Jan 2022 17:21:48 +1100 Subject: [PATCH 0004/1712] stm32/mbedtls: Enable MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE. This adds MBEDTLS_MD_SHA1 to the list of default hashes for TLS 1.2 handshake signatures. Although SHA-1 is weak, this option is turned on in the default mbedtls configuration file, and allows better compatibility with older servers. In particular it allows an stm32-mbedtls-based client to connect to an axtls-based client (eg default unix port and esp8266). Signed-off-by: Damien George --- ports/stm32/mbedtls/mbedtls_config.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/stm32/mbedtls/mbedtls_config.h b/ports/stm32/mbedtls/mbedtls_config.h index 56fbbf3aaf..904d08548f 100644 --- a/ports/stm32/mbedtls/mbedtls_config.h +++ b/ports/stm32/mbedtls/mbedtls_config.h @@ -82,6 +82,7 @@ #define MBEDTLS_SSL_CLI_C #define MBEDTLS_SSL_SRV_C #define MBEDTLS_SSL_TLS_C +#define MBEDTLS_TLS_DEFAULT_ALLOW_SHA1_IN_KEY_EXCHANGE #define MBEDTLS_X509_CRT_PARSE_C #define MBEDTLS_X509_USE_C From 037b2c72a1d5b54a5508a58ab2044628a7a39fa4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 10 Jan 2022 09:03:27 -0600 Subject: [PATCH 0005/1712] py/objstr: Support '{:08}'.format("Jan") like Python 3.10. The new test has an .exp file, because it is not compatible with Python 3.9 and lower. See CPython version of the issue at https://bugs.python.org/issue27772 Signed-off-by: Jeff Epler --- py/objstr.c | 2 +- tests/basics/string_format_cp310.py | 9 +++++++++ tests/basics/string_format_cp310.py.exp | 4 ++++ tests/basics/string_format_error.py | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tests/basics/string_format_cp310.py create mode 100644 tests/basics/string_format_cp310.py.exp diff --git a/py/objstr.c b/py/objstr.c index 7d7f0e1dfa..321bb058dc 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -1163,7 +1163,7 @@ STATIC vstr_t mp_obj_str_format_helper(const char *str, const char *top, int *ar s++; } if (*s == '0') { - if (!align) { + if (!align && arg_looks_numeric(arg)) { align = '='; } if (!fill) { diff --git a/tests/basics/string_format_cp310.py b/tests/basics/string_format_cp310.py new file mode 100644 index 0000000000..77295330be --- /dev/null +++ b/tests/basics/string_format_cp310.py @@ -0,0 +1,9 @@ +# Python 3.10+ functionality test for {} format string + +def test(fmt, *args): + print('{:8s}'.format(fmt) + '>' + fmt.format(*args) + '<') + +test("{:0s}", "ab") +test("{:06s}", "ab") +test("{:<06s}", "ab") +test("{:>06s}", "ab") diff --git a/tests/basics/string_format_cp310.py.exp b/tests/basics/string_format_cp310.py.exp new file mode 100644 index 0000000000..1c26473d83 --- /dev/null +++ b/tests/basics/string_format_cp310.py.exp @@ -0,0 +1,4 @@ +{:0s} >ab< +{:06s} >ab0000< +{:<06s} >ab0000< +{:>06s} >0000ab< diff --git a/tests/basics/string_format_error.py b/tests/basics/string_format_error.py index 708348d59f..74dc6c52ed 100644 --- a/tests/basics/string_format_error.py +++ b/tests/basics/string_format_error.py @@ -1,7 +1,7 @@ # tests for errors in {} format string try: - '{0:0}'.format('zzz') + '{0:=}'.format('zzz') except (ValueError): print('ValueError') From 608d421752c55e466cb8c50d26ab2a172280dfd2 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 20 Jan 2022 16:08:17 +1100 Subject: [PATCH 0006/1712] stm32/mboot: Remove custom HAL_RCC_GetHCLKFreq and use HAL provided one. So that a board can access other HAL_RCC functions if it needs them (this was not possible previously by just adding hal_rcc.c to the src list for a board because it would clash with the custom HAL_RCC_GetHCLKFreq function). Signed-off-by: Damien George --- ports/stm32/mboot/Makefile | 1 + ports/stm32/mboot/main.c | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/ports/stm32/mboot/Makefile b/ports/stm32/mboot/Makefile index 553fc4ac66..7e1b497cef 100755 --- a/ports/stm32/mboot/Makefile +++ b/ports/stm32/mboot/Makefile @@ -161,6 +161,7 @@ SRC_HAL += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\ hal_flash_ex.c \ hal_pcd.c \ hal_pcd_ex.c \ + hal_rcc.c \ ll_usb.c \ ) diff --git a/ports/stm32/mboot/main.c b/ports/stm32/mboot/main.c index 278c07fb4a..3c3e4a8642 100644 --- a/ports/stm32/mboot/main.c +++ b/ports/stm32/mboot/main.c @@ -326,11 +326,6 @@ void SystemClock_Config(void) { #endif -// Needed by HAL_PCD_IRQHandler -uint32_t HAL_RCC_GetHCLKFreq(void) { - return SystemCoreClock; -} - /******************************************************************************/ // GPIO From ce4f8b49ceed0340cdd05d4935e3a1147d0d3d39 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 20 Jan 2022 16:35:49 +1100 Subject: [PATCH 0007/1712] tools/mpremote: Use machine instead of umachine in commands. Because bare-metal boards will have machine but not always umachine. Signed-off-by: Damien George --- tools/mpremote/mpremote/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/mpremote/mpremote/main.py b/tools/mpremote/mpremote/main.py index 99e7bcd9bc..13615f6dd2 100644 --- a/tools/mpremote/mpremote/main.py +++ b/tools/mpremote/mpremote/main.py @@ -80,7 +80,7 @@ _BUILTIN_COMMAND_EXPANSIONS = { "command": [ "exec", "--no-follow", - "import utime, umachine; utime.sleep_ms(t_ms); umachine.reset()", + "import utime, machine; utime.sleep_ms(t_ms); machine.reset()", ], "help": "reset the device after delay", }, @@ -88,7 +88,7 @@ _BUILTIN_COMMAND_EXPANSIONS = { "command": [ "exec", "--no-follow", - "import utime, umachine; utime.sleep_ms(t_ms); umachine.bootloader()", + "import utime, machine; utime.sleep_ms(t_ms); machine.bootloader()", ], "help": "make the device enter its bootloader", }, From 7b0a42374e1ae6a4ab3f756090c6f3b66e82acb5 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 20 Jan 2022 16:43:55 +1100 Subject: [PATCH 0008/1712] rp2/machine_i2c: Provide more specific error codes from I2C transfer. Signed-off-by: Damien George --- ports/rp2/machine_i2c.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ports/rp2/machine_i2c.c b/ports/rp2/machine_i2c.c index 3b895ba4d4..56f012a5e8 100644 --- a/ports/rp2/machine_i2c.c +++ b/ports/rp2/machine_i2c.c @@ -145,11 +145,20 @@ STATIC int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, si ret = mp_machine_soft_i2c_transfer(&soft_i2c.base, addr, 1, &bufs, flags); gpio_set_function(self->scl, GPIO_FUNC_I2C); gpio_set_function(self->sda, GPIO_FUNC_I2C); + return ret; } else { ret = i2c_write_blocking(self->i2c_inst, addr, buf, len, nostop); } } - return (ret < 0) ? -MP_EIO : ret; + if (ret < 0) { + if (ret == PICO_ERROR_TIMEOUT) { + return -MP_ETIMEDOUT; + } else { + return -MP_EIO; + } + } else { + return ret; + } } STATIC const mp_machine_i2c_p_t machine_i2c_p = { From f44fb760551809d038d3fda49ffe07975e92091d Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Tue, 18 Jan 2022 22:06:02 +0200 Subject: [PATCH 0009/1712] rp2/mpconfigport.h: Use internal error numbers. --- ports/rp2/mpconfigport.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h index e6a85bb682..63d9818e31 100644 --- a/ports/rp2/mpconfigport.h +++ b/ports/rp2/mpconfigport.h @@ -70,6 +70,7 @@ #define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) +#define MICROPY_USE_INTERNAL_ERRNO (1) #define MICROPY_SCHEDULER_DEPTH (8) // Fine control over Python builtins, classes, modules, etc From 5db278f1dd061ea0d7d9263cc6b4a3b212b34caf Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sat, 15 Jan 2022 04:32:01 +0200 Subject: [PATCH 0010/1712] rp2/mphalport: Add optional dupterm support. --- ports/rp2/moduos.c | 1 + ports/rp2/mphalport.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/ports/rp2/moduos.c b/ports/rp2/moduos.c index 02f34eb960..a9dc30df89 100644 --- a/ports/rp2/moduos.c +++ b/ports/rp2/moduos.c @@ -26,6 +26,7 @@ #include "py/objstr.h" #include "py/runtime.h" +#include "extmod/misc.h" #include "extmod/vfs.h" #include "extmod/vfs_fat.h" #include "extmod/vfs_lfs.h" diff --git a/ports/rp2/mphalport.c b/ports/rp2/mphalport.c index 3385323db0..c4169fb66c 100644 --- a/ports/rp2/mphalport.c +++ b/ports/rp2/mphalport.c @@ -27,6 +27,7 @@ #include "py/runtime.h" #include "py/stream.h" #include "py/mphal.h" +#include "extmod/misc.h" #include "shared/timeutils/timeutils.h" #include "tusb.h" #include "uart.h" @@ -74,6 +75,9 @@ uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) { ret |= MP_STREAM_POLL_RD; } #endif + #if MICROPY_PY_OS_DUPTERM + ret |= mp_uos_dupterm_poll(poll_flags); + #endif return ret; } @@ -95,6 +99,12 @@ int mp_hal_stdin_rx_chr(void) { } } #endif + #if MICROPY_PY_OS_DUPTERM + int dupterm_c = mp_uos_dupterm_rx_chr(); + if (dupterm_c >= 0) { + return dupterm_c; + } + #endif MICROPY_EVENT_POLL_HOOK } } @@ -123,6 +133,10 @@ void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) { } } #endif + + #if MICROPY_PY_OS_DUPTERM + mp_uos_dupterm_tx_strn(str, len); + #endif } void mp_hal_delay_ms(mp_uint_t ms) { From 981664fd079a379dfd9749e9068781590813b401 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Fri, 14 Jan 2022 02:16:44 +0200 Subject: [PATCH 0011/1712] drivers/ninaw10: Add function to check socket state/data availability. --- drivers/ninaw10/nina_wifi_drv.c | 30 ++++++++++++++++++++++-------- drivers/ninaw10/nina_wifi_drv.h | 1 + 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/ninaw10/nina_wifi_drv.c b/drivers/ninaw10/nina_wifi_drv.c index b7c016f421..e7eac478be 100644 --- a/drivers/ninaw10/nina_wifi_drv.c +++ b/drivers/ninaw10/nina_wifi_drv.c @@ -132,7 +132,7 @@ typedef enum { NINA_CMD_SOCKET_OPEN = 0x3F, NINA_CMD_SOCKET_CLOSE = 0x2E, NINA_CMD_SOCKET_CONNECT = 0x2D, - NINA_CMD_SOCKET_ACCEPT = 0x2B, + NINA_CMD_SOCKET_AVAIL = 0x2B, NINA_CMD_SOCKET_BIND = 0x28, NINA_CMD_SOCKET_STATE = 0x2F, NINA_CMD_SOCKET_REMOTE_ADDR = 0x3A, @@ -752,21 +752,35 @@ int nina_socket_listen(int fd, uint32_t backlog) { return 0; // No listen ? } -int nina_socket_accept(int fd, uint8_t *ip, uint16_t *port, int *fd_out, uint32_t timeout) { +int nina_socket_avail(int fd, int type, uint16_t *data) { uint16_t size = 2; - uint16_t sock = NO_SOCKET_AVAIL; + + if (nina_send_command_read_vals(NINA_CMD_SOCKET_AVAIL, + 1, ARG_8BITS, NINA_ARGS(ARG_BYTE(fd)), + 1, ARG_8BITS, NINA_VALS({&size, data})) != 0) { + return -1; + } + + // For TCP sockets in listen state, return 0 if there's no accepted socket. + if (*data == NO_SOCKET_AVAIL && type == NINA_SOCKET_TYPE_TCP + && nina_server_socket_status(fd) == SOCKET_STATE_LISTEN) { + *data = 0; + } + + return 0; +} + +int nina_socket_accept(int fd, uint8_t *ip, uint16_t *port, int *fd_out, uint32_t timeout) { + uint16_t sock = 0; if (nina_server_socket_status(fd) != SOCKET_STATE_LISTEN) { return -1; } - for (mp_uint_t start = mp_hal_ticks_ms(); sock == 0 || sock == NO_SOCKET_AVAIL; mp_hal_delay_ms(10)) { - if (nina_send_command_read_vals(NINA_CMD_SOCKET_ACCEPT, - 1, ARG_8BITS, NINA_ARGS(ARG_BYTE(fd)), - 1, ARG_8BITS, NINA_VALS({&size, &sock})) != 0) { + for (mp_uint_t start = mp_hal_ticks_ms(); !sock; mp_hal_delay_ms(10)) { + if (nina_socket_avail(fd, NINA_SOCKET_TYPE_TCP, &sock) != 0) { return -1; } - if (timeout && (mp_hal_ticks_ms() - start) >= timeout) { return NINA_ERROR_TIMEOUT; } diff --git a/drivers/ninaw10/nina_wifi_drv.h b/drivers/ninaw10/nina_wifi_drv.h index d8c55f5e67..8b13bfc1f5 100644 --- a/drivers/ninaw10/nina_wifi_drv.h +++ b/drivers/ninaw10/nina_wifi_drv.h @@ -109,6 +109,7 @@ int nina_socket_socket(uint8_t type); int nina_socket_close(int fd); int nina_socket_bind(int fd, uint8_t *ip, uint16_t port, int type); int nina_socket_listen(int fd, uint32_t backlog); +int nina_socket_avail(int fd, int type, uint16_t *data); int nina_socket_accept(int fd, uint8_t *ip, uint16_t *port, int *fd_out, uint32_t timeout); int nina_socket_connect(int fd, uint8_t *ip, uint16_t port, uint32_t timeout); int nina_socket_send(int fd, const uint8_t *buf, uint32_t len, uint32_t timeout); From 9a61bc3aa78058bf222dec3f01ce3b90fa79108a Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Fri, 14 Jan 2022 02:17:11 +0200 Subject: [PATCH 0012/1712] extmod/network_ninaw10: Implement MP_STREAM_POLL in ioctl. There is currently no function to query if the socket is writable. --- extmod/network_ninaw10.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/extmod/network_ninaw10.c b/extmod/network_ninaw10.c index cba24ea94c..c8fd0ce317 100644 --- a/extmod/network_ninaw10.c +++ b/extmod/network_ninaw10.c @@ -545,8 +545,42 @@ STATIC int network_ninaw10_socket_settimeout(mod_network_socket_obj_t *socket, m } STATIC int network_ninaw10_socket_ioctl(mod_network_socket_obj_t *socket, mp_uint_t request, mp_uint_t arg, int *_errno) { - *_errno = MP_EIO; - return -1; + mp_uint_t ret = 0; + uint8_t type; + + switch (socket->type) { + case MOD_NETWORK_SOCK_STREAM: + type = NINA_SOCKET_TYPE_TCP; + break; + + case MOD_NETWORK_SOCK_DGRAM: + type = NINA_SOCKET_TYPE_UDP; + break; + + default: + *_errno = MP_EINVAL; + return MP_STREAM_ERROR; + } + + if (request == MP_STREAM_POLL) { + if (arg & MP_STREAM_POLL_RD) { + uint16_t avail = 0; + if (nina_socket_avail(socket->fileno, type, &avail) != 0) { + *_errno = MP_EIO; + ret = MP_STREAM_ERROR; + } else if (avail) { + // Readable or accepted socket ready. + ret |= MP_STREAM_POLL_RD; + } + } + if (arg & MP_STREAM_POLL_WR) { + ret |= MP_STREAM_POLL_WR; + } + } else { + *_errno = MP_EINVAL; + ret = MP_STREAM_ERROR; + } + return ret; } static const mp_rom_map_elem_t nina_locals_dict_table[] = { From e401ff8935fb7764adede3ee4e0d9a6cf974c6c3 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Fri, 14 Jan 2022 02:59:07 +0200 Subject: [PATCH 0013/1712] drivers/ninaw10: Fix timeout handling to match modusocket. --- drivers/ninaw10/nina_wifi_drv.c | 30 +++++++++++++++++++----------- drivers/ninaw10/nina_wifi_drv.h | 12 ++++++------ extmod/network_ninaw10.c | 16 ++++++++++------ 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/drivers/ninaw10/nina_wifi_drv.c b/drivers/ninaw10/nina_wifi_drv.c index e7eac478be..12707fe051 100644 --- a/drivers/ninaw10/nina_wifi_drv.c +++ b/drivers/ninaw10/nina_wifi_drv.c @@ -770,7 +770,7 @@ int nina_socket_avail(int fd, int type, uint16_t *data) { return 0; } -int nina_socket_accept(int fd, uint8_t *ip, uint16_t *port, int *fd_out, uint32_t timeout) { +int nina_socket_accept(int fd, uint8_t *ip, uint16_t *port, int *fd_out, int32_t timeout) { uint16_t sock = 0; if (nina_server_socket_status(fd) != SOCKET_STATE_LISTEN) { @@ -781,7 +781,7 @@ int nina_socket_accept(int fd, uint8_t *ip, uint16_t *port, int *fd_out, uint32_ if (nina_socket_avail(fd, NINA_SOCKET_TYPE_TCP, &sock) != 0) { return -1; } - if (timeout && (mp_hal_ticks_ms() - start) >= timeout) { + if (timeout == 0 || (timeout > 0 && (mp_hal_ticks_ms() - start) >= timeout)) { return NINA_ERROR_TIMEOUT; } } @@ -798,7 +798,7 @@ int nina_socket_accept(int fd, uint8_t *ip, uint16_t *port, int *fd_out, uint32_ return 0; } -int nina_socket_connect(int fd, uint8_t *ip, uint16_t port, uint32_t timeout) { +int nina_socket_connect(int fd, uint8_t *ip, uint16_t port, int32_t timeout) { if (nina_send_command_read_ack(NINA_CMD_SOCKET_CONNECT, 4, ARG_8BITS, NINA_ARGS( @@ -819,7 +819,7 @@ int nina_socket_connect(int fd, uint8_t *ip, uint16_t port, uint32_t timeout) { break; } - if (timeout && (mp_hal_ticks_ms() - start) >= timeout) { + if (timeout == 0 || (timeout > 0 && (mp_hal_ticks_ms() - start) >= timeout)) { return NINA_ERROR_TIMEOUT; } } @@ -827,7 +827,7 @@ int nina_socket_connect(int fd, uint8_t *ip, uint16_t port, uint32_t timeout) { return 0; } -int nina_socket_send(int fd, const uint8_t *buf, uint32_t len, uint32_t timeout) { +int nina_socket_send(int fd, const uint8_t *buf, uint32_t len, int32_t timeout) { uint16_t size = 2; uint16_t bytes = 0; @@ -853,7 +853,7 @@ int nina_socket_send(int fd, const uint8_t *buf, uint32_t len, uint32_t timeout) break; } - if (timeout && (mp_hal_ticks_ms() - start) >= timeout) { + if (timeout == 0 || (timeout > 0 && (mp_hal_ticks_ms() - start) >= timeout)) { return NINA_ERROR_TIMEOUT; } mp_hal_delay_ms(1); @@ -862,7 +862,7 @@ int nina_socket_send(int fd, const uint8_t *buf, uint32_t len, uint32_t timeout) return bytes; } -int nina_socket_recv(int fd, uint8_t *buf, uint32_t len, uint32_t timeout) { +int nina_socket_recv(int fd, uint8_t *buf, uint32_t len, int32_t timeout) { uint16_t bytes = 0; if (nina_socket_status(fd) != SOCKET_STATE_ESTABLISHED) { @@ -877,7 +877,11 @@ int nina_socket_recv(int fd, uint8_t *buf, uint32_t len, uint32_t timeout) { return -1; } - if (timeout && (mp_hal_ticks_ms() - start) >= timeout) { + if (bytes != 0) { + break; + } + + if (timeout == 0 || (timeout > 0 && (mp_hal_ticks_ms() - start) >= timeout)) { return NINA_ERROR_TIMEOUT; } } @@ -885,7 +889,7 @@ int nina_socket_recv(int fd, uint8_t *buf, uint32_t len, uint32_t timeout) { } // Check from the upper layer if the socket is bound, if not then auto-bind it first. -int nina_socket_sendto(int fd, const uint8_t *buf, uint32_t len, uint8_t *ip, uint16_t port, uint32_t timeout) { +int nina_socket_sendto(int fd, const uint8_t *buf, uint32_t len, uint8_t *ip, uint16_t port, int32_t timeout) { // TODO do we need to split the packet somewhere? if (nina_send_command_read_ack(NINA_CMD_SOCKET_CONNECT, 4, ARG_8BITS, @@ -912,7 +916,7 @@ int nina_socket_sendto(int fd, const uint8_t *buf, uint32_t len, uint8_t *ip, ui } // Check from the upper layer if the socket is bound, if not then auto-bind it first. -int nina_socket_recvfrom(int fd, uint8_t *buf, uint32_t len, uint8_t *ip, uint16_t *port, uint32_t timeout) { +int nina_socket_recvfrom(int fd, uint8_t *buf, uint32_t len, uint8_t *ip, uint16_t *port, int32_t timeout) { uint16_t bytes = 0; uint16_t port_len = 2; uint16_t ip_len = NINA_IPV4_ADDR_LEN; @@ -925,7 +929,11 @@ int nina_socket_recvfrom(int fd, uint8_t *buf, uint32_t len, uint8_t *ip, uint16 return -1; } - if (timeout && (mp_hal_ticks_ms() - start) >= timeout) { + if (bytes != 0) { + break; + } + + if (timeout == 0 || (timeout > 0 && (mp_hal_ticks_ms() - start) >= timeout)) { return NINA_ERROR_TIMEOUT; } } diff --git a/drivers/ninaw10/nina_wifi_drv.h b/drivers/ninaw10/nina_wifi_drv.h index 8b13bfc1f5..b8a6c4eb92 100644 --- a/drivers/ninaw10/nina_wifi_drv.h +++ b/drivers/ninaw10/nina_wifi_drv.h @@ -110,12 +110,12 @@ int nina_socket_close(int fd); int nina_socket_bind(int fd, uint8_t *ip, uint16_t port, int type); int nina_socket_listen(int fd, uint32_t backlog); int nina_socket_avail(int fd, int type, uint16_t *data); -int nina_socket_accept(int fd, uint8_t *ip, uint16_t *port, int *fd_out, uint32_t timeout); -int nina_socket_connect(int fd, uint8_t *ip, uint16_t port, uint32_t timeout); -int nina_socket_send(int fd, const uint8_t *buf, uint32_t len, uint32_t timeout); -int nina_socket_recv(int fd, uint8_t *buf, uint32_t len, uint32_t timeout); -int nina_socket_sendto(int fd, const uint8_t *buf, uint32_t len, uint8_t *ip, uint16_t port, uint32_t timeout); -int nina_socket_recvfrom(int fd, uint8_t *buf, uint32_t len, uint8_t *ip, uint16_t *port, uint32_t timeout); +int nina_socket_accept(int fd, uint8_t *ip, uint16_t *port, int *fd_out, int32_t timeout); +int nina_socket_connect(int fd, uint8_t *ip, uint16_t port, int32_t timeout); +int nina_socket_send(int fd, const uint8_t *buf, uint32_t len, int32_t timeout); +int nina_socket_recv(int fd, uint8_t *buf, uint32_t len, int32_t timeout); +int nina_socket_sendto(int fd, const uint8_t *buf, uint32_t len, uint8_t *ip, uint16_t port, int32_t timeout); +int nina_socket_recvfrom(int fd, uint8_t *buf, uint32_t len, uint8_t *ip, uint16_t *port, int32_t timeout); int nina_socket_setsockopt(int fd, uint32_t level, uint32_t opt, const void *optval, uint32_t optlen); #endif // MICROPY_INCLUDED_DRIVERS_NINAW10_NINA_WIFI_DRV_H diff --git a/extmod/network_ninaw10.c b/extmod/network_ninaw10.c index c8fd0ce317..26b4a811dc 100644 --- a/extmod/network_ninaw10.c +++ b/extmod/network_ninaw10.c @@ -406,7 +406,11 @@ STATIC int network_ninaw10_socket_accept(mod_network_socket_obj_t *socket, int fd = 0; // Call accept. int ret = nina_socket_accept(socket->fileno, ip, (uint16_t *)port, &fd, socket->timeout); - if (ret < 0) { + if (ret == NINA_ERROR_TIMEOUT) { + // The socket is Not closed on timeout when calling functions that accept a timeout. + *_errno = MP_ETIMEDOUT; + return -1; + } else if (ret < 0) { *_errno = ret; network_ninaw10_socket_close(socket); return -1; @@ -420,7 +424,11 @@ STATIC int network_ninaw10_socket_accept(mod_network_socket_obj_t *socket, STATIC int network_ninaw10_socket_connect(mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno) { int ret = nina_socket_connect(socket->fileno, ip, port, socket->timeout); - if (ret < 0) { + if (ret == NINA_ERROR_TIMEOUT) { + // The socket is Not closed on timeout when calling functions that accept a timeout. + *_errno = MP_ETIMEDOUT; + return -1; + } else if (ret < 0) { *_errno = ret; network_ninaw10_socket_close(socket); return -1; @@ -536,10 +544,6 @@ STATIC int network_ninaw10_socket_setsockopt(mod_network_socket_obj_t *socket, m } STATIC int network_ninaw10_socket_settimeout(mod_network_socket_obj_t *socket, mp_uint_t timeout_ms, int *_errno) { - if (timeout_ms == UINT32_MAX) { - // no timeout is given, set the socket to blocking mode. - timeout_ms = 0; - } socket->timeout = timeout_ms; return 0; } From b23178a9c0606d933d231bb8acf4206b153957ce Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Fri, 14 Jan 2022 19:42:00 +0200 Subject: [PATCH 0014/1712] extmod/modusocket: Make setsockopt return if NIC is not connected. --- extmod/modusocket.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extmod/modusocket.c b/extmod/modusocket.c index a42b3213f5..09a334d67e 100644 --- a/extmod/modusocket.c +++ b/extmod/modusocket.c @@ -303,6 +303,11 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom); STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) { mod_network_socket_obj_t *self = MP_OBJ_TO_PTR(args[0]); + if (self->nic == MP_OBJ_NULL) { + // not connected + return mp_const_none; + } + mp_int_t level = mp_obj_get_int(args[1]); mp_int_t opt = mp_obj_get_int(args[2]); From 155eb1361ec18caebc0ef33c115d91209309982a Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sat, 15 Jan 2022 21:32:53 +0200 Subject: [PATCH 0015/1712] extmod/modusocket: Add makefile() method and common socket options. --- extmod/modnetwork.h | 9 +++++++++ extmod/modusocket.c | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/extmod/modnetwork.h b/extmod/modnetwork.h index bbf80bc474..b95760897a 100644 --- a/extmod/modnetwork.h +++ b/extmod/modnetwork.h @@ -38,6 +38,15 @@ #define MOD_NETWORK_STA_IF (0) #define MOD_NETWORK_AP_IF (1) +// Socket level option. +#define MOD_NETWORK_SOL_SOCKET (0x0FFF) + +// Common option flags per-socket. +#define MOD_NETWORK_SO_REUSEADDR (0x0004) +#define MOD_NETWORK_SO_KEEPALIVE (0x0008) +#define MOD_NETWORK_SO_SNDTIMEO (0x1005) +#define MOD_NETWORK_SO_RCVTIMEO (0x1006) + #if MICROPY_PY_LWIP struct netif; void mod_network_lwip_poll_wrapper(uint32_t ticks_ms); diff --git a/extmod/modusocket.c b/extmod/modusocket.c index 09a334d67e..373f2c125f 100644 --- a/extmod/modusocket.c +++ b/extmod/modusocket.c @@ -334,6 +334,12 @@ STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt); +STATIC mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) { + (void)n_args; + return args[0]; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile); + // method socket.settimeout(value) // timeout=0 means non-blocking // timeout=None means blocking @@ -390,6 +396,7 @@ STATIC const mp_rom_map_elem_t socket_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_sendto), MP_ROM_PTR(&socket_sendto_obj) }, { MP_ROM_QSTR(MP_QSTR_recvfrom), MP_ROM_PTR(&socket_recvfrom_obj) }, { MP_ROM_QSTR(MP_QSTR_setsockopt), MP_ROM_PTR(&socket_setsockopt_obj) }, + { MP_ROM_QSTR(MP_QSTR_makefile), MP_ROM_PTR(&socket_makefile_obj) }, { MP_ROM_QSTR(MP_QSTR_settimeout), MP_ROM_PTR(&socket_settimeout_obj) }, { MP_ROM_QSTR(MP_QSTR_setblocking), MP_ROM_PTR(&socket_setblocking_obj) }, @@ -528,6 +535,12 @@ STATIC const mp_rom_map_elem_t mp_module_usocket_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SOCK_DGRAM), MP_ROM_INT(MOD_NETWORK_SOCK_DGRAM) }, { MP_ROM_QSTR(MP_QSTR_SOCK_RAW), MP_ROM_INT(MOD_NETWORK_SOCK_RAW) }, + { MP_ROM_QSTR(MP_QSTR_SOL_SOCKET), MP_ROM_INT(MOD_NETWORK_SOL_SOCKET) }, + { MP_ROM_QSTR(MP_QSTR_SO_REUSEADDR), MP_ROM_INT(MOD_NETWORK_SO_REUSEADDR) }, + { MP_ROM_QSTR(MP_QSTR_SO_KEEPALIVE), MP_ROM_INT(MOD_NETWORK_SO_KEEPALIVE) }, + { MP_ROM_QSTR(MP_QSTR_SO_SNDTIMEO), MP_ROM_INT(MOD_NETWORK_SO_SNDTIMEO) }, + { MP_ROM_QSTR(MP_QSTR_SO_RCVTIMEO), MP_ROM_INT(MOD_NETWORK_SO_RCVTIMEO) }, + /* { MP_ROM_QSTR(MP_QSTR_IPPROTO_IP), MP_ROM_INT(MOD_NETWORK_IPPROTO_IP) }, { MP_ROM_QSTR(MP_QSTR_IPPROTO_ICMP), MP_ROM_INT(MOD_NETWORK_IPPROTO_ICMP) }, From e6ddda29caa3292110c4d18625e791af47ca1e15 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Mon, 17 Jan 2022 15:15:57 +0200 Subject: [PATCH 0016/1712] tests/multi_net: Close accepted sockets when tests are done. gc_sweep_all() cleans up sockets via the finaliser, but tests should cleanly free resources they use. --- tests/multi_net/ssl_data.py | 1 + tests/multi_net/tcp_client_rst.py | 1 + tests/multi_net/tcp_data.py | 1 + 3 files changed, 3 insertions(+) diff --git a/tests/multi_net/ssl_data.py b/tests/multi_net/ssl_data.py index cf2f96e0f3..e5196c81ba 100644 --- a/tests/multi_net/ssl_data.py +++ b/tests/multi_net/ssl_data.py @@ -47,6 +47,7 @@ def instance0(): s2 = ssl.wrap_socket(s2, server_side=True, key=key, cert=cert) print(s2.read(16)) s2.write(b"server to client") + s2.close() s.close() diff --git a/tests/multi_net/tcp_client_rst.py b/tests/multi_net/tcp_client_rst.py index 14da8b1470..1fe994f36c 100644 --- a/tests/multi_net/tcp_client_rst.py +++ b/tests/multi_net/tcp_client_rst.py @@ -38,6 +38,7 @@ def instance0(): # TODO lwip raises here but apparently it shouldn't print(s2.recv(10)) print(convert_poll_list(poll.poll(1000))) + s2.close() s.close() diff --git a/tests/multi_net/tcp_data.py b/tests/multi_net/tcp_data.py index 61224efd2c..bba2d198c4 100644 --- a/tests/multi_net/tcp_data.py +++ b/tests/multi_net/tcp_data.py @@ -15,6 +15,7 @@ def instance0(): s2, _ = s.accept() print(s2.recv(16)) s2.send(b"server to client") + s2.close() s.close() From 6e8f4eaa5252c1a0e7b44238eb168c01abeb7a0e Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Tue, 18 Jan 2022 23:50:53 +0200 Subject: [PATCH 0017/1712] tests/multi_net/udp_data.py: Allow reusing port before bind. --- tests/multi_net/udp_data.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/multi_net/udp_data.py b/tests/multi_net/udp_data.py index fd3e00918f..0c0f165b74 100644 --- a/tests/multi_net/udp_data.py +++ b/tests/multi_net/udp_data.py @@ -12,6 +12,7 @@ def instance0(): multitest.next() for i in range(NUM_NEW_SOCKETS): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind(socket.getaddrinfo("0.0.0.0", PORT)[0][-1]) multitest.broadcast("server ready") for j in range(NUM_TRANSFERS): From a63875d5add278ce37a7cacb917488b4effac8a6 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Tue, 18 Jan 2022 23:56:27 +0200 Subject: [PATCH 0018/1712] extmod/modusocket: Create new sockets in blocking mode. To conform with CPython and other MicroPython ports. --- extmod/modusocket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extmod/modusocket.c b/extmod/modusocket.c index 373f2c125f..10c818bf58 100644 --- a/extmod/modusocket.c +++ b/extmod/modusocket.c @@ -67,7 +67,7 @@ STATIC mp_obj_t socket_make_new(const mp_obj_type_t *type, size_t n_args, size_t } #if MICROPY_PY_USOCKET_EXTENDED_STATE - s->timeout = 0; + s->timeout = -1; s->state = NULL; #endif @@ -88,7 +88,7 @@ STATIC void socket_select_nic(mod_network_socket_obj_t *self, const byte *ip) { #if MICROPY_PY_USOCKET_EXTENDED_STATE // if a timeout was set before binding a NIC, call settimeout to reset it - if (self->timeout != 0 && self->nic_type->settimeout(self, self->timeout, &_errno) != 0) { + if (self->timeout != -1 && self->nic_type->settimeout(self, self->timeout, &_errno) != 0) { mp_raise_OSError(_errno); } #endif @@ -158,7 +158,7 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) { socket2->bound = false; socket2->fileno = -1; #if MICROPY_PY_USOCKET_EXTENDED_STATE - socket2->timeout = 0; + socket2->timeout = -1; socket2->state = NULL; #endif From 1aac151d6894cf892c0ff7bb38e5589580d6c080 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Thu, 20 Jan 2022 17:12:36 +0200 Subject: [PATCH 0019/1712] drivers/ninaw10: Return standard error numbers. --- drivers/ninaw10/nina_wifi_drv.c | 26 ++++++----- drivers/ninaw10/nina_wifi_drv.h | 5 -- extmod/network_ninaw10.c | 82 +++++++++++++++------------------ 3 files changed, 51 insertions(+), 62 deletions(-) diff --git a/drivers/ninaw10/nina_wifi_drv.c b/drivers/ninaw10/nina_wifi_drv.c index 12707fe051..cf09711690 100644 --- a/drivers/ninaw10/nina_wifi_drv.c +++ b/drivers/ninaw10/nina_wifi_drv.c @@ -28,6 +28,7 @@ */ #include "py/mphal.h" +#include "py/mperrno.h" #if MICROPY_PY_NETWORK_NINAW10 @@ -480,7 +481,7 @@ int nina_connected_sta(uint32_t *sta_ip) { } int nina_wait_for_sta(uint32_t *sta_ip, uint32_t timeout) { - return NINA_ERROR_TIMEOUT; + return -MP_ETIMEDOUT; } int nina_ifconfig(nina_ifconfig_t *ifconfig, bool set) { @@ -597,7 +598,7 @@ int nina_scan(nina_scan_callback_t scan_callback, void *arg, uint32_t timeout) { if (timeout && (mp_hal_ticks_ms() - start) >= timeout) { // Timeout, no networks. - return NINA_ERROR_TIMEOUT; + return -MP_ETIMEDOUT; } mp_hal_delay_ms(100); @@ -723,7 +724,7 @@ int nina_socket_close(int fd) { break; } if ((mp_hal_ticks_ms() - start) >= 5000) { - return NINA_ERROR_TIMEOUT; + return -MP_ETIMEDOUT; } } } @@ -777,12 +778,15 @@ int nina_socket_accept(int fd, uint8_t *ip, uint16_t *port, int *fd_out, int32_t return -1; } - for (mp_uint_t start = mp_hal_ticks_ms(); !sock; mp_hal_delay_ms(10)) { + for (mp_uint_t start = mp_hal_ticks_ms(); ; mp_hal_delay_ms(10)) { if (nina_socket_avail(fd, NINA_SOCKET_TYPE_TCP, &sock) != 0) { return -1; } + if (sock != 0) { + break; + } if (timeout == 0 || (timeout > 0 && (mp_hal_ticks_ms() - start) >= timeout)) { - return NINA_ERROR_TIMEOUT; + return -MP_ETIMEDOUT; } } @@ -820,7 +824,7 @@ int nina_socket_connect(int fd, uint8_t *ip, uint16_t port, int32_t timeout) { } if (timeout == 0 || (timeout > 0 && (mp_hal_ticks_ms() - start) >= timeout)) { - return NINA_ERROR_TIMEOUT; + return -MP_ETIMEDOUT; } } @@ -832,7 +836,7 @@ int nina_socket_send(int fd, const uint8_t *buf, uint32_t len, int32_t timeout) uint16_t bytes = 0; if (nina_socket_status(fd) != SOCKET_STATE_ESTABLISHED) { - return -1; + return -MP_ENOTCONN; } if (nina_send_command_read_vals(NINA_CMD_TCP_SEND, @@ -854,7 +858,7 @@ int nina_socket_send(int fd, const uint8_t *buf, uint32_t len, int32_t timeout) } if (timeout == 0 || (timeout > 0 && (mp_hal_ticks_ms() - start) >= timeout)) { - return NINA_ERROR_TIMEOUT; + return -MP_ETIMEDOUT; } mp_hal_delay_ms(1); } @@ -866,7 +870,7 @@ int nina_socket_recv(int fd, uint8_t *buf, uint32_t len, int32_t timeout) { uint16_t bytes = 0; if (nina_socket_status(fd) != SOCKET_STATE_ESTABLISHED) { - return -1; + return -MP_ENOTCONN; } for (mp_uint_t start = mp_hal_ticks_ms(); bytes == 0; mp_hal_delay_ms(1)) { @@ -882,7 +886,7 @@ int nina_socket_recv(int fd, uint8_t *buf, uint32_t len, int32_t timeout) { } if (timeout == 0 || (timeout > 0 && (mp_hal_ticks_ms() - start) >= timeout)) { - return NINA_ERROR_TIMEOUT; + return -MP_ETIMEDOUT; } } return bytes; @@ -934,7 +938,7 @@ int nina_socket_recvfrom(int fd, uint8_t *buf, uint32_t len, uint8_t *ip, uint16 } if (timeout == 0 || (timeout > 0 && (mp_hal_ticks_ms() - start) >= timeout)) { - return NINA_ERROR_TIMEOUT; + return -MP_ETIMEDOUT; } } if (nina_send_command_read_vals(NINA_CMD_SOCKET_REMOTE_ADDR, diff --git a/drivers/ninaw10/nina_wifi_drv.h b/drivers/ninaw10/nina_wifi_drv.h index b8a6c4eb92..b990476b67 100644 --- a/drivers/ninaw10/nina_wifi_drv.h +++ b/drivers/ninaw10/nina_wifi_drv.h @@ -61,11 +61,6 @@ typedef enum { NINA_SOCKET_TYPE_TLS_BEARSSL } nina_socket_type_t; -typedef enum { - NINA_ERROR_IO = -1, - NINA_ERROR_TIMEOUT = -2, -} nina_error_t; - typedef struct { uint8_t ip_addr[NINA_IPV4_ADDR_LEN]; uint8_t subnet_addr[NINA_IPV4_ADDR_LEN]; diff --git a/extmod/network_ninaw10.c b/extmod/network_ninaw10.c index 26b4a811dc..e5d322a953 100644 --- a/extmod/network_ninaw10.c +++ b/extmod/network_ninaw10.c @@ -406,13 +406,12 @@ STATIC int network_ninaw10_socket_accept(mod_network_socket_obj_t *socket, int fd = 0; // Call accept. int ret = nina_socket_accept(socket->fileno, ip, (uint16_t *)port, &fd, socket->timeout); - if (ret == NINA_ERROR_TIMEOUT) { - // The socket is Not closed on timeout when calling functions that accept a timeout. - *_errno = MP_ETIMEDOUT; - return -1; - } else if (ret < 0) { - *_errno = ret; - network_ninaw10_socket_close(socket); + if (ret < 0) { + *_errno = -ret; + // Close socket if not a timeout error. + if (*_errno != MP_ETIMEDOUT) { + network_ninaw10_socket_close(socket); + } return -1; } @@ -424,13 +423,12 @@ STATIC int network_ninaw10_socket_accept(mod_network_socket_obj_t *socket, STATIC int network_ninaw10_socket_connect(mod_network_socket_obj_t *socket, byte *ip, mp_uint_t port, int *_errno) { int ret = nina_socket_connect(socket->fileno, ip, port, socket->timeout); - if (ret == NINA_ERROR_TIMEOUT) { - // The socket is Not closed on timeout when calling functions that accept a timeout. - *_errno = MP_ETIMEDOUT; - return -1; - } else if (ret < 0) { - *_errno = ret; - network_ninaw10_socket_close(socket); + if (ret < 0) { + *_errno = -ret; + // Close socket if not a timeout error. + if (*_errno != MP_ETIMEDOUT) { + network_ninaw10_socket_close(socket); + } return -1; } return 0; @@ -438,14 +436,12 @@ STATIC int network_ninaw10_socket_connect(mod_network_socket_obj_t *socket, byte STATIC mp_uint_t network_ninaw10_socket_send(mod_network_socket_obj_t *socket, const byte *buf, mp_uint_t len, int *_errno) { int ret = nina_socket_send(socket->fileno, buf, len, socket->timeout); - if (ret == NINA_ERROR_TIMEOUT) { - // The socket is Not closed on timeout when calling functions that accept a timeout. - *_errno = MP_ETIMEDOUT; - return -1; - } else if (ret < 0) { - // Close the socket on any other errors. - *_errno = ret; - network_ninaw10_socket_close(socket); + if (ret < 0) { + *_errno = -ret; + // Close socket if not a timeout error. + if (*_errno != MP_ETIMEDOUT) { + network_ninaw10_socket_close(socket); + } return -1; } return ret; @@ -460,15 +456,12 @@ STATIC mp_uint_t network_ninaw10_socket_recv(mod_network_socket_obj_t *socket, b } else { ret = nina_socket_recv(socket->fileno, buf, len, socket->timeout); } - - if (ret == NINA_ERROR_TIMEOUT) { - // The socket is Not closed on timeout when calling functions that accept a timeout. - *_errno = MP_ETIMEDOUT; - return -1; - } else if (ret < 0) { - // Close the socket on any other errors. - *_errno = ret; - network_ninaw10_socket_close(socket); + if (ret < 0) { + *_errno = -ret; + // Close socket if not a timeout error. + if (*_errno != MP_ETIMEDOUT) { + network_ninaw10_socket_close(socket); + } return -1; } return ret; @@ -493,13 +486,12 @@ STATIC mp_uint_t network_ninaw10_socket_sendto(mod_network_socket_obj_t *socket, } int ret = nina_socket_sendto(socket->fileno, buf, len, ip, port, socket->timeout); - if (ret == NINA_ERROR_TIMEOUT) { - // The socket is Not closed on timeout when calling functions that accept a timeout. - *_errno = MP_ETIMEDOUT; - return -1; - } else if (ret < 0) { - *_errno = ret; - network_ninaw10_socket_close(socket); + if (ret < 0) { + *_errno = -ret; + // Close socket if not a timeout error. + if (*_errno != MP_ETIMEDOUT) { + network_ninaw10_socket_close(socket); + } return -1; } return ret; @@ -519,14 +511,12 @@ STATIC mp_uint_t network_ninaw10_socket_recvfrom(mod_network_socket_obj_t *socke } ret = nina_socket_recvfrom(socket->fileno, buf, len, ip, (uint16_t *)port, socket->timeout); } - if (ret == NINA_ERROR_TIMEOUT) { - // The socket is Not closed on timeout when calling functions that accept a timeout. - *_errno = MP_ETIMEDOUT; - return -1; - } else if (ret < 0) { - // Close the socket on any other errors. - *_errno = ret; - network_ninaw10_socket_close(socket); + if (ret < 0) { + *_errno = -ret; + // Close socket if not a timeout error. + if (*_errno != MP_ETIMEDOUT) { + network_ninaw10_socket_close(socket); + } return -1; } return ret; From 9438fb7321f1f0fb9faae666808e86d7f47b8619 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 21 Jan 2022 12:44:49 +1100 Subject: [PATCH 0020/1712] extmod/modusocket: Support additional args to getaddrinfo. Signed-off-by: Damien George --- extmod/modusocket.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/extmod/modusocket.c b/extmod/modusocket.c index 10c818bf58..b6bab72e7a 100644 --- a/extmod/modusocket.c +++ b/extmod/modusocket.c @@ -472,18 +472,41 @@ STATIC const mp_obj_type_t socket_type = { // usocket module // function usocket.getaddrinfo(host, port) -STATIC mp_obj_t mod_usocket_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) { +STATIC mp_obj_t mod_usocket_getaddrinfo(size_t n_args, const mp_obj_t *args) { size_t hlen; - const char *host = mp_obj_str_get_data(host_in, &hlen); - mp_int_t port = mp_obj_get_int(port_in); + const char *host = mp_obj_str_get_data(args[0], &hlen); + mp_int_t port = mp_obj_get_int(args[1]); uint8_t out_ip[MOD_NETWORK_IPADDR_BUF_SIZE]; bool have_ip = false; + // if constraints were passed then check they are compatible with the supported params + if (n_args > 2) { + mp_int_t family = mp_obj_get_int(args[2]); + mp_int_t type = 0; + mp_int_t proto = 0; + mp_int_t flags = 0; + if (n_args > 3) { + type = mp_obj_get_int(args[3]); + if (n_args > 4) { + proto = mp_obj_get_int(args[4]); + if (n_args > 5) { + flags = mp_obj_get_int(args[5]); + } + } + } + if (!((family == 0 || family == MOD_NETWORK_AF_INET) + && (type == 0 || type == MOD_NETWORK_SOCK_STREAM) + && proto == 0 + && flags == 0)) { + mp_warning(MP_WARN_CAT(RuntimeWarning), "unsupported getaddrinfo constraints"); + } + } + if (hlen > 0) { // check if host is already in IP form nlr_buf_t nlr; if (nlr_push(&nlr) == 0) { - netutils_parse_ipv4_addr(host_in, out_ip, NETUTILS_BIG); + netutils_parse_ipv4_addr(args[0], out_ip, NETUTILS_BIG); have_ip = true; nlr_pop(); } else { @@ -519,7 +542,7 @@ STATIC mp_obj_t mod_usocket_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) { tuple->items[4] = netutils_format_inet_addr(out_ip, port, NETUTILS_BIG); return mp_obj_new_list(1, (mp_obj_t *)&tuple); } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_usocket_getaddrinfo_obj, mod_usocket_getaddrinfo); +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_usocket_getaddrinfo_obj, 2, 6, mod_usocket_getaddrinfo); STATIC const mp_rom_map_elem_t mp_module_usocket_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_usocket) }, From bef26d4e3fee7f00758d6e3ae7aa187b80d7878c Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Thu, 20 Jan 2022 20:45:31 +0200 Subject: [PATCH 0021/1712] rp2/machine_uart: Add machine.UART init/deinit methods. Without these methods a lot of existing "portable" scripts are broken. This change improves portability by making rp2 machine.UART more compliant with the documented machine UART interface. --- ports/rp2/machine_uart.c | 66 +++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 17 deletions(-) diff --git a/ports/rp2/machine_uart.c b/ports/rp2/machine_uart.c index 887954276e..283c12ed54 100644 --- a/ports/rp2/machine_uart.c +++ b/ports/rp2/machine_uart.c @@ -162,11 +162,10 @@ STATIC void machine_uart_print(const mp_print_t *print, mp_obj_t self_in, mp_pri self->timeout, self->timeout_char, _invert_name[self->invert]); } -STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_id, ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_tx, ARG_rx, ARG_cts, ARG_rts, +STATIC void machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_tx, ARG_rx, ARG_cts, ARG_rts, ARG_timeout, ARG_timeout_char, ARG_invert, ARG_flow, ARG_txbuf, ARG_rxbuf}; static const mp_arg_t allowed_args[] = { - { MP_QSTR_id, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} }, { MP_QSTR_baudrate, MP_ARG_INT, {.u_int = -1} }, { MP_QSTR_bits, MP_ARG_INT, {.u_int = -1} }, { MP_QSTR_parity, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_INT(-1)} }, @@ -185,16 +184,7 @@ STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, // Parse args. mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - // Get UART bus. - int uart_id = mp_obj_get_int(args[ARG_id].u_obj); - if (uart_id < 0 || uart_id >= MP_ARRAY_SIZE(machine_uart_obj)) { - mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("UART(%d) doesn't exist"), uart_id); - } - - // Get static peripheral object. - machine_uart_obj_t *self = (machine_uart_obj_t *)&machine_uart_obj[uart_id]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); // Set baudrate if configured. if (args[ARG_baudrate].u_int > 0) { @@ -305,7 +295,7 @@ STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, } // Initialise the UART peripheral if any arguments given, or it was not initialised previously. - if (n_args > 1 || n_kw > 0 || self->baudrate == 0) { + if (n_args > 0 || kw_args->used > 0 || self->baudrate == 0) { if (self->baudrate == 0) { self->baudrate = DEFAULT_UART_BAUDRATE; } @@ -339,10 +329,10 @@ STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, // Allocate the RX/TX buffers. ringbuf_alloc(&(self->read_buffer), rxbuf_len + 1); - MP_STATE_PORT(rp2_uart_rx_buffer[uart_id]) = self->read_buffer.buf; + MP_STATE_PORT(rp2_uart_rx_buffer[self->uart_id]) = self->read_buffer.buf; ringbuf_alloc(&(self->write_buffer), txbuf_len + 1); - MP_STATE_PORT(rp2_uart_tx_buffer[uart_id]) = self->write_buffer.buf; + MP_STATE_PORT(rp2_uart_tx_buffer[self->uart_id]) = self->write_buffer.buf; // Set the irq handler. if (self->uart_id == 0) { @@ -356,10 +346,50 @@ STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, // Enable the uart irq; this macro sets the rx irq level to 4. uart_set_irq_enables(self->uart, true, true); } +} + +STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { + mp_arg_check_num(n_args, n_kw, 1, MP_OBJ_FUN_ARGS_MAX, true); + + // Get UART bus. + int uart_id = mp_obj_get_int(args[0]); + if (uart_id < 0 || uart_id >= MP_ARRAY_SIZE(machine_uart_obj)) { + mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("UART(%d) doesn't exist"), uart_id); + } + + // Get static peripheral object. + machine_uart_obj_t *self = (machine_uart_obj_t *)&machine_uart_obj[uart_id]; + + // Initialise the UART peripheral. + mp_map_t kw_args; + mp_map_init_fixed_table(&kw_args, n_kw, args + n_args); + machine_uart_init_helper(self, n_args - 1, args + 1, &kw_args); return MP_OBJ_FROM_PTR(self); } +STATIC mp_obj_t machine_uart_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) { + // Initialise the UART peripheral. + machine_uart_init_helper(args[0], n_args - 1, args + 1, kw_args); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(machine_uart_init_obj, 1, machine_uart_init); + +STATIC mp_obj_t machine_uart_deinit(mp_obj_t self_in) { + machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in); + uart_deinit(self->uart); + if (self->uart_id == 0) { + irq_set_enabled(UART0_IRQ, false); + } else { + irq_set_enabled(UART1_IRQ, false); + } + self->baudrate = 0; + MP_STATE_PORT(rp2_uart_rx_buffer[self->uart_id]) = NULL; + MP_STATE_PORT(rp2_uart_tx_buffer[self->uart_id]) = NULL; + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_deinit_obj, machine_uart_deinit); + STATIC mp_obj_t machine_uart_any(mp_obj_t self_in) { machine_uart_obj_t *self = MP_OBJ_TO_PTR(self_in); // get all bytes from the fifo first @@ -380,8 +410,10 @@ STATIC mp_obj_t machine_uart_sendbreak(mp_obj_t self_in) { STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_uart_sendbreak_obj, machine_uart_sendbreak); STATIC const mp_rom_map_elem_t machine_uart_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_any), MP_ROM_PTR(&machine_uart_any_obj) }, + { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_uart_init_obj) }, + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_uart_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR_any), MP_ROM_PTR(&machine_uart_any_obj) }, { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&mp_stream_read_obj) }, { MP_ROM_QSTR(MP_QSTR_readline), MP_ROM_PTR(&mp_stream_unbuffered_readline_obj) }, { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) }, From a707fe50b085ec83722106609f6fd219faf9f030 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 21 Jan 2022 14:52:03 +1100 Subject: [PATCH 0022/1712] rp2/machine_i2c: Use soft I2C only for len=0, and increase timeout. The RP2040 I2C hardware can do writes of length 1 and 2, just not of length 0. So only use software I2C for writes of length 0, to improve performance. Also increase the software I2C timeout for zero-length writes to accommodate the behaviour of a wider range of I2C devices. Fixes issue #8167. Signed-off-by: Damien George --- ports/rp2/machine_i2c.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/rp2/machine_i2c.c b/ports/rp2/machine_i2c.c index 56f012a5e8..f785ad7ded 100644 --- a/ports/rp2/machine_i2c.c +++ b/ports/rp2/machine_i2c.c @@ -127,12 +127,12 @@ STATIC int machine_i2c_transfer_single(mp_obj_base_t *self_in, uint16_t addr, si if (flags & MP_MACHINE_I2C_FLAG_READ) { ret = i2c_read_blocking(self->i2c_inst, addr, buf, len, nostop); } else { - if (len <= 2) { - // Workaround issue with hardware I2C not accepting short writes. + if (len == 0) { + // Workaround issue with hardware I2C not accepting zero-length writes. mp_machine_soft_i2c_obj_t soft_i2c = { .base = { &mp_machine_soft_i2c_type }, .us_delay = 500000 / self->freq + 1, - .us_timeout = 255, + .us_timeout = 50000, .scl = self->scl, .sda = self->sda, }; From 7d71ae25edc4b405dd03222f044bc7cf3b77f956 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 21 Jan 2022 14:59:13 +1100 Subject: [PATCH 0023/1712] extmod/machine_i2c: Increase default SoftI2C timeout to 50ms. Some devices, eg BNO055, can stretch SCL for a long time, so make the default large to accommodate them. 50ms matches the current default for stm32 hardware I2C . Signed-off-by: Damien George --- docs/library/machine.I2C.rst | 2 +- extmod/machine_i2c.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/library/machine.I2C.rst b/docs/library/machine.I2C.rst index f46d64ef51..82a88390c3 100644 --- a/docs/library/machine.I2C.rst +++ b/docs/library/machine.I2C.rst @@ -57,7 +57,7 @@ Constructors of *scl* and *sda* that cannot be changed. .. _machine.SoftI2C: -.. class:: SoftI2C(scl, sda, *, freq=400000, timeout=255) +.. class:: SoftI2C(scl, sda, *, freq=400000, timeout=50000) Construct a new software I2C object. The parameters are: diff --git a/extmod/machine_i2c.c b/extmod/machine_i2c.c index b2e39c534d..2b1275e5bb 100644 --- a/extmod/machine_i2c.c +++ b/extmod/machine_i2c.c @@ -33,6 +33,8 @@ #include "py/runtime.h" #include "extmod/machine_i2c.h" +#define SOFT_I2C_DEFAULT_TIMEOUT_US (50000) // 50ms + #if MICROPY_PY_MACHINE_SOFTI2C typedef mp_machine_soft_i2c_obj_t machine_i2c_obj_t; @@ -651,7 +653,7 @@ STATIC void mp_machine_soft_i2c_init(mp_obj_base_t *self_in, size_t n_args, cons { MP_QSTR_scl, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_sda, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_freq, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 400000} }, - { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 255} }, + { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = SOFT_I2C_DEFAULT_TIMEOUT_US} }, }; mp_machine_soft_i2c_obj_t *self = (mp_machine_soft_i2c_obj_t *)self_in; From 4d2f487ee1ac93098b90c3108b071f6e855c9e7f Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 21 Jan 2022 22:29:11 +1100 Subject: [PATCH 0024/1712] docs/library: Specify additional ADC methods and new ADCBlock class. The new ADC methods are: init(), read_uv() and block(). The new ADCBlock class has methods: init() and connect(). See related discussions in #3943, #4213. Signed-off-by: Damien George --- docs/library/machine.ADC.rst | 39 ++++++++++++++++++--- docs/library/machine.ADCBlock.rst | 58 +++++++++++++++++++++++++++++++ docs/library/machine.rst | 1 + 3 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 docs/library/machine.ADCBlock.rst diff --git a/docs/library/machine.ADC.rst b/docs/library/machine.ADC.rst index 1404b454ae..eb538a4424 100644 --- a/docs/library/machine.ADC.rst +++ b/docs/library/machine.ADC.rst @@ -8,28 +8,59 @@ The ADC class provides an interface to analog-to-digital convertors, and represents a single endpoint that can sample a continuous voltage and convert it to a discretised value. +For extra control over ADC sampling see :ref:`machine.ADCBlock `. + Example usage:: - import machine + from machine import ADC - adc = machine.ADC(pin) # create an ADC object acting on a pin - val = adc.read_u16() # read a raw analog value in the range 0-65535 + adc = ADC(pin) # create an ADC object acting on a pin + val = adc.read_u16() # read a raw analog value in the range 0-65535 + val = adc.read_uv() # read an analog value in microvolts Constructors ------------ -.. class:: ADC(id) +.. class:: ADC(id, *, sample_ns, atten) Access the ADC associated with a source identified by *id*. This *id* may be an integer (usually specifying a channel number), a :ref:`Pin ` object, or other value supported by the underlying machine. + If additional keyword-arguments are given then they will configure + various aspects of the ADC. If not given, these settings will take + previous or default values. The settings are: + + - *sample_ns* is the sampling time in nanoseconds. + + - *atten* specifies the input attenuation. + Methods ------- +.. method:: ADC.init(*, sample_ns, atten) + + Apply the given settings to the ADC. Only those arguments that are + specified will be changed. See the ADC constructor above for what the + arguments are. + +.. method:: ADC.block() + + Return the :ref:`ADCBlock ` instance associated with + this ADC object. + + This method only exists if the port supports the + :ref:`ADCBlock ` class. + .. method:: ADC.read_u16() Take an analog reading and return an integer in the range 0-65535. The return value represents the raw reading taken by the ADC, scaled such that the minimum value is 0 and the maximum value is 65535. + +.. method:: ADC.read_uv() + + Take an analog reading and return an integer value with units of + microvolts. It is up to the particular port whether or not this value + is calibrated, and how calibration is done. diff --git a/docs/library/machine.ADCBlock.rst b/docs/library/machine.ADCBlock.rst new file mode 100644 index 0000000000..56a468dd62 --- /dev/null +++ b/docs/library/machine.ADCBlock.rst @@ -0,0 +1,58 @@ +.. currentmodule:: machine +.. _machine.ADCBlock: + +class ADCBlock -- control ADC peripherals +========================================= + +The ADCBlock class provides access to an ADC peripheral which has a +number of channels that can be used to sample analog values. It allows +finer control over configuration of :ref:`machine.ADC ` +objects, which do the actual sampling. + +This class is not always available. + +Example usage:: + + from machine import ADCBlock + + block = ADCBlock(id, bits=12) # create an ADCBlock with 12-bit resolution + adc = block.connect(4, pin) # connect channel 4 to the given pin + val = adc.read_uv() # read an analog value + +Constructors +------------ + +.. class:: ADCBlock(id, *, bits) + + Access the ADC peripheral identified by *id*, which may be an integer + or string. + + The *bits* argument, if given, sets the resolution in bits of the + conversion process. If not specified then the previous or default + resolution is used. + +Methods +------- + +.. method:: ADCBlock.init(*, bits) + + Configure the ADC peripheral. *bits* will set the resolution of the + conversion process. + +.. method:: ADCBlock.connect(channel) + ADCBlock.connect(source) + ADCBlock.connect(channel, source) + + Connect up a channel on the ADC peripheral so it is ready for sampling, + and return an :ref:`ADC ` object that represents that connection. + + The *channel* argument must be an integer, and *source* must be an object + (for example a :ref:`Pin `) which can be connected up for sampling. + + If only *channel* is given then it is configured for sampling. + + If only *source* is given then that object is connected to a default + channel ready for sampling. + + If both *channel* and *source* are given then they are connected together + and made ready for sampling. diff --git a/docs/library/machine.rst b/docs/library/machine.rst index 5f45168ed6..d66423d0d4 100644 --- a/docs/library/machine.rst +++ b/docs/library/machine.rst @@ -199,6 +199,7 @@ Classes machine.Pin.rst machine.Signal.rst machine.ADC.rst + machine.ADCBlock.rst machine.PWM.rst machine.UART.rst machine.SPI.rst From 3300d6d3370dcd64d7212d6d977edcba42432234 Mon Sep 17 00:00:00 2001 From: Jonathan Hogg Date: Tue, 21 Dec 2021 13:25:55 +0000 Subject: [PATCH 0025/1712] docs/esp32: Document expanded ADC API in quickref. Document read_u16(), read_uv() and ADCBlock(). Mark old read(), atten() and width() methods as legacy. --- docs/esp32/quickref.rst | 105 +++++++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 34 deletions(-) diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst index 337f87b66f..94b5d966ed 100644 --- a/docs/esp32/quickref.rst +++ b/docs/esp32/quickref.rst @@ -264,54 +264,91 @@ See more examples in the :ref:`esp32_pwm` tutorial. ADC (analog to digital conversion) ---------------------------------- -On the ESP32 ADC functionality is available on Pins 32-39. Note that, when -using the default configuration, input voltages on the ADC pin must be between -0.0v and 1.0v (anything above 1.0v will just read as 4095). Attenuation must -be applied in order to increase this usable voltage range. +On the ESP32 ADC functionality is available on pins 32-39 (ADC block 1) and pins +0, 2, 4, 12-15 and 25-27 (ADC block 2). Use the :ref:`machine.ADC ` class:: from machine import ADC - adc = ADC(Pin(32)) # create ADC object on ADC pin - adc.read() # read value, 0-4095 across voltage range 0.0v - 1.0v + adc = ADC(Pin(32)) # create ADC object for pin 32 + adc.read_u16() # read raw value, 0-65535 - adc.atten(ADC.ATTN_11DB) # set 11dB input attenuation (voltage range roughly 0.0v - 3.6v) - adc.width(ADC.WIDTH_9BIT) # set 9 bit return values (returned range 0-511) - adc.read() # read value using the newly configured attenuation and width +Note that the ESP32 uses an internal ADC reference voltage of 1.0v. To read +voltages above this value, input attenuation can be applied with the optional +``atten`` keyword argument to the constructor. Valid values are: -ESP32 specific ADC class method reference: + - ``ADC.ATTN_0DB``: No attenuation, this is the default + - ``ADC.ATTN_2_5DB``: 2.5dB attenuation, gives a maximum input voltage of + approximately 1.33v + - ``ADC.ATTN_6DB``: 6dB attenuation, gives a maximum input voltage of + approximately 2.00v + - ``ADC.ATTN_11DB``: 11dB attenuation, gives a maximum input voltage of + approximately 3.55v + +E.g.:: + + adc = ADC(Pin(25), atten=ADC.ATTEN_11DB) # 0.0v - 3.55v range + +.. Warning:: + Note that, although 11dB attenuation allows for a voltage range up to 3.55v, + the absolute maximum voltage rating for input pins is 3.6v, and so going + near this boundary risks damage to the IC! + +ESP32-specific ADC class method reference: + +.. method:: ADC.init(*, atten) + + Re-initialize the ADC pin with a different input attenuation. + +.. method:: ADC.read_uv() + + This method uses internal per-package calibration values - set during + manufacture - to return the ADC input voltage in microvolts, taking into + account any input attenuation applied. Note that the calibration curves do + not guarantee that an input tied to ground will read as 0, and the returned + values have only millivolt resolution. + +.. method:: ADC.block() + + Return the matching ``ADCBlock`` object. + +.. class:: ADCBlock(id, *, bits) + + Return the ADC block object with the given ``id`` (1 or 2) and initialize + it to the specified resolution (9 to 12-bits) or the default 12-bits. + +.. method:: ADCBlock.init(*, bits) + + Re-initialize the ADC block with a specific resolution. + +.. method:: ADCBlock.connect(channel_or_pin) + + Return the ``ADC`` object for the specified ADC channel number or Pin object. + +Legacy API methods: + +.. method:: ADC.read() + + This method returns the raw ADC value ranged according to the resolution of + the ADC block, 0-4095 for the default 12-bit resolution. .. method:: ADC.atten(attenuation) - This method allows for the setting of the amount of attenuation on the - input of the ADC. This allows for a wider possible input voltage range, - at the cost of accuracy (the same number of bits now represents a wider - range). The possible attenuation options are: - - - ``ADC.ATTN_0DB``: 0dB attenuation, gives a maximum input voltage - of 1.00v - this is the default configuration - - ``ADC.ATTN_2_5DB``: 2.5dB attenuation, gives a maximum input voltage - of approximately 1.34v - - ``ADC.ATTN_6DB``: 6dB attenuation, gives a maximum input voltage - of approximately 2.00v - - ``ADC.ATTN_11DB``: 11dB attenuation, gives a maximum input voltage - of approximately 3.6v - -.. Warning:: - Despite 11dB attenuation allowing for up to a 3.6v range, note that the - absolute maximum voltage rating for the input pins is 3.6v, and so going - near this boundary may be damaging to the IC! + Equivalent to ``ADC.init(atten=attenuation)``. .. method:: ADC.width(width) - This method allows for the setting of the number of bits to be utilised - and returned during ADC reads. Possible width options are: + Equivalent to ``ADC.block().init(bits=width)``. + +For compatibility, the ``ADC`` object also provides constants matching the +supported ADC resolutions: + + - ``ADC.WIDTH_9BIT`` = 9 + - ``ADC.WIDTH_10BIT`` = 10 + - ``ADC.WIDTH_11BIT`` = 11 + - ``ADC.WIDTH_12BIT`` = 12 - - ``ADC.WIDTH_9BIT``: 9 bit data - - ``ADC.WIDTH_10BIT``: 10 bit data - - ``ADC.WIDTH_11BIT``: 11 bit data - - ``ADC.WIDTH_12BIT``: 12 bit data - this is the default configuration Software SPI bus ---------------- From 63438a31bb6d0c8012e338433df95700f1cbca97 Mon Sep 17 00:00:00 2001 From: Jonathan Hogg Date: Tue, 21 Dec 2021 15:15:24 +0000 Subject: [PATCH 0026/1712] esp32/machine_adcblock: Add new machine.ADCBlock class and update ADC. Rework the ADC implementation to follow the improved ADC/ADCBlock API. This adds support for calibrated voltage readings and the ADC2 block. The ADC API is backwards compatible with what it was before this change. Resolves #6219. --- ports/esp32/boards/sdkconfig.base | 5 + ports/esp32/machine_adc.c | 295 +++++++++++++++++------------- ports/esp32/machine_adc.h | 16 ++ ports/esp32/machine_adcblock.c | 203 ++++++++++++++++++++ ports/esp32/machine_adcblock.h | 20 ++ ports/esp32/main/CMakeLists.txt | 2 + ports/esp32/modmachine.c | 1 + ports/esp32/modmachine.h | 1 + 8 files changed, 414 insertions(+), 129 deletions(-) create mode 100644 ports/esp32/machine_adc.h create mode 100644 ports/esp32/machine_adcblock.c create mode 100644 ports/esp32/machine_adcblock.h diff --git a/ports/esp32/boards/sdkconfig.base b/ports/esp32/boards/sdkconfig.base index 71229e8beb..4b29013434 100644 --- a/ports/esp32/boards/sdkconfig.base +++ b/ports/esp32/boards/sdkconfig.base @@ -58,3 +58,8 @@ CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" # To reduce iRAM usage CONFIG_ESP32_WIFI_IRAM_OPT=n CONFIG_ESP32_WIFI_RX_IRAM_OPT=n + +# ADC calibration +CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y +CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y +CONFIG_ADC_CAL_LUT_ENABLE=y diff --git a/ports/esp32/machine_adc.c b/ports/esp32/machine_adc.c index 6731978e28..f6bc7b9639 100644 --- a/ports/esp32/machine_adc.c +++ b/ports/esp32/machine_adc.c @@ -4,6 +4,7 @@ * The MIT License (MIT) * * Copyright (c) 2017 Nick Moore + * Copyright (c) 2021 Jonathan Hogg * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -24,7 +25,6 @@ * THE SOFTWARE. */ - #include #include "esp_log.h" @@ -35,176 +35,213 @@ #include "py/runtime.h" #include "py/mphal.h" #include "modmachine.h" +#include "machine_adc.h" -typedef struct _madc_obj_t { - mp_obj_base_t base; - gpio_num_t gpio_id; - adc1_channel_t adc1_id; -} madc_obj_t; +#define ADCBLOCK1 (&madcblock_obj[0]) +#define ADCBLOCK2 (&madcblock_obj[1]) STATIC const madc_obj_t madc_obj[] = { #if CONFIG_IDF_TARGET_ESP32 - {{&machine_adc_type}, GPIO_NUM_36, ADC1_CHANNEL_0}, - {{&machine_adc_type}, GPIO_NUM_37, ADC1_CHANNEL_1}, - {{&machine_adc_type}, GPIO_NUM_38, ADC1_CHANNEL_2}, - {{&machine_adc_type}, GPIO_NUM_39, ADC1_CHANNEL_3}, - {{&machine_adc_type}, GPIO_NUM_32, ADC1_CHANNEL_4}, - {{&machine_adc_type}, GPIO_NUM_33, ADC1_CHANNEL_5}, - {{&machine_adc_type}, GPIO_NUM_34, ADC1_CHANNEL_6}, - {{&machine_adc_type}, GPIO_NUM_35, ADC1_CHANNEL_7}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_0, GPIO_NUM_36}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_1, GPIO_NUM_37}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_2, GPIO_NUM_38}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_3, GPIO_NUM_39}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_4, GPIO_NUM_32}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_5, GPIO_NUM_33}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_6, GPIO_NUM_34}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_7, GPIO_NUM_35}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_0, GPIO_NUM_0}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_1, GPIO_NUM_2}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_2, GPIO_NUM_4}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_3, GPIO_NUM_12}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_4, GPIO_NUM_13}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_5, GPIO_NUM_14}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_6, GPIO_NUM_15}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_7, GPIO_NUM_25}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_8, GPIO_NUM_26}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_9, GPIO_NUM_27}, #elif CONFIG_IDF_TARGET_ESP32C3 - {{&machine_adc_type}, GPIO_NUM_0, ADC1_CHANNEL_0}, - {{&machine_adc_type}, GPIO_NUM_1, ADC1_CHANNEL_1}, - {{&machine_adc_type}, GPIO_NUM_2, ADC1_CHANNEL_2}, - {{&machine_adc_type}, GPIO_NUM_3, ADC1_CHANNEL_3}, - {{&machine_adc_type}, GPIO_NUM_4, ADC1_CHANNEL_4}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_0, GPIO_NUM_0}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_1, GPIO_NUM_1}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_2, GPIO_NUM_2}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_3, GPIO_NUM_3}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_4, GPIO_NUM_4}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_0, GPIO_NUM_5}, #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 - {{&machine_adc_type}, GPIO_NUM_1, ADC1_CHANNEL_0}, - {{&machine_adc_type}, GPIO_NUM_2, ADC1_CHANNEL_1}, - {{&machine_adc_type}, GPIO_NUM_3, ADC1_CHANNEL_2}, - {{&machine_adc_type}, GPIO_NUM_4, ADC1_CHANNEL_3}, - {{&machine_adc_type}, GPIO_NUM_5, ADC1_CHANNEL_4}, - {{&machine_adc_type}, GPIO_NUM_6, ADC1_CHANNEL_5}, - {{&machine_adc_type}, GPIO_NUM_7, ADC1_CHANNEL_6}, - {{&machine_adc_type}, GPIO_NUM_8, ADC1_CHANNEL_7}, - {{&machine_adc_type}, GPIO_NUM_9, ADC1_CHANNEL_8}, - {{&machine_adc_type}, GPIO_NUM_10, ADC1_CHANNEL_9}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_0, GPIO_NUM_1}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_1, GPIO_NUM_2}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_2, GPIO_NUM_3}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_3, GPIO_NUM_4}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_4, GPIO_NUM_5}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_5, GPIO_NUM_6}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_6, GPIO_NUM_7}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_7, GPIO_NUM_8}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_8, GPIO_NUM_9}, + {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_9, GPIO_NUM_10}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_0, GPIO_NUM_11}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_1, GPIO_NUM_12}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_2, GPIO_NUM_13}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_3, GPIO_NUM_14}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_4, GPIO_NUM_15}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_5, GPIO_NUM_16}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_6, GPIO_NUM_17}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_7, GPIO_NUM_18}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_8, GPIO_NUM_19}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_9, GPIO_NUM_20}, #endif }; -STATIC uint8_t adc_bit_width; +STATIC adc_atten_t madc_obj_atten[MP_ARRAY_SIZE(madc_obj)]; -STATIC mp_obj_t madc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, - const mp_obj_t *args) { - - static int initialized = 0; - if (!initialized) { - #if CONFIG_IDF_TARGET_ESP32S2 - adc1_config_width(ADC_WIDTH_BIT_13); - #else - adc1_config_width(ADC_WIDTH_BIT_12); - #endif - adc_bit_width = 12; - initialized = 1; - } - - mp_arg_check_num(n_args, n_kw, 1, 1, true); - gpio_num_t pin_id = machine_pin_get_id(args[0]); - const madc_obj_t *self = NULL; +const madc_obj_t *madc_search_helper(madcblock_obj_t *block, adc_channel_t channel_id, gpio_num_t gpio_id) { for (int i = 0; i < MP_ARRAY_SIZE(madc_obj); i++) { - if (pin_id == madc_obj[i].gpio_id) { - self = &madc_obj[i]; - break; + const madc_obj_t *adc = &madc_obj[i]; + if ((block == NULL || block == adc->block) && (channel_id == -1 || channel_id == adc->channel_id) && (gpio_id == -1 || gpio_id == adc->gpio_id)) { + return adc; } } - if (!self) { - mp_raise_ValueError(MP_ERROR_TEXT("invalid Pin for ADC")); - } - esp_err_t err = adc1_config_channel_atten(self->adc1_id, ADC_ATTEN_0db); - if (err == ESP_OK) { - return MP_OBJ_FROM_PTR(self); - } - mp_raise_ValueError(MP_ERROR_TEXT("parameter error")); + return NULL; } STATIC void madc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { - madc_obj_t *self = self_in; - mp_printf(print, "ADC(Pin(%u))", self->gpio_id); + const madc_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_printf(print, "ADC(Pin(%u), atten=%u)", self->gpio_id, madc_obj_atten[self - madc_obj]); } -// read_u16() +STATIC void madc_atten_helper(const madc_obj_t *self, mp_int_t atten) { + esp_err_t err; + if (self->block->unit_id == ADC_UNIT_1) { + err = adc1_config_channel_atten(self->channel_id, atten); + } else { + err = adc2_config_channel_atten(self->channel_id, atten); + } + if (err != ESP_OK) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid atten")); + } + madc_obj_atten[self - madc_obj] = atten; +} + +void madc_init_helper(const madc_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { + ARG_atten, + }; + + static const mp_arg_t allowed_args[] = { + { MP_QSTR_atten, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_pos_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_int_t atten = args[ARG_atten].u_int; + if (atten != -1) { + madc_atten_helper(self, atten); + } else if (madc_obj_atten[self - madc_obj] == -1) { + madc_atten_helper(self, ADC_ATTEN_DB_0); + } +} + +STATIC mp_obj_t madc_make_new(const mp_obj_type_t *type, size_t n_pos_args, size_t n_kw_args, const mp_obj_t *args) { + mp_arg_check_num(n_pos_args, n_kw_args, 1, MP_OBJ_FUN_ARGS_MAX, true); + gpio_num_t gpio_id = machine_pin_get_id(args[0]); + const madc_obj_t *self = madc_search_helper(NULL, -1, gpio_id); + if (!self) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid pin")); + } + + if (self->block->width == -1) { + madcblock_bits_helper(self->block, self->block->bits); + } + + mp_map_t kw_args; + mp_map_init_fixed_table(&kw_args, n_kw_args, args + n_pos_args); + madc_init_helper(self, n_pos_args - 1, args + 1, &kw_args); + + return MP_OBJ_FROM_PTR(self); +} + +STATIC mp_obj_t madc_init(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + const madc_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + madc_init_helper(self, n_pos_args - 1, pos_args + 1, kw_args); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(madc_init_obj, 1, madc_init); + +STATIC mp_obj_t madc_block(mp_obj_t self_in) { + const madc_obj_t *self = MP_OBJ_TO_PTR(self_in); + return MP_OBJ_FROM_PTR(self->block); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(madc_block_obj, madc_block); + +STATIC mp_obj_t madc_read(mp_obj_t self_in) { + const madc_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_int_t raw = madcblock_read_helper(self->block, self->channel_id); + return MP_OBJ_NEW_SMALL_INT(raw); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(madc_read_obj, madc_read); + STATIC mp_obj_t madc_read_u16(mp_obj_t self_in) { - madc_obj_t *self = MP_OBJ_TO_PTR(self_in); - uint32_t raw = adc1_get_raw(self->adc1_id); + const madc_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_uint_t raw = madcblock_read_helper(self->block, self->channel_id); // Scale raw reading to 16 bit value using a Taylor expansion (for 8 <= bits <= 16) - uint32_t u16 = raw << (16 - adc_bit_width) | raw >> (2 * adc_bit_width - 16); + mp_int_t bits = self->block->bits; + mp_uint_t u16 = raw << (16 - bits) | raw >> (2 * bits - 16); return MP_OBJ_NEW_SMALL_INT(u16); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(madc_read_u16_obj, madc_read_u16); -// Legacy method -STATIC mp_obj_t madc_read(mp_obj_t self_in) { - madc_obj_t *self = self_in; - int val = adc1_get_raw(self->adc1_id); - if (val == -1) { - mp_raise_ValueError(MP_ERROR_TEXT("parameter error")); - } - return MP_OBJ_NEW_SMALL_INT(val); +STATIC mp_obj_t madc_read_uv(mp_obj_t self_in) { + const madc_obj_t *self = MP_OBJ_TO_PTR(self_in); + adc_atten_t atten = madc_obj_atten[self - madc_obj]; + return MP_OBJ_NEW_SMALL_INT(madcblock_read_uv_helper(self->block, self->channel_id, atten)); } -MP_DEFINE_CONST_FUN_OBJ_1(madc_read_obj, madc_read); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(madc_read_uv_obj, madc_read_uv); STATIC mp_obj_t madc_atten(mp_obj_t self_in, mp_obj_t atten_in) { - madc_obj_t *self = self_in; - adc_atten_t atten = mp_obj_get_int(atten_in); - esp_err_t err = adc1_config_channel_atten(self->adc1_id, atten); - if (err == ESP_OK) { - return mp_const_none; - } - mp_raise_ValueError(MP_ERROR_TEXT("parameter error")); + const madc_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_int_t atten = mp_obj_get_int(atten_in); + madc_atten_helper(self, atten); + return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_2(madc_atten_obj, madc_atten); -STATIC mp_obj_t madc_width(mp_obj_t cls_in, mp_obj_t width_in) { - adc_bits_width_t width = mp_obj_get_int(width_in); - esp_err_t err = adc1_config_width(width); - if (err != ESP_OK) { - mp_raise_ValueError(MP_ERROR_TEXT("parameter error")); - } - switch (width) { - #if CONFIG_IDF_TARGET_ESP32 - case ADC_WIDTH_9Bit: - adc_bit_width = 9; - break; - case ADC_WIDTH_10Bit: - adc_bit_width = 10; - break; - case ADC_WIDTH_11Bit: - adc_bit_width = 11; - break; - case ADC_WIDTH_12Bit: - adc_bit_width = 12; - break; - #elif CONFIG_IDF_TARGET_ESP32S2 - case ADC_WIDTH_BIT_13: - adc_bit_width = 13; - break; - #elif CONFIG_IDF_TARGET_ESP32S3 - case ADC_WIDTH_BIT_12: - adc_bit_width = 12; - break; - #endif - default: - break; - } +STATIC mp_obj_t madc_width(mp_obj_t self_in, mp_obj_t bits_in) { + const madc_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_int_t bits = mp_obj_get_int(bits_in); + madcblock_bits_helper(self->block, bits); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_2(madc_width_fun_obj, madc_width); -MP_DEFINE_CONST_CLASSMETHOD_OBJ(madc_width_obj, MP_ROM_PTR(&madc_width_fun_obj)); +MP_DEFINE_CONST_FUN_OBJ_2(madc_width_obj, madc_width); STATIC const mp_rom_map_elem_t madc_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_read_u16), MP_ROM_PTR(&madc_read_u16_obj) }, - + { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&madc_init_obj) }, + { MP_ROM_QSTR(MP_QSTR_block), MP_ROM_PTR(&madc_block_obj) }, { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&madc_read_obj) }, + { MP_ROM_QSTR(MP_QSTR_read_u16), MP_ROM_PTR(&madc_read_u16_obj) }, + { MP_ROM_QSTR(MP_QSTR_read_uv), MP_ROM_PTR(&madc_read_uv_obj) }, + + // Legacy API methods: { MP_ROM_QSTR(MP_QSTR_atten), MP_ROM_PTR(&madc_atten_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&madc_width_obj) }, - { MP_ROM_QSTR(MP_QSTR_ATTN_0DB), MP_ROM_INT(ADC_ATTEN_0db) }, - { MP_ROM_QSTR(MP_QSTR_ATTN_2_5DB), MP_ROM_INT(ADC_ATTEN_2_5db) }, - { MP_ROM_QSTR(MP_QSTR_ATTN_6DB), MP_ROM_INT(ADC_ATTEN_6db) }, - { MP_ROM_QSTR(MP_QSTR_ATTN_11DB), MP_ROM_INT(ADC_ATTEN_11db) }, + { MP_ROM_QSTR(MP_QSTR_ATTN_0DB), MP_ROM_INT(ADC_ATTEN_DB_0) }, + { MP_ROM_QSTR(MP_QSTR_ATTN_2_5DB), MP_ROM_INT(ADC_ATTEN_DB_2_5) }, + { MP_ROM_QSTR(MP_QSTR_ATTN_6DB), MP_ROM_INT(ADC_ATTEN_DB_6) }, + { MP_ROM_QSTR(MP_QSTR_ATTN_11DB), MP_ROM_INT(ADC_ATTEN_DB_11) }, #if CONFIG_IDF_TARGET_ESP32 - { MP_ROM_QSTR(MP_QSTR_WIDTH_9BIT), MP_ROM_INT(ADC_WIDTH_9Bit) }, - { MP_ROM_QSTR(MP_QSTR_WIDTH_10BIT), MP_ROM_INT(ADC_WIDTH_10Bit) }, - { MP_ROM_QSTR(MP_QSTR_WIDTH_11BIT), MP_ROM_INT(ADC_WIDTH_11Bit) }, - { MP_ROM_QSTR(MP_QSTR_WIDTH_12BIT), MP_ROM_INT(ADC_WIDTH_12Bit) }, - #elif CONFIG_IDF_TARGET_ESP32S2 - { MP_ROM_QSTR(MP_QSTR_WIDTH_13BIT), MP_ROM_INT(ADC_WIDTH_BIT_13) }, - #elif CONFIG_IDF_TARGET_ESP32S3 - { MP_ROM_QSTR(MP_QSTR_WIDTH_12BIT), MP_ROM_INT(ADC_WIDTH_BIT_12) }, + { MP_ROM_QSTR(MP_QSTR_WIDTH_9BIT), MP_ROM_INT(9) }, + { MP_ROM_QSTR(MP_QSTR_WIDTH_10BIT), MP_ROM_INT(10) }, + { MP_ROM_QSTR(MP_QSTR_WIDTH_11BIT), MP_ROM_INT(11) }, + #endif + #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 + { MP_ROM_QSTR(MP_QSTR_WIDTH_12BIT), MP_ROM_INT(12) }, + #endif + #if CONFIG_IDF_TARGET_ESP32S2 + { MP_ROM_QSTR(MP_QSTR_WIDTH_13BIT), MP_ROM_INT(13) }, #endif -}; +}; STATIC MP_DEFINE_CONST_DICT(madc_locals_dict, madc_locals_dict_table); const mp_obj_type_t machine_adc_type = { diff --git a/ports/esp32/machine_adc.h b/ports/esp32/machine_adc.h new file mode 100644 index 0000000000..0f229a2c5c --- /dev/null +++ b/ports/esp32/machine_adc.h @@ -0,0 +1,16 @@ +#ifndef MICROPY_INCLUDED_MACHINE_ADC_H +#define MICROPY_INCLUDED_MACHINE_ADC_H + +#include "machine_adcblock.h" + +typedef struct _madc_obj_t { + mp_obj_base_t base; + madcblock_obj_t *block; + adc_channel_t channel_id; + gpio_num_t gpio_id; +} madc_obj_t; + +extern const madc_obj_t *madc_search_helper(madcblock_obj_t *block, adc_channel_t channel_id, gpio_num_t gpio_id); +extern void madc_init_helper(const madc_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args); + +#endif // MICROPY_INCLUDED_MACHINE_ADC_H diff --git a/ports/esp32/machine_adcblock.c b/ports/esp32/machine_adcblock.c new file mode 100644 index 0000000000..77e4fcecc7 --- /dev/null +++ b/ports/esp32/machine_adcblock.c @@ -0,0 +1,203 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Jonathan Hogg + * + * 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 "esp_log.h" + +#include "driver/gpio.h" +#include "driver/adc.h" + +#include "py/runtime.h" +#include "py/mphal.h" +#include "modmachine.h" +#include "machine_adc.h" +#include "machine_adcblock.h" + +#define DEFAULT_VREF 1100 + +madcblock_obj_t madcblock_obj[] = { + #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C3 + {{&machine_adcblock_type}, ADC_UNIT_1, 12, -1, {0}}, + {{&machine_adcblock_type}, ADC_UNIT_2, 12, -1, {0}}, + #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 + {{&machine_adcblock_type}, ADC_UNIT_1, 13, -1, {0}}, + {{&machine_adcblock_type}, ADC_UNIT_2, 13, -1, {0}}, + #endif +}; + +STATIC void madcblock_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { + madcblock_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_printf(print, "ADCBlock(%u, bits=%u)", self->unit_id, self->bits); +} + +void madcblock_bits_helper(madcblock_obj_t *self, mp_int_t bits) { + switch (bits) { + #if CONFIG_IDF_TARGET_ESP32 + case 9: + self->width = ADC_WIDTH_BIT_9; + break; + case 10: + self->width = ADC_WIDTH_BIT_10; + break; + case 11: + self->width = ADC_WIDTH_BIT_11; + break; + #endif + #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 + case 12: + self->width = ADC_WIDTH_BIT_12; + break; + #endif + #if CONFIG_IDF_TARGET_ESP32S2 + case 13: + self->width = ADC_WIDTH_BIT_13; + break; + #endif + default: + mp_raise_ValueError(MP_ERROR_TEXT("invalid bits")); + } + self->bits = bits; + + if (self->unit_id == ADC_UNIT_1) { + adc1_config_width(self->width); + } + for (adc_atten_t atten = ADC_ATTEN_DB_0; atten < ADC_ATTEN_MAX; atten++) { + if (self->characteristics[atten] != NULL) { + esp_adc_cal_characterize(self->unit_id, atten, self->width, DEFAULT_VREF, self->characteristics[atten]); + } + } +} + +STATIC void madcblock_init_helper(madcblock_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { + ARG_bits, + }; + + static const mp_arg_t allowed_args[] = { + { MP_QSTR_bits, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_pos_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_int_t bits = args[ARG_bits].u_int; + if (bits != -1) { + madcblock_bits_helper(self, bits); + } else if (self->width == -1) { + madcblock_bits_helper(self, self->bits); + } +} + +STATIC mp_obj_t madcblock_make_new(const mp_obj_type_t *type, size_t n_pos_args, size_t n_kw_args, const mp_obj_t *args) { + mp_arg_check_num(n_pos_args, n_kw_args, 1, MP_OBJ_FUN_ARGS_MAX, true); + adc_unit_t unit = mp_obj_get_int(args[0]); + madcblock_obj_t *self = NULL; + for (int i = 0; i < MP_ARRAY_SIZE(madcblock_obj); i++) { + if (unit == madcblock_obj[i].unit_id) { + self = &madcblock_obj[i]; + break; + } + } + if (!self) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid block id")); + } + + mp_map_t kw_args; + mp_map_init_fixed_table(&kw_args, n_kw_args, args + n_pos_args); + madcblock_init_helper(self, n_pos_args - 1, args + 1, &kw_args); + + return MP_OBJ_FROM_PTR(self); +} + +STATIC mp_obj_t madcblock_init(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + madcblock_obj_t *self = pos_args[0]; + madcblock_init_helper(self, n_pos_args - 1, pos_args + 1, kw_args); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(madcblock_init_obj, 1, madcblock_init); + +STATIC mp_obj_t madcblock_connect(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + madcblock_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + adc_channel_t channel_id = -1; + gpio_num_t gpio_id = -1; + if (n_pos_args == 2) { + if (mp_obj_is_int(pos_args[1])) { + channel_id = mp_obj_get_int(pos_args[1]); + } else { + gpio_id = machine_pin_get_id(pos_args[1]); + } + } else if (n_pos_args == 3) { + channel_id = mp_obj_get_int(pos_args[1]); + gpio_id = machine_pin_get_id(pos_args[2]); + } else { + mp_raise_TypeError(MP_ERROR_TEXT("too many positional args")); + } + + const madc_obj_t *adc = madc_search_helper(self, channel_id, gpio_id); + if (adc != NULL) { + madc_init_helper(adc, 0, pos_args + n_pos_args, kw_args); + return MP_OBJ_FROM_PTR(adc); + } + mp_raise_ValueError(MP_ERROR_TEXT("no matching ADC")); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(madcblock_connect_obj, 2, madcblock_connect); + +mp_int_t madcblock_read_helper(madcblock_obj_t *self, adc_channel_t channel_id) { + int raw; + if (self->unit_id == ADC_UNIT_1) { + raw = adc1_get_raw(channel_id); + } else { + check_esp_err(adc2_get_raw(channel_id, self->width, &raw)); + } + return raw; +} + +mp_int_t madcblock_read_uv_helper(madcblock_obj_t *self, adc_channel_t channel_id, adc_atten_t atten) { + int raw = madcblock_read_helper(self, channel_id); + esp_adc_cal_characteristics_t *adc_chars = self->characteristics[atten]; + if (adc_chars == NULL) { + adc_chars = malloc(sizeof(esp_adc_cal_characteristics_t)); + esp_adc_cal_characterize(self->unit_id, atten, self->width, DEFAULT_VREF, adc_chars); + self->characteristics[atten] = adc_chars; + } + mp_int_t uv = esp_adc_cal_raw_to_voltage(raw, adc_chars) * 1000; + return uv; +} + +STATIC const mp_rom_map_elem_t madcblock_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&madcblock_init_obj) }, + { MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&madcblock_connect_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(madcblock_locals_dict, madcblock_locals_dict_table); + +const mp_obj_type_t machine_adcblock_type = { + { &mp_type_type }, + .name = MP_QSTR_ADCBlock, + .print = madcblock_print, + .make_new = madcblock_make_new, + .locals_dict = (mp_obj_t)&madcblock_locals_dict, +}; diff --git a/ports/esp32/machine_adcblock.h b/ports/esp32/machine_adcblock.h new file mode 100644 index 0000000000..0500726d71 --- /dev/null +++ b/ports/esp32/machine_adcblock.h @@ -0,0 +1,20 @@ +#ifndef MICROPY_INCLUDED_MACHINE_ADCBLOCK_H +#define MICROPY_INCLUDED_MACHINE_ADCBLOCK_H + +#include "esp_adc_cal.h" + +typedef struct _madcblock_obj_t { + mp_obj_base_t base; + adc_unit_t unit_id; + mp_int_t bits; + adc_bits_width_t width; + esp_adc_cal_characteristics_t *characteristics[ADC_ATTEN_MAX]; +} madcblock_obj_t; + +extern madcblock_obj_t madcblock_obj[]; + +extern void madcblock_bits_helper(madcblock_obj_t *self, mp_int_t bits); +extern mp_int_t madcblock_read_helper(madcblock_obj_t *self, adc_channel_t channel_id); +extern mp_int_t madcblock_read_uv_helper(madcblock_obj_t *self, adc_channel_t channel_id, adc_atten_t atten); + +#endif // MICROPY_INCLUDED_MACHINE_ADCBLOCK_H diff --git a/ports/esp32/main/CMakeLists.txt b/ports/esp32/main/CMakeLists.txt index 68a4815d7e..c86ac4dadf 100644 --- a/ports/esp32/main/CMakeLists.txt +++ b/ports/esp32/main/CMakeLists.txt @@ -59,6 +59,7 @@ set(MICROPY_SOURCE_PORT ${PROJECT_DIR}/machine_pin.c ${PROJECT_DIR}/machine_touchpad.c ${PROJECT_DIR}/machine_adc.c + ${PROJECT_DIR}/machine_adcblock.c ${PROJECT_DIR}/machine_dac.c ${PROJECT_DIR}/machine_i2c.c ${PROJECT_DIR}/machine_i2s.c @@ -98,6 +99,7 @@ set(IDF_COMPONENTS bootloader_support bt driver + esp_adc_cal esp_common esp_eth esp_event diff --git a/ports/esp32/modmachine.c b/ports/esp32/modmachine.c index cca2015729..dfe2435ec2 100644 --- a/ports/esp32/modmachine.c +++ b/ports/esp32/modmachine.c @@ -297,6 +297,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_TouchPad), MP_ROM_PTR(&machine_touchpad_type) }, #endif { MP_ROM_QSTR(MP_QSTR_ADC), MP_ROM_PTR(&machine_adc_type) }, + { MP_ROM_QSTR(MP_QSTR_ADCBlock), MP_ROM_PTR(&machine_adcblock_type) }, #if MICROPY_PY_MACHINE_DAC { MP_ROM_QSTR(MP_QSTR_DAC), MP_ROM_PTR(&machine_dac_type) }, #endif diff --git a/ports/esp32/modmachine.h b/ports/esp32/modmachine.h index c773f8dbc9..4d2ab9020d 100644 --- a/ports/esp32/modmachine.h +++ b/ports/esp32/modmachine.h @@ -14,6 +14,7 @@ extern const mp_obj_type_t machine_wdt_type; extern const mp_obj_type_t machine_pin_type; extern const mp_obj_type_t machine_touchpad_type; extern const mp_obj_type_t machine_adc_type; +extern const mp_obj_type_t machine_adcblock_type; extern const mp_obj_type_t machine_dac_type; extern const mp_obj_type_t machine_hw_i2c_type; extern const mp_obj_type_t machine_hw_spi_type; From 357078504d0d2c3a3f06ec4bd69e0ab3bcf9e016 Mon Sep 17 00:00:00 2001 From: jason Date: Wed, 12 May 2021 21:10:06 -0700 Subject: [PATCH 0027/1712] esp32: Pin MicroPython to core 1 again. This follows up on #5489, where we changed the esp32 core pinning to core 0 in order to work around an issue with IDF < 4.2.0. Now that IDF > 4.2.0 is available, we allow pinning back to core 1, which eliminates some problematic callback latency with WiFi enabled. NimBLE is also pinned to core 1 - the same core as MicroPython - when using IDF >=4.2. --- ports/esp32/CMakeLists.txt | 13 +++++++++++-- ports/esp32/boards/sdkconfig.ble | 8 -------- ports/esp32/boards/sdkconfig.nimble_core0 | 6 ++++++ ports/esp32/boards/sdkconfig.nimble_core1 | 6 ++++++ ports/esp32/mphalport.h | 11 ++++++++--- 5 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 ports/esp32/boards/sdkconfig.nimble_core0 create mode 100644 ports/esp32/boards/sdkconfig.nimble_core1 diff --git a/ports/esp32/CMakeLists.txt b/ports/esp32/CMakeLists.txt index 29409adc74..8b2f09a724 100644 --- a/ports/esp32/CMakeLists.txt +++ b/ports/esp32/CMakeLists.txt @@ -18,12 +18,22 @@ if(NOT EXISTS ${MICROPY_BOARD_DIR}/mpconfigboard.cmake) message(FATAL_ERROR "Invalid MICROPY_BOARD specified: ${MICROPY_BOARD}") endif() +# Include main IDF cmake file. +include($ENV{IDF_PATH}/tools/cmake/project.cmake) + # Define the output sdkconfig so it goes in the build directory. set(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig) # Include board config; this is expected to set SDKCONFIG_DEFAULTS (among other options). include(${MICROPY_BOARD_DIR}/mpconfigboard.cmake) +# Add sdkconfig fragments that depend on the IDF version. +if(IDF_VERSION_MAJOR EQUAL 4 AND IDF_VERSION_MINOR LESS 2) + set(SDKCONFIG_DEFAULTS ${SDKCONFIG_DEFAULTS} boards/sdkconfig.nimble_core0) +else() + set(SDKCONFIG_DEFAULTS ${SDKCONFIG_DEFAULTS} boards/sdkconfig.nimble_core1) +endif() + # Concatenate all sdkconfig files into a combined one for the IDF to use. file(WRITE ${CMAKE_BINARY_DIR}/sdkconfig.combined.in "") foreach(SDKCONFIG_DEFAULT ${SDKCONFIG_DEFAULTS}) @@ -33,6 +43,5 @@ endforeach() configure_file(${CMAKE_BINARY_DIR}/sdkconfig.combined.in ${CMAKE_BINARY_DIR}/sdkconfig.combined COPYONLY) set(SDKCONFIG_DEFAULTS ${CMAKE_BINARY_DIR}/sdkconfig.combined) -# Include main IDF cmake file and define the project. -include($ENV{IDF_PATH}/tools/cmake/project.cmake) +# Define the project. project(micropython) diff --git a/ports/esp32/boards/sdkconfig.ble b/ports/esp32/boards/sdkconfig.ble index 5565fd81a8..08d5e481f4 100644 --- a/ports/esp32/boards/sdkconfig.ble +++ b/ports/esp32/boards/sdkconfig.ble @@ -7,11 +7,3 @@ CONFIG_BTDM_CTRL_MODE_BTDM= CONFIG_BT_NIMBLE_ENABLED=y CONFIG_BT_NIMBLE_MAX_CONNECTIONS=4 - -# Pin to the same core as MP. -# Until we move to IDF 4.2+, we need NimBLE on core 0, and for synchronisation -# with the ringbuffer and scheduler MP needs to be on the same core. -# See https://github.com/micropython/micropython/issues/5489 -CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=y -CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=n -CONFIG_BT_NIMBLE_PINNED_TO_CORE=0 diff --git a/ports/esp32/boards/sdkconfig.nimble_core0 b/ports/esp32/boards/sdkconfig.nimble_core0 new file mode 100644 index 0000000000..cacaff1197 --- /dev/null +++ b/ports/esp32/boards/sdkconfig.nimble_core0 @@ -0,0 +1,6 @@ +# For IDF <4.2, we need NimBLE on core 0, and for synchronisation +# with the ringbuffer and scheduler MP needs to be on the same core. +# See https://github.com/micropython/micropython/issues/5489 +CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=y +CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=n +CONFIG_BT_NIMBLE_PINNED_TO_CORE=0 diff --git a/ports/esp32/boards/sdkconfig.nimble_core1 b/ports/esp32/boards/sdkconfig.nimble_core1 new file mode 100644 index 0000000000..33653cc4b1 --- /dev/null +++ b/ports/esp32/boards/sdkconfig.nimble_core1 @@ -0,0 +1,6 @@ +# For IDF >=4.2, we are able to put NimBLE on core 1, and for synchronisation +# with the ringbuffer and scheduler MP needs to be on the same core. +# MP on core 1 prevents interference with WiFi for time sensitive operations. +CONFIG_BT_NIMBLE_PINNED_TO_CORE_0=n +CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=y +CONFIG_BT_NIMBLE_PINNED_TO_CORE=1 diff --git a/ports/esp32/mphalport.h b/ports/esp32/mphalport.h index 01c14ad700..c838bd2284 100644 --- a/ports/esp32/mphalport.h +++ b/ports/esp32/mphalport.h @@ -38,10 +38,15 @@ #define MICROPY_PLATFORM_VERSION "IDF" IDF_VER // The core that the MicroPython task(s) are pinned to. -// Until we move to IDF 4.2+, we need NimBLE on core 0, and for synchronisation -// with the ringbuffer and scheduler MP needs to be on the same core. -// See https://github.com/micropython/micropython/issues/5489 +// Now that we have IDF 4.2.0+, we are once again able to pin to core 1 +// and avoid the Wifi/BLE timing problems on the same core. +// Best effort here to remain backwards compatible in rare version edge cases... +// See https://github.com/micropython/micropython/issues/5489 for history +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0) +#define MP_TASK_COREID (1) +#else #define MP_TASK_COREID (0) +#endif extern TaskHandle_t mp_main_task_handle; From 648656dbbd841aae129628487a71037236aac739 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 22 Jan 2022 00:02:27 +1100 Subject: [PATCH 0028/1712] esp32/esp32_rmt: Call rmt_driver_install directly if running on core 1. Signed-off-by: Damien George --- ports/esp32/esp32_rmt.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ports/esp32/esp32_rmt.c b/ports/esp32/esp32_rmt.c index 639e0467a8..ca751d42a8 100644 --- a/ports/esp32/esp32_rmt.c +++ b/ports/esp32/esp32_rmt.c @@ -60,16 +60,18 @@ typedef struct _esp32_rmt_obj_t { bool loop_en; } esp32_rmt_obj_t; +// Current channel used for machine.bitstream, in the machine_bitstream_high_low_rmt +// implementation. A value of -1 means do not use RMT. +int8_t esp32_rmt_bitstream_channel_id = RMT_CHANNEL_MAX - 1; + +#if MP_TASK_COREID == 0 + typedef struct _rmt_install_state_t { SemaphoreHandle_t handle; uint8_t channel_id; esp_err_t ret; } rmt_install_state_t; -// Current channel used for machine.bitstream, in the machine_bitstream_high_low_rmt -// implementation. A value of -1 means do not use RMT. -int8_t esp32_rmt_bitstream_channel_id = RMT_CHANNEL_MAX - 1; - STATIC void rmt_install_task(void *pvParameter) { rmt_install_state_t *state = pvParameter; state->ret = rmt_driver_install(state->channel_id, 0, 0); @@ -92,6 +94,16 @@ esp_err_t rmt_driver_install_core1(uint8_t channel_id) { return state.ret; } +#else + +// MicroPython runs on core 1, so we can call the RMT installer directly and its +// interrupt handler will also run on core 1. +esp_err_t rmt_driver_install_core1(uint8_t channel_id) { + return rmt_driver_install(channel_id, 0, 0); +} + +#endif + STATIC mp_obj_t esp32_rmt_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { static const mp_arg_t allowed_args[] = { { MP_QSTR_id, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = -1} }, From 23b1a4e0b6c6f538d6622359aba0740dfe14c44d Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 22 Jan 2022 00:46:12 +1100 Subject: [PATCH 0029/1712] esp32/main: Allocate at most 1/2 of available IDF heap for MP heap. So that there is some memory left for the OS, eg for ssl buffers. See issue #7214. Signed-off-by: Damien George --- ports/esp32/main.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/ports/esp32/main.c b/ports/esp32/main.c index c9b033d626..d21dc9f753 100644 --- a/ports/esp32/main.c +++ b/ports/esp32/main.c @@ -97,11 +97,12 @@ void mp_task(void *pvParameter) { #endif machine_init(); - // TODO: CONFIG_SPIRAM_SUPPORT is for 3.3 compatibility, remove after move to 4.0. - #if CONFIG_ESP32_SPIRAM_SUPPORT || CONFIG_SPIRAM_SUPPORT - // Try to use the entire external SPIRAM directly for the heap size_t mp_task_heap_size; - void *mp_task_heap = (void *)SOC_EXTRAM_DATA_LOW; + void *mp_task_heap = NULL; + + #if CONFIG_ESP32_SPIRAM_SUPPORT + // Try to use the entire external SPIRAM directly for the heap + mp_task_heap = (void *)SOC_EXTRAM_DATA_LOW; switch (esp_spiram_get_chip_size()) { case ESP_SPIRAM_SIZE_16MBITS: mp_task_heap_size = 2 * 1024 * 1024; @@ -112,27 +113,27 @@ void mp_task(void *pvParameter) { break; default: // No SPIRAM, fallback to normal allocation - mp_task_heap_size = heap_caps_get_largest_free_block(MALLOC_CAP_8BIT); - mp_task_heap = malloc(mp_task_heap_size); + mp_task_heap = NULL; break; } #elif CONFIG_ESP32S2_SPIRAM_SUPPORT || CONFIG_ESP32S3_SPIRAM_SUPPORT // Try to use the entire external SPIRAM directly for the heap - size_t mp_task_heap_size; size_t esp_spiram_size = esp_spiram_get_size(); - void *mp_task_heap = (void *)SOC_EXTRAM_DATA_HIGH - esp_spiram_size; if (esp_spiram_size > 0) { + mp_task_heap = (void *)SOC_EXTRAM_DATA_HIGH - esp_spiram_size; mp_task_heap_size = esp_spiram_size; - } else { - // No SPIRAM, fallback to normal allocation - mp_task_heap_size = heap_caps_get_largest_free_block(MALLOC_CAP_8BIT); + } + #endif + + if (mp_task_heap == NULL) { + // Allocate the uPy heap using malloc and get the largest available region, + // limiting to 1/2 total available memory to leave memory for the OS. + mp_task_heap_size = MIN( + heap_caps_get_largest_free_block(MALLOC_CAP_8BIT), + heap_caps_get_total_size(MALLOC_CAP_8BIT) / 2 + ); mp_task_heap = malloc(mp_task_heap_size); } - #else - // Allocate the uPy heap using malloc and get the largest available region - size_t mp_task_heap_size = heap_caps_get_largest_free_block(MALLOC_CAP_8BIT); - void *mp_task_heap = malloc(mp_task_heap_size); - #endif soft_reset: // initialise the stack pointer for the main thread From 6a10d3ed99cf63a2505536862734db726008ccfd Mon Sep 17 00:00:00 2001 From: Sean Coates Date: Fri, 14 Jan 2022 17:28:29 -0500 Subject: [PATCH 0030/1712] esp32/README.md: Fix URL for esp-idf installation. The current URL points to a pinned version of the document (v4.0.2) and is currently not found (404). --- ports/esp32/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32/README.md b/ports/esp32/README.md index 42cd588171..4524696899 100644 --- a/ports/esp32/README.md +++ b/ports/esp32/README.md @@ -32,7 +32,7 @@ Currently MicroPython supports v4.0.2, v4.1.1 and v4.2, although other IDF v4 versions may also work. To install the ESP-IDF the full instructions can be found at the -[Espressif Getting Started guide](https://docs.espressif.com/projects/esp-idf/en/v4.0.2/get-started/index.html#installation-step-by-step). +[Espressif Getting Started guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html#installation-step-by-step). If you are on a Windows machine then the [Windows Subsystem for Linux](https://msdn.microsoft.com/en-au/commandline/wsl/install_guide) is the From ac39960aa13d1c4d4c93f002463b1b462be015e0 Mon Sep 17 00:00:00 2001 From: marcidy Date: Mon, 17 Jan 2022 20:41:23 -0800 Subject: [PATCH 0031/1712] esp32/modnetwork: Fix test for WIFI_AUTH_MAX for IDF v4.3.0. Signed-off-by: marcidy --- ports/esp32/modnetwork.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32/modnetwork.c b/ports/esp32/modnetwork.c index a16c67eeb9..206fecbcf9 100644 --- a/ports/esp32/modnetwork.c +++ b/ports/esp32/modnetwork.c @@ -212,7 +212,7 @@ STATIC mp_obj_t esp_phy_mode(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_phy_mode_obj, 0, 1, esp_phy_mode); -#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(4, 3, 0) +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0) #define TEST_WIFI_AUTH_MAX 9 #else #define TEST_WIFI_AUTH_MAX 8 From bb9d688454336591803858b769ce3ea23ab2df91 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 22 Jan 2022 10:45:17 +1100 Subject: [PATCH 0032/1712] esp32/main: Use heap_caps_get_info on IDF <4.1 to compute total heap. heap_caps_get_total_size() is only available in IDF 4.1 and above. Signed-off-by: Damien George --- ports/esp32/main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ports/esp32/main.c b/ports/esp32/main.c index d21dc9f753..e25e6fdd1c 100644 --- a/ports/esp32/main.c +++ b/ports/esp32/main.c @@ -128,10 +128,14 @@ void mp_task(void *pvParameter) { if (mp_task_heap == NULL) { // Allocate the uPy heap using malloc and get the largest available region, // limiting to 1/2 total available memory to leave memory for the OS. - mp_task_heap_size = MIN( - heap_caps_get_largest_free_block(MALLOC_CAP_8BIT), - heap_caps_get_total_size(MALLOC_CAP_8BIT) / 2 - ); + #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0) + size_t heap_total = heap_caps_get_total_size(MALLOC_CAP_8BIT); + #else + multi_heap_info_t info; + heap_caps_get_info(&info, MALLOC_CAP_8BIT); + size_t heap_total = info.total_free_bytes + info.total_allocated_bytes; + #endif + mp_task_heap_size = MIN(heap_caps_get_largest_free_block(MALLOC_CAP_8BIT), heap_total / 2); mp_task_heap = malloc(mp_task_heap_size); } From ea5744fd8decb1161a2bd212813a275e2705fd89 Mon Sep 17 00:00:00 2001 From: ubi de feo Date: Thu, 20 Jan 2022 07:07:06 +0100 Subject: [PATCH 0033/1712] esp32/boards: Provide custom deploy_c3.md for ESP32-C3 boards. This fixes the flash address for installation on ESP32-C3. --- ports/esp32/boards/GENERIC_C3/board.json | 2 +- ports/esp32/boards/GENERIC_C3_USB/board.json | 2 +- ports/esp32/boards/deploy_c3.md | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 ports/esp32/boards/deploy_c3.md diff --git a/ports/esp32/boards/GENERIC_C3/board.json b/ports/esp32/boards/GENERIC_C3/board.json index 481e66bccd..6cc326bf14 100644 --- a/ports/esp32/boards/GENERIC_C3/board.json +++ b/ports/esp32/boards/GENERIC_C3/board.json @@ -1,6 +1,6 @@ { "deploy": [ - "../deploy.md" + "../deploy_c3.md" ], "docs": "", "features": [ diff --git a/ports/esp32/boards/GENERIC_C3_USB/board.json b/ports/esp32/boards/GENERIC_C3_USB/board.json index 94d86d4428..23f9a8eb20 100644 --- a/ports/esp32/boards/GENERIC_C3_USB/board.json +++ b/ports/esp32/boards/GENERIC_C3_USB/board.json @@ -1,6 +1,6 @@ { "deploy": [ - "../deploy.md" + "../deploy_c3.md" ], "docs": "", "features": [ diff --git a/ports/esp32/boards/deploy_c3.md b/ports/esp32/boards/deploy_c3.md new file mode 100644 index 0000000000..016ba7cabb --- /dev/null +++ b/ports/esp32/boards/deploy_c3.md @@ -0,0 +1,14 @@ +Program your board using the esptool.py program, found [here](https://github.com/espressif/esptool). + +If you are putting MicroPython on your board for the first time then you should +first erase the entire flash using: + +```bash +esptool.py --chip esp32c3 --port /dev/ttyUSB0 erase_flash +``` + +From then on program the firmware starting at address 0x0: + +```bash +esptool.py --chip esp32c3 --port /dev/ttyUSB0 --baud 460800 write_flash -z 0x0 esp32c3-20220117-v1.18.bin +``` From 5f8eef4521866a072e27914d597c48e44a2c16e4 Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Wed, 19 Jan 2022 16:33:41 +0100 Subject: [PATCH 0034/1712] windows/README.md: Fix broken mingw link. --- ports/windows/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/windows/README.md b/ports/windows/README.md index 713ea82b87..1fa8008910 100644 --- a/ports/windows/README.md +++ b/ports/windows/README.md @@ -3,7 +3,7 @@ It is based on Unix port, and expected to remain so. The port requires additional testing, debugging, and patches. Please consider to contribute. -All gcc-based builds use the gcc compiler from [Mingw-w64](mingw-w64.org), +All gcc-based builds use the gcc compiler from [Mingw-w64](https://www.mingw-w64.org/), which is the advancement of the original mingw project. The latter is getting obsolete and is not actively supported by MicroPython. From a9448c0a86d6d1f04e190d5c093ca93d9470b99a Mon Sep 17 00:00:00 2001 From: stijn Date: Tue, 11 Jan 2022 17:25:06 +0100 Subject: [PATCH 0035/1712] all: Fix MICROPY_OBJ_REPR_D compilation with msvc. --- mpy-cross/mpconfigport.h | 2 +- ports/windows/mpconfigport.h | 2 +- py/objfun.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mpy-cross/mpconfigport.h b/mpy-cross/mpconfigport.h index 8c716e958d..4c10afe9bb 100644 --- a/mpy-cross/mpconfigport.h +++ b/mpy-cross/mpconfigport.h @@ -139,7 +139,7 @@ typedef long mp_off_t; #define MP_NOINLINE __declspec(noinline) #define MP_LIKELY(x) (x) #define MP_UNLIKELY(x) (x) -#define MICROPY_PORT_CONSTANTS { "dummy", 0 } +#define MICROPY_PORT_CONSTANTS { MP_ROM_QSTR(MP_QSTR_dummy), MP_ROM_PTR(NULL) } #ifdef _WIN64 #define MP_SSIZE_MAX _I64_MAX #else diff --git a/ports/windows/mpconfigport.h b/ports/windows/mpconfigport.h index 96405bc5d2..1aae5a7500 100644 --- a/ports/windows/mpconfigport.h +++ b/ports/windows/mpconfigport.h @@ -244,7 +244,7 @@ extern const struct _mp_obj_module_t mp_module_time; #define MP_NOINLINE __declspec(noinline) #define MP_LIKELY(x) (x) #define MP_UNLIKELY(x) (x) -#define MICROPY_PORT_CONSTANTS { "dummy", 0 } // can't have zero-sized array +#define MICROPY_PORT_CONSTANTS { MP_ROM_QSTR(MP_QSTR_dummy), MP_ROM_PTR(NULL) } // can't have zero-sized array #ifdef _WIN64 #define MP_SSIZE_MAX _I64_MAX #else diff --git a/py/objfun.c b/py/objfun.c index d86a4d235a..85f531c88b 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -410,7 +410,7 @@ mp_obj_t mp_obj_new_fun_bc(mp_obj_t def_args_in, mp_obj_t def_kw_args, const byt STATIC mp_obj_t fun_native_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) { MP_STACK_CHECK(); - mp_obj_fun_bc_t *self = self_in; + mp_obj_fun_bc_t *self = MP_OBJ_TO_PTR(self_in); mp_call_fun_t fun = MICROPY_MAKE_POINTER_CALLABLE((void *)self->bytecode); return fun(self_in, n_args, n_kw, args); } @@ -424,9 +424,9 @@ STATIC const mp_obj_type_t mp_type_fun_native = { }; mp_obj_t mp_obj_new_fun_native(mp_obj_t def_args_in, mp_obj_t def_kw_args, const void *fun_data, const mp_uint_t *const_table) { - mp_obj_fun_bc_t *o = mp_obj_new_fun_bc(def_args_in, def_kw_args, (const byte *)fun_data, const_table); + mp_obj_fun_bc_t *o = MP_OBJ_TO_PTR(mp_obj_new_fun_bc(def_args_in, def_kw_args, (const byte *)fun_data, const_table)); o->base.type = &mp_type_fun_native; - return o; + return MP_OBJ_FROM_PTR(o); } #endif // MICROPY_EMIT_NATIVE @@ -494,7 +494,7 @@ STATIC mp_uint_t convert_obj_for_inline_asm(mp_obj_t obj) { } STATIC mp_obj_t fun_asm_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) { - mp_obj_fun_asm_t *self = self_in; + mp_obj_fun_asm_t *self = MP_OBJ_TO_PTR(self_in); mp_arg_check_num(n_args, n_kw, self->n_args, self->n_args, false); @@ -537,7 +537,7 @@ mp_obj_t mp_obj_new_fun_asm(size_t n_args, const void *fun_data, mp_uint_t type_ o->n_args = n_args; o->fun_data = fun_data; o->type_sig = type_sig; - return o; + return MP_OBJ_FROM_PTR(o); } #endif // MICROPY_EMIT_INLINE_ASM From e0b8d6982713c78169ec882770e746f2c5f4bc30 Mon Sep 17 00:00:00 2001 From: stijn Date: Wed, 12 Jan 2022 14:35:16 +0100 Subject: [PATCH 0036/1712] github/workflows: Show context for qemu-arm test failures. Make it easier to see what went wrong in CI builds. --- .github/workflows/ports_qemu-arm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ports_qemu-arm.yml b/.github/workflows/ports_qemu-arm.yml index 8d144ca3cb..0489a93d5a 100644 --- a/.github/workflows/ports_qemu-arm.yml +++ b/.github/workflows/ports_qemu-arm.yml @@ -24,4 +24,4 @@ jobs: run: source tools/ci.sh && ci_qemu_arm_build - name: Print failures if: failure() - run: grep --text "FAIL" ports/qemu-arm/build/console.out + run: grep --before-context=100 --text "FAIL" ports/qemu-arm/build/console.out From dd6967202a734fce569127c07da7ed1e07ce8bc4 Mon Sep 17 00:00:00 2001 From: stijn Date: Wed, 20 Nov 2019 13:38:33 +0100 Subject: [PATCH 0037/1712] py/modmath: Add math.tau, math.nan and math.inf constants. Configurable by the new MICROPY_PY_MATH_CONSTANTS option. --- .../unix/variants/coverage/mpconfigvariant.h | 1 + ports/unix/variants/dev/mpconfigvariant.h | 1 + ports/windows/variants/dev/mpconfigvariant.h | 1 + py/modmath.c | 5 ++++ py/mpconfig.h | 5 ++++ py/obj.h | 30 +++++++++++++++++++ py/objfloat.c | 8 +++++ tests/float/math_constants.py | 11 +++++++ tests/float/math_constants_extra.py | 17 +++++++++++ 9 files changed, 79 insertions(+) create mode 100644 tests/float/math_constants.py create mode 100644 tests/float/math_constants_extra.py diff --git a/ports/unix/variants/coverage/mpconfigvariant.h b/ports/unix/variants/coverage/mpconfigvariant.h index f033dddb10..5ce40edbb9 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.h +++ b/ports/unix/variants/coverage/mpconfigvariant.h @@ -48,6 +48,7 @@ #define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP_MODULES (1) #define MICROPY_PY_SYS_GETSIZEOF (1) +#define MICROPY_PY_MATH_CONSTANTS (1) #define MICROPY_PY_MATH_FACTORIAL (1) #define MICROPY_PY_URANDOM_EXTRA_FUNCS (1) #define MICROPY_PY_IO_BUFFEREDWRITER (1) diff --git a/ports/unix/variants/dev/mpconfigvariant.h b/ports/unix/variants/dev/mpconfigvariant.h index 54ad993236..35c24c5f00 100644 --- a/ports/unix/variants/dev/mpconfigvariant.h +++ b/ports/unix/variants/dev/mpconfigvariant.h @@ -33,6 +33,7 @@ #define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP_MODULES (1) +#define MICROPY_PY_MATH_CONSTANTS (1) #define MICROPY_PY_SYS_SETTRACE (1) #define MICROPY_PY_UOS_VFS (1) #define MICROPY_PY_URANDOM_EXTRA_FUNCS (1) diff --git a/ports/windows/variants/dev/mpconfigvariant.h b/ports/windows/variants/dev/mpconfigvariant.h index 2da0977140..1f205066f0 100644 --- a/ports/windows/variants/dev/mpconfigvariant.h +++ b/ports/windows/variants/dev/mpconfigvariant.h @@ -30,6 +30,7 @@ #define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP_MODULES (1) +#define MICROPY_PY_MATH_CONSTANTS (1) #define MICROPY_PY_SYS_SETTRACE (1) #define MICROPY_PERSISTENT_CODE_SAVE (1) #define MICROPY_COMP_CONST (0) diff --git a/py/modmath.c b/py/modmath.c index ac9e0bbc44..8fc821c9d5 100644 --- a/py/modmath.c +++ b/py/modmath.c @@ -371,6 +371,11 @@ STATIC const mp_rom_map_elem_t mp_module_math_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_math) }, { MP_ROM_QSTR(MP_QSTR_e), mp_const_float_e }, { MP_ROM_QSTR(MP_QSTR_pi), mp_const_float_pi }, + #if MICROPY_PY_MATH_CONSTANTS + { MP_ROM_QSTR(MP_QSTR_tau), mp_const_float_tau }, + { MP_ROM_QSTR(MP_QSTR_inf), mp_const_float_inf }, + { MP_ROM_QSTR(MP_QSTR_nan), mp_const_float_nan }, + #endif { MP_ROM_QSTR(MP_QSTR_sqrt), MP_ROM_PTR(&mp_math_sqrt_obj) }, { MP_ROM_QSTR(MP_QSTR_pow), MP_ROM_PTR(&mp_math_pow_obj) }, { MP_ROM_QSTR(MP_QSTR_exp), MP_ROM_PTR(&mp_math_exp_obj) }, diff --git a/py/mpconfig.h b/py/mpconfig.h index c1a0bfc046..47779a67de 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1221,6 +1221,11 @@ typedef double mp_float_t; #define MICROPY_PY_MATH (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_CORE_FEATURES) #endif +// Whether to provide all math module constants (Python 3.5+), or just pi and e. +#ifndef MICROPY_PY_MATH_CONSTANTS +#define MICROPY_PY_MATH_CONSTANTS (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) +#endif + // Whether to provide special math functions: math.{erf,erfc,gamma,lgamma} #ifndef MICROPY_PY_MATH_SPECIAL_FUNCTIONS #define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) diff --git a/py/obj.h b/py/obj.h index 7730059e6a..b52ee0e2f4 100644 --- a/py/obj.h +++ b/py/obj.h @@ -104,8 +104,18 @@ static inline bool mp_obj_is_immediate_obj(mp_const_obj_t o) { #if MICROPY_PY_BUILTINS_FLOAT #define mp_const_float_e MP_ROM_PTR(&mp_const_float_e_obj) #define mp_const_float_pi MP_ROM_PTR(&mp_const_float_pi_obj) +#if MICROPY_PY_MATH_CONSTANTS +#define mp_const_float_tau MP_ROM_PTR(&mp_const_float_tau_obj) +#define mp_const_float_inf MP_ROM_PTR(&mp_const_float_inf_obj) +#define mp_const_float_nan MP_ROM_PTR(&mp_const_float_nan_obj) +#endif extern const struct _mp_obj_float_t mp_const_float_e_obj; extern const struct _mp_obj_float_t mp_const_float_pi_obj; +#if MICROPY_PY_MATH_CONSTANTS +extern const struct _mp_obj_float_t mp_const_float_tau_obj; +extern const struct _mp_obj_float_t mp_const_float_inf_obj; +extern const struct _mp_obj_float_t mp_const_float_nan_obj; +#endif #define mp_obj_is_float(o) mp_obj_is_type((o), &mp_type_float) mp_float_t mp_obj_float_get(mp_obj_t self_in); @@ -139,8 +149,18 @@ static inline bool mp_obj_is_immediate_obj(mp_const_obj_t o) { #if MICROPY_PY_BUILTINS_FLOAT #define mp_const_float_e MP_ROM_PTR(&mp_const_float_e_obj) #define mp_const_float_pi MP_ROM_PTR(&mp_const_float_pi_obj) +#if MICROPY_PY_MATH_CONSTANTS +#define mp_const_float_tau MP_ROM_PTR(&mp_const_float_tau_obj) +#define mp_const_float_inf MP_ROM_PTR(&mp_const_float_inf_obj) +#define mp_const_float_nan MP_ROM_PTR(&mp_const_float_nan_obj) +#endif extern const struct _mp_obj_float_t mp_const_float_e_obj; extern const struct _mp_obj_float_t mp_const_float_pi_obj; +#if MICROPY_PY_MATH_CONSTANTS +extern const struct _mp_obj_float_t mp_const_float_tau_obj; +extern const struct _mp_obj_float_t mp_const_float_inf_obj; +extern const struct _mp_obj_float_t mp_const_float_nan_obj; +#endif #define mp_obj_is_float(o) mp_obj_is_type((o), &mp_type_float) mp_float_t mp_obj_float_get(mp_obj_t self_in); @@ -162,6 +182,11 @@ static inline bool mp_obj_is_small_int(mp_const_obj_t o) { #if MICROPY_PY_BUILTINS_FLOAT #define mp_const_float_e MP_ROM_PTR((mp_obj_t)(((0x402df854 & ~3) | 2) + 0x80800000)) #define mp_const_float_pi MP_ROM_PTR((mp_obj_t)(((0x40490fdb & ~3) | 2) + 0x80800000)) +#if MICROPY_PY_MATH_CONSTANTS +#define mp_const_float_tau MP_ROM_PTR((mp_obj_t)(((0x40c90fdb & ~3) | 2) + 0x80800000)) +#define mp_const_float_inf MP_ROM_PTR((mp_obj_t)(((0x7f800000 & ~3) | 2) + 0x80800000)) +#define mp_const_float_nan MP_ROM_PTR((mp_obj_t)(((0xffc00000 & ~3) | 2) + 0x80800000)) +#endif static inline bool mp_obj_is_float(mp_const_obj_t o) { return (((mp_uint_t)(o)) & 3) == 2 && (((mp_uint_t)(o)) & 0xff800007) != 0x00000006; @@ -226,6 +251,11 @@ static inline bool mp_obj_is_immediate_obj(mp_const_obj_t o) { #define mp_const_float_e {((mp_obj_t)((uint64_t)0x4005bf0a8b145769 + 0x8004000000000000))} #define mp_const_float_pi {((mp_obj_t)((uint64_t)0x400921fb54442d18 + 0x8004000000000000))} +#if MICROPY_PY_MATH_CONSTANTS +#define mp_const_float_tau {((mp_obj_t)((uint64_t)0x401921fb54442d18 + 0x8004000000000000))} +#define mp_const_float_inf {((mp_obj_t)((uint64_t)0x7ff0000000000000 + 0x8004000000000000))} +#define mp_const_float_nan {((mp_obj_t)((uint64_t)0xfff8000000000000 + 0x8004000000000000))} +#endif static inline bool mp_obj_is_float(mp_const_obj_t o) { return ((uint64_t)(o) & 0xfffc000000000000) != 0; diff --git a/py/objfloat.c b/py/objfloat.c index 5194dba51e..8ff2fa16c4 100644 --- a/py/objfloat.c +++ b/py/objfloat.c @@ -54,6 +54,14 @@ typedef struct _mp_obj_float_t { const mp_obj_float_t mp_const_float_e_obj = {{&mp_type_float}, (mp_float_t)M_E}; const mp_obj_float_t mp_const_float_pi_obj = {{&mp_type_float}, (mp_float_t)M_PI}; +#if MICROPY_PY_MATH_CONSTANTS +#ifndef NAN +#error NAN macro is not defined +#endif +const mp_obj_float_t mp_const_float_tau_obj = {{&mp_type_float}, (mp_float_t)(2.0 * M_PI)}; +const mp_obj_float_t mp_const_float_inf_obj = {{&mp_type_float}, (mp_float_t)INFINITY}; +const mp_obj_float_t mp_const_float_nan_obj = {{&mp_type_float}, (mp_float_t)NAN}; +#endif #endif diff --git a/tests/float/math_constants.py b/tests/float/math_constants.py new file mode 100644 index 0000000000..2e4c321052 --- /dev/null +++ b/tests/float/math_constants.py @@ -0,0 +1,11 @@ +# Tests various constants of the math module. +try: + import math + from math import exp, cos +except ImportError: + print("SKIP") + raise SystemExit + +print(math.e == exp(1.0)) + +print(cos(math.pi)) diff --git a/tests/float/math_constants_extra.py b/tests/float/math_constants_extra.py new file mode 100644 index 0000000000..dea49aef5a --- /dev/null +++ b/tests/float/math_constants_extra.py @@ -0,0 +1,17 @@ +# Tests constants of the math module available only with MICROPY_PY_MATH_CONSTANTS. +try: + import math + from math import isnan + + math.tau +except (ImportError, AttributeError): + print("SKIP") + raise SystemExit + +print(math.tau == 2.0 * math.pi) + +print(math.inf == float("inf")) +print(-math.inf == -float("inf")) + +print(isnan(math.nan)) +print(isnan(-math.nan)) From f3229590a9ce8286627f5763884328cdc970fa1d Mon Sep 17 00:00:00 2001 From: stijn Date: Wed, 12 Jan 2022 14:38:45 +0100 Subject: [PATCH 0038/1712] tools/ci: Test math constants with MICROPY_OBJ_REPR_D. --- tools/ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci.sh b/tools/ci.sh index d0c5948a8c..0506a00314 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -467,7 +467,7 @@ function ci_unix_coverage_32bit_run_native_mpy_tests { function ci_unix_nanbox_build { # Use Python 2 to check that it can run the build scripts - ci_unix_build_helper PYTHON=python2 VARIANT=nanbox + ci_unix_build_helper PYTHON=python2 VARIANT=nanbox CFLAGS_EXTRA="-DMICROPY_PY_MATH_CONSTANTS=1" ci_unix_build_ffi_lib_helper gcc -m32 } From aafd8859e9f0a2b5cc49e41a50530fecec79a205 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 23 Jan 2022 09:33:19 +1100 Subject: [PATCH 0039/1712] docs/differences: Update differences now that math.tau/inf/nan exist. Signed-off-by: Damien George --- docs/differences/python_35.rst | 2 +- docs/differences/python_36.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/differences/python_35.rst b/docs/differences/python_35.rst index 84c38c9cc1..2a4c119a45 100644 --- a/docs/differences/python_35.rst +++ b/docs/differences/python_35.rst @@ -97,7 +97,7 @@ Changes to built-in modules: +-----------------------------------------------------------------------------------------------------------+---------------+ | `math `_ | +-----------------------------------------------------------------------------------------------------------+---------------+ - | Two new constants have been added to the math module: *inf* and *nan*. | | + | Two new constants have been added to the math module: *inf* and *nan*. | Completed | +-----------------------------------------------------------------------------------------------------------+---------------+ | A new function *isclose()* provides a way to test for approximate equality. | | +-----------------------------------------------------------------------------------------------------------+---------------+ diff --git a/docs/differences/python_36.rst b/docs/differences/python_36.rst index 4ea8742243..dec8c5943f 100644 --- a/docs/differences/python_36.rst +++ b/docs/differences/python_36.rst @@ -121,7 +121,7 @@ Changes to built-in modules: +--------------------------------------------------------------------------------------------------------------+----------------+ | `math `_ | +--------------------------------------------------------------------------------------------------------------+----------------+ - | The new math.tau (τ) constant has been added | | + | The new math.tau (τ) constant has been added | Completed | +--------------------------------------------------------------------------------------------------------------+----------------+ | `os `_ | +--------------------------------------------------------------------------------------------------------------+----------------+ From 2e3a2785cdd5c63788cac7ec8b5d62105ecfe4aa Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Sat, 15 Jan 2022 15:19:59 +0100 Subject: [PATCH 0040/1712] extmod/modubinascii: Add newline keyword to b2a_base64 function. This allows encoding things (eg a Basic-Auth header for a request) without slicing the \n from the string, which allocates additional memory. Co-authored-by: David Lechner --- docs/library/binascii.rst | 4 ++-- extmod/modubinascii.c | 22 ++++++++++++++++------ tests/extmod/ubinascii_b2a_base64.py | 3 +++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/docs/library/binascii.rst b/docs/library/binascii.rst index fc621a8abe..6c02f019aa 100644 --- a/docs/library/binascii.rst +++ b/docs/library/binascii.rst @@ -31,8 +31,8 @@ Functions Conforms to `RFC 2045 s.6.8 `_. Returns a bytes object. -.. function:: b2a_base64(data) +.. function:: b2a_base64(data, *, newline=True) Encode binary data in base64 format, as in `RFC 3548 `_. Returns the encoded data - followed by a newline character, as a bytes object. + followed by a newline character if newline is true, as a bytes object. diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c index fab7717c4e..b34f232c62 100644 --- a/extmod/modubinascii.c +++ b/extmod/modubinascii.c @@ -165,12 +165,20 @@ STATIC mp_obj_t mod_binascii_a2b_base64(mp_obj_t data) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_binascii_a2b_base64_obj, mod_binascii_a2b_base64); -STATIC mp_obj_t mod_binascii_b2a_base64(mp_obj_t data) { +STATIC mp_obj_t mod_binascii_b2a_base64(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_newline }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_newline, MP_ARG_BOOL, {.u_bool = true} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + uint8_t newline = args[ARG_newline].u_bool; mp_buffer_info_t bufinfo; - mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ); + mp_get_buffer_raise(pos_args[0], &bufinfo, MP_BUFFER_READ); vstr_t vstr; - vstr_init_len(&vstr, ((bufinfo.len != 0) ? (((bufinfo.len - 1) / 3) + 1) * 4 : 0) + 1); + vstr_init_len(&vstr, ((bufinfo.len != 0) ? (((bufinfo.len - 1) / 3) + 1) * 4 : 0) + newline); // First pass, we convert input buffer to numeric base 64 values byte *in = bufinfo.buf, *out = (byte *)vstr.buf; @@ -196,7 +204,7 @@ STATIC mp_obj_t mod_binascii_b2a_base64(mp_obj_t data) { // Second pass, we convert number base 64 values to actual base64 ascii encoding out = (byte *)vstr.buf; - for (mp_uint_t j = vstr.len - 1; j--;) { + for (mp_uint_t j = vstr.len - newline; j--;) { if (*out < 26) { *out += 'A'; } else if (*out < 52) { @@ -212,10 +220,12 @@ STATIC mp_obj_t mod_binascii_b2a_base64(mp_obj_t data) { } out++; } - *out = '\n'; + if (newline) { + *out = '\n'; + } return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_binascii_b2a_base64_obj, mod_binascii_b2a_base64); +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mod_binascii_b2a_base64_obj, 1, mod_binascii_b2a_base64); #if MICROPY_PY_UBINASCII_CRC32 #include "lib/uzlib/tinf.h" diff --git a/tests/extmod/ubinascii_b2a_base64.py b/tests/extmod/ubinascii_b2a_base64.py index 9c100f972b..3f92488969 100644 --- a/tests/extmod/ubinascii_b2a_base64.py +++ b/tests/extmod/ubinascii_b2a_base64.py @@ -20,3 +20,6 @@ print(binascii.b2a_base64(b"\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f")) print(binascii.b2a_base64(b"\x7f\x80\xff")) print(binascii.b2a_base64(b"1234ABCDabcd")) print(binascii.b2a_base64(b"\x00\x00>")) # convert into '+' + +print(binascii.b2a_base64(b"foobar", newline=True)) +print(binascii.b2a_base64(b"foobar", newline=False)) From c153bfd31137a4eebb8abc4ee41d3cf4a3a7f234 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 23 Jan 2022 10:23:30 +1100 Subject: [PATCH 0041/1712] docs/differences: Update python_36 now that b2a_base64 accepts newline. Signed-off-by: Damien George --- docs/differences/python_36.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/differences/python_36.rst b/docs/differences/python_36.rst index dec8c5943f..edf6bef023 100644 --- a/docs/differences/python_36.rst +++ b/docs/differences/python_36.rst @@ -78,7 +78,7 @@ Changes to built-in modules: +--------------------------------------------------------------------------------------------------------------+----------------+ | `binascii `_ | | +--------------------------------------------------------------------------------------------------------------+----------------+ - | The b2a_base64() function now accepts an optional newline keyword argument to control whether the newline | | + | The b2a_base64() function now accepts an optional newline keyword argument to control whether the newline | Completed | | character is appended to the return value | | +--------------------------------------------------------------------------------------------------------------+----------------+ | `cmath `_ | | From 30b6ce86be384ac04566d8f7bbf67d5906d6f307 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Mon, 13 Sep 2021 10:43:42 +1000 Subject: [PATCH 0042/1712] windows: Add micropython.schedule support. --- ports/windows/mpconfigport.h | 12 ++++++++++++ ports/windows/windows_mphal.c | 12 +++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ports/windows/mpconfigport.h b/ports/windows/mpconfigport.h index 1aae5a7500..88746744ae 100644 --- a/ports/windows/mpconfigport.h +++ b/ports/windows/mpconfigport.h @@ -69,6 +69,9 @@ #define MICROPY_MODULE_WEAK_LINKS (1) #define MICROPY_MODULE_OVERRIDE_MAIN_IMPORT (1) #define MICROPY_CAN_OVERRIDE_BUILTINS (1) +#ifndef MICROPY_ENABLE_SCHEDULER +#define MICROPY_ENABLE_SCHEDULER (1) +#endif #define MICROPY_VFS_POSIX_FILE (1) #define MICROPY_PY_FUNCTION_ATTRS (1) #define MICROPY_PY_DESCRIPTORS (1) @@ -216,6 +219,15 @@ extern const struct _mp_obj_module_t mp_module_time; #define MICROPY_MPHALPORT_H "windows_mphal.h" +#if MICROPY_ENABLE_SCHEDULER +#define MICROPY_EVENT_POLL_HOOK \ + do { \ + extern void mp_handle_pending(bool); \ + mp_handle_pending(true); \ + mp_hal_delay_us(500); \ + } while (0); +#endif + // We need to provide a declaration/definition of alloca() #include diff --git a/ports/windows/windows_mphal.c b/ports/windows/windows_mphal.c index 7a3d881a34..5398e2da51 100644 --- a/ports/windows/windows_mphal.c +++ b/ports/windows/windows_mphal.c @@ -262,8 +262,14 @@ uint64_t mp_hal_time_ns(void) { return (uint64_t)tv.tv_sec * 1000000000ULL + (uint64_t)tv.tv_usec * 1000ULL; } -// TODO: POSIX et al. define usleep() as guaranteedly capable only of 1s sleep: -// "The useconds argument shall be less than one million." void mp_hal_delay_ms(mp_uint_t ms) { - usleep((ms) * 1000); + #ifdef MICROPY_EVENT_POLL_HOOK + mp_uint_t start = mp_hal_ticks_ms(); + while (mp_hal_ticks_ms() - start < ms) { + // MICROPY_EVENT_POLL_HOOK does mp_hal_delay_us(500) (i.e. usleep(500)). + MICROPY_EVENT_POLL_HOOK + } + #else + SleepEx(ms, TRUE); + #endif } From 79a3158de6dbd0b8f628fbf8cd5ffdeeea37bb6e Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 27 Jan 2022 16:36:08 +1100 Subject: [PATCH 0043/1712] stm32/pin: Change remaining uses of "af" to "alt". The keyword "af" has been deprecated for some time and "alt" should be used instead (but "af" still works). Signed-off-by: Damien George --- docs/library/pyb.Pin.rst | 10 +++++----- ports/stm32/pin.c | 10 +++++----- ports/stm32/timer.c | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/library/pyb.Pin.rst b/docs/library/pyb.Pin.rst index 97dfbffbcf..23ede48ed3 100644 --- a/docs/library/pyb.Pin.rst +++ b/docs/library/pyb.Pin.rst @@ -237,17 +237,17 @@ pin X3. For the pyboard, x3_af would contain: [Pin.AF1_TIM2, Pin.AF2_TIM5, Pin.AF3_TIM9, Pin.AF7_USART2] -Normally, each peripheral would configure the af automatically, but sometimes -the same function is available on multiple pins, and having more control -is desired. +Normally, each peripheral would configure the alternate function automatically, +but sometimes the same function is available on multiple pins, and having more +control is desired. To configure X3 to expose TIM2_CH3, you could use:: - pin = pyb.Pin(pyb.Pin.board.X3, mode=pyb.Pin.AF_PP, af=pyb.Pin.AF1_TIM2) + pin = pyb.Pin(pyb.Pin.board.X3, mode=pyb.Pin.AF_PP, alt=pyb.Pin.AF1_TIM2) or:: - pin = pyb.Pin(pyb.Pin.board.X3, mode=pyb.Pin.AF_PP, af=1) + pin = pyb.Pin(pyb.Pin.board.X3, mode=pyb.Pin.AF_PP, alt=1) Methods ------- diff --git a/ports/stm32/pin.c b/ports/stm32/pin.c index ad153311e3..b490a09b7f 100644 --- a/ports/stm32/pin.c +++ b/ports/stm32/pin.c @@ -230,9 +230,9 @@ STATIC void pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t mp_uint_t af_idx = pin_get_af(self); const pin_af_obj_t *af_obj = pin_find_af_by_index(self, af_idx); if (af_obj == NULL) { - mp_printf(print, ", af=%d)", af_idx); + mp_printf(print, ", alt=%d)", af_idx); } else { - mp_printf(print, ", af=Pin.%q)", af_obj->name); + mp_printf(print, ", alt=Pin.%q)", af_obj->name); } } else { mp_print_str(print, ")"); @@ -328,7 +328,7 @@ STATIC mp_obj_t pin_debug(size_t n_args, const mp_obj_t *args) { STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pin_debug_fun_obj, 1, 2, pin_debug); STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(pin_debug_obj, MP_ROM_PTR(&pin_debug_fun_obj)); -// init(mode, pull=None, af=-1, *, value, alt) +// init(mode, pull=None, alt=-1, *, value, alt) STATIC mp_obj_t pin_obj_init_helper(const pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { static const mp_arg_t allowed_args[] = { { MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT }, @@ -625,9 +625,9 @@ const mp_obj_type_t pin_type = { /// is desired. /// /// To configure X3 to expose TIM2_CH3, you could use: -/// pin = pyb.Pin(pyb.Pin.board.X3, mode=pyb.Pin.AF_PP, af=pyb.Pin.AF1_TIM2) +/// pin = pyb.Pin(pyb.Pin.board.X3, mode=pyb.Pin.AF_PP, alt=pyb.Pin.AF1_TIM2) /// or: -/// pin = pyb.Pin(pyb.Pin.board.X3, mode=pyb.Pin.AF_PP, af=1) +/// pin = pyb.Pin(pyb.Pin.board.X3, mode=pyb.Pin.AF_PP, alt=1) /// \method __str__() /// Return a string describing the alternate function. diff --git a/ports/stm32/timer.c b/ports/stm32/timer.c index c23e7e02d4..5a968ec56d 100644 --- a/ports/stm32/timer.c +++ b/ports/stm32/timer.c @@ -1110,14 +1110,14 @@ STATIC mp_obj_t pyb_timer_channel(size_t n_args, const mp_obj_t *pos_args, mp_ma const pin_obj_t *pin = MP_OBJ_TO_PTR(pin_obj); const pin_af_obj_t *af = pin_find_af(pin, AF_FN_TIM, self->tim_id); if (af == NULL) { - mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("Pin(%q) doesn't have an af for Timer(%d)"), pin->name, self->tim_id); + mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("Pin(%q) doesn't have an alt for Timer(%d)"), pin->name, self->tim_id); } - // pin.init(mode=AF_PP, af=idx) + // pin.init(mode=AF_PP, alt=idx) const mp_obj_t args2[6] = { MP_OBJ_FROM_PTR(&pin_init_obj), pin_obj, MP_OBJ_NEW_QSTR(MP_QSTR_mode), MP_OBJ_NEW_SMALL_INT(GPIO_MODE_AF_PP), - MP_OBJ_NEW_QSTR(MP_QSTR_af), MP_OBJ_NEW_SMALL_INT(af->idx) + MP_OBJ_NEW_QSTR(MP_QSTR_alt), MP_OBJ_NEW_SMALL_INT(af->idx) }; mp_call_method_n_kw(0, 2, args2); } From e1a84a0c6f7ddc0335b4a78a2ea3bcc5f2176965 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 27 Jan 2022 16:38:14 +1100 Subject: [PATCH 0044/1712] esp32/partitions: Increase size of app-part from 0x180000 to 0x1F0000. To fill out all of the available flash up to the start of the filesystem partition. Signed-off-by: Damien George --- ports/esp32/partitions-16MiB.csv | 2 +- ports/esp32/partitions.csv | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/esp32/partitions-16MiB.csv b/ports/esp32/partitions-16MiB.csv index 20d06bad47..ee3e8c7269 100644 --- a/ports/esp32/partitions-16MiB.csv +++ b/ports/esp32/partitions-16MiB.csv @@ -3,5 +3,5 @@ # Name, Type, SubType, Offset, Size, Flags nvs, data, nvs, 0x9000, 0x6000, phy_init, data, phy, 0xf000, 0x1000, -factory, app, factory, 0x10000, 0x180000, +factory, app, factory, 0x10000, 0x1F0000, vfs, data, fat, 0x200000, 0xD59F80, diff --git a/ports/esp32/partitions.csv b/ports/esp32/partitions.csv index d304dccc53..53f0f16744 100644 --- a/ports/esp32/partitions.csv +++ b/ports/esp32/partitions.csv @@ -3,5 +3,5 @@ # Name, Type, SubType, Offset, Size, Flags nvs, data, nvs, 0x9000, 0x6000, phy_init, data, phy, 0xf000, 0x1000, -factory, app, factory, 0x10000, 0x180000, +factory, app, factory, 0x10000, 0x1F0000, vfs, data, fat, 0x200000, 0x200000, From 2dd3d88409937908da6ee05d2d391453df9a3c8a Mon Sep 17 00:00:00 2001 From: robert-hh Date: Thu, 16 Dec 2021 22:10:50 +0100 Subject: [PATCH 0045/1712] mimxrt: Support gaps in the SPI an I2C device numbers. That allows also to use e.g. SPI1 and SPI2 instead SPI0 and SPI1. --- ports/mimxrt/machine_i2c.c | 2 +- ports/mimxrt/machine_spi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/mimxrt/machine_i2c.c b/ports/mimxrt/machine_i2c.c index 618d0a2581..58dd824490 100644 --- a/ports/mimxrt/machine_i2c.c +++ b/ports/mimxrt/machine_i2c.c @@ -109,7 +109,7 @@ mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n // Get I2C bus. int i2c_id = mp_obj_get_int(args[ARG_id].u_obj); - if (i2c_id < 0 || i2c_id >= MICROPY_HW_I2C_NUM) { + if (i2c_id < 0 || i2c_id >= MICROPY_HW_I2C_NUM || i2c_index_table[i2c_id] == 0) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2C(%d) doesn't exist"), i2c_id); } diff --git a/ports/mimxrt/machine_spi.c b/ports/mimxrt/machine_spi.c index 41843b06d9..c7ee226bfc 100644 --- a/ports/mimxrt/machine_spi.c +++ b/ports/mimxrt/machine_spi.c @@ -137,7 +137,7 @@ mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n // Get the SPI bus id. int spi_id = mp_obj_get_int(args[ARG_id].u_obj); - if (spi_id < 0 || spi_id >= MP_ARRAY_SIZE(spi_index_table)) { + if (spi_id < 0 || spi_id >= MP_ARRAY_SIZE(spi_index_table) || spi_index_table[spi_id] == 0) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("SPI(%d) doesn't exist"), spi_id); } From 84b76e4fbff86abb1abd340dd25d38c73d619132 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Fri, 17 Dec 2021 16:29:26 +0100 Subject: [PATCH 0046/1712] mimxrt: Allow for board-specific flash driver files. If in a board's mkconfigboard.mk the following symbol is set: MICROPY_HW_BOARD_FLASH_FILES = 1 then the files: ($BOARD)_flexspi_flash_config.h and qspi_nor_flash_config.c and/or qspi_hyper_flash_config.c are expected in the board directory. Otherwise the common files from the hal directory are used. --- ports/mimxrt/Makefile | 22 ++++++++++++++++++++-- ports/mimxrt/hal/flexspi_hyper_flash.h | 2 +- ports/mimxrt/hal/flexspi_nor_flash.h | 2 +- ports/mimxrt/hal/qspi_hyper_flash_config.c | 2 +- ports/mimxrt/hal/qspi_nor_flash_config.c | 2 +- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ports/mimxrt/Makefile b/ports/mimxrt/Makefile index 32b1145230..2881c7c767 100644 --- a/ports/mimxrt/Makefile +++ b/ports/mimxrt/Makefile @@ -95,6 +95,8 @@ ifeq ($(MICROPY_HW_FLASH_TYPE), qspi_nor) CFLAGS += -DBOARD_FLASH_OPS_HEADER_H=\"hal/flexspi_nor_flash.h\" else ifeq ($(MICROPY_HW_FLASH_TYPE), hyperflash) CFLAGS += -DBOARD_FLASH_OPS_HEADER_H=\"hal/flexspi_hyper_flash.h\" +else +$(error Error: Unknown board flash type $(MICROPY_HW_FLASH_TYPE)) endif ifeq ($(MICROPY_PY_MACHINE_SDCARD),1) @@ -272,6 +274,22 @@ SRC_C += \ $(SRC_HAL_IMX_C) \ $(SRC_ETH_C) \ +ifeq ($(MICROPY_HW_BOARD_FLASH_FILES), 1) +CFLAGS += -DBOARD_FLASH_CONFIG_HEADER_H=\"$(BOARD)_flexspi_flash_config.h\" + +ifeq ($(MICROPY_HW_FLASH_TYPE), qspi_nor) +SRC_C += \ + hal/flexspi_nor_flash.c \ + $(BOARD_DIR)/qspi_nor_flash_config.c +else ifeq ($(MICROPY_HW_FLASH_TYPE), hyperflash) +SRC_C += \ + hal/flexspi_hyper_flash.c \ + $(BOARD_DIR)/qspi_hyper_flash_config.c +endif + +else + +CFLAGS += -DBOARD_FLASH_CONFIG_HEADER_H=\"hal/flexspi_flash_config.h\" ifeq ($(MICROPY_HW_FLASH_TYPE), qspi_nor) SRC_C += \ @@ -281,8 +299,8 @@ else ifeq ($(MICROPY_HW_FLASH_TYPE), hyperflash) SRC_C += \ hal/flexspi_hyper_flash.c \ hal/qspi_hyper_flash_config.c -else -$(error Error: Unknown board flash type $(MICROPY_HW_FLASH_TYPE)) +endif + endif ifeq ($(MICROPY_FLOAT_IMPL),double) diff --git a/ports/mimxrt/hal/flexspi_hyper_flash.h b/ports/mimxrt/hal/flexspi_hyper_flash.h index f340aec10a..dbd028fd6f 100644 --- a/ports/mimxrt/hal/flexspi_hyper_flash.h +++ b/ports/mimxrt/hal/flexspi_hyper_flash.h @@ -28,7 +28,7 @@ #include "fsl_flexspi.h" #include "mpconfigboard.h" -#include "flexspi_flash_config.h" +#include BOARD_FLASH_CONFIG_HEADER_H // Defined in boards flash_config.c extern flexspi_nor_config_t qspiflash_config; diff --git a/ports/mimxrt/hal/flexspi_nor_flash.h b/ports/mimxrt/hal/flexspi_nor_flash.h index c2c30876c7..f8c31488a9 100644 --- a/ports/mimxrt/hal/flexspi_nor_flash.h +++ b/ports/mimxrt/hal/flexspi_nor_flash.h @@ -28,7 +28,7 @@ #include "fsl_flexspi.h" #include "mpconfigboard.h" -#include "flexspi_flash_config.h" +#include BOARD_FLASH_CONFIG_HEADER_H // Defined in boards flash_config.c extern flexspi_nor_config_t qspiflash_config; diff --git a/ports/mimxrt/hal/qspi_hyper_flash_config.c b/ports/mimxrt/hal/qspi_hyper_flash_config.c index 17a952b689..f5ffbe8413 100644 --- a/ports/mimxrt/hal/qspi_hyper_flash_config.c +++ b/ports/mimxrt/hal/qspi_hyper_flash_config.c @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "flexspi_flash_config.h" +#include BOARD_FLASH_CONFIG_HEADER_H /* Component ID definition, used by tools. */ #ifndef FSL_COMPONENT_ID diff --git a/ports/mimxrt/hal/qspi_nor_flash_config.c b/ports/mimxrt/hal/qspi_nor_flash_config.c index f42730ad54..469a584b87 100644 --- a/ports/mimxrt/hal/qspi_nor_flash_config.c +++ b/ports/mimxrt/hal/qspi_nor_flash_config.c @@ -7,7 +7,7 @@ // Based on tinyusb/hw/bsp/teensy_40/evkmimxrt1010_flexspi_nor_config.c -#include "flexspi_flash_config.h" +#include BOARD_FLASH_CONFIG_HEADER_H /* Component ID definition, used by tools. */ #ifndef FSL_COMPONENT_ID From b8a0358c34bf4786b416a18f1d25ac2ab23d1704 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Mon, 27 Dec 2021 13:46:56 +0100 Subject: [PATCH 0047/1712] mimxrt: Compensate for a bug in the fsl_lpspi.c file. This library file has a bug, in that TransferBlocking returns before the transfer has finished. That is a problem if a write follows immediately a read. --- ports/mimxrt/machine_spi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/mimxrt/machine_spi.c b/ports/mimxrt/machine_spi.c index c7ee226bfc..db2fab4ee6 100644 --- a/ports/mimxrt/machine_spi.c +++ b/ports/mimxrt/machine_spi.c @@ -230,7 +230,7 @@ void LPSPI_EDMAMasterCallback(LPSPI_Type *base, lpspi_master_edma_handle_t *hand STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) { machine_spi_obj_t *self = (machine_spi_obj_t *)self_in; // Use DMA for large transfers if channels are available - const size_t dma_min_size_threshold = 16; // That's the FIFO size + const size_t dma_min_size_threshold = FSL_FEATURE_LPSPI_FIFO_SIZEn(0); // The Macro argument is ignored int chan_tx = -1; int chan_rx = -1; @@ -302,6 +302,10 @@ STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8 } if (!use_dma) { + // Wait until a previous Transfer is finished + while (LPSPI_GetTxFifoCount(self->spi_inst) > 0) { + MICROPY_EVENT_POLL_HOOK + } // Reconfigure the TCR, required after switch between DMA vs. non-DMA LPSPI_Enable(self->spi_inst, false); // Disable first before new settings are applied self->spi_inst->TCR = LPSPI_TCR_CPOL(self->master_config->cpol) | LPSPI_TCR_CPHA(self->master_config->cpha) | From 5bda84aed59be8ce75308abcb9562b6d015c69ef Mon Sep 17 00:00:00 2001 From: robert-hh Date: Wed, 29 Dec 2021 22:03:33 +0100 Subject: [PATCH 0048/1712] mimxrt: Remove two files from the Seeed Arch Mix directory. These were leftovers from a previous refactoring in the Seeed Arch Mix directory. --- .../SEEED_ARCH_MIX_flexspi_nor_config.h | 258 ------------------ .../SEEED_ARCH_MIX/qspi_nor_flash_config.c | 136 --------- 2 files changed, 394 deletions(-) delete mode 100644 ports/mimxrt/boards/SEEED_ARCH_MIX/SEEED_ARCH_MIX_flexspi_nor_config.h delete mode 100644 ports/mimxrt/boards/SEEED_ARCH_MIX/qspi_nor_flash_config.c diff --git a/ports/mimxrt/boards/SEEED_ARCH_MIX/SEEED_ARCH_MIX_flexspi_nor_config.h b/ports/mimxrt/boards/SEEED_ARCH_MIX/SEEED_ARCH_MIX_flexspi_nor_config.h deleted file mode 100644 index 33698a34d2..0000000000 --- a/ports/mimxrt/boards/SEEED_ARCH_MIX/SEEED_ARCH_MIX_flexspi_nor_config.h +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright 2019 NXP. - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -// Based on tinyusb/hw/bsp/teensy_40/evkmimxrt1020_flexspi_nor_config.h - -#ifndef __SEEED_ARCH_MIX_FLEXSPI_NOR_CONFIG__ -#define __SEEED_ARCH_MIX_FLEXSPI_NOR_CONFIG__ - -#include -#include -#include "fsl_common.h" - -/*! @name Driver version */ -/*@{*/ -/*! @brief XIP_BOARD driver version 2.0.0. */ -#define FSL_XIP_BOARD_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) -/*@}*/ - -/* FLEXSPI memory config block related defintions */ -#define FLEXSPI_CFG_BLK_TAG (0x42464346UL) // ascii "FCFB" Big Endian -#define FLEXSPI_CFG_BLK_VERSION (0x56010400UL) // V1.4.0 -#define FLEXSPI_CFG_BLK_SIZE (512) - -/* FLEXSPI Feature related definitions */ -#define FLEXSPI_FEATURE_HAS_PARALLEL_MODE 1 - -/* Lookup table related defintions */ -#define CMD_INDEX_READ 0 -#define CMD_INDEX_READSTATUS 1 -#define CMD_INDEX_WRITEENABLE 2 -#define CMD_INDEX_WRITE 4 - -#define CMD_LUT_SEQ_IDX_READ 0 -#define CMD_LUT_SEQ_IDX_READSTATUS 1 -#define CMD_LUT_SEQ_IDX_WRITEENABLE 3 -#define CMD_LUT_SEQ_IDX_WRITE 9 - -#define CMD_SDR 0x01 -#define CMD_DDR 0x21 -#define RADDR_SDR 0x02 -#define RADDR_DDR 0x22 -#define CADDR_SDR 0x03 -#define CADDR_DDR 0x23 -#define MODE1_SDR 0x04 -#define MODE1_DDR 0x24 -#define MODE2_SDR 0x05 -#define MODE2_DDR 0x25 -#define MODE4_SDR 0x06 -#define MODE4_DDR 0x26 -#define MODE8_SDR 0x07 -#define MODE8_DDR 0x27 -#define WRITE_SDR 0x08 -#define WRITE_DDR 0x28 -#define READ_SDR 0x09 -#define READ_DDR 0x29 -#define LEARN_SDR 0x0A -#define LEARN_DDR 0x2A -#define DATSZ_SDR 0x0B -#define DATSZ_DDR 0x2B -#define DUMMY_SDR 0x0C -#define DUMMY_DDR 0x2C -#define DUMMY_RWDS_SDR 0x0D -#define DUMMY_RWDS_DDR 0x2D -#define JMP_ON_CS 0x1F -#define STOP 0 - -#define FLEXSPI_1PAD 0 -#define FLEXSPI_2PAD 1 -#define FLEXSPI_4PAD 2 -#define FLEXSPI_8PAD 3 - -#define FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) \ - (FLEXSPI_LUT_OPERAND0(op0) | FLEXSPI_LUT_NUM_PADS0(pad0) | FLEXSPI_LUT_OPCODE0(cmd0) | FLEXSPI_LUT_OPERAND1(op1) | \ - FLEXSPI_LUT_NUM_PADS1(pad1) | FLEXSPI_LUT_OPCODE1(cmd1)) - -// !@brief Definitions for FlexSPI Serial Clock Frequency -typedef enum _FlexSpiSerialClockFreq -{ - kFlexSpiSerialClk_30MHz = 1, - kFlexSpiSerialClk_50MHz = 2, - kFlexSpiSerialClk_60MHz = 3, - kFlexSpiSerialClk_75MHz = 4, - kFlexSpiSerialClk_80MHz = 5, - kFlexSpiSerialClk_100MHz = 6, - kFlexSpiSerialClk_133MHz = 7, - kFlexSpiSerialClk_166MHz = 8, - kFlexSpiSerialClk_200MHz = 9, -} flexspi_serial_clk_freq_t; - -// !@brief FlexSPI clock configuration type -enum -{ - kFlexSpiClk_SDR, // !< Clock configure for SDR mode - kFlexSpiClk_DDR, // !< Clock configurat for DDR mode -}; - -// !@brief FlexSPI Read Sample Clock Source definition -typedef enum _FlashReadSampleClkSource -{ - kFlexSPIReadSampleClk_LoopbackInternally = 0, - kFlexSPIReadSampleClk_LoopbackFromDqsPad = 1, - kFlexSPIReadSampleClk_LoopbackFromSckPad = 2, - kFlexSPIReadSampleClk_ExternalInputFromDqsPad = 3, -} flexspi_read_sample_clk_t; - -// !@brief Misc feature bit definitions -enum -{ - kFlexSpiMiscOffset_DiffClkEnable = 0, // !< Bit for Differential clock enable - kFlexSpiMiscOffset_Ck2Enable = 1, // !< Bit for CK2 enable - kFlexSpiMiscOffset_ParallelEnable = 2, // !< Bit for Parallel mode enable - kFlexSpiMiscOffset_WordAddressableEnable = 3, // !< Bit for Word Addressable enable - kFlexSpiMiscOffset_SafeConfigFreqEnable = 4, // !< Bit for Safe Configuration Frequency enable - kFlexSpiMiscOffset_PadSettingOverrideEnable = 5, // !< Bit for Pad setting override enable - kFlexSpiMiscOffset_DdrModeEnable = 6, // !< Bit for DDR clock confiuration indication. -}; - -// !@brief Flash Type Definition -enum -{ - kFlexSpiDeviceType_SerialNOR = 1, // !< Flash devices are Serial NOR - kFlexSpiDeviceType_SerialNAND = 2, // !< Flash devices are Serial NAND - kFlexSpiDeviceType_SerialRAM = 3, // !< Flash devices are Serial RAM/HyperFLASH - kFlexSpiDeviceType_MCP_NOR_NAND = 0x12, // !< Flash device is MCP device, A1 is Serial NOR, A2 is Serial NAND - kFlexSpiDeviceType_MCP_NOR_RAM = 0x13, // !< Flash deivce is MCP device, A1 is Serial NOR, A2 is Serial RAMs -}; - -// !@brief Flash Pad Definitions -enum -{ - kSerialFlash_1Pad = 1, - kSerialFlash_2Pads = 2, - kSerialFlash_4Pads = 4, - kSerialFlash_8Pads = 8, -}; - -// !@brief FlexSPI LUT Sequence structure -typedef struct _lut_sequence -{ - uint8_t seqNum; // !< Sequence Number, valid number: 1-16 - uint8_t seqId; // !< Sequence Index, valid number: 0-15 - uint16_t reserved; -} flexspi_lut_seq_t; - -// !@brief Flash Configuration Command Type -enum -{ - kDeviceConfigCmdType_Generic, // !< Generic command, for example: configure dummy cycles, drive strength, etc - kDeviceConfigCmdType_QuadEnable, // !< Quad Enable command - kDeviceConfigCmdType_Spi2Xpi, // !< Switch from SPI to DPI/QPI/OPI mode - kDeviceConfigCmdType_Xpi2Spi, // !< Switch from DPI/QPI/OPI to SPI mode - kDeviceConfigCmdType_Spi2NoCmd, // !< Switch to 0-4-4/0-8-8 mode - kDeviceConfigCmdType_Reset, // !< Reset device command -}; - -// !@brief FlexSPI Memory Configuration Block -typedef struct _FlexSPIConfig -{ - uint32_t tag; // !< [0x000-0x003] Tag, fixed value 0x42464346UL - uint32_t version; // !< [0x004-0x007] Version,[31:24] -'V', [23:16] - Major, [15:8] - Minor, [7:0] - bugfix - uint32_t reserved0; // !< [0x008-0x00b] Reserved for future use - uint8_t readSampleClkSrc; // !< [0x00c-0x00c] Read Sample Clock Source, valid value: 0/1/3 - uint8_t csHoldTime; // !< [0x00d-0x00d] CS hold time, default value: 3 - uint8_t csSetupTime; // !< [0x00e-0x00e] CS setup time, default value: 3 - uint8_t columnAddressWidth; // !< [0x00f-0x00f] Column Address with, for HyperBus protocol, it is fixed to 3, For - // ! Serial NAND, need to refer to datasheet - uint8_t deviceModeCfgEnable; // !< [0x010-0x010] Device Mode Configure enable flag, 1 - Enable, 0 - Disable - uint8_t deviceModeType; // !< [0x011-0x011] Specify the configuration command type:Quad Enable, DPI/QPI/OPI switch, - // ! Generic configuration, etc. - uint16_t waitTimeCfgCommands; // !< [0x012-0x013] Wait time for all configuration commands, unit: 100us, Used for - // ! DPI/QPI/OPI switch or reset command - flexspi_lut_seq_t deviceModeSeq; // !< [0x014-0x017] Device mode sequence info, [7:0] - LUT sequence id, [15:8] - LUt - // ! sequence number, [31:16] Reserved - uint32_t deviceModeArg; // !< [0x018-0x01b] Argument/Parameter for device configuration - uint8_t configCmdEnable; // !< [0x01c-0x01c] Configure command Enable Flag, 1 - Enable, 0 - Disable - uint8_t configModeType[3]; // !< [0x01d-0x01f] Configure Mode Type, similar as deviceModeTpe - flexspi_lut_seq_t - configCmdSeqs[3]; // !< [0x020-0x02b] Sequence info for Device Configuration command, similar as deviceModeSeq - uint32_t reserved1; // !< [0x02c-0x02f] Reserved for future use - uint32_t configCmdArgs[3]; // !< [0x030-0x03b] Arguments/Parameters for device Configuration commands - uint32_t reserved2; // !< [0x03c-0x03f] Reserved for future use - uint32_t controllerMiscOption; // !< [0x040-0x043] Controller Misc Options, see Misc feature bit definitions for more - // ! details - uint8_t deviceType; // !< [0x044-0x044] Device Type: See Flash Type Definition for more details - uint8_t sflashPadType; // !< [0x045-0x045] Serial Flash Pad Type: 1 - Single, 2 - Dual, 4 - Quad, 8 - Octal - uint8_t serialClkFreq; // !< [0x046-0x046] Serial Flash Frequencey, device specific definitions, See System Boot - // ! Chapter for more details - uint8_t lutCustomSeqEnable; // !< [0x047-0x047] LUT customization Enable, it is required if the program/erase cannot - // ! be done using 1 LUT sequence, currently, only applicable to HyperFLASH - uint32_t reserved3[2]; // !< [0x048-0x04f] Reserved for future use - uint32_t sflashA1Size; // !< [0x050-0x053] Size of Flash connected to A1 - uint32_t sflashA2Size; // !< [0x054-0x057] Size of Flash connected to A2 - uint32_t sflashB1Size; // !< [0x058-0x05b] Size of Flash connected to B1 - uint32_t sflashB2Size; // !< [0x05c-0x05f] Size of Flash connected to B2 - uint32_t csPadSettingOverride; // !< [0x060-0x063] CS pad setting override value - uint32_t sclkPadSettingOverride; // !< [0x064-0x067] SCK pad setting override value - uint32_t dataPadSettingOverride; // !< [0x068-0x06b] data pad setting override value - uint32_t dqsPadSettingOverride; // !< [0x06c-0x06f] DQS pad setting override value - uint32_t timeoutInMs; // !< [0x070-0x073] Timeout threshold for read status command - uint32_t commandInterval; // !< [0x074-0x077] CS deselect interval between two commands - uint16_t dataValidTime[2]; // !< [0x078-0x07b] CLK edge to data valid time for PORT A and PORT B, in terms of 0.1ns - uint16_t busyOffset; // !< [0x07c-0x07d] Busy offset, valid value: 0-31 - uint16_t busyBitPolarity; // !< [0x07e-0x07f] Busy flag polarity, 0 - busy flag is 1 when flash device is busy, 1 - - // ! busy flag is 0 when flash device is busy - uint32_t lookupTable[64]; // !< [0x080-0x17f] Lookup table holds Flash command sequences - flexspi_lut_seq_t lutCustomSeq[12]; // !< [0x180-0x1af] Customizable LUT Sequences - uint32_t reserved4[4]; // !< [0x1b0-0x1bf] Reserved for future use -} flexspi_mem_config_t; - -/* */ -#define NOR_CMD_LUT_SEQ_IDX_READ_NORMAL 0 -#define NOR_CMD_LUT_SEQ_IDX_READSTATUSREG 1 -#define NOR_CMD_LUT_SEQ_IDX_READ_FAST_QUAD 2 -#define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE 3 -#define NOR_CMD_LUT_SEQ_IDX_READSTATUS_XPI 4 -#define NOR_CMD_LUT_SEQ_IDX_ERASESECTOR 5 -#define NOR_CMD_LUT_SEQ_IDX_WRITESTATUSREG 6 -#define NOR_CMD_LUT_SEQ_IDX_PAGEPROGRAM_QUAD 7 -#define NOR_CMD_LUT_SEQ_IDX_READID 8 -#define NOR_CMD_LUT_SEQ_IDX_PAGEPROGRAM 9 -#define NOR_CMD_LUT_SEQ_IDX_ENTERQPI 10 -#define NOR_CMD_LUT_SEQ_IDX_CHIPERASE 11 -#define NOR_CMD_LUT_SEQ_IDX_EXITQPI 12 - -/* - * Serial NOR configuration block - */ -typedef struct _flexspi_nor_config -{ - flexspi_mem_config_t memConfig; // !< Common memory configuration info via FlexSPI - uint32_t pageSize; // !< Page size of Serial NOR - uint32_t sectorSize; // !< Sector size of Serial NOR - uint8_t ipcmdSerialClkFreq; // !< Clock frequency for IP command - uint8_t isUniformBlockSize; // !< Sector/Block size is the same - uint8_t reserved0[2]; // !< Reserved for future use - uint8_t serialNorType; // !< Serial NOR Flash type: 0/1/2/3 - uint8_t needExitNoCmdMode; // !< Need to exit NoCmd mode before other IP command - uint8_t halfClkForNonReadCmd; // !< Half the Serial Clock for non-read command: true/false - uint8_t needRestoreNoCmdMode; // !< Need to Restore NoCmd mode after IP commmand execution - uint32_t blockSize; // !< Block size - uint32_t reserve2[11]; // !< Reserved for future use -} flexspi_nor_config_t; - -#define FLASH_BUSY_STATUS_POL 0 -#define FLASH_BUSY_STATUS_OFFSET 0 - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif -#endif /* __SEEED_ARCH_MIX_FLEXSPI_NOR_CONFIG__ */ diff --git a/ports/mimxrt/boards/SEEED_ARCH_MIX/qspi_nor_flash_config.c b/ports/mimxrt/boards/SEEED_ARCH_MIX/qspi_nor_flash_config.c deleted file mode 100644 index 7b2584d3de..0000000000 --- a/ports/mimxrt/boards/SEEED_ARCH_MIX/qspi_nor_flash_config.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 2019 NXP. - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -// Based on tinyusb/hw/bsp/teensy_40/evkmimxrt1010_flexspi_nor_config.c - -#include BOARD_FLASH_CONFIG_HEADER_H - -/* Component ID definition, used by tools. */ -#ifndef FSL_COMPONENT_ID -#define FSL_COMPONENT_ID "platform.drivers.xip_board" -#endif - -/******************************************************************************* - * Code - ******************************************************************************/ -#if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1) -#if defined(__ARMCC_VERSION) || defined(__GNUC__) -__attribute__((section(".boot_hdr.conf"))) -#elif defined(__ICCARM__) -#pragma location = ".boot_hdr.conf" -#endif - -const flexspi_nor_config_t qspiflash_config = { - .memConfig = - { - .tag = FLEXSPI_CFG_BLK_TAG, - .version = FLEXSPI_CFG_BLK_VERSION, - .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad, - .csHoldTime = 3u, - .csSetupTime = 3u, - .busyOffset = FLASH_BUSY_STATUS_OFFSET, // Status bit 0 indicates busy. - .busyBitPolarity = FLASH_BUSY_STATUS_POL, // Busy when the bit is 1. - .deviceModeCfgEnable = 1u, - .deviceModeType = kDeviceConfigCmdType_QuadEnable, - .deviceModeSeq = { - .seqId = 4u, - .seqNum = 1u, - }, - .deviceModeArg = 0x40, - // Enable DDR mode, Wordaddassable, Safe configuration, Differential clock - .deviceType = kFlexSpiDeviceType_SerialNOR, - .sflashPadType = kSerialFlash_4Pads, - .serialClkFreq = kFlexSpiSerialClk_100MHz, - .sflashA1Size = BOARD_FLASH_SIZE, - .lookupTable = - { - // 0 Read LUTs 0 -> 0 - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18), - FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04), - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - - // 1 Read status register -> 1 - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05, READ_SDR, FLEXSPI_1PAD, 0x01), - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - - // 2 Fast read quad mode - SDR - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x6B, RADDR_SDR, FLEXSPI_1PAD, 0x18), - FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x08, READ_SDR, FLEXSPI_4PAD, 0x04), - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - - // 3 Write Enable -> 3 - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06, STOP, FLEXSPI_1PAD, 0), - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - - // 4 Read extend parameters - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x81, READ_SDR, FLEXSPI_1PAD, 0x04), - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - - // 5 Erase Sector -> 5 - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20, RADDR_SDR, FLEXSPI_1PAD, 24), - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - - // 6 Write Status Reg - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01, WRITE_SDR, FLEXSPI_1PAD, 0x04), - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - - // 7 Page Program - quad mode (-> 9) - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x32, RADDR_SDR, FLEXSPI_1PAD, 0x18), - FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_4PAD, 0x04, STOP, FLEXSPI_1PAD, 0), - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - - // 8 Read ID - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x90, DUMMY_SDR, FLEXSPI_1PAD, 24), - FLEXSPI_LUT_SEQ(READ_SDR, FLEXSPI_1PAD, 0x00, 0, 0, 0), - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - - // 9 Page Program - single mode -> 9 - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02, RADDR_SDR, FLEXSPI_1PAD, 24), - FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0, 0, 0, 0), - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - - // 10 Enter QPI mode - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x35, STOP, FLEXSPI_1PAD, 0), - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - - // 11 Erase Chip - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60, STOP, FLEXSPI_1PAD, 0), - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - - // 12 Exit QPI mode - FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_4PAD, 0xF5, STOP, FLEXSPI_1PAD, 0), - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - FLEXSPI_LUT_SEQ(0, 0, 0, 0, 0, 0), // Filler - }, - }, - .pageSize = 256u, - .sectorSize = 4u * 1024u, - .blockSize = 256u * 1024u, - .isUniformBlockSize = false, - // .ipcmdSerialClkFreq = kFlexSpiSerialClk_30MHz, -}; -#endif /* XIP_BOOT_HEADER_ENABLE */ From 1dc366f90194789d9be1bd44dbca2376c75421dc Mon Sep 17 00:00:00 2001 From: robert-hh Date: Sun, 2 Jan 2022 13:21:06 +0100 Subject: [PATCH 0049/1712] mimxrt: Replace Pin-config constants by a function call. The Pin config setting by IOMUXC_SetPinConfig() is supplied by a bit pattern. That pattern is specific for a MCU family. In preparation for supporting the MIMXRT117x family, the constant bit pattern is replaced by a function call, such that the bit pattern is created at a single place. The code for this functions was taken from machine_pin.c. Note: A working port for the MIMXRT1176 exists already. --- ports/mimxrt/eth.c | 6 ++- ports/mimxrt/machine_i2c.c | 7 ++-- ports/mimxrt/machine_pin.c | 34 +--------------- ports/mimxrt/machine_pwm.c | 4 +- ports/mimxrt/machine_spi.c | 8 ++-- ports/mimxrt/machine_uart.c | 6 ++- ports/mimxrt/pin.c | 80 +++++++++++++++++++++++++++++++++++++ ports/mimxrt/pin.h | 2 + ports/mimxrt/sdcard.c | 26 +++++------- 9 files changed, 111 insertions(+), 62 deletions(-) diff --git a/ports/mimxrt/eth.c b/ports/mimxrt/eth.c index 1a8210cb11..5a5138443c 100644 --- a/ports/mimxrt/eth.c +++ b/ports/mimxrt/eth.c @@ -194,7 +194,8 @@ void eth_init(eth_t *self, int mac_idx, const phy_operations_t *phy_ops, int phy const machine_pin_af_obj_t *af_obj = pin_find_af(reset_pin, PIN_AF_MODE_ALT5); IOMUXC_SetPinMux(reset_pin->muxRegister, af_obj->af_mode, 0, 0, reset_pin->configRegister, 0U); - IOMUXC_SetPinConfig(reset_pin->muxRegister, af_obj->af_mode, 0, 0, reset_pin->configRegister, 0xB0A9U); + IOMUXC_SetPinConfig(reset_pin->muxRegister, af_obj->af_mode, 0, 0, reset_pin->configRegister, + pin_generate_config(PIN_PULL_DISABLED, PIN_MODE_OUT, PIN_DRIVE_POWER_5, reset_pin->configRegister)); GPIO_PinInit(reset_pin->gpio, reset_pin->pin, &gpio_config); #endif @@ -204,7 +205,8 @@ void eth_init(eth_t *self, int mac_idx, const phy_operations_t *phy_ops, int phy af_obj = pin_find_af(int_pin, PIN_AF_MODE_ALT5); IOMUXC_SetPinMux(int_pin->muxRegister, af_obj->af_mode, 0, 0, int_pin->configRegister, 0U); - IOMUXC_SetPinConfig(int_pin->muxRegister, af_obj->af_mode, 0, 0, int_pin->configRegister, 0xB0A9U); + IOMUXC_SetPinConfig(int_pin->muxRegister, af_obj->af_mode, 0, 0, int_pin->configRegister, + pin_generate_config(PIN_PULL_UP_47K, PIN_MODE_IN, PIN_DRIVE_POWER_5, int_pin->configRegister)); GPIO_PinInit(int_pin->gpio, int_pin->pin, &gpio_config); #endif diff --git a/ports/mimxrt/machine_i2c.c b/ports/mimxrt/machine_i2c.c index 58dd824490..c64f46ff1b 100644 --- a/ports/mimxrt/machine_i2c.c +++ b/ports/mimxrt/machine_i2c.c @@ -72,15 +72,14 @@ static const iomux_table_t iomux_table[] = { IOMUX_TABLE_I2C }; bool lpi2c_set_iomux(int8_t hw_i2c, uint8_t drive) { int index = (hw_i2c - 1) * 2; + uint16_t pad_config = pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_OPEN_DRAIN, drive, SCL.configRegister); if (SCL.muxRegister != 0) { IOMUXC_SetPinMux(SCL.muxRegister, SCL.muxMode, SCL.inputRegister, SCL.inputDaisy, SCL.configRegister, 1U); - IOMUXC_SetPinConfig(SCL.muxRegister, SCL.muxMode, SCL.inputRegister, SCL.inputDaisy, SCL.configRegister, - 0xF880u | drive << IOMUXC_SW_PAD_CTL_PAD_DSE_SHIFT); + IOMUXC_SetPinConfig(SCL.muxRegister, SCL.muxMode, SCL.inputRegister, SCL.inputDaisy, SCL.configRegister, pad_config); IOMUXC_SetPinMux(SDA.muxRegister, SDA.muxMode, SDA.inputRegister, SDA.inputDaisy, SDA.configRegister, 1U); - IOMUXC_SetPinConfig(SDA.muxRegister, SDA.muxMode, SDA.inputRegister, SDA.inputDaisy, SDA.configRegister, - 0xF880u | drive << IOMUXC_SW_PAD_CTL_PAD_DSE_SHIFT); + IOMUXC_SetPinConfig(SDA.muxRegister, SDA.muxMode, SDA.inputRegister, SDA.inputDaisy, SDA.configRegister, pad_config); return true; } else { return false; diff --git a/ports/mimxrt/machine_pin.c b/ports/mimxrt/machine_pin.c index 12975806d6..1f4afab97f 100644 --- a/ports/mimxrt/machine_pin.c +++ b/ports/mimxrt/machine_pin.c @@ -213,6 +213,7 @@ STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_ const machine_pin_af_obj_t *af_obj; uint32_t pad_config = 0UL; uint8_t pull = PIN_PULL_DISABLED; + uint32_t drive = (uint32_t)args[PIN_INIT_ARG_DRIVE].u_int; // Generate pin configuration if ((args[PIN_INIT_ARG_VALUE].u_obj != MP_OBJ_NULL) && (mp_obj_is_true(args[PIN_INIT_ARG_VALUE].u_obj))) { @@ -233,38 +234,7 @@ STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_ pull = (uint8_t)mp_obj_get_int(args[PIN_INIT_ARG_PULL].u_obj); } - pad_config |= IOMUXC_SW_PAD_CTL_PAD_SRE(0U); // Slow Slew Rate - pad_config |= IOMUXC_SW_PAD_CTL_PAD_SPEED(0b01); // medium(100MHz) - - if (mode == PIN_MODE_OPEN_DRAIN) { - pad_config |= IOMUXC_SW_PAD_CTL_PAD_ODE(0b1); // Open Drain Enabled - } else { - pad_config |= IOMUXC_SW_PAD_CTL_PAD_ODE(0b0); // Open Drain Disabled - } - - if (pull == PIN_PULL_DISABLED) { - pad_config |= IOMUXC_SW_PAD_CTL_PAD_PKE(0); // Pull/Keeper Disabled - } else if (pull == PIN_PULL_HOLD) { - pad_config |= IOMUXC_SW_PAD_CTL_PAD_PKE(1) | // Pull/Keeper Enabled - IOMUXC_SW_PAD_CTL_PAD_PUE(0); // Keeper selected - } else { - pad_config |= IOMUXC_SW_PAD_CTL_PAD_PKE(1) | // Pull/Keeper Enabled - IOMUXC_SW_PAD_CTL_PAD_PUE(1) | // Pull selected - IOMUXC_SW_PAD_CTL_PAD_PUS(pull); - } - - if (mode == PIN_MODE_IN) { - pad_config |= IOMUXC_SW_PAD_CTL_PAD_DSE(0b000) | // output driver disabled - IOMUXC_SW_PAD_CTL_PAD_HYS(1U); // Hysteresis enabled - } else { - uint drive = args[PIN_INIT_ARG_DRIVE].u_int; - if (!IS_GPIO_DRIVE(drive)) { - mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("invalid drive strength: %d"), drive); - } - - pad_config |= IOMUXC_SW_PAD_CTL_PAD_DSE(drive) | - IOMUXC_SW_PAD_CTL_PAD_HYS(0U); // Hysteresis disabled - } + pad_config = pin_generate_config(pull, mode, drive, self->configRegister); // Configure PAD as GPIO IOMUXC_SetPinMux(self->muxRegister, af_obj->af_mode, 0, 0, self->configRegister, 1U); // Software Input On Field: Input Path is determined by functionality diff --git a/ports/mimxrt/machine_pwm.c b/ports/mimxrt/machine_pwm.c index a13af0d80f..c21c7eb94b 100644 --- a/ports/mimxrt/machine_pwm.c +++ b/ports/mimxrt/machine_pwm.c @@ -518,7 +518,7 @@ STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args IOMUXC_SetPinMux(pin1->muxRegister, af_obj1->af_mode, af_obj1->input_register, af_obj1->input_daisy, pin1->configRegister, 0U); IOMUXC_SetPinConfig(pin1->muxRegister, af_obj1->af_mode, af_obj1->input_register, af_obj1->input_daisy, - pin1->configRegister, 0x10B0U); + pin1->configRegister, pin_generate_config(PIN_PULL_DISABLED, PIN_MODE_OUT, PIN_DRIVE_POWER_5, pin1->configRegister)); // Settings for the second pin, if given. if (pin2 != NULL && pin2 != pin1) { @@ -529,7 +529,7 @@ STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args IOMUXC_SetPinMux(pin2->muxRegister, af_obj2->af_mode, af_obj2->input_register, af_obj2->input_daisy, pin2->configRegister, 0U); IOMUXC_SetPinConfig(pin2->muxRegister, af_obj2->af_mode, af_obj2->input_register, af_obj2->input_daisy, - pin2->configRegister, 0x10B0U); + pin2->configRegister, pin_generate_config(PIN_PULL_DISABLED, PIN_MODE_OUT, PIN_DRIVE_POWER_5, pin2->configRegister)); } else { self->complementary = 0; } diff --git a/ports/mimxrt/machine_spi.c b/ports/mimxrt/machine_spi.c index db2fab4ee6..06c0278fb3 100644 --- a/ports/mimxrt/machine_spi.c +++ b/ports/mimxrt/machine_spi.c @@ -87,19 +87,19 @@ bool lpspi_set_iomux(int8_t spi, uint8_t drive) { if (SCK.muxRegister != 0) { IOMUXC_SetPinMux(SCK.muxRegister, SCK.muxMode, SCK.inputRegister, SCK.inputDaisy, SCK.configRegister, 0U); IOMUXC_SetPinConfig(SCK.muxRegister, SCK.muxMode, SCK.inputRegister, SCK.inputDaisy, SCK.configRegister, - 0x1080u | drive << IOMUXC_SW_PAD_CTL_PAD_DSE_SHIFT); + pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_OUT, drive, SCK.configRegister)); IOMUXC_SetPinMux(CS0.muxRegister, CS0.muxMode, CS0.inputRegister, CS0.inputDaisy, CS0.configRegister, 0U); IOMUXC_SetPinConfig(CS0.muxRegister, CS0.muxMode, CS0.inputRegister, CS0.inputDaisy, CS0.configRegister, - 0x1080u | drive << IOMUXC_SW_PAD_CTL_PAD_DSE_SHIFT); + pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_OUT, drive, CS0.configRegister)); IOMUXC_SetPinMux(SDO.muxRegister, SDO.muxMode, SDO.inputRegister, SDO.inputDaisy, SDO.configRegister, 0U); IOMUXC_SetPinConfig(SDO.muxRegister, SDO.muxMode, SDO.inputRegister, SDO.inputDaisy, SDO.configRegister, - 0x1080u | drive << IOMUXC_SW_PAD_CTL_PAD_DSE_SHIFT); + pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_OUT, drive, SDO.configRegister)); IOMUXC_SetPinMux(SDI.muxRegister, SDI.muxMode, SDI.inputRegister, SDI.inputDaisy, SDI.configRegister, 0U); IOMUXC_SetPinConfig(SDI.muxRegister, SDI.muxMode, SDI.inputRegister, SDI.inputDaisy, SDI.configRegister, - 0x1080u | drive << IOMUXC_SW_PAD_CTL_PAD_DSE_SHIFT); + pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_IN, drive, SDI.configRegister)); return true; } else { diff --git a/ports/mimxrt/machine_uart.c b/ports/mimxrt/machine_uart.c index 9aa8a0c742..6807a994e1 100644 --- a/ports/mimxrt/machine_uart.c +++ b/ports/mimxrt/machine_uart.c @@ -84,10 +84,12 @@ bool lpuart_set_iomux(int8_t uart) { if (TX.muxRegister != 0) { IOMUXC_SetPinMux(TX.muxRegister, TX.muxMode, TX.inputRegister, TX.inputDaisy, TX.configRegister, 0U); - IOMUXC_SetPinConfig(TX.muxRegister, TX.muxMode, TX.inputRegister, TX.inputDaisy, TX.configRegister, 0x10B0u); + IOMUXC_SetPinConfig(TX.muxRegister, TX.muxMode, TX.inputRegister, TX.inputDaisy, TX.configRegister, + pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_OUT, PIN_DRIVE_POWER_6, TX.configRegister)); IOMUXC_SetPinMux(RX.muxRegister, RX.muxMode, RX.inputRegister, RX.inputDaisy, RX.configRegister, 0U); - IOMUXC_SetPinConfig(RX.muxRegister, RX.muxMode, RX.inputRegister, RX.inputDaisy, RX.configRegister, 0x10B0u); + IOMUXC_SetPinConfig(RX.muxRegister, RX.muxMode, RX.inputRegister, RX.inputDaisy, RX.configRegister, + pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_IN, PIN_DRIVE_POWER_6, RX.configRegister)); return true; } else { return false; diff --git a/ports/mimxrt/pin.c b/ports/mimxrt/pin.c index 964fb537b8..e4136bd1c3 100644 --- a/ports/mimxrt/pin.c +++ b/ports/mimxrt/pin.c @@ -62,6 +62,86 @@ uint32_t pin_get_af(const machine_pin_obj_t *pin) { return (uint32_t)(mux_register & IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_MASK) >> IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_SHIFT; } +uint32_t pin_generate_config(const uint32_t pull, const uint32_t mode, const uint32_t drive, uint32_t config_register) { + uint32_t pad_config = 0x0UL; + + #if defined MIMXRT117x_SERIES + + // Set Pull-up + if ((config_register >= 0x400E8350 && config_register <= 0x400E83dc) || // GPIO_AD_xx + (config_register >= 0x40C08040 && config_register <= 0x40C0807C)) { // GPIO_LPSR_xx + pad_config |= IOMUXC_SW_PAD_CTL_PAD_SRE(0U); // Set slew rate; there is a discrepancy between doc and header file + if (pull != PIN_PULL_DISABLED) { + pad_config |= IOMUXC_SW_PAD_CTL_PAD_PUE(1) | // Pull Enabled + IOMUXC_SW_PAD_CTL_PAD_PUS(pull != PIN_PULL_DOWN_100K); // Up or DOWn + } + } else { // GPIO_SD_Bx_xx + if (pull == PIN_PULL_DISABLED) { + pad_config |= IOMUXC_SW_PAD_CTL_PAD_PULL(0b11); + } else if (pull == PIN_PULL_DOWN_100K) { + pad_config |= IOMUXC_SW_PAD_CTL_PAD_PULL(0b10); + } else { + pad_config |= IOMUXC_SW_PAD_CTL_PAD_PULL(0b01); + } + } + // Set open Drain; different for LPSR GPIO! + if (config_register >= 0x40C08040 && config_register <= 0x40C0807C) { // GPIO_LPSR_xx + if (mode == PIN_MODE_OPEN_DRAIN) { + pad_config |= 1 << 5; // Open Drain Enabled, no Macro provided + } + } else { + if (mode == PIN_MODE_OPEN_DRAIN) { + pad_config |= IOMUXC_SW_PAD_CTL_PAD_ODE(0b1); // Open Drain Enabled + } + } + // Set drive strength + if (mode != PIN_MODE_IN) { + if (!IS_GPIO_DRIVE(drive)) { + mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("invalid drive strength: %d"), drive); + } + pad_config |= IOMUXC_SW_PAD_CTL_PAD_DSE(drive >= PIN_DRIVE_POWER_4); + } + + #else + + pad_config |= IOMUXC_SW_PAD_CTL_PAD_SRE(0U); // Slow Slew Rate + pad_config |= IOMUXC_SW_PAD_CTL_PAD_SPEED(0b01); // medium(100MHz) + + if (mode == PIN_MODE_OPEN_DRAIN) { + pad_config |= IOMUXC_SW_PAD_CTL_PAD_ODE(0b1); // Open Drain Enabled + } else { + pad_config |= IOMUXC_SW_PAD_CTL_PAD_ODE(0b0); // Open Drain Disabled + } + + if (pull == PIN_PULL_DISABLED) { + pad_config |= IOMUXC_SW_PAD_CTL_PAD_PKE(0); // Pull/Keeper Disabled + } else if (pull == PIN_PULL_HOLD) { + pad_config |= IOMUXC_SW_PAD_CTL_PAD_PKE(1) | // Pull/Keeper Enabled + IOMUXC_SW_PAD_CTL_PAD_PUE(0); // Keeper selected + } else { + pad_config |= IOMUXC_SW_PAD_CTL_PAD_PKE(1) | // Pull/Keeper Enabled + IOMUXC_SW_PAD_CTL_PAD_PUE(1) | // Pull selected + IOMUXC_SW_PAD_CTL_PAD_PUS(pull); + } + + if (mode == PIN_MODE_IN) { + pad_config |= IOMUXC_SW_PAD_CTL_PAD_DSE(0b000) | // output driver disabled + IOMUXC_SW_PAD_CTL_PAD_HYS(1U); // Hysteresis enabled + } else { + + if (!IS_GPIO_DRIVE(drive)) { + mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("invalid drive strength: %d"), drive); + } + + pad_config |= IOMUXC_SW_PAD_CTL_PAD_DSE(drive) | + IOMUXC_SW_PAD_CTL_PAD_HYS(0U); // Hysteresis disabled + } + + #endif + + return pad_config; +} + const machine_pin_obj_t *pin_find(mp_obj_t user_obj) { const machine_pin_obj_t *pin_obj; diff --git a/ports/mimxrt/pin.h b/ports/mimxrt/pin.h index 22e7a7e0f5..d1597fab9b 100644 --- a/ports/mimxrt/pin.h +++ b/ports/mimxrt/pin.h @@ -55,6 +55,7 @@ enum { PIN_MODE_OUT, PIN_MODE_OPEN_DRAIN, PIN_MODE_ALT, + PIN_MODE_SKIP, }; enum { @@ -159,5 +160,6 @@ const machine_pin_af_obj_t *pin_find_af(const machine_pin_obj_t *pin, uint8_t fn const machine_pin_af_obj_t *pin_find_af_by_index(const machine_pin_obj_t *pin, mp_uint_t af_idx); const machine_pin_af_obj_t *pin_find_af_by_name(const machine_pin_obj_t *pin, const char *name); void machine_pin_set_mode(const machine_pin_obj_t *pin, uint8_t mode); +uint32_t pin_generate_config(const uint32_t pull, const uint32_t mode, const uint32_t drive, uint32_t config_register); #endif // MICROPY_INCLUDED_MIMXRT_PIN_H diff --git a/ports/mimxrt/sdcard.c b/ports/mimxrt/sdcard.c index fd3c910835..5c523068ad 100644 --- a/ports/mimxrt/sdcard.c +++ b/ports/mimxrt/sdcard.c @@ -725,24 +725,18 @@ static inline void sdcard_init_pin(const machine_pin_obj_t *pin, uint8_t af_idx, void sdcard_init_pins(mimxrt_sdcard_obj_t *card) { // speed and strength optimized for clock frequency < 100MHz - uint32_t speed = 1U; - uint32_t strength = 7U; const mimxrt_sdcard_obj_pins_t *pins = card->pins; - uint32_t default_config = IOMUXC_SW_PAD_CTL_PAD_SPEED(speed) | - IOMUXC_SW_PAD_CTL_PAD_SRE_MASK | - IOMUXC_SW_PAD_CTL_PAD_PKE_MASK | - IOMUXC_SW_PAD_CTL_PAD_PUE_MASK | - IOMUXC_SW_PAD_CTL_PAD_HYS_MASK | - IOMUXC_SW_PAD_CTL_PAD_PUS(1) | - IOMUXC_SW_PAD_CTL_PAD_DSE(strength); - uint32_t no_cd_config = IOMUXC_SW_PAD_CTL_PAD_SPEED(speed) | - IOMUXC_SW_PAD_CTL_PAD_SRE_MASK | - IOMUXC_SW_PAD_CTL_PAD_PKE_MASK | - IOMUXC_SW_PAD_CTL_PAD_PUE_MASK | - IOMUXC_SW_PAD_CTL_PAD_HYS_MASK | - IOMUXC_SW_PAD_CTL_PAD_PUS(0) | - IOMUXC_SW_PAD_CTL_PAD_DSE(strength); + uint32_t default_config = pin_generate_config( + PIN_PULL_UP_47K, PIN_MODE_SKIP, PIN_DRIVE_POWER_6, card->pins->clk.pin->configRegister); + #if USDHC_DATA3_PULL_DOWN_ON_BOARD + // Pull down on the board -> must not enable internal PD. + uint32_t no_cd_config = pin_generate_config( + PIN_PULL_DISABLED, PIN_MODE_SKIP, PIN_DRIVE_POWER_6, card->pins->data3.pin->configRegister); + #else + uint32_t no_cd_config = pin_generate_config( + PIN_PULL_DOWN_100K, PIN_MODE_SKIP, PIN_DRIVE_POWER_6, card->pins->data3.pin->configRegister); + #endif // USDHC_DATA3_PULL_DOWN_ON_BOARD sdcard_init_pin(card->pins->clk.pin, card->pins->clk.af_idx, default_config); // USDHC1_CLK sdcard_init_pin(card->pins->cmd.pin, card->pins->cmd.af_idx, default_config); // USDHC1_CMD From 30380962cff1a42dabbbdf172b951f21b5bffe14 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Mon, 10 Jan 2022 18:14:40 +0100 Subject: [PATCH 0050/1712] mimxrt: Allow to select cs0 or cs1 for SPI. Using the keyword argument cs=nnn in the constructor. The cs1 pin has to be defined in mpconfigboard.h. Note: Only a few boards have the CS1 pin exposed to the connectors. --- .../boards/MIMXRT1010_EVK/mpconfigboard.h | 3 +- .../boards/MIMXRT1020_EVK/mpconfigboard.h | 5 ++- .../boards/MIMXRT1050_EVK/mpconfigboard.h | 3 +- .../boards/MIMXRT1060_EVK/mpconfigboard.h | 3 +- .../boards/MIMXRT1064_EVK/mpconfigboard.h | 3 +- .../boards/SEEED_ARCH_MIX/mpconfigboard.h | 6 +++- ports/mimxrt/boards/TEENSY40/mpconfigboard.h | 6 +++- ports/mimxrt/boards/TEENSY41/mpconfigboard.h | 6 +++- ports/mimxrt/machine_spi.c | 32 +++++++++++++------ 9 files changed, 50 insertions(+), 17 deletions(-) diff --git a/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.h b/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.h index 9a74a1c9c8..726a63904d 100644 --- a/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.h +++ b/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.h @@ -27,7 +27,8 @@ #define IOMUX_TABLE_SPI \ { IOMUXC_GPIO_AD_06_LPSPI1_SCK }, { IOMUXC_GPIO_AD_05_LPSPI1_PCS0 }, \ - { IOMUXC_GPIO_AD_04_LPSPI1_SDO }, { IOMUXC_GPIO_AD_03_LPSPI1_SDI }, + { IOMUXC_GPIO_AD_04_LPSPI1_SDO }, { IOMUXC_GPIO_AD_03_LPSPI1_SDI }, \ + { IOMUXC_GPIO_AD_02_LPSPI1_PCS1 } #define DMA_REQ_SRC_RX { 0, kDmaRequestMuxLPSPI1Rx, kDmaRequestMuxLPSPI2Rx } #define DMA_REQ_SRC_TX { 0, kDmaRequestMuxLPSPI1Tx, kDmaRequestMuxLPSPI2Tx } diff --git a/ports/mimxrt/boards/MIMXRT1020_EVK/mpconfigboard.h b/ports/mimxrt/boards/MIMXRT1020_EVK/mpconfigboard.h index 5f5de5a3ed..2e7ee34e8d 100644 --- a/ports/mimxrt/boards/MIMXRT1020_EVK/mpconfigboard.h +++ b/ports/mimxrt/boards/MIMXRT1020_EVK/mpconfigboard.h @@ -37,10 +37,13 @@ #define IOMUX_TABLE_SPI \ { IOMUXC_GPIO_AD_B0_10_LPSPI1_SCK }, { IOMUXC_GPIO_AD_B0_11_LPSPI1_PCS0 }, \ { IOMUXC_GPIO_AD_B0_12_LPSPI1_SDO }, { IOMUXC_GPIO_AD_B0_13_LPSPI1_SDI }, \ + { 0 }, \ { 0 }, { 0 }, \ { 0 }, { 0 }, \ + { 0 }, \ { IOMUXC_GPIO_AD_B1_12_LPSPI3_SCK }, { IOMUXC_GPIO_AD_B1_13_LPSPI3_PCS0 }, \ - { IOMUXC_GPIO_AD_B1_14_LPSPI3_SDO }, { IOMUXC_GPIO_AD_B1_15_LPSPI3_SDI }, + { IOMUXC_GPIO_AD_B1_14_LPSPI3_SDO }, { IOMUXC_GPIO_AD_B1_15_LPSPI3_SDI }, \ + { IOMUXC_GPIO_AD_B1_09_LPSPI3_PCS1 } \ #define DMA_REQ_SRC_RX { 0, kDmaRequestMuxLPSPI1Rx, kDmaRequestMuxLPSPI2Rx, \ kDmaRequestMuxLPSPI3Rx, kDmaRequestMuxLPSPI4Rx } diff --git a/ports/mimxrt/boards/MIMXRT1050_EVK/mpconfigboard.h b/ports/mimxrt/boards/MIMXRT1050_EVK/mpconfigboard.h index aa9ab8d95c..c2783a3e59 100644 --- a/ports/mimxrt/boards/MIMXRT1050_EVK/mpconfigboard.h +++ b/ports/mimxrt/boards/MIMXRT1050_EVK/mpconfigboard.h @@ -32,7 +32,8 @@ #define IOMUX_TABLE_SPI \ { IOMUXC_GPIO_SD_B0_00_LPSPI1_SCK }, { IOMUXC_GPIO_SD_B0_01_LPSPI1_PCS0 }, \ - { IOMUXC_GPIO_SD_B0_02_LPSPI1_SDO }, { IOMUXC_GPIO_SD_B0_03_LPSPI1_SDI }, + { IOMUXC_GPIO_SD_B0_02_LPSPI1_SDO }, { IOMUXC_GPIO_SD_B0_03_LPSPI1_SDI }, \ + { 0 }, #define DMA_REQ_SRC_RX { 0, kDmaRequestMuxLPSPI1Rx, kDmaRequestMuxLPSPI2Rx, \ kDmaRequestMuxLPSPI3Rx, kDmaRequestMuxLPSPI4Rx } diff --git a/ports/mimxrt/boards/MIMXRT1060_EVK/mpconfigboard.h b/ports/mimxrt/boards/MIMXRT1060_EVK/mpconfigboard.h index b108122ffc..475d07ddb1 100644 --- a/ports/mimxrt/boards/MIMXRT1060_EVK/mpconfigboard.h +++ b/ports/mimxrt/boards/MIMXRT1060_EVK/mpconfigboard.h @@ -32,7 +32,8 @@ #define IOMUX_TABLE_SPI \ { IOMUXC_GPIO_SD_B0_00_LPSPI1_SCK }, { IOMUXC_GPIO_SD_B0_01_LPSPI1_PCS0 }, \ - { IOMUXC_GPIO_SD_B0_02_LPSPI1_SDO }, { IOMUXC_GPIO_SD_B0_03_LPSPI1_SDI }, + { IOMUXC_GPIO_SD_B0_02_LPSPI1_SDO }, { IOMUXC_GPIO_SD_B0_03_LPSPI1_SDI }, \ + { 0 }, #define DMA_REQ_SRC_RX { 0, kDmaRequestMuxLPSPI1Rx, kDmaRequestMuxLPSPI2Rx, \ kDmaRequestMuxLPSPI3Rx, kDmaRequestMuxLPSPI4Rx } diff --git a/ports/mimxrt/boards/MIMXRT1064_EVK/mpconfigboard.h b/ports/mimxrt/boards/MIMXRT1064_EVK/mpconfigboard.h index 3c724868f7..874991ac65 100644 --- a/ports/mimxrt/boards/MIMXRT1064_EVK/mpconfigboard.h +++ b/ports/mimxrt/boards/MIMXRT1064_EVK/mpconfigboard.h @@ -32,7 +32,8 @@ #define IOMUX_TABLE_SPI \ { IOMUXC_GPIO_SD_B0_00_LPSPI1_SCK }, { IOMUXC_GPIO_SD_B0_01_LPSPI1_PCS0 }, \ - { IOMUXC_GPIO_SD_B0_02_LPSPI1_SDO }, { IOMUXC_GPIO_SD_B0_03_LPSPI1_SDI }, + { IOMUXC_GPIO_SD_B0_02_LPSPI1_SDO }, { IOMUXC_GPIO_SD_B0_03_LPSPI1_SDI }, \ + { 0 }, #define DMA_REQ_SRC_RX { 0, kDmaRequestMuxLPSPI1Rx, kDmaRequestMuxLPSPI2Rx, \ kDmaRequestMuxLPSPI3Rx, kDmaRequestMuxLPSPI4Rx } diff --git a/ports/mimxrt/boards/SEEED_ARCH_MIX/mpconfigboard.h b/ports/mimxrt/boards/SEEED_ARCH_MIX/mpconfigboard.h index 7c79063eef..53a3d4ed78 100644 --- a/ports/mimxrt/boards/SEEED_ARCH_MIX/mpconfigboard.h +++ b/ports/mimxrt/boards/SEEED_ARCH_MIX/mpconfigboard.h @@ -35,12 +35,16 @@ #define IOMUX_TABLE_SPI \ { 0 }, { 0 }, \ { 0 }, { 0 }, \ + { 0 }, \ { 0 }, { 0 }, \ { 0 }, { 0 }, \ + { 0 }, \ { IOMUXC_GPIO_AD_B1_15_LPSPI3_SCK }, { IOMUXC_GPIO_AD_B1_12_LPSPI3_PCS0 }, \ { IOMUXC_GPIO_AD_B1_14_LPSPI3_SDO }, { IOMUXC_GPIO_AD_B1_13_LPSPI3_SDI }, \ + { 0 }, \ { IOMUXC_GPIO_B1_07_LPSPI4_SCK }, { IOMUXC_GPIO_B1_04_LPSPI4_PCS0 }, \ - { IOMUXC_GPIO_B1_06_LPSPI4_SDO }, { IOMUXC_GPIO_B1_05_LPSPI4_SDI }, + { IOMUXC_GPIO_B1_06_LPSPI4_SDO }, { IOMUXC_GPIO_B1_05_LPSPI4_SDI }, \ + { IOMUXC_GPIO_B1_03_LPSPI4_PCS1 } #define DMA_REQ_SRC_RX { 0, kDmaRequestMuxLPSPI1Rx, kDmaRequestMuxLPSPI2Rx, \ kDmaRequestMuxLPSPI3Rx, kDmaRequestMuxLPSPI4Rx } diff --git a/ports/mimxrt/boards/TEENSY40/mpconfigboard.h b/ports/mimxrt/boards/TEENSY40/mpconfigboard.h index ae0a234629..08a774d886 100644 --- a/ports/mimxrt/boards/TEENSY40/mpconfigboard.h +++ b/ports/mimxrt/boards/TEENSY40/mpconfigboard.h @@ -27,12 +27,16 @@ #define IOMUX_TABLE_SPI \ { 0 }, { 0 }, \ { 0 }, { 0 }, \ + { 0 }, \ { 0 }, { 0 }, \ { 0 }, { 0 }, \ + { 0 }, \ { IOMUXC_GPIO_AD_B1_15_LPSPI3_SCK }, { IOMUXC_GPIO_AD_B0_03_LPSPI3_PCS0 }, \ { IOMUXC_GPIO_AD_B1_14_LPSPI3_SDO }, { IOMUXC_GPIO_AD_B0_02_LPSPI3_SDI }, \ + { 0 }, \ { IOMUXC_GPIO_B0_03_LPSPI4_SCK }, { IOMUXC_GPIO_B0_00_LPSPI4_PCS0 }, \ - { IOMUXC_GPIO_B0_02_LPSPI4_SDO }, { IOMUXC_GPIO_B0_01_LPSPI4_SDI }, + { IOMUXC_GPIO_B0_02_LPSPI4_SDO }, { IOMUXC_GPIO_B0_01_LPSPI4_SDI }, \ + { 0 }, #define DMA_REQ_SRC_RX { 0, kDmaRequestMuxLPSPI1Rx, kDmaRequestMuxLPSPI2Rx, \ kDmaRequestMuxLPSPI3Rx, kDmaRequestMuxLPSPI4Rx } diff --git a/ports/mimxrt/boards/TEENSY41/mpconfigboard.h b/ports/mimxrt/boards/TEENSY41/mpconfigboard.h index 4ca82d4b65..449f10babb 100644 --- a/ports/mimxrt/boards/TEENSY41/mpconfigboard.h +++ b/ports/mimxrt/boards/TEENSY41/mpconfigboard.h @@ -27,12 +27,16 @@ #define IOMUX_TABLE_SPI \ { IOMUXC_GPIO_SD_B0_00_LPSPI1_SCK }, { IOMUXC_GPIO_SD_B0_01_LPSPI1_PCS0 }, \ { IOMUXC_GPIO_SD_B0_02_LPSPI1_SDO }, { IOMUXC_GPIO_SD_B0_03_LPSPI1_SDI }, \ + { IOMUXC_GPIO_EMC_31_LPSPI1_PCS1 }, \ { 0 }, { 0 }, \ { 0 }, { 0 }, \ + { 0 }, \ { IOMUXC_GPIO_AD_B1_15_LPSPI3_SCK }, { IOMUXC_GPIO_AD_B1_12_LPSPI3_PCS0 }, \ { IOMUXC_GPIO_AD_B1_14_LPSPI3_SDO }, { IOMUXC_GPIO_AD_B1_13_LPSPI3_SDI }, \ + { 0 }, \ { IOMUXC_GPIO_B0_03_LPSPI4_SCK }, { IOMUXC_GPIO_B0_00_LPSPI4_PCS0 }, \ - { IOMUXC_GPIO_B0_02_LPSPI4_SDO }, { IOMUXC_GPIO_B0_01_LPSPI4_SDI }, + { IOMUXC_GPIO_B0_02_LPSPI4_SDO }, { IOMUXC_GPIO_B0_01_LPSPI4_SDI }, \ + { IOMUXC_GPIO_B1_03_LPSPI4_PCS1 } #define DMA_REQ_SRC_RX { 0, kDmaRequestMuxLPSPI1Rx, kDmaRequestMuxLPSPI2Rx, \ kDmaRequestMuxLPSPI3Rx, kDmaRequestMuxLPSPI4Rx } diff --git a/ports/mimxrt/machine_spi.c b/ports/mimxrt/machine_spi.c index 06c0278fb3..0332d9a9e8 100644 --- a/ports/mimxrt/machine_spi.c +++ b/ports/mimxrt/machine_spi.c @@ -53,6 +53,7 @@ #define CS0 (iomux_table[index + 1]) #define SDO (iomux_table[index + 2]) #define SDI (iomux_table[index + 3]) +#define CS1 (iomux_table[index + 4]) typedef struct _machine_spi_obj_t { mp_obj_base_t base; @@ -81,17 +82,25 @@ static const iomux_table_t iomux_table[] = { static uint16_t dma_req_src_rx[] = DMA_REQ_SRC_RX; static uint16_t dma_req_src_tx[] = DMA_REQ_SRC_TX; -bool lpspi_set_iomux(int8_t spi, uint8_t drive) { - int index = (spi - 1) * 4; +bool lpspi_set_iomux(int8_t spi, uint8_t drive, uint8_t cs) { + int index = (spi - 1) * 5; if (SCK.muxRegister != 0) { IOMUXC_SetPinMux(SCK.muxRegister, SCK.muxMode, SCK.inputRegister, SCK.inputDaisy, SCK.configRegister, 0U); IOMUXC_SetPinConfig(SCK.muxRegister, SCK.muxMode, SCK.inputRegister, SCK.inputDaisy, SCK.configRegister, pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_OUT, drive, SCK.configRegister)); - IOMUXC_SetPinMux(CS0.muxRegister, CS0.muxMode, CS0.inputRegister, CS0.inputDaisy, CS0.configRegister, 0U); - IOMUXC_SetPinConfig(CS0.muxRegister, CS0.muxMode, CS0.inputRegister, CS0.inputDaisy, CS0.configRegister, - pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_OUT, drive, CS0.configRegister)); + if (cs == 0 && CS0.muxRegister != 0) { + IOMUXC_SetPinMux(CS0.muxRegister, CS0.muxMode, CS0.inputRegister, CS0.inputDaisy, CS0.configRegister, 0U); + IOMUXC_SetPinConfig(CS0.muxRegister, CS0.muxMode, CS0.inputRegister, CS0.inputDaisy, CS0.configRegister, + 0x1080u | drive << IOMUXC_SW_PAD_CTL_PAD_DSE_SHIFT); + } else if (cs == 1 && CS1.muxRegister != 0) { + IOMUXC_SetPinMux(CS1.muxRegister, CS1.muxMode, CS1.inputRegister, CS1.inputDaisy, CS1.configRegister, 0U); + IOMUXC_SetPinConfig(CS1.muxRegister, CS1.muxMode, CS1.inputRegister, CS1.inputDaisy, CS1.configRegister, + 0x1080u | drive << IOMUXC_SW_PAD_CTL_PAD_DSE_SHIFT); + } else { + mp_raise_ValueError(MP_ERROR_TEXT("The chosen CS is not available")); + } IOMUXC_SetPinMux(SDO.muxRegister, SDO.muxMode, SDO.inputRegister, SDO.inputDaisy, SDO.configRegister, 0U); IOMUXC_SetPinConfig(SDO.muxRegister, SDO.muxMode, SDO.inputRegister, SDO.inputDaisy, SDO.configRegister, @@ -117,7 +126,7 @@ STATIC void machine_spi_print(const mp_print_t *print, mp_obj_t self_in, mp_prin } mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_id, ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits, ARG_firstbit, ARG_gap_ns, ARG_drive }; + enum { ARG_id, ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits, ARG_firstbit, ARG_gap_ns, ARG_drive, ARG_cs }; static const mp_arg_t allowed_args[] = { { MP_QSTR_id, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_baudrate, MP_ARG_INT, {.u_int = DEFAULT_SPI_BAUDRATE} }, @@ -127,6 +136,7 @@ mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n { MP_QSTR_firstbit, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = DEFAULT_SPI_FIRSTBIT} }, { MP_QSTR_gap_ns, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, { MP_QSTR_drive, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = DEFAULT_SPI_DRIVE} }, + { MP_QSTR_cs, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, }; static bool clk_init = true; @@ -160,7 +170,6 @@ mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n CLOCK_SetMux(kCLOCK_LpspiMux, 1); // Clock source is kCLOCK_Usb1PllPfd1Clk CLOCK_SetDiv(kCLOCK_LpspiDiv, CLOCK_DIVIDER); } - lpspi_set_iomux(spi_index_table[spi_id], drive); LPSPI_Reset(self->spi_inst); LPSPI_Enable(self->spi_inst, false); // Disable first before new settings are applies @@ -176,7 +185,12 @@ mp_obj_t machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n if (args[ARG_gap_ns].u_int != -1) { self->master_config->betweenTransferDelayInNanoSec = args[ARG_gap_ns].u_int; } + uint8_t cs = args[ARG_cs].u_int; + if (cs <= 1) { + self->master_config->whichPcs = cs; + } LPSPI_MasterInit(self->spi_inst, self->master_config, CLOCK_GetFreq(kCLOCK_Usb1PllPfd0Clk) / (CLOCK_DIVIDER + 1)); + lpspi_set_iomux(spi_index_table[spi_id], drive, cs); return MP_OBJ_FROM_PTR(self); } @@ -271,7 +285,7 @@ STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8 masterXfer.txData = (uint8_t *)src; masterXfer.rxData = (uint8_t *)dest; masterXfer.dataSize = len; - masterXfer.configFlags = kLPSPI_MasterPcs0 | kLPSPI_MasterPcsContinuous | kLPSPI_MasterByteSwap; + masterXfer.configFlags = (self->master_config->whichPcs << LPSPI_MASTER_PCS_SHIFT) | kLPSPI_MasterPcsContinuous | kLPSPI_MasterByteSwap; // Reconfigure the TCR, required after switch between DMA vs. non-DMA LPSPI_Enable(self->spi_inst, false); // Disable first before new settings are applied @@ -317,7 +331,7 @@ STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8 masterXfer.txData = (uint8_t *)src; masterXfer.rxData = (uint8_t *)dest; masterXfer.dataSize = len; - masterXfer.configFlags = kLPSPI_MasterPcs0 | kLPSPI_MasterPcsContinuous | kLPSPI_MasterByteSwap; + masterXfer.configFlags = (self->master_config->whichPcs << LPSPI_MASTER_PCS_SHIFT) | kLPSPI_MasterPcsContinuous | kLPSPI_MasterByteSwap; LPSPI_MasterTransferBlocking(self->spi_inst, &masterXfer); } From b73073d2460f14cbe7501e99b882520e0456ec94 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Wed, 12 Jan 2022 14:24:15 +0100 Subject: [PATCH 0051/1712] mimxrt: Add USB ID elements. - Manufacturer, set by MICROPY_HW_USB_STR_MANUF; default "MicroPython" - Board name, as set by MICROPY_HW_BOARD_NAME - Unique-ID, same as returned by machine.unique_id() - USB Vendor ID, as set by MICROPY_HW_USB_VID; default 0xf055 - USB Product ID, as set by MICROPY_HW_USB_PID; default 0x9802 --- ports/mimxrt/tusb_port.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/ports/mimxrt/tusb_port.c b/ports/mimxrt/tusb_port.c index 128861a49a..55855674c6 100644 --- a/ports/mimxrt/tusb_port.c +++ b/ports/mimxrt/tusb_port.c @@ -25,12 +25,20 @@ */ #include "tusb.h" +#include "mphalport.h" #ifndef MICROPY_HW_USB_VID #define MICROPY_HW_USB_VID (0xf055) +#endif + +#ifndef MICROPY_HW_USB_PID #define MICROPY_HW_USB_PID (0x9802) #endif +#ifndef MICROPY_HW_USB_STR_MANUF +#define MICROPY_HW_USB_STR_MANUF ("MicroPython") +#endif + #define USBD_DESC_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN) #define USBD_MAX_POWER_MA (250) @@ -77,9 +85,9 @@ static const uint8_t usbd_desc_cfg[USBD_DESC_LEN] = { }; static const char *const usbd_desc_str[] = { - [USBD_STR_MANUF] = "MicroPython", - [USBD_STR_PRODUCT] = "Board in FS mode", // Todo: fix string to indicate that product is running in High Speed mode - [USBD_STR_SERIAL] = "000000000000", // TODO + [USBD_STR_MANUF] = MICROPY_HW_USB_STR_MANUF, + [USBD_STR_PRODUCT] = MICROPY_HW_BOARD_NAME, + [USBD_STR_SERIAL] = "00000000000000000000", [USBD_STR_CDC] = "Board CDC", }; @@ -95,6 +103,9 @@ const uint8_t *tud_descriptor_configuration_cb(uint8_t index) { const uint16_t *tud_descriptor_string_cb(uint8_t index, uint16_t langid) { #define DESC_STR_MAX (20) static uint16_t desc_str[DESC_STR_MAX]; + static const char hexchr[16] = "0123456789ABCDEF"; + + memset(desc_str, 0, sizeof(desc_str)); uint8_t len; if (index == 0) { @@ -104,9 +115,19 @@ const uint16_t *tud_descriptor_string_cb(uint8_t index, uint16_t langid) { if (index >= sizeof(usbd_desc_str) / sizeof(usbd_desc_str[0])) { return NULL; } - const char *str = usbd_desc_str[index]; - for (len = 0; len < DESC_STR_MAX - 1 && str[len]; ++len) { - desc_str[1 + len] = str[len]; + if (index == USBD_STR_SERIAL) { + uint8_t uid[8]; + mp_hal_get_unique_id(uid); + // store it as a hex string + for (len = 0; len < 16; len += 2) { + desc_str[1 + len] = hexchr[uid[len / 2] >> 4]; + desc_str[1 + len + 1] = hexchr[uid[len / 2] & 0x0f]; + } + } else { + const char *str = usbd_desc_str[index]; + for (len = 0; len < DESC_STR_MAX - 1 && str[len]; ++len) { + desc_str[1 + len] = str[len]; + } } } From da9c3607a5803f207ac499049d43e42599d3dd80 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Fri, 14 Jan 2022 10:24:30 +0100 Subject: [PATCH 0052/1712] mimxrt: Add support for the Olimex RT1010 board. The board.json file is intentionally excluded, until the board will be sold. But including it into the mimxrt series make it easier to keep the build up-to-date. --- .../boards/OLIMEX_RT1010/clock_config.h | 104 ++++++++++++++++++ .../boards/OLIMEX_RT1010/mpconfigboard.h | 50 +++++++++ .../boards/OLIMEX_RT1010/mpconfigboard.mk | 13 +++ ports/mimxrt/boards/OLIMEX_RT1010/pins.csv | 36 ++++++ 4 files changed, 203 insertions(+) create mode 100644 ports/mimxrt/boards/OLIMEX_RT1010/clock_config.h create mode 100644 ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.h create mode 100644 ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.mk create mode 100644 ports/mimxrt/boards/OLIMEX_RT1010/pins.csv diff --git a/ports/mimxrt/boards/OLIMEX_RT1010/clock_config.h b/ports/mimxrt/boards/OLIMEX_RT1010/clock_config.h new file mode 100644 index 0000000000..76f3df422f --- /dev/null +++ b/ports/mimxrt/boards/OLIMEX_RT1010/clock_config.h @@ -0,0 +1,104 @@ +/* + * Copyright 2019 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _CLOCK_CONFIG_H_ +#define _CLOCK_CONFIG_H_ + +#include "fsl_common.h" + +/******************************************************************************* + * Definitions + ******************************************************************************/ +#define BOARD_XTAL0_CLK_HZ 24000000U /*!< Board xtal0 frequency in Hz */ + +#define BOARD_XTAL32K_CLK_HZ 32768U /*!< Board xtal32k frequency in Hz */ +/******************************************************************************* + ************************ BOARD_InitBootClocks function ************************ + ******************************************************************************/ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus*/ + +/*! + * @brief This function executes default configuration of clocks. + * + */ +void BOARD_InitBootClocks(void); + +#if defined(__cplusplus) +} +#endif /* __cplusplus*/ + +/******************************************************************************* + ********************** Configuration BOARD_BootClockRUN *********************** + ******************************************************************************/ +/******************************************************************************* + * Definitions for BOARD_BootClockRUN configuration + ******************************************************************************/ +#define BOARD_BOOTCLOCKRUN_CORE_CLOCK 500000000U /*!< Core clock frequency: 500000000Hz */ + +/* Clock outputs (values are in Hz): */ +#define BOARD_BOOTCLOCKRUN_ADC_ALT_CLK 40000000UL +#define BOARD_BOOTCLOCKRUN_CKIL_SYNC_CLK_ROOT 32768UL +#define BOARD_BOOTCLOCKRUN_CLKO1_CLK 0UL +#define BOARD_BOOTCLOCKRUN_CLKO2_CLK 0UL +#define BOARD_BOOTCLOCKRUN_CLK_1M 1000000UL +#define BOARD_BOOTCLOCKRUN_CLK_24M 24000000UL +#define BOARD_BOOTCLOCKRUN_CORE_CLK_ROOT 500000000UL +#define BOARD_BOOTCLOCKRUN_ENET_500M_REF_CLK 500000000UL +#define BOARD_BOOTCLOCKRUN_FLEXIO1_CLK_ROOT 30000000UL +#define BOARD_BOOTCLOCKRUN_FLEXSPI_CLK_ROOT 132000000UL +#define BOARD_BOOTCLOCKRUN_GPT1_IPG_CLK_HIGHFREQ 62500000UL +#define BOARD_BOOTCLOCKRUN_GPT2_IPG_CLK_HIGHFREQ 62500000UL +#define BOARD_BOOTCLOCKRUN_IPG_CLK_ROOT 125000000UL +#define BOARD_BOOTCLOCKRUN_LPI2C_CLK_ROOT 60000000UL +#define BOARD_BOOTCLOCKRUN_LPSPI_CLK_ROOT 105600000UL +#define BOARD_BOOTCLOCKRUN_MQS_MCLK 63529411UL +#define BOARD_BOOTCLOCKRUN_PERCLK_CLK_ROOT 62500000UL +#define BOARD_BOOTCLOCKRUN_SAI1_CLK_ROOT 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI1_MCLK1 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI1_MCLK2 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI1_MCLK3 30000000UL +#define BOARD_BOOTCLOCKRUN_SAI3_CLK_ROOT 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI3_MCLK1 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI3_MCLK2 0UL +#define BOARD_BOOTCLOCKRUN_SAI3_MCLK3 30000000UL +#define BOARD_BOOTCLOCKRUN_SPDIF0_CLK_ROOT 30000000UL +#define BOARD_BOOTCLOCKRUN_SPDIF0_EXTCLK_OUT 0UL +#define BOARD_BOOTCLOCKRUN_TRACE_CLK_ROOT 117333333UL +#define BOARD_BOOTCLOCKRUN_UART_CLK_ROOT 80000000UL +#define BOARD_BOOTCLOCKRUN_USBPHY_CLK 0UL + +/*! @brief Usb1 PLL set for BOARD_BootClockRUN configuration. + */ +extern const clock_usb_pll_config_t usb1PllConfig_BOARD_BootClockRUN; +/*! @brief Sys PLL for BOARD_BootClockRUN configuration. + */ +extern const clock_sys_pll_config_t sysPllConfig_BOARD_BootClockRUN; +/*! @brief Enet PLL set for BOARD_BootClockRUN configuration. + */ +extern const clock_enet_pll_config_t enetPllConfig_BOARD_BootClockRUN; + +/******************************************************************************* + * API for BOARD_BootClockRUN configuration + ******************************************************************************/ +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus*/ + +/*! + * @brief This function executes configuration of clocks. + * + */ +void BOARD_BootClockRUN(void); + +#if defined(__cplusplus) +} +#endif /* __cplusplus*/ + +#endif /* _CLOCK_CONFIG_H_ */ diff --git a/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.h b/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.h new file mode 100644 index 0000000000..e004050aee --- /dev/null +++ b/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.h @@ -0,0 +1,50 @@ +#define MICROPY_HW_BOARD_NAME "RT1010-Py-DevKIT" +#define MICROPY_HW_MCU_NAME "MIMXRT1011DAE5A" +#define MICROPY_HW_USB_STR_MANUF "Olimex Ltd." +#define MICROPY_HW_USB_VID 0x15ba +#define MICROPY_HW_USB_PID 0x0046 +#define MICROPY_PY_UOS_DUPTERM_BUILTIN_STREAM (0) + +// Olimex RT1010-Py has 1 board LED +#define MICROPY_HW_LED1_PIN (pin_GPIO_11) +#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin)) +#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin)) + +#define MICROPY_HW_NUM_PIN_IRQS (2 * 32) + +// Define mapping logical UART # to hardware UART # +// LPUART1 on RX/TX -> 1 +// LPUART4 on D5/D6 -> 2 + +#define MICROPY_HW_UART_NUM (sizeof(uart_index_table) / sizeof(uart_index_table)[0]) +#define MICROPY_HW_UART_INDEX { 0, 1, 4 } + +#define IOMUX_TABLE_UART \ + { IOMUXC_GPIO_10_LPUART1_TXD }, { IOMUXC_GPIO_09_LPUART1_RXD }, \ + { 0 }, { 0 }, \ + { 0 }, { 0 }, \ + { IOMUXC_GPIO_06_LPUART4_TXD }, { IOMUXC_GPIO_05_LPUART4_RXD }, + +#define MICROPY_HW_SPI_INDEX { 0, 1, 2 } + +#define IOMUX_TABLE_SPI \ + { IOMUXC_GPIO_AD_06_LPSPI1_SCK }, { IOMUXC_GPIO_AD_05_LPSPI1_PCS0 }, \ + { IOMUXC_GPIO_AD_04_LPSPI1_SDO }, { IOMUXC_GPIO_AD_03_LPSPI1_SDI }, \ + { IOMUXC_GPIO_AD_02_LPSPI1_PCS1 }, \ + { IOMUXC_GPIO_AD_12_LPSPI2_SCK }, { IOMUXC_GPIO_AD_11_LPSPI2_PCS0 }, \ + { IOMUXC_GPIO_AD_10_LPSPI2_SDO }, { IOMUXC_GPIO_AD_09_LPSPI2_SDI }, \ + { IOMUXC_GPIO_AD_01_LPSPI2_PCS1 } + +#define DMA_REQ_SRC_RX { 0, kDmaRequestMuxLPSPI1Rx, kDmaRequestMuxLPSPI2Rx } +#define DMA_REQ_SRC_TX { 0, kDmaRequestMuxLPSPI1Tx, kDmaRequestMuxLPSPI2Tx } + +// Define mapping hardware I2C # to logical I2C # +// SDA/SCL HW-I2C Logical I2C +// SDA1/SCL1 LPI2C1 -> 0 +// SDA2/SCL2 LPI2C2 -> 1 + +#define MICROPY_HW_I2C_INDEX { 0, 1, 2 } + +#define IOMUX_TABLE_I2C \ + { IOMUXC_GPIO_AD_14_LPI2C1_SCL }, { IOMUXC_GPIO_AD_13_LPI2C1_SDA }, \ + { IOMUXC_GPIO_AD_08_LPI2C2_SCL }, { IOMUXC_GPIO_AD_07_LPI2C2_SDA }, diff --git a/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.mk b/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.mk new file mode 100644 index 0000000000..e4f904903d --- /dev/null +++ b/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.mk @@ -0,0 +1,13 @@ +MCU_SERIES = MIMXRT1011 +MCU_VARIANT = MIMXRT1011DAE5A + +MICROPY_FLOAT_IMPL = single +MICROPY_PY_MACHINE_SDCARD ?= 0 +MICROPY_HW_FLASH_TYPE ?= qspi_nor +MICROPY_HW_FLASH_SIZE ?= 0x200000 # 2MB +MICROPY_HW_FLASH_RESERVED ?= 0x1000 # 4KB + +CFLAGS += -DMICROPY_HW_FLASH_DQS=kFlexSPIReadSampleClk_LoopbackInternally + +SRC_C += \ + hal/flexspi_nor_flash.c \ diff --git a/ports/mimxrt/boards/OLIMEX_RT1010/pins.csv b/ports/mimxrt/boards/OLIMEX_RT1010/pins.csv new file mode 100644 index 0000000000..d294f86b6d --- /dev/null +++ b/ports/mimxrt/boards/OLIMEX_RT1010/pins.csv @@ -0,0 +1,36 @@ +D0,GPIO_00 +D1,GPIO_01 +D2,GPIO_02 +D3,GPIO_03 +D4,GPIO_04 +D5,GPIO_05 +D6,GPIO_06 +D7,GPIO_07 +D8,GPIO_08 +D9,GPIO_SD_00 +D10,GPIO_SD_01 +D11,GPIO_SD_02 +D12,GPIO_SD_05 +D13,GPIO_SD_12 +D14,GPIO_SD_13 +A0,GPIO_AD_02 +A1,GPIO_AD_03 +A2,GPIO_AD_04 +A3,GPIO_AD_05 +A4,GPIO_AD_06 +LED,GPIO_11 +SDA1, GPIO_AD_13 +SCL1, GPIO_AD_14 +SDA2, GPIO_AD_07 +SCL2, GPIO_AD_08 +SDI, GPIO_AD_09 +SDO, GPIO_AD_10 +CS0, GPIO_AD_11 +SCK, GPIO_AD_12 +USB_OTG1_PWR, GPIO_AD_00 +BT0, GPIO_SD_04 +BT1, GPIO_SD_03 +RX, GPIO_09 +TX, GPIO_10 +RELAY1,GPIO_SD_12 +RELAY2,GPIO_SD_13 From c1841c2d455a99f4184487da658e88267785ebd5 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Tue, 25 Jan 2022 21:13:37 +0100 Subject: [PATCH 0053/1712] mimxrt: Simplify Makefile in selection of flash type. Simplify it a little bit by combining two sections regarding the flash type. Thanks to @alphaFred for suggesting it. --- ports/mimxrt/Makefile | 49 ++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/ports/mimxrt/Makefile b/ports/mimxrt/Makefile index 2881c7c767..5b835d25b7 100644 --- a/ports/mimxrt/Makefile +++ b/ports/mimxrt/Makefile @@ -91,14 +91,6 @@ CFLAGS += -DXIP_EXTERNAL_FLASH=1 \ -DBOARD_FLASH_SIZE=$(MICROPY_HW_FLASH_SIZE) \ -DMICROPY_HW_FLASH_SIZE=$(MICROPY_HW_FLASH_SIZE) \ -ifeq ($(MICROPY_HW_FLASH_TYPE), qspi_nor) -CFLAGS += -DBOARD_FLASH_OPS_HEADER_H=\"hal/flexspi_nor_flash.h\" -else ifeq ($(MICROPY_HW_FLASH_TYPE), hyperflash) -CFLAGS += -DBOARD_FLASH_OPS_HEADER_H=\"hal/flexspi_hyper_flash.h\" -else -$(error Error: Unknown board flash type $(MICROPY_HW_FLASH_TYPE)) -endif - ifeq ($(MICROPY_PY_MACHINE_SDCARD),1) CFLAGS += -DMICROPY_PY_MACHINE_SDCARD=1 endif @@ -274,33 +266,32 @@ SRC_C += \ $(SRC_HAL_IMX_C) \ $(SRC_ETH_C) \ +ifeq ($(MICROPY_HW_FLASH_TYPE), qspi_nor) +CFLAGS += -DBOARD_FLASH_OPS_HEADER_H=\"hal/flexspi_nor_flash.h\" +SRC_C += hal/flexspi_nor_flash.c + ifeq ($(MICROPY_HW_BOARD_FLASH_FILES), 1) CFLAGS += -DBOARD_FLASH_CONFIG_HEADER_H=\"$(BOARD)_flexspi_flash_config.h\" - -ifeq ($(MICROPY_HW_FLASH_TYPE), qspi_nor) -SRC_C += \ - hal/flexspi_nor_flash.c \ - $(BOARD_DIR)/qspi_nor_flash_config.c -else ifeq ($(MICROPY_HW_FLASH_TYPE), hyperflash) -SRC_C += \ - hal/flexspi_hyper_flash.c \ - $(BOARD_DIR)/qspi_hyper_flash_config.c -endif - +SRC_C += $(BOARD_DIR)/qspi_nor_flash_config.c else - CFLAGS += -DBOARD_FLASH_CONFIG_HEADER_H=\"hal/flexspi_flash_config.h\" - -ifeq ($(MICROPY_HW_FLASH_TYPE), qspi_nor) -SRC_C += \ - hal/flexspi_nor_flash.c \ - hal/qspi_nor_flash_config.c -else ifeq ($(MICROPY_HW_FLASH_TYPE), hyperflash) -SRC_C += \ - hal/flexspi_hyper_flash.c \ - hal/qspi_hyper_flash_config.c +SRC_C += hal/qspi_nor_flash_config.c endif +# +else ifeq ($(MICROPY_HW_FLASH_TYPE), hyperflash) +CFLAGS += -DBOARD_FLASH_OPS_HEADER_H=\"hal/flexspi_hyper_flash.h\" +SRC_C += hal/flexspi_hyper_flash.c +ifeq ($(MICROPY_HW_BOARD_FLASH_FILES), 1) +CFLAGS += -DBOARD_FLASH_CONFIG_HEADER_H=\"$(BOARD)_flexspi_flash_config.h\" +SRC_C += $(BOARD_DIR)/qspi_hyper_flash_config.c +else +CFLAGS += -DBOARD_FLASH_CONFIG_HEADER_H=\"hal/flexspi_flash_config.h\" +SRC_C += hal/qspi_hyper_flash_config.c +endif +# +else +$(error Error: Unknown board flash type $(MICROPY_HW_FLASH_TYPE)) endif ifeq ($(MICROPY_FLOAT_IMPL),double) From a00e1e57355f850bce928a770851bc0dc01484c2 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sun, 23 Jan 2022 03:33:43 +0200 Subject: [PATCH 0054/1712] stm32/dac: Deinit all DACs on soft reset. DAC timed functions continue to run after a soft reset cycle, using collected memory in the case of write_timed. --- ports/stm32/dac.c | 7 +++++++ ports/stm32/dac.h | 2 ++ ports/stm32/main.c | 3 +++ 3 files changed, 12 insertions(+) diff --git a/ports/stm32/dac.c b/ports/stm32/dac.c index fe3aecdde8..d51312aebc 100644 --- a/ports/stm32/dac.c +++ b/ports/stm32/dac.c @@ -131,6 +131,13 @@ STATIC void dac_deinit(uint32_t dac_channel) { #endif } +void dac_deinit_all(void) { + dac_deinit(DAC_CHANNEL_1); + #if !defined(STM32L452xx) + dac_deinit(DAC_CHANNEL_2); + #endif +} + STATIC void dac_config_channel(uint32_t dac_channel, uint32_t trig, uint32_t outbuf) { DAC->CR &= ~(DAC_CR_EN1 << dac_channel); uint32_t cr_off = DAC_CR_DMAEN1 | DAC_CR_MAMP1 | DAC_CR_WAVE1 | DAC_CR_TSEL1 | DAC_CR_TEN1; diff --git a/ports/stm32/dac.h b/ports/stm32/dac.h index fca36e019e..d5686725a4 100644 --- a/ports/stm32/dac.h +++ b/ports/stm32/dac.h @@ -28,4 +28,6 @@ extern const mp_obj_type_t pyb_dac_type; +void dac_deinit_all(void); + #endif // MICROPY_INCLUDED_STM32_DAC_H diff --git a/ports/stm32/main.c b/ports/stm32/main.c index 431fa20dee..3291a80184 100644 --- a/ports/stm32/main.c +++ b/ports/stm32/main.c @@ -654,6 +654,9 @@ soft_reset_exit: #if MICROPY_HW_ENABLE_CAN can_deinit_all(); #endif + #if MICROPY_HW_ENABLE_DAC + dac_deinit_all(); + #endif machine_deinit(); #if MICROPY_PY_THREAD From 160e4d9a6d491cf3af0843feba5f987b2dd83c60 Mon Sep 17 00:00:00 2001 From: Herwin Grobben Date: Wed, 1 Dec 2021 16:37:04 +0100 Subject: [PATCH 0055/1712] stm32/fdcan: Fix FIFO1 usage and handling of error interrupts. The original code used a independent state with regards to the interrupt. During heavy bus error conditions the internal state could become out-of-sync with the interrupts. Further explanation: during the development of an application using CAN communication, a interrupt-run-away was found in some situations. It was found that the error interrupt triggered (Warning, Passive or Bus-Off, all triggered it) the run-away. The only recovery was a reset. Two problems were found: - the error interrupt is enabled but not cleared in the interrupt routine; - an internal variable 'State' that was used to track the message received state (empty, new, full, overflow) that was not directly related to interrupt that indicated the state. In this commit these issues are fixed by adding more values for the interrupt reason (warning, passive, bus off) and clearing the error interrupts, and making the internal state directly dependent on the interrupt state for received messages. Furthermore, introducing the FIFO1 in the CAN receive stage, another issue existed. Even if the messages are received into the FIFO1 (by selecting message filtering for FIFO0 and FIFO1), the interrupt firing was indicating FIFO0 Rx. The configuration of the interrupts for this is now also fixed. The CAN peripheral has 2 interrupt lines going into the NVIC controller. The assignment of the interrupt reasons to these 2 interrupt lines was missing. Now the reception of FIFO1 messages triggers the second interrupt line. Other interrupts (Rx FIFO0 and bus error) are assigned to the first interrupt line. Tested on a Nucleo-G474, and also checked the HAL function to work with the H7 family. --- ports/stm32/fdcan.c | 151 +++++++++++++++++++++++++++++------ ports/stm32/make-stmconst.py | 3 +- ports/stm32/pyb_can.c | 41 +++++++--- 3 files changed, 159 insertions(+), 36 deletions(-) diff --git a/ports/stm32/fdcan.c b/ports/stm32/fdcan.c index 2892572f40..778902735e 100644 --- a/ports/stm32/fdcan.c +++ b/ports/stm32/fdcan.c @@ -44,6 +44,13 @@ #define FDCAN_ELEMENT_MASK_FIDX (0x7f000000) // Filter Index #define FDCAN_ELEMENT_MASK_ANMF (0x80000000) // Accepted Non-matching Frame +#define FDCAN_RX_FIFO0_MASK (FDCAN_FLAG_RX_FIFO0_MESSAGE_LOST | FDCAN_FLAG_RX_FIFO0_FULL | FDCAN_FLAG_RX_FIFO0_NEW_MESSAGE) +#define FDCAN_RX_FIFO1_MASK (FDCAN_FLAG_RX_FIFO1_MESSAGE_LOST | FDCAN_FLAG_RX_FIFO1_FULL | FDCAN_FLAG_RX_FIFO1_NEW_MESSAGE) +#define FDCAN_ERROR_STATUS_MASK (FDCAN_FLAG_ERROR_PASSIVE | FDCAN_FLAG_ERROR_WARNING | FDCAN_FLAG_BUS_OFF) + +// also defined in _hal_fdcan.c, but not able to declare extern and reach the variable +static const uint8_t DLCtoBytes[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 20, 24, 32, 48, 64}; + bool can_init(pyb_can_obj_t *can_obj, uint32_t mode, uint32_t prescaler, uint32_t sjw, uint32_t bs1, uint32_t bs2, bool auto_restart) { (void)auto_restart; @@ -60,6 +67,16 @@ bool can_init(pyb_can_obj_t *can_obj, uint32_t mode, uint32_t prescaler, uint32_ init->TransmitPause = DISABLE; init->ProtocolException = ENABLE; + #if defined(STM32G4) + init->ClockDivider = FDCAN_CLOCK_DIV1; + init->DataPrescaler = 1; + init->DataSyncJumpWidth = 1; + init->DataTimeSeg1 = 1; + init->DataTimeSeg2 = 1; + #endif + + #if defined(STM32H7) + // variable used to specify RAM address in HAL, only for H7, G4 uses defined offset address in HAL // The Message RAM is shared between CAN1 and CAN2. Setting the offset to half // the Message RAM for the second CAN and using half the resources for each CAN. if (can_obj->can_id == PYB_CAN_1) { @@ -67,6 +84,14 @@ bool can_init(pyb_can_obj_t *can_obj, uint32_t mode, uint32_t prescaler, uint32_ } else { init->MessageRAMOffset = 2560 / 2; } + #endif + + #if defined(STM32G4) + + init->StdFiltersNbr = 28; // /2 ? if FDCAN2 is used !!? + init->ExtFiltersNbr = 0; // Not used + + #elif defined(STM32H7) init->StdFiltersNbr = 64; // 128 / 2 init->ExtFiltersNbr = 0; // Not used @@ -83,6 +108,9 @@ bool can_init(pyb_can_obj_t *can_obj, uint32_t mode, uint32_t prescaler, uint32_ init->TxFifoQueueElmtsNbr = 16; // Tx fifo elements init->TxElmtSize = FDCAN_DATA_BYTES_8; + + #endif + init->TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION; FDCAN_GlobalTypeDef *CANx = NULL; @@ -148,21 +176,27 @@ bool can_init(pyb_can_obj_t *can_obj, uint32_t mode, uint32_t prescaler, uint32_ NVIC_SetPriority(FDCAN1_IT1_IRQn, IRQ_PRI_CAN); HAL_NVIC_EnableIRQ(FDCAN1_IT1_IRQn); break; + #if defined(MICROPY_HW_CAN2_TX) case PYB_CAN_2: NVIC_SetPriority(FDCAN2_IT0_IRQn, IRQ_PRI_CAN); HAL_NVIC_EnableIRQ(FDCAN2_IT0_IRQn); NVIC_SetPriority(FDCAN2_IT1_IRQn, IRQ_PRI_CAN); HAL_NVIC_EnableIRQ(FDCAN2_IT1_IRQn); break; + #endif default: return false; } + // FDCAN IT 0 + HAL_FDCAN_ConfigInterruptLines(&can_obj->can, FDCAN_IT_GROUP_RX_FIFO0 | FDCAN_IT_GROUP_BIT_LINE_ERROR | FDCAN_IT_GROUP_PROTOCOL_ERROR, FDCAN_INTERRUPT_LINE0); + // FDCAN IT 1 + HAL_FDCAN_ConfigInterruptLines(&can_obj->can, FDCAN_IT_GROUP_RX_FIFO1, FDCAN_INTERRUPT_LINE1); - __HAL_FDCAN_ENABLE_IT(&can_obj->can, FDCAN_IT_BUS_OFF | FDCAN_IT_ERROR_WARNING | FDCAN_IT_ERROR_PASSIVE); - __HAL_FDCAN_ENABLE_IT(&can_obj->can, FDCAN_IT_RX_FIFO0_NEW_MESSAGE | FDCAN_IT_RX_FIFO1_NEW_MESSAGE); - __HAL_FDCAN_ENABLE_IT(&can_obj->can, FDCAN_IT_RX_FIFO0_MESSAGE_LOST | FDCAN_IT_RX_FIFO1_MESSAGE_LOST); - __HAL_FDCAN_ENABLE_IT(&can_obj->can, FDCAN_IT_RX_FIFO0_FULL | FDCAN_IT_RX_FIFO1_FULL); - + uint32_t ActiveITs = FDCAN_IT_BUS_OFF | FDCAN_IT_ERROR_WARNING | FDCAN_IT_ERROR_PASSIVE; + ActiveITs |= FDCAN_IT_RX_FIFO0_NEW_MESSAGE | FDCAN_IT_RX_FIFO1_NEW_MESSAGE; + ActiveITs |= FDCAN_IT_RX_FIFO0_MESSAGE_LOST | FDCAN_IT_RX_FIFO1_MESSAGE_LOST; + ActiveITs |= FDCAN_IT_RX_FIFO0_FULL | FDCAN_IT_RX_FIFO1_FULL; + HAL_FDCAN_ActivateNotification(&can_obj->can, ActiveITs, 0); return true; } @@ -227,10 +261,19 @@ int can_receive(FDCAN_HandleTypeDef *can, int fifo, FDCAN_RxHeaderTypeDef *hdr, uint32_t index, *address; if (fifo == FDCAN_RX_FIFO0) { index = (*rxf & FDCAN_RXF0S_F0GI) >> FDCAN_RXF0S_F0GI_Pos; + #if defined(STM32G4) + address = (uint32_t *)(can->msgRam.RxFIFO0SA + (index * (18U * 4U))); // SRAMCAN_RF0_SIZE bytes, size not configurable + #else address = (uint32_t *)(can->msgRam.RxFIFO0SA + (index * can->Init.RxFifo0ElmtSize * 4)); + #endif } else { index = (*rxf & FDCAN_RXF1S_F1GI) >> FDCAN_RXF1S_F1GI_Pos; + #if defined(STM32G4) + // ToDo: test FIFO1, FIFO 0 is ok + address = (uint32_t *)(can->msgRam.RxFIFO1SA + (index * (18U * 4U))); // SRAMCAN_RF1_SIZE bytes, size not configurable + #else address = (uint32_t *)(can->msgRam.RxFIFO1SA + (index * can->Init.RxFifo1ElmtSize * 4)); + #endif } // Parse header of message @@ -251,7 +294,7 @@ int can_receive(FDCAN_HandleTypeDef *can, int fifo, FDCAN_RxHeaderTypeDef *hdr, // Copy data uint8_t *pdata = (uint8_t *)address; - for (uint32_t i = 0; i < 8; ++i) { // TODO use DLCtoBytes[hdr->DataLength] for length > 8 + for (uint32_t i = 0; i < DLCtoBytes[hdr->DataLength]; ++i) { *data++ = *pdata++; } @@ -269,41 +312,97 @@ STATIC void can_rx_irq_handler(uint can_id, uint fifo_id) { self = MP_STATE_PORT(pyb_can_obj_all)[can_id - 1]; + CAN_TypeDef *can = self->can.Instance; + + uint32_t RxFifo0ITs; + uint32_t RxFifo1ITs; + // uint32_t Errors; + uint32_t ErrorStatusITs; + uint32_t Psr; + + RxFifo0ITs = can->IR & FDCAN_RX_FIFO0_MASK; + RxFifo0ITs &= can->IE; + RxFifo1ITs = can->IR & FDCAN_RX_FIFO1_MASK; + RxFifo1ITs &= can->IE; + // Errors = (&self->can)->Instance->IR & FDCAN_ERROR_MASK; + // Errors &= (&self->can)->Instance->IE; + ErrorStatusITs = can->IR & FDCAN_ERROR_STATUS_MASK; + ErrorStatusITs &= can->IE; + Psr = can->PSR; + if (fifo_id == FDCAN_RX_FIFO0) { callback = self->rxcallback0; state = &self->rx_state0; + if (RxFifo0ITs & FDCAN_FLAG_RX_FIFO0_NEW_MESSAGE) { + __HAL_FDCAN_DISABLE_IT(&self->can, FDCAN_IT_RX_FIFO0_NEW_MESSAGE); + __HAL_FDCAN_CLEAR_FLAG(&self->can, FDCAN_FLAG_RX_FIFO0_NEW_MESSAGE); + irq_reason = MP_OBJ_NEW_SMALL_INT(0); + *state = RX_STATE_MESSAGE_PENDING; + + } + if (RxFifo0ITs & FDCAN_FLAG_RX_FIFO0_FULL) { + __HAL_FDCAN_DISABLE_IT(&self->can, FDCAN_IT_RX_FIFO0_FULL); + __HAL_FDCAN_CLEAR_FLAG(&self->can, FDCAN_FLAG_RX_FIFO0_FULL); + irq_reason = MP_OBJ_NEW_SMALL_INT(1); + *state = RX_STATE_FIFO_FULL; + + } + if (RxFifo0ITs & FDCAN_FLAG_RX_FIFO0_MESSAGE_LOST) { + __HAL_FDCAN_DISABLE_IT(&self->can, FDCAN_IT_RX_FIFO0_MESSAGE_LOST); + __HAL_FDCAN_CLEAR_FLAG(&self->can, FDCAN_FLAG_RX_FIFO0_MESSAGE_LOST); + irq_reason = MP_OBJ_NEW_SMALL_INT(2); + *state = RX_STATE_FIFO_OVERFLOW; + } + } else { callback = self->rxcallback1; state = &self->rx_state1; - } - - switch (*state) { - case RX_STATE_FIFO_EMPTY: - __HAL_FDCAN_DISABLE_IT(&self->can, (fifo_id == FDCAN_RX_FIFO0) ? - FDCAN_IT_RX_FIFO0_NEW_MESSAGE : FDCAN_IT_RX_FIFO1_NEW_MESSAGE); + if (RxFifo1ITs & FDCAN_FLAG_RX_FIFO1_NEW_MESSAGE) { + __HAL_FDCAN_DISABLE_IT(&self->can, FDCAN_IT_RX_FIFO1_NEW_MESSAGE); + __HAL_FDCAN_CLEAR_FLAG(&self->can, FDCAN_FLAG_RX_FIFO1_NEW_MESSAGE); irq_reason = MP_OBJ_NEW_SMALL_INT(0); *state = RX_STATE_MESSAGE_PENDING; - break; - case RX_STATE_MESSAGE_PENDING: - __HAL_FDCAN_DISABLE_IT(&self->can, (fifo_id == FDCAN_RX_FIFO0) ? FDCAN_IT_RX_FIFO0_FULL : FDCAN_IT_RX_FIFO1_FULL); - __HAL_FDCAN_CLEAR_FLAG(&self->can, (fifo_id == FDCAN_RX_FIFO0) ? FDCAN_FLAG_RX_FIFO0_FULL : FDCAN_FLAG_RX_FIFO1_FULL); + + } + if (RxFifo1ITs & FDCAN_FLAG_RX_FIFO1_FULL) { + __HAL_FDCAN_DISABLE_IT(&self->can, FDCAN_IT_RX_FIFO1_FULL); + __HAL_FDCAN_CLEAR_FLAG(&self->can, FDCAN_FLAG_RX_FIFO1_FULL); irq_reason = MP_OBJ_NEW_SMALL_INT(1); *state = RX_STATE_FIFO_FULL; - break; - case RX_STATE_FIFO_FULL: - __HAL_FDCAN_DISABLE_IT(&self->can, (fifo_id == FDCAN_RX_FIFO0) ? - FDCAN_IT_RX_FIFO0_MESSAGE_LOST : FDCAN_IT_RX_FIFO1_MESSAGE_LOST); - __HAL_FDCAN_CLEAR_FLAG(&self->can, (fifo_id == FDCAN_RX_FIFO0) ? - FDCAN_FLAG_RX_FIFO0_MESSAGE_LOST : FDCAN_FLAG_RX_FIFO1_MESSAGE_LOST); + + } + if (RxFifo1ITs & FDCAN_FLAG_RX_FIFO1_MESSAGE_LOST) { + __HAL_FDCAN_DISABLE_IT(&self->can, FDCAN_IT_RX_FIFO1_MESSAGE_LOST); + __HAL_FDCAN_CLEAR_FLAG(&self->can, FDCAN_FLAG_RX_FIFO1_MESSAGE_LOST); irq_reason = MP_OBJ_NEW_SMALL_INT(2); *state = RX_STATE_FIFO_OVERFLOW; - break; - case RX_STATE_FIFO_OVERFLOW: - // This should never happen - break; + } + } + + if (ErrorStatusITs & FDCAN_FLAG_ERROR_WARNING) { + __HAL_FDCAN_CLEAR_FLAG(&self->can, FDCAN_FLAG_ERROR_WARNING); + if (Psr & FDCAN_PSR_EW) { + irq_reason = MP_OBJ_NEW_SMALL_INT(3); + // mp_printf(MICROPY_ERROR_PRINTER, "clear warning %08x\n", (can->IR & FDCAN_ERROR_STATUS_MASK)); + } + } + if (ErrorStatusITs & FDCAN_FLAG_ERROR_PASSIVE) { + __HAL_FDCAN_CLEAR_FLAG(&self->can, FDCAN_FLAG_ERROR_PASSIVE); + if (Psr & FDCAN_PSR_EP) { + irq_reason = MP_OBJ_NEW_SMALL_INT(4); + // mp_printf(MICROPY_ERROR_PRINTER, "clear passive %08x\n", (can->IR & FDCAN_ERROR_STATUS_MASK)); + } + } + if (ErrorStatusITs & FDCAN_FLAG_BUS_OFF) { + __HAL_FDCAN_CLEAR_FLAG(&self->can, FDCAN_FLAG_BUS_OFF); + if (Psr & FDCAN_PSR_BO) { + irq_reason = MP_OBJ_NEW_SMALL_INT(5); + // mp_printf(MICROPY_ERROR_PRINTER, "bus off %08x\n", (can->IR & FDCAN_ERROR_STATUS_MASK)); + } } pyb_can_handle_callback(self, fifo_id, callback, irq_reason); + // mp_printf(MICROPY_ERROR_PRINTER, "Ints: %08x, %08x, %08x\n", RxFifo0ITs, RxFifo1ITs, ErrorStatusITs); } #if defined(MICROPY_HW_CAN1_TX) diff --git a/ports/stm32/make-stmconst.py b/ports/stm32/make-stmconst.py index 217a801a8f..554d662384 100644 --- a/ports/stm32/make-stmconst.py +++ b/ports/stm32/make-stmconst.py @@ -64,7 +64,7 @@ class Lexer: ( "#define typedef", re.compile( - r"#define +(?P[A-Z0-9_]+(ext)?) +\(\([A-Za-z0-9_]+_TypeDef \*\) (?P[A-Za-z0-9_]+)\)($| +/\*)" + r"#define +(?P[A-Z0-9_]+(ext)?) +\(\([A-Za-z0-9_]+_(Global)?TypeDef \*\) (?P[A-Za-z0-9_]+)\)($| +/\*)" ), ), ("typedef struct", re.compile(r"typedef struct$")), @@ -281,6 +281,7 @@ def main(): #'CAN_FIFOMailBox', #'CAN_FilterRegister', #'CAN', + "FDCAN", "CRC", "DAC", "DBGMCU", diff --git a/ports/stm32/pyb_can.c b/ports/stm32/pyb_can.c index 3e55069ab9..8007fd9e3c 100644 --- a/ports/stm32/pyb_can.c +++ b/ports/stm32/pyb_can.c @@ -47,8 +47,14 @@ #define CAN_FIFO1 FDCAN_RX_FIFO1 #define CAN_FILTER_FIFO0 (0) -// Default timings; 125Kbps assuming 48MHz clock +// Default timings; 125Kbps +#if defined(STM32G4) +// assuming 24MHz clock +#define CAN_DEFAULT_PRESCALER (16) +#else +// assuming 48MHz clock #define CAN_DEFAULT_PRESCALER (32) +#endif #define CAN_DEFAULT_SJW (1) #define CAN_DEFAULT_BS1 (8) #define CAN_DEFAULT_BS2 (3) @@ -60,8 +66,10 @@ #define CAN1_RX0_IRQn FDCAN1_IT0_IRQn #define CAN1_RX1_IRQn FDCAN1_IT1_IRQn +#if defined(CAN2) #define CAN2_RX0_IRQn FDCAN2_IT0_IRQn #define CAN2_RX1_IRQn FDCAN2_IT1_IRQn +#endif #define CAN_IT_FIFO0_FULL FDCAN_IT_RX_FIFO0_FULL #define CAN_IT_FIFO1_FULL FDCAN_IT_RX_FIFO1_FULL @@ -326,6 +334,9 @@ STATIC mp_obj_t pyb_can_restart(mp_obj_t self_in) { can->CCCR |= FDCAN_CCCR_INIT; while ((can->CCCR & FDCAN_CCCR_INIT) == 0) { } + can->CCCR |= FDCAN_CCCR_CCE; + while ((can->CCCR & FDCAN_CCCR_CCE) == 0) { + } can->CCCR &= ~FDCAN_CCCR_INIT; while ((can->CCCR & FDCAN_CCCR_INIT)) { } @@ -348,11 +359,12 @@ STATIC mp_obj_t pyb_can_state(mp_obj_t self_in) { if (self->is_enabled) { CAN_TypeDef *can = self->can.Instance; #if MICROPY_HW_ENABLE_FDCAN - if (can->PSR & FDCAN_PSR_BO) { + uint32_t psr = can->PSR; + if (psr & FDCAN_PSR_BO) { state = CAN_STATE_BUS_OFF; - } else if (can->PSR & FDCAN_PSR_EP) { + } else if (psr & FDCAN_PSR_EP) { state = CAN_STATE_ERROR_PASSIVE; - } else if (can->PSR & FDCAN_PSR_EW) { + } else if (psr & FDCAN_PSR_EW) { state = CAN_STATE_ERROR_WARNING; } else { state = CAN_STATE_ERROR_ACTIVE; @@ -375,10 +387,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_can_state_obj, pyb_can_state); // Get info about error states and TX/RX buffers STATIC mp_obj_t pyb_can_info(size_t n_args, const mp_obj_t *args) { - #if MICROPY_HW_ENABLE_FDCAN - // TODO implement for FDCAN - return mp_const_none; - #else pyb_can_obj_t *self = MP_OBJ_TO_PTR(args[0]); mp_obj_list_t *list; if (n_args == 1) { @@ -392,6 +400,20 @@ STATIC mp_obj_t pyb_can_info(size_t n_args, const mp_obj_t *args) { mp_raise_ValueError(NULL); } } + + #if MICROPY_HW_ENABLE_FDCAN + FDCAN_GlobalTypeDef *can = self->can.Instance; + uint32_t esr = can->ECR; + list->items[0] = MP_OBJ_NEW_SMALL_INT((esr & FDCAN_ECR_TEC_Msk) >> FDCAN_ECR_TEC_Pos); + list->items[1] = MP_OBJ_NEW_SMALL_INT((esr & FDCAN_ECR_REC_Msk) >> FDCAN_ECR_REC_Pos); + list->items[2] = MP_OBJ_NEW_SMALL_INT(self->num_error_warning); + list->items[3] = MP_OBJ_NEW_SMALL_INT(self->num_error_passive); + list->items[4] = MP_OBJ_NEW_SMALL_INT(self->num_bus_off); + uint32_t TXEFS = can->TXEFS; + list->items[5] = MP_OBJ_NEW_SMALL_INT(TXEFS & 0x7); + list->items[6] = MP_OBJ_NEW_SMALL_INT((can->RXF0S & FDCAN_RXF0S_F0FL_Msk) >> FDCAN_RXF0S_F0FL_Pos); + list->items[7] = MP_OBJ_NEW_SMALL_INT((can->RXF1S & FDCAN_RXF1S_F1FL_Msk) >> FDCAN_RXF1S_F1FL_Pos); + #else CAN_TypeDef *can = self->can.Instance; uint32_t esr = can->ESR; list->items[0] = MP_OBJ_NEW_SMALL_INT(esr >> CAN_ESR_TEC_Pos & 0xff); @@ -403,8 +425,9 @@ STATIC mp_obj_t pyb_can_info(size_t n_args, const mp_obj_t *args) { list->items[5] = MP_OBJ_NEW_SMALL_INT(n_tx_pending); list->items[6] = MP_OBJ_NEW_SMALL_INT(can->RF0R >> CAN_RF0R_FMP0_Pos & 3); list->items[7] = MP_OBJ_NEW_SMALL_INT(can->RF1R >> CAN_RF1R_FMP1_Pos & 3); - return MP_OBJ_FROM_PTR(list); #endif + + return MP_OBJ_FROM_PTR(list); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_can_info_obj, 1, 2, pyb_can_info); From 517e82eb6b7d93134637b5658132479f4fc260e3 Mon Sep 17 00:00:00 2001 From: Herwin Grobben Date: Wed, 1 Dec 2021 17:10:22 +0100 Subject: [PATCH 0056/1712] stm32/fdcan: Fix naming with regards to G4 series. --- ports/stm32/fdcan.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ports/stm32/fdcan.c b/ports/stm32/fdcan.c index 778902735e..8465b806ae 100644 --- a/ports/stm32/fdcan.c +++ b/ports/stm32/fdcan.c @@ -48,6 +48,14 @@ #define FDCAN_RX_FIFO1_MASK (FDCAN_FLAG_RX_FIFO1_MESSAGE_LOST | FDCAN_FLAG_RX_FIFO1_FULL | FDCAN_FLAG_RX_FIFO1_NEW_MESSAGE) #define FDCAN_ERROR_STATUS_MASK (FDCAN_FLAG_ERROR_PASSIVE | FDCAN_FLAG_ERROR_WARNING | FDCAN_FLAG_BUS_OFF) +#if defined(STM32H7) +// adaptations for H7 to G4 naming convention in HAL +#define FDCAN_IT_GROUP_RX_FIFO0 (FDCAN_ILS_RF0NL | FDCAN_ILS_RF0FL | FDCAN_ILS_RF0LL) +#define FDCAN_IT_GROUP_BIT_LINE_ERROR (FDCAN_ILS_EPE | FDCAN_ILS_ELOE) +#define FDCAN_IT_GROUP_PROTOCOL_ERROR (FDCAN_ILS_ARAE | FDCAN_ILS_PEDE | FDCAN_ILS_PEAE | FDCAN_ILS_WDIE | FDCAN_ILS_BOE | FDCAN_ILS_EWE) +#define FDCAN_IT_GROUP_RX_FIFO1 (FDCAN_ILS_RF1NL | FDCAN_ILS_RF1FL | FDCAN_ILS_RF1LL) +#endif + // also defined in _hal_fdcan.c, but not able to declare extern and reach the variable static const uint8_t DLCtoBytes[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 20, 24, 32, 48, 64}; From 14becd80c9587e7afed56aebab4bf347971ff6e4 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 31 Jan 2022 16:38:32 +1100 Subject: [PATCH 0057/1712] stm32/usbd_conf: Set lpm_enable and battery_charging_enable on all MCUs. Signed-off-by: Damien George --- ports/stm32/usbd_conf.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ports/stm32/usbd_conf.c b/ports/stm32/usbd_conf.c index 50e10ba178..1fb2777831 100644 --- a/ports/stm32/usbd_conf.c +++ b/ports/stm32/usbd_conf.c @@ -391,10 +391,8 @@ USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev, int high_speed, const pcd_fs_handle.Init.phy_itface = PCD_PHY_EMBEDDED; pcd_fs_handle.Init.Sof_enable = 0; pcd_fs_handle.Init.speed = PCD_SPEED_FULL; - #if defined(STM32L4) pcd_fs_handle.Init.lpm_enable = DISABLE; pcd_fs_handle.Init.battery_charging_enable = DISABLE; - #endif #if MICROPY_HW_USB_IS_MULTI_OTG pcd_fs_handle.Init.use_dedicated_ep1 = 0; pcd_fs_handle.Init.dma_enable = 0; From 4a4f269a1ae0e23c0d9815c7f8b1b7ff6ba22cc1 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 31 Jan 2022 16:39:26 +1100 Subject: [PATCH 0058/1712] stm32/powerctrlboot: Set HAL uwTickPrio variable when needed. Signed-off-by: Damien George --- ports/stm32/powerctrlboot.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/stm32/powerctrlboot.c b/ports/stm32/powerctrlboot.c index caa5632926..41b56296e0 100644 --- a/ports/stm32/powerctrlboot.c +++ b/ports/stm32/powerctrlboot.c @@ -33,6 +33,11 @@ void powerctrl_config_systick(void) { SysTick->CTRL |= SYSTICK_CLKSOURCE_HCLK; SysTick_Config(HAL_RCC_GetHCLKFreq() / 1000); NVIC_SetPriority(SysTick_IRQn, IRQ_PRI_SYSTICK); + + #if !BUILDING_MBOOT && (defined(STM32H7) || defined(STM32L4) || defined(STM32WB)) + // Set SysTick IRQ priority variable in case the HAL needs to use it + uwTickPrio = IRQ_PRI_SYSTICK; + #endif } #if defined(STM32F0) From c99ed8d6fa9d4429bf78bcd965ce60ee747e67c3 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 31 Jan 2022 16:40:15 +1100 Subject: [PATCH 0059/1712] stm32/powerctrl: Write bootloader-state as 64-bit word to work on H7. H7 MCUs have ECC and writes do not go through to SRAM until 64-bits have been written (on another location is written). So use 64-bit writes for the bootloader-state variable so it is committed before the system reset. As part of this change, the lower byte of the bootloader address in BL_STATE must now be the magic number 0x5a5 for the state to be valid (previously this was 0x000 which is not as robust). Signed-off-by: Damien George --- ports/stm32/powerctrl.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/ports/stm32/powerctrl.c b/ports/stm32/powerctrl.c index 406325581b..a3f8207e9a 100644 --- a/ports/stm32/powerctrl.c +++ b/ports/stm32/powerctrl.c @@ -75,9 +75,19 @@ #endif #if MICROPY_HW_ENTER_BOOTLOADER_VIA_RESET -// Location in RAM of bootloader state (just after the top of the stack) -extern uint32_t _estack[]; -#define BL_STATE ((uint32_t *)&_estack) +// Location in RAM of bootloader state (just after the top of the stack). +// STM32H7 has ECC and writes to RAM must be 64-bit so they are fully committed +// to actual SRAM before a system reset occurs. +#define BL_STATE_PTR ((uint64_t *)&_estack) +#define BL_STATE_KEY (0x5a5) +#define BL_STATE_KEY_MASK (0xfff) +#define BL_STATE_KEY_SHIFT (32) +#define BL_STATE_INVALID (0) +#define BL_STATE_VALID(reg, addr) ((uint64_t)(reg) | ((uint64_t)((addr) | BL_STATE_KEY)) << BL_STATE_KEY_SHIFT) +#define BL_STATE_GET_REG(s) ((s) & 0xffffffff) +#define BL_STATE_GET_KEY(s) (((s) >> BL_STATE_KEY_SHIFT) & BL_STATE_KEY_MASK) +#define BL_STATE_GET_ADDR(s) (((s) >> BL_STATE_KEY_SHIFT) & ~BL_STATE_KEY_MASK) +extern uint64_t _estack[]; #endif static inline void powerctrl_disable_hsi_if_unused(void) { @@ -89,7 +99,7 @@ static inline void powerctrl_disable_hsi_if_unused(void) { NORETURN void powerctrl_mcu_reset(void) { #if MICROPY_HW_ENTER_BOOTLOADER_VIA_RESET - BL_STATE[1] = 1; // invalidate bootloader address + *BL_STATE_PTR = BL_STATE_INVALID; #if __DCACHE_PRESENT == 1 SCB_CleanDCache(); #endif @@ -112,8 +122,7 @@ NORETURN void powerctrl_enter_bootloader(uint32_t r0, uint32_t bl_addr) { // Enter the bootloader via a reset, so everything is reset (including WDT). // Upon reset powerctrl_check_enter_bootloader() will jump to the bootloader. - BL_STATE[0] = r0; - BL_STATE[1] = bl_addr; + *BL_STATE_PTR = BL_STATE_VALID(r0, bl_addr); #if __DCACHE_PRESENT == 1 SCB_CleanDCache(); #endif @@ -129,16 +138,15 @@ NORETURN void powerctrl_enter_bootloader(uint32_t r0, uint32_t bl_addr) { void powerctrl_check_enter_bootloader(void) { #if MICROPY_HW_ENTER_BOOTLOADER_VIA_RESET - uint32_t bl_addr = BL_STATE[1]; - BL_STATE[1] = 1; // invalidate bootloader address - if ((bl_addr & 0xfff) == 0 && (RCC->RCC_SR & RCC_SR_SFTRSTF)) { + uint64_t bl_state = *BL_STATE_PTR; + *BL_STATE_PTR = BL_STATE_INVALID; + if (BL_STATE_GET_KEY(bl_state) == BL_STATE_KEY && (RCC->RCC_SR & RCC_SR_SFTRSTF)) { // Reset by NVIC_SystemReset with bootloader data set -> branch to bootloader RCC->RCC_SR = RCC_SR_RMVF; #if defined(STM32F0) || defined(STM32F4) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH(); #endif - uint32_t r0 = BL_STATE[0]; - branch_to_bootloader(r0, bl_addr); + branch_to_bootloader(BL_STATE_GET_REG(bl_state), BL_STATE_GET_ADDR(bl_state)); } #endif } From c8c229b96c892ceb8ca1cf72e4a87096617ede64 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 31 Jan 2022 16:47:03 +1100 Subject: [PATCH 0060/1712] stm32/mboot: Use PLL3 for USB clock source on H7 MCUs. PLL3-Q is more reliable than PLL1-Q for the USB clock source when entering mboot from various reset states (eg power on vs MCU reset). (It was found that if the main application used PLL3-Q then sometimes the USB clock source would stay stuck on PLL3-Q and not switch to PLL1-Q after a reset.) Other related changes: - SystemCoreClockUpdate() should be called on H7 because the calculation can be involved in some cases. - __set_PRIMASK(0) should be called because on H7 the built-in ST DFU bootloader exits with IRQs disabled. Signed-off-by: Damien George --- ports/stm32/mboot/main.c | 42 +++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/ports/stm32/mboot/main.c b/ports/stm32/mboot/main.c index 3c3e4a8642..ae409168b9 100644 --- a/ports/stm32/mboot/main.c +++ b/ports/stm32/mboot/main.c @@ -265,27 +265,48 @@ void SystemClock_Config(void) { while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) != RESET) { } - // Configure PLL1 factors and source - RCC->PLLCKSELR = - MICROPY_HW_CLK_PLLM << RCC_PLLCKSELR_DIVM1_Pos - | 2 << RCC_PLLCKSELR_PLLSRC_Pos; // HSE selected as PLL source + // Disable PLL3 + __HAL_RCC_PLL3_DISABLE(); + while (__HAL_RCC_GET_FLAG(RCC_FLAG_PLL3RDY) != RESET) { + } + + // Select HSE as PLLx source + RCC->PLLCKSELR = 2 << RCC_PLLCKSELR_PLLSRC_Pos; + RCC->PLLCFGR = 0; + + // Configure PLL1 for use by SYSCLK + RCC->PLLCKSELR |= MICROPY_HW_CLK_PLLM << RCC_PLLCKSELR_DIVM1_Pos; + RCC->PLLCFGR |= RCC_PLLCFGR_DIVP1EN; + RCC->PLL1FRACR = 0; RCC->PLL1DIVR = (MICROPY_HW_CLK_PLLN - 1) << RCC_PLL1DIVR_N1_Pos | (MICROPY_HW_CLK_PLLP - 1) << RCC_PLL1DIVR_P1_Pos // only even P allowed | (MICROPY_HW_CLK_PLLQ - 1) << RCC_PLL1DIVR_Q1_Pos | (MICROPY_HW_CLK_PLLR - 1) << RCC_PLL1DIVR_R1_Pos; - // Enable PLL1 outputs for SYSCLK and USB - RCC->PLLCFGR = RCC_PLLCFGR_DIVP1EN | RCC_PLLCFGR_DIVQ1EN; + // Configure PLL3 for use by USB at Q=48MHz + RCC->PLLCKSELR |= MICROPY_HW_CLK_PLL3M << RCC_PLLCKSELR_DIVM3_Pos; + RCC->PLLCFGR |= RCC_PLLCFGR_DIVQ3EN; + RCC->PLL3FRACR = 0; + RCC->PLL3DIVR = + (MICROPY_HW_CLK_PLL3N - 1) << RCC_PLL3DIVR_N3_Pos + | (MICROPY_HW_CLK_PLL3P - 1) << RCC_PLL3DIVR_P3_Pos // only even P allowed + | (MICROPY_HW_CLK_PLL3Q - 1) << RCC_PLL3DIVR_Q3_Pos + | (MICROPY_HW_CLK_PLL3R - 1) << RCC_PLL3DIVR_R3_Pos; - // Select PLL1-Q for USB clock source - RCC->D2CCIP2R |= 1 << RCC_D2CCIP2R_USBSEL_Pos; + // Select PLL3-Q for USB clock source + MODIFY_REG(RCC->D2CCIP2R, RCC_D2CCIP2R_USBSEL, RCC_D2CCIP2R_USBSEL_1); // Enable PLL1 __HAL_RCC_PLL_ENABLE(); while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLLRDY) == RESET) { } + // Enable PLL3 + __HAL_RCC_PLL3_ENABLE(); + while(__HAL_RCC_GET_FLAG(RCC_FLAG_PLL3RDY) == RESET) { + } + // Increase latency before changing SYSCLK if (MICROPY_HW_FLASH_LATENCY > (FLASH->ACR & FLASH_ACR_LATENCY)) { __HAL_FLASH_SET_LATENCY(MICROPY_HW_FLASH_LATENCY); @@ -320,7 +341,7 @@ void SystemClock_Config(void) { ; // Update clock value and reconfigure systick now that the frequency changed - SystemCoreClock = CORE_PLL_FREQ; + SystemCoreClockUpdate(); systick_init(); } @@ -1486,6 +1507,9 @@ enter_bootloader: // set the system clock to be HSE SystemClock_Config(); + // Ensure IRQs are enabled (needed coming out of ST bootloader on H7) + __set_PRIMASK(0); + #if USE_USB_POLLING // irqs with a priority value greater or equal to "pri" will be disabled // "pri" should be between 1 and 15 inclusive From 29867a24391ae3938ae43b354297139b7a229b73 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 31 Jan 2022 16:55:07 +1100 Subject: [PATCH 0061/1712] stm32/mboot: Include hal_rcc_ex.c in source file list. It's needed at least on F4 because this file overrides the weak function HAL_RCC_DeInit() from hal_rcc.c. Signed-off-by: Damien George --- ports/stm32/mboot/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/stm32/mboot/Makefile b/ports/stm32/mboot/Makefile index 7e1b497cef..20b0db9070 100755 --- a/ports/stm32/mboot/Makefile +++ b/ports/stm32/mboot/Makefile @@ -162,6 +162,7 @@ SRC_HAL += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\ hal_pcd.c \ hal_pcd_ex.c \ hal_rcc.c \ + hal_rcc_ex.c \ ll_usb.c \ ) From ca1914fb474dd7a2a6e94ba835cea45b0bcd742b Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 31 Jan 2022 16:55:50 +1100 Subject: [PATCH 0062/1712] stm32/mboot: Support H7 MCUs in fwupdate.py. And optimise the speed of flash writing. Signed-off-by: Damien George --- ports/stm32/mboot/fwupdate.py | 137 +++++++++++++++++++++++----------- 1 file changed, 93 insertions(+), 44 deletions(-) diff --git a/ports/stm32/mboot/fwupdate.py b/ports/stm32/mboot/fwupdate.py index d7c8f46db4..8a366dae29 100644 --- a/ports/stm32/mboot/fwupdate.py +++ b/ports/stm32/mboot/fwupdate.py @@ -1,5 +1,5 @@ # Update Mboot or MicroPython from a .dfu.gz file on the board's filesystem -# MIT license; Copyright (c) 2019-2020 Damien P. George +# MIT license; Copyright (c) 2019-2022 Damien P. George from micropython import const import struct, time @@ -16,9 +16,6 @@ _ELEM_TYPE_MOUNT = const(2) _ELEM_TYPE_FSLOAD = const(3) _ELEM_TYPE_STATUS = const(4) -FLASH_KEY1 = 0x45670123 -FLASH_KEY2 = 0xCDEF89AB - def check_mem_contains(addr, buf): mem8 = stm.mem8 @@ -29,15 +26,6 @@ def check_mem_contains(addr, buf): return True -def check_mem_erased(addr, size): - mem16 = stm.mem16 - r = range(0, size, 2) - for off in r: - if mem16[addr + off] != 0xFFFF: - return False - return True - - def dfu_read(filename): f = open(filename, "rb") @@ -85,39 +73,99 @@ def dfu_read(filename): return elems -def flash_wait_not_busy(): - while stm.mem32[stm.FLASH + stm.FLASH_SR] & 1 << 16: - machine.idle() +class Flash: + _FLASH_KEY1 = 0x45670123 + _FLASH_KEY2 = 0xCDEF89AB + def __init__(self): + import os, uctypes -def flash_unlock(): - stm.mem32[stm.FLASH + stm.FLASH_KEYR] = FLASH_KEY1 - stm.mem32[stm.FLASH + stm.FLASH_KEYR] = FLASH_KEY2 + self.addressof = uctypes.addressof + # Detect MCU. + machine = os.uname().machine + if "STM32F4" in machine or "STM32F7" in machine: + dev_id = stm.mem32[0xE004_2000] & 0xFFF + elif "STM32H7" in machine: + dev_id = stm.mem32[0x5C00_1000] & 0xFFF + else: + dev_id = 0 -def flash_lock(): - stm.mem32[stm.FLASH + stm.FLASH_CR] = 1 << 31 # LOCK + # Configure flash parameters based on MCU. + if dev_id in (0x413, 0x419, 0x431, 0x451, 0x452): + # 0x413: STM32F405/407, STM32F415/417 + # 0x419: STM32F42x/43x + # 0x431: STM32F411 + # 0x451: STM32F76x/77x + # 0x452: STM32F72x/73x + self._keyr = stm.FLASH + stm.FLASH_KEYR + self._sr = stm.FLASH + stm.FLASH_SR + self._sr_busy = 1 << 16 + self._cr = stm.FLASH + stm.FLASH_CR + self._cr_lock = 1 << 31 + self._cr_init_erase = lambda s: 2 << 8 | s << 3 | 1 << 1 # PSIZE=32-bits, SNB, SER + self._cr_start_erase = 1 << 16 # STRT + self._cr_init_write = 2 << 8 | 1 << 0 # PSIZE=32-bits, PG + self._cr_flush = None + self._write_multiple = 4 + if dev_id == 0x451 and stm.mem32[0x1FFF_0008] & 1 << 13: # check nDBANK + # STM32F76x/77x in single-bank mode + self.sector0_size = 32 * 1024 + else: + self.sector0_size = 16 * 1024 + elif dev_id == 0x450: + # 0x450: STM32H742, STM32H743/753, STM32H750 + self._keyr = stm.FLASH + stm.FLASH_KEYR1 + self._sr = stm.FLASH + stm.FLASH_SR1 + self._sr_busy = 1 << 2 # QW1 + self._cr = stm.FLASH + stm.FLASH_CR1 + self._cr_lock = 1 << 0 # LOCK1 + self._cr_init_erase = lambda s: s << 8 | 3 << 4 | 1 << 2 # SNB1, PSIZE1=64-bits, SER1 + self._cr_start_erase = 1 << 7 # START1 + self._cr_init_write = 3 << 4 | 1 << 1 # PSIZE1=64-bits, PG1=1 + self._cr_flush = 1 << 6 # FW1=1 + self._write_multiple = 16 + self.sector0_size = 128 * 1024 + else: + raise Exception(f"unknown MCU {machine} DEV_ID=0x{dev_id:x}") + def wait_not_busy(self): + while stm.mem32[self._sr] & self._sr_busy: + machine.idle() -def flash_erase_sector(sector): - assert 0 <= sector <= 7 # for F722 - flash_wait_not_busy() - cr = 2 << 8 | sector << 3 | 1 << 1 # PSIZE = 32 bits # SNB # SER - stm.mem32[stm.FLASH + stm.FLASH_CR] = cr - stm.mem32[stm.FLASH + stm.FLASH_CR] = cr | 1 << 16 # STRT - flash_wait_not_busy() - stm.mem32[stm.FLASH + stm.FLASH_CR] = 0 + def unlock(self): + if stm.mem32[self._cr] & self._cr_lock: + stm.mem32[self._keyr] = self._FLASH_KEY1 + stm.mem32[self._keyr] = self._FLASH_KEY2 + def lock(self): + stm.mem32[self._cr] = self._cr_lock -def flash_write(addr, buf): - assert len(buf) % 4 == 0 - flash_wait_not_busy() - cr = 2 << 8 | 1 << 0 # PSIZE = 32 bits # PG - stm.mem32[stm.FLASH + stm.FLASH_CR] = cr - for off in range(0, len(buf), 4): - stm.mem32[addr + off] = struct.unpack_from("I", buf, off)[0] - flash_wait_not_busy() - stm.mem32[stm.FLASH + stm.FLASH_CR] = 0 + def erase_sector(self, sector): + assert 0 <= sector <= 7 + self.wait_not_busy() + stm.mem32[self._cr] = self._cr_init_erase(sector) + stm.mem32[self._cr] |= self._cr_start_erase + self.wait_not_busy() + stm.mem32[self._cr] = 0 + + # This method is optimised for speed, to reduce the time data is being written. + def write(self, addr, buf): + assert len(buf) % 4 == 0 + mem32 = stm.mem32 + buf_addr = self.addressof(buf) + r = range(0, len(buf), 4) + self.wait_not_busy() + mem32[self._cr] = self._cr_init_write + for off in r: + mem32[addr + off] = mem32[buf_addr + off] + if off % self._write_multiple == 0: + while mem32[self._sr] & self._sr_busy: + pass + if self._cr_flush is not None: + mem32[self._cr] |= self._cr_flush + self.wait_not_busy() + mem32[self._cr] = 0 def update_mboot(filename): @@ -144,13 +192,14 @@ def update_mboot(filename): print("Programming Mboot, do not turn off!") time.sleep_ms(50) + flash = Flash() irq = machine.disable_irq() - flash_unlock() - flash_erase_sector(0) - if len(mboot_fw) > 16 * 1024 and not check_mem_erased(mboot_addr + 16 * 1024, 16 * 1024): - flash_erase_sector(1) - flash_write(mboot_addr, mboot_fw) - flash_lock() + flash.unlock() + flash.erase_sector(0) + if len(mboot_fw) > flash.sector0_size: + flash.erase_sector(1) + flash.write(mboot_addr, mboot_fw) + flash.lock() machine.enable_irq(irq) print("New Mboot programmed.") From 60e05ae84ec08c06e3f9d9051339811641479a94 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 31 Jan 2022 17:26:47 +1100 Subject: [PATCH 0063/1712] stm32/mboot: Compute and check CRC32 of dfu file in fwupdate.py. Signed-off-by: Damien George --- ports/stm32/mboot/fwupdate.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ports/stm32/mboot/fwupdate.py b/ports/stm32/mboot/fwupdate.py index 8a366dae29..3b8dc51e1c 100644 --- a/ports/stm32/mboot/fwupdate.py +++ b/ports/stm32/mboot/fwupdate.py @@ -27,6 +27,8 @@ def check_mem_contains(addr, buf): def dfu_read(filename): + from binascii import crc32 + f = open(filename, "rb") hdr = f.read(3) @@ -39,23 +41,28 @@ def dfu_read(filename): print("Invalid firmware", filename) return None + crc = 0 elems = [] hdr = f.read(11) + crc = crc32(hdr, crc) sig, ver, size, num_targ = struct.unpack("<5sBIB", hdr) file_offset = 11 for i in range(num_targ): hdr = f.read(274) + crc = crc32(hdr, crc) sig, alt, has_name, name, t_size, num_elem = struct.unpack("<6sBi255sII", hdr) file_offset += 274 file_offset_t = file_offset for j in range(num_elem): hdr = f.read(8) + crc = crc32(hdr, crc) addr, e_size = struct.unpack(" Date: Tue, 26 Jan 2021 14:49:56 +0100 Subject: [PATCH 0064/1712] stm32: Add support for G4 MCUs, and add NUCLEO_G474RE board defn. This commit adds support for the STM32G4 series of MCUs, and a board definition for NUCLEO_G474RE. This board has the REPL on LPUART1 which is connected to the on-board ST-link USB-UART. --- ports/stm32/Makefile | 5 + ports/stm32/adc.c | 50 +++- ports/stm32/adc.h | 2 + ports/stm32/boards/NUCLEO_G474RE/board.json | 15 ++ .../boards/NUCLEO_G474RE/mpconfigboard.h | 95 +++++++ .../boards/NUCLEO_G474RE/mpconfigboard.mk | 6 + ports/stm32/boards/NUCLEO_G474RE/pins.csv | 86 +++++++ .../boards/NUCLEO_G474RE/stm32g4xx_hal_conf.h | 19 ++ ports/stm32/boards/make-pins.py | 25 +- ports/stm32/boards/stm32g474.ld | 28 +++ ports/stm32/boards/stm32g474_af.csv | 109 ++++++++ ports/stm32/boards/stm32g4xx_hal_conf_base.h | 131 ++++++++++ ports/stm32/dac.c | 8 +- ports/stm32/dma.c | 237 +++++++++++++++++- ports/stm32/dma.h | 23 ++ ports/stm32/extint.c | 18 +- ports/stm32/extint.h | 2 +- ports/stm32/flash.c | 39 ++- ports/stm32/machine_adc.c | 27 +- ports/stm32/machine_uart.c | 2 +- ports/stm32/modmachine.c | 2 +- ports/stm32/mpconfigboard_common.h | 17 +- ports/stm32/mphalport.c | 2 +- ports/stm32/pin_defs_stm32.h | 4 +- ports/stm32/powerctrl.c | 13 +- ports/stm32/pyb_i2c.c | 24 +- ports/stm32/rtc.c | 21 +- ports/stm32/stm32_it.c | 20 +- ports/stm32/system_stm32.c | 62 ++++- ports/stm32/timer.c | 14 +- ports/stm32/uart.c | 27 +- ports/stm32/usbdev/core/inc/usbd_def.h | 8 +- 32 files changed, 1050 insertions(+), 91 deletions(-) create mode 100644 ports/stm32/boards/NUCLEO_G474RE/board.json create mode 100644 ports/stm32/boards/NUCLEO_G474RE/mpconfigboard.h create mode 100644 ports/stm32/boards/NUCLEO_G474RE/mpconfigboard.mk create mode 100644 ports/stm32/boards/NUCLEO_G474RE/pins.csv create mode 100644 ports/stm32/boards/NUCLEO_G474RE/stm32g4xx_hal_conf.h create mode 100644 ports/stm32/boards/stm32g474.ld create mode 100644 ports/stm32/boards/stm32g474_af.csv create mode 100644 ports/stm32/boards/stm32g4xx_hal_conf_base.h diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index 290503937d..c2581c100b 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -94,6 +94,7 @@ endif CFLAGS_MCU_f0 = $(CFLAGS_CORTEX_M) -mtune=cortex-m0 -mcpu=cortex-m0 CFLAGS_MCU_f4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 CFLAGS_MCU_f7 = $(CFLAGS_CORTEX_M) -mtune=cortex-m7 -mcpu=cortex-m7 +CFLAGS_MCU_g4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 CFLAGS_MCU_l0 = $(CFLAGS_CORTEX_M) -mtune=cortex-m0plus -mcpu=cortex-m0plus CFLAGS_MCU_l4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 CFLAGS_MCU_h7 = $(CFLAGS_CORTEX_M) -mtune=cortex-m7 -mcpu=cortex-m7 @@ -429,6 +430,10 @@ $(BUILD)/$(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_hal_mmc.o: CFLAGS += -Wno-error=par endif endif +ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),g4)) + HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_, hal_fdcan.c) +endif + ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),STM32H743xx STM32H750xx STM32H7A3xx STM32H7A3xxQ STM32H7B3xx STM32H7B3xxQ)) HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_, hal_fdcan.c) else diff --git a/ports/stm32/adc.c b/ports/stm32/adc.c index 3e61abce3c..2e52fb07aa 100644 --- a/ports/stm32/adc.c +++ b/ports/stm32/adc.c @@ -102,6 +102,16 @@ #define ADC_CAL2 ((uint16_t *)(ADC_CAL_ADDRESS + 4)) #define ADC_CAL_BITS (12) +#elif defined(STM32G4) + +#define ADC_FIRST_GPIO_CHANNEL (0) +#define ADC_LAST_GPIO_CHANNEL (18) +#define ADC_SCALE_V (((float)VREFINT_CAL_VREF) / 1000.0f) +#define ADC_CAL_ADDRESS VREFINT_CAL_ADDR +#define ADC_CAL1 TEMPSENSOR_CAL1_ADDR +#define ADC_CAL2 TEMPSENSOR_CAL2_ADDR +#define ADC_CAL_BITS (12) // UM2570, __HAL_ADC_CALC_TEMPERATURE: 'corresponds to a resolution of 12 bits' + #elif defined(STM32H7) #define ADC_SCALE_V (3.3f) @@ -141,6 +151,8 @@ defined(STM32F746xx) || defined(STM32F765xx) || \ defined(STM32F767xx) || defined(STM32F769xx) #define VBAT_DIV (4) +#elif defined(STM32G4) +#define VBAT_DIV (3) #elif defined(STM32H743xx) || defined(STM32H747xx) || \ defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || \ defined(STM32H7B3xx) || defined(STM32H7B3xxQ) || \ @@ -206,7 +218,7 @@ STATIC bool is_adcx_channel(int channel) { ADC_HandleTypeDef handle; handle.Instance = ADCx; return IS_ADC_CHANNEL(&handle, channel); - #elif defined(STM32WB) + #elif defined(STM32G4) || defined(STM32WB) ADC_HandleTypeDef handle; handle.Instance = ADCx; return __HAL_ADC_IS_CHANNEL_INTERNAL(channel) @@ -220,7 +232,7 @@ STATIC void adc_wait_for_eoc_or_timeout(ADC_HandleTypeDef *adcHandle, int32_t ti uint32_t tickstart = HAL_GetTick(); #if defined(STM32F4) || defined(STM32F7) while ((adcHandle->Instance->SR & ADC_FLAG_EOC) != ADC_FLAG_EOC) { - #elif defined(STM32F0) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB) + #elif defined(STM32F0) || defined(STM32G4) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB) while (READ_BIT(adcHandle->Instance->ISR, ADC_FLAG_EOC) != ADC_FLAG_EOC) { #else #error Unsupported processor @@ -237,6 +249,8 @@ STATIC void adcx_clock_enable(ADC_HandleTypeDef *adch) { #elif defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) __HAL_RCC_ADC12_CLK_ENABLE(); __HAL_RCC_ADC_CONFIG(RCC_ADCCLKSOURCE_CLKP); + #elif defined(STM32G4) + __HAL_RCC_ADC12_CLK_ENABLE(); #elif defined(STM32H7) if (adch->Instance == ADC3) { __HAL_RCC_ADC3_CLK_ENABLE(); @@ -286,7 +300,7 @@ STATIC void adcx_init_periph(ADC_HandleTypeDef *adch, uint32_t resolution) { adch->Init.OversamplingMode = DISABLE; adch->Init.LeftBitShift = ADC_LEFTBITSHIFT_NONE; adch->Init.ConversionDataManagement = ADC_CONVERSIONDATA_DR; - #elif defined(STM32L4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32L4) || defined(STM32WB) adch->Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1; adch->Init.ScanConvMode = ADC_SCAN_DISABLE; adch->Init.LowPowerAutoWait = DISABLE; @@ -303,7 +317,7 @@ STATIC void adcx_init_periph(ADC_HandleTypeDef *adch, uint32_t resolution) { #if defined(STM32H7) HAL_ADCEx_Calibration_Start(adch, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED); #endif - #if defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) HAL_ADCEx_Calibration_Start(adch, ADC_SINGLE_ENDED); #endif } @@ -312,7 +326,7 @@ STATIC void adc_init_single(pyb_obj_adc_t *adc_obj) { adc_obj->handle.Instance = ADCx; adcx_init_periph(&adc_obj->handle, ADC_RESOLUTION_12B); - #if defined(STM32L4) && defined(ADC_DUALMODE_REGSIMULT_INJECSIMULT) + #if (defined(STM32G4) || defined(STM32L4)) && defined(ADC_DUALMODE_REGSIMULT_INJECSIMULT) ADC_MultiModeTypeDef multimode; multimode.Mode = ADC_MODE_INDEPENDENT; if (HAL_ADCEx_MultiModeConfigChannel(&adc_obj->handle, &multimode) != HAL_OK) { @@ -324,7 +338,7 @@ STATIC void adc_init_single(pyb_obj_adc_t *adc_obj) { STATIC void adc_config_channel(ADC_HandleTypeDef *adc_handle, uint32_t channel) { ADC_ChannelConfTypeDef sConfig; - #if defined(STM32H7) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) sConfig.Rank = ADC_REGULAR_RANK_1; if (__HAL_ADC_IS_CHANNEL_INTERNAL(channel) == 0) { channel = __HAL_ADC_DECIMAL_NB_TO_CHANNEL(channel); @@ -352,7 +366,7 @@ STATIC void adc_config_channel(ADC_HandleTypeDef *adc_handle, uint32_t channel) sConfig.OffsetNumber = ADC_OFFSET_NONE; sConfig.OffsetRightShift = DISABLE; sConfig.OffsetSignedSaturation = DISABLE; - #elif defined(STM32L4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32L4) || defined(STM32WB) if (__HAL_ADC_IS_CHANNEL_INTERNAL(channel)) { sConfig.SamplingTime = ADC_SAMPLETIME_247CYCLES_5; } else { @@ -536,7 +550,7 @@ STATIC mp_obj_t adc_read_timed(mp_obj_t self_in, mp_obj_t buf_in, mp_obj_t freq_ // for subsequent samples we can just set the "start sample" bit #if defined(STM32F4) || defined(STM32F7) self->handle.Instance->CR2 |= (uint32_t)ADC_CR2_SWSTART; - #elif defined(STM32F0) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB) + #elif defined(STM32F0) || defined(STM32G4) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB) SET_BIT(self->handle.Instance->CR, ADC_CR_ADSTART); #else #error Unsupported processor @@ -646,7 +660,7 @@ STATIC mp_obj_t adc_read_timed_multi(mp_obj_t adc_array_in, mp_obj_t buf_array_i // ADC is started: set the "start sample" bit #if defined(STM32F4) || defined(STM32F7) adc->handle.Instance->CR2 |= (uint32_t)ADC_CR2_SWSTART; - #elif defined(STM32F0) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB) + #elif defined(STM32F0) || defined(STM32G4) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB) SET_BIT(adc->handle.Instance->CR, ADC_CR_ADSTART); #else #error Unsupported processor @@ -766,7 +780,16 @@ STATIC uint32_t adc_config_and_read_ref(ADC_HandleTypeDef *adcHandle, uint32_t c } int adc_read_core_temp(ADC_HandleTypeDef *adcHandle) { + #if defined(STM32G4) + int32_t raw_value = 0; + if (adcHandle->Instance == ADC1) { + raw_value = adc_config_and_read_ref(adcHandle, ADC_CHANNEL_TEMPSENSOR_ADC1); + } else { + return 0; + } + #else int32_t raw_value = adc_config_and_read_ref(adcHandle, ADC_CHANNEL_TEMPSENSOR); + #endif return ((raw_value - CORE_TEMP_V25) / CORE_TEMP_AVG_SLOPE) + 25; } @@ -775,7 +798,16 @@ int adc_read_core_temp(ADC_HandleTypeDef *adcHandle) { STATIC volatile float adc_refcor = 1.0f; float adc_read_core_temp_float(ADC_HandleTypeDef *adcHandle) { + #if defined(STM32G4) + int32_t raw_value = 0; + if (adcHandle->Instance == ADC1) { + raw_value = adc_config_and_read_ref(adcHandle, ADC_CHANNEL_TEMPSENSOR_ADC1); + } else { + return 0; + } + #else int32_t raw_value = adc_config_and_read_ref(adcHandle, ADC_CHANNEL_TEMPSENSOR); + #endif float core_temp_avg_slope = (*ADC_CAL2 - *ADC_CAL1) / 80.0f; return (((float)raw_value * adc_refcor - *ADC_CAL1) / core_temp_avg_slope) + 30.0f; } diff --git a/ports/stm32/adc.h b/ports/stm32/adc.h index 9101b9db83..db706ea494 100644 --- a/ports/stm32/adc.h +++ b/ports/stm32/adc.h @@ -48,6 +48,8 @@ static inline void adc_deselect_vbat(ADC_TypeDef *adc, uint32_t channel) { adc_common = ADC_COMMON_REGISTER(0); #elif defined(STM32F7) adc_common = ADC123_COMMON; + #elif defined(STM32G4) + adc_common = ADC12_COMMON; #elif defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) adc_common = ADC12_COMMON; #elif defined(STM32H7) diff --git a/ports/stm32/boards/NUCLEO_G474RE/board.json b/ports/stm32/boards/NUCLEO_G474RE/board.json new file mode 100644 index 0000000000..3bbb749826 --- /dev/null +++ b/ports/stm32/boards/NUCLEO_G474RE/board.json @@ -0,0 +1,15 @@ +{ + "deploy": [ + "../deploy.md" + ], + "docs": "", + "features": [], + "images": [ + "nucleo_g474re.jpg" + ], + "mcu": "stm32g4", + "product": "Nucleo G474RE", + "thumbnail": "", + "url": "", + "vendor": "ST Microelectronics" +} diff --git a/ports/stm32/boards/NUCLEO_G474RE/mpconfigboard.h b/ports/stm32/boards/NUCLEO_G474RE/mpconfigboard.h new file mode 100644 index 0000000000..06b4e4c52a --- /dev/null +++ b/ports/stm32/boards/NUCLEO_G474RE/mpconfigboard.h @@ -0,0 +1,95 @@ +#define MICROPY_HW_BOARD_NAME "NUCLEO_G474RE" +#define MICROPY_HW_MCU_NAME "STM32G474" + +#define MICROPY_HW_ENABLE_RTC (1) +#define MICROPY_HW_ENABLE_RNG (1) +#define MICROPY_HW_ENABLE_ADC (1) +#define MICROPY_HW_ENABLE_DAC (1) // A4, A5 +#define MICROPY_HW_ENABLE_USB (0) // A12 (dp), A11 (dm) +#define MICROPY_HW_HAS_SWITCH (1) +#define MICROPY_HW_HAS_FLASH (0) // QSPI extflash not mounted + +#define MICROPY_PY_UASYNCIO (0) +#define MICROPY_PY_UZLIB (0) +#define MICROPY_PY_UBINASCII (0) +#define MICROPY_PY_UHASHLIB (0) +#define MICROPY_PY_UJSON (0) +#define MICROPY_PY_URE (0) +#define MICROPY_PY_FRAMEBUF (0) +#define MICROPY_PY_USOCKET (0) +#define MICROPY_PY_NETWORK (0) + +// The board has an 24MHz HSE, the following gives 170MHz CPU speed +#define MICROPY_HW_CLK_PLLM (6) +#define MICROPY_HW_CLK_PLLN (85) +#define MICROPY_HW_CLK_PLLP (2) +#define MICROPY_HW_CLK_PLLQ (8) +#define MICROPY_HW_CLK_PLLR (2) + +#define MICROPY_HW_CLK_USE_HSI48 (1) // for RNG + +// 4 wait states +#define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_8 + +// UART config +#define MICROPY_HW_LPUART1_TX (pin_A2) // A2 (to STLINK), B11, C1 +#define MICROPY_HW_LPUART1_RX (pin_A3) // A3 (to STLINK), B10, C0 +#define MICROPY_HW_UART1_TX (pin_C4) // A9, B6, C4, E0 +#define MICROPY_HW_UART1_RX (pin_C5) // A10, B7, C5, E1 +//#define MICROPY_HW_UART2_TX (pin_A2) // A14, B3, D5 +//#define MICROPY_HW_UART2_RX (pin_A3) // A15, B4, D6 +//#define MICROPY_HW_UART2_RTS (pin_A1) // D4 +//#define MICROPY_HW_UART2_CTS (pin_A0) // D3 +#define MICROPY_HW_UART3_TX (pin_B10) // B9, B10, C10, D8 +#define MICROPY_HW_UART3_RX (pin_B11) // B8 = boot0, B11, C11, D9, E15 +//#define MICROPY_HW_UART3_RTS (pin_B14) // D12, F6 +//#define MICROPY_HW_UART3_CTS (pin_B13) // A13, D11 +//#define MICROPY_HW_UART4_TX (pin_) // C10 +//#define MICROPY_HW_UART4_RX (pin_) // C11 + +#define MICROPY_HW_UART_REPL (PYB_LPUART_1) // default on Nucleo G474 +#define MICROPY_HW_UART_REPL_BAUD (115200) + +// I2C buses +#define MICROPY_HW_I2C1_SCL (pin_B8) // A13, A15, B8 (=boot0) +#define MICROPY_HW_I2C1_SDA (pin_B9) // A14, B7, B9 +//#define MICROPY_HW_I2C2_SCL (pin_) // A9, C4 +//#define MICROPY_HW_I2C2_SDA (pin_) // A8, F0 +//#define MICROPY_HW_I2C3_SCL (pin_) // A8, C8 +//#define MICROPY_HW_I2C3_SDA (pin_) // B5, C9, C11 + +// SPI +#define MICROPY_HW_SPI1_NSS (pin_A4) // A4, A15 (Nucleo64 specifies B6 as pin CS, must be done as GPIO, not as AF) +#define MICROPY_HW_SPI1_SCK (pin_A5) // A5 (LED), B3 (SWO) +#define MICROPY_HW_SPI1_MISO (pin_A6) // A6, B4 +#define MICROPY_HW_SPI1_MOSI (pin_A7) // A7, B5 +//#define MICROPY_HW_SPI2_NSS (pin_) // B12, D15, F0 +//#define MICROPY_HW_SPI2_SCK (pin_) // B13, F1, F9, F10 +//#define MICROPY_HW_SPI2_MISO (pin_) // A10, B14 +//#define MICROPY_HW_SPI2_MOSI (pin_) // A11, B15 +//#define MICROPY_HW_SPI3_NSS (pin_) // A4, A15 +//#define MICROPY_HW_SPI3_SCK (pin_) // B3, C10 +//#define MICROPY_HW_SPI3_MISO (pin_) // B4, C11 +//#define MICROPY_HW_SPI3_MOSI (pin_) // B5, C12 + +// USRSW is pulled low. Pressing the button makes the input go high. +#define MICROPY_HW_USRSW_PIN (pin_C13) +#define MICROPY_HW_USRSW_PULL (GPIO_NOPULL) +#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_RISING) +#define MICROPY_HW_USRSW_PRESSED (1) + +// LEDs +#define MICROPY_HW_LED1 (pin_A5) // green +#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin)) +#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin)) + +// USB config pin A12 (dp), A11 (dm) not mounted on Nucleo +//#define MICROPY_HW_USB_FS (1) +//#define MICROPY_HW_USB_VBUS_DETECT_PIN (pin_A9) +//#define MICROPY_HW_USB_OTG_ID_PIN (pin_A10) + +// FDCAN bus +// User TODO: fit transceiver chip +#define MICROPY_HW_CAN1_NAME "FDCAN1" +#define MICROPY_HW_CAN1_TX (pin_A12) // A12, B9, D1 +#define MICROPY_HW_CAN1_RX (pin_A11) // A11, B8, D0 diff --git a/ports/stm32/boards/NUCLEO_G474RE/mpconfigboard.mk b/ports/stm32/boards/NUCLEO_G474RE/mpconfigboard.mk new file mode 100644 index 0000000000..24a06e08ec --- /dev/null +++ b/ports/stm32/boards/NUCLEO_G474RE/mpconfigboard.mk @@ -0,0 +1,6 @@ +# MCU settings +MCU_SERIES = g4 +CMSIS_MCU = STM32G474xx +MICROPY_FLOAT_IMPL = single +AF_FILE = boards/stm32g474_af.csv +LD_FILES = boards/stm32g474.ld boards/common_basic.ld diff --git a/ports/stm32/boards/NUCLEO_G474RE/pins.csv b/ports/stm32/boards/NUCLEO_G474RE/pins.csv new file mode 100644 index 0000000000..473a5e26bc --- /dev/null +++ b/ports/stm32/boards/NUCLEO_G474RE/pins.csv @@ -0,0 +1,86 @@ +A0,PA0 +A1,PA1 +A2,PA4 +A3,BPB0 +A4,PC1 +A5,PC0 +D0,PC5 +D1,PC4 +D2,PA10 +D3,PB3 +D4,PB5 +D5,PB4 +D6,PB10 +D7,PA8 +D8,PA9 +D9,PC7 +D10,PB6 +D11,PA7 +D12,PA6 +D13,PA5 +D14,PB9 +D15,PB8 +SW,PC13 +I2C_SDA,PB9 +I2C_SCL,PB8 +LED1,PA5 +SPI_MOSI,PA7 +SPI_MISO,PA6 +SPI_SCK,PA5 +SPI_CS,PB6 +LPUART1_TX,PA2 +LPUART1_RX,PA3 +UART1_TX,PC4 +UART1_RX,PC5 +CN7_1,PC10 +CN7_2,PC11 +CN7_3,PC12 +CN7_4,PD2 +CN7_7,PB8 +CN7_13,PA13 +CN7_15,PA14 +CN7_17,PA15 +CN7_21,PB7 +CN7_23,PC13 +CN7_25,PC14 +CN7_27,PC15 +CN7_28,PA0 +CN7_29,PF0 +CN7_30,PA1 +CN7_31,PF1 +CN7_32,PA4 +CN7_34,PB0 +CN7_35,PC2 +CN7_36,PC1 +CN7_37,PC3 +CN7_38,PC0 +CN10_1,PC9 +CN10_2,PC8 +CN10_3,PB8 +CN10_4,PC6 +CN10_5,PB9 +CN10_6,PC5 +CN10_11,PA5 +CN10_12,PA12 +CN10_13,PA6 +CN10_14,PA11 +CN10_15,PA7 +CN10_16,PB12 +CN10_17,PB6 +CN10_18,PB11 +CN10_19,PC7 +CN10_21,PA9 +CN10_22,PB2 +CN10_23,PA8 +CN10_24,PB1 +CN10_25,PB10 +CN10_26,PB15 +CN10_27,PB4 +CN10_28,PB14 +CN10_29,PB5 +CN10_30,PB13 +CN10_31,PB3 +CN10_33,PA10 +CN10_34,PC4 +CN10_35,PC4 +CN10_37,PC5 diff --git a/ports/stm32/boards/NUCLEO_G474RE/stm32g4xx_hal_conf.h b/ports/stm32/boards/NUCLEO_G474RE/stm32g4xx_hal_conf.h new file mode 100644 index 0000000000..5e82fb4874 --- /dev/null +++ b/ports/stm32/boards/NUCLEO_G474RE/stm32g4xx_hal_conf.h @@ -0,0 +1,19 @@ +/* This file is part of the MicroPython project, http://micropython.org/ + * The MIT License (MIT) + * Copyright (c) 2019 Damien P. George + */ +#ifndef MICROPY_INCLUDED_STM32G4XX_HAL_CONF_H +#define MICROPY_INCLUDED_STM32G4XX_HAL_CONF_H + +#include "boards/stm32g4xx_hal_conf_base.h" + +// Oscillator values in Hz +#define HSE_VALUE (24000000) +#define LSE_VALUE (32768) +#define EXTERNAL_CLOCK_VALUE (24000) + +// Oscillator timeouts in ms +#define HSE_STARTUP_TIMEOUT (100) +#define LSE_STARTUP_TIMEOUT (5000) + +#endif // MICROPY_INCLUDED_STM32G4XX_HAL_CONF_H diff --git a/ports/stm32/boards/make-pins.py b/ports/stm32/boards/make-pins.py index 14c9e91097..4e895f8f60 100755 --- a/ports/stm32/boards/make-pins.py +++ b/ports/stm32/boards/make-pins.py @@ -219,23 +219,24 @@ class Pin(object): def parse_adc(self, adc_str): if adc_str[:3] != "ADC": return + adc, channel = None, None if adc_str.find("_INP") != -1: # STM32H7xx, entries have the form: ADCxx_IN[PN]yy/... - # for now just pick the entry with the most ADC periphs - adc, channel = None, None - for ss in adc_str.split("/"): - if ss.find("_INP") != -1: - a, c = ss.split("_") - if adc is None or len(a) > len(adc): - adc, channel = a, c - if adc is None: - return - channel = channel[3:] + sep = "_INP" else: # all other MCUs, entries have the form: ADCxx_INyy - adc, channel = adc_str.split("_") - channel = channel[2:] + sep = "_IN" + + # Pick the entry with the most ADC peripherals + for ss in adc_str.split("/"): + if ss.find(sep) != -1: + a, c = ss.split("_") + if adc is None or len(a) > len(adc): + adc, channel = a, c + if adc is None: + return + channel = channel[len(sep) - 1 :] for idx in range(3, len(adc)): adc_num = int(adc[idx]) # 1, 2, or 3 diff --git a/ports/stm32/boards/stm32g474.ld b/ports/stm32/boards/stm32g474.ld new file mode 100644 index 0000000000..4fe61a472f --- /dev/null +++ b/ports/stm32/boards/stm32g474.ld @@ -0,0 +1,28 @@ +/* Specify the memory areas */ +MEMORY +{ + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 352K + FLASH_FS (rx) : ORIGIN = 0x08058000, LENGTH = 160K /* starting @ 352K */ +} + +/* Generate a link error if heap and stack don't fit into RAM */ +_minimum_heap_size = 0x200; /* required amount of heap */ +_minimum_stack_size = 0x400; /* required amount of stack */ + +_ram_start = ORIGIN(RAM); +_ram_end = ORIGIN(RAM) + LENGTH(RAM); + +_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(RAM) + LENGTH(RAM); +_micropy_hw_internal_flash_storage_ram_cache_start = _micropy_hw_internal_flash_storage_ram_cache_end - 2K; /* fs cache = 2K RAM */ + +/* Define the stack. The stack is full descending so begins just above last byte + of RAM. Note that EABI requires the stack to be 8-byte aligned for a call. */ +_estack = _micropy_hw_internal_flash_storage_ram_cache_start - _estack_reserve; +_sstack = _estack - 8K; /* tunable */ + +_heap_start = _ebss; /* heap starts just after statically allocated memory */ +_heap_end = _sstack; + +_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); +_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); diff --git a/ports/stm32/boards/stm32g474_af.csv b/ports/stm32/boards/stm32g474_af.csv new file mode 100644 index 0000000000..0108ee9013 --- /dev/null +++ b/ports/stm32/boards/stm32g474_af.csv @@ -0,0 +1,109 @@ +Port,,AF0,AF1,AF2,AF3,AF4,AF5,AF6,AF7,AF8,AF9,AF10,AF11,AF12,AF13,AF14,AF15, +,,I2C4/SYS_AF,LPTIM1/TIM2/5/15/16/17,I2C1/3/TIM1/2/3/4/5/8/20/15/COMP1,QUADSPI1/I2C3/4/SAI1/USB/HRTIM1/TIM8/20/15/COMP3,I2C1/2/3/4/TIM1/8/16/17,QUADSPI1/SPI1/2/3/4/I2S2/3/I2C4/UART4/5/TIM8/Infrared,QUADSPI1/SPI2/3/I2S2/3/TIM1/5/8/20/Infrared,USART1/2/3/CAN/COMP7/5/6,I2C3/4/UART4/5/LPUART1/COMP1/2/7/4/5/6/3,CAN/TIM1/8/15/CAN1/2,QUADSPI1/TIM2/3/4/8/17,LPTIM1/TIM1/8/CAN1/3,FMC/LPUART1/SAI1/HRTIM1/TIM1,SAI1SAI1/HRTIM1/OPAMP2,UART4/5/SAI1/TIM2/15/UCPD1,SYS,ADC,COMP,DAC,OPAMP +PortA,PA0,,TIM2_CH1,TIM5_CH1,,,,,USART2_CTS,COMP1_OUT,TIM8_BKIN,TIM8_ETR,,,,TIM2_ETR,EVENTOUT,ADC12_IN1,COMP1_INM/COMP3_INP,, +PortA,PA1,RTC_REFIN,TIM2_CH2,TIM5_CH2,,,,,USART2_RTS_DE,,TIM15_CH1N,,,,,,EVENTOUT,ADC12_IN2,COMP1_INP,,OPAMP1_VINP/OPAMP3_VINP/OPAMP6_VINM +PortA,PA2,,TIM2_CH3,TIM5_CH3,,,,,USART2_TX,COMP2_OUT,TIM15_CH1,QUADSPI1_BK1_NCS,,LPUART1_TX,,UCPD1_FRSTX,EVENTOUT,ADC1_IN3,COMP2_INM,,OPAMP1_VOUT +PortA,PA3,,TIM2_CH4,TIM5_CH4,SAI1_CK1,,,,USART2_RX,,TIM15_CH2,QUADSPI1_CLK,,LPUART1_RX,SAI1_MCLK_A,,EVENTOUT,ADC1_IN4,COMP2_INP,,OPAMP1_VINM/OPAMP1_VINP/OPAMP5_VINM +PortA,PA4,,,TIM3_CH2,,,SPI1_NSS,SPI3_NSS/I2S3_WS,USART2_CK,,,,,,SAI1_FS_B,,EVENTOUT,ADC2_IN17,COMP1_INM,DAC1_OUT1, +PortA,PA5,,TIM2_CH1,TIM2_ETR,,,SPI1_SCK,,,,,,,,,UCPD1_FRSTX,EVENTOUT,ADC2_IN13,COMP2_INM,DAC1_OUT2,OPAMP2_VINM +PortA,PA6,,TIM16_CH1,TIM3_CH1,,TIM8_BKIN,SPI1_MISO,TIM1_BKIN,,COMP1_OUT,,QUADSPI1_BK1_IO3,,LPUART1_CTS,,,EVENTOUT,ADC2_IN3,,DAC2_OUT1,OPAMP2_VOUT +PortA,PA7,,TIM17_CH1,TIM3_CH2,,TIM8_CH1N,SPI1_MOSI,TIM1_CH1N,,COMP2_OUT,,QUADSPI1_BK1_IO2,,,,UCPD1_FRSTX,EVENTOUT,ADC2_IN4,COMP2_INP,,OPAMP1_VINP/OPAMP2_VINP +PortA,PA8,MCO,,I2C3_SCL,,I2C2_SDA,I2S2_MCK,TIM1_CH1,USART1_CK,COMP7_OUT,,TIM4_ETR,CAN3_RX,SAI1_CK2,HRTIM1_CHA1,SAI1_SCK_A,EVENTOUT,ADC5_IN1,,,OPAMP5_VOUT +PortA,PA9,,,I2C3_SMBA,,I2C2_SCL,I2S3_MCK,TIM1_CH2,USART1_TX,COMP5_OUT,TIM15_BKIN,TIM2_CH3,,,HRTIM1_CHA2,SAI1_FS_A,EVENTOUT,ADC5_IN2,,, +PortA,PA10,,TIM17_BKIN,,USB_CRS_SYNC,I2C2_SMBA,SPI2_MISO,TIM1_CH3,USART1_RX,COMP6_OUT,,TIM2_CH4,TIM8_BKIN,SAI1_D1,HRTIM1_CHB1,SAI1_SD_A,EVENTOUT,,,, +PortA,PA11,,,,,,SPI2_MOSI/I2S2_SD,TIM1_CH1N,USART1_CTS,COMP1_OUT,CAN1_RX,TIM4_CH1,TIM1_CH4,TIM1_BKIN2,HRTIM1_CHB2,,EVENTOUT,,,, +PortA,PA12,,TIM16_CH1,,,,I2SCKIN,TIM1_CH2N,USART1_RTS_DE,COMP2_OUT,CAN1_TX,TIM4_CH2,TIM1_ETR,,HRTIM1_FLT1,,EVENTOUT,,,, +PortA,PA13,SWDIOJTMS,TIM16_CH1N,,I2C4_SCL,I2C1_SCL,IR_OUT,,USART3_CTS,,,TIM4_CH3,,,SAI1_SD_B,,EVENTOUT,,,, +PortA,PA14,SWCLKJTCK,LPTIM1_OUT,,I2C4_SMBA,I2C1_SDA,TIM8_CH2,TIM1_BKIN,USART2_TX,,,,,,SAI1_FS_B,,EVENTOUT,,,, +PortA,PA15,JTDI,TIM2_CH1,TIM8_CH1,,I2C1_SCL,SPI1_NSS,SPI3_NSS/I2S3_WS,USART2_RX,UART4_RTS_DE,TIM1_BKIN,,CAN3_TX,,HRTIM1_FLT2,TIM2_ETR,EVENTOUT,,,, +PortB,PB0,,,TIM3_CH3,,TIM8_CH2N,,TIM1_CH2N,,,,QUADSPI1_BK1_IO1,,,HRTIM1_FLT5,UCPD1_FRSTX,EVENTOUT,ADC3_IN12/ADC1_IN15,COMP4_INP,,OPAMP2_VINP/OPAMP3_VINP +PortB,PB1,,,TIM3_CH4,,TIM8_CH3N,,TIM1_CH3N,,COMP4_OUT,,QUADSPI1_BK1_IO0,,LPUART1_RTS_DE,HRTIM1_SCOUT,,EVENTOUT,ADC3_IN1/ADC1_IN12,COMP1_INP,,OPAMP3_VOUT/OPAMP6_VINM +PortB,PB2,RTC_OUT2,LPTIM1_OUT,TIM5_CH1,TIM20_CH1,I2C3_SMBA,,,,,,QUADSPI1_BK2_IO1,,,HRTIM1_SCIN,,EVENTOUT,ADC2_IN12,COMP4_INM,,OPAMP3_VINM +PortB,PB3,JTDOTRACESWO,TIM2_CH2,TIM4_ETR,USB_CRS_SYNC,TIM8_CH1N,SPI1_SCK,SPI3_SCK/I2S3_CK,USART2_TX,,,TIM3_ETR,CAN3_RX,HRTIM1_SCOUT,HRTIM1_EEV9,SAI1_SCK_B,EVENTOUT,,,, +PortB,PB4,JTRST,TIM16_CH1,TIM3_CH1,,TIM8_CH2N,SPI1_MISO,SPI3_MISO,USART2_RX,UART5_RTS_DE,,TIM17_BKIN,CAN3_TX,,HRTIM1_EEV7,SAI1_MCLK_B,EVENTOUT,,,, +PortB,PB5,,TIM16_BKIN,TIM3_CH2,TIM8_CH3N,I2C1_SMBA,SPI1_MOSI,SPI3_MOSI/I2S3_SD,USART2_CK,I2C3_SDA,CAN2_RX,TIM17_CH1,LPTIM1_IN1,SAI1_SD_B,HRTIM1_EEV6,UART5_CTS,EVENTOUT,,,, +PortB,PB6,,TIM16_CH1N,TIM4_CH1,,,TIM8_CH1,TIM8_ETR,USART1_TX,COMP4_OUT,CAN2_TX,TIM8_BKIN2,LPTIM1_ETR,HRTIM1_SCIN,HRTIM1_EEV4,SAI1_FS_B,EVENTOUT,,,, +PortB,PB7,,TIM17_CH1N,TIM4_CH2,I2C4_SDA,I2C1_SDA,TIM8_BKIN,,USART1_RX,COMP3_OUT,,TIM3_CH4,LPTIM1_IN2,FMC_NL,HRTIM1_EEV3,UART4_CTS,EVENTOUT,,,, +PortB,PB8,,TIM16_CH1,TIM4_CH3,SAI1_CK1,I2C1_SCL,,,USART3_RX,COMP1_OUT,CAN1_RX,TIM8_CH2,,TIM1_BKIN,HRTIM1_EEV8,SAI1_MCLK_A,EVENTOUT,,,, +PortB,PB9,,TIM17_CH1,TIM4_CH4,SAI1_D2,I2C1_SDA,,IR_OUT,USART3_TX,COMP2_OUT,CAN1_TX,TIM8_CH3,,TIM1_CH3N,HRTIM1_EEV5,SAI1_FS_A,EVENTOUT,,,, +PortB,PB10,,TIM2_CH3,,,,,,USART3_TX,LPUART1_RX,,QUADSPI1_CLK,,TIM1_BKIN,HRTIM1_FLT3,SAI1_SCK_A,EVENTOUT,,COMP5_INM,,OPAMP3_VINM/OPAMP4_VINM +PortB,PB11,,TIM2_CH4,,,,,,USART3_RX,LPUART1_TX,,QUADSPI1_BK1_NCS,,,HRTIM1_FLT4,,EVENTOUT,ADC12_IN14,COMP6_INP,,OPAMP4_VINP/OPAMP6_VOUT +PortB,PB12,,,TIM5_ETR,,I2C2_SMBA,SPI2_NSS/I2S2_WS,TIM1_BKIN,USART3_CK,LPUART1_RTS_DE,CAN2_RX,,,,HRTIM1_CHC1,,EVENTOUT,ADC4_IN3/ADC1_IN11,COMP7_INM,,OPAMP4_VOUT/OPAMP6_VINP +PortB,PB13,,,,,,SPI2_SCK/I2S2_CK,TIM1_CH1N,USART3_CTS,LPUART1_CTS,CAN2_TX,,,,HRTIM1_CHC2,,EVENTOUT,ADC3_IN5,COMP5_INP,,OPAMP3_VINP/OPAMP4_VINP/OPAMP6_VINP +PortB,PB14,,TIM15_CH1,,,,SPI2_MISO,TIM1_CH2N,USART3_RTS_DE,COMP4_OUT,,,,,HRTIM1_CHD1,,EVENTOUT,ADC4_IN4/ADC1_IN5,COMP7_INP,,OPAMP2_VINP/OPAMP5_VINP +PortB,PB15,RTC_REFIN,TIM15_CH2,TIM15_CH1N,COMP3_OUT,TIM1_CH3N,SPI2_MOSI/I2S2_SD,,,,,,,,HRTIM1_CHD2,,EVENTOUT,ADC4_IN5/ADC2_IN15,COMP6_INM,,OPAMP5_VINM +PortC,PC0,,LPTIM1_IN1,TIM1_CH1,,,,,,LPUART1_RX,,,,,,,EVENTOUT,ADC12_IN6,COMP3_INM, +PortC,PC1,,LPTIM1_OUT,TIM1_CH2,,,,,,LPUART1_TX,,QUADSPI1_BK2_IO0,,,SAI1_SD_A,,EVENTOUT,ADC12_IN7,COMP3_INP,, +PortC,PC2,,LPTIM1_IN2,TIM1_CH3,COMP3_OUT,,,TIM20_CH2,,,,QUADSPI1_BK2_IO1,,,,,EVENTOUT,ADC12_IN8,, +PortC,PC3,,LPTIM1_ETR,TIM1_CH4,SAI1_D1,,,TIM1_BKIN2,,,,QUADSPI1_BK2_IO2,,,SAI1_SD_A,,EVENTOUT,ADC12_IN9,,,OPAMP5_VINP +PortC,PC4,,,TIM1_ETR,,I2C2_SCL,,,USART1_TX,,,QUADSPI1_BK2_IO3,,,,,EVENTOUT,ADC2_IN5,,, +PortC,PC5,,,TIM15_BKIN,SAI1_D3,,,TIM1_CH4N,USART1_RX,,,,,,HRTIM1_EEV10,,EVENTOUT,ADC2_IN11,,,OPAMP1_VINM/OPAMP2_VINM +PortC,PC6,,,TIM3_CH1,HRTIM1_EEV10,TIM8_CH1,,I2S2_MCK,COMP6_OUT,I2C4_SCL,,,,,HRTIM1_CHF1,,EVENTOUT,,,, +PortC,PC7,,,TIM3_CH2,HRTIM1_FLT5,TIM8_CH2,,I2S3_MCK,COMP5_OUT,I2C4_SDA,,,,,HRTIM1_CHF2,,EVENTOUT,,,, +PortC,PC8,,,TIM3_CH3,HRTIM1_CHE1,TIM8_CH3,,TIM20_CH3,COMP7_OUT,I2C3_SCL,,,,,,,EVENTOUT,,,, +PortC,PC9,,,TIM3_CH4,HRTIM1_CHE2,TIM8_CH4,I2SCKIN,TIM8_BKIN2,,I2C3_SDA,,,,,,,EVENTOUT,,,, +PortC,PC10,,,,,TIM8_CH1N,UART4_TX,SPI3_SCK/I2S3_CK,USART3_TX,,,,,,HRTIM1_FLT6,,EVENTOUT,,,, +PortC,PC11,,,,HRTIM1_EEV2,TIM8_CH2N,UART4_RX,SPI3_MISO,USART3_RX,I2C3_SDA,,,,,,,EVENTOUT,,,, +PortC,PC12,,TIM5_CH2,,HRTIM1_EEV1,TIM8_CH3N,UART5_TX,SPI3_MOSI/I2S3_SD,USART3_CK,,,,,,,UCPD1_FRSTX,EVENTOUT,,,, +PortC,PC13,,,TIM1_BKIN,,TIM1_CH1N,,TIM8_CH4N,,,,,,,,,EVENTOUT,,,, +PortC,PC14,,,,,,,,,,,,,,,,EVENTOUT,,,, +PortC,PC15,,,,,,,,,,,,,,,,EVENTOUT,,,, +PortD,PD0,,,,,,,TIM8_CH4N,,,CAN1_RX,,,FMC_D2,,,EVENTOUT,,,, +PortD,PD1,,,,,TIM8_CH4,,TIM8_BKIN2,,,CAN1_TX,,,FMC_D3,,,EVENTOUT,,,, +PortD,PD2,,,TIM3_ETR,,TIM8_BKIN,UART5_RX,,,,,,,,,,EVENTOUT,,,, +PortD,PD3,,,TIM2_CH1/TIM2_ETR,,,,,USART2_CTS,,,QUADSPI1_BK2_NCS,,FMC_CLK,,,EVENTOUT,,,, +PortD,PD4,,,TIM2_CH2,,,,,USART2_RTS_DE,,,QUADSPI1_BK2_IO0,,FMC_NOE,,,EVENTOUT,,,, +PortD,PD5,,,,,,,,USART2_TX,,,QUADSPI1_BK2_IO1,,FMC_NWE,,,EVENTOUT,,,, +PortD,PD6,,,TIM2_CH4,SAI1_D1,,,,USART2_RX,,,QUADSPI1_BK2_IO2,,FMC_NWAIT,SAI1_SD_A,,EVENTOUT,,,, +PortD,PD7,,,TIM2_CH3,,,,,USART2_CK,,,QUADSPI1_BK2_IO3,,FMC_NCE/FMC_NE1,,,EVENTOUT,,,, +PortD,PD8,,,,,,,,USART3_TX,,,,,FMC_D13,,,EVENTOUT,ADC4_IN12/ADC5_IN12,,,OPAMP4_VINM +PortD,PD9,,,,,,,,USART3_RX,,,,,FMC_D14,,,EVENTOUT,ADC4_IN13/ADC5_IN13,,,OPAMP6_VINP +PortD,PD10,,,,,,,,USART3_CK,,,,,FMC_D15,,,EVENTOUT,ADC345_IN7,COMP6_INM,, +PortD,PD11,,TIM5_ETR,,,I2C4_SMBA,,,USART3_CTS,,,,,FMC_A16,,,EVENTOUT,ADC345_IN8,COMP6_INP,,OPAMP4_VINP +PortD,PD12,,,TIM4_CH1,,,,,USART3_RTS_DE,,,,,FMC_A17,,,EVENTOUT,ADC345_IN9,COMP5_INP,,OPAMP5_VINP +PortD,PD13,,,TIM4_CH2,,,,,,,,,,FMC_A18,,,EVENTOUT,ADC345_IN10,COMP5_INM,, +PortD,PD14,,,TIM4_CH3,,,,,,,,,,FMC_D0,,,EVENTOUT,ADC345_IN11,COMP7_INP,,OPAMP2_VINP +PortD,PD15,,,TIM4_CH4,,,,SPI2_NSS,,,,,,FMC_D1,,,EVENTOUT,,COMP7_INM,, +PortE,PE0,,,TIM4_ETR,TIM20_CH4N,TIM16_CH1,,TIM20_ETR,USART1_TX,,CAN1_RXFD,,,FMC_NBL0,,,EVENTOUT,,,, +PortE,PE1,,,,,TIM17_CH1,,TIM20_CH4,USART1_RX,,,,,FMC_NBL1,,,EVENTOUT,,,, +PortE,PE2,TRACECK,,TIM3_CH1,SAI1_CK1,,SPI4_SCK,TIM20_CH1,,,,,,FMC_A23,SAI1_MCLK_A,,EVENTOUT,,,, +PortE,PE3,TRACED0,,TIM3_CH2,,,SPI4_NSS,TIM20_CH2,,,,,,FMC_A19,SAI1_SD_B,,EVENTOUT,,,, +PortE,PE4,TRACED1,,TIM3_CH3,SAI1_D2,,SPI4_NSS,TIM20_CH1N,,,,,,FMC_A20,SAI1_FS_A,,EVENTOUT,,,, +PortE,PE5,TRACED2,,TIM3_CH4,SAI1_CK2,,SPI4_MISO,TIM20_CH2N,,,,,,FMC_A21,SAI1_SCK_A,,EVENTOUT,,,, +PortE,PE6,TRACED3,,,SAI1_D1,,SPI4_MOSI,TIM20_CH3N,,,,,,FMC_A22,SAI1_SD_A,,EVENTOUT,,,, +PortE,PE7,,,TIM1_ETR,,,,,,,,,,FMC_D4,SAI1_SD_B,,EVENTOUT,ADC3_IN4,COMP4_INP,, +PortE,PE8,,TIM5_CH3,TIM1_CH1N,,,,,,,,,,FMC_D5,SAI1_SCK_B,,EVENTOUT,ADC345_IN6,COMP4_INM,, +PortE,PE9,,TIM5_CH4,TIM1_CH1,,,,,,,,,,FMC_D6,SAI1_FS_B,,EVENTOUT,ADC3_IN2,,, +PortE,PE10,,,TIM1_CH2N,,,,,,,,QUADSPI1_CLK,,FMC_D7,SAI1_MCLK_B,,EVENTOUT,ADC345_IN14,,, +PortE,PE11,,,TIM1_CH2,,,SPI4_NSS,,,,,QUADSPI1_BK1_NCS,,FMC_D8,,,EVENTOUT,ADC345_IN15,,, +PortE,PE12,,,TIM1_CH3N,,,SPI4_SCK,,,,,QUADSPI1_BK1_IO0,,FMC_D9,,,EVENTOUT,ADC345_IN16,,, +PortE,PE13,,,TIM1_CH3,,,SPI4_MISO,,,,,QUADSPI1_BK1_IO1,,FMC_D10,,,EVENTOUT,ADC3_IN3,,, +PortE,PE14,,,TIM1_CH4,,,SPI4_MOSI,TIM1_BKIN2,,,,QUADSPI1_BK1_IO2,,FMC_D11,,,EVENTOUT,ADC4_IN1,,, +PortE,PE15,,,TIM1_BKIN,,,,TIM1_CH4N,USART3_RX,,,QUADSPI1_BK1_IO3,,FMC_D12,,,EVENTOUT,ADC4_IN2,,, +PortF,PF0,,,,,I2C2_SDA,SPI2_NSS/I2S2_WS,TIM1_CH3N,,,,,,,,,EVENTOUT,ADC1_IN10,,, +PortF,PF1,,,,,,SPI2_SCK/I2S2_CK,,,,,,,,,,EVENTOUT,ADC2_IN10,COMP3_INM,, +PortF,PF2,,,TIM20_CH3,,I2C2_SMBA,,,,,,,,FMC_A2,,,EVENTOUT,,,, +PortF,PF3,,,TIM20_CH4,,I2C3_SCL,,,,,,,,FMC_A3,,,EVENTOUT,,,, +PortF,PF4,,,COMP1_OUT,TIM20_CH1N,I2C3_SDA,,,,,,,,FMC_A4,,,EVENTOUT,,,, +PortF,PF5,,,TIM20_CH2N,,,,,,,,,,FMC_A5,,,EVENTOUT,,,, +PortF,PF6,,TIM5_ETR,TIM4_CH4,SAI1_SD_B,I2C2_SCL,,TIM5_CH1,USART3_RTS,,,QUADSPI1_BK1_IO3,,,,,EVENTOUT,,,, +PortF,PF7,,,TIM20_BKIN,,,,TIM5_CH2,,,,QUADSPI1_BK1_IO2,,FMC_A1,SAI1_MCLK_B,,EVENTOUT,,,, +PortF,PF8,,,TIM20_BKIN2,,,,TIM5_CH3,,,,QUADSPI1_BK1_IO0,,FMC_A24,SAI1_SCK_B,,EVENTOUT,,,, +PortF,PF9,,,TIM20_BKIN,TIM15_CH1,,SPI2_SCK,TIM5_CH4,,,,QUADSPI1_BK1_IO1,,FMC_A25,SAI1_FS_B,,EVENTOUT,,,, +PortF,PF10,,,TIM20_BKIN2,TIM15_CH2,,SPI2_SCK,,,,,QUADSPI1_CLK,,FMC_A0,SAI1_D3,,EVENTOUT,,,, +PortF,PF11,,,TIM20_ETR,,,,,,,,,,FMC_NE4,,,EVENTOUT,,,, +PortF,PF12,,,TIM20_CH1,,,,,,,,,,FMC_A6,,,EVENTOUT,,,, +PortF,PF13,,,TIM20_CH2,,I2C4_SMBA,,,,,,,,FMC_A7,,,EVENTOUT,,,, +PortF,PF14,,,TIM20_CH3,,I2C4_SCL,,,,,,,,FMC_A8,,,EVENTOUT,,,, +PortF,PF15,,,TIM20_CH4,,I2C4_SDA,,,,,,,,FMC_A9,,,EVENTOUT,,,, +PortG,PG0,,,TIM20_CH1N,,,,,,,,,,FMC_A10,,,EVENTOUT,,,, +PortG,PG1,,,TIM20_CH2N,,,,,,,,,,FMC_A11,,,EVENTOUT,,,, +PortG,PG2,,,TIM20_CH3N,,,SPI1_SCK,,,,,,,FMC_A12,,,EVENTOUT,,,, +PortG,PG3,,,TIM20_BKIN,,I2C4_SCL,SPI1_MISO,TIM20_CH4N,,,,,,FMC_A13,,,EVENTOUT,,,, +PortG,PG4,,,TIM20_BKIN2,,I2C4_SDA,SPI1_MOSI,,,,,,,FMC_A14,,,EVENTOUT,,,, +PortG,PG5,,,TIM20_ETR,,,SPI1_NSS,,,LPUART1_CTS,,,,FMC_A15,,,EVENTOUT,,,, +PortG,PG6,,,TIM20_BKIN,,I2C3_SMBA,,,,LPUART1_RTS_DE,,,,FMC_INT,,,EVENTOUT,,,, +PortG,PG7,,,,SAI1_CK1,I2C3_SCL,,,,LPUART1_TX,,,,FMC_INT,SAI1_MCLK_A,,EVENTOUT,,,, +PortG,PG8,,,,,I2C3_SDA,,,,LPUART1_RX,,,,FMC_NE3,,,EVENTOUT,,,, +PortG,PG9,,,,,,,SPI3_SCK,USART1_TX,,,,,FMC_NCE/FMC_NE2,,TIM15_CH1N,EVENTOUT,,,, +PortG,PG10,MCO,,,,,,,,,,,,,,,EVENTOUT diff --git a/ports/stm32/boards/stm32g4xx_hal_conf_base.h b/ports/stm32/boards/stm32g4xx_hal_conf_base.h new file mode 100644 index 0000000000..034d396539 --- /dev/null +++ b/ports/stm32/boards/stm32g4xx_hal_conf_base.h @@ -0,0 +1,131 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Damien P. George + * + * 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_STM32G4XX_HAL_CONF_BASE_H +#define MICROPY_INCLUDED_STM32G4XX_HAL_CONF_BASE_H + +// Include various HAL modules for convenience + +#include "stm32g4xx_hal_rcc.h" +#include "stm32g4xx_hal_gpio.h" +#include "stm32g4xx_hal_dma.h" +#include "stm32g4xx_hal_cortex.h" +#include "stm32g4xx_hal_adc.h" +#include "stm32g4xx_hal_comp.h" +#include "stm32g4xx_hal_cordic.h" +#include "stm32g4xx_hal_crc.h" +#include "stm32g4xx_hal_cryp.h" +#include "stm32g4xx_hal_dac.h" +#include "stm32g4xx_hal_exti.h" +#include "stm32g4xx_hal_fdcan.h" +#include "stm32g4xx_hal_flash.h" +#include "stm32g4xx_hal_fmac.h" +#include "stm32g4xx_hal_hrtim.h" +#include "stm32g4xx_hal_irda.h" +#include "stm32g4xx_hal_iwdg.h" +#include "stm32g4xx_hal_i2c.h" +#include "stm32g4xx_hal_i2s.h" +#include "stm32g4xx_hal_lptim.h" +#include "stm32g4xx_hal_nand.h" +#include "stm32g4xx_hal_nor.h" +#include "stm32g4xx_hal_opamp.h" +#include "stm32g4xx_hal_pcd.h" +#include "stm32g4xx_hal_pwr.h" +#include "stm32g4xx_hal_qspi.h" +#include "stm32g4xx_hal_rng.h" +#include "stm32g4xx_hal_rtc.h" +#include "stm32g4xx_hal_sai.h" +#include "stm32g4xx_hal_smartcard.h" +#include "stm32g4xx_hal_smbus.h" +#include "stm32g4xx_hal_spi.h" +#include "stm32g4xx_hal_sram.h" +#include "stm32g4xx_hal_tim.h" +#include "stm32g4xx_hal_uart.h" +#include "stm32g4xx_hal_usart.h" +#include "stm32g4xx_hal_wwdg.h" + +#include "stm32g4xx_ll_adc.h" +#include "stm32g4xx_ll_rtc.h" +#include "stm32g4xx_ll_usart.h" +#include "stm32g4xx_ll_lpuart.h" + +#define HAL_MODULE_ENABLED +#define HAL_ADC_MODULE_ENABLED +#define HAL_COMP_MODULE_ENABLED +#define HAL_CORDIC_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +#define HAL_CRC_MODULE_ENABLED +#define HAL_CRYP_MODULE_ENABLED +#define HAL_DAC_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_EXTI_MODULE_ENABLED +#define HAL_FDCAN_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_FMAC_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_HRTIM_MODULE_ENABLED +#define HAL_IRDA_MODULE_ENABLED +#define HAL_IWDG_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_I2S_MODULE_ENABLED +#define HAL_LPTIM_MODULE_ENABLED +#define HAL_NAND_MODULE_ENABLED +#define HAL_NOR_MODULE_ENABLED +#define HAL_OPAMP_MODULE_ENABLED +#define HAL_PCD_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_QSPI_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_RNG_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SAI_MODULE_ENABLED +#define HAL_SMARTCARD_MODULE_ENABLED +#define HAL_SMBUS_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_SRAM_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED +#define HAL_WWDG_MODULE_ENABLED + +// Oscillator values in Hz +#define HSI_VALUE (16000000) +#define HSI48_VALUE (48000000) +#define LSI_VALUE (32000) + +// SysTick priority +#define TICK_INT_PRIORITY (0x0F) + +// Miscellaneous HAL settings +#define USE_RTOS 0 +#define PREFETCH_ENABLE 0 +#define INSTRUCTION_CACHE_ENABLE 1 +#define DATA_CACHE_ENABLE 1 +#define USE_SPI_CRC 1 + +// HAL parameter assertions are disabled +#define assert_param(expr) ((void)0) + +#endif // MICROPY_INCLUDED_STM32G4XX_HAL_CONF_BASE_H diff --git a/ports/stm32/dac.c b/ports/stm32/dac.c index d51312aebc..b7fb0cbd70 100644 --- a/ports/stm32/dac.c +++ b/ports/stm32/dac.c @@ -101,7 +101,7 @@ STATIC uint32_t TIMx_Config(mp_obj_t timer) { } else if (tim->Instance == TIM4) { return DAC_TRIGGER_T4_TRGO; #endif - #if defined(TIM5) + #if defined(TIM5) && defined(DAC_TRIGGER_T5_TRGO) // G474 doesn't have this } else if (tim->Instance == TIM5) { return DAC_TRIGGER_T5_TRGO; #endif @@ -124,7 +124,7 @@ STATIC uint32_t TIMx_Config(mp_obj_t timer) { STATIC void dac_deinit(uint32_t dac_channel) { DAC->CR &= ~(DAC_CR_EN1 << dac_channel); - #if defined(STM32H7) || defined(STM32L4) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32L4) DAC->MCR = (DAC->MCR & ~(DAC_MCR_MODE1_Msk << dac_channel)) | (DAC_OUTPUTBUFFER_DISABLE << dac_channel); #else DAC->CR |= DAC_CR_BOFF1 << dac_channel; @@ -142,7 +142,7 @@ STATIC void dac_config_channel(uint32_t dac_channel, uint32_t trig, uint32_t out DAC->CR &= ~(DAC_CR_EN1 << dac_channel); uint32_t cr_off = DAC_CR_DMAEN1 | DAC_CR_MAMP1 | DAC_CR_WAVE1 | DAC_CR_TSEL1 | DAC_CR_TEN1; uint32_t cr_on = trig; - #if defined(STM32H7) || defined(STM32L4) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32L4) DAC->MCR = (DAC->MCR & ~(DAC_MCR_MODE1_Msk << dac_channel)) | (outbuf << dac_channel); #else cr_off |= DAC_CR_BOFF1; @@ -259,7 +259,7 @@ STATIC mp_obj_t pyb_dac_init_helper(pyb_dac_obj_t *self, size_t n_args, const mp __DAC_CLK_ENABLE(); #elif defined(STM32H7) __HAL_RCC_DAC12_CLK_ENABLE(); - #elif defined(STM32F0) || defined(STM32L4) + #elif defined(STM32F0) || defined(STM32G4) || defined(STM32L4) __HAL_RCC_DAC1_CLK_ENABLE(); #else #error Unsupported Processor diff --git a/ports/stm32/dma.c b/ports/stm32/dma.c index b376ee23b5..dc706e68aa 100644 --- a/ports/stm32/dma.c +++ b/ports/stm32/dma.c @@ -74,7 +74,7 @@ typedef union { struct _dma_descr_t { #if defined(STM32F4) || defined(STM32F7) || defined(STM32H7) DMA_Stream_TypeDef *instance; - #elif defined(STM32F0) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) + #elif defined(STM32F0) || defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) DMA_Channel_TypeDef *instance; #else #error "Unsupported Processor" @@ -89,7 +89,7 @@ struct _dma_descr_t { static const DMA_InitTypeDef dma_init_struct_spi_i2c = { #if defined(STM32F4) || defined(STM32F7) .Channel = 0, - #elif defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) .Request = 0, #endif .Direction = 0, @@ -137,7 +137,7 @@ static const DMA_InitTypeDef dma_init_struct_i2s = { static const DMA_InitTypeDef dma_init_struct_sdio = { #if defined(STM32F4) || defined(STM32F7) .Channel = 0, - #elif defined(STM32L0) || defined(STM32L4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) .Request = 0, #endif .Direction = 0, @@ -147,7 +147,7 @@ static const DMA_InitTypeDef dma_init_struct_sdio = { .MemDataAlignment = DMA_MDATAALIGN_WORD, #if defined(STM32F4) || defined(STM32F7) .Mode = DMA_PFCTRL, - #elif defined(STM32L0) || defined(STM32L4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) .Mode = DMA_NORMAL, #endif .Priority = DMA_PRIORITY_VERY_HIGH, @@ -165,7 +165,7 @@ static const DMA_InitTypeDef dma_init_struct_sdio = { static const DMA_InitTypeDef dma_init_struct_dac = { #if defined(STM32F4) || defined(STM32F7) .Channel = 0, - #elif defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) .Request = 0, #endif .Direction = 0, @@ -501,6 +501,86 @@ static const uint8_t dma_irqn[NSTREAM] = { DMA2_Channel7_IRQn, }; +#elif defined(STM32G4) + +#define NCONTROLLERS (2) + +#if defined(STM32G431xx) || defined(STM32G441xx) +#define NSTREAMS_PER_CONTROLLER (6) // Cat 2 devices = 6, Cat 3 = 8 +#else +#define NSTREAMS_PER_CONTROLLER (8) // Cat 2 devices = 6, Cat 3 = 8 +#endif +#define NSTREAM (NCONTROLLERS * NSTREAMS_PER_CONTROLLER) + +#define DMA_SUB_INSTANCE_AS_UINT8(dma_request) (dma_request) +#if defined(STM32G431xx) || defined(STM32G441xx) +#define DMA1_ENABLE_MASK (0x004f) // Bits in dma_enable_mask corresponding to DMA1 +#define DMA2_ENABLE_MASK (0x0fc0) // Bits in dma_enable_mask corresponding to DMA2 +#else +#define DMA1_ENABLE_MASK (0x00Ff) // Bits in dma_enable_mask corresponding to DMA1 +#define DMA2_ENABLE_MASK (0xff00) // Bits in dma_enable_mask corresponding to DMA2 +#endif + +// These descriptors are ordered by DMAx_Channel number, and within a channel by request +// number. The duplicate streams are ok as long as they aren't used at the same time. + +// DMA1 streams +const dma_descr_t dma_SPI_1_RX = { DMA1_Channel1, DMA_REQUEST_SPI1_RX, dma_id_0, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_SPI_1_TX = { DMA1_Channel2, DMA_REQUEST_SPI1_TX, dma_id_1, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_SPI_2_RX = { DMA1_Channel1, DMA_REQUEST_SPI2_RX, dma_id_0, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_SPI_2_TX = { DMA1_Channel2, DMA_REQUEST_SPI2_TX, dma_id_1, &dma_init_struct_spi_i2c }; + +const dma_descr_t dma_I2C_1_RX = { DMA1_Channel3, DMA_REQUEST_I2C1_RX, dma_id_2, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_I2C_1_TX = { DMA1_Channel4, DMA_REQUEST_I2C1_TX, dma_id_3, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_I2C_2_RX = { DMA1_Channel3, DMA_REQUEST_I2C2_RX, dma_id_2, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_I2C_2_TX = { DMA1_Channel4, DMA_REQUEST_I2C2_TX, dma_id_3, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_I2C_3_RX = { DMA1_Channel3, DMA_REQUEST_I2C3_RX, dma_id_2, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_I2C_3_TX = { DMA1_Channel4, DMA_REQUEST_I2C3_TX, dma_id_3, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_UART_3_RX = { DMA1_Channel3, DMA_REQUEST_USART3_RX, dma_id_2, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_UART_3_TX = { DMA1_Channel4, DMA_REQUEST_USART3_TX, dma_id_3, &dma_init_struct_spi_i2c }; + +#if MICROPY_HW_ENABLE_DAC +const dma_descr_t dma_DAC_1_TX = { DMA1_Channel5, DMA_REQUEST_DAC1_CHANNEL1, dma_id_4, &dma_init_struct_dac }; +const dma_descr_t dma_DAC_2_TX = { DMA1_Channel6, DMA_REQUEST_DAC1_CHANNEL2, dma_id_5, &dma_init_struct_dac }; +#endif +#if !defined(STM32G431xx) && !defined(STM32G441xx) +// channel 7 & 8 +#endif + +// DMA2 streams +const dma_descr_t dma_UART_1_RX = { DMA2_Channel1, DMA_REQUEST_USART1_RX, dma_id_6, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_UART_1_TX = { DMA2_Channel2, DMA_REQUEST_USART1_TX, dma_id_7, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_LPUART_1_RX = { DMA2_Channel3, DMA_REQUEST_LPUART1_RX, dma_id_8, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_LPUART_1_TX = { DMA2_Channel4, DMA_REQUEST_LPUART1_TX, dma_id_9, &dma_init_struct_spi_i2c }; +const dma_descr_t dma_ADC_1 = { DMA2_Channel5, DMA_REQUEST_ADC1, dma_id_10, NULL }; +const dma_descr_t dma_MEM_2_MEM = { DMA2_Channel6, DMA_REQUEST_MEM2MEM, dma_id_11, NULL }; +#if !defined(STM32G431xx) && !defined(STM32G441xx) +// channel 7 & 8 +#endif + +static const uint8_t dma_irqn[NSTREAM] = { + DMA1_Channel1_IRQn, + DMA1_Channel2_IRQn, + DMA1_Channel3_IRQn, + DMA1_Channel4_IRQn, + DMA1_Channel5_IRQn, + DMA1_Channel6_IRQn, + #if !defined(STM32G431xx) && !defined(STM32G441xx) + DMA1_Channel7_IRQn, + DMA1_Channel8_IRQn, + #endif + DMA2_Channel1_IRQn, + DMA2_Channel2_IRQn, + DMA2_Channel3_IRQn, + DMA2_Channel4_IRQn, + DMA2_Channel5_IRQn, + DMA2_Channel6_IRQn, + #if !defined(STM32G431xx) && !defined(STM32G441xx) + DMA2_Channel7_IRQn, + DMA2_Channel8_IRQn, + #endif +}; + #elif defined(STM32H7) #define NCONTROLLERS (2) @@ -742,6 +822,125 @@ void DMA2_Stream7_IRQHandler(void) { IRQ_EXIT(DMA2_Stream7_IRQn); } +#elif defined(STM32G4) + +void DMA1_Channel1_IRQHandler(void) { + IRQ_ENTER(DMA1_Channel1_IRQn); + if (dma_handle[dma_id_0] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_0]); + } + IRQ_EXIT(DMA1_Channel1_IRQn); +} +void DMA1_Channel2_IRQHandler(void) { + IRQ_ENTER(DMA1_Channel2_IRQn); + if (dma_handle[dma_id_1] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_1]); + } + IRQ_EXIT(DMA1_Channel2_IRQn); +} +void DMA1_Channel3_IRQHandler(void) { + IRQ_ENTER(DMA1_Channel3_IRQn); + if (dma_handle[dma_id_2] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_2]); + } + IRQ_EXIT(DMA1_Channel3_IRQn); +} +void DMA1_Channel4_IRQHandler(void) { + IRQ_ENTER(DMA1_Channel4_IRQn); + if (dma_handle[dma_id_3] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_3]); + } + IRQ_EXIT(DMA1_Channel4_IRQn); +} +void DMA1_Channel5_IRQHandler(void) { + IRQ_ENTER(DMA1_Channel5_IRQn); + if (dma_handle[dma_id_4] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_4]); + } + IRQ_EXIT(DMA1_Channel5_IRQn); +} +void DMA1_Channel6_IRQHandler(void) { + IRQ_ENTER(DMA1_Channel6_IRQn); + if (dma_handle[dma_id_5] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_5]); + } + IRQ_EXIT(DMA1_Channel6_IRQn); +} +#if !(defined(STM32G431xx) || defined(STM32G441xx)) +void DMA1_Channel7_IRQHandler(void) { + IRQ_ENTER(DMA1_Channel7_IRQn); + if (dma_handle[dma_id_12] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_12]); + } + IRQ_EXIT(DMA1_Channel7_IRQn); +} +void DMA1_Channel8_IRQHandler(void) { + IRQ_ENTER(DMA1_Channel8_IRQn); + if (dma_handle[dma_id_13] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_13]); + } + IRQ_EXIT(DMA1_Channel8_IRQn); +} +#endif +void DMA2_Channel1_IRQHandler(void) { + IRQ_ENTER(DMA2_Channel1_IRQn); + if (dma_handle[dma_id_6] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_6]); + } + IRQ_EXIT(DMA2_Channel1_IRQn); +} +void DMA2_Channel2_IRQHandler(void) { + IRQ_ENTER(DMA2_Channel2_IRQn); + if (dma_handle[dma_id_7] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_7]); + } + IRQ_EXIT(DMA2_Channel2_IRQn); +} +void DMA2_Channel3_IRQHandler(void) { + IRQ_ENTER(DMA2_Channel3_IRQn); + if (dma_handle[dma_id_8] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_8]); + } + IRQ_EXIT(DMA2_Channel3_IRQn); +} +void DMA2_Channel4_IRQHandler(void) { + IRQ_ENTER(DMA2_Channel4_IRQn); + if (dma_handle[dma_id_9] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_9]); + } + IRQ_EXIT(DMA2_Channel4_IRQn); +} +void DMA2_Channel5_IRQHandler(void) { + IRQ_ENTER(DMA2_Channel5_IRQn); + if (dma_handle[dma_id_10] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_10]); + } + IRQ_EXIT(DMA2_Channel5_IRQn); +} +void DMA2_Channel6_IRQHandler(void) { + IRQ_ENTER(DMA2_Channel6_IRQn); + if (dma_handle[dma_id_11] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_11]); + } + IRQ_EXIT(DMA2_Channel6_IRQn); +} +#if !(defined(STM32G431xx) || defined(STM32G441xx)) +void DMA2_Channel7_IRQHandler(void) { + IRQ_ENTER(DMA2_Channel7_IRQn); + if (dma_handle[dma_id_14] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_14]); + } + IRQ_EXIT(DMA2_Channel7_IRQn); +} +void DMA2_Channel8_IRQHandler(void) { + IRQ_ENTER(DMA2_Channel8_IRQn); + if (dma_handle[dma_id_15] != NULL) { + HAL_DMA_IRQHandler(dma_handle[dma_id_15]); + } + IRQ_EXIT(DMA2_Channel8_IRQn); +} +#endif + #elif defined(STM32L0) void DMA1_Channel1_IRQHandler(void) { @@ -909,6 +1108,9 @@ static void dma_enable_clock(dma_id_t dma_id) { if (dma_id < NSTREAMS_PER_CONTROLLER) { if (((old_enable_mask & DMA1_ENABLE_MASK) == 0) && !DMA1_IS_CLK_ENABLED()) { __HAL_RCC_DMA1_CLK_ENABLE(); + #if defined(STM32G4) + __HAL_RCC_DMAMUX1_CLK_ENABLE(); + #endif // We just turned on the clock. This means that anything stored // in dma_last_channel (for DMA1) needs to be invalidated. @@ -923,6 +1125,9 @@ static void dma_enable_clock(dma_id_t dma_id) { if (((old_enable_mask & DMA2_ENABLE_MASK) == 0) && !DMA2_IS_CLK_ENABLED()) { __HAL_RCC_DMA2_CLK_ENABLE(); + #if defined(STM32G4) + __HAL_RCC_DMAMUX1_CLK_ENABLE(); + #endif // We just turned on the clock. This means that anything stored // in dma_last_channel (for DMA2) needs to be invalidated. @@ -947,7 +1152,7 @@ void dma_init_handle(DMA_HandleTypeDef *dma, const dma_descr_t *dma_descr, uint3 dma->Instance = dma_descr->instance; dma->Init = *dma_descr->init; dma->Init.Direction = dir; - #if defined(STM32L0) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) dma->Init.Request = dma_descr->sub_instance; #else #if !defined(STM32F0) @@ -974,7 +1179,7 @@ void dma_init(DMA_HandleTypeDef *dma, const dma_descr_t *dma_descr, uint32_t dir dma_enable_clock(dma_id); - #if defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) // Always reset and configure the H7 and L0/L4 DMA peripheral // (dma->State is set to HAL_DMA_STATE_RESET by memset above) // TODO: understand how L0/L4 DMA works so this is not needed @@ -1070,10 +1275,23 @@ static void dma_idle_handler(uint32_t tick) { dma_idle.counter[controller] = 0; if (controller == 0) { __HAL_RCC_DMA1_CLK_DISABLE(); + #if defined(STM32G4) + #if defined(DMA2) + if (__HAL_RCC_DMA2_IS_CLK_DISABLED()) + #endif + { + __HAL_RCC_DMAMUX1_CLK_DISABLE(); + } + #endif } #if defined(DMA2) else { __HAL_RCC_DMA2_CLK_DISABLE(); + #if defined(STM32G4) + if (__HAL_RCC_DMA1_IS_CLK_DISABLED()) { + __HAL_RCC_DMAMUX1_CLK_DISABLE(); + } + #endif } #endif } else { @@ -1085,7 +1303,7 @@ static void dma_idle_handler(uint32_t tick) { } } -#if defined(STM32F0) || defined(STM32L0) || defined(STM32L4) +#if defined(STM32F0) || defined(STM32G4) || defined(STM32L0) || defined(STM32L4) void dma_nohal_init(const dma_descr_t *descr, uint32_t config) { DMA_Channel_TypeDef *dma = descr->instance; @@ -1108,6 +1326,9 @@ void dma_nohal_init(const dma_descr_t *descr, uint32_t config) { } else { __HAL_DMA2_REMAP(descr->sub_instance); } + #elif defined(STM32G4) + uint32_t *dmamux_ctrl = (void *)(DMAMUX1_Channel0_BASE + 0x04 * descr->id); + *dmamux_ctrl = (*dmamux_ctrl & ~(0x7f)) | descr->sub_instance; #else DMA_Request_TypeDef *dma_ctrl = (void *)(((uint32_t)dma & ~0xff) + (DMA1_CSELR_BASE - DMA1_BASE)); // DMA1_CSELR or DMA2_CSELR uint32_t channel_number = (((uint32_t)dma & 0xff) - 0x08) / 20; // 0 through 6 diff --git a/ports/stm32/dma.h b/ports/stm32/dma.h index 00200bae46..29d5c3d2eb 100644 --- a/ports/stm32/dma.h +++ b/ports/stm32/dma.h @@ -62,6 +62,29 @@ extern const dma_descr_t dma_I2S_1_TX; extern const dma_descr_t dma_I2S_2_RX; extern const dma_descr_t dma_I2S_2_TX; +#elif defined(STM32G4) + +extern const dma_descr_t dma_SPI_1_RX; +extern const dma_descr_t dma_SPI_1_TX; +extern const dma_descr_t dma_SPI_2_RX; +extern const dma_descr_t dma_SPI_2_TX; +extern const dma_descr_t dma_I2C_1_RX; +extern const dma_descr_t dma_I2C_1_TX; +extern const dma_descr_t dma_I2C_2_RX; +extern const dma_descr_t dma_I2C_2_TX; +extern const dma_descr_t dma_I2C_3_RX; +extern const dma_descr_t dma_I2C_3_TX; +extern const dma_descr_t dma_UART_3_RX; +extern const dma_descr_t dma_UART_3_TX; +extern const dma_descr_t dma_DAC_1_TX; +extern const dma_descr_t dma_DAC_2_TX; +extern const dma_descr_t dma_UART_1_RX; +extern const dma_descr_t dma_UART_1_TX; +extern const dma_descr_t dma_LPUART_1_RX; +extern const dma_descr_t dma_LPUART_1_TX; +extern const dma_descr_t dma_ADC_1; +extern const dma_descr_t dma_MEM_2_MEM; + #elif defined(STM32L0) extern const dma_descr_t dma_SPI_1_RX; diff --git a/ports/stm32/extint.c b/ports/stm32/extint.c index 699bc60040..bb26b00dde 100644 --- a/ports/stm32/extint.c +++ b/ports/stm32/extint.c @@ -91,7 +91,7 @@ #define EXTI_SWIER_BB(line) (*(__IO uint32_t *)(PERIPH_BB_BASE + ((EXTI_OFFSET + offsetof(EXTI_TypeDef, SWIER)) * 32) + ((line) * 4))) #endif -#if defined(STM32L4) || defined(STM32WB) +#if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) // The L4 MCU supports 40 Events/IRQs lines of the type configurable and direct. // Here we only support configurable line types. Details, see page 330 of RM0351, Rev 1. // The USB_FS_WAKUP event is a direct type and there is no support for it. @@ -138,6 +138,10 @@ STATIC mp_obj_t pyb_extint_callback_arg[EXTI_NUM_VECTORS]; #define OTG_FS_WKUP_IRQn 42 // Some MCUs don't have FS IRQ, but we want a value to put in our table #endif +#if defined(STM32G4) +#define TAMP_STAMP_IRQn RTC_TAMP_LSECSS_IRQn +#endif + STATIC const uint8_t nvic_irq_channel[EXTI_NUM_VECTORS] = { #if defined(STM32F0) || defined(STM32L0) @@ -178,7 +182,7 @@ STATIC const uint8_t nvic_irq_channel[EXTI_NUM_VECTORS] = { TAMP_STAMP_LSECSS_IRQn, RTC_WKUP_IRQn, #else - #if defined(STM32L4) + #if defined(STM32G4) || defined(STM32L4) PVD_PVM_IRQn, #else PVD_IRQn, @@ -381,7 +385,7 @@ void extint_enable(uint line) { if (pyb_extint_mode[line] == EXTI_Mode_Interrupt) { #if defined(STM32H7) EXTI_D1->IMR1 |= (1 << line); - #elif defined(STM32WB) + #elif defined(STM32G4) || defined(STM32WB) EXTI->IMR1 |= (1 << line); #else EXTI->IMR |= (1 << line); @@ -389,7 +393,7 @@ void extint_enable(uint line) { } else { #if defined(STM32H7) EXTI_D1->EMR1 |= (1 << line); - #elif defined(STM32WB) + #elif defined(STM32G4) || defined(STM32WB) EXTI->EMR1 |= (1 << line); #else EXTI->EMR |= (1 << line); @@ -415,7 +419,7 @@ void extint_disable(uint line) { #if defined(STM32H7) EXTI_D1->IMR1 &= ~(1 << line); EXTI_D1->EMR1 &= ~(1 << line); - #elif defined(STM32WB) + #elif defined(STM32G4) || defined(STM32WB) EXTI->IMR1 &= ~(1 << line); EXTI->EMR1 &= ~(1 << line); #else @@ -437,7 +441,7 @@ void extint_swint(uint line) { return; } // we need 0 to 1 transition to trigger the interrupt - #if defined(STM32L4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB) EXTI->SWIER1 &= ~(1 << line); EXTI->SWIER1 |= (1 << line); #else @@ -515,7 +519,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_swint_obj, extint_obj_swint); /// \classmethod regs() /// Dump the values of the EXTI registers. STATIC mp_obj_t extint_regs(void) { - #if defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) printf("EXTI_IMR1 %08x\n", (unsigned int)EXTI->IMR1); printf("EXTI_IMR2 %08x\n", (unsigned int)EXTI->IMR2); printf("EXTI_EMR1 %08x\n", (unsigned int)EXTI->EMR1); diff --git a/ports/stm32/extint.h b/ports/stm32/extint.h index 907af53dc2..0cdf5024a0 100644 --- a/ports/stm32/extint.h +++ b/ports/stm32/extint.h @@ -43,7 +43,7 @@ #endif #define EXTI_ETH_WAKEUP (19) #define EXTI_USB_OTG_HS_WAKEUP (20) -#if defined(STM32F0) || defined(STM32L4) +#if defined(STM32F0) || defined(STM32G4) || defined(STM32L4) #define EXTI_RTC_TIMESTAMP (19) #define EXTI_RTC_WAKEUP (20) #elif defined(STM32H7) || defined(STM32WB) diff --git a/ports/stm32/flash.c b/ports/stm32/flash.c index b926679f9f..eeeab52049 100644 --- a/ports/stm32/flash.c +++ b/ports/stm32/flash.c @@ -97,7 +97,7 @@ static const flash_layout_t flash_layout[] = { }; #endif -#elif defined(STM32L0) || defined(STM32L4) || defined(STM32WB) +#elif defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) static const flash_layout_t flash_layout[] = { { (uint32_t)FLASH_BASE, (uint32_t)FLASH_PAGE_SIZE, 512 }, @@ -126,12 +126,20 @@ static uint32_t get_bank(uint32_t addr) { if (addr < (FLASH_BASE + FLASH_BANK_SIZE)) { return FLASH_BANK_1; } else { + #if defined(FLASH_OPTR_DBANK) return FLASH_BANK_2; + #else + return 0; + #endif } } else { // bank swap if (addr < (FLASH_BASE + FLASH_BANK_SIZE)) { + #if defined(FLASH_OPTR_DBANK) return FLASH_BANK_2; + #else + return 0; + #endif } else { return FLASH_BANK_1; } @@ -157,6 +165,25 @@ static uint32_t get_page(uint32_t addr) { return (addr - FLASH_BASE) / FLASH_PAGE_SIZE; } +#elif defined(STM32G4) + +static uint32_t get_page(uint32_t addr) { + return (addr - FLASH_BASE) / FLASH_PAGE_SIZE; +} + +static uint32_t get_bank(uint32_t addr) { + // no bank swap + if (addr < (FLASH_BASE + FLASH_BANK_SIZE)) { + return FLASH_BANK_1; + } else { + #if defined(FLASH_OPTR_DBANK) + return FLASH_BANK_2; + #else + return 0; + #endif + } +} + #endif bool flash_is_valid_addr(uint32_t addr) { @@ -225,6 +252,12 @@ int flash_erase(uint32_t flash_dest, uint32_t num_word32) { EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES; EraseInitStruct.PageAddress = flash_dest; EraseInitStruct.NbPages = (4 * num_word32 + FLASH_PAGE_SIZE - 4) / FLASH_PAGE_SIZE; + #elif defined(STM32G4) + __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_ALL_ERRORS); + EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES; + EraseInitStruct.Page = get_page(flash_dest); + EraseInitStruct.Banks = get_bank(flash_dest); + EraseInitStruct.NbPages = (4 * num_word32 + FLASH_PAGE_SIZE - 4) / FLASH_PAGE_SIZE; #elif defined(STM32L0) __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR); EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES; @@ -258,7 +291,7 @@ int flash_erase(uint32_t flash_dest, uint32_t num_word32) { #else EraseInitStruct.VoltageRange = 0; // unused parameter on STM32H7A3/B3 #endif - #if defined(STM32H7) + #if defined(STM32G4) || defined(STM32H7) EraseInitStruct.Banks = get_bank(flash_dest); #endif EraseInitStruct.Sector = flash_get_sector_info(flash_dest, NULL, NULL); @@ -337,7 +370,7 @@ int flash_write(uint32_t flash_dest, const uint32_t *src, uint32_t num_word32) { HAL_StatusTypeDef status = HAL_OK; - #if defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) // program the flash uint64 by uint64 for (int i = 0; i < num_word32 / 2; i++) { diff --git a/ports/stm32/machine_adc.c b/ports/stm32/machine_adc.c index 8480bff53e..21b35cdcdb 100644 --- a/ports/stm32/machine_adc.c +++ b/ports/stm32/machine_adc.c @@ -28,7 +28,7 @@ #include "py/mphal.h" #include "adc.h" -#if defined(STM32F0) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) +#if defined(STM32F0) || defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) #define ADC_V2 (1) #else #define ADC_V2 (0) @@ -45,6 +45,8 @@ #if defined(STM32F0) || defined(STM32L0) #define ADC_STAB_DELAY_US (1) #define ADC_TEMPSENSOR_DELAY_US (10) +#elif defined(STM32G4) +#define ADC_STAB_DELAY_US (1) // TODO: Check if this is enough #elif defined(STM32L4) #define ADC_STAB_DELAY_US (10) #elif defined(STM32WB) @@ -57,6 +59,9 @@ #elif defined(STM32F4) || defined(STM32F7) #define ADC_SAMPLETIME_DEFAULT ADC_SAMPLETIME_15CYCLES #define ADC_SAMPLETIME_DEFAULT_INT ADC_SAMPLETIME_480CYCLES +#elif defined(STM32G4) +#define ADC_SAMPLETIME_DEFAULT ADC_SAMPLETIME_12CYCLES_5 +#define ADC_SAMPLETIME_DEFAULT_INT ADC_SAMPLETIME_247CYCLES_5 #elif defined(STM32H7) #define ADC_SAMPLETIME_DEFAULT ADC_SAMPLETIME_8CYCLES_5 #define ADC_SAMPLETIME_DEFAULT_INT ADC_SAMPLETIME_387CYCLES_5 @@ -105,7 +110,7 @@ void adc_config(ADC_TypeDef *adc, uint32_t bits) { __HAL_RCC_ADC_CLK_ENABLE(); #else if (adc == ADC1) { - #if defined(STM32H7) + #if defined(STM32G4) || defined(STM32H7) __HAL_RCC_ADC12_CLK_ENABLE(); #else __HAL_RCC_ADC1_CLK_ENABLE(); @@ -113,7 +118,7 @@ void adc_config(ADC_TypeDef *adc, uint32_t bits) { } #if defined(ADC2) if (adc == ADC2) { - #if defined(STM32H7) + #if defined(STM32G4) || defined(STM32H7) __HAL_RCC_ADC12_CLK_ENABLE(); #else __HAL_RCC_ADC2_CLK_ENABLE(); @@ -122,7 +127,11 @@ void adc_config(ADC_TypeDef *adc, uint32_t bits) { #endif #if defined(ADC3) if (adc == ADC3) { + #if defined(ADC345_COMMON) + __HAL_RCC_ADC345_CLK_ENABLE(); + #else __HAL_RCC_ADC3_CLK_ENABLE(); + #endif } #endif #endif @@ -165,7 +174,7 @@ void adc_config(ADC_TypeDef *adc, uint32_t bits) { // ADC isn't enabled so calibrate it now #if defined(STM32F0) || defined(STM32L0) LL_ADC_StartCalibration(adc); - #elif defined(STM32L4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32L4) || defined(STM32WB) LL_ADC_StartCalibration(adc, LL_ADC_SINGLE_ENDED); #else LL_ADC_StartCalibration(adc, LL_ADC_CALIB_OFFSET_LINEARITY, LL_ADC_SINGLE_ENDED); @@ -230,7 +239,7 @@ STATIC int adc_get_bits(ADC_TypeDef *adc) { uint32_t res = (adc->CFGR1 & ADC_CFGR1_RES) >> ADC_CFGR1_RES_Pos; #elif defined(STM32F4) || defined(STM32F7) uint32_t res = (adc->CR1 & ADC_CR1_RES) >> ADC_CR1_RES_Pos; - #elif defined(STM32H7) || defined(STM32L4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB) uint32_t res = (adc->CFGR & ADC_CFGR_RES) >> ADC_CFGR_RES_Pos; #endif return adc_cr_to_bits_table[res]; @@ -403,7 +412,11 @@ STATIC mp_obj_t machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, s adc = ADC1; channel = mp_obj_get_int(source); if (channel == ADC_CHANNEL_VREFINT + #if defined(STM32G4) + || channel == ADC_CHANNEL_TEMPSENSOR_ADC1 + #else || channel == ADC_CHANNEL_TEMPSENSOR + #endif #if defined(ADC_CHANNEL_VBAT) || channel == ADC_CHANNEL_VBAT #endif @@ -455,7 +468,11 @@ STATIC const mp_rom_map_elem_t machine_adc_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_VREF), MP_ROM_INT(ADC_CHANNEL_VREF) }, { MP_ROM_QSTR(MP_QSTR_CORE_VREF), MP_ROM_INT(ADC_CHANNEL_VREFINT) }, + #if defined(STM32G4) + { MP_ROM_QSTR(MP_QSTR_CORE_TEMP), MP_ROM_INT(ADC_CHANNEL_TEMPSENSOR_ADC1) }, + #else { MP_ROM_QSTR(MP_QSTR_CORE_TEMP), MP_ROM_INT(ADC_CHANNEL_TEMPSENSOR) }, + #endif #if defined(ADC_CHANNEL_VBAT) { MP_ROM_QSTR(MP_QSTR_CORE_VBAT), MP_ROM_INT(ADC_CHANNEL_VBAT) }, #endif diff --git a/ports/stm32/machine_uart.c b/ports/stm32/machine_uart.c index 354a1e26ac..6a12fad324 100644 --- a/ports/stm32/machine_uart.c +++ b/ports/stm32/machine_uart.c @@ -459,7 +459,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_uart_readchar_obj, pyb_uart_readchar); // uart.sendbreak() STATIC mp_obj_t pyb_uart_sendbreak(mp_obj_t self_in) { pyb_uart_obj_t *self = MP_OBJ_TO_PTR(self_in); - #if defined(STM32F0) || defined(STM32F7) || defined(STM32L0) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32F0) || defined(STM32F7) || defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) self->uartx->RQR = USART_RQR_SBKRQ; // write-only register #else self->uartx->CR1 |= USART_CR1_SBK; diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c index 92b80b3652..9b215c75cd 100644 --- a/ports/stm32/modmachine.c +++ b/ports/stm32/modmachine.c @@ -63,7 +63,7 @@ #define RCC_CSR_BORRSTF RCC_CSR_PORRSTF #endif -#if defined(STM32L4) || defined(STM32WB) +#if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) // L4 does not have a POR, so use BOR instead #define RCC_CSR_PORRSTF RCC_CSR_BORRSTF #endif diff --git a/ports/stm32/mpconfigboard_common.h b/ports/stm32/mpconfigboard_common.h index f8342f51b9..17a4ad26e4 100644 --- a/ports/stm32/mpconfigboard_common.h +++ b/ports/stm32/mpconfigboard_common.h @@ -319,6 +319,16 @@ #define MICROPY_HW_MAX_UART (8) #define MICROPY_HW_MAX_LPUART (0) +// Configuration for STM32G4 series +#elif defined(STM32G4) + +#define MP_HAL_UNIQUE_ID_ADDRESS (UID_BASE) +#define PYB_EXTI_NUM_VECTORS (42) // up to 42 event/interrupt requests: 28 configurable lines, 14 direct lines +#define MICROPY_HW_MAX_I2C (3) +#define MICROPY_HW_MAX_TIMER (20) // TIM1-8, 20 +#define MICROPY_HW_MAX_UART (5) // UART1-5 + LPUART1 +#define MICROPY_HW_MAX_LPUART (1) + // Configuration for STM32H7A3/B3 series #elif defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || \ defined(STM32H7B3xx) || defined(STM32H7B3xxQ) @@ -410,7 +420,12 @@ #else // Use HSE as a clock source (bypass or oscillator) #define MICROPY_HW_CLK_VALUE (HSE_VALUE) +#if defined(STM32G4) +// enable HSI48 to run RNG on this clock +#define MICROPY_HW_RCC_OSCILLATOR_TYPE (RCC_OSCILLATORTYPE_HSE | RCC_OSCILLATORTYPE_HSI48) +#else #define MICROPY_HW_RCC_OSCILLATOR_TYPE (RCC_OSCILLATORTYPE_HSE) +#endif #define MICROPY_HW_RCC_PLL_SRC (RCC_PLLSOURCE_HSE) #define MICROPY_HW_RCC_CR_HSxON (RCC_CR_HSEON) #define MICROPY_HW_RCC_HSI_STATE (RCC_HSI_OFF) @@ -480,7 +495,7 @@ // Enable CAN if there are any peripherals defined #if defined(MICROPY_HW_CAN1_TX) || defined(MICROPY_HW_CAN2_TX) || defined(MICROPY_HW_CAN3_TX) #define MICROPY_HW_ENABLE_CAN (1) -#if defined(STM32H7) +#if defined(STM32G4) || defined(STM32H7) #define MICROPY_HW_ENABLE_FDCAN (1) // define for MCUs with FDCAN #endif #else diff --git a/ports/stm32/mphalport.c b/ports/stm32/mphalport.c index 81e84ef933..2b98a620ef 100644 --- a/ports/stm32/mphalport.c +++ b/ports/stm32/mphalport.c @@ -99,7 +99,7 @@ void mp_hal_gpio_clock_enable(GPIO_TypeDef *gpio) { #elif defined(STM32L0) #define AHBxENR IOPENR #define AHBxENR_GPIOAEN_Pos RCC_IOPENR_IOPAEN_Pos - #elif defined(STM32L4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32L4) || defined(STM32WB) #define AHBxENR AHB2ENR #define AHBxENR_GPIOAEN_Pos RCC_AHB2ENR_GPIOAEN_Pos #endif diff --git a/ports/stm32/pin_defs_stm32.h b/ports/stm32/pin_defs_stm32.h index 20faab4e03..1f950c1179 100644 --- a/ports/stm32/pin_defs_stm32.h +++ b/ports/stm32/pin_defs_stm32.h @@ -121,8 +121,8 @@ enum { #define I2S2 SPI2 #define I2S3 SPI3 -#if defined(STM32H7) -// Make H7 FDCAN more like CAN +#if defined(STM32G4) || defined(STM32H7) +// Make G4/H7 FDCAN more like CAN #define CAN1 FDCAN1 #define CAN2 FDCAN2 #define GPIO_AF9_CAN1 GPIO_AF9_FDCAN1 diff --git a/ports/stm32/powerctrl.c b/ports/stm32/powerctrl.c index a3f8207e9a..ad3a3ea4c2 100644 --- a/ports/stm32/powerctrl.c +++ b/ports/stm32/powerctrl.c @@ -143,7 +143,7 @@ void powerctrl_check_enter_bootloader(void) { if (BL_STATE_GET_KEY(bl_state) == BL_STATE_KEY && (RCC->RCC_SR & RCC_SR_SFTRSTF)) { // Reset by NVIC_SystemReset with bootloader data set -> branch to bootloader RCC->RCC_SR = RCC_SR_RMVF; - #if defined(STM32F0) || defined(STM32F4) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32F0) || defined(STM32F4) || defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH(); #endif branch_to_bootloader(BL_STATE_GET_REG(bl_state), BL_STATE_GET_ADDR(bl_state)); @@ -378,7 +378,7 @@ STATIC uint32_t calc_apb2_div(uint32_t wanted_div) { #endif } -#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7) +#if defined(STM32F4) || defined(STM32F7) || defined(STM32G4) || defined(STM32H7) int powerctrl_set_sysclk(uint32_t sysclk, uint32_t ahb, uint32_t apb1, uint32_t apb2) { // Return straightaway if the clocks are already at the desired frequency @@ -686,7 +686,7 @@ void powerctrl_enter_stop_mode(void) { __HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_MSI); #endif - #if !defined(STM32F0) && !defined(STM32L0) && !defined(STM32L4) && !defined(STM32WB) + #if !defined(STM32F0) && !defined(STM32G4) && !defined(STM32L0) && !defined(STM32L4) && !defined(STM32WB) // takes longer to wake but reduces stop current HAL_PWREx_EnableFlashPowerDown(); #endif @@ -861,6 +861,9 @@ void powerctrl_enter_standby_mode(void) { #if defined(STM32F0) || defined(STM32L0) #define CR_BITS (RTC_CR_ALRAIE | RTC_CR_WUTIE | RTC_CR_TSIE) #define ISR_BITS (RTC_ISR_ALRAF | RTC_ISR_WUTF | RTC_ISR_TSF) + #elif defined(STM32G4) + #define CR_BITS (RTC_CR_ALRAIE | RTC_CR_ALRBIE | RTC_CR_WUTIE | RTC_CR_TSIE) + #define ISR_BITS (RTC_MISR_ALRAMF | RTC_MISR_ALRBMF | RTC_MISR_WUTMF | RTC_MISR_TSMF) #elif defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) #define CR_BITS (RTC_CR_ALRAIE | RTC_CR_ALRBIE | RTC_CR_WUTIE | RTC_CR_TSIE) #define SR_BITS (RTC_SR_ALRAF | RTC_SR_ALRBF | RTC_SR_WUTF | RTC_SR_TSF) @@ -882,6 +885,8 @@ void powerctrl_enter_standby_mode(void) { // clear RTC wake-up flags #if defined(SR_BITS) RTC->SR &= ~SR_BITS; + #elif defined(STM32G4) + RTC->MISR &= ~ISR_BITS; #else RTC->ISR &= ~ISR_BITS; #endif @@ -898,7 +903,7 @@ void powerctrl_enter_standby_mode(void) { #elif defined(STM32H7) EXTI_D1->PR1 = 0x3fffff; PWR->WKUPCR |= PWR_WAKEUP_FLAG1 | PWR_WAKEUP_FLAG2 | PWR_WAKEUP_FLAG3 | PWR_WAKEUP_FLAG4 | PWR_WAKEUP_FLAG5 | PWR_WAKEUP_FLAG6; - #elif defined(STM32L4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32L4) || defined(STM32WB) // clear all wake-up flags PWR->SCR |= PWR_SCR_CWUF5 | PWR_SCR_CWUF4 | PWR_SCR_CWUF3 | PWR_SCR_CWUF2 | PWR_SCR_CWUF1; // TODO diff --git a/ports/stm32/pyb_i2c.c b/ports/stm32/pyb_i2c.c index dbcf4bcb81..70a8e9f091 100644 --- a/ports/stm32/pyb_i2c.c +++ b/ports/stm32/pyb_i2c.c @@ -130,7 +130,7 @@ const pyb_i2c_obj_t pyb_i2c_obj[] = { #endif }; -#if defined(STM32F7) || defined(STM32L4) || defined(STM32H7) +#if defined(STM32F7) || defined(STM32G4) || defined(STM32L4) || defined(STM32H7) // The STM32F0, F3, F7, H7 and L4 use a TIMINGR register rather than ClockSpeed and // DutyCycle. @@ -163,6 +163,28 @@ const pyb_i2c_obj_t pyb_i2c_obj[] = { #define MICROPY_HW_I2C_BAUDRATE_DEFAULT (PYB_I2C_SPEED_FULL) #define MICROPY_HW_I2C_BAUDRATE_MAX (PYB_I2C_SPEED_FAST) +#elif defined(STM32G4) +// timing input depends on PLL +// for now: 170MHz sysclock, PCLK 10.625 MHz +// using PCLOCK +// generated using CubeMX +#if defined(STM32G431xx) || defined(STM32G441xx) +#define MICROPY_HW_I2C_BAUDRATE_TIMING { \ + {PYB_I2C_SPEED_STANDARD, 0x30A0A7FB}, \ + {PYB_I2C_SPEED_STANDARD, 0x30A0A7FB}, \ + {PYB_I2C_SPEED_STANDARD, 0x30A0A7FB}, \ +} +#else +#define MICROPY_HW_I2C_BAUDRATE_TIMING { \ + {PYB_I2C_SPEED_STANDARD, 0x30A0A7FB}, \ + {PYB_I2C_SPEED_STANDARD, 0x30A0A7FB}, \ + {PYB_I2C_SPEED_STANDARD, 0x30A0A7FB}, \ + {PYB_I2C_SPEED_STANDARD, 0x30A0A7FB}, \ +} +#endif +#define MICROPY_HW_I2C_BAUDRATE_DEFAULT (PYB_I2C_SPEED_STANDARD) +#define MICROPY_HW_I2C_BAUDRATE_MAX (PYB_I2C_SPEED_STANDARD) + #elif defined(STM32H7) // I2C TIMINGs obtained from the STHAL examples. diff --git a/ports/stm32/rtc.c b/ports/stm32/rtc.c index a5553b8a0a..2d6459e239 100644 --- a/ports/stm32/rtc.c +++ b/ports/stm32/rtc.c @@ -220,7 +220,7 @@ void rtc_init_finalise() { // fresh reset; configure RTC Calendar RTC_CalendarConfig(); - #if defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) if (__HAL_RCC_GET_FLAG(RCC_FLAG_BORRST) != RESET) { #else if (__HAL_RCC_GET_FLAG(RCC_FLAG_PORRST) != RESET) { @@ -261,7 +261,7 @@ STATIC HAL_StatusTypeDef PYB_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct HAL_PWR_EnableBkUpAccess(); uint32_t tickstart = HAL_GetTick(); - #if defined(STM32F7) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32F7) || defined(STM32G4) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) // __HAL_RCC_PWR_CLK_ENABLE(); // Enable write access to Backup domain // PWR->CR1 |= PWR_CR1_DBP; @@ -339,7 +339,7 @@ STATIC HAL_StatusTypeDef PYB_RTC_Init(RTC_HandleTypeDef *hrtc) { hrtc->Instance->PRER |= (uint32_t)(hrtc->Init.AsynchPrediv << 16); // Exit Initialization mode - #if defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) + #if defined(STM32G4) || defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) hrtc->Instance->ICSR &= (uint32_t) ~RTC_ICSR_INIT; #else hrtc->Instance->ISR &= (uint32_t) ~RTC_ISR_INIT; @@ -353,6 +353,9 @@ STATIC HAL_StatusTypeDef PYB_RTC_Init(RTC_HandleTypeDef *hrtc) { #elif defined(STM32F7) hrtc->Instance->OR &= (uint32_t) ~RTC_OR_ALARMTYPE; hrtc->Instance->OR |= (uint32_t)(hrtc->Init.OutPutType); + #elif defined(STM32G4) + hrtc->Instance->CR &= (uint32_t) ~RTC_CR_TAMPALRM_TYPE_Msk; + hrtc->Instance->CR |= (uint32_t)(hrtc->Init.OutPutType); #else hrtc->Instance->TAFCR &= (uint32_t) ~RTC_TAFCR_ALARMOUTTYPE; hrtc->Instance->TAFCR |= (uint32_t)(hrtc->Init.OutPutType); @@ -699,7 +702,7 @@ mp_obj_t pyb_rtc_wakeup(size_t n_args, const mp_obj_t *args) { RTC->CR &= ~RTC_CR_WUTE; // wait until WUTWF is set - #if defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) + #if defined(STM32G4) || defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) while (!(RTC->ICSR & RTC_ICSR_WUTWF)) { } #else @@ -720,7 +723,7 @@ mp_obj_t pyb_rtc_wakeup(size_t n_args, const mp_obj_t *args) { RTC->WPR = 0xff; // enable external interrupts on line EXTI_RTC_WAKEUP - #if defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) EXTI->IMR1 |= 1 << EXTI_RTC_WAKEUP; EXTI->RTSR1 |= 1 << EXTI_RTC_WAKEUP; #elif defined(STM32H7) @@ -732,12 +735,14 @@ mp_obj_t pyb_rtc_wakeup(size_t n_args, const mp_obj_t *args) { #endif // clear interrupt flags - #if defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) + #if defined(STM32G4) + RTC->ICSR &= ~RTC_ICSR_WUTWF; + #elif defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) RTC->SR &= ~RTC_SR_WUTF; #else RTC->ISR &= ~RTC_ISR_WUTF; #endif - #if defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) EXTI->PR1 = 1 << EXTI_RTC_WAKEUP; #elif defined(STM32H7) EXTI_D1->PR1 = 1 << EXTI_RTC_WAKEUP; @@ -757,7 +762,7 @@ mp_obj_t pyb_rtc_wakeup(size_t n_args, const mp_obj_t *args) { RTC->WPR = 0xff; // disable external interrupts on line EXTI_RTC_WAKEUP - #if defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) EXTI->IMR1 &= ~(1 << EXTI_RTC_WAKEUP); #elif defined(STM32H7) EXTI_D1->IMR1 |= 1 << EXTI_RTC_WAKEUP; diff --git a/ports/stm32/stm32_it.c b/ports/stm32/stm32_it.c index fe9b606225..84274e3c62 100644 --- a/ports/stm32/stm32_it.c +++ b/ports/stm32/stm32_it.c @@ -529,7 +529,9 @@ void TAMP_STAMP_IRQHandler(void) { void RTC_WKUP_IRQHandler(void) { IRQ_ENTER(RTC_WKUP_IRQn); - #if defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) + #if defined(STM32G4) + RTC->MISR &= ~RTC_MISR_WUTMF; // clear wakeup interrupt flag + #elif defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) RTC->SR &= ~RTC_SR_WUTF; // clear wakeup interrupt flag #else RTC->ISR &= ~RTC_ISR_WUTF; // clear wakeup interrupt flag @@ -593,7 +595,7 @@ void TIM1_BRK_TIM9_IRQHandler(void) { IRQ_EXIT(TIM1_BRK_TIM9_IRQn); } -#if defined(STM32L4) +#if defined(STM32G4) || defined(STM32L4) void TIM1_BRK_TIM15_IRQHandler(void) { IRQ_ENTER(TIM1_BRK_TIM15_IRQn); timer_irq_handler(15); @@ -608,7 +610,7 @@ void TIM1_UP_TIM10_IRQHandler(void) { IRQ_EXIT(TIM1_UP_TIM10_IRQn); } -#if defined(STM32L4) || defined(STM32WB) +#if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) void TIM1_UP_TIM16_IRQHandler(void) { IRQ_ENTER(TIM1_UP_TIM16_IRQn); timer_irq_handler(1); @@ -631,7 +633,7 @@ void TIM1_TRG_COM_TIM11_IRQHandler(void) { IRQ_EXIT(TIM1_TRG_COM_TIM11_IRQn); } -#if defined(STM32L4) || defined(STM32WB) +#if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) void TIM1_TRG_COM_TIM17_IRQHandler(void) { IRQ_ENTER(TIM1_TRG_COM_TIM17_IRQn); timer_irq_handler(17); @@ -679,12 +681,20 @@ void TIM6_DAC_IRQHandler(void) { #endif #if defined(TIM7) // STM32F401 doesn't have TIM7 +#if defined(STM32G4) +void TIM7_DAC_IRQHandler(void) { + IRQ_ENTER(TIM7_DAC_IRQn); + timer_irq_handler(7); + IRQ_EXIT(TIM7_DAC_IRQn); +} +#else void TIM7_IRQHandler(void) { IRQ_ENTER(TIM7_IRQn); timer_irq_handler(7); IRQ_EXIT(TIM7_IRQn); } #endif +#endif #if defined(TIM8) // STM32F401 doesn't have TIM8 void TIM8_BRK_TIM12_IRQHandler(void) { @@ -700,7 +710,7 @@ void TIM8_UP_TIM13_IRQHandler(void) { IRQ_EXIT(TIM8_UP_TIM13_IRQn); } -#if defined(STM32L4) +#if defined(STM32G4) || defined(STM32L4) void TIM8_UP_IRQHandler(void) { IRQ_ENTER(TIM8_UP_IRQn); timer_irq_handler(8); diff --git a/ports/stm32/system_stm32.c b/ports/stm32/system_stm32.c index 8142fd0a5c..582d7a3698 100644 --- a/ports/stm32/system_stm32.c +++ b/ports/stm32/system_stm32.c @@ -78,7 +78,7 @@ #include "py/mphal.h" #include "powerctrl.h" -#if defined(STM32F4) || defined(STM32F7) || defined(STM32H7) || defined(STM32L4) +#if defined(STM32F4) || defined(STM32F7) || defined(STM32G4) || defined(STM32H7) || defined(STM32L4) void __fatal_error(const char *msg); @@ -171,10 +171,10 @@ void SystemClock_Config(void) { RCC->DCKCFGR2 = 0; #endif - RCC_ClkInitTypeDef RCC_ClkInitStruct; - RCC_OscInitTypeDef RCC_OscInitStruct; - #if defined(STM32H7) - RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + #if defined(STM32G4) || defined(STM32H7) + RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; #endif #if defined(STM32F4) || defined(STM32F7) || defined(STM32H7) @@ -192,6 +192,10 @@ void SystemClock_Config(void) { clocked below the maximum system frequency, to update the voltage scaling value regarding system frequency refer to product datasheet. */ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); + + #elif defined(STM32G4) + // Configure the main internal regulator output voltage + HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST); #elif defined(STM32L4) // Configure LSE Drive Capability __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW); @@ -204,7 +208,7 @@ void SystemClock_Config(void) { #endif /* Enable HSE Oscillator and activate PLL with HSE as source */ - #if defined(STM32F4) || defined(STM32F7) || defined(STM32H7) + #if defined(STM32F4) || defined(STM32F7) || defined(STM32G4) || defined(STM32H7) RCC_OscInitStruct.OscillatorType = MICROPY_HW_RCC_OSCILLATOR_TYPE; RCC_OscInitStruct.HSEState = MICROPY_HW_RCC_HSE_STATE; RCC_OscInitStruct.HSIState = MICROPY_HW_RCC_HSI_STATE; @@ -240,6 +244,27 @@ void SystemClock_Config(void) { #endif #endif + + #if defined(STM32G4) + RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; + RCC_OscInitStruct.HSI48State = RCC_HSI48_ON; + #if MICROPY_HW_CLK_USE_HSI && MICROPY_HW_CLK_USE_HSI48 + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI | RCC_OSCILLATORTYPE_HSI48; + RCC_OscInitStruct.HSIState = RCC_HSI_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; + #else + RCC_OscInitStruct.OscillatorType = MICROPY_HW_RCC_OSCILLATOR_TYPE; + RCC_OscInitStruct.HSEState = MICROPY_HW_RCC_HSE_STATE; + RCC_OscInitStruct.HSIState = MICROPY_HW_RCC_HSI_STATE; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + #endif + RCC_OscInitStruct.PLL.PLLM = MICROPY_HW_CLK_PLLM; + RCC_OscInitStruct.PLL.PLLN = MICROPY_HW_CLK_PLLN; + RCC_OscInitStruct.PLL.PLLP = MICROPY_HW_CLK_PLLP; + RCC_OscInitStruct.PLL.PLLQ = MICROPY_HW_CLK_PLLQ; + RCC_OscInitStruct.PLL.PLLR = MICROPY_HW_CLK_PLLR; + #endif + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */ @@ -295,7 +320,7 @@ void SystemClock_Config(void) { RCC_OscInitStruct.PLL.PLLN = MICROPY_HW_CLK_PLLN; RCC_OscInitStruct.PLL.PLLP = MICROPY_HW_CLK_PLLP; RCC_OscInitStruct.PLL.PLLQ = MICROPY_HW_CLK_PLLQ; - #if defined(STM32L4) || defined(STM32H7) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32L4) RCC_OscInitStruct.PLL.PLLR = MICROPY_HW_CLK_PLLR; #endif @@ -309,6 +334,11 @@ void SystemClock_Config(void) { RCC_ClkInitStruct.AHBCLKDivider = MICROPY_HW_CLK_AHB_DIV; RCC_ClkInitStruct.APB1CLKDivider = MICROPY_HW_CLK_APB1_DIV; RCC_ClkInitStruct.APB2CLKDivider = MICROPY_HW_CLK_APB2_DIV; + #elif defined(STM32G4) + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = MICROPY_HW_CLK_AHB_DIV; + RCC_ClkInitStruct.APB1CLKDivider = MICROPY_HW_CLK_APB1_DIV; + RCC_ClkInitStruct.APB2CLKDivider = MICROPY_HW_CLK_APB2_DIV; #elif defined(STM32L4) RCC_ClkInitStruct.AHBCLKDivider = MICROPY_HW_CLK_AHB_DIV; RCC_ClkInitStruct.APB1CLKDivider = MICROPY_HW_CLK_APB1_DIV; @@ -351,12 +381,30 @@ void SystemClock_Config(void) { } #endif + #if defined(STM32G4) + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_8) != HAL_OK) { + __fatal_error("HAL_RCC_ClockConfig"); + } + PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC | RCC_PERIPHCLK_LPUART1 + | RCC_PERIPHCLK_RNG | RCC_PERIPHCLK_ADC12 + | RCC_PERIPHCLK_FDCAN | RCC_PERIPHCLK_USB; + PeriphClkInitStruct.UsbClockSelection = RCC_USBCLKSOURCE_HSI48; + PeriphClkInitStruct.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PCLK1; + PeriphClkInitStruct.FdcanClockSelection = RCC_FDCANCLKSOURCE_HSE; + PeriphClkInitStruct.RngClockSelection = RCC_RNGCLKSOURCE_HSI48; + PeriphClkInitStruct.Adc12ClockSelection = RCC_ADC12CLKSOURCE_SYSCLK; + PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE; + if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) { + __fatal_error("HAL_RCCEx_PeriphCLKConfig"); + } + #else uint32_t vco_out = RCC_OscInitStruct.PLL.PLLN * (MICROPY_HW_CLK_VALUE / 1000000) / RCC_OscInitStruct.PLL.PLLM; uint32_t sysclk_mhz = vco_out / RCC_OscInitStruct.PLL.PLLP; bool need_pll48 = vco_out % 48 != 0; if (powerctrl_rcc_clock_config_pll(&RCC_ClkInitStruct, sysclk_mhz, need_pll48) != 0) { __fatal_error("HAL_RCC_ClockConfig"); } + #endif #if defined(STM32H7) /* Activate CSI clock mandatory for I/O Compensation Cell*/ diff --git a/ports/stm32/timer.c b/ports/stm32/timer.c index 5a968ec56d..57c8dc6c7b 100644 --- a/ports/stm32/timer.c +++ b/ports/stm32/timer.c @@ -482,7 +482,7 @@ STATIC void config_deadtime(pyb_timer_obj_t *self, mp_int_t ticks, mp_int_t brk) deadTimeConfig.DeadTime = compute_dtg_from_ticks(ticks); deadTimeConfig.BreakState = brk == BRK_OFF ? TIM_BREAK_DISABLE : TIM_BREAK_ENABLE; deadTimeConfig.BreakPolarity = brk == BRK_LOW ? TIM_BREAKPOLARITY_LOW : TIM_BREAKPOLARITY_HIGH; - #if defined(STM32F7) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32F7) || defined(STM32G4) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB) deadTimeConfig.BreakFilter = 0; deadTimeConfig.Break2State = TIM_BREAK_DISABLE; deadTimeConfig.Break2Polarity = TIM_BREAKPOLARITY_LOW; @@ -810,7 +810,7 @@ STATIC const uint32_t tim_instance_table[MICROPY_HW_MAX_TIMER] = { TIM_ENTRY(1, TIM1_UP_TIM10_IRQn), #elif defined(STM32H7) TIM_ENTRY(1, TIM1_UP_IRQn), - #elif defined(STM32L4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32L4) || defined(STM32WB) TIM_ENTRY(1, TIM1_UP_TIM16_IRQn), #endif #endif @@ -832,12 +832,16 @@ STATIC const uint32_t tim_instance_table[MICROPY_HW_MAX_TIMER] = { #endif #endif #if defined(TIM7) + #if defined(STM32G4) + TIM_ENTRY(7, TIM7_DAC_IRQn), + #else TIM_ENTRY(7, TIM7_IRQn), #endif + #endif #if defined(TIM8) #if defined(STM32F4) || defined(STM32F7) || defined(STM32H7) TIM_ENTRY(8, TIM8_UP_TIM13_IRQn), - #elif defined(STM32L4) + #elif defined(STM32G4) || defined(STM32L4) TIM_ENTRY(8, TIM8_UP_IRQn), #endif #endif @@ -882,6 +886,9 @@ STATIC const uint32_t tim_instance_table[MICROPY_HW_MAX_TIMER] = { TIM_ENTRY(17, TIM1_TRG_COM_TIM17_IRQn), #endif #endif + #if defined(TIM20) + TIM_ENTRY(20, TIM20_UP_IRQn), + #endif }; #undef TIM_ENTRY @@ -1401,6 +1408,7 @@ STATIC mp_obj_t pyb_timer_callback(mp_obj_t self_in, mp_obj_t callback) { // start timer, so that it interrupts on overflow, but clear any // pending interrupts which may have been set by initializing it. __HAL_TIM_CLEAR_FLAG(&self->tim, TIM_IT_UPDATE); + HAL_TIM_Base_Stop(&self->tim); // internal timer state must be released before starting again HAL_TIM_Base_Start_IT(&self->tim); // This will re-enable the IRQ HAL_NVIC_EnableIRQ(self->irqn); } else { diff --git a/ports/stm32/uart.c b/ports/stm32/uart.c index 2c08257f32..61e72999e2 100644 --- a/ports/stm32/uart.c +++ b/ports/stm32/uart.c @@ -73,6 +73,15 @@ #define USART_CR3_IE_ALL (USART_CR3_IE_BASE) #endif +#elif defined(STM32G4) +#define USART_CR1_IE_ALL (USART_CR1_IE_BASE | USART_CR1_EOBIE | USART_CR1_RTOIE | USART_CR1_CMIE) +#define USART_CR2_IE_ALL (USART_CR2_IE_BASE) +#if defined(USART_CR3_TCBGTIE) +#define USART_CR3_IE_ALL (USART_CR3_IE_BASE | USART_CR3_TCBGTIE | USART_CR3_WUFIE) +#else +#define USART_CR3_IE_ALL (USART_CR3_IE_BASE | USART_CR3_WUFIE) +#endif + #elif defined(STM32H7) #define USART_CR1_IE_ALL (USART_CR1_IE_BASE | USART_CR1_RXFFIE | USART_CR1_TXFEIE | USART_CR1_EOBIE | USART_CR1_RTOIE | USART_CR1_CMIE) #define USART_CR2_IE_ALL (USART_CR2_IE_BASE) @@ -91,6 +100,7 @@ #else #define USART_CR3_IE_ALL (USART_CR3_IE_BASE | USART_CR3_WUFIE) #endif + #endif extern void NORETURN __fatal_error(const char *msg); @@ -501,6 +511,11 @@ bool uart_init(pyb_uart_obj_t *uart_obj, huart.Init.Mode = UART_MODE_TX_RX; huart.Init.HwFlowCtl = flow; huart.Init.OverSampling = UART_OVERSAMPLING_16; + + #if defined(STM32G4) // H7 and WB also have fifo.. + huart.FifoMode = UART_FIFOMODE_ENABLE; + #endif + #if !defined(STM32F4) huart.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; #endif @@ -798,14 +813,14 @@ uint32_t uart_get_baudrate(pyb_uart_obj_t *self) { #if defined(LPUART1) if (self->uart_id == PYB_LPUART_1) { return LL_LPUART_GetBaudRate(self->uartx, uart_get_source_freq(self) - #if defined(STM32H7) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) , self->uartx->PRESC #endif ); } #endif return LL_USART_GetBaudRate(self->uartx, uart_get_source_freq(self), - #if defined(STM32H7) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) self->uartx->PRESC, #endif LL_USART_OVERSAMPLING_16); @@ -815,7 +830,7 @@ void uart_set_baudrate(pyb_uart_obj_t *self, uint32_t baudrate) { #if defined(LPUART1) if (self->uart_id == PYB_LPUART_1) { LL_LPUART_SetBaudRate(self->uartx, uart_get_source_freq(self), - #if defined(STM32H7) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) LL_LPUART_PRESCALER_DIV1, #endif baudrate); @@ -823,7 +838,7 @@ void uart_set_baudrate(pyb_uart_obj_t *self, uint32_t baudrate) { } #endif LL_USART_SetBaudRate(self->uartx, uart_get_source_freq(self), - #if defined(STM32H7) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) LL_USART_PRESCALER_DIV1, #endif LL_USART_OVERSAMPLING_16, baudrate); @@ -874,7 +889,7 @@ int uart_rx_char(pyb_uart_obj_t *self) { return data; } else { // no buffering - #if defined(STM32F0) || defined(STM32F7) || defined(STM32L0) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32F0) || defined(STM32F7) || defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) int data = self->uartx->RDR & self->char_mask; self->uartx->ICR = USART_ICR_ORECF; // clear ORE if it was set return data; @@ -1024,7 +1039,7 @@ void uart_irq_handler(mp_uint_t uart_id) { uint16_t next_head = (self->read_buf_head + 1) % self->read_buf_len; if (next_head != self->read_buf_tail) { // only read data if room in buf - #if defined(STM32F0) || defined(STM32F7) || defined(STM32L0) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32F0) || defined(STM32F7) || defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) int data = self->uartx->RDR; // clears UART_FLAG_RXNE #else self->mp_irq_flags = self->uartx->SR; // resample to get any new flags since next read of DR will clear SR diff --git a/ports/stm32/usbdev/core/inc/usbd_def.h b/ports/stm32/usbdev/core/inc/usbd_def.h index e0d1c37625..44c8dd8d93 100644 --- a/ports/stm32/usbdev/core/inc/usbd_def.h +++ b/ports/stm32/usbdev/core/inc/usbd_def.h @@ -267,8 +267,12 @@ typedef struct _USBD_HandleTypeDef with the DMA during the transaction process should be 4-bytes aligned */ #if defined (__GNUC__) /* GNU Compiler */ - #define __ALIGN_END __attribute__ ((aligned (4))) - #define __ALIGN_BEGIN + #ifndef __ALIGN_END + #define __ALIGN_END __attribute__ ((aligned (4))) + #endif /* __ALIGN_END */ + #ifndef __ALIGN_BEGIN + #define __ALIGN_BEGIN + #endif /* __ALIGN_BEGIN */ #else #define __ALIGN_END #if defined (__CC_ARM) /* ARM Compiler */ From a5003ba40719a3da70586bb79856ec635db1076d Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 1 Feb 2022 15:45:54 +1100 Subject: [PATCH 0065/1712] gitmodules: Update branch for stm32lib submodule. Signed-off-by: Damien George --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index a92757df2c..d0b73e2ecf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,7 +13,7 @@ [submodule "lib/stm32lib"] path = lib/stm32lib url = https://github.com/micropython/stm32lib - branch = work-F4-1.13.1+F7-1.5.0+L4-1.3.0 + branch = work-F0-1.9.0+F4-1.16.0+F7-1.7.0+G4-1.3.0+H7-1.6.0+L0-1.11.2+L4-1.17.0+WB-1.10.0+WL-1.1.0 [submodule "lib/nrfx"] path = lib/nrfx url = https://github.com/NordicSemiconductor/nrfx.git From a5e64c209f2d76cb0cc903df875d87e8ca009507 Mon Sep 17 00:00:00 2001 From: IhorNehrutsa Date: Tue, 25 Jan 2022 17:07:24 +0200 Subject: [PATCH 0066/1712] esp32/machine_pwm: Fix PWM not allowing frequencies < 611 Hz. Fixes issue #8189. --- ports/esp32/machine_pwm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 ports/esp32/machine_pwm.c diff --git a/ports/esp32/machine_pwm.c b/ports/esp32/machine_pwm.c old mode 100644 new mode 100755 index 43d44249dc..9d5d9595e1 --- a/ports/esp32/machine_pwm.c +++ b/ports/esp32/machine_pwm.c @@ -85,10 +85,10 @@ STATIC ledc_timer_config_t timers[PWM_TIMER_MAX]; // duty_u16() and duty_ns() use 16-bit resolution or less // Possible highest resolution in device -#if (LEDC_TIMER_BIT_MAX - 1) < LEDC_TIMER_16_BIT -#define HIGHEST_PWM_RES (LEDC_TIMER_BIT_MAX - 1) -#else +#if CONFIG_IDF_TARGET_ESP32 #define HIGHEST_PWM_RES (LEDC_TIMER_16_BIT) // 20 bit for ESP32, but 16 bit is used +#else +#define HIGHEST_PWM_RES (LEDC_TIMER_BIT_MAX - 1) // 14 bit is used #endif // Duty resolution of user interface in `duty_u16()` and `duty_u16` parameter in constructor/initializer #define UI_RES_16_BIT (16) @@ -300,7 +300,7 @@ STATIC uint32_t get_duty_u16(machine_pwm_obj_t *self) { } STATIC uint32_t get_duty_u10(machine_pwm_obj_t *self) { - return get_duty_u16(self) >> (HIGHEST_PWM_RES - PWRES); + return get_duty_u16(self) >> (UI_RES_16_BIT - LEDC_TIMER_10_BIT); } STATIC uint32_t get_duty_ns(machine_pwm_obj_t *self) { From 15e65b77ebfaeddc9a678d94cf1a2ced625a6d45 Mon Sep 17 00:00:00 2001 From: IhorNehrutsa Date: Tue, 25 Jan 2022 22:57:22 +0200 Subject: [PATCH 0067/1712] esp32/machine_pwm: Clean up macro names and their use. - Remove UI_RES_SHIFT macro. - Rename PWFREQ to PWM_FREQ. - Rename PWRES to PWM_RES_10_BIT. - Use UI_RES_16_BIT flag instead of HIGHEST_PWM_RES. --- ports/esp32/machine_pwm.c | 41 ++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/ports/esp32/machine_pwm.c b/ports/esp32/machine_pwm.c index 9d5d9595e1..9308fcd3cb 100755 --- a/ports/esp32/machine_pwm.c +++ b/ports/esp32/machine_pwm.c @@ -71,15 +71,14 @@ STATIC ledc_timer_config_t timers[PWM_TIMER_MAX]; #define TIMER_IDX_TO_MODE(timer_idx) (timer_idx / LEDC_TIMER_MAX) #define TIMER_IDX_TO_TIMER(timer_idx) (timer_idx % LEDC_TIMER_MAX) -// Params for PW operation +// Params for PWM operation // 5khz is default frequency -#define PWFREQ (5000) - -// 10-bit resolution (compatible with esp8266 PWM) -#define PWRES (LEDC_TIMER_10_BIT) +#define PWM_FREQ (5000) +// default 10-bit resolution (compatible with esp8266 PWM) +#define PWM_RES_10_BIT (LEDC_TIMER_10_BIT) // Maximum duty value on 10-bit resolution -#define MAX_DUTY_U10 ((1 << PWRES) - 1) +#define MAX_DUTY_U10 ((1 << PWM_RES_10_BIT) - 1) // https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/ledc.html#supported-range-of-frequency-and-duty-resolutions // duty() uses 10-bit resolution or less // duty_u16() and duty_ns() use 16-bit resolution or less @@ -94,8 +93,6 @@ STATIC ledc_timer_config_t timers[PWM_TIMER_MAX]; #define UI_RES_16_BIT (16) // Maximum duty value on highest user interface resolution #define UI_MAX_DUTY ((1 << UI_RES_16_BIT) - 1) -// How much to shift from the HIGHEST_PWM_RES duty resolution to the user interface duty resolution UI_RES_16_BIT -#define UI_RES_SHIFT (UI_RES_16_BIT - HIGHEST_PWM_RES) // 0 for ESP32, 2 for S2, S3, C3 // If the PWM frequency is less than EMPIRIC_FREQ, then LEDC_REF_CLK_HZ(1 MHz) source is used, else LEDC_APB_CLK_HZ(80 MHz) source is used #define EMPIRIC_FREQ (10) // Hz @@ -111,7 +108,7 @@ typedef struct _machine_pwm_obj_t { int mode; int channel; int timer; - int duty_x; // PWRES if duty(), HIGHEST_PWM_RES if duty_u16(), -HIGHEST_PWM_RES if duty_ns() + int duty_x; // PWM_RES_10_BIT if duty(), UI_RES_16_BIT if duty_u16(), -UI_RES_16_BIT if duty_ns() int duty_u10; // stored values from previous duty setters int duty_u16; // - / - int duty_ns; // - / - @@ -264,11 +261,11 @@ STATIC void set_freq(machine_pwm_obj_t *self, unsigned int freq, ledc_timer_conf // Save the same duty cycle when frequency is changed if (save_duty_resolution != timer->duty_resolution) { - if (self->duty_x == HIGHEST_PWM_RES) { + if (self->duty_x == UI_RES_16_BIT) { set_duty_u16(self, self->duty_u16); - } else if (self->duty_x == PWRES) { + } else if (self->duty_x == PWM_RES_10_BIT) { set_duty_u10(self, self->duty_u10); - } else if (self->duty_x == -HIGHEST_PWM_RES) { + } else if (self->duty_x == -UI_RES_16_BIT) { set_duty_ns(self, self->duty_ns); } } @@ -296,7 +293,7 @@ STATIC int duty_to_ns(machine_pwm_obj_t *self, int duty) { #define get_duty_raw(self) ledc_get_duty(self->mode, self->channel) STATIC uint32_t get_duty_u16(machine_pwm_obj_t *self) { - return ledc_get_duty(self->mode, self->channel) << (HIGHEST_PWM_RES + UI_RES_SHIFT - timers[TIMER_IDX(self->mode, self->timer)].duty_resolution); + return ledc_get_duty(self->mode, self->channel) << (UI_RES_16_BIT - timers[TIMER_IDX(self->mode, self->timer)].duty_resolution); } STATIC uint32_t get_duty_u10(machine_pwm_obj_t *self) { @@ -312,7 +309,7 @@ STATIC void set_duty_u16(machine_pwm_obj_t *self, int duty) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("duty_u16 must be from 0 to %d"), UI_MAX_DUTY); } ledc_timer_config_t timer = timers[TIMER_IDX(self->mode, self->timer)]; - int channel_duty = duty >> (HIGHEST_PWM_RES + UI_RES_SHIFT - timer.duty_resolution); + int channel_duty = duty >> (UI_RES_16_BIT - timer.duty_resolution); int max_duty = (1 << timer.duty_resolution) - 1; if (channel_duty < 0) { channel_duty = 0; @@ -336,7 +333,7 @@ STATIC void set_duty_u16(machine_pwm_obj_t *self, int duty) { } */ - self->duty_x = HIGHEST_PWM_RES; + self->duty_x = UI_RES_16_BIT; self->duty_u16 = duty; } @@ -344,8 +341,8 @@ STATIC void set_duty_u10(machine_pwm_obj_t *self, int duty) { if ((duty < 0) || (duty > MAX_DUTY_U10)) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("duty must be from 0 to %u"), MAX_DUTY_U10); } - set_duty_u16(self, duty << (HIGHEST_PWM_RES + UI_RES_SHIFT - PWRES)); - self->duty_x = PWRES; + set_duty_u16(self, duty << (UI_RES_16_BIT - LEDC_TIMER_10_BIT)); + self->duty_x = PWM_RES_10_BIT; self->duty_u10 = duty; } @@ -354,7 +351,7 @@ STATIC void set_duty_ns(machine_pwm_obj_t *self, int ns) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("duty_ns must be from 0 to %d ns"), duty_to_ns(self, UI_MAX_DUTY)); } set_duty_u16(self, ns_to_duty(self, ns)); - self->duty_x = -HIGHEST_PWM_RES; + self->duty_x = -UI_RES_16_BIT; self->duty_ns = ns; } @@ -425,9 +422,9 @@ STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_p if (self->active) { mp_printf(print, ", freq=%u", ledc_get_freq(self->mode, self->timer)); - if (self->duty_x == PWRES) { + if (self->duty_x == PWM_RES_10_BIT) { mp_printf(print, ", duty=%d", get_duty_u10(self)); - } else if (self->duty_x == -HIGHEST_PWM_RES) { + } else if (self->duty_x == -UI_RES_16_BIT) { mp_printf(print, ", duty_ns=%d", get_duty_ns(self)); } else { mp_printf(print, ", duty_u16=%d", get_duty_u16(self)); @@ -479,7 +476,7 @@ STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, freq = timers[chans[channel_idx].timer_idx].freq_hz; } if (freq <= 0) { - freq = PWFREQ; + freq = PWM_FREQ; } } if ((freq <= 0) || (freq > 40000000)) { @@ -536,7 +533,7 @@ STATIC void mp_machine_pwm_init_helper(machine_pwm_obj_t *self, } else if (duty != -1) { set_duty_u10(self, duty); } else if (self->duty_x == 0) { - set_duty_u10(self, (1 << PWRES) / 2); // 50% + set_duty_u10(self, (1 << PWM_RES_10_BIT) / 2); // 50% } } From 1f04a9a1fcd4172f7c721e05a4515c9c8bb0e8c9 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 1 Feb 2022 16:58:56 +1100 Subject: [PATCH 0068/1712] esp32/esp32_rmt: Select correct last RMT channel on S2, S3, C3 variants. For example the ESP32-C3 has 2 TX channels and 2 RX channels in total, and in this case channel 1 must be the default for bitstream. Signed-off-by: Damien George --- ports/esp32/esp32_rmt.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ports/esp32/esp32_rmt.c b/ports/esp32/esp32_rmt.c index ca751d42a8..ac897e3336 100644 --- a/ports/esp32/esp32_rmt.c +++ b/ports/esp32/esp32_rmt.c @@ -47,6 +47,13 @@ // This current MicroPython implementation lacks some major features, notably receive pulses // and carrier output. +// Last available RMT channel that can transmit. +#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 4, 0) +#define RMT_LAST_TX_CHANNEL (RMT_CHANNEL_MAX - 1) +#else +#define RMT_LAST_TX_CHANNEL (SOC_RMT_TX_CANDIDATES_PER_GROUP - 1) +#endif + // Forward declaration extern const mp_obj_type_t esp32_rmt_type; @@ -62,7 +69,7 @@ typedef struct _esp32_rmt_obj_t { // Current channel used for machine.bitstream, in the machine_bitstream_high_low_rmt // implementation. A value of -1 means do not use RMT. -int8_t esp32_rmt_bitstream_channel_id = RMT_CHANNEL_MAX - 1; +int8_t esp32_rmt_bitstream_channel_id = RMT_LAST_TX_CHANNEL; #if MP_TASK_COREID == 0 @@ -336,7 +343,7 @@ STATIC mp_obj_t esp32_rmt_bitstream_channel(size_t n_args, const mp_obj_t *args) esp32_rmt_bitstream_channel_id = -1; } else { mp_int_t channel_id = mp_obj_get_int(args[0]); - if (channel_id < 0 || channel_id >= RMT_CHANNEL_MAX) { + if (channel_id < 0 || channel_id > RMT_LAST_TX_CHANNEL) { mp_raise_ValueError(MP_ERROR_TEXT("invalid channel")); } esp32_rmt_bitstream_channel_id = channel_id; From eae2e3516ca4067ca8cfeb51ac8a6505cb6324b7 Mon Sep 17 00:00:00 2001 From: Michael O'Cleirigh Date: Fri, 28 Jan 2022 00:35:53 -0500 Subject: [PATCH 0069/1712] esp32/main: Automatically size SPIRAM heap when allocated using malloc. This change allows the same heap allocation rules to be used when using malloc regardless if the board has SPRAM or normal RAM. Integrating with the esp32-camera for example requires that ESP32 SPRAM be allocatable using the esp-idf capabilities aware allocation functions. In the case of esp32-camera it's for the framebuffer. Detect when CONFIG_SPIRAM_USE_MALLOC is in use and use the standard automatic configuration of leaving 1/2 of the SPRAM available to other FreeRTOS tasks. --- ports/esp32/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ports/esp32/main.c b/ports/esp32/main.c index e25e6fdd1c..6c5edbb356 100644 --- a/ports/esp32/main.c +++ b/ports/esp32/main.c @@ -100,7 +100,10 @@ void mp_task(void *pvParameter) { size_t mp_task_heap_size; void *mp_task_heap = NULL; - #if CONFIG_ESP32_SPIRAM_SUPPORT + #if CONFIG_SPIRAM_USE_MALLOC + // SPIRAM is issued using MALLOC, fallback to normal allocation rules + mp_task_heap = NULL; + #elif CONFIG_ESP32_SPIRAM_SUPPORT // Try to use the entire external SPIRAM directly for the heap mp_task_heap = (void *)SOC_EXTRAM_DATA_LOW; switch (esp_spiram_get_chip_size()) { From b18d4392b4a4c5e6ed50dbcdb4a88828703289cb Mon Sep 17 00:00:00 2001 From: Emil Kondayan Date: Thu, 27 Jan 2022 16:05:59 +0200 Subject: [PATCH 0070/1712] esp32/adc: Fix wrong mapping between ADC2 channel and GPIO number. According to the IO_MUX table in the ESP32 datasheet, the ADC2 channels are mapped to different GPIO numbers. --- ports/esp32/machine_adc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ports/esp32/machine_adc.c b/ports/esp32/machine_adc.c index f6bc7b9639..515d629a7e 100644 --- a/ports/esp32/machine_adc.c +++ b/ports/esp32/machine_adc.c @@ -50,16 +50,16 @@ STATIC const madc_obj_t madc_obj[] = { {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_5, GPIO_NUM_33}, {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_6, GPIO_NUM_34}, {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_7, GPIO_NUM_35}, - {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_0, GPIO_NUM_0}, - {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_1, GPIO_NUM_2}, - {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_2, GPIO_NUM_4}, - {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_3, GPIO_NUM_12}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_0, GPIO_NUM_4}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_1, GPIO_NUM_0}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_2, GPIO_NUM_2}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_3, GPIO_NUM_15}, {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_4, GPIO_NUM_13}, - {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_5, GPIO_NUM_14}, - {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_6, GPIO_NUM_15}, - {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_7, GPIO_NUM_25}, - {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_8, GPIO_NUM_26}, - {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_9, GPIO_NUM_27}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_5, GPIO_NUM_12}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_6, GPIO_NUM_14}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_7, GPIO_NUM_27}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_8, GPIO_NUM_25}, + {{&machine_adc_type}, ADCBLOCK2, ADC_CHANNEL_9, GPIO_NUM_26}, #elif CONFIG_IDF_TARGET_ESP32C3 {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_0, GPIO_NUM_0}, {{&machine_adc_type}, ADCBLOCK1, ADC_CHANNEL_1, GPIO_NUM_1}, From 872bab6b3c967deaeff5f0f3d0d066c3fde03802 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 2 Feb 2022 16:20:41 +1100 Subject: [PATCH 0071/1712] esp32: Remove unneeded modesp.h. Made redundant by 71f4faac2732d932dcc03bdbc9f80434e5757edb Signed-off-by: Damien George --- ports/esp32/modesp.c | 1 - ports/esp32/modesp.h | 1 - 2 files changed, 2 deletions(-) delete mode 100644 ports/esp32/modesp.h diff --git a/ports/esp32/modesp.c b/ports/esp32/modesp.c index 8c94e0cf41..b5beaf5053 100644 --- a/ports/esp32/modesp.c +++ b/ports/esp32/modesp.c @@ -36,7 +36,6 @@ #include "py/mperrno.h" #include "py/mphal.h" #include "drivers/dht/dht.h" -#include "modesp.h" STATIC mp_obj_t esp_osdebug(size_t n_args, const mp_obj_t *args) { esp_log_level_t level = LOG_LOCAL_LEVEL; diff --git a/ports/esp32/modesp.h b/ports/esp32/modesp.h deleted file mode 100644 index a822c02ecc..0000000000 --- a/ports/esp32/modesp.h +++ /dev/null @@ -1 +0,0 @@ -void esp_neopixel_write(uint8_t pin, uint8_t *pixels, uint32_t numBytes, uint8_t timing); From 326b2c79dfaf472d67e5e3fee5868e78ccc6be73 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 2 Feb 2022 16:27:10 +1100 Subject: [PATCH 0072/1712] docs: Remove reference to obsolete neopixel_write function. It has been replaced by machine.bitstream. Signed-off-by: Damien George --- docs/esp32/quickref.rst | 8 ++------ docs/esp8266/quickref.rst | 6 +----- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst index 94b5d966ed..de107ee25c 100644 --- a/docs/esp32/quickref.rst +++ b/docs/esp32/quickref.rst @@ -599,18 +599,14 @@ The APA106 driver extends NeoPixel, but internally uses a different colour order ap = APA106(pin, 8) r, g, b = ap[0] -For low-level driving of a NeoPixel:: - - import esp - esp.neopixel_write(pin, grb_buf, is800khz) - .. Warning:: By default ``NeoPixel`` is configured to control the more popular *800kHz* units. It is possible to use alternative timing to control other (typically 400kHz) devices by passing ``timing=0`` when constructing the ``NeoPixel`` object. -The low-level driver uses an RMT channel by default. To configure this see +For low-level driving of a NeoPixel see `machine.bitstream`. +This low-level driver uses an RMT channel by default. To configure this see `RMT.bitstream_channel`. APA102 (DotStar) uses a different driver as it has an additional clock pin. diff --git a/docs/esp8266/quickref.rst b/docs/esp8266/quickref.rst index 9e64723b27..4e00a92260 100644 --- a/docs/esp8266/quickref.rst +++ b/docs/esp8266/quickref.rst @@ -374,17 +374,13 @@ Use the ``neopixel`` module:: np.write() # write data to all pixels r, g, b = np[0] # get first pixel colour -For low-level driving of a NeoPixel:: - - import esp - esp.neopixel_write(pin, grb_buf, is800khz) - .. Warning:: By default ``NeoPixel`` is configured to control the more popular *800kHz* units. It is possible to use alternative timing to control other (typically 400kHz) devices by passing ``timing=0`` when constructing the ``NeoPixel`` object. +For low-level driving of a NeoPixel see `machine.bitstream`. APA102 driver ------------- From ab2923dfa1174dc177f0a90cb00a7e4ff87958d2 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 2 Feb 2022 16:11:25 +1100 Subject: [PATCH 0073/1712] all: Update Python formatting to latest Black version 22.1.0. Signed-off-by: Damien George --- examples/rp2/pio_pwm.py | 2 +- tests/cpydiff/modules_random_randint.py | 2 +- tests/float/complex1.py | 14 ++++----- tests/float/float1.py | 2 +- tests/float/float2int_doubleprec_intbig.py | 36 +++++++++++----------- tests/float/float2int_fp30_intbig.py | 36 +++++++++++----------- tests/float/float2int_intbig.py | 36 +++++++++++----------- tests/float/inf_nan_arith.py | 2 +- tests/float/int_big_float.py | 2 +- tests/float/int_divzero.py | 2 +- tests/float/int_power.py | 2 +- tests/micropython/import_mpy_native_x64.py | 2 +- tests/misc/rge_sm.py | 12 ++++---- tests/perf_bench/bm_chaos.py | 2 +- tests/perf_bench/misc_raytrace.py | 8 ++--- tests/run-perfbench.py | 6 ++-- 16 files changed, 83 insertions(+), 83 deletions(-) diff --git a/examples/rp2/pio_pwm.py b/examples/rp2/pio_pwm.py index 8e87448ca8..176a238091 100644 --- a/examples/rp2/pio_pwm.py +++ b/examples/rp2/pio_pwm.py @@ -41,5 +41,5 @@ pwm = PIOPWM(0, 25, max_count=(1 << 16) - 1, count_freq=10_000_000) while True: for i in range(256): - pwm.set(i ** 2) + pwm.set(i**2) sleep(0.01) diff --git a/tests/cpydiff/modules_random_randint.py b/tests/cpydiff/modules_random_randint.py index b05908a157..90607400cd 100644 --- a/tests/cpydiff/modules_random_randint.py +++ b/tests/cpydiff/modules_random_randint.py @@ -8,5 +8,5 @@ workaround: If you need integers larger than native wordsize use the random modu import random -x = random.randint(2 ** 128 - 1, 2 ** 128) +x = random.randint(2**128 - 1, 2**128) print("x={}".format(x)) diff --git a/tests/float/complex1.py b/tests/float/complex1.py index a510ffc830..139bb0c509 100644 --- a/tests/float/complex1.py +++ b/tests/float/complex1.py @@ -27,15 +27,15 @@ print(1j * 2j) print(1j / 2) print((1j / 2j).real) print(1j / (1 + 2j)) -ans = 0j ** 0 +ans = 0j**0 print("%.5g %.5g" % (ans.real, ans.imag)) -ans = 0j ** 1 +ans = 0j**1 print("%.5g %.5g" % (ans.real, ans.imag)) -ans = 0j ** 0j +ans = 0j**0j print("%.5g %.5g" % (ans.real, ans.imag)) -ans = 1j ** 2.5 +ans = 1j**2.5 print("%.5g %.5g" % (ans.real, ans.imag)) -ans = 1j ** 2.5j +ans = 1j**2.5j print("%.5g %.5g" % (ans.real, ans.imag)) # comparison @@ -116,10 +116,10 @@ except ZeroDivisionError: # zero division via power try: - 0j ** -1 + 0j**-1 except ZeroDivisionError: print("ZeroDivisionError") try: - 0j ** 1j + 0j**1j except ZeroDivisionError: print("ZeroDivisionError") diff --git a/tests/float/float1.py b/tests/float/float1.py index efde5146be..37f8b3face 100644 --- a/tests/float/float1.py +++ b/tests/float/float1.py @@ -88,7 +88,7 @@ except ZeroDivisionError: print("ZeroDivisionError") try: - 0.0 ** -1 + 0.0**-1 except ZeroDivisionError: print("ZeroDivisionError") diff --git a/tests/float/float2int_doubleprec_intbig.py b/tests/float/float2int_doubleprec_intbig.py index 418eddb607..adc76d4aeb 100644 --- a/tests/float/float2int_doubleprec_intbig.py +++ b/tests/float/float2int_doubleprec_intbig.py @@ -35,8 +35,8 @@ if ll_type != 0: print(int(1418774543.0)) print("%d" % 1418774543.0) if ll_type == 3: - print(int(2.0 ** 100)) - print("%d" % 2.0 ** 100) + print(int(2.0**100)) + print("%d" % 2.0**100) else: print(int(1073741823.0)) print("%d" % 1073741823.0) @@ -44,7 +44,7 @@ else: testpass = True p2_rng = ((30, 63, 1024), (62, 63, 1024))[is_64bit][ll_type] for i in range(0, p2_rng): - bitcnt = len(bin(int(2.0 ** i))) - 3 + bitcnt = len(bin(int(2.0**i))) - 3 if i != bitcnt: print("fail: 2**%u was %u bits long" % (i, bitcnt)) testpass = False @@ -53,7 +53,7 @@ print("power of 2 test: %s" % (testpass and "passed" or "failed")) testpass = True p10_rng = ((9, 18, 23), (18, 18, 23))[is_64bit][ll_type] for i in range(0, p10_rng): - digcnt = len(str(int(10.0 ** i))) - 1 + digcnt = len(str(int(10.0**i))) - 1 if i != digcnt: print("fail: 10**%u was %u digits long" % (i, digcnt)) testpass = False @@ -72,28 +72,28 @@ def fp2int_test(num, name, should_fail): if ll_type != 2: if ll_type == 0: if is_64bit: - neg_bad_fp = -1.00000005 * 2.0 ** 62.0 - pos_bad_fp = 2.0 ** 62.0 - neg_good_fp = -(2.0 ** 62.0) - pos_good_fp = 0.99999993 * 2.0 ** 62.0 + neg_bad_fp = -1.00000005 * 2.0**62.0 + pos_bad_fp = 2.0**62.0 + neg_good_fp = -(2.0**62.0) + pos_good_fp = 0.99999993 * 2.0**62.0 else: - neg_bad_fp = -1.00000005 * 2.0 ** 30.0 - pos_bad_fp = 2.0 ** 30.0 - neg_good_fp = -(2.0 ** 30.0) - pos_good_fp = 0.9999999499 * 2.0 ** 30.0 + neg_bad_fp = -1.00000005 * 2.0**30.0 + pos_bad_fp = 2.0**30.0 + neg_good_fp = -(2.0**30.0) + pos_good_fp = 0.9999999499 * 2.0**30.0 else: - neg_bad_fp = -0.51 * 2.0 ** 64.0 - pos_bad_fp = 2.0 ** 63.0 - neg_good_fp = -(2.0 ** 63.0) - pos_good_fp = 1.9999998 * 2.0 ** 62.0 + neg_bad_fp = -0.51 * 2.0**64.0 + pos_bad_fp = 2.0**63.0 + neg_good_fp = -(2.0**63.0) + pos_good_fp = 1.9999998 * 2.0**62.0 fp2int_test(neg_bad_fp, "neg bad", True) fp2int_test(pos_bad_fp, "pos bad", True) fp2int_test(neg_good_fp, "neg good", False) fp2int_test(pos_good_fp, "pos good", False) else: - fp2int_test(-1.9999999999999981 * 2.0 ** 1023.0, "large neg", False) - fp2int_test(1.9999999999999981 * 2.0 ** 1023.0, "large pos", False) + fp2int_test(-1.9999999999999981 * 2.0**1023.0, "large neg", False) + fp2int_test(1.9999999999999981 * 2.0**1023.0, "large pos", False) fp2int_test(float("inf"), "inf test", True) fp2int_test(float("-inf"), "inf test", True) diff --git a/tests/float/float2int_fp30_intbig.py b/tests/float/float2int_fp30_intbig.py index fcbe2e309f..4e3c1fa217 100644 --- a/tests/float/float2int_fp30_intbig.py +++ b/tests/float/float2int_fp30_intbig.py @@ -34,13 +34,13 @@ if ll_type is None: print(int(14187744.0)) print("%d" % 14187744.0) if ll_type == 2: - print(int(2.0 ** 100)) - print("%d" % 2.0 ** 100) + print(int(2.0**100)) + print("%d" % 2.0**100) testpass = True p2_rng = ((30, 63, 127), (62, 63, 127))[is_64bit][ll_type] for i in range(0, p2_rng): - bitcnt = len(bin(int(2.0 ** i))) - 3 + bitcnt = len(bin(int(2.0**i))) - 3 if i != bitcnt: print("fail: 2.**%u was %u bits long" % (i, bitcnt)) testpass = False @@ -50,7 +50,7 @@ print("power of 2 test: %s" % (testpass and "passed" or "failed")) testpass = True p10_rng = 9 for i in range(0, p10_rng): - digcnt = len(str(int(10.0 ** i))) - 1 + digcnt = len(str(int(10.0**i))) - 1 if i != digcnt: print("fail: 10.**%u was %u digits long" % (i, digcnt)) testpass = False @@ -69,28 +69,28 @@ def fp2int_test(num, name, should_fail): if ll_type != 2: if ll_type == 0: if is_64bit: - neg_bad_fp = -1.00000005 * 2.0 ** 62.0 - pos_bad_fp = 2.0 ** 62.0 - neg_good_fp = -(2.0 ** 62.0) - pos_good_fp = 0.99999993 * 2.0 ** 62.0 + neg_bad_fp = -1.00000005 * 2.0**62.0 + pos_bad_fp = 2.0**62.0 + neg_good_fp = -(2.0**62.0) + pos_good_fp = 0.99999993 * 2.0**62.0 else: - neg_bad_fp = -1.00000005 * 2.0 ** 30.0 - pos_bad_fp = 2.0 ** 30.0 - neg_good_fp = -(2.0 ** 30.0) - pos_good_fp = 0.9999999499 * 2.0 ** 30.0 + neg_bad_fp = -1.00000005 * 2.0**30.0 + pos_bad_fp = 2.0**30.0 + neg_good_fp = -(2.0**30.0) + pos_good_fp = 0.9999999499 * 2.0**30.0 else: - neg_bad_fp = -0.51 * 2.0 ** 64.0 - pos_bad_fp = 2.0 ** 63.0 - neg_good_fp = -(2.0 ** 63.0) - pos_good_fp = 1.9999998 * 2.0 ** 62.0 + neg_bad_fp = -0.51 * 2.0**64.0 + pos_bad_fp = 2.0**63.0 + neg_good_fp = -(2.0**63.0) + pos_good_fp = 1.9999998 * 2.0**62.0 fp2int_test(neg_bad_fp, "neg bad", True) fp2int_test(pos_bad_fp, "pos bad", True) fp2int_test(neg_good_fp, "neg good", False) fp2int_test(pos_good_fp, "pos good", False) else: - fp2int_test(-1.999999879 * 2.0 ** 126.0, "large neg", False) - fp2int_test(1.999999879 * 2.0 ** 126.0, "large pos", False) + fp2int_test(-1.999999879 * 2.0**126.0, "large neg", False) + fp2int_test(1.999999879 * 2.0**126.0, "large pos", False) fp2int_test(float("inf"), "inf test", True) fp2int_test(float("-inf"), "inf test", True) diff --git a/tests/float/float2int_intbig.py b/tests/float/float2int_intbig.py index 865aeea7b9..739f98f804 100644 --- a/tests/float/float2int_intbig.py +++ b/tests/float/float2int_intbig.py @@ -37,13 +37,13 @@ print(int(14187745.)) print("%d" % 14187745.) # fmt: on if ll_type == 2: - print(int(2.0 ** 100)) - print("%d" % 2.0 ** 100) + print(int(2.0**100)) + print("%d" % 2.0**100) testpass = True p2_rng = ((30, 63, 127), (62, 63, 127))[is_64bit][ll_type] for i in range(0, p2_rng): - bitcnt = len(bin(int(2.0 ** i))) - 3 + bitcnt = len(bin(int(2.0**i))) - 3 if i != bitcnt: print("fail: 2.**%u was %u bits long" % (i, bitcnt)) testpass = False @@ -53,7 +53,7 @@ print("power of 2 test: %s" % (testpass and "passed" or "failed")) testpass = True p10_rng = 9 if (ll_type == 0 and ~is_64bit) else 11 for i in range(0, p10_rng): - digcnt = len(str(int(10.0 ** i))) - 1 + digcnt = len(str(int(10.0**i))) - 1 if i != digcnt: print("fail: 10.**%u was %u digits long" % (i, digcnt)) testpass = False @@ -72,28 +72,28 @@ def fp2int_test(num, name, should_fail): if ll_type != 2: if ll_type == 0: if is_64bit: - neg_bad_fp = -1.00000005 * 2.0 ** 62.0 - pos_bad_fp = 2.0 ** 62.0 - neg_good_fp = -(2.0 ** 62.0) - pos_good_fp = 0.99999993 * 2.0 ** 62.0 + neg_bad_fp = -1.00000005 * 2.0**62.0 + pos_bad_fp = 2.0**62.0 + neg_good_fp = -(2.0**62.0) + pos_good_fp = 0.99999993 * 2.0**62.0 else: - neg_bad_fp = -1.00000005 * 2.0 ** 30.0 - pos_bad_fp = 2.0 ** 30.0 - neg_good_fp = -(2.0 ** 30.0) - pos_good_fp = 0.9999999499 * 2.0 ** 30.0 + neg_bad_fp = -1.00000005 * 2.0**30.0 + pos_bad_fp = 2.0**30.0 + neg_good_fp = -(2.0**30.0) + pos_good_fp = 0.9999999499 * 2.0**30.0 else: - neg_bad_fp = -0.51 * 2.0 ** 64.0 - pos_bad_fp = 2.0 ** 63.0 - neg_good_fp = -(2.0 ** 63.0) - pos_good_fp = 1.9999998 * 2.0 ** 62.0 + neg_bad_fp = -0.51 * 2.0**64.0 + pos_bad_fp = 2.0**63.0 + neg_good_fp = -(2.0**63.0) + pos_good_fp = 1.9999998 * 2.0**62.0 fp2int_test(neg_bad_fp, "neg bad", True) fp2int_test(pos_bad_fp, "pos bad", True) fp2int_test(neg_good_fp, "neg good", False) fp2int_test(pos_good_fp, "pos good", False) else: - fp2int_test(-1.999999879 * 2.0 ** 127.0, "large neg", False) - fp2int_test(1.999999879 * 2.0 ** 127.0, "large pos", False) + fp2int_test(-1.999999879 * 2.0**127.0, "large neg", False) + fp2int_test(1.999999879 * 2.0**127.0, "large pos", False) fp2int_test(float("inf"), "inf test", True) fp2int_test(float("nan"), "NaN test", True) diff --git a/tests/float/inf_nan_arith.py b/tests/float/inf_nan_arith.py index c27e38bc52..d1a6b18872 100644 --- a/tests/float/inf_nan_arith.py +++ b/tests/float/inf_nan_arith.py @@ -14,7 +14,7 @@ for x in values: except ZeroDivisionError: print(" / ZeroDivisionError") try: - print(" ** pow", x ** y, pow(x, y)) + print(" ** pow", x**y, pow(x, y)) except ZeroDivisionError: print(" ** pow ZeroDivisionError") print(" == != < <= > >=", x == y, x != y, x < y, x <= y, x > y, x >= y) diff --git a/tests/float/int_big_float.py b/tests/float/int_big_float.py index 0bd1662186..dc13e8e0dd 100644 --- a/tests/float/int_big_float.py +++ b/tests/float/int_big_float.py @@ -19,7 +19,7 @@ print("%.5g" % (i / 1.2)) print("%.5g" % (i * 1.2j).imag) # negative power should produce float -print("%.5g" % (i ** -1)) +print("%.5g" % (i**-1)) print("%.5g" % ((2 + i - i) ** -3)) try: diff --git a/tests/float/int_divzero.py b/tests/float/int_divzero.py index b311a1dbcf..ef3531bee8 100644 --- a/tests/float/int_divzero.py +++ b/tests/float/int_divzero.py @@ -4,6 +4,6 @@ except ZeroDivisionError: print("ZeroDivisionError") try: - 0 ** -1 + 0**-1 except ZeroDivisionError: print("ZeroDivisionError") diff --git a/tests/float/int_power.py b/tests/float/int_power.py index ba79247a56..bcda0f98ed 100644 --- a/tests/float/int_power.py +++ b/tests/float/int_power.py @@ -1,7 +1,7 @@ # negative power should produce float x = 2 -print(x ** -2) +print(x**-2) x = 3 x **= -2 diff --git a/tests/micropython/import_mpy_native_x64.py b/tests/micropython/import_mpy_native_x64.py index cad59e9916..ff0142a9cf 100644 --- a/tests/micropython/import_mpy_native_x64.py +++ b/tests/micropython/import_mpy_native_x64.py @@ -9,7 +9,7 @@ except (ImportError, AttributeError): print("SKIP") raise SystemExit -if not (usys.platform == "linux" and usys.maxsize > 2 ** 32): +if not (usys.platform == "linux" and usys.maxsize > 2**32): print("SKIP") raise SystemExit diff --git a/tests/misc/rge_sm.py b/tests/misc/rge_sm.py index f3bb4189f7..00b0a7a021 100644 --- a/tests/misc/rge_sm.py +++ b/tests/misc/rge_sm.py @@ -52,12 +52,12 @@ class RungeKutta(object): # couplings are: g1, g2, g3 of U(1), SU(2), SU(3); yt (top Yukawa), lambda (Higgs quartic) # see arxiv.org/abs/0812.4950, eqs 10-15 sysSM = ( - lambda *a: 41.0 / 96.0 / math.pi ** 2 * a[1] ** 3, # g1 - lambda *a: -19.0 / 96.0 / math.pi ** 2 * a[2] ** 3, # g2 - lambda *a: -42.0 / 96.0 / math.pi ** 2 * a[3] ** 3, # g3 + lambda *a: 41.0 / 96.0 / math.pi**2 * a[1] ** 3, # g1 + lambda *a: -19.0 / 96.0 / math.pi**2 * a[2] ** 3, # g2 + lambda *a: -42.0 / 96.0 / math.pi**2 * a[3] ** 3, # g3 lambda *a: 1.0 / 16.0 - / math.pi ** 2 + / math.pi**2 * ( 9.0 / 2.0 * a[4] ** 3 - 8.0 * a[3] ** 2 * a[4] @@ -66,7 +66,7 @@ sysSM = ( ), # yt lambda *a: 1.0 / 16.0 - / math.pi ** 2 + / math.pi**2 * ( 24.0 * a[5] ** 2 + 12.0 * a[4] ** 2 * a[5] @@ -137,5 +137,5 @@ def singleTraj(system, trajStart, h=0.02, tend=1.0): # initial conditions at M_Z singleTraj( - sysSM, [0.354, 0.654, 1.278, 0.983, 0.131], h=0.5, tend=math.log(10 ** 17) + sysSM, [0.354, 0.654, 1.278, 0.983, 0.131], h=0.5, tend=math.log(10**17) ) # true values diff --git a/tests/perf_bench/bm_chaos.py b/tests/perf_bench/bm_chaos.py index 55d282561f..d0f1337db7 100644 --- a/tests/perf_bench/bm_chaos.py +++ b/tests/perf_bench/bm_chaos.py @@ -15,7 +15,7 @@ class GVector(object): self.z = z def Mag(self): - return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2) + return math.sqrt(self.x**2 + self.y**2 + self.z**2) def dist(self, other): return math.sqrt( diff --git a/tests/perf_bench/misc_raytrace.py b/tests/perf_bench/misc_raytrace.py index b51acaccac..a729af99c2 100644 --- a/tests/perf_bench/misc_raytrace.py +++ b/tests/perf_bench/misc_raytrace.py @@ -22,7 +22,7 @@ class Vec: return Vec(self.x * rhs, self.y * rhs, self.z * rhs) def length(self): - return (self.x ** 2 + self.y ** 2 + self.z ** 2) ** 0.5 + return (self.x**2 + self.y**2 + self.z**2) ** 0.5 def normalise(self): l = self.length() @@ -87,12 +87,12 @@ class Sphere: def __init__(self, surface, centre, radius): self.surface = surface self.centre = centre - self.radsq = radius ** 2 + self.radsq = radius**2 def intersect(self, ray): v = self.centre - ray.p b = v.dot(ray.d) - det = b ** 2 - v.dot(v) + self.radsq + det = b**2 - v.dot(v) + self.radsq if det > 0: det **= 0.5 t1 = b - det @@ -180,7 +180,7 @@ def trace_ray(scene, ray, depth): if ndotl > 0: col += light_col * surf.diffuse * ndotl if ldotv > 0: - col += light_col * surf.specular * ldotv ** surf.spec_idx + col += light_col * surf.specular * ldotv**surf.spec_idx # Reflections if depth > 0 and surf.reflect > 0: diff --git a/tests/run-perfbench.py b/tests/run-perfbench.py index bcdbe69abb..5f299281fd 100755 --- a/tests/run-perfbench.py +++ b/tests/run-perfbench.py @@ -33,8 +33,8 @@ def compute_stats(lst): avg += x var += x * x avg /= len(lst) - var = max(0, var / len(lst) - avg ** 2) - return avg, var ** 0.5 + var = max(0, var / len(lst) - avg**2) + return avg, var**0.5 def run_script_on_target(target, script): @@ -201,7 +201,7 @@ def compute_diff(file1, file2, diff_score): sd1 *= av1 / 100 # convert from percent sd to absolute sd sd2 *= av2 / 100 # convert from percent sd to absolute sd av_diff = av2 - av1 - sd_diff = (sd1 ** 2 + sd2 ** 2) ** 0.5 + sd_diff = (sd1**2 + sd2**2) ** 0.5 percent = 100 * av_diff / av1 percent_sd = 100 * sd_diff / av1 print( From feeeb5ea3afe801b381eb5d4b310e83290634c46 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 2 Feb 2022 16:14:09 +1100 Subject: [PATCH 0074/1712] top: Update .git-blame-ignore-revs for latest Black formatting commits. Signed-off-by: Damien George --- .git-blame-ignore-revs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index c5039f58b5..fbd35fd2c2 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,3 +1,9 @@ +# all: Update Python formatting to latest Black version 22.1.0. +ab2923dfa1174dc177f0a90cb00a7e4ff87958d2 + +# all: Update Python formatting to latest Black version 21.12b0. +3770fab33449a5dadf8eb06edfae0767e75320a6 + # tools/gen-cpydiff.py: Fix formatting of doc strings for new Black. 0f78c36c5aa458a954eed39a46942209107a553e From 59b60995088ee4a9c0da400633f2096bd365971d Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 2 Feb 2022 20:14:05 +1100 Subject: [PATCH 0075/1712] tools/uf2conv.py: Update to latest version. Signed-off-by: Damien George --- tools/uf2conv.py | 129 ++++++++++++++++++++------- tools/uf2families.json | 192 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 291 insertions(+), 30 deletions(-) mode change 100755 => 100644 tools/uf2conv.py create mode 100644 tools/uf2families.json diff --git a/tools/uf2conv.py b/tools/uf2conv.py old mode 100755 new mode 100644 index d67a55224c..d3b1d9a265 --- a/tools/uf2conv.py +++ b/tools/uf2conv.py @@ -33,21 +33,13 @@ import re import os import os.path import argparse +import json UF2_MAGIC_START0 = 0x0A324655 # "UF2\n" UF2_MAGIC_START1 = 0x9E5D5157 # Randomly selected UF2_MAGIC_END = 0x0AB16F30 # Ditto -families = { - "SAMD21": 0x68ED2B88, - "SAMD51": 0x55114460, - "NRF52": 0x1B57745F, - "STM32F1": 0x5EE21072, - "STM32F4": 0x57755A57, - "ATMEGA32": 0x16573617, -} - INFO_FILE = "/INFO_UF2.TXT" appstartaddr = 0x2000 @@ -71,9 +63,14 @@ def is_hex(buf): def convert_from_uf2(buf): global appstartaddr + global familyid numblocks = len(buf) // 512 curraddr = None - outp = b"" + currfamilyid = None + families_found = {} + prev_flag = None + all_flags_same = True + outp = [] for blockno in range(numblocks): ptr = blockno * 512 block = buf[ptr : ptr + 512] @@ -88,9 +85,13 @@ def convert_from_uf2(buf): if datalen > 476: assert False, "Invalid UF2 data size at " + ptr newaddr = hd[3] - if curraddr == None: - appstartaddr = newaddr + if (hd[2] & 0x2000) and (currfamilyid == None): + currfamilyid = hd[7] + if curraddr == None or ((hd[2] & 0x2000) and hd[7] != currfamilyid): + currfamilyid = hd[7] curraddr = newaddr + if familyid == 0x0 or familyid == hd[7]: + appstartaddr = newaddr padding = newaddr - curraddr if padding < 0: assert False, "Block out of order at " + ptr @@ -101,19 +102,53 @@ def convert_from_uf2(buf): while padding > 0: padding -= 4 outp += b"\x00\x00\x00\x00" - outp += block[32 : 32 + datalen] + if familyid == 0x0 or ((hd[2] & 0x2000) and familyid == hd[7]): + outp.append(block[32 : 32 + datalen]) curraddr = newaddr + datalen - return outp + if hd[2] & 0x2000: + if hd[7] in families_found.keys(): + if families_found[hd[7]] > newaddr: + families_found[hd[7]] = newaddr + else: + families_found[hd[7]] = newaddr + if prev_flag == None: + prev_flag = hd[2] + if prev_flag != hd[2]: + all_flags_same = False + if blockno == (numblocks - 1): + print("--- UF2 File Header Info ---") + families = load_families() + for family_hex in families_found.keys(): + family_short_name = "" + for name, value in families.items(): + if value == family_hex: + family_short_name = name + print( + "Family ID is {:s}, hex value is 0x{:08x}".format( + family_short_name, family_hex + ) + ) + print("Target Address is 0x{:08x}".format(families_found[family_hex])) + if all_flags_same: + print("All block flag values consistent, 0x{:04x}".format(hd[2])) + else: + print("Flags were not all the same") + print("----------------------------") + if len(families_found) > 1 and familyid == 0x0: + outp = [] + appstartaddr = 0x0 + return b"".join(outp) def convert_to_carray(file_content): - outp = "const unsigned char bindata[] __attribute__((aligned(16))) = {" + outp = "const unsigned long bindata_len = %d;\n" % len(file_content) + outp += "const unsigned char bindata[] __attribute__((aligned(16))) = {" for i in range(len(file_content)): if i % 16 == 0: outp += "\n" - outp += "0x%02x, " % ord(file_content[i]) + outp += "0x%02x, " % file_content[i] outp += "\n};\n" - return outp + return bytes(outp, "utf-8") def convert_to_uf2(file_content): @@ -122,7 +157,7 @@ def convert_to_uf2(file_content): while len(datapadding) < 512 - 256 - 32 - 4: datapadding += b"\x00\x00\x00\x00" numblocks = (len(file_content) + 255) // 256 - outp = b"" + outp = [] for blockno in range(numblocks): ptr = 256 * blockno chunk = file_content[ptr : ptr + 256] @@ -144,8 +179,8 @@ def convert_to_uf2(file_content): chunk += b"\x00" block = hd + chunk + datapadding + struct.pack(b"= 3 and words[1] == "2" and words[2] == "FAT": drives.append(words[0]) @@ -270,7 +308,23 @@ def list_drives(): def write_file(name, buf): with open(name, "wb") as f: f.write(buf) - print("Wrote %d bytes to %s." % (len(buf), name)) + print("Wrote %d bytes to %s" % (len(buf), name)) + + +def load_families(): + # The expectation is that the `uf2families.json` file is in the same + # directory as this script. Make a path that works using `__file__` + # which contains the full path to this script. + filename = "uf2families.json" + pathname = os.path.join(os.path.dirname(os.path.abspath(__file__)), filename) + with open(pathname) as f: + raw_families = json.load(f) + + families = {} + for family in raw_families: + families[family["short_name"]] = int(family["id"], 0) + + return families def main(): @@ -303,6 +357,7 @@ def main(): parser.add_argument("-d", "--device", dest="device_path", help="select a device path to flash") parser.add_argument("-l", "--list", action="store_true", help="list connected devices") parser.add_argument("-c", "--convert", action="store_true", help="do not flash, just convert") + parser.add_argument("-D", "--deploy", action="store_true", help="just flash, do not convert") parser.add_argument( "-f", "--family", @@ -314,9 +369,17 @@ def main(): parser.add_argument( "-C", "--carray", action="store_true", help="convert binary file to a C array, not UF2" ) + parser.add_argument( + "-i", + "--info", + action="store_true", + help="display header information from UF2, do not convert", + ) args = parser.parse_args() appstartaddr = int(args.base, 0) + families = load_families() + if args.family.upper() in families: familyid = families[args.family.upper()] else: @@ -334,9 +397,14 @@ def main(): inpbuf = f.read() from_uf2 = is_uf2(inpbuf) ext = "uf2" - if from_uf2: + if args.deploy: + outbuf = inpbuf + elif from_uf2 and not args.info: outbuf = convert_from_uf2(inpbuf) ext = "bin" + elif from_uf2 and args.info: + outbuf = "" + convert_from_uf2(inpbuf) elif is_hex(inpbuf): outbuf = convert_from_hex_to_uf2(inpbuf.decode("utf-8")) elif args.carray: @@ -344,11 +412,12 @@ def main(): ext = "h" else: outbuf = convert_to_uf2(inpbuf) - print( - "Converting to %s, output size: %d, start address: 0x%x" - % (ext, len(outbuf), appstartaddr) - ) - if args.convert: + if not args.deploy and not args.info: + print( + "Converted to %s, output size: %d, start address: 0x%x" + % (ext, len(outbuf), appstartaddr) + ) + if args.convert or ext != "uf2": drives = [] if args.output == None: args.output = "flash." + ext diff --git a/tools/uf2families.json b/tools/uf2families.json new file mode 100644 index 0000000000..fafae82a60 --- /dev/null +++ b/tools/uf2families.json @@ -0,0 +1,192 @@ +[ + { + "id": "0x16573617", + "short_name": "ATMEGA32", + "description": "Microchip (Atmel) ATmega32" + }, + { + "id": "0x1851780a", + "short_name": "SAML21", + "description": "Microchip (Atmel) SAML21" + }, + { + "id": "0x1b57745f", + "short_name": "NRF52", + "description": "Nordic NRF52" + }, + { + "id": "0x1c5f21b0", + "short_name": "ESP32", + "description": "ESP32" + }, + { + "id": "0x1e1f432d", + "short_name": "STM32L1", + "description": "ST STM32L1xx" + }, + { + "id": "0x202e3a91", + "short_name": "STM32L0", + "description": "ST STM32L0xx" + }, + { + "id": "0x21460ff0", + "short_name": "STM32WL", + "description": "ST STM32WLxx" + }, + { + "id": "0x2abc77ec", + "short_name": "LPC55", + "description": "NXP LPC55xx" + }, + { + "id": "0x300f5633", + "short_name": "STM32G0", + "description": "ST STM32G0xx" + }, + { + "id": "0x31d228c6", + "short_name": "GD32F350", + "description": "GD32F350" + }, + { + "id": "0x04240bdf", + "short_name": "STM32L5", + "description": "ST STM32L5xx" + }, + { + "id": "0x4c71240a", + "short_name": "STM32G4", + "description": "ST STM32G4xx" + }, + { + "id": "0x4fb2d5bd", + "short_name": "MIMXRT10XX", + "description": "NXP i.MX RT10XX" + }, + { + "id": "0x53b80f00", + "short_name": "STM32F7", + "description": "ST STM32F7xx" + }, + { + "id": "0x55114460", + "short_name": "SAMD51", + "description": "Microchip (Atmel) SAMD51" + }, + { + "id": "0x57755a57", + "short_name": "STM32F4", + "description": "ST STM32F401" + }, + { + "id": "0x5a18069b", + "short_name": "FX2", + "description": "Cypress FX2" + }, + { + "id": "0x5d1a0a2e", + "short_name": "STM32F2", + "description": "ST STM32F2xx" + }, + { + "id": "0x5ee21072", + "short_name": "STM32F1", + "description": "ST STM32F103" + }, + { + "id": "0x621e937a", + "short_name": "NRF52833", + "description": "Nordic NRF52833" + }, + { + "id": "0x647824b6", + "short_name": "STM32F0", + "description": "ST STM32F0xx" + }, + { + "id": "0x68ed2b88", + "short_name": "SAMD21", + "description": "Microchip (Atmel) SAMD21" + }, + { + "id": "0x6b846188", + "short_name": "STM32F3", + "description": "ST STM32F3xx" + }, + { + "id": "0x6d0922fa", + "short_name": "STM32F407", + "description": "ST STM32F407" + }, + { + "id": "0x6db66082", + "short_name": "STM32H7", + "description": "ST STM32H7xx" + }, + { + "id": "0x70d16653", + "short_name": "STM32WB", + "description": "ST STM32WBxx" + }, + { + "id": "0x7eab61ed", + "short_name": "ESP8266", + "description": "ESP8266" + }, + { + "id": "0x7f83e793", + "short_name": "KL32L2", + "description": "NXP KL32L2x" + }, + { + "id": "0x8fb060fe", + "short_name": "STM32F407VG", + "description": "ST STM32F407VG" + }, + { + "id": "0xada52840", + "short_name": "NRF52840", + "description": "Nordic NRF52840" + }, + { + "id": "0xbfdd4eee", + "short_name": "ESP32S2", + "description": "ESP32-S2" + }, + { + "id": "0xc47e5767", + "short_name": "ESP32S3", + "description": "ESP32-S3" + }, + { + "id": "0xd42ba06c", + "short_name": "ESP32C3", + "description": "ESP32-C3" + }, + { + "id": "0x2b88d29c", + "short_name": "ESP32C2", + "description": "ESP32-C2" + }, + { + "id": "0x332726f6", + "short_name": "ESP32H2", + "description": "ESP32-H2" + }, + { + "id": "0xe48bff56", + "short_name": "RP2040", + "description": "Raspberry Pi RP2040" + }, + { + "id": "0x00ff6919", + "short_name": "STM32L4", + "description": "ST STM32L4xx" + }, + { + "id": "0x9af03e33", + "short_name": "GD32VF103", + "description": "GigaDevice GD32VF103" + } +] From 71b3ce3aceb25139d3f41af9441ade9d446498bb Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 2 Feb 2022 20:14:37 +1100 Subject: [PATCH 0076/1712] esp32: Create .uf2 binaries for S2 and S3 chips. The name of the filesystem partition is updated to support "ffat", as used by TinyUF2. Signed-off-by: Damien George --- ports/esp32/Makefile | 5 +++-- ports/esp32/makeimg.py | 31 +++++++++++++++++++++++++++++-- ports/esp32/modules/flashbdev.py | 3 +++ 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/ports/esp32/Makefile b/ports/esp32/Makefile index 403b698a32..c8ca9262c8 100644 --- a/ports/esp32/Makefile +++ b/ports/esp32/Makefile @@ -36,8 +36,9 @@ all: $(BUILD)/sdkconfig \ $(BUILD)/bootloader/bootloader.bin \ $(BUILD)/partition_table/partition-table.bin \ - $(BUILD)/micropython.bin \ - $(BUILD)/firmware.bin + $(BUILD)/micropython.bin \ + $(BUILD)/firmware.bin \ + $(BUILD)/micropython.uf2 $(BUILD)/bootloader/bootloader.bin $(BUILD)/partition_table/partition-table.bin $(BUILD)/micropython.bin: FORCE diff --git a/ports/esp32/makeimg.py b/ports/esp32/makeimg.py index 0646ce372c..5964e91d28 100644 --- a/ports/esp32/makeimg.py +++ b/ports/esp32/makeimg.py @@ -10,15 +10,29 @@ OFFSET_BOOTLOADER_DEFAULT = 0x1000 OFFSET_PARTITIONS_DEFAULT = 0x8000 -def load_sdkconfig_hex_value(filename, value, default): +def load_sdkconfig_value(filename, value, default): value = "CONFIG_" + value + "=" with open(filename, "r") as f: for line in f: if line.startswith(value): - return int(line.split("=", 1)[1], 16) + return line.split("=", 1)[1] return default +def load_sdkconfig_hex_value(filename, value, default): + value = load_sdkconfig_value(filename, value, None) + if value is None: + return default + return int(value, 16) + + +def load_sdkconfig_str_value(filename, value, default): + value = load_sdkconfig_value(filename, value, None) + if value is None: + return default + return value.strip().strip('"') + + def load_partition_table(filename): with open(filename, "rb") as f: return gen_esp32part.PartitionTable.from_binary(f.read()) @@ -30,8 +44,10 @@ arg_bootloader_bin = sys.argv[2] arg_partitions_bin = sys.argv[3] arg_application_bin = sys.argv[4] arg_output_bin = sys.argv[5] +arg_output_uf2 = sys.argv[6] # Load required sdkconfig values. +idf_target = load_sdkconfig_str_value(arg_sdkconfig, "IDF_TARGET", "").upper() offset_bootloader = load_sdkconfig_hex_value( arg_sdkconfig, "BOOTLOADER_OFFSET_IN_FLASH", OFFSET_BOOTLOADER_DEFAULT ) @@ -85,3 +101,14 @@ with open(file_out, "wb") as fout: ) sys.exit(1) print("%-22s% 8d" % ("total", cur_offset)) + +# Generate .uf2 file if the SoC has native USB. +if idf_target in ("ESP32S2", "ESP32S3"): + sys.path.append(os.path.join(os.path.dirname(__file__), "../../tools")) + import uf2conv + + families = uf2conv.load_families() + uf2conv.appstartaddr = 0 + uf2conv.familyid = families[idf_target] + with open(arg_application_bin, "rb") as fin, open(arg_output_uf2, "wb") as fout: + fout.write(uf2conv.convert_to_uf2(fin.read())) diff --git a/ports/esp32/modules/flashbdev.py b/ports/esp32/modules/flashbdev.py index bf4fec9f38..c3f75c7a7e 100644 --- a/ports/esp32/modules/flashbdev.py +++ b/ports/esp32/modules/flashbdev.py @@ -1,4 +1,7 @@ from esp32 import Partition +# MicroPython's partition table uses "vfs", TinyUF2 uses "ffat". bdev = Partition.find(Partition.TYPE_DATA, label="vfs") +if not bdev: + bdev = Partition.find(Partition.TYPE_DATA, label="ffat") bdev = bdev[0] if bdev else None From 102cc12dbbe10c3caf3e1e141be4ab4366dbd02f Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 2 Feb 2022 20:15:51 +1100 Subject: [PATCH 0077/1712] tools/autobuild: Provide .uf2 images for esp32 builds when available. Signed-off-by: Damien George --- tools/autobuild/build-boards.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/autobuild/build-boards.sh b/tools/autobuild/build-boards.sh index 4b5259b667..c6493f8fc1 100755 --- a/tools/autobuild/build-boards.sh +++ b/tools/autobuild/build-boards.sh @@ -30,8 +30,8 @@ function build_board { dest=$dest_dir/$descr$fw_tag.$ext if [ -r $build_dir/firmware.$ext ]; then mv $build_dir/firmware.$ext $dest - else - # esp32 has micropython.elf and micropython.map + elif [ -r $build_dir/micropython.$ext ]; then + # esp32 has micropython.elf, etc mv $build_dir/micropython.$ext $dest fi done @@ -93,7 +93,7 @@ function build_esp32_boards { else if [ $mcu != esp32 ]; then # build esp32-s2/s3/c3 based boards with IDF v4.4+ - build_board $board_json $fw_tag $dest_dir bin elf map + build_board $board_json $fw_tag $dest_dir bin elf map uf2 fi fi done From fbd47fc46cce80abfc59e680600666473a1868da Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 2 Feb 2022 16:04:00 +1100 Subject: [PATCH 0078/1712] ports: Consolidate inclusion of umachine module in built-ins. The inclusion of `umachine` in the list of built-in modules is now done centrally in py/objmodule.c. Enabling MICROPY_PY_MACHINE will include this module. As part of this, all ports now have `umachine` as the core module name (previously some had only `machine` as the name). Signed-off-by: Damien George --- ports/cc3200/mods/modmachine.c | 2 +- ports/cc3200/mpconfigport.h | 4 +--- ports/esp32/mpconfigport.h | 2 -- ports/esp8266/mpconfigport.h | 2 -- ports/mimxrt/mpconfigport.h | 2 -- ports/nrf/modules/machine/modmachine.c | 2 +- ports/nrf/mpconfigport.h | 5 +---- ports/qemu-arm/mpconfigport.h | 1 - ports/rp2/mpconfigport.h | 2 -- ports/samd/mpconfigport.h | 2 -- ports/stm32/modmachine.c | 2 +- ports/stm32/mpconfigport.h | 9 +++------ ports/unix/mpconfigport.h | 2 -- ports/windows/mpconfigport.h | 1 - ports/zephyr/mpconfigport.h | 2 -- py/objmodule.c | 3 +++ 16 files changed, 11 insertions(+), 32 deletions(-) diff --git a/ports/cc3200/mods/modmachine.c b/ports/cc3200/mods/modmachine.c index 89800810c7..ee76d6e516 100644 --- a/ports/cc3200/mods/modmachine.c +++ b/ports/cc3200/mods/modmachine.c @@ -209,7 +209,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table); -const mp_obj_module_t machine_module = { +const mp_obj_module_t mp_module_machine = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&machine_module_globals, }; diff --git a/ports/cc3200/mpconfigport.h b/ports/cc3200/mpconfigport.h index 345b64fe40..28192e9b3e 100644 --- a/ports/cc3200/mpconfigport.h +++ b/ports/cc3200/mpconfigport.h @@ -145,7 +145,6 @@ { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, \ // extra built in modules to add to the list of known ones -extern const struct _mp_obj_module_t machine_module; extern const struct _mp_obj_module_t wipy_module; extern const struct _mp_obj_module_t mp_module_ure; extern const struct _mp_obj_module_t mp_module_ujson; @@ -158,7 +157,6 @@ extern const struct _mp_obj_module_t mp_module_ubinascii; extern const struct _mp_obj_module_t mp_module_ussl; #define MICROPY_PORT_BUILTIN_MODULES \ - { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&machine_module) }, \ { MP_ROM_QSTR(MP_QSTR_wipy), MP_ROM_PTR(&wipy_module) }, \ { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \ { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \ @@ -170,7 +168,7 @@ extern const struct _mp_obj_module_t mp_module_ussl; // extra constants #define MICROPY_PORT_CONSTANTS \ - { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&machine_module) }, \ + { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \ // vm state and root pointers for the gc #define MP_STATE_PORT MP_STATE_VM diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h index dc6bc2e53b..c457a5743b 100644 --- a/ports/esp32/mpconfigport.h +++ b/ports/esp32/mpconfigport.h @@ -224,7 +224,6 @@ extern const struct _mp_obj_module_t esp32_module; extern const struct _mp_obj_module_t utime_module; extern const struct _mp_obj_module_t uos_module; extern const struct _mp_obj_module_t mp_module_usocket; -extern const struct _mp_obj_module_t mp_module_machine; extern const struct _mp_obj_module_t mp_module_network; extern const struct _mp_obj_module_t mp_module_onewire; @@ -234,7 +233,6 @@ extern const struct _mp_obj_module_t mp_module_onewire; { MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&utime_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&uos_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_usocket), (mp_obj_t)&mp_module_usocket }, \ - { MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&mp_module_machine }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_network), (mp_obj_t)&mp_module_network }, \ { MP_OBJ_NEW_QSTR(MP_QSTR__onewire), (mp_obj_t)&mp_module_onewire }, \ diff --git a/ports/esp8266/mpconfigport.h b/ports/esp8266/mpconfigport.h index 7d6d0a34c3..49c53a4671 100644 --- a/ports/esp8266/mpconfigport.h +++ b/ports/esp8266/mpconfigport.h @@ -174,7 +174,6 @@ extern const struct _mp_obj_module_t network_module; extern const struct _mp_obj_module_t utime_module; extern const struct _mp_obj_module_t uos_module; extern const struct _mp_obj_module_t mp_module_lwip; -extern const struct _mp_obj_module_t mp_module_machine; extern const struct _mp_obj_module_t mp_module_onewire; #define MICROPY_PORT_BUILTIN_MODULES \ @@ -183,7 +182,6 @@ extern const struct _mp_obj_module_t mp_module_onewire; { MP_ROM_QSTR(MP_QSTR_network), MP_ROM_PTR(&network_module) }, \ { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&utime_module) }, \ { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&uos_module) }, \ - { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \ { MP_ROM_QSTR(MP_QSTR__onewire), MP_ROM_PTR(&mp_module_onewire) }, \ #define MP_STATE_PORT MP_STATE_VM diff --git a/ports/mimxrt/mpconfigport.h b/ports/mimxrt/mpconfigport.h index e650579e69..4462a18a61 100644 --- a/ports/mimxrt/mpconfigport.h +++ b/ports/mimxrt/mpconfigport.h @@ -217,7 +217,6 @@ static inline void restore_irq_pri(uint32_t basepri) { #define MICROPY_PORT_BUILTINS \ { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, -extern const struct _mp_obj_module_t mp_module_machine; extern const struct _mp_obj_module_t mp_module_mimxrt; extern const struct _mp_obj_module_t mp_module_onewire; extern const struct _mp_obj_module_t mp_module_uos; @@ -256,7 +255,6 @@ extern const struct _mp_obj_type_t network_lan_type; #endif #define MICROPY_PORT_BUILTIN_MODULES \ - { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \ { MP_ROM_QSTR(MP_QSTR_mimxrt), (mp_obj_t)&mp_module_mimxrt }, \ { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \ { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \ diff --git a/ports/nrf/modules/machine/modmachine.c b/ports/nrf/modules/machine/modmachine.c index fb3267e0db..3d4cda8e45 100644 --- a/ports/nrf/modules/machine/modmachine.c +++ b/ports/nrf/modules/machine/modmachine.c @@ -244,7 +244,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table); -const mp_obj_module_t machine_module = { +const mp_obj_module_t mp_module_machine = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&machine_module_globals, }; diff --git a/ports/nrf/mpconfigport.h b/ports/nrf/mpconfigport.h index 3ffb092c61..7a6e282e86 100644 --- a/ports/nrf/mpconfigport.h +++ b/ports/nrf/mpconfigport.h @@ -220,7 +220,6 @@ typedef long mp_off_t; // extra built in modules to add to the list of known ones extern const struct _mp_obj_module_t board_module; -extern const struct _mp_obj_module_t machine_module; extern const struct _mp_obj_module_t nrf_module; extern const struct _mp_obj_module_t mp_module_utime; extern const struct _mp_obj_module_t mp_module_uos; @@ -263,7 +262,6 @@ extern const struct _mp_obj_module_t ble_module; #define MICROPY_PORT_BUILTIN_MODULES \ { MP_ROM_QSTR(MP_QSTR_board), MP_ROM_PTR(&board_module) }, \ - { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&machine_module) }, \ { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \ { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&mp_module_utime) }, \ { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \ @@ -278,7 +276,6 @@ extern const struct _mp_obj_module_t ble_module; extern const struct _mp_obj_module_t ble_module; #define MICROPY_PORT_BUILTIN_MODULES \ { MP_ROM_QSTR(MP_QSTR_board), MP_ROM_PTR(&board_module) }, \ - { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&machine_module) }, \ { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \ { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \ MUSIC_MODULE \ @@ -296,7 +293,7 @@ extern const struct _mp_obj_module_t ble_module; // extra constants #define MICROPY_PORT_CONSTANTS \ { MP_ROM_QSTR(MP_QSTR_board), MP_ROM_PTR(&board_module) }, \ - { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&machine_module) }, \ + { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \ BLE_MODULE \ #define MP_STATE_PORT MP_STATE_VM diff --git a/ports/qemu-arm/mpconfigport.h b/ports/qemu-arm/mpconfigport.h index 270995979c..6bfea74ea0 100644 --- a/ports/qemu-arm/mpconfigport.h +++ b/ports/qemu-arm/mpconfigport.h @@ -68,7 +68,6 @@ extern const struct _mp_obj_module_t mp_module_uos; #define MICROPY_PORT_BUILTIN_MODULES \ { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \ - { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \ // We need to provide a declaration/definition of alloca() #include diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h index 63d9818e31..1ff9d5b511 100644 --- a/ports/rp2/mpconfigport.h +++ b/ports/rp2/mpconfigport.h @@ -121,7 +121,6 @@ #define MICROPY_PORT_BUILTINS \ { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, -extern const struct _mp_obj_module_t mp_module_machine; extern const struct _mp_obj_module_t mp_module_network; extern const struct _mp_obj_module_t mp_module_onewire; extern const struct _mp_obj_module_t mp_module_rp2; @@ -171,7 +170,6 @@ extern const struct _mod_network_nic_type_t mod_network_nic_type_nina; #endif #define MICROPY_PORT_BUILTIN_MODULES \ - { MP_OBJ_NEW_QSTR(MP_QSTR_machine), (mp_obj_t)&mp_module_machine }, \ { MP_OBJ_NEW_QSTR(MP_QSTR__onewire), (mp_obj_t)&mp_module_onewire }, \ { MP_OBJ_NEW_QSTR(MP_QSTR__rp2), (mp_obj_t)&mp_module_rp2 }, \ { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \ diff --git a/ports/samd/mpconfigport.h b/ports/samd/mpconfigport.h index 645f16b3f7..54018f111e 100644 --- a/ports/samd/mpconfigport.h +++ b/ports/samd/mpconfigport.h @@ -108,12 +108,10 @@ #define MICROPY_PORT_BUILTINS \ { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, -extern const struct _mp_obj_module_t mp_module_machine; extern const struct _mp_obj_module_t mp_module_samd; extern const struct _mp_obj_module_t mp_module_utime; #define MICROPY_PORT_BUILTIN_MODULES \ - { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \ { MP_ROM_QSTR(MP_QSTR_samd), MP_ROM_PTR(&mp_module_samd) }, \ { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \ diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c index 9b215c75cd..f9026bc370 100644 --- a/ports/stm32/modmachine.c +++ b/ports/stm32/modmachine.c @@ -464,7 +464,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { STATIC MP_DEFINE_CONST_DICT(machine_module_globals, machine_module_globals_table); -const mp_obj_module_t machine_module = { +const mp_obj_module_t mp_module_machine = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t *)&machine_module_globals, }; diff --git a/ports/stm32/mpconfigport.h b/ports/stm32/mpconfigport.h index 6bca5dfd92..3cca8f1925 100644 --- a/ports/stm32/mpconfigport.h +++ b/ports/stm32/mpconfigport.h @@ -169,7 +169,6 @@ { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, // extra built in modules to add to the list of known ones -extern const struct _mp_obj_module_t machine_module; extern const struct _mp_obj_module_t pyb_module; extern const struct _mp_obj_module_t stm_module; extern const struct _mp_obj_module_t mp_module_ubinascii; @@ -197,10 +196,10 @@ extern const struct _mp_obj_module_t mp_module_onewire; #endif #if MICROPY_PY_MACHINE -#define MACHINE_BUILTIN_MODULE { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&machine_module) }, -#define MACHINE_BUILTIN_MODULE_CONSTANTS { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&machine_module) }, +#define MACHINE_BUILTIN_MODULE_CONSTANTS \ + { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \ + { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, #else -#define MACHINE_BUILTIN_MODULE #define MACHINE_BUILTIN_MODULE_CONSTANTS #endif @@ -272,7 +271,6 @@ extern const struct _mod_network_nic_type_t mod_network_nic_type_cc3k; #endif #define MICROPY_PORT_BUILTIN_MODULES \ - MACHINE_BUILTIN_MODULE \ PYB_BUILTIN_MODULE \ STM_BUILTIN_MODULE \ UOS_BUILTIN_MODULE \ @@ -283,7 +281,6 @@ extern const struct _mod_network_nic_type_t mod_network_nic_type_cc3k; // extra constants #define MICROPY_PORT_CONSTANTS \ - MACHINE_BUILTIN_MODULE \ MACHINE_BUILTIN_MODULE_CONSTANTS \ PYB_BUILTIN_MODULE \ STM_BUILTIN_MODULE \ diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h index 658cb680f1..d54d0b3ef3 100644 --- a/ports/unix/mpconfigport.h +++ b/ports/unix/mpconfigport.h @@ -204,7 +204,6 @@ extern const struct _mp_print_t mp_stderr_print; #define mp_type_fileio mp_type_vfs_posix_fileio #define mp_type_textio mp_type_vfs_posix_textio -extern const struct _mp_obj_module_t mp_module_machine; extern const struct _mp_obj_module_t mp_module_os; extern const struct _mp_obj_module_t mp_module_uos_vfs; extern const struct _mp_obj_module_t mp_module_uselect; @@ -255,7 +254,6 @@ extern const struct _mp_obj_module_t mp_module_jni; MICROPY_PY_JNI_DEF \ MICROPY_PY_UTIME_DEF \ MICROPY_PY_SOCKET_DEF \ - { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \ MICROPY_PY_UOS_DEF \ MICROPY_PY_USELECT_DEF \ MICROPY_PY_TERMIOS_DEF \ diff --git a/ports/windows/mpconfigport.h b/ports/windows/mpconfigport.h index 88746744ae..d589dac7a7 100644 --- a/ports/windows/mpconfigport.h +++ b/ports/windows/mpconfigport.h @@ -207,7 +207,6 @@ extern const struct _mp_obj_module_t mp_module_os; extern const struct _mp_obj_module_t mp_module_time; #define MICROPY_PORT_BUILTIN_MODULES \ { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) }, \ - { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, \ { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_os) }, \ #if MICROPY_USE_READLINE == 1 diff --git a/ports/zephyr/mpconfigport.h b/ports/zephyr/mpconfigport.h index 501c39a1bb..b8e25faefd 100644 --- a/ports/zephyr/mpconfigport.h +++ b/ports/zephyr/mpconfigport.h @@ -138,7 +138,6 @@ typedef long mp_off_t; void *machine_pin_irq_list; /* Linked list of pin irq objects */ \ struct _mp_bluetooth_zephyr_root_pointers_t *bluetooth_zephyr_root_pointers; -extern const struct _mp_obj_module_t mp_module_machine; extern const struct _mp_obj_module_t mp_module_time; extern const struct _mp_obj_module_t mp_module_uos; extern const struct _mp_obj_module_t mp_module_usocket; @@ -176,7 +175,6 @@ extern const struct _mp_obj_module_t mp_module_zsensor; #endif #define MICROPY_PORT_BUILTIN_MODULES \ - { MP_ROM_QSTR(MP_QSTR_machine), MP_ROM_PTR(&mp_module_machine) }, \ MICROPY_PY_UOS_DEF \ MICROPY_PY_USOCKET_DEF \ MICROPY_PY_UTIME_DEF \ diff --git a/py/objmodule.c b/py/objmodule.c index 6b06740e4d..9be4bad92c 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -219,6 +219,9 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = { #if MICROPY_PY_LWIP { MP_ROM_QSTR(MP_QSTR_lwip), MP_ROM_PTR(&mp_module_lwip) }, #endif + #if MICROPY_PY_MACHINE + { MP_ROM_QSTR(MP_QSTR_umachine), MP_ROM_PTR(&mp_module_machine) }, + #endif #if MICROPY_PY_UWEBSOCKET { MP_ROM_QSTR(MP_QSTR_uwebsocket), MP_ROM_PTR(&mp_module_uwebsocket) }, #endif From b8d55d4c52145e3ef2abf692a01a3ffce3ee78d0 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Feb 2022 13:20:22 +1100 Subject: [PATCH 0079/1712] stm32/mboot: Allow HSI to be used as the main clock source. Signed-off-by: Damien George --- ports/stm32/mboot/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ports/stm32/mboot/main.c b/ports/stm32/mboot/main.c index ae409168b9..d62224b1a6 100644 --- a/ports/stm32/mboot/main.c +++ b/ports/stm32/mboot/main.c @@ -80,7 +80,7 @@ #undef MICROPY_HW_CLK_PLLP #undef MICROPY_HW_CLK_PLLQ #undef MICROPY_HW_CLK_PLLR -#define MICROPY_HW_CLK_PLLM (HSE_VALUE / 1000000) +#define MICROPY_HW_CLK_PLLM (MICROPY_HW_CLK_VALUE / 1000000) #define MICROPY_HW_CLK_PLLN (192) #define MICROPY_HW_CLK_PLLP (MICROPY_HW_CLK_PLLN / (CORE_PLL_FREQ / 1000000)) #define MICROPY_HW_CLK_PLLQ (4) @@ -184,10 +184,12 @@ void SystemClock_Config(void) { // Reduce power consumption __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); + #if !MICROPY_HW_CLK_USE_HSI // Turn HSE on __HAL_RCC_HSE_CONFIG(RCC_HSE_ON); while (__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET) { } + #endif // Disable PLL __HAL_RCC_PLL_DISABLE(); @@ -196,7 +198,11 @@ void SystemClock_Config(void) { // Configure PLL factors and source RCC->PLLCFGR = + #if MICROPY_HW_CLK_USE_HSI + 0 << RCC_PLLCFGR_PLLSRC_Pos // HSI selected as PLL source + #else 1 << RCC_PLLCFGR_PLLSRC_Pos // HSE selected as PLL source + #endif | MICROPY_HW_CLK_PLLM << RCC_PLLCFGR_PLLM_Pos | MICROPY_HW_CLK_PLLN << RCC_PLLCFGR_PLLN_Pos | ((MICROPY_HW_CLK_PLLP >> 1) - 1) << RCC_PLLCFGR_PLLP_Pos From 4f918f4b26ec2c949f6832b972cdab80506b7038 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Feb 2022 13:20:51 +1100 Subject: [PATCH 0080/1712] stm32/mboot: Add MBOOT_BOARD_ENTRY_INIT for a board to add entry code. Also change the signature of stm32_main to uint32_t, which is what it should be. Signed-off-by: Damien George --- ports/stm32/mboot/main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/stm32/mboot/main.c b/ports/stm32/mboot/main.c index d62224b1a6..abde92de1b 100644 --- a/ports/stm32/mboot/main.c +++ b/ports/stm32/mboot/main.c @@ -1439,7 +1439,7 @@ static void leave_bootloader(void) { extern PCD_HandleTypeDef pcd_fs_handle; extern PCD_HandleTypeDef pcd_hs_handle; -void stm32_main(int initial_r0) { +void stm32_main(uint32_t initial_r0) { #if defined(STM32H7) // Configure write-once power options, and wait for voltage levels to be ready PWR->CR3 = PWR_CR3_LDOEN; @@ -1524,6 +1524,10 @@ enter_bootloader: __ASM volatile ("msr basepri_max, %0" : : "r" (pri) : "memory"); #endif + #if defined(MBOOT_BOARD_ENTRY_INIT) + MBOOT_BOARD_ENTRY_INIT(initial_r0); + #endif + #if defined(MBOOT_SPIFLASH_ADDR) MBOOT_SPIFLASH_SPIFLASH->config = MBOOT_SPIFLASH_CONFIG; mp_spiflash_init(MBOOT_SPIFLASH_SPIFLASH); From 26faf74d52e3e953c9ddbcd800a2f9e117477ce7 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Feb 2022 13:21:57 +1100 Subject: [PATCH 0081/1712] stm32/mboot: Add support for F469/479 MCUs in fwupdate.py. And don't assert on the sector number in sector_erase, so it can support erasing arbitrary sectors. Signed-off-by: Damien George --- ports/stm32/mboot/fwupdate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/stm32/mboot/fwupdate.py b/ports/stm32/mboot/fwupdate.py index 3b8dc51e1c..0e7ea01418 100644 --- a/ports/stm32/mboot/fwupdate.py +++ b/ports/stm32/mboot/fwupdate.py @@ -105,10 +105,11 @@ class Flash: dev_id = 0 # Configure flash parameters based on MCU. - if dev_id in (0x413, 0x419, 0x431, 0x451, 0x452): + if dev_id in (0x413, 0x419, 0x431, 0x434, 0x451, 0x452): # 0x413: STM32F405/407, STM32F415/417 # 0x419: STM32F42x/43x # 0x431: STM32F411 + # 0x434: STM32F469/479 # 0x451: STM32F76x/77x # 0x452: STM32F72x/73x self._keyr = stm.FLASH + stm.FLASH_KEYR @@ -155,7 +156,6 @@ class Flash: stm.mem32[self._cr] = self._cr_lock def erase_sector(self, sector): - assert 0 <= sector <= 7 self.wait_not_busy() stm.mem32[self._cr] = self._cr_init_erase(sector) stm.mem32[self._cr] |= self._cr_start_erase From e4f59a00201b31903b11a6d30dddedc1457ed2ff Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 4 Feb 2022 08:30:39 +1100 Subject: [PATCH 0082/1712] stm32/rtc: Use LL_RTC functions to simplify some MCU-specific code. This also fixes a possible race condition when exiting initialisation mode: reading then writing to ISR (via ISR &= ~RTC_ISR_INIT) will clear any flags that were set by the hardware between the read and the write. The correct way to clear just the INIT bit is to just do a single write via ISR = ~RTC_ISR_INIT, which will not clear any other flags (they must be written to 0 to clear), and that is exactly what LL_RTC_DisableInitMode does. Signed-off-by: Damien George --- ports/stm32/rtc.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/ports/stm32/rtc.c b/ports/stm32/rtc.c index 2d6459e239..1164e71e08 100644 --- a/ports/stm32/rtc.c +++ b/ports/stm32/rtc.c @@ -339,11 +339,7 @@ STATIC HAL_StatusTypeDef PYB_RTC_Init(RTC_HandleTypeDef *hrtc) { hrtc->Instance->PRER |= (uint32_t)(hrtc->Init.AsynchPrediv << 16); // Exit Initialization mode - #if defined(STM32G4) || defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) - hrtc->Instance->ICSR &= (uint32_t) ~RTC_ICSR_INIT; - #else - hrtc->Instance->ISR &= (uint32_t) ~RTC_ISR_INIT; - #endif + LL_RTC_DisableInitMode(hrtc->Instance); #if defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) // do nothing @@ -702,13 +698,8 @@ mp_obj_t pyb_rtc_wakeup(size_t n_args, const mp_obj_t *args) { RTC->CR &= ~RTC_CR_WUTE; // wait until WUTWF is set - #if defined(STM32G4) || defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) - while (!(RTC->ICSR & RTC_ICSR_WUTWF)) { + while (!LL_RTC_IsActiveFlag_WUTW(RTC)) { } - #else - while (!(RTC->ISR & RTC_ISR_WUTWF)) { - } - #endif if (enable) { // program WUT From 9127e6370819b32552caedd0184f206e1b9c9285 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 22 Feb 2021 11:54:31 +1100 Subject: [PATCH 0083/1712] stm32/Makefile: Make stm32lib configurable. The default stm32lib remains lib/stm32lib, but it can now be easily overriden at build time by specifying STM32LIB_DIR, or STM32LIB_CMSIS_DIR and STM32LIB_HAL_DIR. Signed-off-by: Damien George --- ports/stm32/Makefile | 68 +++++-------------- .../stm32/boards/NUCLEO_WB55/mpconfigboard.mk | 2 +- .../boards/USBDONGLE_WB55/mpconfigboard.mk | 2 +- ports/stm32/mboot/Makefile | 27 ++------ ports/stm32/stm32.mk | 68 +++++++++++++++++++ 5 files changed, 93 insertions(+), 74 deletions(-) create mode 100644 ports/stm32/stm32.mk diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index c2581c100b..4c90c6f1ef 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -36,12 +36,7 @@ include $(TOP)/py/py.mk GIT_SUBMODULES += lib/libhydrogen lib/lwip lib/mbedtls lib/stm32lib -MCU_SERIES_UPPER = $(shell echo $(MCU_SERIES) | tr '[:lower:]' '[:upper:]') -CMSIS_MCU_LOWER = $(shell echo $(CMSIS_MCU) | tr '[:upper:]' '[:lower:]') - LD_DIR=boards -CMSIS_DIR=$(TOP)/lib/stm32lib/CMSIS/STM32$(MCU_SERIES_UPPER)xx/Include -HAL_DIR=lib/stm32lib/STM32$(MCU_SERIES_UPPER)xx_HAL_Driver USBDEV_DIR=usbdev #USBHOST_DIR=usbhost DFU=$(TOP)/tools/dfu.py @@ -55,8 +50,8 @@ BOOTLOADER_DFU_USB_PID ?= 0xDF11 STFLASH ?= st-flash OPENOCD ?= openocd OPENOCD_CONFIG ?= boards/openocd_stm32f4.cfg -STARTUP_FILE ?= lib/stm32lib/CMSIS/STM32$(MCU_SERIES_UPPER)xx/Source/Templates/gcc/startup_$(CMSIS_MCU_LOWER).o -SYSTEM_FILE ?= lib/stm32lib/CMSIS/STM32$(MCU_SERIES_UPPER)xx/Source/Templates/system_stm32$(MCU_SERIES)xx.o + +include stm32.mk # Select the cross compile prefix CROSS_COMPILE ?= arm-none-eabi- @@ -65,41 +60,12 @@ INC += -I. INC += -I$(TOP) INC += -I$(BUILD) INC += -I$(TOP)/lib/cmsis/inc -INC += -I$(CMSIS_DIR)/ -INC += -I$(TOP)/$(HAL_DIR)/Inc +INC += -I$(STM32LIB_CMSIS_ABS)/Include +INC += -I$(STM32LIB_HAL_ABS)/Inc INC += -I$(USBDEV_DIR)/core/inc -I$(USBDEV_DIR)/class/inc #INC += -I$(USBHOST_DIR) INC += -Ilwip_inc -# Basic Cortex-M flags -CFLAGS_CORTEX_M = -mthumb - -# Select hardware floating-point support -SUPPORTS_HARDWARE_FP_SINGLE = 0 -SUPPORTS_HARDWARE_FP_DOUBLE = 0 -ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),STM32F765xx STM32F767xx STM32F769xx STM32H743xx STM32H750xx STM32H7A3xx STM32H7A3xxQ STM32H7B3xx STM32H7B3xxQ)) -CFLAGS_CORTEX_M += -mfpu=fpv5-d16 -mfloat-abi=hard -SUPPORTS_HARDWARE_FP_SINGLE = 1 -SUPPORTS_HARDWARE_FP_DOUBLE = 1 -else -ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f0 l0)) -CFLAGS_CORTEX_M += -msoft-float -else -CFLAGS_CORTEX_M += -mfpu=fpv4-sp-d16 -mfloat-abi=hard -SUPPORTS_HARDWARE_FP_SINGLE = 1 -endif -endif - -# Options for particular MCU series -CFLAGS_MCU_f0 = $(CFLAGS_CORTEX_M) -mtune=cortex-m0 -mcpu=cortex-m0 -CFLAGS_MCU_f4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 -CFLAGS_MCU_f7 = $(CFLAGS_CORTEX_M) -mtune=cortex-m7 -mcpu=cortex-m7 -CFLAGS_MCU_g4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 -CFLAGS_MCU_l0 = $(CFLAGS_CORTEX_M) -mtune=cortex-m0plus -mcpu=cortex-m0plus -CFLAGS_MCU_l4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 -CFLAGS_MCU_h7 = $(CFLAGS_CORTEX_M) -mtune=cortex-m7 -mcpu=cortex-m7 -CFLAGS_MCU_wb = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 - CFLAGS += $(INC) -Wall -Wpointer-arith -Werror -Wdouble-promotion -Wfloat-conversion -std=gnu99 -nostdlib $(CFLAGS_MOD) $(CFLAGS_EXTRA) CFLAGS += -D$(CMSIS_MCU) -DUSE_FULL_LL_DRIVER CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES)) @@ -377,7 +343,7 @@ SRC_O += \ endif endif -HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\ +HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ hal.c \ hal_adc.c \ hal_adc_ex.c \ @@ -403,13 +369,13 @@ HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\ ) ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f4 f7 h7 l0 l4 wb)) -HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\ +HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ ll_usb.c \ ) endif ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f4 f7 h7 l4)) -HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\ +HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ hal_sd.c \ ll_sdmmc.c \ ll_fmc.c \ @@ -417,7 +383,7 @@ HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\ endif ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f4 f7 h7)) -HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\ +HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ hal_mmc.c \ hal_sdram.c \ hal_dma_ex.c \ @@ -426,35 +392,35 @@ HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\ ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f4)) # HAL F4-1.16.0 has a bug with missing parentheses in HAL_MMC_Erase. # This function is unused so let the error go by as a warning. -$(BUILD)/$(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_hal_mmc.o: CFLAGS += -Wno-error=parentheses +$(BUILD)/$(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_hal_mmc.o: CFLAGS += -Wno-error=parentheses endif endif ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),g4)) - HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_, hal_fdcan.c) + HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_, hal_fdcan.c) endif ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),STM32H743xx STM32H750xx STM32H7A3xx STM32H7A3xxQ STM32H7B3xx STM32H7B3xxQ)) - HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_, hal_fdcan.c) + HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_, hal_fdcan.c) else ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f0 f4 f7 h7)) - HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_, hal_can.c) + HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_, hal_can.c) else ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),l4)) -HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/Legacy/stm32$(MCU_SERIES)xx_, hal_can.c) -$(BUILD)/$(HAL_DIR)/Src/Legacy/stm32$(MCU_SERIES)xx_hal_can.o: CFLAGS += -Wno-error=cpp +HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/Legacy/stm32$(MCU_SERIES)xx_, hal_can.c) +$(BUILD)/$(STM32LIB_HAL_BASE)/Src/Legacy/stm32$(MCU_SERIES)xx_hal_can.o: CFLAGS += -Wno-error=cpp endif endif endif ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f0 f4 f7 l0)) -HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\ +HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ hal_i2s.c \ ) endif ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f4)) -HAL_SRC_C += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\ +HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ hal_i2s_ex.c \ ) endif @@ -778,7 +744,7 @@ GEN_PLLFREQTABLE_HDR = $(HEADER_BUILD)/pllfreqtable.h GEN_STMCONST_HDR = $(HEADER_BUILD)/modstm_const.h GEN_STMCONST_QSTR = $(BUILD)/modstm_qstr.h GEN_STMCONST_MPZ = $(HEADER_BUILD)/modstm_mpz.h -CMSIS_MCU_HDR = $(CMSIS_DIR)/$(CMSIS_MCU_LOWER).h +CMSIS_MCU_HDR = $(STM32LIB_CMSIS_ABS)/Include/$(CMSIS_MCU_LOWER).h modmachine.c: $(GEN_PLLFREQTABLE_HDR) $(GEN_PLLFREQTABLE_HDR): $(PLLVALUES) | $(HEADER_BUILD) diff --git a/ports/stm32/boards/NUCLEO_WB55/mpconfigboard.mk b/ports/stm32/boards/NUCLEO_WB55/mpconfigboard.mk index dcec788ed4..349ce46d79 100644 --- a/ports/stm32/boards/NUCLEO_WB55/mpconfigboard.mk +++ b/ports/stm32/boards/NUCLEO_WB55/mpconfigboard.mk @@ -1,7 +1,7 @@ MCU_SERIES = wb CMSIS_MCU = STM32WB55xx AF_FILE = boards/stm32wb55_af.csv -STARTUP_FILE = lib/stm32lib/CMSIS/STM32WBxx/Source/Templates/gcc/startup_stm32wb55xx_cm4.o +STARTUP_FILE = $(STM32LIB_CMSIS_BASE)/Source/Templates/gcc/startup_stm32wb55xx_cm4.o ifeq ($(USE_MBOOT),1) # When using Mboot all the text goes together after the bootloader diff --git a/ports/stm32/boards/USBDONGLE_WB55/mpconfigboard.mk b/ports/stm32/boards/USBDONGLE_WB55/mpconfigboard.mk index dcec788ed4..349ce46d79 100644 --- a/ports/stm32/boards/USBDONGLE_WB55/mpconfigboard.mk +++ b/ports/stm32/boards/USBDONGLE_WB55/mpconfigboard.mk @@ -1,7 +1,7 @@ MCU_SERIES = wb CMSIS_MCU = STM32WB55xx AF_FILE = boards/stm32wb55_af.csv -STARTUP_FILE = lib/stm32lib/CMSIS/STM32WBxx/Source/Templates/gcc/startup_stm32wb55xx_cm4.o +STARTUP_FILE = $(STM32LIB_CMSIS_BASE)/Source/Templates/gcc/startup_stm32wb55xx_cm4.o ifeq ($(USE_MBOOT),1) # When using Mboot all the text goes together after the bootloader diff --git a/ports/stm32/mboot/Makefile b/ports/stm32/mboot/Makefile index 20b0db9070..ee75fb2afe 100755 --- a/ports/stm32/mboot/Makefile +++ b/ports/stm32/mboot/Makefile @@ -32,11 +32,6 @@ include $(BOARD_DIR)/mpconfigboard.mk # A board can set MBOOT_TEXT0_ADDR to a custom location where mboot should reside. MBOOT_TEXT0_ADDR ?= 0x08000000 -MCU_SERIES_UPPER = $(shell echo $(MCU_SERIES) | tr '[:lower:]' '[:upper:]') -CMSIS_MCU_LOWER = $(shell echo $(CMSIS_MCU) | tr '[:upper:]' '[:lower:]') - -CMSIS_DIR=$(TOP)/lib/stm32lib/CMSIS/STM32$(MCU_SERIES_UPPER)xx/Include -HAL_DIR=lib/stm32lib/STM32$(MCU_SERIES_UPPER)xx_HAL_Driver USBDEV_DIR=usbdev DFU=$(TOP)/tools/dfu.py PYDFU ?= $(TOP)/tools/pydfu.py @@ -45,8 +40,8 @@ BOOTLOADER_DFU_USB_PID ?= 0xDF11 STFLASH ?= st-flash OPENOCD ?= openocd OPENOCD_CONFIG ?= boards/openocd_stm32f4.cfg -STARTUP_FILE ?= lib/stm32lib/CMSIS/STM32$(MCU_SERIES_UPPER)xx/Source/Templates/gcc/startup_$(CMSIS_MCU_LOWER).o -SYSTEM_FILE ?= lib/stm32lib/CMSIS/STM32$(MCU_SERIES_UPPER)xx/Source/Templates/system_stm32$(MCU_SERIES)xx.o + +include ../stm32.mk CROSS_COMPILE ?= arm-none-eabi- @@ -55,20 +50,10 @@ INC += -I.. INC += -I$(TOP) INC += -I$(BUILD) INC += -I$(TOP)/lib/cmsis/inc -INC += -I$(CMSIS_DIR)/ -INC += -I$(TOP)/$(HAL_DIR)/Inc +INC += -I$(STM32LIB_CMSIS_ABS)/Include +INC += -I$(STM32LIB_HAL_ABS)/Inc INC += -I../$(USBDEV_DIR)/core/inc -I../$(USBDEV_DIR)/class/inc -# Basic Cortex-M flags -CFLAGS_CORTEX_M = -mthumb - -# Options for particular MCU series -CFLAGS_MCU_f4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 -CFLAGS_MCU_f7 = $(CFLAGS_CORTEX_M) -mtune=cortex-m7 -mcpu=cortex-m7 -CFLAGS_MCU_h7 = $(CFLAGS_CORTEX_M) -mtune=cortex-m7 -mcpu=cortex-m7 -CFLAGS_MCU_l4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 -CFLAGS_MCU_wb = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 - # Standard C functions like memset need to be compiled with special flags so # the compiler does not optimise these functions in terms of themselves. CFLAGS_BUILTIN ?= -ffreestanding -fno-builtin -fno-lto @@ -154,8 +139,8 @@ CFLAGS += -DMBOOT_PACK_CHUNKSIZE=$(MBOOT_PACK_CHUNKSIZE) CFLAGS += -DMBOOT_PACK_KEYS_FILE=\"$(MBOOT_PACK_KEYS_FILE)\" endif -$(BUILD)/$(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_ll_usb.o: CFLAGS += -Wno-attributes -SRC_HAL += $(addprefix $(HAL_DIR)/Src/stm32$(MCU_SERIES)xx_,\ +$(BUILD)/$(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_ll_usb.o: CFLAGS += -Wno-attributes +SRC_HAL += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ hal_cortex.c \ hal_flash.c \ hal_flash_ex.c \ diff --git a/ports/stm32/stm32.mk b/ports/stm32/stm32.mk new file mode 100644 index 0000000000..f17351cdca --- /dev/null +++ b/ports/stm32/stm32.mk @@ -0,0 +1,68 @@ +# +# Makefile fragment for STM32 MCUs. +# + +# Create variables for the MCU name. +MCU_SERIES_UPPER = $(shell echo $(MCU_SERIES) | tr '[:lower:]' '[:upper:]') +CMSIS_MCU_LOWER = $(shell echo $(CMSIS_MCU) | tr '[:upper:]' '[:lower:]') + +# Configure location of stm32lib. Options are: +# 1. default: use provided lib/stm32lib +# 2. set STM32LIB_DIR to point to an stm32lib directory structure +# 3. set STM32LIB_CMSIS_DIR to point to xxx/CMSIS/Device/ST/STM32xx +# and STM32LIB_HAL_DIR to point to xxx/STM32xx_HAL_Driver +ifneq ($(STM32LIB_CMSIS_DIR),) +# Option 3 +STM32LIB_CMSIS_BASE = $(abspath $(STM32LIB_CMSIS_DIR)) +STM32LIB_CMSIS_ABS = $(STM32LIB_CMSIS_BASE) +STM32LIB_HAL_BASE = $(abspath $(STM32LIB_HAL_DIR)) +STM32LIB_HAL_ABS = $(STM32LIB_HAL_BASE) +else +ifneq ($(STM32LIB_DIR),) +# Option 2 +STM32LIB_VPATH = $(abspath $(STM32LIB_DIR)) +STM32LIB_FROM_HERE = $(STM32LIB_VPATH) +else +# Option 1 +STM32LIB_VPATH = lib/stm32lib +STM32LIB_FROM_HERE = $(TOP)/$(STM32LIB_VPATH) +endif +STM32LIB_CMSIS_BASE = $(STM32LIB_VPATH)/CMSIS/STM32$(MCU_SERIES_UPPER)xx +STM32LIB_CMSIS_ABS = $(STM32LIB_FROM_HERE)/CMSIS/STM32$(MCU_SERIES_UPPER)xx +STM32LIB_HAL_BASE = $(STM32LIB_VPATH)/STM32$(MCU_SERIES_UPPER)xx_HAL_Driver +STM32LIB_HAL_ABS = $(STM32LIB_FROM_HERE)/STM32$(MCU_SERIES_UPPER)xx_HAL_Driver +endif + +STARTUP_FILE ?= $(STM32LIB_CMSIS_BASE)/Source/Templates/gcc/startup_$(CMSIS_MCU_LOWER).o +SYSTEM_FILE ?= $(STM32LIB_CMSIS_BASE)/Source/Templates/system_stm32$(MCU_SERIES)xx.o + +# Basic Cortex-M flags. +CFLAGS_CORTEX_M = -mthumb + +ifneq ($(BUILDING_MBOOT),1) +# Select hardware floating-point support. +SUPPORTS_HARDWARE_FP_SINGLE = 0 +SUPPORTS_HARDWARE_FP_DOUBLE = 0 +ifeq ($(CMSIS_MCU),$(filter $(CMSIS_MCU),STM32F765xx STM32F767xx STM32F769xx STM32H743xx STM32H750xx STM32H7A3xx STM32H7A3xxQ STM32H7B3xx STM32H7B3xxQ)) +CFLAGS_CORTEX_M += -mfpu=fpv5-d16 -mfloat-abi=hard +SUPPORTS_HARDWARE_FP_SINGLE = 1 +SUPPORTS_HARDWARE_FP_DOUBLE = 1 +else +ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f0 l0)) +CFLAGS_CORTEX_M += -msoft-float +else +CFLAGS_CORTEX_M += -mfpu=fpv4-sp-d16 -mfloat-abi=hard +SUPPORTS_HARDWARE_FP_SINGLE = 1 +endif +endif +endif + +# Options for particular MCU series. +CFLAGS_MCU_f0 = $(CFLAGS_CORTEX_M) -mtune=cortex-m0 -mcpu=cortex-m0 +CFLAGS_MCU_f4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 +CFLAGS_MCU_f7 = $(CFLAGS_CORTEX_M) -mtune=cortex-m7 -mcpu=cortex-m7 +CFLAGS_MCU_g4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 +CFLAGS_MCU_l0 = $(CFLAGS_CORTEX_M) -mtune=cortex-m0plus -mcpu=cortex-m0plus +CFLAGS_MCU_l4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 +CFLAGS_MCU_h7 = $(CFLAGS_CORTEX_M) -mtune=cortex-m7 -mcpu=cortex-m7 +CFLAGS_MCU_wb = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 From e0a0719416d6a936ade8c30314b7e9c90bfbbf23 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 22 Feb 2021 11:55:12 +1100 Subject: [PATCH 0084/1712] stm32: Add initial support for STM32WL MCUs. Signed-off-by: Damien George --- ports/stm32/Makefile | 6 +- ports/stm32/adc.h | 2 + ports/stm32/boards/stm32wl55_af.csv | 45 +++++++++++ ports/stm32/boards/stm32wl55xc.ld | 34 +++++++++ ports/stm32/boards/stm32wlxx_hal_conf_base.h | 78 ++++++++++++++++++++ ports/stm32/dma.c | 12 +-- ports/stm32/dma.h | 2 +- ports/stm32/extint.c | 22 ++++-- ports/stm32/extint.h | 2 +- ports/stm32/flash.c | 8 +- ports/stm32/machine_adc.c | 24 ++++-- ports/stm32/machine_uart.c | 2 +- ports/stm32/modmachine.c | 2 +- ports/stm32/mpconfigboard_common.h | 10 +++ ports/stm32/mphalport.c | 2 +- ports/stm32/powerctrl.c | 25 +++++-- ports/stm32/powerctrlboot.c | 37 ++++++++++ ports/stm32/rtc.c | 21 ++++-- ports/stm32/stm32.mk | 3 +- ports/stm32/stm32_it.c | 2 +- ports/stm32/timer.c | 4 +- ports/stm32/uart.c | 33 +++++++-- ports/stm32/uart.h | 2 +- 23 files changed, 316 insertions(+), 62 deletions(-) create mode 100644 ports/stm32/boards/stm32wl55_af.csv create mode 100644 ports/stm32/boards/stm32wl55xc.ld create mode 100644 ports/stm32/boards/stm32wlxx_hal_conf_base.h diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index 4c90c6f1ef..dd86f1e3f3 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -353,8 +353,6 @@ HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ hal_flash_ex.c \ hal_gpio.c \ hal_i2c.c \ - hal_pcd.c \ - hal_pcd_ex.c \ hal_pwr.c \ hal_pwr_ex.c \ hal_rcc.c \ @@ -368,8 +366,10 @@ HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ ll_utils.c \ ) -ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f4 f7 h7 l0 l4 wb)) +ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f4 f7 g4 h7 l0 l4 wb)) HAL_SRC_C += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ + hal_pcd.c \ + hal_pcd_ex.c \ ll_usb.c \ ) endif diff --git a/ports/stm32/adc.h b/ports/stm32/adc.h index db706ea494..3b79dc01f5 100644 --- a/ports/stm32/adc.h +++ b/ports/stm32/adc.h @@ -56,6 +56,8 @@ static inline void adc_deselect_vbat(ADC_TypeDef *adc, uint32_t channel) { adc_common = adc == ADC3 ? ADC3_COMMON : ADC12_COMMON; #elif defined(STM32L4) adc_common = __LL_ADC_COMMON_INSTANCE(0); + #elif defined(STM32WL) + adc_common = ADC_COMMON; #endif adc_common->CCR &= ~LL_ADC_PATH_INTERNAL_VBAT; diff --git a/ports/stm32/boards/stm32wl55_af.csv b/ports/stm32/boards/stm32wl55_af.csv new file mode 100644 index 0000000000..219b8b08b7 --- /dev/null +++ b/ports/stm32/boards/stm32wl55_af.csv @@ -0,0 +1,45 @@ +Port,,AF0,AF1,AF2,AF3,AF4,AF5,AF6,AF7,AF8,AF9,AF10,AF11,AF12,AF13,AF14,AF15, +,,SYS_AF,TIM1/TIM2/LPTIM1,TIM1/TIM2,SPI2S2/TIM1/LPTIM3,I2C1/I2C2/I2C3,SPI1/SPI2S2,RF,USART1/USART2,LPUART1,,,,COMP1/COMP2/TIM1,DEBUG,TIM2/TIM16/TIM17/LPTIM2,EVENOUT,ADC +PortA,PA0,,TIM2_CH1,,,I2C3_SMBA,I2S_CKIN,,USART2_CTS,,,,,COMP1_OUT,DEBUG_PWR_REGLP1S,TIM2_ETR,EVENTOUT,ADC123_IN0 +PortA,PA1,,TIM2_CH2,,LPTIM3_OUT,I2C1_SMBA,SPI1_SCK,,USART2_RTS,LPUART1_RTS,,,,,DEBUG_PWR_REGLP2S,,EVENTOUT,ADC123_IN1 +PortA,PA2,LSCO,TIM2_CH3,,,,,,USART2_TX,LPUART1_TX,,,,COMP2_OUT,DEBUG_PWR_LDORDY,,EVENTOUT,ADC123_IN2 +PortA,PA3,,TIM2_CH4,,,,I2S2_MCK,,USART2_RX,LPUART1_RX,,,,,,,EVENTOUT,ADC123_IN3 +PortA,PA4,RTC_OUT2,LPTIM1_OUT,,,,SPI1_NSS,,USART2_CK,,,,,,DEBUG_SUBGHZSPI_NSSOUT,LPTIM2_OUT,EVENTOUT,ADC12_IN4 +PortA,PA5,,TIM2_CH1,TIM2_ETR,SPI2_MISO,,SPI1_SCK,,,,,,,,DEBUG_SUBGHZSPI_SCKOUT,LPTIM2_ETR,EVENTOUT,ADC12_IN5 +PortA,PA6,,TIM1_BKIN,,,I2C2_SMBA,SPI1_MISO,,,LPUART1_CTS,,,,TIM1_BKIN,DEBUG_SUBGHZSPI_MISOOUT,TIM16_CH1,EVENTOUT,ADC12_IN6 +PortA,PA7,,TIM1_CH1N,,,I2C3_SCL,SPI1_MOSI,,,,,,,COMP2_OUT,DEBUG_SUBGHZSPI_MOSIOUT,TIM17_CH1,EVENTOUT,ADC12_IN7 +PortA,PA8,MCO,TIM1_CH1,,,,SPI2_SCK/I2S2_CK,,USART1_CK,,,,,,,LPTIM2_OUT,EVENTOUT, +PortA,PA9,,TIM1_CH2,,SPI2_NSS/I2S2_WS,I2C1_SCL,SPI2_SCK/I2S2_CK,,USART1_TX,,,,,,,,EVENTOUT, +PortA,PA10,RTC_REFIN,TIM1_CH3,,,I2C1_SDA,SPI2_MOSI/I2S2_SD,,USART1_RX,,,,,,DEBUG_RF_HSE32RDY,TIM17_BKIN,EVENTOUT, +PortA,PA11,,TIM1_CH4,TIM1_BKIN2,LPTIM3_ETR,I2C2_SDA,SPI1_MISO,,USART1_CTS,,,,,TIM1_BKIN2,DEBUG_RF_NRESET,,EVENTOUT, +PortA,PA12,,TIM1_ETR,,LPTIM3_IN1,I2C2_SCL,SPI1_MOSI,RF_BUSY,USART1_RTS,,,,,,,,EVENTOUT, +PortA,PA13,JTMS/SWDIO,,,,I2C2_SMBA,,,,IR_OUT,,,,,,,EVENTOUT, +PortA,PA14,JTCK/SWCLK,LPTIM1_OUT,,,I2C1_SMBA,,,,,,,,,,,EVENTOUT, +PortA,PA15,JTDI,TIM2_CH1,TIM2_ETR,,I2C2_SDA,SPI1_NSS,,,,,,,,,,EVENTOUT, +PortB,PB0,,,,,,,,,,,,,COMP1_OUT,,,EVENTOUT,ADC12_IN8 +PortB,PB1,,,,,,,,,LPUART1_RTS_DE,,,,,,LPTIM2_IN1,EVENTOUT,ADC12_IN9 +PortB,PB2,,LPTIM1_OUT,,,I2C3_SMBA,SPI1_NSS,,,,,,,,DEBUG_RF_SMPSRDY,,EVENTOUT, +PortB,PB3,JTDO/TRACESWO,TIM2_CH2,,,,SPI1_SCK,RF_IRQ0,USART1_RTS,,,,,,DEBUG_RF_DTB1,,EVENTOUT, +PortB,PB4,NJTRST,,,,I2C3_SDA,SPI1_MISO,,USART1_CTS,,,,,,DEBUG_RF_LDORDY,TIM17_BKIN,EVENTOUT, +PortB,PB5,,LPTIM1_IN1,,,I2C1_SMBA,SPI1_MOSI,RF_IRQ1,USART1_CK,,,,,COMP2_OUT,,TIM16_BKIN,EVENTOUT, +PortB,PB6,,LPTIM1_ETR,,,I2C1_SCL,,,USART1_TX,,,,,,,TIM16_CH1N,EVENTOUT, +PortB,PB7,,LPTIM1_IN2,,TIM1_BKIN,I2C1_SDA,,,USART1_RX,,,,,,,TIM17_CH1N,EVENTOUT, +PortB,PB8,,TIM1_CH2N,,,I2C1_SCL,,RF_IRQ2,,,,,,,,TIM16_CH1,EVENTOUT, +PortB,PB9,,TIM1_CH3N,,,I2C1_SDA,SPI2_NSS/I2S2_WS,,,IR_OUT,,,,,,TIM17_CH1,EVENTOUT, +PortB,PB10,,TIM2_CH3,,,I2C3_SCL,SPI2_SCK/I2S2_CK,,,LPUART1_RX,,,,COMP1_OUT,,,EVENTOUT, +PortB,PB11,,TIM2_CH4,,,I2C3_SDA,,,,LPUART1_TX,,,,COMP2_OUT,,,EVENTOUT, +PortB,PB12,,TIM1_BKIN,,TIM1_BKIN,I2C3_SMBA,SPI2_NSS/I2S2_WS,,,LPUART1_RTS,,,,,,,EVENTOUT, +PortB,PB13,,TIM1_CH1N,,,I2C3_SCL,SPI2_SCK/I2S2_CK,,,LPUART1_CTS,,,,,,,EVENTOUT, +PortB,PB14,,TIM1_CH2N,,I2S2_MCK,I2C3_SDA,SPI2_MISO,,,,,,,,,,EVENTOUT, +PortB,PB15,,TIM1_CH3N,,,I2C2_SCL,SPI2_MOSI/I2S2_SD,,,,,,,,,,EVENTOUT, +PortC,PC0,,LPTIM1_IN1,,,I2C3_SCL,,,,LPUART1_RX,,,,,,LPTIM2_IN1,EVENTOUT,ADC123_IN10 +PortC,PC1,,LPTIM1_OUT,,SPI2_MOSI/I2S2_SD,I2C3_SDA,,,,LPUART1_TX,,,,,,,EVENTOUT,ADC123_IN11 +PortC,PC2,,LPTIM1_IN2,,,,SPI2_MISO,,,,,,,,,,EVENTOUT,ADC123_IN12 +PortC,PC3,,LPTIM1_ETR,,,,SPI2_MOSI/I2S2_SD,,,,,,,,,LPTIM2_ETR,EVENTOUT,ADC123_IN13 +PortC,PC4,,,,,,,,,,,,,,,,EVENTOUT,ADC12_IN14 +PortC,PC5,,,,,,,,,,,,,,,,EVENTOUT,ADC12_IN15 +PortC,PC6,,,,,,I2S2_MCK,,,,,,,,,,EVENTOUT, +PortC,PC13,,,,,,,,,,,,,,,,EVENTOUT, +PortC,PC14,,,,,,,,,,,,,,,,EVENTOUT, +PortC,PC15,,,,,,,,,,,,,,,,EVENTOUT, +PortH,PH3,,,,,,,,,,,,,,,,EVENTOUT, diff --git a/ports/stm32/boards/stm32wl55xc.ld b/ports/stm32/boards/stm32wl55xc.ld new file mode 100644 index 0000000000..109675bb5e --- /dev/null +++ b/ports/stm32/boards/stm32wl55xc.ld @@ -0,0 +1,34 @@ +/* + GNU linker script for STM32WL55xC +*/ + +/* Specify the memory areas */ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K /* sectors 0-127 */ + FLASH_APP (rx) : ORIGIN = 0x08000000, LENGTH = 232K /* sectors 0-115 */ + FLASH_FS (r) : ORIGIN = 0x0803a000, LENGTH = 24K /* sectors 116-127 */ + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K /* SRAM1+SRAM2 */ +} + +/* produce a link error if there is not this amount of RAM for these sections */ +_minimum_stack_size = 2K; +_minimum_heap_size = 16K; + +/* RAM extents for the garbage collector */ +_ram_start = ORIGIN(RAM); +_ram_end = ORIGIN(RAM) + LENGTH(RAM); + +_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(RAM) + LENGTH(RAM); +_micropy_hw_internal_flash_storage_ram_cache_start = _micropy_hw_internal_flash_storage_ram_cache_end - 2K; /* fs cache = 2K */ + +/* Define the stack. The stack is full descending so begins at the bottom of FS cache. + Note that EABI requires the stack to be 8-byte aligned for a call. */ +_estack = _micropy_hw_internal_flash_storage_ram_cache_start - _estack_reserve; +_sstack = _estack - 6K; + +_heap_start = _ebss; /* heap starts just after statically allocated memory */ +_heap_end = _sstack; + +_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); +_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); diff --git a/ports/stm32/boards/stm32wlxx_hal_conf_base.h b/ports/stm32/boards/stm32wlxx_hal_conf_base.h new file mode 100644 index 0000000000..e98b0525bd --- /dev/null +++ b/ports/stm32/boards/stm32wlxx_hal_conf_base.h @@ -0,0 +1,78 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Damien P. George + * + * 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_STM32WLXX_HAL_CONF_BASE_H +#define MICROPY_INCLUDED_STM32WLXX_HAL_CONF_BASE_H + +// Include various HAL modules for convenience +#include "stm32wlxx_hal_dma.h" +#include "stm32wlxx_hal_adc.h" +#include "stm32wlxx_hal_cortex.h" +#include "stm32wlxx_hal_flash.h" +#include "stm32wlxx_hal_gpio.h" +#include "stm32wlxx_hal_i2c.h" +#include "stm32wlxx_hal_pwr.h" +#include "stm32wlxx_hal_rcc.h" +#include "stm32wlxx_hal_rtc.h" +#include "stm32wlxx_hal_spi.h" +#include "stm32wlxx_hal_tim.h" +#include "stm32wlxx_hal_uart.h" +#include "stm32wlxx_hal_usart.h" +#include "stm32wlxx_ll_adc.h" +#include "stm32wlxx_ll_lpuart.h" +#include "stm32wlxx_ll_rtc.h" +#include "stm32wlxx_ll_usart.h" + +// Enable various HAL modules +#define HAL_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_GPIO_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_RTC_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +#define HAL_UART_MODULE_ENABLED +#define HAL_USART_MODULE_ENABLED + +// Oscillator values in Hz +#define MSI_VALUE (4000000) + +// SysTick has the highest priority +#define TICK_INT_PRIORITY (0x00) + +// Miscellaneous HAL settings +#define DATA_CACHE_ENABLE 1 +#define INSTRUCTION_CACHE_ENABLE 1 +#define PREFETCH_ENABLE 0 +#define USE_SPI_CRC 0 +#define USE_RTOS 0 + +// HAL parameter assertions are disabled +#define assert_param(expr) ((void)0) + +#endif // MICROPY_INCLUDED_STM32WLXX_HAL_CONF_BASE_H diff --git a/ports/stm32/dma.c b/ports/stm32/dma.c index dc706e68aa..75c34325d7 100644 --- a/ports/stm32/dma.c +++ b/ports/stm32/dma.c @@ -74,7 +74,7 @@ typedef union { struct _dma_descr_t { #if defined(STM32F4) || defined(STM32F7) || defined(STM32H7) DMA_Stream_TypeDef *instance; - #elif defined(STM32F0) || defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) + #elif defined(STM32F0) || defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) DMA_Channel_TypeDef *instance; #else #error "Unsupported Processor" @@ -89,7 +89,7 @@ struct _dma_descr_t { static const DMA_InitTypeDef dma_init_struct_spi_i2c = { #if defined(STM32F4) || defined(STM32F7) .Channel = 0, - #elif defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) .Request = 0, #endif .Direction = 0, @@ -467,7 +467,7 @@ static const uint8_t dma_irqn[NSTREAM] = { DMA2_Channel7_IRQn, }; -#elif defined(STM32WB) +#elif defined(STM32WB) || defined(STM32WL) #define NCONTROLLERS (2) #define NSTREAMS_PER_CONTROLLER (7) @@ -1152,7 +1152,7 @@ void dma_init_handle(DMA_HandleTypeDef *dma, const dma_descr_t *dma_descr, uint3 dma->Instance = dma_descr->instance; dma->Init = *dma_descr->init; dma->Init.Direction = dir; - #if defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) dma->Init.Request = dma_descr->sub_instance; #else #if !defined(STM32F0) @@ -1179,7 +1179,7 @@ void dma_init(DMA_HandleTypeDef *dma, const dma_descr_t *dma_descr, uint32_t dir dma_enable_clock(dma_id); - #if defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) // Always reset and configure the H7 and L0/L4 DMA peripheral // (dma->State is set to HAL_DMA_STATE_RESET by memset above) // TODO: understand how L0/L4 DMA works so this is not needed @@ -1353,7 +1353,7 @@ void dma_nohal_start(const dma_descr_t *descr, uint32_t src_addr, uint32_t dst_a dma->CCR |= DMA_CCR_EN; } -#elif defined(STM32WB) +#elif defined(STM32WB) || defined(STM32WL) // These functions are currently not implemented or needed for this MCU. diff --git a/ports/stm32/dma.h b/ports/stm32/dma.h index 29d5c3d2eb..9b0b4c77a6 100644 --- a/ports/stm32/dma.h +++ b/ports/stm32/dma.h @@ -100,7 +100,7 @@ extern const dma_descr_t dma_I2C_2_RX; extern const dma_descr_t dma_I2C_1_TX; extern const dma_descr_t dma_I2C_1_RX; -#elif defined(STM32L4) || defined(STM32WB) +#elif defined(STM32L4) || defined(STM32WB) || defined(STM32WL) extern const dma_descr_t dma_ADC_1_RX; extern const dma_descr_t dma_ADC_2_RX; diff --git a/ports/stm32/extint.c b/ports/stm32/extint.c index bb26b00dde..55c9095f11 100644 --- a/ports/stm32/extint.c +++ b/ports/stm32/extint.c @@ -91,7 +91,7 @@ #define EXTI_SWIER_BB(line) (*(__IO uint32_t *)(PERIPH_BB_BASE + ((EXTI_OFFSET + offsetof(EXTI_TypeDef, SWIER)) * 32) + ((line) * 4))) #endif -#if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) +#if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) // The L4 MCU supports 40 Events/IRQs lines of the type configurable and direct. // Here we only support configurable line types. Details, see page 330 of RM0351, Rev 1. // The USB_FS_WAKUP event is a direct type and there is no support for it. @@ -181,6 +181,12 @@ STATIC const uint8_t nvic_irq_channel[EXTI_NUM_VECTORS] = { RTC_Alarm_IRQn, TAMP_STAMP_LSECSS_IRQn, RTC_WKUP_IRQn, + #elif defined(STM32WL) + PVD_PVM_IRQn, + RTC_Alarm_IRQn, + TAMP_STAMP_LSECSS_SSRU_IRQn, // SSRU + TAMP_STAMP_LSECSS_SSRU_IRQn, // TAMP, RTC_STAMP, LSE_CSS + RTC_WKUP_IRQn, #else #if defined(STM32G4) || defined(STM32L4) PVD_PVM_IRQn, @@ -308,7 +314,7 @@ void extint_register_pin(const pin_obj_t *pin, uint32_t mode, bool hard_irq, mp_ pyb_extint_callback_arg[line] = MP_OBJ_FROM_PTR(pin); // Route the GPIO to EXTI - #if !defined(STM32WB) + #if !defined(STM32WB) && !defined(STM32WL) __HAL_RCC_SYSCFG_CLK_ENABLE(); #endif SYSCFG->EXTICR[line >> 2] = @@ -345,7 +351,7 @@ void extint_set(const pin_obj_t *pin, uint32_t mode) { pyb_extint_callback_arg[line] = MP_OBJ_FROM_PTR(pin); // Route the GPIO to EXTI - #if !defined(STM32WB) + #if !defined(STM32WB) && !defined(STM32WL) __HAL_RCC_SYSCFG_CLK_ENABLE(); #endif SYSCFG->EXTICR[line >> 2] = @@ -385,7 +391,7 @@ void extint_enable(uint line) { if (pyb_extint_mode[line] == EXTI_Mode_Interrupt) { #if defined(STM32H7) EXTI_D1->IMR1 |= (1 << line); - #elif defined(STM32G4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32WB) || defined(STM32WL) EXTI->IMR1 |= (1 << line); #else EXTI->IMR |= (1 << line); @@ -393,7 +399,7 @@ void extint_enable(uint line) { } else { #if defined(STM32H7) EXTI_D1->EMR1 |= (1 << line); - #elif defined(STM32G4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32WB) || defined(STM32WL) EXTI->EMR1 |= (1 << line); #else EXTI->EMR |= (1 << line); @@ -419,7 +425,7 @@ void extint_disable(uint line) { #if defined(STM32H7) EXTI_D1->IMR1 &= ~(1 << line); EXTI_D1->EMR1 &= ~(1 << line); - #elif defined(STM32G4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32WB) || defined(STM32WL) EXTI->IMR1 &= ~(1 << line); EXTI->EMR1 &= ~(1 << line); #else @@ -441,7 +447,7 @@ void extint_swint(uint line) { return; } // we need 0 to 1 transition to trigger the interrupt - #if defined(STM32G4) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) EXTI->SWIER1 &= ~(1 << line); EXTI->SWIER1 |= (1 << line); #else @@ -519,7 +525,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(extint_obj_swint_obj, extint_obj_swint); /// \classmethod regs() /// Dump the values of the EXTI registers. STATIC mp_obj_t extint_regs(void) { - #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) printf("EXTI_IMR1 %08x\n", (unsigned int)EXTI->IMR1); printf("EXTI_IMR2 %08x\n", (unsigned int)EXTI->IMR2); printf("EXTI_EMR1 %08x\n", (unsigned int)EXTI->EMR1); diff --git a/ports/stm32/extint.h b/ports/stm32/extint.h index 0cdf5024a0..247852fa19 100644 --- a/ports/stm32/extint.h +++ b/ports/stm32/extint.h @@ -43,7 +43,7 @@ #endif #define EXTI_ETH_WAKEUP (19) #define EXTI_USB_OTG_HS_WAKEUP (20) -#if defined(STM32F0) || defined(STM32G4) || defined(STM32L4) +#if defined(STM32F0) || defined(STM32G4) || defined(STM32L4) || defined(STM32WL) #define EXTI_RTC_TIMESTAMP (19) #define EXTI_RTC_WAKEUP (20) #elif defined(STM32H7) || defined(STM32WB) diff --git a/ports/stm32/flash.c b/ports/stm32/flash.c index eeeab52049..0c4d2cf5b9 100644 --- a/ports/stm32/flash.c +++ b/ports/stm32/flash.c @@ -97,7 +97,7 @@ static const flash_layout_t flash_layout[] = { }; #endif -#elif defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) +#elif defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) static const flash_layout_t flash_layout[] = { { (uint32_t)FLASH_BASE, (uint32_t)FLASH_PAGE_SIZE, 512 }, @@ -159,7 +159,7 @@ static uint32_t get_page(uint32_t addr) { } #endif -#elif (defined(STM32L4) && !defined(SYSCFG_MEMRMP_FB_MODE)) || defined(STM32WB) +#elif (defined(STM32L4) && !defined(SYSCFG_MEMRMP_FB_MODE)) || defined(STM32WB) || defined(STM32WL) static uint32_t get_page(uint32_t addr) { return (addr - FLASH_BASE) / FLASH_PAGE_SIZE; @@ -263,7 +263,7 @@ int flash_erase(uint32_t flash_dest, uint32_t num_word32) { EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES; EraseInitStruct.PageAddress = flash_dest; EraseInitStruct.NbPages = (4 * num_word32 + FLASH_PAGE_SIZE - 4) / FLASH_PAGE_SIZE; - #elif (defined(STM32L4) && !defined(SYSCFG_MEMRMP_FB_MODE)) || defined(STM32WB) + #elif (defined(STM32L4) && !defined(SYSCFG_MEMRMP_FB_MODE)) || defined(STM32WB) || defined(STM32WL) __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_ALL_ERRORS); EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES; EraseInitStruct.Page = get_page(flash_dest); @@ -370,7 +370,7 @@ int flash_write(uint32_t flash_dest, const uint32_t *src, uint32_t num_word32) { HAL_StatusTypeDef status = HAL_OK; - #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) // program the flash uint64 by uint64 for (int i = 0; i < num_word32 / 2; i++) { diff --git a/ports/stm32/machine_adc.c b/ports/stm32/machine_adc.c index 21b35cdcdb..819fd3414f 100644 --- a/ports/stm32/machine_adc.c +++ b/ports/stm32/machine_adc.c @@ -28,7 +28,7 @@ #include "py/mphal.h" #include "adc.h" -#if defined(STM32F0) || defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) +#if defined(STM32F0) || defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) #define ADC_V2 (1) #else #define ADC_V2 (0) @@ -42,7 +42,7 @@ #define ADCx_COMMON __LL_ADC_COMMON_INSTANCE(0) #endif -#if defined(STM32F0) || defined(STM32L0) +#if defined(STM32F0) || defined(STM32L0) || defined(STM32WL) #define ADC_STAB_DELAY_US (1) #define ADC_TEMPSENSOR_DELAY_US (10) #elif defined(STM32G4) @@ -65,7 +65,7 @@ #elif defined(STM32H7) #define ADC_SAMPLETIME_DEFAULT ADC_SAMPLETIME_8CYCLES_5 #define ADC_SAMPLETIME_DEFAULT_INT ADC_SAMPLETIME_387CYCLES_5 -#elif defined(STM32L0) +#elif defined(STM32L0) || defined(STM32WL) #define ADC_SAMPLETIME_DEFAULT ADC_SAMPLETIME_12CYCLES_5 #define ADC_SAMPLETIME_DEFAULT_INT ADC_SAMPLETIME_160CYCLES_5 #elif defined(STM32L4) || defined(STM32WB) @@ -105,7 +105,7 @@ STATIC const uint8_t adc_cr_to_bits_table[] = {12, 10, 8, 6}; void adc_config(ADC_TypeDef *adc, uint32_t bits) { // Configure ADC clock source and enable ADC clock - #if defined(STM32L4) || defined(STM32WB) + #if defined(STM32L4) || defined(STM32WB) || defined(STM32WL) __HAL_RCC_ADC_CONFIG(RCC_ADCCLKSOURCE_SYSCLK); __HAL_RCC_ADC_CLK_ENABLE(); #else @@ -150,6 +150,8 @@ void adc_config(ADC_TypeDef *adc, uint32_t bits) { ADC1_COMMON->CCR = 0; // ADCPR=PCLK/2 #elif defined(STM32WB) ADC1_COMMON->CCR = 0 << ADC_CCR_PRESC_Pos | 0 << ADC_CCR_CKMODE_Pos; // PRESC=1, MODE=ASYNC + #elif defined(STM32WL) + ADC_COMMON->CCR = 0 << ADC_CCR_PRESC_Pos; // PRESC=1 #endif #if defined(STM32H7) || defined(STM32L4) || defined(STM32WB) @@ -158,7 +160,7 @@ void adc_config(ADC_TypeDef *adc, uint32_t bits) { } #endif - #if defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) if (!(adc->CR & ADC_CR_ADVREGEN)) { adc->CR = ADC_CR_ADVREGEN; // enable VREG #if defined(STM32H7) @@ -172,7 +174,7 @@ void adc_config(ADC_TypeDef *adc, uint32_t bits) { #if ADC_V2 if (!(adc->CR & ADC_CR_ADEN)) { // ADC isn't enabled so calibrate it now - #if defined(STM32F0) || defined(STM32L0) + #if defined(STM32F0) || defined(STM32L0) || defined(STM32WL) LL_ADC_StartCalibration(adc); #elif defined(STM32G4) || defined(STM32L4) || defined(STM32WB) LL_ADC_StartCalibration(adc, LL_ADC_SINGLE_ENDED); @@ -235,7 +237,7 @@ void adc_config(ADC_TypeDef *adc, uint32_t bits) { } STATIC int adc_get_bits(ADC_TypeDef *adc) { - #if defined(STM32F0) || defined(STM32L0) + #if defined(STM32F0) || defined(STM32L0) || defined(STM32WL) uint32_t res = (adc->CFGR1 & ADC_CFGR1_RES) >> ADC_CFGR1_RES_Pos; #elif defined(STM32F4) || defined(STM32F7) uint32_t res = (adc->CR1 & ADC_CR1_RES) >> ADC_CR1_RES_Pos; @@ -409,7 +411,11 @@ STATIC mp_obj_t machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, s uint32_t sample_time = ADC_SAMPLETIME_DEFAULT; ADC_TypeDef *adc; if (mp_obj_is_int(source)) { + #if defined(STM32WL) + adc = ADC; + #else adc = ADC1; + #endif channel = mp_obj_get_int(source); if (channel == ADC_CHANNEL_VREFINT #if defined(STM32G4) @@ -426,7 +432,11 @@ STATIC mp_obj_t machine_adc_make_new(const mp_obj_type_t *type, size_t n_args, s } else { const pin_obj_t *pin = pin_find(source); if (pin->adc_num & PIN_ADC1) { + #if defined(STM32WL) + adc = ADC; + #else adc = ADC1; + #endif #if defined(ADC2) } else if (pin->adc_num & PIN_ADC2) { adc = ADC2; diff --git a/ports/stm32/machine_uart.c b/ports/stm32/machine_uart.c index 6a12fad324..681939094b 100644 --- a/ports/stm32/machine_uart.c +++ b/ports/stm32/machine_uart.c @@ -459,7 +459,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(pyb_uart_readchar_obj, pyb_uart_readchar); // uart.sendbreak() STATIC mp_obj_t pyb_uart_sendbreak(mp_obj_t self_in) { pyb_uart_obj_t *self = MP_OBJ_TO_PTR(self_in); - #if defined(STM32F0) || defined(STM32F7) || defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32F0) || defined(STM32F7) || defined(STM32G4) || defined(STM32H7) || defined(STM32L0) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) self->uartx->RQR = USART_RQR_SBKRQ; // write-only register #else self->uartx->CR1 |= USART_CR1_SBK; diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c index f9026bc370..57b8ef5e6b 100644 --- a/ports/stm32/modmachine.c +++ b/ports/stm32/modmachine.c @@ -63,7 +63,7 @@ #define RCC_CSR_BORRSTF RCC_CSR_PORRSTF #endif -#if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) +#if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) // L4 does not have a POR, so use BOR instead #define RCC_CSR_PORRSTF RCC_CSR_BORRSTF #endif diff --git a/ports/stm32/mpconfigboard_common.h b/ports/stm32/mpconfigboard_common.h index 17a4ad26e4..7c8662318d 100644 --- a/ports/stm32/mpconfigboard_common.h +++ b/ports/stm32/mpconfigboard_common.h @@ -404,6 +404,16 @@ #define MICROPY_HW_RFCORE_BLE_LL_ONLY (1) // use LL only, we provide the rest of the BLE stack #endif +// Configuration for STM32WL series +#elif defined(STM32WL) + +#define MP_HAL_UNIQUE_ID_ADDRESS (UID_BASE) +#define PYB_EXTI_NUM_VECTORS (21) // up to RTC_WKUP +#define MICROPY_HW_MAX_I2C (3) +#define MICROPY_HW_MAX_TIMER (17) +#define MICROPY_HW_MAX_UART (2) +#define MICROPY_HW_MAX_LPUART (1) + #else #error Unsupported MCU series #endif diff --git a/ports/stm32/mphalport.c b/ports/stm32/mphalport.c index 2b98a620ef..2025388413 100644 --- a/ports/stm32/mphalport.c +++ b/ports/stm32/mphalport.c @@ -99,7 +99,7 @@ void mp_hal_gpio_clock_enable(GPIO_TypeDef *gpio) { #elif defined(STM32L0) #define AHBxENR IOPENR #define AHBxENR_GPIOAEN_Pos RCC_IOPENR_IOPAEN_Pos - #elif defined(STM32G4) || defined(STM32L4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) #define AHBxENR AHB2ENR #define AHBxENR_GPIOAEN_Pos RCC_AHB2ENR_GPIOAEN_Pos #endif diff --git a/ports/stm32/powerctrl.c b/ports/stm32/powerctrl.c index ad3a3ea4c2..a2e3b5c71b 100644 --- a/ports/stm32/powerctrl.c +++ b/ports/stm32/powerctrl.c @@ -151,7 +151,7 @@ void powerctrl_check_enter_bootloader(void) { #endif } -#if !defined(STM32F0) && !defined(STM32L0) && !defined(STM32WB) +#if !defined(STM32F0) && !defined(STM32L0) && !defined(STM32WB) && !defined(STM32WL) typedef struct _sysclk_scaling_table_entry_t { uint16_t mhz; @@ -542,9 +542,15 @@ set_clk: return 0; } -#elif defined(STM32WB) +#elif defined(STM32WB) || defined(STM32WL) +#if defined(STM32WB) #include "stm32wbxx_ll_utils.h" +#define FLASH_LATENCY_MAX LL_FLASH_LATENCY_3 +#else +#include "stm32wlxx_ll_utils.h" +#define FLASH_LATENCY_MAX LL_FLASH_LATENCY_2 +#endif #define LPR_THRESHOLD (2000000) #define VOS2_THRESHOLD (16000000) @@ -605,8 +611,8 @@ int powerctrl_set_sysclk(uint32_t sysclk, uint32_t ahb, uint32_t apb1, uint32_t } else if (sysclk_mode == SYSCLK_MODE_MSI) { // Set flash latency to maximum to ensure the latency is large enough for // both the current SYSCLK and the SYSCLK that will be selected below. - LL_FLASH_SetLatency(LL_FLASH_LATENCY_3); - while (LL_FLASH_GetLatency() != LL_FLASH_LATENCY_3) { + LL_FLASH_SetLatency(FLASH_LATENCY_MAX); + while (LL_FLASH_GetLatency() != FLASH_LATENCY_MAX) { } // Before changing the MSIRANGE value, if MSI is on then it must also be ready. @@ -686,7 +692,7 @@ void powerctrl_enter_stop_mode(void) { __HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_MSI); #endif - #if !defined(STM32F0) && !defined(STM32G4) && !defined(STM32L0) && !defined(STM32L4) && !defined(STM32WB) + #if !defined(STM32F0) && !defined(STM32G4) && !defined(STM32L0) && !defined(STM32L4) && !defined(STM32WB) && !defined(STM32WL) // takes longer to wake but reduces stop current HAL_PWREx_EnableFlashPowerDown(); #endif @@ -765,7 +771,7 @@ void powerctrl_enter_stop_mode(void) { #if defined(STM32H7) while (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_CFGR_SWS_PLL1) { } - #elif defined(STM32WB) + #elif defined(STM32WB) || defined(STM32WL) while (__HAL_RCC_GET_SYSCLK_SOURCE() != RCC_SYSCLKSOURCE_STATUS_PLLCLK) { } #else @@ -861,7 +867,7 @@ void powerctrl_enter_standby_mode(void) { #if defined(STM32F0) || defined(STM32L0) #define CR_BITS (RTC_CR_ALRAIE | RTC_CR_WUTIE | RTC_CR_TSIE) #define ISR_BITS (RTC_ISR_ALRAF | RTC_ISR_WUTF | RTC_ISR_TSF) - #elif defined(STM32G4) + #elif defined(STM32G4) || defined(STM32WL) #define CR_BITS (RTC_CR_ALRAIE | RTC_CR_ALRBIE | RTC_CR_WUTIE | RTC_CR_TSIE) #define ISR_BITS (RTC_MISR_ALRAMF | RTC_MISR_ALRBMF | RTC_MISR_WUTMF | RTC_MISR_TSMF) #elif defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) @@ -885,7 +891,7 @@ void powerctrl_enter_standby_mode(void) { // clear RTC wake-up flags #if defined(SR_BITS) RTC->SR &= ~SR_BITS; - #elif defined(STM32G4) + #elif defined(STM32G4) || defined(STM32WL) RTC->MISR &= ~ISR_BITS; #else RTC->ISR &= ~ISR_BITS; @@ -907,6 +913,9 @@ void powerctrl_enter_standby_mode(void) { // clear all wake-up flags PWR->SCR |= PWR_SCR_CWUF5 | PWR_SCR_CWUF4 | PWR_SCR_CWUF3 | PWR_SCR_CWUF2 | PWR_SCR_CWUF1; // TODO + #elif defined(STM32WL) + // clear all wake-up flags + PWR->SCR |= PWR_SCR_CWUF3 | PWR_SCR_CWUF2 | PWR_SCR_CWUF1; #else // clear global wake-up flag PWR->CR |= PWR_CR_CWUF; diff --git a/ports/stm32/powerctrlboot.c b/ports/stm32/powerctrlboot.c index 41b56296e0..4ecd83e2c6 100644 --- a/ports/stm32/powerctrlboot.c +++ b/ports/stm32/powerctrlboot.c @@ -212,4 +212,41 @@ void SystemClock_Config(void) { powerctrl_config_systick(); } +#elif defined(STM32WL) + +#include "stm32wlxx_ll_utils.h" + +void SystemClock_Config(void) { + // Set flash latency + LL_FLASH_SetLatency(LL_FLASH_LATENCY_2); + while (LL_FLASH_GetLatency() != LL_FLASH_LATENCY_2) { + } + + LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1); + + // Enable MSI + LL_RCC_MSI_Enable(); + while (!LL_RCC_MSI_IsReady()) { + } + + // Configure MSI + LL_RCC_MSI_EnableRangeSelection(); + LL_RCC_MSI_SetRange(LL_RCC_MSIRANGE_11); + LL_RCC_MSI_SetCalibTrimming(0); + + // Select SYSCLK source + LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_MSI); + while (LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_MSI) { + } + + // Set bus dividers + LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1); + LL_RCC_SetAHB3Prescaler(LL_RCC_SYSCLK_DIV_1); + LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1); + LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1); + + SystemCoreClockUpdate(); + powerctrl_config_systick(); +} + #endif diff --git a/ports/stm32/rtc.c b/ports/stm32/rtc.c index 1164e71e08..e776f67bb9 100644 --- a/ports/stm32/rtc.c +++ b/ports/stm32/rtc.c @@ -94,6 +94,11 @@ STATIC bool rtc_need_init_finalise = false; #endif void rtc_init_start(bool force_init) { + #if defined(STM32WL) + // Enable the RTC APB bus clock, to communicate with the RTC. + __HAL_RCC_RTCAPB_CLK_ENABLE(); + #endif + RTCHandle.Instance = RTC; /* Configure RTC prescaler and RTC data registers */ @@ -220,7 +225,7 @@ void rtc_init_finalise() { // fresh reset; configure RTC Calendar RTC_CalendarConfig(); - #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) if (__HAL_RCC_GET_FLAG(RCC_FLAG_BORRST) != RESET) { #else if (__HAL_RCC_GET_FLAG(RCC_FLAG_PORRST) != RESET) { @@ -252,7 +257,7 @@ STATIC HAL_StatusTypeDef PYB_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct /*------------------------------ LSE Configuration -------------------------*/ if ((RCC_OscInitStruct->OscillatorType & RCC_OSCILLATORTYPE_LSE) == RCC_OSCILLATORTYPE_LSE) { - #if !defined(STM32H7) && !defined(STM32WB) + #if !defined(STM32H7) && !defined(STM32WB) && !defined(STM32WL) // Enable Power Clock __HAL_RCC_PWR_CLK_ENABLE(); #endif @@ -261,7 +266,7 @@ STATIC HAL_StatusTypeDef PYB_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct HAL_PWR_EnableBkUpAccess(); uint32_t tickstart = HAL_GetTick(); - #if defined(STM32F7) || defined(STM32G4) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32F7) || defined(STM32G4) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) || defined(STM32WL) // __HAL_RCC_PWR_CLK_ENABLE(); // Enable write access to Backup domain // PWR->CR1 |= PWR_CR1_DBP; @@ -349,7 +354,7 @@ STATIC HAL_StatusTypeDef PYB_RTC_Init(RTC_HandleTypeDef *hrtc) { #elif defined(STM32F7) hrtc->Instance->OR &= (uint32_t) ~RTC_OR_ALARMTYPE; hrtc->Instance->OR |= (uint32_t)(hrtc->Init.OutPutType); - #elif defined(STM32G4) + #elif defined(STM32G4) || defined(STM32WL) hrtc->Instance->CR &= (uint32_t) ~RTC_CR_TAMPALRM_TYPE_Msk; hrtc->Instance->CR |= (uint32_t)(hrtc->Init.OutPutType); #else @@ -714,7 +719,7 @@ mp_obj_t pyb_rtc_wakeup(size_t n_args, const mp_obj_t *args) { RTC->WPR = 0xff; // enable external interrupts on line EXTI_RTC_WAKEUP - #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) EXTI->IMR1 |= 1 << EXTI_RTC_WAKEUP; EXTI->RTSR1 |= 1 << EXTI_RTC_WAKEUP; #elif defined(STM32H7) @@ -726,14 +731,14 @@ mp_obj_t pyb_rtc_wakeup(size_t n_args, const mp_obj_t *args) { #endif // clear interrupt flags - #if defined(STM32G4) + #if defined(STM32G4) || defined(STM32WL) RTC->ICSR &= ~RTC_ICSR_WUTWF; #elif defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) RTC->SR &= ~RTC_SR_WUTF; #else RTC->ISR &= ~RTC_ISR_WUTF; #endif - #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) EXTI->PR1 = 1 << EXTI_RTC_WAKEUP; #elif defined(STM32H7) EXTI_D1->PR1 = 1 << EXTI_RTC_WAKEUP; @@ -753,7 +758,7 @@ mp_obj_t pyb_rtc_wakeup(size_t n_args, const mp_obj_t *args) { RTC->WPR = 0xff; // disable external interrupts on line EXTI_RTC_WAKEUP - #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32L4) || defined(STM32WB) || defined(STM32WL) EXTI->IMR1 &= ~(1 << EXTI_RTC_WAKEUP); #elif defined(STM32H7) EXTI_D1->IMR1 |= 1 << EXTI_RTC_WAKEUP; diff --git a/ports/stm32/stm32.mk b/ports/stm32/stm32.mk index f17351cdca..4de101ce7a 100644 --- a/ports/stm32/stm32.mk +++ b/ports/stm32/stm32.mk @@ -48,7 +48,7 @@ CFLAGS_CORTEX_M += -mfpu=fpv5-d16 -mfloat-abi=hard SUPPORTS_HARDWARE_FP_SINGLE = 1 SUPPORTS_HARDWARE_FP_DOUBLE = 1 else -ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f0 l0)) +ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f0 l0 wl)) CFLAGS_CORTEX_M += -msoft-float else CFLAGS_CORTEX_M += -mfpu=fpv4-sp-d16 -mfloat-abi=hard @@ -66,3 +66,4 @@ CFLAGS_MCU_l0 = $(CFLAGS_CORTEX_M) -mtune=cortex-m0plus -mcpu=cortex-m0plus CFLAGS_MCU_l4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 CFLAGS_MCU_h7 = $(CFLAGS_CORTEX_M) -mtune=cortex-m7 -mcpu=cortex-m7 CFLAGS_MCU_wb = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 +CFLAGS_MCU_wl = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 diff --git a/ports/stm32/stm32_it.c b/ports/stm32/stm32_it.c index 84274e3c62..39229a143b 100644 --- a/ports/stm32/stm32_it.c +++ b/ports/stm32/stm32_it.c @@ -529,7 +529,7 @@ void TAMP_STAMP_IRQHandler(void) { void RTC_WKUP_IRQHandler(void) { IRQ_ENTER(RTC_WKUP_IRQn); - #if defined(STM32G4) + #if defined(STM32G4) || defined(STM32WL) RTC->MISR &= ~RTC_MISR_WUTMF; // clear wakeup interrupt flag #elif defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) RTC->SR &= ~RTC_SR_WUTF; // clear wakeup interrupt flag diff --git a/ports/stm32/timer.c b/ports/stm32/timer.c index 57c8dc6c7b..12f0515d4e 100644 --- a/ports/stm32/timer.c +++ b/ports/stm32/timer.c @@ -873,14 +873,14 @@ STATIC const uint32_t tim_instance_table[MICROPY_HW_MAX_TIMER] = { #endif #endif #if defined(TIM16) - #if defined(STM32F0) || defined(STM32H7) + #if defined(STM32F0) || defined(STM32H7) || defined(STM32WL) TIM_ENTRY(16, TIM16_IRQn), #else TIM_ENTRY(16, TIM1_UP_TIM16_IRQn), #endif #endif #if defined(TIM17) - #if defined(STM32F0) || defined(STM32H7) + #if defined(STM32F0) || defined(STM32H7) || defined(STM32WL) TIM_ENTRY(17, TIM17_IRQn), #else TIM_ENTRY(17, TIM1_TRG_COM_TIM17_IRQn), diff --git a/ports/stm32/uart.c b/ports/stm32/uart.c index 61e72999e2..13e1667d2c 100644 --- a/ports/stm32/uart.c +++ b/ports/stm32/uart.c @@ -41,16 +41,25 @@ #if defined(STM32F4) #define UART_RXNE_IS_SET(uart) ((uart)->SR & USART_SR_RXNE) #else -#if defined(STM32H7) +#if defined(STM32H7) || defined(STM32WL) #define USART_ISR_RXNE USART_ISR_RXNE_RXFNE #endif #define UART_RXNE_IS_SET(uart) ((uart)->ISR & USART_ISR_RXNE) #endif +#if defined(STM32WL) +#define UART_RXNE_IT_EN(uart) do { (uart)->CR1 |= USART_CR1_RXNEIE_RXFNEIE; } while (0) +#define UART_RXNE_IT_DIS(uart) do { (uart)->CR1 &= ~USART_CR1_RXNEIE_RXFNEIE; } while (0) +#else #define UART_RXNE_IT_EN(uart) do { (uart)->CR1 |= USART_CR1_RXNEIE; } while (0) #define UART_RXNE_IT_DIS(uart) do { (uart)->CR1 &= ~USART_CR1_RXNEIE; } while (0) +#endif +#if defined(STM32WL) +#define USART_CR1_IE_BASE (USART_CR1_PEIE | USART_CR1_TXEIE_TXFNFIE | USART_CR1_TCIE | USART_CR1_RXNEIE_RXFNEIE | USART_CR1_IDLEIE) +#else #define USART_CR1_IE_BASE (USART_CR1_PEIE | USART_CR1_TXEIE | USART_CR1_TCIE | USART_CR1_RXNEIE | USART_CR1_IDLEIE) +#endif #define USART_CR2_IE_BASE (USART_CR2_LBDIE) #define USART_CR3_IE_BASE (USART_CR3_CTSIE | USART_CR3_EIE) @@ -92,7 +101,7 @@ #define USART_CR2_IE_ALL (USART_CR2_IE_BASE) #define USART_CR3_IE_ALL (USART_CR3_IE_BASE | USART_CR3_WUFIE) -#elif defined(STM32L4) || defined(STM32WB) +#elif defined(STM32L4) || defined(STM32WB) || defined(STM32WL) #define USART_CR1_IE_ALL (USART_CR1_IE_BASE | USART_CR1_EOBIE | USART_CR1_RTOIE | USART_CR1_CMIE) #define USART_CR2_IE_ALL (USART_CR2_IE_BASE) #if defined(USART_CR3_TCBGTIE) @@ -113,9 +122,17 @@ typedef struct _pyb_uart_irq_map_t { STATIC const pyb_uart_irq_map_t mp_uart_irq_map[] = { { USART_CR1_IDLEIE, UART_FLAG_IDLE}, // RX idle { USART_CR1_PEIE, UART_FLAG_PE}, // parity error + #if defined(STM32WL) + { USART_CR1_TXEIE_TXFNFIE, UART_FLAG_TXE}, // TX register empty + #else { USART_CR1_TXEIE, UART_FLAG_TXE}, // TX register empty + #endif { USART_CR1_TCIE, UART_FLAG_TC}, // TX complete + #if defined(STM32WL) + { USART_CR1_RXNEIE_RXFNEIE, UART_FLAG_RXNE}, // RX register not empty + #else { USART_CR1_RXNEIE, UART_FLAG_RXNE}, // RX register not empty + #endif #if 0 // For now only IRQs selected by CR1 are supported #if defined(STM32F4) @@ -813,14 +830,14 @@ uint32_t uart_get_baudrate(pyb_uart_obj_t *self) { #if defined(LPUART1) if (self->uart_id == PYB_LPUART_1) { return LL_LPUART_GetBaudRate(self->uartx, uart_get_source_freq(self) - #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) || defined(STM32WL) , self->uartx->PRESC #endif ); } #endif return LL_USART_GetBaudRate(self->uartx, uart_get_source_freq(self), - #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) || defined(STM32WL) self->uartx->PRESC, #endif LL_USART_OVERSAMPLING_16); @@ -830,7 +847,7 @@ void uart_set_baudrate(pyb_uart_obj_t *self, uint32_t baudrate) { #if defined(LPUART1) if (self->uart_id == PYB_LPUART_1) { LL_LPUART_SetBaudRate(self->uartx, uart_get_source_freq(self), - #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) || defined(STM32WL) LL_LPUART_PRESCALER_DIV1, #endif baudrate); @@ -838,7 +855,7 @@ void uart_set_baudrate(pyb_uart_obj_t *self, uint32_t baudrate) { } #endif LL_USART_SetBaudRate(self->uartx, uart_get_source_freq(self), - #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) || defined(STM32WL) LL_USART_PRESCALER_DIV1, #endif LL_USART_OVERSAMPLING_16, baudrate); @@ -889,7 +906,7 @@ int uart_rx_char(pyb_uart_obj_t *self) { return data; } else { // no buffering - #if defined(STM32F0) || defined(STM32F7) || defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32F0) || defined(STM32F7) || defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) || defined(STM32WL) int data = self->uartx->RDR & self->char_mask; self->uartx->ICR = USART_ICR_ORECF; // clear ORE if it was set return data; @@ -1039,7 +1056,7 @@ void uart_irq_handler(mp_uint_t uart_id) { uint16_t next_head = (self->read_buf_head + 1) % self->read_buf_len; if (next_head != self->read_buf_tail) { // only read data if room in buf - #if defined(STM32F0) || defined(STM32F7) || defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32F0) || defined(STM32F7) || defined(STM32G4) || defined(STM32L0) || defined(STM32L4) || defined(STM32H7) || defined(STM32WB) || defined(STM32WL) int data = self->uartx->RDR; // clears UART_FLAG_RXNE #else self->mp_irq_flags = self->uartx->SR; // resample to get any new flags since next read of DR will clear SR diff --git a/ports/stm32/uart.h b/ports/stm32/uart.h index 0a268ad465..5fee841f8f 100644 --- a/ports/stm32/uart.h +++ b/ports/stm32/uart.h @@ -102,7 +102,7 @@ void uart_tx_strn(pyb_uart_obj_t *uart_obj, const char *str, uint len); static inline bool uart_tx_avail(pyb_uart_obj_t *self) { #if defined(STM32F4) return self->uartx->SR & USART_SR_TXE; - #elif defined(STM32H7) + #elif defined(STM32H7) || defined(STM32WL) return self->uartx->ISR & USART_ISR_TXE_TXFNF; #else return self->uartx->ISR & USART_ISR_TXE; From e306f2285ba497f4d12e4068149cb245036a99b9 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 22 Feb 2021 11:55:34 +1100 Subject: [PATCH 0085/1712] stm32/boards/NUCLEO_WL55: Add new board definition. Signed-off-by: Damien George --- ports/stm32/boards/NUCLEO_WL55/board.json | 15 +++++ .../stm32/boards/NUCLEO_WL55/mpconfigboard.h | 63 +++++++++++++++++++ .../stm32/boards/NUCLEO_WL55/mpconfigboard.mk | 13 ++++ ports/stm32/boards/NUCLEO_WL55/pins.csv | 46 ++++++++++++++ .../boards/NUCLEO_WL55/stm32wlxx_hal_conf.h | 18 ++++++ 5 files changed, 155 insertions(+) create mode 100644 ports/stm32/boards/NUCLEO_WL55/board.json create mode 100644 ports/stm32/boards/NUCLEO_WL55/mpconfigboard.h create mode 100644 ports/stm32/boards/NUCLEO_WL55/mpconfigboard.mk create mode 100644 ports/stm32/boards/NUCLEO_WL55/pins.csv create mode 100644 ports/stm32/boards/NUCLEO_WL55/stm32wlxx_hal_conf.h diff --git a/ports/stm32/boards/NUCLEO_WL55/board.json b/ports/stm32/boards/NUCLEO_WL55/board.json new file mode 100644 index 0000000000..d756a4cdbb --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WL55/board.json @@ -0,0 +1,15 @@ +{ + "deploy": [ + "../deploy.md" + ], + "docs": "", + "features": [], + "images": [ + "nucleo_wl55.jpg" + ], + "mcu": "stm32wl", + "product": "Nucleo WL55", + "thumbnail": "", + "url": "", + "vendor": "ST Microelectronics" +} diff --git a/ports/stm32/boards/NUCLEO_WL55/mpconfigboard.h b/ports/stm32/boards/NUCLEO_WL55/mpconfigboard.h new file mode 100644 index 0000000000..baf1f023be --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WL55/mpconfigboard.h @@ -0,0 +1,63 @@ +/* This file is part of the MicroPython project, https://micropython.org/ + * MIT License; Copyright (c) 2021 Damien P. George + */ + +#define MICROPY_HW_BOARD_NAME "NUCLEO-WL55" +#define MICROPY_HW_MCU_NAME "STM32WL55JCI7" + +#define MICROPY_EMIT_THUMB (0) +#define MICROPY_EMIT_INLINE_THUMB (0) +#define MICROPY_PY_BUILTINS_COMPLEX (0) +#define MICROPY_PY_GENERATOR_PEND_THROW (0) +#define MICROPY_PY_MATH (0) +#define MICROPY_PY_FRAMEBUF (0) +#define MICROPY_PY_USOCKET (0) +#define MICROPY_PY_NETWORK (0) +#define MICROPY_PY_ONEWIRE (0) +#define MICROPY_PY_STM (0) +#define MICROPY_PY_PYB_LEGACY (0) +#define MICROPY_PY_UHEAPQ (0) +#define MICROPY_PY_UTIMEQ (0) + +#define MICROPY_HW_HAS_FLASH (1) +#define MICROPY_HW_ENABLE_RTC (1) +#define MICROPY_HW_ENABLE_RNG (1) +#define MICROPY_HW_ENABLE_ADC (0) // use machine.ADC instead +#define MICROPY_HW_HAS_SWITCH (1) + +// There is an external 32kHz oscillator +#define MICROPY_HW_RTC_USE_LSE (1) +#define MICROPY_HW_RTC_USE_US (1) + +// UART buses +#define MICROPY_HW_UART1_TX (pin_B6) // Arduino D1, pin 7 on CN9 +#define MICROPY_HW_UART1_RX (pin_B7) // Arduino D0, pin 8 on CN9 +#define MICROPY_HW_LPUART1_TX (pin_A2) // ST-link +#define MICROPY_HW_LPUART1_RX (pin_A3) // ST-link +#define MICROPY_HW_UART_REPL PYB_LPUART_1 +#define MICROPY_HW_UART_REPL_BAUD 115200 + +// I2C buses +#define MICROPY_HW_I2C1_SCL (pin_A12) // Arduino D15, pin 10 on CN5 +#define MICROPY_HW_I2C1_SDA (pin_A11) // Arduino D14, pin 9 on CN5 +#define MICROPY_HW_I2C3_SCL (pin_B13) // Arduino A5, pin 6 on CN8 +#define MICROPY_HW_I2C3_SDA (pin_B14) // Arduino A4, pin 5 on CN8 + +// SPI buses +#define MICROPY_HW_SPI1_NSS (pin_A4) // Arduino D10 pin 3 on CN5 +#define MICROPY_HW_SPI1_SCK (pin_A5) // Arduino D13, pin 6 on CN5 +#define MICROPY_HW_SPI1_MISO (pin_A6) // Arduino D12, pin 5 on CN5 +#define MICROPY_HW_SPI1_MOSI (pin_A7) // Arduino D11, pin 4 on CN5 + +// User switch; pressing the button makes the input go low +#define MICROPY_HW_USRSW_PIN (pin_A0) +#define MICROPY_HW_USRSW_PULL (GPIO_PULLUP) +#define MICROPY_HW_USRSW_EXTI_MODE (GPIO_MODE_IT_FALLING) +#define MICROPY_HW_USRSW_PRESSED (0) + +// LEDs +#define MICROPY_HW_LED1 (pin_B15) // blue +#define MICROPY_HW_LED2 (pin_B9) // green +#define MICROPY_HW_LED3 (pin_B11) // red +#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_high(pin)) +#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin)) diff --git a/ports/stm32/boards/NUCLEO_WL55/mpconfigboard.mk b/ports/stm32/boards/NUCLEO_WL55/mpconfigboard.mk new file mode 100644 index 0000000000..210f3058c1 --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WL55/mpconfigboard.mk @@ -0,0 +1,13 @@ +MCU_SERIES = wl +CMSIS_MCU = STM32WL55xx +AF_FILE = boards/stm32wl55_af.csv +STARTUP_FILE = $(STM32LIB_CMSIS_BASE)/Source/Templates/gcc/startup_stm32wl55xx_cm4.o +LD_FILES = boards/stm32wl55xc.ld boards/common_basic.ld +TEXT0_ADDR = 0x08000000 + +# MicroPython settings +MICROPY_VFS_FAT = 0 +MICROPY_VFS_LFS2 = 1 + +# Don't include default frozen modules because MCU is tight on flash space +FROZEN_MANIFEST ?= diff --git a/ports/stm32/boards/NUCLEO_WL55/pins.csv b/ports/stm32/boards/NUCLEO_WL55/pins.csv new file mode 100644 index 0000000000..afcf34df11 --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WL55/pins.csv @@ -0,0 +1,46 @@ +,PA0 +,PA1 +,PA2 +,PA3 +,PA4 +,PA5 +,PA6 +,PA7 +,PA8 +,PA9 +,PA10 +,PA11 +,PA12 +,PA13 +,PA14 +,PA15 +,PB0 +,PB1 +,PB2 +,PB3 +,PB4 +,PB5 +,PB6 +,PB7 +,PB8 +,PB9 +,PB10 +,PB11 +,PB12 +,PB13 +,PB14 +,PB15 +,PC0 +,PC1 +,PC2 +,PC3 +,PC4 +,PC5 +,PC6 +SW,PA0 +SW1,PA0 +SW2,PA1 +SW3,PC6 +LED_GREEN,PB9 +LED_RED,PB11 +LED_BLUE,PB15 diff --git a/ports/stm32/boards/NUCLEO_WL55/stm32wlxx_hal_conf.h b/ports/stm32/boards/NUCLEO_WL55/stm32wlxx_hal_conf.h new file mode 100644 index 0000000000..2c28cc3d2a --- /dev/null +++ b/ports/stm32/boards/NUCLEO_WL55/stm32wlxx_hal_conf.h @@ -0,0 +1,18 @@ +/* This file is part of the MicroPython project, https://micropython.org/ + * The MIT License (MIT) + * Copyright (c) 2021 Damien P. George + */ +#ifndef MICROPY_INCLUDED_STM32WLXX_HAL_CONF_H +#define MICROPY_INCLUDED_STM32WLXX_HAL_CONF_H + +// Oscillator values in Hz +#define HSE_VALUE (32000000) +#define LSE_VALUE (32768) + +// Oscillator timeouts in ms +#define HSE_STARTUP_TIMEOUT (100) +#define LSE_STARTUP_TIMEOUT (5000) + +#include "boards/stm32wlxx_hal_conf_base.h" + +#endif // MICROPY_INCLUDED_STM32WLXX_HAL_CONF_H From ae5f647a2d294cf940367918fbb250f1a9c0c8c0 Mon Sep 17 00:00:00 2001 From: "Peter D. Gray" Date: Thu, 4 Jan 2018 12:10:15 -0500 Subject: [PATCH 0086/1712] stm32/system_stm32: Make SystemClock_Config() a weak symbol. This allows boards to override as needed. --- ports/stm32/system_stm32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/stm32/system_stm32.c b/ports/stm32/system_stm32.c index 582d7a3698..2ee745a49b 100644 --- a/ports/stm32/system_stm32.c +++ b/ports/stm32/system_stm32.c @@ -163,7 +163,7 @@ void __fatal_error(const char *msg); * * Timers run from APBx if APBx_PRESC=1, else 2x APBx */ -void SystemClock_Config(void) { +MP_WEAK void SystemClock_Config(void) { #if defined(STM32F7) // The DFU bootloader changes the clocksource register from its default power // on reset value, so we set it back here, so the clocksources are the same From e5df4a96fa85ad4cf10d82b3cd5f8ca8b279050b Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Mon, 31 Jan 2022 19:12:48 +0200 Subject: [PATCH 0087/1712] stm32/adc: Fix L4 ADC channel numbers. Use HAL macro to map decimal numbers to channel numbers. This is needed since updating L4 HAL v1.17.0 in a0f5b3148a5c276aa1abf7b77b0964eec80cda16. Fixes issue #8233. --- ports/stm32/adc.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ports/stm32/adc.c b/ports/stm32/adc.c index 2e52fb07aa..497bf5339f 100644 --- a/ports/stm32/adc.c +++ b/ports/stm32/adc.c @@ -214,11 +214,7 @@ STATIC bool is_adcx_channel(int channel) { #elif defined(STM32H7) return __HAL_ADC_IS_CHANNEL_INTERNAL(channel) || IS_ADC_CHANNEL(__HAL_ADC_DECIMAL_NB_TO_CHANNEL(channel)); - #elif defined(STM32L4) - ADC_HandleTypeDef handle; - handle.Instance = ADCx; - return IS_ADC_CHANNEL(&handle, channel); - #elif defined(STM32G4) || defined(STM32WB) + #elif defined(STM32G4) || defined(STM32L4) || defined(STM32WB) ADC_HandleTypeDef handle; handle.Instance = ADCx; return __HAL_ADC_IS_CHANNEL_INTERNAL(channel) @@ -338,7 +334,7 @@ STATIC void adc_init_single(pyb_obj_adc_t *adc_obj) { STATIC void adc_config_channel(ADC_HandleTypeDef *adc_handle, uint32_t channel) { ADC_ChannelConfTypeDef sConfig; - #if defined(STM32G4) || defined(STM32H7) || defined(STM32WB) + #if defined(STM32G4) || defined(STM32H7) || defined(STM32L4) || defined(STM32WB) sConfig.Rank = ADC_REGULAR_RANK_1; if (__HAL_ADC_IS_CHANNEL_INTERNAL(channel) == 0) { channel = __HAL_ADC_DECIMAL_NB_TO_CHANNEL(channel); From 31f2440388be597ba39679e165676e4ef1b0a98c Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Tue, 1 Feb 2022 15:34:57 +0200 Subject: [PATCH 0088/1712] stm32/adc: Remove obsolete FIRST/LAST GPIO channel macros. --- ports/stm32/adc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ports/stm32/adc.c b/ports/stm32/adc.c index 497bf5339f..1d4beafa45 100644 --- a/ports/stm32/adc.c +++ b/ports/stm32/adc.c @@ -104,8 +104,6 @@ #elif defined(STM32G4) -#define ADC_FIRST_GPIO_CHANNEL (0) -#define ADC_LAST_GPIO_CHANNEL (18) #define ADC_SCALE_V (((float)VREFINT_CAL_VREF) / 1000.0f) #define ADC_CAL_ADDRESS VREFINT_CAL_ADDR #define ADC_CAL1 TEMPSENSOR_CAL1_ADDR From 5679fe6aee7811447ab9dfc9b4539526b23b1d84 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Feb 2022 00:12:08 +1100 Subject: [PATCH 0089/1712] rp2/modutime: Fix time.localtime day-of-week value. The correct day-of-week is stored in the RTC (0=Monday, 6=Sunday) so there is no need to adjust it for the return value of time.localtime(). Fixes issue #7889. Signed-off-by: Damien George --- ports/rp2/modutime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/rp2/modutime.c b/ports/rp2/modutime.c index 8041ae65b6..a586073101 100644 --- a/ports/rp2/modutime.c +++ b/ports/rp2/modutime.c @@ -45,7 +45,7 @@ STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) { mp_obj_new_int(t.hour), mp_obj_new_int(t.min), mp_obj_new_int(t.sec), - mp_obj_new_int((t.dotw + 6) % 7), // convert 0=Sunday to 6=Sunday + mp_obj_new_int(t.dotw), mp_obj_new_int(timeutils_year_day(t.year, t.month, t.day)), }; return mp_obj_new_tuple(8, tuple); From 5943a2ec79e51df91e0bb5d57ead68c57569f5cd Mon Sep 17 00:00:00 2001 From: Cem Eliguzel Date: Thu, 6 Jan 2022 13:53:43 +0300 Subject: [PATCH 0090/1712] docs/develop/porting.rst: Fix build and import problems in the example. --- docs/develop/porting.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/develop/porting.rst b/docs/develop/porting.rst index ae0cfd8b06..d08fd74e43 100644 --- a/docs/develop/porting.rst +++ b/docs/develop/porting.rst @@ -146,6 +146,9 @@ The following is an example of an ``mpconfigport.h`` file: #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_TERSE) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) + // Enable u-modules to be imported with their standard name, like sys. + #define MICROPY_MODULE_WEAK_LINKS (1) + // Fine control over Python builtins, classes, modules, etc. #define MICROPY_PY_ASYNC_AWAIT (0) #define MICROPY_PY_BUILTINS_SET (0) @@ -296,7 +299,7 @@ like this: mphalport.c \ ... - SRC_QSTR += modport.c + SRC_QSTR += modmyport.c If all went correctly then, after rebuilding, you should be able to import the new module: From ddda959e57d704873c91be05dec95846b7949c17 Mon Sep 17 00:00:00 2001 From: Luiz Brandao Date: Mon, 24 Jan 2022 10:16:35 -0500 Subject: [PATCH 0091/1712] docs/reference/isr_rules.rst: Fix inconsistent variable name in example. Fixed to be conistent with the code example above it. --- docs/reference/isr_rules.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/isr_rules.rst b/docs/reference/isr_rules.rst index 7f466ab42f..a611f492a4 100644 --- a/docs/reference/isr_rules.rst +++ b/docs/reference/isr_rules.rst @@ -339,8 +339,8 @@ A critical section can comprise a single line of code and a single variable. Con This example illustrates a subtle source of bugs. The line ``count += 1`` in the main loop carries a specific race condition hazard known as a read-modify-write. This is a classic cause of bugs in real time systems. In the main loop -MicroPython reads the value of ``t.counter``, adds 1 to it, and writes it back. On rare occasions the interrupt occurs -after the read and before the write. The interrupt modifies ``t.counter`` but its change is overwritten by the main +MicroPython reads the value of ``count``, adds 1 to it, and writes it back. On rare occasions the interrupt occurs +after the read and before the write. The interrupt modifies ``count`` but its change is overwritten by the main loop when the ISR returns. In a real system this could lead to rare, unpredictable failures. As mentioned above, care should be taken if an instance of a Python built in type is modified in the main code and From a43764e6549957e1972ec375c330dd2a5c002d89 Mon Sep 17 00:00:00 2001 From: Jonathan Hogg Date: Thu, 3 Feb 2022 17:37:46 +0000 Subject: [PATCH 0092/1712] docs/esp32/quickref: Update ADC documentation. Update ADC documentation now that the new API is described in the main docs. --- docs/esp32/quickref.rst | 98 ++++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 45 deletions(-) diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst index de107ee25c..da586819fd 100644 --- a/docs/esp32/quickref.rst +++ b/docs/esp32/quickref.rst @@ -264,82 +264,90 @@ See more examples in the :ref:`esp32_pwm` tutorial. ADC (analog to digital conversion) ---------------------------------- -On the ESP32 ADC functionality is available on pins 32-39 (ADC block 1) and pins -0, 2, 4, 12-15 and 25-27 (ADC block 2). +On the ESP32, ADC functionality is available on pins 32-39 (ADC block 1) and +pins 0, 2, 4, 12-15 and 25-27 (ADC block 2). Use the :ref:`machine.ADC ` class:: from machine import ADC - adc = ADC(Pin(32)) # create ADC object for pin 32 - adc.read_u16() # read raw value, 0-65535 + adc = ADC(pin) # create an ADC object acting on a pin + val = adc.read_u16() # read a raw analog value in the range 0-65535 + val = adc.read_uv() # read an analog value in microvolts -Note that the ESP32 uses an internal ADC reference voltage of 1.0v. To read -voltages above this value, input attenuation can be applied with the optional -``atten`` keyword argument to the constructor. Valid values are: +ADC block 2 is also used by WiFi and so attempting to read analog values from +block 2 pins when WiFi is active will raise an exception. - - ``ADC.ATTN_0DB``: No attenuation, this is the default - - ``ADC.ATTN_2_5DB``: 2.5dB attenuation, gives a maximum input voltage of - approximately 1.33v - - ``ADC.ATTN_6DB``: 6dB attenuation, gives a maximum input voltage of - approximately 2.00v - - ``ADC.ATTN_11DB``: 11dB attenuation, gives a maximum input voltage of - approximately 3.55v - -E.g.:: - - adc = ADC(Pin(25), atten=ADC.ATTEN_11DB) # 0.0v - 3.55v range - -.. Warning:: - Note that, although 11dB attenuation allows for a voltage range up to 3.55v, - the absolute maximum voltage rating for input pins is 3.6v, and so going - near this boundary risks damage to the IC! +The internal ADC reference voltage is typically 1.1V, but varies slightly from +package to package. The ADC is less linear close to the reference voltage +(particularly at higher attenuations) and has a minimum measurement voltage +around 100mV, voltages at or below this will read as 0. To read voltages +accurately, it is recommended to use the ``read_uv()`` method (see below). ESP32-specific ADC class method reference: -.. method:: ADC.init(*, atten) +.. class:: ADC(pin, *, atten) - Re-initialize the ADC pin with a different input attenuation. + Return the ADC object for the specified pin. ESP32 does not support + different timings for ADC sampling and so the ``sample_ns`` keyword argument + is not supported. + + To read voltages above the reference voltage, apply input attenuation with + the ``atten`` keyword argument. Valid values (and approximate linear + measurement ranges) are: + + - ``ADC.ATTN_0DB``: No attenuation (100mV - 950mV) + - ``ADC.ATTN_2_5DB``: 2.5dB attenuation (100mV - 1250mV) + - ``ADC.ATTN_6DB``: 6dB attenuation (150mV - 1750mV) + - ``ADC.ATTN_11DB``: 11dB attenuation (150mV - 2450mV) + +.. Warning:: + Note that the absolute maximum voltage rating for input pins is 3.6V. Going + near to this boundary risks damage to the IC! .. method:: ADC.read_uv() - This method uses internal per-package calibration values - set during - manufacture - to return the ADC input voltage in microvolts, taking into - account any input attenuation applied. Note that the calibration curves do - not guarantee that an input tied to ground will read as 0, and the returned - values have only millivolt resolution. + This method uses the known characteristics of the ADC and per-package eFuse + values - set during manufacture - to return a calibrated input voltage + (before attenuation) in microvolts. The returned value has only millivolt + resolution (i.e., will always be a multiple of 1000 microvolts). -.. method:: ADC.block() + The calibration is only valid across the linear range of the ADC. In + particular, an input tied to ground will read as a value above 0 microvolts. + Within the linear range, however, more accurate and consistent results will + be obtained than using `read_u16()` and scaling the result with a constant. - Return the matching ``ADCBlock`` object. +The ESP32 port also supports the :ref:`machine.ADC ` API: .. class:: ADCBlock(id, *, bits) Return the ADC block object with the given ``id`` (1 or 2) and initialize - it to the specified resolution (9 to 12-bits) or the default 12-bits. + it to the specified resolution (9 to 12-bits depending on the ESP32 series) + or the highest supported resolution if not specified. -.. method:: ADCBlock.init(*, bits) +.. method:: ADCBlock.connect(pin) + ADCBlock.connect(channel) + ADCBlock.connect(channel, pin) - Re-initialize the ADC block with a specific resolution. + Return the ``ADC`` object for the specified ADC pin or channel number. + Arbitrary connection of ADC channels to GPIO is not supported and so + specifying a pin that is not connected to this block, or specifying a + mismatched channel and pin, will raise an exception. -.. method:: ADCBlock.connect(channel_or_pin) - - Return the ``ADC`` object for the specified ADC channel number or Pin object. - -Legacy API methods: +Legacy methods: .. method:: ADC.read() This method returns the raw ADC value ranged according to the resolution of - the ADC block, 0-4095 for the default 12-bit resolution. + the block, e.g., 0-4095 for 12-bit resolution. -.. method:: ADC.atten(attenuation) +.. method:: ADC.atten(atten) - Equivalent to ``ADC.init(atten=attenuation)``. + Equivalent to ``ADC.init(atten=atten)``. -.. method:: ADC.width(width) +.. method:: ADC.width(bits) - Equivalent to ``ADC.block().init(bits=width)``. + Equivalent to ``ADC.block().init(bits=bits)``. For compatibility, the ``ADC`` object also provides constants matching the supported ADC resolutions: From 80b81acea5af425b15a92d09c3cc723dd24ebfb6 Mon Sep 17 00:00:00 2001 From: Peter Hinch Date: Sun, 30 Jan 2022 16:37:42 +0000 Subject: [PATCH 0093/1712] docs/reference/isr_rules.rst: Describe uasyncio-IRQ interface. --- docs/reference/isr_rules.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/reference/isr_rules.rst b/docs/reference/isr_rules.rst index a611f492a4..bdb838c590 100644 --- a/docs/reference/isr_rules.rst +++ b/docs/reference/isr_rules.rst @@ -219,6 +219,33 @@ Exceptions If an ISR raises an exception it will not propagate to the main loop. The interrupt will be disabled unless the exception is handled by the ISR code. +Interfacing to uasyncio +----------------------- + +When an ISR runs it can preempt the `uasyncio` scheduler. If the ISR performs a `uasyncio` +operation the scheduler's operation can be disrupted. This applies whether the interrupt is hard +or soft and also applies if the ISR has passed execution to another function via +`micropython.schedule`. In particular creating or cancelling tasks is invalid in an ISR context. +The safe way to interact with `uasyncio` is to implement a coroutine with synchronisation performed by +`uasyncio.ThreadSafeFlag`. The following fragment illustrates the creation of a task in response +to an interrupt: + +.. code:: python + + tsf = uasyncio.ThreadSafeFlag() + + def isr(_): # Interrupt handler + tsf.set() + + async def foo(): + while True: + await tsf.wait() + uasyncio.create_task(bar()) + +In this example there will be a variable amount of latency between the execution of the ISR and the execution +of ``foo()``. This is inherent to cooperative scheduling. The maximum latency is application +and platform dependent but may typically be measured in tens of ms. + General issues -------------- From a7530cbc03ba3ca4a70f7d3bd6b2e27656c25173 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 4 Feb 2022 14:28:21 +1100 Subject: [PATCH 0094/1712] stm32/boards/NUCLEO_L432KC: Disable MICROPY_OPT_COMPUTED_GOTO. To save space, after recent fixes to L4 ADC made it overflow flash. Signed-off-by: Damien George --- ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.h b/ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.h index ce9de3c4dd..5e05053cdd 100644 --- a/ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.h +++ b/ports/stm32/boards/NUCLEO_L432KC/mpconfigboard.h @@ -3,6 +3,7 @@ #define MICROPY_EMIT_THUMB (0) #define MICROPY_EMIT_INLINE_THUMB (0) +#define MICROPY_OPT_COMPUTED_GOTO (0) #define MICROPY_PY_BUILTINS_COMPLEX (0) #define MICROPY_PY_GENERATOR_PEND_THROW (0) #define MICROPY_PY_USOCKET (0) From 1f84440538a017e463aaad9686831ce9527122b5 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Tue, 1 Feb 2022 10:52:55 +1100 Subject: [PATCH 0095/1712] tools/mpremote: Fix "fs cp -r" on Windows. A backslash in the directory name will end up being passed through to the device and becoming a backslash in a filename, rather than being interpreted as directories. This makes "cp -r" problematic on Windows. Changing to simply "/",join() fixes this. --- tools/mpremote/mpremote/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/mpremote/mpremote/main.py b/tools/mpremote/mpremote/main.py index 13615f6dd2..5c63625589 100644 --- a/tools/mpremote/mpremote/main.py +++ b/tools/mpremote/mpremote/main.py @@ -268,7 +268,7 @@ def do_filesystem(pyb, args): def _list_recursive(files, path): if os.path.isdir(path): for entry in os.listdir(path): - _list_recursive(files, os.path.join(path, entry)) + _list_recursive(files, "/".join((path, entry))) else: files.append(os.path.split(path)) @@ -289,7 +289,7 @@ def do_filesystem(pyb, args): if d not in known_dirs: pyb.exec_("try:\n uos.mkdir('%s')\nexcept OSError as e:\n print(e)" % d) known_dirs.add(d) - pyboard.filesystem_command(pyb, ["cp", os.path.join(dir, file), ":" + dir + "/"]) + pyboard.filesystem_command(pyb, ["cp", "/".join((dir, file)), ":" + dir + "/"]) else: pyboard.filesystem_command(pyb, args) args.clear() From d865ca53b53aca5c66028970f7321e0766a0dd58 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Fri, 28 Jan 2022 14:43:17 +1100 Subject: [PATCH 0096/1712] tools/mpremote: Make ConsolePosix work without .raw attribute. When running mpremote in the vscode terminal on OSX the sys.stdout.buffer does not have the raw attribute. It works fine without it. --- tools/mpremote/mpremote/console.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/mpremote/mpremote/console.py b/tools/mpremote/mpremote/console.py index 2652c7393b..a0ee55dce9 100644 --- a/tools/mpremote/mpremote/console.py +++ b/tools/mpremote/mpremote/console.py @@ -11,8 +11,13 @@ except ImportError: class ConsolePosix: def __init__(self): self.infd = sys.stdin.fileno() - self.infile = sys.stdin.buffer.raw - self.outfile = sys.stdout.buffer.raw + self.infile = sys.stdin.buffer + self.outfile = sys.stdout.buffer + if hasattr(self.infile, "raw"): + self.infile = self.infile.raw + if hasattr(self.outfile, "raw"): + self.outfile = self.outfile.raw + self.orig_attr = termios.tcgetattr(self.infd) def enter(self): From 5a86d8dc424b5923d5d1a7c1352378ef328847d6 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Tue, 1 Feb 2022 12:07:40 +1100 Subject: [PATCH 0097/1712] tools/mpremote: During soft reboot wait long enough for 115200 data. --- tools/mpremote/mpremote/pyboardextended.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mpremote/mpremote/pyboardextended.py b/tools/mpremote/mpremote/pyboardextended.py index 41f360e5fd..1b6463e853 100644 --- a/tools/mpremote/mpremote/pyboardextended.py +++ b/tools/mpremote/mpremote/pyboardextended.py @@ -641,7 +641,7 @@ class PyboardExtended(Pyboard): while n > 0: buf = self.serial.read(n) out_callback(buf) - time.sleep(0.1) + time.sleep(0.2) n = self.serial.inWaiting() self.serial.write(b"\x01") self.exec_(fs_hook_code) From b1519845f5dfd46b82fd5b3d980812d30ce0140b Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Wed, 2 Feb 2022 21:20:05 +1100 Subject: [PATCH 0098/1712] tools/mpremote: Accept both --help and help to show usage. --- tools/mpremote/mpremote/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/mpremote/mpremote/main.py b/tools/mpremote/mpremote/main.py index 5c63625589..492d2d26d4 100644 --- a/tools/mpremote/mpremote/main.py +++ b/tools/mpremote/mpremote/main.py @@ -96,6 +96,7 @@ _BUILTIN_COMMAND_EXPANSIONS = { "exec", "import machine; machine.RTC().datetime((2020, 1, 1, 0, 10, 0, 0, 0))", ], + "--help": "help", } for port_num in range(4): From 203ec8ca7fa5f59e20bca95c74a77e3b1e8ef394 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Tue, 1 Feb 2022 11:59:59 +1100 Subject: [PATCH 0099/1712] tools/mpremote: Correctly manage mounted flag during soft-reset. --- tools/mpremote/mpremote/pyboardextended.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/mpremote/mpremote/pyboardextended.py b/tools/mpremote/mpremote/pyboardextended.py index 1b6463e853..2ec1fbbee9 100644 --- a/tools/mpremote/mpremote/pyboardextended.py +++ b/tools/mpremote/mpremote/pyboardextended.py @@ -614,10 +614,10 @@ class PyboardExtended(Pyboard): def mount_local(self, path): fout = self.serial - self.mounted = True if self.eval('"RemoteFS" in globals()') == b"False": self.exec_(fs_hook_code) self.exec_("__mount()") + self.mounted = True self.cmd = PyboardCommand(self.serial, fout, path) self.serial = SerialIntercept(self.serial, self.cmd) @@ -626,6 +626,9 @@ class PyboardExtended(Pyboard): if not self.mounted: return + # Clear flag while board reboots, it will be re-set once mounted. + self.mounted = False + # Wait for a response to the soft-reset command. for i in range(10): if self.serial.inWaiting(): @@ -646,6 +649,7 @@ class PyboardExtended(Pyboard): self.serial.write(b"\x01") self.exec_(fs_hook_code) self.exec_("__mount()") + self.mounted = True self.exit_raw_repl() self.read_until(4, b">>> ") self.serial = SerialIntercept(self.serial, self.cmd) From fecfd5269632e86f86c6b31a9bc2ec22876f8934 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 5 Feb 2022 23:29:44 +1100 Subject: [PATCH 0100/1712] tools/mpremote: Fix special handling of ctrl-D when host FS is mounted. Changes are: - decision to remount local filesystem on remote device is made only if "MPY: soft reboot" is seen in the output after sending a ctrl-D - a nice message is printed to the user when the remount occurs - soft reset during raw REPL is now handled correctly Fixes issue #7731. Signed-off-by: Damien George --- tools/mpremote/mpremote/main.py | 4 +- tools/mpremote/mpremote/pyboardextended.py | 65 ++++++++++++++++------ 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/tools/mpremote/mpremote/main.py b/tools/mpremote/mpremote/main.py index 492d2d26d4..1073bec7fa 100644 --- a/tools/mpremote/mpremote/main.py +++ b/tools/mpremote/mpremote/main.py @@ -304,8 +304,8 @@ def do_repl_main_loop(pyb, console_in, console_out_write, *, code_to_inject, fil if c == b"\x1d": # ctrl-], quit break elif c == b"\x04": # ctrl-D - # do a soft reset and reload the filesystem hook - pyb.soft_reset_with_mount(console_out_write) + # special handling needed for ctrl-D if filesystem is mounted + pyb.write_ctrl_d(console_out_write) elif c == b"\x0a" and code_to_inject is not None: # ctrl-j, inject code pyb.serial.write(code_to_inject) elif c == b"\x0b" and file_to_inject is not None: # ctrl-k, inject script diff --git a/tools/mpremote/mpremote/pyboardextended.py b/tools/mpremote/mpremote/pyboardextended.py index 2ec1fbbee9..6817e7bbf4 100644 --- a/tools/mpremote/mpremote/pyboardextended.py +++ b/tools/mpremote/mpremote/pyboardextended.py @@ -621,37 +621,66 @@ class PyboardExtended(Pyboard): self.cmd = PyboardCommand(self.serial, fout, path) self.serial = SerialIntercept(self.serial, self.cmd) - def soft_reset_with_mount(self, out_callback): + def write_ctrl_d(self, out_callback): self.serial.write(b"\x04") if not self.mounted: return - # Clear flag while board reboots, it will be re-set once mounted. - self.mounted = False + # Read response from the device until it is quiet (with a timeout). + INITIAL_TIMEOUT = 0.5 + QUIET_TIMEOUT = 0.2 + FULL_TIMEOUT = 5 + t_start = t_last_activity = time.monotonic() + data_all = b"" + while True: + t = time.monotonic() + n = self.serial.inWaiting() + if n > 0: + data = self.serial.read(n) + out_callback(data) + data_all += data + t_last_activity = t + else: + if len(data_all) == 0: + if t - t_start > INITIAL_TIMEOUT: + return + else: + if t - t_start > FULL_TIMEOUT: + return + if t - t_last_activity > QUIET_TIMEOUT: + break - # Wait for a response to the soft-reset command. - for i in range(10): - if self.serial.inWaiting(): - break - time.sleep(0.05) + # Check if a soft reset occurred. + if data_all.find(b"MPY: soft reboot") == -1: + return + if data_all.endswith(b">>> "): + in_friendly_repl = True + elif data_all.endswith(b">"): + in_friendly_repl = False else: - # Device didn't respond so it wasn't in a state to do a soft reset. return - out_callback(self.serial.read(1)) + # Clear state while board remounts, it will be re-set once mounted. + self.mounted = False self.serial = self.serial.orig_serial - n = self.serial.inWaiting() - while n > 0: - buf = self.serial.read(n) - out_callback(buf) - time.sleep(0.2) - n = self.serial.inWaiting() + + # Provide a message about the remount. + out_callback(bytes(f"\r\nRemount local directory {self.cmd.root} at /remote\r\n", "utf8")) + + # Enter raw REPL and re-mount the remote filesystem. self.serial.write(b"\x01") self.exec_(fs_hook_code) self.exec_("__mount()") self.mounted = True - self.exit_raw_repl() - self.read_until(4, b">>> ") + + # Exit raw REPL if needed, and wait for the friendly REPL prompt. + if in_friendly_repl: + self.exit_raw_repl() + prompt = b">>> " + else: + prompt = b">" + self.read_until(len(prompt), prompt) + out_callback(prompt) self.serial = SerialIntercept(self.serial, self.cmd) def umount_local(self): From 69c9a76786a584c716e26e6874cc778468d5d8c2 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Thu, 25 Nov 2021 11:44:21 +1100 Subject: [PATCH 0101/1712] windows/mingw: Include extmod/shared/lib sources properly. --- ports/windows/Makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ports/windows/Makefile b/ports/windows/Makefile index 4aceeb981c..5a22be4642 100644 --- a/ports/windows/Makefile +++ b/ports/windows/Makefile @@ -61,7 +61,18 @@ SRC_C = \ $(SRC_MOD) \ $(wildcard $(VARIANT_DIR)/*.c) +SHARED_SRC_C += $(addprefix shared/,\ + $(SHARED_SRC_C_EXTRA) \ + ) + +SRC_CXX += \ + $(SRC_MOD_CXX) + OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(SRC_CXX:.cpp=.o)) +OBJ += $(addprefix $(BUILD)/, $(SHARED_SRC_C:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(EXTMOD_SRC_C:.c=.o)) +OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o)) ifeq ($(MICROPY_USE_READLINE),1) CFLAGS_MOD += -DMICROPY_USE_READLINE=1 @@ -71,7 +82,7 @@ endif LIB += -lws2_32 # List of sources for qstr extraction -SRC_QSTR += $(SRC_C) +SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SHARED_SRC_C) $(EXTMOD_SRC_C) # Append any auto-generated sources that are needed by sources listed in # SRC_QSTR SRC_QSTR_AUTO_DEPS += From c708262c12cdf9b465e7007cc33cca7044310fcb Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Thu, 25 Nov 2021 12:09:40 +1100 Subject: [PATCH 0102/1712] windows/uselect: Enable micropython select in dev variant. --- ports/windows/msvc/sources.props | 1 + ports/windows/variants/dev/mpconfigvariant.h | 1 + 2 files changed, 2 insertions(+) diff --git a/ports/windows/msvc/sources.props b/ports/windows/msvc/sources.props index 5bf0fc453d..228a96d81e 100644 --- a/ports/windows/msvc/sources.props +++ b/ports/windows/msvc/sources.props @@ -14,6 +14,7 @@ + diff --git a/ports/windows/variants/dev/mpconfigvariant.h b/ports/windows/variants/dev/mpconfigvariant.h index 1f205066f0..09ee689daf 100644 --- a/ports/windows/variants/dev/mpconfigvariant.h +++ b/ports/windows/variants/dev/mpconfigvariant.h @@ -36,3 +36,4 @@ #define MICROPY_COMP_CONST (0) #define MICROPY_PY_URANDOM_EXTRA_FUNCS (1) #define MICROPY_PY_BUILTINS_SLICE_INDICES (1) +#define MICROPY_PY_USELECT (1) From 6f7d6c567f8862e0893da7fd08bd828cc6d054cf Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Mon, 7 Feb 2022 14:38:53 +1100 Subject: [PATCH 0103/1712] windows/uasyncio: Add support for uasyncio to windows dev variant. --- ports/windows/msvc/sources.props | 1 + ports/windows/variants/dev/manifest.py | 1 + ports/windows/variants/dev/mpconfigvariant.h | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/ports/windows/msvc/sources.props b/ports/windows/msvc/sources.props index 228a96d81e..e5109eecc8 100644 --- a/ports/windows/msvc/sources.props +++ b/ports/windows/msvc/sources.props @@ -7,6 +7,7 @@ + diff --git a/ports/windows/variants/dev/manifest.py b/ports/windows/variants/dev/manifest.py index 08295fc678..88a6937b4f 100644 --- a/ports/windows/variants/dev/manifest.py +++ b/ports/windows/variants/dev/manifest.py @@ -1 +1,2 @@ include("$(PORT_DIR)/variants/manifest.py") +include("$(MPY_DIR)/extmod/uasyncio/manifest.py") diff --git a/ports/windows/variants/dev/mpconfigvariant.h b/ports/windows/variants/dev/mpconfigvariant.h index 09ee689daf..abf43a0da9 100644 --- a/ports/windows/variants/dev/mpconfigvariant.h +++ b/ports/windows/variants/dev/mpconfigvariant.h @@ -37,3 +37,7 @@ #define MICROPY_PY_URANDOM_EXTRA_FUNCS (1) #define MICROPY_PY_BUILTINS_SLICE_INDICES (1) #define MICROPY_PY_USELECT (1) + +#ifndef MICROPY_PY_UASYNCIO +#define MICROPY_PY_UASYNCIO (1) +#endif From 6fe3856c4f5baeb5ef7b46dbdfd99bf34f967169 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 8 Feb 2022 12:24:15 +1100 Subject: [PATCH 0104/1712] esp32/partitions-16MiB.csv: Increase 14MiB filesystem to maximum size. The original value was 14000000, it's now changed to 14 * 1024 * 1024. Fixes issue #8266. Signed-off-by: Damien George --- ports/esp32/partitions-16MiB.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32/partitions-16MiB.csv b/ports/esp32/partitions-16MiB.csv index ee3e8c7269..ae926c7b94 100644 --- a/ports/esp32/partitions-16MiB.csv +++ b/ports/esp32/partitions-16MiB.csv @@ -4,4 +4,4 @@ nvs, data, nvs, 0x9000, 0x6000, phy_init, data, phy, 0xf000, 0x1000, factory, app, factory, 0x10000, 0x1F0000, -vfs, data, fat, 0x200000, 0xD59F80, +vfs, data, fat, 0x200000, 0xE00000, From ada836b8344cac24b08cbec969b4b4cdb08eec8a Mon Sep 17 00:00:00 2001 From: Seon Rozenblum Date: Tue, 8 Feb 2022 11:14:28 +1100 Subject: [PATCH 0105/1712] esp32/machine_adcblock: Fix ADC bit width for ESP32-S3. --- ports/esp32/machine_adcblock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/esp32/machine_adcblock.c b/ports/esp32/machine_adcblock.c index 77e4fcecc7..06c215f8ae 100644 --- a/ports/esp32/machine_adcblock.c +++ b/ports/esp32/machine_adcblock.c @@ -40,10 +40,10 @@ #define DEFAULT_VREF 1100 madcblock_obj_t madcblock_obj[] = { - #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C3 + #if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 {{&machine_adcblock_type}, ADC_UNIT_1, 12, -1, {0}}, {{&machine_adcblock_type}, ADC_UNIT_2, 12, -1, {0}}, - #elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 + #elif CONFIG_IDF_TARGET_ESP32S2 {{&machine_adcblock_type}, ADC_UNIT_1, 13, -1, {0}}, {{&machine_adcblock_type}, ADC_UNIT_2, 13, -1, {0}}, #endif From 468d1979baf022b9598137243007cc550ff0b306 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 8 Feb 2022 15:03:42 +1100 Subject: [PATCH 0106/1712] esp32/machine_adc: Fix configuration of default ADC atten value. Prior to this fix, if the ADC atten value was not explicitly given then adc1_config_channel_atten() would never be called. Fixes issue #8275. Signed-off-by: Damien George --- ports/esp32/machine_adc.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ports/esp32/machine_adc.c b/ports/esp32/machine_adc.c index 515d629a7e..cb45aab339 100644 --- a/ports/esp32/machine_adc.c +++ b/ports/esp32/machine_adc.c @@ -91,7 +91,19 @@ STATIC const madc_obj_t madc_obj[] = { #endif }; -STATIC adc_atten_t madc_obj_atten[MP_ARRAY_SIZE(madc_obj)]; +// These values are initialised to 0, which means the corresponding ADC channel is not initialised. +// The madc_atten_get/madc_atten_set functions store (atten+1) here so that the uninitialised state +// can be distinguished from the initialised state. +STATIC uint8_t madc_obj_atten[MP_ARRAY_SIZE(madc_obj)]; + +static inline adc_atten_t madc_atten_get(const madc_obj_t *self) { + uint8_t value = madc_obj_atten[self - &madc_obj[0]]; + return value == 0 ? ADC_ATTEN_MAX : value - 1; +} + +static inline void madc_atten_set(const madc_obj_t *self, adc_atten_t atten) { + madc_obj_atten[self - &madc_obj[0]] = atten + 1; +} const madc_obj_t *madc_search_helper(madcblock_obj_t *block, adc_channel_t channel_id, gpio_num_t gpio_id) { for (int i = 0; i < MP_ARRAY_SIZE(madc_obj); i++) { @@ -105,7 +117,7 @@ const madc_obj_t *madc_search_helper(madcblock_obj_t *block, adc_channel_t chann STATIC void madc_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { const madc_obj_t *self = MP_OBJ_TO_PTR(self_in); - mp_printf(print, "ADC(Pin(%u), atten=%u)", self->gpio_id, madc_obj_atten[self - madc_obj]); + mp_printf(print, "ADC(Pin(%u), atten=%u)", self->gpio_id, madc_atten_get(self)); } STATIC void madc_atten_helper(const madc_obj_t *self, mp_int_t atten) { @@ -118,7 +130,7 @@ STATIC void madc_atten_helper(const madc_obj_t *self, mp_int_t atten) { if (err != ESP_OK) { mp_raise_ValueError(MP_ERROR_TEXT("invalid atten")); } - madc_obj_atten[self - madc_obj] = atten; + madc_atten_set(self, atten); } void madc_init_helper(const madc_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -136,7 +148,7 @@ void madc_init_helper(const madc_obj_t *self, size_t n_pos_args, const mp_obj_t mp_int_t atten = args[ARG_atten].u_int; if (atten != -1) { madc_atten_helper(self, atten); - } else if (madc_obj_atten[self - madc_obj] == -1) { + } else if (madc_atten_get(self) == ADC_ATTEN_MAX) { madc_atten_helper(self, ADC_ATTEN_DB_0); } } @@ -192,7 +204,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(madc_read_u16_obj, madc_read_u16); STATIC mp_obj_t madc_read_uv(mp_obj_t self_in) { const madc_obj_t *self = MP_OBJ_TO_PTR(self_in); - adc_atten_t atten = madc_obj_atten[self - madc_obj]; + adc_atten_t atten = madc_atten_get(self); return MP_OBJ_NEW_SMALL_INT(madcblock_read_uv_helper(self->block, self->channel_id, atten)); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(madc_read_uv_obj, madc_read_uv); From aca40127bf9c9a0fb791d8b82be7637fa57ca343 Mon Sep 17 00:00:00 2001 From: Seon Rozenblum Date: Sun, 30 Jan 2022 12:43:28 +1100 Subject: [PATCH 0107/1712] esp32/boards: Add three UM ESP32-S3 based boards. --- ports/esp32/boards/UM_FEATHERS3/board.json | 27 ++++++ ports/esp32/boards/UM_FEATHERS3/board.md | 2 + ports/esp32/boards/UM_FEATHERS3/deploy.md | 52 +++++++++++ ports/esp32/boards/UM_FEATHERS3/manifest.py | 2 + .../boards/UM_FEATHERS3/modules/feathers3.py | 90 +++++++++++++++++++ .../boards/UM_FEATHERS3/mpconfigboard.cmake | 12 +++ .../esp32/boards/UM_FEATHERS3/mpconfigboard.h | 11 +++ .../esp32/boards/UM_FEATHERS3/sdkconfig.board | 23 +++++ ports/esp32/boards/UM_PROS3/board.json | 27 ++++++ ports/esp32/boards/UM_PROS3/board.md | 2 + ports/esp32/boards/UM_PROS3/deploy.md | 52 +++++++++++ ports/esp32/boards/UM_PROS3/manifest.py | 2 + ports/esp32/boards/UM_PROS3/modules/pros3.py | 66 ++++++++++++++ .../esp32/boards/UM_PROS3/mpconfigboard.cmake | 12 +++ ports/esp32/boards/UM_PROS3/mpconfigboard.h | 11 +++ ports/esp32/boards/UM_PROS3/sdkconfig.board | 23 +++++ ports/esp32/boards/UM_TINYS3/board.json | 26 ++++++ ports/esp32/boards/UM_TINYS3/board.md | 2 + ports/esp32/boards/UM_TINYS3/deploy.md | 52 +++++++++++ ports/esp32/boards/UM_TINYS3/manifest.py | 2 + .../esp32/boards/UM_TINYS3/modules/tinys3.py | 66 ++++++++++++++ .../boards/UM_TINYS3/mpconfigboard.cmake | 12 +++ ports/esp32/boards/UM_TINYS3/mpconfigboard.h | 11 +++ ports/esp32/boards/UM_TINYS3/sdkconfig.board | 23 +++++ 24 files changed, 608 insertions(+) create mode 100644 ports/esp32/boards/UM_FEATHERS3/board.json create mode 100644 ports/esp32/boards/UM_FEATHERS3/board.md create mode 100644 ports/esp32/boards/UM_FEATHERS3/deploy.md create mode 100644 ports/esp32/boards/UM_FEATHERS3/manifest.py create mode 100644 ports/esp32/boards/UM_FEATHERS3/modules/feathers3.py create mode 100644 ports/esp32/boards/UM_FEATHERS3/mpconfigboard.cmake create mode 100644 ports/esp32/boards/UM_FEATHERS3/mpconfigboard.h create mode 100644 ports/esp32/boards/UM_FEATHERS3/sdkconfig.board create mode 100644 ports/esp32/boards/UM_PROS3/board.json create mode 100644 ports/esp32/boards/UM_PROS3/board.md create mode 100644 ports/esp32/boards/UM_PROS3/deploy.md create mode 100644 ports/esp32/boards/UM_PROS3/manifest.py create mode 100644 ports/esp32/boards/UM_PROS3/modules/pros3.py create mode 100644 ports/esp32/boards/UM_PROS3/mpconfigboard.cmake create mode 100644 ports/esp32/boards/UM_PROS3/mpconfigboard.h create mode 100644 ports/esp32/boards/UM_PROS3/sdkconfig.board create mode 100644 ports/esp32/boards/UM_TINYS3/board.json create mode 100644 ports/esp32/boards/UM_TINYS3/board.md create mode 100644 ports/esp32/boards/UM_TINYS3/deploy.md create mode 100644 ports/esp32/boards/UM_TINYS3/manifest.py create mode 100644 ports/esp32/boards/UM_TINYS3/modules/tinys3.py create mode 100644 ports/esp32/boards/UM_TINYS3/mpconfigboard.cmake create mode 100644 ports/esp32/boards/UM_TINYS3/mpconfigboard.h create mode 100644 ports/esp32/boards/UM_TINYS3/sdkconfig.board diff --git a/ports/esp32/boards/UM_FEATHERS3/board.json b/ports/esp32/boards/UM_FEATHERS3/board.json new file mode 100644 index 0000000000..68423cca5e --- /dev/null +++ b/ports/esp32/boards/UM_FEATHERS3/board.json @@ -0,0 +1,27 @@ +{ + "deploy": [ + "deploy.md" + ], + "docs": "", + "features": [ + "Battery Charging", + "RGB LED", + "SPIRAM", + "USB-C", + "WiFi", + "BLE", + "STEMMA QT/QWIIC", + "Feather" + ], + "features_non_filterable": [ + ], + "id": "feathers3", + "images": [ + "unexpectedmaker_feathers3.jpg" + ], + "mcu": "esp32s3", + "product": "FeatherS3", + "thumbnail": "", + "url": "https://feathers3.io", + "vendor": "Unexpected Maker" +} diff --git a/ports/esp32/boards/UM_FEATHERS3/board.md b/ports/esp32/boards/UM_FEATHERS3/board.md new file mode 100644 index 0000000000..ca9c36ad33 --- /dev/null +++ b/ports/esp32/boards/UM_FEATHERS3/board.md @@ -0,0 +1,2 @@ +The following files are daily firmware for the FeatherS3. This firmware is +compiled using ESP-IDF v4.4 or later. diff --git a/ports/esp32/boards/UM_FEATHERS3/deploy.md b/ports/esp32/boards/UM_FEATHERS3/deploy.md new file mode 100644 index 0000000000..3a6a21a522 --- /dev/null +++ b/ports/esp32/boards/UM_FEATHERS3/deploy.md @@ -0,0 +1,52 @@ +Program your board using the latest version of the esptool.py program, found [here](https://github.com/espressif/esptool). + +To flash or erase your FeatherS3, you have to first put it into download mode. +To do this, follow these steps: + +- Press and hold the [BOOT] button +- Press and release the [RESET] button +- Release the [BOOT] button + +Now the board is in download mode and the native USB will have enumerated as a serial device. + +If you are putting MicroPython on your board for the first time then you should +first erase the entire flash using: + +### Linux +```bash +esptool.py --chip esp32s3 --port /dev/ttyACM0 erase_flash +``` + +### Mac +Please do a `ls /dev/cu.usbm*` to determine the port your board has enumerated as. +```bash +esptool.py --chip esp32s3 --port /dev/cu.usbmodem01 erase_flash +``` + +### Windows +Change (X) to whatever COM port is being used by the board +```bash +esptool --chip esp32s3 --port COM(X) erase_flash +``` + +Now download the version of the firmware you would like to install from the options below, +then use the following command to program the firmware starting at address 0x0, +remembering to replace `feathers3-micropython-firmware-version.bin` with the name of +the firmware you just downloaded: + +### Linux +```bash +esptool.py --chip esp32s3 --port /dev/ttyACM0 write_flash -z 0x0 feathers3-micropython-firmware-version.bin +``` + +### Mac +Please do a `ls /dev/cu.usbm*` to determine the port your board has enumerated as. +```bash +esptool.py --chip esp32s3 --port /dev/cu.usbmodem01 write_flash -z 0x0 feathers3-micropython-firmware-version.bin +``` + +### Windows +Change (X) to whatever COM port is being used by the board +```bash +esptool --chip esp32s3 --port COM(X) write_flash -z 0x0 feathers3-micropython-firmware-version.bin +``` diff --git a/ports/esp32/boards/UM_FEATHERS3/manifest.py b/ports/esp32/boards/UM_FEATHERS3/manifest.py new file mode 100644 index 0000000000..7ae2ed15d9 --- /dev/null +++ b/ports/esp32/boards/UM_FEATHERS3/manifest.py @@ -0,0 +1,2 @@ +include("$(PORT_DIR)/boards/manifest.py") +freeze("modules") diff --git a/ports/esp32/boards/UM_FEATHERS3/modules/feathers3.py b/ports/esp32/boards/UM_FEATHERS3/modules/feathers3.py new file mode 100644 index 0000000000..801f9cbf46 --- /dev/null +++ b/ports/esp32/boards/UM_FEATHERS3/modules/feathers3.py @@ -0,0 +1,90 @@ +# FeatherS3 MicroPython Helper Library +# MIT license; Copyright (c) 2022 Seon Rozenblum - Unexpected Maker +# +# Project home: +# http://feathers3.io + +# Import required libraries +from micropython import const +from machine import Pin, ADC +import time + +# FeatherS3 Hardware Pin Assignments + +# Sense Pins +VBUS_SENSE = const(34) +VBAT_SENSE = const(2) + +# RGB LED, LDO2 & Other Pins +RGB_DATA = const(40) +LDO2 = const(39) +LED = const(13) +AMB_LIGHT = const(4) + +# SPI +SPI_MOSI = const(35) +SPI_MISO = const(37) +SPI_CLK = const(36) + +# I2C +I2C_SDA = const(8) +I2C_SCL = const(9) + +# Helper functions + +# LED & Ambient Light Sensor control +def led_set(state): + """Set the state of the BLUE LED on IO13""" + l = Pin(LED, Pin.OUT) + l.value(state) + + +def led_blink(): + """Toggle the BLUE LED on IO13""" + l = Pin(LED, Pin.OUT) + l.value(not l.value()) + + +# Create ADC and set attenuation and return the ambient light value from the onboard sensor +def get_amb_light(): + """Get Ambient Light Sensor reading""" + adc = ADC(Pin(AMB_LIGHT)) + adc.atten(ADC.ATTN_11DB) + return adc.read() + + +def set_ldo2_power(state): + """Enable or Disable power to the second LDO""" + Pin(LDO2, Pin.OUT).value(state) + + +def get_battery_voltage(): + """ + Returns the current battery voltage. If no battery is connected, returns 4.2V which is the charge voltage + This is an approximation only, but useful to detect if the charge state of the battery is getting low. + """ + adc = ADC(Pin(VBAT_SENSE)) # Assign the ADC pin to read + measuredvbat = adc.read() + measuredvbat /= 4095 # divide by 4095 as we are using the default ADC attenuation of 0dB + measuredvbat *= 4.2 # Multiply by 4.2V, our max charge voltage for a 1S LiPo + return round(measuredvbat, 2) + + +def get_vbus_present(): + """Detect if VBUS (5V) power source is present""" + return Pin(VBUS_SENSE, Pin.IN).value() == 1 + + +# NeoPixel rainbow colour wheel +def rgb_color_wheel(wheel_pos): + """Color wheel to allow for cycling through the rainbow of RGB colors.""" + wheel_pos = wheel_pos % 255 + + if wheel_pos < 85: + return 255 - wheel_pos * 3, 0, wheel_pos * 3 + elif wheel_pos < 170: + wheel_pos -= 85 + return 0, wheel_pos * 3, 255 - wheel_pos * 3 + else: + wheel_pos -= 170 + return wheel_pos * 3, 255 - wheel_pos * 3, 0 diff --git a/ports/esp32/boards/UM_FEATHERS3/mpconfigboard.cmake b/ports/esp32/boards/UM_FEATHERS3/mpconfigboard.cmake new file mode 100644 index 0000000000..6c7f34009e --- /dev/null +++ b/ports/esp32/boards/UM_FEATHERS3/mpconfigboard.cmake @@ -0,0 +1,12 @@ +set(IDF_TARGET esp32s3) + +set(SDKCONFIG_DEFAULTS + boards/sdkconfig.base + boards/sdkconfig.usb + boards/sdkconfig.ble + boards/sdkconfig.240mhz + boards/sdkconfig.spiram_sx + boards/UM_TINYS3/sdkconfig.board +) + +set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) diff --git a/ports/esp32/boards/UM_FEATHERS3/mpconfigboard.h b/ports/esp32/boards/UM_FEATHERS3/mpconfigboard.h new file mode 100644 index 0000000000..738b32ca1e --- /dev/null +++ b/ports/esp32/boards/UM_FEATHERS3/mpconfigboard.h @@ -0,0 +1,11 @@ +#define MICROPY_HW_BOARD_NAME "FeatherS3" +#define MICROPY_HW_MCU_NAME "ESP32-S3" + +#define MICROPY_PY_MACHINE_DAC (0) + +#define MICROPY_HW_I2C0_SCL (9) +#define MICROPY_HW_I2C0_SDA (8) + +#define MICROPY_HW_SPI1_MOSI (35) +#define MICROPY_HW_SPI1_MISO (37) +#define MICROPY_HW_SPI1_SCK (36) diff --git a/ports/esp32/boards/UM_FEATHERS3/sdkconfig.board b/ports/esp32/boards/UM_FEATHERS3/sdkconfig.board new file mode 100644 index 0000000000..5e20045125 --- /dev/null +++ b/ports/esp32/boards/UM_FEATHERS3/sdkconfig.board @@ -0,0 +1,23 @@ +CONFIG_FLASHMODE_QIO=y +CONFIG_ESPTOOLPY_FLASHFREQ_80M=y +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +CONFIG_ESPTOOLPY_AFTER_NORESET=y + +CONFIG_SPIRAM_MEMTEST= + +CONFIG_ESPTOOLPY_FLASHSIZE_4MB= +CONFIG_ESPTOOLPY_FLASHSIZE_8MB= +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-16MiB.csv" + +CONFIG_LWIP_LOCAL_HOSTNAME="UMFeatherS3" + +# CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID is not set +CONFIG_TINYUSB_DESC_CUSTOM_VID=0x303A +# CONFIG_TINYUSB_DESC_USE_DEFAULT_PID is not set +CONFIG_TINYUSB_DESC_CUSTOM_PID=0x80D7 +CONFIG_TINYUSB_DESC_BCD_DEVICE=0x0100 +CONFIG_TINYUSB_DESC_MANUFACTURER_STRING="Unexpected Maker" +CONFIG_TINYUSB_DESC_PRODUCT_STRING="FeatherS3" +CONFIG_TINYUSB_DESC_SERIAL_STRING="_fs3_" \ No newline at end of file diff --git a/ports/esp32/boards/UM_PROS3/board.json b/ports/esp32/boards/UM_PROS3/board.json new file mode 100644 index 0000000000..0122e4b991 --- /dev/null +++ b/ports/esp32/boards/UM_PROS3/board.json @@ -0,0 +1,27 @@ +{ + "deploy": [ + "deploy.md" + ], + "docs": "", + "features": [ + "Battery Charging", + "RGB LED", + "SPIRAM", + "USB-C", + "WiFi", + "BLE", + "STEMMA QT/QWIIC", + "Feather" + ], + "features_non_filterable": [ + ], + "id": "pros3", + "images": [ + "unexpectedmaker_pros3.jpg" + ], + "mcu": "esp32s3", + "product": "ProS3", + "thumbnail": "", + "url": "https://pros3.io", + "vendor": "Unexpected Maker" +} diff --git a/ports/esp32/boards/UM_PROS3/board.md b/ports/esp32/boards/UM_PROS3/board.md new file mode 100644 index 0000000000..4d1c435a07 --- /dev/null +++ b/ports/esp32/boards/UM_PROS3/board.md @@ -0,0 +1,2 @@ +The following files are daily firmware for the ProS3. This firmware is +compiled using ESP-IDF v4.4 or later. diff --git a/ports/esp32/boards/UM_PROS3/deploy.md b/ports/esp32/boards/UM_PROS3/deploy.md new file mode 100644 index 0000000000..d35d7a02fe --- /dev/null +++ b/ports/esp32/boards/UM_PROS3/deploy.md @@ -0,0 +1,52 @@ +Program your board using the latest version of the esptool.py program, found [here](https://github.com/espressif/esptool). + +To flash or erase your ProS3, you have to first put it into download mode. +To do this, follow these steps: + +- Press and hold the [BOOT] button +- Press and release the [RESET] button +- Release the [BOOT] button + +Now the board is in download mode and the native USB will have enumerated as a serial device. + +If you are putting MicroPython on your board for the first time then you should +first erase the entire flash using: + +### Linux +```bash +esptool.py --chip esp32s3 --port /dev/ttyACM0 erase_flash +``` + +### Mac +Please do a `ls /dev/cu.usbm*` to determine the port your board has enumerated as. +```bash +esptool.py --chip esp32s3 --port /dev/cu.usbmodem01 erase_flash +``` + +### Windows +Change (X) to whatever COM port is being used by the board +```bash +esptool --chip esp32s3 --port COM(X) erase_flash +``` + +Now download the version of the firmware you would like to install from the options below, +then use the following command to program the firmware starting at address 0x0, +remembering to replace `pros3-micropython-firmware-version.bin` with the name of +the firmware you just downloaded: + +### Linux +```bash +esptool.py --chip esp32s3 --port /dev/ttyACM0 write_flash -z 0x0 pros3-micropython-firmware-version.bin +``` + +### Mac +Please do a `ls /dev/cu.usbm*` to determine the port your board has enumerated as. +```bash +esptool.py --chip esp32s3 --port /dev/cu.usbmodem01 write_flash -z 0x0 pros3-micropython-firmware-version.bin +``` + +### Windows +Change (X) to whatever COM port is being used by the board +```bash +esptool --chip esp32s3 --port COM(X) write_flash -z 0x0 pros3-pros3-firmware-version.bin +``` diff --git a/ports/esp32/boards/UM_PROS3/manifest.py b/ports/esp32/boards/UM_PROS3/manifest.py new file mode 100644 index 0000000000..7ae2ed15d9 --- /dev/null +++ b/ports/esp32/boards/UM_PROS3/manifest.py @@ -0,0 +1,2 @@ +include("$(PORT_DIR)/boards/manifest.py") +freeze("modules") diff --git a/ports/esp32/boards/UM_PROS3/modules/pros3.py b/ports/esp32/boards/UM_PROS3/modules/pros3.py new file mode 100644 index 0000000000..2edf3e42ea --- /dev/null +++ b/ports/esp32/boards/UM_PROS3/modules/pros3.py @@ -0,0 +1,66 @@ +# ProS3 MicroPython Helper Library +# MIT license; Copyright (c) 2022 Seon Rozenblum - Unexpected Maker +# +# Project home: +# http://pros3.io + +# Import required libraries +from micropython import const +from machine import Pin, ADC +import time + +# ProS3 Hardware Pin Assignments + +# Sense Pins +VBUS_SENSE = const(33) +VBAT_SENSE = const(10) + +# RGB LED & LDO2 Pins +RGB_DATA = const(18) +LDO2 = const(17) + +# SPI +SPI_MOSI = const(35) +SPI_MISO = const(37) +SPI_CLK = const(36) + +# I2C +I2C_SDA = const(8) +I2C_SCL = const(9) + +# Helper functions +def set_ldo2_power(state): + """Enable or Disable power to the second LDO""" + Pin(LDO2, Pin.OUT).value(state) + + +def get_battery_voltage(): + """ + Returns the current battery voltage. If no battery is connected, returns 4.2V which is the charge voltage + This is an approximation only, but useful to detect if the charge state of the battery is getting low. + """ + adc = ADC(Pin(VBAT_SENSE)) # Assign the ADC pin to read + measuredvbat = adc.read() + measuredvbat /= 4095 # divide by 4095 as we are using the default ADC attenuation of 0dB + measuredvbat *= 4.2 # Multiply by 4.2V, our max charge voltage for a 1S LiPo + return round(measuredvbat, 2) + + +def get_vbus_present(): + """Detect if VBUS (5V) power source is present""" + return Pin(VBUS_SENSE, Pin.IN).value() == 1 + + +# NeoPixel rainbow colour wheel +def rgb_color_wheel(wheel_pos): + """Color wheel to allow for cycling through the rainbow of RGB colors.""" + wheel_pos = wheel_pos % 255 + + if wheel_pos < 85: + return 255 - wheel_pos * 3, 0, wheel_pos * 3 + elif wheel_pos < 170: + wheel_pos -= 85 + return 0, wheel_pos * 3, 255 - wheel_pos * 3 + else: + wheel_pos -= 170 + return wheel_pos * 3, 255 - wheel_pos * 3, 0 diff --git a/ports/esp32/boards/UM_PROS3/mpconfigboard.cmake b/ports/esp32/boards/UM_PROS3/mpconfigboard.cmake new file mode 100644 index 0000000000..41a96f26e3 --- /dev/null +++ b/ports/esp32/boards/UM_PROS3/mpconfigboard.cmake @@ -0,0 +1,12 @@ +set(IDF_TARGET esp32s3) + +set(SDKCONFIG_DEFAULTS + boards/sdkconfig.base + boards/sdkconfig.usb + boards/sdkconfig.ble + boards/sdkconfig.240mhz + boards/sdkconfig.spiram_sx + boards/UM_PROS3/sdkconfig.board +) + +set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) diff --git a/ports/esp32/boards/UM_PROS3/mpconfigboard.h b/ports/esp32/boards/UM_PROS3/mpconfigboard.h new file mode 100644 index 0000000000..1522e2aee3 --- /dev/null +++ b/ports/esp32/boards/UM_PROS3/mpconfigboard.h @@ -0,0 +1,11 @@ +#define MICROPY_HW_BOARD_NAME "ProS3" +#define MICROPY_HW_MCU_NAME "ESP32-S3" + +#define MICROPY_PY_MACHINE_DAC (0) + +#define MICROPY_HW_I2C0_SCL (9) +#define MICROPY_HW_I2C0_SDA (8) + +#define MICROPY_HW_SPI1_MOSI (35) +#define MICROPY_HW_SPI1_MISO (37) +#define MICROPY_HW_SPI1_SCK (36) diff --git a/ports/esp32/boards/UM_PROS3/sdkconfig.board b/ports/esp32/boards/UM_PROS3/sdkconfig.board new file mode 100644 index 0000000000..06b3a00a1c --- /dev/null +++ b/ports/esp32/boards/UM_PROS3/sdkconfig.board @@ -0,0 +1,23 @@ +CONFIG_FLASHMODE_QIO=y +CONFIG_ESPTOOLPY_FLASHFREQ_80M=y +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +CONFIG_ESPTOOLPY_AFTER_NORESET=y + +CONFIG_SPIRAM_MEMTEST= + +CONFIG_ESPTOOLPY_FLASHSIZE_4MB= +CONFIG_ESPTOOLPY_FLASHSIZE_8MB= +CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-16MiB.csv" + +CONFIG_LWIP_LOCAL_HOSTNAME="UMProS3" + +# CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID is not set +CONFIG_TINYUSB_DESC_CUSTOM_VID=0x303A +# CONFIG_TINYUSB_DESC_USE_DEFAULT_PID is not set +CONFIG_TINYUSB_DESC_CUSTOM_PID=0x80D4 +CONFIG_TINYUSB_DESC_BCD_DEVICE=0x0100 +CONFIG_TINYUSB_DESC_MANUFACTURER_STRING="Unexpected Maker" +CONFIG_TINYUSB_DESC_PRODUCT_STRING="ProS3" +CONFIG_TINYUSB_DESC_SERIAL_STRING="_ps3_" diff --git a/ports/esp32/boards/UM_TINYS3/board.json b/ports/esp32/boards/UM_TINYS3/board.json new file mode 100644 index 0000000000..73482a6284 --- /dev/null +++ b/ports/esp32/boards/UM_TINYS3/board.json @@ -0,0 +1,26 @@ +{ + "deploy": [ + "deploy.md" + ], + "docs": "", + "features": [ + "Battery Charging", + "RGB LED", + "SPIRAM", + "USB-C", + "WiFi", + "BLE" + ], + "features_non_filterable": [ + "TinyPICO Compatible" + ], + "id": "tinys3", + "images": [ + "unexpectedmaker_tinys3.jpg" + ], + "mcu": "esp32s3", + "product": "TinyS3", + "thumbnail": "", + "url": "https://tinys3.io", + "vendor": "Unexpected Maker" +} diff --git a/ports/esp32/boards/UM_TINYS3/board.md b/ports/esp32/boards/UM_TINYS3/board.md new file mode 100644 index 0000000000..da06e191f2 --- /dev/null +++ b/ports/esp32/boards/UM_TINYS3/board.md @@ -0,0 +1,2 @@ +The following files are daily firmware for the TinyS3. This firmware is +compiled using ESP-IDF v4.4 or later. diff --git a/ports/esp32/boards/UM_TINYS3/deploy.md b/ports/esp32/boards/UM_TINYS3/deploy.md new file mode 100644 index 0000000000..d65014e012 --- /dev/null +++ b/ports/esp32/boards/UM_TINYS3/deploy.md @@ -0,0 +1,52 @@ +Program your board using the latest version of the esptool.py program, found [here](https://github.com/espressif/esptool). + +To flash or erase your TinyS3, you have to first put it into download mode. +To do this, follow these steps: + +- Press and hold the [BOOT] button +- Press and release the [RESET] button +- Release the [BOOT] button + +Now the board is in download mode and the native USB will have enumerated as a serial device. + +If you are putting MicroPython on your board for the first time then you should +first erase the entire flash using: + +### Linux +```bash +esptool.py --chip esp32s3 --port /dev/ttyACM0 erase_flash +``` + +### Mac +Please do a `ls /dev/cu.usbm*` to determine the port your board has enumerated as. +```bash +esptool.py --chip esp32s3 --port /dev/cu.usbmodem01 erase_flash +``` + +### Windows +Change (X) to whatever COM port is being used by the board +```bash +esptool --chip esp32s3 --port COM(X) erase_flash +``` + +Now download the version of the firmware you would like to install from the options below, +then use the following command to program the firmware starting at address 0x0, +remembering to replace `tinys3-micropython-firmware-version.bin` with the name of +the firmware you just downloaded: + +### Linux +```bash +esptool.py --chip esp32s3 --port /dev/ttyACM0 write_flash -z 0x0 tinys3-micropython-firmware-version.bin +``` + +### Mac +Please do a `ls /dev/cu.usbm*` to determine the port your board has enumerated as. +```bash +esptool.py --chip esp32s3 --port /dev/cu.usbmodem01 write_flash -z 0x0 tinys3-micropython-firmware-version.bin +``` + +### Windows +Change (X) to whatever COM port is being used by the board +```bash +esptool --chip esp32s3 --port COM(X) write_flash -z 0x0 tinys3-micropython-firmware-version.bin +``` diff --git a/ports/esp32/boards/UM_TINYS3/manifest.py b/ports/esp32/boards/UM_TINYS3/manifest.py new file mode 100644 index 0000000000..7ae2ed15d9 --- /dev/null +++ b/ports/esp32/boards/UM_TINYS3/manifest.py @@ -0,0 +1,2 @@ +include("$(PORT_DIR)/boards/manifest.py") +freeze("modules") diff --git a/ports/esp32/boards/UM_TINYS3/modules/tinys3.py b/ports/esp32/boards/UM_TINYS3/modules/tinys3.py new file mode 100644 index 0000000000..4efcfe4b52 --- /dev/null +++ b/ports/esp32/boards/UM_TINYS3/modules/tinys3.py @@ -0,0 +1,66 @@ +# TinyS3 Helper Library +# MIT license; Copyright (c) 2022 Seon Rozenblum - Unexpected Maker +# +# Project home: +# https://tinys3.io + +# Import required libraries +from micropython import const +from machine import Pin, ADC +import time + +# TinyS3 Hardware Pin Assignments + +# Sense Pins +VBUS_SENSE = const(33) +VBAT_SENSE = const(10) + +# RGB LED Pins +RGB_DATA = const(18) +RGB_PWR = const(17) + +# SPI +SPI_MOSI = const(35) +SPI_MISO = const(37) +SPI_CLK = const(36) + +# I2C +I2C_SDA = const(8) +I2C_SCL = const(9) + +# Helper functions +def set_pixel_power(state): + """Enable or Disable power to the onboard NeoPixel to either show colour, or to reduce power for deep sleep.""" + Pin(RGB_PWR, Pin.OUT).value(state) + + +def get_battery_voltage(): + """ + Returns the current battery voltage. If no battery is connected, returns 4.2V which is the charge voltage + This is an approximation only, but useful to detect if the charge state of the battery is getting low. + """ + adc = ADC(Pin(VBAT_SENSE)) # Assign the ADC pin to read + measuredvbat = adc.read() + measuredvbat /= 4095 # divide by 4095 as we are using the default ADC attenuation of 0dB + measuredvbat *= 4.2 # Multiply by 4.2V, our max charge voltage for a 1S LiPo + return round(measuredvbat, 2) + + +def get_vbus_present(): + """Detect if VBUS (5V) power source is present""" + return Pin(VBUS_SENSE, Pin.IN).value() == 1 + + +# NeoPixel rainbow colour wheel +def rgb_color_wheel(wheel_pos): + """Color wheel to allow for cycling through the rainbow of RGB colors.""" + wheel_pos = wheel_pos % 255 + + if wheel_pos < 85: + return 255 - wheel_pos * 3, 0, wheel_pos * 3 + elif wheel_pos < 170: + wheel_pos -= 85 + return 0, wheel_pos * 3, 255 - wheel_pos * 3 + else: + wheel_pos -= 170 + return wheel_pos * 3, 255 - wheel_pos * 3, 0 diff --git a/ports/esp32/boards/UM_TINYS3/mpconfigboard.cmake b/ports/esp32/boards/UM_TINYS3/mpconfigboard.cmake new file mode 100644 index 0000000000..6c7f34009e --- /dev/null +++ b/ports/esp32/boards/UM_TINYS3/mpconfigboard.cmake @@ -0,0 +1,12 @@ +set(IDF_TARGET esp32s3) + +set(SDKCONFIG_DEFAULTS + boards/sdkconfig.base + boards/sdkconfig.usb + boards/sdkconfig.ble + boards/sdkconfig.240mhz + boards/sdkconfig.spiram_sx + boards/UM_TINYS3/sdkconfig.board +) + +set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) diff --git a/ports/esp32/boards/UM_TINYS3/mpconfigboard.h b/ports/esp32/boards/UM_TINYS3/mpconfigboard.h new file mode 100644 index 0000000000..b2638a9847 --- /dev/null +++ b/ports/esp32/boards/UM_TINYS3/mpconfigboard.h @@ -0,0 +1,11 @@ +#define MICROPY_HW_BOARD_NAME "TinyS3" +#define MICROPY_HW_MCU_NAME "ESP32-S3-FN8" + +#define MICROPY_PY_MACHINE_DAC (0) + +#define MICROPY_HW_I2C0_SCL (9) +#define MICROPY_HW_I2C0_SDA (8) + +#define MICROPY_HW_SPI1_MOSI (35) +#define MICROPY_HW_SPI1_MISO (37) +#define MICROPY_HW_SPI1_SCK (36) diff --git a/ports/esp32/boards/UM_TINYS3/sdkconfig.board b/ports/esp32/boards/UM_TINYS3/sdkconfig.board new file mode 100644 index 0000000000..2b9ddbebe7 --- /dev/null +++ b/ports/esp32/boards/UM_TINYS3/sdkconfig.board @@ -0,0 +1,23 @@ +CONFIG_FLASHMODE_QIO=y +CONFIG_ESPTOOLPY_FLASHFREQ_80M=y +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +CONFIG_ESPTOOLPY_AFTER_NORESET=y + +CONFIG_SPIRAM_MEMTEST= + +CONFIG_ESPTOOLPY_FLASHSIZE_4MB= +CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y +CONFIG_ESPTOOLPY_FLASHSIZE_16MB= +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions-8MiB.csv" + +CONFIG_LWIP_LOCAL_HOSTNAME="UMTinyS3" + +# CONFIG_TINYUSB_DESC_USE_ESPRESSIF_VID is not set +CONFIG_TINYUSB_DESC_CUSTOM_VID=0x303A +# CONFIG_TINYUSB_DESC_USE_DEFAULT_PID is not set +CONFIG_TINYUSB_DESC_CUSTOM_PID=0x80D1 +CONFIG_TINYUSB_DESC_BCD_DEVICE=0x0100 +CONFIG_TINYUSB_DESC_MANUFACTURER_STRING="Unexpected Maker" +CONFIG_TINYUSB_DESC_PRODUCT_STRING="TinyS3" +CONFIG_TINYUSB_DESC_SERIAL_STRING="_ts3_" From 30a022548fcd20bf956789185e1481edb0f0acfc Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sat, 22 Jan 2022 20:37:50 +0200 Subject: [PATCH 0108/1712] tests/multi_net/udp_data.py: Make UDP test more reliable. The current test depends on a specific number and order of packets to pass, which can't be reproduced every run due to the unreliable UDP protocol. This patch adds simple packets sequencing, retransmits with timeouts, and a packet loss threshold, to make the test more tolerant to UDP protocol packet drops and reordering. --- tests/multi_net/udp_data.py | 52 ++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/tests/multi_net/udp_data.py b/tests/multi_net/udp_data.py index 0c0f165b74..8934d7df74 100644 --- a/tests/multi_net/udp_data.py +++ b/tests/multi_net/udp_data.py @@ -3,34 +3,68 @@ import socket NUM_NEW_SOCKETS = 4 -NUM_TRANSFERS = 4 +NUM_TRANSFERS = 10 +TOTAL_PACKETS = NUM_NEW_SOCKETS * NUM_TRANSFERS +# If more than 75% of packets are lost, the test fails. +PACKET_LOSS_THRESH = 0.75 * TOTAL_PACKETS PORT = 8000 + +def print_stats(seq): + if (TOTAL_PACKETS - seq) > PACKET_LOSS_THRESH: + print( + "packet loss %.1f%% %d/%d" + % (((TOTAL_PACKETS - seq) / TOTAL_PACKETS * 100), seq, TOTAL_PACKETS) + ) + else: + print("pass") + + # Server def instance0(): + seq = 0 multitest.globals(IP=multitest.get_network_ip()) multitest.next() for i in range(NUM_NEW_SOCKETS): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - s.bind(socket.getaddrinfo("0.0.0.0", PORT)[0][-1]) + s.bind(socket.getaddrinfo("0.0.0.0", PORT + i)[0][-1]) + s.settimeout(0.250) multitest.broadcast("server ready") for j in range(NUM_TRANSFERS): - data, addr = s.recvfrom(1000) - print(data) - s.sendto(b"server to client %d %d" % (i, j), addr) + try: + data, addr = s.recvfrom(1000) + except: + continue + if int(data) == seq: + if seq < (TOTAL_PACKETS - PACKET_LOSS_THRESH): + print(seq) + seq += 1 + s.sendto(b"%d" % (seq), addr) s.close() + print_stats(seq) + # Client def instance1(): + seq = 0 multitest.next() - ai = socket.getaddrinfo(IP, PORT)[0][-1] for i in range(NUM_NEW_SOCKETS): + ai = socket.getaddrinfo(IP, PORT + i)[0][-1] s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + s.settimeout(0.250) multitest.wait("server ready") for j in range(NUM_TRANSFERS): - s.sendto(b"client to server %d %d" % (i, j), ai) - data, addr = s.recvfrom(1000) - print(data) + s.sendto(b"%d" % (seq), ai) + try: + data, addr = s.recvfrom(1000) + except: + continue + if int(data) == seq + 1: + if seq < (TOTAL_PACKETS - PACKET_LOSS_THRESH): + print(seq) + seq += 1 s.close() + + print_stats(seq) From a41abd94dcbb5c36cd3a66ae000fa02634472a6c Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Mon, 12 Jul 2021 17:47:49 +0200 Subject: [PATCH 0109/1712] docs/library/collections.rst: Use class for deque and OrderedDict. --- docs/library/collections.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/library/collections.rst b/docs/library/collections.rst index 21f06fded7..6cf2c096ff 100644 --- a/docs/library/collections.rst +++ b/docs/library/collections.rst @@ -12,7 +12,7 @@ hold/accumulate various objects. Classes ------- -.. function:: deque(iterable, maxlen[, flags]) +.. class:: deque(iterable, maxlen[, flags]) Deques (double-ended queues) are a list-like container that support O(1) appends and pops from either side of the deque. New deques are created @@ -57,7 +57,7 @@ Classes print(t1.name) assert t2.name == t2[1] -.. function:: OrderedDict(...) +.. class:: OrderedDict(...) ``dict`` type subclass which remembers and preserves the order of keys added. When ordered dict is iterated over, keys/items are returned in From cd0531c533c9e3bb6e96ec8d994ae272b58503c6 Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Mon, 12 Jul 2021 18:04:56 +0200 Subject: [PATCH 0110/1712] docs: Use the correct * keyword-only notation. --- docs/library/machine.PWM.rst | 4 ++-- docs/library/pyb.Pin.rst | 2 +- docs/wipy/general.rst | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/library/machine.PWM.rst b/docs/library/machine.PWM.rst index 4c72255d81..793c074a36 100644 --- a/docs/library/machine.PWM.rst +++ b/docs/library/machine.PWM.rst @@ -23,7 +23,7 @@ Example usage:: Constructors ------------ -.. class:: PWM(dest, \*, freq, duty_u16, duty_ns) +.. class:: PWM(dest, *, freq, duty_u16, duty_ns) Construct and return a new PWM object using the following parameters: @@ -42,7 +42,7 @@ Constructors Methods ------- -.. method:: PWM.init(\*, freq, duty_u16, duty_ns) +.. method:: PWM.init(*, freq, duty_u16, duty_ns) Modify settings for the PWM object. See the above constructor for details about the parameters. diff --git a/docs/library/pyb.Pin.rst b/docs/library/pyb.Pin.rst index 23ede48ed3..33b994e390 100644 --- a/docs/library/pyb.Pin.rst +++ b/docs/library/pyb.Pin.rst @@ -98,7 +98,7 @@ Class methods Methods ------- -.. method:: Pin.init(mode, pull=Pin.PULL_NONE, \*, value=None, alt=-1) +.. method:: Pin.init(mode, pull=Pin.PULL_NONE, *, value=None, alt=-1) Initialise the pin: diff --git a/docs/wipy/general.rst b/docs/wipy/general.rst index 7f24435db3..a1c8df8ef4 100644 --- a/docs/wipy/general.rst +++ b/docs/wipy/general.rst @@ -345,7 +345,7 @@ Example:: Create a server instance, see ``init`` for parameters of initialization. -.. method:: server.init(\*, login=('micro', 'python'), timeout=300) +.. method:: server.init(*, login=('micro', 'python'), timeout=300) Init (and effectively start the server). Optionally a new ``user``, ``password`` and ``timeout`` (in seconds) can be passed. @@ -368,7 +368,7 @@ Adhoc VFS-like support WiPy doesn't implement full MicroPython VFS support, instead following functions are defined in ``os`` module: -.. function:: mount(block_device, mount_point, \*, readonly=False) +.. function:: mount(block_device, mount_point, *, readonly=False) Mounts a block device (like an ``SD`` object) in the specified mount point. Example:: From 2c30ac7aeb0694ea0b4721706639ca7781de34f5 Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Tue, 27 Jul 2021 00:11:11 +0200 Subject: [PATCH 0111/1712] docs/library/socket.rst: Document socket as a class. Following CPython: https://bugs.python.org/issue45772 --- docs/library/socket.rst | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/library/socket.rst b/docs/library/socket.rst index 704b614ab1..1d1c23abd1 100644 --- a/docs/library/socket.rst +++ b/docs/library/socket.rst @@ -66,19 +66,6 @@ Tuple address format for ``socket`` module: Functions --------- -.. function:: socket(af=AF_INET, type=SOCK_STREAM, proto=IPPROTO_TCP, /) - - Create a new socket using the given address family, socket type and - protocol number. Note that specifying *proto* in most cases is not - required (and not recommended, as some MicroPython ports may omit - ``IPPROTO_*`` constants). Instead, *type* argument will select needed - protocol automatically:: - - # Create STREAM TCP socket - socket(AF_INET, SOCK_STREAM) - # Create DGRAM UDP socket - socket(AF_INET, SOCK_DGRAM) - .. function:: getaddrinfo(host, port, af=0, type=0, proto=0, flags=0, /) Translate the host/port argument into a sequence of 5-tuples that contain all the @@ -176,6 +163,19 @@ Constants specific to WiPy: class socket ============ +.. class:: socket(af=AF_INET, type=SOCK_STREAM, proto=IPPROTO_TCP, /) + + Create a new socket using the given address family, socket type and + protocol number. Note that specifying *proto* in most cases is not + required (and not recommended, as some MicroPython ports may omit + ``IPPROTO_*`` constants). Instead, *type* argument will select needed + protocol automatically:: + + # Create STREAM TCP socket + socket(AF_INET, SOCK_STREAM) + # Create DGRAM UDP socket + socket(AF_INET, SOCK_DGRAM) + Methods ------- From 50b172023f27e571ffdc250a7e90916b46b8feca Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Tue, 21 Sep 2021 18:26:39 +0200 Subject: [PATCH 0112/1712] docs/library/pyb.Timer.rst: Add pyb.Timer class constants. --- docs/library/pyb.Timer.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/library/pyb.Timer.rst b/docs/library/pyb.Timer.rst index 34fe71155f..cc7a01f580 100644 --- a/docs/library/pyb.Timer.rst +++ b/docs/library/pyb.Timer.rst @@ -262,3 +262,12 @@ Methods for which the pulse is active. The value can be an integer or floating-point number for more accuracy. For example, a value of 25 gives a duty cycle of 25%. + +Constants +--------- + +.. data:: Timer.UP + Timer.DOWN + Timer.CENTER + + Configures the timer to count Up, Down, or from 0 to ARR and then back down to 0. From ba4f6f5fdf949924b44bf54291f6a860d6e36bff Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Tue, 21 Sep 2021 18:37:01 +0200 Subject: [PATCH 0113/1712] docs/library/pyb.rst: Add pyb.hid_mouse and pyb.hid_keyboard constants. --- docs/library/pyb.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/library/pyb.rst b/docs/library/pyb.rst index 880d68c531..c8ef2c5315 100644 --- a/docs/library/pyb.rst +++ b/docs/library/pyb.rst @@ -298,6 +298,15 @@ Miscellaneous functions The *high_speed* parameter, when set to ``True``, enables USB HS mode if it is supported by the hardware. +Constants +--------- + +.. data:: pyb.hid_mouse + pyb.hid_keyboard + + A tuple of (subclass, protocol, max packet length, polling interval, report + descriptor) to set appropriate values for a USB mouse or keyboard. + Classes ------- From 8715ad9ccfc45c25883fb1a7587c9f81da8133ab Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Tue, 21 Sep 2021 21:58:19 +0200 Subject: [PATCH 0114/1712] docs/library/pyb.DAC.rst: Add DAC class constants. --- docs/library/pyb.DAC.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/library/pyb.DAC.rst b/docs/library/pyb.DAC.rst index bf07119ada..0eb469bef4 100644 --- a/docs/library/pyb.DAC.rst +++ b/docs/library/pyb.DAC.rst @@ -122,3 +122,15 @@ Methods dac2 = DAC(2) dac1.write_timed(buf1, pyb.Timer(6, freq=100), mode=DAC.CIRCULAR) dac2.write_timed(buf2, pyb.Timer(7, freq=200), mode=DAC.CIRCULAR) + +Constants +--------- + +.. data:: DAC.NORMAL + + NORMAL mode does a single transmission of the waveform in the data buffer, + +.. data:: DAC.CIRCULAR + + CIRCULAR mode does a transmission of the waveform in the data buffer, and wraps around + to the start of the data buffer every time it reaches the end of the table. From 7621b176365c8b2b6187861dbb1f20ffe4c68335 Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Wed, 22 Sep 2021 15:47:27 +0200 Subject: [PATCH 0115/1712] docs/library/machine.SPI.rst: Add class constant SoftSPI.MSB and .LSB. --- docs/library/machine.SPI.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/library/machine.SPI.rst b/docs/library/machine.SPI.rst index 1116f0e8a3..7b0e8cf406 100644 --- a/docs/library/machine.SPI.rst +++ b/docs/library/machine.SPI.rst @@ -143,9 +143,11 @@ Constants for initialising the SPI bus to controller; this is only used for the WiPy .. data:: SPI.MSB + SoftSPI.MSB set the first bit to be the most significant bit .. data:: SPI.LSB + SoftSPI.LSB set the first bit to be the least significant bit From f99b6799167a6cce97a7a683825f6ea27a892e6e Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Sun, 26 Sep 2021 23:14:56 +0200 Subject: [PATCH 0116/1712] docs/library/machine.WDT.rst: Use correct case for WDT.feed. --- docs/library/machine.WDT.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/library/machine.WDT.rst b/docs/library/machine.WDT.rst index 3c799583e6..8c81e10ea5 100644 --- a/docs/library/machine.WDT.rst +++ b/docs/library/machine.WDT.rst @@ -31,7 +31,7 @@ Constructors Methods ------- -.. method:: wdt.feed() +.. method:: WDT.feed() Feed the WDT to prevent it from resetting the system. The application should place this call in a sensible place ensuring that the WDT is From 58cd2a8b0a16ba65b7390e425d37a825141735d3 Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Mon, 7 Feb 2022 18:34:57 +0100 Subject: [PATCH 0117/1712] docs/library/esp.rst: Document the osdebug function. --- docs/library/esp.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/library/esp.rst b/docs/library/esp.rst index 5fb370065f..8920c8241e 100644 --- a/docs/library/esp.rst +++ b/docs/library/esp.rst @@ -62,6 +62,21 @@ Functions .. function:: flash_erase(sector_no) +.. function:: osdebug(level) + + Turn esp os debugging messages on or off. + + The *level* parameter sets the threshold for the log messages for all esp components. + The log levels are defined as constants: + + * ``LOG_NONE`` -- No log output + * ``LOG_ERROR`` -- Critical errors, software module can not recover on its own + * ``LOG_WARN`` -- Error conditions from which recovery measures have been taken + * ``LOG_INFO`` -- Information messages which describe normal flow of events + * ``LOG_DEBUG`` -- Extra information which is not necessary for normal use (values, pointers, sizes, etc) + * ``LOG_VERBOSE`` -- Bigger chunks of debugging information, or frequent messages + which can potentially flood the output + .. function:: set_native_code_location(start, length) **Note**: ESP8266 only From 7f67524031a04d972ba59a50e5e320adadbcb893 Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Mon, 7 Feb 2022 19:11:47 +0100 Subject: [PATCH 0118/1712] docs/library/pyb.SPI.rst: Document default for prescaler argument. To prevent "non-default argument follows default argument" errors. --- docs/library/pyb.SPI.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/library/pyb.SPI.rst b/docs/library/pyb.SPI.rst index 1bdb73a5dd..14b90a2240 100644 --- a/docs/library/pyb.SPI.rst +++ b/docs/library/pyb.SPI.rst @@ -51,7 +51,7 @@ Methods Turn off the SPI bus. -.. method:: SPI.init(mode, baudrate=328125, *, prescaler, polarity=1, phase=0, bits=8, firstbit=SPI.MSB, ti=False, crc=None) +.. method:: SPI.init(mode, baudrate=328125, *, prescaler=-1, polarity=1, phase=0, bits=8, firstbit=SPI.MSB, ti=False, crc=None) Initialise the SPI bus with the given parameters: From 6653856b87a76adc5584bb72b32924719effa970 Mon Sep 17 00:00:00 2001 From: Jos Verlinde Date: Mon, 7 Feb 2022 22:13:26 +0100 Subject: [PATCH 0119/1712] docs/library/machine.Pin.rst: Document defaults for Pin.init. --- docs/library/machine.Pin.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/library/machine.Pin.rst b/docs/library/machine.Pin.rst index 32fa05b49c..f80de11784 100644 --- a/docs/library/machine.Pin.rst +++ b/docs/library/machine.Pin.rst @@ -42,7 +42,7 @@ Usage Model:: Constructors ------------ -.. class:: Pin(id, mode=-1, pull=-1, *, value, drive, alt) +.. class:: Pin(id, mode=-1, pull=-1, *, value=None, drive=0, alt=-1) Access the pin peripheral (GPIO pin) associated with the given ``id``. If additional arguments are given in the constructor then they are used to initialise @@ -108,7 +108,7 @@ Constructors Methods ------- -.. method:: Pin.init(mode=-1, pull=-1, *, value, drive, alt) +.. method:: Pin.init(mode=-1, pull=-1, *, value=None, drive=0, alt=-1) Re-initialise the pin using the given parameters. Only those arguments that are specified will be set. The rest of the pin peripheral state will remain From 8f6924c9fb061742039554a3b5840f6e92aff7f2 Mon Sep 17 00:00:00 2001 From: Lars Kellogg-Stedman Date: Thu, 3 Feb 2022 23:03:23 -0500 Subject: [PATCH 0120/1712] docs/library/uasyncio.rst: Fix description of ThreadSafeFlag.wait. When a task waits on a ThreadSafeFlag (and the wait method returns), the flag is immediately reset. This was not clear in the documentation, which appeared to copy the description of the wait method from the Event class. Signed-off-by: Lars Kellogg-Stedman --- docs/library/uasyncio.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/library/uasyncio.rst b/docs/library/uasyncio.rst index 1fc8b53db0..a842cc64d4 100644 --- a/docs/library/uasyncio.rst +++ b/docs/library/uasyncio.rst @@ -159,7 +159,7 @@ class ThreadSafeFlag .. method:: ThreadSafeFlag.wait() Wait for the flag to be set. If the flag is already set then it returns - immediately. + immediately. The flag is automatically reset upon return from ``wait``. A flag may only be waited on by a single task at a time. From d8a7bf83ccf28d0e8acf9790a1fc38aa5d13a2e5 Mon Sep 17 00:00:00 2001 From: YoungJoon Chun Date: Thu, 3 Feb 2022 22:41:45 +0900 Subject: [PATCH 0121/1712] rp2/machine_uart: Fix UART RTS behaviour so RTS is deasserted. The UART hardware flow control was not working correctly, the receive FIFO was always fetched and RTS was never deasserted. This is not a problem when hardware flow control is not used: normally, if the receive FIFO is full, the UART receiver won't receive data into the FIFO anymore, but the current implementation fetches from the FIFO and discards it instead. The problem is that data is discarded even when RTS is enabled. This commit fixes the issue by only taking from the FIFO if there is room in the ring buffer to put the character. Signed-off-by: YoungJoon Chun --- ports/rp2/machine_uart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/rp2/machine_uart.c b/ports/rp2/machine_uart.c index 283c12ed54..0642f704f7 100644 --- a/ports/rp2/machine_uart.c +++ b/ports/rp2/machine_uart.c @@ -109,10 +109,10 @@ STATIC const char *_invert_name[] = {"None", "INV_TX", "INV_RX", "INV_TX|INV_RX" /******************************************************************************/ // IRQ and buffer handling -// take all bytes from the fifo and store them, if possible, in the buffer +// take all bytes from the fifo and store them in the buffer STATIC void uart_drain_rx_fifo(machine_uart_obj_t *self) { - while (uart_is_readable(self->uart)) { - // try to write the data, ignore the fail + while (uart_is_readable(self->uart) && ringbuf_free(&self->read_buffer) > 0) { + // get a byte from uart and put into the buffer ringbuf_put(&(self->read_buffer), uart_get_hw(self->uart)->dr); } } From b33fdbe5357ae224d668b827958fbbd04b507540 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 10 Feb 2022 14:52:51 +1100 Subject: [PATCH 0122/1712] tests/run-perfbench.py: Allow a test to SKIP, and to have a .exp file. Signed-off-by: Damien George --- tests/run-perfbench.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/run-perfbench.py b/tests/run-perfbench.py index 5f299281fd..fccb7a7684 100755 --- a/tests/run-perfbench.py +++ b/tests/run-perfbench.py @@ -74,6 +74,8 @@ def run_feature_test(target, test): def run_benchmark_on_target(target, script): output, err = run_script_on_target(target, script) if err is None: + if output == "SKIP": + return -1, -1, "SKIP" time, norm, result = output.split(None, 2) try: return int(time), int(norm), result @@ -133,7 +135,14 @@ def run_benchmarks(target, param_n, param_m, n_average, test_list): # Check result against truth if needed if error is None and result_out != "None": - _, _, result_exp = run_benchmark_on_target(PYTHON_TRUTH, test_script) + test_file_expected = test_file + ".exp" + if os.path.isfile(test_file_expected): + # Expected result is given by a file, so read that in + with open(test_file_expected) as f: + result_exp = f.read().strip() + else: + # Run CPython to work out the expected result + _, _, result_exp = run_benchmark_on_target(PYTHON_TRUTH, test_script) if result_out != result_exp: error = "FAIL truth" From 75da124cf856d020efb17efbcba97543c5e7435c Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 10 Feb 2022 14:53:29 +1100 Subject: [PATCH 0123/1712] tests/perf_bench: Add perf tests for qstr interning and importing .mpy. Signed-off-by: Damien George --- tests/perf_bench/core_import_mpy_multi.py | 85 +++++++++++ tests/perf_bench/core_import_mpy_multi.py.exp | 1 + tests/perf_bench/core_import_mpy_single.py | 135 ++++++++++++++++++ .../perf_bench/core_import_mpy_single.py.exp | 1 + tests/perf_bench/core_qstr.py | 21 +++ 5 files changed, 243 insertions(+) create mode 100644 tests/perf_bench/core_import_mpy_multi.py create mode 100644 tests/perf_bench/core_import_mpy_multi.py.exp create mode 100644 tests/perf_bench/core_import_mpy_single.py create mode 100644 tests/perf_bench/core_import_mpy_single.py.exp create mode 100644 tests/perf_bench/core_qstr.py diff --git a/tests/perf_bench/core_import_mpy_multi.py b/tests/perf_bench/core_import_mpy_multi.py new file mode 100644 index 0000000000..0da466206b --- /dev/null +++ b/tests/perf_bench/core_import_mpy_multi.py @@ -0,0 +1,85 @@ +# Test performance of importing an .mpy file many times. + +import usys, uio, uos + +if not (hasattr(uio, "IOBase") and hasattr(uos, "mount")): + print("SKIP") + raise SystemExit + +# This is the test.py file that is compiled to test.mpy below. +""" +class A: + def __init__(self, arg): + self.arg = arg + def write(self): + pass + def read(self): + pass +def f(): + print, str, bytes, dict + Exception, ValueError, TypeError + x = "this will be a string object" + x = b"this will be a bytes object" + x = ("const tuple", None, False, True, 1, 2, 3) +result = 123 +""" +file_data = b'M\x05\x02\x1f \x81\x0c\x10\x12\x00\x07\x0etest.py\x8b\x07e`\x00T2\x00\x10\x02A4\x02\x16\x012\x01\x16\x02f"\x80{\x16\x0cresultQc\x00\x02\x81\x1c\x00\x10\x05\x07,EE\x00\x11\x00\x17\x16\x00\x16\x10\x03\x16\x00\x1a2\x00\x16\x00\x112\x01\x16\x00\xa42\x02\x16\x00}Qc\x00\x03<\x1a\x0c\x00\x11\x03@\x00\xb1\xb0\x18\x06argQc\x00\x00\x00\x89\x01,\t\x0e\x00\xa4\x03` \x00Qc\x00\x00\x00\x89,\t\x0e\x00}\x01``\x00Qc\x00\x00\x00\x89\x81l8\x16\t\x03\x80\x08/,##\x00\x12\x00{\x12\x00\x97\x12\x00B\x12\x00K*\x04Y\x12\x00$\x12\x007\x12\x006*\x03Y#\x00\xc0#\x01\xc0#\x02QPR\x81\x82\x83*\x07\xc0Qc\x03\x00s\x1cthis will be a string objectb\x1bthis will be a bytes objects\x0bconst tuple' + + +class File(uio.IOBase): + def __init__(self): + self.off = 0 + + def ioctl(self, request, arg): + return 0 + + def readinto(self, buf): + buf[:] = memoryview(file_data)[self.off : self.off + len(buf)] + self.off += len(buf) + return len(buf) + + +class FS: + def mount(self, readonly, mkfs): + pass + + def chdir(self, path): + pass + + def stat(self, path): + if path == "__injected.mpy": + return tuple(0 for _ in range(10)) + else: + raise OSError(-2) # ENOENT + + def open(self, path, mode): + return File() + + +def mount(): + uos.mount(FS(), "/__remote") + uos.chdir("/__remote") + + +def test(r): + global result + for _ in r: + usys.modules.clear() + module = __import__("__injected") + result = module.result + + +########################################################################### +# Benchmark interface + +bm_params = { + (100, 10): (50,), + (1000, 10): (500,), + (5000, 10): (5000,), +} + + +def bm_setup(params): + (nloop,) = params + mount() + return lambda: test(range(nloop)), lambda: (nloop, result) diff --git a/tests/perf_bench/core_import_mpy_multi.py.exp b/tests/perf_bench/core_import_mpy_multi.py.exp new file mode 100644 index 0000000000..190a18037c --- /dev/null +++ b/tests/perf_bench/core_import_mpy_multi.py.exp @@ -0,0 +1 @@ +123 diff --git a/tests/perf_bench/core_import_mpy_single.py b/tests/perf_bench/core_import_mpy_single.py new file mode 100644 index 0000000000..5ca3584959 --- /dev/null +++ b/tests/perf_bench/core_import_mpy_single.py @@ -0,0 +1,135 @@ +# Test performance of importing an .mpy file just once. +# The first import of a module will intern strings that don't already exist, and +# this test should be representative of what happens in a real application. + +import uio, uos + +if not (hasattr(uio, "IOBase") and hasattr(uos, "mount")): + print("SKIP") + raise SystemExit + +# This is the test.py file that is compiled to test.mpy below. +# Many known and unknown names/strings are included to test the linking process. +""" +class A0: + def a0(self): pass + def a1(self): pass + def a2(self): pass + def a3(self): pass +class A1: + def a0(self): pass + def a1(self): pass + def a2(self): pass + def a3(self): pass +def f0(): + __call__, __class__, __delitem__, __enter__, __exit__, __getattr__, __getitem__, + __hash__, __init__, __int__, __iter__, __len__, __main__, __module__, __name__, + __new__, __next__, __qualname__, __repr__, __setitem__, __str__, + ArithmeticError, AssertionError, AttributeError, BaseException, EOFError, Ellipsis, + Exception, GeneratorExit, ImportError, IndentationError, IndexError, KeyError, + KeyboardInterrupt, LookupError, MemoryError, NameError, NoneType, + NotImplementedError, OSError, OverflowError, RuntimeError, StopIteration, + SyntaxError, SystemExit, TypeError, ValueError, ZeroDivisionError, + abs, all, any, append, args, bool, builtins, bytearray, bytecode, bytes, callable, + chr, classmethod, clear, close, const, copy, count, dict, dir, divmod, end, + endswith, eval, exec, extend, find, format, from_bytes, get, getattr, globals, + hasattr, hash, id, index, insert, int, isalpha, isdigit, isinstance, islower, + isspace, issubclass, isupper, items, iter, join, key, keys, len, list, little, + locals, lower, lstrip, main, map, micropython, next, object, open, ord, pop, + popitem, pow, print, range, read, readinto, readline, remove, replace, repr, + reverse, rfind, rindex, round, rsplit, rstrip, self, send, sep, set, setattr, + setdefault, sort, sorted, split, start, startswith, staticmethod, step, stop, str, + strip, sum, super, throw, to_bytes, tuple, type, update, upper, value, values, + write, zip, + name0, name1, name2, name3, name4, name5, name6, name7, name8, name9, + quite_a_long_name0, quite_a_long_name1, quite_a_long_name2, quite_a_long_name3, + quite_a_long_name4, quite_a_long_name5, quite_a_long_name6, quite_a_long_name7, + quite_a_long_name8, quite_a_long_name9, quite_a_long_name10, quite_a_long_name11, +def f1(): + x = "this will be a string object 0" + x = "this will be a string object 1" + x = "this will be a string object 2" + x = "this will be a string object 3" + x = "this will be a string object 4" + x = "this will be a string object 5" + x = "this will be a string object 6" + x = "this will be a string object 7" + x = "this will be a string object 8" + x = "this will be a string object 9" + x = b"this will be a bytes object 0" + x = b"this will be a bytes object 1" + x = b"this will be a bytes object 2" + x = b"this will be a bytes object 3" + x = b"this will be a bytes object 4" + x = b"this will be a bytes object 5" + x = b"this will be a bytes object 6" + x = b"this will be a bytes object 7" + x = b"this will be a bytes object 8" + x = b"this will be a bytes object 9" + x = ("const tuple 0", None, False, True, 1, 2, 3) + x = ("const tuple 1", None, False, True, 1, 2, 3) + x = ("const tuple 2", None, False, True, 1, 2, 3) + x = ("const tuple 3", None, False, True, 1, 2, 3) + x = ("const tuple 4", None, False, True, 1, 2, 3) + x = ("const tuple 5", None, False, True, 1, 2, 3) + x = ("const tuple 6", None, False, True, 1, 2, 3) + x = ("const tuple 7", None, False, True, 1, 2, 3) + x = ("const tuple 8", None, False, True, 1, 2, 3) + x = ("const tuple 9", None, False, True, 1, 2, 3) +result = 123 +""" +file_data = b'M\x05\x02\x1f \x81\\\x10\x1a\x00\x07\x0etest.pyk@k@\x85\x18\x85\x1f\x00T2\x00\x10\x04A04\x02\x16\x01T2\x01\x10\x04A14\x02\x16\x012\x02\x16\x04f02\x03\x16\x04f1"\x80{\x16\x0cresultQc\x00\x04\x814\x00\x12\t\x0b,%%%\x00\x11\x00\x17\x16\x00\x16\x10\x03\x16\x00\x1a2\x00\x16\x04a02\x01\x16\x04a12\x02\x16\x04a22\x03\x16\x04a3Qc\x00\x04(\t\x0c\x07\x0b \x00Qc\x00\x00\x00\x89(\t\x0c\t\x03@\x00Qc\x00\x00\x00\x89(\t\x0c\t\x03`\x00Qc\x00\x00\x00\x89,\t\x0e\t\x03` \x00Qc\x00\x00\x00\x89\x818\x00\x14\x13\x03l`%%%\x00\x11\x00\x17\x16\x00\x16\x10\x03\x16\x00\x1a2\x00\x16\x0b2\x01\x16\x0b2\x02\x16\x0b2\x03\x16\x0bQc\x00\x04,\t\x0e\x07\x0b``\x00Qc\x00\x00\x00\x89,\t\x0e\t\x03\x80\x07\x00Qc\x00\x00\x00\x89,\t\x0e\t\x03\x80\x08\x00Qc\x00\x00\x00\x89,\t\x0e\t\x03\x80\t\x00Qc\x00\x00\x00\x89\x94\x1cPP\x13\x03\x80\x0b8;555222\x1f%\x1f%\x1f"\x1f"\x1f%\x1f%\x1f"\x1f%\x1f"\x1f%)\x1f"//\x00\x12\x00\t\x12\x00\n\x12\x00\x0b\x12\x00\x0c\x12\x00\r\x12\x00\x0e\x12\x00\x0f*\x07Y\x12\x00\x10\x12\x00\x11\x12\x00\x12\x12\x00\x13\x12\x00\x14\x12\x00\x15\x12\x00\x16\x12\x00\x17*\x08Y\x12\x00\x18\x12\x00\x19\x12\x00\x1a\x12\x00\x1b\x12\x00\x1c\x12\x00\x1d*\x06Y\x12\x00\x1e\x12\x00\x1f\x12\x00 \x12\x00!\x12\x00"\x12\x00#*\x06Y\x12\x00$\x12\x00%\x12\x00&\x12\x00\'\x12\x00(\x12\x00)*\x06Y\x12\x00*\x12\x00+\x12\x00,\x12\x00-\x12\x00.*\x05Y\x12\x00/\x12\x000\x12\x001\x12\x002\x12\x003*\x05Y\x12\x004\x12\x005\x12\x006\x12\x007\x12\x008*\x05Y\x12\x009\x12\x00:\x12\x00;\x12\x00<\x12\x00=\x12\x00>\x12\x00?\x12\x00@\x12\x00A\x12\x00B\x12\x00C*\x0bY\x12\x00D\x12\x00E\x12\x00F\x12\x00G\x12\x00H\x12\x00I\x12\x00J\x12\x00K\x12\x00L\x12\x00M\x12\x00N*\x0bY\x12\x00O\x12\x00P\x12\x00Q\x12\x00R\x12\x00S\x12\x00T\x12\x00U\x12\x00V\x12\x00W\x12\x00X*\nY\x12\x00Y\x12\x00Z\x12\x00[\x12\x00\\\x12\x00]\x12\x00^\x12\x00_\x12\x00`\x12\x00a\x12\x00b*\nY\x12\x00c\x12\x00d\x12\x00e\x12\x00f\x12\x00g\x12\x00h\x12\x00i\x12\x00j\x12\x00k\x12\x00l\x12\x00m*\x0bY\x12\x00n\x12\x00o\x12\x00p\x12\x00q\x12\x00r\x12\x00s\x12\x00t\x12\x00u\x12\x00v\x12\x00w\x12\x00x*\x0bY\x12\x00y\x12\x00z\x12\x00{\x12\x00|\x12\x00}\x12\x00~\x12\x00\x7f\x12\x00\x80\x12\x00\x81\x12\x00\x82*\nY\x12\x00\x83\x12\x00\x84\x12\x00\x85\x12\x00\x86\x12\x00\x87\x12\x00\x88\x12\x00\x89\x12\x00\x8a\x12\x00\x8b\x12\x00\x8c\x12\x00\x8d*\x0bY\x12\x00\x8e\x12\x00\x8f\x12\x00\x90\x12\x00\x91\x12\x00\x92\x12\x00\x93\x12\x00\x94\x12\x00\x95\x12\x00\x96\x12\x00\x97*\nY\x12\x00\x98\x12\x00\x99\x12\x00\x9a\x12\x00\x9b\x12\x00\x9c\x12\x00\x9d\x12\x00\x9e\x12\x00\x9f\x12\x00\xa0\x12\x00\xa2\x12\x00\xa3*\x0bY\x12\x00\xa4\x12\x00\xa5*\x02Y\x12\nname0\x12\nname1\x12\nname2\x12\nname3\x12\nname4\x12\nname5\x12\nname6\x12\nname7\x12\nname8\x12\nname9*\nY\x12$quite_a_long_name0\x12$quite_a_long_name1\x12$quite_a_long_name2\x12$quite_a_long_name3*\x04Y\x12$quite_a_long_name4\x12$quite_a_long_name5\x12$quite_a_long_name6\x12$quite_a_long_name7*\x04Y\x12$quite_a_long_name8\x12$quite_a_long_name9\x12&quite_a_long_name10\x12&quite_a_long_name11*\x04YQc\x00\x00\x86H8H?/\x80#####################+++++++++\x00#\x00\xc0#\x01\xc0#\x02\xc0#\x03\xc0#\x04\xc0#\x05\xc0#\x06\xc0#\x07\xc0#\x08\xc0#\t\xc0#\n\xc0#\x0b\xc0#\x0c\xc0#\r\xc0#\x0e\xc0#\x0f\xc0#\x10\xc0#\x11\xc0#\x12\xc0#\x13\xc0#\x14QPR\x81\x82\x83*\x07\xc0#\x15QPR\x81\x82\x83*\x07\xc0#\x16QPR\x81\x82\x83*\x07\xc0#\x17QPR\x81\x82\x83*\x07\xc0#\x18QPR\x81\x82\x83*\x07\xc0#\x19QPR\x81\x82\x83*\x07\xc0#\x1aQPR\x81\x82\x83*\x07\xc0#\x1bQPR\x81\x82\x83*\x07\xc0#\x1cQPR\x81\x82\x83*\x07\xc0#\x1dQPR\x81\x82\x83*\x07\xc0Qc\x1e\x00s\x1ethis will be a string object 0s\x1ethis will be a string object 1s\x1ethis will be a string object 2s\x1ethis will be a string object 3s\x1ethis will be a string object 4s\x1ethis will be a string object 5s\x1ethis will be a string object 6s\x1ethis will be a string object 7s\x1ethis will be a string object 8s\x1ethis will be a string object 9b\x1dthis will be a bytes object 0b\x1dthis will be a bytes object 1b\x1dthis will be a bytes object 2b\x1dthis will be a bytes object 3b\x1dthis will be a bytes object 4b\x1dthis will be a bytes object 5b\x1dthis will be a bytes object 6b\x1dthis will be a bytes object 7b\x1dthis will be a bytes object 8b\x1dthis will be a bytes object 9s\rconst tuple 0s\rconst tuple 1s\rconst tuple 2s\rconst tuple 3s\rconst tuple 4s\rconst tuple 5s\rconst tuple 6s\rconst tuple 7s\rconst tuple 8s\rconst tuple 9' + + +class File(uio.IOBase): + def __init__(self): + self.off = 0 + + def ioctl(self, request, arg): + return 0 + + def readinto(self, buf): + buf[:] = memoryview(file_data)[self.off : self.off + len(buf)] + self.off += len(buf) + return len(buf) + + +class FS: + def mount(self, readonly, mkfs): + pass + + def chdir(self, path): + pass + + def stat(self, path): + if path == "__injected.mpy": + return tuple(0 for _ in range(10)) + else: + raise OSError(-2) # ENOENT + + def open(self, path, mode): + return File() + + +def mount(): + uos.mount(FS(), "/__remote") + uos.chdir("/__remote") + + +def test(): + global result + module = __import__("__injected") + result = module.result + + +########################################################################### +# Benchmark interface + +bm_params = { + (1, 1): (), +} + + +def bm_setup(params): + mount() + return lambda: test(), lambda: (1, result) diff --git a/tests/perf_bench/core_import_mpy_single.py.exp b/tests/perf_bench/core_import_mpy_single.py.exp new file mode 100644 index 0000000000..190a18037c --- /dev/null +++ b/tests/perf_bench/core_import_mpy_single.py.exp @@ -0,0 +1 @@ +123 diff --git a/tests/perf_bench/core_qstr.py b/tests/perf_bench/core_qstr.py new file mode 100644 index 0000000000..b87e2c0658 --- /dev/null +++ b/tests/perf_bench/core_qstr.py @@ -0,0 +1,21 @@ +# This tests qstr_find_strn() speed when the string being searched for is not found. + + +def test(r): + for _ in r: + str("a string that shouldn't be interned") + + +########################################################################### +# Benchmark interface + +bm_params = { + (100, 10): (400,), + (1000, 10): (4000,), + (5000, 10): (40000,), +} + + +def bm_setup(params): + (nloop,) = params + return lambda: test(range(nloop)), lambda: (nloop // 100, None) From a434705700c18544edbbcabc714a5bf507847eb4 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 11 Feb 2022 13:42:00 +1100 Subject: [PATCH 0124/1712] tests/perf_bench: Add perf test for yield-from execution. Signed-off-by: Damien George --- tests/perf_bench/core_yield_from.py | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/perf_bench/core_yield_from.py diff --git a/tests/perf_bench/core_yield_from.py b/tests/perf_bench/core_yield_from.py new file mode 100644 index 0000000000..2f6930e2b8 --- /dev/null +++ b/tests/perf_bench/core_yield_from.py @@ -0,0 +1,31 @@ +# Test a deep set of "yield from" statements. + + +def recursive_yield_from(depth, iter_): + if depth <= 0: + for i in iter_: + yield i + else: + yield from recursive_yield_from(depth - 1, iter_) + + +def test(n): + global result + result = 0 + for i in recursive_yield_from(10, range(n)): + result += i + + +########################################################################### +# Benchmark interface + +bm_params = { + (100, 10): (2000,), + (1000, 10): (20000,), + (5000, 10): (100000,), +} + + +def bm_setup(params): + (nloop,) = params + return lambda: test(nloop), lambda: (nloop // 100, result) From e8bc4a3a5be12ad639b811852337c63e8f1d6277 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 11 Feb 2022 22:19:38 +1100 Subject: [PATCH 0125/1712] tests/run-perfbench.py: Use SKIP consistently, and increase print width. A script will print "SKIP" if it wants to be skipped, so the test runner must also use uppercase SKIP. Signed-off-by: Damien George --- tests/run-perfbench.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/run-perfbench.py b/tests/run-perfbench.py index fccb7a7684..c143ae32f9 100755 --- a/tests/run-perfbench.py +++ b/tests/run-perfbench.py @@ -100,7 +100,7 @@ def run_benchmarks(target, param_n, param_m, n_average, test_list): and test_file.find("viper_") != -1 ) if skip: - print("skip") + print("SKIP") continue # Create test script @@ -171,7 +171,7 @@ def parse_output(filename): m = int(m.split("=")[1]) data = [] for l in f: - if l.find(": ") != -1 and l.find(": skip") == -1 and l.find("CRASH: ") == -1: + if l.find(": ") != -1 and l.find(": SKIP") == -1 and l.find("CRASH: ") == -1: name, values = l.strip().split(": ") values = tuple(float(v) for v in values.split()) data.append((name,) + values) @@ -193,7 +193,7 @@ def compute_diff(file1, file2, diff_score): else: hdr = "N={} M={} vs N={} M={}".format(n1, m1, n2, m2) print( - "{:24} {:>10} -> {:>10} {:>10} {:>7}% (error%)".format( + "{:26} {:>10} -> {:>10} {:>10} {:>7}% (error%)".format( hdr, file1, file2, "diff", "diff" ) ) @@ -214,7 +214,7 @@ def compute_diff(file1, file2, diff_score): percent = 100 * av_diff / av1 percent_sd = 100 * sd_diff / av1 print( - "{:24} {:10.2f} -> {:10.2f} : {:+10.2f} = {:+7.3f}% (+/-{:.2f}%)".format( + "{:26} {:10.2f} -> {:10.2f} : {:+10.2f} = {:+7.3f}% (+/-{:.2f}%)".format( name, av1, av2, av_diff, percent, percent_sd ) ) From 18b1ba086c0e5547ca81030bf13b026961f80720 Mon Sep 17 00:00:00 2001 From: Artyom Skrobov Date: Mon, 3 May 2021 14:17:36 -0400 Subject: [PATCH 0126/1712] py/qstr: Separate hash and len from string data. This allows the compiler to merge strings: e.g. "update", "difference_update" and "symmetric_difference_update" will all point to the same memory. No functional change. The size reduction depends on the number of qstrs in the build. The change this commit brings is: bare-arm: -4 -0.007% minimal x86: +150 +0.092% [incl +48(data)] unix x64: -608 -0.118% unix nanbox: -572 -0.126% [incl +32(data)] stm32: -1392 -0.352% PYBV10 cc3200: -448 -0.244% esp8266: -1208 -0.173% GENERIC esp32: -1028 -0.068% GENERIC[incl -1020(data)] nrf: -440 -0.252% pca10040 rp2: -1072 -0.217% PICO samd: -368 -0.264% ADAFRUIT_ITSYBITSY_M4_EXPRESS Performance is also improved (on bare metal at least) for the core_import_mpy_multi.py, core_import_mpy_single.py and core_qstr.py performance benchmarks. Originally at adafruit#4583 Signed-off-by: Artyom Skrobov --- py/makeqstrdata.py | 29 +++++----- py/mpstate.h | 2 +- py/qstr.c | 132 +++++++++++++++++++++++---------------------- py/qstr.h | 22 +++++++- tools/mpy-tool.py | 29 +++++++--- 5 files changed, 121 insertions(+), 93 deletions(-) diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index 403c406888..e332ab94ed 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -317,26 +317,24 @@ def parse_input_headers(infiles): return qcfgs, qstrs +def escape_bytes(qstr, qbytes): + if all(32 <= ord(c) <= 126 and c != "\\" and c != '"' for c in qstr): + # qstr is all printable ASCII so render it as-is (for easier debugging) + return qstr + else: + # qstr contains non-printable codes so render entire thing as hex pairs + return "".join(("\\x%02x" % b) for b in qbytes) + + def make_bytes(cfg_bytes_len, cfg_bytes_hash, qstr): qbytes = bytes_cons(qstr, "utf8") qlen = len(qbytes) qhash = compute_hash(qbytes, cfg_bytes_hash) - if all(32 <= ord(c) <= 126 and c != "\\" and c != '"' for c in qstr): - # qstr is all printable ASCII so render it as-is (for easier debugging) - qdata = qstr - else: - # qstr contains non-printable codes so render entire thing as hex pairs - qdata = "".join(("\\x%02x" % b) for b in qbytes) if qlen >= (1 << (8 * cfg_bytes_len)): print("qstr is too long:", qstr) assert False - qlen_str = ("\\x%02x" * cfg_bytes_len) % tuple( - ((qlen >> (8 * i)) & 0xFF) for i in range(cfg_bytes_len) - ) - qhash_str = ("\\x%02x" * cfg_bytes_hash) % tuple( - ((qhash >> (8 * i)) & 0xFF) for i in range(cfg_bytes_hash) - ) - return '(const byte*)"%s%s" "%s"' % (qhash_str, qlen_str, qdata) + qdata = escape_bytes(qstr, qbytes) + return '%d, %d, "%s"' % (qhash, qlen, qdata) def print_qstr_data(qcfgs, qstrs): @@ -349,10 +347,7 @@ def print_qstr_data(qcfgs, qstrs): print("") # add NULL qstr with no hash or data - print( - 'QDEF(MP_QSTRnull, (const byte*)"%s%s" "")' - % ("\\x00" * cfg_bytes_hash, "\\x00" * cfg_bytes_len) - ) + print('QDEF(MP_QSTRnull, 0, 0, "")') # go through each qstr and print it out for order, ident, qstr in sorted(qstrs.values(), key=lambda x: x[0]): diff --git a/py/mpstate.h b/py/mpstate.h index 8ece151663..7f86399f57 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -202,7 +202,7 @@ typedef struct _mp_state_vm_t { // pointer and sizes to store interned string data // (qstr_last_chunk can be root pointer but is also stored in qstr pool) - byte *qstr_last_chunk; + char *qstr_last_chunk; size_t qstr_last_alloc; size_t qstr_last_used; diff --git a/py/qstr.c b/py/qstr.c index e5b13b700d..848a583304 100644 --- a/py/qstr.c +++ b/py/qstr.c @@ -35,7 +35,6 @@ // NOTE: we are using linear arrays to store and search for qstr's (unique strings, interned strings) // ultimately we will replace this with a static hash table of some kind -// also probably need to include the length in the string data, to allow null bytes in the string #if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_printf DEBUG_printf @@ -44,34 +43,9 @@ #endif // A qstr is an index into the qstr pool. -// The data for a qstr contains (hash, length, data): -// - hash (configurable number of bytes) -// - length (configurable number of bytes) -// - data ("length" number of bytes) -// - \0 terminated (so they can be printed using printf) +// The data for a qstr is \0 terminated (so they can be printed using printf) -#if MICROPY_QSTR_BYTES_IN_HASH == 1 - #define Q_HASH_MASK (0xff) - #define Q_GET_HASH(q) ((mp_uint_t)(q)[0]) - #define Q_SET_HASH(q, hash) do { (q)[0] = (hash); } while (0) -#elif MICROPY_QSTR_BYTES_IN_HASH == 2 - #define Q_HASH_MASK (0xffff) - #define Q_GET_HASH(q) ((mp_uint_t)(q)[0] | ((mp_uint_t)(q)[1] << 8)) - #define Q_SET_HASH(q, hash) do { (q)[0] = (hash); (q)[1] = (hash) >> 8; } while (0) -#else - #error unimplemented qstr hash decoding -#endif -#define Q_GET_ALLOC(q) (MICROPY_QSTR_BYTES_IN_HASH + MICROPY_QSTR_BYTES_IN_LEN + Q_GET_LENGTH(q) + 1) -#define Q_GET_DATA(q) ((q) + MICROPY_QSTR_BYTES_IN_HASH + MICROPY_QSTR_BYTES_IN_LEN) -#if MICROPY_QSTR_BYTES_IN_LEN == 1 - #define Q_GET_LENGTH(q) ((q)[MICROPY_QSTR_BYTES_IN_HASH]) - #define Q_SET_LENGTH(q, len) do { (q)[MICROPY_QSTR_BYTES_IN_HASH] = (len); } while (0) -#elif MICROPY_QSTR_BYTES_IN_LEN == 2 - #define Q_GET_LENGTH(q) ((q)[MICROPY_QSTR_BYTES_IN_HASH] | ((q)[MICROPY_QSTR_BYTES_IN_HASH + 1] << 8)) - #define Q_SET_LENGTH(q, len) do { (q)[MICROPY_QSTR_BYTES_IN_HASH] = (len); (q)[MICROPY_QSTR_BYTES_IN_HASH + 1] = (len) >> 8; } while (0) -#else - #error unimplemented qstr length decoding -#endif +#define Q_HASH_MASK ((1 << (8 * MICROPY_QSTR_BYTES_IN_HASH)) - 1) #if MICROPY_PY_THREAD && !MICROPY_PY_THREAD_GIL #define QSTR_ENTER() mp_thread_mutex_lock(&MP_STATE_VM(qstr_mutex), 1) @@ -100,14 +74,32 @@ mp_uint_t qstr_compute_hash(const byte *data, size_t len) { return hash; } +const qstr_hash_t mp_qstr_const_hashes[] = { + #ifndef NO_QSTR +#define QDEF(id, hash, len, str) hash, + #include "genhdr/qstrdefs.generated.h" +#undef QDEF + #endif +}; + +const qstr_len_t mp_qstr_const_lengths[] = { + #ifndef NO_QSTR +#define QDEF(id, hash, len, str) len, + #include "genhdr/qstrdefs.generated.h" +#undef QDEF + #endif +}; + const qstr_pool_t mp_qstr_const_pool = { NULL, // no previous pool 0, // no previous pool MICROPY_ALLOC_QSTR_ENTRIES_INIT, MP_QSTRnumber_of, // corresponds to number of strings in array just below + (qstr_hash_t *)mp_qstr_const_hashes, + (qstr_len_t *)mp_qstr_const_lengths, { #ifndef NO_QSTR -#define QDEF(id, str) str, +#define QDEF(id, hash, len, str) str, #include "genhdr/qstrdefs.generated.h" #undef QDEF #endif @@ -130,19 +122,21 @@ void qstr_init(void) { #endif } -STATIC const byte *find_qstr(qstr q) { +STATIC qstr_pool_t *find_qstr(qstr *q) { // search pool for this qstr // total_prev_len==0 in the final pool, so the loop will always terminate qstr_pool_t *pool = MP_STATE_VM(last_pool); - while (q < pool->total_prev_len) { + while (*q < pool->total_prev_len) { pool = pool->prev; } - return pool->qstrs[q - pool->total_prev_len]; + *q -= pool->total_prev_len; + assert(*q < pool->len); + return pool; } // qstr_mutex must be taken while in this function -STATIC qstr qstr_add(const byte *q_ptr) { - DEBUG_printf("QSTR: add hash=%d len=%d data=%.*s\n", Q_GET_HASH(q_ptr), Q_GET_LENGTH(q_ptr), Q_GET_LENGTH(q_ptr), Q_GET_DATA(q_ptr)); +STATIC qstr qstr_add(mp_uint_t hash, mp_uint_t len, const char *q_ptr) { + DEBUG_printf("QSTR: add hash=%d len=%d data=%.*s\n", hash, len, len, q_ptr); // make sure we have room in the pool for a new qstr if (MP_STATE_VM(last_pool)->len >= MP_STATE_VM(last_pool)->alloc) { @@ -151,7 +145,9 @@ STATIC qstr qstr_add(const byte *q_ptr) { // Put a lower bound on the allocation size in case the extra qstr pool has few entries new_alloc = MAX(MICROPY_ALLOC_QSTR_ENTRIES_INIT, new_alloc); #endif - qstr_pool_t *pool = m_new_obj_var_maybe(qstr_pool_t, const char *, new_alloc); + mp_uint_t pool_size = sizeof(qstr_pool_t) + + (sizeof(const char *) + sizeof(qstr_hash_t) + sizeof(qstr_len_t)) * new_alloc; + qstr_pool_t *pool = (qstr_pool_t *)m_malloc_maybe(pool_size); if (pool == NULL) { // Keep qstr_last_chunk consistent with qstr_pool_t: qstr_last_chunk is not scanned // at garbage collection since it's reachable from a qstr_pool_t. And the caller of @@ -162,6 +158,8 @@ STATIC qstr qstr_add(const byte *q_ptr) { QSTR_EXIT(); m_malloc_fail(new_alloc); } + pool->hashes = (qstr_hash_t *)(pool->qstrs + new_alloc); + pool->lengths = (qstr_len_t *)(pool->hashes + new_alloc); pool->prev = MP_STATE_VM(last_pool); pool->total_prev_len = MP_STATE_VM(last_pool)->total_prev_len + MP_STATE_VM(last_pool)->len; pool->alloc = new_alloc; @@ -171,10 +169,14 @@ STATIC qstr qstr_add(const byte *q_ptr) { } // add the new qstr - MP_STATE_VM(last_pool)->qstrs[MP_STATE_VM(last_pool)->len++] = q_ptr; + mp_uint_t at = MP_STATE_VM(last_pool)->len; + MP_STATE_VM(last_pool)->hashes[at] = hash; + MP_STATE_VM(last_pool)->lengths[at] = len; + MP_STATE_VM(last_pool)->qstrs[at] = q_ptr; + MP_STATE_VM(last_pool)->len++; // return id for the newly-added qstr - return MP_STATE_VM(last_pool)->total_prev_len + MP_STATE_VM(last_pool)->len - 1; + return MP_STATE_VM(last_pool)->total_prev_len + at; } qstr qstr_find_strn(const char *str, size_t str_len) { @@ -183,9 +185,10 @@ qstr qstr_find_strn(const char *str, size_t str_len) { // search pools for the data for (qstr_pool_t *pool = MP_STATE_VM(last_pool); pool != NULL; pool = pool->prev) { - for (const byte **q = pool->qstrs, **q_top = pool->qstrs + pool->len; q < q_top; q++) { - if (Q_GET_HASH(*q) == str_hash && Q_GET_LENGTH(*q) == str_len && memcmp(Q_GET_DATA(*q), str, str_len) == 0) { - return pool->total_prev_len + (q - pool->qstrs); + for (mp_uint_t at = 0, top = pool->len; at < top; at++) { + if (pool->hashes[at] == str_hash && pool->lengths[at] == str_len + && memcmp(pool->qstrs[at], str, str_len) == 0) { + return pool->total_prev_len + at; } } } @@ -211,14 +214,14 @@ qstr qstr_from_strn(const char *str, size_t len) { } // compute number of bytes needed to intern this string - size_t n_bytes = MICROPY_QSTR_BYTES_IN_HASH + MICROPY_QSTR_BYTES_IN_LEN + len + 1; + size_t n_bytes = len + 1; if (MP_STATE_VM(qstr_last_chunk) != NULL && MP_STATE_VM(qstr_last_used) + n_bytes > MP_STATE_VM(qstr_last_alloc)) { // not enough room at end of previously interned string so try to grow - byte *new_p = m_renew_maybe(byte, MP_STATE_VM(qstr_last_chunk), MP_STATE_VM(qstr_last_alloc), MP_STATE_VM(qstr_last_alloc) + n_bytes, false); + char *new_p = m_renew_maybe(char, MP_STATE_VM(qstr_last_chunk), MP_STATE_VM(qstr_last_alloc), MP_STATE_VM(qstr_last_alloc) + n_bytes, false); if (new_p == NULL) { // could not grow existing memory; shrink it to fit previous - (void)m_renew_maybe(byte, MP_STATE_VM(qstr_last_chunk), MP_STATE_VM(qstr_last_alloc), MP_STATE_VM(qstr_last_used), false); + (void)m_renew_maybe(char, MP_STATE_VM(qstr_last_chunk), MP_STATE_VM(qstr_last_alloc), MP_STATE_VM(qstr_last_used), false); MP_STATE_VM(qstr_last_chunk) = NULL; } else { // could grow existing memory @@ -232,10 +235,10 @@ qstr qstr_from_strn(const char *str, size_t len) { if (al < MICROPY_ALLOC_QSTR_CHUNK_INIT) { al = MICROPY_ALLOC_QSTR_CHUNK_INIT; } - MP_STATE_VM(qstr_last_chunk) = m_new_maybe(byte, al); + MP_STATE_VM(qstr_last_chunk) = m_new_maybe(char, al); if (MP_STATE_VM(qstr_last_chunk) == NULL) { // failed to allocate a large chunk so try with exact size - MP_STATE_VM(qstr_last_chunk) = m_new_maybe(byte, n_bytes); + MP_STATE_VM(qstr_last_chunk) = m_new_maybe(char, n_bytes); if (MP_STATE_VM(qstr_last_chunk) == NULL) { QSTR_EXIT(); m_malloc_fail(n_bytes); @@ -247,40 +250,38 @@ qstr qstr_from_strn(const char *str, size_t len) { } // allocate memory from the chunk for this new interned string's data - byte *q_ptr = MP_STATE_VM(qstr_last_chunk) + MP_STATE_VM(qstr_last_used); + char *q_ptr = MP_STATE_VM(qstr_last_chunk) + MP_STATE_VM(qstr_last_used); MP_STATE_VM(qstr_last_used) += n_bytes; // store the interned strings' data mp_uint_t hash = qstr_compute_hash((const byte *)str, len); - Q_SET_HASH(q_ptr, hash); - Q_SET_LENGTH(q_ptr, len); - memcpy(q_ptr + MICROPY_QSTR_BYTES_IN_HASH + MICROPY_QSTR_BYTES_IN_LEN, str, len); - q_ptr[MICROPY_QSTR_BYTES_IN_HASH + MICROPY_QSTR_BYTES_IN_LEN + len] = '\0'; - q = qstr_add(q_ptr); + memcpy(q_ptr, str, len); + q_ptr[len] = '\0'; + q = qstr_add(hash, len, q_ptr); } QSTR_EXIT(); return q; } mp_uint_t qstr_hash(qstr q) { - const byte *qd = find_qstr(q); - return Q_GET_HASH(qd); + qstr_pool_t *pool = find_qstr(&q); + return pool->hashes[q]; } size_t qstr_len(qstr q) { - const byte *qd = find_qstr(q); - return Q_GET_LENGTH(qd); + qstr_pool_t *pool = find_qstr(&q); + return pool->lengths[q]; } const char *qstr_str(qstr q) { - const byte *qd = find_qstr(q); - return (const char *)Q_GET_DATA(qd); + qstr_pool_t *pool = find_qstr(&q); + return pool->qstrs[q]; } const byte *qstr_data(qstr q, size_t *len) { - const byte *qd = find_qstr(q); - *len = Q_GET_LENGTH(qd); - return Q_GET_DATA(qd); + qstr_pool_t *pool = find_qstr(&q); + *len = pool->lengths[q]; + return (byte *)pool->qstrs[q]; } void qstr_pool_info(size_t *n_pool, size_t *n_qstr, size_t *n_str_data_bytes, size_t *n_total_bytes) { @@ -292,13 +293,14 @@ void qstr_pool_info(size_t *n_pool, size_t *n_qstr, size_t *n_str_data_bytes, si for (qstr_pool_t *pool = MP_STATE_VM(last_pool); pool != NULL && pool != &CONST_POOL; pool = pool->prev) { *n_pool += 1; *n_qstr += pool->len; - for (const byte **q = pool->qstrs, **q_top = pool->qstrs + pool->len; q < q_top; q++) { - *n_str_data_bytes += Q_GET_ALLOC(*q); + for (qstr_len_t *l = pool->lengths, *l_top = pool->lengths + pool->len; l < l_top; l++) { + *n_str_data_bytes += *l + 1; } #if MICROPY_ENABLE_GC *n_total_bytes += gc_nbytes(pool); // this counts actual bytes used in heap #else - *n_total_bytes += sizeof(qstr_pool_t) + sizeof(qstr) * pool->alloc; + *n_total_bytes += sizeof(qstr_pool_t) + + (sizeof(const char *) + sizeof(qstr_hash_t) + sizeof(qstr_len_t)) * pool->alloc; #endif } *n_total_bytes += *n_str_data_bytes; @@ -309,8 +311,8 @@ void qstr_pool_info(size_t *n_pool, size_t *n_qstr, size_t *n_str_data_bytes, si void qstr_dump_data(void) { QSTR_ENTER(); for (qstr_pool_t *pool = MP_STATE_VM(last_pool); pool != NULL && pool != &CONST_POOL; pool = pool->prev) { - for (const byte **q = pool->qstrs, **q_top = pool->qstrs + pool->len; q < q_top; q++) { - mp_printf(&mp_plat_print, "Q(%s)\n", Q_GET_DATA(*q)); + for (const char **q = pool->qstrs, **q_top = pool->qstrs + pool->len; q < q_top; q++) { + mp_printf(&mp_plat_print, "Q(%s)\n", *q); } } QSTR_EXIT(); diff --git a/py/qstr.h b/py/qstr.h index 0b6fb12b08..19672afc0d 100644 --- a/py/qstr.h +++ b/py/qstr.h @@ -38,7 +38,7 @@ // first entry in enum will be MP_QSTRnull=0, which indicates invalid/no qstr enum { #ifndef NO_QSTR -#define QDEF(id, str) id, +#define QDEF(id, hash, len, str) id, #include "genhdr/qstrdefs.generated.h" #undef QDEF #endif @@ -47,12 +47,30 @@ enum { typedef size_t qstr; +#if MICROPY_QSTR_BYTES_IN_HASH == 1 +typedef uint8_t qstr_hash_t; +#elif MICROPY_QSTR_BYTES_IN_HASH == 2 +typedef uint16_t qstr_hash_t; +#else +#error unimplemented qstr hash decoding +#endif + +#if MICROPY_QSTR_BYTES_IN_LEN == 1 +typedef uint8_t qstr_len_t; +#elif MICROPY_QSTR_BYTES_IN_LEN == 2 +typedef uint16_t qstr_len_t; +#else +#error unimplemented qstr length decoding +#endif + typedef struct _qstr_pool_t { struct _qstr_pool_t *prev; size_t total_prev_len; size_t alloc; size_t len; - const byte *qstrs[]; + qstr_hash_t *hashes; + qstr_len_t *lengths; + const char *qstrs[]; } qstr_pool_t; #define QSTR_TOTAL() (MP_STATE_VM(last_pool)->total_prev_len + MP_STATE_VM(last_pool)->len) diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index aa0272111c..337f580b6e 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -814,7 +814,7 @@ def freeze_mpy(base_qstrs, raw_codes): # don't add duplicates if q is None or q.qstr_esc in base_qstrs or q.qstr_esc in new: continue - new[q.qstr_esc] = (len(new), q.qstr_esc, q.str) + new[q.qstr_esc] = (len(new), q.qstr_esc, q.str, bytes_cons(q.str, "utf8")) new = sorted(new.values(), key=lambda x: x[0]) print('#include "py/mpconfig.h"') @@ -864,6 +864,22 @@ def freeze_mpy(base_qstrs, raw_codes): # As in qstr.c, set so that the first dynamically allocated pool is twice this size; must be <= the len qstr_pool_alloc = min(len(new), 10) + print() + print("const qstr_hash_t mp_qstr_frozen_const_hashes[] = {") + qstr_size = {"metadata": 0, "data": 0} + for _, _, _, qbytes in new: + qhash = qstrutil.compute_hash(qbytes, config.MICROPY_QSTR_BYTES_IN_HASH) + print(" %d," % qhash) + print("};") + print() + print("const qstr_len_t mp_qstr_frozen_const_lengths[] = {") + for _, _, _, qbytes in new: + print(" %d," % len(qbytes)) + qstr_size["metadata"] += ( + config.MICROPY_QSTR_BYTES_IN_LEN + config.MICROPY_QSTR_BYTES_IN_HASH + ) + qstr_size["data"] += len(qbytes) + print("};") print() print("extern const qstr_pool_t mp_qstr_const_pool;") print("const qstr_pool_t mp_qstr_frozen_const_pool = {") @@ -871,14 +887,11 @@ def freeze_mpy(base_qstrs, raw_codes): print(" MP_QSTRnumber_of, // previous pool size") print(" %u, // allocated entries" % qstr_pool_alloc) print(" %u, // used entries" % len(new)) + print(" (qstr_hash_t *)mp_qstr_frozen_const_hashes,") + print(" (qstr_len_t *)mp_qstr_frozen_const_lengths,") print(" {") - for _, _, qstr in new: - print( - " %s," - % qstrutil.make_bytes( - config.MICROPY_QSTR_BYTES_IN_LEN, config.MICROPY_QSTR_BYTES_IN_HASH, qstr - ) - ) + for _, _, qstr, qbytes in new: + print(' "%s",' % qstrutil.escape_bytes(qstr, qbytes)) print(" },") print("};") From f46a7140f55a8f6d80f9c2d5f8db7af3de116794 Mon Sep 17 00:00:00 2001 From: Artyom Skrobov Date: Tue, 4 May 2021 03:35:45 -0400 Subject: [PATCH 0127/1712] py/qstr: Use `const` consistently to avoid a cast. Originally at adafruit#4707 Signed-off-by: Artyom Skrobov --- py/qstr.c | 20 ++++++++++---------- py/qstr.h | 2 +- tools/mpy-tool.py | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/py/qstr.c b/py/qstr.c index 848a583304..f9ca106837 100644 --- a/py/qstr.c +++ b/py/qstr.c @@ -122,10 +122,10 @@ void qstr_init(void) { #endif } -STATIC qstr_pool_t *find_qstr(qstr *q) { +STATIC const qstr_pool_t *find_qstr(qstr *q) { // search pool for this qstr // total_prev_len==0 in the final pool, so the loop will always terminate - qstr_pool_t *pool = MP_STATE_VM(last_pool); + const qstr_pool_t *pool = MP_STATE_VM(last_pool); while (*q < pool->total_prev_len) { pool = pool->prev; } @@ -184,7 +184,7 @@ qstr qstr_find_strn(const char *str, size_t str_len) { mp_uint_t str_hash = qstr_compute_hash((const byte *)str, str_len); // search pools for the data - for (qstr_pool_t *pool = MP_STATE_VM(last_pool); pool != NULL; pool = pool->prev) { + for (const qstr_pool_t *pool = MP_STATE_VM(last_pool); pool != NULL; pool = pool->prev) { for (mp_uint_t at = 0, top = pool->len; at < top; at++) { if (pool->hashes[at] == str_hash && pool->lengths[at] == str_len && memcmp(pool->qstrs[at], str, str_len) == 0) { @@ -264,22 +264,22 @@ qstr qstr_from_strn(const char *str, size_t len) { } mp_uint_t qstr_hash(qstr q) { - qstr_pool_t *pool = find_qstr(&q); + const qstr_pool_t *pool = find_qstr(&q); return pool->hashes[q]; } size_t qstr_len(qstr q) { - qstr_pool_t *pool = find_qstr(&q); + const qstr_pool_t *pool = find_qstr(&q); return pool->lengths[q]; } const char *qstr_str(qstr q) { - qstr_pool_t *pool = find_qstr(&q); + const qstr_pool_t *pool = find_qstr(&q); return pool->qstrs[q]; } const byte *qstr_data(qstr q, size_t *len) { - qstr_pool_t *pool = find_qstr(&q); + const qstr_pool_t *pool = find_qstr(&q); *len = pool->lengths[q]; return (byte *)pool->qstrs[q]; } @@ -290,7 +290,7 @@ void qstr_pool_info(size_t *n_pool, size_t *n_qstr, size_t *n_str_data_bytes, si *n_qstr = 0; *n_str_data_bytes = 0; *n_total_bytes = 0; - for (qstr_pool_t *pool = MP_STATE_VM(last_pool); pool != NULL && pool != &CONST_POOL; pool = pool->prev) { + for (const qstr_pool_t *pool = MP_STATE_VM(last_pool); pool != NULL && pool != &CONST_POOL; pool = pool->prev) { *n_pool += 1; *n_qstr += pool->len; for (qstr_len_t *l = pool->lengths, *l_top = pool->lengths + pool->len; l < l_top; l++) { @@ -310,8 +310,8 @@ void qstr_pool_info(size_t *n_pool, size_t *n_qstr, size_t *n_str_data_bytes, si #if MICROPY_PY_MICROPYTHON_MEM_INFO void qstr_dump_data(void) { QSTR_ENTER(); - for (qstr_pool_t *pool = MP_STATE_VM(last_pool); pool != NULL && pool != &CONST_POOL; pool = pool->prev) { - for (const char **q = pool->qstrs, **q_top = pool->qstrs + pool->len; q < q_top; q++) { + for (const qstr_pool_t *pool = MP_STATE_VM(last_pool); pool != NULL && pool != &CONST_POOL; pool = pool->prev) { + for (const char *const *q = pool->qstrs, *const *q_top = pool->qstrs + pool->len; q < q_top; q++) { mp_printf(&mp_plat_print, "Q(%s)\n", *q); } } diff --git a/py/qstr.h b/py/qstr.h index 19672afc0d..ded105760c 100644 --- a/py/qstr.h +++ b/py/qstr.h @@ -64,7 +64,7 @@ typedef uint16_t qstr_len_t; #endif typedef struct _qstr_pool_t { - struct _qstr_pool_t *prev; + const struct _qstr_pool_t *prev; size_t total_prev_len; size_t alloc; size_t len; diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index 337f580b6e..58a4a75c91 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -883,7 +883,7 @@ def freeze_mpy(base_qstrs, raw_codes): print() print("extern const qstr_pool_t mp_qstr_const_pool;") print("const qstr_pool_t mp_qstr_frozen_const_pool = {") - print(" (qstr_pool_t*)&mp_qstr_const_pool, // previous pool") + print(" &mp_qstr_const_pool, // previous pool") print(" MP_QSTRnumber_of, // previous pool size") print(" %u, // allocated entries" % qstr_pool_alloc) print(" %u, // used entries" % len(new)) From 2ea21abae0358a46c0144f014f2e5891afe03dfd Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 12 Feb 2022 01:03:39 +1100 Subject: [PATCH 0128/1712] tests/extmod/vfs_fat_finaliser.py: Make finalisation more robust. Signed-off-by: Damien George --- tests/extmod/vfs_fat_finaliser.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/extmod/vfs_fat_finaliser.py b/tests/extmod/vfs_fat_finaliser.py index b67afc2d94..b38e640c73 100644 --- a/tests/extmod/vfs_fat_finaliser.py +++ b/tests/extmod/vfs_fat_finaliser.py @@ -56,6 +56,12 @@ micropython.heap_unlock() # Here we test that the finaliser is actually called during a garbage collection. import gc +# Preallocate global variables, and list of filenames for the test (which may +# in turn allocate new qstrs and/or a new qstr pool). +f = None +n = None +names = ["x%d" % i for i in range(4)] + # Do a large number of single-block allocations to move the GC head forwards, # ensuring that the files are allocated from never-before-used blocks and # therefore couldn't possibly have any references to them left behind on @@ -63,14 +69,13 @@ import gc for i in range(1024): [] -N = 4 -for i in range(N): - n = "x%d" % i +# Run the test: create files without closing them, run GC, then read back files. +for n in names: f = vfs.open(n, "w") f.write(n) f = None # release f without closing - [0, 1, 2, 3] # use up Python stack so f is really gone + sorted([0, 1, 2, 3], key=lambda x: x) # use up Python and C stack so f is really gone gc.collect() # should finalise all N files by closing them -for i in range(N): - with vfs.open("x%d" % i, "r") as f: +for n in names: + with vfs.open(n, "r") as f: print(f.read()) From d1b18bb96c31f1e53494a483233d96bf6bac8cef Mon Sep 17 00:00:00 2001 From: Eric Rong Date: Mon, 14 Feb 2022 23:36:35 -0800 Subject: [PATCH 0129/1712] Add support for lilygo_t_display_rp2040 board --- .../boards/lilygo_t_display_rp2040/board.c | 153 ++++++++++++++++++ .../lilygo_t_display_rp2040/mpconfigboard.h | 2 + .../lilygo_t_display_rp2040/mpconfigboard.mk | 11 ++ .../pico-sdk-configboard.h | 1 + .../boards/lilygo_t_display_rp2040/pin.c | 60 +++++++ 5 files changed, 227 insertions(+) create mode 100644 ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c create mode 100644 ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/lilygo_t_display_rp2040/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c new file mode 100644 index 0000000000..c8d483ee4f --- /dev/null +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c @@ -0,0 +1,153 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "shared-bindings/microcontroller/Pin.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" + +displayio_fourwire_obj_t board_display_obj; + +#define DELAY 0x80 +#define PWR_EN 22 + +// display init sequence according to LilyGO example app +uint8_t display_init_sequence[] = { + // sw reset + 0x01, 0 | DELAY, 150, + // sleep out + 0x11, 0 | DELAY, 255, + // normal display mode on + 0x13, 0, + // display and color format settings + 0x36, 1, 0x08, + 0xB6, 2, 0x0A, 0x82, + 0x3A, 1 | DELAY, 0x55, 10, + // ST7789V frame rate setting + 0xB2, 5, 0x0C, 0x0C, 0x00, 0x33, 0x33, + // voltages: VGH / VGL + 0xB7, 1, 0x35, + // ST7789V power setting + 0xBB, 1, 0x28, + 0xC0, 1, 0x0C, + 0xC2, 2, 0x01, 0xFF, + 0xC3, 1, 0x10, + 0xC4, 1, 0x20, + 0xC6, 1, 0x0F, + 0xD0, 2, 0xA4, 0xA1, + // ST7789V gamma setting + 0xE0, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x32, 0x44, 0x42, 0x06, 0x0E, 0x12, 0x14, 0x17, + 0xE1, 14, 0xD0, 0x00, 0x02, 0x07, 0x0A, 0x28, 0x31, 0x54, 0x47, 0x0E, 0x1C, 0x17, 0x1B, 0x1E, + 0x21, 0, + // display on + 0x29, 0 | DELAY, 255, +}; + +static void display_init(void) { + busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + + common_hal_busio_spi_construct( + spi, + &pin_GPIO2, // CLK + &pin_GPIO3, // MOSI + NULL // MISO not connected + ); + + 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_GPIO1, // DC + &pin_GPIO5, // CS + NULL, // RST (Reset pin tie to 0, do not set here) + 40000000, // baudrate + 1, // 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) + 52, // column start + 40, // row start + 90, // rotation + 16, // color depth + false, // grayscale + false, // pixels in a byte share a row. Only valid for depths < 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 + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO4, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness (ignored) + false, // auto_brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + true, // backlight_on_high + false // SH1107_addressing + ); + + common_hal_never_reset_pin(&pin_GPIO4); // backlight pin +} + +void board_init(void) { + // Pin 22 has to be pulled high to turn on the LCD + const uint PWR_PIN = PWR_EN; + gpio_init(PWR_PIN); + gpio_set_dir(PWR_PIN, GPIO_OUT); + gpio_put(PWR_PIN, 1); + common_hal_never_reset_pin(&pin_GPIO22); + + // Display + display_init(); +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { +} \ No newline at end of file diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.h b/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.h new file mode 100644 index 0000000000..71a2485e4c --- /dev/null +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.h @@ -0,0 +1,2 @@ +#define MICROPY_HW_BOARD_NAME "LILYGO T-DISPLAY" +#define MICROPY_HW_MCU_NAME "rp2040" \ No newline at end of file diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.mk new file mode 100644 index 0000000000..33fbfdf622 --- /dev/null +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x303A +USB_PID = 0x8008 +USB_PRODUCT = "T-Display" +USB_MANUFACTURER = "Lilygo" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ" + +CIRCUITPY__EVE = 1 \ No newline at end of file diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/pico-sdk-configboard.h b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c new file mode 100644 index 0000000000..d2b8ba0a3d --- /dev/null +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c @@ -0,0 +1,60 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_L), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_R), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_GP29_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_GP29), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); \ No newline at end of file From dfa9b688b816f49ca5c3673b83c79bbb700a67d9 Mon Sep 17 00:00:00 2001 From: Eric Rong Date: Mon, 14 Feb 2022 23:40:44 -0800 Subject: [PATCH 0130/1712] Add new line to end of file --- ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c | 2 +- .../raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.h | 2 +- .../raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.mk | 2 +- ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c index c8d483ee4f..c4d353e0c7 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c @@ -150,4 +150,4 @@ void reset_board(void) { } void board_deinit(void) { -} \ No newline at end of file +} diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.h b/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.h index 71a2485e4c..757d1c08fc 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.h +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.h @@ -1,2 +1,2 @@ #define MICROPY_HW_BOARD_NAME "LILYGO T-DISPLAY" -#define MICROPY_HW_MCU_NAME "rp2040" \ No newline at end of file +#define MICROPY_HW_MCU_NAME "rp2040" diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.mk index 33fbfdf622..005429e0ff 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.mk +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.mk @@ -8,4 +8,4 @@ CHIP_FAMILY = rp2 EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ" -CIRCUITPY__EVE = 1 \ No newline at end of file +CIRCUITPY__EVE = 1 diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c index d2b8ba0a3d..a4a1df5333 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c @@ -57,4 +57,4 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_GP29), MP_ROM_PTR(&pin_GPIO29) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, }; -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); \ No newline at end of file +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 31fe42dba458e0b4a7cfa77d2b03e65897881a74 Mon Sep 17 00:00:00 2001 From: Eric Rong Date: Mon, 14 Feb 2022 23:58:15 -0800 Subject: [PATCH 0131/1712] clean up the pin.c with only breakout pins --- .../boards/lilygo_t_display_rp2040/pin.c | 32 ++----------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c index a4a1df5333..a91d8f9168 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c @@ -3,13 +3,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS - { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, - { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON_L), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, @@ -25,36 +18,15 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, - { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_GPIO22) }, { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, - { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, - { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, - - { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO26) }, - { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, - { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, - - { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, - { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, - - { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, - { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, - - { MP_ROM_QSTR(MP_QSTR_GP29_A3), MP_ROM_PTR(&pin_GPIO29) }, - { MP_ROM_QSTR(MP_QSTR_GP29), MP_ROM_PTR(&pin_GPIO29) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From f2e77aa021eca99024a2002578478c06b52d55f9 Mon Sep 17 00:00:00 2001 From: Eric Rong Date: Tue, 15 Feb 2022 01:43:57 -0800 Subject: [PATCH 0132/1712] correct pins.c name --- .../raspberrypi/boards/lilygo_t_display_rp2040/{pin.c => pins.c} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ports/raspberrypi/boards/lilygo_t_display_rp2040/{pin.c => pins.c} (100%) diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c similarity index 100% rename from ports/raspberrypi/boards/lilygo_t_display_rp2040/pin.c rename to ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c From ec342dc557ea00044b8efb1b8b932df38425ee1a Mon Sep 17 00:00:00 2001 From: Eric Rong Date: Tue, 15 Feb 2022 02:07:50 -0800 Subject: [PATCH 0133/1712] update includes --- ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c index c4d353e0c7..16043d4d7f 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c @@ -27,8 +27,11 @@ #include "supervisor/board.h" #include "mpconfigboard.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" +#include "supervisor/shared/board.h" displayio_fourwire_obj_t board_display_obj; From ce350cb353eafb700d666655358684b998f69f95 Mon Sep 17 00:00:00 2001 From: Eric Rong Date: Tue, 15 Feb 2022 02:23:26 -0800 Subject: [PATCH 0134/1712] Try to fix compilation error --- ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c index 16043d4d7f..125677e161 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c @@ -27,11 +27,8 @@ #include "supervisor/board.h" #include "mpconfigboard.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" -#include "supervisor/shared/board.h" displayio_fourwire_obj_t board_display_obj; @@ -77,8 +74,8 @@ static void display_init(void) { spi, &pin_GPIO2, // CLK &pin_GPIO3, // MOSI - NULL // MISO not connected - ); + NULL, // MISO not connected + false); // Not half-duplex common_hal_busio_spi_never_reset(spi); From ff4a4465af69de970f6b998dd5e2a53e9751a8de Mon Sep 17 00:00:00 2001 From: Eric Rong Date: Tue, 15 Feb 2022 22:01:35 -0800 Subject: [PATCH 0135/1712] pin definition cleanup --- .../boards/lilygo_t_display_rp2040/board.c | 4 +-- .../boards/lilygo_t_display_rp2040/pins.c | 35 ++++++++++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c index 125677e161..d99578984a 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c @@ -33,7 +33,7 @@ displayio_fourwire_obj_t board_display_obj; #define DELAY 0x80 -#define PWR_EN 22 +#define LCD_POWER 22 // display init sequence according to LilyGO example app uint8_t display_init_sequence[] = { @@ -132,7 +132,7 @@ static void display_init(void) { void board_init(void) { // Pin 22 has to be pulled high to turn on the LCD - const uint PWR_PIN = PWR_EN; + const uint PWR_PIN = LCD_POWER; gpio_init(PWR_PIN); gpio_set_dir(PWR_PIN, GPIO_OUT); gpio_put(PWR_PIN, 1); diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c index a91d8f9168..16ba17dba9 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c @@ -1,8 +1,15 @@ #include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_L), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, @@ -11,22 +18,48 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_TFT_POWER), MP_ROM_PTR(&pin_GPIO22) }, { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, + + // 1.14 inch LCD ST7789 + { MP_ROM_QSTR(MP_QSTR_LCD_MOSI), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CLK), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_LCD_RESET), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_LCD_BACKLIGHT), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) }, + + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, + + { 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_module_globals_table); From 18acd0318f927930dd7f9efd77f08d8e05a43ce8 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 17 Feb 2022 11:17:21 +1100 Subject: [PATCH 0136/1712] py/gc: Update debug code to compile with changes to qstr pool types. Following on from 18b1ba086c0e5547ca81030bf13b026961f80720 and f46a7140f55a8f6d80f9c2d5f8db7af3de116794. Signed-off-by: Damien George --- py/gc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/py/gc.c b/py/gc.c index a01d81abdc..0c1f3961df 100644 --- a/py/gc.c +++ b/py/gc.c @@ -920,13 +920,13 @@ void gc_dump_alloc_table(void) { // This code prints "Q" for qstr-pool data, and "q" for qstr-str // data. It can be useful to see how qstrs are being allocated, // but is disabled by default because it is very slow. - for (qstr_pool_t *pool = MP_STATE_VM(last_pool); c == 'h' && pool != NULL; pool = pool->prev) { - if ((qstr_pool_t *)ptr == pool) { + for (const qstr_pool_t *pool = MP_STATE_VM(last_pool); c == 'h' && pool != NULL; pool = pool->prev) { + if ((const qstr_pool_t *)ptr == pool) { c = 'Q'; break; } - for (const byte **q = pool->qstrs, **q_top = pool->qstrs + pool->len; q < q_top; q++) { - if ((const byte *)ptr == *q) { + for (const char *const *q = pool->qstrs, *const *q_top = pool->qstrs + pool->len; q < q_top; q++) { + if ((const char *)ptr == *q) { c = 'q'; break; } From 767058f3282bf4836e7b9f137bada3c0d8b717af Mon Sep 17 00:00:00 2001 From: YoungJoon Chun Date: Wed, 9 Feb 2022 20:58:56 +0900 Subject: [PATCH 0137/1712] rp2/Makefile: Add FROZEN_MANIFEST Makefile option, to override default. --- ports/rp2/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/rp2/Makefile b/ports/rp2/Makefile index 2af13bfbbf..2d1e6d6f5c 100644 --- a/ports/rp2/Makefile +++ b/ports/rp2/Makefile @@ -14,6 +14,10 @@ ifdef USER_C_MODULES CMAKE_ARGS += -DUSER_C_MODULES=${USER_C_MODULES} endif +ifneq ($(FROZEN_MANIFEST),) +CMAKE_ARGS += -DMICROPY_FROZEN_MANIFEST=${FROZEN_MANIFEST} +endif + all: [ -d $(BUILD) ] || cmake -S . -B $(BUILD) -DPICO_BUILD_DOCS=0 ${CMAKE_ARGS} $(MAKE) $(MAKESILENT) -C $(BUILD) From 0dfd0447fa6f24bb8ed62b35dbaf91695a255f43 Mon Sep 17 00:00:00 2001 From: Bradley Wogsland Date: Wed, 9 Feb 2022 10:52:02 +0100 Subject: [PATCH 0138/1712] README: Update link for ARM embedded toolchain to developer.arm.com. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d197924f0e..920f10a503 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,7 @@ The STM32 version The "stm32" port requires an ARM compiler, arm-none-eabi-gcc, and associated bin-utils. For those using Arch Linux, you need arm-none-eabi-binutils, arm-none-eabi-gcc and arm-none-eabi-newlib packages. Otherwise, try here: -https://launchpad.net/gcc-arm-embedded +https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm To build: From 28cb573b89f3d1edfff786f8ee757a93579c41bd Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 9 Feb 2022 10:26:35 -0600 Subject: [PATCH 0139/1712] windows/appveyor: Fix printing of test failures. In the `after_test` section, the current directory is `ports/windows` when tests are run, so running `run-tests.py` without changing the directory or specifying a path causes a file not found error. This commit fixes the problem by changing the directory before calling `run-tests.py`. Signed-off-by: David Lechner --- ports/windows/.appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/windows/.appveyor.yml b/ports/windows/.appveyor.yml index 739484f095..d7192236df 100644 --- a/ports/windows/.appveyor.yml +++ b/ports/windows/.appveyor.yml @@ -80,6 +80,7 @@ after_test: } C:\msys64\usr\bin\bash.exe -l -c "make V=1 test_full VARIANT=$($env:PyVariant)" if ($LASTEXITCODE -ne 0) { + cd (Join-Path $env:APPVEYOR_BUILD_FOLDER 'tests') & $env:MICROPY_CPYTHON3 run-tests.py --print-failures throw "Test failure" } From 5d6408f8f914f46f3c067fc59f5f31001b988fbc Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 9 Feb 2022 11:02:12 -0600 Subject: [PATCH 0140/1712] tools/verifygitlog.py: Ignore line length in body if it's a URL. This changes the git commit message line length check to ignore lines that contain URLs, since these cannot be wrapped without breaking tools that detect URLs and create a link. Signed-off-by: David Lechner --- tools/verifygitlog.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/verifygitlog.py b/tools/verifygitlog.py index cc4b80f4a9..ce36791256 100755 --- a/tools/verifygitlog.py +++ b/tools/verifygitlog.py @@ -69,7 +69,8 @@ def verify(sha): # Message body lines. for line in raw_body[2:]: - if len(line) >= 76: + # Long lines with URLs are exempt from the line length rule. + if len(line) >= 76 and "://" not in line: error("Message lines should be 75 or less characters: " + line) if not raw_body[-1].startswith("Signed-off-by: ") or "@" not in raw_body[-1]: From 465b74e78daf50f5bd92625ba57bf2f5597cb712 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Thu, 10 Feb 2022 22:30:01 +0200 Subject: [PATCH 0141/1712] drivers/ninaw10: Add NIC-level ioctl function. This commit adds support in the driver for irregular commands. It currently supports setting GPIO pin mode, and GPIO pin read/write value. --- drivers/ninaw10/nina_wifi_drv.c | 27 +++++++++++++++++++++++++++ drivers/ninaw10/nina_wifi_drv.h | 1 + extmod/network_ninaw10.c | 10 ++++++++++ 3 files changed, 38 insertions(+) diff --git a/drivers/ninaw10/nina_wifi_drv.c b/drivers/ninaw10/nina_wifi_drv.c index cf09711690..1ad77218b6 100644 --- a/drivers/ninaw10/nina_wifi_drv.c +++ b/drivers/ninaw10/nina_wifi_drv.c @@ -701,6 +701,33 @@ int nina_gethostbyname(const char *name, uint8_t *out_ip) { return 0; } +int nina_ioctl(uint32_t cmd, size_t len, uint8_t *buf, uint32_t iface) { + switch (cmd) { + case NINA_CMD_SET_PIN_MODE: + if (len != 2 || nina_send_command_read_ack(NINA_CMD_SET_PIN_MODE, + 2, ARG_8BITS, NINA_ARGS(ARG_BYTE(buf[0]), ARG_BYTE(buf[1]))) != SPI_ACK) { + return -1; + } + break; + case NINA_CMD_SET_DIGITAL_WRITE: + if (len != 2 || nina_send_command_read_ack(NINA_CMD_SET_DIGITAL_WRITE, + 2, ARG_8BITS, NINA_ARGS(ARG_BYTE(buf[0]), ARG_BYTE(buf[1]))) != SPI_ACK) { + return -1; + } + break; + case NINA_CMD_GET_DIGITAL_READ: + if (len != 1 || nina_send_command_read_vals(NINA_CMD_GET_DIGITAL_READ, + 1, ARG_8BITS, NINA_ARGS(ARG_BYTE(buf[0])), + 1, ARG_8BITS, NINA_VALS({(uint16_t *)&len, buf})) != 0) { + return -1; + } + break; + default: + return 0; + } + return 0; +} + int nina_socket_socket(uint8_t type) { uint16_t size = 1; uint8_t sock = 0; diff --git a/drivers/ninaw10/nina_wifi_drv.h b/drivers/ninaw10/nina_wifi_drv.h index b990476b67..4fe701eba1 100644 --- a/drivers/ninaw10/nina_wifi_drv.h +++ b/drivers/ninaw10/nina_wifi_drv.h @@ -100,6 +100,7 @@ int nina_get_rssi(void); int nina_fw_version(uint8_t *fw_ver); int nina_set_hostname(const char *name); int nina_gethostbyname(const char *name, uint8_t *out_ip); +int nina_ioctl(uint32_t cmd, size_t len, uint8_t *buf, uint32_t iface); int nina_socket_socket(uint8_t type); int nina_socket_close(int fd); int nina_socket_bind(int fd, uint8_t *ip, uint16_t port, int type); diff --git a/extmod/network_ninaw10.c b/extmod/network_ninaw10.c index e5d322a953..0340763073 100644 --- a/extmod/network_ninaw10.c +++ b/extmod/network_ninaw10.c @@ -317,6 +317,15 @@ STATIC mp_obj_t network_ninaw10_status(size_t n_args, const mp_obj_t *args) { } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(network_ninaw10_status_obj, 1, 2, network_ninaw10_status); +STATIC mp_obj_t network_ninaw10_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_t buf_in) { + nina_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_buffer_info_t buf; + mp_get_buffer_raise(buf_in, &buf, MP_BUFFER_READ | MP_BUFFER_WRITE); + nina_ioctl(mp_obj_get_int(cmd_in), buf.len, buf.buf, self->itf); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_3(network_ninaw10_ioctl_obj, network_ninaw10_ioctl); + STATIC int network_ninaw10_gethostbyname(mp_obj_t nic, const char *name, mp_uint_t len, uint8_t *out_ip) { return nina_gethostbyname(name, out_ip); } @@ -586,6 +595,7 @@ static const mp_rom_map_elem_t nina_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_ifconfig), MP_ROM_PTR(&network_ninaw10_ifconfig_obj) }, { MP_ROM_QSTR(MP_QSTR_config), MP_ROM_PTR(&network_ninaw10_config_obj) }, { MP_ROM_QSTR(MP_QSTR_status), MP_ROM_PTR(&network_ninaw10_status_obj) }, + { MP_ROM_QSTR(MP_QSTR_ioctl), MP_ROM_PTR(&network_ninaw10_ioctl_obj) }, // Network is not secured. { MP_ROM_QSTR(MP_QSTR_OPEN), MP_ROM_INT(NINA_SEC_OPEN) }, From 9c05f3aa1d201ba943c7852bee975f8b7d48e235 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Tue, 15 Feb 2022 18:02:09 +0100 Subject: [PATCH 0142/1712] drivers/sdcard: Allow setting the final SPI baudrate. This baudrate is supplied in the constructor. The default is 1320000 as before. Example: sd = sdcard.SDCard(spi, cs, baudrate=20_000_000) --- drivers/sdcard/sdcard.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/sdcard/sdcard.py b/drivers/sdcard/sdcard.py index 0ba3076a3d..2c3e99d3c0 100644 --- a/drivers/sdcard/sdcard.py +++ b/drivers/sdcard/sdcard.py @@ -39,7 +39,7 @@ _TOKEN_DATA = const(0xFE) class SDCard: - def __init__(self, spi, cs): + def __init__(self, spi, cs, baudrate=1320000): self.spi = spi self.cs = cs @@ -51,7 +51,7 @@ class SDCard: self.dummybuf_memoryview = memoryview(self.dummybuf) # initialise the card - self.init_card() + self.init_card(baudrate) def init_spi(self, baudrate): try: @@ -63,7 +63,8 @@ class SDCard: # on pyboard self.spi.init(master, baudrate=baudrate, phase=0, polarity=0) - def init_card(self): + def init_card(self, baudrate): + # init CS pin self.cs.init(self.cs.OUT, value=1) @@ -111,7 +112,7 @@ class SDCard: raise OSError("can't set 512 block size") # set to high data rate now that it's initialised - self.init_spi(1320000) + self.init_spi(baudrate) def init_card_v1(self): for i in range(_CMD_TIMEOUT): From 8bb50c6301f5b3df143fff7a425f284e88a0b64d Mon Sep 17 00:00:00 2001 From: stijn Date: Tue, 15 Feb 2022 10:16:46 +0100 Subject: [PATCH 0143/1712] unix/Makefile: Remove explicit addition of -std=c++ flag. This was added merely for building the C++ user module example, so it's a better fit to add it in the corresponding micropython.mk. --- examples/usercmodule/cppexample/micropython.mk | 2 +- ports/unix/Makefile | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/examples/usercmodule/cppexample/micropython.mk b/examples/usercmodule/cppexample/micropython.mk index e10d965a00..0071d4fcc7 100644 --- a/examples/usercmodule/cppexample/micropython.mk +++ b/examples/usercmodule/cppexample/micropython.mk @@ -6,7 +6,7 @@ SRC_USERMOD_CXX += $(CPPEXAMPLE_MOD_DIR)/example.cpp # Add our module directory to the include path. CFLAGS_USERMOD += -I$(CPPEXAMPLE_MOD_DIR) -CXXFLAGS_USERMOD += -I$(CPPEXAMPLE_MOD_DIR) +CXXFLAGS_USERMOD += -I$(CPPEXAMPLE_MOD_DIR) -std=c++11 # We use C++ features so have to link against the standard library. LDFLAGS_USERMOD += -lstdc++ diff --git a/ports/unix/Makefile b/ports/unix/Makefile index cd8bb379c4..7732211e2d 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -270,12 +270,6 @@ CFLAGS += -DMPZ_DIG_SIZE=16 # force 16 bits to work on both 32 and 64 bit archs CFLAGS += -DMICROPY_MODULE_FROZEN_STR endif -HASCPP17 = $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 7) -ifeq ($(HASCPP17), 1) - CXXFLAGS += -std=c++17 -else - CXXFLAGS += -std=c++11 -endif CXXFLAGS += $(filter-out -Wmissing-prototypes -Wold-style-definition -std=gnu99,$(CFLAGS) $(CXXFLAGS_MOD)) ifeq ($(MICROPY_FORCE_32BIT),1) From c14f47faa329ea3655aae3068956c138f7e9c178 Mon Sep 17 00:00:00 2001 From: stijn Date: Thu, 17 Feb 2022 12:44:42 +0100 Subject: [PATCH 0144/1712] windows/Makefile: Specify CXXFLAGS in the Makefile. Enables building user modules which use C++ code, like the unix port. --- ports/windows/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/windows/Makefile b/ports/windows/Makefile index 5a22be4642..91744b7a5e 100644 --- a/ports/windows/Makefile +++ b/ports/windows/Makefile @@ -91,6 +91,8 @@ ifneq ($(FROZEN_MANIFEST),) CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool -DMICROPY_MODULE_FROZEN_MPY=1 -DMPZ_DIG_SIZE=16 endif +CXXFLAGS += $(filter-out -std=gnu99,$(CFLAGS) $(CXXFLAGS_MOD)) + include $(TOP)/py/mkrules.mk .PHONY: test test_full From 130f7db1fc2a881647d727bc76a0ef40bd179e5c Mon Sep 17 00:00:00 2001 From: Christophe Priouzeau Date: Thu, 11 Feb 2021 12:00:26 +0100 Subject: [PATCH 0145/1712] stm32/boards/NUCLEO_WB55: Add Arduino pin alias definitions. Fixes issue #8295. Signed-off-by: Christophe Priouzeau --- ports/stm32/boards/NUCLEO_WB55/pins.csv | 52 +++++++++++-------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/ports/stm32/boards/NUCLEO_WB55/pins.csv b/ports/stm32/boards/NUCLEO_WB55/pins.csv index d7e0babf36..cc03a3f1f1 100644 --- a/ports/stm32/boards/NUCLEO_WB55/pins.csv +++ b/ports/stm32/boards/NUCLEO_WB55/pins.csv @@ -1,49 +1,41 @@ -,PA0 -,PA1 -,PA2 -,PA3 -,PA4 -,PA5 -,PA6 -,PA7 -,PA8 -,PA9 -,PA10 -,PA11 -,PA12 ,PA13 ,PA14 -,PA15 -,PB0 -,PB1 ,PB2 ,PB3 ,PB4 -,PB5 ,PB6 ,PB7 -,PB8 -,PB9 ,PB10 ,PB11 ,PB12 ,PB13 ,PB14 ,PB15 -,PC0 -,PC1 -,PC2 -,PC3 -,PC4 ,PC5 -,PC6 -,PC10 ,PC11 -,PC12 -,PC13 -,PD0 -,PD1 ,PE4 +A0,PC0 +A1,PC1 +A2,PA1 +A3,PA0 +A4,PC3 +A5,PC2 +D0,PA3 +D1,PA2 +D2,PC6 +D3,PA10 +D4,PC10 +D5,PA15 +D6,PA8 +D7,PC13 +D8,PC12 +D9,PA9 +D10,PA4 +D11,PA7 +D12,PA6 +D13,PA5 +D14,PB9 +D15,PB8 SW,PC4 SW1,PC4 SW2,PD0 From 2b62f1210392f405f6b8d3510c24c25c26a457a1 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 16 Feb 2022 22:18:39 +1100 Subject: [PATCH 0146/1712] stm32/mboot: Allow a board to fully configure system clocks. If a board wants to customise the clocks it can define the following: MBOOT_CLK_PLLM MBOOT_CLK_PLLN MBOOT_CLK_PLLP MBOOT_CLK_PLLQ MBOOT_CLK_PLLR (only needed on STM32H7) MBOOT_FLASH_LATENCY MBOOT_CLK_AHB_DIV MBOOT_CLK_APB1_DIV MBOOT_CLK_APB2_DIV MBOOT_CLK_APB3_DIV (only needed on STM32H7) MBOOT_CLK_APB4_DIV (only needed on STM32H7) Signed-off-by: Damien George --- ports/stm32/mboot/main.c | 106 +++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/ports/stm32/mboot/main.c b/ports/stm32/mboot/main.c index abde92de1b..aec31cbc20 100644 --- a/ports/stm32/mboot/main.c +++ b/ports/stm32/mboot/main.c @@ -60,31 +60,38 @@ // Most values are defined in irq.h. #define IRQ_PRI_I2C (NVIC_EncodePriority(NVIC_PRIORITYGROUP_4, 1, 0)) -// Configure PLL to give the desired CPU freq -#undef MICROPY_HW_FLASH_LATENCY -#if defined(STM32F4) || defined(STM32F7) - #if MBOOT_ENABLE_PACKING - // With encryption/signing/compression, a faster CPU makes processing much faster. +#if defined(MBOOT_CLK_PLLM) + // The board specified the PLL values, flash latency and bus dividers + #define CORE_PLL_FREQ (1000000 * MBOOT_CLK_PLLN / MBOOT_CLK_PLLP) +#else + // The board did not specify the clock values, so configure defaults + #if defined(STM32F4) || defined(STM32F7) + #if MBOOT_ENABLE_PACKING + // With encryption/signing/compression, a faster CPU makes processing much faster. + #define CORE_PLL_FREQ (96000000) + #define MBOOT_FLASH_LATENCY FLASH_LATENCY_3 + #else + #define CORE_PLL_FREQ (48000000) + #define MBOOT_FLASH_LATENCY FLASH_LATENCY_1 + #endif + #define MBOOT_CLK_AHB_DIV (RCC_SYSCLK_DIV1) + #define MBOOT_CLK_APB1_DIV (RCC_HCLK_DIV4) + #define MBOOT_CLK_APB2_DIV (RCC_HCLK_DIV2) + #elif defined(STM32H7) #define CORE_PLL_FREQ (96000000) - #define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_3 - #else - #define CORE_PLL_FREQ (48000000) - #define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_1 + #define MBOOT_FLASH_LATENCY FLASH_LATENCY_2 + #define MBOOT_CLK_AHB_DIV (RCC_HCLK_DIV2) + #define MBOOT_CLK_APB1_DIV (RCC_APB1_DIV2) + #define MBOOT_CLK_APB2_DIV (RCC_APB2_DIV2) + #define MBOOT_CLK_APB3_DIV (RCC_APB3_DIV2) + #define MBOOT_CLK_APB4_DIV (RCC_APB4_DIV2) #endif -#elif defined(STM32H7) - #define CORE_PLL_FREQ (96000000) - #define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_2 + #define MBOOT_CLK_PLLM (MICROPY_HW_CLK_VALUE / 1000000) + #define MBOOT_CLK_PLLN (192) + #define MBOOT_CLK_PLLP (MBOOT_CLK_PLLN / (CORE_PLL_FREQ / 1000000)) + #define MBOOT_CLK_PLLQ (4) + #define MBOOT_CLK_PLLR (2) #endif -#undef MICROPY_HW_CLK_PLLM -#undef MICROPY_HW_CLK_PLLN -#undef MICROPY_HW_CLK_PLLP -#undef MICROPY_HW_CLK_PLLQ -#undef MICROPY_HW_CLK_PLLR -#define MICROPY_HW_CLK_PLLM (MICROPY_HW_CLK_VALUE / 1000000) -#define MICROPY_HW_CLK_PLLN (192) -#define MICROPY_HW_CLK_PLLP (MICROPY_HW_CLK_PLLN / (CORE_PLL_FREQ / 1000000)) -#define MICROPY_HW_CLK_PLLQ (4) -#define MICROPY_HW_CLK_PLLR (2) // Work out which USB device to use for the USB DFU interface #if !defined(MICROPY_HW_USB_MAIN_DEV) @@ -203,10 +210,10 @@ void SystemClock_Config(void) { #else 1 << RCC_PLLCFGR_PLLSRC_Pos // HSE selected as PLL source #endif - | MICROPY_HW_CLK_PLLM << RCC_PLLCFGR_PLLM_Pos - | MICROPY_HW_CLK_PLLN << RCC_PLLCFGR_PLLN_Pos - | ((MICROPY_HW_CLK_PLLP >> 1) - 1) << RCC_PLLCFGR_PLLP_Pos - | MICROPY_HW_CLK_PLLQ << RCC_PLLCFGR_PLLQ_Pos + | MBOOT_CLK_PLLM << RCC_PLLCFGR_PLLM_Pos + | MBOOT_CLK_PLLN << RCC_PLLCFGR_PLLN_Pos + | ((MBOOT_CLK_PLLP >> 1) - 1) << RCC_PLLCFGR_PLLP_Pos + | MBOOT_CLK_PLLQ << RCC_PLLCFGR_PLLQ_Pos #ifdef RCC_PLLCFGR_PLLR | 2 << RCC_PLLCFGR_PLLR_Pos // default PLLR value of 2 #endif @@ -218,12 +225,12 @@ void SystemClock_Config(void) { } // Increase latency before changing clock - if (MICROPY_HW_FLASH_LATENCY > (FLASH->ACR & FLASH_ACR_LATENCY)) { - __HAL_FLASH_SET_LATENCY(MICROPY_HW_FLASH_LATENCY); + if (MBOOT_FLASH_LATENCY > (FLASH->ACR & FLASH_ACR_LATENCY)) { + __HAL_FLASH_SET_LATENCY(MBOOT_FLASH_LATENCY); } // Configure AHB divider - MODIFY_REG(RCC->CFGR, RCC_CFGR_HPRE, RCC_SYSCLK_DIV1); + MODIFY_REG(RCC->CFGR, RCC_CFGR_HPRE, MBOOT_CLK_AHB_DIV); // Configure SYSCLK source from PLL __HAL_RCC_SYSCLK_CONFIG(RCC_SYSCLKSOURCE_PLLCLK); @@ -231,13 +238,13 @@ void SystemClock_Config(void) { } // Decrease latency after changing clock - if (MICROPY_HW_FLASH_LATENCY < (FLASH->ACR & FLASH_ACR_LATENCY)) { - __HAL_FLASH_SET_LATENCY(MICROPY_HW_FLASH_LATENCY); + if (MBOOT_FLASH_LATENCY < (FLASH->ACR & FLASH_ACR_LATENCY)) { + __HAL_FLASH_SET_LATENCY(MBOOT_FLASH_LATENCY); } // Set APB clock dividers - MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE1, RCC_HCLK_DIV4); - MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE2, RCC_HCLK_DIV2 << 3); + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE1, MBOOT_CLK_APB1_DIV); + MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE2, MBOOT_CLK_APB2_DIV << 3); // Update clock value and reconfigure systick now that the frequency changed SystemCoreClock = CORE_PLL_FREQ; @@ -281,14 +288,14 @@ void SystemClock_Config(void) { RCC->PLLCFGR = 0; // Configure PLL1 for use by SYSCLK - RCC->PLLCKSELR |= MICROPY_HW_CLK_PLLM << RCC_PLLCKSELR_DIVM1_Pos; + RCC->PLLCKSELR |= MBOOT_CLK_PLLM << RCC_PLLCKSELR_DIVM1_Pos; RCC->PLLCFGR |= RCC_PLLCFGR_DIVP1EN; RCC->PLL1FRACR = 0; RCC->PLL1DIVR = - (MICROPY_HW_CLK_PLLN - 1) << RCC_PLL1DIVR_N1_Pos - | (MICROPY_HW_CLK_PLLP - 1) << RCC_PLL1DIVR_P1_Pos // only even P allowed - | (MICROPY_HW_CLK_PLLQ - 1) << RCC_PLL1DIVR_Q1_Pos - | (MICROPY_HW_CLK_PLLR - 1) << RCC_PLL1DIVR_R1_Pos; + (MBOOT_CLK_PLLN - 1) << RCC_PLL1DIVR_N1_Pos + | (MBOOT_CLK_PLLP - 1) << RCC_PLL1DIVR_P1_Pos // only even P allowed + | (MBOOT_CLK_PLLQ - 1) << RCC_PLL1DIVR_Q1_Pos + | (MBOOT_CLK_PLLR - 1) << RCC_PLL1DIVR_R1_Pos; // Configure PLL3 for use by USB at Q=48MHz RCC->PLLCKSELR |= MICROPY_HW_CLK_PLL3M << RCC_PLLCKSELR_DIVM3_Pos; @@ -314,14 +321,14 @@ void SystemClock_Config(void) { } // Increase latency before changing SYSCLK - if (MICROPY_HW_FLASH_LATENCY > (FLASH->ACR & FLASH_ACR_LATENCY)) { - __HAL_FLASH_SET_LATENCY(MICROPY_HW_FLASH_LATENCY); + if (MBOOT_FLASH_LATENCY > (FLASH->ACR & FLASH_ACR_LATENCY)) { + __HAL_FLASH_SET_LATENCY(MBOOT_FLASH_LATENCY); } // Configure AHB divider RCC->D1CFGR = 0 << RCC_D1CFGR_D1CPRE_Pos // SYSCLK prescaler of 1 - | 8 << RCC_D1CFGR_HPRE_Pos // AHB prescaler of 2 + | MBOOT_CLK_AHB_DIV ; // Configure SYSCLK source from PLL @@ -330,21 +337,14 @@ void SystemClock_Config(void) { } // Decrease latency after changing clock - if (MICROPY_HW_FLASH_LATENCY < (FLASH->ACR & FLASH_ACR_LATENCY)) { - __HAL_FLASH_SET_LATENCY(MICROPY_HW_FLASH_LATENCY); + if (MBOOT_FLASH_LATENCY < (FLASH->ACR & FLASH_ACR_LATENCY)) { + __HAL_FLASH_SET_LATENCY(MBOOT_FLASH_LATENCY); } // Set APB clock dividers - RCC->D1CFGR |= - 4 << RCC_D1CFGR_D1PPRE_Pos // APB3 prescaler of 2 - ; - RCC->D2CFGR = - 4 << RCC_D2CFGR_D2PPRE2_Pos // APB2 prescaler of 2 - | 4 << RCC_D2CFGR_D2PPRE1_Pos // APB1 prescaler of 2 - ; - RCC->D3CFGR = - 4 << RCC_D3CFGR_D3PPRE_Pos // APB4 prescaler of 2 - ; + RCC->D1CFGR |= MBOOT_CLK_APB3_DIV; + RCC->D2CFGR = MBOOT_CLK_APB2_DIV | MBOOT_CLK_APB1_DIV; + RCC->D3CFGR = MBOOT_CLK_APB4_DIV; // Update clock value and reconfigure systick now that the frequency changed SystemCoreClockUpdate(); From 5995fb526158ae224dddacef212c1d553d6a6306 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 16 Feb 2022 22:22:04 +1100 Subject: [PATCH 0147/1712] stm32/mboot: Allow a board more control over entry initialisation. If MBOOT_BOARD_ENTRY_INIT is defined by a board then that function must now make sure system clocks are configured, eg by calling mboot_entry_init(). Signed-off-by: Damien George --- ports/stm32/mboot/main.c | 13 +------------ ports/stm32/mboot/mboot.h | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/ports/stm32/mboot/main.c b/ports/stm32/mboot/main.c index aec31cbc20..8d6e28f189 100644 --- a/ports/stm32/mboot/main.c +++ b/ports/stm32/mboot/main.c @@ -1507,14 +1507,7 @@ void stm32_main(uint32_t initial_r0) { enter_bootloader: - // Init subsystems (mboot_get_reset_mode() may call these, calling them again is ok) - led_init(); - - // set the system clock to be HSE - SystemClock_Config(); - - // Ensure IRQs are enabled (needed coming out of ST bootloader on H7) - __set_PRIMASK(0); + MBOOT_BOARD_ENTRY_INIT(&initial_r0); #if USE_USB_POLLING // irqs with a priority value greater or equal to "pri" will be disabled @@ -1524,10 +1517,6 @@ enter_bootloader: __ASM volatile ("msr basepri_max, %0" : : "r" (pri) : "memory"); #endif - #if defined(MBOOT_BOARD_ENTRY_INIT) - MBOOT_BOARD_ENTRY_INIT(initial_r0); - #endif - #if defined(MBOOT_SPIFLASH_ADDR) MBOOT_SPIFLASH_SPIFLASH->config = MBOOT_SPIFLASH_CONFIG; mp_spiflash_init(MBOOT_SPIFLASH_SPIFLASH); diff --git a/ports/stm32/mboot/mboot.h b/ports/stm32/mboot/mboot.h index 3a27ce08ef..254c842653 100644 --- a/ports/stm32/mboot/mboot.h +++ b/ports/stm32/mboot/mboot.h @@ -26,8 +26,7 @@ #ifndef MICROPY_INCLUDED_STM32_MBOOT_MBOOT_H #define MICROPY_INCLUDED_STM32_MBOOT_MBOOT_H -#include -#include +#include "py/mphal.h" // Use this to tag global static data in RAM that doesn't need to be zeroed on startup #define SECTION_NOZERO_BSS __attribute__((section(".nozero_bss"))) @@ -39,6 +38,10 @@ #define NORETURN __attribute__((noreturn)) #define MP_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#ifndef MBOOT_BOARD_ENTRY_INIT +#define MBOOT_BOARD_ENTRY_INIT mboot_entry_init +#endif + enum { MBOOT_ERRNO_FLASH_ERASE_DISALLOWED = 200, MBOOT_ERRNO_FLASH_ERASE_FAILED, @@ -86,6 +89,8 @@ enum { extern uint8_t _estack[ELEM_DATA_SIZE]; void systick_init(void); +void led_init(void); +void SystemClock_Config(void); uint32_t get_le32(const uint8_t *b); void led_state_all(unsigned int mask); @@ -101,4 +106,17 @@ int do_write(uint32_t addr, const uint8_t *src8, size_t len); const uint8_t *elem_search(const uint8_t *elem, uint8_t elem_id); int fsload_process(void); +static inline void mboot_entry_init(uint32_t *initial_r0) { + // Init subsystems (mboot_get_reset_mode() may call these, calling them again is ok) + led_init(); + + // set the system clock to be HSE + SystemClock_Config(); + + #if defined(STM32H7) + // Ensure IRQs are enabled (needed coming out of ST bootloader on H7) + __set_PRIMASK(0); + #endif +} + #endif // MICROPY_INCLUDED_STM32_MBOOT_MBOOT_H From ff9c7085077a9aa4e715b3952d24ada7b096d744 Mon Sep 17 00:00:00 2001 From: stijn Date: Thu, 17 Feb 2022 10:51:17 +0100 Subject: [PATCH 0148/1712] tests/run-tests.py: Skip repl tests when running windows underneath. Some versions of Python (for instance: the mingw-w64 version which can be installed on MSYS2) do include a pty module and claim to be posix-like (os.name == 'posix'), yet the select.select call used in run-tests.py hangs forever. To be on the safe side just exclude anything which might be running on windows. --- tests/run-tests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/run-tests.py b/tests/run-tests.py index 6f3c09d1da..f9a16283bc 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -109,6 +109,10 @@ def run_micropython(pyb, args, test_file, is_special=False): return b"SKIP\n" import select + # Even though these might have the pty module, it's unlikely to function. + if sys.platform in ["win32", "msys", "cygwin"]: + return b"SKIP\n" + def get(required=False): rv = b"" while True: From c8cd5a9960e7cda0da064dcddd748808aa95ffea Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 18 Feb 2022 15:50:01 +1100 Subject: [PATCH 0149/1712] esp32/mpconfigport.h: Use the "extra" feature level. This commit is a no-op change to simplify existing config. Signed-off-by: Damien George --- ports/esp32/mpconfigport.h | 96 ++++---------------------------------- 1 file changed, 8 insertions(+), 88 deletions(-) diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h index c457a5743b..2ef90dea52 100644 --- a/ports/esp32/mpconfigport.h +++ b/ports/esp32/mpconfigport.h @@ -10,6 +10,10 @@ #include "freertos/FreeRTOS.h" #include "driver/i2s.h" +#ifndef MICROPY_CONFIG_ROM_LEVEL +#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES) +#endif + // object representation and NLR handling #define MICROPY_OBJ_REPR (MICROPY_OBJ_REPR_A) #define MICROPY_NLR_SETJMP (1) @@ -27,107 +31,36 @@ #endif // compiler configuration -#define MICROPY_COMP_MODULE_CONST (1) -#define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (1) +#define MICROPY_COMP_RETURN_IF_EXPR (0) // optimisations #define MICROPY_OPT_COMPUTED_GOTO (1) -#define MICROPY_OPT_LOAD_ATTR_FAST_PATH (1) -#define MICROPY_OPT_MAP_LOOKUP_CACHE (1) -#define MICROPY_OPT_MPZ_BITWISE (1) +#define MICROPY_OPT_MATH_FACTORIAL (0) // Python internal features #define MICROPY_READER_VFS (1) #define MICROPY_ENABLE_GC (1) -#define MICROPY_ENABLE_FINALISER (1) -#define MICROPY_STACK_CHECK (1) #define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1) -#define MICROPY_KBD_EXCEPTION (1) -#define MICROPY_HELPER_REPL (1) -#define MICROPY_REPL_EMACS_KEYS (1) -#define MICROPY_REPL_AUTO_INDENT (1) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ) -#define MICROPY_ENABLE_SOURCE_LINE (1) #define MICROPY_ERROR_REPORTING (MICROPY_ERROR_REPORTING_NORMAL) #define MICROPY_WARNINGS (1) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) -#define MICROPY_CPYTHON_COMPAT (1) -#define MICROPY_STREAMS_NON_BLOCK (1) #define MICROPY_STREAMS_POSIX_API (1) -#define MICROPY_MODULE_BUILTIN_INIT (1) -#define MICROPY_MODULE_WEAK_LINKS (1) #define MICROPY_MODULE_FROZEN_STR (0) #define MICROPY_MODULE_FROZEN_MPY (1) #define MICROPY_QSTR_EXTRA_POOL mp_qstr_frozen_const_pool -#define MICROPY_CAN_OVERRIDE_BUILTINS (1) #define MICROPY_USE_INTERNAL_ERRNO (0) // errno.h from xtensa-esp32-elf/sys-include/sys #define MICROPY_USE_INTERNAL_PRINTF (0) // ESP32 SDK requires its own printf -#define MICROPY_ENABLE_SCHEDULER (1) #define MICROPY_SCHEDULER_DEPTH (8) #define MICROPY_VFS (1) // control over Python builtins -#define MICROPY_PY_FUNCTION_ATTRS (1) -#define MICROPY_PY_DESCRIPTORS (1) -#define MICROPY_PY_DELATTR_SETATTR (1) -#define MICROPY_PY_FSTRINGS (1) #define MICROPY_PY_STR_BYTES_CMP_WARN (1) -#define MICROPY_PY_BUILTINS_STR_UNICODE (1) -#define MICROPY_PY_BUILTINS_STR_CENTER (1) -#define MICROPY_PY_BUILTINS_STR_PARTITION (1) -#define MICROPY_PY_BUILTINS_STR_SPLITLINES (1) -#define MICROPY_PY_BUILTINS_BYTEARRAY (1) -#define MICROPY_PY_BUILTINS_MEMORYVIEW (1) -#define MICROPY_PY_BUILTINS_SET (1) -#define MICROPY_PY_BUILTINS_SLICE (1) -#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1) -#define MICROPY_PY_BUILTINS_SLICE_INDICES (1) -#define MICROPY_PY_BUILTINS_FROZENSET (1) -#define MICROPY_PY_BUILTINS_PROPERTY (1) -#define MICROPY_PY_BUILTINS_RANGE_ATTRS (1) -#define MICROPY_PY_BUILTINS_ROUND_INT (1) -#define MICROPY_PY_ALL_SPECIAL_METHODS (1) #define MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS (1) -#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1) -#define MICROPY_PY_BUILTINS_COMPILE (1) -#define MICROPY_PY_BUILTINS_ENUMERATE (1) -#define MICROPY_PY_BUILTINS_EXECFILE (1) -#define MICROPY_PY_BUILTINS_FILTER (1) -#define MICROPY_PY_BUILTINS_REVERSED (1) -#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1) -#define MICROPY_PY_BUILTINS_INPUT (1) -#define MICROPY_PY_BUILTINS_MIN_MAX (1) -#define MICROPY_PY_BUILTINS_POW3 (1) -#define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP_TEXT esp32_help_text -#define MICROPY_PY_BUILTINS_HELP_MODULES (1) -#define MICROPY_PY___FILE__ (1) -#define MICROPY_PY_MICROPYTHON_MEM_INFO (1) -#define MICROPY_PY_ARRAY (1) -#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1) -#define MICROPY_PY_ATTRTUPLE (1) -#define MICROPY_PY_COLLECTIONS (1) -#define MICROPY_PY_COLLECTIONS_DEQUE (1) -#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1) -#define MICROPY_PY_MATH (1) -#define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (1) -#define MICROPY_PY_MATH_ISCLOSE (1) -#define MICROPY_PY_CMATH (1) -#define MICROPY_PY_GC (1) -#define MICROPY_PY_IO (1) -#define MICROPY_PY_IO_IOBASE (1) -#define MICROPY_PY_IO_FILEIO (1) -#define MICROPY_PY_IO_BYTESIO (1) +#define MICROPY_PY_MATH_CONSTANTS (0) +#define MICROPY_PY_MATH_FACTORIAL (0) #define MICROPY_PY_IO_BUFFEREDWRITER (1) -#define MICROPY_PY_STRUCT (1) -#define MICROPY_PY_SYS (1) -#define MICROPY_PY_SYS_MAXSIZE (1) -#define MICROPY_PY_SYS_MODULES (1) -#define MICROPY_PY_SYS_EXIT (1) -#define MICROPY_PY_SYS_STDFILES (1) -#define MICROPY_PY_SYS_STDIO_BUFFER (1) -#define MICROPY_PY_UERRNO (1) -#define MICROPY_PY_USELECT (1) #define MICROPY_PY_UTIME_MP_HAL (1) #define MICROPY_PY_THREAD (1) #define MICROPY_PY_THREAD_GIL (1) @@ -140,22 +73,10 @@ #define MICROPY_BLUETOOTH_NIMBLE (1) #define MICROPY_BLUETOOTH_NIMBLE_BINDINGS_ONLY (1) #endif -#define MICROPY_PY_UASYNCIO (1) -#define MICROPY_PY_UCTYPES (1) -#define MICROPY_PY_UZLIB (1) -#define MICROPY_PY_UJSON (1) -#define MICROPY_PY_URE (1) -#define MICROPY_PY_URE_SUB (1) -#define MICROPY_PY_UHEAPQ (1) #define MICROPY_PY_UTIMEQ (1) -#define MICROPY_PY_UHASHLIB (1) #define MICROPY_PY_UHASHLIB_SHA1 (1) #define MICROPY_PY_UHASHLIB_SHA256 (1) #define MICROPY_PY_UCRYPTOLIB (1) -#define MICROPY_PY_UBINASCII (1) -#define MICROPY_PY_UBINASCII_CRC32 (1) -#define MICROPY_PY_URANDOM (1) -#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1) #define MICROPY_PY_URANDOM_SEED_INIT_FUNC (esp_random()) #define MICROPY_PY_OS_DUPTERM (1) #define MICROPY_PY_MACHINE (1) @@ -192,7 +113,6 @@ #define MICROPY_PY_USSL_FINALISER (1) #define MICROPY_PY_UWEBSOCKET (1) #define MICROPY_PY_WEBREPL (1) -#define MICROPY_PY_FRAMEBUF (1) #define MICROPY_PY_BTREE (1) #define MICROPY_PY_ONEWIRE (1) #define MICROPY_PY_UPLATFORM (1) From 5935fa229c94e53c4b23d0a491cb16d9adb9dada Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 18 Feb 2022 16:01:18 +1100 Subject: [PATCH 0150/1712] esp32/mpconfigport.h: Enable remaining features to get to "extra" level. Signed-off-by: Damien George --- ports/esp32/mpconfigport.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h index 2ef90dea52..1ea19ada01 100644 --- a/ports/esp32/mpconfigport.h +++ b/ports/esp32/mpconfigport.h @@ -30,12 +30,8 @@ #define MICROPY_EMIT_XTENSAWIN (1) #endif -// compiler configuration -#define MICROPY_COMP_RETURN_IF_EXPR (0) - // optimisations #define MICROPY_OPT_COMPUTED_GOTO (1) -#define MICROPY_OPT_MATH_FACTORIAL (0) // Python internal features #define MICROPY_READER_VFS (1) @@ -58,8 +54,6 @@ #define MICROPY_PY_STR_BYTES_CMP_WARN (1) #define MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS (1) #define MICROPY_PY_BUILTINS_HELP_TEXT esp32_help_text -#define MICROPY_PY_MATH_CONSTANTS (0) -#define MICROPY_PY_MATH_FACTORIAL (0) #define MICROPY_PY_IO_BUFFEREDWRITER (1) #define MICROPY_PY_UTIME_MP_HAL (1) #define MICROPY_PY_THREAD (1) From 106a83de222a7c9ceb3f70ca214677c996916489 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 7 Feb 2022 21:05:48 +1100 Subject: [PATCH 0151/1712] esp32/esp32_partition: Add support for specifying block_size. To support filesystems that use a block size different from the native erase-page size. Signed-off-by: Damien George --- docs/library/esp32.rst | 8 +++- ports/esp32/esp32_partition.c | 80 ++++++++++++++++++++++++++++------- 2 files changed, 70 insertions(+), 18 deletions(-) diff --git a/docs/library/esp32.rst b/docs/library/esp32.rst index ff1c99a553..82e69e4964 100644 --- a/docs/library/esp32.rst +++ b/docs/library/esp32.rst @@ -68,17 +68,21 @@ Flash partitions This class gives access to the partitions in the device's flash memory and includes methods to enable over-the-air (OTA) updates. -.. class:: Partition(id) +.. class:: Partition(id, block_size=4096) Create an object representing a partition. *id* can be a string which is the label of the partition to retrieve, or one of the constants: ``BOOT`` or ``RUNNING``. + *block_size* specifies the byte size of an individual block. -.. classmethod:: Partition.find(type=TYPE_APP, subtype=0xff, label=None) +.. classmethod:: Partition.find(type=TYPE_APP, subtype=0xff, label=None, block_size=4096) Find a partition specified by *type*, *subtype* and *label*. Returns a (possibly empty) list of Partition objects. Note: ``subtype=0xff`` matches any subtype and ``label=None`` matches any label. + *block_size* specifies the byte size of an individual block used by the returned + objects. + .. method:: Partition.info() Returns a 6-tuple ``(type, subtype, addr, size, label, encrypted)``. diff --git a/ports/esp32/esp32_partition.c b/ports/esp32/esp32_partition.c index dc2bdd7120..b779cb18c6 100644 --- a/ports/esp32/esp32_partition.c +++ b/ports/esp32/esp32_partition.c @@ -34,9 +34,12 @@ #include "esp_ota_ops.h" // esp_partition_read and esp_partition_write can operate on arbitrary bytes -// but esp_partition_erase_range operates on 4k blocks. But to make a partition -// implement the standard block protocol all operations are done on 4k blocks. -#define BLOCK_SIZE_BYTES (4096) +// but esp_partition_erase_range operates on 4k blocks. The default block size +// for a Partition object is therefore 4k, to make writes efficient, and also +// make it work well with filesystems like littlefs. The Partition object also +// supports smaller block sizes, in which case a cache is used and writes may +// be less efficient. +#define NATIVE_BLOCK_SIZE_BYTES (4096) enum { ESP32_PARTITION_BOOT, @@ -46,15 +49,23 @@ enum { typedef struct _esp32_partition_obj_t { mp_obj_base_t base; const esp_partition_t *part; + uint8_t *cache; + uint16_t block_size; } esp32_partition_obj_t; -STATIC esp32_partition_obj_t *esp32_partition_new(const esp_partition_t *part) { +STATIC esp32_partition_obj_t *esp32_partition_new(const esp_partition_t *part, uint16_t block_size) { if (part == NULL) { mp_raise_OSError(MP_ENOENT); } esp32_partition_obj_t *self = m_new_obj(esp32_partition_obj_t); self->base.type = &esp32_partition_type; self->part = part; + self->block_size = block_size; + if (self->block_size < NATIVE_BLOCK_SIZE_BYTES) { + self->cache = m_new(uint8_t, NATIVE_BLOCK_SIZE_BYTES); + } else { + self->cache = NULL; + } return self; } @@ -69,7 +80,7 @@ STATIC void esp32_partition_print(const mp_print_t *print, mp_obj_t self_in, mp_ STATIC mp_obj_t esp32_partition_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { // Check args - mp_arg_check_num(n_args, n_kw, 1, 1, false); + mp_arg_check_num(n_args, n_kw, 1, 2, false); // Get requested partition const esp_partition_t *part; @@ -94,17 +105,24 @@ STATIC mp_obj_t esp32_partition_make_new(const mp_obj_type_t *type, size_t n_arg } } + // Get block size if given + uint16_t block_size = NATIVE_BLOCK_SIZE_BYTES; + if (n_args == 2) { + block_size = mp_obj_get_int(all_args[1]); + } + // Return new object - return MP_OBJ_FROM_PTR(esp32_partition_new(part)); + return MP_OBJ_FROM_PTR(esp32_partition_new(part, block_size)); } STATIC mp_obj_t esp32_partition_find(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { // Parse args - enum { ARG_type, ARG_subtype, ARG_label }; + enum { ARG_type, ARG_subtype, ARG_label, ARG_block_size }; static const mp_arg_t allowed_args[] = { { MP_QSTR_type, MP_ARG_INT, {.u_int = ESP_PARTITION_TYPE_APP} }, { MP_QSTR_subtype, MP_ARG_INT, {.u_int = ESP_PARTITION_SUBTYPE_ANY} }, { MP_QSTR_label, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} }, + { MP_QSTR_block_size, MP_ARG_INT, {.u_int = NATIVE_BLOCK_SIZE_BYTES} }, }; 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); @@ -115,11 +133,14 @@ STATIC mp_obj_t esp32_partition_find(size_t n_args, const mp_obj_t *pos_args, mp label = mp_obj_str_get_str(args[ARG_label].u_obj); } + // Get block size + uint16_t block_size = args[ARG_block_size].u_int; + // Build list of matching partitions mp_obj_t list = mp_obj_new_list(0, NULL); esp_partition_iterator_t iter = esp_partition_find(args[ARG_type].u_int, args[ARG_subtype].u_int, label); while (iter != NULL) { - mp_obj_list_append(list, MP_OBJ_FROM_PTR(esp32_partition_new(esp_partition_get(iter)))); + mp_obj_list_append(list, MP_OBJ_FROM_PTR(esp32_partition_new(esp_partition_get(iter), block_size))); iter = esp_partition_next(iter); } esp_partition_iterator_release(iter); @@ -145,7 +166,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_partition_info_obj, esp32_partition_info) STATIC mp_obj_t esp32_partition_readblocks(size_t n_args, const mp_obj_t *args) { esp32_partition_obj_t *self = MP_OBJ_TO_PTR(args[0]); - uint32_t offset = mp_obj_get_int(args[1]) * BLOCK_SIZE_BYTES; + uint32_t offset = mp_obj_get_int(args[1]) * self->block_size; mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_WRITE); if (n_args == 4) { @@ -158,12 +179,36 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp32_partition_readblocks_obj, 3, 4, STATIC mp_obj_t esp32_partition_writeblocks(size_t n_args, const mp_obj_t *args) { esp32_partition_obj_t *self = MP_OBJ_TO_PTR(args[0]); - uint32_t offset = mp_obj_get_int(args[1]) * BLOCK_SIZE_BYTES; + uint32_t offset = mp_obj_get_int(args[1]) * self->block_size; mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_READ); if (n_args == 3) { - check_esp_err(esp_partition_erase_range(self->part, offset, bufinfo.len)); + // A simple write, which requires erasing first. + if (self->block_size >= NATIVE_BLOCK_SIZE_BYTES) { + // Block size is at least native erase-page size, so do an efficient erase. + check_esp_err(esp_partition_erase_range(self->part, offset, bufinfo.len)); + } else { + // Block size is less than native erase-page size, so do erase in sections. + uint32_t addr = (offset / NATIVE_BLOCK_SIZE_BYTES) * NATIVE_BLOCK_SIZE_BYTES; + uint32_t o = offset % NATIVE_BLOCK_SIZE_BYTES; + uint32_t top_addr = offset + bufinfo.len; + while (addr < top_addr) { + if (o > 0 || top_addr < addr + NATIVE_BLOCK_SIZE_BYTES) { + check_esp_err(esp_partition_read(self->part, addr, self->cache, NATIVE_BLOCK_SIZE_BYTES)); + } + check_esp_err(esp_partition_erase_range(self->part, addr, NATIVE_BLOCK_SIZE_BYTES)); + if (o > 0) { + check_esp_err(esp_partition_write(self->part, addr, self->cache, o)); + } + if (top_addr < addr + NATIVE_BLOCK_SIZE_BYTES) { + check_esp_err(esp_partition_write(self->part, top_addr, self->cache, addr + NATIVE_BLOCK_SIZE_BYTES - top_addr)); + } + o = 0; + addr += NATIVE_BLOCK_SIZE_BYTES; + } + } } else { + // An extended write, erasing must have been done explicitly before this write. offset += mp_obj_get_int(args[3]); } check_esp_err(esp_partition_write(self->part, offset, bufinfo.buf, bufinfo.len)); @@ -182,12 +227,15 @@ STATIC mp_obj_t esp32_partition_ioctl(mp_obj_t self_in, mp_obj_t cmd_in, mp_obj_ case MP_BLOCKDEV_IOCTL_SYNC: return MP_OBJ_NEW_SMALL_INT(0); case MP_BLOCKDEV_IOCTL_BLOCK_COUNT: - return MP_OBJ_NEW_SMALL_INT(self->part->size / BLOCK_SIZE_BYTES); + return MP_OBJ_NEW_SMALL_INT(self->part->size / self->block_size); case MP_BLOCKDEV_IOCTL_BLOCK_SIZE: - return MP_OBJ_NEW_SMALL_INT(BLOCK_SIZE_BYTES); + return MP_OBJ_NEW_SMALL_INT(self->block_size); case MP_BLOCKDEV_IOCTL_BLOCK_ERASE: { - uint32_t offset = mp_obj_get_int(arg_in) * BLOCK_SIZE_BYTES; - check_esp_err(esp_partition_erase_range(self->part, offset, BLOCK_SIZE_BYTES)); + if (self->block_size != NATIVE_BLOCK_SIZE_BYTES) { + return MP_OBJ_NEW_SMALL_INT(-MP_EINVAL); + } + uint32_t offset = mp_obj_get_int(arg_in) * NATIVE_BLOCK_SIZE_BYTES; + check_esp_err(esp_partition_erase_range(self->part, offset, NATIVE_BLOCK_SIZE_BYTES)); return MP_OBJ_NEW_SMALL_INT(0); } default: @@ -205,7 +253,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_partition_set_boot_obj, esp32_partition_s STATIC mp_obj_t esp32_partition_get_next_update(mp_obj_t self_in) { esp32_partition_obj_t *self = MP_OBJ_TO_PTR(self_in); - return MP_OBJ_FROM_PTR(esp32_partition_new(esp_ota_get_next_update_partition(self->part))); + return MP_OBJ_FROM_PTR(esp32_partition_new(esp_ota_get_next_update_partition(self->part), NATIVE_BLOCK_SIZE_BYTES)); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_partition_get_next_update_obj, esp32_partition_get_next_update); From f30b32e084ec49cdb2bf6011963dd1fa98945706 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 7 Feb 2022 21:06:05 +1100 Subject: [PATCH 0152/1712] esp32/modules: Create ffat partition object with block_size=512. Because these are formatted with a 512 sector size. Signed-off-by: Damien George --- ports/esp32/modules/flashbdev.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32/modules/flashbdev.py b/ports/esp32/modules/flashbdev.py index c3f75c7a7e..1ee6ff779b 100644 --- a/ports/esp32/modules/flashbdev.py +++ b/ports/esp32/modules/flashbdev.py @@ -3,5 +3,5 @@ from esp32 import Partition # MicroPython's partition table uses "vfs", TinyUF2 uses "ffat". bdev = Partition.find(Partition.TYPE_DATA, label="vfs") if not bdev: - bdev = Partition.find(Partition.TYPE_DATA, label="ffat") + bdev = Partition.find(Partition.TYPE_DATA, label="ffat", block_size=512) bdev = bdev[0] if bdev else None From 49934fcf8b0b2bd906a96e1ff57b724d8dd6d93e Mon Sep 17 00:00:00 2001 From: stijn Date: Fri, 18 Feb 2022 19:36:40 +0100 Subject: [PATCH 0153/1712] extmod/moduplatform: Move platform PP definitions into a header. These are more generally useful than just for the module so make them globally available, prefixed consistently with MICROPY_PLATFORM_. --- extmod/moduplatform.c | 82 +++------------------------------ extmod/moduplatform.h | 105 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+), 75 deletions(-) create mode 100644 extmod/moduplatform.h diff --git a/extmod/moduplatform.c b/extmod/moduplatform.c index 820feb312a..fa59c9227d 100644 --- a/extmod/moduplatform.c +++ b/extmod/moduplatform.c @@ -29,87 +29,19 @@ #include "py/objtuple.h" #include "py/objstr.h" #include "py/mphal.h" +#include "extmod/moduplatform.h" #include "genhdr/mpversion.h" #if MICROPY_PY_UPLATFORM // platform - Access to underlying platform's identifying data -// TODO: Add more architectures, compilers and libraries. -// See: https://sourceforge.net/p/predef/wiki/Home/ - -#if defined(__ARM_ARCH) -#define PLATFORM_ARCH "arm" -#elif defined(__x86_64__) || defined(_WIN64) -#define PLATFORM_ARCH "x86_64" -#elif defined(__i386__) || defined(_M_IX86) -#define PLATFORM_ARCH "x86" -#elif defined(__xtensa__) || defined(_M_IX86) -#define PLATFORM_ARCH "xtensa" -#else -#define PLATFORM_ARCH "" -#endif - -#if defined(__GNUC__) -#define PLATFORM_COMPILER \ - "GCC " \ - MP_STRINGIFY(__GNUC__) "." \ - MP_STRINGIFY(__GNUC_MINOR__) "." \ - MP_STRINGIFY(__GNUC_PATCHLEVEL__) -#elif defined(__ARMCC_VERSION) -#define PLATFORM_COMPILER \ - "ARMCC " \ - MP_STRINGIFY((__ARMCC_VERSION / 1000000)) "." \ - MP_STRINGIFY((__ARMCC_VERSION / 10000 % 100)) "." \ - MP_STRINGIFY((__ARMCC_VERSION % 10000)) -#elif defined(_MSC_VER) -#if defined(_WIN64) -#define COMPILER_BITS "64 bit" -#elif defined(_M_IX86) -#define COMPILER_BITS "32 bit" -#else -#define COMPILER_BITS "" -#endif -#define PLATFORM_COMPILER \ - "MSC v." MP_STRINGIFY(_MSC_VER) " " COMPILER_BITS -#else -#define PLATFORM_COMPILER "" -#endif - -#if defined(__GLIBC__) -#define PLATFORM_LIBC_LIB "glibc" -#define PLATFORM_LIBC_VER \ - MP_STRINGIFY(__GLIBC__) "." \ - MP_STRINGIFY(__GLIBC_MINOR__) -#elif defined(__NEWLIB__) -#define PLATFORM_LIBC_LIB "newlib" -#define PLATFORM_LIBC_VER _NEWLIB_VERSION -#else -#define PLATFORM_LIBC_LIB "" -#define PLATFORM_LIBC_VER "" -#endif - -#if defined(__linux) -#define PLATFORM_SYSTEM "Linux" -#elif defined(__unix__) -#define PLATFORM_SYSTEM "Unix" -#elif defined(__CYGWIN__) -#define PLATFORM_SYSTEM "Cygwin" -#elif defined(_WIN32) -#define PLATFORM_SYSTEM "Windows" -#else -#define PLATFORM_SYSTEM "MicroPython" -#endif - -#ifndef MICROPY_PLATFORM_VERSION -#define MICROPY_PLATFORM_VERSION "" -#endif - -STATIC const MP_DEFINE_STR_OBJ(info_platform_obj, PLATFORM_SYSTEM "-" MICROPY_VERSION_STRING "-" \ - PLATFORM_ARCH "-" MICROPY_PLATFORM_VERSION "-with-" PLATFORM_LIBC_LIB "" PLATFORM_LIBC_VER); -STATIC const MP_DEFINE_STR_OBJ(info_python_compiler_obj, PLATFORM_COMPILER); -STATIC const MP_DEFINE_STR_OBJ(info_libc_lib_obj, PLATFORM_LIBC_LIB); -STATIC const MP_DEFINE_STR_OBJ(info_libc_ver_obj, PLATFORM_LIBC_VER); +STATIC const MP_DEFINE_STR_OBJ(info_platform_obj, MICROPY_PLATFORM_SYSTEM "-" \ + MICROPY_VERSION_STRING "-" MICROPY_PLATFORM_ARCH "-" MICROPY_PLATFORM_VERSION "-with-" \ + MICROPY_PLATFORM_LIBC_LIB "" MICROPY_PLATFORM_LIBC_VER); +STATIC const MP_DEFINE_STR_OBJ(info_python_compiler_obj, MICROPY_PLATFORM_COMPILER); +STATIC const MP_DEFINE_STR_OBJ(info_libc_lib_obj, MICROPY_PLATFORM_LIBC_LIB); +STATIC const MP_DEFINE_STR_OBJ(info_libc_ver_obj, MICROPY_PLATFORM_LIBC_VER); STATIC const mp_rom_obj_tuple_t info_libc_tuple_obj = { {&mp_type_tuple}, 2, {MP_ROM_PTR(&info_libc_lib_obj), MP_ROM_PTR(&info_libc_ver_obj)} }; diff --git a/extmod/moduplatform.h b/extmod/moduplatform.h new file mode 100644 index 0000000000..2b9ad3ae49 --- /dev/null +++ b/extmod/moduplatform.h @@ -0,0 +1,105 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2013-2021 Ibrahim Abdelkader + * + * 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_MODUPLATFORM_H +#define MICROPY_INCLUDED_MODUPLATFORM_H + +#include "py/misc.h" // For MP_STRINGIFY. +#include "py/mpconfig.h" + +// Preprocessor directives indentifying the platform. +// The (u)platform module itself is guarded by MICROPY_PY_UPLATFORM, see the +// .c file, but these are made available because they're generally usable. +// TODO: Add more architectures, compilers and libraries. +// See: https://sourceforge.net/p/predef/wiki/Home/ + +#if defined(__ARM_ARCH) +#define MICROPY_PLATFORM_ARCH "arm" +#elif defined(__x86_64__) || defined(_WIN64) +#define MICROPY_PLATFORM_ARCH "x86_64" +#elif defined(__i386__) || defined(_M_IX86) +#define MICROPY_PLATFORM_ARCH "x86" +#elif defined(__xtensa__) || defined(_M_IX86) +#define MICROPY_PLATFORM_ARCH "xtensa" +#else +#define MICROPY_PLATFORM_ARCH "" +#endif + +#if defined(__GNUC__) +#define MICROPY_PLATFORM_COMPILER \ + "GCC " \ + MP_STRINGIFY(__GNUC__) "." \ + MP_STRINGIFY(__GNUC_MINOR__) "." \ + MP_STRINGIFY(__GNUC_PATCHLEVEL__) +#elif defined(__ARMCC_VERSION) +#define MICROPY_PLATFORM_COMPILER \ + "ARMCC " \ + MP_STRINGIFY((__ARMCC_VERSION / 1000000)) "." \ + MP_STRINGIFY((__ARMCC_VERSION / 10000 % 100)) "." \ + MP_STRINGIFY((__ARMCC_VERSION % 10000)) +#elif defined(_MSC_VER) +#if defined(_WIN64) +#define MICROPY_PLATFORM_COMPILER_BITS "64 bit" +#elif defined(_M_IX86) +#define MICROPY_PLATFORM_COMPILER_BITS "32 bit" +#else +#define MICROPY_PLATFORM_COMPILER_BITS "" +#endif +#define MICROPY_PLATFORM_COMPILER \ + "MSC v." MP_STRINGIFY(_MSC_VER) " " MICROPY_PLATFORM_COMPILER_BITS +#else +#define MICROPY_PLATFORM_COMPILER "" +#endif + +#if defined(__GLIBC__) +#define MICROPY_PLATFORM_LIBC_LIB "glibc" +#define MICROPY_PLATFORM_LIBC_VER \ + MP_STRINGIFY(__GLIBC__) "." \ + MP_STRINGIFY(__GLIBC_MINOR__) +#elif defined(__NEWLIB__) +#define MICROPY_PLATFORM_LIBC_LIB "newlib" +#define MICROPY_PLATFORM_LIBC_VER _NEWLIB_VERSION +#else +#define MICROPY_PLATFORM_LIBC_LIB "" +#define MICROPY_PLATFORM_LIBC_VER "" +#endif + +#if defined(__linux) +#define MICROPY_PLATFORM_SYSTEM "Linux" +#elif defined(__unix__) +#define MICROPY_PLATFORM_SYSTEM "Unix" +#elif defined(__CYGWIN__) +#define MICROPY_PLATFORM_SYSTEM "Cygwin" +#elif defined(_WIN32) +#define MICROPY_PLATFORM_SYSTEM "Windows" +#else +#define MICROPY_PLATFORM_SYSTEM "MicroPython" +#endif + +#ifndef MICROPY_PLATFORM_VERSION +#define MICROPY_PLATFORM_VERSION "" +#endif + +#endif // MICROPY_INCLUDED_MODUPLATFORM_H From 5f50f4a130e60c4bc5f4fbf58ac849dcaf764e72 Mon Sep 17 00:00:00 2001 From: stijn Date: Fri, 18 Feb 2022 19:38:55 +0100 Subject: [PATCH 0154/1712] unix: Show compiler info in REPL banner. The unix port's main.c gets used by unix and windows ports, and with a variety of compilers, so it's convenient to see which version is actually being used immediately when starting micropython. This is similar to what CPython does. --- ports/unix/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ports/unix/main.c b/ports/unix/main.c index b2790791af..2769f33191 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -47,6 +47,7 @@ #include "py/mphal.h" #include "py/mpthread.h" #include "extmod/misc.h" +#include "extmod/moduplatform.h" #include "extmod/vfs.h" #include "extmod/vfs_posix.h" #include "genhdr/mpversion.h" @@ -178,7 +179,8 @@ STATIC char *strjoin(const char *s1, int sep_char, const char *s2) { STATIC int do_repl(void) { mp_hal_stdout_tx_str("MicroPython " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE "; " - MICROPY_PY_SYS_PLATFORM " version\nUse Ctrl-D to exit, Ctrl-E for paste mode\n"); + MICROPY_PY_SYS_PLATFORM " [" MICROPY_PLATFORM_COMPILER "] version\n" + "Use Ctrl-D to exit, Ctrl-E for paste mode\n"); #if MICROPY_USE_READLINE == 1 From b1afbe3336a3daca170f54c471f84d28622293e4 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 24 Feb 2022 15:23:32 +1100 Subject: [PATCH 0155/1712] tools/ci.sh: Update IDF v4.4 build to use v4.4 tag. Signed-off-by: Damien George --- tools/ci.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/ci.sh b/tools/ci.sh index 0506a00314..3e78ae4a05 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -107,8 +107,7 @@ function ci_esp32_idf402_setup { } function ci_esp32_idf44_setup { - # This commit is just before v5.0-dev - ci_esp32_setup_helper 142bb32c50fa9875b8b69fa539a2d59559460d72 + ci_esp32_setup_helper v4.4 } function ci_esp32_build { From 64bfaae7ab33e628f28ca3b53b10893fb047b48e Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 24 Feb 2022 15:23:50 +1100 Subject: [PATCH 0156/1712] esp32/README.md: Update list of supported IDF versions. Signed-off-by: Damien George --- ports/esp32/README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ports/esp32/README.md b/ports/esp32/README.md index 4524696899..c37213b303 100644 --- a/ports/esp32/README.md +++ b/ports/esp32/README.md @@ -28,7 +28,7 @@ manage the ESP32 microcontroller, as well as a way to manage the required build environment and toolchains needed to build the firmware. The ESP-IDF changes quickly and MicroPython only supports certain versions. -Currently MicroPython supports v4.0.2, v4.1.1 and v4.2, +Currently MicroPython supports v4.0.2, v4.1.1, v4.2.2, v4.3.2 and v4.4, although other IDF v4 versions may also work. To install the ESP-IDF the full instructions can be found at the @@ -50,7 +50,7 @@ To check out a copy of the IDF use git clone: $ git clone -b v4.0.2 --recursive https://github.com/espressif/esp-idf.git ``` -You can replace `v4.0.2` with `v4.1.1` or `v4.2` or any other supported version. +You can replace `v4.0.2` with `v4.2.2` or `v4.4` or any other supported version. (You don't need a full recursive clone; see the `ci_esp32_setup` function in `tools/ci.sh` in this repository for more detailed set-up commands.) @@ -77,8 +77,7 @@ The `install.sh` step only needs to be done once. You will need to source **Note:** If you are building MicroPython for the ESP32-S2, ESP32-C3 or ESP32-S3, please ensure you are using the following required IDF versions: -- ESP32-S3 currently requires latest `master`, but eventually `v4.4` or later when - it's available. +- ESP32-S3 currently requires `v4.4` or later. - ESP32-S2 and ESP32-C3 require `v4.3.1` or later. Building the firmware From f2040bfc7ee033e48acef9f289790f3b4e6b74e5 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 22 Oct 2021 22:22:47 +1100 Subject: [PATCH 0157/1712] py: Rework bytecode and .mpy file format to be mostly static data. Background: .mpy files are precompiled .py files, built using mpy-cross, that contain compiled bytecode functions (and can also contain machine code). The benefit of using an .mpy file over a .py file is that they are faster to import and take less memory when importing. They are also smaller on disk. But the real benefit of .mpy files comes when they are frozen into the firmware. This is done by loading the .mpy file during compilation of the firmware and turning it into a set of big C data structures (the job of mpy-tool.py), which are then compiled and downloaded into the ROM of a device. These C data structures can be executed in-place, ie directly from ROM. This makes importing even faster because there is very little to do, and also means such frozen modules take up much less RAM (because their bytecode stays in ROM). The downside of frozen code is that it requires recompiling and reflashing the entire firmware. This can be a big barrier to entry, slows down development time, and makes it harder to do OTA updates of frozen code (because the whole firmware must be updated). This commit attempts to solve this problem by providing a solution that sits between loading .mpy files into RAM and freezing them into the firmware. The .mpy file format has been reworked so that it consists of data and bytecode which is mostly static and ready to run in-place. If these new .mpy files are located in flash/ROM which is memory addressable, the .mpy file can be executed (mostly) in-place. With this approach there is still a small amount of unpacking and linking of the .mpy file that needs to be done when it's imported, but it's still much better than loading an .mpy from disk into RAM (although not as good as freezing .mpy files into the firmware). The main trick to make static .mpy files is to adjust the bytecode so any qstrs that it references now go through a lookup table to convert from local qstr number in the module to global qstr number in the firmware. That means the bytecode does not need linking/rewriting of qstrs when it's loaded. Instead only a small qstr table needs to be built (and put in RAM) at import time. This means the bytecode itself is static/constant and can be used directly if it's in addressable memory. Also the qstr string data in the .mpy file, and some constant object data, can be used directly. Note that the qstr table is global to the module (ie not per function). In more detail, in the VM what used to be (schematically): qst = DECODE_QSTR_VALUE; is now (schematically): idx = DECODE_QSTR_INDEX; qst = qstr_table[idx]; That allows the bytecode to be fixed at compile time and not need relinking/rewriting of the qstr values. Only qstr_table needs to be linked when the .mpy is loaded. Incidentally, this helps to reduce the size of bytecode because what used to be 2-byte qstr values in the bytecode are now (mostly) 1-byte indices. If the module uses the same qstr more than two times then the bytecode is smaller than before. The following changes are measured for this commit compared to the previous (the baseline): - average 7%-9% reduction in size of .mpy files - frozen code size is reduced by about 5%-7% - importing .py files uses about 5% less RAM in total - importing .mpy files uses about 4% less RAM in total - importing .py and .mpy files takes about the same time as before The qstr indirection in the bytecode has only a small impact on VM performance. For stm32 on PYBv1.0 the performance change of this commit is: diff of scores (higher is better) N=100 M=100 baseline -> this-commit diff diff% (error%) bm_chaos.py 371.07 -> 357.39 : -13.68 = -3.687% (+/-0.02%) bm_fannkuch.py 78.72 -> 77.49 : -1.23 = -1.563% (+/-0.01%) bm_fft.py 2591.73 -> 2539.28 : -52.45 = -2.024% (+/-0.00%) bm_float.py 6034.93 -> 5908.30 : -126.63 = -2.098% (+/-0.01%) bm_hexiom.py 48.96 -> 47.93 : -1.03 = -2.104% (+/-0.00%) bm_nqueens.py 4510.63 -> 4459.94 : -50.69 = -1.124% (+/-0.00%) bm_pidigits.py 650.28 -> 644.96 : -5.32 = -0.818% (+/-0.23%) core_import_mpy_multi.py 564.77 -> 581.49 : +16.72 = +2.960% (+/-0.01%) core_import_mpy_single.py 68.67 -> 67.16 : -1.51 = -2.199% (+/-0.01%) core_qstr.py 64.16 -> 64.12 : -0.04 = -0.062% (+/-0.00%) core_yield_from.py 362.58 -> 354.50 : -8.08 = -2.228% (+/-0.00%) misc_aes.py 429.69 -> 405.59 : -24.10 = -5.609% (+/-0.01%) misc_mandel.py 3485.13 -> 3416.51 : -68.62 = -1.969% (+/-0.00%) misc_pystone.py 2496.53 -> 2405.56 : -90.97 = -3.644% (+/-0.01%) misc_raytrace.py 381.47 -> 374.01 : -7.46 = -1.956% (+/-0.01%) viper_call0.py 576.73 -> 572.49 : -4.24 = -0.735% (+/-0.04%) viper_call1a.py 550.37 -> 546.21 : -4.16 = -0.756% (+/-0.09%) viper_call1b.py 438.23 -> 435.68 : -2.55 = -0.582% (+/-0.06%) viper_call1c.py 442.84 -> 440.04 : -2.80 = -0.632% (+/-0.08%) viper_call2a.py 536.31 -> 532.35 : -3.96 = -0.738% (+/-0.06%) viper_call2b.py 382.34 -> 377.07 : -5.27 = -1.378% (+/-0.03%) And for unix on x64: diff of scores (higher is better) N=2000 M=2000 baseline -> this-commit diff diff% (error%) bm_chaos.py 13594.20 -> 13073.84 : -520.36 = -3.828% (+/-5.44%) bm_fannkuch.py 60.63 -> 59.58 : -1.05 = -1.732% (+/-3.01%) bm_fft.py 112009.15 -> 111603.32 : -405.83 = -0.362% (+/-4.03%) bm_float.py 246202.55 -> 247923.81 : +1721.26 = +0.699% (+/-2.79%) bm_hexiom.py 615.65 -> 617.21 : +1.56 = +0.253% (+/-1.64%) bm_nqueens.py 215807.95 -> 215600.96 : -206.99 = -0.096% (+/-3.52%) bm_pidigits.py 8246.74 -> 8422.82 : +176.08 = +2.135% (+/-3.64%) misc_aes.py 16133.00 -> 16452.74 : +319.74 = +1.982% (+/-1.50%) misc_mandel.py 128146.69 -> 130796.43 : +2649.74 = +2.068% (+/-3.18%) misc_pystone.py 83811.49 -> 83124.85 : -686.64 = -0.819% (+/-1.03%) misc_raytrace.py 21688.02 -> 21385.10 : -302.92 = -1.397% (+/-3.20%) The code size change is (firmware with a lot of frozen code benefits the most): bare-arm: +396 +0.697% minimal x86: +1595 +0.979% [incl +32(data)] unix x64: +2408 +0.470% [incl +800(data)] unix nanbox: +1396 +0.309% [incl -96(data)] stm32: -1256 -0.318% PYBV10 cc3200: +288 +0.157% esp8266: -260 -0.037% GENERIC esp32: -216 -0.014% GENERIC[incl -1072(data)] nrf: +116 +0.067% pca10040 rp2: -664 -0.135% PICO samd: +844 +0.607% ADAFRUIT_ITSYBITSY_M4_EXPRESS As part of this change the .mpy file format version is bumped to version 6. And mpy-tool.py has been improved to provide a good visualisation of the contents of .mpy files. In summary: this commit changes the bytecode to use qstr indirection, and reworks the .mpy file format to be simpler and allow .mpy files to be executed in-place. Performance is not impacted too much. Eventually it will be possible to store such .mpy files in a linear, read-only, memory- mappable filesystem so they can be executed from flash/ROM. This will essentially be able to replace frozen code for most applications. Signed-off-by: Damien George --- mpy-cross/main.c | 5 +- ports/unix/coverage.c | 4 + py/asmbase.c | 3 +- py/asmbase.h | 2 +- py/bc.c | 69 +- py/bc.h | 84 +- py/builtinevex.c | 2 +- py/builtinimport.c | 28 +- py/compile.c | 171 ++- py/compile.h | 3 +- py/dynruntime.h | 10 +- py/emit.h | 50 +- py/emitbc.c | 156 +-- py/emitcommon.c | 11 + py/emitglue.c | 61 +- py/emitglue.h | 26 +- py/emitnative.c | 263 ++-- py/emitnx86.c | 2 +- py/frozenmod.c | 2 +- py/mpconfig.h | 8 + py/nativeglue.c | 6 +- py/nativeglue.h | 12 +- py/obj.h | 4 - py/objfun.c | 50 +- py/objfun.h | 10 +- py/objgenerator.c | 18 +- py/objmodule.c | 9 +- py/persistentcode.c | 558 +++----- py/persistentcode.h | 12 +- py/profile.c | 47 +- py/profile.h | 4 +- py/qstr.h | 1 + py/scope.c | 3 +- py/scope.h | 3 +- py/showbc.c | 73 +- py/vm.c | 73 +- shared/runtime/pyexec.c | 6 +- tests/cmdline/cmd_parsetree.py.exp | 74 +- tests/cmdline/cmd_showbc.py.exp | 762 ++++++----- tests/cmdline/cmd_verbose.py.exp | 18 +- tests/micropython/import_mpy_invalid.py | 1 - tests/micropython/import_mpy_invalid.py.exp | 1 - tests/micropython/import_mpy_native_gc.py | 8 +- tests/micropython/import_mpy_native_x64.py | 63 +- tests/perf_bench/core_import_mpy_multi.py | 2 +- tests/perf_bench/core_import_mpy_single.py | 2 +- tools/mpy-tool.py | 1326 +++++++++++++------ tools/mpy_ld.py | 35 +- 48 files changed, 2388 insertions(+), 1753 deletions(-) diff --git a/mpy-cross/main.c b/mpy-cross/main.c index 7218921b31..a2daf7b22f 100644 --- a/mpy-cross/main.c +++ b/mpy-cross/main.c @@ -72,7 +72,8 @@ STATIC int compile_and_save(const char *file, const char *output_file, const cha #endif mp_parse_tree_t parse_tree = mp_parse(lex, MP_PARSE_FILE_INPUT); - mp_raw_code_t *rc = mp_compile_to_raw_code(&parse_tree, source_name, false); + mp_module_context_t *ctx = m_new_obj(mp_module_context_t); + mp_compiled_module_t cm = mp_compile_to_raw_code(&parse_tree, source_name, false, ctx); vstr_t vstr; vstr_init(&vstr, 16); @@ -83,7 +84,7 @@ STATIC int compile_and_save(const char *file, const char *output_file, const cha } else { vstr_add_str(&vstr, output_file); } - mp_raw_code_save_file(rc, vstr_null_terminated_str(&vstr)); + mp_raw_code_save_file(&cm, vstr_null_terminated_str(&vstr)); vstr_clear(&vstr); nlr_pop(); diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c index 6b00cdfef2..a855237200 100644 --- a/ports/unix/coverage.c +++ b/ports/unix/coverage.c @@ -2,6 +2,7 @@ #include #include "py/obj.h" +#include "py/objfun.h" #include "py/objstr.h" #include "py/runtime.h" #include "py/gc.h" @@ -449,7 +450,10 @@ STATIC mp_obj_t extra_coverage(void) { mp_printf(&mp_plat_print, "# VM\n"); // call mp_execute_bytecode with invalide bytecode (should raise NotImplementedError) + mp_module_context_t context; mp_obj_fun_bc_t fun_bc; + fun_bc.context = &context; + fun_bc.child_table = NULL; fun_bc.bytecode = (const byte *)"\x01"; // just needed for n_state mp_code_state_t *code_state = m_new_obj_var(mp_code_state_t, mp_obj_t, 1); code_state->fun_bc = &fun_bc; diff --git a/py/asmbase.c b/py/asmbase.c index 344e03e7a7..4a3fd089cb 100644 --- a/py/asmbase.c +++ b/py/asmbase.c @@ -61,7 +61,8 @@ void mp_asm_base_start_pass(mp_asm_base_t *as, int pass) { // all functions must go through this one to emit bytes // if as->pass < MP_ASM_PASS_EMIT, then this function just counts the number // of bytes needed and returns NULL, and callers should not store any data -uint8_t *mp_asm_base_get_cur_to_write_bytes(mp_asm_base_t *as, size_t num_bytes_to_write) { +uint8_t *mp_asm_base_get_cur_to_write_bytes(void *as_in, size_t num_bytes_to_write) { + mp_asm_base_t *as = as_in; uint8_t *c = NULL; if (as->pass == MP_ASM_PASS_EMIT) { assert(as->code_offset + num_bytes_to_write <= as->code_size); diff --git a/py/asmbase.h b/py/asmbase.h index 24c3af8679..960be7685f 100644 --- a/py/asmbase.h +++ b/py/asmbase.h @@ -45,7 +45,7 @@ typedef struct _mp_asm_base_t { void mp_asm_base_init(mp_asm_base_t *as, size_t max_num_labels); void mp_asm_base_deinit(mp_asm_base_t *as, bool free_code); void mp_asm_base_start_pass(mp_asm_base_t *as, int pass); -uint8_t *mp_asm_base_get_cur_to_write_bytes(mp_asm_base_t *as, size_t num_bytes_to_write); +uint8_t *mp_asm_base_get_cur_to_write_bytes(void *as, size_t num_bytes_to_write); void mp_asm_base_label_assign(mp_asm_base_t *as, size_t label); void mp_asm_base_align(mp_asm_base_t *as, unsigned int align); void mp_asm_base_data(mp_asm_base_t *as, unsigned int bytesize, uintptr_t val); diff --git a/py/bc.c b/py/bc.c index 69b6739e8f..b98df39e28 100644 --- a/py/bc.c +++ b/py/bc.c @@ -29,9 +29,9 @@ #include #include -#include "py/runtime.h" #include "py/bc0.h" #include "py/bc.h" +#include "py/objfun.h" #if MICROPY_DEBUG_VERBOSE // print debugging info #define DEBUG_PRINT (1) @@ -40,7 +40,23 @@ #define DEBUG_printf(...) (void)0 #endif -#if !MICROPY_PERSISTENT_CODE +void mp_encode_uint(void *env, mp_encode_uint_allocator_t allocator, mp_uint_t val) { + // We store each 7 bits in a separate byte, and that's how many bytes needed + byte buf[MP_ENCODE_UINT_MAX_BYTES]; + byte *p = buf + sizeof(buf); + // We encode in little-ending order, but store in big-endian, to help decoding + do { + *--p = val & 0x7f; + val >>= 7; + } while (val != 0); + byte *c = allocator(env, buf + sizeof(buf) - p); + if (c != NULL) { + while (p != buf + sizeof(buf) - 1) { + *c++ = *p++ | 0x80; + } + *c = *p; + } +} mp_uint_t mp_decode_uint(const byte **ptr) { mp_uint_t unum = 0; @@ -72,8 +88,6 @@ const byte *mp_decode_uint_skip(const byte *ptr) { return ptr; } -#endif - STATIC NORETURN void fun_pos_args_mismatch(mp_obj_fun_bc_t *f, size_t expected, size_t given) { #if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE // generic message, used also for other argument issues @@ -107,8 +121,8 @@ STATIC void dump_args(const mp_obj_t *a, size_t sz) { // On entry code_state should be allocated somewhere (stack/heap) and // contain the following valid entries: // - code_state->fun_bc should contain a pointer to the function object -// - code_state->ip should contain the offset in bytes from the pointer -// code_state->fun_bc->bytecode to the entry n_state (0 for bytecode, non-zero for native) +// - code_state->ip should contain a pointer to the beginning of the prelude +// - code_state->n_state should be the number of objects in the local state void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw, const mp_obj_t *args) { // This function is pretty complicated. It's main aim is to be efficient in speed and RAM // usage for the common case of positional only args. @@ -116,9 +130,6 @@ void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw // get the function object that we want to set up (could be bytecode or native code) mp_obj_fun_bc_t *self = code_state->fun_bc; - // ip comes in as an offset into bytecode, so turn it into a true pointer - code_state->ip = self->bytecode + (size_t)code_state->ip; - #if MICROPY_STACKLESS code_state->prev = NULL; #endif @@ -134,6 +145,7 @@ void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw // Decode prelude size_t n_state_unused, n_exc_stack_unused, scope_flags, n_pos_args, n_kwonly_args, n_def_pos_args; MP_BC_PRELUDE_SIG_DECODE_INTO(code_state->ip, n_state_unused, n_exc_stack_unused, scope_flags, n_pos_args, n_kwonly_args, n_def_pos_args); + MP_BC_PRELUDE_SIZE_DECODE(code_state->ip); (void)n_state_unused; (void)n_exc_stack_unused; @@ -194,14 +206,20 @@ void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw *var_pos_kw_args = dict; } - // get pointer to arg_names array - const mp_obj_t *arg_names = (const mp_obj_t *)self->const_table; - for (size_t i = 0; i < n_kw; i++) { // the keys in kwargs are expected to be qstr objects mp_obj_t wanted_arg_name = kwargs[2 * i]; + + // get pointer to arg_names array + const uint8_t *arg_names = code_state->ip; + arg_names = mp_decode_uint_skip(arg_names); + for (size_t j = 0; j < n_pos_args + n_kwonly_args; j++) { - if (wanted_arg_name == arg_names[j]) { + qstr arg_qstr = mp_decode_uint(&arg_names); + #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE + arg_qstr = self->context->constants.qstr_table[arg_qstr]; + #endif + if (wanted_arg_name == MP_OBJ_NEW_QSTR(arg_qstr)) { if (code_state->state[n_state - 1 - j] != MP_OBJ_NULL) { mp_raise_msg_varg(&mp_type_TypeError, MP_ERROR_TEXT("function got multiple values for argument '%q'"), MP_OBJ_QSTR_VALUE(wanted_arg_name)); @@ -248,17 +266,25 @@ void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw // Check that all mandatory keyword args are specified // Fill in default kw args if we have them + const uint8_t *arg_names = mp_decode_uint_skip(code_state->ip); + for (size_t i = 0; i < n_pos_args; i++) { + arg_names = mp_decode_uint_skip(arg_names); + } for (size_t i = 0; i < n_kwonly_args; i++) { + qstr arg_qstr = mp_decode_uint(&arg_names); + #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE + arg_qstr = self->context->constants.qstr_table[arg_qstr]; + #endif if (code_state->state[n_state - 1 - n_pos_args - i] == MP_OBJ_NULL) { mp_map_elem_t *elem = NULL; if ((scope_flags & MP_SCOPE_FLAG_DEFKWARGS) != 0) { - elem = mp_map_lookup(&((mp_obj_dict_t *)MP_OBJ_TO_PTR(self->extra_args[n_def_pos_args]))->map, arg_names[n_pos_args + i], MP_MAP_LOOKUP); + elem = mp_map_lookup(&((mp_obj_dict_t *)MP_OBJ_TO_PTR(self->extra_args[n_def_pos_args]))->map, MP_OBJ_NEW_QSTR(arg_qstr), MP_MAP_LOOKUP); } if (elem != NULL) { code_state->state[n_state - 1 - n_pos_args - i] = elem->value; } else { mp_raise_msg_varg(&mp_type_TypeError, - MP_ERROR_TEXT("function missing required keyword argument '%q'"), MP_OBJ_QSTR_VALUE(arg_names[n_pos_args + i])); + MP_ERROR_TEXT("function missing required keyword argument '%q'"), arg_qstr); } } } @@ -273,12 +299,8 @@ void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw } } - // read the size part of the prelude - const byte *ip = code_state->ip; - MP_BC_PRELUDE_SIZE_DECODE(ip); - - // jump over code info (source file and line-number mapping) - ip += n_info; + // jump over code info (source file, argument names and line-number mapping) + const uint8_t *ip = code_state->ip + n_info; // bytecode prelude: initialise closed over variables for (; n_cell; --n_cell) { @@ -287,11 +309,6 @@ void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw mp_obj_new_cell(code_state->state[n_state - 1 - local_num]); } - #if !MICROPY_PERSISTENT_CODE - // so bytecode is aligned - ip = MP_ALIGN(ip, sizeof(mp_uint_t)); - #endif - // now that we skipped over the prelude, set the ip for the VM code_state->ip = ip; diff --git a/py/bc.h b/py/bc.h index ef5afeae16..7d761e30e6 100644 --- a/py/bc.h +++ b/py/bc.h @@ -28,7 +28,6 @@ #define MICROPY_INCLUDED_PY_BC_H #include "py/runtime.h" -#include "py/objfun.h" // bytecode layout: // @@ -50,7 +49,9 @@ // // source info section: // simple_name : var qstr -// source_file : var qstr +// argname0 : var qstr +// ... : var qstr +// argnameN : var qstr N = num_pos_args + num_kwonly_args - 1 // // // closure section: @@ -58,19 +59,16 @@ // ... : byte // local_numN : byte N = n_cells-1 // -// only needed if bytecode contains pointers -// // // // // constant table layout: // -// argname0 : obj (qstr) -// ... : obj (qstr) -// argnameN : obj (qstr) N = num_pos_args + num_kwonly_args // const0 : obj // constN : obj +#define MP_ENCODE_UINT_MAX_BYTES ((MP_BYTES_PER_OBJ_WORD * 8 + 6) / 7) + #define MP_BC_PRELUDE_SIG_ENCODE(S, E, scope, out_byte, out_env) \ do { \ /*// Get values to store in prelude */ \ @@ -182,9 +180,9 @@ typedef struct _mp_bytecode_prelude_t { uint n_pos_args; uint n_kwonly_args; uint n_def_pos_args; - qstr qstr_block_name; - qstr qstr_source_file; + qstr qstr_block_name_idx; const byte *line_info; + const byte *line_info_top; const byte *opcodes; } mp_bytecode_prelude_t; @@ -198,12 +196,46 @@ typedef struct _mp_exc_stack_t { mp_obj_base_t *prev_exc; } mp_exc_stack_t; +// Constants associated with a module, to interface bytecode with runtime. +typedef struct _mp_module_constants_t { + #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE + qstr_short_t *qstr_table; + #else + qstr source_file; + #endif + mp_obj_t *obj_table; +} mp_module_constants_t; + +// State associated with a module. +typedef struct _mp_module_context_t { + mp_obj_module_t module; + mp_module_constants_t constants; +} mp_module_context_t; + +// Outer level struct defining a compiled module. +typedef struct _mp_compiled_module_t { + const mp_module_context_t *context; + const struct _mp_raw_code_t *rc; + #if MICROPY_PERSISTENT_CODE_SAVE + bool has_native; + size_t n_qstr; + size_t n_obj; + #endif +} mp_compiled_module_t; + +// Outer level struct defining a frozen module. +typedef struct _mp_frozen_module_t { + const mp_module_constants_t constants; + const struct _mp_raw_code_t *rc; +} mp_frozen_module_t; + +// State for an executing function. typedef struct _mp_code_state_t { // The fun_bc entry points to the underlying function object that is being executed. // It is needed to access the start of bytecode and the const_table. // It is also needed to prevent the GC from reclaiming the bytecode during execution, // because the ip pointer below will always point to the interior of the bytecode. - mp_obj_fun_bc_t *fun_bc; + struct _mp_obj_fun_bc_t *fun_bc; const byte *ip; mp_obj_t *sp; uint16_t n_state; @@ -222,6 +254,10 @@ typedef struct _mp_code_state_t { // mp_exc_stack_t exc_state[0]; } mp_code_state_t; +// Allocator may return NULL, in which case data is not stored (can be used to compute size). +typedef uint8_t *(*mp_encode_uint_allocator_t)(void *env, size_t nbytes); + +void mp_encode_uint(void *env, mp_encode_uint_allocator_t allocator, mp_uint_t val); mp_uint_t mp_decode_uint(const byte **ptr); mp_uint_t mp_decode_uint_value(const byte *ptr); const byte *mp_decode_uint_skip(const byte *ptr); @@ -229,10 +265,10 @@ const byte *mp_decode_uint_skip(const byte *ptr); mp_vm_return_kind_t mp_execute_bytecode(mp_code_state_t *code_state, volatile mp_obj_t inject_exc); mp_code_state_t *mp_obj_fun_bc_prepare_codestate(mp_obj_t func, size_t n_args, size_t n_kw, const mp_obj_t *args); void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw, const mp_obj_t *args); -void mp_bytecode_print(const mp_print_t *print, const void *descr, const byte *code, mp_uint_t len, const mp_uint_t *const_table); -void mp_bytecode_print2(const mp_print_t *print, const byte *code, size_t len, const mp_uint_t *const_table); +void mp_bytecode_print(const mp_print_t *print, const void *descr, const byte *code, mp_uint_t len, const mp_module_constants_t *cm); +void mp_bytecode_print2(const mp_print_t *print, const byte *code, size_t len, const mp_module_constants_t *cm); const byte *mp_bytecode_print_str(const mp_print_t *print, const byte *ip); -#define mp_bytecode_print_inst(print, code, const_table) mp_bytecode_print2(print, code, 1, const_table) +#define mp_bytecode_print_inst(print, code, x_table) mp_bytecode_print2(print, code, 1, x_table) // Helper macros to access pointer with least significant bits holding flags #define MP_TAGPTR_PTR(x) ((void *)((uintptr_t)(x) & ~((uintptr_t)3))) @@ -246,10 +282,26 @@ uint mp_opcode_format(const byte *ip, size_t *opcode_size, bool count_var_uint); #endif -static inline size_t mp_bytecode_get_source_line(const byte *line_info, size_t bc_offset) { +static inline void mp_module_context_alloc_tables(mp_module_context_t *context, size_t n_qstr, size_t n_obj) { + #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE + size_t nq = (n_qstr * sizeof(qstr_short_t) + sizeof(mp_uint_t) - 1) / sizeof(mp_uint_t); + size_t no = n_obj; + mp_uint_t *mem = m_new(mp_uint_t, nq + no); + context->constants.qstr_table = (void *)(mem); + context->constants.obj_table = (void *)(mem + nq); + #else + if (n_obj == 0) { + context->constants.obj_table = NULL; + } else { + context->constants.obj_table = m_new(mp_obj_t, n_obj); + } + #endif +} + +static inline size_t mp_bytecode_get_source_line(const byte *line_info, const byte *line_info_top, size_t bc_offset) { size_t source_line = 1; - size_t c; - while ((c = *line_info)) { + while (line_info < line_info_top) { + size_t c = *line_info; size_t b, l; if ((c & 0x80) == 0) { // 0b0LLBBBBB encoding diff --git a/py/builtinevex.c b/py/builtinevex.c index 800a20223a..4e1c6a66d1 100644 --- a/py/builtinevex.c +++ b/py/builtinevex.c @@ -54,7 +54,7 @@ STATIC mp_obj_t code_execute(mp_obj_code_t *self, mp_obj_dict_t *globals, mp_obj // the correct one if (mp_obj_is_type(self->module_fun, &mp_type_fun_bc)) { mp_obj_fun_bc_t *fun_bc = MP_OBJ_TO_PTR(self->module_fun); - fun_bc->globals = globals; + ((mp_module_context_t *)fun_bc->context)->module.globals = globals; } // execute code diff --git a/py/builtinimport.c b/py/builtinimport.c index 3e336633d9..094959f97d 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -146,28 +146,28 @@ STATIC mp_import_stat_t stat_top_level_dir_or_file(qstr mod_name, vstr_t *dest) } #if MICROPY_MODULE_FROZEN_STR || MICROPY_ENABLE_COMPILER -STATIC void do_load_from_lexer(mp_obj_t module_obj, mp_lexer_t *lex) { +STATIC void do_load_from_lexer(mp_module_context_t *context, mp_lexer_t *lex) { #if MICROPY_PY___FILE__ qstr source_name = lex->source_name; - mp_store_attr(module_obj, MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name)); + mp_store_attr(MP_OBJ_FROM_PTR(&context->module), MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name)); #endif // parse, compile and execute the module in its context - mp_obj_dict_t *mod_globals = mp_obj_module_get_globals(module_obj); + mp_obj_dict_t *mod_globals = context->module.globals; mp_parse_compile_execute(lex, MP_PARSE_FILE_INPUT, mod_globals, mod_globals); } #endif #if (MICROPY_HAS_FILE_READER && MICROPY_PERSISTENT_CODE_LOAD) || MICROPY_MODULE_FROZEN_MPY -STATIC void do_execute_raw_code(mp_obj_t module_obj, mp_raw_code_t *raw_code, const char *source_name) { +STATIC void do_execute_raw_code(mp_module_context_t *context, const mp_raw_code_t *rc, const mp_module_context_t *mc, const char *source_name) { (void)source_name; #if MICROPY_PY___FILE__ - mp_store_attr(module_obj, MP_QSTR___file__, MP_OBJ_NEW_QSTR(qstr_from_str(source_name))); + mp_store_attr(MP_OBJ_FROM_PTR(&context->module), MP_QSTR___file__, MP_OBJ_NEW_QSTR(qstr_from_str(source_name))); #endif // execute the module in its context - mp_obj_dict_t *mod_globals = mp_obj_module_get_globals(module_obj); + mp_obj_dict_t *mod_globals = context->module.globals; // save context mp_obj_dict_t *volatile old_globals = mp_globals_get(); @@ -179,7 +179,7 @@ STATIC void do_execute_raw_code(mp_obj_t module_obj, mp_raw_code_t *raw_code, co nlr_buf_t nlr; if (nlr_push(&nlr) == 0) { - mp_obj_t module_fun = mp_make_function_from_raw_code(raw_code, MP_OBJ_NULL, MP_OBJ_NULL); + mp_obj_t module_fun = mp_make_function_from_raw_code(rc, mc, NULL); mp_call_function_0(module_fun); // finish nlr block, restore context @@ -195,7 +195,7 @@ STATIC void do_execute_raw_code(mp_obj_t module_obj, mp_raw_code_t *raw_code, co } #endif -STATIC void do_load(mp_obj_t module_obj, vstr_t *file) { +STATIC void do_load(mp_module_context_t *module_obj, vstr_t *file) { #if MICROPY_MODULE_FROZEN || MICROPY_ENABLE_COMPILER || (MICROPY_PERSISTENT_CODE_LOAD && MICROPY_HAS_FILE_READER) const char *file_str = vstr_null_terminated_str(file); #endif @@ -222,7 +222,9 @@ STATIC void do_load(mp_obj_t module_obj, vstr_t *file) { // its data) in the list of frozen files, execute it. #if MICROPY_MODULE_FROZEN_MPY if (frozen_type == MP_FROZEN_MPY) { - do_execute_raw_code(module_obj, modref, file_str + frozen_path_prefix_len); + const mp_frozen_module_t *frozen = modref; + module_obj->constants = frozen->constants; + do_execute_raw_code(module_obj, frozen->rc, module_obj, file_str + frozen_path_prefix_len); return; } #endif @@ -234,8 +236,8 @@ STATIC void do_load(mp_obj_t module_obj, vstr_t *file) { // the correct format and, if so, load and execute the file. #if MICROPY_HAS_FILE_READER && MICROPY_PERSISTENT_CODE_LOAD if (file_str[file->len - 3] == 'm') { - mp_raw_code_t *raw_code = mp_raw_code_load_file(file_str); - do_execute_raw_code(module_obj, raw_code, file_str); + mp_compiled_module_t cm = mp_raw_code_load_file(file_str, module_obj); + do_execute_raw_code(module_obj, cm.rc, cm.context, file_str); return; } #endif @@ -434,7 +436,7 @@ STATIC mp_obj_t process_import_at_level(qstr full_mod_name, qstr level_mod_name, size_t orig_path_len = path->len; vstr_add_str(path, PATH_SEP_CHAR "__init__.py"); if (stat_file_py_or_mpy(path) == MP_IMPORT_STAT_FILE) { - do_load(module_obj, path); + do_load(MP_OBJ_TO_PTR(module_obj), path); } else { // No-op. Nothing to load. // mp_warning("%s is imported as namespace package", vstr_str(&path)); @@ -443,7 +445,7 @@ STATIC mp_obj_t process_import_at_level(qstr full_mod_name, qstr level_mod_name, path->len = orig_path_len; } else { // MP_IMPORT_STAT_FILE // File -- execute "path.(m)py". - do_load(module_obj, path); + do_load(MP_OBJ_TO_PTR(module_obj), path); // Note: This should be the last component in the import path. If // there are remaining components then it's an ImportError // because the current path(the module that was just loaded) is diff --git a/py/compile.c b/py/compile.c index 8ebcc2289f..92736e22e5 100644 --- a/py/compile.c +++ b/py/compile.c @@ -35,6 +35,7 @@ #include "py/compile.h" #include "py/runtime.h" #include "py/asmbase.h" +#include "py/nativeglue.h" #include "py/persistentcode.h" #if MICROPY_ENABLE_COMPILER @@ -88,7 +89,7 @@ typedef enum { #if MICROPY_EMIT_NATIVE && MICROPY_DYNAMIC_COMPILER #define NATIVE_EMITTER(f) emit_native_table[mp_dynamic_compiler.native_arch]->emit_##f -#define NATIVE_EMITTER_TABLE emit_native_table[mp_dynamic_compiler.native_arch] +#define NATIVE_EMITTER_TABLE (emit_native_table[mp_dynamic_compiler.native_arch]) STATIC const emit_method_table_t *emit_native_table[] = { NULL, @@ -121,7 +122,7 @@ STATIC const emit_method_table_t *emit_native_table[] = { #else #error "unknown native emitter" #endif -#define NATIVE_EMITTER_TABLE &NATIVE_EMITTER(method_table) +#define NATIVE_EMITTER_TABLE (&NATIVE_EMITTER(method_table)) #endif #if MICROPY_EMIT_INLINE_ASM && MICROPY_DYNAMIC_COMPILER @@ -162,8 +163,6 @@ STATIC const emit_inline_asm_method_table_t *emit_asm_table[] = { // elements in this struct are ordered to make it compact typedef struct _compiler_t { - qstr source_file; - uint8_t is_repl; uint8_t pass; // holds enum type pass_kind_t uint8_t have_star; @@ -185,7 +184,10 @@ typedef struct _compiler_t { scope_t *scope_head; scope_t *scope_cur; + mp_emit_common_t emit_common; + emit_t *emit; // current emitter + emit_t *emit_bc; #if NEED_METHOD_TABLE const emit_method_table_t *emit_method_table; // current emit method table #endif @@ -196,6 +198,72 @@ typedef struct _compiler_t { #endif } compiler_t; +/******************************************************************************/ +// mp_emit_common_t helper functions +// These are defined here so they can be inlined, to reduce code size. + +STATIC void mp_emit_common_init(mp_emit_common_t *emit, qstr source_file) { + #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE + mp_map_init(&emit->qstr_map, 1); + + // add the source file as the first entry in the qstr table + mp_map_elem_t *elem = mp_map_lookup(&emit->qstr_map, MP_OBJ_NEW_QSTR(source_file), MP_MAP_LOOKUP_ADD_IF_NOT_FOUND); + elem->value = MP_OBJ_NEW_SMALL_INT(0); + #endif +} + +STATIC void mp_emit_common_start_pass(mp_emit_common_t *emit, pass_kind_t pass) { + emit->pass = pass; + if (pass == MP_PASS_STACK_SIZE) { + emit->ct_cur_obj_base = emit->ct_cur_obj; + } else if (pass > MP_PASS_STACK_SIZE) { + emit->ct_cur_obj = emit->ct_cur_obj_base; + } + if (pass == MP_PASS_EMIT) { + if (emit->ct_cur_child == 0) { + emit->children = NULL; + } else { + emit->children = m_new0(mp_raw_code_t *, emit->ct_cur_child); + } + } + emit->ct_cur_child = 0; +} + +STATIC void mp_emit_common_finalise(mp_emit_common_t *emit, bool has_native_code) { + emit->ct_cur_obj += has_native_code; // allocate an additional slot for &mp_fun_table + emit->const_table = m_new0(mp_uint_t, emit->ct_cur_obj); + emit->ct_cur_obj = has_native_code; // reserve slot 0 for &mp_fun_table + #if MICROPY_EMIT_NATIVE + if (has_native_code) { + // store mp_fun_table pointer at the start of the constant table + emit->const_table[0] = (mp_uint_t)(uintptr_t)&mp_fun_table; + } + #endif +} + +STATIC void mp_emit_common_populate_module_context(mp_emit_common_t *emit, qstr source_file, mp_module_context_t *context) { + #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE + size_t qstr_map_used = emit->qstr_map.used; + mp_module_context_alloc_tables(context, qstr_map_used, emit->ct_cur_obj); + for (size_t i = 0; i < emit->qstr_map.alloc; ++i) { + if (mp_map_slot_is_filled(&emit->qstr_map, i)) { + size_t idx = MP_OBJ_SMALL_INT_VALUE(emit->qstr_map.table[i].value); + qstr qst = MP_OBJ_QSTR_VALUE(emit->qstr_map.table[i].key); + context->constants.qstr_table[idx] = qst; + } + } + #else + mp_module_context_alloc_tables(context, 0, emit->ct_cur_obj); + context->constants.source_file = source_file; + #endif + + if (emit->ct_cur_obj > 0) { + memcpy(context->constants.obj_table, emit->const_table, emit->ct_cur_obj * sizeof(mp_uint_t)); + } +} + +/******************************************************************************/ + STATIC void compile_error_set_line(compiler_t *comp, mp_parse_node_t pn) { // if the line of the error is unknown then try to update it from the pn if (comp->compile_error_line == 0 && MP_PARSE_NODE_IS_STRUCT(pn)) { @@ -246,7 +314,7 @@ STATIC void compile_decrease_except_level(compiler_t *comp) { } STATIC scope_t *scope_new_and_link(compiler_t *comp, scope_kind_t kind, mp_parse_node_t pn, uint emit_options) { - scope_t *scope = scope_new(kind, pn, comp->source_file, emit_options); + scope_t *scope = scope_new(kind, pn, emit_options); scope->parent = comp->scope_cur; scope->next = NULL; if (comp->scope_head == NULL) { @@ -290,7 +358,8 @@ STATIC void compile_generic_all_nodes(compiler_t *comp, mp_parse_node_struct_t * STATIC void compile_load_id(compiler_t *comp, qstr qst) { if (comp->pass == MP_PASS_SCOPE) { mp_emit_common_get_id_for_load(comp->scope_cur, qst); - } else { + } + { #if NEED_METHOD_TABLE mp_emit_common_id_op(comp->emit, &comp->emit_method_table->load_id, comp->scope_cur, qst); #else @@ -302,7 +371,8 @@ STATIC void compile_load_id(compiler_t *comp, qstr qst) { STATIC void compile_store_id(compiler_t *comp, qstr qst) { if (comp->pass == MP_PASS_SCOPE) { mp_emit_common_get_id_for_modification(comp->scope_cur, qst); - } else { + } + { #if NEED_METHOD_TABLE mp_emit_common_id_op(comp->emit, &comp->emit_method_table->store_id, comp->scope_cur, qst); #else @@ -314,7 +384,8 @@ STATIC void compile_store_id(compiler_t *comp, qstr qst) { STATIC void compile_delete_id(compiler_t *comp, qstr qst) { if (comp->pass == MP_PASS_SCOPE) { mp_emit_common_get_id_for_modification(comp->scope_cur, qst); - } else { + } + { #if NEED_METHOD_TABLE mp_emit_common_id_op(comp->emit, &comp->emit_method_table->delete_id, comp->scope_cur, qst); #else @@ -819,7 +890,7 @@ STATIC bool compile_built_in_decorator(compiler_t *comp, size_t name_len, mp_par compile_syntax_error(comp, name_nodes[1], MP_ERROR_TEXT("invalid micropython decorator")); } - #if MICROPY_DYNAMIC_COMPILER + #if MICROPY_EMIT_NATIVE && MICROPY_DYNAMIC_COMPILER if (*emit_options == MP_EMIT_OPT_NATIVE_PYTHON || *emit_options == MP_EMIT_OPT_VIPER) { if (emit_native_table[mp_dynamic_compiler.native_arch] == NULL) { compile_syntax_error(comp, name_nodes[1], MP_ERROR_TEXT("invalid arch")); @@ -2082,6 +2153,7 @@ STATIC void compile_lambdef(compiler_t *comp, mp_parse_node_struct_t *pns) { STATIC void compile_namedexpr_helper(compiler_t *comp, mp_parse_node_t pn_name, mp_parse_node_t pn_expr) { if (!MP_PARSE_NODE_IS_ID(pn_name)) { compile_syntax_error(comp, (mp_parse_node_t)pn_name, MP_ERROR_TEXT("can't assign to expression")); + return; // because pn_name is not a valid qstr (in compile_store_id below) } compile_node(comp, pn_expr); EMIT(dup_top); @@ -2814,6 +2886,7 @@ STATIC void compile_scope_func_lambda_param(compiler_t *comp, mp_parse_node_t pn // comes before a star, so counts as a positional parameter comp->scope_cur->num_pos_args += 1; } + mp_emit_common_use_qstr(&comp->emit_common, param_name); } else { assert(MP_PARSE_NODE_IS_STRUCT(pn)); pns = (mp_parse_node_struct_t *)pn; @@ -2827,6 +2900,7 @@ STATIC void compile_scope_func_lambda_param(compiler_t *comp, mp_parse_node_t pn // comes before a star, so counts as a positional parameter comp->scope_cur->num_pos_args += 1; } + mp_emit_common_use_qstr(&comp->emit_common, param_name); } else if (MP_PARSE_NODE_STRUCT_KIND(pns) == pn_star) { if (comp->have_star) { // more than one star @@ -2976,6 +3050,7 @@ STATIC void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) { comp->pass = pass; comp->scope_cur = scope; comp->next_label = 0; + mp_emit_common_start_pass(&comp->emit_common, pass); EMIT_ARG(start_pass, pass, scope); reserve_labels_for_native(comp, 6); // used by native's start_pass @@ -2984,6 +3059,14 @@ STATIC void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) { // they will be computed in this first pass scope->stack_size = 0; scope->exc_stack_size = 0; + + #if MICROPY_EMIT_NATIVE + if (scope->emit_options == MP_EMIT_OPT_NATIVE_PYTHON || scope->emit_options == MP_EMIT_OPT_VIPER) { + // allow native code to perfom basic tasks during the pass scope + // note: the first argument passed here is mp_emit_common_t, not the native emitter context + NATIVE_EMITTER_TABLE->start_pass((void *)&comp->emit_common, comp->pass, scope); + } + #endif } // compile @@ -3064,6 +3147,7 @@ STATIC void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) { if (comp->pass == MP_PASS_SCOPE) { scope_find_or_add_id(comp->scope_cur, qstr_arg, ID_INFO_KIND_LOCAL); scope->num_pos_args = 1; + mp_emit_common_use_qstr(&comp->emit_common, MP_QSTR__star_); } // Set the source line number for the start of the comprehension @@ -3296,9 +3380,10 @@ STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind f, mp_asm_base_get_code_size((mp_asm_base_t *)comp->emit_inline_asm), NULL, #if MICROPY_PERSISTENT_CODE_SAVE - 0, 0, 0, 0, NULL, + 0, + 0, 0, NULL, #endif - comp->scope_cur->num_pos_args, 0, type_sig); + 0, comp->scope_cur->num_pos_args, type_sig); } } @@ -3310,7 +3395,7 @@ STATIC void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind } #endif -STATIC void scope_compute_things(scope_t *scope) { +STATIC void scope_compute_things(scope_t *scope, mp_emit_common_t *emit_common) { // in MicroPython we put the *x parameter after all other parameters (except **y) if (scope->scope_flags & MP_SCOPE_FLAG_VARARGS) { id_info_t *id_param = NULL; @@ -3399,6 +3484,7 @@ STATIC void scope_compute_things(scope_t *scope) { } scope->num_pos_args += num_free; // free vars are counted as params for passing them into the function scope->num_locals += num_free; + mp_emit_common_use_qstr(emit_common, MP_QSTR__star_); } } } @@ -3406,15 +3492,15 @@ STATIC void scope_compute_things(scope_t *scope) { #if !MICROPY_PERSISTENT_CODE_SAVE STATIC #endif -mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_file, bool is_repl) { +mp_compiled_module_t mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_file, bool is_repl, mp_module_context_t *context) { // put compiler state on the stack, it's relatively small compiler_t comp_state = {0}; compiler_t *comp = &comp_state; - comp->source_file = source_file; comp->is_repl = is_repl; comp->break_label = INVALID_LABEL; comp->continue_label = INVALID_LABEL; + mp_emit_common_init(&comp->emit_common, source_file); // create the module scope #if MICROPY_EMIT_NATIVE @@ -3425,10 +3511,11 @@ mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_f scope_t *module_scope = scope_new_and_link(comp, SCOPE_MODULE, parse_tree->root, emit_opt); // create standard emitter; it's used at least for MP_PASS_SCOPE - emit_t *emit_bc = emit_bc_new(); + emit_t *emit_bc = emit_bc_new(&comp->emit_common); - // compile pass 1 + // compile MP_PASS_SCOPE comp->emit = emit_bc; + comp->emit_bc = emit_bc; #if MICROPY_EMIT_NATIVE comp->emit_method_table = &emit_bc_method_table; #endif @@ -3458,14 +3545,24 @@ mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_f } // compute some things related to scope and identifiers + bool has_native_code = false; for (scope_t *s = comp->scope_head; s != NULL && comp->compile_error == MP_OBJ_NULL; s = s->next) { - scope_compute_things(s); + #if MICROPY_EMIT_NATIVE + if (s->emit_options == MP_EMIT_OPT_NATIVE_PYTHON || s->emit_options == MP_EMIT_OPT_VIPER) { + has_native_code = true; + } + #endif + + scope_compute_things(s, &comp->emit_common); } // set max number of labels now that it's calculated emit_bc_set_max_num_labels(emit_bc, max_num_labels); - // compile pass 2 and 3 + // finalise and allocate the constant table + mp_emit_common_finalise(&comp->emit_common, has_native_code); + + // compile MP_PASS_STACK_SIZE, MP_PASS_CODE_SIZE, MP_PASS_EMIT #if MICROPY_EMIT_NATIVE emit_t *emit_native = NULL; #endif @@ -3505,7 +3602,7 @@ mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_f case MP_EMIT_OPT_NATIVE_PYTHON: case MP_EMIT_OPT_VIPER: if (emit_native == NULL) { - emit_native = NATIVE_EMITTER(new)(&comp->compile_error, &comp->next_label, max_num_labels); + emit_native = NATIVE_EMITTER(new)(&comp->emit_common, &comp->compile_error, &comp->next_label, max_num_labels); } comp->emit_method_table = NATIVE_EMITTER_TABLE; comp->emit = emit_native; @@ -3540,10 +3637,33 @@ mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_f // number for the start of this scope compile_error_set_line(comp, comp->scope_cur->pn); // add a traceback to the exception using relevant source info - mp_obj_exception_add_traceback(comp->compile_error, comp->source_file, + mp_obj_exception_add_traceback(comp->compile_error, source_file, comp->compile_error_line, comp->scope_cur->simple_name); } + // construct the global qstr/const table for this module + mp_compiled_module_t cm; + cm.rc = module_scope->raw_code; + cm.context = context; + #if MICROPY_PERSISTENT_CODE_SAVE + cm.has_native = has_native_code; + cm.n_qstr = comp->emit_common.qstr_map.used; + cm.n_obj = comp->emit_common.ct_cur_obj; + #endif + if (comp->compile_error == MP_OBJ_NULL) { + mp_emit_common_populate_module_context(&comp->emit_common, source_file, context); + + #if MICROPY_DEBUG_PRINTERS + // now that the module context is valid, the raw codes can be printed + if (mp_verbose_flag >= 2) { + for (scope_t *s = comp->scope_head; s != NULL; s = s->next) { + mp_raw_code_t *rc = s->raw_code; + mp_bytecode_print(&mp_plat_print, rc, rc->fun_data, rc->fun_data_len, &cm.context->constants); + } + } + #endif + } + // free the emitters emit_bc_free(emit_bc); @@ -3562,7 +3682,6 @@ mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_f mp_parse_tree_clear(parse_tree); // free the scopes - mp_raw_code_t *outer_raw_code = module_scope->raw_code; for (scope_t *s = module_scope; s;) { scope_t *next = s->next; scope_free(s); @@ -3571,15 +3690,17 @@ mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_f if (comp->compile_error != MP_OBJ_NULL) { nlr_raise(comp->compile_error); - } else { - return outer_raw_code; } + + return cm; } mp_obj_t mp_compile(mp_parse_tree_t *parse_tree, qstr source_file, bool is_repl) { - mp_raw_code_t *rc = mp_compile_to_raw_code(parse_tree, source_file, is_repl); + mp_module_context_t *context = m_new_obj(mp_module_context_t); + context->module.globals = mp_globals_get(); + mp_compiled_module_t cm = mp_compile_to_raw_code(parse_tree, source_file, is_repl, context); // return function that executes the outer module - return mp_make_function_from_raw_code(rc, MP_OBJ_NULL, MP_OBJ_NULL); + return mp_make_function_from_raw_code(cm.rc, cm.context, NULL); } #endif // MICROPY_ENABLE_COMPILER diff --git a/py/compile.h b/py/compile.h index 1ad1f5e9cd..ae87bf2a04 100644 --- a/py/compile.h +++ b/py/compile.h @@ -32,11 +32,12 @@ // the compiler will raise an exception if an error occurred // the compiler will clear the parse tree before it returns +// mp_globals_get() will be used for the context mp_obj_t mp_compile(mp_parse_tree_t *parse_tree, qstr source_file, bool is_repl); #if MICROPY_PERSISTENT_CODE_SAVE // this has the same semantics as mp_compile -mp_raw_code_t *mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_file, bool is_repl); +mp_compiled_module_t mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr source_file, bool is_repl, mp_module_context_t *globals); #endif // this is implemented in runtime.c diff --git a/py/dynruntime.h b/py/dynruntime.h index fdb91ed37e..b9dca60d13 100644 --- a/py/dynruntime.h +++ b/py/dynruntime.h @@ -30,6 +30,7 @@ // MicroPython runtime API defined in py/obj.h and py/runtime.h. #include "py/nativeglue.h" +#include "py/objfun.h" #include "py/objstr.h" #include "py/objtype.h" @@ -177,8 +178,8 @@ static inline mp_obj_t mp_obj_len_dyn(mp_obj_t o) { #define mp_unary_op(op, obj) (mp_fun_table.unary_op((op), (obj))) #define mp_binary_op(op, lhs, rhs) (mp_fun_table.binary_op((op), (lhs), (rhs))) -#define mp_make_function_from_raw_code(rc, def_args, def_kw_args) \ - (mp_fun_table.make_function_from_raw_code((rc), (def_args), (def_kw_args))) +#define mp_make_function_from_raw_code(rc, context, def_args) \ + (mp_fun_table.make_function_from_raw_code((rc), (context), (def_args))) #define mp_call_function_n_kw(fun, n_args, n_kw, args) \ (mp_fun_table.call_function_n_kw((fun), (n_args) | ((n_kw) << 8), args)) @@ -187,11 +188,10 @@ static inline mp_obj_t mp_obj_len_dyn(mp_obj_t o) { (mp_fun_table.arg_check_num_sig((n_args), (n_kw), MP_OBJ_FUN_MAKE_SIG((n_args_min), (n_args_max), (takes_kw)))) #define MP_DYNRUNTIME_INIT_ENTRY \ - mp_obj_t old_globals = mp_fun_table.swap_globals(self->globals); \ + mp_obj_t old_globals = mp_fun_table.swap_globals(self->context->module.globals); \ mp_raw_code_t rc; \ rc.kind = MP_CODE_NATIVE_VIPER; \ rc.scope_flags = 0; \ - rc.const_table = (void *)self->const_table; \ (void)rc; #define MP_DYNRUNTIME_INIT_EXIT \ @@ -199,7 +199,7 @@ static inline mp_obj_t mp_obj_len_dyn(mp_obj_t o) { return mp_const_none; #define MP_DYNRUNTIME_MAKE_FUNCTION(f) \ - (mp_make_function_from_raw_code((rc.fun_data = (f), &rc), MP_OBJ_NULL, MP_OBJ_NULL)) + (mp_make_function_from_raw_code((rc.fun_data = (f), &rc), self->context, NULL)) #define mp_import_name(name, fromlist, level) \ (mp_fun_table.import_name((name), (fromlist), (level))) diff --git a/py/emit.h b/py/emit.h index 13bd3e9b2e..6f3593a0e8 100644 --- a/py/emit.h +++ b/py/emit.h @@ -92,6 +92,18 @@ typedef enum { typedef struct _emit_t emit_t; +typedef struct _mp_emit_common_t { + pass_kind_t pass; + uint16_t ct_cur_obj_base; + uint16_t ct_cur_obj; + uint16_t ct_cur_child; + mp_uint_t *const_table; + mp_raw_code_t **children; + #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE + mp_map_t qstr_map; + #endif +} mp_emit_common_t; + typedef struct _mp_emit_method_table_id_ops_t { void (*local)(emit_t *emit, qstr qst, mp_uint_t local_num, int kind); void (*global)(emit_t *emit, qstr qst, int kind); @@ -99,7 +111,7 @@ typedef struct _mp_emit_method_table_id_ops_t { typedef struct _emit_method_table_t { #if MICROPY_DYNAMIC_COMPILER - emit_t *(*emit_new)(mp_obj_t * error_slot, uint *label_slot, mp_uint_t max_num_labels); + emit_t *(*emit_new)(mp_emit_common_t * emit_common, mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels); void (*emit_free)(emit_t *emit); #endif @@ -161,6 +173,28 @@ typedef struct _emit_method_table_t { void (*end_except_handler)(emit_t *emit); } emit_method_table_t; +#if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE +qstr_short_t mp_emit_common_use_qstr(mp_emit_common_t *emit, qstr qst); +#else +static inline qstr_short_t mp_emit_common_use_qstr(mp_emit_common_t *emit, qstr qst) { + return qst; +} +#endif + +static inline size_t mp_emit_common_alloc_const_obj(mp_emit_common_t *emit, mp_obj_t obj) { + if (emit->pass == MP_PASS_EMIT) { + emit->const_table[emit->ct_cur_obj] = (mp_uint_t)obj; + } + return emit->ct_cur_obj++; +} + +static inline size_t mp_emit_common_alloc_const_child(mp_emit_common_t *emit, mp_raw_code_t *rc) { + if (emit->pass == MP_PASS_EMIT) { + emit->children[emit->ct_cur_child] = rc; + } + return emit->ct_cur_child++; +} + static inline void mp_emit_common_get_id_for_load(scope_t *scope, qstr qst) { scope_find_or_add_id(scope, qst, ID_INFO_KIND_GLOBAL_IMPLICIT); } @@ -180,13 +214,13 @@ extern const mp_emit_method_table_id_ops_t mp_emit_bc_method_table_load_id_ops; extern const mp_emit_method_table_id_ops_t mp_emit_bc_method_table_store_id_ops; extern const mp_emit_method_table_id_ops_t mp_emit_bc_method_table_delete_id_ops; -emit_t *emit_bc_new(void); -emit_t *emit_native_x64_new(mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels); -emit_t *emit_native_x86_new(mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels); -emit_t *emit_native_thumb_new(mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels); -emit_t *emit_native_arm_new(mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels); -emit_t *emit_native_xtensa_new(mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels); -emit_t *emit_native_xtensawin_new(mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels); +emit_t *emit_bc_new(mp_emit_common_t *emit_common); +emit_t *emit_native_x64_new(mp_emit_common_t *emit_common, mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels); +emit_t *emit_native_x86_new(mp_emit_common_t *emit_common, mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels); +emit_t *emit_native_thumb_new(mp_emit_common_t *emit_common, mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels); +emit_t *emit_native_arm_new(mp_emit_common_t *emit_common, mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels); +emit_t *emit_native_xtensa_new(mp_emit_common_t *emit_common, mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels); +emit_t *emit_native_xtensawin_new(mp_emit_common_t *emit_common, mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels); void emit_bc_set_max_num_labels(emit_t *emit, mp_uint_t max_num_labels); diff --git a/py/emitbc.c b/py/emitbc.c index ca74046033..c04701ca78 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -36,8 +36,7 @@ #if MICROPY_ENABLE_COMPILER -#define BYTES_FOR_INT ((MP_BYTES_PER_OBJ_WORD * 8 + 6) / 7) -#define DUMMY_DATA_SIZE (BYTES_FOR_INT) +#define DUMMY_DATA_SIZE (MP_ENCODE_UINT_MAX_BYTES) struct _emit_t { // Accessed as mp_obj_t, so must be aligned as such, and we rely on the @@ -50,6 +49,7 @@ struct _emit_t { int stack_size; + mp_emit_common_t *emit_common; scope_t *scope; mp_uint_t last_source_line_offset; @@ -66,17 +66,11 @@ struct _emit_t { size_t n_info; size_t n_cell; - - #if MICROPY_PERSISTENT_CODE - uint16_t ct_cur_obj; - uint16_t ct_num_obj; - uint16_t ct_cur_raw_code; - #endif - mp_uint_t *const_table; }; -emit_t *emit_bc_new(void) { +emit_t *emit_bc_new(mp_emit_common_t *emit_common) { emit_t *emit = m_new0(emit_t, 1); + emit->emit_common = emit_common; return emit; } @@ -90,26 +84,9 @@ void emit_bc_free(emit_t *emit) { m_del_obj(emit_t, emit); } -typedef byte *(*emit_allocator_t)(emit_t *emit, int nbytes); - -STATIC void emit_write_uint(emit_t *emit, emit_allocator_t allocator, mp_uint_t val) { - // We store each 7 bits in a separate byte, and that's how many bytes needed - byte buf[BYTES_FOR_INT]; - byte *p = buf + sizeof(buf); - // We encode in little-ending order, but store in big-endian, to help decoding - do { - *--p = val & 0x7f; - val >>= 7; - } while (val != 0); - byte *c = allocator(emit, buf + sizeof(buf) - p); - while (p != buf + sizeof(buf) - 1) { - *c++ = *p++ | 0x80; - } - *c = *p; -} - // all functions must go through this one to emit code info -STATIC byte *emit_get_cur_to_write_code_info(emit_t *emit, int num_bytes_to_write) { +STATIC uint8_t *emit_get_cur_to_write_code_info(void *emit_in, size_t num_bytes_to_write) { + emit_t *emit = emit_in; if (emit->pass < MP_PASS_EMIT) { emit->code_info_offset += num_bytes_to_write; return emit->dummy_data; @@ -126,14 +103,7 @@ STATIC void emit_write_code_info_byte(emit_t *emit, byte val) { } STATIC void emit_write_code_info_qstr(emit_t *emit, qstr qst) { - #if MICROPY_PERSISTENT_CODE - assert((qst >> 16) == 0); - byte *c = emit_get_cur_to_write_code_info(emit, 2); - c[0] = qst; - c[1] = qst >> 8; - #else - emit_write_uint(emit, emit_get_cur_to_write_code_info, qst); - #endif + mp_encode_uint(emit, emit_get_cur_to_write_code_info, mp_emit_common_use_qstr(emit->emit_common, qst)); } #if MICROPY_ENABLE_SOURCE_LINE @@ -166,7 +136,8 @@ STATIC void emit_write_code_info_bytes_lines(emit_t *emit, mp_uint_t bytes_to_sk #endif // all functions must go through this one to emit byte code -STATIC byte *emit_get_cur_to_write_bytecode(emit_t *emit, int num_bytes_to_write) { +STATIC uint8_t *emit_get_cur_to_write_bytecode(void *emit_in, size_t num_bytes_to_write) { + emit_t *emit = emit_in; if (emit->pass < MP_PASS_EMIT) { emit->bytecode_offset += num_bytes_to_write; return emit->dummy_data; @@ -189,12 +160,12 @@ STATIC void emit_write_bytecode_byte(emit_t *emit, int stack_adj, byte b1) { c[0] = b1; } -// Similar to emit_write_bytecode_uint(), just some extra handling to encode sign +// Similar to mp_encode_uint(), just some extra handling to encode sign STATIC void emit_write_bytecode_byte_int(emit_t *emit, int stack_adj, byte b1, mp_int_t num) { emit_write_bytecode_byte(emit, stack_adj, b1); // We store each 7 bits in a separate byte, and that's how many bytes needed - byte buf[BYTES_FOR_INT]; + byte buf[MP_ENCODE_UINT_MAX_BYTES]; byte *p = buf + sizeof(buf); // We encode in little-ending order, but store in big-endian, to help decoding do { @@ -218,61 +189,25 @@ STATIC void emit_write_bytecode_byte_int(emit_t *emit, int stack_adj, byte b1, m STATIC void emit_write_bytecode_byte_uint(emit_t *emit, int stack_adj, byte b, mp_uint_t val) { emit_write_bytecode_byte(emit, stack_adj, b); - emit_write_uint(emit, emit_get_cur_to_write_bytecode, val); + mp_encode_uint(emit, emit_get_cur_to_write_bytecode, val); } -#if MICROPY_PERSISTENT_CODE -STATIC void emit_write_bytecode_byte_const(emit_t *emit, int stack_adj, byte b, mp_uint_t n, mp_uint_t c) { - if (emit->pass == MP_PASS_EMIT) { - emit->const_table[n] = c; - } +STATIC void emit_write_bytecode_byte_const(emit_t *emit, int stack_adj, byte b, mp_uint_t n) { emit_write_bytecode_byte_uint(emit, stack_adj, b, n); } -#endif STATIC void emit_write_bytecode_byte_qstr(emit_t *emit, int stack_adj, byte b, qstr qst) { - #if MICROPY_PERSISTENT_CODE - assert((qst >> 16) == 0); - mp_emit_bc_adjust_stack_size(emit, stack_adj); - byte *c = emit_get_cur_to_write_bytecode(emit, 3); - c[0] = b; - c[1] = qst; - c[2] = qst >> 8; - #else - emit_write_bytecode_byte_uint(emit, stack_adj, b, qst); - #endif + emit_write_bytecode_byte_uint(emit, stack_adj, b, mp_emit_common_use_qstr(emit->emit_common, qst)); } STATIC void emit_write_bytecode_byte_obj(emit_t *emit, int stack_adj, byte b, mp_obj_t obj) { - #if MICROPY_PERSISTENT_CODE emit_write_bytecode_byte_const(emit, stack_adj, b, - emit->scope->num_pos_args + emit->scope->num_kwonly_args - + emit->ct_cur_obj++, (mp_uint_t)obj); - #else - // aligns the pointer so it is friendly to GC - emit_write_bytecode_byte(emit, stack_adj, b); - emit->bytecode_offset = (size_t)MP_ALIGN(emit->bytecode_offset, sizeof(mp_obj_t)); - mp_obj_t *c = (mp_obj_t *)emit_get_cur_to_write_bytecode(emit, sizeof(mp_obj_t)); - // Verify thar c is already uint-aligned - assert(c == MP_ALIGN(c, sizeof(mp_obj_t))); - *c = obj; - #endif + mp_emit_common_alloc_const_obj(emit->emit_common, obj)); } -STATIC void emit_write_bytecode_byte_raw_code(emit_t *emit, int stack_adj, byte b, mp_raw_code_t *rc) { - #if MICROPY_PERSISTENT_CODE +STATIC void emit_write_bytecode_byte_child(emit_t *emit, int stack_adj, byte b, mp_raw_code_t *rc) { emit_write_bytecode_byte_const(emit, stack_adj, b, - emit->scope->num_pos_args + emit->scope->num_kwonly_args - + emit->ct_num_obj + emit->ct_cur_raw_code++, (mp_uint_t)(uintptr_t)rc); - #else - // aligns the pointer so it is friendly to GC - emit_write_bytecode_byte(emit, stack_adj, b); - emit->bytecode_offset = (size_t)MP_ALIGN(emit->bytecode_offset, sizeof(void *)); - void **c = (void **)emit_get_cur_to_write_bytecode(emit, sizeof(void *)); - // Verify thar c is already uint-aligned - assert(c == MP_ALIGN(c, sizeof(void *))); - *c = rc; - #endif + mp_emit_common_alloc_const_child(emit->emit_common, rc)); #if MICROPY_PY_SYS_SETTRACE rc->line_of_definition = emit->last_source_line; #endif @@ -343,27 +278,19 @@ void mp_emit_bc_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) { } // Write number of cells and size of the source code info - if (pass >= MP_PASS_CODE_SIZE) { - MP_BC_PRELUDE_SIZE_ENCODE(emit->n_info, emit->n_cell, emit_write_code_info_byte, emit); + if (emit->pass >= MP_PASS_CODE_SIZE) { + size_t n_info = emit->n_info; + size_t n_cell = emit->n_cell; + MP_BC_PRELUDE_SIZE_ENCODE(n_info, n_cell, emit_write_code_info_byte, emit); } emit->n_info = emit->code_info_offset; - // Write the name and source file of this function. + // Write the name of this function. emit_write_code_info_qstr(emit, scope->simple_name); - emit_write_code_info_qstr(emit, scope->source_file); - - #if MICROPY_PERSISTENT_CODE - emit->ct_cur_obj = 0; - emit->ct_cur_raw_code = 0; - #endif - - if (pass == MP_PASS_EMIT) { - // Write argument names (needed to resolve positional args passed as - // keywords). We store them as full word-sized objects for efficient access - // in mp_setup_code_state this is the start of the prelude and is guaranteed - // to be aligned on a word boundary. + // Write argument names, needed to resolve positional args passed as keywords. + { // For a given argument position (indexed by i) we need to find the // corresponding id_info which is a parameter, as it has the correct // qstr name to use as the argument name. Note that it's not a simple @@ -383,7 +310,7 @@ void mp_emit_bc_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) { break; } } - emit->const_table[i] = (mp_uint_t)MP_OBJ_NEW_QSTR(qst); + emit_write_code_info_qstr(emit, qst); } } } @@ -396,8 +323,6 @@ void mp_emit_bc_end_pass(emit_t *emit) { // check stack is back to zero size assert(emit->stack_size == 0); - emit_write_code_info_byte(emit, 0); // end of line number info - // Calculate size of source code info section emit->n_info = emit->code_info_offset - emit->n_info; @@ -412,39 +337,20 @@ void mp_emit_bc_end_pass(emit_t *emit) { } } - #if MICROPY_PERSISTENT_CODE - assert(emit->pass <= MP_PASS_STACK_SIZE || (emit->ct_num_obj == emit->ct_cur_obj)); - emit->ct_num_obj = emit->ct_cur_obj; - #endif - if (emit->pass == MP_PASS_CODE_SIZE) { - #if !MICROPY_PERSISTENT_CODE - // so bytecode is aligned - emit->code_info_offset = (size_t)MP_ALIGN(emit->code_info_offset, sizeof(mp_uint_t)); - #endif - // calculate size of total code-info + bytecode, in bytes emit->code_info_size = emit->code_info_offset; emit->bytecode_size = emit->bytecode_offset; emit->code_base = m_new0(byte, emit->code_info_size + emit->bytecode_size); - #if MICROPY_PERSISTENT_CODE - emit->const_table = m_new0(mp_uint_t, - emit->scope->num_pos_args + emit->scope->num_kwonly_args - + emit->ct_cur_obj + emit->ct_cur_raw_code); - #else - emit->const_table = m_new0(mp_uint_t, - emit->scope->num_pos_args + emit->scope->num_kwonly_args); - #endif - } else if (emit->pass == MP_PASS_EMIT) { mp_emit_glue_assign_bytecode(emit->scope->raw_code, emit->code_base, #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS emit->code_info_size + emit->bytecode_size, #endif - emit->const_table, + emit->emit_common->children, #if MICROPY_PERSISTENT_CODE_SAVE - emit->ct_cur_obj, emit->ct_cur_raw_code, + emit->emit_common->ct_cur_child, #endif emit->scope->scope_flags); } @@ -783,21 +689,21 @@ void mp_emit_bc_unpack_ex(emit_t *emit, mp_uint_t n_left, mp_uint_t n_right) { void mp_emit_bc_make_function(emit_t *emit, scope_t *scope, mp_uint_t n_pos_defaults, mp_uint_t n_kw_defaults) { if (n_pos_defaults == 0 && n_kw_defaults == 0) { - emit_write_bytecode_byte_raw_code(emit, 1, MP_BC_MAKE_FUNCTION, scope->raw_code); + emit_write_bytecode_byte_child(emit, 1, MP_BC_MAKE_FUNCTION, scope->raw_code); } else { - emit_write_bytecode_byte_raw_code(emit, -1, MP_BC_MAKE_FUNCTION_DEFARGS, scope->raw_code); + emit_write_bytecode_byte_child(emit, -1, MP_BC_MAKE_FUNCTION_DEFARGS, scope->raw_code); } } void mp_emit_bc_make_closure(emit_t *emit, scope_t *scope, mp_uint_t n_closed_over, mp_uint_t n_pos_defaults, mp_uint_t n_kw_defaults) { if (n_pos_defaults == 0 && n_kw_defaults == 0) { int stack_adj = -n_closed_over + 1; - emit_write_bytecode_byte_raw_code(emit, stack_adj, MP_BC_MAKE_CLOSURE, scope->raw_code); + emit_write_bytecode_byte_child(emit, stack_adj, MP_BC_MAKE_CLOSURE, scope->raw_code); emit_write_bytecode_raw_byte(emit, n_closed_over); } else { assert(n_closed_over <= 255); int stack_adj = -2 - (mp_int_t)n_closed_over + 1; - emit_write_bytecode_byte_raw_code(emit, stack_adj, MP_BC_MAKE_CLOSURE_DEFARGS, scope->raw_code); + emit_write_bytecode_byte_child(emit, stack_adj, MP_BC_MAKE_CLOSURE_DEFARGS, scope->raw_code); emit_write_bytecode_raw_byte(emit, n_closed_over); } } diff --git a/py/emitcommon.c b/py/emitcommon.c index 791bf398ab..c1780d2db9 100644 --- a/py/emitcommon.c +++ b/py/emitcommon.c @@ -30,6 +30,17 @@ #if MICROPY_ENABLE_COMPILER +#if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE +qstr_short_t mp_emit_common_use_qstr(mp_emit_common_t *emit, qstr qst) { + mp_map_elem_t *elem = mp_map_lookup(&emit->qstr_map, MP_OBJ_NEW_QSTR(qst), MP_MAP_LOOKUP_ADD_IF_NOT_FOUND); + if (elem->value == MP_OBJ_NULL) { + assert(emit->pass == MP_PASS_SCOPE); + elem->value = MP_OBJ_NEW_SMALL_INT(emit->qstr_map.used - 1); + } + return MP_OBJ_SMALL_INT_VALUE(elem->value); +} +#endif + void mp_emit_common_get_id_for_modification(scope_t *scope, qstr qst) { // name adding/lookup id_info_t *id = scope_find_or_add_id(scope, qst, ID_INFO_KIND_GLOBAL_IMPLICIT); diff --git a/py/emitglue.c b/py/emitglue.c index 09b48682ff..cd902838af 100644 --- a/py/emitglue.c +++ b/py/emitglue.c @@ -34,6 +34,7 @@ #include "py/emitglue.h" #include "py/runtime0.h" #include "py/bc.h" +#include "py/objfun.h" #include "py/profile.h" #if MICROPY_DEBUG_VERBOSE // print debugging info @@ -63,20 +64,22 @@ void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, const byte *code, #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS size_t len, #endif - const mp_uint_t *const_table, + mp_raw_code_t **children, #if MICROPY_PERSISTENT_CODE_SAVE - uint16_t n_obj, uint16_t n_raw_code, + size_t n_children, #endif mp_uint_t scope_flags) { rc->kind = MP_CODE_BYTECODE; rc->scope_flags = scope_flags; rc->fun_data = code; - rc->const_table = const_table; - #if MICROPY_PERSISTENT_CODE_SAVE + #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS rc->fun_data_len = len; - rc->n_obj = n_obj; - rc->n_raw_code = n_raw_code; + #endif + rc->children = children; + + #if MICROPY_PERSISTENT_CODE_SAVE + rc->n_children = n_children; #endif #if MICROPY_PY_SYS_SETTRACE @@ -85,26 +88,22 @@ void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, const byte *code, #endif #ifdef DEBUG_PRINT - #if !MICROPY_DEBUG_PRINTERS + #if !(MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS) const size_t len = 0; #endif DEBUG_printf("assign byte code: code=%p len=" UINT_FMT " flags=%x\n", code, len, (uint)scope_flags); #endif - #if MICROPY_DEBUG_PRINTERS - if (mp_verbose_flag >= 2) { - mp_bytecode_print(&mp_plat_print, rc, code, len, const_table); - } - #endif } #if MICROPY_EMIT_MACHINE_CODE -void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void *fun_data, mp_uint_t fun_len, const mp_uint_t *const_table, +void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void *fun_data, mp_uint_t fun_len, + mp_raw_code_t **children, #if MICROPY_PERSISTENT_CODE_SAVE + size_t n_children, uint16_t prelude_offset, - uint16_t n_obj, uint16_t n_raw_code, uint16_t n_qstr, mp_qstr_link_entry_t *qstr_link, #endif - mp_uint_t n_pos_args, mp_uint_t scope_flags, mp_uint_t type_sig) { + mp_uint_t scope_flags, mp_uint_t n_pos_args, mp_uint_t type_sig) { assert(kind == MP_CODE_NATIVE_PY || kind == MP_CODE_NATIVE_VIPER || kind == MP_CODE_NATIVE_ASM); @@ -135,20 +134,24 @@ void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void rc->kind = kind; rc->scope_flags = scope_flags; - rc->n_pos_args = n_pos_args; rc->fun_data = fun_data; - rc->const_table = const_table; - rc->type_sig = type_sig; + + #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS + rc->fun_data_len = fun_len; + #endif + rc->children = children; #if MICROPY_PERSISTENT_CODE_SAVE - rc->fun_data_len = fun_len; + rc->n_children = n_children; rc->prelude_offset = prelude_offset; - rc->n_obj = n_obj; - rc->n_raw_code = n_raw_code; rc->n_qstr = n_qstr; rc->qstr_link = qstr_link; #endif + // These two entries are only needed for MP_CODE_NATIVE_ASM. + rc->n_pos_args = n_pos_args; + rc->type_sig = type_sig; + #ifdef DEBUG_PRINT DEBUG_printf("assign native: kind=%d fun=%p len=" UINT_FMT " n_pos_args=" UINT_FMT " flags=%x\n", kind, fun_data, fun_len, n_pos_args, (uint)scope_flags); for (mp_uint_t i = 0; i < fun_len; i++) { @@ -170,15 +173,15 @@ void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void } #endif -mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_args, mp_obj_t def_kw_args) { +mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, const mp_module_context_t *context, const mp_obj_t *def_args) { DEBUG_OP_printf("make_function_from_raw_code %p\n", rc); assert(rc != NULL); // def_args must be MP_OBJ_NULL or a tuple - assert(def_args == MP_OBJ_NULL || mp_obj_is_type(def_args, &mp_type_tuple)); + assert(def_args == NULL || def_args[0] == MP_OBJ_NULL || mp_obj_is_type(def_args[0], &mp_type_tuple)); // def_kw_args must be MP_OBJ_NULL or a dict - assert(def_kw_args == MP_OBJ_NULL || mp_obj_is_type(def_kw_args, &mp_type_dict)); + assert(def_args == NULL || def_args[1] == MP_OBJ_NULL || mp_obj_is_type(def_args[1], &mp_type_dict)); // make the function, depending on the raw code kind mp_obj_t fun; @@ -186,7 +189,7 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_ar #if MICROPY_EMIT_NATIVE case MP_CODE_NATIVE_PY: case MP_CODE_NATIVE_VIPER: - fun = mp_obj_new_fun_native(def_args, def_kw_args, rc->fun_data, rc->const_table); + fun = mp_obj_new_fun_native(def_args, rc->fun_data, context, rc->children); // Check for a generator function, and if so change the type of the object if ((rc->scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0) { ((mp_obj_base_t *)MP_OBJ_TO_PTR(fun))->type = &mp_type_native_gen_wrap; @@ -201,7 +204,7 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_ar default: // rc->kind should always be set and BYTECODE is the only remaining case assert(rc->kind == MP_CODE_BYTECODE); - fun = mp_obj_new_fun_bc(def_args, def_kw_args, rc->fun_data, rc->const_table); + fun = mp_obj_new_fun_bc(def_args, rc->fun_data, context, rc->children); // check for generator functions and if so change the type of the object if ((rc->scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0) { ((mp_obj_base_t *)MP_OBJ_TO_PTR(fun))->type = &mp_type_gen_wrap; @@ -218,16 +221,16 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_ar return fun; } -mp_obj_t mp_make_closure_from_raw_code(const mp_raw_code_t *rc, mp_uint_t n_closed_over, const mp_obj_t *args) { +mp_obj_t mp_make_closure_from_raw_code(const mp_raw_code_t *rc, const mp_module_context_t *context, mp_uint_t n_closed_over, const mp_obj_t *args) { DEBUG_OP_printf("make_closure_from_raw_code %p " UINT_FMT " %p\n", rc, n_closed_over, args); // make function object mp_obj_t ffun; if (n_closed_over & 0x100) { // default positional and keyword args given - ffun = mp_make_function_from_raw_code(rc, args[0], args[1]); + ffun = mp_make_function_from_raw_code(rc, context, args); } else { // default positional and keyword args not given - ffun = mp_make_function_from_raw_code(rc, MP_OBJ_NULL, MP_OBJ_NULL); + ffun = mp_make_function_from_raw_code(rc, context, NULL); } // wrap function in closure object return mp_obj_new_closure(ffun, n_closed_over & 0xff, args + ((n_closed_over >> 7) & 2)); diff --git a/py/emitglue.h b/py/emitglue.h index a5411dc2e2..9a22a93218 100644 --- a/py/emitglue.h +++ b/py/emitglue.h @@ -54,16 +54,20 @@ typedef struct _mp_qstr_link_entry_t { uint16_t qst; } mp_qstr_link_entry_t; +// compiled bytecode: instance in RAM, referenced by outer scope, usually freed after first (and only) use +// mpy file: instance in RAM, created when .mpy file is loaded (same comments as above) +// frozen: instance in ROM typedef struct _mp_raw_code_t { mp_uint_t kind : 3; // of type mp_raw_code_kind_t mp_uint_t scope_flags : 7; mp_uint_t n_pos_args : 11; const void *fun_data; - const mp_uint_t *const_table; + #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS + size_t fun_data_len; // so mp_raw_code_save and mp_bytecode_print work + #endif + struct _mp_raw_code_t **children; #if MICROPY_PERSISTENT_CODE_SAVE - size_t fun_data_len; - uint16_t n_obj; - uint16_t n_raw_code; + size_t n_children; #if MICROPY_PY_SYS_SETTRACE mp_bytecode_prelude_t prelude; // line_of_definition is a Python source line where the raw_code was @@ -89,22 +93,22 @@ void mp_emit_glue_assign_bytecode(mp_raw_code_t *rc, const byte *code, #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS size_t len, #endif - const mp_uint_t *const_table, + mp_raw_code_t **children, #if MICROPY_PERSISTENT_CODE_SAVE - uint16_t n_obj, uint16_t n_raw_code, + size_t n_children, #endif mp_uint_t scope_flags); void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void *fun_data, mp_uint_t fun_len, - const mp_uint_t *const_table, + mp_raw_code_t **children, #if MICROPY_PERSISTENT_CODE_SAVE + size_t n_children, uint16_t prelude_offset, - uint16_t n_obj, uint16_t n_raw_code, uint16_t n_qstr, mp_qstr_link_entry_t *qstr_link, #endif - mp_uint_t n_pos_args, mp_uint_t scope_flags, mp_uint_t type_sig); + mp_uint_t scope_flags, mp_uint_t n_pos_args, mp_uint_t type_sig); -mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, mp_obj_t def_args, mp_obj_t def_kw_args); -mp_obj_t mp_make_closure_from_raw_code(const mp_raw_code_t *rc, mp_uint_t n_closed_over, const mp_obj_t *args); +mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, const mp_module_context_t *context, const mp_obj_t *def_args); +mp_obj_t mp_make_closure_from_raw_code(const mp_raw_code_t *rc, const mp_module_context_t *context, mp_uint_t n_closed_over, const mp_obj_t *args); #endif // MICROPY_INCLUDED_PY_EMITGLUE_H diff --git a/py/emitnative.c b/py/emitnative.c index 6504f37765..ca34e89f64 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -48,6 +48,7 @@ #include "py/emit.h" #include "py/nativeglue.h" +#include "py/objfun.h" #include "py/objstr.h" #if MICROPY_DEBUG_VERBOSE // print debugging info @@ -92,9 +93,13 @@ #define OFFSETOF_CODE_STATE_FUN_BC (offsetof(mp_code_state_t, fun_bc) / sizeof(uintptr_t)) #define OFFSETOF_CODE_STATE_IP (offsetof(mp_code_state_t, ip) / sizeof(uintptr_t)) #define OFFSETOF_CODE_STATE_SP (offsetof(mp_code_state_t, sp) / sizeof(uintptr_t)) -#define OFFSETOF_OBJ_FUN_BC_GLOBALS (offsetof(mp_obj_fun_bc_t, globals) / sizeof(uintptr_t)) +#define OFFSETOF_CODE_STATE_N_STATE (offsetof(mp_code_state_t, n_state) / sizeof(uintptr_t)) +#define OFFSETOF_OBJ_FUN_BC_CONTEXT (offsetof(mp_obj_fun_bc_t, context) / sizeof(uintptr_t)) +#define OFFSETOF_OBJ_FUN_BC_CHILD_TABLE (offsetof(mp_obj_fun_bc_t, child_table) / sizeof(uintptr_t)) #define OFFSETOF_OBJ_FUN_BC_BYTECODE (offsetof(mp_obj_fun_bc_t, bytecode) / sizeof(uintptr_t)) -#define OFFSETOF_OBJ_FUN_BC_CONST_TABLE (offsetof(mp_obj_fun_bc_t, const_table) / sizeof(uintptr_t)) +#define OFFSETOF_MODULE_CONTEXT_OBJ_TABLE (offsetof(mp_module_context_t, constants.obj_table) / sizeof(uintptr_t)) +#define OFFSETOF_MODULE_CONTEXT_GLOBALS (offsetof(mp_module_context_t, module.globals) / sizeof(uintptr_t)) +#define INDEX_OF_MP_FUN_TABLE_IN_CONST_TABLE (0) // If not already defined, set parent args to same as child call registers #ifndef REG_PARENT_RET @@ -205,6 +210,7 @@ typedef struct _exc_stack_entry_t { } exc_stack_entry_t; struct _emit_t { + mp_emit_common_t *emit_common; mp_obj_t *error_slot; uint *label_slot; uint exit_label; @@ -225,18 +231,17 @@ struct _emit_t { exc_stack_entry_t *exc_stack; int prelude_offset; + #if N_PRELUDE_AS_BYTES_OBJ + size_t prelude_const_table_offset; + #endif int start_offset; int n_state; uint16_t code_state_start; uint16_t stack_start; int stack_size; + uint16_t n_info; uint16_t n_cell; - uint16_t const_table_cur_obj; - uint16_t const_table_num_obj; - uint16_t const_table_cur_raw_code; - mp_uint_t *const_table; - #if MICROPY_PERSISTENT_CODE_SAVE uint16_t qstr_link_cur; mp_qstr_link_entry_t *qstr_link; @@ -255,8 +260,9 @@ STATIC void emit_native_global_exc_entry(emit_t *emit); STATIC void emit_native_global_exc_exit(emit_t *emit); STATIC void emit_native_load_const_obj(emit_t *emit, mp_obj_t obj); -emit_t *EXPORT_FUN(new)(mp_obj_t * error_slot, uint *label_slot, mp_uint_t max_num_labels) { +emit_t *EXPORT_FUN(new)(mp_emit_common_t * emit_common, mp_obj_t *error_slot, uint *label_slot, mp_uint_t max_num_labels) { emit_t *emit = m_new0(emit_t, 1); + emit->emit_common = emit_common; emit->error_slot = error_slot; emit->label_slot = label_slot; emit->stack_info_alloc = 8; @@ -340,30 +346,22 @@ STATIC void emit_native_mov_reg_qstr_obj(emit_t *emit, int reg_dest, qstr qst) { emit_native_mov_state_reg((emit), (local_num), (reg_temp)); \ } while (false) -#define emit_native_mov_state_imm_fix_u16_via(emit, local_num, imm, reg_temp) \ - do { \ - ASM_MOV_REG_IMM_FIX_U16((emit)->as, (reg_temp), (imm)); \ - emit_native_mov_state_reg((emit), (local_num), (reg_temp)); \ - } while (false) - -#define emit_native_mov_state_imm_fix_word_via(emit, local_num, imm, reg_temp) \ - do { \ - ASM_MOV_REG_IMM_FIX_WORD((emit)->as, (reg_temp), (imm)); \ - emit_native_mov_state_reg((emit), (local_num), (reg_temp)); \ - } while (false) - STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) { DEBUG_printf("start_pass(pass=%u, scope=%p)\n", pass, scope); + if (pass == MP_PASS_SCOPE) { + // Note: the first argument passed here is mp_emit_common_t, not the native emitter context + #if N_PRELUDE_AS_BYTES_OBJ + if (scope->emit_options == MP_EMIT_OPT_NATIVE_PYTHON) { + mp_emit_common_alloc_const_obj((mp_emit_common_t *)emit, mp_const_none); + } + #endif + return; + } + emit->pass = pass; emit->do_viper_types = scope->emit_options == MP_EMIT_OPT_VIPER; emit->stack_size = 0; - #if N_PRELUDE_AS_BYTES_OBJ - emit->const_table_cur_obj = emit->do_viper_types ? 0 : 1; // reserve first obj for prelude bytes obj - #else - emit->const_table_cur_obj = 0; - #endif - emit->const_table_cur_raw_code = 0; #if MICROPY_PERSISTENT_CODE_SAVE emit->qstr_link_cur = 0; #endif @@ -455,8 +453,9 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop #endif // Load REG_FUN_TABLE with a pointer to mp_fun_table, found in the const_table - ASM_LOAD_REG_REG_OFFSET(emit->as, REG_LOCAL_3, REG_PARENT_ARG_1, OFFSETOF_OBJ_FUN_BC_CONST_TABLE); - ASM_LOAD_REG_REG_OFFSET(emit->as, REG_FUN_TABLE, REG_LOCAL_3, 0); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_FUN_TABLE, REG_PARENT_ARG_1, OFFSETOF_OBJ_FUN_BC_CONTEXT); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_FUN_TABLE, REG_FUN_TABLE, OFFSETOF_MODULE_CONTEXT_OBJ_TABLE); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_FUN_TABLE, REG_FUN_TABLE, INDEX_OF_MP_FUN_TABLE_IN_CONST_TABLE); // Store function object (passed as first arg) to stack if needed if (NEED_FUN_OBJ(emit)) { @@ -514,7 +513,7 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop emit->stack_start = SIZEOF_CODE_STATE; #if N_PRELUDE_AS_BYTES_OBJ // Load index of prelude bytes object in const_table - mp_asm_base_data(&emit->as->base, ASM_WORD_SIZE, (uintptr_t)(emit->scope->num_pos_args + emit->scope->num_kwonly_args + 1)); + mp_asm_base_data(&emit->as->base, ASM_WORD_SIZE, (uintptr_t)emit->prelude_const_table_offset); #else mp_asm_base_data(&emit->as->base, ASM_WORD_SIZE, (uintptr_t)emit->prelude_offset); #endif @@ -536,8 +535,9 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop // Load REG_FUN_TABLE with a pointer to mp_fun_table, found in the const_table ASM_LOAD_REG_REG_OFFSET(emit->as, REG_TEMP0, REG_GENERATOR_STATE, LOCAL_IDX_FUN_OBJ(emit)); - ASM_LOAD_REG_REG_OFFSET(emit->as, REG_TEMP0, REG_TEMP0, OFFSETOF_OBJ_FUN_BC_CONST_TABLE); - ASM_LOAD_REG_REG_OFFSET(emit->as, REG_FUN_TABLE, REG_TEMP0, emit->scope->num_pos_args + emit->scope->num_kwonly_args); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_TEMP0, REG_TEMP0, OFFSETOF_OBJ_FUN_BC_CONTEXT); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_TEMP0, REG_TEMP0, OFFSETOF_MODULE_CONTEXT_OBJ_TABLE); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_FUN_TABLE, REG_TEMP0, INDEX_OF_MP_FUN_TABLE_IN_CONST_TABLE); } else { // The locals and stack start after the code_state structure emit->stack_start = emit->code_state_start + SIZEOF_CODE_STATE; @@ -555,22 +555,33 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop #endif // Load REG_FUN_TABLE with a pointer to mp_fun_table, found in the const_table - ASM_LOAD_REG_REG_OFFSET(emit->as, REG_LOCAL_3, REG_PARENT_ARG_1, OFFSETOF_OBJ_FUN_BC_CONST_TABLE); - ASM_LOAD_REG_REG_OFFSET(emit->as, REG_FUN_TABLE, REG_LOCAL_3, emit->scope->num_pos_args + emit->scope->num_kwonly_args); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_FUN_TABLE, REG_PARENT_ARG_1, OFFSETOF_OBJ_FUN_BC_CONTEXT); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_FUN_TABLE, REG_FUN_TABLE, OFFSETOF_MODULE_CONTEXT_OBJ_TABLE); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_FUN_TABLE, REG_FUN_TABLE, INDEX_OF_MP_FUN_TABLE_IN_CONST_TABLE); // Set code_state.fun_bc ASM_MOV_LOCAL_REG(emit->as, LOCAL_IDX_FUN_OBJ(emit), REG_PARENT_ARG_1); - // Set code_state.ip (offset from start of this function to prelude info) + // Set code_state.ip, a pointer to the beginning of the prelude + // Need to use some locals for this, so assert that they are available for use + MP_STATIC_ASSERT(REG_LOCAL_3 != REG_PARENT_ARG_1); + MP_STATIC_ASSERT(REG_LOCAL_3 != REG_PARENT_ARG_2); + MP_STATIC_ASSERT(REG_LOCAL_3 != REG_PARENT_ARG_3); + MP_STATIC_ASSERT(REG_LOCAL_3 != REG_PARENT_ARG_4); int code_state_ip_local = emit->code_state_start + OFFSETOF_CODE_STATE_IP; #if N_PRELUDE_AS_BYTES_OBJ - // Prelude is a bytes object in const_table; store ip = prelude->data - fun_bc->bytecode - ASM_LOAD_REG_REG_OFFSET(emit->as, REG_LOCAL_3, REG_LOCAL_3, emit->scope->num_pos_args + emit->scope->num_kwonly_args + 1); + // Prelude is a bytes object in const_table[prelude_const_table_offset]. + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_LOCAL_3, REG_PARENT_ARG_1, OFFSETOF_OBJ_FUN_BC_CONTEXT); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_LOCAL_3, REG_LOCAL_3, OFFSETOF_MODULE_CONTEXT_OBJ_TABLE); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_LOCAL_3, REG_LOCAL_3, emit->prelude_const_table_offset); ASM_LOAD_REG_REG_OFFSET(emit->as, REG_LOCAL_3, REG_LOCAL_3, offsetof(mp_obj_str_t, data) / sizeof(uintptr_t)); - ASM_LOAD_REG_REG_OFFSET(emit->as, REG_PARENT_ARG_1, REG_PARENT_ARG_1, OFFSETOF_OBJ_FUN_BC_BYTECODE); - ASM_SUB_REG_REG(emit->as, REG_LOCAL_3, REG_PARENT_ARG_1); - emit_native_mov_state_reg(emit, code_state_ip_local, REG_LOCAL_3); #else + MP_STATIC_ASSERT(REG_LOCAL_2 != REG_PARENT_ARG_1); + MP_STATIC_ASSERT(REG_LOCAL_2 != REG_PARENT_ARG_2); + MP_STATIC_ASSERT(REG_LOCAL_2 != REG_PARENT_ARG_3); + MP_STATIC_ASSERT(REG_LOCAL_2 != REG_PARENT_ARG_4); + // Prelude is at the end of the machine code + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_LOCAL_3, REG_PARENT_ARG_1, OFFSETOF_OBJ_FUN_BC_BYTECODE); if (emit->pass == MP_PASS_CODE_SIZE) { // Commit to the encoding size based on the value of prelude_offset in this pass. // By using 32768 as the cut-off it is highly unlikely that prelude_offset will @@ -579,14 +590,16 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop } if (emit->prelude_offset_uses_u16_encoding) { assert(emit->prelude_offset <= 65535); - emit_native_mov_state_imm_fix_u16_via(emit, code_state_ip_local, emit->prelude_offset, REG_PARENT_ARG_1); + ASM_MOV_REG_IMM_FIX_U16((emit)->as, REG_LOCAL_2, emit->prelude_offset); } else { - emit_native_mov_state_imm_fix_word_via(emit, code_state_ip_local, emit->prelude_offset, REG_PARENT_ARG_1); + ASM_MOV_REG_IMM_FIX_WORD((emit)->as, REG_LOCAL_2, emit->prelude_offset); } + ASM_ADD_REG_REG(emit->as, REG_LOCAL_3, REG_LOCAL_2); #endif + emit_native_mov_state_reg(emit, code_state_ip_local, REG_LOCAL_3); // Set code_state.n_state (only works on little endian targets due to n_state being uint16_t) - emit_native_mov_state_imm_via(emit, emit->code_state_start + offsetof(mp_code_state_t, n_state) / sizeof(uintptr_t), emit->n_state, REG_ARG_1); + emit_native_mov_state_imm_via(emit, emit->code_state_start + OFFSETOF_CODE_STATE_N_STATE, emit->n_state, REG_ARG_1); // Put address of code_state into first arg ASM_MOV_REG_LOCAL_ADDR(emit->as, REG_ARG_1, emit->code_state_start); @@ -628,30 +641,17 @@ STATIC void emit_native_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scop emit->local_vtype[id->local_num] = VTYPE_PYOBJ; } } - - if (pass == MP_PASS_EMIT) { - // write argument names as qstr objects - // see comment in corresponding part of emitbc.c about the logic here - for (int i = 0; i < scope->num_pos_args + scope->num_kwonly_args; i++) { - qstr qst = MP_QSTR__star_; - for (int j = 0; j < scope->id_info_len; ++j) { - id_info_t *id = &scope->id_info[j]; - if ((id->flags & ID_FLAG_IS_PARAM) && id->local_num == i) { - qst = id->qst; - break; - } - } - emit->const_table[i] = (mp_uint_t)MP_OBJ_NEW_QSTR(qst); - } - } } - } static inline void emit_native_write_code_info_byte(emit_t *emit, byte val) { mp_asm_base_data(&emit->as->base, 1, val); } +static inline void emit_native_write_code_info_qstr(emit_t *emit, qstr qst) { + mp_encode_uint(&emit->as->base, mp_asm_base_get_cur_to_write_bytes, mp_emit_common_use_qstr(emit->emit_common, qst)); +} + STATIC void emit_native_end_pass(emit_t *emit) { emit_native_global_exc_exit(emit); @@ -662,21 +662,25 @@ STATIC void emit_native_end_pass(emit_t *emit) { size_t n_exc_stack = 0; // exc-stack not needed for native code MP_BC_PRELUDE_SIG_ENCODE(n_state, n_exc_stack, emit->scope, emit_native_write_code_info_byte, emit); - #if MICROPY_PERSISTENT_CODE - size_t n_info = 4; - #else - size_t n_info = 1; - #endif - MP_BC_PRELUDE_SIZE_ENCODE(n_info, emit->n_cell, emit_native_write_code_info_byte, emit); + size_t n_info = emit->n_info; + size_t n_cell = emit->n_cell; + MP_BC_PRELUDE_SIZE_ENCODE(n_info, n_cell, emit_native_write_code_info_byte, emit); - #if MICROPY_PERSISTENT_CODE - mp_asm_base_data(&emit->as->base, 1, emit->scope->simple_name); - mp_asm_base_data(&emit->as->base, 1, emit->scope->simple_name >> 8); - mp_asm_base_data(&emit->as->base, 1, emit->scope->source_file); - mp_asm_base_data(&emit->as->base, 1, emit->scope->source_file >> 8); - #else - mp_asm_base_data(&emit->as->base, 1, 1); - #endif + // bytecode prelude: source info (function and argument qstrs) + size_t info_start = mp_asm_base_get_code_pos(&emit->as->base); + emit_native_write_code_info_qstr(emit, emit->scope->simple_name); + for (int i = 0; i < emit->scope->num_pos_args + emit->scope->num_kwonly_args; i++) { + qstr qst = MP_QSTR__star_; + for (int j = 0; j < emit->scope->id_info_len; ++j) { + id_info_t *id = &emit->scope->id_info[j]; + if ((id->flags & ID_FLAG_IS_PARAM) && id->local_num == i) { + qst = id->qst; + break; + } + } + emit_native_write_code_info_qstr(emit, qst); + } + emit->n_info = mp_asm_base_get_code_pos(&emit->as->base) - info_start; // bytecode prelude: initialise closed over variables size_t cell_start = mp_asm_base_get_code_pos(&emit->as->base); @@ -690,13 +694,14 @@ STATIC void emit_native_end_pass(emit_t *emit) { emit->n_cell = mp_asm_base_get_code_pos(&emit->as->base) - cell_start; #if N_PRELUDE_AS_BYTES_OBJ - // Prelude bytes object is after qstr arg names and mp_fun_table - size_t table_off = emit->scope->num_pos_args + emit->scope->num_kwonly_args + 1; + // Create the prelude as a bytes object, and store it in the constant table + mp_obj_t prelude = mp_const_none; if (emit->pass == MP_PASS_EMIT) { void *buf = emit->as->base.code_base + emit->prelude_offset; size_t n = emit->as->base.code_offset - emit->prelude_offset; - emit->const_table[table_off] = (uintptr_t)mp_obj_new_bytes(buf, n); + prelude = mp_obj_new_bytes(buf, n); } + emit->prelude_const_table_offset = mp_emit_common_alloc_const_obj(emit->emit_common, prelude); #endif } @@ -706,31 +711,15 @@ STATIC void emit_native_end_pass(emit_t *emit) { assert(emit->stack_size == 0); assert(emit->exc_stack_size == 0); - // Deal with const table accounting - assert(emit->pass <= MP_PASS_STACK_SIZE || (emit->const_table_num_obj == emit->const_table_cur_obj)); - emit->const_table_num_obj = emit->const_table_cur_obj; + #if MICROPY_PERSISTENT_CODE_SAVE + // Allocate qstr_link table if needed if (emit->pass == MP_PASS_CODE_SIZE) { - size_t const_table_alloc = 1 + emit->const_table_num_obj + emit->const_table_cur_raw_code; - size_t nqstr = 0; - if (!emit->do_viper_types) { - // Add room for qstr names of arguments - nqstr = emit->scope->num_pos_args + emit->scope->num_kwonly_args; - const_table_alloc += nqstr; - } - emit->const_table = m_new(mp_uint_t, const_table_alloc); - #if !MICROPY_DYNAMIC_COMPILER - // Store mp_fun_table pointer just after qstrs - // (but in dynamic-compiler mode eliminate dependency on mp_fun_table) - emit->const_table[nqstr] = (mp_uint_t)(uintptr_t)&mp_fun_table; - #endif - - #if MICROPY_PERSISTENT_CODE_SAVE size_t qstr_link_alloc = emit->qstr_link_cur; if (qstr_link_alloc > 0) { emit->qstr_link = m_new(mp_qstr_link_entry_t, qstr_link_alloc); } - #endif } + #endif if (emit->pass == MP_PASS_EMIT) { void *f = mp_asm_base_get_code(&emit->as->base); @@ -738,13 +727,14 @@ STATIC void emit_native_end_pass(emit_t *emit) { mp_emit_glue_assign_native(emit->scope->raw_code, emit->do_viper_types ? MP_CODE_NATIVE_VIPER : MP_CODE_NATIVE_PY, - f, f_len, emit->const_table, + f, f_len, + emit->emit_common->children, #if MICROPY_PERSISTENT_CODE_SAVE + emit->emit_common->ct_cur_child, emit->prelude_offset, - emit->const_table_cur_obj, emit->const_table_cur_raw_code, emit->qstr_link_cur, emit->qstr_link, #endif - emit->scope->num_pos_args, emit->scope->scope_flags, 0); + emit->scope->scope_flags, 0, 0); } } @@ -1137,29 +1127,19 @@ STATIC exc_stack_entry_t *emit_native_pop_exc_stack(emit_t *emit) { return e; } -STATIC void emit_load_reg_with_ptr(emit_t *emit, int reg, mp_uint_t ptr, size_t table_off) { - if (!emit->do_viper_types) { - // Skip qstr names of arguments - table_off += emit->scope->num_pos_args + emit->scope->num_kwonly_args; - } - if (emit->pass == MP_PASS_EMIT) { - emit->const_table[table_off] = ptr; - } +STATIC void emit_load_reg_with_object(emit_t *emit, int reg, mp_obj_t obj) { + size_t table_off = mp_emit_common_alloc_const_obj(emit->emit_common, obj); emit_native_mov_reg_state(emit, REG_TEMP0, LOCAL_IDX_FUN_OBJ(emit)); - ASM_LOAD_REG_REG_OFFSET(emit->as, REG_TEMP0, REG_TEMP0, OFFSETOF_OBJ_FUN_BC_CONST_TABLE); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_TEMP0, REG_TEMP0, OFFSETOF_OBJ_FUN_BC_CONTEXT); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_TEMP0, REG_TEMP0, OFFSETOF_MODULE_CONTEXT_OBJ_TABLE); ASM_LOAD_REG_REG_OFFSET(emit->as, reg, REG_TEMP0, table_off); } -STATIC void emit_load_reg_with_object(emit_t *emit, int reg, mp_obj_t obj) { - // First entry is for mp_fun_table - size_t table_off = 1 + emit->const_table_cur_obj++; - emit_load_reg_with_ptr(emit, reg, (mp_uint_t)obj, table_off); -} - -STATIC void emit_load_reg_with_raw_code(emit_t *emit, int reg, mp_raw_code_t *rc) { - // First entry is for mp_fun_table, then constant objects - size_t table_off = 1 + emit->const_table_num_obj + emit->const_table_cur_raw_code++; - emit_load_reg_with_ptr(emit, reg, (mp_uint_t)rc, table_off); +STATIC void emit_load_reg_with_child(emit_t *emit, int reg, mp_raw_code_t *rc) { + size_t table_off = mp_emit_common_alloc_const_child(emit->emit_common, rc); + emit_native_mov_reg_state(emit, REG_TEMP0, LOCAL_IDX_FUN_OBJ(emit)); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_TEMP0, REG_TEMP0, OFFSETOF_OBJ_FUN_BC_CHILD_TABLE); + ASM_LOAD_REG_REG_OFFSET(emit->as, reg, REG_TEMP0, table_off); } STATIC void emit_native_label_assign(emit_t *emit, mp_uint_t l) { @@ -1203,7 +1183,8 @@ STATIC void emit_native_global_exc_entry(emit_t *emit) { if (!(emit->scope->scope_flags & MP_SCOPE_FLAG_GENERATOR)) { // Set new globals emit_native_mov_reg_state(emit, REG_ARG_1, LOCAL_IDX_FUN_OBJ(emit)); - ASM_LOAD_REG_REG_OFFSET(emit->as, REG_ARG_1, REG_ARG_1, OFFSETOF_OBJ_FUN_BC_GLOBALS); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_ARG_1, REG_ARG_1, OFFSETOF_OBJ_FUN_BC_CONTEXT); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_ARG_1, REG_ARG_1, OFFSETOF_MODULE_CONTEXT_GLOBALS); emit_call(emit, MP_F_NATIVE_SWAP_GLOBALS); // Save old globals (or NULL if globals didn't change) @@ -1254,7 +1235,8 @@ STATIC void emit_native_global_exc_entry(emit_t *emit) { #if N_NLR_SETJMP // Reload REG_FUN_TABLE, since it may be clobbered by longjmp emit_native_mov_reg_state(emit, REG_LOCAL_1, LOCAL_IDX_FUN_OBJ(emit)); - ASM_LOAD_REG_REG_OFFSET(emit->as, REG_LOCAL_1, REG_LOCAL_1, offsetof(mp_obj_fun_bc_t, const_table) / sizeof(uintptr_t)); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_LOCAL_1, REG_LOCAL_1, OFFSETOF_OBJ_FUN_BC_CONTEXT); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_LOCAL_1, REG_LOCAL_1, OFFSETOF_MODULE_CONTEXT_OBJ_TABLE); ASM_LOAD_REG_REG_OFFSET(emit->as, REG_FUN_TABLE, REG_LOCAL_1, emit->scope->num_pos_args + emit->scope->num_kwonly_args); #endif ASM_MOV_REG_LOCAL(emit->as, REG_LOCAL_1, LOCAL_IDX_EXC_HANDLER_PC(emit)); @@ -1385,11 +1367,7 @@ STATIC void emit_native_import(emit_t *emit, qstr qst, int kind) { STATIC void emit_native_load_const_tok(emit_t *emit, mp_token_kind_t tok) { DEBUG_printf("load_const_tok(tok=%u)\n", tok); if (tok == MP_TOKEN_ELLIPSIS) { - #if MICROPY_PERSISTENT_CODE_SAVE emit_native_load_const_obj(emit, MP_OBJ_FROM_PTR(&mp_const_ellipsis_obj)); - #else - emit_post_push_imm(emit, VTYPE_PYOBJ, (mp_uint_t)MP_OBJ_FROM_PTR(&mp_const_ellipsis_obj)); - #endif } else { emit_native_pre(emit); if (tok == MP_TOKEN_KW_NONE) { @@ -2682,33 +2660,46 @@ STATIC void emit_native_unpack_ex(emit_t *emit, mp_uint_t n_left, mp_uint_t n_ri STATIC void emit_native_make_function(emit_t *emit, scope_t *scope, mp_uint_t n_pos_defaults, mp_uint_t n_kw_defaults) { // call runtime, with type info for args, or don't support dict/default params, or only support Python objects for them emit_native_pre(emit); + emit_native_mov_reg_state(emit, REG_ARG_2, LOCAL_IDX_FUN_OBJ(emit)); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_ARG_2, REG_ARG_2, OFFSETOF_OBJ_FUN_BC_CONTEXT); if (n_pos_defaults == 0 && n_kw_defaults == 0) { need_reg_all(emit); - ASM_MOV_REG_IMM(emit->as, REG_ARG_2, (mp_uint_t)MP_OBJ_NULL); - ASM_MOV_REG_IMM(emit->as, REG_ARG_3, (mp_uint_t)MP_OBJ_NULL); + ASM_MOV_REG_IMM(emit->as, REG_ARG_3, 0); } else { - vtype_kind_t vtype_def_tuple, vtype_def_dict; - emit_pre_pop_reg_reg(emit, &vtype_def_dict, REG_ARG_3, &vtype_def_tuple, REG_ARG_2); - assert(vtype_def_tuple == VTYPE_PYOBJ); - assert(vtype_def_dict == VTYPE_PYOBJ); + emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_3, 2); need_reg_all(emit); } - emit_load_reg_with_raw_code(emit, REG_ARG_1, scope->raw_code); + emit_load_reg_with_child(emit, REG_ARG_1, scope->raw_code); ASM_CALL_IND(emit->as, MP_F_MAKE_FUNCTION_FROM_RAW_CODE); emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET); } STATIC void emit_native_make_closure(emit_t *emit, scope_t *scope, mp_uint_t n_closed_over, mp_uint_t n_pos_defaults, mp_uint_t n_kw_defaults) { + // make function emit_native_pre(emit); + emit_native_mov_reg_state(emit, REG_ARG_2, LOCAL_IDX_FUN_OBJ(emit)); + ASM_LOAD_REG_REG_OFFSET(emit->as, REG_ARG_2, REG_ARG_2, OFFSETOF_OBJ_FUN_BC_CONTEXT); if (n_pos_defaults == 0 && n_kw_defaults == 0) { - emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_3, n_closed_over); - ASM_MOV_REG_IMM(emit->as, REG_ARG_2, n_closed_over); + need_reg_all(emit); + ASM_MOV_REG_IMM(emit->as, REG_ARG_3, 0); } else { - emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_3, n_closed_over + 2); - ASM_MOV_REG_IMM(emit->as, REG_ARG_2, 0x100 | n_closed_over); + emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_3, 2 + n_closed_over); + adjust_stack(emit, 2 + n_closed_over); + need_reg_all(emit); } - emit_load_reg_with_raw_code(emit, REG_ARG_1, scope->raw_code); - ASM_CALL_IND(emit->as, MP_F_MAKE_CLOSURE_FROM_RAW_CODE); + emit_load_reg_with_child(emit, REG_ARG_1, scope->raw_code); + ASM_CALL_IND(emit->as, MP_F_MAKE_FUNCTION_FROM_RAW_CODE); + + // make closure + #if REG_ARG_1 != REG_RET + ASM_MOV_REG_REG(emit->as, REG_ARG_1, REG_RET); + #endif + ASM_MOV_REG_IMM(emit->as, REG_ARG_2, n_closed_over); + emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_3, n_closed_over); + if (n_pos_defaults != 0 || n_kw_defaults != 0) { + adjust_stack(emit, -2); + } + ASM_CALL_IND(emit->as, MP_F_NEW_CLOSURE); emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET); } diff --git a/py/emitnx86.c b/py/emitnx86.c index f0553f0682..d990ef5a9e 100644 --- a/py/emitnx86.c +++ b/py/emitnx86.c @@ -56,7 +56,7 @@ STATIC byte mp_f_n_args[MP_F_NUMBER_OF] = { [MP_F_UNPACK_EX] = 3, [MP_F_DELETE_NAME] = 1, [MP_F_DELETE_GLOBAL] = 1, - [MP_F_MAKE_CLOSURE_FROM_RAW_CODE] = 3, + [MP_F_NEW_CLOSURE] = 3, [MP_F_ARG_CHECK_NUM_SIG] = 3, [MP_F_SETUP_CODE_STATE] = 4, [MP_F_SMALL_INT_FLOOR_DIVIDE] = 2, diff --git a/py/frozenmod.c b/py/frozenmod.c index 6cb68d1ec0..61c2f20aa1 100644 --- a/py/frozenmod.c +++ b/py/frozenmod.c @@ -57,7 +57,7 @@ extern const char mp_frozen_str_content[]; #include "py/emitglue.h" -extern const mp_raw_code_t *const mp_frozen_mpy_content[]; +extern const mp_frozen_module_t *const mp_frozen_mpy_content[]; #endif // MICROPY_MODULE_FROZEN_MPY diff --git a/py/mpconfig.h b/py/mpconfig.h index 47779a67de..5edff69dfd 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -328,6 +328,14 @@ #define MICROPY_PERSISTENT_CODE (MICROPY_PERSISTENT_CODE_LOAD || MICROPY_PERSISTENT_CODE_SAVE || MICROPY_MODULE_FROZEN_MPY) #endif +// Whether bytecode uses a qstr_table to map internal qstr indices in the bytecode +// to global qstr values in the runtime (behaviour when feature is enabled), or +// just stores global qstr values directly in the bytecode. This must be enabled +// if MICROPY_PERSISTENT_CODE is enabled. +#ifndef MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE +#define MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE (MICROPY_PERSISTENT_CODE) +#endif + // Whether to emit x64 native code #ifndef MICROPY_EMIT_X64 #define MICROPY_EMIT_X64 (0) diff --git a/py/nativeglue.c b/py/nativeglue.c index 30e5b40061..aed6fecddf 100644 --- a/py/nativeglue.c +++ b/py/nativeglue.c @@ -300,7 +300,7 @@ const mp_fun_table_t mp_fun_table = { mp_unpack_ex, mp_delete_name, mp_delete_global, - mp_make_closure_from_raw_code, + mp_obj_new_closure, mp_arg_check_num_sig, mp_setup_code_state, mp_small_int_floor_divide, @@ -344,4 +344,8 @@ const mp_fun_table_t mp_fun_table = { &mp_stream_write_obj, }; +#elif MICROPY_EMIT_NATIVE && MICROPY_DYNAMIC_COMPILER + +const int mp_fun_table; + #endif // MICROPY_EMIT_NATIVE diff --git a/py/nativeglue.h b/py/nativeglue.h index 9d9a97b9e7..49ce665f2d 100644 --- a/py/nativeglue.h +++ b/py/nativeglue.h @@ -75,7 +75,7 @@ typedef enum { MP_F_UNPACK_EX, MP_F_DELETE_NAME, MP_F_DELETE_GLOBAL, - MP_F_MAKE_CLOSURE_FROM_RAW_CODE, + MP_F_NEW_CLOSURE, MP_F_ARG_CHECK_NUM_SIG, MP_F_SETUP_CODE_STATE, MP_F_SMALL_INT_FLOOR_DIVIDE, @@ -112,7 +112,7 @@ typedef struct _mp_fun_table_t { void (*set_store)(mp_obj_t self_in, mp_obj_t item); mp_obj_t (*list_append)(mp_obj_t self_in, mp_obj_t arg); mp_obj_t (*dict_store)(mp_obj_t self_in, mp_obj_t key, mp_obj_t value); - mp_obj_t (*make_function_from_raw_code)(const mp_raw_code_t *rc, mp_obj_t def_args, mp_obj_t def_kw_args); + mp_obj_t (*make_function_from_raw_code)(const mp_raw_code_t *rc, const mp_module_context_t *cm, const mp_obj_t *def_args); mp_obj_t (*call_function_n_kw)(mp_obj_t fun_in, size_t n_args_kw, const mp_obj_t *args); mp_obj_t (*call_method_n_kw)(size_t n_args, size_t n_kw, const mp_obj_t *args); mp_obj_t (*call_method_n_kw_var)(bool have_self, size_t n_args_n_kw, const mp_obj_t *args); @@ -129,7 +129,7 @@ typedef struct _mp_fun_table_t { void (*unpack_ex)(mp_obj_t seq, size_t num, mp_obj_t *items); void (*delete_name)(qstr qst); void (*delete_global)(qstr qst); - mp_obj_t (*make_closure_from_raw_code)(const mp_raw_code_t *rc, mp_uint_t n_closed_over, const mp_obj_t *args); + mp_obj_t (*new_closure)(mp_obj_t fun, size_t n_closed_over, const mp_obj_t *closed); void (*arg_check_num_sig)(size_t n_args, size_t n_kw, uint32_t sig); void (*setup_code_state)(mp_code_state_t *code_state, size_t n_args, size_t n_kw, const mp_obj_t *args); mp_int_t (*small_int_floor_divide)(mp_int_t num, mp_int_t denom); @@ -172,6 +172,12 @@ typedef struct _mp_fun_table_t { const mp_obj_fun_builtin_var_t *stream_write_obj; } mp_fun_table_t; +#if (MICROPY_EMIT_NATIVE && !MICROPY_DYNAMIC_COMPILER) || MICROPY_ENABLE_DYNRUNTIME extern const mp_fun_table_t mp_fun_table; +#elif MICROPY_EMIT_NATIVE && MICROPY_DYNAMIC_COMPILER +// In dynamic-compiler mode eliminate dependency on entries in mp_fun_table. +// This only needs to be an independent pointer, content doesn't matter. +extern const int mp_fun_table; +#endif #endif // MICROPY_INCLUDED_PY_NATIVEGLUE_H diff --git a/py/obj.h b/py/obj.h index b52ee0e2f4..08a35ee6f8 100644 --- a/py/obj.h +++ b/py/obj.h @@ -781,9 +781,6 @@ mp_obj_t mp_obj_new_exception_msg_varg(const mp_obj_type_t *exc_type, mp_rom_err #ifdef va_start mp_obj_t mp_obj_new_exception_msg_vlist(const mp_obj_type_t *exc_type, mp_rom_error_text_t fmt, va_list arg); // same fmt restrictions as above #endif -mp_obj_t mp_obj_new_fun_bc(mp_obj_t def_args, mp_obj_t def_kw_args, const byte *code, const mp_uint_t *const_table); -mp_obj_t mp_obj_new_fun_native(mp_obj_t def_args_in, mp_obj_t def_kw_args, const void *fun_data, const mp_uint_t *const_table); -mp_obj_t mp_obj_new_fun_asm(size_t n_args, const void *fun_data, mp_uint_t type_sig); mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun); mp_obj_t mp_obj_new_closure(mp_obj_t fun, size_t n_closed, const mp_obj_t *closed); mp_obj_t mp_obj_new_tuple(size_t n, const mp_obj_t *items); @@ -992,7 +989,6 @@ typedef struct _mp_obj_fun_builtin_var_t { } mp_obj_fun_builtin_var_t; qstr mp_obj_fun_get_name(mp_const_obj_t fun); -qstr mp_obj_code_get_name(const byte *code_info); mp_obj_t mp_identity(mp_obj_t self); MP_DECLARE_CONST_FUN_OBJ_1(mp_identity_obj); diff --git a/py/objfun.c b/py/objfun.c index 85f531c88b..3542cc0e3f 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -143,13 +143,13 @@ const mp_obj_type_t mp_type_fun_builtin_var = { /******************************************************************************/ /* byte code functions */ -qstr mp_obj_code_get_name(const byte *code_info) { +STATIC qstr mp_obj_code_get_name(const mp_obj_fun_bc_t *fun, const byte *code_info) { MP_BC_PRELUDE_SIZE_DECODE(code_info); - #if MICROPY_PERSISTENT_CODE - return code_info[0] | (code_info[1] << 8); - #else - return mp_decode_uint_value(code_info); + mp_uint_t name = mp_decode_uint_value(code_info); + #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE + name = fun->context->constants.qstr_table[name]; #endif + return name; } #if MICROPY_EMIT_NATIVE @@ -167,7 +167,7 @@ qstr mp_obj_fun_get_name(mp_const_obj_t fun_in) { const byte *bc = fun->bytecode; MP_BC_PRELUDE_SIG_DECODE(bc); - return mp_obj_code_get_name(bc); + return mp_obj_code_get_name(fun, bc); } #if MICROPY_CPYTHON_COMPAT @@ -209,7 +209,7 @@ STATIC void dump_args(const mp_obj_t *a, size_t sz) { #define INIT_CODESTATE(code_state, _fun_bc, _n_state, n_args, n_kw, args) \ code_state->fun_bc = _fun_bc; \ - code_state->ip = 0; \ + code_state->ip = _fun_bc->bytecode; \ code_state->n_state = _n_state; \ mp_setup_code_state(code_state, n_args, n_kw, args); \ code_state->old_globals = mp_globals_get(); @@ -240,7 +240,7 @@ mp_code_state_t *mp_obj_fun_bc_prepare_codestate(mp_obj_t self_in, size_t n_args INIT_CODESTATE(code_state, self, n_state, n_args, n_kw, args); // execute the byte code with the correct globals context - mp_globals_set(self->globals); + mp_globals_set(self->context->module.globals); return code_state; } @@ -285,7 +285,7 @@ STATIC mp_obj_t fun_bc_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const INIT_CODESTATE(code_state, self, n_state, n_args, n_kw, args); // execute the byte code with the correct globals context - mp_globals_set(self->globals); + mp_globals_set(self->context->module.globals); mp_vm_return_kind_t vm_return_kind = mp_execute_bytecode(code_state, MP_OBJ_NULL); mp_globals_set(code_state->old_globals); @@ -358,7 +358,7 @@ void mp_obj_fun_bc_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { } if (attr == MP_QSTR___globals__) { mp_obj_fun_bc_t *self = MP_OBJ_TO_PTR(self_in); - dest[0] = MP_OBJ_FROM_PTR(self->globals); + dest[0] = MP_OBJ_FROM_PTR(self->context->module.globals); } } #endif @@ -377,25 +377,29 @@ const mp_obj_type_t mp_type_fun_bc = { #endif }; -mp_obj_t mp_obj_new_fun_bc(mp_obj_t def_args_in, mp_obj_t def_kw_args, const byte *code, const mp_uint_t *const_table) { +mp_obj_t mp_obj_new_fun_bc(const mp_obj_t *def_args, const byte *code, const mp_module_context_t *context, struct _mp_raw_code_t *const *child_table) { size_t n_def_args = 0; size_t n_extra_args = 0; - mp_obj_tuple_t *def_args = MP_OBJ_TO_PTR(def_args_in); - if (def_args_in != MP_OBJ_NULL) { - assert(mp_obj_is_type(def_args_in, &mp_type_tuple)); - n_def_args = def_args->len; - n_extra_args = def_args->len; + mp_obj_tuple_t *def_pos_args = NULL; + mp_obj_t def_kw_args = MP_OBJ_NULL; + if (def_args != NULL && def_args[0] != MP_OBJ_NULL) { + assert(mp_obj_is_type(def_args[0], &mp_type_tuple)); + def_pos_args = MP_OBJ_TO_PTR(def_args[0]); + n_def_args = def_pos_args->len; + n_extra_args = def_pos_args->len; } - if (def_kw_args != MP_OBJ_NULL) { + if (def_args != NULL && def_args[1] != MP_OBJ_NULL) { + assert(mp_obj_is_type(def_args[1], &mp_type_dict)); + def_kw_args = def_args[1]; n_extra_args += 1; } mp_obj_fun_bc_t *o = m_new_obj_var(mp_obj_fun_bc_t, mp_obj_t, n_extra_args); o->base.type = &mp_type_fun_bc; - o->globals = mp_globals_get(); o->bytecode = code; - o->const_table = const_table; - if (def_args != NULL) { - memcpy(o->extra_args, def_args->items, n_def_args * sizeof(mp_obj_t)); + o->context = context; + o->child_table = child_table; + if (def_pos_args != NULL) { + memcpy(o->extra_args, def_pos_args->items, n_def_args * sizeof(mp_obj_t)); } if (def_kw_args != MP_OBJ_NULL) { o->extra_args[n_def_args] = def_kw_args; @@ -423,8 +427,8 @@ STATIC const mp_obj_type_t mp_type_fun_native = { .unary_op = mp_generic_unary_op, }; -mp_obj_t mp_obj_new_fun_native(mp_obj_t def_args_in, mp_obj_t def_kw_args, const void *fun_data, const mp_uint_t *const_table) { - mp_obj_fun_bc_t *o = MP_OBJ_TO_PTR(mp_obj_new_fun_bc(def_args_in, def_kw_args, (const byte *)fun_data, const_table)); +mp_obj_t mp_obj_new_fun_native(const mp_obj_t *def_args, const void *fun_data, const mp_module_context_t *mc, struct _mp_raw_code_t *const *child_table) { + mp_obj_fun_bc_t *o = MP_OBJ_TO_PTR(mp_obj_new_fun_bc(def_args, (const byte *)fun_data, mc, child_table)); o->base.type = &mp_type_fun_native; return MP_OBJ_FROM_PTR(o); } diff --git a/py/objfun.h b/py/objfun.h index 771bf31a95..9de15b8841 100644 --- a/py/objfun.h +++ b/py/objfun.h @@ -26,13 +26,14 @@ #ifndef MICROPY_INCLUDED_PY_OBJFUN_H #define MICROPY_INCLUDED_PY_OBJFUN_H +#include "py/bc.h" #include "py/obj.h" typedef struct _mp_obj_fun_bc_t { mp_obj_base_t base; - mp_obj_dict_t *globals; // the context within which this function was defined - const byte *bytecode; // bytecode for the function - const mp_uint_t *const_table; // constant table + const mp_module_context_t *context; // context within which this function was defined + struct _mp_raw_code_t *const *child_table; // table of children + const byte *bytecode; // bytecode for the function #if MICROPY_PY_SYS_SETTRACE const struct _mp_raw_code_t *rc; #endif @@ -42,6 +43,9 @@ typedef struct _mp_obj_fun_bc_t { mp_obj_t extra_args[]; } mp_obj_fun_bc_t; +mp_obj_t mp_obj_new_fun_bc(const mp_obj_t *def_args, const byte *code, const mp_module_context_t *cm, struct _mp_raw_code_t *const *raw_code_table); +mp_obj_t mp_obj_new_fun_native(const mp_obj_t *def_args, const void *fun_data, const mp_module_context_t *cm, struct _mp_raw_code_t *const *raw_code_table); +mp_obj_t mp_obj_new_fun_asm(size_t n_args, const void *fun_data, mp_uint_t type_sig); void mp_obj_fun_bc_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest); #endif // MICROPY_INCLUDED_PY_OBJFUN_H diff --git a/py/objgenerator.c b/py/objgenerator.c index 784310092e..cbe79e66a5 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -65,7 +65,7 @@ STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, cons o->pend_exc = mp_const_none; o->code_state.fun_bc = self_fun; - o->code_state.ip = 0; + o->code_state.ip = self_fun->bytecode; o->code_state.n_state = n_state; mp_setup_code_state(&o->code_state, n_args, n_kw, args); return MP_OBJ_FROM_PTR(o); @@ -91,14 +91,18 @@ STATIC mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_k // The state for a native generating function is held in the same struct as a bytecode function mp_obj_fun_bc_t *self_fun = MP_OBJ_TO_PTR(self_in); - // Determine start of prelude, and extract n_state from it + // Determine start of prelude. uintptr_t prelude_offset = ((uintptr_t *)self_fun->bytecode)[0]; #if MICROPY_EMIT_NATIVE_PRELUDE_AS_BYTES_OBJ // Prelude is in bytes object in const_table, at index prelude_offset - mp_obj_str_t *prelude_bytes = MP_OBJ_TO_PTR(self_fun->const_table[prelude_offset]); - prelude_offset = (const byte *)prelude_bytes->data - self_fun->bytecode; + mp_obj_str_t *prelude_bytes = MP_OBJ_TO_PTR(self_fun->context->constants.obj_table[prelude_offset]); + const uint8_t *prelude_ptr = prelude_bytes->data; + #else + const uint8_t *prelude_ptr = self_fun->bytecode + prelude_offset; #endif - const uint8_t *ip = self_fun->bytecode + prelude_offset; + + // Extract n_state from the prelude. + const uint8_t *ip = prelude_ptr; size_t n_state, n_exc_stack_unused, scope_flags, n_pos_args, n_kwonly_args, n_def_args; MP_BC_PRELUDE_SIG_DECODE_INTO(ip, n_state, n_exc_stack_unused, scope_flags, n_pos_args, n_kwonly_args, n_def_args); size_t n_exc_stack = 0; @@ -111,7 +115,7 @@ STATIC mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_k // Parse the input arguments and set up the code state o->pend_exc = mp_const_none; o->code_state.fun_bc = self_fun; - o->code_state.ip = (const byte *)prelude_offset; + o->code_state.ip = prelude_ptr; o->code_state.n_state = n_state; mp_setup_code_state(&o->code_state, n_args, n_kw, args); @@ -184,7 +188,7 @@ mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_value, mp_ // Set up the correct globals context for the generator and execute it self->code_state.old_globals = mp_globals_get(); - mp_globals_set(self->code_state.fun_bc->globals); + mp_globals_set(self->code_state.fun_bc->context->module.globals); mp_vm_return_kind_t ret_kind; diff --git a/py/objmodule.c b/py/objmodule.c index 9be4bad92c..4b04f7ca9c 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -112,6 +112,7 @@ const mp_obj_type_t mp_type_module = { .attr = module_attr, }; +#include "py/bc.h" mp_obj_t mp_obj_new_module(qstr module_name) { mp_map_t *mp_loaded_modules_map = &MP_STATE_VM(mp_loaded_modules_dict).map; mp_map_elem_t *el = mp_map_lookup(mp_loaded_modules_map, MP_OBJ_NEW_QSTR(module_name), MP_MAP_LOOKUP_ADD_IF_NOT_FOUND); @@ -122,12 +123,12 @@ mp_obj_t mp_obj_new_module(qstr module_name) { } // create new module object - mp_obj_module_t *o = m_new_obj(mp_obj_module_t); - o->base.type = &mp_type_module; - o->globals = MP_OBJ_TO_PTR(mp_obj_new_dict(MICROPY_MODULE_DICT_SIZE)); + mp_module_context_t *o = m_new_obj(mp_module_context_t); + o->module.base.type = &mp_type_module; + o->module.globals = MP_OBJ_TO_PTR(mp_obj_new_dict(MICROPY_MODULE_DICT_SIZE)); // store __name__ entry in the module - mp_obj_dict_store(MP_OBJ_FROM_PTR(o->globals), MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(module_name)); + mp_obj_dict_store(MP_OBJ_FROM_PTR(o->module.globals), MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(module_name)); // store the new module into the slot in the global dict holding all modules el->value = MP_OBJ_FROM_PTR(o); diff --git a/py/persistentcode.c b/py/persistentcode.c index ac523990c1..b473f18308 100644 --- a/py/persistentcode.c +++ b/py/persistentcode.c @@ -63,57 +63,6 @@ STATIC int mp_small_int_bits(void) { } #endif -#define QSTR_WINDOW_SIZE (32) - -typedef struct _qstr_window_t { - uint16_t idx; // indexes the head of the window - uint16_t window[QSTR_WINDOW_SIZE]; -} qstr_window_t; - -// Push a qstr to the head of the window, and the tail qstr is overwritten -STATIC void qstr_window_push(qstr_window_t *qw, qstr qst) { - qw->idx = (qw->idx + 1) % QSTR_WINDOW_SIZE; - qw->window[qw->idx] = qst; -} - -// Pull an existing qstr from within the window to the head of the window -STATIC qstr qstr_window_pull(qstr_window_t *qw, size_t idx) { - qstr qst = qw->window[idx]; - if (idx > qw->idx) { - memmove(&qw->window[idx], &qw->window[idx + 1], (QSTR_WINDOW_SIZE - idx - 1) * sizeof(uint16_t)); - qw->window[QSTR_WINDOW_SIZE - 1] = qw->window[0]; - idx = 0; - } - memmove(&qw->window[idx], &qw->window[idx + 1], (qw->idx - idx) * sizeof(uint16_t)); - qw->window[qw->idx] = qst; - return qst; -} - -#if MICROPY_PERSISTENT_CODE_LOAD - -// Access a qstr at the given index, relative to the head of the window (0=head) -STATIC qstr qstr_window_access(qstr_window_t *qw, size_t idx) { - return qstr_window_pull(qw, (qw->idx + QSTR_WINDOW_SIZE - idx) % QSTR_WINDOW_SIZE); -} - -#endif - -#if MICROPY_PERSISTENT_CODE_SAVE - -// Insert a qstr at the head of the window, either by pulling an existing one or pushing a new one -STATIC size_t qstr_window_insert(qstr_window_t *qw, qstr qst) { - for (size_t idx = 0; idx < QSTR_WINDOW_SIZE; ++idx) { - if (qw->window[idx] == qst) { - qstr_window_pull(qw, idx); - return (qw->idx + QSTR_WINDOW_SIZE - idx) % QSTR_WINDOW_SIZE; - } - } - qstr_window_push(qw, qst); - return QSTR_WINDOW_SIZE; -} - -#endif - typedef struct _bytecode_prelude_t { uint n_state; uint n_exc_stack; @@ -124,23 +73,6 @@ typedef struct _bytecode_prelude_t { uint code_info_size; } bytecode_prelude_t; -// ip will point to start of opcodes -// return value will point to simple_name, source_file qstrs -STATIC byte *extract_prelude(const byte **ip, bytecode_prelude_t *prelude) { - MP_BC_PRELUDE_SIG_DECODE(*ip); - prelude->n_state = n_state; - prelude->n_exc_stack = n_exc_stack; - prelude->scope_flags = scope_flags; - prelude->n_pos_args = n_pos_args; - prelude->n_kwonly_args = n_kwonly_args; - prelude->n_def_pos_args = n_def_pos_args; - MP_BC_PRELUDE_SIZE_DECODE(*ip); - byte *ip_info = (byte *)*ip; - *ip += n_info; - *ip += n_cell; - return ip_info; -} - #endif // MICROPY_PERSISTENT_CODE_LOAD || MICROPY_PERSISTENT_CODE_SAVE #if MICROPY_PERSISTENT_CODE_LOAD @@ -148,13 +80,14 @@ STATIC byte *extract_prelude(const byte **ip, bytecode_prelude_t *prelude) { #include "py/parsenum.h" STATIC int read_byte(mp_reader_t *reader); -STATIC size_t read_uint(mp_reader_t *reader, byte **out); +STATIC size_t read_uint(mp_reader_t *reader); #if MICROPY_EMIT_MACHINE_CODE typedef struct _reloc_info_t { mp_reader_t *reader; - mp_uint_t *const_table; + uint8_t *rodata; + uint8_t *bss; } reloc_info_t; #if MICROPY_EMIT_THUMB @@ -197,13 +130,13 @@ void mp_native_relocate(void *ri_in, uint8_t *text, uintptr_t reloc_text) { while ((op = read_byte(ri->reader)) != 0xff) { if (op & 1) { // Point to new location to make adjustments - size_t addr = read_uint(ri->reader, NULL); + size_t addr = read_uint(ri->reader); if ((addr & 1) == 0) { // Point to somewhere in text addr_to_adjust = &((uintptr_t *)text)[addr >> 1]; } else { // Point to somewhere in rodata - addr_to_adjust = &((uintptr_t *)ri->const_table[1])[addr >> 1]; + addr_to_adjust = &((uintptr_t *)ri->rodata)[addr >> 1]; } } op >>= 1; @@ -212,15 +145,18 @@ void mp_native_relocate(void *ri_in, uint8_t *text, uintptr_t reloc_text) { if (op <= 5) { if (op & 1) { // Read in number of adjustments to make - n = read_uint(ri->reader, NULL); + n = read_uint(ri->reader); } op >>= 1; if (op == 0) { // Destination is text dest = reloc_text; + } else if (op == 1) { + // Destination is rodata + dest = (uintptr_t)ri->rodata; } else { - // Destination is rodata (op=1) or bss (op=1 if no rodata, else op=2) - dest = ri->const_table[op]; + // Destination is bss + dest = (uintptr_t)ri->bss; } } else if (op == 6) { // Destination is mp_fun_table itself @@ -247,14 +183,10 @@ STATIC void read_bytes(mp_reader_t *reader, byte *buf, size_t len) { } } -STATIC size_t read_uint(mp_reader_t *reader, byte **out) { +STATIC size_t read_uint(mp_reader_t *reader) { size_t unum = 0; for (;;) { byte b = reader->readbyte(reader->data); - if (out != NULL) { - **out = b; - ++*out; - } unum = (unum << 7) | (b & 0x7f); if ((b & 0x80) == 0) { break; @@ -263,35 +195,41 @@ STATIC size_t read_uint(mp_reader_t *reader, byte **out) { return unum; } -STATIC qstr load_qstr(mp_reader_t *reader, qstr_window_t *qw) { - size_t len = read_uint(reader, NULL); - if (len == 0) { - // static qstr - return read_byte(reader); - } +STATIC qstr load_qstr(mp_reader_t *reader) { + size_t len = read_uint(reader); if (len & 1) { - // qstr in window - return qstr_window_access(qw, len >> 1); + // static qstr + return len >> 1; } len >>= 1; char *str = m_new(char, len); read_bytes(reader, (byte *)str, len); + read_byte(reader); // read and discard null terminator qstr qst = qstr_from_strn(str, len); m_del(char, str, len); - qstr_window_push(qw, qst); return qst; } STATIC mp_obj_t load_obj(mp_reader_t *reader) { byte obj_type = read_byte(reader); + #if MICROPY_EMIT_MACHINE_CODE + if (obj_type == 't') { + return MP_OBJ_FROM_PTR(&mp_fun_table); + } else + #endif if (obj_type == 'e') { return MP_OBJ_FROM_PTR(&mp_const_ellipsis_obj); } else { - size_t len = read_uint(reader, NULL); + size_t len = read_uint(reader); + if (len == 0 && obj_type == 'b') { + read_byte(reader); // skip null terminator + return mp_const_empty_bytes; + } vstr_t vstr; vstr_init_len(&vstr, len); read_bytes(reader, (byte *)vstr.buf, len); if (obj_type == 's' || obj_type == 'b') { + read_byte(reader); // skip null terminator return mp_obj_new_str_from_vstr(obj_type == 's' ? &mp_type_str : &mp_type_bytes, &vstr); } else if (obj_type == 'i') { return mp_parse_num_integer(vstr.buf, vstr.len, 10, NULL); @@ -302,58 +240,12 @@ STATIC mp_obj_t load_obj(mp_reader_t *reader) { } } -STATIC void load_prelude_qstrs(mp_reader_t *reader, qstr_window_t *qw, byte *ip) { - qstr simple_name = load_qstr(reader, qw); - ip[0] = simple_name; - ip[1] = simple_name >> 8; - qstr source_file = load_qstr(reader, qw); - ip[2] = source_file; - ip[3] = source_file >> 8; -} - -STATIC void load_prelude(mp_reader_t *reader, qstr_window_t *qw, byte **ip, bytecode_prelude_t *prelude) { - // Read in the prelude header - byte *ip_read = *ip; - read_uint(reader, &ip_read); // read in n_state/etc (is effectively a var-uint) - read_uint(reader, &ip_read); // read in n_info/n_cell (is effectively a var-uint) - - // Prelude header has been read into *ip, now decode and extract values from it - extract_prelude((const byte **)ip, prelude); - - // Load qstrs in prelude - load_prelude_qstrs(reader, qw, ip_read); - ip_read += 4; - - // Read remaining code info - read_bytes(reader, ip_read, *ip - ip_read); -} - -STATIC void load_bytecode(mp_reader_t *reader, qstr_window_t *qw, byte *ip, byte *ip_top) { - while (ip < ip_top) { - *ip = read_byte(reader); - size_t sz; - uint f = mp_opcode_format(ip, &sz, false); - ++ip; - --sz; - if (f == MP_BC_FORMAT_QSTR) { - qstr qst = load_qstr(reader, qw); - *ip++ = qst; - *ip++ = qst >> 8; - sz -= 2; - } else if (f == MP_BC_FORMAT_VAR_UINT) { - while ((*ip++ = read_byte(reader)) & 0x80) { - } - } - read_bytes(reader, ip, sz); - ip += sz; - } -} - -STATIC mp_raw_code_t *load_raw_code(mp_reader_t *reader, qstr_window_t *qw) { +STATIC mp_raw_code_t *load_raw_code(mp_reader_t *reader) { // Load function kind and data length - size_t kind_len = read_uint(reader, NULL); + size_t kind_len = read_uint(reader); int kind = (kind_len & 3) + MP_CODE_BYTECODE; - size_t fun_data_len = kind_len >> 2; + bool has_children = !!(kind_len & 4); + size_t fun_data_len = kind_len >> 3; #if !MICROPY_EMIT_MACHINE_CODE if (kind != MP_CODE_BYTECODE) { @@ -362,23 +254,18 @@ STATIC mp_raw_code_t *load_raw_code(mp_reader_t *reader, qstr_window_t *qw) { #endif uint8_t *fun_data = NULL; - bytecode_prelude_t prelude = {0}; #if MICROPY_EMIT_MACHINE_CODE size_t prelude_offset = 0; - mp_uint_t type_sig = 0; - size_t n_qstr_link = 0; + mp_uint_t native_scope_flags = 0; + mp_uint_t native_n_pos_args = 0; + mp_uint_t native_type_sig = 0; #endif if (kind == MP_CODE_BYTECODE) { // Allocate memory for the bytecode fun_data = m_new(uint8_t, fun_data_len); - - // Load prelude - byte *ip = fun_data; - load_prelude(reader, qw, &ip, &prelude); - // Load bytecode - load_bytecode(reader, qw, ip, fun_data + fun_data_len); + read_bytes(reader, fun_data, fun_data_len); #if MICROPY_EMIT_MACHINE_CODE } else { @@ -389,10 +276,10 @@ STATIC mp_raw_code_t *load_raw_code(mp_reader_t *reader, qstr_window_t *qw) { if (kind == MP_CODE_NATIVE_PY || kind == MP_CODE_NATIVE_VIPER) { // Parse qstr link table and link native code - n_qstr_link = read_uint(reader, NULL); + size_t n_qstr_link = read_uint(reader); for (size_t i = 0; i < n_qstr_link; ++i) { - size_t off = read_uint(reader, NULL); - qstr qst = load_qstr(reader, qw); + size_t off = read_uint(reader); + qstr qst = load_qstr(reader); uint8_t *dest = fun_data + (off >> 2); if ((off & 3) == 0) { // Generic 16-bit link @@ -409,113 +296,92 @@ STATIC mp_raw_code_t *load_raw_code(mp_reader_t *reader, qstr_window_t *qw) { } if (kind == MP_CODE_NATIVE_PY) { - // Extract prelude for later use - prelude_offset = read_uint(reader, NULL); + // Read prelude offset within fun_data, and extract scope flags. + prelude_offset = read_uint(reader); const byte *ip = fun_data + prelude_offset; - byte *ip_info = extract_prelude(&ip, &prelude); - // Load qstrs in prelude - load_prelude_qstrs(reader, qw, ip_info); + MP_BC_PRELUDE_SIG_DECODE(ip); + native_scope_flags = scope_flags; } else { - // Load basic scope info for viper and asm - prelude.scope_flags = read_uint(reader, NULL); - prelude.n_pos_args = 0; - prelude.n_kwonly_args = 0; + // Load basic scope info for viper and asm. + native_scope_flags = read_uint(reader); if (kind == MP_CODE_NATIVE_ASM) { - prelude.n_pos_args = read_uint(reader, NULL); - type_sig = read_uint(reader, NULL); + native_n_pos_args = read_uint(reader); + native_type_sig = read_uint(reader); } } #endif } - size_t n_obj = 0; - size_t n_raw_code = 0; - mp_uint_t *const_table = NULL; + size_t n_children = 0; + mp_raw_code_t **children = NULL; - if (kind != MP_CODE_NATIVE_ASM) { - // Load constant table for bytecode, native and viper - - // Number of entries in constant table - n_obj = read_uint(reader, NULL); - n_raw_code = read_uint(reader, NULL); - - // Allocate constant table - size_t n_alloc = prelude.n_pos_args + prelude.n_kwonly_args + n_obj + n_raw_code; - #if MICROPY_EMIT_MACHINE_CODE - if (kind != MP_CODE_BYTECODE) { - ++n_alloc; // additional entry for mp_fun_table - if (prelude.scope_flags & MP_SCOPE_FLAG_VIPERRODATA) { - ++n_alloc; // additional entry for rodata - } - if (prelude.scope_flags & MP_SCOPE_FLAG_VIPERBSS) { - ++n_alloc; // additional entry for BSS - } - } - #endif - - const_table = m_new(mp_uint_t, n_alloc); - mp_uint_t *ct = const_table; - - // Load function argument names (initial entries in const_table) - // (viper has n_pos_args=n_kwonly_args=0 so doesn't load any qstrs here) - for (size_t i = 0; i < prelude.n_pos_args + prelude.n_kwonly_args; ++i) { - *ct++ = (mp_uint_t)MP_OBJ_NEW_QSTR(load_qstr(reader, qw)); + #if MICROPY_EMIT_MACHINE_CODE + // Load optional BSS/rodata for viper. + uint8_t *rodata = NULL; + uint8_t *bss = NULL; + if (kind == MP_CODE_NATIVE_VIPER) { + size_t rodata_size = 0; + if (native_scope_flags & MP_SCOPE_FLAG_VIPERRODATA) { + rodata_size = read_uint(reader); } - #if MICROPY_EMIT_MACHINE_CODE - if (kind != MP_CODE_BYTECODE) { - // Populate mp_fun_table entry - *ct++ = (mp_uint_t)(uintptr_t)&mp_fun_table; + size_t bss_size = 0; + if (native_scope_flags & MP_SCOPE_FLAG_VIPERBSS) { + bss_size = read_uint(reader); + } - // Allocate and load rodata if needed - if (prelude.scope_flags & MP_SCOPE_FLAG_VIPERRODATA) { - size_t size = read_uint(reader, NULL); - uint8_t *rodata = m_new(uint8_t, size); - read_bytes(reader, rodata, size); - *ct++ = (uintptr_t)rodata; + if (rodata_size + bss_size != 0) { + bss_size = (uintptr_t)MP_ALIGN(bss_size, sizeof(uintptr_t)); + uint8_t *data = m_new0(uint8_t, bss_size + rodata_size); + bss = data; + rodata = bss + bss_size; + if (native_scope_flags & MP_SCOPE_FLAG_VIPERRODATA) { + read_bytes(reader, rodata, rodata_size); } - // Allocate BSS if needed - if (prelude.scope_flags & MP_SCOPE_FLAG_VIPERBSS) { - size_t size = read_uint(reader, NULL); - uint8_t *bss = m_new0(uint8_t, size); - *ct++ = (uintptr_t)bss; - } + // Viper code with BSS/rodata should not have any children. + // Reuse the children pointer to reference the BSS/rodata + // memory so that it is not reclaimed by the GC. + assert(!has_children); + children = (void *)data; } - #endif + } + #endif - // Load constant objects and raw code children - for (size_t i = 0; i < n_obj; ++i) { - *ct++ = (mp_uint_t)load_obj(reader); - } - for (size_t i = 0; i < n_raw_code; ++i) { - *ct++ = (mp_uint_t)(uintptr_t)load_raw_code(reader, qw); + // Load children if any. + if (has_children) { + n_children = read_uint(reader); + children = m_new(mp_raw_code_t *, n_children); + for (size_t i = 0; i < n_children; ++i) { + children[i] = load_raw_code(reader); } } // Create raw_code and return it mp_raw_code_t *rc = mp_emit_glue_new_raw_code(); if (kind == MP_CODE_BYTECODE) { + const byte *ip = fun_data; + MP_BC_PRELUDE_SIG_DECODE(ip); // Assign bytecode to raw code object mp_emit_glue_assign_bytecode(rc, fun_data, #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS fun_data_len, #endif - const_table, + children, #if MICROPY_PERSISTENT_CODE_SAVE - n_obj, n_raw_code, + n_children, #endif - prelude.scope_flags); + scope_flags); #if MICROPY_EMIT_MACHINE_CODE } else { // Relocate and commit code to executable address space - reloc_info_t ri = {reader, const_table}; + reloc_info_t ri = {reader, rodata, bss}; #if defined(MP_PLAT_COMMIT_EXEC) - void *opt_ri = (prelude.scope_flags & MP_SCOPE_FLAG_VIPERRELOC) ? &ri : NULL; + void *opt_ri = (native_scope_flags & MP_SCOPE_FLAG_VIPERRELOC) ? &ri : NULL; fun_data = MP_PLAT_COMMIT_EXEC(fun_data, fun_data_len, opt_ri); #else - if (prelude.scope_flags & MP_SCOPE_FLAG_VIPERRELOC) { + if (native_scope_flags & MP_SCOPE_FLAG_VIPERRELOC) { #if MICROPY_PERSISTENT_CODE_TRACK_RELOC_CODE // If native code needs relocations then it's not guaranteed that a pointer to // the head of `buf` (containing the machine code) will be retained for the GC @@ -534,26 +400,27 @@ STATIC mp_raw_code_t *load_raw_code(mp_reader_t *reader, qstr_window_t *qw) { // Assign native code to raw code object mp_emit_glue_assign_native(rc, kind, - fun_data, fun_data_len, const_table, + fun_data, fun_data_len, + children, #if MICROPY_PERSISTENT_CODE_SAVE + n_children, prelude_offset, - n_obj, n_raw_code, - n_qstr_link, NULL, + 0, NULL, #endif - prelude.n_pos_args, prelude.scope_flags, type_sig); + native_scope_flags, native_n_pos_args, native_type_sig + ); #endif } return rc; } -mp_raw_code_t *mp_raw_code_load(mp_reader_t *reader) { +mp_compiled_module_t mp_raw_code_load(mp_reader_t *reader, mp_module_context_t *context) { byte header[4]; read_bytes(reader, header, sizeof(header)); if (header[0] != 'M' || header[1] != MPY_VERSION || MPY_FEATURE_DECODE_FLAGS(header[2]) != MPY_FEATURE_FLAGS - || header[3] > mp_small_int_bits() - || read_uint(reader, NULL) > QSTR_WINDOW_SIZE) { + || header[3] > mp_small_int_bits()) { mp_raise_ValueError(MP_ERROR_TEXT("incompatible .mpy file")); } if (MPY_FEATURE_DECODE_ARCH(header[2]) != MP_NATIVE_ARCH_NONE) { @@ -562,25 +429,49 @@ mp_raw_code_t *mp_raw_code_load(mp_reader_t *reader) { mp_raise_ValueError(MP_ERROR_TEXT("incompatible .mpy arch")); } } - qstr_window_t qw; - qw.idx = 0; - mp_raw_code_t *rc = load_raw_code(reader, &qw); + + size_t n_qstr = read_uint(reader); + size_t n_obj = read_uint(reader); + mp_module_context_alloc_tables(context, n_qstr, n_obj); + + // Load qstrs. + for (size_t i = 0; i < n_qstr; ++i) { + context->constants.qstr_table[i] = load_qstr(reader); + } + + // Load constant objects. + for (size_t i = 0; i < n_obj; ++i) { + context->constants.obj_table[i] = load_obj(reader); + } + + // Load top-level module. + mp_compiled_module_t cm2; + cm2.rc = load_raw_code(reader); + cm2.context = context; + + #if MICROPY_PERSISTENT_CODE_SAVE + cm2.has_native = MPY_FEATURE_DECODE_ARCH(header[2]) != MP_NATIVE_ARCH_NONE; + cm2.n_qstr = n_qstr; + cm2.n_obj = n_obj; + #endif + reader->close(reader->data); - return rc; + + return cm2; } -mp_raw_code_t *mp_raw_code_load_mem(const byte *buf, size_t len) { +mp_compiled_module_t mp_raw_code_load_mem(const byte *buf, size_t len, mp_module_context_t *context) { mp_reader_t reader; mp_reader_new_mem(&reader, buf, len, 0); - return mp_raw_code_load(&reader); + return mp_raw_code_load(&reader, context); } #if MICROPY_HAS_FILE_READER -mp_raw_code_t *mp_raw_code_load_file(const char *filename) { +mp_compiled_module_t mp_raw_code_load_file(const char *filename, mp_module_context_t *context) { mp_reader_t reader; mp_reader_new_file(&reader, filename); - return mp_raw_code_load(&reader); + return mp_raw_code_load(&reader, context); } #endif // MICROPY_HAS_FILE_READER @@ -607,26 +498,25 @@ STATIC void mp_print_uint(mp_print_t *print, size_t n) { print->print_strn(print->data, (char *)p, buf + sizeof(buf) - p); } -STATIC void save_qstr(mp_print_t *print, qstr_window_t *qw, qstr qst) { +STATIC void save_qstr(mp_print_t *print, qstr qst) { if (qst <= QSTR_LAST_STATIC) { // encode static qstr - byte buf[2] = {0, qst & 0xff}; - mp_print_bytes(print, buf, 2); - return; - } - size_t idx = qstr_window_insert(qw, qst); - if (idx < QSTR_WINDOW_SIZE) { - // qstr found in window, encode index to it - mp_print_uint(print, idx << 1 | 1); + mp_print_uint(print, qst << 1 | 1); return; } size_t len; const byte *str = qstr_data(qst, &len); mp_print_uint(print, len << 1); - mp_print_bytes(print, str, len); + mp_print_bytes(print, str, len + 1); // +1 to store null terminator } STATIC void save_obj(mp_print_t *print, mp_obj_t o) { + #if MICROPY_EMIT_MACHINE_CODE + if (o == MP_OBJ_FROM_PTR(&mp_fun_table)) { + byte obj_type = 't'; + mp_print_bytes(print, &obj_type, 1); + } else + #endif if (mp_obj_is_str_or_bytes(o)) { byte obj_type; if (mp_obj_is_str(o)) { @@ -638,7 +528,7 @@ STATIC void save_obj(mp_print_t *print, mp_obj_t o) { const char *str = mp_obj_str_get_data(o, &len); mp_print_bytes(print, &obj_type, 1); mp_print_uint(print, len); - mp_print_bytes(print, (const byte *)str, len); + mp_print_bytes(print, (const byte *)str, len + 1); // +1 to store null terminator } else if (MP_OBJ_TO_PTR(o) == &mp_const_ellipsis_obj) { byte obj_type = 'e'; mp_print_bytes(print, &obj_type, 1); @@ -667,136 +557,45 @@ STATIC void save_obj(mp_print_t *print, mp_obj_t o) { } } -STATIC void save_prelude_qstrs(mp_print_t *print, qstr_window_t *qw, const byte *ip) { - save_qstr(print, qw, ip[0] | (ip[1] << 8)); // simple_name - save_qstr(print, qw, ip[2] | (ip[3] << 8)); // source_file -} - -STATIC void save_bytecode(mp_print_t *print, qstr_window_t *qw, const byte *ip, const byte *ip_top) { - while (ip < ip_top) { - size_t sz; - uint f = mp_opcode_format(ip, &sz, true); - if (f == MP_BC_FORMAT_QSTR) { - mp_print_bytes(print, ip, 1); - qstr qst = ip[1] | (ip[2] << 8); - save_qstr(print, qw, qst); - ip += 3; - sz -= 3; - } - mp_print_bytes(print, ip, sz); - ip += sz; - } -} - -STATIC void save_raw_code(mp_print_t *print, mp_raw_code_t *rc, qstr_window_t *qstr_window) { +STATIC void save_raw_code(mp_print_t *print, const mp_raw_code_t *rc) { // Save function kind and data length - mp_print_uint(print, (rc->fun_data_len << 2) | (rc->kind - MP_CODE_BYTECODE)); + mp_print_uint(print, (rc->fun_data_len << 3) | ((rc->n_children != 0) << 2) | (rc->kind - MP_CODE_BYTECODE)); - bytecode_prelude_t prelude; + // Save function code. + mp_print_bytes(print, rc->fun_data, rc->fun_data_len); - if (rc->kind == MP_CODE_BYTECODE) { - // Extract prelude - const byte *ip = rc->fun_data; - const byte *ip_info = extract_prelude(&ip, &prelude); - - // Save prelude - mp_print_bytes(print, rc->fun_data, ip_info - (const byte *)rc->fun_data); - save_prelude_qstrs(print, qstr_window, ip_info); - ip_info += 4; - mp_print_bytes(print, ip_info, ip - ip_info); - - // Save bytecode - const byte *ip_top = (const byte *)rc->fun_data + rc->fun_data_len; - save_bytecode(print, qstr_window, ip, ip_top); #if MICROPY_EMIT_MACHINE_CODE - } else { - // Save native code - mp_print_bytes(print, rc->fun_data, rc->fun_data_len); - - if (rc->kind == MP_CODE_NATIVE_PY || rc->kind == MP_CODE_NATIVE_VIPER) { - // Save qstr link table for native code - mp_print_uint(print, rc->n_qstr); - for (size_t i = 0; i < rc->n_qstr; ++i) { - mp_print_uint(print, rc->qstr_link[i].off); - save_qstr(print, qstr_window, rc->qstr_link[i].qst); - } + if (rc->kind == MP_CODE_NATIVE_PY || rc->kind == MP_CODE_NATIVE_VIPER) { + // Save qstr link table for native code + mp_print_uint(print, rc->n_qstr); + for (size_t i = 0; i < rc->n_qstr; ++i) { + mp_print_uint(print, rc->qstr_link[i].off); + save_qstr(print, rc->qstr_link[i].qst); } + } - if (rc->kind == MP_CODE_NATIVE_PY) { - // Save prelude size - mp_print_uint(print, rc->prelude_offset); - - // Extract prelude and save qstrs in prelude - const byte *ip = (const byte *)rc->fun_data + rc->prelude_offset; - const byte *ip_info = extract_prelude(&ip, &prelude); - save_prelude_qstrs(print, qstr_window, ip_info); - } else { - // Save basic scope info for viper and asm - mp_print_uint(print, rc->scope_flags & MP_SCOPE_FLAG_ALL_SIG); - prelude.n_pos_args = 0; - prelude.n_kwonly_args = 0; - if (rc->kind == MP_CODE_NATIVE_ASM) { - mp_print_uint(print, rc->n_pos_args); - mp_print_uint(print, rc->type_sig); - } + if (rc->kind == MP_CODE_NATIVE_PY) { + // Save prelude size + mp_print_uint(print, rc->prelude_offset); + } else if (rc->kind == MP_CODE_NATIVE_VIPER || rc->kind == MP_CODE_NATIVE_ASM) { + // Save basic scope info for viper and asm + mp_print_uint(print, rc->scope_flags & MP_SCOPE_FLAG_ALL_SIG); + if (rc->kind == MP_CODE_NATIVE_ASM) { + mp_print_uint(print, rc->n_pos_args); + mp_print_uint(print, rc->type_sig); } + } #endif - } - if (rc->kind != MP_CODE_NATIVE_ASM) { - // Save constant table for bytecode, native and viper - - // Number of entries in constant table - mp_print_uint(print, rc->n_obj); - mp_print_uint(print, rc->n_raw_code); - - const mp_uint_t *const_table = rc->const_table; - - // Save function argument names (initial entries in const_table) - // (viper has n_pos_args=n_kwonly_args=0 so doesn't save any qstrs here) - for (size_t i = 0; i < prelude.n_pos_args + prelude.n_kwonly_args; ++i) { - mp_obj_t o = (mp_obj_t)*const_table++; - save_qstr(print, qstr_window, MP_OBJ_QSTR_VALUE(o)); - } - - if (rc->kind != MP_CODE_BYTECODE) { - // Skip saving mp_fun_table entry - ++const_table; - } - - // Save constant objects and raw code children - for (size_t i = 0; i < rc->n_obj; ++i) { - save_obj(print, (mp_obj_t)*const_table++); - } - for (size_t i = 0; i < rc->n_raw_code; ++i) { - save_raw_code(print, (mp_raw_code_t *)(uintptr_t)*const_table++, qstr_window); + if (rc->n_children) { + mp_print_uint(print, rc->n_children); + for (size_t i = 0; i < rc->n_children; ++i) { + save_raw_code(print, rc->children[i]); } } } -STATIC bool mp_raw_code_has_native(mp_raw_code_t *rc) { - if (rc->kind != MP_CODE_BYTECODE) { - return true; - } - - const byte *ip = rc->fun_data; - bytecode_prelude_t prelude; - extract_prelude(&ip, &prelude); - - const mp_uint_t *const_table = rc->const_table - + prelude.n_pos_args + prelude.n_kwonly_args - + rc->n_obj; - - for (size_t i = 0; i < rc->n_raw_code; ++i) { - if (mp_raw_code_has_native((mp_raw_code_t *)(uintptr_t)*const_table++)) { - return true; - } - } - - return false; -} - -void mp_raw_code_save(mp_raw_code_t *rc, mp_print_t *print) { +void mp_raw_code_save(mp_compiled_module_t *cm, mp_print_t *print) { // header contains: // byte 'M' // byte version @@ -813,16 +612,27 @@ void mp_raw_code_save(mp_raw_code_t *rc, mp_print_t *print) { mp_small_int_bits(), #endif }; - if (mp_raw_code_has_native(rc)) { + if (cm->has_native) { header[2] |= MPY_FEATURE_ENCODE_ARCH(MPY_FEATURE_ARCH_DYNAMIC); } mp_print_bytes(print, header, sizeof(header)); - mp_print_uint(print, QSTR_WINDOW_SIZE); - qstr_window_t qw; - qw.idx = 0; - memset(qw.window, 0, sizeof(qw.window)); - save_raw_code(print, rc, &qw); + // Number of entries in constant table. + mp_print_uint(print, cm->n_qstr); + mp_print_uint(print, cm->n_obj); + + // Save qstrs. + for (size_t i = 0; i < cm->n_qstr; ++i) { + save_qstr(print, cm->context->constants.qstr_table[i]); + } + + // Save constant objects. + for (size_t i = 0; i < cm->n_obj; ++i) { + save_obj(print, (mp_obj_t)cm->context->constants.obj_table[i]); + } + + // Save outer raw code, which will save all its child raw codes. + save_raw_code(print, cm->rc); } #if MICROPY_PERSISTENT_CODE_SAVE_FILE @@ -839,12 +649,12 @@ STATIC void fd_print_strn(void *env, const char *str, size_t len) { (void)ret; } -void mp_raw_code_save_file(mp_raw_code_t *rc, const char *filename) { +void mp_raw_code_save_file(mp_compiled_module_t *cm, const char *filename) { MP_THREAD_GIL_EXIT(); int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); MP_THREAD_GIL_ENTER(); mp_print_t fd_print = {(void *)(intptr_t)fd, fd_print_strn}; - mp_raw_code_save(rc, &fd_print); + mp_raw_code_save(cm, &fd_print); MP_THREAD_GIL_EXIT(); close(fd); MP_THREAD_GIL_ENTER(); diff --git a/py/persistentcode.h b/py/persistentcode.h index 94fc3bf2d3..1991ba26ff 100644 --- a/py/persistentcode.h +++ b/py/persistentcode.h @@ -31,7 +31,7 @@ #include "py/emitglue.h" // The current version of .mpy files -#define MPY_VERSION 5 +#define MPY_VERSION 6 // Macros to encode/decode flags to/from the feature byte #define MPY_FEATURE_ENCODE_FLAGS(flags) (flags) @@ -102,12 +102,12 @@ enum { MP_NATIVE_ARCH_XTENSAWIN, }; -mp_raw_code_t *mp_raw_code_load(mp_reader_t *reader); -mp_raw_code_t *mp_raw_code_load_mem(const byte *buf, size_t len); -mp_raw_code_t *mp_raw_code_load_file(const char *filename); +mp_compiled_module_t mp_raw_code_load(mp_reader_t *reader, mp_module_context_t *ctx); +mp_compiled_module_t mp_raw_code_load_mem(const byte *buf, size_t len, mp_module_context_t *ctx); +mp_compiled_module_t mp_raw_code_load_file(const char *filename, mp_module_context_t *ctx); -void mp_raw_code_save(mp_raw_code_t *rc, mp_print_t *print); -void mp_raw_code_save_file(mp_raw_code_t *rc, const char *filename); +void mp_raw_code_save(mp_compiled_module_t *cm, mp_print_t *print); +void mp_raw_code_save_file(mp_compiled_module_t *cm, const char *filename); void mp_native_relocate(void *reloc, uint8_t *text, uintptr_t reloc_text); diff --git a/py/profile.c b/py/profile.c index d0ac99e074..4e23e9eac4 100644 --- a/py/profile.c +++ b/py/profile.c @@ -27,14 +27,16 @@ #include "py/profile.h" #include "py/bc0.h" #include "py/gc.h" +#include "py/objfun.h" #if MICROPY_PY_SYS_SETTRACE #define prof_trace_cb MP_STATE_THREAD(prof_trace_callback) +#define QSTR_MAP(context, idx) (context->constants.qstr_table[idx]) STATIC uint mp_prof_bytecode_lineno(const mp_raw_code_t *rc, size_t bc) { const mp_bytecode_prelude_t *prelude = &rc->prelude; - return mp_bytecode_get_source_line(prelude->line_info, bc); + return mp_bytecode_get_source_line(prelude->line_info, prelude->line_info_top, bc); } void mp_prof_extract_prelude(const byte *bytecode, mp_bytecode_prelude_t *prelude) { @@ -50,13 +52,14 @@ void mp_prof_extract_prelude(const byte *bytecode, mp_bytecode_prelude_t *prelud MP_BC_PRELUDE_SIZE_DECODE(ip); - prelude->line_info = ip + 4; + prelude->line_info_top = ip + n_info; prelude->opcodes = ip + n_info + n_cell; - qstr block_name = ip[0] | (ip[1] << 8); - qstr source_file = ip[2] | (ip[3] << 8); - prelude->qstr_block_name = block_name; - prelude->qstr_source_file = source_file; + prelude->qstr_block_name_idx = mp_decode_uint_value(ip); + for (size_t i = 0; i < 1 + n_pos_args + n_kwonly_args; ++i) { + ip = mp_decode_uint_skip(ip); + } + prelude->line_info = ip; } /******************************************************************************/ @@ -69,22 +72,19 @@ STATIC void code_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t k const mp_bytecode_prelude_t *prelude = &rc->prelude; mp_printf(print, "", - prelude->qstr_block_name, + QSTR_MAP(o->context, prelude->qstr_block_name_idx), o, - prelude->qstr_source_file, + QSTR_MAP(o->context, 0), rc->line_of_definition ); } -STATIC mp_obj_tuple_t *code_consts(const mp_raw_code_t *rc) { - const mp_bytecode_prelude_t *prelude = &rc->prelude; - int start = prelude->n_pos_args + prelude->n_kwonly_args + rc->n_obj; - int stop = prelude->n_pos_args + prelude->n_kwonly_args + rc->n_obj + rc->n_raw_code; - mp_obj_tuple_t *consts = MP_OBJ_TO_PTR(mp_obj_new_tuple(stop - start + 1, NULL)); +STATIC mp_obj_tuple_t *code_consts(const mp_module_context_t *context, const mp_raw_code_t *rc) { + mp_obj_tuple_t *consts = MP_OBJ_TO_PTR(mp_obj_new_tuple(rc->n_children + 1, NULL)); size_t const_no = 0; - for (int i = start; i < stop; ++i) { - mp_obj_t code = mp_obj_new_code((const mp_raw_code_t *)MP_OBJ_TO_PTR(rc->const_table[i])); + for (size_t i = 0; i < rc->n_children; ++i) { + mp_obj_t code = mp_obj_new_code(context, rc->children[i]); if (code == MP_OBJ_NULL) { m_malloc_fail(sizeof(mp_obj_code_t)); } @@ -149,16 +149,16 @@ STATIC void code_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { ); break; case MP_QSTR_co_consts: - dest[0] = MP_OBJ_FROM_PTR(code_consts(rc)); + dest[0] = MP_OBJ_FROM_PTR(code_consts(o->context, rc)); break; case MP_QSTR_co_filename: - dest[0] = MP_OBJ_NEW_QSTR(prelude->qstr_source_file); + dest[0] = MP_OBJ_NEW_QSTR(QSTR_MAP(o->context, 0)); break; case MP_QSTR_co_firstlineno: dest[0] = MP_OBJ_NEW_SMALL_INT(mp_prof_bytecode_lineno(rc, 0)); break; case MP_QSTR_co_name: - dest[0] = MP_OBJ_NEW_QSTR(prelude->qstr_block_name); + dest[0] = MP_OBJ_NEW_QSTR(QSTR_MAP(o->context, prelude->qstr_block_name_idx)); break; case MP_QSTR_co_names: dest[0] = MP_OBJ_FROM_PTR(o->dict_locals); @@ -180,12 +180,13 @@ const mp_obj_type_t mp_type_settrace_codeobj = { .attr = code_attr, }; -mp_obj_t mp_obj_new_code(const mp_raw_code_t *rc) { +mp_obj_t mp_obj_new_code(const mp_module_context_t *context, const mp_raw_code_t *rc) { mp_obj_code_t *o = m_new_obj_maybe(mp_obj_code_t); if (o == NULL) { return MP_OBJ_NULL; } o->base.type = &mp_type_settrace_codeobj; + o->context = context; o->rc = rc; o->dict_locals = mp_locals_get(); // this is a wrong! how to do this properly? o->lnotab = MP_OBJ_NULL; @@ -204,9 +205,9 @@ STATIC void frame_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t mp_printf(print, "", frame, - prelude->qstr_source_file, + QSTR_MAP(code->context, 0), frame->lineno, - prelude->qstr_block_name + QSTR_MAP(code->context, prelude->qstr_block_name_idx) ); } @@ -229,7 +230,7 @@ STATIC void frame_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { dest[0] = MP_OBJ_FROM_PTR(o->code); break; case MP_QSTR_f_globals: - dest[0] = MP_OBJ_FROM_PTR(o->code_state->fun_bc->globals); + dest[0] = MP_OBJ_FROM_PTR(o->code_state->fun_bc->context->module.globals); break; case MP_QSTR_f_lasti: dest[0] = MP_OBJ_NEW_SMALL_INT(o->lasti); @@ -258,7 +259,7 @@ mp_obj_t mp_obj_new_frame(const mp_code_state_t *code_state) { return MP_OBJ_NULL; } - mp_obj_code_t *code = o->code = MP_OBJ_TO_PTR(mp_obj_new_code(code_state->fun_bc->rc)); + mp_obj_code_t *code = o->code = MP_OBJ_TO_PTR(mp_obj_new_code(code_state->fun_bc->context, code_state->fun_bc->rc)); if (code == NULL) { return MP_OBJ_NULL; } diff --git a/py/profile.h b/py/profile.h index 64e207d04f..7f3f914034 100644 --- a/py/profile.h +++ b/py/profile.h @@ -34,7 +34,9 @@ #define mp_prof_is_executing MP_STATE_THREAD(prof_callback_is_executing) typedef struct _mp_obj_code_t { + // TODO this was 4 words mp_obj_base_t base; + const mp_module_context_t *context; const mp_raw_code_t *rc; mp_obj_dict_t *dict_locals; mp_obj_t lnotab; @@ -53,7 +55,7 @@ typedef struct _mp_obj_frame_t { void mp_prof_extract_prelude(const byte *bytecode, mp_bytecode_prelude_t *prelude); -mp_obj_t mp_obj_new_code(const mp_raw_code_t *rc); +mp_obj_t mp_obj_new_code(const mp_module_context_t *mc, const mp_raw_code_t *rc); mp_obj_t mp_obj_new_frame(const mp_code_state_t *code_state); // This is the implementation for the sys.settrace diff --git a/py/qstr.h b/py/qstr.h index ded105760c..fa634f90b0 100644 --- a/py/qstr.h +++ b/py/qstr.h @@ -46,6 +46,7 @@ enum { }; typedef size_t qstr; +typedef uint16_t qstr_short_t; #if MICROPY_QSTR_BYTES_IN_HASH == 1 typedef uint8_t qstr_hash_t; diff --git a/py/scope.c b/py/scope.c index 98e02fb53f..8fc0943289 100644 --- a/py/scope.c +++ b/py/scope.c @@ -40,7 +40,7 @@ STATIC const uint8_t scope_simple_name_table[] = { [SCOPE_GEN_EXPR] = MP_QSTR__lt_genexpr_gt_, }; -scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, mp_uint_t emit_options) { +scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, mp_uint_t emit_options) { // Make sure those qstrs indeed fit in an uint8_t. MP_STATIC_ASSERT(MP_QSTR__lt_module_gt_ <= UINT8_MAX); MP_STATIC_ASSERT(MP_QSTR__lt_lambda_gt_ <= UINT8_MAX); @@ -52,7 +52,6 @@ scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, mp_u scope_t *scope = m_new0(scope_t, 1); scope->kind = kind; scope->pn = pn; - scope->source_file = source_file; if (kind == SCOPE_FUNCTION || kind == SCOPE_CLASS) { assert(MP_PARSE_NODE_IS_STRUCT(pn)); scope->simple_name = MP_PARSE_NODE_LEAF_ARG(((mp_parse_node_struct_t *)pn)->nodes[0]); diff --git a/py/scope.h b/py/scope.h index edf164c4ad..5006deadea 100644 --- a/py/scope.h +++ b/py/scope.h @@ -75,7 +75,6 @@ typedef struct _scope_t { struct _scope_t *next; mp_parse_node_t pn; mp_raw_code_t *raw_code; - uint16_t source_file; // a qstr uint16_t simple_name; // a qstr uint16_t scope_flags; // see runtime0.h uint16_t emit_options; // see emitglue.h @@ -90,7 +89,7 @@ typedef struct _scope_t { id_info_t *id_info; } scope_t; -scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, mp_uint_t emit_options); +scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, mp_uint_t emit_options); void scope_free(scope_t *scope); id_info_t *scope_find_or_add_id(scope_t *scope, qstr qstr, id_info_kind_t kind); id_info_t *scope_find(scope_t *scope, qstr qstr); diff --git a/py/showbc.c b/py/showbc.c index da8077eccd..1300ac1fa3 100644 --- a/py/showbc.c +++ b/py/showbc.c @@ -41,43 +41,32 @@ #define DECODE_ULABEL do { unum = (ip[0] | (ip[1] << 8)); ip += 2; } while (0) #define DECODE_SLABEL do { unum = (ip[0] | (ip[1] << 8)) - 0x8000; ip += 2; } while (0) -#if MICROPY_PERSISTENT_CODE +#if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE #define DECODE_QSTR \ - qst = ip[0] | ip[1] << 8; \ - ip += 2; -#define DECODE_PTR \ DECODE_UINT; \ - unum = mp_showbc_const_table[unum] -#define DECODE_OBJ \ - DECODE_UINT; \ - unum = mp_showbc_const_table[unum] + qst = mp_showbc_constants->qstr_table[unum] #else -#define DECODE_QSTR { \ - qst = 0; \ - do { \ - qst = (qst << 7) + (*ip & 0x7f); \ - } while ((*ip++ & 0x80) != 0); \ -} -#define DECODE_PTR do { \ - ip = (byte *)MP_ALIGN(ip, sizeof(void *)); \ - unum = (uintptr_t)*(void **)ip; \ - ip += sizeof(void *); \ -} while (0) -#define DECODE_OBJ do { \ - ip = (byte *)MP_ALIGN(ip, sizeof(mp_obj_t)); \ - unum = (mp_uint_t)*(mp_obj_t *)ip; \ - ip += sizeof(mp_obj_t); \ -} while (0) +#define DECODE_QSTR \ + DECODE_UINT; \ + qst = unum; #endif -const byte *mp_showbc_code_start; -const mp_uint_t *mp_showbc_const_table; +#define DECODE_PTR \ + DECODE_UINT; -void mp_bytecode_print(const mp_print_t *print, const void *descr, const byte *ip, mp_uint_t len, const mp_uint_t *const_table) { +#define DECODE_OBJ \ + DECODE_UINT; \ + unum = (mp_uint_t)mp_showbc_constants->obj_table[unum] + +const byte * mp_showbc_code_start; +const mp_module_constants_t *mp_showbc_constants; + +#include "py/emitglue.h" +void mp_bytecode_print(const mp_print_t *print, const void *descr, const byte *ip, mp_uint_t len, const mp_module_constants_t *cm) { mp_showbc_code_start = ip; // Decode prelude @@ -85,16 +74,15 @@ void mp_bytecode_print(const mp_print_t *print, const void *descr, const byte *i MP_BC_PRELUDE_SIZE_DECODE(ip); const byte *code_info = ip; - #if MICROPY_PERSISTENT_CODE - qstr block_name = code_info[0] | (code_info[1] << 8); - qstr source_file = code_info[2] | (code_info[3] << 8); - code_info += 4; - #else qstr block_name = mp_decode_uint(&code_info); - qstr source_file = mp_decode_uint(&code_info); + #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE + block_name = cm->qstr_table[block_name]; + qstr source_file = cm->qstr_table[0]; + #else + qstr source_file = cm->source_file; #endif - mp_printf(print, "File %s, code block '%s' (descriptor: %p, bytecode @%p " UINT_FMT " bytes)\n", - qstr_str(source_file), qstr_str(block_name), descr, mp_showbc_code_start, len); + mp_printf(print, "File %s, code block '%s' (descriptor: %p, bytecode @%p " UINT_FMT " bytes)\n",// rct=%p\n", + qstr_str(source_file), qstr_str(block_name), descr, mp_showbc_code_start, len);// , ((mp_raw_code_t*)descr)->children); // raw bytecode dump size_t prelude_size = ip - mp_showbc_code_start + n_info + n_cell; @@ -111,7 +99,11 @@ void mp_bytecode_print(const mp_print_t *print, const void *descr, const byte *i // bytecode prelude: arg names (as qstr objects) mp_printf(print, "arg names:"); for (mp_uint_t i = 0; i < n_pos_args + n_kwonly_args; i++) { - mp_printf(print, " %s", qstr_str(MP_OBJ_QSTR_VALUE(const_table[i]))); + qstr qst = mp_decode_uint(&code_info); + #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE + qst = cm->qstr_table[qst]; + #endif + mp_printf(print, " %s", qstr_str(qst)); } mp_printf(print, "\n"); @@ -120,6 +112,7 @@ void mp_bytecode_print(const mp_print_t *print, const void *descr, const byte *i // skip over code_info ip += n_info; + const byte *line_info_top = ip; // bytecode prelude: initialise closed over variables for (size_t i = 0; i < n_cell; ++i) { @@ -132,7 +125,7 @@ void mp_bytecode_print(const mp_print_t *print, const void *descr, const byte *i mp_int_t bc = 0; mp_uint_t source_line = 1; mp_printf(print, " bc=" INT_FMT " line=" UINT_FMT "\n", bc, source_line); - for (const byte *ci = code_info; *ci;) { + for (const byte *ci = code_info; ci < line_info_top;) { if ((ci[0] & 0x80) == 0) { // 0b0LLBBBBB encoding bc += ci[0] & 0x1f; @@ -147,7 +140,7 @@ void mp_bytecode_print(const mp_print_t *print, const void *descr, const byte *i mp_printf(print, " bc=" INT_FMT " line=" UINT_FMT "\n", bc, source_line); } } - mp_bytecode_print2(print, ip, len - prelude_size, const_table); + mp_bytecode_print2(print, ip, len - prelude_size, cm); } const byte *mp_bytecode_print_str(const mp_print_t *print, const byte *ip) { @@ -535,9 +528,9 @@ const byte *mp_bytecode_print_str(const mp_print_t *print, const byte *ip) { return ip; } -void mp_bytecode_print2(const mp_print_t *print, const byte *ip, size_t len, const mp_uint_t *const_table) { +void mp_bytecode_print2(const mp_print_t *print, const byte *ip, size_t len, const mp_module_constants_t *cm) { mp_showbc_code_start = ip; - mp_showbc_const_table = const_table; + mp_showbc_constants = cm; while (ip < len + mp_showbc_code_start) { mp_printf(print, "%02u ", (uint)(ip - mp_showbc_code_start)); ip = mp_bytecode_print_str(print, ip); diff --git a/py/vm.c b/py/vm.c index 0289bcfae5..b762c92bf2 100644 --- a/py/vm.c +++ b/py/vm.c @@ -31,9 +31,9 @@ #include "py/emitglue.h" #include "py/objtype.h" +#include "py/objfun.h" #include "py/runtime.h" #include "py/bc0.h" -#include "py/bc.h" #include "py/profile.h" // *FORMAT-OFF* @@ -44,7 +44,7 @@ #else #define TRACE_PREFIX mp_printf(&mp_plat_print, "sp=%d ", (int)(sp - &code_state->state[0] + 1)) #endif -#define TRACE(ip) TRACE_PREFIX; mp_bytecode_print2(&mp_plat_print, ip, 1, code_state->fun_bc->const_table); +#define TRACE(ip) TRACE_PREFIX; mp_bytecode_print2(&mp_plat_print, ip, 1, &code_state->fun_bc->context->constants); #else #define TRACE(ip) #endif @@ -64,35 +64,28 @@ #define DECODE_ULABEL size_t ulab = (ip[0] | (ip[1] << 8)); ip += 2 #define DECODE_SLABEL size_t slab = (ip[0] | (ip[1] << 8)) - 0x8000; ip += 2 -#if MICROPY_PERSISTENT_CODE +#if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE #define DECODE_QSTR \ - qstr qst = ip[0] | ip[1] << 8; \ - ip += 2; -#define DECODE_PTR \ DECODE_UINT; \ - void *ptr = (void*)(uintptr_t)code_state->fun_bc->const_table[unum] -#define DECODE_OBJ \ - DECODE_UINT; \ - mp_obj_t obj = (mp_obj_t)code_state->fun_bc->const_table[unum] + qstr qst = qstr_table[unum] #else -#define DECODE_QSTR qstr qst = 0; \ - do { \ - qst = (qst << 7) + (*ip & 0x7f); \ - } while ((*ip++ & 0x80) != 0) -#define DECODE_PTR \ - ip = (byte*)MP_ALIGN(ip, sizeof(void*)); \ - void *ptr = *(void**)ip; \ - ip += sizeof(void*) -#define DECODE_OBJ \ - ip = (byte*)MP_ALIGN(ip, sizeof(mp_obj_t)); \ - mp_obj_t obj = *(mp_obj_t*)ip; \ - ip += sizeof(mp_obj_t) +#define DECODE_QSTR \ + DECODE_UINT; \ + qstr qst = unum; #endif +#define DECODE_PTR \ + DECODE_UINT; \ + void *ptr = (void *)(uintptr_t)code_state->fun_bc->child_table[unum] + +#define DECODE_OBJ \ + DECODE_UINT; \ + mp_obj_t obj = (mp_obj_t)code_state->fun_bc->context->constants.obj_table[unum] + #define PUSH(val) *++sp = (val) #define POP() (*sp--) #define TOP() (*sp) @@ -255,6 +248,9 @@ outer_dispatch_loop: // local variables that are not visible to the exception handler const byte *ip = code_state->ip; mp_obj_t *sp = code_state->sp; + #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE + const qstr_short_t *qstr_table = code_state->fun_bc->context->constants.qstr_table; + #endif mp_obj_t obj_shared; MICROPY_VM_HOOK_INIT @@ -859,15 +855,15 @@ unwind_jump:; ENTRY(MP_BC_MAKE_FUNCTION): { DECODE_PTR; - PUSH(mp_make_function_from_raw_code(ptr, MP_OBJ_NULL, MP_OBJ_NULL)); + PUSH(mp_make_function_from_raw_code(ptr, code_state->fun_bc->context, NULL)); DISPATCH(); } ENTRY(MP_BC_MAKE_FUNCTION_DEFARGS): { DECODE_PTR; // Stack layout: def_tuple def_dict <- TOS - mp_obj_t def_dict = POP(); - SET_TOP(mp_make_function_from_raw_code(ptr, TOP(), def_dict)); + sp -= 1; + SET_TOP(mp_make_function_from_raw_code(ptr, code_state->fun_bc->context, sp)); DISPATCH(); } @@ -876,7 +872,7 @@ unwind_jump:; size_t n_closed_over = *ip++; // Stack layout: closed_overs <- TOS sp -= n_closed_over - 1; - SET_TOP(mp_make_closure_from_raw_code(ptr, n_closed_over, sp)); + SET_TOP(mp_make_closure_from_raw_code(ptr, code_state->fun_bc->context, n_closed_over, sp)); DISPATCH(); } @@ -885,7 +881,7 @@ unwind_jump:; size_t n_closed_over = *ip++; // Stack layout: def_tuple def_dict closed_overs <- TOS sp -= 2 + n_closed_over - 1; - SET_TOP(mp_make_closure_from_raw_code(ptr, 0x100 | n_closed_over, sp)); + SET_TOP(mp_make_closure_from_raw_code(ptr, code_state->fun_bc->context, 0x100 | n_closed_over, sp)); DISPATCH(); } @@ -1384,23 +1380,20 @@ unwind_loop: const byte *ip = code_state->fun_bc->bytecode; MP_BC_PRELUDE_SIG_DECODE(ip); MP_BC_PRELUDE_SIZE_DECODE(ip); + const byte *line_info_top = ip + n_info; const byte *bytecode_start = ip + n_info + n_cell; - #if !MICROPY_PERSISTENT_CODE - // so bytecode is aligned - bytecode_start = MP_ALIGN(bytecode_start, sizeof(mp_uint_t)); - #endif size_t bc = code_state->ip - bytecode_start; - #if MICROPY_PERSISTENT_CODE - qstr block_name = ip[0] | (ip[1] << 8); - qstr source_file = ip[2] | (ip[3] << 8); - ip += 4; - #else qstr block_name = mp_decode_uint_value(ip); - ip = mp_decode_uint_skip(ip); - qstr source_file = mp_decode_uint_value(ip); - ip = mp_decode_uint_skip(ip); + for (size_t i = 0; i < 1 + n_pos_args + n_kwonly_args; ++i) { + ip = mp_decode_uint_skip(ip); + } + #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE + block_name = code_state->fun_bc->context->constants.qstr_table[block_name]; + qstr source_file = code_state->fun_bc->context->constants.qstr_table[0]; + #else + qstr source_file = code_state->fun_bc->context->constants.source_file; #endif - size_t source_line = mp_bytecode_get_source_line(ip, bc); + size_t source_line = mp_bytecode_get_source_line(ip, line_info_top, bc); mp_obj_exception_add_traceback(MP_OBJ_FROM_PTR(nlr.ret_val), source_file, source_line, block_name); } diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c index 5f05c1da3e..ae6dd770b1 100644 --- a/shared/runtime/pyexec.c +++ b/shared/runtime/pyexec.c @@ -83,7 +83,11 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input #if MICROPY_MODULE_FROZEN_MPY if (exec_flags & EXEC_FLAG_SOURCE_IS_RAW_CODE) { // source is a raw_code object, create the function - module_fun = mp_make_function_from_raw_code(source, MP_OBJ_NULL, MP_OBJ_NULL); + const mp_frozen_module_t *frozen = source; + mp_module_context_t *ctx = m_new_obj(mp_module_context_t); + ctx->module.globals = mp_globals_get(); + ctx->constants = frozen->constants; + module_fun = mp_make_function_from_raw_code(frozen->rc, ctx, NULL); } else #endif { diff --git a/tests/cmdline/cmd_parsetree.py.exp b/tests/cmdline/cmd_parsetree.py.exp index bee4fc99d1..ac16f6d88d 100644 --- a/tests/cmdline/cmd_parsetree.py.exp +++ b/tests/cmdline/cmd_parsetree.py.exp @@ -39,50 +39,52 @@ [ 13] \(rule\|arglist\)(164) (n=1) id(b) ---------------- -File cmdline/cmd_parsetree.py, code block '' (descriptor: \.\+, bytecode @\.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): -######## -\.\+63 +File cmdline/cmd_parsetree.py, code block '' (descriptor: \.\+, bytecode @\.\+ 64 bytes) +Raw bytecode (code_info_size=13, bytecode_size=51): + 20 16 01 60 28 23 23 24 24 24 24 24 25 2a 00 5f + 4b 05 00 16 02 42 f8 7f 51 16 03 10 04 16 05 23 + 00 16 06 23 01 16 07 23 02 16 08 23 03 16 09 22 + 80 7b 16 0a 23 04 14 0b 11 05 36 01 16 0c 51 63 arg names: (N_STATE 5) (N_EXC_STACK 0) bc=0 line=1 bc=0 line=4 - bc=9 line=5 - bc=12 line=6 - bc=16 line=7 - bc=22 line=8 - bc=27 line=9 - bc=32 line=10 - bc=37 line=11 - bc=42 line=12 - bc=48 line=13 + bc=8 line=5 + bc=11 line=6 + bc=14 line=7 + bc=18 line=8 + bc=22 line=9 + bc=26 line=10 + bc=30 line=11 + bc=34 line=12 + bc=39 line=13 00 BUILD_TUPLE 0 02 GET_ITER_STACK -03 FOR_ITER 12 +03 FOR_ITER 11 06 STORE_NAME i -09 JUMP 3 -12 LOAD_CONST_NONE -13 STORE_NAME a -16 LOAD_CONST_STRING 'str' -19 STORE_NAME b -22 LOAD_CONST_OBJ \.\+ -24 STORE_NAME c -27 LOAD_CONST_OBJ \.\+ -29 STORE_NAME d -32 LOAD_CONST_OBJ \.\+ -34 STORE_NAME e -37 LOAD_CONST_OBJ \.\+ -39 STORE_NAME f -42 LOAD_CONST_SMALL_INT 123 -45 STORE_NAME g -48 LOAD_CONST_OBJ \.\+ -50 LOAD_METHOD format -53 LOAD_NAME b -56 CALL_METHOD n=1 nkw=0 -58 STORE_NAME h -61 LOAD_CONST_NONE -62 RETURN_VALUE +08 JUMP 3 +11 LOAD_CONST_NONE +12 STORE_NAME a +14 LOAD_CONST_STRING 'str' +16 STORE_NAME b +18 LOAD_CONST_OBJ \.\+='a very long str that will not be interned' +20 STORE_NAME c +22 LOAD_CONST_OBJ \.\+=b'bytes' +24 STORE_NAME d +26 LOAD_CONST_OBJ \.\+=b'a very long bytes that will not be interned' +28 STORE_NAME e +30 LOAD_CONST_OBJ \.\+=123456789012345678901234567890 +32 STORE_NAME f +34 LOAD_CONST_SMALL_INT 123 +37 STORE_NAME g +39 LOAD_CONST_OBJ \.\+="fstring: '{}'" +41 LOAD_METHOD format +43 LOAD_NAME b +45 CALL_METHOD n=1 nkw=0 +47 STORE_NAME h +49 LOAD_CONST_NONE +50 RETURN_VALUE mem: total=\\d\+, current=\\d\+, peak=\\d\+ stack: \\d\+ out of \\d\+ GC: total: \\d\+, used: \\d\+, free: \\d\+ diff --git a/tests/cmdline/cmd_showbc.py.exp b/tests/cmdline/cmd_showbc.py.exp index 22712b79ee..031820fcd9 100644 --- a/tests/cmdline/cmd_showbc.py.exp +++ b/tests/cmdline/cmd_showbc.py.exp @@ -1,51 +1,144 @@ -File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): -######## -\.\+63 +File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ 63 bytes) +Raw bytecode (code_info_size=18, bytecode_size=45): + 10 20 01 60 20 84 7d 64 60 88 07 64 60 69 20 62 + 64 20 32 00 16 02 32 01 16 02 81 2a 01 53 33 02 + 16 02 32 03 16 02 54 32 04 10 03 34 02 16 03 19 + 03 32 05 16 02 80 10 04 2a 01 1b 05 69 51 63 arg names: (N_STATE 3) (N_EXC_STACK 0) bc=0 line=1 -######## - bc=\\d\+ line=160 + bc=0 line=4 + bc=0 line=5 + bc=4 line=130 + bc=8 line=133 + bc=8 line=136 + bc=16 line=143 + bc=20 line=146 + bc=20 line=149 + bc=29 line=152 + bc=29 line=153 + bc=31 line=156 + bc=35 line=159 + bc=35 line=160 00 MAKE_FUNCTION \.\+ -\\d\+ STORE_NAME f -\\d\+ MAKE_FUNCTION \.\+ -\\d\+ STORE_NAME f -\\d\+ LOAD_CONST_SMALL_INT 1 -\\d\+ BUILD_TUPLE 1 -\\d\+ LOAD_NULL -\\d\+ MAKE_FUNCTION_DEFARGS \.\+ -\\d\+ STORE_NAME f -\\d\+ MAKE_FUNCTION \.\+ -\\d\+ STORE_NAME f -\\d\+ LOAD_BUILD_CLASS -\\d\+ MAKE_FUNCTION \.\+ -\\d\+ LOAD_CONST_STRING 'Class' -\\d\+ CALL_FUNCTION n=2 nkw=0 -\\d\+ STORE_NAME Class -\\d\+ DELETE_NAME Class -\\d\+ MAKE_FUNCTION \.\+ -\\d\+ STORE_NAME f -\\d\+ LOAD_CONST_SMALL_INT 0 -\\d\+ LOAD_CONST_STRING '*' -\\d\+ BUILD_TUPLE 1 -\\d\+ IMPORT_NAME 'sys' -\\d\+ IMPORT_STAR -\\d\+ LOAD_CONST_NONE -\\d\+ RETURN_VALUE -File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): +02 STORE_NAME f +04 MAKE_FUNCTION \.\+ +06 STORE_NAME f +08 LOAD_CONST_SMALL_INT 1 +09 BUILD_TUPLE 1 +11 LOAD_NULL +12 MAKE_FUNCTION_DEFARGS \.\+ +14 STORE_NAME f +16 MAKE_FUNCTION \.\+ +18 STORE_NAME f +20 LOAD_BUILD_CLASS +21 MAKE_FUNCTION \.\+ +23 LOAD_CONST_STRING 'Class' +25 CALL_FUNCTION n=2 nkw=0 +27 STORE_NAME Class +29 DELETE_NAME Class +31 MAKE_FUNCTION \.\+ +33 STORE_NAME f +35 LOAD_CONST_SMALL_INT 0 +36 LOAD_CONST_STRING '*' +38 BUILD_TUPLE 1 +40 IMPORT_NAME 'sys' +42 IMPORT_STAR +43 LOAD_CONST_NONE +44 RETURN_VALUE +File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ 48\[24\] bytes) +Raw bytecode (code_info_size=8\[46\], bytecode_size=398): + a8 12 9\[bf\] 03 02 60 60 26 22 24 64 22 26 25 25 24 + 26 23 63 22 22 25 23 23 31 6d 25 65 25 25 69 68 + 26 65 27 6a 62 20 23 62 2a 29 69 24 25 28 67 26 ######## -\.\+rg names: +\.\+81 63 +arg names: (N_STATE 22) (N_EXC_STACK 2) (INIT_CELL 14) (INIT_CELL 15) (INIT_CELL 16) bc=0 line=1 + bc=0 line=4 + bc=0 line=7 + bc=6 line=8 + bc=8 line=9 + bc=12 line=10 + bc=16 line=13 + bc=18 line=14 + bc=24 line=15 + bc=29 line=16 + bc=34 line=17 + bc=38 line=18 + bc=44 line=19 + bc=47 line=20 + bc=50 line=23 + bc=52 line=24 + bc=54 line=25 + bc=59 line=26 + bc=62 line=27 + bc=65 line=28 + bc=82 line=29 + bc=95 line=32 + bc=100 line=33 + bc=105 line=36 + bc=110 line=37 + bc=115 line=38 + bc=124 line=41 + bc=132 line=44 + bc=138 line=45 + bc=143 line=48 + bc=150 line=49 + bc=160 line=52 + bc=162 line=55 + bc=162 line=56 + bc=165 line=57 + bc=167 line=60 + bc=177 line=61 + bc=186 line=62 + bc=195 line=65 + bc=199 line=66 + bc=204 line=67 + bc=212 line=68 + bc=219 line=71 + bc=225 line=72 + bc=232 line=73 + bc=242 line=74 + bc=250 line=77 + bc=254 line=78 + bc=260 line=80 + bc=263 line=81 + bc=266 line=82 + bc=273 line=83 + bc=276 line=84 + bc=283 line=85 + bc=289 line=88 + bc=296 line=89 + bc=301 line=92 + bc=307 line=93 + bc=310 line=94 ######## - bc=\\d\+ line=127 + bc=321 line=96 + bc=329 line=98 + bc=332 line=99 + bc=335 line=100 + bc=338 line=101 +######## + bc=346 line=103 + bc=354 line=106 + bc=359 line=107 + bc=365 line=110 + bc=368 line=111 + bc=374 line=114 + bc=374 line=117 + bc=379 line=118 + bc=391 line=121 + bc=391 line=122 + bc=392 line=123 + bc=394 line=126 + bc=396 line=127 00 LOAD_CONST_NONE 01 LOAD_CONST_FALSE 02 BINARY_OP 27 __add__ @@ -80,247 +173,251 @@ Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): 42 STORE_MAP 43 STORE_FAST 3 44 LOAD_CONST_STRING 'a' -47 STORE_FAST 4 -48 LOAD_CONST_OBJ \.\+ -\\d\+ STORE_FAST 5 -\\d\+ LOAD_CONST_SMALL_INT 1 -\\d\+ STORE_FAST 6 -\\d\+ LOAD_CONST_SMALL_INT 2 -\\d\+ STORE_FAST 7 -\\d\+ LOAD_FAST 0 -\\d\+ LOAD_DEREF 14 -58 BINARY_OP 27 __add__ -\\d\+ STORE_FAST 8 -\\d\+ LOAD_FAST 0 -\\d\+ UNARY_OP 1 __neg__ -\\d\+ STORE_FAST 9 -\\d\+ LOAD_FAST 0 -\\d\+ UNARY_OP 3 -\\d\+ STORE_FAST 10 -\\d\+ LOAD_FAST 0 -\\d\+ LOAD_DEREF 14 -\\d\+ DUP_TOP -\\d\+ ROT_THREE -\\d\+ BINARY_OP 2 __eq__ -\\d\+ JUMP_IF_FALSE_OR_POP \\d\+ -\\d\+ LOAD_FAST 1 -\\d\+ BINARY_OP 2 __eq__ -\\d\+ JUMP \\d\+ -\\d\+ ROT_TWO -\\d\+ POP_TOP -\\d\+ STORE_FAST 10 -\\d\+ LOAD_FAST 0 -\\d\+ LOAD_DEREF 14 -\\d\+ BINARY_OP 2 __eq__ -\\d\+ JUMP_IF_FALSE_OR_POP \\d\+ -\\d\+ LOAD_DEREF 14 -\\d\+ LOAD_FAST 1 -\\d\+ BINARY_OP 2 __eq__ -\\d\+ UNARY_OP 3 -\\d\+ STORE_FAST 10 -\\d\+ LOAD_DEREF 14 -\\d\+ LOAD_ATTR c -\\d\+ STORE_FAST 11 -\\d\+ LOAD_FAST 11 -\\d\+ LOAD_DEREF 14 -\\d\+ STORE_ATTR c -\\d\+ LOAD_DEREF 14 -\\d\+ LOAD_CONST_SMALL_INT 0 -\\d\+ LOAD_SUBSCR -\\d\+ STORE_FAST 12 -\\d\+ LOAD_FAST 12 -\\d\+ LOAD_DEREF 14 -\\d\+ LOAD_CONST_SMALL_INT 0 -\\d\+ STORE_SUBSCR -\\d\+ LOAD_DEREF 14 -\\d\+ LOAD_CONST_SMALL_INT 0 -\\d\+ DUP_TOP_TWO -\\d\+ LOAD_SUBSCR -\\d\+ LOAD_FAST 12 -\\d\+ BINARY_OP 14 __iadd__ -\\d\+ ROT_THREE -\\d\+ STORE_SUBSCR -\\d\+ LOAD_DEREF 14 -\\d\+ LOAD_CONST_NONE -\\d\+ LOAD_CONST_NONE -\\d\+ BUILD_SLICE 2 -\\d\+ LOAD_SUBSCR -\\d\+ STORE_FAST 0 -\\d\+ LOAD_FAST 1 -\\d\+ UNPACK_SEQUENCE 2 -\\d\+ STORE_FAST 0 -\\d\+ STORE_DEREF 14 -\\d\+ LOAD_FAST 0 -\\d\+ UNPACK_EX 1 -\\d\+ STORE_FAST 0 -\\d\+ STORE_FAST 0 -\\d\+ LOAD_DEREF 14 -\\d\+ LOAD_FAST 0 -\\d\+ ROT_TWO -\\d\+ STORE_FAST 0 -\\d\+ STORE_DEREF 14 -\\d\+ LOAD_FAST 1 -\\d\+ LOAD_DEREF 14 -\\d\+ LOAD_FAST 0 -\\d\+ ROT_THREE -\\d\+ ROT_TWO -\\d\+ STORE_FAST 0 -\\d\+ STORE_DEREF 14 -\\d\+ STORE_FAST 1 -\\d\+ DELETE_FAST 0 -\\d\+ LOAD_FAST 0 -\\d\+ STORE_GLOBAL gl -\\d\+ DELETE_GLOBAL gl -\\d\+ LOAD_FAST 14 -\\d\+ LOAD_FAST 15 -\\d\+ MAKE_CLOSURE \.\+ 2 -\\d\+ LOAD_FAST 2 -\\d\+ GET_ITER -\\d\+ CALL_FUNCTION n=1 nkw=0 -\\d\+ STORE_FAST 0 -\\d\+ LOAD_FAST 14 -\\d\+ LOAD_FAST 15 -\\d\+ MAKE_CLOSURE \.\+ 2 -\\d\+ LOAD_FAST 2 -\\d\+ CALL_FUNCTION n=1 nkw=0 -\\d\+ STORE_FAST 0 -\\d\+ LOAD_FAST 14 -\\d\+ LOAD_FAST 15 -\\d\+ MAKE_CLOSURE \.\+ 2 -\\d\+ LOAD_FAST 2 -\\d\+ CALL_FUNCTION n=1 nkw=0 -\\d\+ STORE_FAST 0 -\\d\+ LOAD_FAST 0 -\\d\+ CALL_FUNCTION n=0 nkw=0 -\\d\+ POP_TOP -\\d\+ LOAD_FAST 0 -\\d\+ LOAD_CONST_SMALL_INT 1 -\\d\+ CALL_FUNCTION n=1 nkw=0 -\\d\+ POP_TOP -\\d\+ LOAD_FAST 0 -\\d\+ LOAD_CONST_STRING 'b' -\\d\+ LOAD_CONST_SMALL_INT 1 -\\d\+ CALL_FUNCTION n=0 nkw=1 -\\d\+ POP_TOP -\\d\+ LOAD_FAST 0 -\\d\+ LOAD_DEREF 14 -\\d\+ LOAD_NULL -\\d\+ CALL_FUNCTION_VAR_KW n=0 nkw=0 -\\d\+ POP_TOP -\\d\+ LOAD_FAST 0 -\\d\+ LOAD_METHOD b -\\d\+ CALL_METHOD n=0 nkw=0 -\\d\+ POP_TOP -\\d\+ LOAD_FAST 0 -\\d\+ LOAD_METHOD b -\\d\+ LOAD_CONST_SMALL_INT 1 -\\d\+ CALL_METHOD n=1 nkw=0 -\\d\+ POP_TOP -\\d\+ LOAD_FAST 0 -\\d\+ LOAD_METHOD b -\\d\+ LOAD_CONST_STRING 'c' -\\d\+ LOAD_CONST_SMALL_INT 1 -\\d\+ CALL_METHOD n=0 nkw=1 -\\d\+ POP_TOP -\\d\+ LOAD_FAST 0 -\\d\+ LOAD_METHOD b -\\d\+ LOAD_FAST 1 -\\d\+ LOAD_NULL -\\d\+ CALL_METHOD_VAR_KW n=0 nkw=0 -\\d\+ POP_TOP -\\d\+ LOAD_FAST 0 -\\d\+ POP_JUMP_IF_FALSE \\d\+ -\\d\+ LOAD_DEREF 16 -\\d\+ POP_TOP -\\d\+ JUMP \\d\+ -\\d\+ LOAD_GLOBAL y -\\d\+ POP_TOP -\\d\+ JUMP \\d\+ -\\d\+ LOAD_DEREF 14 -\\d\+ POP_TOP -\\d\+ LOAD_FAST 0 -\\d\+ POP_JUMP_IF_TRUE \\d\+ -\\d\+ JUMP \\d\+ -\\d\+ LOAD_DEREF 14 -\\d\+ POP_TOP -\\d\+ LOAD_FAST 0 -\\d\+ POP_JUMP_IF_FALSE \\d\+ -\\d\+ LOAD_FAST 0 -\\d\+ JUMP_IF_TRUE_OR_POP \\d\+ -\\d\+ LOAD_FAST 0 -\\d\+ STORE_FAST 0 -\\d\+ LOAD_DEREF 14 -\\d\+ GET_ITER_STACK -\\d\+ FOR_ITER \\d\+ -\\d\+ STORE_FAST 0 -\\d\+ LOAD_FAST 1 -\\d\+ POP_TOP -\\d\+ JUMP \\d\+ -\\d\+ SETUP_FINALLY \\d\+ -\\d\+ SETUP_EXCEPT \\d\+ -\\d\+ JUMP \\d\+ -\\d\+ JUMP \\d\+ -\\d\+ LOAD_FAST 0 -\\d\+ POP_JUMP_IF_TRUE \\d\+ -\\d\+ POP_EXCEPT_JUMP \\d\+ -\\d\+ POP_TOP -\\d\+ LOAD_DEREF 14 -\\d\+ POP_TOP -\\d\+ POP_EXCEPT_JUMP \\d\+ -\\d\+ END_FINALLY -\\d\+ LOAD_CONST_NONE -\\d\+ LOAD_FAST 1 -\\d\+ POP_TOP -\\d\+ END_FINALLY -\\d\+ JUMP \\d\+ -\\d\+ SETUP_EXCEPT \\d\+ -\\d\+ UNWIND_JUMP \\d\+ 1 -\\d\+ POP_EXCEPT_JUMP \\d\+ -\\d\+ POP_TOP -\\d\+ POP_EXCEPT_JUMP \\d\+ -\\d\+ END_FINALLY -\\d\+ LOAD_FAST 0 -\\d\+ POP_JUMP_IF_TRUE \\d\+ -\\d\+ LOAD_FAST 0 -\\d\+ SETUP_WITH \\d\+ -\\d\+ POP_TOP -\\d\+ LOAD_DEREF 14 -\\d\+ POP_TOP -\\d\+ LOAD_CONST_NONE -\\d\+ WITH_CLEANUP -\\d\+ END_FINALLY -\\d\+ LOAD_CONST_SMALL_INT 1 -\\d\+ STORE_DEREF 16 -\\d\+ LOAD_FAST_N 16 -\\d\+ MAKE_CLOSURE \.\+ 1 -\\d\+ STORE_FAST 13 -\\d\+ LOAD_CONST_SMALL_INT 0 -\\d\+ LOAD_CONST_NONE -\\d\+ IMPORT_NAME 'a' -\\d\+ STORE_FAST 0 -\\d\+ LOAD_CONST_SMALL_INT 0 -\\d\+ LOAD_CONST_STRING 'b' -\\d\+ BUILD_TUPLE 1 -\\d\+ IMPORT_NAME 'a' -\\d\+ IMPORT_FROM 'b' -\\d\+ STORE_DEREF 14 -\\d\+ POP_TOP -\\d\+ RAISE_LAST -\\d\+ LOAD_CONST_SMALL_INT 1 -\\d\+ RAISE_OBJ -\\d\+ LOAD_CONST_NONE -\\d\+ RETURN_VALUE -\\d\+ LOAD_CONST_SMALL_INT 1 -\\d\+ RETURN_VALUE -File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): -######## -\.\+rg names: +46 STORE_FAST 4 +47 LOAD_CONST_OBJ \.\+=b'a' +49 STORE_FAST 5 +50 LOAD_CONST_SMALL_INT 1 +51 STORE_FAST 6 +52 LOAD_CONST_SMALL_INT 2 +53 STORE_FAST 7 +54 LOAD_FAST 0 +55 LOAD_DEREF 14 +57 BINARY_OP 27 __add__ +58 STORE_FAST 8 +59 LOAD_FAST 0 +60 UNARY_OP 1 __neg__ +61 STORE_FAST 9 +62 LOAD_FAST 0 +63 UNARY_OP 3 +64 STORE_FAST 10 +65 LOAD_FAST 0 +66 LOAD_DEREF 14 +68 DUP_TOP +69 ROT_THREE +70 BINARY_OP 2 __eq__ +71 JUMP_IF_FALSE_OR_POP 79 +74 LOAD_FAST 1 +75 BINARY_OP 2 __eq__ +76 JUMP 81 +79 ROT_TWO +80 POP_TOP +81 STORE_FAST 10 +82 LOAD_FAST 0 +83 LOAD_DEREF 14 +85 BINARY_OP 2 __eq__ +86 JUMP_IF_FALSE_OR_POP 93 +89 LOAD_DEREF 14 +91 LOAD_FAST 1 +92 BINARY_OP 2 __eq__ +93 UNARY_OP 3 +94 STORE_FAST 10 +95 LOAD_DEREF 14 +97 LOAD_ATTR c +99 STORE_FAST 11 +100 LOAD_FAST 11 +101 LOAD_DEREF 14 +103 STORE_ATTR c +105 LOAD_DEREF 14 +107 LOAD_CONST_SMALL_INT 0 +108 LOAD_SUBSCR +109 STORE_FAST 12 +110 LOAD_FAST 12 +111 LOAD_DEREF 14 +113 LOAD_CONST_SMALL_INT 0 +114 STORE_SUBSCR +115 LOAD_DEREF 14 +117 LOAD_CONST_SMALL_INT 0 +118 DUP_TOP_TWO +119 LOAD_SUBSCR +120 LOAD_FAST 12 +121 BINARY_OP 14 __iadd__ +122 ROT_THREE +123 STORE_SUBSCR +124 LOAD_DEREF 14 +126 LOAD_CONST_NONE +127 LOAD_CONST_NONE +128 BUILD_SLICE 2 +130 LOAD_SUBSCR +131 STORE_FAST 0 +132 LOAD_FAST 1 +133 UNPACK_SEQUENCE 2 +135 STORE_FAST 0 +136 STORE_DEREF 14 +138 LOAD_FAST 0 +139 UNPACK_EX 1 +141 STORE_FAST 0 +142 STORE_FAST 0 +143 LOAD_DEREF 14 +145 LOAD_FAST 0 +146 ROT_TWO +147 STORE_FAST 0 +148 STORE_DEREF 14 +150 LOAD_FAST 1 +151 LOAD_DEREF 14 +153 LOAD_FAST 0 +154 ROT_THREE +155 ROT_TWO +156 STORE_FAST 0 +157 STORE_DEREF 14 +159 STORE_FAST 1 +160 DELETE_FAST 0 +162 LOAD_FAST 0 +163 STORE_GLOBAL gl +165 DELETE_GLOBAL gl +167 LOAD_FAST 14 +168 LOAD_FAST 15 +169 MAKE_CLOSURE \.\+ 2 +172 LOAD_FAST 2 +173 GET_ITER +174 CALL_FUNCTION n=1 nkw=0 +176 STORE_FAST 0 +177 LOAD_FAST 14 +178 LOAD_FAST 15 +179 MAKE_CLOSURE \.\+ 2 +182 LOAD_FAST 2 +183 CALL_FUNCTION n=1 nkw=0 +185 STORE_FAST 0 +186 LOAD_FAST 14 +187 LOAD_FAST 15 +188 MAKE_CLOSURE \.\+ 2 +191 LOAD_FAST 2 +192 CALL_FUNCTION n=1 nkw=0 +194 STORE_FAST 0 +195 LOAD_FAST 0 +196 CALL_FUNCTION n=0 nkw=0 +198 POP_TOP +199 LOAD_FAST 0 +200 LOAD_CONST_SMALL_INT 1 +201 CALL_FUNCTION n=1 nkw=0 +203 POP_TOP +204 LOAD_FAST 0 +205 LOAD_CONST_STRING 'b' +207 LOAD_CONST_SMALL_INT 1 +208 CALL_FUNCTION n=0 nkw=1 +211 POP_TOP +212 LOAD_FAST 0 +213 LOAD_DEREF 14 +215 LOAD_NULL +216 CALL_FUNCTION_VAR_KW n=0 nkw=0 +218 POP_TOP +219 LOAD_FAST 0 +220 LOAD_METHOD b +222 CALL_METHOD n=0 nkw=0 +224 POP_TOP +225 LOAD_FAST 0 +226 LOAD_METHOD b +228 LOAD_CONST_SMALL_INT 1 +229 CALL_METHOD n=1 nkw=0 +231 POP_TOP +232 LOAD_FAST 0 +233 LOAD_METHOD b +235 LOAD_CONST_STRING 'c' +237 LOAD_CONST_SMALL_INT 1 +238 CALL_METHOD n=0 nkw=1 +241 POP_TOP +242 LOAD_FAST 0 +243 LOAD_METHOD b +245 LOAD_FAST 1 +246 LOAD_NULL +247 CALL_METHOD_VAR_KW n=0 nkw=0 +249 POP_TOP +250 LOAD_FAST 0 +251 POP_JUMP_IF_FALSE 260 +254 LOAD_DEREF 16 +256 POP_TOP +257 JUMP 263 +260 LOAD_GLOBAL y +262 POP_TOP +263 JUMP 269 +266 LOAD_DEREF 14 +268 POP_TOP +269 LOAD_FAST 0 +270 POP_JUMP_IF_TRUE 266 +273 JUMP 279 +276 LOAD_DEREF 14 +278 POP_TOP +279 LOAD_FAST 0 +280 POP_JUMP_IF_FALSE 276 +283 LOAD_FAST 0 +284 JUMP_IF_TRUE_OR_POP 288 +287 LOAD_FAST 0 +288 STORE_FAST 0 +289 LOAD_DEREF 14 +291 GET_ITER_STACK +292 FOR_ITER 301 +295 STORE_FAST 0 +296 LOAD_FAST 1 +297 POP_TOP +298 JUMP 292 +301 SETUP_FINALLY 329 +304 SETUP_EXCEPT 320 +307 JUMP 313 +310 JUMP 317 +313 LOAD_FAST 0 +314 POP_JUMP_IF_TRUE 310 +317 POP_EXCEPT_JUMP 328 +320 POP_TOP +321 LOAD_DEREF 14 +323 POP_TOP +324 POP_EXCEPT_JUMP 328 +327 END_FINALLY +328 LOAD_CONST_NONE +329 LOAD_FAST 1 +330 POP_TOP +331 END_FINALLY +332 JUMP 350 +335 SETUP_EXCEPT 345 +338 UNWIND_JUMP 354 1 +342 POP_EXCEPT_JUMP 350 +345 POP_TOP +346 POP_EXCEPT_JUMP 350 +349 END_FINALLY +350 LOAD_FAST 0 +351 POP_JUMP_IF_TRUE 335 +354 LOAD_FAST 0 +355 SETUP_WITH 363 +358 POP_TOP +359 LOAD_DEREF 14 +361 POP_TOP +362 LOAD_CONST_NONE +363 WITH_CLEANUP +364 END_FINALLY +365 LOAD_CONST_SMALL_INT 1 +366 STORE_DEREF 16 +368 LOAD_FAST_N 16 +370 MAKE_CLOSURE \.\+ 1 +373 STORE_FAST 13 +374 LOAD_CONST_SMALL_INT 0 +375 LOAD_CONST_NONE +376 IMPORT_NAME 'a' +378 STORE_FAST 0 +379 LOAD_CONST_SMALL_INT 0 +380 LOAD_CONST_STRING 'b' +382 BUILD_TUPLE 1 +384 IMPORT_NAME 'a' +386 IMPORT_FROM 'b' +388 STORE_DEREF 14 +390 POP_TOP +391 RAISE_LAST +392 LOAD_CONST_SMALL_INT 1 +393 RAISE_OBJ +394 LOAD_CONST_NONE +395 RETURN_VALUE +396 LOAD_CONST_SMALL_INT 1 +397 RETURN_VALUE +File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ 59 bytes) +Raw bytecode (code_info_size=8, bytecode_size=51): + a8 10 0a 02 80 82 34 38 81 57 c0 57 c1 57 c2 57 + c3 57 c4 57 c5 57 c6 57 c7 57 c8 c9 82 57 ca 57 + cb 57 cc 57 cd 57 ce 57 cf 57 26 10 57 26 11 57 + 26 12 26 13 b9 24 13 f2 59 51 63 +arg names: (N_STATE 22) (N_EXC_STACK 0) bc=0 line=1 -######## - bc=\\d\+ line=133 + bc=0 line=131 + bc=20 line=132 + bc=44 line=133 00 LOAD_CONST_SMALL_INT 1 01 DUP_TOP 02 STORE_FAST 0 @@ -367,28 +464,29 @@ Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): 48 POP_TOP 49 LOAD_CONST_NONE 50 RETURN_VALUE -File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): -######## -\.\+63 +File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ 20 bytes) +Raw bytecode (code_info_size=9, bytecode_size=11): + a1 01 0b 02 06 80 88 40 00 82 2a 01 53 b0 21 00 + 01 c1 51 63 arg names: a (N_STATE 5) (N_EXC_STACK 0) (INIT_CELL 0) -######## - bc=\\d\+ line=139 + bc=0 line=1 + bc=0 line=137 + bc=0 line=139 00 LOAD_CONST_SMALL_INT 2 01 BUILD_TUPLE 1 03 LOAD_NULL 04 LOAD_FAST 0 05 MAKE_CLOSURE_DEFARGS \.\+ 1 -\\d\+ STORE_FAST 1 -\\d\+ LOAD_CONST_NONE -\\d\+ RETURN_VALUE -File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): -######## -\.\+63 +08 STORE_FAST 1 +09 LOAD_CONST_NONE +10 RETURN_VALUE +File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ 21 bytes) +Raw bytecode (code_info_size=8, bytecode_size=13): + 88 40 0a 02 80 8f 23 23 51 67 59 81 67 59 81 5e + 51 68 59 51 63 arg names: (N_STATE 2) (N_EXC_STACK 0) @@ -409,49 +507,47 @@ arg names: 10 POP_TOP 11 LOAD_CONST_NONE 12 RETURN_VALUE -File cmdline/cmd_showbc.py, code block 'Class' (descriptor: \.\+, bytecode @\.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): -######## -\.\+63 +File cmdline/cmd_showbc.py, code block 'Class' (descriptor: \.\+, bytecode @\.\+ 1\[56\] bytes) +Raw bytecode (code_info_size=\[56\], bytecode_size=10): + 00 \.\+ 11 0c 16 0d 10 03 16 0e 51 63 arg names: (N_STATE 1) (N_EXC_STACK 0) bc=0 line=1 ######## - bc=12 line=150 + bc=8 line=150 00 LOAD_NAME __name__ -03 STORE_NAME __module__ -06 LOAD_CONST_STRING 'Class' -09 STORE_NAME __qualname__ -12 LOAD_CONST_NONE -13 RETURN_VALUE -File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): -######## -\.\+63 +02 STORE_NAME __module__ +04 LOAD_CONST_STRING 'Class' +06 STORE_NAME __qualname__ +08 LOAD_CONST_NONE +09 RETURN_VALUE +File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ 18 bytes) +Raw bytecode (code_info_size=6, bytecode_size=12): + 19 08 02 0f 80 9c 12 10 12 11 b0 15 02 36 00 59 + 51 63 arg names: self (N_STATE 4) (N_EXC_STACK 0) bc=0 line=1 bc=0 line=157 00 LOAD_GLOBAL super -\\d\+ LOAD_GLOBAL __class__ -\\d\+ LOAD_FAST 0 -\\d\+ LOAD_SUPER_METHOD f -\\d\+ CALL_METHOD n=0 nkw=0 -\\d\+ POP_TOP -\\d\+ LOAD_CONST_NONE -\\d\+ RETURN_VALUE -File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): -######## -\.\+63 +02 LOAD_GLOBAL __class__ +04 LOAD_FAST 0 +05 LOAD_SUPER_METHOD f +07 CALL_METHOD n=0 nkw=0 +09 POP_TOP +10 LOAD_CONST_NONE +11 RETURN_VALUE +File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ 31 bytes) +Raw bytecode (code_info_size=9, bytecode_size=22): + c3 40 0c 12 04 04 04 80 3b 53 b2 53 53 4b 0d 00 + c3 25 01 44 f7 7f 25 00 67 59 42 f0 7f 51 63 arg names: * * * (N_STATE 9) (N_EXC_STACK 0) bc=0 line=1 bc=0 line=60 -######## 00 LOAD_NULL 01 LOAD_FAST 2 02 LOAD_NULL @@ -466,16 +562,15 @@ arg names: * * * 17 JUMP 4 20 LOAD_CONST_NONE 21 RETURN_VALUE -File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): -######## -\.\+63 +File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ 29 bytes) +Raw bytecode (code_info_size=8, bytecode_size=21): + 4b 0c 14 04 04 04 80 3c 2b 00 b2 5f 4b 0d 00 c3 + 25 01 44 f7 7f 25 00 2f 14 42 f0 7f 63 arg names: * * * (N_STATE 10) (N_EXC_STACK 0) bc=0 line=1 bc=0 line=61 -######## 00 BUILD_LIST 0 02 LOAD_FAST 2 03 GET_ITER_STACK @@ -487,15 +582,15 @@ arg names: * * * 15 STORE_COMP 20 17 JUMP 4 20 RETURN_VALUE -File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): -######## -\.\+63 +File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ 31 bytes) +Raw bytecode (code_info_size=8, bytecode_size=23): + 53 0c 15 04 04 04 80 3d 2c 00 b2 5f 4b 0f 00 c3 + 25 01 44 f7 7f 25 00 25 00 2f 19 42 ee 7f 63 arg names: * * * (N_STATE 11) (N_EXC_STACK 0) bc=0 line=1 -######## + bc=0 line=62 00 BUILD_MAP 0 02 LOAD_FAST 2 03 GET_ITER_STACK @@ -508,16 +603,17 @@ arg names: * * * 17 STORE_COMP 25 19 JUMP 4 22 RETURN_VALUE -File cmdline/cmd_showbc.py, code block 'closure' (descriptor: \.\+, bytecode @\.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): -######## -\.\+63 +File cmdline/cmd_showbc.py, code block 'closure' (descriptor: \.\+, bytecode @\.\+ 20 bytes) +Raw bytecode (code_info_size=8, bytecode_size=12): + 19 0c 16 04 80 6f 25 23 25 00 81 f2 c1 81 27 00 + 29 00 51 63 arg names: * (N_STATE 4) (N_EXC_STACK 0) bc=0 line=1 -######## - bc=\\d\+ line=114 + bc=0 line=112 + bc=5 line=113 + bc=8 line=114 00 LOAD_DEREF 0 02 LOAD_CONST_SMALL_INT 1 03 BINARY_OP 27 __add__ @@ -527,16 +623,14 @@ arg names: * 08 DELETE_DEREF 0 10 LOAD_CONST_NONE 11 RETURN_VALUE -File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): -######## -\.\+63 +File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ 13 bytes) +Raw bytecode (code_info_size=8, bytecode_size=5): + 9a 01 0a 02 04 09 80 8b b1 25 00 f2 63 arg names: * b (N_STATE 4) (N_EXC_STACK 0) bc=0 line=1 -######## - bc=\\d\+ line=140 + bc=0 line=140 00 LOAD_FAST 1 01 LOAD_DEREF 0 03 BINARY_OP 27 __add__ diff --git a/tests/cmdline/cmd_verbose.py.exp b/tests/cmdline/cmd_verbose.py.exp index 0edd050c22..ae833dbec8 100644 --- a/tests/cmdline/cmd_verbose.py.exp +++ b/tests/cmdline/cmd_verbose.py.exp @@ -1,19 +1,17 @@ -File cmdline/cmd_verbose.py, code block '' (descriptor: \.\+, bytecode \.\+ bytes) -Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): - 08 \.\+ -######## -\.\+63 +File cmdline/cmd_verbose.py, code block '' (descriptor: \.\+, bytecode @\.\+ 12 bytes) +Raw bytecode (code_info_size=4, bytecode_size=8): + 08 04 01 40 11 02 81 34 01 59 51 63 arg names: (N_STATE 2) (N_EXC_STACK 0) bc=0 line=1 bc=0 line=3 00 LOAD_NAME print -03 LOAD_CONST_SMALL_INT 1 -04 CALL_FUNCTION n=1 nkw=0 -06 POP_TOP -07 LOAD_CONST_NONE -08 RETURN_VALUE +02 LOAD_CONST_SMALL_INT 1 +03 CALL_FUNCTION n=1 nkw=0 +05 POP_TOP +06 LOAD_CONST_NONE +07 RETURN_VALUE 1 mem: total=\\d\+, current=\\d\+, peak=\\d\+ stack: \\d\+ out of \\d\+ diff --git a/tests/micropython/import_mpy_invalid.py b/tests/micropython/import_mpy_invalid.py index 02fd4b1254..b02312a7a8 100644 --- a/tests/micropython/import_mpy_invalid.py +++ b/tests/micropython/import_mpy_invalid.py @@ -49,7 +49,6 @@ user_files = { "/mod0.mpy": b"", # empty file "/mod1.mpy": b"M", # too short header "/mod2.mpy": b"M\x00\x00\x00", # bad version - "/mod3.mpy": b"M\x00\x00\x00\x7f", # qstr window too large } # create and mount a user filesystem diff --git a/tests/micropython/import_mpy_invalid.py.exp b/tests/micropython/import_mpy_invalid.py.exp index ea748ff6c1..1727ea1cea 100644 --- a/tests/micropython/import_mpy_invalid.py.exp +++ b/tests/micropython/import_mpy_invalid.py.exp @@ -1,4 +1,3 @@ mod0 ValueError incompatible .mpy file mod1 ValueError incompatible .mpy file mod2 ValueError incompatible .mpy file -mod3 ValueError incompatible .mpy file diff --git a/tests/micropython/import_mpy_native_gc.py b/tests/micropython/import_mpy_native_gc.py index f982a4ee17..6f37b15ab7 100644 --- a/tests/micropython/import_mpy_native_gc.py +++ b/tests/micropython/import_mpy_native_gc.py @@ -49,14 +49,14 @@ class UserFS: # by the required value of sys.implementation.mpy. features0_file_contents = { # -march=x64 - 0xA05: b'M\x05\x0a\x1f \x84b\xe9/\x00\x00\x00SH\x8b\x1ds\x00\x00\x00\xbe\x02\x00\x00\x00\xffS\x18\xbf\x01\x00\x00\x00H\x85\xc0u\x0cH\x8bC \xbe\x02\x00\x00\x00[\xff\xe0H\x0f\xaf\xf8H\xff\xc8\xeb\xe6ATUSH\x8b\x1dA\x00\x00\x00H\x8b\x7f\x08L\x8bc(A\xff\xd4H\x8d5\x1f\x00\x00\x00H\x89\xc5H\x8b\x05-\x00\x00\x00\x0f\xb78\xffShH\x89\xefA\xff\xd4H\x8b\x03[]A\\\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x90\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x84@\x12factorial\x10\x00\x00\r \x01"\x9f\x1c\x01\x1e\xff', + 0xA06: b'M\x06\n\x1f\x01\x004build/features0.native.mpy\x00\x8aB\xe9/\x00\x00\x00SH\x8b\x1d\x83\x00\x00\x00\xbe\x02\x00\x00\x00\xffS\x18\xbf\x01\x00\x00\x00H\x85\xc0u\x0cH\x8bC \xbe\x02\x00\x00\x00[\xff\xe0H\x0f\xaf\xf8H\xff\xc8\xeb\xe6ATUSH\x8b\x1dQ\x00\x00\x00H\x8bG\x08L\x8bc(H\x8bx\x08A\xff\xd4H\x8d5+\x00\x00\x00H\x89\xc5H\x8b\x059\x00\x00\x00\x0f\xb78\xffShH\x89\xefA\xff\xd4H\x8b\x03[]A\\\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xa0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x85\x00\x12factorial\x00\x10\r$\x01&\x9f \x01"\xff', # -march=armv7m - 0x1605: b"M\x05\x16\x1f \x84\x12\x1a\xe0\x00\x00\x13\xb5\nK\nJ{D\x9cX\x02!\xe3h\x98G\x03F\x01 3\xb9\x02!#i\x01\x93\x02\xb0\xbd\xe8\x10@\x18GXC\x01;\xf4\xe7\x00\xbfj\x00\x00\x00\x00\x00\x00\x00\xf8\xb5\tN\tK~D\xf4X@hgi\xb8G\x05F\x07K\x07I\xf2XyD\x10\x88ck\x98G(F\xb8G h\xf8\xbd6\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x1c\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x01\x84\x00\x12factorial\x10\x00\x00\r<\x01>\x9f8\x01:\xff", + 0x1606: b"M\x06\x16\x1f\x01\x004build/features0.native.mpy\x00\x88B\x1a\xe0\x00\x00\x13\xb5\nK\nJ{D\x9cX\x02!\xe3h\x98G\x03F\x01 3\xb9\x02!#i\x01\x93\x02\xb0\xbd\xe8\x10@\x18GXC\x01;\xf4\xe7\x00\xbfn\x00\x00\x00\x00\x00\x00\x00\xf8\xb5\nN\nK~D\xf4XChgiXh\xb8G\x05F\x07K\x08I\xf2XyD\x10\x88ck\x98G(F\xb8G h\xf8\xbd\x00\xbf:\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x1e\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x84\x00\x00\x00\x00\x00\x00\x00\x01\x84\x10\x12factorial\x00\x10\r>\x01@\x9f:\x01<\xff", } # Populate other armv7m-derived archs based on armv7m. -for arch in (0x1A05, 0x1E05, 0x2205): - features0_file_contents[arch] = features0_file_contents[0x1605] +for arch in (0x1A06, 0x1E06, 0x2206): + features0_file_contents[arch] = features0_file_contents[0x1606] if sys.implementation.mpy not in features0_file_contents: print("SKIP") diff --git a/tests/micropython/import_mpy_native_x64.py b/tests/micropython/import_mpy_native_x64.py index ff0142a9cf..3a25df1866 100644 --- a/tests/micropython/import_mpy_native_x64.py +++ b/tests/micropython/import_mpy_native_x64.py @@ -52,49 +52,62 @@ class UserFS: # fmt: off user_files = { # bad architecture - '/mod0.mpy': b'M\x05\xfe\x00\x10', + '/mod0.mpy': b'M\x06\xfe\x00\x10', # test loading of viper and asm '/mod1.mpy': ( - b'M\x05\x0a\x1f\x20' # header + b'M\x06\x0a\x1f' # header - b'\x20' # n bytes, bytecode - b'\x00\x08\x02m\x02m' # prelude + b'\x02' # n_qstr + b'\x00' # n_obj + + b'\x0emod1.py\x00' # qstr0 = "mod1.py" + b'\x0aouter\x00' # qstr1 = "outer" + + b'\x2c' # 5 bytes, have children, bytecode + b'\x00\x02' # prelude + b'\x01' # simple name (qstr index) b'\x51' # LOAD_CONST_NONE b'\x63' # RETURN_VALUE - b'\x00\x02' # n_obj, n_raw_code + b'\x02' # 2 children - b'\x22' # n bytes, viper code - b'\x00\x00\x00\x00\x00\x00' # dummy machine code - b'\x00\x00' # qstr0 - b'\x01\x0c\x0aprint' # n_qstr, qstr0 - b'\x00\x00\x00' # scope_flags, n_obj, n_raw_code + b'\x42' # 8 bytes, no children, viper code + b'\x00\x00\x00\x00\x00\x00' # dummy machine code + b'\x00\x00' # slot for qstr0 + b'\x01\x0c\x0aprint\x00' # n_qstr=1, qstr0 + b'\x00' # scope_flags - b'\x23' # n bytes, asm code - b'\x00\x00\x00\x00\x00\x00\x00\x00' # dummy machine code - b'\x00\x00\x00' # scope_flags, n_pos_args, type_sig + b'\x43' # 8 bytes, no children, asm code + b'\x00\x00\x00\x00\x00\x00\x00\x00' # dummy machine code + b'\x00\x00\x00' # scope_flags, n_pos_args, type_sig ), # test loading viper with additional scope flags and relocation '/mod2.mpy': ( - b'M\x05\x0a\x1f\x20' # header + b'M\x06\x0a\x1f' # header - b'\x20' # n bytes, bytecode - b'\x00\x08\x02m\x02m' # prelude + b'\x02' # n_qstr + b'\x00' # n_obj + + b'\x0emod2.py\x00' # qstr0 = "mod2.py" + b'\x0aouter\x00' # qstr1 = "outer" + + b'\x2c' # 5 bytes, have children, bytecode + b'\x00\x02' # prelude + b'\x01' # simple name (qstr index) b'\x51' # LOAD_CONST_NONE b'\x63' # RETURN_VALUE - b'\x00\x01' # n_obj, n_raw_code + b'\x01' # 1 child - b'\x12' # n bytes(=4), viper code - b'\x00\x00\x00\x00' # dummy machine code - b'\x00' # n_qstr - b'\x70' # scope_flags: VIPERBSS | VIPERRODATA | VIPERRELOC - b'\x00\x00' # n_obj, n_raw_code - b'\x06rodata' # rodata, 6 bytes - b'\x04' # bss, 4 bytes - b'\x03\x01\x00' # dummy relocation of rodata + b'\x22' # 4 bytes, no children, viper code + b'\x00\x00\x00\x00' # dummy machine code + b'\x00' # n_qstr=0 + b'\x70' # scope_flags: VIPERBSS | VIPERRODATA | VIPERRELOC + b'\x06\x04' # rodata=6 bytes, bss=4 bytes + b'rodata' # rodata content + b'\x03\x01\x00' # dummy relocation of rodata ), } # fmt: on diff --git a/tests/perf_bench/core_import_mpy_multi.py b/tests/perf_bench/core_import_mpy_multi.py index 0da466206b..74caf20a38 100644 --- a/tests/perf_bench/core_import_mpy_multi.py +++ b/tests/perf_bench/core_import_mpy_multi.py @@ -23,7 +23,7 @@ def f(): x = ("const tuple", None, False, True, 1, 2, 3) result = 123 """ -file_data = b'M\x05\x02\x1f \x81\x0c\x10\x12\x00\x07\x0etest.py\x8b\x07e`\x00T2\x00\x10\x02A4\x02\x16\x012\x01\x16\x02f"\x80{\x16\x0cresultQc\x00\x02\x81\x1c\x00\x10\x05\x07,EE\x00\x11\x00\x17\x16\x00\x16\x10\x03\x16\x00\x1a2\x00\x16\x00\x112\x01\x16\x00\xa42\x02\x16\x00}Qc\x00\x03<\x1a\x0c\x00\x11\x03@\x00\xb1\xb0\x18\x06argQc\x00\x00\x00\x89\x01,\t\x0e\x00\xa4\x03` \x00Qc\x00\x00\x00\x89,\t\x0e\x00}\x01``\x00Qc\x00\x00\x00\x89\x81l8\x16\t\x03\x80\x08/,##\x00\x12\x00{\x12\x00\x97\x12\x00B\x12\x00K*\x04Y\x12\x00$\x12\x007\x12\x006*\x03Y#\x00\xc0#\x01\xc0#\x02QPR\x81\x82\x83*\x07\xc0Qc\x03\x00s\x1cthis will be a string objectb\x1bthis will be a bytes objects\x0bconst tuple' +file_data = b'M\x06\x02\x1f\x14\x03\x0etest.py\x00\x0f\x02A\x00\x02f\x00\x0cresult\x00/-5#\x82I\x81{\x81w\x82/\x81\x05\x81\x17Iom\x82\x13\x06arg\x00s\x1cthis will be a string object\x00b\x1bthis will be a bytes object\x00s\x0bconst tuple\x00\x81\\\x10\n\x01\x89\x07d`T2\x00\x10\x024\x02\x16\x022\x01\x16\x03"\x80{\x16\x04Qc\x02\x81d\x00\x08\x02(DD\x11\x05\x16\x06\x10\x02\x16\x072\x00\x16\x082\x01\x16\t2\x02\x16\nQc\x03`\x1a\x08\x08\x12\x13@\xb1\xb0\x18\x13Qc@\t\x08\t\x12` Qc@\t\x08\n\x12``Qc\x83\x008\x0e\x03\x80\x08+)##\x12\x0b\x12\x0c\x12\r\x12\x0e*\x04Y\x12\x0f\x12\x10\x12\x11*\x03Y#\x00\xc0#\x01\xc0#\x02QPR\x81\x82\x83*\x07\xc0Qc' class File(uio.IOBase): diff --git a/tests/perf_bench/core_import_mpy_single.py b/tests/perf_bench/core_import_mpy_single.py index 5ca3584959..1e8a4f531e 100644 --- a/tests/perf_bench/core_import_mpy_single.py +++ b/tests/perf_bench/core_import_mpy_single.py @@ -78,7 +78,7 @@ def f1(): x = ("const tuple 9", None, False, True, 1, 2, 3) result = 123 """ -file_data = b'M\x05\x02\x1f \x81\\\x10\x1a\x00\x07\x0etest.pyk@k@\x85\x18\x85\x1f\x00T2\x00\x10\x04A04\x02\x16\x01T2\x01\x10\x04A14\x02\x16\x012\x02\x16\x04f02\x03\x16\x04f1"\x80{\x16\x0cresultQc\x00\x04\x814\x00\x12\t\x0b,%%%\x00\x11\x00\x17\x16\x00\x16\x10\x03\x16\x00\x1a2\x00\x16\x04a02\x01\x16\x04a12\x02\x16\x04a22\x03\x16\x04a3Qc\x00\x04(\t\x0c\x07\x0b \x00Qc\x00\x00\x00\x89(\t\x0c\t\x03@\x00Qc\x00\x00\x00\x89(\t\x0c\t\x03`\x00Qc\x00\x00\x00\x89,\t\x0e\t\x03` \x00Qc\x00\x00\x00\x89\x818\x00\x14\x13\x03l`%%%\x00\x11\x00\x17\x16\x00\x16\x10\x03\x16\x00\x1a2\x00\x16\x0b2\x01\x16\x0b2\x02\x16\x0b2\x03\x16\x0bQc\x00\x04,\t\x0e\x07\x0b``\x00Qc\x00\x00\x00\x89,\t\x0e\t\x03\x80\x07\x00Qc\x00\x00\x00\x89,\t\x0e\t\x03\x80\x08\x00Qc\x00\x00\x00\x89,\t\x0e\t\x03\x80\t\x00Qc\x00\x00\x00\x89\x94\x1cPP\x13\x03\x80\x0b8;555222\x1f%\x1f%\x1f"\x1f"\x1f%\x1f%\x1f"\x1f%\x1f"\x1f%)\x1f"//\x00\x12\x00\t\x12\x00\n\x12\x00\x0b\x12\x00\x0c\x12\x00\r\x12\x00\x0e\x12\x00\x0f*\x07Y\x12\x00\x10\x12\x00\x11\x12\x00\x12\x12\x00\x13\x12\x00\x14\x12\x00\x15\x12\x00\x16\x12\x00\x17*\x08Y\x12\x00\x18\x12\x00\x19\x12\x00\x1a\x12\x00\x1b\x12\x00\x1c\x12\x00\x1d*\x06Y\x12\x00\x1e\x12\x00\x1f\x12\x00 \x12\x00!\x12\x00"\x12\x00#*\x06Y\x12\x00$\x12\x00%\x12\x00&\x12\x00\'\x12\x00(\x12\x00)*\x06Y\x12\x00*\x12\x00+\x12\x00,\x12\x00-\x12\x00.*\x05Y\x12\x00/\x12\x000\x12\x001\x12\x002\x12\x003*\x05Y\x12\x004\x12\x005\x12\x006\x12\x007\x12\x008*\x05Y\x12\x009\x12\x00:\x12\x00;\x12\x00<\x12\x00=\x12\x00>\x12\x00?\x12\x00@\x12\x00A\x12\x00B\x12\x00C*\x0bY\x12\x00D\x12\x00E\x12\x00F\x12\x00G\x12\x00H\x12\x00I\x12\x00J\x12\x00K\x12\x00L\x12\x00M\x12\x00N*\x0bY\x12\x00O\x12\x00P\x12\x00Q\x12\x00R\x12\x00S\x12\x00T\x12\x00U\x12\x00V\x12\x00W\x12\x00X*\nY\x12\x00Y\x12\x00Z\x12\x00[\x12\x00\\\x12\x00]\x12\x00^\x12\x00_\x12\x00`\x12\x00a\x12\x00b*\nY\x12\x00c\x12\x00d\x12\x00e\x12\x00f\x12\x00g\x12\x00h\x12\x00i\x12\x00j\x12\x00k\x12\x00l\x12\x00m*\x0bY\x12\x00n\x12\x00o\x12\x00p\x12\x00q\x12\x00r\x12\x00s\x12\x00t\x12\x00u\x12\x00v\x12\x00w\x12\x00x*\x0bY\x12\x00y\x12\x00z\x12\x00{\x12\x00|\x12\x00}\x12\x00~\x12\x00\x7f\x12\x00\x80\x12\x00\x81\x12\x00\x82*\nY\x12\x00\x83\x12\x00\x84\x12\x00\x85\x12\x00\x86\x12\x00\x87\x12\x00\x88\x12\x00\x89\x12\x00\x8a\x12\x00\x8b\x12\x00\x8c\x12\x00\x8d*\x0bY\x12\x00\x8e\x12\x00\x8f\x12\x00\x90\x12\x00\x91\x12\x00\x92\x12\x00\x93\x12\x00\x94\x12\x00\x95\x12\x00\x96\x12\x00\x97*\nY\x12\x00\x98\x12\x00\x99\x12\x00\x9a\x12\x00\x9b\x12\x00\x9c\x12\x00\x9d\x12\x00\x9e\x12\x00\x9f\x12\x00\xa0\x12\x00\xa2\x12\x00\xa3*\x0bY\x12\x00\xa4\x12\x00\xa5*\x02Y\x12\nname0\x12\nname1\x12\nname2\x12\nname3\x12\nname4\x12\nname5\x12\nname6\x12\nname7\x12\nname8\x12\nname9*\nY\x12$quite_a_long_name0\x12$quite_a_long_name1\x12$quite_a_long_name2\x12$quite_a_long_name3*\x04Y\x12$quite_a_long_name4\x12$quite_a_long_name5\x12$quite_a_long_name6\x12$quite_a_long_name7*\x04Y\x12$quite_a_long_name8\x12$quite_a_long_name9\x12&quite_a_long_name10\x12&quite_a_long_name11*\x04YQc\x00\x00\x86H8H?/\x80#####################+++++++++\x00#\x00\xc0#\x01\xc0#\x02\xc0#\x03\xc0#\x04\xc0#\x05\xc0#\x06\xc0#\x07\xc0#\x08\xc0#\t\xc0#\n\xc0#\x0b\xc0#\x0c\xc0#\r\xc0#\x0e\xc0#\x0f\xc0#\x10\xc0#\x11\xc0#\x12\xc0#\x13\xc0#\x14QPR\x81\x82\x83*\x07\xc0#\x15QPR\x81\x82\x83*\x07\xc0#\x16QPR\x81\x82\x83*\x07\xc0#\x17QPR\x81\x82\x83*\x07\xc0#\x18QPR\x81\x82\x83*\x07\xc0#\x19QPR\x81\x82\x83*\x07\xc0#\x1aQPR\x81\x82\x83*\x07\xc0#\x1bQPR\x81\x82\x83*\x07\xc0#\x1cQPR\x81\x82\x83*\x07\xc0#\x1dQPR\x81\x82\x83*\x07\xc0Qc\x1e\x00s\x1ethis will be a string object 0s\x1ethis will be a string object 1s\x1ethis will be a string object 2s\x1ethis will be a string object 3s\x1ethis will be a string object 4s\x1ethis will be a string object 5s\x1ethis will be a string object 6s\x1ethis will be a string object 7s\x1ethis will be a string object 8s\x1ethis will be a string object 9b\x1dthis will be a bytes object 0b\x1dthis will be a bytes object 1b\x1dthis will be a bytes object 2b\x1dthis will be a bytes object 3b\x1dthis will be a bytes object 4b\x1dthis will be a bytes object 5b\x1dthis will be a bytes object 6b\x1dthis will be a bytes object 7b\x1dthis will be a bytes object 8b\x1dthis will be a bytes object 9s\rconst tuple 0s\rconst tuple 1s\rconst tuple 2s\rconst tuple 3s\rconst tuple 4s\rconst tuple 5s\rconst tuple 6s\rconst tuple 7s\rconst tuple 8s\rconst tuple 9' +file_data = b"M\x06\x02\x1f\x81=\x1e\x0etest.py\x00\x0f\x04A0\x00\x04A1\x00\x04f0\x00\x04f1\x00\x0cresult\x00/-5\x04a0\x00\x04a1\x00\x04a2\x00\x04a3\x00\x13\x15\x17\x19\x1b\x1d\x1f!#%')+1379;=?ACEGIKMOQSUWY[]_acegikmoqsuwy{}\x7f\x81\x01\x81\x03\x81\x05\x81\x07\x81\t\x81\x0b\x81\r\x81\x0f\x81\x11\x81\x13\x81\x15\x81\x17\x81\x19\x81\x1b\x81\x1d\x81\x1f\x81!\x81#\x81%\x81'\x81)\x81+\x81-\x81/\x811\x813\x815\x817\x819\x81;\x81=\x81?\x81A\x81C\x81E\x81G\x81I\x81K\x81M\x81O\x81Q\x81S\x81U\x81W\x81Y\x81[\x81]\x81_\x81a\x81c\x81e\x81g\x81i\x81k\x81m\x81o\x81q\x81s\x81u\x81w\x81y\x81{\x81}\x81\x7f\x82\x01\x82\x03\x82\x05\x82\x07\x82\t\x82\x0b\x82\r\x82\x0f\x82\x11\x82\x13\x82\x15\x82\x17\x82\x19\x82\x1b\x82\x1d\x82\x1f\x82!\x82#\x82%\x82'\x82)\x82+\x82-\x82/\x821\x823\x825\x827\x829\x82;\x82=\x82?\x82A\x82E\x82G\x82I\x82K\nname0\x00\nname1\x00\nname2\x00\nname3\x00\nname4\x00\nname5\x00\nname6\x00\nname7\x00\nname8\x00\nname9\x00$quite_a_long_name0\x00$quite_a_long_name1\x00$quite_a_long_name2\x00$quite_a_long_name3\x00$quite_a_long_name4\x00$quite_a_long_name5\x00$quite_a_long_name6\x00$quite_a_long_name7\x00$quite_a_long_name8\x00$quite_a_long_name9\x00&quite_a_long_name10\x00&quite_a_long_name11\x00s\x1ethis will be a string object 0\x00s\x1ethis will be a string object 1\x00s\x1ethis will be a string object 2\x00s\x1ethis will be a string object 3\x00s\x1ethis will be a string object 4\x00s\x1ethis will be a string object 5\x00s\x1ethis will be a string object 6\x00s\x1ethis will be a string object 7\x00s\x1ethis will be a string object 8\x00s\x1ethis will be a string object 9\x00b\x1dthis will be a bytes object 0\x00b\x1dthis will be a bytes object 1\x00b\x1dthis will be a bytes object 2\x00b\x1dthis will be a bytes object 3\x00b\x1dthis will be a bytes object 4\x00b\x1dthis will be a bytes object 5\x00b\x1dthis will be a bytes object 6\x00b\x1dthis will be a bytes object 7\x00b\x1dthis will be a bytes object 8\x00b\x1dthis will be a bytes object 9\x00s\rconst tuple 0\x00s\rconst tuple 1\x00s\rconst tuple 2\x00s\rconst tuple 3\x00s\rconst tuple 4\x00s\rconst tuple 5\x00s\rconst tuple 6\x00s\rconst tuple 7\x00s\rconst tuple 8\x00s\rconst tuple 9\x00\x82d\x10\x12\x01i@i@\x84\x18\x84\x1fT2\x00\x10\x024\x02\x16\x02T2\x01\x10\x034\x02\x16\x032\x02\x16\x042\x03\x16\x05\"\x80{\x16\x06Qc\x04\x82\x0c\x00\n\x02($$$\x11\x07\x16\x08\x10\x02\x16\t2\x00\x16\n2\x01\x16\x0b2\x02\x16\x0c2\x03\x16\rQc\x04@\t\x08\n\x81\x0b Qc@\t\x08\x0b\x81\x0b@Qc@\t\x08\x0c\x81\x0b`QcH\t\n\r\x81\x0b` Qc\x82\x14\x00\x0c\x03h`$$$\x11\x07\x16\x08\x10\x03\x16\t2\x00\x16\n2\x01\x16\x0b2\x02\x16\x0c2\x03\x16\rQc\x04H\t\n\n\x81\x0b``QcH\t\n\x0b\x81\x0b\x80\x07QcH\t\n\x0c\x81\x0b\x80\x08QcH\t\n\r\x81\x0b\x80\tQc\xa08P:\x04\x80\x0b13///---997799<\x1f%\x1f\"\x1f%)\x1f\"//\x12\x0e\x12\x0f\x12\x10\x12\x11\x12\x12\x12\x13\x12\x14*\x07Y\x12\x15\x12\x16\x12\x17\x12\x18\x12\x19\x12\x1a\x12\x08\x12\x07*\x08Y\x12\x1b\x12\x1c\x12\t\x12\x1d\x12\x1e\x12\x1f*\x06Y\x12 \x12!\x12\"\x12#\x12$\x12%*\x06Y\x12&\x12'\x12(\x12)\x12*\x12+*\x06Y\x12,\x12-\x12.\x12/\x120*\x05Y\x121\x122\x123\x124\x125*\x05Y\x126\x127\x128\x129\x12:*\x05Y\x12;\x12<\x12=\x12>\x12?\x12@\x12A\x12B\x12C\x12D\x12E*\x0bY\x12F\x12G\x12H\x12I\x12J\x12K\x12L\x12M\x12N\x12O\x12P*\x0bY\x12Q\x12R\x12S\x12T\x12U\x12V\x12W\x12X\x12Y\x12Z*\nY\x12[\x12\\\x12]\x12^\x12_\x12`\x12a\x12b\x12c\x12d*\nY\x12e\x12f\x12g\x12h\x12i\x12j\x12k\x12l\x12m\x12n\x12o*\x0bY\x12p\x12q\x12r\x12s\x12t\x12u\x12v\x12w\x12x\x12y\x12z*\x0bY\x12{\x12|\x12}\x12~\x12\x7f\x12\x81\x00\x12\x81\x01\x12\x81\x02\x12\x81\x03\x12\x81\x04*\nY\x12\x81\x05\x12\x81\x06\x12\x81\x07\x12\x81\x08\x12\x81\t\x12\x81\n\x12\x81\x0b\x12\x81\x0c\x12\x81\r\x12\x81\x0e\x12\x81\x0f*\x0bY\x12\x81\x10\x12\x81\x11\x12\x81\x12\x12\x81\x13\x12\x81\x14\x12\x81\x15\x12\x81\x16\x12\x81\x17\x12\x81\x18\x12\x81\x19*\nY\x12\x81\x1a\x12\x81\x1b\x12\x81\x1c\x12\x81\x1d\x12\x81\x1e\x12\x81\x1f\x12\x81 \x12\x81!\x12\x81\"\x12\x81#\x12\x81$*\x0bY\x12\x81%\x12\x81&*\x02Y\x12\x81'\x12\x81(\x12\x81)\x12\x81*\x12\x81+\x12\x81,\x12\x81-\x12\x81.\x12\x81/\x12\x810*\nY\x12\x811\x12\x812\x12\x813\x12\x814*\x04Y\x12\x815\x12\x816\x12\x817\x12\x818*\x04Y\x12\x819\x12\x81:\x12\x81;\x12\x81<*\x04YQc\x8cp8@\x05\x80#####################+++++++++#\x00\xc0#\x01\xc0#\x02\xc0#\x03\xc0#\x04\xc0#\x05\xc0#\x06\xc0#\x07\xc0#\x08\xc0#\t\xc0#\n\xc0#\x0b\xc0#\x0c\xc0#\r\xc0#\x0e\xc0#\x0f\xc0#\x10\xc0#\x11\xc0#\x12\xc0#\x13\xc0#\x14QPR\x81\x82\x83*\x07\xc0#\x15QPR\x81\x82\x83*\x07\xc0#\x16QPR\x81\x82\x83*\x07\xc0#\x17QPR\x81\x82\x83*\x07\xc0#\x18QPR\x81\x82\x83*\x07\xc0#\x19QPR\x81\x82\x83*\x07\xc0#\x1aQPR\x81\x82\x83*\x07\xc0#\x1bQPR\x81\x82\x83*\x07\xc0#\x1cQPR\x81\x82\x83*\x07\xc0#\x1dQPR\x81\x82\x83*\x07\xc0Qc" class File(uio.IOBase): diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index 58a4a75c91..da6352dab7 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -29,27 +29,49 @@ from __future__ import print_function import platform if platform.python_version_tuple()[0] == "2": - str_cons = lambda val, enc=None: val + from binascii import hexlify as hexlify_py2 + + str_cons = lambda val, enc=None: str(val) bytes_cons = lambda val, enc=None: bytearray(val) is_str_type = lambda o: type(o) is str is_bytes_type = lambda o: type(o) is bytearray is_int_type = lambda o: type(o) is int or type(o) is long + + def hexlify_to_str(b): + x = hexlify_py2(b) + return ":".join(x[i : i + 2] for i in range(0, len(x), 2)) + else: + from binascii import hexlify + str_cons = str bytes_cons = bytes is_str_type = lambda o: type(o) is str is_bytes_type = lambda o: type(o) is bytes is_int_type = lambda o: type(o) is int + + def hexlify_to_str(b): + return str(hexlify(b, ":"), "ascii") + + # end compatibility code import sys import struct -from collections import namedtuple sys.path.append(sys.path[0] + "/../py") import makeqstrdata as qstrutil +class MPYReadError(Exception): + def __init__(self, filename, msg): + self.filename = filename + self.msg = msg + + def __str__(self): + return "%s: %s" % (self.filename, self.msg) + + class FreezeError(Exception): def __init__(self, rawcode, msg): self.rawcode = rawcode @@ -60,7 +82,7 @@ class FreezeError(Exception): class Config: - MPY_VERSION = 5 + MPY_VERSION = 6 MICROPY_LONGINT_IMPL_NONE = 0 MICROPY_LONGINT_IMPL_LONGLONG = 1 MICROPY_LONGINT_IMPL_MPZ = 2 @@ -82,20 +104,6 @@ for n in qstrutil.static_qstr_list: global_qstrs.append(QStrType(n)) -class QStrWindow: - def __init__(self, size): - self.window = [] - self.size = size - - def push(self, val): - self.window = [val] + self.window[: self.size - 1] - - def access(self, idx): - val = self.window[idx] - self.window = [val] + self.window[:idx] + self.window[idx + 1 :] - return val - - MP_CODE_BYTECODE = 2 MP_CODE_NATIVE_PY = 3 MP_CODE_NATIVE_VIPER = 4 @@ -113,6 +121,10 @@ MP_NATIVE_ARCH_ARMV7EMDP = 8 MP_NATIVE_ARCH_XTENSA = 9 MP_NATIVE_ARCH_XTENSAWIN = 10 +MP_SCOPE_FLAG_VIPERRELOC = 0x10 +MP_SCOPE_FLAG_VIPERRODATA = 0x20 +MP_SCOPE_FLAG_VIPERBSS = 0x40 + MP_BC_MASK_EXTRA_BYTE = 0x9E MP_BC_FORMAT_BYTE = 0 @@ -120,11 +132,180 @@ MP_BC_FORMAT_QSTR = 1 MP_BC_FORMAT_VAR_UINT = 2 MP_BC_FORMAT_OFFSET = 3 -# extra byte if caching enabled: -MP_BC_LOAD_NAME = 0x11 -MP_BC_LOAD_GLOBAL = 0x12 -MP_BC_LOAD_ATTR = 0x13 -MP_BC_STORE_ATTR = 0x18 +mp_unary_op_method_name = ( + "__pos__", + "__neg__", + "__invert__", + "", +) + +mp_binary_op_method_name = ( + "__lt__", + "__gt__", + "__eq__", + "__le__", + "__ge__", + "__ne__", + "", + "", + "", + "__ior__", + "__ixor__", + "__iand__", + "__ilshift__", + "__irshift__", + "__iadd__", + "__isub__", + "__imul__", + "__imatmul__", + "__ifloordiv__", + "__itruediv__", + "__imod__", + "__ipow__", + "__or__", + "__xor__", + "__and__", + "__lshift__", + "__rshift__", + "__add__", + "__sub__", + "__mul__", + "__matmul__", + "__floordiv__", + "__truediv__", + "__mod__", + "__pow__", +) + + +class Opcodes: + # fmt: off + # Load, Store, Delete, Import, Make, Build, Unpack, Call, Jump, Exception, For, sTack, Return, Yield, Op + MP_BC_BASE_RESERVED = (0x00) # ---------------- + MP_BC_BASE_QSTR_O = (0x10) # LLLLLLSSSDDII--- + MP_BC_BASE_VINT_E = (0x20) # MMLLLLSSDDBBBBBB + MP_BC_BASE_VINT_O = (0x30) # UUMMCCCC-------- + MP_BC_BASE_JUMP_E = (0x40) # J-JJJJJEEEEF---- + MP_BC_BASE_BYTE_O = (0x50) # LLLLSSDTTTTTEEFF + MP_BC_BASE_BYTE_E = (0x60) # --BREEEYYI------ + MP_BC_LOAD_CONST_SMALL_INT_MULTI = (0x70) # LLLLLLLLLLLLLLLL + # = (0x80) # LLLLLLLLLLLLLLLL + # = (0x90) # LLLLLLLLLLLLLLLL + # = (0xa0) # LLLLLLLLLLLLLLLL + MP_BC_LOAD_FAST_MULTI = (0xb0) # LLLLLLLLLLLLLLLL + MP_BC_STORE_FAST_MULTI = (0xc0) # SSSSSSSSSSSSSSSS + MP_BC_UNARY_OP_MULTI = (0xd0) # OOOOOOO + MP_BC_BINARY_OP_MULTI = (0xd7) # OOOOOOOOO + # = (0xe0) # OOOOOOOOOOOOOOOO + # = (0xf0) # OOOOOOOOOO------ + + MP_BC_LOAD_CONST_SMALL_INT_MULTI_NUM = 64 + MP_BC_LOAD_CONST_SMALL_INT_MULTI_EXCESS = 16 + MP_BC_LOAD_FAST_MULTI_NUM = 16 + MP_BC_STORE_FAST_MULTI_NUM = 16 + MP_BC_UNARY_OP_MULTI_NUM = 4 # MP_UNARY_OP_NUM_BYTECODE + MP_BC_BINARY_OP_MULTI_NUM = 35 # MP_BINARY_OP_NUM_BYTECODE + + MP_BC_LOAD_CONST_FALSE = (MP_BC_BASE_BYTE_O + 0x00) + MP_BC_LOAD_CONST_NONE = (MP_BC_BASE_BYTE_O + 0x01) + MP_BC_LOAD_CONST_TRUE = (MP_BC_BASE_BYTE_O + 0x02) + MP_BC_LOAD_CONST_SMALL_INT = (MP_BC_BASE_VINT_E + 0x02) # signed var-int + MP_BC_LOAD_CONST_STRING = (MP_BC_BASE_QSTR_O + 0x00) # qstr + MP_BC_LOAD_CONST_OBJ = (MP_BC_BASE_VINT_E + 0x03) # ptr + MP_BC_LOAD_NULL = (MP_BC_BASE_BYTE_O + 0x03) + + MP_BC_LOAD_FAST_N = (MP_BC_BASE_VINT_E + 0x04) # uint + MP_BC_LOAD_DEREF = (MP_BC_BASE_VINT_E + 0x05) # uint + MP_BC_LOAD_NAME = (MP_BC_BASE_QSTR_O + 0x01) # qstr + MP_BC_LOAD_GLOBAL = (MP_BC_BASE_QSTR_O + 0x02) # qstr + MP_BC_LOAD_ATTR = (MP_BC_BASE_QSTR_O + 0x03) # qstr + MP_BC_LOAD_METHOD = (MP_BC_BASE_QSTR_O + 0x04) # qstr + MP_BC_LOAD_SUPER_METHOD = (MP_BC_BASE_QSTR_O + 0x05) # qstr + MP_BC_LOAD_BUILD_CLASS = (MP_BC_BASE_BYTE_O + 0x04) + MP_BC_LOAD_SUBSCR = (MP_BC_BASE_BYTE_O + 0x05) + + MP_BC_STORE_FAST_N = (MP_BC_BASE_VINT_E + 0x06) # uint + MP_BC_STORE_DEREF = (MP_BC_BASE_VINT_E + 0x07) # uint + MP_BC_STORE_NAME = (MP_BC_BASE_QSTR_O + 0x06) # qstr + MP_BC_STORE_GLOBAL = (MP_BC_BASE_QSTR_O + 0x07) # qstr + MP_BC_STORE_ATTR = (MP_BC_BASE_QSTR_O + 0x08) # qstr + MP_BC_STORE_SUBSCR = (MP_BC_BASE_BYTE_O + 0x06) + + MP_BC_DELETE_FAST = (MP_BC_BASE_VINT_E + 0x08) # uint + MP_BC_DELETE_DEREF = (MP_BC_BASE_VINT_E + 0x09) # uint + MP_BC_DELETE_NAME = (MP_BC_BASE_QSTR_O + 0x09) # qstr + MP_BC_DELETE_GLOBAL = (MP_BC_BASE_QSTR_O + 0x0a) # qstr + + MP_BC_DUP_TOP = (MP_BC_BASE_BYTE_O + 0x07) + MP_BC_DUP_TOP_TWO = (MP_BC_BASE_BYTE_O + 0x08) + MP_BC_POP_TOP = (MP_BC_BASE_BYTE_O + 0x09) + MP_BC_ROT_TWO = (MP_BC_BASE_BYTE_O + 0x0a) + MP_BC_ROT_THREE = (MP_BC_BASE_BYTE_O + 0x0b) + + MP_BC_JUMP = (MP_BC_BASE_JUMP_E + 0x02) # rel byte code offset, 16-bit signed, in excess + MP_BC_POP_JUMP_IF_TRUE = (MP_BC_BASE_JUMP_E + 0x03) # rel byte code offset, 16-bit signed, in excess + MP_BC_POP_JUMP_IF_FALSE = (MP_BC_BASE_JUMP_E + 0x04) # rel byte code offset, 16-bit signed, in excess + MP_BC_JUMP_IF_TRUE_OR_POP = (MP_BC_BASE_JUMP_E + 0x05) # rel byte code offset, 16-bit signed, in excess + MP_BC_JUMP_IF_FALSE_OR_POP = (MP_BC_BASE_JUMP_E + 0x06) # rel byte code offset, 16-bit signed, in excess + MP_BC_UNWIND_JUMP = (MP_BC_BASE_JUMP_E + 0x00) # rel byte code offset, 16-bit signed, in excess; then a byte + MP_BC_SETUP_WITH = (MP_BC_BASE_JUMP_E + 0x07) # rel byte code offset, 16-bit unsigned + MP_BC_SETUP_EXCEPT = (MP_BC_BASE_JUMP_E + 0x08) # rel byte code offset, 16-bit unsigned + MP_BC_SETUP_FINALLY = (MP_BC_BASE_JUMP_E + 0x09) # rel byte code offset, 16-bit unsigned + MP_BC_POP_EXCEPT_JUMP = (MP_BC_BASE_JUMP_E + 0x0a) # rel byte code offset, 16-bit unsigned + MP_BC_FOR_ITER = (MP_BC_BASE_JUMP_E + 0x0b) # rel byte code offset, 16-bit unsigned + MP_BC_WITH_CLEANUP = (MP_BC_BASE_BYTE_O + 0x0c) + MP_BC_END_FINALLY = (MP_BC_BASE_BYTE_O + 0x0d) + MP_BC_GET_ITER = (MP_BC_BASE_BYTE_O + 0x0e) + MP_BC_GET_ITER_STACK = (MP_BC_BASE_BYTE_O + 0x0f) + + MP_BC_BUILD_TUPLE = (MP_BC_BASE_VINT_E + 0x0a) # uint + MP_BC_BUILD_LIST = (MP_BC_BASE_VINT_E + 0x0b) # uint + MP_BC_BUILD_MAP = (MP_BC_BASE_VINT_E + 0x0c) # uint + MP_BC_STORE_MAP = (MP_BC_BASE_BYTE_E + 0x02) + MP_BC_BUILD_SET = (MP_BC_BASE_VINT_E + 0x0d) # uint + MP_BC_BUILD_SLICE = (MP_BC_BASE_VINT_E + 0x0e) # uint + MP_BC_STORE_COMP = (MP_BC_BASE_VINT_E + 0x0f) # uint + MP_BC_UNPACK_SEQUENCE = (MP_BC_BASE_VINT_O + 0x00) # uint + MP_BC_UNPACK_EX = (MP_BC_BASE_VINT_O + 0x01) # uint + + MP_BC_RETURN_VALUE = (MP_BC_BASE_BYTE_E + 0x03) + MP_BC_RAISE_LAST = (MP_BC_BASE_BYTE_E + 0x04) + MP_BC_RAISE_OBJ = (MP_BC_BASE_BYTE_E + 0x05) + MP_BC_RAISE_FROM = (MP_BC_BASE_BYTE_E + 0x06) + MP_BC_YIELD_VALUE = (MP_BC_BASE_BYTE_E + 0x07) + MP_BC_YIELD_FROM = (MP_BC_BASE_BYTE_E + 0x08) + + MP_BC_MAKE_FUNCTION = (MP_BC_BASE_VINT_O + 0x02) # uint + MP_BC_MAKE_FUNCTION_DEFARGS = (MP_BC_BASE_VINT_O + 0x03) # uint + MP_BC_MAKE_CLOSURE = (MP_BC_BASE_VINT_E + 0x00) # uint; extra byte + MP_BC_MAKE_CLOSURE_DEFARGS = (MP_BC_BASE_VINT_E + 0x01) # uint; extra byte + MP_BC_CALL_FUNCTION = (MP_BC_BASE_VINT_O + 0x04) # uint + MP_BC_CALL_FUNCTION_VAR_KW = (MP_BC_BASE_VINT_O + 0x05) # uint + MP_BC_CALL_METHOD = (MP_BC_BASE_VINT_O + 0x06) # uint + MP_BC_CALL_METHOD_VAR_KW = (MP_BC_BASE_VINT_O + 0x07) # uint + + MP_BC_IMPORT_NAME = (MP_BC_BASE_QSTR_O + 0x0b) # qstr + MP_BC_IMPORT_FROM = (MP_BC_BASE_QSTR_O + 0x0c) # qstr + MP_BC_IMPORT_STAR = (MP_BC_BASE_BYTE_E + 0x09) + # fmt: on + + # Create a dict mapping opcode value to opcode name. + mapping = ["unknown" for _ in range(256)] + for op_name in list(locals()): + if op_name.startswith("MP_BC_"): + mapping[locals()[op_name]] = op_name[len("MP_BC_") :] + for i in range(MP_BC_LOAD_CONST_SMALL_INT_MULTI_NUM): + name = "LOAD_CONST_SMALL_INT %d" % (i - MP_BC_LOAD_CONST_SMALL_INT_MULTI_EXCESS) + mapping[MP_BC_LOAD_CONST_SMALL_INT_MULTI + i] = name + for i in range(MP_BC_LOAD_FAST_MULTI_NUM): + mapping[MP_BC_LOAD_FAST_MULTI + i] = "LOAD_FAST %d" % i + for i in range(MP_BC_STORE_FAST_MULTI_NUM): + mapping[MP_BC_STORE_FAST_MULTI + i] = "STORE_FAST %d" % i + for i in range(MP_BC_UNARY_OP_MULTI_NUM): + mapping[MP_BC_UNARY_OP_MULTI + i] = "UNARY_OP %d %s" % (i, mp_unary_op_method_name[i]) + for i in range(MP_BC_BINARY_OP_MULTI_NUM): + mapping[MP_BC_BINARY_OP_MULTI + i] = "BINARY_OP %d %s" % (i, mp_binary_op_method_name[i]) + # this function mirrors that in py/bc.c def mp_opcode_format(bytecode, ip, count_var_uint): @@ -147,6 +328,26 @@ def mp_opcode_format(bytecode, ip, count_var_uint): return f, ip - ip_start +def mp_opcode_decode(bytecode, ip): + opcode = bytecode[ip] + ip_start = ip + f = (0x000003A4 >> (2 * ((opcode) >> 4))) & 3 + extra_byte = (opcode & MP_BC_MASK_EXTRA_BYTE) == 0 + ip += 1 + arg = 0 + if f in (MP_BC_FORMAT_QSTR, MP_BC_FORMAT_VAR_UINT): + arg = bytecode[ip] & 0x7F + while bytecode[ip] & 0x80 != 0: + ip += 1 + arg = arg << 7 | bytecode[ip] & 0x7F + ip += 1 + elif f == MP_BC_FORMAT_OFFSET: + arg = bytecode[ip] | bytecode[ip + 1] << 8 + ip += 2 + ip += extra_byte + return f, ip - ip_start, arg + + def read_prelude_sig(read_byte): z = read_byte() # xSSSSEAA @@ -201,6 +402,7 @@ def extract_prelude(bytecode, ip): n_kwonly_args, n_def_pos_args, ) = read_prelude_sig(local_read_byte) + n_info, n_cell = read_prelude_size(local_read_byte) ip = ip_ref[0] @@ -208,74 +410,186 @@ def extract_prelude(bytecode, ip): ip = ip2 + n_info + n_cell # ip now points to first opcode # ip2 points to simple_name qstr - return ip, ip2, (n_state, n_exc_stack, scope_flags, n_pos_args, n_kwonly_args, n_def_pos_args) + + # Extract simple_name and argument qstrs (var uints). + args = [] + for arg_num in range(1 + n_pos_args + n_kwonly_args): + value = 0 + while True: + b = local_read_byte() + value = (value << 7) | (b & 0x7F) + if b & 0x80 == 0: + break + args.append(value) + + return ( + ip2, + ip, + ip_ref[0], + (n_state, n_exc_stack, scope_flags, n_pos_args, n_kwonly_args, n_def_pos_args), + args, + ) class MPFunTable: - pass + def __repr__(self): + return "mp_fun_table" -class RawCode(object): - # a set of all escaped names, to make sure they are unique - escaped_names = set() - - # convert code kind number to string - code_kind_str = { - MP_CODE_BYTECODE: "MP_CODE_BYTECODE", - MP_CODE_NATIVE_PY: "MP_CODE_NATIVE_PY", - MP_CODE_NATIVE_VIPER: "MP_CODE_NATIVE_VIPER", - MP_CODE_NATIVE_ASM: "MP_CODE_NATIVE_ASM", - } - - def __init__(self, code_kind, bytecode, prelude_offset, qstrs, objs, raw_codes): - # set core variables - self.code_kind = code_kind - self.bytecode = bytecode - self.prelude_offset = prelude_offset - self.qstrs = qstrs - self.objs = objs - self.raw_codes = raw_codes - - if self.prelude_offset is None: - # no prelude, assign a dummy simple_name - self.prelude_offset = 0 - self.simple_name = global_qstrs[1] - else: - # extract prelude - self.ip, self.ip2, self.prelude = extract_prelude(self.bytecode, self.prelude_offset) - self.simple_name = self._unpack_qstr(self.ip2) - self.source_file = self._unpack_qstr(self.ip2 + 2) - self.line_info_offset = self.ip2 + 4 +class CompiledModule: + def __init__( + self, + mpy_source_file, + mpy_segments, + header, + qstr_table, + obj_table, + raw_code, + raw_code_file_offset, + escaped_name, + ): + self.mpy_source_file = mpy_source_file + self.mpy_segments = mpy_segments + self.source_file = qstr_table[0] + self.header = header + self.qstr_table = qstr_table + self.obj_table = obj_table + self.raw_code_file_offset = raw_code_file_offset + self.raw_code = raw_code + self.escaped_name = escaped_name def _unpack_qstr(self, ip): qst = self.bytecode[ip] | self.bytecode[ip + 1] << 8 return global_qstrs[qst] - def dump(self): - # dump children first - for rc in self.raw_codes: - rc.freeze("") - # TODO + def hexdump(self): + with open(self.mpy_source_file, "rb") as f: + WIDTH = 16 + COL_OFF = "\033[0m" + COL_TABLE = ( + ("", ""), # META + ("\033[0;31m", "\033[0;91m"), # QSTR + ("\033[0;32m", "\033[0;92m"), # OBJ + ("\033[0;34m", "\033[0;94m"), # CODE + ) + cur_col = "" + cur_col_index = 0 + offset = 0 + segment_index = 0 + while True: + data = bytes_cons(f.read(WIDTH)) + if not data: + break - def freeze_children(self, parent_name): - self.escaped_name = parent_name + self.simple_name.qstr_esc + # Print out the hex dump of this line of data. + line_hex = cur_col + line_chr = cur_col + line_comment = "" + for i in range(len(data)): + # Determine the colour of the data, if any, and the line comment. + while segment_index < len(self.mpy_segments): + if offset + i == self.mpy_segments[segment_index].start: + cur_col = COL_TABLE[self.mpy_segments[segment_index].kind][ + cur_col_index + ] + cur_col_index = 1 - cur_col_index + line_hex += cur_col + line_chr += cur_col + line_comment += " %s%s%s" % ( + cur_col, + self.mpy_segments[segment_index].name, + COL_OFF, + ) + if offset + i == self.mpy_segments[segment_index].end: + cur_col = "" + line_hex += COL_OFF + line_chr += COL_OFF + segment_index += 1 + else: + break - # make sure the escaped name is unique - i = 2 - while self.escaped_name in RawCode.escaped_names: - self.escaped_name = parent_name + self.simple_name.qstr_esc + str(i) - i += 1 - RawCode.escaped_names.add(self.escaped_name) + # Add to the hex part of the line. + if i % 2 == 0: + line_hex += " " + line_hex += "%02x" % data[i] - # emit children first - for rc in self.raw_codes: - rc.freeze(self.escaped_name + "_") + # Add to the characters part of the line. + if 0x20 <= data[i] <= 0x7E: + line_chr += "%s" % chr(data[i]) + else: + line_chr += "." + + # Print out this line. + if cur_col: + line_hex += COL_OFF + line_chr += COL_OFF + pad = " " * ((WIDTH - len(data)) * 5 // 2) + print("%08x:%s%s %s %s" % (offset, line_hex, pad, line_chr, line_comment)) + offset += WIDTH + + def disassemble(self): + print("mpy_source_file:", self.mpy_source_file) + print("source_file:", self.source_file.str) + print("header:", hexlify_to_str(self.header)) + print("qstr_table[%u]:" % len(self.qstr_table)) + for q in self.qstr_table: + print(" %s" % q.str) + print("obj_table:", self.obj_table) + self.raw_code.disassemble() + + def freeze(self, compiled_module_index): + print() + print("/" * 80) + print("// frozen module %s" % self.escaped_name) + print("// - original source file: %s" % self.mpy_source_file) + print("// - frozen file name: %s" % self.source_file.str) + print("// - .mpy header: %s" % ":".join("%02x" % b for b in self.header)) + print() + + self.raw_code.freeze() + print() + + self.freeze_constants() + + print() + print("static const mp_frozen_module_t frozen_module_%s = {" % self.escaped_name) + print(" .constants = {") + if len(self.qstr_table): + print( + " .qstr_table = (qstr_short_t *)&const_qstr_table_data_%s," + % self.escaped_name + ) + else: + print(" .qstr_table = NULL,") + if len(self.obj_table): + print(" .obj_table = (mp_obj_t *)&const_obj_table_data_%s," % self.escaped_name) + else: + print(" .obj_table = NULL,") + print(" },") + print(" .rc = &raw_code_%s," % self.raw_code.escaped_name) + print("};") def freeze_constants(self): + global const_str_content, const_int_content, const_obj_content + + if len(self.qstr_table): + print( + "static const qstr_short_t const_qstr_table_data_%s[%u] = {" + % (self.escaped_name, len(self.qstr_table)) + ) + for q in self.qstr_table: + print(" %s," % q.qstr_id) + print("};") + + if not len(self.obj_table): + return + # generate constant objects - for i, obj in enumerate(self.objs): + print() + print("// constants") + for i, obj in enumerate(self.obj_table): obj_name = "const_obj_%s_%u" % (self.escaped_name, i) - if obj is MPFunTable: + if isinstance(obj, MPFunTable): pass elif obj is Ellipsis: print("#define %s mp_const_ellipsis_obj" % obj_name) @@ -286,7 +600,7 @@ class RawCode(object): else: obj_type = "mp_type_bytes" print( - 'STATIC const mp_obj_str_t %s = {{&%s}, %u, %u, (const byte*)"%s"};' + 'static const mp_obj_str_t %s = {{&%s}, %u, %u, (const byte*)"%s"};' % ( obj_name, obj_type, @@ -295,6 +609,8 @@ class RawCode(object): "".join(("\\x%02x" % b) for b in obj), ) ) + const_str_content += len(obj) + const_obj_content += 4 * 4 elif is_int_type(obj): if config.MICROPY_LONGINT_IMPL == config.MICROPY_LONGINT_IMPL_NONE: # TODO check if we can actually fit this long-int into a small-int @@ -316,76 +632,139 @@ class RawCode(object): ndigs = len(digs) digs = ",".join(("%#x" % d) for d in digs) print( - "STATIC const mp_obj_int_t %s = {{&mp_type_int}, " + "static const mp_obj_int_t %s = {{&mp_type_int}, " "{.neg=%u, .fixed_dig=1, .alloc=%u, .len=%u, .dig=(uint%u_t*)(const uint%u_t[]){%s}}};" % (obj_name, neg, ndigs, ndigs, bits_per_dig, bits_per_dig, digs) ) + const_int_content += (digs.count(",") + 1) * bits_per_dig // 8 + const_obj_content += 4 * 4 elif type(obj) is float: print( "#if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_A || MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_B" ) print( - "STATIC const mp_obj_float_t %s = {{&mp_type_float}, (mp_float_t)%.16g};" + "static const mp_obj_float_t %s = {{&mp_type_float}, (mp_float_t)%.16g};" % (obj_name, obj) ) print("#endif") + const_obj_content += 3 * 4 elif type(obj) is complex: print( - "STATIC const mp_obj_complex_t %s = {{&mp_type_complex}, (mp_float_t)%.16g, (mp_float_t)%.16g};" + "static const mp_obj_complex_t %s = {{&mp_type_complex}, (mp_float_t)%.16g, (mp_float_t)%.16g};" % (obj_name, obj.real, obj.imag) ) else: raise FreezeError(self, "freezing of object %r is not implemented" % (obj,)) - # generate constant table, if it has any entries - const_table_len = len(self.qstrs) + len(self.objs) + len(self.raw_codes) - if const_table_len: - print( - "STATIC const mp_rom_obj_t const_table_data_%s[%u] = {" - % (self.escaped_name, const_table_len) - ) - for qst in self.qstrs: - print(" MP_ROM_QSTR(%s)," % global_qstrs[qst].qstr_id) - for i in range(len(self.objs)): - if self.objs[i] is MPFunTable: - print(" &mp_fun_table,") - elif type(self.objs[i]) is float: - print( - "#if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_A || MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_B" - ) - print(" MP_ROM_PTR(&const_obj_%s_%u)," % (self.escaped_name, i)) - print("#elif MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_C") - n = struct.unpack("> 8,") - print(" ", self.source_file.qstr_id, "& 0xff,", self.source_file.qstr_id, ">> 8,") - print(" ", end="") - for i in range(self.ip2 + 4, self.ip): - print(" 0x%02x," % self.bytecode[i], end="") - print() - ip = self.ip - while ip < len(self.bytecode): - f, sz = mp_opcode_format(self.bytecode, ip, True) - if f == 1: - qst = self._unpack_qstr(ip + 1).qstr_id - extra = "" if sz == 3 else " 0x%02x," % self.bytecode[ip + 3] - print(" ", "0x%02x," % self.bytecode[ip], qst, "& 0xff,", qst, ">> 8,", extra) + def disassemble(self): + bc = self.fun_data + print("simple_name:", self.simple_name.str) + print(" raw bytecode:", len(bc), hexlify_to_str(bc)) + print(" prelude:", self.prelude) + print(" args:", [self.qstr_table[i].str for i in self.names[1:]]) + print(" line info:", hexlify_to_str(bc[self.offset_line_info : self.offset_opcodes])) + ip = self.offset_opcodes + while ip < len(bc): + fmt, sz, arg = mp_opcode_decode(bc, ip) + if bc[ip] == Opcodes.MP_BC_LOAD_CONST_OBJ: + arg = "%r" % self.obj_table[arg] + if fmt == MP_BC_FORMAT_QSTR: + arg = self.qstr_table[arg].str + elif fmt in (MP_BC_FORMAT_VAR_UINT, MP_BC_FORMAT_OFFSET): + pass else: - print(" ", "".join("0x%02x, " % self.bytecode[ip + i] for i in range(sz))) + arg = "" + print( + " %-11s %s %s" % (hexlify_to_str(bc[ip : ip + sz]), Opcodes.mapping[bc[ip]], arg) + ) ip += sz + self.disassemble_children() + + def freeze(self): + # generate bytecode data + bc = self.fun_data + print( + "// frozen bytecode for file %s, scope %s" + % (self.qstr_table[0].str, self.escaped_name) + ) + print("static const byte fun_data_%s[%u] = {" % (self.escaped_name, len(bc))) + + print(" ", end="") + for b in bc[: self.offset_names]: + print("0x%02x," % b, end="") + print(" // prelude") + + print(" ", end="") + for b in bc[self.offset_names : self.offset_line_info]: + print("0x%02x," % b, end="") + print(" // names: %s" % ", ".join(self.qstr_table[i].str for i in self.names)) + + print(" ", end="") + for b in bc[self.offset_line_info : self.offset_opcodes]: + print("0x%02x," % b, end="") + print(" // code info") + + ip = self.offset_opcodes + while ip < len(bc): + fmt, sz, arg = mp_opcode_decode(bc, ip) + opcode_name = Opcodes.mapping[bc[ip]] + if fmt == MP_BC_FORMAT_QSTR: + opcode_name += " " + self.qstr_table[arg].str + elif fmt in (MP_BC_FORMAT_VAR_UINT, MP_BC_FORMAT_OFFSET): + opcode_name += " %u" % arg + print( + " %s, // %s" % (",".join("0x%02x" % b for b in bc[ip : ip + sz]), opcode_name) + ) + ip += sz + print("};") - self.freeze_constants() - self.freeze_module() + self.freeze_children() + self.freeze_raw_code() + + global bc_content + bc_content += len(bc) class RawCodeNative(RawCode): def __init__( self, - code_kind, + cm_escaped_name, + qstr_table, + kind, fun_data, prelude_offset, - prelude, qstr_links, - qstrs, - objs, - raw_codes, + scope_flags, + n_pos_args, type_sig, ): super(RawCodeNative, self).__init__( - code_kind, fun_data, prelude_offset, qstrs, objs, raw_codes + cm_escaped_name, qstr_table, fun_data, prelude_offset, kind ) - self.prelude = prelude + + if kind in (MP_CODE_NATIVE_VIPER, MP_CODE_NATIVE_ASM): + self.scope_flags = scope_flags + self.n_pos_args = n_pos_args + self.qstr_links = qstr_links self.type_sig = type_sig if config.native_arch in ( @@ -502,11 +925,32 @@ class RawCodeNative(RawCode): # ARMVxxM -- two byte align. self.fun_data_attributes += " __attribute__ ((aligned (2)))" + def disassemble(self): + fun_data = self.fun_data + print("simple_name:", self.simple_name.str) + print( + " raw data:", + len(fun_data), + hexlify_to_str(fun_data[:32]), + "..." if len(fun_data) > 32 else "", + ) + if self.code_kind != MP_CODE_NATIVE_PY: + return + print(" prelude:", self.prelude) + print(" args:", [self.qstr_table[i].str for i in self.names[1:]]) + print(" line info:", fun_data[self.offset_line_info : self.offset_opcodes]) + ip = 0 + while ip < self.prelude_offset: + sz = 16 + print(" ", hexlify_to_str(fun_data[ip : min(ip + sz, self.prelude_offset)])) + ip += sz + self.disassemble_children() + def _asm_thumb_rewrite_mov(self, pc, val): - print(" (%u & 0xf0) | (%s >> 12)," % (self.bytecode[pc], val), end="") - print(" (%u & 0xfb) | (%s >> 9 & 0x04)," % (self.bytecode[pc + 1], val), end="") + print(" (%u & 0xf0) | (%s >> 12)," % (self.fun_data[pc], val), end="") + print(" (%u & 0xfb) | (%s >> 9 & 0x04)," % (self.fun_data[pc + 1], val), end="") print(" (%s & 0xff)," % (val,), end="") - print(" (%u & 0x07) | (%s >> 4 & 0x70)," % (self.bytecode[pc + 3], val)) + print(" (%u & 0x07) | (%s >> 4 & 0x70)," % (self.fun_data[pc + 3], val)) def _link_qstr(self, pc, kind, qst): if kind == 0: @@ -543,32 +987,22 @@ class RawCodeNative(RawCode): else: assert 0 - def freeze(self, parent_name): - if self.prelude[2] & ~0x0F: + def freeze(self): + if self.scope_flags & ~0x0F: raise FreezeError("unable to freeze code with relocations") - self.freeze_children(parent_name) - # generate native code data print() - if self.code_kind == MP_CODE_NATIVE_PY: - print( - "// frozen native code for file %s, scope %s%s" - % (self.source_file.str, parent_name, self.simple_name.str) - ) - elif self.code_kind == MP_CODE_NATIVE_VIPER: - print("// frozen viper code for scope %s" % (parent_name,)) - else: - print("// frozen assembler code for scope %s" % (parent_name,)) print( - "STATIC const byte fun_data_%s[%u] %s = {" - % (self.escaped_name, len(self.bytecode), self.fun_data_attributes) + "// frozen native code for file %s, scope %s" + % (self.qstr_table[0].str, self.escaped_name) + ) + print( + "static const byte fun_data_%s[%u] %s = {" + % (self.escaped_name, len(self.fun_data), self.fun_data_attributes) ) - if self.code_kind == MP_CODE_NATIVE_PY: - i_top = self.prelude_offset - else: - i_top = len(self.bytecode) + i_top = len(self.fun_data) i = 0 qi = 0 while i < i_top: @@ -585,229 +1019,253 @@ class RawCodeNative(RawCode): i16 = min(i16, self.qstr_links[qi][0]) print(" ", end="") for ii in range(i, i16): - print(" 0x%02x," % self.bytecode[ii], end="") + print(" 0x%02x," % self.fun_data[ii], end="") print() i = i16 - if self.code_kind == MP_CODE_NATIVE_PY: - print(" ", end="") - for i in range(self.prelude_offset, self.ip2): - print(" 0x%02x," % self.bytecode[i], end="") - print() - - print(" ", self.simple_name.qstr_id, "& 0xff,", self.simple_name.qstr_id, ">> 8,") - print(" ", self.source_file.qstr_id, "& 0xff,", self.source_file.qstr_id, ">> 8,") - - print(" ", end="") - for i in range(self.ip2 + 4, self.ip): - print(" 0x%02x," % self.bytecode[i], end="") - print() - print("};") - self.freeze_constants() - self.freeze_module(self.qstr_links, self.type_sig) + self.freeze_children() + self.freeze_raw_code(self.qstr_links, self.type_sig) -class BytecodeBuffer: - def __init__(self, size): - self.buf = bytearray(size) - self.idx = 0 +class MPYSegment: + META = 0 + QSTR = 1 + OBJ = 2 + CODE = 3 - def is_full(self): - return self.idx == len(self.buf) - - def append(self, b): - self.buf[self.idx] = b - self.idx += 1 + def __init__(self, kind, name, start, end): + self.kind = kind + self.name = name + self.start = start + self.end = end -def read_byte(f, out=None): - b = bytes_cons(f.read(1))[0] - if out is not None: - out.append(b) - return b +class MPYReader: + def __init__(self, filename, fileobj): + self.filename = filename + self.fileobj = fileobj + + def tell(self): + return self.fileobj.tell() + + def read_byte(self): + return bytes_cons(self.fileobj.read(1))[0] + + def read_bytes(self, n): + return bytes_cons(self.fileobj.read(n)) + + def read_uint(self): + i = 0 + while True: + b = self.read_byte() + i = (i << 7) | (b & 0x7F) + if b & 0x80 == 0: + break + return i -def read_uint(f, out=None): - i = 0 - while True: - b = read_byte(f, out) - i = (i << 7) | (b & 0x7F) - if b & 0x80 == 0: - break - return i - - -def read_qstr(f, qstr_win): - ln = read_uint(f) - if ln == 0: - # static qstr - return bytes_cons(f.read(1))[0] +def read_qstr(reader, segments): + start_pos = reader.tell() + ln = reader.read_uint() if ln & 1: - # qstr in table - return qstr_win.access(ln >> 1) + # static qstr + segments.append( + MPYSegment(MPYSegment.META, global_qstrs[ln >> 1].str, start_pos, start_pos) + ) + return ln >> 1 ln >>= 1 - data = str_cons(f.read(ln), "utf8") + start_pos = reader.tell() + data = str_cons(reader.read_bytes(ln), "utf8") + reader.read_byte() # read and discard null terminator + segments.append(MPYSegment(MPYSegment.QSTR, data, start_pos, reader.tell())) global_qstrs.append(QStrType(data)) - qstr_win.push(len(global_qstrs) - 1) return len(global_qstrs) - 1 -def read_obj(f): - obj_type = f.read(1) - if obj_type == b"e": +def read_obj(reader, segments): + obj_type = reader.read_bytes(1) + if obj_type == b"t": + return MPFunTable() + elif obj_type == b"e": return Ellipsis else: - buf = f.read(read_uint(f)) + ln = reader.read_uint() + start_pos = reader.tell() + buf = reader.read_bytes(ln) + if obj_type in (b"s", b"b"): + reader.read_byte() # read and discard null terminator if obj_type == b"s": - return str_cons(buf, "utf8") + obj = str_cons(buf, "utf8") elif obj_type == b"b": - return bytes_cons(buf) + obj = buf elif obj_type == b"i": - return int(str_cons(buf, "ascii"), 10) + obj = int(str_cons(buf, "ascii"), 10) elif obj_type == b"f": - return float(str_cons(buf, "ascii")) + obj = float(str_cons(buf, "ascii")) elif obj_type == b"c": - return complex(str_cons(buf, "ascii")) + obj = complex(str_cons(buf, "ascii")) else: - assert 0 + raise MPYReadError(reader.filename, "corrupt .mpy file") + segments.append(MPYSegment(MPYSegment.OBJ, obj, start_pos, reader.tell())) + return obj -def read_prelude(f, bytecode, qstr_win): - ( - n_state, - n_exc_stack, - scope_flags, - n_pos_args, - n_kwonly_args, - n_def_pos_args, - ) = read_prelude_sig(lambda: read_byte(f, bytecode)) - n_info, n_cell = read_prelude_size(lambda: read_byte(f, bytecode)) - read_qstr_and_pack(f, bytecode, qstr_win) # simple_name - read_qstr_and_pack(f, bytecode, qstr_win) # source_file - for _ in range(n_info - 4 + n_cell): - read_byte(f, bytecode) - return n_state, n_exc_stack, scope_flags, n_pos_args, n_kwonly_args, n_def_pos_args - - -def read_qstr_and_pack(f, bytecode, qstr_win): - qst = read_qstr(f, qstr_win) - bytecode.append(qst & 0xFF) - bytecode.append(qst >> 8) - - -def read_bytecode(file, bytecode, qstr_win): - while not bytecode.is_full(): - op = read_byte(file, bytecode) - f, sz = mp_opcode_format(bytecode.buf, bytecode.idx - 1, False) - sz -= 1 - if f == MP_BC_FORMAT_QSTR: - read_qstr_and_pack(file, bytecode, qstr_win) - sz -= 2 - elif f == MP_BC_FORMAT_VAR_UINT: - while read_byte(file, bytecode) & 0x80: - pass - for _ in range(sz): - read_byte(file, bytecode) - - -def read_raw_code(f, qstr_win): - kind_len = read_uint(f) +def read_raw_code(reader, cm_escaped_name, qstr_table, obj_table, segments): + # Read raw code header. + kind_len = reader.read_uint() kind = (kind_len & 3) + MP_CODE_BYTECODE - fun_data_len = kind_len >> 2 - fun_data = BytecodeBuffer(fun_data_len) + has_children = (kind_len >> 2) & 1 + fun_data_len = kind_len >> 3 + + # Read the body of the raw code. + file_offset = reader.tell() + fun_data = reader.read_bytes(fun_data_len) + segments_len = len(segments) if kind == MP_CODE_BYTECODE: - prelude = read_prelude(f, fun_data, qstr_win) - read_bytecode(f, fun_data, qstr_win) + # Create bytecode raw code. + rc = RawCodeBytecode(cm_escaped_name, qstr_table, obj_table, fun_data) else: - fun_data.buf[:] = f.read(fun_data_len) - + # Create native raw code. qstr_links = [] if kind in (MP_CODE_NATIVE_PY, MP_CODE_NATIVE_VIPER): - # load qstr link table - n_qstr_link = read_uint(f) + # Read qstr link table. + n_qstr_link = reader.read_uint() for _ in range(n_qstr_link): - off = read_uint(f) - qst = read_qstr(f, qstr_win) + off = reader.read_uint() + qst = read_qstr(reader, segments) qstr_links.append((off >> 2, off & 3, qst)) - type_sig = 0 + native_scope_flags = 0 + native_n_pos_args = 0 + native_type_sig = 0 if kind == MP_CODE_NATIVE_PY: - prelude_offset = read_uint(f) - _, name_idx, prelude = extract_prelude(fun_data.buf, prelude_offset) - fun_data.idx = name_idx # rewind to where qstrs are in prelude - read_qstr_and_pack(f, fun_data, qstr_win) # simple_name - read_qstr_and_pack(f, fun_data, qstr_win) # source_file + prelude_offset = reader.read_uint() else: - prelude_offset = None - scope_flags = read_uint(f) - n_pos_args = 0 - if kind == MP_CODE_NATIVE_ASM: - n_pos_args = read_uint(f) - type_sig = read_uint(f) - prelude = (None, None, scope_flags, n_pos_args, 0) + prelude_offset = 0 + native_scope_flags = reader.read_uint() + if kind == MP_CODE_NATIVE_VIPER: + # Read any additional sections for native viper. + if native_scope_flags & MP_SCOPE_FLAG_VIPERRODATA: + rodata_size = reader.read_uint() + if native_scope_flags & MP_SCOPE_FLAG_VIPERBSS: + bss_size = reader.read_uint() + if native_scope_flags & MP_SCOPE_FLAG_VIPERRODATA: + reader.read_bytes(rodata_size) + if native_scope_flags & MP_SCOPE_FLAG_VIPERRELOC: + while True: + op = reader.read_byte() + if op == 0xFF: + break + if op & 1: + addr = reader.read_uint() + op >>= 1 + if op <= 5 and op & 1: + n = reader.read_uint() + else: + assert kind == MP_CODE_NATIVE_ASM + native_n_pos_args = reader.read_uint() + native_type_sig = reader.read_uint() - qstrs = [] - objs = [] - raw_codes = [] - if kind != MP_CODE_NATIVE_ASM: - # load constant table - n_obj = read_uint(f) - n_raw_code = read_uint(f) - qstrs = [read_qstr(f, qstr_win) for _ in range(prelude[3] + prelude[4])] - if kind != MP_CODE_BYTECODE: - objs.append(MPFunTable) - objs.extend([read_obj(f) for _ in range(n_obj)]) - raw_codes = [read_raw_code(f, qstr_win) for _ in range(n_raw_code)] - - if kind == MP_CODE_BYTECODE: - return RawCodeBytecode(fun_data.buf, qstrs, objs, raw_codes) - else: - return RawCodeNative( + rc = RawCodeNative( + cm_escaped_name, + qstr_table, kind, - fun_data.buf, + fun_data, prelude_offset, - prelude, qstr_links, - qstrs, - objs, - raw_codes, - type_sig, + native_scope_flags, + native_n_pos_args, + native_type_sig, ) + # Add a segment for the raw code data. + segments.insert( + segments_len, + MPYSegment(MPYSegment.CODE, rc.simple_name.str, file_offset, file_offset + fun_data_len), + ) + + # Read children, if there are any. + rc.children = [] + if has_children: + n_children = reader.read_uint() + for _ in range(n_children): + rc.children.append( + read_raw_code(reader, cm_escaped_name, qstr_table, obj_table, segments) + ) + + return rc + def read_mpy(filename): - with open(filename, "rb") as f: - header = bytes_cons(f.read(4)) + with open(filename, "rb") as fileobj: + reader = MPYReader(filename, fileobj) + segments = [] + + # Read and verify the header. + header = reader.read_bytes(4) if header[0] != ord("M"): - raise Exception("not a valid .mpy file") + raise MPYReadError(filename, "not a valid .mpy file") if header[1] != config.MPY_VERSION: - raise Exception("incompatible .mpy version") + raise MPYReadError(filename, "incompatible .mpy version") feature_byte = header[2] - qw_size = read_uint(f) config.MICROPY_PY_BUILTINS_STR_UNICODE = (feature_byte & 2) != 0 mpy_native_arch = feature_byte >> 2 if mpy_native_arch != MP_NATIVE_ARCH_NONE: if config.native_arch == MP_NATIVE_ARCH_NONE: config.native_arch = mpy_native_arch elif config.native_arch != mpy_native_arch: - raise Exception("native architecture mismatch") + raise MPYReadError(filename, "native architecture mismatch") config.mp_small_int_bits = header[3] - qstr_win = QStrWindow(qw_size) - rc = read_raw_code(f, qstr_win) - rc.mpy_source_file = filename - rc.qstr_win_size = qw_size - return rc + + # Read number of qstrs, and number of objects. + n_qstr = reader.read_uint() + n_obj = reader.read_uint() + + # Read qstrs and construct qstr table. + qstr_table = [] + for i in range(n_qstr): + q = read_qstr(reader, segments) + qstr_table.append(global_qstrs[q]) + + # Read objects and construct object table. + obj_table = [] + for i in range(n_obj): + obj_table.append(read_obj(reader, segments)) + + # Compute the compiled-module escaped name. + cm_escaped_name = qstr_table[0].str.replace("/", "_")[:-3] + + # Read the outer raw code, which will in turn read all its children. + raw_code_file_offset = reader.tell() + raw_code = read_raw_code(reader, cm_escaped_name, qstr_table, obj_table, segments) + + # Create the outer-level compiled module representing the whole .mpy file. + return CompiledModule( + filename, + segments, + header, + qstr_table, + obj_table, + raw_code, + raw_code_file_offset, + cm_escaped_name, + ) -def dump_mpy(raw_codes): - for rc in raw_codes: - rc.dump() +def hexdump_mpy(compiled_modules): + for cm in compiled_modules: + cm.hexdump() -def freeze_mpy(base_qstrs, raw_codes): +def disassemble_mpy(compiled_modules): + for cm in compiled_modules: + cm.disassemble() + + +def freeze_mpy(base_qstrs, compiled_modules): # add to qstrs new = {} for q in global_qstrs: @@ -864,6 +1322,17 @@ def freeze_mpy(base_qstrs, raw_codes): # As in qstr.c, set so that the first dynamically allocated pool is twice this size; must be <= the len qstr_pool_alloc = min(len(new), 10) + global bc_content, const_str_content, const_int_content, const_obj_content, const_table_qstr_content, const_table_ptr_content, raw_code_count, raw_code_content + qstr_content = 0 + bc_content = 0 + const_str_content = 0 + const_int_content = 0 + const_obj_content = 0 + const_table_qstr_content = 0 + const_table_ptr_content = 0 + raw_code_count = 0 + raw_code_content = 0 + print() print("const qstr_hash_t mp_qstr_frozen_const_hashes[] = {") qstr_size = {"metadata": 0, "data": 0} @@ -892,32 +1361,49 @@ def freeze_mpy(base_qstrs, raw_codes): print(" {") for _, _, qstr, qbytes in new: print(' "%s",' % qstrutil.escape_bytes(qstr, qbytes)) + qstr_content += ( + config.MICROPY_QSTR_BYTES_IN_LEN + config.MICROPY_QSTR_BYTES_IN_HASH + len(qbytes) + 1 + ) print(" },") print("};") - for rc in raw_codes: - rc.freeze(rc.source_file.str.replace("/", "_")[:-3] + "_") + # Freeze all modules. + for idx, cm in enumerate(compiled_modules): + cm.freeze(idx) + # Print separator, separating individual modules from global data structures. + print() + print("/" * 80) + print("// collection of all frozen modules") + + # Define the string of frozen module names. print() print("const char mp_frozen_names[] = {") - print("#ifdef MP_FROZEN_STR_NAMES") + print(" #ifdef MP_FROZEN_STR_NAMES") # makemanifest.py might also include some frozen string content. - print("MP_FROZEN_STR_NAMES") - print("#endif") - for rc in raw_codes: - module_name = rc.source_file.str - print('"%s\\0"' % module_name) - print('"\\0"};') - - print("const mp_raw_code_t *const mp_frozen_mpy_content[] = {") - for rc in raw_codes: - print(" &raw_code_%s," % rc.escaped_name) + print(" MP_FROZEN_STR_NAMES") + print(" #endif") + mp_frozen_mpy_names_content = 1 + for cm in compiled_modules: + module_name = cm.source_file.str + print(' "%s\\0"' % module_name) + mp_frozen_mpy_names_content += len(cm.source_file.str) + 1 + print(' "\\0"') print("};") + # Define the array of pointers to frozen module content. + print() + print("const mp_frozen_module_t *const mp_frozen_mpy_content[] = {") + for cm in compiled_modules: + print(" &frozen_module_%s," % cm.escaped_name) + print("};") + mp_frozen_mpy_content_size = len(compiled_modules * 4) + # If a port defines MICROPY_FROZEN_LIST_ITEM then list all modules wrapped in that macro. + print() print("#ifdef MICROPY_FROZEN_LIST_ITEM") - for rc in raw_codes: - module_name = rc.source_file.str + for cm in compiled_modules: + module_name = cm.source_file.str if module_name.endswith("/__init__.py"): short_name = module_name[: -len("/__init__.py")] else: @@ -925,45 +1411,94 @@ def freeze_mpy(base_qstrs, raw_codes): print('MICROPY_FROZEN_LIST_ITEM("%s", "%s")' % (short_name, module_name)) print("#endif") + print() + print("/*") + print("byte sizes:") + print("qstr content: %d unique, %d bytes" % (len(new), qstr_content)) + print("bc content: %d" % bc_content) + print("const str content: %d" % const_str_content) + print("const int content: %d" % const_int_content) + print("const obj content: %d" % const_obj_content) + print( + "const table qstr content: %d entries, %d bytes" + % (const_table_qstr_content, const_table_qstr_content * 4) + ) + print( + "const table ptr content: %d entries, %d bytes" + % (const_table_ptr_content, const_table_ptr_content * 4) + ) + print("raw code content: %d * 4 = %d" % (raw_code_count, raw_code_content)) + print("mp_frozen_mpy_names_content: %d" % mp_frozen_mpy_names_content) + print("mp_frozen_mpy_content_size: %d" % mp_frozen_mpy_content_size) + print( + "total: %d" + % ( + qstr_content + + bc_content + + const_str_content + + const_int_content + + const_obj_content + + const_table_qstr_content * 4 + + const_table_ptr_content * 4 + + raw_code_content + + mp_frozen_mpy_names_content + + mp_frozen_mpy_content_size + ) + ) + print("*/") + def merge_mpy(raw_codes, output_file): - assert len(raw_codes) <= 31 # so var-uints all fit in 1 byte + assert len(raw_codes) <= 2 # so var-uints all fit in 1 byte merged_mpy = bytearray() if len(raw_codes) == 1: with open(raw_codes[0].mpy_source_file, "rb") as f: merged_mpy.extend(f.read()) else: - header = bytearray(5) + main_rc = None + for rc in raw_codes: + if len(rc.qstr_table) > 1 or len(rc.obj_table) > 0: + # Must use qstr_table and obj_table from this raw_code + if main_rc is not None: + raise Exception( + "can't merge files when more than one has a populated qstr or obj table" + ) + main_rc = rc + if main_rc is None: + main_rc = raw_codes[0] + + header = bytearray(4) header[0] = ord("M") header[1] = config.MPY_VERSION header[2] = config.native_arch << 2 | config.MICROPY_PY_BUILTINS_STR_UNICODE << 1 header[3] = config.mp_small_int_bits - header[4] = 32 # qstr_win_size merged_mpy.extend(header) + # Copy n_qstr, n_obj, qstr_table, obj_table from main_rc. + with open(main_rc.mpy_source_file, "rb") as f: + data = f.read(main_rc.raw_code_file_offset) + merged_mpy.extend(data[4:]) + bytecode = bytearray() - bytecode_len = 6 + len(raw_codes) * 5 + 2 - bytecode.append(bytecode_len << 2) # kind and length + bytecode_len = 3 + len(raw_codes) * 5 + 2 + bytecode.append(bytecode_len << 3 | 1 << 2) # kind, has_children and length bytecode.append(0b00000000) # signature prelude - bytecode.append(0b00001000) # size prelude - bytecode.extend(b"\x00\x01") # MP_QSTR_ - bytecode.extend(b"\x00\x01") # MP_QSTR_ + bytecode.append(0b00000010) # size prelude; n_info=1 + bytecode.extend(b"\x00") # simple_name: qstr index 0 (will use source filename) for idx in range(len(raw_codes)): bytecode.append(0x32) # MP_BC_MAKE_FUNCTION bytecode.append(idx) # index raw code bytecode.extend(b"\x34\x00\x59") # MP_BC_CALL_FUNCTION, 0 args, MP_BC_POP_TOP bytecode.extend(b"\x51\x63") # MP_BC_LOAD_NONE, MP_BC_RETURN_VALUE - bytecode.append(0) # n_obj - bytecode.append(len(raw_codes)) # n_raw_code - merged_mpy.extend(bytecode) + merged_mpy.append(len(raw_codes)) # n_children + for rc in raw_codes: with open(rc.mpy_source_file, "rb") as f: - f.read(4) # skip header - read_uint(f) # skip qstr_win_size + f.seek(rc.raw_code_file_offset) data = f.read() # read rest of mpy file merged_mpy.extend(data) @@ -978,7 +1513,12 @@ def main(): import argparse cmd_parser = argparse.ArgumentParser(description="A tool to work with MicroPython .mpy files.") - cmd_parser.add_argument("-d", "--dump", action="store_true", help="dump contents of files") + cmd_parser.add_argument( + "-x", "--hexdump", action="store_true", help="output an annotated hex dump of files" + ) + cmd_parser.add_argument( + "-d", "--disassemble", action="store_true", help="output disassembled contents of files" + ) cmd_parser.add_argument("-f", "--freeze", action="store_true", help="freeze files") cmd_parser.add_argument( "--merge", action="store_true", help="merge multiple .mpy files into one" @@ -1018,20 +1558,32 @@ def main(): else: config.MICROPY_QSTR_BYTES_IN_LEN = 1 config.MICROPY_QSTR_BYTES_IN_HASH = 1 - base_qstrs = {} + base_qstrs = list(qstrutil.static_qstr_list) - raw_codes = [read_mpy(file) for file in args.files] + # Load all .mpy files. + try: + compiled_modules = [read_mpy(file) for file in args.files] + except MPYReadError as er: + print(er, file=sys.stderr) + sys.exit(1) - if args.dump: - dump_mpy(raw_codes) - elif args.freeze: + if args.hexdump: + hexdump_mpy(compiled_modules) + + if args.disassemble: + if args.hexdump: + print() + disassemble_mpy(compiled_modules) + + if args.freeze: try: - freeze_mpy(base_qstrs, raw_codes) + freeze_mpy(base_qstrs, compiled_modules) except FreezeError as er: print(er, file=sys.stderr) sys.exit(1) - elif args.merge: - merged_mpy = merge_mpy(raw_codes, args.output) + + if args.merge: + merge_mpy(compiled_modules, args.output) if __name__ == "__main__": diff --git a/tools/mpy_ld.py b/tools/mpy_ld.py index 6bc1dbac05..0dac69e208 100755 --- a/tools/mpy_ld.py +++ b/tools/mpy_ld.py @@ -35,7 +35,7 @@ sys.path.append(os.path.dirname(__file__) + "/../py") import makeqstrdata as qstrutil # MicroPython constants -MPY_VERSION = 5 +MPY_VERSION = 6 MP_NATIVE_ARCH_X86 = 1 MP_NATIVE_ARCH_X64 = 2 MP_NATIVE_ARCH_ARMV7M = 5 @@ -860,11 +860,12 @@ class MPYOutput: def write_qstr(self, s): if s in qstrutil.static_qstr_list: - self.write_bytes(bytes([0, qstrutil.static_qstr_list.index(s) + 1])) + self.write_uint((qstrutil.static_qstr_list.index(s) + 1) << 1 | 1) else: s = bytes(s, "ascii") self.write_uint(len(s) << 1) self.write_bytes(s) + self.write_bytes(b"\x00") def write_reloc(self, base, offset, dest, n): need_offset = not (base == self.prev_base and offset == self.prev_offset + 1) @@ -905,14 +906,19 @@ def build_mpy(env, entry_offset, fmpy, native_qstr_vals, native_qstr_objs): out.open(fmpy) # MPY: header - out.write_bytes( - bytearray( - [ord("M"), MPY_VERSION, env.arch.mpy_feature, MP_SMALL_INT_BITS, QSTR_WINDOW_SIZE] - ) - ) + out.write_bytes(bytearray([ord("M"), MPY_VERSION, env.arch.mpy_feature, MP_SMALL_INT_BITS])) + + # MPY: n_qstr + out.write_uint(1) + + # MPY: n_obj + out.write_uint(0) + + # MPY: qstr table + out.write_qstr(fmpy) # filename # MPY: kind/len - out.write_uint(len(env.full_text) << 2 | (MP_CODE_NATIVE_VIPER - MP_CODE_BYTECODE)) + out.write_uint(len(env.full_text) << 3 | (MP_CODE_NATIVE_VIPER - MP_CODE_BYTECODE)) # MPY: machine code out.write_bytes(env.full_text) @@ -936,20 +942,15 @@ def build_mpy(env, entry_offset, fmpy, native_qstr_vals, native_qstr_objs): scope_flags |= MP_SCOPE_FLAG_VIPERBSS out.write_uint(scope_flags) - # MPY: n_obj - out.write_uint(0) - - # MPY: n_raw_code - out.write_uint(0) - - # MPY: rodata and/or bss + # MPY: bss and/or rodata if len(env.full_rodata): rodata_const_table_idx = 1 out.write_uint(len(env.full_rodata)) - out.write_bytes(env.full_rodata) if len(env.full_bss): - bss_const_table_idx = bool(env.full_rodata) + 1 + bss_const_table_idx = 2 out.write_uint(len(env.full_bss)) + if len(env.full_rodata): + out.write_bytes(env.full_rodata) # MPY: relocation information prev_kind = None From c0f2af4e862a9bb80e401894bad30378dbeac85e Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 18 Nov 2021 11:56:17 +1100 Subject: [PATCH 0158/1712] ports: Recompile bytecode tests now that .mpy format changed. Signed-off-by: Damien George --- ports/minimal/frozentest.mpy | Bin 196 -> 198 bytes ports/powerpc/frozentest.mpy | Bin 196 -> 198 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/ports/minimal/frozentest.mpy b/ports/minimal/frozentest.mpy index 8a89194a1048700453ca5b682c972e131a878610..cd75d65a8bad195029d131cc42f18437ffeb7523 100644 GIT binary patch delta 134 zcmX@Yc#KirmyJoDm02pSD8DK-uOzj&M6aNdfxoewtu&yLfhluhmMSB|#D0xPh9vH! zN}#-gp^>o(BSVXW03V||5NN3jG6^u7Fh&Y8DKkJQMhL|Orj&NQpCt-pH8}A!gp08V VG6}K(d5urQTdq65tB(v!1^}XBAlv`| delta 131 zcmX@cc!V*_mz7Cgp(#W_jDcM$tth`LHLoPKxJ0j@Qd2`iLtBGEkfBo(BSVXW03V||5NN3jG6^u7Fh&Y8DKkJQMhL|Orj&NQpCt-pH8}A!gp08V VG6}K(d5urQTdq65tB(v!1^}XBAlv`| delta 131 zcmX@cc!V*_mz7Cgp(#W_jDcM$tth`LHLoPKxJ0j@Qd2`iLtBGEkfB Date: Thu, 17 Feb 2022 12:01:49 +1100 Subject: [PATCH 0159/1712] github/workflows: Add new workflow to test .mpy file format and tools. Signed-off-by: Damien George --- .github/workflows/mpy_format.yml | 18 ++++++++++++++++++ tools/ci.sh | 17 +++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 .github/workflows/mpy_format.yml diff --git a/.github/workflows/mpy_format.yml b/.github/workflows/mpy_format.yml new file mode 100644 index 0000000000..ab90bb339a --- /dev/null +++ b/.github/workflows/mpy_format.yml @@ -0,0 +1,18 @@ +name: .mpy file format and tools + +on: + push: + pull_request: + paths: + - '.github/workflows/*.yml' + - 'tools/**' + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install packages + run: source tools/ci.sh && ci_mpy_format_setup + - name: Test mpy-tool.py + run: source tools/ci.sh && ci_mpy_format_test diff --git a/tools/ci.sh b/tools/ci.sh index 3e78ae4a05..075e5e423a 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -67,6 +67,23 @@ function ci_code_size_build { tools/metrics.py build bm | tee ~/size1 } +######################################################################################## +# .mpy file format + +function ci_mpy_format_setup { + sudo pip3 install pyelftools +} + +function ci_mpy_format_test { + # Test mpy-tool.py dump feature on bytecode + python2 ./tools/mpy-tool.py -xd ports/minimal/frozentest.mpy + python3 ./tools/mpy-tool.py -xd ports/minimal/frozentest.mpy + + # Test mpy-tool.py dump feature on native code + make -C examples/natmod/features1 + ./tools/mpy-tool.py -xd examples/natmod/features1/features1.mpy +} + ######################################################################################## # ports/cc3200 From 66fc0f45c17c8f3af68d688a432bb51318bc434e Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 17 Feb 2022 12:02:35 +1100 Subject: [PATCH 0160/1712] tools/ci.sh: Run urandom test scripts as part of native module tests. Signed-off-by: Damien George --- tools/ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci.sh b/tools/ci.sh index 075e5e423a..4ae21859db 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -454,7 +454,7 @@ function ci_unix_coverage_run_tests { function ci_unix_coverage_run_native_mpy_tests { MICROPYPATH=examples/natmod/features2 ./ports/unix/micropython-coverage -m features2 - (cd tests && ./run-natmodtests.py "$@" extmod/{btree*,framebuf*,uheapq*,ure*,uzlib*}.py) + (cd tests && ./run-natmodtests.py "$@" extmod/{btree*,framebuf*,uheapq*,urandom*,ure*,uzlib*}.py) } function ci_unix_32bit_setup { From 0a2895b0998bc7ab66b8339acf64fda0339d1e53 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 18 Feb 2022 16:30:24 +1100 Subject: [PATCH 0161/1712] tests/perf_bench: Skip bm_chaos test if random.randrange is unavailable. Signed-off-by: Damien George --- tests/perf_bench/bm_chaos.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/perf_bench/bm_chaos.py b/tests/perf_bench/bm_chaos.py index d0f1337db7..e0e9269ebd 100644 --- a/tests/perf_bench/bm_chaos.py +++ b/tests/perf_bench/bm_chaos.py @@ -218,6 +218,10 @@ class Chaosgame(object): ########################################################################### # Benchmark interface +if not hasattr(random, "randrange"): + print("SKIP") + raise SystemExit + bm_params = { (100, 50): (0.25, 100, 50, 50, 50, 1234), (1000, 1000): (0.25, 200, 400, 400, 1000, 1234), From 414b59d39c9f37c0da5ee00d270aa630c392c2fd Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 21 Feb 2022 10:36:04 +1100 Subject: [PATCH 0162/1712] qemu-arm: Add tests for freezing viper and asm_thumb code. Signed-off-by: Damien George --- ports/qemu-arm/test-frzmpy/frozen_asm.py | 29 ++++++++++++++++++++++ ports/qemu-arm/test-frzmpy/frozen_viper.py | 8 ++++++ tests/qemu-arm/asm_test.py | 7 ++++++ tests/qemu-arm/asm_test.py.exp | 5 ++++ tests/qemu-arm/viper_test.py | 3 +++ tests/qemu-arm/viper_test.py.exp | 1 + 6 files changed, 53 insertions(+) create mode 100644 ports/qemu-arm/test-frzmpy/frozen_asm.py create mode 100644 ports/qemu-arm/test-frzmpy/frozen_viper.py create mode 100644 tests/qemu-arm/asm_test.py create mode 100644 tests/qemu-arm/asm_test.py.exp create mode 100644 tests/qemu-arm/viper_test.py create mode 100644 tests/qemu-arm/viper_test.py.exp diff --git a/ports/qemu-arm/test-frzmpy/frozen_asm.py b/ports/qemu-arm/test-frzmpy/frozen_asm.py new file mode 100644 index 0000000000..2c7f5c92cd --- /dev/null +++ b/ports/qemu-arm/test-frzmpy/frozen_asm.py @@ -0,0 +1,29 @@ +# Test freezing inline-asm code. + +import micropython + + +@micropython.asm_thumb +def asm_add(r0, r1): + add(r0, r0, r1) + + +@micropython.asm_thumb +def asm_add1(r0) -> object: + lsl(r0, r0, 1) + add(r0, r0, 3) + + +@micropython.asm_thumb +def asm_cast_bool(r0) -> bool: + pass + + +@micropython.asm_thumb +def asm_shift_int(r0) -> int: + lsl(r0, r0, 29) + + +@micropython.asm_thumb +def asm_shift_uint(r0) -> uint: + lsl(r0, r0, 29) diff --git a/ports/qemu-arm/test-frzmpy/frozen_viper.py b/ports/qemu-arm/test-frzmpy/frozen_viper.py new file mode 100644 index 0000000000..71dfe7c3b6 --- /dev/null +++ b/ports/qemu-arm/test-frzmpy/frozen_viper.py @@ -0,0 +1,8 @@ +# Test freezing viper code. + +import micropython + + +@micropython.viper +def viper_add(x, y): + print(x + y) diff --git a/tests/qemu-arm/asm_test.py b/tests/qemu-arm/asm_test.py new file mode 100644 index 0000000000..26c7efe427 --- /dev/null +++ b/tests/qemu-arm/asm_test.py @@ -0,0 +1,7 @@ +import frozen_asm + +print(frozen_asm.asm_add(1, 2)) +print(frozen_asm.asm_add1(3)) +print(frozen_asm.asm_cast_bool(0), frozen_asm.asm_cast_bool(3)) +print(frozen_asm.asm_shift_int(4)) +print(frozen_asm.asm_shift_uint(4)) diff --git a/tests/qemu-arm/asm_test.py.exp b/tests/qemu-arm/asm_test.py.exp new file mode 100644 index 0000000000..b4be8b40e2 --- /dev/null +++ b/tests/qemu-arm/asm_test.py.exp @@ -0,0 +1,5 @@ +3 +4 +False True +-2147483648 +2147483648 diff --git a/tests/qemu-arm/viper_test.py b/tests/qemu-arm/viper_test.py new file mode 100644 index 0000000000..8e38a2b928 --- /dev/null +++ b/tests/qemu-arm/viper_test.py @@ -0,0 +1,3 @@ +import frozen_viper + +frozen_viper.viper_add(1, 2) diff --git a/tests/qemu-arm/viper_test.py.exp b/tests/qemu-arm/viper_test.py.exp new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/tests/qemu-arm/viper_test.py.exp @@ -0,0 +1 @@ +3 From ad1f523e7ebae5f260e9c586b28e0d75d715cf65 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 24 Feb 2022 14:05:51 +1100 Subject: [PATCH 0163/1712] tools/mpremote: Add "resume" and "soft-reset" commands. This makes the auto soft-reset behaviour of mpremote more logical, and now configurable via these new commands. Signed-off-by: Damien George --- docs/reference/mpremote.rst | 36 +++++++++++++++++++++++++++++++++ tools/mpremote/mpremote/main.py | 15 +++++++++++++- 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/docs/reference/mpremote.rst b/docs/reference/mpremote.rst index 7a7d787a5a..8e3cf9aa5a 100644 --- a/docs/reference/mpremote.rst +++ b/docs/reference/mpremote.rst @@ -60,6 +60,25 @@ The full list of supported commands are: $ mpremote disconnect + After a disconnect, auto soft-reset is enabled. + +- resume a previous ``mpremote`` session: + + .. code-block:: bash + + $ mpremote resume + + This disables auto soft-reset. + +- perform a soft-reset of the device: + + .. code-block:: bash + + $ mpremote soft-reset + + This will clear out the Python heap and restart the interpreter. It also + disables auto soft-reset. + - enter the REPL on the connected device: .. code-block:: bash @@ -117,11 +136,28 @@ The full list of supported commands are: $ mpremote mount Multiple commands can be specified and they will be run sequentially. + + +Auto connection and soft-reset +------------------------------ + Connection and disconnection will be done automatically at the start and end of the execution of the tool, if such commands are not explicitly given. Automatic connection will search for the first available serial device. If no action is specified then the REPL will be entered. +Once connected to a device, ``mpremote`` will automatically soft-reset the +device if needed. This clears the Python heap and restarts the interpreter, +making sure that subsequent Python code executes in a fresh environment. Auto +soft-reset is performed the first time one of the following commands are +executed: ``mount``, ``eval``, ``exec``, ``run``, ``fs``. After doing a +soft-reset for the first time, it will not be done again automatically, until a +``disconnect`` command is issued. + +Auto soft-reset behaviour can be controlled by the ``resume`` command. And the +``soft-reset`` command can be used to perform an explicit soft reset. + + Shortcuts --------- diff --git a/tools/mpremote/mpremote/main.py b/tools/mpremote/mpremote/main.py index 1073bec7fa..a53ea66f39 100644 --- a/tools/mpremote/mpremote/main.py +++ b/tools/mpremote/mpremote/main.py @@ -39,6 +39,8 @@ _COMMANDS = { or any valid device name/path""", ), "disconnect": (False, False, 0, "disconnect current device"), + "resume": (False, False, 0, "resume a previous mpremote session (will not auto soft-reset)"), + "soft-reset": (False, True, 0, "perform a soft-reset of the device"), "mount": (True, False, 1, "mount local directory on device"), "repl": ( False, @@ -434,6 +436,7 @@ def main(): args = sys.argv[1:] pyb = None + auto_soft_reset = True did_action = False try: @@ -460,13 +463,19 @@ def main(): elif cmd == "help": print_help() sys.exit(0) + elif cmd == "resume": + auto_soft_reset = False + continue + + # The following commands need a connection, and either a raw or friendly REPL. if pyb is None: pyb = do_connect(["auto"]) if need_raw_repl: if not pyb.in_raw_repl: - pyb.enter_raw_repl() + pyb.enter_raw_repl(soft_reset=auto_soft_reset) + auto_soft_reset = False else: if pyb.in_raw_repl: pyb.exit_raw_repl() @@ -476,6 +485,10 @@ def main(): if cmd == "disconnect": do_disconnect(pyb) pyb = None + auto_soft_reset = True + elif cmd == "soft-reset": + pyb.enter_raw_repl(soft_reset=True) + auto_soft_reset = False elif cmd == "mount": path = args.pop(0) pyb.mount_local(path) From d6564a315967f80aafaa4c117892d0b21b0cb2bc Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 25 Feb 2022 13:10:45 +1100 Subject: [PATCH 0164/1712] tools/mpremote: Add "umount" command. Signed-off-by: Damien George --- docs/reference/mpremote.rst | 6 ++++++ tools/mpremote/mpremote/main.py | 3 +++ tools/mpremote/mpremote/pyboardextended.py | 1 + 3 files changed, 10 insertions(+) diff --git a/docs/reference/mpremote.rst b/docs/reference/mpremote.rst index 8e3cf9aa5a..345927ef7f 100644 --- a/docs/reference/mpremote.rst +++ b/docs/reference/mpremote.rst @@ -135,6 +135,12 @@ The full list of supported commands are: $ mpremote mount +- unmount the local directory from the remote device: + + .. code-block:: bash + + $ mpremote umount + Multiple commands can be specified and they will be run sequentially. diff --git a/tools/mpremote/mpremote/main.py b/tools/mpremote/mpremote/main.py index a53ea66f39..524b2ec80a 100644 --- a/tools/mpremote/mpremote/main.py +++ b/tools/mpremote/mpremote/main.py @@ -42,6 +42,7 @@ _COMMANDS = { "resume": (False, False, 0, "resume a previous mpremote session (will not auto soft-reset)"), "soft-reset": (False, True, 0, "perform a soft-reset of the device"), "mount": (True, False, 1, "mount local directory on device"), + "umount": (True, False, 0, "unmount the local directory"), "repl": ( False, True, @@ -493,6 +494,8 @@ def main(): path = args.pop(0) pyb.mount_local(path) print(f"Local directory {path} is mounted at /remote") + elif cmd == "umount": + pyb.umount_local() elif cmd in ("exec", "eval", "run"): follow = True if args[0] == "--no-follow": diff --git a/tools/mpremote/mpremote/pyboardextended.py b/tools/mpremote/mpremote/pyboardextended.py index 6817e7bbf4..69cbf02edd 100644 --- a/tools/mpremote/mpremote/pyboardextended.py +++ b/tools/mpremote/mpremote/pyboardextended.py @@ -687,3 +687,4 @@ class PyboardExtended(Pyboard): if self.mounted: self.exec_('uos.umount("/remote")') self.mounted = False + self.serial = self.serial.orig_serial From c2e8a5acd267e55a11a709d44f0385d0a40f3ec9 Mon Sep 17 00:00:00 2001 From: stijn Date: Tue, 22 Feb 2022 15:42:50 +0100 Subject: [PATCH 0165/1712] windows: Unify project file headers. The xmlns attribute is required for older msbuild version (e.g. for VS2015). Add it where needed, and reorder the attributes so all files look the same. --- mpy-cross/mpy-cross.vcxproj | 2 +- ports/windows/micropython.vcxproj | 2 +- ports/windows/msvc/genhdr.targets | 2 +- ports/windows/msvc/sources.props | 2 +- ports/windows/variants/dev/mpconfigvariant.props | 3 ++- ports/windows/variants/standard/mpconfigvariant.props | 3 ++- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mpy-cross/mpy-cross.vcxproj b/mpy-cross/mpy-cross.vcxproj index e70b29ae14..53cb0fa1fe 100644 --- a/mpy-cross/mpy-cross.vcxproj +++ b/mpy-cross/mpy-cross.vcxproj @@ -1,5 +1,5 @@  - + Debug diff --git a/ports/windows/micropython.vcxproj b/ports/windows/micropython.vcxproj index 6817d6ed13..d5e3f57d8b 100644 --- a/ports/windows/micropython.vcxproj +++ b/ports/windows/micropython.vcxproj @@ -1,5 +1,5 @@  - + Debug diff --git a/ports/windows/msvc/genhdr.targets b/ports/windows/msvc/genhdr.targets index ed97a455d3..b53894f21d 100644 --- a/ports/windows/msvc/genhdr.targets +++ b/ports/windows/msvc/genhdr.targets @@ -1,5 +1,5 @@ - + diff --git a/ports/windows/msvc/sources.props b/ports/windows/msvc/sources.props index e5109eecc8..a6dfd48aa6 100644 --- a/ports/windows/msvc/sources.props +++ b/ports/windows/msvc/sources.props @@ -1,5 +1,5 @@ - + diff --git a/ports/windows/variants/dev/mpconfigvariant.props b/ports/windows/variants/dev/mpconfigvariant.props index d01d74b441..5f78d6e62a 100644 --- a/ports/windows/variants/dev/mpconfigvariant.props +++ b/ports/windows/variants/dev/mpconfigvariant.props @@ -1,4 +1,5 @@ - + + micropython-dev diff --git a/ports/windows/variants/standard/mpconfigvariant.props b/ports/windows/variants/standard/mpconfigvariant.props index 0157102fdf..3cbb1821f4 100644 --- a/ports/windows/variants/standard/mpconfigvariant.props +++ b/ports/windows/variants/standard/mpconfigvariant.props @@ -1,4 +1,5 @@ - + + micropython From 546e213265872cc6393af83a94bb2af5092d4348 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 25 Feb 2022 16:52:58 +1100 Subject: [PATCH 0166/1712] esp32/boards: Add specific deploy instructions for S3 variant. Signed-off-by: Damien George --- ports/esp32/boards/GENERIC_S3/board.json | 2 +- ports/esp32/boards/GENERIC_S3_SPIRAM/board.json | 2 +- ports/esp32/boards/deploy_s3.md | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 ports/esp32/boards/deploy_s3.md diff --git a/ports/esp32/boards/GENERIC_S3/board.json b/ports/esp32/boards/GENERIC_S3/board.json index 058fb7dff0..0db9b32503 100644 --- a/ports/esp32/boards/GENERIC_S3/board.json +++ b/ports/esp32/boards/GENERIC_S3/board.json @@ -1,6 +1,6 @@ { "deploy": [ - "../deploy.md" + "../deploy_s3.md" ], "docs": "", "features": [ diff --git a/ports/esp32/boards/GENERIC_S3_SPIRAM/board.json b/ports/esp32/boards/GENERIC_S3_SPIRAM/board.json index ee2cb8d3f4..3b405d4a12 100644 --- a/ports/esp32/boards/GENERIC_S3_SPIRAM/board.json +++ b/ports/esp32/boards/GENERIC_S3_SPIRAM/board.json @@ -1,6 +1,6 @@ { "deploy": [ - "../deploy.md" + "../deploy_s3.md" ], "docs": "", "features": [ diff --git a/ports/esp32/boards/deploy_s3.md b/ports/esp32/boards/deploy_s3.md new file mode 100644 index 0000000000..7f564a95e3 --- /dev/null +++ b/ports/esp32/boards/deploy_s3.md @@ -0,0 +1,14 @@ +Program your board using the esptool.py program, found [here](https://github.com/espressif/esptool). + +If you are putting MicroPython on your board for the first time then you should +first erase the entire flash using: + +```bash +esptool.py --chip esp32s3 --port /dev/ttyACM0 erase_flash +``` + +From then on program the firmware starting at address 0: + +```bash +esptool.py --chip esp32s3 --port /dev/ttyACM0 write_flash -z 0 board-20210902-v1.17.bin +``` From 0a217624e1d26899986d3e79eb604652da540b00 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 25 Feb 2022 18:24:03 +1100 Subject: [PATCH 0167/1712] tools/upip.py: Remove unused op_basename() function. It seems this was never used, at least not since its inclusion in this repository. Signed-off-by: Damien George --- tools/upip.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/upip.py b/tools/upip.py index 9fb8726420..2932cca50c 100644 --- a/tools/upip.py +++ b/tools/upip.py @@ -41,10 +41,6 @@ def op_split(path): return (head, r[1]) -def op_basename(path): - return op_split(path)[1] - - # Expects *file* name def _makedirs(name, mode=0o777): ret = False @@ -205,7 +201,6 @@ def install_pkg(pkg_spec, install_path): assert len(packages) == 1 package_url = packages[0]["url"] print("Installing %s %s from %s" % (pkg_spec, latest_ver, package_url)) - package_fname = op_basename(package_url) f1 = url_open(package_url) try: f2 = uzlib.DecompIO(f1, gzdict_sz) From 5c46721a1cc32bdb8f700955f9b441a08056f7b0 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Sat, 26 Feb 2022 07:55:53 +0100 Subject: [PATCH 0168/1712] tools/mpy-tool.py: Fix frozen comment generation to escape chars. That caused the compile of frozen_content.c to fail if characters like backslash were in a short string. Thanks to @hippy for identifying the spot to change. --- tools/mpy-tool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index da6352dab7..73753094ec 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -861,7 +861,7 @@ class RawCodeBytecode(RawCode): fmt, sz, arg = mp_opcode_decode(bc, ip) opcode_name = Opcodes.mapping[bc[ip]] if fmt == MP_BC_FORMAT_QSTR: - opcode_name += " " + self.qstr_table[arg].str + opcode_name += " " + repr(self.qstr_table[arg].str) elif fmt in (MP_BC_FORMAT_VAR_UINT, MP_BC_FORMAT_OFFSET): opcode_name += " %u" % arg print( From c4b8dae4387b3a01cf4139c75f0852c5a6ffc108 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 28 Feb 2022 18:51:45 +1100 Subject: [PATCH 0169/1712] tests/unix: Add coverage test for freezing various objects. Signed-off-by: Damien George --- ports/unix/variants/coverage/frzmpy/frzmpy3.py | 6 ++++++ tests/unix/extra_coverage.py | 3 +++ tests/unix/extra_coverage.py.exp | 5 +++++ 3 files changed, 14 insertions(+) create mode 100644 ports/unix/variants/coverage/frzmpy/frzmpy3.py diff --git a/ports/unix/variants/coverage/frzmpy/frzmpy3.py b/ports/unix/variants/coverage/frzmpy/frzmpy3.py new file mode 100644 index 0000000000..617fac5523 --- /dev/null +++ b/ports/unix/variants/coverage/frzmpy/frzmpy3.py @@ -0,0 +1,6 @@ +# Test freezing objects that may not be handled well by the build process. + +print("\\") +print("\nX") +print(repr("\x1b")) +print(b"\x00\xff") diff --git a/tests/unix/extra_coverage.py b/tests/unix/extra_coverage.py index 8ea27cbf2f..bb22485026 100644 --- a/tests/unix/extra_coverage.py +++ b/tests/unix/extra_coverage.py @@ -89,6 +89,9 @@ try: except ZeroDivisionError: print("ZeroDivisionError") +# test importing various objects +import frzmpy3 + # test for MP_QSTR_NULL regression from frzqstr import returns_NULL diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index 8ee233a712..1a5a2cde85 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -174,4 +174,9 @@ frzstr_pkg2.mod frzmpy_pkg2.mod 1 ZeroDivisionError +\ + +X +'\x1b' +b'\x00\xff' NULL From 8626dcd6238e6a85a366f64dccf33724142653b6 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 28 Feb 2022 18:54:10 +1100 Subject: [PATCH 0170/1712] tools/ci.sh: Run performance benchmark as part of all unix test runs. This tests that the performance benchmarks run without error. Signed-off-by: Damien George --- .github/workflows/ports_unix.yml | 2 -- tools/ci.sh | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ports_unix.yml b/.github/workflows/ports_unix.yml index 4e75172b64..dbd213cdff 100644 --- a/.github/workflows/ports_unix.yml +++ b/.github/workflows/ports_unix.yml @@ -45,8 +45,6 @@ jobs: run: source tools/ci.sh && ci_unix_standard_build - name: Run main test suite run: source tools/ci.sh && ci_unix_standard_run_tests - - name: Run performance benchmarks - run: source tools/ci.sh && ci_unix_standard_run_perfbench - name: Print failures if: failure() run: tests/run-tests.py --print-failures diff --git a/tools/ci.sh b/tools/ci.sh index 4ae21859db..dee4b387bf 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -385,6 +385,7 @@ function ci_unix_run_tests_full_helper { fi make -C ports/unix VARIANT=$variant "$@" test_full (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/$micropython ./run-multitests.py multi_net/*.py) + (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/$micropython ./run-perfbench.py 1000 1000) } function ci_native_mpy_modules_build { @@ -424,10 +425,6 @@ function ci_unix_standard_run_tests { ci_unix_run_tests_full_helper standard } -function ci_unix_standard_run_perfbench { - (cd tests && MICROPY_CPYTHON3=python3 MICROPY_MICROPYTHON=../ports/unix/micropython ./run-perfbench.py 1000 1000) -} - function ci_unix_dev_build { ci_unix_build_helper VARIANT=dev } From 3c2aa5ff93a3b12723c7ca794aa9c583891c349b Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 28 Feb 2022 18:58:54 +1100 Subject: [PATCH 0171/1712] unix/.gitignore: Remove *.py from ignore list. .py files are valid source files and shouldn't be ignored. This line was from the early days when .py files in the unix directory were used for testing. Signed-off-by: Damien George --- ports/unix/.gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/unix/.gitignore b/ports/unix/.gitignore index 6745218688..3ca8f6cb27 100644 --- a/ports/unix/.gitignore +++ b/ports/unix/.gitignore @@ -1,4 +1,3 @@ micropython micropython-* -*.py *.gcov From 795370ca23ac8b0f3589ec1d4b34d3d7f3b175eb Mon Sep 17 00:00:00 2001 From: stijn Date: Mon, 28 Feb 2022 10:20:47 +0100 Subject: [PATCH 0172/1712] py/bc.h: Fix C++ compilation of public API. Casts between unrelated types must be explicit. Regression in f2040bfc7ee033e48acef9f289790f3b4e6b74e5 --- py/bc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py/bc.h b/py/bc.h index 7d761e30e6..5710f4d243 100644 --- a/py/bc.h +++ b/py/bc.h @@ -287,8 +287,8 @@ static inline void mp_module_context_alloc_tables(mp_module_context_t *context, size_t nq = (n_qstr * sizeof(qstr_short_t) + sizeof(mp_uint_t) - 1) / sizeof(mp_uint_t); size_t no = n_obj; mp_uint_t *mem = m_new(mp_uint_t, nq + no); - context->constants.qstr_table = (void *)(mem); - context->constants.obj_table = (void *)(mem + nq); + context->constants.qstr_table = (qstr_short_t *)mem; + context->constants.obj_table = (mp_obj_t *)(mem + nq); #else if (n_obj == 0) { context->constants.obj_table = NULL; From 2d47020e15b82b7f021e0b52dabe75baf5cb4c4d Mon Sep 17 00:00:00 2001 From: YoungJoon Chun Date: Wed, 16 Feb 2022 18:47:05 +0900 Subject: [PATCH 0173/1712] rp2/mpthreadport: Fix memory corruption when thread is created in core1. The stack (and arg) of core1 is itself a root pointer, not just the entries in it. Without this fix the GC could reclaim the entire stack (and argument object). Fixes issues #7124 and #7981. --- ports/rp2/mpthreadport.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ports/rp2/mpthreadport.c b/ports/rp2/mpthreadport.c index 8a36cfca75..cdb5945d21 100644 --- a/ports/rp2/mpthreadport.c +++ b/ports/rp2/mpthreadport.c @@ -52,12 +52,12 @@ void mp_thread_deinit(void) { } void mp_thread_gc_others(void) { - if (get_core_num() == 0) { - // GC running on core0, trace core1's stack, if it's running. - if (core1_entry != NULL) { - gc_collect_root((void **)core1_stack, core1_stack_num_words); - } - } else { + if (core1_entry != NULL) { + // Collect core1's stack if it is active. + gc_collect_root((void **)&core1_stack, 1); + gc_collect_root((void **)&core1_arg, 1); + } + if (get_core_num() == 1) { // GC running on core1, trace core0's stack. gc_collect_root((void **)&__StackBottom, (&__StackTop - &__StackBottom) / sizeof(uintptr_t)); } From 2cc9232781d818b8a317dc7b173ecd5b752867e7 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Thu, 24 Feb 2022 14:20:56 +1100 Subject: [PATCH 0174/1712] esp32/uart: Correctly init low-level UART driver for REPL. uart_driver_install() needs to be called to set up the UART correctly. --- ports/esp32/main.c | 2 +- ports/esp32/mphalport.c | 15 ++----------- ports/esp32/uart.c | 49 ++++++++++++++++++++++++++++++++++++++--- ports/esp32/uart.h | 3 ++- 4 files changed, 51 insertions(+), 18 deletions(-) diff --git a/ports/esp32/main.c b/ports/esp32/main.c index 6c5edbb356..a1c27c0a26 100644 --- a/ports/esp32/main.c +++ b/ports/esp32/main.c @@ -93,7 +93,7 @@ void mp_task(void *pvParameter) { #elif CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG usb_serial_jtag_init(); #else - uart_init(); + uart_stdout_init(); #endif machine_init(); diff --git a/ports/esp32/mphalport.c b/ports/esp32/mphalport.c index de1b173ac4..15a8dce1f3 100644 --- a/ports/esp32/mphalport.c +++ b/ports/esp32/mphalport.c @@ -33,16 +33,6 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" -#if CONFIG_IDF_TARGET_ESP32 -#include "esp32/rom/uart.h" -#elif CONFIG_IDF_TARGET_ESP32C3 -#include "esp32c3/rom/uart.h" -#elif CONFIG_IDF_TARGET_ESP32S2 -#include "esp32s2/rom/uart.h" -#elif CONFIG_IDF_TARGET_ESP32S3 -#include "esp32s3/rom/uart.h" -#endif - #include "py/obj.h" #include "py/objstr.h" #include "py/stream.h" @@ -54,6 +44,7 @@ #include "mphalport.h" #include "usb.h" #include "usb_serial_jtag.h" +#include "uart.h" TaskHandle_t mp_main_task_handle; @@ -122,9 +113,7 @@ void mp_hal_stdout_tx_strn(const char *str, size_t len) { #elif CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG usb_serial_jtag_tx_strn(str, len); #else - for (uint32_t i = 0; i < len; ++i) { - uart_tx_one_char(str[i]); - } + uart_stdout_tx_strn(str, len); #endif if (release_gil) { MP_THREAD_GIL_ENTER(); diff --git a/ports/esp32/uart.c b/ports/esp32/uart.c index 58fc0c6c61..ca4ac67cde 100644 --- a/ports/esp32/uart.c +++ b/ports/esp32/uart.c @@ -33,13 +33,56 @@ #include "py/runtime.h" #include "py/mphal.h" +#include "uart.h" + +#ifndef MICROPY_HW_UART_REPL +#define MICROPY_HW_UART_REPL (UART_NUM_0) +#endif + +#ifndef MICROPY_HW_UART_REPL_BAUD +#define MICROPY_HW_UART_REPL_BAUD (115200) +#endif STATIC void uart_irq_handler(void *arg); -void uart_init(void) { +void uart_stdout_init(void) { + uart_config_t uartcfg = { + .baud_rate = MICROPY_HW_UART_REPL_BAUD, + .data_bits = UART_DATA_8_BITS, + .parity = UART_PARITY_DISABLE, + .stop_bits = UART_STOP_BITS_1, + .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, + .rx_flow_ctrl_thresh = 0 + }; + uart_param_config(MICROPY_HW_UART_REPL, &uartcfg); + + const uint32_t rxbuf = 129; // IDF requires > 128 min + const uint32_t txbuf = 0; + + uart_driver_install(MICROPY_HW_UART_REPL, rxbuf, txbuf, 0, NULL, 0); + uart_isr_handle_t handle; - uart_isr_register(UART_NUM_0, uart_irq_handler, NULL, ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_IRAM, &handle); - uart_enable_rx_intr(UART_NUM_0); + uart_isr_free(MICROPY_HW_UART_REPL); + uart_isr_register(MICROPY_HW_UART_REPL, uart_irq_handler, NULL, ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_IRAM, &handle); + uart_enable_rx_intr(MICROPY_HW_UART_REPL); +} + +int uart_stdout_tx_strn(const char *str, size_t len) { + size_t remaining = len; + // TODO add a timeout + for (;;) { + int ret = uart_tx_chars(MICROPY_HW_UART_REPL, str, remaining); + if (ret == -1) { + return -1; + } + remaining -= ret; + if (remaining <= 0) { + break; + } + str += ret; + ulTaskNotifyTake(pdFALSE, 1); + } + return len - remaining; } // all code executed in ISR must be in IRAM, and any const data must be in DRAM diff --git a/ports/esp32/uart.h b/ports/esp32/uart.h index 264c8b8949..439be521c4 100644 --- a/ports/esp32/uart.h +++ b/ports/esp32/uart.h @@ -28,6 +28,7 @@ #ifndef MICROPY_INCLUDED_ESP32_UART_H #define MICROPY_INCLUDED_ESP32_UART_H -void uart_init(void); +void uart_stdout_init(void); +int uart_stdout_tx_strn(const char *str, size_t len); #endif // MICROPY_INCLUDED_ESP32_UART_H From 919e586e46af67e7eaa819b0f187b600a3165526 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Thu, 24 Feb 2022 14:30:50 +1100 Subject: [PATCH 0175/1712] esp32/machine_uart: Allow limited configuration of REPL UART. Some applications may want to adjust the hard coded 115200 REPL buadrate, and this commit allows it to be changed dynamically via machine.UART(0). --- ports/esp32/machine_uart.c | 26 ++++++++++++++------------ ports/esp32/uart.c | 8 -------- ports/esp32/uart.h | 8 ++++++++ 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/ports/esp32/machine_uart.c b/ports/esp32/machine_uart.c index 3c90a72150..aa8d494ec8 100644 --- a/ports/esp32/machine_uart.c +++ b/ports/esp32/machine_uart.c @@ -35,6 +35,7 @@ #include "py/stream.h" #include "py/mperrno.h" #include "modmachine.h" +#include "uart.h" #if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 1, 0) #define UART_INV_TX UART_INVERSE_TXD @@ -151,6 +152,10 @@ STATIC void machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, co if (args[ARG_txbuf].u_int >= 0 || args[ARG_rxbuf].u_int >= 0) { // must reinitialise driver to change the tx/rx buffer size + if (self->uart_num == MICROPY_HW_UART_REPL) { + mp_raise_ValueError(MP_ERROR_TEXT("UART buffer size is fixed")); + } + if (args[ARG_txbuf].u_int >= 0) { self->txbuf = args[ARG_txbuf].u_int; } @@ -291,12 +296,6 @@ STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("UART(%d) does not exist"), uart_num); } - // Attempts to use UART0 from Python has resulted in all sorts of fun errors. - // FIXME: UART0 is disabled for now. - if (uart_num == UART_NUM_0) { - mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("UART(%d) is disabled (dedicated to REPL)"), uart_num); - } - // Defaults uart_config_t uartcfg = { .baud_rate = 115200, @@ -338,14 +337,17 @@ STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, #endif } - // Remove any existing configuration - uart_driver_delete(self->uart_num); + // Only reset the driver if it's not the REPL UART. + if (uart_num != MICROPY_HW_UART_REPL) { + // Remove any existing configuration + uart_driver_delete(self->uart_num); - // init the peripheral - // Setup - uart_param_config(self->uart_num, &uartcfg); + // init the peripheral + // Setup + uart_param_config(self->uart_num, &uartcfg); - uart_driver_install(uart_num, self->rxbuf, self->txbuf, 0, NULL, 0); + uart_driver_install(uart_num, self->rxbuf, self->txbuf, 0, NULL, 0); + } mp_map_t kw_args; mp_map_init_fixed_table(&kw_args, n_kw, args + n_args); diff --git a/ports/esp32/uart.c b/ports/esp32/uart.c index ca4ac67cde..f6493dc796 100644 --- a/ports/esp32/uart.c +++ b/ports/esp32/uart.c @@ -35,14 +35,6 @@ #include "py/mphal.h" #include "uart.h" -#ifndef MICROPY_HW_UART_REPL -#define MICROPY_HW_UART_REPL (UART_NUM_0) -#endif - -#ifndef MICROPY_HW_UART_REPL_BAUD -#define MICROPY_HW_UART_REPL_BAUD (115200) -#endif - STATIC void uart_irq_handler(void *arg); void uart_stdout_init(void) { diff --git a/ports/esp32/uart.h b/ports/esp32/uart.h index 439be521c4..f32d5cf342 100644 --- a/ports/esp32/uart.h +++ b/ports/esp32/uart.h @@ -28,6 +28,14 @@ #ifndef MICROPY_INCLUDED_ESP32_UART_H #define MICROPY_INCLUDED_ESP32_UART_H +#ifndef MICROPY_HW_UART_REPL +#define MICROPY_HW_UART_REPL (UART_NUM_0) +#endif + +#ifndef MICROPY_HW_UART_REPL_BAUD +#define MICROPY_HW_UART_REPL_BAUD (115200) +#endif + void uart_stdout_init(void); int uart_stdout_tx_strn(const char *str, size_t len); From 665f0e2a68dfa4944f60e85a00d0543bb3d7fee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20de=20Giessen?= Date: Wed, 23 Feb 2022 17:28:32 +0100 Subject: [PATCH 0176/1712] esp32: Sleep one tick in MICROPY_EVENT_POLL_HOOK. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If MicroPython threads are enabled, loops waiting for an incoming event should release the GIL and suspend, allowing other tasks to run while they wait. Prior to this commit, the problem can easily be observed by running a thread that is both busy and regularly releases the GIL (for example a loop doing something then sleeping a few ms after each iteration). When the main task is at the REPL, the thread is significantly stalled. If the main task is manually made to release the GIL (for example, by calling utime.sleep_ms(500)) the other thread can be seen immediately working at the expected speed again. Additionally, there are various instances in where blocking functions run MICROPY_EVENT_POLL_HOOK in a loop while they wait for a certain event/ condition. For example the uselect methods poll objects to determine whether data is available, but uses 100% of CPU while it does, constantly calling MICROPY_EVENT_POLL_HOOK in the process. The MICROPY_EVENT_POLL_HOOK macro is only ever used in waiting loops, where (if threads are enabled) it makes sense to yield for a single tick so that these loops do not consume all CPU cycles but instead other threads may execute. (In fact, the thing these loops wait for may even indirectly or directly depend on another task being able to run.) This change moves the sleep that was inside the REPL input function to inside the MICROPY_EVENT_POLL_HOOK macro, where the GIL is already being released, solving both the blocking REPL issue and the 100% CPU use issue at the same time. Signed-off-by: Daniël van de Giessen --- ports/esp32/mpconfigport.h | 1 + ports/esp32/mphalport.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h index 1ea19ada01..d4f542f668 100644 --- a/ports/esp32/mpconfigport.h +++ b/ports/esp32/mpconfigport.h @@ -195,6 +195,7 @@ void *esp_native_code_commit(void *, size_t, void *); mp_handle_pending(true); \ MICROPY_PY_USOCKET_EVENTS_HANDLER \ MP_THREAD_GIL_EXIT(); \ + ulTaskNotifyTake(pdFALSE, 1); \ MP_THREAD_GIL_ENTER(); \ } while (0); #else diff --git a/ports/esp32/mphalport.c b/ports/esp32/mphalport.c index 15a8dce1f3..41e6e6ec00 100644 --- a/ports/esp32/mphalport.c +++ b/ports/esp32/mphalport.c @@ -98,7 +98,6 @@ int mp_hal_stdin_rx_chr(void) { return c; } MICROPY_EVENT_POLL_HOOK - ulTaskNotifyTake(pdFALSE, 1); } } From 55a0125a154a9c13363d900e0caccd218bce0a54 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Sun, 27 Feb 2022 15:22:21 +0100 Subject: [PATCH 0177/1712] esp32/machine_pwm: Always set the duty cycle when setting the frequency. If setting the frequency to a value used already by an existing timer, this timer will be used. But still, the duty cycle for that channel may have to be changed. Fixes issues #8306 and #8345. --- ports/esp32/machine_pwm.c | 58 +++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 23 deletions(-) mode change 100755 => 100644 ports/esp32/machine_pwm.c diff --git a/ports/esp32/machine_pwm.c b/ports/esp32/machine_pwm.c old mode 100755 new mode 100644 index 9308fcd3cb..5baaa693c6 --- a/ports/esp32/machine_pwm.c +++ b/ports/esp32/machine_pwm.c @@ -74,7 +74,8 @@ STATIC ledc_timer_config_t timers[PWM_TIMER_MAX]; // Params for PWM operation // 5khz is default frequency #define PWM_FREQ (5000) -// default 10-bit resolution (compatible with esp8266 PWM) + +// 10-bit resolution (compatible with esp8266 PWM) #define PWM_RES_10_BIT (LEDC_TIMER_10_BIT) // Maximum duty value on 10-bit resolution @@ -84,15 +85,17 @@ STATIC ledc_timer_config_t timers[PWM_TIMER_MAX]; // duty_u16() and duty_ns() use 16-bit resolution or less // Possible highest resolution in device -#if CONFIG_IDF_TARGET_ESP32 -#define HIGHEST_PWM_RES (LEDC_TIMER_16_BIT) // 20 bit for ESP32, but 16 bit is used +#if (LEDC_TIMER_BIT_MAX - 1) < LEDC_TIMER_16_BIT +#define HIGHEST_PWM_RES (LEDC_TIMER_BIT_MAX - 1) #else -#define HIGHEST_PWM_RES (LEDC_TIMER_BIT_MAX - 1) // 14 bit is used +#define HIGHEST_PWM_RES (LEDC_TIMER_16_BIT) // 20 bit for ESP32, but 16 bit is used #endif // Duty resolution of user interface in `duty_u16()` and `duty_u16` parameter in constructor/initializer #define UI_RES_16_BIT (16) // Maximum duty value on highest user interface resolution #define UI_MAX_DUTY ((1 << UI_RES_16_BIT) - 1) +// How much to shift from the HIGHEST_PWM_RES duty resolution to the user interface duty resolution UI_RES_16_BIT +#define UI_RES_SHIFT (UI_RES_16_BIT - HIGHEST_PWM_RES) // 0 for ESP32, 2 for S2, S3, C3 // If the PWM frequency is less than EMPIRIC_FREQ, then LEDC_REF_CLK_HZ(1 MHz) source is used, else LEDC_APB_CLK_HZ(80 MHz) source is used #define EMPIRIC_FREQ (10) // Hz @@ -108,7 +111,7 @@ typedef struct _machine_pwm_obj_t { int mode; int channel; int timer; - int duty_x; // PWM_RES_10_BIT if duty(), UI_RES_16_BIT if duty_u16(), -UI_RES_16_BIT if duty_ns() + int duty_x; // PWM_RES_10_BIT if duty(), HIGHEST_PWM_RES if duty_u16(), -HIGHEST_PWM_RES if duty_ns() int duty_u10; // stored values from previous duty setters int duty_u16; // - / - int duty_ns; // - / - @@ -237,7 +240,6 @@ STATIC void set_freq(machine_pwm_obj_t *self, unsigned int freq, ledc_timer_conf } // Configure the new resolution and frequency - unsigned int save_duty_resolution = timer->duty_resolution; timer->duty_resolution = res; timer->freq_hz = freq; timer->clk_cfg = LEDC_USE_APB_CLK; @@ -258,17 +260,15 @@ STATIC void set_freq(machine_pwm_obj_t *self, unsigned int freq, ledc_timer_conf if (self->mode == LEDC_LOW_SPEED_MODE) { check_esp_err(ledc_timer_rst(self->mode, self->timer)); } + } - // Save the same duty cycle when frequency is changed - if (save_duty_resolution != timer->duty_resolution) { - if (self->duty_x == UI_RES_16_BIT) { - set_duty_u16(self, self->duty_u16); - } else if (self->duty_x == PWM_RES_10_BIT) { - set_duty_u10(self, self->duty_u10); - } else if (self->duty_x == -UI_RES_16_BIT) { - set_duty_ns(self, self->duty_ns); - } - } + // Save the same duty cycle when frequency is changed + if (self->duty_x == HIGHEST_PWM_RES) { + set_duty_u16(self, self->duty_u16); + } else if (self->duty_x == PWM_RES_10_BIT) { + set_duty_u10(self, self->duty_u10); + } else if (self->duty_x == -HIGHEST_PWM_RES) { + set_duty_ns(self, self->duty_ns); } } @@ -293,11 +293,18 @@ STATIC int duty_to_ns(machine_pwm_obj_t *self, int duty) { #define get_duty_raw(self) ledc_get_duty(self->mode, self->channel) STATIC uint32_t get_duty_u16(machine_pwm_obj_t *self) { - return ledc_get_duty(self->mode, self->channel) << (UI_RES_16_BIT - timers[TIMER_IDX(self->mode, self->timer)].duty_resolution); + int resolution = timers[TIMER_IDX(self->mode, self->timer)].duty_resolution; + int duty = ledc_get_duty(self->mode, self->channel); + if (resolution <= UI_RES_16_BIT) { + duty <<= (UI_RES_16_BIT - resolution); + } else { + duty >>= (resolution - UI_RES_16_BIT); + } + return duty; } STATIC uint32_t get_duty_u10(machine_pwm_obj_t *self) { - return get_duty_u16(self) >> (UI_RES_16_BIT - LEDC_TIMER_10_BIT); + return get_duty_u16(self) >> 6; // Scale down from 16 bit to 10 bit resolution } STATIC uint32_t get_duty_ns(machine_pwm_obj_t *self) { @@ -309,7 +316,12 @@ STATIC void set_duty_u16(machine_pwm_obj_t *self, int duty) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("duty_u16 must be from 0 to %d"), UI_MAX_DUTY); } ledc_timer_config_t timer = timers[TIMER_IDX(self->mode, self->timer)]; - int channel_duty = duty >> (UI_RES_16_BIT - timer.duty_resolution); + int channel_duty; + if (timer.duty_resolution <= UI_RES_16_BIT) { + channel_duty = duty >> (UI_RES_16_BIT - timer.duty_resolution); + } else { + channel_duty = duty << (timer.duty_resolution - UI_RES_16_BIT); + } int max_duty = (1 << timer.duty_resolution) - 1; if (channel_duty < 0) { channel_duty = 0; @@ -333,7 +345,7 @@ STATIC void set_duty_u16(machine_pwm_obj_t *self, int duty) { } */ - self->duty_x = UI_RES_16_BIT; + self->duty_x = HIGHEST_PWM_RES; self->duty_u16 = duty; } @@ -341,7 +353,7 @@ STATIC void set_duty_u10(machine_pwm_obj_t *self, int duty) { if ((duty < 0) || (duty > MAX_DUTY_U10)) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("duty must be from 0 to %u"), MAX_DUTY_U10); } - set_duty_u16(self, duty << (UI_RES_16_BIT - LEDC_TIMER_10_BIT)); + set_duty_u16(self, duty << (UI_RES_16_BIT - PWM_RES_10_BIT)); self->duty_x = PWM_RES_10_BIT; self->duty_u10 = duty; } @@ -351,7 +363,7 @@ STATIC void set_duty_ns(machine_pwm_obj_t *self, int ns) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("duty_ns must be from 0 to %d ns"), duty_to_ns(self, UI_MAX_DUTY)); } set_duty_u16(self, ns_to_duty(self, ns)); - self->duty_x = -UI_RES_16_BIT; + self->duty_x = -HIGHEST_PWM_RES; self->duty_ns = ns; } @@ -424,7 +436,7 @@ STATIC void mp_machine_pwm_print(const mp_print_t *print, mp_obj_t self_in, mp_p if (self->duty_x == PWM_RES_10_BIT) { mp_printf(print, ", duty=%d", get_duty_u10(self)); - } else if (self->duty_x == -UI_RES_16_BIT) { + } else if (self->duty_x == -HIGHEST_PWM_RES) { mp_printf(print, ", duty_ns=%d", get_duty_ns(self)); } else { mp_printf(print, ", duty_u16=%d", get_duty_u16(self)); From d696d9141e29da524fc78a1044f90a6e9107892f Mon Sep 17 00:00:00 2001 From: robert-hh Date: Sun, 27 Feb 2022 18:09:41 +0100 Subject: [PATCH 0178/1712] esp32/machine_uart: Make UART.init preserve unspecified parameters. Most of the settings behaved that way, except for baudate, timeout, timout_char, invert and flow. --- ports/esp32/machine_uart.c | 42 +++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/ports/esp32/machine_uart.c b/ports/esp32/machine_uart.c index aa8d494ec8..396455666f 100644 --- a/ports/esp32/machine_uart.c +++ b/ports/esp32/machine_uart.c @@ -139,10 +139,10 @@ STATIC void machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, co { MP_QSTR_cts, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = UART_PIN_NO_CHANGE} }, { MP_QSTR_txbuf, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, { MP_QSTR_rxbuf, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, - { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, - { MP_QSTR_timeout_char, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, - { MP_QSTR_invert, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, - { MP_QSTR_flow, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, + { MP_QSTR_timeout_char, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, + { MP_QSTR_invert, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, + { MP_QSTR_flow, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, }; 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); @@ -181,8 +181,8 @@ STATIC void machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, co uint32_t baudrate = 115200; if (args[ARG_baudrate].u_int > 0) { uart_set_baudrate(self->uart_num, args[ARG_baudrate].u_int); - uart_get_baudrate(self->uart_num, &baudrate); } + uart_get_baudrate(self->uart_num, &baudrate); uart_set_pin(self->uart_num, args[ARG_tx].u_int, args[ARG_rx].u_int, args[ARG_rts].u_int, args[ARG_cts].u_int); if (args[ARG_tx].u_int != UART_PIN_NO_CHANGE) { @@ -262,28 +262,36 @@ STATIC void machine_uart_init_helper(machine_uart_obj_t *self, size_t n_args, co } // set timeout - self->timeout = args[ARG_timeout].u_int; + if (args[ARG_timeout].u_int != -1) { + self->timeout = args[ARG_timeout].u_int; + } // set timeout_char // make sure it is at least as long as a whole character (13 bits to be safe) - self->timeout_char = args[ARG_timeout_char].u_int; - uint32_t min_timeout_char = 13000 / baudrate + 1; - if (self->timeout_char < min_timeout_char) { - self->timeout_char = min_timeout_char; + if (args[ARG_timeout_char].u_int != -1) { + self->timeout_char = args[ARG_timeout_char].u_int; + uint32_t min_timeout_char = 13000 / baudrate + 1; + if (self->timeout_char < min_timeout_char) { + self->timeout_char = min_timeout_char; + } } // set line inversion - if (args[ARG_invert].u_int & ~UART_INV_MASK) { - mp_raise_ValueError(MP_ERROR_TEXT("invalid inversion mask")); + if (args[ARG_invert].u_int != -1) { + if (args[ARG_invert].u_int & ~UART_INV_MASK) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid inversion mask")); + } + self->invert = args[ARG_invert].u_int; } - self->invert = args[ARG_invert].u_int; uart_set_line_inverse(self->uart_num, self->invert); // set hardware flow control - if (args[ARG_flow].u_int & ~UART_HW_FLOWCTRL_CTS_RTS) { - mp_raise_ValueError(MP_ERROR_TEXT("invalid flow control mask")); + if (args[ARG_flow].u_int != -1) { + if (args[ARG_flow].u_int & ~UART_HW_FLOWCTRL_CTS_RTS) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid flow control mask")); + } + self->flowcontrol = args[ARG_flow].u_int; } - self->flowcontrol = args[ARG_flow].u_int; uart_set_hw_flow_ctrl(self->uart_num, self->flowcontrol, UART_FIFO_LEN - UART_FIFO_LEN / 4); } @@ -319,6 +327,8 @@ STATIC mp_obj_t machine_uart_make_new(const mp_obj_type_t *type, size_t n_args, self->rxbuf = 256; // IDF minimum self->timeout = 0; self->timeout_char = 0; + self->invert = 0; + self->flowcontrol = 0; switch (uart_num) { case UART_NUM_0: From 5d9171b5ccf154a4c7c5f8e152ea4fd75a5f33a5 Mon Sep 17 00:00:00 2001 From: Jan Date: Thu, 3 Mar 2022 13:49:06 +0100 Subject: [PATCH 0179/1712] docs/library/machine.UART.rst: Add details for `invert` parameter. --- docs/library/machine.UART.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/library/machine.UART.rst b/docs/library/machine.UART.rst index 8fb42cfe87..e239525736 100644 --- a/docs/library/machine.UART.rst +++ b/docs/library/machine.UART.rst @@ -63,6 +63,12 @@ Methods - *timeout* specifies the time to wait for the first character (in ms). - *timeout_char* specifies the time to wait between characters (in ms). - *invert* specifies which lines to invert. + + - ``0`` will not invert lines (idle state of both lines is logic high). + - ``UART.INV_TX`` will invert TX line (idle state of TX line now logic low). + - ``UART.INV_RX`` will invert RX line (idle state of RX line now logic low). + - ``UART.INV_TX | UART.INV_RX`` will invert both lines (idle state at logic low). + - *flow* specifies which hardware flow control signals to use. The value is a bitmask. From eadc927baff938a7f561fe69e09a27f11514f96e Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sat, 5 Mar 2022 09:51:34 -0600 Subject: [PATCH 0180/1712] docs/differences/python_35: Mark PEP 486 as not applicable. This adds the "Not relevant" designation to PEP 486 since it has to do with the Python Launcher for Windows and not the Python language itself. Also fix a typo while we are touching this line. Signed-off-by: David Lechner --- docs/differences/python_35.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/differences/python_35.rst b/docs/differences/python_35.rst index 2a4c119a45..e88df25f95 100644 --- a/docs/differences/python_35.rst +++ b/docs/differences/python_35.rst @@ -33,7 +33,7 @@ Below is a list of finalised/accepted PEPs for Python 3.5 grouped into their imp +--------------------------------------------------------+-------------------------------------------------+---------------+ | `PEP 441 `_ | improved Python zip application support | | +--------------------------------------------------------+-------------------------------------------------+---------------+ - | `PEP 486 `_ | make the Python Laucher aware of virtual | | + | `PEP 486 `_ | make the Python Launcher aware of virtual | Not relevant | | | environments | | +--------------------------------------------------------+-------------------------------------------------+---------------+ | `PEP 484 `_ | type hints (advisory only) | In Progress | From bb2bd071f74c04237618958521e58d48d2dc35d4 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 7 Mar 2022 15:15:45 +1100 Subject: [PATCH 0181/1712] docs/library/esp32.rst: Mark esp32.Partition as not taking kw args. Fixes issue #8380. Signed-off-by: Damien George --- docs/library/esp32.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/library/esp32.rst b/docs/library/esp32.rst index 82e69e4964..da5fa8c3cb 100644 --- a/docs/library/esp32.rst +++ b/docs/library/esp32.rst @@ -68,7 +68,7 @@ Flash partitions This class gives access to the partitions in the device's flash memory and includes methods to enable over-the-air (OTA) updates. -.. class:: Partition(id, block_size=4096) +.. class:: Partition(id, block_size=4096, /) Create an object representing a partition. *id* can be a string which is the label of the partition to retrieve, or one of the constants: ``BOOT`` or ``RUNNING``. From 7cd166ff9244a720a6e72e651215db891dc1f85e Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 7 Mar 2022 12:29:17 +1100 Subject: [PATCH 0182/1712] tests/basics: Add test for creating small-ints in nan-box builds. Signed-off-by: Damien George --- tests/basics/nanbox_smallint.py | 42 +++++++++++++++++++++++++++++ tests/basics/nanbox_smallint.py.exp | 5 ++++ 2 files changed, 47 insertions(+) create mode 100644 tests/basics/nanbox_smallint.py create mode 100644 tests/basics/nanbox_smallint.py.exp diff --git a/tests/basics/nanbox_smallint.py b/tests/basics/nanbox_smallint.py new file mode 100644 index 0000000000..642ca77b37 --- /dev/null +++ b/tests/basics/nanbox_smallint.py @@ -0,0 +1,42 @@ +# Test creating small integers without heap allocation in nan-boxing mode. + +import micropython + +try: + # Test for nan-box build by allocating a float while heap is locked. + # This should pass on nan-box builds. + micropython.heap_lock() + float(123) + micropython.heap_unlock() +except: + print("SKIP") + raise SystemExit + +# Check that nan-boxing uses 64-bit floats (eg it's not object representation C). +if float("1e100") == float("inf"): + print("SKIP") + raise SystemExit + +micropython.heap_lock() +print(int("0x80000000")) +micropython.heap_unlock() + +# This is the most positive small integer. +micropython.heap_lock() +print(int("0x3fffffffffff")) +micropython.heap_unlock() + +# This is the most negative small integer. +micropython.heap_lock() +print(int("-0x3fffffffffff") - 1) +micropython.heap_unlock() + +x = 1 +micropython.heap_lock() +print((x << 31) + 1) +micropython.heap_unlock() + +x = 1 +micropython.heap_lock() +print((x << 45) + 1) +micropython.heap_unlock() diff --git a/tests/basics/nanbox_smallint.py.exp b/tests/basics/nanbox_smallint.py.exp new file mode 100644 index 0000000000..aad1f7b8b6 --- /dev/null +++ b/tests/basics/nanbox_smallint.py.exp @@ -0,0 +1,5 @@ +2147483648 +70368744177663 +-70368744177664 +2147483649 +35184372088833 From bf01671a96b454340a176d27696d575e2a93ad7c Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 7 Mar 2022 16:02:55 +1100 Subject: [PATCH 0183/1712] tools/mpremote: Bump version to 0.2.0. Signed-off-by: Damien George --- tools/mpremote/setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mpremote/setup.cfg b/tools/mpremote/setup.cfg index bb2d0da52e..2bde6a8ebc 100644 --- a/tools/mpremote/setup.cfg +++ b/tools/mpremote/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = mpremote -version = 0.1.0 +version = 0.2.0 author = Damien George author_email = damien@micropython.org description = Tool for interacting remotely with MicroPython From 86a4a526700ad40b2e37e33c7ae08826cff2a6ac Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Fri, 4 Mar 2022 08:32:50 -0600 Subject: [PATCH 0184/1712] zephyr: Update include path to disk_access.h. The disk_access header was moved to a different path in Zephyr v2.6.0. The old path was deprecated for two releases (v2.6.0 and v2.7.0) and will no longer be supported after Zephyr v2.7.0. Signed-off-by: Maureen Helm --- ports/zephyr/zephyr_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/zephyr/zephyr_storage.c b/ports/zephyr/zephyr_storage.c index 1c25b32771..5934f22813 100644 --- a/ports/zephyr/zephyr_storage.c +++ b/ports/zephyr/zephyr_storage.c @@ -32,7 +32,7 @@ #endif #ifdef CONFIG_DISK_ACCESS -#include +#include #endif #ifdef CONFIG_FLASH_MAP From 474d288e55503e135a0d86e6eaa733354583a5f2 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Wed, 2 Mar 2022 20:45:20 -0600 Subject: [PATCH 0185/1712] zephyr: Upgrade to Zephyr v3.0.0. Updates the Zephyr port build instructions and CI to use the latest Zephyr release tag. Signed-off-by: Maureen Helm --- docs/zephyr/tutorial/repl.rst | 4 ++-- ports/zephyr/README.md | 6 +++--- tools/ci.sh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/zephyr/tutorial/repl.rst b/docs/zephyr/tutorial/repl.rst index 71e732e610..6e11c04cb3 100644 --- a/docs/zephyr/tutorial/repl.rst +++ b/docs/zephyr/tutorial/repl.rst @@ -31,8 +31,8 @@ With your serial program open (PuTTY, screen, picocom, etc) you may see a blank screen with a flashing cursor. Press Enter (or reset the board) and you should be presented with the following text:: - *** Booting Zephyr OS build zephyr-v2.7.0 *** - MicroPython v1.17-288-gb695f5a70-dirty on 2022-01-03; zephyr-frdm_k64f with mk64f12 + *** Booting Zephyr OS build zephyr-v3.0.0 *** + MicroPython v1.18-169-g665f0e2a6-dirty on 2022-03-02; zephyr-frdm_k64f with mk64f12 Type "help()" for more information. >>> diff --git a/ports/zephyr/README.md b/ports/zephyr/README.md index 6b1c7ddd5f..6b2b54fa29 100644 --- a/ports/zephyr/README.md +++ b/ports/zephyr/README.md @@ -4,7 +4,7 @@ MicroPython port to Zephyr RTOS This is a work-in-progress port of MicroPython to Zephyr RTOS (http://zephyrproject.org). -This port requires Zephyr version v2.7.0, and may also work on higher +This port requires Zephyr version v3.0.0, and may also work on higher versions. All boards supported by Zephyr (with standard level of features support, like UART console) should work with MicroPython (but not all were tested). @@ -39,13 +39,13 @@ setup is correct. If you already have Zephyr installed but are having issues building the MicroPython port then try installing the correct version of Zephyr via: - $ west init zephyrproject -m https://github.com/zephyrproject-rtos/zephyr --mr v2.7.0 + $ west init zephyrproject -m https://github.com/zephyrproject-rtos/zephyr --mr v3.0.0 Alternatively, you don't have to redo the Zephyr installation to just switch from master to a tagged release, you can instead do: $ cd zephyrproject/zephyr - $ git checkout v2.7.0 + $ git checkout v3.0.0 $ west update With Zephyr installed you may then need to configure your environment, diff --git a/tools/ci.sh b/tools/ci.sh index dee4b387bf..4f6717fe93 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -618,7 +618,7 @@ function ci_windows_build { ZEPHYR_DOCKER_VERSION=v0.21.0 ZEPHYR_SDK_VERSION=0.13.2 -ZEPHYR_VERSION=v2.7.0 +ZEPHYR_VERSION=v3.0.0 function ci_zephyr_setup { docker pull zephyrprojectrtos/ci:${ZEPHYR_DOCKER_VERSION} From cced9a0128a5fba99868b6fa091b26fec3119f54 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 7 Mar 2022 16:43:29 +1100 Subject: [PATCH 0186/1712] zephyr/prj.conf: Enable CONFIG_BUILD_OUTPUT_HEX to generate .hex output. The .hex file contains more information than .bin, useful for flashing. Signed-off-by: Damien George --- ports/zephyr/prj.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/zephyr/prj.conf b/ports/zephyr/prj.conf index b6559e4f73..90211e3657 100644 --- a/ports/zephyr/prj.conf +++ b/ports/zephyr/prj.conf @@ -1,4 +1,5 @@ CONFIG_BUILD_OUTPUT_BIN=y +CONFIG_BUILD_OUTPUT_HEX=y CONFIG_REBOOT=y CONFIG_STDOUT_CONSOLE=y From 9a8ee6a5df8d59d0c88a14d81fe40ad95a31c1e4 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 7 Mar 2022 16:45:40 +1100 Subject: [PATCH 0187/1712] tests/run-tests.py: Include test files ending in _set as set tests. Signed-off-by: Damien George --- tests/run-tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-tests.py b/tests/run-tests.py index f9a16283bc..edd20b9bd5 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -548,7 +548,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): is_endian = test_name.endswith("_endian") is_int_big = test_name.startswith("int_big") or test_name.endswith("_intbig") is_bytearray = test_name.startswith("bytearray") or test_name.endswith("_bytearray") - is_set_type = test_name.startswith("set_") or test_name.startswith("frozenset") + is_set_type = test_name.startswith(("set_", "frozenset")) or test_name.endswith("_set") is_slice = test_name.find("slice") != -1 or test_name in misc_slice_tests is_async = test_name.startswith(("async_", "uasyncio_")) is_const = test_name.startswith("const") From 3440201e2e6861be77aecb1d5069a6cfe4ccc328 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 7 Mar 2022 16:47:33 +1100 Subject: [PATCH 0188/1712] tests/micropython: Switch from set.pop to raise-0 to test exc strings. To not rely on sets, which are an optional feature. Signed-off-by: Damien George --- tests/micropython/heapalloc_exc_compressed.py | 16 +++++++--------- .../micropython/heapalloc_exc_compressed.py.exp | 6 +++--- .../heapalloc_exc_compressed_emg_exc.py | 10 ++++------ .../heapalloc_exc_compressed_emg_exc.py.exp | 4 ++-- 4 files changed, 16 insertions(+), 20 deletions(-) diff --git a/tests/micropython/heapalloc_exc_compressed.py b/tests/micropython/heapalloc_exc_compressed.py index 79e423ca0f..aa071d641c 100644 --- a/tests/micropython/heapalloc_exc_compressed.py +++ b/tests/micropython/heapalloc_exc_compressed.py @@ -5,12 +5,10 @@ import micropython # mp_obj_new_exception_msg (decompression can be deferred) # NameError uses mp_obj_new_exception_msg_varg for NameError("name '%q' isn't defined") -# set.pop uses mp_obj_new_exception_msg for KeyError("pop from an empty set") +# `raise 0` uses mp_obj_new_exception_msg for TypeError("exceptions must derive from BaseException") # Tests that deferred decompression works both via print(e) and accessing the message directly via e.args. -a = set() - # First test the regular case (can use heap for allocating the decompression buffer). try: name() @@ -18,8 +16,8 @@ except NameError as e: print(type(e).__name__, e) try: - a.pop() -except KeyError as e: + raise 0 +except TypeError as e: print(type(e).__name__, e) try: @@ -28,8 +26,8 @@ except NameError as e: print(e.args[0]) try: - a.pop() -except KeyError as e: + raise 0 +except TypeError as e: print(e.args[0]) # Then test that it still works when the heap is locked (i.e. in ISR context). @@ -41,8 +39,8 @@ except NameError as e: print(type(e).__name__) try: - a.pop() -except KeyError as e: + raise 0 +except TypeError as e: print(type(e).__name__) micropython.heap_unlock() diff --git a/tests/micropython/heapalloc_exc_compressed.py.exp b/tests/micropython/heapalloc_exc_compressed.py.exp index 32d1642f86..c3e6e5dd9f 100644 --- a/tests/micropython/heapalloc_exc_compressed.py.exp +++ b/tests/micropython/heapalloc_exc_compressed.py.exp @@ -1,6 +1,6 @@ NameError name 'name' isn't defined -KeyError pop from an empty set +TypeError exceptions must derive from BaseException name 'name' isn't defined -pop from an empty set +exceptions must derive from BaseException NameError -KeyError +TypeError diff --git a/tests/micropython/heapalloc_exc_compressed_emg_exc.py b/tests/micropython/heapalloc_exc_compressed_emg_exc.py index 86ade07862..48ce9dd69e 100644 --- a/tests/micropython/heapalloc_exc_compressed_emg_exc.py +++ b/tests/micropython/heapalloc_exc_compressed_emg_exc.py @@ -9,8 +9,6 @@ try: except AttributeError: pass -a = set() - def test(): micropython.heap_lock() @@ -21,8 +19,8 @@ def test(): print(type(e).__name__, e) try: - a.pop() - except KeyError as e: + raise 0 + except TypeError as e: print(type(e).__name__, e) try: @@ -31,8 +29,8 @@ def test(): print(e.args[0]) try: - a.pop() - except KeyError as e: + raise 0 + except TypeError as e: print(e.args[0]) micropython.heap_unlock() diff --git a/tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp b/tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp index 7c368712a2..1fc8109339 100644 --- a/tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp +++ b/tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp @@ -1,4 +1,4 @@ NameError name 'name' isn't defined -KeyError pop from an empty set +TypeError exceptions must derive from BaseException name 'name' isn't defined -pop from an empty set +exceptions must derive from BaseException From 33083bf52730fa1c238a154685a895b2775cc355 Mon Sep 17 00:00:00 2001 From: Jonathan Hogg Date: Mon, 7 Mar 2022 08:55:48 +0000 Subject: [PATCH 0189/1712] esp32/machine_pin: Add support for pin drive strength. Add support for configuring drive strength of output pins with `drive` keyword argument and `DRIVE_*` constants. --- ports/esp32/machine_pin.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ports/esp32/machine_pin.c b/ports/esp32/machine_pin.c index c0c7ddb705..1dad398524 100644 --- a/ports/esp32/machine_pin.c +++ b/ports/esp32/machine_pin.c @@ -253,13 +253,14 @@ STATIC void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_prin mp_printf(print, "Pin(%u)", self->id); } -// pin.init(mode, pull=None, *, value) +// pin.init(mode=None, pull=-1, *, value, drive) STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_mode, ARG_pull, ARG_value }; + enum { ARG_mode, ARG_pull, ARG_value, ARG_drive }; static const mp_arg_t allowed_args[] = { { MP_QSTR_mode, MP_ARG_OBJ, {.u_obj = mp_const_none}}, { MP_QSTR_pull, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(-1)}}, { MP_QSTR_value, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL}}, + { MP_QSTR_drive, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL}}, }; // parse args @@ -289,6 +290,14 @@ STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_ gpio_set_level(self->id, mp_obj_is_true(args[ARG_value].u_obj)); } + // set drive capability (do this before configuring mode) + if (args[ARG_drive].u_obj != MP_OBJ_NULL && GPIO_IS_VALID_OUTPUT_GPIO(self->id)) { + mp_int_t strength = mp_obj_get_int(args[ARG_drive].u_obj); + if (0 <= strength && strength < GPIO_DRIVE_CAP_MAX) { + gpio_set_drive_capability(self->id, strength); + } + } + // configure mode if (args[ARG_mode].u_obj != mp_const_none) { mp_int_t pin_io_mode = mp_obj_get_int(args[ARG_mode].u_obj); @@ -476,6 +485,10 @@ STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_IRQ_FALLING), MP_ROM_INT(GPIO_PIN_INTR_NEGEDGE) }, { MP_ROM_QSTR(MP_QSTR_WAKE_LOW), MP_ROM_INT(GPIO_PIN_INTR_LOLEVEL) }, { MP_ROM_QSTR(MP_QSTR_WAKE_HIGH), MP_ROM_INT(GPIO_PIN_INTR_HILEVEL) }, + { MP_ROM_QSTR(MP_QSTR_DRIVE_0), MP_ROM_INT(GPIO_DRIVE_CAP_0) }, + { MP_ROM_QSTR(MP_QSTR_DRIVE_1), MP_ROM_INT(GPIO_DRIVE_CAP_1) }, + { MP_ROM_QSTR(MP_QSTR_DRIVE_2), MP_ROM_INT(GPIO_DRIVE_CAP_2) }, + { MP_ROM_QSTR(MP_QSTR_DRIVE_3), MP_ROM_INT(GPIO_DRIVE_CAP_3) }, }; STATIC mp_uint_t pin_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) { From 4c7c80d6266c6362253755c92bf649dc85c47dae Mon Sep 17 00:00:00 2001 From: Jonathan Hogg Date: Mon, 7 Mar 2022 09:03:49 +0000 Subject: [PATCH 0190/1712] docs/esp32/quickref: Document GPIO drive strength. Add brief documentation of the new `drive` keyword argument. --- docs/esp32/quickref.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst index da586819fd..56e765536e 100644 --- a/docs/esp32/quickref.rst +++ b/docs/esp32/quickref.rst @@ -160,6 +160,7 @@ Use the :ref:`machine.Pin ` class:: p4 = Pin(4, Pin.IN, Pin.PULL_UP) # enable internal pull-up resistor p5 = Pin(5, Pin.OUT, value=1) # set pin high on creation + p6 = Pin(6, Pin.OUT, drive=Pin.DRIVE_3) # set maximum drive strength Available Pins are from the following ranges (inclusive): 0-19, 21-23, 25-27, 32-39. These correspond to the actual GPIO pin numbers of ESP32 chip. Note that many @@ -167,6 +168,15 @@ end-user boards use their own adhoc pin numbering (marked e.g. D0, D1, ...). For mapping between board logical pins and physical chip pins consult your board documentation. +Four drive strengths are supported, using the ``drive`` keyword argument to the +``Pin()`` constructor or ``Pin.init()`` method, with different corresponding +safe maximum source/sink currents and approximate internal driver resistances: + + - ``Pin.DRIVE_0``: 5mA / 130 ohm + - ``Pin.DRIVE_1``: 10mA / 60 ohm + - ``Pin.DRIVE_2``: 20mA / 30 ohm (default strength if not configured) + - ``Pin.DRIVE_3``: 40mA / 15 ohm + Notes: * Pins 1 and 3 are REPL UART TX and RX respectively From 3ebc370344ce5583b8615881a80749f855622aa5 Mon Sep 17 00:00:00 2001 From: Jonathan Hogg Date: Mon, 7 Mar 2022 09:03:54 +0000 Subject: [PATCH 0191/1712] docs/library/machine.Pin: Update to use preferred DRIVE_x constants. Update documents with new common names for the drive strength constants. --- docs/library/machine.Pin.rst | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/docs/library/machine.Pin.rst b/docs/library/machine.Pin.rst index f80de11784..49fb66beb3 100644 --- a/docs/library/machine.Pin.rst +++ b/docs/library/machine.Pin.rst @@ -87,9 +87,9 @@ Constructors output pin value if given, otherwise the state of the pin peripheral remains unchanged. - - ``drive`` specifies the output power of the pin and can be one of: ``Pin.LOW_POWER``, - ``Pin.MED_POWER`` or ``Pin.HIGH_POWER``. The actual current driving capabilities - are port dependent. Not all ports implement this argument. + - ``drive`` specifies the output power of the pin and can be one of: ``Pin.DRIVE_0``, + ``Pin.DRIVE_1``, etc., increasing in drive strength. The actual current driving + capabilities are port dependent. Not all ports implement this argument. - ``alt`` specifies an alternate function for the pin and the values it can take are port dependent. This argument is valid only for ``Pin.ALT`` and ``Pin.ALT_OPEN_DRAIN`` @@ -260,11 +260,13 @@ not all constants are available on all ports. Selects whether there is a pull up/down resistor. Use the value ``None`` for no pull. -.. data:: Pin.LOW_POWER - Pin.MED_POWER - Pin.HIGH_POWER +.. data:: Pin.DRIVE_0 + Pin.DRIVE_1 + Pin.DRIVE_2 - Selects the pin drive strength. + Selects the pin drive strength. A port may define additional drive + constants with increasing number corresponding to increasing drive + strength. .. data:: Pin.IRQ_FALLING Pin.IRQ_RISING From 62cb2069bb107f32efedcd59481de6373c854db1 Mon Sep 17 00:00:00 2001 From: Philipp Ebensberger Date: Mon, 7 Mar 2022 16:56:14 +0100 Subject: [PATCH 0192/1712] mimxrt/machine_pin: Change pin drive constants to DRIVE_x naming. Updated DRIVE_x constants representing pin drive strength. Signed-off-by: Philipp Ebensberger --- ports/mimxrt/eth.c | 4 ++-- ports/mimxrt/machine_pin.c | 18 +++++++++--------- ports/mimxrt/machine_pwm.c | 4 ++-- ports/mimxrt/machine_uart.c | 4 ++-- ports/mimxrt/pin.c | 2 +- ports/mimxrt/pin.h | 28 ++++++++++++++-------------- ports/mimxrt/sdcard.c | 6 +++--- 7 files changed, 33 insertions(+), 33 deletions(-) diff --git a/ports/mimxrt/eth.c b/ports/mimxrt/eth.c index 5a5138443c..af0264d085 100644 --- a/ports/mimxrt/eth.c +++ b/ports/mimxrt/eth.c @@ -195,7 +195,7 @@ void eth_init(eth_t *self, int mac_idx, const phy_operations_t *phy_ops, int phy IOMUXC_SetPinMux(reset_pin->muxRegister, af_obj->af_mode, 0, 0, reset_pin->configRegister, 0U); IOMUXC_SetPinConfig(reset_pin->muxRegister, af_obj->af_mode, 0, 0, reset_pin->configRegister, - pin_generate_config(PIN_PULL_DISABLED, PIN_MODE_OUT, PIN_DRIVE_POWER_5, reset_pin->configRegister)); + pin_generate_config(PIN_PULL_DISABLED, PIN_MODE_OUT, PIN_DRIVE_5, reset_pin->configRegister)); GPIO_PinInit(reset_pin->gpio, reset_pin->pin, &gpio_config); #endif @@ -206,7 +206,7 @@ void eth_init(eth_t *self, int mac_idx, const phy_operations_t *phy_ops, int phy IOMUXC_SetPinMux(int_pin->muxRegister, af_obj->af_mode, 0, 0, int_pin->configRegister, 0U); IOMUXC_SetPinConfig(int_pin->muxRegister, af_obj->af_mode, 0, 0, int_pin->configRegister, - pin_generate_config(PIN_PULL_UP_47K, PIN_MODE_IN, PIN_DRIVE_POWER_5, int_pin->configRegister)); + pin_generate_config(PIN_PULL_UP_47K, PIN_MODE_IN, PIN_DRIVE_5, int_pin->configRegister)); GPIO_PinInit(int_pin->gpio, int_pin->pin, &gpio_config); #endif diff --git a/ports/mimxrt/machine_pin.c b/ports/mimxrt/machine_pin.c index 1f4afab97f..2424088f02 100644 --- a/ports/mimxrt/machine_pin.c +++ b/ports/mimxrt/machine_pin.c @@ -190,7 +190,7 @@ STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_ [PIN_INIT_ARG_MODE] { MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT }, [PIN_INIT_ARG_PULL] { MP_QSTR_pull, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE}}, [PIN_INIT_ARG_VALUE] { MP_QSTR_value, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL}}, - [PIN_INIT_ARG_DRIVE] { MP_QSTR_drive, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = PIN_DRIVE_POWER_3}}, + [PIN_INIT_ARG_DRIVE] { MP_QSTR_drive, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = PIN_DRIVE_3}}, // TODO: Implement additional arguments /* { MP_QSTR_af, MP_ARG_INT, {.u_int = -1}}, // legacy @@ -381,14 +381,14 @@ STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_PULL_DOWN), MP_ROM_INT(PIN_PULL_DOWN_100K) }, { MP_ROM_QSTR(MP_QSTR_PULL_HOLD), MP_ROM_INT(PIN_PULL_HOLD) }, - { MP_ROM_QSTR(MP_QSTR_DRIVER_OFF), MP_ROM_INT(PIN_DRIVE_OFF) }, - { MP_ROM_QSTR(MP_QSTR_POWER_0), MP_ROM_INT(PIN_DRIVE_POWER_0) }, // R0 (150 Ohm @3.3V / 260 Ohm @ 1.8V) - { MP_ROM_QSTR(MP_QSTR_POWER_1), MP_ROM_INT(PIN_DRIVE_POWER_1) }, // R0/2 - { MP_ROM_QSTR(MP_QSTR_POWER_2), MP_ROM_INT(PIN_DRIVE_POWER_2) }, // R0/3 - { MP_ROM_QSTR(MP_QSTR_POWER_3), MP_ROM_INT(PIN_DRIVE_POWER_3) }, // R0/4 - { MP_ROM_QSTR(MP_QSTR_POWER_4), MP_ROM_INT(PIN_DRIVE_POWER_4) }, // R0/5 - { MP_ROM_QSTR(MP_QSTR_POWER_5), MP_ROM_INT(PIN_DRIVE_POWER_5) }, // R0/6 - { MP_ROM_QSTR(MP_QSTR_POWER_6), MP_ROM_INT(PIN_DRIVE_POWER_6) }, // R0/7 + { MP_ROM_QSTR(MP_QSTR_DRIVE_OFF), MP_ROM_INT(PIN_DRIVE_OFF) }, + { MP_ROM_QSTR(MP_QSTR_DRIVE_0), MP_ROM_INT(PIN_DRIVE_0) }, // R0 (150 Ohm @3.3V / 260 Ohm @ 1.8V) + { MP_ROM_QSTR(MP_QSTR_DRIVE_1), MP_ROM_INT(PIN_DRIVE_1) }, // R0/2 + { MP_ROM_QSTR(MP_QSTR_DRIVE_2), MP_ROM_INT(PIN_DRIVE_2) }, // R0/3 + { MP_ROM_QSTR(MP_QSTR_DRIVE_3), MP_ROM_INT(PIN_DRIVE_3) }, // R0/4 + { MP_ROM_QSTR(MP_QSTR_DRIVE_4), MP_ROM_INT(PIN_DRIVE_4) }, // R0/5 + { MP_ROM_QSTR(MP_QSTR_DRIVE_5), MP_ROM_INT(PIN_DRIVE_5) }, // R0/6 + { MP_ROM_QSTR(MP_QSTR_DRIVE_6), MP_ROM_INT(PIN_DRIVE_6) }, // R0/7 { MP_ROM_QSTR(MP_QSTR_IRQ_RISING), MP_ROM_INT(1) }, { MP_ROM_QSTR(MP_QSTR_IRQ_FALLING), MP_ROM_INT(2) }, diff --git a/ports/mimxrt/machine_pwm.c b/ports/mimxrt/machine_pwm.c index c21c7eb94b..9a498fbab8 100644 --- a/ports/mimxrt/machine_pwm.c +++ b/ports/mimxrt/machine_pwm.c @@ -518,7 +518,7 @@ STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args IOMUXC_SetPinMux(pin1->muxRegister, af_obj1->af_mode, af_obj1->input_register, af_obj1->input_daisy, pin1->configRegister, 0U); IOMUXC_SetPinConfig(pin1->muxRegister, af_obj1->af_mode, af_obj1->input_register, af_obj1->input_daisy, - pin1->configRegister, pin_generate_config(PIN_PULL_DISABLED, PIN_MODE_OUT, PIN_DRIVE_POWER_5, pin1->configRegister)); + pin1->configRegister, pin_generate_config(PIN_PULL_DISABLED, PIN_MODE_OUT, PIN_DRIVE_5, pin1->configRegister)); // Settings for the second pin, if given. if (pin2 != NULL && pin2 != pin1) { @@ -529,7 +529,7 @@ STATIC mp_obj_t mp_machine_pwm_make_new(const mp_obj_type_t *type, size_t n_args IOMUXC_SetPinMux(pin2->muxRegister, af_obj2->af_mode, af_obj2->input_register, af_obj2->input_daisy, pin2->configRegister, 0U); IOMUXC_SetPinConfig(pin2->muxRegister, af_obj2->af_mode, af_obj2->input_register, af_obj2->input_daisy, - pin2->configRegister, pin_generate_config(PIN_PULL_DISABLED, PIN_MODE_OUT, PIN_DRIVE_POWER_5, pin2->configRegister)); + pin2->configRegister, pin_generate_config(PIN_PULL_DISABLED, PIN_MODE_OUT, PIN_DRIVE_5, pin2->configRegister)); } else { self->complementary = 0; } diff --git a/ports/mimxrt/machine_uart.c b/ports/mimxrt/machine_uart.c index 6807a994e1..d413778c8c 100644 --- a/ports/mimxrt/machine_uart.c +++ b/ports/mimxrt/machine_uart.c @@ -85,11 +85,11 @@ bool lpuart_set_iomux(int8_t uart) { if (TX.muxRegister != 0) { IOMUXC_SetPinMux(TX.muxRegister, TX.muxMode, TX.inputRegister, TX.inputDaisy, TX.configRegister, 0U); IOMUXC_SetPinConfig(TX.muxRegister, TX.muxMode, TX.inputRegister, TX.inputDaisy, TX.configRegister, - pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_OUT, PIN_DRIVE_POWER_6, TX.configRegister)); + pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_OUT, PIN_DRIVE_6, TX.configRegister)); IOMUXC_SetPinMux(RX.muxRegister, RX.muxMode, RX.inputRegister, RX.inputDaisy, RX.configRegister, 0U); IOMUXC_SetPinConfig(RX.muxRegister, RX.muxMode, RX.inputRegister, RX.inputDaisy, RX.configRegister, - pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_IN, PIN_DRIVE_POWER_6, RX.configRegister)); + pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_IN, PIN_DRIVE_6, RX.configRegister)); return true; } else { return false; diff --git a/ports/mimxrt/pin.c b/ports/mimxrt/pin.c index e4136bd1c3..fcc9863286 100644 --- a/ports/mimxrt/pin.c +++ b/ports/mimxrt/pin.c @@ -99,7 +99,7 @@ uint32_t pin_generate_config(const uint32_t pull, const uint32_t mode, const uin if (!IS_GPIO_DRIVE(drive)) { mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("invalid drive strength: %d"), drive); } - pad_config |= IOMUXC_SW_PAD_CTL_PAD_DSE(drive >= PIN_DRIVE_POWER_4); + pad_config |= IOMUXC_SW_PAD_CTL_PAD_DSE(drive >= PIN_DRIVE_4); } #else diff --git a/ports/mimxrt/pin.h b/ports/mimxrt/pin.h index d1597fab9b..583d1c3023 100644 --- a/ports/mimxrt/pin.h +++ b/ports/mimxrt/pin.h @@ -40,13 +40,13 @@ ((MODE) == PIN_MODE_ALT)) #define IS_GPIO_DRIVE(DRIVE) (((DRIVE) == PIN_DRIVE_OFF) || \ - ((DRIVE) == PIN_DRIVE_POWER_0) || \ - ((DRIVE) == PIN_DRIVE_POWER_1) || \ - ((DRIVE) == PIN_DRIVE_POWER_2) || \ - ((DRIVE) == PIN_DRIVE_POWER_3) || \ - ((DRIVE) == PIN_DRIVE_POWER_4) || \ - ((DRIVE) == PIN_DRIVE_POWER_5) || \ - ((DRIVE) == PIN_DRIVE_POWER_6)) + ((DRIVE) == PIN_DRIVE_0) || \ + ((DRIVE) == PIN_DRIVE_1) || \ + ((DRIVE) == PIN_DRIVE_2) || \ + ((DRIVE) == PIN_DRIVE_3) || \ + ((DRIVE) == PIN_DRIVE_4) || \ + ((DRIVE) == PIN_DRIVE_5) || \ + ((DRIVE) == PIN_DRIVE_6)) // ------------------------------------------------------------------------------------------------------------------ // @@ -82,13 +82,13 @@ enum { enum { PIN_DRIVE_OFF = 0b000, - PIN_DRIVE_POWER_0, // R0 (150 Ohm @3.3V / 260 Ohm @ 1.8V) - PIN_DRIVE_POWER_1, // R0/2 - PIN_DRIVE_POWER_2, // R0/3 - PIN_DRIVE_POWER_3, // R0/4 - PIN_DRIVE_POWER_4, // R0/5 - PIN_DRIVE_POWER_5, // R0/6 - PIN_DRIVE_POWER_6, // R0/7 + PIN_DRIVE_0, // R0 (150 Ohm @3.3V / 260 Ohm @ 1.8V) + PIN_DRIVE_1, // R0/2 + PIN_DRIVE_2, // R0/3 + PIN_DRIVE_3, // R0/4 + PIN_DRIVE_4, // R0/5 + PIN_DRIVE_5, // R0/6 + PIN_DRIVE_6, // R0/7 }; diff --git a/ports/mimxrt/sdcard.c b/ports/mimxrt/sdcard.c index 5c523068ad..1a9a97b681 100644 --- a/ports/mimxrt/sdcard.c +++ b/ports/mimxrt/sdcard.c @@ -728,14 +728,14 @@ void sdcard_init_pins(mimxrt_sdcard_obj_t *card) { const mimxrt_sdcard_obj_pins_t *pins = card->pins; uint32_t default_config = pin_generate_config( - PIN_PULL_UP_47K, PIN_MODE_SKIP, PIN_DRIVE_POWER_6, card->pins->clk.pin->configRegister); + PIN_PULL_UP_47K, PIN_MODE_SKIP, PIN_DRIVE_6, card->pins->clk.pin->configRegister); #if USDHC_DATA3_PULL_DOWN_ON_BOARD // Pull down on the board -> must not enable internal PD. uint32_t no_cd_config = pin_generate_config( - PIN_PULL_DISABLED, PIN_MODE_SKIP, PIN_DRIVE_POWER_6, card->pins->data3.pin->configRegister); + PIN_PULL_DISABLED, PIN_MODE_SKIP, PIN_DRIVE_6, card->pins->data3.pin->configRegister); #else uint32_t no_cd_config = pin_generate_config( - PIN_PULL_DOWN_100K, PIN_MODE_SKIP, PIN_DRIVE_POWER_6, card->pins->data3.pin->configRegister); + PIN_PULL_DOWN_100K, PIN_MODE_SKIP, PIN_DRIVE_6, card->pins->data3.pin->configRegister); #endif // USDHC_DATA3_PULL_DOWN_ON_BOARD sdcard_init_pin(card->pins->clk.pin, card->pins->clk.af_idx, default_config); // USDHC1_CLK From 5cc50b9f1cdc2991008bedec6e012c3ec877999a Mon Sep 17 00:00:00 2001 From: robert-hh Date: Wed, 2 Feb 2022 08:52:37 +0100 Subject: [PATCH 0193/1712] mimxrt/machine_spi: Add omitted GPIO config. The method was changed, but not for the CSx pins. No functional change. --- ports/mimxrt/machine_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/mimxrt/machine_spi.c b/ports/mimxrt/machine_spi.c index 0332d9a9e8..e25e219c79 100644 --- a/ports/mimxrt/machine_spi.c +++ b/ports/mimxrt/machine_spi.c @@ -93,11 +93,11 @@ bool lpspi_set_iomux(int8_t spi, uint8_t drive, uint8_t cs) { if (cs == 0 && CS0.muxRegister != 0) { IOMUXC_SetPinMux(CS0.muxRegister, CS0.muxMode, CS0.inputRegister, CS0.inputDaisy, CS0.configRegister, 0U); IOMUXC_SetPinConfig(CS0.muxRegister, CS0.muxMode, CS0.inputRegister, CS0.inputDaisy, CS0.configRegister, - 0x1080u | drive << IOMUXC_SW_PAD_CTL_PAD_DSE_SHIFT); + pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_OUT, drive, CS0.configRegister)); } else if (cs == 1 && CS1.muxRegister != 0) { IOMUXC_SetPinMux(CS1.muxRegister, CS1.muxMode, CS1.inputRegister, CS1.inputDaisy, CS1.configRegister, 0U); IOMUXC_SetPinConfig(CS1.muxRegister, CS1.muxMode, CS1.inputRegister, CS1.inputDaisy, CS1.configRegister, - 0x1080u | drive << IOMUXC_SW_PAD_CTL_PAD_DSE_SHIFT); + pin_generate_config(PIN_PULL_UP_100K, PIN_MODE_OUT, drive, CS1.configRegister)); } else { mp_raise_ValueError(MP_ERROR_TEXT("The chosen CS is not available")); } From 5ea85b7a852046783074be8a59534bd7f55d2553 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Sat, 18 Dec 2021 21:16:07 +0100 Subject: [PATCH 0194/1712] mimxrt/boards: Add board files for MIMXRT1015 and MIMXRT1015_EVK. OCOTP_Init() has been removed from mphalport.c. The library files are missing for the MIMXRT1015, and for just reading the OCOTP the Init is not required. --- ports/mimxrt/Makefile | 1 - ports/mimxrt/boards/MIMXRT1015.ld | 38 +++++++ ports/mimxrt/boards/MIMXRT1015_EVK/board.json | 23 ++++ .../boards/MIMXRT1015_EVK/clock_config.h | 107 ++++++++++++++++++ .../boards/MIMXRT1015_EVK/mpconfigboard.h | 84 ++++++++++++++ .../boards/MIMXRT1015_EVK/mpconfigboard.mk | 9 ++ ports/mimxrt/boards/MIMXRT1015_EVK/pins.csv | 41 +++++++ ports/mimxrt/boards/MIMXRT1015_af.csv | 57 ++++++++++ ports/mimxrt/boards/make-flexram-config.py | 1 + ports/mimxrt/mphalport.c | 6 +- 10 files changed, 365 insertions(+), 2 deletions(-) create mode 100644 ports/mimxrt/boards/MIMXRT1015.ld create mode 100644 ports/mimxrt/boards/MIMXRT1015_EVK/board.json create mode 100644 ports/mimxrt/boards/MIMXRT1015_EVK/clock_config.h create mode 100644 ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.h create mode 100644 ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.mk create mode 100644 ports/mimxrt/boards/MIMXRT1015_EVK/pins.csv create mode 100644 ports/mimxrt/boards/MIMXRT1015_af.csv diff --git a/ports/mimxrt/Makefile b/ports/mimxrt/Makefile index 5b835d25b7..55e32433f5 100644 --- a/ports/mimxrt/Makefile +++ b/ports/mimxrt/Makefile @@ -186,7 +186,6 @@ SRC_HAL_IMX_C += \ $(MCU_DIR)/drivers/fsl_lpspi.c \ $(MCU_DIR)/drivers/fsl_lpspi_edma.c \ $(MCU_DIR)/drivers/fsl_lpuart.c \ - $(MCU_DIR)/drivers/fsl_ocotp.c \ $(MCU_DIR)/drivers/fsl_pit.c \ $(MCU_DIR)/drivers/fsl_pwm.c \ $(MCU_DIR)/drivers/fsl_snvs_lp.c \ diff --git a/ports/mimxrt/boards/MIMXRT1015.ld b/ports/mimxrt/boards/MIMXRT1015.ld new file mode 100644 index 0000000000..6d34200a9f --- /dev/null +++ b/ports/mimxrt/boards/MIMXRT1015.ld @@ -0,0 +1,38 @@ +/* Memory configuration */ +#if defined MICROPY_HW_FLASH_RESERVED +reserved_size = MICROPY_HW_FLASH_RESERVED; +#endif + +#if MICROPY_HW_FLASH_TYPE == qspi_nor +flash_start = 0x60000000; +#else +#error Unknown MICROPY_HW_FLASH_TYPE +#endif +flash_size = MICROPY_HW_FLASH_SIZE; +flash_end = DEFINED(reserved_size) ? ((flash_start) + (flash_size - reserved_size)) : ((flash_start) + (flash_size)); +flash_config_start = flash_start; +flash_config_size = 0x00001000; +ivt_start = flash_start + 0x00001000; +ivt_size = 0x00001000; +interrupts_start = flash_start + 0x00002000; +interrupts_size = 0x00000400; +text_start = flash_start + 0x00002400; +vfs_start = flash_start + 0x00100000; +text_size = ((vfs_start) - (text_start)); +vfs_size = ((flash_end) - (vfs_start)); +itcm_start = 0x00000000; +itcm_size = 0x00008000; +dtcm_start = 0x20000000; +dtcm_size = 0x00008000; +ocrm_start = 0x20200000; +ocrm_size = 0x00010000; + +/* 24kiB stack. */ +__stack_size__ = 0x5000; +_estack = __StackTop; +_sstack = __StackLimit; + +/* Use second OCRAM bank for GC heap. */ +/* Use all OCRAM for the GC heap. */ +_gc_heap_start = ORIGIN(m_ocrm); +_gc_heap_end = ORIGIN(m_ocrm) + LENGTH(m_ocrm); diff --git a/ports/mimxrt/boards/MIMXRT1015_EVK/board.json b/ports/mimxrt/boards/MIMXRT1015_EVK/board.json new file mode 100644 index 0000000000..78044c134e --- /dev/null +++ b/ports/mimxrt/boards/MIMXRT1015_EVK/board.json @@ -0,0 +1,23 @@ +{ + "deploy": [ + "../deploy_mimxrt.md" + ], + "docs": "", + "features": [ + "MicroSD", + "MicroUSB", + "Microphone", + "AudioCodec", + "CAN", + "OpenSDA", + "JLink" + ], + "images": [ + "MIMXRT1015-EVK-TOP.jpg" + ], + "mcu": "mimxrt", + "product": "MIMXRT1015_EVK", + "thumbnail": "", + "url": "https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/i-mx-rt1015-evaluation-kit:MIMXRT1015-EVK", + "vendor": "NXP" +} diff --git a/ports/mimxrt/boards/MIMXRT1015_EVK/clock_config.h b/ports/mimxrt/boards/MIMXRT1015_EVK/clock_config.h new file mode 100644 index 0000000000..65944077e5 --- /dev/null +++ b/ports/mimxrt/boards/MIMXRT1015_EVK/clock_config.h @@ -0,0 +1,107 @@ +/* + * Copyright 2018-2019 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _CLOCK_CONFIG_H_ +#define _CLOCK_CONFIG_H_ + +#include "fsl_common.h" + +/******************************************************************************* + * Definitions + ******************************************************************************/ +#define BOARD_XTAL0_CLK_HZ 24000000U /*!< Board xtal0 frequency in Hz */ + +#define BOARD_XTAL32K_CLK_HZ 32768U /*!< Board xtal32k frequency in Hz */ +/******************************************************************************* + ************************ BOARD_InitBootClocks function ************************ + ******************************************************************************/ + +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus*/ + +/*! + * @brief This function executes default configuration of clocks. + * + */ +void BOARD_InitBootClocks(void); + +#if defined(__cplusplus) +} +#endif /* __cplusplus*/ + +/******************************************************************************* + ********************** Configuration BOARD_BootClockRUN *********************** + ******************************************************************************/ +/******************************************************************************* + * Definitions for BOARD_BootClockRUN configuration + ******************************************************************************/ +#define BOARD_BOOTCLOCKRUN_CORE_CLOCK 500000000U /*!< Core clock frequency: 500000000Hz */ + +/* Clock outputs (values are in Hz): */ +#define BOARD_BOOTCLOCKRUN_AHB_CLK_ROOT 500000000UL +#define BOARD_BOOTCLOCKRUN_CKIL_SYNC_CLK_ROOT 32768UL +#define BOARD_BOOTCLOCKRUN_CLKO1_CLK 0UL +#define BOARD_BOOTCLOCKRUN_CLKO2_CLK 0UL +#define BOARD_BOOTCLOCKRUN_CLK_1M 1000000UL +#define BOARD_BOOTCLOCKRUN_CLK_24M 24000000UL +#define BOARD_BOOTCLOCKRUN_ENET_500M_REF_CLK 500000000UL +#define BOARD_BOOTCLOCKRUN_FLEXIO1_CLK_ROOT 30000000UL +#define BOARD_BOOTCLOCKRUN_FLEXSPI_CLK_ROOT 125000000UL +#define BOARD_BOOTCLOCKRUN_GPT1_IPG_CLK_HIGHFREQ 62500000UL +#define BOARD_BOOTCLOCKRUN_GPT2_IPG_CLK_HIGHFREQ 62500000UL +#define BOARD_BOOTCLOCKRUN_IPG_CLK_ROOT 125000000UL +#define BOARD_BOOTCLOCKRUN_LPI2C_CLK_ROOT 60000000UL +#define BOARD_BOOTCLOCKRUN_LPSPI_CLK_ROOT 105600000UL +#define BOARD_BOOTCLOCKRUN_MQS_MCLK 63529411UL +#define BOARD_BOOTCLOCKRUN_PERCLK_CLK_ROOT 62500000UL +#define BOARD_BOOTCLOCKRUN_SAI1_CLK_ROOT 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI1_MCLK1 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI1_MCLK2 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI1_MCLK3 30000000UL +#define BOARD_BOOTCLOCKRUN_SAI2_CLK_ROOT 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI2_MCLK1 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI2_MCLK2 0UL +#define BOARD_BOOTCLOCKRUN_SAI2_MCLK3 30000000UL +#define BOARD_BOOTCLOCKRUN_SAI3_CLK_ROOT 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI3_MCLK1 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI3_MCLK2 0UL +#define BOARD_BOOTCLOCKRUN_SAI3_MCLK3 30000000UL +#define BOARD_BOOTCLOCKRUN_SPDIF0_CLK_ROOT 30000000UL +#define BOARD_BOOTCLOCKRUN_SPDIF0_EXTCLK_OUT 0UL +#define BOARD_BOOTCLOCKRUN_TRACE_CLK_ROOT 117333333UL +#define BOARD_BOOTCLOCKRUN_UART_CLK_ROOT 80000000UL +#define BOARD_BOOTCLOCKRUN_USBPHY1_CLK 0UL + +/*! @brief Usb1 PLL set for BOARD_BootClockRUN configuration. + */ +extern const clock_usb_pll_config_t usb1PllConfig_BOARD_BootClockRUN; +/*! @brief Sys PLL for BOARD_BootClockRUN configuration. + */ +extern const clock_sys_pll_config_t sysPllConfig_BOARD_BootClockRUN; +/*! @brief Enet PLL set for BOARD_BootClockRUN configuration. + */ +extern const clock_enet_pll_config_t enetPllConfig_BOARD_BootClockRUN; + +/******************************************************************************* + * API for BOARD_BootClockRUN configuration + ******************************************************************************/ +#if defined(__cplusplus) +extern "C" { +#endif /* __cplusplus*/ + +/*! + * @brief This function executes configuration of clocks. + * + */ +void BOARD_BootClockRUN(void); + +#if defined(__cplusplus) +} +#endif /* __cplusplus*/ + +#endif /* _CLOCK_CONFIG_H_ */ diff --git a/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.h b/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.h new file mode 100644 index 0000000000..17326cb485 --- /dev/null +++ b/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.h @@ -0,0 +1,84 @@ +#define MICROPY_HW_BOARD_NAME "i.MX RT1015 EVK" +#define MICROPY_HW_MCU_NAME "MIMXRT1015DAF5A" + +// i.MX RT1015 EVK has 3 board LED +// Todo: think about replacing the define with searching in the generated pins? +#define MICROPY_HW_LED1_PIN (pin_GPIO_SD_B1_00) +#define MICROPY_HW_LED2_PIN (pin_GPIO_SD_B1_01) +#define MICROPY_HW_LED3_PIN (pin_GPIO_SD_B1_02) +#define MICROPY_HW_LED_ON(pin) (mp_hal_pin_low(pin)) +#define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_high(pin)) + +#define MICROPY_HW_NUM_PIN_IRQS (3 * 32) + +// Define mapping logical UART # to hardware UART # +// RX/TX HW-UART Logical UART +// DEBUG USB LPUART1 -> 0 +// D3/D5 LPUART1 +// D0/D1 LPUART2 -> 1 +// D6/D9 LPUART3 -> 2 +// A0/A1 LPUART4 -> 5 + +#define MICROPY_HW_UART_NUM (sizeof(uart_index_table) / sizeof(uart_index_table)[0]) +#define MICROPY_HW_UART_INDEX { 1, 4, 3 } + +#define IOMUX_TABLE_UART \ + { IOMUXC_GPIO_AD_B0_06_LPUART1_TX }, { IOMUXC_GPIO_AD_B0_07_LPUART1_RX }, \ + { 0 }, { 0 }, \ + { IOMUXC_GPIO_AD_B0_14_LPUART3_TX }, { IOMUXC_GPIO_AD_B0_15_LPUART3_RX }, \ + { IOMUXC_GPIO_EMC_32_LPUART4_TX }, { IOMUXC_GPIO_EMC_33_LPUART4_RX }, \ + +#define MICROPY_HW_SPI_INDEX { 1 } + +#define IOMUX_TABLE_SPI \ + { IOMUXC_GPIO_AD_B0_10_LPSPI1_SCK }, { IOMUXC_GPIO_AD_B0_11_LPSPI1_PCS0 }, \ + { IOMUXC_GPIO_AD_B0_12_LPSPI1_SDO }, { IOMUXC_GPIO_AD_B0_13_LPSPI1_SDI }, \ + { 0 } + +#define DMA_REQ_SRC_RX { 0, kDmaRequestMuxLPSPI1Rx, kDmaRequestMuxLPSPI2Rx } + +#define DMA_REQ_SRC_TX { 0, kDmaRequestMuxLPSPI1Tx, kDmaRequestMuxLPSPI2Tx } + +// Define mapping hardware I2C # to logical I2C # +// SDA/SCL HW-I2C Logical I2C +// D14/D15 LPI2C4 -> 0 +// A4/A5 LPI2C1 -> 1 +// D0/D1 LPI2C2 -> 2 + +#define MICROPY_HW_I2C_INDEX { 1, 2 } + +#define IOMUX_TABLE_I2C \ + { IOMUXC_GPIO_AD_B1_14_LPI2C1_SCL }, { IOMUXC_GPIO_AD_B1_15_LPI2C1_SDA }, \ + { IOMUXC_GPIO_EMC_19_LPI2C2_SCL }, { IOMUXC_GPIO_EMC_18_LPI2C2_SDA }, + +#define MICROPY_PY_MACHINE_I2S (1) +#define MICROPY_HW_I2S_NUM (1) +#define I2S_CLOCK_MUX { 0, kCLOCK_Sai1Mux, kCLOCK_Sai2Mux } +#define I2S_CLOCK_PRE_DIV { 0, kCLOCK_Sai1PreDiv, kCLOCK_Sai2PreDiv } +#define I2S_CLOCK_DIV { 0, kCLOCK_Sai1Div, kCLOCK_Sai2Div } +#define I2S_IOMUXC_GPR_MODE { 0, kIOMUXC_GPR_SAI1MClkOutputDir, kIOMUXC_GPR_SAI2MClkOutputDir } +#define I2S_DMA_REQ_SRC_RX { 0, kDmaRequestMuxSai1Rx, kDmaRequestMuxSai2Rx } +#define I2S_DMA_REQ_SRC_TX { 0, kDmaRequestMuxSai1Tx, kDmaRequestMuxSai2Tx } + +#define I2S_GPIO(_hwid, _fn, _mode, _pin, _iomux) \ + { \ + .hw_id = _hwid, \ + .fn = _fn, \ + .mode = _mode, \ + .name = MP_QSTR_##_pin, \ + .iomux = {_iomux}, \ + } + +#define I2S_GPIO_MAP \ + { \ + I2S_GPIO(1, MCK, TX, GPIO_EMC_20, IOMUXC_GPIO_EMC_20_SAI1_MCLK), \ + I2S_GPIO(1, SCK, RX, GPIO_EMC_19, IOMUXC_GPIO_EMC_19_SAI1_RX_BCLK), \ + I2S_GPIO(1, WS, RX, GPIO_EMC_18, IOMUXC_GPIO_EMC_18_SAI1_RX_SYNC), \ + I2S_GPIO(1, SD, RX, GPIO_EMC_21, IOMUXC_GPIO_EMC_21_SAI1_RX_DATA00), \ + I2S_GPIO(1, SCK, TX, GPIO_EMC_26, IOMUXC_GPIO_EMC_26_SAI1_TX_BCLK), \ + I2S_GPIO(1, WS, TX, GPIO_EMC_27, IOMUXC_GPIO_EMC_27_SAI1_TX_SYNC), \ + I2S_GPIO(1, SD, TX, GPIO_EMC_25, IOMUXC_GPIO_EMC_25_SAI1_TX_DATA00), \ + } + +#define MICROPY_BOARD_ROOT_POINTERS \ + struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_I2S_NUM]; diff --git a/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.mk b/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.mk new file mode 100644 index 0000000000..5d959b31d4 --- /dev/null +++ b/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.mk @@ -0,0 +1,9 @@ +MCU_SERIES = MIMXRT1015 +MCU_VARIANT = MIMXRT1015DAF5A + +MICROPY_FLOAT_IMPL = single +MICROPY_PY_MACHINE_SDCARD = 0 +MICROPY_HW_FLASH_TYPE ?= qspi_nor +MICROPY_HW_FLASH_SIZE ?= 0x1000000 # 16MB + +MICROPY_BOOT_BUFFER_SIZE = (32 * 1024) diff --git a/ports/mimxrt/boards/MIMXRT1015_EVK/pins.csv b/ports/mimxrt/boards/MIMXRT1015_EVK/pins.csv new file mode 100644 index 0000000000..2b50c7ca76 --- /dev/null +++ b/ports/mimxrt/boards/MIMXRT1015_EVK/pins.csv @@ -0,0 +1,41 @@ +D0,GPIO_EMC_33 +D1,GPIO_EMC_32 +D2,GPIO_EMC_20 +D3,GPIO_EMC_26 +D4,GPIO_EMC_34 +D5,GPIO_EMC_27 +D6,GPIO_AD_B1_11 +D7,GPIO_AD_B0_15 +D8,GPIO_EMC_21 +D9,GPIO_EMC_22 +D10,GPIO_AD_B0_11 +D11,GPIO_AD_B0_12 +D12,GPIO_AD_B0_13 +D13,GPIO_AD_B0_10 +D14,GPIO_AD_B1_15 +D15,GPIO_AD_B1_14 +A0,GPIO_AD_B1_13 +A1,GPIO_AD_B0_14 +A2,GPIO_AD_B1_12 +A3,GPIO_AD_B1_10 +A4,GPIO_AD_B1_15 +A5,GPIO_AD_B1_14 +RX,GPIO_EMC_33 +TX,GPIO_EMC_32 +SDA,GPIO_AD_B1_15 +SCL,GPIO_AD_B1_14 +SCK,GPIO_AD_B0_10 +SDI,GPIO_AD_B0_13 +SDO,GPIO_AD_B0_12 +CS,GPIO_AD_B0_11 +LED1,GPIO_SD_B1_00 +LED2,GPIO_SD_B1_01 +LED3,GPIO_SD_B1_02 +BUTTON,GPIO_EMC_09 +MCK,GPIO_EMC_20 +SCK_RX,GPIO_EMC_19 +WS_RX,GPIO_EMC_18 +SD_RX,GPIO_EMC_21 +SCK_TX,GPIO_EMC_26 +WS_TX,GPIO_EMC_27 +SD_TX,GPIO_EMC_25 \ No newline at end of file diff --git a/ports/mimxrt/boards/MIMXRT1015_af.csv b/ports/mimxrt/boards/MIMXRT1015_af.csv new file mode 100644 index 0000000000..d988662583 --- /dev/null +++ b/ports/mimxrt/boards/MIMXRT1015_af.csv @@ -0,0 +1,57 @@ +Pad,ALT0,ALT1,ALT2,ALT3,ALT4,ALT5,ALT6,ALT7,ALT8,ALT9,ADC,ACMP,Default +GPIO_AD_B0_00,JTAG_TMS,,,,,GPIO1_IO00,,GPT1_COMPARE1,,,,,ALT0 +GPIO_AD_B0_01,JTAG_TCK,,,,,GPIO1_IO01,,GPT1_CAPTURE2,,,,,ALT0 +GPIO_AD_B0_02,JTAG_MOD,,,,,GPIO1_IO02,,GPT1_CAPTURE1,,,,,ALT0 +GPIO_AD_B0_03,JTAG_TDI,,WDOG1_B,SAI1_MCLK,,GPIO1_IO03,USB_OTG1_OC,CCM_PMIC_RDY,,,,,ALT0 +GPIO_AD_B0_04,JTAG_TDO,,,,,GPIO1_IO04,USB_OTG1_PWR,EWM_OUT_B,,,,,ALT0 +GPIO_AD_B0_05,JTAG_TRSTB,,,,,GPIO1_IO05,USB_OTG1_ID,ARM_NMI,,,,,ALT0 +GPIO_AD_B0_06,PIT_TRIGGER0,MQS_RIGHT,LPUART1_TXD,,,GPIO1_IO06,REF_32K_OUT,,,,,,ALT5 +GPIO_AD_B0_07,PIT_TRIGGER1,MQS_LEFT,LPUART1_RXD,,,GPIO1_IO07,REF_24M_OUT,,,,,,ALT5 +GPIO_AD_B0_08,,,LPUART1_CTS_B,KPP_COL0,,GPIO1_IO08,ARM_CM7_TXEV,,,,,,ALT5 +GPIO_AD_B0_09,,,LPUART1_RTS_B,KPP_ROW0,CSU_CSU_INT_DEB,GPIO1_IO09,ARM_CM7_RXEV,,,,,,ALT5 +GPIO_AD_B0_10,,LPSPI1_SCK,,KPP_COL1,,GPIO1_IO10,ARM_TRACE_CLK,,,,,,ALT5 +GPIO_AD_B0_11,,LPSPI1_PCS0,,KPP_ROW1,,GPIO1_IO11,ARM_TRACE_SWO,,,,,,ALT5 +GPIO_AD_B0_12,,LPSPI1_SDO,LPUART3_CTS_B,KPP_COL2,,GPIO1_IO12,ARM_TRACE0,SNVS_VIO_5_CTL,,,ADC1_IN0,,ALT5 +GPIO_AD_B0_13,,LPSPI1_SDI,LPUART3_RTS_B,KPP_ROW2,,GPIO1_IO13,ARM_CM7_TRACE01,SNVS_VIO_5_B,,,,,ALT5 +GPIO_AD_B0_14,,,LPUART3_TXD,KPP_COL3,,GPIO1_IO14,ARM_CM7_TRACE02,WDOG1_ANY,,,ADC1_IN1,,ALT5 +GPIO_AD_B0_15,,,LPUART3_RXD,KPP_ROW3,,GPIO1_IO15,ARM_CM7_TRACE03,,,,ADC1_IN2,,ALT5 +GPIO_AD_B1_10,USB_OTG1_PWR,FLEXPWM1_PWM2_A,LPUART4_TXD,,FLEXIO1_D05,GPIO1_IO26,GPT2_CAPTURE1,,,,ADC1_IN10,,ALT5 +GPIO_AD_B1_11,USB_OTG1_ID,FLEXPWM1_PWM2_B,LPUART4_RXD,,FLEXIO1_D04,GPIO1_IO27,GPT2_COMPARE1,,,,ADC1_IN11,,ALT5 +GPIO_AD_B1_12,USB_OTG1_OC,ACMP1_OUT,,,FLEXIO1_D03,GPIO1_IO28,FLEXPWM1_PWM3_A,,,,ADC1_IN12,ACMP1_OUT,ALT5 +GPIO_AD_B1_13,LPI2C1_HREQ,ACMP2_OUT,,,FLEXIO1_D02,GPIO1_IO29,FLEXPWM1_PWM3_B,,,,ADC1_IN13,ACMP2_OUT,ALT5 +GPIO_AD_B1_14,LPI2C1_SCL,ACMP3_OUT,,,FLEXIO1_D01,GPIO1_IO30,,,,,ADC1_IN14,ACMP3_OUT,ALT5 +GPIO_AD_B1_15,LPI2C1_SDA,ACMP4_OUT,,,FLEXIO1_D00,GPIO1_IO31,,,,,ADC1_IN15,ACMP4_OUT,ALT5 +GPIO_EMC_04,,XBAR_INOUT04,SPDIF_OUT,SAI2_TX_BCLK,FLEXIO1_D16,GPIO2_IO04,,SJC_JTAG_ACT,,,,,ALT5 +GPIO_EMC_05,,XBAR_INOUT05,SPDIF_IN,SAI2_TX_SYNC,FLEXIO1_D17,GPIO2_IO05,,SJC_DE_B,,,,,ALT5 +GPIO_EMC_06,,XBAR_INOUT06,LPUART3_TXD,SAI2_TX_DATA,FLEXIO1_D18,GPIO2_IO06,,,,,,,ALT5 +GPIO_EMC_07,,XBAR_INOUT07,LPUART3_RXD,SAI2_RX_SYNC,FLEXIO1_D19,GPIO2_IO07,,,,,,,ALT5 +GPIO_EMC_08,,XBAR_INOUT08,,SAI2_RX_DATA,FLEXIO1_D20,GPIO2_IO08,,,,,,,ALT5 +GPIO_EMC_09,,XBAR_INOUT09,,SAI2_RX_BCLK,FLEXIO1_D21,GPIO2_IO09,,,,,,,ALT5 +GPIO_EMC_16,,,MQS_RIGHT,SAI2_MCLK,,GPIO2_IO16,SRC_BOOT_MODE0,,,,,,ALT5 +GPIO_EMC_17,,,MQS_LEFT,SAI3_MCLK,,GPIO2_IO17,SRC_BOOT_MODE1,,,,,,ALT5 +GPIO_EMC_18,,XBAR_INOUT16,LPI2C2_SDA,SAI1_RX_SYNC,FLEXIO1_D22,GPIO2_IO18,SRC_BT_CFG0,,,,,,ALT5 +GPIO_EMC_19,,XBAR_INOUT17,LPI2C2_SCL,SAI1_RX_BCLK,FLEXIO1_D23,GPIO2_IO19,SRC_BT_CFG1,,,,,,ALT5 +GPIO_EMC_20,,FLEXPWM1_PWM3_A,LPUART2_CTS_B,SAI1_MCLK,FLEXIO1_D24,GPIO2_IO20,SRC_BT_CFG2,,,,,,ALT5 +GPIO_EMC_21,,FLEXPWM1_PWM3_B,LPUART2_RTS_B,SAI1_RX_DATA0,FLEXIO1_D25,GPIO2_IO21,SRC_BT_CFG3,,,,,,ALT5 +GPIO_EMC_22,,FLEXPWM1_PWM2_A,LPUART2_TXD,SAI1_TX_DATA3,FLEXIO1_D26,GPIO2_IO22,SRC_BT_CFG4,,,,,,ALT5 +GPIO_EMC_23,,FLEXPWM1_PWM2_B,LPUART2_RXD,SAI1_TX_DATA2,FLEXIO1_D27,GPIO2_IO23,SRC_BT_CFG5,,,,,,ALT5 +GPIO_EMC_24,,FLEXPWM1_PWM1_A,,SAI1_TX_DATA1,FLEXIO1_D28,GPIO2_IO24,SRC_BT_CFG6,,,,,,ALT5 +GPIO_EMC_25,,FLEXPWM1_PWM1_B,,SAI1_TX_DATA0,FLEXIO1_D29,GPIO2_IO25,SRC_BT_CFG7,,,,,,ALT5 +GPIO_EMC_26,,FLEXPWM1_PWM0_A,,SAI1_TX_BCLK,FLEXIO1_D30,GPIO2_IO26,SRC_BT_CFG8,,,,,,ALT5 +GPIO_EMC_27,,FLEXPWM1_PWM0_B,,SAI1_TX_SYNC,FLEXIO1_D31,GPIO2_IO27,SRC_BT_CFG9,,,,,,ALT5 +GPIO_EMC_32,,TMR1_TIMER0,LPUART4_TXD,SAI3_TX_DATA,,GPIO3_IO00,,REF_24M_OUT,,,,,ALT5 +GPIO_EMC_33,,TMR1_TIMER1,LPUART4_RXD,SAI3_TX_BCLK,,GPIO3_IO01,,,,,,,ALT5 +GPIO_EMC_34,,TMR1_TIMER2,,SAI3_TX_SYNC,,GPIO3_IO02,,,,,,,ALT5 +GPIO_EMC_35,,TMR1_TIMER3,,,,GPIO3_IO03,,,,,,,ALT5 +GPIO_SD_B1_00,,FLEXSPI_B_DATA3,,XBAR_INOUT10,,GPIO3_IO20,,,,,,,ALT5 +GPIO_SD_B1_01,,FLEXSPI_B_SCLK,,FLEXSPI_A_SS1_B,,GPIO3_IO21,,,,,,,ALT5 +GPIO_SD_B1_02,,FLEXSPI_B_DATA0,,,,GPIO3_IO22,CCM_CLKO1,,,,,,ALT5 +GPIO_SD_B1_03,,FLEXSPI_B_DATA2,,,,GPIO3_IO23,CCM_CLKO2,,,,,,ALT5 +GPIO_SD_B1_04,,FLEXSPI_B_DATA1,,,EWM_OUT_B,GPIO3_IO24,CCM_WAIT,,,,,,ALT5 +GPIO_SD_B1_05,,FLEXSPI_A_DQS,,SAI3_MCLK,FLEXSPI_B_SS0_B,GPIO3_IO25,CCM_PMIC_RDY,,,,,,ALT5 +GPIO_SD_B1_06,,FLEXSPI_A_DATA3,,SAI3_TX_BCLK,LPSPI2_PCS0,GPIO3_IO26,CCM_STOP,,,,,,ALT5 +GPIO_SD_B1_07,,FLEXSPI_A_SCLK,,SAI3_TX_SYNC,LPSPI2_SCK,GPIO3_IO27,,,,,,,ALT5 +GPIO_SD_B1_08,,FLEXSPI_A_DATA0,,SAI3_TX_DATA,LPSPI2_SDO,GPIO3_IO28,,,,,,,ALT5 +GPIO_SD_B1_09,,FLEXSPI_A_DATA2,,SAI3_RX_BCLK,LPSPI2_SDI,GPIO3_IO29,CCM_REF_EN_B,,,,,,ALT5 +GPIO_SD_B1_10,,FLEXSPI_A_DATA1,,SAI3_RX_SYNC,LPSPI2_PCS2,GPIO3_IO30,SRC_SYSTEM_RESET,,,,,,ALT5 +GPIO_SD_B1_11,,FLEXSPI_A_SS0_B,,SAI3_RX_DATA,LPSPI2_PCS3,GPIO3_IO31,SRC_EARLY_RESET,,,,,,ALT5 diff --git a/ports/mimxrt/boards/make-flexram-config.py b/ports/mimxrt/boards/make-flexram-config.py index 0a667ff5b7..5d9c1a8c7c 100644 --- a/ports/mimxrt/boards/make-flexram-config.py +++ b/ports/mimxrt/boards/make-flexram-config.py @@ -172,6 +172,7 @@ def mimxrt_106x_gen_code(extract_dict): def main(defines_file, features_file, ld_script, controller): dispatcher = { "MIMXRT1011": (mimxrt_default_parser, mimxrt_default_gen_code), + "MIMXRT1015": (mimxrt_default_parser, mimxrt_default_gen_code), "MIMXRT1021": (mimxrt_default_parser, mimxrt_default_gen_code), "MIMXRT1052": (mimxrt_default_parser, mimxrt_default_gen_code), "MIMXRT1062": (mimxrt_default_parser, mimxrt_106x_gen_code), diff --git a/ports/mimxrt/mphalport.c b/ports/mimxrt/mphalport.c index 17a6898c40..673b58b23f 100644 --- a/ports/mimxrt/mphalport.c +++ b/ports/mimxrt/mphalport.c @@ -33,7 +33,12 @@ #include "ticks.h" #include "tusb.h" #include "fsl_snvs_lp.h" + +#if FSL_COMMON_DRIVER_VERSION != 0x020001 #include "fsl_ocotp.h" +#else +void OCOTP_Init(OCOTP_Type *base, uint32_t srcClock_Hz); +#endif #include CPU_HEADER_H @@ -124,7 +129,6 @@ uint64_t mp_hal_time_ns(void) { // MAC address void mp_hal_get_unique_id(uint8_t id[]) { - OCOTP_Init(OCOTP, CLOCK_GetFreq(kCLOCK_IpgClk)); *(uint32_t *)&id[0] = OCOTP->CFG0; *(uint32_t *)&id[4] = OCOTP->CFG1; } From b0d460cd7deb6f1cc3393f56c378943aca8d954b Mon Sep 17 00:00:00 2001 From: robert-hh Date: Thu, 3 Feb 2022 15:41:56 +0100 Subject: [PATCH 0195/1712] mimxrt/eth: Fix an Ethernet transmit error. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes frames could not be sent immediately because the controller was still busy with previous frames. Then, an error was returned to lwip. This fix adds a limited number of retries for this busy state, waiting 100µs before the next attempt. Typically the transmit succeeds now at the second attempt. Second change: Reset the controller for a clean state after soft reset. --- ports/mimxrt/eth.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/ports/mimxrt/eth.c b/ports/mimxrt/eth.c index af0264d085..08e4dcc09d 100644 --- a/ports/mimxrt/eth.c +++ b/ports/mimxrt/eth.c @@ -174,7 +174,7 @@ void eth_irq_handler(ENET_Type *base, enet_handle_t *handle, enet_event_t event, } } while (status != kStatus_ENET_RxFrameEmpty); } else { - ENET_ClearInterruptStatus(base, kENET_TxFrameInterrupt); + ENET_ClearInterruptStatus(base, ENET_TX_INTERRUPT | ENET_ERR_INTERRUPT); } } @@ -279,6 +279,7 @@ void eth_init(eth_t *self, int mac_idx, const phy_operations_t *phy_ops, int phy mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("PHY Init failed.")); } + ENET_Reset(ENET); ENET_GetDefaultConfig(&enet_config); enet_config.miiSpeed = (enet_mii_speed_t)speed; enet_config.miiDuplex = (enet_mii_duplex_t)duplex; @@ -311,6 +312,22 @@ void eth_set_trace(eth_t *self, uint32_t value) { /*******************************************************************************/ // ETH-LwIP bindings +STATIC err_t eth_send_frame_blocking(ENET_Type *base, enet_handle_t *handle, uint8_t *buffer, int len) { + status_t status; + int i; + #define XMIT_LOOP 10 + + // Try a few times to send the frame + for (i = XMIT_LOOP; i > 0; i--) { + status = ENET_SendFrame(base, handle, buffer, len); + if (status != kStatus_ENET_TxFrameBusy) { + break; + } + ticks_delay_us64(100); + } + return status; +} + STATIC err_t eth_netif_output(struct netif *netif, struct pbuf *p) { // This function should always be called from a context where PendSV-level IRQs are disabled status_t status; @@ -319,7 +336,7 @@ STATIC err_t eth_netif_output(struct netif *netif, struct pbuf *p) { eth_trace(netif->state, (size_t)-1, p, NETUTILS_TRACE_IS_TX | NETUTILS_TRACE_NEWLINE); if (p->next == NULL) { - status = ENET_SendFrame(ENET, &g_handle, p->payload, p->len); + status = eth_send_frame_blocking(ENET, &g_handle, p->payload, p->len); } else { // frame consists of several parts. Copy them together and send them size_t length = 0; @@ -330,8 +347,8 @@ STATIC err_t eth_netif_output(struct netif *netif, struct pbuf *p) { length += p->len; p = p->next; } - status = ENET_SendFrame(ENET, &g_handle, tx_frame, length); - } + status = eth_send_frame_blocking(ENET, &g_handle, tx_frame, length); + } return status == kStatus_Success ? ERR_OK : ERR_BUF; } From c72dfbcef96ef137c8faf72f0ccdb2ce6aab514c Mon Sep 17 00:00:00 2001 From: robert-hh Date: Thu, 3 Feb 2022 18:37:54 +0100 Subject: [PATCH 0196/1712] mimxrt/boards/TEENSY41: Use the same SPI1 pins for Teensy 4.0 and 4.1. Teensy 4.1 used different pins for SPI1 than Teensy 4.0, which made the boards unnecessarily different. --- ports/mimxrt/boards/TEENSY41/mpconfigboard.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/mimxrt/boards/TEENSY41/mpconfigboard.h b/ports/mimxrt/boards/TEENSY41/mpconfigboard.h index 449f10babb..3b8d497c3f 100644 --- a/ports/mimxrt/boards/TEENSY41/mpconfigboard.h +++ b/ports/mimxrt/boards/TEENSY41/mpconfigboard.h @@ -31,8 +31,8 @@ { 0 }, { 0 }, \ { 0 }, { 0 }, \ { 0 }, \ - { IOMUXC_GPIO_AD_B1_15_LPSPI3_SCK }, { IOMUXC_GPIO_AD_B1_12_LPSPI3_PCS0 }, \ - { IOMUXC_GPIO_AD_B1_14_LPSPI3_SDO }, { IOMUXC_GPIO_AD_B1_13_LPSPI3_SDI }, \ + { IOMUXC_GPIO_AD_B1_15_LPSPI3_SCK }, { IOMUXC_GPIO_AD_B0_03_LPSPI3_PCS0 }, \ + { IOMUXC_GPIO_AD_B1_14_LPSPI3_SDO }, { IOMUXC_GPIO_AD_B0_02_LPSPI3_SDI }, \ { 0 }, \ { IOMUXC_GPIO_B0_03_LPSPI4_SCK }, { IOMUXC_GPIO_B0_00_LPSPI4_PCS0 }, \ { IOMUXC_GPIO_B0_02_LPSPI4_SDO }, { IOMUXC_GPIO_B0_01_LPSPI4_SDI }, \ From 04f92a28251058756d776e90c044441e8f876f3f Mon Sep 17 00:00:00 2001 From: robert-hh Date: Sun, 6 Feb 2022 17:33:24 +0100 Subject: [PATCH 0197/1712] mimxrt/boards: Support using an optional board-specific manifest.py. If the board directory contains a manifest.py file, it will be included. File not found errors will be ignored. --- ports/mimxrt/boards/manifest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/mimxrt/boards/manifest.py b/ports/mimxrt/boards/manifest.py index ccbd33cae8..2e1a1d63d4 100644 --- a/ports/mimxrt/boards/manifest.py +++ b/ports/mimxrt/boards/manifest.py @@ -2,3 +2,7 @@ freeze("$(PORT_DIR)/modules") freeze("$(MPY_DIR)/drivers/onewire") freeze("$(MPY_DIR)/drivers/dht", "dht.py") include("$(MPY_DIR)/extmod/uasyncio/manifest.py") +try: + include("$(BOARD_DIR)/manifest.py") +except FileNotFoundError: + pass From 4774501cab372b75ca263be91d5eb0fa3ba9d60d Mon Sep 17 00:00:00 2001 From: robert-hh Date: Wed, 23 Feb 2022 14:15:27 +0100 Subject: [PATCH 0198/1712] mimxrt/eth: Avoid a race condition for Ethernet. That caused Ethernet to lock up at high data rates after ~200MByte data average in a row. Tested now with data bursts up to 10 GByte and overall data rates of ~8MByte/s at the Eth100 port. --- ports/mimxrt/eth.c | 3 ++- ports/mimxrt/mpconfigport.h | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ports/mimxrt/eth.c b/ports/mimxrt/eth.c index 08e4dcc09d..288aafb6b3 100644 --- a/ports/mimxrt/eth.c +++ b/ports/mimxrt/eth.c @@ -291,6 +291,7 @@ void eth_init(eth_t *self, int mac_idx, const phy_operations_t *phy_ops, int phy ENET_Init(ENET, &g_handle, &enet_config, &buffConfig[0], hw_addr, CLOCK_GetFreq(kCLOCK_IpgClk)); ENET_SetCallback(&g_handle, eth_irq_handler, (void *)self); + NVIC_SetPriority(ENET_IRQn, IRQ_PRI_PENDSV); ENET_EnableInterrupts(ENET, ENET_RX_INTERRUPT); ENET_ClearInterruptStatus(ENET, ENET_TX_INTERRUPT | ENET_RX_INTERRUPT | ENET_ERR_INTERRUPT); ENET_ActiveRead(ENET); @@ -348,7 +349,7 @@ STATIC err_t eth_netif_output(struct netif *netif, struct pbuf *p) { p = p->next; } status = eth_send_frame_blocking(ENET, &g_handle, tx_frame, length); - } + } return status == kStatus_Success ? ERR_OK : ERR_BUF; } diff --git a/ports/mimxrt/mpconfigport.h b/ports/mimxrt/mpconfigport.h index 4462a18a61..7958874447 100644 --- a/ports/mimxrt/mpconfigport.h +++ b/ports/mimxrt/mpconfigport.h @@ -169,9 +169,11 @@ uint32_t trng_random_u32(void); // For regular code that wants to prevent "background tasks" from running. // These background tasks (LWIP, Bluetooth) run in PENDSV context. // TODO: Check for the settings of the STM32 port in irq.h -#define MICROPY_PY_PENDSV_ENTER uint32_t atomic_state = disable_irq(); -#define MICROPY_PY_PENDSV_REENTER atomic_state = disable_irq(); -#define MICROPY_PY_PENDSV_EXIT enable_irq(atomic_state); +#define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003) +#define IRQ_PRI_PENDSV NVIC_EncodePriority(NVIC_PRIORITYGROUP_4, 15, 0) +#define MICROPY_PY_PENDSV_ENTER uint32_t atomic_state = raise_irq_pri(IRQ_PRI_PENDSV); +#define MICROPY_PY_PENDSV_REENTER atomic_state = raise_irq_pri(IRQ_PRI_PENDSV); +#define MICROPY_PY_PENDSV_EXIT restore_irq_pri(atomic_state); // Use VfsLfs2's types for fileio/textio #define mp_type_fileio mp_type_vfs_lfs2_fileio From e0b97013d0730a70d94922aca168f49b9f456e46 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Fri, 25 Feb 2022 20:18:24 +0100 Subject: [PATCH 0199/1712] mimxrt/hal/pwm_backport: Make PWM symmetric, and round division calcs. Ensure the symmetry of PWM: the duty rate of X and Q channels was not 50%, when it should have been. That is evident at high frequencies, like 15Mhz or 37.5 MHz. At low frequencies the deviation mattered less. The A/B channels were fine. Also round up or down non-integer division factors. Before, always the floor value was used. --- ports/mimxrt/hal/pwm_backport.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/mimxrt/hal/pwm_backport.c b/ports/mimxrt/hal/pwm_backport.c index cea6642120..a4663df4f1 100644 --- a/ports/mimxrt/hal/pwm_backport.c +++ b/ports/mimxrt/hal/pwm_backport.c @@ -53,7 +53,7 @@ void PWM_SetupPwm_u16(PWM_Type *base, pwm_submodule_t subModule, pwm_signal_para // Divide the clock by the prescale value pwmClock = (srcClock_Hz / (1U << ((base->SM[subModule].CTRL & PWM_CTRL_PRSC_MASK) >> PWM_CTRL_PRSC_SHIFT))); - pulseCnt = pwmClock / pwmFreq_Hz; + pulseCnt = (pwmClock + (pwmFreq_Hz - 1) / 2) / pwmFreq_Hz; base->SM[subModule].INIT = 0; base->SM[subModule].VAL1 = pulseCnt - 1; @@ -93,9 +93,9 @@ void PWM_SetupPwmx_u16(PWM_Type *base, pwm_submodule_t subModule, // Divide the clock by the prescale value pwmClock = (srcClock_Hz / (1U << ((base->SM[subModule].CTRL & PWM_CTRL_PRSC_MASK) >> PWM_CTRL_PRSC_SHIFT))); - pulseCnt = pwmClock / pwmFreq_Hz; + pulseCnt = (pwmClock + (pwmFreq_Hz - 1) / 2) / pwmFreq_Hz; base->SM[subModule].INIT = 0; - base->SM[subModule].VAL0 = ((uint32_t)duty_cycle * pulseCnt) / PWM_FULL_SCALE; + base->SM[subModule].VAL0 = ((uint32_t)duty_cycle * pulseCnt) / PWM_FULL_SCALE - 1; base->SM[subModule].VAL1 = pulseCnt - 1; base->SM[subModule].OCTRL = (base->SM[subModule].OCTRL & ~PWM_OCTRL_POLX_MASK) | PWM_OCTRL_POLX(!invert); @@ -137,7 +137,7 @@ status_t QTMR_SetupPwm_u16(TMR_Type *base, qtmr_channel_selection_t channel, uin } // Counter values to generate a PWM signal - periodCount = (srcClock_Hz / pwmFreqHz) - 1; + periodCount = ((srcClock_Hz + (pwmFreqHz - 1) / 2) / pwmFreqHz) - 2; highCount = (periodCount * dutyCycleU16) / PWM_FULL_SCALE; lowCount = periodCount - highCount; From e2513bfe8db91055e443e1804e3abb90c9998d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20de=20Giessen?= Date: Thu, 27 Aug 2020 14:16:48 +0200 Subject: [PATCH 0200/1712] extmod/moduzlib: Fix parsing zlib header dict size. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From RFC 1950 section 2.2: "CINFO is the base-2 logarithm of the LZ77 window size, minus eight (CINFO=7 indicates a 32K window size)" Signed-off-by: Daniël van de Giessen --- extmod/moduzlib.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c index f78c349085..a6874fb4e3 100644 --- a/extmod/moduzlib.c +++ b/extmod/moduzlib.c @@ -77,7 +77,7 @@ STATIC mp_obj_t decompio_make_new(const mp_obj_type_t *type, size_t n_args, size o->eof = false; mp_int_t dict_opt = 0; - int dict_sz; + uint dict_sz; if (n_args > 1) { dict_opt = mp_obj_get_int(args[1]); } @@ -94,7 +94,10 @@ STATIC mp_obj_t decompio_make_new(const mp_obj_type_t *type, size_t n_args, size header_error: mp_raise_ValueError(MP_ERROR_TEXT("compression header")); } - dict_sz = 1 << dict_opt; + // RFC 1950 section 2.2: + // CINFO is the base-2 logarithm of the LZ77 window size, + // minus eight (CINFO=7 indicates a 32K window size) + dict_sz = 1 << (dict_opt + 8); } else { dict_sz = 1 << -dict_opt; } @@ -116,6 +119,7 @@ STATIC mp_uint_t decompio_read(mp_obj_t o_in, void *buf, mp_uint_t size, int *er o->eof = true; } if (st < 0) { + DEBUG_printf("uncompress error=" INT_FMT "\n", st); *errcode = MP_EINVAL; return MP_STREAM_ERROR; } From 507ad03329983551635831c0b5ba76319eaca165 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Wed, 16 Jun 2021 00:55:09 +0200 Subject: [PATCH 0201/1712] rp2: Add USB MSC support. It is currently not enabled by default on any board. --- ports/rp2/CMakeLists.txt | 1 + ports/rp2/boards/PICO/mpconfigboard.h | 3 + ports/rp2/main.c | 4 + ports/rp2/modules/_boot_fat.py | 15 +++ ports/rp2/mpconfigport.h | 16 +++- ports/rp2/msc_disk.c | 127 ++++++++++++++++++++++++++ ports/rp2/tusb_config.h | 9 ++ ports/rp2/tusb_port.c | 19 ++++ 8 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 ports/rp2/modules/_boot_fat.py create mode 100644 ports/rp2/msc_disk.c diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt index 0009ab2cdb..a428b0c39b 100644 --- a/ports/rp2/CMakeLists.txt +++ b/ports/rp2/CMakeLists.txt @@ -105,6 +105,7 @@ set(MICROPY_SOURCE_PORT rp2_pio.c tusb_port.c uart.c + msc_disk.c ) set(MICROPY_SOURCE_QSTR diff --git a/ports/rp2/boards/PICO/mpconfigboard.h b/ports/rp2/boards/PICO/mpconfigboard.h index e6623374d0..0bab214e20 100644 --- a/ports/rp2/boards/PICO/mpconfigboard.h +++ b/ports/rp2/boards/PICO/mpconfigboard.h @@ -1,3 +1,6 @@ // Board and hardware specific configuration #define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico" #define MICROPY_HW_FLASH_STORAGE_BYTES (1408 * 1024) + +// Enable USB Mass Storage with FatFS filesystem. +//#define MICROPY_HW_USB_MSC (1) diff --git a/ports/rp2/main.c b/ports/rp2/main.c index 84f23af23c..02bfb6dae2 100644 --- a/ports/rp2/main.c +++ b/ports/rp2/main.c @@ -116,7 +116,11 @@ int main(int argc, char **argv) { #endif // Execute _boot.py to set up the filesystem. + #if MICROPY_VFS_FAT && MICROPY_HW_USB_MSC + pyexec_frozen_module("_boot_fat.py"); + #else pyexec_frozen_module("_boot.py"); + #endif // Execute user scripts. int ret = pyexec_file_if_exists("boot.py"); diff --git a/ports/rp2/modules/_boot_fat.py b/ports/rp2/modules/_boot_fat.py new file mode 100644 index 0000000000..02a2df9bab --- /dev/null +++ b/ports/rp2/modules/_boot_fat.py @@ -0,0 +1,15 @@ +import os +import machine, rp2 + + +# Try to mount the filesystem, and format the flash if it doesn't exist. +bdev = rp2.Flash() +try: + vfs = os.VfsFat(bdev) + os.mount(vfs, "/") +except: + os.VfsFat.mkfs(bdev) + vfs = os.VfsFat(bdev) +os.mount(vfs, "/") + +del os, bdev, vfs diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h index 1ff9d5b511..9e839766eb 100644 --- a/ports/rp2/mpconfigport.h +++ b/ports/rp2/mpconfigport.h @@ -30,8 +30,10 @@ #include "hardware/spi.h" #include "hardware/sync.h" #include "pico/binary_info.h" - #include "mpconfigboard.h" +#if MICROPY_HW_USB_MSC +#include "hardware/flash.h" +#endif // Board and hardware specific configuration #define MICROPY_HW_MCU_NAME "RP2040" @@ -107,10 +109,22 @@ #define MICROPY_FATFS_ENABLE_LFN (1) #define MICROPY_FATFS_LFN_CODE_PAGE 437 /* 1=SFN/ANSI 437=LFN/U.S.(OEM) */ #define MICROPY_FATFS_RPATH (2) +#if MICROPY_HW_USB_MSC +#define MICROPY_FATFS_USE_LABEL (1) +#define MICROPY_FATFS_MULTI_PARTITION (1) +// Set FatFS block size to flash sector size to avoid caching +// the flash sector in memory to support smaller block sizes. +#define MICROPY_FATFS_MAX_SS (FLASH_SECTOR_SIZE) +#endif +#if MICROPY_VFS_FAT && MICROPY_HW_USB_MSC +#define mp_type_fileio mp_type_vfs_fat_fileio +#define mp_type_textio mp_type_vfs_fat_textio +#elif MICROPY_VFS_LFS2 // Use VfsLfs2's types for fileio/textio #define mp_type_fileio mp_type_vfs_lfs2_fileio #define mp_type_textio mp_type_vfs_lfs2_textio +#endif // Use VFS's functions for import stat and builtin open #define mp_import_stat mp_vfs_import_stat diff --git a/ports/rp2/msc_disk.c b/ports/rp2/msc_disk.c new file mode 100644 index 0000000000..24bd51cec3 --- /dev/null +++ b/ports/rp2/msc_disk.c @@ -0,0 +1,127 @@ +/* + * The MIT License (MIT) + * + * Copyright (c) 2020-2021 Damien P. George + * + * 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 "tusb.h" +#if CFG_TUD_MSC +#include "mpconfigboard.h" +#include "hardware/flash.h" +#include "hardware/sync.h" +#include "pico/stdlib.h" + +// This implementation does Not support Flash sector caching. +#if MICROPY_FATFS_MAX_SS != FLASH_SECTOR_SIZE +#error MICROPY_FATFS_MAX_SS must be the same size as FLASH_SECTOR_SIZE +#endif + +#define BLOCK_SIZE (FLASH_SECTOR_SIZE) +#define BLOCK_COUNT (MICROPY_HW_FLASH_STORAGE_BYTES / BLOCK_SIZE) +#define FLASH_BASE_ADDR (PICO_FLASH_SIZE_BYTES - MICROPY_HW_FLASH_STORAGE_BYTES) +#define FLASH_MMAP_ADDR (XIP_BASE + FLASH_BASE_ADDR) + +static bool ejected = false; + +// Invoked when received SCSI_CMD_INQUIRY +// Application fill vendor id, product id and revision with string up to 8, 16, 4 characters respectively +void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]) { + const char vid[] = "Micropy"; + const char pid[] = "Mass Storage"; + const char rev[] = "1.0"; + + strncpy((char *)vendor_id, vid, 8); + strncpy((char *)product_id, pid, 16); + strncpy((char *)product_rev, rev, 4); +} + +// Invoked when received Test Unit Ready command. +// return true allowing host to read/write this LUN e.g SD card inserted +bool tud_msc_test_unit_ready_cb(uint8_t lun) { + if (ejected) { + tud_msc_set_sense(lun, SCSI_SENSE_NOT_READY, 0x3a, 0x00); + return false; + } + return true; +} + +// Invoked when received SCSI_CMD_READ_CAPACITY_10 and SCSI_CMD_READ_FORMAT_CAPACITY to determine the disk size +// Application update block count and block size +void tud_msc_capacity_cb(uint8_t lun, uint32_t *block_count, uint16_t *block_size) { + *block_size = BLOCK_SIZE; + *block_count = BLOCK_COUNT; +} + +// Invoked when received Start Stop Unit command +// - Start = 0 : stopped power mode, if load_eject = 1 : unload disk storage +// - Start = 1 : active mode, if load_eject = 1 : load disk storage +bool tud_msc_start_stop_cb(uint8_t lun, uint8_t power_condition, bool start, bool load_eject) { + if (load_eject) { + if (start) { + // load disk storage + ejected = false; + } else { + // unload disk storage + ejected = true; + } + } + return true; +} + +// Callback invoked when received READ10 command. +// Copy disk's data to buffer (up to bufsize) and return number of copied bytes. +int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void *buffer, uint32_t bufsize) { + uint32_t count = bufsize / BLOCK_SIZE; + memcpy(buffer, (void *)(FLASH_MMAP_ADDR + lba * BLOCK_SIZE), count * BLOCK_SIZE); + return count * BLOCK_SIZE; +} + +// Callback invoked when received WRITE10 command. +// Process data in buffer to disk's storage and return number of written bytes +int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t *buffer, uint32_t bufsize) { + uint32_t count = bufsize / BLOCK_SIZE; + uint32_t ints = save_and_disable_interrupts(); + flash_range_erase(FLASH_BASE_ADDR + lba * BLOCK_SIZE, count * BLOCK_SIZE); + flash_range_program(FLASH_BASE_ADDR + lba * BLOCK_SIZE, buffer, count * BLOCK_SIZE); + restore_interrupts(ints); + return count * BLOCK_SIZE; +} + +// Callback invoked when received an SCSI command not in built-in list below +// - READ_CAPACITY10, READ_FORMAT_CAPACITY, INQUIRY, MODE_SENSE6, REQUEST_SENSE +// - READ10 and WRITE10 has their own callbacks +int32_t tud_msc_scsi_cb(uint8_t lun, uint8_t const scsi_cmd[16], void *buffer, uint16_t bufsize) { + int32_t resplen = 0; + switch (scsi_cmd[0]) { + case SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL: + // Sync the logical unit if needed. + break; + + default: + // Set Sense = Invalid Command Operation + tud_msc_set_sense(lun, SCSI_SENSE_ILLEGAL_REQUEST, 0x20, 0x00); + // negative means error -> tinyusb could stall and/or response with failed status + resplen = -1; + break; + } + return resplen; +} +#endif diff --git a/ports/rp2/tusb_config.h b/ports/rp2/tusb_config.h index 8c2a9f7560..ce321616a6 100644 --- a/ports/rp2/tusb_config.h +++ b/ports/rp2/tusb_config.h @@ -25,6 +25,8 @@ #ifndef MICROPY_INCLUDED_RP2_TUSB_CONFIG_H #define MICROPY_INCLUDED_RP2_TUSB_CONFIG_H +#include "mpconfigport.h" + #define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE) #define CFG_TUD_CDC (1) @@ -32,4 +34,11 @@ #define CFG_TUD_CDC_RX_BUFSIZE (256) #define CFG_TUD_CDC_TX_BUFSIZE (256) +#if MICROPY_HW_USB_MSC +// Board and hardware specific configuration +#define CFG_TUD_MSC (1) +// Set MSC EP buffer size to FatFS block size to avoid partial read/writes (offset arg). +#define CFG_TUD_MSC_BUFSIZE (MICROPY_FATFS_MAX_SS) +#endif + #endif // MICROPY_INCLUDED_RP2_TUSB_CONFIG_H diff --git a/ports/rp2/tusb_port.c b/ports/rp2/tusb_port.c index 8896be9077..4aac08791e 100644 --- a/ports/rp2/tusb_port.c +++ b/ports/rp2/tusb_port.c @@ -34,11 +34,20 @@ #define MICROPY_HW_USB_PID (0x0005) // RP2 MicroPython #endif +#if CFG_TUD_MSC +#define USBD_DESC_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN + TUD_MSC_DESC_LEN) +#else #define USBD_DESC_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN) +#endif #define USBD_MAX_POWER_MA (250) #define USBD_ITF_CDC (0) // needs 2 interfaces +#define USBD_ITF_MSC (2) +#if CFG_TUD_MSC +#define USBD_ITF_MAX (3) +#else #define USBD_ITF_MAX (2) +#endif #define USBD_CDC_EP_CMD (0x81) #define USBD_CDC_EP_OUT (0x02) @@ -46,11 +55,15 @@ #define USBD_CDC_CMD_MAX_SIZE (8) #define USBD_CDC_IN_OUT_MAX_SIZE (64) +#define EPNUM_MSC_OUT (0x03) +#define EPNUM_MSC_IN (0x83) + #define USBD_STR_0 (0x00) #define USBD_STR_MANUF (0x01) #define USBD_STR_PRODUCT (0x02) #define USBD_STR_SERIAL (0x03) #define USBD_STR_CDC (0x04) +#define USBD_STR_MSC (0x05) // Note: descriptors returned from callbacks must exist long enough for transfer to complete @@ -77,6 +90,9 @@ static const uint8_t usbd_desc_cfg[USBD_DESC_LEN] = { TUD_CDC_DESCRIPTOR(USBD_ITF_CDC, USBD_STR_CDC, USBD_CDC_EP_CMD, USBD_CDC_CMD_MAX_SIZE, USBD_CDC_EP_OUT, USBD_CDC_EP_IN, USBD_CDC_IN_OUT_MAX_SIZE), + #if CFG_TUD_MSC + TUD_MSC_DESCRIPTOR(USBD_ITF_MSC, 5, EPNUM_MSC_OUT, EPNUM_MSC_IN, 64), + #endif }; static const char *const usbd_desc_str[] = { @@ -84,6 +100,9 @@ static const char *const usbd_desc_str[] = { [USBD_STR_PRODUCT] = "Board in FS mode", [USBD_STR_SERIAL] = NULL, // generated dynamically [USBD_STR_CDC] = "Board CDC", + #if CFG_TUD_MSC + [USBD_STR_MSC] = "Board MSC", + #endif }; const uint8_t *tud_descriptor_device_cb(void) { From 926b554dafffa1e9bd80aa12fea5c621221c9d79 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Mar 2022 17:59:30 +1100 Subject: [PATCH 0202/1712] extmod/moduos: Create general uos module to be used by all ports. Based on the rp2 port version, with the rp2 port converted to use this module. Signed-off-by: Damien George --- extmod/extmod.cmake | 1 + extmod/moduos.c | 134 ++++++++++++++++++++++++++++++++++++ ports/esp32/mpconfigport.h | 1 + ports/rp2/CMakeLists.txt | 1 - ports/rp2/moduos.c | 82 +--------------------- ports/rp2/mpconfigport.h | 4 +- ports/zephyr/moduos.c | 4 +- ports/zephyr/mpconfigport.h | 4 +- py/builtin.h | 1 + py/mpconfig.h | 4 ++ py/objmodule.c | 3 + 11 files changed, 152 insertions(+), 87 deletions(-) create mode 100644 extmod/moduos.c diff --git a/extmod/extmod.cmake b/extmod/extmod.cmake index 67f7d8fd39..9c05237774 100644 --- a/extmod/extmod.cmake +++ b/extmod/extmod.cmake @@ -25,6 +25,7 @@ set(MICROPY_SOURCE_EXTMOD ${MICROPY_EXTMOD_DIR}/moduhashlib.c ${MICROPY_EXTMOD_DIR}/moduheapq.c ${MICROPY_EXTMOD_DIR}/modujson.c + ${MICROPY_EXTMOD_DIR}/moduos.c ${MICROPY_EXTMOD_DIR}/moduplatform.c ${MICROPY_EXTMOD_DIR}/modurandom.c ${MICROPY_EXTMOD_DIR}/modure.c diff --git a/extmod/moduos.c b/extmod/moduos.c new file mode 100644 index 0000000000..6dcead0fc4 --- /dev/null +++ b/extmod/moduos.c @@ -0,0 +1,134 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016-2022 Damien P. George + * + * 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/objstr.h" +#include "py/runtime.h" + +#if MICROPY_PY_UOS + +#include "extmod/misc.h" +#include "extmod/vfs.h" + +#if MICROPY_VFS_FAT +#include "extmod/vfs_fat.h" +#endif + +#if MICROPY_VFS_LFS1 || MICROPY_VFS_LFS2 +#include "extmod/vfs_lfs.h" +#endif + +#if MICROPY_PY_UOS_UNAME +#include "genhdr/mpversion.h" +#endif + +#ifdef MICROPY_PY_UOS_INCLUDEFILE +#include MICROPY_PY_UOS_INCLUDEFILE +#endif + +#ifdef MICROPY_BUILD_TYPE +#define MICROPY_BUILD_TYPE_PAREN " (" MICROPY_BUILD_TYPE ")" +#else +#define MICROPY_BUILD_TYPE_PAREN +#endif + +STATIC const qstr mp_uos_uname_info_fields[] = { + MP_QSTR_sysname, + MP_QSTR_nodename, + MP_QSTR_release, + MP_QSTR_version, + MP_QSTR_machine +}; +STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM); +STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_nodename_obj, MICROPY_PY_SYS_PLATFORM); +STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_release_obj, MICROPY_VERSION_STRING); +STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE MICROPY_BUILD_TYPE_PAREN); +STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME); + +STATIC MP_DEFINE_ATTRTUPLE( + mp_uos_uname_info_obj, + mp_uos_uname_info_fields, + 5, + MP_ROM_PTR(&mp_uos_uname_info_sysname_obj), + MP_ROM_PTR(&mp_uos_uname_info_nodename_obj), + MP_ROM_PTR(&mp_uos_uname_info_release_obj), + MP_ROM_PTR(&mp_uos_uname_info_version_obj), + MP_ROM_PTR(&mp_uos_uname_info_machine_obj) + ); + +STATIC mp_obj_t mp_uos_uname(void) { + return MP_OBJ_FROM_PTR(&mp_uos_uname_info_obj); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_uos_uname_obj, mp_uos_uname); + +STATIC const mp_rom_map_elem_t os_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, + + { MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&mp_uos_uname_obj) }, + #if MICROPY_PY_UOS_URANDOM + { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mp_uos_urandom_obj) }, + #endif + + #if MICROPY_VFS + { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, + { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, + { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mp_vfs_rename_obj) }, + { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, + { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, + #endif + + // The following are MicroPython extensions. + + #if MICROPY_PY_OS_DUPTERM + { MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&mp_uos_dupterm_obj) }, + #endif + + #if MICROPY_VFS + { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, + { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, + #if MICROPY_VFS_FAT + { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, + #endif + #if MICROPY_VFS_LFS1 + { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, + #endif + #if MICROPY_VFS_LFS2 + { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, + #endif + #endif +}; +STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); + +const mp_obj_module_t mp_module_uos = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&os_module_globals, +}; + +#endif // MICROPY_PY_UOS diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h index d4f542f668..c820e526a2 100644 --- a/ports/esp32/mpconfigport.h +++ b/ports/esp32/mpconfigport.h @@ -72,6 +72,7 @@ #define MICROPY_PY_UHASHLIB_SHA256 (1) #define MICROPY_PY_UCRYPTOLIB (1) #define MICROPY_PY_URANDOM_SEED_INIT_FUNC (esp_random()) +#define MICROPY_PY_UOS (0) #define MICROPY_PY_OS_DUPTERM (1) #define MICROPY_PY_MACHINE (1) #define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt index a428b0c39b..0ceb039675 100644 --- a/ports/rp2/CMakeLists.txt +++ b/ports/rp2/CMakeLists.txt @@ -97,7 +97,6 @@ set(MICROPY_SOURCE_PORT main.c modmachine.c modrp2.c - moduos.c modutime.c mphalport.c mpthreadport.c diff --git a/ports/rp2/moduos.c b/ports/rp2/moduos.c index a9dc30df89..6288ff5696 100644 --- a/ports/rp2/moduos.c +++ b/ports/rp2/moduos.c @@ -24,43 +24,11 @@ * THE SOFTWARE. */ -#include "py/objstr.h" #include "py/runtime.h" -#include "extmod/misc.h" -#include "extmod/vfs.h" -#include "extmod/vfs_fat.h" -#include "extmod/vfs_lfs.h" -#include "genhdr/mpversion.h" uint8_t rosc_random_u8(size_t cycles); -STATIC const qstr os_uname_info_fields[] = { - MP_QSTR_sysname, MP_QSTR_nodename, - MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine -}; -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_PY_SYS_PLATFORM); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE " (" MICROPY_BUILD_TYPE ")"); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME); - -STATIC MP_DEFINE_ATTRTUPLE( - os_uname_info_obj, - os_uname_info_fields, - 5, - (mp_obj_t)&os_uname_info_sysname_obj, - (mp_obj_t)&os_uname_info_nodename_obj, - (mp_obj_t)&os_uname_info_release_obj, - (mp_obj_t)&os_uname_info_version_obj, - (mp_obj_t)&os_uname_info_machine_obj - ); - -STATIC mp_obj_t os_uname(void) { - return (mp_obj_t)&os_uname_info_obj; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname); - -STATIC mp_obj_t os_urandom(mp_obj_t num) { +STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); vstr_t vstr; vstr_init_len(&vstr, n); @@ -69,50 +37,4 @@ STATIC mp_obj_t os_urandom(mp_obj_t num) { } return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_urandom_obj, os_urandom); - -STATIC const mp_rom_map_elem_t os_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, - - { MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&os_uname_obj) }, - { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&os_urandom_obj) }, - - #if MICROPY_VFS - { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, - { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mp_vfs_rename_obj) }, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, - #endif - - // The following are MicroPython extensions. - - #if MICROPY_PY_OS_DUPTERM - { MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&mp_uos_dupterm_obj) }, - #endif - - #if MICROPY_VFS - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, - { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, - #if MICROPY_VFS_FAT - { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, - #endif - #if MICROPY_VFS_LFS1 - { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, - #endif - #if MICROPY_VFS_LFS2 - { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, - #endif - #endif -}; -STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); - -const mp_obj_module_t mp_module_uos = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&os_module_globals, -}; +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom); diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h index 9e839766eb..5e78018ea3 100644 --- a/ports/rp2/mpconfigport.h +++ b/ports/rp2/mpconfigport.h @@ -83,6 +83,8 @@ // Extended modules #define MICROPY_EPOCH_IS_1970 (1) +#define MICROPY_PY_UOS_INCLUDEFILE "ports/rp2/moduos.c" +#define MICROPY_PY_UOS_URANDOM (1) #define MICROPY_PY_URE_MATCH_GROUPS (1) #define MICROPY_PY_URE_MATCH_SPAN_START_END (1) #define MICROPY_PY_UTIME_MP_HAL (1) @@ -138,7 +140,6 @@ extern const struct _mp_obj_module_t mp_module_network; extern const struct _mp_obj_module_t mp_module_onewire; extern const struct _mp_obj_module_t mp_module_rp2; -extern const struct _mp_obj_module_t mp_module_uos; extern const struct _mp_obj_module_t mp_module_usocket; extern const struct _mp_obj_module_t mp_module_utime; @@ -186,7 +187,6 @@ extern const struct _mod_network_nic_type_t mod_network_nic_type_nina; #define MICROPY_PORT_BUILTIN_MODULES \ { MP_OBJ_NEW_QSTR(MP_QSTR__onewire), (mp_obj_t)&mp_module_onewire }, \ { MP_OBJ_NEW_QSTR(MP_QSTR__rp2), (mp_obj_t)&mp_module_rp2 }, \ - { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \ { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \ SOCKET_BUILTIN_MODULE \ NETWORK_BUILTIN_MODULE \ diff --git a/ports/zephyr/moduos.c b/ports/zephyr/moduos.c index 49d5744af4..4d1eeb667e 100644 --- a/ports/zephyr/moduos.c +++ b/ports/zephyr/moduos.c @@ -36,7 +36,7 @@ #include "extmod/vfs_lfs.h" #endif -#if MICROPY_PY_UOS +#if MICROPY_PY_UOS_ZEPHYR STATIC const mp_rom_map_elem_t uos_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, @@ -72,4 +72,4 @@ const mp_obj_module_t mp_module_uos = { .globals = (mp_obj_dict_t *)&uos_module_globals, }; -#endif // MICROPY_PY_UOS +#endif // MICROPY_PY_UOS_ZEPHYR diff --git a/ports/zephyr/mpconfigport.h b/ports/zephyr/mpconfigport.h index b8e25faefd..fe124bace0 100644 --- a/ports/zephyr/mpconfigport.h +++ b/ports/zephyr/mpconfigport.h @@ -83,7 +83,7 @@ #endif #define MICROPY_PY_UBINASCII (1) #define MICROPY_PY_UHASHLIB (1) -#define MICROPY_PY_UOS (1) +#define MICROPY_PY_UOS_ZEPHYR (1) #define MICROPY_PY_UTIME (1) #define MICROPY_PY_UTIME_MP_HAL (1) #define MICROPY_PY_ZEPHYR (1) @@ -144,7 +144,7 @@ extern const struct _mp_obj_module_t mp_module_usocket; extern const struct _mp_obj_module_t mp_module_zephyr; extern const struct _mp_obj_module_t mp_module_zsensor; -#if MICROPY_PY_UOS +#if MICROPY_PY_UOS_ZEPHYR #define MICROPY_PY_UOS_DEF { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, #else #define MICROPY_PY_UOS_DEF diff --git a/py/builtin.h b/py/builtin.h index 8639e978ff..162fed77cc 100644 --- a/py/builtin.h +++ b/py/builtin.h @@ -108,6 +108,7 @@ extern const mp_obj_module_t mp_module_uerrno; extern const mp_obj_module_t mp_module_uctypes; extern const mp_obj_module_t mp_module_uzlib; extern const mp_obj_module_t mp_module_ujson; +extern const mp_obj_module_t mp_module_uos; extern const mp_obj_module_t mp_module_ure; extern const mp_obj_module_t mp_module_uheapq; extern const mp_obj_module_t mp_module_uhashlib; diff --git a/py/mpconfig.h b/py/mpconfig.h index 5edff69dfd..8f9f0f02fb 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1455,6 +1455,10 @@ typedef double mp_float_t; #define MICROPY_PY_UJSON_SEPARATORS (1) #endif +#ifndef MICROPY_PY_UOS +#define MICROPY_PY_UOS (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) +#endif + #ifndef MICROPY_PY_URE #define MICROPY_PY_URE (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) #endif diff --git a/py/objmodule.c b/py/objmodule.c index 4b04f7ca9c..f7cd437bac 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -190,6 +190,9 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = { #if MICROPY_PY_UJSON { MP_ROM_QSTR(MP_QSTR_ujson), MP_ROM_PTR(&mp_module_ujson) }, #endif + #if MICROPY_PY_UOS + { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, + #endif #if MICROPY_PY_URE { MP_ROM_QSTR(MP_QSTR_ure), MP_ROM_PTR(&mp_module_ure) }, #endif From 1c53d85162007750d0708cf665a8bb7c062053be Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Mar 2022 19:09:01 +1100 Subject: [PATCH 0203/1712] esp32/moduos: Convert module to use extmod version. Signed-off-by: Damien George --- extmod/moduos.c | 3 ++ ports/esp32/main/CMakeLists.txt | 1 - ports/esp32/moduos.c | 86 ++------------------------------- ports/esp32/mpconfigport.h | 6 +-- 4 files changed, 11 insertions(+), 85 deletions(-) diff --git a/extmod/moduos.c b/extmod/moduos.c index 6dcead0fc4..87e2fcc703 100644 --- a/extmod/moduos.c +++ b/extmod/moduos.c @@ -108,6 +108,9 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { #if MICROPY_PY_OS_DUPTERM { MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&mp_uos_dupterm_obj) }, #endif + #if MICROPY_PY_UOS_DUPTERM_NOTIFY + { MP_ROM_QSTR(MP_QSTR_dupterm_notify), MP_ROM_PTR(&mp_uos_dupterm_notify_obj) }, + #endif #if MICROPY_VFS { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, diff --git a/ports/esp32/main/CMakeLists.txt b/ports/esp32/main/CMakeLists.txt index c86ac4dadf..ab333c3290 100644 --- a/ports/esp32/main/CMakeLists.txt +++ b/ports/esp32/main/CMakeLists.txt @@ -53,7 +53,6 @@ set(MICROPY_SOURCE_PORT ${PROJECT_DIR}/fatfs_port.c ${PROJECT_DIR}/help.c ${PROJECT_DIR}/modutime.c - ${PROJECT_DIR}/moduos.c ${PROJECT_DIR}/machine_bitstream.c ${PROJECT_DIR}/machine_timer.c ${PROJECT_DIR}/machine_pin.c diff --git a/ports/esp32/moduos.c b/ports/esp32/moduos.c index 50c0d7ea5c..f307a9ffe0 100644 --- a/ports/esp32/moduos.c +++ b/ports/esp32/moduos.c @@ -27,49 +27,13 @@ * THE SOFTWARE. */ -#include - #include "esp_system.h" -#include "py/objstr.h" #include "py/runtime.h" -#include "py/mperrno.h" #include "py/mphal.h" #include "extmod/misc.h" -#include "extmod/vfs.h" -#include "extmod/vfs_fat.h" -#include "extmod/vfs_lfs.h" -#include "genhdr/mpversion.h" -extern const mp_obj_type_t mp_fat_vfs_type; - -STATIC const qstr os_uname_info_fields[] = { - MP_QSTR_sysname, MP_QSTR_nodename, - MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine -}; -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_PY_SYS_PLATFORM); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME); - -STATIC MP_DEFINE_ATTRTUPLE( - os_uname_info_obj, - os_uname_info_fields, - 5, - (mp_obj_t)&os_uname_info_sysname_obj, - (mp_obj_t)&os_uname_info_nodename_obj, - (mp_obj_t)&os_uname_info_release_obj, - (mp_obj_t)&os_uname_info_version_obj, - (mp_obj_t)&os_uname_info_machine_obj - ); - -STATIC mp_obj_t os_uname(void) { - return (mp_obj_t)&os_uname_info_obj; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname); - -STATIC mp_obj_t os_urandom(mp_obj_t num) { +STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); vstr_t vstr; vstr_init_len(&vstr, n); @@ -83,10 +47,10 @@ STATIC mp_obj_t os_urandom(mp_obj_t num) { } return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_urandom_obj, os_urandom); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom); -#if MICROPY_PY_OS_DUPTERM -STATIC mp_obj_t os_dupterm_notify(mp_obj_t obj_in) { +#if MICROPY_PY_UOS_DUPTERM_NOTIFY +STATIC mp_obj_t mp_uos_dupterm_notify(mp_obj_t obj_in) { (void)obj_in; for (;;) { int c = mp_uos_dupterm_rx_chr(); @@ -97,45 +61,5 @@ STATIC mp_obj_t os_dupterm_notify(mp_obj_t obj_in) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_dupterm_notify_obj, os_dupterm_notify); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_dupterm_notify_obj, mp_uos_dupterm_notify); #endif - -STATIC const mp_rom_map_elem_t os_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, - { MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&os_uname_obj) }, - { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&os_urandom_obj) }, - #if MICROPY_PY_OS_DUPTERM - { MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&mp_uos_dupterm_obj) }, - { MP_ROM_QSTR(MP_QSTR_dupterm_notify), MP_ROM_PTR(&os_dupterm_notify_obj) }, - #endif - #if MICROPY_VFS - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mp_vfs_rename_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, - { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, - { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, - #if MICROPY_VFS_FAT - { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, - #endif - #if MICROPY_VFS_LFS1 - { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, - #endif - #if MICROPY_VFS_LFS2 - { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, - #endif - #endif -}; - -STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); - -const mp_obj_module_t uos_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&os_module_globals, -}; diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h index c820e526a2..e06ee94d52 100644 --- a/ports/esp32/mpconfigport.h +++ b/ports/esp32/mpconfigport.h @@ -72,8 +72,10 @@ #define MICROPY_PY_UHASHLIB_SHA256 (1) #define MICROPY_PY_UCRYPTOLIB (1) #define MICROPY_PY_URANDOM_SEED_INIT_FUNC (esp_random()) -#define MICROPY_PY_UOS (0) +#define MICROPY_PY_UOS_INCLUDEFILE "ports/esp32/moduos.c" #define MICROPY_PY_OS_DUPTERM (1) +#define MICROPY_PY_UOS_DUPTERM_NOTIFY (1) +#define MICROPY_PY_UOS_URANDOM (1) #define MICROPY_PY_MACHINE (1) #define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new #define MICROPY_PY_MACHINE_BITSTREAM (1) @@ -137,7 +139,6 @@ extern const struct _mp_obj_module_t esp_module; extern const struct _mp_obj_module_t esp32_module; extern const struct _mp_obj_module_t utime_module; -extern const struct _mp_obj_module_t uos_module; extern const struct _mp_obj_module_t mp_module_usocket; extern const struct _mp_obj_module_t mp_module_network; extern const struct _mp_obj_module_t mp_module_onewire; @@ -146,7 +147,6 @@ extern const struct _mp_obj_module_t mp_module_onewire; { MP_OBJ_NEW_QSTR(MP_QSTR_esp), (mp_obj_t)&esp_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_esp32), (mp_obj_t)&esp32_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_utime), (mp_obj_t)&utime_module }, \ - { MP_OBJ_NEW_QSTR(MP_QSTR_uos), (mp_obj_t)&uos_module }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_usocket), (mp_obj_t)&mp_module_usocket }, \ { MP_OBJ_NEW_QSTR(MP_QSTR_network), (mp_obj_t)&mp_module_network }, \ { MP_OBJ_NEW_QSTR(MP_QSTR__onewire), (mp_obj_t)&mp_module_onewire }, \ From 818be10bb557b6a8b975b414dd26d09dd50a7760 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Mar 2022 19:17:12 +1100 Subject: [PATCH 0204/1712] zephyr/moduos: Convert module to use extmod version. This also adds uos.unlink(), for all ports that use extmod/moduos.c. Signed-off-by: Damien George --- extmod/moduos.c | 5 +++ ports/esp32/mpconfigport.h | 1 + ports/rp2/mpconfigport.h | 1 + ports/zephyr/CMakeLists.txt | 1 - ports/zephyr/moduos.c | 75 ------------------------------------- ports/zephyr/mpconfigport.h | 10 +---- 6 files changed, 8 insertions(+), 85 deletions(-) delete mode 100644 ports/zephyr/moduos.c diff --git a/extmod/moduos.c b/extmod/moduos.c index 87e2fcc703..0378d50302 100644 --- a/extmod/moduos.c +++ b/extmod/moduos.c @@ -54,6 +54,7 @@ #define MICROPY_BUILD_TYPE_PAREN #endif +#if MICROPY_PY_UOS_UNAME STATIC const qstr mp_uos_uname_info_fields[] = { MP_QSTR_sysname, MP_QSTR_nodename, @@ -82,11 +83,14 @@ STATIC mp_obj_t mp_uos_uname(void) { return MP_OBJ_FROM_PTR(&mp_uos_uname_info_obj); } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_uos_uname_obj, mp_uos_uname); +#endif STATIC const mp_rom_map_elem_t os_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, + #if MICROPY_PY_UOS_UNAME { MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&mp_uos_uname_obj) }, + #endif #if MICROPY_PY_UOS_URANDOM { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mp_uos_urandom_obj) }, #endif @@ -101,6 +105,7 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, + { MP_ROM_QSTR(MP_QSTR_unlink), MP_ROM_PTR(&mp_vfs_remove_obj) }, // unlink aliases to remove #endif // The following are MicroPython extensions. diff --git a/ports/esp32/mpconfigport.h b/ports/esp32/mpconfigport.h index e06ee94d52..ffc155360a 100644 --- a/ports/esp32/mpconfigport.h +++ b/ports/esp32/mpconfigport.h @@ -75,6 +75,7 @@ #define MICROPY_PY_UOS_INCLUDEFILE "ports/esp32/moduos.c" #define MICROPY_PY_OS_DUPTERM (1) #define MICROPY_PY_UOS_DUPTERM_NOTIFY (1) +#define MICROPY_PY_UOS_UNAME (1) #define MICROPY_PY_UOS_URANDOM (1) #define MICROPY_PY_MACHINE (1) #define MICROPY_PY_MACHINE_PIN_MAKE_NEW mp_pin_make_new diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h index 5e78018ea3..1fb0211e88 100644 --- a/ports/rp2/mpconfigport.h +++ b/ports/rp2/mpconfigport.h @@ -84,6 +84,7 @@ // Extended modules #define MICROPY_EPOCH_IS_1970 (1) #define MICROPY_PY_UOS_INCLUDEFILE "ports/rp2/moduos.c" +#define MICROPY_PY_UOS_UNAME (1) #define MICROPY_PY_UOS_URANDOM (1) #define MICROPY_PY_URE_MATCH_GROUPS (1) #define MICROPY_PY_URE_MATCH_SPAN_START_END (1) diff --git a/ports/zephyr/CMakeLists.txt b/ports/zephyr/CMakeLists.txt index d809b7007d..bd5068faf3 100644 --- a/ports/zephyr/CMakeLists.txt +++ b/ports/zephyr/CMakeLists.txt @@ -43,7 +43,6 @@ set(MICROPY_SOURCE_PORT machine_uart.c modbluetooth_zephyr.c modmachine.c - moduos.c modusocket.c modutime.c modzephyr.c diff --git a/ports/zephyr/moduos.c b/ports/zephyr/moduos.c deleted file mode 100644 index 4d1eeb667e..0000000000 --- a/ports/zephyr/moduos.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2019 NXP - * - * 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/obj.h" - -#include "extmod/vfs.h" - -#if MICROPY_VFS_FAT -#include "extmod/vfs_fat.h" -#endif - -#if MICROPY_VFS_LFS1 || MICROPY_VFS_LFS2 -#include "extmod/vfs_lfs.h" -#endif - -#if MICROPY_PY_UOS_ZEPHYR - -STATIC const mp_rom_map_elem_t uos_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, - #if MICROPY_VFS - { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename),MP_ROM_PTR(&mp_vfs_rename_obj)}, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, - { MP_ROM_QSTR(MP_QSTR_unlink), MP_ROM_PTR(&mp_vfs_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, - { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, - #endif - #if MICROPY_VFS_FAT - { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, - #endif - #if MICROPY_VFS_LFS1 - { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, - #endif - #if MICROPY_VFS_LFS2 - { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, - #endif -}; -STATIC MP_DEFINE_CONST_DICT(uos_module_globals, uos_module_globals_table); - -const mp_obj_module_t mp_module_uos = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&uos_module_globals, -}; - -#endif // MICROPY_PY_UOS_ZEPHYR diff --git a/ports/zephyr/mpconfigport.h b/ports/zephyr/mpconfigport.h index fe124bace0..fa1cb56ae6 100644 --- a/ports/zephyr/mpconfigport.h +++ b/ports/zephyr/mpconfigport.h @@ -83,7 +83,7 @@ #endif #define MICROPY_PY_UBINASCII (1) #define MICROPY_PY_UHASHLIB (1) -#define MICROPY_PY_UOS_ZEPHYR (1) +#define MICROPY_PY_UOS (1) #define MICROPY_PY_UTIME (1) #define MICROPY_PY_UTIME_MP_HAL (1) #define MICROPY_PY_ZEPHYR (1) @@ -139,17 +139,10 @@ typedef long mp_off_t; struct _mp_bluetooth_zephyr_root_pointers_t *bluetooth_zephyr_root_pointers; extern const struct _mp_obj_module_t mp_module_time; -extern const struct _mp_obj_module_t mp_module_uos; extern const struct _mp_obj_module_t mp_module_usocket; extern const struct _mp_obj_module_t mp_module_zephyr; extern const struct _mp_obj_module_t mp_module_zsensor; -#if MICROPY_PY_UOS_ZEPHYR -#define MICROPY_PY_UOS_DEF { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, -#else -#define MICROPY_PY_UOS_DEF -#endif - #if MICROPY_PY_USOCKET #define MICROPY_PY_USOCKET_DEF { MP_ROM_QSTR(MP_QSTR_usocket), MP_ROM_PTR(&mp_module_usocket) }, #else @@ -175,7 +168,6 @@ extern const struct _mp_obj_module_t mp_module_zsensor; #endif #define MICROPY_PORT_BUILTIN_MODULES \ - MICROPY_PY_UOS_DEF \ MICROPY_PY_USOCKET_DEF \ MICROPY_PY_UTIME_DEF \ MICROPY_PY_ZEPHYR_DEF \ From 94077c6402f6fc1cbd70abcbb3a1960c94495ca7 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Mar 2022 19:30:58 +1100 Subject: [PATCH 0205/1712] samd/moduos: Convert module to use extmod version. Signed-off-by: Damien George --- ports/samd/Makefile | 3 +- ports/samd/moduos.c | 75 -------------------------------------- ports/stm32/mpconfigport.h | 7 ++-- py/py.mk | 1 + 4 files changed, 6 insertions(+), 80 deletions(-) delete mode 100644 ports/samd/moduos.c diff --git a/ports/samd/Makefile b/ports/samd/Makefile index 8476eea4b8..ab74b80c16 100644 --- a/ports/samd/Makefile +++ b/ports/samd/Makefile @@ -75,7 +75,6 @@ endif SRC_C = \ main.c \ help.c \ - moduos.c \ modutime.c \ modmachine.c \ $(BOARD_DIR)/pins.c \ @@ -120,7 +119,7 @@ SRC_S = shared/runtime/gchelper_m3.s endif # List of sources for qstr extraction -SRC_QSTR += moduos.c \ +SRC_QSTR += \ modutime.c \ modmachine.c \ machine_pin.c \ diff --git a/ports/samd/moduos.c b/ports/samd/moduos.c deleted file mode 100644 index b884d5e7b5..0000000000 --- a/ports/samd/moduos.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Damien P. George - * - * 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 "extmod/vfs.h" -#include "extmod/vfs_fat.h" -#include "extmod/vfs_lfs.h" - -STATIC const mp_rom_map_elem_t os_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, - - #if MICROPY_VFS - { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, - { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mp_vfs_rename_obj) }, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, - #endif - - // The following are MicroPython extensions. - - #if MICROPY_PY_OS_DUPTERM - { MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&mp_uos_dupterm_obj) }, - #endif - - #if MICROPY_VFS - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, - { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, - #if MICROPY_VFS_FAT - { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, - #endif - #if MICROPY_VFS_LFS1 - { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, - #endif - #if MICROPY_VFS_LFS2 - { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, - #endif - #endif -}; -STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); - -const mp_obj_module_t mp_module_uos = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&os_module_globals, -}; - -MP_REGISTER_MODULE(MP_QSTR_uos, mp_module_uos, MICROPY_PY_UOS); diff --git a/ports/stm32/mpconfigport.h b/ports/stm32/mpconfigport.h index 3cca8f1925..98e5f2f36b 100644 --- a/ports/stm32/mpconfigport.h +++ b/ports/stm32/mpconfigport.h @@ -95,8 +95,9 @@ #define MICROPY_PY_UHASHLIB_MD5 (MICROPY_PY_USSL) #define MICROPY_PY_UHASHLIB_SHA1 (MICROPY_PY_USSL) #define MICROPY_PY_UCRYPTOLIB (MICROPY_PY_USSL) -#ifndef MICROPY_PY_UOS -#define MICROPY_PY_UOS (1) +#define MICROPY_PY_UOS (0) +#ifndef MICROPY_PY_UOS_STM32 +#define MICROPY_PY_UOS_STM32 (1) #endif #define MICROPY_PY_OS_DUPTERM (3) #define MICROPY_PY_UOS_DUPTERM_BUILTIN_STREAM (1) @@ -203,7 +204,7 @@ extern const struct _mp_obj_module_t mp_module_onewire; #define MACHINE_BUILTIN_MODULE_CONSTANTS #endif -#if MICROPY_PY_UOS +#if MICROPY_PY_UOS_STM32 #define UOS_BUILTIN_MODULE { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, #else #define UOS_BUILTIN_MODULE diff --git a/py/py.mk b/py/py.mk index 122dea225a..518cd0a225 100644 --- a/py/py.mk +++ b/py/py.mk @@ -176,6 +176,7 @@ PY_EXTMOD_O_BASENAME = \ extmod/moduasyncio.o \ extmod/moductypes.o \ extmod/modujson.o \ + extmod/moduos.o \ extmod/modure.o \ extmod/moduzlib.o \ extmod/moduheapq.o \ From 20bfae1471fe86e153360dbf28d0292274f3978b Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Mar 2022 19:34:15 +1100 Subject: [PATCH 0206/1712] qemu-arm/moduos: Convert module to use extmod version. Signed-off-by: Damien George --- ports/qemu-arm/Makefile | 1 - ports/qemu-arm/moduos.c | 53 ----------------------------------- ports/qemu-arm/mpconfigport.h | 7 +---- 3 files changed, 1 insertion(+), 60 deletions(-) delete mode 100644 ports/qemu-arm/moduos.c diff --git a/ports/qemu-arm/Makefile b/ports/qemu-arm/Makefile index 4a6d63a014..08c2d82498 100644 --- a/ports/qemu-arm/Makefile +++ b/ports/qemu-arm/Makefile @@ -77,7 +77,6 @@ LIBS = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) SRC_COMMON_C = \ startup.c \ uart.c \ - moduos.c \ modmachine.c \ shared/libc/string0.c \ shared/runtime/sys_stdio_mphal.c \ diff --git a/ports/qemu-arm/moduos.c b/ports/qemu-arm/moduos.c deleted file mode 100644 index 23a1241869..0000000000 --- a/ports/qemu-arm/moduos.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Damien P. George - * - * 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 "extmod/vfs.h" - -STATIC const mp_rom_map_elem_t os_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, - - { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mp_vfs_rename_obj) }, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, - - // MicroPython extensions - { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, - { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, -}; - -STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); - -const mp_obj_module_t mp_module_uos = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&os_module_globals, -}; diff --git a/ports/qemu-arm/mpconfigport.h b/ports/qemu-arm/mpconfigport.h index 6bfea74ea0..cccfa1e180 100644 --- a/ports/qemu-arm/mpconfigport.h +++ b/ports/qemu-arm/mpconfigport.h @@ -40,6 +40,7 @@ #define MICROPY_PY_UCTYPES (1) #define MICROPY_PY_UZLIB (1) #define MICROPY_PY_UJSON (1) +#define MICROPY_PY_UOS (1) #define MICROPY_PY_URE (1) #define MICROPY_PY_UHEAPQ (1) #define MICROPY_PY_UHASHLIB (1) @@ -63,12 +64,6 @@ typedef long mp_off_t; #define MICROPY_PORT_BUILTINS \ { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, -// extra built-in modules to add to the list of known ones -extern const struct _mp_obj_module_t mp_module_uos; - -#define MICROPY_PORT_BUILTIN_MODULES \ - { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \ - // We need to provide a declaration/definition of alloca() #include From 9a3e1a18081c8c6a08e2a2efcfefcc4d96e9a8da Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Mar 2022 22:50:40 +1100 Subject: [PATCH 0207/1712] mimxrt/moduos: Convert module to use extmod version. Signed-off-by: Damien George --- ports/mimxrt/Makefile | 2 - ports/mimxrt/moduos.c | 91 +++---------------------------------- ports/mimxrt/mpconfigport.h | 7 ++- 3 files changed, 12 insertions(+), 88 deletions(-) diff --git a/ports/mimxrt/Makefile b/ports/mimxrt/Makefile index 55e32433f5..be5083965f 100644 --- a/ports/mimxrt/Makefile +++ b/ports/mimxrt/Makefile @@ -238,7 +238,6 @@ SRC_C += \ mimxrt_sdram.c \ modmachine.c \ modmimxrt.c \ - moduos.c \ modutime.c \ mphalport.c \ mpnetworkport.c \ @@ -409,7 +408,6 @@ SRC_QSTR += \ mimxrt_flash.c \ modmachine.c \ modmimxrt.c \ - moduos.c \ modutime.c \ pin.c \ shared/runtime/mpirq.c \ diff --git a/ports/mimxrt/moduos.c b/ports/mimxrt/moduos.c index b59a5f4483..34bd2b4248 100644 --- a/ports/mimxrt/moduos.c +++ b/ports/mimxrt/moduos.c @@ -28,42 +28,10 @@ * THE SOFTWARE. */ -#include "py/objstr.h" #include "py/runtime.h" #include "py/mphal.h" -#include "extmod/misc.h" -#include "extmod/vfs.h" -#include "extmod/vfs_fat.h" -#include "extmod/vfs_lfs.h" -#include "genhdr/mpversion.h" #include "fsl_trng.h" -STATIC const qstr os_uname_info_fields[] = { - MP_QSTR_sysname, MP_QSTR_nodename, - MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine -}; -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_PY_SYS_PLATFORM); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME); - -STATIC MP_DEFINE_ATTRTUPLE( - os_uname_info_obj, - os_uname_info_fields, - 5, - (mp_obj_t)&os_uname_info_sysname_obj, - (mp_obj_t)&os_uname_info_nodename_obj, - (mp_obj_t)&os_uname_info_release_obj, - (mp_obj_t)&os_uname_info_version_obj, - (mp_obj_t)&os_uname_info_machine_obj - ); - -STATIC mp_obj_t os_uname(void) { - return (mp_obj_t)&os_uname_info_obj; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname); - static bool initialized = false; STATIC void trng_start(void) { @@ -86,7 +54,8 @@ uint32_t trng_random_u32(void) { return rngval; } -STATIC mp_obj_t os_urandom(mp_obj_t num) { +#if MICROPY_PY_UOS_URANDOM +STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); vstr_t vstr; vstr_init_len(&vstr, n); @@ -96,10 +65,11 @@ STATIC mp_obj_t os_urandom(mp_obj_t num) { return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_urandom_obj, os_urandom); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom); +#endif -#if MICROPY_PY_OS_DUPTERM -STATIC mp_obj_t os_dupterm_notify(mp_obj_t obj_in) { +#if MICROPY_PY_UOS_DUPTERM_NOTIFY +STATIC mp_obj_t mp_uos_dupterm_notify(mp_obj_t obj_in) { (void)obj_in; for (;;) { int c = mp_uos_dupterm_rx_chr(); @@ -110,52 +80,5 @@ STATIC mp_obj_t os_dupterm_notify(mp_obj_t obj_in) { } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_dupterm_notify_obj, os_dupterm_notify); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_dupterm_notify_obj, mp_uos_dupterm_notify); #endif - -STATIC const mp_rom_map_elem_t os_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, - - { MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&os_uname_obj) }, - { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&os_urandom_obj) }, - - #if MICROPY_VFS - { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, - { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mp_vfs_rename_obj) }, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, - #endif - - // The following are MicroPython extensions. - - #if MICROPY_PY_OS_DUPTERM - { MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&mp_uos_dupterm_obj) }, - { MP_ROM_QSTR(MP_QSTR_dupterm_notify), MP_ROM_PTR(&os_dupterm_notify_obj) }, - #endif - - #if MICROPY_VFS - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, - { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, - #if MICROPY_VFS_FAT - { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, - #endif - #if MICROPY_VFS_LFS1 - { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, - #endif - #if MICROPY_VFS_LFS2 - { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, - #endif - #endif -}; -STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); - -const mp_obj_module_t mp_module_uos = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&os_module_globals, -}; diff --git a/ports/mimxrt/mpconfigport.h b/ports/mimxrt/mpconfigport.h index 7958874447..ca8be01f78 100644 --- a/ports/mimxrt/mpconfigport.h +++ b/ports/mimxrt/mpconfigport.h @@ -121,7 +121,12 @@ uint32_t trng_random_u32(void); #define MICROPY_PY_UBINASCII (1) #define MICROPY_PY_UBINASCII_CRC32 (1) #define MICROPY_PY_UTIME_MP_HAL (1) +#define MICROPY_PY_UOS (1) +#define MICROPY_PY_UOS_INCLUDEFILE "ports/mimxrt/moduos.c" #define MICROPY_PY_OS_DUPTERM (3) +#define MICROPY_PY_UOS_DUPTERM_NOTIFY (1) +#define MICROPY_PY_UOS_UNAME (1) +#define MICROPY_PY_UOS_URANDOM (1) #define MICROPY_PY_URANDOM (1) #define MICROPY_PY_URANDOM_EXTRA_FUNCS (1) #define MICROPY_PY_URANDOM_SEED_INIT_FUNC (trng_random_u32()) @@ -221,7 +226,6 @@ static inline void restore_irq_pri(uint32_t basepri) { extern const struct _mp_obj_module_t mp_module_mimxrt; extern const struct _mp_obj_module_t mp_module_onewire; -extern const struct _mp_obj_module_t mp_module_uos; extern const struct _mp_obj_module_t mp_module_utime; extern const struct _mp_obj_module_t mp_module_usocket; extern const struct _mp_obj_module_t mp_module_network; @@ -258,7 +262,6 @@ extern const struct _mp_obj_type_t network_lan_type; #define MICROPY_PORT_BUILTIN_MODULES \ { MP_ROM_QSTR(MP_QSTR_mimxrt), (mp_obj_t)&mp_module_mimxrt }, \ - { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, \ { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, \ { MP_ROM_QSTR(MP_QSTR__onewire), MP_ROM_PTR(&mp_module_onewire) }, \ SOCKET_BUILTIN_MODULE \ From 11b77263ef9e8f897c7186f10f4ef579adde9195 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Mar 2022 23:15:59 +1100 Subject: [PATCH 0208/1712] stm32/moduos: Convert module to use extmod version. Signed-off-by: Damien George --- extmod/misc.h | 1 + extmod/moduos.c | 6 ++ extmod/uos_dupterm.c | 4 ++ ports/stm32/Makefile | 1 - ports/stm32/modpyb.c | 2 +- ports/stm32/moduos.c | 144 ++++++------------------------------- ports/stm32/mpconfigport.h | 18 ++--- ports/stm32/portmodules.h | 4 +- 8 files changed, 42 insertions(+), 138 deletions(-) diff --git a/extmod/misc.h b/extmod/misc.h index 40b091e5f7..a9392aa10b 100644 --- a/extmod/misc.h +++ b/extmod/misc.h @@ -36,6 +36,7 @@ MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_uos_dupterm_obj); #if MICROPY_PY_OS_DUPTERM bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream); +void mp_uos_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached); uintptr_t mp_uos_dupterm_poll(uintptr_t poll_flags); int mp_uos_dupterm_rx_chr(void); void mp_uos_dupterm_tx_strn(const char *str, size_t len); diff --git a/extmod/moduos.c b/extmod/moduos.c index 0378d50302..28c482dd91 100644 --- a/extmod/moduos.c +++ b/extmod/moduos.c @@ -88,6 +88,12 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_uos_uname_obj, mp_uos_uname); STATIC const mp_rom_map_elem_t os_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, + #if MICROPY_PY_UOS_SEP + { MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) }, + #endif + #if MICROPY_PY_UOS_SYNC + { MP_ROM_QSTR(MP_QSTR_sync), MP_ROM_PTR(&mp_uos_sync_obj) }, + #endif #if MICROPY_PY_UOS_UNAME { MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&mp_uos_uname_obj) }, #endif diff --git a/extmod/uos_dupterm.c b/extmod/uos_dupterm.c index d55767de21..e18d133b91 100644 --- a/extmod/uos_dupterm.c +++ b/extmod/uos_dupterm.c @@ -193,6 +193,10 @@ STATIC mp_obj_t mp_uos_dupterm(size_t n_args, const mp_obj_t *args) { MP_STATE_VM(dupterm_objs[idx]) = args[0]; } + #if MICROPY_PY_UOS_DUPTERM_STREAM_DETACHED_ATTACHED + mp_uos_dupterm_stream_detached_attached(previous_obj, args[0]); + #endif + return previous_obj; } MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_uos_dupterm_obj, 1, 2, mp_uos_dupterm); diff --git a/ports/stm32/Makefile b/ports/stm32/Makefile index dd86f1e3f3..3083c99570 100644 --- a/ports/stm32/Makefile +++ b/ports/stm32/Makefile @@ -297,7 +297,6 @@ SRC_C += \ modmachine.c \ modpyb.c \ modstm.c \ - moduos.c \ modutime.c \ network_lan.c \ extint.c \ diff --git a/ports/stm32/modpyb.c b/ports/stm32/modpyb.c index b9e2bac03f..a444654888 100644 --- a/ports/stm32/modpyb.c +++ b/ports/stm32/modpyb.c @@ -185,7 +185,7 @@ STATIC const mp_rom_map_elem_t pyb_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_elapsed_micros), MP_ROM_PTR(&pyb_elapsed_micros_obj) }, { MP_ROM_QSTR(MP_QSTR_delay), MP_ROM_PTR(&mp_utime_sleep_ms_obj) }, { MP_ROM_QSTR(MP_QSTR_udelay), MP_ROM_PTR(&mp_utime_sleep_us_obj) }, - { MP_ROM_QSTR(MP_QSTR_sync), MP_ROM_PTR(&mod_os_sync_obj) }, + { MP_ROM_QSTR(MP_QSTR_sync), MP_ROM_PTR(&mp_uos_sync_obj) }, { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, #endif diff --git a/ports/stm32/moduos.c b/ports/stm32/moduos.c index 5b2335272f..1862564b61 100644 --- a/ports/stm32/moduos.c +++ b/ports/stm32/moduos.c @@ -24,66 +24,19 @@ * THE SOFTWARE. */ -#include -#include - #include "py/runtime.h" -#include "py/objtuple.h" -#include "py/objstr.h" -#include "shared/timeutils/timeutils.h" -#include "lib/oofatfs/ff.h" -#include "lib/oofatfs/diskio.h" -#include "extmod/misc.h" -#include "extmod/vfs.h" -#include "extmod/vfs_fat.h" -#include "extmod/vfs_lfs.h" -#include "genhdr/mpversion.h" #include "rng.h" #include "usb.h" #include "uart.h" -#include "portmodules.h" -/// \module os - basic "operating system" services -/// -/// The `os` module contains functions for filesystem access and `urandom`. -/// -/// The filesystem has `/` as the root directory, and the available physical -/// drives are accessible from here. They are currently: -/// -/// /flash -- the internal flash filesystem -/// /sd -- the SD card (if it exists) -/// -/// On boot up, the current directory is `/flash` if no SD card is inserted, -/// otherwise it is `/sd`. +#if MICROPY_VFS_FAT +#include "lib/oofatfs/ff.h" +#include "lib/oofatfs/diskio.h" +#endif -STATIC const qstr os_uname_info_fields[] = { - MP_QSTR_sysname, MP_QSTR_nodename, - MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine -}; -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, "pyboard"); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, "pyboard"); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_release_obj, MICROPY_VERSION_STRING); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME); -STATIC MP_DEFINE_ATTRTUPLE( - os_uname_info_obj, - os_uname_info_fields, - 5, - MP_ROM_PTR(&os_uname_info_sysname_obj), - MP_ROM_PTR(&os_uname_info_nodename_obj), - MP_ROM_PTR(&os_uname_info_release_obj), - MP_ROM_PTR(&os_uname_info_version_obj), - MP_ROM_PTR(&os_uname_info_machine_obj) - ); - -STATIC mp_obj_t os_uname(void) { - return MP_OBJ_FROM_PTR(&os_uname_info_obj); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname); - -/// \function sync() -/// Sync all filesystems. -STATIC mp_obj_t os_sync(void) { +// sync() +// Sync all filesystems. +STATIC mp_obj_t mp_uos_sync(void) { #if MICROPY_VFS_FAT for (mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table); vfs != NULL; vfs = vfs->next) { // this assumes that vfs->obj is fs_user_mount_t with block device functions @@ -92,13 +45,13 @@ STATIC mp_obj_t os_sync(void) { #endif return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_0(mod_os_sync_obj, os_sync); +MP_DEFINE_CONST_FUN_OBJ_0(mp_uos_sync_obj, mp_uos_sync); -#if MICROPY_HW_ENABLE_RNG -/// \function urandom(n) -/// Return a bytes object with n random bytes, generated by the hardware -/// random number generator. -STATIC mp_obj_t os_urandom(mp_obj_t num) { +#if MICROPY_PY_UOS_URANDOM +// urandom(n) +// Return a bytes object with n random bytes, generated by the hardware +// random number generator. +STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); vstr_t vstr; vstr_init_len(&vstr, n); @@ -107,7 +60,7 @@ STATIC mp_obj_t os_urandom(mp_obj_t num) { } return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_urandom_obj, os_urandom); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom); #endif bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream) { @@ -119,73 +72,22 @@ bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream) { ; } -STATIC mp_obj_t uos_dupterm(size_t n_args, const mp_obj_t *args) { - mp_obj_t prev_obj = mp_uos_dupterm_obj.fun.var(n_args, args); - if (mp_obj_get_type(prev_obj) == &pyb_uart_type) { - uart_attach_to_repl(MP_OBJ_TO_PTR(prev_obj), false); +void mp_uos_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached) { + if (mp_obj_get_type(stream_detached) == &pyb_uart_type) { + uart_attach_to_repl(MP_OBJ_TO_PTR(stream_detached), false); } #if MICROPY_HW_ENABLE_USB - if (mp_obj_get_type(prev_obj) == &pyb_usb_vcp_type) { - usb_vcp_attach_to_repl(MP_OBJ_TO_PTR(prev_obj), false); + if (mp_obj_get_type(stream_detached) == &pyb_usb_vcp_type) { + usb_vcp_attach_to_repl(MP_OBJ_TO_PTR(stream_detached), false); } #endif - if (mp_obj_get_type(args[0]) == &pyb_uart_type) { - uart_attach_to_repl(MP_OBJ_TO_PTR(args[0]), true); + if (mp_obj_get_type(stream_attached) == &pyb_uart_type) { + uart_attach_to_repl(MP_OBJ_TO_PTR(stream_attached), true); } #if MICROPY_HW_ENABLE_USB - if (mp_obj_get_type(args[0]) == &pyb_usb_vcp_type) { - usb_vcp_attach_to_repl(MP_OBJ_TO_PTR(args[0]), true); + if (mp_obj_get_type(stream_attached) == &pyb_usb_vcp_type) { + usb_vcp_attach_to_repl(MP_OBJ_TO_PTR(stream_attached), true); } #endif - return prev_obj; } -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(uos_dupterm_obj, 1, 2, uos_dupterm); - -STATIC const mp_rom_map_elem_t os_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, - - { MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&os_uname_obj) }, - - { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename),MP_ROM_PTR(&mp_vfs_rename_obj)}, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, - { MP_ROM_QSTR(MP_QSTR_unlink), MP_ROM_PTR(&mp_vfs_remove_obj) }, // unlink aliases to remove - - { MP_ROM_QSTR(MP_QSTR_sync), MP_ROM_PTR(&mod_os_sync_obj) }, - - /// \constant sep - separation character used in paths - { MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) }, - - #if MICROPY_HW_ENABLE_RNG - { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&os_urandom_obj) }, - #endif - - // these are MicroPython extensions - { MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&uos_dupterm_obj) }, - { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, - { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, - #if MICROPY_VFS_FAT - { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, - #endif - #if MICROPY_VFS_LFS1 - { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, - #endif - #if MICROPY_VFS_LFS2 - { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, - #endif -}; - -STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); - -const mp_obj_module_t mp_module_uos = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&os_module_globals, -}; diff --git a/ports/stm32/mpconfigport.h b/ports/stm32/mpconfigport.h index 98e5f2f36b..60f6d45fc4 100644 --- a/ports/stm32/mpconfigport.h +++ b/ports/stm32/mpconfigport.h @@ -95,12 +95,14 @@ #define MICROPY_PY_UHASHLIB_MD5 (MICROPY_PY_USSL) #define MICROPY_PY_UHASHLIB_SHA1 (MICROPY_PY_USSL) #define MICROPY_PY_UCRYPTOLIB (MICROPY_PY_USSL) -#define MICROPY_PY_UOS (0) -#ifndef MICROPY_PY_UOS_STM32 -#define MICROPY_PY_UOS_STM32 (1) -#endif +#define MICROPY_PY_UOS_INCLUDEFILE "ports/stm32/moduos.c" #define MICROPY_PY_OS_DUPTERM (3) #define MICROPY_PY_UOS_DUPTERM_BUILTIN_STREAM (1) +#define MICROPY_PY_UOS_DUPTERM_STREAM_DETACHED_ATTACHED (1) +#define MICROPY_PY_UOS_SEP (1) +#define MICROPY_PY_UOS_SYNC (1) +#define MICROPY_PY_UOS_UNAME (1) +#define MICROPY_PY_UOS_URANDOM (MICROPY_HW_ENABLE_RNG) #define MICROPY_PY_URANDOM_SEED_INIT_FUNC (rng_get()) #ifndef MICROPY_PY_UTIME #define MICROPY_PY_UTIME (1) @@ -178,7 +180,6 @@ extern const struct _mp_obj_module_t mp_module_uzlib; extern const struct _mp_obj_module_t mp_module_ujson; extern const struct _mp_obj_module_t mp_module_uheapq; extern const struct _mp_obj_module_t mp_module_uhashlib; -extern const struct _mp_obj_module_t mp_module_uos; extern const struct _mp_obj_module_t mp_module_utime; extern const struct _mp_obj_module_t mp_module_usocket; extern const struct _mp_obj_module_t mp_module_network; @@ -204,12 +205,6 @@ extern const struct _mp_obj_module_t mp_module_onewire; #define MACHINE_BUILTIN_MODULE_CONSTANTS #endif -#if MICROPY_PY_UOS_STM32 -#define UOS_BUILTIN_MODULE { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos) }, -#else -#define UOS_BUILTIN_MODULE -#endif - #if MICROPY_PY_UTIME #define UTIME_BUILTIN_MODULE { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_utime) }, #else @@ -274,7 +269,6 @@ extern const struct _mod_network_nic_type_t mod_network_nic_type_cc3k; #define MICROPY_PORT_BUILTIN_MODULES \ PYB_BUILTIN_MODULE \ STM_BUILTIN_MODULE \ - UOS_BUILTIN_MODULE \ UTIME_BUILTIN_MODULE \ SOCKET_BUILTIN_MODULE \ NETWORK_BUILTIN_MODULE \ diff --git a/ports/stm32/portmodules.h b/ports/stm32/portmodules.h index 81cb7fd04a..f80b4fdf82 100644 --- a/ports/stm32/portmodules.h +++ b/ports/stm32/portmodules.h @@ -28,7 +28,6 @@ extern const mp_obj_module_t pyb_module; extern const mp_obj_module_t stm_module; -extern const mp_obj_module_t mp_module_uos; extern const mp_obj_module_t mp_module_utime; extern const mp_obj_module_t mp_module_usocket; @@ -37,7 +36,6 @@ extern const mp_obj_module_t mp_module_usocket; MP_DECLARE_CONST_FUN_OBJ_1(time_sleep_ms_obj); MP_DECLARE_CONST_FUN_OBJ_1(time_sleep_us_obj); -MP_DECLARE_CONST_FUN_OBJ_0(mod_os_sync_obj); -MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_dupterm_obj); +MP_DECLARE_CONST_FUN_OBJ_0(mp_uos_sync_obj); #endif // MICROPY_INCLUDED_STM32_PORTMODULES_H From ade2720e55e5960f6667d952c4482a369747e3a4 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Mar 2022 23:46:16 +1100 Subject: [PATCH 0209/1712] esp8266/moduos: Convert module to use extmod version. Signed-off-by: Damien George --- extmod/moduos.c | 15 +++++- ports/esp8266/Makefile | 1 - ports/esp8266/main.c | 3 +- ports/esp8266/moduos.c | 88 ++++-------------------------------- ports/esp8266/mpconfigport.h | 9 +++- 5 files changed, 31 insertions(+), 85 deletions(-) diff --git a/extmod/moduos.c b/extmod/moduos.c index 28c482dd91..0ec38bff8a 100644 --- a/extmod/moduos.c +++ b/extmod/moduos.c @@ -55,6 +55,13 @@ #endif #if MICROPY_PY_UOS_UNAME + +#if MICROPY_PY_UOS_UNAME_RELEASE_DYNAMIC +#define CONST_RELEASE +#else +#define CONST_RELEASE const +#endif + STATIC const qstr mp_uos_uname_info_fields[] = { MP_QSTR_sysname, MP_QSTR_nodename, @@ -64,7 +71,7 @@ STATIC const qstr mp_uos_uname_info_fields[] = { }; STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM); STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_nodename_obj, MICROPY_PY_SYS_PLATFORM); -STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_release_obj, MICROPY_VERSION_STRING); +STATIC CONST_RELEASE MP_DEFINE_STR_OBJ(mp_uos_uname_info_release_obj, MICROPY_VERSION_STRING); STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE MICROPY_BUILD_TYPE_PAREN); STATIC const MP_DEFINE_STR_OBJ(mp_uos_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME); @@ -80,9 +87,15 @@ STATIC MP_DEFINE_ATTRTUPLE( ); STATIC mp_obj_t mp_uos_uname(void) { + #if MICROPY_PY_UOS_UNAME_RELEASE_DYNAMIC + const char *release = mp_uos_uname_release(); + mp_uos_uname_info_release_obj.len = strlen(release); + mp_uos_uname_info_release_obj.data = (const byte *)release; + #endif return MP_OBJ_FROM_PTR(&mp_uos_uname_info_obj); } STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_uos_uname_obj, mp_uos_uname); + #endif STATIC const mp_rom_map_elem_t os_module_globals_table[] = { diff --git a/ports/esp8266/Makefile b/ports/esp8266/Makefile index d0afe73ea8..fd2346d515 100644 --- a/ports/esp8266/Makefile +++ b/ports/esp8266/Makefile @@ -102,7 +102,6 @@ SRC_C = \ modesp.c \ modnetwork.c \ modutime.c \ - moduos.c \ ets_alt_task.c \ fatfs_port.c \ posix_helpers.c \ diff --git a/ports/esp8266/main.c b/ports/esp8266/main.c index 5d7debced0..1ae3f85bff 100644 --- a/ports/esp8266/main.c +++ b/ports/esp8266/main.c @@ -69,8 +69,7 @@ STATIC void mp_reset(void) { args[1] = MP_OBJ_NEW_SMALL_INT(115200); args[0] = pyb_uart_type.make_new(&pyb_uart_type, 2, 0, args); args[1] = MP_OBJ_NEW_SMALL_INT(1); - extern mp_obj_t os_dupterm(size_t n_args, const mp_obj_t *args); - os_dupterm(2, args); + mp_uos_dupterm_obj.fun.var(2, args); } #if MICROPY_MODULE_FROZEN diff --git a/ports/esp8266/moduos.c b/ports/esp8266/moduos.c index f04094fbed..9a235e61b9 100644 --- a/ports/esp8266/moduos.c +++ b/ports/esp8266/moduos.c @@ -37,37 +37,11 @@ #include "esp_mphal.h" #include "user_interface.h" -STATIC const qstr os_uname_info_fields[] = { - MP_QSTR_sysname, MP_QSTR_nodename, - MP_QSTR_release, MP_QSTR_version, MP_QSTR_machine -}; -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_sysname_obj, MICROPY_PY_SYS_PLATFORM); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_nodename_obj, MICROPY_PY_SYS_PLATFORM); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_version_obj, MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE); -STATIC const MP_DEFINE_STR_OBJ(os_uname_info_machine_obj, MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME); - -STATIC mp_obj_tuple_t os_uname_info_obj = { - .base = {&mp_type_attrtuple}, - .len = 5, - .items = { - (mp_obj_t)&os_uname_info_sysname_obj, - (mp_obj_t)&os_uname_info_nodename_obj, - NULL, - (mp_obj_t)&os_uname_info_version_obj, - (mp_obj_t)&os_uname_info_machine_obj, - (void *)os_uname_info_fields, - } -}; - -STATIC mp_obj_t os_uname(void) { - // We must populate the "release" field each time in case it was GC'd since the last call. - const char *ver = system_get_sdk_version(); - os_uname_info_obj.items[2] = mp_obj_new_str(ver, strlen(ver)); - return (mp_obj_t)&os_uname_info_obj; +STATIC const char *mp_uos_uname_release(void) { + return system_get_sdk_version(); } -STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname); -STATIC mp_obj_t os_urandom(mp_obj_t num) { +STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { mp_int_t n = mp_obj_get_int(num); vstr_t vstr; vstr_init_len(&vstr, n); @@ -76,64 +50,20 @@ STATIC mp_obj_t os_urandom(mp_obj_t num) { } return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_urandom_obj, os_urandom); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom); -// We wrap the mp_uos_dupterm function to detect if a UART is attached or not -mp_obj_t os_dupterm(size_t n_args, const mp_obj_t *args) { - mp_obj_t prev_obj = mp_uos_dupterm_obj.fun.var(n_args, args); - if (mp_obj_get_type(args[0]) == &pyb_uart_type) { +void mp_uos_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached) { + if (mp_obj_get_type(stream_attached) == &pyb_uart_type) { ++uart_attached_to_dupterm; } - if (mp_obj_get_type(prev_obj) == &pyb_uart_type) { + if (mp_obj_get_type(stream_detached) == &pyb_uart_type) { --uart_attached_to_dupterm; } - return prev_obj; } -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(os_dupterm_obj, 1, 2, os_dupterm); -STATIC mp_obj_t os_dupterm_notify(mp_obj_t obj_in) { +STATIC mp_obj_t mp_uos_dupterm_notify(mp_obj_t obj_in) { (void)obj_in; mp_hal_signal_dupterm_input(); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(os_dupterm_notify_obj, os_dupterm_notify); - -STATIC const mp_rom_map_elem_t os_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, - { MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&os_uname_obj) }, - { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&os_urandom_obj) }, - #if MICROPY_PY_OS_DUPTERM - { MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&os_dupterm_obj) }, - { MP_ROM_QSTR(MP_QSTR_dupterm_notify), MP_ROM_PTR(&os_dupterm_notify_obj) }, - #endif - #if MICROPY_VFS - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mp_vfs_rename_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, - { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, - { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, - #if MICROPY_VFS_FAT - { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, - #endif - #if MICROPY_VFS_LFS1 - { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, - #endif - #if MICROPY_VFS_LFS2 - { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, - #endif - #endif -}; - -STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); - -const mp_obj_module_t uos_module = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&os_module_globals, -}; +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_dupterm_notify_obj, mp_uos_dupterm_notify); diff --git a/ports/esp8266/mpconfigport.h b/ports/esp8266/mpconfigport.h index 49c53a4671..ad73f465a3 100644 --- a/ports/esp8266/mpconfigport.h +++ b/ports/esp8266/mpconfigport.h @@ -95,7 +95,14 @@ #define MICROPY_PY_WEBREPL_DELAY (20) #define MICROPY_PY_WEBREPL_STATIC_FILEBUF (1) #define MICROPY_PY_MICROPYTHON_MEM_INFO (1) +#define MICROPY_PY_UOS (1) +#define MICROPY_PY_UOS_INCLUDEFILE "ports/esp8266/moduos.c" #define MICROPY_PY_OS_DUPTERM (2) +#define MICROPY_PY_UOS_DUPTERM_NOTIFY (1) +#define MICROPY_PY_UOS_DUPTERM_STREAM_DETACHED_ATTACHED (1) +#define MICROPY_PY_UOS_UNAME (1) +#define MICROPY_PY_UOS_UNAME_RELEASE_DYNAMIC (1) +#define MICROPY_PY_UOS_URANDOM (1) #define MICROPY_CPYTHON_COMPAT (1) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) @@ -172,7 +179,6 @@ extern const struct _mp_print_t mp_debug_print; extern const struct _mp_obj_module_t esp_module; extern const struct _mp_obj_module_t network_module; extern const struct _mp_obj_module_t utime_module; -extern const struct _mp_obj_module_t uos_module; extern const struct _mp_obj_module_t mp_module_lwip; extern const struct _mp_obj_module_t mp_module_onewire; @@ -181,7 +187,6 @@ extern const struct _mp_obj_module_t mp_module_onewire; { MP_ROM_QSTR(MP_QSTR_usocket), MP_ROM_PTR(&mp_module_lwip) }, \ { MP_ROM_QSTR(MP_QSTR_network), MP_ROM_PTR(&network_module) }, \ { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&utime_module) }, \ - { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&uos_module) }, \ { MP_ROM_QSTR(MP_QSTR__onewire), MP_ROM_PTR(&mp_module_onewire) }, \ #define MP_STATE_PORT MP_STATE_VM From 2b409ef8a46015f8f3bd20bc44e644637dbe9bd3 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 9 Mar 2022 12:32:44 +1100 Subject: [PATCH 0210/1712] unix/moduos: Convert module to use extmod version. All variants now use extmod/moduos.c as their uos module implementation. In particular this means they all have MICROPY_VFS enabled and use VfsPosix for their filesystem. As part of this, the available functions in uos become more consistent with other ports: - coverage variant gets uos.urandom - minimal and standard variant get: unlink, chdir, getcwd, listdir Signed-off-by: Damien George --- extmod/moduos.c | 18 + ports/unix/Makefile | 2 - ports/unix/main.c | 32 -- ports/unix/modos.c | 359 ------------------ ports/unix/moduos.c | 123 ++++++ ports/unix/moduos_vfs.c | 94 ----- ports/unix/modusocket.c | 3 +- ports/unix/mpconfigport.h | 22 +- .../unix/variants/coverage/mpconfigvariant.h | 10 - ports/unix/variants/dev/mpconfigvariant.h | 9 - ports/unix/variants/minimal/mpconfigvariant.h | 13 +- 11 files changed, 163 insertions(+), 522 deletions(-) delete mode 100644 ports/unix/modos.c create mode 100644 ports/unix/moduos.c delete mode 100644 ports/unix/moduos_vfs.c diff --git a/extmod/moduos.c b/extmod/moduos.c index 0ec38bff8a..ed278dd545 100644 --- a/extmod/moduos.c +++ b/extmod/moduos.c @@ -40,6 +40,10 @@ #include "extmod/vfs_lfs.h" #endif +#if MICROPY_VFS_POSIX +#include "extmod/vfs_posix.h" +#endif + #if MICROPY_PY_UOS_UNAME #include "genhdr/mpversion.h" #endif @@ -101,12 +105,20 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_uos_uname_obj, mp_uos_uname); STATIC const mp_rom_map_elem_t os_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, + #if MICROPY_PY_UOS_GETENV_PUTENV_UNSETENV + { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mp_uos_getenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mp_uos_putenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mp_uos_unsetenv_obj) }, + #endif #if MICROPY_PY_UOS_SEP { MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) }, #endif #if MICROPY_PY_UOS_SYNC { MP_ROM_QSTR(MP_QSTR_sync), MP_ROM_PTR(&mp_uos_sync_obj) }, #endif + #if MICROPY_PY_UOS_SYSTEM + { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mp_uos_system_obj) }, + #endif #if MICROPY_PY_UOS_UNAME { MP_ROM_QSTR(MP_QSTR_uname), MP_ROM_PTR(&mp_uos_uname_obj) }, #endif @@ -135,6 +147,9 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { #if MICROPY_PY_UOS_DUPTERM_NOTIFY { MP_ROM_QSTR(MP_QSTR_dupterm_notify), MP_ROM_PTR(&mp_uos_dupterm_notify_obj) }, #endif + #if MICROPY_PY_UOS_ERRNO + { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mp_uos_errno_obj) }, + #endif #if MICROPY_VFS { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, @@ -149,6 +164,9 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { #if MICROPY_VFS_LFS2 { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, #endif + #if MICROPY_VFS_POSIX + { MP_ROM_QSTR(MP_QSTR_VfsPosix), MP_ROM_PTR(&mp_type_vfs_posix) }, + #endif #endif }; STATIC MP_DEFINE_CONST_DICT(os_module_globals, os_module_globals_table); diff --git a/ports/unix/Makefile b/ports/unix/Makefile index 7732211e2d..d93cdf5d7f 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -225,8 +225,6 @@ SRC_C += \ mpthreadport.c \ input.c \ modmachine.c \ - modos.c \ - moduos_vfs.c \ modtime.c \ moduselect.c \ alloc.c \ diff --git a/ports/unix/main.c b/ports/unix/main.c index 2769f33191..bde867f8c8 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -723,38 +723,6 @@ MP_NOINLINE int main_(int argc, char **argv) { return ret & 0xff; } -#if !MICROPY_VFS -uint mp_import_stat(const char *path) { - struct stat st; - if (stat(path, &st) == 0) { - if (S_ISDIR(st.st_mode)) { - return MP_IMPORT_STAT_DIR; - } else if (S_ISREG(st.st_mode)) { - return MP_IMPORT_STAT_FILE; - } - } - return MP_IMPORT_STAT_NO_EXIST; -} - -#if MICROPY_PY_IO -// Factory function for I/O stream classes, only needed if generic VFS subsystem isn't used. -// Note: buffering and encoding are currently ignored. -mp_obj_t mp_builtin_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kwargs) { - enum { ARG_file, ARG_mode }; - STATIC const mp_arg_t allowed_args[] = { - { MP_QSTR_file, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_rom_obj = MP_ROM_NONE} }, - { MP_QSTR_mode, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_QSTR(MP_QSTR_r)} }, - { MP_QSTR_buffering, MP_ARG_INT, {.u_int = -1} }, - { MP_QSTR_encoding, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE} }, - }; - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args, pos_args, kwargs, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - return mp_vfs_posix_file_open(&mp_type_textio, args[ARG_file].u_obj, args[ARG_mode].u_obj); -} -MP_DEFINE_CONST_FUN_OBJ_KW(mp_builtin_open_obj, 1, mp_builtin_open); -#endif -#endif - void nlr_jump_fail(void *val) { fprintf(stderr, "FATAL: uncaught NLR %p\n", val); exit(1); diff --git a/ports/unix/modos.c b/ports/unix/modos.c deleted file mode 100644 index 24e5c95b18..0000000000 --- a/ports/unix/modos.c +++ /dev/null @@ -1,359 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014-2018 Paul Sokolovsky - * Copyright (c) 2014-2018 Damien P. George - * - * 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 -#include -#include -#include -#include -#include -#include -#ifdef _MSC_VER -#include // For mkdir -#endif -#include "py/mpconfig.h" - -#include "py/runtime.h" -#include "py/objtuple.h" -#include "py/mphal.h" -#include "py/mpthread.h" -#include "extmod/vfs.h" -#include "extmod/misc.h" - -#ifdef __ANDROID__ -#define USE_STATFS 1 -#endif - -#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) -#if __GLIBC_PREREQ(2, 25) -#include -#define _HAVE_GETRANDOM -#endif -#endif - -STATIC mp_obj_t mod_os_urandom(mp_obj_t num) { - mp_int_t n = mp_obj_get_int(num); - vstr_t vstr; - vstr_init_len(&vstr, n); - #ifdef _HAVE_GETRANDOM - RAISE_ERRNO(getrandom(vstr.buf, n, 0), errno); - #else - int fd = open("/dev/urandom", O_RDONLY); - RAISE_ERRNO(fd, errno); - RAISE_ERRNO(read(fd, vstr.buf, n), errno); - close(fd); - #endif - return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_urandom_obj, mod_os_urandom); - -STATIC mp_obj_t mod_os_stat(mp_obj_t path_in) { - struct stat sb; - const char *path = mp_obj_str_get_str(path_in); - - int res; - MP_HAL_RETRY_SYSCALL(res, stat(path, &sb), mp_raise_OSError(err)); - - mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL)); - t->items[0] = MP_OBJ_NEW_SMALL_INT(sb.st_mode); - t->items[1] = mp_obj_new_int_from_uint(sb.st_ino); - t->items[2] = mp_obj_new_int_from_uint(sb.st_dev); - t->items[3] = mp_obj_new_int_from_uint(sb.st_nlink); - t->items[4] = mp_obj_new_int_from_uint(sb.st_uid); - t->items[5] = mp_obj_new_int_from_uint(sb.st_gid); - t->items[6] = mp_obj_new_int_from_uint(sb.st_size); - t->items[7] = mp_obj_new_int_from_uint(sb.st_atime); - t->items[8] = mp_obj_new_int_from_uint(sb.st_mtime); - t->items[9] = mp_obj_new_int_from_uint(sb.st_ctime); - return MP_OBJ_FROM_PTR(t); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_stat_obj, mod_os_stat); - -#if MICROPY_PY_OS_STATVFS - -#if USE_STATFS -#include -#define STRUCT_STATVFS struct statfs -#define STATVFS statfs -#define F_FAVAIL sb.f_ffree -#define F_NAMEMAX sb.f_namelen -#define F_FLAG sb.f_flags -#else -#include -#define STRUCT_STATVFS struct statvfs -#define STATVFS statvfs -#define F_FAVAIL sb.f_favail -#define F_NAMEMAX sb.f_namemax -#define F_FLAG sb.f_flag -#endif - -STATIC mp_obj_t mod_os_statvfs(mp_obj_t path_in) { - STRUCT_STATVFS sb; - const char *path = mp_obj_str_get_str(path_in); - - int res; - MP_HAL_RETRY_SYSCALL(res, STATVFS(path, &sb), mp_raise_OSError(err)); - - mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL)); - t->items[0] = MP_OBJ_NEW_SMALL_INT(sb.f_bsize); - t->items[1] = MP_OBJ_NEW_SMALL_INT(sb.f_frsize); - t->items[2] = MP_OBJ_NEW_SMALL_INT(sb.f_blocks); - t->items[3] = MP_OBJ_NEW_SMALL_INT(sb.f_bfree); - t->items[4] = MP_OBJ_NEW_SMALL_INT(sb.f_bavail); - t->items[5] = MP_OBJ_NEW_SMALL_INT(sb.f_files); - t->items[6] = MP_OBJ_NEW_SMALL_INT(sb.f_ffree); - t->items[7] = MP_OBJ_NEW_SMALL_INT(F_FAVAIL); - t->items[8] = MP_OBJ_NEW_SMALL_INT(F_FLAG); - t->items[9] = MP_OBJ_NEW_SMALL_INT(F_NAMEMAX); - return MP_OBJ_FROM_PTR(t); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_statvfs_obj, mod_os_statvfs); -#endif - -STATIC mp_obj_t mod_os_remove(mp_obj_t path_in) { - const char *path = mp_obj_str_get_str(path_in); - - // Note that POSIX requires remove() to be able to delete a directory - // too (act as rmdir()). This is POSIX extenstion to ANSI C semantics - // of that function. But Python remove() follows ANSI C, and explicitly - // required to raise exception on attempt to remove a directory. Thus, - // call POSIX unlink() here. - MP_THREAD_GIL_EXIT(); - int r = unlink(path); - MP_THREAD_GIL_ENTER(); - - RAISE_ERRNO(r, errno); - - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_remove_obj, mod_os_remove); - -STATIC mp_obj_t mod_os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) { - const char *old_path = mp_obj_str_get_str(old_path_in); - const char *new_path = mp_obj_str_get_str(new_path_in); - - MP_THREAD_GIL_EXIT(); - int r = rename(old_path, new_path); - MP_THREAD_GIL_ENTER(); - - RAISE_ERRNO(r, errno); - - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_os_rename_obj, mod_os_rename); - -STATIC mp_obj_t mod_os_rmdir(mp_obj_t path_in) { - const char *path = mp_obj_str_get_str(path_in); - - MP_THREAD_GIL_EXIT(); - int r = rmdir(path); - MP_THREAD_GIL_ENTER(); - - RAISE_ERRNO(r, errno); - - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_rmdir_obj, mod_os_rmdir); - -STATIC mp_obj_t mod_os_system(mp_obj_t cmd_in) { - const char *cmd = mp_obj_str_get_str(cmd_in); - - MP_THREAD_GIL_EXIT(); - int r = system(cmd); - MP_THREAD_GIL_ENTER(); - - RAISE_ERRNO(r, errno); - - return MP_OBJ_NEW_SMALL_INT(r); -} -MP_DEFINE_CONST_FUN_OBJ_1(mod_os_system_obj, mod_os_system); - -STATIC mp_obj_t mod_os_getenv(mp_obj_t var_in) { - const char *s = getenv(mp_obj_str_get_str(var_in)); - if (s == NULL) { - return mp_const_none; - } - return mp_obj_new_str(s, strlen(s)); -} -MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_obj, mod_os_getenv); - -STATIC mp_obj_t mod_os_putenv(mp_obj_t key_in, mp_obj_t value_in) { - const char *key = mp_obj_str_get_str(key_in); - const char *value = mp_obj_str_get_str(value_in); - int ret; - - #if _WIN32 - ret = _putenv_s(key, value); - #else - ret = setenv(key, value, 1); - #endif - - if (ret == -1) { - mp_raise_OSError(errno); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(mod_os_putenv_obj, mod_os_putenv); - -STATIC mp_obj_t mod_os_unsetenv(mp_obj_t key_in) { - const char *key = mp_obj_str_get_str(key_in); - int ret; - - #if _WIN32 - ret = _putenv_s(key, ""); - #else - ret = unsetenv(key); - #endif - - if (ret == -1) { - mp_raise_OSError(errno); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(mod_os_unsetenv_obj, mod_os_unsetenv); - -STATIC mp_obj_t mod_os_mkdir(mp_obj_t path_in) { - // TODO: Accept mode param - const char *path = mp_obj_str_get_str(path_in); - MP_THREAD_GIL_EXIT(); - #ifdef _WIN32 - int r = mkdir(path); - #else - int r = mkdir(path, 0777); - #endif - MP_THREAD_GIL_ENTER(); - RAISE_ERRNO(r, errno); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_mkdir_obj, mod_os_mkdir); - -typedef struct _mp_obj_listdir_t { - mp_obj_base_t base; - mp_fun_1_t iternext; - DIR *dir; -} mp_obj_listdir_t; - -STATIC mp_obj_t listdir_next(mp_obj_t self_in) { - mp_obj_listdir_t *self = MP_OBJ_TO_PTR(self_in); - - if (self->dir == NULL) { - goto done; - } - MP_THREAD_GIL_EXIT(); - struct dirent *dirent = readdir(self->dir); - if (dirent == NULL) { - closedir(self->dir); - MP_THREAD_GIL_ENTER(); - self->dir = NULL; - done: - return MP_OBJ_STOP_ITERATION; - } - MP_THREAD_GIL_ENTER(); - - mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(3, NULL)); - t->items[0] = mp_obj_new_str(dirent->d_name, strlen(dirent->d_name)); - - #ifdef _DIRENT_HAVE_D_TYPE - #ifdef DTTOIF - t->items[1] = MP_OBJ_NEW_SMALL_INT(DTTOIF(dirent->d_type)); - #else - if (dirent->d_type == DT_DIR) { - t->items[1] = MP_OBJ_NEW_SMALL_INT(MP_S_IFDIR); - } else if (dirent->d_type == DT_REG) { - t->items[1] = MP_OBJ_NEW_SMALL_INT(MP_S_IFREG); - } else { - t->items[1] = MP_OBJ_NEW_SMALL_INT(dirent->d_type); - } - #endif - #else - // DT_UNKNOWN should have 0 value on any reasonable system - t->items[1] = MP_OBJ_NEW_SMALL_INT(0); - #endif - - #ifdef _DIRENT_HAVE_D_INO - t->items[2] = MP_OBJ_NEW_SMALL_INT(dirent->d_ino); - #else - t->items[2] = MP_OBJ_NEW_SMALL_INT(0); - #endif - return MP_OBJ_FROM_PTR(t); -} - -STATIC mp_obj_t mod_os_ilistdir(size_t n_args, const mp_obj_t *args) { - const char *path = "."; - if (n_args > 0) { - path = mp_obj_str_get_str(args[0]); - } - mp_obj_listdir_t *o = m_new_obj(mp_obj_listdir_t); - o->base.type = &mp_type_polymorph_iter; - MP_THREAD_GIL_EXIT(); - o->dir = opendir(path); - MP_THREAD_GIL_ENTER(); - o->iternext = listdir_next; - return MP_OBJ_FROM_PTR(o); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_ilistdir_obj, 0, 1, mod_os_ilistdir); - -STATIC mp_obj_t mod_os_errno(size_t n_args, const mp_obj_t *args) { - if (n_args == 0) { - return MP_OBJ_NEW_SMALL_INT(errno); - } - - errno = mp_obj_get_int(args[0]); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_errno_obj, 0, 1, mod_os_errno); - -STATIC const mp_rom_map_elem_t mp_module_os_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, - { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mod_os_errno_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mod_os_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mod_os_urandom_obj) }, - #if MICROPY_PY_OS_STATVFS - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mod_os_statvfs_obj) }, - #endif - { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mod_os_system_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mod_os_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mod_os_rename_obj) }, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mod_os_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mod_os_getenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mod_os_putenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mod_os_unsetenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mod_os_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mod_os_ilistdir_obj) }, - #if MICROPY_PY_OS_DUPTERM - { MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&mp_uos_dupterm_obj) }, - #endif -}; - -STATIC MP_DEFINE_CONST_DICT(mp_module_os_globals, mp_module_os_globals_table); - -const mp_obj_module_t mp_module_os = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_os_globals, -}; diff --git a/ports/unix/moduos.c b/ports/unix/moduos.c new file mode 100644 index 0000000000..1262cd2e29 --- /dev/null +++ b/ports/unix/moduos.c @@ -0,0 +1,123 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2014-2018 Paul Sokolovsky + * Copyright (c) 2017-2022 Damien P. George + * + * 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 + +#include "py/runtime.h" +#include "py/mphal.h" + +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) +#if __GLIBC_PREREQ(2, 25) +#include +#define _HAVE_GETRANDOM +#endif +#endif + +STATIC mp_obj_t mp_uos_getenv(mp_obj_t var_in) { + const char *s = getenv(mp_obj_str_get_str(var_in)); + if (s == NULL) { + return mp_const_none; + } + return mp_obj_new_str(s, strlen(s)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_getenv_obj, mp_uos_getenv); + +STATIC mp_obj_t mp_uos_putenv(mp_obj_t key_in, mp_obj_t value_in) { + const char *key = mp_obj_str_get_str(key_in); + const char *value = mp_obj_str_get_str(value_in); + int ret; + + #if _WIN32 + ret = _putenv_s(key, value); + #else + ret = setenv(key, value, 1); + #endif + + if (ret == -1) { + mp_raise_OSError(errno); + } + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_uos_putenv_obj, mp_uos_putenv); + +STATIC mp_obj_t mp_uos_unsetenv(mp_obj_t key_in) { + const char *key = mp_obj_str_get_str(key_in); + int ret; + + #if _WIN32 + ret = _putenv_s(key, ""); + #else + ret = unsetenv(key); + #endif + + if (ret == -1) { + mp_raise_OSError(errno); + } + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_unsetenv_obj, mp_uos_unsetenv); + +STATIC mp_obj_t mp_uos_system(mp_obj_t cmd_in) { + const char *cmd = mp_obj_str_get_str(cmd_in); + + MP_THREAD_GIL_EXIT(); + int r = system(cmd); + MP_THREAD_GIL_ENTER(); + + RAISE_ERRNO(r, errno); + + return MP_OBJ_NEW_SMALL_INT(r); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_system_obj, mp_uos_system); + +STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) { + mp_int_t n = mp_obj_get_int(num); + vstr_t vstr; + vstr_init_len(&vstr, n); + #ifdef _HAVE_GETRANDOM + RAISE_ERRNO(getrandom(vstr.buf, n, 0), errno); + #else + int fd = open("/dev/urandom", O_RDONLY); + RAISE_ERRNO(fd, errno); + RAISE_ERRNO(read(fd, vstr.buf, n), errno); + close(fd); + #endif + return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom); + +STATIC mp_obj_t mp_uos_errno(size_t n_args, const mp_obj_t *args) { + if (n_args == 0) { + return MP_OBJ_NEW_SMALL_INT(errno); + } + + errno = mp_obj_get_int(args[0]); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_uos_errno_obj, 0, 1, mp_uos_errno); diff --git a/ports/unix/moduos_vfs.c b/ports/unix/moduos_vfs.c deleted file mode 100644 index 6e4f352aad..0000000000 --- a/ports/unix/moduos_vfs.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Damien P. George - * - * 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 "extmod/vfs.h" -#include "extmod/vfs_posix.h" -#include "extmod/vfs_fat.h" -#include "extmod/vfs_lfs.h" - -#if MICROPY_VFS - -// These are defined in modos.c -MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_errno_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_putenv_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_unsetenv_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_system_obj); - -STATIC const mp_rom_map_elem_t uos_vfs_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos_vfs) }, - { MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) }, - - { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mod_os_errno_obj) }, - { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mod_os_getenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mod_os_putenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mod_os_unsetenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mod_os_system_obj) }, - - { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, - { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, - - { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename),MP_ROM_PTR(&mp_vfs_rename_obj) }, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, - { MP_ROM_QSTR(MP_QSTR_unlink), MP_ROM_PTR(&mp_vfs_remove_obj) }, // unlink aliases to remove - - #if MICROPY_PY_OS_DUPTERM - { MP_ROM_QSTR(MP_QSTR_dupterm), MP_ROM_PTR(&mp_uos_dupterm_obj) }, - #endif - - #if MICROPY_VFS_POSIX - { MP_ROM_QSTR(MP_QSTR_VfsPosix), MP_ROM_PTR(&mp_type_vfs_posix) }, - #endif - #if MICROPY_VFS_FAT - { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, - #endif - #if MICROPY_VFS_LFS1 - { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, - #endif - #if MICROPY_VFS_LFS2 - { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, - #endif -}; - -STATIC MP_DEFINE_CONST_DICT(uos_vfs_module_globals, uos_vfs_module_globals_table); - -const mp_obj_module_t mp_module_uos_vfs = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&uos_vfs_module_globals, -}; - -#endif // MICROPY_VFS diff --git a/ports/unix/modusocket.c b/ports/unix/modusocket.c index 951cb7a21c..efa182e393 100644 --- a/ports/unix/modusocket.c +++ b/ports/unix/modusocket.c @@ -46,6 +46,7 @@ #include "py/builtin.h" #include "py/mphal.h" #include "py/mpthread.h" +#include "extmod/vfs.h" #include /* @@ -445,7 +446,7 @@ STATIC mp_obj_t socket_makefile(size_t n_args, const mp_obj_t *args) { mp_obj_t *new_args = alloca(n_args * sizeof(mp_obj_t)); memcpy(new_args + 1, args + 1, (n_args - 1) * sizeof(mp_obj_t)); new_args[0] = MP_OBJ_NEW_SMALL_INT(self->fd); - return mp_builtin_open(n_args, new_args, (mp_map_t *)&mp_const_empty_map); + return mp_vfs_open(n_args, new_args, (mp_map_t *)&mp_const_empty_map); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_makefile_obj, 1, 3, socket_makefile); diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h index d54d0b3ef3..f96abb9420 100644 --- a/ports/unix/mpconfigport.h +++ b/ports/unix/mpconfigport.h @@ -64,6 +64,7 @@ // check stdout a chance to pass, etc. #define MICROPY_DEBUG_PRINTER (&mp_stderr_print) #define MICROPY_READER_POSIX (1) +#define MICROPY_READER_VFS (1) #define MICROPY_USE_READLINE_HISTORY (1) #define MICROPY_HELPER_REPL (1) #define MICROPY_REPL_EMACS_KEYS (1) @@ -88,7 +89,8 @@ #define MICROPY_MODULE_WEAK_LINKS (1) #define MICROPY_MODULE_OVERRIDE_MAIN_IMPORT (1) #define MICROPY_CAN_OVERRIDE_BUILTINS (1) -#define MICROPY_VFS_POSIX_FILE (1) +#define MICROPY_VFS (1) +#define MICROPY_VFS_POSIX (1) #define MICROPY_PY_FUNCTION_ATTRS (1) #define MICROPY_PY_DESCRIPTORS (1) #define MICROPY_PY_DELATTR_SETATTR (1) @@ -146,7 +148,13 @@ #define MICROPY_STACKLESS_STRICT (0) #endif -#define MICROPY_PY_OS_STATVFS (1) +#define MICROPY_PY_UOS (1) +#define MICROPY_PY_UOS_INCLUDEFILE "ports/unix/moduos.c" +#define MICROPY_PY_UOS_ERRNO (1) +#define MICROPY_PY_UOS_GETENV_PUTENV_UNSETENV (1) +#define MICROPY_PY_UOS_SEP (1) +#define MICROPY_PY_UOS_SYSTEM (1) +#define MICROPY_PY_UOS_URANDOM (1) #define MICROPY_PY_UTIME (1) #define MICROPY_PY_UTIME_MP_HAL (1) #define MICROPY_PY_UERRNO (1) @@ -201,11 +209,11 @@ extern const struct _mp_print_t mp_stderr_print; #define MICROPY_KBD_EXCEPTION (1) #define MICROPY_ASYNC_KBD_INTR (1) +#define mp_import_stat mp_vfs_import_stat +#define mp_builtin_open_obj mp_vfs_open_obj #define mp_type_fileio mp_type_vfs_posix_fileio #define mp_type_textio mp_type_vfs_posix_textio -extern const struct _mp_obj_module_t mp_module_os; -extern const struct _mp_obj_module_t mp_module_uos_vfs; extern const struct _mp_obj_module_t mp_module_uselect; extern const struct _mp_obj_module_t mp_module_time; extern const struct _mp_obj_module_t mp_module_termios; @@ -213,11 +221,6 @@ extern const struct _mp_obj_module_t mp_module_socket; extern const struct _mp_obj_module_t mp_module_ffi; extern const struct _mp_obj_module_t mp_module_jni; -#if MICROPY_PY_UOS_VFS -#define MICROPY_PY_UOS_DEF { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_uos_vfs) }, -#else -#define MICROPY_PY_UOS_DEF { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_os) }, -#endif #if MICROPY_PY_FFI #define MICROPY_PY_FFI_DEF { MP_ROM_QSTR(MP_QSTR_ffi), MP_ROM_PTR(&mp_module_ffi) }, #else @@ -254,7 +257,6 @@ extern const struct _mp_obj_module_t mp_module_jni; MICROPY_PY_JNI_DEF \ MICROPY_PY_UTIME_DEF \ MICROPY_PY_SOCKET_DEF \ - MICROPY_PY_UOS_DEF \ MICROPY_PY_USELECT_DEF \ MICROPY_PY_TERMIOS_DEF \ diff --git a/ports/unix/variants/coverage/mpconfigvariant.h b/ports/unix/variants/coverage/mpconfigvariant.h index 5ce40edbb9..db01c4bcd5 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.h +++ b/ports/unix/variants/coverage/mpconfigvariant.h @@ -27,14 +27,10 @@ // This config enables almost all possible features such that it can be used // for coverage testing. -#define MICROPY_VFS (1) -#define MICROPY_PY_UOS_VFS (1) - #define MICROPY_DEBUG_PARSE_RULE_NAME (1) #define MICROPY_OPT_MATH_FACTORIAL (1) #define MICROPY_FLOAT_HIGH_QUALITY_HASH (1) #define MICROPY_ENABLE_SCHEDULER (1) -#define MICROPY_READER_VFS (1) #define MICROPY_REPL_EMACS_WORDS_MOVE (1) #define MICROPY_REPL_EMACS_EXTRA_WORDS_MOVE (1) #define MICROPY_WARNINGS_CATEGORY (1) @@ -57,14 +53,8 @@ #define MICROPY_PY_URE_MATCH_GROUPS (1) #define MICROPY_PY_URE_MATCH_SPAN_START_END (1) #define MICROPY_PY_URE_SUB (1) -#define MICROPY_VFS_POSIX (1) #define MICROPY_PY_FRAMEBUF (1) #define MICROPY_PY_COLLECTIONS_NAMEDTUPLE__ASDICT (1) #define MICROPY_PY_UCRYPTOLIB (1) #define MICROPY_PY_UCRYPTOLIB_CTR (1) #define MICROPY_PY_MICROPYTHON_HEAP_LOCKED (1) - -// use vfs's functions for import stat and builtin open -#define mp_import_stat mp_vfs_import_stat -#define mp_builtin_open mp_vfs_open -#define mp_builtin_open_obj mp_vfs_open_obj diff --git a/ports/unix/variants/dev/mpconfigvariant.h b/ports/unix/variants/dev/mpconfigvariant.h index 35c24c5f00..280243e344 100644 --- a/ports/unix/variants/dev/mpconfigvariant.h +++ b/ports/unix/variants/dev/mpconfigvariant.h @@ -24,25 +24,16 @@ * THE SOFTWARE. */ -#define MICROPY_READER_VFS (1) #define MICROPY_REPL_EMACS_WORDS_MOVE (1) #define MICROPY_REPL_EMACS_EXTRA_WORDS_MOVE (1) #define MICROPY_ENABLE_SCHEDULER (1) -#define MICROPY_VFS (1) -#define MICROPY_VFS_POSIX (1) #define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP_MODULES (1) #define MICROPY_PY_MATH_CONSTANTS (1) #define MICROPY_PY_SYS_SETTRACE (1) -#define MICROPY_PY_UOS_VFS (1) #define MICROPY_PY_URANDOM_EXTRA_FUNCS (1) #ifndef MICROPY_PY_UASYNCIO #define MICROPY_PY_UASYNCIO (1) #endif - -// Use vfs's functions for import stat and builtin open. -#define mp_import_stat mp_vfs_import_stat -#define mp_builtin_open mp_vfs_open -#define mp_builtin_open_obj mp_vfs_open_obj diff --git a/ports/unix/variants/minimal/mpconfigvariant.h b/ports/unix/variants/minimal/mpconfigvariant.h index e0db3756ca..f6be446920 100644 --- a/ports/unix/variants/minimal/mpconfigvariant.h +++ b/ports/unix/variants/minimal/mpconfigvariant.h @@ -44,6 +44,7 @@ #define MICROPY_MEM_STATS (0) #define MICROPY_DEBUG_PRINTERS (0) #define MICROPY_READER_POSIX (1) +#define MICROPY_READER_VFS (1) #define MICROPY_HELPER_REPL (1) #define MICROPY_HELPER_LEXER_UNIX (1) #define MICROPY_ENABLE_SOURCE_LINE (0) @@ -59,6 +60,8 @@ #define MICROPY_OPT_MAP_LOOKUP_CACHE (0) #define MICROPY_CAN_OVERRIDE_BUILTINS (0) #define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (0) +#define MICROPY_VFS (1) +#define MICROPY_VFS_POSIX (1) #define MICROPY_CPYTHON_COMPAT (0) #define MICROPY_PY_BUILTINS_BYTEARRAY (0) #define MICROPY_PY_BUILTINS_MEMORYVIEW (0) @@ -98,18 +101,18 @@ #define MICROPY_PY_UTIME (0) #define MICROPY_PY_UZLIB (0) #define MICROPY_PY_UJSON (0) +#define MICROPY_PY_UOS (1) #define MICROPY_PY_URE (0) #define MICROPY_PY_UHEAPQ (0) #define MICROPY_PY_UHASHLIB (0) #define MICROPY_PY_UBINASCII (0) -extern const struct _mp_obj_module_t mp_module_os; - -#define MICROPY_PORT_BUILTIN_MODULES \ - { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_os) }, \ - #define MICROPY_PORT_ROOT_POINTERS \ +#define mp_import_stat mp_vfs_import_stat +#define mp_type_fileio mp_type_vfs_posix_fileio +#define mp_type_textio mp_type_vfs_posix_textio + ////////////////////////////////////////// // Do not change anything beyond this line ////////////////////////////////////////// From 0149cd6b8b255907b49ec105146a2f238b07dbb8 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 9 Mar 2022 12:45:06 +1100 Subject: [PATCH 0211/1712] windows: Switch to VFS subsystem and use VfsPosix. Following the unix port. Signed-off-by: Damien George --- extmod/vfs_posix.c | 13 +++++++++++++ ports/windows/Makefile | 1 - ports/windows/micropython.vcxproj | 1 - ports/windows/mpconfigport.h | 16 +++++++++++++--- ports/windows/msvc/sources.props | 4 ++++ py/mpconfig.h | 4 ++++ 6 files changed, 34 insertions(+), 5 deletions(-) diff --git a/extmod/vfs_posix.c b/extmod/vfs_posix.c index 719afe28fe..5dcc9c03ec 100644 --- a/extmod/vfs_posix.c +++ b/extmod/vfs_posix.c @@ -37,6 +37,9 @@ #include #include #include +#ifdef _MSC_VER +#include // For mkdir etc. +#endif typedef struct _mp_obj_vfs_posix_t { mp_obj_base_t base; @@ -254,7 +257,11 @@ STATIC mp_obj_t vfs_posix_mkdir(mp_obj_t self_in, mp_obj_t path_in) { mp_obj_vfs_posix_t *self = MP_OBJ_TO_PTR(self_in); const char *path = vfs_posix_get_path_str(self, path_in); MP_THREAD_GIL_EXIT(); + #ifdef _WIN32 + int ret = mkdir(path); + #else int ret = mkdir(path, 0777); + #endif MP_THREAD_GIL_ENTER(); if (ret != 0) { mp_raise_OSError(errno); @@ -308,6 +315,8 @@ STATIC mp_obj_t vfs_posix_stat(mp_obj_t self_in, mp_obj_t path_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_stat_obj, vfs_posix_stat); +#if MICROPY_PY_UOS_STATVFS + #ifdef __ANDROID__ #define USE_STATFS 1 #endif @@ -349,6 +358,8 @@ STATIC mp_obj_t vfs_posix_statvfs(mp_obj_t self_in, mp_obj_t path_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_2(vfs_posix_statvfs_obj, vfs_posix_statvfs); +#endif + STATIC const mp_rom_map_elem_t vfs_posix_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&vfs_posix_mount_obj) }, { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&vfs_posix_umount_obj) }, @@ -362,7 +373,9 @@ STATIC const mp_rom_map_elem_t vfs_posix_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&vfs_posix_rename_obj) }, { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&vfs_posix_rmdir_obj) }, { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&vfs_posix_stat_obj) }, + #if MICROPY_PY_UOS_STATVFS { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&vfs_posix_statvfs_obj) }, + #endif }; STATIC MP_DEFINE_CONST_DICT(vfs_posix_locals_dict, vfs_posix_locals_dict_table); diff --git a/ports/windows/Makefile b/ports/windows/Makefile index 91744b7a5e..c9efc2353c 100644 --- a/ports/windows/Makefile +++ b/ports/windows/Makefile @@ -49,7 +49,6 @@ SRC_C = \ shared/runtime/gchelper_generic.c \ ports/unix/main.c \ ports/unix/input.c \ - ports/unix/modos.c \ ports/unix/modmachine.c \ ports/unix/modtime.c \ ports/unix/gccollect.c \ diff --git a/ports/windows/micropython.vcxproj b/ports/windows/micropython.vcxproj index d5e3f57d8b..4fa0c47df8 100644 --- a/ports/windows/micropython.vcxproj +++ b/ports/windows/micropython.vcxproj @@ -93,7 +93,6 @@ - diff --git a/ports/windows/mpconfigport.h b/ports/windows/mpconfigport.h index d589dac7a7..4679d13565 100644 --- a/ports/windows/mpconfigport.h +++ b/ports/windows/mpconfigport.h @@ -51,6 +51,7 @@ #define MICROPY_DEBUG_PRINTER (&mp_stderr_print) #define MICROPY_DEBUG_PRINTERS (1) #define MICROPY_READER_POSIX (1) +#define MICROPY_READER_VFS (1) #define MICROPY_USE_READLINE_HISTORY (1) #define MICROPY_HELPER_REPL (1) #define MICROPY_REPL_EMACS_KEYS (1) @@ -72,7 +73,8 @@ #ifndef MICROPY_ENABLE_SCHEDULER #define MICROPY_ENABLE_SCHEDULER (1) #endif -#define MICROPY_VFS_POSIX_FILE (1) +#define MICROPY_VFS (1) +#define MICROPY_VFS_POSIX (1) #define MICROPY_PY_FUNCTION_ATTRS (1) #define MICROPY_PY_DESCRIPTORS (1) #define MICROPY_PY_DELATTR_SETATTR (1) @@ -124,6 +126,14 @@ #define MICROPY_STACKLESS_STRICT (0) #endif +#define MICROPY_PY_UOS (1) +#define MICROPY_PY_UOS_INCLUDEFILE "ports/unix/moduos.c" +#define MICROPY_PY_UOS_ERRNO (1) +#define MICROPY_PY_UOS_GETENV_PUTENV_UNSETENV (1) +#define MICROPY_PY_UOS_SEP (1) +#define MICROPY_PY_UOS_STATVFS (0) +#define MICROPY_PY_UOS_SYSTEM (1) +#define MICROPY_PY_UOS_URANDOM (1) #define MICROPY_PY_UTIME (1) #define MICROPY_PY_UTIME_MP_HAL (1) #define MICROPY_PY_UERRNO (1) @@ -161,6 +171,8 @@ extern const struct _mp_print_t mp_stderr_print; #define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE (256) #define MICROPY_KBD_EXCEPTION (1) +#define mp_import_stat mp_vfs_import_stat +#define mp_builtin_open_obj mp_vfs_open_obj #define mp_type_fileio mp_type_vfs_posix_fileio #define mp_type_textio mp_type_vfs_posix_textio @@ -203,11 +215,9 @@ typedef long mp_off_t; #define MICROPY_PORT_BUILTINS \ { MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_builtin_open_obj) }, -extern const struct _mp_obj_module_t mp_module_os; extern const struct _mp_obj_module_t mp_module_time; #define MICROPY_PORT_BUILTIN_MODULES \ { MP_ROM_QSTR(MP_QSTR_utime), MP_ROM_PTR(&mp_module_time) }, \ - { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_os) }, \ #if MICROPY_USE_READLINE == 1 #define MICROPY_PORT_ROOT_POINTERS \ diff --git a/ports/windows/msvc/sources.props b/ports/windows/msvc/sources.props index a6dfd48aa6..b755049db0 100644 --- a/ports/windows/msvc/sources.props +++ b/ports/windows/msvc/sources.props @@ -13,6 +13,7 @@ + @@ -20,7 +21,10 @@ + + + diff --git a/py/mpconfig.h b/py/mpconfig.h index 8f9f0f02fb..a41e99b4c1 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1459,6 +1459,10 @@ typedef double mp_float_t; #define MICROPY_PY_UOS (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) #endif +#ifndef MICROPY_PY_UOS_STATVFS +#define MICROPY_PY_UOS_STATVFS (MICROPY_PY_UOS) +#endif + #ifndef MICROPY_PY_URE #define MICROPY_PY_URE (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) #endif From d470c5a5baa8660461b76585a57f2de28b30f5dc Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 10 Mar 2022 00:41:03 +1100 Subject: [PATCH 0212/1712] tests/extmod/vfs_posix.py: Only test statvfs if it exists. Signed-off-by: Damien George --- tests/extmod/vfs_posix.py | 5 +++-- tests/extmod/vfs_posix.py.exp | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/extmod/vfs_posix.py b/tests/extmod/vfs_posix.py index f8c4aae406..2a14fc2076 100644 --- a/tests/extmod/vfs_posix.py +++ b/tests/extmod/vfs_posix.py @@ -59,9 +59,10 @@ print(uos.listdir(temp_dir)) vfs = uos.VfsPosix(temp_dir) print(list(i[0] for i in vfs.ilistdir("."))) -# stat, statvfs +# stat, statvfs (statvfs may not exist) print(type(vfs.stat("."))) -print(type(vfs.statvfs("."))) +if hasattr(vfs, "statvfs"): + assert type(vfs.statvfs(".")) is tuple # check types of ilistdir with str/bytes arguments print(type(list(vfs.ilistdir("."))[0][0])) diff --git a/tests/extmod/vfs_posix.py.exp b/tests/extmod/vfs_posix.py.exp index e7d68f38ec..eb9ab43106 100644 --- a/tests/extmod/vfs_posix.py.exp +++ b/tests/extmod/vfs_posix.py.exp @@ -7,7 +7,6 @@ hello ['test2'] ['test2'] - [] From 3356b5ef8d1b232a1df493f70f0ba434f293fe11 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 27 Jul 2021 00:38:21 +1000 Subject: [PATCH 0213/1712] py/objmodule: Support delegating failed attr lookups. This commit adds generic support for mutable module attributes on built in modules, by adding support for an optional hook function for module attribute lookup. If a module wants to support additional attribute load/ store/delete (beyond what is in the constant, globals dict) then it should add at the very end of its globals dict MP_MODULE_ATTR_DELEGATION_ENTRY(). This should point to a custom function which will handle any additional attributes. The mp_module_generic_attr() function is provided as a helper function for additional attributes: it requires an array of qstrs (terminated in MP_QSTRnull) and a corresponding array of objects (with a 1-1 mapping between qstrs and objects). If the qstr is found in the array then the corresponding object is loaded/stored/deleted. Signed-off-by: Damien George --- py/mpconfig.h | 6 ++++++ py/objmodule.c | 36 ++++++++++++++++++++++++++++++++++++ py/objmodule.h | 5 +++++ 3 files changed, 47 insertions(+) diff --git a/py/mpconfig.h b/py/mpconfig.h index a41e99b4c1..2b03b93f4e 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -822,6 +822,12 @@ typedef double mp_float_t; #define MICROPY_STREAMS_POSIX_API (0) #endif +// Whether modules can use MP_MODULE_ATTR_DELEGATION_ENTRY() to delegate failed +// attribute lookups. +#ifndef MICROPY_MODULE_ATTR_DELEGATION +#define MICROPY_MODULE_ATTR_DELEGATION (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) +#endif + // Whether to call __init__ when importing builtin modules for the first time #ifndef MICROPY_MODULE_BUILTIN_INIT #define MICROPY_MODULE_BUILTIN_INIT (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) diff --git a/py/objmodule.c b/py/objmodule.c index f7cd437bac..0cd10e61f0 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -62,6 +62,21 @@ STATIC void module_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kin mp_printf(print, "", module_name); } +STATIC void module_attr_try_delegation(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { + #if MICROPY_MODULE_ATTR_DELEGATION + // Delegate lookup to a module's custom attr method (found in last lot of globals dict). + mp_obj_module_t *self = MP_OBJ_TO_PTR(self_in); + mp_map_t *map = &self->globals->map; + if (map->table[map->alloc - 1].key == MP_OBJ_NEW_QSTR(MP_QSTRnull)) { + ((mp_attr_fun_t)MP_OBJ_TO_PTR(map->table[map->alloc - 1].value))(self_in, attr, dest); + } + #else + (void)self_in; + (void)attr; + (void)dest; + #endif +} + STATIC void module_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { mp_obj_module_t *self = MP_OBJ_TO_PTR(self_in); if (dest[0] == MP_OBJ_NULL) { @@ -74,8 +89,12 @@ STATIC void module_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { elem = mp_map_lookup(&self->globals->map, MP_OBJ_NEW_QSTR(MP_QSTR___getattr__), MP_MAP_LOOKUP); if (elem != NULL) { dest[0] = mp_call_function_1(elem->value, MP_OBJ_NEW_QSTR(attr)); + } else { + module_attr_try_delegation(self_in, attr, dest); } #endif + } else { + module_attr_try_delegation(self_in, attr, dest); } } else { // delete/store attribute @@ -91,6 +110,7 @@ STATIC void module_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { #endif { // can't delete or store to fixed map + module_attr_try_delegation(self_in, attr, dest); return; } } @@ -319,3 +339,19 @@ STATIC void mp_module_call_init(mp_obj_t module_name, mp_obj_t module_obj) { } } #endif + +void mp_module_generic_attr(qstr attr, mp_obj_t *dest, const uint16_t *keys, mp_obj_t *values) { + for (size_t i = 0; keys[i] != MP_QSTRnull; ++i) { + if (attr == keys[i]) { + if (dest[0] == MP_OBJ_NULL) { + // load attribute (MP_OBJ_NULL returned for deleted items) + dest[0] = values[i]; + } else { + // delete or store (delete stores MP_OBJ_NULL) + values[i] = dest[1]; + dest[0] = MP_OBJ_NULL; // indicate success + } + return; + } + } +} diff --git a/py/objmodule.h b/py/objmodule.h index 8a82d13fe5..d11d5bcd74 100644 --- a/py/objmodule.h +++ b/py/objmodule.h @@ -28,6 +28,9 @@ #include "py/obj.h" +// Place at the very end of a module's globals_table. +#define MP_MODULE_ATTR_DELEGATION_ENTRY(ptr) { MP_ROM_QSTR(MP_QSTRnull), MP_ROM_PTR(ptr) } + extern const mp_map_t mp_builtin_module_map; mp_obj_t mp_module_get_loaded_or_builtin(qstr module_name); @@ -35,4 +38,6 @@ mp_obj_t mp_module_get_loaded_or_builtin(qstr module_name); mp_obj_t mp_module_get_builtin(qstr module_name); #endif +void mp_module_generic_attr(qstr attr, mp_obj_t *dest, const uint16_t *keys, mp_obj_t *values); + #endif // MICROPY_INCLUDED_PY_OBJMODULE_H From bc181550a4790f4dcfaf10e7e61ecfcdf346d5a8 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 27 Jul 2021 00:39:04 +1000 Subject: [PATCH 0214/1712] py/modsys: Add optional attribute delegation. To be enabled when needed by specific sys attributes. Signed-off-by: Damien George --- py/modsys.c | 18 ++++++++++++++++++ py/mpconfig.h | 6 ++++++ py/mpstate.h | 9 +++++++++ 3 files changed, 33 insertions(+) diff --git a/py/modsys.c b/py/modsys.c index 43666bc00e..a05709f8e6 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -27,6 +27,7 @@ #include "py/builtin.h" #include "py/objlist.h" +#include "py/objmodule.h" #include "py/objtuple.h" #include "py/objstr.h" #include "py/objint.h" @@ -182,6 +183,18 @@ STATIC mp_obj_t mp_sys_settrace(mp_obj_t obj) { MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_settrace_obj, mp_sys_settrace); #endif // MICROPY_PY_SYS_SETTRACE +#if MICROPY_PY_SYS_ATTR_DELEGATION +STATIC const uint16_t sys_mutable_keys[] = { + MP_QSTRnull, +}; + +STATIC void mp_module_sys_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { + MP_STATIC_ASSERT(MP_ARRAY_SIZE(sys_mutable_keys) == MP_SYS_MUTABLE_NUM + 1); + MP_STATIC_ASSERT(MP_ARRAY_SIZE(MP_STATE_VM(sys_mutable)) == MP_SYS_MUTABLE_NUM); + mp_module_generic_attr(attr, dest, sys_mutable_keys, MP_STATE_VM(sys_mutable)); +} +#endif + STATIC const mp_rom_map_elem_t mp_module_sys_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sys) }, @@ -244,6 +257,11 @@ STATIC const mp_rom_map_elem_t mp_module_sys_globals_table[] = { #if MICROPY_PY_SYS_ATEXIT { MP_ROM_QSTR(MP_QSTR_atexit), MP_ROM_PTR(&mp_sys_atexit_obj) }, #endif + + #if MICROPY_PY_SYS_ATTR_DELEGATION + // Delegation of attr lookup. + MP_MODULE_ATTR_DELEGATION_ENTRY(&mp_module_sys_attr), + #endif }; STATIC MP_DEFINE_CONST_DICT(mp_module_sys_globals, mp_module_sys_globals_table); diff --git a/py/mpconfig.h b/py/mpconfig.h index 2b03b93f4e..617e897080 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1377,6 +1377,12 @@ typedef double mp_float_t; #define MICROPY_PY_SYS_STDIO_BUFFER (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) #endif +// Whether the sys module supports attribute delegation +// This is enabled automatically when needed by other features +#ifndef MICROPY_PY_SYS_ATTR_DELEGATION +#define MICROPY_PY_SYS_ATTR_DELEGATION (0) +#endif + // Whether to provide "uerrno" module #ifndef MICROPY_PY_UERRNO #define MICROPY_PY_UERRNO (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) diff --git a/py/mpstate.h b/py/mpstate.h index 7f86399f57..f29e6be502 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -40,6 +40,10 @@ // memory system, runtime and virtual machine. The state is a global // variable, but in the future it is hoped that the state can become local. +enum { + MP_SYS_MUTABLE_NUM, +}; + // This structure contains dynamic configuration for the compiler. #if MICROPY_DYNAMIC_COMPILER typedef struct mp_dynamic_compiler_t { @@ -158,6 +162,11 @@ typedef struct _mp_state_vm_t { // must be initialised after the call to mp_init. mp_obj_list_t mp_sys_path_obj; mp_obj_list_t mp_sys_argv_obj; + + #if MICROPY_PY_SYS_ATTR_DELEGATION + // Contains mutable sys attributes. + mp_obj_t sys_mutable[MP_SYS_MUTABLE_NUM]; + #endif #endif // dictionary for overridden builtins From cac939ddc3625da7e6cf1cf0309daba25fc1cedb Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 27 Jul 2021 00:41:27 +1000 Subject: [PATCH 0215/1712] py/modsys: Add optional sys.tracebacklimit attribute. With behaviour as per CPython. Signed-off-by: Damien George --- docs/library/sys.rst | 8 ++ .../unix/variants/coverage/mpconfigvariant.h | 2 + py/modsys.c | 3 + py/mpconfig.h | 7 +- py/mpstate.h | 3 + py/objexcept.c | 10 +++ py/runtime.c | 4 + tests/basics/sys_tracebacklimit.py | 78 +++++++++++++++++++ tests/run-tests.py | 1 + tests/unix/extra_coverage.py.exp | 4 +- 10 files changed, 117 insertions(+), 3 deletions(-) create mode 100644 tests/basics/sys_tracebacklimit.py diff --git a/docs/library/sys.rst b/docs/library/sys.rst index d36394c88c..f4ff8786a2 100644 --- a/docs/library/sys.rst +++ b/docs/library/sys.rst @@ -144,6 +144,14 @@ Constants Standard output `stream`. +.. data:: tracebacklimit + + A mutable attribute holding an integer value which is the maximum number of traceback + entries to store in an exception. Set to 0 to disable adding tracebacks. Defaults + to 1000. + + Note: this is not available on all ports. + .. data:: version Python language version that this implementation conforms to, as a string. diff --git a/ports/unix/variants/coverage/mpconfigvariant.h b/ports/unix/variants/coverage/mpconfigvariant.h index db01c4bcd5..9b6b407754 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.h +++ b/ports/unix/variants/coverage/mpconfigvariant.h @@ -34,6 +34,7 @@ #define MICROPY_REPL_EMACS_WORDS_MOVE (1) #define MICROPY_REPL_EMACS_EXTRA_WORDS_MOVE (1) #define MICROPY_WARNINGS_CATEGORY (1) +#define MICROPY_MODULE_ATTR_DELEGATION (1) #define MICROPY_MODULE_GETATTR (1) #define MICROPY_PY_DELATTR_SETATTR (1) #define MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS (1) @@ -44,6 +45,7 @@ #define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP_MODULES (1) #define MICROPY_PY_SYS_GETSIZEOF (1) +#define MICROPY_PY_SYS_TRACEBACKLIMIT (1) #define MICROPY_PY_MATH_CONSTANTS (1) #define MICROPY_PY_MATH_FACTORIAL (1) #define MICROPY_PY_URANDOM_EXTRA_FUNCS (1) diff --git a/py/modsys.c b/py/modsys.c index a05709f8e6..c44c7ed450 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -185,6 +185,9 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_settrace_obj, mp_sys_settrace); #if MICROPY_PY_SYS_ATTR_DELEGATION STATIC const uint16_t sys_mutable_keys[] = { + #if MICROPY_PY_SYS_TRACEBACKLIMIT + MP_QSTR_tracebacklimit, + #endif MP_QSTRnull, }; diff --git a/py/mpconfig.h b/py/mpconfig.h index 617e897080..be967e6980 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1377,10 +1377,15 @@ typedef double mp_float_t; #define MICROPY_PY_SYS_STDIO_BUFFER (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) #endif +// Whether to provide sys.tracebacklimit mutable attribute +#ifndef MICROPY_PY_SYS_TRACEBACKLIMIT +#define MICROPY_PY_SYS_TRACEBACKLIMIT (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EVERYTHING) +#endif + // Whether the sys module supports attribute delegation // This is enabled automatically when needed by other features #ifndef MICROPY_PY_SYS_ATTR_DELEGATION -#define MICROPY_PY_SYS_ATTR_DELEGATION (0) +#define MICROPY_PY_SYS_ATTR_DELEGATION (MICROPY_PY_SYS_TRACEBACKLIMIT) #endif // Whether to provide "uerrno" module diff --git a/py/mpstate.h b/py/mpstate.h index f29e6be502..499d863512 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -41,6 +41,9 @@ // variable, but in the future it is hoped that the state can become local. enum { + #if MICROPY_PY_SYS_TRACEBACKLIMIT + MP_SYS_MUTABLE_TRACEBACKLIMIT, + #endif MP_SYS_MUTABLE_NUM, }; diff --git a/py/objexcept.c b/py/objexcept.c index 7a86c36471..dca287bb6e 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -575,6 +575,16 @@ void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qs // append this traceback info to traceback data // if memory allocation fails (eg because gc is locked), just return + #if MICROPY_PY_SYS_TRACEBACKLIMIT + mp_int_t max_traceback = MP_OBJ_SMALL_INT_VALUE(MP_STATE_VM(sys_mutable[MP_SYS_MUTABLE_TRACEBACKLIMIT])); + if (max_traceback <= 0) { + return; + } else if (self->traceback_data != NULL && self->traceback_len >= max_traceback * TRACEBACK_ENTRY_LEN) { + self->traceback_len -= TRACEBACK_ENTRY_LEN; + memmove(self->traceback_data, self->traceback_data + TRACEBACK_ENTRY_LEN, self->traceback_len * sizeof(self->traceback_data[0])); + } + #endif + if (self->traceback_data == NULL) { self->traceback_data = m_new_maybe(size_t, TRACEBACK_ENTRY_LEN); if (self->traceback_data == NULL) { diff --git a/py/runtime.c b/py/runtime.c index 8c93f539e0..665c9f2206 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -141,6 +141,10 @@ void mp_init(void) { MP_STATE_THREAD(current_code_state) = NULL; #endif + #if MICROPY_PY_SYS_TRACEBACKLIMIT + MP_STATE_VM(sys_mutable[MP_SYS_MUTABLE_TRACEBACKLIMIT]) = MP_OBJ_NEW_SMALL_INT(1000); + #endif + #if MICROPY_PY_BLUETOOTH MP_STATE_VM(bluetooth) = MP_OBJ_NULL; #endif diff --git a/tests/basics/sys_tracebacklimit.py b/tests/basics/sys_tracebacklimit.py new file mode 100644 index 0000000000..1ee638967f --- /dev/null +++ b/tests/basics/sys_tracebacklimit.py @@ -0,0 +1,78 @@ +# test sys.tracebacklimit + +try: + try: + import usys as sys + import uio as io + except ImportError: + import sys + import io +except ImportError: + print("SKIP") + raise SystemExit + +try: + sys.tracebacklimit = 1000 +except AttributeError: + print("SKIP") + raise SystemExit + +if hasattr(sys, "print_exception"): + print_exception = sys.print_exception +else: + import traceback + + print_exception = lambda e, f: traceback.print_exception(None, e, sys.exc_info()[2], file=f) + + +def print_exc(e): + buf = io.StringIO() + print_exception(e, buf) + s = buf.getvalue() + for l in s.split("\n"): + # Remove filename. + if l.startswith(" File "): + l = l.split('"') + print(l[0], l[2]) + # uPy and CPy tracebacks differ in that CPy prints a source line for + # each traceback entry. In this case, we know that offending line + # has 4-space indent, so filter it out. + elif not l.startswith(" "): + print(l) + + +def f0(): + raise ValueError("value") + + +def f1(): + f0() + + +def f2(): + f1() + + +def f3(): + f2() + + +def ftop(): + try: + f3() + except ValueError as er: + print_exc(er) + + +ftop() + +for limit in range(4, -2, -1): + print("limit", limit) + sys.tracebacklimit = limit + ftop() + + +# test deleting the attribute +print(hasattr(sys, "tracebacklimit")) +del sys.tracebacklimit +print(hasattr(sys, "tracebacklimit")) diff --git a/tests/run-tests.py b/tests/run-tests.py index edd20b9bd5..dfe0a8e55f 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -504,6 +504,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): skip_tests.add("basics/del_local.py") # requires checking for unbound local skip_tests.add("basics/exception_chain.py") # raise from is not supported skip_tests.add("basics/scope_implicit.py") # requires checking for unbound local + skip_tests.add("basics/sys_tracebacklimit.py") # requires traceback info skip_tests.add("basics/try_finally_return2.py") # requires raise_varargs skip_tests.add("basics/unboundlocal.py") # requires checking for unbound local skip_tests.add("extmod/uasyncio_event.py") # unknown issue diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index 1a5a2cde85..67d299bca1 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -45,8 +45,8 @@ utime utimeq argv atexit byteorder exc_info exit getsizeof implementation maxsize modules path platform print_exception -stderr stdin stdout version -version_info +stderr stdin stdout tracebacklimit +version version_info ementation # attrtuple (start=1, stop=2, step=3) From ac2293161e98e73d39434628f995e85bd97e52c2 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 27 Jul 2021 00:43:35 +1000 Subject: [PATCH 0216/1712] py/modsys: Add optional mutable attributes sys.ps1/ps2 and use them. This allows customising the REPL prompt strings. Signed-off-by: Damien George --- docs/library/sys.rst | 6 +++++ ports/unix/main.c | 8 +++--- .../unix/variants/coverage/mpconfigvariant.h | 1 + py/modsys.c | 4 +++ py/mpconfig.h | 7 ++++- py/mpstate.h | 4 +++ py/qstrdefs.h | 4 +++ py/repl.c | 10 +++++++ py/repl.h | 26 +++++++++++++++++++ py/runtime.c | 5 ++++ shared/runtime/pyexec.c | 10 +++---- tests/cmdline/repl_sys_ps1_ps2.py | 6 +++++ tests/cmdline/repl_sys_ps1_ps2.py.exp | 10 +++++++ tests/run-tests.py | 1 + tests/unix/extra_coverage.py.exp | 4 +-- 15 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 tests/cmdline/repl_sys_ps1_ps2.py create mode 100644 tests/cmdline/repl_sys_ps1_ps2.py.exp diff --git a/docs/library/sys.rst b/docs/library/sys.rst index f4ff8786a2..a2d55fecbb 100644 --- a/docs/library/sys.rst +++ b/docs/library/sys.rst @@ -132,6 +132,12 @@ Constants If you need to check whether your program runs on MicroPython (vs other Python implementation), use `sys.implementation` instead. +.. data:: ps1 + ps2 + + Mutable attributes holding strings, which are used for the REPL prompt. The defaults + give the standard Python prompt of ``>>>`` and ``...``. + .. data:: stderr Standard error `stream`. diff --git a/ports/unix/main.c b/ports/unix/main.c index bde867f8c8..c2a6c8c6b9 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -193,7 +193,7 @@ STATIC int do_repl(void) { input_restart: vstr_reset(&line); - int ret = readline(&line, ">>> "); + int ret = readline(&line, mp_repl_get_ps1()); mp_parse_input_kind_t parse_input_kind = MP_PARSE_SINGLE_INPUT; if (ret == CHAR_CTRL_C) { @@ -240,7 +240,7 @@ STATIC int do_repl(void) { // got a line with non-zero length, see if it needs continuing while (mp_repl_continue_with_input(vstr_null_terminated_str(&line))) { vstr_add_byte(&line, '\n'); - ret = readline(&line, "... "); + ret = readline(&line, mp_repl_get_ps2()); if (ret == CHAR_CTRL_C) { // cancel everything printf("\n"); @@ -265,13 +265,13 @@ STATIC int do_repl(void) { // use simple readline for (;;) { - char *line = prompt(">>> "); + char *line = prompt((char *)mp_repl_get_ps1()); if (line == NULL) { // EOF return 0; } while (mp_repl_continue_with_input(line)) { - char *line2 = prompt("... "); + char *line2 = prompt((char *)mp_repl_get_ps2()); if (line2 == NULL) { break; } diff --git a/ports/unix/variants/coverage/mpconfigvariant.h b/ports/unix/variants/coverage/mpconfigvariant.h index 9b6b407754..e2640f71f7 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.h +++ b/ports/unix/variants/coverage/mpconfigvariant.h @@ -45,6 +45,7 @@ #define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP_MODULES (1) #define MICROPY_PY_SYS_GETSIZEOF (1) +#define MICROPY_PY_SYS_PS1_PS2 (1) #define MICROPY_PY_SYS_TRACEBACKLIMIT (1) #define MICROPY_PY_MATH_CONSTANTS (1) #define MICROPY_PY_MATH_FACTORIAL (1) diff --git a/py/modsys.c b/py/modsys.c index c44c7ed450..ac90776226 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -185,6 +185,10 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_settrace_obj, mp_sys_settrace); #if MICROPY_PY_SYS_ATTR_DELEGATION STATIC const uint16_t sys_mutable_keys[] = { + #if MICROPY_PY_SYS_PS1_PS2 + MP_QSTR_ps1, + MP_QSTR_ps2, + #endif #if MICROPY_PY_SYS_TRACEBACKLIMIT MP_QSTR_tracebacklimit, #endif diff --git a/py/mpconfig.h b/py/mpconfig.h index be967e6980..47c16ed967 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1356,6 +1356,11 @@ typedef double mp_float_t; #define MICROPY_PY_SYS_ATEXIT (0) #endif +// Whether to provide sys.{ps1,ps2} mutable attributes, to control REPL prompts +#ifndef MICROPY_PY_SYS_PS1_PS2 +#define MICROPY_PY_SYS_PS1_PS2 (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) +#endif + // Whether to provide "sys.settrace" function #ifndef MICROPY_PY_SYS_SETTRACE #define MICROPY_PY_SYS_SETTRACE (0) @@ -1385,7 +1390,7 @@ typedef double mp_float_t; // Whether the sys module supports attribute delegation // This is enabled automatically when needed by other features #ifndef MICROPY_PY_SYS_ATTR_DELEGATION -#define MICROPY_PY_SYS_ATTR_DELEGATION (MICROPY_PY_SYS_TRACEBACKLIMIT) +#define MICROPY_PY_SYS_ATTR_DELEGATION (MICROPY_PY_SYS_PS1_PS2 || MICROPY_PY_SYS_TRACEBACKLIMIT) #endif // Whether to provide "uerrno" module diff --git a/py/mpstate.h b/py/mpstate.h index 499d863512..a493b780ab 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -41,6 +41,10 @@ // variable, but in the future it is hoped that the state can become local. enum { + #if MICROPY_PY_SYS_PS1_PS2 + MP_SYS_MUTABLE_PS1, + MP_SYS_MUTABLE_PS2, + #endif #if MICROPY_PY_SYS_TRACEBACKLIMIT MP_SYS_MUTABLE_TRACEBACKLIMIT, #endif diff --git a/py/qstrdefs.h b/py/qstrdefs.h index 405813941b..5003636df3 100644 --- a/py/qstrdefs.h +++ b/py/qstrdefs.h @@ -39,6 +39,10 @@ Q() Q(*) Q(_) Q(/) +#if MICROPY_PY_SYS_PS1_PS2 +Q(>>> ) +Q(... ) +#endif #if MICROPY_PY_BUILTINS_STR_OP_MODULO Q(%#o) Q(%#x) diff --git a/py/repl.c b/py/repl.c index 822e385abd..4e47cf784c 100644 --- a/py/repl.c +++ b/py/repl.c @@ -33,6 +33,16 @@ #if MICROPY_HELPER_REPL +#if MICROPY_PY_SYS_PS1_PS2 +const char *mp_repl_get_psx(unsigned int entry) { + if (mp_obj_is_str(MP_STATE_VM(sys_mutable)[entry])) { + return mp_obj_str_get_str(MP_STATE_VM(sys_mutable)[entry]); + } else { + return ""; + } +} +#endif + STATIC bool str_startswith_word(const char *str, const char *head) { size_t i; for (i = 0; str[i] && head[i]; i++) { diff --git a/py/repl.h b/py/repl.h index a7a4136cad..9e8f7f1dda 100644 --- a/py/repl.h +++ b/py/repl.h @@ -31,8 +31,34 @@ #include "py/mpprint.h" #if MICROPY_HELPER_REPL + +#if MICROPY_PY_SYS_PS1_PS2 + +const char *mp_repl_get_psx(unsigned int entry); + +static inline const char *mp_repl_get_ps1(void) { + return mp_repl_get_psx(MP_SYS_MUTABLE_PS1); +} + +static inline const char *mp_repl_get_ps2(void) { + return mp_repl_get_psx(MP_SYS_MUTABLE_PS2); +} + +#else + +static inline const char *mp_repl_get_ps1(void) { + return ">>> "; +} + +static inline const char *mp_repl_get_ps2(void) { + return "... "; +} + +#endif + bool mp_repl_continue_with_input(const char *input); size_t mp_repl_autocomplete(const char *str, size_t len, const mp_print_t *print, const char **compl_str); + #endif #endif // MICROPY_INCLUDED_PY_REPL_H diff --git a/py/runtime.c b/py/runtime.c index 665c9f2206..ba3fbe7fa5 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -135,6 +135,11 @@ void mp_init(void) { MP_STATE_VM(sys_exitfunc) = mp_const_none; #endif + #if MICROPY_PY_SYS_PS1_PS2 + MP_STATE_VM(sys_mutable[MP_SYS_MUTABLE_PS1]) = MP_OBJ_NEW_QSTR(MP_QSTR__gt__gt__gt__space_); + MP_STATE_VM(sys_mutable[MP_SYS_MUTABLE_PS2]) = MP_OBJ_NEW_QSTR(MP_QSTR__dot__dot__dot__space_); + #endif + #if MICROPY_PY_SYS_SETTRACE MP_STATE_THREAD(prof_trace_callback) = MP_OBJ_NULL; MP_STATE_THREAD(prof_callback_is_executing) = false; diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c index ae6dd770b1..9fde987a4b 100644 --- a/shared/runtime/pyexec.c +++ b/shared/runtime/pyexec.c @@ -433,7 +433,7 @@ STATIC int pyexec_friendly_repl_process_char(int c) { vstr_add_byte(MP_STATE_VM(repl_line), '\n'); repl.cont_line = true; - readline_note_newline("... "); + readline_note_newline(mp_repl_get_ps2()); return 0; } else { @@ -454,7 +454,7 @@ STATIC int pyexec_friendly_repl_process_char(int c) { if (mp_repl_continue_with_input(vstr_null_terminated_str(MP_STATE_VM(repl_line)))) { vstr_add_byte(MP_STATE_VM(repl_line), '\n'); - readline_note_newline("... "); + readline_note_newline(mp_repl_get_ps2()); return 0; } @@ -468,7 +468,7 @@ STATIC int pyexec_friendly_repl_process_char(int c) { vstr_reset(MP_STATE_VM(repl_line)); repl.cont_line = false; repl.paste_mode = false; - readline_init(MP_STATE_VM(repl_line), ">>> "); + readline_init(MP_STATE_VM(repl_line), mp_repl_get_ps1()); return 0; } } @@ -598,7 +598,7 @@ friendly_repl_reset: } vstr_reset(&line); - int ret = readline(&line, ">>> "); + int ret = readline(&line, mp_repl_get_ps1()); mp_parse_input_kind_t parse_input_kind = MP_PARSE_SINGLE_INPUT; if (ret == CHAR_CTRL_A) { @@ -651,7 +651,7 @@ friendly_repl_reset: // got a line with non-zero length, see if it needs continuing while (mp_repl_continue_with_input(vstr_null_terminated_str(&line))) { vstr_add_byte(&line, '\n'); - ret = readline(&line, "... "); + ret = readline(&line, mp_repl_get_ps2()); if (ret == CHAR_CTRL_C) { // cancel everything mp_hal_stdout_tx_str("\r\n"); diff --git a/tests/cmdline/repl_sys_ps1_ps2.py b/tests/cmdline/repl_sys_ps1_ps2.py new file mode 100644 index 0000000000..4f96057c49 --- /dev/null +++ b/tests/cmdline/repl_sys_ps1_ps2.py @@ -0,0 +1,6 @@ +# test changing ps1/ps2 +import usys +usys.ps1 = "PS1" +usys.ps2 = "PS2" +(1 + +2) diff --git a/tests/cmdline/repl_sys_ps1_ps2.py.exp b/tests/cmdline/repl_sys_ps1_ps2.py.exp new file mode 100644 index 0000000000..e4a802d34d --- /dev/null +++ b/tests/cmdline/repl_sys_ps1_ps2.py.exp @@ -0,0 +1,10 @@ +MicroPython \.\+ version +Use \.\+ +>>> # test changing ps1/ps2 +>>> import usys +>>> usys.ps1 = "PS1" +PS1usys.ps2 = "PS2" +PS1(1 + +PS22) +3 +PS1 diff --git a/tests/run-tests.py b/tests/run-tests.py index dfe0a8e55f..9c298dae31 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -433,6 +433,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): if not has_coverage: skip_tests.add("cmdline/cmd_parsetree.py") + skip_tests.add("cmdline/repl_sys_ps1_ps2.py") # Some tests shouldn't be run on a PC if args.target == "unix": diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index 67d299bca1..f6681f4ac1 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -45,8 +45,8 @@ utime utimeq argv atexit byteorder exc_info exit getsizeof implementation maxsize modules path platform print_exception -stderr stdin stdout tracebacklimit -version version_info +ps1 ps2 stderr stdin +stdout tracebacklimit version version_info ementation # attrtuple (start=1, stop=2, step=3) From 0ac3191d8c3be9d043af3d75fd5264f8b2f995a1 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 10 Mar 2022 13:20:50 +1100 Subject: [PATCH 0217/1712] unix/mpconfigport.h: Collect together config options from extra level. This change is a no-op in terms of functionality. Signed-off-by: Damien George --- ports/unix/mpconfigport.h | 132 ++++++++++++++++++++------------------ 1 file changed, 68 insertions(+), 64 deletions(-) diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h index f96abb9420..9987630382 100644 --- a/ports/unix/mpconfigport.h +++ b/ports/unix/mpconfigport.h @@ -34,6 +34,74 @@ // If we're building the minimal variant, ignore the rest of this file. #ifndef MICROPY_UNIX_MINIMAL +// If the variant did not set a feature level then configure a set of features. +#ifndef MICROPY_CONFIG_ROM_LEVEL +#define MICROPY_COMP_MODULE_CONST (1) +#define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (1) +#define MICROPY_COMP_RETURN_IF_EXPR (1) +#ifndef MICROPY_OPT_LOAD_ATTR_FAST_PATH +#define MICROPY_OPT_LOAD_ATTR_FAST_PATH (1) +#endif +#ifndef MICROPY_OPT_MAP_LOOKUP_CACHE +#define MICROPY_OPT_MAP_LOOKUP_CACHE (1) +#endif +#define MICROPY_ENABLE_FINALISER (1) +#define MICROPY_STACK_CHECK (1) +#define MICROPY_KBD_EXCEPTION (1) +#define MICROPY_HELPER_REPL (1) +#define MICROPY_REPL_EMACS_KEYS (1) +#define MICROPY_REPL_AUTO_INDENT (1) +#define MICROPY_ENABLE_SOURCE_LINE (1) +#ifndef MICROPY_STREAMS_NON_BLOCK +#define MICROPY_STREAMS_NON_BLOCK (1) +#endif +#define MICROPY_MODULE_WEAK_LINKS (1) +#define MICROPY_CAN_OVERRIDE_BUILTINS (1) +#define MICROPY_PY_FUNCTION_ATTRS (1) +#define MICROPY_PY_DESCRIPTORS (1) +#define MICROPY_PY_DELATTR_SETATTR (1) +#define MICROPY_PY_FSTRINGS (1) +#define MICROPY_PY_BUILTINS_STR_UNICODE (1) +#define MICROPY_PY_BUILTINS_STR_CENTER (1) +#define MICROPY_PY_BUILTINS_STR_PARTITION (1) +#define MICROPY_PY_BUILTINS_STR_SPLITLINES (1) +#define MICROPY_PY_BUILTINS_MEMORYVIEW (1) +#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1) +#define MICROPY_PY_BUILTINS_SLICE_INDICES (1) +#define MICROPY_PY_BUILTINS_FROZENSET (1) +#define MICROPY_PY_BUILTINS_ROUND_INT (1) +#define MICROPY_PY_ALL_SPECIAL_METHODS (1) +#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1) +#define MICROPY_PY_BUILTINS_COMPILE (1) +#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1) +#define MICROPY_PY_BUILTINS_INPUT (1) +#define MICROPY_PY_BUILTINS_POW3 (1) +#define MICROPY_PY_MICROPYTHON_MEM_INFO (1) +#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1) +#define MICROPY_PY_COLLECTIONS_DEQUE (1) +#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1) +#ifndef MICROPY_PY_MATH_SPECIAL_FUNCTIONS +#define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (1) +#endif +#define MICROPY_PY_MATH_ISCLOSE (MICROPY_PY_MATH_SPECIAL_FUNCTIONS) +#define MICROPY_PY_CMATH (1) +#define MICROPY_PY_IO_IOBASE (1) +#define MICROPY_PY_IO_FILEIO (1) +#define MICROPY_PY_SYS_MAXSIZE (1) +#define MICROPY_PY_SYS_STDFILES (1) +#define MICROPY_PY_UERRNO (1) +#define MICROPY_PY_UCTYPES (1) +#define MICROPY_PY_UZLIB (1) +#define MICROPY_PY_UJSON (1) +#define MICROPY_PY_UOS (1) +#define MICROPY_PY_URE (1) +#define MICROPY_PY_UHEAPQ (1) +#define MICROPY_PY_UHASHLIB (1) +#define MICROPY_PY_UBINASCII (1) +#define MICROPY_PY_UBINASCII_CRC32 (1) +#define MICROPY_PY_URANDOM (1) +#endif + #define MICROPY_ALLOC_PATH_MAX (PATH_MAX) #define MICROPY_PERSISTENT_CODE_LOAD (1) #if !defined(MICROPY_EMIT_X64) && defined(__x86_64__) @@ -51,12 +119,7 @@ #if !defined(MICROPY_EMIT_ARM) && defined(__arm__) && !defined(__thumb2__) #define MICROPY_EMIT_ARM (1) #endif -#define MICROPY_COMP_MODULE_CONST (1) -#define MICROPY_COMP_TRIPLE_TUPLE_ASSIGN (1) -#define MICROPY_COMP_RETURN_IF_EXPR (1) #define MICROPY_ENABLE_GC (1) -#define MICROPY_ENABLE_FINALISER (1) -#define MICROPY_STACK_CHECK (1) #define MICROPY_MALLOC_USES_ALLOCATED_SIZE (1) #define MICROPY_MEM_STATS (1) #define MICROPY_DEBUG_PRINTERS (1) @@ -66,52 +129,16 @@ #define MICROPY_READER_POSIX (1) #define MICROPY_READER_VFS (1) #define MICROPY_USE_READLINE_HISTORY (1) -#define MICROPY_HELPER_REPL (1) -#define MICROPY_REPL_EMACS_KEYS (1) -#define MICROPY_REPL_AUTO_INDENT (1) #define MICROPY_HELPER_LEXER_UNIX (1) -#define MICROPY_ENABLE_SOURCE_LINE (1) #ifndef MICROPY_FLOAT_IMPL #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_DOUBLE) #endif #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ) -#ifndef MICROPY_STREAMS_NON_BLOCK -#define MICROPY_STREAMS_NON_BLOCK (1) -#endif #define MICROPY_STREAMS_POSIX_API (1) #define MICROPY_OPT_COMPUTED_GOTO (1) -#ifndef MICROPY_OPT_LOAD_ATTR_FAST_PATH -#define MICROPY_OPT_LOAD_ATTR_FAST_PATH (1) -#endif -#ifndef MICROPY_OPT_MAP_LOOKUP_CACHE -#define MICROPY_OPT_MAP_LOOKUP_CACHE (1) -#endif -#define MICROPY_MODULE_WEAK_LINKS (1) #define MICROPY_MODULE_OVERRIDE_MAIN_IMPORT (1) -#define MICROPY_CAN_OVERRIDE_BUILTINS (1) #define MICROPY_VFS (1) #define MICROPY_VFS_POSIX (1) -#define MICROPY_PY_FUNCTION_ATTRS (1) -#define MICROPY_PY_DESCRIPTORS (1) -#define MICROPY_PY_DELATTR_SETATTR (1) -#define MICROPY_PY_FSTRINGS (1) -#define MICROPY_PY_BUILTINS_STR_UNICODE (1) -#define MICROPY_PY_BUILTINS_STR_CENTER (1) -#define MICROPY_PY_BUILTINS_STR_PARTITION (1) -#define MICROPY_PY_BUILTINS_STR_SPLITLINES (1) -#define MICROPY_PY_BUILTINS_MEMORYVIEW (1) -#define MICROPY_PY_BUILTINS_FROZENSET (1) -#define MICROPY_PY_BUILTINS_COMPILE (1) -#define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (1) -#define MICROPY_PY_BUILTINS_INPUT (1) -#define MICROPY_PY_BUILTINS_POW3 (1) -#define MICROPY_PY_BUILTINS_ROUND_INT (1) -#define MICROPY_PY_MICROPYTHON_MEM_INFO (1) -#define MICROPY_PY_ALL_SPECIAL_METHODS (1) -#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1) -#define MICROPY_PY_ARRAY_SLICE_ASSIGN (1) -#define MICROPY_PY_BUILTINS_SLICE_ATTRS (1) -#define MICROPY_PY_BUILTINS_SLICE_INDICES (1) #define MICROPY_PY_SYS_PATH_ARGV_DEFAULTS (0) #define MICROPY_PY_SYS_EXIT (1) #define MICROPY_PY_SYS_ATEXIT (1) @@ -129,18 +156,7 @@ #ifndef MICROPY_PY_SYS_PATH_DEFAULT #define MICROPY_PY_SYS_PATH_DEFAULT ".frozen:~/.micropython/lib:/usr/lib/micropython" #endif -#define MICROPY_PY_SYS_MAXSIZE (1) -#define MICROPY_PY_SYS_STDFILES (1) #define MICROPY_PY_SYS_EXC_INFO (1) -#define MICROPY_PY_COLLECTIONS_DEQUE (1) -#define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1) -#ifndef MICROPY_PY_MATH_SPECIAL_FUNCTIONS -#define MICROPY_PY_MATH_SPECIAL_FUNCTIONS (1) -#endif -#define MICROPY_PY_MATH_ISCLOSE (MICROPY_PY_MATH_SPECIAL_FUNCTIONS) -#define MICROPY_PY_CMATH (1) -#define MICROPY_PY_IO_IOBASE (1) -#define MICROPY_PY_IO_FILEIO (1) #define MICROPY_PY_GC_COLLECT_RETVAL (1) #ifndef MICROPY_STACKLESS @@ -148,7 +164,6 @@ #define MICROPY_STACKLESS_STRICT (0) #endif -#define MICROPY_PY_UOS (1) #define MICROPY_PY_UOS_INCLUDEFILE "ports/unix/moduos.c" #define MICROPY_PY_UOS_ERRNO (1) #define MICROPY_PY_UOS_GETENV_PUTENV_UNSETENV (1) @@ -157,22 +172,12 @@ #define MICROPY_PY_UOS_URANDOM (1) #define MICROPY_PY_UTIME (1) #define MICROPY_PY_UTIME_MP_HAL (1) -#define MICROPY_PY_UERRNO (1) -#define MICROPY_PY_UCTYPES (1) -#define MICROPY_PY_UZLIB (1) -#define MICROPY_PY_UJSON (1) -#define MICROPY_PY_URE (1) -#define MICROPY_PY_UHEAPQ (1) #define MICROPY_PY_UTIMEQ (1) -#define MICROPY_PY_UHASHLIB (1) #if MICROPY_PY_USSL #define MICROPY_PY_UHASHLIB_MD5 (1) #define MICROPY_PY_UHASHLIB_SHA1 (1) #define MICROPY_PY_UCRYPTOLIB (1) #endif -#define MICROPY_PY_UBINASCII (1) -#define MICROPY_PY_UBINASCII_CRC32 (1) -#define MICROPY_PY_URANDOM (1) #ifndef MICROPY_PY_USELECT_POSIX #define MICROPY_PY_USELECT_POSIX (1) #endif @@ -206,7 +211,6 @@ extern const struct _mp_print_t mp_stderr_print; #define MICROPY_ENABLE_EMERGENCY_EXCEPTION_BUF (1) #define MICROPY_EMERGENCY_EXCEPTION_BUF_SIZE (256) -#define MICROPY_KBD_EXCEPTION (1) #define MICROPY_ASYNC_KBD_INTR (1) #define mp_import_stat mp_vfs_import_stat From 3c20ddb41adc177442b68a8fdff221c80e0b0b5e Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 10 Mar 2022 13:21:11 +1100 Subject: [PATCH 0218/1712] unix/variants: Use rom feature config for standard, dev, coverage. This change is a no-op in terms of functionality. Signed-off-by: Damien George --- .../unix/variants/coverage/mpconfigvariant.h | 26 ++++++++---------- ports/unix/variants/dev/mpconfigvariant.h | 27 ++++++++++++------- .../unix/variants/standard/mpconfigvariant.h | 21 +++++++++++++-- 3 files changed, 47 insertions(+), 27 deletions(-) diff --git a/ports/unix/variants/coverage/mpconfigvariant.h b/ports/unix/variants/coverage/mpconfigvariant.h index e2640f71f7..14f6b8331e 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.h +++ b/ports/unix/variants/coverage/mpconfigvariant.h @@ -27,36 +27,32 @@ // This config enables almost all possible features such that it can be used // for coverage testing. +// Set base feature level. +#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES) + +// Disable some features that come enabled by default with the feature level. +#define MICROPY_OPT_MPZ_BITWISE (0) +#define MICROPY_MODULE_BUILTIN_INIT (0) +#define MICROPY_PY_BUILTINS_EXECFILE (0) +#define MICROPY_PY_SYS_STDIO_BUFFER (0) +#define MICROPY_PY_USELECT (0) + +// Enable additional features. #define MICROPY_DEBUG_PARSE_RULE_NAME (1) -#define MICROPY_OPT_MATH_FACTORIAL (1) #define MICROPY_FLOAT_HIGH_QUALITY_HASH (1) -#define MICROPY_ENABLE_SCHEDULER (1) #define MICROPY_REPL_EMACS_WORDS_MOVE (1) #define MICROPY_REPL_EMACS_EXTRA_WORDS_MOVE (1) #define MICROPY_WARNINGS_CATEGORY (1) -#define MICROPY_MODULE_ATTR_DELEGATION (1) -#define MICROPY_MODULE_GETATTR (1) -#define MICROPY_PY_DELATTR_SETATTR (1) #define MICROPY_PY_ALL_INPLACE_SPECIAL_METHODS (1) -#define MICROPY_PY_REVERSE_SPECIAL_METHODS (1) #define MICROPY_PY_BUILTINS_MEMORYVIEW_ITEMSIZE (1) #define MICROPY_PY_BUILTINS_NEXT2 (1) #define MICROPY_PY_BUILTINS_RANGE_BINOP (1) -#define MICROPY_PY_BUILTINS_HELP (1) -#define MICROPY_PY_BUILTINS_HELP_MODULES (1) #define MICROPY_PY_SYS_GETSIZEOF (1) -#define MICROPY_PY_SYS_PS1_PS2 (1) #define MICROPY_PY_SYS_TRACEBACKLIMIT (1) -#define MICROPY_PY_MATH_CONSTANTS (1) -#define MICROPY_PY_MATH_FACTORIAL (1) -#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1) #define MICROPY_PY_IO_BUFFEREDWRITER (1) -#define MICROPY_PY_UASYNCIO (1) #define MICROPY_PY_URE_DEBUG (1) #define MICROPY_PY_URE_MATCH_GROUPS (1) #define MICROPY_PY_URE_MATCH_SPAN_START_END (1) -#define MICROPY_PY_URE_SUB (1) -#define MICROPY_PY_FRAMEBUF (1) #define MICROPY_PY_COLLECTIONS_NAMEDTUPLE__ASDICT (1) #define MICROPY_PY_UCRYPTOLIB (1) #define MICROPY_PY_UCRYPTOLIB_CTR (1) diff --git a/ports/unix/variants/dev/mpconfigvariant.h b/ports/unix/variants/dev/mpconfigvariant.h index 280243e344..16799322ff 100644 --- a/ports/unix/variants/dev/mpconfigvariant.h +++ b/ports/unix/variants/dev/mpconfigvariant.h @@ -24,16 +24,23 @@ * THE SOFTWARE. */ +// Set base feature level. +#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES) + +// Disable some features that come enabled by default with the feature level. +#define MICROPY_OPT_MPZ_BITWISE (0) +#define MICROPY_OPT_MATH_FACTORIAL (0) +#define MICROPY_MODULE_ATTR_DELEGATION (0) +#define MICROPY_MODULE_BUILTIN_INIT (0) +#define MICROPY_PY_BUILTINS_EXECFILE (0) +#define MICROPY_PY_MATH_FACTORIAL (0) +#define MICROPY_PY_SYS_PS1_PS2 (0) +#define MICROPY_PY_SYS_STDIO_BUFFER (0) +#define MICROPY_PY_USELECT (0) +#define MICROPY_PY_URE_SUB (0) +#define MICROPY_PY_FRAMEBUF (0) + +// Enable some additional features. #define MICROPY_REPL_EMACS_WORDS_MOVE (1) #define MICROPY_REPL_EMACS_EXTRA_WORDS_MOVE (1) -#define MICROPY_ENABLE_SCHEDULER (1) - -#define MICROPY_PY_BUILTINS_HELP (1) -#define MICROPY_PY_BUILTINS_HELP_MODULES (1) -#define MICROPY_PY_MATH_CONSTANTS (1) #define MICROPY_PY_SYS_SETTRACE (1) -#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1) - -#ifndef MICROPY_PY_UASYNCIO -#define MICROPY_PY_UASYNCIO (1) -#endif diff --git a/ports/unix/variants/standard/mpconfigvariant.h b/ports/unix/variants/standard/mpconfigvariant.h index 3cdcfa8e9b..1ec46ef92d 100644 --- a/ports/unix/variants/standard/mpconfigvariant.h +++ b/ports/unix/variants/standard/mpconfigvariant.h @@ -24,5 +24,22 @@ * THE SOFTWARE. */ -#define MICROPY_PY_BUILTINS_HELP (1) -#define MICROPY_PY_BUILTINS_HELP_MODULES (1) +// Set base feature level. +#define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES) + +// Disable some features that come enabled by default with the feature level. +#define MICROPY_OPT_MPZ_BITWISE (0) +#define MICROPY_OPT_MATH_FACTORIAL (0) +#define MICROPY_MODULE_ATTR_DELEGATION (0) +#define MICROPY_MODULE_BUILTIN_INIT (0) +#define MICROPY_ENABLE_SCHEDULER (0) +#define MICROPY_PY_BUILTINS_EXECFILE (0) +#define MICROPY_PY_MATH_CONSTANTS (0) +#define MICROPY_PY_MATH_FACTORIAL (0) +#define MICROPY_PY_SYS_PS1_PS2 (0) +#define MICROPY_PY_SYS_STDIO_BUFFER (0) +#define MICROPY_PY_USELECT (0) +#define MICROPY_PY_UASYNCIO (0) +#define MICROPY_PY_URE_SUB (0) +#define MICROPY_PY_URANDOM_EXTRA_FUNCS (0) +#define MICROPY_PY_FRAMEBUF (0) From eec07332b127587a62f6555644f069620afa6091 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 10 Mar 2022 13:34:43 +1100 Subject: [PATCH 0219/1712] unix/variants: Enable a few optimisations and features on dev, coverage. Signed-off-by: Damien George --- ports/unix/variants/coverage/mpconfigvariant.h | 1 - ports/unix/variants/dev/mpconfigvariant.h | 7 ------- 2 files changed, 8 deletions(-) diff --git a/ports/unix/variants/coverage/mpconfigvariant.h b/ports/unix/variants/coverage/mpconfigvariant.h index 14f6b8331e..2e36355ca6 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.h +++ b/ports/unix/variants/coverage/mpconfigvariant.h @@ -31,7 +31,6 @@ #define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES) // Disable some features that come enabled by default with the feature level. -#define MICROPY_OPT_MPZ_BITWISE (0) #define MICROPY_MODULE_BUILTIN_INIT (0) #define MICROPY_PY_BUILTINS_EXECFILE (0) #define MICROPY_PY_SYS_STDIO_BUFFER (0) diff --git a/ports/unix/variants/dev/mpconfigvariant.h b/ports/unix/variants/dev/mpconfigvariant.h index 16799322ff..87e89dc2a1 100644 --- a/ports/unix/variants/dev/mpconfigvariant.h +++ b/ports/unix/variants/dev/mpconfigvariant.h @@ -28,17 +28,10 @@ #define MICROPY_CONFIG_ROM_LEVEL (MICROPY_CONFIG_ROM_LEVEL_EXTRA_FEATURES) // Disable some features that come enabled by default with the feature level. -#define MICROPY_OPT_MPZ_BITWISE (0) -#define MICROPY_OPT_MATH_FACTORIAL (0) -#define MICROPY_MODULE_ATTR_DELEGATION (0) #define MICROPY_MODULE_BUILTIN_INIT (0) #define MICROPY_PY_BUILTINS_EXECFILE (0) -#define MICROPY_PY_MATH_FACTORIAL (0) -#define MICROPY_PY_SYS_PS1_PS2 (0) #define MICROPY_PY_SYS_STDIO_BUFFER (0) #define MICROPY_PY_USELECT (0) -#define MICROPY_PY_URE_SUB (0) -#define MICROPY_PY_FRAMEBUF (0) // Enable some additional features. #define MICROPY_REPL_EMACS_WORDS_MOVE (1) From 65851ebb5126d4940e91c9f2c1d13b4e10753579 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 16 Mar 2022 00:00:25 +1100 Subject: [PATCH 0220/1712] py/parse: Simplify handling of const int parse nodes. Signed-off-by: Damien George --- py/parse.c | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/py/parse.c b/py/parse.c index 68c761734a..ff639122cb 100644 --- a/py/parse.c +++ b/py/parse.c @@ -463,16 +463,21 @@ STATIC mp_parse_node_t make_node_const_object(parser_t *parser, size_t src_line, return (mp_parse_node_t)pn; } -STATIC mp_parse_node_t mp_parse_node_new_small_int_checked(parser_t *parser, mp_obj_t o_val) { - (void)parser; - mp_int_t val = MP_OBJ_SMALL_INT_VALUE(o_val); - #if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_D - // A parse node is only 32-bits and the small-int value must fit in 31-bits - if (((val ^ (val << 1)) & 0xffffffff80000000) != 0) { - return make_node_const_object(parser, 0, o_val); +// Create a parse node represeting a constant integer value, possibly optimising +// it by putting the (small) integer value directly in the parse node itself. +STATIC mp_parse_node_t make_node_const_int(parser_t *parser, size_t src_line, mp_obj_t obj) { + if (mp_obj_is_small_int(obj)) { + mp_int_t val = MP_OBJ_SMALL_INT_VALUE(obj); + #if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_D + // A parse node is only 32-bits and the small-int value must fit in 31-bits + if (((val ^ (val << 1)) & 0xffffffff80000000) != 0) { + return make_node_const_object(parser, src_line, obj); + } + #endif + return mp_parse_node_new_small_int(val); + } else { + return make_node_const_object(parser, src_line, obj); } - #endif - return mp_parse_node_new_small_int(val); } STATIC void push_result_token(parser_t *parser, uint8_t rule_id) { @@ -485,11 +490,7 @@ STATIC void push_result_token(parser_t *parser, uint8_t rule_id) { mp_map_elem_t *elem; if (rule_id == RULE_atom && (elem = mp_map_lookup(&parser->consts, MP_OBJ_NEW_QSTR(id), MP_MAP_LOOKUP)) != NULL) { - if (mp_obj_is_small_int(elem->value)) { - pn = mp_parse_node_new_small_int_checked(parser, elem->value); - } else { - pn = make_node_const_object(parser, lex->tok_line, elem->value); - } + pn = make_node_const_int(parser, lex->tok_line, elem->value); } else { pn = mp_parse_node_new_leaf(MP_PARSE_NODE_ID, id); } @@ -499,11 +500,7 @@ STATIC void push_result_token(parser_t *parser, uint8_t rule_id) { #endif } else if (lex->tok_kind == MP_TOKEN_INTEGER) { mp_obj_t o = mp_parse_num_integer(lex->vstr.buf, lex->vstr.len, 0, lex); - if (mp_obj_is_small_int(o)) { - pn = mp_parse_node_new_small_int_checked(parser, o); - } else { - pn = make_node_const_object(parser, lex->tok_line, o); - } + pn = make_node_const_int(parser, lex->tok_line, o); } else if (lex->tok_kind == MP_TOKEN_FLOAT_OR_IMAG) { mp_obj_t o = mp_parse_num_decimal(lex->vstr.buf, lex->vstr.len, true, false, lex); pn = make_node_const_object(parser, lex->tok_line, o); @@ -784,12 +781,7 @@ STATIC bool fold_constants(parser_t *parser, uint8_t rule_id, size_t num_args) { for (size_t i = num_args; i > 0; i--) { pop_result(parser); } - if (mp_obj_is_small_int(arg0)) { - push_result_node(parser, mp_parse_node_new_small_int_checked(parser, arg0)); - } else { - // TODO reuse memory for parse node struct? - push_result_node(parser, make_node_const_object(parser, 0, arg0)); - } + push_result_node(parser, make_node_const_int(parser, 0, arg0)); return true; } From 3c7cab4e98a31649ed1bc2e728d610856382d6f5 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 16 Mar 2022 00:22:58 +1100 Subject: [PATCH 0221/1712] py/parse: Put const bytes objects in parse tree as const object. Instead of as an intermediate qstr, which may unnecessarily intern the data of the bytes object. Signed-off-by: Damien George --- py/compile.c | 10 ---------- py/parse.c | 19 +++++++++---------- py/parse.h | 6 ++---- tests/cmdline/cmd_parsetree.py.exp | 2 +- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/py/compile.c b/py/compile.c index 92736e22e5..f9e8de4573 100644 --- a/py/compile.c +++ b/py/compile.c @@ -2816,16 +2816,6 @@ STATIC void compile_node(compiler_t *comp, mp_parse_node_t pn) { case MP_PARSE_NODE_STRING: EMIT_ARG(load_const_str, arg); break; - case MP_PARSE_NODE_BYTES: - // only create and load the actual bytes object on the last pass - if (comp->pass != MP_PASS_EMIT) { - EMIT_ARG(load_const_obj, mp_const_none); - } else { - size_t len; - const byte *data = qstr_data(arg, &len); - EMIT_ARG(load_const_obj, mp_obj_new_bytes(data, len)); - } - break; case MP_PARSE_NODE_TOKEN: default: if (arg == MP_TOKEN_NEWLINE) { diff --git a/py/parse.c b/py/parse.c index ff639122cb..f18f03b3f1 100644 --- a/py/parse.c +++ b/py/parse.c @@ -388,9 +388,6 @@ void mp_parse_node_print(const mp_print_t *print, mp_parse_node_t pn, size_t ind case MP_PARSE_NODE_STRING: mp_printf(print, "str(%s)\n", qstr_str(arg)); break; - case MP_PARSE_NODE_BYTES: - mp_printf(print, "bytes(%s)\n", qstr_str(arg)); - break; default: assert(MP_PARSE_NODE_LEAF_KIND(pn) == MP_PARSE_NODE_TOKEN); mp_printf(print, "tok(%u)\n", (uint)arg); @@ -504,8 +501,8 @@ STATIC void push_result_token(parser_t *parser, uint8_t rule_id) { } else if (lex->tok_kind == MP_TOKEN_FLOAT_OR_IMAG) { mp_obj_t o = mp_parse_num_decimal(lex->vstr.buf, lex->vstr.len, true, false, lex); pn = make_node_const_object(parser, lex->tok_line, o); - } else if (lex->tok_kind == MP_TOKEN_STRING || lex->tok_kind == MP_TOKEN_BYTES) { - // Don't automatically intern all strings/bytes. doc strings (which are usually large) + } else if (lex->tok_kind == MP_TOKEN_STRING) { + // Don't automatically intern all strings. Doc strings (which are usually large) // will be discarded by the compiler, and so we shouldn't intern them. qstr qst = MP_QSTRnull; if (lex->vstr.len <= MICROPY_ALLOC_PARSE_INTERN_STRING_LEN) { @@ -517,14 +514,16 @@ STATIC void push_result_token(parser_t *parser, uint8_t rule_id) { } if (qst != MP_QSTRnull) { // qstr exists, make a leaf node - pn = mp_parse_node_new_leaf(lex->tok_kind == MP_TOKEN_STRING ? MP_PARSE_NODE_STRING : MP_PARSE_NODE_BYTES, qst); + pn = mp_parse_node_new_leaf(MP_PARSE_NODE_STRING, qst); } else { - // not interned, make a node holding a pointer to the string/bytes object - mp_obj_t o = mp_obj_new_str_copy( - lex->tok_kind == MP_TOKEN_STRING ? &mp_type_str : &mp_type_bytes, - (const byte *)lex->vstr.buf, lex->vstr.len); + // not interned, make a node holding a pointer to the string object + mp_obj_t o = mp_obj_new_str_copy(&mp_type_str, (const byte *)lex->vstr.buf, lex->vstr.len); pn = make_node_const_object(parser, lex->tok_line, o); } + } else if (lex->tok_kind == MP_TOKEN_BYTES) { + // make a node holding a pointer to the bytes object + mp_obj_t o = mp_obj_new_bytes((const byte *)lex->vstr.buf, lex->vstr.len); + pn = make_node_const_object(parser, lex->tok_line, o); } else { pn = mp_parse_node_new_leaf(MP_PARSE_NODE_TOKEN, lex->tok_kind); } diff --git a/py/parse.h b/py/parse.h index a6eb380047..9c327c28b6 100644 --- a/py/parse.h +++ b/py/parse.h @@ -39,15 +39,13 @@ struct _mp_lexer_t; // - xxxx...xx00: pointer to mp_parse_node_struct_t // - xx...xx0010: an identifier; bits 4 and above are the qstr // - xx...xx0110: a string; bits 4 and above are the qstr holding the value -// - xx...xx1010: a string of bytes; bits 4 and above are the qstr holding the value -// - xx...xx1110: a token; bits 4 and above are mp_token_kind_t +// - xx...xx1010: a token; bits 4 and above are mp_token_kind_t #define MP_PARSE_NODE_NULL (0) #define MP_PARSE_NODE_SMALL_INT (0x1) #define MP_PARSE_NODE_ID (0x02) #define MP_PARSE_NODE_STRING (0x06) -#define MP_PARSE_NODE_BYTES (0x0a) -#define MP_PARSE_NODE_TOKEN (0x0e) +#define MP_PARSE_NODE_TOKEN (0x0a) typedef uintptr_t mp_parse_node_t; // must be pointer size diff --git a/tests/cmdline/cmd_parsetree.py.exp b/tests/cmdline/cmd_parsetree.py.exp index ac16f6d88d..53d62a5dbd 100644 --- a/tests/cmdline/cmd_parsetree.py.exp +++ b/tests/cmdline/cmd_parsetree.py.exp @@ -18,7 +18,7 @@ [ 8] literal \.\+ [ 9] \(rule\|expr_stmt\)(5) (n=2) id(d) - bytes(bytes) +[ 9] literal \.\+ [ 10] \(rule\|expr_stmt\)(5) (n=2) id(e) [ 10] literal \.\+ From 962ad8622e4c732f76ecbf8d5191ba8216d244d3 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 16 Mar 2022 00:33:44 +1100 Subject: [PATCH 0222/1712] py/parse: Handle check for target small-int size in parser. This means that all constants for EMIT_ARG(load_const_obj, obj) are created in the parser (rather than some in the compiler). Signed-off-by: Damien George --- py/compile.c | 16 ---------------- py/parse.c | 7 +++++++ py/persistentcode.c | 2 +- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/py/compile.c b/py/compile.c index f9e8de4573..2e719206ff 100644 --- a/py/compile.c +++ b/py/compile.c @@ -2790,23 +2790,7 @@ STATIC void compile_node(compiler_t *comp, mp_parse_node_t pn) { // pass } else if (MP_PARSE_NODE_IS_SMALL_INT(pn)) { mp_int_t arg = MP_PARSE_NODE_LEAF_SMALL_INT(pn); - #if MICROPY_DYNAMIC_COMPILER - mp_uint_t sign_mask = -((mp_uint_t)1 << (mp_dynamic_compiler.small_int_bits - 1)); - if ((arg & sign_mask) == 0 || (arg & sign_mask) == sign_mask) { - // integer fits in target runtime's small-int - EMIT_ARG(load_const_small_int, arg); - } else { - // integer doesn't fit, so create a multi-precision int object - // (but only create the actual object on the last pass) - if (comp->pass != MP_PASS_EMIT) { - EMIT_ARG(load_const_obj, mp_const_none); - } else { - EMIT_ARG(load_const_obj, mp_obj_new_int_from_ll(arg)); - } - } - #else EMIT_ARG(load_const_small_int, arg); - #endif } else if (MP_PARSE_NODE_IS_LEAF(pn)) { uintptr_t arg = MP_PARSE_NODE_LEAF_ARG(pn); switch (MP_PARSE_NODE_LEAF_KIND(pn)) { diff --git a/py/parse.c b/py/parse.c index f18f03b3f1..233cba11b4 100644 --- a/py/parse.c +++ b/py/parse.c @@ -471,6 +471,13 @@ STATIC mp_parse_node_t make_node_const_int(parser_t *parser, size_t src_line, mp return make_node_const_object(parser, src_line, obj); } #endif + #if MICROPY_DYNAMIC_COMPILER + // Check that the integer value fits in target runtime's small-int + mp_uint_t sign_mask = -((mp_uint_t)1 << (mp_dynamic_compiler.small_int_bits - 1)); + if (!((val & sign_mask) == 0 || (val & sign_mask) == sign_mask)) { + return make_node_const_object(parser, src_line, obj); + } + #endif return mp_parse_node_new_small_int(val); } else { return make_node_const_object(parser, src_line, obj); diff --git a/py/persistentcode.c b/py/persistentcode.c index b473f18308..6110ae97f0 100644 --- a/py/persistentcode.c +++ b/py/persistentcode.c @@ -536,7 +536,7 @@ STATIC void save_obj(mp_print_t *print, mp_obj_t o) { // we save numbers using a simplistic text representation // TODO could be improved byte obj_type; - if (mp_obj_is_type(o, &mp_type_int)) { + if (mp_obj_is_int(o)) { obj_type = 'i'; #if MICROPY_PY_BUILTINS_COMPLEX } else if (mp_obj_is_type(o, &mp_type_complex)) { From 1692cad6733b82b1cb7631ce10c1ddb54e66058e Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 16 Mar 2022 11:39:27 +1100 Subject: [PATCH 0223/1712] py/showbc: Remove global variables and make DECODE_PTR work correctly. The bytecode state variables mp_showbc_code_start and mp_showbc_constants have been removed and made local variables passed into the various functions. As part of this, the DECODE_PTR macro is fixed so it extracts the relevant pointer from the child_table (a regression introduced in f2040bfc7ee033e48acef9f289790f3b4e6b74e5). Signed-off-by: Damien George --- py/bc.h | 6 ++--- py/compile.c | 2 +- py/showbc.c | 71 ++++++++++++++++++++++++++-------------------------- py/vm.c | 2 +- 4 files changed, 41 insertions(+), 40 deletions(-) diff --git a/py/bc.h b/py/bc.h index 5710f4d243..8709b42389 100644 --- a/py/bc.h +++ b/py/bc.h @@ -265,9 +265,9 @@ const byte *mp_decode_uint_skip(const byte *ptr); mp_vm_return_kind_t mp_execute_bytecode(mp_code_state_t *code_state, volatile mp_obj_t inject_exc); mp_code_state_t *mp_obj_fun_bc_prepare_codestate(mp_obj_t func, size_t n_args, size_t n_kw, const mp_obj_t *args); void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw, const mp_obj_t *args); -void mp_bytecode_print(const mp_print_t *print, const void *descr, const byte *code, mp_uint_t len, const mp_module_constants_t *cm); -void mp_bytecode_print2(const mp_print_t *print, const byte *code, size_t len, const mp_module_constants_t *cm); -const byte *mp_bytecode_print_str(const mp_print_t *print, const byte *ip); +void mp_bytecode_print(const mp_print_t *print, const struct _mp_raw_code_t *rc, const mp_module_constants_t *cm); +void mp_bytecode_print2(const mp_print_t *print, const byte *ip, size_t len, struct _mp_raw_code_t *const *child_table, const mp_module_constants_t *cm); +const byte *mp_bytecode_print_str(const mp_print_t *print, const byte *ip_start, const byte *ip, struct _mp_raw_code_t *const *child_table, const mp_module_constants_t *cm); #define mp_bytecode_print_inst(print, code, x_table) mp_bytecode_print2(print, code, 1, x_table) // Helper macros to access pointer with least significant bits holding flags diff --git a/py/compile.c b/py/compile.c index 2e719206ff..eb7389ec5f 100644 --- a/py/compile.c +++ b/py/compile.c @@ -3632,7 +3632,7 @@ mp_compiled_module_t mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr so if (mp_verbose_flag >= 2) { for (scope_t *s = comp->scope_head; s != NULL; s = s->next) { mp_raw_code_t *rc = s->raw_code; - mp_bytecode_print(&mp_plat_print, rc, rc->fun_data, rc->fun_data_len, &cm.context->constants); + mp_bytecode_print(&mp_plat_print, rc, &cm.context->constants); } } #endif diff --git a/py/showbc.c b/py/showbc.c index 1300ac1fa3..8430739d8e 100644 --- a/py/showbc.c +++ b/py/showbc.c @@ -28,7 +28,7 @@ #include #include "py/bc0.h" -#include "py/bc.h" +#include "py/emitglue.h" #if MICROPY_DEBUG_PRINTERS @@ -45,7 +45,7 @@ #define DECODE_QSTR \ DECODE_UINT; \ - qst = mp_showbc_constants->qstr_table[unum] + qst = qstr_table[unum] #else @@ -56,18 +56,16 @@ #endif #define DECODE_PTR \ - DECODE_UINT; + DECODE_UINT; \ + unum = (mp_uint_t)(uintptr_t)child_table[unum] #define DECODE_OBJ \ DECODE_UINT; \ - unum = (mp_uint_t)mp_showbc_constants->obj_table[unum] + unum = (mp_uint_t)obj_table[unum] -const byte * mp_showbc_code_start; -const mp_module_constants_t *mp_showbc_constants; - -#include "py/emitglue.h" -void mp_bytecode_print(const mp_print_t *print, const void *descr, const byte *ip, mp_uint_t len, const mp_module_constants_t *cm) { - mp_showbc_code_start = ip; +void mp_bytecode_print(const mp_print_t *print, const mp_raw_code_t *rc, const mp_module_constants_t *cm) { + const byte *ip_start = rc->fun_data; + const byte *ip = rc->fun_data; // Decode prelude MP_BC_PRELUDE_SIG_DECODE(ip); @@ -81,18 +79,18 @@ void mp_bytecode_print(const mp_print_t *print, const void *descr, const byte *i #else qstr source_file = cm->source_file; #endif - mp_printf(print, "File %s, code block '%s' (descriptor: %p, bytecode @%p " UINT_FMT " bytes)\n",// rct=%p\n", - qstr_str(source_file), qstr_str(block_name), descr, mp_showbc_code_start, len);// , ((mp_raw_code_t*)descr)->children); + mp_printf(print, "File %s, code block '%s' (descriptor: %p, bytecode @%p %u bytes)\n", + qstr_str(source_file), qstr_str(block_name), rc, ip_start, (unsigned)rc->fun_data_len); // raw bytecode dump - size_t prelude_size = ip - mp_showbc_code_start + n_info + n_cell; + size_t prelude_size = ip - ip_start + n_info + n_cell; mp_printf(print, "Raw bytecode (code_info_size=%u, bytecode_size=%u):\n", - (unsigned)prelude_size, (unsigned)(len - prelude_size)); - for (mp_uint_t i = 0; i < len; i++) { + (unsigned)prelude_size, (unsigned)(rc->fun_data_len - prelude_size)); + for (size_t i = 0; i < rc->fun_data_len; i++) { if (i > 0 && i % 16 == 0) { mp_printf(print, "\n"); } - mp_printf(print, " %02x", mp_showbc_code_start[i]); + mp_printf(print, " %02x", ip_start[i]); } mp_printf(print, "\n"); @@ -140,10 +138,14 @@ void mp_bytecode_print(const mp_print_t *print, const void *descr, const byte *i mp_printf(print, " bc=" INT_FMT " line=" UINT_FMT "\n", bc, source_line); } } - mp_bytecode_print2(print, ip, len - prelude_size, cm); + mp_bytecode_print2(print, ip, rc->fun_data_len - prelude_size, rc->children, cm); } -const byte *mp_bytecode_print_str(const mp_print_t *print, const byte *ip) { +const byte *mp_bytecode_print_str(const mp_print_t *print, const byte *ip_start, const byte *ip, mp_raw_code_t *const *child_table, const mp_module_constants_t *cm) { + #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE + const qstr_short_t *qstr_table = cm->qstr_table; + #endif + const mp_obj_t *obj_table = cm->obj_table; mp_uint_t unum; qstr qst; @@ -302,32 +304,32 @@ const byte *mp_bytecode_print_str(const mp_print_t *print, const byte *ip) { case MP_BC_JUMP: DECODE_SLABEL; - mp_printf(print, "JUMP " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start)); + mp_printf(print, "JUMP " UINT_FMT, (mp_uint_t)(ip + unum - ip_start)); break; case MP_BC_POP_JUMP_IF_TRUE: DECODE_SLABEL; - mp_printf(print, "POP_JUMP_IF_TRUE " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start)); + mp_printf(print, "POP_JUMP_IF_TRUE " UINT_FMT, (mp_uint_t)(ip + unum - ip_start)); break; case MP_BC_POP_JUMP_IF_FALSE: DECODE_SLABEL; - mp_printf(print, "POP_JUMP_IF_FALSE " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start)); + mp_printf(print, "POP_JUMP_IF_FALSE " UINT_FMT, (mp_uint_t)(ip + unum - ip_start)); break; case MP_BC_JUMP_IF_TRUE_OR_POP: DECODE_SLABEL; - mp_printf(print, "JUMP_IF_TRUE_OR_POP " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start)); + mp_printf(print, "JUMP_IF_TRUE_OR_POP " UINT_FMT, (mp_uint_t)(ip + unum - ip_start)); break; case MP_BC_JUMP_IF_FALSE_OR_POP: DECODE_SLABEL; - mp_printf(print, "JUMP_IF_FALSE_OR_POP " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start)); + mp_printf(print, "JUMP_IF_FALSE_OR_POP " UINT_FMT, (mp_uint_t)(ip + unum - ip_start)); break; case MP_BC_SETUP_WITH: DECODE_ULABEL; // loop-like labels are always forward - mp_printf(print, "SETUP_WITH " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start)); + mp_printf(print, "SETUP_WITH " UINT_FMT, (mp_uint_t)(ip + unum - ip_start)); break; case MP_BC_WITH_CLEANUP: @@ -336,18 +338,18 @@ const byte *mp_bytecode_print_str(const mp_print_t *print, const byte *ip) { case MP_BC_UNWIND_JUMP: DECODE_SLABEL; - mp_printf(print, "UNWIND_JUMP " UINT_FMT " %d", (mp_uint_t)(ip + unum - mp_showbc_code_start), *ip); + mp_printf(print, "UNWIND_JUMP " UINT_FMT " %d", (mp_uint_t)(ip + unum - ip_start), *ip); ip += 1; break; case MP_BC_SETUP_EXCEPT: DECODE_ULABEL; // except labels are always forward - mp_printf(print, "SETUP_EXCEPT " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start)); + mp_printf(print, "SETUP_EXCEPT " UINT_FMT, (mp_uint_t)(ip + unum - ip_start)); break; case MP_BC_SETUP_FINALLY: DECODE_ULABEL; // except labels are always forward - mp_printf(print, "SETUP_FINALLY " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start)); + mp_printf(print, "SETUP_FINALLY " UINT_FMT, (mp_uint_t)(ip + unum - ip_start)); break; case MP_BC_END_FINALLY: @@ -368,12 +370,12 @@ const byte *mp_bytecode_print_str(const mp_print_t *print, const byte *ip) { case MP_BC_FOR_ITER: DECODE_ULABEL; // the jump offset if iteration finishes; for labels are always forward - mp_printf(print, "FOR_ITER " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start)); + mp_printf(print, "FOR_ITER " UINT_FMT, (mp_uint_t)(ip + unum - ip_start)); break; case MP_BC_POP_EXCEPT_JUMP: DECODE_ULABEL; // these labels are always forward - mp_printf(print, "POP_EXCEPT_JUMP " UINT_FMT, (mp_uint_t)(ip + unum - mp_showbc_code_start)); + mp_printf(print, "POP_EXCEPT_JUMP " UINT_FMT, (mp_uint_t)(ip + unum - ip_start)); break; case MP_BC_BUILD_TUPLE: @@ -528,12 +530,11 @@ const byte *mp_bytecode_print_str(const mp_print_t *print, const byte *ip) { return ip; } -void mp_bytecode_print2(const mp_print_t *print, const byte *ip, size_t len, const mp_module_constants_t *cm) { - mp_showbc_code_start = ip; - mp_showbc_constants = cm; - while (ip < len + mp_showbc_code_start) { - mp_printf(print, "%02u ", (uint)(ip - mp_showbc_code_start)); - ip = mp_bytecode_print_str(print, ip); +void mp_bytecode_print2(const mp_print_t *print, const byte *ip, size_t len, mp_raw_code_t *const *child_table, const mp_module_constants_t *cm) { + const byte *ip_start = ip; + while (ip < ip_start + len) { + mp_printf(print, "%02u ", (uint)(ip - ip_start)); + ip = mp_bytecode_print_str(print, ip_start, ip, child_table, cm); mp_printf(print, "\n"); } } diff --git a/py/vm.c b/py/vm.c index b762c92bf2..497a569622 100644 --- a/py/vm.c +++ b/py/vm.c @@ -44,7 +44,7 @@ #else #define TRACE_PREFIX mp_printf(&mp_plat_print, "sp=%d ", (int)(sp - &code_state->state[0] + 1)) #endif -#define TRACE(ip) TRACE_PREFIX; mp_bytecode_print2(&mp_plat_print, ip, 1, &code_state->fun_bc->context->constants); +#define TRACE(ip) TRACE_PREFIX; mp_bytecode_print2(&mp_plat_print, ip, 1, code_state->fun_bc->child_table, &code_state->fun_bc->context->constants); #else #define TRACE(ip) #endif From adfd57c5fedec4e64c2e34cbea89aa6ecdb40a50 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 10 Mar 2022 11:49:01 +1100 Subject: [PATCH 0224/1712] lib/re1.5: Distinguish between subject start-of-line and start-of-srch. Otherwise a repeated sub/split will continue to match ^ to the start of that search. Signed-off-by: Damien George --- lib/re1.5/re1.5.h | 1 + lib/re1.5/recursiveloop.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/re1.5/re1.5.h b/lib/re1.5/re1.5.h index ba6f97b743..81f43ed7f5 100644 --- a/lib/re1.5/re1.5.h +++ b/lib/re1.5/re1.5.h @@ -130,6 +130,7 @@ Sub *update(Sub*, int, const char*); void decref(Sub*); struct Subject { + const char *begin_line; const char *begin; const char *end; }; diff --git a/lib/re1.5/recursiveloop.c b/lib/re1.5/recursiveloop.c index f8cb926292..17ecea3378 100644 --- a/lib/re1.5/recursiveloop.c +++ b/lib/re1.5/recursiveloop.c @@ -68,7 +68,7 @@ recursiveloop(char *pc, const char *sp, Subject *input, const char **subp, int n subp[off] = old; return 0; case Bol: - if(sp != input->begin) + if(sp != input->begin_line) return 0; continue; case Eol: From 63f0e700f4e8927854ec1f70eeb114fa079632a3 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 10 Mar 2022 11:51:42 +1100 Subject: [PATCH 0225/1712] extmod/modure: Set subject begin_line so ^ doesn't match interior. Fixes issue #8402. Signed-off-by: Damien George --- extmod/modure.c | 6 +++--- tests/extmod/ure_split.py | 10 ++++++++++ tests/extmod/ure_sub.py | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/extmod/modure.c b/extmod/modure.c index 36c987a80d..d9e5451eb5 100644 --- a/extmod/modure.c +++ b/extmod/modure.c @@ -187,7 +187,7 @@ STATIC mp_obj_t ure_exec(bool is_anchored, uint n_args, const mp_obj_t *args) { } Subject subj; size_t len; - subj.begin = mp_obj_str_get_data(args[1], &len); + subj.begin_line = subj.begin = mp_obj_str_get_data(args[1], &len); subj.end = subj.begin + len; int caps_num = (self->re.sub + 1) * 2; mp_obj_match_t *match = m_new_obj_var(mp_obj_match_t, char *, caps_num); @@ -220,7 +220,7 @@ STATIC mp_obj_t re_split(size_t n_args, const mp_obj_t *args) { Subject subj; size_t len; const mp_obj_type_t *str_type = mp_obj_get_type(args[1]); - subj.begin = mp_obj_str_get_data(args[1], &len); + subj.begin_line = subj.begin = mp_obj_str_get_data(args[1], &len); subj.end = subj.begin + len; int caps_num = (self->re.sub + 1) * 2; @@ -280,7 +280,7 @@ STATIC mp_obj_t re_sub_helper(size_t n_args, const mp_obj_t *args) { size_t where_len; const char *where_str = mp_obj_str_get_data(where, &where_len); Subject subj; - subj.begin = where_str; + subj.begin_line = subj.begin = where_str; subj.end = subj.begin + where_len; int caps_num = (self->re.sub + 1) * 2; diff --git a/tests/extmod/ure_split.py b/tests/extmod/ure_split.py index a8b9c1686c..7e6ef3990f 100644 --- a/tests/extmod/ure_split.py +++ b/tests/extmod/ure_split.py @@ -31,3 +31,13 @@ print(s) r = re.compile(b"x") s = r.split(b"fooxbar") print(s) + +# using ^ +r = re.compile("^ab") +s = r.split("abababcabab") +print(s) + +# using ^ with | +r = re.compile("^ab|cab") +s = r.split("abababcabab") +print(s) diff --git a/tests/extmod/ure_sub.py b/tests/extmod/ure_sub.py index ae6ad28d62..806c389576 100644 --- a/tests/extmod/ure_sub.py +++ b/tests/extmod/ure_sub.py @@ -75,3 +75,7 @@ except TypeError: # Include \ in the sub replacement print(re.sub("b", "\\\\b", "abc")) + +# Using ^, make sure it doesn't repeatedly match +print(re.sub("^ab", "*", "abababcabab")) +print(re.sub("^ab|cab", "*", "abababcabab")) From a16dcc8136c8af47d69e7a4b3a55270db0e4c637 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sun, 13 Mar 2022 20:03:38 +0200 Subject: [PATCH 0226/1712] stm32/boards: Convert F4xx and F7xx to new flash FS config. Following on from 35e70c1698047170f9fb8b1edc65a7f7125f267f. Fixes issue #8390. --- ports/stm32/boards/stm32f401xd.ld | 11 +++++-- ports/stm32/boards/stm32f401xe.ld | 11 +++++-- ports/stm32/boards/stm32f405.ld | 6 ++++ ports/stm32/boards/stm32f411.ld | 11 +++++-- ports/stm32/boards/stm32f412zx.ld | 11 +++++-- ports/stm32/boards/stm32f427xi.ld | 7 ++++ ports/stm32/boards/stm32f429.ld | 7 ++++ ports/stm32/boards/stm32f722.ld | 6 ++++ ports/stm32/boards/stm32f746.ld | 6 ++++ ports/stm32/boards/stm32f767.ld | 6 ++++ ports/stm32/boards/stm32f769.ld | 6 ++++ ports/stm32/flashbdev.c | 55 +------------------------------ 12 files changed, 81 insertions(+), 62 deletions(-) diff --git a/ports/stm32/boards/stm32f401xd.ld b/ports/stm32/boards/stm32f401xd.ld index f4146abc6d..33b2912ace 100644 --- a/ports/stm32/boards/stm32f401xd.ld +++ b/ports/stm32/boards/stm32f401xd.ld @@ -7,9 +7,10 @@ MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 384K /* entire flash */ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */ - FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 112K /* sectors 1,2,3 are 16K, 4 is 64K */ + FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 64K /* sectors 1,2,3,4: 16k+16k+16k+16k(of 64k)=64k */ FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 256K /* sectors 5,6 are 128K */ - RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 80K + FS_CACHE (xrw) : ORIGIN = 0x20014000, LENGTH = 16K } /* produce a link error if there is not this amount of RAM for these sections */ @@ -26,3 +27,9 @@ _ram_start = ORIGIN(RAM); _ram_end = ORIGIN(RAM) + LENGTH(RAM); _heap_start = _ebss; /* heap starts just after statically allocated memory */ _heap_end = _sstack; + +/* Filesystem cache in RAM, and storage in flash */ +_micropy_hw_internal_flash_storage_ram_cache_start = ORIGIN(FS_CACHE); +_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(FS_CACHE) + LENGTH(FS_CACHE); +_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); +_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); diff --git a/ports/stm32/boards/stm32f401xe.ld b/ports/stm32/boards/stm32f401xe.ld index e7bd8edfed..d783cd1875 100644 --- a/ports/stm32/boards/stm32f401xe.ld +++ b/ports/stm32/boards/stm32f401xe.ld @@ -7,9 +7,10 @@ MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */ - FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 112K /* sectors 1,2,3 are 16K, 4 is 64K */ + FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 64K /* sectors 1,2,3,4: 16k+16k+16k+16k(of 64k)=64k */ FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 384K /* sectors 5,6,7 are 128K */ - RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 96K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 80K + FS_CACHE (xrw) : ORIGIN = 0x20014000, LENGTH = 16K } /* produce a link error if there is not this amount of RAM for these sections */ @@ -26,3 +27,9 @@ _ram_start = ORIGIN(RAM); _ram_end = ORIGIN(RAM) + LENGTH(RAM); _heap_start = _ebss; /* heap starts just after statically allocated memory */ _heap_end = _sstack; + +/* Filesystem cache in RAM, and storage in flash */ +_micropy_hw_internal_flash_storage_ram_cache_start = ORIGIN(FS_CACHE); +_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(FS_CACHE) + LENGTH(FS_CACHE); +_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); +_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); diff --git a/ports/stm32/boards/stm32f405.ld b/ports/stm32/boards/stm32f405.ld index b6f5d30578..6658c1e991 100644 --- a/ports/stm32/boards/stm32f405.ld +++ b/ports/stm32/boards/stm32f405.ld @@ -27,3 +27,9 @@ _ram_start = ORIGIN(RAM); _ram_end = ORIGIN(RAM) + LENGTH(RAM); _heap_start = _ebss; /* heap starts just after statically allocated memory */ _heap_end = _sstack; + +/* Filesystem cache in RAM, and storage in flash */ +_micropy_hw_internal_flash_storage_ram_cache_start = ORIGIN(CCMRAM); +_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(CCMRAM) + LENGTH(CCMRAM); +_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); +_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); diff --git a/ports/stm32/boards/stm32f411.ld b/ports/stm32/boards/stm32f411.ld index 50633118eb..6e874f66c8 100644 --- a/ports/stm32/boards/stm32f411.ld +++ b/ports/stm32/boards/stm32f411.ld @@ -7,9 +7,10 @@ MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* entire flash */ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */ - FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 112K /* sectors 1,2,3 are 16K, 4 is 64K */ + FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 64K /* sectors 1,2,3,4: 16k+16k+16k+16k(of 64k)=64k */ FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 384K /* sectors 5,6,7 are 128K */ - RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 112K + FS_CACHE (xrw) : ORIGIN = 0x2001c000, LENGTH = 16K } /* produce a link error if there is not this amount of RAM for these sections */ @@ -26,3 +27,9 @@ _ram_start = ORIGIN(RAM); _ram_end = ORIGIN(RAM) + LENGTH(RAM); _heap_start = _ebss; /* heap starts just after statically allocated memory */ _heap_end = _sstack; + +/* Filesystem cache in RAM, and storage in flash */ +_micropy_hw_internal_flash_storage_ram_cache_start = ORIGIN(FS_CACHE); +_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(FS_CACHE) + LENGTH(FS_CACHE); +_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); +_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); diff --git a/ports/stm32/boards/stm32f412zx.ld b/ports/stm32/boards/stm32f412zx.ld index 55aa608657..c949d827a6 100644 --- a/ports/stm32/boards/stm32f412zx.ld +++ b/ports/stm32/boards/stm32f412zx.ld @@ -7,9 +7,10 @@ MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K /* entire flash */ FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 */ - FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 112K /* sectors 1,2,3 are 16K, 4 is 64K */ + FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 64K /* sectors 1,2,3,4: 16k+16k+16k+16k(of 64k)=64k */ FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 896K /* sectors 5,6,7,8,9,10,11 are 128K */ - RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 240K + FS_CACHE (xrw) : ORIGIN = 0x2003c000, LENGTH = 16K } /* produce a link error if there is not this amount of RAM for these sections */ @@ -26,3 +27,9 @@ _ram_start = ORIGIN(RAM); _ram_end = ORIGIN(RAM) + LENGTH(RAM); _heap_start = _ebss; /* heap starts just after statically allocated memory */ _heap_end = _sstack; + +/* Filesystem cache in RAM, and storage in flash */ +_micropy_hw_internal_flash_storage_ram_cache_start = ORIGIN(FS_CACHE); +_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(FS_CACHE) + LENGTH(FS_CACHE); +_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); +_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); diff --git a/ports/stm32/boards/stm32f427xi.ld b/ports/stm32/boards/stm32f427xi.ld index 1197848af1..b405841609 100644 --- a/ports/stm32/boards/stm32f427xi.ld +++ b/ports/stm32/boards/stm32f427xi.ld @@ -9,6 +9,7 @@ MEMORY FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0, 16 KiB */ FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 112K /* sectors 1-4: 3*16K+64K */ FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 896K /* sectors 5-11 are 128K */ + CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K } @@ -26,3 +27,9 @@ _ram_start = ORIGIN(RAM); _ram_end = ORIGIN(RAM) + LENGTH(RAM); _heap_start = _ebss; /* heap starts just after statically allocated memory */ _heap_end = _sstack; + +/* Filesystem cache in RAM, and storage in flash */ +_micropy_hw_internal_flash_storage_ram_cache_start = ORIGIN(CCMRAM); +_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(CCMRAM) + LENGTH(CCMRAM); +_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); +_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); diff --git a/ports/stm32/boards/stm32f429.ld b/ports/stm32/boards/stm32f429.ld index beeaa4df21..d081c190d3 100644 --- a/ports/stm32/boards/stm32f429.ld +++ b/ports/stm32/boards/stm32f429.ld @@ -9,6 +9,7 @@ MEMORY FLASH_ISR (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0, 16 KiB */ FLASH_FS (rx) : ORIGIN = 0x08004000, LENGTH = 112K /* sectors 1-4: 3*16K+64K */ FLASH_TEXT (rx) : ORIGIN = 0x08020000, LENGTH = 896K /* sectors 5-11 are 128K */ + CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K SDRAM(xrw) : ORIGIN = 0xC0000000, LENGTH = 8192K } @@ -27,3 +28,9 @@ _ram_start = ORIGIN(RAM); _ram_end = ORIGIN(RAM) + LENGTH(RAM); _heap_start = _ebss; /* heap starts just after statically allocated memory */ _heap_end = _sstack; + +/* Filesystem cache in RAM, and storage in flash */ +_micropy_hw_internal_flash_storage_ram_cache_start = ORIGIN(CCMRAM); +_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(CCMRAM) + LENGTH(CCMRAM); +_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); +_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); diff --git a/ports/stm32/boards/stm32f722.ld b/ports/stm32/boards/stm32f722.ld index fe84a49637..0520f2e95f 100644 --- a/ports/stm32/boards/stm32f722.ld +++ b/ports/stm32/boards/stm32f722.ld @@ -27,3 +27,9 @@ _ram_start = ORIGIN(RAM); _ram_end = ORIGIN(RAM) + LENGTH(RAM); _heap_start = _ebss; /* heap starts just after statically allocated memory */ _heap_end = _sstack; + +/* Filesystem cache in RAM, and storage in flash */ +_micropy_hw_internal_flash_storage_ram_cache_start = ORIGIN(DTCM); +_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(DTCM) + LENGTH(DTCM); +_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); +_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); diff --git a/ports/stm32/boards/stm32f746.ld b/ports/stm32/boards/stm32f746.ld index 0f1de26964..854b95463a 100644 --- a/ports/stm32/boards/stm32f746.ld +++ b/ports/stm32/boards/stm32f746.ld @@ -27,3 +27,9 @@ _ram_start = ORIGIN(RAM); _ram_end = ORIGIN(RAM) + LENGTH(RAM); _heap_start = _ebss; /* heap starts just after statically allocated memory */ _heap_end = _sstack; + +/* Filesystem cache in RAM, and storage in flash */ +_micropy_hw_internal_flash_storage_ram_cache_start = ORIGIN(DTCM); +_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(DTCM) + LENGTH(DTCM); +_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); +_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); diff --git a/ports/stm32/boards/stm32f767.ld b/ports/stm32/boards/stm32f767.ld index d07f2ecbef..580be50dc9 100644 --- a/ports/stm32/boards/stm32f767.ld +++ b/ports/stm32/boards/stm32f767.ld @@ -28,3 +28,9 @@ _ram_start = ORIGIN(RAM); _ram_end = ORIGIN(RAM) + LENGTH(RAM); _heap_start = _ebss; /* heap starts just after statically allocated memory */ _heap_end = _sstack; + +/* Filesystem cache in RAM, and storage in flash */ +_micropy_hw_internal_flash_storage_ram_cache_start = ORIGIN(DTCM); +_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(DTCM) + LENGTH(DTCM); +_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); +_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); diff --git a/ports/stm32/boards/stm32f769.ld b/ports/stm32/boards/stm32f769.ld index ebc6d033d9..9fc73c8596 100644 --- a/ports/stm32/boards/stm32f769.ld +++ b/ports/stm32/boards/stm32f769.ld @@ -27,3 +27,9 @@ _ram_start = ORIGIN(RAM); _ram_end = ORIGIN(RAM) + LENGTH(RAM); _heap_start = _ebss; /* heap starts just after statically allocated memory */ _heap_end = _sstack; + +/* Filesystem cache in RAM, and storage in flash */ +_micropy_hw_internal_flash_storage_ram_cache_start = ORIGIN(DTCM); +_micropy_hw_internal_flash_storage_ram_cache_end = ORIGIN(DTCM) + LENGTH(DTCM); +_micropy_hw_internal_flash_storage_start = ORIGIN(FLASH_FS); +_micropy_hw_internal_flash_storage_end = ORIGIN(FLASH_FS) + LENGTH(FLASH_FS); diff --git a/ports/stm32/flashbdev.c b/ports/stm32/flashbdev.c index 946a9d8cc2..bcff94b15d 100644 --- a/ports/stm32/flashbdev.c +++ b/ports/stm32/flashbdev.c @@ -36,58 +36,7 @@ #if MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE -// Here we try to automatically configure the location and size of the flash -// pages to use for the internal storage. We also configure the location of the -// cache used for writing. - -#if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) - -#define CACHE_MEM_START_ADDR (0x10000000) // CCM data RAM, 64k -#define FLASH_SECTOR_SIZE_MAX (0x10000) // 64k max, size of CCM -#define FLASH_MEM_SEG1_START_ADDR (0x08004000) // sector 1 -#define FLASH_MEM_SEG1_NUM_BLOCKS (224) // sectors 1,2,3,4: 16k+16k+16k+64k=112k - -// enable this to get an extra 64k of storage (uses the last sector of the flash) -#if 0 -#define FLASH_MEM_SEG2_START_ADDR (0x080e0000) // sector 11 -#define FLASH_MEM_SEG2_NUM_BLOCKS (128) // sector 11: 128k -#endif - -#elif defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F412Zx) || defined(STM32F446xx) - -STATIC byte flash_cache_mem[0x4000] __attribute__((aligned(4))); // 16k -#define CACHE_MEM_START_ADDR (&flash_cache_mem[0]) -#define FLASH_SECTOR_SIZE_MAX (0x4000) // 16k max due to size of cache buffer -#define FLASH_MEM_SEG1_START_ADDR (0x08004000) // sector 1 -#define FLASH_MEM_SEG1_NUM_BLOCKS (128) // sectors 1,2,3,4: 16k+16k+16k+16k(of 64k)=64k - -#elif defined(STM32F427xx) || defined(STM32F429xx) - -#define CACHE_MEM_START_ADDR (0x10000000) // CCM data RAM, 64k -#define FLASH_SECTOR_SIZE_MAX (0x10000) // 64k max, size of CCM -#define FLASH_MEM_SEG1_START_ADDR (0x08004000) // sector 1 -#define FLASH_MEM_SEG1_NUM_BLOCKS (224) // sectors 1,2,3,4: 16k+16k+16k+64k=112k - -#elif defined(STM32F722xx) || defined(STM32F723xx) || defined(STM32F732xx) || defined(STM32F733xx) - -#define CACHE_MEM_START_ADDR (0x20000000) // DTCM data RAM, 64k -#define FLASH_SECTOR_SIZE_MAX (0x10000) // 64k max -#define FLASH_MEM_SEG1_START_ADDR (0x08004000) // sector 1 -#define FLASH_MEM_SEG1_NUM_BLOCKS (224) // sectors 1,2,3,4: 16k+16k+16k+64k=112k - -#elif defined(STM32F746xx) || defined(STM32F765xx) || defined(STM32F767xx) || defined(STM32F769xx) - -// The STM32F746 doesn't really have CCRAM, so we use the 64K DTCM for this. - -#define CACHE_MEM_START_ADDR (0x20000000) // DTCM data RAM, 64k -#define FLASH_SECTOR_SIZE_MAX (0x08000) // 32k max -#define FLASH_MEM_SEG1_START_ADDR (0x08008000) // sector 1 -#define FLASH_MEM_SEG1_NUM_BLOCKS (192) // sectors 1,2,3: 32k+32k+32=96k - -#else - -// Generic configuration where the linker script specifies flash storage and RAM cache locations. - +// The linker script specifies flash storage and RAM cache locations. extern uint8_t _micropy_hw_internal_flash_storage_start; extern uint8_t _micropy_hw_internal_flash_storage_end; extern uint8_t _micropy_hw_internal_flash_storage2_start; @@ -111,8 +60,6 @@ extern uint8_t _micropy_hw_internal_flash_storage_ram_cache_end[]; ((&_micropy_hw_internal_flash_storage2_end - &_micropy_hw_internal_flash_storage2_start) / 512) #endif -#endif - #if !defined(FLASH_MEM_SEG2_START_ADDR) #define FLASH_MEM_SEG2_NUM_BLOCKS (0) // no second segment #endif From 95ee29f4f4e0f76fcca7567d26f3335957762d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Z=C3=BCger?= Date: Wed, 16 Mar 2022 15:45:03 +0100 Subject: [PATCH 0227/1712] stm32/mbedtls: Add NULL pointer check in m_free_mbedtls. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to the C standard the free(void *ptr) function: if ptr is a null pointer, no action occurs. Signed-off-by: Peter Züger --- ports/stm32/mbedtls/mbedtls_port.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/stm32/mbedtls/mbedtls_port.c b/ports/stm32/mbedtls/mbedtls_port.c index c31eb744ae..44e23a3b90 100644 --- a/ports/stm32/mbedtls/mbedtls_port.c +++ b/ports/stm32/mbedtls/mbedtls_port.c @@ -62,6 +62,9 @@ void *m_calloc_mbedtls(size_t nmemb, size_t size) { } void m_free_mbedtls(void *ptr_in) { + if (ptr_in == NULL) { + return; + } void **ptr = &((void**)ptr_in)[-2]; #if DEBUG uint32_t nb; From 94a9b5066827d7dc5b1844ae28fad79778314185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Z=C3=BCger?= Date: Wed, 16 Mar 2022 16:41:23 +0100 Subject: [PATCH 0228/1712] mimxrt/mbedtls: Add NULL pointer check in m_free_mbedtls. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Züger --- ports/mimxrt/mbedtls/mbedtls_port.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/mimxrt/mbedtls/mbedtls_port.c b/ports/mimxrt/mbedtls/mbedtls_port.c index eb11f5141b..928f12f3f1 100644 --- a/ports/mimxrt/mbedtls/mbedtls_port.c +++ b/ports/mimxrt/mbedtls/mbedtls_port.c @@ -64,6 +64,9 @@ void *m_calloc_mbedtls(size_t nmemb, size_t size) { } void m_free_mbedtls(void *ptr_in) { + if (ptr_in == NULL) { + return; + } void **ptr = &((void **)ptr_in)[-2]; #if DEBUG uint32_t nb; From 5887dfeea6a4899e8f30ac1435159d760a985642 Mon Sep 17 00:00:00 2001 From: Jonathan Hogg Date: Mon, 7 Mar 2022 09:15:05 +0000 Subject: [PATCH 0229/1712] docs/esp32/quickref: Refine deep-sleep power-saving notes. This attempts to better explain how pull-ups and pull-downs operate in deep-sleep mode. --- docs/esp32/quickref.rst | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst index 56e765536e..0778425f2f 100644 --- a/docs/esp32/quickref.rst +++ b/docs/esp32/quickref.rst @@ -186,8 +186,7 @@ Notes: * Pins 34-39 are input only, and also do not have internal pull-up resistors -* The pull value of some pins can be set to ``Pin.PULL_HOLD`` to reduce power - consumption during deepsleep. +* See :ref:`Deep_sleep_Mode` for a discussion of pin behaviour during sleep There's a higher-level abstraction :ref:`machine.Signal ` which can be used to invert a pin. Useful for illuminating active-low LEDs @@ -508,6 +507,8 @@ See :ref:`machine.WDT `. :: wdt = WDT(timeout=5000) wdt.feed() +.. _Deep_sleep_mode: + Deep-sleep mode --------------- @@ -527,15 +528,28 @@ Notes: * Calling ``deepsleep()`` without an argument will put the device to sleep indefinitely * A software reset does not change the reset cause -* There may be some leakage current flowing through enabled internal pullups. - To further reduce power consumption it is possible to disable the internal pullups:: - p1 = Pin(4, Pin.IN, Pin.PULL_HOLD) +Some ESP32 pins (0, 2, 4, 12-15, 25-27, 32-39) are connected to the RTC during +deep-sleep and can be used to wake the device with the ``wake_on_`` functions in +the :mod:`esp32` module. The output-capable RTC pins (all except 34-39) will +also retain their pull-up or pull-down resistor configuration when entering +deep-sleep. - After leaving deepsleep it may be necessary to un-hold the pin explicitly (e.g. if - it is an output pin) via:: +If the pull resistors are not actively required during deep-sleep and are likely +to cause current leakage (for example a pull-up resistor is connected to ground +through a switch), then they should be disabled to save power before entering +deep-sleep mode:: - p1 = Pin(4, Pin.OUT, None) + from machine import Pin, deepsleep + + # configure input RTC pin with pull-up on boot + pin = Pin(2, Pin.IN, Pin.PULL_UP) + + # disable pull-up and put the device to sleep for 10 seconds + pin.init(pull=None) + machine.deepsleep(10000) + +Non-RTC GPIO pins will be disconnected by default on entering deep-sleep. SD card ------- From 7684c996bc2b2521fa4bd023e4fa24622092cd5f Mon Sep 17 00:00:00 2001 From: Jonathan Hogg Date: Mon, 7 Mar 2022 09:21:11 +0000 Subject: [PATCH 0230/1712] esp32/machine_pin: Add new hold keyword argument and remove PULL_HOLD. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current pull=Pin.PULL_HOLD argument doesn't make a lot of sense in the context of what it actually does vs what the ESP32 quickref document says it does. This commit removes PULL_HOLD and adds a new hold=True|False keyword argument to Pin()/Pin.init(). Setting this to True will cause the ESP32 to lock the configuration of the pin – including direction, output value, drive strength, pull-up/-down – such that it can't be accidentally changed and will be retained through a watchdog or internal reset. Fixes issue #8283, and see also #8284. --- docs/esp32/quickref.rst | 12 ++++++++++++ ports/esp32/machine_pin.c | 18 +++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst index 0778425f2f..dd7e515f1b 100644 --- a/docs/esp32/quickref.rst +++ b/docs/esp32/quickref.rst @@ -177,6 +177,14 @@ safe maximum source/sink currents and approximate internal driver resistances: - ``Pin.DRIVE_2``: 20mA / 30 ohm (default strength if not configured) - ``Pin.DRIVE_3``: 40mA / 15 ohm +The ``hold=`` keyword argument to ``Pin()`` and ``Pin.init()`` will enable the +ESP32 "pad hold" feature. When set to ``True``, the pin configuration +(direction, pull resistors and output value) will be held and any further +changes (including changing the output level) will not be applied. Setting +``hold=False`` will immediately apply any outstanding pin configuration changes +and release the pin. Using ``hold=True`` while a pin is already held will apply +any configuration changes and then immediately reapply the hold. + Notes: * Pins 1 and 3 are REPL UART TX and RX respectively @@ -549,6 +557,10 @@ deep-sleep mode:: pin.init(pull=None) machine.deepsleep(10000) +Output-configured RTC pins will also retain their output direction and level in +deep-sleep if pad hold is enabled with the ``hold=True`` argument to +``Pin.init()``. + Non-RTC GPIO pins will be disconnected by default on entering deep-sleep. SD card diff --git a/ports/esp32/machine_pin.c b/ports/esp32/machine_pin.c index 1dad398524..90dc03e69a 100644 --- a/ports/esp32/machine_pin.c +++ b/ports/esp32/machine_pin.c @@ -47,7 +47,6 @@ // Used to implement a range of pull capabilities #define GPIO_PULL_DOWN (1) #define GPIO_PULL_UP (2) -#define GPIO_PULL_HOLD (4) #if CONFIG_IDF_TARGET_ESP32 #define GPIO_FIRST_NON_OUTPUT (34) @@ -253,14 +252,15 @@ STATIC void machine_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_prin mp_printf(print, "Pin(%u)", self->id); } -// pin.init(mode=None, pull=-1, *, value, drive) +// pin.init(mode=None, pull=-1, *, value, drive, hold) STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_mode, ARG_pull, ARG_value, ARG_drive }; + enum { ARG_mode, ARG_pull, ARG_value, ARG_drive, ARG_hold }; static const mp_arg_t allowed_args[] = { { MP_QSTR_mode, MP_ARG_OBJ, {.u_obj = mp_const_none}}, { MP_QSTR_pull, MP_ARG_OBJ, {.u_obj = MP_OBJ_NEW_SMALL_INT(-1)}}, { MP_QSTR_value, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL}}, { MP_QSTR_drive, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL}}, + { MP_QSTR_hold, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL}}, }; // parse args @@ -325,10 +325,15 @@ STATIC mp_obj_t machine_pin_obj_init_helper(const machine_pin_obj_t *self, size_ } else { gpio_pullup_dis(self->id); } - if (mode & GPIO_PULL_HOLD) { + } + + // configure pad hold + if (args[ARG_hold].u_obj != MP_OBJ_NULL && GPIO_IS_VALID_OUTPUT_GPIO(self->id)) { + // always disable pad hold to apply outstanding config changes + gpio_hold_dis(self->id); + // (re-)enable pad hold if requested + if (mp_obj_is_true(args[ARG_hold].u_obj)) { gpio_hold_en(self->id); - } else if (GPIO_IS_VALID_OUTPUT_GPIO(self->id)) { - gpio_hold_dis(self->id); } } @@ -480,7 +485,6 @@ STATIC const mp_rom_map_elem_t machine_pin_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_OPEN_DRAIN), MP_ROM_INT(GPIO_MODE_INPUT_OUTPUT_OD) }, { MP_ROM_QSTR(MP_QSTR_PULL_UP), MP_ROM_INT(GPIO_PULL_UP) }, { MP_ROM_QSTR(MP_QSTR_PULL_DOWN), MP_ROM_INT(GPIO_PULL_DOWN) }, - { MP_ROM_QSTR(MP_QSTR_PULL_HOLD), MP_ROM_INT(GPIO_PULL_HOLD) }, { MP_ROM_QSTR(MP_QSTR_IRQ_RISING), MP_ROM_INT(GPIO_PIN_INTR_POSEDGE) }, { MP_ROM_QSTR(MP_QSTR_IRQ_FALLING), MP_ROM_INT(GPIO_PIN_INTR_NEGEDGE) }, { MP_ROM_QSTR(MP_QSTR_WAKE_LOW), MP_ROM_INT(GPIO_PIN_INTR_LOLEVEL) }, From 21d0599bd10aa567e3fdee5e39da1fe9a9f816e6 Mon Sep 17 00:00:00 2001 From: Jonathan Hogg Date: Mon, 7 Mar 2022 09:22:00 +0000 Subject: [PATCH 0231/1712] esp32/modesp32: Add new gpio_deep_sleep_hold function. Add a new function to control whether held pins will retain their function through deep-sleep. Also document this function and explain how to use this in quickref to retain pin configuration during deep-sleep. --- docs/esp32/quickref.rst | 17 +++++++++++++++++ docs/library/esp32.rst | 5 +++++ ports/esp32/modesp32.c | 11 +++++++++++ 3 files changed, 33 insertions(+) diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst index dd7e515f1b..894508f4c2 100644 --- a/docs/esp32/quickref.rst +++ b/docs/esp32/quickref.rst @@ -562,6 +562,23 @@ deep-sleep if pad hold is enabled with the ``hold=True`` argument to ``Pin.init()``. Non-RTC GPIO pins will be disconnected by default on entering deep-sleep. +Configuration of non-RTC pins - including output level - can be retained by +enabling pad hold on the pin and enabling GPIO pad hold during deep-sleep:: + + from machine import Pin, deepsleep + import esp32 + + opin = Pin(19, Pin.OUT, value=1, hold=True) # hold output level + ipin = Pin(21, Pin.IN, Pin.PULL_UP, hold=True) # hold pull-up + + # enable pad hold in deep-sleep for non-RTC GPIO + esp32.gpio_deep_sleep_hold(True) + + # put the device to sleep for 10 seconds + deepsleep(10000) + +The pin configuration - including the pad hold - will be retained on wake from +sleep. See :ref:`Pins_and_GPIO` above for a further discussion of pad holding. SD card ------- diff --git a/docs/library/esp32.rst b/docs/library/esp32.rst index da5fa8c3cb..3348003499 100644 --- a/docs/library/esp32.rst +++ b/docs/library/esp32.rst @@ -30,6 +30,11 @@ Functions or a tuple/list of valid Pin objects. *level* should be ``esp32.WAKEUP_ALL_LOW`` or ``esp32.WAKEUP_ANY_HIGH``. +.. function:: gpio_deep_sleep_hold(enable) + + Configure whether non-RTC GPIO pin configuration is retained during + deep-sleep mode for held pads. *enable* should be a boolean value. + .. function:: raw_temperature() Read the raw value of the internal temperature sensor, returning an integer. diff --git a/ports/esp32/modesp32.c b/ports/esp32/modesp32.c index 75e5b3ed8b..4579c5de11 100644 --- a/ports/esp32/modesp32.c +++ b/ports/esp32/modesp32.c @@ -131,6 +131,16 @@ STATIC mp_obj_t esp32_wake_on_ext1(size_t n_args, const mp_obj_t *pos_args, mp_m } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(esp32_wake_on_ext1_obj, 0, esp32_wake_on_ext1); +STATIC mp_obj_t esp32_gpio_deep_sleep_hold(const mp_obj_t enable) { + if (mp_obj_is_true(enable)) { + gpio_deep_sleep_hold_en(); + } else { + gpio_deep_sleep_hold_dis(); + } + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp32_gpio_deep_sleep_hold_obj, esp32_gpio_deep_sleep_hold); + #if CONFIG_IDF_TARGET_ESP32 #include "soc/sens_reg.h" @@ -187,6 +197,7 @@ STATIC const mp_rom_map_elem_t esp32_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_wake_on_touch), MP_ROM_PTR(&esp32_wake_on_touch_obj) }, { MP_ROM_QSTR(MP_QSTR_wake_on_ext0), MP_ROM_PTR(&esp32_wake_on_ext0_obj) }, { MP_ROM_QSTR(MP_QSTR_wake_on_ext1), MP_ROM_PTR(&esp32_wake_on_ext1_obj) }, + { MP_ROM_QSTR(MP_QSTR_gpio_deep_sleep_hold), MP_ROM_PTR(&esp32_gpio_deep_sleep_hold_obj) }, #if CONFIG_IDF_TARGET_ESP32 { MP_ROM_QSTR(MP_QSTR_raw_temperature), MP_ROM_PTR(&esp32_raw_temperature_obj) }, { MP_ROM_QSTR(MP_QSTR_hall_sensor), MP_ROM_PTR(&esp32_hall_sensor_obj) }, From 3b9de192be8177abd07c18cf58468939c4c5fd5d Mon Sep 17 00:00:00 2001 From: Jonathan Hogg Date: Thu, 10 Mar 2022 13:00:30 +0000 Subject: [PATCH 0232/1712] esp32/boards/UM_TINYPICO: Remove use of PULL_HOLD. Change APA102 power handling to not use the (now removed) PULL_HOLD constant. --- ports/esp32/boards/UM_TINYPICO/modules/tinypico.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ports/esp32/boards/UM_TINYPICO/modules/tinypico.py b/ports/esp32/boards/UM_TINYPICO/modules/tinypico.py index 04b274bb53..9545078842 100644 --- a/ports/esp32/boards/UM_TINYPICO/modules/tinypico.py +++ b/ports/esp32/boards/UM_TINYPICO/modules/tinypico.py @@ -83,10 +83,9 @@ def set_dotstar_power(state): """Set the power for the on-board Dotstar to allow no current draw when not needed.""" # Set the power pin to the inverse of state if state: - Pin(DOTSTAR_PWR, Pin.OUT, None) # Break the PULL_HOLD on the pin - Pin(DOTSTAR_PWR).value(False) # Set the pin to LOW to enable the Transistor + Pin(DOTSTAR_PWR, Pin.OUT, None, value=0) # Drive output to LOW to enable transistor else: - Pin(13, Pin.IN, Pin.PULL_HOLD) # Set PULL_HOLD on the pin to allow the 3V3 pull-up to work + Pin(DOTSTAR_PWR, Pin.IN, None) # Disable output, external pull-up will disable transistor Pin( DOTSTAR_CLK, Pin.OUT if state else Pin.IN From 1a0bd352d3bfb6674d470c4b07862ebaace0ca88 Mon Sep 17 00:00:00 2001 From: wemos Date: Wed, 9 Mar 2022 19:22:49 +0800 Subject: [PATCH 0233/1712] esp32/boards: Add LOLIN C3 MINI ESP32-C3 based board. --- ports/esp32/boards/LOLIN_C3_MINI/board.json | 19 ++++++++++++++ ports/esp32/boards/LOLIN_C3_MINI/manifest.py | 2 ++ .../boards/LOLIN_C3_MINI/modules/c3mini.py | 26 +++++++++++++++++++ .../boards/LOLIN_C3_MINI/mpconfigboard.cmake | 11 ++++++++ .../boards/LOLIN_C3_MINI/mpconfigboard.h | 13 ++++++++++ .../boards/LOLIN_C3_MINI/sdkconfig.board | 9 +++++++ 6 files changed, 80 insertions(+) create mode 100644 ports/esp32/boards/LOLIN_C3_MINI/board.json create mode 100644 ports/esp32/boards/LOLIN_C3_MINI/manifest.py create mode 100644 ports/esp32/boards/LOLIN_C3_MINI/modules/c3mini.py create mode 100644 ports/esp32/boards/LOLIN_C3_MINI/mpconfigboard.cmake create mode 100644 ports/esp32/boards/LOLIN_C3_MINI/mpconfigboard.h create mode 100644 ports/esp32/boards/LOLIN_C3_MINI/sdkconfig.board diff --git a/ports/esp32/boards/LOLIN_C3_MINI/board.json b/ports/esp32/boards/LOLIN_C3_MINI/board.json new file mode 100644 index 0000000000..f47c672fa4 --- /dev/null +++ b/ports/esp32/boards/LOLIN_C3_MINI/board.json @@ -0,0 +1,19 @@ +{ + "deploy": [ + "../deploy_c3.md" + ], + "docs": "", + "features": [ + "BLE", + "USB-C", + "WiFi" + ], + "images": [ + "lolin_c3_mini.jpg" + ], + "mcu": "esp32c3", + "product": "C3 mini", + "thumbnail": "", + "url": "https://www.wemos.cc/en/latest/c3/c3_mini.html", + "vendor": "Wemos" +} diff --git a/ports/esp32/boards/LOLIN_C3_MINI/manifest.py b/ports/esp32/boards/LOLIN_C3_MINI/manifest.py new file mode 100644 index 0000000000..f993d4fa6b --- /dev/null +++ b/ports/esp32/boards/LOLIN_C3_MINI/manifest.py @@ -0,0 +1,2 @@ +include("$(PORT_DIR)/boards/manifest.py") +freeze("./modules") diff --git a/ports/esp32/boards/LOLIN_C3_MINI/modules/c3mini.py b/ports/esp32/boards/LOLIN_C3_MINI/modules/c3mini.py new file mode 100644 index 0000000000..ce167303ee --- /dev/null +++ b/ports/esp32/boards/LOLIN_C3_MINI/modules/c3mini.py @@ -0,0 +1,26 @@ +# LOLIN C3 MINI MicroPython Helper Library + +from micropython import const +from machine import Pin + +# Pin Assignments + +# SPI +SPI_MOSI = const(4) +SPI_MISO = const(3) +SPI_CLK = const(2) + +# I2C +I2C_SDA = const(8) +I2C_SCL = const(10) + +# LED +LED = const(7) + +# BUTTON +BUTTON = const(0) + +# Built-in peripherals + +led = Pin(LED, Pin.OUT, value=0) +button = Pin(BUTTON, Pin.IN, Pin.PULL_UP) diff --git a/ports/esp32/boards/LOLIN_C3_MINI/mpconfigboard.cmake b/ports/esp32/boards/LOLIN_C3_MINI/mpconfigboard.cmake new file mode 100644 index 0000000000..9fe3b6411d --- /dev/null +++ b/ports/esp32/boards/LOLIN_C3_MINI/mpconfigboard.cmake @@ -0,0 +1,11 @@ +set(IDF_TARGET esp32c3) + +set(SDKCONFIG_DEFAULTS + boards/sdkconfig.base + boards/sdkconfig.ble + boards/LOLIN_C3_MINI/sdkconfig.board +) + +if(NOT MICROPY_FROZEN_MANIFEST) + set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) +endif() diff --git a/ports/esp32/boards/LOLIN_C3_MINI/mpconfigboard.h b/ports/esp32/boards/LOLIN_C3_MINI/mpconfigboard.h new file mode 100644 index 0000000000..5872bdc8ae --- /dev/null +++ b/ports/esp32/boards/LOLIN_C3_MINI/mpconfigboard.h @@ -0,0 +1,13 @@ +#define MICROPY_HW_BOARD_NAME "LOLIN_C3_MINI" +#define MICROPY_HW_MCU_NAME "ESP32-C3FH4" + +#define MICROPY_HW_ENABLE_SDCARD (0) +#define MICROPY_PY_MACHINE_DAC (0) +#define MICROPY_PY_MACHINE_I2S (0) + +#define MICROPY_HW_I2C0_SCL (10) +#define MICROPY_HW_I2C0_SDA (8) + +#define MICROPY_HW_SPI1_MOSI (4) +#define MICROPY_HW_SPI1_MISO (3) +#define MICROPY_HW_SPI1_SCK (2) diff --git a/ports/esp32/boards/LOLIN_C3_MINI/sdkconfig.board b/ports/esp32/boards/LOLIN_C3_MINI/sdkconfig.board new file mode 100644 index 0000000000..f0cbad00e4 --- /dev/null +++ b/ports/esp32/boards/LOLIN_C3_MINI/sdkconfig.board @@ -0,0 +1,9 @@ +CONFIG_ESP32C3_REV_MIN_3=y +CONFIG_ESP32C3_REV_MIN=3 +CONFIG_ESP32C3_BROWNOUT_DET=y +CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_7= +CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_4=y +CONFIG_ESP32C3_BROWNOUT_DET_LVL=4 +CONFIG_ESP_CONSOLE_UART_DEFAULT= +CONFIG_ESP_CONSOLE_USB_CDC= +CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=y From 09b55dc297da2b4dc3915f2a4cc0e3b53ea07359 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Tue, 8 Mar 2022 11:40:26 +0100 Subject: [PATCH 0234/1712] esp32/machine_hw_spi: Use automatic DMA channel selection for SPI on C3. Addresses issue #8204. --- ports/esp32/machine_hw_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32/machine_hw_spi.c b/ports/esp32/machine_hw_spi.c index 1515b00744..3e720adb1a 100644 --- a/ports/esp32/machine_hw_spi.c +++ b/ports/esp32/machine_hw_spi.c @@ -268,7 +268,7 @@ STATIC void machine_hw_spi_init_internal( // Select DMA channel based on the hardware SPI host int dma_chan = 0; if (self->host == HSPI_HOST) { - #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 + #if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32C3 dma_chan = 3; #else dma_chan = 1; From afceb56ee2fe7c1741c6437b5d0d3fb7dbb54340 Mon Sep 17 00:00:00 2001 From: Algy Tynan Date: Tue, 15 Mar 2022 18:18:42 +1100 Subject: [PATCH 0235/1712] esp32/boards: Add support for LilyGO LoRa32 boards. Boards use ESP32-PICO-D4. Added pins for hardware versions v1.0, v1.2, v1.6 and v2.0. Signed-off-by: Algy Tynan --- .../boards/LILYGO_TTGO_LORA32/board.json | 23 ++++++ .../esp32/boards/LILYGO_TTGO_LORA32/board.md | 3 + .../boards/LILYGO_TTGO_LORA32/manifest.py | 4 + .../LILYGO_TTGO_LORA32/modules/lilygo_oled.py | 36 +++++++++ .../LILYGO_TTGO_LORA32/modules/lora32.py | 79 +++++++++++++++++++ .../LILYGO_TTGO_LORA32/mpconfigboard.cmake | 7 ++ .../boards/LILYGO_TTGO_LORA32/mpconfigboard.h | 2 + 7 files changed, 154 insertions(+) create mode 100644 ports/esp32/boards/LILYGO_TTGO_LORA32/board.json create mode 100644 ports/esp32/boards/LILYGO_TTGO_LORA32/board.md create mode 100644 ports/esp32/boards/LILYGO_TTGO_LORA32/manifest.py create mode 100644 ports/esp32/boards/LILYGO_TTGO_LORA32/modules/lilygo_oled.py create mode 100644 ports/esp32/boards/LILYGO_TTGO_LORA32/modules/lora32.py create mode 100644 ports/esp32/boards/LILYGO_TTGO_LORA32/mpconfigboard.cmake create mode 100644 ports/esp32/boards/LILYGO_TTGO_LORA32/mpconfigboard.h diff --git a/ports/esp32/boards/LILYGO_TTGO_LORA32/board.json b/ports/esp32/boards/LILYGO_TTGO_LORA32/board.json new file mode 100644 index 0000000000..7f4b227abf --- /dev/null +++ b/ports/esp32/boards/LILYGO_TTGO_LORA32/board.json @@ -0,0 +1,23 @@ +{ + "deploy": [ + "../deploy.md" + ], + "docs": "", + "features": [ + "BLE", + "LoRa", + "OLED", + "SDCard", + "USB-MICRO", + "WiFi" + ], + "id": "esp32", + "images": [ + "lilygo-ttgo-lora-32-v1-6.jpg" + ], + "mcu": "esp32", + "product": "LILYGO TTGO LoRa32", + "thumbnail": "", + "url": "http://www.lilygo.cn/prod_view.aspx?TypeId=50060&Id=1270&FId=t3:50060:3", + "vendor": "LILYGO" +} diff --git a/ports/esp32/boards/LILYGO_TTGO_LORA32/board.md b/ports/esp32/boards/LILYGO_TTGO_LORA32/board.md new file mode 100644 index 0000000000..b7f5c21fec --- /dev/null +++ b/ports/esp32/boards/LILYGO_TTGO_LORA32/board.md @@ -0,0 +1,3 @@ +The following files are daily firmware for the LILYGO TTGO LoRa32. + +Support for hardware versions v1.0, v1.2, v1.6 and v2.0. diff --git a/ports/esp32/boards/LILYGO_TTGO_LORA32/manifest.py b/ports/esp32/boards/LILYGO_TTGO_LORA32/manifest.py new file mode 100644 index 0000000000..0709f8597c --- /dev/null +++ b/ports/esp32/boards/LILYGO_TTGO_LORA32/manifest.py @@ -0,0 +1,4 @@ +include("$(PORT_DIR)/boards/manifest.py") +freeze("modules") + +freeze("$(MPY_DIR)/drivers/display", "ssd1306.py") diff --git a/ports/esp32/boards/LILYGO_TTGO_LORA32/modules/lilygo_oled.py b/ports/esp32/boards/LILYGO_TTGO_LORA32/modules/lilygo_oled.py new file mode 100644 index 0000000000..58072ee1b5 --- /dev/null +++ b/ports/esp32/boards/LILYGO_TTGO_LORA32/modules/lilygo_oled.py @@ -0,0 +1,36 @@ +from time import sleep_ms +from ssd1306 import SSD1306_I2C +import network + + +class OLED(SSD1306_I2C): + def __init__(self, i2c): + super().__init__(128, 32, i2c) + + def test(self): + self.fill(0) + self.fill_rect(0, 0, 32, 32, 1) + self.fill_rect(2, 2, 28, 28, 0) + self.vline(9, 8, 22, 1) + self.vline(16, 2, 22, 1) + self.vline(23, 8, 22, 1) + self.fill_rect(26, 24, 2, 4, 1) + self.text("MicroPython", 40, 0, 1) + self.text("SSD1306", 40, 12, 1) + self.text("OLED 128x32", 40, 24, 1) + self.show() + + def display_wifi(self): + self.fill(0) + self.text("Scan...", 0, 0, 1) + self.show() + + sta_if = network.WLAN(network.STA_IF) + sta_if.active(True) + _wifi = sta_if.scan() + + self.fill(0) + self.text(str(len(_wifi)) + " Networks", 0, 0, 1) + self.text(str(_wifi[0][3]) + " " + (_wifi[0][0]).decode("utf-8"), 0, 12, 1) + self.text(str(_wifi[1][3]) + " " + (_wifi[1][0]).decode("utf-8"), 0, 24, 1) + self.show() diff --git a/ports/esp32/boards/LILYGO_TTGO_LORA32/modules/lora32.py b/ports/esp32/boards/LILYGO_TTGO_LORA32/modules/lora32.py new file mode 100644 index 0000000000..067982a228 --- /dev/null +++ b/ports/esp32/boards/LILYGO_TTGO_LORA32/modules/lora32.py @@ -0,0 +1,79 @@ +"""LILYGO TTGO LoRa32 MicroPython Helper Library.""" + +from machine import Pin, SoftI2C, Signal + +from lilygo_oled import OLED + +from micropython import const + + +class Lora32Base: + """Base class defining common pins.""" + + def __init__(self, define_helpers=True): + # LORA + self.LORA_MOSI = const(27) + self.LORA_MISO = const(19) + self.LORA_SCLK = const(5) + self.LORA_CS = const(18) + self.LORA_DIO = const(26) + self.LORA_RST = const(23) + + # DAC + self.DAC1 = const(26) + + # LED + self.LED = const(25) + + # OLED + self.OLED_SDA = const(21) + self.OLED_SCL = const(22) + + if define_helpers: + self.create_helpers() + + def create_helpers(self): + self.led = Pin(self.LED, Pin.OUT) + self.i2c = SoftI2C(scl=Pin(self.OLED_SCL), sda=Pin(self.OLED_SDA)) + self.oled = OLED(self.i2c) + + +class Lora32v1_0(Lora32Base): + """Device Support for LILYGO TTGO LoRa32 v1.0.""" + + def __init__(self): + super().__init__(define_helpers=False) + + # v1.0 has different pins for the following + self.LORA_RST = const(14) + self.OLED_SDA = const(4) + self.OLED_SCL = const(15) + + # Also has a reset for the OLED that the others don't have + self.OLED_RST = const(16) + + super().create_helpers() + + +class Lora32v1_2(Lora32Base): + """Device Support for LILYGO TTGO LoRa32 v1.2 (T-Fox).""" + + def __init__(self): + super().__init__() + + # v1.2 Has a DS3231 RTC + self.DS3231_SDA = const(21) + self.DS3231_SCL = const(22) + + +class Lora32(Lora32Base): + """Device Support for LILYGO TTGO LoRa32 v1.6 and v2.0.""" + + def __init__(self): + super().__init__() + + # v1.6 and v2.0 support an SDCard + self.SD_CS = const(13) + self.SD_MOSI = const(15) + self.SD_MISO = const(2) + self.SD_SCLK = const(14) diff --git a/ports/esp32/boards/LILYGO_TTGO_LORA32/mpconfigboard.cmake b/ports/esp32/boards/LILYGO_TTGO_LORA32/mpconfigboard.cmake new file mode 100644 index 0000000000..c35e4e0743 --- /dev/null +++ b/ports/esp32/boards/LILYGO_TTGO_LORA32/mpconfigboard.cmake @@ -0,0 +1,7 @@ +set(SDKCONFIG_DEFAULTS + boards/sdkconfig.base + boards/sdkconfig.ble +) +if(NOT MICROPY_FROZEN_MANIFEST) + set(MICROPY_FROZEN_MANIFEST ${MICROPY_BOARD_DIR}/manifest.py) +endif() diff --git a/ports/esp32/boards/LILYGO_TTGO_LORA32/mpconfigboard.h b/ports/esp32/boards/LILYGO_TTGO_LORA32/mpconfigboard.h new file mode 100644 index 0000000000..1c7b6fd557 --- /dev/null +++ b/ports/esp32/boards/LILYGO_TTGO_LORA32/mpconfigboard.h @@ -0,0 +1,2 @@ +#define MICROPY_HW_BOARD_NAME "LILYGO TTGO LoRa32" +#define MICROPY_HW_MCU_NAME "ESP32" From 61c02e6500be7b174bb1c257f4798969fadab206 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Thu, 10 Mar 2022 13:15:49 -0500 Subject: [PATCH 0236/1712] esp32/machine_pin: Expose pin 20 for ESP32. This pin is available on some ESP32 packages. Signed-off-by: Kattni Rembor --- ports/esp32/machine_pin.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ports/esp32/machine_pin.c b/ports/esp32/machine_pin.c index 90dc03e69a..c22eb5d847 100644 --- a/ports/esp32/machine_pin.c +++ b/ports/esp32/machine_pin.c @@ -92,7 +92,11 @@ STATIC const machine_pin_obj_t machine_pin_obj[] = { #endif {{&machine_pin_type}, GPIO_NUM_18}, {{&machine_pin_type}, GPIO_NUM_19}, + #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0) + {{&machine_pin_type}, GPIO_NUM_20}, + #else {{NULL}, -1}, + #endif {{&machine_pin_type}, GPIO_NUM_21}, {{&machine_pin_type}, GPIO_NUM_22}, {{&machine_pin_type}, GPIO_NUM_23}, @@ -560,7 +564,11 @@ STATIC const machine_pin_irq_obj_t machine_pin_irq_object[] = { #endif {{&machine_pin_irq_type}, GPIO_NUM_18}, {{&machine_pin_irq_type}, GPIO_NUM_19}, + #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0) + {{&machine_pin_irq_type}, GPIO_NUM_20}, + #else {{NULL}, -1}, + #endif {{&machine_pin_irq_type}, GPIO_NUM_21}, {{&machine_pin_irq_type}, GPIO_NUM_22}, {{&machine_pin_irq_type}, GPIO_NUM_23}, From 65be5e072fbce4529b0def95e5aa39c8cf630c95 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 22 Mar 2022 10:45:15 +1100 Subject: [PATCH 0237/1712] esp8266/mpconfigport.h: Remove config values that are the defaults. This commit is a no-op in terms of functionality. Signed-off-by: Damien George --- ports/esp8266/mpconfigport.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/ports/esp8266/mpconfigport.h b/ports/esp8266/mpconfigport.h index ad73f465a3..0f1da51671 100644 --- a/ports/esp8266/mpconfigport.h +++ b/ports/esp8266/mpconfigport.h @@ -14,7 +14,6 @@ #define MICROPY_ALLOC_PARSE_RULE_INC (8) #define MICROPY_ALLOC_PARSE_RESULT_INC (8) #define MICROPY_ALLOC_PARSE_CHUNK_INIT (64) -#define MICROPY_MEM_STATS (0) #define MICROPY_DEBUG_PRINTER (&mp_debug_print) #define MICROPY_ENABLE_GC (1) #define MICROPY_ENABLE_FINALISER (1) @@ -24,7 +23,6 @@ #define MICROPY_REPL_EVENT_DRIVEN (0) #define MICROPY_REPL_AUTO_INDENT (1) #define MICROPY_HELPER_REPL (1) -#define MICROPY_HELPER_LEXER_UNIX (0) #define MICROPY_ENABLE_SOURCE_LINE (1) #define MICROPY_MODULE_BUILTIN_INIT (1) #define MICROPY_MODULE_WEAK_LINKS (1) @@ -34,32 +32,19 @@ #define MICROPY_PY_DESCRIPTORS (1) #define MICROPY_PY_BUILTINS_COMPLEX (0) #define MICROPY_PY_BUILTINS_STR_UNICODE (1) -#define MICROPY_PY_BUILTINS_BYTEARRAY (1) #define MICROPY_PY_BUILTINS_MEMORYVIEW (1) #define MICROPY_PY_BUILTINS_FROZENSET (1) -#define MICROPY_PY_BUILTINS_SET (1) -#define MICROPY_PY_BUILTINS_SLICE (1) -#define MICROPY_PY_BUILTINS_PROPERTY (1) #define MICROPY_PY_BUILTINS_ROUND_INT (1) #define MICROPY_PY_BUILTINS_INPUT (1) #define MICROPY_PY_BUILTINS_HELP (1) #define MICROPY_PY_BUILTINS_HELP_TEXT esp_help_text #define MICROPY_PY_BUILTINS_HELP_MODULES (1) #define MICROPY_PY___FILE__ (0) -#define MICROPY_PY_GC (1) -#define MICROPY_PY_ARRAY (1) #define MICROPY_PY_ARRAY_SLICE_ASSIGN (1) -#define MICROPY_PY_COLLECTIONS (1) #define MICROPY_PY_COLLECTIONS_DEQUE (1) #define MICROPY_PY_COLLECTIONS_ORDEREDDICT (1) -#define MICROPY_PY_MATH (1) -#define MICROPY_PY_CMATH (0) -#define MICROPY_PY_IO (1) #define MICROPY_PY_IO_IOBASE (1) -#define MICROPY_PY_STRUCT (1) -#define MICROPY_PY_SYS (1) #define MICROPY_PY_SYS_MAXSIZE (1) -#define MICROPY_PY_SYS_EXIT (1) #define MICROPY_PY_SYS_STDFILES (1) #define MICROPY_PY_UERRNO (1) #define MICROPY_PY_UBINASCII (1) @@ -103,7 +88,6 @@ #define MICROPY_PY_UOS_UNAME (1) #define MICROPY_PY_UOS_UNAME_RELEASE_DYNAMIC (1) #define MICROPY_PY_UOS_URANDOM (1) -#define MICROPY_CPYTHON_COMPAT (1) #define MICROPY_LONGINT_IMPL (MICROPY_LONGINT_IMPL_MPZ) #define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT) #define MICROPY_WARNINGS (1) From eef7eae6b299f5a6469b977aae6425e33ee895af Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 22 Mar 2022 11:01:02 +1100 Subject: [PATCH 0238/1712] esp8266/modesp: Remove esp.info() function. The main functionality of this info function is available via the existing micropython.mem_info() and micropython.qstr_info() functions. The printing of the address space layout doesn't add much and removing esp.info() saves about 600 bytes. Signed-off-by: Damien George --- ports/esp8266/Makefile | 1 - ports/esp8266/boards/esp8266_common.ld | 1 - ports/esp8266/modesp.c | 1 - ports/esp8266/modpyb.c | 79 -------------------------- 4 files changed, 82 deletions(-) delete mode 100644 ports/esp8266/modpyb.c diff --git a/ports/esp8266/Makefile b/ports/esp8266/Makefile index fd2346d515..705f4f1eeb 100644 --- a/ports/esp8266/Makefile +++ b/ports/esp8266/Makefile @@ -90,7 +90,6 @@ SRC_C = \ uart.c \ esppwm.c \ espapa102.c \ - modpyb.c \ modmachine.c \ machine_bitstream.c \ machine_pin.c \ diff --git a/ports/esp8266/boards/esp8266_common.ld b/ports/esp8266/boards/esp8266_common.ld index ae1509faee..c2d62e9dd4 100644 --- a/ports/esp8266/boards/esp8266_common.ld +++ b/ports/esp8266/boards/esp8266_common.ld @@ -151,7 +151,6 @@ SECTIONS *help.o(.literal* .text*) *lexerstr32.o(.literal* .text*) *utils.o(.literal* .text*) - *modpyb.o(.literal*, .text*) *machine_pin.o(.literal*, .text*) *machine_pwm.o(.literal*, .text*) *machine_rtc.o(.literal*, .text*) diff --git a/ports/esp8266/modesp.c b/ports/esp8266/modesp.c index eb79d20bc5..0e2acaf5ff 100644 --- a/ports/esp8266/modesp.c +++ b/ports/esp8266/modesp.c @@ -359,7 +359,6 @@ STATIC const mp_rom_map_elem_t esp_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_freemem), MP_ROM_PTR(&esp_freemem_obj) }, { MP_ROM_QSTR(MP_QSTR_meminfo), MP_ROM_PTR(&esp_meminfo_obj) }, { MP_ROM_QSTR(MP_QSTR_check_fw), MP_ROM_PTR(&esp_check_fw_obj) }, - { MP_ROM_QSTR(MP_QSTR_info), MP_ROM_PTR(&pyb_info_obj) }, // TODO delete/rename/move elsewhere { MP_ROM_QSTR(MP_QSTR_malloc), MP_ROM_PTR(&esp_malloc_obj) }, { MP_ROM_QSTR(MP_QSTR_free), MP_ROM_PTR(&esp_free_obj) }, { MP_ROM_QSTR(MP_QSTR_esf_free_bufs), MP_ROM_PTR(&esp_esf_free_bufs_obj) }, diff --git a/ports/esp8266/modpyb.c b/ports/esp8266/modpyb.c deleted file mode 100644 index 0a23f6f9da..0000000000 --- a/ports/esp8266/modpyb.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014 Damien P. George - * - * 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/gc.h" -#include "gccollect.h" -#include "modmachine.h" - -// The pyb module no longer exists since all functionality now appears -// elsewhere, in more standard places (eg time, machine modules). The -// only remaining function is pyb.info() which has been moved to the -// esp module, pending deletion/renaming/moving elsewhere. - -STATIC mp_obj_t pyb_info(size_t n_args, const mp_obj_t *args) { - // print info about memory - { - printf("_text_start=%p\n", &_text_start); - printf("_text_end=%p\n", &_text_end); - printf("_irom0_text_start=%p\n", &_irom0_text_start); - printf("_irom0_text_end=%p\n", &_irom0_text_end); - printf("_data_start=%p\n", &_data_start); - printf("_data_end=%p\n", &_data_end); - printf("_rodata_start=%p\n", &_rodata_start); - printf("_rodata_end=%p\n", &_rodata_end); - printf("_bss_start=%p\n", &_bss_start); - printf("_bss_end=%p\n", &_bss_end); - printf("_heap_start=%p\n", &_heap_start); - printf("_heap_end=%p\n", &_heap_end); - } - - // qstr info - { - mp_uint_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes; - qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes); - printf("qstr:\n n_pool=" UINT_FMT "\n n_qstr=" UINT_FMT "\n n_str_data_bytes=" UINT_FMT "\n n_total_bytes=" UINT_FMT "\n", n_pool, n_qstr, n_str_data_bytes, n_total_bytes); - } - - // GC info - { - gc_info_t info; - gc_info(&info); - printf("GC:\n"); - printf(" " UINT_FMT " total\n", info.total); - printf(" " UINT_FMT " : " UINT_FMT "\n", info.used, info.free); - printf(" 1=" UINT_FMT " 2=" UINT_FMT " m=" UINT_FMT "\n", info.num_1block, info.num_2block, info.max_block); - } - - if (n_args == 1) { - // arg given means dump gc allocation table - gc_dump_alloc_table(); - } - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_info_obj, 0, 1, pyb_info); From 7a9cf1f0fb7c43de766e18465a15d451dda6ef58 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 17 Mar 2022 17:07:49 +1100 Subject: [PATCH 0239/1712] stm32/sdcard: Use mp_hal_pin_input instead of HAL function. Signed-off-by: Damien George --- ports/stm32/sdcard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/stm32/sdcard.c b/ports/stm32/sdcard.c index cb773f29db..cdec576dc2 100644 --- a/ports/stm32/sdcard.c +++ b/ports/stm32/sdcard.c @@ -249,7 +249,7 @@ bool sdcard_is_present(void) { } #endif #if defined(MICROPY_HW_SDCARD_DETECT_PIN) - return HAL_GPIO_ReadPin(MICROPY_HW_SDCARD_DETECT_PIN->gpio, MICROPY_HW_SDCARD_DETECT_PIN->pin_mask) == MICROPY_HW_SDCARD_DETECT_PRESENT; + return mp_hal_pin_read(MICROPY_HW_SDCARD_DETECT_PIN) == MICROPY_HW_SDCARD_DETECT_PRESENT; #else return true; #endif From 75d2bfcccf04e2740c51c345bc8a3145c2c2c7c7 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 17 Mar 2022 17:08:14 +1100 Subject: [PATCH 0240/1712] stm32/sdcard: Add sdcard_select_sd/mmc functions. So that C code can select which of SD or MMC to use. Signed-off-by: Damien George --- ports/stm32/sdcard.c | 8 ++++++++ ports/stm32/sdcard.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/ports/stm32/sdcard.c b/ports/stm32/sdcard.c index cdec576dc2..12c9eb4446 100644 --- a/ports/stm32/sdcard.c +++ b/ports/stm32/sdcard.c @@ -200,6 +200,14 @@ void sdcard_init(void) { #endif } +void sdcard_select_sd(void) { + pyb_sdmmc_flags |= PYB_SDMMC_FLAG_SD; +} + +void sdcard_select_mmc(void) { + pyb_sdmmc_flags |= PYB_SDMMC_FLAG_MMC; +} + STATIC void sdmmc_msp_init(void) { // enable SDIO clock SDMMC_CLK_ENABLE(); diff --git a/ports/stm32/sdcard.h b/ports/stm32/sdcard.h index e436ffffe1..a2e4e4517c 100644 --- a/ports/stm32/sdcard.h +++ b/ports/stm32/sdcard.h @@ -30,6 +30,8 @@ #define SDCARD_BLOCK_SIZE (512) void sdcard_init(void); +void sdcard_select_sd(void); +void sdcard_select_mmc(void); bool sdcard_is_present(void); bool sdcard_power_on(void); void sdcard_power_off(void); From 63c7593df66533fc0c529d2ed2a5da38042c8970 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 17 Mar 2022 17:09:01 +1100 Subject: [PATCH 0241/1712] stm32/main: Support SD cards without a partition table. Signed-off-by: Damien George --- ports/stm32/main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ports/stm32/main.c b/ports/stm32/main.c index 3291a80184..875584be8a 100644 --- a/ports/stm32/main.c +++ b/ports/stm32/main.c @@ -233,7 +233,7 @@ MP_NOINLINE STATIC bool init_flash_fs(uint reset_mode) { #if MICROPY_HW_SDCARD_MOUNT_AT_BOOT STATIC bool init_sdcard_fs(void) { bool first_part = true; - for (int part_num = 1; part_num <= 4; ++part_num) { + for (int part_num = 1; part_num <= 5; ++part_num) { // create vfs object fs_user_mount_t *vfs_fat = m_new_obj_maybe(fs_user_mount_t); mp_vfs_mount_t *vfs = m_new_obj_maybe(mp_vfs_mount_t); @@ -241,7 +241,16 @@ STATIC bool init_sdcard_fs(void) { break; } vfs_fat->blockdev.flags = MP_BLOCKDEV_FLAG_FREE_OBJ; - sdcard_init_vfs(vfs_fat, part_num); + if (part_num == 5) { + if (!first_part) { + break; + } + // partitions 1-4 couldn't be mounted, so try FATFS auto-detect mode + // which will work if there is no partition table, just a filesystem + sdcard_init_vfs(vfs_fat, 0); + } else { + sdcard_init_vfs(vfs_fat, part_num); + } // try to mount the partition FRESULT res = f_mount(&vfs_fat->fatfs); From f0be0de34185e77141205499f5f7563c6450df5f Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 17 Mar 2022 17:09:28 +1100 Subject: [PATCH 0242/1712] stm32/dma: Add option to disable auto-DMA-turn-off. Signed-off-by: Damien George --- ports/stm32/dma.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ports/stm32/dma.c b/ports/stm32/dma.c index 75c34325d7..cb8e555df4 100644 --- a/ports/stm32/dma.c +++ b/ports/stm32/dma.c @@ -34,6 +34,12 @@ #include "dma.h" #include "irq.h" +// When this option is enabled, the DMA will turn off automatically after +// a period of inactivity. +#ifndef MICROPY_HW_DMA_ENABLE_AUTO_TURN_OFF +#define MICROPY_HW_DMA_ENABLE_AUTO_TURN_OFF (1) +#endif + #define DMA_IDLE_ENABLED() (dma_idle.enabled != 0) #define DMA_SYSTICK_LOG2 (3) #define DMA_SYSTICK_MASK ((1 << DMA_SYSTICK_LOG2) - 1) @@ -653,7 +659,9 @@ static const uint8_t dma_irqn[NSTREAM] = { static DMA_HandleTypeDef *dma_handle[NSTREAM] = {NULL}; static uint8_t dma_last_sub_instance[NSTREAM]; static volatile uint32_t dma_enable_mask = 0; +#if MICROPY_HW_DMA_ENABLE_AUTO_TURN_OFF volatile dma_idle_count_t dma_idle; +#endif #define DMA_INVALID_CHANNEL 0xff // Value stored in dma_last_channel which means invalid @@ -1082,6 +1090,7 @@ void DMA2_Channel7_IRQHandler(void) { #endif +#if MICROPY_HW_DMA_ENABLE_AUTO_TURN_OFF static void dma_idle_handler(uint32_t tick); // Resets the idle counter for the DMA controller associated with dma_id. @@ -1089,6 +1098,7 @@ static void dma_tickle(dma_id_t dma_id) { dma_idle.counter[(dma_id < NSTREAMS_PER_CONTROLLER) ? 0 : 1] = 1; systick_enable_dispatch(SYSTICK_DISPATCH_DMA, dma_idle_handler); } +#endif static void dma_enable_clock(dma_id_t dma_id) { // We don't want dma_tick_handler() to turn off the clock right after we @@ -1143,7 +1153,9 @@ static void dma_disable_clock(dma_id_t dma_id) { // We just mark the clock as disabled here, but we don't actually disable it. // We wait for the timer to expire first, which means that back-to-back // transfers don't have to initialize as much. + #if MICROPY_HW_DMA_ENABLE_AUTO_TURN_OFF dma_tickle(dma_id); + #endif dma_enable_mask &= ~(1 << dma_id); } @@ -1250,6 +1262,7 @@ void dma_invalidate_channel(const dma_descr_t *dma_descr) { } } +#if MICROPY_HW_DMA_ENABLE_AUTO_TURN_OFF // Called from the SysTick handler // We use LSB of tick to select which controller to process static void dma_idle_handler(uint32_t tick) { @@ -1302,6 +1315,7 @@ static void dma_idle_handler(uint32_t tick) { } } } +#endif #if defined(STM32F0) || defined(STM32G4) || defined(STM32L0) || defined(STM32L4) From dc91024a7312894997020e57502cccf0ebbca4ff Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 17 Mar 2022 17:10:45 +1100 Subject: [PATCH 0243/1712] stm32/mboot: Add pragma for GCC to ignore array bounds warning. Signed-off-by: Damien George --- ports/stm32/mboot/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ports/stm32/mboot/main.c b/ports/stm32/mboot/main.c index 8d6e28f189..ac564d1d06 100644 --- a/ports/stm32/mboot/main.c +++ b/ports/stm32/mboot/main.c @@ -788,7 +788,15 @@ void i2c_slave_process_rx_end(i2c_slave_t *i2c) { if (buf[0] == I2C_CMD_ECHO) { ++len; } else if (buf[0] == I2C_CMD_GETID && len == 0) { + #if __GNUC__ >= 11 + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Warray-bounds" + #pragma GCC diagnostic ignored "-Wstringop-overread" + #endif memcpy(buf, (uint8_t*)MP_HAL_UNIQUE_ID_ADDRESS, 12); + #if __GNUC__ >= 11 + #pragma GCC diagnostic pop + #endif memcpy(buf + 12, MICROPY_HW_MCU_NAME, sizeof(MICROPY_HW_MCU_NAME)); memcpy(buf + 12 + sizeof(MICROPY_HW_MCU_NAME), MICROPY_HW_BOARD_NAME, sizeof(MICROPY_HW_BOARD_NAME) - 1); len = 12 + sizeof(MICROPY_HW_MCU_NAME) + sizeof(MICROPY_HW_BOARD_NAME) - 1; From a92d45c3df893c845571506afe6fbbfb3e7a85aa Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 17 Mar 2022 17:11:03 +1100 Subject: [PATCH 0244/1712] stm32/mboot: Always check the magic number to enter filesystem loading. Even if MBOOT_FSLOAD is disabled, mboot should still check for 0x70ad0080 so it can immediately return to the application if this feature is not enabled. Otherwise mboot will get stuck in DFU mode. Signed-off-by: Damien George --- ports/stm32/mboot/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/stm32/mboot/main.c b/ports/stm32/mboot/main.c index ac564d1d06..341cf18179 100644 --- a/ports/stm32/mboot/main.c +++ b/ports/stm32/mboot/main.c @@ -1539,8 +1539,8 @@ enter_bootloader: mboot_pack_init(); #endif - #if MBOOT_FSLOAD if ((initial_r0 & 0xffffff80) == 0x70ad0080) { + #if MBOOT_FSLOAD // Application passed through elements, validate then process them const uint8_t *elem_end = elem_search(ELEM_DATA_START, ELEM_TYPE_END); if (elem_end != NULL && elem_end[-1] == 0) { @@ -1553,11 +1553,11 @@ enter_bootloader: *status_ptr = ret; } } + #endif // Always reset because the application is expecting to resume led_state_all(0); leave_bootloader(); } - #endif dfu_init(); From 9b07d38c7e5919c8f26ee12b7bba71214ac43289 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 18 Mar 2022 16:22:26 +1100 Subject: [PATCH 0245/1712] stm32/mboot: Add support for 64-bit mboot address space for reads. If enabled via MBOOT_ADDRESS_SPACE_64BIT (it's disabled by default) then read addresses will be 64-bit. Signed-off-by: Damien George --- ports/stm32/mboot/README.md | 6 +++++- ports/stm32/mboot/fsload.c | 27 ++++++++++++++++++--------- ports/stm32/mboot/fwupdate.py | 7 +++++-- ports/stm32/mboot/main.c | 11 ++++++++--- ports/stm32/mboot/mboot.h | 16 ++++++++++++++-- ports/stm32/mboot/vfs.h | 14 +++++++------- ports/stm32/mboot/vfs_fat.c | 11 ++++++----- ports/stm32/mboot/vfs_lfs.c | 5 +++-- 8 files changed, 66 insertions(+), 31 deletions(-) diff --git a/ports/stm32/mboot/README.md b/ports/stm32/mboot/README.md index b85bc3e2ee..49385047a4 100644 --- a/ports/stm32/mboot/README.md +++ b/ports/stm32/mboot/README.md @@ -137,9 +137,13 @@ are located and what filename to program. The elements to use are: * MOUNT: type=2, len=10, payload=( ) +* MOUNT: type=2, len=14, payload=( ) + +* MOUNT: type=2, len=22, payload=( ) + * FSLOAD: type=3, len=1+n, payload=( ) -`u32` means unsigned 32-bit little-endian integer. +`u32`/`u64` mean unsigned 32-bit/64-bit little-endian integers. The firmware to load must be a gzip'd DfuSe file (.dfu.gz) and stored within a FAT or littlefs formatted partition. diff --git a/ports/stm32/mboot/fsload.c b/ports/stm32/mboot/fsload.c index 9ecc25b0be..14864bb895 100644 --- a/ports/stm32/mboot/fsload.c +++ b/ports/stm32/mboot/fsload.c @@ -222,20 +222,29 @@ int fsload_process(void) { // End of elements. return -MBOOT_ERRNO_FSLOAD_NO_MOUNT; } - uint32_t block_size; - if (elem[-1] == 10) { - // No block size given, use default. - block_size = MBOOT_FSLOAD_DEFAULT_BLOCK_SIZE; - } else if (elem[-1] == 14) { - // Block size given, extract it. - block_size = get_le32(&elem[10]); + mboot_addr_t base_addr; + mboot_addr_t byte_len; + uint32_t block_size = MBOOT_FSLOAD_DEFAULT_BLOCK_SIZE; + if (elem[-1] == 10 || elem[-1] == 14) { + // 32-bit base and length given, extract them. + base_addr = get_le32(&elem[2]); + byte_len = get_le32(&elem[6]); + if (elem[-1] == 14) { + // Block size given, extract it. + block_size = get_le32(&elem[10]); + } + #if MBOOT_ADDRESS_SPACE_64BIT + } else if (elem[-1] == 22) { + // 64-bit base and length given, and block size, so extract them. + base_addr = get_le64(&elem[2]); + byte_len = get_le64(&elem[10]); + block_size = get_le32(&elem[18]); + #endif } else { // Invalid MOUNT element. return -MBOOT_ERRNO_FSLOAD_INVALID_MOUNT; } if (elem[0] == mount_point) { - uint32_t base_addr = get_le32(&elem[2]); - uint32_t byte_len = get_le32(&elem[6]); int ret; union { #if MBOOT_VFS_FAT diff --git a/ports/stm32/mboot/fwupdate.py b/ports/stm32/mboot/fwupdate.py index 0e7ea01418..df1ff62846 100644 --- a/ports/stm32/mboot/fwupdate.py +++ b/ports/stm32/mboot/fwupdate.py @@ -227,7 +227,9 @@ def _create_element(kind, body): return bytes([kind, len(body)]) + body -def update_mpy(filename, fs_base, fs_len, fs_type=VFS_FAT, fs_blocksize=0, status_addr=None): +def update_mpy( + filename, fs_base, fs_len, fs_type=VFS_FAT, fs_blocksize=0, status_addr=None, addr_64bit=False +): # Check firmware is of .dfu or .dfu.gz type try: with open(filename, "rb") as f: @@ -243,9 +245,10 @@ def update_mpy(filename, fs_base, fs_len, fs_type=VFS_FAT, fs_blocksize=0, statu raise Exception("littlefs requires fs_blocksize parameter") mount_point = 1 + mount_encoding = "bdev_byte_len / 512) { - hw_read(ctx->bdev_base_addr + sector * SECSIZE, count * SECSIZE, buf); + if (0 <= sector && sector < ctx->bdev_num_blocks) { + mboot_addr_t addr = ctx->bdev_base_addr + (mboot_addr_t)sector * (mboot_addr_t)SECSIZE; + hw_read(addr, count * SECSIZE, buf); return RES_OK; } @@ -57,7 +58,7 @@ DRESULT disk_ioctl(void *pdrv, BYTE cmd, void *buf) { return RES_OK; case GET_SECTOR_COUNT: - *((DWORD*)buf) = ctx->bdev_byte_len / SECSIZE; + *((DWORD*)buf) = ctx->bdev_num_blocks; return RES_OK; case GET_SECTOR_SIZE: @@ -78,9 +79,9 @@ DRESULT disk_ioctl(void *pdrv, BYTE cmd, void *buf) { } } -int vfs_fat_mount(vfs_fat_context_t *ctx, uint32_t base_addr, uint32_t byte_len) { +int vfs_fat_mount(vfs_fat_context_t *ctx, mboot_addr_t base_addr, mboot_addr_t byte_len) { ctx->bdev_base_addr = base_addr; - ctx->bdev_byte_len = byte_len; + ctx->bdev_num_blocks = byte_len / SECSIZE; ctx->fatfs.drv = ctx; FRESULT res = f_mount(&ctx->fatfs); if (res != FR_OK) { diff --git a/ports/stm32/mboot/vfs_lfs.c b/ports/stm32/mboot/vfs_lfs.c index e7fd8ce63c..5aa400df40 100644 --- a/ports/stm32/mboot/vfs_lfs.c +++ b/ports/stm32/mboot/vfs_lfs.c @@ -70,7 +70,8 @@ static uint8_t lfs_lookahead_buffer[LFS_LOOKAHEAD_SIZE]; static int dev_read(const struct LFSx_API (config) * c, LFSx_API(block_t) block, LFSx_API(off_t) off, void *buffer, LFSx_API(size_t) size) { VFS_LFSx_CONTEXT_T *ctx = c->context; if (0 <= block && block < ctx->config.block_count) { - hw_read(ctx->bdev_base_addr + block * ctx->config.block_size + off, size, buffer); + mboot_addr_t addr = ctx->bdev_base_addr + (mboot_addr_t)block * (mboot_addr_t)ctx->config.block_size + (mboot_addr_t)off; + hw_read(addr, size, buffer); return LFSx_MACRO(_ERR_OK); } return LFSx_MACRO(_ERR_IO); @@ -88,7 +89,7 @@ static int dev_sync(const struct LFSx_API (config) * c) { return LFSx_MACRO(_ERR_OK); } -int VFS_LFSx_MOUNT(VFS_LFSx_CONTEXT_T *ctx, uint32_t base_addr, uint32_t byte_len, uint32_t block_size) { +int VFS_LFSx_MOUNT(VFS_LFSx_CONTEXT_T *ctx, mboot_addr_t base_addr, mboot_addr_t byte_len, uint32_t block_size) { ctx->bdev_base_addr = base_addr; struct LFSx_API (config) *config = &ctx->config; From e316306546c9a0f76512692eaacfee9fe38892c5 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 17 Mar 2022 17:11:44 +1100 Subject: [PATCH 0246/1712] stm32/mboot: Add support for reading from SD card. Tested on PYBV10 and PYBD_SF6, with MBOOT_FSLOAD enabled and programming new firmware from a .dfu.gz file stored on the SD card. Signed-off-by: Damien George --- ports/stm32/mboot/Makefile | 10 ++++++++++ ports/stm32/mboot/README.md | 12 ++++++++++++ ports/stm32/mboot/main.c | 17 +++++++++++++++++ ports/stm32/mboot/sdcard.c | 13 +++++++++++++ ports/stm32/sdcard.c | 4 ++++ tools/ci.sh | 1 + 6 files changed, 57 insertions(+) create mode 100644 ports/stm32/mboot/sdcard.c diff --git a/ports/stm32/mboot/Makefile b/ports/stm32/mboot/Makefile index ee75fb2afe..61a102d02d 100755 --- a/ports/stm32/mboot/Makefile +++ b/ports/stm32/mboot/Makefile @@ -110,6 +110,7 @@ SRC_C += \ fsload.c \ gzstream.c \ pack.c \ + sdcard.c \ vfs_fat.c \ vfs_lfs.c \ drivers/bus/softspi.c \ @@ -142,6 +143,7 @@ endif $(BUILD)/$(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_ll_usb.o: CFLAGS += -Wno-attributes SRC_HAL += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ hal_cortex.c \ + hal_dma.c \ hal_flash.c \ hal_flash_ex.c \ hal_pcd.c \ @@ -151,6 +153,14 @@ SRC_HAL += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ ll_usb.c \ ) +ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES),f4 f7 h7)) +SRC_HAL += $(addprefix $(STM32LIB_HAL_BASE)/Src/stm32$(MCU_SERIES)xx_,\ + hal_mmc.c \ + hal_sd.c \ + ll_sdmmc.c \ + ) +endif + SRC_USBDEV += $(addprefix ports/stm32/$(USBDEV_DIR)/,\ core/src/usbd_core.c \ core/src/usbd_ctlreq.c \ diff --git a/ports/stm32/mboot/README.md b/ports/stm32/mboot/README.md index 49385047a4..936b587608 100644 --- a/ports/stm32/mboot/README.md +++ b/ports/stm32/mboot/README.md @@ -59,6 +59,13 @@ How to use second one use the same configuration names as above but with `SPIFLASH2`, ie `MBOOT_SPIFLASH2_ADDR` etc. + SD card support (read-only, useful in combination with `MBOOT_FSLOAD`) + can be enabled with the following options: + + #define MBOOT_ADDRESS_SPACE_64BIT (1) + #define MBOOT_SDCARD_ADDR (0x100000000ULL) + #define MBOOT_SDCARD_BYTE_SIZE (0x400000000ULL) + To enable loading firmware from a filesystem use: #define MBOOT_FSLOAD (1) @@ -159,6 +166,11 @@ firmware.dfu.gz stored on the default FAT filesystem: The 0x80000000 value is the address understood by Mboot as the location of the external SPI flash, configured via `MBOOT_SPIFLASH_ADDR`. +To load a file from the SD card (see `MBOOT_SDCARD_ADDR`), assuming it is a +16GiB card, use: + + fwupdate.update_mpy('firmware.dfu.gz', 0x1_00000000, 0x4_00000000, addr_64bit=True) + Signed and encrypted DFU support -------------------------------- diff --git a/ports/stm32/mboot/main.c b/ports/stm32/mboot/main.c index 714b20ff09..976f0e54d2 100644 --- a/ports/stm32/mboot/main.c +++ b/ports/stm32/mboot/main.c @@ -37,6 +37,7 @@ #include "irq.h" #include "mboot.h" #include "powerctrl.h" +#include "sdcard.h" #include "dfu.h" #include "pack.h" @@ -653,6 +654,16 @@ void hw_read(mboot_addr_t addr, size_t len, uint8_t *buf) { mp_spiflash_read(MBOOT_SPIFLASH2_SPIFLASH, addr - MBOOT_SPIFLASH2_ADDR, len, buf); } else #endif + #if defined(MBOOT_SDCARD_ADDR) + if (MBOOT_SDCARD_ADDR <= addr && addr < MBOOT_SDCARD_ADDR + MBOOT_SDCARD_BYTE_SIZE) { + // Read address and length must be aligned. + if (addr % SDCARD_BLOCK_SIZE == 0 && len % SDCARD_BLOCK_SIZE == 0) { + sdcard_read_blocks(buf, (addr - MBOOT_SDCARD_ADDR) / SDCARD_BLOCK_SIZE, len / SDCARD_BLOCK_SIZE); + } else { + memset(buf, 0xff, len); + } + } else + #endif { // Other addresses, just read directly from memory memcpy(buf, (void *)(uintptr_t)addr, len); @@ -1540,6 +1551,12 @@ enter_bootloader: mp_spiflash_init(MBOOT_SPIFLASH2_SPIFLASH); #endif + #if defined(MBOOT_SDCARD_ADDR) + sdcard_init(); + sdcard_select_sd(); + sdcard_power_on(); + #endif + #if MBOOT_ENABLE_PACKING mboot_pack_init(); #endif diff --git a/ports/stm32/mboot/sdcard.c b/ports/stm32/mboot/sdcard.c new file mode 100644 index 0000000000..caf3dbf3c0 --- /dev/null +++ b/ports/stm32/mboot/sdcard.c @@ -0,0 +1,13 @@ +// Include relevant source files for SD card only when it's needed and +// configured at the C level (in mpconfigboard.h). + +#include "py/mpconfig.h" + +#if defined(MBOOT_SDCARD_ADDR) + +#define MICROPY_HW_DMA_ENABLE_AUTO_TURN_OFF (0) + +#include "ports/stm32/dma.c" +#include "ports/stm32/sdcard.c" + +#endif diff --git a/ports/stm32/sdcard.c b/ports/stm32/sdcard.c index 12c9eb4446..6f5892570b 100644 --- a/ports/stm32/sdcard.c +++ b/ports/stm32/sdcard.c @@ -688,6 +688,8 @@ mp_uint_t sdcard_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t n // // Expose the SD card or MMC as an object with the block protocol. +#if !BUILDING_MBOOT + // There are singleton SDCard/MMCard objects #if MICROPY_HW_ENABLE_SDCARD const mp_obj_base_t pyb_sdcard_obj = {&pyb_sdcard_type}; @@ -905,4 +907,6 @@ void sdcard_init_vfs(fs_user_mount_t *vfs, int part) { vfs->blockdev.u.ioctl[1] = MP_OBJ_FROM_PTR(&pyb_sdcard_obj); } +#endif // !BUILDING_MBOOT + #endif // MICROPY_HW_ENABLE_SDCARD || MICROPY_HW_ENABLE_MMCARD diff --git a/tools/ci.sh b/tools/ci.sh index 4f6717fe93..5aed8a7dff 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -292,6 +292,7 @@ function ci_stm32_pyb_build { make ${MAKEOPTS} -C ports/stm32 BOARD=PYBD_SF6 NANBOX=1 MICROPY_BLUETOOTH_NIMBLE=0 MICROPY_BLUETOOTH_BTSTACK=1 make ${MAKEOPTS} -C ports/stm32/mboot BOARD=PYBV10 CFLAGS_EXTRA='-DMBOOT_FSLOAD=1 -DMBOOT_VFS_LFS2=1' make ${MAKEOPTS} -C ports/stm32/mboot BOARD=PYBD_SF6 + make ${MAKEOPTS} -C ports/stm32/mboot BOARD=STM32F769DISC CFLAGS_EXTRA='-DMBOOT_ADDRESS_SPACE_64BIT=1 -DMBOOT_SDCARD_ADDR=0x100000000ULL -DMBOOT_SDCARD_BYTE_SIZE=0x400000000ULL -DMBOOT_FSLOAD=1 -DMBOOT_VFS_FAT=1' } function ci_stm32_nucleo_build { From bf89e336b9e0b195eacfe26f3a72989a8a9c06f2 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 22 Mar 2022 12:14:34 +1100 Subject: [PATCH 0247/1712] stm32/boards/PYBD_SF2: Turn on SD card in mboot init if SD enabled. Signed-off-by: Damien George --- ports/stm32/boards/PYBD_SF2/board_init.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/stm32/boards/PYBD_SF2/board_init.c b/ports/stm32/boards/PYBD_SF2/board_init.c index c3b54fa2f1..ab15783a7e 100644 --- a/ports/stm32/boards/PYBD_SF2/board_init.c +++ b/ports/stm32/boards/PYBD_SF2/board_init.c @@ -44,6 +44,11 @@ typedef struct _pyb_otp_t { void mboot_board_early_init(void) { // Enable 500mA on WBUS-DIP28 mp_hal_pin_config(pyb_pin_W23, MP_HAL_PIN_MODE_INPUT, MP_HAL_PIN_PULL_UP, 0); + + #if defined(MBOOT_SDCARD_ADDR) + // Configure EN_3V3 as an output pin so that SD card can be used + mp_hal_pin_config(pyb_pin_EN_3V3, MP_HAL_PIN_MODE_OUTPUT, MP_HAL_PIN_PULL_NONE, 0); + #endif } void board_early_init(void) { From 80055c2cdc1a5376c609e50f3ae0710f27146b15 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 22 Mar 2022 11:42:52 +1100 Subject: [PATCH 0248/1712] stm32/mboot/fwupdate.py: Simplify calculation of CRC32. Signed-off-by: Damien George --- ports/stm32/mboot/fwupdate.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ports/stm32/mboot/fwupdate.py b/ports/stm32/mboot/fwupdate.py index df1ff62846..3e25351370 100644 --- a/ports/stm32/mboot/fwupdate.py +++ b/ports/stm32/mboot/fwupdate.py @@ -75,12 +75,10 @@ def dfu_read(filename): return None hdr = f.read(16) - crc = crc32(hdr[:-4], crc) - hdr = struct.unpack(" Date: Thu, 17 Jun 2021 12:51:37 +1000 Subject: [PATCH 0249/1712] stm32/mboot: Verify signature of fsload packed DFU files before writing. When verifying the DFU contents, the signature of signed/encrypted files is also now checked in this initial, dry-run stage. --- ports/stm32/mboot/fsload.c | 10 ++++------ ports/stm32/mboot/main.c | 16 ++++++++++------ ports/stm32/mboot/mboot.h | 2 +- ports/stm32/mboot/pack.c | 5 ++++- ports/stm32/mboot/pack.h | 2 +- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/ports/stm32/mboot/fsload.c b/ports/stm32/mboot/fsload.c index 14864bb895..a54cfe4c73 100644 --- a/ports/stm32/mboot/fsload.c +++ b/ports/stm32/mboot/fsload.c @@ -151,13 +151,11 @@ static int fsload_program_file(bool write_to_flash) { if (res != l) { return -MBOOT_ERRNO_DFU_READ_ERROR; } - if (write_to_flash) { - res = do_write(elem_addr, buf, l); - if (res != 0) { - return res; - } - elem_addr += l; + res = do_write(elem_addr, buf, l, !write_to_flash); + if (res != 0) { + return res; } + elem_addr += l; s -= l; } diff --git a/ports/stm32/mboot/main.c b/ports/stm32/mboot/main.c index 976f0e54d2..10a09fe3e1 100644 --- a/ports/stm32/mboot/main.c +++ b/ports/stm32/mboot/main.c @@ -715,11 +715,15 @@ void do_read(mboot_addr_t addr, size_t len, uint8_t *buf) { #endif } -int do_write(uint32_t addr, const uint8_t *src8, size_t len) { +int do_write(uint32_t addr, const uint8_t *src8, size_t len, bool dry_run) { #if MBOOT_ENABLE_PACKING - return mboot_pack_write(addr, src8, len); + return mboot_pack_write(addr, src8, len, dry_run); #else - return hw_write(addr, src8, len); + if (dry_run) { + return 0; + } else { + return hw_write(addr, src8, len); + } #endif } @@ -844,7 +848,7 @@ void i2c_slave_process_rx_end(i2c_slave_t *i2c) { // Mark the 2 lower bits to indicate invalid app firmware buf[1] |= APP_VALIDITY_BITS; } - int ret = do_write(i2c_obj.cmd_wraddr, buf + 1, len); + int ret = do_write(i2c_obj.cmd_wraddr, buf + 1, len, false); if (ret < 0) { len = ret; } else { @@ -866,7 +870,7 @@ void i2c_slave_process_rx_end(i2c_slave_t *i2c) { len = -1; } else { buf &= ~APP_VALIDITY_BITS; - int ret = do_write(APPLICATION_ADDR, (void*)&buf, 4); + int ret = do_write(APPLICATION_ADDR, (void*)&buf, 4, false); if (ret < 0) { len = ret; } else { @@ -940,7 +944,7 @@ static int dfu_process_dnload(void) { } else if (dfu_context.wBlockNum > 1) { // write data to memory uint32_t addr = (dfu_context.wBlockNum - 2) * DFU_XFER_SIZE + dfu_context.addr; - ret = do_write(addr, dfu_context.buf, dfu_context.wLength); + ret = do_write(addr, dfu_context.buf, dfu_context.wLength, false); } if (ret == 0) { return DFU_STATE_DNLOAD_IDLE; diff --git a/ports/stm32/mboot/mboot.h b/ports/stm32/mboot/mboot.h index 36acb313b6..e64835bb44 100644 --- a/ports/stm32/mboot/mboot.h +++ b/ports/stm32/mboot/mboot.h @@ -113,7 +113,7 @@ int hw_write(uint32_t addr, const uint8_t *src8, size_t len); int do_page_erase(uint32_t addr, uint32_t *next_addr); void do_read(mboot_addr_t addr, size_t len, uint8_t *buf); -int do_write(uint32_t addr, const uint8_t *src8, size_t len); +int do_write(uint32_t addr, const uint8_t *src8, size_t len, bool dry_run); const uint8_t *elem_search(const uint8_t *elem, uint8_t elem_id); int fsload_process(void); diff --git a/ports/stm32/mboot/pack.c b/ports/stm32/mboot/pack.c index 88529ec50a..03ac6a4dc5 100644 --- a/ports/stm32/mboot/pack.c +++ b/ports/stm32/mboot/pack.c @@ -206,7 +206,7 @@ static int mboot_pack_handle_firmware(void) { } } -int mboot_pack_write(uint32_t addr, const uint8_t *src8, size_t len) { +int mboot_pack_write(uint32_t addr, const uint8_t *src8, size_t len, bool dry_run) { if (addr == APPLICATION_ADDR) { // Base address of main firmware, reset any previous state firmware_chunk_base_addr = 0; @@ -274,6 +274,9 @@ int mboot_pack_write(uint32_t addr, const uint8_t *src8, size_t len) { } // Signature passed, we have valid chunk. + if (dry_run) { + return 0; + } if (firmware_chunk_buf.header.format == MBOOT_PACK_CHUNK_META) { // Ignore META chunks. diff --git a/ports/stm32/mboot/pack.h b/ports/stm32/mboot/pack.h index 195f297ca1..3578d9d127 100644 --- a/ports/stm32/mboot/pack.h +++ b/ports/stm32/mboot/pack.h @@ -75,7 +75,7 @@ extern const uint8_t mboot_pack_secretbox_key[hydro_secretbox_KEYBYTES]; // Implementation void mboot_pack_init(void); -int mboot_pack_write(uint32_t addr, const uint8_t *src8, size_t len); +int mboot_pack_write(uint32_t addr, const uint8_t *src8, size_t len, bool dry_run); #endif // MBOOT_ENABLE_PACKING From bb0ca00b77b3ccb77bad857373df39556612444a Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Thu, 17 Jun 2021 12:55:18 +1000 Subject: [PATCH 0250/1712] stm32/mboot: Verify CRC32 of fsload DFU files before writing. --- ports/stm32/mboot/fsload.c | 13 ++++++++++++- ports/stm32/mboot/mboot.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ports/stm32/mboot/fsload.c b/ports/stm32/mboot/fsload.c index a54cfe4c73..2b674369f0 100644 --- a/ports/stm32/mboot/fsload.c +++ b/ports/stm32/mboot/fsload.c @@ -27,6 +27,7 @@ #include #include "py/mphal.h" +#include "lib/uzlib/tinf.h" #include "mboot.h" #include "pack.h" #include "vfs.h" @@ -74,6 +75,7 @@ static inline int input_stream_read(size_t len, uint8_t *buf) { static int fsload_program_file(bool write_to_flash) { // Parse DFU + uint32_t crc = 0xffffffff; uint8_t buf[512]; size_t file_offset; @@ -83,6 +85,7 @@ static int fsload_program_file(bool write_to_flash) { return -MBOOT_ERRNO_DFU_READ_ERROR; } file_offset = 11; + crc = uzlib_crc32(buf, 11, crc); // Validate header, version 1 if (memcmp(buf, "DfuSe\x01", 6) != 0) { @@ -103,6 +106,7 @@ static int fsload_program_file(bool write_to_flash) { return -MBOOT_ERRNO_DFU_READ_ERROR; } file_offset += 274; + crc = uzlib_crc32(buf, 274, crc); // Validate target header, with alt being 0 if (memcmp(buf, "Target\x00", 7) != 0) { @@ -123,6 +127,7 @@ static int fsload_program_file(bool write_to_flash) { return -MBOOT_ERRNO_DFU_READ_ERROR; } file_offset += 8; + crc = uzlib_crc32(buf, 8, crc); // Get element destination address and size uint32_t elem_addr = get_le32(buf); @@ -151,6 +156,7 @@ static int fsload_program_file(bool write_to_flash) { if (res != l) { return -MBOOT_ERRNO_DFU_READ_ERROR; } + crc = uzlib_crc32(buf, l, crc); res = do_write(elem_addr, buf, l, !write_to_flash); if (res != 0) { return res; @@ -176,7 +182,12 @@ static int fsload_program_file(bool write_to_flash) { return -MBOOT_ERRNO_DFU_READ_ERROR; } - // TODO validate CRC32 + // The final 4 bytes of the file are the expected CRC32, so including these + // bytes in the CRC calculation should yield a final CRC32 of 0. + crc = uzlib_crc32(buf, 16, crc); + if (crc != 0) { + return -MBOOT_ERRNO_DFU_INVALID_CRC; + } return 0; } diff --git a/ports/stm32/mboot/mboot.h b/ports/stm32/mboot/mboot.h index e64835bb44..0e04f67f4a 100644 --- a/ports/stm32/mboot/mboot.h +++ b/ports/stm32/mboot/mboot.h @@ -56,6 +56,7 @@ enum { MBOOT_ERRNO_DFU_INVALID_SIZE, MBOOT_ERRNO_DFU_TOO_MANY_TARGETS, MBOOT_ERRNO_DFU_READ_ERROR, + MBOOT_ERRNO_DFU_INVALID_CRC, MBOOT_ERRNO_FSLOAD_NO_FSLOAD = 220, MBOOT_ERRNO_FSLOAD_NO_MOUNT, From 66fe3d5cb5b42a48c0b72480bc1fc54994a91af1 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 22 Mar 2022 16:01:09 +1100 Subject: [PATCH 0251/1712] stm32: Support building for STM32F745. Signed-off-by: Damien George --- ports/stm32/adc.c | 1 + ports/stm32/pyb_i2c.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/stm32/adc.c b/ports/stm32/adc.c index 1d4beafa45..c5ca6306e4 100644 --- a/ports/stm32/adc.c +++ b/ports/stm32/adc.c @@ -146,6 +146,7 @@ #define VBAT_DIV (4) #elif defined(STM32F722xx) || defined(STM32F723xx) || \ defined(STM32F732xx) || defined(STM32F733xx) || \ + defined(STM32F745xx) || \ defined(STM32F746xx) || defined(STM32F765xx) || \ defined(STM32F767xx) || defined(STM32F769xx) #define VBAT_DIV (4) diff --git a/ports/stm32/pyb_i2c.c b/ports/stm32/pyb_i2c.c index 70a8e9f091..5cd7c0c8b0 100644 --- a/ports/stm32/pyb_i2c.c +++ b/ports/stm32/pyb_i2c.c @@ -137,7 +137,7 @@ const pyb_i2c_obj_t pyb_i2c_obj[] = { #define PYB_I2C_TIMINGR (1) -#if defined(STM32F746xx) +#if defined(STM32F745xx) || defined(STM32F746xx) // The value 0x40912732 was obtained from the DISCOVERY_I2Cx_TIMING constant // defined in the STM32F7Cube file Drivers/BSP/STM32F746G-Discovery/stm32f7456g_discovery.h From fe8b47e29fb40566fa35e97e02ab06cfab19bf6e Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Thu, 10 Mar 2022 00:54:44 +0200 Subject: [PATCH 0252/1712] ports: Allow boards to define additional network interfaces. --- ports/mimxrt/mpconfigport.h | 5 +++++ ports/rp2/mpconfigport.h | 5 +++++ ports/stm32/mpconfigport.h | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/ports/mimxrt/mpconfigport.h b/ports/mimxrt/mpconfigport.h index ca8be01f78..b4df533f4a 100644 --- a/ports/mimxrt/mpconfigport.h +++ b/ports/mimxrt/mpconfigport.h @@ -267,8 +267,13 @@ extern const struct _mp_obj_type_t network_lan_type; SOCKET_BUILTIN_MODULE \ NETWORK_BUILTIN_MODULE \ +#ifndef MICROPY_BOARD_NETWORK_INTERFACES +#define MICROPY_BOARD_NETWORK_INTERFACES +#endif + #define MICROPY_PORT_NETWORK_INTERFACES \ MICROPY_HW_NIC_ETH \ + MICROPY_BOARD_NETWORK_INTERFACES \ #define MICROPY_HW_PIT_NUM_CHANNELS 3 diff --git a/ports/rp2/mpconfigport.h b/ports/rp2/mpconfigport.h index 1fb0211e88..2919ed0181 100644 --- a/ports/rp2/mpconfigport.h +++ b/ports/rp2/mpconfigport.h @@ -192,8 +192,13 @@ extern const struct _mod_network_nic_type_t mod_network_nic_type_nina; SOCKET_BUILTIN_MODULE \ NETWORK_BUILTIN_MODULE \ +#ifndef MICROPY_BOARD_NETWORK_INTERFACES +#define MICROPY_BOARD_NETWORK_INTERFACES +#endif + #define MICROPY_PORT_NETWORK_INTERFACES \ MICROPY_HW_NIC_NINAW10 \ + MICROPY_BOARD_NETWORK_INTERFACES \ #ifndef MICROPY_BOARD_ROOT_POINTERS #define MICROPY_BOARD_ROOT_POINTERS diff --git a/ports/stm32/mpconfigport.h b/ports/stm32/mpconfigport.h index 60f6d45fc4..18a2edc426 100644 --- a/ports/stm32/mpconfigport.h +++ b/ports/stm32/mpconfigport.h @@ -280,11 +280,16 @@ extern const struct _mod_network_nic_type_t mod_network_nic_type_cc3k; PYB_BUILTIN_MODULE \ STM_BUILTIN_MODULE \ +#ifndef MICROPY_BOARD_NETWORK_INTERFACES +#define MICROPY_BOARD_NETWORK_INTERFACES +#endif + #define MICROPY_PORT_NETWORK_INTERFACES \ MICROPY_HW_NIC_ETH \ MICROPY_HW_NIC_CYW43 \ MICROPY_HW_NIC_WIZNET5K \ MICROPY_HW_NIC_CC3K \ + MICROPY_BOARD_NETWORK_INTERFACES \ #define MP_STATE_PORT MP_STATE_VM From df86cef59ac3f92fcdc433e4679c8243a8c3159d Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Wed, 9 Mar 2022 23:28:52 +0200 Subject: [PATCH 0253/1712] rp2: Allow Overriding cmake frozen manifest from the command line. If MICROPY_FROZEN_MANIFEST is set from the cmake command line, then it will override the default and any manifest set by the board. --- ports/rp2/CMakeLists.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt index 0ceb039675..bf3a51be99 100644 --- a/ports/rp2/CMakeLists.txt +++ b/ports/rp2/CMakeLists.txt @@ -33,7 +33,9 @@ if(NOT EXISTS ${MICROPY_BOARD_DIR}/mpconfigboard.cmake) message(FATAL_ERROR "Invalid MICROPY_BOARD specified: ${MICROPY_BOARD}") endif() -# Include board config +set(MICROPY_USER_FROZEN_MANIFEST ${MICROPY_FROZEN_MANIFEST}) + +# Include board config, it may override MICROPY_FROZEN_MANIFEST include(${MICROPY_BOARD_DIR}/mpconfigboard.cmake) # Set the PICO_BOARD if it's not already set (allow a board to override it). @@ -216,9 +218,13 @@ if (MICROPY_PY_NETWORK_NINAW10) ) endif() -# Define mpy-cross flags and frozen manifest +# Define mpy-cross flags set(MICROPY_CROSS_FLAGS -march=armv7m) -if (NOT MICROPY_FROZEN_MANIFEST) + +# Set the frozen manifest file +if (MICROPY_USER_FROZEN_MANIFEST) + set(MICROPY_FROZEN_MANIFEST ${MICROPY_USER_FROZEN_MANIFEST}) +elseif (NOT MICROPY_FROZEN_MANIFEST) set(MICROPY_FROZEN_MANIFEST ${PROJECT_SOURCE_DIR}/boards/manifest.py) endif() From 73623d04d586d90a53836ba2e46cba271dc846c8 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 25 Mar 2022 11:38:19 +1100 Subject: [PATCH 0254/1712] github/workflows: Add new workflow to test embedding example. Signed-off-by: Damien George --- .github/workflows/examples.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/examples.yml diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml new file mode 100644 index 0000000000..53a817af2b --- /dev/null +++ b/.github/workflows/examples.yml @@ -0,0 +1,21 @@ +name: Check examples + +on: + push: + pull_request: + paths: + - '.github/workflows/*.yml' + - 'examples/**' + - 'ports/unix/**' + - 'py/**' + - 'shared/**' + +jobs: + embedding: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build + run: make -C examples/embedding + - name: Run + run: test "$(./examples/embedding/hello-embed)" = "Hello world of easy embedding!" From b083cdba2b59e7ad68a718cec9d015ab7aede4c8 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 25 Mar 2022 11:47:30 +1100 Subject: [PATCH 0255/1712] examples/embedding: Fix build with updated sys and os modules. Signed-off-by: Damien George --- examples/embedding/Makefile.upylib | 1 - examples/embedding/mpconfigport_minimal.h | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/embedding/Makefile.upylib b/examples/embedding/Makefile.upylib index 14260a719f..80f7eed159 100644 --- a/examples/embedding/Makefile.upylib +++ b/examples/embedding/Makefile.upylib @@ -137,7 +137,6 @@ SRC_C = $(addprefix ports/unix/,\ unix_mphal.c \ input.c \ modmachine.c \ - modos.c \ moduselect.c \ alloc.c \ coverage.c \ diff --git a/examples/embedding/mpconfigport_minimal.h b/examples/embedding/mpconfigport_minimal.h index 07180a3225..6cc84dcbc1 100644 --- a/examples/embedding/mpconfigport_minimal.h +++ b/examples/embedding/mpconfigport_minimal.h @@ -75,21 +75,18 @@ #define MICROPY_PY_SYS_EXIT (0) #define MICROPY_PY_SYS_PLATFORM "linux" #define MICROPY_PY_SYS_MAXSIZE (0) +#define MICROPY_PY_SYS_PATH_DEFAULT ".frozen" #define MICROPY_PY_SYS_STDFILES (0) #define MICROPY_PY_CMATH (0) #define MICROPY_PY_UCTYPES (0) #define MICROPY_PY_UZLIB (0) #define MICROPY_PY_UJSON (0) +#define MICROPY_PY_UOS (1) #define MICROPY_PY_URE (0) #define MICROPY_PY_UHEAPQ (0) #define MICROPY_PY_UHASHLIB (0) #define MICROPY_PY_UBINASCII (0) -extern const struct _mp_obj_module_t mp_module_os; - -#define MICROPY_PORT_BUILTIN_MODULES \ - { MP_ROM_QSTR(MP_QSTR_uos), MP_ROM_PTR(&mp_module_os) }, \ - #define MICROPY_PORT_ROOT_POINTERS \ ////////////////////////////////////////// From e7a92c0e699a7c95ea322e3105f587ae1a71bedf Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 23 Mar 2022 20:39:00 -0500 Subject: [PATCH 0256/1712] tests/cmdline/cmd_showbc: Fix spelling of sequence. --- tests/cmdline/cmd_showbc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cmdline/cmd_showbc.py b/tests/cmdline/cmd_showbc.py index a960c15c4a..e5874f990a 100644 --- a/tests/cmdline/cmd_showbc.py +++ b/tests/cmdline/cmd_showbc.py @@ -40,7 +40,7 @@ def f(): # slice a = b[::] - # sequenc unpacking + # sequence unpacking a, b = c a, *a = a From e7f6b9f4f76142ecd554106984a8520a0ada9d03 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 23 Mar 2022 14:18:23 -0500 Subject: [PATCH 0257/1712] tools/gen-cpydiff: Skip Black fmt comments. Since cpydiff is code used as documentation, there are cases where we may want to use Black's `fmt: on/off/skip` comments to avoid automatic formatting. However, we don't want these comments to be distracting in the generated documentation. This rewrites the code to omit these comments when generating the docs. Signed-off-by: David Lechner --- tools/gen-cpydiff.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/gen-cpydiff.py b/tools/gen-cpydiff.py index 1d458d3dcd..d4c8a5736d 100644 --- a/tools/gen-cpydiff.py +++ b/tools/gen-cpydiff.py @@ -85,6 +85,16 @@ def readfiles(): class_, desc, cause, workaround, code = [ x.rstrip() for x in list(filter(None, re.split(SPLIT, text))) ] + + # remove black `fmt: on/off/skip` comments + code = "".join( + # skip comments are inline, so we replace just the comment + re.sub(r"\s*# fmt: skip", "", x) + for x in code.splitlines(keepends=True) + # on/off comments are on their own line, so we omit the entire line + if not re.match(r"\s*# fmt: (on|off)\s*", x) + ) + output = Output(test, class_, desc, cause, workaround, code, "", "", "") files.append(output) except IndexError: From 768879f999f4739e8507ae6013b5e9271618656e Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 23 Mar 2022 14:29:52 -0500 Subject: [PATCH 0258/1712] py/smallint: Introduce MP_SMALL_INT_BITS macro. This adds a new MP_SMALL_INT_BITS macro that is a compile-time constant that contains the number of bits available in an MP_SMALL_INT. We can use this in place of the runtime function mp_small_int_bits(). Signed-off-by: David Lechner --- py/persistentcode.c | 19 ++----------------- py/smallint.h | 7 +++++++ 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/py/persistentcode.c b/py/persistentcode.c index 6110ae97f0..f64e383a61 100644 --- a/py/persistentcode.c +++ b/py/persistentcode.c @@ -48,21 +48,6 @@ #define MPY_FEATURE_ARCH_DYNAMIC MPY_FEATURE_ARCH #endif -#if MICROPY_PERSISTENT_CODE_LOAD || (MICROPY_PERSISTENT_CODE_SAVE && !MICROPY_DYNAMIC_COMPILER) -// The bytecode will depend on the number of bits in a small-int, and -// this function computes that (could make it a fixed constant, but it -// would need to be defined in mpconfigport.h). -STATIC int mp_small_int_bits(void) { - mp_int_t i = MP_SMALL_INT_MAX; - int n = 1; - while (i != 0) { - i >>= 1; - ++n; - } - return n; -} -#endif - typedef struct _bytecode_prelude_t { uint n_state; uint n_exc_stack; @@ -420,7 +405,7 @@ mp_compiled_module_t mp_raw_code_load(mp_reader_t *reader, mp_module_context_t * if (header[0] != 'M' || header[1] != MPY_VERSION || MPY_FEATURE_DECODE_FLAGS(header[2]) != MPY_FEATURE_FLAGS - || header[3] > mp_small_int_bits()) { + || header[3] > MP_SMALL_INT_BITS) { mp_raise_ValueError(MP_ERROR_TEXT("incompatible .mpy file")); } if (MPY_FEATURE_DECODE_ARCH(header[2]) != MP_NATIVE_ARCH_NONE) { @@ -609,7 +594,7 @@ void mp_raw_code_save(mp_compiled_module_t *cm, mp_print_t *print) { #if MICROPY_DYNAMIC_COMPILER mp_dynamic_compiler.small_int_bits, #else - mp_small_int_bits(), + MP_SMALL_INT_BITS, #endif }; if (cm->has_native) { diff --git a/py/smallint.h b/py/smallint.h index 67daf9b9fa..584e0018d1 100644 --- a/py/smallint.h +++ b/py/smallint.h @@ -61,6 +61,13 @@ #define MP_SMALL_INT_MAX ((mp_int_t)(~(MP_SMALL_INT_MIN))) +// https://stackoverflow.com/a/4589384/1976323 +// Number of bits in inttype_MAX, or in any (1< Date: Fri, 25 Mar 2022 12:35:49 +1100 Subject: [PATCH 0259/1712] py/objgenerator: Fix unused variables when native gen extracts prelude. Some compilers will warn about unused variables like scope_flags. So use MP_BC_PRELUDE_SIG_DECODE() which will silence these warnings. Signed-off-by: Damien George --- py/objgenerator.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/py/objgenerator.c b/py/objgenerator.c index cbe79e66a5..850de3fb68 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -103,13 +103,10 @@ STATIC mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_k // Extract n_state from the prelude. const uint8_t *ip = prelude_ptr; - size_t n_state, n_exc_stack_unused, scope_flags, n_pos_args, n_kwonly_args, n_def_args; - MP_BC_PRELUDE_SIG_DECODE_INTO(ip, n_state, n_exc_stack_unused, scope_flags, n_pos_args, n_kwonly_args, n_def_args); - size_t n_exc_stack = 0; + MP_BC_PRELUDE_SIG_DECODE(ip); - // Allocate the generator object, with room for local stack and exception stack - mp_obj_gen_instance_t *o = m_new_obj_var(mp_obj_gen_instance_t, byte, - n_state * sizeof(mp_obj_t) + n_exc_stack * sizeof(mp_exc_stack_t)); + // Allocate the generator object, with room for local stack (exception stack not needed). + mp_obj_gen_instance_t *o = m_new_obj_var(mp_obj_gen_instance_t, byte, n_state * sizeof(mp_obj_t)); o->base.type = &mp_type_gen_instance; // Parse the input arguments and set up the code state From 538c3c0a5540b4018cedd442b585666130fc8def Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 16 Mar 2022 09:37:58 +1100 Subject: [PATCH 0260/1712] py: Change jump opcodes to emit 1-byte jump offset when possible. This commit introduces changes: - All jump opcodes are changed to have variable length arguments, of either 1 or 2 bytes (previously they were fixed at 2 bytes). In most cases only 1 byte is needed to encode the short jump offset, saving bytecode size. - The bytecode emitter now selects 1 byte jump arguments when the jump offset is guaranteed to fit in 1 byte. This is achieved by checking if the code size changed during the last pass and, if it did (if it shrank), then requesting that the compiler make another pass to get the correct offsets of the now-smaller code. This can continue multiple times until the code stabilises. The code can only ever shrink so this iteration is guaranteed to complete. In most cases no extra passes are needed, the original 4 passes are enough to get it right by the 4th pass (because the 2nd pass computes roughly the correct labels and the 3rd pass computes the correct size for the jump argument). This change to the jump opcode encoding reduces .mpy files and RAM usage (when bytecode is in RAM) by about 2% on average. The performance of the VM is not impacted, at least within measurment of the performance benchmark suite. Code size is reduced for builds that include a decent amount of frozen bytecode. ARM Cortex-M builds without any frozen code increase by about 350 bytes. Signed-off-by: Damien George --- py/bc.c | 6 +- py/bc0.h | 34 +- py/compile.c | 12 +- py/emit.h | 6 +- py/emitbc.c | 141 ++++--- py/emitnative.c | 4 +- py/showbc.c | 24 +- py/vm.c | 26 +- tests/cmdline/cmd_parsetree.py.exp | 78 ++-- tests/cmdline/cmd_showbc.py.exp | 614 ++++++++++++++--------------- tests/run-tests.py | 1 + tests/stress/bytecode_limit.py | 26 ++ tests/stress/bytecode_limit.py.exp | 1 + tools/mpy-tool.py | 49 ++- 14 files changed, 584 insertions(+), 438 deletions(-) create mode 100644 tests/stress/bytecode_limit.py create mode 100644 tests/stress/bytecode_limit.py.exp diff --git a/py/bc.c b/py/bc.c index b98df39e28..2a21ffd4b7 100644 --- a/py/bc.c +++ b/py/bc.c @@ -335,7 +335,11 @@ uint mp_opcode_format(const byte *ip, size_t *opcode_size, bool count_var_uint) } } } else if (f == MP_BC_FORMAT_OFFSET) { - ip += 2; + if ((*ip & 0x80) == 0) { + ip += 1; + } else { + ip += 2; + } } ip += extra_byte; } diff --git a/py/bc0.h b/py/bc0.h index 842034ebfb..50c4954b08 100644 --- a/py/bc0.h +++ b/py/bc0.h @@ -28,6 +28,18 @@ // MicroPython bytecode opcodes, grouped based on the format of the opcode +// All opcodes are encoded as a byte with an optional argument. Arguments are +// variable-length encoded so they can be as small as possible. The possible +// encodings for arguments are (ip[0] is the opcode): +// +// - unsigned relative bytecode offset: +// - if ip[1] high bit is clear then: arg = ip[1] +// - if ip[1] high bit is set then: arg = ip[1] & 0x7f | ip[2] << 7 +// +// - signed relative bytecode offset: +// - if ip[1] high bit is clear then: arg = ip[1] - 0x40 +// - if ip[1] high bit is set then: arg = (ip[1] & 0x7f | ip[2] << 7) - 0x4000 + #define MP_BC_MASK_FORMAT (0xf0) #define MP_BC_MASK_EXTRA_BYTE (0x9e) @@ -101,17 +113,17 @@ #define MP_BC_ROT_TWO (MP_BC_BASE_BYTE_O + 0x0a) #define MP_BC_ROT_THREE (MP_BC_BASE_BYTE_O + 0x0b) -#define MP_BC_JUMP (MP_BC_BASE_JUMP_E + 0x02) // rel byte code offset, 16-bit signed, in excess -#define MP_BC_POP_JUMP_IF_TRUE (MP_BC_BASE_JUMP_E + 0x03) // rel byte code offset, 16-bit signed, in excess -#define MP_BC_POP_JUMP_IF_FALSE (MP_BC_BASE_JUMP_E + 0x04) // rel byte code offset, 16-bit signed, in excess -#define MP_BC_JUMP_IF_TRUE_OR_POP (MP_BC_BASE_JUMP_E + 0x05) // rel byte code offset, 16-bit signed, in excess -#define MP_BC_JUMP_IF_FALSE_OR_POP (MP_BC_BASE_JUMP_E + 0x06) // rel byte code offset, 16-bit signed, in excess -#define MP_BC_UNWIND_JUMP (MP_BC_BASE_JUMP_E + 0x00) // rel byte code offset, 16-bit signed, in excess; then a byte -#define MP_BC_SETUP_WITH (MP_BC_BASE_JUMP_E + 0x07) // rel byte code offset, 16-bit unsigned -#define MP_BC_SETUP_EXCEPT (MP_BC_BASE_JUMP_E + 0x08) // rel byte code offset, 16-bit unsigned -#define MP_BC_SETUP_FINALLY (MP_BC_BASE_JUMP_E + 0x09) // rel byte code offset, 16-bit unsigned -#define MP_BC_POP_EXCEPT_JUMP (MP_BC_BASE_JUMP_E + 0x0a) // rel byte code offset, 16-bit unsigned -#define MP_BC_FOR_ITER (MP_BC_BASE_JUMP_E + 0x0b) // rel byte code offset, 16-bit unsigned +#define MP_BC_UNWIND_JUMP (MP_BC_BASE_JUMP_E + 0x00) // signed relative bytecode offset; then a byte +#define MP_BC_JUMP (MP_BC_BASE_JUMP_E + 0x02) // signed relative bytecode offset +#define MP_BC_POP_JUMP_IF_TRUE (MP_BC_BASE_JUMP_E + 0x03) // signed relative bytecode offset +#define MP_BC_POP_JUMP_IF_FALSE (MP_BC_BASE_JUMP_E + 0x04) // signed relative bytecode offset +#define MP_BC_JUMP_IF_TRUE_OR_POP (MP_BC_BASE_JUMP_E + 0x05) // signed relative bytecode offset +#define MP_BC_JUMP_IF_FALSE_OR_POP (MP_BC_BASE_JUMP_E + 0x06) // signed relative bytecode offset +#define MP_BC_SETUP_WITH (MP_BC_BASE_JUMP_E + 0x07) // unsigned relative bytecode offset +#define MP_BC_SETUP_EXCEPT (MP_BC_BASE_JUMP_E + 0x08) // unsigned relative bytecode offset +#define MP_BC_SETUP_FINALLY (MP_BC_BASE_JUMP_E + 0x09) // unsigned relative bytecode offset +#define MP_BC_POP_EXCEPT_JUMP (MP_BC_BASE_JUMP_E + 0x0a) // unsigned relative bytecode offset +#define MP_BC_FOR_ITER (MP_BC_BASE_JUMP_E + 0x0b) // unsigned relative bytecode offset #define MP_BC_WITH_CLEANUP (MP_BC_BASE_BYTE_O + 0x0c) #define MP_BC_END_FINALLY (MP_BC_BASE_BYTE_O + 0x0d) #define MP_BC_GET_ITER (MP_BC_BASE_BYTE_O + 0x0e) diff --git a/py/compile.c b/py/compile.c index eb7389ec5f..d61dabb9a5 100644 --- a/py/compile.c +++ b/py/compile.c @@ -219,7 +219,7 @@ STATIC void mp_emit_common_start_pass(mp_emit_common_t *emit, pass_kind_t pass) } else if (pass > MP_PASS_STACK_SIZE) { emit->ct_cur_obj = emit->ct_cur_obj_base; } - if (pass == MP_PASS_EMIT) { + if (pass == MP_PASS_CODE_SIZE) { if (emit->ct_cur_child == 0) { emit->children = NULL; } else { @@ -3020,7 +3020,7 @@ STATIC void check_for_doc_string(compiler_t *comp, mp_parse_node_t pn) { #endif } -STATIC void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) { +STATIC bool compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) { comp->pass = pass; comp->scope_cur = scope; comp->next_label = 0; @@ -3187,10 +3187,12 @@ STATIC void compile_scope(compiler_t *comp, scope_t *scope, pass_kind_t pass) { EMIT(return_value); } - EMIT(end_pass); + bool pass_complete = EMIT(end_pass); // make sure we match all the exception levels assert(comp->cur_except_level == 0); + + return pass_complete; } #if MICROPY_EMIT_INLINE_ASM @@ -3600,8 +3602,10 @@ mp_compiled_module_t mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr so } // final pass: emit code + // the emitter can request multiple of these passes if (comp->compile_error == MP_OBJ_NULL) { - compile_scope(comp, s, MP_PASS_EMIT); + while (!compile_scope(comp, s, MP_PASS_EMIT)) { + } } } } diff --git a/py/emit.h b/py/emit.h index 6f3593a0e8..d4aea2e4db 100644 --- a/py/emit.h +++ b/py/emit.h @@ -43,7 +43,7 @@ typedef enum { MP_PASS_SCOPE = 1, // work out id's and their kind, and number of labels MP_PASS_STACK_SIZE = 2, // work out maximum stack size MP_PASS_CODE_SIZE = 3, // work out code size and label offsets - MP_PASS_EMIT = 4, // emit code + MP_PASS_EMIT = 4, // emit code (may be run multiple times if the emitter requests it) } pass_kind_t; #define MP_EMIT_STAR_FLAG_SINGLE (0x01) @@ -116,7 +116,7 @@ typedef struct _emit_method_table_t { #endif void (*start_pass)(emit_t *emit, pass_kind_t pass, scope_t *scope); - void (*end_pass)(emit_t *emit); + bool (*end_pass)(emit_t *emit); bool (*last_emit_was_return_value)(emit_t *emit); void (*adjust_stack_size)(emit_t *emit, mp_int_t delta); void (*set_source_line)(emit_t *emit, mp_uint_t line); @@ -233,7 +233,7 @@ void emit_native_xtensa_free(emit_t *emit); void emit_native_xtensawin_free(emit_t *emit); void mp_emit_bc_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope); -void mp_emit_bc_end_pass(emit_t *emit); +bool mp_emit_bc_end_pass(emit_t *emit); bool mp_emit_bc_last_emit_was_return_value(emit_t *emit); void mp_emit_bc_adjust_stack_size(emit_t *emit, mp_int_t delta); void mp_emit_bc_set_source_line(emit_t *emit, mp_uint_t line); diff --git a/py/emitbc.c b/py/emitbc.c index c04701ca78..14a72e2765 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "py/mpstate.h" @@ -55,8 +56,8 @@ struct _emit_t { mp_uint_t last_source_line_offset; mp_uint_t last_source_line; - mp_uint_t max_num_labels; - mp_uint_t *label_offsets; + size_t max_num_labels; + size_t *label_offsets; size_t code_info_offset; size_t code_info_size; @@ -76,11 +77,11 @@ emit_t *emit_bc_new(mp_emit_common_t *emit_common) { void emit_bc_set_max_num_labels(emit_t *emit, mp_uint_t max_num_labels) { emit->max_num_labels = max_num_labels; - emit->label_offsets = m_new(mp_uint_t, emit->max_num_labels); + emit->label_offsets = m_new(size_t, emit->max_num_labels); } void emit_bc_free(emit_t *emit) { - m_del(mp_uint_t, emit->label_offsets, emit->max_num_labels); + m_del(size_t, emit->label_offsets, emit->max_num_labels); m_del_obj(emit_t, emit); } @@ -213,34 +214,55 @@ STATIC void emit_write_bytecode_byte_child(emit_t *emit, int stack_adj, byte b, #endif } -// unsigned labels are relative to ip following this instruction, stored as 16 bits -STATIC void emit_write_bytecode_byte_unsigned_label(emit_t *emit, int stack_adj, byte b1, mp_uint_t label) { +// Emit a jump opcode to a destination label. +// The offset to the label is relative to the ip following this instruction. +// The offset is encoded as either 1 or 2 bytes, depending on how big it is. +// The encoding of this jump opcode can change size from one pass to the next, +// but it must only ever decrease in size on successive passes. +STATIC void emit_write_bytecode_byte_label(emit_t *emit, int stack_adj, byte b1, mp_uint_t label) { mp_emit_bc_adjust_stack_size(emit, stack_adj); - mp_uint_t bytecode_offset; - if (emit->pass < MP_PASS_EMIT) { - bytecode_offset = 0; - } else { - bytecode_offset = emit->label_offsets[label] - emit->bytecode_offset - 3; - } - byte *c = emit_get_cur_to_write_bytecode(emit, 3); - c[0] = b1; - c[1] = bytecode_offset; - c[2] = bytecode_offset >> 8; -} -// signed labels are relative to ip following this instruction, stored as 16 bits, in excess -STATIC void emit_write_bytecode_byte_signed_label(emit_t *emit, int stack_adj, byte b1, mp_uint_t label) { - mp_emit_bc_adjust_stack_size(emit, stack_adj); - int bytecode_offset; - if (emit->pass < MP_PASS_EMIT) { - bytecode_offset = 0; - } else { - bytecode_offset = emit->label_offsets[label] - emit->bytecode_offset - 3 + 0x8000; + // Determine if the jump offset is signed or unsigned, based on the opcode. + const bool is_signed = b1 <= MP_BC_JUMP_IF_FALSE_OR_POP; + + // Default to a 2-byte encoding (the largest) with an unknown jump offset. + unsigned int jump_encoding_size = 1; + ssize_t bytecode_offset = 0; + + // Compute the jump size and offset only when code size is known. + if (emit->pass >= MP_PASS_CODE_SIZE) { + // The -2 accounts for this jump opcode taking 2 bytes (at least). + bytecode_offset = emit->label_offsets[label] - emit->bytecode_offset - 2; + + // Check if the bytecode_offset is small enough to use a 1-byte encoding. + if ((is_signed && -64 <= bytecode_offset && bytecode_offset <= 63) + || (!is_signed && (size_t)bytecode_offset <= 127)) { + // Use a 1-byte jump offset. + jump_encoding_size = 0; + } + + // Adjust the offset depending on the size of the encoding of the offset. + bytecode_offset -= jump_encoding_size; + + assert(is_signed || bytecode_offset >= 0); } - byte *c = emit_get_cur_to_write_bytecode(emit, 3); + + // Emit the opcode. + byte *c = emit_get_cur_to_write_bytecode(emit, 2 + jump_encoding_size); c[0] = b1; - c[1] = bytecode_offset; - c[2] = bytecode_offset >> 8; + if (jump_encoding_size == 0) { + if (is_signed) { + bytecode_offset += 0x40; + } + assert(0 <= bytecode_offset && bytecode_offset <= 0x7f); + c[1] = bytecode_offset; + } else { + if (is_signed) { + bytecode_offset += 0x4000; + } + c[1] = 0x80 | (bytecode_offset & 0x7f); + c[2] = bytecode_offset >> 7; + } } void mp_emit_bc_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) { @@ -250,12 +272,6 @@ void mp_emit_bc_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) { emit->scope = scope; emit->last_source_line_offset = 0; emit->last_source_line = 1; - #ifndef NDEBUG - // With debugging enabled labels are checked for unique assignment - if (pass < MP_PASS_EMIT && emit->label_offsets != NULL) { - memset(emit->label_offsets, -1, emit->max_num_labels * sizeof(mp_uint_t)); - } - #endif emit->bytecode_offset = 0; emit->code_info_offset = 0; @@ -315,9 +331,9 @@ void mp_emit_bc_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) { } } -void mp_emit_bc_end_pass(emit_t *emit) { +bool mp_emit_bc_end_pass(emit_t *emit) { if (emit->pass == MP_PASS_SCOPE) { - return; + return true; } // check stack is back to zero size @@ -344,6 +360,20 @@ void mp_emit_bc_end_pass(emit_t *emit) { emit->code_base = m_new0(byte, emit->code_info_size + emit->bytecode_size); } else if (emit->pass == MP_PASS_EMIT) { + // Code info and/or bytecode can shrink during this pass. + assert(emit->code_info_offset <= emit->code_info_size); + assert(emit->bytecode_offset <= emit->bytecode_size); + + if (emit->code_info_offset != emit->code_info_size + || emit->bytecode_offset != emit->bytecode_size) { + // Code info and/or bytecode changed size in this pass, so request the + // compiler to do another pass with these updated sizes. + emit->code_info_size = emit->code_info_offset; + emit->bytecode_size = emit->bytecode_offset; + return false; + } + + // Bytecode is finalised, assign it to the raw code object. mp_emit_glue_assign_bytecode(emit->scope->raw_code, emit->code_base, #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS emit->code_info_size + emit->bytecode_size, @@ -354,6 +384,8 @@ void mp_emit_bc_end_pass(emit_t *emit) { #endif emit->scope->scope_flags); } + + return true; } bool mp_emit_bc_last_emit_was_return_value(emit_t *emit) { @@ -396,15 +428,16 @@ void mp_emit_bc_label_assign(emit_t *emit, mp_uint_t l) { if (emit->pass == MP_PASS_SCOPE) { return; } + + // Label offsets can change from one pass to the next, but they must only + // decrease (ie code can only shrink). There will be multiple MP_PASS_EMIT + // stages until the labels no longer change, which is when the code size + // stays constant after a MP_PASS_EMIT. assert(l < emit->max_num_labels); - if (emit->pass < MP_PASS_EMIT) { - // assign label offset - assert(emit->label_offsets[l] == (mp_uint_t)-1); - emit->label_offsets[l] = emit->bytecode_offset; - } else { - // ensure label offset has not changed from MP_PASS_CODE_SIZE to MP_PASS_EMIT - assert(emit->label_offsets[l] == emit->bytecode_offset); - } + assert(emit->pass == MP_PASS_STACK_SIZE || emit->bytecode_offset <= emit->label_offsets[l]); + + // Assign label offset. + emit->label_offsets[l] = emit->bytecode_offset; } void mp_emit_bc_import(emit_t *emit, qstr qst, int kind) { @@ -552,22 +585,22 @@ void mp_emit_bc_rot_three(emit_t *emit) { } void mp_emit_bc_jump(emit_t *emit, mp_uint_t label) { - emit_write_bytecode_byte_signed_label(emit, 0, MP_BC_JUMP, label); + emit_write_bytecode_byte_label(emit, 0, MP_BC_JUMP, label); } void mp_emit_bc_pop_jump_if(emit_t *emit, bool cond, mp_uint_t label) { if (cond) { - emit_write_bytecode_byte_signed_label(emit, -1, MP_BC_POP_JUMP_IF_TRUE, label); + emit_write_bytecode_byte_label(emit, -1, MP_BC_POP_JUMP_IF_TRUE, label); } else { - emit_write_bytecode_byte_signed_label(emit, -1, MP_BC_POP_JUMP_IF_FALSE, label); + emit_write_bytecode_byte_label(emit, -1, MP_BC_POP_JUMP_IF_FALSE, label); } } void mp_emit_bc_jump_if_or_pop(emit_t *emit, bool cond, mp_uint_t label) { if (cond) { - emit_write_bytecode_byte_signed_label(emit, -1, MP_BC_JUMP_IF_TRUE_OR_POP, label); + emit_write_bytecode_byte_label(emit, -1, MP_BC_JUMP_IF_TRUE_OR_POP, label); } else { - emit_write_bytecode_byte_signed_label(emit, -1, MP_BC_JUMP_IF_FALSE_OR_POP, label); + emit_write_bytecode_byte_label(emit, -1, MP_BC_JUMP_IF_FALSE_OR_POP, label); } } @@ -581,9 +614,9 @@ void mp_emit_bc_unwind_jump(emit_t *emit, mp_uint_t label, mp_uint_t except_dept emit_write_bytecode_raw_byte(emit, MP_BC_POP_TOP); } } - emit_write_bytecode_byte_signed_label(emit, 0, MP_BC_JUMP, label & ~MP_EMIT_BREAK_FROM_FOR); + emit_write_bytecode_byte_label(emit, 0, MP_BC_JUMP, label & ~MP_EMIT_BREAK_FROM_FOR); } else { - emit_write_bytecode_byte_signed_label(emit, 0, MP_BC_UNWIND_JUMP, label & ~MP_EMIT_BREAK_FROM_FOR); + emit_write_bytecode_byte_label(emit, 0, MP_BC_UNWIND_JUMP, label & ~MP_EMIT_BREAK_FROM_FOR); emit_write_bytecode_raw_byte(emit, ((label & MP_EMIT_BREAK_FROM_FOR) ? 0x80 : 0) | except_depth); } } @@ -595,7 +628,7 @@ void mp_emit_bc_setup_block(emit_t *emit, mp_uint_t label, int kind) { // The SETUP_WITH opcode pops ctx_mgr from the top of the stack // and then pushes 3 entries: __exit__, ctx_mgr, as_value. int stack_adj = kind == MP_EMIT_SETUP_BLOCK_WITH ? 2 : 0; - emit_write_bytecode_byte_unsigned_label(emit, stack_adj, MP_BC_SETUP_WITH + kind, label); + emit_write_bytecode_byte_label(emit, stack_adj, MP_BC_SETUP_WITH + kind, label); } void mp_emit_bc_with_cleanup(emit_t *emit, mp_uint_t label) { @@ -617,7 +650,7 @@ void mp_emit_bc_get_iter(emit_t *emit, bool use_stack) { } void mp_emit_bc_for_iter(emit_t *emit, mp_uint_t label) { - emit_write_bytecode_byte_unsigned_label(emit, 1, MP_BC_FOR_ITER, label); + emit_write_bytecode_byte_label(emit, 1, MP_BC_FOR_ITER, label); } void mp_emit_bc_for_iter_end(emit_t *emit) { @@ -626,7 +659,7 @@ void mp_emit_bc_for_iter_end(emit_t *emit) { void mp_emit_bc_pop_except_jump(emit_t *emit, mp_uint_t label, bool within_exc_handler) { (void)within_exc_handler; - emit_write_bytecode_byte_unsigned_label(emit, 0, MP_BC_POP_EXCEPT_JUMP, label); + emit_write_bytecode_byte_label(emit, 0, MP_BC_POP_EXCEPT_JUMP, label); } void mp_emit_bc_unary_op(emit_t *emit, mp_unary_op_t op) { diff --git a/py/emitnative.c b/py/emitnative.c index ca34e89f64..bddd661428 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -652,7 +652,7 @@ static inline void emit_native_write_code_info_qstr(emit_t *emit, qstr qst) { mp_encode_uint(&emit->as->base, mp_asm_base_get_cur_to_write_bytes, mp_emit_common_use_qstr(emit->emit_common, qst)); } -STATIC void emit_native_end_pass(emit_t *emit) { +STATIC bool emit_native_end_pass(emit_t *emit) { emit_native_global_exc_exit(emit); if (!emit->do_viper_types) { @@ -736,6 +736,8 @@ STATIC void emit_native_end_pass(emit_t *emit) { #endif emit->scope->scope_flags, 0, 0); } + + return true; } STATIC bool emit_native_last_emit_was_return_value(emit_t *emit) { diff --git a/py/showbc.c b/py/showbc.c index 8430739d8e..178fa451a2 100644 --- a/py/showbc.c +++ b/py/showbc.c @@ -38,8 +38,28 @@ unum = (unum << 7) + (*ip & 0x7f); \ } while ((*ip++ & 0x80) != 0); \ } -#define DECODE_ULABEL do { unum = (ip[0] | (ip[1] << 8)); ip += 2; } while (0) -#define DECODE_SLABEL do { unum = (ip[0] | (ip[1] << 8)) - 0x8000; ip += 2; } while (0) + +#define DECODE_ULABEL \ + do { \ + if (ip[0] & 0x80) { \ + unum = ((ip[0] & 0x7f) | (ip[1] << 7)); \ + ip += 2; \ + } else { \ + unum = ip[0]; \ + ip += 1; \ + } \ + } while (0) + +#define DECODE_SLABEL \ + do { \ + if (ip[0] & 0x80) { \ + unum = ((ip[0] & 0x7f) | (ip[1] << 7)) - 0x4000; \ + ip += 2; \ + } else { \ + unum = ip[0] - 0x40; \ + ip += 1; \ + } \ + } while (0) #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE diff --git a/py/vm.c b/py/vm.c index 497a569622..990009c00c 100644 --- a/py/vm.c +++ b/py/vm.c @@ -61,8 +61,30 @@ do { \ unum = (unum << 7) + (*ip & 0x7f); \ } while ((*ip++ & 0x80) != 0) -#define DECODE_ULABEL size_t ulab = (ip[0] | (ip[1] << 8)); ip += 2 -#define DECODE_SLABEL size_t slab = (ip[0] | (ip[1] << 8)) - 0x8000; ip += 2 + +#define DECODE_ULABEL \ + size_t ulab; \ + do { \ + if (ip[0] & 0x80) { \ + ulab = ((ip[0] & 0x7f) | (ip[1] << 7)); \ + ip += 2; \ + } else { \ + ulab = ip[0]; \ + ip += 1; \ + } \ + } while (0) + +#define DECODE_SLABEL \ + size_t slab; \ + do { \ + if (ip[0] & 0x80) { \ + slab = ((ip[0] & 0x7f) | (ip[1] << 7)) - 0x4000; \ + ip += 2; \ + } else { \ + slab = ip[0] - 0x40; \ + ip += 1; \ + } \ + } while (0) #if MICROPY_EMIT_BYTECODE_USES_QSTR_TABLE diff --git a/tests/cmdline/cmd_parsetree.py.exp b/tests/cmdline/cmd_parsetree.py.exp index 53d62a5dbd..6ee96b7caf 100644 --- a/tests/cmdline/cmd_parsetree.py.exp +++ b/tests/cmdline/cmd_parsetree.py.exp @@ -39,52 +39,52 @@ [ 13] \(rule\|arglist\)(164) (n=1) id(b) ---------------- -File cmdline/cmd_parsetree.py, code block '' (descriptor: \.\+, bytecode @\.\+ 64 bytes) -Raw bytecode (code_info_size=13, bytecode_size=51): - 20 16 01 60 28 23 23 24 24 24 24 24 25 2a 00 5f - 4b 05 00 16 02 42 f8 7f 51 16 03 10 04 16 05 23 - 00 16 06 23 01 16 07 23 02 16 08 23 03 16 09 22 - 80 7b 16 0a 23 04 14 0b 11 05 36 01 16 0c 51 63 +File cmdline/cmd_parsetree.py, code block '' (descriptor: \.\+, bytecode @\.\+ 62 bytes) +Raw bytecode (code_info_size=13, bytecode_size=49): + 20 16 01 60 27 22 23 24 24 24 24 24 25 2a 00 5f + 4b 04 16 02 42 3a 51 16 03 10 04 16 05 23 00 16 + 06 23 01 16 07 23 02 16 08 23 03 16 09 22 80 7b + 16 0a 23 04 14 0b 11 05 36 01 16 0c 51 63 arg names: (N_STATE 5) (N_EXC_STACK 0) bc=0 line=1 bc=0 line=4 - bc=8 line=5 - bc=11 line=6 - bc=14 line=7 - bc=18 line=8 - bc=22 line=9 - bc=26 line=10 - bc=30 line=11 - bc=34 line=12 - bc=39 line=13 + bc=7 line=5 + bc=9 line=6 + bc=12 line=7 + bc=16 line=8 + bc=20 line=9 + bc=24 line=10 + bc=28 line=11 + bc=32 line=12 + bc=37 line=13 00 BUILD_TUPLE 0 02 GET_ITER_STACK -03 FOR_ITER 11 -06 STORE_NAME i -08 JUMP 3 -11 LOAD_CONST_NONE -12 STORE_NAME a -14 LOAD_CONST_STRING 'str' -16 STORE_NAME b -18 LOAD_CONST_OBJ \.\+='a very long str that will not be interned' -20 STORE_NAME c -22 LOAD_CONST_OBJ \.\+=b'bytes' -24 STORE_NAME d -26 LOAD_CONST_OBJ \.\+=b'a very long bytes that will not be interned' -28 STORE_NAME e -30 LOAD_CONST_OBJ \.\+=123456789012345678901234567890 -32 STORE_NAME f -34 LOAD_CONST_SMALL_INT 123 -37 STORE_NAME g -39 LOAD_CONST_OBJ \.\+="fstring: '{}'" -41 LOAD_METHOD format -43 LOAD_NAME b -45 CALL_METHOD n=1 nkw=0 -47 STORE_NAME h -49 LOAD_CONST_NONE -50 RETURN_VALUE +03 FOR_ITER 9 +05 STORE_NAME i +07 JUMP 3 +09 LOAD_CONST_NONE +10 STORE_NAME a +12 LOAD_CONST_STRING 'str' +14 STORE_NAME b +16 LOAD_CONST_OBJ \.\+='a very long str that will not be interned' +18 STORE_NAME c +20 LOAD_CONST_OBJ \.\+=b'bytes' +22 STORE_NAME d +24 LOAD_CONST_OBJ \.\+=b'a very long bytes that will not be interned' +26 STORE_NAME e +28 LOAD_CONST_OBJ \.\+=123456789012345678901234567890 +30 STORE_NAME f +32 LOAD_CONST_SMALL_INT 123 +35 STORE_NAME g +37 LOAD_CONST_OBJ \.\+="fstring: '{}'" +39 LOAD_METHOD format +41 LOAD_NAME b +43 CALL_METHOD n=1 nkw=0 +45 STORE_NAME h +47 LOAD_CONST_NONE +48 RETURN_VALUE mem: total=\\d\+, current=\\d\+, peak=\\d\+ stack: \\d\+ out of \\d\+ GC: total: \\d\+, used: \\d\+, free: \\d\+ diff --git a/tests/cmdline/cmd_showbc.py.exp b/tests/cmdline/cmd_showbc.py.exp index 031820fcd9..92501e1248 100644 --- a/tests/cmdline/cmd_showbc.py.exp +++ b/tests/cmdline/cmd_showbc.py.exp @@ -47,10 +47,10 @@ arg names: 42 IMPORT_STAR 43 LOAD_CONST_NONE 44 RETURN_VALUE -File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ 48\[24\] bytes) -Raw bytecode (code_info_size=8\[46\], bytecode_size=398): +File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ 45\[68\] bytes) +Raw bytecode (code_info_size=8\[46\], bytecode_size=372): a8 12 9\[bf\] 03 02 60 60 26 22 24 64 22 26 25 25 24 - 26 23 63 22 22 25 23 23 31 6d 25 65 25 25 69 68 + 26 23 63 22 22 25 23 23 2f 6c 25 65 25 25 69 68 26 65 27 6a 62 20 23 62 2a 29 69 24 25 28 67 26 ######## \.\+81 63 @@ -80,65 +80,65 @@ arg names: bc=59 line=26 bc=62 line=27 bc=65 line=28 - bc=82 line=29 - bc=95 line=32 - bc=100 line=33 - bc=105 line=36 - bc=110 line=37 - bc=115 line=38 - bc=124 line=41 - bc=132 line=44 - bc=138 line=45 - bc=143 line=48 - bc=150 line=49 - bc=160 line=52 - bc=162 line=55 - bc=162 line=56 - bc=165 line=57 - bc=167 line=60 - bc=177 line=61 - bc=186 line=62 - bc=195 line=65 - bc=199 line=66 - bc=204 line=67 - bc=212 line=68 - bc=219 line=71 - bc=225 line=72 - bc=232 line=73 - bc=242 line=74 - bc=250 line=77 - bc=254 line=78 - bc=260 line=80 - bc=263 line=81 - bc=266 line=82 - bc=273 line=83 - bc=276 line=84 - bc=283 line=85 - bc=289 line=88 - bc=296 line=89 - bc=301 line=92 - bc=307 line=93 - bc=310 line=94 + bc=80 line=29 + bc=92 line=32 + bc=97 line=33 + bc=102 line=36 + bc=107 line=37 + bc=112 line=38 + bc=121 line=41 + bc=129 line=44 + bc=135 line=45 + bc=140 line=48 + bc=147 line=49 + bc=157 line=52 + bc=159 line=55 + bc=159 line=56 + bc=162 line=57 + bc=164 line=60 + bc=174 line=61 + bc=183 line=62 + bc=192 line=65 + bc=196 line=66 + bc=201 line=67 + bc=209 line=68 + bc=216 line=71 + bc=222 line=72 + bc=229 line=73 + bc=239 line=74 + bc=247 line=77 + bc=250 line=78 + bc=255 line=80 + bc=258 line=81 + bc=260 line=82 + bc=266 line=83 + bc=268 line=84 + bc=274 line=85 + bc=279 line=88 + bc=285 line=89 + bc=289 line=92 + bc=293 line=93 + bc=295 line=94 ######## - bc=321 line=96 - bc=329 line=98 - bc=332 line=99 - bc=335 line=100 - bc=338 line=101 + bc=303 line=96 + bc=310 line=98 + bc=313 line=99 + bc=315 line=100 + bc=317 line=101 ######## - bc=346 line=103 - bc=354 line=106 - bc=359 line=107 - bc=365 line=110 - bc=368 line=111 - bc=374 line=114 - bc=374 line=117 - bc=379 line=118 - bc=391 line=121 - bc=391 line=122 - bc=392 line=123 - bc=394 line=126 - bc=396 line=127 + bc=323 line=103 + bc=329 line=106 + bc=333 line=107 + bc=339 line=110 + bc=342 line=111 + bc=348 line=114 + bc=348 line=117 + bc=353 line=118 + bc=365 line=121 + bc=365 line=122 + bc=366 line=123 + bc=368 line=126 + bc=370 line=127 00 LOAD_CONST_NONE 01 LOAD_CONST_FALSE 02 BINARY_OP 27 __add__ @@ -195,216 +195,216 @@ arg names: 68 DUP_TOP 69 ROT_THREE 70 BINARY_OP 2 __eq__ -71 JUMP_IF_FALSE_OR_POP 79 -74 LOAD_FAST 1 -75 BINARY_OP 2 __eq__ -76 JUMP 81 -79 ROT_TWO -80 POP_TOP -81 STORE_FAST 10 -82 LOAD_FAST 0 -83 LOAD_DEREF 14 -85 BINARY_OP 2 __eq__ -86 JUMP_IF_FALSE_OR_POP 93 -89 LOAD_DEREF 14 -91 LOAD_FAST 1 -92 BINARY_OP 2 __eq__ -93 UNARY_OP 3 -94 STORE_FAST 10 -95 LOAD_DEREF 14 -97 LOAD_ATTR c -99 STORE_FAST 11 -100 LOAD_FAST 11 -101 LOAD_DEREF 14 -103 STORE_ATTR c -105 LOAD_DEREF 14 -107 LOAD_CONST_SMALL_INT 0 -108 LOAD_SUBSCR -109 STORE_FAST 12 -110 LOAD_FAST 12 -111 LOAD_DEREF 14 -113 LOAD_CONST_SMALL_INT 0 -114 STORE_SUBSCR -115 LOAD_DEREF 14 -117 LOAD_CONST_SMALL_INT 0 -118 DUP_TOP_TWO -119 LOAD_SUBSCR -120 LOAD_FAST 12 -121 BINARY_OP 14 __iadd__ -122 ROT_THREE -123 STORE_SUBSCR -124 LOAD_DEREF 14 -126 LOAD_CONST_NONE -127 LOAD_CONST_NONE -128 BUILD_SLICE 2 -130 LOAD_SUBSCR -131 STORE_FAST 0 -132 LOAD_FAST 1 -133 UNPACK_SEQUENCE 2 -135 STORE_FAST 0 -136 STORE_DEREF 14 -138 LOAD_FAST 0 -139 UNPACK_EX 1 -141 STORE_FAST 0 -142 STORE_FAST 0 -143 LOAD_DEREF 14 -145 LOAD_FAST 0 -146 ROT_TWO -147 STORE_FAST 0 -148 STORE_DEREF 14 -150 LOAD_FAST 1 -151 LOAD_DEREF 14 -153 LOAD_FAST 0 -154 ROT_THREE -155 ROT_TWO -156 STORE_FAST 0 -157 STORE_DEREF 14 -159 STORE_FAST 1 -160 DELETE_FAST 0 -162 LOAD_FAST 0 -163 STORE_GLOBAL gl -165 DELETE_GLOBAL gl -167 LOAD_FAST 14 -168 LOAD_FAST 15 -169 MAKE_CLOSURE \.\+ 2 -172 LOAD_FAST 2 -173 GET_ITER -174 CALL_FUNCTION n=1 nkw=0 -176 STORE_FAST 0 -177 LOAD_FAST 14 -178 LOAD_FAST 15 -179 MAKE_CLOSURE \.\+ 2 -182 LOAD_FAST 2 -183 CALL_FUNCTION n=1 nkw=0 -185 STORE_FAST 0 -186 LOAD_FAST 14 -187 LOAD_FAST 15 -188 MAKE_CLOSURE \.\+ 2 -191 LOAD_FAST 2 -192 CALL_FUNCTION n=1 nkw=0 -194 STORE_FAST 0 -195 LOAD_FAST 0 -196 CALL_FUNCTION n=0 nkw=0 -198 POP_TOP -199 LOAD_FAST 0 -200 LOAD_CONST_SMALL_INT 1 -201 CALL_FUNCTION n=1 nkw=0 -203 POP_TOP -204 LOAD_FAST 0 -205 LOAD_CONST_STRING 'b' -207 LOAD_CONST_SMALL_INT 1 -208 CALL_FUNCTION n=0 nkw=1 -211 POP_TOP -212 LOAD_FAST 0 -213 LOAD_DEREF 14 -215 LOAD_NULL -216 CALL_FUNCTION_VAR_KW n=0 nkw=0 -218 POP_TOP -219 LOAD_FAST 0 -220 LOAD_METHOD b -222 CALL_METHOD n=0 nkw=0 -224 POP_TOP -225 LOAD_FAST 0 -226 LOAD_METHOD b -228 LOAD_CONST_SMALL_INT 1 -229 CALL_METHOD n=1 nkw=0 -231 POP_TOP -232 LOAD_FAST 0 -233 LOAD_METHOD b -235 LOAD_CONST_STRING 'c' -237 LOAD_CONST_SMALL_INT 1 -238 CALL_METHOD n=0 nkw=1 -241 POP_TOP -242 LOAD_FAST 0 -243 LOAD_METHOD b -245 LOAD_FAST 1 -246 LOAD_NULL -247 CALL_METHOD_VAR_KW n=0 nkw=0 -249 POP_TOP -250 LOAD_FAST 0 -251 POP_JUMP_IF_FALSE 260 -254 LOAD_DEREF 16 -256 POP_TOP -257 JUMP 263 -260 LOAD_GLOBAL y +71 JUMP_IF_FALSE_OR_POP 77 +73 LOAD_FAST 1 +74 BINARY_OP 2 __eq__ +75 JUMP 79 +77 ROT_TWO +78 POP_TOP +79 STORE_FAST 10 +80 LOAD_FAST 0 +81 LOAD_DEREF 14 +83 BINARY_OP 2 __eq__ +84 JUMP_IF_FALSE_OR_POP 90 +86 LOAD_DEREF 14 +88 LOAD_FAST 1 +89 BINARY_OP 2 __eq__ +90 UNARY_OP 3 +91 STORE_FAST 10 +92 LOAD_DEREF 14 +94 LOAD_ATTR c +96 STORE_FAST 11 +97 LOAD_FAST 11 +98 LOAD_DEREF 14 +100 STORE_ATTR c +102 LOAD_DEREF 14 +104 LOAD_CONST_SMALL_INT 0 +105 LOAD_SUBSCR +106 STORE_FAST 12 +107 LOAD_FAST 12 +108 LOAD_DEREF 14 +110 LOAD_CONST_SMALL_INT 0 +111 STORE_SUBSCR +112 LOAD_DEREF 14 +114 LOAD_CONST_SMALL_INT 0 +115 DUP_TOP_TWO +116 LOAD_SUBSCR +117 LOAD_FAST 12 +118 BINARY_OP 14 __iadd__ +119 ROT_THREE +120 STORE_SUBSCR +121 LOAD_DEREF 14 +123 LOAD_CONST_NONE +124 LOAD_CONST_NONE +125 BUILD_SLICE 2 +127 LOAD_SUBSCR +128 STORE_FAST 0 +129 LOAD_FAST 1 +130 UNPACK_SEQUENCE 2 +132 STORE_FAST 0 +133 STORE_DEREF 14 +135 LOAD_FAST 0 +136 UNPACK_EX 1 +138 STORE_FAST 0 +139 STORE_FAST 0 +140 LOAD_DEREF 14 +142 LOAD_FAST 0 +143 ROT_TWO +144 STORE_FAST 0 +145 STORE_DEREF 14 +147 LOAD_FAST 1 +148 LOAD_DEREF 14 +150 LOAD_FAST 0 +151 ROT_THREE +152 ROT_TWO +153 STORE_FAST 0 +154 STORE_DEREF 14 +156 STORE_FAST 1 +157 DELETE_FAST 0 +159 LOAD_FAST 0 +160 STORE_GLOBAL gl +162 DELETE_GLOBAL gl +164 LOAD_FAST 14 +165 LOAD_FAST 15 +166 MAKE_CLOSURE \.\+ 2 +169 LOAD_FAST 2 +170 GET_ITER +171 CALL_FUNCTION n=1 nkw=0 +173 STORE_FAST 0 +174 LOAD_FAST 14 +175 LOAD_FAST 15 +176 MAKE_CLOSURE \.\+ 2 +179 LOAD_FAST 2 +180 CALL_FUNCTION n=1 nkw=0 +182 STORE_FAST 0 +183 LOAD_FAST 14 +184 LOAD_FAST 15 +185 MAKE_CLOSURE \.\+ 2 +188 LOAD_FAST 2 +189 CALL_FUNCTION n=1 nkw=0 +191 STORE_FAST 0 +192 LOAD_FAST 0 +193 CALL_FUNCTION n=0 nkw=0 +195 POP_TOP +196 LOAD_FAST 0 +197 LOAD_CONST_SMALL_INT 1 +198 CALL_FUNCTION n=1 nkw=0 +200 POP_TOP +201 LOAD_FAST 0 +202 LOAD_CONST_STRING 'b' +204 LOAD_CONST_SMALL_INT 1 +205 CALL_FUNCTION n=0 nkw=1 +208 POP_TOP +209 LOAD_FAST 0 +210 LOAD_DEREF 14 +212 LOAD_NULL +213 CALL_FUNCTION_VAR_KW n=0 nkw=0 +215 POP_TOP +216 LOAD_FAST 0 +217 LOAD_METHOD b +219 CALL_METHOD n=0 nkw=0 +221 POP_TOP +222 LOAD_FAST 0 +223 LOAD_METHOD b +225 LOAD_CONST_SMALL_INT 1 +226 CALL_METHOD n=1 nkw=0 +228 POP_TOP +229 LOAD_FAST 0 +230 LOAD_METHOD b +232 LOAD_CONST_STRING 'c' +234 LOAD_CONST_SMALL_INT 1 +235 CALL_METHOD n=0 nkw=1 +238 POP_TOP +239 LOAD_FAST 0 +240 LOAD_METHOD b +242 LOAD_FAST 1 +243 LOAD_NULL +244 CALL_METHOD_VAR_KW n=0 nkw=0 +246 POP_TOP +247 LOAD_FAST 0 +248 POP_JUMP_IF_FALSE 255 +250 LOAD_DEREF 16 +252 POP_TOP +253 JUMP 258 +255 LOAD_GLOBAL y +257 POP_TOP +258 JUMP 263 +260 LOAD_DEREF 14 262 POP_TOP -263 JUMP 269 -266 LOAD_DEREF 14 -268 POP_TOP -269 LOAD_FAST 0 -270 POP_JUMP_IF_TRUE 266 -273 JUMP 279 -276 LOAD_DEREF 14 -278 POP_TOP -279 LOAD_FAST 0 -280 POP_JUMP_IF_FALSE 276 -283 LOAD_FAST 0 -284 JUMP_IF_TRUE_OR_POP 288 -287 LOAD_FAST 0 -288 STORE_FAST 0 -289 LOAD_DEREF 14 -291 GET_ITER_STACK -292 FOR_ITER 301 -295 STORE_FAST 0 -296 LOAD_FAST 1 -297 POP_TOP -298 JUMP 292 -301 SETUP_FINALLY 329 -304 SETUP_EXCEPT 320 -307 JUMP 313 -310 JUMP 317 -313 LOAD_FAST 0 -314 POP_JUMP_IF_TRUE 310 -317 POP_EXCEPT_JUMP 328 -320 POP_TOP -321 LOAD_DEREF 14 -323 POP_TOP -324 POP_EXCEPT_JUMP 328 -327 END_FINALLY -328 LOAD_CONST_NONE -329 LOAD_FAST 1 -330 POP_TOP -331 END_FINALLY -332 JUMP 350 -335 SETUP_EXCEPT 345 -338 UNWIND_JUMP 354 1 -342 POP_EXCEPT_JUMP 350 -345 POP_TOP -346 POP_EXCEPT_JUMP 350 -349 END_FINALLY -350 LOAD_FAST 0 -351 POP_JUMP_IF_TRUE 335 -354 LOAD_FAST 0 -355 SETUP_WITH 363 -358 POP_TOP -359 LOAD_DEREF 14 -361 POP_TOP -362 LOAD_CONST_NONE -363 WITH_CLEANUP -364 END_FINALLY -365 LOAD_CONST_SMALL_INT 1 -366 STORE_DEREF 16 -368 LOAD_FAST_N 16 -370 MAKE_CLOSURE \.\+ 1 -373 STORE_FAST 13 -374 LOAD_CONST_SMALL_INT 0 -375 LOAD_CONST_NONE -376 IMPORT_NAME 'a' -378 STORE_FAST 0 -379 LOAD_CONST_SMALL_INT 0 -380 LOAD_CONST_STRING 'b' -382 BUILD_TUPLE 1 -384 IMPORT_NAME 'a' -386 IMPORT_FROM 'b' -388 STORE_DEREF 14 -390 POP_TOP -391 RAISE_LAST -392 LOAD_CONST_SMALL_INT 1 -393 RAISE_OBJ -394 LOAD_CONST_NONE -395 RETURN_VALUE -396 LOAD_CONST_SMALL_INT 1 -397 RETURN_VALUE +263 LOAD_FAST 0 +264 POP_JUMP_IF_TRUE 260 +266 JUMP 271 +268 LOAD_DEREF 14 +270 POP_TOP +271 LOAD_FAST 0 +272 POP_JUMP_IF_FALSE 268 +274 LOAD_FAST 0 +275 JUMP_IF_TRUE_OR_POP 278 +277 LOAD_FAST 0 +278 STORE_FAST 0 +279 LOAD_DEREF 14 +281 GET_ITER_STACK +282 FOR_ITER 289 +284 STORE_FAST 0 +285 LOAD_FAST 1 +286 POP_TOP +287 JUMP 282 +289 SETUP_FINALLY 310 +291 SETUP_EXCEPT 302 +293 JUMP 297 +295 JUMP 300 +297 LOAD_FAST 0 +298 POP_JUMP_IF_TRUE 295 +300 POP_EXCEPT_JUMP 309 +302 POP_TOP +303 LOAD_DEREF 14 +305 POP_TOP +306 POP_EXCEPT_JUMP 309 +308 END_FINALLY +309 LOAD_CONST_NONE +310 LOAD_FAST 1 +311 POP_TOP +312 END_FINALLY +313 JUMP 326 +315 SETUP_EXCEPT 322 +317 UNWIND_JUMP 329 1 +320 POP_EXCEPT_JUMP 326 +322 POP_TOP +323 POP_EXCEPT_JUMP 326 +325 END_FINALLY +326 LOAD_FAST 0 +327 POP_JUMP_IF_TRUE 315 +329 LOAD_FAST 0 +330 SETUP_WITH 337 +332 POP_TOP +333 LOAD_DEREF 14 +335 POP_TOP +336 LOAD_CONST_NONE +337 WITH_CLEANUP +338 END_FINALLY +339 LOAD_CONST_SMALL_INT 1 +340 STORE_DEREF 16 +342 LOAD_FAST_N 16 +344 MAKE_CLOSURE \.\+ 1 +347 STORE_FAST 13 +348 LOAD_CONST_SMALL_INT 0 +349 LOAD_CONST_NONE +350 IMPORT_NAME 'a' +352 STORE_FAST 0 +353 LOAD_CONST_SMALL_INT 0 +354 LOAD_CONST_STRING 'b' +356 BUILD_TUPLE 1 +358 IMPORT_NAME 'a' +360 IMPORT_FROM 'b' +362 STORE_DEREF 14 +364 POP_TOP +365 RAISE_LAST +366 LOAD_CONST_SMALL_INT 1 +367 RAISE_OBJ +368 LOAD_CONST_NONE +369 RETURN_VALUE +370 LOAD_CONST_SMALL_INT 1 +371 RETURN_VALUE File cmdline/cmd_showbc.py, code block 'f' (descriptor: \.\+, bytecode @\.\+ 59 bytes) Raw bytecode (code_info_size=8, bytecode_size=51): a8 10 0a 02 80 82 34 38 81 57 c0 57 c1 57 c2 57 @@ -539,10 +539,10 @@ arg names: self 09 POP_TOP 10 LOAD_CONST_NONE 11 RETURN_VALUE -File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ 31 bytes) -Raw bytecode (code_info_size=9, bytecode_size=22): - c3 40 0c 12 04 04 04 80 3b 53 b2 53 53 4b 0d 00 - c3 25 01 44 f7 7f 25 00 67 59 42 f0 7f 51 63 +File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ 28 bytes) +Raw bytecode (code_info_size=9, bytecode_size=19): + c3 40 0c 12 04 04 04 80 3b 53 b2 53 53 4b 0b c3 + 25 01 44 39 25 00 67 59 42 33 51 63 arg names: * * * (N_STATE 9) (N_EXC_STACK 0) @@ -552,20 +552,20 @@ arg names: * * * 01 LOAD_FAST 2 02 LOAD_NULL 03 LOAD_NULL -04 FOR_ITER 20 -07 STORE_FAST 3 -08 LOAD_DEREF 1 -10 POP_JUMP_IF_FALSE 4 -13 LOAD_DEREF 0 -15 YIELD_VALUE -16 POP_TOP -17 JUMP 4 -20 LOAD_CONST_NONE -21 RETURN_VALUE -File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ 29 bytes) -Raw bytecode (code_info_size=8, bytecode_size=21): - 4b 0c 14 04 04 04 80 3c 2b 00 b2 5f 4b 0d 00 c3 - 25 01 44 f7 7f 25 00 2f 14 42 f0 7f 63 +04 FOR_ITER 17 +06 STORE_FAST 3 +07 LOAD_DEREF 1 +09 POP_JUMP_IF_FALSE 4 +11 LOAD_DEREF 0 +13 YIELD_VALUE +14 POP_TOP +15 JUMP 4 +17 LOAD_CONST_NONE +18 RETURN_VALUE +File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ 26 bytes) +Raw bytecode (code_info_size=8, bytecode_size=18): + 4b 0c 14 04 04 04 80 3c 2b 00 b2 5f 4b 0b c3 25 + 01 44 39 25 00 2f 14 42 33 63 arg names: * * * (N_STATE 10) (N_EXC_STACK 0) @@ -574,18 +574,18 @@ arg names: * * * 00 BUILD_LIST 0 02 LOAD_FAST 2 03 GET_ITER_STACK -04 FOR_ITER 20 -07 STORE_FAST 3 -08 LOAD_DEREF 1 -10 POP_JUMP_IF_FALSE 4 -13 LOAD_DEREF 0 -15 STORE_COMP 20 -17 JUMP 4 -20 RETURN_VALUE -File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ 31 bytes) -Raw bytecode (code_info_size=8, bytecode_size=23): - 53 0c 15 04 04 04 80 3d 2c 00 b2 5f 4b 0f 00 c3 - 25 01 44 f7 7f 25 00 25 00 2f 19 42 ee 7f 63 +04 FOR_ITER 17 +06 STORE_FAST 3 +07 LOAD_DEREF 1 +09 POP_JUMP_IF_FALSE 4 +11 LOAD_DEREF 0 +13 STORE_COMP 20 +15 JUMP 4 +17 RETURN_VALUE +File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ 28 bytes) +Raw bytecode (code_info_size=8, bytecode_size=20): + 53 0c 15 04 04 04 80 3d 2c 00 b2 5f 4b 0d c3 25 + 01 44 39 25 00 25 00 2f 19 42 31 63 arg names: * * * (N_STATE 11) (N_EXC_STACK 0) @@ -594,15 +594,15 @@ arg names: * * * 00 BUILD_MAP 0 02 LOAD_FAST 2 03 GET_ITER_STACK -04 FOR_ITER 22 -07 STORE_FAST 3 -08 LOAD_DEREF 1 -10 POP_JUMP_IF_FALSE 4 +04 FOR_ITER 19 +06 STORE_FAST 3 +07 LOAD_DEREF 1 +09 POP_JUMP_IF_FALSE 4 +11 LOAD_DEREF 0 13 LOAD_DEREF 0 -15 LOAD_DEREF 0 -17 STORE_COMP 25 -19 JUMP 4 -22 RETURN_VALUE +15 STORE_COMP 25 +17 JUMP 4 +19 RETURN_VALUE File cmdline/cmd_showbc.py, code block 'closure' (descriptor: \.\+, bytecode @\.\+ 20 bytes) Raw bytecode (code_info_size=8, bytecode_size=12): 19 0c 16 04 80 6f 25 23 25 00 81 f2 c1 81 27 00 diff --git a/tests/run-tests.py b/tests/run-tests.py index 9c298dae31..d0ecc74a9a 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -527,6 +527,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): "micropython/opt_level_lineno.py" ) # native doesn't have proper traceback info skip_tests.add("micropython/schedule.py") # native code doesn't check pending events + skip_tests.add("stress/bytecode_limit.py") # bytecode specific test def run_one_test(test_file): test_file = test_file.replace("\\", "/") diff --git a/tests/stress/bytecode_limit.py b/tests/stress/bytecode_limit.py new file mode 100644 index 0000000000..0cb0c21e40 --- /dev/null +++ b/tests/stress/bytecode_limit.py @@ -0,0 +1,26 @@ +# Test the limits of bytecode generation. + +body = " with f()()() as a:\n try:\n f()()()\n except Exception:\n pass\n" + +# Test changing size of code info (source line/bytecode mapping) due to changing +# bytecode size in the final passes. This test is very specific to how the +# code info is encoded, and how jump offsets shrink in the final passes. This +# test should fail if the bytecode emitter doesn't correctly handle shrinking of +# the code info section. +exec( + """ +x = 0 +if x: +""" + + body * 13 + + """ +x = [1 if x else 123] + + + + + + +print(x) +""" +) diff --git a/tests/stress/bytecode_limit.py.exp b/tests/stress/bytecode_limit.py.exp new file mode 100644 index 0000000000..3214bfe58c --- /dev/null +++ b/tests/stress/bytecode_limit.py.exp @@ -0,0 +1 @@ +[123] diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index 73753094ec..1ce301ab94 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -242,17 +242,17 @@ class Opcodes: MP_BC_ROT_TWO = (MP_BC_BASE_BYTE_O + 0x0a) MP_BC_ROT_THREE = (MP_BC_BASE_BYTE_O + 0x0b) - MP_BC_JUMP = (MP_BC_BASE_JUMP_E + 0x02) # rel byte code offset, 16-bit signed, in excess - MP_BC_POP_JUMP_IF_TRUE = (MP_BC_BASE_JUMP_E + 0x03) # rel byte code offset, 16-bit signed, in excess - MP_BC_POP_JUMP_IF_FALSE = (MP_BC_BASE_JUMP_E + 0x04) # rel byte code offset, 16-bit signed, in excess - MP_BC_JUMP_IF_TRUE_OR_POP = (MP_BC_BASE_JUMP_E + 0x05) # rel byte code offset, 16-bit signed, in excess - MP_BC_JUMP_IF_FALSE_OR_POP = (MP_BC_BASE_JUMP_E + 0x06) # rel byte code offset, 16-bit signed, in excess - MP_BC_UNWIND_JUMP = (MP_BC_BASE_JUMP_E + 0x00) # rel byte code offset, 16-bit signed, in excess; then a byte - MP_BC_SETUP_WITH = (MP_BC_BASE_JUMP_E + 0x07) # rel byte code offset, 16-bit unsigned - MP_BC_SETUP_EXCEPT = (MP_BC_BASE_JUMP_E + 0x08) # rel byte code offset, 16-bit unsigned - MP_BC_SETUP_FINALLY = (MP_BC_BASE_JUMP_E + 0x09) # rel byte code offset, 16-bit unsigned - MP_BC_POP_EXCEPT_JUMP = (MP_BC_BASE_JUMP_E + 0x0a) # rel byte code offset, 16-bit unsigned - MP_BC_FOR_ITER = (MP_BC_BASE_JUMP_E + 0x0b) # rel byte code offset, 16-bit unsigned + MP_BC_UNWIND_JUMP = (MP_BC_BASE_JUMP_E + 0x00) # signed relative bytecode offset; then a byte + MP_BC_JUMP = (MP_BC_BASE_JUMP_E + 0x02) # signed relative bytecode offset + MP_BC_POP_JUMP_IF_TRUE = (MP_BC_BASE_JUMP_E + 0x03) # signed relative bytecode offset + MP_BC_POP_JUMP_IF_FALSE = (MP_BC_BASE_JUMP_E + 0x04) # signed relative bytecode offset + MP_BC_JUMP_IF_TRUE_OR_POP = (MP_BC_BASE_JUMP_E + 0x05) # signed relative bytecode offset + MP_BC_JUMP_IF_FALSE_OR_POP = (MP_BC_BASE_JUMP_E + 0x06) # signed relative bytecode offset + MP_BC_SETUP_WITH = (MP_BC_BASE_JUMP_E + 0x07) # unsigned relative bytecode offset + MP_BC_SETUP_EXCEPT = (MP_BC_BASE_JUMP_E + 0x08) # unsigned relative bytecode offset + MP_BC_SETUP_FINALLY = (MP_BC_BASE_JUMP_E + 0x09) # unsigned relative bytecode offset + MP_BC_POP_EXCEPT_JUMP = (MP_BC_BASE_JUMP_E + 0x0a) # unsigned relative bytecode offset + MP_BC_FOR_ITER = (MP_BC_BASE_JUMP_E + 0x0b) # unsigned relative bytecode offset MP_BC_WITH_CLEANUP = (MP_BC_BASE_BYTE_O + 0x0c) MP_BC_END_FINALLY = (MP_BC_BASE_BYTE_O + 0x0d) MP_BC_GET_ITER = (MP_BC_BASE_BYTE_O + 0x0e) @@ -289,6 +289,16 @@ class Opcodes: MP_BC_IMPORT_STAR = (MP_BC_BASE_BYTE_E + 0x09) # fmt: on + # Create sets of related opcodes. + ALL_OFFSET_SIGNED = ( + MP_BC_UNWIND_JUMP, + MP_BC_JUMP, + MP_BC_POP_JUMP_IF_TRUE, + MP_BC_POP_JUMP_IF_FALSE, + MP_BC_JUMP_IF_TRUE_OR_POP, + MP_BC_JUMP_IF_FALSE_OR_POP, + ) + # Create a dict mapping opcode value to opcode name. mapping = ["unknown" for _ in range(256)] for op_name in list(locals()): @@ -323,7 +333,10 @@ def mp_opcode_format(bytecode, ip, count_var_uint): ip += 1 ip += 1 elif f == MP_BC_FORMAT_OFFSET: - ip += 2 + if bytecode[ip] & 0x80 == 0: + ip += 1 + else: + ip += 2 ip += extra_byte return f, ip - ip_start @@ -342,8 +355,16 @@ def mp_opcode_decode(bytecode, ip): arg = arg << 7 | bytecode[ip] & 0x7F ip += 1 elif f == MP_BC_FORMAT_OFFSET: - arg = bytecode[ip] | bytecode[ip + 1] << 8 - ip += 2 + if bytecode[ip] & 0x80 == 0: + arg = bytecode[ip] + ip += 1 + if opcode in Opcodes.ALL_OFFSET_SIGNED: + arg -= 0x40 + else: + arg = bytecode[ip] & 0x7F | bytecode[ip + 1] << 7 + ip += 2 + if opcode in Opcodes.ALL_OFFSET_SIGNED: + arg -= 0x4000 ip += extra_byte return f, ip - ip_start, arg From acd2c5c8349a4cd713b1b36c0e6ec6f39791ca19 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 18 Mar 2022 13:18:59 +1100 Subject: [PATCH 0261/1712] py/emitbc: Add check for bytecode jump offset overflow. Signed-off-by: Damien George --- py/emitbc.c | 9 +++++++++ tests/stress/bytecode_limit.py | 7 +++++++ tests/stress/bytecode_limit.py.exp | 4 ++++ 3 files changed, 20 insertions(+) diff --git a/py/emitbc.c b/py/emitbc.c index 14a72e2765..90ab6c0a92 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -64,6 +64,7 @@ struct _emit_t { size_t bytecode_offset; size_t bytecode_size; byte *code_base; // stores both byte code and code info + bool overflow; size_t n_info; size_t n_cell; @@ -260,6 +261,9 @@ STATIC void emit_write_bytecode_byte_label(emit_t *emit, int stack_adj, byte b1, if (is_signed) { bytecode_offset += 0x4000; } + if (emit->pass == MP_PASS_EMIT && !(0 <= bytecode_offset && bytecode_offset <= 0x7fff)) { + emit->overflow = true; + } c[1] = 0x80 | (bytecode_offset & 0x7f); c[2] = bytecode_offset >> 7; } @@ -274,6 +278,7 @@ void mp_emit_bc_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) { emit->last_source_line = 1; emit->bytecode_offset = 0; emit->code_info_offset = 0; + emit->overflow = false; // Write local state size, exception stack size, scope flags and number of arguments { @@ -373,6 +378,10 @@ bool mp_emit_bc_end_pass(emit_t *emit) { return false; } + if (emit->overflow) { + mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("bytecode overflow")); + } + // Bytecode is finalised, assign it to the raw code object. mp_emit_glue_assign_bytecode(emit->scope->raw_code, emit->code_base, #if MICROPY_PERSISTENT_CODE_SAVE || MICROPY_DEBUG_PRINTERS diff --git a/tests/stress/bytecode_limit.py b/tests/stress/bytecode_limit.py index 0cb0c21e40..49f7cd2caf 100644 --- a/tests/stress/bytecode_limit.py +++ b/tests/stress/bytecode_limit.py @@ -24,3 +24,10 @@ x = [1 if x else 123] print(x) """ ) + +# Test overflow of jump offset. +for n in (430, 431, 432, 433): + try: + exec("cond = 0\nif cond:\n" + body * n + "else:\n print('cond false')\n") + except RuntimeError: + print("RuntimeError") diff --git a/tests/stress/bytecode_limit.py.exp b/tests/stress/bytecode_limit.py.exp index 3214bfe58c..b2d9737d80 100644 --- a/tests/stress/bytecode_limit.py.exp +++ b/tests/stress/bytecode_limit.py.exp @@ -1 +1,5 @@ [123] +cond false +cond false +RuntimeError +RuntimeError From 6d11c69983f8084459e5bb037d931d5e2d283c78 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 21 Mar 2022 16:36:13 +1100 Subject: [PATCH 0262/1712] py: Change jump-if-x-or-pop opcodes to have unsigned offset argument. These jumps are always forwards, and it's more efficient in the VM to decode an unsigned argument. These opcodes are already optimised versions of the sequence "dup-top pop-jump-if-x pop" so it doesn't hurt generality to optimise them further. Signed-off-by: Damien George --- py/bc0.h | 4 ++-- py/emitbc.c | 2 +- py/showbc.c | 4 ++-- py/vm.c | 8 ++++---- tools/mpy-tool.py | 6 ++---- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/py/bc0.h b/py/bc0.h index 50c4954b08..a4a0acf937 100644 --- a/py/bc0.h +++ b/py/bc0.h @@ -117,8 +117,8 @@ #define MP_BC_JUMP (MP_BC_BASE_JUMP_E + 0x02) // signed relative bytecode offset #define MP_BC_POP_JUMP_IF_TRUE (MP_BC_BASE_JUMP_E + 0x03) // signed relative bytecode offset #define MP_BC_POP_JUMP_IF_FALSE (MP_BC_BASE_JUMP_E + 0x04) // signed relative bytecode offset -#define MP_BC_JUMP_IF_TRUE_OR_POP (MP_BC_BASE_JUMP_E + 0x05) // signed relative bytecode offset -#define MP_BC_JUMP_IF_FALSE_OR_POP (MP_BC_BASE_JUMP_E + 0x06) // signed relative bytecode offset +#define MP_BC_JUMP_IF_TRUE_OR_POP (MP_BC_BASE_JUMP_E + 0x05) // unsigned relative bytecode offset +#define MP_BC_JUMP_IF_FALSE_OR_POP (MP_BC_BASE_JUMP_E + 0x06) // unsigned relative bytecode offset #define MP_BC_SETUP_WITH (MP_BC_BASE_JUMP_E + 0x07) // unsigned relative bytecode offset #define MP_BC_SETUP_EXCEPT (MP_BC_BASE_JUMP_E + 0x08) // unsigned relative bytecode offset #define MP_BC_SETUP_FINALLY (MP_BC_BASE_JUMP_E + 0x09) // unsigned relative bytecode offset diff --git a/py/emitbc.c b/py/emitbc.c index 90ab6c0a92..1f5cd9d322 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -224,7 +224,7 @@ STATIC void emit_write_bytecode_byte_label(emit_t *emit, int stack_adj, byte b1, mp_emit_bc_adjust_stack_size(emit, stack_adj); // Determine if the jump offset is signed or unsigned, based on the opcode. - const bool is_signed = b1 <= MP_BC_JUMP_IF_FALSE_OR_POP; + const bool is_signed = b1 <= MP_BC_POP_JUMP_IF_FALSE; // Default to a 2-byte encoding (the largest) with an unknown jump offset. unsigned int jump_encoding_size = 1; diff --git a/py/showbc.c b/py/showbc.c index 178fa451a2..f9c334b93b 100644 --- a/py/showbc.c +++ b/py/showbc.c @@ -338,12 +338,12 @@ const byte *mp_bytecode_print_str(const mp_print_t *print, const byte *ip_start, break; case MP_BC_JUMP_IF_TRUE_OR_POP: - DECODE_SLABEL; + DECODE_ULABEL; mp_printf(print, "JUMP_IF_TRUE_OR_POP " UINT_FMT, (mp_uint_t)(ip + unum - ip_start)); break; case MP_BC_JUMP_IF_FALSE_OR_POP: - DECODE_SLABEL; + DECODE_ULABEL; mp_printf(print, "JUMP_IF_FALSE_OR_POP " UINT_FMT, (mp_uint_t)(ip + unum - ip_start)); break; diff --git a/py/vm.c b/py/vm.c index 990009c00c..50da90e7d2 100644 --- a/py/vm.c +++ b/py/vm.c @@ -560,9 +560,9 @@ dispatch_loop: } ENTRY(MP_BC_JUMP_IF_TRUE_OR_POP): { - DECODE_SLABEL; + DECODE_ULABEL; if (mp_obj_is_true(TOP())) { - ip += slab; + ip += ulab; } else { sp--; } @@ -570,11 +570,11 @@ dispatch_loop: } ENTRY(MP_BC_JUMP_IF_FALSE_OR_POP): { - DECODE_SLABEL; + DECODE_ULABEL; if (mp_obj_is_true(TOP())) { sp--; } else { - ip += slab; + ip += ulab; } DISPATCH_WITH_PEND_EXC_CHECK(); } diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index 1ce301ab94..84c09a0c68 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -246,8 +246,8 @@ class Opcodes: MP_BC_JUMP = (MP_BC_BASE_JUMP_E + 0x02) # signed relative bytecode offset MP_BC_POP_JUMP_IF_TRUE = (MP_BC_BASE_JUMP_E + 0x03) # signed relative bytecode offset MP_BC_POP_JUMP_IF_FALSE = (MP_BC_BASE_JUMP_E + 0x04) # signed relative bytecode offset - MP_BC_JUMP_IF_TRUE_OR_POP = (MP_BC_BASE_JUMP_E + 0x05) # signed relative bytecode offset - MP_BC_JUMP_IF_FALSE_OR_POP = (MP_BC_BASE_JUMP_E + 0x06) # signed relative bytecode offset + MP_BC_JUMP_IF_TRUE_OR_POP = (MP_BC_BASE_JUMP_E + 0x05) # unsigned relative bytecode offset + MP_BC_JUMP_IF_FALSE_OR_POP = (MP_BC_BASE_JUMP_E + 0x06) # unsigned relative bytecode offset MP_BC_SETUP_WITH = (MP_BC_BASE_JUMP_E + 0x07) # unsigned relative bytecode offset MP_BC_SETUP_EXCEPT = (MP_BC_BASE_JUMP_E + 0x08) # unsigned relative bytecode offset MP_BC_SETUP_FINALLY = (MP_BC_BASE_JUMP_E + 0x09) # unsigned relative bytecode offset @@ -295,8 +295,6 @@ class Opcodes: MP_BC_JUMP, MP_BC_POP_JUMP_IF_TRUE, MP_BC_POP_JUMP_IF_FALSE, - MP_BC_JUMP_IF_TRUE_OR_POP, - MP_BC_JUMP_IF_FALSE_OR_POP, ) # Create a dict mapping opcode value to opcode name. From b312a7abf5504d0e68846d5728c09899119f2621 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 25 Mar 2022 11:57:59 +1100 Subject: [PATCH 0263/1712] py/builtinimport: Alias sys to usys if import weak links aren't enabled. The sys module should always be available (if it's compiled in), eg to change sys.path for importing. So provide an explicit alias from "sys" to "usys" so that "import sys" can always work. Signed-off-by: Damien George --- py/builtinimport.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/py/builtinimport.c b/py/builtinimport.c index 094959f97d..cd9636ccdc 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -373,6 +373,10 @@ STATIC mp_obj_t process_import_at_level(qstr full_mod_name, qstr level_mod_name, qstr umodule_name = qstr_from_str(umodule_buf); module_obj = mp_module_get_builtin(umodule_name); } + #elif MICROPY_PY_SYS + if (stat == MP_IMPORT_STAT_NO_EXIST && module_obj == MP_OBJ_NULL && level_mod_name == MP_QSTR_sys) { + module_obj = MP_OBJ_FROM_PTR(&mp_module_sys); + } #endif } else { DEBUG_printf("Searching for sub-module\n"); From 35dbde163a8a253679c09b4646a9177cde5345f2 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 25 Mar 2022 12:39:12 +1100 Subject: [PATCH 0264/1712] tools/mpremote: Support any prompt string when detecting soft reset. The prompt may be changed by sys.ps1. Signed-off-by: Damien George --- tools/mpremote/mpremote/pyboardextended.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tools/mpremote/mpremote/pyboardextended.py b/tools/mpremote/mpremote/pyboardextended.py index 69cbf02edd..95619b0eb6 100644 --- a/tools/mpremote/mpremote/pyboardextended.py +++ b/tools/mpremote/mpremote/pyboardextended.py @@ -653,12 +653,12 @@ class PyboardExtended(Pyboard): # Check if a soft reset occurred. if data_all.find(b"MPY: soft reboot") == -1: return - if data_all.endswith(b">>> "): - in_friendly_repl = True - elif data_all.endswith(b">"): + if data_all.endswith(b">"): in_friendly_repl = False + prompt = b">" else: - return + in_friendly_repl = True + prompt = data_all.rsplit(b"\r\n", 1)[-1] # Clear state while board remounts, it will be re-set once mounted. self.mounted = False @@ -676,9 +676,6 @@ class PyboardExtended(Pyboard): # Exit raw REPL if needed, and wait for the friendly REPL prompt. if in_friendly_repl: self.exit_raw_repl() - prompt = b">>> " - else: - prompt = b">" self.read_until(len(prompt), prompt) out_callback(prompt) self.serial = SerialIntercept(self.serial, self.cmd) From c90dfba04ca8d6e3eb12732dea2344f393f77531 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 23 Mar 2022 15:21:03 +1100 Subject: [PATCH 0265/1712] stm32/machine_i2s: Set FullDuplexMode to disabled on F4. Signed-off-by: Damien George --- ports/stm32/machine_i2s.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/stm32/machine_i2s.c b/ports/stm32/machine_i2s.c index 31b7d14bfd..0bb0f3e8f5 100644 --- a/ports/stm32/machine_i2s.c +++ b/ports/stm32/machine_i2s.c @@ -791,6 +791,9 @@ STATIC void machine_i2s_init_helper(machine_i2s_obj_t *self, size_t n_pos_args, init->AudioFreq = args[ARG_rate].u_int; init->CPOL = I2S_CPOL_LOW; init->ClockSource = I2S_CLOCK_PLL; + #if defined(STM32F4) + init->FullDuplexMode = I2S_FULLDUPLEXMODE_DISABLE; + #endif // init the I2S bus if (!i2s_init(self)) { From 2a91c8a888bc56b61876e6d01a2f144aee5686b4 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 25 Mar 2022 14:29:48 +1100 Subject: [PATCH 0266/1712] stm32/machine_i2s: Allow I2S.deinit to be called multiple times. In particular, it is called by the constructor if the instance already exists. So if the previous instance was deinit'd then it will be deinit'd a second time. Signed-off-by: Damien George --- ports/stm32/machine_i2s.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/ports/stm32/machine_i2s.c b/ports/stm32/machine_i2s.c index 0bb0f3e8f5..2120554c3a 100644 --- a/ports/stm32/machine_i2s.c +++ b/ports/stm32/machine_i2s.c @@ -887,25 +887,27 @@ STATIC mp_obj_t machine_i2s_init(size_t n_pos_args, const mp_obj_t *pos_args, mp STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2s_init_obj, 1, machine_i2s_init); STATIC mp_obj_t machine_i2s_deinit(mp_obj_t self_in) { - machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in); - dma_deinit(self->dma_descr_tx); - dma_deinit(self->dma_descr_rx); - HAL_I2S_DeInit(&self->hi2s); + if (self->ring_buffer_storage != NULL) { + dma_deinit(self->dma_descr_tx); + dma_deinit(self->dma_descr_rx); + HAL_I2S_DeInit(&self->hi2s); - if (self->hi2s.Instance == I2S1) { - __SPI1_FORCE_RESET(); - __SPI1_RELEASE_RESET(); - __SPI1_CLK_DISABLE(); - } else if (self->hi2s.Instance == I2S2) { - __SPI2_FORCE_RESET(); - __SPI2_RELEASE_RESET(); - __SPI2_CLK_DISABLE(); + if (self->hi2s.Instance == I2S1) { + __SPI1_FORCE_RESET(); + __SPI1_RELEASE_RESET(); + __SPI1_CLK_DISABLE(); + } else if (self->hi2s.Instance == I2S2) { + __SPI2_FORCE_RESET(); + __SPI2_RELEASE_RESET(); + __SPI2_CLK_DISABLE(); + } + + m_free(self->ring_buffer_storage); + self->ring_buffer_storage = NULL; } - m_free(self->ring_buffer_storage); - return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_i2s_deinit_obj, machine_i2s_deinit); From 6804a8a891d61d7b4c2b613997021d12f960763c Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 26 Mar 2022 00:07:19 +1100 Subject: [PATCH 0267/1712] stm32/machine_i2s: Fix 16-bit stereo i2s_frame_map. Signed-off-by: Damien George --- ports/stm32/machine_i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/stm32/machine_i2s.c b/ports/stm32/machine_i2s.c index 2120554c3a..2bb60a6a86 100644 --- a/ports/stm32/machine_i2s.c +++ b/ports/stm32/machine_i2s.c @@ -158,7 +158,7 @@ STATIC mp_obj_t machine_i2s_deinit(mp_obj_t self_in); STATIC const int8_t i2s_frame_map[NUM_I2S_USER_FORMATS][I2S_RX_FRAME_SIZE_IN_BYTES] = { { 0, 1, -1, -1, -1, -1, -1, -1 }, // Mono, 16-bits { 2, 3, 0, 1, -1, -1, -1, -1 }, // Mono, 32-bits - { 0, 1, 4, 5, -1, -1, -1, -1 }, // Stereo, 16-bits + { 0, 1, -1, -1, 2, 3, -1, -1 }, // Stereo, 16-bits { 2, 3, 0, 1, 6, 7, 4, 5 }, // Stereo, 32-bits }; From 726628584507d1b043fa28e9adf122acb4b40781 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 28 Mar 2022 16:53:03 +1100 Subject: [PATCH 0268/1712] tests/extmod: Add test for machine.I2S data rate. Signed-off-by: Damien George --- tests/extmod/machine_i2s_rate.py | 80 ++++++++++++++++++++++++++++ tests/extmod/machine_i2s_rate.py.exp | 8 +++ 2 files changed, 88 insertions(+) create mode 100644 tests/extmod/machine_i2s_rate.py create mode 100644 tests/extmod/machine_i2s_rate.py.exp diff --git a/tests/extmod/machine_i2s_rate.py b/tests/extmod/machine_i2s_rate.py new file mode 100644 index 0000000000..46e94585b7 --- /dev/null +++ b/tests/extmod/machine_i2s_rate.py @@ -0,0 +1,80 @@ +# Test machine.I2S data transfer rate, for both TX and RX. + +try: + from machine import Pin, I2S +except ImportError: + print("SKIP") + raise SystemExit + +import time, sys + +# Configure pins based on the board. +if "pyboard" in sys.platform: + i2s_id = 2 + sck_pin = Pin("Y6") + ws_pin = Pin("Y5") + sd_pin = Pin("Y8") +elif "rp2" in sys.platform: + i2s_id = 1 + sck_pin = Pin(0) + ws_pin = Pin(1) + sd_pin = Pin(2) + +TEST_BYTES = b"01234567" +RATE = 11025 # frames/sec + + +def test(mode, bits_per_sample, frame_format): + i2s = I2S( + i2s_id, + sck=sck_pin, + ws=ws_pin, + sd=sd_pin, + mode=mode, + bits=bits_per_sample, + format=frame_format, + rate=RATE, + ibuf=200, + ) + + if frame_format == I2S.MONO: + channels = 1 + else: + channels = 2 + bits_per_frame = bits_per_sample * channels + buf_len_250ms = bits_per_frame // 8 * RATE // 4 + + # Create test data and preload I2S buffers. + if mode == I2S.TX: + mode_str = "TX" + data = TEST_BYTES * (buf_len_250ms // len(TEST_BYTES)) + i2s.write(data) + else: + mode_str = "RX" + data = bytearray(len(TEST_BYTES) * (buf_len_250ms // len(TEST_BYTES))) + i2s.readinto(data) + + # Time how long it takes to read/write 2 lots of data. + t0 = time.ticks_ms() + for i in range(2): + if mode == I2S.TX: + i2s.write(data) + else: + i2s.readinto(data) + t1 = time.ticks_ms() + dt = time.ticks_diff(t1, t0) + + i2s.deinit() + + # Print out test result, time should be in range of 500ms. + print(mode_str, bits_per_sample, channels, abs(dt - 500) <= 4) + + +test(I2S.TX, 16, I2S.MONO) +test(I2S.TX, 16, I2S.STEREO) +test(I2S.TX, 32, I2S.MONO) +test(I2S.TX, 32, I2S.STEREO) +test(I2S.RX, 16, I2S.MONO) +test(I2S.RX, 16, I2S.STEREO) +test(I2S.RX, 32, I2S.MONO) +test(I2S.RX, 32, I2S.STEREO) diff --git a/tests/extmod/machine_i2s_rate.py.exp b/tests/extmod/machine_i2s_rate.py.exp new file mode 100644 index 0000000000..e160d92f6b --- /dev/null +++ b/tests/extmod/machine_i2s_rate.py.exp @@ -0,0 +1,8 @@ +TX 16 1 True +TX 16 2 True +TX 32 1 True +TX 32 2 True +RX 16 1 True +RX 16 2 True +RX 32 1 True +RX 32 2 True From 5e685a9c6faeb764c0b689bc736ed00736bfd6b6 Mon Sep 17 00:00:00 2001 From: Damien George Date: Mon, 28 Mar 2022 17:10:33 +1100 Subject: [PATCH 0269/1712] docs/library/machine.I2S: Clarify what rate refers to. Signed-off-by: Damien George --- docs/library/machine.I2S.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/library/machine.I2S.rst b/docs/library/machine.I2S.rst index abfbb08780..d4e5ac9433 100644 --- a/docs/library/machine.I2S.rst +++ b/docs/library/machine.I2S.rst @@ -95,7 +95,8 @@ Constructor - ``mode`` specifies receive or transmit - ``bits`` specifies sample size (bits), 16 or 32 - ``format`` specifies channel format, STEREO or MONO - - ``rate`` specifies audio sampling rate (samples/s) + - ``rate`` specifies audio sampling rate (Hz); + this is the frequency of the ``ws`` signal - ``ibuf`` specifies internal buffer length (bytes) For all ports, DMA runs continuously in the background and allows user applications to perform other operations while From 1f6cb8f0476e699c1910ed59f1bb027fbef72ad7 Mon Sep 17 00:00:00 2001 From: MikeTeachman Date: Mon, 29 Nov 2021 09:50:34 -0800 Subject: [PATCH 0270/1712] mixmrt/machine_i2s: Add I2S protocol support. This commit adds support for machine.I2S on the mimxrt port. The I2S API is consistent with the existing stm32, esp32, and rp2 implementations. I2S features: - controller transmit and controller receive - 16-bit and 32-bit sample sizes - mono and stereo formats - sampling frequencies from 8kHz to 48kHz - 3 modes of operation: - blocking - non-blocking with callback - uasyncio - configurable internal buffer - optional MCK Tested with the following development boards: - MIMXRT1010_EVK, MIMXRT1015_EVK, MIMXRT1020_EVK, MIMXRT1050_EVK - Teensy 4.0, Teensy 4.1 - Olimex RT1010 - Seeed ARCH MIX Tested with the following I2S hardware peripherals: - UDA1334 - GY-SPH0645LM4H - WM8960 codec on board the MIMXRT boards and separate breakout board - INMP441 - PCM5102 - SGTL5000 on the Teensy audio shield Signed-off-by: Mike Teachman --- docs/library/machine.I2S.rst | 12 +- ports/mimxrt/Makefile | 9 +- ports/mimxrt/board_init.c | 4 + .../boards/MIMXRT1010_EVK/mpconfigboard.h | 33 + ports/mimxrt/boards/MIMXRT1010_EVK/pins.csv | 7 + .../boards/MIMXRT1020_EVK/mpconfigboard.h | 33 + ports/mimxrt/boards/MIMXRT1020_EVK/pins.csv | 9 +- .../boards/MIMXRT1050_EVK/mpconfigboard.h | 34 + ports/mimxrt/boards/MIMXRT1050_EVK/pins.csv | 7 + .../boards/MIMXRT1060_EVK/mpconfigboard.h | 33 + ports/mimxrt/boards/MIMXRT1060_EVK/pins.csv | 7 + .../boards/MIMXRT1064_EVK/mpconfigboard.h | 33 + ports/mimxrt/boards/MIMXRT1064_EVK/pins.csv | 7 + .../boards/OLIMEX_RT1010/mpconfigboard.h | 36 + ports/mimxrt/boards/OLIMEX_RT1010/pins.csv | 7 + .../boards/SEEED_ARCH_MIX/mpconfigboard.h | 32 + ports/mimxrt/boards/SEEED_ARCH_MIX/pins.csv | 7 + ports/mimxrt/boards/TEENSY40/mpconfigboard.h | 38 + ports/mimxrt/boards/TEENSY40/pins.csv | 9 +- ports/mimxrt/boards/TEENSY41/mpconfigboard.h | 40 + ports/mimxrt/boards/TEENSY41/pins.csv | 9 +- ports/mimxrt/{dma_channel.c => dma_manager.c} | 16 +- ports/mimxrt/{dma_channel.h => dma_manager.h} | 1 + ports/mimxrt/machine_i2s.c | 1228 +++++++++++++++++ ports/mimxrt/machine_spi.c | 7 +- ports/mimxrt/main.c | 3 + ports/mimxrt/modmachine.c | 3 + ports/mimxrt/modmachine.h | 3 + ports/mimxrt/mpconfigport.h | 13 + ports/mimxrt/sdcard.c | 2 +- 30 files changed, 1662 insertions(+), 20 deletions(-) rename ports/mimxrt/{dma_channel.c => dma_manager.c} (86%) rename ports/mimxrt/{dma_channel.h => dma_manager.h} (98%) create mode 100644 ports/mimxrt/machine_i2s.c diff --git a/docs/library/machine.I2S.rst b/docs/library/machine.I2S.rst index d4e5ac9433..e68a863d7c 100644 --- a/docs/library/machine.I2S.rst +++ b/docs/library/machine.I2S.rst @@ -75,23 +75,19 @@ uasyncio:: Constructor ----------- -.. class:: I2S(id, *, sck, ws, sd, mode, bits, format, rate, ibuf) +.. class:: I2S(id, *, sck, ws, sd, mck=None, mode, bits, format, rate, ibuf) Construct an I2S object of the given id: - - ``id`` identifies a particular I2S bus. - - ``id`` is board and port specific: - - - PYBv1.0/v1.1: has one I2S bus with id=2. - - PYBD-SFxW: has two I2S buses with id=1 and id=2. - - ESP32: has two I2S buses with id=0 and id=1. + - ``id`` identifies a particular I2S bus; it is board and port specific Keyword-only parameters that are supported on all ports: - ``sck`` is a pin object for the serial clock line - ``ws`` is a pin object for the word select line - ``sd`` is a pin object for the serial data line + - ``mck`` is a pin object for the master clock line; + master clock frequency is sampling rate * 256 - ``mode`` specifies receive or transmit - ``bits`` specifies sample size (bits), 16 or 32 - ``format`` specifies channel format, STEREO or MONO diff --git a/ports/mimxrt/Makefile b/ports/mimxrt/Makefile index be5083965f..f9c5bf402a 100644 --- a/ports/mimxrt/Makefile +++ b/ports/mimxrt/Makefile @@ -77,7 +77,7 @@ INC += -I$(TOP)/lib/tinyusb/hw INC += -I$(TOP)/lib/tinyusb/hw/bsp/teensy_40 INC += -I$(TOP)/lib/tinyusb/src -CFLAGS_MCU = -mtune=cortex-m7 -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 +CFLAGS_MCU = -mtune=cortex-m7 -mcpu=cortex-m7 CFLAGS += $(INC) -Wall -Werror -Wdouble-promotion -Wfloat-conversion -std=c99 -nostdlib -mthumb $(CFLAGS_MCU) CFLAGS += -DCPU_$(MCU_SERIES) -DCPU_$(MCU_VARIANT) -DBOARD_$(BOARD) CFLAGS += -DXIP_EXTERNAL_FLASH=1 \ @@ -100,12 +100,14 @@ CFLAGS += $(CFLAGS_MOD) $(CFLAGS_EXTRA) # Configure floating point support ifeq ($(MICROPY_FLOAT_IMPL),double) CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_DOUBLE +CFLAGS_MCU += -mfloat-abi=hard -mfpu=fpv5-d16 else ifeq ($(MICROPY_FLOAT_IMPL),none) CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_NONE else CFLAGS += -DMICROPY_FLOAT_IMPL=MICROPY_FLOAT_IMPL_FLOAT CFLAGS += -fsingle-precision-constant +CFLAGS_MCU += -mfloat-abi=softfp -mfpu=fpv5-sp-d16 endif endif @@ -188,6 +190,7 @@ SRC_HAL_IMX_C += \ $(MCU_DIR)/drivers/fsl_lpuart.c \ $(MCU_DIR)/drivers/fsl_pit.c \ $(MCU_DIR)/drivers/fsl_pwm.c \ + $(MCU_DIR)/drivers/fsl_sai.c \ $(MCU_DIR)/drivers/fsl_snvs_lp.c \ $(MCU_DIR)/drivers/fsl_trng.c \ $(MCU_DIR)/drivers/fsl_wdog.c \ @@ -210,7 +213,7 @@ endif SRC_C += \ board_init.c \ - dma_channel.c \ + dma_manager.c \ drivers/bus/softspi.c \ drivers/dht/dht.c \ eth.c \ @@ -224,6 +227,7 @@ SRC_C += \ machine_adc.c \ machine_bitstream.c \ machine_i2c.c \ + machine_i2s.c \ machine_led.c \ machine_pin.c \ machine_rtc.c \ @@ -396,6 +400,7 @@ SRC_QSTR += \ extmod/modonewire.c \ extmod/uos_dupterm.c \ machine_adc.c \ + machine_i2s.c \ machine_led.c \ machine_pin.c \ machine_pwm.c \ diff --git a/ports/mimxrt/board_init.c b/ports/mimxrt/board_init.c index d96645feff..82af620a8d 100644 --- a/ports/mimxrt/board_init.c +++ b/ports/mimxrt/board_init.c @@ -96,6 +96,10 @@ void board_init(void) { #if MICROPY_PY_MACHINE_SDCARD machine_sdcard_init0(); #endif + + #if MICROPY_PY_MACHINE_I2S + machine_i2s_init0(); + #endif } void USB_OTG1_IRQHandler(void) { diff --git a/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.h b/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.h index 726a63904d..75fda0cad1 100644 --- a/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.h +++ b/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.h @@ -44,3 +44,36 @@ #define IOMUX_TABLE_I2C \ { IOMUXC_GPIO_02_LPI2C1_SCL }, { IOMUXC_GPIO_01_LPI2C1_SDA }, \ { IOMUXC_GPIO_10_LPI2C2_SCL }, { IOMUXC_GPIO_09_LPI2C2_SDA }, + +#define MICROPY_PY_MACHINE_I2S (1) +#define MICROPY_HW_I2S_NUM (1) +#define I2S_CLOCK_MUX { 0, kCLOCK_Sai1Mux } +#define I2S_CLOCK_PRE_DIV { 0, kCLOCK_Sai1PreDiv } +#define I2S_CLOCK_DIV { 0, kCLOCK_Sai1Div } +#define I2S_IOMUXC_GPR_MODE { 0, kIOMUXC_GPR_SAI1MClkOutputDir } +#define I2S_DMA_REQ_SRC_RX { 0, kDmaRequestMuxSai1Rx } +#define I2S_DMA_REQ_SRC_TX { 0, kDmaRequestMuxSai1Tx } +#define I2S_WM8960_RX_MODE (1) + +#define I2S_GPIO(_hwid, _fn, _mode, _pin, _iomux) \ + { \ + .hw_id = _hwid, \ + .fn = _fn, \ + .mode = _mode, \ + .name = MP_QSTR_##_pin, \ + .iomux = {_iomux}, \ + } + +#define I2S_GPIO_MAP \ + { \ + I2S_GPIO(1, MCK, TX, GPIO_08, IOMUXC_GPIO_08_SAI1_MCLK), \ + I2S_GPIO(1, SCK, RX, GPIO_01, IOMUXC_GPIO_01_SAI1_RX_BCLK), \ + I2S_GPIO(1, WS, RX, GPIO_02, IOMUXC_GPIO_02_SAI1_RX_SYNC), \ + I2S_GPIO(1, SD, RX, GPIO_03, IOMUXC_GPIO_03_SAI1_RX_DATA00), \ + I2S_GPIO(1, SCK, TX, GPIO_06, IOMUXC_GPIO_06_SAI1_TX_BCLK), \ + I2S_GPIO(1, WS, TX, GPIO_07, IOMUXC_GPIO_07_SAI1_TX_SYNC), \ + I2S_GPIO(1, SD, TX, GPIO_04, IOMUXC_GPIO_04_SAI1_TX_DATA00), \ + } + +#define MICROPY_BOARD_ROOT_POINTERS \ + struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_I2S_NUM]; diff --git a/ports/mimxrt/boards/MIMXRT1010_EVK/pins.csv b/ports/mimxrt/boards/MIMXRT1010_EVK/pins.csv index 1f01215ddd..d8710f8ce5 100644 --- a/ports/mimxrt/boards/MIMXRT1010_EVK/pins.csv +++ b/ports/mimxrt/boards/MIMXRT1010_EVK/pins.csv @@ -34,3 +34,10 @@ PWM_CB,GPIO_05 ENC_A,GPIO_AD_05 ENC_B,GPIO_AD_06 LED_GREEN,GPIO_11 +MCK,GPIO_08 +SCK_RX,GPIO_01 +WS_RX,GPIO_02 +SD_RX,GPIO_03 +SCK_TX,GPIO_06 +WS_TX,GPIO_07 +SD_TX,GPIO_04 diff --git a/ports/mimxrt/boards/MIMXRT1020_EVK/mpconfigboard.h b/ports/mimxrt/boards/MIMXRT1020_EVK/mpconfigboard.h index 2e7ee34e8d..1dfe02b651 100644 --- a/ports/mimxrt/boards/MIMXRT1020_EVK/mpconfigboard.h +++ b/ports/mimxrt/boards/MIMXRT1020_EVK/mpconfigboard.h @@ -65,6 +65,36 @@ { 0 }, { 0 }, \ { IOMUXC_GPIO_SD_B1_02_LPI2C4_SCL }, { IOMUXC_GPIO_SD_B1_03_LPI2C4_SDA }, +#define MICROPY_PY_MACHINE_I2S (1) +#define MICROPY_HW_I2S_NUM (1) +#define I2S_CLOCK_MUX { 0, kCLOCK_Sai1Mux, kCLOCK_Sai2Mux } +#define I2S_CLOCK_PRE_DIV { 0, kCLOCK_Sai1PreDiv, kCLOCK_Sai2PreDiv } +#define I2S_CLOCK_DIV { 0, kCLOCK_Sai1Div, kCLOCK_Sai2Div } +#define I2S_IOMUXC_GPR_MODE { 0, kIOMUXC_GPR_SAI1MClkOutputDir, kIOMUXC_GPR_SAI2MClkOutputDir } +#define I2S_DMA_REQ_SRC_RX { 0, kDmaRequestMuxSai1Rx, kDmaRequestMuxSai2Rx } +#define I2S_DMA_REQ_SRC_TX { 0, kDmaRequestMuxSai1Tx, kDmaRequestMuxSai2Tx } + +#define I2S_GPIO(_hwid, _fn, _mode, _pin, _iomux) \ + { \ + .hw_id = _hwid, \ + .fn = _fn, \ + .mode = _mode, \ + .name = MP_QSTR_##_pin, \ + .iomux = {_iomux}, \ + } + +#define I2S_GPIO_MAP \ + { \ + I2S_GPIO(1, MCK, TX, GPIO_AD_B1_00, IOMUXC_GPIO_AD_B1_00_SAI1_MCLK), \ + I2S_GPIO(1, SCK, RX, GPIO_AD_B1_06, IOMUXC_GPIO_AD_B1_06_SAI1_RX_BCLK), \ + I2S_GPIO(1, WS, RX, GPIO_AD_B1_04, IOMUXC_GPIO_AD_B1_04_SAI1_RX_SYNC), \ + I2S_GPIO(1, SD, RX, GPIO_AD_B1_05, IOMUXC_GPIO_AD_B1_05_SAI1_RX_DATA00), \ + I2S_GPIO(1, SCK, TX, GPIO_AD_B1_01, IOMUXC_GPIO_AD_B1_01_SAI1_TX_BCLK), \ + I2S_GPIO(1, WS, TX, GPIO_AD_B1_02, IOMUXC_GPIO_AD_B1_02_SAI1_TX_SYNC), \ + I2S_GPIO(1, SD, TX, GPIO_AD_B1_03, IOMUXC_GPIO_AD_B1_03_SAI1_TX_DATA00), \ + } + + #define USDHC_DUMMY_PIN NULL, 0 #define MICROPY_USDHC1 \ { \ @@ -142,3 +172,6 @@ { IOMUXC_GPIO_AD_B0_15_ENET_TDATA01, 0, 0xB0E9u }, \ { IOMUXC_GPIO_EMC_40_ENET_MDIO, 0, 0xB0E9u }, \ { IOMUXC_GPIO_EMC_41_ENET_MDC, 0, 0xB0E9u }, + +#define MICROPY_BOARD_ROOT_POINTERS \ + struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_I2S_NUM]; diff --git a/ports/mimxrt/boards/MIMXRT1020_EVK/pins.csv b/ports/mimxrt/boards/MIMXRT1020_EVK/pins.csv index 8420bbd821..e1f2669b08 100644 --- a/ports/mimxrt/boards/MIMXRT1020_EVK/pins.csv +++ b/ports/mimxrt/boards/MIMXRT1020_EVK/pins.csv @@ -30,4 +30,11 @@ SCK,GPIO_AD_B0_10 SDI,GPIO_AD_B0_13 SDO,GPIO_AD_B0_12 CS,GPIO_AD_B0_11 -LED_GREEN,GPIO_AD_B0_05 \ No newline at end of file +LED_GREEN,GPIO_AD_B0_05 +MCK,GPIO_AD_B1_00 +SCK_RX,GPIO_AD_B1_06 +WS_RX,GPIO_AD_B1_04 +SD_RX,GPIO_AD_B1_05 +SCK_TX,GPIO_AD_B1_01 +WS_TX,GPIO_AD_B1_02 +SD_TX,GPIO_AD_B1_03 diff --git a/ports/mimxrt/boards/MIMXRT1050_EVK/mpconfigboard.h b/ports/mimxrt/boards/MIMXRT1050_EVK/mpconfigboard.h index c2783a3e59..613095e67f 100644 --- a/ports/mimxrt/boards/MIMXRT1050_EVK/mpconfigboard.h +++ b/ports/mimxrt/boards/MIMXRT1050_EVK/mpconfigboard.h @@ -53,6 +53,37 @@ { 0 }, { 0 }, \ { IOMUXC_GPIO_AD_B1_07_LPI2C3_SCL }, { IOMUXC_GPIO_AD_B1_06_LPI2C3_SDA }, +#define MICROPY_PY_MACHINE_I2S (1) +#define MICROPY_HW_I2S_NUM (1) +#define I2S_CLOCK_MUX { 0, kCLOCK_Sai1Mux, kCLOCK_Sai2Mux } +#define I2S_CLOCK_PRE_DIV { 0, kCLOCK_Sai1PreDiv, kCLOCK_Sai2PreDiv } +#define I2S_CLOCK_DIV { 0, kCLOCK_Sai1Div, kCLOCK_Sai2Div } +#define I2S_IOMUXC_GPR_MODE { 0, kIOMUXC_GPR_SAI1MClkOutputDir, kIOMUXC_GPR_SAI2MClkOutputDir } +#define I2S_DMA_REQ_SRC_RX { 0, kDmaRequestMuxSai1Rx, kDmaRequestMuxSai2Rx } +#define I2S_DMA_REQ_SRC_TX { 0, kDmaRequestMuxSai1Tx, kDmaRequestMuxSai2Tx } +#define I2S_WM8960_RX_MODE (1) + +#define I2S_GPIO(_hwid, _fn, _mode, _pin, _iomux) \ + { \ + .hw_id = _hwid, \ + .fn = _fn, \ + .mode = _mode, \ + .name = MP_QSTR_##_pin, \ + .iomux = {_iomux}, \ + } + +#define I2S_GPIO_MAP \ + { \ + I2S_GPIO(1, MCK, TX, GPIO_AD_B1_09, IOMUXC_GPIO_AD_B1_09_SAI1_MCLK), \ + I2S_GPIO(1, SCK, RX, GPIO_AD_B1_11, IOMUXC_GPIO_AD_B1_11_SAI1_RX_BCLK), \ + I2S_GPIO(1, WS, RX, GPIO_AD_B1_10, IOMUXC_GPIO_AD_B1_10_SAI1_RX_SYNC), \ + I2S_GPIO(1, SD, RX, GPIO_AD_B1_12, IOMUXC_GPIO_AD_B1_12_SAI1_RX_DATA00), \ + I2S_GPIO(1, SCK, TX, GPIO_AD_B1_14, IOMUXC_GPIO_AD_B1_14_SAI1_TX_BCLK), \ + I2S_GPIO(1, WS, TX, GPIO_AD_B1_15, IOMUXC_GPIO_AD_B1_15_SAI1_TX_SYNC), \ + I2S_GPIO(1, SD, TX, GPIO_AD_B1_13, IOMUXC_GPIO_AD_B1_13_SAI1_TX_DATA00), \ + } + + #define USDHC_DUMMY_PIN NULL, 0 #define MICROPY_USDHC1 \ @@ -131,3 +162,6 @@ { IOMUXC_GPIO_B1_11_ENET_RX_ER, 0, 0xB0E9u }, \ { IOMUXC_GPIO_EMC_41_ENET_MDIO, 0, 0xB0E9u }, \ { IOMUXC_GPIO_EMC_40_ENET_MDC, 0, 0xB0E9u }, + +#define MICROPY_BOARD_ROOT_POINTERS \ + struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_I2S_NUM]; diff --git a/ports/mimxrt/boards/MIMXRT1050_EVK/pins.csv b/ports/mimxrt/boards/MIMXRT1050_EVK/pins.csv index 463079b129..4bdd9e4f03 100644 --- a/ports/mimxrt/boards/MIMXRT1050_EVK/pins.csv +++ b/ports/mimxrt/boards/MIMXRT1050_EVK/pins.csv @@ -29,3 +29,10 @@ SDI,GPIO_SD_B0_03 SDO,GPIO_SD_B0_02 CS,GPIO_SD_B0_01 LED_GREEN,GPIO_AD_B0_09 +MCK,GPIO_AD_B1_09 +SCK_RX,GPIO_AD_B1_11 +WS_RX,GPIO_AD_B1_10 +SD_RX,GPIO_AD_B1_12 +SCK_TX,GPIO_AD_B1_14 +WS_TX,GPIO_AD_B1_15 +SD_TX,GPIO_AD_B1_13 diff --git a/ports/mimxrt/boards/MIMXRT1060_EVK/mpconfigboard.h b/ports/mimxrt/boards/MIMXRT1060_EVK/mpconfigboard.h index 475d07ddb1..a3f0062389 100644 --- a/ports/mimxrt/boards/MIMXRT1060_EVK/mpconfigboard.h +++ b/ports/mimxrt/boards/MIMXRT1060_EVK/mpconfigboard.h @@ -53,6 +53,36 @@ { 0 }, { 0 }, \ { IOMUXC_GPIO_AD_B1_07_LPI2C3_SCL }, { IOMUXC_GPIO_AD_B1_06_LPI2C3_SDA }, +#define MICROPY_PY_MACHINE_I2S (1) +#define MICROPY_HW_I2S_NUM (1) +#define I2S_CLOCK_MUX { 0, kCLOCK_Sai1Mux, kCLOCK_Sai2Mux } +#define I2S_CLOCK_PRE_DIV { 0, kCLOCK_Sai1PreDiv, kCLOCK_Sai2PreDiv } +#define I2S_CLOCK_DIV { 0, kCLOCK_Sai1Div, kCLOCK_Sai2Div } +#define I2S_IOMUXC_GPR_MODE { 0, kIOMUXC_GPR_SAI1MClkOutputDir, kIOMUXC_GPR_SAI2MClkOutputDir } +#define I2S_DMA_REQ_SRC_RX { 0, kDmaRequestMuxSai1Rx, kDmaRequestMuxSai2Rx } +#define I2S_DMA_REQ_SRC_TX { 0, kDmaRequestMuxSai1Tx, kDmaRequestMuxSai2Tx } +#define I2S_WM8960_RX_MODE (1) + +#define I2S_GPIO(_hwid, _fn, _mode, _pin, _iomux) \ + { \ + .hw_id = _hwid, \ + .fn = _fn, \ + .mode = _mode, \ + .name = MP_QSTR_##_pin, \ + .iomux = {_iomux}, \ + } + +#define I2S_GPIO_MAP \ + { \ + I2S_GPIO(1, MCK, TX, GPIO_AD_B1_09, IOMUXC_GPIO_AD_B1_09_SAI1_MCLK), \ + I2S_GPIO(1, SCK, RX, GPIO_AD_B1_11, IOMUXC_GPIO_AD_B1_11_SAI1_RX_BCLK), \ + I2S_GPIO(1, WS, RX, GPIO_AD_B1_10, IOMUXC_GPIO_AD_B1_10_SAI1_RX_SYNC), \ + I2S_GPIO(1, SD, RX, GPIO_AD_B1_12, IOMUXC_GPIO_AD_B1_12_SAI1_RX_DATA00), \ + I2S_GPIO(1, SCK, TX, GPIO_AD_B1_14, IOMUXC_GPIO_AD_B1_14_SAI1_TX_BCLK), \ + I2S_GPIO(1, WS, TX, GPIO_AD_B1_15, IOMUXC_GPIO_AD_B1_15_SAI1_TX_SYNC), \ + I2S_GPIO(1, SD, TX, GPIO_AD_B1_13, IOMUXC_GPIO_AD_B1_13_SAI1_TX_DATA00), \ + } + #define USDHC_DUMMY_PIN NULL, 0 #define MICROPY_USDHC1 \ { \ @@ -130,3 +160,6 @@ { IOMUXC_GPIO_B1_11_ENET_RX_ER, 0, 0xB0E9u }, \ { IOMUXC_GPIO_EMC_41_ENET_MDIO, 0, 0xB0E9u }, \ { IOMUXC_GPIO_EMC_40_ENET_MDC, 0, 0xB0E9u }, + +#define MICROPY_BOARD_ROOT_POINTERS \ + struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_I2S_NUM]; diff --git a/ports/mimxrt/boards/MIMXRT1060_EVK/pins.csv b/ports/mimxrt/boards/MIMXRT1060_EVK/pins.csv index 463079b129..4bdd9e4f03 100644 --- a/ports/mimxrt/boards/MIMXRT1060_EVK/pins.csv +++ b/ports/mimxrt/boards/MIMXRT1060_EVK/pins.csv @@ -29,3 +29,10 @@ SDI,GPIO_SD_B0_03 SDO,GPIO_SD_B0_02 CS,GPIO_SD_B0_01 LED_GREEN,GPIO_AD_B0_09 +MCK,GPIO_AD_B1_09 +SCK_RX,GPIO_AD_B1_11 +WS_RX,GPIO_AD_B1_10 +SD_RX,GPIO_AD_B1_12 +SCK_TX,GPIO_AD_B1_14 +WS_TX,GPIO_AD_B1_15 +SD_TX,GPIO_AD_B1_13 diff --git a/ports/mimxrt/boards/MIMXRT1064_EVK/mpconfigboard.h b/ports/mimxrt/boards/MIMXRT1064_EVK/mpconfigboard.h index 874991ac65..fe1fb532b8 100644 --- a/ports/mimxrt/boards/MIMXRT1064_EVK/mpconfigboard.h +++ b/ports/mimxrt/boards/MIMXRT1064_EVK/mpconfigboard.h @@ -53,6 +53,36 @@ { 0 }, { 0 }, \ { IOMUXC_GPIO_AD_B1_07_LPI2C3_SCL }, { IOMUXC_GPIO_AD_B1_06_LPI2C3_SDA }, +#define MICROPY_PY_MACHINE_I2S (1) +#define MICROPY_HW_I2S_NUM (1) +#define I2S_CLOCK_MUX { 0, kCLOCK_Sai1Mux, kCLOCK_Sai2Mux } +#define I2S_CLOCK_PRE_DIV { 0, kCLOCK_Sai1PreDiv, kCLOCK_Sai2PreDiv } +#define I2S_CLOCK_DIV { 0, kCLOCK_Sai1Div, kCLOCK_Sai2Div } +#define I2S_IOMUXC_GPR_MODE { 0, kIOMUXC_GPR_SAI1MClkOutputDir, kIOMUXC_GPR_SAI2MClkOutputDir } +#define I2S_DMA_REQ_SRC_RX { 0, kDmaRequestMuxSai1Rx, kDmaRequestMuxSai2Rx } +#define I2S_DMA_REQ_SRC_TX { 0, kDmaRequestMuxSai1Tx, kDmaRequestMuxSai2Tx } +#define I2S_WM8960_RX_MODE (1) + +#define I2S_GPIO(_hwid, _fn, _mode, _pin, _iomux) \ + { \ + .hw_id = _hwid, \ + .fn = _fn, \ + .mode = _mode, \ + .name = MP_QSTR_##_pin, \ + .iomux = {_iomux}, \ + } + +#define I2S_GPIO_MAP \ + { \ + I2S_GPIO(1, MCK, TX, GPIO_AD_B1_09, IOMUXC_GPIO_AD_B1_09_SAI1_MCLK), \ + I2S_GPIO(1, SCK, RX, GPIO_AD_B1_11, IOMUXC_GPIO_AD_B1_11_SAI1_RX_BCLK), \ + I2S_GPIO(1, WS, RX, GPIO_AD_B1_10, IOMUXC_GPIO_AD_B1_10_SAI1_RX_SYNC), \ + I2S_GPIO(1, SD, RX, GPIO_AD_B1_12, IOMUXC_GPIO_AD_B1_12_SAI1_RX_DATA00), \ + I2S_GPIO(1, SCK, TX, GPIO_AD_B1_14, IOMUXC_GPIO_AD_B1_14_SAI1_TX_BCLK), \ + I2S_GPIO(1, WS, TX, GPIO_AD_B1_15, IOMUXC_GPIO_AD_B1_15_SAI1_TX_SYNC), \ + I2S_GPIO(1, SD, TX, GPIO_AD_B1_13, IOMUXC_GPIO_AD_B1_13_SAI1_TX_DATA00), \ + } + #define USDHC_DUMMY_PIN NULL, 0 #define MICROPY_USDHC1 \ { \ @@ -130,3 +160,6 @@ { IOMUXC_GPIO_B1_11_ENET_RX_ER, 0, 0xB0E9u }, \ { IOMUXC_GPIO_EMC_41_ENET_MDIO, 0, 0xB0E9u }, \ { IOMUXC_GPIO_EMC_40_ENET_MDC, 0, 0xB0E9u }, + +#define MICROPY_BOARD_ROOT_POINTERS \ + struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_I2S_NUM]; diff --git a/ports/mimxrt/boards/MIMXRT1064_EVK/pins.csv b/ports/mimxrt/boards/MIMXRT1064_EVK/pins.csv index 463079b129..4bdd9e4f03 100644 --- a/ports/mimxrt/boards/MIMXRT1064_EVK/pins.csv +++ b/ports/mimxrt/boards/MIMXRT1064_EVK/pins.csv @@ -29,3 +29,10 @@ SDI,GPIO_SD_B0_03 SDO,GPIO_SD_B0_02 CS,GPIO_SD_B0_01 LED_GREEN,GPIO_AD_B0_09 +MCK,GPIO_AD_B1_09 +SCK_RX,GPIO_AD_B1_11 +WS_RX,GPIO_AD_B1_10 +SD_RX,GPIO_AD_B1_12 +SCK_TX,GPIO_AD_B1_14 +WS_TX,GPIO_AD_B1_15 +SD_TX,GPIO_AD_B1_13 diff --git a/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.h b/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.h index e004050aee..c30caa0470 100644 --- a/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.h +++ b/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.h @@ -48,3 +48,39 @@ #define IOMUX_TABLE_I2C \ { IOMUXC_GPIO_AD_14_LPI2C1_SCL }, { IOMUXC_GPIO_AD_13_LPI2C1_SDA }, \ { IOMUXC_GPIO_AD_08_LPI2C2_SCL }, { IOMUXC_GPIO_AD_07_LPI2C2_SDA }, + +#define MICROPY_PY_MACHINE_I2S (1) +#define MICROPY_HW_I2S_NUM (3) +#define I2S_CLOCK_MUX { 0, kCLOCK_Sai1Mux, 0, kCLOCK_Sai3Mux } +#define I2S_CLOCK_PRE_DIV { 0, kCLOCK_Sai1PreDiv, 0, kCLOCK_Sai3PreDiv } +#define I2S_CLOCK_DIV { 0, kCLOCK_Sai1Div, 0, kCLOCK_Sai3Div } +#define I2S_IOMUXC_GPR_MODE { 0, kIOMUXC_GPR_SAI1MClkOutputDir, 0, kIOMUXC_GPR_SAI3MClkOutputDir } +#define I2S_DMA_REQ_SRC_RX { 0, kDmaRequestMuxSai1Rx, 0, kDmaRequestMuxSai3Rx } +#define I2S_DMA_REQ_SRC_TX { 0, kDmaRequestMuxSai1Tx, 0, kDmaRequestMuxSai3Tx } + +#define I2S_GPIO(_hwid, _fn, _mode, _pin, _iomux) \ + { \ + .hw_id = _hwid, \ + .fn = _fn, \ + .mode = _mode, \ + .name = MP_QSTR_##_pin, \ + .iomux = {_iomux}, \ + } + +#define I2S_GPIO_MAP \ + { \ + I2S_GPIO(1, MCK, TX, GPIO_08, IOMUXC_GPIO_08_SAI1_MCLK), /* pin D8 */ \ + I2S_GPIO(1, SCK, RX, GPIO_01, IOMUXC_GPIO_01_SAI1_RX_BCLK), /* pin D1 */ \ + I2S_GPIO(1, WS, RX, GPIO_02, IOMUXC_GPIO_02_SAI1_RX_SYNC), /* pin D2 */ \ + I2S_GPIO(1, SD, RX, GPIO_03, IOMUXC_GPIO_03_SAI1_RX_DATA00), /* pin D3 */ \ + I2S_GPIO(1, SCK, TX, GPIO_06, IOMUXC_GPIO_06_SAI1_TX_BCLK), /* pin D6 */ \ + I2S_GPIO(1, WS, TX, GPIO_07, IOMUXC_GPIO_07_SAI1_TX_SYNC), /* pin D7 */ \ + I2S_GPIO(1, SD, TX, GPIO_04, IOMUXC_GPIO_04_SAI1_TX_DATA00), /* pin D4 */ \ + I2S_GPIO(3, SCK, TX, GPIO_SD_01, IOMUXC_GPIO_SD_01_SAI3_TX_BCLK), /* pin D10 */ \ + I2S_GPIO(3, WS, TX, GPIO_SD_00, IOMUXC_GPIO_SD_00_SAI3_TX_SYNC), /* pin D9 */ \ + I2S_GPIO(3, SD, TX, GPIO_SD_02, IOMUXC_GPIO_SD_02_SAI3_TX_DATA) /* pin D11 */ \ + } + + +#define MICROPY_BOARD_ROOT_POINTERS \ + struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_I2S_NUM]; diff --git a/ports/mimxrt/boards/OLIMEX_RT1010/pins.csv b/ports/mimxrt/boards/OLIMEX_RT1010/pins.csv index d294f86b6d..d3c68aba2d 100644 --- a/ports/mimxrt/boards/OLIMEX_RT1010/pins.csv +++ b/ports/mimxrt/boards/OLIMEX_RT1010/pins.csv @@ -34,3 +34,10 @@ RX, GPIO_09 TX, GPIO_10 RELAY1,GPIO_SD_12 RELAY2,GPIO_SD_13 +MCK,GPIO_08 +SCK_RX,GPIO_01 +WS_RX,GPIO_02 +SD_RX,GPIO_03 +SCK_TX,GPIO_06 +WS_TX,GPIO_07 +SD_TX,GPIO_04 diff --git a/ports/mimxrt/boards/SEEED_ARCH_MIX/mpconfigboard.h b/ports/mimxrt/boards/SEEED_ARCH_MIX/mpconfigboard.h index 53a3d4ed78..a6502d3353 100644 --- a/ports/mimxrt/boards/SEEED_ARCH_MIX/mpconfigboard.h +++ b/ports/mimxrt/boards/SEEED_ARCH_MIX/mpconfigboard.h @@ -65,6 +65,35 @@ { IOMUXC_GPIO_B0_04_LPI2C2_SCL }, { IOMUXC_GPIO_B0_05_LPI2C2_SDA }, \ { IOMUXC_GPIO_AD_B1_07_LPI2C3_SCL }, { IOMUXC_GPIO_AD_B1_06_LPI2C3_SDA } +#define MICROPY_PY_MACHINE_I2S (1) +#define MICROPY_HW_I2S_NUM (1) +#define I2S_CLOCK_MUX { 0, kCLOCK_Sai1Mux } +#define I2S_CLOCK_PRE_DIV { 0, kCLOCK_Sai1PreDiv } +#define I2S_CLOCK_DIV { 0, kCLOCK_Sai1Div } +#define I2S_IOMUXC_GPR_MODE { 0, kIOMUXC_GPR_SAI1MClkOutputDir } +#define I2S_DMA_REQ_SRC_RX { 0, kDmaRequestMuxSai1Rx } +#define I2S_DMA_REQ_SRC_TX { 0, kDmaRequestMuxSai1Tx } + +#define I2S_GPIO(_hwid, _fn, _mode, _pin, _iomux) \ + { \ + .hw_id = _hwid, \ + .fn = _fn, \ + .mode = _mode, \ + .name = MP_QSTR_##_pin, \ + .iomux = {_iomux}, \ + } + +#define I2S_GPIO_MAP \ + { \ + I2S_GPIO(1, MCK, TX, GPIO_AD_B1_09, IOMUXC_GPIO_AD_B1_09_SAI1_MCLK), /* pin J4 09 */ \ + I2S_GPIO(1, SCK, RX, GPIO_AD_B1_11, IOMUXC_GPIO_AD_B1_11_SAI1_RX_BCLK), /* pin J4 11 */ \ + I2S_GPIO(1, WS, RX, GPIO_AD_B1_10, IOMUXC_GPIO_AD_B1_10_SAI1_RX_SYNC), /* pin J4 10 */ \ + I2S_GPIO(1, SD, RX, GPIO_AD_B1_12, IOMUXC_GPIO_AD_B1_12_SAI1_RX_DATA00), /* pin J4 12 */ \ + I2S_GPIO(1, SCK, TX, GPIO_AD_B1_14, IOMUXC_GPIO_AD_B1_14_SAI1_TX_BCLK), /* pin J4 14 */ \ + I2S_GPIO(1, WS, TX, GPIO_AD_B1_15, IOMUXC_GPIO_AD_B1_15_SAI1_TX_SYNC), /* pin J4 15 */ \ + I2S_GPIO(1, SD, TX, GPIO_AD_B1_13, IOMUXC_GPIO_AD_B1_13_SAI1_TX_DATA00) /* pin J4 13 */ \ + } + #define USDHC_DUMMY_PIN NULL, 0 #define MICROPY_USDHC1 \ @@ -144,3 +173,6 @@ #define MIMXRT_IOMUXC_SEMC_WE IOMUXC_GPIO_EMC_28_SEMC_WE #define MIMXRT_IOMUXC_SEMC_CS0 IOMUXC_GPIO_EMC_29_SEMC_CS0 + +#define MICROPY_BOARD_ROOT_POINTERS \ + struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_I2S_NUM]; diff --git a/ports/mimxrt/boards/SEEED_ARCH_MIX/pins.csv b/ports/mimxrt/boards/SEEED_ARCH_MIX/pins.csv index 0183795cd7..6b757fae4b 100644 --- a/ports/mimxrt/boards/SEEED_ARCH_MIX/pins.csv +++ b/ports/mimxrt/boards/SEEED_ARCH_MIX/pins.csv @@ -60,3 +60,10 @@ J5_50,GPIO_AD_B0_02 LED_RED,GPIO_AD_B0_09 LED_GREEN,GPIO_AD_B0_10 LED_BLUE,GPIO_AD_B0_11 +MCK,GPIO_AD_B1_09 +SCK_RX,GPIO_AD_B1_11 +WS_RX,GPIO_AD_B1_10 +SD_RX,GPIO_AD_B1_12 +SCK_TX,GPIO_AD_B1_14 +WS_TX,GPIO_AD_B1_15 +SD_TX,GPIO_AD_B1_13 diff --git a/ports/mimxrt/boards/TEENSY40/mpconfigboard.h b/ports/mimxrt/boards/TEENSY40/mpconfigboard.h index 08a774d886..f2ea86bd0e 100644 --- a/ports/mimxrt/boards/TEENSY40/mpconfigboard.h +++ b/ports/mimxrt/boards/TEENSY40/mpconfigboard.h @@ -58,6 +58,41 @@ { IOMUXC_GPIO_AD_B1_07_LPI2C3_SCL }, { IOMUXC_GPIO_AD_B1_06_LPI2C3_SDA }, \ { IOMUXC_GPIO_AD_B0_12_LPI2C4_SCL }, { IOMUXC_GPIO_AD_B0_13_LPI2C4_SDA }, +#define MICROPY_PY_MACHINE_I2S (1) +#define MICROPY_HW_I2S_NUM (2) +#define I2S_CLOCK_MUX { 0, kCLOCK_Sai1Mux, kCLOCK_Sai2Mux } +#define I2S_CLOCK_PRE_DIV { 0, kCLOCK_Sai1PreDiv, kCLOCK_Sai2PreDiv } +#define I2S_CLOCK_DIV { 0, kCLOCK_Sai1Div, kCLOCK_Sai2Div } +#define I2S_IOMUXC_GPR_MODE { 0, kIOMUXC_GPR_SAI1MClkOutputDir, kIOMUXC_GPR_SAI2MClkOutputDir } +#define I2S_DMA_REQ_SRC_RX { 0, kDmaRequestMuxSai1Rx, kDmaRequestMuxSai2Rx } +#define I2S_DMA_REQ_SRC_TX { 0, kDmaRequestMuxSai1Tx, kDmaRequestMuxSai2Tx } + +#define I2S_GPIO(_hwid, _fn, _mode, _pin, _iomux) \ + { \ + .hw_id = _hwid, \ + .fn = _fn, \ + .mode = _mode, \ + .name = MP_QSTR_##_pin, \ + .iomux = {_iomux}, \ + } + +#define I2S_GPIO_MAP \ + { \ + I2S_GPIO(1, SCK, RX, GPIO_AD_B1_11, IOMUXC_GPIO_AD_B1_11_SAI1_RX_BCLK), /* pin 21 */ \ + I2S_GPIO(1, WS, RX, GPIO_AD_B1_10, IOMUXC_GPIO_AD_B1_10_SAI1_RX_SYNC), /* pin 20 */ \ + I2S_GPIO(1, SD, RX, GPIO_B1_00, IOMUXC_GPIO_B1_00_SAI1_RX_DATA00), /* pin 8 */ \ + I2S_GPIO(1, SCK, TX, GPIO_AD_B1_14, IOMUXC_GPIO_AD_B1_14_SAI1_TX_BCLK), /* pin 26 */ \ + I2S_GPIO(1, SCK, TX, GPIO_B1_02, IOMUXC_GPIO_B1_02_SAI1_TX_BCLK), /* pin 36 */ \ + I2S_GPIO(1, WS, TX, GPIO_AD_B1_15, IOMUXC_GPIO_AD_B1_15_SAI1_TX_SYNC), /* pin 27 */ \ + I2S_GPIO(1, WS, TX, GPIO_B1_03, IOMUXC_GPIO_B1_03_SAI1_TX_SYNC), /* pin 37 */ \ + I2S_GPIO(1, SD, TX, GPIO_B1_01, IOMUXC_GPIO_B1_01_SAI1_TX_DATA00), /* pin 7 */ \ + I2S_GPIO(1, MCK, TX, GPIO_AD_B1_09, IOMUXC_GPIO_AD_B1_09_SAI1_MCLK), /* pin 23 */ \ + I2S_GPIO(2, SCK, TX, GPIO_EMC_06, IOMUXC_GPIO_EMC_06_SAI2_TX_BCLK), /* pin 4 */ \ + I2S_GPIO(2, WS, TX, GPIO_EMC_05, IOMUXC_GPIO_EMC_05_SAI2_TX_SYNC), /* pin 3 */ \ + I2S_GPIO(2, SD, TX, GPIO_EMC_04, IOMUXC_GPIO_EMC_04_SAI2_TX_DATA), /* pin 2 */ \ + I2S_GPIO(2, MCK, TX, GPIO_EMC_07, IOMUXC_GPIO_EMC_07_SAI2_MCLK) /* pin 33 */ \ + } + #define USDHC_DUMMY_PIN NULL, 0 #define MICROPY_USDHC1 \ { \ @@ -69,3 +104,6 @@ .data2 = { GPIO_SD_B0_04_USDHC1_DATA2 }, \ .data3 = { GPIO_SD_B0_05_USDHC1_DATA3 }, \ } + +#define MICROPY_BOARD_ROOT_POINTERS \ + struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_I2S_NUM]; diff --git a/ports/mimxrt/boards/TEENSY40/pins.csv b/ports/mimxrt/boards/TEENSY40/pins.csv index 0ea4f13731..b4509e5848 100644 --- a/ports/mimxrt/boards/TEENSY40/pins.csv +++ b/ports/mimxrt/boards/TEENSY40/pins.csv @@ -52,4 +52,11 @@ A10,GPIO_AD_B0_12 A11,GPIO_AD_B0_13 A12,GPIO_AD_B1_14 A13,GPIO_AD_B1_15 -LED,GPIO_B0_03 \ No newline at end of file +LED,GPIO_B0_03 +MCK,GPIO_AD_B1_09 +SCK_RX,GPIO_AD_B1_11 +WS_RX,GPIO_AD_B1_10 +SD_RX,GPIO_B1_00 +SCK_TX,GPIO_EMC_06 +WS_TX,GPIO_EMC_05 +SD_TX,GPIO_EMC_04 diff --git a/ports/mimxrt/boards/TEENSY41/mpconfigboard.h b/ports/mimxrt/boards/TEENSY41/mpconfigboard.h index 3b8d497c3f..7d75f62f36 100644 --- a/ports/mimxrt/boards/TEENSY41/mpconfigboard.h +++ b/ports/mimxrt/boards/TEENSY41/mpconfigboard.h @@ -58,6 +58,43 @@ { IOMUXC_GPIO_AD_B1_07_LPI2C3_SCL }, { IOMUXC_GPIO_AD_B1_06_LPI2C3_SDA }, \ { IOMUXC_GPIO_AD_B0_12_LPI2C4_SCL }, { IOMUXC_GPIO_AD_B0_13_LPI2C4_SDA }, +#define MICROPY_PY_MACHINE_I2S (1) +#define MICROPY_HW_I2S_NUM (2) +#define I2S_CLOCK_MUX { 0, kCLOCK_Sai1Mux, kCLOCK_Sai2Mux } +#define I2S_CLOCK_PRE_DIV { 0, kCLOCK_Sai1PreDiv, kCLOCK_Sai2PreDiv } +#define I2S_CLOCK_DIV { 0, kCLOCK_Sai1Div, kCLOCK_Sai2Div } +#define I2S_IOMUXC_GPR_MODE { 0, kIOMUXC_GPR_SAI1MClkOutputDir, kIOMUXC_GPR_SAI2MClkOutputDir } +#define I2S_DMA_REQ_SRC_RX { 0, kDmaRequestMuxSai1Rx, kDmaRequestMuxSai2Rx } +#define I2S_DMA_REQ_SRC_TX { 0, kDmaRequestMuxSai1Tx, kDmaRequestMuxSai2Tx } + +#define I2S_GPIO(_hwid, _fn, _mode, _pin, _iomux) \ + { \ + .hw_id = _hwid, \ + .fn = _fn, \ + .mode = _mode, \ + .name = MP_QSTR_##_pin, \ + .iomux = {_iomux}, \ + } + +#define I2S_GPIO_MAP \ + { \ + I2S_GPIO(1, SCK, RX, GPIO_AD_B1_11, IOMUXC_GPIO_AD_B1_11_SAI1_RX_BCLK), /* pin 21 */ \ + I2S_GPIO(1, WS, RX, GPIO_AD_B1_10, IOMUXC_GPIO_AD_B1_10_SAI1_RX_SYNC), /* pin 20 */ \ + I2S_GPIO(1, SD, RX, GPIO_AD_B1_12, IOMUXC_GPIO_AD_B1_12_SAI1_RX_DATA00), /* pin 38 */ \ + I2S_GPIO(1, SD, RX, GPIO_B1_00, IOMUXC_GPIO_B1_00_SAI1_RX_DATA00), /* pin 8 */ \ + I2S_GPIO(1, SCK, TX, GPIO_AD_B1_14, IOMUXC_GPIO_AD_B1_14_SAI1_TX_BCLK), /* pin 26 */ \ + I2S_GPIO(1, SCK, TX, GPIO_B1_02, IOMUXC_GPIO_B1_02_SAI1_TX_BCLK), /* pin 36 */ \ + I2S_GPIO(1, WS, TX, GPIO_AD_B1_15, IOMUXC_GPIO_AD_B1_15_SAI1_TX_SYNC), /* pin 27 */ \ + I2S_GPIO(1, WS, TX, GPIO_B1_03, IOMUXC_GPIO_B1_03_SAI1_TX_SYNC), /* pin 37 */ \ + I2S_GPIO(1, SD, TX, GPIO_AD_B1_13, IOMUXC_GPIO_AD_B1_13_SAI1_TX_DATA00), /* pin 39 */ \ + I2S_GPIO(1, SD, TX, GPIO_B1_01, IOMUXC_GPIO_B1_01_SAI1_TX_DATA00), /* pin 7 */ \ + I2S_GPIO(1, MCK, TX, GPIO_AD_B1_09, IOMUXC_GPIO_AD_B1_09_SAI1_MCLK), /* pin 23 */ \ + I2S_GPIO(2, SCK, TX, GPIO_EMC_06, IOMUXC_GPIO_EMC_06_SAI2_TX_BCLK), /* pin 4 */ \ + I2S_GPIO(2, WS, TX, GPIO_EMC_05, IOMUXC_GPIO_EMC_05_SAI2_TX_SYNC), /* pin 3 */ \ + I2S_GPIO(2, SD, TX, GPIO_EMC_04, IOMUXC_GPIO_EMC_04_SAI2_TX_DATA), /* pin 2 */ \ + I2S_GPIO(2, MCK, TX, GPIO_EMC_07, IOMUXC_GPIO_EMC_07_SAI2_MCLK) /* pin 33 */ \ + } + #define USDHC_DUMMY_PIN NULL, 0 #define MICROPY_USDHC1 \ { \ @@ -90,3 +127,6 @@ { IOMUXC_GPIO_B1_11_ENET_RX_ER, 0, 0xB0E9u }, \ { IOMUXC_GPIO_B1_15_ENET_MDIO, 0, 0xB0E9u }, \ { IOMUXC_GPIO_B1_14_ENET_MDC, 0, 0xB0E9u }, + +#define MICROPY_BOARD_ROOT_POINTERS \ + struct _machine_i2s_obj_t *machine_i2s_obj[MICROPY_HW_I2S_NUM]; diff --git a/ports/mimxrt/boards/TEENSY41/pins.csv b/ports/mimxrt/boards/TEENSY41/pins.csv index 88b91f2540..b28a22312c 100755 --- a/ports/mimxrt/boards/TEENSY41/pins.csv +++ b/ports/mimxrt/boards/TEENSY41/pins.csv @@ -80,4 +80,11 @@ A10,GPIO_AD_B0_12 A11,GPIO_AD_B0_13 A12,GPIO_AD_B1_14 A13,GPIO_AD_B1_15 -LED,GPIO_B0_03 \ No newline at end of file +LED,GPIO_B0_03 +MCK,GPIO_AD_B1_09 +SCK_RX,GPIO_AD_B1_11 +WS_RX,GPIO_AD_B1_10 +SD_RX,GPIO_B1_00 +SCK_TX,GPIO_EMC_06 +WS_TX,GPIO_EMC_05 +SD_TX,GPIO_EMC_04 diff --git a/ports/mimxrt/dma_channel.c b/ports/mimxrt/dma_manager.c similarity index 86% rename from ports/mimxrt/dma_channel.c rename to ports/mimxrt/dma_manager.c index c6cae9da9c..2890a15586 100644 --- a/ports/mimxrt/dma_channel.c +++ b/ports/mimxrt/dma_manager.c @@ -24,7 +24,10 @@ * THE SOFTWARE. */ -#include "dma_channel.h" +#include +#include "py/mpconfig.h" +#include "fsl_edma.h" +#include "dma_manager.h" // List of channel flags: true: channel used, false: channel available static bool channel_list[FSL_FEATURE_DMAMUX_MODULE_CHANNEL] = { @@ -39,6 +42,8 @@ static bool channel_list[FSL_FEATURE_DMAMUX_MODULE_CHANNEL] = { #endif }; +STATIC bool dma_initialized = false; + // allocate_channel(): retrieve an available channel. Return the number or -1 int allocate_dma_channel(void) { for (int i = 0; i < ARRAY_SIZE(channel_list); i++) { @@ -56,3 +61,12 @@ void free_dma_channel(int n) { channel_list[n] = false; } } + +void dma_init(void) { + if (!dma_initialized) { + edma_config_t dmaConfig; + EDMA_GetDefaultConfig(&dmaConfig); + EDMA_Init(DMA0, &dmaConfig); + dma_initialized = true; + } +} diff --git a/ports/mimxrt/dma_channel.h b/ports/mimxrt/dma_manager.h similarity index 98% rename from ports/mimxrt/dma_channel.h rename to ports/mimxrt/dma_manager.h index 3fe66a3dbb..77e9689b22 100644 --- a/ports/mimxrt/dma_channel.h +++ b/ports/mimxrt/dma_manager.h @@ -30,5 +30,6 @@ int allocate_dma_channel(void); void free_dma_channel(int n); +void dma_init(void); #endif // MICROPY_INCLUDED_MIMXRT_DMACHANNEL_H diff --git a/ports/mimxrt/machine_i2s.c b/ports/mimxrt/machine_i2s.c new file mode 100644 index 0000000000..a41dfe94f1 --- /dev/null +++ b/ports/mimxrt/machine_i2s.c @@ -0,0 +1,1228 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 Mike Teachman + * Copyright (c) 2022 Robert Hammelrath + * + * 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 +#include +#include + +#include "py/obj.h" +#include "py/runtime.h" +#include "py/mphal.h" +#include "py/misc.h" +#include "py/stream.h" +#include "py/objstr.h" +#include "modmachine.h" +#include "dma_manager.h" + +#include "clock_config.h" +#include "fsl_iomuxc.h" +#include "fsl_dmamux.h" +#include "fsl_edma.h" +#include "fsl_sai.h" + +#if MICROPY_PY_MACHINE_I2S +// The I2S module has 3 modes of operation: +// +// Mode1: Blocking +// - readinto() and write() methods block until the supplied buffer is filled (read) or emptied (write) +// - this is the default mode of operation +// +// Mode2: Non-Blocking +// - readinto() and write() methods return immediately +// - buffer filling and emptying happens asynchronously to the main MicroPython task +// - a callback function is called when the supplied buffer has been filled (read) or emptied (write) +// - non-blocking mode is enabled when a callback is set with the irq() method +// - the DMA callback is used to implement the asynchronous background operations +// +// Mode3: Uasyncio +// - implements the stream protocol +// - uasyncio mode is enabled when the ioctl() function is called +// - the state of the internal ring buffer is used to detect that I2S samples can be read or written +// +// The samples contained in the app buffer supplied for the readinto() and write() methods have the following convention: +// Mono: little endian format +// Stereo: little endian format, left channel first +// +// I2S terms: +// "frame": consists of two audio samples (Left audio sample + Right audio sample) +// +// Misc: +// - for Mono configuration: +// - readinto method: samples are gathered from the L channel only +// - write method: every sample is output to both the L and R channels +// - for readinto method the I2S hardware is read using 8-byte frames +// (this is standard for almost all I2S hardware, such as MEMS microphones) +// - all 3 Modes of operation are implemented using the peripheral drivers in the NXP MCUXpresso SDK +// - all sample data transfers use DMA +// - the DMA ping-pong buffer needs to be aligned to a cache line size of 32 bytes. 32 byte +// alignment is needed to use the routines that clean and invalidate D-Cache which work on a +// 32 byte address boundary. +// - master clock frequency is sampling frequency * 256 + +// DMA ping-pong buffer size was empirically determined. It is a tradeoff between: +// 1. memory use (smaller buffer size desirable to reduce memory footprint) +// 2. interrupt frequency (larger buffer size desirable to reduce interrupt frequency) +// The sizeof 1/2 of the DMA buffer must be evenly divisible by the cache line size of 32 bytes. +#define SIZEOF_DMA_BUFFER_IN_BYTES (256) +#define SIZEOF_HALF_DMA_BUFFER_IN_BYTES (SIZEOF_DMA_BUFFER_IN_BYTES / 2) + +// For non-blocking mode, to avoid underflow/overflow, sample data is written/read to/from the ring buffer at a rate faster +// than the DMA transfer rate +#define NON_BLOCKING_RATE_MULTIPLIER (4) +#define SIZEOF_NON_BLOCKING_COPY_IN_BYTES (SIZEOF_HALF_DMA_BUFFER_IN_BYTES * NON_BLOCKING_RATE_MULTIPLIER) + +#define NUM_I2S_USER_FORMATS (4) +#define I2S_RX_FRAME_SIZE_IN_BYTES (8) +#define AUDIO_PLL_CLOCK (2U) +#define SAI_CHANNEL_0 (0) +#define SAI_NUM_AUDIO_CHANNELS (2U) + +typedef enum { + SCK, + WS, + SD, + MCK +} i2s_pin_function_t; + +typedef enum { + RX, + TX, +} i2s_mode_t; + +typedef enum { + MONO, + STEREO +} format_t; + +typedef enum { + BLOCKING, + NON_BLOCKING, + UASYNCIO +} io_mode_t; + +typedef enum { + TOP_HALF, + BOTTOM_HALF +} ping_pong_t; + +typedef struct _ring_buf_t { + uint8_t *buffer; + size_t head; + size_t tail; + size_t size; +} ring_buf_t; + +typedef struct _non_blocking_descriptor_t { + mp_buffer_info_t appbuf; + uint32_t index; + bool copy_in_progress; +} non_blocking_descriptor_t; + +typedef struct _machine_i2s_obj_t { + mp_obj_base_t base; + uint8_t i2s_id; + mp_hal_pin_obj_t sck; + mp_hal_pin_obj_t ws; + mp_hal_pin_obj_t sd; + mp_hal_pin_obj_t mck; + i2s_mode_t mode; + int8_t bits; + format_t format; + int32_t rate; + int32_t ibuf; + mp_obj_t callback_for_non_blocking; + uint8_t dma_buffer[SIZEOF_DMA_BUFFER_IN_BYTES + 0x1f]; // 0x1f related to D-Cache alignment + uint8_t *dma_buffer_dcache_aligned; + ring_buf_t ring_buffer; + uint8_t *ring_buffer_storage; + non_blocking_descriptor_t non_blocking_descriptor; + io_mode_t io_mode; + I2S_Type *i2s_inst; + int dma_channel; + edma_handle_t edmaHandle; + edma_tcd_t *edmaTcd; +} machine_i2s_obj_t; + +typedef struct _iomux_table_t { + uint32_t muxRegister; + uint32_t muxMode; + uint32_t inputRegister; + uint32_t inputDaisy; + uint32_t configRegister; +} iomux_table_t; + +typedef struct _gpio_map_t { + uint8_t hw_id; + i2s_pin_function_t fn; + i2s_mode_t mode; + qstr name; + iomux_table_t iomux; +} gpio_map_t; + +typedef struct _i2s_clock_config_t { + sai_sample_rate_t rate; + const clock_audio_pll_config_t *pll_config; + uint32_t clock_pre_divider; + uint32_t clock_divider; +} i2s_clock_config_t; + +STATIC mp_obj_t machine_i2s_deinit(mp_obj_t self_in); + +// The frame map is used with the readinto() method to transform the audio sample data coming +// from DMA memory (32-bit stereo) to the format specified +// in the I2S constructor. e.g. 16-bit mono +STATIC const int8_t i2s_frame_map[NUM_I2S_USER_FORMATS][I2S_RX_FRAME_SIZE_IN_BYTES] = { + {-1, -1, 0, 1, -1, -1, -1, -1 }, // Mono, 16-bits + { 0, 1, 2, 3, -1, -1, -1, -1 }, // Mono, 32-bits + {-1, -1, 0, 1, -1, -1, 2, 3 }, // Stereo, 16-bits + { 0, 1, 2, 3, 4, 5, 6, 7 }, // Stereo, 32-bits +}; + +// 2 PLL configurations +// PLL output frequency = 24MHz * (.loopDivider + .numerator/.denominator) + +// Configuration 1: for sampling frequencies [Hz]: 8000, 12000, 16000, 24000, 32000, 48000 +// Clock frequency = 786,432,480 Hz +STATIC const clock_audio_pll_config_t audioPllConfig_8000_48000 = { + .loopDivider = 32, // PLL loop divider. Valid range for DIV_SELECT divider value: 27~54 + .postDivider = 1, // Divider after the PLL, should only be 1, 2, 4, 8, 16 + .numerator = 76802, // 30 bit numerator of fractional loop divider + .denominator = 100000, // 30 bit denominator of fractional loop divider + .src = kCLOCK_PllClkSrc24M // Pll clock source +}; + +// Configuration 2: for sampling frequencies [Hz]: 11025, 22050, 44100 +// Clock frequency = 722,534,880 +STATIC const clock_audio_pll_config_t audioPllConfig_11025_44100 = { + .loopDivider = 30, // PLL loop divider. Valid range for DIV_SELECT divider value: 27~54 + .postDivider = 1, // Divider after the PLL, should only be 1, 2, 4, 8, 16 + .numerator = 10562, // 30 bit numerator of fractional loop divider + .denominator = 100000, // 30 bit denominator of fractional loop divider + .src = kCLOCK_PllClkSrc24M // Pll clock source +}; + +STATIC const i2s_clock_config_t clock_config_map[] = { + {kSAI_SampleRate8KHz, &audioPllConfig_8000_48000, 5, 63}, + {kSAI_SampleRate11025Hz, &audioPllConfig_11025_44100, 3, 63}, + {kSAI_SampleRate12KHz, &audioPllConfig_8000_48000, 3, 63}, + {kSAI_SampleRate16KHz, &audioPllConfig_8000_48000, 2, 63}, + {kSAI_SampleRate22050Hz, &audioPllConfig_11025_44100, 1, 63}, + {kSAI_SampleRate24KHz, &audioPllConfig_8000_48000, 1, 63}, + {kSAI_SampleRate32KHz, &audioPllConfig_8000_48000, 1, 47}, + {kSAI_SampleRate44100Hz, &audioPllConfig_11025_44100, 0, 63}, + {kSAI_SampleRate48KHz, &audioPllConfig_8000_48000, 0, 63} +}; + +STATIC const I2S_Type *i2s_base_ptr[] = I2S_BASE_PTRS; +STATIC const clock_mux_t i2s_clock_mux[] = I2S_CLOCK_MUX; +STATIC const clock_div_t i2s_clock_pre_div[] = I2S_CLOCK_PRE_DIV; +STATIC const clock_div_t i2s_clock_div[] = I2S_CLOCK_DIV; +STATIC const iomuxc_gpr_mode_t i2s_iomuxc_gpr_mode[] = I2S_IOMUXC_GPR_MODE; +STATIC const dma_request_source_t i2s_dma_req_src_tx[] = I2S_DMA_REQ_SRC_TX; +STATIC const dma_request_source_t i2s_dma_req_src_rx[] = I2S_DMA_REQ_SRC_RX; +STATIC const gpio_map_t i2s_gpio_map[] = I2S_GPIO_MAP; +AT_NONCACHEABLE_SECTION_ALIGN(STATIC edma_tcd_t edmaTcd[MICROPY_HW_I2S_NUM], 32); + +// called on processor reset +void machine_i2s_init0() { + for (uint8_t i = 0; i < MICROPY_HW_I2S_NUM; i++) { + MP_STATE_PORT(machine_i2s_obj)[i] = NULL; + } +} + +// called on soft reboot +void machine_i2s_deinit_all(void) { + for (uint8_t i = 0; i < MICROPY_HW_I2S_NUM; i++) { + machine_i2s_obj_t *i2s_obj = MP_STATE_PORT(machine_i2s_obj)[i]; + if (i2s_obj != NULL) { + machine_i2s_deinit(i2s_obj); + MP_STATE_PORT(machine_i2s_obj)[i] = NULL; + } + } +} + +// Ring Buffer +// Thread safe when used with these constraints: +// - Single Producer, Single Consumer +// - Sequential atomic operations +// One byte of capacity is used to detect buffer empty/full + +STATIC void ringbuf_init(ring_buf_t *rbuf, uint8_t *buffer, size_t size) { + rbuf->buffer = buffer; + rbuf->size = size; + rbuf->head = 0; + rbuf->tail = 0; +} + +STATIC bool ringbuf_push(ring_buf_t *rbuf, uint8_t data) { + size_t next_tail = (rbuf->tail + 1) % rbuf->size; + + if (next_tail != rbuf->head) { + rbuf->buffer[rbuf->tail] = data; + rbuf->tail = next_tail; + return true; + } + + // full + return false; +} + +STATIC bool ringbuf_pop(ring_buf_t *rbuf, uint8_t *data) { + if (rbuf->head == rbuf->tail) { + // empty + return false; + } + + *data = rbuf->buffer[rbuf->head]; + rbuf->head = (rbuf->head + 1) % rbuf->size; + return true; +} + +STATIC bool ringbuf_is_empty(ring_buf_t *rbuf) { + return rbuf->head == rbuf->tail; +} + +STATIC bool ringbuf_is_full(ring_buf_t *rbuf) { + return ((rbuf->tail + 1) % rbuf->size) == rbuf->head; +} + +STATIC size_t ringbuf_available_data(ring_buf_t *rbuf) { + return (rbuf->tail - rbuf->head + rbuf->size) % rbuf->size; +} + +STATIC size_t ringbuf_available_space(ring_buf_t *rbuf) { + return rbuf->size - ringbuf_available_data(rbuf) - 1; +} + +STATIC int8_t get_frame_mapping_index(int8_t bits, format_t format) { + if (format == MONO) { + if (bits == 16) { + return 0; + } else { // 32 bits + return 1; + } + } else { // STEREO + if (bits == 16) { + return 2; + } else { // 32 bits + return 3; + } + } +} + +STATIC int8_t get_dma_bits(uint16_t mode, int8_t bits) { + if (mode == TX) { + if (bits == 16) { + return 16; + } else { + return 32; + } + return bits; + } else { // RX + // always read 32 bit words for I2S e.g. I2S MEMS microphones + return 32; + } +} + +STATIC bool lookup_gpio(const machine_pin_obj_t *pin, i2s_pin_function_t fn, uint8_t hw_id, uint16_t *index) { + for (uint16_t i = 0; i < ARRAY_SIZE(i2s_gpio_map); i++) { + if ((pin->name == i2s_gpio_map[i].name) && + (i2s_gpio_map[i].fn == fn) && + (i2s_gpio_map[i].hw_id == hw_id)) { + *index = i; + return true; + } + } + return false; +} + +STATIC bool set_iomux(const machine_pin_obj_t *pin, i2s_pin_function_t fn, uint8_t hw_id) { + uint16_t mapping_index; + if (lookup_gpio(pin, fn, hw_id, &mapping_index)) { + iomux_table_t iom = i2s_gpio_map[mapping_index].iomux; + IOMUXC_SetPinMux(iom.muxRegister, iom.muxMode, iom.inputRegister, iom.inputDaisy, iom.configRegister, 1U); + IOMUXC_SetPinConfig(iom.muxRegister, iom.muxMode, iom.inputRegister, iom.inputDaisy, iom.configRegister, + pin_generate_config(PIN_PULL_DISABLED, PIN_MODE_OUT, 2, iom.configRegister)); + return true; + } else { + return false; + } +} + +STATIC bool is_rate_supported(int32_t rate) { + for (uint16_t i = 0; i < ARRAY_SIZE(clock_config_map); i++) { + if (clock_config_map[i].rate == rate) { + return true; + } + } + return false; +} + +STATIC const clock_audio_pll_config_t *get_pll_config(int32_t rate) { + for (uint16_t i = 0; i < ARRAY_SIZE(clock_config_map); i++) { + if (clock_config_map[i].rate == rate) { + return clock_config_map[i].pll_config; + } + } + return 0; +} + +STATIC const uint32_t get_clock_pre_divider(int32_t rate) { + for (uint16_t i = 0; i < ARRAY_SIZE(clock_config_map); i++) { + if (clock_config_map[i].rate == rate) { + return clock_config_map[i].clock_pre_divider; + } + } + return 0; +} + +STATIC const uint32_t get_clock_divider(int32_t rate) { + for (uint16_t i = 0; i < ARRAY_SIZE(clock_config_map); i++) { + if (clock_config_map[i].rate == rate) { + return clock_config_map[i].clock_divider; + } + } + return 0; +} + +STATIC uint32_t fill_appbuf_from_ringbuf(machine_i2s_obj_t *self, mp_buffer_info_t *appbuf) { + + // copy audio samples from the ring buffer to the app buffer + // loop, copying samples until the app buffer is filled + // For uasyncio mode, the loop will make an early exit if the ring buffer becomes empty + // Example: + // a MicroPython I2S object is configured for 16-bit mono (2 bytes per audio sample). + // For every frame coming from the ring buffer (8 bytes), 2 bytes are "cherry picked" and + // copied to the supplied app buffer. + // Thus, for every 1 byte copied to the app buffer, 4 bytes are read from the ring buffer. + // If a 8kB app buffer is supplied, 32kB of audio samples is read from the ring buffer. + + uint32_t num_bytes_copied_to_appbuf = 0; + uint8_t *app_p = (uint8_t *)appbuf->buf; + uint8_t appbuf_sample_size_in_bytes = (self->bits == 16? 2 : 4) * (self->format == STEREO ? 2: 1); + uint32_t num_bytes_needed_from_ringbuf = appbuf->len * (I2S_RX_FRAME_SIZE_IN_BYTES / appbuf_sample_size_in_bytes); + uint8_t discard_byte; + while (num_bytes_needed_from_ringbuf) { + + uint8_t f_index = get_frame_mapping_index(self->bits, self->format); + + for (uint8_t i = 0; i < I2S_RX_FRAME_SIZE_IN_BYTES; i++) { + int8_t r_to_a_mapping = i2s_frame_map[f_index][i]; + if (r_to_a_mapping != -1) { + if (self->io_mode == BLOCKING) { + // poll the ringbuf until a sample becomes available, copy into appbuf using the mapping transform + while (ringbuf_pop(&self->ring_buffer, app_p + r_to_a_mapping) == false) { + ; + } + num_bytes_copied_to_appbuf++; + } else if (self->io_mode == UASYNCIO) { + if (ringbuf_pop(&self->ring_buffer, app_p + r_to_a_mapping) == false) { + // ring buffer is empty, exit + goto exit; + } else { + num_bytes_copied_to_appbuf++; + } + } else { + return 0; // should never get here (non-blocking mode does not use this function) + } + } else { // r_a_mapping == -1 + // discard unused byte from ring buffer + if (self->io_mode == BLOCKING) { + // poll the ringbuf until a sample becomes available + while (ringbuf_pop(&self->ring_buffer, &discard_byte) == false) { + ; + } + } else if (self->io_mode == UASYNCIO) { + if (ringbuf_pop(&self->ring_buffer, &discard_byte) == false) { + // ring buffer is empty, exit + goto exit; + } + } else { + return 0; // should never get here (non-blocking mode does not use this function) + } + } + num_bytes_needed_from_ringbuf--; + } + app_p += appbuf_sample_size_in_bytes; + } +exit: + return num_bytes_copied_to_appbuf; +} + +// function is used in IRQ context +STATIC void fill_appbuf_from_ringbuf_non_blocking(machine_i2s_obj_t *self) { + + // attempt to copy a block of audio samples from the ring buffer to the supplied app buffer. + // audio samples will be formatted as part of the copy operation + + uint32_t num_bytes_copied_to_appbuf = 0; + uint8_t *app_p = &(((uint8_t *)self->non_blocking_descriptor.appbuf.buf)[self->non_blocking_descriptor.index]); + + uint8_t appbuf_sample_size_in_bytes = (self->bits == 16? 2 : 4) * (self->format == STEREO ? 2: 1); + uint32_t num_bytes_remaining_to_copy_to_appbuf = self->non_blocking_descriptor.appbuf.len - self->non_blocking_descriptor.index; + uint32_t num_bytes_remaining_to_copy_from_ring_buffer = num_bytes_remaining_to_copy_to_appbuf * + (I2S_RX_FRAME_SIZE_IN_BYTES / appbuf_sample_size_in_bytes); + uint32_t num_bytes_needed_from_ringbuf = MIN(SIZEOF_NON_BLOCKING_COPY_IN_BYTES, num_bytes_remaining_to_copy_from_ring_buffer); + uint8_t discard_byte; + if (ringbuf_available_data(&self->ring_buffer) >= num_bytes_needed_from_ringbuf) { + while (num_bytes_needed_from_ringbuf) { + + uint8_t f_index = get_frame_mapping_index(self->bits, self->format); + + for (uint8_t i = 0; i < I2S_RX_FRAME_SIZE_IN_BYTES; i++) { + int8_t r_to_a_mapping = i2s_frame_map[f_index][i]; + if (r_to_a_mapping != -1) { + ringbuf_pop(&self->ring_buffer, app_p + r_to_a_mapping); + num_bytes_copied_to_appbuf++; + } else { // r_a_mapping == -1 + // discard unused byte from ring buffer + ringbuf_pop(&self->ring_buffer, &discard_byte); + } + num_bytes_needed_from_ringbuf--; + } + app_p += appbuf_sample_size_in_bytes; + } + self->non_blocking_descriptor.index += num_bytes_copied_to_appbuf; + + if (self->non_blocking_descriptor.index >= self->non_blocking_descriptor.appbuf.len) { + self->non_blocking_descriptor.copy_in_progress = false; + mp_sched_schedule(self->callback_for_non_blocking, MP_OBJ_FROM_PTR(self)); + } + } +} + +STATIC uint32_t copy_appbuf_to_ringbuf(machine_i2s_obj_t *self, mp_buffer_info_t *appbuf) { + + // copy audio samples from the app buffer to the ring buffer + // loop, reading samples until the app buffer is emptied + // for uasyncio mode, the loop will make an early exit if the ring buffer becomes full + + uint32_t a_index = 0; + + while (a_index < appbuf->len) { + if (self->io_mode == BLOCKING) { + // copy a byte to the ringbuf when space becomes available + while (ringbuf_push(&self->ring_buffer, ((uint8_t *)appbuf->buf)[a_index]) == false) { + ; + } + a_index++; + } else if (self->io_mode == UASYNCIO) { + if (ringbuf_push(&self->ring_buffer, ((uint8_t *)appbuf->buf)[a_index]) == false) { + // ring buffer is full, exit + break; + } else { + a_index++; + } + } else { + return 0; // should never get here (non-blocking mode does not use this function) + } + } + + return a_index; +} + +// function is used in IRQ context +STATIC void copy_appbuf_to_ringbuf_non_blocking(machine_i2s_obj_t *self) { + + // copy audio samples from app buffer into ring buffer + uint32_t num_bytes_remaining_to_copy = self->non_blocking_descriptor.appbuf.len - self->non_blocking_descriptor.index; + uint32_t num_bytes_to_copy = MIN(SIZEOF_NON_BLOCKING_COPY_IN_BYTES, num_bytes_remaining_to_copy); + + if (ringbuf_available_space(&self->ring_buffer) >= num_bytes_to_copy) { + for (uint32_t i = 0; i < num_bytes_to_copy; i++) { + ringbuf_push(&self->ring_buffer, + ((uint8_t *)self->non_blocking_descriptor.appbuf.buf)[self->non_blocking_descriptor.index + i]); + } + + self->non_blocking_descriptor.index += num_bytes_to_copy; + if (self->non_blocking_descriptor.index >= self->non_blocking_descriptor.appbuf.len) { + self->non_blocking_descriptor.copy_in_progress = false; + mp_sched_schedule(self->callback_for_non_blocking, MP_OBJ_FROM_PTR(self)); + } + } +} + +// function is used in IRQ context +STATIC void empty_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) { + uint16_t dma_buffer_offset = 0; + + if (dma_ping_pong == TOP_HALF) { + dma_buffer_offset = 0; + } else { // BOTTOM_HALF + dma_buffer_offset = SIZEOF_HALF_DMA_BUFFER_IN_BYTES; + } + + uint8_t *dma_buffer_p = &self->dma_buffer_dcache_aligned[dma_buffer_offset]; + + // flush and invalidate cache so the CPU reads data placed into RAM by DMA + MP_HAL_CLEANINVALIDATE_DCACHE(dma_buffer_p, SIZEOF_HALF_DMA_BUFFER_IN_BYTES); + + // when space exists, copy samples into ring buffer + if (ringbuf_available_space(&self->ring_buffer) >= SIZEOF_HALF_DMA_BUFFER_IN_BYTES) { + for (uint32_t i = 0; i < SIZEOF_HALF_DMA_BUFFER_IN_BYTES; i++) { + ringbuf_push(&self->ring_buffer, dma_buffer_p[i]); + } + } +} + +// function is used in IRQ context +STATIC void feed_dma(machine_i2s_obj_t *self, ping_pong_t dma_ping_pong) { + uint16_t dma_buffer_offset = 0; + + if (dma_ping_pong == TOP_HALF) { + dma_buffer_offset = 0; + } else { // BOTTOM_HALF + dma_buffer_offset = SIZEOF_HALF_DMA_BUFFER_IN_BYTES; + } + + uint8_t *dma_buffer_p = &self->dma_buffer_dcache_aligned[dma_buffer_offset]; + + // when data exists, copy samples from ring buffer + if (ringbuf_available_data(&self->ring_buffer) >= SIZEOF_HALF_DMA_BUFFER_IN_BYTES) { + + // copy a block of samples from the ring buffer to the dma buffer. + // mono format is implemented by duplicating each sample into both L and R channels. + if ((self->format == MONO) && (self->bits == 16)) { + for (uint32_t i = 0; i < SIZEOF_HALF_DMA_BUFFER_IN_BYTES / 4; i++) { + for (uint8_t b = 0; b < sizeof(uint16_t); b++) { + ringbuf_pop(&self->ring_buffer, &dma_buffer_p[i * 4 + b]); + dma_buffer_p[i * 4 + b + 2] = dma_buffer_p[i * 4 + b]; // duplicated mono sample + } + } + } else if ((self->format == MONO) && (self->bits == 32)) { + for (uint32_t i = 0; i < SIZEOF_HALF_DMA_BUFFER_IN_BYTES / 8; i++) { + for (uint8_t b = 0; b < sizeof(uint32_t); b++) { + ringbuf_pop(&self->ring_buffer, &dma_buffer_p[i * 8 + b]); + dma_buffer_p[i * 8 + b + 4] = dma_buffer_p[i * 8 + b]; // duplicated mono sample + } + } + } else { // STEREO, both 16-bit and 32-bit + for (uint32_t i = 0; i < SIZEOF_HALF_DMA_BUFFER_IN_BYTES; i++) { + ringbuf_pop(&self->ring_buffer, &dma_buffer_p[i]); + } + } + } else { + // underflow. clear buffer to transmit "silence" on the I2S bus + memset(dma_buffer_p, 0, SIZEOF_HALF_DMA_BUFFER_IN_BYTES); + } + + // flush cache to RAM so DMA can read the sample data + MP_HAL_CLEAN_DCACHE(dma_buffer_p, SIZEOF_HALF_DMA_BUFFER_IN_BYTES); +} + +STATIC void edma_i2s_callback(edma_handle_t *handle, void *userData, bool transferDone, uint32_t tcds) { + machine_i2s_obj_t *self = userData; + + if (self->mode == TX) { + // for non-blocking mode, sample copying (appbuf->ibuf) is initiated in this callback routine + if ((self->io_mode == NON_BLOCKING) && (self->non_blocking_descriptor.copy_in_progress)) { + copy_appbuf_to_ringbuf_non_blocking(self); + } + + if (transferDone) { + // bottom half of buffer now emptied, + // safe to fill the bottom half while the top half of buffer is being emptied + feed_dma(self, BOTTOM_HALF); + } else { + // top half of buffer now emptied, + // safe to fill the top half while the bottom half of buffer is being emptied + feed_dma(self, TOP_HALF); + } + } else { // RX + if (transferDone) { + // bottom half of buffer now filled, + // safe to empty the bottom half while the top half of buffer is being filled + empty_dma(self, BOTTOM_HALF); + } else { + // top half of buffer now filled, + // safe to empty the top half while the bottom half of buffer is being filled + empty_dma(self, TOP_HALF); + } + + // for non-blocking mode, sample copying (ibuf->appbuf) is initiated in this callback routine + if ((self->io_mode == NON_BLOCKING) && (self->non_blocking_descriptor.copy_in_progress)) { + fill_appbuf_from_ringbuf_non_blocking(self); + } + } +} + +STATIC bool i2s_init(machine_i2s_obj_t *self) { + + CLOCK_InitAudioPll(get_pll_config(self->rate)); + CLOCK_SetMux(i2s_clock_mux[self->i2s_id], AUDIO_PLL_CLOCK); + CLOCK_SetDiv(i2s_clock_pre_div[self->i2s_id], get_clock_pre_divider(self->rate)); + CLOCK_SetDiv(i2s_clock_div[self->i2s_id], get_clock_divider(self->rate)); + + if (!set_iomux(self->sck, SCK, self->i2s_id)) { + return false; + } + + if (!set_iomux(self->ws, WS, self->i2s_id)) { + return false; + } + + if (!set_iomux(self->sd, SD, self->i2s_id)) { + return false; + } + + if (self->mck) { + if (!set_iomux(self->mck, MCK, self->i2s_id)) { + return false; + } + IOMUXC_EnableMode(IOMUXC_GPR, i2s_iomuxc_gpr_mode[self->i2s_id], true); + } + + self->dma_channel = allocate_dma_channel(); + + DMAMUX_Init(DMAMUX); + if (self->mode == TX) { + DMAMUX_SetSource(DMAMUX, self->dma_channel, i2s_dma_req_src_tx[self->i2s_id]); + } else { // RX + DMAMUX_SetSource(DMAMUX, self->dma_channel, i2s_dma_req_src_rx[self->i2s_id]); + } + DMAMUX_EnableChannel(DMAMUX, self->dma_channel); + + dma_init(); + EDMA_CreateHandle(&self->edmaHandle, DMA0, self->dma_channel); + EDMA_SetCallback(&self->edmaHandle, edma_i2s_callback, self); + EDMA_ResetChannel(DMA0, self->dma_channel); + + SAI_Init(self->i2s_inst); + + sai_transceiver_t saiConfig; + SAI_GetClassicI2SConfig(&saiConfig, get_dma_bits(self->mode, self->bits), kSAI_Stereo, kSAI_Channel0Mask); + saiConfig.masterSlave = kSAI_Master; + + uint16_t sck_index; + lookup_gpio(self->sck, SCK, self->i2s_id, &sck_index); + + if ((self->mode == TX) && (i2s_gpio_map[sck_index].mode == TX)) { + saiConfig.syncMode = kSAI_ModeAsync; + SAI_TxSetConfig(self->i2s_inst, &saiConfig); + } else if ((self->mode == RX) && (i2s_gpio_map[sck_index].mode == RX)) { + saiConfig.syncMode = kSAI_ModeAsync; + SAI_RxSetConfig(self->i2s_inst, &saiConfig); + } else if ((self->mode == TX) && (i2s_gpio_map[sck_index].mode == RX)) { + saiConfig.syncMode = kSAI_ModeAsync; + SAI_RxSetConfig(self->i2s_inst, &saiConfig); + saiConfig.bitClock.bclkSrcSwap = true; + saiConfig.syncMode = kSAI_ModeSync; + SAI_TxSetConfig(self->i2s_inst, &saiConfig); + } else if ((self->mode == RX) && (i2s_gpio_map[sck_index].mode == TX)) { + saiConfig.syncMode = kSAI_ModeAsync; + SAI_TxSetConfig(self->i2s_inst, &saiConfig); + saiConfig.syncMode = kSAI_ModeSync; + SAI_RxSetConfig(self->i2s_inst, &saiConfig); + } else { + return false; // should never happen + } + + uint32_t clock_freq = + (CLOCK_GetFreq(kCLOCK_AudioPllClk) / (get_clock_divider(self->rate) + 1U) / + (get_clock_pre_divider(self->rate) + 1U)); + + SAI_TxSetBitClockRate(self->i2s_inst, clock_freq, self->rate, get_dma_bits(self->mode, self->bits), + SAI_NUM_AUDIO_CHANNELS); + SAI_RxSetBitClockRate(self->i2s_inst, clock_freq, self->rate, get_dma_bits(self->mode, self->bits), + SAI_NUM_AUDIO_CHANNELS); + + edma_transfer_config_t transferConfig; + uint8_t bytes_per_sample = get_dma_bits(self->mode, self->bits) / 8; + + if (self->mode == TX) { + uint32_t destAddr = SAI_TxGetDataRegisterAddress(self->i2s_inst, SAI_CHANNEL_0); + EDMA_PrepareTransfer(&transferConfig, + self->dma_buffer_dcache_aligned, bytes_per_sample, + (void *)destAddr, bytes_per_sample, + (FSL_FEATURE_SAI_FIFO_COUNT - saiConfig.fifo.fifoWatermark) * bytes_per_sample, + SIZEOF_DMA_BUFFER_IN_BYTES, kEDMA_MemoryToPeripheral); + } else { // RX + uint32_t srcAddr = SAI_RxGetDataRegisterAddress(self->i2s_inst, SAI_CHANNEL_0); + EDMA_PrepareTransfer(&transferConfig, + (void *)srcAddr, bytes_per_sample, + self->dma_buffer_dcache_aligned, bytes_per_sample, + (FSL_FEATURE_SAI_FIFO_COUNT - saiConfig.fifo.fifoWatermark) * bytes_per_sample, + SIZEOF_DMA_BUFFER_IN_BYTES, kEDMA_PeripheralToMemory); + } + + memset(self->edmaTcd, 0, sizeof(edma_tcd_t)); + + // continuous DMA operation is acheived using the scatter/gather feature, with one TCD linked back to itself + EDMA_TcdSetTransferConfig(self->edmaTcd, &transferConfig, self->edmaTcd); + EDMA_TcdEnableInterrupts(self->edmaTcd, kEDMA_MajorInterruptEnable | kEDMA_HalfInterruptEnable); + EDMA_InstallTCD(DMA0, self->dma_channel, self->edmaTcd); + EDMA_StartTransfer(&self->edmaHandle); + + if (self->mode == TX) { + SAI_TxEnableDMA(self->i2s_inst, kSAI_FIFORequestDMAEnable, true); + SAI_TxEnable(self->i2s_inst, true); + SAI_TxSetChannelFIFOMask(self->i2s_inst, kSAI_Channel0Mask); + } else { // RX + SAI_RxEnableDMA(self->i2s_inst, kSAI_FIFORequestDMAEnable, true); + SAI_RxEnable(self->i2s_inst, true); + SAI_RxSetChannelFIFOMask(self->i2s_inst, kSAI_Channel0Mask); + } + + return true; +} + +STATIC void machine_i2s_init_helper(machine_i2s_obj_t *self, size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + + enum { + ARG_sck, + ARG_ws, + ARG_sd, + ARG_mck, + ARG_mode, + ARG_bits, + ARG_format, + ARG_rate, + ARG_ibuf, + }; + + static const mp_arg_t allowed_args[] = { + { MP_QSTR_sck, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_ws, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_sd, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_mck, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_mode, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = -1} }, + { MP_QSTR_bits, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = -1} }, + { MP_QSTR_format, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = -1} }, + { MP_QSTR_rate, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = -1} }, + { MP_QSTR_ibuf, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = -1} }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_pos_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + // + // ---- Check validity of arguments ---- + // + + // is Mode valid? + uint16_t i2s_mode = args[ARG_mode].u_int; + if ((i2s_mode != (RX)) && + (i2s_mode != (TX))) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid mode")); + } + + // are I2S pin assignments valid? + uint16_t not_used; + + // is SCK valid? + const machine_pin_obj_t *pin_sck = pin_find(args[ARG_sck].u_obj); + if (!lookup_gpio(pin_sck, SCK, self->i2s_id, ¬_used)) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid SCK pin")); + } + + // is WS valid? + const machine_pin_obj_t *pin_ws = pin_find(args[ARG_ws].u_obj); + if (!lookup_gpio(pin_ws, WS, self->i2s_id, ¬_used)) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid WS pin")); + } + + // is SD valid? + const machine_pin_obj_t *pin_sd = pin_find(args[ARG_sd].u_obj); + uint16_t mapping_index; + bool invalid_sd = true; + if (lookup_gpio(pin_sd, SD, self->i2s_id, &mapping_index)) { + if (i2s_mode == i2s_gpio_map[mapping_index].mode) { + invalid_sd = false; + } + } + + if (invalid_sd) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid SD pin")); + } + + // is MCK defined and valid? + const machine_pin_obj_t *pin_mck = NULL; + if (args[ARG_mck].u_obj != mp_const_none) { + pin_mck = pin_find(args[ARG_mck].u_obj); + if (!lookup_gpio(pin_mck, MCK, self->i2s_id, ¬_used)) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid MCK pin")); + } + } + + // is Bits valid? + int8_t i2s_bits = args[ARG_bits].u_int; + if ((i2s_bits != 16) && + (i2s_bits != 32)) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid bits")); + } + + // is Format valid? + format_t i2s_format = args[ARG_format].u_int; + if ((i2s_format != MONO) && + (i2s_format != STEREO)) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid format")); + } + + // is Rate valid? + int32_t i2s_rate = args[ARG_rate].u_int; + if (!is_rate_supported(i2s_rate)) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid rate")); + } + + // is Ibuf valid? + int32_t ring_buffer_len = args[ARG_ibuf].u_int; + if (ring_buffer_len > 0) { + uint8_t *buffer = m_new(uint8_t, ring_buffer_len); + self->ring_buffer_storage = buffer; + ringbuf_init(&self->ring_buffer, buffer, ring_buffer_len); + } else { + mp_raise_ValueError(MP_ERROR_TEXT("invalid ibuf")); + } + + self->sck = pin_sck; + self->ws = pin_ws; + self->sd = pin_sd; + self->mck = pin_mck; + self->mode = i2s_mode; + self->bits = i2s_bits; + self->format = i2s_format; + self->rate = i2s_rate; + self->ibuf = ring_buffer_len; + self->callback_for_non_blocking = MP_OBJ_NULL; + self->non_blocking_descriptor.copy_in_progress = false; + self->io_mode = BLOCKING; + self->i2s_inst = (I2S_Type *)i2s_base_ptr[self->i2s_id]; + + // init the I2S bus + if (!i2s_init(self)) { + mp_raise_msg_varg(&mp_type_OSError, MP_ERROR_TEXT("I2S init failed")); + } +} + +STATIC void machine_i2s_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { + machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_printf(print, "I2S(id=%u,\n" + "sck="MP_HAL_PIN_FMT ",\n" + "ws="MP_HAL_PIN_FMT ",\n" + "sd="MP_HAL_PIN_FMT ",\n" + "mck="MP_HAL_PIN_FMT ",\n" + "mode=%u,\n" + "bits=%u, format=%u,\n" + "rate=%d, ibuf=%d)", + self->i2s_id, + mp_hal_pin_name(self->sck), + mp_hal_pin_name(self->ws), + mp_hal_pin_name(self->sd), + mp_hal_pin_name(self->mck), + self->mode, + self->bits, self->format, + self->rate, self->ibuf + ); +} + +STATIC mp_obj_t machine_i2s_make_new(const mp_obj_type_t *type, size_t n_pos_args, size_t n_kw_args, const mp_obj_t *args) { + mp_arg_check_num(n_pos_args, n_kw_args, 1, MP_OBJ_FUN_ARGS_MAX, true); + uint8_t i2s_id = mp_obj_get_int(args[0]); + + if (i2s_id < 1 || i2s_id > MICROPY_HW_I2S_NUM) { + mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("I2S(%d) does not exist"), i2s_id); + } + + uint8_t i2s_id_zero_base = i2s_id - 1; + + machine_i2s_obj_t *self; + if (MP_STATE_PORT(machine_i2s_obj)[i2s_id_zero_base] == NULL) { + self = m_new_obj(machine_i2s_obj_t); + MP_STATE_PORT(machine_i2s_obj)[i2s_id_zero_base] = self; + self->base.type = &machine_i2s_type; + self->i2s_id = i2s_id; + self->edmaTcd = &edmaTcd[i2s_id_zero_base]; + } else { + self = MP_STATE_PORT(machine_i2s_obj)[i2s_id_zero_base]; + machine_i2s_deinit(MP_OBJ_FROM_PTR(self)); + } + + // align DMA buffer to the cache line size (32 bytes) + self->dma_buffer_dcache_aligned = (uint8_t *)((uint32_t)(self->dma_buffer + 0x1f) & ~0x1f); + + // fill the DMA buffer with NULLs + memset(self->dma_buffer_dcache_aligned, 0, SIZEOF_DMA_BUFFER_IN_BYTES); + + mp_map_t kw_args; + mp_map_init_fixed_table(&kw_args, n_kw_args, args + n_pos_args); + machine_i2s_init_helper(self, n_pos_args - 1, args + 1, &kw_args); + return MP_OBJ_FROM_PTR(self); +} + +STATIC mp_obj_t machine_i2s_init(size_t n_pos_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + machine_i2s_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + machine_i2s_deinit(MP_OBJ_FROM_PTR(self)); + machine_i2s_init_helper(self, n_pos_args - 1, pos_args + 1, kw_args); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2s_init_obj, 1, machine_i2s_init); + +STATIC mp_obj_t machine_i2s_deinit(mp_obj_t self_in) { + machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in); + + // use self->i2s_inst as in indication that I2S object has already been de-initialized + if (self->i2s_inst != NULL) { + EDMA_AbortTransfer(&self->edmaHandle); + + if (self->mode == TX) { + SAI_TxSetChannelFIFOMask(self->i2s_inst, 0); + SAI_TxEnableDMA(self->i2s_inst, kSAI_FIFORequestDMAEnable, false); + SAI_TxEnable(self->i2s_inst, false); + SAI_TxReset(self->i2s_inst); + } else { // RX + SAI_RxSetChannelFIFOMask(self->i2s_inst, 0); + SAI_RxEnableDMA(self->i2s_inst, kSAI_FIFORequestDMAEnable, false); + SAI_RxEnable(self->i2s_inst, false); + SAI_RxReset(self->i2s_inst); + } + + SAI_Deinit(self->i2s_inst); + free_dma_channel(self->dma_channel); + m_free(self->ring_buffer_storage); + self->i2s_inst = NULL; // flag object as de-initialized + } + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(machine_i2s_deinit_obj, machine_i2s_deinit); + +STATIC mp_obj_t machine_i2s_irq(mp_obj_t self_in, mp_obj_t handler) { + machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in); + if (handler != mp_const_none && !mp_obj_is_callable(handler)) { + mp_raise_ValueError(MP_ERROR_TEXT("invalid callback")); + } + + if (handler != mp_const_none) { + self->io_mode = NON_BLOCKING; + } else { + self->io_mode = BLOCKING; + } + + self->callback_for_non_blocking = handler; + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_i2s_irq_obj, machine_i2s_irq); + +// Shift() is typically used as a volume control. +// shift=1 increases volume by 6dB, shift=-1 decreases volume by 6dB +STATIC mp_obj_t machine_i2s_shift(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_buf, ARG_bits, ARG_shift}; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_buf, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_bits, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, + { MP_QSTR_shift, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, + }; + + // parse args + 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_buffer_info_t bufinfo; + mp_get_buffer_raise(args[ARG_buf].u_obj, &bufinfo, MP_BUFFER_RW); + + int16_t *buf_16 = bufinfo.buf; + int32_t *buf_32 = bufinfo.buf; + + uint8_t bits = args[ARG_bits].u_int; + int8_t shift = args[ARG_shift].u_int; + + uint32_t num_audio_samples; + switch (bits) { + case 16: + num_audio_samples = bufinfo.len / sizeof(uint16_t); + break; + + case 32: + num_audio_samples = bufinfo.len / sizeof(uint32_t); + break; + + default: + mp_raise_ValueError(MP_ERROR_TEXT("invalid bits")); + break; + } + + for (uint32_t i = 0; i < num_audio_samples; i++) { + switch (bits) { + case 16: + if (shift >= 0) { + buf_16[i] = buf_16[i] << shift; + } else { + buf_16[i] = buf_16[i] >> abs(shift); + } + break; + case 32: + if (shift >= 0) { + buf_32[i] = buf_32[i] << shift; + } else { + buf_32[i] = buf_32[i] >> abs(shift); + } + break; + } + } + + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(machine_i2s_shift_fun_obj, 0, machine_i2s_shift); +STATIC MP_DEFINE_CONST_STATICMETHOD_OBJ(machine_i2s_shift_obj, MP_ROM_PTR(&machine_i2s_shift_fun_obj)); + +STATIC const mp_rom_map_elem_t machine_i2s_locals_dict_table[] = { + // Methods + { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&machine_i2s_init_obj) }, + { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&mp_stream_readinto_obj) }, + { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&mp_stream_write_obj) }, + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&machine_i2s_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR_irq), MP_ROM_PTR(&machine_i2s_irq_obj) }, + + // Static method + { MP_ROM_QSTR(MP_QSTR_shift), MP_ROM_PTR(&machine_i2s_shift_obj) }, + + // Constants + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_INT(RX) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_INT(TX) }, + { MP_ROM_QSTR(MP_QSTR_STEREO), MP_ROM_INT(STEREO) }, + { MP_ROM_QSTR(MP_QSTR_MONO), MP_ROM_INT(MONO) }, +}; +MP_DEFINE_CONST_DICT(machine_i2s_locals_dict, machine_i2s_locals_dict_table); + +STATIC mp_uint_t machine_i2s_stream_read(mp_obj_t self_in, void *buf_in, mp_uint_t size, int *errcode) { + machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in); + + if (self->mode != RX) { + *errcode = MP_EPERM; + return MP_STREAM_ERROR; + } + + uint8_t appbuf_sample_size_in_bytes = (self->bits / 8) * (self->format == STEREO ? 2: 1); + if (size % appbuf_sample_size_in_bytes != 0) { + *errcode = MP_EINVAL; + return MP_STREAM_ERROR; + } + + if (size == 0) { + return 0; + } + + if (self->io_mode == NON_BLOCKING) { + self->non_blocking_descriptor.appbuf.buf = (void *)buf_in; + self->non_blocking_descriptor.appbuf.len = size; + self->non_blocking_descriptor.index = 0; + self->non_blocking_descriptor.copy_in_progress = true; + return size; + } else { // blocking or uasyncio mode + mp_buffer_info_t appbuf; + appbuf.buf = (void *)buf_in; + appbuf.len = size; + uint32_t num_bytes_read = fill_appbuf_from_ringbuf(self, &appbuf); + return num_bytes_read; + } +} + +STATIC mp_uint_t machine_i2s_stream_write(mp_obj_t self_in, const void *buf_in, mp_uint_t size, int *errcode) { + machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in); + + if (self->mode != TX) { + *errcode = MP_EPERM; + return MP_STREAM_ERROR; + } + + if (size == 0) { + return 0; + } + + if (self->io_mode == NON_BLOCKING) { + self->non_blocking_descriptor.appbuf.buf = (void *)buf_in; + self->non_blocking_descriptor.appbuf.len = size; + self->non_blocking_descriptor.index = 0; + self->non_blocking_descriptor.copy_in_progress = true; + return size; + } else { // blocking or uasyncio mode + mp_buffer_info_t appbuf; + appbuf.buf = (void *)buf_in; + appbuf.len = size; + uint32_t num_bytes_written = copy_appbuf_to_ringbuf(self, &appbuf); + return num_bytes_written; + } +} + +STATIC mp_uint_t machine_i2s_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg, int *errcode) { + machine_i2s_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_uint_t ret; + uintptr_t flags = arg; + self->io_mode = UASYNCIO; // a call to ioctl() is an indication that uasyncio is being used + + if (request == MP_STREAM_POLL) { + ret = 0; + + if (flags & MP_STREAM_POLL_RD) { + if (self->mode != RX) { + *errcode = MP_EPERM; + return MP_STREAM_ERROR; + } + + if (!ringbuf_is_empty(&self->ring_buffer)) { + ret |= MP_STREAM_POLL_RD; + } + } + + if (flags & MP_STREAM_POLL_WR) { + if (self->mode != TX) { + *errcode = MP_EPERM; + return MP_STREAM_ERROR; + } + + if (!ringbuf_is_full(&self->ring_buffer)) { + ret |= MP_STREAM_POLL_WR; + } + } + } else { + *errcode = MP_EINVAL; + ret = MP_STREAM_ERROR; + } + + return ret; +} + +STATIC const mp_stream_p_t i2s_stream_p = { + .read = machine_i2s_stream_read, + .write = machine_i2s_stream_write, + .ioctl = machine_i2s_ioctl, + .is_text = false, +}; + +const mp_obj_type_t machine_i2s_type = { + { &mp_type_type }, + .name = MP_QSTR_I2S, + .print = machine_i2s_print, + .getiter = mp_identity_getiter, + .iternext = mp_stream_unbuffered_iter, + .protocol = &i2s_stream_p, + .make_new = machine_i2s_make_new, + .locals_dict = (mp_obj_dict_t *)&machine_i2s_locals_dict, +}; + +#endif // MICROPY_PY_MACHINE_I2S diff --git a/ports/mimxrt/machine_spi.c b/ports/mimxrt/machine_spi.c index e25e219c79..b8b5a4d5b5 100644 --- a/ports/mimxrt/machine_spi.c +++ b/ports/mimxrt/machine_spi.c @@ -30,7 +30,7 @@ #include "py/mperrno.h" #include "extmod/machine_spi.h" #include "modmachine.h" -#include "dma_channel.h" +#include "dma_manager.h" #include "fsl_cache.h" #include "fsl_dmamux.h" @@ -256,8 +256,6 @@ STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8 bool use_dma = chan_rx >= 0 && chan_tx >= 0; if (use_dma) { - edma_config_t userConfig; - /* DMA MUX init*/ DMAMUX_Init(DMAMUX); @@ -267,8 +265,7 @@ STATIC void machine_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8 DMAMUX_SetSource(DMAMUX, chan_tx, dma_req_src_tx[self->spi_hw_id]); DMAMUX_EnableChannel(DMAMUX, chan_tx); - EDMA_GetDefaultConfig(&userConfig); - EDMA_Init(DMA0, &userConfig); + dma_init(); lpspi_master_edma_handle_t g_master_edma_handle; edma_handle_t lpspiEdmaMasterRxRegToRxDataHandle; diff --git a/ports/mimxrt/main.c b/ports/mimxrt/main.c index a6a0d2e196..82e07868a1 100644 --- a/ports/mimxrt/main.c +++ b/ports/mimxrt/main.c @@ -113,6 +113,9 @@ int main(void) { soft_reset_exit: mp_printf(MP_PYTHON_PRINTER, "MPY: soft reboot\n"); machine_pin_irq_deinit(); + #if MICROPY_PY_MACHINE_I2S + machine_i2s_deinit_all(); + #endif #if MICROPY_PY_NETWORK mod_network_deinit(); #endif diff --git a/ports/mimxrt/modmachine.c b/ports/mimxrt/modmachine.c index 63cec05507..d2358c5069 100644 --- a/ports/mimxrt/modmachine.c +++ b/ports/mimxrt/modmachine.c @@ -131,6 +131,9 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SoftI2C), MP_ROM_PTR(&mp_machine_soft_i2c_type) }, { MP_ROM_QSTR(MP_QSTR_SoftSPI), MP_ROM_PTR(&mp_machine_soft_spi_type) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&machine_i2c_type) }, + #if MICROPY_PY_MACHINE_I2S + { MP_ROM_QSTR(MP_QSTR_I2S), MP_ROM_PTR(&machine_i2s_type) }, + #endif { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&machine_spi_type) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&machine_uart_type) }, { MP_ROM_QSTR(MP_QSTR_WDT), MP_ROM_PTR(&machine_wdt_type) }, diff --git a/ports/mimxrt/modmachine.h b/ports/mimxrt/modmachine.h index d18a227624..6502eea09f 100644 --- a/ports/mimxrt/modmachine.h +++ b/ports/mimxrt/modmachine.h @@ -31,6 +31,7 @@ extern const mp_obj_type_t machine_adc_type; extern const mp_obj_type_t machine_i2c_type; +extern const mp_obj_type_t machine_i2s_type; extern const mp_obj_type_t machine_pwm_type; extern const mp_obj_type_t machine_rtc_type; extern const mp_obj_type_t machine_sdcard_type; @@ -45,5 +46,7 @@ void machine_pwm_deinit_all(void); void machine_timer_init_PIT(void); void machine_sdcard_init0(void); void mimxrt_sdram_init(void); +void machine_i2s_init0(); +void machine_i2s_deinit_all(void); #endif // MICROPY_INCLUDED_MIMXRT_MODMACHINE_H diff --git a/ports/mimxrt/mpconfigport.h b/ports/mimxrt/mpconfigport.h index b4df533f4a..8572f69354 100644 --- a/ports/mimxrt/mpconfigport.h +++ b/ports/mimxrt/mpconfigport.h @@ -140,6 +140,9 @@ uint32_t trng_random_u32(void); #define MICROPY_PY_MACHINE_PWM_DUTY_U16_NS (1) #define MICROPY_PY_MACHINE_PWM_INCLUDEFILE "ports/mimxrt/machine_pwm.c" #define MICROPY_PY_MACHINE_I2C (1) +#ifndef MICROPY_PY_MACHINE_I2S +#define MICROPY_PY_MACHINE_I2S (0) +#endif #define MICROPY_PY_MACHINE_SOFTI2C (1) #define MICROPY_PY_MACHINE_SPI (1) #define MICROPY_PY_MACHINE_SOFTSPI (1) @@ -277,6 +280,10 @@ extern const struct _mp_obj_type_t network_lan_type; #define MICROPY_HW_PIT_NUM_CHANNELS 3 +#ifndef MICROPY_BOARD_ROOT_POINTERS +#define MICROPY_BOARD_ROOT_POINTERS +#endif + #define MICROPY_PORT_ROOT_POINTERS \ const char *readline_hist[8]; \ struct _machine_timer_obj_t *timer_table[MICROPY_HW_PIT_NUM_CHANNELS]; \ @@ -285,6 +292,8 @@ extern const struct _mp_obj_type_t network_lan_type; mp_obj_list_t mod_network_nic_list; \ /* root pointers for sub-systems */ \ MICROPY_PORT_ROOT_POINTER_MBEDTLS \ + /* root pointers defined by a board */ \ + MICROPY_BOARD_ROOT_POINTERS \ #define MP_STATE_PORT MP_STATE_VM @@ -298,6 +307,10 @@ extern const struct _mp_obj_type_t network_lan_type; #define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1)) +#define MP_HAL_CLEANINVALIDATE_DCACHE(addr, size) \ + (SCB_CleanInvalidateDCache_by_Addr((uint32_t *)((uint32_t)addr & ~0x1f), \ + ((uint32_t)((uint8_t *)addr + size + 0x1f) & ~0x1f) - ((uint32_t)addr & ~0x1f))) + #define MP_HAL_CLEAN_DCACHE(addr, size) \ (SCB_CleanDCache_by_Addr((uint32_t *)((uint32_t)addr & ~0x1f), \ ((uint32_t)((uint8_t *)addr + size + 0x1f) & ~0x1f) - ((uint32_t)addr & ~0x1f))) diff --git a/ports/mimxrt/sdcard.c b/ports/mimxrt/sdcard.c index 1a9a97b681..31853b400e 100644 --- a/ports/mimxrt/sdcard.c +++ b/ports/mimxrt/sdcard.c @@ -822,7 +822,7 @@ bool sdcard_write(mimxrt_sdcard_obj_t *card, uint8_t *buffer, uint32_t block_num .command = &command, }; - status_t status = sdcard_transfer_blocking(card->usdhc_inst, &card->handle, &transfer, 500); + status_t status = sdcard_transfer_blocking(card->usdhc_inst, &card->handle, &transfer, 3000); if (status == kStatus_Success) { card->status = command.response[0]; From 3e70be8ee9973cffb6b9e8b721bf13b42510b739 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 30 Mar 2022 14:10:31 +1100 Subject: [PATCH 0271/1712] tests/extmod: Update I2S rate test to work on mimxrt. Tested on Teensy 4.0. Signed-off-by: Damien George --- tests/extmod/machine_i2s_rate.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/tests/extmod/machine_i2s_rate.py b/tests/extmod/machine_i2s_rate.py index 46e94585b7..d2cd1ae105 100644 --- a/tests/extmod/machine_i2s_rate.py +++ b/tests/extmod/machine_i2s_rate.py @@ -13,18 +13,24 @@ if "pyboard" in sys.platform: i2s_id = 2 sck_pin = Pin("Y6") ws_pin = Pin("Y5") - sd_pin = Pin("Y8") + sd_tx_pin = sd_rx_pin = Pin("Y8") elif "rp2" in sys.platform: i2s_id = 1 sck_pin = Pin(0) ws_pin = Pin(1) - sd_pin = Pin(2) + sd_tx_pin = sd_rx_pin = Pin(2) +elif "mimxrt" in sys.platform: + i2s_id = 1 + sck_pin = Pin(26) + ws_pin = Pin(27) + sd_tx_pin = Pin(7) + sd_rx_pin = Pin(8) TEST_BYTES = b"01234567" RATE = 11025 # frames/sec -def test(mode, bits_per_sample, frame_format): +def test(mode, sd_pin, bits_per_sample, frame_format): i2s = I2S( i2s_id, sck=sck_pin, @@ -70,11 +76,11 @@ def test(mode, bits_per_sample, frame_format): print(mode_str, bits_per_sample, channels, abs(dt - 500) <= 4) -test(I2S.TX, 16, I2S.MONO) -test(I2S.TX, 16, I2S.STEREO) -test(I2S.TX, 32, I2S.MONO) -test(I2S.TX, 32, I2S.STEREO) -test(I2S.RX, 16, I2S.MONO) -test(I2S.RX, 16, I2S.STEREO) -test(I2S.RX, 32, I2S.MONO) -test(I2S.RX, 32, I2S.STEREO) +test(I2S.TX, sd_tx_pin, 16, I2S.MONO) +test(I2S.TX, sd_tx_pin, 16, I2S.STEREO) +test(I2S.TX, sd_tx_pin, 32, I2S.MONO) +test(I2S.TX, sd_tx_pin, 32, I2S.STEREO) +test(I2S.RX, sd_rx_pin, 16, I2S.MONO) +test(I2S.RX, sd_rx_pin, 16, I2S.STEREO) +test(I2S.RX, sd_rx_pin, 32, I2S.MONO) +test(I2S.RX, sd_rx_pin, 32, I2S.STEREO) From 4c252ae067a4798fe11c2ce56a9734c1e64846a8 Mon Sep 17 00:00:00 2001 From: Waterlens Date: Fri, 18 Mar 2022 17:47:24 +0800 Subject: [PATCH 0272/1712] tools/mpremote: Allow running mpremote with `python -m`. This is helpful because some scripts are likely to use mpremote with a specific python path. --- tools/mpremote/mpremote/__main__.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tools/mpremote/mpremote/__main__.py diff --git a/tools/mpremote/mpremote/__main__.py b/tools/mpremote/mpremote/__main__.py new file mode 100644 index 0000000000..a91ff67b15 --- /dev/null +++ b/tools/mpremote/mpremote/__main__.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import sys +from mpremote import main + +sys.exit(main.main()) From dc8b43adc721a253b9b4de655ef3c4b85937862a Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Thu, 17 Feb 2022 11:45:45 +1100 Subject: [PATCH 0273/1712] nrf/drivers/usb: Fix background events/scheduling while at USB REPL. --- ports/nrf/drivers/usb/usb_cdc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/nrf/drivers/usb/usb_cdc.c b/ports/nrf/drivers/usb/usb_cdc.c index 9d7c832e20..fa098c98b8 100644 --- a/ports/nrf/drivers/usb/usb_cdc.c +++ b/ports/nrf/drivers/usb/usb_cdc.c @@ -198,6 +198,7 @@ int mp_hal_stdin_rx_chr(void) { if (cdc_rx_any()) { return cdc_rx_char(); } + MICROPY_EVENT_POLL_HOOK } return 0; From f92da1adc41f8a354c1ca2b7c9b53f0c45d02e87 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Tue, 1 Mar 2022 21:34:05 +1100 Subject: [PATCH 0274/1712] nrf/drivers/usb: Fix MP_STREAM_POLL_RD support on USB CDC. This gets ipoll working on USB CDC stdin. --- ports/nrf/drivers/usb/usb_cdc.c | 12 ++++++++++++ ports/nrf/mphalport.c | 4 +--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ports/nrf/drivers/usb/usb_cdc.c b/ports/nrf/drivers/usb/usb_cdc.c index fa098c98b8..a1d411a256 100644 --- a/ports/nrf/drivers/usb/usb_cdc.c +++ b/ports/nrf/drivers/usb/usb_cdc.c @@ -34,6 +34,7 @@ #include "nrfx_power.h" #include "nrfx_uart.h" #include "py/ringbuf.h" +#include "py/stream.h" #ifdef BLUETOOTH_SD #include "nrf_sdm.h" @@ -192,6 +193,17 @@ void usb_cdc_sd_event_handler(uint32_t soc_evt) { } #endif +uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) { + uintptr_t ret = 0; + if (poll_flags & MP_STREAM_POLL_RD) { + usb_cdc_loop(); + if (cdc_rx_any()) { + ret |= MP_STREAM_POLL_RD; + } + } + return ret; +} + int mp_hal_stdin_rx_chr(void) { for (;;) { usb_cdc_loop(); diff --git a/ports/nrf/mphalport.c b/ports/nrf/mphalport.c index 8ffb256018..1b31ad5acc 100644 --- a/ports/nrf/mphalport.c +++ b/ports/nrf/mphalport.c @@ -172,7 +172,7 @@ void mp_hal_set_interrupt_char(int c) { } #endif -#if !MICROPY_PY_BLE_NUS +#if !MICROPY_PY_BLE_NUS && !MICROPY_HW_USB_CDC uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) { uintptr_t ret = 0; if ((poll_flags & MP_STREAM_POLL_RD) && MP_STATE_PORT(board_stdio_uart) != NULL @@ -181,9 +181,7 @@ uintptr_t mp_hal_stdio_poll(uintptr_t poll_flags) { } return ret; } -#endif -#if !MICROPY_PY_BLE_NUS && !MICROPY_HW_USB_CDC int mp_hal_stdin_rx_chr(void) { for (;;) { if (MP_STATE_PORT(board_stdio_uart) != NULL && uart_rx_any(MP_STATE_PORT(board_stdio_uart))) { From 303e222f70501664b7f8b1118ae8682064387cd6 Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Tue, 1 Mar 2022 21:34:57 +1100 Subject: [PATCH 0275/1712] nrf/modules: Include uasyncio in default board manifest. --- ports/nrf/modules/manifest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/nrf/modules/manifest.py b/ports/nrf/modules/manifest.py index 4e8482226b..b27d4648b7 100644 --- a/ports/nrf/modules/manifest.py +++ b/ports/nrf/modules/manifest.py @@ -1 +1,2 @@ freeze("$(PORT_DIR)/modules/scripts", "_mkfs.py") +include("$(MPY_DIR)/extmod/uasyncio/manifest.py") From 6b23f7d3011ce89aeb00bc510eba97e5e36cd180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Meri=C3=A7=20SARII=C5=9EIK?= Date: Mon, 7 Feb 2022 15:41:17 +0100 Subject: [PATCH 0276/1712] stm32/sdio: Use runtime calculation for clock divider of sdio on H7. STM32H7 family has a different calculation compared to the current one for the SDMMC clock divider configuration. --- ports/stm32/sdio.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ports/stm32/sdio.c b/ports/stm32/sdio.c index bedafcb138..99d05a5155 100644 --- a/ports/stm32/sdio.c +++ b/ports/stm32/sdio.c @@ -96,6 +96,19 @@ static volatile uint8_t *sdmmc_buf_top; #define MICROPY_HW_SDIO_CMD (pin_D2) #endif +#if defined(STM32H7) +static uint32_t safe_divide(uint32_t denom) { + uint32_t num = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_SDMMC); + uint32_t divres; + + divres = num / (2U * denom); + if ((num % (2U * denom)) > denom) { + divres++; + } + return divres; +} +#endif + void sdio_init(uint32_t irq_pri) { // configure IO pins mp_hal_pin_config_alt_static(MICROPY_HW_SDIO_D0, MP_HAL_PIN_MODE_ALT, MP_HAL_PIN_PULL_UP, STATIC_AF_SDMMC_D0); @@ -110,6 +123,8 @@ void sdio_init(uint32_t irq_pri) { SDMMC_TypeDef *SDIO = SDMMC; #if defined(STM32F7) SDIO->CLKCR = SDMMC_CLKCR_HWFC_EN | SDMMC_CLKCR_PWRSAV | (120 - 2); // 1-bit, 400kHz + #elif defined(STM32H7) + SDIO->CLKCR = SDMMC_CLKCR_HWFC_EN | SDMMC_CLKCR_PWRSAV | safe_divide(400000U); // 1-bit, 400kHz #else SDIO->CLKCR = SDMMC_CLKCR_HWFC_EN | SDMMC_CLKCR_PWRSAV | (120 / 2); // 1-bit, 400kHz #endif @@ -157,6 +172,8 @@ void sdio_enable_high_speed_4bit(void) { mp_hal_delay_us(10); #if defined(STM32F7) SDIO->CLKCR = SDMMC_CLKCR_HWFC_EN | SDMMC_CLKCR_WIDBUS_0 | SDMMC_CLKCR_BYPASS /*| SDMMC_CLKCR_PWRSAV*/; // 4-bit, 48MHz + #elif defined(STM32H7) + SDIO->CLKCR = SDMMC_CLKCR_HWFC_EN | SDMMC_CLKCR_WIDBUS_0 | safe_divide(48000000U); // 4-bit, 48MHz #else SDIO->CLKCR = SDMMC_CLKCR_HWFC_EN | SDMMC_CLKCR_WIDBUS_0; // 4-bit, 48MHz #endif From a41bc5a7cadb5bea9b7800286b2f4ea4f9b26e1a Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Wed, 23 Feb 2022 09:37:48 +1100 Subject: [PATCH 0277/1712] stm32/modmachine: Add deepsleep support to reset_cause() for WB55. --- ports/stm32/modmachine.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c index 57b8ef5e6b..0239ea64ca 100644 --- a/ports/stm32/modmachine.c +++ b/ports/stm32/modmachine.c @@ -119,6 +119,12 @@ void machine_init(void) { reset_cause = PYB_RESET_DEEPSLEEP; PWR->SCR |= PWR_SCR_CSBF; } else + #elif defined(STM32WB) + if (PWR->EXTSCR & PWR_EXTSCR_C1SBF) { + // came out of standby + reset_cause = PYB_RESET_DEEPSLEEP; + PWR->EXTSCR |= PWR_EXTSCR_C1CSSF; + } else #endif { // get reset cause from RCC flags From 335002a4c020850591122d763324599e5edbe045 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 29 Mar 2022 12:27:56 +1100 Subject: [PATCH 0278/1712] extmod/uasyncio: Allow task state to be a callable. This implements a form of CPython's "add_done_callback()", but at this stage it is a hidden feature and only intended to be used internally. Signed-off-by: Damien George --- extmod/moduasyncio.c | 3 +++ extmod/uasyncio/core.py | 5 +++++ extmod/uasyncio/task.py | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/extmod/moduasyncio.c b/extmod/moduasyncio.c index dd2d1e7475..b0921b6eb1 100644 --- a/extmod/moduasyncio.c +++ b/extmod/moduasyncio.c @@ -265,6 +265,9 @@ STATIC mp_obj_t task_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf) { } else if (self->state == TASK_STATE_RUNNING_NOT_WAITED_ON) { // Allocate the waiting queue. self->state = task_queue_make_new(&task_queue_type, 0, 0, NULL); + } else if (mp_obj_get_type(self->state) != &task_queue_type) { + // Task has state used for another purpose, so can't also wait on it. + mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("can't wait")); } return self_in; } diff --git a/extmod/uasyncio/core.py b/extmod/uasyncio/core.py index 12833cf0cd..28b5e960ac 100644 --- a/extmod/uasyncio/core.py +++ b/extmod/uasyncio/core.py @@ -195,6 +195,11 @@ def run_until_complete(main_task=None): if t.state is True: # "None" indicates that the task is complete and not await'ed on (yet). t.state = None + elif callable(t.state): + # The task has a callback registered to be called on completion. + t.state(t, er) + t.state = False + waiting = True else: # Schedule any other tasks waiting on the completion of this task. while t.state.peek(): diff --git a/extmod/uasyncio/task.py b/extmod/uasyncio/task.py index 26df7b1725..d775164909 100644 --- a/extmod/uasyncio/task.py +++ b/extmod/uasyncio/task.py @@ -123,7 +123,7 @@ class Task: def __init__(self, coro, globals=None): self.coro = coro # Coroutine of this Task self.data = None # General data for queue it is waiting on - self.state = True # None, False, True or a TaskQueue instance + self.state = True # None, False, True, a callable, or a TaskQueue instance self.ph_key = 0 # Pairing heap self.ph_child = None # Paring heap self.ph_child_last = None # Paring heap @@ -137,6 +137,9 @@ class Task: elif self.state is True: # Allocated head of linked list of Tasks waiting on completion of this task. self.state = TaskQueue() + elif type(self.state) is not TaskQueue: + # Task has state used for another purpose, so can't also wait on it. + raise RuntimeError("can't wait") return self def __next__(self): From 90aaf2dbef657e5afb8855a42d26093c3ef2a38d Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 29 Mar 2022 12:57:04 +1100 Subject: [PATCH 0279/1712] extmod/uasyncio: Fix gather cancelling and handling of exceptions. The following fixes are made: - cancelling a gather now cancels all sub-tasks of the gather (previously it would only cancel the first) - if any sub-task of a gather raises an exception then the gather finishes (previously it would only finish if the first sub-task raised) Fixes issues #5798, #7807, #7901. Signed-off-by: Damien George --- extmod/uasyncio/funcs.py | 76 +++++++++++++++++---- tests/extmod/uasyncio_gather.py | 63 ++++++++++++++--- tests/extmod/uasyncio_gather.py.exp | 21 ++++++ tests/extmod/uasyncio_gather_notimpl.py | 53 ++++++++++++++ tests/extmod/uasyncio_gather_notimpl.py.exp | 14 ++++ 5 files changed, 202 insertions(+), 25 deletions(-) create mode 100644 tests/extmod/uasyncio_gather_notimpl.py create mode 100644 tests/extmod/uasyncio_gather_notimpl.py.exp diff --git a/extmod/uasyncio/funcs.py b/extmod/uasyncio/funcs.py index 0ce48b015c..b19edeb6ef 100644 --- a/extmod/uasyncio/funcs.py +++ b/extmod/uasyncio/funcs.py @@ -53,22 +53,68 @@ def wait_for_ms(aw, timeout): return wait_for(aw, timeout, core.sleep_ms) +class _Remove: + @staticmethod + def remove(t): + pass + + async def gather(*aws, return_exceptions=False): + def done(t, er): + nonlocal state + if type(state) is not int: + # A sub-task already raised an exception, so do nothing. + return + elif not return_exceptions and not isinstance(er, StopIteration): + # A sub-task raised an exception, indicate that to the gather task. + state = er + else: + state -= 1 + if state: + # Still some sub-tasks running. + return + # Gather waiting is done, schedule the main gather task. + core._task_queue.push_head(gather_task) + ts = [core._promote_to_task(aw) for aw in aws] for i in range(len(ts)): - try: - # TODO handle cancel of gather itself - # if ts[i].coro: - # iter(ts[i]).waiting.push_head(cur_task) - # try: - # yield - # except CancelledError as er: - # # cancel all waiting tasks - # raise er - ts[i] = await ts[i] - except (core.CancelledError, Exception) as er: - if return_exceptions: - ts[i] = er - else: - raise er + if ts[i].state is not True: + # Task is not running, gather not currently supported for this case. + raise RuntimeError("can't gather") + # Register the callback to call when the task is done. + ts[i].state = done + + # Set the state for execution of the gather. + gather_task = core.cur_task + state = len(ts) + cancel_all = False + + # Wait for the a sub-task to need attention. + gather_task.data = _Remove + try: + yield + except core.CancelledError as er: + cancel_all = True + state = er + + # Clean up tasks. + for i in range(len(ts)): + if ts[i].state is done: + # Sub-task is still running, deregister the callback and cancel if needed. + ts[i].state = True + if cancel_all: + ts[i].cancel() + elif isinstance(ts[i].data, StopIteration): + # Sub-task ran to completion, get its return value. + ts[i] = ts[i].data.value + else: + # Sub-task had an exception with return_exceptions==True, so get its exception. + ts[i] = ts[i].data + + # Either this gather was cancelled, or one of the sub-tasks raised an exception with + # return_exceptions==False, so reraise the exception here. + if state is not 0: + raise state + + # Return the list of return values of each sub-task. return ts diff --git a/tests/extmod/uasyncio_gather.py b/tests/extmod/uasyncio_gather.py index 6053873dbc..718e702be6 100644 --- a/tests/extmod/uasyncio_gather.py +++ b/tests/extmod/uasyncio_gather.py @@ -27,9 +27,22 @@ async def task(id): return id -async def gather_task(): +async def task_loop(id): + print("task_loop start", id) + while True: + await asyncio.sleep(0.02) + print("task_loop loop", id) + + +async def task_raise(id): + print("task_raise start", id) + await asyncio.sleep(0.02) + raise ValueError(id) + + +async def gather_task(t0, t1): print("gather_task") - await asyncio.gather(task(1), task(2)) + await asyncio.gather(t0, t1) print("gather_task2") @@ -37,19 +50,49 @@ async def main(): # Simple gather with return values print(await asyncio.gather(factorial("A", 2), factorial("B", 3), factorial("C", 4))) + print("====") + # Test return_exceptions, where one task is cancelled and the other finishes normally tasks = [asyncio.create_task(task(1)), asyncio.create_task(task(2))] tasks[0].cancel() print(await asyncio.gather(*tasks, return_exceptions=True)) - # Cancel a multi gather - # TODO doesn't work, Task should not forward cancellation from gather to sub-task - # but rather CancelledError should cancel the gather directly, which will then cancel - # all sub-tasks explicitly - # t = asyncio.create_task(gather_task()) - # await asyncio.sleep(0.01) - # t.cancel() - # await asyncio.sleep(0.01) + print("====") + + # Test return_exceptions, where one task raises an exception and the other finishes normally. + tasks = [asyncio.create_task(task(1)), asyncio.create_task(task_raise(2))] + print(await asyncio.gather(*tasks, return_exceptions=True)) + + print("====") + + # Test case where one task raises an exception and other task keeps running. + tasks = [asyncio.create_task(task_loop(1)), asyncio.create_task(task_raise(2))] + try: + await asyncio.gather(*tasks) + except ValueError as er: + print(repr(er)) + print(tasks[0].done(), tasks[1].done()) + for t in tasks: + t.cancel() + await asyncio.sleep(0.04) + + print("====") + + # Test case where both tasks raise an exception. + tasks = [asyncio.create_task(task_raise(1)), asyncio.create_task(task_raise(2))] + try: + await asyncio.gather(*tasks) + except ValueError as er: + print(repr(er)) + print(tasks[0].done(), tasks[1].done()) + + print("====") + + # Cancel a multi gather. + t = asyncio.create_task(gather_task(task(1), task(2))) + await asyncio.sleep(0.01) + t.cancel() + await asyncio.sleep(0.04) asyncio.run(main()) diff --git a/tests/extmod/uasyncio_gather.py.exp b/tests/extmod/uasyncio_gather.py.exp index 95310bbe1c..9b30c36b67 100644 --- a/tests/extmod/uasyncio_gather.py.exp +++ b/tests/extmod/uasyncio_gather.py.exp @@ -8,6 +8,27 @@ Task B: factorial(3) = 6 Task C: Compute factorial(4)... Task C: factorial(4) = 24 [2, 6, 24] +==== start 2 end 2 [CancelledError(), 2] +==== +start 1 +task_raise start 2 +end 1 +[1, ValueError(2,)] +==== +task_loop start 1 +task_raise start 2 +task_loop loop 1 +ValueError(2,) +False True +==== +task_raise start 1 +task_raise start 2 +ValueError(1,) +True True +==== +gather_task +start 1 +start 2 diff --git a/tests/extmod/uasyncio_gather_notimpl.py b/tests/extmod/uasyncio_gather_notimpl.py new file mode 100644 index 0000000000..3ebab9bad6 --- /dev/null +++ b/tests/extmod/uasyncio_gather_notimpl.py @@ -0,0 +1,53 @@ +# Test uasyncio.gather() function, features that are not implemented. + +try: + import uasyncio as asyncio +except ImportError: + try: + import asyncio + except ImportError: + print("SKIP") + raise SystemExit + + +def custom_handler(loop, context): + print(repr(context["exception"])) + + +async def task(id): + print("task start", id) + await asyncio.sleep(0.01) + print("task end", id) + return id + + +async def gather_task(t0, t1): + print("gather_task start") + await asyncio.gather(t0, t1) + print("gather_task end") + + +async def main(): + loop = asyncio.get_event_loop() + loop.set_exception_handler(custom_handler) + + # Test case where can't wait on a task being gathered. + tasks = [asyncio.create_task(task(1)), asyncio.create_task(task(2))] + gt = asyncio.create_task(gather_task(tasks[0], tasks[1])) + await asyncio.sleep(0) # let the gather start + try: + await tasks[0] # can't await because this task is part of the gather + except RuntimeError as er: + print(repr(er)) + await gt + + print("====") + + # Test case where can't gather on a task being waited. + tasks = [asyncio.create_task(task(1)), asyncio.create_task(task(2))] + asyncio.create_task(gather_task(tasks[0], tasks[1])) + await tasks[0] # wait on this task before the gather starts + await tasks[1] + + +asyncio.run(main()) diff --git a/tests/extmod/uasyncio_gather_notimpl.py.exp b/tests/extmod/uasyncio_gather_notimpl.py.exp new file mode 100644 index 0000000000..f21614ffbe --- /dev/null +++ b/tests/extmod/uasyncio_gather_notimpl.py.exp @@ -0,0 +1,14 @@ +task start 1 +task start 2 +gather_task start +RuntimeError("can't wait",) +task end 1 +task end 2 +gather_task end +==== +task start 1 +task start 2 +gather_task start +RuntimeError("can't gather",) +task end 1 +task end 2 From 594c753c27c07df2a1b36e4eb772a6a2165eee9c Mon Sep 17 00:00:00 2001 From: stijn Date: Thu, 17 Mar 2022 12:49:38 +0100 Subject: [PATCH 0280/1712] py/bc.h: Fix C++20 compilation with "volatile". C++20 is deprecating several usages of the volatile keyword so remove this one affected case in the codebase which causes such warning. --- py/bc.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/py/bc.h b/py/bc.h index 8709b42389..3b7b625fec 100644 --- a/py/bc.h +++ b/py/bc.h @@ -262,7 +262,11 @@ mp_uint_t mp_decode_uint(const byte **ptr); mp_uint_t mp_decode_uint_value(const byte *ptr); const byte *mp_decode_uint_skip(const byte *ptr); -mp_vm_return_kind_t mp_execute_bytecode(mp_code_state_t *code_state, volatile mp_obj_t inject_exc); +mp_vm_return_kind_t mp_execute_bytecode(mp_code_state_t *code_state, +#ifndef __cplusplus + volatile +#endif + mp_obj_t inject_exc); mp_code_state_t *mp_obj_fun_bc_prepare_codestate(mp_obj_t func, size_t n_args, size_t n_kw, const mp_obj_t *args); void mp_setup_code_state(mp_code_state_t *code_state, size_t n_args, size_t n_kw, const mp_obj_t *args); void mp_bytecode_print(const mp_print_t *print, const struct _mp_raw_code_t *rc, const mp_module_constants_t *cm); From df9a4122062ff706ad4b6a76cb5bc16d1a23d384 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 29 Mar 2022 22:37:58 +1100 Subject: [PATCH 0281/1712] py/compile: Only show raw code that is bytecode. Signed-off-by: Damien George --- py/compile.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/py/compile.c b/py/compile.c index d61dabb9a5..36f33f97f7 100644 --- a/py/compile.c +++ b/py/compile.c @@ -3636,7 +3636,9 @@ mp_compiled_module_t mp_compile_to_raw_code(mp_parse_tree_t *parse_tree, qstr so if (mp_verbose_flag >= 2) { for (scope_t *s = comp->scope_head; s != NULL; s = s->next) { mp_raw_code_t *rc = s->raw_code; - mp_bytecode_print(&mp_plat_print, rc, &cm.context->constants); + if (rc->kind == MP_CODE_BYTECODE) { + mp_bytecode_print(&mp_plat_print, rc, &cm.context->constants); + } } } #endif From bf3585b33c4fcd47edcf39494b7bc464a018b4fc Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 29 Mar 2022 22:38:19 +1100 Subject: [PATCH 0282/1712] py/asmxtensa: Fix use of l32i/s32i when offset won't fit in encoding. This commit adds optimised l32i/s32i functions that select the best load/ store encoding based on the size of the offset, and uses the function when necessary in code generation. Without this, ASM_LOAD_REG_REG_OFFSET() could overflow the word offset (using a narrow encoding), for example when loading the prelude from the constant table when there are many (>16) constants. Fixes issue #8458. Signed-off-by: Damien George --- py/asmxtensa.c | 32 ++++++++++++++++++++++---------- py/asmxtensa.h | 6 ++++-- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/py/asmxtensa.c b/py/asmxtensa.c index 0956d50f3e..8ac914ec41 100644 --- a/py/asmxtensa.c +++ b/py/asmxtensa.c @@ -27,7 +27,7 @@ #include #include -#include "py/mpconfig.h" +#include "py/runtime.h" // wrapper around everything in this file #if MICROPY_EMIT_XTENSA || MICROPY_EMIT_INLINE_XTENSA || MICROPY_EMIT_XTENSAWIN @@ -232,21 +232,33 @@ void asm_xtensa_mov_reg_pcrel(asm_xtensa_t *as, uint reg_dest, uint label) { asm_xtensa_op_add_n(as, reg_dest, reg_dest, ASM_XTENSA_REG_A0); } -void asm_xtensa_call_ind(asm_xtensa_t *as, uint idx) { - if (idx < 16) { - asm_xtensa_op_l32i_n(as, ASM_XTENSA_REG_A0, ASM_XTENSA_REG_FUN_TABLE, idx); +void asm_xtensa_l32i_optimised(asm_xtensa_t *as, uint reg_dest, uint reg_base, uint word_offset) { + if (word_offset < 16) { + asm_xtensa_op_l32i_n(as, reg_dest, reg_base, word_offset); + } else if (word_offset < 256) { + asm_xtensa_op_l32i(as, reg_dest, reg_base, word_offset); } else { - asm_xtensa_op_l32i(as, ASM_XTENSA_REG_A0, ASM_XTENSA_REG_FUN_TABLE, idx); + mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("asm overflow")); } +} + +void asm_xtensa_s32i_optimised(asm_xtensa_t *as, uint reg_src, uint reg_base, uint word_offset) { + if (word_offset < 16) { + asm_xtensa_op_s32i_n(as, reg_src, reg_base, word_offset); + } else if (word_offset < 256) { + asm_xtensa_op_s32i(as, reg_src, reg_base, word_offset); + } else { + mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("asm overflow")); + } +} + +void asm_xtensa_call_ind(asm_xtensa_t *as, uint idx) { + asm_xtensa_l32i_optimised(as, ASM_XTENSA_REG_A0, ASM_XTENSA_REG_FUN_TABLE, idx); asm_xtensa_op_callx0(as, ASM_XTENSA_REG_A0); } void asm_xtensa_call_ind_win(asm_xtensa_t *as, uint idx) { - if (idx < 16) { - asm_xtensa_op_l32i_n(as, ASM_XTENSA_REG_A8, ASM_XTENSA_REG_FUN_TABLE_WIN, idx); - } else { - asm_xtensa_op_l32i(as, ASM_XTENSA_REG_A8, ASM_XTENSA_REG_FUN_TABLE_WIN, idx); - } + asm_xtensa_l32i_optimised(as, ASM_XTENSA_REG_A8, ASM_XTENSA_REG_FUN_TABLE_WIN, idx); asm_xtensa_op_callx8(as, ASM_XTENSA_REG_A8); } diff --git a/py/asmxtensa.h b/py/asmxtensa.h index 43f1b608ed..16a59c0ee0 100644 --- a/py/asmxtensa.h +++ b/py/asmxtensa.h @@ -278,6 +278,8 @@ void asm_xtensa_mov_local_reg(asm_xtensa_t *as, int local_num, uint reg_src); void asm_xtensa_mov_reg_local(asm_xtensa_t *as, uint reg_dest, int local_num); void asm_xtensa_mov_reg_local_addr(asm_xtensa_t *as, uint reg_dest, int local_num); void asm_xtensa_mov_reg_pcrel(asm_xtensa_t *as, uint reg_dest, uint label); +void asm_xtensa_l32i_optimised(asm_xtensa_t *as, uint reg_dest, uint reg_base, uint word_offset); +void asm_xtensa_s32i_optimised(asm_xtensa_t *as, uint reg_src, uint reg_base, uint word_offset); void asm_xtensa_call_ind(asm_xtensa_t *as, uint idx); void asm_xtensa_call_ind_win(asm_xtensa_t *as, uint idx); @@ -393,12 +395,12 @@ void asm_xtensa_call_ind_win(asm_xtensa_t *as, uint idx); #define ASM_SUB_REG_REG(as, reg_dest, reg_src) asm_xtensa_op_sub((as), (reg_dest), (reg_dest), (reg_src)) #define ASM_MUL_REG_REG(as, reg_dest, reg_src) asm_xtensa_op_mull((as), (reg_dest), (reg_dest), (reg_src)) -#define ASM_LOAD_REG_REG_OFFSET(as, reg_dest, reg_base, word_offset) asm_xtensa_op_l32i_n((as), (reg_dest), (reg_base), (word_offset)) +#define ASM_LOAD_REG_REG_OFFSET(as, reg_dest, reg_base, word_offset) asm_xtensa_l32i_optimised((as), (reg_dest), (reg_base), (word_offset)) #define ASM_LOAD8_REG_REG(as, reg_dest, reg_base) asm_xtensa_op_l8ui((as), (reg_dest), (reg_base), 0) #define ASM_LOAD16_REG_REG(as, reg_dest, reg_base) asm_xtensa_op_l16ui((as), (reg_dest), (reg_base), 0) #define ASM_LOAD32_REG_REG(as, reg_dest, reg_base) asm_xtensa_op_l32i_n((as), (reg_dest), (reg_base), 0) -#define ASM_STORE_REG_REG_OFFSET(as, reg_dest, reg_base, word_offset) asm_xtensa_op_s32i_n((as), (reg_dest), (reg_base), (word_offset)) +#define ASM_STORE_REG_REG_OFFSET(as, reg_dest, reg_base, word_offset) asm_xtensa_s32i_optimised((as), (reg_dest), (reg_base), (word_offset)) #define ASM_STORE8_REG_REG(as, reg_src, reg_base) asm_xtensa_op_s8i((as), (reg_src), (reg_base), 0) #define ASM_STORE16_REG_REG(as, reg_src, reg_base) asm_xtensa_op_s16i((as), (reg_src), (reg_base), 0) #define ASM_STORE32_REG_REG(as, reg_src, reg_base) asm_xtensa_op_s32i_n((as), (reg_src), (reg_base), 0) From 7e8222ae063d78ae8f901bb0f9fef663edd2edb6 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 29 Mar 2022 22:40:02 +1100 Subject: [PATCH 0283/1712] py/emitnative: Don't store prelude at end of machine code if not needed. Signed-off-by: Damien George --- py/emitnative.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/py/emitnative.c b/py/emitnative.c index bddd661428..a207dd30f7 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -723,7 +723,13 @@ STATIC bool emit_native_end_pass(emit_t *emit) { if (emit->pass == MP_PASS_EMIT) { void *f = mp_asm_base_get_code(&emit->as->base); + #if N_PRELUDE_AS_BYTES_OBJ + // Keep only the machine code, not the prelude, which is in a separate bytes object. + mp_uint_t f_len = emit->prelude_offset; + #else + // Keep both the machine code and the prelude. mp_uint_t f_len = mp_asm_base_get_code_size(&emit->as->base); + #endif mp_emit_glue_assign_native(emit->scope->raw_code, emit->do_viper_types ? MP_CODE_NATIVE_VIPER : MP_CODE_NATIVE_PY, From bb70874111dbb246624a68c013e8f1c3245ca0d8 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 31 Mar 2022 10:57:34 +1100 Subject: [PATCH 0284/1712] py/vm: Prevent array bound warning when using -MP_OBJ_ITER_BUF_NSLOTS. This warning can happen on clang 13.0.1 building mpy-cross: ../py/vm.c:748:25: error: array index -3 refers past the last possible element for an array in 64-bit address space containing 64-bit (8-byte) elements (max possible 2305843009213693952 elements) [-Werror,-Warray-bounds] sp[-MP_OBJ_ITER_BUF_NSLOTS + 1] = MP_OBJ_NULL; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Using pointer access instead of array access works around this warning. Fixes issue #8467. Signed-off-by: Damien George --- py/vm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/py/vm.c b/py/vm.c index 50da90e7d2..fa163423ad 100644 --- a/py/vm.c +++ b/py/vm.c @@ -745,8 +745,8 @@ unwind_jump:; obj = mp_getiter(obj, iter_buf); if (obj != MP_OBJ_FROM_PTR(iter_buf)) { // Iterator didn't use the stack so indicate that with MP_OBJ_NULL. - sp[-MP_OBJ_ITER_BUF_NSLOTS + 1] = MP_OBJ_NULL; - sp[-MP_OBJ_ITER_BUF_NSLOTS + 2] = obj; + *(sp - MP_OBJ_ITER_BUF_NSLOTS + 1) = MP_OBJ_NULL; + *(sp - MP_OBJ_ITER_BUF_NSLOTS + 2) = obj; } DISPATCH(); } @@ -757,8 +757,8 @@ unwind_jump:; DECODE_ULABEL; // the jump offset if iteration finishes; for labels are always forward code_state->sp = sp; mp_obj_t obj; - if (sp[-MP_OBJ_ITER_BUF_NSLOTS + 1] == MP_OBJ_NULL) { - obj = sp[-MP_OBJ_ITER_BUF_NSLOTS + 2]; + if (*(sp - MP_OBJ_ITER_BUF_NSLOTS + 1) == MP_OBJ_NULL) { + obj = *(sp - MP_OBJ_ITER_BUF_NSLOTS + 2); } else { obj = MP_OBJ_FROM_PTR(&sp[-MP_OBJ_ITER_BUF_NSLOTS + 1]); } From 1e99d29f362f8cccc60a36fcbd8590404c719f40 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Tue, 24 Mar 2020 21:39:46 -0500 Subject: [PATCH 0285/1712] py/runtime: Allow multiple **args in a function call. This is a partial implementation of PEP 448 to allow multiple ** unpackings when calling a function or method. The compiler is modified to encode the argument as a None: obj key-value pair (similar to how regular keyword arguments are encoded as str: obj pairs). The extra object that was pushed on the stack to hold a single ** unpacking object is no longer used and is removed. The runtime is modified to decode this new format. Signed-off-by: David Lechner --- py/compile.c | 18 ++--- py/emitbc.c | 4 +- py/emitnative.c | 4 +- py/runtime.c | 126 +++++++++++++++++-------------- py/vm.c | 8 +- tests/basics/fun_calldblstar4.py | 33 ++++++++ tests/basics/python34.py | 1 - tests/basics/python34.py.exp | 1 - tests/cmdline/cmd_showbc.py.exp | 8 +- 9 files changed, 121 insertions(+), 82 deletions(-) create mode 100644 tests/basics/fun_calldblstar4.py diff --git a/py/compile.c b/py/compile.c index 36f33f97f7..1636bd157d 100644 --- a/py/compile.c +++ b/py/compile.c @@ -2397,7 +2397,7 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar int n_positional = n_positional_extra; uint n_keyword = 0; uint star_flags = 0; - mp_parse_node_struct_t *star_args_node = NULL, *dblstar_args_node = NULL; + mp_parse_node_struct_t *star_args_node = NULL; for (size_t i = 0; i < n_args; i++) { if (MP_PARSE_NODE_IS_STRUCT(args[i])) { mp_parse_node_struct_t *pns_arg = (mp_parse_node_struct_t *)args[i]; @@ -2409,12 +2409,11 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar star_flags |= MP_EMIT_STAR_FLAG_SINGLE; star_args_node = pns_arg; } else if (MP_PARSE_NODE_STRUCT_KIND(pns_arg) == PN_arglist_dbl_star) { - if (star_flags & MP_EMIT_STAR_FLAG_DOUBLE) { - compile_syntax_error(comp, (mp_parse_node_t)pns_arg, MP_ERROR_TEXT("can't have multiple **x")); - return; - } star_flags |= MP_EMIT_STAR_FLAG_DOUBLE; - dblstar_args_node = pns_arg; + // double-star args are stored as kw arg with key of None + EMIT(load_null); + compile_node(comp, pns_arg->nodes[0]); + n_keyword++; } else if (MP_PARSE_NODE_STRUCT_KIND(pns_arg) == PN_argument) { #if MICROPY_PY_ASSIGN_EXPR if (MP_PARSE_NODE_IS_STRUCT_KIND(pns_arg->nodes[1], PN_argument_3)) { @@ -2429,7 +2428,7 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar } EMIT_ARG(load_const_str, MP_PARSE_NODE_LEAF_ARG(pns_arg->nodes[0])); compile_node(comp, pns_arg->nodes[1]); - n_keyword += 1; + n_keyword++; } else { compile_comprehension(comp, pns_arg, SCOPE_GEN_EXPR); n_positional++; @@ -2460,11 +2459,6 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar } else { compile_node(comp, star_args_node->nodes[0]); } - if (dblstar_args_node == NULL) { - EMIT(load_null); - } else { - compile_node(comp, dblstar_args_node->nodes[0]); - } } // emit the function/method call diff --git a/py/emitbc.c b/py/emitbc.c index 1f5cd9d322..21ec121911 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -752,7 +752,9 @@ void mp_emit_bc_make_closure(emit_t *emit, scope_t *scope, mp_uint_t n_closed_ov STATIC void emit_bc_call_function_method_helper(emit_t *emit, int stack_adj, mp_uint_t bytecode_base, mp_uint_t n_positional, mp_uint_t n_keyword, mp_uint_t star_flags) { if (star_flags) { - stack_adj -= (int)n_positional + 2 * (int)n_keyword + 2; + // each positional arg is one object, each kwarg is two objects, the key + // and the value and one extra object for the star args bitmap. + stack_adj -= (int)n_positional + 2 * (int)n_keyword + 1; emit_write_bytecode_byte_uint(emit, stack_adj, bytecode_base + 1, (n_keyword << 8) | n_positional); // TODO make it 2 separate uints? } else { stack_adj -= (int)n_positional + 2 * (int)n_keyword; diff --git a/py/emitnative.c b/py/emitnative.c index a207dd30f7..2863984047 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -2752,7 +2752,7 @@ STATIC void emit_native_call_function(emit_t *emit, mp_uint_t n_positional, mp_u } else { assert(vtype_fun == VTYPE_PYOBJ); if (star_flags) { - emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_3, n_positional + 2 * n_keyword + 3); // pointer to args + emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_3, n_positional + 2 * n_keyword + 2); // pointer to args emit_call_with_2_imm_args(emit, MP_F_CALL_METHOD_N_KW_VAR, 0, REG_ARG_1, n_positional | (n_keyword << 8), REG_ARG_2); emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET); } else { @@ -2768,7 +2768,7 @@ STATIC void emit_native_call_function(emit_t *emit, mp_uint_t n_positional, mp_u STATIC void emit_native_call_method(emit_t *emit, mp_uint_t n_positional, mp_uint_t n_keyword, mp_uint_t star_flags) { if (star_flags) { - emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_3, n_positional + 2 * n_keyword + 4); // pointer to args + emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_3, n_positional + 2 * n_keyword + 3); // pointer to args emit_call_with_2_imm_args(emit, MP_F_CALL_METHOD_N_KW_VAR, 1, REG_ARG_1, n_positional | (n_keyword << 8), REG_ARG_2); emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET); } else { diff --git a/py/runtime.c b/py/runtime.c index ba3fbe7fa5..e6bfbda58d 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -702,9 +702,8 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ uint n_args = n_args_n_kw & 0xff; uint n_kw = (n_args_n_kw >> 8) & 0xff; mp_obj_t pos_seq = args[n_args + 2 * n_kw]; // may be MP_OBJ_NULL - mp_obj_t kw_dict = args[n_args + 2 * n_kw + 1]; // may be MP_OBJ_NULL - DEBUG_OP_printf("call method var (fun=%p, self=%p, n_args=%u, n_kw=%u, args=%p, seq=%p, dict=%p)\n", fun, self, n_args, n_kw, args, pos_seq, kw_dict); + DEBUG_OP_printf("call method var (fun=%p, self=%p, n_args=%u, n_kw=%u, args=%p, seq=%p)\n", fun, self, n_args, n_kw, args, pos_seq); // We need to create the following array of objects: // args[0 .. n_args] unpacked(pos_seq) args[n_args .. n_args + 2 * n_kw] unpacked(kw_dict) @@ -717,8 +716,13 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ // Try to get a hint for the size of the kw_dict uint kw_dict_len = 0; - if (kw_dict != MP_OBJ_NULL && mp_obj_is_type(kw_dict, &mp_type_dict)) { - kw_dict_len = mp_obj_dict_len(kw_dict); + + for (uint i = 0; i < n_kw; i++) { + mp_obj_t key = args[n_args + i * 2]; + mp_obj_t value = args[n_args + i * 2 + 1]; + if (key == MP_OBJ_NULL && value != MP_OBJ_NULL && mp_obj_is_type(value, &mp_type_dict)) { + kw_dict_len += mp_obj_dict_len(value); + } } // Extract the pos_seq sequence to the new args array. @@ -792,64 +796,72 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ // The size of the args2 array now is the number of positional args. uint pos_args_len = args2_len; - // Copy the fixed kw args. - mp_seq_copy(args2 + args2_len, args + n_args, 2 * n_kw, mp_obj_t); - args2_len += 2 * n_kw; - - // Extract (key,value) pairs from kw_dict dictionary and append to args2. - // Note that it can be arbitrary iterator. - if (kw_dict == MP_OBJ_NULL) { - // pass - } else if (mp_obj_is_type(kw_dict, &mp_type_dict)) { - // dictionary - mp_map_t *map = mp_obj_dict_get_map(kw_dict); - assert(args2_len + 2 * map->used <= args2_alloc); // should have enough, since kw_dict_len is in this case hinted correctly above - for (size_t i = 0; i < map->alloc; i++) { - if (mp_map_slot_is_filled(map, i)) { - // the key must be a qstr, so intern it if it's a string - mp_obj_t key = map->table[i].key; - if (!mp_obj_is_qstr(key)) { - key = mp_obj_str_intern_checked(key); + // Copy the kw args. + for (uint i = 0; i < n_kw; i++) { + mp_obj_t kw_key = args[n_args + i * 2]; + mp_obj_t kw_value = args[n_args + i * 2 + 1]; + if (kw_key == MP_OBJ_NULL) { + // double-star args + if (kw_value == MP_OBJ_NULL) { + // pass + } else if (mp_obj_is_type(kw_value, &mp_type_dict)) { + // dictionary + mp_map_t *map = mp_obj_dict_get_map(kw_value); + // should have enough, since kw_dict_len is in this case hinted correctly above + assert(args2_len + 2 * map->used <= args2_alloc); + for (size_t j = 0; j < map->alloc; j++) { + if (mp_map_slot_is_filled(map, j)) { + // the key must be a qstr, so intern it if it's a string + mp_obj_t key = map->table[j].key; + if (!mp_obj_is_qstr(key)) { + key = mp_obj_str_intern_checked(key); + } + args2[args2_len++] = key; + args2[args2_len++] = map->table[j].value; + } } - args2[args2_len++] = key; - args2[args2_len++] = map->table[i].value; - } - } - } else { - // generic mapping: - // - call keys() to get an iterable of all keys in the mapping - // - call __getitem__ for each key to get the corresponding value + } else { + // generic mapping: + // - call keys() to get an iterable of all keys in the mapping + // - call __getitem__ for each key to get the corresponding value - // get the keys iterable - mp_obj_t dest[3]; - mp_load_method(kw_dict, MP_QSTR_keys, dest); - mp_obj_t iterable = mp_getiter(mp_call_method_n_kw(0, 0, dest), NULL); + // get the keys iterable + mp_obj_t dest[3]; + mp_load_method(kw_value, MP_QSTR_keys, dest); + mp_obj_t iterable = mp_getiter(mp_call_method_n_kw(0, 0, dest), NULL); - mp_obj_t key; - while ((key = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - // expand size of args array if needed - if (args2_len + 1 >= args2_alloc) { - uint new_alloc = args2_alloc * 2; - if (new_alloc < 4) { - new_alloc = 4; + mp_obj_t key; + while ((key = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { + // expand size of args array if needed + if (args2_len + 1 >= args2_alloc) { + uint new_alloc = args2_alloc * 2; + if (new_alloc < 4) { + new_alloc = 4; + } + args2 = mp_nonlocal_realloc(args2, args2_alloc * sizeof(mp_obj_t), new_alloc * sizeof(mp_obj_t)); + args2_alloc = new_alloc; + } + + // the key must be a qstr, so intern it if it's a string + if (!mp_obj_is_qstr(key)) { + key = mp_obj_str_intern_checked(key); + } + + // get the value corresponding to the key + mp_load_method(kw_value, MP_QSTR___getitem__, dest); + dest[2] = key; + mp_obj_t value = mp_call_method_n_kw(1, 0, dest); + + // store the key/value pair in the argument array + args2[args2_len++] = key; + args2[args2_len++] = value; } - args2 = mp_nonlocal_realloc(args2, args2_alloc * sizeof(mp_obj_t), new_alloc * sizeof(mp_obj_t)); - args2_alloc = new_alloc; } - - // the key must be a qstr, so intern it if it's a string - if (!mp_obj_is_qstr(key)) { - key = mp_obj_str_intern_checked(key); - } - - // get the value corresponding to the key - mp_load_method(kw_dict, MP_QSTR___getitem__, dest); - dest[2] = key; - mp_obj_t value = mp_call_method_n_kw(1, 0, dest); - - // store the key/value pair in the argument array - args2[args2_len++] = key; - args2[args2_len++] = value; + } else { + // normal kwarg + assert(args2_len + 2 <= args2_alloc); + args2[args2_len++] = kw_key; + args2[args2_len++] = kw_value; } } diff --git a/py/vm.c b/py/vm.c index fa163423ad..1450004838 100644 --- a/py/vm.c +++ b/py/vm.c @@ -949,8 +949,8 @@ unwind_jump:; // unum & 0xff == n_positional // (unum >> 8) & 0xff == n_keyword // We have following stack layout here: - // fun arg0 arg1 ... kw0 val0 kw1 val1 ... seq dict <- TOS - sp -= (unum & 0xff) + ((unum >> 7) & 0x1fe) + 2; + // fun arg0 arg1 ... kw0 val0 kw1 val1 ... seq <- TOS + sp -= (unum & 0xff) + ((unum >> 7) & 0x1fe) + 1; #if MICROPY_STACKLESS if (mp_obj_get_type(*sp) == &mp_type_fun_bc) { code_state->ip = ip; @@ -1034,8 +1034,8 @@ unwind_jump:; // unum & 0xff == n_positional // (unum >> 8) & 0xff == n_keyword // We have following stack layout here: - // fun self arg0 arg1 ... kw0 val0 kw1 val1 ... seq dict <- TOS - sp -= (unum & 0xff) + ((unum >> 7) & 0x1fe) + 3; + // fun self arg0 arg1 ... kw0 val0 kw1 val1 ... seq <- TOS + sp -= (unum & 0xff) + ((unum >> 7) & 0x1fe) + 2; #if MICROPY_STACKLESS if (mp_obj_get_type(*sp) == &mp_type_fun_bc) { code_state->ip = ip; diff --git a/tests/basics/fun_calldblstar4.py b/tests/basics/fun_calldblstar4.py new file mode 100644 index 0000000000..acb332a8c2 --- /dev/null +++ b/tests/basics/fun_calldblstar4.py @@ -0,0 +1,33 @@ +# test calling a function with multiple **args + + +def f(a, b=None, c=None): + print(a, b, c) + + +f(**{"a": 1}, **{"b": 2}) +f(**{"a": 1}, **{"b": 2}, c=3) +f(**{"a": 1}, b=2, **{"c": 3}) + +try: + f(1, **{"b": 2}, **{"b": 3}) +except TypeError: + print("TypeError") + +# test calling a method with multiple **args + + +class A: + def f(self, a, b=None, c=None): + print(a, b, c) + + +a = A() +a.f(**{"a": 1}, **{"b": 2}) +a.f(**{"a": 1}, **{"b": 2}, c=3) +a.f(**{"a": 1}, b=2, **{"c": 3}) + +try: + a.f(1, **{"b": 2}, **{"b": 3}) +except TypeError: + print("TypeError") diff --git a/tests/basics/python34.py b/tests/basics/python34.py index 0f6e4bafd0..609a8b6b84 100644 --- a/tests/basics/python34.py +++ b/tests/basics/python34.py @@ -25,7 +25,6 @@ def test_syntax(code): except SyntaxError: print("SyntaxError") test_syntax("f(*a, *b)") # can't have multiple * (in 3.5 we can) -test_syntax("f(**a, **b)") # can't have multiple ** (in 3.5 we can) test_syntax("f(*a, b)") # can't have positional after * test_syntax("f(**a, b)") # can't have positional after ** test_syntax("() = []") # can't assign to empty tuple (in 3.6 we can) diff --git a/tests/basics/python34.py.exp b/tests/basics/python34.py.exp index 8480171307..75f1c2c056 100644 --- a/tests/basics/python34.py.exp +++ b/tests/basics/python34.py.exp @@ -8,7 +8,6 @@ SyntaxError SyntaxError SyntaxError SyntaxError -SyntaxError 3.4 3 4 IndexError('foo',) diff --git a/tests/cmdline/cmd_showbc.py.exp b/tests/cmdline/cmd_showbc.py.exp index 92501e1248..663bacda01 100644 --- a/tests/cmdline/cmd_showbc.py.exp +++ b/tests/cmdline/cmd_showbc.py.exp @@ -297,8 +297,8 @@ arg names: 208 POP_TOP 209 LOAD_FAST 0 210 LOAD_DEREF 14 -212 LOAD_NULL -213 CALL_FUNCTION_VAR_KW n=0 nkw=0 +212 LOAD_CONST_SMALL_INT 1 +213 CALL_FUNCTION_VAR_KW n=1 nkw=0 215 POP_TOP 216 LOAD_FAST 0 217 LOAD_METHOD b @@ -318,8 +318,8 @@ arg names: 239 LOAD_FAST 0 240 LOAD_METHOD b 242 LOAD_FAST 1 -243 LOAD_NULL -244 CALL_METHOD_VAR_KW n=0 nkw=0 +243 LOAD_CONST_SMALL_INT 1 +244 CALL_METHOD_VAR_KW n=1 nkw=0 246 POP_TOP 247 LOAD_FAST 0 248 POP_JUMP_IF_FALSE 255 From 783b1a868fb0f3c1fd6cf7231311c24801c33505 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Tue, 24 Mar 2020 23:54:45 -0500 Subject: [PATCH 0286/1712] py/runtime: Allow multiple *args in a function call. This is a partial implementation of PEP 448 to allow unpacking multiple star args in a function or method call. This is implemented by changing the emitted bytecodes so that both positional args and star args are stored as positional args. A bitmap is added to indicate if an argument at a given position is a positional argument or a star arg. In the generated code, this new bitmap takes the place of the old star arg. It is stored as a small int, so this means only the first N arguments can be star args where N is the number of bits in a small int. The runtime is modified to interpret this new bytecode format while still trying to perform as few memory reallocations as possible. Signed-off-by: David Lechner --- docs/differences/python_35.rst | 2 +- py/compile.c | 37 +++++---- py/runtime.c | 103 ++++++++++++++++---------- py/vm.c | 4 +- tests/basics/fun_callstar.py | 12 +++ tests/basics/fun_callstardblstar.py | 10 +++ tests/basics/fun_kwvarargs.py | 13 ++++ tests/basics/python34.py | 11 +-- tests/basics/python34.py.exp | 5 -- tests/cpydiff/syntax_arg_unpacking.py | 23 ++++++ 10 files changed, 151 insertions(+), 69 deletions(-) create mode 100644 tests/cpydiff/syntax_arg_unpacking.py diff --git a/docs/differences/python_35.rst b/docs/differences/python_35.rst index e88df25f95..06cfbfc03c 100644 --- a/docs/differences/python_35.rst +++ b/docs/differences/python_35.rst @@ -8,7 +8,7 @@ Below is a list of finalised/accepted PEPs for Python 3.5 grouped into their imp +----------------------------------------------------------------------------------------------------------+---------------+ | **Extensions to the syntax:** | **Status** | +--------------------------------------------------------+-------------------------------------------------+---------------+ - | `PEP 448 `_ | additional unpacking generalizations | | + | `PEP 448 `_ | additional unpacking generalizations | Partial | +--------------------------------------------------------+-------------------------------------------------+---------------+ | `PEP 465 `_ | a new matrix multiplication operator | Completed | +--------------------------------------------------------+-------------------------------------------------+---------------+ diff --git a/py/compile.c b/py/compile.c index 1636bd157d..fc11062705 100644 --- a/py/compile.c +++ b/py/compile.c @@ -37,6 +37,7 @@ #include "py/asmbase.h" #include "py/nativeglue.h" #include "py/persistentcode.h" +#include "py/smallint.h" #if MICROPY_ENABLE_COMPILER @@ -2397,17 +2398,30 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar int n_positional = n_positional_extra; uint n_keyword = 0; uint star_flags = 0; - mp_parse_node_struct_t *star_args_node = NULL; + mp_uint_t star_args = 0; for (size_t i = 0; i < n_args; i++) { if (MP_PARSE_NODE_IS_STRUCT(args[i])) { mp_parse_node_struct_t *pns_arg = (mp_parse_node_struct_t *)args[i]; if (MP_PARSE_NODE_STRUCT_KIND(pns_arg) == PN_arglist_star) { - if (star_flags & MP_EMIT_STAR_FLAG_SINGLE) { - compile_syntax_error(comp, (mp_parse_node_t)pns_arg, MP_ERROR_TEXT("can't have multiple *x")); + if (star_flags & MP_EMIT_STAR_FLAG_DOUBLE) { + compile_syntax_error(comp, (mp_parse_node_t)pns_arg, MP_ERROR_TEXT("* arg after **")); + return; + } + #if MICROPY_DYNAMIC_COMPILER + if (i > mp_dynamic_compiler.small_int_bits) + #else + if (i > MP_SMALL_INT_BITS) + #endif + { + // If there are not enough bits in a small int to fit the flag, then we consider + // it a syntax error. It should be unlikely to have this many args in practice. + compile_syntax_error(comp, (mp_parse_node_t)pns_arg, MP_ERROR_TEXT("too many args")); return; } star_flags |= MP_EMIT_STAR_FLAG_SINGLE; - star_args_node = pns_arg; + star_args |= 1 << i; + compile_node(comp, pns_arg->nodes[0]); + n_positional++; } else if (MP_PARSE_NODE_STRUCT_KIND(pns_arg) == PN_arglist_dbl_star) { star_flags |= MP_EMIT_STAR_FLAG_DOUBLE; // double-star args are stored as kw arg with key of None @@ -2438,12 +2452,12 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar } } else { normal_argument: - if (star_flags) { - compile_syntax_error(comp, args[i], MP_ERROR_TEXT("non-keyword arg after */**")); + if (star_flags & MP_EMIT_STAR_FLAG_DOUBLE) { + compile_syntax_error(comp, args[i], MP_ERROR_TEXT("positional arg after **")); return; } if (n_keyword > 0) { - compile_syntax_error(comp, args[i], MP_ERROR_TEXT("non-keyword arg after keyword arg")); + compile_syntax_error(comp, args[i], MP_ERROR_TEXT("positional arg after keyword arg")); return; } compile_node(comp, args[i]); @@ -2451,14 +2465,9 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar } } - // compile the star/double-star arguments if we had them - // if we had one but not the other then we load "null" as a place holder if (star_flags != 0) { - if (star_args_node == NULL) { - EMIT(load_null); - } else { - compile_node(comp, star_args_node->nodes[0]); - } + // one extra object that contains the star_args map + EMIT_ARG(load_const_small_int, star_args); } // emit the function/method call diff --git a/py/runtime.c b/py/runtime.c index e6bfbda58d..90722ee18a 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -701,9 +701,9 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ } uint n_args = n_args_n_kw & 0xff; uint n_kw = (n_args_n_kw >> 8) & 0xff; - mp_obj_t pos_seq = args[n_args + 2 * n_kw]; // may be MP_OBJ_NULL + mp_uint_t star_args = mp_obj_get_int_truncated(args[n_args + 2 * n_kw]); - DEBUG_OP_printf("call method var (fun=%p, self=%p, n_args=%u, n_kw=%u, args=%p, seq=%p)\n", fun, self, n_args, n_kw, args, pos_seq); + DEBUG_OP_printf("call method var (fun=%p, self=%p, n_args=%u, n_kw=%u, args=%p, map=%u)\n", fun, self, n_args, n_kw, args, star_args); // We need to create the following array of objects: // args[0 .. n_args] unpacked(pos_seq) args[n_args .. n_args + 2 * n_kw] unpacked(kw_dict) @@ -714,6 +714,20 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ uint args2_alloc; uint args2_len = 0; + // Try to get a hint for unpacked * args length + uint list_len = 0; + + if (star_args != 0) { + for (uint i = 0; i < n_args; i++) { + if (star_args & (1 << i)) { + mp_obj_t len = mp_obj_len_maybe(args[i]); + if (len != MP_OBJ_NULL) { + list_len += mp_obj_get_int(len); + } + } + } + } + // Try to get a hint for the size of the kw_dict uint kw_dict_len = 0; @@ -727,8 +741,8 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ // Extract the pos_seq sequence to the new args array. // Note that it can be arbitrary iterator. - if (pos_seq == MP_OBJ_NULL) { - // no sequence + if (star_args == 0) { + // no star args to unpack // allocate memory for the new array of args args2_alloc = 1 + n_args + 2 * (n_kw + kw_dict_len); @@ -742,33 +756,11 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ // copy the fixed pos args mp_seq_copy(args2 + args2_len, args, n_args, mp_obj_t); args2_len += n_args; - - } else if (mp_obj_is_type(pos_seq, &mp_type_tuple) || mp_obj_is_type(pos_seq, &mp_type_list)) { - // optimise the case of a tuple and list - - // get the items - size_t len; - mp_obj_t *items; - mp_obj_get_array(pos_seq, &len, &items); - - // allocate memory for the new array of args - args2_alloc = 1 + n_args + len + 2 * (n_kw + kw_dict_len); - args2 = mp_nonlocal_alloc(args2_alloc * sizeof(mp_obj_t)); - - // copy the self - if (self != MP_OBJ_NULL) { - args2[args2_len++] = self; - } - - // copy the fixed and variable position args - mp_seq_cat(args2 + args2_len, args, n_args, items, len, mp_obj_t); - args2_len += n_args + len; - } else { - // generic iterator + // at least one star arg to unpack // allocate memory for the new array of args - args2_alloc = 1 + n_args + 2 * (n_kw + kw_dict_len) + 3; + args2_alloc = 1 + n_args + list_len + 2 * (n_kw + kw_dict_len); args2 = mp_nonlocal_alloc(args2_alloc * sizeof(mp_obj_t)); // copy the self @@ -776,26 +768,57 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ args2[args2_len++] = self; } - // copy the fixed position args - mp_seq_copy(args2 + args2_len, args, n_args, mp_obj_t); - args2_len += n_args; + for (uint i = 0; i < n_args; i++) { + mp_obj_t arg = args[i]; + if (star_args & (1 << i)) { + // star arg + if (mp_obj_is_type(arg, &mp_type_tuple) || mp_obj_is_type(arg, &mp_type_list)) { + // optimise the case of a tuple and list - // extract the variable position args from the iterator - mp_obj_iter_buf_t iter_buf; - mp_obj_t iterable = mp_getiter(pos_seq, &iter_buf); - mp_obj_t item; - while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - if (args2_len >= args2_alloc) { - args2 = mp_nonlocal_realloc(args2, args2_alloc * sizeof(mp_obj_t), args2_alloc * 2 * sizeof(mp_obj_t)); - args2_alloc *= 2; + // get the items + size_t len; + mp_obj_t *items; + mp_obj_get_array(arg, &len, &items); + + // copy the items + assert(args2_len + len <= args2_alloc); + mp_seq_copy(args2 + args2_len, items, len, mp_obj_t); + args2_len += len; + } else { + // generic iterator + + // extract the variable position args from the iterator + mp_obj_iter_buf_t iter_buf; + mp_obj_t iterable = mp_getiter(arg, &iter_buf); + mp_obj_t item; + while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { + if (args2_len >= args2_alloc) { + args2 = mp_nonlocal_realloc(args2, args2_alloc * sizeof(mp_obj_t), + args2_alloc * 2 * sizeof(mp_obj_t)); + args2_alloc *= 2; + } + args2[args2_len++] = item; + } + } + } else { + // normal argument + assert(args2_len < args2_alloc); + args2[args2_len++] = arg; } - args2[args2_len++] = item; } } // The size of the args2 array now is the number of positional args. uint pos_args_len = args2_len; + // ensure there is still enough room for kw args + if (args2_len + 2 * (n_kw + kw_dict_len) > args2_alloc) { + uint new_alloc = args2_len + 2 * (n_kw + kw_dict_len); + args2 = mp_nonlocal_realloc(args2, args2_alloc * sizeof(mp_obj_t), + new_alloc * sizeof(mp_obj_t)); + args2_alloc = new_alloc; + } + // Copy the kw args. for (uint i = 0; i < n_kw; i++) { mp_obj_t kw_key = args[n_args + i * 2]; diff --git a/py/vm.c b/py/vm.c index 1450004838..02f8bc88c9 100644 --- a/py/vm.c +++ b/py/vm.c @@ -949,7 +949,7 @@ unwind_jump:; // unum & 0xff == n_positional // (unum >> 8) & 0xff == n_keyword // We have following stack layout here: - // fun arg0 arg1 ... kw0 val0 kw1 val1 ... seq <- TOS + // fun arg0 arg1 ... kw0 val0 kw1 val1 ... bitmap <- TOS sp -= (unum & 0xff) + ((unum >> 7) & 0x1fe) + 1; #if MICROPY_STACKLESS if (mp_obj_get_type(*sp) == &mp_type_fun_bc) { @@ -1034,7 +1034,7 @@ unwind_jump:; // unum & 0xff == n_positional // (unum >> 8) & 0xff == n_keyword // We have following stack layout here: - // fun self arg0 arg1 ... kw0 val0 kw1 val1 ... seq <- TOS + // fun self arg0 arg1 ... kw0 val0 kw1 val1 ... bitmap <- TOS sp -= (unum & 0xff) + ((unum >> 7) & 0x1fe) + 2; #if MICROPY_STACKLESS if (mp_obj_get_type(*sp) == &mp_type_fun_bc) { diff --git a/tests/basics/fun_callstar.py b/tests/basics/fun_callstar.py index a27a288a3c..53d2ece3e1 100644 --- a/tests/basics/fun_callstar.py +++ b/tests/basics/fun_callstar.py @@ -3,10 +3,16 @@ def foo(a, b, c): print(a, b, c) +foo(*(), 1, 2, 3) +foo(*(1,), 2, 3) +foo(*(1, 2), 3) foo(*(1, 2, 3)) foo(1, *(2, 3)) foo(1, 2, *(3,)) foo(1, 2, 3, *()) +foo(*(1,), 2, *(3,)) +foo(*(1, 2), *(3,)) +foo(*(1,), *(2, 3)) # Another sequence type foo(1, 2, *[100]) @@ -29,10 +35,16 @@ class A: print(a, b, c) a = A() +a.foo(*(), 1, 2, 3) +a.foo(*(1,), 2, 3) +a.foo(*(1, 2), 3) a.foo(*(1, 2, 3)) a.foo(1, *(2, 3)) a.foo(1, 2, *(3,)) a.foo(1, 2, 3, *()) +a.foo(*(1,), 2, *(3,)) +a.foo(*(1, 2), *(3,)) +a.foo(*(1,), *(2, 3)) # Another sequence type a.foo(1, 2, *[100]) diff --git a/tests/basics/fun_callstardblstar.py b/tests/basics/fun_callstardblstar.py index f2fd29107e..aceb04a843 100644 --- a/tests/basics/fun_callstardblstar.py +++ b/tests/basics/fun_callstardblstar.py @@ -6,6 +6,11 @@ def f(a, b, c, d): f(*(1, 2), **{'c':3, 'd':4}) f(*(1, 2), **{['c', 'd'][i]:(3 + i) for i in range(2)}) +try: + eval("f(**{'a': 1}, *(2, 3, 4))") +except SyntaxError: + print("SyntaxError") + # test calling a method with *tuple and **dict class A: @@ -15,3 +20,8 @@ class A: a = A() a.f(*(1, 2), **{'c':3, 'd':4}) a.f(*(1, 2), **{['c', 'd'][i]:(3 + i) for i in range(2)}) + +try: + eval("a.f(**{'a': 1}, *(2, 3, 4))") +except SyntaxError: + print("SyntaxError") diff --git a/tests/basics/fun_kwvarargs.py b/tests/basics/fun_kwvarargs.py index bdc10fcf14..e9fd0720e9 100644 --- a/tests/basics/fun_kwvarargs.py +++ b/tests/basics/fun_kwvarargs.py @@ -23,3 +23,16 @@ def f4(*vargs, **kwargs): f4(*(1, 2)) f4(kw_arg=3) f4(*(1, 2), kw_arg=3) + + +# test evaluation order of arguments +def f5(*vargs, **kwargs): + print(vargs, kwargs) + + +def print_ret(x): + print(x) + return x + + +f5(*print_ret(["a", "b"]), kw_arg=print_ret(None)) diff --git a/tests/basics/python34.py b/tests/basics/python34.py index 609a8b6b84..36e25e20dd 100644 --- a/tests/basics/python34.py +++ b/tests/basics/python34.py @@ -6,26 +6,23 @@ except NameError: print("SKIP") raise SystemExit -# from basics/fun_kwvarargs.py -# test evaluation order of arguments (in 3.4 it's backwards, 3.5 it's fixed) -def f4(*vargs, **kwargs): - print(vargs, kwargs) + def print_ret(x): print(x) return x -f4(*print_ret(['a', 'b']), kw_arg=print_ret(None)) # test evaluation order of dictionary key/value pair (in 3.4 it's backwards) {print_ret(1):print_ret(2)} + # from basics/syntaxerror.py def test_syntax(code): try: exec(code) except SyntaxError: print("SyntaxError") -test_syntax("f(*a, *b)") # can't have multiple * (in 3.5 we can) -test_syntax("f(*a, b)") # can't have positional after * + + test_syntax("f(**a, b)") # can't have positional after ** test_syntax("() = []") # can't assign to empty tuple (in 3.6 we can) test_syntax("del ()") # can't delete empty tuple (in 3.6 we can) diff --git a/tests/basics/python34.py.exp b/tests/basics/python34.py.exp index 75f1c2c056..a56c1a50b6 100644 --- a/tests/basics/python34.py.exp +++ b/tests/basics/python34.py.exp @@ -1,13 +1,8 @@ -None -['a', 'b'] -('a', 'b') {'kw_arg': None} 2 1 SyntaxError SyntaxError SyntaxError -SyntaxError -SyntaxError 3.4 3 4 IndexError('foo',) diff --git a/tests/cpydiff/syntax_arg_unpacking.py b/tests/cpydiff/syntax_arg_unpacking.py new file mode 100644 index 0000000000..e54832ddb9 --- /dev/null +++ b/tests/cpydiff/syntax_arg_unpacking.py @@ -0,0 +1,23 @@ +""" +categories: Syntax +description: Argument unpacking does not work if the argument being unpacked is the nth or greater argument where n is the number of bits in an MP_SMALL_INT. +cause: The implementation uses an MP_SMALL_INT to flag args that need to be unpacked. +workaround: Use fewer arguments. +""" + + +def example(*args): + print(len(args)) + + +MORE = ["a", "b", "c"] + +# fmt: off +example( + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + *MORE, +) +# fmt: on From 3679a47eb064850406f473bc435c36d95017c16e Mon Sep 17 00:00:00 2001 From: David Lechner Date: Tue, 29 Mar 2022 12:11:42 -0500 Subject: [PATCH 0287/1712] py/runtime: Do not overallocate when len is known. This fixes overallocating an extra mp_obj_t when the length of *args and **args is known. Previously we were allocating 1 mp_obj_t for each n_args and n_kw plus the length of each *arg and **arg (if they are known). Since n_args includes *args and n_kw includes **args, this was allocating an extra mp_obj_t in addition to the length of these args when unpacked. To fix this, we just subtract 1 from the length to account for the 1 already implicitly allocated by n_args and n_kw. Signed-off-by: David Lechner --- py/runtime.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/py/runtime.c b/py/runtime.c index 90722ee18a..95990197d0 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -715,27 +715,29 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ uint args2_len = 0; // Try to get a hint for unpacked * args length - uint list_len = 0; + int list_len = 0; if (star_args != 0) { for (uint i = 0; i < n_args; i++) { if (star_args & (1 << i)) { mp_obj_t len = mp_obj_len_maybe(args[i]); if (len != MP_OBJ_NULL) { - list_len += mp_obj_get_int(len); + // -1 accounts for 1 of n_args occupied by this arg + list_len += mp_obj_get_int(len) - 1; } } } } // Try to get a hint for the size of the kw_dict - uint kw_dict_len = 0; + int kw_dict_len = 0; for (uint i = 0; i < n_kw; i++) { mp_obj_t key = args[n_args + i * 2]; mp_obj_t value = args[n_args + i * 2 + 1]; if (key == MP_OBJ_NULL && value != MP_OBJ_NULL && mp_obj_is_type(value, &mp_type_dict)) { - kw_dict_len += mp_obj_dict_len(value); + // -1 accounts for 1 of n_kw occupied by this arg + kw_dict_len += mp_obj_dict_len(value) - 1; } } From 9b74d71aa74d368e0679616173edb4be49e03684 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Tue, 29 Mar 2022 12:44:58 -0500 Subject: [PATCH 0288/1712] py/runtime: Drop new_alloc < 4 check. To reach this check, n_kw has to be >= 1 and therefore args2_alloc has to be >= 2. Therefore new_alloc will always be >= 4. So this check will never be true and can be removed. Signed-off-by: David Lechner --- py/runtime.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/py/runtime.c b/py/runtime.c index 95990197d0..7355817b69 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -860,9 +860,6 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ // expand size of args array if needed if (args2_len + 1 >= args2_alloc) { uint new_alloc = args2_alloc * 2; - if (new_alloc < 4) { - new_alloc = 4; - } args2 = mp_nonlocal_realloc(args2, args2_alloc * sizeof(mp_obj_t), new_alloc * sizeof(mp_obj_t)); args2_alloc = new_alloc; } From 47685180f02254a9d2dfd2eb9dafc24888daeb33 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Tue, 29 Mar 2022 13:15:15 -0500 Subject: [PATCH 0289/1712] tests/basics/fun_callstardblstar: Add coverage test. This fixes code coverage for the case where a *arg without __len__ is unpacked and uses exactly the amount of memory that was allocated for kw args. This triggers the code branch where the memory for the kw args gets reallocated since it was used already by the *arg unpacking. Signed-off-by: David Lechner --- tests/basics/fun_callstardblstar.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/basics/fun_callstardblstar.py b/tests/basics/fun_callstardblstar.py index aceb04a843..7db458b561 100644 --- a/tests/basics/fun_callstardblstar.py +++ b/tests/basics/fun_callstardblstar.py @@ -25,3 +25,12 @@ try: eval("a.f(**{'a': 1}, *(2, 3, 4))") except SyntaxError: print("SyntaxError") + + +# coverage test for arg allocation corner case + +def f2(*args, **kwargs): + print(len(args), len(kwargs)) + + +f2(*iter(range(4)), **{'a': 1}) From 2e3f2045f9a7511987e69a8be0d3d117502e4bb1 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 30 Mar 2022 10:47:06 -0500 Subject: [PATCH 0290/1712] py/runtime: Use size_t/ssize_t instead of uint/int. This replaces instances of uint with size_t and int with ssize_t in the mp_call_prepare_args_n_kw_var() function since all of the variables are used as array offsets. Also sort headers while we are touching this. Signed-off-by: David Lechner --- py/runtime.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/py/runtime.c b/py/runtime.c index 7355817b69..594e63082b 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -25,10 +25,11 @@ * THE SOFTWARE. */ +#include #include #include #include -#include +#include #include "py/parsenum.h" #include "py/compile.h" @@ -699,8 +700,8 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ if (have_self) { self = *args++; // may be MP_OBJ_NULL } - uint n_args = n_args_n_kw & 0xff; - uint n_kw = (n_args_n_kw >> 8) & 0xff; + size_t n_args = n_args_n_kw & 0xff; + size_t n_kw = (n_args_n_kw >> 8) & 0xff; mp_uint_t star_args = mp_obj_get_int_truncated(args[n_args + 2 * n_kw]); DEBUG_OP_printf("call method var (fun=%p, self=%p, n_args=%u, n_kw=%u, args=%p, map=%u)\n", fun, self, n_args, n_kw, args, star_args); @@ -711,14 +712,14 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ // The new args array mp_obj_t *args2; - uint args2_alloc; - uint args2_len = 0; + size_t args2_alloc; + size_t args2_len = 0; // Try to get a hint for unpacked * args length - int list_len = 0; + ssize_t list_len = 0; if (star_args != 0) { - for (uint i = 0; i < n_args; i++) { + for (size_t i = 0; i < n_args; i++) { if (star_args & (1 << i)) { mp_obj_t len = mp_obj_len_maybe(args[i]); if (len != MP_OBJ_NULL) { @@ -730,9 +731,9 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ } // Try to get a hint for the size of the kw_dict - int kw_dict_len = 0; + ssize_t kw_dict_len = 0; - for (uint i = 0; i < n_kw; i++) { + for (size_t i = 0; i < n_kw; i++) { mp_obj_t key = args[n_args + i * 2]; mp_obj_t value = args[n_args + i * 2 + 1]; if (key == MP_OBJ_NULL && value != MP_OBJ_NULL && mp_obj_is_type(value, &mp_type_dict)) { @@ -770,7 +771,7 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ args2[args2_len++] = self; } - for (uint i = 0; i < n_args; i++) { + for (size_t i = 0; i < n_args; i++) { mp_obj_t arg = args[i]; if (star_args & (1 << i)) { // star arg @@ -811,18 +812,18 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ } // The size of the args2 array now is the number of positional args. - uint pos_args_len = args2_len; + size_t pos_args_len = args2_len; // ensure there is still enough room for kw args if (args2_len + 2 * (n_kw + kw_dict_len) > args2_alloc) { - uint new_alloc = args2_len + 2 * (n_kw + kw_dict_len); + size_t new_alloc = args2_len + 2 * (n_kw + kw_dict_len); args2 = mp_nonlocal_realloc(args2, args2_alloc * sizeof(mp_obj_t), new_alloc * sizeof(mp_obj_t)); args2_alloc = new_alloc; } // Copy the kw args. - for (uint i = 0; i < n_kw; i++) { + for (size_t i = 0; i < n_kw; i++) { mp_obj_t kw_key = args[n_args + i * 2]; mp_obj_t kw_value = args[n_args + i * 2 + 1]; if (kw_key == MP_OBJ_NULL) { @@ -859,7 +860,7 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ while ((key = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { // expand size of args array if needed if (args2_len + 1 >= args2_alloc) { - uint new_alloc = args2_alloc * 2; + size_t new_alloc = args2_alloc * 2; args2 = mp_nonlocal_realloc(args2, args2_alloc * sizeof(mp_obj_t), new_alloc * sizeof(mp_obj_t)); args2_alloc = new_alloc; } From e3de723e2d955ca89c8b06bb2c4ae86724aad77b Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 31 Mar 2022 23:59:10 +1100 Subject: [PATCH 0291/1712] py/emitbc: Assert that a small int fits its encoding when emitting one. Signed-off-by: Damien George --- py/emitbc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/py/emitbc.c b/py/emitbc.c index 21ec121911..a9d5b3799e 100644 --- a/py/emitbc.c +++ b/py/emitbc.c @@ -32,6 +32,7 @@ #include #include "py/mpstate.h" +#include "py/smallint.h" #include "py/emit.h" #include "py/bc0.h" @@ -471,6 +472,7 @@ void mp_emit_bc_load_const_tok(emit_t *emit, mp_token_kind_t tok) { } void mp_emit_bc_load_const_small_int(emit_t *emit, mp_int_t arg) { + assert(MP_SMALL_INT_FITS(arg)); if (-MP_BC_LOAD_CONST_SMALL_INT_MULTI_EXCESS <= arg && arg < MP_BC_LOAD_CONST_SMALL_INT_MULTI_NUM - MP_BC_LOAD_CONST_SMALL_INT_MULTI_EXCESS) { emit_write_bytecode_byte(emit, 1, From bd556b69960cafc97353e736f825eca5c00b0c29 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 1 Apr 2022 00:00:58 +1100 Subject: [PATCH 0292/1712] py: Fix compiling and decoding of *args at large arg positions. There were two issues with the existing code: 1. "1 << i" is computed as a 32-bit number so would overflow when executed on 64-bit machines (when mp_uint_t is 64-bit). This meant that *args beyond 32 positions would not be handled correctly. 2. star_args must fit as a positive small int so that it is encoded correctly in the emitted code. MP_SMALL_INT_BITS is too big because it overflows a small int by 1 bit. MP_SMALL_INT_BITS - 1 does not work because it produces a signed small int which is then sign extended when extracted (even by mp_obj_get_int_truncated), and this sign extension means that any position arg after *args is also treated as a star-arg. So the maximum bit position is MP_SMALL_INT_BITS - 2. This means that MP_OBJ_SMALL_INT_VALUE() can be used instead of mp_obj_get_int_truncated() to get the value of star_args. These issues are fixed by this commit, and a test added. Signed-off-by: Damien George --- py/compile.c | 6 ++--- py/runtime.c | 6 ++--- tests/stress/fun_call_limit.py | 36 ++++++++++++++++++++++++++++++ tests/stress/fun_call_limit.py.exp | 2 ++ 4 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 tests/stress/fun_call_limit.py create mode 100644 tests/stress/fun_call_limit.py.exp diff --git a/py/compile.c b/py/compile.c index fc11062705..e4ead7f1ac 100644 --- a/py/compile.c +++ b/py/compile.c @@ -2408,9 +2408,9 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar return; } #if MICROPY_DYNAMIC_COMPILER - if (i > mp_dynamic_compiler.small_int_bits) + if (i >= (size_t)mp_dynamic_compiler.small_int_bits - 1) #else - if (i > MP_SMALL_INT_BITS) + if (i >= MP_SMALL_INT_BITS - 1) #endif { // If there are not enough bits in a small int to fit the flag, then we consider @@ -2419,7 +2419,7 @@ STATIC void compile_trailer_paren_helper(compiler_t *comp, mp_parse_node_t pn_ar return; } star_flags |= MP_EMIT_STAR_FLAG_SINGLE; - star_args |= 1 << i; + star_args |= (mp_uint_t)1 << i; compile_node(comp, pns_arg->nodes[0]); n_positional++; } else if (MP_PARSE_NODE_STRUCT_KIND(pns_arg) == PN_arglist_dbl_star) { diff --git a/py/runtime.c b/py/runtime.c index 594e63082b..ad066acb16 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -702,7 +702,7 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ } size_t n_args = n_args_n_kw & 0xff; size_t n_kw = (n_args_n_kw >> 8) & 0xff; - mp_uint_t star_args = mp_obj_get_int_truncated(args[n_args + 2 * n_kw]); + mp_uint_t star_args = MP_OBJ_SMALL_INT_VALUE(args[n_args + 2 * n_kw]); DEBUG_OP_printf("call method var (fun=%p, self=%p, n_args=%u, n_kw=%u, args=%p, map=%u)\n", fun, self, n_args, n_kw, args, star_args); @@ -720,7 +720,7 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ if (star_args != 0) { for (size_t i = 0; i < n_args; i++) { - if (star_args & (1 << i)) { + if ((star_args >> i) & 1) { mp_obj_t len = mp_obj_len_maybe(args[i]); if (len != MP_OBJ_NULL) { // -1 accounts for 1 of n_args occupied by this arg @@ -773,7 +773,7 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ for (size_t i = 0; i < n_args; i++) { mp_obj_t arg = args[i]; - if (star_args & (1 << i)) { + if ((star_args >> i) & 1) { // star arg if (mp_obj_is_type(arg, &mp_type_tuple) || mp_obj_is_type(arg, &mp_type_list)) { // optimise the case of a tuple and list diff --git a/tests/stress/fun_call_limit.py b/tests/stress/fun_call_limit.py new file mode 100644 index 0000000000..b802aadd55 --- /dev/null +++ b/tests/stress/fun_call_limit.py @@ -0,0 +1,36 @@ +# Test the limit of the number of arguments to a function call. +# This currently tests the case of *args after many positional args. + + +def f(*args): + return len(args) + + +def test(n): + pos_args = ",".join(str(i) for i in range(n)) + s = "f({}, *(100, 101), 102, 103)".format(pos_args) + try: + return eval(s) + except SyntaxError: + return "SyntaxError" + + +# If the port has at least 32-bits then this test should pass. +print(test(29)) + +# This test should fail on all ports (overflows a small int). +print(test(70)) + +# Check that there is a correct transition to the limit of too many args before *args. +reached_limit = False +for i in range(30, 70): + result = test(i) + if reached_limit: + if result != "SyntaxError": + print("FAIL") + else: + if result == "SyntaxError": + reached_limit = True + else: + if result != i + 4: + print("FAIL") diff --git a/tests/stress/fun_call_limit.py.exp b/tests/stress/fun_call_limit.py.exp new file mode 100644 index 0000000000..53d2b28043 --- /dev/null +++ b/tests/stress/fun_call_limit.py.exp @@ -0,0 +1,2 @@ +33 +SyntaxError From 40f5c743db7f16a0b898fe1697c626e53aa6500d Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 1 Apr 2022 00:21:03 +1100 Subject: [PATCH 0293/1712] py/runtime: Remove unnecessary check for kw_value == MP_OBJ_NULL. The values are always real objects, only the key can be MP_OBJ_NULL to indicate a **kwargs entry. Signed-off-by: Damien George --- py/runtime.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/py/runtime.c b/py/runtime.c index ad066acb16..2a07df6642 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -828,9 +828,7 @@ void mp_call_prepare_args_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ mp_obj_t kw_value = args[n_args + i * 2 + 1]; if (kw_key == MP_OBJ_NULL) { // double-star args - if (kw_value == MP_OBJ_NULL) { - // pass - } else if (mp_obj_is_type(kw_value, &mp_type_dict)) { + if (mp_obj_is_type(kw_value, &mp_type_dict)) { // dictionary mp_map_t *map = mp_obj_dict_get_map(kw_value); // should have enough, since kw_dict_len is in this case hinted correctly above From 1dbf393962428bdab1362c77f59745f28d2cdd53 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 1 Apr 2022 00:21:58 +1100 Subject: [PATCH 0294/1712] tests/basics/fun_callstardblstar: Add test for large arg allocation. Signed-off-by: Damien George --- tests/basics/fun_callstardblstar.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/basics/fun_callstardblstar.py b/tests/basics/fun_callstardblstar.py index 7db458b561..f395df3333 100644 --- a/tests/basics/fun_callstardblstar.py +++ b/tests/basics/fun_callstardblstar.py @@ -34,3 +34,6 @@ def f2(*args, **kwargs): f2(*iter(range(4)), **{'a': 1}) + +# case where *args is not a tuple/list and takes up most of the memory allocated for **kwargs +f2(*iter(range(100)), **{str(i): i for i in range(100)}) From 8baf05af8c8011d586ce767da70b4c6f47f55d6c Mon Sep 17 00:00:00 2001 From: Daniel Jour Date: Tue, 29 Mar 2022 13:42:19 +0200 Subject: [PATCH 0295/1712] py/makeqstrdefs: Cleanup and extend source file classification. - The classification of source files in makeqstrdefs.py has been moved into functions to consolidate the logic for that classification into a single place. - Classification of source files (into C or C++ or "other" files) is based on the filename extension. - For C++ there are many more common filename extensions than just ".cpp"; see "Options Controlling the Kind of Output" in man gcc for example. All common extensions for C++ source files which need preprocessing have been added. --- py/makeqstrdefs.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/py/makeqstrdefs.py b/py/makeqstrdefs.py index 187a9aeeaa..1a63bd39a9 100644 --- a/py/makeqstrdefs.py +++ b/py/makeqstrdefs.py @@ -22,6 +22,14 @@ _MODE_QSTR = "qstr" _MODE_COMPRESS = "compress" +def is_c_source(fname): + return os.path.splitext(fname)[1] in [".c"] + + +def is_cxx_source(fname): + return os.path.splitext(fname)[1] in [".cc", ".cp", ".cxx", ".cpp", ".CPP", ".c++", ".C"] + + def preprocess(): if any(src in args.dependencies for src in args.changed_sources): sources = args.sources @@ -32,9 +40,9 @@ def preprocess(): csources = [] cxxsources = [] for source in sources: - if source.endswith(".cpp"): + if is_cxx_source(source): cxxsources.append(source) - elif source.endswith(".c"): + elif is_c_source(source): csources.append(source) try: os.makedirs(os.path.dirname(args.output[0])) @@ -87,7 +95,7 @@ def process_file(f): m = re_line.match(line) assert m is not None fname = m.group(1) - if os.path.splitext(fname)[1] not in [".c", ".cpp"]: + if not is_c_source(fname) and not is_cxx_source(fname): continue if fname != last_fname: write_out(last_fname, output) From ff287d085f95ab0ca3fdf67ee9d8cce6f046b01e Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Mon, 17 Jan 2022 00:12:01 +0200 Subject: [PATCH 0296/1712] stm32/pyb_can: Enable CAN FD frame support and BRS. - Enable CAN FD frame support and BRS. - Optimize the message RAM usage per FDCAN instance. - Document the usage and different sections of the Message RAM. --- ports/stm32/fdcan.c | 94 +++++++++++++++++------------ ports/stm32/pyb_can.c | 133 +++++++++++++++++++++++++++++------------- 2 files changed, 149 insertions(+), 78 deletions(-) diff --git a/ports/stm32/fdcan.c b/ports/stm32/fdcan.c index 8465b806ae..63c6c31238 100644 --- a/ports/stm32/fdcan.c +++ b/ports/stm32/fdcan.c @@ -56,14 +56,19 @@ #define FDCAN_IT_GROUP_RX_FIFO1 (FDCAN_ILS_RF1NL | FDCAN_ILS_RF1FL | FDCAN_ILS_RF1LL) #endif +// The dedicated Message RAM should be 2560 words, but the way it's defined in stm32h7xx_hal_fdcan.c +// as (SRAMCAN_BASE + FDCAN_MESSAGE_RAM_SIZE - 0x4U) limits the usable number of words to 2559 words. +#define FDCAN_MESSAGE_RAM_SIZE (2560 - 1) + // also defined in _hal_fdcan.c, but not able to declare extern and reach the variable -static const uint8_t DLCtoBytes[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 20, 24, 32, 48, 64}; +const uint8_t DLCtoBytes[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 20, 24, 32, 48, 64}; bool can_init(pyb_can_obj_t *can_obj, uint32_t mode, uint32_t prescaler, uint32_t sjw, uint32_t bs1, uint32_t bs2, bool auto_restart) { (void)auto_restart; FDCAN_InitTypeDef *init = &can_obj->can.Init; - init->FrameFormat = FDCAN_FRAME_CLASSIC; + // Configure FDCAN with FD frame and BRS support. + init->FrameFormat = FDCAN_FRAME_FD_BRS; init->Mode = mode; init->NominalPrescaler = prescaler; // tq = NominalPrescaler x (1/fdcan_ker_ck) @@ -81,46 +86,58 @@ bool can_init(pyb_can_obj_t *can_obj, uint32_t mode, uint32_t prescaler, uint32_ init->DataSyncJumpWidth = 1; init->DataTimeSeg1 = 1; init->DataTimeSeg2 = 1; - #endif - - #if defined(STM32H7) - // variable used to specify RAM address in HAL, only for H7, G4 uses defined offset address in HAL - // The Message RAM is shared between CAN1 and CAN2. Setting the offset to half - // the Message RAM for the second CAN and using half the resources for each CAN. + init->StdFiltersNbr = 28; // /2 ? if FDCAN2 is used !!? + init->ExtFiltersNbr = 0; // Not used + init->TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION; + #elif defined(STM32H7) + // The dedicated FDCAN RAM is 2560 32-bit words and shared between the FDCAN instances. + // To support 2 FDCAN instances simultaneously, the Message RAM is divided in half by + // setting the second FDCAN memory offset to half the RAM size. With this configuration, + // the maximum words per FDCAN instance is 1280 32-bit words. if (can_obj->can_id == PYB_CAN_1) { init->MessageRAMOffset = 0; } else { - init->MessageRAMOffset = 2560 / 2; + init->MessageRAMOffset = FDCAN_MESSAGE_RAM_SIZE / 2; } - #endif + // An element stored in the Message RAM contains an identifier, DLC, control bits, the + // data field and the specific transmission or reception bits field for control. + // The following code configures the different Message RAM sections per FDCAN instance. - #if defined(STM32G4) + // The RAM filtering section is configured for 64 x 1 word elements for 11-bit standard + // identifiers, and 31 x 2 words elements for 29-bit extended identifiers. + // The total number of words reserved for the filtering per FDCAN instance is 126 words. + init->StdFiltersNbr = 64; + // Note extended identifiers are Not used in pyb_can.c and Not handled correctly. + // Disable the extended identifiers filters for now until this is fixed properly. + init->ExtFiltersNbr = 0 /*31*/; - init->StdFiltersNbr = 28; // /2 ? if FDCAN2 is used !!? - init->ExtFiltersNbr = 0; // Not used - - #elif defined(STM32H7) - - init->StdFiltersNbr = 64; // 128 / 2 - init->ExtFiltersNbr = 0; // Not used - - init->TxEventsNbr = 16; // 32 / 2 - init->RxBuffersNbr = 32; // 64 / 2 - init->TxBuffersNbr = 16; // 32 / 2 - - init->RxFifo0ElmtsNbr = 64; // 128 / 2 - init->RxFifo0ElmtSize = FDCAN_DATA_BYTES_8; - - init->RxFifo1ElmtsNbr = 64; // 128 / 2 - init->RxFifo1ElmtSize = FDCAN_DATA_BYTES_8; - - init->TxFifoQueueElmtsNbr = 16; // Tx fifo elements - init->TxElmtSize = FDCAN_DATA_BYTES_8; - - #endif + // The Tx event FIFO is used to store the message ID and the timestamp of successfully + // transmitted elements. The Tx event FIFO can store a maximum of 32 (2 words) elements. + // NOTE: Events are stored in Tx event FIFO only if tx_msg.TxEventFifoControl is enabled. + init->TxEventsNbr = 0; + // Transmission section is configured in FIFO mode operation, with no dedicated Tx buffers. + // The Tx FIFO can store a maximum of 32 elements (or 576 words), each element is 18 words + // long (to support a maximum of 64 bytes data field): + // 2 words header + 16 words data field (to support up to 64 bytes of data). + // The total number of words reserved for the Tx FIFO per FDCAN instance is 288 words. + init->TxBuffersNbr = 0; + init->TxFifoQueueElmtsNbr = 16; + init->TxElmtSize = FDCAN_DATA_BYTES_64; init->TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION; + // Reception section is configured to use Rx FIFO 0 and Rx FIFO1, with no dedicated Rx buffers. + // Each Rx FIFO can store a maximum of 64 elements (1152 words), each element is 18 words + // long (to support a maximum of 64 bytes data field): + // 2 words header + 16 words data field (to support up to 64 bytes of data). + // The total number of words reserved for the Rx FIFOs per FDCAN instance is 864 words. + init->RxBuffersNbr = 0; + init->RxFifo0ElmtsNbr = 24; + init->RxFifo0ElmtSize = FDCAN_DATA_BYTES_64; + init->RxFifo1ElmtsNbr = 24; + init->RxFifo1ElmtSize = FDCAN_DATA_BYTES_64; + #endif + FDCAN_GlobalTypeDef *CANx = NULL; const pin_obj_t *pins[2]; @@ -159,7 +176,10 @@ bool can_init(pyb_can_obj_t *can_obj, uint32_t mode, uint32_t prescaler, uint32_ // init CANx can_obj->can.Instance = CANx; - HAL_FDCAN_Init(&can_obj->can); + // catch bad configuration errors. + if (HAL_FDCAN_Init(&can_obj->can) != HAL_OK) { + return false; + } // Disable acceptance of non-matching frames (enabled by default) HAL_FDCAN_ConfigGlobalFilter(&can_obj->can, FDCAN_REJECT, FDCAN_REJECT, DISABLE, DISABLE); @@ -168,7 +188,7 @@ bool can_init(pyb_can_obj_t *can_obj, uint32_t mode, uint32_t prescaler, uint32_ HAL_FDCAN_Start(&can_obj->can); // Reset all filters - for (int f = 0; f < 64; ++f) { + for (int f = 0; f < init->StdFiltersNbr; ++f) { can_clearfilter(can_obj, f, 0); } @@ -299,10 +319,12 @@ int can_receive(FDCAN_HandleTypeDef *can, int fifo, FDCAN_RxHeaderTypeDef *hdr, hdr->FDFormat = *address & FDCAN_ELEMENT_MASK_FDF; hdr->FilterIndex = (*address & FDCAN_ELEMENT_MASK_FIDX) >> 24; hdr->IsFilterMatchingFrame = (*address++ & FDCAN_ELEMENT_MASK_ANMF) >> 31; + // Convert DLC to Bytes. + hdr->DataLength = DLCtoBytes[hdr->DataLength]; // Copy data uint8_t *pdata = (uint8_t *)address; - for (uint32_t i = 0; i < DLCtoBytes[hdr->DataLength]; ++i) { + for (uint32_t i = 0; i < hdr->DataLength; ++i) { *data++ = *pdata++; } diff --git a/ports/stm32/pyb_can.c b/ports/stm32/pyb_can.c index 8007fd9e3c..0c5c60255d 100644 --- a/ports/stm32/pyb_can.c +++ b/ports/stm32/pyb_can.c @@ -42,6 +42,7 @@ #if MICROPY_HW_ENABLE_FDCAN #define CAN_MAX_FILTER (64) +#define CAN_MAX_DATA_FRAME (64) #define CAN_FIFO0 FDCAN_RX_FIFO0 #define CAN_FIFO1 FDCAN_RX_FIFO1 @@ -89,10 +90,11 @@ // Both banks start at 0 STATIC uint8_t can2_start_bank = 0; - +extern const uint8_t DLCtoBytes[16]; #else #define CAN_MAX_FILTER (28) +#define CAN_MAX_DATA_FRAME (8) #define CAN_DEFAULT_PRESCALER (100) #define CAN_DEFAULT_SJW (1) @@ -180,19 +182,50 @@ STATIC uint32_t pyb_can_get_source_freq() { return can_kern_clk; } +STATIC void pyb_can_get_bit_timing(mp_uint_t baudrate, mp_uint_t sample_point, + mp_int_t *bs1_out, mp_int_t *bs2_out, mp_int_t *prescaler_out) { + uint32_t can_kern_clk = pyb_can_get_source_freq(); + + // The following max values work on all MCUs for classical CAN. + for (int brp = 1; brp < 512; brp++) { + for (int bs1 = 1; bs1 < 16; bs1++) { + for (int bs2 = 1; bs2 < 8; bs2++) { + if ((baudrate == (can_kern_clk / (brp * (1 + bs1 + bs2)))) && + ((sample_point * 10) == (((1 + bs1) * 1000) / (1 + bs1 + bs2)))) { + *bs1_out = bs1; + *bs2_out = bs2; + *prescaler_out = brp; + return; + } + } + } + } + + mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("couldn't match baudrate and sample point")); +} + // init(mode, extframe=False, prescaler=100, *, sjw=1, bs1=6, bs2=8) STATIC mp_obj_t pyb_can_init_helper(pyb_can_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_mode, ARG_extframe, ARG_prescaler, ARG_sjw, ARG_bs1, ARG_bs2, ARG_auto_restart, ARG_baudrate, ARG_sample_point }; + enum { ARG_mode, ARG_extframe, ARG_prescaler, ARG_sjw, ARG_bs1, ARG_bs2, ARG_auto_restart, ARG_baudrate, ARG_sample_point, + ARG_brs_prescaler, ARG_brs_sjw, ARG_brs_bs1, ARG_brs_bs2, ARG_brs_baudrate, ARG_brs_sample_point }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = CAN_MODE_NORMAL} }, - { MP_QSTR_extframe, MP_ARG_BOOL, {.u_bool = false} }, - { MP_QSTR_prescaler, MP_ARG_INT, {.u_int = CAN_DEFAULT_PRESCALER} }, - { MP_QSTR_sjw, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = CAN_DEFAULT_SJW} }, - { MP_QSTR_bs1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = CAN_DEFAULT_BS1} }, - { MP_QSTR_bs2, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = CAN_DEFAULT_BS2} }, - { MP_QSTR_auto_restart, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, - { MP_QSTR_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, - { MP_QSTR_sample_point, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 75} }, // 75% sampling point + { MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = CAN_MODE_NORMAL} }, + { MP_QSTR_extframe, MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_prescaler, MP_ARG_INT, {.u_int = CAN_DEFAULT_PRESCALER} }, + { MP_QSTR_sjw, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = CAN_DEFAULT_SJW} }, + { MP_QSTR_bs1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = CAN_DEFAULT_BS1} }, + { MP_QSTR_bs2, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = CAN_DEFAULT_BS2} }, + { MP_QSTR_auto_restart, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_sample_point, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 75} }, // 75% sampling point + #if MICROPY_HW_ENABLE_FDCAN + { MP_QSTR_brs_prescaler, MP_ARG_INT, {.u_int = CAN_DEFAULT_PRESCALER} }, + { MP_QSTR_brs_sjw, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = CAN_DEFAULT_SJW} }, + { MP_QSTR_brs_bs1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = CAN_DEFAULT_BS1} }, + { MP_QSTR_brs_bs2, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = CAN_DEFAULT_BS2} }, + { MP_QSTR_brs_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_brs_sample_point, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} } + #endif }; // parse args @@ -206,34 +239,30 @@ STATIC mp_obj_t pyb_can_init_helper(pyb_can_obj_t *self, size_t n_args, const mp // Calculate CAN bit timing from baudrate if provided if (args[ARG_baudrate].u_int != 0) { - uint32_t baudrate = args[ARG_baudrate].u_int; - uint32_t sampoint = args[ARG_sample_point].u_int; - uint32_t can_kern_clk = pyb_can_get_source_freq(); - bool timing_found = false; - - // The following max values work on all MCUs for classical CAN. - for (int brp = 1; brp < 512 && !timing_found; brp++) { - for (int bs1 = 1; bs1 < 16 && !timing_found; bs1++) { - for (int bs2 = 1; bs2 < 8 && !timing_found; bs2++) { - if ((baudrate == (can_kern_clk / (brp * (1 + bs1 + bs2)))) && - ((sampoint * 10) == (((1 + bs1) * 1000) / (1 + bs1 + bs2)))) { - args[ARG_bs1].u_int = bs1; - args[ARG_bs2].u_int = bs2; - args[ARG_prescaler].u_int = brp; - timing_found = true; - } - } - } - } - if (!timing_found) { - mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("couldn't match baudrate and sample point")); - } + pyb_can_get_bit_timing(args[ARG_baudrate].u_int, args[ARG_sample_point].u_int, + &args[ARG_bs1].u_int, &args[ARG_bs2].u_int, &args[ARG_prescaler].u_int); } - // init CAN (if it fails, it's because the port doesn't exist) + #if MICROPY_HW_ENABLE_FDCAN + // If no sample point is provided for data bit timing, use the nominal sample point. + if (args[ARG_brs_sample_point].u_int == 0) { + args[ARG_brs_sample_point].u_int = args[ARG_sample_point].u_int; + } + // Calculate BRS CAN bit timing from baudrate if provided + if (args[ARG_brs_baudrate].u_int != 0) { + pyb_can_get_bit_timing(args[ARG_brs_baudrate].u_int, args[ARG_brs_sample_point].u_int, + &args[ARG_brs_bs1].u_int, &args[ARG_brs_bs2].u_int, &args[ARG_brs_prescaler].u_int); + } + // Set BRS bit timings. + self->can.Init.DataPrescaler = args[ARG_brs_prescaler].u_int; + self->can.Init.DataSyncJumpWidth = args[ARG_brs_sjw].u_int; + self->can.Init.DataTimeSeg1 = args[ARG_bs1].u_int; // DataTimeSeg1 = Propagation_segment + Phase_segment_1 + self->can.Init.DataTimeSeg2 = args[ARG_bs2].u_int; + #endif + if (!can_init(self, args[ARG_mode].u_int, args[ARG_prescaler].u_int, args[ARG_sjw].u_int, args[ARG_bs1].u_int, args[ARG_bs2].u_int, args[ARG_auto_restart].u_bool)) { - mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("CAN(%d) doesn't exist"), self->can_id); + mp_raise_msg_varg(&mp_type_ValueError, MP_ERROR_TEXT("CAN(%d) init failure"), self->can_id); } return mp_const_none; @@ -450,12 +479,16 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_can_any_obj, pyb_can_any); // send(send, addr, *, timeout=5000) STATIC mp_obj_t pyb_can_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_data, ARG_id, ARG_timeout, ARG_rtr }; + enum { ARG_data, ARG_id, ARG_timeout, ARG_rtr, ARG_fdf, ARG_brs }; static const mp_arg_t allowed_args[] = { { MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_id, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_rtr, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + #if MICROPY_HW_ENABLE_FDCAN + { MP_QSTR_fdf, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_brs, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + #endif }; // parse args @@ -468,7 +501,7 @@ STATIC mp_obj_t pyb_can_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t * uint8_t data[1]; pyb_buf_get_for_send(args[ARG_data].u_obj, &bufinfo, data); - if (bufinfo.len > 8) { + if (bufinfo.len > CAN_MAX_DATA_FRAME) { mp_raise_ValueError(MP_ERROR_TEXT("CAN data field too long")); } @@ -476,13 +509,12 @@ STATIC mp_obj_t pyb_can_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t * CanTxMsgTypeDef tx_msg; #if MICROPY_HW_ENABLE_FDCAN - uint8_t tx_data[8]; + uint8_t tx_data[CAN_MAX_DATA_FRAME]; + memset(tx_data, 0, sizeof(tx_data)); + tx_msg.MessageMarker = 0; tx_msg.ErrorStateIndicator = FDCAN_ESI_ACTIVE; - tx_msg.BitRateSwitch = FDCAN_BRS_OFF; - tx_msg.FDFormat = FDCAN_CLASSIC_CAN; tx_msg.TxEventFifoControl = FDCAN_NO_TX_EVENTS; - tx_msg.DataLength = (bufinfo.len << 16); // TODO DLC for len > 8 if (self->extframe) { tx_msg.Identifier = args[ARG_id].u_int & 0x1FFFFFFF; @@ -496,6 +528,23 @@ STATIC mp_obj_t pyb_can_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t * } else { tx_msg.TxFrameType = FDCAN_REMOTE_FRAME; } + if (args[ARG_fdf].u_bool == false) { + tx_msg.FDFormat = FDCAN_CLASSIC_CAN; + } else { + tx_msg.FDFormat = FDCAN_FD_CAN; + } + if (args[ARG_brs].u_bool == false) { + tx_msg.BitRateSwitch = FDCAN_BRS_OFF; + } else { + tx_msg.BitRateSwitch = FDCAN_BRS_ON; + } + // Roundup DataLength to next DLC size and encode to DLC. + for (mp_uint_t i = 0; i < MP_ARRAY_SIZE(DLCtoBytes); i++) { + if (bufinfo.len <= DLCtoBytes[i]) { + tx_msg.DataLength = (i << 16); + break; + } + } #else tx_msg.DLC = bufinfo.len; uint8_t *tx_data = tx_msg.Data; // Data is uint32_t but holds only 1 byte @@ -565,7 +614,7 @@ STATIC mp_obj_t pyb_can_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t * // receive the data CanRxMsgTypeDef rx_msg; #if MICROPY_HW_ENABLE_FDCAN - uint8_t rx_data[8]; + uint8_t rx_data[CAN_MAX_DATA_FRAME]; #else uint8_t *rx_data = rx_msg.Data; #endif From 3320ec44ed7d1ba36e59a065f6941cd46608acc4 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Mon, 17 Jan 2022 20:51:31 +0200 Subject: [PATCH 0297/1712] stm32/pyb_can: Add support for CAN FD extended frame ID. --- ports/stm32/fdcan.c | 18 ++++++++++------ ports/stm32/pyb_can.c | 50 +++++++++++++++++++++++++++++++------------ 2 files changed, 48 insertions(+), 20 deletions(-) diff --git a/ports/stm32/fdcan.c b/ports/stm32/fdcan.c index 63c6c31238..bcf3e8d6a3 100644 --- a/ports/stm32/fdcan.c +++ b/ports/stm32/fdcan.c @@ -107,9 +107,7 @@ bool can_init(pyb_can_obj_t *can_obj, uint32_t mode, uint32_t prescaler, uint32_ // identifiers, and 31 x 2 words elements for 29-bit extended identifiers. // The total number of words reserved for the filtering per FDCAN instance is 126 words. init->StdFiltersNbr = 64; - // Note extended identifiers are Not used in pyb_can.c and Not handled correctly. - // Disable the extended identifiers filters for now until this is fixed properly. - init->ExtFiltersNbr = 0 /*31*/; + init->ExtFiltersNbr = 31; // The Tx event FIFO is used to store the message ID and the timestamp of successfully // transmitted elements. The Tx event FIFO can store a maximum of 32 (2 words) elements. @@ -189,7 +187,11 @@ bool can_init(pyb_can_obj_t *can_obj, uint32_t mode, uint32_t prescaler, uint32_ // Reset all filters for (int f = 0; f < init->StdFiltersNbr; ++f) { - can_clearfilter(can_obj, f, 0); + can_clearfilter(can_obj, f, false); + } + + for (int f = 0; f < init->ExtFiltersNbr; ++f) { + can_clearfilter(can_obj, f, true); } can_obj->is_enabled = true; @@ -250,10 +252,14 @@ void can_deinit(pyb_can_obj_t *self) { } } -void can_clearfilter(pyb_can_obj_t *self, uint32_t f, uint8_t bank) { +void can_clearfilter(pyb_can_obj_t *self, uint32_t f, uint8_t extid) { if (self && self->can.Instance) { FDCAN_FilterTypeDef filter = {0}; - filter.IdType = FDCAN_STANDARD_ID; + if (extid == 1) { + filter.IdType = FDCAN_EXTENDED_ID; + } else { + filter.IdType = FDCAN_STANDARD_ID; + } filter.FilterIndex = f; filter.FilterConfig = FDCAN_FILTER_DISABLE; HAL_FDCAN_ConfigFilter(&self->can, &filter); diff --git a/ports/stm32/pyb_can.c b/ports/stm32/pyb_can.c index 0c5c60255d..323b04d692 100644 --- a/ports/stm32/pyb_can.c +++ b/ports/stm32/pyb_can.c @@ -41,7 +41,6 @@ #if MICROPY_HW_ENABLE_FDCAN -#define CAN_MAX_FILTER (64) #define CAN_MAX_DATA_FRAME (64) #define CAN_FIFO0 FDCAN_RX_FIFO0 @@ -87,9 +86,6 @@ #define __HAL_CAN_DISABLE_IT __HAL_FDCAN_DISABLE_IT #define __HAL_CAN_CLEAR_FLAG __HAL_FDCAN_CLEAR_FLAG #define __HAL_CAN_MSG_PENDING HAL_FDCAN_GetRxFifoFillLevel - -// Both banks start at 0 -STATIC uint8_t can2_start_bank = 0; extern const uint8_t DLCtoBytes[16]; #else @@ -715,16 +711,29 @@ STATIC mp_obj_t pyb_can_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t * STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_can_recv_obj, 1, pyb_can_recv); // initfilterbanks(n) -STATIC mp_obj_t pyb_can_initfilterbanks(mp_obj_t self, mp_obj_t bank_in) { +STATIC mp_obj_t pyb_can_initfilterbanks(mp_obj_t self_in, mp_obj_t bank_in) { + pyb_can_obj_t *self = MP_OBJ_TO_PTR(self_in); #if MICROPY_HW_ENABLE_FDCAN - can2_start_bank = 0; - #else - can2_start_bank = mp_obj_get_int(bank_in); - #endif - - for (int f = 0; f < CAN_MAX_FILTER; f++) { - can_clearfilter(MP_OBJ_TO_PTR(self), f, can2_start_bank); + (void)self; + #if 0 + FDCAN_InitTypeDef *init = &self->can.Init; + // Clear standard ID filters. + for (int f = 0; f < init->StdFiltersNbr; ++f) { + can_clearfilter(self, f, false); } + // Clear extended ID filters. + for (int f = 0; f < init->ExtFiltersNbr; ++f) { + can_clearfilter(self, f, true); + } + #endif + #else + // NOTE: For classic CAN, this function calls HAL_CAN_ConfigFilter(NULL, &filter); + // if CAN3 is defined, ConfigFilter() will dereference a NULL pointer. + can2_start_bank = mp_obj_get_int(bank_in); + for (int f = 0; f < CAN_MAX_FILTER; f++) { + can_clearfilter(self, f, can2_start_bank); + } + #endif return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_can_initfilterbanks_fun_obj, pyb_can_initfilterbanks); @@ -733,10 +742,14 @@ STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(pyb_can_initfilterbanks_obj, MP_ROM_PTR(& STATIC mp_obj_t pyb_can_clearfilter(mp_obj_t self_in, mp_obj_t bank_in) { pyb_can_obj_t *self = MP_OBJ_TO_PTR(self_in); mp_int_t f = mp_obj_get_int(bank_in); + #if MICROPY_HW_ENABLE_FDCAN + can_clearfilter(self, f, self->extframe); + #else if (self->can_id == 2) { f += can2_start_bank; } can_clearfilter(self, f, can2_start_bank); + #endif return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_can_clearfilter_obj, pyb_can_clearfilter); @@ -760,9 +773,18 @@ STATIC mp_obj_t pyb_can_setfilter(size_t n_args, const mp_obj_t *pos_args, mp_ma #if MICROPY_HW_ENABLE_FDCAN FDCAN_FilterTypeDef filter = {0}; - filter.IdType = FDCAN_STANDARD_ID; - // TODO check filter index + if (self->extframe) { + filter.IdType = FDCAN_EXTENDED_ID; + } else { + filter.IdType = FDCAN_STANDARD_ID; + } + filter.FilterIndex = args[ARG_bank].u_int; + // Check filter index. + if ((filter.IdType == FDCAN_STANDARD_ID && filter.FilterIndex >= self->can.Init.StdFiltersNbr) || + (filter.IdType == FDCAN_EXTENDED_ID && filter.FilterIndex >= self->can.Init.ExtFiltersNbr)) { + goto error; + } // Check filter mode if (((args[ARG_mode].u_int != FDCAN_FILTER_RANGE) && From e7264e9532549560304be33ce7971609baba5bec Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sat, 29 Jan 2022 03:16:26 +0200 Subject: [PATCH 0298/1712] stm32/pyb_can: Add support for bus with mixed Classic/FD nodes. A CAN bus can have mixed classic/FD nodes. Prior to this patch the CAN API could be configured for either standard or extended ID, but not both/mixed operation. This patch allows extended IDs to be filtered and enabled on a per-message basis, in send(), setfilter() and clearfilter(). This is a breaking change to the API: init() no longer accepts the extframe keyword argument. --- ports/stm32/can.h | 1 - ports/stm32/pyb_can.c | 55 ++++++++++++++++++++++++------------------- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/ports/stm32/can.h b/ports/stm32/can.h index bb26c0b7e2..45ac7187e0 100644 --- a/ports/stm32/can.h +++ b/ports/stm32/can.h @@ -67,7 +67,6 @@ typedef struct _pyb_can_obj_t { mp_obj_t rxcallback1; mp_uint_t can_id : 8; bool is_enabled : 1; - bool extframe : 1; byte rx_state0; byte rx_state1; uint16_t num_error_warning; diff --git a/ports/stm32/pyb_can.c b/ports/stm32/pyb_can.c index 323b04d692..4d97e21f57 100644 --- a/ports/stm32/pyb_can.c +++ b/ports/stm32/pyb_can.c @@ -133,10 +133,9 @@ STATIC void pyb_can_print(const mp_print_t *print, mp_obj_t self_in, mp_print_ki mode = MP_QSTR_SILENT_LOOPBACK; break; } - mp_printf(print, "CAN(%u, CAN.%q, extframe=%q, auto_restart=%q)", + mp_printf(print, "CAN(%u, CAN.%q, auto_restart=%q)", self->can_id, mode, - self->extframe ? MP_QSTR_True : MP_QSTR_False, #if MICROPY_HW_ENABLE_FDCAN (self->can.Instance->CCCR & FDCAN_CCCR_DAR) ? MP_QSTR_True : MP_QSTR_False #else @@ -200,13 +199,12 @@ STATIC void pyb_can_get_bit_timing(mp_uint_t baudrate, mp_uint_t sample_point, mp_raise_msg(&mp_type_ValueError, MP_ERROR_TEXT("couldn't match baudrate and sample point")); } -// init(mode, extframe=False, prescaler=100, *, sjw=1, bs1=6, bs2=8) +// init(mode, prescaler=100, *, sjw=1, bs1=6, bs2=8) STATIC mp_obj_t pyb_can_init_helper(pyb_can_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_mode, ARG_extframe, ARG_prescaler, ARG_sjw, ARG_bs1, ARG_bs2, ARG_auto_restart, ARG_baudrate, ARG_sample_point, + enum { ARG_mode, ARG_prescaler, ARG_sjw, ARG_bs1, ARG_bs2, ARG_auto_restart, ARG_baudrate, ARG_sample_point, ARG_brs_prescaler, ARG_brs_sjw, ARG_brs_bs1, ARG_brs_bs2, ARG_brs_baudrate, ARG_brs_sample_point }; static const mp_arg_t allowed_args[] = { { MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = CAN_MODE_NORMAL} }, - { MP_QSTR_extframe, MP_ARG_BOOL, {.u_bool = false} }, { MP_QSTR_prescaler, MP_ARG_INT, {.u_int = CAN_DEFAULT_PRESCALER} }, { MP_QSTR_sjw, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = CAN_DEFAULT_SJW} }, { MP_QSTR_bs1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = CAN_DEFAULT_BS1} }, @@ -228,8 +226,6 @@ STATIC mp_obj_t pyb_can_init_helper(pyb_can_obj_t *self, size_t n_args, const mp 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); - self->extframe = args[ARG_extframe].u_bool; - // set the CAN configuration values memset(&self->can, 0, sizeof(self->can)); @@ -475,15 +471,16 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_can_any_obj, pyb_can_any); // send(send, addr, *, timeout=5000) STATIC mp_obj_t pyb_can_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_data, ARG_id, ARG_timeout, ARG_rtr, ARG_fdf, ARG_brs }; + enum { ARG_data, ARG_id, ARG_timeout, ARG_rtr, ARG_extframe, ARG_fdf, ARG_brs }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, - { MP_QSTR_id, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} }, - { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, - { MP_QSTR_rtr, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_data, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_id, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_rtr, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_extframe, MP_ARG_BOOL, {.u_bool = false} }, #if MICROPY_HW_ENABLE_FDCAN - { MP_QSTR_fdf, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, - { MP_QSTR_brs, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_fdf, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, + { MP_QSTR_brs, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, #endif }; @@ -512,7 +509,7 @@ STATIC mp_obj_t pyb_can_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t * tx_msg.ErrorStateIndicator = FDCAN_ESI_ACTIVE; tx_msg.TxEventFifoControl = FDCAN_NO_TX_EVENTS; - if (self->extframe) { + if (args[ARG_extframe].u_bool == true) { tx_msg.Identifier = args[ARG_id].u_int & 0x1FFFFFFF; tx_msg.IdType = FDCAN_EXTENDED_ID; } else { @@ -545,7 +542,7 @@ STATIC mp_obj_t pyb_can_send(size_t n_args, const mp_obj_t *pos_args, mp_map_t * tx_msg.DLC = bufinfo.len; uint8_t *tx_data = tx_msg.Data; // Data is uint32_t but holds only 1 byte - if (self->extframe) { + if (args[ARG_extframe].u_bool == true) { tx_msg.ExtId = args[ARG_id].u_int & 0x1FFFFFFF; tx_msg.IDE = CAN_ID_EXT; } else { @@ -739,11 +736,20 @@ STATIC mp_obj_t pyb_can_initfilterbanks(mp_obj_t self_in, mp_obj_t bank_in) { STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_can_initfilterbanks_fun_obj, pyb_can_initfilterbanks); STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(pyb_can_initfilterbanks_obj, MP_ROM_PTR(&pyb_can_initfilterbanks_fun_obj)); -STATIC mp_obj_t pyb_can_clearfilter(mp_obj_t self_in, mp_obj_t bank_in) { - pyb_can_obj_t *self = MP_OBJ_TO_PTR(self_in); - mp_int_t f = mp_obj_get_int(bank_in); +STATIC mp_obj_t pyb_can_clearfilter(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_extframe }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_extframe, MP_ARG_BOOL, {.u_bool = false} }, + }; + + // parse args + pyb_can_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + mp_int_t f = mp_obj_get_int(pos_args[1]); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 2, pos_args + 2, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + #if MICROPY_HW_ENABLE_FDCAN - can_clearfilter(self, f, self->extframe); + can_clearfilter(self, f, args[ARG_extframe].u_bool); #else if (self->can_id == 2) { f += can2_start_bank; @@ -752,18 +758,19 @@ STATIC mp_obj_t pyb_can_clearfilter(mp_obj_t self_in, mp_obj_t bank_in) { #endif return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_can_clearfilter_obj, pyb_can_clearfilter); +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_can_clearfilter_obj, 2, pyb_can_clearfilter); // setfilter(bank, mode, fifo, params, *, rtr) #define EXTENDED_ID_TO_16BIT_FILTER(id) (((id & 0xC00000) >> 13) | ((id & 0x38000) >> 15)) | 8 STATIC mp_obj_t pyb_can_setfilter(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_bank, ARG_mode, ARG_fifo, ARG_params, ARG_rtr }; + enum { ARG_bank, ARG_mode, ARG_fifo, ARG_params, ARG_rtr, ARG_extframe }; static const mp_arg_t allowed_args[] = { { MP_QSTR_bank, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_fifo, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = CAN_FILTER_FIFO0} }, { MP_QSTR_params, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_rtr, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_extframe, MP_ARG_BOOL, {.u_bool = false} }, }; // parse args @@ -773,7 +780,7 @@ STATIC mp_obj_t pyb_can_setfilter(size_t n_args, const mp_obj_t *pos_args, mp_ma #if MICROPY_HW_ENABLE_FDCAN FDCAN_FilterTypeDef filter = {0}; - if (self->extframe) { + if (args[ARG_extframe].u_bool == true) { filter.IdType = FDCAN_EXTENDED_ID; } else { filter.IdType = FDCAN_STANDARD_ID; @@ -831,7 +838,7 @@ STATIC mp_obj_t pyb_can_setfilter(size_t n_args, const mp_obj_t *pos_args, mp_ma goto error; } filter.FilterScale = CAN_FILTERSCALE_16BIT; - if (self->extframe) { + if (args[ARG_extframe].u_bool == true) { if (args[ARG_rtr].u_obj != MP_OBJ_NULL) { if (args[ARG_mode].u_int == MASK16) { rtr_masks[0] = mp_obj_get_int(rtr_flags[0]) ? 0x02 : 0; From 95104c9f6e8a3dac884e803103e38163d5caf2aa Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sat, 29 Jan 2022 03:47:47 +0200 Subject: [PATCH 0299/1712] stm32/pyb_can: Return the filter ID and type of received messages. CAN.recv() now returns a 5-tuple, with the new element in the second position being a boolean, True if the ID is extended. This is a breaking change of the API for CAN.recv(). --- ports/stm32/pyb_can.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/ports/stm32/pyb_can.c b/ports/stm32/pyb_can.c index 4d97e21f57..bdb0e9034b 100644 --- a/ports/stm32/pyb_can.c +++ b/ports/stm32/pyb_can.c @@ -660,29 +660,29 @@ STATIC mp_obj_t pyb_can_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t * } // Create the tuple, or get the list, that will hold the return values - // Also populate the fourth element, either a new bytes or reuse existing memoryview + // Also populate the fifth element, either a new bytes or reuse existing memoryview mp_obj_t ret_obj = args[ARG_list].u_obj; mp_obj_t *items; if (ret_obj == mp_const_none) { - ret_obj = mp_obj_new_tuple(4, NULL); + ret_obj = mp_obj_new_tuple(5, NULL); items = ((mp_obj_tuple_t *)MP_OBJ_TO_PTR(ret_obj))->items; - items[3] = mp_obj_new_bytes(rx_data, rx_dlc); + items[4] = mp_obj_new_bytes(rx_data, rx_dlc); } else { - // User should provide a list of length at least 4 to hold the values + // User should provide a list of length at least 5 to hold the values if (!mp_obj_is_type(ret_obj, &mp_type_list)) { mp_raise_TypeError(NULL); } mp_obj_list_t *list = MP_OBJ_TO_PTR(ret_obj); - if (list->len < 4) { + if (list->len < 5) { mp_raise_ValueError(NULL); } items = list->items; - // Fourth element must be a memoryview which we assume points to a + // Fifth element must be a memoryview which we assume points to a // byte-like array which is large enough, and then we resize it inplace - if (!mp_obj_is_type(items[3], &mp_type_memoryview)) { + if (!mp_obj_is_type(items[4], &mp_type_memoryview)) { mp_raise_TypeError(NULL); } - mp_obj_array_t *mv = MP_OBJ_TO_PTR(items[3]); + mp_obj_array_t *mv = MP_OBJ_TO_PTR(items[4]); if (!(mv->typecode == (MP_OBJ_ARRAY_TYPECODE_FLAG_RW | BYTEARRAY_TYPECODE) || (mv->typecode | 0x20) == (MP_OBJ_ARRAY_TYPECODE_FLAG_RW | 'b'))) { mp_raise_ValueError(NULL); @@ -691,15 +691,17 @@ STATIC mp_obj_t pyb_can_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t * memcpy(mv->items, rx_data, rx_dlc); } - // Populate the first 3 values of the tuple/list + // Populate the first 4 values of the tuple/list #if MICROPY_HW_ENABLE_FDCAN items[0] = MP_OBJ_NEW_SMALL_INT(rx_msg.Identifier); - items[1] = rx_msg.RxFrameType == FDCAN_REMOTE_FRAME ? mp_const_true : mp_const_false; - items[2] = MP_OBJ_NEW_SMALL_INT(rx_msg.FilterIndex); + items[1] = mp_obj_new_bool(rx_msg.IdType == FDCAN_EXTENDED_ID); + items[2] = rx_msg.RxFrameType == FDCAN_REMOTE_FRAME ? mp_const_true : mp_const_false; + items[3] = MP_OBJ_NEW_SMALL_INT(rx_msg.FilterIndex); #else items[0] = MP_OBJ_NEW_SMALL_INT((rx_msg.IDE == CAN_ID_STD ? rx_msg.StdId : rx_msg.ExtId)); - items[1] = rx_msg.RTR == CAN_RTR_REMOTE ? mp_const_true : mp_const_false; - items[2] = MP_OBJ_NEW_SMALL_INT(rx_msg.FMI); + items[1] = mp_obj_new_bool(rx_msg.IDE == CAN_ID_EXT); + items[2] = rx_msg.RTR == CAN_RTR_REMOTE ? mp_const_true : mp_const_false; + items[3] = MP_OBJ_NEW_SMALL_INT(rx_msg.FMI); #endif // Return the result From a79706fb397b5763eff9fa0a2c1b3f1dbc906fff Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sun, 30 Jan 2022 19:16:17 +0200 Subject: [PATCH 0300/1712] stm32/pyb_can: Define the maximum bit timing parameters. Define the maximum parameters for CAN/FDCAN nominal bit timing, and for FDCAN data bit timing, for bit timing calculations. --- ports/stm32/pyb_can.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/ports/stm32/pyb_can.c b/ports/stm32/pyb_can.c index bdb0e9034b..aa33129325 100644 --- a/ports/stm32/pyb_can.c +++ b/ports/stm32/pyb_can.c @@ -59,6 +59,16 @@ #define CAN_DEFAULT_BS1 (8) #define CAN_DEFAULT_BS2 (3) +#define CAN_MAXIMUM_NBRP (512) +#define CAN_MAXIMUM_NBS1 (256) +#define CAN_MAXIMUM_NBS2 (128) +// Minimum Nominal time segment for FDCAN is 2. +#define CAN_MINIMUM_TSEG (2) + +#define CAN_MAXIMUM_DBRP (32) +#define CAN_MAXIMUM_DBS1 (32) +#define CAN_MAXIMUM_DBS2 (16) + #define CAN_MODE_NORMAL FDCAN_MODE_NORMAL #define CAN_MODE_LOOPBACK FDCAN_MODE_EXTERNAL_LOOPBACK #define CAN_MODE_SILENT FDCAN_MODE_BUS_MONITORING @@ -97,6 +107,11 @@ extern const uint8_t DLCtoBytes[16]; #define CAN_DEFAULT_BS1 (6) #define CAN_DEFAULT_BS2 (8) +#define CAN_MAXIMUM_NBRP (1024) +#define CAN_MAXIMUM_NBS1 (16) +#define CAN_MAXIMUM_NBS2 (8) +#define CAN_MINIMUM_TSEG (1) + #define CAN_IT_FIFO0_FULL CAN_IT_FF0 #define CAN_IT_FIFO1_FULL CAN_IT_FF1 #define CAN_IT_FIFO0_OVRF CAN_IT_FOV0 @@ -178,13 +193,13 @@ STATIC uint32_t pyb_can_get_source_freq() { } STATIC void pyb_can_get_bit_timing(mp_uint_t baudrate, mp_uint_t sample_point, + uint32_t max_brp, uint32_t max_bs1, uint32_t max_bs2, uint32_t min_tseg, mp_int_t *bs1_out, mp_int_t *bs2_out, mp_int_t *prescaler_out) { uint32_t can_kern_clk = pyb_can_get_source_freq(); - - // The following max values work on all MCUs for classical CAN. - for (int brp = 1; brp < 512; brp++) { - for (int bs1 = 1; bs1 < 16; bs1++) { - for (int bs2 = 1; bs2 < 8; bs2++) { + // Calculate CAN bit timing. + for (uint32_t brp = 1; brp < max_brp; brp++) { + for (uint32_t bs1 = min_tseg; bs1 < max_bs1; bs1++) { + for (uint32_t bs2 = min_tseg; bs2 < max_bs2; bs2++) { if ((baudrate == (can_kern_clk / (brp * (1 + bs1 + bs2)))) && ((sample_point * 10) == (((1 + bs1) * 1000) / (1 + bs1 + bs2)))) { *bs1_out = bs1; @@ -229,9 +244,10 @@ STATIC mp_obj_t pyb_can_init_helper(pyb_can_obj_t *self, size_t n_args, const mp // set the CAN configuration values memset(&self->can, 0, sizeof(self->can)); - // Calculate CAN bit timing from baudrate if provided + // Calculate CAN nominal bit timing from baudrate if provided if (args[ARG_baudrate].u_int != 0) { pyb_can_get_bit_timing(args[ARG_baudrate].u_int, args[ARG_sample_point].u_int, + CAN_MAXIMUM_NBRP, CAN_MAXIMUM_NBS1, CAN_MAXIMUM_NBS2, CAN_MINIMUM_TSEG, &args[ARG_bs1].u_int, &args[ARG_bs2].u_int, &args[ARG_prescaler].u_int); } @@ -240,9 +256,10 @@ STATIC mp_obj_t pyb_can_init_helper(pyb_can_obj_t *self, size_t n_args, const mp if (args[ARG_brs_sample_point].u_int == 0) { args[ARG_brs_sample_point].u_int = args[ARG_sample_point].u_int; } - // Calculate BRS CAN bit timing from baudrate if provided + // Calculate CAN data bit timing from baudrate if provided if (args[ARG_brs_baudrate].u_int != 0) { pyb_can_get_bit_timing(args[ARG_brs_baudrate].u_int, args[ARG_brs_sample_point].u_int, + CAN_MAXIMUM_DBRP, CAN_MAXIMUM_DBS1, CAN_MAXIMUM_DBS2, 1, &args[ARG_brs_bs1].u_int, &args[ARG_brs_bs2].u_int, &args[ARG_brs_prescaler].u_int); } // Set BRS bit timings. From 5562ed3f43f1a9327bf8634f16e2592774eb7907 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Wed, 30 Mar 2022 17:40:44 +0200 Subject: [PATCH 0301/1712] stm32/pyb_can: Replace CAN.initfilterbanks with CAN.init keyword arg. The CAN.initfilterbanks() class method is removed, and its functionality is replaced with the "num_filter_banks" keyword argument to the CAN constructor and CAN.init(). This configures the filter bank split. This new approach provides more flexibility configuring the resources used by a given CAN instance, allowing other MCUs like H7 to fit the API. It also brings CAN closer to how other machine peripherals are configured, where everything is done in the constructor/init method. This is a breaking change to the CAN API. --- ports/stm32/pyb_can.c | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/ports/stm32/pyb_can.c b/ports/stm32/pyb_can.c index aa33129325..aa2d83a64e 100644 --- a/ports/stm32/pyb_can.c +++ b/ports/stm32/pyb_can.c @@ -217,7 +217,7 @@ STATIC void pyb_can_get_bit_timing(mp_uint_t baudrate, mp_uint_t sample_point, // init(mode, prescaler=100, *, sjw=1, bs1=6, bs2=8) STATIC mp_obj_t pyb_can_init_helper(pyb_can_obj_t *self, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_mode, ARG_prescaler, ARG_sjw, ARG_bs1, ARG_bs2, ARG_auto_restart, ARG_baudrate, ARG_sample_point, - ARG_brs_prescaler, ARG_brs_sjw, ARG_brs_bs1, ARG_brs_bs2, ARG_brs_baudrate, ARG_brs_sample_point }; + ARG_num_filter_banks, ARG_brs_prescaler, ARG_brs_sjw, ARG_brs_bs1, ARG_brs_bs2, ARG_brs_baudrate, ARG_brs_sample_point }; static const mp_arg_t allowed_args[] = { { MP_QSTR_mode, MP_ARG_REQUIRED | MP_ARG_INT, {.u_int = CAN_MODE_NORMAL} }, { MP_QSTR_prescaler, MP_ARG_INT, {.u_int = CAN_DEFAULT_PRESCALER} }, @@ -227,6 +227,7 @@ STATIC mp_obj_t pyb_can_init_helper(pyb_can_obj_t *self, size_t n_args, const mp { MP_QSTR_auto_restart, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, { MP_QSTR_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_sample_point, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 75} }, // 75% sampling point + { MP_QSTR_num_filter_banks, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 14} }, #if MICROPY_HW_ENABLE_FDCAN { MP_QSTR_brs_prescaler, MP_ARG_INT, {.u_int = CAN_DEFAULT_PRESCALER} }, { MP_QSTR_brs_sjw, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = CAN_DEFAULT_SJW} }, @@ -267,6 +268,12 @@ STATIC mp_obj_t pyb_can_init_helper(pyb_can_obj_t *self, size_t n_args, const mp self->can.Init.DataSyncJumpWidth = args[ARG_brs_sjw].u_int; self->can.Init.DataTimeSeg1 = args[ARG_bs1].u_int; // DataTimeSeg1 = Propagation_segment + Phase_segment_1 self->can.Init.DataTimeSeg2 = args[ARG_bs2].u_int; + #else + // Init filter banks for classic CAN. + can2_start_bank = args[ARG_num_filter_banks].u_int; + for (int f = 0; f < CAN_MAX_FILTER; f++) { + can_clearfilter(self, f, can2_start_bank); + } #endif if (!can_init(self, args[ARG_mode].u_int, args[ARG_prescaler].u_int, args[ARG_sjw].u_int, @@ -726,35 +733,6 @@ STATIC mp_obj_t pyb_can_recv(size_t n_args, const mp_obj_t *pos_args, mp_map_t * } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(pyb_can_recv_obj, 1, pyb_can_recv); -// initfilterbanks(n) -STATIC mp_obj_t pyb_can_initfilterbanks(mp_obj_t self_in, mp_obj_t bank_in) { - pyb_can_obj_t *self = MP_OBJ_TO_PTR(self_in); - #if MICROPY_HW_ENABLE_FDCAN - (void)self; - #if 0 - FDCAN_InitTypeDef *init = &self->can.Init; - // Clear standard ID filters. - for (int f = 0; f < init->StdFiltersNbr; ++f) { - can_clearfilter(self, f, false); - } - // Clear extended ID filters. - for (int f = 0; f < init->ExtFiltersNbr; ++f) { - can_clearfilter(self, f, true); - } - #endif - #else - // NOTE: For classic CAN, this function calls HAL_CAN_ConfigFilter(NULL, &filter); - // if CAN3 is defined, ConfigFilter() will dereference a NULL pointer. - can2_start_bank = mp_obj_get_int(bank_in); - for (int f = 0; f < CAN_MAX_FILTER; f++) { - can_clearfilter(self, f, can2_start_bank); - } - #endif - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(pyb_can_initfilterbanks_fun_obj, pyb_can_initfilterbanks); -STATIC MP_DEFINE_CONST_CLASSMETHOD_OBJ(pyb_can_initfilterbanks_obj, MP_ROM_PTR(&pyb_can_initfilterbanks_fun_obj)); - STATIC mp_obj_t pyb_can_clearfilter(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_extframe }; static const mp_arg_t allowed_args[] = { @@ -1006,7 +984,6 @@ STATIC const mp_rom_map_elem_t pyb_can_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_any), MP_ROM_PTR(&pyb_can_any_obj) }, { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&pyb_can_send_obj) }, { MP_ROM_QSTR(MP_QSTR_recv), MP_ROM_PTR(&pyb_can_recv_obj) }, - { MP_ROM_QSTR(MP_QSTR_initfilterbanks), MP_ROM_PTR(&pyb_can_initfilterbanks_obj) }, { MP_ROM_QSTR(MP_QSTR_setfilter), MP_ROM_PTR(&pyb_can_setfilter_obj) }, { MP_ROM_QSTR(MP_QSTR_clearfilter), MP_ROM_PTR(&pyb_can_clearfilter_obj) }, { MP_ROM_QSTR(MP_QSTR_rxcallback), MP_ROM_PTR(&pyb_can_rxcallback_obj) }, From 5cdf9645711cc12b45e602ef5795c33895116fc4 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sun, 20 Feb 2022 20:29:32 +0200 Subject: [PATCH 0302/1712] docs/library/pyb.CAN: Update CAN docs to match revised API. --- docs/library/pyb.CAN.rst | 140 +++++++++++++++++++++++++-------------- 1 file changed, 92 insertions(+), 48 deletions(-) diff --git a/docs/library/pyb.CAN.rst b/docs/library/pyb.CAN.rst index bcaeeba9df..69704d09b2 100644 --- a/docs/library/pyb.CAN.rst +++ b/docs/library/pyb.CAN.rst @@ -4,13 +4,12 @@ class CAN -- controller area network communication bus ====================================================== -CAN implements the standard CAN communications protocol. At -the physical level it consists of 2 lines: RX and TX. Note that -to connect the pyboard to a CAN bus you must use a CAN transceiver -to convert the CAN logic signals from the pyboard to the correct +CAN implements support for classic CAN (available on F4, F7 MCUs) and CAN FD (H7 series) controllers. +At the physical level CAN bus consists of 2 lines: RX and TX. Note that to connect the pyboard to a +CAN bus you must use a CAN transceiver to convert the CAN logic signals from the pyboard to the correct voltage levels on the bus. -Example usage (works without anything connected):: +Example usage for classic CAN controller in Loopback (transceiver-less) mode:: from pyb import CAN can = CAN(1, CAN.LOOPBACK) @@ -18,6 +17,16 @@ Example usage (works without anything connected):: can.send('message!', 123) # send a message with id 123 can.recv(0) # receive message on FIFO 0 +Example usage for CAN FD controller with all of the possible options enabled:: + + # FD frame + BRS mode + Extended frame ID. 500 Kbit/s for arbitration phase, 1Mbit/s for data phase. + can = CAN(1, CAN.NORMAL, baudrate=500_000, brs_baudrate=1_000_000, sample_point=80) + can.setfilter(0, CAN.RANGE, 0, (0xFFF0, 0xFFFF)) + can.send('a'*64, 0xFFFF, fdf=True, brs=True, extframe=True) + can.recv(0) + +The following CAN module functions and their arguments are available +for both classic and FD CAN controllers, unless otherwise stated. Constructors ------------ @@ -35,43 +44,48 @@ Constructors - ``CAN(1)`` is on ``YA``: ``(RX, TX) = (Y3, Y4) = (PB8, PB9)`` - ``CAN(2)`` is on ``YB``: ``(RX, TX) = (Y5, Y6) = (PB12, PB13)`` -Class Methods -------------- -.. classmethod:: CAN.initfilterbanks(nr) - - Reset and disable all filter banks and assign how many banks should be available for CAN(1). - - STM32F405 has 28 filter banks that are shared between the two available CAN bus controllers. - This function configures how many filter banks should be assigned to each. *nr* is the number of banks - that will be assigned to CAN(1), the rest of the 28 are assigned to CAN(2). - At boot, 14 banks are assigned to each controller. - Methods ------- -.. method:: CAN.init(mode, extframe=False, prescaler=100, *, sjw=1, bs1=6, bs2=8, auto_restart=False, baudrate=0, sample_point=75) +.. method:: CAN.init(mode, prescaler=100, *, sjw=1, bs1=6, bs2=8, auto_restart=False, baudrate=0, sample_point=75, + num_filter_banks=14, brs_sjw=1, brs_bs1=8, brs_bs2=3, brs_baudrate=0, brs_sample_point=75) Initialise the CAN bus with the given parameters: - *mode* is one of: NORMAL, LOOPBACK, SILENT, SILENT_LOOPBACK - - if *extframe* is True then the bus uses extended identifiers in the frames - (29 bits); otherwise it uses standard 11 bit identifiers - - *prescaler* is used to set the duration of 1 time quanta; the time quanta - will be the input clock (PCLK1, see :meth:`pyb.freq()`) divided by the prescaler - - *sjw* is the resynchronisation jump width in units of the time quanta; - it can be 1, 2, 3, 4 - - *bs1* defines the location of the sample point in units of the time quanta; - it can be between 1 and 1024 inclusive - - *bs2* defines the location of the transmit point in units of the time quanta; - it can be between 1 and 16 inclusive + - *prescaler* is the value by which the CAN input clock is divided to generate the + nominal bit time quanta. The prescaler can be a value between 1 and 1024 inclusive + for classic CAN, and between 1 and 512 inclusive for CAN FD. + - *sjw* is the resynchronisation jump width in units of time quanta for nominal bits; + it can be a value between 1 and 4 inclusive for classic CAN, and between 1 and 128 inclusive for CAN FD. + - *bs1* defines the location of the sample point in units of the time quanta for nominal bits; + it can be a value between 1 and 16 inclusive for classic CAN, and between 2 and 256 inclusive for CAN FD. + - *bs2* defines the location of the transmit point in units of the time quanta for nominal bits; + it can be a value between 1 and 8 inclusive for classic CAN, and between 2 and 128 inclusive for CAN FD. - *auto_restart* sets whether the controller will automatically try and restart communications after entering the bus-off state; if this is disabled then :meth:`~CAN.restart()` can be used to leave the bus-off state - *baudrate* if a baudrate other than 0 is provided, this function will try to automatically - calculate a CAN bit-timing (overriding *prescaler*, *bs1* and *bs2*) that satisfies both - the baudrate and the desired *sample_point*. - - *sample_point* given in a percentage of the bit time, the *sample_point* specifies the position - of the last bit sample with respect to the whole bit time. The default *sample_point* is 75%. + calculate the CAN nominal bit time (overriding *prescaler*, *bs1* and *bs2*) that satisfies + both the baudrate and the desired *sample_point*. + - *sample_point* given in a percentage of the nominal bit time, the *sample_point* specifies the position + of the bit sample with respect to the whole nominal bit time. The default *sample_point* is 75%. + - *num_filter_banks* for classic CAN, this is the number of banks that will be assigned to CAN(1), + the rest of the 28 are assigned to CAN(2). + - *brs_prescaler* is the value by which the CAN FD input clock is divided to generate the + data bit time quanta. The prescaler can be a value between 1 and 32 inclusive. + - *brs_sjw* is the resynchronisation jump width in units of time quanta for data bits; + it can be a value between 1 and 16 inclusive + - *brs_bs1* defines the location of the sample point in units of the time quanta for data bits; + it can be a value between 1 and 32 inclusive + - *brs_bs2* defines the location of the transmit point in units of the time quanta for data bits; + it can be a value between 1 and 16 inclusive + - *brs_baudrate* if a baudrate other than 0 is provided, this function will try to automatically + calculate the CAN data bit time (overriding *brs_prescaler*, *brs_bs1* and *brs_bs2*) that satisfies + both the baudrate and the desired *brs_sample_point*. + - *brs_sample_point* given in a percentage of the data bit time, the *brs_sample_point* specifies the position + of the bit sample with respect to the whole data bit time. The default *brs_sample_point* is 75%. + The time quanta tq is the basic unit of time for the CAN bus. tq is the CAN prescaler value divided by PCLK1 (the frequency of internal peripheral bus 1); @@ -140,17 +154,17 @@ Methods - number of pending RX messages on fifo 0 - number of pending RX messages on fifo 1 -.. method:: CAN.setfilter(bank, mode, fifo, params, *, rtr) +.. method:: CAN.setfilter(bank, mode, fifo, params, *, rtr, extframe=False) Configure a filter bank: - - *bank* is the filter bank that is to be configured. - - *mode* is the mode the filter should operate in. + - *bank* is the classic CAN controller filter bank, or CAN FD filter index, to configure. + - *mode* is the mode the filter should operate in, see the tables below. - *fifo* is which fifo (0 or 1) a message should be stored in, if it is accepted by this filter. - *params* is an array of values the defines the filter. The contents of the array depends on the *mode* argument. +-----------+---------------------------------------------------------+ - |*mode* |contents of *params* array | + |*mode* |Contents of *params* array for classic CAN controller | +===========+=========================================================+ |CAN.LIST16 |Four 16 bit ids that will be accepted | +-----------+---------------------------------------------------------+ @@ -165,10 +179,20 @@ Methods |CAN.MASK32 |As with CAN.MASK16 but with only one 32 bit id/mask pair.| +-----------+---------------------------------------------------------+ - - *rtr* is an array of booleans that states if a filter should accept a - remote transmission request message. If this argument is not given - then it defaults to ``False`` for all entries. The length of the array - depends on the *mode* argument. + +-----------+---------------------------------------------------------+ + |*mode* |Contents of *params* array for CAN FD controller | + +===========+=========================================================+ + |CAN.RANGE |Two ids that represent a range of accepted ids. | + +-----------+---------------------------------------------------------+ + |CAN.DUAL |Two ids that will be accepted. For example (1, 2) | + +-----------+---------------------------------------------------------+ + |CAN.MASK |One filter ID and a mask. For example (0x111, 0x7FF) | + +-----------+---------------------------------------------------------+ + + - *rtr* For classic CAN controllers, this is an array of booleans that states if + a filter should accept a remote transmission request message. If this argument + is not given then it defaults to ``False`` for all entries. The length of the + array depends on the *mode* argument. For CAN FD, this argument is ignored. +-----------+----------------------+ |*mode* |length of *rtr* array | @@ -182,11 +206,17 @@ Methods |CAN.MASK32 |1 | +-----------+----------------------+ -.. method:: CAN.clearfilter(bank) + - *extframe* If True the frame will have an extended identifier (29 bits), + otherwise a standard identifier (11 bits) is used. + + +.. method:: CAN.clearfilter(bank, extframe=False) Clear and disables a filter bank: - - *bank* is the filter bank that is to be cleared. + - *bank* is the classic CAN controller filter bank, or CAN FD filter index, to clear. + - *extframe* For CAN FD controllers, if True, clear an extended filter (configured with extframe=True), + otherwise the clear a standard identifier (configured with extframe=False). .. method:: CAN.any(fifo) @@ -200,21 +230,22 @@ Methods - *list* is an optional list object to be used as the return value - *timeout* is the timeout in milliseconds to wait for the receive. - Return value: A tuple containing four values. + Return value: A tuple containing five values. - The id of the message. + - A boolean that indicates if the message ID is standard or extended. - A boolean that indicates if the message is an RTR message. - The FMI (Filter Match Index) value. - An array containing the data. If *list* is ``None`` then a new tuple will be allocated, as well as a new - bytes object to contain the data (as the fourth element in the tuple). + bytes object to contain the data (as the fifth element in the tuple). - If *list* is not ``None`` then it should be a list object with a least four - elements. The fourth element should be a memoryview object which is created + If *list* is not ``None`` then it should be a list object with a least five + elements. The fifth element should be a memoryview object which is created from either a bytearray or an array of type 'B' or 'b', and this array must have enough room for at least 8 bytes. The list object will then be - populated with the first three return values above, and the memoryview object + populated with the first four return values above, and the memoryview object will be resized inplace to the size of the data and filled in with that data. The same list and memoryview objects can be reused in subsequent calls to this method, providing a way of receiving data without using the heap. @@ -225,7 +256,7 @@ Methods # No heap memory is allocated in the following call can.recv(0, lst) -.. method:: CAN.send(data, id, *, timeout=0, rtr=False) +.. method:: CAN.send(data, id, *, timeout=0, rtr=False, extframe=False, fdf=False, brs=False) Send a message on the bus: @@ -236,6 +267,13 @@ Methods a remote transmission request. If *rtr* is True then only the length of *data* is used to fill in the DLC slot of the frame; the actual bytes in *data* are unused. + - *extframe* if True the frame will have an extended identifier (29 bits), + otherwise a standard identifier (11 bits) is used. + - *fdf* for CAN FD controllers, if set to True, the frame will have an FD + frame format, which supports data payloads up to 64 bytes. + - *brs* for CAN FD controllers, if set to True, the bitrate switching mode + is enabled, in which the data phase is transmitted at a differet bitrate. + See :meth:`CAN.init` for the data bit timing configuration parameters. If timeout is 0 the message is placed in a buffer in one of three hardware buffers and the method returns immediately. If all three buffers are in use @@ -302,4 +340,10 @@ Constants CAN.LIST32 CAN.MASK32 - The operation mode of a filter used in :meth:`~CAN.setfilter()`. + The operation mode of a filter used in :meth:`~CAN.setfilter()` for classic CAN. + +.. data:: CAN.DUAL + CAN.RANGE + CAN.MASK + + The operation mode of a filter used in :meth:`~CAN.setfilter()` for CAN FD. From 71344c15f4ef6efc62fbaeef830fa357ee30dce0 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 2 Apr 2022 22:14:33 +1100 Subject: [PATCH 0303/1712] tests/pyb: Update CAN tests to match revised CAN API. Signed-off-by: Damien George --- tests/pyb/can.py | 51 ++++++++++++++++++++--------------- tests/pyb/can.py.exp | 63 +++++++++++++++++++++++-------------------- tests/pyb/can2.py | 18 ++++++------- tests/pyb/can2.py.exp | 6 ++--- 4 files changed, 76 insertions(+), 62 deletions(-) diff --git a/tests/pyb/can.py b/tests/pyb/can.py index 4ea29b0f63..020efae053 100644 --- a/tests/pyb/can.py +++ b/tests/pyb/can.py @@ -17,14 +17,13 @@ for bus in (-1, 0, 1, 3): print("ValueError", bus) CAN(1).deinit() -CAN.initfilterbanks(14) can = CAN(1) print(can) # Test state when de-init'd print(can.state() == can.STOPPED) -can.init(CAN.LOOPBACK) +can.init(CAN.LOOPBACK, num_filter_banks=14) print(can) print(can.any(0)) @@ -61,7 +60,7 @@ else: # Test that recv can work without allocating memory on the heap buf = bytearray(10) -l = [0, 0, 0, memoryview(buf)] +l = [0, 0, 0, 0, memoryview(buf)] l2 = None micropython.heap_lock() @@ -69,30 +68,30 @@ micropython.heap_lock() can.send("", 42) l2 = can.recv(0, l) assert l is l2 -print(l, len(l[3]), buf) +print(l, len(l[4]), buf) can.send("1234", 42) l2 = can.recv(0, l) assert l is l2 -print(l, len(l[3]), buf) +print(l, len(l[4]), buf) can.send("01234567", 42) l2 = can.recv(0, l) assert l is l2 -print(l, len(l[3]), buf) +print(l, len(l[4]), buf) can.send("abc", 42) l2 = can.recv(0, l) assert l is l2 -print(l, len(l[3]), buf) +print(l, len(l[4]), buf) micropython.heap_unlock() # Test that recv can work with different arrays behind the memoryview can.send("abc", 1) -print(bytes(can.recv(0, [0, 0, 0, memoryview(array("B", range(8)))])[3])) +print(bytes(can.recv(0, [0, 0, 0, 0, memoryview(array("B", range(8)))])[4])) can.send("def", 1) -print(bytes(can.recv(0, [0, 0, 0, memoryview(array("b", range(8)))])[3])) +print(bytes(can.recv(0, [0, 0, 0, 0, memoryview(array("b", range(8)))])[4])) # Test for non-list passed as second arg to recv can.send("abc", 1) @@ -111,7 +110,7 @@ except ValueError: # Test for non-memoryview passed as 4th element to recv can.send("abc", 1) try: - can.recv(0, [0, 0, 0, 0]) + can.recv(0, [0, 0, 0, 0, 0]) except TypeError: print("TypeError") @@ -132,19 +131,21 @@ except ValueError: del can # Testing extended IDs -can = CAN(1, CAN.LOOPBACK, extframe=True) -# Catch all filter -can.setfilter(0, CAN.MASK32, 0, (0, 0)) +print("==== TEST extframe=True ====") + +can = CAN(1, CAN.LOOPBACK) +# Catch all filter, but only for extframe's +can.setfilter(0, CAN.MASK32, 0, (0, 0), extframe=True) print(can) try: - can.send("abcde", 0x7FF + 1, timeout=5000) + can.send("abcde", 0x7FF + 1, timeout=5000, extframe=True) except ValueError: print("failed") else: r = can.recv(0) - if r[0] == 0x7FF + 1 and r[3] == b"abcde": + if r[0] == 0x7FF + 1 and r[4] == b"abcde": print("passed") else: print("failed, wrong data received") @@ -156,22 +157,24 @@ for n in [0, 8, 16, 24]: id_ok = 0b00001010 << n id_fail = 0b00011010 << n - can.clearfilter(0) - can.setfilter(0, pyb.CAN.MASK32, 0, (filter_id, filter_mask)) + can.clearfilter(0, extframe=True) + can.setfilter(0, pyb.CAN.MASK32, 0, (filter_id, filter_mask), extframe=True) - can.send("ok", id_ok, timeout=3) + can.send("ok", id_ok, timeout=3, extframe=True) if can.any(0): msg = can.recv(0) - print((hex(filter_id), hex(filter_mask), hex(msg[0]), msg[3])) + print((hex(filter_id), hex(filter_mask), hex(msg[0]), msg[1], msg[4])) - can.send("fail", id_fail, timeout=3) + can.send("fail", id_fail, timeout=3, extframe=True) if can.any(0): msg = can.recv(0) - print((hex(filter_id), hex(filter_mask), hex(msg[0]), msg[3])) + print((hex(filter_id), hex(filter_mask), hex(msg[0]), msg[1], msg[4])) del can # Test RxCallbacks +print("==== TEST rx callbacks ====") + can = CAN(1, CAN.LOOPBACK) can.setfilter(0, CAN.LIST16, 0, (1, 2, 3, 4)) can.setfilter(1, CAN.LIST16, 1, (5, 6, 7, 8)) @@ -248,6 +251,8 @@ print(can.recv(1)) del can # Testing asynchronous send +print("==== TEST async send ====") + can = CAN(1, CAN.LOOPBACK) can.setfilter(0, CAN.MASK16, 0, (0, 0, 0, 0)) @@ -277,6 +282,8 @@ while can.any(0): print(can.recv(0)) # Testing rtr messages +print("==== TEST rtr messages ====") + bus1 = CAN(1, CAN.LOOPBACK) while bus1.any(0): bus1.recv(0) @@ -298,6 +305,8 @@ bus1.send("", 32, rtr=True) print(bus1.recv(0)) # test HAL error, timeout +print("==== TEST errors ====") + can = pyb.CAN(1, pyb.CAN.NORMAL) try: can.send("1", 1, timeout=50) diff --git a/tests/pyb/can.py.exp b/tests/pyb/can.py.exp index a27907cc52..bd8f6d60b6 100644 --- a/tests/pyb/can.py.exp +++ b/tests/pyb/can.py.exp @@ -4,19 +4,19 @@ CAN 1 ValueError 3 CAN(1) True -CAN(1, CAN.LOOPBACK, extframe=False, auto_restart=False) +CAN(1, CAN.LOOPBACK, auto_restart=False) False True [0, 0, 0, 0, 0, 0, 0, 0] True [0, 0, 0, 0, 0, 0, 1, 0] -(123, False, 0, b'abcd') -(2047, False, 0, b'abcd') -(0, False, 0, b'abcd') +(123, False, False, 0, b'abcd') +(2047, False, False, 0, b'abcd') +(0, False, False, 0, b'abcd') passed -[42, False, 0, ] 0 bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -[42, False, 0, ] 4 bytearray(b'1234\x00\x00\x00\x00\x00\x00') -[42, False, 0, ] 8 bytearray(b'01234567\x00\x00') -[42, False, 0, ] 3 bytearray(b'abc34567\x00\x00') +[42, False, False, 0, ] 0 bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') +[42, False, False, 0, ] 4 bytearray(b'1234\x00\x00\x00\x00\x00\x00') +[42, False, False, 0, ] 8 bytearray(b'01234567\x00\x00') +[42, False, False, 0, ] 3 bytearray(b'abc34567\x00\x00') b'abc' b'def' TypeError @@ -24,12 +24,14 @@ ValueError TypeError ValueError ValueError -CAN(1, CAN.LOOPBACK, extframe=True, auto_restart=False) +==== TEST extframe=True ==== +CAN(1, CAN.LOOPBACK, auto_restart=False) passed -('0x8', '0x1c', '0xa', b'ok') -('0x800', '0x1c00', '0xa00', b'ok') -('0x80000', '0x1c0000', '0xa0000', b'ok') -('0x8000000', '0x1c000000', '0xa000000', b'ok') +('0x8', '0x1c', '0xa', True, b'ok') +('0x800', '0x1c00', '0xa00', True, b'ok') +('0x80000', '0x1c0000', '0xa0000', True, b'ok') +('0x8000000', '0x1c000000', '0xa000000', True, b'ok') +==== TEST rx callbacks ==== cb0 pending cb0 @@ -42,28 +44,31 @@ cb1 full cb1a overflow -(1, False, 0, b'11111111') -(2, False, 1, b'22222222') -(4, False, 3, b'44444444') -(5, False, 0, b'55555555') -(6, False, 1, b'66666666') -(8, False, 3, b'88888888') +(1, False, False, 0, b'11111111') +(2, False, False, 1, b'22222222') +(4, False, False, 3, b'44444444') +(5, False, False, 0, b'55555555') +(6, False, False, 1, b'66666666') +(8, False, False, 3, b'88888888') cb0a pending cb1a pending -(1, False, 0, b'11111111') -(5, False, 0, b'55555555') +(1, False, False, 0, b'11111111') +(5, False, False, 0, b'55555555') +==== TEST async send ==== False -(1, False, 0, b'abcde') +(1, False, False, 0, b'abcde') passed -(2, False, 0, b'abcde') -(3, False, 0, b'abcde') -(4, False, 0, b'abcde') +(2, False, False, 0, b'abcde') +(3, False, False, 0, b'abcde') +(4, False, False, 0, b'abcde') +==== TEST rtr messages ==== False -(5, True, 4, b'') -(6, True, 5, b'') -(7, True, 6, b'') +(5, False, True, 4, b'') +(6, False, True, 5, b'') +(7, False, True, 6, b'') False -(32, True, 9, b'') +(32, False, True, 9, b'') +==== TEST errors ==== OSError(110,) diff --git a/tests/pyb/can2.py b/tests/pyb/can2.py index 46237ad84f..2ce438f1af 100644 --- a/tests/pyb/can2.py +++ b/tests/pyb/can2.py @@ -7,19 +7,19 @@ except (ImportError, ValueError): raise SystemExit # Testing rtr messages -bus2 = CAN(2, CAN.LOOPBACK, extframe=True) +bus2 = CAN(2, CAN.LOOPBACK) while bus2.any(0): bus2.recv(0) -bus2.setfilter(0, CAN.LIST32, 0, (1, 2), rtr=(True, True)) -bus2.setfilter(1, CAN.LIST32, 0, (3, 4), rtr=(True, False)) -bus2.setfilter(2, CAN.MASK32, 0, (16, 16), rtr=(False,)) -bus2.setfilter(2, CAN.MASK32, 0, (32, 32), rtr=(True,)) +bus2.setfilter(0, CAN.LIST32, 0, (1, 2), rtr=(True, True), extframe=True) +bus2.setfilter(1, CAN.LIST32, 0, (3, 4), rtr=(True, False), extframe=True) +bus2.setfilter(2, CAN.MASK32, 0, (16, 16), rtr=(False,), extframe=True) +bus2.setfilter(2, CAN.MASK32, 0, (32, 32), rtr=(True,), extframe=True) -bus2.send("", 1, rtr=True) +bus2.send("", 1, rtr=True, extframe=True) print(bus2.recv(0)) -bus2.send("", 2, rtr=True) +bus2.send("", 2, rtr=True, extframe=True) print(bus2.recv(0)) -bus2.send("", 3, rtr=True) +bus2.send("", 3, rtr=True, extframe=True) print(bus2.recv(0)) -bus2.send("", 4, rtr=True) +bus2.send("", 4, rtr=True, extframe=True) print(bus2.any(0)) diff --git a/tests/pyb/can2.py.exp b/tests/pyb/can2.py.exp index 371ad2bdc4..3339e5cbec 100644 --- a/tests/pyb/can2.py.exp +++ b/tests/pyb/can2.py.exp @@ -1,4 +1,4 @@ -(1, True, 0, b'') -(2, True, 1, b'') -(3, True, 2, b'') +(1, True, True, 0, b'') +(2, True, True, 1, b'') +(3, True, True, 2, b'') False From 7a447e08b23f47fac6ebcbe5d60c4e1d0fe0d157 Mon Sep 17 00:00:00 2001 From: robert-hh Date: Fri, 18 Jun 2021 17:12:44 +0200 Subject: [PATCH 0304/1712] docs: Add quickref and docs for mimxrt, including network.LAN docs. --- docs/index.rst | 1 + docs/library/machine.PWM.rst | 12 + docs/library/machine.SDCard.rst | 43 ++ docs/library/network.LAN.rst | 93 ++++ docs/library/network.rst | 1 + docs/mimxrt/general.rst | 92 ++++ docs/mimxrt/img/teensy_4.1.jpg | Bin 0 -> 127829 bytes docs/mimxrt/quickref.rst | 864 ++++++++++++++++++++++++++++++++ docs/mimxrt/tutorial/intro.rst | 125 +++++ docs/templates/topindex.html | 4 + 10 files changed, 1235 insertions(+) create mode 100644 docs/library/network.LAN.rst create mode 100644 docs/mimxrt/general.rst create mode 100644 docs/mimxrt/img/teensy_4.1.jpg create mode 100644 docs/mimxrt/quickref.rst create mode 100644 docs/mimxrt/tutorial/intro.rst diff --git a/docs/index.rst b/docs/index.rst index a97bff1c84..3bc78e9023 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -12,6 +12,7 @@ MicroPython documentation and references esp8266/quickref.rst esp32/quickref.rst rp2/quickref.rst + mimxrt/quickref.rst wipy/quickref.rst unix/quickref.rst zephyr/quickref.rst diff --git a/docs/library/machine.PWM.rst b/docs/library/machine.PWM.rst index 793c074a36..4b74355775 100644 --- a/docs/library/machine.PWM.rst +++ b/docs/library/machine.PWM.rst @@ -78,6 +78,13 @@ Methods With a single *value* argument the pulse width is set to that value. +Specific PWM class implementations +---------------------------------- + +The following concrete class(es) implement enhancements to the PWM class. + + | :ref:`pyb.Timer for PyBoard ` + Limitations of PWM ------------------ @@ -90,6 +97,11 @@ Limitations of PWM 80000000 / 267 = 299625.5 Hz, not 300kHz. If the divider is set to 266 then the PWM frequency will be 80000000 / 266 = 300751.9 Hz, but again not 300kHz. + Some ports like the RP2040 one use a fractional divider, which allow a finer + granularity of the frequency at higher frequencies by switching the PWM + pulse duration between two adjacent values, such that the resulting average + frequency is more close to the intended one, at the cost of spectral purity. + * The duty cycle has the same discrete nature and its absolute accuracy is not achievable. On most hardware platforms the duty will be applied at the next frequency period. Therefore, you should wait more than "1/frequency" before diff --git a/docs/library/machine.SDCard.rst b/docs/library/machine.SDCard.rst index b07ad37d39..cde0bd1d14 100644 --- a/docs/library/machine.SDCard.rst +++ b/docs/library/machine.SDCard.rst @@ -122,3 +122,46 @@ You can set the pins used for SPI access by passing a tuple as the *Note:* The current cc3200 SD card implementation names the this class :class:`machine.SD` rather than :class:`machine.SDCard` . + +mimxrt +`````` + +The SDCard module for the mimxrt port only supports access via dedicated SD/MMC +peripheral (USDHC) in 4-bit mode with 50MHz clock frequency exclusively. +Unfortunately the MIMXRT1011 controller does not support the USDHC peripheral. +Hence this controller does not feature the ``machine.SDCard`` module. + +Due to the decision to only support 4-bit mode with 50MHz clock frequency the +interface has been simplified, and the constructor signature is: + +.. class:: SDCard(slot=1) + :noindex: + +The pins used for the USDHC peripheral have to be configured in ``mpconfigboard.h``. +Most of the controllers supported by the mimxrt port provide up to two USDHC +peripherals. Therefore the pin configuration is performed using the macro +``MICROPY_USDHCx`` with x being 1 or 2 respectively. + +The following shows an example configuration for USDHC1:: + + #define MICROPY_USDHC1 \ + { \ + .cmd = { GPIO_SD_B0_02_USDHC1_CMD}, \ + .clk = { GPIO_SD_B0_03_USDHC1_CLK }, \ + .cd_b = { GPIO_SD_B0_06_USDHC1_CD_B },\ + .data0 = { GPIO_SD_B0_04_USDHC1_DATA0 },\ + .data1 = { GPIO_SD_B0_05_USDHC1_DATA1 },\ + .data2 = { GPIO_SD_B0_00_USDHC1_DATA2 },\ + .data3 = { GPIO_SD_B0_01_USDHC1_DATA3 },\ + } + +If the card detect pin is not used (cb_b pin) then the respective entry has to be +filled with the following dummy value:: + + #define USDHC_DUMMY_PIN NULL , 0 + +Based on the definition of macro ``MICROPY_USDHC1`` and/or ``MICROPY_USDHC2`` +the ``machine.SDCard`` module either supports one or two slots. If only one of +the defines is provided, calling ``machine.SDCard()`` or ``machine.SDCard(1)`` +will return an instance using the respective USDHC peripheral. When both macros +are defined, calling ``machine.SDCard(2)`` returns an instance using USDHC2. diff --git a/docs/library/network.LAN.rst b/docs/library/network.LAN.rst new file mode 100644 index 0000000000..58bd61ebbd --- /dev/null +++ b/docs/library/network.LAN.rst @@ -0,0 +1,93 @@ +.. currentmodule:: network +.. _network.LAN: + +class LAN -- control an Ethernet module +======================================= + +This class allows you to control the Ethernet interface. The PHY hardware type is board-specific. + +Example usage:: + + import network + nic = network.LAN(0) + print(nic.ifconfig()) + + # now use socket as usual + ... + + +Constructors +------------ + +.. class:: LAN(id, *, phy_type=, phy_addr=, phy_clock=) + + Create a LAN driver object, initialise the LAN module using the given + PHY driver name, and return the LAN object. + + Arguments are: + + - *id* is the number of the Ethernet port, either 0 or 1. + - *phy_type* is the name of the PHY driver. For most board the on-board PHY has to be used and + is the default. Suitable values are port specific. + - *phy_addr* specifies the address of the PHY interface. As with *phy_type*, the hardwired value has + to be used for most boards and that value is the default. + - *phy_clock* specifies, whether the data clock is provided by the Ethernet controller or the PYH interface. + The default value is the one that matches the board. If set to ``True``, the clock is driven by the + Ethernet controller, otherwise by the PHY interface. + + For example, with the Seeed Arch Mix board you can use:: + + nic = LAN(0, phy_type=LAN.PHY_LAN8720, phy_addr=2, phy_clock=False) + +Methods +------- + +.. method:: LAN.active([state]) + + With a parameter, it sets the interface active if *state* is true, otherwise it + sets it inactive. + Without a parameter, it returns the state. + +.. method:: LAN.isconnected() + + Returns ``True`` if the physical Ethernet link is connected and up. + Returns ``False`` otherwise. + +.. method:: LAN.status() + + Returns the LAN status. + +.. method:: LAN.ifconfig([(ip, subnet, gateway, dns)]) + + Get/set IP address, subnet mask, gateway and DNS. + + When called with no arguments, this method returns a 4-tuple with the above information. + + To set the above values, pass a 4-tuple with the required information. For example:: + + nic.ifconfig(('192.168.0.4', '255.255.255.0', '192.168.0.1', '8.8.8.8')) + +.. method:: LAN.config(config_parameters) + + Sets or gets parameters of the LAN interface. The only parameter that can be + retrieved is the MAC address, using:: + + mac = LAN.config("mac") + + The parameters that can be set are: + + - ``trace=n`` sets trace levels; suitable values are: + + - 2: trace TX + - 4: trace RX + - 8: full trace + + - ``low_power=bool`` sets or clears low power mode, valid values being ``False`` + or ``True``. + + +Specific LAN class implementations +---------------------------------- + +On the mimxrt port, suitable values for the *phy_type* constructor argument are: +``PHY_KSZ8081``, ``PHY_DP83825``, ``PHY_DP83848``, ``PHY_LAN8720``, ``PHY_RTL8211F``. diff --git a/docs/library/network.rst b/docs/library/network.rst index 1bd7e303bb..361e664b54 100644 --- a/docs/library/network.rst +++ b/docs/library/network.rst @@ -152,6 +152,7 @@ provide a way to control networking interfaces of various kinds. network.WLANWiPy.rst network.CC3K.rst network.WIZNET5K.rst + network.LAN.rst Network functions ================= diff --git a/docs/mimxrt/general.rst b/docs/mimxrt/general.rst new file mode 100644 index 0000000000..d08e180e7f --- /dev/null +++ b/docs/mimxrt/general.rst @@ -0,0 +1,92 @@ +.. _mimxrt_general: + +General information about the MIMXRT port +========================================= + +The i.MXRT MCU family is a high performance family of devices made by NXP. +Based on an ARM7 core, they provide many on-chip I/O units for building +small to medium sized devices. + +Multitude of boards +------------------- + +There is a multitude of modules and boards from different sources which carry +an i.MXRT chip. MicroPython aims to provide a generic port which runs on +as many boards/modules as possible, but there may be limitations. The +NXP IMXRT1020-EVK and the Teensy 4.0 and Teensy 4.1 development boards are taken +as reference for the port (for example, testing is performed on them). +For any board you are using please make sure you have a data sheet, schematics +and other reference materials so you can look up any board-specific functions. + +The following boards are supported by the port: + +- MIMXRT1010-EVK +- MIMXRT1020-EVK +- MIMXRT1050-EVK +- MIMXRT1060-EVK +- MIMXRT1064-EVK +- Teensy 4.0 +- Teensy 4.1 + +Supported MCUs +-------------- + ++-------------+--------------------+-------------------------+ +| Product | CPU | Memory | ++=============+====================+=========================+ +| i.MX RT1064 | Cortex-M7 @600 MHz | 1 MB SRAM, 4 MB Flash | ++-------------+--------------------+-------------------------+ +| i.MX RT1061 | Cortex-M7 @600 MHz | 1 MB SRAM | ++-------------+--------------------+-------------------------+ +| i.MX RT1062 | Cortex-M7 @600 MHz | 1 MB SRAM | ++-------------+--------------------+-------------------------+ +| i.MX RT1050 | Cortex-M7 @600 MHz | 512 kB SRAM | ++-------------+--------------------+-------------------------+ +| i.MX RT1020 | Cortex-M7 @500 MHz | 256 kB SRAM | ++-------------+--------------------+-------------------------+ +| i.MX RT1010 | Cortex-M7 @500 MHz | 128 kB SRAM | ++-------------+--------------------+-------------------------+ + +Note: Most of the controllers do not have internal flash memory. Therefore +their flash capacity is dependent on an external flash chip. + +To make a generic MIMXRT port and support as many boards as possible the +following design and implementation decision were made: + +* GPIO pin numbering is based on the board numbering as well as on the + MCU numbering. Please have the manual/pin diagram of your board at hand + to find correspondence between your board pins and actual i.MXRT pins. +* All MCU pins are supported by MicroPython but not all are usable on any given board. + +Technical specifications and SoC datasheets +------------------------------------------- + +The data sheets and other reference material for i.MXRT chip are available +from the vendor site: https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/i-mx-rt-crossover-mcus:IMX-RT-SERIES . +They are the primary reference for the chip technical specifications, capabilities, +operating modes, internal functioning, etc. + +For your convenience, a few technical specifications are provided below: + +* Architecture: ARM Cortex M7 +* CPU frequency: up to 600MHz +* Total RAM available: up to 1 MByte (see table) +* BootROM: 96KB +* External FlashROM: code and data, via SPI Flash; usual size 2 - 8 MB + Some boards provide additional external RAM and SPI flash. +* GPIO: up to 124 (GPIOs are multiplexed with other functions, including + external FlashROM, UART, etc.) +* UART: 4 or 8 RX/TX UART. Hardware handshaking is supported by the MCU, + but the boards used for testing do not expose the signals. +* SPI: 2 or 4 low power SPI interfaces (software implementation available on every pin) +* I2C: 2 or 4 low power I2C interfaces (software implementation available on every pin) +* I2S: 3 I2S interfaces +* ADC: one or two 12-bit SAR ADC converters +* Ethernet controller +* Programming: using BootROM bootloader from USB - due to external FlashROM + and always-available BootROM bootloader, the MIMXRT is not brickable + +The lower numbers for UART, SPI and I2C apply to the i.MXRT 101x MCU. + +For more information see the i.MXRT data sheets or reference manuals. +NXP provides software support through it's SDK packages. diff --git a/docs/mimxrt/img/teensy_4.1.jpg b/docs/mimxrt/img/teensy_4.1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0a09f68ea4f3e201fd606a10fe8bda30e6bf7b31 GIT binary patch literal 127829 zcmd42XIzs_6EA!v1VWHr6p#`iBm@L$O0QCq&^w~iyMR)qNCyR^gwRm|Av8fL(o_&o zkRnJg0wU6j6sbymqxb!u=Q-ue`F1X{zx}g2vzgu5-D_uNb2ff91JL6%uo?ge1OhOm zKj7>;Q@Ogoiz5JFv4Q|4006YWIRFgMkWd{d0U#IvB4vscB=|3;Cj$UF5Ey`w%G*eZ zo`nCVrugZ#Dg^NkZUb!MGDg|%@*%ANru$SfJ`9GEIvH`#{NiJm?G9d54pH}{9=TA?YuUI;BslF!^^tc>iG0zw}HbS!qp_ z|Dmz^Q?CDC*!nLGIf;hH>7Vu)NEqn^`ddy~ULYwa@LvoTCGk3u{l#R)h9nI6i~q{t zME)0(1_Gq)1pSNu@Zy{({^EalDFIS{0MOYPi5K<{1|vwA>K{y6l7JKSfBHqD1^$Nud$UwXRm;pq_06J>}I7xDn zk^h}4|8xQ%Nkv+)U@~$Dsal2}0E55~G71QUg0xGM9#Rd20U)Q~fij9Q@rtV&*ibU_ zsUQqJ!&xp!BoBPImAqz@Url0VC#i~zv^@UnAtN@WB@=A5SSc7qWGu&4>1D| zqXC3TOvQ%RGr1~!i&@<8``H9QO(Fp^kTH-%CrtRMK+GJrlA7zpitU~4IEU)%1O*Cy z@V-Gs1!xx0Pt?c1VS2E`?ymFHXhFPPhtoL1B7ha4+intT0>71-bgMG*+H)6wYw~#@ zgL$B1{KW|E(hmh)LDmAXoLT?J&y$S8Q9gGBg|hL@%INiw!L>GZw0J>nI46I z>yI~)YO8=vKN5c8+KqfD5n!6oE>ARORyfsN+<*5gLFX$%=e)wTr7ujp5sIdVE^~JT z_S*A{_l zex7jSGXLrsKqp2oT=9+P(pAW5NB^v^lrPx7gj44?Wd;Ysj@E8Q$8XKNk77gWedr$< zZSn>E);F7(j(M-I*}B_hlnuditZh>LJn?mo8*Vfm2dsUUf2DobwaYXzG<1EAi+eu5 zUYd_{d0nV1W#h9_N2Bu<>|A+8YM$54XCTYr5Ib_eV2JgFq=t(k!N*GAprz>XY(eA> zD>2F3K-@$dJ;R%Q8w&?mI6v37Kc0OY`IG> zO*+51&H&7Fbb&2l2Lq!DWAc~6@|}F3dX?M6>%X92EE2kBl?=-s@1)L*gnT7 zJlosHU<~)WOW&A}5iCAG6AYNJ@<_~p^CJH+=Q!|G;UuYu&*+}%lKPPT@9nrgErzEd zgkQQ-1;chXQw_564{^|-PwU~zzbd{ny^voio%1jBhPb7Aa|K-f&N=;-dp*Hd>3k!1 zgiLXYq2Jv>UG#Id5)>GH(ZO`X4LfN#4%*jMLEQ`#$9%#VXu|JxBE5J8w&L-KST(>hF(!3X;=)zCSP7lhps0T)M&!xP*mu6th z@O^XK=N);9iHgCo4kK%RY1!S?P+?beQF656NU3gpc?-bm}xL;R+_ zWh8t>Uexr`OKb5RdenKtkMk)5cWf$KJ~!+2vFIq6oWG-)xxZYE)x)fQjg+zZB6d{@ zxLMh-NwX!YUpVi`;Jqj^EV&*W_$_c%s8fh?&pFCOc0S834y{c^=rI9Rk-y(LKKCw{q8-GZu< zNjvwn#GfmBnPiKY8qg1(Yz`i^29 z*EFd{J`2j^nHlLhA`qzDhR2f`gX60|owS!MB=i+cN(6F6dJTRr6{n44X`S2b#vDE2 zn@vh{!VnpS$Y0T^dKM(e~L>leeE`Vrk9*df9j>!>0*y zfZPK6eDIIa)_V^u))WWXeTL`Xq-UVhtZlZpby%N{D0}f~7~aUtor-{JJI<<5@A~Qx zL^z|1OrOfUX=?Pl)l>F>VCs5)XxC?Jk!jwSMI3hiiqmuF1=uGk7hZ1-%DZ-}Q1Fz%JIX1M@1yEBN`2i9 zE3RZ}a^AP8O?M2GJ(>e>u)|_GaY;>CFHkD zOz)3hpQ}e_s~LQ$5Bwfx!%*q?CP%Iz!b7fC;1nu?{K_xmFYP%Pua|ZXoB8o0sn0aJy`KIU@bmR#Q=Ft-bGdtKL-;opT?s8I;qj zbZ8o(424o?&DV!n?nA7{Jj45qT)IcYpiGls%gz#1t{3aCim|-fb@xga#_ihndTuu# zw-?9qVzTEiNZz6&eyP1fxvk5DOSqcIULf4#x>)>4x2T4l~xTEdkX4ms;wxQ32oA;VampS(hc!wQ~ zp;;AQ+Lx44ZF>~+ncCc4WR-9DvbS%Gmo`ur`q>SRCrvBfS0COoip?gNb`Qya7OHk0 zvC9r@PA$c%m?l*-GAE>J)ZG>F2(&qLZBRPL|7cgy`}FSncf2(Zi0)PYpo?QC0Tf<~JupsjcUzIgS`{LUrW8o+#oBeY=&(i8^ zV`mp_^H~zFm*zV=Mo8nc=v*!$Y(R_pw3A=-lyyb2pZosS@00JR95>a#6??Sp8Iq4E zn;$iA)n9A8@TIkIz7N)(fpx3i85@?THoLR_%QF4@U82RIL!>mpxzrx5psKN2nELX& z-387ODM;Q^TqDay!^Umb>F$H4_O|~a`*w|f@>qxEFQpx%g3(DcLYD2 zWPbbMsofWsm*VB>Q?gCBV&wcQe3yQOf41%O^%`w8GBBgAZ2P2uV@c~knHplD2h!{+ z`jtBZmLAp=M?O;T&j881u2&_<2l)?lJ1YiFo`%QW0B+(%W+tYJZ9;GQqiaT0IJUY( z%mpLB$hhnF3u*PQZkj*xwn}xsEA}F#DuL#U&)nkD4H|+jsJ!9V2@LMKfqtirEzu|lPWzPjn5&-IPAB)tqOzVjWBI1LbG9*H=QPc0be(Ss5X^=da%^Yb85(wT;=RZaglL?LNP2?=?(-BCIN zbZh&DZ%y2-rfcatMwozkg`vg$4|iwx6LVf&PN`y)7-z71XmU%{K0>Q!=}oYLk~Y#? zho8khc!lk46HSwnwrJhx+kyf0kkappJ|p4?pY6=4op8GQ!*W@GD=XJNGR`&bd-t z`-Odzd-)wdMQ-$N5&xHvQ_ea%m& zRoK>Gm3zmCNvVZ1z&sW6%La4p$GfZB6%{Lw)IU%e4*K7B>U=jno{0GhHi{Q`Ye};T zZ2rRfDP@cY*=9s$M?O6RU;-YXT> zzw=u?_fou~;jOUk(|6_JGp5&#(j8Lq7@U{6d2twi{WH3QHQz}_KN-E-eD>x4F-sG)Mz;LFS(=dl$si;r znUWMBC?x z!cve!NtIFzBqJU~1||nnkUVMtltlICTOo`*+#uQC^Ow+T zMAWK0J*8fH-fuW6M(Nnde|3XQXTky^h+KnXxSm=}-EU+w2BwzsV7E z<->?CRb$WG*a@^NoI+@F!I=%fhvl-3|CM90&V*A$U8druEOm7gxk5b`(@|-9IXlx0##IVU%*BaL=X8kX->9lr z)q@mPq7!uSx^VIzWbgq5>*SD!0(?YI2g6I(G4Kc=EEHSJKospHzsAvOtX3+) z{W$?LN{Q8G>a!5P3~mks`&e?4-*CGK+4f5Vo!q7xkoHwg$iw@?Jg*%uAE&7?w8IgF zMvQXdsfo@_;a1q3jbzvpA zyqZT75WZyJnq;crd+=pWUk_WTnMtJG>wl(!5{l0UL;(emaFaN5Kz$zUX{yOP3$EF1uNhYu6 z42+Uo7|ju7se^U#wwK>?zD@R+4ZpE!e5j)kJJ=%=Ut`rf4K`QdxlFGluq^P>z4GqC zT<))P3C+9N_b5;-_Ku-p-^9)Ufg*bg*JC%kadycvEw}K{WQP9ZfinPSQ8VL@5Ih5T zae+D=+=Gb%kz)OR<+Qfsm$Hv*LjiS{LNw}hyIF-3%r$ptgc*WpFL)s$d`=@6`Wq^pux|}rKvQ^2m7y}x*fT(| z5&%DJ@;}s*WH-&Gq?l&tj|QbQAQEAiauk^#HopD6U4uJC=rv8+{uIs?0b_xfFii{S z!WtPh|6EY&wBvWd1M2$IwC@qkK2cA4yQ4gX3r+-P)tK5MryFBk{nu2uh0S4&SGGs- zEM#YW8jmNPh7XD^3)4+i@R29u4$9=bQuqomNh_*b=4ERs z1hd)AtLi(|^b<1k-koLH&up-K_&|M5K_(e7fFa}ny&P!Nl^*CX#5Z-Ag0B2&`(^BAQtpqv<#1ig9+^{b#`Ma9#FO3|q#VyZ0X~9U2K+-{~jN-fHLe70(fD z(L*GTL>&@zz}uCe5Qe}Ov<&%c&fzdv-ahNvn8a%$b-2pZ7=PZ24kvEsvh0*v)O3U` zJD*IZpgvkes`C(4sAP8~+kZ1rQTxiHE)PXV?NU*I3&XvH)4hOTrtD!rWz};k1xhCr z}fFX#6a}l^Bius-P68^1(s1MZ?p9@7T2SitR;{H?o6%E&BUJ z&F+qcuuy1sPl$LaS;S)>khum*5a0C0q4d_XsJKcs5by0S1MQZ@%;R!JbLdt)VU$o_ zwAh9-?aW%zCcO0MYvTY1? zB%XXc1E@a1a9%O6!^tl0&#!)I7<>P!rd&hUlO3;qfZmlirDD|N=y$eo4pTbU)gj~l z>I`Us9+@7h*`c z8J@!Fe@Z`_SX|r`D8nnw{BR);#CktdEd&WV*baCWpzWv5<|e9Z_A7jelD`yiQ+Pga z!`UavBx(5MBRj9wr}Z;{r^sR0W%k*(udGfiDHwBafG7me6q-9;*yy6^b!Fbl_^T=ivJ{Jxg_;QGaRa6ru+X5P45u@lF!@G{ zQslgCSRe#x#C;48{Tx3@^CAo*@5{N;0(@0iNqLY>D*%o^ zuN)(DPeH*r-4I#zi)Hh`Ym;0%v_&wWuaT9>)2NITrArAL0g`yEy5!kl4x#c*n<4?hPg*OlkjmCbbJ zZV|hRbhL#D_kk9|liX@}AY4>iuiubGQbS*xf+RVZCG9%H7h<9dclh)MM&{mJ19idS zNE9uUVYh;*hLDWRzp*e2I%YhfH%Rj@D?MerE%4!1SblkAoWW)#An*kjM>NZ8>$55Z zE#yO_%ktq?!W2p^vV)-%Z?-#4)o=Qoa&k=g8=RE#-+0JOHq^njAUpkWMds6R{r$?i z!C12liFSGo37? zyVhVTKlFfZKF|IZ6zMZF}48(qb1T^^OkXic=~> zak5eTOyFd3e>|Nlq-F~oudt#*ae~YB@u@)3`0G2KQtsbLIbQBzVTA5fxQ|n2ErxCX z6b!gzGG~?^b*ryD42P6H8eXh2>*RVo8?sIngd|*cySIDJtZX;m8G>M1pCCHD%-qED zOTS%UVF<2M`lVX+>(&`ia{Nnv-3(O$cK>Ti*YEE&MX>FLwSz+Q**o_i%x*~2U!^Qy^Kj$lb#hZ# zzC8+iY)^6{z-A+*!nrSSM5e_y$NU~Xad_4nn8+^|c$&7VermzHKFIQX^J=%rb_o^N z=__W>nvIxcS^e7zT_YKvk~F*PvJ{U}Z4=02!!+etOPPi)A*F9H=I11LvOLX6L|1Wy z>2X_l$`e7YoU6!I5U+pkXlevZE-Iv^5RAyl4fIejYGY8Q!lgz8%Mo1C!UfSAE-eKk znvrel!q>iK<(Uh8xuCRHz%apnpJB75;Csl-j&j8Wu9izoEtb+B#H})&grI3o&27ST z>5WLdM+Q{5Q1oJ-mZk-tNpppsL_TN;603+hf@7pMU?<=`T`ld#siaEpcvJ>G^p$RtKbTqCxBJw`7AxWyJY5bOgL8F)1vOW0Px!%D^c0OY!9-XUrL} z#_U4&3Cocw)=n`R2OGNA?x=tcR|r;3EQw0li&P;9?abQ<@dze16;;QITPL~Vq7bQ> zxvmz*{!9~**Av<>aLgL>)8fqXvXNE_r`iDVSUhh$C^dzzvYa^+SzUM+emaat1|Ic? zg+E2uUiRDDHanrYO!e%SdPKeF_Ik@1@E+Zy9M;JHOPkHc8XVLv7ptrxGJpn?QF8no zfE$Tdj37fo{A0>J6w2DwC^O?QK!?O0b5==b813A2DuIro@q8LxNZTM-MG&ck!$1|# z3`|(G#O~&GRYJhQTy}S=GG_z32usFeL@6F1$5_93)dUZIB0PY0APZPurk zo+MBWbP2CKu{DP2*Q+1{ha^J3CXGuVPOX6oBo&4)sWt#Bgp}TAS)Wp4BRZ?%z=7VJ z(P(AnpXNF5Qcw*QEX>8fz0mR7%xaNZ(4nDP9t5p%pkYKe7P6(et_%}V^OWxo792Qc ztIU(SU^TZ zt36&;RX^>l+>qg>um}vN>>y5xZ8>Blb0+pg;7SmyXr9{ce)**iunRVZ%$ed<=d1vz zl5*LWpwYL4MWe2aU}0_?G5twF;vgReCh@lI9c zw2XNHs3$_VL+c|IkdZZ^d*NH!A7Jp1#sRM| zl|+T*iw@U}r-*oiZTAwg(R%{=4zIsg%u6P}!I~+K%qKL-2D@N*to+xm^WEQR$s2qN zOAQ}N+*=={9qtW)O{H*uPFIF^5Kop_CzyU0lvMEBd8Qni>f;&xPu9L-7}|lW{*W+j zzr5FepR(drk9gX1E6}`2kkk@vQxyzD6R%cs2# zu-(=L;}`ETC3`8ge;{&%AS|(`CQqkQ!<8&r%nX$KDBgo(*2fL)JUMpDRS3alZ~?Xb zO=XxuTWdD7oc#=F$cc7;$euE+nTaf?$E=KouP%Iq?H&l-{u4tKkob0}E$k5y6_ofs zW6TqpJkdB9%vEq`*bSQJQs*7NjANwO2rd(cl3O{K6O=AnXv|_6IA52f$U~7(h1;zP zdXh8Rq_v%jWz_C-b*4sAqIQc?bM?5MjdQQ)zJMRh7&%2{<{)xw#l;WJFW~A~O{Ey= z!^Cn8bDpBMakX(Hb; zDEUMP$Xw~QE9GF|T)Fma?I4dL9T!XQ!b1U5fHukeHkO$mWJYu#BQDW7R!U^d?QmQo@1vaPy<7;%?id)nr~}Eh;in)!$QaA9yRHoKntT`dQCYD%;K)GZ zHztRi?i2C(_9y2V7A!Kh=2|R=Uy(z_sv~Cir{x4@DG~>du;opcf%p+!`AX$tp_zrW z)V}*y){84fn~s+mA~ZgO9sFSb6RR^KWwDYZHy< zDbc(+WCx(ByfeV%65S%q;mZ%|_KT`%RC944ul%Ri?WvwA32v_5qbw*zyOZsBxn#L~ zbU4m3I5*{#`@$AR&dbE>0#BII9#j*w*R*!YCP&i0)ZU*>#jIf6!at59pJ=(j6gr0Y z@*s&j;&P^{PK~CT6`q@x6Mp2h%+%~ag{u#-;=&u13+wcnb`*(MDb1P@!6jGo1*N3( zGBLl~2$ZYvf%(MdugFM#tDDgXR)wTmR5t}i4BY4d$0AA7{N7!FIl+m5eNq+1p?r}5F1Sp z)ozKVE3{0XmSMdG5s<*dy%%={NSF%$At0{4_~jfHCe|VO5a9TMI6;RHq|5V?QN`0) zmG8|O)OIGSRYak80##Js5L-BJD^~k2$g=}mU%#!3v4ma48c1wTq#^cJ#!b&-Q3)+a z{Xnl8u^5WKiJ>k@R!}pJ*FOX9)@pBG)Y~nYNK1V}p}}lekzuu4n%UMKY1B%IIW-Pq zGh0)d2}Xxu*QN$P*eZk*QyRD$#|ZPput0rR(Fz=qPREwg;4rS+Y(;`;qLC^l=4g-% z25jtMvu`p+ZlEhEMd_fG<%QKxr-ndfc_Fu2OcrYQ@Zt?i&3Kbb&lxMHm}7E;CNWI%W6h#5*%S^MvMRid#vvmy7h`e<8&h+p zieKk3%q;y>7JunXo2H`kqT}@&|IRa@d|)|xcVCiE8}V4`5cVc0>DV!nKevp&!9cO6&yGXt1f#osSqaIODq!WF+z?o!FqtC|B}RnU?4-As@UV zs7B06S+|4YzX-jn^u?h+t<$a-QqdUpQ&T z&wwrRE0Yv*Aq@{yTPX}(ZZym?9h9@TdC2cz#_i!zZ9BUafOgPWm_9|IDP_)Ln1*&K z-)jy}?4;su0Zh;G>Dpwl(i$eXO+ZOmkJa#x7wMl9*Y!86lEm8-`vobA5zI&FQX zmAi8&TEi}ecoP+*MV3gnTS}k3E2^6|@#M-IeI7WMl9BpSgn-9W3~SMOI3pr_G8>6F z0}92TheTPkK_WYFEqXxC?QRGqxQc3(ZhOVxvV2I+aa_xCDPr)=iDqDje!z_1Gq@-t zD!WCuC8Q=Vxdlnc^TRO6>qu52VRgDcMpopvvf#l24a&*82YC$(vNIq( zk*FL;JrP<+a>9~qc)T*bQko1%GX-G(iHY1CjBYKtV;{@>l$i8FS^+I~yvEV9zi9wU zSuy6SCA?JTb-C{`Lxo8}n@Ga1I(b!_e@DP>YL5Hn_mWjIk>8qq;K1~X&)zPqP;)E} znYsZa^3_WG-GeC+TOnzw05V5-EU;qEUe2I4cd@Jae4D4`GM&w)4iA|(HvU#esOIm%s>Vsw-Svs8Y<*pk`S6Z( z9g#MjYU-?TNj8h)fvsR%)M?J%s?U~eiY3vdWf~E>M(dVBbqXk1VGFt}H}Zm?XT^`O zo&oE$HtGvN1p@xtRW1yh^R+0Uz;LdITVA!{B0+PnRDvRV*==*sA zfu?yV*+!82E3z@cCQ_gK;L*iHdKN8;W-+TyAE7(JL!?*xxp}hPyyl4>S>|WI5}G;V z)|4j74QIuv5xKrY+)2<4RznDZP7+Uvq+512+mGa8Xs{9`o&jT{jlLpRl$qy+O(q{| zO15oA9Pr)>YjUtA1n4}P*F3=%JX1l>=on9b`a*NvvH3~8YV_lsWBZ@0YGi#zz3jRk zU9gm3_d~_py}T~i7+_m{srUsv-CMQp2 zdIarkrq0M4`+yjFr8XKHDFLOU;dNfk=V3o>wyB2Uf;-eKD_;Xi3s1FV?tVl;rvkaz z&S&y@Q5!*A_&W^JQR%@O$xk1gp+gKk`u5K|f2GU^UrdwesI2hpVB%b<$W)nOLVYU~ zn1XcjD%M=Qk2!vXge^nvl_R`SFAyd4)bE2=c$VP=?cMOvuy5SS@9no_h!K?m5wfPt zFW!UTN17I`_W`hEta$O6Q!;V8 ziPjy{_?t^B=KN^JK)-AX;yd-IF#7`r%e&giT}OkA-wi0>X7$CMa>e8N7c)BL3ggJy8>L5t^?~ zn;3C_P@Q(lUNK|dvksiw)A!VLdBj2&ChqP`2UsU_(Z?A<%=X9$4c%ZjY{fzhqYzf@9c$zbsChYyV=LIm z=__-KcZ*RKoG$0|f#|?!f0XpF9Ij`vYzBd!ppP(f8<`Y^Fa(|Yf7XmO3B!=F+Hq_vG9gHSd zS5R2t->_BOO$bmOzDFx00OFf6vS}k~$C>M=AO)yn4PX%Ou5xm&0n1oK;?p(q;Y2!4 zQXEQ9(S`dvGh2ad&WRY`0=wM9JBAJUttv{cG}c+euff6kpHu_&j1K$b$L_`W&<>f; z(v`iizXW#5*-fL*SMyoH^ygA2g9A=(%SrhX!JxIyLMYsuY(;rHfUktJR0zTKa{1Q2&R6;m!T`*M`5x(NiQh6LYWL~nF&uz+_x$M;F`O6 zT_uYGlBv6hpA%?R?Urz?TX%q{(hK`mEPW`B2Ah*2N_l9ibuC4H5Zw4qvn=lOo^OQ0 zN_ggW>mF7i0qGy9rT_KFmpP&9X6p)u4#6Dl&3wUF<_x&USZUobp8IlDN}Te5`J5^E zi5=;uOcX14mCe;6gP`NOi!NMY*rgXTEt|cfUwA|vHJhYi28us5&RLHRwFF|0NAQG~ z1I(#uAfRLLiFRzZT08`igBDP}7`3xkPEdi|RVYPpZ!$<$O0+RQw`RcjI(;&LC&K2| zbuT4`4bd@G-EW-;3{DV#%l#~$HeIfAv@C|oO^|N%5m}!F9Wmpr-gs8hciI|z1et;h zzF=83P;<8s(kBQpWj5+!nZ+^&8eW!%`z}_iB?2p0L7bs>djO<$F$%1S8qT?WP9Me# zH+p2o;Y%b?g%m|7wrDYzvi-)!77ywHuMtmZ;(xH50uacYPveQ z%3V2%B`dv>`gEu7)MP^@#-k&*NV-R*y z2Aj}i+ApOrh=FrOR4pYh77z{y+;cwWs@9f{gA4ug`R=HX8wJv8%SCUN1>0)0(IoTXL(|q2d95Nip=$K*t3LM;oP3Q)R+@q{JBRX==pVzVZ0pH?9|v@ zE@qJz%_i`iErV-jAgsL+KT}kXDBc?}$scUuz%Yue(gCX$ zj+IL|?3biE(k1;5S>-6q_g0AAxM5Sb^CuT{&OPosuIAhrB^;$c%Y7h&C`R79#5G_} zHjD@*h472`ZLq(u)fzNFSx#$Q-~t3xQeejdJm?@VBmBlbI-rT?q0TAnmE#R;W0>Lg z?_Ht9X4lInkJ@6;wP88v(W7!Tttriv2 z=3qI$C@kr?j8e@DD+$er5GvMfhI-tF(;XLboX(~uNFS=`f3~Nx%a05_O)!^2?HC$o zNsPwhxBDHm{1NxG!Ie1#u+VwJY5&t}t_Jm3cc(i3Or4=hlt(_ync31_$`n z3tDCa@=f18Hm0pijXgonf8x9(?{o}S0yn#r6e#%R2MNRY4ymrOa>Oa`NO(wF-!;cD z`=iz@shEHWSueExXiYyDMVA`=*+DH)?M8m(=mof5nfQ;RbAD&Q=R~A^3_fTSXSB

O^LHN? zEIxjH5#aS~UPPajW6PxxDTVrF@?^eK5yyj^qGb4%QxhtX@ayd?6SIo|$cypa7>oVVZmczL4*MwYT) zac6A<%`RUaVotZ!*n$WV8UMyLWcku$uF zb;}e#f)1t!RQy;^cH;A3s0@p~L3p;RaA4AV(n~BWryb_QQVxwOPEyky zlRO$VKktcH?O%P&@rgj8F;4g5SuQCWkAF-(fcLtjy`|oK>T4~h>WDcqWg5Y)lfsY% zq#uP;(swKx-s6Y_G||-ePSyl#KS2nOKN5mJS^XYp!LD~S@guO>+CvX}kFP>$U^b_KpIgeMj48^zOC+FgPd z;?l1_d?8WntbS4nn@{lwIQ1c3Ujl&w&N=ikvcfetH35Dx4nx8OuDBjYqow`MoPNT= z47epuP?(e-z4@vqlk#mXX*CHKaxXiN_8W(!%}BAyd-h&RYO%WX@_C4o)H9dR zHA|huJk!~?pWvFxY*u^Om7QQzv9~3b3R{@`Lf-1_Y4=js(!B@|cizDBX{R-O;8BN; z>S(F+%K7Wg`dY4g+#$6AX7KQ?!+sk1y!z@nSHou^^Ch%J&{N|fu`k7Ob@Ek~x-LTW zCw1SRQ;(&NdIZy5?>ML@8S;WMWN%7caK_ZFg(*%MR+lR3KHrVz+(-D~-*k`n-j$!^ z?5Gh*1l3_AD5{ecmOBGNzlKHE-Q_(uzWuTq{EIo-V(|c6INq{>e=QjT%2X<}0f*%C zh6jY6h*Gijs!YF?=)0);M*kB}wrSy~LdvS$>aMB$XX4cAH?@?n>M;t?L>Qfvc5j;; zBk3%k2qu2K;oO#AFCk1ln|kjeS7;-1#R_vYO5X=l6((1DlO%2>KaUH9R((iR9Wp8L;pTzS6u9=xOdg80Y<%bU7$3!j?%=2u>SXZE4y*I|S4{o3l;CSu~%LU6|}QFq{oT^{9BvSWUoQ&aLG>DJwD3%0(u z5I6PKglrHQwMyX)Zl(Bs^)dM;F)H5R;FIU`*2KQuyzE?8&-KKB*G{E#JBc-8-U_=R zH}=FX@kvrO?~9_so2*uFG>dha=ToNckmPw3g-4Yf8Wt)<8Fjg#cPorQ47uDX^Pwgp zl`OgQEaqpxh){MVn%AC@uGSwQ-MBna=k~XigP+j*|^mE|vy)JDmHvox(++ z%1@-2*-PHU8EQ6C=2=>u0ove;pGx-X09t?flTz9O(IQi5_ZFRDz|6pICbVKY>$R$h z$2(MnfOgb!8#lihF8-B8$jC)ulUjPbX&`pdxqPwt%_Ds|aBXOz6Rw&msuru1#&Enm zXoJq3$iWQhJqrwTkf{yz>!*7@qD1nLF2xwyept>g9H`k{5f3tY%c$1Dn?asK7CPU( zqTy3E=r))d4-ow4R51$ZH;+iIc36}=VBIBPJ{$h_>xKQ+cTgaQlCM8 z^#)!~XYp0NIAeu+r5FGuMOqqu_#c_2@vSQhE1kxfVjMMaAB}ETn~*|8Nwv(XuWtBz zjK!>eCmryTvmusq@m#kgIF-=(33c?awRQ@NiRbJ+u*}kp##8t*mSc$M}0==bz0Ey!qX}r z;Rn`v;pcJ}nBQ8p8+hQO#4ZMv^s@JGU%q(P$z|MDVdcDrxyAsWbCKhgRct~J2UicX zn{d^;zzxyc!!E**n59I=CWEemmQZhoVzW1AfJ{T1C1?k>McS zJSj)+QpS?~a*3;i2_i~@OH+n|!OEFS!?L5erkjb1BMZ!%2-uNXstR_$=(gwu4pdeJ z6Bx}e2Qzhr>BLoF%I-Tc5v~ zI{y<+)AG(~`D%{yDm|~ilAbGhrtZ`zy)T#dlhEI_X$`5(N#`l-hkGRX2MhhQ~HKYsZrT? zIX}YN`LEgUMGp60Vp%t@^eoX{7iw?;5~I@Mq%*^i0W)#1=lvJ#+!sg}2kOMe>R%>8 z1Q=RGLtQnbl|JKVaB6)ajFVMMvYMOwTZ?s zN>RmKAOiy84K0KdfZ34YW1L-mtxekxJ+KZKAI;|#)k#tK!y#$y$`LI;j|8Xe=v6%F4vsk!+|wM_5RpRi zR;co2p)%Jj!O*glOqY5)I50(7?0kuF%zY|#41fEFmNZN!J)7;7J^`s|&dlTE* zm$%I17>dY7(tTd9tuYx0;J}kgN>WE1yHb+_->*^Lu&_X$pK1r}MZHlL?)?GjL$s?t zUIxWIe}_GOrifmj_g8lS07AJxV^DOe3bfudl?4LANF$-*h1kdc0C)NcY}yC}tM#P> zNh9e>2#;v?uO%cIj%YOr2WT-pd(uoOkY{(iQ-luun)C+BiKG}38&u5C74IvLRCViF zD;tMA8dwHBB80{?q=K*@^%7_%lR!9T)RK0WU5~Hv6e#y_6gcCh0MY47I16x+N=n@# zdh+V3NtmVj(f$KSNk~^x4{C5AAaT(9n!;qGn3~T{c8~|XMA$`0d(U@qNM;7WCTE$S zYglL?v;lF!wEZ-NOOX=xjhds2L|q{tFG z%_=9-I>iRGc_^6?2i~wz1fCBR=P42V>Akyp_oOokOoDs;E5sjeYdsIs-j-1NWddr2hbFa|2=Ft9U*7Dy$@go+3W93d@~KnO4)wYyhL~0ihW#`lI}X(hnwM z?@CDu1`Nk)@(_3g{;^631P}nA*tkMK+co0^NI$JCAS6ke@>9Exf`N^u1jl})*MfI< zZ|r^zYSp z8 z)Q~#QdQ=%4{*{of36Ip!2uK7IGHWPK>En*onBrRkaHBmUgKEM50CqGJ z)8-lD>AX!H+6nJLwK)RCpGsB!@Ye_1bp<#6n+PRAAp3h)qpuMiXvMOJb&Lg9^fe= zN7{_f9Vj(~BQuczpUj@UI#FaKq)~%C9hkCs;B!gmbQlTxQqY++u%GV6;YiXmwofK2 z)7!VbDQM)7IjkiiC-k6@kOIf+ULb?P;PFb3nfI@4p2U&Tfp-IC+bh1YgXs$jJSM<8j;_|x!(o=e{Qm(TCX#U~|9jTeLyult)ND>tS zvCK$=?@B=gnD1DPq{rTaSdt|2XO1SZ&>25jr31TyKT1ghkW&JHJeUBgW<_~w0R+!K zYC$0+r6K_O(n;n=s6_-othxUHt?u;y0PT1jj=#j_k8lz}0DUUH&xIl{~RBqF^Ke)S96; z@kQZsf{HadRol|h;M5$_?#WM8O>b=ElQ!8@b>PyQ3MnL~iLFKd0BU~?5;@dLbKhmT zG^V~Pyf0Ep&ZtTws9R(ZKYE9WACY;wah>Sf$wH4nD=KV}x@%Q`+LOaHr3yNUMJwS7 zO}dCz+AAmGi^DSEZ0dHx!Ge`GK?mvyp;*31y=I*(xv%WK<(c1_!*!7BlOO%;(T0+s zm^|@Xe*XaCFT<7OF_);-HtV-x#g(ifP$eV|+?k?@_?Pg|r0vx$6Yu1#kLgn0jMVCC zbCXj>&M7efaDD3=OvdWfiuk4Q!H-Ltt)0<4vavsEcGu!}!waSDPOY}&PbpVQThXoR z=v+CYXKWjK^!Kdo+<6gNz0Zm73tLvt?R}!YiAs$)J|_GvC<;2x#Q^l*B8})vS3_Ce zjhobQ#UWF;j;6Jk_?+;uz@nXNVF~JeM1LyFKN8*-C~X?X$woSatNke6gUwU-qTi}o zCdS$mzHeB7IGxMQSl++kV1*p z7C?j8DE|PJOLD=QH`J|d$r~sG%u-38uiCY@{iVDwD+&JFW5GY-3m@fKPsEpo5yrBy zJoSY~^r-GezcW(*03>XHnFd53r6dwKkG*Sy@h9P!5_Nr%kt1kP4;to=+dO3TS?2uelo6dy&n+X8!vX0(#0Q57M4f4i2<)#g z@_%Y;{?OhVB{DUhG=bNZQr^BswN$_JMcXyJ;%@o_<){uh=~=?3Za&!tVJ#$c*QIOx zx5N*J4&rV@TF)KkDFh^LAeDCFDcpaL{v0)I(`(jP-RW&IH!4RTYLb%2b1#~uTb=0H zVkRf_q^Tib`&PaG0JJZLWpVwr#sy4mB~w4Od4CZe8NvSm*Bp3{%_Q;ssc(!Fj)T(O9CjR4I_KgW!*w#^POz~~;=~7dU46@W!8~Kv#ZKU)u&wBRo6nj>`SHu^G2$|Lv zNRAAJe%&cQ_J{D)rhm28Kt#+D`$(m}KPH8%qwinYu*X?F4Pjub+ACf+@fYE{iS+8L zbw_a8&-qe6?Hl2!Fs)l^nd8>l!2XnPkI844tL{d~4bNaJ#DD@v@~w8Sh`$Vxu(_;k zS}IQDhXRsHeZ-ERT5aEn9}Am6D%N=TS3(qNZbg1_h5l>%HWR~QWFBZnl=b0QFbA!{ z07v)DQ`PY&;g;nm`(tFa1oR0~zoiS){{Rs_8CYXeZsxDF4y9`Jl&X1AKHplBk}}Uz zSBRy#VB4v0l4F`sAol)z*0V>%w}s>%{c^J%`AUcRSC7P>hC6qEY%I!8LII_|CH{9# z{{YQ@X38ujK#jchn#Yz$dEzTp{{Y&D!n7=dtgTc?k+me#pZ1{ey(tA+wSqp4tD0NU zHLIdsrj3}|PqasRU*;rqtysT`UkV#pAKNQZI{s7pQkC&T;a~%Hv$GS@L8rbVddegI zYx_2NPpD5xpn7GWEm;*z@4In-y;2?cr0}VtP`zPl6qCr>Xf`k6Z^FztyG#19k>}hk z)F~|~LJ9X2D-n`fx*X!v*Y6=}=Ns0ORXHG094E z`AJDhA-}gnRGeqTmW9o@<9O?=h3cD){za0Nx7vNGxaY;kh8S$NL+7&>Y&xKjT6Wb* zQb*X-l#z|2&Bqx}q1i<>%hF`|tgvsP(?@1;h zHcBR)PsVSCvADmMC_mr%C2>o71+UY-RMEWvAt$-|&`Y!@`&VEA^&4k+?bKGGN5ovIAplY!8?95>HsEZ$?Y?`e`NWUCxP2cNOB$ z-8_A(pYA?5JTkTlBk@;)I;|`XvF|fUPscBZ3VX>7W>)bM5Svh|pW-FdY$1jGdLKd`T+d||ePFp}R*0KKpZvOxZ!)jN}UO?;Ui2hV~ zvH2JLmXbV5#B>=DVj(q@@++R3`0Mb>@n~w$R^ZhR+{*)8F>U(?mJt>3v8-CR8oBt4!bhI6!B%iH#4zd=z4KQLt+FTmCX3x zj4KQ-82OqXC2Y;G2tPG&lq{aWAo5A5XXDQaY?N=&**{!_{{R>r$J>v+9wbU()ikuh zDbEK}fCz$XBdV21h+3rE*Qj`$O=SZiZaZ86dKqz(#OlXv}yRjUgDNpkZfhDOsceO+dc7C$86)pWM6M6z@>ketpyk_akHeK_ew(1d_z zpQUn*zs8adMdvN_i&w5awEqCRWe}u}I!Nkxq>qnwElEYjh<%pm>kU2H&-0NIz3tqR+>l%$1fj1=7Mtsb4T6rP%yy<}z@r9}99fO_3>a4;_Si zgAq%`M5EPov-)Or7%)g6L8i(8J$HR8mu~(xvX;t9E<87O)x*&bUnK;OvF4e}{BdNk zWwCkT+pKwlQ8z=>KJ>g;mP@H=qPdaOfiW}6t1=0n>s+2bJ8qE4dEXE2QiJ(aZe%O% zUbFb?y3Aw~V_~2iy1a5i8gBFzan!_8@nTfEwvoIk@^r>(6?#-&2kQN zzY9`NPC%Hc7M~u@WDBClM5gREozjcgQpeDBH2g@A{{WDp z4pMJ}u2ICyeJcS85yMZI(3UNfu)P$&Pad1O2kFvlr93m%>+u6dVs#0(O{#JX zhkS&Y*~t+-`csXmyc#sULr<)2Q#|0eM&ZX3#e2#T&mypsx=1}bQi(CmTZ7UQw2u4^ z)s+sAe@gHrTp0c9DG+&zVuXyQI9W9^7e5OFA@r0n? zI-pkaK?Bnr{*-h3L5v8KlC=a0<>Zg^sUCis>eXwIiX|k2)3?^Mw4P5&8jVMeSp;8O zOi%n&{{XEl=IrO(Knb|#(cM2VJ$cq z+qvRYe=#zk1cG9;9&g61cZqsaC1a`eE%MoM!Q>%0(tOl|z$9`({pqMA`8un*ex1^m z)X_q|)wli}YFyST)#g;I8?`bn7+6vr+sal4NFam9y+In$cdz`-!TFqn>ML>g0Ga)& zl%|sP^~-|c>zO;e+k|aey9pg)0Ew>^p(-g;>2HZl_amUGI?`MpGP6Nl+K&U>KGKuepY`zLdK+nEg=pO2snsiDJPCQc?Zopl$U) z<~!9>;Y-JDC*h7;BW0?r?R5qfY$4R4=8pE9Dg|n69u!XD{{YKdW5#cY?+sqpdU5Oy zO|30pyn54e9<(mDNnC-o3Oi43pIV00z0aX(dS04}5>dfZv()&X8}!N)i=V?agDYEh z&nC?XMe0D1r6lpQ{9MQ<^sNDr$*U2Wxv{yj7I${ec`H(SPeqiN=`;FNi|u!1rt*1r zG`>~bv9r3kHW?-yLrkG7PVJ$kjmk`@?)rfpD_>vgjHW{GBX@Ut>-RYWy5VjBt;clm zIw$msl36(}siUP_qo3&7cua-~_m-TJ&7H3)W&37#xZw%_1kZEN+P1q|hXs_uy1SfZ zlk7IHEev1Sk$3bfaWMn0Bbw$sE~2@$XXX)li+5~UcJT$kAg}VI0o;lGE3|C>B)mSm z@b5KYcaFg;P}$+q&8_eYD|X>X8x*n?6THvqM$DZ?gQn@~rwtnS7vUJ!uf6@6Lsq%v z+Z)SlMe39ry=S2fz1cty%CLIyYe?Q|cJ0#Px5peU)w+voWV^kP!#wt~=2^Ug|~4k(4J zs7l8Q;LPzePi#^-?z5q$sHxY+OGBP0>L)BwWX@vs>sQoMHQS4n3&;e7$tnYDGmg@1Ws0zmdWlU*C| z*{eK0(3*nnzY-bzV*_%O{Ek(Htw!C*3s_J}rU~GWr6m-4eHW+KDwURU&eOK=8&Bsv zHcm?8L*lHmX#OXec%t6+f%K@Y2aYn?x2}tK7_-RSsN3G8palhPkW!+f2t6n1S~uc1 zCw}Iy#iH%&M{kXjiMY72c`Iqu2Vns_PY?ui1o1T`6pdY1PgB#$!FC4Y{87KgI32fh z_@i=C-)h{`OtXz^Ka*)CLA&PC-Mz3Jl`m{=Bt!$nbN%D~QzgQs zanGi*p73f=pkgc*z<#Ly?d>6 zj%VgeSSyQ*g{4el+^}zC5AKAC0G@f7_o-ee>Wwd`G*kIZTez%lqQ(;K^@1#mC(GOd zlBU%sa3_K|G*9AFE2WjBS9xKlt+eJ@Id+CR{Y?38Ic)@y>2QM(ME42zHK6=n`OIsW zy-R19$2u~|`8S%!x>e?<%aT@-B!M0M#T!3krs`T6l`SuUyibX(+B#Z!mLIis3T5rg zg%txZr1aWmDeNAzPD>|YjmBf#xOnbD+ZKVrv?Th;o@-Y&xoq=W2f*w~vRQnatYodR zw?W1k58PY^foy`MAbZL7rLkb*dS-??o7HlBBfI<$(VidMyw(d_kRT4An)ewBz#j?>4A)E~Et|L=q-qM?Jr#D8>)i`Mk8Smbuj~Q)fsu zrE&T{J(0v^aSdd(9j(gPRkLrD+Jr#ZqGPE%fFOW*ir!kf&nw_m-%@xgZ^mI8O#SpKe6gG3m`kn!@TV4dzDv*CT6|aXB07cvH%`-cmL#Gr3_Yk-?5W zmAZU()mECPPiahc7S78BYOI2+u3cN|Ls!Tt{tBULFjMOs@;L*JDk>{DJNi0yo|^Fp zn-j$S4WacuHT!#fMl(xh1-G216z1j&Wh8~6eFr`N0F`lCbu(;~mu*pShTJUgBlt=n zkrFzC6ZWEhG-Psk#?F?=>K5|H7`BwcY@ycnDG*y*lRlW>bmFy(PA=oiwn>C7Ns-!n z82eSKD+kZI&YBX`ZA%8nz-Ham8Jl|xTUmUlkcL}I!k|b@cKh-LY?Ns+r>+p?)|;}) zJqcwNPkE{@IJHE`DTp1%6{0k~-cLwlFY`9nsmA1k3U!dKTqshA8+htMN#?u10k6Cz z%=jT_i>z{gwT@}uoEd=mQ;EAnWkEtzR3Shfk=lh)XHC<3UY@GGODxxVJsuk8vsYSk zQ0d&Ri_bDrrkuuqzM;ZN8$wnL4xM=CtpxGELf-gmduMfRd1Zh=bpx&+03|?+~8Sxw|b@k-f0buIA0#2T;?VYtAhC&{hvfASda?Qv7B3fYhEN z{wB?|W;4oPV+zj<35zp3|gnJR{-9DI6oN`qh)a~24goc_>K?8bQ3JXv_ zm-VgDq!p`mcgp1KZmjg46e>~j45eyO2dN|yvD$i9E2iyt1;CXdv@s5nw*qEP(ggM5 zw!eVhDWe6h92sq5_M63gGaGNT;9 zBbqVsN8`hOB5G_EzB?yt@;0ox+wJ3SJoc2J;R#a6>ZmjQD@Cj@&B{@1>aJLAWl3zL zhQT076Yu_1)Kfv!^z=RJ9HV7mb)|rHi)V{AN_k33E*$8EM2Y$n$Lm+`3Nf$ijN)u< zF;=+;UAJoG#Xgu~+;U}V9LfIx2qZdc%^-tFM$L@3{tFzU*Ud=1R>x@O6+J?bmn-nt9 z9Uv%!9EkN*HuJ`fQ1%Eht1a<4yim6DFPj!^H*su$t$|)@ISU8WCxR+t{{Rq{=fW$t z8`ccHb!~2j8^fVV^PWNg+*DMaHx7QBjQ<^og7Qeq?! zK=%4nd^V1sS)`>yYItRl?+|Qk^3J-#8pzp|6tcUY^k8!0lSqPp;u^JQ^rUiBtgrGupNRA`x`Rw(*+wTFjK;TSo#|E8khyu-leua< zPdxzocBXPZEn8~~<72F_mey|M$}L;eT7KWieUeNht*(kp^^R&M!_UNSB|tlls;2h+HTg>n=MNF%YKT6*Qo z?poU)j*WPL*?nbJ+RBdSzDXyfyN5){O9j51{cD+1+VvX_V9#C(N6{E^VtKC`>2l0VX=dbWe+45?DO;j5sE|LBM9yns(WRF4zRR$tpXX zDcTBB2HrZ3X{fCBK9{8Fx;m@y+*bs@i5~-Weu%&;RA^k|mNrVaP3m#^IB^#(6oqa? zi5wV@aTUuCYU^9aU3u0SDcTfLgoMHN6?pOAC7iXry}HM*Ak~|W+1spnib7;?M+fguV)i&Lub`!B6kxb!z|$EUeC5&( zL9tT%AWx=~`_(RCeXRc5PivskF|f)LDE5{*}!(yjuu-<*Z%uon-(> zTJ6jLl#;01?OHEX>fge31?_`*L!7i>@V2g2Idl|)3WRm!54_QBMdBr!DjSg@_w>u^t+w$ZsvAV%c@)R1HMt^47tIW0q@SCX>1wbHm}Qwzx5GKcT)Rotm+ z;UJO1K(0V-^Kp2FywKVnUe_Em=uC~uKR_zyVd7oxnDG-#KV_)eYReaN(vY&za@`V6 z_ZErdbI%nmg!(>$n&PJ=oSg;Y2Z-9=1BkkB8R8Z8UeV#GS%p&%tZf~ZmTZ6IwU-83kk&s5V>vElYW z_cc=O-f_m2aFnRYA;kqKbJh)Q-wteX*T}I|m7}*hp53(GU)^O;w{7w1-3SS9pEQ}^ zA9~TBgWNlXa`ZOhm}MK(=R|?;HF)r|#TT?bA3Eb1cCBx6X=xsqTY)K&D3jOsr?E4Y z={icCj>#7NsI=8C^s z@)^Zk+T&jzHIBV=a$IDRKZiV+>pgj(z6<xOf1k+Q2QI_#>1D9m9huywk~#t+qVbfHJDpt=PK>37UbXLu zwpoo!Ym&xe#x19;!kn~H_cr3zqN54unGwg$ex>hLR+n zdJ)nDO;hi3&tKdo%ok0Cxhg|PXeDHFvPXX3YAfNM0gU##7B~5JaJYvUA>6g#CALVF z0B5R?0x9gt!0GgLYIRtdy0pvLCYf&|hEK~oxH8?}l!sL52}v*%lgyr=cZxReiQX$| zT;mw~`}8ix`9KHrc+lH6o_jYvXo(IgU(dJre|6{j*DD_-5Kul^&UAoTUg*rZso16aH!sw9YIQ;g?hH32i3?QrD~UM(`wOh5}#!#as>DN zDrse$Cs5Ky##MVA72%FAC8@HPHf=86`Artyb0DHr%PQMGQc=iXS(C+V2Q=;FrLE1| z8GEJw01)|&TC|vXL0+_PN_Y{+q>i=Bwp!^LV?t!@taC0Z_anpJQ)@|N0#Bs$CujrS zw{OG$0K~?R!+23=i_K~_wC-lk&XC*yi{cj9d3t3r>?&Zq*1kB ziA%R$QxSH`?UiQuHY+5kC?C#}o}xP+-l>-wz1G-q)E3-Ol0s5>`-%~-wGJmguXP4x zte4^z&g338o=7AuvmqoNIO#%|x(&6z%L`mgOhrvWVB`9pl9zsPbgp{)58*DJ(>d)s zomQaAWi8b4x#c8TY$STyDu>tDNPlg#QIqZu5lW&2D$mBN<((vW%% zoDQFAH1nKt}#(qX7SWGO>N*mk*e|6*Y#h{iEW>th z18~DlskY!Cq&c-j%82TER)EOdv-7Ph9C9hLkKv;Ia-k!b<{*(YS1r-(SJkxiD&(Q; zUv72wKsXR?6kC84lqvx}h%!(3RH)$9dqddayh+Vo>3i1> ziPrY=S}gL_=}Nsx*m(<29F7PacNMSv8ThHf_(h;B@ebrJoWFD_7ig93VMNaKZQ?tg z=Bam?`(|@1)b_WR7x{Etx&_MA18WQ1L#Q(+f<$(u7^eFj7OP99wx_vvHaCh+-}rlx zU6M5gwr%#nOUr4Lg`r2Cs{?>|;woQ+z9m^HyoJlUdeb?X`I4Jt5pIIQjQe$~aQ z{mYz*DGiVBr)sxu0t|cBh4BvUm;6b^Tey+(rA?)eG4!PhZ6RSx-Vdat!TX4bfPkfdO7Yf^#HrP+0MkIhS>iw*^sPsbyuQ=fB_-Dv zW4Q%v`K3r}lL`cxC!f}8se;O{67rt%4ax&$B|EnAL~G%( z^gEi*EVo=L{{VAAH;+FGZ+xmyndu(&vGINq-D@#;&YHz!GO4y!)jx)CjjBBXP(8;n zTn`5)yfzc#b&hS1*Mxh};i^z8&OoI*(Uh>GkBV*7$cG z!k=5L?Af(Z`Dd8+rL}w=cAH11t_rmkfX)`{DS`1V&kyyJ2`xTW+pEbm6LD$+N{~{t zncS{8Gg`AVt8a1nyW1Np^Koxz`kQUo60j6t$Q;oR5IkeRXS_zqY8)n?eRl3GE!o{Z z@of1iY$Pd3f=Y=JW~mFsURW`0khmYhzDaqXT$q!=_Nk~R>~eiuO-yC^W!p-4t7oO} zFE29K@5gfGC~p|cs0Q7a6i8CmpYKG770~VI>pMJEwqsPT-#dMMv9z1scBw`~O*Q@B zXcfo!Jwc3bIcafmk5&4tuNrm6HwaQh@%5EQ6>iraB&ylwO7V{4Z!R(oU5AwVi^*Xw z0(`J|Oh@t*{4|e$rqf+D#|d(8UmE@%F51MqnYz+hZ7=c-rr}CuwFUt9S3Z**4&aLC zmwZCJ{twM$Zd_~;4XJ4>LPUWv(}=Et@jv6Wjc4I?{)55WKX$v_p;-%?mAi3rk;=l7 zsVFhuf%L9WylUF;yyd<%R%%Mbl{i+Yh#>LrOKGF1!l_i^kZ$W!Upm91=3QF}{vbeb z!4uDV>8sBg@?JG%@OVs9*P4F`V~ieUhCG{KR+NuY-0mi8k{b>SZ!ErxX4H16*93%* zatB|vZQl>|ewV=Mtx<1mmvXv}@q{;PaHY#-l|U$u?w?6K^T?wZXN}SH@KKY&x3o8h zxZfDH9rl&N-{CHA?b-^scK-GXd4aWNO4UE%t!?ABfYd(^xtlyrTO`HUbtEC%ONBZX zBaos`AE#QUXn!AY8VkfXbC(z;V{QYg54~>w=f`BJv=IYn0tbF*w~jtM;rwUH<8n55 zo9mWXw^AFs$*3X694aS%)bZTVqs!p;HB{3&Uhd^9`(1kKxw&)MB&tGa=9%#>`$Ic; z?V}DHzCodA#p+T4w?dWbS3PHn*Xwi2LX@E??oAMXTOk^Y9dUbNGHJF$L8~yZhKp&R zN{Hl=dFS<`2Opu+#@q7!j?B@z4^L>lIxd;CMrQ3u4_#io*m-MM{KuXW2R~XLsJto3 zYimVivDiERxT2Jvc@^lL!fOYk z^HvZbeJMl%G?goe0Lb^IERixGn+N?xK7s+Jv5kaUpd`o%1N5gdp1TWx2dK7xr89|C zShN8qQaXxeXZob=kO80Cy-G-wa(M4vq-xFp+HVtRt1HIbv$s+gcIwIUQ_riV6;_?c zEdK!PY$y+Q(tpaK=^sux@JIz$Zy6kj+-UTj-3;{NgDn+9XJA6K)-6O$g{dL{DnU%1ds8p)VekezTM^0pHq)N4&;Zg-mBercGT8uf z2xw7&2YSkgh@&KY3jP3!(io=!{{V4gp8I(;fur$FsBN)q4`DI=Xy{k88fcBXxqqQQW#3&GK&;bx(N(7JIvt(2?PDv#~epQkO z{v~yzaA10V^vqOITZ{Djvy=Wlbj^k<;rT1Hwk<4Xtz?B2c3gF@p16M#GM*RaF}ciI z68+VyggTdsq1IJ0-yMveV~YAi{?JKRfB;AUW^HG8Pw!XGY$b-B$Y-ssbv{Dl6@_@I zFJ0QT<~W1e2eJPED#c`XO*4qs-t>J@cwXo&oADac#G8#lon_}Ss>qgGxw3u4ET?J+ zAOpgOvFlpE>&NwCehRE6yuS;XGQ5=4i&~1DaGp$`NcyXyLHARzcmlmv+`(oK6 zfPcEF_pKtV7Dq_rb6RfchVl0n&x?D@cF0ik6aN4=da`lwAUAvUa z+&Oqc9lLd~(~dNRw1og5arU9v7gu9s-KG7i8o8e~)k^_wI01r^w3+MFS6+M|cqgW{ zrYipcRBCG<#w~3wzE0a7>x4772~ySsPf-GDXU6A%8aE4}?6sbg#-|B$ZFb$Q-ZhmH z%gJ^?QW8(4K!GvTS2G^2rFVmlPO1JGrU_e?<=-b4V{`cYb1yfMWh%UGbXo+fyF*N1xZH>RJ+ zD(O~BNM_--geeLVkiL*WiHfY-MsR)i2ai3t=%6$9eu$X3&}=5w7yr zcm zy+yinHJlo^PHJ}WS!V7mQk#{s+49n*7(&E=vP2%FnD0|`7LL5u+M>q=jW+hzSFWh} zmkZe2X_->F_LIk2fu=O|kK?$!b=~@GtS)ZbV(sLD3rH%389o01rEk9$yfg6b>qY9E zmVs*G(;=hZWvi=!a#r2zYYTi~@=loZ(sQh2>&i??x{{RqNz+c`q zc>8Uo=5H<1q&E5%1c5!l6{)oa`_5e@0c%B=JSDC+p5*)2b71s_rSTubM+b-r#oTD- zaOGIs!WMyY!;PoVrK)C6B0iPIFX^jmm@MB1LME-=acUjur=5yMEC-_S(GjZgu!gx!Y0qONKG$o!4`mJ--CtNs2yvTey zYnMDRZ(9s)yO?*FHwj@kAMYiY&kUY-V?%7RV5#-1aC{PdKCTA_Mil$D3t&QL08`ousF+{-aV|MAAb-oTKTsbK}t~8 z@wlm7giwoheMS~V#<$#uhQr=wTr5~yJ%4dO@NH4OQSTKZ(H zjjkmmrCmR2>D_OV(>53^?zQmi5&e_O>5PMT^gWL$Q+Mnt08-F+BC6gn3_p#!2FJvQ z?OeoaEO<^oHD6>-!(2OT#?vB>b(OBwr^j>g=<(xtojYdz+T-?$zcz zE#6WPwI1N6I??YB?(cA^e)lS%=xC+k=cJP6(n?#A%%5{gzR=i0{{We8=52=n3Q|_W zPpjTiWK@f6W-*YYzjK{>NZf>5gZjZd#Za2h2SGlo2Omm#8Mt=iFOj;tS_jNtJGeC5 zl2on&N55fPAH^?*?RDXHiLupLOFKs_ikop})$Q(CxOqT%F~B_}d)D^T-V*p*f2DBv zOjauA`*7YNI)SX)cM?3rLGqkT@iEi2Y>g_Hd|A#XR^V+DlG7QxA&=D>e){Do@|**2 zni8YZJ-Uk33X?~JT~by%CCff{-)fd_@sBrho10sf!cDujODS;&cc~>)`FSUZs5ahP z_X)ab{I*4#LJN%DFU(*}fMA&%l4{%HXNTCl2CdKI@y=W?8)tm;EUm;C2ujFE4h|Q` z^s4?o$XQw3vcr3vb!l3k^2(h^1AqwV54BM6o)2gKO-3#<&P3xB`cZJLilpRF}iahb*J>6V(AyS%+56V=njq-YU~1F$EJSO zI74yd*Eemlw#T2?;9RB6uAj{1F>KvAlfyFmjWGHWTT|!?AQ8GsRX(5(y#PyAPTpL3 z7f&?9i!K)3b7@IF;6VL4b6qp>XWXha z{icCoD|PFpFJ8Lj2A621r?e}R)|b=4=&gKV=(E4V>0M}9QqnlX$_#DZW};} z=eeo&tY2rYtgM-7+qa5hFr62CN4}NEZ$eQn8 zh}{K@*ZMNX!ox*pt{YPaDP^gZaFsJ|wfdYxsy!kjY3gDtg7R7)5pd~wwC5$l1bm

OYMGF z+n*qwNk_5z(EK)zO@;bNv&b~uerGMoaQ&-xcm<+#R-*AH&mXQ@zO~ct*}RhV#IS(* z03ekPk;xxgf?0S+pRBvbvu%Fmbv_Df7d$Sw@dRN~G~Ju1JMN4)>L>mxTO*VLM4Hx^ zT$Uj>H&!{MD%Ec(OBW2UY6y-Xb|Z+c-op(~r+jO3!_8fh$!a|@mdCkaYTL+5RxVrZ zK2wP)F}sL8=0T?% z2HNGef%SQfC~Y5dD(Q%_#pAIHWvgt3)%t-2NVXdj`_sy6g8fdWJ6^|@70~(*QESWO zVzk~V+_mDA1Fg28pDiT*WfRbSdQ~G_X?%{5)R}C3>kG%^?H(+?*Rqm(k=Ty)^asIx zGvQ8}x5nzNEqJSpE!Bf~olMHE6dkvDL=?QU!jLygRkx0vs;Tis;TDxni_2$N((Yle zao5SWx43fXk&|V~g(bxkxb!^J@UXID(#7eqV(xIZXE}(!yHfGj*O*qHKsOlWtcK9% zeS~!e0sU$HH;}QmwSA^Tm$z>#XnB5?+fTUeO=BbB^TqPEn+=2g)jWa+KYBl=G}VSB zw%*E>wP0NcH!P?)8doq>2QgIfgVeuS7Y|2ph8EGQr`Wamq+?xl?M2IpQj(Q+ouHn2 zOd7R#rQz1Dz&VCzP!Eq^>r06p77Bn#_U5O|3Pco-U}z2<3Tr29>bKlN!76iX zBz<_~Rp-RbG~K4F&ErtDI;#ukt%IaVT2QhQXYEysJSwf+3REa3fI*sAXy{|qVYTPE zx4bX#^DprMsqHXW7VRx^O%_ITPsp* zu_{Z}?w|v?N>En@I}tUg{4&)S+CN-j@|f(c#vSIa5{GYXR|-Q!fWM&;@9kZIrhG-z z7(a+zGkclVF6tc>khOH$GqyTH0N| zYTemO&o+H24ZyWw2esY>`aZ(5T!Z@L=uLr44wL(4} zp2eq5sib&v<<-5Vs-0EXW#^RXQ`Y=M4*sq_ooN`m7qV9@+1awYi~ENX(>Cq$rxbVq zQZSZUa}|%d^Rk&0T)cpQEbW3?PzFZr#!MRD{s!s)01owbhsa{^_ZJqvC$Vbyl^fp=@2Sn4j@)J$i8!-C8X-o;PU$p|w7i%IX|_i|$&xsP5Yh zTw~qj@}hdDiH_C7`pZY*?6cRlR+(i!h8xRNk?sU-8(K<`|cr$mVpvb zB4!CcYMY8nB(&{NvilnCTAJ0{n~TKVf4n{vg{ZWY9f!A1-|tS_Wn0O*%S<$enr$E` z_1s5OP+suj_TAm$&i&@6g^O1|p%r7qXL)gro!kJNS)l=8%DvYd}FVrOrLH8|s zGfUs7-S7Et1!1NIGlpVmvHGyjP5-_=tT6bYn{zt{6p~XH>I_~ z%OgyilyX$k@qWNeXjlKfz9I!V6_W9(8 zt=tD_2~v9*=C)fJPSV#Yi}2??fBl!%x?m>b4VQN05c>rFUBU-$p4FldPnLM94#_)b z?r__=gQNi7Kq0@|%HXvIAxeLDmWWozSy=R|liP{{*ukR3$5yFuC;-W9sYmNI(7zb= z7#y#PFPwYKTwkWuk&#`LEtef2%9HGU=jmMj#+0>b=G<*d0RCxDmCk#dg-;C1iw%LdYb0{*zk=Lg0w?qPAY9v81 z!Rb+SMn@B%^#(I2_9+^l7TSv4VZsyUs16dKL;w$N_1E}qVWxaXde>O!%dBE^R+a_K zj*Po$DGwniDN<6cvXunLv>!Trst*g@THi zx=fif*+bf?x4NSpmBCoqWtdB!horW`(2y3P*eLxgy1ZV?Xzge4t#OoIFAsreC_9L; zx4H9f+kbfqN~fVb@Co83xM1n5d#;r(-A^pW*-;$QloDsT4P8{hLVSbq8Oslsy0^E+ zm+qcV@a}@4Ovgd?_p25j-CKO0HKZv}g*^P0m?yfFCupad(rCq7sck!NxDXs^heDLu z_E4^q_;&HHL*sNk_lBCk6>WvYWSMl_=eGqo>!k2cra^Gc)N{{Rp={@YA=t(>&Nrx&O! z?k$>K(w5%qblw3AS^(qjDpRRN8uZskNbii%%$1_Si;z-I8v^vCOAwEPqkE9#W*ev!)Q&ioKaW|CtysO^nuV- z!$4|HPoZ@pGCES>OlHe2Hib6Gbz4s=FnV$?zv-wm9VKMii9}xOR*A3!kLn(wxF<8r+cCr>sG=P@8rKFf2 zS?ybAQRML-6L3;x$eq7w0QCw3~atg!<5;IO`;Ltx>FXEtiOX7wG$8jlFYF z;8JZa?vjNT!yN3~p~tsht!>)2nDo^2^dTjojeS{{WR{;cPS%h=8dP`G}TxD&UUdJvNQcGc7;Zq0gT?OE$!Umbv zS_=C)tGq!vS5UIIQ}`>*p#`v++a*R-xCxZ>p+_f#w7R`TyW);j(^i&^>g-U|iF*G4 z3Wt!Jn|9pVr&wD=h4}3(v@K-;k zwYGs9h_aU>$TEDN-v?aHR-`Wd%8+_&&caK;Aq+Yhx;*&gXJn>jc%Q24mH!Uu$oLnj(o>LJ$`Qo`#{{TdqvdN(1xE#fT7MWo2_U&TR)pnXWt}UG3o7I|g z@as!Enncv+$ram}ANF$i zV&;=ZcRQ&wY})xn;$KruDX+Q1r$9oyr34=H=}D>_ z5!3C|_-#cjoSkWfyt-rY3#U`(T$15&!|HKI`^0@~>3_mDS=Rgo((Siq^XWq?Np&Cu zm|3o3_=fm)(b^{!Wp&}ov)Y2~#Fajm5T&-ue_u%F`d3r@88G8t587R&pryp6(5BBD ze~6*YQ@0i)oax$4MLOF&PVIL#=*-*&fUJA}08dQ*^rdF5PvytlD0`(eShw5x(t==m zYhl+atowk<&RwKH$6TH!HV^ftm7cj+6OOu*{{SHW09rT@LZBytE8bc}NR#xY9vz=? zT))fRF2?CUA#fqH>QDop-kQYbUt-muY@S*|1d-mX83ZI_?ujKJw6ER`M!_^yV#y>G z6azt>)jt(2#8I1hU;aY$`|%a(HW?p6E7Tf%D?Z{5lR{UDSV}e^T|Nl+JItCnB?JWX z$9f5(!A==Kk~dtwKqt4Dd(qgAPihNj{WM}okZB}s<_Yaf-2ihxdcao)X_M{Rg7E=;XS_^7aH6BP5l&8pO1MYoBf1Mag`tiqNY5N&8{{Tz=PG$c9Xga_A zKma%j%-czy`m2JxF2w3fopWVzr!Y3T?1KzG`*!!p+{p<{ll4&I2iCj4{h`WG@EXX1 zKpES8-)*a|3DDjpXS^lU?P?4Qto+k$t+K_)Drsp{Zr~9Ifyk;eiJvm-l8kzsT>D_& z)>t1CyhyXhD<$GqJHzYTy}OQC;4Rwub(Dz!K!eGyU3(RKrnN?651wtt^6WacZoJj* zQG6K-QjaAjW_^gQg{i(JH3qBkJ5K97_8S#>ae@j%HjD)!E)ygvN;AkXMQd$ot1=qz zT4ps4L^RdrPT;=c8l8yZ5|KW@4r@iYvN$BQYPm+*`=)K*1blkV_$1}^s~G0=5^ur(Eb3;)k^GKDDOo^Ea)x zu}>=DumD0jS`l(VPROx~v*kD_V6 z7Cl^Jr-Xe^g2&+>gj)XqSZc=d`X=A-#aOw$IfXstG?ftq1rg8Gb6ruWbnnD+G}-(= zBc*crW?SiQ+D+#G{z9MuSI|@+93Rx$J$OwGplz3quxYk!&~20aS6p8SNI$3~{c885 zJ{o*Lz+)}1?|ejz`cfSEMTI!h9RC0cmC*g-v)8EC&+{sNlh>C>(ZVfU-uLc&;ndCM zRj6{qQ6lVW18}2$FM&(GZ+Qo&)7mOSZhX?3H(1+t6|o`Ggb-ax;3_5o;&}G1u=wQC zcKVA&>2DHKY>Qm#ZvOxW$t9D+!)mq?NRm>dC`s)e)yNi$7MF-|Z2ZC$b}5obE)L)k z$UfE3X|)m5!+v=_Rn@w5v^u#_7nJ!%==f;RT9WfsYAc;LrSQ7S;>O7fWqC(}TWl#t z3IX7#$A4p6b69B)8*|!T?!@a{E}qJzg7S2JAf>02h$N&D$S0qrXbc9c&G=cSwFRD* zYVQkcnnD|L?d7OE*3wSoE&%Bwq39nNvU(?6WHnvwulAc!Tw8fI_gN>@RKmF%pmp@X zj>3KG)P$nqSCvg_5=~^*Yqu?Vh;<4}iBU?>;PnLpcLjZBx1YmDi<&>eO)svQ)i_n= zS<5Aq+t?NZh`4~M9Pz=9O=*#G?n@x+w@wAWc>0`mU_esVqE8)!nnPjCmPwYBnQ=-C zHlD+nNFLQ%c;y~tcDm%;c_wO&NpYUbWS(UT#A2?VE;oj@d0#HVdn6`c{@rK~luU92 z@F>OgqS~|u;>p~5=~-;F;pE4Er9@)wR;@mtC6}9U1gp(NsQ?+29>nye-;rihmLx`C zhAx>?o08a2-WrY3-afTz(pju-16tr+ONz|eF_U89clS&by3#_#z#Nb{{pfY$7L8ln zmU6b)6fbLyG=>UR!e@|AW6VcADg}zuX6kN~pD_(6e+a5P!#|Y!168M&lK3}U!P6fS zo-^tFQ>ZO2v`vMk4)<}mYgO2xK7GUCB`RfPas(0A>0HS8xVm!Y?e|x8aO$_*KJxc1 zYAWj|lg&s=)``4AEHUE7%`5Xwx0+n$B4pG>ZQ3Gt0m&w0`_!ITwHHdq`x05Qv0EfP za`G;K3QK5batJfj&j*7|Ti-szZ?@BpB`&sF+LaW-WFDQ&59dy=CwLe|m|IJ2AOw)w zN`ULME+#&dLgwvO*t8`Vc=s(HOgUms>z3V)RnvjMgE2`IMQ5?IdM~OrpuB+*BN}dc>3vYe?l~%VYS!N0Gy-6*6b};+ zNfA{-7)A^Tl5buuc?-A5vPx8w6C`pZaaUgtek1L1c{Xfv z`d1r{cIDNr*VVl^=TIeE94Sy#_N`8wvs+YGi@0;lDJ3pkfOe#b>(5A_ndLQ-X6=UT z%PgoBp)NhX6bDo9$Q5+GQNe5>1oMP$Zx}pa$LgnXh|^fyCYrTPv&ePqDN~7YQdAVA zxwr!#tp@Oa$Gd$BZq=N?;5BubC{r!vY(kt^CKa{xfe<-`16l`6YFF^L>^dGocDd+6 z`AAnVK=+!qK0MG)(4?+P_9#Z?NwJ=iosR1*EZauzoVvpBefQX*4k%5YfUMH zI0R%_xn}ay5TMyY+araJoO8`Sllg0dX3gW)&0~sXu;-M5vop|zC$F_h$6d2-E>~%lLA_-@WBB(OAr2-W zjs46XpIWw9i{Sb0wRl>IczuZ)yI*R3f0J(`sI!+jOSan$wzVr_TTgJ5r-42F=v&Ci zGK4I@c81;I5Vd-~)cxx=$+K%IX2bsgBwzBBm866;uq93I=uCZS{N2T#DW`2ME^-SO zDMiAW$RM^`>ZI)lsDe2h5CvB9`N8J+cD`B%{Ju#H2bBHdTP8OtO8}p}7tq?DFQm1W zD?f{Q$1)ZVrR27yDM@q#$`u^J6%PLM9ctUCv%knX<;qd#TVAKq)N(eS{LCL}i;ujq zSDw?kmvJjlN}9O0PUADsj<9}|li(CAgw_p*;vbIsn^rNM!&zKEgwnY?pO|wK)S+ey zz*khHs1vk%pL*8z*0;ASOBT-D6@P)XDDU@4h#0$(T7b%3atb;3BF5K)CMC~f+ z+O~eE_-4)Me-7?74nsB^w@7K*wsA5p@$x+hbqAoS(Eek z*Q~4$OK2po^^?U&Y1;)Lw&rs#l&jK0Q7KUNBXu@P@^|mtKW}w*pn&3#1Ulg0On#DS z>x^BimZ`aF{@TZSHybO(l)jVuK?kv@CbCr*KVx&_{7c4aF95X_joWvZS)B^gSD0+l zoGmzlw?a~ti94W;1+H2uRW@c#hC z6t=!wv9dr}{H{&UAP)Riv2j65N)nI~2T18&h7*cAE}vSRUbT?t_NM;fO7lo^Ozia( z{i18i)R!$gy|$3n<2(ZZ{W+lvO4U1$sH%A4l!Zu%+>zF3NglG&)ApMOO?d07w6e15 z$32c|8CC_g<4dqhiMU9fRVS16rnL`_de>Cx`wc&s$+eNgSrnEnUbg`#DG;9g$7!k} zHmN`-kURTU6!1UXB=@O%55TSQfSAgyX^)l1NHZePf2}UlQr+1p^svQ)D0ROn*tJY8 zKT$D4e=CH@<~XNL#W%ExgV(vJY>OJxQoBSukMRRDid}%PU7JG1@pW&y*LZ2bWE9Ec z?N;n(#Qy+^_@u2vWj;eY|!Ob7x5dz#hdfZBi(L5QZ8y)Jd0YQ@69 zEj>%LLf3kZ_Vv}S;l>_QiYsw`SE*|xl1V=EOt+uBwE#BFp#pz3x>Y@Bd$6Ij0#9$P zWI&R#cpWCIamf!YPII&%y-#@R04THy=u|C|AbWArjUN>?3z}i=Kl2u+61#zLt7TcB zfZ!1+GawK-imJ9kq6rB+o+gx12!w%6M3PMcZ&=#h+pI0O*~YS!Aw#-I=~Y6opi)p0 zp3zPxauy6FDLhBl-kM1Q)777)8#SMaPZFAQDdlRXm>13m-)R=jgu1Q)DuLVp54=@b zpAvJTtJ1q`?QtG5q49pqZNbAfYF;*!Zn#yfxCVF*@Cx zW6n3RO0d(8B0=n9tq8u#SY3;iKdUX8dBpl|&H>gIh0iJrOc_64dIP6*Caupt&4w#8 ze|LK0Wx&m{!BGhkq6cUdXt%NP5MeHJ`5WxcKTlh!D1Q3sDNx*aNJ11nM3L9(D+7MV zA&E(692NC2%G(NGiMI#`{5JP|iglY-R04;I_ltq~MWxLC)pEu=l)TdE%r7;rP86+8 zjDj%8RkrcfA!F?n)*|aMoP4*7zSoy(kP;ikAd~x6ciht&Y{KA1oYlEKFx{IN-xY5e zwrb#977c~LLf71{+!zulc3U-<$YpOYaeB_OF_KHCb~%r&ijM8`Vwj^!bX)@7eVOzuK~`6Pi`3Zn4)H9KC|l zR*Q>kwI~$#Do)@*5z?fj`xNeqj@vQlwZ=;F z+S=bJynWr!Q7o#&pzLlq+*8&_;(4XvF!uRJT5A69D{!aY@*Ac)`ECatLw0Kb=|h-@|UX)VRm) zEU=G*Zd9kOU$`E65IPXn={)_a`+M+vsPR^o1??fJt{uB+DoM7zYl1|OK>VlZdQ@dL z`<5*&ll3SwPhDu8K;tS)T07*fRkzN#MaoK?kD*ivJn>df4!k?mcr8_q$z?Pk)R?3d zCHn`i8il1vi4w2OCPdIpQ=>6>E3cEe#_9}J@GC+WkZ~(zOGoBJiWQ4$*4c(x{0ZEs zeJU0&!Vf;VSxn=2$WsQ;*b9H8bZXG9sw4Ulzl6u#V)HOFL#)^B$ z>H02;y?d3n{V3(7d<<~&pyJ!IL0gn4?;xpkxQ}}yetzV+GmR~5FM+3KP+&Zs4u|J(89!Juz zH_zSpoj&HbINC1tLZvRX>y~6jylG8 z^{#O~8Gm3{$y>94DJ^bG5dOksqi`|wn4W8+{u;bSy3t<_HrTb}ES$H_=3ZgP)X4Kn zL!c{hBm5!(?f0%QQ41SUAQ9B|u8Z))P&24J62@Si)YiD{&9-Ihjn5`sEQQEY6CC#a ztE=AJKhec>X(-;~H`v+!GwAIDi_lr^L5Rn`yxWUy1gT)RxTs0m1aLl-Kf(_bFuoo5 zWpSBr2+nIgcFU|SO@h|J2hyPhJPxJIf-J#@s%k}^V9SVZ5 zQaAvBD@SU7g)bN{u%g1tU7L#r$tbr|i)9MtAaVDsmBz&K+1sUBTp)Ij)T+rREswN# z<1F31a_OsdIAKJQyPi0iG4-O$ynf}Yri+2?tS{23CwF1E9w)h}8VBK{UEysQwa8ny zk$Ibis#sW3))mn}^!+BS2=FsmTBhi;g(_{yE-h|^kLUcW&{B>HHoUwWU*U7{OTP_O zdu4L|10ZsD45^G|!rN>FgpNe>?Eq$ z$v+Vv5xJcip1m#%zCp`pK1uI4Dzt^EDJODcsDeLg>lCu9hRP(NN7@hbu21-n_;=NM z`%pUW1y)ZmyQJLt&nzWL^g&7Y=A{;s%M4{22IJ!Wh7{9h1D<_b0{phKPQrei9=ue% z$HfbJxA4q$&I>Veg0!Ht{$XlC3n3saJ^KFuD(#;EGPHy>uwldfUoU{{Xf(rQ*E@nmP?!4ARdNAEjI2aY8FHj%9HIt zuxq~^H9mhG;od_#m(;ndq~cpIrMr8e+Q~kd5gmp7L7_UN}>51PFuqVn`?HS1${64nJ67 z+SPiQ_wRD5R?&HLlyE5sJZ%IK#Ezd@;pKcr=5BN~o*BIlk~a*jt;fn15~V1~jwiKe z!|YDH@v~FoaBSM;?Xj&m67|EVc^3AKi6#MnRUCfPRJAPf%XYymq~QDlyi!iM?;s8!2)OdQ~UyP{V!L-0~09n!jCLS>9VYt1>9J7S5@A zQrHR`4;&`855eQgUxAoi%G}_7;1e_d0K7eGPk4>uU51X+Sr;!{*rlOtHqrpzT2>x`^Wh&-PE_%=eYt-zuxj&j4R|@IUqG5;olM~lq9CWF7 zvGUIa07k_V?b4#)oC?P>Kp^ZK8Vry1m+%opZ6I-8q@h5`A_?nWpx2Tnj0yY&wEza^ zT_6tM#8(t(NlzfqO(u8XZPb({C@NXt{{YNr+;Bgo1yn!FLP|n;;12bK9#sRs?M?&4 zPa~5^B%XW33JdZi0+|Dtr4zVE0H10}1P`SoCu(`1JBuqg7za#A@^_u>sU)(q6ar1En|`#>Ek@J8LUv(=bt0?bdLUF(Dy!6U@IL5{*{j0<=h z=Tf;<-a$_^uoFE0~Z9DGp^4nf8GbO}Fr~tZoX> z-d9ScbG0c}SbC3W;<{5u_*s9hE}y<^IxVbSHoj`xN>g*xMq3H0vAZ$_ zlm+Y^Rp}wO+dan8IIAtv@7T9_^K9ZvAgC?jv;*}u^FP7gihWDrUM*G@uOlH~l|n3^ z-3!n<_%_oP*o>+*rf(L_ z;%_&n9*oOqHkV~8_3d!albbzEdq!OVZ*Q2J>Jw1C@bDq;`;nX$qy{L_hM$ugyMGxVf3v?25>I%nbAQ(|vz-*?1Y+@lv(cLvmu%P86i4t7ZeQa$Tg6&8ty zLX*>W?mpC@{{Wzn06#%7OKLrZqM?6^?So@xa+(Ft19avq6vL?3%E`HPmA`h`Uurw@m^&tz|Lw-$-Ev_|#9(*;mDAa|)_2c4d8-@#hWhx)eeB@H+I0Xy`gTTDO9^m%X*iqTMzwikjjO!@Dqer=aM^AT!vcC;M~Li z05IBuyte{2jmM<^z3SzErgT6J2CuH(D3G-_iH>;Wq<{7blc&5f(|X4)j8+YKY=!fv zTFVSIu}&0@N=o$I+cf?p8g;;lRE4BZKUwWoynds@V-(+=ewS_lQ*EK5 z0YN;KEA@yp?!544C89F7c3B&1+%gu}QVrTdmXREgK_Oiyi0fL;=fnK9t(d)Sfqi1B zCF@hUNCW(6>YAN$O=cx_EE}=>d(3!mgt&0Frtb4Mt|4e%;GhtJGx|{`++#1Ht?w@K ztud5!Zl>DZn*gslw$-*BaB@0zJ%vA#$6Vxe--bF`-TZbvhOvU=D)s*WDJ5?1Dq4(m zg#PA*WHAqElWmE1^1|!MZBHr8eb~4`D_K2YM^2RN#_Sx$dPr(+oTj+;Hf}e>{4KA- z{l|xI2d;BBI)vnkMX~bynCree&u%(Ldf582#@`QhkHm(9)%RA8Td*+qh>#)!wNDhPTg)=+bMc>q6t!<%<@mTtjM})DO-tjr;wszs!&L+(Ob_3%h4Dd zUZK)?{EhBs9g582ZN7DjX0eIbq@c`|p8J65???6L#V%XK{S|3~%CO!U)s~I*{fjW| zz(?f@C!m-=rBb{v@a6vi74x^)8(i&3p)yD-rhss>>+qnp3vd*(5d!n7^=44v={O zpK6VBfl}NnxWZ>%eP?o=TF^?q{8AjnG|C)x%LiL%1G&pf{l%f~QacI`{yoO7nq<1Q zHt8N)p~WaHdyabjDI{~zYq4j>W3DXxI`J4M9d~1Ht7|tDZx)hO4?uuBeQR2&2t3S~ zkTPt}-d7z6`A;l>Hqyr$& z<{sU+_oOzGp*+a{09wOkT<#}u?^tPEs1Qtu3MQ;ar-Lo+^QK4ybxEFU&K=1r2>}V@ zbJDR2+X;X=_326t5h>g@$4Y2e5S1c8Af4ROlIN_2Cush3(Mr1$6V{z+g{450k=QDk zBiodu@??&blo|CcJb+?pD=9(uQ099Y^eCf+!98dL1#+?zxDn8Hr683lK##3t2|-yL zk8gUy;Yi|2pdKg|1t1_K6dlK^ff3DlL?vB1@x>qrazKe9Nv}t#NtuH)K(cxWO85j3 z(vs6;gS40=Qo>HA*lsJxT=arloY7oRj0#CrMIfXh-@uM#@?)@Y21BYMh-o&DxR8}fLV)z8Tn@hVv3??Twx7%C zyF6x?(^;Gw3cX90jNV=wmX5$-TZiTA9PwHwL7?d!eWfxQrKj+EZvFkQ-P^PrC`nHn z6Fhb3YkYX!pVH{CI6n+E9z#;!kJh}I@jeWiXenr=p5gxh zhy8Dp&iHkqd^B%8duxZxT|aYpT1s{>gspBV2q&Jz{{Z$H?|%+$G0kaq9mVQ3<1AW0 zXghGWL(1YoS=qrLg9qNee|$OVo4qG%;iH*08)D+(?)CQ2hXVfqgr;3mNg_nWbRL6c ztd<#fZ=iXrbis3>0SS)3LtNdnZ(X-OoOU}+H8JuLpSiiUuZA8Uc!QjCC#bb8u2S>l z{zN$C@&q(YkN_T&Jjmv+xGS{T;w`bb&1GWpSZyq_UVRQO0DuWRtAIYW&tx{#rAbNd zLQ^O26zZ%SHoKKaV1xoDi(%eiH#aQ3cTS-oK3 z@?JnvLx@shWXS99UoJKM{r*>1=WjA@T-@I-`NI3opzR#+COEI4dX<94GcMwtdDN=G z#Qy*hWl#VH2eokbiQ11nr#xEK*3D$zZrz-dgXIVcVPN(tJ!C~yps~)|dEqmj{7pe;{lBU>gN{LYb#K8irn)eHU(i-aNygIY?ty+>X%_)^3 z7bE+}a-hcIM@l!~=Z+d%N$TszbEt(9_=$51QUIX@=~^nN0In&$~}?mtjsowjvtUMB4; zE;eV%k8-rc#m^nYj2K!50s;4iO=2SZ(nK4L2SzkQl&y56WrH3YcCRQZlA&>?IB^3 zO}(>Cz4K1F^8yx5&_r!1neR<_mGEZAgc%(nYOQOC%G~E34ZN#lD{ep32K64`Ptexg zYv7v?2}1m6!k}ysHq$0O_f%q`E^=?xS$&B@6_kx9@jHU>!^B-eoYF2auHPXD`LvZd zHc0(X9E#ofpO4QBtnt?FSZWKG?-I1Q+kR5hAOqHZ{p+9gzrq$PAL1U7z@HJZd30y) zlV<)!mdW`P&*xB+Bko0QTaWfc=8iU>S2u4q?d8+$w{!|rgs-97)0(H-xVCNX7TZ@>Q3J@c z@vF6lUs+}@GMSu{`776zxlddxddKVA>?=Qmex^&tSV-t~9cGAEB}>a-&oK?$GzgZ- zmlCt?c>s#C<1B77xXnRvd2elr{3jNxn-$|#v1is3Db1|)KjiDq%I2J9s!ApMY9NNa51>5H$?=`G}2I{!pelt0tu;2 zqs&@~gaO=x6&$p;R+8GAPQ%$m8c4Wzd~zqLRL~g|ZQi+B)o$Vx2L%a4e>!MdwY2YT zEvu-GX>GQoD3GPKJ?YmFR+uG3`^5-ZBKav=43Gga?N7ICg`|j5f_v@;ezcGsM)VfL zfj;00c`me+LW7N{bJCcGJfO)1roAJnQGrq#7W+vl1#156o++K-K$gn4cM2Yw^4?fb zQD~4mCX4}vA!=HJTUbCnM>1*aP3{G5aDachpL;22 z%6D74#BTSFl-J7nj-)_%^Z{u}KhnI@O7jvM01_vxkyG13k_jma`YXLG420#Ci)Beu z3j_~PN>j<7wM5BhEHw5e^8WVK4A|PVUUk*4XhKpCJas=xn(0g< zYf=1EwxoC$s)`*UDs2cV5&;~O)9q4<&jOReIDf{!j4fxcwI$OUb0+==0@I}}c`N=a z!=~k#{z9r6M_uZi#$L+S=U?Qkt}dTL2`hO=a8jVef1ObA8glD8t(NPzw@^q?`KOZ5 z{moi5_6=AaSAuIIn;VAFddk&y%bS7{6eblgKD0EE;@fwAP5rEJ4r#qa?gu-nFE4HF zZIb<=ak=x9uXD+tervwI1z$q^1H}XaP@9LqC$IcN+PH7U>zr<9#SPy)g)pl$5Vj8D zRtE{5)!Y970t){C@eyc{2nfHqKvDki3-9{XO)n7f`efxjZ1Vk%jX^y7ML3Qm#8wih z5O}X1;PkDi?B8q(OOgzAq=HH7Bzsm0k3kVx2_SWvV?!6MmD@ZI9)dU@N`-+(m5;ZA zOdt+=nwxf1ZQhv!Y2;K5JGkQQ`TpRb$o~LYe*rKG<~aJ-sbkpmuTsIOG8T_WPM@>^ zJ3$J8{{W29t@{>D4Hf6N=cI-2|sF<4Ajm(8st{}vS*X^ zq`FiUx_I_A9!`;u4ggBqUD)wD-kr&a2B@X}k`H)n9?;opIH^!d_E;YkPepkUhbuXqAZr$)FM*)!6Vv9ty89aK=B{(e5IbG z$=O>qZDP&krTo0+}_<-?I?1=`;Rr1bKEF)_MjTK!#@c09jY%grxAc*#Sq(< zX=MRNtPRQLtD4(ZWHhTP@*KK#L@X-u-WKNZKA0U0a{yNj{6Xp`{A14P>pZRP_CpVB z>&xHA|4+wL3U&O4l`1`vMLVWu*vOpy82udV=wZtDE z`CTce9Mb60nK78Nzf<08NeCY<;#Iam2?TM+J*!>#RgnJx(e>^}6Nk0DHn)i0H#@n* zwL}m^#0c&0NYq{yWc*~-nsZJwZdo}Srvodxd&>!Qwn&8uiH`hpQcXr!NTT{9Wo;## znu+#VEIsm>t4mvi@)dT`30NbPg9ZpcO8Not+^jkHTf$>5E}TQTb}yMjb}Sd}78Io= zOKq{(4td~v)~43K1Nv`8_)n`dPv&#%YFrjQ$DFjhakQZ?B|CwDpHdHKFh@$~KMp=6 zb(e>lOEaVN(k(1*Z|#Sdnz*`G%vrO#RMR7(WT>7!=cuVkOAP1wc9+Ut<7dBP=%to7 z1)}@{%xUax<=93a33_(rtxdb?NlM99)4>3cIQJFu_f4wRojHkptewrB^GQ3b+i!X< z5`E7>->q#+Z;HPWzw~tOnZCQl=War78*3|)c}loLP9UXi^TLD^)cbo@ozh0#c9u=t zy6w9jKuVrMLX?9X81Ky}IqkzL>-%D&;=>Ix(evJY7Y;Jocd5Hng0dz$o&^@iTV<_s z7LMtc?;i6YHpk2coEyXxC{G8TqK7ed)w0|2GH$bQf>JL6c7+2x5!SHY1>A+=3UWBt zZdWS{ySWKZ0IPC|>A?O~VtF{ND*VKk$ZN#hMz+9Y@yzSHhaA3nl{sdIE)wx=jnTA} z^dNyV)+(a3nJ{Hrzq&XzWY>B=<3{AHZLakVuBE!Vvlk-b&GkNpk-U#9a)~5QKHSh2 z!ELpAcefB!Q^E}WDaWz(dXsQj5|)aQ>4c?SONkqVb%X4Gdh(PTDojG6c_J$fJeMU( zgr)*d-?!=Y6s060Tk`=603}=z$G>`!azhAGQh$iOiBuiYS6>LM^?plUSleh<13H7t zc}%{S64R}tXCx??j*=kts$x`ytKH>VX_xZl9w*+FN>%>pp{QNbmy%=y}>Ts zNeQ~NeYHl{7C}F;3_o+`dbvZ!dwYOyH@&??@=V0kC#_cHvr28n5JHk<0k_-_ zdNp>#4B07BaMP(jna00{w1Wp~yPEc9(;k6x#g*bNY|24E2Xex=FnV`2Bzs*MZLx(l zcaAS=t2eRNIEJvyt-E$n<-Dg-=a!)>gZW8;#bVa!3bbUk0oB1JTm>FTKecPkM`+Ep z%L~}0Z$SbG;P#_hel9R*OScZ8=G+Ns2ua~4XVvr_DoE{RCq7tlR`-`4U>1fyHsvS) z1pWE@SFLqT#(>BSvayK2eWr^>-EQp&-w>nMiWuZJk_%I~6s1Md0s8&wJF7>@+**XN z*mWc+VbWYs_JTO+?@h-m3`w+3zSQk&jM2GW-^n3X&9b(R<)tMFB7ah7ZaU%i5SCE! zam1v{jVEG&PxoXF)ltH%wRp*N`E3P+x}sohCJ*aZl-Rp%a<{F}l2E7#ji4u|Pk82~ z6}N)9Jm)3F%|dk(T7A2h7R#91V`R058A*MB;Z#cC1&JLyP}jc?H;=hsE(;3@O4WAb zYf{uC6DZ<4Q`oIW-ka1IyoH`7-tWnEwJBGsN_HS0;sk|ocT7*PqFTc*Z=cJ*le5R# z;+eTxfw#9%SC|9<=^&KJ=>j+uKIRQN<+N8^{{W7^PUOT&dw!I*lu8g5l&B=iNdUxB zPWK5Q#BuBL}cWEfeO*;eF%lB0Z_=Q?(Gb5?d+RwMHYK%n!fv zrjqJGKr5931a0CgAQ0rJ%pcIx0{7uS(RTWg(XH*Soy9q7v@v^V_m<_e#X=R&q)6gV z5^0@yG=0u~#f><;qxM0SG~1awmK6l7z$LNyN#;qb2gB!z7M>Psvy;8SV|6u)_N!v* z%OKYIZbE@arBFhX)QIP|T4%<+ZDFrGLvrTN1!;xGyxL8bs#MZNxg*q)QN$JV&%H&S zCs~jG056i4lSR%MR^i)gdmNi%rL1jnxahD6AHQ0Rw-Iq@Tx_YUVCYk=Heq(knGPfV zU+GFsg4$iBrNy%iWE^;){JWdC3G|LQpK5ORWrI!LGih~=xoN`Mk#Phr2M7H{R&Xmj zvJ=8&UCL;$5uJM|{z*lf6#4fJgp`jz@{W1qn%CDVhZI38Or57}0xIc*z4`qgu2Qy| zVFjBssTR$IlP?u+B>PoP_RzG4Jh0k=3=}2gtw|o{D`i|G=o$%bp%GRjiBJY94LTqr zm`s34fmjPuiH>+3X$_EtNrDGjy!0|>%}=Xqn~CTTHGpIi2};1{o+$|dNh<6(gGo|U z3EQ?uX`nJX+S3F`GxepR;*v!AhrL8eJ5vxK^ru7Xae|T)u^ylTKtHLVV}vQg>h#9| z(W_Sto-*F)w6O9}BH^_i#F^vm_Y@7ag%CnS5gbuwu^wf$k#68AcRSaxB%P>1f@utz z<~1p?y}M;ea>;vkI69$3kWxYBM-&vOCI;k{L=Zmo`;1wt(aW5D!;c^@YSOmKB=#bD z(BPskpOT{jX_1G2|i33*;9F zouJ#SO;$>Z43WU($*UKJ?Kg9+ZQFG&`9j9{ugQ)3eqD36d(qh$wHS4>4XvfM%eJpx zy>RPoq%X=!r7Bn)5($nd=366ckOkyfy4C4xo8#APCwQd5% zPbfKj_sStUg|w#C8`A~FlyWvik9jq>d}Z)!NqAwTT78{OfYu9feq(=yx={LE5iLpl z&6JbJTJxub&jyvfeLqO+lZ83IObD6%iN^KhmUz{zM>Iocd;E#SQ zqWnC!ZsSU_=H$3b%SyetN&!DkhPl7tby~1u^bNzfOJ;PD&tExjkZRx+w&7{i>{DGp zkfvC0@~<5;@7yS;Tly7QxQpiCtq zV`$>J8$szyyG$pDIY(W$YRS9^w^&ojE)}@oDI0qBKe+d;{{Z35%Wh?rkByfp#9Fu! z{pE;HL0(3wIa?UM$8pf3vq0p#o1M=Rv8W|!&^lfw2ziw(lh!K@_^*m|I1h)qOr|#o zwqHK{RY0|Jk0M%zt>tM7L=t~#`hK*^QGDgIp$w;SSDCd)2cCYPT09EZvFIsD_b&&; zoO`VQ01v~RCWeB4IJZ(r9l4s9j`4j~s)lry2`vH!#+L8{^xYLjcPVt1Uu9MX=`I1Y zdPk)|aG(d&2_Dt!G~Hb(S1;PG*uWbU2Pe9??M^jCJfXKFw&d487+HK?sMEhUZ-rwU zbj`v7mu{V&U@6>W{{VUnMRKy7FO;~W17c(j+(mSc#9<54S!69OxSLf1uUru!xId>g z%}`RyX;=48Q7OMEf-O^Mcd>?zb9 zAm-Xj*6b;;rLifLw%qWDNd-#xr>fQX2}LZo*z)>kOnpXpUrO%I9ecvvWX3<|Rira% zv?5E&uy7B*O0Fre+6yJJ6bLGmkffeL1XpQl5B7$5jiR+K?DmVdvcx!cr3-mScn9)@ z2^*uePVx6g=?@(|9=GwcL0dD5%i2P+R;?r?Di5fsAV6A7bKDuMRcowLQMMS#(&~Q> zLb{ylmT+*T!a`e2DJlz0kPjfq5NPLxs+K%S5T#C>RFsK`a8wqtkL7PgqY!Q#SsR=o zAP%IH(kkuX&JbAZ4P%e<*|-b9y4s5>+?7IyBloX;a=1DD7pByi)xQSLrt9IKM6LGD z!fuH2+)_{cVg$!?6}oL%D0lcL&_^i*{{T7fT4Uhhl>Y$P%SWTkQ7wy+v?@S8daHM~ z9Q?#4I&LX7TRW)sJmSviE$xm$07(l?|bL(mlb6r-2w3 zjjR-_dPhh-E5hY!QA27wM-Y4dw3T^n1^UvUNRl}dNi3~o1Qhj=CMW?#%cj908-MZR@=6!H z3Hy#|=XN;IQ-x|+?0M#(HibB{M1ni}(-ujrDMiTv37$sL2A@jFPSkQi5=f}ZS%5cz z$0m}ig|+~IK=!EMLh=}EY@4kr?Z24vmAMI5M4x)C_@CkSN5q{Ef2Hw`+S^^{ z%Y?Fq(I<3n>R|9H$McH|N}F?HyPo2;=Z{*#<3xB}me1L^k$Yz2N@>Ni92=zdPu7}E zb_a*UHBXFx?C{V&8|b9p+3GdlKW>fJmvI+>;(m&o4a-n>?MvVbvxIxdvmm+v{Ap;n$BCyRBd~R(}1Qd%=er zO`A6*#HmVvCy62}slE{McG+zQl)ANb4z|3r$INV!m2e^_o+@x|O*T=duS*%XPBL$= z?ug|3SCAz}Bvv6MGcon7q@^IoKWg+*=!)bojzo2@as<{8s3b=Ob*~iz$3J=iV(G#d zc6$P7ex6WHI^7~vHq4RMr(L6Uv$4dagHZ5XW0`{>Cxh=#*vT)|K~X=Yda~Kz^VYpc z+LCCj=`AUXb4=qm+QAKSN|ZmmdrcJ@GY$f`T5bf-E-U?M{VtHK9iOBn8zw!3nkq-6 ze}~$olLa(au{;&kXq-55MV~+2K4SR(bhT*wYLHNryphzXTr3#<4IMD4^vAKRDQO+~ z`cgD1EBGtx(fHxX7e!nF7fT#|^pEU@IV6Pq%0V3k(*FR~j;InklT8G~_xsWpmapKi zFGpDI^)B*9MGMCPAI__~qffD8XJN71hZ|l>-77=SDPa1(ziPd>qqm+9V^y7C;c=`& zLiRWKgDL=ZQ4(USlfoq$As3X3M~2O%INP@R zjFe}Ve8AUwqS1{+x|!RLk=aq)QG4Oxq#3$58@9R;-#WXRhDkF8iOJRfv_k@cRpEev)_Ey<*xI zBe?9L^&D1hpDfg@j(Z$4rhIxjpEMTZd3&pu*=EQ&akPfoNq`cO&NF{HtJC@kdxJ9pKd<2UJ@kQpJZCIdK(d|FsWq`^WDUkA48cwH z_ULNn;7Rh(2ODI8BbZOQtt;{Mm1|O9^dos@S769DPlA$0=R;_Olh_`3>sxAYmj+2i z#Nn++tL*glr?$JlaM|NFD$mR*Q9>54P+O76{GdpyzJtiWlGbcr>HF(Ug^jWW%3rd% zE+r2o1cAr|cd9PE@b2eXUSq?V)|<3y5W94;r0-b=XCip!Cbx%(-WOti8T=K{OUt~w zcXF0jOHO3NP<8SCZ@Y&;(ErZ*KB25DZkkU4cT{K+*DL{h~{Rj_H6l0r2#&a zi1woGVccD+pG%C)@Xqn(5$_$vM@wgSK}|fI#rmr*!kftbrMBi@f92e`43x?mOrA*+ zPhmtYan@JaD^$IiHZCc$v?$ss(%OKKjibL>v3PsoABZ~b=I%6RCELdqRM>LT@d02* zB%~6cBiwhY{-@D-y&;}XFC}i1lXq!DcJ~3|;);rP$mp%YAoEFb_%E)DYm97g;Ad0d zbhe(kwQo#jozw_GFnSc?&YwUe%)q}*353=46D-UU^ ztx<=$zGcghkms0{sIQ?{K%hE`rMIau2~yCUow9h|ON%Mn^fN<8(sZ_NsbnP5QbA9o zD03odZLP9o?LmoAQR9jZ)~3R{=6~LnVM*kqEQ$MZ&0uFSE`+b~OGeU61(#>Pe`8viJy|B}|g*t;6hheMZXjl#t*Ms#jG&d`VxU*wr<(h2nK`;{FP;o!vrtOzt zt5hY%Zq%*`QCdLh&u{+8tSI8yQon zT0)3~iWio$df!In^OlN8e;s(sD}>5cm875KYJL6NNX84Qb;S4wQE-CkI?Z6}U)BoBClRa;F- zk-@a{Y+c--6!Ed%6YNq4^Qj}XacHHzq_t~_-{iOudE4@MqE&^7V=^doaTKp!wR;|@e+voDx_VDf7t^1RSN>=oa z69ImZCX}VMWRxQ0@MsHr!;V%#=j@hMYLXscz*>2ZWO2`Uq0ab?mVGX^(t{SOsO}sjk}v$%6)h-mQw zL?2NGwJSNcJf^O4S2lLHH!ipklr!a|rL(k>dG&q!RGZ}S^sZ~bmdCFQLAzKOFW4}K1qpGl>QTUy@mPEvn{#6szK|~h|VIe8nIRm(* zD0zw|V3>eEoj_K598)JEz*@j5M*jd(fiNIo z+k33+b?xKY9}A1jWRqaDzQ$DvAT(4zCgM4mkUMpxc*^#!ztqWhQt2#CoqaatF4`i= zi)0>TtI(oIKKxZn!#zCiy0+B$EGDP5!!J(bK7Gg373IDQfgz{_nuOTwA`W}Y{?^d{bG}6H`Z)%g01_I@00SWXg6(W$WY#gtyWYc=w_W~36jsT zadhR|MHcA=OT2y#-*7qNu&bK~mX*0|?mp6XF>h*1o>`tsl&(#B_Zj3g5cW3K>hS=U zZvK1?sO=~Rl0B*!IOs<*=di{M+OI}QONf9edVR;7SPsdr}j@E9uPu zAwfxk4+56f?Sf1R z$&vP~`AX`q+Ps!rOG#SLpn`U%o)l>*QdH{HQ?h@$4;3L`^0-KZ@iEOU2`K;%U%3@O z7@KRQ{JPq5Ry`_5B`59NRLAfM#Wm+$0_#dlp-pl=l4)cT0l1!^E7cqtv|GDs`&Pr| zn{9x?8(UjpNpKI$N$V!7DFi-M0s$R58ZYHorPjs6Yi$oC5c5j(qI;R@DlDE1UU}%p zFXpaMaH7BAr35Qz?>^KWUbf{u2T1Kit}!lS>@Jl0R)W&fgs3ObpnHQt+k0ww^sOXz zkZBAsfSFYAf4e-zS61SU z!j$1EQjaA^y;;09yYe-XR+yDo-Jk$E%SWXXd=*J27n1X#v6fo%#oPidlFiNK{y;Zs zR`Oc4ZP+4Kr4EElNUh=VLE#$wC(#LeS6XA%^~fm2J&L^!7VbeDt{{OEGr_J$yuw`H z-=pL%K2);dakVMn%F!JU-mG?6EYlV&-{f+?jk<;GX`Abm+y;S31o?B{fhVPT?PT(4 z)WRBBN8Ozb@TZl%b5Ce{A27JU)VInIWh3}Y;E&dSTIe4K^DX4CmzeK1-8a_vO7j{* zwv{DGNdyDbaBGk>e~uc5MCq*#{hpe!aX9>%u2b?Yga=aGp+#VHQn`~v_0Ni$3sGmD z%3Ij#+;Y~Uep=k78a(ioM1=h-oz+6f>bywDD;PV?1nQoKFqE*--VU(yt$Ar^Bo$8N zo@u4F;&(|x6V#QhB0pKLovZO5MvIRjSq)sp&cf(z`>>O=clM4e3fDS8)wb$xwN>Ak zfZ-t}9d?pB zcdi51R}Q=42B}h z*o26a0)Ex1b$zOx*P4y{=V1KNQo<7jN`b;hxvP3~Y*Vs!EM=Uh;+aBvdgBM218l7l zvLAU%X5Bo64ivNOpY^F`@%u-VrgsONLW69y3WF%_PaKo=rEGl&ws~nlQj(z4Wl}9b zF)AMY>c!!%nAN)5HF1g2C~Q^7VWESx`i!HxE4BqBy{S1xT*M`icAYucDDJQA(FYt+c1k^e`cc7t8E{Y z6Tt*@HMq3*!gr1OwWPgadv5i=tIW7gSQgMnRI84^YOQL|gl`nI<>+fB_C2Rp%2YA{ zC28l7VzFAN)Z=%t-gM1Iw?$Wn;k*@g{w{RmDnU+|)ZUXDS9r1r_A^b~{9NhPx>T(< zsZqUCA3UTFwGvOmmbhUl->Gn{Z;&@+B$7Jzrf$9&b$(To=V$OYOrc-iyIB%@&f3rA zwBIlLXSTYYuiCHw06^D%E^tXoi+XoFl@T0eAOrdu7=A1)Ur(z8o>OK}3i5|(2m7-} zN5UpyOM|HNs8}E=CiIP?-}2StN&F>h{Pt%En|^&9QRNlNRCX^k<-w= zf3h#A>mU7p{*6O#;#Ib{)4BXxSgX4cb`!NPyj)Q`fh$voumS*}Hw$TMUd1Q)K`D{n zw;uJ>`pf;F{v=>c+BDWP5dJhnif-EY?^%vVtCRMwcGtQCJK@f8+$N*2ILw=9-llg2 zdQU|HI3U)l6>!Rd$Mv5zcjnt104)n`IE5KlN`lBEhy)t?fAJfNyVM>W=}lXPWmov? zJ7kvyu-;PBh)D|(*hCXwG?8tNLnhg2zBk@im|qQ#Aa~ji>(;w#;Ctd@5scC<=*?N1 zMUBmh_G4YWKf-q0^W~KuI5GtGHHWAt2}b0zgMZ=OOe#{Md^gz9TB|Q>-N}x%wsnV!9t3!A zlR2!NwwxJ+512r)WIpiyR1ZP$tl}T4(M4H2QZYf9wC|XAX2H)PKqTQ?2DJWWCM5LaT zmvKH*dyrI+e`)}25B~u0cAt5gc@Mkg^4{=A2^AeS&XEPsPzU$b$)z%#==CHdo)QvB zpb3nH+-ysUQaO%AHFCmPQBK04@7|be&jw41f$XYNo@@|5meANrq!ki6*OKZ&WjqLoh@fbWfUW-k#0dkipq?P;27FG@ISn)~ z>~Wtow#m52DM7FSB=P};M@gejyXr{cXTKdkTBCT|s$bC_6Xx@_S1j6ITPd=`lf7YE zzruQtr+PW|B$9o~#;o`~_;t`4KJz7esxR|-2AYt~t@=q?{{ZDk9VhEr_eK0Nczvp| zOyt_f<*saQB~2|^CfkIA21IogqVj(en!`P3bk0RKmkc-*g#5le4Jk=I&oVyMV$k0f zd95R*vG_|}G~L=6L2Lyp@{&x+o@cFj*2?tp1W==)?KX7&FX2PMT=qdY{3Xs_!zXT; zxVLiTIH08TGXxNOMQu-n<}rFVNarxNmrg3$-zx8xr;n(D0qggg=T8T|Cv=UTLi1B< zb&EXx%VDJB*+KHq2SQ1oSNhjR{2=D+^(K|nxhrKQ_Fc=bYRY$T8gQjmu6U zyP4pQI@ByKZq1t(zmAZCBy&dIvt%;lHlNC1B_IkNgtTQA4Fxui{B0d3gF9CEi;?#A z9g3&;=n?Ly=Dkysk6?nJ({exM73x_p+kdkarIo)=W0q6O*h;zWB8kdZz#xyM4AVtU zU@?SqHm#G-L$-;ig#Ns7OwmW_qbg8>CYdQpxCgI1Q-~0gx;Qj~s3&(%c%aaRR7ym1 z9gQ@olM3dYE+nXeN79*8DP#fq`_dU5(4`)xJ*uazB#bzM58`bd=b(hB{`^&~^$on3 z6I9K1@*DgJs1Qy`Cv@~4TI!hrZt#i1yb{zzZdq3c+?u%GHmj>g5ZZ!PdKGk#XP>1| z{1a`&X_pJC3t4c0K#n&U{#A9maJCeq`BTq7&Z^wf!AeL8vaav09albb#^uRBSP}H7 z;GRer9X94YZDAdGD{({dT%g*Nwx<-YLoK9m6SztL0H^Cyb&eL>FN#|kJT5msY=sw+ z#z~;0p?%bo)KAj0r4s6wd6K(Bh<_xO%WW(T?XZNxCOfK1qu7ckmvxlcI$cWElnEgs zNl$(%QOtP-&vRVr4+pf(?u1@d?GdF|aV!@Sq_(!pXP7cN#c(%{`rrQmNp}qC&0C#K zrYjuViLp}BhQ+#EFhN=W0H6Uiy8bWzF7>yDH@F=YgvDd-tS+(NF?JsWEyQmjAaWys z4RXGB19{_p)#I5(v8S$cOWkajkqn^?Eh09KyvgUetr>5YW3@|bNZ7c{Ps5UYJiEu_ zG8w#$<%PL@Ib3aV@KVRa^xI}UPDY;97Iuz3blx%77SqmvRFYdz*~kNcL7pp>arQ{N^2<(q^3ZkrcAO55eqpj4zKWmEJMLT4tv zwY~nwXnYoGWOy0jYBfS^koCr>zj3cQ-hem4T1f}FGw<}`w3o#OO4NKu=WZ`S!Qb6H z)$6a>AZ@cz5L6S?sFcY*=4*L;CwPsb-S~de`hP8&!L^pL%f7#q%D$8-3oDR9N$v>d zx%=Yl$jf{{X7bh#TRmrX$`URZx=V<0Xd6^h1c4j~9@ALqvTkxs@O>kxZI4Zc-`Lgu zH*0*Ki1=(y2k|HJ_PDEu9%n6jvR{96fFrOR)eA)F2eFqqC$D^mS$fIHL(26PBodWJ zCL|G8cd|=L)SFiAnn6fH${GMF1V{&^B@SBLxXEtOD9MBt6?B(|8P*UB#?6WBwAs9D^R;(vfAQ+g6%?3U-U9?oji0B_a|4{HpKQ zy=^;&t*nxiCi>+UHmX}IwP~^B-2>5Ey}N#t5ly)2656>+0RRMn0Gggzq4kU6)=GWG zgvz~$#NrWPTe-7&#~io{ND7{xsI2MTIeCq`aaY$)vX!KvZ6wK1nSuvuy4zu%y;wm? zQkK)o-Ebu!eb0Jg_ZF;m(~PYUq#nj(b~LhPyQ^DlTwi86XvL!3Z3uL_wGaXpHYayr zNjwT`Fw?gFS}v^EvAgvJBH3X{P@WG{Oso>oNB2RPii+X@NrAL|C_IQfric$DNr(sB z_N1I^ps@LEDQRtm1@4|?@g1qhfGH*h2tE0;k zX@N6(uQR9IIPaP-*s0-iTUp)|u|4O4K9zd4)ofnjarX>ewC@T}%dH?Ul){oD>J4kX zY2{=dYW*l_2y<}U#0JTdXO5q0HK#QOp0LDPwx?STw%j;MKv6P#^&^^^M`XJeXD-`T z@cs?g(ji2l)Th);^FwmlivIux%j(4wWaEQ|WlMz5Ne7>LiuS0*ByLVqVJZZr9;yET zDhH6yTRt2u-j`6Bg_OikZaAT!To37Od2@HD9DefS%e#3BPo7h|%=C~EAJUE4CDqy~ zCf&B3eIZG9VM$kVK=-Onmatkf_SY$l9{r7{O9JytVYbA2hvLsu$y`X@!ZdXy#dRC0p%w4MOPs@`;%F#N8)qbI7=HD{-Xy9z#hR&>+HqJ$>oXV~uE9u*K827U5@g#nV7}Wc1=m`qgel@#}bB zNFz6cKl*0DgaD+ri)OAuRGqA^YNa6b;6dZ-K#`@_jnaCF4qTy1ye&Ks5<-$v`3p%0 z^dsC=?MrF3Sv7Thi{B+gD&>Ztr6-_><~r6gR`%tVZN>UC7Y(gTH{mKwqm8MB4x%UZ zsHr?)a_dQ_gjcj%Su0I7afe=crZG>tkmZVpl&92_=}MInQj%wB?rPI%adL}Kl`XK4 z&@*zT#`F)N{o#RryhFmWwo3w z@Df4;{SzNrp_HhY9&Vh;wf>PS)UM`KBC;7X3r z38`fC@MX0@De26b^NAaYN~T93aaptl`+$v#Sm8?B%n9a;WN?WWEh&Q*?(|U|AoIub zqa*AF2n9P-Iqf|uO%i~lo#9eI?wykTr9NDUQkPzV72^#LI)gStsQDt-O!i;R>pX5t@Gr_5T$&<9`#^`YZ( zlei9?L8O4lbOc0`9P``%0J13re|U4pT6MN2ca5j(?OswsB_NX~dG@D}2w+!w>KV;=za=ZX+$jw z2dJWNWbM=P_a7?y?+~57YQPCs924BsUvNMSrc`8Z5bIWrW6*>pzbTU-kv^mKsqAC2 z7kHjk{^S7Vf0YwIuQ5Uv+^s~xB$9u-&sslam?GFYaKp<}XiFv5ln7c!KtZ5rP5SaI z;aFkY#NA{3&p~a#u!00_J;xoW8I&lF0%wXZk;+=XZl-N56KLAXRN({jC~+t2^`R&D zfT$0rGy^iy(j+A$_vF=&!-q-MEC#{?{!Z+rPKiJvl4V2KcdGD6OM9U8~ri(I}A)rInwFRqcfKE+5WFk*`!YE6kY?_jQ*l3aC=!rMUi zG9(VYtIcl=;HH;3W0nqOtT0ygSnWTjGj`1dlwKunIOyDDsE;s5JoKTh<1_CsW#%o> z$x%(Jl9^9o>QU)g$T-EZ3%kHz@0RSV=IkGFw6C6hC{O_L?O3!nZ?vT&OxU=PKfQMF z{iR&gaG$Yq>K4ImRuD5D8GmT6nz+bdvVkqP}4SV zD}AFWh#b#qLRDhw)RuI$lZxYOX64eO$@=q2d|FyP4(W?qcZhxP&H?R8p}jrpU!3UQy3d2TuTdo z=E~ebCIQ-1XWE3*WbX4e!*tWZSko+6U241rKQPR@;e*TDjyvCIPN-(oQ%1xzlQW!jvl_-scY_7*{{M zR>!o?H-=DYC(pVe$JR%wN3fp24%On# zy57`wFp8HVaee_JdPr>_>x}b$_W+A-vYFS;#~4nn>Wffhf!pZ0UzGr%+{#a zo*HUD4A3&zchK`pJeOL&w**8V$l&YEZ^mwxiRlwe-rf0)ywiwFj5v~&w60R1eZ^TD zB=`-f6Fd{~mmT76D6)mOWt+7~Mb)FnYLWi{IzjAfiT*b)^jR@>$0lb+5(^ja#+UA%23Lm zJU|^(conx(d?}7*e8Weiw^?S|mnhKpEL!=CU8kHHC(?&GSMTjnLq$sT0>e*4w(ZW0vk&|paHdFw|$8J!>c zNzD);BL?{Apc{nMHt!&&#mmoIFt@+=MQEQYPgMT^m0P|V!cT}fXe%zO333P{h>>2p zX_z!0sF8a3WbwnrKMhfX(oXn)dz#ZXxe~i8w6e6R4LaeHl>rgon(u3`A!=AjTHPxt zBqa7fwQJu4?=G6~yG?m-Jkw_$gekd>k~saQwi+*z(|lVc$o}fyDXL#A`XpA=dR745 zuz(Ck;y~xUVB|wC6slb3^MUoOT;F-DLl&i%4_%AjyY3BmToS-a$mB|rqyfzYj5%^# zC3`}UPXwo$%muUx+jM{kPQxF{n@gc$HZ4g5^F&2^=bpAgf*&CSkNAKPDoF^!np@1u zcPEJ2;F+ZPjj6qbuPjIRL{b-WTc0eg(x{l=1KyG@P=!Lc>?4|D$m?lgA{IY}p*(e@ zwBfgKwuf9(Q3188LTB$uSxaq#w>BV{8;4J+rif@Sa$f_91cGP+TAbZI2M`X*^J*X! z70O~b6_B+lwE1o&(f}li%PI`|h*F6^;o^Y}TQ~}okgkyfy*#ufy~Qq-0ys*OAfK&a z>x8Mb8Ak{5kpz9J5psA)On->TCV>+|b`!95=ZceijBwhEmL=9FY2pY!S{MVZD9VU2 zAfW#MDw%DOcF;?1s#GOg%+K6VG($m2G5JhTEp?=ew=B&EL-7%KT-{v=jmY8wS6T94kI#kUi@eQjq&4V^}_O_)h zsO?}O2W*l_2fbpq$8XSzl(bR$`<;g8g#HTZtyle?!0A+C@^;q#ZOZMhTv`+)2||zN z>)ck+_&mW|X}vqDadu(A!x?3%Dsf$XAV>19PVige0|AQ3t5fQ?EQej`XsJeZ$w}Y@qfI|qF`&8wWlheNjDn(SRR)$mz9R`0%{}5B%Z^)OC$vK-S();fiqEHL~%fw5z;xT zUcOJ5<^%$FeDa7f*fgoDo5}0geQJf`Le|&ze1&ZW`9@|U8dv(&Obge9GIZk49;K2y z_cdd<-rJ-sgFQO&Ro@5*UYQE!Nsp&fR$SG?c6RQ*v?tl(OD=L3pG#!ciln{*&r+JM{yf(TmqQ8VooQE@LXVRf9!S~UAd@at6z zrSCu?_kr}M{*n2Q)+t)8#V-c?#06||r&N+8DjXeuew3x+8Vx9U*J_^MG`NqiHS4T; z9K|lkD2sit6yt?T>mU+(fM^*lZWOIM)S?ooJ4Fb|W!SubD`RY>mn_;rxOZ=*1#=C8 zf4v-^X{mYa#l8m*cagpS0Ecehn53Zc;p~z1CL`WxZl1+l*lG15-DTLENjs^JN#DGsQYj`v-bxs3MY4x*W@8O>? z0^IV_wHKvdm%kmWdidqwPFGv&eKoHWl*eO{j!I<@ZYEC)Oz0LF^r2AAi?j5>)$6s+yy0a=TQoxVTg6al-2g}YZOKrB&Nq~Erw!LTIqhSWyDXp%O z4-SOeq%YWkGY72HqgNS6K?^myx_l(F6l(k)kI3aRHdf49w{WLkKrJcsq^&!Ir>}7} z^;1iDDd6HfJhIhe!hCPxjoFtjTzLsAOKC){&8krf5*6Ni*Uha&_Ljw6T3zUyjKkMW zJPVEH%K@+;`jDimcLQCAl=!0XeLoIQ=<7SIsLd}1Z4lFFSN_nXa!R*t02MiF9*}%Z;9D0IgPux%wyYWr|oVo0z-uhOv2-d1RA2ZfqAF=tCyR!1a2UZ z;-l;hMWml6i!~^}4qm{;6qz0VhM6eyln{X`JVjj^@XhD6Mo(7^n_~}QeASDjuuFwY z?h+3pk^9t))+<0_ygISF!)m*Xrmwhs2W=g;Ei}?3%#sO&f$z;2!MjhPy4bnJ6i2aE zjI?~quhR~vI`yn-*5+lX-xg*H*gdcJ-Yq+ih)8?26? zeOkP%i(GpwD6_N}3Q>sXp8Qo6{VR{TvdBAemo43)ux(kkXsjsn!pR?}6p_(rbhlL{ zCW=E@mNCE!5qD_dGr1~HAEBalUMFU3ZG$Lw-DpVKlJ-57kUsH2FR)jZ)@!+1N0Nty zy45`ww{(8gKgucUd8<*=sWe(&@jE+o5`lEvX#j{tlPRCS6gll_nOaL{BKSviB?w6U zfT((V4(6cD+T+`BGOL9YrDS)4f69ov;r>|`_g4-$z)i78b{8-Si5~Q_T9l>8In6_P zbjp~1<;B~nQl^lEq!ap8he=stZf;w5CxXb|+68muFUv^-sGoWvkDm zYKxuQV5Aa9`BjS_e|Kz%MbrC09*;1A`%@t(wyxxfkE-ux7B9b=M44DyQHO8h+H9+b_9F<=xbTqrtQYtyO!MrN}o5-L~tUvaPT(? zh||6rJ#CS=$YixE2!8!JXOxQ+DSwng2qGtrXNrW|XE&+n(z7;0lS-gC!@JrlLetcW zn%;XP!-Z*m2~p}4(g;6rM>X5;d?5HWqqL5tZ&PYVT-A2rX|QV-l2A&|m$|<}lgTDz z6A(VN!pJFgq$`3w$m{i}_c^_Gg3Siq@3>d-`-hual$0>yi00X#5`LS1(!9=Q^e52h z`>C|?{HePeCd$&6OND9#p|*gN_nrlH`hE(0H`3T_Bf96sN3c0OmAYT~e=Ve>0wjSv zz?hRwMZU+KRW@ofwB$>SmG$Cwzi_1jAb^l3=wMV&CyoaKy9Yh+t>DGAl5VlSHLdN= zrJ$81l@7f06Vi%W{33W7?WuTp&iULU)>#63@kY~P>3W9n&LdJJ@z2myD}=z0>s{l7 z_#E(?Rl4ntp7CPiC4J?oY}+y9l@bS12P9V-YOE$ZO=Pk-tHyGFGi7k)yN)2YwZfGY zlAbzoMle+^Ea`rx0>Pl8M{CCn`DwSaZCgb3dSm%jD5YMtB$5(ikMgaLhDD>A2gEel zHu*?u#Y*{=BpLIFfw#Bbweo=qDFm~m8$we8qxgU8u#q zm8!m8)zImu6Lh3poz8GVeYtHHODR)peKL)p@(;BW zxp6F^Z#$4}#uO!1%1}^~{t!8e35$3Xsk3C=*B{>oKUk^vA0o?WE?G8*N=j18Yd(|D zB=bNZ9kXWfZ;vz~2|}GD2@pF`p_N^`R<7D!Hd{(UT(ejl`^fG-vJ}~2`H*>$6b+z39n;!q#$y

s_b7=+dPK|++ul-pm9N)fM8GDbfg&^^8y4$0sQK<)hDTr^nb&Qlen!^-QzBn9BR_-ZMr(4L83waRG(ut{M8`dIggdcl{%bx zv`c5r`G^mPKd&CuZ1AhY4ME~=dCLtor>?WNp@Oq#ZjFI$lL}Ilr~xC6W~f(}uU=m} zdvF_7)2;^=ppZh8W0)L$YpVVU{6xsz_}`ujy;7BBhguqW2?-(`NHPRZO7q%DJe;*1pn&Ex;bhr_>Z+kQ8V1 zBE0uwZwToB0Qi4R^=@So#Ge7R?}H1qcUtMI%w?7GTtKC5d=sj#|XIW^)}m%V1l zxcZ1;r7Xtc2UL!=*113Sap(LWdCgG0Z-~g-TQa8<&&s&c*R+Kcr>K)0Nv}!e!Lym^ zbj{CnJ7lqEo@&C;;dY|yt~koV!eUY+kbb<@=fUJ#RikAJ3Q0<0J)^B^ZxFPWXA`6C zud=r9TUuQrS-D!0xg(T?k@-*1);uin6^r{TY<0@oYWVs81EHZxjO$jy*?wBY`tKRjc8~=gRR) z=!3gXyj~ zl^7~9$JlqE?xXbNmdius%8Efxa1AfSsuomAa*ENGb^j zrqC&(V$$$Qh_RPt0{Qd0U{b7=)p({B(dMc5Eqa1Nl8+K>)B^PXCh<)LUQ z5{MJ~)Kb#cl_f4E5y76qmgVfI1a3%)h=Sz zEDaJjg#{A{K;~kE>Rcw1)Y>N{hRoz|@e94VLYI-WVRr{)M$arBJM&MW4=fGtB?*tq zGsRFmbj!Vo@QVQKKoh@HUE8MUJi=O14Vw12m2QBfpP{3lVeU(~Z(V3Vhiw(%UP9Lw zr7f=W0^Sv*jVahiHT95(g%_XW=7VwXeUnIhI>m8g~5( z@|Kt>Q9&l74DjXL&sDlfSo|L6OEx9A>U-1eEF>B0Q5s(m1wPo1y?SWgPhr4%)4=cy zf%;Td7sp7alA+2((;4fJTS_3u91%ja*EVP!i6(zqDC(sPN@hswL$v4y$tF5?{b(~w z^-yIgfJA<^>cJpPnEO|$8c7(GgyU_8U96x%`&5|*M9B82whsRQyR--Y0CG>}JfBFX ziG;`}^zBTAQd<$_m=FX~3U?-C{e^frAjmR1#WY?CnJ@|V=A!ajxdQSWehmIqiG}bsxOF23cu6s@wHCAeZ+>3YPh)e#F;;}QT4if z?4|~Hk{58I5`Xwm5A&+zJfmayNT2;vWS*p+efc$MdOX9}Rcpeb<>@9<1Jm!Qjod)2&^!i*!HpmoBL&R^mqhdlAi1F2p1C8#e0Ix0FM}bQu#-MY8PB zuPlVLzEqF^AA092Z;dx?9eFv;GSdx&klXf7E#0c;l_P^5@M-%$j(q`a!V{Rgx@~Jn zlFm8Qr6-w<#GSGF)h3KHe7Z<6$T8oiT4DW=Je0L0w5 z#NhJlb0Dx*+c!+9qM$vetz2~;AMr+(%dd-j7nF~f4DjQr6DZyN(0UW?K%W4s0_L>5 zXESnx_&uA2Sj%OI`IU*AmlNCr`3LJ%UmSiYbYFqS$&FEyRlY*~3w4&Dle8GzVqjI@ zHK{E${es9zZ4IMpQh+w3bP43}0I!}O6;~MF7CcwQTwdBGl{toNyEZ#M&+csClA)VI;(xOl1;8z^$ol~kYI*T!z(C;~t2wE5y zmhBgO#GlTsqoC*q+O--~^3etL?Hr?t=h`B|} zmbQvPPxuT73 z_j#=&iFBMrw3F~sE*JI_c zzptM)?-?#uwvypEyCX9lTQ#Vb`!}jj%VT_;g1?5h(CItV{{TWvzBh382 zg=5pf_Gpf^uQBYZ_1mj99Ywp(wou!yt7u980IRhYuTk?2M;FW6Cfjb;BZv4$&NAv6 z1@DO?IsVVw3^VT6tohd1aLsvPO7WJ3I-hFL>6^Y|*r0NiObc@}`MpE}XWEH!k=^vK(HvGb*|rwt!|81V5(*C|k|GTW$Ybr% zZX9jjF?-5NMEXQb&)$tN^|~&1D%~m@LPA#D_JjKHO$BjgVt=Q%+O?JToVl`63#{x*l2W;lW3Niy0~BsP zA1)Bvs!E*Iz^Q0Z3IoZBA6~UUxW+kSWR_jH^TzU|1#+mK3HrrZoE+`iwOpSiZx@HS z!@rKnG`6lDacc5y+m$FN2;>fDo|S0D+v@FakGrwLX_qgMw z5CK|}lLQ_~9rsjQSv`#;-SuzXgPHM8CfXIcJj@a8dv*^t*Nq6uonj@gz{wdk ztJhld(&_U6Dr@roVaGM}8^m2?%V~`{WR2TUQD}!s z$UVYP2=}VSnfSlZj@qFaEj?(%gvRSOn<)C2Qb7^=)r$AxtHY+6Nwvfx>?s?Jw99Zk zxuIPTX&*rFHmq$m8n7BS2l1VxhK>9=yIYJ^)7J>aq#?AZrErx1dcYsOeEac?{{Z;M z)<}XEq7{+lns>MEELvAGRa(3>4z%YAzR{?mvxOkVW zK^v5F7i9Z?#aA_Z#G{mOePXp;ya2E)m%KaiD5Q`Zx5t%7PHsr&`Beqb60_=vJQ~DODSw$lL4tW5=)ocOkd- z$g_<@Yqtu1+ z_4b-0m9}>g?ZqcCde%<#y4-{Y(us)NK!T|H#Q;vzNyt23X2JH@^HH^4WDr2+B=o0} z?dytpwk~Y$T-tZA(h^*V=6L#cp?JK4Y|!N@Sdcf!PrGQ0rB=fX^Jt(NOv0<>QtA~onos6bnea}i5g!&>=2Z;XwIzESyd9inP zw(Kd3bfCIP0YFaK1Haaoh&fv|KW%MyZ+hkG3dOifvQ&fEAE)|KGY&K6w`*+ruC46R zx02$R)O9Y*PbdE%Fl%`)aQ?@@h|@XL;fdUXEb|je!}M8 zU~TmYTF)v$?-C>$E2Xf^YP`lj7}la_TjZQ&mXiBLKQAUHZ*o0>=ia&#zz>9v4YhxY z8C@@`vzNK1tt}s2!*o>FNmE}sB%|% z8}=>j?_Yd4^}}G0P!JN71fG!{ezg+^i+;2J{3F{ z(z^RSgU8zHR9jiCC_$NWCq{sN>n%8+I-p}t{mA9Dfx>-*p)u5miNthjKw)W;3Aw?)q5f#~A z5&r-Mo*L*|>?2wuId_9q-L1-&jEjr7Le|g)AaDw2)%#Z`w8kpI#u>S_yvnWr0M7lI z_9du2Q@9>}^`T)boEKG%i%`5nd;Bfy#xOn%I3KjQb*8d6O7j?N_-&vlA6kizx9wMr zbK?b-?}R#sPVQG~L;2_$pC5ASe^=e`@ACtR|jbnzyvU<{!pcCAECrwo4)t z=PgSrB}hSo?bEdi$lBZDbV}`P^TT<$KsI)H6)l$=RPP18JHb3xpDi})9Fsc_JzO-K zBK?WF3shU;wKf>!F=sHg?oe%>^9o&U#DY*_V2K>fZmds>8lS|b7k`?~-(G=}QweEr z5`;F5hC*kOK{d?w85HBPR+s7iE4Gg%)C0S2@iEee>HU9yqP3c{2K7j_OQrN#?*0jM zo>jDT=~{29Q-;{H&*+-CR@`OseY?{)*pCvl6E{{qPD>AT$V06Jg_hI=ZYez!4>iJn z5grw0JTTSEde|oG6LzBIt=*bDqJRe}Qb!>}zuvj;MEr1TFAXzyxg9x@vaw?5mAj6G zD%_~`AWsMCDqefz<5y~{$1d{?;WCR+Dnedu&5Z-W2>|!+HRQbvq`gS(Yt<^-+RcNC z@w-#uno}+0oN)jI!|jJ){m*)q*Tfd920nF^$F;Ige`@FKkHr2;_0_nWTq`Z^kkfXg zr9Y`NO||hCc2o+{g>Pt$sk1VEwL7-1^-bXccaeI(;z?PbL%0cKi9_D*=A6n)cFNzDCdI<=@KIDFNS|}=h!YIw} z#!hko%|O4CB%l+v3^_wS?| zo0N$E0KyOWL<-y{ya>R2t=GqfZ%!XaH$k~#frT{O*4 z)Q=0P>g%shDCd?|4Dan8$E^^0s>ZY(bvAx*z*;X>2;j^9I2Qa$)jzj~ix zh`h{S+u7r6?lM=e7;4(pvbPoXNUuWOn_m9M%qsDGOw*kH#?W)(v&CmINVYo4>v2g$ zr)Y5_q?H8EAl9wQ<}Y(Mj$Pi|Idc1kRO5>(Qi z&oRF=kNPHSROWCQEjy8Z!zqrs#$Q{Qa^CT>+SB?P!%vk@^6`_>)qlviV*KOx$U7h# zXC8)-va5%N_Y8hS&!h^lcmSm_;+Z>1ABMga0(g|rv59{9_8Mg=Tdp8}WdH#8C)%&y z4OssG!@P7=tNvU60QY6ecOc3SPJXrNN4^K3mL`$aKMBDXJ^^7{wP{VHWbz6LaETws zHMzy9YTPBj5e7Q)39Uu&-s)NKQq4}S7L7A`d`FZyQ1i+A^)*G-e;i&PX-z?Qg1<$< ze$C%5;YqYxhj1K#LZF(dCf^6p;q;v_!fozW^H%M+@kY_-Bq${&u-j$3gdt@x6lAFM zu4>Z196lTBH<4v&aOJc9SSRL*Xenh-l)?PRq=8ax{yaQ5e>BD>;k%n_pz*g`%Vj~b zsfh+)3X;lrCx+Hh(urN3^pvm9K;=*f=9;>H%7wO#r7Du1pi>Ooy7jAfRzeslOPin& zQhn)4b#5T2h$NCoMM)6A>vv=BT{b`^Ai4GJuJVKOz&YErYHV)JnAM;H*R*Uxcd3zKD4afYdLJ;W|=uk-tgAkKV z`6a~?uu=y=4_aD0#>oXFEBth~+FOiBcWS|ipkpO0Y}!(^{{Yhw`_R2ZrmQtSo4>{7 zuCJ}}kEyWp*yd8}>EyrxL=I@JxOJh=masp?)~Oyi-(K4IN2!%*J!)3& z2qTb3T8WDp@g#J+XHg?AfA`PG*R<6g1E zVwuI`ZV_j0iG*)ig>|3GBC**ErS!8i)M+7=HOcg^1*7~e@j~Mwhcq@97%_=Yoa+{x zx)(7C9U>@q!(Kke2dFjOmMN6mW7B@wX|yIFY#}^$u3YdJ<0|LFd^P(SoM6c0o?n@9 zdh!a(vBFX&I(t__{3Gk;yhpy*Ih$*9XxrCpsZ6dtCu!%cI`f6QxkYzrr*GvhPMiw# z@Ot&9P_F4T%1KER0TI{Uqy-=(!Rua$utb&7$2Bv>UdU@2XG^))0fa5OVcI1RTzPUAnhpvy1SLCvFVM>Xn7V96W~ zhP_PG3};Q3ZSD7Ea!LiXepf(_2hyagO{{R7wowTjN6ZiOqSn*owZssFfC+Vc@+?u5xvl6|XI_{Qd9+~BYAn5&$V zHm^7?o3%#w8*OQTLPsZ>i{v9jVDgRA;i}R!xY`LQ0H^`aNv>+w9yDCqYJB1|Cf^~8 zTv;aC@iK&koxFPnvX{03=3Tec89bxp8I)!%%N$2&gLE=Bd?Y@6h<}x_! zan9LaY<&q`+5#C-{KzO$hjAd*NgAN>CeNSQ%}c3oa~IZl>vwOh4aT-E~g1+m}Q*1G~4vOcFh- z>s`_tRfEgg;b{rq(~}j+-VgjX>Hh!@d_=L&F{{_ApRiKAw%W5SG|?lgi&s+}g>?dT zJ19aoIDj_=1kc~C7-E}?>{EPH@P|`s%x#d8$+DVNzhnsI(=w;(H_JP8%PsKs(&mgewd;fLV&N_hET{;k&tySZl` z;Iqf$*n7%tlL2d7q;h3L_N|ZOSBAHkjen=HEb3%j+&7E~w7ko(l_tTIy90sNU;=va zTVLRpPK`J4^`{$gDns`{%cldKNm8I6v;kb}@t@+(F9GBGm`s)9mX_~eTDNZT4Hco6 zRJEujM0B1H>qL^0$tNe5A7W?3COn^o&kz-x$71bu4Wbcj^R_Ib%5(V5sSdWSvNt5n zeCSXGO7#Lk{_TAo_?5hE?}Uv>aGUn>es(I%D(#`^TEfthKD>ipIvu+g2x&VTY&MOs z*p1wtPu803eCP25RBl)p+qCjJ4)lO{JbuEI;-jGcbc7O8L7r)&m0u$*4Hn*R%L+q3tfwdy#;-X-seSjt-nyz`r2Vv1QbyD1Ict))8pF`i^we8byTcHBw zlw709P*WyA3fQ5+0M$&pnL|a7n|L+1ZCf+X5DR8rmWo)HSer0Z4`=4qQ z&H~MDHq-Ya+TrQ))8+04J^iY1ZAX)Ry;dsLtK}7c2DE+dU&JhPEvDTYQnjg9iU?$g zA{0*meQRv^o8iiv(~soZU9-)hrqQ<@beB+nia7y1%*f~3f$1x2TuMO{fim>%&=u#_S<1#~eTK9w@a*%nqZ z7k74H3rmfgM#B8aGElBW53O4A`DX=}Wt_g{yZb?9W#Bc&m~l@G#m;>@}~HvW8aKZ0#!LQe;<3d}{dNr2JLz*Gl5FYF)X?W45eaw%3$x&=U#(n37Cz zC!wx6%W5lgrkWN{Wi4}RQ)zrHM701AqLcOD^r^nc`Ug&wAzsxYboP3=KXTrN%&{Ec`Y^+bz(=D6AB-}0=0-`N>Yl9_9WA| z4NI6-h-XeccBe6d=wB_RAZ}B;VoJKe_NhYML<7X1tu}Bv+f%jeWX%($ZuM@h#%bFd z)+{da&U~6~E>u#|5}-=Ak=h6AS3P&|kCf35-dyTZ_0}@kDR1Yr;sfYQgn9zhvH~Z+ zwDZ=emRoG{wvVkZDGez~QDDNr+CVAfatu}PKk*%NZ=&)zTOB`;x5r&5D&=n7k1fUR zPf;ZEw3w}r=Z4ogAbT;np0i)YUeuL9KT5l4Z-uP(BQ>V3wN3go?Y4OyWumN`H#cRK2nq;K0(Suf z_pNf~dmQ@@A-5$(Bmk5UO#ORS)xP+)dpVWR_X*S280+0S$}LOw*8#$`r633gj;Wv4 zo9tCT4aM(f@WlTBvzuAnX?*T)6PvelG5{V8|EpS&UG*D{*aI1t>V6+$1EnVnX@_00`=9NZaHC_G~+O zeRK0IBX7$D$`}6t**y(K;c$*GtSvrb>XukC;qA*>(qdc+^r!w|U3cRqL3uA2TWMo^ zY~ZaFjmM5bpXpqdi}yvEQqD<>1tGv)Wla*Ri6RmVbpHTa>aP@cC&i##fK`IC;C`Ui z9czAGN2mB|3&zet?XZX?AP5|h!4%-PY?x5rzy^9&TQWF2(}W&o5501#$$Xzsa7`9p z3Z6DzI_N(oI|AFf3)#lt5h8xZxnIR+OP(X^6+tTeUg~7@{vocX@WsJz(xm(4XbRB=I?it+T4r1%fL_uu%h5`D0Yp~EZ^r^GvUx=W*egV2^{{Sz;uM$B{ z?abM5JCNz(wffYQ2nst*T`)*=Xgz#W{{Rd(VzmO996V#6tVL3mjfyFqTiB~6JtOm`KC+N1obprT1J`qYm^Sumr}itr{TNj<9pMNlFS+Lo22 zOMnj0dXYgSD1^L5(o6{dkwH{&s>Dq!wZzj{}wJKeM zZA!uOHzfwrS0C~1$CjVDNufD5TerJYY&zY-1VYecAGJ+?8td;ki@c?> zpCk>gyZz(arxZQ=2dwWEXrxQ2;DDhYy$D$&2vOicry8|W>e$*8>x4*30VnIlWU{mk z%i9uQB|!B1Q;c7|Z07bIEiY+Kf7P9x?k1^Ze^osbW~j6l=(`T_Tbf9YC$nYw2j-=nuI*UWx;834;>TbnLnVK zB)BQH?XFC-T3%mi8;fi8TjPFhl0HbGNp&SE;3$Ah5y1!Ex9`Dcia6~VtgXuG%8w56u4&{Ve-*d;0CpP;CE!$|9EJxS(d zF!{SX`-YRfSN6+EEso@h77f#opvRr%If5-rSTQ`GGJ9 zj+H+n;J&lP*^9UI#rtd_2yi&aO3Fb#lj$-H_N=}PbDW(|o67o5_V}Ig4#Qq$G^-j{ zFpJCkF?8+Ht=#hqX(%9qdUFJO^IW9*?k(7dGG^7M5+St`6hZ7j>H5`ULZ>mHZm*kp zo9u1tt%Ci%$XhCLC#26Y25QdEMWora_=8L@%V?WKp-0VWN0GXJGEcGQuZqVA;QFnr zQ+FQ4>%iPL8vg)Mw}KdPxg0H7 z2MLd<_o`Nw@XtA^@i~mI{*Z9GRp#u!i)(p!q`d1&k{eKnNHO(^6|E3T+}MQz4_&TE zN3{(#apfaiUt*BTl*@Q@GDkz^ERUp5T8fM?Z3b-j^9B?_2DW|CTleU=MY7nq*|jA` zK{LXH)J%o5mrIw6YPedAsRVk@*mR*9Fp)t{pF)PyY>>X=a;BfN(#W`RDP6jGAOI9* zt;@wdYBoCB_Rr^8AGI;DC{t=}3TeQgkWx=_0RD8-BGIjGEnK&`d99^e7Ni0@fJmm0 zs1l%4+P0Rd&@bt%p|raJ$I5)t>ql}7%)-0#GwoIToDH4pTQ07ZX5k?zcgrgPPb7iu zODB}|DmHj*#+}lOxmCOW05Zr&rD4UPN=tun9Q~_h-#6#70$#Q(umC?TXXGVH=v5s_ znyBM7MxDS|3sq#6;6~6E+a#3~_keimMe+KQ!!pgw z&~lkMrpQW(B!HRYt#;OhxWRlQ{65<2ckEMjtF!H)X?57%jp>v&lhq&&Oji!2KwG>M zFjAuwV zw>u{Lqm}OdIebgG%p8MRw(N%`HtjbceGHk3-#1!|74fg|_m$1Pk8a;x>3)3lM&|$% z1obH(cj* z6)|Ayp~l^DMeEqM-_(Zs-;F$zE0YBx~W3-#ttOAT3xkT6oS7&Y1aA??g#Bx zUxv%uba>Bd-Ib!O?bD37X(&^h)HnpFp7lb%Sl+dz3POsv5=_UvT|OI~w{ymeGF@R)4e8M{4~2&S9*k zR}J%SDa(sXWdfbVl1fU4A8Jr(A3?@r!Sgq2kmz2>Ajnrj54bhEobfK(H{dP{Pvk7@ zRhzNRAllub1LhRbRFbpbk_4W$)nomdIu&<6{{U8JOK|}!2ps+5iDUl&+0EhJ9ou)F zyUg7yB#j@49ne^qz1$yYp?2}VV?Rg>Xm439u{iQY8SL}8b&A)^Yk7`}4D5M=s=;Hnt zFi*rn;r{4Xtc$H_(kHq^X!tMr0MfuSg=j3Ixwy*Ix&DWx}N^>RH(0LCa%|+JW5&4`Lp8Qt?ERfnoZhuc zS@}%?!zcAS|PzQ4ELS zK_acn%Z1Gm=LEvPaZ!)yehfOMyBlT_-{Z5fa^O#E5XJ#X|ND1>G2g2Z1V|Q;da!f4*$|A!V%>%Xxw9c3hy{9EQuby+^(W2 zQ&0sATF14e=%cmy^(hWuT=FY zRY+4%QQ_oPoQtF{K- zsLONjr+85Lw4poNZ2bM+j~=D&R@da7vPJa_Wh<-;^0iNE@nO}D><8EKSlz5 zrfJKi?h!YN_LNSILY4!E_yy(h5uK0-+z0l@2l3#iz<8g1T10}&P4(K|lUl2nfAsP$ zj@!!WZ||`oW|PIM=B3b2h!+697t~MV94G#f1d!oMham zwo4?Gs}N`ENEDrs%X}YzF{TM*ve+U^m zNrd#AysqH9E3g&6t}Zz*IeKmuE+Uj z($=%FL|d;ia$aU10zVqi*=*C|b|j?Tb4<^AxGMg^bc=0O@oO5gqP5MS(g`IMXVsp# zn5kr3(d*Q7OQcGWoQ_nRr!Et)`0~bd`f_e#U(+#)`v5suj=YLSx>$Xq5pLjuvElxs zdnMpHvs?lB7v7q6Ei6P=S2|&GJhz;|kOXuBKbW zO29lM%-0%U%YPzP@D76i zV{_YZ)+M`BrI+7Ej(1#xhspwzfqDCRt;#z(O^6*mmds0+vKQaNsAkA@mg0%eL8^YD z34P+@@w8U>s^iU1i0%3W7dVVCSxcr0+7x}YmeLYr zVrWJ*Ak#G~5>-BU-^L=?)0!W7DquChGu2t7IFe+fO!uQBTO)ryY@%i?7jA|^CtDX1 zUyWSyfl@ybA*%yGhpIFc;*gpgr5z2h8HWAs!!cbhdh;+U@R*A7Zih$>XTGEgbIATP zhsnA>LEl%BGYJ_G)MF>O>s}Y*%%mNClT?G{LY>D5 z@zP3V9~#E5nvj#yH;- zPyqo5Zzqe0-?H7m67flm^G%OVlwRV!gWODaYEluJY=>*lw{6FV)AhPAdYV)NK%i{} zrCLvvzWRokWyF$n>Cz<+B8!GpS$Ra07fP|cT_jhw^kOrA?w@_sfKoRCi7R*gj@Yfr zNGqG@P76iXLS05qV!4o; zUImXF+ATCfwmhwBGo<_U+&nXG}0P zL4u`XV>Z0Z*roZZi3yv{!?7gc1tmYKjR37Zq%Sn3W}D*It||oE&y_CzwjVTzNB}o> zXN{M6P}#gOpT|@K>=RB}(np_Gts0F61c&H)Ru1-xLFpGBqWlZqP=9kTjixywmttyH z3mP4&nrvDd?dKcG#|RT&(cR^P1fLUL^J$HugMHJ%Uo}h38w+OIZ>rxzzK?NfMj2V1 z3+Rk>ST$}l zkYnE@Fcjs~zz*7cs&gRr3p!srB-9ax3GuZtrij#(e5VN01Vpoa7qg7r6(Q9JL95YR zCAHH49QQY1#-v#ZfqX*Q7ctOx{C&`MX^f^OO3y`5QwB)GRrO`G?|U@8$1o#(%`{uJ zeJ11P%2tQ`X0D`+LZ&m=byt%BAzBMW^uDD4A;It%iakgB^SyxQMi)p4b=5Iyd|lGkI%*Z2`G=vY`FO!Srd~#R4Cn34+_+&llMk zRM|wYBe!gKe@h0V1L&>sq@bLtm85;S(|4H}?Co_MxfS24u54kW`h2yZ=oPD+bNg>p zts6$dyXnDON#mZjsLB#_Y~FgK?*I#CL6B5Z4yChHY&n_K$S-5arQ%H+1V?O3rJZ(3 zANh5aO9K$lR0um?Qu$h(7=zkRAN(2&s6=4!_GV`eD$7sm5+`j|;n-EJ#59%OOJBE} zB}C$lo884!CmZT-9R>7?j2F91XiLmh3Pc325P26rO3+ej4Ul9jM0me`~W}Z(t7g>ed{g0r!$sjIcNqO z$`aTsLp!BcCXg{Z*-&(N^Ama7s@`uL6)6MlqY}2Bl_}8XKb6L9?8Q?)kyuicIsKc5Dp5xnk($c59^m@-HG z_s!&1yMl&Ga+yK8eMmxq)S5NU|8_ zISiI!Bsp0k7*ybd3ctJU+R$gaT`MqL6uI&?#Jp~^7tj=dw4gRrcAr|7)gR&=Hy|9q zEn3J_uJVzBQfAr}383coE5284SF2h-^pZ}v`N z#us84DFjDpNJ5`v7tj_DOtdw9$xz}H#7sx|bGuO{*|&~;z)7kVj7k7T+K0@7;jNLs zKPnjFq9Le!y%)~ade5A{E7u~VRwy9CSF_`baJcB=mnkL8rXO9bDV!JpxsxWa9)O+1 z_fBMMO4EM@&MjFLk-G7Zl3_52P8NFCW%W<^9UH~|?uvE6v1Hg1F| zN!!Kk%s|hw?&kDtOz5<45>imgSJ?V}NYEz)pmE`!CtQeZvtJ=fJ!8+&-Lby?!lJT8 zb8iJn5mS#x(}S8;g?6mCHEWujeSMn@=I`sak6RAOn)WJLYsxCQ__4rcfXHK32qyrh zmaCPsX#*kfAQ-?rMAwCk6Aw|QnVWwnAU5V&Cd*~k1Zj@OZM3&Ko<5OuDt(W)&iaSu zHr)}Ykk*0?&TTQQD&zLPnWn(@hZ*ebcl}$W%WMe(N-0vhYcnlWYwd0G2m2yT$*$^Q zdlN(^~FE2DNX#xp`9e;%tPBrh1mh)Soi+nYM0 zt_}fPuhBPbGtat?Unik>7mGQv(>PHi$)s^uz`p1~`ZHNR*Aki`P<|UT-xOdUsZMgt z%*?IHyYSKLYuJD)X4C+MMg`ohgeIsD;Acs|K6^mW(VbbbGj3o?*@O)#23IL>=G>n{ z(M6I`eHj?doC@E3!_f|e;hFLSAwKv!zw`I=^OB0)*F@gKi~lWL=)W+f|3Zko8tOnp zSt6-!oiErtSr5PD>oh8C_j89t)ui`?`I|dewW|-|hy2qFPW}g0^;KATd{%dfyQ~W)0geX zIm+-qvQ+2HA|in;IXUX$>y!;!?=8xrX5%p%hLO7bov&hGnm&Mw!>*thjsY=#~ zalBNkFMF9|g_SQ*b+>^o6;T#fbSQz*x+;Hy8oQ0KR8T{nLlJr&+l9n$ zYGWXQ8}~l^?Go@LJrnw*@X@>O^oE)^c)>dTD7th8vXjUf&Y!L$#3D>oz!;iPTktTn zUfUto7&!Vht| zkH8&{S8J!OIT5unR!!ZG2Z=6|xg(d^v9*hH9%4r5eZ~}xwYxyciAT_-!Zp6x95L-? z#i3B_!>9a1y>SWybA<62S=?2wai~~o&Pq6n6 zj-?zuyl)q@#=e>%yp@-$V)$?I}luwHt&!aI1)L22(&WgCw}{;oB8hDb#KhDf3aIM!1&lf zh-ZrO{?`rsw^v$sBlkK5vx<7p9{LX^ttrc=2(J_6|Jd9!5TQ^<#>Rwc=41a3o)NDq zX#w6wadjY0e{B>fSS@>rufIu}O z#dW;?4ToTokdBUAkZ|e5g+6b&Y03*^kW9F>sc^+tk6+>2cflR>5;XzHz@t)jb<1A# zc?r2ci%FkMVaUZ(8;LUBhkj-(#X7&2ryB9BB?d4WlIZo|nrP>Om7Is7Y@TBg$}a_3 zukj@I(Wc$&zE3>LHF#y7xS6LPy;PJhafg*#`>V~}$jr=4`oZ-6UoK62qY#&lNZPWL zed}7goTgt_AKYN@8U?oSS*0P=6t~z|*}`2WGXHfMlg+oEmKq+jsbsf7K6;R{ly17| zHzSdk4)DZXeW~GrDeaXp>tWpr$tvBwz5V9PesLcCt}-m##N|5fSp35fvD==GbROj@ z4OLfUSziGmdRj5oOY8z<%)%^UqKcfP%70@VNS%X>rIL-C+k_@3z$sANX0dEfsAVVY zGtg)fiCxBZ-TrVz(x6%9Y4!Y>^eB5XE@*q*s0Ayg6`d;E0jUM!L#UT4e1bI0Wma zok7JnRobnhIkJ61ScB0I=C5f_Mx})sX1qiWX~(@ITE_*eo{J3b(ITT>BGlWTsL8ao zJ?po7+a!u^jU+#8M6|NQpl#u6ioIL%fTL;p1T4R z_S&w&Rs)WMqk(7W;XOYhBByvLtp-0L3-)&RDh95?7h45rDdE!Ua^4YW^~^6Dd5)O8 zm!-Tz^q|kg2(xbWVp&{k#e{eB90Y?)i5YawaDWyX@v~R)HygzX)LsQ}@~k8q`y>Rh zt<@ZL`=xW|FyKE{jRuT=_rGsLAQIPk2Q05tO!Z7FHTFWhf3YdU^;mP&Jahp*$?;l) z`taFi`v5Fl?`1?V?Pq2mDTJA?1KxydC=}M+#?6M?o0uFy0(cCrbN!uXWMaw?vO9FV zOp}-GFh`e#^hSkBC;V(=x8CGsSxu(t3fHXYyi;=;Z8^&M(&1rc}-pl#T5|26iFs zqBai2<;|F>TA{SDx#2d6V^naSlU=m+$kr1-t=9Nf3tFV!_O(k{*=7=a-N44p(DzAcv4#iGZF_jaiQNBB{X?lz_jX`bR@N86S6R~I z7G)vcMf2oSe@SXpoGEws6i3s;Y!-)kT;BeWqcme4{h<5g=f#8$VG+5Djp@IC=~$w! zn^a6o>ssITf)X|0ebGlsiq>QgSlakaa~)#6{r!8QxSsnhWuN(S37J15IauVB6d zswJ8m>^3H182v|f-@d{7nSBhub-BsiRP&wiUbT6MpK+J2;F!PSs5bFi?y;`vT9~Qs z?~u#B;^5}{a`N&*HBYfG9=!6|U3}oQcEepKj_%k^YTtOz0E$R#JP;`FpsuC1Vd|pzATW+b8hUkPGB{Y4NrLHbmxVMNV zq|1cte&&1}smlc|ws4e_pdvUTLHtnt4_qc}()e4}jR(DXrjMssC(2xffBr-J0!x9T zfGKC|B4zd!z*od*k1KbL2tk)cm;0N$dF4Jdc$|2ZEZZC9wXFI}iH|r2TDZZpt)T)p zG1^ZJSK1cgv4$BabK6kuQ(LW75`U*@`PuyjENk8Xtw9Kjo+*GavH>vpaassFFpo1J99W#(SyLB7Rw#<^%hz6 z=1d4vUzFV826jO*Nuc^<{Oek)aqy!hR#JJcqvIg4%~jVgH|a;^vTpuhVmDo8cd*atU#1NfvgE18pLjQh^UCLrSCt!oqS{}FWfEq3X^OPTWrb1|H^ z##Qo_DCu0suM1iFX(RuOcok}i%K2Z!D|_VLv`3wN`Gtf@0iz2VW3sCst>q*r758-c ze>=Znt^q4-ry#x1sUxSRAtId{ znc~X7aW7gN`JMQZM|n(g-a4_H_l%@*s?rmyV?B|ZIDEOUoXmkUNz~&%UREpu7WUM& z_DLDc5j0LpyBvU97+rhNP~|yE66EV>m!;M4=UQ2!U9-D2nQ9U;LOl7SqcVR@ z`H4B_>X+X)c)CrZT#5%mQcakJhWl@J9#v`09?zRj9*$(S2RC2P$@sBa^O^G>WlAaR z(*w>b*@aD3>kNd{tbo@2q{Jnqx>|acS{s#AbZQ8#hY{B zz&xT1&z48O&V-*fw1c2B!!4ShphDusfN1Sf%gW#bsy~k&FZ<~xuo^ES%(*?#BaYcR zQDnCK<*MaD67i|__TXV{#nk^g=im9wkD~vnFaK91>i;=)xNcjEmNhXk;e3_FMwGbZ zAaIxhYUKt*RC__x#5?s~xIgGl75bYd$c!#gry(Y~Vd(1g!RHCRafQf_QaK52*JSqu z)4Fu3GNljrW-=PWbRhhBcm+~6#p@6zCOvyUs=vJG8hGK*449@U+8g0wLc1>{AU~eY zNjgW#OG*03|MEa4Opi}ZCX{>mK1?yCD^4{GoQG!L#3_9n>UDco)(`{*2xOC9JY&|7 z#q}#5e$&{Cz8HY?@6~PnK8ZR+1>q(9tJI|7wz#AjAOvh^`mS-*7{&boB)p_V+?VYo zEqW88?FAnj*QuVBn;{Q%gNai|%AB1A(zwSOl&w{3z8Czhv?9k7W>;U9(y;i6g5ojI z2$8?3VK95&F+nN9pzWLzZ|A=SqTX=$NSpmK1E^>(?dheCEpiw@=T}n<;$G}$LJ)g^ zxd&~{Jtf=R040el)I8#I1DyOS`F$i(Bm*0>QKmWSYjye2{NcWh-fwW0nWcaZg%Akq6^NDAX(vs$>;TFu+ zs%X~sUnOu2-h`g~-C<=Phu`qUmiMwf`DEkXrfTfa)up0KvlwnaKRe4<9Y*a&BnKX~ zF<9LV6FCzP!ixI?loG2pDx!^3eGHj)`CI6T((2a z6#=kxARZd1aF*ko00TaeQ&@lYMnr8TOGPQPS{`;s$8Q* zo{B}vhc)Y9fo$+?4P2d4E-s?u&Af_Gjq_0EDW=Z*VS^B$V> zNZGMFZ5naHLF!gY4<^^=VCSN-{}=*=?_rCuSf$Sa*Uah-S&BdZ?h6+^d$xuA-uSU( zGq7CS+CJi4(zChi2Wn+^HCUQw-!hnm{T0_t0CU>d&c@RttAp0o)^q$@C(^8Ef%&NP@zO4N3+KP zztySO%XUaZHAi{Y32JUgG_kbiomB6!Bd>@5Kg4~m;3t9Y59;dSy8ia2y(L^_(^s5# zm{}5@RJ^}0l>C@^GTDNaBu|20=$B4|uU8&X5AeDi)>7q6Je-dGXfXG-++qB8QpHkS zl+~!rCFkeU`a7@Dyorwi=ZrF=4o9gU=Qigsf1J%p;4?`mbf}6Y_sc`POr0BzbiZT~ zCw~p(xn(Gf%ZiA{ouy7+DLvvaOhwta1p|Q+9O>d*m~^=U)bE01)mze#m;YjU3=uH$ zG<9{E&aN(Z!>ppBq8A1e+&zDbnD8nv1cql<)l6HqS-ozxtb5eVBfv@on1WxLknVe1 zJ2*JzD+a9c(vZ}<&oEbfZH!3=e<|ye(tV42tj|8gPm@=}MK>XN55xKA2UcBe<)&q? zNG@A9S&p)GGD81~_M9y=B{%4BL{*9>l!0)?j+z}Y)?~Y`D79d9b-<@lze3=jCvA*k zs&&<+OfB~$yMZzDKtmUml=sCpdM}U=grI6+OQG3|bu5~G0rpb{lk39(Y#3@O38o0GRfare-E1rG4w?z+xJK+4zt6)noB1R+C!T)$k*m#arfJkux@F z5!!LLB>WUvt8&&M$50>2Y(C(UG-{Y_iCG~gz=)1~oMERh0rtFdX`2&6b z-(6uP>=bg!g)xQ*EAm#ug5WN1~f9^-l3YN=_(z9mvM+^!NiMZMaf~$Lt>E6C6 zj%sE933^ht3|MrE@nq5Zg@iMRf3XSLEN{7?8NKE1Me9S5;jzzSA4UidcPbvkjoBH$ zc=2LHq*%T}a-nmFoU~YvJhay+@-po>?vUk=o*xzMkiB()2F5E|@V%L=id{#Qbz(*T z*+badPVu7sA??2q)qhqcEv^7Bh%4yz)FG89kC^`fi2QH9PGYq9FWMw`hJjYw8!|kP z4i>hNuC|s@Ov(O25B0^1dzEQa+W!4!EieNFi<1v<`*Q$eyvwOhPdBtAQ;)EAReV+c z0G)I{@iNOe>RKpD&4P7RF~_50Cz+F!w^69S|Kok{F)k40YgOAM^wyARK~%t?qrYME z;I{bdSds5{J{_D!x=;qgv^}0Y(0@Tl6EetDL}G{D)_N?9dOwW#qd4Uz4KPiZxby&m zDEw)Ab1`lHqZyg=*a+qZFTW!62PnOkq|rJhHDy_lSNj^c51o`9t}C{@tH!yPI>(Ln zQ7!Cq_#9xd7VNnh)T8ymESxi4>*eEv0YoXKH{}jjasLC|Xv~sMQ`IED$dT{68}~x^ z%!N%Nf9i(XQwg~B_k45nEA1b@BoGaM*36#0?kxAG|4qN0$W`sS;469SH*oSbnqt<- zo4u-jMc2qGTS0vt8UQiAGrteg$LiLxyVZ!M0a?a-?0qthjCs7)gaF|pD2%H#Ip)+| zM(=a~we@wKjAz?(#f>j8-~Dku`Ce*sVdYWwPk_)ip7Ot^5T)|98=Y$r_A^Gb;B3VO2jt6NnyL8?O$(l z-c@l7!$*ABUJzfrJ6(*;a@&>G3u@o~b~jx0m>jUAck35>ox4#*X!yr>Oc{F3^!$-c zrLW5dweYLtBKjlC53xEnrV?c|+uL5*rS(jp%0j}i%gSg!lh}SAS#c_`2F-zCCKzi} z6jv=Czc;8`M8{h@u7+fPsoIhD&MG36`^qD*4#e`1vE9sIP&B#!#%LdgzwYxZW%dR_ zWt|N8PD16Y-QGxD+rP&DsaCt%OF*b)BMlyQKeIG=^IdqCH%raZ#qp;ljE2JJkl#V; zPJ7DW<_~Zx>OJ|72v5#v>HuY9|we=O)hJ{vOMOz^S7w`)X#uAGsWCNFwFW4123~ z5Ay*cwOMU30L)aZwDy-49&iDx1jg_k<~PfI5iD(?c3WUTf$$_)-559cQ_|NoSfor5+B&D z!5m*JhE}xzQ}MAQM`S4!tB5~wty7YeI&%Kbx@`I5wB!8`;ETT)*&@&sj;<7L=dBs+`qXy~wn7?m;a;QO`_)X0=}O-CAAGQjPtlo~rGboU>Yur+*xQ z-#^02zmegL5NxIg>YWD{QifOxDHoP``qpOnl!!eYW7kAXDl|V#_viX%d^qN4-}R_v z4!yT~)g!khIYDPi?e}=gc|m}!!e6^~RelVvM%+~iRRQee)L(vRm=-mS$jMVZT7nxI_ir|cz$WI=KrBxPD!ggmZH)yG z)+EQWapiEv>qmFfTk^bpeM<&LD#_M)g!sc;!r^c3iR=~1&9(V>(zj7Nff@1Wndv}; z7bDe9zE4>aRRP`<^Vl}2vwLZpL$lNR?1#PL|95vxQo!I$*9ZutS4z5e(Ob^V1lBTa z+!t726%g4`^4;^H*ib^vlxa|;mD6Xaqy24vZ^LO_Vt^G)$jr)=BncV`a@@vmKM;a# zQ}4paAiJYr&O|*S$XHrl<#PX#qE~4t2cPdIXz%1lJS3`3e@*Nb2;QUO?X!vA?5QDt3k(!k4m zGvQ1QBBC|F{4+XD@jIuQaK8j9hpR44bSXARF52%;GJ&a=1pO20C>$9V4yE4}(Pr5C- z7O$&Z(D&O?J*H4J_J5G}7En>H|GqdX1}d@zK|w;KTR=b>m2Mbj=#cJFQW_PNlI~P` zg6>8I>1JkVRC0!rmZ9!Du>GBV&i$S9zxRLla<9c&%KJWVJ$feHfb-0=R1=bLAcu>`e9D&&=tu=)t{$`hXx_=2*gSSB4!WHp zrN?YjkLQSh)Ypbgt30~RLiheEGt(OnO(%ui{copF-C4_q36YXpo2w>vWN0-w4A~b} zQkVheu)r{i3{OdRGTFnou`S~6lK1`KCJmkeW3Q4gPR+%B%&6Mcy`X*jQxNGCd3hcR z3wt?#2}ziCNkS$UV)r$k>O6_W4ys6D>-$An)cua7=pGKA%TZ;Jn6QW$z3El~8*f&l zGjzb2#pm`J%8@LFN#2N8RF)+}Yy!r{Rybj7W@ENXSZp$&Vk*|}_1Im}*Dp1Ht8eIU zV7MBsSlhQJ&8e~1#7Gwnjgt4p27*6xaAE{@Rf-&2RcB zYu;yMO1Q4T`PYBIs-)YZXPhe0bG7^bDkuM=u)L@D7Ot{;kPCw;9eyep)26GmuZAoY z7fwfftz_h63{X6x=)Sy2XbHLjJfdNwc^i@H;P)n-x3Xa{;vI6mAk}Bz>mc=yU;@1H z4F*}I%1&E;#&KYHqi>>;iR0)vFlfh4Y1~j-`&C<=wCc{TNF~j7ZTP>czMW#{*Wlq< zC2A=bS)hVerA~OUML*ff^eSD-q4V}6qcK`r=+;b8(~n)geNw~1h_6pJiEVW@4xSD% z^oFQf)_&_xC2_vR8GlhS2JY1eP2N5HRV_wN-{$}QW<-n;7v^atD1vh|E#YhM+m;T_V z&P)-Quva@$Ir&rTQMPTkwIeNV-z{(s&Kvd6i1^k<-wooKHzunTyD=Z!{&nc?FXh-~ z>5~sdU%U_(B||&8UOnG!YWvzq{tH5%#I>I!_Y}@|zp3fXklM#C%Ful$>w+!18^P6@ z#v0YMD_bE2Vy%QHr`d1B08kAPouhGzt}3Z+_#;BL14t~lZRA|kR}5Q-+ecQ$5JgSo zh8n=$qndy5YzXB$w9s;aM@olYM~`fzM!U>nN;qFxa@a1pc|e)anZ(yco4x&leKE;y@Cfp~ zr&{o%_XCE^3Ml$089Jk_T;m@m1>LQ*SbsVM=u!OHO^Lpxy|3F(#XX#Xy7FoyQj4+> zBoWY5gbMwjJ0M;TXgZz0Zo9glHF!Dt}tSYts-H)Kz zH%WxN3j1@Gu(8ufTa(5kHJ*<@XRL)a%tm@w@^n6|A+3i3}?0-(fU@Gd?|P0T)vp+Bb}=KoG0|fzh^aH zh9))jhO0nP@8w>$PJA*=&lY$Dogeyq(-iM%T0=%RefXI%(oaBHw~rqbaE_b_*H#Up ziU7Bvn%c_udczl}-FhUs_VGL$4cHbPJ>TU1oFbt`5R1dMNG10VnT+PM;2IYA|aY0 zVHb=eU_#z0k)3yAny#sg@0+_#Avqq`Roz7uH7hL_=~p)7iw`HXs~W?GI$po^%JDIi zsVk>{pVv1L(N@=~rffOTgiRBdTlt>GVU8-RH5M_V?=y@rYgML!?lBL)zv+5UyWN2i zhOczjmfx92|L9Gt_xg<|A3Lz#yw`S_iS@S@ZpX0C3*@v+WQ!BT8FUw!Km$OFx=Yp6 zH!NS9P6yJjE`SoJ1A8*%dx@KWX5)GYMb}RI4hg!FAkaDhg`kdx#?X#V4AS)@gPei} zkH5IOe0wN#aRkD$*X($3$|oiiz3K^m-5@vB5%0GJd2^g69~VR>D(}kz+V>O7X_1M; zfo7;T7w1gN-q~?qqL8?<*5NvwOk<^WL=@%k4S1oTW3RVvICat%zr97{RT;OiYgcaB zuH9ARuObQc8m~G*&lB6*{}O?7dr=_yZs~NfuT@jWHOV4Zf=+}F4|@l?UHfO>jTBs}nBmlq}W@yN3C z+Ot0swsl;SZxZ*>O4YJR!aKuNI|O;YW+>}5jn5(B#sQ$(NMET%P0~!_19AaSCF6yy zNafJAbxOa?(pF2F0t-K;ihe_TOZ7PlWP967gz6shr3%EXfaJdZZ8SRF?>6#nu; zV~hx|rZR(a!GuthcU^LMriu8YAJ+_&4i*PQKIO%3?30%)6NQwk9oYs{>a+Fr*(YpS zyP}0&U9d4g79pL@Hlal&)Pg6Vqo%(uGeoSb=uL@G*Si+~>X0UOCV03a2`l=s~DlLJrz)N%K6U zrtTr(B|wThZS$fCNQe!>RLpQC2v=n-{sWIzADk^p$WW-W*qt4}Hlt0G;T(c(V1k9( zGu}~BT#5E5|7>MHGBdJ7#Iq+QL67+yb=9@ZjZ`nPsNZR#bC@nxHgoG8BwhNbz@Lk+ z$6QM!BP4iRKN7FOe-uoq*n?zHg5nNB`zUfJDi~H75N5Y-Ef!wKi^MI`Ufyx55q)gw zC%LVZXAd`7sOi^gboK>|qhF)X9av{^_TI)C_qb6G@(%j!^g zxOR4z@{X}p#>mogtU`jvB5-wqWv4NarzQw%ai3izQm^z2l1I9*u+W+$jE&>Szj*uG z8{8$esR8S$Oe|Iu*H}W|%Kw$3*y!z675CCj%U2~rq4_Z_ER$Sg>j1BoHgg|1EWD_+ zR0{}F>@o0iOS2gq|4WU&OR78lpASqhFq0d zAJa&_W%J6=*1b1lAYtH>4D^0lay6_+;R_nN-P4?Yf-(;Xh7E<5b3FmeY9pd8O4*A`L4vvL^QdzIfJ)t}MYDNd@M0;sN8w6=t=;_8M=S=wIV zc@-B)?)h5wMNcCr=0>vxa1V*PBg23~j!@k`eYzFLqy)Y;zoBTB@9)v*KfZqhTb3}X z5?S&~p}Wp-e&xZvE}Mkz{AH;2o;z}d}AW0Jy-G^*yzbrpe=^?YRqOm z8%Ers+W(`b=C%3--f72OIL880x|ntg}P8r7{sm{*)07UbcNs(M>< zCM=xPyS=499ega#sM%iQq+Q`I=#e7aOqAw(CO}G)OsiYW^K+wyMJJx1Q0BLKqR|{o zRU`Vqea9_K=SXI>K{v#Ff`=tC(ij7sVrI*gj!U-B%1`W>YSxZ;6BBM-30r=jCNjs` z9>cp^RB*T1&A5KlPldy3ra}VbdH5;KP7t0T)FvOP-Z3UEDTnyp$5UxwM3&;$L#VJ_ zi4~$(6MQ2mU8lI+rjbzx6Yk}CVLf^vKTd7!`rO5hL6M4Q8%h9W9l-lcYLS*-v+G64 z`5TSs-YmXqf7AEIa?3OiCTx1*Qa;KKxv!FUr@YZVY@*Dl%ZBpK4y8^#3%hY>iAOBs z3g>5n<)0=;-}CC0@Csc3BbFamrixi(T@&i4kgl_7 zYJlg>lrxea{%Y}?&cPY@pKdzMVdU2+o3kA=YM;vG4D)@#ir;geE$JWWP2tUQ(9MFZieXc`lic!Y_S`xn(!@J{Mgp%>@Q$pv z`_}>rHXGDByFQeYP$>B%OEN~YlGc}y`3V6Rj-xgYb@u^EoAX(VBj3iOG}=me z3t~@h6zPZ(b)|TeO~qsTTiui2RVoi07`}Ri)&bD6fAb~GQ~Nl@-%%E=x&ra#`A@H2 z=Y>h_q%#JnPjfpw8Zc*HABV;HhnlqgrZa?(&6q2wQ_^^WK~g}ecRwaLw~wI8)s)7u z=>fuVrS40Za5(3O+ERF(L8YO1TZFufsQpVxH%W7O#CE6%W$Q2A&4<}J=}a6(v2%{j z@mKHf=QLX1#13tU_pv{8u`i9(LdW9G`KgyYB3=^ebDTmtF+w{Vo|0SGtM-X=%XB?m z)YnDD+pWjC)OvHyi!)YoC(j5#R&M3ezVERO8p{8sjWvL^$gC<{MX}m|NsBMX zmUk@OXZUsjXJn1_rH{|%V}R0<_sDk73)-SR ztW6Nq1#=#Ccn08Jti4@guHB7eJNo^*w#%uyE>!x4GUf)?iCP1O3kaEI+E`WSTJ#A` zN-t;QeG~0P|H-sMrzoR@*e#&YDaAiDLus@@kLfME$OH3~Gjs5)M71tdfaK$*Godf*k1*#Kdxv>^R^FINg88Q|FN@ejiuC|j zv@y|xh1RY0$$aQ9y^AMY6E_k7WmF!(Icd7Wot5V8NiGjf97fbX(5O!Dz<5{Gi|iz; zzL=hIlN_=+(S7OeYSUQEuwUd{;0w_4l6>i{qY_k7Cih;rDy=4z0QB7aqovfIbAsfo z(+FJtG8VYZOyO9XwrFGN{AQLFLxAvCvK5^vj@-G=!dwLIgBuu=d3S^lm*)_9P>uA4EgkwI!->csalP4ORSVRxOjB_yWE z!wT-c)sagl5;>#xpVDUpu2j%}Em~)~8cxohKLzLd@yOQrLX4*0jlN`Uj|V59RwVv& zj}%08%9ic^kWECP+K#dGP}4L8IcCZGm)nF!(6CGYQ;DKCdY`^LPBOpsB0_SCUuj$P zjq^ep_DIOkzBt?=KWS!zwyqaY`&ctq*`6czZ`Th!I!MhY^KjWp3oM7F`ZQ4OtVjI) zcs~C3dVivY{CpDZ;B7$RH$v)!rmM-|w322uWqWB7^w^H@Yy;)cqoeE;6cpBl5@LN7 z1lL%?3{X5SFWChWC1|qlyL^ep%B!%Ve9%Tbo|1*9+`48aP(ZQ2_6ki3%EhF1-p&of zI4n|bQl{VuKnRfx$?0D+B}NOPKK%So+P;GGfRP|{4p{n z8JW|A1kQh*B0(F9S*13E3|ulUjRKB_^kXM;?NdgXfE+yc1j0g5_tOoly8to9kkv9; zy;I5J?|W+1a`eYPVkG$Qi}X|S=Kn&~as>ij0z5BX4N80OxH0yib<41Z}858m+G3^4NcJ8p?TwNX1jIcbl37r<_iY zL`2~4e?J{dN8c`_14uwhm>Zy!%1t5x4zx)PJ%s;GSJr01W4+~T@m@G+KOh4RIFGN7-;esw%CorUht{4M4OO3xrj2F(w zD9)w}XXvv4v-j(I`z#5Sv*d33g}pl*8ktM{YxvgbBPrlo>(@s$a8eW~>sKmoe}@C) zhEL$~6P(#EpVuSv7L znU+)UqL*fwA%!&st)>~JthEojp4V*Sw3*3rVMl7n8htsyw|(IFeEPU#{0VPtg0(~4 zOv!a|1x>X`6_-bLYGiRRES$~26!VPg>Z8m@R*gl_8QVr{K=$mxy1iZVo(0v@!Ke`R zjlZ%e#j5~doH&3u7)wB-7R|P@u9$=WEB15Q1-bd)PDQ<(uiH$GnLjM7F7|d!RP&DA z9ND7sBcG&*^8I@Vf#Lx62`CgZs2uEkA0>Fvm^nUT`{C_g=urKJYf)aquz2xc73+Ax zT6tz)%cpg~d;J62;oYgsGA4J1bM>*q?EObfY?stB@!qX7R`~f^uvF~TTOZOoGs^TV zmJc$bd{m_gM5Asr$faqHQGI?LSRqxdt<41nBGii%2QJD4Nm?y6Zl zeJO<~=i;{FCrQr&z#XI5nnA-p#JOxFSnrsP#9)(eNgnmlx5XLK$MJYj-u6+G|7y+e zRJ(HKe`1HwoifYbM(-l8cb4=OP5->9L23?8ChFwylG8Z1J;i8P=Nx~da&_|i7FrRJ zo4T1u5H;m@mZJ`G8vZi=&hd^ns_UBdMPhe)#GC{9R)8Avv4eisOtozXARG55;prN_ zbNXh>RMv+rIkgkcX=az~6YM;E!0@(v`(JNj00R5(Q&43XECqU}@08H#b)dk$!d z6C^f46nMu9Xs<38m=j*}+_{Fe(}!TzIWpJ*x3+V3j#h6rt#aDYku3H8_MxokE4Nt8 zTXBlwV&MHwnEVN;W!nu}x$Z3R_+BC~(=`3HA&!SfxXw_JkI$+)XKME~xpziO1T9+LIf^B2uuo{m1z;1Dp5)8)|6gm(V=9jBVy`!<{m z;cYRizmxavJ&Q0jaM@s(<$|D~fJJ;TaWC3|?2jd{dg(KKgI`>c1@K3uI}Mpb`=Gvh zC~$Ev4?$8oQ3d13}O!A7EcPQQ*muHCxnSr^5oe&*O3AnS~pJ|?Zr?{++u zZnjuaN$R1>KB=V`inTR6Aqb|u!u=1KmG{9z9xC}c2w>gsGt{|j|H3{E8#u3|Tp`VT z?B>kY{QId^r4R!Mv)*xm@=EGnSJX;%GiD}p?;wk@Uizp{BvuPc29wG=n8?9X#MmC+ zxXm)QUOk>1JJdBdyJ_Pt!!@6TiXN$W3@m;oeH|eK*;v@?3yh6Cv$7qkOcglmoa*-` zf`-~UK1Ujzfp&bTg^)UFTf(giG%z>>rWN|J@v-|`?_m`$N-e-V$ujZ6lDwTG6)iB1 ze03_l#5XkCVfApOJAW$r1uxU048$6ye|eg7wwBh z0Pi1_TD9nsAK-jAd+A(wp1t0=sH!n>4z>VhEwOSjZhL3dlOkWBhP7vxd&rD#DKL{I z#~!Magb@4P2T0oW@M8iX;pa!Ll!NP2ysxb!%pU2sKA0KVZRT9T>8*$?TE#*tX~kX- z-B!wJo>?pQXX1WO#bf~P;^%rL8S0o(R`9AMDZIdMC0OE_8insiXl$dXFA~`@w13Pt zFAlMU#`>Zw_Voz<@#znpW@C>}HTNwpi_>QDpYjjJG%oba)!ExE$Mp#x-B6~ie8+o{ zMPOk5$`!912eZidD2cR)V}d9Vc6T{}7qAR-Md?HUni5Zd!qWeoq%-4TIS=~VE+_u+ zpgub$P~R?8+Iq*yZ-&A}1M>mBDF#LCaJne>CDQVX18d6aO@rkF?^fvet^UHzWSzep z=Ty-;PfkAzZGhh%(l}O;Bz+LS3?CjgS34&Qi;1~2Sp1Bnhq{xZL|&*<@xIT)$YNvR z)HWQJoC_T%L^+^(?)sYM`huc7%UrdqYOV^4SGltGH-0W{jEsF8Q7uB) zC08w8!Pyst#0nS`N`Sq9u98h^QAft%>PHPceJ2SR8?-VV7=%c8cxoCZs!0w5s_O)6 zE`!|sBd-N!{c0OxVT1vDhC+jwT~u*@v=2vqj>48>f(O@4d_h_TT5!eg1*Jd;8U#95 zC|pjCn8-TtDa=`DlCo)H2Xl6%g7vnegu=T%#aTdTJm-;|7zY8dMVC=P2v(WB1be%C zrEqfdqhslrz$2=y4Y-1#p{#5$Kri{~eFKGz{+%SmQ_?oe@e}s?`8bkE6L0SP8vI>yos={g=uW&RMv_{!CnA_xC=(6l0iI9-2bvY26iF&9NHAHR0f zd%sCaO=7uNIArxPljyW{xhI{-rf15MQRt7Ykk`u{1$rO~7-uX%<`6#qw-?ko05(Ss zFR*d9@~?1a=3T}5v8eYM)A{3Q-~E_en^KCx_g{Y;hM*|VRQ=zRaGnqDlT7iI=Slz` zyCsTYu-s~DhW(xL%wLIxK^9eMUQ&Ff!N1j7lqZ^5GYhu2S{M*)hO6t${1sHOmTR#2o|KIinn38{Z?e)CRMCS2ui1_I- zxp`lMF~~o>g>5piP!_qpecAcvSZ&=`H96Y{7s%21EOt?pLhmPy5+Gd|43S zk)j5CxC-yySuQDR7xw1I)nRynz!g)s=U@IIARu=v;xCdPrY_E76W;hq zML(AbKI=kpZCR&bEiJKs!dgU&wQ=WnxB&MNQZb&k=PrzVALZ&1r3{XVJU)=B9h`2s zr?E%RWqW%XW4h6EHic4s1&(4MT%qKulK;EfiBbbF>IpS#<4nr4KDqg`N(v}!SMb^N zv4Rhe`X0zdd!@%5{nTB@R%bDa-}H$!y(|$k1Vt~hT5AAHy`^8D^8^$HlTeJAC^}yA z4}nZR=Q!diDoU@I=EFy^rSBXuIvAP^9u3{Sy|H>-@zYoU!?7vea>s^g^Zk2^pN&%v zRaDu4h9(;Uh-fkgPv4qAv6A0FuP#wmSuPiPRWe@twh(_=Ki@g7*=j&$bo9x1$N@e3 z!%zR*ope`@fx8~6a^VQEa~lSai#B_mbOSt#i8;fY;)Z6l_ne;V#=cD7nFZW+ zgHOe}mSWRiy$*rPIdwJa|oJ^{l)9~o8*m}?-jFG$|cl85&wK8ZwYEdyJN*^8xEM6O(wXO4E3 z{)E@T7GxCYm8O|xW*hGuMN5%XO$c>qD+j1dSJ#L+-*0mB17m25KPv)DIN+(;`8mO{ z)duJMNfI2d62PpbHE>qsw#k%S-Rkbm&OtL^$v0k#_gqSq6k}(Pe#P6aBMbzgB&8|E zN8m`vlw0}N`-f3H7pCUf-tpx&&#$E3_=RoV@c_;;7Xf(MT+Yk0S?Q29<9>;a7YRq| z<#S2Fo6fKUPbR&$Uh@lDU75O_;WxTs`4BLUk5!yjkvKr)rl{#l4k%1?D;E#OjWBB|5`rhDM~UOrmGx)sDO3`UtdUHvynGKJ^ZkEraT`@6DL}WLFAf!yncH4J^g>X z&{&Pb3*xkIV{;ZarUPHn)y5z8{ZJUx^!5>3)P5Az>`VeIFTJ*GJ5$p=p83ktdT}?h zg4}P(1*}EgN*NI$M-LynHNjPVrcJoEne_`0f(Xmz8JZo+@SZt3 zIdBv`CDj$e2T{6)Q$usrOP>z#(L-V3uGZEdeXhs|L8sA@&&c^|pFL-J$ho2cp?lFE z>5VH9Jvkd*%m-G98NB*tc*fITbCxZ+`aGoQRWLCNZ{u{7EElOBHfL?xBxE`N4ms@f zT^qUi8XV~0*4d&ei+pGj-$y)>xku3V71eN@9)gPEGv~+9)2u5Pv$Rg)^;S+L+Dz?2 zkJG=^Gy1=8^HlC2QxZ0QFu7O)Hlqk;l)<^-*%+OjcW#mh+UOsapT|#+OjKYI#(+$z zdZY97DL*xRW(-HUXfZa2HiWc037*IgxDWWLY3N0k&;GF?~dox=7J6QdW!`z%#d*Ic|e&`5Y zHSA-9zYi`?74RqA>dCXS0}vVc0JEBR?YDVk#tCNf{T&F{~aauzr<E=Hfa%TGmhtXi(FCBm1ySM!RDodFE-^!A+0T4=>?k74=)YOLNxIYzm6<^9? zTo$+Ar<~WHn|)rW)Wm*4ZLe!qf1X41+4O1J;YXT;2Y}9S_HVSGP6=LlnAaXF;46z7 z+(Fh6jQl1gQqOz4@9K2L-3~t6aL34TMe3y*e;F^F{NZ%SI+(M%;Xgv&YCkR{2m>H~tkZ<*Mm0=>bJphVbIJ$J z5y5muE(tz$J*lU^STpdymkO0pR2y#I%!qN$NPL>Ud~yu=Dp`nh`a~z+v8IkwZ~MrO z_@)eys?#XIe6YH{v$uHEWZSW((Y)0Q1adruM`DkKVaGwtDa~Kyly(maJr;5*1omqV z_2~wbMXh({&%*F*(K?^coq)&@FBeaH|1l6bxSlP>rsqH%?tB8$cfb6E4_>$6L>Og@ zki|y+xvH0z4mM%jxAHhG0oO*%EMW4z7TNX0|9|N7hx1Kl-;gI$1P6C9(p}zKjSFm_ z&N>)q=DOGT45d&m7uNoj{MWk?HY$aUc4Qy3Y24z4{!Yb1((=z9y!5f_FBuB&neC)B z3;@wR*8#Ux4^^1G=fJ@eb?se2@-0MNV=1x@zyn})%+Co(N}xk8IjbHYx`LSw*e|RI zz98J}xD$7Gt?rxLQ*+XALfrsF>O?6Hu#vCFAN4J1xHTJNFl^DX@U?K}`|*}dQ5QA+wy0Db7{-TN3%N?IKpmSF=RLd;yWaw zlR1-qXCbSny`IY7-^;rk9@1954y>qNU#$_meb?5jx@SFk?h}rgn-uVrmOrtVf;hfE^VJpv&n33;;lTnrx@ckGwvj5MsH z9n40`Xp7c)=*>_vgj-&;(Ds{%jt6xzO{4-g|^C?S$U8Vb0=2eN14T(k36-%7ehObx7>BF7>W!4HdFdyZ8`9^hSK7UXx2aNdL*GrYf2wYcy}jAyaOGky6eX5YVFV#*

uQqBc3xdgunz8_-esG6F6@8636{qN_Ur;pDVqh)Q~4=p?E3e1 z>Bq+#!p%iOrFVlQ{@OS927tW9PXG_{eBF$oZzXCWM|9f-vL^x{&mdqJ+!I-a^_jI#Y2plA)#&dqAje=A2emYg5}e2TgH_%yH$a}}R8 zAKq;mt|PM?(o;|nI?29VC&jndx+2W5w3WIFghPGOp@)AcoA$-vr4*)-$jy%y7 z#T`dUTJ;wJdpO1PqF)CgI;Y;tc$n48b`PYz!)HcE| zRs1#Lw*{nq0QgV_pq7xJdamILEoag2dKLVdcllhWpgqi}sYf z7!9nSobCnOQugm~WC+XbSAmD7Wv~U|4d_lV<-3%8XQ7NMqvI(@I%Rc~q`j$MJ28n- zdY)ney+K2wl{v z{OHUJodWvXhPPq}%bn_+S+jt>v~elAq|n5Gp2>RvxA!u$JZ}dJc(Hnhs|nFJ&zovY zfdl}@?+}L#zvNcOc9e|hm$AQXUm$fga-{VxeABbj8Q zMrGmtCW}hHIhz65vLg6ZUB+4xGyZi%6WsqYQ_R4TfMFK^M~6u98-quhu&{Uh2P6Sw z%8#twt-D(&aK6d;Yx-wSE{`F9uQddZK1Wa=4Q6--X6 zgd(9Z>9Q`lgx){PIE}gGX@5pURHXEOU&a0NH;SHh`Zqrm5(<&NC1hAK7eh+EDWWLU zr`X)Ag^#s9Er0^W9+%)!;{Rn-VtG`y{ZEkL5{cJcW?E>JOu=VIE{(EgEpHTdb%(s< ztVT`Dy#^srdcT7K+zRF*8#8R}^LSRk5hY~xa?(*Dl%8WAdX^IoF=&6`k z8I(H$Y;sv*@~cOH|IaDXOi@3nF04ii{ZOtrPV)O)TEbwtxVSTtqRaO<5 z$D1SnB&0`~S(uC70r54}BMO%~(YV>T-fA`En4y7b0b|R5M#o2voL-GtDYrMk(Q{Me z*gHE{ncRMu9ye=&7wp9e?y{PVDGGNKnfUPEN$wTzTGj0zd(3$=(|3Djuk*w1!bSIW zex`~qq)+Tmu{;?`JzzVD?srsnf2RrII9N9y@^sEx?7HPsMc&$pc2Ig4*VlimWFhJ; z%lDqKoKR^lJFWi;Ks1}i-~x`U{hZBr2_b&y#g(cfNO~8Db-oJGTyL61DPp7?5QcDI z1ELbVvSRx1$C{rfwK^5wNZ#)g;flOmpI+6 zXwBXJ#sCNkyjII_R7Fl-6Y=1DQ%O=7#xv==Jg9rgX2olibN^9#5$umibnD zK_H&fe^iAqe-hQ8hgkIZx@xYc%Hnv^)1Lt1tfF(V*>>NUM{X!Hr&o9KmO9&9$*E{i zCxq|#ktCPWM5;WZO*FHVCr3X|uL;knfMabVB+Iz&M9bD41>s`hx7Xu0XO*=?Eh{G$ zZFT(uax`AAdVDAYz>=6fo}!3Ub)!spF)n3R=uT${gyn9lM4Xn#r4!>B3#Y{jcmhJ&4#aUb{ zWd!zr1S+a0itYmSLS(BL?5Unmo>;V)A@=+I(>uXCKTSY^N8iAcj;rH<%z+4^-br^u zZE_~OyK@sVFE22|k5wRs-IdcU@w)8mpRqODml}X9+aNqwuP#_QpnIbF26RnpoO^Zm zSKfJRt3HLZ8+@r&SWn0w4Op7hF4EG(FoJrJGF(Zym`LXQ-b>tufVnJHX%uwg`+{U| zSGgsX@3W7jMd(>rX-c;% zFZoP3jtYmGSeQJV;WwZjQ*Kf)8udX?dj}0|UIk*EAP6LC={35Gw8u^Y zIvNkrD2=2vIuTx4qUrMvHtF-p>Y|!<1JK}l!XkH0RwqMBMeo+C4s%E)0G<=-) z!JD~ccpBq!K_Yj%deTotMV_Ssf$37CoQ#gO>5lDW6N-6o4VBOr)~556aMHj79^ktc z^J13Fg|bWLLzTao!(jfbFfru>WpDa*(qK%qVdpxn|1Hwo>U>w;w-@%86IzD-2EskG zXI6WCJ>hd7BigjPdL2wXXe@keQAmxnsM3Xah%5p zxHrK0Af8MD57^iakt+kqnE2mjPk-E-MKJC!?6QK+yU0TiyowJaN2&sbi~Z&H<;a9a zui<>UG?Y$rHd}t0(R_Cq61qo{9zJPnVWw>#w)ZZ3p zFa%9DKs{9Sfa^j?kDCm%V=kE!R3J2*5QxPeCBN7ktiou=}{ig-B)DS z*aLHM_?rHNyKNE65RM{4did+T^h1@gt4@4W{{lofcuc`m{mARBa6!PN{pW;+wS-)6 zFmO!5ZxRv3@lbw*%YRh;wA4EFQBg1a}p0r{!U9Y{aJpYlgUEiPL6uifopGnm9oQRk>@C#Xy6p5CBc(OT#9CQb-f zeA1rtjocm!>=!>4j;uS-7Zvl?#&GJ}<7WI$4y88#AV(CGmk{Aq^rA1n-|*Vihynkb@aJf#jjYNCKmyV@4Np3 zQoU?6DTkbphXgqi@XRwLt3?e+t2WO4W1p9y{PVW_`>aPJ&}aC39QWA*VkTrI0)(qiNcPdP3E|>ahYiu zTZkf9=Ucm<3TThq>aH9bALLy%6z;MwKf7z+4P*g*aTfbo&6keVHLirv&v~d zR6|VXZ5Y!FYVTt!(a(xpr{fEhd*O5u!K)q|an2;|R;|+I?2%<03ZYiZo(*hj;H||6 zjpM1FV)4X&M2(YBQ{Oj>pWo*9I^JKLAGIq#3$-e;lRo@G)~h{V^vMjBlXgdvrL5|y z^GuDF@bp5g5XJ3YpKs%pWoT{#w*efl42U$>Sv49QFB+P%j-O7C;OMJ5 zU@kM1+resez&_c@FS1_yDlFD+zvZ%&8QL*6U!!9qlXZR@JM58cA62=G?zp<#OR>2r zVj9g55z%D}S1pR)O-1Wv8XIs~w$B#<-g(ye!?;jd- zlj8T+jdTL)$D!KI&pkPQi=YqvB>RO3lZzS2!-o$$#DNe57;Wu2_{PSIePEJyM3-S7 zfm~h7^}E-_XZF>xpW)p${_LIc^c%jmACPu6?9dGRs8osN6*JWQ*5=lnXeSOojz0ex zt|aRBvxe4Z9_99Yd3(-4zZhrWglY+Or?+zg&y+TS8>_lVNi76+DR!pv*{n7jYWY%MzuvlGvH4XuAc@2c?mATCQi$xHs*M@J(IEWm z6Z=n$Viu=i`b3(hPiOq*8<0j>-@_>bMR!9R@LxyvC3#}ki+YIb5O&kc!^DM!7DxQG zxyqO8Q`)P)&x}%X%^4qgE@3_lrQlOfdz~<5(~>Ug0(>i*)U%85iYMm~=5N4OY8Q;k zy|W!hKv-dGwG;~dM!7Zom)mpKAf>TMw_Wg~QLPH<`l317tm#@}_v zINj|{=mH=7UO2g1Z%|c%XolmeU(^)^Y!SYzgu8SFE=>@7I~Pd06zc{E=kA2~U6uSD zEu6XZGD*hN=;Lw_$QfB5rz6au3sGAgQHv}wPSd)~w2K~EiE z;(9ZNQ^B|=`0fq%c{GWG96u4PK5o=$AO>;)I9|#p@l4m z>I|gQY6mUfa#He48%*SFj~2`5%h>d%(70>@ZrwuXazO`mMUO|R1h<`vo@#QN^iOp( za)J(b_CV{WnqIkI3Q1FE7!HXxHHpg~DAaeDQr1gJl9~cxw+MEsML}fu&?(j+SQvgD?0;k zycG09AG}kcv(-dt77HTRz*Kj4*M3;$NXB_4*y*CQ{0bbIBk9{}SX>(_P=>N(V-s6SY5xf^qqDI|UEd=f8B1ddYq!zARPjvBhZ{lbyY*`YQbl1)N`qm=- zZm#i(Bx45wqHVc&^)Zm{Zbp zOjmorR$W8A$#r?i=~4TOUg~Y82^MTCX5Be;R1uA|y4A-Hx!H|rFoSs$i)%1&J$1f` zpZ>cv(Dfa+4hfLtqPpD3@Dr}|&_^6>Ch6iVu1|ItrQDG4&(WR3?XCWgZ0h5rsi6X{ zv}trj2_$qCG-VMAp&8zW=#e(m-QJ~oUncHechoqqVHyT}ZWp=`XOVK+WOMW7vgt{m zxbE*<-6EDu*E~||1R~tBoSAnh_C`MVL9{nJ1vf$IL4J)2QqP<)B55=6&=WJ&K4VoD zoPE??1IaR8#Gug71DG?8wEN>1>_xRENl^~Ai01ni zVgf^W{@SS*;cOa_@YxE;)B*bO>mADF*5PsX*hP&_7znDYy&50@i|FoxY)tJ_?@!%# zo?c`>pfQvw90#wsN<3ph7*60~#ZP{F?92KfkWLbOP~7S|pk;t-xvTjdu;E$}-V;dg z)uEzgbzEJ(fJUK_YwUQ@i~}HKaCkyD%y(Ei>0E`4aUOQj@5^lFUY1^n?Vmg*0V!0c z>SQ*ulTu2)RW~l?3jmq$lb~a9c>S4DH7Ss)TVB*~`|4~-6|h;X^GQ&nMj?PR?3Nez z3%P*2n=xIMP0ea{yU?x4HrFhJ=o>TXyBoIP%wdc*j^i~8-3(=!^L!3|s$jX@i??!E zI$jqXU?}ZTkD9r7@(n)IqrBs1(d^F`f+nou+$p{!Xch1<@iOY;W$Mx4q<75DAB^<4 z3hAUa^g#=o6E9QM!+jGc6NHetI=i+c4&xE=3O0tUk?PL14l3x8hmyTEmhAl_Fxvc| z$#ybNabc|6P5aIWGvbimv9&E=;Wn4w{|!%K_f|qqvpZns()L2a1iVViqM7E6EZW#} zjgR7Lwnbgzo?r&XBb*>Vp$Bz_Ja?-{L6Ygi*H&S{yI%c9naOsatQPmRog8adg~wtf zO*Mq4b>jEEUDIf&yL@Ov#jRt}w!+Jg3T9yC-DAyT%1hsejgx0T6%B{pc$++)A`TuA z%XARWiF+J`7EQi$^UQ9c7m>iNmz&R>o5v4K8WV1R*@x8`B07CD!iU?pw*?MZw|TiD z)i0D<0+mJaxH2X!t02ucI625KX>-eSs!oZ^`fKUz&DRUwRnc4 z)AnT#Q1HgrQEN;Y_JByKy`-c4f*Qp*e2XJlugdn>oFA?4}qf?MlNUIBqWzKTB7Sj2O*sL*8_b*j4>LVBAyN;p#U! z%$)e;upMJgUN`|dw=+ZO-nte3om2jQwfCJ-O?BP6c2q!AR1^fPAiYYjDk2@}9hD{} z1PDb+5)~1VCPIKv1!>Y-=p+In5SmCQK#&e0l!PRN5OR4x-`DevJI*-c8~5)$JAd|0 zvgcZRtu^ObbFXJUvjQ4^pcaQdO$)1+qoYn5%39tmQ{agx%ja!&!wTcn)R3uo6VcS- zj*g^n$d+Ma7s*U>Sq7IZ`g_{!Rc@)kS<@?zW!u?T8fQ&@JbOxJ&7HsmK73}|s5{f% z@T;$HPAYI$FId}pdgdUFlU!oMB|@~N5QVeIv@zG~>haFvw9D>&&G{hP0Yfdjsj`3k88CK2db4 z7V(%8JwYVh1UbwP-3tb_u{Si^?``t?=nn@j&DQs@_iI<)8z})M465$D+MD0bDYk{i z_s|U0!NlOb#gDFE;%Mq|LOJGQ1bUUsCK|e8B8=-7iKA3D@O4I#r6C24VC_zYt9MSL!oDg85=iZ;Edsl5 ze=b8IK!4h@(NbkAcpR!4$>2&=IN?y3j)q45HJZeEM-Nz`=_U==gNHO%d@C1BZr~FT z{;iv@;hnwj-n`e%(=1%R)v0)mkqdww@QA zsx?{K-ZDZBH%=^#cUcL{?l?PU2wL2!2pWJo^j5c4`ZWGEeZ189zx>x~1OkpQN>6my zU2$A>4p{H?58O`3F`pw3U8lck{<#j~|ChU%ojo`|KvCI^sc@Us7XGSG%g=bH@{GyKW7P+)hY~!D^m&8F(M5=w&&>oin6q-!lY0*z zcKs`2@kwBT=K&OD*UrGULVHsGgRKU6s2t#=$DLBmqnOXGX;8RuqkCo0XZPDFdFS(w z*j5yEl||65o#)ZPLVUpD(NwiF__C-7J68X8;z zaXw)^NQ@ZGBjR)^vO1;nFV?$*L%zt(0dX-zF!%T66K~u5|GZhNVWaT*wfTgyQ1jGe3bj5Ve_jT`9Z*mo5#g&_>Pc zn%aAVE>5#&)Fa1Vdwo5{CFfQCmi^T90}h>+NA7<$I_AvUc1Y{^$D<8;yt;a7Y>xrGI_Qr!-Usuxx79dS>RRAO_C7tPnW4LrYf-SnJM760=9crCipE zr1dPVZ9bR|#+v0hK|Hm;x2kTt=$j*mvY8wl%d(0^~YzfD0 zWjQx4410gEt-p3(&#LOWJE_5A`O~F^2e}F&h=~NkGhb<+FJ1Rj zx=dJSYTLMZ@wQWLOCU;q&^l#o34=AMwlC`)@)g!K(8{P8w+OtW!(|F@mTamq^JiFd zTJxVLR$Ys|3!JsIDc65UeRiQg^=+||%|}+6;Ip5W+%KZUG|j-z7s5ySg#_Sn`TLyC zioD+=pXSLF~~^9I!DH`gpId-q*>H-W~&@gWvZ++bAB(!P&BYLt#U^m=V#&*QB0R zQ{E#2q{qw-pNO?LHDfyUadnXr-g)f&`eWuRo>-*v3|dh6g>iu?;811N_2@i09r^P# z*N||@k1C?i0va}AVEz>L+`~SwC_FqUmN~Ci zCWh{}2WNJbg=tuFmGdMSeP_~Fq$emiPtaF?wyK%0a0)S3Uf}A9N{_y6X<;)sVryeb z6B%q7Nq;+(^z0}iYh~PGSV{3^ce&H{q&Hlyz8}j z@TL^gqbZAhkV0cuSFbLn@a@F!x{HmfP)!;sH>_d*?i5Z2D)(sd)@)V@yKP|8Rd-Dd zTn-XgkNf8PLRX>pGULabx72ks8%Q$cu_~J{((WrRahkB=o!7T;by2(?gDD-?c;X;c zAN$=o=xl4h43N;1HdpMsjS~%AlyQbhGKm2uebX5!Ge7TJo}8A7GN~J_N<@;fnuxV@ zLh3=rPX>LTwt-2~LhTVE_tpbYRb>r#8QV5UY|4jPv5bVcT>}DRx&Xa0_nBMO}HoGX5xeUp3IEu5& z{MvZRklWoaW-*;bagXH#L*z2I6*}WlWi|GlyCZgI!ALpwMbi>17`g}m-iSFMq>Ec! znfqA97vQbcHba6!rAN)?;aVHjBNYLN7`PJis)g|gf_o#zB*$!CjZ=s)Pn){ds!E&I zfJ^w*TE#8a)U2e7jH}H4$o~eb##VL%cIcszd3*JNy88V{u0``7qA`ygz&d1q%^b-! zX;uJB=f)G_=+V!?l~b4Fph~hr8+~bd)lUK6x+MKw?~Bs>#z)lW8q0hM4fza7j#7x& z=Tz&;VBdRvIi!W#xh+m8{S^@{hlPkY8pZV8c7K#7n%Y@(?uv3?lZ8rw1(WKqVo>GDEdYr@2%$Pol8&%%HF- z%~K;oOf_lAS&{B4o#NwrkGUYY18wF5I6Dppl=7&=@xK1Pr9EPXj4ShFv>;P89dE44 zB}BY~l1Ly|KF+G2Zz-EymD1-~g(o*E^;|Xwbp?EBc0|f%d4QADJ`Y`MT^3bv-VL9` zCaQ~m?!obSu0!#Nsr(>UXQqot&002omGo9RR`-Cn*?RW_>PslXd2*-g^G|6%SD*=> zZupbZpb!#537ErF)&n?WkjUlpjU^G&K4?hozertl2XHwnmf$q2O9RZ0mn>PG5CTtV zB%{Qn_1G&Z`~VP`l4_7J9Wf~7BbZ44Ja_YH2FU|D&Z#QQ6koJLnT8n;Xb%l|%gdiT zb6zpn608k$!pruAeGvkyOG_d34`Q1B7dw#COFaq@nrb1vYKA%LdVB;F@GP!+c?wtH3MbTQB1SrZA zvnZ>Qy}~IkvSGUysvENrMtt3)Ngy}I|;O`dmWl>JQdY}27z9&?*$n_nx zAQAL~V=U=gNw|nDa1{;@mzG>@)~WvdlX>aM+YdGgLaQh9974U8bNv;S&YCP5zP& zs(%4#8ip|~^zai;#~K?bNMSj;aF*PDlx$oI;zfm&Fb`6KyI4M_Ci!{{8nzH^Jeg6iu!0p_ob<4N5OFwT{Fmg33*tSH<{=sACSDFj!2I~3r+>V*>%w{r#X4&{ z#YdvP%Y(lc<(%GtpJ6H_&4^()4 zS7B=Ji$f3-tXf=NZ|8tSK{!pPAmpB=-2-}d&5pBhEGQZnxI5Gb$veqi^m<7FuL-#z zZYKf%(1SWg4_z^60~J;-qz5DSPh_->`3#(~)^}@*^&F6_bv7-Gw*u+~j{A`6dodN( z{Ng^9{lQX1VM?;;?A}w}4r+18bD16q7HShFH$%f`B;2PDOE&)nGyNsQp5LoTT<@X1eGVV&=nsshxp3~cLd zVNO-A#jK%)l=qi6LprfT($Cq-$y1|*_!W`DUvBCp!#;Zj_2;wvN{Z|l*Sb@tS20q* zR8HqU<$tGLOBBv6ExO~A;c?&DIv6usL>{hL9@8yv#6r@ec-TryWol&|9UP2DaDJAu zq?rQCS*}K(*=%YiA=I^lJ%7RD!yWdaorf7pG%cL%Py=(Z&mDJ^VAW*IbIW9G2QK1_ zuR1m#)7yc0BT!qy8h8;F24Z}u$`t-~%%l}|bn$)h%4dGxYaz8S9*lUi+{uddLEDGR zY;;EYr=f+VWT{uVG~fPwYeY`%a>6LJHpIE)8ez%@&vsQ|n^w4!&T$LL2E=NUZ1nVR ziym#{QvCwR&B|@ zO~z`1AC686*4p`bnUHJr0@o4dmGj)#?Pf4-2&52x=ffgd!aS#98|=k3z*KT%*`zN- zvTUFke~oRHdN2jC;V(MXAa&DJ+=(SUR3NfGpUWERFN+~Hk_PLui#ux40j(Ka-*AXi zH-uARB1W)U7X@09`l7f1zBdCHv$}-3>$$r1E)Qrhl9Vd>v=2(r-6cEDMkUUb@&Z(L z>FarPUE*g@wg`A*EttFL`B4o*u_pAF64a}J?UeG*vnLry1cC>X83SU#?)EKohvP|0 z6J~sl&$6%gnf3WO#+AC2Pb7Hn=h=nAOsx*IgIzC z@taxio`T(E4;y>_s!3;i+#}|qDt~M7X{IangIK>!$IBZ&+mA)HU5Px1xiirhgZ)IT z&YhQfgjqvi^_y$_0I3=<*omZ&P6xv4z%fFa&7*2YHs3<)WK&{(M)7-aaRP65}I)R^iSC8?XC9f#8wCn}5A zS<3Vm&XuybfjF^2q%XTk5FzE=af?doJn{75bVc~psNHpEkU66WAUg2FH+6Qny;mhl zr0qgxnV4{xkac0zI5y~V(%tZtq1rMT(pd3X8%#p<4i(4*#O(FC5e{!C&-Yf@oq($* zICsQ=%T=bX5REVX z*+fvf-%}&EJcsB}+@e*TwDjWxI+08lGS>|wbk^{qLeks9Ur8D?Ga=#!BvmNrwL|ux z6(Q8WZ?Wdpve^+(E^s>S9Xvkb+nt%xVmjxXt^JCMXQ82Pu$uLIic?E0Jn9bjt8=mve(-3OXVMj)+A5VaR#C69;Q-qx%uHsyl^+;bUm8e@+_bL3z@U2 z5z(=9-TXDSE7g+0+;aRYm1-G0;4O!ZN=((@*8Gk?|N4K0U3vST^BP^ z{X?L`@Z>(n3BYayav1+UCX?PbDv8s_jl{yiCB}=XixV~-vcZS1dqbW8FKXl2r%YUW zHQYs(()eeY?%_OwSy;sEl7U9CM_xSLber_35!2?f_Dy>(!ug!;7}f5I$rF`cHi4}K zvX|G2vA^$qN+1pA@wh7wN=V3a`~ZFWr0lEMDFfu0pF)oY()T`r>|qO~G0ka#nZ&&; zFK}nJgIdS_;!=L-SE@MSx?CRhc`#^zUwCGgBl{+J6%GR5+1LZ1E}S+Cqqx64ewjC? zwO(USTb)*P88mQ2ykD8KZ&YocbL^Cr)k`nlu+TLe|3F-SSo(9TMz#$KU=&xrZ=PF| zDb;@Tk{y1aZ`@|!457^IDNN!ZWCb@Wd-1-4X|J4)B^F^#(^a_bS{Sd}m<~ zka_W>nd|4DCx&$zuRmx>SZDeY)(ws4^aF*V9Sb7%+WErdh0Nfbsp*>H@79Hu+aH+E z&mC^1%UItn)Y4M<1r$)Wir6 zErR5J_+ORicM|U=w6VY3#&o@}&QhX9*LhecR{or6t6+8RnKmnrpWgd<29IfE**GaF1J>d7y=U`VZQH*XlwxnKSZFD*c7@;yuW+;2+ z`p5)cXQ}iQW|cRToj-70jrj~+cKfdxJR?$uc5!ZRdt+f5#nIXl>bn_Po zZAx9kSsRh44XMsX1h@`;K{@toP77pE?Ge!va9ctkWQrgw&1Za9xi#Iiq$6*ig5;E& zlzz~U9q97P4$(uxgA+-aZE_Lo0&X2s9T#*PdQ^>=c(~snJVH-GSBLv5Hmx7{p^CbN z@G?uoKU3(;g1kqMxOE7*{&$H>9hb4wT3lDl3PO+r8tZDZnrL@_+qFB4vFs%m_>wjW zcQa_P(q?GOl3BKb7hlXNL@KxEMR$QzO6it54;k)e9wo>6r{DA1HrlyN)x?Jj936xn zuYLM}zu&eNHin7NoqVbF6X?JG;`<)z zr|n^tTB<*4x@?NoVcLBEYST&fJ9eisC6edHDhbzZNRBZgDko}}eA?DW73zn>vzLI7 zEA`%U-?1B$^$zxY%^_5yzBG9Ud&@;GVc!|Fn}ze)Sfq+fXTg(*01Np!K~s^nXx1yS zc>W+@;&%TK+HpNjwxz0Pny+8xTw@7%_!$#?#QTbjSmmvnXvZdgKTKNCqV-;K`cK?P z7eNp<=%Xxe>>1vW{fE?HcdzA3I<@sFV>p#n^`B3$saBWBrmq99g{;Y2d(!-V@S zB?rj8_sa(}tk1HJkezJIri9#4^7EeVuXtPyzXUEC22@@UjpT8%shhrh#z74glsF-3 zgO<|VuaU2&+MGdhQ;HP3=6bMiZOFL96HMUMK1fcBE9%S&Kqpbl&APut6U_2FJ#AFs z%I&XT04cq}$8sD<`Suy@u@y@->2$S+D0Vcbtj{}g>YYsg`di&Ol*{5h3Rjv@FVdH7 zc^hbHN9I!LECWdU#{F5RC%L>J->ckCYZlO>S2nIRF`|1T9Wvv_fLbfP#r))Ejaa>a zA65G~iH|cXFnK~k&AZ`bm7sacCGQ0Q(5lN%aYZgRqJsX)^9cpI2|zAE6c;%~14rC3 zYB!pd30XyxQ@HziFE}M@@3yqWxMbAN-!F3jb=uz)Y%K3N@S$sqcR$Fomd0F_&(6my zuL95T_4&?zJ4F+m!eeTu%*{wNa?GYBFW>qTG4^EOx>R>g+sn*LIbUw2j3bsg0DM+* zydgq*IoS&;n4r$_{p1AZ#ls#YY(v{A3o9Uh%e_xMMhlk8->>r+egL*eU71z98z?JM zMI+(ww0QgFXHAd})s2cl?+>6)>UpCIs6Pgu5Ikf;+2lRs0X?Y8h#h}>FIVk>RrhJ#LUH#*89|>@>0V6%9K=kUp`AEUizEthJfaj zz>vWrx=O!>O`@Nx^YT@Y_vNG7OG7f;6Ct8J)eig%)z?{COLw^5`-63*nE+RRg*qVg z&)BWdd{+9?cJ1*2&J7a>V7p(}A~H-4=&IKFsUo^oqEb(TWD{rme@Xy4m0b8mxF>4+ z5`vFIykye9IHLq{S;xjUx&^9U=O~JMZj-+9CV6L5@`sKbOabqIbffBhwTIA8I ztl;$(i9wEItfiwO&CRPoOCH1xnPsgq&MQs*DQ_HaA1#!Pq&WDlaGEEFCFa0-?A$!J^}&vGDA)Pb-Fpj({oTdTue`w@|Nw3oK@U?pns&t76d-bSPs#S7|qZhBI*j z{0qW(=w(~plk(NNCL-Q15IV9)%PqFs<)9KG@iSsm=!t{I{ObtsJ=9-(`lyaMgZf}| zb%D_&WDlw4Tgl3;toaSy{rXgL=IBUl_fRw2!tR`_L{@GRgRHiWBm$hz7N-4E7Ymll z#izL$`Q3zHb1R$eKcU+!!Z3u$?=tM5_fMGt7_^&I!cVuIXJl~wK3>sBDP;K1vuy5i ziCZ8<+_)^iXq??0~T6PaIcS@5zuB)-sw~{iwdmj z?_$oxziufM|Fq4kvxwz)+}&b)WK-=s&HrCAQV)KgBlI!q1qZ7JeMk(*og_xrzJjSG z<~JCBrd$BRHM1g6zlV2%D*)^%Mk6)9pFqy!M95c#-{;~=e}en|B)9#yUY#>!D%vO4 zqK^Njra1IMx%?kKfd964|7+0vk7EDR!ScW2{@)etf7|Z=$F}n#?@>XtvYcYO4J|Hw;(YiC{l`4Jxb$Zr7}_TaXHjCW{|U}Hy~3i)%2^=!&p7&2 zen;(Ylp5@hc|Ur^?B8Vkn~DGDj;~z*lsFR|$0h4|K#7&ENOt0r}qxZe-RKVn_ zy**+-Va+(sn%D1`dc&H5m*B5zHNHDmg%dJ;>{TU*FxOk2 z_Bu282J_={8ygS)xT;CQYFq)zAvCr{pH3xI-1JV9&LkHhnx!a?_k@*phHk-rbd+QKi z9XB>e;)CM#A-{T_rV$j>-@a7&9n()~Zi?>wR^)?E0`}ag@%76f{q%F-NcO*D)vlfg zLPCt)B4%Enx;L~i7%MhD`f#Z*uiCn%6`(@>HaX#B-hNC7WaEiHO-UW=E1s@@@t6WK zUGFxo_tU3b#6D@JUx~P=49^6_E_l+&h;8d-yGNIc-iH-Fqcy#tcuE?a&*UgMy-KuH zo*wM$Pzo&5M+q$9R9Ec7=i6T^1qJDeI*AB&@6x^m)`uWPRol;hEQ@JB_NrLtBWb|( z@1f`Qyr(PIowDG4K}%fyWWDg#WxbE564T-}lQI#WtnOt^fr2F2jg<|R(PmLJ|57VV z9&g<^tDaQD5uh4RTk3U5xp;4M9wH>c=jm-jCqFo4Dto7ma4wAvbTu)tlAa&br4ZIuC@;(EZS+Wu7&k3~`bIx4CxSsN~ zWns9gmVuQzN~e?ZOW3-1id8nWikIJS_s|9j&K>XbJX11dS`&Fb;eLqiz^D`=!CCWy zkO8-%A6@J6o5pPm;w|NJc-TMnj;Qz3;pu9fwWSujcs);^V6!kNy_OOmt6IWT6xH*- zXxDwK=gwS;Qh8DO>r5M=(DzOJI!oH+(#~PVJ7vU7$Yh0E(S0vPdyl&&`Nb%v!-xdm zx}l2t{sr|Lbz{8$XyZlN%k`q#T~))$69N;p#ZD)AK60Z-xY7`RREN}uXZpSNmjbuL zLI$Wk1x+V*)@ov4+ARS8+FL?3*F=RK&0tD~8mb%zecr6%X zv&;0IWpi94|JFM=0@#KQ|h18 zd%&KV6sJKKh{}0*tmMx<`m4_2Wnf3?d!^-bCvm17`ixtdx5?~`#FqVso|AQ36vcq` zv83O&w#|v>*#3^u-Y-1UOuKFUPF!d6a-fy>B5( + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ports/silabs/supervisor/internal_flash.c b/ports/silabs/supervisor/internal_flash.c new file mode 100644 index 0000000000..c260649c63 --- /dev/null +++ b/ports/silabs/supervisor/internal_flash.c @@ -0,0 +1,138 @@ +/* + * This file is part of Adafruit for EFR32 project + * + * The MIT License (MIT) + * + * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + * + * 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/internal_flash.h" + +#include +#include + +#include "extmod/vfs.h" +#include "extmod/vfs_fat.h" +#include "py/mphal.h" +#include "py/obj.h" +#include "py/runtime.h" +#include "lib/oofatfs/ff.h" +#include "supervisor/flash.h" +#include "supervisor/shared/safe_mode.h" + +#include "FreeRTOS.h" +#include "task.h" + +#include "em_core.h" +#include "em_device.h" +#include "em_cmu.h" +#include "em_msc.h" +#include "sl_status.h" + +#define NO_CACHE 0xffffffff +uint8_t _flash_cache[FLASH_PAGE_SIZE] __attribute__((aligned(4))); +uint32_t _flash_page_addr = NO_CACHE; + +STATIC inline uint32_t lba2addr(uint32_t block) { + return CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR + block * FILESYSTEM_BLOCK_SIZE; +} + +void supervisor_flash_init(void) { + // Enable MSC clock if supported + CMU_ClockEnable(cmuClock_MSC, true); +} + +uint32_t supervisor_flash_get_block_size(void) { + return FILESYSTEM_BLOCK_SIZE; +} + +uint32_t supervisor_flash_get_block_count(void) { + return CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE / FILESYSTEM_BLOCK_SIZE; +} + +void port_internal_flash_flush(void) { + if (_flash_page_addr == NO_CACHE) { + return; + } + + msc_Return_TypeDef ret = mscReturnOk; + + // Skip if data is the same + if (memcmp(_flash_cache, (void *)_flash_page_addr, FLASH_PAGE_SIZE) != 0) { + + MSC_Init(); + taskENTER_CRITICAL(); + ret = MSC_ErasePage((uint32_t *)_flash_page_addr); + taskEXIT_CRITICAL(); + if (mscReturnOk != ret) { + reset_into_safe_mode(SAFE_MODE_FLASH_WRITE_FAIL); + } + taskENTER_CRITICAL(); + ret = MSC_WriteWord((uint32_t *)_flash_page_addr,_flash_cache,FLASH_PAGE_SIZE); + taskEXIT_CRITICAL(); + if (mscReturnOk != ret) { + reset_into_safe_mode(SAFE_MODE_FLASH_WRITE_FAIL); + } + MSC_Deinit(); + } +} + +mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) { + // Must write out anything in cache before trying to read. + supervisor_flash_flush(); + + uint32_t src = lba2addr(block); + memcpy(dest, (uint8_t *)src, FILESYSTEM_BLOCK_SIZE * num_blocks); + return 0; // success +} + +mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32_t num_blocks) { + while (num_blocks) { + uint32_t const addr = lba2addr(lba); + uint32_t const page_addr = addr & ~(FLASH_PAGE_SIZE - 1); + + // Up to page boundary + uint32_t count = 8 - (lba % 8); + count = MIN(num_blocks, count); + + if (page_addr != _flash_page_addr) { + // Write out anything in cache before overwriting it.*/ + supervisor_flash_flush(); + + _flash_page_addr = page_addr; + + // Copy the current contents of the entire page into the cache. + memcpy(_flash_cache, (void *)page_addr, FLASH_PAGE_SIZE); + } + + // Overwrite part or all of the page cache with the src data. + memcpy(_flash_cache + (addr & (FLASH_PAGE_SIZE - 1)), src, count * FILESYSTEM_BLOCK_SIZE); + + // adjust for next run + lba += count; + src += count * FILESYSTEM_BLOCK_SIZE; + num_blocks -= count; + } + return 0; // success +} + +void supervisor_flash_release_cache(void) { +} diff --git a/ports/silabs/supervisor/internal_flash.h b/ports/silabs/supervisor/internal_flash.h new file mode 100644 index 0000000000..898376e9d6 --- /dev/null +++ b/ports/silabs/supervisor/internal_flash.h @@ -0,0 +1,38 @@ +/* + * This file is part of Adafruit for EFR32 project + * + * The MIT License (MIT) + * + * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + * + * 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_EFR32_INTERNAL_FLASH_H +#define MICROPY_INCLUDED_EFR32_INTERNAL_FLASH_H + +#include +#include + +#include "py/mpconfig.h" + +#define INTERNAL_FLASH_SYSTICK_MASK (0x1ff) // 512ms +#define INTERNAL_FLASH_IDLE_TICK(tick) (((tick) & INTERNAL_FLASH_SYSTICK_MASK) == 2) + +#endif // MICROPY_INCLUDED_EFR32_INTERNAL_FLASH_H diff --git a/ports/silabs/supervisor/internal_flash_root_pointers.h b/ports/silabs/supervisor/internal_flash_root_pointers.h new file mode 100644 index 0000000000..16694d5dac --- /dev/null +++ b/ports/silabs/supervisor/internal_flash_root_pointers.h @@ -0,0 +1,32 @@ +/* + * This file is part of Adafruit for EFR32 project + * + * The MIT License (MIT) + * + * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + * + * 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_EFR32_INTERNAL_FLASH_ROOT_POINTERS_H +#define MICROPY_INCLUDED_EFR32_INTERNAL_FLASH_ROOT_POINTERS_H + +#define FLASH_ROOT_POINTERS + +#endif // MICROPY_INCLUDED_EFR32_INTERNAL_FLASH_ROOT_POINTERS_H diff --git a/ports/silabs/supervisor/port.c b/ports/silabs/supervisor/port.c new file mode 100644 index 0000000000..b5deebf979 --- /dev/null +++ b/ports/silabs/supervisor/port.c @@ -0,0 +1,336 @@ +/* + * This file is part of Adafruit for EFR32 project + * + * The MIT License (MIT) + * + * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + * + * 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/background_callback.h" +#include "supervisor/board.h" +#include "supervisor/port.h" +#include "shared/timeutils/timeutils.h" + +#include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/__init__.h" + +#if CIRCUITPY_AUDIOPWMIO +#include "common-hal/audiopwmio/PWMAudioOut.h" +#endif +#if CIRCUITPY_BUSIO +#include "common-hal/busio/I2C.h" +#include "common-hal/busio/SPI.h" +#include "common-hal/busio/UART.h" +#endif +#if CIRCUITPY_PULSEIO +#include "common-hal/pulseio/PulseOut.h" +#include "common-hal/pulseio/PulseIn.h" +#endif +#if CIRCUITPY_PWMIO +#include "common-hal/pwmio/PWMOut.h" +#endif +#if CIRCUITPY_PULSEIO || CIRCUITPY_PWMIO +#include "peripherals/timers.h" +#endif +#if CIRCUITPY_SDIOIO +#include "common-hal/sdioio/SDCard.h" +#endif +#if CIRCUITPY_PULSEIO || CIRCUITPY_ALARM +#include "peripherals/exti.h" +#endif +#if CIRCUITPY_ALARM +#include "common-hal/alarm/__init__.h" +#endif +#if CIRCUITPY_RTC +#include "shared-bindings/rtc/__init__.h" +#endif +#if CIRCUITPY_ANALOGIO +#include "common-hal/analogio/AnalogOut.h" +#endif + +#if CIRCUITPY_BLEIO +#include "common-hal/_bleio/__init__.h" +#endif + +// Include headers of EFR32 +#include +#include "em_chip.h" +#include "sl_cmsis_os2_common.h" +#include "sl_component_catalog.h" +#include "sl_sleeptimer.h" +#include "sl_system_init.h" +#include "sl_system_kernel.h" + +#if defined(SL_CATALOG_POWER_MANAGER_PRESENT) +#include "sl_power_manager.h" +#endif // SL_CATALOG_POWER_MANAGER_PRESENT + +#if !defined(SL_CATALOG_KERNEL_PRESENT) +#error "Error: Requires SL_CATALOG_KERNEL_PRESENT definition" +#endif + +#define SL_CIRCUITPYTHON_TASK_STACK_EXTRA_SIZE (32) +#define SL_CIRCUITPYTHON_TASK_PRIORITY (40) +#define HEAP_SIZE (88 * 1024) + +extern uint32_t __bss_start__; +extern uint32_t __bss_end__; + +uint32_t _sbss; +uint32_t _ebss; + +uint32_t *heap; +uint32_t heap_size; + +STATIC sl_sleeptimer_timer_handle_t _tick_timer; +STATIC sl_sleeptimer_timer_handle_t _sleep_timer; + +// CircuitPython stack thread +STATIC void circuitpython_thread(void *p_arg); +STATIC osThreadId_t tid_thread_circuitpython; +__ALIGNED(8) +STATIC uint8_t thread_circuitpython_stk[(CIRCUITPY_DEFAULT_STACK_SIZE + + SL_CIRCUITPYTHON_TASK_STACK_EXTRA_SIZE) & + 0xFFFFFFF8u]; +__ALIGNED(4) +STATIC uint8_t thread_circuitpython_cb[osThreadCbSize]; + +STATIC const osThreadAttr_t thread_circuitpython_attr = { + .name = "CircuitPython stack", + .stack_mem = thread_circuitpython_stk, + .stack_size = sizeof(thread_circuitpython_stk), + .cb_mem = thread_circuitpython_cb, + .cb_size = osThreadCbSize, + .priority = (osPriority_t)SL_CIRCUITPYTHON_TASK_PRIORITY +}; + +STATIC bool isSchedulerStarted = false; + +safe_mode_t port_init(void) { + #if defined(SL_CATALOG_KERNEL_PRESENT) + + if (!isSchedulerStarted) { + _sbss = __bss_start__; + _ebss = __bss_end__; + + isSchedulerStarted = true; + // Initialize Silicon Labs device, system, service(s) and protocol stack(s). + // Note that if the kernel is present, processing task(s) will be created by + // this call. + sl_system_init(); + // Create thread for Bluetooth stack + if (tid_thread_circuitpython == NULL) { + tid_thread_circuitpython = osThreadNew(circuitpython_thread, + NULL, + &thread_circuitpython_attr); + } + + // Create mutex for Bluetooth handle + if (bluetooth_connection_mutex_id == NULL) { + bluetooth_connection_mutex_id = osMutexNew(&bluetooth_connection_mutex_attr); + } + + if (tid_thread_circuitpython == NULL) { + for (;;) { + } + } + // Start the kernel. Task(s) created in app_init() will start running. + sl_system_kernel_start(); + } + + #endif // SL_CATALOG_KERNEL_PRESENT + + if (heap == NULL) { + heap = malloc(HEAP_SIZE); + heap_size = HEAP_SIZE / sizeof(uint32_t); + } + if (heap == NULL) { + return SAFE_MODE_NO_HEAP; + } + return SAFE_MODE_NONE; +} + +void reset_port(void) { + reset_all_pins(); + + #if CIRCUITPY_BUSIO + i2c_reset(); + spi_reset(); + uart_reset(); + #endif + + #if CIRCUITPY_PWMIO + pwmout_reset(); + #endif + + #if CIRCUITPY_ANALOGIO + analogout_reset(); + #endif + + #if CIRCUITPY_BLEIO + bleio_reset(); + #endif +} + +void reset_to_bootloader(void) { + CHIP_Reset(); + for (;;) { + } +} + +void reset_cpu(void) { + CHIP_Reset(); + for (;;) { + } +} + +uint32_t *port_heap_get_bottom(void) { + return heap; +} + +uint32_t *port_heap_get_top(void) { + return heap + heap_size; +} + +bool port_has_fixed_stack(void) { + return true; +} + +uint32_t *port_stack_get_limit(void) { + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" + return (uint32_t *)thread_circuitpython_stk; + #pragma GCC diagnostic pop +} + +uint32_t *port_stack_get_top(void) { + return port_stack_get_limit() + CIRCUITPY_DEFAULT_STACK_SIZE / sizeof(uint32_t); +} + +uint64_t port_get_raw_ticks(uint8_t *subticks) { + uint32_t timer_freq = sl_sleeptimer_get_timer_frequency(); + uint64_t all_subticks = (uint64_t)(sl_sleeptimer_get_tick_count()) * 1024; + if (subticks != NULL) { + *subticks = all_subticks % timer_freq; + } + return all_subticks / timer_freq; +} + +// Periodic tick timer callback +STATIC void on_tick_timer_timeout(sl_sleeptimer_timer_handle_t *handle, + void *data) { + (void)&handle; + (void)&data; + supervisor_tick(); + + // CircuitPython's VM is run in a separate FreeRTOS task from timer callbacks. + // So, we have to notify the main task every time in case it's waiting for us. + osThreadFlagsSet(tid_thread_circuitpython, 0x0001); +} + +// Enable 1/1024 second tick. +void port_enable_tick(void) { + uint32_t timer_freq = sl_sleeptimer_get_timer_frequency(); + + // Create timer for waking up the system periodically. + sl_sleeptimer_start_periodic_timer(&_tick_timer, + timer_freq / 1024, + on_tick_timer_timeout, NULL, + 0, + SL_SLEEPTIMER_NO_HIGH_PRECISION_HF_CLOCKS_REQUIRED_FLAG); +} + +// Disable 1/1024 second tick. +void port_disable_tick(void) { + sl_sleeptimer_stop_timer(&_tick_timer); +} + +void port_wake_main_task(void) { + osThreadFlagsSet(tid_thread_circuitpython, 0x0001); +} + +STATIC void on_sleep_timer_timeout(sl_sleeptimer_timer_handle_t *handle, + void *data) { + port_wake_main_task(); +} + +void port_interrupt_after_ticks(uint32_t ticks) { + uint32_t timer_freq = sl_sleeptimer_get_timer_frequency(); + + uint32_t timer_tick = (uint32_t)((((uint64_t)ticks * timer_freq) + 1023) / 1024u); + + // Create one-shot timer for waking up the system. + sl_sleeptimer_start_timer(&_sleep_timer, + timer_tick, + on_sleep_timer_timeout, NULL, + 0, + SL_SLEEPTIMER_NO_HIGH_PRECISION_HF_CLOCKS_REQUIRED_FLAG); +} + +void port_idle_until_interrupt(void) { + if (!background_callback_pending()) { + osThreadFlagsWait(0x0001, osFlagsWaitAny, osWaitForever); + } + +} + +// Place the word to save just after our BSS section that gets blanked. +void port_set_saved_word(uint32_t value) { + __bss_end__ = value; +} + +uint32_t port_get_saved_word(void) { + return __bss_end__; +} + +#if CIRCUITPY_ALARM +// Board deinit in case boards/xxx/board.c does not provide board_deinit() +MP_WEAK void board_deinit(void) { +} +#endif + +extern void main(void); + +void circuitpython_thread(void *p_arg) { + (void)p_arg; + main(); +} + +__attribute__((used)) void BusFault_Handler(void) { + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); + while (true) { + asm ("nop;"); + } +} + +__attribute__((used)) void UsageFault_Handler(void) { + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); + while (true) { + asm ("nop;"); + } +} + +__attribute__((used)) void HardFault_Handler(void) { + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); + while (true) { + asm ("nop;"); + } +} diff --git a/ports/silabs/supervisor/serial.c b/ports/silabs/supervisor/serial.c new file mode 100644 index 0000000000..01aaa49835 --- /dev/null +++ b/ports/silabs/supervisor/serial.c @@ -0,0 +1,156 @@ +/* + * This file is part of Adafruit for EFR32 project + * + * The MIT License (MIT) + * + * Copyright 2023 Silicon Laboratories Inc. www.silabs.com + * + * 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/mphal.h" +#include "py/ringbuf.h" +#include "supervisor/port.h" +#include "supervisor/serial.h" +#include "shared/readline/readline.h" +#include "shared/runtime/interrupt_char.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "py/runtime.h" + +#include "em_cmu.h" +#include "em_core.h" +#include "em_gpio.h" +#include "em_eusart.h" +#include "em_gpio.h" +#include "em_cmu.h" + +#define CONSOLE_RCV_BUFFER_SIZE 4096 + +#define EUSART_VCOM_TX_PORT gpioPortA +#define EUSART_VCOM_TX_PIN 5 + +#define EUSART_VCOM_RX_PORT gpioPortA +#define EUSART_VCOM_RX_PIN 6 + +STATIC ringbuf_t con_uart_rx_ringbuf; +STATIC byte con_uart_rx_buf[CONSOLE_RCV_BUFFER_SIZE]; +STATIC volatile uint8_t received_data; + +// USART0 RX interrupt handler , put characters to ring buffer one by one +void EUSART0_RX_IRQHandler(void) { + CORE_DECLARE_IRQ_STATE; + CORE_ENTER_ATOMIC(); + + received_data = EUSART0->RXDATA; + if (1 != ringbuf_put_n(&con_uart_rx_ringbuf, (uint8_t *)&received_data, 1)) { + mp_raise_OverflowError_varg(translate("Console UART RX buffer overflow")); + } + + CORE_EXIT_ATOMIC(); + port_wake_main_task(); + + if (received_data == CHAR_CTRL_C && + mp_interrupt_char == CHAR_CTRL_C) { + ringbuf_clear(&con_uart_rx_ringbuf); + mp_sched_keyboard_interrupt(); + } + EUSART_IntClear(EUSART0, EUSART_IF_RXFL); +} + +// Configure EUSART0 for REPL +void port_serial_early_init(void) { + + // Enable clock to GPIO and EUSART1 + CMU_ClockEnable(cmuClock_GPIO, true); + CMU_ClockEnable(cmuClock_EUSART0, true); + + // Configure the EUSART TX pin to the board controller as an output + GPIO_PinModeSet(EUSART_VCOM_TX_PORT, EUSART_VCOM_TX_PIN, gpioModePushPull, 0); + + // Configure the EUSART RX pin to the board controller as an input + GPIO_PinModeSet(EUSART_VCOM_RX_PORT, EUSART_VCOM_RX_PIN, gpioModeInput, 0); + + // Route EUSART0 TX and RX to the board controller TX and RX pins + GPIO->EUSARTROUTE[0].TXROUTE = (EUSART_VCOM_TX_PORT << _GPIO_EUSART_TXROUTE_PORT_SHIFT) + | (EUSART_VCOM_TX_PIN << _GPIO_EUSART_TXROUTE_PIN_SHIFT); + GPIO->EUSARTROUTE[0].RXROUTE = (EUSART_VCOM_RX_PORT << _GPIO_EUSART_RXROUTE_PORT_SHIFT) + | (EUSART_VCOM_RX_PIN << _GPIO_EUSART_RXROUTE_PIN_SHIFT); + + // Enable RX and TX signals now that they have been routed + GPIO->EUSARTROUTE[0].ROUTEEN = GPIO_EUSART_ROUTEEN_RXPEN | GPIO_EUSART_ROUTEEN_TXPEN; + + // Default asynchronous initializer (115.2 Kbps, 8N1, no flow control) + EUSART_UartInit_TypeDef init = EUSART_UART_INIT_DEFAULT_HF; + + // Configure and enable EUSART0 for high-frequency (EM0/1) operation + EUSART_UartInitHf(EUSART0, &init); + + + // Claim and never reset UART console pin + common_hal_mcu_pin_claim(&pin_PA5); + common_hal_mcu_pin_claim(&pin_PA6); + common_hal_never_reset_pin(&pin_PA5); + common_hal_never_reset_pin(&pin_PA6); +} + +// Enable EUSART0 interrupt, init ring buffer +void port_serial_init(void) { + ringbuf_init(&con_uart_rx_ringbuf, + con_uart_rx_buf, + CONSOLE_RCV_BUFFER_SIZE); + + received_data = 0; + // Enable NVIC USART sources + NVIC_ClearPendingIRQ(EUSART0_RX_IRQn); + NVIC_EnableIRQ(EUSART0_RX_IRQn); + NVIC_SetPriority(EUSART0_RX_IRQn, 3); + EUSART_IntEnable(EUSART0, EUSART_IEN_RXFL); +} + +bool port_serial_connected(void) { + return true; +} + +// Get a characters from ring buffer +char port_serial_read(void) { + int data; + + CORE_DECLARE_IRQ_STATE; + CORE_ENTER_ATOMIC(); + + data = ringbuf_get(&con_uart_rx_ringbuf); + + CORE_EXIT_ATOMIC(); + + return (char)data; +} + +// Checking ring buffer haves bytes available or not +bool port_serial_bytes_available(void) { + return ringbuf_num_filled(&con_uart_rx_ringbuf) > 0 ? true : false; +} + +// Send n bytes data to serial by EUSART0 +void port_serial_write_substring(const char *text, uint32_t len) { + char *p_text = (char *)text; + while (len--) { + EUSART_Tx(EUSART0, *p_text); + p_text++; + } +} diff --git a/ports/silabs/tools/make_pins.py b/ports/silabs/tools/make_pins.py new file mode 100644 index 0000000000..bd4973d3e0 --- /dev/null +++ b/ports/silabs/tools/make_pins.py @@ -0,0 +1,216 @@ +import csv +import argparse +import string + + +def parse_pins(filename): + """Parse CSV file given in filename. + The CSV file should have the following columns: + mcu_name, board_name, port (integer), pin (integer) + The CSV file should also have a header row""" + pins = {} + with open(filename, newline="") as csv_file: + reader = csv.reader(csv_file) + reader.__next__() + for row in reader: + entry = (row[0].strip(), row[1].strip(), int(row[2].strip()), int(row[3].strip())) + pins[row[0].lower()] = entry + return pins + + +def parse_pin_functions(filename): + """Parse a CSV file with peripheral pin mappings. + The CSV file should have the following columns + func_name, LOC0,LOC1,...,LOC31 + There should not be any header row""" + functions = {} + with open(filename, newline="") as csv_file: + reader = csv.reader(csv_file) + for row in reader: + entry = row[1:] + functions[row[0].strip()] = entry + return functions + + +def make_pin_name(pin): + """Create pin name""" + return "pin_" + pin[0] + + +def make_mcu_dict_entry(pin): + """Create a pin mcu dictionary entry""" + entry = "{ MP_ROM_QSTR(MP_QSTR_" + pin[0] + "), MP_ROM_PTR(&" + make_pin_name(pin) + ") }," + return entry + + +def make_mcu_dict_entry2(pin): + """Create a pin mcu dictionary entry""" + entry = ( + "{ MP_ROM_QSTR(MP_QSTR_" + pin[1] + "), \t\t\tMP_ROM_PTR(&" + make_pin_name(pin) + ") }," + ) + return entry + + +def make_mcu_dict(pins): + """Create the mcu dictionary""" + decl = "\n\nSTATIC const mp_rom_map_elem_t board_module_globals_table[] = {\n" + decl += "\tCIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS\n" + for pin in pins.values(): + decl += "\t" + make_mcu_dict_entry(pin) + "\n" + + decl += "\n" + for pin in pins.values(): + if pin[1] != "": + decl += "\t" + make_mcu_dict_entry2(pin) + "\n" + + decl += "\t{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },\n" + decl += "\t{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },\n" + decl += "};\n" + decl += "MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);\n" + return decl + + +def make_board_dict_entry(pin): + """Create a pin board dictionary entry""" + entry = "{ MP_OBJ_NEW_QSTR(MP_QSTR_" + pin[1] + "), (mp_obj_t)&" + make_pin_name(pin) + " }," + return entry + + +def make_pin_function_list_decl(pin, fcns): + """Create a pin function list declaration""" + decl = "\nconst uint8_t pin_" + pin + "_functions[] = { \n" + if len(fcns) > 0: + decl += str(fcns[0]) + for i in fcns[1:]: + decl += ", " + str(i) + decl += "\n};\n" + return decl + + +def make_pin_declaration(pin): + """Create a pin declaration""" + decl = ( + "\nconst mcu_pin_obj_t " + + make_pin_name(pin) + + " = PIN(" + + str(pin[2]) + + "," + + str(pin[3]) + + "," + + make_pin_name(pin).lower() + + "_functions" + ");" + ) + return decl + + +def define_pin_exists(pin): + ret = "\n#define GPIO_" + pin[0] + "_EXISTS\t1" + return ret + + +def make_pin_function_lists(functions, pins): + """Create lists of pin functions from the parsed CSV data""" + fcn_list = {} + decl = "" + i = 0 + for fcn, fcn_pins in sorted(functions.items()): + for j in range(0, len(fcn_pins)): + pin = fcn_pins[j].lower() + if pin == "": + continue + if pin not in fcn_list: + fcn_list[pin] = [255] * len(functions) + fcn_list[pin][i] = 1 + i += 1 + for pin in pins.keys(): + if not pin in fcn_list: + fcn_list[pin] = [] + + decl += make_pin_function_list_decl(pin, fcn_list[pin]) + + return decl + + +def make_source_file(src_file, pins, fcn): + """Make pins.c""" + with open(src_file, "w") as f: + f.write('#include "shared-bindings/board/__init__.h"\n') + f.write('#include "pin_functions.h"\n') + + f.write(make_pin_function_lists(fcn, pins)) + + for pin in pins.values(): + f.write(make_pin_declaration(pin)) + f.write(make_mcu_dict(pins)) + f.close() + return + + +def make_header_file(hdr_file, pins, fcns): + """Make pins.h""" + hdr_file_name = hdr_file.split("/")[-1] + guard_name = "__" + hdr_file_name.replace(".", "_").upper() + "__" + with open(hdr_file, "w") as f: + f.write("#ifndef " + guard_name + "\n") + f.write("#define " + guard_name + "\n\n") + + fcn_names = sorted(fcns.keys()) + for i in range(len(fcn_names)): + f.write("#define " + "FN_" + fcn_names[i] + "\t\t\t(" + str(i) + ")\n") + + for pin in pins.values(): + f.write(define_pin_exists(pin)) + + f.write("\n\n") + f.write("\n\n#endif /*" + guard_name + "*/\n") + f.close() + + return + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + prog="make_pins", + usage="%(prog)s [options]", + description="Parse a CSV file with pin data and store as corresponding C source and header files.", + ) + parser.add_argument( + "-s", + "--source_file", + dest="source_file", + action="store", + help="Name of the output source file", + default="pins.c", + ) + parser.add_argument( + "-e", + "--header_file", + dest="header_file", + action="store", + help="Name of the output header file", + default="pin_functions.h", + ) + + parser.add_argument( + "csv_file", + action="store", + help="Name of the input csv file", + ) + parser.add_argument( + "fcn_csv", + action="store", + help="Name of the csv file with pin functions", + ) + args = parser.parse_args() + + src_file = args.source_file + hdr_file = args.header_file + + csv_file = args.csv_file + fcn_csv = args.fcn_csv + + pins = parse_pins(csv_file) + fcns = parse_pin_functions(fcn_csv) + make_source_file(src_file, pins, fcns) + make_header_file(hdr_file, pins, fcns) diff --git a/ports/silabs/tools/slc_cli_linux b/ports/silabs/tools/slc_cli_linux new file mode 160000 index 0000000000..a2cef44346 --- /dev/null +++ b/ports/silabs/tools/slc_cli_linux @@ -0,0 +1 @@ +Subproject commit a2cef4434600379695bef23bfbdcc8e604f7f305 diff --git a/requirements-dev.txt b/requirements-dev.txt index 5e8fe3d3f6..5efa084652 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -30,3 +30,7 @@ cryptography # for web workflow minify minify_html jsmin + +# for Silicon Labs Configurator (SLC) +websockets +colorama diff --git a/tools/ci_fetch_deps.py b/tools/ci_fetch_deps.py index 1b292b9d73..b77bea72f9 100644 --- a/tools/ci_fetch_deps.py +++ b/tools/ci_fetch_deps.py @@ -43,6 +43,7 @@ PORT_DEPS = { "lib/tinyusb/", "data/nvm.toml/", ], + "silabs": ["extmod/ulab/", "data/nvm.toml/"], "stm": ["extmod/ulab/", "lib/mp3/", "lib/protomatter/", "lib/tinyusb/", "data/nvm.toml/"] # omit unix which is part of the "test" target below } From 75670829652aaf1794c27f6b0bbad5937fecd9f0 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 18 Apr 2023 15:52:06 -0400 Subject: [PATCH 0886/1712] Add Adafruit Feather RP2040 Prop-Maker --- .../board.c | 29 ++++++++++ .../mpconfigboard.h | 14 +++++ .../mpconfigboard.mk | 9 +++ .../pico-sdk-configboard.h | 4 ++ .../adafruit_feather_rp2040_prop_maker/pins.c | 57 +++++++++++++++++++ 5 files changed, 113 insertions(+) create mode 100644 ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/board.c create mode 100644 ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/pins.c diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/board.c b/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/mpconfigboard.h b/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/mpconfigboard.h new file mode 100644 index 0000000000..c9e83756e3 --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "Adafruit Feather RP2040 Prop-Maker" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO4) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO14) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO15) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO8) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/mpconfigboard.mk new file mode 100644 index 0000000000..06d0c5e2b8 --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x239A +USB_PID = 0x8132 +USB_PRODUCT = "Feather RP2040 Prop-Maker" +USB_MANUFACTURER = "Adafruit" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ" diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/pico-sdk-configboard.h b/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/pico-sdk-configboard.h new file mode 100644 index 0000000000..a41131dd22 --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/pico-sdk-configboard.h @@ -0,0 +1,4 @@ +// Put board-specific pico-sdk definitions here. This file must exist. + +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/pins.c b/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/pins.c new file mode 100644 index 0000000000..96e0bc71df --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/pins.c @@ -0,0 +1,57 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, + + { 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_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_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_I2S_BIT_CLOCK), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_WORD_SELECT), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_EXTERNAL_BUTTON), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_SERVO), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_EXTERNAL_NEOPIXELS), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_ACCELEROMETER_INTERRUPT), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_EXTERNAL_NEOPIXELS_POWER), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 403ea89d5799a37d4cda08071d5bf2e5bc86a383 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Tue, 18 Apr 2023 19:44:03 -0500 Subject: [PATCH 0887/1712] Initial paletts for OnDiskGif --- shared-bindings/gifio/OnDiskGif.c | 28 ++++++- shared-bindings/gifio/OnDiskGif.h | 3 +- shared-module/gifio/OnDiskGif.c | 121 +++++++++++++++++++++--------- shared-module/gifio/OnDiskGif.h | 8 +- 4 files changed, 118 insertions(+), 42 deletions(-) diff --git a/shared-bindings/gifio/OnDiskGif.c b/shared-bindings/gifio/OnDiskGif.c index f6acccfabf..cfed55d0c8 100644 --- a/shared-bindings/gifio/OnDiskGif.c +++ b/shared-bindings/gifio/OnDiskGif.c @@ -117,9 +117,16 @@ //| """ //| ... STATIC mp_obj_t gifio_ondiskgif_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - mp_arg_check_num(n_args, n_kw, 1, 1, false); - mp_obj_t arg = all_args[0]; + enum { ARG_filename, ARG_use_palette, NUM_ARGS }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_filename, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_use_palette, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, + }; + MP_STATIC_ASSERT(MP_ARRAY_SIZE(allowed_args) == NUM_ARGS); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + mp_obj_t arg = all_args[0]; if (mp_obj_is_str(arg)) { arg = mp_call_function_2(MP_OBJ_FROM_PTR(&mp_builtin_open_obj), arg, MP_ROM_QSTR(MP_QSTR_rb)); } @@ -130,7 +137,7 @@ STATIC mp_obj_t gifio_ondiskgif_make_new(const mp_obj_type_t *type, size_t n_arg gifio_ondiskgif_t *self = m_new_obj(gifio_ondiskgif_t); self->base.type = &gifio_ondiskgif_type; - common_hal_gifio_ondiskgif_construct(self, MP_OBJ_TO_PTR(arg)); + common_hal_gifio_ondiskgif_construct(self, MP_OBJ_TO_PTR(arg), args[ARG_use_palette].u_bool); return MP_OBJ_FROM_PTR(self); } @@ -199,6 +206,20 @@ MP_DEFINE_CONST_FUN_OBJ_1(gifio_ondiskgif_get_bitmap_obj, gifio_ondiskgif_obj_ge MP_PROPERTY_GETTER(gifio_ondiskgif_bitmap_obj, (mp_obj_t)&gifio_ondiskgif_get_bitmap_obj); +//| palette: displayio.Palette +//| """The palette for the current frame.""" +STATIC mp_obj_t gifio_ondiskgif_obj_get_palette(mp_obj_t self_in) { + gifio_ondiskgif_t *self = MP_OBJ_TO_PTR(self_in); + + check_for_deinit(self); + return common_hal_gifio_ondiskgif_get_palette(self); +} + +MP_DEFINE_CONST_FUN_OBJ_1(gifio_ondiskgif_get_palette_obj, gifio_ondiskgif_obj_get_palette); + +MP_PROPERTY_GETTER(gifio_ondiskgif_palette_obj, + (mp_obj_t)&gifio_ondiskgif_get_palette_obj); + //| def next_frame(self) -> float: //| """Loads the next frame. Returns expected delay before the next frame in seconds.""" STATIC mp_obj_t gifio_ondiskgif_obj_next_frame(mp_obj_t self_in) { @@ -285,6 +306,7 @@ STATIC const mp_rom_map_elem_t gifio_ondiskgif_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&gifio_ondiskgif___exit___obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&gifio_ondiskgif_height_obj) }, { MP_ROM_QSTR(MP_QSTR_bitmap), MP_ROM_PTR(&gifio_ondiskgif_bitmap_obj) }, + { MP_ROM_QSTR(MP_QSTR_palette), MP_ROM_PTR(&gifio_ondiskgif_palette_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&gifio_ondiskgif_width_obj) }, { MP_ROM_QSTR(MP_QSTR_next_frame), MP_ROM_PTR(&gifio_ondiskgif_next_frame_obj) }, { MP_ROM_QSTR(MP_QSTR_duration), MP_ROM_PTR(&gifio_ondiskgif_duration_obj) }, diff --git a/shared-bindings/gifio/OnDiskGif.h b/shared-bindings/gifio/OnDiskGif.h index 6776466e8d..deaa639685 100644 --- a/shared-bindings/gifio/OnDiskGif.h +++ b/shared-bindings/gifio/OnDiskGif.h @@ -32,13 +32,14 @@ extern const mp_obj_type_t gifio_ondiskgif_type; -void common_hal_gifio_ondiskgif_construct(gifio_ondiskgif_t *self, pyb_file_obj_t *file); +void common_hal_gifio_ondiskgif_construct(gifio_ondiskgif_t *self, pyb_file_obj_t *file, bool use_palette); uint32_t common_hal_gifio_ondiskgif_get_pixel(gifio_ondiskgif_t *bitmap, int16_t x, int16_t y); uint16_t common_hal_gifio_ondiskgif_get_height(gifio_ondiskgif_t *self); mp_obj_t common_hal_gifio_ondiskgif_get_bitmap(gifio_ondiskgif_t *self); +mp_obj_t common_hal_gifio_ondiskgif_get_palette(gifio_ondiskgif_t *self); uint16_t common_hal_gifio_ondiskgif_get_width(gifio_ondiskgif_t *self); uint32_t common_hal_gifio_ondiskgif_next_frame(gifio_ondiskgif_t *self, bool setDirty); int32_t common_hal_gifio_ondiskgif_get_duration(gifio_ondiskgif_t *self); diff --git a/shared-module/gifio/OnDiskGif.c b/shared-module/gifio/OnDiskGif.c index aeb4f7bb74..f6adfa0775 100644 --- a/shared-module/gifio/OnDiskGif.c +++ b/shared-module/gifio/OnDiskGif.c @@ -26,6 +26,7 @@ #include "shared-bindings/gifio/OnDiskGif.h" #include "shared-bindings/displayio/Bitmap.h" +#include "shared-bindings/displayio/Palette.h" #include @@ -34,7 +35,6 @@ static int32_t GIFReadFile(GIFFILE *pFile, uint8_t *pBuf, int32_t iLen) { - // mp_printf(&mp_plat_print, "GifReadFile len %d ", iLen); uint32_t iBytesRead; iBytesRead = iLen; pyb_file_obj_t *f = pFile->fHandle; @@ -50,18 +50,15 @@ static int32_t GIFReadFile(GIFFILE *pFile, uint8_t *pBuf, int32_t iLen) { mp_raise_OSError(MP_EIO); } pFile->iPos = f->fp.fptr; - // mp_printf(&mp_plat_print, " now at %d\n", pFile->iPos); return bytes_read; } /* GIFReadFile() */ static int32_t GIFSeekFile(GIFFILE *pFile, int32_t iPosition) { - // mp_printf(&mp_plat_print, "GifSeekFile %d ", iPosition); pyb_file_obj_t *f = pFile->fHandle; f_lseek(&f->fp, iPosition); pFile->iPos = f->fp.fptr; - // mp_printf(&mp_plat_print, " now at %d\n", pFile->iPos); return pFile->iPos; } /* GIFSeekFile() */ @@ -71,10 +68,25 @@ static void GIFDraw(GIFDRAW *pDraw) { // The palette is either RGB565 or the original 24-bit RGB values // depending on the pixel type selected with gif.begin() - displayio_bitmap_t *bitmap = (displayio_bitmap_t *)pDraw->pUser; + gifio_ondiskgif_displayio_objs_t *displayio_objs = (gifio_ondiskgif_displayio_objs_t *)pDraw->pUser; + displayio_bitmap_t *bitmap = displayio_objs->bitmap; + displayio_palette_t *palette = displayio_objs->palette; - uint8_t *s; - uint16_t *d; + // Update the palette if we have one in RGB888 + if (palette != NULL) { + uint8_t *pPal = pDraw->pPalette24; + for (int p = 0; p < 256; p++) { + uint8_t r = *pPal++; + uint8_t g = *pPal++; + uint8_t b = *pPal++; + uint32_t color = (r << 16) + (g << 8) + b; + common_hal_displayio_palette_set_color(palette, p, color); + common_hal_displayio_palette_make_opaque(palette, p); // Transparency can change frame to frame + } + if (pDraw->ucHasTransparency) { + common_hal_displayio_palette_make_transparent(palette, pDraw->ucTransparent); + } + } int iWidth = pDraw->iWidth; if (iWidth + pDraw->iX > bitmap->width) { @@ -87,11 +99,6 @@ static void GIFDraw(GIFDRAW *pDraw) { int32_t row_start = (pDraw->y + pDraw->iY) * bitmap->stride; uint32_t *row = bitmap->data + row_start; - s = pDraw->pPixels; - d = (uint16_t *)row; - - uint16_t *pPal; - pPal = (uint16_t *)pDraw->pPalette; if (pDraw->ucDisposalMethod == 2) { // restore to background color // Not supported currently. Need to reset the area the previous frame occupied @@ -101,31 +108,53 @@ static void GIFDraw(GIFDRAW *pDraw) { // To workaround clear the gif.bitmap object yourself as required. } - uint8_t c, ucTransparent = pDraw->ucTransparent; - d += pDraw->iX; - if (pDraw->ucHasTransparency == 1) { + if (palette != NULL) { + uint8_t *s = pDraw->pPixels; + uint8_t *d = (uint8_t *)row; + + d += pDraw->iX; for (int x = 0; x < iWidth; x++) { - c = *s++; - if (c != ucTransparent) { - *d = pPal[c]; - } - d++; + *d++ = *s++; } } else { - for (int x = 0; x < iWidth; x++) - { - c = *s++; - *d++ = pPal[c]; + // No palette writing RGB565_SWAPPED right to bitmap buffer + uint8_t *s = pDraw->pPixels; + ; + uint16_t *d = (uint16_t *)row; + + uint16_t *pPal; + pPal = (uint16_t *)pDraw->pPalette; + + uint8_t c, ucTransparent = pDraw->ucTransparent; + d += pDraw->iX; + if (pDraw->ucHasTransparency == 1) { + for (int x = 0; x < iWidth; x++) + { + c = *s++; + if (c != ucTransparent) { + *d = pPal[c]; + } + d++; + } + } else { + for (int x = 0; x < iWidth; x++) + { + c = *s++; + *d++ = pPal[c]; + } } } } -void common_hal_gifio_ondiskgif_construct(gifio_ondiskgif_t *self, pyb_file_obj_t *file) { - // mp_printf(&mp_plat_print, "Begin OnDiskGif\n"); +void common_hal_gifio_ondiskgif_construct(gifio_ondiskgif_t *self, pyb_file_obj_t *file, bool use_palette) { self->file = file; - GIF_begin(&self->gif, GIF_PALETTE_RGB565_BE); + if (use_palette == true) { + GIF_begin(&self->gif, GIF_PALETTE_RGB888); + } else { + GIF_begin(&self->gif, GIF_PALETTE_RGB565_BE); + } self->gif.iError = GIF_SUCCESS; self->gif.pfnRead = GIFReadFile; @@ -143,10 +172,22 @@ void common_hal_gifio_ondiskgif_construct(gifio_ondiskgif_t *self, pyb_file_obj_ mp_arg_error_invalid(MP_QSTR_file); } + int bpp = 16; + if (use_palette == true) { + mp_printf(&mp_plat_print, "Using palette\n"); + displayio_palette_t *palette = m_new_obj(displayio_palette_t); + palette->base.type = &displayio_palette_type; + common_hal_displayio_palette_construct(palette, 256, false); + self->displayio_objs.palette = palette; + bpp = 8; + } else { + self->displayio_objs.palette = NULL; + } + displayio_bitmap_t *bitmap = m_new_obj(displayio_bitmap_t); bitmap->base.type = &displayio_bitmap_type; - common_hal_displayio_bitmap_construct(bitmap, self->gif.iCanvasWidth, self->gif.iCanvasHeight, 16); - self->bitmap = bitmap; + common_hal_displayio_bitmap_construct(bitmap, self->gif.iCanvasWidth, self->gif.iCanvasHeight, bpp); + self->displayio_objs.bitmap = bitmap; GIFINFO info; GIF_getInfo(&self->gif, &info); @@ -158,12 +199,13 @@ void common_hal_gifio_ondiskgif_construct(gifio_ondiskgif_t *self, pyb_file_obj_ void common_hal_gifio_ondiskgif_deinit(gifio_ondiskgif_t *self) { self->file = NULL; - common_hal_displayio_bitmap_deinit(self->bitmap); - self->bitmap = NULL; + common_hal_displayio_bitmap_deinit(self->displayio_objs.bitmap); + self->displayio_objs.bitmap = NULL; + self->displayio_objs.palette = NULL; } bool common_hal_gifio_ondiskgif_deinited(gifio_ondiskgif_t *self) { - return self->bitmap == NULL; + return self->displayio_objs.bitmap == NULL; } uint16_t common_hal_gifio_ondiskgif_get_height(gifio_ondiskgif_t *self) { @@ -175,7 +217,11 @@ uint16_t common_hal_gifio_ondiskgif_get_width(gifio_ondiskgif_t *self) { } mp_obj_t common_hal_gifio_ondiskgif_get_bitmap(gifio_ondiskgif_t *self) { - return MP_OBJ_FROM_PTR(self->bitmap); + return MP_OBJ_FROM_PTR(self->displayio_objs.bitmap); +} + +mp_obj_t common_hal_gifio_ondiskgif_get_palette(gifio_ondiskgif_t *self) { + return MP_OBJ_FROM_PTR(self->displayio_objs.palette); } int32_t common_hal_gifio_ondiskgif_get_duration(gifio_ondiskgif_t *self) { @@ -196,17 +242,18 @@ int32_t common_hal_gifio_ondiskgif_get_max_delay(gifio_ondiskgif_t *self) { uint32_t common_hal_gifio_ondiskgif_next_frame(gifio_ondiskgif_t *self, bool setDirty) { int nextDelay = 0; - int result = GIF_playFrame(&self->gif, &nextDelay, self->bitmap); + int result = 0; + result = GIF_playFrame(&self->gif, &nextDelay, &self->displayio_objs); if ((result >= 0) && (setDirty)) { displayio_area_t dirty_area = { .x1 = 0, .y1 = 0, - .x2 = self->bitmap->width, - .y2 = self->bitmap->height, + .x2 = self->displayio_objs.bitmap->width, + .y2 = self->displayio_objs.bitmap->height, }; - displayio_bitmap_set_dirty_area(self->bitmap, &dirty_area); + displayio_bitmap_set_dirty_area(self->displayio_objs.bitmap, &dirty_area); } return nextDelay; diff --git a/shared-module/gifio/OnDiskGif.h b/shared-module/gifio/OnDiskGif.h index c40781ef1f..70479ac8d9 100644 --- a/shared-module/gifio/OnDiskGif.h +++ b/shared-module/gifio/OnDiskGif.h @@ -34,14 +34,20 @@ #include "lib/AnimatedGIF/AnimatedGIF_circuitpy.h" #include "shared-module/displayio/Bitmap.h" +#include "shared-module/displayio/Palette.h" #include "extmod/vfs_fat.h" +typedef struct { + displayio_bitmap_t *bitmap; + displayio_palette_t *palette; +} gifio_ondiskgif_displayio_objs_t; + typedef struct { mp_obj_base_t base; GIFIMAGE gif; pyb_file_obj_t *file; - displayio_bitmap_t *bitmap; + gifio_ondiskgif_displayio_objs_t displayio_objs; int32_t duration; int32_t frame_count; int32_t min_delay; From 8980ebfa169059ca993e27f164e92aed51185b1f Mon Sep 17 00:00:00 2001 From: Ted Hess Date: Sun, 16 Apr 2023 12:06:15 -0400 Subject: [PATCH 0888/1712] Simplify CORS checks and don't restrict host names. Minor socket cleanup. --- .../espressif/common-hal/socketpool/Socket.c | 1 - supervisor/shared/web_workflow/web_workflow.c | 82 ++++++++----------- 2 files changed, 35 insertions(+), 48 deletions(-) diff --git a/ports/espressif/common-hal/socketpool/Socket.c b/ports/espressif/common-hal/socketpool/Socket.c index 5af3cdbbc3..ef56480672 100644 --- a/ports/espressif/common-hal/socketpool/Socket.c +++ b/ports/espressif/common-hal/socketpool/Socket.c @@ -88,7 +88,6 @@ STATIC void socket_select_task(void *arg) { } assert(num_triggered > 0); - assert(!FD_ISSET(socket_change_fd, &excptfds)); // Notice event trigger if (FD_ISSET(socket_change_fd, &readfds)) { diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index d24547dd09..faadd52bda 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -24,6 +24,9 @@ * THE SOFTWARE. */ +// Include strchrnul() +#define _GNU_SOURCE + #include #include @@ -85,8 +88,8 @@ typedef struct { char destination[256]; char header_key[64]; char header_value[256]; - // We store the origin so we can reply back with it. - char origin[64]; + char origin[64]; // We store the origin so we can reply back with it. + char host[64]; // We store the host to check against origin. size_t content_length; size_t offset; uint64_t timestamp_ms; @@ -454,49 +457,33 @@ static bool _endswith(const char *str, const char *suffix) { return strcmp(str + (strlen(str) - strlen(suffix)), suffix) == 0; } -const char *ok_hosts[] = { - "127.0.0.1", - "localhost", -}; +const char http_scheme[] = "http://"; +#define PREFIX_HTTP_LEN (sizeof(http_scheme) - 1) -static bool _origin_ok(const char *origin) { - const char *http = "http://"; - - // note: redirected requests send an Origin of "null" and will be caught by this - if (strncmp(origin, http, strlen(http)) != 0) { - return false; - } - // These are prefix checks up to : so that any port works. - // TODO: Support DHCP hostname in addition to MDNS. - const char *end; - #if CIRCUITPY_MDNS - if (!common_hal_mdns_server_deinited(&mdns)) { - const char *local = ".local"; - const char *hostname = common_hal_mdns_server_get_hostname(&mdns); - end = origin + strlen(http) + strlen(hostname) + strlen(local); - if (strncmp(origin + strlen(http), hostname, strlen(hostname)) == 0 && - strncmp(origin + strlen(http) + strlen(hostname), local, strlen(local)) == 0 && - (end[0] == '\0' || end[0] == ':')) { - return true; - } - } - #endif - - _update_encoded_ip(); - end = origin + strlen(http) + strlen(_our_ip_encoded); - if (strncmp(origin + strlen(http), _our_ip_encoded, strlen(_our_ip_encoded)) == 0 && - (end[0] == '\0' || end[0] == ':')) { +static bool _origin_ok(_request *request) { + // Origin may be 'null' + if (request->origin[0] == '\0') { return true; } - - for (size_t i = 0; i < MP_ARRAY_SIZE(ok_hosts); i++) { - // Allows any port - end = origin + strlen(http) + strlen(ok_hosts[i]); - if (strncmp(origin + strlen(http), ok_hosts[i], strlen(ok_hosts[i])) == 0 - && (end[0] == '\0' || end[0] == ':')) { + // Origin has http prefix? + if (strncmp(request->origin, http_scheme, PREFIX_HTTP_LEN) != 0) { + // Not HTTP scheme request - ok + request->origin[0] = '\0'; + return true; + } + // Host given? + if (request->host[0] != '\0') { + // OK if host and origin match (fqdn + port #) + if (strcmp(request->host, &request->origin[PREFIX_HTTP_LEN]) == 0) { + return true; + } + // DEBUG: OK if origin is 'localhost' (ignoring port #) + *strchrnul(&request->origin[PREFIX_HTTP_LEN], ':') = '\0'; + if (strcmp(&request->origin[PREFIX_HTTP_LEN], "localhost") == 0) { return true; } } + // Otherwise deny request return false; } @@ -517,8 +504,8 @@ static void _cors_header(socketpool_socket_obj_t *socket, _request *request) { _send_strs(socket, "Access-Control-Allow-Credentials: true\r\n", "Vary: Origin, Accept, Upgrade\r\n", - "Access-Control-Allow-Origin: *\r\n", - NULL); + "Access-Control-Allow-Origin: ", + (request->origin[0] == '\0') ? "*" : request->origin, "\r\n", NULL); } static void _reply_continue(socketpool_socket_obj_t *socket, _request *request) { @@ -1086,11 +1073,7 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) { #else _reply_missing(socket, request); #endif - -// For now until CORS is sorted, allow always the origin requester. -// Note: caller knows who we are better than us. CORS is not security -// unless browser cooperates. Do not rely on mDNS or IP. - } else if (strlen(request->origin) > 0 && !_origin_ok(request->origin)) { + } else if (!_origin_ok(request)) { _reply_forbidden(socket, request); } else if (strncmp(request->path, "/fs/", 4) == 0) { if (strcasecmp(request->method, "OPTIONS") == 0) { @@ -1314,6 +1297,7 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) { static void _reset_request(_request *request) { request->state = STATE_METHOD; request->origin[0] = '\0'; + request->host[0] = '\0'; request->content_length = 0; request->offset = 0; request->timestamp_ms = 0; @@ -1340,6 +1324,7 @@ static void _process_request(socketpool_socket_obj_t *socket, _request *request) if (len == 0 || len == -MP_ENOTCONN) { // Disconnect - clear 'in-progress' _reset_request(request); + common_hal_socketpool_socket_close(socket); } break; } @@ -1421,6 +1406,8 @@ static void _process_request(socketpool_socket_obj_t *socket, _request *request) request->redirect = strncmp(request->header_value, cp_local, strlen(cp_local)) == 0 && (strlen(request->header_value) == strlen(cp_local) || request->header_value[strlen(cp_local)] == ':'); + strncpy(request->host, request->header_value, sizeof(request->host) - 1); + request->host[sizeof(request->host) - 1] = '\0'; } else if (strcasecmp(request->header_key, "Content-Length") == 0) { request->content_length = strtoul(request->header_value, NULL, 10); } else if (strcasecmp(request->header_key, "Expect") == 0) { @@ -1428,7 +1415,8 @@ static void _process_request(socketpool_socket_obj_t *socket, _request *request) } else if (strcasecmp(request->header_key, "Accept") == 0) { request->json = strcasecmp(request->header_value, "application/json") == 0; } else if (strcasecmp(request->header_key, "Origin") == 0) { - strcpy(request->origin, request->header_value); + strncpy(request->origin, request->header_value, sizeof(request->origin) - 1); + request->origin[sizeof(request->origin) - 1] = '\0'; } else if (strcasecmp(request->header_key, "X-Timestamp") == 0) { request->timestamp_ms = strtoull(request->header_value, NULL, 10); } else if (strcasecmp(request->header_key, "Upgrade") == 0) { From e5a5a348fd9c9e927c1e7e5d82a3957ea5044f81 Mon Sep 17 00:00:00 2001 From: CDarius Date: Wed, 19 Apr 2023 08:17:10 +0000 Subject: [PATCH 0889/1712] Fixed wrong GPIO number for touch screen interrupt --- ports/espressif/boards/m5stack_core2/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_core2/pins.c b/ports/espressif/boards/m5stack_core2/pins.c index 865ce61eaf..ee8fe21ad9 100644 --- a/ports/espressif/boards/m5stack_core2/pins.c +++ b/ports/espressif/boards/m5stack_core2/pins.c @@ -83,7 +83,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SD_CS),MP_ROM_PTR(&pin_GPIO4) }, // touch screen - { MP_ROM_QSTR(MP_QSTR_TOUCH_SCR_IRQ),MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_TOUCH_INT),MP_ROM_PTR(&pin_GPIO39) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_PORTA_I2C), MP_ROM_PTR(&board_porta_i2c_obj) }, From fd1e9cf8f18d96cb46ee878700040b4b462a8931 Mon Sep 17 00:00:00 2001 From: Milind Date: Wed, 19 Apr 2023 21:46:08 +0530 Subject: [PATCH 0890/1712] 1. Changed attenuation from ADC_ATTEN_DB_0 to ADC_ATTEN_DB_11 2. Scaling the 12-bit values received from DMA engine to 16-bit value --- ports/espressif/common-hal/analogbufio/BufferedIn.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ports/espressif/common-hal/analogbufio/BufferedIn.c b/ports/espressif/common-hal/analogbufio/BufferedIn.c index f2ee8c19af..3a8d8d0def 100644 --- a/ports/espressif/common-hal/analogbufio/BufferedIn.c +++ b/ports/espressif/common-hal/analogbufio/BufferedIn.c @@ -46,8 +46,9 @@ #define NUM_SAMPLES_PER_INTERRUPT 256 #define NUM_ADC_CHANNELS 1 #define DMA_BUFFER_SIZE 1024 -#define ATTENUATION ADC_ATTEN_DB_0 +#define ATTENUATION ADC_ATTEN_DB_11 #define ADC_READ_TIMEOUT_MS 2000 +#define ADC_PIN_MAX_VALUE 0xfff #if defined(CONFIG_IDF_TARGET_ESP32) #define ADC_RESULT_BYTE 2 @@ -239,6 +240,7 @@ uint32_t common_hal_analogbufio_bufferedin_readinto(analogbufio_bufferedin_obj_t uint32_t captured_bytes = 0; esp_err_t ret; uint32_t ret_num = 0; + uint32_t adc_reading = 0; adc_digi_convert_mode_t convert_mode = ADC_CONV_SINGLE_UNIT_2; adc_digi_output_format_t output_format = ADC_DIGI_OUTPUT_FORMAT_TYPE1; @@ -264,11 +266,13 @@ uint32_t common_hal_analogbufio_bufferedin_readinto(analogbufio_bufferedin_obj_t uint16_t *pBuffer = (uint16_t *)(void *)&buffer[captured_bytes]; if (output_format == ADC_DIGI_OUTPUT_FORMAT_TYPE1) { #if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S2) - *pBuffer = pResult->type1.data; + adc_reading = pResult->type1.data; #endif } else { - *pBuffer = pResult->type2.data; + adc_reading = pResult->type2.data; } + adc_reading = adc_reading * ((1 << 16) - 1) / ADC_PIN_MAX_VALUE; + *pBuffer = (uint16_t)adc_reading; captured_bytes += sizeof(uint16_t); captured_samples++; } else { From 66edcf5d034432519aac18690806adad2cacf2ac Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 7 Apr 2023 11:59:55 -0700 Subject: [PATCH 0891/1712] Add PicoDVI support PicoDVI in CP support 640x480 and 800x480 on Feather DVI, Pico and Pico W. 1 and 2 bit grayscale are full resolution. 8 and 16 bit color are half resolution. Memory layout is modified to give the top most 4k of ram to the second core. Its MPU is used to prevent flash access after startup. The port saved word is moved to a watchdog scratch register so that it doesn't get overwritten by other things in RAM. Right align status bar and scroll area. This normally gives a few pixels of padding on the left hand side and improves the odds it is readable in a case. Fixes #7562 Fixes c stack checking. The length was correct but the top was being set to the current stack pointer instead of the correct top. Fixes #7643 This makes Bitmap subscr raise IndexError instead of ValueError when the index arguments are wrong. --- .gitmodules | 4 + locale/circuitpython.pot | 24 +- main.c | 10 +- .../common-hal/videocore/Framebuffer.c | 1 + ports/raspberrypi/Makefile | 47 +- ports/raspberrypi/audio_dma.c | 2 +- .../bindings/picodvi/Framebuffer.c | 265 +++++++++++ .../bindings/picodvi/Framebuffer.h | 49 ++ ports/raspberrypi/bindings/picodvi/__init__.c | 48 ++ .../adafruit_feather_rp2040_dvi/board.c | 23 + .../mpconfigboard.mk | 2 + .../boards/adafruit_feather_rp2040_dvi/pins.c | 4 + .../boards/raspberry_pi_pico/mpconfigboard.mk | 1 + .../boards/raspberry_pi_pico_w/link.ld | 295 +----------- .../raspberry_pi_pico_w/mpconfigboard.mk | 2 + .../common-hal/picodvi/Framebuffer.c | 419 ++++++++++++++++++ .../common-hal/picodvi/Framebuffer.h | 51 +++ .../common-hal/rp2pio/StateMachine.c | 18 +- .../common-hal/rp2pio/StateMachine.h | 3 + ports/raspberrypi/lib/PicoDVI | 1 + ports/raspberrypi/link.ld | 52 ++- ports/raspberrypi/mpconfigport.mk | 2 +- .../sdk_config/pico/config_autogen.h | 6 + ports/raspberrypi/supervisor/port.c | 29 +- py/circuitpy_defns.mk | 19 +- py/circuitpy_mpconfig.mk | 5 + shared-bindings/displayio/Bitmap.c | 24 +- shared-module/displayio/ColorConverter.c | 12 + shared-module/displayio/ColorConverter.h | 1 + shared-module/displayio/__init__.c | 11 + shared-module/displayio/__init__.h | 7 + supervisor/shared/display.c | 40 +- supervisor/shared/memory.c | 2 + supervisor/shared/usb/usb.c | 2 +- tools/cortex-m-fault-gdb.py | 62 ++- 35 files changed, 1134 insertions(+), 409 deletions(-) create mode 100644 ports/raspberrypi/bindings/picodvi/Framebuffer.c create mode 100644 ports/raspberrypi/bindings/picodvi/Framebuffer.h create mode 100644 ports/raspberrypi/bindings/picodvi/__init__.c create mode 100644 ports/raspberrypi/common-hal/picodvi/Framebuffer.c create mode 100644 ports/raspberrypi/common-hal/picodvi/Framebuffer.h create mode 160000 ports/raspberrypi/lib/PicoDVI diff --git a/.gitmodules b/.gitmodules index a33354bbff..2fcfc07fcc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -331,3 +331,7 @@ [submodule "ports/silabs/tools/slc_cli_linux"] path = ports/silabs/tools/slc_cli_linux url = https://github.com/SiliconLabs/circuitpython_slc_cli_linux +[submodule "ports/raspberrypi/lib/PicoDVI"] + path = ports/raspberrypi/lib/PicoDVI + url = https://github.com/circuitpython/PicoDVI.git + branch = circuitpython diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f87fc02975..87c28a21e9 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -98,6 +98,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "" @@ -123,6 +126,7 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -161,11 +165,11 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "" @@ -193,7 +197,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -465,6 +469,7 @@ msgstr "" msgid "All event channels in use" msgstr "" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -473,6 +478,7 @@ msgstr "" msgid "All sync event channels in use" msgstr "" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "" @@ -1117,10 +1123,6 @@ msgstr "" msgid "I2C peripheral in use" msgstr "" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1223,7 +1225,9 @@ msgid "Interrupt error." msgstr "" #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" @@ -1708,10 +1712,6 @@ 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 frequency not writable when variable_frequency is False on construction." diff --git a/main.c b/main.c index 6ff6202d6d..9351d90529 100644 --- a/main.c +++ b/main.c @@ -153,11 +153,15 @@ STATIC void start_mp(supervisor_allocation *heap, supervisor_allocation *pystack supervisor_workflow_reset(); // Stack limit should be less than real stack size, so we have a chance - // to recover from limit hit. (Limit is measured in bytes.) + // to recover from limit hit. (Limit is measured in bytes.) The top of the + // stack is set to our current state. Not the actual top. mp_stack_ctrl_init(); - if (stack_get_bottom() != NULL) { - mp_stack_set_limit(stack_get_length() - 1024); + uint32_t *stack_bottom = stack_get_bottom(); + if (stack_bottom != NULL) { + size_t stack_length = stack_get_length(); + mp_stack_set_top(stack_bottom + (stack_length / sizeof(uint32_t))); + mp_stack_set_limit(stack_length - 1024); } diff --git a/ports/broadcom/common-hal/videocore/Framebuffer.c b/ports/broadcom/common-hal/videocore/Framebuffer.c index 18b703b8b6..63c55324af 100644 --- a/ports/broadcom/common-hal/videocore/Framebuffer.c +++ b/ports/broadcom/common-hal/videocore/Framebuffer.c @@ -42,6 +42,7 @@ void common_hal_videocore_framebuffer_deinit(videocore_framebuffer_obj_t *self) if (vcmailbox_release_framebuffer()) { self->framebuffer = NULL; } + self->base.type = &mp_type_NoneType; } bool common_hal_videocore_framebuffer_deinited(videocore_framebuffer_obj_t *self) { diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index fafc817ca2..f23da5a51d 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -33,11 +33,11 @@ INC_CYW43 := \ -isystem lib/cyw43-driver/firmware \ -isystem lib/cyw43-driver/src \ -isystem lib/lwip/src/include \ - -isystem sdk/src/rp2_common/pico_async_context/include/ \ + -isystem sdk/src/rp2_common/pico_async_context/include/ \ -isystem sdk/src/rp2_common/pico_cyw43_arch/include/ \ -isystem sdk/src/rp2_common/pico_cyw43_driver/include/ \ -isystem sdk/src/rp2_common/pico_lwip/include/ \ - -isystem sdk/src/rp2_common/pico_rand/include/ \ + -isystem sdk/src/rp2_common/pico_rand/include/ \ CFLAGS_CYW43 := -DCYW43_LWIP=1 -DPICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1 -DCYW43_USE_SPI -DIGNORE_GPIO25 -DIGNORE_GPIO23 -DIGNORE_GPIO24 -DCYW43_LOGIC_DEBUG=0 -DCYW43_NETUTILS=1 SRC_SDK_CYW43 := \ @@ -105,6 +105,7 @@ INC += \ -isystem sdk/src/common/pico_util/include/ \ -isystem sdk/src/rp2040/hardware_regs/include/ \ -isystem sdk/src/rp2040/hardware_structs/include/ \ + -isystem sdk/src/rp2_common/cmsis/ \ -isystem sdk/src/rp2_common/hardware_adc/include/ \ -isystem sdk/src/rp2_common/hardware_base/include/ \ -isystem sdk/src/rp2_common/hardware_claim/include/ \ @@ -113,16 +114,19 @@ INC += \ -isystem sdk/src/rp2_common/hardware_dma/include/ \ -isystem sdk/src/rp2_common/hardware_flash/include/ \ -isystem sdk/src/rp2_common/hardware_gpio/include/ \ + -isystem sdk/src/rp2_common/hardware_interp/include/ \ -isystem sdk/src/rp2_common/hardware_irq/include/ \ -isystem sdk/src/rp2_common/hardware_i2c/include/ \ -isystem sdk/src/rp2_common/hardware_pio/include/ \ -isystem sdk/src/rp2_common/hardware_pll/include/ \ + -isystem sdk/src/rp2_common/hardware_pwm/include/ \ -isystem sdk/src/rp2_common/hardware_resets/include/ \ -isystem sdk/src/rp2_common/hardware_rtc/include/ \ -isystem sdk/src/rp2_common/hardware_spi/include/ \ -isystem sdk/src/rp2_common/hardware_sync/include/ \ -isystem sdk/src/rp2_common/hardware_timer/include/ \ -isystem sdk/src/rp2_common/hardware_uart/include/ \ + -isystem sdk/src/rp2_common/hardware_vreg/include/ \ -isystem sdk/src/rp2_common/hardware_watchdog/include/ \ -isystem sdk/src/rp2_common/hardware_xosc/include/ \ -isystem sdk/src/rp2_common/pico_multicore/include/ \ @@ -131,7 +135,7 @@ INC += \ -isystem sdk/src/rp2_common/pico_printf/include/ \ -isystem sdk/src/rp2_common/pico_float/include/ \ -isystem sdk/src/rp2_common/pico_platform/include/ \ - -isystem sdk/src/rp2_common/pico_runtime/printf/include/ \ + -isystem sdk/src/rp2_common/pico_runtime/include/ \ -isystem sdk/src/rp2_common/pico_bootrom/include/ \ -isystem sdk/src/rp2_common/pico_unique_id/include/ \ $(INC_CYW43) \ @@ -141,7 +145,7 @@ INC += \ -I$(BUILD) # Pico specific configuration -CFLAGS += -DRASPBERRYPI -DPICO_ON_DEVICE=1 -DPICO_NO_BINARY_INFO=0 -DPICO_TIME_DEFAULT_ALARM_POOL_DISABLED=0 -DPICO_DIVIDER_CALL_IDIV0=0 -DPICO_DIVIDER_CALL_LDIV0=0 -DPICO_DIVIDER_HARDWARE=1 -DPICO_DOUBLE_ROM=1 -DPICO_FLOAT_ROM=1 -DPICO_MULTICORE=1 -DPICO_BITS_IN_RAM=0 -DPICO_DIVIDER_IN_RAM=0 -DPICO_DOUBLE_PROPAGATE_NANS=0 -DPICO_DOUBLE_IN_RAM=0 -DPICO_MEM_IN_RAM=0 -DPICO_FLOAT_IN_RAM=0 -DPICO_FLOAT_PROPAGATE_NANS=1 -DPICO_NO_FLASH=0 -DPICO_COPY_TO_RAM=0 -DPICO_DISABLE_SHARED_IRQ_HANDLERS=0 -DPICO_NO_BI_BOOTSEL_VIA_DOUBLE_RESET=0 +CFLAGS += -DRASPBERRYPI -DPICO_ON_DEVICE=1 -DPICO_NO_BINARY_INFO=0 -DPICO_TIME_DEFAULT_ALARM_POOL_DISABLED=0 -DPICO_DIVIDER_CALL_IDIV0=0 -DPICO_DIVIDER_CALL_LDIV0=0 -DPICO_DIVIDER_HARDWARE=1 -DPICO_DOUBLE_ROM=1 -DPICO_FLOAT_ROM=1 -DPICO_MULTICORE=1 -DPICO_BITS_IN_RAM=0 -DPICO_DIVIDER_IN_RAM=0 -DPICO_DOUBLE_PROPAGATE_NANS=0 -DPICO_DOUBLE_IN_RAM=0 -DPICO_MEM_IN_RAM=0 -DPICO_FLOAT_IN_RAM=0 -DPICO_FLOAT_PROPAGATE_NANS=1 -DPICO_NO_FLASH=0 -DPICO_COPY_TO_RAM=0 -DPICO_DISABLE_SHARED_IRQ_HANDLERS=0 -DPICO_NO_BI_BOOTSEL_VIA_DOUBLE_RESET=0 -DDVI_1BPP_BIT_REVERSE=0 OPTIMIZATION_FLAGS ?= -O3 # TinyUSB defines CFLAGS += -DTUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX=1 -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 @@ -172,8 +176,8 @@ DISABLE_WARNINGS = -Wno-stringop-overflow -Wno-cast-align CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) -Werror=missing-prototypes CFLAGS += \ - -march=armv6-m \ - -mthumb \ + -march=armv6-m \ + -mthumb \ -mabi=aapcs-linux \ -mcpu=cortex-m0plus \ -msoft-float \ @@ -195,6 +199,7 @@ SRC_SDK := \ src/common/pico_time/time.c \ src/common/pico_time/timeout_helper.c \ src/common/pico_util/pheap.c \ + src/common/pico_util/queue.c \ src/rp2_common/hardware_adc/adc.c \ src/rp2_common/hardware_claim/claim.c \ src/rp2_common/hardware_clocks/clocks.c \ @@ -202,6 +207,7 @@ SRC_SDK := \ src/rp2_common/hardware_flash/flash.c \ src/rp2_common/hardware_gpio/gpio.c \ src/rp2_common/hardware_i2c/i2c.c \ + src/rp2_common/hardware_interp/interp.c \ src/rp2_common/hardware_irq/irq.c \ src/rp2_common/hardware_pio/pio.c \ src/rp2_common/hardware_pll/pll.c \ @@ -210,6 +216,7 @@ SRC_SDK := \ src/rp2_common/hardware_sync/sync.c \ src/rp2_common/hardware_timer/timer.c \ src/rp2_common/hardware_uart/uart.c \ + src/rp2_common/hardware_vreg/vreg.c \ src/rp2_common/hardware_watchdog/watchdog.c \ src/rp2_common/hardware_xosc/xosc.c \ src/rp2_common/pico_bootrom/bootrom.c \ @@ -223,6 +230,7 @@ SRC_SDK := \ src/rp2_common/pico_printf/printf.c \ src/rp2_common/pico_runtime/runtime.c \ src/rp2_common/pico_stdio/stdio.c \ + src/rp2_common/pico_stdlib/stdlib.c \ src/rp2_common/pico_unique_id/unique_id.c \ $(SRC_SDK_CYW43) \ @@ -240,12 +248,24 @@ SRC_C += \ background.c \ peripherals/pins.c \ lib/crypto-algorithms/sha256.c \ + lib/PicoDVI/software/libdvi/dvi.c \ + lib/PicoDVI/software/libdvi/dvi_serialiser.c \ + lib/PicoDVI/software/libdvi/dvi_timing.c \ + lib/PicoDVI/software/libdvi/tmds_encode.c \ lib/tinyusb/src/portable/raspberrypi/rp2040/dcd_rp2040.c \ lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c \ mphalport.c \ $(SRC_CYW43) \ $(SRC_LWIP) \ +ifeq ($(CIRCUITPY_PICODVI),1) +SRC_C += \ + bindings/picodvi/__init__.c \ + bindings/picodvi/Framebuffer.c \ + common-hal/picodvi/Framebuffer.c \ + +endif + ifeq ($(CIRCUITPY_SSL),1) CFLAGS += -isystem $(TOP)/mbedtls/include SRC_MBEDTLS := $(addprefix lib/mbedtls/library/, \ @@ -359,6 +379,7 @@ SRC_S_UPPER = sdk/src/rp2_common/hardware_divider/divider.S \ sdk/src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S \ sdk/src/rp2_common/pico_mem_ops/mem_ops_aeabi.S \ sdk/src/rp2_common/pico_standard_link/crt0.S \ + lib/PicoDVI/software/libdvi/tmds_encode_asm.S \ OBJ = $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_SDK:.c=.o)) @@ -405,13 +426,19 @@ SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_M all: $(BUILD)/firmware.uf2 -LINK_LD := $(firstword $(wildcard boards/$(BOARD)/link.ld link.ld)) -$(BUILD)/firmware.elf: $(OBJ) $(LINK_LD) +BOARD_LD := $(wildcard boards/$(BOARD)/link.ld) + +ifneq ($(BOARD_LD),) + LINKER_SCRIPTS = -Wl,-T,$(BOARD_LD) +endif + +LINKER_SCRIPTS += -Wl,-T,link.ld + +$(BUILD)/firmware.elf: $(OBJ) $(BOARD_LD) link.ld $(STEPECHO) "LINK $@" $(Q)echo $(OBJ) > $(BUILD)/firmware.objs $(Q)echo $(PICO_LDFLAGS) > $(BUILD)/firmware.ldflags - $(Q)$(CC) -o $@ $(CFLAGS) @$(BUILD)/firmware.ldflags -Wl,-T,$(LINK_LD) -Wl,-Map=$@.map -Wl,-cref -Wl,--gc-sections @$(BUILD)/firmware.objs -Wl,-lc - $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(LINK_LD) $(BUILD) + $(Q)$(CC) -o $@ $(CFLAGS) @$(BUILD)/firmware.ldflags $(LINKER_SCRIPTS) -Wl,--print-memory-usage -Wl,-Map=$@.map -Wl,-cref -Wl,--gc-sections @$(BUILD)/firmware.objs -Wl,-lc $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" diff --git a/ports/raspberrypi/audio_dma.c b/ports/raspberrypi/audio_dma.c index 7fef1a52e0..612fbbde4c 100644 --- a/ports/raspberrypi/audio_dma.c +++ b/ports/raspberrypi/audio_dma.c @@ -37,7 +37,7 @@ #include "src/rp2_common/hardware_irq/include/hardware/irq.h" -#if CIRCUITPY_AUDIOPWMIO || CIRCUITPY_AUDIOBUSIO +#if CIRCUITPY_AUDIOCORE void audio_dma_reset(void) { for (size_t channel = 0; channel < NUM_DMA_CHANNELS; channel++) { diff --git a/ports/raspberrypi/bindings/picodvi/Framebuffer.c b/ports/raspberrypi/bindings/picodvi/Framebuffer.c new file mode 100644 index 0000000000..51afd0eda7 --- /dev/null +++ b/ports/raspberrypi/bindings/picodvi/Framebuffer.c @@ -0,0 +1,265 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "py/obj.h" +#include "py/objproperty.h" +#include "py/runtime.h" +#include "py/objarray.h" + +#include "bindings/picodvi/Framebuffer.h" +#include "shared-bindings/util.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/framebufferio/__init__.h" +#include "shared-module/framebufferio/FramebufferDisplay.h" + +//| class Framebuffer: +//| """A PicoDVI managed frame buffer.""" +//| +//| def __init__( +//| self, +//| width: int, +//| height: int, +//| *, +//| clk_dp: microcontroller.Pin, +//| clk_dn: microcontroller.Pin, +//| red_dp: microcontroller.Pin, +//| red_dn: microcontroller.Pin, +//| green_dp: microcontroller.Pin, +//| green_dn: microcontroller.Pin, +//| blue_dp: microcontroller.Pin, +//| blue_dn: microcontroller.Pin, +//| color_depth: int = 8, +//| ) -> None: +//| """Create a Framebuffer object with the given dimensions (640x480 or 800x480). Memory is +//| allocated outside of onto the heap and then moved outside on VM +//| end. +//| +//| This will change the system clock speed to match the DVI signal. +//| Make sure to initialize other objects after this one so they account +//| for the changed clock. This also allocates a very large framebuffer +//| and is most likely to succeed the earlier it is attempted. +//| +//| Each *_dp and *_dn pair of pins must be neighboring, such as 19 and +//| 20. They must also be ordered the same way. In other words, dp must +//| be less than dn for all pairs or dp must be greater than dn for all +//| pairs. +//| +//| The framebuffer pixel format varies depending on color_depth: +//| * 1 - Each bit is a pixel. Either white (1) or black (0). +//| * 2 - Each 2 bits is a pixels. Grayscale between white (0x3) and black (0x0). +//| * 8 - Each byte is a pixels in RGB332 format. +//| * 16 - Each two bytes are a pixel in RGB565 format. +//| +//| Monochrome framebuffers (color_depth=1 or 2) will be full resolution. +//| Color framebuffers will be half resolution and pixels will be +//| duplicated to create a signal with the target dimensions. +//| +//| A Framebuffer is often used in conjunction with a +//| `framebufferio.FramebufferDisplay`. +//| +//| :param int width: the width of the target display signal. It will be halved when +//| color_depth >= 8 when creating the framebuffer. Only 640 or 800 is currently supported. +//| :param int height: the height of the target display signal. It will be halved when +//| color_depth >= 8 when creating the framebuffer. Only 480 is currently supported. +//| :param ~microcontroller.Pin clk_dp: the positive clock signal pin +//| :param ~microcontroller.Pin clk_dn: the negative clock signal pin +//| :param ~microcontroller.Pin red_dp: the positive red signal pin +//| :param ~microcontroller.Pin red_dn: the negative red signal pin +//| :param ~microcontroller.Pin green_dp: the positive green signal pin +//| :param ~microcontroller.Pin green_dn: the negative green signal pin +//| :param ~microcontroller.Pin blue_dp: the positive blue signal pin +//| :param ~microcontroller.Pin blue_dn: the negative blue signal pin +//| :param int color_depth: the color depth of the framebuffer in bits. 1, 2 for grayscale +//| and 8 or 16 for color +//| """ + +STATIC mp_obj_t picodvi_framebuffer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_width, ARG_height, ARG_clk_dp, ARG_clk_dn, ARG_red_dp, ARG_red_dn, ARG_green_dp, + ARG_green_dn, ARG_blue_dp, ARG_blue_dn, ARG_color_depth }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_width, MP_ARG_INT | MP_ARG_REQUIRED }, + { MP_QSTR_height, MP_ARG_INT | MP_ARG_REQUIRED }, + + { MP_QSTR_clk_dp, MP_ARG_KW_ONLY | MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_clk_dn, MP_ARG_KW_ONLY | MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_red_dp, MP_ARG_KW_ONLY | MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_red_dn, MP_ARG_KW_ONLY | MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_green_dp, MP_ARG_KW_ONLY | MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_green_dn, MP_ARG_KW_ONLY | MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_blue_dp, MP_ARG_KW_ONLY | MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_blue_dn, MP_ARG_KW_ONLY | MP_ARG_OBJ | MP_ARG_REQUIRED }, + + { MP_QSTR_color_depth, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 8} }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + picodvi_framebuffer_obj_t *self = &allocate_display_bus_or_raise()->picodvi; + self->base.type = &picodvi_framebuffer_type; + + mp_uint_t width = (mp_uint_t)mp_arg_validate_int_min(args[ARG_width].u_int, 0, MP_QSTR_width); + mp_uint_t height = (mp_uint_t)mp_arg_validate_int_min(args[ARG_height].u_int, 0, MP_QSTR_height); + mp_uint_t color_depth = args[ARG_color_depth].u_int; + if (color_depth != 1 && color_depth != 2 && color_depth != 8 && color_depth != 16) { + mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_color_depth); + } + common_hal_picodvi_framebuffer_construct(self, + width, height, + validate_obj_is_free_pin(args[ARG_clk_dp].u_obj, MP_QSTR_clk_dp), + validate_obj_is_free_pin(args[ARG_clk_dn].u_obj, MP_QSTR_clk_dn), + validate_obj_is_free_pin(args[ARG_red_dp].u_obj, MP_QSTR_red_dp), + validate_obj_is_free_pin(args[ARG_red_dn].u_obj, MP_QSTR_red_dn), + validate_obj_is_free_pin(args[ARG_green_dp].u_obj, MP_QSTR_green_dp), + validate_obj_is_free_pin(args[ARG_green_dn].u_obj, MP_QSTR_green_dn), + validate_obj_is_free_pin(args[ARG_blue_dp].u_obj, MP_QSTR_blue_dp), + validate_obj_is_free_pin(args[ARG_blue_dn].u_obj, MP_QSTR_blue_dn), + color_depth); + + return MP_OBJ_FROM_PTR(self); +} + +//| def deinit(self) -> None: +//| """Free the resources (pins, timers, etc.) associated with this +//| rgbmatrix instance. After deinitialization, no further operations +//| may be performed.""" +//| ... +STATIC mp_obj_t picodvi_framebuffer_deinit(mp_obj_t self_in) { + picodvi_framebuffer_obj_t *self = (picodvi_framebuffer_obj_t *)self_in; + common_hal_picodvi_framebuffer_deinit(self); + return mp_const_none; +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_1(picodvi_framebuffer_deinit_obj, picodvi_framebuffer_deinit); + +static void check_for_deinit(picodvi_framebuffer_obj_t *self) { + if (common_hal_picodvi_framebuffer_deinited(self)) { + raise_deinited_error(); + } +} + +//| width: int +//| """The width of the framebuffer, in pixels. It may be doubled for output (and half of what +//| width was given to __init__.)""" +STATIC mp_obj_t picodvi_framebuffer_get_width(mp_obj_t self_in) { + picodvi_framebuffer_obj_t *self = (picodvi_framebuffer_obj_t *)self_in; + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_picodvi_framebuffer_get_width(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(picodvi_framebuffer_get_width_obj, picodvi_framebuffer_get_width); +MP_PROPERTY_GETTER(picodvi_framebuffer_width_obj, + (mp_obj_t)&picodvi_framebuffer_get_width_obj); + +//| height: int +//| """The width of the framebuffer, in pixels. It may be doubled for output (and half of what +//| width was given to __init__.)""" +//| +STATIC mp_obj_t picodvi_framebuffer_get_height(mp_obj_t self_in) { + picodvi_framebuffer_obj_t *self = (picodvi_framebuffer_obj_t *)self_in; + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_picodvi_framebuffer_get_height(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(picodvi_framebuffer_get_height_obj, picodvi_framebuffer_get_height); + +MP_PROPERTY_GETTER(picodvi_framebuffer_height_obj, + (mp_obj_t)&picodvi_framebuffer_get_height_obj); + +STATIC const mp_rom_map_elem_t picodvi_framebuffer_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&picodvi_framebuffer_deinit_obj) }, + + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&picodvi_framebuffer_width_obj) }, + { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&picodvi_framebuffer_height_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(picodvi_framebuffer_locals_dict, picodvi_framebuffer_locals_dict_table); + +STATIC void picodvi_framebuffer_get_bufinfo(mp_obj_t self_in, mp_buffer_info_t *bufinfo) { + common_hal_picodvi_framebuffer_get_buffer(self_in, bufinfo, 0); +} + +// These versions exist so that the prototype matches the protocol, +// avoiding a type cast that can hide errors +STATIC void picodvi_framebuffer_swapbuffers(mp_obj_t self_in, uint8_t *dirty_row_bitmap) { + (void)dirty_row_bitmap; + common_hal_picodvi_framebuffer_refresh(self_in); +} + +STATIC void picodvi_framebuffer_deinit_proto(mp_obj_t self_in) { + common_hal_picodvi_framebuffer_deinit(self_in); +} + +STATIC int picodvi_framebuffer_get_width_proto(mp_obj_t self_in) { + return common_hal_picodvi_framebuffer_get_width(self_in); +} + +STATIC int picodvi_framebuffer_get_height_proto(mp_obj_t self_in) { + return common_hal_picodvi_framebuffer_get_height(self_in); +} + +STATIC int picodvi_framebuffer_get_color_depth_proto(mp_obj_t self_in) { + return common_hal_picodvi_framebuffer_get_color_depth(self_in); + ; +} + +STATIC int picodvi_framebuffer_get_bytes_per_cell_proto(mp_obj_t self_in) { + return 1; +} + +STATIC int picodvi_framebuffer_get_native_frames_per_second_proto(mp_obj_t self_in) { + return 60; +} + +STATIC bool picodvi_framebuffer_get_pixels_in_byte_share_row_proto(mp_obj_t self_in) { + return true; +} + +STATIC int picodvi_framebuffer_get_row_stride_proto(mp_obj_t self_in) { + return common_hal_picodvi_framebuffer_get_row_stride(self_in); +} + +STATIC const framebuffer_p_t picodvi_framebuffer_proto = { + MP_PROTO_IMPLEMENT(MP_QSTR_protocol_framebuffer) + .get_bufinfo = picodvi_framebuffer_get_bufinfo, + .get_width = picodvi_framebuffer_get_width_proto, + .get_height = picodvi_framebuffer_get_height_proto, + .get_color_depth = picodvi_framebuffer_get_color_depth_proto, + .get_row_stride = picodvi_framebuffer_get_row_stride_proto, + .get_bytes_per_cell = picodvi_framebuffer_get_bytes_per_cell_proto, + .get_native_frames_per_second = picodvi_framebuffer_get_native_frames_per_second_proto, + .get_pixels_in_byte_share_row = picodvi_framebuffer_get_pixels_in_byte_share_row_proto, + .swapbuffers = picodvi_framebuffer_swapbuffers, + .deinit = picodvi_framebuffer_deinit_proto, +}; + +const mp_obj_type_t picodvi_framebuffer_type = { + { &mp_type_type }, + .flags = MP_TYPE_FLAG_EXTENDED, + .name = MP_QSTR_Framebuffer, + .locals_dict = (mp_obj_dict_t *)&picodvi_framebuffer_locals_dict, + .make_new = picodvi_framebuffer_make_new, + MP_TYPE_EXTENDED_FIELDS( + .buffer_p = { .get_buffer = common_hal_picodvi_framebuffer_get_buffer, }, + .protocol = &picodvi_framebuffer_proto, + ), +}; diff --git a/ports/raspberrypi/bindings/picodvi/Framebuffer.h b/ports/raspberrypi/bindings/picodvi/Framebuffer.h new file mode 100644 index 0000000000..cfcab4af50 --- /dev/null +++ b/ports/raspberrypi/bindings/picodvi/Framebuffer.h @@ -0,0 +1,49 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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. + */ + +#pragma once + +#include "common-hal/picodvi/Framebuffer.h" + +#include "shared-bindings/microcontroller/Pin.h" + +extern const mp_obj_type_t picodvi_framebuffer_type; + +void common_hal_picodvi_framebuffer_construct(picodvi_framebuffer_obj_t *self, + mp_uint_t width, mp_uint_t height, + const mcu_pin_obj_t *clk_dp, const mcu_pin_obj_t *clk_dn, + const mcu_pin_obj_t *red_dp, const mcu_pin_obj_t *red_dn, + const mcu_pin_obj_t *green_dp, const mcu_pin_obj_t *green_dn, + const mcu_pin_obj_t *blue_dp, const mcu_pin_obj_t *blue_dn, + mp_uint_t color_depth); +void common_hal_picodvi_framebuffer_deinit(picodvi_framebuffer_obj_t *self); +bool common_hal_picodvi_framebuffer_deinited(picodvi_framebuffer_obj_t *self); +void common_hal_picodvi_framebuffer_refresh(picodvi_framebuffer_obj_t *self); +int common_hal_picodvi_framebuffer_get_width(picodvi_framebuffer_obj_t *self); +int common_hal_picodvi_framebuffer_get_height(picodvi_framebuffer_obj_t *self); +int common_hal_picodvi_framebuffer_get_row_stride(picodvi_framebuffer_obj_t *self); +int common_hal_picodvi_framebuffer_get_color_depth(picodvi_framebuffer_obj_t *self); +mp_int_t common_hal_picodvi_framebuffer_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags); diff --git a/ports/raspberrypi/bindings/picodvi/__init__.c b/ports/raspberrypi/bindings/picodvi/__init__.c new file mode 100644 index 0000000000..edfe7759c8 --- /dev/null +++ b/ports/raspberrypi/bindings/picodvi/__init__.c @@ -0,0 +1,48 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 + +#include "py/obj.h" +#include "py/runtime.h" + +#include "bindings/picodvi/Framebuffer.h" + +//| """Low-level routines for interacting with PicoDVI Output""" + +STATIC const mp_rom_map_elem_t picodvi_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_picodvi) }, + { MP_ROM_QSTR(MP_QSTR_Framebuffer), MP_ROM_PTR(&picodvi_framebuffer_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(picodvi_module_globals, picodvi_module_globals_table); + +const mp_obj_module_t picodvi_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&picodvi_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_picodvi, picodvi_module, CIRCUITPY_PICODVI); diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/board.c b/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/board.c index 331653173e..bcbab5e4cd 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/board.c +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/board.c @@ -26,4 +26,27 @@ #include "supervisor/board.h" +#include "bindings/picodvi/Framebuffer.h" +#include "shared-module/displayio/__init__.h" +#include "shared-bindings/framebufferio/FramebufferDisplay.h" + +void board_init(void) { + picodvi_framebuffer_obj_t *fb = &allocate_display_bus()->picodvi; + fb->base.type = &picodvi_framebuffer_type; + common_hal_picodvi_framebuffer_construct(fb, 640, 480, + &pin_GPIO17, &pin_GPIO16, + &pin_GPIO19, &pin_GPIO18, + &pin_GPIO21, &pin_GPIO20, + &pin_GPIO23, &pin_GPIO22, + 8); + + framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; + display->base.type = &framebufferio_framebufferdisplay_type; + common_hal_framebufferio_framebufferdisplay_construct( + display, + MP_OBJ_FROM_PTR(fb), + 0, + true); +} + // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/mpconfigboard.mk index a60ff7b9a7..ca8a6fa396 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/mpconfigboard.mk +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/mpconfigboard.mk @@ -7,3 +7,5 @@ CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ" + +CIRCUITPY_PICODVI = 1 diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/pins.c b/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/pins.c index c8b4e3474f..3dd0fe86bb 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/pins.c +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/pins.c @@ -1,5 +1,7 @@ #include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS @@ -49,6 +51,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D2N), MP_ROM_PTR(&pin_GPIO22) }, { MP_ROM_QSTR(MP_QSTR_D2P), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].framebuffer_display)}, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, diff --git a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk index 608ca280df..20607d50e4 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk +++ b/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.mk @@ -9,3 +9,4 @@ CHIP_FAMILY = rp2 EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" CIRCUITPY__EVE = 1 +CIRCUITPY_PICODVI = 1 diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/link.ld b/ports/raspberrypi/boards/raspberry_pi_pico_w/link.ld index 2777b41720..e814bead4c 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico_w/link.ld +++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/link.ld @@ -1,294 +1 @@ -/* Based on GCC ARM embedded samples. - Defines the following symbols for use by code: - __exidx_start - __exidx_end - __etext - __data_start__ - __preinit_array_start - __preinit_array_end - __init_array_start - __init_array_end - __fini_array_start - __fini_array_end - __data_end__ - __bss_start__ - __bss_end__ - __end__ - end - __HeapLimit - __StackLimit - __StackTop - __stack (== StackTop) -*/ - -MEMORY -{ - FLASH_FIRMWARE (rx) : ORIGIN = 0x10000000, LENGTH = 1532k - /* Followed by: 4kB of NVRAM and at least 512kB of CIRCUITPY */ - RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k - SCRATCH_X (rwx) : ORIGIN = 0x20040000, LENGTH = 4k - SCRATCH_Y (rwx) : ORIGIN = 0x20041000, LENGTH = 4k -} - -ENTRY(_entry_point) - -SECTIONS -{ - /* Second stage bootloader is prepended to the image. It must be 256 bytes big - and checksummed. It is usually built by the boot_stage2 target - in the Pico SDK - */ - - .flash_begin : { - __flash_binary_start = .; - } > FLASH_FIRMWARE - - .boot2 : { - __boot2_start__ = .; - KEEP (*(.boot2)) - __boot2_end__ = .; - } > FLASH_FIRMWARE - - ASSERT(__boot2_end__ - __boot2_start__ == 256, - "ERROR: Pico second stage bootloader must be 256 bytes in size") - - /* The second stage will always enter the image at the start of .text. - The debugger will use the ELF entry point, which is the _entry_point - symbol if present, otherwise defaults to start of .text. - This can be used to transfer control back to the bootrom on debugger - launches only, to perform proper flash setup. - */ - - .text : { - __logical_binary_start = .; - KEEP (*(.vectors)) - KEEP (*(.binary_info_header)) - __binary_info_header_end = .; - KEEP (*(.reset)) - /* TODO revisit this now memset/memcpy/float in ROM */ - /* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from - * FLASH ... we will include any thing excluded here in .data below by default */ - *(.init) - - __property_getter_start = .; - *(.property_getter) - __property_getter_end = .; - __property_getset_start = .; - *(.property_getset) - __property_getset_end = .; - - *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .text*) - *(.fini) - /* Pull all c'tors into .text */ - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - /* Followed by destructors */ - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) - *(SORT(.dtors.*)) - *(.dtors) - - *(.eh_frame*) - . = ALIGN(4); - } > FLASH_FIRMWARE - - .rodata : { - *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .rodata*) - . = ALIGN(4); - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*))) - . = ALIGN(4); - } > FLASH_FIRMWARE - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > FLASH_FIRMWARE - - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > FLASH_FIRMWARE - __exidx_end = .; - - /* Machine inspectable binary information */ - . = ALIGN(4); - __binary_info_start = .; - .binary_info : - { - KEEP(*(.binary_info.keep.*)) - *(.binary_info.*) - } > FLASH_FIRMWARE - __binary_info_end = .; - . = ALIGN(4); - - /* End of .text-like segments */ - __etext = .; - - .ram_vector_table (COPY): { - *(.ram_vector_table) - } > RAM - - .data : { - __data_start__ = .; - *(vtable) - - *(.time_critical*) - - /* remaining .text and .rodata; i.e. stuff we exclude above because we want it in RAM */ - *(.text*) - . = ALIGN(4); - *(.rodata*) - . = ALIGN(4); - - *(.data*) - - . = ALIGN(4); - *(.after_data.*) - . = ALIGN(4); - /* preinit data */ - PROVIDE_HIDDEN (__mutex_array_start = .); - KEEP(*(SORT(.mutex_array.*))) - KEEP(*(.mutex_array)) - PROVIDE_HIDDEN (__mutex_array_end = .); - - . = ALIGN(4); - /* preinit data */ - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(SORT(.preinit_array.*))) - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - - . = ALIGN(4); - /* init data */ - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - - . = ALIGN(4); - /* finit data */ - PROVIDE_HIDDEN (__fini_array_start = .); - *(SORT(.fini_array.*)) - *(.fini_array) - PROVIDE_HIDDEN (__fini_array_end = .); - - *(.jcr) - . = ALIGN(4); - /* All data end */ - __data_end__ = .; - } > RAM AT> FLASH_FIRMWARE - - .itcm : - { - . = ALIGN(4); - *(.itcm.*) - - . = ALIGN(4); - } > RAM AT> FLASH_FIRMWARE - _ld_itcm_destination = ADDR(.itcm); - _ld_itcm_flash_copy = LOADADDR(.itcm); - _ld_itcm_size = SIZEOF(.itcm); - - .dtcm_data : - { - . = ALIGN(4); - - *(.dtcm_data.*) - - . = ALIGN(4); - } > RAM AT> FLASH_FIRMWARE - _ld_dtcm_data_destination = ADDR(.dtcm_data); - _ld_dtcm_data_flash_copy = LOADADDR(.dtcm_data); - _ld_dtcm_data_size = SIZEOF(.dtcm_data); - - .dtcm_bss : - { - . = ALIGN(4); - - *(.dtcm_bss.*) - - . = ALIGN(4); - } > RAM AT> RAM - _ld_dtcm_bss_start = ADDR(.dtcm_bss); - _ld_dtcm_bss_size = SIZEOF(.dtcm_bss); - - .uninitialized_data (COPY): { - . = ALIGN(4); - *(.uninitialized_data*) - } > RAM - - /* Start and end symbols must be word-aligned */ - .scratch_x : { - __scratch_x_start__ = .; - *(.scratch_x.*) - . = ALIGN(4); - __scratch_x_end__ = .; - } > SCRATCH_X AT > FLASH_FIRMWARE - __scratch_x_source__ = LOADADDR(.scratch_x); - - .scratch_y : { - __scratch_y_start__ = .; - *(.scratch_y.*) - . = ALIGN(4); - __scratch_y_end__ = .; - } > SCRATCH_Y AT > FLASH_FIRMWARE - __scratch_y_source__ = LOADADDR(.scratch_y); - - .bss : { - . = ALIGN(4); - __bss_start__ = .; - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*))) - *(COMMON) - . = ALIGN(4); - __bss_end__ = .; - } > RAM - - .heap (COPY): - { - __end__ = .; - end = __end__; - *(.heap*) - __HeapLimit = .; - } > RAM - - /* .stack*_dummy section doesn't contains any symbols. It is only - * used for linker to calculate size of stack sections, and assign - * values to stack symbols later - * - * stack1 section may be empty/missing if platform_launch_core1 is not used */ - - /* by default we put core 0 stack at the end of scratch Y, so that if core 1 - * stack is not used then all of SCRATCH_X is free. - */ - .stack1_dummy (COPY): - { - *(.stack1*) - } > SCRATCH_X - .stack_dummy (COPY): - { - *(.stack*) - } > SCRATCH_Y - - .flash_end : { - __flash_binary_end = .; - } > FLASH_FIRMWARE - - /* stack limit is poorly named, but historically is maximum heap ptr */ - __StackLimit = ORIGIN(RAM) + LENGTH(RAM); - __StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X); - __StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y); - __StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy); - __StackBottom = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - - /* Check if data + heap + stack exceeds RAM limit */ - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed") - - ASSERT( __binary_info_header_end - __logical_binary_start <= 256, "Binary info must be in first 256 bytes of the binary") - /* todo assert on extra code */ -} +firmware_size = 1532k; diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk index a050391505..f36f98b7c5 100644 --- a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk +++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk @@ -19,6 +19,8 @@ CIRCUITPY_MDNS = 1 CIRCUITPY_SOCKETPOOL = 1 CIRCUITPY_WIFI = 1 +CIRCUITPY_PICODVI = 1 + CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 # Must be accompanied by a linker script change CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' diff --git a/ports/raspberrypi/common-hal/picodvi/Framebuffer.c b/ports/raspberrypi/common-hal/picodvi/Framebuffer.c new file mode 100644 index 0000000000..20f447a824 --- /dev/null +++ b/ports/raspberrypi/common-hal/picodvi/Framebuffer.c @@ -0,0 +1,419 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "bindings/picodvi/Framebuffer.h" + +#include "py/gc.h" +#include "py/runtime.h" +#include "shared-bindings/time/__init__.h" +#include "common-hal/pwmio/PWMOut.h" +#include "common-hal/rp2pio/StateMachine.h" + +#include "src/common/pico_stdlib/include/pico/stdlib.h" +#include "src/rp2040/hardware_structs/include/hardware/structs/mpu.h" +#include "src/rp2_common/cmsis/stub/CMSIS/Device/RaspberryPi/RP2040/Include/RP2040.h" +#include "src/rp2_common/hardware_pwm/include/hardware/pwm.h" +#include "src/rp2_common/hardware_vreg/include/hardware/vreg.h" +#include "src/rp2_common/pico_multicore/include/pico/multicore.h" + +#include "lib/PicoDVI/software/libdvi/tmds_encode.h" + +picodvi_framebuffer_obj_t *active_picodvi = NULL; + +STATIC PIO pio_instances[2] = {pio0, pio1}; + +static void __not_in_flash_func(core1_main)(void) { + // The MPU is reset before this starts. + + picodvi_framebuffer_obj_t *self = active_picodvi; + dvi_register_irqs_this_core(&self->dvi, DMA_IRQ_1); + + while (queue_is_empty(&self->dvi.q_colour_valid)) { + __wfe(); + } + dvi_start(&self->dvi); + + // Turn off flash access. After this, it will hard fault. Better than messing + // up CIRCUITPY. + MPU->CTRL = MPU_CTRL_PRIVDEFENA_Msk | MPU_CTRL_ENABLE_Msk; + MPU->RNR = 6; // 7 is used by pico-sdk stack protection. + MPU->RBAR = XIP_MAIN_BASE | MPU_RBAR_VALID_Msk; + MPU->RASR = MPU_RASR_XN_Msk | // Set execute never and everything else is restricted. + MPU_RASR_ENABLE_Msk | + (0x1b << MPU_RASR_SIZE_Pos); // Size is 0x10000000 which masks up to SRAM region. + MPU->RNR = 7; + + uint y = 0; + while (1) { + uint32_t *scanbuf; + queue_remove_blocking_u32(&self->dvi.q_colour_valid, &scanbuf); + + uint32_t *tmdsbuf; + queue_remove_blocking_u32(&self->dvi.q_tmds_free, &tmdsbuf); + // Check to see if the tmds memory has moved and replace this tmdsbuf + // the corresponding on at a new location. + size_t old_fb = tmdsbuf[self->tmdsbuf_size - 1]; + if (old_fb != (uint32_t)self->framebuffer) { + size_t index = ((uint32_t)(tmdsbuf - old_fb)) / self->tmdsbuf_size; + // Check our index and hang if it is out of range. Hang is ok since this is core 1. + // Better than writing the wrong memory that is shared with CP. + while (index >= DVI_N_TMDS_BUFFERS) { + } + tmdsbuf = self->framebuffer + self->framebuffer_len + (self->tmdsbuf_size * index); + tmdsbuf[self->tmdsbuf_size - 1] = (uint32_t)self->framebuffer; + } + uint pixwidth = self->dvi.timing->h_active_pixels; + uint words_per_channel = pixwidth / DVI_SYMBOLS_PER_WORD; + if (self->color_depth == 8) { + tmds_encode_data_channel_8bpp(scanbuf, tmdsbuf + 0 * words_per_channel, pixwidth / 2, DVI_8BPP_BLUE_MSB, DVI_8BPP_BLUE_LSB); + tmds_encode_data_channel_8bpp(scanbuf, tmdsbuf + 1 * words_per_channel, pixwidth / 2, DVI_8BPP_GREEN_MSB, DVI_8BPP_GREEN_LSB); + tmds_encode_data_channel_8bpp(scanbuf, tmdsbuf + 2 * words_per_channel, pixwidth / 2, DVI_8BPP_RED_MSB, DVI_8BPP_RED_LSB); + } else if (self->color_depth == 16) { + tmds_encode_data_channel_16bpp(scanbuf, tmdsbuf + 0 * words_per_channel, pixwidth / 2, DVI_16BPP_BLUE_MSB, DVI_16BPP_BLUE_LSB); + tmds_encode_data_channel_16bpp(scanbuf, tmdsbuf + 1 * words_per_channel, pixwidth / 2, DVI_16BPP_GREEN_MSB, DVI_16BPP_GREEN_LSB); + tmds_encode_data_channel_16bpp(scanbuf, tmdsbuf + 2 * words_per_channel, pixwidth / 2, DVI_16BPP_RED_MSB, DVI_16BPP_RED_LSB); + } else if (self->color_depth == 1) { + tmds_encode_1bpp(scanbuf, tmdsbuf, pixwidth); + } else if (self->color_depth == 2) { + tmds_encode_2bpp(scanbuf, tmdsbuf, pixwidth); + } + queue_add_blocking_u32(&self->dvi.q_tmds_valid, &tmdsbuf); + + queue_add_blocking_u32(&self->dvi.q_colour_free, &scanbuf); + ++y; + if (y == self->dvi.timing->v_active_lines) { + y = 0; + } + } + __builtin_unreachable(); +} + +static void __not_in_flash_func(core1_scanline_callback)(void) { + picodvi_framebuffer_obj_t *self = active_picodvi; + uint32_t *next_scanline_buf; + next_scanline_buf = self->framebuffer + (self->pitch * self->next_scanline); + queue_add_blocking_u32(&self->dvi.q_colour_valid, &next_scanline_buf); + + // Remove any buffers that were sent back to us. + while (queue_try_remove_u32(&self->dvi.q_colour_free, &next_scanline_buf)) { + } + self->next_scanline += 1; + if (self->next_scanline >= self->height) { + self->next_scanline = 0; + // Update the framebuffer pointer in case it moved. + self->framebuffer = self->allocation->ptr; + } +} + +extern uint8_t dvi_vertical_repeat; +extern bool dvi_monochrome_tmds; + +void common_hal_picodvi_framebuffer_construct(picodvi_framebuffer_obj_t *self, + mp_uint_t width, mp_uint_t height, + const mcu_pin_obj_t *clk_dp, const mcu_pin_obj_t *clk_dn, + const mcu_pin_obj_t *red_dp, const mcu_pin_obj_t *red_dn, + const mcu_pin_obj_t *green_dp, const mcu_pin_obj_t *green_dn, + const mcu_pin_obj_t *blue_dp, const mcu_pin_obj_t *blue_dn, + mp_uint_t color_depth) { + + const struct dvi_timing *timing = NULL; + if (width == 640 && height == 480) { + timing = &dvi_timing_640x480p_60hz; + } else if (width == 800 && height == 480) { + timing = &dvi_timing_800x480p_60hz; + } else { + if (height == 480) { + mp_raise_ValueError_varg(translate("%q must be %d"), MP_QSTR_width, 480); + } + mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_height); + } + + if (active_picodvi != NULL) { + mp_raise_msg_varg(&mp_type_RuntimeError, translate("%q in use"), MP_QSTR_picodvi); + } + + bool invert_diffpairs = clk_dn->number < clk_dp->number; + int8_t other_pins[4]; + int8_t *a; + int8_t *b; + if (invert_diffpairs) { + a = other_pins; + b = self->pin_pair; + } else { + a = self->pin_pair; + b = other_pins; + } + a[0] = clk_dp->number; + a[1] = red_dp->number; + a[2] = green_dp->number; + a[3] = blue_dp->number; + b[0] = clk_dn->number; + b[1] = red_dn->number; + b[2] = green_dn->number; + b[3] = blue_dn->number; + qstr pin_names[4] = {MP_QSTR_clk_dp, MP_QSTR_red_dp, MP_QSTR_green_dp, MP_QSTR_blue_dp}; + for (size_t i = 0; i < 4; i++) { + if (other_pins[i] - self->pin_pair[i] != 1) { + raise_ValueError_invalid_pin_name(pin_names[i]); + } + } + + uint8_t slice = pwm_gpio_to_slice_num(self->pin_pair[0]); + + + pio_program_t program_struct = { + .instructions = NULL, + .length = 2, + .origin = -1 + }; + size_t pio_index = NUM_PIOS; + int free_state_machines[4]; // We may find all four free. We only use the first three. + for (size_t i = 0; i < NUM_PIOS; i++) { + PIO pio = pio_instances[i]; + uint8_t free_count = 0; + for (size_t sm = 0; sm < NUM_PIO_STATE_MACHINES; sm++) { + if (!pio_sm_is_claimed(pio, sm)) { + free_state_machines[free_count] = sm; + free_count++; + } + } + if (free_count >= 3 && pio_can_add_program(pio, &program_struct)) { + pio_index = i; + break; + } + } + + if (pio_index == NUM_PIOS) { + mp_raise_RuntimeError(translate("All state machines in use")); + } + + self->width = width; + self->height = height; + + size_t tmds_bufs_per_scanline; + if (color_depth >= 8) { + dvi_vertical_repeat = 2; + dvi_monochrome_tmds = false; + self->width /= 2; + self->height /= 2; + tmds_bufs_per_scanline = 3; + } else { + dvi_vertical_repeat = 1; + dvi_monochrome_tmds = true; + // One tmds buffer is used for all three color outputs. + tmds_bufs_per_scanline = 1; + } + self->pitch = (self->width * color_depth) / 8; + // Align each row to words. + if (self->pitch % sizeof(uint32_t) != 0) { + self->pitch += sizeof(uint32_t) - (self->pitch % sizeof(uint32_t)); + } + self->pitch /= sizeof(uint32_t); + size_t framebuffer_size = self->pitch * self->height; + // use width here because it hasn't been downsized for the frame buffer + self->tmdsbuf_size = tmds_bufs_per_scanline * width / DVI_SYMBOLS_PER_WORD + 1; + size_t total_allocation_size = sizeof(uint32_t) * (framebuffer_size + DVI_N_TMDS_BUFFERS * self->tmdsbuf_size); + self->allocation = allocate_memory(total_allocation_size, false, true); + if (self->allocation == NULL) { + m_malloc_fail(total_allocation_size); + return; + } + + // Do the pwmio check last because it claims the pwm slice. + if (!pwmio_claim_slice_ab_channels(slice)) { + mp_raise_ValueError(translate("All timers for this pin are in use")); + } + self->pwm_slice = slice; + + pwmout_never_reset(self->pwm_slice, 0); + pwmout_never_reset(self->pwm_slice, 1); + + for (size_t i = 0; i < 4; i++) { + never_reset_pin_number(self->pin_pair[i]); + never_reset_pin_number(self->pin_pair[i] + 1); + } + + for (size_t i = 0; i < 3; i++) { + rp2pio_statemachine_never_reset(pio_instances[pio_index], free_state_machines[i]); + } + + // For the output. + user_irq_claim(DMA_IRQ_1); + self->framebuffer_len = framebuffer_size; + self->framebuffer = self->allocation->ptr; + self->color_depth = color_depth; + + self->dvi.timing = timing; + self->dvi.ser_cfg.pio = pio_instances[pio_index]; + self->dvi.ser_cfg.sm_tmds[0] = free_state_machines[0]; + self->dvi.ser_cfg.sm_tmds[1] = free_state_machines[1]; + self->dvi.ser_cfg.sm_tmds[2] = free_state_machines[2]; + self->dvi.ser_cfg.pins_clk = self->pin_pair[0]; + self->dvi.ser_cfg.pins_tmds[0] = self->pin_pair[1]; + self->dvi.ser_cfg.pins_tmds[1] = self->pin_pair[2]; + self->dvi.ser_cfg.pins_tmds[2] = self->pin_pair[3]; + self->dvi.ser_cfg.invert_diffpairs = invert_diffpairs; + self->dvi.scanline_callback = core1_scanline_callback; + + vreg_set_voltage(VREG_VOLTAGE_1_20); + common_hal_time_delay_ms(10); + set_sys_clock_khz(timing->bit_clk_khz, true); // Run at TMDS bit clock + self->tmds_lock = next_striped_spin_lock_num(); + self->colour_lock = next_striped_spin_lock_num(); + dvi_init(&self->dvi, self->tmds_lock, self->colour_lock); + + // Load up the TMDS buffers. + for (int i = 0; i < DVI_N_TMDS_BUFFERS; ++i) { + uint32_t *tmdsbuf = self->framebuffer + (self->framebuffer_len + self->tmdsbuf_size * i); + // Use the last word in the buffer to track its original root. That way + // we can detect when framebuffer is moved. + tmdsbuf[self->tmdsbuf_size - 1] = (uint32_t)self->framebuffer; + queue_add_blocking_u32(&self->dvi.q_tmds_free, &tmdsbuf); + } + + active_picodvi = self; + + // Core 1 will wait until it sees the first colour buffer, then start up the + // DVI signalling. + multicore_launch_core1(core1_main); + + self->next_scanline = 0; + uint32_t *next_scanline_buf = self->framebuffer + (self->pitch * self->next_scanline); + queue_add_blocking_u32(&self->dvi.q_colour_valid, &next_scanline_buf); + self->next_scanline += 1; + next_scanline_buf = self->framebuffer + (self->pitch * self->next_scanline); + queue_add_blocking_u32(&self->dvi.q_colour_valid, &next_scanline_buf); + self->next_scanline += 1; + + // Wait for the second core to run dvi_start because it is in flash. Once it is done, + // it'll pull from this queue. Not waiting may lead to us reading flash when this core + // doesn't want us to. + while (queue_get_level(&self->dvi.q_colour_valid) == 2) { + } +} + +STATIC void _turn_off_dma(uint8_t channel) { + dma_channel_config c = dma_channel_get_default_config(channel); + channel_config_set_enable(&c, false); + dma_channel_set_config(channel, &c, false /* trigger */); + + if (dma_channel_is_busy(channel)) { + dma_channel_abort(channel); + } + dma_channel_set_irq1_enabled(channel, false); + dma_channel_unclaim(channel); +} + +void common_hal_picodvi_framebuffer_deinit(picodvi_framebuffer_obj_t *self) { + if (common_hal_picodvi_framebuffer_deinited(self)) { + return; + } + // Stop the other core and free resources. + + // Grab the locks before shutting down the other core so we don't leave the + // locks locked. + spin_lock_t *tmds_lock = spin_lock_instance(self->tmds_lock); + spin_lock_t *colour_lock = spin_lock_instance(self->colour_lock); + uint32_t tmds_save = spin_lock_blocking(tmds_lock); + uint32_t colour_save = spin_lock_blocking(colour_lock); + multicore_reset_core1(); + spin_unlock(colour_lock, colour_save); + spin_unlock(tmds_lock, tmds_save); + + for (size_t i = 0; i < 4; i++) { + reset_pin_number(self->pin_pair[i]); + reset_pin_number(self->pin_pair[i] + 1); + } + + for (int i = 0; i < N_TMDS_LANES; ++i) { + // Turn off data first because it chains to the ctrl DMA. + _turn_off_dma(self->dvi.dma_cfg[i].chan_data); + _turn_off_dma(self->dvi.dma_cfg[i].chan_ctrl); + } + + pwm_set_enabled(self->pwm_slice, false); + pwmout_free(self->pwm_slice, 0); + pwmout_free(self->pwm_slice, 1); + + pio_program_t program_struct = { + .length = 2 + }; + PIO pio = self->dvi.ser_cfg.pio; + for (size_t i = 0; i < 3; i++) { + int sm = self->dvi.ser_cfg.sm_tmds[i]; + pio_sm_set_enabled(pio, sm, false); + pio_sm_unclaim(pio, sm); + rp2pio_statemachine_reset_ok(pio, sm); + } + pio_remove_program(pio, &program_struct, self->dvi.ser_cfg.prog_offs); + + if (user_irq_is_claimed(DMA_IRQ_1)) { + user_irq_unclaim(DMA_IRQ_1); + } + + active_picodvi = NULL; + + free_memory(self->allocation); + self->framebuffer = NULL; + + self->base.type = &mp_type_NoneType; +} + +bool common_hal_picodvi_framebuffer_deinited(picodvi_framebuffer_obj_t *self) { + return self->framebuffer == NULL; +} + +void common_hal_picodvi_framebuffer_refresh(picodvi_framebuffer_obj_t *self) { +} + +int common_hal_picodvi_framebuffer_get_width(picodvi_framebuffer_obj_t *self) { + return self->width; +} + +int common_hal_picodvi_framebuffer_get_height(picodvi_framebuffer_obj_t *self) { + return self->height; +} + +int common_hal_picodvi_framebuffer_get_color_depth(picodvi_framebuffer_obj_t *self) { + return self->color_depth; +} + +mp_int_t common_hal_picodvi_framebuffer_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) { + picodvi_framebuffer_obj_t *self = (picodvi_framebuffer_obj_t *)self_in; + bufinfo->buf = self->framebuffer; + char typecode = 'B'; + if (self->color_depth == 16) { + typecode = 'H'; + } + bufinfo->typecode = typecode; + bufinfo->len = self->framebuffer_len * sizeof(uint32_t); + return 0; +} + +int common_hal_picodvi_framebuffer_get_row_stride(picodvi_framebuffer_obj_t *self) { + // Pitch is in words but row stride is expected as bytes. + return self->pitch * sizeof(uint32_t); +} diff --git a/ports/raspberrypi/common-hal/picodvi/Framebuffer.h b/ports/raspberrypi/common-hal/picodvi/Framebuffer.h new file mode 100644 index 0000000000..f5d7df8f9a --- /dev/null +++ b/ports/raspberrypi/common-hal/picodvi/Framebuffer.h @@ -0,0 +1,51 @@ +#pragma once + +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "py/obj.h" + +#include "supervisor/memory.h" + +#include "lib/PicoDVI/software/libdvi/dvi.h" + +typedef struct { + mp_obj_base_t base; + supervisor_allocation *allocation; + uint32_t *framebuffer; + size_t framebuffer_len; // in words + size_t tmdsbuf_size; // in words + struct dvi_inst dvi; + mp_uint_t width; + mp_uint_t height; + uint tmds_lock; + uint colour_lock; + uint16_t next_scanline; + uint16_t pitch; // Number of words between rows. (May be more than a width's worth.) + uint8_t color_depth; + uint8_t pwm_slice; + int8_t pin_pair[4]; +} picodvi_framebuffer_obj_t; diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index e9cb3d34bb..9034b64242 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -218,9 +218,7 @@ bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, _current_program_len[i][j] == program_len) { program_offset = _current_program_offset[i][j]; } - int temp_claim = pio_claim_unused_sm(pio, false); - if (temp_claim >= 0) { - pio_sm_unclaim(pio, temp_claim); + if (!pio_sm_is_claimed(pio, j)) { free_count++; } } @@ -634,6 +632,16 @@ void common_hal_rp2pio_statemachine_set_frequency(rp2pio_statemachine_obj_t *sel pio_sm_clkdiv_restart(self->pio, self->state_machine); } +void rp2pio_statemachine_reset_ok(PIO pio, int sm) { + uint8_t pio_index = pio_get_index(pio); + _never_reset[pio_index][sm] = false; +} + +void rp2pio_statemachine_never_reset(PIO pio, int sm) { + uint8_t pio_index = pio_get_index(pio); + _never_reset[pio_index][sm] = true; +} + void rp2pio_statemachine_deinit(rp2pio_statemachine_obj_t *self, bool leave_pins) { common_hal_rp2pio_statemachine_stop(self); (void)common_hal_rp2pio_statemachine_stop_background_write(self); @@ -654,9 +662,7 @@ void common_hal_rp2pio_statemachine_deinit(rp2pio_statemachine_obj_t *self) { } void common_hal_rp2pio_statemachine_never_reset(rp2pio_statemachine_obj_t *self) { - uint8_t sm = self->state_machine; - uint8_t pio_index = pio_get_index(self->pio); - _never_reset[pio_index][sm] = true; + rp2pio_statemachine_never_reset(self->pio, self->state_machine); // TODO: never reset all the pins } diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.h b/ports/raspberrypi/common-hal/rp2pio/StateMachine.h index 03dadc53b3..71f85b1f11 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.h +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.h @@ -95,6 +95,9 @@ uint8_t rp2pio_statemachine_program_offset(rp2pio_statemachine_obj_t *self); void rp2pio_statemachine_deinit(rp2pio_statemachine_obj_t *self, bool leave_pins); void rp2pio_statemachine_dma_complete(rp2pio_statemachine_obj_t *self, int channel); +void rp2pio_statemachine_reset_ok(PIO pio, int sm); +void rp2pio_statemachine_never_reset(PIO pio, int sm); + extern const mp_obj_type_t rp2pio_statemachine_type; #endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_RP2PIO_STATEMACHINE_H diff --git a/ports/raspberrypi/lib/PicoDVI b/ports/raspberrypi/lib/PicoDVI new file mode 160000 index 0000000000..23a3a3bf18 --- /dev/null +++ b/ports/raspberrypi/lib/PicoDVI @@ -0,0 +1 @@ +Subproject commit 23a3a3bf18820f2abd78e8a9c05b45c01b5a3810 diff --git a/ports/raspberrypi/link.ld b/ports/raspberrypi/link.ld index 982c5e3a0c..1e758f61bf 100644 --- a/ports/raspberrypi/link.ld +++ b/ports/raspberrypi/link.ld @@ -21,13 +21,16 @@ __stack (== StackTop) */ +firmware_size = DEFINED(firmware_size) ? firmware_size : 1020K ; + MEMORY { - FLASH_FIRMWARE (rx) : ORIGIN = 0x10000000, LENGTH = 1020k + FLASH_FIRMWARE (rx) : ORIGIN = 0x10000000, LENGTH = firmware_size /* Followed by: 4kB of NVRAM and at least 1024kB of CIRCUITPY */ RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k - SCRATCH_X (rwx) : ORIGIN = 0x20040000, LENGTH = 4k - SCRATCH_Y (rwx) : ORIGIN = 0x20041000, LENGTH = 4k + SCRATCH_Y (rwx) : ORIGIN = 0x20040000, LENGTH = 4k + /* X is used by core 1 so we put it last. */ + SCRATCH_X (rwx) : ORIGIN = 0x20041000, LENGTH = 4k } ENTRY(_entry_point) @@ -77,7 +80,7 @@ SECTIONS *(.property_getset) __property_getset_end = .; - *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .text*) + *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a: *interp.o *divider.o) .text*) *(.fini) /* Pull all c'tors into .text */ *crtbegin.o(.ctors) @@ -137,7 +140,7 @@ SECTIONS __data_start__ = .; *(vtable) - *(.time_critical*) + *(EXCLUDE_FILE(*tmds_encode.o) .time_critical*) /* remaining .text and .rodata; i.e. stuff we exclude above because we want it in RAM */ *(.text*) @@ -222,23 +225,6 @@ SECTIONS *(.uninitialized_data*) } > RAM - /* Start and end symbols must be word-aligned */ - .scratch_x : { - __scratch_x_start__ = .; - *(.scratch_x.*) - . = ALIGN(4); - __scratch_x_end__ = .; - } > SCRATCH_X AT > FLASH_FIRMWARE - __scratch_x_source__ = LOADADDR(.scratch_x); - - .scratch_y : { - __scratch_y_start__ = .; - *(.scratch_y.*) - . = ALIGN(4); - __scratch_y_end__ = .; - } > SCRATCH_Y AT > FLASH_FIRMWARE - __scratch_y_source__ = LOADADDR(.scratch_y); - .bss : { . = ALIGN(4); __bss_start__ = .; @@ -252,10 +238,30 @@ SECTIONS { __end__ = .; end = __end__; + _ld_cp_dynamic_mem_start = .; *(.heap*) __HeapLimit = .; } > RAM + /* Start and end symbols must be word-aligned */ + .scratch_x : { + __scratch_x_start__ = .; + *(.scratch_x.*) + *tmds_encode.o (.time_critical*) + . = ALIGN(4); + __scratch_x_end__ = .; + } > SCRATCH_X AT > FLASH_FIRMWARE + __scratch_x_source__ = LOADADDR(.scratch_x); + + .scratch_y : { + __scratch_y_start__ = .; + /* Don't put anything into scratch y because CircuitPython manages it and uses it for core 0 stack. + /* *(.scratch_y.*) */ + . = ALIGN(4); + __scratch_y_end__ = .; + } > SCRATCH_Y AT > FLASH_FIRMWARE + __scratch_y_source__ = LOADADDR(.scratch_y); + /* .stack*_dummy section doesn't contains any symbols. It is only * used for linker to calculate size of stack sections, and assign * values to stack symbols later @@ -269,6 +275,7 @@ SECTIONS { *(.stack1*) } > SCRATCH_X + .stack_dummy (COPY): { *(.stack*) @@ -282,6 +289,7 @@ SECTIONS __StackLimit = ORIGIN(RAM) + LENGTH(RAM); __StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X); __StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y); + _ld_cp_dynamic_mem_end = __StackTop; __StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy); __StackBottom = __StackTop - SIZEOF(.stack_dummy); PROVIDE(__stack = __StackTop); diff --git a/ports/raspberrypi/mpconfigport.mk b/ports/raspberrypi/mpconfigport.mk index 671d4669bf..ab60207b0d 100644 --- a/ports/raspberrypi/mpconfigport.mk +++ b/ports/raspberrypi/mpconfigport.mk @@ -39,7 +39,7 @@ CIRCUITPY_AUDIOBUSIO ?= 1 CIRCUITPY_AUDIOCORE ?= 1 CIRCUITPY_AUDIOPWMIO ?= 1 -CIRCUITPY_AUDIOMIXER = 1 +CIRCUITPY_AUDIOMIXER ?= 1 INTERNAL_LIBM = 1 diff --git a/ports/raspberrypi/sdk_config/pico/config_autogen.h b/ports/raspberrypi/sdk_config/pico/config_autogen.h index ee99b1c609..85a8cccb6f 100644 --- a/ports/raspberrypi/sdk_config/pico/config_autogen.h +++ b/ports/raspberrypi/sdk_config/pico/config_autogen.h @@ -3,6 +3,7 @@ #include "pico-sdk-configboard.h" // alphabetized +#define LIB_CMSIS_CORE (1) #define LIB_PICO_BINARY_INFO (0) #define LIB_PICO_PRINTF_NONE (0) #define LIB_PICO_PRINTF_PICO (0) @@ -23,4 +24,9 @@ #define PICO_STDIO_IGNORE_NESTED_STDOUT (0) #define PICO_USE_CRT_PRINTF (0) #define PICO_USE_OPTIMISTIC_SBRK (0) +// Stack guards cause a hard fault when 32 bytes around the stack bottom are +// accessed. These backtraces aren't always helpful and this conflicts with our +// own stack checking. #define PICO_USE_STACK_GUARDS (0) + +#include "include/cmsis/rename_exceptions.h" diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index f3da71cbd7..2ee3a1ee98 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -228,14 +228,14 @@ bool port_has_fixed_stack(void) { } // From the linker script -extern uint32_t __HeapLimit; -extern uint32_t __StackTop; +extern uint32_t _ld_cp_dynamic_mem_start; +extern uint32_t _ld_cp_dynamic_mem_end; uint32_t *port_stack_get_limit(void) { - return &__HeapLimit; + return &_ld_cp_dynamic_mem_start; } uint32_t *port_stack_get_top(void) { - return &__StackTop; + return &_ld_cp_dynamic_mem_end; } uint32_t *port_heap_get_bottom(void) { @@ -246,13 +246,14 @@ uint32_t *port_heap_get_top(void) { return port_stack_get_top(); } -extern uint32_t __scratch_x_start__; void port_set_saved_word(uint32_t value) { - __scratch_x_start__ = value; + // Store in a watchdog scratch register instead of RAM. 4-7 are used by the + // sdk. 0 is used by alarm. 1-3 are free. + watchdog_hw->scratch[1] = value; } uint32_t port_get_saved_word(void) { - return __scratch_x_start__; + return watchdog_hw->scratch[1]; } static volatile bool ticks_enabled; @@ -305,14 +306,12 @@ void port_idle_until_interrupt(void) { * \brief Default interrupt handler for unused IRQs. */ extern void HardFault_Handler(void); // provide a prototype to avoid a missing-prototypes diagnostic -__attribute__((used)) void HardFault_Handler(void) { - #ifdef ENABLE_MICRO_TRACE_BUFFER - // Turn off the micro trace buffer so we don't fill it up in the infinite - // loop below. - REG_MTB_MASTER = 0x00000000 + 6; - #endif - - reset_into_safe_mode(SAFE_MODE_HARD_FAULT); +__attribute__((used)) void __not_in_flash_func(HardFault_Handler)(void) { + // Only safe mode from core 0 which is running CircuitPython. Core 1 faulting + // should not be fatal to CP. (Fingers crossed.) + if (get_core_num() == 0) { + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); + } while (true) { asm ("nop;"); } diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index fb5d745ebb..d9af56356a 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -278,14 +278,8 @@ endif ifeq ($(CIRCUITPY_PIXELMAP),1) SRC_PATTERNS += _pixelmap/% endif -ifeq ($(CIRCUITPY_QRIO),1) -SRC_PATTERNS += qrio/% -endif -ifeq ($(CIRCUITPY_RAINBOWIO),1) -SRC_PATTERNS += rainbowio/% -endif -ifeq ($(CIRCUITPY_RGBMATRIX),1) -SRC_PATTERNS += rgbmatrix/% +ifeq ($(CIRCUITPY_PICODVI),1) +SRC_PATTERNS += picodvi/% endif ifeq ($(CIRCUITPY_PS2IO),1) SRC_PATTERNS += ps2io/% @@ -296,9 +290,18 @@ endif ifeq ($(CIRCUITPY_PWMIO),1) SRC_PATTERNS += pwmio/% endif +ifeq ($(CIRCUITPY_QRIO),1) +SRC_PATTERNS += qrio/% +endif +ifeq ($(CIRCUITPY_RAINBOWIO),1) +SRC_PATTERNS += rainbowio/% +endif ifeq ($(CIRCUITPY_RANDOM),1) SRC_PATTERNS += random/% endif +ifeq ($(CIRCUITPY_RGBMATRIX),1) +SRC_PATTERNS += rgbmatrix/% +endif ifeq ($(CIRCUITPY_RP2PIO),1) SRC_PATTERNS += rp2pio/% endif diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 0aec2ebe74..639fae9bbc 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -339,6 +339,11 @@ CFLAGS += -DCIRCUITPY_OS=$(CIRCUITPY_OS) CIRCUITPY_PEW ?= 0 CFLAGS += -DCIRCUITPY_PEW=$(CIRCUITPY_PEW) +# CIRCUITPY_PICODVI is handled in the raspberrypi tree. +# Only for RP2 chips. Assume not a raspberrypi build. +CIRCUITPY_PICODVI ?= 0 +CFLAGS += -DCIRCUITPY_PICODVI=$(CIRCUITPY_PICODVI) + CIRCUITPY_PIXELBUF ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_PIXELBUF=$(CIRCUITPY_PIXELBUF) diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index 12aee30b19..c4dc345cb8 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -151,15 +151,27 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val uint16_t x = 0; uint16_t y = 0; if (mp_obj_is_small_int(index_obj)) { - mp_int_t i = mp_arg_validate_int_min(MP_OBJ_SMALL_INT_VALUE(index_obj), 0, MP_QSTR_index); - uint16_t width = common_hal_displayio_bitmap_get_width(self); - x = i % width; - y = i / width; + mp_int_t i = MP_OBJ_SMALL_INT_VALUE(index_obj); + int total_length = self->width * self->height; + if (i < 0 || i >= total_length) { + mp_raise_IndexError_varg(translate("%q must be %d-%d"), MP_QSTR_index, 0, total_length - 1); + } + + x = i % self->width; + y = i / self->width; } else { mp_obj_t *items; mp_obj_get_array_fixed_n(index_obj, 2, &items); - x = mp_arg_validate_int_range(mp_obj_get_int(items[0]), 0, self->width - 1, MP_QSTR_x); - y = mp_arg_validate_int_range(mp_obj_get_int(items[1]), 0, self->height - 1, MP_QSTR_y); + mp_int_t x_in = mp_obj_get_int(items[0]); + if (x_in < 0 || x_in >= self->width) { + mp_raise_IndexError_varg(translate("%q must be %d-%d"), MP_QSTR_x, 0, self->width - 1); + } + mp_int_t y_in = mp_obj_get_int(items[1]); + if (y_in < 0 || y_in >= self->height) { + mp_raise_IndexError_varg(translate("%q must be %d-%d"), MP_QSTR_y, 0, self->height - 1); + } + x = x_in; + y = y_in; } if (value_obj == MP_OBJ_SENTINEL) { diff --git a/shared-module/displayio/ColorConverter.c b/shared-module/displayio/ColorConverter.c index 7064569e2d..112f7f9ad1 100644 --- a/shared-module/displayio/ColorConverter.c +++ b/shared-module/displayio/ColorConverter.c @@ -55,6 +55,13 @@ uint16_t displayio_colorconverter_compute_rgb565(uint32_t color_rgb888) { return r5 << 11 | g6 << 5 | b5; } +uint8_t displayio_colorconverter_compute_rgb332(uint32_t color_rgb888) { + uint32_t r3 = (color_rgb888 >> 21); + uint32_t g3 = (color_rgb888 >> 13) & 0x7; + uint32_t b2 = (color_rgb888 >> 6) & 0x3; + return r3 << 5 | g3 << 2 | b2; +} + uint8_t displayio_colorconverter_compute_rgbd(uint32_t color_rgb888) { uint32_t r1 = (color_rgb888 >> 23) & 0x1; uint32_t g1 = (color_rgb888 >> 15) & 0x1; @@ -309,6 +316,11 @@ void displayio_convert_color(const _displayio_colorspace_t *colorspace, bool dit output_color->pixel = pixel; output_color->opaque = true; return; + } else if (colorspace->depth == 8 && !colorspace->grayscale) { + uint8_t packed = displayio_colorconverter_compute_rgb332(pixel); + output_color->pixel = packed; + output_color->opaque = true; + return; } else if (colorspace->depth == 4) { uint8_t packed; if (colorspace->sevencolor) { diff --git a/shared-module/displayio/ColorConverter.h b/shared-module/displayio/ColorConverter.h index c1e46035ca..7ac5062ff3 100644 --- a/shared-module/displayio/ColorConverter.h +++ b/shared-module/displayio/ColorConverter.h @@ -57,6 +57,7 @@ uint32_t displayio_colorconverter_dither_noise_2(uint32_t x, uint32_t y); void displayio_convert_color(const _displayio_colorspace_t *colorspace, bool dither, const displayio_input_pixel_t *input_pixel, displayio_output_pixel_t *output_color); uint16_t displayio_colorconverter_compute_rgb565(uint32_t color_rgb888); +uint8_t displayio_colorconverter_compute_rgb332(uint32_t color_rgb888); uint8_t displayio_colorconverter_compute_rgbd(uint32_t color_rgb888); uint8_t displayio_colorconverter_compute_luma(uint32_t color_rgb888); uint8_t displayio_colorconverter_compute_chroma(uint32_t color_rgb888); diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index 87962dfc60..2dd0cff8b8 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -152,6 +152,10 @@ void common_hal_displayio_release_displays(void) { } else if (displays[i].bus_base.type == &videocore_framebuffer_type) { common_hal_videocore_framebuffer_deinit(&displays[i].videocore); #endif + #if CIRCUITPY_PICODVI + } else if (displays[i].bus_base.type == &picodvi_framebuffer_type) { + common_hal_picodvi_framebuffer_deinit(&displays[i].picodvi); + #endif } displays[i].fourwire_bus.base.type = &mp_type_NoneType; } @@ -266,6 +270,13 @@ void reset_displays(void) { // The framebuffer is allocated outside of the heap so it doesn't // need to be moved. #endif + #if CIRCUITPY_PICODVI + } else if (displays[i].bus_base.type == &picodvi_framebuffer_type) { + picodvi_framebuffer_obj_t *vc = &displays[i].picodvi; + if (!any_display_uses_this_framebuffer(&vc->base)) { + common_hal_picodvi_framebuffer_deinit(vc); + } + #endif } else { // Not an active display bus. continue; diff --git a/shared-module/displayio/__init__.h b/shared-module/displayio/__init__.h index c1954b146c..b450cb711d 100644 --- a/shared-module/displayio/__init__.h +++ b/shared-module/displayio/__init__.h @@ -47,9 +47,13 @@ #if CIRCUITPY_SHARPDISPLAY #include "shared-module/sharpdisplay/SharpMemoryFramebuffer.h" #endif +// Port unique frame buffers. #if CIRCUITPY_VIDEOCORE #include "bindings/videocore/Framebuffer.h" #endif +#if CIRCUITPY_PICODVI +#include "bindings/picodvi/Framebuffer.h" +#endif typedef struct { union { @@ -71,6 +75,9 @@ typedef struct { #if CIRCUITPY_VIDEOCORE videocore_framebuffer_obj_t videocore; #endif + #if CIRCUITPY_PICODVI + picodvi_framebuffer_obj_t picodvi; + #endif }; union { mp_obj_base_t display_base; diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index 26585c54d5..5ab00d4f8a 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -103,37 +103,43 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { if (reset_tiles) { uint8_t *tiles = (uint8_t *)tilegrid_tiles->ptr; + // Adjust the display dimensions to account for scale of the outer group. + width_px /= scale; + height_px /= scale; + + // Number of tiles from the left edge to inset the status bar. + size_t min_left_padding = 0; #if CIRCUITPY_REPL_LOGO - status_bar->x = supervisor_blinka_sprite.pixel_width + 1; + // Blinka + 1 px padding minimum + min_left_padding = supervisor_blinka_sprite.pixel_width + 1; // Align the status bar to the bottom of the logo. status_bar->y = supervisor_blinka_sprite.pixel_height - status_bar->tile_height; #else - status_bar->x = 0; status_bar->y = 0; #endif - status_bar->top_left_y = 0; - status_bar->width_in_tiles = width_in_tiles; + status_bar->width_in_tiles = (width_px - min_left_padding) / status_bar->tile_width; status_bar->height_in_tiles = 1; - status_bar->pixel_width = width_in_tiles * status_bar->tile_width; + status_bar->pixel_width = status_bar->width_in_tiles * status_bar->tile_width; status_bar->pixel_height = status_bar->tile_height; + // Right align the status bar. + status_bar->x = width_px - status_bar->pixel_width; + status_bar->top_left_y = 0; status_bar->tiles = tiles; status_bar->full_change = true; - scroll_area->x = 0; - scroll_area->top_left_y = 0; scroll_area->width_in_tiles = width_in_tiles; - scroll_area->height_in_tiles = height_in_tiles - 1; - scroll_area->pixel_width = width_in_tiles * scroll_area->tile_width; - scroll_area->pixel_height = (height_in_tiles - 1) * scroll_area->tile_height; + scroll_area->height_in_tiles = height_in_tiles; #if CIRCUITPY_REPL_LOGO - scroll_area->y = blinka_bitmap.height; - #else - scroll_area->y = status_bar->tile_height; + scroll_area->height_in_tiles -= 1; #endif - int16_t extra_height = (scroll_area->pixel_height + scroll_area->y) - (height_px / scale); - // Subtract extra height so that the bottom line fully shows. The top line will be under the - // title bar and Blinka logo. - scroll_area->y -= extra_height; + scroll_area->pixel_width = scroll_area->width_in_tiles * scroll_area->tile_width; + scroll_area->pixel_height = scroll_area->height_in_tiles * scroll_area->tile_height; + // Right align the scroll area to give margin to the start of each line. + scroll_area->x = width_px - scroll_area->pixel_width; + scroll_area->top_left_y = 0; + // Align the scroll area to the bottom so that the newest line isn't cutoff. The top line + // may be clipped by the status bar and that's ok. + scroll_area->y = height_px - scroll_area->pixel_height; scroll_area->tiles = tiles + width_in_tiles; scroll_area->full_change = true; diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c index a5f3296a28..ec0b27a9a6 100644 --- a/supervisor/shared/memory.c +++ b/supervisor/shared/memory.c @@ -77,6 +77,8 @@ enum { // Maximum needs of one display: max(4 if RGBMATRIX, 1 if SHARPDISPLAY, 0) #if CIRCUITPY_RGBMATRIX 4 + #elif CIRCUITPY_PICODVI + 2 #elif CIRCUITPY_SHARPDISPLAY 1 #else diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 1d600e1158..133a97a99d 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -123,7 +123,7 @@ void usb_set_defaults(void) { }; #if CIRCUITPY_USB_IDENTIFICATION -supervisor_allocation *usb_identification_allocation; +supervisor_allocation *usb_identification_allocation = NULL; #endif // Some dynamic USB data must be saved after boot.py. How much is needed? diff --git a/tools/cortex-m-fault-gdb.py b/tools/cortex-m-fault-gdb.py index 31b76aa1d4..2ed2d13909 100644 --- a/tools/cortex-m-fault-gdb.py +++ b/tools/cortex-m-fault-gdb.py @@ -17,7 +17,7 @@ MMFAR = SCB + 0x034 # (R/W) MemManage Fault Address Register */ BFAR = SCB + 0x038 # (R/W) BusFault Address Register */ AFSR = SCB + 0x03C # (R/W) Auxiliary Fault Status Register */ -PARTS = {0xC27: "Cortex M7"} +PARTS = {0xC27: "Cortex M7", 0xC60: "Cortex M0+"} EXCEPTIONS = { 0: "Thread mode", @@ -40,18 +40,35 @@ class CortexMFault(gdb.Command): i = gdb.selected_inferior() return i.read_memory(address, 4).cast("I")[0] - def invoke(self, arg, from_tty): - cpuid = self._read(CPUID) - implementer = cpuid >> 24 - if implementer != 0x41: - raise RuntimeError() - variant = (cpuid >> 20) & 0xF - constant = (cpuid >> 16) & 0xF - if constant != 0xF: - raise RuntimeError() - revision = cpuid & 0xF - part_no = (cpuid >> 4) & 0xFFF - print(PARTS[part_no]) + def _armv6m_fault(self): + vtor = self._read(VTOR) + print("vtor", hex(vtor)) + + icsr = self._read(ICSR) + if (icsr & (1 << 23)) != 0: + print("No preempted exceptions") + else: + print("Another exception was preempted") + vectactive = icsr & 0x1FF + print(hex(icsr), vectactive) + if vectactive != 0: + if vectactive in EXCEPTIONS: + vectactive = EXCEPTIONS[vectactive] + else: + vectactive -= 16 + + print("Active interrupt:", vectactive) + + vectpending = (icsr >> 12) & 0x1FF + if vectpending != 0: + if vectpending in EXCEPTIONS: + vectpending = EXCEPTIONS[vectpending] + else: + vectpending -= 16 + + print("Pending interrupt:", vectpending) + + def _armv7m_fault(self): icsr = self._read(ICSR) if (icsr & (1 << 11)) != 0: print("No preempted exceptions") @@ -65,6 +82,7 @@ class CortexMFault(gdb.Command): print(vectactive - 16) vtor = self._read(VTOR) + print("vtor", hex(vtor)) # print(hex(self._read(SHCSR))) cfsr = self._read(CFSR) ufsr = cfsr >> 16 @@ -102,5 +120,23 @@ class CortexMFault(gdb.Command): print("Bus fault when reading vector table") print("VTOR", hex(vtor)) + def invoke(self, arg, from_tty): + cpuid = self._read(CPUID) + implementer = cpuid >> 24 + if implementer != 0x41: + raise RuntimeError() + variant = (cpuid >> 20) & 0xF + architecture = (cpuid >> 16) & 0xF + revision = cpuid & 0xF + part_no = (cpuid >> 4) & 0xFFF + print(PARTS[part_no]) + + if architecture == 0xF: + self._armv7m_fault() + elif architecture == 0xC: + self._armv6m_fault() + else: + raise RuntimeError(f"Unknown architecture {architecture:x}") + CortexMFault() From 13bb8012117dd297ee558410c32150729630de2d Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 19 Apr 2023 15:42:02 -0700 Subject: [PATCH 0892/1712] Fix docs and windows --- ports/raspberrypi/bindings/picodvi/Framebuffer.c | 7 +++---- tools/ci_fetch_deps.py | 5 ++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ports/raspberrypi/bindings/picodvi/Framebuffer.c b/ports/raspberrypi/bindings/picodvi/Framebuffer.c index 51afd0eda7..12482c3baa 100644 --- a/ports/raspberrypi/bindings/picodvi/Framebuffer.c +++ b/ports/raspberrypi/bindings/picodvi/Framebuffer.c @@ -62,10 +62,9 @@ //| for the changed clock. This also allocates a very large framebuffer //| and is most likely to succeed the earlier it is attempted. //| -//| Each *_dp and *_dn pair of pins must be neighboring, such as 19 and -//| 20. They must also be ordered the same way. In other words, dp must -//| be less than dn for all pairs or dp must be greater than dn for all -//| pairs. +//| Each dp and dn pair of pins must be neighboring, such as 19 and 20. +//| They must also be ordered the same way. In other words, dp must be +//| less than dn for all pairs or dp must be greater than dn for all pairs. //| //| The framebuffer pixel format varies depending on color_depth: //| * 1 - Each bit is a pixel. Either white (1) or black (0). diff --git a/tools/ci_fetch_deps.py b/tools/ci_fetch_deps.py index b77bea72f9..2069c035c7 100644 --- a/tools/ci_fetch_deps.py +++ b/tools/ci_fetch_deps.py @@ -87,7 +87,10 @@ def main(): submodules = ["tools/"] # for huffman elif TARGET == "windows": # This builds one board from a number of ports so fill out a bunch of submodules - submodules = ["extmod/ulab", "lib/", "tools/", "ports/", "data/nvm.toml"] + for port in ("atmel-samd", "nrf", "raspberrypi", "stm"): + submodules.extend(PORT_DEPS[port]) + unique_submodules = set(submodules) + submodules = list(unique_submodules) elif TARGET == "website": submodules = ["tools/adabot/"] submodules_tags = ["frozen/"] From f38d59be2cb2af43a0fb2a07d4cbd833d5797082 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 19 Apr 2023 16:02:01 -0700 Subject: [PATCH 0893/1712] Fix windows CI --- tools/ci_fetch_deps.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ci_fetch_deps.py b/tools/ci_fetch_deps.py index 2069c035c7..15ef6a51cd 100644 --- a/tools/ci_fetch_deps.py +++ b/tools/ci_fetch_deps.py @@ -88,6 +88,7 @@ def main(): elif TARGET == "windows": # This builds one board from a number of ports so fill out a bunch of submodules for port in ("atmel-samd", "nrf", "raspberrypi", "stm"): + submodules.append(f"ports/{port}") submodules.extend(PORT_DEPS[port]) unique_submodules = set(submodules) submodules = list(unique_submodules) From e2ab7a4751e867e7981425f60bf2ef54c6bae355 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 19 Apr 2023 17:04:54 -0700 Subject: [PATCH 0894/1712] Change voltage. Refine docs --- .../common-hal/microcontroller/Processor.c | 1 + ports/raspberrypi/Makefile | 2 ++ .../common-hal/microcontroller/Processor.c | 19 ++++++++++++++++++- shared-bindings/microcontroller/Processor.c | 8 ++++++-- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c index 34400e3f41..8df21268ec 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c @@ -59,6 +59,7 @@ void common_hal_mcu_processor_set_frequency(mcu_processor_obj_t *self, freq != 720 && freq != 816 && freq != 912 && freq != 960 && freq != 1008) { mp_raise_ValueError(translate("Frequency must be 24, 150, 396, 450, 528, 600, 720, 816, 912, 960 or 1008 Mhz")); } + SystemCoreClock = setarmclock(frequency); } diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 395a5553e2..98a5d7d77a 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -129,6 +129,7 @@ INC += \ -isystem sdk/src/rp2_common/hardware_sync/include/ \ -isystem sdk/src/rp2_common/hardware_timer/include/ \ -isystem sdk/src/rp2_common/hardware_uart/include/ \ + -isystem sdk/src/rp2_common/hardware_vreg/include/ \ -isystem sdk/src/rp2_common/hardware_watchdog/include/ \ -isystem sdk/src/rp2_common/hardware_xosc/include/ \ -isystem sdk/src/rp2_common/pico_multicore/include/ \ @@ -216,6 +217,7 @@ SRC_SDK := \ src/rp2_common/hardware_sync/sync.c \ src/rp2_common/hardware_timer/timer.c \ src/rp2_common/hardware_uart/uart.c \ + src/rp2_common/hardware_vreg/vreg.c \ src/rp2_common/hardware_watchdog/watchdog.c \ src/rp2_common/hardware_xosc/xosc.c \ src/rp2_common/pico_bootrom/bootrom.c \ diff --git a/ports/raspberrypi/common-hal/microcontroller/Processor.c b/ports/raspberrypi/common-hal/microcontroller/Processor.c index 66083a357d..56f2fd7fb1 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Processor.c +++ b/ports/raspberrypi/common-hal/microcontroller/Processor.c @@ -32,10 +32,12 @@ #include "common-hal/microcontroller/Processor.h" #include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" +#include "shared-bindings/time/__init__.h" #include "pico/stdlib.h" #include "src/rp2_common/hardware_adc/include/hardware/adc.h" #include "src/rp2_common/hardware_clocks/include/hardware/clocks.h" +#include "src/rp2_common/hardware_vreg/include/hardware/vreg.h" #include "src/rp2040/hardware_regs/include/hardware/regs/vreg_and_chip_reset.h" #include "src/rp2040/hardware_regs/include/hardware/regs/watchdog.h" @@ -62,9 +64,24 @@ uint32_t common_hal_mcu_processor_get_frequency(void) { } void common_hal_mcu_processor_set_frequency(mcu_processor_obj_t *self, uint32_t frequency) { - if (!set_sys_clock_khz(frequency / 1000, false)) { + uint vco, postdiv1, postdiv2; + uint32_t freq_khz = frequency / 1000; + if (!check_sys_clock_khz(freq_khz, &vco, &postdiv1, &postdiv2)) { mp_arg_error_invalid(MP_QSTR_frequency); } + // These voltages are approximate based on the PicoDVI examples. + enum vreg_voltage voltage = VREG_VOLTAGE_1_10; + if (freq_khz >= 400000) { + voltage = VREG_VOLTAGE_1_30; + } else if (freq_khz >= 300000) { + voltage = VREG_VOLTAGE_1_20; + } else if (freq_khz > 133000) { + voltage = VREG_VOLTAGE_1_20; + } + vreg_set_voltage(voltage); + // Wait for a stable voltage + common_hal_time_delay_ms(10); + set_sys_clock_khz(freq_khz, false); } void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { diff --git a/shared-bindings/microcontroller/Processor.c b/shared-bindings/microcontroller/Processor.c index 6ae0212a6a..e4819047da 100644 --- a/shared-bindings/microcontroller/Processor.c +++ b/shared-bindings/microcontroller/Processor.c @@ -70,8 +70,12 @@ //| **Limitations:** On most boards, ``frequency`` is read-only. Setting //| the ``frequency`` is possible on RP2040 boards and some i.MX boards. //| -//| .. warning:: On RP2040 boards changing the frequency may cause issues -//| with other subsystems, such as USB, PWM, and PIO. +//| .. warning:: Overclocking likely voids your warranties and may reduce +//| the lifetime of the chip. +//| +//| .. warning:: Changing the frequency may cause issues with other +//| subsystems, such as USB, PWM, and PIO. To minimize issues, set the CPU +//| frequency before initializing other systems. //| """ #if CIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY From df41bd9eadc33e35568fbc7031f395324c83e2f6 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 20 Apr 2023 09:47:25 -0400 Subject: [PATCH 0895/1712] change hex radio password validation; add password length doc --- data/nvm.toml | 2 +- locale/circuitpython.pot | 17 ++++++++--------- py/argcheck.c | 13 ------------- py/runtime.h | 1 - shared-bindings/wifi/Radio.c | 23 +++++++++++++++++++---- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/data/nvm.toml b/data/nvm.toml index 73fafcbe4c..427cc92397 160000 --- a/data/nvm.toml +++ b/data/nvm.toml @@ -1 +1 @@ -Subproject commit 73fafcbe4c66b23df63be31e9227353b695abb08 +Subproject commit 427cc923976229bcb981ca6f218ebe8efd636df6 diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f87fc02975..16ff1b38cc 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -98,6 +98,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "" @@ -193,7 +196,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1117,10 +1120,6 @@ msgstr "" msgid "I2C peripheral in use" msgstr "" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1282,6 +1281,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" @@ -1708,10 +1711,6 @@ 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 frequency not writable when variable_frequency is False on construction." diff --git a/py/argcheck.c b/py/argcheck.c index 73f3ead269..465a82c97e 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -268,19 +268,6 @@ mp_int_t mp_arg_validate_type_int(mp_obj_t obj, qstr arg_name) { return an_int; } -mp_int_t mp_arg_validate_valid_hex_password(mp_uint_t length, uint8_t *buf) { - unsigned int i=0; - while (i +#include "py/unicode.h" #include "py/runtime.h" #include "py/objproperty.h" @@ -70,6 +71,14 @@ STATIC bool hostname_valid(const char *ptr, size_t len) { return !(partlen > 63); } +STATIC void validate_hex_password(const uint8_t *buf, size_t len) { + for (size_t i = 0; i < len; i++) { + if (!unichar_isxdigit(buf[i])) { + mp_raise_ValueError_varg(translate("Invalid hex password")); + } + } +} + //| class Radio: //| """Native wifi radio. @@ -321,6 +330,9 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station); //| ``OPEN`` will be used when the password is the empty string, //| otherwise ``authmode`` will be ``WPA_WPA2_PSK``. //| +//| The length of ``password`` must be 8-63 characters if it is ASCII, +//| or exactly 64 hexadecimal characters if it is the hex form of the 256-bit key. +//| //| If ``max_connections`` is given, the access point will allow up to //| that number of stations to connect.""" //| ... @@ -368,8 +380,8 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_ if (authmodes != AUTHMODE_OPEN) { mp_arg_validate_length_range(password.len, 8, 64, MP_QSTR_password); - if (password.len==64) { - mp_arg_validate_valid_hex_password(password.len, password.buf); + if (password.len == 64) { + validate_hex_password(password.buf, password.len); } } @@ -409,6 +421,9 @@ MP_PROPERTY_GETTER(wifi_radio_ap_active_obj, //| """Connects to the given ssid and waits for an ip address. Reconnections are handled //| automatically once one connection succeeds. //| +//| The length of ``password`` must be 0 if there is no password, 8-63 characters if it is ASCII, +//| or exactly 64 hexadecimal characters if it is the hex form of the 256-bit key. +//| //| By default, this will scan all channels and connect to the access point (AP) with the //| given ``ssid`` and greatest signal strength (rssi). //| @@ -449,8 +464,8 @@ STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_m mp_get_buffer_raise(args[ARG_password].u_obj, &password, MP_BUFFER_READ); if (password.len != 0) { mp_arg_validate_length_range(password.len, 8, 64, MP_QSTR_password); - if (password.len==64) { - mp_arg_validate_valid_hex_password(password.len, password.buf); + if (password.len == 64) { + validate_hex_password(password.buf, password.len); } } } From 6f71e81c862d42eae77c61a05276a5bf6faf318a Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 20 Apr 2023 16:23:03 +0200 Subject: [PATCH 0896/1712] 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 | 17 ++++++++--------- locale/cs.po | 17 ++++++++--------- locale/de_DE.po | 23 ++++++++++++++--------- locale/el.po | 17 ++++++++--------- locale/en_GB.po | 23 ++++++++++++++--------- locale/es.po | 23 ++++++++++++++--------- locale/fil.po | 17 ++++++++--------- locale/fr.po | 23 ++++++++++++++--------- locale/hi.po | 17 ++++++++--------- locale/it_IT.po | 17 ++++++++--------- locale/ja.po | 20 +++++++++++--------- locale/ko.po | 17 ++++++++--------- locale/nl.po | 20 +++++++++++--------- locale/pl.po | 20 +++++++++++--------- locale/pt_BR.po | 23 ++++++++++++++--------- locale/ru.po | 20 +++++++++++--------- locale/sv.po | 23 ++++++++++++++--------- locale/tr.po | 20 +++++++++++--------- locale/zh_Latn_pinyin.po | 23 ++++++++++++++--------- 19 files changed, 209 insertions(+), 171 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 7163efb5df..c37a4f64db 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -101,6 +101,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "" @@ -196,7 +199,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1127,10 +1130,6 @@ msgstr "" msgid "I2C peripheral in use" msgstr "" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1294,6 +1293,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "Ukuran potongan format tidak valid" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" @@ -1725,10 +1728,6 @@ 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 frequency not writable when variable_frequency is False on construction." diff --git a/locale/cs.po b/locale/cs.po index 0e6b8714af..277287a4af 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -102,6 +102,9 @@ msgstr "%d adresní pin, %d rgb pin a %d dlaždice indikuje výšku %d, ne %d" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "%q" @@ -197,7 +200,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1127,10 +1130,6 @@ msgstr "Chyba inicializace I2C" msgid "I2C peripheral in use" msgstr "Periférie I2C je používána" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1294,6 +1293,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "Neplatná velikost bloku" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Chybná multicastová MAC adresa" @@ -1721,10 +1724,6 @@ 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 frequency not writable when variable_frequency is False on construction." diff --git a/locale/de_DE.po b/locale/de_DE.po index 6b68831288..9c39023401 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -110,6 +110,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "%q" @@ -206,7 +209,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "%q muss ein Array vom Typ 'H' sein" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1147,10 +1150,6 @@ msgstr "I2C-Initialisierungsfehler" msgid "I2C peripheral in use" msgstr "I2C Peripherie in Verwendung" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "I2SOut nicht verfügbar" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "In-Puffer-Elemente müssen <= 4 Bytes lang sein" @@ -1318,6 +1317,10 @@ msgstr "Ungültiges Format" msgid "Invalid format chunk size" msgstr "Ungültige format chunk size" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Ungültige Multicast-MAC-Adresse" @@ -1751,10 +1754,6 @@ msgstr "Out-Buffer-Elemente müssen <= 4 bytes lang sein" 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 "PDMIn nicht verfügbar" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -4464,6 +4463,12 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "I2SOut not available" +#~ msgstr "I2SOut nicht verfügbar" + +#~ msgid "PDMIn not available" +#~ msgstr "PDMIn nicht verfügbar" + #~ msgid "out of range of source" #~ msgstr "Außerhalb des Bereichs der Quelle" diff --git a/locale/el.po b/locale/el.po index c1d8350462..ca698c532f 100644 --- a/locale/el.po +++ b/locale/el.po @@ -106,6 +106,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "%q" @@ -201,7 +204,7 @@ msgstr "%q πρέπει να είναι bytearray ή array τύπου 'h', 'H', msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1137,10 +1140,6 @@ msgstr "" msgid "I2C peripheral in use" msgstr "" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1302,6 +1301,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" @@ -1728,10 +1731,6 @@ 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 frequency not writable when variable_frequency is False on construction." diff --git a/locale/en_GB.po b/locale/en_GB.po index 8b7a1da9fc..8568718c68 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -111,6 +111,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "%q" @@ -206,7 +209,7 @@ msgstr "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" msgid "%q must be array of type 'H'" msgstr "%q must be array of type 'H'" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "%q must be array of type 'h'" @@ -1136,10 +1139,6 @@ msgstr "I2C init error" msgid "I2C peripheral in use" msgstr "I2C peripheral in use" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "I2SOut not available" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "In-buffer elements must be <= 4 bytes long" @@ -1303,6 +1302,10 @@ msgstr "Invalid format" msgid "Invalid format chunk size" msgstr "Invalid format chunk size" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Invalid multicast MAC address" @@ -1733,10 +1736,6 @@ msgstr "Out-buffer elements must be <= 4 bytes long" msgid "Oversample must be multiple of 8." msgstr "Oversample must be multiple of 8." -#: shared-bindings/audiobusio/PDMIn.c -msgid "PDMIn not available" -msgstr "PDMIn not available" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -4405,6 +4404,12 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "I2SOut not available" +#~ msgstr "I2SOut not available" + +#~ msgid "PDMIn not available" +#~ msgstr "PDMIn not available" + #~ msgid "out of range of source" #~ msgstr "out of range of source" diff --git a/locale/es.po b/locale/es.po index 3ebfdc7833..ef8ca30c40 100644 --- a/locale/es.po +++ b/locale/es.po @@ -113,6 +113,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "%q" @@ -208,7 +211,7 @@ msgstr "%q debe ser un byte-matriz o matriz de tipo 'h', 'H', 'b', o 'B'" msgid "%q must be array of type 'H'" msgstr "%q debe ser un arreglo de tipo 'H'" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "%q debe ser una matriz de tipo 'h'" @@ -1154,10 +1157,6 @@ msgstr "Error en la inicialización I2C" msgid "I2C peripheral in use" msgstr "Dispositivo I2C en uso" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "I2SOut no disponible" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1328,6 +1327,10 @@ msgstr "Formato inválido" msgid "Invalid format chunk size" msgstr "Formato de fragmento de formato no válido" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Dirección MAC de multidifusión inválida" @@ -1764,10 +1767,6 @@ msgstr "Los elementos del búfer de salida deben ser de una longitud <= 4 bytes" 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 "PDMIn no esta disponible" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -4461,6 +4460,12 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "I2SOut not available" +#~ msgstr "I2SOut no disponible" + +#~ msgid "PDMIn not available" +#~ msgstr "PDMIn no esta disponible" + #~ msgid "out of range of source" #~ msgstr "fuera de rango de fuente" diff --git a/locale/fil.po b/locale/fil.po index 2a9127c34c..e7630e6068 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -99,6 +99,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "" @@ -194,7 +197,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1127,10 +1130,6 @@ msgstr "" msgid "I2C peripheral in use" msgstr "" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1294,6 +1293,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "Mali ang format ng chunk size" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" @@ -1723,10 +1726,6 @@ 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 frequency not writable when variable_frequency is False on construction." diff --git a/locale/fr.po b/locale/fr.po index 22391687cb..81f8c8dcd2 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -113,6 +113,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "%q" @@ -208,7 +211,7 @@ msgstr "%q doit être a bytearray ou array de type 'h', 'H', 'b', ou 'B'" msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1160,10 +1163,6 @@ msgstr "Erreur d'initialisation I2C" msgid "I2C peripheral in use" msgstr "Périphérique I2C utilisé" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "I2SOut n'est pas disponible" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "Éléments dans le tampon doivent être <= à 4 octets" @@ -1337,6 +1336,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "Taille de bloc de formatage invalide" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Adresse MAC multicast invalide" @@ -1773,10 +1776,6 @@ msgstr "Éléments du tampon de sortie doivent être <= à 4 octets" 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 "PDMIn non disponible" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -4483,6 +4482,12 @@ 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 "I2SOut not available" +#~ msgstr "I2SOut n'est pas disponible" + +#~ msgid "PDMIn not available" +#~ msgstr "PDMIn non disponible" + #~ msgid "out of range of source" #~ msgstr "dépassement des bornes de source" diff --git a/locale/hi.po b/locale/hi.po index 1f60a526cd..56095ed2f7 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -98,6 +98,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "" @@ -193,7 +196,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1117,10 +1120,6 @@ msgstr "" msgid "I2C peripheral in use" msgstr "" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1282,6 +1281,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" @@ -1708,10 +1711,6 @@ 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 frequency not writable when variable_frequency is False on construction." diff --git a/locale/it_IT.po b/locale/it_IT.po index 57a9a3b91f..4bedc7d428 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -102,6 +102,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "" @@ -197,7 +200,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1129,10 +1132,6 @@ msgstr "" msgid "I2C peripheral in use" msgstr "" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1296,6 +1295,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" @@ -1727,10 +1730,6 @@ 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 #, fuzzy msgid "" diff --git a/locale/ja.po b/locale/ja.po index fbe0d8c902..1045e43dbc 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -104,6 +104,9 @@ msgstr "%dアドレスピン、%dRGBピン、%dタイルは%dの高さを指示 #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c #, fuzzy msgid "%q" msgstr "%q" @@ -200,7 +203,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1128,10 +1131,6 @@ msgstr "" msgid "I2C peripheral in use" msgstr "" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "I2SOutが利用できません" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1295,6 +1294,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "フォーマットチャンクのサイズが不正" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" @@ -1723,10 +1726,6 @@ 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 frequency not writable when variable_frequency is False on construction." @@ -4386,6 +4385,9 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "I2SOut not available" +#~ msgstr "I2SOutが利用できません" + #~ msgid "out of range of source" #~ msgstr "ソースが範囲外" diff --git a/locale/ko.po b/locale/ko.po index 339cb42c86..6dccfd143b 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -99,6 +99,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "" @@ -194,7 +197,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1120,10 +1123,6 @@ msgstr "" msgid "I2C peripheral in use" msgstr "" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1285,6 +1284,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "형식 청크 크기가 잘못되었습니다" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" @@ -1711,10 +1714,6 @@ 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 frequency not writable when variable_frequency is False on construction." diff --git a/locale/nl.po b/locale/nl.po index a91063c256..003953f289 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -98,6 +98,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "" @@ -193,7 +196,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1123,10 +1126,6 @@ msgstr "" msgid "I2C peripheral in use" msgstr "" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "I2SOut is niet beschikbaar" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1290,6 +1289,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "Ongeldig formaat stuk grootte" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" @@ -1722,10 +1725,6 @@ msgstr "" 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 frequency not writable when variable_frequency is False on construction." @@ -4396,6 +4395,9 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "I2SOut not available" +#~ msgstr "I2SOut is niet beschikbaar" + #~ msgid "out of range of source" #~ msgstr "buiten bereik van bron" diff --git a/locale/pl.po b/locale/pl.po index fbd76182cc..b0f60e0806 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -100,6 +100,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "" @@ -195,7 +198,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1123,10 +1126,6 @@ msgstr "" msgid "I2C peripheral in use" msgstr "" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "I2SOut niedostępne" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "" @@ -1290,6 +1289,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "Zła wielkość fragmentu formatu" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "" @@ -1716,10 +1719,6 @@ 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 frequency not writable when variable_frequency is False on construction." @@ -4372,6 +4371,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "I2SOut not available" +#~ msgstr "I2SOut niedostępne" + #~ msgid "pixel value requires too many bits" #~ msgstr "wartość piksela wymaga zbyt wielu bitów" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index d130fcc464..b428121645 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -111,6 +111,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "%q" @@ -206,7 +209,7 @@ msgstr "%q deve ser um bytearray ou uma matriz do tipo 'h', 'H', 'b', ou 'B'" msgid "%q must be array of type 'H'" msgstr "%q deve ser uma matriz do tipo 'H'" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "%q deve ser uma matriz do tipo 'h'" @@ -1151,10 +1154,6 @@ msgstr "Erro de inicialização do I2C" msgid "I2C peripheral in use" msgstr "Periférico I2C em uso" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "O I2SOut não está disponível" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "Os elementos In-buffer devem ter um comprimento de <= 4 bytes" @@ -1324,6 +1323,10 @@ msgstr "Formato inválido" msgid "Invalid format chunk size" msgstr "Tamanho do pedaço de formato inválido" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Endereço MAC multicast inválido" @@ -1757,10 +1760,6 @@ msgstr "Os elementos Out-buffer devem ter um comprimento de <= 4 bytes" 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 "O PDMIn não está disponível" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -4461,6 +4460,12 @@ 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 "I2SOut not available" +#~ msgstr "O I2SOut não está disponível" + +#~ msgid "PDMIn not available" +#~ msgstr "O PDMIn não está disponível" + #~ msgid "out of range of source" #~ msgstr "fora do alcance da fonte" diff --git a/locale/ru.po b/locale/ru.po index 8fe6419b11..75447bec23 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -105,6 +105,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "%q" @@ -200,7 +203,7 @@ msgstr "%q должно быть bytearray или array типа 'h', 'H', 'b', msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1154,10 +1157,6 @@ msgstr "Ошибка инициализации I2C" msgid "I2C peripheral in use" msgstr "Периферийное устройство I2C уже используется" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "I2SOut недоступен" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "Элементы буфера должны быть длиной <= 4 байта" @@ -1327,6 +1326,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "Неверный размер блока формата" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Неверный MAC-адрес multicast" @@ -1764,10 +1767,6 @@ 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 frequency not writable when variable_frequency is False on construction." @@ -4425,6 +4424,9 @@ msgstr "zi должно быть типа float" msgid "zi must be of shape (n_section, 2)" msgstr "zi должен иметь форму (n_section, 2)" +#~ msgid "I2SOut not available" +#~ msgstr "I2SOut недоступен" + #~ msgid "64 bit types" #~ msgstr "64-битные типы" diff --git a/locale/sv.po b/locale/sv.po index 8cb79da28e..5cc3ecdf9c 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -110,6 +110,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "%q" @@ -207,7 +210,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "%q måste vara en array av typen 'H'" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "%q måste vara en matris av typen 'h'" @@ -1140,10 +1143,6 @@ msgstr "I2C-initieringsfel" msgid "I2C peripheral in use" msgstr "I2C-enhet används redan" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "I2SOut är inte tillgängligt" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "Antal element i buffert måste vara <= 4 byte" @@ -1309,6 +1308,10 @@ msgstr "Ogiltigt format" msgid "Invalid format chunk size" msgstr "Ogiltig formatsegmentstorlek" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Ogiltig MAC-adress för multicast" @@ -1741,10 +1744,6 @@ msgstr "Element i utbuffer måste vara <= 4 byte långa" 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 "PDMIn inte tillgänglig" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -4423,6 +4422,12 @@ 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 "I2SOut not available" +#~ msgstr "I2SOut är inte tillgängligt" + +#~ msgid "PDMIn not available" +#~ msgstr "PDMIn inte tillgänglig" + #~ msgid "out of range of source" #~ msgstr "utanför räckvidd för source" diff --git a/locale/tr.po b/locale/tr.po index 1f8874167b..3a4b19ea1b 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -106,6 +106,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "%q" @@ -201,7 +204,7 @@ msgstr "%q 'h', 'H', 'b' ya da 'B' tipi bir bytearray ya da array olmalı" msgid "%q must be array of type 'H'" msgstr "" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "" @@ -1133,10 +1136,6 @@ msgstr "I2C init hatası" msgid "I2C peripheral in use" msgstr "I2C çevre cihazı kullanımda" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "I2SOut uygundeğil" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "Buffer öğeleri <=4 bayt uzunluğunda olmalı" @@ -1301,6 +1300,10 @@ msgstr "" msgid "Invalid format chunk size" msgstr "Geçersiz biçim yığın boyutu" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "Geçersiz multicast MAC adresi" @@ -1727,10 +1730,6 @@ 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 frequency not writable when variable_frequency is False on construction." @@ -4384,6 +4383,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "I2SOut not available" +#~ msgstr "I2SOut uygundeğil" + #~ msgid "64 bit types" #~ msgstr "64 bit tipler" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index dffbea185d..1ecf35326f 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -113,6 +113,9 @@ msgstr "" #: ports/raspberrypi/common-hal/analogio/AnalogOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c +#: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c +#: shared-bindings/keypad/KeyMatrix.c shared-bindings/keypad/Keys.c +#: shared-bindings/keypad/ShiftRegisterKeys.c msgid "%q" msgstr "%q" @@ -209,7 +212,7 @@ msgstr "" msgid "%q must be array of type 'H'" msgstr "%q bì xū shì lèi xíng wéi 'H' de shù zǔ" -#: shared-bindings/synthio/MidiTrack.c shared-bindings/synthio/__init__.c +#: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" msgstr "%q bìxū shì lèixíng wéi 'h' de shùzǔ" @@ -1144,10 +1147,6 @@ msgstr "I2C qǐdòng cuòwù" msgid "I2C peripheral in use" msgstr "I2C wài shè zhèng zài shǐ yòng zhōng" -#: shared-bindings/audiobusio/I2SOut.c -msgid "I2SOut not available" -msgstr "I2SOut bù kě yòng" - #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "In-buffer elements must be <= 4 bytes long" msgstr "huǎn chōng nèi yuán sù bì xū <= 4 zì jié cháng" @@ -1316,6 +1315,10 @@ msgstr "géshì wúxiào" msgid "Invalid format chunk size" msgstr "Géshì kuài dàxiǎo wúxiào" +#: shared-bindings/wifi/Radio.c +msgid "Invalid hex password" +msgstr "" + #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" msgstr "wú xiào de duō bō MAC dì zhǐ" @@ -1748,10 +1751,6 @@ msgstr "huǎn chōng wài yuán sù bì xū <= 4 zì jié cháng" 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 "PDMIn bù kě yòng" - #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." @@ -4429,6 +4428,12 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "I2SOut not available" +#~ msgstr "I2SOut bù kě yòng" + +#~ msgid "PDMIn not available" +#~ msgstr "PDMIn bù kě yòng" + #~ msgid "out of range of source" #~ msgstr "yuán fàn wéi wài" From 8cc44f2b9033df4713ee9a277e66529983a4f013 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 20 Apr 2023 20:50:34 +0200 Subject: [PATCH 0897/1712] 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 | 11 ++++++++--- locale/cs.po | 11 ++++++++--- locale/de_DE.po | 11 ++++++++--- locale/el.po | 11 ++++++++--- locale/en_GB.po | 11 ++++++++--- locale/es.po | 11 ++++++++--- locale/fil.po | 11 ++++++++--- locale/fr.po | 11 ++++++++--- locale/hi.po | 11 ++++++++--- locale/it_IT.po | 11 ++++++++--- locale/ja.po | 11 ++++++++--- locale/ko.po | 11 ++++++++--- locale/nl.po | 11 ++++++++--- locale/pl.po | 11 ++++++++--- locale/pt_BR.po | 11 ++++++++--- locale/ru.po | 11 ++++++++--- locale/sv.po | 11 ++++++++--- locale/tr.po | 11 ++++++++--- locale/zh_Latn_pinyin.po | 11 ++++++++--- 19 files changed, 152 insertions(+), 57 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index c37a4f64db..b629eeb48e 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -129,6 +129,7 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -167,11 +168,11 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "%q harus %d-%d" @@ -471,6 +472,7 @@ msgstr "" msgid "All event channels in use" msgstr "Semua channel event sedang digunakan" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -479,6 +481,7 @@ msgstr "" msgid "All sync event channels in use" msgstr "Semua channel event yang disinkronisasi sedang digunakan" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Semua timer untuk pin ini sedang digunakan" @@ -1234,7 +1237,9 @@ msgid "Interrupt error." msgstr "" #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/cs.po b/locale/cs.po index 277287a4af..2b7854a27f 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -130,6 +130,7 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -168,11 +169,11 @@ msgstr "Délka %q musí být <= %d" msgid "%q length must be >= %d" msgstr "Délka %q musí být >= %d" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "%q musí být %d" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "%q musí být %d-%d" @@ -472,6 +473,7 @@ msgstr "Všechny kanály jsou používány" msgid "All event channels in use" msgstr "Všechny kanály událostí jsou již používány" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -480,6 +482,7 @@ msgstr "" msgid "All sync event channels in use" msgstr "" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Všechny časovače pro tento pin jsou používány" @@ -1234,7 +1237,9 @@ msgid "Interrupt error." msgstr "" #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/de_DE.po b/locale/de_DE.po index 9c39023401..21fea5273f 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -138,6 +138,7 @@ msgstr "%q in %q muss von Typ %q sein, nicht %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -176,11 +177,11 @@ msgstr "%q länge muss kleiner oder gleich %d sein" msgid "%q length must be >= %d" msgstr "%q länge muss größer oder gleich %d sein" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "%q muss %d entsprechen" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "%q muss %d-%d sein" @@ -482,6 +483,7 @@ msgstr "Alle Kanäle werden verwendet" msgid "All event channels in use" msgstr "Alle Event-Kanäle werden benutzt" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Alle State-Maschinen in Verwendung" @@ -490,6 +492,7 @@ msgstr "Alle State-Maschinen in Verwendung" msgid "All sync event channels in use" msgstr "Alle Sync Event-Kanäle werden benutzt" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Alle Timer für diesen Pin werden bereits benutzt" @@ -1258,7 +1261,9 @@ msgid "Interrupt error." msgstr "Interrupt Fehler." #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/el.po b/locale/el.po index ca698c532f..f7bc0aa360 100644 --- a/locale/el.po +++ b/locale/el.po @@ -134,6 +134,7 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -172,11 +173,11 @@ msgstr "%q μήκος πρέπει να είναι <= %d" msgid "%q length must be >= %d" msgstr "%q μήκος πρέπει να είναι >= %d" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "%q πρέπει να είναι %d" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "%q πρέπει να είναι %d-%d" @@ -476,6 +477,7 @@ msgstr "Όλα τα κανάλια είναι σε χρήση" msgid "All event channels in use" msgstr "Όλα τα κανάλια συμβάντων είναι σε χρήση" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Όλες οι μηχανές κατάστασης είναι σε χρήση" @@ -484,6 +486,7 @@ msgstr "Όλες οι μηχανές κατάστασης είναι σε χρή msgid "All sync event channels in use" msgstr "Όλα τα κανάλια συμβάντων συγχρονισμού είναι σε χρήση" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Όλοι οι χρονιστές για αυτό το pin χρησιμοποιούνται ήδη" @@ -1242,7 +1245,9 @@ msgid "Interrupt error." msgstr "" #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/en_GB.po b/locale/en_GB.po index 8568718c68..06ad558ee1 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -139,6 +139,7 @@ msgstr "%q in %q must be of type %q, not %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -177,11 +178,11 @@ msgstr "%q length must be <= %d" msgid "%q length must be >= %d" msgstr "%q length must be >= %d" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "%q must be %d" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "%q must be %d-%d" @@ -481,6 +482,7 @@ msgstr "All channels in use" msgid "All event channels in use" msgstr "All event channels in use" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "All state machines in use" @@ -489,6 +491,7 @@ msgstr "All state machines in use" msgid "All sync event channels in use" msgstr "All sync event channels in use" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "All timers for this pin are in use" @@ -1243,7 +1246,9 @@ msgid "Interrupt error." msgstr "Interrupt error." #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/es.po b/locale/es.po index ef8ca30c40..f0604b74f4 100644 --- a/locale/es.po +++ b/locale/es.po @@ -141,6 +141,7 @@ msgstr "%q en %q debe ser del tipo %q, no %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -179,11 +180,11 @@ msgstr "%q longitud debe ser <= %d" msgid "%q length must be >= %d" msgstr "%q longitud debe ser >= %d" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "%q debe ser %d" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "%q debe ser %d-%d" @@ -483,6 +484,7 @@ msgstr "Todos los canales están en uso" msgid "All event channels in use" msgstr "Todos los canales de eventos están en uso" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Todas las máquinas de estado están en uso" @@ -493,6 +495,7 @@ msgstr "" "Todos los canales de eventos de sincronización (sync event channels) están " "en uso" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Todos los timers para este pin están en uso" @@ -1268,7 +1271,9 @@ msgid "Interrupt error." msgstr "Error de interrupción." #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/fil.po b/locale/fil.po index e7630e6068..c7c0aeb635 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -127,6 +127,7 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -165,11 +166,11 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "" @@ -471,6 +472,7 @@ msgstr "" msgid "All event channels in use" msgstr "Lahat ng event channels ginagamit" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -479,6 +481,7 @@ msgstr "" msgid "All sync event channels in use" msgstr "Lahat ng sync event channels ay ginagamit" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Lahat ng timers para sa pin na ito ay ginagamit" @@ -1234,7 +1237,9 @@ msgid "Interrupt error." msgstr "" #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/fr.po b/locale/fr.po index 81f8c8dcd2..ac83978de1 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -141,6 +141,7 @@ msgstr "%q dans %q doit être de type %q, pas %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -179,11 +180,11 @@ msgstr "La longeur de %q doit être <= %d" msgid "%q length must be >= %d" msgstr "La longeur de %q doit être >= %d" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "%q doit être %d" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "%q doit être %d-%d" @@ -483,6 +484,7 @@ msgstr "Tout les canaux sont utilisés" msgid "All event channels in use" msgstr "Tous les canaux d'événements sont utilisés" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Tous les automates finis sont utilisés" @@ -491,6 +493,7 @@ msgstr "Tous les automates finis sont utilisés" msgid "All sync event channels in use" msgstr "Tout les canaux d'événements sync sont utilisés" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Tous les minuteurs pour cette broche sont utilisés" @@ -1277,7 +1280,9 @@ msgid "Interrupt error." msgstr "Erreur d'interruption." #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/hi.po b/locale/hi.po index 56095ed2f7..e264d5e692 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -126,6 +126,7 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -164,11 +165,11 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "" @@ -468,6 +469,7 @@ msgstr "" msgid "All event channels in use" msgstr "" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -476,6 +478,7 @@ msgstr "" msgid "All sync event channels in use" msgstr "" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "" @@ -1222,7 +1225,9 @@ msgid "Interrupt error." msgstr "" #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/it_IT.po b/locale/it_IT.po index 4bedc7d428..52fb4b00a3 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -130,6 +130,7 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -168,11 +169,11 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "" @@ -474,6 +475,7 @@ msgstr "" msgid "All event channels in use" msgstr "Tutti i canali eventi utilizati" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Tutte le state machines sono in uso" @@ -482,6 +484,7 @@ msgstr "Tutte le state machines sono in uso" msgid "All sync event channels in use" msgstr "Tutti i canali di eventi sincronizzati in uso" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Tutti i timer per questo pin sono in uso" @@ -1236,7 +1239,9 @@ msgid "Interrupt error." msgstr "" #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/ja.po b/locale/ja.po index 1045e43dbc..805dc10e8e 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -133,6 +133,7 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -171,11 +172,11 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "" @@ -475,6 +476,7 @@ msgstr "" msgid "All event channels in use" msgstr "全てのイベントチャネルが使用中" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -483,6 +485,7 @@ msgstr "" msgid "All sync event channels in use" msgstr "全ての同期イベントチャネルが使用中" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "このピン用の全てのタイマが使用中" @@ -1235,7 +1238,9 @@ msgid "Interrupt error." msgstr "" #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/ko.po b/locale/ko.po index 6dccfd143b..061c70bdfa 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -127,6 +127,7 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -165,11 +166,11 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "" @@ -469,6 +470,7 @@ msgstr "" msgid "All event channels in use" msgstr "" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -477,6 +479,7 @@ msgstr "" msgid "All sync event channels in use" msgstr "" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "핀의 모든 타이머가 사용 중입니다" @@ -1225,7 +1228,9 @@ msgid "Interrupt error." msgstr "" #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/nl.po b/locale/nl.po index 003953f289..3f14b144c6 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -126,6 +126,7 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -164,11 +165,11 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "" @@ -468,6 +469,7 @@ msgstr "" msgid "All event channels in use" msgstr "Alle event kanalen zijn in gebruik" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -476,6 +478,7 @@ msgstr "" msgid "All sync event channels in use" msgstr "Alle sync event kanalen zijn in gebruik" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Alle timers voor deze pin zijn in gebruik" @@ -1230,7 +1233,9 @@ msgid "Interrupt error." msgstr "" #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/pl.po b/locale/pl.po index b0f60e0806..f6c35b87b2 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -128,6 +128,7 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -166,11 +167,11 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "" @@ -470,6 +471,7 @@ msgstr "" msgid "All event channels in use" msgstr "Wszystkie kanały zdarzeń w użyciu" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "" @@ -478,6 +480,7 @@ msgstr "" msgid "All sync event channels in use" msgstr "Wszystkie kanały zdarzeń synchronizacji w użyciu" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Wszystkie timery tej nóżki w użyciu" @@ -1230,7 +1233,9 @@ msgid "Interrupt error." msgstr "" #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index b428121645..5d02126604 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -139,6 +139,7 @@ msgstr "%q em %q deve ser do tipo %q e não %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -177,11 +178,11 @@ msgstr "o comprimento de %q deve ser <= %d" msgid "%q length must be >= %d" msgstr "o comprimento de %q deve ser >= %d" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "%q deve ser %d" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "o %q deve ser %d-%d" @@ -485,6 +486,7 @@ msgstr "Todos os canais estão em uso" msgid "All event channels in use" msgstr "Todos os canais de eventos em uso" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "O estado de todas as máquinas em uso" @@ -493,6 +495,7 @@ msgstr "O estado de todas as máquinas em uso" msgid "All sync event channels in use" msgstr "Todos os canais dos eventos de sincronização em uso" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Todos os temporizadores para este pino estão em uso" @@ -1264,7 +1267,9 @@ msgid "Interrupt error." msgstr "Erro de interrupção." #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/ru.po b/locale/ru.po index 75447bec23..82bf8504f9 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -133,6 +133,7 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -171,11 +172,11 @@ msgstr "Длинна %q должна быть <= %d" msgid "%q length must be >= %d" msgstr "Длинна %q должна быть >= %d" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "%q должно быть %d" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "%q должно быть %d-%d" @@ -475,6 +476,7 @@ msgstr "Все каналы уже используются" msgid "All event channels in use" msgstr "Все каналы событий уже используются" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Все машины состояний уже используются" @@ -483,6 +485,7 @@ msgstr "Все машины состояний уже используются" msgid "All sync event channels in use" msgstr "Все каналы событий синхронизации уже используются" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Все таймеры для этого пина уже используются" @@ -1267,7 +1270,9 @@ msgid "Interrupt error." msgstr "" #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/sv.po b/locale/sv.po index 5cc3ecdf9c..909c8a624f 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -138,6 +138,7 @@ msgstr "%q i %q måste vara av typen %q, inte %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -176,11 +177,11 @@ msgstr "längden på %q måste vara <= %d" msgid "%q length must be >= %d" msgstr "längden på %q måste vara >= %d" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "%q måste vara %d" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "%q måste vara %d-%d" @@ -482,6 +483,7 @@ msgstr "Alla kanaler används" msgid "All event channels in use" msgstr "Alla händelsekanaler används" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Alla tillståndsmaskiner används" @@ -490,6 +492,7 @@ msgstr "Alla tillståndsmaskiner används" msgid "All sync event channels in use" msgstr "Alla händelsekanaler används" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Alla timers för denna pinne är i bruk" @@ -1249,7 +1252,9 @@ msgid "Interrupt error." msgstr "Interrupt-fel." #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/tr.po b/locale/tr.po index 3a4b19ea1b..1bcf4b9cfb 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -134,6 +134,7 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -172,11 +173,11 @@ msgstr "%q boyutu <= %d olmalıdır" msgid "%q length must be >= %d" msgstr "%q boyutu >= %d olmalıdır" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "%q, %d olmalıdır" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "%q, %d-%d olmalıdır" @@ -477,6 +478,7 @@ msgstr "Tüm kanallar kullanımda" msgid "All event channels in use" msgstr "Tüm olay kanalları kullanımda" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "Tüm durum makineleri kullanımda" @@ -485,6 +487,7 @@ msgstr "Tüm durum makineleri kullanımda" msgid "All sync event channels in use" msgstr "Tüm asenkron olay kanalları kullanımda" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "Bu pin için tüm zamanlayıcılar kullanımda" @@ -1240,7 +1243,9 @@ msgid "Interrupt error." msgstr "" #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 1ecf35326f..ec33771682 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -141,6 +141,7 @@ msgstr "%q zhōng de %q bì xū shì %q lèi xíng, ér bù shì %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c @@ -179,11 +180,11 @@ msgstr "%q chángdù bìxū <= %d" msgid "%q length must be >= %d" msgstr "%q chángdù bìxū >= %d" -#: py/argcheck.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c msgid "%q must be %d" msgstr "%q bìxū %d" -#: py/argcheck.c +#: py/argcheck.c shared-bindings/displayio/Bitmap.c msgid "%q must be %d-%d" msgstr "%q bì xū wéi %d-%d" @@ -484,6 +485,7 @@ msgstr "suǒyǒu píndào dōu zài shǐyòng zhōng" msgid "All event channels in use" msgstr "suǒyǒu shìjiàn píndào dōu zài shǐyòng zhōng" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "All state machines in use" msgstr "suǒyǒu zhuàngtàijī dōu zài shǐyòng zhōng" @@ -492,6 +494,7 @@ msgstr "suǒyǒu zhuàngtàijī dōu zài shǐyòng zhōng" msgid "All sync event channels in use" msgstr "suǒyǒu tóngbù shìjiàn píndào dōu zài shǐyòng zhōng" +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c msgid "All timers for this pin are in use" msgstr "cǐ yǐnjiǎo de suǒyǒu jìshíqì dōu zài shǐyòng zhōng" @@ -1256,7 +1259,9 @@ msgid "Interrupt error." msgstr "zhōng duàn cuò wù." #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c -#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c py/argcheck.c +#: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c +#: ports/raspberrypi/bindings/picodvi/Framebuffer.c +#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/displayio/EPaperDisplay.c msgid "Invalid %q" From afae39765f958953e6e3f595578d609cc16718c8 Mon Sep 17 00:00:00 2001 From: gamblor21 Date: Thu, 20 Apr 2023 18:26:04 -0500 Subject: [PATCH 0898/1712] PR review fixups --- shared-bindings/gifio/OnDiskGif.c | 12 +++++------ shared-module/gifio/OnDiskGif.c | 36 ++++++++++++++++--------------- shared-module/gifio/OnDiskGif.h | 8 ++----- 3 files changed, 27 insertions(+), 29 deletions(-) diff --git a/shared-bindings/gifio/OnDiskGif.c b/shared-bindings/gifio/OnDiskGif.c index cfed55d0c8..be8794f24c 100644 --- a/shared-bindings/gifio/OnDiskGif.c +++ b/shared-bindings/gifio/OnDiskGif.c @@ -126,18 +126,18 @@ STATIC mp_obj_t gifio_ondiskgif_make_new(const mp_obj_type_t *type, size_t n_arg mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - mp_obj_t arg = all_args[0]; - if (mp_obj_is_str(arg)) { - arg = mp_call_function_2(MP_OBJ_FROM_PTR(&mp_builtin_open_obj), arg, MP_ROM_QSTR(MP_QSTR_rb)); + mp_obj_t filename = all_args[0]; + if (mp_obj_is_str(filename)) { + filename = mp_call_function_2(MP_OBJ_FROM_PTR(&mp_builtin_open_obj), filename, MP_ROM_QSTR(MP_QSTR_rb)); } - if (!mp_obj_is_type(arg, &mp_type_fileio)) { + if (!mp_obj_is_type(filename, &mp_type_fileio)) { mp_raise_TypeError(translate("file must be a file opened in byte mode")); } gifio_ondiskgif_t *self = m_new_obj(gifio_ondiskgif_t); self->base.type = &gifio_ondiskgif_type; - common_hal_gifio_ondiskgif_construct(self, MP_OBJ_TO_PTR(arg), args[ARG_use_palette].u_bool); + common_hal_gifio_ondiskgif_construct(self, MP_OBJ_TO_PTR(filename), args[ARG_use_palette].u_bool); return MP_OBJ_FROM_PTR(self); } @@ -207,7 +207,7 @@ MP_PROPERTY_GETTER(gifio_ondiskgif_bitmap_obj, (mp_obj_t)&gifio_ondiskgif_get_bitmap_obj); //| palette: displayio.Palette -//| """The palette for the current frame.""" +//| """The palette for the current frame if it exists.""" STATIC mp_obj_t gifio_ondiskgif_obj_get_palette(mp_obj_t self_in) { gifio_ondiskgif_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-module/gifio/OnDiskGif.c b/shared-module/gifio/OnDiskGif.c index f6adfa0775..c1e6d1f2c2 100644 --- a/shared-module/gifio/OnDiskGif.c +++ b/shared-module/gifio/OnDiskGif.c @@ -68,9 +68,9 @@ static void GIFDraw(GIFDRAW *pDraw) { // The palette is either RGB565 or the original 24-bit RGB values // depending on the pixel type selected with gif.begin() - gifio_ondiskgif_displayio_objs_t *displayio_objs = (gifio_ondiskgif_displayio_objs_t *)pDraw->pUser; - displayio_bitmap_t *bitmap = displayio_objs->bitmap; - displayio_palette_t *palette = displayio_objs->palette; + gifio_ondiskgif_t *ondiskgif = (gifio_ondiskgif_t *)pDraw->pUser; + displayio_bitmap_t *bitmap = ondiskgif->bitmap; + displayio_palette_t *palette = ondiskgif->palette; // Update the palette if we have one in RGB888 if (palette != NULL) { @@ -174,20 +174,19 @@ void common_hal_gifio_ondiskgif_construct(gifio_ondiskgif_t *self, pyb_file_obj_ int bpp = 16; if (use_palette == true) { - mp_printf(&mp_plat_print, "Using palette\n"); displayio_palette_t *palette = m_new_obj(displayio_palette_t); palette->base.type = &displayio_palette_type; common_hal_displayio_palette_construct(palette, 256, false); - self->displayio_objs.palette = palette; + self->palette = palette; bpp = 8; } else { - self->displayio_objs.palette = NULL; + self->palette = NULL; } displayio_bitmap_t *bitmap = m_new_obj(displayio_bitmap_t); bitmap->base.type = &displayio_bitmap_type; common_hal_displayio_bitmap_construct(bitmap, self->gif.iCanvasWidth, self->gif.iCanvasHeight, bpp); - self->displayio_objs.bitmap = bitmap; + self->bitmap = bitmap; GIFINFO info; GIF_getInfo(&self->gif, &info); @@ -199,13 +198,13 @@ void common_hal_gifio_ondiskgif_construct(gifio_ondiskgif_t *self, pyb_file_obj_ void common_hal_gifio_ondiskgif_deinit(gifio_ondiskgif_t *self) { self->file = NULL; - common_hal_displayio_bitmap_deinit(self->displayio_objs.bitmap); - self->displayio_objs.bitmap = NULL; - self->displayio_objs.palette = NULL; + common_hal_displayio_bitmap_deinit(self->bitmap); + self->bitmap = NULL; + self->palette = NULL; } bool common_hal_gifio_ondiskgif_deinited(gifio_ondiskgif_t *self) { - return self->displayio_objs.bitmap == NULL; + return self->bitmap == NULL; } uint16_t common_hal_gifio_ondiskgif_get_height(gifio_ondiskgif_t *self) { @@ -217,11 +216,14 @@ uint16_t common_hal_gifio_ondiskgif_get_width(gifio_ondiskgif_t *self) { } mp_obj_t common_hal_gifio_ondiskgif_get_bitmap(gifio_ondiskgif_t *self) { - return MP_OBJ_FROM_PTR(self->displayio_objs.bitmap); + return MP_OBJ_FROM_PTR(self->bitmap); } mp_obj_t common_hal_gifio_ondiskgif_get_palette(gifio_ondiskgif_t *self) { - return MP_OBJ_FROM_PTR(self->displayio_objs.palette); + if (self->palette == NULL) { + return mp_const_none; + } + return MP_OBJ_FROM_PTR(self->palette); } int32_t common_hal_gifio_ondiskgif_get_duration(gifio_ondiskgif_t *self) { @@ -243,17 +245,17 @@ int32_t common_hal_gifio_ondiskgif_get_max_delay(gifio_ondiskgif_t *self) { uint32_t common_hal_gifio_ondiskgif_next_frame(gifio_ondiskgif_t *self, bool setDirty) { int nextDelay = 0; int result = 0; - result = GIF_playFrame(&self->gif, &nextDelay, &self->displayio_objs); + result = GIF_playFrame(&self->gif, &nextDelay, self); if ((result >= 0) && (setDirty)) { displayio_area_t dirty_area = { .x1 = 0, .y1 = 0, - .x2 = self->displayio_objs.bitmap->width, - .y2 = self->displayio_objs.bitmap->height, + .x2 = self->bitmap->width, + .y2 = self->bitmap->height, }; - displayio_bitmap_set_dirty_area(self->displayio_objs.bitmap, &dirty_area); + displayio_bitmap_set_dirty_area(self->bitmap, &dirty_area); } return nextDelay; diff --git a/shared-module/gifio/OnDiskGif.h b/shared-module/gifio/OnDiskGif.h index 70479ac8d9..6138337391 100644 --- a/shared-module/gifio/OnDiskGif.h +++ b/shared-module/gifio/OnDiskGif.h @@ -38,16 +38,12 @@ #include "extmod/vfs_fat.h" -typedef struct { - displayio_bitmap_t *bitmap; - displayio_palette_t *palette; -} gifio_ondiskgif_displayio_objs_t; - typedef struct { mp_obj_base_t base; GIFIMAGE gif; pyb_file_obj_t *file; - gifio_ondiskgif_displayio_objs_t displayio_objs; + displayio_bitmap_t *bitmap; + displayio_palette_t *palette; int32_t duration; int32_t frame_count; int32_t min_delay; From b3c8575b81ef78c5df9af265d7270056b00d9459 Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Thu, 20 Apr 2023 21:22:39 -0400 Subject: [PATCH 0899/1712] Update for Pimoroni Pico dv pins/connectors --- .../boards/pimoroni_pico_dv/board.c | 52 +++++++++++ .../boards/pimoroni_pico_dv/mpconfigboard.h | 7 ++ .../boards/pimoroni_pico_dv/mpconfigboard.mk | 12 +++ .../pimoroni_pico_dv/pico-sdk-configboard.h | 4 + .../boards/pimoroni_pico_dv/pins.c | 92 +++++++++++++++++++ 5 files changed, 167 insertions(+) create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv/board.c create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv/pins.c diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv/board.c b/ports/raspberrypi/boards/pimoroni_pico_dv/board.c new file mode 100644 index 0000000000..bc5878bf24 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv/board.c @@ -0,0 +1,52 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "bindings/picodvi/Framebuffer.h" +#include "shared-module/displayio/__init__.h" +#include "shared-bindings/framebufferio/FramebufferDisplay.h" + +void board_init(void) { + picodvi_framebuffer_obj_t *fb = &allocate_display_bus()->picodvi; + fb->base.type = &picodvi_framebuffer_type; + common_hal_picodvi_framebuffer_construct(fb, 640, 480, + &pin_GPIO7, &pin_GPIO6, + &pin_GPIO9, &pin_GPIO8, + &pin_GPIO11, &pin_GPIO10, + &pin_GPIO13, &pin_GPIO12, + 8); + + framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; + display->base.type = &framebufferio_framebufferdisplay_type; + common_hal_framebufferio_framebufferdisplay_construct( + display, + MP_OBJ_FROM_PTR(fb), + 0, + true); +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.h b/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.h new file mode 100644 index 0000000000..bf18491e47 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.h @@ -0,0 +1,7 @@ +#define MICROPY_HW_BOARD_NAME "Pimoroni Pico DV" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO25) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk new file mode 100644 index 0000000000..20607d50e4 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk @@ -0,0 +1,12 @@ +USB_VID = 0x239A +USB_PID = 0x80F4 +USB_PRODUCT = "Pico" +USB_MANUFACTURER = "Raspberry Pi" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY__EVE = 1 +CIRCUITPY_PICODVI = 1 diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv/pico-sdk-configboard.h b/ports/raspberrypi/boards/pimoroni_pico_dv/pico-sdk-configboard.h new file mode 100644 index 0000000000..a41131dd22 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv/pico-sdk-configboard.h @@ -0,0 +1,4 @@ +// Put board-specific pico-sdk definitions here. This file must exist. + +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv/pins.c b/ports/raspberrypi/boards/pimoroni_pico_dv/pins.c new file mode 100644 index 0000000000..c331d5cbf9 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv/pins.c @@ -0,0 +1,92 @@ +#include "shared-bindings/board/__init__.h" + +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_B), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_C), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + + // SD Card + { MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO5)}, + { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO18)}, + { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO19)}, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO22)}, + + { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_WS), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_BCLK), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_OUT), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, + + // DVI VIDEO + { MP_ROM_QSTR(MP_QSTR_DV_CEC), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_DV_SCL), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_DV_SDA), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_CKN), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_CKP), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D0N), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D0P), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D1N), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D1P), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D2N), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D2P), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_DV_HPD), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].framebuffer_display)}, + +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From ae7303221d687150c506c4c39f0b8f787064d7a3 Mon Sep 17 00:00:00 2001 From: Mark <56205165+gamblor21@users.noreply.github.com> Date: Fri, 21 Apr 2023 11:21:29 -0500 Subject: [PATCH 0900/1712] Update doc that Palette may not always be there Co-authored-by: Scott Shawcroft --- shared-bindings/gifio/OnDiskGif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/gifio/OnDiskGif.c b/shared-bindings/gifio/OnDiskGif.c index be8794f24c..e4335f9e44 100644 --- a/shared-bindings/gifio/OnDiskGif.c +++ b/shared-bindings/gifio/OnDiskGif.c @@ -206,7 +206,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(gifio_ondiskgif_get_bitmap_obj, gifio_ondiskgif_obj_ge MP_PROPERTY_GETTER(gifio_ondiskgif_bitmap_obj, (mp_obj_t)&gifio_ondiskgif_get_bitmap_obj); -//| palette: displayio.Palette +//| palette: Optional[displayio.Palette] //| """The palette for the current frame if it exists.""" STATIC mp_obj_t gifio_ondiskgif_obj_get_palette(mp_obj_t self_in) { gifio_ondiskgif_t *self = MP_OBJ_TO_PTR(self_in); From 7089ea4d6586821f03c062e21ccdc8c4dfab9422 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 20 Apr 2023 16:15:06 -0700 Subject: [PATCH 0901/1712] Add address_little_endian for displayio Add address_little_endian for epaper displays with little endian (low byte first) addresses. Also clears allocated display and display bus memory so it has a known state. The acep member wasn't always set so it varied accidentally. Fixes #7560. May fix #7778. Fixes #5119. --- shared-bindings/displayio/EPaperDisplay.c | 10 +- shared-bindings/displayio/EPaperDisplay.h | 14 +- shared-module/_stage/__init__.c | 5 +- shared-module/board/__init__.c | 8 +- shared-module/displayio/Display.c | 12 +- shared-module/displayio/EPaperDisplay.c | 26 ++-- shared-module/displayio/EPaperDisplay.h | 4 - shared-module/displayio/TileGrid.c | 1 - shared-module/displayio/__init__.c | 139 ++++++++++-------- shared-module/displayio/__init__.h | 8 +- shared-module/displayio/display_core.c | 50 +++++-- shared-module/displayio/display_core.h | 20 ++- .../framebufferio/FramebufferDisplay.c | 5 +- supervisor/shared/display.c | 8 +- 14 files changed, 181 insertions(+), 129 deletions(-) diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 93d91110a2..42f58ac0c5 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -80,7 +80,8 @@ //| grayscale: bool = False, //| advanced_color_epaper: bool = False, //| two_byte_sequence_length: bool = False, -//| start_up_time: float = 0 +//| start_up_time: float = 0, +//| address_little_endian: bool = False //| ) -> None: //| """Create a EPaperDisplay object on the given display bus (`displayio.FourWire` or `paralleldisplay.ParallelBus`). //| @@ -122,6 +123,7 @@ //| :param bool advanced_color_epaper: When true, the display is a 7-color advanced color epaper (ACeP) //| :param bool two_byte_sequence_length: When true, use two bytes to define sequence length //| :param float start_up_time: Time to wait after reset before sending commands +//| :param bool address_little_endian: Send the least significant byte (not bit) of multi-byte addresses first. Ignored when ram is addressed with one byte //| """ //| ... STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { @@ -132,7 +134,7 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size ARG_write_color_ram_command, ARG_color_bits_inverted, ARG_highlight_color, ARG_refresh_display_command, ARG_refresh_time, ARG_busy_pin, ARG_busy_state, ARG_seconds_per_frame, ARG_always_toggle_chip_select, ARG_grayscale, ARG_advanced_color_epaper, - ARG_two_byte_sequence_length, ARG_start_up_time }; + ARG_two_byte_sequence_length, ARG_start_up_time, ARG_address_little_endian }; static const mp_arg_t allowed_args[] = { { MP_QSTR_display_bus, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_start_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -163,6 +165,7 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size { MP_QSTR_advanced_color_epaper, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, { MP_QSTR_two_byte_sequence_length, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, { MP_QSTR_start_up_time, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NEW_SMALL_INT(0)} }, + { MP_QSTR_address_little_endian, MP_ARG_BOOL | MP_ARG_KW_ONLY, {.u_bool = false} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -228,7 +231,8 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size args[ARG_write_black_ram_command].u_int, args[ARG_black_bits_inverted].u_bool, write_color_ram_command, args[ARG_color_bits_inverted].u_bool, highlight_color, refresh_buf, refresh_buf_len, refresh_time, busy_pin, args[ARG_busy_state].u_bool, seconds_per_frame, - args[ARG_always_toggle_chip_select].u_bool, args[ARG_grayscale].u_bool, args[ARG_advanced_color_epaper].u_bool, two_byte_sequence_length + args[ARG_always_toggle_chip_select].u_bool, args[ARG_grayscale].u_bool, args[ARG_advanced_color_epaper].u_bool, + two_byte_sequence_length, args[ARG_address_little_endian].u_bool ); return self; diff --git a/shared-bindings/displayio/EPaperDisplay.h b/shared-bindings/displayio/EPaperDisplay.h index 1ef2ed4b4b..bdaad61300 100644 --- a/shared-bindings/displayio/EPaperDisplay.h +++ b/shared-bindings/displayio/EPaperDisplay.h @@ -37,12 +37,18 @@ extern const mp_obj_type_t displayio_epaperdisplay_type; #define NO_COMMAND 0x100 void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t *self, - mp_obj_t bus, const uint8_t *start_sequence, uint16_t start_sequence_len, mp_float_t start_up_time, const uint8_t *stop_sequence, uint16_t stop_sequence_len, - uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, + mp_obj_t bus, const uint8_t *start_sequence, uint16_t start_sequence_len, mp_float_t start_up_time, + const uint8_t *stop_sequence, uint16_t stop_sequence_len, + uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, + int16_t colstart, int16_t rowstart, uint16_t rotation, uint16_t set_column_window_command, uint16_t set_row_window_command, uint16_t set_current_column_command, uint16_t set_current_row_command, - uint16_t write_black_ram_command, bool black_bits_inverted, uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, const uint8_t *refresh_sequence, uint16_t refresh_sequence_len, mp_float_t refresh_time, - const mcu_pin_obj_t *busy_pin, bool busy_state, mp_float_t seconds_per_frame, bool always_toggle_chip_select, bool grayscale, bool acep, bool two_byte_sequence_length); + uint16_t write_black_ram_command, bool black_bits_inverted, + uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, + const uint8_t *refresh_sequence, uint16_t refresh_sequence_len, mp_float_t refresh_time, + const mcu_pin_obj_t *busy_pin, bool busy_state, mp_float_t seconds_per_frame, + bool always_toggle_chip_select, bool grayscale, bool acep, bool two_byte_sequence_length, + bool address_little_endian); bool common_hal_displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t *self); diff --git a/shared-module/_stage/__init__.c b/shared-module/_stage/__init__.c index 7ec640bc6e..0a18635562 100644 --- a/shared-module/_stage/__init__.c +++ b/shared-module/_stage/__init__.c @@ -46,10 +46,7 @@ void render_stage( area.y1 = y0 * scale; area.x2 = x1 * scale; area.y2 = y1 * scale; - displayio_display_core_set_region_to_update( - &display->core, display->set_column_command, display->set_row_command, - NO_COMMAND, NO_COMMAND, display->data_as_commands, false, &area, - display->SH1107_addressing); + displayio_display_core_set_region_to_update(&display->core, &area); while (!displayio_display_core_begin_transaction(&display->core)) { RUN_BACKGROUND_TASKS; diff --git a/shared-module/board/__init__.c b/shared-module/board/__init__.c index 5d08c368b5..2d5a8a07e4 100644 --- a/shared-module/board/__init__.c +++ b/shared-module/board/__init__.c @@ -190,7 +190,7 @@ void reset_board_buses(void) { bool display_using_i2c = false; #if CIRCUITPY_DISPLAYIO for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - if (displays[i].bus_base.type == &displayio_i2cdisplay_type && displays[i].i2cdisplay_bus.bus == &i2c_obj[instance]) { + if (display_buses[i].bus_base.type == &displayio_i2cdisplay_type && display_buses[i].i2cdisplay_bus.bus == &i2c_obj[instance]) { display_using_i2c = true; break; } @@ -211,13 +211,13 @@ void reset_board_buses(void) { bool display_using_spi = false; #if CIRCUITPY_DISPLAYIO for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - mp_const_obj_t bus_type = displays[i].bus_base.type; - if (bus_type == &displayio_fourwire_type && displays[i].fourwire_bus.bus == &spi_obj[instance]) { + mp_const_obj_t bus_type = display_buses[i].bus_base.type; + if (bus_type == &displayio_fourwire_type && display_buses[i].fourwire_bus.bus == &spi_obj[instance]) { display_using_spi = true; break; } #if CIRCUITPY_SHARPDISPLAY - if (displays[i].bus_base.type == &sharpdisplay_framebuffer_type && displays[i].sharpdisplay.bus == &spi_obj[instance]) { + if (bus_type == &sharpdisplay_framebuffer_type && display_buses[i].sharpdisplay.bus == &spi_obj[instance]) { display_using_spi = true; break; } diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 01d8c544ad..6d4acbe8c0 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -64,16 +64,14 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self, ram_height = 0xff; } displayio_display_core_construct(&self->core, bus, width, height, ram_width, ram_height, colstart, rowstart, rotation, - color_depth, grayscale, pixels_in_byte_share_row, bytes_per_cell, reverse_pixels_in_byte, reverse_bytes_in_word); + color_depth, grayscale, pixels_in_byte_share_row, bytes_per_cell, reverse_pixels_in_byte, reverse_bytes_in_word, + set_column_command, set_row_command, NO_COMMAND, NO_COMMAND, self->data_as_commands, false /* always_toggle_chip_select */, + SH1107_addressing && color_depth == 1, false /*address_little_endian */); - self->set_column_command = set_column_command; - self->set_row_command = set_row_command; self->write_ram_command = write_ram_command; self->brightness_command = brightness_command; self->first_manual_refresh = !auto_refresh; - self->data_as_commands = data_as_commands; self->backlight_on_high = backlight_on_high; - self->SH1107_addressing = SH1107_addressing && color_depth == 1; self->native_frames_per_second = native_frames_per_second; self->native_ms_per_frame = 1000 / native_frames_per_second; @@ -294,9 +292,7 @@ STATIC bool _refresh_area(displayio_display_obj_t *self, const displayio_area_t } remaining_rows -= rows_per_buffer; - displayio_display_core_set_region_to_update(&self->core, self->set_column_command, - self->set_row_command, NO_COMMAND, NO_COMMAND, self->data_as_commands, false, - &subrectangle, self->SH1107_addressing); + displayio_display_core_set_region_to_update(&self->core, &subrectangle); uint16_t subrectangle_size_bytes; if (self->core.colorspace.depth >= 8) { diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 74f828aea8..2f6c8fa5c9 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -58,28 +58,30 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t uint16_t write_color_ram_command, bool color_bits_inverted, uint32_t highlight_color, const uint8_t *refresh_sequence, uint16_t refresh_sequence_len, mp_float_t refresh_time, const mcu_pin_obj_t *busy_pin, bool busy_state, mp_float_t seconds_per_frame, - bool chip_select, bool grayscale, bool acep, bool two_byte_sequence_length) { + bool chip_select, bool grayscale, bool acep, bool two_byte_sequence_length, bool address_little_endian) { uint16_t color_depth = 1; bool core_grayscale = true; if (highlight_color != 0x000000) { self->core.colorspace.tricolor = true; self->core.colorspace.tricolor_hue = displayio_colorconverter_compute_hue(highlight_color); self->core.colorspace.tricolor_luma = displayio_colorconverter_compute_luma(highlight_color); + } else { + self->core.colorspace.tricolor = false; } + self->acep = acep; + self->core.colorspace.sevencolor = acep; if (acep) { - self->core.colorspace.sevencolor = true; color_depth = 4; // bits. 7 colors + clean - self->acep = acep; grayscale = false; core_grayscale = false; } - displayio_display_core_construct(&self->core, bus, width, height, ram_width, ram_height, colstart, rowstart, rotation, color_depth, core_grayscale, true, 1, true, true); + displayio_display_core_construct(&self->core, bus, width, height, ram_width, ram_height, + colstart, rowstart, rotation, color_depth, core_grayscale, true, 1, true, true, + set_column_window_command, set_row_window_command, set_current_column_command, set_current_row_command, + false /* data_as_commands */, chip_select, + false /* SH1107_addressing */, address_little_endian); - self->set_column_window_command = set_column_window_command; - self->set_row_window_command = set_row_window_command; - self->set_current_column_command = set_current_column_command; - self->set_current_row_command = set_current_row_command; self->write_black_ram_command = write_black_ram_command; self->black_bits_inverted = black_bits_inverted; self->write_color_ram_command = write_color_ram_command; @@ -137,7 +139,7 @@ STATIC const displayio_area_t *displayio_epaperdisplay_get_refresh_areas(display if (self->core.current_group != NULL) { first_area = displayio_group_get_refresh_areas(self->core.current_group, NULL); } - if (first_area != NULL && self->set_row_window_command == NO_COMMAND) { + if (first_area != NULL) { self->core.area.next = NULL; return &self->core.area; } @@ -310,10 +312,8 @@ STATIC bool displayio_epaperdisplay_refresh_area(displayio_epaperdisplay_obj_t * for (uint8_t pass = 0; pass < passes; pass++) { uint16_t remaining_rows = displayio_area_height(&clipped); - if (self->set_row_window_command != NO_COMMAND) { - displayio_display_core_set_region_to_update(&self->core, self->set_column_window_command, - self->set_row_window_command, self->set_current_column_command, self->set_current_row_command, - false, self->chip_select, &clipped, false /* SH1107_addressing */); + if (self->core.row_command != NO_COMMAND) { + displayio_display_core_set_region_to_update(&self->core, &clipped); } uint8_t write_command = self->write_black_ram_command; diff --git a/shared-module/displayio/EPaperDisplay.h b/shared-module/displayio/EPaperDisplay.h index f2398398ea..13cf84dbd3 100644 --- a/shared-module/displayio/EPaperDisplay.h +++ b/shared-module/displayio/EPaperDisplay.h @@ -46,10 +46,6 @@ typedef struct { uint16_t refresh_sequence_len; uint16_t start_up_time_ms; uint16_t refresh_time; - uint16_t set_column_window_command; - uint16_t set_row_window_command; - uint16_t set_current_column_command; - uint16_t set_current_row_command; uint16_t write_black_ram_command; uint16_t write_color_ram_command; uint8_t hue; diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index e5573ac34c..723aa41682 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -543,7 +543,6 @@ bool displayio_tilegrid_fill_area(displayio_tilegrid_t *self, ((uint8_t *)buffer)[offset / pixels_per_byte] |= output_pixel.pixel << shift; } } - (void)input_pixel; } } return full_coverage; diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index 2dd0cff8b8..c47b19caea 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -48,6 +48,7 @@ #include "shared-module/sharpdisplay/SharpMemoryFramebuffer.h" #endif +primary_display_bus_t display_buses[CIRCUITPY_DISPLAY_LIMIT]; primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT]; displayio_buffer_transform_t null_transform = { @@ -87,19 +88,19 @@ void displayio_background(void) { return; } - for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - if (displays[i].display.base.type == NULL || displays[i].display.base.type == &mp_type_NoneType) { + mp_const_obj_t display_type = displays[i].display.base.type; + if (display_type == NULL || display_type == &mp_type_NoneType) { // Skip null display. continue; } - if (displays[i].display.base.type == &displayio_display_type) { + if (display_type == &displayio_display_type) { displayio_display_background(&displays[i].display); #if CIRCUITPY_FRAMEBUFFERIO - } else if (displays[i].framebuffer_display.base.type == &framebufferio_framebufferdisplay_type) { + } else if (display_type == &framebufferio_framebufferdisplay_type) { framebufferio_framebufferdisplay_background(&displays[i].framebuffer_display); #endif - } else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) { + } else if (display_type == &displayio_epaperdisplay_type) { displayio_epaperdisplay_background(&displays[i].epaper_display); } } @@ -110,7 +111,7 @@ void common_hal_displayio_release_displays(void) { // Release displays before busses so that they can send any final commands to turn the display // off properly. for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - mp_const_obj_t display_type = displays[i].display.base.type; + mp_const_obj_t display_type = displays[i].display_base.type; if (display_type == NULL || display_type == &mp_type_NoneType) { continue; } else if (display_type == &displayio_display_type) { @@ -125,39 +126,39 @@ void common_hal_displayio_release_displays(void) { displays[i].display.base.type = &mp_type_NoneType; } for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - mp_const_obj_t bus_type = displays[i].fourwire_bus.base.type; + mp_const_obj_t bus_type = display_buses[i].bus_base.type; if (bus_type == NULL || bus_type == &mp_type_NoneType) { continue; } else if (bus_type == &displayio_fourwire_type) { - common_hal_displayio_fourwire_deinit(&displays[i].fourwire_bus); + common_hal_displayio_fourwire_deinit(&display_buses[i].fourwire_bus); } else if (bus_type == &displayio_i2cdisplay_type) { - common_hal_displayio_i2cdisplay_deinit(&displays[i].i2cdisplay_bus); + common_hal_displayio_i2cdisplay_deinit(&display_buses[i].i2cdisplay_bus); #if CIRCUITPY_PARALLELDISPLAY } else if (bus_type == ¶lleldisplay_parallelbus_type) { - common_hal_paralleldisplay_parallelbus_deinit(&displays[i].parallel_bus); + common_hal_paralleldisplay_parallelbus_deinit(&display_buses[i].parallel_bus); #endif #if CIRCUITPY_RGBMATRIX } else if (bus_type == &rgbmatrix_RGBMatrix_type) { - common_hal_rgbmatrix_rgbmatrix_deinit(&displays[i].rgbmatrix); + common_hal_rgbmatrix_rgbmatrix_deinit(&display_buses[i].rgbmatrix); #endif #if CIRCUITPY_IS31FL3741 } else if (bus_type == &is31fl3741_FrameBuffer_type) { - common_hal_is31fl3741_FrameBuffer_deinit(&displays[i].is31fl3741); + common_hal_is31fl3741_FrameBuffer_deinit(&display_buses[i].is31fl3741); #endif #if CIRCUITPY_SHARPDISPLAY - } else if (displays[i].bus_base.type == &sharpdisplay_framebuffer_type) { - common_hal_sharpdisplay_framebuffer_deinit(&displays[i].sharpdisplay); + } else if (bus_type == &sharpdisplay_framebuffer_type) { + common_hal_sharpdisplay_framebuffer_deinit(&display_buses[i].sharpdisplay); #endif #if CIRCUITPY_VIDEOCORE - } else if (displays[i].bus_base.type == &videocore_framebuffer_type) { - common_hal_videocore_framebuffer_deinit(&displays[i].videocore); + } else if (bus_type == &videocore_framebuffer_type) { + common_hal_videocore_framebuffer_deinit(&display_buses[i].videocore); #endif #if CIRCUITPY_PICODVI } else if (displays[i].bus_base.type == &picodvi_framebuffer_type) { common_hal_picodvi_framebuffer_deinit(&displays[i].picodvi); #endif } - displays[i].fourwire_bus.base.type = &mp_type_NoneType; + display_buses[i].bus_base.type = &mp_type_NoneType; } supervisor_stop_terminal(); @@ -166,10 +167,11 @@ void common_hal_displayio_release_displays(void) { void reset_displays(void) { // The SPI buses used by FourWires may be allocated on the heap so we need to move them inline. for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - if (displays[i].fourwire_bus.base.type == &displayio_fourwire_type) { - displayio_fourwire_obj_t *fourwire = &displays[i].fourwire_bus; - if (((size_t)fourwire->bus) < ((size_t)&displays) || - ((size_t)fourwire->bus) > ((size_t)&displays + CIRCUITPY_DISPLAY_LIMIT)) { + mp_const_obj_t display_bus_type = display_buses[i].bus_base.type; + if (display_bus_type == &displayio_fourwire_type) { + displayio_fourwire_obj_t *fourwire = &display_buses[i].fourwire_bus; + if (((size_t)fourwire->bus) < ((size_t)&display_buses) || + ((size_t)fourwire->bus) > ((size_t)&display_buses + CIRCUITPY_DISPLAY_LIMIT * sizeof(primary_display_bus_t))) { busio_spi_obj_t *original_spi = fourwire->bus; #if CIRCUITPY_BOARD_SPI // We don't need to move original_spi if it is a board.SPI object because it is @@ -186,18 +188,19 @@ void reset_displays(void) { #endif memcpy(&fourwire->inline_bus, original_spi, sizeof(busio_spi_obj_t)); fourwire->bus = &fourwire->inline_bus; - // Check for other displays that use the same spi bus and swap them too. + // Check for other display buses that use the same spi bus and swap them too. for (uint8_t j = i + 1; j < CIRCUITPY_DISPLAY_LIMIT; j++) { - if (displays[i].fourwire_bus.base.type == &displayio_fourwire_type && - displays[i].fourwire_bus.bus == original_spi) { - displays[i].fourwire_bus.bus = &fourwire->inline_bus; + if (display_buses[j].fourwire_bus.base.type == &displayio_fourwire_type && + display_buses[j].fourwire_bus.bus == original_spi) { + display_buses[j].fourwire_bus.bus = &fourwire->inline_bus; } } } - } else if (displays[i].i2cdisplay_bus.base.type == &displayio_i2cdisplay_type) { - displayio_i2cdisplay_obj_t *i2c = &displays[i].i2cdisplay_bus; - if (((size_t)i2c->bus) < ((size_t)&displays) || - ((size_t)i2c->bus) > ((size_t)&displays + CIRCUITPY_DISPLAY_LIMIT)) { + } else if (display_bus_type == &displayio_i2cdisplay_type) { + displayio_i2cdisplay_obj_t *i2c = &display_buses[i].i2cdisplay_bus; + // Check to see if we need to inline the I2C bus. + if (((size_t)i2c->bus) < ((size_t)&display_buses) || + ((size_t)i2c->bus) > ((size_t)&display_buses + CIRCUITPY_DISPLAY_LIMIT * sizeof(primary_display_bus_t))) { busio_i2c_obj_t *original_i2c = i2c->bus; #if CIRCUITPY_BOARD_I2C // We don't need to move original_i2c if it is a board.I2C object because it is @@ -211,15 +214,15 @@ void reset_displays(void) { i2c->bus = &i2c->inline_bus; // Check for other displays that use the same i2c bus and swap them too. for (uint8_t j = i + 1; j < CIRCUITPY_DISPLAY_LIMIT; j++) { - if (displays[i].i2cdisplay_bus.base.type == &displayio_i2cdisplay_type && - displays[i].i2cdisplay_bus.bus == original_i2c) { - displays[i].i2cdisplay_bus.bus = &i2c->inline_bus; + if (display_buses[j].i2cdisplay_bus.base.type == &displayio_i2cdisplay_type && + display_buses[j].i2cdisplay_bus.bus == original_i2c) { + display_buses[j].i2cdisplay_bus.bus = &i2c->inline_bus; } } } #if CIRCUITPY_RGBMATRIX - } else if (displays[i].rgbmatrix.base.type == &rgbmatrix_RGBMatrix_type) { - rgbmatrix_rgbmatrix_obj_t *pm = &displays[i].rgbmatrix; + } else if (display_bus_type == &rgbmatrix_RGBMatrix_type) { + rgbmatrix_rgbmatrix_obj_t *pm = &display_buses[i].rgbmatrix; if (!any_display_uses_this_framebuffer(&pm->base)) { common_hal_rgbmatrix_rgbmatrix_deinit(pm); } else { @@ -227,11 +230,11 @@ void reset_displays(void) { } #endif #if CIRCUITPY_IS31FL3741 - } else if (displays[i].is31fl3741.base.type == &is31fl3741_FrameBuffer_type) { - is31fl3741_FrameBuffer_obj_t *is31fb = &displays[i].is31fl3741; + } else if (display_bus_type == &is31fl3741_FrameBuffer_type) { + is31fl3741_FrameBuffer_obj_t *is31fb = &display_buses[i].is31fl3741; - if (((uint32_t)is31fb->is31fl3741->i2c) < ((uint32_t)&displays) || - ((uint32_t)is31fb->is31fl3741->i2c) > ((uint32_t)&displays + CIRCUITPY_DISPLAY_LIMIT)) { + if (((uint32_t)is31fb->is31fl3741->i2c) < ((uint32_t)&display_buses) || + ((uint32_t)is31fb->is31fl3741->i2c) > ((uint32_t)&display_buses + CIRCUITPY_DISPLAY_LIMIT)) { #if CIRCUITPY_BOARD_I2C // We don't need to move original_i2c if it is the board.I2C object because it is // statically allocated already. (Doing so would also make it impossible to reference in @@ -257,13 +260,13 @@ void reset_displays(void) { } #endif #if CIRCUITPY_SHARPDISPLAY - } else if (displays[i].bus_base.type == &sharpdisplay_framebuffer_type) { - sharpdisplay_framebuffer_obj_t *sharp = &displays[i].sharpdisplay; + } else if (display_bus_type == &sharpdisplay_framebuffer_type) { + sharpdisplay_framebuffer_obj_t *sharp = &display_buses[i].sharpdisplay; common_hal_sharpdisplay_framebuffer_reset(sharp); #endif #if CIRCUITPY_VIDEOCORE - } else if (displays[i].bus_base.type == &videocore_framebuffer_type) { - videocore_framebuffer_obj_t *vc = &displays[i].videocore; + } else if (display_bus_type == &videocore_framebuffer_type) { + videocore_framebuffer_obj_t *vc = &display_buses[i].videocore; if (!any_display_uses_this_framebuffer(&vc->base)) { common_hal_videocore_framebuffer_deinit(vc); } @@ -286,13 +289,14 @@ void reset_displays(void) { for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { // Reset the displayed group. Only the first will get the terminal but // that's ok. - if (displays[i].display.base.type == &displayio_display_type) { + mp_const_obj_t display_type = displays[i].display_base.type; + if (display_type == &displayio_display_type) { reset_display(&displays[i].display); - } else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) { + } else if (display_type == &displayio_epaperdisplay_type) { displayio_epaperdisplay_obj_t *display = &displays[i].epaper_display; common_hal_displayio_epaperdisplay_show(display, NULL); #if CIRCUITPY_FRAMEBUFFERIO - } else if (displays[i].framebuffer_display.base.type == &framebufferio_framebufferdisplay_type) { + } else if (display_type == &framebufferio_framebufferdisplay_type) { framebufferio_framebufferdisplay_reset(&displays[i].framebuffer_display); #endif } @@ -301,35 +305,42 @@ void reset_displays(void) { void displayio_gc_collect(void) { for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { + mp_const_obj_t display_bus_type = display_buses[i].bus_base.type; + if (display_bus_type == NULL || display_bus_type == &mp_type_NoneType) { + continue; + } #if CIRCUITPY_RGBMATRIX - if (displays[i].rgbmatrix.base.type == &rgbmatrix_RGBMatrix_type) { - rgbmatrix_rgbmatrix_collect_ptrs(&displays[i].rgbmatrix); + if (display_bus_type == &rgbmatrix_RGBMatrix_type) { + rgbmatrix_rgbmatrix_collect_ptrs(&display_buses[i].rgbmatrix); } #endif #if CIRCUITPY_IS31FL3741 - if (displays[i].is31fl3741.base.type == &is31fl3741_FrameBuffer_type) { - is31fl3741_FrameBuffer_collect_ptrs(&displays[i].is31fl3741); + if (display_bus_type == &is31fl3741_FrameBuffer_type) { + is31fl3741_FrameBuffer_collect_ptrs(&display_buses[i].is31fl3741); } #endif #if CIRCUITPY_SHARPDISPLAY - if (displays[i].bus_base.type == &sharpdisplay_framebuffer_type) { - common_hal_sharpdisplay_framebuffer_collect_ptrs(&displays[i].sharpdisplay); + if (display_bus_type == &sharpdisplay_framebuffer_type) { + common_hal_sharpdisplay_framebuffer_collect_ptrs(&display_buses[i].sharpdisplay); } #endif + } - if (displays[i].display.base.type == NULL) { + for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { + mp_const_obj_t display_type = displays[i].display_base.type; + if (display_type == NULL || display_type == &mp_type_NoneType) { continue; } // Alternatively, we could use gc_collect_root over the whole object, // but this is more precise, and is the only field that needs marking. - if (displays[i].display.base.type == &displayio_display_type) { + if (display_type == &displayio_display_type) { displayio_display_collect_ptrs(&displays[i].display); #if CIRCUITPY_FRAMEBUFFERIO - } else if (displays[i].framebuffer_display.base.type == &framebufferio_framebufferdisplay_type) { + } else if (display_type == &framebufferio_framebufferdisplay_type) { framebufferio_framebufferdisplay_collect_ptrs(&displays[i].framebuffer_display); #endif - } else if (displays[i].epaper_display.base.type == &displayio_epaperdisplay_type) { + } else if (display_type == &displayio_epaperdisplay_type) { displayio_epaperdisplay_collect_ptrs(&displays[i].epaper_display); } } @@ -339,6 +350,10 @@ primary_display_t *allocate_display(void) { for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { mp_const_obj_t display_type = displays[i].display.base.type; if (display_type == NULL || display_type == &mp_type_NoneType) { + // Clear this memory so it is in a known state before init. + memset(&displays[i], 0, sizeof(displays[i])); + // Default to None so that it works as board.DISPLAY. + displays[i].display_base.type = &mp_type_NoneType; return &displays[i]; } } @@ -352,18 +367,22 @@ primary_display_t *allocate_display_or_raise(void) { } mp_raise_RuntimeError(translate("Too many displays")); } -primary_display_t *allocate_display_bus(void) { + +primary_display_bus_t *allocate_display_bus(void) { for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { - mp_const_obj_t display_bus_type = displays[i].bus_base.type; + mp_const_obj_t display_bus_type = display_buses[i].bus_base.type; if (display_bus_type == NULL || display_bus_type == &mp_type_NoneType) { - return &displays[i]; + // Clear this memory so it is in a known state before init. + memset(&display_buses[i], 0, sizeof(display_buses[i])); + display_buses[i].bus_base.type = &mp_type_NoneType; + return &display_buses[i]; } } return NULL; } -primary_display_t *allocate_display_bus_or_raise(void) { - primary_display_t *result = allocate_display_bus(); +primary_display_bus_t *allocate_display_bus_or_raise(void) { + primary_display_bus_t *result = allocate_display_bus(); if (result) { return result; } diff --git a/shared-module/displayio/__init__.h b/shared-module/displayio/__init__.h index b450cb711d..1add0133b6 100644 --- a/shared-module/displayio/__init__.h +++ b/shared-module/displayio/__init__.h @@ -79,6 +79,9 @@ typedef struct { picodvi_framebuffer_obj_t picodvi; #endif }; +} primary_display_bus_t; + +typedef struct { union { mp_obj_base_t display_base; displayio_display_obj_t display; @@ -89,6 +92,7 @@ typedef struct { }; } primary_display_t; +extern primary_display_bus_t display_buses[CIRCUITPY_DISPLAY_LIMIT]; extern primary_display_t displays[CIRCUITPY_DISPLAY_LIMIT]; extern displayio_group_t circuitpython_splash; @@ -99,7 +103,7 @@ void displayio_gc_collect(void); primary_display_t *allocate_display(void); primary_display_t *allocate_display_or_raise(void); -primary_display_t *allocate_display_bus(void); -primary_display_t *allocate_display_bus_or_raise(void); +primary_display_bus_t *allocate_display_bus(void); +primary_display_bus_t *allocate_display_bus_or_raise(void); #endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO___INIT___H diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c index c21d87316d..8e6d51084e 100644 --- a/shared-module/displayio/display_core.c +++ b/shared-module/displayio/display_core.c @@ -47,7 +47,9 @@ void displayio_display_core_construct(displayio_display_core_t *self, mp_obj_t bus, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, - uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word) { + uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word, + uint16_t column_command, uint16_t row_command, uint16_t set_current_column_command, uint16_t set_current_row_command, + bool data_as_commands, bool always_toggle_chip_select, bool SH1107_addressing, bool address_little_endian) { self->colorspace.depth = color_depth; self->colorspace.grayscale = grayscale; self->colorspace.grayscale_bit = 8 - color_depth; @@ -61,6 +63,15 @@ void displayio_display_core_construct(displayio_display_core_t *self, self->rowstart = rowstart; self->last_refresh = 0; + self->column_command = column_command; + self->row_command = row_command; + self->set_current_column_command = set_current_column_command; + self->set_current_row_command = set_current_row_command; + self->data_as_commands = data_as_commands; + self->always_toggle_chip_select = always_toggle_chip_select; + self->SH1107_addressing = SH1107_addressing; + self->address_little_endian = address_little_endian; + // (framebufferdisplay already validated its 'bus' is a buffer-protocol object) if (bus) { #if CIRCUITPY_PARALLELDISPLAY @@ -214,10 +225,7 @@ void displayio_display_core_end_transaction(displayio_display_core_t *self) { self->end_transaction(self->bus); } -void displayio_display_core_set_region_to_update(displayio_display_core_t *self, uint8_t column_command, - uint8_t row_command, uint16_t set_current_column_command, uint16_t set_current_row_command, - bool data_as_commands, bool always_toggle_chip_select, - displayio_area_t *area, bool SH1107_addressing) { +void displayio_display_core_set_region_to_update(displayio_display_core_t *self, displayio_area_t *area) { uint16_t x1 = area->x1 + self->colstart; uint16_t x2 = area->x2 + self->colstart; uint16_t y1 = area->y1 + self->rowstart; @@ -239,17 +247,17 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self, y2 -= 1; display_chip_select_behavior_t chip_select = CHIP_SELECT_UNTOUCHED; - if (always_toggle_chip_select || data_as_commands) { + if (self->always_toggle_chip_select || self->data_as_commands) { chip_select = CHIP_SELECT_TOGGLE_EVERY_BYTE; } // Set column. displayio_display_core_begin_transaction(self); uint8_t data[5]; - data[0] = column_command; + data[0] = self->column_command; uint8_t data_length = 1; display_byte_type_t data_type = DISPLAY_DATA; - if (!data_as_commands) { + if (!self->data_as_commands) { self->send(self->bus, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, data, 1); data_length = 0; } else { @@ -260,6 +268,10 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self, data[data_length++] = x1; data[data_length++] = x2; } else { + if (self->address_little_endian) { + x1 = __builtin_bswap16(x1); + x2 = __builtin_bswap16(x2); + } data[data_length++] = x1 >> 8; data[data_length++] = x1 & 0xff; data[data_length++] = x2 >> 8; @@ -268,7 +280,7 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self, // Quirk for SH1107 "SH1107_addressing" // Column lower command = 0x00, Column upper command = 0x10 - if (SH1107_addressing) { + if (self->SH1107_addressing) { data[0] = ((x1 >> 4) & 0x0F) | 0x10; // 0x10 to 0x17 data[1] = x1 & 0x0F; // 0x00 to 0x0F data_length = 2; @@ -277,10 +289,11 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self, self->send(self->bus, data_type, chip_select, data, data_length); displayio_display_core_end_transaction(self); - if (set_current_column_command != NO_COMMAND) { - uint8_t command = set_current_column_command; + if (self->set_current_column_command != NO_COMMAND) { + uint8_t command = self->set_current_column_command; displayio_display_core_begin_transaction(self); self->send(self->bus, DISPLAY_COMMAND, chip_select, &command, 1); + // Only send the first half of data because it is the first coordinate. self->send(self->bus, DISPLAY_DATA, chip_select, data, data_length / 2); displayio_display_core_end_transaction(self); } @@ -288,9 +301,9 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self, // Set row. displayio_display_core_begin_transaction(self); - data[0] = row_command; + data[0] = self->row_command; data_length = 1; - if (!data_as_commands) { + if (!self->data_as_commands) { self->send(self->bus, DISPLAY_COMMAND, CHIP_SELECT_UNTOUCHED, data, 1); data_length = 0; } @@ -299,6 +312,10 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self, data[data_length++] = y1; data[data_length++] = y2; } else { + if (self->address_little_endian) { + y1 = __builtin_bswap16(y1); + y2 = __builtin_bswap16(y2); + } data[data_length++] = y1 >> 8; data[data_length++] = y1 & 0xff; data[data_length++] = y2 >> 8; @@ -307,7 +324,7 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self, // Quirk for SH1107 "SH1107_addressing" // Page address command = 0xB0 - if (SH1107_addressing) { + if (self->SH1107_addressing) { // set the page to our y value data[0] = 0xB0 | y1; data_length = 1; @@ -316,10 +333,11 @@ void displayio_display_core_set_region_to_update(displayio_display_core_t *self, self->send(self->bus, data_type, chip_select, data, data_length); displayio_display_core_end_transaction(self); - if (set_current_row_command != NO_COMMAND) { - uint8_t command = set_current_row_command; + if (self->set_current_row_command != NO_COMMAND) { + uint8_t command = self->set_current_row_command; displayio_display_core_begin_transaction(self); self->send(self->bus, DISPLAY_COMMAND, chip_select, &command, 1); + // Only send the first half of data because it is the first coordinate. self->send(self->bus, DISPLAY_DATA, chip_select, data, data_length / 2); displayio_display_core_end_transaction(self); } diff --git a/shared-module/displayio/display_core.h b/shared-module/displayio/display_core.h index 2167683a0d..07e57fbc6a 100644 --- a/shared-module/displayio/display_core.h +++ b/shared-module/displayio/display_core.h @@ -53,13 +53,26 @@ typedef struct { _displayio_colorspace_t colorspace; int16_t colstart; int16_t rowstart; + + // Refresh area related. + uint16_t column_command; + uint16_t row_command; + uint16_t set_current_column_command; + uint16_t set_current_row_command; + bool data_as_commands; + bool always_toggle_chip_select; + bool SH1107_addressing; + bool address_little_endian; + bool full_refresh; // New group means we need to refresh the whole display. bool refresh_in_progress; } displayio_display_core_t; void displayio_display_core_construct(displayio_display_core_t *self, mp_obj_t bus, uint16_t width, uint16_t height, uint16_t ram_width, uint16_t ram_height, int16_t colstart, int16_t rowstart, uint16_t rotation, - uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word); + uint16_t color_depth, bool grayscale, bool pixels_in_byte_share_row, uint8_t bytes_per_cell, bool reverse_pixels_in_byte, bool reverse_bytes_in_word, + uint16_t column_command, uint16_t row_command, uint16_t set_current_column_command, uint16_t set_current_row_command, + bool data_as_commands, bool always_toggle_chip_select, bool SH1107_addressing, bool address_little_endian); bool displayio_display_core_set_root_group(displayio_display_core_t *self, displayio_group_t *root_group); @@ -75,10 +88,7 @@ bool displayio_display_core_bus_free(displayio_display_core_t *self); bool displayio_display_core_begin_transaction(displayio_display_core_t *self); void displayio_display_core_end_transaction(displayio_display_core_t *self); -void displayio_display_core_set_region_to_update(displayio_display_core_t *self, uint8_t column_command, - uint8_t row_command, uint16_t set_current_column_command, uint16_t set_current_row_command, - bool data_as_commands, bool always_toggle_chip_select, - displayio_area_t *area, bool SH1107_addressing); +void displayio_display_core_set_region_to_update(displayio_display_core_t *self, displayio_area_t *area); void release_display_core(displayio_display_core_t *self); diff --git a/shared-module/framebufferio/FramebufferDisplay.c b/shared-module/framebufferio/FramebufferDisplay.c index 3d66370c04..6db2c3fec1 100644 --- a/shared-module/framebufferio/FramebufferDisplay.c +++ b/shared-module/framebufferio/FramebufferDisplay.c @@ -72,7 +72,10 @@ void common_hal_framebufferio_framebufferdisplay_construct(framebufferio_framebu fb_getter_default(get_pixels_in_byte_share_row, false), fb_getter_default(get_bytes_per_cell, 2), fb_getter_default(get_reverse_pixels_in_byte, false), - fb_getter_default(get_reverse_pixels_in_word, false) + fb_getter_default(get_reverse_pixels_in_word, false), + // Region update related settings that aren't used by framebuffer display. + NO_COMMAND, NO_COMMAND, NO_COMMAND, NO_COMMAND, + false, false, false, false ); self->first_pixel_offset = fb_getter_default(get_first_pixel_offset, 0); diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index 5ab00d4f8a..939a13340d 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -189,14 +189,14 @@ void supervisor_display_move_memory(void) { #if CIRCUITPY_DISPLAYIO for (uint8_t i = 0; i < CIRCUITPY_DISPLAY_LIMIT; i++) { #if CIRCUITPY_RGBMATRIX - if (displays[i].rgbmatrix.base.type == &rgbmatrix_RGBMatrix_type) { - rgbmatrix_rgbmatrix_obj_t *pm = &displays[i].rgbmatrix; + if (display_buses[i].rgbmatrix.base.type == &rgbmatrix_RGBMatrix_type) { + rgbmatrix_rgbmatrix_obj_t *pm = &display_buses[i].rgbmatrix; common_hal_rgbmatrix_rgbmatrix_reconstruct(pm, NULL); } #endif #if CIRCUITPY_SHARPDISPLAY - if (displays[i].bus_base.type == &sharpdisplay_framebuffer_type) { - sharpdisplay_framebuffer_obj_t *sharp = &displays[i].sharpdisplay; + if (display_buses[i].bus_base.type == &sharpdisplay_framebuffer_type) { + sharpdisplay_framebuffer_obj_t *sharp = &display_buses[i].sharpdisplay; common_hal_sharpdisplay_framebuffer_reconstruct(sharp); } #endif From d5b747b305597c89430bfd8d7585340d93cfe012 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 21 Apr 2023 13:23:01 -0700 Subject: [PATCH 0902/1712] Fix board inits --- ports/atmel-samd/boards/hallowing_m0_express/board.c | 4 ++-- ports/atmel-samd/boards/hallowing_m4_express/board.c | 6 +++--- ports/atmel-samd/boards/monster_m4sk/board.c | 6 +++--- ports/atmel-samd/boards/openbook_m4/board.c | 6 +++--- ports/atmel-samd/boards/pewpew_lcd/board.c | 6 +++--- ports/atmel-samd/boards/pewpew_m4/board.c | 6 +++--- ports/atmel-samd/boards/pybadge/board.c | 6 +++--- ports/atmel-samd/boards/pygamer/board.c | 6 +++--- ports/atmel-samd/boards/pyportal/board.c | 4 ++-- ports/atmel-samd/boards/pyportal_titano/board.c | 4 ++-- ports/atmel-samd/boards/seeeduino_wio_terminal/board.c | 6 +++--- ports/atmel-samd/boards/ugame10/board.c | 4 ++-- ports/broadcom/boards/diodes_delight_piunora/board.c | 2 +- ports/broadcom/boards/raspberrypi_cm4/board.c | 2 +- ports/broadcom/boards/raspberrypi_cm4io/board.c | 2 +- ports/broadcom/boards/raspberrypi_pi4b/board.c | 2 +- ports/broadcom/boards/raspberrypi_zero/board.c | 2 +- ports/broadcom/boards/raspberrypi_zero2w/board.c | 2 +- ports/broadcom/boards/raspberrypi_zero_w/board.c | 2 +- ports/espressif/boards/01space_lcd042_esp32c3/board.c | 6 +++--- ports/espressif/boards/adafruit_esp32s2_camera/board.c | 4 ++-- .../boards/adafruit_feather_esp32s2_reverse_tft/board.c | 4 ++-- .../espressif/boards/adafruit_feather_esp32s2_tft/board.c | 4 ++-- .../boards/adafruit_feather_esp32s3_reverse_tft/board.c | 4 ++-- .../espressif/boards/adafruit_feather_esp32s3_tft/board.c | 4 ++-- ports/espressif/boards/adafruit_funhouse/board.c | 6 +++--- .../boards/adafruit_magtag_2.9_grayscale/board.c | 6 +++--- ports/espressif/boards/espressif_esp32s3_box/board.c | 6 +++--- ports/espressif/boards/espressif_esp32s3_box_lite/board.c | 6 +++--- ports/espressif/boards/espressif_esp32s3_eye/board.c | 4 ++-- .../espressif/boards/espressif_esp32s3_usb_otg_n8/board.c | 6 +++--- ports/espressif/boards/hardkernel_odroid_go/board.c | 6 +++--- ports/espressif/boards/hexky_s2/board.c | 4 ++-- ports/espressif/boards/hiibot_iots2/board.c | 6 +++--- ports/espressif/boards/lilygo_tembed_esp32s3/board.c | 6 +++--- ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c | 6 +++--- .../boards/lilygo_ttgo_tdisplay_esp32_16m/board.c | 6 +++--- ports/espressif/boards/lilygo_twatch_2020_v3/board.c | 6 +++--- ports/espressif/boards/lolin_s2_pico/board.c | 4 ++-- ports/espressif/boards/m5stack_core2/board.c | 4 ++-- ports/espressif/boards/m5stack_core_basic/board.c | 4 ++-- ports/espressif/boards/m5stack_core_fire/board.c | 4 ++-- ports/espressif/boards/m5stack_stick_c/board.c | 6 +++--- ports/espressif/boards/morpheans_morphesp-240/board.c | 6 +++--- .../espressif/boards/waveshare_esp32_s2_pico_lcd/board.c | 6 +++--- ports/nrf/boards/clue_nrf52840_express/board.c | 6 +++--- ports/nrf/boards/hiibot_bluefi/board.c | 6 +++--- ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c | 6 +++--- ports/nrf/boards/ohs2020_badge/board.c | 6 +++--- .../boards/adafruit_feather_rp2040_dvi/board.c | 2 +- ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c | 6 +++--- ports/raspberrypi/boards/hack_club_sprig/board.c | 6 +++--- ports/raspberrypi/boards/pimoroni_badger2040/board.c | 8 +++----- ports/raspberrypi/boards/pimoroni_picosystem/board.c | 6 +++--- .../raspberrypi/boards/waveshare_rp2040_lcd_0_96/board.c | 6 +++--- ports/stm/boards/meowbit_v121/board.c | 4 ++-- 56 files changed, 136 insertions(+), 138 deletions(-) diff --git a/ports/atmel-samd/boards/hallowing_m0_express/board.c b/ports/atmel-samd/boards/hallowing_m0_express/board.c index aeea62d2a2..357cda495c 100644 --- a/ports/atmel-samd/boards/hallowing_m0_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m0_express/board.c @@ -69,7 +69,7 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; busio_spi_obj_t *spi = common_hal_board_create_spi(0); common_hal_busio_spi_never_reset(spi); @@ -82,7 +82,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/hallowing_m4_express/board.c b/ports/atmel-samd/boards/hallowing_m4_express/board.c index 5003c904bc..c070db6e52 100644 --- a/ports/atmel-samd/boards/hallowing_m4_express/board.c +++ b/ports/atmel-samd/boards/hallowing_m4_express/board.c @@ -47,11 +47,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_PA01, &pin_PA00, NULL, false); 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, @@ -62,7 +62,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/monster_m4sk/board.c b/ports/atmel-samd/boards/monster_m4sk/board.c index 76c96bba82..c67bc7dab9 100644 --- a/ports/atmel-samd/boards/monster_m4sk/board.c +++ b/ports/atmel-samd/boards/monster_m4sk/board.c @@ -48,11 +48,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_PA13, &pin_PA12, NULL, false); 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, @@ -63,7 +63,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/openbook_m4/board.c b/ports/atmel-samd/boards/openbook_m4/board.c index ec1ba9f956..59c3bb4978 100644 --- a/ports/atmel-samd/boards/openbook_m4/board.c +++ b/ports/atmel-samd/boards/openbook_m4/board.c @@ -57,11 +57,11 @@ uint8_t refresh_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL, false); 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, @@ -72,7 +72,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_epaperdisplay_obj_t *display = &displays[0].epaper_display; + displayio_epaperdisplay_obj_t *display = &allocate_display()->epaper_display; display->base.type = &displayio_epaperdisplay_type; common_hal_displayio_epaperdisplay_construct(display, bus, diff --git a/ports/atmel-samd/boards/pewpew_lcd/board.c b/ports/atmel-samd/boards/pewpew_lcd/board.c index f4060571bf..8c058fb6d9 100644 --- a/ports/atmel-samd/boards/pewpew_lcd/board.c +++ b/ports/atmel-samd/boards/pewpew_lcd/board.c @@ -46,11 +46,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_PA23, &pin_PA22, NULL, false); 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, @@ -61,7 +61,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/pewpew_m4/board.c b/ports/atmel-samd/boards/pewpew_m4/board.c index c36388f933..381af5ec16 100644 --- a/ports/atmel-samd/boards/pewpew_m4/board.c +++ b/ports/atmel-samd/boards/pewpew_m4/board.c @@ -97,11 +97,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_PA13, &pin_PA15, NULL, false); 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, @@ -115,7 +115,7 @@ void board_init(void) { uint32_t cfg0 = lookupCfg(CFG_DISPLAY_CFG0, 0x000000); uint32_t offX = (cfg0 >> 8) & 0xff; uint32_t offY = (cfg0 >> 16) & 0xff; - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/pybadge/board.c b/ports/atmel-samd/boards/pybadge/board.c index 11db1ba0a8..4b5ac1dc19 100644 --- a/ports/atmel-samd/boards/pybadge/board.c +++ b/ports/atmel-samd/boards/pybadge/board.c @@ -68,11 +68,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL, false); 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, @@ -83,7 +83,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/pygamer/board.c b/ports/atmel-samd/boards/pygamer/board.c index 141365a4a1..84b81a4b4e 100644 --- a/ports/atmel-samd/boards/pygamer/board.c +++ b/ports/atmel-samd/boards/pygamer/board.c @@ -70,11 +70,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_PB13, &pin_PB15, NULL, false); 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, @@ -85,7 +85,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/pyportal/board.c b/ports/atmel-samd/boards/pyportal/board.c index e304f6f24b..49dd831c4d 100644 --- a/ports/atmel-samd/boards/pyportal/board.c +++ b/ports/atmel-samd/boards/pyportal/board.c @@ -61,7 +61,7 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - paralleldisplay_parallelbus_obj_t *bus = &displays[0].parallel_bus; + paralleldisplay_parallelbus_obj_t *bus = &allocate_display_bus()->parallel_bus; bus->base.type = ¶lleldisplay_parallelbus_type; common_hal_paralleldisplay_parallelbus_construct(bus, &pin_PA16, // Data0 @@ -72,7 +72,7 @@ void board_init(void) { &pin_PA00, // Reset 0); // Frequency - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/pyportal_titano/board.c b/ports/atmel-samd/boards/pyportal_titano/board.c index 939a2dcc70..f938456599 100644 --- a/ports/atmel-samd/boards/pyportal_titano/board.c +++ b/ports/atmel-samd/boards/pyportal_titano/board.c @@ -78,7 +78,7 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - paralleldisplay_parallelbus_obj_t *bus = &displays[0].parallel_bus; + paralleldisplay_parallelbus_obj_t *bus = &allocate_display_bus()->parallel_bus; bus->base.type = ¶lleldisplay_parallelbus_type; common_hal_paralleldisplay_parallelbus_construct(bus, &pin_PA16, // Data0 @@ -89,7 +89,7 @@ void board_init(void) { &pin_PA00, // Reset 0); // Frequency - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c b/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c index 2eddb41fd6..6a18d4ea84 100644 --- a/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c +++ b/ports/atmel-samd/boards/seeeduino_wio_terminal/board.c @@ -65,11 +65,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_PB20, &pin_PB19, NULL, false); 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, @@ -80,7 +80,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/atmel-samd/boards/ugame10/board.c b/ports/atmel-samd/boards/ugame10/board.c index 9953f27d02..6db511d775 100644 --- a/ports/atmel-samd/boards/ugame10/board.c +++ b/ports/atmel-samd/boards/ugame10/board.c @@ -70,7 +70,7 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; busio_spi_obj_t *spi = common_hal_board_create_spi(0); common_hal_displayio_fourwire_construct(bus, @@ -82,7 +82,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/broadcom/boards/diodes_delight_piunora/board.c b/ports/broadcom/boards/diodes_delight_piunora/board.c index e272a8cc3d..ab9454298c 100644 --- a/ports/broadcom/boards/diodes_delight_piunora/board.c +++ b/ports/broadcom/boards/diodes_delight_piunora/board.c @@ -36,7 +36,7 @@ void board_init(void) { fb->base.type = &videocore_framebuffer_type; common_hal_videocore_framebuffer_construct(fb, 640, 480); - framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; + framebufferio_framebufferdisplay_obj_t *display = &allocate_display()->framebuffer_display; display->base.type = &framebufferio_framebufferdisplay_type; common_hal_framebufferio_framebufferdisplay_construct( display, diff --git a/ports/broadcom/boards/raspberrypi_cm4/board.c b/ports/broadcom/boards/raspberrypi_cm4/board.c index e272a8cc3d..ab9454298c 100644 --- a/ports/broadcom/boards/raspberrypi_cm4/board.c +++ b/ports/broadcom/boards/raspberrypi_cm4/board.c @@ -36,7 +36,7 @@ void board_init(void) { fb->base.type = &videocore_framebuffer_type; common_hal_videocore_framebuffer_construct(fb, 640, 480); - framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; + framebufferio_framebufferdisplay_obj_t *display = &allocate_display()->framebuffer_display; display->base.type = &framebufferio_framebufferdisplay_type; common_hal_framebufferio_framebufferdisplay_construct( display, diff --git a/ports/broadcom/boards/raspberrypi_cm4io/board.c b/ports/broadcom/boards/raspberrypi_cm4io/board.c index e272a8cc3d..ab9454298c 100644 --- a/ports/broadcom/boards/raspberrypi_cm4io/board.c +++ b/ports/broadcom/boards/raspberrypi_cm4io/board.c @@ -36,7 +36,7 @@ void board_init(void) { fb->base.type = &videocore_framebuffer_type; common_hal_videocore_framebuffer_construct(fb, 640, 480); - framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; + framebufferio_framebufferdisplay_obj_t *display = &allocate_display()->framebuffer_display; display->base.type = &framebufferio_framebufferdisplay_type; common_hal_framebufferio_framebufferdisplay_construct( display, diff --git a/ports/broadcom/boards/raspberrypi_pi4b/board.c b/ports/broadcom/boards/raspberrypi_pi4b/board.c index e272a8cc3d..ab9454298c 100644 --- a/ports/broadcom/boards/raspberrypi_pi4b/board.c +++ b/ports/broadcom/boards/raspberrypi_pi4b/board.c @@ -36,7 +36,7 @@ void board_init(void) { fb->base.type = &videocore_framebuffer_type; common_hal_videocore_framebuffer_construct(fb, 640, 480); - framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; + framebufferio_framebufferdisplay_obj_t *display = &allocate_display()->framebuffer_display; display->base.type = &framebufferio_framebufferdisplay_type; common_hal_framebufferio_framebufferdisplay_construct( display, diff --git a/ports/broadcom/boards/raspberrypi_zero/board.c b/ports/broadcom/boards/raspberrypi_zero/board.c index e272a8cc3d..ab9454298c 100644 --- a/ports/broadcom/boards/raspberrypi_zero/board.c +++ b/ports/broadcom/boards/raspberrypi_zero/board.c @@ -36,7 +36,7 @@ void board_init(void) { fb->base.type = &videocore_framebuffer_type; common_hal_videocore_framebuffer_construct(fb, 640, 480); - framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; + framebufferio_framebufferdisplay_obj_t *display = &allocate_display()->framebuffer_display; display->base.type = &framebufferio_framebufferdisplay_type; common_hal_framebufferio_framebufferdisplay_construct( display, diff --git a/ports/broadcom/boards/raspberrypi_zero2w/board.c b/ports/broadcom/boards/raspberrypi_zero2w/board.c index e272a8cc3d..ab9454298c 100644 --- a/ports/broadcom/boards/raspberrypi_zero2w/board.c +++ b/ports/broadcom/boards/raspberrypi_zero2w/board.c @@ -36,7 +36,7 @@ void board_init(void) { fb->base.type = &videocore_framebuffer_type; common_hal_videocore_framebuffer_construct(fb, 640, 480); - framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; + framebufferio_framebufferdisplay_obj_t *display = &allocate_display()->framebuffer_display; display->base.type = &framebufferio_framebufferdisplay_type; common_hal_framebufferio_framebufferdisplay_construct( display, diff --git a/ports/broadcom/boards/raspberrypi_zero_w/board.c b/ports/broadcom/boards/raspberrypi_zero_w/board.c index e272a8cc3d..ab9454298c 100644 --- a/ports/broadcom/boards/raspberrypi_zero_w/board.c +++ b/ports/broadcom/boards/raspberrypi_zero_w/board.c @@ -36,7 +36,7 @@ void board_init(void) { fb->base.type = &videocore_framebuffer_type; common_hal_videocore_framebuffer_construct(fb, 640, 480); - framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; + framebufferio_framebufferdisplay_obj_t *display = &allocate_display()->framebuffer_display; display->base.type = &framebufferio_framebufferdisplay_type; common_hal_framebufferio_framebufferdisplay_construct( display, diff --git a/ports/espressif/boards/01space_lcd042_esp32c3/board.c b/ports/espressif/boards/01space_lcd042_esp32c3/board.c index 56df21ab57..53f6e4a48e 100644 --- a/ports/espressif/boards/01space_lcd042_esp32c3/board.c +++ b/ports/espressif/boards/01space_lcd042_esp32c3/board.c @@ -55,11 +55,11 @@ void board_init(void) { busio_i2c_obj_t *i2c = common_hal_board_create_i2c(0); // What we would do if it wasn't the shared board I2C: (for reference) - // busio_i2c_obj_t *i2c = &displays[0].i2cdisplay_bus.inline_bus; + // busio_i2c_obj_t *i2c = &allocate_display_bus()->i2cdisplay_bus.inline_bus; // common_hal_busio_i2c_construct(i2c, &pin_GPIO23, &pin_GPIO22, 100000, 0); // common_hal_busio_i2c_never_reset(i2c); - displayio_i2cdisplay_obj_t *bus = &displays[0].i2cdisplay_bus; + displayio_i2cdisplay_obj_t *bus = &allocate_display_bus()->i2cdisplay_bus; bus->base.type = &displayio_i2cdisplay_type; common_hal_displayio_i2cdisplay_construct(bus, i2c, @@ -67,7 +67,7 @@ void board_init(void) { NULL ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/board.c b/ports/espressif/boards/adafruit_esp32s2_camera/board.c index 280f2b14b8..4799a07b79 100644 --- a/ports/espressif/boards/adafruit_esp32s2_camera/board.c +++ b/ports/espressif/boards/adafruit_esp32s2_camera/board.c @@ -52,7 +52,7 @@ uint8_t display_init_sequence[] = { void board_init(void) { busio_spi_obj_t *spi = common_hal_board_create_spi(0); - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, @@ -63,7 +63,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( display, diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/board.c b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/board.c index 360c71804c..ef6908d50a 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/board.c @@ -72,7 +72,7 @@ uint8_t display_init_sequence[] = { void board_init(void) { busio_spi_obj_t *spi = common_hal_board_create_spi(0); - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct( @@ -85,7 +85,7 @@ void board_init(void) { 0, // polarity 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c b/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c index c5b47a2f95..ce0aa8d2b9 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/board.c @@ -72,7 +72,7 @@ uint8_t display_init_sequence[] = { void board_init(void) { busio_spi_obj_t *spi = common_hal_board_create_spi(0); - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct( @@ -85,7 +85,7 @@ void board_init(void) { 0, // polarity 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/board.c b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/board.c index 360c71804c..ef6908d50a 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/board.c @@ -72,7 +72,7 @@ uint8_t display_init_sequence[] = { void board_init(void) { busio_spi_obj_t *spi = common_hal_board_create_spi(0); - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct( @@ -85,7 +85,7 @@ void board_init(void) { 0, // polarity 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_tft/board.c b/ports/espressif/boards/adafruit_feather_esp32s3_tft/board.c index 7e28aafb8e..18f361cc06 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_tft/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/board.c @@ -72,7 +72,7 @@ uint8_t display_init_sequence[] = { void board_init(void) { busio_spi_obj_t *spi = common_hal_board_create_spi(0); - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct( @@ -85,7 +85,7 @@ void board_init(void) { 0, // polarity 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/adafruit_funhouse/board.c b/ports/espressif/boards/adafruit_funhouse/board.c index d89a4db268..b1a01b2dcb 100644 --- a/ports/espressif/boards/adafruit_funhouse/board.c +++ b/ports/espressif/boards/adafruit_funhouse/board.c @@ -56,11 +56,11 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO38); #endif /* DEBUG */ - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL, false); 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, @@ -71,7 +71,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( display, diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c index 681efc1cea..55c61a0912 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c @@ -120,11 +120,11 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO44); #endif /* DEBUG */ - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL, false); 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, @@ -135,7 +135,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_epaperdisplay_obj_t *display = &displays[0].epaper_display; + displayio_epaperdisplay_obj_t *display = &allocate_display()->epaper_display; display->base.type = &displayio_epaperdisplay_type; common_hal_displayio_epaperdisplay_construct( display, diff --git a/ports/espressif/boards/espressif_esp32s3_box/board.c b/ports/espressif/boards/espressif_esp32s3_box/board.c index 75c0ede92d..a91a924d04 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/board.c +++ b/ports/espressif/boards/espressif_esp32s3_box/board.c @@ -43,11 +43,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO7, &pin_GPIO6, NULL, false); 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, @@ -58,7 +58,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/board.c b/ports/espressif/boards/espressif_esp32s3_box_lite/board.c index 23c67d06b6..ddfab49797 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/board.c +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/board.c @@ -44,11 +44,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO7, &pin_GPIO6, NULL, false); 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, @@ -59,7 +59,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/espressif/boards/espressif_esp32s3_eye/board.c b/ports/espressif/boards/espressif_esp32s3_eye/board.c index be129c6a30..49535de902 100644 --- a/ports/espressif/boards/espressif_esp32s3_eye/board.c +++ b/ports/espressif/boards/espressif_esp32s3_eye/board.c @@ -71,7 +71,7 @@ uint8_t display_init_sequence[] = { void board_init(void) { busio_spi_obj_t *spi = common_hal_board_create_spi(0); - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct( @@ -84,7 +84,7 @@ void board_init(void) { 0, // polarity 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/board.c b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/board.c index 685e7cf156..afbb5ae8fb 100644 --- a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/board.c +++ b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/board.c @@ -71,11 +71,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO6, &pin_GPIO7, NULL, false); 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, @@ -86,7 +86,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/espressif/boards/hardkernel_odroid_go/board.c b/ports/espressif/boards/hardkernel_odroid_go/board.c index 609572977e..54ecd27ff3 100644 --- a/ports/espressif/boards/hardkernel_odroid_go/board.c +++ b/ports/espressif/boards/hardkernel_odroid_go/board.c @@ -63,11 +63,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO23, NULL, false); 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, @@ -78,7 +78,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/espressif/boards/hexky_s2/board.c b/ports/espressif/boards/hexky_s2/board.c index e4f8f48855..ef99a96e1d 100644 --- a/ports/espressif/boards/hexky_s2/board.c +++ b/ports/espressif/boards/hexky_s2/board.c @@ -72,7 +72,7 @@ uint8_t display_init_sequence[] = { void board_init(void) { busio_spi_obj_t *spi = common_hal_board_create_spi(0); - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct( @@ -85,7 +85,7 @@ void board_init(void) { 0, // polarity 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/hiibot_iots2/board.c b/ports/espressif/boards/hiibot_iots2/board.c index c9cf7afb92..87ee7d0b14 100644 --- a/ports/espressif/boards/hiibot_iots2/board.c +++ b/ports/espressif/boards/hiibot_iots2/board.c @@ -65,7 +65,8 @@ uint8_t display_init_sequence[] = { }; static void display_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct( spi, @@ -76,7 +77,6 @@ static void display_init(void) { 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( @@ -90,7 +90,7 @@ static void display_init(void) { 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/lilygo_tembed_esp32s3/board.c b/ports/espressif/boards/lilygo_tembed_esp32s3/board.c index ed49eb504c..03a86a48d4 100644 --- a/ports/espressif/boards/lilygo_tembed_esp32s3/board.c +++ b/ports/espressif/boards/lilygo_tembed_esp32s3/board.c @@ -43,11 +43,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO12, &pin_GPIO11, NULL, false); 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, @@ -58,7 +58,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c index 6c0a54c99c..7ba109dfce 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c @@ -65,7 +65,8 @@ uint8_t display_init_sequence[] = { }; static void display_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct( spi, @@ -76,7 +77,6 @@ static void display_init(void) { 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( @@ -90,7 +90,7 @@ static void display_init(void) { 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/lilygo_ttgo_tdisplay_esp32_16m/board.c b/ports/espressif/boards/lilygo_ttgo_tdisplay_esp32_16m/board.c index 630de0b63f..916f1d0a78 100644 --- a/ports/espressif/boards/lilygo_ttgo_tdisplay_esp32_16m/board.c +++ b/ports/espressif/boards/lilygo_ttgo_tdisplay_esp32_16m/board.c @@ -45,7 +45,8 @@ uint8_t display_init_sequence[] = { }; static void display_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct( spi, @@ -56,7 +57,6 @@ static void display_init(void) { 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( @@ -71,7 +71,7 @@ static void display_init(void) { 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/lilygo_twatch_2020_v3/board.c b/ports/espressif/boards/lilygo_twatch_2020_v3/board.c index 6a60ada6b0..de2b79b895 100644 --- a/ports/espressif/boards/lilygo_twatch_2020_v3/board.c +++ b/ports/espressif/boards/lilygo_twatch_2020_v3/board.c @@ -48,7 +48,8 @@ uint8_t display_init_sequence[] = { }; static void display_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct( spi, @@ -60,7 +61,6 @@ static void display_init(void) { 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( @@ -74,7 +74,7 @@ static void display_init(void) { 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/lolin_s2_pico/board.c b/ports/espressif/boards/lolin_s2_pico/board.c index e2c24bb22a..2f987799ad 100644 --- a/ports/espressif/boards/lolin_s2_pico/board.c +++ b/ports/espressif/boards/lolin_s2_pico/board.c @@ -54,7 +54,7 @@ uint8_t display_init_sequence[] = { // SSD1306 static void display_init(void) { busio_i2c_obj_t *i2c = common_hal_board_create_i2c(0); - displayio_i2cdisplay_obj_t *bus = &displays[0].i2cdisplay_bus; + displayio_i2cdisplay_obj_t *bus = &allocate_display_bus()->i2cdisplay_bus; bus->base.type = &displayio_i2cdisplay_type; common_hal_displayio_i2cdisplay_construct(bus, i2c, @@ -62,7 +62,7 @@ static void display_init(void) { &pin_GPIO18 // reset ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/espressif/boards/m5stack_core2/board.c b/ports/espressif/boards/m5stack_core2/board.c index a2565229ce..5080617df4 100644 --- a/ports/espressif/boards/m5stack_core2/board.c +++ b/ports/espressif/boards/m5stack_core2/board.c @@ -333,7 +333,7 @@ static bool pmic_init(busio_i2c_obj_t *i2c) { static bool display_init(void) { busio_spi_obj_t *spi = common_hal_board_create_spi(0); - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct( @@ -347,7 +347,7 @@ static bool display_init(void) { 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/m5stack_core_basic/board.c b/ports/espressif/boards/m5stack_core_basic/board.c index 2736bc758b..68eff30782 100644 --- a/ports/espressif/boards/m5stack_core_basic/board.c +++ b/ports/espressif/boards/m5stack_core_basic/board.c @@ -57,7 +57,7 @@ uint8_t display_init_sequence[] = { void board_init(void) { busio_spi_obj_t *spi = common_hal_board_create_spi(0); - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct( @@ -71,7 +71,7 @@ void board_init(void) { 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/m5stack_core_fire/board.c b/ports/espressif/boards/m5stack_core_fire/board.c index 2736bc758b..68eff30782 100755 --- a/ports/espressif/boards/m5stack_core_fire/board.c +++ b/ports/espressif/boards/m5stack_core_fire/board.c @@ -57,7 +57,7 @@ uint8_t display_init_sequence[] = { void board_init(void) { busio_spi_obj_t *spi = common_hal_board_create_spi(0); - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct( @@ -71,7 +71,7 @@ void board_init(void) { 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/m5stack_stick_c/board.c b/ports/espressif/boards/m5stack_stick_c/board.c index d25663895c..e6a0125fb4 100755 --- a/ports/espressif/boards/m5stack_stick_c/board.c +++ b/ports/espressif/boards/m5stack_stick_c/board.c @@ -165,11 +165,11 @@ static bool pmic_init(busio_i2c_obj_t *i2c) { } static bool display_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO13, &pin_GPIO15, NULL, false); 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( @@ -183,7 +183,7 @@ static bool display_init(void) { 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/espressif/boards/morpheans_morphesp-240/board.c b/ports/espressif/boards/morpheans_morphesp-240/board.c index 30e0a04aad..9491902161 100644 --- a/ports/espressif/boards/morpheans_morphesp-240/board.c +++ b/ports/espressif/boards/morpheans_morphesp-240/board.c @@ -147,7 +147,8 @@ void board_init(void) { // Display - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct( spi, @@ -158,7 +159,6 @@ void board_init(void) { 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( @@ -172,7 +172,7 @@ void board_init(void) { 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( display, diff --git a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/board.c b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/board.c index 359263df81..2898f675c8 100644 --- a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/board.c +++ b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/board.c @@ -64,7 +64,8 @@ uint8_t display_init_sequence[] = { }; static void display_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct( spi, @@ -75,7 +76,6 @@ static void display_init(void) { 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( @@ -89,7 +89,7 @@ static void display_init(void) { 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( diff --git a/ports/nrf/boards/clue_nrf52840_express/board.c b/ports/nrf/boards/clue_nrf52840_express/board.c index 92ea3fefeb..98ec033dc6 100644 --- a/ports/nrf/boards/clue_nrf52840_express/board.c +++ b/ports/nrf/boards/clue_nrf52840_express/board.c @@ -47,11 +47,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_P0_14, &pin_P0_15, NULL, false); 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, @@ -62,7 +62,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/nrf/boards/hiibot_bluefi/board.c b/ports/nrf/boards/hiibot_bluefi/board.c index e5fc4279f8..d2c9e732b2 100644 --- a/ports/nrf/boards/hiibot_bluefi/board.c +++ b/ports/nrf/boards/hiibot_bluefi/board.c @@ -47,11 +47,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_P0_07, &pin_P1_08, NULL, false); // SCK, MOSI, MISO, not half-duplex 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, @@ -63,7 +63,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c index ce4241c9da..1fea4b2b9f 100644 --- a/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c +++ b/ports/nrf/boards/makerdiary_nrf52840_m2_devkit/board.c @@ -48,11 +48,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_P0_11, &pin_P0_12, NULL, false); 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, @@ -63,7 +63,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/nrf/boards/ohs2020_badge/board.c b/ports/nrf/boards/ohs2020_badge/board.c index 30c066d91e..568357eacb 100644 --- a/ports/nrf/boards/ohs2020_badge/board.c +++ b/ports/nrf/boards/ohs2020_badge/board.c @@ -47,11 +47,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_P0_11, &pin_P0_12, NULL, false); 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, @@ -62,7 +62,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/board.c b/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/board.c index bcbab5e4cd..140a15cc04 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/board.c +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/board.c @@ -40,7 +40,7 @@ void board_init(void) { &pin_GPIO23, &pin_GPIO22, 8); - framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; + framebufferio_framebufferdisplay_obj_t *display = &allocate_display()->framebuffer_display; display->base.type = &framebufferio_framebufferdisplay_type; common_hal_framebufferio_framebufferdisplay_construct( display, diff --git a/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c b/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c index b5cef1639d..25d8dbe831 100644 --- a/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c +++ b/ports/raspberrypi/boards/adafruit_macropad_rp2040/board.c @@ -59,11 +59,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO26, &pin_GPIO27, NULL, false); 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, @@ -74,7 +74,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/raspberrypi/boards/hack_club_sprig/board.c b/ports/raspberrypi/boards/hack_club_sprig/board.c index 775e6ca5df..819d7943dc 100644 --- a/ports/raspberrypi/boards/hack_club_sprig/board.c +++ b/ports/raspberrypi/boards/hack_club_sprig/board.c @@ -78,11 +78,11 @@ uint8_t display_init_sequence[] = { void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO19, &pin_GPIO16, false); 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, @@ -93,7 +93,7 @@ void board_init(void) { 0, 0); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/raspberrypi/boards/pimoroni_badger2040/board.c b/ports/raspberrypi/boards/pimoroni_badger2040/board.c index 9eea472925..3331ee1e98 100644 --- a/ports/raspberrypi/boards/pimoroni_badger2040/board.c +++ b/ports/raspberrypi/boards/pimoroni_badger2040/board.c @@ -274,12 +274,12 @@ void board_init(void) { common_hal_digitalio_digitalinout_never_reset(&enable_pin_obj); // Set up the SPI object used to control the display - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO19, &pin_GPIO16, false); common_hal_busio_spi_never_reset(spi); // Set up the DisplayIO pin object - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, @@ -291,7 +291,7 @@ void board_init(void) { 0); // Phase // Set up the DisplayIO epaper object - displayio_epaperdisplay_obj_t *display = &displays[0].epaper_display; + displayio_epaperdisplay_obj_t *display = &allocate_display()->epaper_display; display->base.type = &displayio_epaperdisplay_type; common_hal_displayio_epaperdisplay_construct( display, @@ -329,10 +329,8 @@ void board_init(void) { void board_deinit(void) { displayio_epaperdisplay_obj_t *display = &displays[0].epaper_display; if (display->base.type == &displayio_epaperdisplay_type) { - size_t i = 0; while (common_hal_displayio_epaperdisplay_get_busy(display)) { RUN_BACKGROUND_TASKS; - i++; } } common_hal_displayio_release_displays(); diff --git a/ports/raspberrypi/boards/pimoroni_picosystem/board.c b/ports/raspberrypi/boards/pimoroni_picosystem/board.c index 600089f129..388c3f2417 100644 --- a/ports/raspberrypi/boards/pimoroni_picosystem/board.c +++ b/ports/raspberrypi/boards/pimoroni_picosystem/board.c @@ -64,11 +64,11 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO6, &pin_GPIO7, NULL, false); 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, @@ -79,7 +79,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, diff --git a/ports/raspberrypi/boards/waveshare_rp2040_lcd_0_96/board.c b/ports/raspberrypi/boards/waveshare_rp2040_lcd_0_96/board.c index afe3f87787..2c3ef18805 100644 --- a/ports/raspberrypi/boards/waveshare_rp2040_lcd_0_96/board.c +++ b/ports/raspberrypi/boards/waveshare_rp2040_lcd_0_96/board.c @@ -63,7 +63,8 @@ uint8_t display_init_sequence[] = { }; static void display_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct( spi, &pin_GPIO10, // CLK @@ -74,7 +75,6 @@ static void display_init(void) { 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( @@ -88,7 +88,7 @@ static void display_init(void) { 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( display, diff --git a/ports/stm/boards/meowbit_v121/board.c b/ports/stm/boards/meowbit_v121/board.c index 0edf3d40e4..2d67daf806 100644 --- a/ports/stm/boards/meowbit_v121/board.c +++ b/ports/stm/boards/meowbit_v121/board.c @@ -70,7 +70,7 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; busio_spi_obj_t *internal_spi = &supervisor_flash_spi_bus; common_hal_displayio_fourwire_construct(bus, @@ -82,7 +82,7 @@ void board_init(void) { 0, // Polarity 0); // Phase - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct(display, bus, From b16037859cfb22ef5c9b308938ac7512696d488a Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 21 Apr 2023 14:36:35 -0700 Subject: [PATCH 0903/1712] Fix native epd boards --- ports/atmel-samd/boards/openbook_m4/board.c | 3 ++- .../boards/adafruit_magtag_2.9_grayscale/board.c | 3 ++- ports/raspberrypi/boards/pimoroni_badger2040/board.c | 3 ++- shared-module/displayio/__init__.c | 8 ++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ports/atmel-samd/boards/openbook_m4/board.c b/ports/atmel-samd/boards/openbook_m4/board.c index 59c3bb4978..5867a279f4 100644 --- a/ports/atmel-samd/boards/openbook_m4/board.c +++ b/ports/atmel-samd/boards/openbook_m4/board.c @@ -106,7 +106,8 @@ void board_init(void) { false, // chip_select (don't always toggle chip select) false, // grayscale false, // acep - false); // two_byte_sequence_length + false, // two_byte_sequence_length + false); // address_little_endian } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c index 55c61a0912..da070688ed 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c @@ -167,7 +167,8 @@ void board_init(void) { false, // always_toggle_chip_select true, // grayscale false, // acep - false); // two_byte_sequence_length + false, // two_byte_sequence_length + false); // address_little_endian } bool espressif_board_reset_pin_number(gpio_num_t pin_number) { diff --git a/ports/raspberrypi/boards/pimoroni_badger2040/board.c b/ports/raspberrypi/boards/pimoroni_badger2040/board.c index 3331ee1e98..cd7cd3a194 100644 --- a/ports/raspberrypi/boards/pimoroni_badger2040/board.c +++ b/ports/raspberrypi/boards/pimoroni_badger2040/board.c @@ -323,7 +323,8 @@ void board_init(void) { false, // always_toggle_chip_select false, // grayscale false, // acep - false); // two_byte_sequence_length + false, // two_byte_sequence_length + false); // address_little_endian } void board_deinit(void) { diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index c47b19caea..e9431dee14 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -154,8 +154,8 @@ void common_hal_displayio_release_displays(void) { common_hal_videocore_framebuffer_deinit(&display_buses[i].videocore); #endif #if CIRCUITPY_PICODVI - } else if (displays[i].bus_base.type == &picodvi_framebuffer_type) { - common_hal_picodvi_framebuffer_deinit(&displays[i].picodvi); + } else if (bus_type == &picodvi_framebuffer_type) { + common_hal_picodvi_framebuffer_deinit(&display_buses[i].picodvi); #endif } display_buses[i].bus_base.type = &mp_type_NoneType; @@ -274,8 +274,8 @@ void reset_displays(void) { // need to be moved. #endif #if CIRCUITPY_PICODVI - } else if (displays[i].bus_base.type == &picodvi_framebuffer_type) { - picodvi_framebuffer_obj_t *vc = &displays[i].picodvi; + } else if (display_bus_type == &picodvi_framebuffer_type) { + picodvi_framebuffer_obj_t *vc = &display_buses[i].picodvi; if (!any_display_uses_this_framebuffer(&vc->base)) { common_hal_picodvi_framebuffer_deinit(vc); } From 031667ebd0bb3deb944962ea280aa2246b7103a6 Mon Sep 17 00:00:00 2001 From: George White Date: Fri, 21 Apr 2023 17:41:52 -0400 Subject: [PATCH 0904/1712] Added notes re the RTL8720D pins The Wio Terminal includes a RealTek RTL8720D as a companion to the main chip to provide WiFi and Bluetooth capabilities via eRPC over a UART connection. The WIO Terminal schematic labels some pins as the RXD/TXD for the UART, and that was captured in the board definition for CircuitPython. However, these pins may be used for logging in another mode, but they are not the main pins used to communicate with the RTL chip. The correct configuration is RX on PC24/pad 2 and TX on PB24/pad 0 of SERCOM 0. The comments on the pin definitions now reflect this situation, for anyone trying to get the WiFi/BLE to work on the Wio Terminal. --- ports/atmel-samd/boards/seeeduino_wio_terminal/pins.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/atmel-samd/boards/seeeduino_wio_terminal/pins.c b/ports/atmel-samd/boards/seeeduino_wio_terminal/pins.c index 0ff0f7b1ba..90daa8df00 100644 --- a/ports/atmel-samd/boards/seeeduino_wio_terminal/pins.c +++ b/ports/atmel-samd/boards/seeeduino_wio_terminal/pins.c @@ -95,13 +95,13 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_I2S_SDIN), MP_ROM_PTR(&pin_PA22) }, { MP_OBJ_NEW_QSTR(MP_QSTR_I2S_BCLK), MP_ROM_PTR(&pin_PB16) }, - // RTL8720D + // RTL8720D - follows the schematic, but see comments { MP_OBJ_NEW_QSTR(MP_QSTR_RTL_PWR), MP_ROM_PTR(&pin_PA18) }, // CHIP_PU - { MP_OBJ_NEW_QSTR(MP_QSTR_RTL_RXD), MP_ROM_PTR(&pin_PC22) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_RTL_TXD), MP_ROM_PTR(&pin_PC23) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_RTL_MOSI), MP_ROM_PTR(&pin_PB24) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RTL_RXD), MP_ROM_PTR(&pin_PC22) }, // *NOT* THE MAIN RX FOR THE RTL CHIP (may be a log UART?) + { MP_OBJ_NEW_QSTR(MP_QSTR_RTL_TXD), MP_ROM_PTR(&pin_PC23) }, // *NOT* THE MAIN TX FOR THE RTL CHIP (may be a log UART?) + { MP_OBJ_NEW_QSTR(MP_QSTR_RTL_MOSI), MP_ROM_PTR(&pin_PB24) }, // used as the UART TX for the RTL chip { MP_OBJ_NEW_QSTR(MP_QSTR_RTL_CLK), MP_ROM_PTR(&pin_PB25) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_RTL_MISO), MP_ROM_PTR(&pin_PC24) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RTL_MISO), MP_ROM_PTR(&pin_PC24) }, // used as the UART RX for the RTL chip { MP_OBJ_NEW_QSTR(MP_QSTR_RTL_CS), MP_ROM_PTR(&pin_PC25) }, { MP_OBJ_NEW_QSTR(MP_QSTR_RTL_READY), MP_ROM_PTR(&pin_PC20) }, // IRQ0 { MP_OBJ_NEW_QSTR(MP_QSTR_RTL_DIR), MP_ROM_PTR(&pin_PA19) }, // SYNC From 01197a96d15141b35093daf1f844f685a60b2a4a Mon Sep 17 00:00:00 2001 From: foamyguy Date: Fri, 21 Apr 2023 16:54:46 -0500 Subject: [PATCH 0905/1712] remove abs() from radius --- shared-module/vectorio/Circle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-module/vectorio/Circle.c b/shared-module/vectorio/Circle.c index ee83ad18b9..4f89e46163 100644 --- a/shared-module/vectorio/Circle.c +++ b/shared-module/vectorio/Circle.c @@ -23,7 +23,7 @@ void common_hal_vectorio_circle_set_on_dirty(vectorio_circle_t *self, vectorio_e uint32_t common_hal_vectorio_circle_get_pixel(void *obj, int16_t x, int16_t y) { vectorio_circle_t *self = obj; - int16_t radius = abs(self->radius); + int16_t radius = self->radius; x = abs(x); y = abs(y); if (x + y <= radius) { From 56fd7dcf0adf76eb838d2d76d3ba312f1d12e3d3 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Fri, 21 Apr 2023 18:00:16 -0500 Subject: [PATCH 0906/1712] add minimum validation for tilegrid size in terminalio.Terminal --- shared-bindings/terminalio/Terminal.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shared-bindings/terminalio/Terminal.c b/shared-bindings/terminalio/Terminal.c index 46e171ff7e..164999093a 100644 --- a/shared-bindings/terminalio/Terminal.c +++ b/shared-bindings/terminalio/Terminal.c @@ -85,6 +85,9 @@ STATIC mp_obj_t terminalio_terminal_make_new(const mp_obj_type_t *type, size_t n fontio_builtinfont_t *font = mp_arg_validate_type(args[ARG_font].u_obj, &fontio_builtinfont_type, MP_QSTR_font); + mp_arg_validate_int_min(scroll_area->width_in_tiles, 2, MP_QSTR_scroll_area_width); + mp_arg_validate_int_min(scroll_area->height_in_tiles, 2, MP_QSTR_scroll_area_height); + terminalio_terminal_obj_t *self = m_new_obj(terminalio_terminal_obj_t); self->base.type = &terminalio_terminal_type; From b59f0e17be471c5828287d3f136b8d9b92bdc85c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 21 Apr 2023 15:59:11 -0700 Subject: [PATCH 0907/1712] Fix RP2040 idle Don't idle from main if we scheduled an interrupt for 0 ticks in the future. Have RP2040 detect wakes that happen between setting the timer and the idle call. Fixes #7361 --- main.c | 10 ++++++++-- ports/raspberrypi/supervisor/port.c | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 9351d90529..ae8c339172 100644 --- a/main.c +++ b/main.c @@ -716,9 +716,15 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) { // time_to_next_change is in ms and ticks are slightly shorter so // we'll undersleep just a little. It shouldn't matter. - port_interrupt_after_ticks(time_to_next_change); - #endif + if (time_to_next_change > 0) { + port_interrupt_after_ticks(time_to_next_change); + port_idle_until_interrupt(); + } + #else + // No status LED can we sleep until we are interrupted by some + // interaction. port_idle_until_interrupt(); + #endif } } diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index 2ee3a1ee98..e45fa8837a 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -257,6 +257,7 @@ uint32_t port_get_saved_word(void) { } static volatile bool ticks_enabled; +static volatile bool _woken_up; uint64_t port_get_raw_ticks(uint8_t *subticks) { uint64_t microseconds = time_us_64(); @@ -268,6 +269,7 @@ STATIC void _tick_callback(uint alarm_num) { supervisor_tick(); hardware_alarm_set_target(0, delayed_by_us(get_absolute_time(), 977)); } + _woken_up = true; } // Enable 1/1024 second tick. @@ -291,11 +293,12 @@ void port_interrupt_after_ticks(uint32_t ticks) { if (!ticks_enabled) { hardware_alarm_set_target(0, delayed_by_us(get_absolute_time(), ticks * 977)); } + _woken_up = false; } void port_idle_until_interrupt(void) { common_hal_mcu_disable_interrupts(); - if (!background_callback_pending() && !tud_task_event_ready()) { + if (!background_callback_pending() && !tud_task_event_ready() && !_woken_up) { __DSB(); __WFI(); } From 73fde93218ddfcb7238c7ea538f05d68a5ddb27a Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 21 Apr 2023 06:45:05 +0000 Subject: [PATCH 0908/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (999 of 999 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 5d02126604..c31b7e0134 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: 2023-04-07 00:49+0000\n" +"PO-Revision-Date: 2023-04-22 06:48+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "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.17-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1330,7 +1330,7 @@ msgstr "Tamanho do pedaço de formato inválido" #: shared-bindings/wifi/Radio.c msgid "Invalid hex password" -msgstr "" +msgstr "Senha hexadecimal inválida" #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" From 964a94929a1bec1f25253787bf904406b5936e40 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Thu, 20 Apr 2023 22:11:28 +0000 Subject: [PATCH 0909/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (999 of 999 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 909c8a624f..c5dece498d 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-04-07 00:49+0000\n" +"PO-Revision-Date: 2023-04-22 06:48+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "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.17-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1315,7 +1315,7 @@ msgstr "Ogiltig formatsegmentstorlek" #: shared-bindings/wifi/Radio.c msgid "Invalid hex password" -msgstr "" +msgstr "Ogiltigt hex-lösenord" #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" From 14b69d750f7ec60984069a42d92dfe504eac5d48 Mon Sep 17 00:00:00 2001 From: Andi Chandler Date: Thu, 20 Apr 2023 20:20:28 +0000 Subject: [PATCH 0910/1712] Translated using Weblate (English (United Kingdom)) Currently translated at 100.0% (999 of 999 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/en_GB/ --- locale/en_GB.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/en_GB.po b/locale/en_GB.po index 06ad558ee1..4452427b1a 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-04-16 13:51+0000\n" +"PO-Revision-Date: 2023-04-22 06:48+0000\n" "Last-Translator: Andi Chandler \n" "Language-Team: none\n" "Language: en_GB\n" @@ -15,7 +15,7 @@ msgstr "" "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.17-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1309,7 +1309,7 @@ msgstr "Invalid format chunk size" #: shared-bindings/wifi/Radio.c msgid "Invalid hex password" -msgstr "" +msgstr "Invalid hex password" #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" From a6545d6341c92201376a973f2e8e74815b76127e Mon Sep 17 00:00:00 2001 From: Jose David M Date: Sat, 22 Apr 2023 15:48:28 +0000 Subject: [PATCH 0911/1712] Translated using Weblate (Spanish) Currently translated at 100.0% (999 of 999 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/es.po b/locale/es.po index f0604b74f4..c9ba32682f 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-04-07 00:49+0000\n" +"PO-Revision-Date: 2023-04-22 15:51+0000\n" "Last-Translator: Jose David M \n" "Language-Team: \n" "Language: es\n" @@ -16,7 +16,7 @@ msgstr "" "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.17-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1334,7 +1334,7 @@ msgstr "Formato de fragmento de formato no válido" #: shared-bindings/wifi/Radio.c msgid "Invalid hex password" -msgstr "" +msgstr "Contraseña hexadecimal no válida" #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" From ccbb6a58fbefbb552098c11b81fd4886290c9975 Mon Sep 17 00:00:00 2001 From: Ted Hess Date: Sat, 22 Apr 2023 13:09:18 -0400 Subject: [PATCH 0912/1712] Fix web-editor debug on non-standard port using localhost (CORS) --- supervisor/shared/web_workflow/web_workflow.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index 94732cf52c..648af72ccb 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -478,8 +478,12 @@ static bool _origin_ok(_request *request) { return true; } // DEBUG: OK if origin is 'localhost' (ignoring port #) - *strchrnul(&request->origin[PREFIX_HTTP_LEN], ':') = '\0'; + char *cptr = strchrnul(&request->origin[PREFIX_HTTP_LEN], ':'); + char csave = *cptr; // NULL or colon + *cptr = '\0'; if (strcmp(&request->origin[PREFIX_HTTP_LEN], "localhost") == 0) { + // Restore removed colon if non-null host terminator + *cptr = csave; return true; } } From b0ea28a031e85d1497793da3bd777933d036a282 Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Sun, 23 Apr 2023 00:33:14 -0400 Subject: [PATCH 0913/1712] Doc fix for root_group=None behaviour --- shared-bindings/displayio/Display.c | 2 +- shared-bindings/displayio/EPaperDisplay.c | 2 +- shared-bindings/framebufferio/FramebufferDisplay.c | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 49194ebd1e..29bca28c3f 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -426,7 +426,7 @@ MP_PROPERTY_GETTER(displayio_display_bus_obj, //| root_group: Group //| """The root group on the display. -//| If the root group is set to ``None``, the default CircuitPython terminal will be shown. +//| If the root group is set to ``None``, no output will be shown. //| """ STATIC mp_obj_t displayio_display_obj_get_root_group(mp_obj_t self_in) { displayio_display_obj_t *self = native_display(self_in); diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 93d91110a2..8c753de19b 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -384,7 +384,7 @@ MP_PROPERTY_GETTER(displayio_epaperdisplay_bus_obj, //| root_group: Group //| """The root group on the epaper display. -//| If the root group is set to ``None``, the default CircuitPython terminal will be shown. +//| If the root group is set to ``None``, no output will be shown. //| """ //| STATIC mp_obj_t displayio_epaperdisplay_obj_get_root_group(mp_obj_t self_in) { diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index 030b924c1e..7f27d3851c 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -323,8 +323,9 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row(size_t n_args, con MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_fill_row_obj, 1, framebufferio_framebufferdisplay_obj_fill_row); //| root_group: displayio.Group -//| """The root group on the display.""" -//| +//| """The root group on the display. +//| If the root group is set to ``None``, no output will be shown. +//| """ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_root_group(mp_obj_t self_in) { framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); return common_hal_framebufferio_framebufferdisplay_get_root_group(self); From b2b24231bc68d199e36676c3ff77df36604fa296 Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Sun, 23 Apr 2023 00:45:38 -0400 Subject: [PATCH 0914/1712] local pre-commit changes --- shared-bindings/framebufferio/FramebufferDisplay.c | 1 + shared-bindings/socketpool/SocketPool.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index 7f27d3851c..eb49f311b7 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -326,6 +326,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_fill_row_obj, 1, fra //| """The root group on the display. //| If the root group is set to ``None``, no output will be shown. //| """ +//| STATIC mp_obj_t framebufferio_framebufferdisplay_obj_get_root_group(mp_obj_t self_in) { framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); return common_hal_framebufferio_framebufferdisplay_get_root_group(self); diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index 3023721378..f056c741f3 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -52,7 +52,6 @@ //| returned by :py:attr:`wifi.radio` //| """ //| ... -//| STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); From 0c00220aa633dbc8e38ebedd6b06140c45e10589 Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Sun, 23 Apr 2023 00:52:48 -0400 Subject: [PATCH 0915/1712] Removing unrelated change by local pre-commit --- shared-bindings/socketpool/SocketPool.c | 1 + 1 file changed, 1 insertion(+) diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index f056c741f3..3023721378 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -52,6 +52,7 @@ //| returned by :py:attr:`wifi.radio` //| """ //| ... +//| STATIC mp_obj_t socketpool_socketpool_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); From 3cf712556b363fc2ce0f316152eaf4ba4400f04f Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Sun, 23 Apr 2023 01:03:13 -0400 Subject: [PATCH 0916/1712] Add CIRCUITPYTHON_TERMINAL usage description --- shared-bindings/displayio/Display.c | 1 + shared-bindings/displayio/EPaperDisplay.c | 1 + shared-bindings/framebufferio/FramebufferDisplay.c | 1 + 3 files changed, 3 insertions(+) diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 29bca28c3f..381924e0ab 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -426,6 +426,7 @@ MP_PROPERTY_GETTER(displayio_display_bus_obj, //| root_group: Group //| """The root group on the display. +//| If the root group is set to displayio.CIRCUITPYTHON_TERMINAL, the default CircuitPython terminal will be shown. //| If the root group is set to ``None``, no output will be shown. //| """ STATIC mp_obj_t displayio_display_obj_get_root_group(mp_obj_t self_in) { diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 8c753de19b..8df3b31de9 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -384,6 +384,7 @@ MP_PROPERTY_GETTER(displayio_epaperdisplay_bus_obj, //| root_group: Group //| """The root group on the epaper display. +//| If the root group is set to displayio.CIRCUITPYTHON_TERMINAL, the default CircuitPython terminal will be shown. //| If the root group is set to ``None``, no output will be shown. //| """ //| diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index eb49f311b7..806d9957b4 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -324,6 +324,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_fill_row_obj, 1, fra //| root_group: displayio.Group //| """The root group on the display. +//| If the root group is set to displayio.CIRCUITPYTHON_TERMINAL, the default CircuitPython terminal will be shown. //| If the root group is set to ``None``, no output will be shown. //| """ //| From 6aa3e7d8a6881df241240983f19cb06d05b52929 Mon Sep 17 00:00:00 2001 From: David Glaude Date: Sun, 23 Apr 2023 10:58:02 +0200 Subject: [PATCH 0917/1712] This is about picodvi not rgbmatrix There might be another way or other place where the documentation does not match the code. But this is the most obvious, that's why I found it. --- ports/raspberrypi/bindings/picodvi/Framebuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/bindings/picodvi/Framebuffer.c b/ports/raspberrypi/bindings/picodvi/Framebuffer.c index 12482c3baa..67d6a286dd 100644 --- a/ports/raspberrypi/bindings/picodvi/Framebuffer.c +++ b/ports/raspberrypi/bindings/picodvi/Framebuffer.c @@ -142,7 +142,7 @@ STATIC mp_obj_t picodvi_framebuffer_make_new(const mp_obj_type_t *type, size_t n //| def deinit(self) -> None: //| """Free the resources (pins, timers, etc.) associated with this -//| rgbmatrix instance. After deinitialization, no further operations +//| picodvi instance. After deinitialization, no further operations //| may be performed.""" //| ... STATIC mp_obj_t picodvi_framebuffer_deinit(mp_obj_t self_in) { From 8e3c28e97dcca5795d9b7834f812841ec9e9a300 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 14 Apr 2023 13:43:24 -0500 Subject: [PATCH 0918/1712] Fix `memoryview.cast` in micropython-coverage `locals_dict` and `attr` are incompatible, so just use circuitpython-style properties so that a property and a method are both available. this makes no difference in circuitpython, where `MICROPY_PY_BUILTINS_MEMORYVIEW_ITEMSIZE` is never enabled --- py/objarray.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/py/objarray.c b/py/objarray.c index 763ec15cdb..518c3aba52 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -31,6 +31,7 @@ #include "py/runtime.h" #include "py/binary.h" +#include "py/objproperty.h" #include "py/objstr.h" #include "py/objarray.h" @@ -270,15 +271,13 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(memoryview_cast_obj, memoryview_cast); #endif #if MICROPY_PY_BUILTINS_MEMORYVIEW_ITEMSIZE -STATIC void memoryview_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { - if (dest[0] != MP_OBJ_NULL) { - return; - } - if (attr == MP_QSTR_itemsize) { - mp_obj_array_t *self = MP_OBJ_TO_PTR(self_in); - dest[0] = MP_OBJ_NEW_SMALL_INT(mp_binary_get_size('@', self->typecode & TYPECODE_MASK, NULL)); - } +STATIC mp_obj_t memoryview_itemsize_get(mp_obj_t self_in) { + mp_obj_array_t *self = MP_OBJ_TO_PTR(self_in); + return MP_OBJ_NEW_SMALL_INT(mp_binary_get_size('@', self->typecode & TYPECODE_MASK, NULL)); } +MP_DEFINE_CONST_FUN_OBJ_1(memoryview_itemsize_get_obj, memoryview_itemsize_get); + +MP_PROPERTY_GETTER(memoryview_itemsize_obj, (mp_obj_t)&memoryview_itemsize_get_obj); #endif #endif @@ -785,9 +784,14 @@ const mp_obj_type_t mp_type_bytearray = { #if MICROPY_PY_BUILTINS_MEMORYVIEW -#if MICROPY_CPYTHON_COMPAT +#if MICROPY_CPYTHON_COMPAT || MICROPY_PY_BUILTINS_MEMORYVIEW_ITEMSIZE STATIC const mp_rom_map_elem_t memoryview_locals_dict_table[] = { + #if MICROPY_CPYTHON_COMPAT { MP_ROM_QSTR(MP_QSTR_cast), MP_ROM_PTR(&memoryview_cast_obj) }, + #endif + #if MICROPY_PY_BUILTINS_MEMORYVIEW_ITEMSIZE + { MP_ROM_QSTR(MP_QSTR_itemsize), MP_ROM_PTR(&memoryview_itemsize_obj) }, + #endif }; STATIC MP_DEFINE_CONST_DICT(memoryview_locals_dict, memoryview_locals_dict_table); @@ -798,12 +802,9 @@ const mp_obj_type_t mp_type_memoryview = { .flags = MP_TYPE_FLAG_EQ_CHECKS_OTHER_TYPE | MP_TYPE_FLAG_EXTENDED, .name = MP_QSTR_memoryview, .make_new = memoryview_make_new, - #if MICROPY_CPYTHON_COMPAT + #if MICROPY_CPYTHON_COMPAT || MICROPY_PY_BUILTINS_MEMORYVIEW_ITEMSIZE .locals_dict = (mp_obj_dict_t *)&memoryview_locals_dict, #endif - #if MICROPY_PY_BUILTINS_MEMORYVIEW_ITEMSIZE - .attr = memoryview_attr, - #endif MP_TYPE_EXTENDED_FIELDS( .getiter = array_iterator_new, .unary_op = array_unary_op, From 738f626663745fa55c812159ab76f4ffb13d430a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 24 Apr 2023 12:54:37 -0400 Subject: [PATCH 0919/1712] Code formatting in doc --- shared-bindings/displayio/Display.c | 2 +- shared-bindings/displayio/EPaperDisplay.c | 2 +- shared-bindings/framebufferio/FramebufferDisplay.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 381924e0ab..451f2c770e 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -426,7 +426,7 @@ MP_PROPERTY_GETTER(displayio_display_bus_obj, //| root_group: Group //| """The root group on the display. -//| If the root group is set to displayio.CIRCUITPYTHON_TERMINAL, the default CircuitPython terminal will be shown. +//| If the root group is set to `displayio.CIRCUITPYTHON_TERMINAL`, the default CircuitPython terminal will be shown. //| If the root group is set to ``None``, no output will be shown. //| """ STATIC mp_obj_t displayio_display_obj_get_root_group(mp_obj_t self_in) { diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index 8df3b31de9..0df2311b36 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -384,7 +384,7 @@ MP_PROPERTY_GETTER(displayio_epaperdisplay_bus_obj, //| root_group: Group //| """The root group on the epaper display. -//| If the root group is set to displayio.CIRCUITPYTHON_TERMINAL, the default CircuitPython terminal will be shown. +//| If the root group is set to `displayio.CIRCUITPYTHON_TERMINAL`, the default CircuitPython terminal will be shown. //| If the root group is set to ``None``, no output will be shown. //| """ //| diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index 806d9957b4..b80b57b435 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -324,7 +324,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_fill_row_obj, 1, fra //| root_group: displayio.Group //| """The root group on the display. -//| If the root group is set to displayio.CIRCUITPYTHON_TERMINAL, the default CircuitPython terminal will be shown. +//| If the root group is set to `displayio.CIRCUITPYTHON_TERMINAL`, the default CircuitPython terminal will be shown. //| If the root group is set to ``None``, no output will be shown. //| """ //| From b9c7cd40281caaf830af3c7ae981a5b37b047f9a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 24 Apr 2023 12:58:40 -0400 Subject: [PATCH 0920/1712] describe instance more precisely --- ports/raspberrypi/bindings/picodvi/Framebuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/bindings/picodvi/Framebuffer.c b/ports/raspberrypi/bindings/picodvi/Framebuffer.c index 67d6a286dd..e4584370af 100644 --- a/ports/raspberrypi/bindings/picodvi/Framebuffer.c +++ b/ports/raspberrypi/bindings/picodvi/Framebuffer.c @@ -142,7 +142,7 @@ STATIC mp_obj_t picodvi_framebuffer_make_new(const mp_obj_type_t *type, size_t n //| def deinit(self) -> None: //| """Free the resources (pins, timers, etc.) associated with this -//| picodvi instance. After deinitialization, no further operations +//| `picodvi.Framebuffer` instance. After deinitialization, no further operations //| may be performed.""" //| ... STATIC mp_obj_t picodvi_framebuffer_deinit(mp_obj_t self_in) { From ac82f8f90b27838b610fe57a4a1295729499e8cd Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 24 Apr 2023 13:43:09 -0400 Subject: [PATCH 0921/1712] document displayio.CIRCUITPYTHON_TERMINAL --- shared-bindings/displayio/__init__.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared-bindings/displayio/__init__.c b/shared-bindings/displayio/__init__.c index 77dc8aecee..6b4dc6d895 100644 --- a/shared-bindings/displayio/__init__.c +++ b/shared-bindings/displayio/__init__.c @@ -57,6 +57,10 @@ //| `_. //| """ +//| CIRCUITPYTHON_TERMINAL: Group +//| """The `displayio.Group` that is the displayed serial terminal (REPL).""" +//| + //| import paralleldisplay //| From 87fc5eff267e1e29b8b8cafee6cf4dc7076415ea Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 24 Apr 2023 16:24:33 -0700 Subject: [PATCH 0922/1712] Re-enable partial updates when available --- shared-module/displayio/EPaperDisplay.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared-module/displayio/EPaperDisplay.c b/shared-module/displayio/EPaperDisplay.c index 2f6c8fa5c9..e79c692766 100644 --- a/shared-module/displayio/EPaperDisplay.c +++ b/shared-module/displayio/EPaperDisplay.c @@ -139,7 +139,8 @@ STATIC const displayio_area_t *displayio_epaperdisplay_get_refresh_areas(display if (self->core.current_group != NULL) { first_area = displayio_group_get_refresh_areas(self->core.current_group, NULL); } - if (first_area != NULL) { + if (first_area != NULL && self->core.row_command == NO_COMMAND) { + // Do a full refresh if the display doesn't support partial updates. self->core.area.next = NULL; return &self->core.area; } From c4104898cec82bee66ac513322f44b67663e4980 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 23 Apr 2023 09:43:25 -0500 Subject: [PATCH 0923/1712] add additional float validators --- py/argcheck.c | 15 +++++++++++++++ py/runtime.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/py/argcheck.c b/py/argcheck.c index 465a82c97e..b530d44caa 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -186,6 +186,21 @@ mp_int_t mp_arg_validate_int_range(mp_int_t i, mp_int_t min, mp_int_t max, qstr return i; } +mp_float_t mp_arg_validate_type_float(mp_obj_t obj, qstr arg_name) { + mp_float_t a_float; + if (!mp_obj_get_float_maybe(obj, &a_float)) { + mp_raise_TypeError_varg(translate("%q must be of type %q, not %q"), arg_name, MP_QSTR_float, mp_obj_get_type(obj)->name); + } + return a_float; +} + +void mp_arg_validate_obj_float_range(mp_obj_t float_in, mp_int_t min, mp_int_t max, qstr arg_name) { + const mp_float_t f = mp_arg_validate_type_float(float_in, arg_name); + if (f < (mp_float_t)min || f > (mp_float_t)max) { + mp_raise_ValueError_varg(translate("%q must be %d-%d"), arg_name, min, max); + } +} + mp_float_t mp_arg_validate_obj_float_non_negative(mp_obj_t float_in, mp_float_t default_for_null, qstr arg_name) { const mp_float_t f = (float_in == MP_OBJ_NULL) ? default_for_null diff --git a/py/runtime.h b/py/runtime.h index d154772508..f7b96a27ae 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -103,6 +103,8 @@ mp_int_t mp_arg_validate_int_max(mp_int_t i, mp_int_t j, qstr arg_name); mp_int_t mp_arg_validate_int_range(mp_int_t i, mp_int_t min, mp_int_t max, qstr arg_name); #if MICROPY_PY_BUILTINS_FLOAT mp_float_t mp_arg_validate_obj_float_non_negative(mp_obj_t float_in, mp_float_t default_for_null, qstr arg_name); +void mp_arg_validate_obj_float_range(mp_obj_t float_in, mp_int_t min, mp_int_t max, qstr arg_name); +mp_float_t mp_arg_validate_type_float(mp_obj_t obj, qstr arg_name); #endif mp_uint_t mp_arg_validate_length_min(mp_uint_t length, mp_uint_t min, qstr arg_name); mp_uint_t mp_arg_validate_length_max(mp_uint_t length, mp_uint_t max, qstr arg_name); From ca6ea83ff5a25422028ebe11c2527af4b7f328d2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 23 Apr 2023 09:28:34 -0500 Subject: [PATCH 0924/1712] Fix `non_negative` validator to allow 0.0 --- py/argcheck.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/py/argcheck.c b/py/argcheck.c index b530d44caa..265b303901 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -204,8 +204,8 @@ void mp_arg_validate_obj_float_range(mp_obj_t float_in, mp_int_t min, mp_int_t m mp_float_t mp_arg_validate_obj_float_non_negative(mp_obj_t float_in, mp_float_t default_for_null, qstr arg_name) { const mp_float_t f = (float_in == MP_OBJ_NULL) ? default_for_null - : mp_obj_get_float(float_in); - if (f <= (mp_float_t)0.0) { + : mp_arg_validate_type_float(float_in, arg_name); + if (f < (mp_float_t)0.0) { mp_raise_ValueError_varg(translate("%q must be >= %d"), arg_name, 0); } return f; From 361608119c1ee47e7a055a22096bb0011f3299ac Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Tue, 25 Apr 2023 10:33:13 -0400 Subject: [PATCH 0925/1712] Change VID/PID to be Raspberry Pi values Spotted the Cosmo_pico port on circuitpython.org which is the same class of device as the Pimoroni PICO dv so I'm switching the VID/PID to use the Raspberry Pi owned values rather than the Adafruit values just as the Como device uses. --- ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk index 20607d50e4..e4eb325fc1 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk +++ b/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk @@ -1,6 +1,6 @@ -USB_VID = 0x239A -USB_PID = 0x80F4 -USB_PRODUCT = "Pico" +USB_VID = 0x2E8A +USB_PID = 0x104C +USB_PRODUCT = "Pimoroni PICO dv" USB_MANUFACTURER = "Raspberry Pi" CHIP_VARIANT = RP2040 From 076cd1fab4279b444f555887718937a902e036da Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Tue, 25 Apr 2023 11:14:48 -0400 Subject: [PATCH 0926/1712] Nope, can't use the COSMO-pico vid/pid pair Setting back, at least temporarily to the Adafruit pair. --- ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk index e4eb325fc1..f78d88add3 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk +++ b/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk @@ -1,5 +1,5 @@ -USB_VID = 0x2E8A -USB_PID = 0x104C +USB_VID = 0x239A +USB_PID = 0x80F4 USB_PRODUCT = "Pimoroni PICO dv" USB_MANUFACTURER = "Raspberry Pi" From 2bee4926f9957f00c33ff8de3447346565ef5669 Mon Sep 17 00:00:00 2001 From: Neradoc Date: Tue, 25 Apr 2023 17:22:04 +0200 Subject: [PATCH 0927/1712] Fix Scorpio on-board neopixel pin --- .../boards/adafruit_feather_rp2040_scorpio/mpconfigboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_scorpio/mpconfigboard.h b/ports/raspberrypi/boards/adafruit_feather_rp2040_scorpio/mpconfigboard.h index 94b6fcee7b..d9cec8d50a 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_scorpio/mpconfigboard.h +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_scorpio/mpconfigboard.h @@ -1,7 +1,7 @@ #define MICROPY_HW_BOARD_NAME "Adafruit Feather RP2040 Scorpio" #define MICROPY_HW_MCU_NAME "rp2040" -#define MICROPY_HW_NEOPIXEL (&pin_GPIO16) +#define MICROPY_HW_NEOPIXEL (&pin_GPIO4) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO3) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) From 375a9cd4c500ff7bf04ca426e51a53148477bfea Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 17 Apr 2023 10:59:54 -0500 Subject: [PATCH 0928/1712] add Synthesizer.release --- shared-bindings/synthio/Synthesizer.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index 56ad0d76cd..4a4256b5ac 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -92,7 +92,20 @@ STATIC mp_obj_t synthio_synthesizer_press(mp_obj_t self_in, mp_obj_t press) { return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_press_obj, synthio_synthesizer_press); -// +//| def release(self, /, release: Sequence[int] = ()) -> None: +//| """Turn some notes off. Notes use MIDI numbering, with 60 being middle C, approximately 262Hz. +//| +//| Releasing a note that was already released has no effect. +//| +//| :param Sequence[int] release: Any sequence of integer notes.""" +STATIC mp_obj_t synthio_synthesizer_release(mp_obj_t self_in, mp_obj_t release) { + synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + common_hal_synthio_synthesizer_release(self, release); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_release_obj, synthio_synthesizer_release); + //| def release_then_press( //| self, release: Sequence[int] = (), press: Sequence[int] = () //| ) -> None: @@ -210,6 +223,7 @@ MP_PROPERTY_GETTER(synthio_synthesizer_pressed_obj, STATIC const mp_rom_map_elem_t synthio_synthesizer_locals_dict_table[] = { // Methods { MP_ROM_QSTR(MP_QSTR_press), MP_ROM_PTR(&synthio_synthesizer_press_obj) }, + { MP_ROM_QSTR(MP_QSTR_release), MP_ROM_PTR(&synthio_synthesizer_release_obj) }, { MP_ROM_QSTR(MP_QSTR_release_all), MP_ROM_PTR(&synthio_synthesizer_release_all_obj) }, { MP_ROM_QSTR(MP_QSTR_release_then_press), MP_ROM_PTR(&synthio_synthesizer_release_then_press_obj) }, { MP_ROM_QSTR(MP_QSTR_release_all_then_press), MP_ROM_PTR(&synthio_synthesizer_release_all_then_press_obj) }, From 12c1a72f03209837e894d081eabaab3e975413eb Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 12 Apr 2023 20:26:46 -0500 Subject: [PATCH 0929/1712] synthio: implement envelope This works for me (tested playing midi to raw files on host computer, as well as a variant of the nunchuk instrument on pygamer) it has to re-factor how/when MIDI reading occurs, because reasons. endorse new test results .. and allow `-1` to specify a note with no sustain (plucked) --- shared-bindings/audiocore/__init__.c | 18 ++- shared-bindings/synthio/MidiTrack.c | 11 +- shared-bindings/synthio/MidiTrack.h | 8 +- shared-bindings/synthio/Synthesizer.c | 44 +++++- shared-bindings/synthio/Synthesizer.h | 4 +- shared-bindings/synthio/__init__.c | 111 ++++++++++++- shared-bindings/synthio/__init__.h | 6 + shared-module/synthio/MidiTrack.c | 167 +++++++++---------- shared-module/synthio/MidiTrack.h | 7 +- shared-module/synthio/Synthesizer.c | 33 ++-- shared-module/synthio/__init__.c | 211 +++++++++++++++++++++---- shared-module/synthio/__init__.h | 33 +++- tests/circuitpython/miditrack.py | 6 +- tests/circuitpython/miditrack.py.exp | 4 +- tests/circuitpython/synthesizer.py | 16 +- tests/circuitpython/synthesizer.py.exp | 32 +++- 16 files changed, 535 insertions(+), 176 deletions(-) diff --git a/shared-bindings/audiocore/__init__.c b/shared-bindings/audiocore/__init__.c index 6f32979099..3ecd7391b6 100644 --- a/shared-bindings/audiocore/__init__.c +++ b/shared-bindings/audiocore/__init__.c @@ -27,6 +27,7 @@ #include #include "py/obj.h" +#include "py/gc.h" #include "py/runtime.h" #include "shared-bindings/audiocore/__init__.h" @@ -46,8 +47,23 @@ STATIC mp_obj_t audiocore_get_buffer(mp_obj_t sample_in) { mp_obj_t result[2] = {mp_obj_new_int_from_uint(gbr), mp_const_none}; if (gbr != GET_BUFFER_ERROR) { + bool single_buffer, samples_signed; + uint32_t max_buffer_length; + uint8_t spacing; + + uint8_t bits_per_sample = audiosample_bits_per_sample(sample_in); + audiosample_get_buffer_structure(sample_in, false, &single_buffer, &samples_signed, &max_buffer_length, &spacing); // copies the data because the gc semantics of get_buffer are unclear - result[1] = mp_obj_new_bytes(buffer, buffer_length); + void *result_buf = gc_alloc(buffer_length, 0, false); + memcpy(result_buf, buffer, buffer_length); + char typecode = + (bits_per_sample == 8 && samples_signed) ? 'b' : + (bits_per_sample == 8 && !samples_signed) ? 'B' : + (bits_per_sample == 16 && samples_signed) ? 'h' : + (bits_per_sample == 16 && !samples_signed) ? 'H' : + 'b'; + size_t nitems = buffer_length / (bits_per_sample / 8); + result[1] = mp_obj_new_memoryview(typecode, nitems, result_buf); } return mp_obj_new_tuple(2, result); diff --git a/shared-bindings/synthio/MidiTrack.c b/shared-bindings/synthio/MidiTrack.c index 20a203ce9c..6916a21689 100644 --- a/shared-bindings/synthio/MidiTrack.c +++ b/shared-bindings/synthio/MidiTrack.c @@ -44,7 +44,8 @@ //| tempo: int, //| *, //| sample_rate: int = 11025, -//| waveform: ReadableBuffer = None +//| waveform: Optional[ReadableBuffer] = None, +//| envelope: Optional[Envelope] = None, //| ) -> None: //| """Create a MidiTrack from the given stream of MIDI events. Only "Note On" and "Note Off" events //| are supported; channel numbers and key velocities are ignored. Up to two notes may be on at the @@ -54,6 +55,7 @@ //| :param int tempo: Tempo of the streamed events, in MIDI ticks per second //| :param int sample_rate: The desired playback sample rate; higher sample rate requires more memory //| :param ReadableBuffer waveform: A single-cycle waveform. Default is a 50% duty cycle square wave. If specified, must be a ReadableBuffer of type 'h' (signed 16 bit) +//| :param Envelope envelope: An object that defines the loudness of a note over time. The default envelope provides no ramping, voices turn instantly on and off. //| //| Simple melody:: //| @@ -72,12 +74,13 @@ //| print("stopped")""" //| ... STATIC mp_obj_t synthio_miditrack_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_buffer, ARG_tempo, ARG_sample_rate, ARG_waveform }; + enum { ARG_buffer, ARG_tempo, ARG_sample_rate, ARG_waveform, ARG_envelope }; static const mp_arg_t allowed_args[] = { { MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED }, { MP_QSTR_tempo, MP_ARG_INT | MP_ARG_REQUIRED }, { MP_QSTR_sample_rate, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 11025} }, { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, + { MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -96,7 +99,9 @@ STATIC mp_obj_t synthio_miditrack_make_new(const mp_obj_type_t *type, size_t n_a args[ARG_tempo].u_int, args[ARG_sample_rate].u_int, bufinfo_waveform.buf, - bufinfo_waveform.len / 2); + bufinfo_waveform.len / 2, + args[ARG_envelope].u_obj + ); return MP_OBJ_FROM_PTR(self); } diff --git a/shared-bindings/synthio/MidiTrack.h b/shared-bindings/synthio/MidiTrack.h index 90ddab8728..046163c2de 100644 --- a/shared-bindings/synthio/MidiTrack.h +++ b/shared-bindings/synthio/MidiTrack.h @@ -24,20 +24,18 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_SYNTHIO_MIDITRACK_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_SYNTHIO_MIDITRACK_H +#pragma once #include "shared-module/synthio/MidiTrack.h" extern const mp_obj_type_t synthio_miditrack_type; void common_hal_synthio_miditrack_construct(synthio_miditrack_obj_t *self, - const uint8_t *buffer, uint32_t len, uint32_t tempo, uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_len); + const uint8_t *buffer, uint32_t len, uint32_t tempo, uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_len, + mp_obj_t envelope); void common_hal_synthio_miditrack_deinit(synthio_miditrack_obj_t *self); bool common_hal_synthio_miditrack_deinited(synthio_miditrack_obj_t *self); uint32_t common_hal_synthio_miditrack_get_sample_rate(synthio_miditrack_obj_t *self); uint8_t common_hal_synthio_miditrack_get_bits_per_sample(synthio_miditrack_obj_t *self); uint8_t common_hal_synthio_miditrack_get_channel_count(synthio_miditrack_obj_t *self); - -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_SYNTHIO_MIDITRACK_H diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index 4a4256b5ac..97941b860b 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -37,24 +37,29 @@ #include "supervisor/shared/translate/translate.h" //| class Synthesizer: -//| def __init__(self, *, sample_rate: int = 11025, waveform: ReadableBuffer = None) -> None: +//| def __init__( +//| self, +//| *, +//| sample_rate: int = 11025, +//| waveform: Optional[ReadableBuffer] = None, +//| envelope: Optional[Envelope] = None, +//| ) -> None: //| """Create a synthesizer object. //| //| This API is experimental. //| -//| At least 2 simultaneous notes are supported. mimxrt10xx and rp2040 platforms support up to -//| 12 notes. -//| //| Notes use MIDI note numbering, with 60 being C4 or Middle C, approximately 262Hz. //| //| :param int sample_rate: The desired playback sample rate; higher sample rate requires more memory -//| :param ReadableBuffer waveform: A single-cycle waveform. Default is a 50% duty cycle square wave. If specified, must be a ReadableBuffer of type 'h' (signed 16 bit). It is permitted to modify this buffer during synthesis. This can be used, for instance, to control the overall volume or timbre of the notes. +//| :param ReadableBuffer waveform: A single-cycle waveform. Default is a 50% duty cycle square wave. If specified, must be a ReadableBuffer of type 'h' (signed 16 bit) +//| :param Optional[Envelope] envelope: An object that defines the loudness of a note over time. The default envelope, `None` provides no ramping, voices turn instantly on and off. //| """ STATIC mp_obj_t synthio_synthesizer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_sample_rate, ARG_waveform }; + enum { ARG_sample_rate, ARG_waveform, ARG_envelope }; static const mp_arg_t allowed_args[] = { { MP_QSTR_sample_rate, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 11025} }, { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, + { MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -68,7 +73,9 @@ STATIC mp_obj_t synthio_synthesizer_make_new(const mp_obj_type_t *type, size_t n common_hal_synthio_synthesizer_construct(self, args[ARG_sample_rate].u_int, bufinfo_waveform.buf, - bufinfo_waveform.len / 2); + bufinfo_waveform.len / 2, + args[ARG_envelope].u_obj); + return MP_OBJ_FROM_PTR(self); } @@ -191,6 +198,28 @@ STATIC mp_obj_t synthio_synthesizer_obj___exit__(size_t n_args, const mp_obj_t * return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(synthio_synthesizer___exit___obj, 4, 4, synthio_synthesizer_obj___exit__); + +//| envelope: Optional[Envelope] +//| """The envelope to apply to all notes. `None`, the default envelope, instantly turns notes on and off. The envelope may be changed dynamically, but it affects all notes (even currently playing notes)""" +STATIC mp_obj_t synthio_synthesizer_obj_get_envelope(mp_obj_t self_in) { + synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return synthio_synth_envelope_get(&self->synth); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_synthesizer_get_envelope_obj, synthio_synthesizer_obj_get_envelope); + +STATIC mp_obj_t synthio_synthesizer_obj_set_envelope(mp_obj_t self_in, mp_obj_t envelope) { + synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + synthio_synth_envelope_set(&self->synth, envelope); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_set_envelope_obj, synthio_synthesizer_obj_set_envelope); + +MP_PROPERTY_GETSET(synthio_synthesizer_envelope_obj, + (mp_obj_t)&synthio_synthesizer_get_envelope_obj, + (mp_obj_t)&synthio_synthesizer_set_envelope_obj); + //| sample_rate: int //| """32 bit value that tells how quickly samples are played in Hertz (cycles per second).""" STATIC mp_obj_t synthio_synthesizer_obj_get_sample_rate(mp_obj_t self_in) { @@ -232,6 +261,7 @@ STATIC const mp_rom_map_elem_t synthio_synthesizer_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&synthio_synthesizer___exit___obj) }, // Properties + { MP_ROM_QSTR(MP_QSTR_envelope), MP_ROM_PTR(&synthio_synthesizer_envelope_obj) }, { MP_ROM_QSTR(MP_QSTR_sample_rate), MP_ROM_PTR(&synthio_synthesizer_sample_rate_obj) }, { MP_ROM_QSTR(MP_QSTR_max_polyphony), MP_ROM_INT(CIRCUITPY_SYNTHIO_MAX_CHANNELS) }, { MP_ROM_QSTR(MP_QSTR_pressed), MP_ROM_PTR(&synthio_synthesizer_pressed_obj) }, diff --git a/shared-bindings/synthio/Synthesizer.h b/shared-bindings/synthio/Synthesizer.h index 92e75a1c23..ba6c3b99e3 100644 --- a/shared-bindings/synthio/Synthesizer.h +++ b/shared-bindings/synthio/Synthesizer.h @@ -32,8 +32,8 @@ extern const mp_obj_type_t synthio_synthesizer_type; void common_hal_synthio_synthesizer_construct(synthio_synthesizer_obj_t *self, - uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_len); - + uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_length, + mp_obj_t envelope); void common_hal_synthio_synthesizer_deinit(synthio_synthesizer_obj_t *self); bool common_hal_synthio_synthesizer_deinited(synthio_synthesizer_obj_t *self); uint32_t common_hal_synthio_synthesizer_get_sample_rate(synthio_synthesizer_obj_t *self); diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 3c50377ff8..703966defc 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -28,6 +28,7 @@ #include "py/mperrno.h" #include "py/obj.h" +#include "py/objnamedtuple.h" #include "py/runtime.h" #include "extmod/vfs_fat.h" #include "extmod/vfs_posix.h" @@ -36,16 +37,111 @@ #include "shared-bindings/synthio/MidiTrack.h" #include "shared-bindings/synthio/Synthesizer.h" -//| """Support for MIDI synthesis""" +//| """Support for multi-channel audio synthesis //| -//| def from_file(file: typing.BinaryIO, *, sample_rate: int = 11025) -> MidiTrack: +//| At least 2 simultaneous notes are supported. samd5x, mimxrt10xx and rp2040 platforms support up to 12 notes. +//| +//| I'm a little teapot. I'm not on line 11, but I don't know what is. +//| """ +//| +//| class Envelope: +//| def __init__( +//| self, +//| attack_time: float, +//| decay_time: float, +//| release_time: float, +//| attack_level: float, +//| sustain_level: float, +//| ) -> None: +//| """Construct an Envelope object +//| +//| The Envelope defines an ADSR (Attack, Decay, Sustain, Release) envelope with linear amplitude ramping. A note starts at 0 volume, then increases to ``attack_level`` over ``attack_time`` seconds; then it decays to ``sustain_level`` over ``decay_time`` seconds. Finally, when the note is released, it decreases to ``0`` volume over ``release_time``. +//| +//| If the ``sustain_level`` of an envelope is 0, then the decay and sustain phases of the note are always omitted. The note is considered to be released as soon as the envelope reaches the end of the attack phase. The ``decay_time`` is ignored. This is similar to how a plucked or struck instrument behaves. +//| +//| If a note is released before it reaches its sustain phase, it decays with the same slope indicated by ``sustain_level/release_time`` (or ``attack_level/release_time`` for plucked envelopes) +//| +//| :param float attack_time: The time in seconds it takes to ramp from 0 volume to attack_volume +//| :param float decay_time: The time in seconds it takes to ramp from attack_volume to sustain_volume +//| :param float release_time: The time in seconds it takes to ramp from sustain_volume to release_volume. When a note is released before it has reached the sustain phase, the release is done with the same slope indicated by ``release_time`` and ``sustain_level`` +//| :param float attack_level: The relative level, in the range ``0.0`` to ``1.0`` of the peak volume of the attack phase +//| :param float sustain_level: The relative level, in the range ``0.0`` to ``1.0`` of the volume of the sustain phase +//| """ +//| attack_time: float +//| """The time in seconds it takes to ramp from 0 volume to attack_volume""" +//| +//| decay_time: float +//| """The time in seconds it takes to ramp from attack_volume to sustain_volume""" +//| +//| release_time: float +//| """The time in seconds it takes to ramp from sustain_volume to release_volume. When a note is released before it has reached the sustain phase, the release is done with the same slope indicated by ``release_time`` and ``sustain_level``""" +//| +//| attack_level: float +//| """The relative level, in the range ``0.0`` to ``1.0`` of the peak volume of the attack phase""" +//| +//| sustain_level: float +//| """The relative level, in the range ``0.0`` to ``1.0`` of the volume of the sustain phase""" +//| + +STATIC mp_obj_t synthio_envelope_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) { + mp_obj_t new_obj = namedtuple_make_new(type_in, n_args, n_kw, args); + mp_obj_t *fields; + size_t len; + mp_obj_tuple_get(new_obj, &len, &fields); + + mp_arg_validate_obj_float_non_negative(fields[0], 0., MP_QSTR_attack_time); + mp_arg_validate_obj_float_non_negative(fields[1], 0., MP_QSTR_decay_time); + mp_arg_validate_obj_float_non_negative(fields[2], 0., MP_QSTR_release_time); + + mp_arg_validate_obj_float_range(fields[3], 0, 1, MP_QSTR_attack_level); + mp_arg_validate_obj_float_range(fields[4], 0, 1, MP_QSTR_sustain_level); + + return new_obj; +}; + +const mp_obj_namedtuple_type_t synthio_envelope_type_obj = { + .base = { + .base = { + .type = &mp_type_type + }, + .flags = MP_TYPE_FLAG_EXTENDED, + .name = MP_QSTR_Envelope, + .print = namedtuple_print, + .parent = &mp_type_tuple, + .make_new = synthio_envelope_make_new, + .attr = namedtuple_attr, + MP_TYPE_EXTENDED_FIELDS( + .unary_op = mp_obj_tuple_unary_op, + .binary_op = mp_obj_tuple_binary_op, + .subscr = mp_obj_tuple_subscr, + .getiter = mp_obj_tuple_getiter, + ), + }, + .n_fields = 5, + .fields = { + MP_QSTR_attack_time, + MP_QSTR_decay_time, + MP_QSTR_release_time, + MP_QSTR_attack_level, + MP_QSTR_sustain_level, + }, +}; + + +//| def from_file( +//| file: typing.BinaryIO, +//| *, +//| sample_rate: int = 11025, +//| waveform: Optional[ReadableBuffer] = None, +//| envelope: Optional[ReadableBuffer] = None, +//| ) -> MidiTrack: //| """Create an AudioSample from an already opened MIDI file. //| Currently, only single-track MIDI (type 0) is supported. //| //| :param typing.BinaryIO file: Already opened MIDI file //| :param int sample_rate: The desired playback sample rate; higher sample rate requires more memory //| :param ReadableBuffer waveform: A single-cycle waveform. Default is a 50% duty cycle square wave. If specified, must be a ReadableBuffer of type 'h' (signed 16 bit) -//| +//| :param Envelope envelope: An object that defines the loudness of a note over time. The default envelope provides no ramping, voices turn instantly on and off. //| //| Playing a MIDI file from flash:: //| @@ -65,11 +161,12 @@ //| ... //| STATIC mp_obj_t synthio_from_file(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_file, ARG_sample_rate, ARG_waveform }; + enum { ARG_file, ARG_sample_rate, ARG_waveform, ARG_envelope }; static const mp_arg_t allowed_args[] = { { MP_QSTR_file, MP_ARG_OBJ | MP_ARG_REQUIRED }, { MP_QSTR_sample_rate, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 11025} }, { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, + { MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.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); @@ -121,7 +218,9 @@ STATIC mp_obj_t synthio_from_file(size_t n_args, const mp_obj_t *pos_args, mp_ma result->base.type = &synthio_miditrack_type; common_hal_synthio_miditrack_construct(result, buffer, track_size, - tempo, args[ARG_sample_rate].u_int, bufinfo_waveform.buf, bufinfo_waveform.len / 2); + tempo, args[ARG_sample_rate].u_int, bufinfo_waveform.buf, bufinfo_waveform.len / 2, + args[ARG_envelope].u_obj + ); #if MICROPY_MALLOC_USES_ALLOCATED_SIZE m_free(buffer, track_size); @@ -133,12 +232,12 @@ STATIC mp_obj_t synthio_from_file(size_t n_args, const mp_obj_t *pos_args, mp_ma } MP_DEFINE_CONST_FUN_OBJ_KW(synthio_from_file_obj, 1, synthio_from_file); - STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_synthio) }, { MP_ROM_QSTR(MP_QSTR_MidiTrack), MP_ROM_PTR(&synthio_miditrack_type) }, { MP_ROM_QSTR(MP_QSTR_Synthesizer), MP_ROM_PTR(&synthio_synthesizer_type) }, { MP_ROM_QSTR(MP_QSTR_from_file), MP_ROM_PTR(&synthio_from_file_obj) }, + { MP_ROM_QSTR(MP_QSTR_Envelope), MP_ROM_PTR(&synthio_envelope_type_obj) }, }; STATIC MP_DEFINE_CONST_DICT(synthio_module_globals, synthio_module_globals_table); diff --git a/shared-bindings/synthio/__init__.h b/shared-bindings/synthio/__init__.h index 3b7d47db28..6ea323905a 100644 --- a/shared-bindings/synthio/__init__.h +++ b/shared-bindings/synthio/__init__.h @@ -26,4 +26,10 @@ #pragma once +#include "py/objnamedtuple.h" + +typedef struct synthio_synth synthio_synth_t; extern int16_t shared_bindings_synthio_square_wave[]; +extern const mp_obj_namedtuple_type_t synthio_envelope_type_obj; +void synthio_synth_envelope_set(synthio_synth_t *synth, mp_obj_t envelope_obj); +mp_obj_t synthio_synth_envelope_get(synthio_synth_t *synth); diff --git a/shared-module/synthio/MidiTrack.c b/shared-module/synthio/MidiTrack.c index f8b39c29e3..6a021af85c 100644 --- a/shared-module/synthio/MidiTrack.c +++ b/shared-module/synthio/MidiTrack.c @@ -28,118 +28,109 @@ #include "shared-bindings/synthio/MidiTrack.h" -STATIC NORETURN void raise_midi_stream_error(uint32_t pos) { - mp_raise_ValueError_varg(translate("Error in MIDI stream at position %d"), pos); +STATIC void print_midi_stream_error(synthio_miditrack_obj_t *self) { + mp_cprintf(&mp_plat_print, translate("Error in MIDI stream at position %d"), self->pos); + self->pos = self->track.len; } -STATIC uint8_t parse_note(const uint8_t *buffer, uint32_t len, uint32_t *pos) { - if (*pos + 1 >= len) { - raise_midi_stream_error(*pos); +STATIC uint8_t parse_note(synthio_miditrack_obj_t *self) { + uint8_t *buffer = self->track.buf; + size_t len = self->track.len; + if (self->pos + 1 >= len) { + print_midi_stream_error(self); } - uint8_t note = buffer[(*pos)++]; - if (note > 127 || buffer[(*pos)++] > 127) { - raise_midi_stream_error(*pos); + uint8_t note = buffer[(self->pos)++]; + if (note > 127 || buffer[(self->pos)++] > 127) { + print_midi_stream_error(self); } return note; } -STATIC void terminate_span(synthio_miditrack_obj_t *self, uint16_t *dur) { - if (*dur) { - self->track[self->total_spans - 1].dur = *dur; - *dur = 0; - } else { - self->total_spans--; +static int decode_duration(synthio_miditrack_obj_t *self) { + uint8_t *buffer = self->track.buf; + size_t len = self->track.len; + uint8_t c; + uint32_t delta = 0; + do { + c = buffer[self->pos++]; + delta <<= 7; + delta |= c & 0x7f; + } while ((c & 0x80) && (self->pos < len)); + + // errors cannot be raised from the background task, so simply end the track. + if (c & 0x80) { + self->pos = self->track.len; + print_midi_stream_error(self); } + return delta * self->synth.sample_rate / self->tempo; } -STATIC void add_span(synthio_miditrack_obj_t *self, const synthio_midi_span_t *span) { - self->track = m_renew(synthio_midi_span_t, self->track, self->total_spans, self->total_spans + 1); - self->track[self->total_spans++] = *span; -} - -STATIC void change_span_note(synthio_miditrack_obj_t *self, uint8_t old_note, uint8_t new_note, uint16_t *dur) { - synthio_midi_span_t span = self->track[self->total_spans - 1]; - if (synthio_span_change_note(&span, old_note, new_note)) { - terminate_span(self, dur); - add_span(self, &span); - *dur = 0; - } -} - -void common_hal_synthio_miditrack_construct(synthio_miditrack_obj_t *self, - const uint8_t *buffer, uint32_t len, uint32_t tempo, uint32_t sample_rate, - const int16_t *waveform, uint16_t waveform_length) { - - self->synth.sample_rate = sample_rate; - self->track = m_malloc(sizeof(synthio_midi_span_t), false); - synthio_span_init(self->track); - self->next_span = 0; - self->total_spans = 1; - self->synth.waveform = waveform; - self->synth.waveform_length = waveform_length; - - uint16_t dur = 0; - uint32_t pos = 0; - while (pos < len) { - uint8_t c; - uint32_t delta = 0; - do { - c = buffer[pos++]; - delta <<= 7; - delta |= c & 0x7f; - } while ((c & 0x80) && (pos < len)); - - if (c & 0x80) { - raise_midi_stream_error(pos); - } - - // dur is carried over here so that if a note on/off message doesn't actually produce a change, the - // underlying "span" is extended. Otherwise, it is zeroed out in the call to `terminate_span`. - dur += delta * sample_rate / tempo; - - switch (buffer[pos++] >> 4) { +// invariant: pointing at a MIDI message +static void decode_until_pause(synthio_miditrack_obj_t *self) { + uint8_t *buffer = self->track.buf; + size_t len = self->track.len; + do { + switch (buffer[self->pos++] >> 4) { case 8: { // Note Off - uint8_t note = parse_note(buffer, len, &pos); - change_span_note(self, note, SYNTHIO_SILENCE, &dur); + uint8_t note = parse_note(self); + synthio_span_change_note(&self->synth, note, SYNTHIO_SILENCE); break; } case 9: { // Note On - uint8_t note = parse_note(buffer, len, &pos); - change_span_note(self, SYNTHIO_SILENCE, note, &dur); + uint8_t note = parse_note(self); + synthio_span_change_note(&self->synth, SYNTHIO_SILENCE, note); break; } case 10: case 11: case 14: // two data bytes to ignore - parse_note(buffer, len, &pos); + parse_note(self); break; case 12: case 13: // one data byte to ignore - if (pos >= len || buffer[pos++] > 127) { - raise_midi_stream_error(pos); + if (self->pos >= len || buffer[self->pos++] > 127) { + print_midi_stream_error(self); } break; case 15: // the full syntax is too complicated, just assume it's "End of Track" event - pos = len; + self->pos = len; break; default: // invalid event - raise_midi_stream_error(pos); + print_midi_stream_error(self); } - } - terminate_span(self, &dur); + if (self->pos < len) { + self->synth.span.dur = decode_duration(self); + } + } while (self->pos < len && self->synth.span.dur == 0); +} - uint16_t max_dur = 0; - for (int i = 0; i < self->total_spans; i++) { - max_dur = MAX(self->track[i].dur, max_dur); +STATIC void start_parse(synthio_miditrack_obj_t *self) { + self->pos = 0; + self->synth.span.dur = decode_duration(self); + if (self->synth.span.dur == 0) { + // the usual case: the file starts with some MIDI event, not a delay + decode_until_pause(self); } - synthio_synth_init(&self->synth, max_dur); +} + +void common_hal_synthio_miditrack_construct(synthio_miditrack_obj_t *self, + const uint8_t *buffer, uint32_t len, uint32_t tempo, uint32_t sample_rate, + const int16_t *waveform, uint16_t waveform_length, + mp_obj_t envelope) { + + self->tempo = tempo; + self->track.buf = (void *)buffer; + self->track.len = len; + + synthio_synth_init(&self->synth, sample_rate, waveform, waveform_length, envelope); + + start_parse(self); } void common_hal_synthio_miditrack_deinit(synthio_miditrack_obj_t *self) { synthio_synth_deinit(&self->synth); - m_del(synthio_midi_span_t, self->track, self->total_spans + 1); - self->track = NULL; } + bool common_hal_synthio_miditrack_deinited(synthio_miditrack_obj_t *self) { return synthio_synth_deinited(&self->synth); } @@ -157,25 +148,21 @@ uint8_t common_hal_synthio_miditrack_get_channel_count(synthio_miditrack_obj_t * void synthio_miditrack_reset_buffer(synthio_miditrack_obj_t *self, bool single_channel_output, uint8_t channel) { synthio_synth_reset_buffer(&self->synth, single_channel_output, channel); - self->synth.span.dur = 0; - self->next_span = 0; + start_parse(self); } audioio_get_buffer_result_t synthio_miditrack_get_buffer(synthio_miditrack_obj_t *self, bool single_channel_output, uint8_t channel, uint8_t **buffer, uint32_t *buffer_length) { - if (self->synth.span.dur == 0) { - if (self->next_span >= self->total_spans) { - *buffer_length = 0; - return GET_BUFFER_DONE; - } - self->synth.span = self->track[self->next_span++]; - } - synthio_synth_synthesize(&self->synth, buffer, buffer_length, single_channel_output ? 0 : channel); - - return (self->synth.span.dur == 0 && self->next_span >= self->total_spans) ? - GET_BUFFER_DONE : GET_BUFFER_MORE_DATA; + if (self->synth.span.dur == 0) { + if (self->pos == self->track.len) { + return GET_BUFFER_DONE; + } else { + decode_until_pause(self); + } + } + return GET_BUFFER_MORE_DATA; } void synthio_miditrack_get_buffer_structure(synthio_miditrack_obj_t *self, bool single_channel_output, diff --git a/shared-module/synthio/MidiTrack.h b/shared-module/synthio/MidiTrack.h index e301ef355f..549e72fb25 100644 --- a/shared-module/synthio/MidiTrack.h +++ b/shared-module/synthio/MidiTrack.h @@ -34,9 +34,10 @@ typedef struct { mp_obj_base_t base; synthio_synth_t synth; - uint16_t next_span; - uint16_t total_spans; - synthio_midi_span_t *track; + mp_buffer_info_t track; + // invariant: after initial startup, pos always points just after an encoded duration, i.e., at a midi message (or at EOF) + size_t pos; + uint32_t tempo; } synthio_miditrack_obj_t; diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index 25c91ecbe0..42d0468845 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -30,13 +30,10 @@ void common_hal_synthio_synthesizer_construct(synthio_synthesizer_obj_t *self, - uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_length) { + uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_length, + mp_obj_t envelope) { - self->synth.sample_rate = sample_rate; - self->synth.waveform = waveform; - self->synth.waveform_length = waveform_length; - synthio_synth_init(&self->synth, SYNTHIO_MAX_DUR); - common_hal_synthio_synthesizer_release_all(self); + synthio_synth_init(&self->synth, sample_rate, waveform, waveform_length, envelope); } void common_hal_synthio_synthesizer_deinit(synthio_synthesizer_obj_t *self) { @@ -74,14 +71,18 @@ void synthio_synthesizer_get_buffer_structure(synthio_synthesizer_obj_t *self, b } void common_hal_synthio_synthesizer_release_all(synthio_synthesizer_obj_t *self) { - synthio_span_init(&self->synth.span); + for (size_t i = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { + if (self->synth.span.note[i] != SYNTHIO_SILENCE) { + synthio_span_change_note(&self->synth, self->synth.span.note[i], SYNTHIO_SILENCE); + } + } } void common_hal_synthio_synthesizer_release(synthio_synthesizer_obj_t *self, mp_obj_t to_release) { mp_obj_iter_buf_t iter_buf; mp_obj_t iterable = mp_getiter(to_release, &iter_buf); mp_obj_t item; while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - synthio_span_change_note(&self->synth.span, mp_arg_validate_int_range(mp_obj_get_int(item), 0, 127, MP_QSTR_note), SYNTHIO_SILENCE); + synthio_span_change_note(&self->synth, mp_arg_validate_int_range(mp_obj_get_int(item), 0, 127, MP_QSTR_note), SYNTHIO_SILENCE); } } @@ -90,15 +91,21 @@ void common_hal_synthio_synthesizer_press(synthio_synthesizer_obj_t *self, mp_ob mp_obj_t iterable = mp_getiter(to_press, &iter_buf); mp_obj_t item; while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - synthio_span_change_note(&self->synth.span, SYNTHIO_SILENCE, mp_arg_validate_int_range(mp_obj_get_int(item), 0, 127, MP_QSTR_note)); + synthio_span_change_note(&self->synth, SYNTHIO_SILENCE, mp_arg_validate_int_range(mp_obj_get_int(item), 0, 127, MP_QSTR_note)); } } mp_obj_t common_hal_synthio_synthesizer_get_pressed_notes(synthio_synthesizer_obj_t *self) { - mp_obj_tuple_t *result = MP_OBJ_TO_PTR(mp_obj_new_tuple(synthio_span_count_active_channels(&self->synth.span), NULL)); - for (size_t i = 0, j = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { - if (self->synth.span.note[i] != SYNTHIO_SILENCE) { - result->items[j++] = MP_OBJ_NEW_SMALL_INT(self->synth.span.note[i]); + int count = 0; + for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { + if (self->synth.span.note[chan] != SYNTHIO_SILENCE && self->synth.envelope_state[chan].state != SYNTHIO_ENVELOPE_STATE_RELEASE) { + count += 1; + } + } + mp_obj_tuple_t *result = MP_OBJ_TO_PTR(mp_obj_new_tuple(count, NULL)); + for (size_t chan = 0, j = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { + if (self->synth.span.note[chan] != SYNTHIO_SILENCE && self->synth.envelope_state[chan].state != SYNTHIO_ENVELOPE_STATE_RELEASE) { + result->items[j++] = MP_OBJ_NEW_SMALL_INT(self->synth.span.note[chan]); } } return MP_OBJ_FROM_PTR(result); diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 11e4c1dcc9..1385059b99 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -26,18 +26,117 @@ */ #include "shared-module/synthio/__init__.h" +#include "shared-bindings/synthio/__init__.h" #include "py/runtime.h" +#include +#include -STATIC const int16_t square_wave[] = {-32768, 32767}; +STATIC const int16_t square_wave[] = {-32768, 0}; STATIC const uint16_t notes[] = {8372, 8870, 9397, 9956, 10548, 11175, 11840, 12544, 13290, 14080, 14917, 15804}; // 9th octave -int synthio_span_count_active_channels(synthio_midi_span_t *span) { - int result = 0; - for (int i = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { - if (span->note[i] != SYNTHIO_SILENCE) { - result += 1; +STATIC int16_t convert_time_to_rate(uint32_t sample_rate, mp_obj_t time_in, int16_t difference) { + mp_float_t time = mp_obj_get_float(time_in); + int num_samples = (int)MICROPY_FLOAT_C_FUN(round)(time * sample_rate); + if (num_samples == 0) { + return 0; + } + int16_t result = MIN(32767, MAX(1, abs(difference * SYNTHIO_MAX_DUR) / num_samples)); + return (difference < 0) ? -result : result; +} + +STATIC void synthio_envelope_definition_set(synthio_envelope_definition_t *envelope, mp_obj_t obj, uint32_t sample_rate) { + if (obj == mp_const_none) { + envelope->attack_level = 32767; + envelope->sustain_level = 32767; + envelope->attack_step = 32767; + envelope->decay_step = -32767; + envelope->release_step = -32767; + return; + } + mp_arg_validate_type(obj, (mp_obj_type_t *)&synthio_envelope_type_obj, MP_QSTR_envelope); + + size_t len; + mp_obj_t *fields; + mp_obj_tuple_get(obj, &len, &fields); + + envelope->attack_level = (int)(32767 * mp_obj_get_float(fields[3])); + envelope->sustain_level = (int)(32767 * mp_obj_get_float(fields[4])); + + envelope->attack_step = convert_time_to_rate( + sample_rate, fields[0], envelope->attack_level); + + envelope->decay_step = -convert_time_to_rate( + sample_rate, fields[1], envelope->attack_level - envelope->sustain_level); + + envelope->release_step = -convert_time_to_rate( + sample_rate, fields[2], + envelope->decay_step + ? envelope->sustain_level + : envelope->attack_level); +} + +STATIC void synthio_envelope_state_step(synthio_envelope_state_t *state, synthio_envelope_definition_t *def, size_t n_steps) { + state->substep += n_steps; + while (state->substep >= SYNTHIO_MAX_DUR) { + // max n_steps should be SYNTHIO_MAX_DUR so this loop executes at most + // once + state->substep -= SYNTHIO_MAX_DUR; + switch (state->state) { + case SYNTHIO_ENVELOPE_STATE_SUSTAIN: + break; + case SYNTHIO_ENVELOPE_STATE_ATTACK: + if (def->attack_step != 0) { + state->level = MIN(state->level + def->attack_step, def->attack_level); + if (state->level == def->attack_level) { + state->state = SYNTHIO_ENVELOPE_STATE_DECAY; + } + break; + } + state->state = SYNTHIO_ENVELOPE_STATE_DECAY; + MP_FALLTHROUGH; + case SYNTHIO_ENVELOPE_STATE_DECAY: + if (def->decay_step != 0) { + state->level = MAX(state->level + def->decay_step, def->sustain_level); + assert(state->level >= 0); + if (state->level == def->sustain_level) { + state->state = SYNTHIO_ENVELOPE_STATE_SUSTAIN; + } + break; + } + state->state = SYNTHIO_ENVELOPE_STATE_RELEASE; + MP_FALLTHROUGH; + case SYNTHIO_ENVELOPE_STATE_RELEASE: + if (def->release_step != 0) { + int delta = def->release_step; + state->level = MAX(state->level + delta, 0); + } else { + state->level = 0; + } + break; + } + } +} + +STATIC void synthio_envelope_state_init(synthio_envelope_state_t *state, synthio_envelope_definition_t *def) { + state->level = 0; + state->substep = 0; + state->state = SYNTHIO_ENVELOPE_STATE_ATTACK; + + synthio_envelope_state_step(state, def, SYNTHIO_MAX_DUR); +} + +STATIC void synthio_envelope_state_release(synthio_envelope_state_t *state, synthio_envelope_definition_t *def) { + state->state = SYNTHIO_ENVELOPE_STATE_RELEASE; +} + + +STATIC uint32_t synthio_synth_sum_envelope(synthio_synth_t *synth) { + uint32_t result = 0; + for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { + if (synth->span.note[chan] != SYNTHIO_SILENCE) { + result += synth->envelope_state[chan].level; } } return result; @@ -62,16 +161,23 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t memset(out_buffer, 0, synth->buffer_length); int32_t sample_rate = synth->sample_rate; - int active_channels = synthio_span_count_active_channels(&synth->span); + uint32_t total_envelope = synthio_synth_sum_envelope(synth); const int16_t *waveform = synth->waveform; uint32_t waveform_length = synth->waveform_length; - if (active_channels) { - int16_t loudness = 0xffff / (1 + 2 * active_channels); + if (total_envelope > 0) { + uint16_t ovl_loudness = 0x7fffffff / MAX(0x8000, total_envelope); for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { if (synth->span.note[chan] == SYNTHIO_SILENCE) { synth->accum[chan] = 0; continue; } + // adjust loudness by envelope + uint16_t loudness = (ovl_loudness * synth->envelope_state[chan].level) >> 16; + + if (synth->envelope_state[chan].level == 0) { + // note is truly finished + synth->span.note[chan] = SYNTHIO_SILENCE; + } uint8_t octave = synth->span.note[chan] / 12; uint16_t base_freq = notes[synth->span.note[chan] % 12]; uint32_t accum = synth->accum[chan]; @@ -95,6 +201,11 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t } } + // advance envelope states + for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { + synthio_envelope_state_step(&synth->envelope_state[chan], &synth->envelope_definition, dur); + } + *buffer_length = synth->last_buffer_length = dur * SYNTHIO_BYTES_PER_SAMPLE; *bufptr = (uint8_t *)out_buffer; } @@ -117,11 +228,28 @@ void synthio_synth_deinit(synthio_synth_t *synth) { synth->buffers[1] = NULL; } -void synthio_synth_init(synthio_synth_t *synth, uint16_t max_dur) { - synth->buffer_length = MIN(SYNTHIO_MAX_DUR, max_dur) * SYNTHIO_BYTES_PER_SAMPLE; +void synthio_synth_envelope_set(synthio_synth_t *synth, mp_obj_t envelope_obj) { + synthio_envelope_definition_set(&synth->envelope_definition, envelope_obj, synth->sample_rate); + synth->envelope_obj = envelope_obj; +} + +mp_obj_t synthio_synth_envelope_get(synthio_synth_t *synth) { + return synth->envelope_obj; +} + +void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_length, mp_obj_t envelope_obj) { + synth->buffer_length = SYNTHIO_MAX_DUR * SYNTHIO_BYTES_PER_SAMPLE; synth->buffers[0] = m_malloc(synth->buffer_length, false); synth->buffers[1] = m_malloc(synth->buffer_length, false); synth->other_channel = -1; + synth->waveform = waveform; + synth->waveform_length = waveform_length; + synth->sample_rate = sample_rate; + synthio_synth_envelope_set(synth, envelope_obj); + + for (size_t i = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { + synth->span.note[i] = SYNTHIO_SILENCE; + } } void synthio_synth_get_buffer_structure(synthio_synth_t *synth, bool single_channel_output, @@ -132,40 +260,57 @@ void synthio_synth_get_buffer_structure(synthio_synth_t *synth, bool single_chan *spacing = 1; } +static bool parse_common(mp_buffer_info_t *bufinfo, mp_obj_t o, int16_t what) { + if (o != mp_const_none) { + mp_get_buffer_raise(o, bufinfo, MP_BUFFER_READ); + if (bufinfo->typecode != 'h') { + mp_raise_ValueError_varg(translate("%q must be array of type 'h'"), what); + } + mp_arg_validate_length_range(bufinfo->len / 2, 2, 1024, what); + return true; + } + return false; +} + void synthio_synth_parse_waveform(mp_buffer_info_t *bufinfo_waveform, mp_obj_t waveform_obj) { *bufinfo_waveform = ((mp_buffer_info_t) { .buf = (void *)square_wave, .len = 4 }); + parse_common(bufinfo_waveform, waveform_obj, MP_QSTR_waveform); +} - if (waveform_obj != mp_const_none) { - mp_get_buffer_raise(waveform_obj, bufinfo_waveform, MP_BUFFER_READ); - if (bufinfo_waveform->typecode != 'h') { - mp_raise_ValueError_varg(translate("%q must be array of type 'h'"), MP_QSTR_waveform); +STATIC int find_channel_with_note(synthio_synth_t *synth, uint8_t note) { + for (int i = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { + if (synth->span.note[i] == note) { + return i; } } - mp_arg_validate_length_range(bufinfo_waveform->len / 2, 2, 1024, MP_QSTR_waveform); -} - -void synthio_span_init(synthio_midi_span_t *span) { - span->dur = 0; - for (size_t i = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { span->note[i] = SYNTHIO_SILENCE; - } -} - -STATIC int find_channel_with_note(const synthio_midi_span_t *span, uint8_t note) { - for (int i = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { - if (span->note[i] == note) { - return i; + if (note == SYNTHIO_SILENCE) { + // we need a victim note that is releasing. simple algorithm: lowest numbered slot + for (int i = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { + if (SYNTHIO_VOICE_IS_RELEASING(synth, i)) { + return i; + } } } return -1; } -bool synthio_span_change_note(synthio_midi_span_t *span, uint8_t old_note, uint8_t new_note) { - if (new_note != SYNTHIO_SILENCE && find_channel_with_note(span, new_note) != -1) { - return false; // note already pressed, do nothing +bool synthio_span_change_note(synthio_synth_t *synth, uint8_t old_note, uint8_t new_note) { + int channel; + if (new_note != SYNTHIO_SILENCE && (channel = find_channel_with_note(synth, new_note)) != -1) { + // note already playing, re-strike + synthio_envelope_state_init(&synth->envelope_state[channel], &synth->envelope_definition); + synth->accum[channel] = 0; + return true; } - int channel = find_channel_with_note(span, old_note); + channel = find_channel_with_note(synth, old_note); if (channel != -1) { - span->note[channel] = new_note; + if (new_note == SYNTHIO_SILENCE) { + synthio_envelope_state_release(&synth->envelope_state[channel], &synth->envelope_definition); + } else { + synth->span.note[channel] = new_note; + synthio_envelope_state_init(&synth->envelope_state[channel], &synth->envelope_definition); + synth->accum[channel] = 0; + } return true; } return false; diff --git a/shared-module/synthio/__init__.h b/shared-module/synthio/__init__.h index e14e5ead10..56521d3208 100644 --- a/shared-module/synthio/__init__.h +++ b/shared-module/synthio/__init__.h @@ -30,6 +30,7 @@ #define SYNTHIO_BYTES_PER_SAMPLE (SYNTHIO_BITS_PER_SAMPLE / 8) #define SYNTHIO_MAX_DUR (256) #define SYNTHIO_SILENCE (0x80) +#define SYNTHIO_VOICE_IS_RELEASING(synth, i) (synth->envelope_state[i].state == SYNTHIO_ENVELOPE_STATE_RELEASE) #include "shared-module/audiocore/__init__.h" @@ -39,6 +40,25 @@ typedef struct { } synthio_midi_span_t; typedef struct { + // the number of attack or decay steps (signed) per sample + // therefore the maximum time is 32767 samples or 0.68s at 48kHz + // provided the level is maximum (this should be increased!) + int16_t attack_step, decay_step, release_step; + uint16_t attack_level, sustain_level; +} synthio_envelope_definition_t; + +typedef enum { + SYNTHIO_ENVELOPE_STATE_ATTACK, SYNTHIO_ENVELOPE_STATE_DECAY, + SYNTHIO_ENVELOPE_STATE_SUSTAIN, SYNTHIO_ENVELOPE_STATE_RELEASE +} envelope_state_e; + +typedef struct { + int16_t level; + uint16_t substep; + envelope_state_e state; +} synthio_envelope_state_t; + +typedef struct synthio_synth { uint32_t sample_rate; int16_t *buffers[2]; const int16_t *waveform; @@ -46,19 +66,24 @@ typedef struct { uint16_t last_buffer_length; uint8_t other_channel, buffer_index, other_buffer_index; uint16_t waveform_length; + synthio_envelope_definition_t envelope_definition; + mp_obj_t envelope_obj; synthio_midi_span_t span; uint32_t accum[CIRCUITPY_SYNTHIO_MAX_CHANNELS]; + synthio_envelope_state_t envelope_state[CIRCUITPY_SYNTHIO_MAX_CHANNELS]; } synthio_synth_t; -void synthio_span_init(synthio_midi_span_t *span); void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **buffer, uint32_t *buffer_length, uint8_t channel); void synthio_synth_deinit(synthio_synth_t *synth); bool synthio_synth_deinited(synthio_synth_t *synth); -void synthio_synth_init(synthio_synth_t *synth, uint16_t max_dur); +void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_length, + mp_obj_t envelope); void synthio_synth_get_buffer_structure(synthio_synth_t *synth, bool single_channel_output, bool *single_buffer, bool *samples_signed, uint32_t *max_buffer_length, uint8_t *spacing); void synthio_synth_reset_buffer(synthio_synth_t *synth, bool single_channel_output, uint8_t channel); void synthio_synth_parse_waveform(mp_buffer_info_t *bufinfo_waveform, mp_obj_t waveform_obj); +void synthio_synth_parse_envelope(uint16_t *envelope_sustain_index, mp_buffer_info_t *bufinfo_envelope, mp_obj_t envelope_obj, mp_obj_t envelope_hold_obj); -bool synthio_span_change_note(synthio_midi_span_t *span, uint8_t old_note, uint8_t new_note); -int synthio_span_count_active_channels(synthio_midi_span_t *span); +bool synthio_span_change_note(synthio_synth_t *synth, uint8_t old_note, uint8_t new_note); + +void synthio_envelope_step(synthio_envelope_definition_t *definition, synthio_envelope_state_t *state, int n_samples); diff --git a/tests/circuitpython/miditrack.py b/tests/circuitpython/miditrack.py index 53a8ca631d..2eac69b152 100644 --- a/tests/circuitpython/miditrack.py +++ b/tests/circuitpython/miditrack.py @@ -11,10 +11,12 @@ SCORE = b"\0\x90@\0\x20\x90b\0\x20\x80@\0\0\x80\b\0" with MidiTrack(SCORE, sample_rate=8000, tempo=640) as m: print(get_structure(m)) - print(get_buffer(m)) + p, q = get_buffer(m) + print(p, list(q)) with MidiTrack( SCORE, sample_rate=8000, tempo=640, waveform=array.array("h", [0, 32767, 0, -32768]) ) as m: print(get_structure(m)) - print(get_buffer(m)) + p, q = get_buffer(m) + print(p, list(q)) diff --git a/tests/circuitpython/miditrack.py.exp b/tests/circuitpython/miditrack.py.exp index bfb082bfe7..2d9e2548a0 100644 --- a/tests/circuitpython/miditrack.py.exp +++ b/tests/circuitpython/miditrack.py.exp @@ -1,4 +1,4 @@ (0, 1, 512, 1) -(1, b'V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\xaa*\xaa*') +1 [-16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0] (0, 1, 512, 1) -(1, b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00V\xd5V\xd5V\xd5V\xd5V\xd5V\xd5\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaa*\xaa*\xaa*\xaa*\xaa*\xaa*\x00\x00\x00\x00') +1 [0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0] diff --git a/tests/circuitpython/synthesizer.py b/tests/circuitpython/synthesizer.py index bdb273f861..326fef0994 100644 --- a/tests/circuitpython/synthesizer.py +++ b/tests/circuitpython/synthesizer.py @@ -1,10 +1,11 @@ import struct import synthio import audiocore +import ulab.numpy as np def dump_samples(): - print(struct.unpack("12h", audiocore.get_buffer(s)[1][:24])) + print([i for i in audiocore.get_buffer(s)[1][:24]]) s = synthio.Synthesizer(sample_rate=8000) @@ -22,3 +23,16 @@ dump_samples() s.release_then_press((80,)) print(s.pressed) dump_samples() + +envelope = synthio.Envelope( + attack_time=0.1, decay_time=0.05, release_time=0.2, attack_level=1, sustain_level=0.8 +) +s = synthio.Synthesizer(sample_rate=8000, envelope=envelope) +s.press((60,)) +for _ in range(12): + buf = audiocore.get_buffer(s)[1] + print((min(buf), max(buf))) +s.release_all() +for _ in range(12): + buf = audiocore.get_buffer(s)[1] + print((min(buf), max(buf))) diff --git a/tests/circuitpython/synthesizer.py.exp b/tests/circuitpython/synthesizer.py.exp index 79c88b3248..70eb647bab 100644 --- a/tests/circuitpython/synthesizer.py.exp +++ b/tests/circuitpython/synthesizer.py.exp @@ -1,8 +1,32 @@ () -(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) +[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (80,) -(-10922, -10922, -10922, -10922, 10922, 10922, 10922, 10922, 10922, -10922, -10922, -10922) +[-16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383] (80, 91) -(0, 0, 13106, 13106, 0, -13106, -13106, 0, 13106, 13106, 0, 0) +[-8191, -8191, 0, 0, -8191, -16382, -16382, -8191, 0, 0, -8191, -8191, 0, -8191, -8191, -16382, -16382, -8191, 0, 0, -8191, -8191, 0, -8191] (91,) -(-10922, 10922, 10922, 10922, -10922, -10922, 10922, 10922, 10922, -10922, -10922, 10922) +[-16382, -8191, -8191, 0, -8191, -8191, 0, 0, -8191, -16382, -16382, -8191, 0, 0, -8191, -8191, 0, -8191, -8191, -16382, -16382, -16382, 0, 0] +(-5242, 0) +(-10484, 0) +(-15727, 0) +(-16383, 0) +(-14286, 0) +(-13106, 0) +(-13106, 0) +(-13106, 0) +(-13106, 0) +(-13106, 0) +(-13106, 0) +(-13106, 0) +(-13106, 0) +(-11009, 0) +(-8912, 0) +(-6815, 0) +(-4718, 0) +(-2621, 0) +(-524, 0) +(0, 0) +(0, 0) +(0, 0) +(0, 0) +(0, 0) From b5c33a4c03a7a31cc1bf46a6fa22d79bc82747a4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 23 Apr 2023 09:24:17 -0500 Subject: [PATCH 0930/1712] Add a manual test of synthio this allows to test how the midi synthesizer is working, without access to hardware. Run `micropython-coverage midi2wav.py` and it will create `tune.wav` as an output. --- .../synthio/wave/.gitignore | 1 + .../synthio/wave/README.md | 5 + .../synthio/wave/audioop.py | 7 + .../synthio/wave/chunk.py | 169 ++++++ .../synthio/wave/midi2wav.py | 59 ++ .../circuitpython-manual/synthio/wave/wave.py | 546 ++++++++++++++++++ 6 files changed, 787 insertions(+) create mode 100644 tests/circuitpython-manual/synthio/wave/.gitignore create mode 100644 tests/circuitpython-manual/synthio/wave/README.md create mode 100644 tests/circuitpython-manual/synthio/wave/audioop.py create mode 100644 tests/circuitpython-manual/synthio/wave/chunk.py create mode 100644 tests/circuitpython-manual/synthio/wave/midi2wav.py create mode 100644 tests/circuitpython-manual/synthio/wave/wave.py diff --git a/tests/circuitpython-manual/synthio/wave/.gitignore b/tests/circuitpython-manual/synthio/wave/.gitignore new file mode 100644 index 0000000000..c212df9c3d --- /dev/null +++ b/tests/circuitpython-manual/synthio/wave/.gitignore @@ -0,0 +1 @@ +tune.wav diff --git a/tests/circuitpython-manual/synthio/wave/README.md b/tests/circuitpython-manual/synthio/wave/README.md new file mode 100644 index 0000000000..27868bf9f3 --- /dev/null +++ b/tests/circuitpython-manual/synthio/wave/README.md @@ -0,0 +1,5 @@ +# Test synthio without hardware + +Build the uninx port then run `....../ports/unix/micropython-coverage midi2wav.py`. + +This will create `tune.wav` as output, which you can listen to using any old audio player. diff --git a/tests/circuitpython-manual/synthio/wave/audioop.py b/tests/circuitpython-manual/synthio/wave/audioop.py new file mode 100644 index 0000000000..6ec637a3a1 --- /dev/null +++ b/tests/circuitpython-manual/synthio/wave/audioop.py @@ -0,0 +1,7 @@ +import struct + + +def byteswap(data, sampwidth): + print(data) + raise + ch = "I" if sampwidth == 16 else "H" diff --git a/tests/circuitpython-manual/synthio/wave/chunk.py b/tests/circuitpython-manual/synthio/wave/chunk.py new file mode 100644 index 0000000000..eea83c42d6 --- /dev/null +++ b/tests/circuitpython-manual/synthio/wave/chunk.py @@ -0,0 +1,169 @@ +"""Simple class to read IFF chunks. + +An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File +Format)) has the following structure: + ++----------------+ +| ID (4 bytes) | ++----------------+ +| size (4 bytes) | ++----------------+ +| data | +| ... | ++----------------+ + +The ID is a 4-byte string which identifies the type of chunk. + +The size field (a 32-bit value, encoded using big-endian byte order) +gives the size of the whole chunk, including the 8-byte header. + +Usually an IFF-type file consists of one or more chunks. The proposed +usage of the Chunk class defined here is to instantiate an instance at +the start of each chunk and read from the instance until it reaches +the end, after which a new instance can be instantiated. At the end +of the file, creating a new instance will fail with an EOFError +exception. + +Usage: +while True: + try: + chunk = Chunk(file) + except EOFError: + break + chunktype = chunk.getname() + while True: + data = chunk.read(nbytes) + if not data: + pass + # do something with data + +The interface is file-like. The implemented methods are: +read, close, seek, tell, isatty. +Extra methods are: skip() (called by close, skips to the end of the chunk), +getname() (returns the name (ID) of the chunk) + +The __init__ method has one required argument, a file-like object +(including a chunk instance), and one optional argument, a flag which +specifies whether or not chunks are aligned on 2-byte boundaries. The +default is 1, i.e. aligned. +""" + + +class Chunk: + def __init__(self, file, align=True, bigendian=True, inclheader=False): + import struct + + self.closed = False + self.align = align # whether to align to word (2-byte) boundaries + if bigendian: + strflag = ">" + else: + strflag = "<" + self.file = file + self.chunkname = file.read(4) + if len(self.chunkname) < 4: + raise EOFError + try: + self.chunksize = struct.unpack_from(strflag + "L", file.read(4))[0] + except struct.error: + raise EOFError from None + if inclheader: + self.chunksize = self.chunksize - 8 # subtract header + self.size_read = 0 + try: + self.offset = self.file.tell() + except (AttributeError, OSError): + self.seekable = False + else: + self.seekable = True + + def getname(self): + """Return the name (ID) of the current chunk.""" + return self.chunkname + + def getsize(self): + """Return the size of the current chunk.""" + return self.chunksize + + def close(self): + if not self.closed: + try: + self.skip() + finally: + self.closed = True + + def isatty(self): + if self.closed: + raise ValueError("I/O operation on closed file") + return False + + def seek(self, pos, whence=0): + """Seek to specified position into the chunk. + Default position is 0 (start of chunk). + If the file is not seekable, this will result in an error. + """ + + if self.closed: + raise ValueError("I/O operation on closed file") + if not self.seekable: + raise OSError("cannot seek") + if whence == 1: + pos = pos + self.size_read + elif whence == 2: + pos = pos + self.chunksize + if pos < 0 or pos > self.chunksize: + raise RuntimeError + self.file.seek(self.offset + pos, 0) + self.size_read = pos + + def tell(self): + if self.closed: + raise ValueError("I/O operation on closed file") + return self.size_read + + def read(self, size=-1): + """Read at most size bytes from the chunk. + If size is omitted or negative, read until the end + of the chunk. + """ + + if self.closed: + raise ValueError("I/O operation on closed file") + if self.size_read >= self.chunksize: + return b"" + if size < 0: + size = self.chunksize - self.size_read + if size > self.chunksize - self.size_read: + size = self.chunksize - self.size_read + data = self.file.read(size) + self.size_read = self.size_read + len(data) + if self.size_read == self.chunksize and self.align and (self.chunksize & 1): + dummy = self.file.read(1) + self.size_read = self.size_read + len(dummy) + return data + + def skip(self): + """Skip the rest of the chunk. + If you are not interested in the contents of the chunk, + this method should be called so that the file points to + the start of the next chunk. + """ + + if self.closed: + raise ValueError("I/O operation on closed file") + if self.seekable: + try: + n = self.chunksize - self.size_read + # maybe fix alignment + if self.align and (self.chunksize & 1): + n = n + 1 + self.file.seek(n, 1) + self.size_read = self.size_read + n + return + except OSError: + pass + while self.size_read < self.chunksize: + n = min(8192, self.chunksize - self.size_read) + dummy = self.read(n) + if not dummy: + raise EOFError diff --git a/tests/circuitpython-manual/synthio/wave/midi2wav.py b/tests/circuitpython-manual/synthio/wave/midi2wav.py new file mode 100644 index 0000000000..daa46a28c0 --- /dev/null +++ b/tests/circuitpython-manual/synthio/wave/midi2wav.py @@ -0,0 +1,59 @@ +import audiocore +import synthio +from ulab import numpy as np +import wave + +SAMPLE_SIZE = 1024 +VOLUME = 32700 +sine = np.array( + np.sin(np.linspace(0, 2 * np.pi, SAMPLE_SIZE, endpoint=False)) * VOLUME, + dtype=np.int16, +) + +envelope = synthio.Envelope( + attack_time=0.1, decay_time=0.05, release_time=0.2, attack_level=1, sustain_level=0.8 +) +melody = synthio.MidiTrack( + b"\0\x90H\0*\x80H\0\6\x90J\0*\x80J\0\6\x90L\0*\x80L\0\6\x90J\0" + + b"*\x80J\0\6\x90H\0*\x80H\0\6\x90J\0*\x80J\0\6\x90L\0T\x80L\0" + + b"\x0c\x90H\0T\x80H\0\x0c\x90H\0T\x80H\0", + tempo=240, + sample_rate=48000, + waveform=sine, + envelope=envelope, +) + +# sox -r 48000 -e signed -b 16 -c 1 tune.raw tune.wav +with wave.open("tune.wav", "w") as f: + f.setnchannels(1) + f.setsampwidth(2) + f.setframerate(48000) + while True: + result, data = audiocore.get_buffer(melody) + if data is None: + break + f.writeframes(data) + if result != 1: + break + +melody = synthio.MidiTrack( + b"\0\x90H\0*\x80H\0\6\x90J\0*\x80J\0\6\x90L\0*\x80L\0\6\x90J\0" + + b"*\x80J\0\6\x90H\0*\x80H\0\6\x90J\0*\x80J\0\6\x90L\0T\x80L\0" + + b"\x0c\x90H\0T\x80H\0\x0c\x90H\0T\x80H\0", + tempo=240, + sample_rate=48000, + waveform=sine, +) + +# sox -r 48000 -e signed -b 16 -c 1 tune.raw tune.wav +with wave.open("tune-noenv.wav", "w") as f: + f.setnchannels(1) + f.setsampwidth(2) + f.setframerate(48000) + while True: + result, data = audiocore.get_buffer(melody) + if data is None: + break + f.writeframes(data) + if result != 1: + break diff --git a/tests/circuitpython-manual/synthio/wave/wave.py b/tests/circuitpython-manual/synthio/wave/wave.py new file mode 100644 index 0000000000..903295a4ba --- /dev/null +++ b/tests/circuitpython-manual/synthio/wave/wave.py @@ -0,0 +1,546 @@ +"""Stuff to parse WAVE files. + +Usage. + +Reading WAVE files: + f = wave.open(file, 'r') +where file is either the name of a file or an open file pointer. +The open file pointer must have methods read(), seek(), and close(). +When the setpos() and rewind() methods are not used, the seek() +method is not necessary. + +This returns an instance of a class with the following public methods: + getnchannels() -- returns number of audio channels (1 for + mono, 2 for stereo) + getsampwidth() -- returns sample width in bytes + getframerate() -- returns sampling frequency + getnframes() -- returns number of audio frames + getcomptype() -- returns compression type ('NONE' for linear samples) + getcompname() -- returns human-readable version of + compression type ('not compressed' linear samples) + getparams() -- returns a namedtuple consisting of all of the + above in the above order + getmarkers() -- returns None (for compatibility with the + aifc module) + getmark(id) -- raises an error since the mark does not + exist (for compatibility with the aifc module) + readframes(n) -- returns at most n frames of audio + rewind() -- rewind to the beginning of the audio stream + setpos(pos) -- seek to the specified position + tell() -- return the current position + close() -- close the instance (make it unusable) +The position returned by tell() and the position given to setpos() +are compatible and have nothing to do with the actual position in the +file. +The close() method is called automatically when the class instance +is destroyed. + +Writing WAVE files: + f = wave.open(file, 'w') +where file is either the name of a file or an open file pointer. +The open file pointer must have methods write(), tell(), seek(), and +close(). + +This returns an instance of a class with the following public methods: + setnchannels(n) -- set the number of channels + setsampwidth(n) -- set the sample width + setframerate(n) -- set the frame rate + setnframes(n) -- set the number of frames + setcomptype(type, name) + -- set the compression type and the + human-readable compression type + setparams(tuple) + -- set all parameters at once + tell() -- return current position in output file + writeframesraw(data) + -- write audio frames without patching up the + file header + writeframes(data) + -- write audio frames and patch up the file header + close() -- patch up the file header and close the + output file +You should set the parameters before the first writeframesraw or +writeframes. The total number of frames does not need to be set, +but when it is set to the correct value, the header does not have to +be patched up. +It is best to first set all parameters, perhaps possibly the +compression type, and then write audio frames using writeframesraw. +When all frames have been written, either call writeframes(b'') or +close() to patch up the sizes in the header. +The close() method is called automatically when the class instance +is destroyed. +""" + +from chunk import Chunk +from collections import namedtuple +import audioop +import builtins +import struct +import sys + + +__all__ = ["open", "Error", "Wave_read", "Wave_write"] + + +class Error(Exception): + pass + + +WAVE_FORMAT_PCM = 0x0001 + +_array_fmts = None, "b", "h", None, "i" + +_wave_params = namedtuple( + "_wave_params", "nchannels sampwidth framerate nframes comptype compname" +) + + +class Wave_read: + """Variables used in this class: + + These variables are available to the user though appropriate + methods of this class: + _file -- the open file with methods read(), close(), and seek() + set through the __init__() method + _nchannels -- the number of audio channels + available through the getnchannels() method + _nframes -- the number of audio frames + available through the getnframes() method + _sampwidth -- the number of bytes per audio sample + available through the getsampwidth() method + _framerate -- the sampling frequency + available through the getframerate() method + _comptype -- the AIFF-C compression type ('NONE' if AIFF) + available through the getcomptype() method + _compname -- the human-readable AIFF-C compression type + available through the getcomptype() method + _soundpos -- the position in the audio stream + available through the tell() method, set through the + setpos() method + + These variables are used internally only: + _fmt_chunk_read -- 1 iff the FMT chunk has been read + _data_seek_needed -- 1 iff positioned correctly in audio + file for readframes() + _data_chunk -- instantiation of a chunk class for the DATA chunk + _framesize -- size of one frame in the file + """ + + def initfp(self, file): + self._convert = None + self._soundpos = 0 + self._file = Chunk(file, bigendian=0) + if self._file.getname() != b"RIFF": + raise Error("file does not start with RIFF id") + if self._file.read(4) != b"WAVE": + raise Error("not a WAVE file") + self._fmt_chunk_read = 0 + self._data_chunk = None + while 1: + self._data_seek_needed = 1 + try: + chunk = Chunk(self._file, bigendian=0) + except EOFError: + break + chunkname = chunk.getname() + if chunkname == b"fmt ": + self._read_fmt_chunk(chunk) + self._fmt_chunk_read = 1 + elif chunkname == b"data": + if not self._fmt_chunk_read: + raise Error("data chunk before fmt chunk") + self._data_chunk = chunk + self._nframes = chunk.chunksize // self._framesize + self._data_seek_needed = 0 + break + chunk.skip() + if not self._fmt_chunk_read or not self._data_chunk: + raise Error("fmt chunk and/or data chunk missing") + + def __init__(self, f): + self._i_opened_the_file = None + if isinstance(f, str): + f = builtins.open(f, "rb") + self._i_opened_the_file = f + # else, assume it is an open file object already + try: + self.initfp(f) + except: + if self._i_opened_the_file: + f.close() + raise + + def __del__(self): + self.close() + + def __enter__(self): + return self + + def __exit__(self, *args): + self.close() + + # + # User visible methods. + # + def getfp(self): + return self._file + + def rewind(self): + self._data_seek_needed = 1 + self._soundpos = 0 + + def close(self): + self._file = None + file = self._i_opened_the_file + if file: + self._i_opened_the_file = None + file.close() + + def tell(self): + return self._soundpos + + def getnchannels(self): + return self._nchannels + + def getnframes(self): + return self._nframes + + def getsampwidth(self): + return self._sampwidth + + def getframerate(self): + return self._framerate + + def getcomptype(self): + return self._comptype + + def getcompname(self): + return self._compname + + def getparams(self): + return _wave_params( + self.getnchannels(), + self.getsampwidth(), + self.getframerate(), + self.getnframes(), + self.getcomptype(), + self.getcompname(), + ) + + def getmarkers(self): + return None + + def getmark(self, id): + raise Error("no marks") + + def setpos(self, pos): + if pos < 0 or pos > self._nframes: + raise Error("position not in range") + self._soundpos = pos + self._data_seek_needed = 1 + + def readframes(self, nframes): + if self._data_seek_needed: + self._data_chunk.seek(0, 0) + pos = self._soundpos * self._framesize + if pos: + self._data_chunk.seek(pos, 0) + self._data_seek_needed = 0 + if nframes == 0: + return b"" + data = self._data_chunk.read(nframes * self._framesize) + if self._sampwidth != 1 and sys.byteorder == "big": + data = audioop.byteswap(data, self._sampwidth) + if self._convert and data: + data = self._convert(data) + self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth) + return data + + # + # Internal methods. + # + + def _read_fmt_chunk(self, chunk): + try: + ( + wFormatTag, + self._nchannels, + self._framerate, + dwAvgBytesPerSec, + wBlockAlign, + ) = struct.unpack_from(" 4: + raise Error("bad sample width") + self._sampwidth = sampwidth + + def getsampwidth(self): + if not self._sampwidth: + raise Error("sample width not set") + return self._sampwidth + + def setframerate(self, framerate): + if self._datawritten: + raise Error("cannot change parameters after starting to write") + if framerate <= 0: + raise Error("bad frame rate") + self._framerate = int(round(framerate)) + + def getframerate(self): + if not self._framerate: + raise Error("frame rate not set") + return self._framerate + + def setnframes(self, nframes): + if self._datawritten: + raise Error("cannot change parameters after starting to write") + self._nframes = nframes + + def getnframes(self): + return self._nframeswritten + + def setcomptype(self, comptype, compname): + if self._datawritten: + raise Error("cannot change parameters after starting to write") + if comptype not in ("NONE",): + raise Error("unsupported compression type") + self._comptype = comptype + self._compname = compname + + def getcomptype(self): + return self._comptype + + def getcompname(self): + return self._compname + + def setparams(self, params): + nchannels, sampwidth, framerate, nframes, comptype, compname = params + if self._datawritten: + raise Error("cannot change parameters after starting to write") + self.setnchannels(nchannels) + self.setsampwidth(sampwidth) + self.setframerate(framerate) + self.setnframes(nframes) + self.setcomptype(comptype, compname) + + def getparams(self): + if not self._nchannels or not self._sampwidth or not self._framerate: + raise Error("not all parameters set") + return _wave_params( + self._nchannels, + self._sampwidth, + self._framerate, + self._nframes, + self._comptype, + self._compname, + ) + + def setmark(self, id, pos, name): + raise Error("setmark() not supported") + + def getmark(self, id): + raise Error("no marks") + + def getmarkers(self): + return None + + def tell(self): + return self._nframeswritten + + def writeframesraw(self, data): + if not isinstance(data, (bytes, bytearray)): + data = memoryview(data).cast("B") + self._ensure_header_written(len(data)) + nframes = len(data) // (self._sampwidth * self._nchannels) + if self._convert: + data = self._convert(data) + if self._sampwidth != 1 and sys.byteorder == "big": + data = audioop.byteswap(data, self._sampwidth) + self._file.write(data) + self._datawritten += len(data) + self._nframeswritten = self._nframeswritten + nframes + + def writeframes(self, data): + self.writeframesraw(data) + if self._datalength != self._datawritten: + self._patchheader() + + def close(self): + try: + if self._file: + self._ensure_header_written(0) + if self._datalength != self._datawritten: + self._patchheader() + self._file.flush() + finally: + self._file = None + file = self._i_opened_the_file + if file: + self._i_opened_the_file = None + file.close() + + # + # Internal methods. + # + + def _ensure_header_written(self, datasize): + if not self._headerwritten: + if not self._nchannels: + raise Error("# channels not specified") + if not self._sampwidth: + raise Error("sample width not specified") + if not self._framerate: + raise Error("sampling rate not specified") + self._write_header(datasize) + + def _write_header(self, initlength): + assert not self._headerwritten + self._file.write(b"RIFF") + if not self._nframes: + self._nframes = initlength // (self._nchannels * self._sampwidth) + self._datalength = self._nframes * self._nchannels * self._sampwidth + try: + self._form_length_pos = self._file.tell() + except (AttributeError, OSError): + self._form_length_pos = None + self._file.write( + struct.pack( + " Date: Tue, 25 Apr 2023 08:21:31 -0500 Subject: [PATCH 0931/1712] Disable synthio on two boards where it doesn't fit --- ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk | 2 +- ports/stm/boards/thunderpack_v11/mpconfigboard.mk | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk index 49be084ddf..e297e96d95 100644 --- a/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew_m4/mpconfigboard.mk @@ -48,7 +48,7 @@ CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS = 0 CIRCUITPY_KEYPAD_KEYMATRIX = 0 CIRCUITPY_MATH = 1 CIRCUITPY_STAGE = 1 -CIRCUITPY_SYNTHIO = 1 +CIRCUITPY_SYNTHIO = 0 CIRCUITPY_ZLIB = 1 FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/pewpew_m4 diff --git a/ports/stm/boards/thunderpack_v11/mpconfigboard.mk b/ports/stm/boards/thunderpack_v11/mpconfigboard.mk index 0aa8ce6746..376f54ac6d 100644 --- a/ports/stm/boards/thunderpack_v11/mpconfigboard.mk +++ b/ports/stm/boards/thunderpack_v11/mpconfigboard.mk @@ -19,6 +19,7 @@ LD_FILE = boards/STM32F411_nvm.ld CIRCUITPY_AESIO = 0 CIRCUITPY_BITMAPTOOLS = 0 CIRCUITPY_BLEIO_HCI = 0 +CIRCUITPY_SYNTHIO = 0 CIRCUITPY_VECTORIO = 0 CIRCUITPY_ULAB = 0 CIRCUITPY_ZLIB = 0 From 95acec0f55d53213a2475f7c03af95c1fd3e757b Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 25 Apr 2023 13:22:42 -0400 Subject: [PATCH 0932/1712] Improve pin names --- .../boards/adafruit_feather_rp2040_prop_maker/pins.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/pins.c b/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/pins.c index 96e0bc71df..20368dd6fd 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/pins.c +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_prop_maker/pins.c @@ -42,12 +42,12 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_I2S_BIT_CLOCK), MP_ROM_PTR(&pin_GPIO17) }, - { MP_ROM_QSTR(MP_QSTR_WORD_SELECT), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_EXTERNAL_BUTTON), MP_ROM_PTR(&pin_GPIO19) }, - { MP_ROM_QSTR(MP_QSTR_SERVO), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_EXTERNAL_SERVO), MP_ROM_PTR(&pin_GPIO20) }, { MP_ROM_QSTR(MP_QSTR_EXTERNAL_NEOPIXELS), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_ACCELEROMETER_INTERRUPT), MP_ROM_PTR(&pin_GPIO22) }, - { MP_ROM_QSTR(MP_QSTR_EXTERNAL_NEOPIXELS_POWER), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_EXTERNAL_POWER), MP_ROM_PTR(&pin_GPIO23) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, From eab202aa530b17993be4a440cc99b28577fceaa6 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 25 Apr 2023 10:36:34 -0700 Subject: [PATCH 0933/1712] Fix SH110x --- shared-module/displayio/Display.c | 10 +++++----- shared-module/displayio/Display.h | 5 ----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 6d4acbe8c0..093604214d 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -65,7 +65,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self, } displayio_display_core_construct(&self->core, bus, width, height, ram_width, ram_height, colstart, rowstart, rotation, color_depth, grayscale, pixels_in_byte_share_row, bytes_per_cell, reverse_pixels_in_byte, reverse_bytes_in_word, - set_column_command, set_row_command, NO_COMMAND, NO_COMMAND, self->data_as_commands, false /* always_toggle_chip_select */, + set_column_command, set_row_command, NO_COMMAND, NO_COMMAND, data_as_commands, false /* always_toggle_chip_select */, SH1107_addressing && color_depth == 1, false /*address_little_endian */); self->write_ram_command = write_ram_command; @@ -86,7 +86,7 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self, while (!displayio_display_core_begin_transaction(&self->core)) { RUN_BACKGROUND_TASKS; } - if (self->data_as_commands) { + if (self->core.data_as_commands) { uint8_t full_command[data_size + 1]; full_command[0] = cmd[0]; memcpy(full_command + 1, data, data_size); @@ -185,7 +185,7 @@ bool common_hal_displayio_display_set_brightness(displayio_display_obj_t *self, } else if (self->brightness_command != NO_BRIGHTNESS_COMMAND) { ok = displayio_display_core_begin_transaction(&self->core); if (ok) { - if (self->data_as_commands) { + if (self->core.data_as_commands) { uint8_t set_brightness[2] = {self->brightness_command, (uint8_t)(0xff * brightness)}; self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, set_brightness, 2); } else { @@ -226,7 +226,7 @@ STATIC const displayio_area_t *_get_refresh_areas(displayio_display_obj_t *self) } STATIC void _send_pixels(displayio_display_obj_t *self, uint8_t *pixels, uint32_t length) { - if (!self->data_as_commands) { + if (!self->core.data_as_commands) { self->core.send(self->core.bus, DISPLAY_COMMAND, CHIP_SELECT_TOGGLE_EVERY_BYTE, &self->write_ram_command, 1); } self->core.send(self->core.bus, DISPLAY_DATA, CHIP_SELECT_UNTOUCHED, pixels, length); @@ -247,7 +247,7 @@ STATIC bool _refresh_area(displayio_display_obj_t *self, const displayio_area_t uint16_t subrectangles = 1; // for SH1107 and other boundary constrained controllers // write one single row at a time - if (self->SH1107_addressing) { + if (self->core.SH1107_addressing) { subrectangles = rows_per_buffer / 8; // page addressing mode writes 8 rows at a time rows_per_buffer = 8; } else if (displayio_area_size(&clipped) > buffer_size * pixels_per_word) { diff --git a/shared-module/displayio/Display.h b/shared-module/displayio/Display.h index c60adc482f..e56aa87a5f 100644 --- a/shared-module/displayio/Display.h +++ b/shared-module/displayio/Display.h @@ -50,15 +50,10 @@ typedef struct { uint16_t brightness_command; uint16_t native_frames_per_second; uint16_t native_ms_per_frame; - uint8_t set_column_command; - uint8_t set_row_command; uint8_t write_ram_command; bool auto_refresh; bool first_manual_refresh; - bool data_as_commands; bool backlight_on_high; - // new quirk for sh1107 - bool SH1107_addressing; } displayio_display_obj_t; void displayio_display_background(displayio_display_obj_t *self); From 75046b3a58b698e61036fed12ae10f22d23a07a2 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 25 Apr 2023 13:26:48 -0700 Subject: [PATCH 0934/1712] Save space with consolidated errors --- shared-bindings/displayio/Display.c | 2 +- .../framebufferio/FramebufferDisplay.c | 2 +- shared-bindings/is31fl3741/FrameBuffer.c | 2 +- shared-bindings/rgbmatrix/RGBMatrix.c | 2 +- shared-module/displayio/Shape.c | 16 +++++++++------- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index 49194ebd1e..d6326d6d3b 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -358,7 +358,7 @@ STATIC mp_obj_t displayio_display_obj_set_brightness(mp_obj_t self_in, mp_obj_t displayio_display_obj_t *self = native_display(self_in); mp_float_t brightness = mp_obj_get_float(brightness_obj); if (brightness < 0 || brightness > 1.0) { - mp_raise_ValueError(translate("Brightness must be 0-1.0")); + mp_raise_ValueError_varg(translate("%q must be %d-%d"), MP_QSTR_brightness, 0, 1); } bool ok = common_hal_displayio_display_set_brightness(self, brightness); if (!ok) { diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index 030b924c1e..826f69fd83 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -194,7 +194,7 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_set_brightness(mp_obj_t sel framebufferio_framebufferdisplay_obj_t *self = native_display(self_in); mp_float_t brightness = mp_obj_get_float(brightness_obj); if (brightness < 0.0f || brightness > 1.0f) { - mp_raise_ValueError(translate("Brightness must be 0-1.0")); + mp_raise_ValueError_varg(translate("%q must be %d-%d"), MP_QSTR_brightness, 0, 1); } bool ok = common_hal_framebufferio_framebufferdisplay_set_brightness(self, brightness); if (!ok) { diff --git a/shared-bindings/is31fl3741/FrameBuffer.c b/shared-bindings/is31fl3741/FrameBuffer.c index f907a1dcd3..02a783fd15 100644 --- a/shared-bindings/is31fl3741/FrameBuffer.c +++ b/shared-bindings/is31fl3741/FrameBuffer.c @@ -162,7 +162,7 @@ STATIC mp_obj_t is31fl3741_FrameBuffer_set_brightness(mp_obj_t self_in, mp_obj_t check_for_deinit(self); mp_float_t brightness = mp_obj_get_float(value_in); if (brightness < 0.0f || brightness > 1.0f) { - mp_raise_ValueError(translate("Brightness must be 0-1.0")); + mp_raise_ValueError_varg(translate("%q must be %d-%d"), MP_QSTR_brightness, 0, 1); } uint8_t current = (uint8_t)(brightness * 0xFF); diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index f2877531bb..129d77e321 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -294,7 +294,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_set_brightness(mp_obj_t self_in, mp_obj_t va check_for_deinit(self); mp_float_t brightness = mp_obj_get_float(value_in); if (brightness < 0.0f || brightness > 1.0f) { - mp_raise_ValueError(translate("Brightness must be 0-1.0")); + mp_raise_ValueError_varg(translate("%q must be %d-%d"), MP_QSTR_brightness, 0, 1); } common_hal_rgbmatrix_rgbmatrix_set_paused(self, brightness <= 0); diff --git a/shared-module/displayio/Shape.c b/shared-module/displayio/Shape.c index 4a32c7a606..1d6db5bd69 100644 --- a/shared-module/displayio/Shape.c +++ b/shared-module/displayio/Shape.c @@ -63,15 +63,17 @@ void common_hal_displayio_shape_construct(displayio_shape_t *self, uint32_t widt } void common_hal_displayio_shape_set_boundary(displayio_shape_t *self, uint16_t y, uint16_t start_x, uint16_t end_x) { - if (y < 0 || y >= self->height || (self->mirror_y && y >= self->half_height)) { - mp_raise_ValueError(translate("y value out of bounds")); + uint16_t max_y = self->height - 1; + if (self->mirror_y) { + max_y = self->half_height - 1; } - if (start_x < 0 || start_x >= self->width || end_x < 0 || end_x >= self->width) { - mp_raise_ValueError(translate("x value out of bounds")); - } - if (self->mirror_x && (start_x >= self->half_width || end_x >= self->half_width)) { - mp_raise_ValueError_varg(translate("Maximum x value when mirrored is %d"), self->half_width); + mp_arg_validate_int_range(y, 0, max_y, MP_QSTR_y); + uint16_t max_x = self->width - 1; + if (self->mirror_x) { + max_x = self->half_width - 1; } + mp_arg_validate_int_range(start_x, 0, max_x, MP_QSTR_start_x); + mp_arg_validate_int_range(end_x, 0, max_x, MP_QSTR_end_x); uint16_t lower_x, upper_x, lower_y, upper_y; From 6c850349528c4da31141ff0d6a6b90b01e4cb901 Mon Sep 17 00:00:00 2001 From: Marco Sirabella Date: Tue, 25 Apr 2023 15:16:42 -0600 Subject: [PATCH 0935/1712] Bump recommended shallow-since 1.5 years forward --- py/makeversionhdr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/makeversionhdr.py b/py/makeversionhdr.py index 6576c3abbb..21ad92f1d8 100644 --- a/py/makeversionhdr.py +++ b/py/makeversionhdr.py @@ -66,7 +66,7 @@ def cannot_determine_version(): CircuitPython must be built from a git clone with tags. If you cloned from a fork, fetch the tags from adafruit/circuitpython as follows: - git fetch --tags --recurse-submodules=no --shallow-since="2021-07-01" https://github.com/adafruit/circuitpython HEAD""" + git fetch --tags --recurse-submodules=no --shallow-since="2023-02-01" https://github.com/adafruit/circuitpython HEAD""" ) From 863042dfd0abebba04be242b33b6f1a4f5d6bab5 Mon Sep 17 00:00:00 2001 From: Marco Sirabella Date: Tue, 25 Apr 2023 16:05:20 -0600 Subject: [PATCH 0936/1712] Move git command to update necessary tags to submodule I ran into this one since I did an initial shallow clone due to slow pycon 2023 wifi. --- Makefile | 4 ++++ py/makeversionhdr.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d0f1fcb3d0..d611dff49d 100644 --- a/Makefile +++ b/Makefile @@ -345,3 +345,7 @@ fetch-submodules: remove-submodules: git submodule deinit -f --all rm -rf .git/modules/* + +.PHONY: fetch-tags +fetch-tags: + git fetch --tags --recurse-submodules=no --shallow-since="2023-02-01" https://github.com/adafruit/circuitpython HEAD diff --git a/py/makeversionhdr.py b/py/makeversionhdr.py index 21ad92f1d8..b0d00a694e 100644 --- a/py/makeversionhdr.py +++ b/py/makeversionhdr.py @@ -66,7 +66,7 @@ def cannot_determine_version(): CircuitPython must be built from a git clone with tags. If you cloned from a fork, fetch the tags from adafruit/circuitpython as follows: - git fetch --tags --recurse-submodules=no --shallow-since="2023-02-01" https://github.com/adafruit/circuitpython HEAD""" + make fetch-tags""" ) From 4214f2bb77bd38844223ce4a36bd8ec84c740b28 Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Wed, 26 Apr 2023 11:01:56 -0400 Subject: [PATCH 0937/1712] Rename ports/raspberrypi/boards/pimoroni_pico_dv to ports/raspberrypi/boards/pimoroni_pico_dv_base --- .../boards/{pimoroni_pico_dv => pimoroni_pico_dv_base}/board.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename ports/raspberrypi/boards/{pimoroni_pico_dv => pimoroni_pico_dv_base}/board.c (100%) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv/board.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base/board.c similarity index 100% rename from ports/raspberrypi/boards/pimoroni_pico_dv/board.c rename to ports/raspberrypi/boards/pimoroni_pico_dv_base/board.c From 9f38304c2054df58a00fe5fb28eac99e46bc57c8 Mon Sep 17 00:00:00 2001 From: Chenxi Xiao <347396430@qq.com> Date: Wed, 26 Apr 2023 11:45:57 -0600 Subject: [PATCH 0938/1712] Update zh_Latn_pinyin.po --- locale/zh_Latn_pinyin.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index ec33771682..133958f5a6 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -1322,7 +1322,7 @@ msgstr "Géshì kuài dàxiǎo wúxiào" #: shared-bindings/wifi/Radio.c msgid "Invalid hex password" -msgstr "" +msgstr "Shíliù jìn zhì mìmǎ wúxiào" #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" From 6e8031faf846f2f4e5c3b9ca5305c7c1f66a3bb8 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 26 Apr 2023 13:53:33 -0500 Subject: [PATCH 0939/1712] Note limitation of next_stack_limit on espressif boards Open to better wording. --- shared-bindings/supervisor/Runtime.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index ecdd914a8f..1cc2f0abb1 100644 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -187,8 +187,10 @@ MP_PROPERTY_GETSET(supervisor_runtime_ble_workflow_obj, (mp_obj_t)&supervisor_runtime_set_ble_workflow_obj); //| next_stack_limit: int -//| """The size of the stack for the next vm run. If its too large, the default will be used.""" +//| """The size of the stack for the next vm run. If its too large, the default will be used. //| +//| **Limitations**: Stack size is fixed at startup on ``espressif`` port and this will have no effect. +//| """ STATIC mp_obj_t supervisor_runtime_get_next_stack_limit(mp_obj_t self) { return mp_obj_new_int(get_next_stack_size()); } From c333e6168179ca3c012f5d2578066825c64c61d7 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 26 Apr 2023 14:58:45 -0400 Subject: [PATCH 0940/1712] small wording change --- shared-bindings/supervisor/Runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/supervisor/Runtime.c b/shared-bindings/supervisor/Runtime.c index 1cc2f0abb1..792f18637a 100644 --- a/shared-bindings/supervisor/Runtime.c +++ b/shared-bindings/supervisor/Runtime.c @@ -189,7 +189,7 @@ MP_PROPERTY_GETSET(supervisor_runtime_ble_workflow_obj, //| next_stack_limit: int //| """The size of the stack for the next vm run. If its too large, the default will be used. //| -//| **Limitations**: Stack size is fixed at startup on ``espressif`` port and this will have no effect. +//| **Limitations**: Stack size is fixed at startup on the ``espressif`` port; setting this will have no effect. //| """ STATIC mp_obj_t supervisor_runtime_get_next_stack_limit(mp_obj_t self) { return mp_obj_new_int(get_next_stack_size()); From 5d0c37f19807daf37817795fe5bfb44845c86130 Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Wed, 26 Apr 2023 17:45:59 -0400 Subject: [PATCH 0941/1712] Rename folders and add VID/PID from Pimoroni --- .../mpconfigboard.h | 2 +- .../mpconfigboard.mk | 8 +- .../pico-sdk-configboard.h | 0 .../pins.c | 0 .../boards/pimoroni_pico_dv_base_w/board.c | 52 +++++++++++ .../boards/pimoroni_pico_dv_base_w/link.ld | 1 + .../pimoroni_pico_dv_base_w/mpconfigboard.h | 10 +++ .../pimoroni_pico_dv_base_w/mpconfigboard.mk | 26 ++++++ .../pico-sdk-configboard.h | 4 + .../boards/pimoroni_pico_dv_base_w/pins.c | 89 +++++++++++++++++++ 10 files changed, 187 insertions(+), 5 deletions(-) rename ports/raspberrypi/boards/{pimoroni_pico_dv => pimoroni_pico_dv_base}/mpconfigboard.h (75%) rename ports/raspberrypi/boards/{pimoroni_pico_dv => pimoroni_pico_dv_base}/mpconfigboard.mk (51%) rename ports/raspberrypi/boards/{pimoroni_pico_dv => pimoroni_pico_dv_base}/pico-sdk-configboard.h (100%) rename ports/raspberrypi/boards/{pimoroni_pico_dv => pimoroni_pico_dv_base}/pins.c (100%) create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/link.ld create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.h b/ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.h similarity index 75% rename from ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.h rename to ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.h index bf18491e47..969ccf74d8 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.h +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.h @@ -1,4 +1,4 @@ -#define MICROPY_HW_BOARD_NAME "Pimoroni Pico DV" +#define MICROPY_HW_BOARD_NAME "Pimoroni Pico dv Base" #define MICROPY_HW_MCU_NAME "rp2040" #define MICROPY_HW_LED_STATUS (&pin_GPIO25) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.mk similarity index 51% rename from ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk rename to ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.mk index f78d88add3..8546a32c93 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv/mpconfigboard.mk +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.mk @@ -1,7 +1,7 @@ -USB_VID = 0x239A -USB_PID = 0x80F4 -USB_PRODUCT = "Pimoroni PICO dv" -USB_MANUFACTURER = "Raspberry Pi" +USB_VID = 0x2E8A +USB_PID = 0x1059 +USB_PRODUCT = "Pimoroni Pico DV Demo Base for Pico" +USB_MANUFACTURER = "Pimoroni" CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv/pico-sdk-configboard.h b/ports/raspberrypi/boards/pimoroni_pico_dv_base/pico-sdk-configboard.h similarity index 100% rename from ports/raspberrypi/boards/pimoroni_pico_dv/pico-sdk-configboard.h rename to ports/raspberrypi/boards/pimoroni_pico_dv_base/pico-sdk-configboard.h diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv/pins.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base/pins.c similarity index 100% rename from ports/raspberrypi/boards/pimoroni_pico_dv/pins.c rename to ports/raspberrypi/boards/pimoroni_pico_dv_base/pins.c diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c new file mode 100644 index 0000000000..bc5878bf24 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c @@ -0,0 +1,52 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "bindings/picodvi/Framebuffer.h" +#include "shared-module/displayio/__init__.h" +#include "shared-bindings/framebufferio/FramebufferDisplay.h" + +void board_init(void) { + picodvi_framebuffer_obj_t *fb = &allocate_display_bus()->picodvi; + fb->base.type = &picodvi_framebuffer_type; + common_hal_picodvi_framebuffer_construct(fb, 640, 480, + &pin_GPIO7, &pin_GPIO6, + &pin_GPIO9, &pin_GPIO8, + &pin_GPIO11, &pin_GPIO10, + &pin_GPIO13, &pin_GPIO12, + 8); + + framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; + display->base.type = &framebufferio_framebufferdisplay_type; + common_hal_framebufferio_framebufferdisplay_construct( + display, + MP_OBJ_FROM_PTR(fb), + 0, + true); +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/link.ld b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/link.ld new file mode 100644 index 0000000000..e814bead4c --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/link.ld @@ -0,0 +1 @@ +firmware_size = 1532k; diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h new file mode 100644 index 0000000000..df6539734e --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h @@ -0,0 +1,10 @@ +#define MICROPY_HW_BOARD_NAME "Pimoroni Pico DV Base W" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1) +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1) + +#define MICROPY_HW_LED_STATUS (&pin_CYW0) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk new file mode 100644 index 0000000000..cf37a7e401 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk @@ -0,0 +1,26 @@ +USB_VID = 0x2E8A +USB_PID = 0x105A +USB_PRODUCT = "Pimoroni Pico DV Demo Base for Pico W" +USB_MANUFACTURER = "Pimoroni" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY__EVE = 1 + +CIRCUITPY_CYW43 = 1 +CIRCUITPY_SSL = 1 +CIRCUITPY_SSL_MBEDTLS = 1 +CIRCUITPY_HASHLIB = 1 +CIRCUITPY_WEB_WORKFLOW = 1 +CIRCUITPY_MDNS = 1 +CIRCUITPY_SOCKETPOOL = 1 +CIRCUITPY_WIFI = 1 + +CIRCUITPY_PICODVI = 1 + +CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 +# Must be accompanied by a linker script change +CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h new file mode 100644 index 0000000000..a41131dd22 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h @@ -0,0 +1,4 @@ +// Put board-specific pico-sdk definitions here. This file must exist. + +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c new file mode 100644 index 0000000000..346a2ae44c --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c @@ -0,0 +1,89 @@ +#include "shared-bindings/board/__init__.h" + +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_B), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_C), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + + // SD Card + { MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO5)}, + { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO18)}, + { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO19)}, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO22)}, + + { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_CYW1) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_CYW0) }, + + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_WS), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_BCLK), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_OUT), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, + + // DVI VIDEO + { MP_ROM_QSTR(MP_QSTR_DV_CEC), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_DV_SCL), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_DV_SDA), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_CKN), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_CKP), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D0N), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D0P), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D1N), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D1P), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D2N), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D2P), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_DV_HPD), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].framebuffer_display)}, + +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From aba4c50e74af1301e2b5fe1ee5198ddea92879fd Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Wed, 26 Apr 2023 21:08:28 -0400 Subject: [PATCH 0942/1712] Add adafruit_sdcard as frozen library --- .../raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.mk | 3 +++ .../boards/pimoroni_pico_dv_base_w/mpconfigboard.mk | 3 +++ 2 files changed, 6 insertions(+) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.mk index 8546a32c93..d5d90c6b4b 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.mk +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.mk @@ -10,3 +10,6 @@ EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" CIRCUITPY__EVE = 1 CIRCUITPY_PICODVI = 1 + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD \ No newline at end of file diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk index cf37a7e401..83e0764ab4 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk @@ -24,3 +24,6 @@ CIRCUITPY_PICODVI = 1 CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 # Must be accompanied by a linker script change CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD \ No newline at end of file From 12f59b494834838db405e1cf8eeb82d2833e509c Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Wed, 26 Apr 2023 21:14:57 -0400 Subject: [PATCH 0943/1712] pre-commit formatting --- ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.mk | 2 +- .../raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.mk index d5d90c6b4b..b383ead573 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.mk +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base/mpconfigboard.mk @@ -12,4 +12,4 @@ CIRCUITPY__EVE = 1 CIRCUITPY_PICODVI = 1 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD \ No newline at end of file +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk index 83e0764ab4..b7919a1847 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk @@ -26,4 +26,4 @@ CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_C CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD \ No newline at end of file +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD From ec6fde91adae9a648863686374bccc1badf0587a Mon Sep 17 00:00:00 2001 From: Bernhard Bablok Date: Thu, 27 Apr 2023 18:14:46 +0200 Subject: [PATCH 0944/1712] integrate latest changes from upstream --- .../boards/pimoroni_badger2040w/board.c | 13 +- .../boards/pimoroni_badger2040w/link.ld | 295 +----------------- 2 files changed, 7 insertions(+), 301 deletions(-) diff --git a/ports/raspberrypi/boards/pimoroni_badger2040w/board.c b/ports/raspberrypi/boards/pimoroni_badger2040w/board.c index 9eea472925..e54e7edd43 100644 --- a/ports/raspberrypi/boards/pimoroni_badger2040w/board.c +++ b/ports/raspberrypi/boards/pimoroni_badger2040w/board.c @@ -31,6 +31,7 @@ #include "shared-bindings/displayio/FourWire.h" #include "shared-bindings/microcontroller/Pin.h" #include "shared-module/displayio/__init__.h" +#include "shared-bindings/board/__init__.h" #include "supervisor/shared/board.h" #include "badger-shared.h" @@ -274,12 +275,11 @@ void board_init(void) { common_hal_digitalio_digitalinout_never_reset(&enable_pin_obj); // Set up the SPI object used to control the display - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; - common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO19, &pin_GPIO16, false); + busio_spi_obj_t *spi = common_hal_board_create_spi(0); common_hal_busio_spi_never_reset(spi); // Set up the DisplayIO pin object - displayio_fourwire_obj_t *bus = &displays[0].fourwire_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; common_hal_displayio_fourwire_construct(bus, spi, @@ -291,7 +291,7 @@ void board_init(void) { 0); // Phase // Set up the DisplayIO epaper object - displayio_epaperdisplay_obj_t *display = &displays[0].epaper_display; + displayio_epaperdisplay_obj_t *display = &allocate_display()->epaper_display; display->base.type = &displayio_epaperdisplay_type; common_hal_displayio_epaperdisplay_construct( display, @@ -323,16 +323,15 @@ void board_init(void) { false, // always_toggle_chip_select false, // grayscale false, // acep - false); // two_byte_sequence_length + false, // two_byte_sequence_length + false); // address_little_endian } void board_deinit(void) { displayio_epaperdisplay_obj_t *display = &displays[0].epaper_display; if (display->base.type == &displayio_epaperdisplay_type) { - size_t i = 0; while (common_hal_displayio_epaperdisplay_get_busy(display)) { RUN_BACKGROUND_TASKS; - i++; } } common_hal_displayio_release_displays(); diff --git a/ports/raspberrypi/boards/pimoroni_badger2040w/link.ld b/ports/raspberrypi/boards/pimoroni_badger2040w/link.ld index 2777b41720..e814bead4c 100644 --- a/ports/raspberrypi/boards/pimoroni_badger2040w/link.ld +++ b/ports/raspberrypi/boards/pimoroni_badger2040w/link.ld @@ -1,294 +1 @@ -/* Based on GCC ARM embedded samples. - Defines the following symbols for use by code: - __exidx_start - __exidx_end - __etext - __data_start__ - __preinit_array_start - __preinit_array_end - __init_array_start - __init_array_end - __fini_array_start - __fini_array_end - __data_end__ - __bss_start__ - __bss_end__ - __end__ - end - __HeapLimit - __StackLimit - __StackTop - __stack (== StackTop) -*/ - -MEMORY -{ - FLASH_FIRMWARE (rx) : ORIGIN = 0x10000000, LENGTH = 1532k - /* Followed by: 4kB of NVRAM and at least 512kB of CIRCUITPY */ - RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k - SCRATCH_X (rwx) : ORIGIN = 0x20040000, LENGTH = 4k - SCRATCH_Y (rwx) : ORIGIN = 0x20041000, LENGTH = 4k -} - -ENTRY(_entry_point) - -SECTIONS -{ - /* Second stage bootloader is prepended to the image. It must be 256 bytes big - and checksummed. It is usually built by the boot_stage2 target - in the Pico SDK - */ - - .flash_begin : { - __flash_binary_start = .; - } > FLASH_FIRMWARE - - .boot2 : { - __boot2_start__ = .; - KEEP (*(.boot2)) - __boot2_end__ = .; - } > FLASH_FIRMWARE - - ASSERT(__boot2_end__ - __boot2_start__ == 256, - "ERROR: Pico second stage bootloader must be 256 bytes in size") - - /* The second stage will always enter the image at the start of .text. - The debugger will use the ELF entry point, which is the _entry_point - symbol if present, otherwise defaults to start of .text. - This can be used to transfer control back to the bootrom on debugger - launches only, to perform proper flash setup. - */ - - .text : { - __logical_binary_start = .; - KEEP (*(.vectors)) - KEEP (*(.binary_info_header)) - __binary_info_header_end = .; - KEEP (*(.reset)) - /* TODO revisit this now memset/memcpy/float in ROM */ - /* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from - * FLASH ... we will include any thing excluded here in .data below by default */ - *(.init) - - __property_getter_start = .; - *(.property_getter) - __property_getter_end = .; - __property_getset_start = .; - *(.property_getset) - __property_getset_end = .; - - *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .text*) - *(.fini) - /* Pull all c'tors into .text */ - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - /* Followed by destructors */ - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) - *(SORT(.dtors.*)) - *(.dtors) - - *(.eh_frame*) - . = ALIGN(4); - } > FLASH_FIRMWARE - - .rodata : { - *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .rodata*) - . = ALIGN(4); - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*))) - . = ALIGN(4); - } > FLASH_FIRMWARE - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > FLASH_FIRMWARE - - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > FLASH_FIRMWARE - __exidx_end = .; - - /* Machine inspectable binary information */ - . = ALIGN(4); - __binary_info_start = .; - .binary_info : - { - KEEP(*(.binary_info.keep.*)) - *(.binary_info.*) - } > FLASH_FIRMWARE - __binary_info_end = .; - . = ALIGN(4); - - /* End of .text-like segments */ - __etext = .; - - .ram_vector_table (COPY): { - *(.ram_vector_table) - } > RAM - - .data : { - __data_start__ = .; - *(vtable) - - *(.time_critical*) - - /* remaining .text and .rodata; i.e. stuff we exclude above because we want it in RAM */ - *(.text*) - . = ALIGN(4); - *(.rodata*) - . = ALIGN(4); - - *(.data*) - - . = ALIGN(4); - *(.after_data.*) - . = ALIGN(4); - /* preinit data */ - PROVIDE_HIDDEN (__mutex_array_start = .); - KEEP(*(SORT(.mutex_array.*))) - KEEP(*(.mutex_array)) - PROVIDE_HIDDEN (__mutex_array_end = .); - - . = ALIGN(4); - /* preinit data */ - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(SORT(.preinit_array.*))) - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - - . = ALIGN(4); - /* init data */ - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - - . = ALIGN(4); - /* finit data */ - PROVIDE_HIDDEN (__fini_array_start = .); - *(SORT(.fini_array.*)) - *(.fini_array) - PROVIDE_HIDDEN (__fini_array_end = .); - - *(.jcr) - . = ALIGN(4); - /* All data end */ - __data_end__ = .; - } > RAM AT> FLASH_FIRMWARE - - .itcm : - { - . = ALIGN(4); - *(.itcm.*) - - . = ALIGN(4); - } > RAM AT> FLASH_FIRMWARE - _ld_itcm_destination = ADDR(.itcm); - _ld_itcm_flash_copy = LOADADDR(.itcm); - _ld_itcm_size = SIZEOF(.itcm); - - .dtcm_data : - { - . = ALIGN(4); - - *(.dtcm_data.*) - - . = ALIGN(4); - } > RAM AT> FLASH_FIRMWARE - _ld_dtcm_data_destination = ADDR(.dtcm_data); - _ld_dtcm_data_flash_copy = LOADADDR(.dtcm_data); - _ld_dtcm_data_size = SIZEOF(.dtcm_data); - - .dtcm_bss : - { - . = ALIGN(4); - - *(.dtcm_bss.*) - - . = ALIGN(4); - } > RAM AT> RAM - _ld_dtcm_bss_start = ADDR(.dtcm_bss); - _ld_dtcm_bss_size = SIZEOF(.dtcm_bss); - - .uninitialized_data (COPY): { - . = ALIGN(4); - *(.uninitialized_data*) - } > RAM - - /* Start and end symbols must be word-aligned */ - .scratch_x : { - __scratch_x_start__ = .; - *(.scratch_x.*) - . = ALIGN(4); - __scratch_x_end__ = .; - } > SCRATCH_X AT > FLASH_FIRMWARE - __scratch_x_source__ = LOADADDR(.scratch_x); - - .scratch_y : { - __scratch_y_start__ = .; - *(.scratch_y.*) - . = ALIGN(4); - __scratch_y_end__ = .; - } > SCRATCH_Y AT > FLASH_FIRMWARE - __scratch_y_source__ = LOADADDR(.scratch_y); - - .bss : { - . = ALIGN(4); - __bss_start__ = .; - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*))) - *(COMMON) - . = ALIGN(4); - __bss_end__ = .; - } > RAM - - .heap (COPY): - { - __end__ = .; - end = __end__; - *(.heap*) - __HeapLimit = .; - } > RAM - - /* .stack*_dummy section doesn't contains any symbols. It is only - * used for linker to calculate size of stack sections, and assign - * values to stack symbols later - * - * stack1 section may be empty/missing if platform_launch_core1 is not used */ - - /* by default we put core 0 stack at the end of scratch Y, so that if core 1 - * stack is not used then all of SCRATCH_X is free. - */ - .stack1_dummy (COPY): - { - *(.stack1*) - } > SCRATCH_X - .stack_dummy (COPY): - { - *(.stack*) - } > SCRATCH_Y - - .flash_end : { - __flash_binary_end = .; - } > FLASH_FIRMWARE - - /* stack limit is poorly named, but historically is maximum heap ptr */ - __StackLimit = ORIGIN(RAM) + LENGTH(RAM); - __StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X); - __StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y); - __StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy); - __StackBottom = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - - /* Check if data + heap + stack exceeds RAM limit */ - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed") - - ASSERT( __binary_info_header_end - __logical_binary_start <= 256, "Binary info must be in first 256 bytes of the binary") - /* todo assert on extra code */ -} +firmware_size = 1532k; From 4f8ae14c18e15ffc6bc0a33fd3151fff193c9829 Mon Sep 17 00:00:00 2001 From: Bernhard Bablok Date: Fri, 28 Apr 2023 08:56:52 +0200 Subject: [PATCH 0945/1712] update to upstream version --- .../boards/pimoroni_plasma2040w/link.ld | 295 +----------------- 1 file changed, 1 insertion(+), 294 deletions(-) diff --git a/ports/raspberrypi/boards/pimoroni_plasma2040w/link.ld b/ports/raspberrypi/boards/pimoroni_plasma2040w/link.ld index 2777b41720..e814bead4c 100644 --- a/ports/raspberrypi/boards/pimoroni_plasma2040w/link.ld +++ b/ports/raspberrypi/boards/pimoroni_plasma2040w/link.ld @@ -1,294 +1 @@ -/* Based on GCC ARM embedded samples. - Defines the following symbols for use by code: - __exidx_start - __exidx_end - __etext - __data_start__ - __preinit_array_start - __preinit_array_end - __init_array_start - __init_array_end - __fini_array_start - __fini_array_end - __data_end__ - __bss_start__ - __bss_end__ - __end__ - end - __HeapLimit - __StackLimit - __StackTop - __stack (== StackTop) -*/ - -MEMORY -{ - FLASH_FIRMWARE (rx) : ORIGIN = 0x10000000, LENGTH = 1532k - /* Followed by: 4kB of NVRAM and at least 512kB of CIRCUITPY */ - RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256k - SCRATCH_X (rwx) : ORIGIN = 0x20040000, LENGTH = 4k - SCRATCH_Y (rwx) : ORIGIN = 0x20041000, LENGTH = 4k -} - -ENTRY(_entry_point) - -SECTIONS -{ - /* Second stage bootloader is prepended to the image. It must be 256 bytes big - and checksummed. It is usually built by the boot_stage2 target - in the Pico SDK - */ - - .flash_begin : { - __flash_binary_start = .; - } > FLASH_FIRMWARE - - .boot2 : { - __boot2_start__ = .; - KEEP (*(.boot2)) - __boot2_end__ = .; - } > FLASH_FIRMWARE - - ASSERT(__boot2_end__ - __boot2_start__ == 256, - "ERROR: Pico second stage bootloader must be 256 bytes in size") - - /* The second stage will always enter the image at the start of .text. - The debugger will use the ELF entry point, which is the _entry_point - symbol if present, otherwise defaults to start of .text. - This can be used to transfer control back to the bootrom on debugger - launches only, to perform proper flash setup. - */ - - .text : { - __logical_binary_start = .; - KEEP (*(.vectors)) - KEEP (*(.binary_info_header)) - __binary_info_header_end = .; - KEEP (*(.reset)) - /* TODO revisit this now memset/memcpy/float in ROM */ - /* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from - * FLASH ... we will include any thing excluded here in .data below by default */ - *(.init) - - __property_getter_start = .; - *(.property_getter) - __property_getter_end = .; - __property_getset_start = .; - *(.property_getset) - __property_getset_end = .; - - *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .text*) - *(.fini) - /* Pull all c'tors into .text */ - *crtbegin.o(.ctors) - *crtbegin?.o(.ctors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) - *(SORT(.ctors.*)) - *(.ctors) - /* Followed by destructors */ - *crtbegin.o(.dtors) - *crtbegin?.o(.dtors) - *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) - *(SORT(.dtors.*)) - *(.dtors) - - *(.eh_frame*) - . = ALIGN(4); - } > FLASH_FIRMWARE - - .rodata : { - *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .rodata*) - . = ALIGN(4); - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*))) - . = ALIGN(4); - } > FLASH_FIRMWARE - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - } > FLASH_FIRMWARE - - __exidx_start = .; - .ARM.exidx : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - } > FLASH_FIRMWARE - __exidx_end = .; - - /* Machine inspectable binary information */ - . = ALIGN(4); - __binary_info_start = .; - .binary_info : - { - KEEP(*(.binary_info.keep.*)) - *(.binary_info.*) - } > FLASH_FIRMWARE - __binary_info_end = .; - . = ALIGN(4); - - /* End of .text-like segments */ - __etext = .; - - .ram_vector_table (COPY): { - *(.ram_vector_table) - } > RAM - - .data : { - __data_start__ = .; - *(vtable) - - *(.time_critical*) - - /* remaining .text and .rodata; i.e. stuff we exclude above because we want it in RAM */ - *(.text*) - . = ALIGN(4); - *(.rodata*) - . = ALIGN(4); - - *(.data*) - - . = ALIGN(4); - *(.after_data.*) - . = ALIGN(4); - /* preinit data */ - PROVIDE_HIDDEN (__mutex_array_start = .); - KEEP(*(SORT(.mutex_array.*))) - KEEP(*(.mutex_array)) - PROVIDE_HIDDEN (__mutex_array_end = .); - - . = ALIGN(4); - /* preinit data */ - PROVIDE_HIDDEN (__preinit_array_start = .); - KEEP(*(SORT(.preinit_array.*))) - KEEP(*(.preinit_array)) - PROVIDE_HIDDEN (__preinit_array_end = .); - - . = ALIGN(4); - /* init data */ - PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) - KEEP(*(.init_array)) - PROVIDE_HIDDEN (__init_array_end = .); - - . = ALIGN(4); - /* finit data */ - PROVIDE_HIDDEN (__fini_array_start = .); - *(SORT(.fini_array.*)) - *(.fini_array) - PROVIDE_HIDDEN (__fini_array_end = .); - - *(.jcr) - . = ALIGN(4); - /* All data end */ - __data_end__ = .; - } > RAM AT> FLASH_FIRMWARE - - .itcm : - { - . = ALIGN(4); - *(.itcm.*) - - . = ALIGN(4); - } > RAM AT> FLASH_FIRMWARE - _ld_itcm_destination = ADDR(.itcm); - _ld_itcm_flash_copy = LOADADDR(.itcm); - _ld_itcm_size = SIZEOF(.itcm); - - .dtcm_data : - { - . = ALIGN(4); - - *(.dtcm_data.*) - - . = ALIGN(4); - } > RAM AT> FLASH_FIRMWARE - _ld_dtcm_data_destination = ADDR(.dtcm_data); - _ld_dtcm_data_flash_copy = LOADADDR(.dtcm_data); - _ld_dtcm_data_size = SIZEOF(.dtcm_data); - - .dtcm_bss : - { - . = ALIGN(4); - - *(.dtcm_bss.*) - - . = ALIGN(4); - } > RAM AT> RAM - _ld_dtcm_bss_start = ADDR(.dtcm_bss); - _ld_dtcm_bss_size = SIZEOF(.dtcm_bss); - - .uninitialized_data (COPY): { - . = ALIGN(4); - *(.uninitialized_data*) - } > RAM - - /* Start and end symbols must be word-aligned */ - .scratch_x : { - __scratch_x_start__ = .; - *(.scratch_x.*) - . = ALIGN(4); - __scratch_x_end__ = .; - } > SCRATCH_X AT > FLASH_FIRMWARE - __scratch_x_source__ = LOADADDR(.scratch_x); - - .scratch_y : { - __scratch_y_start__ = .; - *(.scratch_y.*) - . = ALIGN(4); - __scratch_y_end__ = .; - } > SCRATCH_Y AT > FLASH_FIRMWARE - __scratch_y_source__ = LOADADDR(.scratch_y); - - .bss : { - . = ALIGN(4); - __bss_start__ = .; - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*))) - *(COMMON) - . = ALIGN(4); - __bss_end__ = .; - } > RAM - - .heap (COPY): - { - __end__ = .; - end = __end__; - *(.heap*) - __HeapLimit = .; - } > RAM - - /* .stack*_dummy section doesn't contains any symbols. It is only - * used for linker to calculate size of stack sections, and assign - * values to stack symbols later - * - * stack1 section may be empty/missing if platform_launch_core1 is not used */ - - /* by default we put core 0 stack at the end of scratch Y, so that if core 1 - * stack is not used then all of SCRATCH_X is free. - */ - .stack1_dummy (COPY): - { - *(.stack1*) - } > SCRATCH_X - .stack_dummy (COPY): - { - *(.stack*) - } > SCRATCH_Y - - .flash_end : { - __flash_binary_end = .; - } > FLASH_FIRMWARE - - /* stack limit is poorly named, but historically is maximum heap ptr */ - __StackLimit = ORIGIN(RAM) + LENGTH(RAM); - __StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X); - __StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y); - __StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy); - __StackBottom = __StackTop - SIZEOF(.stack_dummy); - PROVIDE(__stack = __StackTop); - - /* Check if data + heap + stack exceeds RAM limit */ - ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed") - - ASSERT( __binary_info_header_end - __logical_binary_start <= 256, "Binary info must be in first 256 bytes of the binary") - /* todo assert on extra code */ -} +firmware_size = 1532k; From 14c17224a1a0d4dc82262b8a72cba6b8e1f9999a Mon Sep 17 00:00:00 2001 From: Bernhard Bablok Date: Fri, 28 Apr 2023 08:57:22 +0200 Subject: [PATCH 0946/1712] update product-id --- ports/raspberrypi/boards/pimoroni_plasma2040w/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/pimoroni_plasma2040w/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_plasma2040w/mpconfigboard.mk index 68fec260ed..4b5faf6efb 100644 --- a/ports/raspberrypi/boards/pimoroni_plasma2040w/mpconfigboard.mk +++ b/ports/raspberrypi/boards/pimoroni_plasma2040w/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x2E8A -USB_PID = 0x100a +USB_PID = 0x1058 USB_PRODUCT = "Plasma 2040 W" USB_MANUFACTURER = "Pimoroni" From a9dc31a88198e5f09d46799870a921b92470b120 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 23 Mar 2023 16:11:00 -0700 Subject: [PATCH 0947/1712] Add additional iMX RT support This adds a script to generate the peripherals files (except clock). It adds support for the 1015, 1020, 1040, and 1050 EVKs. Some work was started on 1176 but it isn't working. So, the board def is in a separate branch. Fixes #3521. Fixes #2477. --- lib/tinyusb | 2 +- ports/mimxrt10xx/Makefile | 42 +- ports/mimxrt10xx/boards/board.h | 1 + ports/mimxrt10xx/boards/imxrt1010_evk/board.c | 4 +- .../boards/imxrt1010_evk/flash_config.c | 2 +- .../boards/imxrt1010_evk/mpconfigboard.h | 4 +- ports/mimxrt10xx/boards/imxrt1015_evk/board.c | 49 ++ .../boards/imxrt1015_evk/flash_config.c | 143 ++++ .../boards/imxrt1015_evk/mpconfigboard.h | 24 + .../boards/imxrt1015_evk/mpconfigboard.mk | 8 + ports/mimxrt10xx/boards/imxrt1015_evk/pins.c | 76 ++ ports/mimxrt10xx/boards/imxrt1020_evk/board.c | 4 +- .../boards/imxrt1020_evk/flash_config.c | 2 +- ports/mimxrt10xx/boards/imxrt1040_evk/board.c | 53 ++ .../boards/imxrt1040_evk/flash_config.c | 144 ++++ .../boards/imxrt1040_evk/mpconfigboard.h | 22 + .../boards/imxrt1040_evk/mpconfigboard.mk | 8 + ports/mimxrt10xx/boards/imxrt1040_evk/pins.c | 123 ++++ .../mimxrt10xx/boards/imxrt1050_evkb/board.c | 53 ++ .../boards/imxrt1050_evkb/flash_config.c | 144 ++++ .../boards/imxrt1050_evkb/mpconfigboard.h | 27 + .../boards/imxrt1050_evkb/mpconfigboard.mk | 10 + ports/mimxrt10xx/boards/imxrt1050_evkb/pins.c | 142 ++++ .../boards/metro_m7_1011/flash_config.c | 6 +- .../mimxrt10xx/common-hal/audiobusio/I2SOut.c | 6 +- ports/mimxrt10xx/common-hal/busio/I2C.c | 30 +- ports/mimxrt10xx/common-hal/busio/SPI.c | 58 +- ports/mimxrt10xx/common-hal/busio/UART.c | 30 +- .../common-hal/digitalio/DigitalInOut.c | 10 +- .../common-hal/microcontroller/Processor.c | 10 + .../common-hal/microcontroller/__init__.c | 190 +---- ports/mimxrt10xx/common-hal/os/__init__.c | 6 + .../linking/chip_family/MIMXRT1011.ld | 4 +- .../linking/chip_family/MIMXRT1015.ld | 4 + .../linking/chip_family/MIMXRT1021.ld | 4 +- .../linking/chip_family/MIMXRT1042.ld | 4 + .../linking/chip_family/MIMXRT1052.ld | 4 + .../linking/chip_family/MIMXRT1062.ld | 4 +- .../linking/chip_family/MIMXRT1176.ld | 4 + ports/mimxrt10xx/linking/common.ld | 14 +- ports/mimxrt10xx/linking/flash/IS25WP128.ld | 1 + ports/mimxrt10xx/mpconfigport.mk | 6 +- .../mimxrt10xx/MIMXRT1011/clocks.c | 2 + .../mimxrt10xx/MIMXRT1011/periph.c | 98 +-- .../mimxrt10xx/MIMXRT1011/periph.h | 29 +- .../mimxrt10xx/MIMXRT1011/pin_names.h | 78 ++ .../peripherals/mimxrt10xx/MIMXRT1011/pins.c | 88 +-- .../peripherals/mimxrt10xx/MIMXRT1011/pins.h | 59 +- .../mimxrt10xx/MIMXRT1015/clocks.c | 315 ++++++++ .../mimxrt10xx/MIMXRT1015/periph.c | 184 +++++ .../mimxrt10xx/MIMXRT1015/periph.h | 55 ++ .../mimxrt10xx/MIMXRT1015/pin_names.h | 92 +++ .../peripherals/mimxrt10xx/MIMXRT1015/pins.c | 91 +++ .../peripherals/mimxrt10xx/MIMXRT1015/pins.h | 36 + .../mimxrt10xx/MIMXRT1021/clocks.c | 2 + .../mimxrt10xx/MIMXRT1021/periph.c | 232 +++--- .../mimxrt10xx/MIMXRT1021/periph.h | 27 +- .../mimxrt10xx/MIMXRT1021/pin_names.h | 130 ++++ .../peripherals/mimxrt10xx/MIMXRT1021/pins.c | 68 +- .../peripherals/mimxrt10xx/MIMXRT1021/pins.h | 111 +-- .../mimxrt10xx/MIMXRT1042/clocks.c | 382 ++++++++++ .../mimxrt10xx/MIMXRT1042/periph.c | 356 ++++++++++ .../mimxrt10xx/MIMXRT1042/periph.h | 55 ++ .../mimxrt10xx/MIMXRT1042/pin_names.h | 151 ++++ .../peripherals/mimxrt10xx/MIMXRT1042/pins.c | 147 ++++ .../peripherals/mimxrt10xx/MIMXRT1042/pins.h | 36 + .../mimxrt10xx/MIMXRT1052/clocks.c | 402 +++++++++++ .../mimxrt10xx/MIMXRT1052/periph.c | 377 ++++++++++ .../mimxrt10xx/MIMXRT1052/periph.h | 55 ++ .../mimxrt10xx/MIMXRT1052/pin_names.h | 165 +++++ .../peripherals/mimxrt10xx/MIMXRT1052/pins.c | 161 +++++ .../peripherals/mimxrt10xx/MIMXRT1052/pins.h | 36 + .../mimxrt10xx/MIMXRT1062/periph.c | 178 ++--- .../mimxrt10xx/MIMXRT1062/periph.h | 29 +- .../mimxrt10xx/MIMXRT1062/pin_names.h | 165 +++++ .../peripherals/mimxrt10xx/MIMXRT1062/pins.c | 27 +- .../peripherals/mimxrt10xx/MIMXRT1062/pins.h | 148 +--- .../mimxrt10xx/MIMXRT1176/clocks.c | 672 ++++++++++++++++++ .../mimxrt10xx/MIMXRT1176/periph.c | 358 ++++++++++ .../mimxrt10xx/MIMXRT1176/periph.h | 55 ++ .../mimxrt10xx/MIMXRT1176/pin_names.h | 182 +++++ .../peripherals/mimxrt10xx/MIMXRT1176/pins.c | 177 +++++ .../peripherals/mimxrt10xx/MIMXRT1176/pins.h | 36 + .../peripherals/mimxrt10xx/periph.h | 8 + .../peripherals/mimxrt10xx/pin_names.h | 42 ++ .../mimxrt10xx/peripherals/mimxrt10xx/pins.h | 8 + ports/mimxrt10xx/sdk | 2 +- .../supervisor/flexspi_nor_flash_ops.c | 2 +- ports/mimxrt10xx/supervisor/internal_flash.c | 40 ++ ports/mimxrt10xx/supervisor/port.c | 113 ++- ports/mimxrt10xx/supervisor/usb.c | 5 + .../mimxrt10xx/tools/gen_peripherals_data.py | 356 ++++++++++ py/stackctrl.c | 3 + supervisor/linker.h | 2 +- tools/cortex-m-fault-gdb.py | 7 + 95 files changed, 7148 insertions(+), 969 deletions(-) create mode 100644 ports/mimxrt10xx/boards/imxrt1015_evk/board.c create mode 100644 ports/mimxrt10xx/boards/imxrt1015_evk/flash_config.c create mode 100644 ports/mimxrt10xx/boards/imxrt1015_evk/mpconfigboard.h create mode 100644 ports/mimxrt10xx/boards/imxrt1015_evk/mpconfigboard.mk create mode 100644 ports/mimxrt10xx/boards/imxrt1015_evk/pins.c create mode 100644 ports/mimxrt10xx/boards/imxrt1040_evk/board.c create mode 100644 ports/mimxrt10xx/boards/imxrt1040_evk/flash_config.c create mode 100644 ports/mimxrt10xx/boards/imxrt1040_evk/mpconfigboard.h create mode 100644 ports/mimxrt10xx/boards/imxrt1040_evk/mpconfigboard.mk create mode 100644 ports/mimxrt10xx/boards/imxrt1040_evk/pins.c create mode 100644 ports/mimxrt10xx/boards/imxrt1050_evkb/board.c create mode 100644 ports/mimxrt10xx/boards/imxrt1050_evkb/flash_config.c create mode 100644 ports/mimxrt10xx/boards/imxrt1050_evkb/mpconfigboard.h create mode 100644 ports/mimxrt10xx/boards/imxrt1050_evkb/mpconfigboard.mk create mode 100644 ports/mimxrt10xx/boards/imxrt1050_evkb/pins.c create mode 100644 ports/mimxrt10xx/linking/chip_family/MIMXRT1015.ld create mode 100644 ports/mimxrt10xx/linking/chip_family/MIMXRT1042.ld create mode 100644 ports/mimxrt10xx/linking/chip_family/MIMXRT1052.ld create mode 100644 ports/mimxrt10xx/linking/chip_family/MIMXRT1176.ld create mode 100644 ports/mimxrt10xx/linking/flash/IS25WP128.ld create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pin_names.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/clocks.c create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.c create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pin_names.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.c create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pin_names.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/clocks.c create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.c create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pin_names.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.c create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/clocks.c create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.c create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pin_names.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.c create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pin_names.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/clocks.c create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.c create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pin_names.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.c create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.h create mode 100644 ports/mimxrt10xx/peripherals/mimxrt10xx/pin_names.h create mode 100644 ports/mimxrt10xx/tools/gen_peripherals_data.py diff --git a/lib/tinyusb b/lib/tinyusb index ec9c666107..e3b3229d61 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit ec9c666107c0be0f8dc7c2a15e3bdea8c44a50b4 +Subproject commit e3b3229d61676585879c81d5f2e3393a2a1f1b16 diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index 72f4d191ef..b10466bb2d 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -34,10 +34,11 @@ INC += \ -I../../lib/tinyusb/src \ -I../../supervisor/shared/usb \ -I$(BUILD) \ - -Iboards/ \ + -Iboards \ -Iboards/$(BOARD) \ -Iperipherals/ \ -Iperipherals/mimxrt10xx/ \ + -Isdk/CMSIS/Include/ \ -Isdk/devices/$(CHIP_FAMILY) \ -Isdk/devices/$(CHIP_FAMILY)/drivers \ -Isdk/drivers/common @@ -48,7 +49,7 @@ CFLAGS += -ftree-vrp -DNDEBUG # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_CDC_RX_BUFSIZE=512 -DCFG_TUD_CDC_TX_BUFSIZE=512 -ifeq ($(CHIP_FAMILY), MIMXRT1011) +ifeq ($(CHIP_FAMILY),$(filter $(CHIP_FAMILY),MIMXRT1011 MIMXRT1015)) CFLAGS += -DCFG_TUD_MIDI_RX_BUFSIZE=64 -DCFG_TUD_MIDI_TX_BUFSIZE=64 -DCFG_TUD_MSC_BUFSIZE=512 else CFLAGS += -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_TUD_MIDI_TX_BUFSIZE=512 -DCFG_TUD_MSC_BUFSIZE=1024 @@ -75,7 +76,7 @@ CFLAGS += \ -mfloat-abi=hard \ -mfpu=fpv5-sp-d16 \ -DCPU_$(CHIP_VARIANT) \ - -DIMXRT10XX \ + -DIMXRT1XXX \ -g3 -Wno-unused-parameter \ -ffunction-sections -fdata-sections -fstack-usage @@ -100,14 +101,27 @@ ifndef INTERNAL_LIBM LIBS += -lm endif -LDFLAGS += -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mthumb -mapcs +ifndef CHIP_CORE +CHIP_CORE = $(CHIP_FAMILY) +endif + +# If not empty, then it is 10xx. +ifneq ($(findstring MIMXRT10, $(CHIP_FAMILY)),) +CFLAGS += -DIMXRT10XX=1 -DIMXRT11XX=0 +MIMXRT10xx = $(CHIP_FAMILY) BOOTLOADER_SIZE := 0x6000C000 +else +CFLAGS += -DIMXRT11XX=1 -DIMXRT10XX=0 +MIMXRT11xx = $(CHIP_FAMILY) +BOOTLOADER_SIZE := 0x3000C000 +endif + +LDFLAGS += -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-sp-d16 -mthumb -mapcs SRC_SDK := \ devices/$(CHIP_FAMILY)/drivers/fsl_clock.c \ - devices/$(CHIP_FAMILY)/system_$(CHIP_FAMILY).c \ + devices/$(CHIP_FAMILY)/system_$(CHIP_CORE).c \ devices/$(CHIP_FAMILY)/xip/fsl_flexspi_nor_boot.c \ - drivers/adc_12b1msps_sar/fsl_adc.c \ drivers/cache/armv7-m7/fsl_cache.c \ drivers/common/fsl_common_arm.c \ drivers/common/fsl_common.c \ @@ -121,11 +135,23 @@ SRC_SDK := \ drivers/sai/fsl_sai.c \ drivers/snvs_hp/fsl_snvs_hp.c \ drivers/snvs_lp/fsl_snvs_lp.c \ - drivers/tempmon/fsl_tempmon.c \ drivers/trng/fsl_trng.c \ +ifeq ($(CIRCUITPY_ANALOGIO), 1) +SRC_SDK += drivers/adc_12b1msps_sar/fsl_adc.c \ + drivers/tempmon/fsl_tempmon.c +endif + +ifeq ($(CHIP_FAMILY), MIMXRT1176) +SRC_SDK += devices/$(CHIP_FAMILY)/drivers/fsl_anatop_ai.c \ + devices/$(CHIP_FAMILY)/drivers/fsl_dcdc.c \ + devices/$(CHIP_FAMILY)/drivers/fsl_pmu.c +endif + SRC_SDK := $(addprefix sdk/, $(SRC_SDK)) +$(addprefix $(BUILD)/, $(SRC_SDK:.c=.o)): CFLAGS += -Wno-array-bounds + SRC_C += \ background.c \ boards/$(BOARD)/board.c \ @@ -156,7 +182,7 @@ SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL)) SRC_S = \ - sdk/devices/$(CHIP_FAMILY)/gcc/startup_$(CHIP_FAMILY).S \ + sdk/devices/$(CHIP_FAMILY)/gcc/startup_$(CHIP_CORE).S \ supervisor/cpu.S OBJ = $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) diff --git a/ports/mimxrt10xx/boards/board.h b/ports/mimxrt10xx/boards/board.h index e6736806ed..f00fea6be9 100644 --- a/ports/mimxrt10xx/boards/board.h +++ b/ports/mimxrt10xx/boards/board.h @@ -27,3 +27,4 @@ #include "mpconfigboard.h" #define XIP_BOOT_HEADER_ENABLE (1) +#define XIP_EXTERNAL_FLASH (1) diff --git a/ports/mimxrt10xx/boards/imxrt1010_evk/board.c b/ports/mimxrt10xx/boards/imxrt1010_evk/board.c index b839ffa666..c5237c8a8e 100644 --- a/ports/mimxrt10xx/boards/imxrt1010_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1010_evk/board.c @@ -42,8 +42,8 @@ const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { &pin_GPIO_SD_07, &pin_GPIO_SD_06, // USB Pins - &pin_GPIO_12, - &pin_GPIO_13, + &pin_USB_OTG1_DN, + &pin_USB_OTG1_DP, NULL, // Must end in NULL. }; diff --git a/ports/mimxrt10xx/boards/imxrt1010_evk/flash_config.c b/ports/mimxrt10xx/boards/imxrt1010_evk/flash_config.c index f15a3f3459..383a8ba1d1 100644 --- a/ports/mimxrt10xx/boards/imxrt1010_evk/flash_config.c +++ b/ports/mimxrt10xx/boards/imxrt1010_evk/flash_config.c @@ -37,7 +37,7 @@ const flexspi_nor_config_t qspiflash_config = { .deviceModeArg = 0x02, .deviceType = kFLEXSPIDeviceType_SerialNOR, .sflashPadType = kSerialFlash_4Pads, - .serialClkFreq = kFLEXSPISerialClk_60MHz, + .serialClkFreq = kFLEXSPISerialClk_133MHz, .sflashA1Size = FLASH_SIZE, .lookupTable = { diff --git a/ports/mimxrt10xx/boards/imxrt1010_evk/mpconfigboard.h b/ports/mimxrt10xx/boards/imxrt1010_evk/mpconfigboard.h index 192c265f88..2ae3a8b6f1 100644 --- a/ports/mimxrt10xx/boards/imxrt1010_evk/mpconfigboard.h +++ b/ports/mimxrt10xx/boards/imxrt1010_evk/mpconfigboard.h @@ -17,7 +17,7 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO_09) #define DEFAULT_UART_BUS_TX (&pin_GPIO_10) -#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO_09) -#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO_10) +// #define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO_09) +// #define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO_10) #define MICROPY_HW_LED_STATUS (&pin_GPIO_11) diff --git a/ports/mimxrt10xx/boards/imxrt1015_evk/board.c b/ports/mimxrt10xx/boards/imxrt1015_evk/board.c new file mode 100644 index 0000000000..568945a3eb --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1015_evk/board.c @@ -0,0 +1,49 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * + * 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 "shared-bindings/microcontroller/Pin.h" + +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { + &pin_GPIO_AD_B0_00, // SWDIO + &pin_GPIO_AD_B0_01, // SWCLK + // FLEX flash + &pin_GPIO_SD_B1_06, + &pin_GPIO_SD_B1_07, + &pin_GPIO_SD_B1_08, + &pin_GPIO_SD_B1_09, + &pin_GPIO_SD_B1_10, + &pin_GPIO_SD_B1_11, + // USB Pins + &pin_USB_OTG1_DN, + &pin_USB_OTG1_DP, + NULL, // Must end in NULL. +}; + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/imxrt1015_evk/flash_config.c b/ports/mimxrt10xx/boards/imxrt1015_evk/flash_config.c new file mode 100644 index 0000000000..f15a3f3459 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1015_evk/flash_config.c @@ -0,0 +1,143 @@ +/* + * Copyright 2017 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "boards/flash_config.h" + +#include "xip/fsl_flexspi_nor_boot.h" + +// Config for AT25SF128A with QSPI routed. +__attribute__((section(".boot_hdr.conf"))) +const flexspi_nor_config_t qspiflash_config = { + .pageSize = 256u, + .sectorSize = 4u * 1024u, + .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz, + .blockSize = 0x00010000, + .isUniformBlockSize = false, + .memConfig = + { + .tag = FLEXSPI_CFG_BLK_TAG, + .version = FLEXSPI_CFG_BLK_VERSION, + .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad, + .csHoldTime = 3u, + .csSetupTime = 3u, + + .busyOffset = 0u, // Status bit 0 indicates busy. + .busyBitPolarity = 0u, // Busy when the bit is 1. + + .deviceModeCfgEnable = 1u, + .deviceModeType = kDeviceConfigCmdType_QuadEnable, + .deviceModeSeq = { + .seqId = 4u, + .seqNum = 1u, + }, + .deviceModeArg = 0x02, + .deviceType = kFLEXSPIDeviceType_SerialNOR, + .sflashPadType = kSerialFlash_4Pads, + .serialClkFreq = kFLEXSPISerialClk_60MHz, + .sflashA1Size = FLASH_SIZE, + .lookupTable = + { + // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) + // The high 16 bits is command 1 and the low are command 0. + // Within a command, the top 6 bits are the opcode, the next two are the number + // of pads and then last byte is the operand. The operand's meaning changes + // per opcode. + + // Indices with ROM should always have the same function because the ROM + // bootloader uses it. + + // 0: ROM: Read LUTs + // Quad version + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, + RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), + FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, + READ_SDR, FLEXSPI_4PAD, 0x04), + // Single fast read version, good for debugging. + // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, + // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, + // READ_SDR, FLEXSPI_1PAD, 0x04), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 1: ROM: Read status + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, + READ_SDR, FLEXSPI_1PAD, 0x02), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 2: Empty + EMPTY_SEQUENCE, + + // 3: ROM: Write Enable + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, + STOP, FLEXSPI_1PAD, 0x00), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 4: Config: Write Status + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x31 /* the command to send */, + WRITE_SDR, FLEXSPI_1PAD, 0x01), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 5: ROM: Erase Sector + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 6: Empty + EMPTY_SEQUENCE, + + // 7: Empty + EMPTY_SEQUENCE, + + // 8: Block Erase + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 9: ROM: Page program + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + + FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, + STOP, FLEXSPI_1PAD, 0), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 10: Empty + EMPTY_SEQUENCE, + + // 11: ROM: Chip erase + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, + STOP, FLEXSPI_1PAD, 0), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 12: Empty + EMPTY_SEQUENCE, + + // 13: ROM: Read SFDP + EMPTY_SEQUENCE, + + // 14: ROM: Restore no cmd + EMPTY_SEQUENCE, + + // 15: ROM: Dummy + EMPTY_SEQUENCE + }, + }, +}; diff --git a/ports/mimxrt10xx/boards/imxrt1015_evk/mpconfigboard.h b/ports/mimxrt10xx/boards/imxrt1015_evk/mpconfigboard.h new file mode 100644 index 0000000000..ff2fe55319 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1015_evk/mpconfigboard.h @@ -0,0 +1,24 @@ +#define MICROPY_HW_BOARD_NAME "IMXRT1015-EVK" +#define MICROPY_HW_MCU_NAME "IMXRT1015DAF5A" + +// If you change this, then make sure to update the linker scripts as well to +// make sure you don't overwrite code +#define CIRCUITPY_INTERNAL_NVM_SIZE 0 + +#define BOARD_FLASH_SIZE (16 * 1024 * 1024) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO_AD_B0_10) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO_AD_B0_12) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO_AD_B0_13) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO_AD_B1_15) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO_AD_B1_14) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO_EMC_33) +#define DEFAULT_UART_BUS_TX (&pin_GPIO_EMC_32) + +// #define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO_AD_B0_07) +// #define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO_AD_B0_06) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO_SD_B1_00) +#define MICROPY_HW_LED_STATUS_INVERTED (1) diff --git a/ports/mimxrt10xx/boards/imxrt1015_evk/mpconfigboard.mk b/ports/mimxrt10xx/boards/imxrt1015_evk/mpconfigboard.mk new file mode 100644 index 0000000000..0f446e13bf --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1015_evk/mpconfigboard.mk @@ -0,0 +1,8 @@ +USB_VID = 0x239A +USB_PID = 0x8078 +USB_PRODUCT = "IMXRT1015-EVK" +USB_MANUFACTURER = "NXP" + +CHIP_VARIANT = MIMXRT1015DAF5A +CHIP_FAMILY = MIMXRT1015 +FLASH = AT25SF128A diff --git a/ports/mimxrt10xx/boards/imxrt1015_evk/pins.c b/ports/mimxrt10xx/boards/imxrt1015_evk/pins.c new file mode 100644 index 0000000000..abe2e8e746 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1015_evk/pins.c @@ -0,0 +1,76 @@ +#include "shared-bindings/board/__init__.h" + +#include "supervisor/board.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_EMC_33) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO_EMC_33) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO_EMC_32) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO_EMC_32) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO_EMC_20) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO_EMC_26) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO_EMC_34) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO_EMC_27) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO_AD_B1_11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO_AD_B0_15) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO_EMC_21) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO_EMC_22) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO_AD_B0_11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO_AD_B0_12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO_AD_B0_12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO_AD_B0_13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO_AD_B0_13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO_AD_B0_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO_AD_B0_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO_AD_B1_15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO_AD_B1_14) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO_AD_B1_13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO_AD_B0_14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO_AD_B1_12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO_AD_B1_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO_AD_B1_15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO_AD_B1_15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO_AD_B1_14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO_AD_B1_14) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_USER_LED), MP_ROM_PTR(&pin_GPIO_SD_B1_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO_SD_B1_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_GPIO_SD_B1_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_GPIO_SD_B1_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED3), MP_ROM_PTR(&pin_GPIO_SD_B1_02) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_USER_SW), MP_ROM_PTR(&pin_GPIO_EMC_09) }, + + // Audio Interface + { MP_ROM_QSTR(MP_QSTR_AUDIO_INT), MP_ROM_PTR(&pin_GPIO_EMC_08) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_SYNC), MP_ROM_PTR(&pin_GPIO_EMC_27) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_BCLK), MP_ROM_PTR(&pin_GPIO_EMC_26) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_RXD), MP_ROM_PTR(&pin_GPIO_EMC_21) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_TXD), MP_ROM_PTR(&pin_GPIO_EMC_25) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_MCLK), MP_ROM_PTR(&pin_GPIO_EMC_20) }, + + // SPDIF + { MP_ROM_QSTR(MP_QSTR_SPDIF_IN), MP_ROM_PTR(&pin_GPIO_EMC_05) }, + { MP_ROM_QSTR(MP_QSTR_SPDIF_OUT), MP_ROM_PTR(&pin_GPIO_EMC_04) }, + + // J29 UART LPUART4 + { MP_ROM_QSTR(MP_QSTR_J29_TX), MP_ROM_PTR(&pin_GPIO_EMC_32) }, + { MP_ROM_QSTR(MP_QSTR_J29_RX), MP_ROM_PTR(&pin_GPIO_EMC_33) }, + + // J30 UART LPUART3 + { MP_ROM_QSTR(MP_QSTR_J30_TX), MP_ROM_PTR(&pin_GPIO_EMC_06) }, + { MP_ROM_QSTR(MP_QSTR_J30_RX), MP_ROM_PTR(&pin_GPIO_EMC_07) }, + + // Freelink UART + { MP_ROM_QSTR(MP_QSTR_FREELINK_TX), MP_ROM_PTR(&pin_GPIO_AD_B0_06) }, + { MP_ROM_QSTR(MP_QSTR_FREELINK_RX), MP_ROM_PTR(&pin_GPIO_AD_B0_07) }, + + { 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_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/mimxrt10xx/boards/imxrt1020_evk/board.c b/ports/mimxrt10xx/boards/imxrt1020_evk/board.c index afbc0c58b5..f814afd956 100644 --- a/ports/mimxrt10xx/boards/imxrt1020_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1020_evk/board.c @@ -44,8 +44,8 @@ const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { &pin_GPIO_SD_B1_11, // USB Pins - &pin_GPIO_AD_B1_11, - &pin_GPIO_AD_B1_12, + &pin_USB_OTG1_DN, + &pin_USB_OTG1_DP, NULL, // Must end in NULL. }; diff --git a/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c b/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c index 2ae8ae9b76..47293c22b9 100644 --- a/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c +++ b/ports/mimxrt10xx/boards/imxrt1020_evk/flash_config.c @@ -21,7 +21,7 @@ const flexspi_nor_config_t qspiflash_config = { { .tag = FLEXSPI_CFG_BLK_TAG, .version = FLEXSPI_CFG_BLK_VERSION, - .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad, + .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromSckPad, .csHoldTime = 3u, .csSetupTime = 3u, diff --git a/ports/mimxrt10xx/boards/imxrt1040_evk/board.c b/ports/mimxrt10xx/boards/imxrt1040_evk/board.c new file mode 100644 index 0000000000..0e97d87b60 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1040_evk/board.c @@ -0,0 +1,53 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * + * 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 "shared-bindings/microcontroller/Pin.h" + +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { + // SWD Pins + &pin_GPIO_AD_B0_06, // SWDIO + &pin_GPIO_AD_B0_07, // SWCLK + + // FLEXSPI QSPI + &pin_GPIO_SD_B1_05, + &pin_GPIO_SD_B1_06, + &pin_GPIO_SD_B1_07, + &pin_GPIO_SD_B1_08, + &pin_GPIO_SD_B1_09, + &pin_GPIO_SD_B1_10, + &pin_GPIO_SD_B1_11, + + &pin_USB_OTG1_DN, + &pin_USB_OTG1_DP, + + NULL, // Must end in NULL. +}; + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/imxrt1040_evk/flash_config.c b/ports/mimxrt10xx/boards/imxrt1040_evk/flash_config.c new file mode 100644 index 0000000000..e68d9f9312 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1040_evk/flash_config.c @@ -0,0 +1,144 @@ +/* + * Copyright 2017 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "boards/flash_config.h" + +#include "xip/fsl_flexspi_nor_boot.h" + +// Config for W25Q64JVSSIQ with QSPI routed. +__attribute__((section(".boot_hdr.conf"))) +const flexspi_nor_config_t qspiflash_config = { + .pageSize = 256u, + .sectorSize = 4u * 1024u, + .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz, + .blockSize = 0x00010000, + .isUniformBlockSize = false, + .memConfig = + { + .tag = FLEXSPI_CFG_BLK_TAG, + .version = FLEXSPI_CFG_BLK_VERSION, + .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromSckPad, + .csHoldTime = 3u, + .csSetupTime = 3u, + + .busyOffset = 0u, // Status bit 0 indicates busy. + .busyBitPolarity = 0u, // Busy when the bit is 1. + + .deviceModeCfgEnable = 1u, + .deviceModeType = kDeviceConfigCmdType_QuadEnable, + .deviceModeSeq = { + .seqId = 4u, + .seqNum = 1u, + }, + .deviceModeArg = 0x40, + .deviceType = kFLEXSPIDeviceType_SerialNOR, + .sflashPadType = kSerialFlash_4Pads, + .serialClkFreq = kFLEXSPISerialClk_60MHz, + .sflashA1Size = FLASH_SIZE, + .lookupTable = + { + // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) + // The high 16 bits is command 1 and the low are command 0. + // Within a command, the top 6 bits are the opcode, the next two are the number + // of pads and then last byte is the operand. The operand's meaning changes + // per opcode. + + // Indices with ROM should always have the same function because the ROM + // bootloader uses it. + + // 0: ROM: Read LUTs + // Quad version + SEQUENCE( + FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, + RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), + FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, + READ_SDR, FLEXSPI_4PAD, 0x04), + // Single fast read version, good for debugging. + // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, + // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, + // READ_SDR, FLEXSPI_1PAD, 0x04), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 1: ROM: Read status + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, + READ_SDR, FLEXSPI_1PAD, 0x02), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 2: Empty + EMPTY_SEQUENCE, + + // 3: ROM: Write Enable + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, + STOP, FLEXSPI_1PAD, 0x00), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 4: Config: Write Status + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01 /* the command to send */, + WRITE_SDR, FLEXSPI_1PAD, 0x01), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 5: ROM: Erase Sector + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 6: Empty + EMPTY_SEQUENCE, + + // 7: Empty + EMPTY_SEQUENCE, + + // 8: Block Erase + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 9: ROM: Page program + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + + FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, + STOP, FLEXSPI_1PAD, 0), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 10: Empty + EMPTY_SEQUENCE, + + // 11: ROM: Chip erase + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, + STOP, FLEXSPI_1PAD, 0), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 12: Empty + EMPTY_SEQUENCE, + + // 13: ROM: Read SFDP + EMPTY_SEQUENCE, + + // 14: ROM: Restore no cmd + EMPTY_SEQUENCE, + + // 15: ROM: Dummy + EMPTY_SEQUENCE + }, + }, +}; diff --git a/ports/mimxrt10xx/boards/imxrt1040_evk/mpconfigboard.h b/ports/mimxrt10xx/boards/imxrt1040_evk/mpconfigboard.h new file mode 100644 index 0000000000..dd1cf9f759 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1040_evk/mpconfigboard.h @@ -0,0 +1,22 @@ +#define MICROPY_HW_BOARD_NAME "iMX RT 1040 EVK" +#define MICROPY_HW_MCU_NAME "IMXRT1042XJM5B" + +// If you change this, then make sure to update the linker scripts as well to +// make sure you don't overwrite code +#define CIRCUITPY_INTERNAL_NVM_SIZE 0 + +#define BOARD_FLASH_SIZE (8 * 1024 * 1024) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO_AD_B0_08) +#define MICROPY_HW_LED_STATUS_INVERTED (1) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO_AD_B1_00) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO_AD_B1_01) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO_AD_B1_07) +#define DEFAULT_UART_BUS_TX (&pin_GPIO_AD_B1_06) + +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO_AD_B0_12) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO_AD_B0_13) + +// If you want to connect over SWD, then make sure J80 is open. diff --git a/ports/mimxrt10xx/boards/imxrt1040_evk/mpconfigboard.mk b/ports/mimxrt10xx/boards/imxrt1040_evk/mpconfigboard.mk new file mode 100644 index 0000000000..cf351d906e --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1040_evk/mpconfigboard.mk @@ -0,0 +1,8 @@ +USB_VID = 0x239A +USB_PID = 0x8084 +USB_PRODUCT = "iMX RT 1040 EVK" +USB_MANUFACTURER = "NXP" + +CHIP_VARIANT = MIMXRT1042XJM5B +CHIP_FAMILY = MIMXRT1042 +FLASH = W25Q64JV diff --git a/ports/mimxrt10xx/boards/imxrt1040_evk/pins.c b/ports/mimxrt10xx/boards/imxrt1040_evk/pins.c new file mode 100644 index 0000000000..4cabdddc55 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1040_evk/pins.c @@ -0,0 +1,123 @@ +#include "shared-bindings/board/__init__.h" + +#include "supervisor/board.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_SD_B1_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO_SD_B1_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO_SD_B1_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO_SD_B1_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO_AD_B0_11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO_SD_B1_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO_AD_B0_09) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO_AD_B0_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO_AD_B1_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO_AD_B1_03) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO_B1_14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO_B1_15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO_SD_B0_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO_SD_B0_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO_SD_B0_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO_SD_B0_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO_AD_B1_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO_AD_B1_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO_AD_B1_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO_AD_B1_00) }, + + // i2c sensor is on I2C1_SCL/SDA + + { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO_AD_B0_14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO_AD_B0_15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO_AD_B1_04) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO_AD_B1_05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO_AD_B1_06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO_AD_B1_07) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_USER_LED), MP_ROM_PTR(&pin_GPIO_AD_B0_08) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO_AD_B0_08) }, + + // SD Card / Wifi + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_CLK), MP_ROM_PTR(&pin_GPIO_SD_B0_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_SW), MP_ROM_PTR(&pin_GPIO_B1_12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_CMD), MP_ROM_PTR(&pin_GPIO_SD_B0_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_D0), MP_ROM_PTR(&pin_GPIO_SD_B0_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_D1), MP_ROM_PTR(&pin_GPIO_SD_B0_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_D2), MP_ROM_PTR(&pin_GPIO_SD_B0_04) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_D3), MP_ROM_PTR(&pin_GPIO_SD_B0_05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_PWREN), MP_ROM_PTR(&pin_GPIO_AD_B1_04) }, + + // LCD Interface + { MP_ROM_QSTR(MP_QSTR_LCD_BACKLIGHT), MP_ROM_PTR(&pin_GPIO_B1_15) }, + { MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO_AD_B1_03) }, + { MP_ROM_QSTR(MP_QSTR_LCD_ENABLE), MP_ROM_PTR(&pin_GPIO_B0_01) }, + { MP_ROM_QSTR(MP_QSTR_LCD_VSYNC), MP_ROM_PTR(&pin_GPIO_B0_03) }, + { MP_ROM_QSTR(MP_QSTR_LCD_HSYNC), MP_ROM_PTR(&pin_GPIO_B0_02) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CLK), MP_ROM_PTR(&pin_GPIO_B0_00) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D0), MP_ROM_PTR(&pin_GPIO_B0_04) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D1), MP_ROM_PTR(&pin_GPIO_B0_05) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D2), MP_ROM_PTR(&pin_GPIO_B0_06) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D3), MP_ROM_PTR(&pin_GPIO_B0_07) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D4), MP_ROM_PTR(&pin_GPIO_B0_08) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D5), MP_ROM_PTR(&pin_GPIO_B0_09) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D6), MP_ROM_PTR(&pin_GPIO_B0_10) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D7), MP_ROM_PTR(&pin_GPIO_B0_11) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D8), MP_ROM_PTR(&pin_GPIO_B0_12) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D9), MP_ROM_PTR(&pin_GPIO_B0_13) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D10), MP_ROM_PTR(&pin_GPIO_B0_14) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D11), MP_ROM_PTR(&pin_GPIO_B0_15) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D12), MP_ROM_PTR(&pin_GPIO_B1_00) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D13), MP_ROM_PTR(&pin_GPIO_B1_01) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D14), MP_ROM_PTR(&pin_GPIO_B1_02) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D15), MP_ROM_PTR(&pin_GPIO_B1_03) }, + + // Touch Interface + { MP_ROM_QSTR(MP_QSTR_LCD_TOUCH_INT), MP_ROM_PTR(&pin_GPIO_AD_B0_11) }, + + // Audio Interface + { MP_ROM_QSTR(MP_QSTR_AUDIO_INT), MP_ROM_PTR(&pin_GPIO_SD_B1_03) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_MCLK), MP_ROM_PTR(&pin_GPIO_B0_13) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_RX_SYNC), MP_ROM_PTR(&pin_GPIO_B0_14) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_RX_BCLK), MP_ROM_PTR(&pin_GPIO_B0_15) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_RXD), MP_ROM_PTR(&pin_GPIO_AD_B1_00) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_TXD), MP_ROM_PTR(&pin_GPIO_AD_B1_01) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_TX_BCLK), MP_ROM_PTR(&pin_GPIO_AD_B1_02) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_TX_SYNC), MP_ROM_PTR(&pin_GPIO_AD_B1_03) }, + + // SPDIF + { MP_ROM_QSTR(MP_QSTR_SPDIF_IN), MP_ROM_PTR(&pin_GPIO_AD_B1_03) }, + { MP_ROM_QSTR(MP_QSTR_SPDIF_OUT), MP_ROM_PTR(&pin_GPIO_AD_B1_02) }, + + // Ethernet + { MP_ROM_QSTR(MP_QSTR_ETHERNET_MDIO), MP_ROM_PTR(&pin_GPIO_EMC_41) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_MDC), MP_ROM_PTR(&pin_GPIO_EMC_40) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_RXD0), MP_ROM_PTR(&pin_GPIO_B1_04) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_RXD1), MP_ROM_PTR(&pin_GPIO_B1_05) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_CRS_DV), MP_ROM_PTR(&pin_GPIO_B1_06) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_TXD0), MP_ROM_PTR(&pin_GPIO_B1_07) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_TXD1), MP_ROM_PTR(&pin_GPIO_B1_08) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_TXEN), MP_ROM_PTR(&pin_GPIO_B1_09) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_INT), MP_ROM_PTR(&pin_GPIO_SD_B1_04) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_RST), MP_ROM_PTR(&pin_GPIO_AD_B0_09) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_CLK), MP_ROM_PTR(&pin_GPIO_B1_10) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_RXER), MP_ROM_PTR(&pin_GPIO_B1_11) }, + + // Freelink UART + { MP_ROM_QSTR(MP_QSTR_FREELINK_TX), MP_ROM_PTR(&pin_GPIO_AD_B0_12) }, + { MP_ROM_QSTR(MP_QSTR_FREELINK_RX), MP_ROM_PTR(&pin_GPIO_AD_B0_13) }, + + // CAN + { MP_ROM_QSTR(MP_QSTR_CAN_TX), MP_ROM_PTR(&pin_GPIO_AD_B0_14) }, + { MP_ROM_QSTR(MP_QSTR_CAN_RX), MP_ROM_PTR(&pin_GPIO_AD_B0_15) }, + { MP_ROM_QSTR(MP_QSTR_CAN_STBY), MP_ROM_PTR(&pin_GPIO_AD_B0_05) }, + + // USB + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DP), MP_ROM_PTR(&pin_USB_OTG1_DP) }, + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DM), MP_ROM_PTR(&pin_USB_OTG1_DN) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/mimxrt10xx/boards/imxrt1050_evkb/board.c b/ports/mimxrt10xx/boards/imxrt1050_evkb/board.c new file mode 100644 index 0000000000..8a34fc4210 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1050_evkb/board.c @@ -0,0 +1,53 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * + * 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 "shared-bindings/microcontroller/Pin.h" + +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { + // SWD Pins + &pin_GPIO_AD_B0_06, // SWDIO + &pin_GPIO_AD_B0_07, // SWCLK + + // FLEXSPI QSPI + &pin_GPIO_SD_B1_05, + &pin_GPIO_SD_B1_06, + &pin_GPIO_SD_B1_07, + &pin_GPIO_SD_B1_08, + &pin_GPIO_SD_B1_09, + &pin_GPIO_SD_B1_10, + &pin_GPIO_SD_B1_11, + + // USB Pins + &pin_GPIO_AD_B0_01, + &pin_GPIO_AD_B0_03, + NULL, // Must end in NULL. +}; + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/imxrt1050_evkb/flash_config.c b/ports/mimxrt10xx/boards/imxrt1050_evkb/flash_config.c new file mode 100644 index 0000000000..110ef465bf --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1050_evkb/flash_config.c @@ -0,0 +1,144 @@ +/* + * Copyright 2017 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "boards/flash_config.h" + +#include "xip/fsl_flexspi_nor_boot.h" + +// Config for IS25WP064A with QSPI routed. +__attribute__((section(".boot_hdr.conf"))) +const flexspi_nor_config_t qspiflash_config = { + .pageSize = 256u, + .sectorSize = 4u * 1024u, + .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz, + .blockSize = 0x00010000, + .isUniformBlockSize = false, + .memConfig = + { + .tag = FLEXSPI_CFG_BLK_TAG, + .version = FLEXSPI_CFG_BLK_VERSION, + .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromSckPad, + .csHoldTime = 3u, + .csSetupTime = 3u, + + .busyOffset = 0u, // Status bit 0 indicates busy. + .busyBitPolarity = 0u, // Busy when the bit is 1. + + .deviceModeCfgEnable = 1u, + .deviceModeType = kDeviceConfigCmdType_QuadEnable, + .deviceModeSeq = { + .seqId = 4u, + .seqNum = 1u, + }, + .deviceModeArg = 0x40, + .deviceType = kFLEXSPIDeviceType_SerialNOR, + .sflashPadType = kSerialFlash_4Pads, + .serialClkFreq = kFLEXSPISerialClk_60MHz, + .sflashA1Size = FLASH_SIZE, + .lookupTable = + { + // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) + // The high 16 bits is command 1 and the low are command 0. + // Within a command, the top 6 bits are the opcode, the next two are the number + // of pads and then last byte is the operand. The operand's meaning changes + // per opcode. + + // Indices with ROM should always have the same function because the ROM + // bootloader uses it. + + // 0: ROM: Read LUTs + // Quad version + SEQUENCE( + FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, + RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), + FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, + READ_SDR, FLEXSPI_4PAD, 0x04), + // Single fast read version, good for debugging. + // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, + // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, + // READ_SDR, FLEXSPI_1PAD, 0x04), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 1: ROM: Read status + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, + READ_SDR, FLEXSPI_1PAD, 0x02), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 2: Empty + EMPTY_SEQUENCE, + + // 3: ROM: Write Enable + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, + STOP, FLEXSPI_1PAD, 0x00), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 4: Config: Write Status + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01 /* the command to send */, + WRITE_SDR, FLEXSPI_1PAD, 0x01), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 5: ROM: Erase Sector + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 6: Empty + EMPTY_SEQUENCE, + + // 7: Empty + EMPTY_SEQUENCE, + + // 8: Block Erase + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 9: ROM: Page program + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + + FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, + STOP, FLEXSPI_1PAD, 0), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 10: Empty + EMPTY_SEQUENCE, + + // 11: ROM: Chip erase + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, + STOP, FLEXSPI_1PAD, 0), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 12: Empty + EMPTY_SEQUENCE, + + // 13: ROM: Read SFDP + EMPTY_SEQUENCE, + + // 14: ROM: Restore no cmd + EMPTY_SEQUENCE, + + // 15: ROM: Dummy + EMPTY_SEQUENCE + }, + }, +}; diff --git a/ports/mimxrt10xx/boards/imxrt1050_evkb/mpconfigboard.h b/ports/mimxrt10xx/boards/imxrt1050_evkb/mpconfigboard.h new file mode 100644 index 0000000000..44e1dfaf12 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1050_evkb/mpconfigboard.h @@ -0,0 +1,27 @@ +#define MICROPY_HW_BOARD_NAME "iMX RT 1050 EVKB" +#define MICROPY_HW_MCU_NAME "IMXRT1052DVL6B" + +// If you change this, then make sure to update the linker scripts as well to +// make sure you don't overwrite code +#define CIRCUITPY_INTERNAL_NVM_SIZE 0 + +// This uses the QSPI Flash. You'll need to modify the board to access it. See +// AN12108 for instructions. https://www.nxp.com/docs/en/application-note/AN12108.pdf +// JLinkGDBServer -if SWD -device "MIMXRT1052xxx6B?BankAddr=0x60000000&Loader=QSPI" +#define BOARD_FLASH_SIZE (8 * 1024 * 1024) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO_AD_B0_09) +#define MICROPY_HW_LED_STATUS_INVERTED (1) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO_AD_B1_00) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO_AD_B1_01) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO_AD_B1_07) +#define DEFAULT_UART_BUS_TX (&pin_GPIO_AD_B1_06) + +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO_AD_B0_12) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO_AD_B0_13) + +// Put host on the second USB so that the device connection powers the board. +#define CIRCUITPY_USB_DEVICE_INSTANCE 0 +#define CIRCUITPY_USB_HOST_INSTANCE 1 diff --git a/ports/mimxrt10xx/boards/imxrt1050_evkb/mpconfigboard.mk b/ports/mimxrt10xx/boards/imxrt1050_evkb/mpconfigboard.mk new file mode 100644 index 0000000000..6627d46681 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1050_evkb/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x239A +USB_PID = 0x8084 +USB_PRODUCT = "iMX RT 1050 EVKB" +USB_MANUFACTURER = "NXP" + +CHIP_VARIANT = MIMXRT1052DVL6B +CHIP_FAMILY = MIMXRT1052 +FLASH = IS25WP064A + +CIRCUITPY_USB_HOST = 1 diff --git a/ports/mimxrt10xx/boards/imxrt1050_evkb/pins.c b/ports/mimxrt10xx/boards/imxrt1050_evkb/pins.c new file mode 100644 index 0000000000..a162463b28 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1050_evkb/pins.c @@ -0,0 +1,142 @@ +#include "shared-bindings/board/__init__.h" + +#include "supervisor/board.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_AD_B1_07) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO_AD_B1_07) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO_AD_B1_06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO_AD_B1_06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO_AD_B0_11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO_AD_B1_08) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO_AD_B0_09) }, // Connected to audio codec + { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO_AD_B0_10) }, // Connected to audio codec + { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO_AD_B1_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO_AD_B1_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO_AD_B0_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO_AD_B0_02) }, // Connected to audio codec + { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO_SD_B0_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO_SD_B0_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO_SD_B0_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO_SD_B0_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO_AD_B1_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO_AD_B1_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO_AD_B1_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO_AD_B1_00) }, + + // i2c sensor is on I2C1_SCL/SDA + + { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO_AD_B1_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO_AD_B1_11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO_AD_B1_04) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO_AD_B1_05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO_AD_B1_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO_AD_B1_00) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_USER_LED), MP_ROM_PTR(&pin_GPIO_AD_B0_09) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO_AD_B0_09) }, + + // Camera Sensor Interface + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_VSYNC), MP_ROM_PTR(&pin_GPIO_AD_B1_06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_PWDN), MP_ROM_PTR(&pin_GPIO_AD_B1_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_HSYNC), MP_ROM_PTR(&pin_GPIO_AD_B1_07) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D9), MP_ROM_PTR(&pin_GPIO_AD_B1_08) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_MCLK), MP_ROM_PTR(&pin_GPIO_AD_B1_05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D8), MP_ROM_PTR(&pin_GPIO_AD_B1_09) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D7), MP_ROM_PTR(&pin_GPIO_AD_B1_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_PIXCLK), MP_ROM_PTR(&pin_GPIO_AD_B1_04) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D6), MP_ROM_PTR(&pin_GPIO_AD_B1_11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D2), MP_ROM_PTR(&pin_GPIO_AD_B1_15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D5), MP_ROM_PTR(&pin_GPIO_AD_B1_12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D3), MP_ROM_PTR(&pin_GPIO_AD_B1_14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D4), MP_ROM_PTR(&pin_GPIO_AD_B1_13) }, + + // SD Card + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CLK), MP_ROM_PTR(&pin_GPIO_SD_B0_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_SW), MP_ROM_PTR(&pin_GPIO_B1_12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CMD), MP_ROM_PTR(&pin_GPIO_SD_B0_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_D0), MP_ROM_PTR(&pin_GPIO_SD_B0_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_D1), MP_ROM_PTR(&pin_GPIO_SD_B0_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_D2), MP_ROM_PTR(&pin_GPIO_SD_B0_04) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_D3), MP_ROM_PTR(&pin_GPIO_SD_B0_05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_PWREN), MP_ROM_PTR(&pin_GPIO_AD_B1_03) }, + + // LCD Interface + { MP_ROM_QSTR(MP_QSTR_LCD_BACKLIGHT), MP_ROM_PTR(&pin_GPIO_B1_15) }, + { MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO_AD_B0_02) }, + { MP_ROM_QSTR(MP_QSTR_LCD_ENABLE), MP_ROM_PTR(&pin_GPIO_B0_01) }, + { MP_ROM_QSTR(MP_QSTR_LCD_VSYNC), MP_ROM_PTR(&pin_GPIO_B0_03) }, + { MP_ROM_QSTR(MP_QSTR_LCD_HSYNC), MP_ROM_PTR(&pin_GPIO_B0_02) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CLK), MP_ROM_PTR(&pin_GPIO_B0_00) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D0), MP_ROM_PTR(&pin_GPIO_B0_04) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D1), MP_ROM_PTR(&pin_GPIO_B0_05) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D2), MP_ROM_PTR(&pin_GPIO_B0_06) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D3), MP_ROM_PTR(&pin_GPIO_B0_07) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D4), MP_ROM_PTR(&pin_GPIO_B0_08) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D5), MP_ROM_PTR(&pin_GPIO_B0_09) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D6), MP_ROM_PTR(&pin_GPIO_B0_10) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D7), MP_ROM_PTR(&pin_GPIO_B0_11) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D8), MP_ROM_PTR(&pin_GPIO_B0_12) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D9), MP_ROM_PTR(&pin_GPIO_B0_13) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D10), MP_ROM_PTR(&pin_GPIO_B0_14) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D11), MP_ROM_PTR(&pin_GPIO_B0_15) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D12), MP_ROM_PTR(&pin_GPIO_B1_00) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D13), MP_ROM_PTR(&pin_GPIO_B1_01) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D14), MP_ROM_PTR(&pin_GPIO_B1_02) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D15), MP_ROM_PTR(&pin_GPIO_B1_03) }, + + // Touch Interface + { MP_ROM_QSTR(MP_QSTR_LCD_TOUCH_INT), MP_ROM_PTR(&pin_GPIO_AD_B0_11) }, + + // Audio Interface + { MP_ROM_QSTR(MP_QSTR_AUDIO_INT), MP_ROM_PTR(&pin_GPIO_AD_B1_08) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_MCLK), MP_ROM_PTR(&pin_GPIO_AD_B1_09) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_RX_SYNC), MP_ROM_PTR(&pin_GPIO_AD_B1_10) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_RX_BCLK), MP_ROM_PTR(&pin_GPIO_AD_B1_11) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_RXD), MP_ROM_PTR(&pin_GPIO_AD_B1_12) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_TXD), MP_ROM_PTR(&pin_GPIO_AD_B1_13) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_TX_BCLK), MP_ROM_PTR(&pin_GPIO_AD_B1_14) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_TX_SYNC), MP_ROM_PTR(&pin_GPIO_AD_B1_15) }, + + // SPDIF + { MP_ROM_QSTR(MP_QSTR_SPDIF_IN), MP_ROM_PTR(&pin_GPIO_AD_B1_03) }, + { MP_ROM_QSTR(MP_QSTR_SPDIF_OUT), MP_ROM_PTR(&pin_GPIO_AD_B1_02) }, + + // Ethernet + { MP_ROM_QSTR(MP_QSTR_ETHERNET_MDIO), MP_ROM_PTR(&pin_GPIO_EMC_41) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_MDC), MP_ROM_PTR(&pin_GPIO_EMC_40) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_RXD0), MP_ROM_PTR(&pin_GPIO_B1_04) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_RXD1), MP_ROM_PTR(&pin_GPIO_B1_05) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_CRS_DV), MP_ROM_PTR(&pin_GPIO_B1_06) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_TXD0), MP_ROM_PTR(&pin_GPIO_B1_07) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_TXD1), MP_ROM_PTR(&pin_GPIO_B1_08) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_TXEN), MP_ROM_PTR(&pin_GPIO_B1_09) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_INT), MP_ROM_PTR(&pin_GPIO_AD_B0_10) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_RST), MP_ROM_PTR(&pin_GPIO_AD_B0_09) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_CLK), MP_ROM_PTR(&pin_GPIO_B1_10) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_RXER), MP_ROM_PTR(&pin_GPIO_B1_11) }, + + // Freelink UART + { MP_ROM_QSTR(MP_QSTR_FREELINK_TX), MP_ROM_PTR(&pin_GPIO_AD_B0_12) }, + { MP_ROM_QSTR(MP_QSTR_FREELINK_RX), MP_ROM_PTR(&pin_GPIO_AD_B0_13) }, + + // CAN + { MP_ROM_QSTR(MP_QSTR_CAN_TX), MP_ROM_PTR(&pin_GPIO_AD_B0_14) }, + { MP_ROM_QSTR(MP_QSTR_CAN_RX), MP_ROM_PTR(&pin_GPIO_AD_B0_15) }, + { MP_ROM_QSTR(MP_QSTR_CAN_STBY), MP_ROM_PTR(&pin_GPIO_AD_B0_05) }, + + // USB + #if CIRCUITPY_USB_HOST_INSTANCE == 0 + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DP), MP_ROM_PTR(&pin_USB_OTG1_DP) }, + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DM), MP_ROM_PTR(&pin_USB_OTG1_DN) }, + #elif CIRCUITPY_USB_HOST_INSTANCE == 1 + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DP), MP_ROM_PTR(&pin_USB_OTG2_DP) }, + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DM), MP_ROM_PTR(&pin_USB_OTG2_DN) }, + #endif + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/flash_config.c b/ports/mimxrt10xx/boards/metro_m7_1011/flash_config.c index e4562c1965..3b47af1d6c 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/flash_config.c +++ b/ports/mimxrt10xx/boards/metro_m7_1011/flash_config.c @@ -14,14 +14,14 @@ __attribute__((section(".boot_hdr.conf"))) const flexspi_nor_config_t qspiflash_config = { .pageSize = 256u, .sectorSize = 4u * 1024u, - .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz, + .ipcmdSerialClkFreq = kFLEXSPISerialClk_133MHz, .blockSize = 0x00010000, .isUniformBlockSize = false, .memConfig = { .tag = FLEXSPI_CFG_BLK_TAG, .version = FLEXSPI_CFG_BLK_VERSION, - .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad, + .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromSckPad, .csHoldTime = 3u, .csSetupTime = 3u, @@ -43,7 +43,7 @@ const flexspi_nor_config_t qspiflash_config = { }, .deviceType = kFLEXSPIDeviceType_SerialNOR, .sflashPadType = kSerialFlash_4Pads, - .serialClkFreq = kFLEXSPISerialClk_60MHz, + .serialClkFreq = kFLEXSPISerialClk_133MHz, .sflashA1Size = FLASH_SIZE, .lookupTable = { diff --git a/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c b/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c index 06765afe02..9ba2762f1c 100644 --- a/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c +++ b/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c @@ -77,9 +77,9 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t *self, const mcu_pin_obj_t *data, bool left_justified) { int instance = -1; - const mcu_periph_obj_t *bclk_periph = find_pin_function(mcu_sai_tx_bclk_list, bit_clock, &instance, MP_QSTR_bit_clock); - const mcu_periph_obj_t *sync_periph = find_pin_function(mcu_sai_tx_sync_list, word_select, &instance, MP_QSTR_word_select); - const mcu_periph_obj_t *data_periph = find_pin_function(mcu_sai_tx_data0_list, data, &instance, MP_QSTR_data); + const mcu_periph_obj_t *bclk_periph = find_pin_function(mcu_i2s_tx_bclk_list, bit_clock, &instance, MP_QSTR_bit_clock); + const mcu_periph_obj_t *sync_periph = find_pin_function(mcu_i2s_tx_sync_list, word_select, &instance, MP_QSTR_word_select); + const mcu_periph_obj_t *data_periph = find_pin_function(mcu_i2s_tx_data0_list, data, &instance, MP_QSTR_data); sai_transceiver_t config; SAI_GetClassicI2SConfig(&config, 16, kSAI_Stereo, 1); diff --git a/ports/mimxrt10xx/common-hal/busio/I2C.c b/ports/mimxrt10xx/common-hal/busio/I2C.c index 6c5bbea416..de1b94e80e 100644 --- a/ports/mimxrt10xx/common-hal/busio/I2C.c +++ b/ports/mimxrt10xx/common-hal/busio/I2C.c @@ -37,13 +37,17 @@ #include "sdk/drivers/lpi2c/fsl_lpi2c.h" #include "sdk/drivers/igpio/fsl_gpio.h" +#if IMXRT11XX +#define I2C_CLOCK_FREQ (24000000) +#else #define I2C_CLOCK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllClk) / 8 / (1 + CLOCK_GetDiv(kCLOCK_Lpi2cDiv))) +#endif + #define IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT5 5U // arrays use 0 based numbering: I2C1 is stored at index 0 -#define MAX_I2C 4 -STATIC bool reserved_i2c[MAX_I2C]; -STATIC bool never_reset_i2c[MAX_I2C]; +STATIC bool reserved_i2c[MP_ARRAY_SIZE(mcu_i2c_banks)]; +STATIC bool never_reset_i2c[MP_ARRAY_SIZE(mcu_i2c_banks)]; void i2c_reset(void) { for (uint i = 0; i < MP_ARRAY_SIZE(mcu_i2c_banks); i++) { @@ -63,24 +67,28 @@ static void config_periph_pin(const mcu_periph_obj_t *periph) { IOMUXC_SetPinConfig(0, 0, 0, 0, periph->pin->cfg_reg, - IOMUXC_SW_PAD_CTL_PAD_HYS(0) - | IOMUXC_SW_PAD_CTL_PAD_PUS(3) - | IOMUXC_SW_PAD_CTL_PAD_PUE(0) + IOMUXC_SW_PAD_CTL_PAD_PUS(3) + #if IMXRT10XX + | IOMUXC_SW_PAD_CTL_PAD_HYS(0) | IOMUXC_SW_PAD_CTL_PAD_PKE(1) - | IOMUXC_SW_PAD_CTL_PAD_ODE(1) | IOMUXC_SW_PAD_CTL_PAD_SPEED(2) + #endif + | IOMUXC_SW_PAD_CTL_PAD_PUE(0) + | IOMUXC_SW_PAD_CTL_PAD_ODE(1) | IOMUXC_SW_PAD_CTL_PAD_DSE(4) | IOMUXC_SW_PAD_CTL_PAD_SRE(0)); } static void i2c_check_pin_config(const mcu_pin_obj_t *pin, uint32_t pull) { IOMUXC_SetPinConfig(0, 0, 0, 0, pin->cfg_reg, - IOMUXC_SW_PAD_CTL_PAD_HYS(1) - | IOMUXC_SW_PAD_CTL_PAD_PUS(0) // Pulldown - | IOMUXC_SW_PAD_CTL_PAD_PUE(pull) // 0=nopull (keeper), 1=pull + IOMUXC_SW_PAD_CTL_PAD_PUS(0) // Pulldown + #if IMXRT10XX + | IOMUXC_SW_PAD_CTL_PAD_HYS(1) | IOMUXC_SW_PAD_CTL_PAD_PKE(1) - | IOMUXC_SW_PAD_CTL_PAD_ODE(0) | IOMUXC_SW_PAD_CTL_PAD_SPEED(2) + #endif + | IOMUXC_SW_PAD_CTL_PAD_PUE(pull) // 0=nopull (keeper), 1=pull + | IOMUXC_SW_PAD_CTL_PAD_ODE(0) | IOMUXC_SW_PAD_CTL_PAD_DSE(1) | IOMUXC_SW_PAD_CTL_PAD_SRE(0)); } diff --git a/ports/mimxrt10xx/common-hal/busio/SPI.c b/ports/mimxrt10xx/common-hal/busio/SPI.c index d88b71a403..641714bcca 100644 --- a/ports/mimxrt10xx/common-hal/busio/SPI.c +++ b/ports/mimxrt10xx/common-hal/busio/SPI.c @@ -36,14 +36,21 @@ #include +#if IMXRT11XX +#define LPSPI_MASTER_CLK_FREQ (24000000) +#else #define LPSPI_MASTER_CLK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllPfd0Clk) / (CLOCK_GetDiv(kCLOCK_LpspiDiv) + 1)) +#endif #define MAX_SPI_BUSY_RETRIES 100 // arrays use 0 based numbering: SPI1 is stored at index 0 -#define MAX_SPI 4 -STATIC bool reserved_spi[MAX_SPI]; -STATIC bool never_reset_spi[MAX_SPI]; +STATIC bool reserved_spi[MP_ARRAY_SIZE(mcu_spi_banks)]; +STATIC bool never_reset_spi[MP_ARRAY_SIZE(mcu_spi_banks)]; + +#if IMXRT11XX +STATIC const clock_ip_name_t s_lpspiClocks[] = LPSPI_CLOCKS; +#endif STATIC void config_periph_pin(const mcu_periph_obj_t *periph) { IOMUXC_SetPinMux( @@ -54,12 +61,14 @@ STATIC void config_periph_pin(const mcu_periph_obj_t *periph) { IOMUXC_SetPinConfig(0, 0, 0, 0, periph->pin->cfg_reg, - IOMUXC_SW_PAD_CTL_PAD_HYS(0) - | IOMUXC_SW_PAD_CTL_PAD_PUS(0) - | IOMUXC_SW_PAD_CTL_PAD_PUE(0) + IOMUXC_SW_PAD_CTL_PAD_PUS(0) + #if IMXRT10XX + | IOMUXC_SW_PAD_CTL_PAD_HYS(0) | IOMUXC_SW_PAD_CTL_PAD_PKE(1) - | IOMUXC_SW_PAD_CTL_PAD_ODE(0) | IOMUXC_SW_PAD_CTL_PAD_SPEED(2) + #endif + | IOMUXC_SW_PAD_CTL_PAD_PUE(0) + | IOMUXC_SW_PAD_CTL_PAD_ODE(0) | IOMUXC_SW_PAD_CTL_PAD_DSE(4) | IOMUXC_SW_PAD_CTL_PAD_SRE(0)); } @@ -68,6 +77,13 @@ void spi_reset(void) { for (uint i = 0; i < MP_ARRAY_SIZE(mcu_spi_banks); i++) { if (!never_reset_spi[i]) { reserved_spi[i] = false; + #if IMXRT11XX + // Skip resetting SPIs that aren't clocked. Doing so generates a bus fault. + if ((CCM->LPCG[s_lpspiClocks[i + 1]].STATUS0 & CCM_LPCG_STATUS0_ON_MASK) == ((uint32_t)kCLOCK_Off & CCM_LPCG_STATUS0_ON_MASK)) { + continue; + } + #endif + LPSPI_Deinit(mcu_spi_banks[i]); } } @@ -78,8 +94,8 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, const mcu_pin_obj_t *miso, bool half_duplex) { const uint32_t sck_count = MP_ARRAY_SIZE(mcu_spi_sck_list); - const uint32_t miso_count = MP_ARRAY_SIZE(mcu_spi_miso_list); - const uint32_t mosi_count = MP_ARRAY_SIZE(mcu_spi_mosi_list); + const uint32_t miso_count = MP_ARRAY_SIZE(mcu_spi_sdi_list); + const uint32_t mosi_count = MP_ARRAY_SIZE(mcu_spi_sdo_list); bool spi_taken = false; if (half_duplex) { @@ -93,13 +109,13 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, // if both MOSI and MISO exist, loop search normally if ((mosi != NULL) && (miso != NULL)) { for (uint j = 0; j < mosi_count; j++) { - if ((mcu_spi_mosi_list[i].pin != mosi) - || (mcu_spi_sck_list[i].bank_idx != mcu_spi_mosi_list[j].bank_idx)) { + if ((mcu_spi_sdo_list[i].pin != mosi) + || (mcu_spi_sck_list[i].bank_idx != mcu_spi_sdo_list[j].bank_idx)) { continue; } for (uint k = 0; k < miso_count; k++) { - if ((mcu_spi_miso_list[k].pin != miso) // everything needs the same index - || (mcu_spi_sck_list[i].bank_idx != mcu_spi_miso_list[k].bank_idx)) { + if ((mcu_spi_sdi_list[k].pin != miso) // everything needs the same index + || (mcu_spi_sck_list[i].bank_idx != mcu_spi_sdi_list[k].bank_idx)) { continue; } // if SPI is taken, break (pins never have >1 periph) @@ -109,8 +125,8 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, } // store pins if not self->clock = &mcu_spi_sck_list[i]; - self->mosi = &mcu_spi_mosi_list[j]; - self->miso = &mcu_spi_miso_list[k]; + self->mosi = &mcu_spi_sdo_list[j]; + self->miso = &mcu_spi_sdi_list[k]; break; } if (self->clock != NULL || spi_taken) { @@ -123,8 +139,8 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, // if just MISO, reduce search } else if (miso != NULL) { for (uint j = 0; j < miso_count; j++) { - if ((mcu_spi_miso_list[j].pin != miso) // only SCK and MISO need the same index - || (mcu_spi_sck_list[i].bank_idx != mcu_spi_miso_list[j].bank_idx)) { + if ((mcu_spi_sdi_list[j].pin != miso) // only SCK and MISO need the same index + || (mcu_spi_sck_list[i].bank_idx != mcu_spi_sdi_list[j].bank_idx)) { continue; } if (reserved_spi[mcu_spi_sck_list[i].bank_idx - 1]) { @@ -132,7 +148,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, break; } self->clock = &mcu_spi_sck_list[i]; - self->miso = &mcu_spi_miso_list[j]; + self->miso = &mcu_spi_sdi_list[j]; break; } if (self->clock != NULL || spi_taken) { @@ -141,8 +157,8 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, // if just MOSI, reduce search } else if (mosi != NULL) { for (uint j = 0; j < mosi_count; j++) { - if ((mcu_spi_mosi_list[j].pin != mosi) // only SCK and MOSI need the same index - || (mcu_spi_sck_list[i].bank_idx != mcu_spi_mosi_list[j].bank_idx)) { + if ((mcu_spi_sdo_list[j].pin != mosi) // only SCK and MOSI need the same index + || (mcu_spi_sck_list[i].bank_idx != mcu_spi_sdo_list[j].bank_idx)) { continue; } if (reserved_spi[mcu_spi_sck_list[i].bank_idx - 1]) { @@ -150,7 +166,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, break; } self->clock = &mcu_spi_sck_list[i]; - self->mosi = &mcu_spi_mosi_list[j]; + self->mosi = &mcu_spi_sdo_list[j]; break; } if (self->clock != NULL || spi_taken) { diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c index 088b2aefc6..e4d5fda6ae 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.c +++ b/ports/mimxrt10xx/common-hal/busio/UART.c @@ -52,11 +52,15 @@ // arrays use 0 based numbering: UART1 is stored at index 0 -#define MAX_UART 8 -STATIC bool reserved_uart[MAX_UART]; -STATIC bool never_reset_uart[MAX_UART]; +STATIC bool reserved_uart[MP_ARRAY_SIZE(mcu_uart_banks)]; +STATIC bool never_reset_uart[MP_ARRAY_SIZE(mcu_uart_banks)]; +#if IMXRT11XX +#define UART_CLOCK_FREQ (24000000) +#else #define UART_CLOCK_FREQ (CLOCK_GetPllFreq(kCLOCK_PllUsb1) / 6U) / (CLOCK_GetDiv(kCLOCK_UartDiv) + 1U) +#endif + static void config_periph_pin(const mcu_periph_obj_t *periph) { IOMUXC_SetPinMux( @@ -67,12 +71,14 @@ static void config_periph_pin(const mcu_periph_obj_t *periph) { IOMUXC_SetPinConfig(0, 0, 0, 0, periph->pin->cfg_reg, - IOMUXC_SW_PAD_CTL_PAD_HYS(0) - | IOMUXC_SW_PAD_CTL_PAD_PUS(1) - | IOMUXC_SW_PAD_CTL_PAD_PUE(1) + IOMUXC_SW_PAD_CTL_PAD_PUS(1) + #if IMXRT10XX + | IOMUXC_SW_PAD_CTL_PAD_HYS(0) | IOMUXC_SW_PAD_CTL_PAD_PKE(1) - | IOMUXC_SW_PAD_CTL_PAD_ODE(0) | IOMUXC_SW_PAD_CTL_PAD_SPEED(1) + #endif + | IOMUXC_SW_PAD_CTL_PAD_PUE(1) + | IOMUXC_SW_PAD_CTL_PAD_ODE(0) | IOMUXC_SW_PAD_CTL_PAD_DSE(6) | IOMUXC_SW_PAD_CTL_PAD_SRE(0)); } @@ -288,12 +294,14 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, IOMUXC_SetPinMux(rs485_dir->mux_reg, IOMUXC_SW_MUX_CTL_PAD_MUX_MODE_ALT5, 0, 0, 0, 0); DBGPrintf(&mp_plat_print, "\tAfter IOMUXC_SetPinMux\n"); IOMUXC_SetPinConfig(0, 0, 0, 0, rs485_dir->cfg_reg, - IOMUXC_SW_PAD_CTL_PAD_HYS(1) - | IOMUXC_SW_PAD_CTL_PAD_PUS(0) - | IOMUXC_SW_PAD_CTL_PAD_PUE(0) + IOMUXC_SW_PAD_CTL_PAD_PUS(0) + #if IMXRT10XX + | IOMUXC_SW_PAD_CTL_PAD_HYS(1) | IOMUXC_SW_PAD_CTL_PAD_PKE(1) - | IOMUXC_SW_PAD_CTL_PAD_ODE(0) | IOMUXC_SW_PAD_CTL_PAD_SPEED(2) + #endif + | IOMUXC_SW_PAD_CTL_PAD_PUE(0) + | IOMUXC_SW_PAD_CTL_PAD_ODE(0) | IOMUXC_SW_PAD_CTL_PAD_DSE(1) | IOMUXC_SW_PAD_CTL_PAD_SRE(0)); DBGPrintf(&mp_plat_print, "\tAfter IOMUXC_SetPinConfig\n"); diff --git a/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c b/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c index 2b4a78948e..31dac38bdc 100644 --- a/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c +++ b/ports/mimxrt10xx/common-hal/digitalio/DigitalInOut.c @@ -42,12 +42,14 @@ void pin_config(const mcu_pin_obj_t *pin, bool open_drain, digitalio_pull_t pull) { IOMUXC_SetPinConfig(0, 0, 0, 0, pin->cfg_reg, - IOMUXC_SW_PAD_CTL_PAD_HYS(1) - | IOMUXC_SW_PAD_CTL_PAD_PUS((pull == PULL_UP) ? 2 : 0) - | IOMUXC_SW_PAD_CTL_PAD_PUE(pull != PULL_NONE) + IOMUXC_SW_PAD_CTL_PAD_PUS((pull == PULL_UP) ? 2 : 0) + #if IMXRT10XX + | IOMUXC_SW_PAD_CTL_PAD_HYS(1) | IOMUXC_SW_PAD_CTL_PAD_PKE(1) - | IOMUXC_SW_PAD_CTL_PAD_ODE(open_drain) | IOMUXC_SW_PAD_CTL_PAD_SPEED(2) + #endif + | IOMUXC_SW_PAD_CTL_PAD_PUE(pull != PULL_NONE) + | IOMUXC_SW_PAD_CTL_PAD_ODE(open_drain) | IOMUXC_SW_PAD_CTL_PAD_DSE(1) | IOMUXC_SW_PAD_CTL_PAD_SRE(0)); } diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c index 9277f81d47..bd7d77f4fa 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c @@ -33,11 +33,14 @@ #include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/microcontroller/ResetReason.h" +#if CIRCUITPY_ANALOGIO #include "sdk/drivers/tempmon/fsl_tempmon.h" +#endif #include "sdk/drivers/ocotp/fsl_ocotp.h" #include "clocks.h" float common_hal_mcu_processor_get_temperature(void) { + #if CIRCUITPY_ANALOGIO tempmon_config_t config; TEMPMON_GetDefaultConfig(&config); @@ -50,6 +53,9 @@ float common_hal_mcu_processor_get_temperature(void) { OCOTP_Deinit(OCOTP); return temp; + #else + return 0; + #endif } uint32_t common_hal_mcu_processor_set_frequency(mcu_processor_obj_t *self, @@ -73,7 +79,11 @@ uint32_t common_hal_mcu_processor_get_frequency(void) { } void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { + #if IMXRT11XX + OCOTP_Init(OCOTP, CLOCK_GetFreq(kCLOCK_Ocotp)); + #else OCOTP_Init(OCOTP, CLOCK_GetFreq(kCLOCK_IpgClk)); + #endif // Reads shadow registers 0x01 - 0x04 (Configuration and Manufacturing Info) // into 8 bit wide destination, avoiding punning. diff --git a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c index 1b10b4d4ee..de970fa26a 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/__init__.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/__init__.c @@ -40,6 +40,8 @@ #include "supervisor/shared/safe_mode.h" #include "supervisor/shared/translate/translate.h" +#include "pins.h" + void common_hal_mcu_delay_us(uint32_t delay) { mp_hal_delay_us(delay); } @@ -107,188 +109,10 @@ const nvm_bytearray_obj_t common_hal_mcu_nvm_obj = { // This maps MCU pin names to pin objects. // NOTE: for all i.MX chips, order MUST match _iomuxc_sw_mux_ctl_pad enum -STATIC const mp_rom_map_elem_t mcu_pin_global_dict_table[] = { - #ifdef MIMXRT1011_SERIES - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_14), MP_ROM_PTR(&pin_GPIO_AD_14) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_13), MP_ROM_PTR(&pin_GPIO_AD_13) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_12), MP_ROM_PTR(&pin_GPIO_AD_12) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_11), MP_ROM_PTR(&pin_GPIO_AD_11) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_10), MP_ROM_PTR(&pin_GPIO_AD_10) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_09), MP_ROM_PTR(&pin_GPIO_AD_09) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_08), MP_ROM_PTR(&pin_GPIO_AD_08) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_07), MP_ROM_PTR(&pin_GPIO_AD_07) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_06), MP_ROM_PTR(&pin_GPIO_AD_06) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_05), MP_ROM_PTR(&pin_GPIO_AD_05) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_04), MP_ROM_PTR(&pin_GPIO_AD_04) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_03), MP_ROM_PTR(&pin_GPIO_AD_03) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_02), MP_ROM_PTR(&pin_GPIO_AD_02) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_01), MP_ROM_PTR(&pin_GPIO_AD_01) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_00), MP_ROM_PTR(&pin_GPIO_AD_00) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_14), MP_ROM_PTR(&pin_GPIO_SD_14) }, // spooky ghost pin - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_13), MP_ROM_PTR(&pin_GPIO_SD_13) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_12), MP_ROM_PTR(&pin_GPIO_SD_12) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_11), MP_ROM_PTR(&pin_GPIO_SD_11) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_10), MP_ROM_PTR(&pin_GPIO_SD_10) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_09), MP_ROM_PTR(&pin_GPIO_SD_09) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_08), MP_ROM_PTR(&pin_GPIO_SD_08) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_07), MP_ROM_PTR(&pin_GPIO_SD_07) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_06), MP_ROM_PTR(&pin_GPIO_SD_06) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_05), MP_ROM_PTR(&pin_GPIO_SD_05) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_04), MP_ROM_PTR(&pin_GPIO_SD_04) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_03), MP_ROM_PTR(&pin_GPIO_SD_03) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_02), MP_ROM_PTR(&pin_GPIO_SD_02) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_01), MP_ROM_PTR(&pin_GPIO_SD_01) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_00), MP_ROM_PTR(&pin_GPIO_SD_00) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_13), MP_ROM_PTR(&pin_GPIO_13) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_12), MP_ROM_PTR(&pin_GPIO_12) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_11), MP_ROM_PTR(&pin_GPIO_11) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_10), MP_ROM_PTR(&pin_GPIO_10) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_09), MP_ROM_PTR(&pin_GPIO_09) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_08), MP_ROM_PTR(&pin_GPIO_08) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_07), MP_ROM_PTR(&pin_GPIO_07) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_06), MP_ROM_PTR(&pin_GPIO_06) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_05), MP_ROM_PTR(&pin_GPIO_05) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_04), MP_ROM_PTR(&pin_GPIO_04) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_03), MP_ROM_PTR(&pin_GPIO_03) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_02), MP_ROM_PTR(&pin_GPIO_02) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_01), MP_ROM_PTR(&pin_GPIO_01) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_00), MP_ROM_PTR(&pin_GPIO_00) }, - #else - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_00), MP_ROM_PTR(&pin_GPIO_EMC_00) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_01), MP_ROM_PTR(&pin_GPIO_EMC_01) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_02), MP_ROM_PTR(&pin_GPIO_EMC_02) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_03), MP_ROM_PTR(&pin_GPIO_EMC_03) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_04), MP_ROM_PTR(&pin_GPIO_EMC_04) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_05), MP_ROM_PTR(&pin_GPIO_EMC_05) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_06), MP_ROM_PTR(&pin_GPIO_EMC_06) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_07), MP_ROM_PTR(&pin_GPIO_EMC_07) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_08), MP_ROM_PTR(&pin_GPIO_EMC_08) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_09), MP_ROM_PTR(&pin_GPIO_EMC_09) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_10), MP_ROM_PTR(&pin_GPIO_EMC_10) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_11), MP_ROM_PTR(&pin_GPIO_EMC_11) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_12), MP_ROM_PTR(&pin_GPIO_EMC_12) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_13), MP_ROM_PTR(&pin_GPIO_EMC_13) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_14), MP_ROM_PTR(&pin_GPIO_EMC_14) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_15), MP_ROM_PTR(&pin_GPIO_EMC_15) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_16), MP_ROM_PTR(&pin_GPIO_EMC_16) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_17), MP_ROM_PTR(&pin_GPIO_EMC_17) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_18), MP_ROM_PTR(&pin_GPIO_EMC_18) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_19), MP_ROM_PTR(&pin_GPIO_EMC_19) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_20), MP_ROM_PTR(&pin_GPIO_EMC_20) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_21), MP_ROM_PTR(&pin_GPIO_EMC_21) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_22), MP_ROM_PTR(&pin_GPIO_EMC_22) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_23), MP_ROM_PTR(&pin_GPIO_EMC_23) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_24), MP_ROM_PTR(&pin_GPIO_EMC_24) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_25), MP_ROM_PTR(&pin_GPIO_EMC_25) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_26), MP_ROM_PTR(&pin_GPIO_EMC_26) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_27), MP_ROM_PTR(&pin_GPIO_EMC_27) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_28), MP_ROM_PTR(&pin_GPIO_EMC_28) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_29), MP_ROM_PTR(&pin_GPIO_EMC_29) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_30), MP_ROM_PTR(&pin_GPIO_EMC_30) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_31), MP_ROM_PTR(&pin_GPIO_EMC_31) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_32), MP_ROM_PTR(&pin_GPIO_EMC_32) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_33), MP_ROM_PTR(&pin_GPIO_EMC_33) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_34), MP_ROM_PTR(&pin_GPIO_EMC_34) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_35), MP_ROM_PTR(&pin_GPIO_EMC_35) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_36), MP_ROM_PTR(&pin_GPIO_EMC_36) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_37), MP_ROM_PTR(&pin_GPIO_EMC_37) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_38), MP_ROM_PTR(&pin_GPIO_EMC_38) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_39), MP_ROM_PTR(&pin_GPIO_EMC_39) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_40), MP_ROM_PTR(&pin_GPIO_EMC_40) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_EMC_41), MP_ROM_PTR(&pin_GPIO_EMC_41) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_00), MP_ROM_PTR(&pin_GPIO_AD_B0_00) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_01), MP_ROM_PTR(&pin_GPIO_AD_B0_01) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_02), MP_ROM_PTR(&pin_GPIO_AD_B0_02) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_03), MP_ROM_PTR(&pin_GPIO_AD_B0_03) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_04), MP_ROM_PTR(&pin_GPIO_AD_B0_04) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_05), MP_ROM_PTR(&pin_GPIO_AD_B0_05) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_06), MP_ROM_PTR(&pin_GPIO_AD_B0_06) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_07), MP_ROM_PTR(&pin_GPIO_AD_B0_07) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_08), MP_ROM_PTR(&pin_GPIO_AD_B0_08) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_09), MP_ROM_PTR(&pin_GPIO_AD_B0_09) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_10), MP_ROM_PTR(&pin_GPIO_AD_B0_10) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_11), MP_ROM_PTR(&pin_GPIO_AD_B0_11) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_12), MP_ROM_PTR(&pin_GPIO_AD_B0_12) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_13), MP_ROM_PTR(&pin_GPIO_AD_B0_13) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_14), MP_ROM_PTR(&pin_GPIO_AD_B0_14) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B0_15), MP_ROM_PTR(&pin_GPIO_AD_B0_15) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_00), MP_ROM_PTR(&pin_GPIO_AD_B1_00) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_01), MP_ROM_PTR(&pin_GPIO_AD_B1_01) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_02), MP_ROM_PTR(&pin_GPIO_AD_B1_02) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_03), MP_ROM_PTR(&pin_GPIO_AD_B1_03) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_04), MP_ROM_PTR(&pin_GPIO_AD_B1_04) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_05), MP_ROM_PTR(&pin_GPIO_AD_B1_05) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_06), MP_ROM_PTR(&pin_GPIO_AD_B1_06) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_07), MP_ROM_PTR(&pin_GPIO_AD_B1_07) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_08), MP_ROM_PTR(&pin_GPIO_AD_B1_08) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_09), MP_ROM_PTR(&pin_GPIO_AD_B1_09) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_10), MP_ROM_PTR(&pin_GPIO_AD_B1_10) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_11), MP_ROM_PTR(&pin_GPIO_AD_B1_11) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_12), MP_ROM_PTR(&pin_GPIO_AD_B1_12) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_13), MP_ROM_PTR(&pin_GPIO_AD_B1_13) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_14), MP_ROM_PTR(&pin_GPIO_AD_B1_14) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_AD_B1_15), MP_ROM_PTR(&pin_GPIO_AD_B1_15) }, - #ifdef MIMXRT1062_SERIES - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_00), MP_ROM_PTR(&pin_GPIO_B0_00) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_01), MP_ROM_PTR(&pin_GPIO_B0_01) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_02), MP_ROM_PTR(&pin_GPIO_B0_02) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_03), MP_ROM_PTR(&pin_GPIO_B0_03) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_04), MP_ROM_PTR(&pin_GPIO_B0_04) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_05), MP_ROM_PTR(&pin_GPIO_B0_05) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_06), MP_ROM_PTR(&pin_GPIO_B0_06) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_07), MP_ROM_PTR(&pin_GPIO_B0_07) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_08), MP_ROM_PTR(&pin_GPIO_B0_08) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_09), MP_ROM_PTR(&pin_GPIO_B0_09) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_10), MP_ROM_PTR(&pin_GPIO_B0_10) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_11), MP_ROM_PTR(&pin_GPIO_B0_11) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_12), MP_ROM_PTR(&pin_GPIO_B0_12) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_13), MP_ROM_PTR(&pin_GPIO_B0_13) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_14), MP_ROM_PTR(&pin_GPIO_B0_14) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B0_15), MP_ROM_PTR(&pin_GPIO_B0_15) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_00), MP_ROM_PTR(&pin_GPIO_B1_00) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_01), MP_ROM_PTR(&pin_GPIO_B1_01) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_02), MP_ROM_PTR(&pin_GPIO_B1_02) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_03), MP_ROM_PTR(&pin_GPIO_B1_03) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_04), MP_ROM_PTR(&pin_GPIO_B1_04) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_05), MP_ROM_PTR(&pin_GPIO_B1_05) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_06), MP_ROM_PTR(&pin_GPIO_B1_06) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_07), MP_ROM_PTR(&pin_GPIO_B1_07) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_08), MP_ROM_PTR(&pin_GPIO_B1_08) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_09), MP_ROM_PTR(&pin_GPIO_B1_09) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_10), MP_ROM_PTR(&pin_GPIO_B1_10) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_11), MP_ROM_PTR(&pin_GPIO_B1_11) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_12), MP_ROM_PTR(&pin_GPIO_B1_12) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_13), MP_ROM_PTR(&pin_GPIO_B1_13) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_14), MP_ROM_PTR(&pin_GPIO_B1_14) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_B1_15), MP_ROM_PTR(&pin_GPIO_B1_15) }, - #endif - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B0_00), MP_ROM_PTR(&pin_GPIO_SD_B0_00) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B0_01), MP_ROM_PTR(&pin_GPIO_SD_B0_01) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B0_02), MP_ROM_PTR(&pin_GPIO_SD_B0_02) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B0_03), MP_ROM_PTR(&pin_GPIO_SD_B0_03) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B0_04), MP_ROM_PTR(&pin_GPIO_SD_B0_04) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B0_05), MP_ROM_PTR(&pin_GPIO_SD_B0_05) }, - #ifdef MIMXRT1021_SERIES - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B0_06), MP_ROM_PTR(&pin_GPIO_SD_B0_06) }, - #endif - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_00), MP_ROM_PTR(&pin_GPIO_SD_B1_00) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_01), MP_ROM_PTR(&pin_GPIO_SD_B1_01) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_02), MP_ROM_PTR(&pin_GPIO_SD_B1_02) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_03), MP_ROM_PTR(&pin_GPIO_SD_B1_03) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_04), MP_ROM_PTR(&pin_GPIO_SD_B1_04) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_05), MP_ROM_PTR(&pin_GPIO_SD_B1_05) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_06), MP_ROM_PTR(&pin_GPIO_SD_B1_06) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_07), MP_ROM_PTR(&pin_GPIO_SD_B1_07) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_08), MP_ROM_PTR(&pin_GPIO_SD_B1_08) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_09), MP_ROM_PTR(&pin_GPIO_SD_B1_09) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_10), MP_ROM_PTR(&pin_GPIO_SD_B1_10) }, - { MP_ROM_QSTR(MP_QSTR_GPIO_SD_B1_11), MP_ROM_PTR(&pin_GPIO_SD_B1_11) }, - #ifdef MIMXRT1062_SERIES - { MP_ROM_QSTR(MP_QSTR_USB_OTG1_DN), MP_ROM_PTR(&pin_USB_OTG1_DN) }, - { MP_ROM_QSTR(MP_QSTR_USB_OTG1_DP), MP_ROM_PTR(&pin_USB_OTG1_DP) }, - { MP_ROM_QSTR(MP_QSTR_USB_OTG2_DN), MP_ROM_PTR(&pin_USB_OTG2_DN) }, - { MP_ROM_QSTR(MP_QSTR_USB_OTG2_DP), MP_ROM_PTR(&pin_USB_OTG2_DP) }, - #endif - #endif +STATIC const mp_rom_map_elem_t mcu_pin_global_dict_table[PIN_COUNT] = { + +#define FORMAT_PIN(pin_name) { MP_ROM_QSTR(MP_QSTR_##pin_name), MP_ROM_PTR(&pin_##pin_name) }, + #include "pin_names.h" +#undef FORMAT_PIN }; MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_global_dict_table); diff --git a/ports/mimxrt10xx/common-hal/os/__init__.c b/ports/mimxrt10xx/common-hal/os/__init__.c index 9219242685..899541bb21 100644 --- a/ports/mimxrt10xx/common-hal/os/__init__.c +++ b/ports/mimxrt10xx/common-hal/os/__init__.c @@ -33,7 +33,9 @@ #include "shared-bindings/os/__init__.h" +#if CIRCUITPY_RANDOM #include "sdk/drivers/trng/fsl_trng.h" +#endif STATIC const qstr os_uname_info_fields[] = { MP_QSTR_sysname, MP_QSTR_nodename, @@ -61,6 +63,7 @@ mp_obj_t common_hal_os_uname(void) { } bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) { + #if CIRCUITPY_RANDOM trng_config_t trngConfig; TRNG_GetDefaultConfig(&trngConfig); @@ -71,4 +74,7 @@ bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) { TRNG_Deinit(TRNG); return true; + #else + return false; + #endif } diff --git a/ports/mimxrt10xx/linking/chip_family/MIMXRT1011.ld b/ports/mimxrt10xx/linking/chip_family/MIMXRT1011.ld index 0d0beebaae..55f03cb9c1 100644 --- a/ports/mimxrt10xx/linking/chip_family/MIMXRT1011.ld +++ b/ports/mimxrt10xx/linking/chip_family/MIMXRT1011.ld @@ -1,2 +1,4 @@ ram_size = 128K; -flash_config_location = 0x60000400; +flash_base = 0x60000000; +ocram_base = 0x20200000; +flash_config_location = flash_base + 0x400; diff --git a/ports/mimxrt10xx/linking/chip_family/MIMXRT1015.ld b/ports/mimxrt10xx/linking/chip_family/MIMXRT1015.ld new file mode 100644 index 0000000000..72b2b705b5 --- /dev/null +++ b/ports/mimxrt10xx/linking/chip_family/MIMXRT1015.ld @@ -0,0 +1,4 @@ +ram_size = 128K; +flash_base = 0x60000000; +ocram_base = 0x20200000; +flash_config_location = flash_base; diff --git a/ports/mimxrt10xx/linking/chip_family/MIMXRT1021.ld b/ports/mimxrt10xx/linking/chip_family/MIMXRT1021.ld index 21f2ea872c..215e58f9b3 100644 --- a/ports/mimxrt10xx/linking/chip_family/MIMXRT1021.ld +++ b/ports/mimxrt10xx/linking/chip_family/MIMXRT1021.ld @@ -1,2 +1,4 @@ ram_size = 256K; -flash_config_location = 0x60000000; +flash_base = 0x60000000; +ocram_base = 0x20200000; +flash_config_location = flash_base; diff --git a/ports/mimxrt10xx/linking/chip_family/MIMXRT1042.ld b/ports/mimxrt10xx/linking/chip_family/MIMXRT1042.ld new file mode 100644 index 0000000000..9af9660087 --- /dev/null +++ b/ports/mimxrt10xx/linking/chip_family/MIMXRT1042.ld @@ -0,0 +1,4 @@ +ram_size = 512K; +flash_base = 0x60000000; +ocram_base = 0x20200000; +flash_config_location = flash_base; diff --git a/ports/mimxrt10xx/linking/chip_family/MIMXRT1052.ld b/ports/mimxrt10xx/linking/chip_family/MIMXRT1052.ld new file mode 100644 index 0000000000..9af9660087 --- /dev/null +++ b/ports/mimxrt10xx/linking/chip_family/MIMXRT1052.ld @@ -0,0 +1,4 @@ +ram_size = 512K; +flash_base = 0x60000000; +ocram_base = 0x20200000; +flash_config_location = flash_base; diff --git a/ports/mimxrt10xx/linking/chip_family/MIMXRT1062.ld b/ports/mimxrt10xx/linking/chip_family/MIMXRT1062.ld index e07c5c2c37..1ae8172200 100644 --- a/ports/mimxrt10xx/linking/chip_family/MIMXRT1062.ld +++ b/ports/mimxrt10xx/linking/chip_family/MIMXRT1062.ld @@ -1,2 +1,4 @@ ram_size = 1M; -flash_config_location = 0x60000000; +flash_base = 0x60000000; +ocram_base = 0x20200000; +flash_config_location = flash_base; diff --git a/ports/mimxrt10xx/linking/chip_family/MIMXRT1176.ld b/ports/mimxrt10xx/linking/chip_family/MIMXRT1176.ld new file mode 100644 index 0000000000..a5d18addb7 --- /dev/null +++ b/ports/mimxrt10xx/linking/chip_family/MIMXRT1176.ld @@ -0,0 +1,4 @@ +ram_size = 1M; +flash_base = 0x30000000; +ocram_base = 0x20240000; +flash_config_location = flash_base + 0x400; diff --git a/ports/mimxrt10xx/linking/common.ld b/ports/mimxrt10xx/linking/common.ld index 76c11c8d6f..a3ed2dbdbf 100644 --- a/ports/mimxrt10xx/linking/common.ld +++ b/ports/mimxrt10xx/linking/common.ld @@ -19,13 +19,13 @@ MEMORY /* This is the first block and is read so that the bootrom knows the optimal way to interface with the flash chip. */ FLASH_CONFIG (rx) : ORIGIN = flash_config_location, LENGTH = 512 /* This can't move because the bootrom looks at this address. */ - FLASH_IVT (rx) : ORIGIN = 0x60001000, LENGTH = 4K + FLASH_IVT (rx) : ORIGIN = flash_base + 0x1000, LENGTH = 4K /* Place the ISRs 48k in to leave room for the bootloader when it is available. */ - FLASH_FIRMWARE (rx) : ORIGIN = 0x6000C000, LENGTH = code_size - 48K - FLASH_FATFS (r) : ORIGIN = 0x60000000 + code_size, LENGTH = _ld_flash_size - code_size - _ld_reserved_flash_size + FLASH_FIRMWARE (rx) : ORIGIN = flash_base + 0xC000, LENGTH = code_size - 48K + FLASH_FATFS (r) : ORIGIN = flash_base + code_size, LENGTH = _ld_flash_size - code_size - _ld_reserved_flash_size /* Teensy uses the last bit of flash for recovery. */ - RESERVED_FLASH : ORIGIN = 0x60000000 + code_size + _ld_flash_size - _ld_reserved_flash_size, LENGTH = _ld_reserved_flash_size - OCRAM (rwx) : ORIGIN = 0x20200000, LENGTH = ram_size - 64K + RESERVED_FLASH : ORIGIN = flash_base + code_size + _ld_flash_size - _ld_reserved_flash_size, LENGTH = _ld_reserved_flash_size + OCRAM (rwx) : ORIGIN = ocram_base, LENGTH = ram_size - 64K DTCM (x) : ORIGIN = 0x20000000, LENGTH = 32K ITCM (x) : ORIGIN = 0x00000000, LENGTH = 32K } @@ -135,7 +135,9 @@ SECTIONS _ld_ocram_bss_start = ADDR(.bss); _ld_ocram_bss_size = SIZEOF(.bss); _ld_heap_start = _ld_ocram_bss_start + _ld_ocram_bss_size; - _ld_heap_end = ORIGIN(OCRAM) + LENGTH(OCRAM); + _ld_ocram_start = ORIGIN(OCRAM); + _ld_ocram_end = ORIGIN(OCRAM) + LENGTH(OCRAM); + _ld_heap_end = _ld_ocram_end; .itcm : ALIGN(4) diff --git a/ports/mimxrt10xx/linking/flash/IS25WP128.ld b/ports/mimxrt10xx/linking/flash/IS25WP128.ld new file mode 100644 index 0000000000..205d9dd839 --- /dev/null +++ b/ports/mimxrt10xx/linking/flash/IS25WP128.ld @@ -0,0 +1 @@ +_ld_flash_size = 16M; diff --git a/ports/mimxrt10xx/mpconfigport.mk b/ports/mimxrt10xx/mpconfigport.mk index ae22cb69f4..b421b583be 100644 --- a/ports/mimxrt10xx/mpconfigport.mk +++ b/ports/mimxrt10xx/mpconfigport.mk @@ -11,13 +11,13 @@ CIRCUITPY_TUSB_MEM_ALIGN = 32 INTERNAL_FLASH_FILESYSTEM = 1 -CIRCUITPY_AUDIOBUSIO = 1 +CIRCUITPY_AUDIOBUSIO ?= 1 CIRCUITPY_AUDIOBUSIO_PDMIN = 0 -CIRCUITPY_AUDIOCORE = 1 +CIRCUITPY_AUDIOCORE ?= 1 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_AUDIOMIXER = 1 CIRCUITPY_AUDIOMP3 = 1 -CIRCUITPY_AUDIOPWMIO = 1 +CIRCUITPY_AUDIOPWMIO ?= 1 CIRCUITPY_SYNTHIO_MAX_CHANNELS = 12 CIRCUITPY_BUSDEVICE = 1 CIRCUITPY_COUNTIO = 0 diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/clocks.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/clocks.c index e96b55f3e9..69ce673a0e 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/clocks.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/clocks.c @@ -35,6 +35,8 @@ #include "fsl_clock.h" #include "fsl_iomuxc.h" +#include "board.h" + #include "clocks.h" #define BOARD_XTAL0_CLK_HZ 24000000U /*!< Board xtal0 frequency in Hz */ diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c index b67f7b1179..fd8ef69f7e 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c @@ -5,6 +5,7 @@ * * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 @@ -65,7 +66,7 @@ const mcu_periph_obj_t mcu_spi_sck_list[4] = { PERIPH_PIN(2, 1, kIOMUXC_LPSPI2_SCK_SELECT_INPUT, 1, &pin_GPIO_SD_11), }; -const mcu_periph_obj_t mcu_spi_mosi_list[4] = { +const mcu_periph_obj_t mcu_spi_sdo_list[4] = { PERIPH_PIN(1, 0, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 0, &pin_GPIO_AD_04), PERIPH_PIN(1, 2, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 1, &pin_GPIO_SD_06), @@ -73,7 +74,7 @@ const mcu_periph_obj_t mcu_spi_mosi_list[4] = { PERIPH_PIN(2, 1, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 1, &pin_GPIO_SD_10), }; -const mcu_periph_obj_t mcu_spi_miso_list[4] = { +const mcu_periph_obj_t mcu_spi_sdi_list[4] = { PERIPH_PIN(1, 0, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 0, &pin_GPIO_AD_03), PERIPH_PIN(1, 2, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 1, &pin_GPIO_SD_05), @@ -120,7 +121,7 @@ const mcu_periph_obj_t mcu_uart_rts_list[4] = { PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_13), - PERIPH_PIN(4, 3, 0, 0, &pin_GPIO_AD_13) + PERIPH_PIN(4, 3, 0, 0, &pin_GPIO_AD_13), }; const mcu_periph_obj_t mcu_uart_cts_list[4] = { @@ -133,67 +134,76 @@ const mcu_periph_obj_t mcu_uart_cts_list[4] = { PERIPH_PIN(4, 3, 0, 0, &pin_GPIO_AD_14), }; -const mcu_pwm_obj_t mcu_pwm_list[20] = { - PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_02_FLEXPWM1_PWM0_A, &pin_GPIO_02), - PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_SD_02_FLEXPWM1_PWM0_A, &pin_GPIO_SD_02), +I2S_Type *const mcu_i2s_banks[2] = { SAI1, SAI3 }; + +const mcu_periph_obj_t mcu_i2s_rx_data0_list[2] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_03), + + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_SD_03), +}; + +const mcu_periph_obj_t mcu_i2s_rx_sync_list[2] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_02), + + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_SD_04), +}; + +const mcu_periph_obj_t mcu_i2s_tx_bclk_list[2] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_06), + + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_SD_01), +}; + +const mcu_periph_obj_t mcu_i2s_tx_data0_list[2] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_04), + + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_SD_02), +}; + +const mcu_periph_obj_t mcu_i2s_tx_sync_list[2] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_07), + + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_SD_00), +}; + +const mcu_periph_obj_t mcu_mqs_left_list[1] = { + PERIPH_PIN(3, 4, 0, 0, &pin_GPIO_AD_01), +}; + +const mcu_periph_obj_t mcu_mqs_right_list[1] = { + PERIPH_PIN(3, 4, 0, 0, &pin_GPIO_AD_02), +}; + +const mcu_pwm_obj_t mcu_pwm_list[20] = { + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_SD_02_FLEXPWM1_PWM0_A, &pin_GPIO_SD_02), + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_02_FLEXPWM1_PWM0_A, &pin_GPIO_02), - PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_01_FLEXPWM1_PWM0_B, &pin_GPIO_01), PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_SD_01_FLEXPWM1_PWM0_B, &pin_GPIO_SD_01), + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_01_FLEXPWM1_PWM0_B, &pin_GPIO_01), PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmX, IOMUXC_GPIO_AD_12_FLEXPWM1_PWM0_X, &pin_GPIO_AD_12), - PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_04_FLEXPWM1_PWM1_A, &pin_GPIO_04), PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_SD_04_FLEXPWM1_PWM1_A, &pin_GPIO_SD_04), + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_04_FLEXPWM1_PWM1_A, &pin_GPIO_04), - PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_03_FLEXPWM1_PWM1_B, &pin_GPIO_03), PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_SD_03_FLEXPWM1_PWM1_B, &pin_GPIO_SD_03), + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_03_FLEXPWM1_PWM1_B, &pin_GPIO_03), PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmX, IOMUXC_GPIO_AD_11_FLEXPWM1_PWM1_X, &pin_GPIO_AD_11), - PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_06_FLEXPWM1_PWM2_A, &pin_GPIO_06), PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_AD_04_FLEXPWM1_PWM2_A, &pin_GPIO_AD_04), + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_06_FLEXPWM1_PWM2_A, &pin_GPIO_06), - PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_05_FLEXPWM1_PWM2_B, &pin_GPIO_05), PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_AD_03_FLEXPWM1_PWM2_B, &pin_GPIO_AD_03), + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_05_FLEXPWM1_PWM2_B, &pin_GPIO_05), PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmX, IOMUXC_GPIO_AD_10_FLEXPWM1_PWM2_X, &pin_GPIO_AD_10), - PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_08_FLEXPWM1_PWM3_A, &pin_GPIO_08), PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_06_FLEXPWM1_PWM3_A, &pin_GPIO_AD_06), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_08_FLEXPWM1_PWM3_A, &pin_GPIO_08), - PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_07_FLEXPWM1_PWM3_B, &pin_GPIO_07), PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_AD_05_FLEXPWM1_PWM3_B, &pin_GPIO_AD_05), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_07_FLEXPWM1_PWM3_B, &pin_GPIO_07), PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmX, IOMUXC_GPIO_AD_09_FLEXPWM1_PWM3_X, &pin_GPIO_AD_09), }; - -const mcu_periph_obj_t mcu_sai_rx_bclk_list[] = { - PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_08), - PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_00), -}; -const mcu_periph_obj_t mcu_sai_rx_data0_list[] = { - PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_03), - PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_SD_03), -}; -const mcu_periph_obj_t mcu_sai_rx_sync_list[] = { - PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_02), - PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_SD_04), -}; -const mcu_periph_obj_t mcu_sai_tx_bclk_list[] = { - PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_06), - PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_SD_01), -}; -const mcu_periph_obj_t mcu_sai_tx_data0_list[] = { - PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_04), - PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_SD_02), -}; -const mcu_periph_obj_t mcu_sai_tx_sync_list[] = { - PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_07), - PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_SD_00), -}; -const mcu_periph_obj_t mcu_mqs_left_list[] = { - PERIPH_PIN(3, 4, 0, 0, &pin_GPIO_AD_01), -}; -const mcu_periph_obj_t mcu_mqs_right_list[] = { - PERIPH_PIN(3, 4, 0, 0, &pin_GPIO_AD_02), -}; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h index 045e33ca0e..e03e2c7967 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h @@ -3,7 +3,9 @@ * * The MIT License (MIT) * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 @@ -24,37 +26,30 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_MIMXRT10XX_MIMXRT1011_PERIPHERALS_MIMXRT1011_PERIPH_H -#define MICROPY_INCLUDED_MIMXRT10XX_MIMXRT1011_PERIPHERALS_MIMXRT1011_PERIPH_H - +#pragma once extern LPI2C_Type *const mcu_i2c_banks[2]; - extern const mcu_periph_obj_t mcu_i2c_sda_list[8]; extern const mcu_periph_obj_t mcu_i2c_scl_list[8]; extern LPSPI_Type *const mcu_spi_banks[2]; - extern const mcu_periph_obj_t mcu_spi_sck_list[4]; -extern const mcu_periph_obj_t mcu_spi_mosi_list[4]; -extern const mcu_periph_obj_t mcu_spi_miso_list[4]; +extern const mcu_periph_obj_t mcu_spi_sdo_list[4]; +extern const mcu_periph_obj_t mcu_spi_sdi_list[4]; extern LPUART_Type *const mcu_uart_banks[4]; - extern const mcu_periph_obj_t mcu_uart_rx_list[9]; extern const mcu_periph_obj_t mcu_uart_tx_list[9]; extern const mcu_periph_obj_t mcu_uart_rts_list[4]; extern const mcu_periph_obj_t mcu_uart_cts_list[4]; -extern const mcu_pwm_obj_t mcu_pwm_list[20]; - -extern const mcu_periph_obj_t mcu_sai_rx_bclk_list[2]; -extern const mcu_periph_obj_t mcu_sai_rx_data0_list[2]; -extern const mcu_periph_obj_t mcu_sai_rx_sync_list[2]; -extern const mcu_periph_obj_t mcu_sai_tx_bclk_list[2]; -extern const mcu_periph_obj_t mcu_sai_tx_data0_list[2]; -extern const mcu_periph_obj_t mcu_sai_tx_sync_list[2]; +extern I2S_Type *const mcu_i2s_banks[2]; +extern const mcu_periph_obj_t mcu_i2s_rx_data0_list[2]; +extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[2]; +extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[2]; +extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[2]; +extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[2]; extern const mcu_periph_obj_t mcu_mqs_left_list[1]; extern const mcu_periph_obj_t mcu_mqs_right_list[1]; -#endif // MICROPY_INCLUDED_MIMXRT10XX_MIMXRT1011_PERIPHERALS_MIMXRT1011_PERIPH_H +extern const mcu_pwm_obj_t mcu_pwm_list[20]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pin_names.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pin_names.h new file mode 100644 index 0000000000..b197256a36 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pin_names.h @@ -0,0 +1,78 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + + +// define FORMAT_PIN(pin_name) and then include this file. + +FORMAT_PIN(GPIO_AD_14) +FORMAT_PIN(GPIO_AD_13) +FORMAT_PIN(GPIO_AD_12) +FORMAT_PIN(GPIO_AD_11) +FORMAT_PIN(GPIO_AD_10) +FORMAT_PIN(GPIO_AD_09) +FORMAT_PIN(GPIO_AD_08) +FORMAT_PIN(GPIO_AD_07) +FORMAT_PIN(GPIO_AD_06) +FORMAT_PIN(GPIO_AD_05) +FORMAT_PIN(GPIO_AD_04) +FORMAT_PIN(GPIO_AD_03) +FORMAT_PIN(GPIO_AD_02) +FORMAT_PIN(GPIO_AD_01) +FORMAT_PIN(GPIO_AD_00) + +FORMAT_PIN(GPIO_SD_13) +FORMAT_PIN(GPIO_SD_12) +FORMAT_PIN(GPIO_SD_11) +FORMAT_PIN(GPIO_SD_10) +FORMAT_PIN(GPIO_SD_09) +FORMAT_PIN(GPIO_SD_08) +FORMAT_PIN(GPIO_SD_07) +FORMAT_PIN(GPIO_SD_06) +FORMAT_PIN(GPIO_SD_05) +FORMAT_PIN(GPIO_SD_04) +FORMAT_PIN(GPIO_SD_03) +FORMAT_PIN(GPIO_SD_02) +FORMAT_PIN(GPIO_SD_01) +FORMAT_PIN(GPIO_SD_00) + +FORMAT_PIN(GPIO_13) +FORMAT_PIN(GPIO_12) +FORMAT_PIN(GPIO_11) +FORMAT_PIN(GPIO_10) +FORMAT_PIN(GPIO_09) +FORMAT_PIN(GPIO_08) +FORMAT_PIN(GPIO_07) +FORMAT_PIN(GPIO_06) +FORMAT_PIN(GPIO_05) +FORMAT_PIN(GPIO_04) +FORMAT_PIN(GPIO_03) +FORMAT_PIN(GPIO_02) +FORMAT_PIN(GPIO_01) +FORMAT_PIN(GPIO_00) +FORMAT_PIN(USB_OTG1_DN) +FORMAT_PIN(USB_OTG1_DP) diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c index 492d1c6f08..a2b38a8a67 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c @@ -5,6 +5,7 @@ * * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 @@ -29,48 +30,49 @@ #include "py/mphal.h" #include "mimxrt10xx/pins.h" -const mcu_pin_obj_t pin_GPIO_00 = PIN(GPIO1, 0, GPIO_00, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_01 = PIN(GPIO1, 1, GPIO_01, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_02 = PIN(GPIO1, 2, GPIO_02, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_03 = PIN(GPIO1, 3, GPIO_03, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_04 = PIN(GPIO1, 4, GPIO_04, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_05 = PIN(GPIO1, 5, GPIO_05, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_06 = PIN(GPIO1, 6, GPIO_06, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_07 = PIN(GPIO1, 7, GPIO_07, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_08 = PIN(GPIO1, 8, GPIO_08, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_09 = PIN(GPIO1, 9, GPIO_09, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_10 = PIN(GPIO1, 10, GPIO_10, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_11 = PIN(GPIO1, 11, GPIO_11, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_12 = PIN(GPIO1, 12, GPIO_12, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_13 = PIN(GPIO1, 13, GPIO_13, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_00 = PIN(GPIO1, 14, GPIO_AD_00, ADC1, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_01 = PIN(GPIO1, 15, GPIO_AD_01, ADC1, 1, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_02 = PIN(GPIO1, 16, GPIO_AD_02, ADC1, 2, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_03 = PIN(GPIO1, 17, GPIO_AD_03, ADC1, 3, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_04 = PIN(GPIO1, 18, GPIO_AD_04, ADC1, 4, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_05 = PIN(GPIO1, 19, GPIO_AD_05, ADC1, 5, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_06 = PIN(GPIO1, 20, GPIO_AD_06, ADC1, 6, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_07 = PIN(GPIO1, 21, GPIO_AD_07, ADC1, 7, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_AD_08 = PIN(GPIO1, 22, GPIO_AD_08, ADC1, 8, 0x00000007, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_09 = PIN(GPIO1, 23, GPIO_AD_09, ADC1, 9, 0x00000007, 0x000090B1); -const mcu_pin_obj_t pin_GPIO_AD_10 = PIN(GPIO1, 24, GPIO_AD_10, ADC1, 10, 0x00000007, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_11 = PIN(GPIO1, 25, GPIO_AD_11, ADC1, 11, 0x00000007, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_AD_12 = PIN(GPIO1, 26, GPIO_AD_12, ADC1, 12, 0x00000007, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_AD_13 = PIN(GPIO1, 27, GPIO_AD_13, ADC1, 13, 0x00000007, 0x000070A0); const mcu_pin_obj_t pin_GPIO_AD_14 = PIN(GPIO1, 28, GPIO_AD_14, ADC1, 14, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_00 = PIN(GPIO2, 0, GPIO_SD_00, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_01 = PIN(GPIO2, 1, GPIO_SD_01, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_02 = PIN(GPIO2, 2, GPIO_SD_02, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_03 = PIN(GPIO2, 3, GPIO_SD_03, NO_ADC, 0, 0x00000006, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_SD_04 = PIN(GPIO2, 4, GPIO_SD_04, NO_ADC, 0, 0x00000006, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_SD_05 = PIN(GPIO2, 5, GPIO_SD_05, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_06 = PIN(GPIO2, 6, GPIO_SD_06, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_07 = PIN(GPIO2, 7, GPIO_SD_07, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_08 = PIN(GPIO2, 8, GPIO_SD_08, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_09 = PIN(GPIO2, 9, GPIO_SD_09, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_10 = PIN(GPIO2, 10, GPIO_SD_10, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_11 = PIN(GPIO2, 11, GPIO_SD_11, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_12 = PIN(GPIO2, 12, GPIO_SD_12, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_13 = PIN(GPIO1, 27, GPIO_AD_13, ADC1, 13, 0x00000007, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_12 = PIN(GPIO1, 26, GPIO_AD_12, ADC1, 12, 0x00000007, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_11 = PIN(GPIO1, 25, GPIO_AD_11, ADC1, 11, 0x00000007, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_10 = PIN(GPIO1, 24, GPIO_AD_10, ADC1, 10, 0x00000007, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_09 = PIN(GPIO1, 23, GPIO_AD_09, ADC1, 9, 0x00000007, 0x000090B1); +const mcu_pin_obj_t pin_GPIO_AD_08 = PIN(GPIO1, 22, GPIO_AD_08, ADC1, 8, 0x00000007, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_07 = PIN(GPIO1, 21, GPIO_AD_07, ADC1, 7, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_06 = PIN(GPIO1, 20, GPIO_AD_06, ADC1, 6, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_05 = PIN(GPIO1, 19, GPIO_AD_05, ADC1, 5, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_04 = PIN(GPIO1, 18, GPIO_AD_04, ADC1, 4, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_03 = PIN(GPIO1, 17, GPIO_AD_03, ADC1, 3, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_02 = PIN(GPIO1, 16, GPIO_AD_02, ADC1, 2, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_01 = PIN(GPIO1, 15, GPIO_AD_01, ADC1, 1, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_AD_00 = PIN(GPIO1, 14, GPIO_AD_00, ADC1, 0, 0x00000005, 0x000010A0); const mcu_pin_obj_t pin_GPIO_SD_13 = PIN(GPIO2, 13, GPIO_SD_13, NO_ADC, 0, 0x00000005, 0x000010A0); -const mcu_pin_obj_t pin_GPIO_SD_14 = PIN(GPIO2, 14, GPIO_SD_14, NO_ADC, 0, 0x00000000, 0x000010A0); -// pin_GPIO_SD_14 isn't actually used as a pad but we include it anyway to make resetting easier +const mcu_pin_obj_t pin_GPIO_SD_12 = PIN(GPIO2, 12, GPIO_SD_12, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_11 = PIN(GPIO2, 11, GPIO_SD_11, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_10 = PIN(GPIO2, 10, GPIO_SD_10, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_09 = PIN(GPIO2, 9, GPIO_SD_09, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_08 = PIN(GPIO2, 8, GPIO_SD_08, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_07 = PIN(GPIO2, 7, GPIO_SD_07, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_06 = PIN(GPIO2, 6, GPIO_SD_06, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_05 = PIN(GPIO2, 5, GPIO_SD_05, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_04 = PIN(GPIO2, 4, GPIO_SD_04, NO_ADC, 0, 0x00000006, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_SD_03 = PIN(GPIO2, 3, GPIO_SD_03, NO_ADC, 0, 0x00000006, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_SD_02 = PIN(GPIO2, 2, GPIO_SD_02, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_01 = PIN(GPIO2, 1, GPIO_SD_01, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_SD_00 = PIN(GPIO2, 0, GPIO_SD_00, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_13 = PIN(GPIO1, 13, GPIO_13, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_12 = PIN(GPIO1, 12, GPIO_12, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_11 = PIN(GPIO1, 11, GPIO_11, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_10 = PIN(GPIO1, 10, GPIO_10, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_09 = PIN(GPIO1, 9, GPIO_09, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_08 = PIN(GPIO1, 8, GPIO_08, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_07 = PIN(GPIO1, 7, GPIO_07, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_06 = PIN(GPIO1, 6, GPIO_06, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_05 = PIN(GPIO1, 5, GPIO_05, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_04 = PIN(GPIO1, 4, GPIO_04, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_03 = PIN(GPIO1, 3, GPIO_03, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_02 = PIN(GPIO1, 2, GPIO_02, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_01 = PIN(GPIO1, 1, GPIO_01, NO_ADC, 0, 0x00000005, 0x000010A0); +const mcu_pin_obj_t pin_GPIO_00 = PIN(GPIO1, 0, GPIO_00, NO_ADC, 0, 0x00000005, 0x000010A0); + +const mcu_pin_obj_t pin_USB_OTG1_DN = { { &mcu_pin_type }, }; +const mcu_pin_obj_t pin_USB_OTG1_DP = { { &mcu_pin_type }, }; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h index 58ef7329e7..118eff9335 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h @@ -3,7 +3,9 @@ * * The MIT License (MIT) * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 @@ -24,56 +26,11 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PINS_H -#define MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PINS_H +#pragma once -extern const mcu_pin_obj_t pin_GPIO_00; -extern const mcu_pin_obj_t pin_GPIO_01; -extern const mcu_pin_obj_t pin_GPIO_02; -extern const mcu_pin_obj_t pin_GPIO_03; -extern const mcu_pin_obj_t pin_GPIO_04; -extern const mcu_pin_obj_t pin_GPIO_05; -extern const mcu_pin_obj_t pin_GPIO_06; -extern const mcu_pin_obj_t pin_GPIO_07; -extern const mcu_pin_obj_t pin_GPIO_08; -extern const mcu_pin_obj_t pin_GPIO_09; -extern const mcu_pin_obj_t pin_GPIO_10; -extern const mcu_pin_obj_t pin_GPIO_11; -extern const mcu_pin_obj_t pin_GPIO_12; -extern const mcu_pin_obj_t pin_GPIO_13; +#define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; +#include "pin_names.h" +#undef FORMAT_PIN -extern const mcu_pin_obj_t pin_GPIO_SD_00; -extern const mcu_pin_obj_t pin_GPIO_SD_01; -extern const mcu_pin_obj_t pin_GPIO_SD_02; -extern const mcu_pin_obj_t pin_GPIO_SD_03; -extern const mcu_pin_obj_t pin_GPIO_SD_04; -extern const mcu_pin_obj_t pin_GPIO_SD_05; -extern const mcu_pin_obj_t pin_GPIO_SD_06; -extern const mcu_pin_obj_t pin_GPIO_SD_07; -extern const mcu_pin_obj_t pin_GPIO_SD_08; -extern const mcu_pin_obj_t pin_GPIO_SD_09; -extern const mcu_pin_obj_t pin_GPIO_SD_10; -extern const mcu_pin_obj_t pin_GPIO_SD_11; -extern const mcu_pin_obj_t pin_GPIO_SD_12; -extern const mcu_pin_obj_t pin_GPIO_SD_13; -extern const mcu_pin_obj_t pin_GPIO_SD_14; - -extern const mcu_pin_obj_t pin_GPIO_AD_00; -extern const mcu_pin_obj_t pin_GPIO_AD_01; -extern const mcu_pin_obj_t pin_GPIO_AD_02; -extern const mcu_pin_obj_t pin_GPIO_AD_03; -extern const mcu_pin_obj_t pin_GPIO_AD_04; -extern const mcu_pin_obj_t pin_GPIO_AD_05; -extern const mcu_pin_obj_t pin_GPIO_AD_06; -extern const mcu_pin_obj_t pin_GPIO_AD_07; -extern const mcu_pin_obj_t pin_GPIO_AD_08; -extern const mcu_pin_obj_t pin_GPIO_AD_09; -extern const mcu_pin_obj_t pin_GPIO_AD_10; -extern const mcu_pin_obj_t pin_GPIO_AD_11; -extern const mcu_pin_obj_t pin_GPIO_AD_12; -extern const mcu_pin_obj_t pin_GPIO_AD_13; -extern const mcu_pin_obj_t pin_GPIO_AD_14; - -extern const mcu_pin_obj_t mcu_pin_list[IOMUXC_SW_PAD_CTL_PAD_COUNT]; - -#endif // MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1011_PINS_H +#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 2) +extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/clocks.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/clocks.c new file mode 100644 index 0000000000..bef213a7c7 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/clocks.c @@ -0,0 +1,315 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Artur Pacholec + * + * 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. + */ +/* + * Copyright 2019 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "mpconfigport.h" + +#include "fsl_clock.h" +#include "fsl_iomuxc.h" + +#include "supervisor/linker.h" + +#include "board.h" + +#include "clocks.h" + +#define BOARD_XTAL0_CLK_HZ 24000000U /*!< Board xtal0 frequency in Hz */ +#define BOARD_XTAL32K_CLK_HZ 32768U /*!< Board xtal32k frequency in Hz */ + +#define BOARD_BOOTCLOCKRUN_CORE_CLOCK 500000000U /*!< Core clock frequency: 500000000Hz */ + +/* Clock outputs (values are in Hz): */ +#define BOARD_BOOTCLOCKRUN_AHB_CLK_ROOT 500000000UL +#define BOARD_BOOTCLOCKRUN_CKIL_SYNC_CLK_ROOT 32768UL +#define BOARD_BOOTCLOCKRUN_CLKO1_CLK 0UL +#define BOARD_BOOTCLOCKRUN_CLKO2_CLK 0UL +#define BOARD_BOOTCLOCKRUN_CLK_1M 1000000UL +#define BOARD_BOOTCLOCKRUN_CLK_24M 24000000UL +#define BOARD_BOOTCLOCKRUN_ENET_500M_REF_CLK 500000000UL +#define BOARD_BOOTCLOCKRUN_FLEXIO1_CLK_ROOT 30000000UL +#define BOARD_BOOTCLOCKRUN_FLEXSPI_CLK_ROOT 196363636UL +#define BOARD_BOOTCLOCKRUN_GPT1_IPG_CLK_HIGHFREQ 62500000UL +#define BOARD_BOOTCLOCKRUN_GPT2_IPG_CLK_HIGHFREQ 62500000UL +#define BOARD_BOOTCLOCKRUN_IPG_CLK_ROOT 125000000UL +#define BOARD_BOOTCLOCKRUN_LPI2C_CLK_ROOT 60000000UL +#define BOARD_BOOTCLOCKRUN_LPSPI_CLK_ROOT 105600000UL +#define BOARD_BOOTCLOCKRUN_MQS_MCLK 63529411UL +#define BOARD_BOOTCLOCKRUN_PERCLK_CLK_ROOT 62500000UL +#define BOARD_BOOTCLOCKRUN_SAI1_CLK_ROOT 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI1_MCLK1 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI1_MCLK2 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI1_MCLK3 30000000UL +#define BOARD_BOOTCLOCKRUN_SAI2_CLK_ROOT 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI2_MCLK1 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI2_MCLK2 0UL +#define BOARD_BOOTCLOCKRUN_SAI2_MCLK3 30000000UL +#define BOARD_BOOTCLOCKRUN_SAI3_CLK_ROOT 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI3_MCLK1 63529411UL +#define BOARD_BOOTCLOCKRUN_SAI3_MCLK2 0UL +#define BOARD_BOOTCLOCKRUN_SAI3_MCLK3 30000000UL +#define BOARD_BOOTCLOCKRUN_SPDIF0_CLK_ROOT 30000000UL +#define BOARD_BOOTCLOCKRUN_SPDIF0_EXTCLK_OUT 0UL +#define BOARD_BOOTCLOCKRUN_TRACE_CLK_ROOT 117333333UL +#define BOARD_BOOTCLOCKRUN_UART_CLK_ROOT 80000000UL +#define BOARD_BOOTCLOCKRUN_USBPHY1_CLK 0UL + + +const clock_sys_pll_config_t sysPllConfig_BOARD_BootClockRUN = +{ + .loopDivider = 1, /* PLL loop divider, Fout = Fin * ( 20 + loopDivider*2 + numerator / denominator ) */ + .numerator = 0, /* 30 bit numerator of fractional loop divider */ + .denominator = 1, /* 30 bit denominator of fractional loop divider */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ +}; +const clock_usb_pll_config_t usb1PllConfig_BOARD_BootClockRUN = +{ + .loopDivider = 0, /* PLL loop divider, Fout = Fin * 20 */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ +}; +const clock_enet_pll_config_t enetPllConfig_BOARD_BootClockRUN = +{ + .enableClkOutput500M = true, /* Enable the PLL providing the ENET 500MHz reference clock */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ +}; + +// Based on the hello_world example in the SDK +void clocks_init(void) { + /* Init RTC OSC clock frequency. */ + CLOCK_SetRtcXtalFreq(32768U); + /* Enable 1MHz clock output. */ + XTALOSC24M->OSC_CONFIG2 |= XTALOSC24M_OSC_CONFIG2_ENABLE_1M_MASK; + /* Use free 1MHz clock output. */ + XTALOSC24M->OSC_CONFIG2 &= ~XTALOSC24M_OSC_CONFIG2_MUX_1M_MASK; + /* Set XTAL 24MHz clock frequency. */ + CLOCK_SetXtalFreq(24000000U); + /* Enable XTAL 24MHz clock source. */ + CLOCK_InitExternalClk(0); + /* Enable internal RC. */ + CLOCK_InitRcOsc24M(); + /* Switch clock source to external OSC. */ + CLOCK_SwitchOsc(kCLOCK_XtalOsc); + /* Set Oscillator ready counter value. */ + CCM->CCR = (CCM->CCR & (~CCM_CCR_OSCNT_MASK)) | CCM_CCR_OSCNT(127); + /* Setting PeriphClk2Mux and PeriphMux to provide stable clock before PLLs are initialed */ + CLOCK_SetMux(kCLOCK_PeriphClk2Mux, 1); /* Set PERIPH_CLK2 MUX to OSC */ + CLOCK_SetMux(kCLOCK_PeriphMux, 1); /* Set PERIPH_CLK MUX to PERIPH_CLK2 */ + /* Setting the VDD_SOC to 1.25V. It is necessary to config AHB to 500Mhz. */ + DCDC->REG3 = (DCDC->REG3 & (~DCDC_REG3_TRG_MASK)) | DCDC_REG3_TRG(0x12); + /* Waiting for DCDC_STS_DC_OK bit is asserted */ + while (DCDC_REG0_STS_DC_OK_MASK != (DCDC_REG0_STS_DC_OK_MASK & DCDC->REG0)) { + } + /* Set AHB_PODF. */ + CLOCK_SetDiv(kCLOCK_AhbDiv, 0); + /* Disable IPG clock gate. */ + CLOCK_DisableClock(kCLOCK_Adc1); + CLOCK_DisableClock(kCLOCK_Xbar1); + CLOCK_DisableClock(kCLOCK_Xbar2); + /* Set IPG_PODF. */ + CLOCK_SetDiv(kCLOCK_IpgDiv, 3); + /* Set ARM_PODF. */ + CLOCK_SetDiv(kCLOCK_ArmDiv, 0); + /* Set PERIPH_CLK2_PODF. */ + CLOCK_SetDiv(kCLOCK_PeriphClk2Div, 0); + /* Disable PERCLK clock gate. */ + CLOCK_DisableClock(kCLOCK_Gpt1); + CLOCK_DisableClock(kCLOCK_Gpt1S); + CLOCK_DisableClock(kCLOCK_Gpt2); + CLOCK_DisableClock(kCLOCK_Gpt2S); + CLOCK_DisableClock(kCLOCK_Pit); + /* Set PERCLK_PODF. */ + CLOCK_SetDiv(kCLOCK_PerclkDiv, 1); + /* Set SEMC_PODF. */ + CLOCK_SetDiv(kCLOCK_SemcDiv, 1); + /* Set Semc alt clock source. */ + CLOCK_SetMux(kCLOCK_SemcAltMux, 0); + /* Set Semc clock source. */ + CLOCK_SetMux(kCLOCK_SemcMux, 0); + /* In SDK projects, external flash (configured by FLEXSPI) will be initialized by dcd. + * With this macro XIP_EXTERNAL_FLASH, usb1 pll (selected to be FLEXSPI clock source in SDK projects) will be left unchanged. + * Note: If another clock source is selected for FLEXSPI, user may want to avoid changing that clock as well.*/ + #if !(defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)) + /* Disable Flexspi clock gate. */ + CLOCK_DisableClock(kCLOCK_FlexSpi); + /* Set FLEXSPI_PODF. */ + CLOCK_SetDiv(kCLOCK_FlexspiDiv, 1); + /* Set Flexspi clock source. */ + CLOCK_SetMux(kCLOCK_FlexspiMux, 3); + #endif + /* Disable LPSPI clock gate. */ + CLOCK_DisableClock(kCLOCK_Lpspi1); + CLOCK_DisableClock(kCLOCK_Lpspi2); + /* Set LPSPI_PODF. */ + CLOCK_SetDiv(kCLOCK_LpspiDiv, 4); + /* Set Lpspi clock source. */ + CLOCK_SetMux(kCLOCK_LpspiMux, 2); + /* Disable TRACE clock gate. */ + CLOCK_DisableClock(kCLOCK_Trace); + /* Set TRACE_PODF. */ + CLOCK_SetDiv(kCLOCK_TraceDiv, 2); + /* Set Trace clock source. */ + CLOCK_SetMux(kCLOCK_TraceMux, 2); + /* Disable SAI1 clock gate. */ + CLOCK_DisableClock(kCLOCK_Sai1); + /* Set SAI1_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Sai1PreDiv, 3); + /* Set SAI1_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Sai1Div, 1); + /* Set Sai1 clock source. */ + CLOCK_SetMux(kCLOCK_Sai1Mux, 0); + /* Disable SAI2 clock gate. */ + CLOCK_DisableClock(kCLOCK_Sai2); + /* Set SAI2_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Sai2PreDiv, 3); + /* Set SAI2_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Sai2Div, 1); + /* Set Sai2 clock source. */ + CLOCK_SetMux(kCLOCK_Sai2Mux, 0); + /* Disable SAI3 clock gate. */ + CLOCK_DisableClock(kCLOCK_Sai3); + /* Set SAI3_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Sai3PreDiv, 3); + /* Set SAI3_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Sai3Div, 1); + /* Set Sai3 clock source. */ + CLOCK_SetMux(kCLOCK_Sai3Mux, 0); + /* Disable Lpi2c clock gate. */ + CLOCK_DisableClock(kCLOCK_Lpi2c1); + CLOCK_DisableClock(kCLOCK_Lpi2c2); + /* Set LPI2C_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Lpi2cDiv, 0); + /* Set Lpi2c clock source. */ + CLOCK_SetMux(kCLOCK_Lpi2cMux, 0); + /* Disable UART clock gate. */ + CLOCK_DisableClock(kCLOCK_Lpuart1); + CLOCK_DisableClock(kCLOCK_Lpuart2); + CLOCK_DisableClock(kCLOCK_Lpuart3); + CLOCK_DisableClock(kCLOCK_Lpuart4); + /* Set UART_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_UartDiv, 0); + /* Set Uart clock source. */ + CLOCK_SetMux(kCLOCK_UartMux, 0); + /* Disable SPDIF clock gate. */ + CLOCK_DisableClock(kCLOCK_Spdif); + /* Set SPDIF0_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Spdif0PreDiv, 1); + /* Set SPDIF0_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Spdif0Div, 7); + /* Set Spdif clock source. */ + CLOCK_SetMux(kCLOCK_SpdifMux, 3); + /* Disable Flexio1 clock gate. */ + CLOCK_DisableClock(kCLOCK_Flexio1); + /* Set FLEXIO1_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Flexio1PreDiv, 1); + /* Set FLEXIO1_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Flexio1Div, 7); + /* Set Flexio1 clock source. */ + CLOCK_SetMux(kCLOCK_Flexio1Mux, 3); + /* Set Pll3 sw clock source. */ + CLOCK_SetMux(kCLOCK_Pll3SwMux, 0); + /* Init System PLL. */ + CLOCK_InitSysPll(&sysPllConfig_BOARD_BootClockRUN); + /* Init System pfd0. */ + CLOCK_InitSysPfd(kCLOCK_Pfd0, 27); + /* Init System pfd1. */ + CLOCK_InitSysPfd(kCLOCK_Pfd1, 16); + /* Init System pfd2. */ + CLOCK_InitSysPfd(kCLOCK_Pfd2, 18); + /* Init System pfd3. */ + CLOCK_InitSysPfd(kCLOCK_Pfd3, 18); + /* In SDK projects, external flash (configured by FLEXSPI) will be initialized by dcd. + * With this macro XIP_EXTERNAL_FLASH, usb1 pll (selected to be FLEXSPI clock source in SDK projects) will be left unchanged. + * Note: If another clock source is selected for FLEXSPI, user may want to avoid changing that clock as well.*/ + #if !(defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)) + /* Init Usb1 PLL. */ + CLOCK_InitUsb1Pll(&usb1PllConfig_BOARD_BootClockRUN); + /* Init Usb1 pfd0. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd0, 22); + /* Init Usb1 pfd1. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd1, 16); + /* Init Usb1 pfd2. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd2, 17); + /* Init Usb1 pfd3. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd3, 18); + /* Disable Usb1 PLL output for USBPHY1. */ + CCM_ANALOG->PLL_USB1 &= ~CCM_ANALOG_PLL_USB1_EN_USB_CLKS_MASK; + #endif + /* DeInit Audio PLL. */ + CLOCK_DeinitAudioPll(); + /* Bypass Audio PLL. */ + CLOCK_SetPllBypass(CCM_ANALOG, kCLOCK_PllAudio, 1); + /* Set divider for Audio PLL. */ + CCM_ANALOG->MISC2 &= ~CCM_ANALOG_MISC2_AUDIO_DIV_LSB_MASK; + CCM_ANALOG->MISC2 &= ~CCM_ANALOG_MISC2_AUDIO_DIV_MSB_MASK; + /* Enable Audio PLL output. */ + CCM_ANALOG->PLL_AUDIO |= CCM_ANALOG_PLL_AUDIO_ENABLE_MASK; + /* Init Enet PLL. */ + CLOCK_InitEnetPll(&enetPllConfig_BOARD_BootClockRUN); + /* Set preperiph clock source. */ + CLOCK_SetMux(kCLOCK_PrePeriphMux, 3); + /* Set periph clock source. */ + CLOCK_SetMux(kCLOCK_PeriphMux, 0); + /* Set periph clock2 clock source. */ + CLOCK_SetMux(kCLOCK_PeriphClk2Mux, 0); + /* Set per clock source. */ + CLOCK_SetMux(kCLOCK_PerclkMux, 0); + /* Set clock out1 divider. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO1_DIV_MASK)) | CCM_CCOSR_CLKO1_DIV(0); + /* Set clock out1 source. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO1_SEL_MASK)) | CCM_CCOSR_CLKO1_SEL(1); + /* Set clock out2 divider. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO2_DIV_MASK)) | CCM_CCOSR_CLKO2_DIV(0); + /* Set clock out2 source. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO2_SEL_MASK)) | CCM_CCOSR_CLKO2_SEL(6); + /* Set clock out1 drives clock out1. */ + CCM->CCOSR &= ~CCM_CCOSR_CLK_OUT_SEL_MASK; + /* Disable clock out1. */ + CCM->CCOSR &= ~CCM_CCOSR_CLKO1_EN_MASK; + /* Disable clock out2. */ + CCM->CCOSR &= ~CCM_CCOSR_CLKO2_EN_MASK; + /* Set SAI1 MCLK1 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk1Sel, 0); + /* Set SAI1 MCLK2 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk2Sel, 0); + /* Set SAI1 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk3Sel, 0); + /* Set SAI2 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI2MClk3Sel, 0); + /* Set SAI3 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI3MClk3Sel, 0); + /* Set MQS configuration. */ + IOMUXC_MQSConfig(IOMUXC_GPR,kIOMUXC_MqsPwmOverSampleRate32, 0); + /* Set GPT1 High frequency reference clock source. */ + IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT1_MASK; + /* Set GPT2 High frequency reference clock source. */ + IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT2_MASK; + /* Set SystemCoreClock variable. */ + SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK; +} diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.c new file mode 100644 index 0000000000..9c56c47dc0 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.c @@ -0,0 +1,184 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 "py/obj.h" +#include "py/mphal.h" +#include "mimxrt10xx/periph.h" + +LPI2C_Type *const mcu_i2c_banks[2] = { LPI2C1, LPI2C2 }; + +const mcu_periph_obj_t mcu_i2c_sda_list[2] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_B1_15), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_18), +}; + +const mcu_periph_obj_t mcu_i2c_scl_list[2] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_B1_14), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_19), +}; + +LPSPI_Type *const mcu_spi_banks[2] = { LPSPI1, LPSPI2 }; + +const mcu_periph_obj_t mcu_spi_sck_list[2] = { + PERIPH_PIN(1, 1, 0, 0, &pin_GPIO_AD_B0_10), + + PERIPH_PIN(2, 4, 0, 0, &pin_GPIO_SD_B1_07), +}; + +const mcu_periph_obj_t mcu_spi_sdo_list[2] = { + PERIPH_PIN(1, 1, 0, 0, &pin_GPIO_AD_B0_12), + + PERIPH_PIN(2, 4, 0, 0, &pin_GPIO_SD_B1_08), +}; + +const mcu_periph_obj_t mcu_spi_sdi_list[2] = { + PERIPH_PIN(1, 1, 0, 0, &pin_GPIO_AD_B0_13), + + PERIPH_PIN(2, 4, 0, 0, &pin_GPIO_SD_B1_09), +}; + +LPUART_Type *const mcu_uart_banks[4] = { LPUART1, LPUART2, LPUART3, LPUART4 }; + +const mcu_periph_obj_t mcu_uart_rx_list[6] = { + PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_07), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_23), + + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_07), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B0_15), + + PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_EMC_33), + PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_AD_B1_11), +}; + +const mcu_periph_obj_t mcu_uart_tx_list[6] = { + PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_06), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_22), + + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_06), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B0_14), + + PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_EMC_32), + PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_AD_B1_10), +}; + +const mcu_periph_obj_t mcu_uart_rts_list[3] = { + PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_09), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_21), + + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B0_13), +}; + +const mcu_periph_obj_t mcu_uart_cts_list[3] = { + PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_08), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_20), + + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B0_12), +}; + +I2S_Type *const mcu_i2s_banks[3] = { SAI1, SAI2, SAI3 }; + +const mcu_periph_obj_t mcu_i2s_rx_data0_list[3] = { + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_21), + + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_08), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B1_11), +}; + +const mcu_periph_obj_t mcu_i2s_rx_sync_list[3] = { + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_18), + + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_07), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B1_10), +}; + +const mcu_periph_obj_t mcu_i2s_tx_bclk_list[4] = { + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_26), + + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_04), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_33), + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B1_06), +}; + +const mcu_periph_obj_t mcu_i2s_tx_data0_list[4] = { + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_25), + + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_06), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_32), + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B1_08), +}; + +const mcu_periph_obj_t mcu_i2s_tx_sync_list[4] = { + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_27), + + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_05), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_34), + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B1_07), +}; + +const mcu_periph_obj_t mcu_mqs_left_list[2] = { + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_17), + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_07), +}; + +const mcu_periph_obj_t mcu_mqs_right_list[2] = { + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_16), + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_06), +}; + +const mcu_pwm_obj_t mcu_pwm_list[12] = { + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_26_FLEXPWM1_PWMA00, &pin_GPIO_EMC_26), + + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_27_FLEXPWM1_PWMB00, &pin_GPIO_EMC_27), + + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_24_FLEXPWM1_PWMA01, &pin_GPIO_EMC_24), + + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_25_FLEXPWM1_PWMB01, &pin_GPIO_EMC_25), + + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_22_FLEXPWM1_PWMA02, &pin_GPIO_EMC_22), + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_AD_B1_10_FLEXPWM1_PWMA02, &pin_GPIO_AD_B1_10), + + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_23_FLEXPWM1_PWMB02, &pin_GPIO_EMC_23), + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_AD_B1_11_FLEXPWM1_PWMB02, &pin_GPIO_AD_B1_11), + + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_20_FLEXPWM1_PWMA03, &pin_GPIO_EMC_20), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B1_12_FLEXPWM1_PWMA03, &pin_GPIO_AD_B1_12), + + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_21_FLEXPWM1_PWMB03, &pin_GPIO_EMC_21), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_AD_B1_13_FLEXPWM1_PWMB03, &pin_GPIO_AD_B1_13), +}; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.h new file mode 100644 index 0000000000..af53706d6f --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.h @@ -0,0 +1,55 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + +#pragma once +extern LPI2C_Type *const mcu_i2c_banks[2]; +extern const mcu_periph_obj_t mcu_i2c_sda_list[2]; +extern const mcu_periph_obj_t mcu_i2c_scl_list[2]; + +extern LPSPI_Type *const mcu_spi_banks[2]; +extern const mcu_periph_obj_t mcu_spi_sck_list[2]; +extern const mcu_periph_obj_t mcu_spi_sdo_list[2]; +extern const mcu_periph_obj_t mcu_spi_sdi_list[2]; + +extern LPUART_Type *const mcu_uart_banks[4]; +extern const mcu_periph_obj_t mcu_uart_rx_list[6]; +extern const mcu_periph_obj_t mcu_uart_tx_list[6]; +extern const mcu_periph_obj_t mcu_uart_rts_list[3]; +extern const mcu_periph_obj_t mcu_uart_cts_list[3]; + +extern I2S_Type *const mcu_i2s_banks[3]; +extern const mcu_periph_obj_t mcu_i2s_rx_data0_list[3]; +extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[3]; +extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[4]; +extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[4]; +extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[4]; + +extern const mcu_periph_obj_t mcu_mqs_left_list[2]; +extern const mcu_periph_obj_t mcu_mqs_right_list[2]; + +extern const mcu_pwm_obj_t mcu_pwm_list[12]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pin_names.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pin_names.h new file mode 100644 index 0000000000..0416e2ee65 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pin_names.h @@ -0,0 +1,92 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + + +// define FORMAT_PIN(pin_name) and then include this file. + +FORMAT_PIN(GPIO_EMC_04) +FORMAT_PIN(GPIO_EMC_05) +FORMAT_PIN(GPIO_EMC_06) +FORMAT_PIN(GPIO_EMC_07) +FORMAT_PIN(GPIO_EMC_08) +FORMAT_PIN(GPIO_EMC_09) +FORMAT_PIN(GPIO_EMC_16) +FORMAT_PIN(GPIO_EMC_17) +FORMAT_PIN(GPIO_EMC_18) +FORMAT_PIN(GPIO_EMC_19) +FORMAT_PIN(GPIO_EMC_20) +FORMAT_PIN(GPIO_EMC_21) +FORMAT_PIN(GPIO_EMC_22) +FORMAT_PIN(GPIO_EMC_23) +FORMAT_PIN(GPIO_EMC_24) +FORMAT_PIN(GPIO_EMC_25) +FORMAT_PIN(GPIO_EMC_26) +FORMAT_PIN(GPIO_EMC_27) +FORMAT_PIN(GPIO_EMC_32) +FORMAT_PIN(GPIO_EMC_33) +FORMAT_PIN(GPIO_EMC_34) +FORMAT_PIN(GPIO_EMC_35) + +FORMAT_PIN(GPIO_AD_B0_00) +FORMAT_PIN(GPIO_AD_B0_01) +FORMAT_PIN(GPIO_AD_B0_02) +FORMAT_PIN(GPIO_AD_B0_03) +FORMAT_PIN(GPIO_AD_B0_04) +FORMAT_PIN(GPIO_AD_B0_05) +FORMAT_PIN(GPIO_AD_B0_06) +FORMAT_PIN(GPIO_AD_B0_07) +FORMAT_PIN(GPIO_AD_B0_08) +FORMAT_PIN(GPIO_AD_B0_09) +FORMAT_PIN(GPIO_AD_B0_10) +FORMAT_PIN(GPIO_AD_B0_11) +FORMAT_PIN(GPIO_AD_B0_12) +FORMAT_PIN(GPIO_AD_B0_13) +FORMAT_PIN(GPIO_AD_B0_14) +FORMAT_PIN(GPIO_AD_B0_15) + +FORMAT_PIN(GPIO_AD_B1_10) +FORMAT_PIN(GPIO_AD_B1_11) +FORMAT_PIN(GPIO_AD_B1_12) +FORMAT_PIN(GPIO_AD_B1_13) +FORMAT_PIN(GPIO_AD_B1_14) +FORMAT_PIN(GPIO_AD_B1_15) + +FORMAT_PIN(GPIO_SD_B1_00) +FORMAT_PIN(GPIO_SD_B1_01) +FORMAT_PIN(GPIO_SD_B1_02) +FORMAT_PIN(GPIO_SD_B1_03) +FORMAT_PIN(GPIO_SD_B1_04) +FORMAT_PIN(GPIO_SD_B1_05) +FORMAT_PIN(GPIO_SD_B1_06) +FORMAT_PIN(GPIO_SD_B1_07) +FORMAT_PIN(GPIO_SD_B1_08) +FORMAT_PIN(GPIO_SD_B1_09) +FORMAT_PIN(GPIO_SD_B1_10) +FORMAT_PIN(GPIO_SD_B1_11) +FORMAT_PIN(USB_OTG1_DN) +FORMAT_PIN(USB_OTG1_DP) diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.c new file mode 100644 index 0000000000..efa7abcedf --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.c @@ -0,0 +1,91 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 "py/obj.h" +#include "py/mphal.h" +#include "mimxrt10xx/pins.h" + +const mcu_pin_obj_t pin_GPIO_EMC_04 = PIN(GPIO2, 4, GPIO_EMC_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_05 = PIN(GPIO2, 5, GPIO_EMC_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_06 = PIN(GPIO2, 6, GPIO_EMC_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_07 = PIN(GPIO2, 7, GPIO_EMC_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_08 = PIN(GPIO2, 8, GPIO_EMC_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_09 = PIN(GPIO2, 9, GPIO_EMC_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_16 = PIN(GPIO2, 16, GPIO_EMC_16, NO_ADC, 0, 0x00000006, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_EMC_17 = PIN(GPIO2, 17, GPIO_EMC_17, NO_ADC, 0, 0x00000006, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_EMC_18 = PIN(GPIO2, 18, GPIO_EMC_18, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_19 = PIN(GPIO2, 19, GPIO_EMC_19, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_20 = PIN(GPIO2, 20, GPIO_EMC_20, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_21 = PIN(GPIO2, 21, GPIO_EMC_21, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_22 = PIN(GPIO2, 22, GPIO_EMC_22, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_23 = PIN(GPIO2, 23, GPIO_EMC_23, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_24 = PIN(GPIO2, 24, GPIO_EMC_24, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_25 = PIN(GPIO2, 25, GPIO_EMC_25, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_26 = PIN(GPIO2, 26, GPIO_EMC_26, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_27 = PIN(GPIO2, 27, GPIO_EMC_27, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_32 = PIN(GPIO3, 0, GPIO_EMC_32, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_33 = PIN(GPIO3, 1, GPIO_EMC_33, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_34 = PIN(GPIO3, 2, GPIO_EMC_34, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_35 = PIN(GPIO3, 3, GPIO_EMC_35, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_00 = PIN(GPIO1, 0, GPIO_AD_B0_00, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_01 = PIN(GPIO1, 1, GPIO_AD_B0_01, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_02 = PIN(GPIO1, 2, GPIO_AD_B0_02, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_03 = PIN(GPIO1, 3, GPIO_AD_B0_03, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_04 = PIN(GPIO1, 4, GPIO_AD_B0_04, NO_ADC, 0, 0x00000000, 0x000090B1); +const mcu_pin_obj_t pin_GPIO_AD_B0_05 = PIN(GPIO1, 5, GPIO_AD_B0_05, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_06 = PIN(GPIO1, 6, GPIO_AD_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_07 = PIN(GPIO1, 7, GPIO_AD_B0_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_08 = PIN(GPIO1, 8, GPIO_AD_B0_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_09 = PIN(GPIO1, 9, GPIO_AD_B0_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_10 = PIN(GPIO1, 10, GPIO_AD_B0_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_11 = PIN(GPIO1, 11, GPIO_AD_B0_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 12, GPIO_AD_B0_12, ADC1, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 13, GPIO_AD_B0_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 14, GPIO_AD_B0_14, ADC1, 1, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 15, GPIO_AD_B0_15, ADC1, 2, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 26, GPIO_AD_B1_10, ADC1, 10, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 27, GPIO_AD_B1_11, ADC1, 11, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_12 = PIN(GPIO1, 28, GPIO_AD_B1_12, ADC1, 12, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_13 = PIN(GPIO1, 29, GPIO_AD_B1_13, ADC1, 13, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_14 = PIN(GPIO1, 30, GPIO_AD_B1_14, ADC1, 14, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_15 = PIN(GPIO1, 31, GPIO_AD_B1_15, ADC1, 15, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_00 = PIN(GPIO3, 20, GPIO_SD_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_01 = PIN(GPIO3, 21, GPIO_SD_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_02 = PIN(GPIO3, 22, GPIO_SD_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_03 = PIN(GPIO3, 23, GPIO_SD_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_04 = PIN(GPIO3, 24, GPIO_SD_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_05 = PIN(GPIO3, 25, GPIO_SD_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_06 = PIN(GPIO3, 26, GPIO_SD_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_07 = PIN(GPIO3, 27, GPIO_SD_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 28, GPIO_SD_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 29, GPIO_SD_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 30, GPIO_SD_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 31, GPIO_SD_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); + +const mcu_pin_obj_t pin_USB_OTG1_DN = { { &mcu_pin_type }, }; +const mcu_pin_obj_t pin_USB_OTG1_DP = { { &mcu_pin_type }, }; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.h new file mode 100644 index 0000000000..118eff9335 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + +#pragma once + +#define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; +#include "pin_names.h" +#undef FORMAT_PIN + +#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 2) +extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/clocks.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/clocks.c index 198f85110e..eab7f4eacc 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/clocks.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/clocks.c @@ -36,6 +36,8 @@ #include "fsl_clock.h" #include "fsl_iomuxc.h" +#include "board.h" + #include "clocks.h" // These values are pulled from the SDK's devices/MIMXRT1021/project_template/clock_config.* files. diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c index 59bd3cc105..8615e6cfc5 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c @@ -5,7 +5,7 @@ * * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * Copyright (c) 2019 Artur Pacholec - * Copyright (c) 2020 Scott Shawcroft + * Copyright (c) 2023 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 @@ -70,13 +70,13 @@ const mcu_periph_obj_t mcu_spi_sck_list[8] = { PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SCK_SELECT_INPUT, 1, &pin_GPIO_EMC_10), PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SCK_SELECT_INPUT, 2, &pin_GPIO_SD_B1_07), - PERIPH_PIN(3, 2, kIOMUXC_LPSPI2_SCK_SELECT_INPUT, 0, &pin_GPIO_AD_B1_12), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B1_12), - PERIPH_PIN(4, 2, kIOMUXC_LPSPI2_SCK_SELECT_INPUT, 0, &pin_GPIO_AD_B1_02), - PERIPH_PIN(4, 4, kIOMUXC_LPSPI2_SCK_SELECT_INPUT, 1, &pin_GPIO_EMC_32), + PERIPH_PIN(4, 2, kIOMUXC_LPSPI4_SCK_SELECT_INPUT, 0, &pin_GPIO_AD_B1_02), + PERIPH_PIN(4, 4, kIOMUXC_LPSPI4_SCK_SELECT_INPUT, 1, &pin_GPIO_EMC_32), }; -const mcu_periph_obj_t mcu_spi_mosi_list[8] = { +const mcu_periph_obj_t mcu_spi_sdo_list[8] = { PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 0, &pin_GPIO_SD_B0_04), PERIPH_PIN(1, 1, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 1, &pin_GPIO_AD_B0_12), @@ -84,13 +84,13 @@ const mcu_periph_obj_t mcu_spi_mosi_list[8] = { PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 1, &pin_GPIO_EMC_12), PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 2, &pin_GPIO_SD_B1_08), - PERIPH_PIN(3, 2, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 0, &pin_GPIO_AD_B1_14), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B1_14), - PERIPH_PIN(4, 2, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 0, &pin_GPIO_AD_B1_04), - PERIPH_PIN(4, 4, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 1, &pin_GPIO_EMC_34), + PERIPH_PIN(4, 2, kIOMUXC_LPSPI4_SDO_SELECT_INPUT, 0, &pin_GPIO_AD_B1_04), + PERIPH_PIN(4, 4, kIOMUXC_LPSPI4_SDO_SELECT_INPUT, 1, &pin_GPIO_EMC_34), }; -const mcu_periph_obj_t mcu_spi_miso_list[8] = { +const mcu_periph_obj_t mcu_spi_sdi_list[8] = { PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 0, &pin_GPIO_SD_B0_05), PERIPH_PIN(1, 1, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 1, &pin_GPIO_AD_B0_13), @@ -98,10 +98,10 @@ const mcu_periph_obj_t mcu_spi_miso_list[8] = { PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 1, &pin_GPIO_EMC_13), PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 2, &pin_GPIO_SD_B1_09), - PERIPH_PIN(3, 2, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 0, &pin_GPIO_AD_B1_15), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B1_15), - PERIPH_PIN(4, 2, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 0, &pin_GPIO_AD_B1_05), - PERIPH_PIN(4, 4, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 1, &pin_GPIO_EMC_35), + PERIPH_PIN(4, 2, kIOMUXC_LPSPI4_SDI_SELECT_INPUT, 0, &pin_GPIO_AD_B1_05), + PERIPH_PIN(4, 4, kIOMUXC_LPSPI4_SDI_SELECT_INPUT, 1, &pin_GPIO_EMC_35), }; LPUART_Type *const mcu_uart_banks[8] = { LPUART1, LPUART2, LPUART3, LPUART4, LPUART5, LPUART6, LPUART7, LPUART8 }; @@ -162,18 +162,18 @@ const mcu_periph_obj_t mcu_uart_rts_list[10] = { PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_09), PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_21), - PERIPH_PIN(2, 2, 0, 1, &pin_GPIO_AD_B1_07), + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_AD_B1_07), - PERIPH_PIN(3, 2, 0, 1, &pin_GPIO_AD_B0_13), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B0_13), PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_EMC_01), - PERIPH_PIN(4, 2, 0, 1, &pin_GPIO_EMC_31), + PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_EMC_31), PERIPH_PIN(5, 2, 0, 0, &pin_GPIO_EMC_37), PERIPH_PIN(6, 2, 0, 0, &pin_GPIO_EMC_15), - PERIPH_PIN(7, 2, 0, 1, &pin_GPIO_SD_B0_03), + PERIPH_PIN(7, 2, 0, 0, &pin_GPIO_SD_B0_03), PERIPH_PIN(8, 2, 0, 0, &pin_GPIO_EMC_25), }; @@ -184,10 +184,10 @@ const mcu_periph_obj_t mcu_uart_cts_list[10] = { PERIPH_PIN(2, 2, kIOMUXC_LPUART2_CTS_B_SELECT_INPUT, 0, &pin_GPIO_AD_B1_06), PERIPH_PIN(2, 2, kIOMUXC_LPUART2_CTS_B_SELECT_INPUT, 1, &pin_GPIO_EMC_20), - PERIPH_PIN(3, 2, 0, 1, &pin_GPIO_AD_B0_12), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B0_12), PERIPH_PIN(4, 2, kIOMUXC_LPUART4_CTS_B_SELECT_INPUT, 0, &pin_GPIO_EMC_00), - PERIPH_PIN(4, 2, kIOMUXC_LPUART4_CTS_B_SELECT_INPUT, 0, &pin_GPIO_EMC_30), + PERIPH_PIN(4, 2, kIOMUXC_LPUART4_CTS_B_SELECT_INPUT, 1, &pin_GPIO_EMC_30), PERIPH_PIN(5, 2, 0, 0, &pin_GPIO_EMC_36), @@ -198,126 +198,142 @@ const mcu_periph_obj_t mcu_uart_cts_list[10] = { PERIPH_PIN(8, 2, 0, 0, &pin_GPIO_EMC_24), }; -const mcu_pwm_obj_t mcu_pwm_list[39] = { +I2S_Type *const mcu_i2s_banks[3] = { SAI1, SAI2, SAI3 }; + +const mcu_periph_obj_t mcu_i2s_rx_data0_list[7] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_DATA0_SELECT_INPUT, 0, &pin_GPIO_EMC_13), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_DATA0_SELECT_INPUT, 1, &pin_GPIO_AD_B1_05), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_DATA0_SELECT_INPUT, 2, &pin_GPIO_EMC_21), + + PERIPH_PIN(2, 3, kIOMUXC_SAI2_RX_DATA0_SELECT_INPUT, 0, &pin_GPIO_SD_B0_03), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_RX_DATA0_SELECT_INPUT, 1, &pin_GPIO_EMC_08), + + PERIPH_PIN(3, 3, kIOMUXC_SAI3_RX_DATA0_SELECT_INPUT, 0, &pin_GPIO_SD_B1_11), + PERIPH_PIN(3, 3, kIOMUXC_SAI3_RX_DATA0_SELECT_INPUT, 1, &pin_GPIO_EMC_31), +}; + +const mcu_periph_obj_t mcu_i2s_rx_sync_list[7] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_SYNC_SELECT_INPUT, 0, &pin_GPIO_AD_B1_04), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_SYNC_SELECT_INPUT, 1, &pin_GPIO_EMC_15), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_SYNC_SELECT_INPUT, 2, &pin_GPIO_EMC_18), + + PERIPH_PIN(2, 3, kIOMUXC_SAI2_RX_SYNC_SELECT_INPUT, 0, &pin_GPIO_SD_B0_01), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_RX_SYNC_SELECT_INPUT, 1, &pin_GPIO_EMC_07), + + PERIPH_PIN(3, 3, kIOMUXC_SAI3_RX_SYNC_SELECT_INPUT, 0, &pin_GPIO_SD_B1_10), + PERIPH_PIN(3, 3, kIOMUXC_SAI3_RX_SYNC_SELECT_INPUT, 1, &pin_GPIO_EMC_30), +}; + +const mcu_periph_obj_t mcu_i2s_tx_bclk_list[7] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_BCLK_SELECT_INPUT, 0, &pin_GPIO_EMC_11), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_BCLK_SELECT_INPUT, 1, &pin_GPIO_AD_B1_01), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_BCLK_SELECT_INPUT, 2, &pin_GPIO_EMC_26), + + PERIPH_PIN(2, 3, kIOMUXC_SAI2_TX_BCLK_SELECT_INPUT, 0, &pin_GPIO_SD_B0_05), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_TX_BCLK_SELECT_INPUT, 1, &pin_GPIO_EMC_04), + + PERIPH_PIN(3, 3, kIOMUXC_SAI3_TX_BCLK_SELECT_INPUT, 0, &pin_GPIO_SD_B1_06), + PERIPH_PIN(3, 3, kIOMUXC_SAI3_TX_BCLK_SELECT_INPUT, 1, &pin_GPIO_EMC_33), +}; + +const mcu_periph_obj_t mcu_i2s_tx_data0_list[7] = { + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_12), + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_25), + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_03), + + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_06), + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_SD_B0_04), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_32), + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B1_08), +}; + +const mcu_periph_obj_t mcu_i2s_tx_sync_list[7] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_SYNC_SELECT_INPUT, 0, &pin_GPIO_EMC_10), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_SYNC_SELECT_INPUT, 1, &pin_GPIO_AD_B1_02), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_SYNC_SELECT_INPUT, 2, &pin_GPIO_EMC_27), + + PERIPH_PIN(2, 3, kIOMUXC_SAI2_TX_SYNC_SELECT_INPUT, 0, &pin_GPIO_SD_B0_06), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_TX_SYNC_SELECT_INPUT, 1, &pin_GPIO_EMC_05), + + PERIPH_PIN(3, 3, kIOMUXC_SAI3_TX_SYNC_SELECT_INPUT, 0, &pin_GPIO_SD_B1_07), + PERIPH_PIN(3, 3, kIOMUXC_SAI3_TX_SYNC_SELECT_INPUT, 1, &pin_GPIO_EMC_34), +}; + +const mcu_periph_obj_t mcu_mqs_left_list[3] = { + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_17), + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_38), + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_07), +}; + +const mcu_periph_obj_t mcu_mqs_right_list[3] = { + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_16), + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_37), + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_06), +}; + +const mcu_pwm_obj_t mcu_pwm_list[40] = { PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_26_FLEXPWM1_PWMA00, &pin_GPIO_EMC_26), PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_AD_B1_06_FLEXPWM1_PWMA00, &pin_GPIO_AD_B1_06), - PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_24_FLEXPWM1_PWMA01, &pin_GPIO_EMC_24), - PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_AD_B1_08_FLEXPWM1_PWMA01, &pin_GPIO_AD_B1_08), - - PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_22_FLEXPWM1_PWMA02, &pin_GPIO_EMC_22), - PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_AD_B1_10_FLEXPWM1_PWMA02, &pin_GPIO_AD_B1_10), - - PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_20_FLEXPWM1_PWMA03, &pin_GPIO_EMC_20), - PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B1_12_FLEXPWM1_PWMA03, &pin_GPIO_AD_B1_12), - PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_27_FLEXPWM1_PWMB00, &pin_GPIO_EMC_27), PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_AD_B1_07_FLEXPWM1_PWMB00, &pin_GPIO_AD_B1_07), + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmX, IOMUXC_GPIO_EMC_28_FLEXPWM1_PWMX00, &pin_GPIO_EMC_28), + + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_24_FLEXPWM1_PWMA01, &pin_GPIO_EMC_24), + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_AD_B1_08_FLEXPWM1_PWMA01, &pin_GPIO_AD_B1_08), + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_25_FLEXPWM1_PWMB01, &pin_GPIO_EMC_25), PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_AD_B1_09_FLEXPWM1_PWMB01, &pin_GPIO_AD_B1_09), + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmX, IOMUXC_GPIO_EMC_29_FLEXPWM1_PWMX01, &pin_GPIO_EMC_29), + + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_22_FLEXPWM1_PWMA02, &pin_GPIO_EMC_22), + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_AD_B1_10_FLEXPWM1_PWMA02, &pin_GPIO_AD_B1_10), + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_23_FLEXPWM1_PWMB02, &pin_GPIO_EMC_23), PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_AD_B1_11_FLEXPWM1_PWMB02, &pin_GPIO_AD_B1_11), + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmX, IOMUXC_GPIO_EMC_30_FLEXPWM1_PWMX02, &pin_GPIO_EMC_30), + + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_20_FLEXPWM1_PWMA03, &pin_GPIO_EMC_20), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B1_12_FLEXPWM1_PWMA03, &pin_GPIO_AD_B1_12), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_21_FLEXPWM1_PWMB03, &pin_GPIO_EMC_21), PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_AD_B1_13_FLEXPWM1_PWMB03, &pin_GPIO_AD_B1_13), - PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmX, IOMUXC_GPIO_EMC_28_FLEXPWM1_PWMX00, &pin_GPIO_EMC_28), - PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmX, IOMUXC_GPIO_EMC_29_FLEXPWM1_PWMX01, &pin_GPIO_EMC_29), - PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmX, IOMUXC_GPIO_EMC_30_FLEXPWM1_PWMX02, &pin_GPIO_EMC_30), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmX, IOMUXC_GPIO_EMC_31_FLEXPWM1_PWMX03, &pin_GPIO_EMC_31), PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_38_FLEXPWM2_PWMA00, &pin_GPIO_EMC_38), PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_AD_B0_14_FLEXPWM2_PWMA00, &pin_GPIO_AD_B0_14), - PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_36_FLEXPWM2_PWMA01, &pin_GPIO_EMC_36), - PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_AD_B0_12_FLEXPWM2_PWMA01, &pin_GPIO_AD_B0_12), - - PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_30_FLEXPWM2_PWMA02, &pin_GPIO_EMC_30), - PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_AD_B0_10_FLEXPWM2_PWMA02, &pin_GPIO_AD_B0_10), - - PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_28_FLEXPWM2_PWMA03, &pin_GPIO_EMC_28), - PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B0_06_FLEXPWM2_PWMA03, &pin_GPIO_AD_B0_06), - PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_39_FLEXPWM2_PWMB00, &pin_GPIO_EMC_39), PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_AD_B0_15_FLEXPWM2_PWMB00, &pin_GPIO_AD_B0_15), + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmX, IOMUXC_GPIO_EMC_10_FLEXPWM2_PWMX00, &pin_GPIO_EMC_10), + + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_36_FLEXPWM2_PWMA01, &pin_GPIO_EMC_36), + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_AD_B0_12_FLEXPWM2_PWMA01, &pin_GPIO_AD_B0_12), + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_37_FLEXPWM2_PWMB01, &pin_GPIO_EMC_37), PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_AD_B0_13_FLEXPWM2_PWMB01, &pin_GPIO_AD_B0_13), + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmX, IOMUXC_GPIO_EMC_11_FLEXPWM2_PWMX01, &pin_GPIO_EMC_11), + + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_30_FLEXPWM2_PWMA02, &pin_GPIO_EMC_30), + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_AD_B0_10_FLEXPWM2_PWMA02, &pin_GPIO_AD_B0_10), + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_31_FLEXPWM2_PWMB02, &pin_GPIO_EMC_31), PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_AD_B0_11_FLEXPWM2_PWMB02, &pin_GPIO_AD_B0_11), + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmX, IOMUXC_GPIO_EMC_12_FLEXPWM2_PWMX02, &pin_GPIO_EMC_12), + + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_28_FLEXPWM2_PWMA03, &pin_GPIO_EMC_28), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B0_06_FLEXPWM2_PWMA03, &pin_GPIO_AD_B0_06), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_29_FLEXPWM2_PWMB03, &pin_GPIO_EMC_29), PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_AD_B0_07_FLEXPWM2_PWMB03, &pin_GPIO_AD_B0_07), - PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmX, IOMUXC_GPIO_EMC_10_FLEXPWM2_PWMX00, &pin_GPIO_EMC_10), - PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmX, IOMUXC_GPIO_EMC_11_FLEXPWM2_PWMX01, &pin_GPIO_EMC_11), - PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmX, IOMUXC_GPIO_EMC_12_FLEXPWM2_PWMX02, &pin_GPIO_EMC_12), PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmX, IOMUXC_GPIO_EMC_13_FLEXPWM2_PWMX03, &pin_GPIO_EMC_13), }; - -const mcu_periph_obj_t mcu_sai_rx_bclk_list[] = { - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_14), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_19), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_06), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_09), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_SD_B0_02), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_29), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B1_09), -}; -const mcu_periph_obj_t mcu_sai_rx_data0_list[] = { - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_13), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_21), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_05), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_08), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_SD_B0_03), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_30), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B1_11), -}; -const mcu_periph_obj_t mcu_sai_rx_sync_list[] = { - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_15), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_28), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_04), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_07), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_SD_B0_01), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_30), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B1_10), -}; -const mcu_periph_obj_t mcu_sai_tx_bclk_list[] = { - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_11), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_26), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_01), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_04), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_SD_B0_04), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_33), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B0_06), -}; -const mcu_periph_obj_t mcu_sai_tx_data0_list[] = { - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_12), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_25), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_03), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_06), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_SD_B0_04), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_32), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B1_08), -}; -const mcu_periph_obj_t mcu_sai_tx_sync_list[] = { - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_10), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_27), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_02), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_05), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_SD_B0_06), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_34), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B1_07), -}; -const mcu_periph_obj_t mcu_mqs_left_list[] = { - PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_07), - PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_17), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_38), -}; -const mcu_periph_obj_t mcu_mqs_right_list[] = { - PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_06), - PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_16), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_37), -}; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h index 51c97b3eef..496e0ab153 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h @@ -3,8 +3,9 @@ * * The MIT License (MIT) * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * Copyright (c) 2019 Artur Pacholec - * Copyright (c) 2020 Scott Shawcroft + * Copyright (c) 2023 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 @@ -26,33 +27,29 @@ */ #pragma once - extern LPI2C_Type *const mcu_i2c_banks[4]; - extern const mcu_periph_obj_t mcu_i2c_sda_list[8]; extern const mcu_periph_obj_t mcu_i2c_scl_list[8]; extern LPSPI_Type *const mcu_spi_banks[4]; - extern const mcu_periph_obj_t mcu_spi_sck_list[8]; -extern const mcu_periph_obj_t mcu_spi_mosi_list[8]; -extern const mcu_periph_obj_t mcu_spi_miso_list[8]; +extern const mcu_periph_obj_t mcu_spi_sdo_list[8]; +extern const mcu_periph_obj_t mcu_spi_sdi_list[8]; extern LPUART_Type *const mcu_uart_banks[8]; - extern const mcu_periph_obj_t mcu_uart_rx_list[16]; extern const mcu_periph_obj_t mcu_uart_tx_list[16]; extern const mcu_periph_obj_t mcu_uart_rts_list[10]; extern const mcu_periph_obj_t mcu_uart_cts_list[10]; -extern const mcu_pwm_obj_t mcu_pwm_list[39]; - -extern const mcu_periph_obj_t mcu_sai_rx_bclk_list[7]; -extern const mcu_periph_obj_t mcu_sai_rx_data0_list[7]; -extern const mcu_periph_obj_t mcu_sai_rx_sync_list[7]; -extern const mcu_periph_obj_t mcu_sai_tx_bclk_list[7]; -extern const mcu_periph_obj_t mcu_sai_tx_data0_list[7]; -extern const mcu_periph_obj_t mcu_sai_tx_sync_list[7]; +extern I2S_Type *const mcu_i2s_banks[3]; +extern const mcu_periph_obj_t mcu_i2s_rx_data0_list[7]; +extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[7]; +extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[7]; +extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[7]; +extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[7]; extern const mcu_periph_obj_t mcu_mqs_left_list[3]; extern const mcu_periph_obj_t mcu_mqs_right_list[3]; + +extern const mcu_pwm_obj_t mcu_pwm_list[40]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pin_names.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pin_names.h new file mode 100644 index 0000000000..1f159afe53 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pin_names.h @@ -0,0 +1,130 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + + +// define FORMAT_PIN(pin_name) and then include this file. + +FORMAT_PIN(GPIO_EMC_00) +FORMAT_PIN(GPIO_EMC_01) +FORMAT_PIN(GPIO_EMC_02) +FORMAT_PIN(GPIO_EMC_03) +FORMAT_PIN(GPIO_EMC_04) +FORMAT_PIN(GPIO_EMC_05) +FORMAT_PIN(GPIO_EMC_06) +FORMAT_PIN(GPIO_EMC_07) +FORMAT_PIN(GPIO_EMC_08) +FORMAT_PIN(GPIO_EMC_09) +FORMAT_PIN(GPIO_EMC_10) +FORMAT_PIN(GPIO_EMC_11) +FORMAT_PIN(GPIO_EMC_12) +FORMAT_PIN(GPIO_EMC_13) +FORMAT_PIN(GPIO_EMC_14) +FORMAT_PIN(GPIO_EMC_15) +FORMAT_PIN(GPIO_EMC_16) +FORMAT_PIN(GPIO_EMC_17) +FORMAT_PIN(GPIO_EMC_18) +FORMAT_PIN(GPIO_EMC_19) +FORMAT_PIN(GPIO_EMC_20) +FORMAT_PIN(GPIO_EMC_21) +FORMAT_PIN(GPIO_EMC_22) +FORMAT_PIN(GPIO_EMC_23) +FORMAT_PIN(GPIO_EMC_24) +FORMAT_PIN(GPIO_EMC_25) +FORMAT_PIN(GPIO_EMC_26) +FORMAT_PIN(GPIO_EMC_27) +FORMAT_PIN(GPIO_EMC_28) +FORMAT_PIN(GPIO_EMC_29) +FORMAT_PIN(GPIO_EMC_30) +FORMAT_PIN(GPIO_EMC_31) +FORMAT_PIN(GPIO_EMC_32) +FORMAT_PIN(GPIO_EMC_33) +FORMAT_PIN(GPIO_EMC_34) +FORMAT_PIN(GPIO_EMC_35) +FORMAT_PIN(GPIO_EMC_36) +FORMAT_PIN(GPIO_EMC_37) +FORMAT_PIN(GPIO_EMC_38) +FORMAT_PIN(GPIO_EMC_39) +FORMAT_PIN(GPIO_EMC_40) +FORMAT_PIN(GPIO_EMC_41) + +FORMAT_PIN(GPIO_AD_B0_00) +FORMAT_PIN(GPIO_AD_B0_01) +FORMAT_PIN(GPIO_AD_B0_02) +FORMAT_PIN(GPIO_AD_B0_03) +FORMAT_PIN(GPIO_AD_B0_04) +FORMAT_PIN(GPIO_AD_B0_05) +FORMAT_PIN(GPIO_AD_B0_06) +FORMAT_PIN(GPIO_AD_B0_07) +FORMAT_PIN(GPIO_AD_B0_08) +FORMAT_PIN(GPIO_AD_B0_09) +FORMAT_PIN(GPIO_AD_B0_10) +FORMAT_PIN(GPIO_AD_B0_11) +FORMAT_PIN(GPIO_AD_B0_12) +FORMAT_PIN(GPIO_AD_B0_13) +FORMAT_PIN(GPIO_AD_B0_14) +FORMAT_PIN(GPIO_AD_B0_15) + +FORMAT_PIN(GPIO_AD_B1_00) +FORMAT_PIN(GPIO_AD_B1_01) +FORMAT_PIN(GPIO_AD_B1_02) +FORMAT_PIN(GPIO_AD_B1_03) +FORMAT_PIN(GPIO_AD_B1_04) +FORMAT_PIN(GPIO_AD_B1_05) +FORMAT_PIN(GPIO_AD_B1_06) +FORMAT_PIN(GPIO_AD_B1_07) +FORMAT_PIN(GPIO_AD_B1_08) +FORMAT_PIN(GPIO_AD_B1_09) +FORMAT_PIN(GPIO_AD_B1_10) +FORMAT_PIN(GPIO_AD_B1_11) +FORMAT_PIN(GPIO_AD_B1_12) +FORMAT_PIN(GPIO_AD_B1_13) +FORMAT_PIN(GPIO_AD_B1_14) +FORMAT_PIN(GPIO_AD_B1_15) + +FORMAT_PIN(GPIO_SD_B0_00) +FORMAT_PIN(GPIO_SD_B0_01) +FORMAT_PIN(GPIO_SD_B0_02) +FORMAT_PIN(GPIO_SD_B0_03) +FORMAT_PIN(GPIO_SD_B0_04) +FORMAT_PIN(GPIO_SD_B0_05) +FORMAT_PIN(GPIO_SD_B0_06) + +FORMAT_PIN(GPIO_SD_B1_00) +FORMAT_PIN(GPIO_SD_B1_01) +FORMAT_PIN(GPIO_SD_B1_02) +FORMAT_PIN(GPIO_SD_B1_03) +FORMAT_PIN(GPIO_SD_B1_04) +FORMAT_PIN(GPIO_SD_B1_05) +FORMAT_PIN(GPIO_SD_B1_06) +FORMAT_PIN(GPIO_SD_B1_07) +FORMAT_PIN(GPIO_SD_B1_08) +FORMAT_PIN(GPIO_SD_B1_09) +FORMAT_PIN(GPIO_SD_B1_10) +FORMAT_PIN(GPIO_SD_B1_11) +FORMAT_PIN(USB_OTG1_DN) +FORMAT_PIN(USB_OTG1_DP) diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c index fe39f7e19d..e349f43542 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c @@ -5,6 +5,7 @@ * * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 @@ -29,38 +30,6 @@ #include "py/mphal.h" #include "mimxrt10xx/pins.h" -const mcu_pin_obj_t pin_GPIO_AD_B0_00 = PIN(GPIO1, 0, GPIO_AD_B0_00, NO_ADC, 0, 0x00000000, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_01 = PIN(GPIO1, 1, GPIO_AD_B0_01, NO_ADC, 0, 0x00000000, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_02 = PIN(GPIO1, 2, GPIO_AD_B0_02, NO_ADC, 0, 0x00000000, 0x000030A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_03 = PIN(GPIO1, 3, GPIO_AD_B0_03, NO_ADC, 0, 0x00000000, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_04 = PIN(GPIO1, 4, GPIO_AD_B0_04, NO_ADC, 0, 0x00000000, 0x000090B1); -const mcu_pin_obj_t pin_GPIO_AD_B0_05 = PIN(GPIO1, 5, GPIO_AD_B0_05, NO_ADC, 0, 0x00000000, 0x000070A0); -const mcu_pin_obj_t pin_GPIO_AD_B0_06 = PIN(GPIO1, 6, GPIO_AD_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_07 = PIN(GPIO1, 7, GPIO_AD_B0_07, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_08 = PIN(GPIO1, 8, GPIO_AD_B0_08, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_09 = PIN(GPIO1, 9, GPIO_AD_B0_09, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_10 = PIN(GPIO1, 10, GPIO_AD_B0_10, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_11 = PIN(GPIO1, 11, GPIO_AD_B0_11, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 12, GPIO_AD_B0_12, ADC1, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 13, GPIO_AD_B0_13, ADC2, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 14, GPIO_AD_B0_14, ADC2, 1, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 15, GPIO_AD_B0_15, ADC1, 2, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 16, GPIO_AD_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 17, GPIO_AD_B1_01, ADC1, 3, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 18, GPIO_AD_B1_02, ADC2, 3, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 19, GPIO_AD_B1_03, ADC1, 4, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 20, GPIO_AD_B1_04, ADC2, 4, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 21, GPIO_AD_B1_05, ADC2, 5, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 22, GPIO_AD_B1_06, ADC2, 6, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 23, GPIO_AD_B1_07, ADC2, 7, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_08 = PIN(GPIO1, 24, GPIO_AD_B1_08, ADC2, 8, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_09 = PIN(GPIO1, 25, GPIO_AD_B1_09, ADC2, 9, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 26, GPIO_AD_B1_10, ADC2, 10, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 27, GPIO_AD_B1_11, ADC2, 11, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_12 = PIN(GPIO1, 28, GPIO_AD_B1_12, ADC2, 12, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_13 = PIN(GPIO1, 29, GPIO_AD_B1_13, ADC2, 13, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_14 = PIN(GPIO1, 30, GPIO_AD_B1_14, ADC2, 14, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_15 = PIN(GPIO1, 31, GPIO_AD_B1_15, ADC2, 15, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_EMC_00 = PIN(GPIO2, 0, GPIO_EMC_00, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_EMC_01 = PIN(GPIO2, 1, GPIO_EMC_01, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_EMC_02 = PIN(GPIO2, 2, GPIO_EMC_02, NO_ADC, 0, 0x00000005, 0x000010B0); @@ -103,6 +72,38 @@ const mcu_pin_obj_t pin_GPIO_EMC_38 = PIN(GPIO3, 6, GPIO_EMC_38, NO_ADC, 0, 0x00 const mcu_pin_obj_t pin_GPIO_EMC_39 = PIN(GPIO3, 7, GPIO_EMC_39, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_EMC_40 = PIN(GPIO3, 8, GPIO_EMC_40, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_EMC_41 = PIN(GPIO3, 9, GPIO_EMC_41, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_00 = PIN(GPIO1, 0, GPIO_AD_B0_00, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_01 = PIN(GPIO1, 1, GPIO_AD_B0_01, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_02 = PIN(GPIO1, 2, GPIO_AD_B0_02, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_03 = PIN(GPIO1, 3, GPIO_AD_B0_03, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_04 = PIN(GPIO1, 4, GPIO_AD_B0_04, NO_ADC, 0, 0x00000000, 0x000090B1); +const mcu_pin_obj_t pin_GPIO_AD_B0_05 = PIN(GPIO1, 5, GPIO_AD_B0_05, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_06 = PIN(GPIO1, 6, GPIO_AD_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_07 = PIN(GPIO1, 7, GPIO_AD_B0_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_08 = PIN(GPIO1, 8, GPIO_AD_B0_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_09 = PIN(GPIO1, 9, GPIO_AD_B0_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_10 = PIN(GPIO1, 10, GPIO_AD_B0_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_11 = PIN(GPIO1, 11, GPIO_AD_B0_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 12, GPIO_AD_B0_12, ADC1, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 13, GPIO_AD_B0_13, ADC2, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 14, GPIO_AD_B0_14, ADC2, 1, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 15, GPIO_AD_B0_15, ADC2, 2, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 16, GPIO_AD_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 17, GPIO_AD_B1_01, ADC1, 3, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 18, GPIO_AD_B1_02, ADC2, 3, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 19, GPIO_AD_B1_03, ADC1, 4, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 20, GPIO_AD_B1_04, ADC2, 4, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 21, GPIO_AD_B1_05, ADC2, 5, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 22, GPIO_AD_B1_06, ADC2, 6, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 23, GPIO_AD_B1_07, ADC2, 7, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_08 = PIN(GPIO1, 24, GPIO_AD_B1_08, ADC2, 8, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_09 = PIN(GPIO1, 25, GPIO_AD_B1_09, ADC2, 9, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 26, GPIO_AD_B1_10, ADC2, 10, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 27, GPIO_AD_B1_11, ADC2, 11, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_12 = PIN(GPIO1, 28, GPIO_AD_B1_12, ADC2, 12, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_13 = PIN(GPIO1, 29, GPIO_AD_B1_13, ADC2, 13, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_14 = PIN(GPIO1, 30, GPIO_AD_B1_14, ADC2, 14, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_15 = PIN(GPIO1, 31, GPIO_AD_B1_15, ADC2, 15, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_SD_B0_00 = PIN(GPIO3, 13, GPIO_SD_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_SD_B0_01 = PIN(GPIO3, 14, GPIO_SD_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_SD_B0_02 = PIN(GPIO3, 15, GPIO_SD_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); @@ -122,3 +123,6 @@ const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 28, GPIO_SD_B1_08, NO_ADC, 0, const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 29, GPIO_SD_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 30, GPIO_SD_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 31, GPIO_SD_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); + +const mcu_pin_obj_t pin_USB_OTG1_DN = { { &mcu_pin_type }, }; +const mcu_pin_obj_t pin_USB_OTG1_DP = { { &mcu_pin_type }, }; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h index 4485b6e152..118eff9335 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h @@ -3,8 +3,9 @@ * * The MIT License (MIT) * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * Copyright (c) 2019 Artur Pacholec - * Copyright (c) 2020 Scott Shawcroft + * Copyright (c) 2023 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 @@ -25,107 +26,11 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1021_PINS_H -#define MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1021_PINS_H +#pragma once -extern const mcu_pin_obj_t pin_GPIO_AD_B0_00; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_01; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_02; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_03; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_04; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_05; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_06; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_07; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_08; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_09; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_10; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_11; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_12; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_13; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_14; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_15; +#define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; +#include "pin_names.h" +#undef FORMAT_PIN -extern const mcu_pin_obj_t pin_GPIO_AD_B1_00; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_01; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_02; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_03; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_04; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_05; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_06; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_07; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_08; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_09; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_10; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_11; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_12; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_13; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_14; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_15; - -extern const mcu_pin_obj_t pin_GPIO_EMC_00; -extern const mcu_pin_obj_t pin_GPIO_EMC_01; -extern const mcu_pin_obj_t pin_GPIO_EMC_02; -extern const mcu_pin_obj_t pin_GPIO_EMC_03; -extern const mcu_pin_obj_t pin_GPIO_EMC_04; -extern const mcu_pin_obj_t pin_GPIO_EMC_05; -extern const mcu_pin_obj_t pin_GPIO_EMC_06; -extern const mcu_pin_obj_t pin_GPIO_EMC_07; -extern const mcu_pin_obj_t pin_GPIO_EMC_08; -extern const mcu_pin_obj_t pin_GPIO_EMC_09; -extern const mcu_pin_obj_t pin_GPIO_EMC_10; -extern const mcu_pin_obj_t pin_GPIO_EMC_11; -extern const mcu_pin_obj_t pin_GPIO_EMC_12; -extern const mcu_pin_obj_t pin_GPIO_EMC_13; -extern const mcu_pin_obj_t pin_GPIO_EMC_14; -extern const mcu_pin_obj_t pin_GPIO_EMC_15; -extern const mcu_pin_obj_t pin_GPIO_EMC_16; -extern const mcu_pin_obj_t pin_GPIO_EMC_17; -extern const mcu_pin_obj_t pin_GPIO_EMC_18; -extern const mcu_pin_obj_t pin_GPIO_EMC_19; -extern const mcu_pin_obj_t pin_GPIO_EMC_20; -extern const mcu_pin_obj_t pin_GPIO_EMC_21; -extern const mcu_pin_obj_t pin_GPIO_EMC_22; -extern const mcu_pin_obj_t pin_GPIO_EMC_23; -extern const mcu_pin_obj_t pin_GPIO_EMC_24; -extern const mcu_pin_obj_t pin_GPIO_EMC_25; -extern const mcu_pin_obj_t pin_GPIO_EMC_26; -extern const mcu_pin_obj_t pin_GPIO_EMC_27; -extern const mcu_pin_obj_t pin_GPIO_EMC_28; -extern const mcu_pin_obj_t pin_GPIO_EMC_29; -extern const mcu_pin_obj_t pin_GPIO_EMC_30; -extern const mcu_pin_obj_t pin_GPIO_EMC_31; -extern const mcu_pin_obj_t pin_GPIO_EMC_32; -extern const mcu_pin_obj_t pin_GPIO_EMC_33; -extern const mcu_pin_obj_t pin_GPIO_EMC_34; -extern const mcu_pin_obj_t pin_GPIO_EMC_35; -extern const mcu_pin_obj_t pin_GPIO_EMC_36; -extern const mcu_pin_obj_t pin_GPIO_EMC_37; -extern const mcu_pin_obj_t pin_GPIO_EMC_38; -extern const mcu_pin_obj_t pin_GPIO_EMC_39; -extern const mcu_pin_obj_t pin_GPIO_EMC_40; -extern const mcu_pin_obj_t pin_GPIO_EMC_41; - -extern const mcu_pin_obj_t pin_GPIO_SD_B0_00; -extern const mcu_pin_obj_t pin_GPIO_SD_B0_01; -extern const mcu_pin_obj_t pin_GPIO_SD_B0_02; -extern const mcu_pin_obj_t pin_GPIO_SD_B0_03; -extern const mcu_pin_obj_t pin_GPIO_SD_B0_04; -extern const mcu_pin_obj_t pin_GPIO_SD_B0_05; -extern const mcu_pin_obj_t pin_GPIO_SD_B0_06; - -extern const mcu_pin_obj_t pin_GPIO_SD_B1_00; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_01; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_02; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_03; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_04; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_05; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_06; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_07; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_08; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_09; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_10; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_11; - -extern const mcu_pin_obj_t mcu_pin_list[IOMUXC_SW_PAD_CTL_PAD_COUNT]; - -#endif // MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1021_PINS_H +#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 2) +extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/clocks.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/clocks.c new file mode 100644 index 0000000000..f62f974bdd --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/clocks.c @@ -0,0 +1,382 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Artur Pacholec + * + * 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. + */ +/* + * Copyright 2019 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "mpconfigport.h" + +#include "fsl_clock.h" +#include "fsl_iomuxc.h" +#include "fsl_device_registers.h" + +#include "board.h" + +#include "clocks.h" + +#define BOARD_XTAL0_CLK_HZ 24000000U /*!< Board xtal0 frequency in Hz */ +#define BOARD_XTAL32K_CLK_HZ 32768U /*!< Board xtal32k frequency in Hz */ +#define BOARD_BOOTCLOCKRUN_CORE_CLOCK 528000000U /*!< Core clock frequency: 528000000Hz */ + +/******************************************************************************* + * Variables for BOARD_BootClockRUN configuration + ******************************************************************************/ +const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN = +{ + .loopDivider = 100, /* PLL loop divider, Fout = Fin * 50 */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ +}; +const clock_sys_pll_config_t sysPllConfig_BOARD_BootClockRUN = +{ + .loopDivider = 1, /* PLL loop divider, Fout = Fin * ( 20 + loopDivider*2 + numerator / denominator ) */ + .numerator = 0, /* 30 bit numerator of fractional loop divider */ + .denominator = 1, /* 30 bit denominator of fractional loop divider */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ +}; +const clock_usb_pll_config_t usb1PllConfig_BOARD_BootClockRUN = +{ + .loopDivider = 0, /* PLL loop divider, Fout = Fin * 20 */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ +}; +const clock_video_pll_config_t videoPllConfig_BOARD_BootClockRUN = +{ + .loopDivider = 31, /* PLL loop divider, Fout = Fin * ( loopDivider + numerator / denominator ) */ + .postDivider = 8, /* Divider after PLL */ + .numerator = 0, /* 30 bit numerator of fractional loop divider, Fout = Fin * ( loopDivider + numerator / denominator ) */ + .denominator = 1, /* 30 bit denominator of fractional loop divider, Fout = Fin * ( loopDivider + numerator / denominator ) */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ +}; +/******************************************************************************* + * Code for BOARD_BootClockRUN configuration + ******************************************************************************/ +void clocks_init(void) { + /* Init RTC OSC clock frequency. */ + CLOCK_SetRtcXtalFreq(32768U); + /* Enable 1MHz clock output. */ + XTALOSC24M->OSC_CONFIG2 |= XTALOSC24M_OSC_CONFIG2_ENABLE_1M_MASK; + /* Use free 1MHz clock output. */ + XTALOSC24M->OSC_CONFIG2 &= ~XTALOSC24M_OSC_CONFIG2_MUX_1M_MASK; + /* Set XTAL 24MHz clock frequency. */ + CLOCK_SetXtalFreq(24000000U); + /* Enable XTAL 24MHz clock source. */ + CLOCK_InitExternalClk(0); + /* Enable internal RC. */ + CLOCK_InitRcOsc24M(); + /* Switch clock source to external OSC. */ + CLOCK_SwitchOsc(kCLOCK_XtalOsc); + /* Set Oscillator ready counter value. */ + CCM->CCR = (CCM->CCR & (~CCM_CCR_OSCNT_MASK)) | CCM_CCR_OSCNT(127); + /* Setting PeriphClk2Mux and PeriphMux to provide stable clock before PLLs are initialed */ + CLOCK_SetMux(kCLOCK_PeriphClk2Mux, 1); /* Set PERIPH_CLK2 MUX to OSC */ + CLOCK_SetMux(kCLOCK_PeriphMux, 1); /* Set PERIPH_CLK MUX to PERIPH_CLK2 */ + /* Set AHB_PODF. */ + CLOCK_SetDiv(kCLOCK_AhbDiv, 0); + /* Disable IPG clock gate. */ + CLOCK_DisableClock(kCLOCK_Adc1); + CLOCK_DisableClock(kCLOCK_Adc2); + CLOCK_DisableClock(kCLOCK_Xbar1); + CLOCK_DisableClock(kCLOCK_Xbar2); + CLOCK_DisableClock(kCLOCK_Xbar3); + /* Set IPG_PODF. */ + CLOCK_SetDiv(kCLOCK_IpgDiv, 3); + /* Set ARM_PODF. */ + CLOCK_SetDiv(kCLOCK_ArmDiv, 1); + /* Set PERIPH_CLK2_PODF. */ + CLOCK_SetDiv(kCLOCK_PeriphClk2Div, 0); + /* Disable PERCLK clock gate. */ + CLOCK_DisableClock(kCLOCK_Gpt1); + CLOCK_DisableClock(kCLOCK_Gpt1S); + CLOCK_DisableClock(kCLOCK_Gpt2); + CLOCK_DisableClock(kCLOCK_Gpt2S); + CLOCK_DisableClock(kCLOCK_Pit); + /* Set PERCLK_PODF. */ + CLOCK_SetDiv(kCLOCK_PerclkDiv, 1); + /* Disable USDHC1 clock gate. */ + CLOCK_DisableClock(kCLOCK_Usdhc1); + /* Set USDHC1_PODF. */ + CLOCK_SetDiv(kCLOCK_Usdhc1Div, 1); + /* Set Usdhc1 clock source. */ + CLOCK_SetMux(kCLOCK_Usdhc1Mux, 0); + /* Disable USDHC2 clock gate. */ + CLOCK_DisableClock(kCLOCK_Usdhc2); + /* Set USDHC2_PODF. */ + CLOCK_SetDiv(kCLOCK_Usdhc2Div, 1); + /* Set Usdhc2 clock source. */ + CLOCK_SetMux(kCLOCK_Usdhc2Mux, 0); + /* In SDK projects, SDRAM (configured by SEMC) will be initialized in either debug script or dcd. + * With this macro SKIP_SYSCLK_INIT, system pll (selected to be SEMC source clock in SDK projects) will be left unchanged. + * Note: If another clock source is selected for SEMC, user may want to avoid changing that clock as well.*/ + #ifndef SKIP_SYSCLK_INIT + /* Disable Semc clock gate. */ + CLOCK_DisableClock(kCLOCK_Semc); + /* Set SEMC_PODF. */ + CLOCK_SetDiv(kCLOCK_SemcDiv, 7); + /* Set Semc alt clock source. */ + CLOCK_SetMux(kCLOCK_SemcAltMux, 0); + /* Set Semc clock source. */ + CLOCK_SetMux(kCLOCK_SemcMux, 0); + #endif + /* In SDK projects, external flash (configured by FLEXSPI) will be initialized by dcd. + * With this macro XIP_EXTERNAL_FLASH, usb1 pll (selected to be FLEXSPI clock source in SDK projects) will be left unchanged. + * Note: If another clock source is selected for FLEXSPI, user may want to avoid changing that clock as well.*/ + #if !(defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)) + /* Disable Flexspi clock gate. */ + CLOCK_DisableClock(kCLOCK_FlexSpi); + /* Set FLEXSPI_PODF. */ + CLOCK_SetDiv(kCLOCK_FlexspiDiv, 1); + /* Set Flexspi clock source. */ + CLOCK_SetMux(kCLOCK_FlexspiMux, 3); + #endif + /* Disable Flexspi2 clock gate. */ + CLOCK_DisableClock(kCLOCK_FlexSpi2); + /* Set FLEXSPI2_PODF. */ + CLOCK_SetDiv(kCLOCK_Flexspi2Div, 1); + /* Set Flexspi2 clock source. */ + CLOCK_SetMux(kCLOCK_Flexspi2Mux, 1); + /* Disable LPSPI clock gate. */ + CLOCK_DisableClock(kCLOCK_Lpspi1); + CLOCK_DisableClock(kCLOCK_Lpspi2); + CLOCK_DisableClock(kCLOCK_Lpspi3); + /* Set LPSPI_PODF. */ + CLOCK_SetDiv(kCLOCK_LpspiDiv, 4); + /* Set Lpspi clock source. */ + CLOCK_SetMux(kCLOCK_LpspiMux, 2); + /* Disable TRACE clock gate. */ + CLOCK_DisableClock(kCLOCK_Trace); + /* Set TRACE_PODF. */ + CLOCK_SetDiv(kCLOCK_TraceDiv, 3); + /* Set Trace clock source. */ + CLOCK_SetMux(kCLOCK_TraceMux, 0); + /* Disable SAI1 clock gate. */ + CLOCK_DisableClock(kCLOCK_Sai1); + /* Set SAI1_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Sai1PreDiv, 3); + /* Set SAI1_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Sai1Div, 1); + /* Set Sai1 clock source. */ + CLOCK_SetMux(kCLOCK_Sai1Mux, 0); + /* Disable SAI2 clock gate. */ + CLOCK_DisableClock(kCLOCK_Sai2); + /* Set SAI2_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Sai2PreDiv, 3); + /* Set SAI2_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Sai2Div, 1); + /* Set Sai2 clock source. */ + CLOCK_SetMux(kCLOCK_Sai2Mux, 0); + /* Disable SAI3 clock gate. */ + CLOCK_DisableClock(kCLOCK_Sai3); + /* Set SAI3_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Sai3PreDiv, 3); + /* Set SAI3_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Sai3Div, 1); + /* Set Sai3 clock source. */ + CLOCK_SetMux(kCLOCK_Sai3Mux, 0); + /* Disable Lpi2c clock gate. */ + CLOCK_DisableClock(kCLOCK_Lpi2c1); + CLOCK_DisableClock(kCLOCK_Lpi2c2); + CLOCK_DisableClock(kCLOCK_Lpi2c3); + /* Set LPI2C_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Lpi2cDiv, 0); + /* Set Lpi2c clock source. */ + CLOCK_SetMux(kCLOCK_Lpi2cMux, 0); + /* Disable CAN clock gate. */ + CLOCK_DisableClock(kCLOCK_Can1); + CLOCK_DisableClock(kCLOCK_Can2); + CLOCK_DisableClock(kCLOCK_Can1S); + CLOCK_DisableClock(kCLOCK_Can2S); + /* Set CAN_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_CanDiv, 1); + /* Set Can clock source. */ + CLOCK_SetMux(kCLOCK_CanMux, 2); + /* Disable UART clock gate. */ + CLOCK_DisableClock(kCLOCK_Lpuart1); + CLOCK_DisableClock(kCLOCK_Lpuart2); + CLOCK_DisableClock(kCLOCK_Lpuart3); + CLOCK_DisableClock(kCLOCK_Lpuart4); + CLOCK_DisableClock(kCLOCK_Lpuart5); + CLOCK_DisableClock(kCLOCK_Lpuart6); + CLOCK_DisableClock(kCLOCK_Lpuart7); + CLOCK_DisableClock(kCLOCK_Lpuart8); + /* Set UART_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_UartDiv, 0); + /* Set Uart clock source. */ + CLOCK_SetMux(kCLOCK_UartMux, 0); + /* Disable LCDIF clock gate. */ + CLOCK_DisableClock(kCLOCK_LcdPixel); + /* Set LCDIF_PRED. */ + CLOCK_SetDiv(kCLOCK_LcdifPreDiv, 1); + /* Set LCDIF_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_LcdifDiv, 3); + /* Set Lcdif pre clock source. */ + CLOCK_SetMux(kCLOCK_LcdifPreMux, 5); + /* Disable SPDIF clock gate. */ + CLOCK_DisableClock(kCLOCK_Spdif); + /* Set SPDIF0_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Spdif0PreDiv, 1); + /* Set SPDIF0_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Spdif0Div, 7); + /* Set Spdif clock source. */ + CLOCK_SetMux(kCLOCK_SpdifMux, 3); + /* Disable Flexio1 clock gate. */ + CLOCK_DisableClock(kCLOCK_Flexio1); + /* Set FLEXIO1_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Flexio1PreDiv, 1); + /* Set FLEXIO1_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Flexio1Div, 7); + /* Set Flexio1 clock source. */ + CLOCK_SetMux(kCLOCK_Flexio1Mux, 3); + /* Disable Flexio2 clock gate. */ + CLOCK_DisableClock(kCLOCK_Flexio2); + /* Set FLEXIO2_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Flexio2PreDiv, 1); + /* Set FLEXIO2_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Flexio2Div, 7); + /* Set Flexio2 clock source. */ + CLOCK_SetMux(kCLOCK_Flexio2Mux, 3); + /* Set Pll3 sw clock source. */ + CLOCK_SetMux(kCLOCK_Pll3SwMux, 0); + /* Init ARM PLL. */ + CLOCK_InitArmPll(&armPllConfig_BOARD_BootClockRUN); + /* In SDK projects, SDRAM (configured by SEMC) will be initialized in either debug script or dcd. + * With this macro SKIP_SYSCLK_INIT, system pll (selected to be SEMC source clock in SDK projects) will be left unchanged. + * Note: If another clock source is selected for SEMC, user may want to avoid changing that clock as well.*/ + #ifndef SKIP_SYSCLK_INIT + #if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (XIP_BOOT_HEADER_DCD_ENABLE == 1) + #warning "SKIP_SYSCLK_INIT should be defined to keep system pll (selected to be SEMC source clock in SDK projects) unchanged." + #endif + /* Init System PLL. */ + CLOCK_InitSysPll(&sysPllConfig_BOARD_BootClockRUN); + /* Init System pfd0. */ + CLOCK_InitSysPfd(kCLOCK_Pfd0, 27); + /* Init System pfd1. */ + CLOCK_InitSysPfd(kCLOCK_Pfd1, 16); + /* Init System pfd2. */ + CLOCK_InitSysPfd(kCLOCK_Pfd2, 24); + /* Init System pfd3. */ + CLOCK_InitSysPfd(kCLOCK_Pfd3, 16); + #endif + /* In SDK projects, external flash (configured by FLEXSPI) will be initialized by dcd. + * With this macro XIP_EXTERNAL_FLASH, usb1 pll (selected to be FLEXSPI clock source in SDK projects) will be left unchanged. + * Note: If another clock source is selected for FLEXSPI, user may want to avoid changing that clock as well.*/ + #if !(defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)) + /* Init Usb1 PLL. */ + CLOCK_InitUsb1Pll(&usb1PllConfig_BOARD_BootClockRUN); + /* Init Usb1 pfd0. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd0, 33); + /* Init Usb1 pfd1. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd1, 16); + /* Init Usb1 pfd2. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd2, 17); + /* Init Usb1 pfd3. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd3, 19); + /* Disable Usb1 PLL output for USBPHY1. */ + CCM_ANALOG->PLL_USB1 &= ~CCM_ANALOG_PLL_USB1_EN_USB_CLKS_MASK; + #endif + /* DeInit Audio PLL. */ + CLOCK_DeinitAudioPll(); + /* Bypass Audio PLL. */ + CLOCK_SetPllBypass(CCM_ANALOG, kCLOCK_PllAudio, 1); + /* Set divider for Audio PLL. */ + CCM_ANALOG->MISC2 &= ~CCM_ANALOG_MISC2_AUDIO_DIV_LSB_MASK; + CCM_ANALOG->MISC2 &= ~CCM_ANALOG_MISC2_AUDIO_DIV_MSB_MASK; + /* Enable Audio PLL output. */ + CCM_ANALOG->PLL_AUDIO |= CCM_ANALOG_PLL_AUDIO_ENABLE_MASK; + /* Init Video PLL. */ + uint32_t pllVideo; + /* Disable Video PLL output before initial Video PLL. */ + CCM_ANALOG->PLL_VIDEO &= ~CCM_ANALOG_PLL_VIDEO_ENABLE_MASK; + /* Bypass PLL first */ + CCM_ANALOG->PLL_VIDEO = (CCM_ANALOG->PLL_VIDEO & (~CCM_ANALOG_PLL_VIDEO_BYPASS_CLK_SRC_MASK)) | + CCM_ANALOG_PLL_VIDEO_BYPASS_MASK | CCM_ANALOG_PLL_VIDEO_BYPASS_CLK_SRC(0); + CCM_ANALOG->PLL_VIDEO_NUM = CCM_ANALOG_PLL_VIDEO_NUM_A(0); + CCM_ANALOG->PLL_VIDEO_DENOM = CCM_ANALOG_PLL_VIDEO_DENOM_B(1); + pllVideo = (CCM_ANALOG->PLL_VIDEO & (~(CCM_ANALOG_PLL_VIDEO_DIV_SELECT_MASK | CCM_ANALOG_PLL_VIDEO_POWERDOWN_MASK))) | + CCM_ANALOG_PLL_VIDEO_ENABLE_MASK | CCM_ANALOG_PLL_VIDEO_DIV_SELECT(31); + pllVideo |= CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT(1); + CCM_ANALOG->MISC2 = (CCM_ANALOG->MISC2 & (~CCM_ANALOG_MISC2_VIDEO_DIV_MASK)) | CCM_ANALOG_MISC2_VIDEO_DIV(3); + CCM_ANALOG->PLL_VIDEO = pllVideo; + while ((CCM_ANALOG->PLL_VIDEO & CCM_ANALOG_PLL_VIDEO_LOCK_MASK) == 0) { + } + /* Disable bypass for Video PLL. */ + CLOCK_SetPllBypass(CCM_ANALOG, kCLOCK_PllVideo, 0); + /* DeInit Enet PLL. */ + CLOCK_DeinitEnetPll(); + /* Bypass Enet PLL. */ + CLOCK_SetPllBypass(CCM_ANALOG, kCLOCK_PllEnet, 1); + /* Set Enet output divider. */ + CCM_ANALOG->PLL_ENET = (CCM_ANALOG->PLL_ENET & (~CCM_ANALOG_PLL_ENET_DIV_SELECT_MASK)) | CCM_ANALOG_PLL_ENET_DIV_SELECT(1); + /* Enable Enet output. */ + CCM_ANALOG->PLL_ENET |= CCM_ANALOG_PLL_ENET_ENABLE_MASK; + /* Enable Enet25M output. */ + CCM_ANALOG->PLL_ENET |= CCM_ANALOG_PLL_ENET_ENET_25M_REF_EN_MASK; + /* Set preperiph clock source. */ + CLOCK_SetMux(kCLOCK_PrePeriphMux, 0); + /* Set periph clock source. */ + CLOCK_SetMux(kCLOCK_PeriphMux, 0); + /* Set periph clock2 clock source. */ + CLOCK_SetMux(kCLOCK_PeriphClk2Mux, 0); + /* Set per clock source. */ + CLOCK_SetMux(kCLOCK_PerclkMux, 0); + /* Set lvds1 clock source. */ + CCM_ANALOG->MISC1 = (CCM_ANALOG->MISC1 & (~CCM_ANALOG_MISC1_LVDS1_CLK_SEL_MASK)) | CCM_ANALOG_MISC1_LVDS1_CLK_SEL(0); + /* Set clock out1 divider. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO1_DIV_MASK)) | CCM_CCOSR_CLKO1_DIV(0); + /* Set clock out1 source. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO1_SEL_MASK)) | CCM_CCOSR_CLKO1_SEL(1); + /* Set clock out2 divider. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO2_DIV_MASK)) | CCM_CCOSR_CLKO2_DIV(0); + /* Set clock out2 source. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO2_SEL_MASK)) | CCM_CCOSR_CLKO2_SEL(18); + /* Set clock out1 drives clock out1. */ + CCM->CCOSR &= ~CCM_CCOSR_CLK_OUT_SEL_MASK; + /* Disable clock out1. */ + CCM->CCOSR &= ~CCM_CCOSR_CLKO1_EN_MASK; + /* Disable clock out2. */ + CCM->CCOSR &= ~CCM_CCOSR_CLKO2_EN_MASK; + /* Set SAI1 MCLK1 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk1Sel, 0); + /* Set SAI1 MCLK2 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk2Sel, 0); + /* Set SAI1 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk3Sel, 0); + /* Set SAI2 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI2MClk3Sel, 0); + /* Set SAI3 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI3MClk3Sel, 0); + /* Set MQS configuration. */ + IOMUXC_MQSConfig(IOMUXC_GPR,kIOMUXC_MqsPwmOverSampleRate32, 0); + /* Set ENET Ref clock source. */ + IOMUXC_GPR->GPR1 &= ~IOMUXC_GPR_GPR1_ENET1_TX_CLK_DIR_MASK; + /* Set GPT1 High frequency reference clock source. */ + IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT1_MASK; + /* Set GPT2 High frequency reference clock source. */ + IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT2_MASK; + /* Set SystemCoreClock variable. */ + SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK; +} diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.c new file mode 100644 index 0000000000..bbd41e7007 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.c @@ -0,0 +1,356 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 "py/obj.h" +#include "py/mphal.h" +#include "mimxrt10xx/periph.h" + +LPI2C_Type *const mcu_i2c_banks[4] = { LPI2C1, LPI2C2, LPI2C3, LPI2C4 }; + +const mcu_periph_obj_t mcu_i2c_sda_list[9] = { + PERIPH_PIN(1, 2, kIOMUXC_LPI2C1_SDA_SELECT_INPUT, 0, &pin_GPIO_SD_B1_05), + PERIPH_PIN(1, 3, kIOMUXC_LPI2C1_SDA_SELECT_INPUT, 1, &pin_GPIO_AD_B1_01), + + PERIPH_PIN(2, 3, kIOMUXC_LPI2C2_SDA_SELECT_INPUT, 0, &pin_GPIO_SD_B1_10), + PERIPH_PIN(2, 2, kIOMUXC_LPI2C2_SDA_SELECT_INPUT, 1, &pin_GPIO_B0_05), + + PERIPH_PIN(3, 2, kIOMUXC_LPI2C3_SDA_SELECT_INPUT, 0, &pin_GPIO_EMC_21), + PERIPH_PIN(3, 2, kIOMUXC_LPI2C3_SDA_SELECT_INPUT, 1, &pin_GPIO_SD_B0_01), + PERIPH_PIN(3, 1, kIOMUXC_LPI2C3_SDA_SELECT_INPUT, 2, &pin_GPIO_AD_B1_06), + + PERIPH_PIN(4, 2, kIOMUXC_LPI2C4_SDA_SELECT_INPUT, 0, &pin_GPIO_EMC_11), + PERIPH_PIN(4, 0, kIOMUXC_LPI2C4_SDA_SELECT_INPUT, 1, &pin_GPIO_AD_B0_13), +}; + +const mcu_periph_obj_t mcu_i2c_scl_list[9] = { + PERIPH_PIN(1, 2, kIOMUXC_LPI2C1_SCL_SELECT_INPUT, 0, &pin_GPIO_SD_B1_04), + PERIPH_PIN(1, 3, kIOMUXC_LPI2C1_SCL_SELECT_INPUT, 1, &pin_GPIO_AD_B1_00), + + PERIPH_PIN(2, 3, kIOMUXC_LPI2C2_SCL_SELECT_INPUT, 0, &pin_GPIO_SD_B1_11), + PERIPH_PIN(2, 2, kIOMUXC_LPI2C2_SCL_SELECT_INPUT, 1, &pin_GPIO_B0_04), + + PERIPH_PIN(3, 2, kIOMUXC_LPI2C3_SCL_SELECT_INPUT, 0, &pin_GPIO_EMC_22), + PERIPH_PIN(3, 2, kIOMUXC_LPI2C3_SCL_SELECT_INPUT, 1, &pin_GPIO_SD_B0_00), + PERIPH_PIN(3, 1, kIOMUXC_LPI2C3_SCL_SELECT_INPUT, 2, &pin_GPIO_AD_B1_07), + + PERIPH_PIN(4, 2, kIOMUXC_LPI2C4_SCL_SELECT_INPUT, 0, &pin_GPIO_EMC_12), + PERIPH_PIN(4, 0, kIOMUXC_LPI2C4_SCL_SELECT_INPUT, 1, &pin_GPIO_AD_B0_12), +}; + +LPSPI_Type *const mcu_spi_banks[3] = { LPSPI1, LPSPI2, LPSPI3 }; + +const mcu_periph_obj_t mcu_spi_sck_list[6] = { + PERIPH_PIN(1, 3, kIOMUXC_LPSPI1_SCK_SELECT_INPUT, 0, &pin_GPIO_EMC_27), + PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SCK_SELECT_INPUT, 1, &pin_GPIO_SD_B0_00), + + PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SCK_SELECT_INPUT, 0, &pin_GPIO_SD_B1_07), + PERIPH_PIN(2, 2, kIOMUXC_LPSPI2_SCK_SELECT_INPUT, 1, &pin_GPIO_EMC_00), + + PERIPH_PIN(3, 3, kIOMUXC_LPSPI3_SCK_SELECT_INPUT, 0, &pin_GPIO_B0_03), + PERIPH_PIN(3, 1, kIOMUXC_LPSPI3_SCK_SELECT_INPUT, 1, &pin_GPIO_B1_07), +}; + +const mcu_periph_obj_t mcu_spi_sdo_list[6] = { + PERIPH_PIN(1, 3, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 0, &pin_GPIO_EMC_28), + PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 1, &pin_GPIO_SD_B0_02), + + PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 0, &pin_GPIO_SD_B1_08), + PERIPH_PIN(2, 2, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 1, &pin_GPIO_EMC_02), + + PERIPH_PIN(3, 3, kIOMUXC_LPSPI3_SDO_SELECT_INPUT, 0, &pin_GPIO_B0_02), + PERIPH_PIN(3, 1, kIOMUXC_LPSPI3_SDO_SELECT_INPUT, 1, &pin_GPIO_B1_06), +}; + +const mcu_periph_obj_t mcu_spi_sdi_list[6] = { + PERIPH_PIN(1, 3, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 0, &pin_GPIO_EMC_29), + PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 1, &pin_GPIO_SD_B0_03), + + PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 0, &pin_GPIO_SD_B1_09), + PERIPH_PIN(2, 2, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 1, &pin_GPIO_EMC_03), + + PERIPH_PIN(3, 3, kIOMUXC_LPSPI3_SDI_SELECT_INPUT, 0, &pin_GPIO_B0_01), + PERIPH_PIN(3, 1, kIOMUXC_LPSPI3_SDI_SELECT_INPUT, 1, &pin_GPIO_B1_05), +}; + +LPUART_Type *const mcu_uart_banks[8] = { LPUART1, LPUART2, LPUART3, LPUART4, LPUART5, LPUART6, LPUART7, LPUART8 }; + +const mcu_periph_obj_t mcu_uart_rx_list[16] = { + PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_13), + + PERIPH_PIN(2, 2, kIOMUXC_LPUART2_RX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_10), + PERIPH_PIN(2, 2, kIOMUXC_LPUART2_RX_SELECT_INPUT, 1, &pin_GPIO_AD_B1_03), + + PERIPH_PIN(3, 2, kIOMUXC_LPUART3_RX_SELECT_INPUT, 0, &pin_GPIO_AD_B1_07), + PERIPH_PIN(3, 2, kIOMUXC_LPUART3_RX_SELECT_INPUT, 1, &pin_GPIO_EMC_14), + PERIPH_PIN(3, 3, kIOMUXC_LPUART3_RX_SELECT_INPUT, 2, &pin_GPIO_B0_09), + + PERIPH_PIN(4, 4, kIOMUXC_LPUART4_RX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_01), + PERIPH_PIN(4, 2, kIOMUXC_LPUART4_RX_SELECT_INPUT, 1, &pin_GPIO_EMC_20), + PERIPH_PIN(4, 2, kIOMUXC_LPUART4_RX_SELECT_INPUT, 2, &pin_GPIO_B1_01), + + PERIPH_PIN(5, 2, kIOMUXC_LPUART5_RX_SELECT_INPUT, 0, &pin_GPIO_EMC_24), + PERIPH_PIN(5, 1, kIOMUXC_LPUART5_RX_SELECT_INPUT, 1, &pin_GPIO_B1_13), + + PERIPH_PIN(6, 2, kIOMUXC_LPUART6_RX_SELECT_INPUT, 0, &pin_GPIO_EMC_26), + + PERIPH_PIN(7, 2, kIOMUXC_LPUART7_RX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_09), + PERIPH_PIN(7, 2, kIOMUXC_LPUART7_RX_SELECT_INPUT, 1, &pin_GPIO_EMC_32), + + PERIPH_PIN(8, 2, kIOMUXC_LPUART8_RX_SELECT_INPUT, 0, &pin_GPIO_SD_B0_05), + PERIPH_PIN(8, 2, kIOMUXC_LPUART8_RX_SELECT_INPUT, 2, &pin_GPIO_EMC_39), +}; + +const mcu_periph_obj_t mcu_uart_tx_list[16] = { + PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_12), + + PERIPH_PIN(2, 2, kIOMUXC_LPUART2_TX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_11), + PERIPH_PIN(2, 2, kIOMUXC_LPUART2_TX_SELECT_INPUT, 1, &pin_GPIO_AD_B1_02), + + PERIPH_PIN(3, 2, kIOMUXC_LPUART3_TX_SELECT_INPUT, 0, &pin_GPIO_AD_B1_06), + PERIPH_PIN(3, 2, kIOMUXC_LPUART3_TX_SELECT_INPUT, 1, &pin_GPIO_EMC_13), + PERIPH_PIN(3, 3, kIOMUXC_LPUART3_TX_SELECT_INPUT, 2, &pin_GPIO_B0_08), + + PERIPH_PIN(4, 4, kIOMUXC_LPUART4_TX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_00), + PERIPH_PIN(4, 2, kIOMUXC_LPUART4_TX_SELECT_INPUT, 1, &pin_GPIO_EMC_19), + PERIPH_PIN(4, 2, kIOMUXC_LPUART4_TX_SELECT_INPUT, 2, &pin_GPIO_B1_00), + + PERIPH_PIN(5, 2, kIOMUXC_LPUART5_TX_SELECT_INPUT, 0, &pin_GPIO_EMC_23), + PERIPH_PIN(5, 1, kIOMUXC_LPUART5_TX_SELECT_INPUT, 1, &pin_GPIO_B1_12), + + PERIPH_PIN(6, 2, kIOMUXC_LPUART6_TX_SELECT_INPUT, 0, &pin_GPIO_EMC_25), + + PERIPH_PIN(7, 2, kIOMUXC_LPUART7_TX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_08), + PERIPH_PIN(7, 2, kIOMUXC_LPUART7_TX_SELECT_INPUT, 1, &pin_GPIO_EMC_31), + + PERIPH_PIN(8, 2, kIOMUXC_LPUART8_TX_SELECT_INPUT, 0, &pin_GPIO_SD_B0_04), + PERIPH_PIN(8, 2, kIOMUXC_LPUART8_TX_SELECT_INPUT, 2, &pin_GPIO_EMC_38), +}; + +const mcu_periph_obj_t mcu_uart_rts_list[9] = { + PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_15), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_AD_B1_01), + + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_16), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B1_05), + + PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_EMC_18), + + PERIPH_PIN(5, 2, 0, 0, &pin_GPIO_EMC_27), + + PERIPH_PIN(6, 2, 0, 0, &pin_GPIO_EMC_29), + + PERIPH_PIN(7, 2, 0, 0, &pin_GPIO_SD_B1_07), + + PERIPH_PIN(8, 2, 0, 0, &pin_GPIO_SD_B0_03), +}; + +const mcu_periph_obj_t mcu_uart_cts_list[9] = { + PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_14), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_AD_B1_00), + + PERIPH_PIN(3, 2, kIOMUXC_LPUART3_CTS_B_SELECT_INPUT, 0, &pin_GPIO_EMC_15), + PERIPH_PIN(3, 2, kIOMUXC_LPUART3_CTS_B_SELECT_INPUT, 1, &pin_GPIO_AD_B1_04), + + PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_EMC_17), + + PERIPH_PIN(5, 2, 0, 0, &pin_GPIO_EMC_28), + + PERIPH_PIN(6, 2, 0, 0, &pin_GPIO_EMC_30), + + PERIPH_PIN(7, 2, 0, 0, &pin_GPIO_SD_B1_06), + + PERIPH_PIN(8, 2, 0, 0, &pin_GPIO_SD_B0_02), +}; + +I2S_Type *const mcu_i2s_banks[3] = { SAI1, SAI2, SAI3 }; + +const mcu_periph_obj_t mcu_i2s_rx_data0_list[6] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_DATA0_SELECT_INPUT, 0, &pin_GPIO_SD_B1_06), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_DATA0_SELECT_INPUT, 2, &pin_GPIO_B1_00), + + PERIPH_PIN(2, 2, kIOMUXC_SAI2_RX_DATA0_SELECT_INPUT, 0, &pin_GPIO_EMC_08), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_RX_DATA0_SELECT_INPUT, 1, &pin_GPIO_AD_B0_08), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_33), + PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_00), +}; + +const mcu_periph_obj_t mcu_i2s_rx_sync_list[6] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_SYNC_SELECT_INPUT, 0, &pin_GPIO_SD_B1_04), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_SYNC_SELECT_INPUT, 2, &pin_GPIO_B0_14), + + PERIPH_PIN(2, 2, kIOMUXC_SAI2_RX_SYNC_SELECT_INPUT, 0, &pin_GPIO_EMC_09), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_RX_SYNC_SELECT_INPUT, 1, &pin_GPIO_AD_B0_07), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_34), + PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_05), +}; + +const mcu_periph_obj_t mcu_i2s_tx_bclk_list[6] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_BCLK_SELECT_INPUT, 0, &pin_GPIO_SD_B1_08), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_BCLK_SELECT_INPUT, 2, &pin_GPIO_B1_02), + + PERIPH_PIN(2, 2, kIOMUXC_SAI2_TX_BCLK_SELECT_INPUT, 0, &pin_GPIO_EMC_06), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_TX_BCLK_SELECT_INPUT, 1, &pin_GPIO_AD_B0_05), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_38), + PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_03), +}; + +const mcu_periph_obj_t mcu_i2s_tx_data0_list[6] = { + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_B1_01), + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_SD_B1_07), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_04), + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_AD_B0_09), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_36), + PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_01), +}; + +const mcu_periph_obj_t mcu_i2s_tx_sync_list[6] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_SYNC_SELECT_INPUT, 0, &pin_GPIO_SD_B1_09), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_SYNC_SELECT_INPUT, 2, &pin_GPIO_B1_03), + + PERIPH_PIN(2, 2, kIOMUXC_SAI2_TX_SYNC_SELECT_INPUT, 0, &pin_GPIO_EMC_05), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_TX_SYNC_SELECT_INPUT, 1, &pin_GPIO_AD_B0_04), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_39), + PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_02), +}; + +const mcu_periph_obj_t mcu_mqs_left_list[3] = { + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_14), + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_05), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_B0_01), +}; + +const mcu_periph_obj_t mcu_mqs_right_list[3] = { + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_13), + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_04), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_B0_00), +}; + +const mcu_pwm_obj_t mcu_pwm_list[61] = { + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_23_FLEXPWM1_PWMA00, &pin_GPIO_EMC_23), + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_SD_B0_00_FLEXPWM1_PWMA00, &pin_GPIO_SD_B0_00), + + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_24_FLEXPWM1_PWMB00, &pin_GPIO_EMC_24), + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_SD_B0_01_FLEXPWM1_PWMB00, &pin_GPIO_SD_B0_01), + + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_25_FLEXPWM1_PWMA01, &pin_GPIO_EMC_25), + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_SD_B0_02_FLEXPWM1_PWMA01, &pin_GPIO_SD_B0_02), + + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_26_FLEXPWM1_PWMB01, &pin_GPIO_EMC_26), + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_SD_B0_03_FLEXPWM1_PWMB01, &pin_GPIO_SD_B0_03), + + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_27_FLEXPWM1_PWMA02, &pin_GPIO_EMC_27), + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_SD_B0_04_FLEXPWM1_PWMA02, &pin_GPIO_SD_B0_04), + + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_28_FLEXPWM1_PWMB02, &pin_GPIO_EMC_28), + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_SD_B0_05_FLEXPWM1_PWMB02, &pin_GPIO_SD_B0_05), + + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmX, IOMUXC_GPIO_AD_B0_12_FLEXPWM1_PWMX02, &pin_GPIO_AD_B0_12), + + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_12_FLEXPWM1_PWMA03, &pin_GPIO_EMC_12), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_38_FLEXPWM1_PWMA03, &pin_GPIO_EMC_38), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B0_10_FLEXPWM1_PWMA03, &pin_GPIO_AD_B0_10), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_B1_00_FLEXPWM1_PWMA03, &pin_GPIO_B1_00), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_SD_B1_00_FLEXPWM1_PWMA03, &pin_GPIO_SD_B1_00), + + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_13_FLEXPWM1_PWMB03, &pin_GPIO_EMC_13), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_39_FLEXPWM1_PWMB03, &pin_GPIO_EMC_39), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_AD_B0_11_FLEXPWM1_PWMB03, &pin_GPIO_AD_B0_11), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_B1_01_FLEXPWM1_PWMB03, &pin_GPIO_B1_01), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_SD_B1_01_FLEXPWM1_PWMB03, &pin_GPIO_SD_B1_01), + + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmX, IOMUXC_GPIO_AD_B0_13_FLEXPWM1_PWMX03, &pin_GPIO_AD_B0_13), + + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_06_FLEXPWM2_PWMA00, &pin_GPIO_EMC_06), + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_B0_06_FLEXPWM2_PWMA00, &pin_GPIO_B0_06), + + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_07_FLEXPWM2_PWMB00, &pin_GPIO_EMC_07), + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_B0_07_FLEXPWM2_PWMB00, &pin_GPIO_B0_07), + + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_08_FLEXPWM2_PWMA01, &pin_GPIO_EMC_08), + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_B0_08_FLEXPWM2_PWMA01, &pin_GPIO_B0_08), + + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_09_FLEXPWM2_PWMB01, &pin_GPIO_EMC_09), + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_B0_09_FLEXPWM2_PWMB01, &pin_GPIO_B0_09), + + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_10_FLEXPWM2_PWMA02, &pin_GPIO_EMC_10), + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_B0_10_FLEXPWM2_PWMA02, &pin_GPIO_B0_10), + + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_11_FLEXPWM2_PWMB02, &pin_GPIO_EMC_11), + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_B0_11_FLEXPWM2_PWMB02, &pin_GPIO_B0_11), + + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_19_FLEXPWM2_PWMA03, &pin_GPIO_EMC_19), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B0_09_FLEXPWM2_PWMA03, &pin_GPIO_AD_B0_09), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_B1_02_FLEXPWM2_PWMA03, &pin_GPIO_B1_02), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_SD_B1_02_FLEXPWM2_PWMA03, &pin_GPIO_SD_B1_02), + + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_20_FLEXPWM2_PWMB03, &pin_GPIO_EMC_20), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_B1_03_FLEXPWM2_PWMB03, &pin_GPIO_B1_03), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_SD_B1_03_FLEXPWM2_PWMB03, &pin_GPIO_SD_B1_03), + + PWM_PIN(PWM3, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_29_FLEXPWM3_PWMA00, &pin_GPIO_EMC_29), + + PWM_PIN(PWM3, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_30_FLEXPWM3_PWMB00, &pin_GPIO_EMC_30), + + PWM_PIN(PWM3, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_31_FLEXPWM3_PWMA01, &pin_GPIO_EMC_31), + + PWM_PIN(PWM3, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_32_FLEXPWM3_PWMB01, &pin_GPIO_EMC_32), + + PWM_PIN(PWM3, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_33_FLEXPWM3_PWMA02, &pin_GPIO_EMC_33), + + PWM_PIN(PWM3, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_34_FLEXPWM3_PWMB02, &pin_GPIO_EMC_34), + + PWM_PIN(PWM3, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_21_FLEXPWM3_PWMA03, &pin_GPIO_EMC_21), + + PWM_PIN(PWM3, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_22_FLEXPWM3_PWMB03, &pin_GPIO_EMC_22), + + PWM_PIN(PWM4, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_00_FLEXPWM4_PWMA00, &pin_GPIO_EMC_00), + + PWM_PIN(PWM4, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_01_FLEXPWM4_PWMB00, &pin_GPIO_EMC_01), + + PWM_PIN(PWM4, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_02_FLEXPWM4_PWMA01, &pin_GPIO_EMC_02), + + PWM_PIN(PWM4, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_03_FLEXPWM4_PWMB01, &pin_GPIO_EMC_03), + + PWM_PIN(PWM4, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_04_FLEXPWM4_PWMA02, &pin_GPIO_EMC_04), + PWM_PIN(PWM4, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_B1_14_FLEXPWM4_PWMA02, &pin_GPIO_B1_14), + + PWM_PIN(PWM4, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_05_FLEXPWM4_PWMB02, &pin_GPIO_EMC_05), + + PWM_PIN(PWM4, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_17_FLEXPWM4_PWMA03, &pin_GPIO_EMC_17), + PWM_PIN(PWM4, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_B1_15_FLEXPWM4_PWMA03, &pin_GPIO_B1_15), + + PWM_PIN(PWM4, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_18_FLEXPWM4_PWMB03, &pin_GPIO_EMC_18), +}; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.h new file mode 100644 index 0000000000..69a15dc50c --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.h @@ -0,0 +1,55 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + +#pragma once +extern LPI2C_Type *const mcu_i2c_banks[4]; +extern const mcu_periph_obj_t mcu_i2c_sda_list[9]; +extern const mcu_periph_obj_t mcu_i2c_scl_list[9]; + +extern LPSPI_Type *const mcu_spi_banks[3]; +extern const mcu_periph_obj_t mcu_spi_sck_list[6]; +extern const mcu_periph_obj_t mcu_spi_sdo_list[6]; +extern const mcu_periph_obj_t mcu_spi_sdi_list[6]; + +extern LPUART_Type *const mcu_uart_banks[8]; +extern const mcu_periph_obj_t mcu_uart_rx_list[16]; +extern const mcu_periph_obj_t mcu_uart_tx_list[16]; +extern const mcu_periph_obj_t mcu_uart_rts_list[9]; +extern const mcu_periph_obj_t mcu_uart_cts_list[9]; + +extern I2S_Type *const mcu_i2s_banks[3]; +extern const mcu_periph_obj_t mcu_i2s_rx_data0_list[6]; +extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[6]; +extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[6]; +extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[6]; +extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[6]; + +extern const mcu_periph_obj_t mcu_mqs_left_list[3]; +extern const mcu_periph_obj_t mcu_mqs_right_list[3]; + +extern const mcu_pwm_obj_t mcu_pwm_list[61]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pin_names.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pin_names.h new file mode 100644 index 0000000000..05b3110bf3 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pin_names.h @@ -0,0 +1,151 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + + +// define FORMAT_PIN(pin_name) and then include this file. + +FORMAT_PIN(GPIO_EMC_00) +FORMAT_PIN(GPIO_EMC_01) +FORMAT_PIN(GPIO_EMC_02) +FORMAT_PIN(GPIO_EMC_03) +FORMAT_PIN(GPIO_EMC_04) +FORMAT_PIN(GPIO_EMC_05) +FORMAT_PIN(GPIO_EMC_06) +FORMAT_PIN(GPIO_EMC_07) +FORMAT_PIN(GPIO_EMC_08) +FORMAT_PIN(GPIO_EMC_09) +FORMAT_PIN(GPIO_EMC_10) +FORMAT_PIN(GPIO_EMC_11) +FORMAT_PIN(GPIO_EMC_12) +FORMAT_PIN(GPIO_EMC_13) +FORMAT_PIN(GPIO_EMC_14) +FORMAT_PIN(GPIO_EMC_15) +FORMAT_PIN(GPIO_EMC_16) +FORMAT_PIN(GPIO_EMC_17) +FORMAT_PIN(GPIO_EMC_18) +FORMAT_PIN(GPIO_EMC_19) +FORMAT_PIN(GPIO_EMC_20) +FORMAT_PIN(GPIO_EMC_21) +FORMAT_PIN(GPIO_EMC_22) +FORMAT_PIN(GPIO_EMC_23) +FORMAT_PIN(GPIO_EMC_24) +FORMAT_PIN(GPIO_EMC_25) +FORMAT_PIN(GPIO_EMC_26) +FORMAT_PIN(GPIO_EMC_27) +FORMAT_PIN(GPIO_EMC_28) +FORMAT_PIN(GPIO_EMC_29) +FORMAT_PIN(GPIO_EMC_30) +FORMAT_PIN(GPIO_EMC_31) +FORMAT_PIN(GPIO_EMC_32) +FORMAT_PIN(GPIO_EMC_33) +FORMAT_PIN(GPIO_EMC_34) +FORMAT_PIN(GPIO_EMC_35) +FORMAT_PIN(GPIO_EMC_36) +FORMAT_PIN(GPIO_EMC_37) +FORMAT_PIN(GPIO_EMC_38) +FORMAT_PIN(GPIO_EMC_39) +FORMAT_PIN(GPIO_EMC_40) +FORMAT_PIN(GPIO_EMC_41) + +FORMAT_PIN(GPIO_AD_B0_04) +FORMAT_PIN(GPIO_AD_B0_05) +FORMAT_PIN(GPIO_AD_B0_06) +FORMAT_PIN(GPIO_AD_B0_07) +FORMAT_PIN(GPIO_AD_B0_08) +FORMAT_PIN(GPIO_AD_B0_09) +FORMAT_PIN(GPIO_AD_B0_10) +FORMAT_PIN(GPIO_AD_B0_11) +FORMAT_PIN(GPIO_AD_B0_12) +FORMAT_PIN(GPIO_AD_B0_13) +FORMAT_PIN(GPIO_AD_B0_14) +FORMAT_PIN(GPIO_AD_B0_15) + +FORMAT_PIN(GPIO_AD_B1_00) +FORMAT_PIN(GPIO_AD_B1_01) +FORMAT_PIN(GPIO_AD_B1_02) +FORMAT_PIN(GPIO_AD_B1_03) +FORMAT_PIN(GPIO_AD_B1_04) +FORMAT_PIN(GPIO_AD_B1_05) +FORMAT_PIN(GPIO_AD_B1_06) +FORMAT_PIN(GPIO_AD_B1_07) + +FORMAT_PIN(GPIO_B0_00) +FORMAT_PIN(GPIO_B0_01) +FORMAT_PIN(GPIO_B0_02) +FORMAT_PIN(GPIO_B0_03) +FORMAT_PIN(GPIO_B0_04) +FORMAT_PIN(GPIO_B0_05) +FORMAT_PIN(GPIO_B0_06) +FORMAT_PIN(GPIO_B0_07) +FORMAT_PIN(GPIO_B0_08) +FORMAT_PIN(GPIO_B0_09) +FORMAT_PIN(GPIO_B0_10) +FORMAT_PIN(GPIO_B0_11) +FORMAT_PIN(GPIO_B0_12) +FORMAT_PIN(GPIO_B0_13) +FORMAT_PIN(GPIO_B0_14) +FORMAT_PIN(GPIO_B0_15) + +FORMAT_PIN(GPIO_B1_00) +FORMAT_PIN(GPIO_B1_01) +FORMAT_PIN(GPIO_B1_02) +FORMAT_PIN(GPIO_B1_03) +FORMAT_PIN(GPIO_B1_04) +FORMAT_PIN(GPIO_B1_05) +FORMAT_PIN(GPIO_B1_06) +FORMAT_PIN(GPIO_B1_07) +FORMAT_PIN(GPIO_B1_08) +FORMAT_PIN(GPIO_B1_09) +FORMAT_PIN(GPIO_B1_10) +FORMAT_PIN(GPIO_B1_11) +FORMAT_PIN(GPIO_B1_12) +FORMAT_PIN(GPIO_B1_13) +FORMAT_PIN(GPIO_B1_14) +FORMAT_PIN(GPIO_B1_15) + +FORMAT_PIN(GPIO_SD_B0_00) +FORMAT_PIN(GPIO_SD_B0_01) +FORMAT_PIN(GPIO_SD_B0_02) +FORMAT_PIN(GPIO_SD_B0_03) +FORMAT_PIN(GPIO_SD_B0_04) +FORMAT_PIN(GPIO_SD_B0_05) + +FORMAT_PIN(GPIO_SD_B1_00) +FORMAT_PIN(GPIO_SD_B1_01) +FORMAT_PIN(GPIO_SD_B1_02) +FORMAT_PIN(GPIO_SD_B1_03) +FORMAT_PIN(GPIO_SD_B1_04) +FORMAT_PIN(GPIO_SD_B1_05) +FORMAT_PIN(GPIO_SD_B1_06) +FORMAT_PIN(GPIO_SD_B1_07) +FORMAT_PIN(GPIO_SD_B1_08) +FORMAT_PIN(GPIO_SD_B1_09) +FORMAT_PIN(GPIO_SD_B1_10) +FORMAT_PIN(GPIO_SD_B1_11) +FORMAT_PIN(USB_OTG1_DN) +FORMAT_PIN(USB_OTG1_DP) diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.c new file mode 100644 index 0000000000..64d35c2d67 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.c @@ -0,0 +1,147 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 "py/obj.h" +#include "py/mphal.h" +#include "mimxrt10xx/pins.h" + +const mcu_pin_obj_t pin_GPIO_EMC_00 = PIN(GPIO4, 0, GPIO_EMC_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_01 = PIN(GPIO4, 1, GPIO_EMC_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_02 = PIN(GPIO4, 2, GPIO_EMC_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_03 = PIN(GPIO4, 3, GPIO_EMC_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_04 = PIN(GPIO4, 4, GPIO_EMC_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_05 = PIN(GPIO4, 5, GPIO_EMC_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_06 = PIN(GPIO4, 6, GPIO_EMC_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_07 = PIN(GPIO4, 7, GPIO_EMC_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_08 = PIN(GPIO4, 8, GPIO_EMC_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_09 = PIN(GPIO4, 9, GPIO_EMC_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_10 = PIN(GPIO4, 10, GPIO_EMC_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_11 = PIN(GPIO4, 11, GPIO_EMC_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_12 = PIN(GPIO4, 12, GPIO_EMC_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_13 = PIN(GPIO4, 13, GPIO_EMC_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_14 = PIN(GPIO4, 14, GPIO_EMC_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_15 = PIN(GPIO4, 15, GPIO_EMC_15, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_16 = PIN(GPIO4, 16, GPIO_EMC_16, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_17 = PIN(GPIO4, 17, GPIO_EMC_17, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_18 = PIN(GPIO4, 18, GPIO_EMC_18, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_19 = PIN(GPIO4, 19, GPIO_EMC_19, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_20 = PIN(GPIO4, 20, GPIO_EMC_20, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_21 = PIN(GPIO4, 21, GPIO_EMC_21, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_22 = PIN(GPIO4, 22, GPIO_EMC_22, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_23 = PIN(GPIO4, 23, GPIO_EMC_23, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_24 = PIN(GPIO4, 24, GPIO_EMC_24, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_25 = PIN(GPIO4, 25, GPIO_EMC_25, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_26 = PIN(GPIO4, 26, GPIO_EMC_26, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_27 = PIN(GPIO4, 27, GPIO_EMC_27, NO_ADC, 0, 0x00000005, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_EMC_28 = PIN(GPIO4, 28, GPIO_EMC_28, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_29 = PIN(GPIO4, 29, GPIO_EMC_29, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_30 = PIN(GPIO4, 30, GPIO_EMC_30, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_31 = PIN(GPIO4, 31, GPIO_EMC_31, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_32 = PIN(GPIO3, 18, GPIO_EMC_32, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_33 = PIN(GPIO3, 19, GPIO_EMC_33, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_34 = PIN(GPIO3, 20, GPIO_EMC_34, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_35 = PIN(GPIO3, 21, GPIO_EMC_35, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_36 = PIN(GPIO3, 22, GPIO_EMC_36, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_37 = PIN(GPIO3, 23, GPIO_EMC_37, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_38 = PIN(GPIO3, 24, GPIO_EMC_38, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_39 = PIN(GPIO3, 25, GPIO_EMC_39, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_40 = PIN(GPIO3, 26, GPIO_EMC_40, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_41 = PIN(GPIO3, 27, GPIO_EMC_41, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_04 = PIN(GPIO1, 4, GPIO_AD_B0_04, NO_ADC, 0, 0x00000000, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_05 = PIN(GPIO1, 5, GPIO_AD_B0_05, NO_ADC, 0, 0x00000000, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_06 = PIN(GPIO1, 6, GPIO_AD_B0_06, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_07 = PIN(GPIO1, 7, GPIO_AD_B0_07, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_08 = PIN(GPIO1, 8, GPIO_AD_B0_08, NO_ADC, 0, 0x00000000, 0x000030A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_09 = PIN(GPIO1, 9, GPIO_AD_B0_09, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_10 = PIN(GPIO1, 10, GPIO_AD_B0_10, NO_ADC, 0, 0x00000000, 0x000090B1); +const mcu_pin_obj_t pin_GPIO_AD_B0_11 = PIN(GPIO1, 11, GPIO_AD_B0_11, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 12, GPIO_AD_B0_12, ADC1, 1, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 13, GPIO_AD_B0_13, ADC1, 2, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 14, GPIO_AD_B0_14, ADC1, 3, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 15, GPIO_AD_B0_15, ADC1, 4, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 16, GPIO_AD_B1_00, ADC2, 5, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 17, GPIO_AD_B1_01, ADC2, 6, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 18, GPIO_AD_B1_02, ADC2, 7, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 19, GPIO_AD_B1_03, ADC2, 8, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 20, GPIO_AD_B1_04, ADC2, 9, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 21, GPIO_AD_B1_05, ADC2, 10, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 22, GPIO_AD_B1_06, ADC2, 11, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 23, GPIO_AD_B1_07, ADC2, 12, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_00 = PIN(GPIO2, 0, GPIO_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_01 = PIN(GPIO2, 1, GPIO_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_02 = PIN(GPIO2, 2, GPIO_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_03 = PIN(GPIO2, 3, GPIO_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_04 = PIN(GPIO2, 4, GPIO_B0_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_05 = PIN(GPIO2, 5, GPIO_B0_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_06 = PIN(GPIO2, 6, GPIO_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_07 = PIN(GPIO2, 7, GPIO_B0_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_08 = PIN(GPIO2, 8, GPIO_B0_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_09 = PIN(GPIO2, 9, GPIO_B0_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_10 = PIN(GPIO2, 10, GPIO_B0_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_11 = PIN(GPIO2, 11, GPIO_B0_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_12 = PIN(GPIO2, 12, GPIO_B0_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_13 = PIN(GPIO2, 13, GPIO_B0_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_14 = PIN(GPIO2, 14, GPIO_B0_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_15 = PIN(GPIO2, 15, GPIO_B0_15, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_00 = PIN(GPIO2, 16, GPIO_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_01 = PIN(GPIO2, 17, GPIO_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_02 = PIN(GPIO2, 18, GPIO_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_03 = PIN(GPIO2, 19, GPIO_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_04 = PIN(GPIO2, 20, GPIO_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_05 = PIN(GPIO2, 21, GPIO_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_06 = PIN(GPIO2, 22, GPIO_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_07 = PIN(GPIO2, 23, GPIO_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_08 = PIN(GPIO2, 24, GPIO_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_09 = PIN(GPIO2, 25, GPIO_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_10 = PIN(GPIO2, 26, GPIO_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_11 = PIN(GPIO2, 27, GPIO_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_12 = PIN(GPIO2, 28, GPIO_B1_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_13 = PIN(GPIO2, 29, GPIO_B1_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_14 = PIN(GPIO2, 30, GPIO_B1_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_15 = PIN(GPIO2, 31, GPIO_B1_15, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_00 = PIN(GPIO3, 12, GPIO_SD_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_01 = PIN(GPIO3, 13, GPIO_SD_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_02 = PIN(GPIO3, 14, GPIO_SD_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_03 = PIN(GPIO3, 15, GPIO_SD_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_04 = PIN(GPIO3, 16, GPIO_SD_B0_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_05 = PIN(GPIO3, 17, GPIO_SD_B0_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_00 = PIN(GPIO3, 0, GPIO_SD_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_01 = PIN(GPIO3, 1, GPIO_SD_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_02 = PIN(GPIO3, 2, GPIO_SD_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_03 = PIN(GPIO3, 3, GPIO_SD_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_04 = PIN(GPIO3, 4, GPIO_SD_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_05 = PIN(GPIO3, 5, GPIO_SD_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_06 = PIN(GPIO3, 6, GPIO_SD_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_07 = PIN(GPIO3, 7, GPIO_SD_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 8, GPIO_SD_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 9, GPIO_SD_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 10, GPIO_SD_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 11, GPIO_SD_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); + +const mcu_pin_obj_t pin_USB_OTG1_DN = { { &mcu_pin_type }, }; +const mcu_pin_obj_t pin_USB_OTG1_DP = { { &mcu_pin_type }, }; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.h new file mode 100644 index 0000000000..118eff9335 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + +#pragma once + +#define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; +#include "pin_names.h" +#undef FORMAT_PIN + +#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 2) +extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/clocks.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/clocks.c new file mode 100644 index 0000000000..832ad9afac --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/clocks.c @@ -0,0 +1,402 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Artur Pacholec + * + * 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. + */ +/* + * Copyright 2019 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "mpconfigport.h" + +#include "fsl_clock.h" +#include "fsl_iomuxc.h" +#include "fsl_device_registers.h" + +#include "board.h" + +#include "clocks.h" + +#define BOARD_XTAL0_CLK_HZ 24000000U /*!< Board xtal0 frequency in Hz */ +#define BOARD_XTAL32K_CLK_HZ 32768U /*!< Board xtal32k frequency in Hz */ +#define BOARD_BOOTCLOCKRUN_CORE_CLOCK 600000000U /*!< Core clock frequency: 600000000Hz */ + +/******************************************************************************* + * Variables for BOARD_BootClockRUN configuration + ******************************************************************************/ +const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN = +{ + .loopDivider = 100, /* PLL loop divider, Fout = Fin * 50 */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ +}; +const clock_sys_pll_config_t sysPllConfig_BOARD_BootClockRUN = +{ + .loopDivider = 1, /* PLL loop divider, Fout = Fin * ( 20 + loopDivider*2 + numerator / denominator ) */ + .numerator = 0, /* 30 bit numerator of fractional loop divider */ + .denominator = 1, /* 30 bit denominator of fractional loop divider */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ +}; +const clock_usb_pll_config_t usb1PllConfig_BOARD_BootClockRUN = +{ + .loopDivider = 0, /* PLL loop divider, Fout = Fin * 20 */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ +}; +const clock_video_pll_config_t videoPllConfig_BOARD_BootClockRUN = +{ + .loopDivider = 31, /* PLL loop divider, Fout = Fin * ( loopDivider + numerator / denominator ) */ + .postDivider = 8, /* Divider after PLL */ + .numerator = 0, /* 30 bit numerator of fractional loop divider, Fout = Fin * ( loopDivider + numerator / denominator ) */ + .denominator = 1, /* 30 bit denominator of fractional loop divider, Fout = Fin * ( loopDivider + numerator / denominator ) */ + .src = 0, /* Bypass clock source, 0 - OSC 24M, 1 - CLK1_P and CLK1_N */ +}; +/******************************************************************************* + * Code for BOARD_BootClockRUN configuration + ******************************************************************************/ +void clocks_init(void) { + /* Init RTC OSC clock frequency. */ + CLOCK_SetRtcXtalFreq(32768U); + /* Enable 1MHz clock output. */ + XTALOSC24M->OSC_CONFIG2 |= XTALOSC24M_OSC_CONFIG2_ENABLE_1M_MASK; + /* Use free 1MHz clock output. */ + XTALOSC24M->OSC_CONFIG2 &= ~XTALOSC24M_OSC_CONFIG2_MUX_1M_MASK; + /* Set XTAL 24MHz clock frequency. */ + CLOCK_SetXtalFreq(24000000U); + /* Enable XTAL 24MHz clock source. */ + CLOCK_InitExternalClk(0); + /* Enable internal RC. */ + CLOCK_InitRcOsc24M(); + /* Switch clock source to external OSC. */ + CLOCK_SwitchOsc(kCLOCK_XtalOsc); + /* Set Oscillator ready counter value. */ + CCM->CCR = (CCM->CCR & (~CCM_CCR_OSCNT_MASK)) | CCM_CCR_OSCNT(127); + /* Setting PeriphClk2Mux and PeriphMux to provide stable clock before PLLs are initialed */ + CLOCK_SetMux(kCLOCK_PeriphClk2Mux, 1); /* Set PERIPH_CLK2 MUX to OSC */ + CLOCK_SetMux(kCLOCK_PeriphMux, 1); /* Set PERIPH_CLK MUX to PERIPH_CLK2 */ + /* Setting the VDD_SOC to 1.275V. It is necessary to config AHB to 600Mhz. */ + DCDC->REG3 = (DCDC->REG3 & (~DCDC_REG3_TRG_MASK)) | DCDC_REG3_TRG(0x13); + /* Waiting for DCDC_STS_DC_OK bit is asserted */ + while (DCDC_REG0_STS_DC_OK_MASK != (DCDC_REG0_STS_DC_OK_MASK & DCDC->REG0)) { + } + /* Set AHB_PODF. */ + CLOCK_SetDiv(kCLOCK_AhbDiv, 0); + /* Disable IPG clock gate. */ + CLOCK_DisableClock(kCLOCK_Adc1); + CLOCK_DisableClock(kCLOCK_Adc2); + CLOCK_DisableClock(kCLOCK_Xbar1); + CLOCK_DisableClock(kCLOCK_Xbar2); + CLOCK_DisableClock(kCLOCK_Xbar3); + /* Set IPG_PODF. */ + CLOCK_SetDiv(kCLOCK_IpgDiv, 3); + /* Set ARM_PODF. */ + CLOCK_SetDiv(kCLOCK_ArmDiv, 1); + /* Set PERIPH_CLK2_PODF. */ + CLOCK_SetDiv(kCLOCK_PeriphClk2Div, 0); + /* Disable PERCLK clock gate. */ + CLOCK_DisableClock(kCLOCK_Gpt1); + CLOCK_DisableClock(kCLOCK_Gpt1S); + CLOCK_DisableClock(kCLOCK_Gpt2); + CLOCK_DisableClock(kCLOCK_Gpt2S); + CLOCK_DisableClock(kCLOCK_Pit); + /* Set PERCLK_PODF. */ + CLOCK_SetDiv(kCLOCK_PerclkDiv, 1); + /* Disable USDHC1 clock gate. */ + CLOCK_DisableClock(kCLOCK_Usdhc1); + /* Set USDHC1_PODF. */ + CLOCK_SetDiv(kCLOCK_Usdhc1Div, 1); + /* Set Usdhc1 clock source. */ + CLOCK_SetMux(kCLOCK_Usdhc1Mux, 0); + /* Disable USDHC2 clock gate. */ + CLOCK_DisableClock(kCLOCK_Usdhc2); + /* Set USDHC2_PODF. */ + CLOCK_SetDiv(kCLOCK_Usdhc2Div, 1); + /* Set Usdhc2 clock source. */ + CLOCK_SetMux(kCLOCK_Usdhc2Mux, 0); + /* In SDK projects, SDRAM (configured by SEMC) will be initialized in either debug script or dcd. + * With this macro SKIP_SYSCLK_INIT, system pll (selected to be SEMC source clock in SDK projects) will be left unchanged. + * Note: If another clock source is selected for SEMC, user may want to avoid changing that clock as well.*/ + #ifndef SKIP_SYSCLK_INIT + /* Disable Semc clock gate. */ + CLOCK_DisableClock(kCLOCK_Semc); + /* Set SEMC_PODF. */ + CLOCK_SetDiv(kCLOCK_SemcDiv, 7); + /* Set Semc alt clock source. */ + CLOCK_SetMux(kCLOCK_SemcAltMux, 0); + /* Set Semc clock source. */ + CLOCK_SetMux(kCLOCK_SemcMux, 0); + #endif + /* In SDK projects, external flash (configured by FLEXSPI) will be initialized by dcd. + * With this macro XIP_EXTERNAL_FLASH, usb1 pll (selected to be FLEXSPI clock source in SDK projects) will be left unchanged. + * Note: If another clock source is selected for FLEXSPI, user may want to avoid changing that clock as well.*/ + #if !(defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)) + #error "whoops" + /* Disable Flexspi clock gate. */ + CLOCK_DisableClock(kCLOCK_FlexSpi); + /* Set FLEXSPI_PODF. */ + CLOCK_SetDiv(kCLOCK_FlexspiDiv, 2); + /* Set Flexspi clock source. */ + CLOCK_SetMux(kCLOCK_FlexspiMux, 1); + #endif + /* Disable CSI clock gate. */ + CLOCK_DisableClock(kCLOCK_Csi); + /* Set CSI_PODF. */ + CLOCK_SetDiv(kCLOCK_CsiDiv, 1); + /* Set Csi clock source. */ + CLOCK_SetMux(kCLOCK_CsiMux, 0); + /* Disable LPSPI clock gate. */ + CLOCK_DisableClock(kCLOCK_Lpspi1); + CLOCK_DisableClock(kCLOCK_Lpspi2); + CLOCK_DisableClock(kCLOCK_Lpspi3); + CLOCK_DisableClock(kCLOCK_Lpspi4); + /* Set LPSPI_PODF. */ + CLOCK_SetDiv(kCLOCK_LpspiDiv, 4); + /* Set Lpspi clock source. */ + CLOCK_SetMux(kCLOCK_LpspiMux, 2); + /* Disable TRACE clock gate. */ + CLOCK_DisableClock(kCLOCK_Trace); + /* Set TRACE_PODF. */ + CLOCK_SetDiv(kCLOCK_TraceDiv, 3); + /* Set Trace clock source. */ + CLOCK_SetMux(kCLOCK_TraceMux, 0); + /* Disable SAI1 clock gate. */ + CLOCK_DisableClock(kCLOCK_Sai1); + /* Set SAI1_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Sai1PreDiv, 3); + /* Set SAI1_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Sai1Div, 1); + /* Set Sai1 clock source. */ + CLOCK_SetMux(kCLOCK_Sai1Mux, 0); + /* Disable SAI2 clock gate. */ + CLOCK_DisableClock(kCLOCK_Sai2); + /* Set SAI2_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Sai2PreDiv, 3); + /* Set SAI2_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Sai2Div, 1); + /* Set Sai2 clock source. */ + CLOCK_SetMux(kCLOCK_Sai2Mux, 0); + /* Disable SAI3 clock gate. */ + CLOCK_DisableClock(kCLOCK_Sai3); + /* Set SAI3_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Sai3PreDiv, 3); + /* Set SAI3_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Sai3Div, 1); + /* Set Sai3 clock source. */ + CLOCK_SetMux(kCLOCK_Sai3Mux, 0); + /* Disable Lpi2c clock gate. */ + CLOCK_DisableClock(kCLOCK_Lpi2c1); + CLOCK_DisableClock(kCLOCK_Lpi2c2); + CLOCK_DisableClock(kCLOCK_Lpi2c3); + /* Set LPI2C_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Lpi2cDiv, 0); + /* Set Lpi2c clock source. */ + CLOCK_SetMux(kCLOCK_Lpi2cMux, 0); + /* Disable CAN clock gate. */ + CLOCK_DisableClock(kCLOCK_Can1); + CLOCK_DisableClock(kCLOCK_Can2); + CLOCK_DisableClock(kCLOCK_Can1S); + CLOCK_DisableClock(kCLOCK_Can2S); + /* Set CAN_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_CanDiv, 1); + /* Set Can clock source. */ + CLOCK_SetMux(kCLOCK_CanMux, 2); + /* Disable UART clock gate. */ + CLOCK_DisableClock(kCLOCK_Lpuart1); + CLOCK_DisableClock(kCLOCK_Lpuart2); + CLOCK_DisableClock(kCLOCK_Lpuart3); + CLOCK_DisableClock(kCLOCK_Lpuart4); + CLOCK_DisableClock(kCLOCK_Lpuart5); + CLOCK_DisableClock(kCLOCK_Lpuart6); + CLOCK_DisableClock(kCLOCK_Lpuart7); + CLOCK_DisableClock(kCLOCK_Lpuart8); + /* Set UART_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_UartDiv, 0); + /* Set Uart clock source. */ + CLOCK_SetMux(kCLOCK_UartMux, 0); + /* Disable LCDIF clock gate. */ + CLOCK_DisableClock(kCLOCK_LcdPixel); + /* Set LCDIF_PRED. */ + CLOCK_SetDiv(kCLOCK_LcdifPreDiv, 1); + /* Set LCDIF_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_LcdifDiv, 3); + /* Set Lcdif pre clock source. */ + CLOCK_SetMux(kCLOCK_LcdifPreMux, 5); + /* Disable SPDIF clock gate. */ + CLOCK_DisableClock(kCLOCK_Spdif); + /* Set SPDIF0_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Spdif0PreDiv, 1); + /* Set SPDIF0_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Spdif0Div, 7); + /* Set Spdif clock source. */ + CLOCK_SetMux(kCLOCK_SpdifMux, 3); + /* Disable Flexio1 clock gate. */ + CLOCK_DisableClock(kCLOCK_Flexio1); + /* Set FLEXIO1_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Flexio1PreDiv, 1); + /* Set FLEXIO1_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Flexio1Div, 7); + /* Set Flexio1 clock source. */ + CLOCK_SetMux(kCLOCK_Flexio1Mux, 3); + /* Disable Flexio2 clock gate. */ + CLOCK_DisableClock(kCLOCK_Flexio2); + /* Set FLEXIO2_CLK_PRED. */ + CLOCK_SetDiv(kCLOCK_Flexio2PreDiv, 1); + /* Set FLEXIO2_CLK_PODF. */ + CLOCK_SetDiv(kCLOCK_Flexio2Div, 7); + /* Set Flexio2 clock source. */ + CLOCK_SetMux(kCLOCK_Flexio2Mux, 3); + /* Set Pll3 sw clock source. */ + CLOCK_SetMux(kCLOCK_Pll3SwMux, 0); + /* Init ARM PLL. */ + CLOCK_InitArmPll(&armPllConfig_BOARD_BootClockRUN); + /* In SDK projects, SDRAM (configured by SEMC) will be initialized in either debug script or dcd. + * With this macro SKIP_SYSCLK_INIT, system pll (selected to be SEMC source clock in SDK projects) will be left unchanged. + * Note: If another clock source is selected for SEMC, user may want to avoid changing that clock as well.*/ + #ifndef SKIP_SYSCLK_INIT + #if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (XIP_BOOT_HEADER_DCD_ENABLE == 1) + #warning "SKIP_SYSCLK_INIT should be defined to keep system pll (selected to be SEMC source clock in SDK projects) unchanged." + #endif + /* Init System PLL. */ + CLOCK_InitSysPll(&sysPllConfig_BOARD_BootClockRUN); + /* Init System pfd0. */ + CLOCK_InitSysPfd(kCLOCK_Pfd0, 27); + /* Init System pfd1. */ + CLOCK_InitSysPfd(kCLOCK_Pfd1, 16); + /* Init System pfd2. */ + CLOCK_InitSysPfd(kCLOCK_Pfd2, 24); + /* Init System pfd3. */ + CLOCK_InitSysPfd(kCLOCK_Pfd3, 16); + #endif + /* In SDK projects, external flash (configured by FLEXSPI) will be initialized by dcd. + * With this macro XIP_EXTERNAL_FLASH, usb1 pll (selected to be FLEXSPI clock source in SDK projects) will be left unchanged. + * Note: If another clock source is selected for FLEXSPI, user may want to avoid changing that clock as well.*/ + #if !(defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)) + /* Init Usb1 PLL. */ + CLOCK_InitUsb1Pll(&usb1PllConfig_BOARD_BootClockRUN); + /* Init Usb1 pfd0. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd0, 33); + /* Init Usb1 pfd1. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd1, 16); + /* Init Usb1 pfd2. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd2, 17); + /* Init Usb1 pfd3. */ + CLOCK_InitUsb1Pfd(kCLOCK_Pfd3, 19); + /* Disable Usb1 PLL output for USBPHY1. */ + CCM_ANALOG->PLL_USB1 &= ~CCM_ANALOG_PLL_USB1_EN_USB_CLKS_MASK; + #endif + /* DeInit Audio PLL. */ + CLOCK_DeinitAudioPll(); + /* Bypass Audio PLL. */ + CLOCK_SetPllBypass(CCM_ANALOG, kCLOCK_PllAudio, 1); + /* Set divider for Audio PLL. */ + CCM_ANALOG->MISC2 &= ~CCM_ANALOG_MISC2_AUDIO_DIV_LSB_MASK; + CCM_ANALOG->MISC2 &= ~CCM_ANALOG_MISC2_AUDIO_DIV_MSB_MASK; + /* Enable Audio PLL output. */ + CCM_ANALOG->PLL_AUDIO |= CCM_ANALOG_PLL_AUDIO_ENABLE_MASK; + /* Init Video PLL. */ + uint32_t pllVideo; + /* Disable Video PLL output before initial Video PLL. */ + CCM_ANALOG->PLL_VIDEO &= ~CCM_ANALOG_PLL_VIDEO_ENABLE_MASK; + /* Bypass PLL first */ + CCM_ANALOG->PLL_VIDEO = (CCM_ANALOG->PLL_VIDEO & (~CCM_ANALOG_PLL_VIDEO_BYPASS_CLK_SRC_MASK)) | + CCM_ANALOG_PLL_VIDEO_BYPASS_MASK | CCM_ANALOG_PLL_VIDEO_BYPASS_CLK_SRC(0); + CCM_ANALOG->PLL_VIDEO_NUM = CCM_ANALOG_PLL_VIDEO_NUM_A(0); + CCM_ANALOG->PLL_VIDEO_DENOM = CCM_ANALOG_PLL_VIDEO_DENOM_B(1); + pllVideo = (CCM_ANALOG->PLL_VIDEO & (~(CCM_ANALOG_PLL_VIDEO_DIV_SELECT_MASK | CCM_ANALOG_PLL_VIDEO_POWERDOWN_MASK))) | + CCM_ANALOG_PLL_VIDEO_ENABLE_MASK | CCM_ANALOG_PLL_VIDEO_DIV_SELECT(31); + pllVideo |= CCM_ANALOG_PLL_VIDEO_POST_DIV_SELECT(1); + CCM_ANALOG->MISC2 = (CCM_ANALOG->MISC2 & (~CCM_ANALOG_MISC2_VIDEO_DIV_MASK)) | CCM_ANALOG_MISC2_VIDEO_DIV(3); + CCM_ANALOG->PLL_VIDEO = pllVideo; + while ((CCM_ANALOG->PLL_VIDEO & CCM_ANALOG_PLL_VIDEO_LOCK_MASK) == 0) { + } + /* Disable bypass for Video PLL. */ + CLOCK_SetPllBypass(CCM_ANALOG, kCLOCK_PllVideo, 0); + /* DeInit Enet PLL. */ + CLOCK_DeinitEnetPll(); + /* Bypass Enet PLL. */ + CLOCK_SetPllBypass(CCM_ANALOG, kCLOCK_PllEnet, 1); + /* Set Enet output divider. */ + CCM_ANALOG->PLL_ENET = (CCM_ANALOG->PLL_ENET & (~CCM_ANALOG_PLL_ENET_DIV_SELECT_MASK)) | CCM_ANALOG_PLL_ENET_DIV_SELECT(1); + /* Enable Enet output. */ + CCM_ANALOG->PLL_ENET |= CCM_ANALOG_PLL_ENET_ENABLE_MASK; + /* Enable Enet25M output. */ + CCM_ANALOG->PLL_ENET |= CCM_ANALOG_PLL_ENET_ENET_25M_REF_EN_MASK; + /* DeInit Usb2 PLL. */ + CLOCK_DeinitUsb2Pll(); + /* Bypass Usb2 PLL. */ + CLOCK_SetPllBypass(CCM_ANALOG, kCLOCK_PllUsb2, 1); + /* Enable Usb2 PLL output. */ + CCM_ANALOG->PLL_USB2 |= CCM_ANALOG_PLL_USB2_ENABLE_MASK; + /* Set preperiph clock source. */ + CLOCK_SetMux(kCLOCK_PrePeriphMux, 3); + /* Set periph clock source. */ + CLOCK_SetMux(kCLOCK_PeriphMux, 0); + /* Set periph clock2 clock source. */ + CLOCK_SetMux(kCLOCK_PeriphClk2Mux, 0); + /* Set per clock source. */ + CLOCK_SetMux(kCLOCK_PerclkMux, 0); + /* Set lvds1 clock source. */ + CCM_ANALOG->MISC1 = (CCM_ANALOG->MISC1 & (~CCM_ANALOG_MISC1_LVDS1_CLK_SEL_MASK)) | CCM_ANALOG_MISC1_LVDS1_CLK_SEL(0); + /* Set clock out1 divider. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO1_DIV_MASK)) | CCM_CCOSR_CLKO1_DIV(0); + /* Set clock out1 source. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO1_SEL_MASK)) | CCM_CCOSR_CLKO1_SEL(1); + /* Set clock out2 divider. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO2_DIV_MASK)) | CCM_CCOSR_CLKO2_DIV(0); + /* Set clock out2 source. */ + CCM->CCOSR = (CCM->CCOSR & (~CCM_CCOSR_CLKO2_SEL_MASK)) | CCM_CCOSR_CLKO2_SEL(18); + /* Set clock out1 drives clock out1. */ + CCM->CCOSR &= ~CCM_CCOSR_CLK_OUT_SEL_MASK; + /* Disable clock out1. */ + CCM->CCOSR &= ~CCM_CCOSR_CLKO1_EN_MASK; + /* Disable clock out2. */ + CCM->CCOSR &= ~CCM_CCOSR_CLKO2_EN_MASK; + /* Set SAI1 MCLK1 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk1Sel, 0); + /* Set SAI1 MCLK2 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk2Sel, 0); + /* Set SAI1 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk3Sel, 0); + /* Set SAI2 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI2MClk3Sel, 0); + /* Set SAI3 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI3MClk3Sel, 0); + /* Set MQS configuration. */ + IOMUXC_MQSConfig(IOMUXC_GPR,kIOMUXC_MqsPwmOverSampleRate32, 0); + /* Set ENET Ref clock source. */ + #if defined(IOMUXC_GPR_GPR1_ENET_REF_CLK_DIR_MASK) + IOMUXC_GPR->GPR1 &= ~IOMUXC_GPR_GPR1_ENET_REF_CLK_DIR_MASK; + #elif defined(IOMUXC_GPR_GPR1_ENET1_TX_CLK_DIR_MASK) + /* Backward compatibility for original bitfield name */ + IOMUXC_GPR->GPR1 &= ~IOMUXC_GPR_GPR1_ENET1_TX_CLK_DIR_MASK; + #else + #error "Neither IOMUXC_GPR_GPR1_ENET_REF_CLK_DIR_MASK nor IOMUXC_GPR_GPR1_ENET1_TX_CLK_DIR_MASK is defined." + #endif /* defined(IOMUXC_GPR_GPR1_ENET_REF_CLK_DIR_MASK) */ + /* Set GPT1 High frequency reference clock source. */ + IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT1_MASK; + /* Set GPT2 High frequency reference clock source. */ + IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT2_MASK; + /* Set SystemCoreClock variable. */ + SystemCoreClock = BOARD_BOOTCLOCKRUN_CORE_CLOCK; +} diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.c new file mode 100644 index 0000000000..35b097f675 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.c @@ -0,0 +1,377 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 "py/obj.h" +#include "py/mphal.h" +#include "mimxrt10xx/periph.h" + +LPI2C_Type *const mcu_i2c_banks[4] = { LPI2C1, LPI2C2, LPI2C3, LPI2C4 }; + +const mcu_periph_obj_t mcu_i2c_sda_list[9] = { + PERIPH_PIN(1, 2, kIOMUXC_LPI2C1_SDA_SELECT_INPUT, 0, &pin_GPIO_SD_B1_05), + PERIPH_PIN(1, 3, kIOMUXC_LPI2C1_SDA_SELECT_INPUT, 1, &pin_GPIO_AD_B1_01), + + PERIPH_PIN(2, 3, kIOMUXC_LPI2C2_SDA_SELECT_INPUT, 0, &pin_GPIO_SD_B1_10), + PERIPH_PIN(2, 2, kIOMUXC_LPI2C2_SDA_SELECT_INPUT, 1, &pin_GPIO_B0_05), + + PERIPH_PIN(3, 2, kIOMUXC_LPI2C3_SDA_SELECT_INPUT, 0, &pin_GPIO_EMC_21), + PERIPH_PIN(3, 2, kIOMUXC_LPI2C3_SDA_SELECT_INPUT, 1, &pin_GPIO_SD_B0_01), + PERIPH_PIN(3, 1, kIOMUXC_LPI2C3_SDA_SELECT_INPUT, 2, &pin_GPIO_AD_B1_06), + + PERIPH_PIN(4, 2, kIOMUXC_LPI2C4_SDA_SELECT_INPUT, 0, &pin_GPIO_EMC_11), + PERIPH_PIN(4, 0, kIOMUXC_LPI2C4_SDA_SELECT_INPUT, 1, &pin_GPIO_AD_B0_13), +}; + +const mcu_periph_obj_t mcu_i2c_scl_list[9] = { + PERIPH_PIN(1, 2, kIOMUXC_LPI2C1_SCL_SELECT_INPUT, 0, &pin_GPIO_SD_B1_04), + PERIPH_PIN(1, 3, kIOMUXC_LPI2C1_SCL_SELECT_INPUT, 1, &pin_GPIO_AD_B1_00), + + PERIPH_PIN(2, 3, kIOMUXC_LPI2C2_SCL_SELECT_INPUT, 0, &pin_GPIO_SD_B1_11), + PERIPH_PIN(2, 2, kIOMUXC_LPI2C2_SCL_SELECT_INPUT, 1, &pin_GPIO_B0_04), + + PERIPH_PIN(3, 2, kIOMUXC_LPI2C3_SCL_SELECT_INPUT, 0, &pin_GPIO_EMC_22), + PERIPH_PIN(3, 2, kIOMUXC_LPI2C3_SCL_SELECT_INPUT, 1, &pin_GPIO_SD_B0_00), + PERIPH_PIN(3, 1, kIOMUXC_LPI2C3_SCL_SELECT_INPUT, 2, &pin_GPIO_AD_B1_07), + + PERIPH_PIN(4, 2, kIOMUXC_LPI2C4_SCL_SELECT_INPUT, 0, &pin_GPIO_EMC_12), + PERIPH_PIN(4, 0, kIOMUXC_LPI2C4_SCL_SELECT_INPUT, 1, &pin_GPIO_AD_B0_12), +}; + +LPSPI_Type *const mcu_spi_banks[4] = { LPSPI1, LPSPI2, LPSPI3, LPSPI4 }; + +const mcu_periph_obj_t mcu_spi_sck_list[8] = { + PERIPH_PIN(1, 3, kIOMUXC_LPSPI1_SCK_SELECT_INPUT, 0, &pin_GPIO_EMC_27), + PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SCK_SELECT_INPUT, 1, &pin_GPIO_SD_B0_00), + + PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SCK_SELECT_INPUT, 0, &pin_GPIO_SD_B1_07), + PERIPH_PIN(2, 2, kIOMUXC_LPSPI2_SCK_SELECT_INPUT, 1, &pin_GPIO_EMC_00), + + PERIPH_PIN(3, 7, kIOMUXC_LPSPI3_SCK_SELECT_INPUT, 0, &pin_GPIO_AD_B0_00), + PERIPH_PIN(3, 2, kIOMUXC_LPSPI3_SCK_SELECT_INPUT, 1, &pin_GPIO_AD_B1_15), + + PERIPH_PIN(4, 3, kIOMUXC_LPSPI4_SCK_SELECT_INPUT, 0, &pin_GPIO_B0_03), + PERIPH_PIN(4, 1, kIOMUXC_LPSPI4_SCK_SELECT_INPUT, 1, &pin_GPIO_B1_07), +}; + +const mcu_periph_obj_t mcu_spi_sdo_list[8] = { + PERIPH_PIN(1, 3, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 0, &pin_GPIO_EMC_28), + PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 1, &pin_GPIO_SD_B0_02), + + PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 0, &pin_GPIO_SD_B1_08), + PERIPH_PIN(2, 2, kIOMUXC_LPSPI2_SDO_SELECT_INPUT, 1, &pin_GPIO_EMC_02), + + PERIPH_PIN(3, 7, kIOMUXC_LPSPI3_SDO_SELECT_INPUT, 0, &pin_GPIO_AD_B0_01), + PERIPH_PIN(3, 2, kIOMUXC_LPSPI3_SDO_SELECT_INPUT, 1, &pin_GPIO_AD_B1_14), + + PERIPH_PIN(4, 3, kIOMUXC_LPSPI4_SDO_SELECT_INPUT, 0, &pin_GPIO_B0_02), + PERIPH_PIN(4, 1, kIOMUXC_LPSPI4_SDO_SELECT_INPUT, 1, &pin_GPIO_B1_06), +}; + +const mcu_periph_obj_t mcu_spi_sdi_list[8] = { + PERIPH_PIN(1, 3, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 0, &pin_GPIO_EMC_29), + PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 1, &pin_GPIO_SD_B0_03), + + PERIPH_PIN(2, 4, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 0, &pin_GPIO_SD_B1_09), + PERIPH_PIN(2, 2, kIOMUXC_LPSPI2_SDI_SELECT_INPUT, 1, &pin_GPIO_EMC_03), + + PERIPH_PIN(3, 7, kIOMUXC_LPSPI3_SDI_SELECT_INPUT, 0, &pin_GPIO_AD_B0_02), + PERIPH_PIN(3, 2, kIOMUXC_LPSPI3_SDI_SELECT_INPUT, 1, &pin_GPIO_AD_B1_13), + + PERIPH_PIN(4, 3, kIOMUXC_LPSPI4_SDI_SELECT_INPUT, 0, &pin_GPIO_B0_01), + PERIPH_PIN(4, 1, kIOMUXC_LPSPI4_SDI_SELECT_INPUT, 1, &pin_GPIO_B1_05), +}; + +LPUART_Type *const mcu_uart_banks[8] = { LPUART1, LPUART2, LPUART3, LPUART4, LPUART5, LPUART6, LPUART7, LPUART8 }; + +const mcu_periph_obj_t mcu_uart_rx_list[18] = { + PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_13), + + PERIPH_PIN(2, 2, kIOMUXC_LPUART2_RX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_10), + PERIPH_PIN(2, 2, kIOMUXC_LPUART2_RX_SELECT_INPUT, 1, &pin_GPIO_AD_B1_03), + + PERIPH_PIN(3, 2, kIOMUXC_LPUART3_RX_SELECT_INPUT, 0, &pin_GPIO_AD_B1_07), + PERIPH_PIN(3, 2, kIOMUXC_LPUART3_RX_SELECT_INPUT, 1, &pin_GPIO_EMC_14), + PERIPH_PIN(3, 3, kIOMUXC_LPUART3_RX_SELECT_INPUT, 2, &pin_GPIO_B0_09), + + PERIPH_PIN(4, 4, kIOMUXC_LPUART4_RX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_01), + PERIPH_PIN(4, 2, kIOMUXC_LPUART4_RX_SELECT_INPUT, 1, &pin_GPIO_EMC_20), + PERIPH_PIN(4, 2, kIOMUXC_LPUART4_RX_SELECT_INPUT, 2, &pin_GPIO_B1_01), + + PERIPH_PIN(5, 2, kIOMUXC_LPUART5_RX_SELECT_INPUT, 0, &pin_GPIO_EMC_24), + PERIPH_PIN(5, 1, kIOMUXC_LPUART5_RX_SELECT_INPUT, 1, &pin_GPIO_B1_13), + + PERIPH_PIN(6, 2, kIOMUXC_LPUART6_RX_SELECT_INPUT, 0, &pin_GPIO_EMC_26), + PERIPH_PIN(6, 2, kIOMUXC_LPUART6_RX_SELECT_INPUT, 1, &pin_GPIO_AD_B0_03), + + PERIPH_PIN(7, 2, kIOMUXC_LPUART7_RX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_09), + PERIPH_PIN(7, 2, kIOMUXC_LPUART7_RX_SELECT_INPUT, 1, &pin_GPIO_EMC_32), + + PERIPH_PIN(8, 2, kIOMUXC_LPUART8_RX_SELECT_INPUT, 0, &pin_GPIO_SD_B0_05), + PERIPH_PIN(8, 2, kIOMUXC_LPUART8_RX_SELECT_INPUT, 1, &pin_GPIO_AD_B1_11), + PERIPH_PIN(8, 2, kIOMUXC_LPUART8_RX_SELECT_INPUT, 2, &pin_GPIO_EMC_39), +}; + +const mcu_periph_obj_t mcu_uart_tx_list[18] = { + PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_12), + + PERIPH_PIN(2, 2, kIOMUXC_LPUART2_TX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_11), + PERIPH_PIN(2, 2, kIOMUXC_LPUART2_TX_SELECT_INPUT, 1, &pin_GPIO_AD_B1_02), + + PERIPH_PIN(3, 2, kIOMUXC_LPUART3_TX_SELECT_INPUT, 0, &pin_GPIO_AD_B1_06), + PERIPH_PIN(3, 2, kIOMUXC_LPUART3_TX_SELECT_INPUT, 1, &pin_GPIO_EMC_13), + PERIPH_PIN(3, 3, kIOMUXC_LPUART3_TX_SELECT_INPUT, 2, &pin_GPIO_B0_08), + + PERIPH_PIN(4, 4, kIOMUXC_LPUART4_TX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_00), + PERIPH_PIN(4, 2, kIOMUXC_LPUART4_TX_SELECT_INPUT, 1, &pin_GPIO_EMC_19), + PERIPH_PIN(4, 2, kIOMUXC_LPUART4_TX_SELECT_INPUT, 2, &pin_GPIO_B1_00), + + PERIPH_PIN(5, 2, kIOMUXC_LPUART5_TX_SELECT_INPUT, 0, &pin_GPIO_EMC_23), + PERIPH_PIN(5, 1, kIOMUXC_LPUART5_TX_SELECT_INPUT, 1, &pin_GPIO_B1_12), + + PERIPH_PIN(6, 2, kIOMUXC_LPUART6_TX_SELECT_INPUT, 0, &pin_GPIO_EMC_25), + PERIPH_PIN(6, 2, kIOMUXC_LPUART6_TX_SELECT_INPUT, 1, &pin_GPIO_AD_B0_02), + + PERIPH_PIN(7, 2, kIOMUXC_LPUART7_TX_SELECT_INPUT, 0, &pin_GPIO_SD_B1_08), + PERIPH_PIN(7, 2, kIOMUXC_LPUART7_TX_SELECT_INPUT, 1, &pin_GPIO_EMC_31), + + PERIPH_PIN(8, 2, kIOMUXC_LPUART8_TX_SELECT_INPUT, 0, &pin_GPIO_SD_B0_04), + PERIPH_PIN(8, 2, kIOMUXC_LPUART8_TX_SELECT_INPUT, 1, &pin_GPIO_AD_B1_10), + PERIPH_PIN(8, 2, kIOMUXC_LPUART8_TX_SELECT_INPUT, 2, &pin_GPIO_EMC_38), +}; + +const mcu_periph_obj_t mcu_uart_rts_list[9] = { + PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_15), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_AD_B1_01), + + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_16), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B1_05), + + PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_EMC_18), + + PERIPH_PIN(5, 2, 0, 0, &pin_GPIO_EMC_27), + + PERIPH_PIN(6, 2, 0, 0, &pin_GPIO_EMC_29), + + PERIPH_PIN(7, 2, 0, 0, &pin_GPIO_SD_B1_07), + + PERIPH_PIN(8, 2, 0, 0, &pin_GPIO_SD_B0_03), +}; + +const mcu_periph_obj_t mcu_uart_cts_list[9] = { + PERIPH_PIN(1, 2, 0, 0, &pin_GPIO_AD_B0_14), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_AD_B1_00), + + PERIPH_PIN(3, 2, kIOMUXC_LPUART3_CTS_B_SELECT_INPUT, 0, &pin_GPIO_EMC_15), + PERIPH_PIN(3, 2, kIOMUXC_LPUART3_CTS_B_SELECT_INPUT, 1, &pin_GPIO_AD_B1_04), + + PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_EMC_17), + + PERIPH_PIN(5, 2, 0, 0, &pin_GPIO_EMC_28), + + PERIPH_PIN(6, 2, 0, 0, &pin_GPIO_EMC_30), + + PERIPH_PIN(7, 2, 0, 0, &pin_GPIO_SD_B1_06), + + PERIPH_PIN(8, 2, 0, 0, &pin_GPIO_SD_B0_02), +}; + +I2S_Type *const mcu_i2s_banks[3] = { SAI1, SAI2, SAI3 }; + +const mcu_periph_obj_t mcu_i2s_rx_data0_list[6] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_DATA0_SELECT_INPUT, 0, &pin_GPIO_SD_B1_06), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_DATA0_SELECT_INPUT, 1, &pin_GPIO_AD_B1_12), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_DATA0_SELECT_INPUT, 2, &pin_GPIO_B1_00), + + PERIPH_PIN(2, 2, kIOMUXC_SAI2_RX_DATA0_SELECT_INPUT, 0, &pin_GPIO_EMC_08), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_RX_DATA0_SELECT_INPUT, 1, &pin_GPIO_AD_B0_08), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_33), +}; + +const mcu_periph_obj_t mcu_i2s_rx_sync_list[6] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_SYNC_SELECT_INPUT, 0, &pin_GPIO_SD_B1_04), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_SYNC_SELECT_INPUT, 1, &pin_GPIO_AD_B1_10), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_SYNC_SELECT_INPUT, 2, &pin_GPIO_B0_14), + + PERIPH_PIN(2, 2, kIOMUXC_SAI2_RX_SYNC_SELECT_INPUT, 0, &pin_GPIO_EMC_09), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_RX_SYNC_SELECT_INPUT, 1, &pin_GPIO_AD_B0_07), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_34), +}; + +const mcu_periph_obj_t mcu_i2s_tx_bclk_list[6] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_BCLK_SELECT_INPUT, 0, &pin_GPIO_SD_B1_08), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_BCLK_SELECT_INPUT, 1, &pin_GPIO_AD_B1_14), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_BCLK_SELECT_INPUT, 2, &pin_GPIO_B1_02), + + PERIPH_PIN(2, 2, kIOMUXC_SAI2_TX_BCLK_SELECT_INPUT, 0, &pin_GPIO_EMC_06), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_TX_BCLK_SELECT_INPUT, 1, &pin_GPIO_AD_B0_05), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_38), +}; + +const mcu_periph_obj_t mcu_i2s_tx_data0_list[6] = { + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_13), + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_B1_01), + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_SD_B1_07), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_04), + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_AD_B0_09), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_36), +}; + +const mcu_periph_obj_t mcu_i2s_tx_sync_list[6] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_SYNC_SELECT_INPUT, 0, &pin_GPIO_SD_B1_09), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_SYNC_SELECT_INPUT, 1, &pin_GPIO_AD_B1_15), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_SYNC_SELECT_INPUT, 2, &pin_GPIO_B1_03), + + PERIPH_PIN(2, 2, kIOMUXC_SAI2_TX_SYNC_SELECT_INPUT, 0, &pin_GPIO_EMC_05), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_TX_SYNC_SELECT_INPUT, 1, &pin_GPIO_AD_B0_04), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_39), +}; + +const mcu_periph_obj_t mcu_mqs_left_list[3] = { + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_14), + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_05), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_B0_01), +}; + +const mcu_periph_obj_t mcu_mqs_right_list[3] = { + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_13), + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_04), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_B0_00), +}; + +const mcu_pwm_obj_t mcu_pwm_list[67] = { + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_23_FLEXPWM1_PWM0_A, &pin_GPIO_EMC_23), + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_SD_B0_00_FLEXPWM1_PWM0_A, &pin_GPIO_SD_B0_00), + + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_24_FLEXPWM1_PWM0_B, &pin_GPIO_EMC_24), + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_SD_B0_01_FLEXPWM1_PWM0_B, &pin_GPIO_SD_B0_01), + + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmX, IOMUXC_GPIO_AD_B0_02_FLEXPWM1_PWM0_X, &pin_GPIO_AD_B0_02), + + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_25_FLEXPWM1_PWM1_A, &pin_GPIO_EMC_25), + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_SD_B0_02_FLEXPWM1_PWM1_A, &pin_GPIO_SD_B0_02), + + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_26_FLEXPWM1_PWM1_B, &pin_GPIO_EMC_26), + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_SD_B0_03_FLEXPWM1_PWM1_B, &pin_GPIO_SD_B0_03), + + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmX, IOMUXC_GPIO_AD_B0_03_FLEXPWM1_PWM1_X, &pin_GPIO_AD_B0_03), + + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_27_FLEXPWM1_PWM2_A, &pin_GPIO_EMC_27), + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_SD_B0_04_FLEXPWM1_PWM2_A, &pin_GPIO_SD_B0_04), + + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_28_FLEXPWM1_PWM2_B, &pin_GPIO_EMC_28), + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_SD_B0_05_FLEXPWM1_PWM2_B, &pin_GPIO_SD_B0_05), + + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmX, IOMUXC_GPIO_AD_B0_12_FLEXPWM1_PWM2_X, &pin_GPIO_AD_B0_12), + + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_12_FLEXPWM1_PWM3_A, &pin_GPIO_EMC_12), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_38_FLEXPWM1_PWM3_A, &pin_GPIO_EMC_38), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B0_10_FLEXPWM1_PWM3_A, &pin_GPIO_AD_B0_10), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_B1_00_FLEXPWM1_PWM3_A, &pin_GPIO_B1_00), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_SD_B1_00_FLEXPWM1_PWM3_A, &pin_GPIO_SD_B1_00), + + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_13_FLEXPWM1_PWM3_B, &pin_GPIO_EMC_13), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_39_FLEXPWM1_PWM3_B, &pin_GPIO_EMC_39), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_AD_B0_11_FLEXPWM1_PWM3_B, &pin_GPIO_AD_B0_11), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_B1_01_FLEXPWM1_PWM3_B, &pin_GPIO_B1_01), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_SD_B1_01_FLEXPWM1_PWM3_B, &pin_GPIO_SD_B1_01), + + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmX, IOMUXC_GPIO_AD_B0_13_FLEXPWM1_PWM3_X, &pin_GPIO_AD_B0_13), + + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_06_FLEXPWM2_PWM0_A, &pin_GPIO_EMC_06), + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_B0_06_FLEXPWM2_PWM0_A, &pin_GPIO_B0_06), + + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_07_FLEXPWM2_PWM0_B, &pin_GPIO_EMC_07), + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_B0_07_FLEXPWM2_PWM0_B, &pin_GPIO_B0_07), + + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_08_FLEXPWM2_PWM1_A, &pin_GPIO_EMC_08), + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_B0_08_FLEXPWM2_PWM1_A, &pin_GPIO_B0_08), + + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_09_FLEXPWM2_PWM1_B, &pin_GPIO_EMC_09), + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_B0_09_FLEXPWM2_PWM1_B, &pin_GPIO_B0_09), + + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_10_FLEXPWM2_PWM2_A, &pin_GPIO_EMC_10), + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_B0_10_FLEXPWM2_PWM2_A, &pin_GPIO_B0_10), + + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_11_FLEXPWM2_PWM2_B, &pin_GPIO_EMC_11), + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_B0_11_FLEXPWM2_PWM2_B, &pin_GPIO_B0_11), + + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_19_FLEXPWM2_PWM3_A, &pin_GPIO_EMC_19), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B0_00_FLEXPWM2_PWM3_A, &pin_GPIO_AD_B0_00), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B0_09_FLEXPWM2_PWM3_A, &pin_GPIO_AD_B0_09), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_B1_02_FLEXPWM2_PWM3_A, &pin_GPIO_B1_02), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_SD_B1_02_FLEXPWM2_PWM3_A, &pin_GPIO_SD_B1_02), + + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_20_FLEXPWM2_PWM3_B, &pin_GPIO_EMC_20), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_AD_B0_01_FLEXPWM2_PWM3_B, &pin_GPIO_AD_B0_01), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_B1_03_FLEXPWM2_PWM3_B, &pin_GPIO_B1_03), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_SD_B1_03_FLEXPWM2_PWM3_B, &pin_GPIO_SD_B1_03), + + PWM_PIN(PWM3, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_29_FLEXPWM3_PWM0_A, &pin_GPIO_EMC_29), + + PWM_PIN(PWM3, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_30_FLEXPWM3_PWM0_B, &pin_GPIO_EMC_30), + + PWM_PIN(PWM3, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_31_FLEXPWM3_PWM1_A, &pin_GPIO_EMC_31), + + PWM_PIN(PWM3, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_32_FLEXPWM3_PWM1_B, &pin_GPIO_EMC_32), + + PWM_PIN(PWM3, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_33_FLEXPWM3_PWM2_A, &pin_GPIO_EMC_33), + + PWM_PIN(PWM3, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_34_FLEXPWM3_PWM2_B, &pin_GPIO_EMC_34), + + PWM_PIN(PWM3, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_21_FLEXPWM3_PWM3_A, &pin_GPIO_EMC_21), + + PWM_PIN(PWM3, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_22_FLEXPWM3_PWM3_B, &pin_GPIO_EMC_22), + + PWM_PIN(PWM4, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_00_FLEXPWM4_PWM0_A, &pin_GPIO_EMC_00), + PWM_PIN(PWM4, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_AD_B1_08_FLEXPWM4_PWM0_A, &pin_GPIO_AD_B1_08), + + PWM_PIN(PWM4, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_01_FLEXPWM4_PWM0_B, &pin_GPIO_EMC_01), + + PWM_PIN(PWM4, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_02_FLEXPWM4_PWM1_A, &pin_GPIO_EMC_02), + PWM_PIN(PWM4, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_AD_B1_09_FLEXPWM4_PWM1_A, &pin_GPIO_AD_B1_09), + + PWM_PIN(PWM4, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_03_FLEXPWM4_PWM1_B, &pin_GPIO_EMC_03), + + PWM_PIN(PWM4, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_04_FLEXPWM4_PWM2_A, &pin_GPIO_EMC_04), + PWM_PIN(PWM4, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_B1_14_FLEXPWM4_PWM2_A, &pin_GPIO_B1_14), + + PWM_PIN(PWM4, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_05_FLEXPWM4_PWM2_B, &pin_GPIO_EMC_05), + + PWM_PIN(PWM4, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_17_FLEXPWM4_PWM3_A, &pin_GPIO_EMC_17), + PWM_PIN(PWM4, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_B1_15_FLEXPWM4_PWM3_A, &pin_GPIO_B1_15), + + PWM_PIN(PWM4, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_18_FLEXPWM4_PWM3_B, &pin_GPIO_EMC_18), +}; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.h new file mode 100644 index 0000000000..ae6566f974 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.h @@ -0,0 +1,55 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + +#pragma once +extern LPI2C_Type *const mcu_i2c_banks[4]; +extern const mcu_periph_obj_t mcu_i2c_sda_list[9]; +extern const mcu_periph_obj_t mcu_i2c_scl_list[9]; + +extern LPSPI_Type *const mcu_spi_banks[4]; +extern const mcu_periph_obj_t mcu_spi_sck_list[8]; +extern const mcu_periph_obj_t mcu_spi_sdo_list[8]; +extern const mcu_periph_obj_t mcu_spi_sdi_list[8]; + +extern LPUART_Type *const mcu_uart_banks[8]; +extern const mcu_periph_obj_t mcu_uart_rx_list[18]; +extern const mcu_periph_obj_t mcu_uart_tx_list[18]; +extern const mcu_periph_obj_t mcu_uart_rts_list[9]; +extern const mcu_periph_obj_t mcu_uart_cts_list[9]; + +extern I2S_Type *const mcu_i2s_banks[3]; +extern const mcu_periph_obj_t mcu_i2s_rx_data0_list[6]; +extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[6]; +extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[6]; +extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[6]; +extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[6]; + +extern const mcu_periph_obj_t mcu_mqs_left_list[3]; +extern const mcu_periph_obj_t mcu_mqs_right_list[3]; + +extern const mcu_pwm_obj_t mcu_pwm_list[67]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pin_names.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pin_names.h new file mode 100644 index 0000000000..4b9df709cf --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pin_names.h @@ -0,0 +1,165 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + + +// define FORMAT_PIN(pin_name) and then include this file. + +FORMAT_PIN(GPIO_EMC_00) +FORMAT_PIN(GPIO_EMC_01) +FORMAT_PIN(GPIO_EMC_02) +FORMAT_PIN(GPIO_EMC_03) +FORMAT_PIN(GPIO_EMC_04) +FORMAT_PIN(GPIO_EMC_05) +FORMAT_PIN(GPIO_EMC_06) +FORMAT_PIN(GPIO_EMC_07) +FORMAT_PIN(GPIO_EMC_08) +FORMAT_PIN(GPIO_EMC_09) +FORMAT_PIN(GPIO_EMC_10) +FORMAT_PIN(GPIO_EMC_11) +FORMAT_PIN(GPIO_EMC_12) +FORMAT_PIN(GPIO_EMC_13) +FORMAT_PIN(GPIO_EMC_14) +FORMAT_PIN(GPIO_EMC_15) +FORMAT_PIN(GPIO_EMC_16) +FORMAT_PIN(GPIO_EMC_17) +FORMAT_PIN(GPIO_EMC_18) +FORMAT_PIN(GPIO_EMC_19) +FORMAT_PIN(GPIO_EMC_20) +FORMAT_PIN(GPIO_EMC_21) +FORMAT_PIN(GPIO_EMC_22) +FORMAT_PIN(GPIO_EMC_23) +FORMAT_PIN(GPIO_EMC_24) +FORMAT_PIN(GPIO_EMC_25) +FORMAT_PIN(GPIO_EMC_26) +FORMAT_PIN(GPIO_EMC_27) +FORMAT_PIN(GPIO_EMC_28) +FORMAT_PIN(GPIO_EMC_29) +FORMAT_PIN(GPIO_EMC_30) +FORMAT_PIN(GPIO_EMC_31) +FORMAT_PIN(GPIO_EMC_32) +FORMAT_PIN(GPIO_EMC_33) +FORMAT_PIN(GPIO_EMC_34) +FORMAT_PIN(GPIO_EMC_35) +FORMAT_PIN(GPIO_EMC_36) +FORMAT_PIN(GPIO_EMC_37) +FORMAT_PIN(GPIO_EMC_38) +FORMAT_PIN(GPIO_EMC_39) +FORMAT_PIN(GPIO_EMC_40) +FORMAT_PIN(GPIO_EMC_41) + +FORMAT_PIN(GPIO_AD_B0_00) +FORMAT_PIN(GPIO_AD_B0_01) +FORMAT_PIN(GPIO_AD_B0_02) +FORMAT_PIN(GPIO_AD_B0_03) +FORMAT_PIN(GPIO_AD_B0_04) +FORMAT_PIN(GPIO_AD_B0_05) +FORMAT_PIN(GPIO_AD_B0_06) +FORMAT_PIN(GPIO_AD_B0_07) +FORMAT_PIN(GPIO_AD_B0_08) +FORMAT_PIN(GPIO_AD_B0_09) +FORMAT_PIN(GPIO_AD_B0_10) +FORMAT_PIN(GPIO_AD_B0_11) +FORMAT_PIN(GPIO_AD_B0_12) +FORMAT_PIN(GPIO_AD_B0_13) +FORMAT_PIN(GPIO_AD_B0_14) +FORMAT_PIN(GPIO_AD_B0_15) + +FORMAT_PIN(GPIO_AD_B1_00) +FORMAT_PIN(GPIO_AD_B1_01) +FORMAT_PIN(GPIO_AD_B1_02) +FORMAT_PIN(GPIO_AD_B1_03) +FORMAT_PIN(GPIO_AD_B1_04) +FORMAT_PIN(GPIO_AD_B1_05) +FORMAT_PIN(GPIO_AD_B1_06) +FORMAT_PIN(GPIO_AD_B1_07) +FORMAT_PIN(GPIO_AD_B1_08) +FORMAT_PIN(GPIO_AD_B1_09) +FORMAT_PIN(GPIO_AD_B1_10) +FORMAT_PIN(GPIO_AD_B1_11) +FORMAT_PIN(GPIO_AD_B1_12) +FORMAT_PIN(GPIO_AD_B1_13) +FORMAT_PIN(GPIO_AD_B1_14) +FORMAT_PIN(GPIO_AD_B1_15) + +FORMAT_PIN(GPIO_B0_00) +FORMAT_PIN(GPIO_B0_01) +FORMAT_PIN(GPIO_B0_02) +FORMAT_PIN(GPIO_B0_03) +FORMAT_PIN(GPIO_B0_04) +FORMAT_PIN(GPIO_B0_05) +FORMAT_PIN(GPIO_B0_06) +FORMAT_PIN(GPIO_B0_07) +FORMAT_PIN(GPIO_B0_08) +FORMAT_PIN(GPIO_B0_09) +FORMAT_PIN(GPIO_B0_10) +FORMAT_PIN(GPIO_B0_11) +FORMAT_PIN(GPIO_B0_12) +FORMAT_PIN(GPIO_B0_13) +FORMAT_PIN(GPIO_B0_14) +FORMAT_PIN(GPIO_B0_15) + +FORMAT_PIN(GPIO_B1_00) +FORMAT_PIN(GPIO_B1_01) +FORMAT_PIN(GPIO_B1_02) +FORMAT_PIN(GPIO_B1_03) +FORMAT_PIN(GPIO_B1_04) +FORMAT_PIN(GPIO_B1_05) +FORMAT_PIN(GPIO_B1_06) +FORMAT_PIN(GPIO_B1_07) +FORMAT_PIN(GPIO_B1_08) +FORMAT_PIN(GPIO_B1_09) +FORMAT_PIN(GPIO_B1_10) +FORMAT_PIN(GPIO_B1_11) +FORMAT_PIN(GPIO_B1_12) +FORMAT_PIN(GPIO_B1_13) +FORMAT_PIN(GPIO_B1_14) +FORMAT_PIN(GPIO_B1_15) + +FORMAT_PIN(GPIO_SD_B0_00) +FORMAT_PIN(GPIO_SD_B0_01) +FORMAT_PIN(GPIO_SD_B0_02) +FORMAT_PIN(GPIO_SD_B0_03) +FORMAT_PIN(GPIO_SD_B0_04) +FORMAT_PIN(GPIO_SD_B0_05) + +FORMAT_PIN(GPIO_SD_B1_00) +FORMAT_PIN(GPIO_SD_B1_01) +FORMAT_PIN(GPIO_SD_B1_02) +FORMAT_PIN(GPIO_SD_B1_03) +FORMAT_PIN(GPIO_SD_B1_04) +FORMAT_PIN(GPIO_SD_B1_05) +FORMAT_PIN(GPIO_SD_B1_06) +FORMAT_PIN(GPIO_SD_B1_07) +FORMAT_PIN(GPIO_SD_B1_08) +FORMAT_PIN(GPIO_SD_B1_09) +FORMAT_PIN(GPIO_SD_B1_10) +FORMAT_PIN(GPIO_SD_B1_11) +FORMAT_PIN(USB_OTG1_DN) +FORMAT_PIN(USB_OTG1_DP) +FORMAT_PIN(USB_OTG2_DN) +FORMAT_PIN(USB_OTG2_DP) diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.c new file mode 100644 index 0000000000..83bbe18e42 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.c @@ -0,0 +1,161 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 "py/obj.h" +#include "py/mphal.h" +#include "mimxrt10xx/pins.h" + +const mcu_pin_obj_t pin_GPIO_EMC_00 = PIN(GPIO4, 0, GPIO_EMC_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_01 = PIN(GPIO4, 1, GPIO_EMC_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_02 = PIN(GPIO4, 2, GPIO_EMC_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_03 = PIN(GPIO4, 3, GPIO_EMC_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_04 = PIN(GPIO4, 4, GPIO_EMC_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_05 = PIN(GPIO4, 5, GPIO_EMC_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_06 = PIN(GPIO4, 6, GPIO_EMC_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_07 = PIN(GPIO4, 7, GPIO_EMC_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_08 = PIN(GPIO4, 8, GPIO_EMC_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_09 = PIN(GPIO4, 9, GPIO_EMC_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_10 = PIN(GPIO4, 10, GPIO_EMC_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_11 = PIN(GPIO4, 11, GPIO_EMC_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_12 = PIN(GPIO4, 12, GPIO_EMC_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_13 = PIN(GPIO4, 13, GPIO_EMC_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_14 = PIN(GPIO4, 14, GPIO_EMC_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_15 = PIN(GPIO4, 15, GPIO_EMC_15, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_16 = PIN(GPIO4, 16, GPIO_EMC_16, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_17 = PIN(GPIO4, 17, GPIO_EMC_17, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_18 = PIN(GPIO4, 18, GPIO_EMC_18, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_19 = PIN(GPIO4, 19, GPIO_EMC_19, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_20 = PIN(GPIO4, 20, GPIO_EMC_20, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_21 = PIN(GPIO4, 21, GPIO_EMC_21, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_22 = PIN(GPIO4, 22, GPIO_EMC_22, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_23 = PIN(GPIO4, 23, GPIO_EMC_23, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_24 = PIN(GPIO4, 24, GPIO_EMC_24, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_25 = PIN(GPIO4, 25, GPIO_EMC_25, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_26 = PIN(GPIO4, 26, GPIO_EMC_26, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_27 = PIN(GPIO4, 27, GPIO_EMC_27, NO_ADC, 0, 0x00000005, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_EMC_28 = PIN(GPIO4, 28, GPIO_EMC_28, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_29 = PIN(GPIO4, 29, GPIO_EMC_29, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_30 = PIN(GPIO4, 30, GPIO_EMC_30, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_31 = PIN(GPIO4, 31, GPIO_EMC_31, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_32 = PIN(GPIO3, 18, GPIO_EMC_32, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_33 = PIN(GPIO3, 19, GPIO_EMC_33, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_34 = PIN(GPIO3, 20, GPIO_EMC_34, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_35 = PIN(GPIO3, 21, GPIO_EMC_35, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_36 = PIN(GPIO3, 22, GPIO_EMC_36, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_37 = PIN(GPIO3, 23, GPIO_EMC_37, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_38 = PIN(GPIO3, 24, GPIO_EMC_38, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_39 = PIN(GPIO3, 25, GPIO_EMC_39, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_40 = PIN(GPIO3, 26, GPIO_EMC_40, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_41 = PIN(GPIO3, 27, GPIO_EMC_41, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_00 = PIN(GPIO1, 0, GPIO_AD_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_01 = PIN(GPIO1, 1, GPIO_AD_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_02 = PIN(GPIO1, 2, GPIO_AD_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_03 = PIN(GPIO1, 3, GPIO_AD_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_04 = PIN(GPIO1, 4, GPIO_AD_B0_04, NO_ADC, 0, 0x00000000, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_05 = PIN(GPIO1, 5, GPIO_AD_B0_05, NO_ADC, 0, 0x00000000, 0x000030B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_06 = PIN(GPIO1, 6, GPIO_AD_B0_06, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_07 = PIN(GPIO1, 7, GPIO_AD_B0_07, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_08 = PIN(GPIO1, 8, GPIO_AD_B0_08, NO_ADC, 0, 0x00000000, 0x0000B0A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_09 = PIN(GPIO1, 9, GPIO_AD_B0_09, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_10 = PIN(GPIO1, 10, GPIO_AD_B0_10, NO_ADC, 0, 0x00000000, 0x000090B1); +const mcu_pin_obj_t pin_GPIO_AD_B0_11 = PIN(GPIO1, 11, GPIO_AD_B0_11, NO_ADC, 0, 0x00000000, 0x000070A0); +const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 12, GPIO_AD_B0_12, ADC1, 1, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 13, GPIO_AD_B0_13, ADC1, 2, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 14, GPIO_AD_B0_14, ADC1, 3, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 15, GPIO_AD_B0_15, ADC1, 4, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 16, GPIO_AD_B1_00, ADC2, 5, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 17, GPIO_AD_B1_01, ADC2, 6, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 18, GPIO_AD_B1_02, ADC2, 7, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 19, GPIO_AD_B1_03, ADC2, 8, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 20, GPIO_AD_B1_04, ADC2, 9, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 21, GPIO_AD_B1_05, ADC2, 10, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 22, GPIO_AD_B1_06, ADC2, 11, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 23, GPIO_AD_B1_07, ADC2, 12, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_08 = PIN(GPIO1, 24, GPIO_AD_B1_08, ADC2, 13, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_09 = PIN(GPIO1, 25, GPIO_AD_B1_09, ADC2, 14, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 26, GPIO_AD_B1_10, ADC2, 15, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 27, GPIO_AD_B1_11, ADC2, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_12 = PIN(GPIO1, 28, GPIO_AD_B1_12, ADC2, 1, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_13 = PIN(GPIO1, 29, GPIO_AD_B1_13, ADC2, 2, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_14 = PIN(GPIO1, 30, GPIO_AD_B1_14, ADC2, 3, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_15 = PIN(GPIO1, 31, GPIO_AD_B1_15, ADC2, 4, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_00 = PIN(GPIO2, 0, GPIO_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_01 = PIN(GPIO2, 1, GPIO_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_02 = PIN(GPIO2, 2, GPIO_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_03 = PIN(GPIO2, 3, GPIO_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_04 = PIN(GPIO2, 4, GPIO_B0_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_05 = PIN(GPIO2, 5, GPIO_B0_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_06 = PIN(GPIO2, 6, GPIO_B0_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_07 = PIN(GPIO2, 7, GPIO_B0_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_08 = PIN(GPIO2, 8, GPIO_B0_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_09 = PIN(GPIO2, 9, GPIO_B0_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_10 = PIN(GPIO2, 10, GPIO_B0_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_11 = PIN(GPIO2, 11, GPIO_B0_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_12 = PIN(GPIO2, 12, GPIO_B0_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_13 = PIN(GPIO2, 13, GPIO_B0_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_14 = PIN(GPIO2, 14, GPIO_B0_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B0_15 = PIN(GPIO2, 15, GPIO_B0_15, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_00 = PIN(GPIO2, 16, GPIO_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_01 = PIN(GPIO2, 17, GPIO_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_02 = PIN(GPIO2, 18, GPIO_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_03 = PIN(GPIO2, 19, GPIO_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_04 = PIN(GPIO2, 20, GPIO_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_05 = PIN(GPIO2, 21, GPIO_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_06 = PIN(GPIO2, 22, GPIO_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_07 = PIN(GPIO2, 23, GPIO_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_08 = PIN(GPIO2, 24, GPIO_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_09 = PIN(GPIO2, 25, GPIO_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_10 = PIN(GPIO2, 26, GPIO_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_11 = PIN(GPIO2, 27, GPIO_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_12 = PIN(GPIO2, 28, GPIO_B1_12, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_13 = PIN(GPIO2, 29, GPIO_B1_13, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_14 = PIN(GPIO2, 30, GPIO_B1_14, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_B1_15 = PIN(GPIO2, 31, GPIO_B1_15, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_00 = PIN(GPIO3, 12, GPIO_SD_B0_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_01 = PIN(GPIO3, 13, GPIO_SD_B0_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_02 = PIN(GPIO3, 14, GPIO_SD_B0_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_03 = PIN(GPIO3, 15, GPIO_SD_B0_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_04 = PIN(GPIO3, 16, GPIO_SD_B0_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B0_05 = PIN(GPIO3, 17, GPIO_SD_B0_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_00 = PIN(GPIO3, 0, GPIO_SD_B1_00, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_01 = PIN(GPIO3, 1, GPIO_SD_B1_01, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_02 = PIN(GPIO3, 2, GPIO_SD_B1_02, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_03 = PIN(GPIO3, 3, GPIO_SD_B1_03, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_04 = PIN(GPIO3, 4, GPIO_SD_B1_04, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_05 = PIN(GPIO3, 5, GPIO_SD_B1_05, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_06 = PIN(GPIO3, 6, GPIO_SD_B1_06, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_07 = PIN(GPIO3, 7, GPIO_SD_B1_07, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_08 = PIN(GPIO3, 8, GPIO_SD_B1_08, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_09 = PIN(GPIO3, 9, GPIO_SD_B1_09, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_10 = PIN(GPIO3, 10, GPIO_SD_B1_10, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_SD_B1_11 = PIN(GPIO3, 11, GPIO_SD_B1_11, NO_ADC, 0, 0x00000005, 0x000010B0); + +const mcu_pin_obj_t pin_USB_OTG1_DN = { { &mcu_pin_type }, }; +const mcu_pin_obj_t pin_USB_OTG1_DP = { { &mcu_pin_type }, }; +const mcu_pin_obj_t pin_USB_OTG2_DN = { { &mcu_pin_type }, }; +const mcu_pin_obj_t pin_USB_OTG2_DP = { { &mcu_pin_type }, }; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.h new file mode 100644 index 0000000000..6e40d30c2b --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + +#pragma once + +#define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; +#include "pin_names.h" +#undef FORMAT_PIN + +#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 4) +extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c index c43f4eb96b..12c9a09621 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c @@ -5,6 +5,7 @@ * * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 @@ -19,7 +20,7 @@ * 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 R COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * 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. @@ -77,7 +78,7 @@ const mcu_periph_obj_t mcu_spi_sck_list[8] = { PERIPH_PIN(4, 1, kIOMUXC_LPSPI4_SCK_SELECT_INPUT, 1, &pin_GPIO_B1_07), }; -const mcu_periph_obj_t mcu_spi_mosi_list[8] = { +const mcu_periph_obj_t mcu_spi_sdo_list[8] = { PERIPH_PIN(1, 3, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 0, &pin_GPIO_EMC_28), PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SDO_SELECT_INPUT, 1, &pin_GPIO_SD_B0_02), @@ -91,7 +92,7 @@ const mcu_periph_obj_t mcu_spi_mosi_list[8] = { PERIPH_PIN(4, 1, kIOMUXC_LPSPI4_SDO_SELECT_INPUT, 1, &pin_GPIO_B1_06), }; -const mcu_periph_obj_t mcu_spi_miso_list[8] = { +const mcu_periph_obj_t mcu_spi_sdi_list[8] = { PERIPH_PIN(1, 3, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 0, &pin_GPIO_EMC_29), PERIPH_PIN(1, 4, kIOMUXC_LPSPI1_SDI_SELECT_INPUT, 1, &pin_GPIO_SD_B0_03), @@ -168,8 +169,8 @@ const mcu_periph_obj_t mcu_uart_rts_list[9] = { PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_AD_B1_01), - PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B1_05), PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_16), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_AD_B1_05), PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_EMC_18), @@ -201,6 +202,80 @@ const mcu_periph_obj_t mcu_uart_cts_list[9] = { PERIPH_PIN(8, 2, 0, 0, &pin_GPIO_SD_B0_02), }; +I2S_Type *const mcu_i2s_banks[3] = { SAI1, SAI2, SAI3 }; + +const mcu_periph_obj_t mcu_i2s_rx_data0_list[7] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_DATA0_SELECT_INPUT, 0, &pin_GPIO_SD_B1_06), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_DATA0_SELECT_INPUT, 1, &pin_GPIO_AD_B1_12), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_DATA0_SELECT_INPUT, 2, &pin_GPIO_B1_00), + + PERIPH_PIN(2, 2, kIOMUXC_SAI2_RX_DATA0_SELECT_INPUT, 0, &pin_GPIO_EMC_08), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_RX_DATA0_SELECT_INPUT, 1, &pin_GPIO_AD_B0_08), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_33), + PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_00), +}; + +const mcu_periph_obj_t mcu_i2s_rx_sync_list[7] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_SYNC_SELECT_INPUT, 0, &pin_GPIO_SD_B1_04), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_SYNC_SELECT_INPUT, 1, &pin_GPIO_AD_B1_10), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_RX_SYNC_SELECT_INPUT, 2, &pin_GPIO_B0_14), + + PERIPH_PIN(2, 2, kIOMUXC_SAI2_RX_SYNC_SELECT_INPUT, 0, &pin_GPIO_EMC_09), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_RX_SYNC_SELECT_INPUT, 1, &pin_GPIO_AD_B0_07), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_34), + PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_05), +}; + +const mcu_periph_obj_t mcu_i2s_tx_bclk_list[7] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_BCLK_SELECT_INPUT, 0, &pin_GPIO_SD_B1_08), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_BCLK_SELECT_INPUT, 1, &pin_GPIO_AD_B1_14), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_BCLK_SELECT_INPUT, 2, &pin_GPIO_B1_02), + + PERIPH_PIN(2, 2, kIOMUXC_SAI2_TX_BCLK_SELECT_INPUT, 0, &pin_GPIO_EMC_06), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_TX_BCLK_SELECT_INPUT, 1, &pin_GPIO_AD_B0_05), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_38), + PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_03), +}; + +const mcu_periph_obj_t mcu_i2s_tx_data0_list[7] = { + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_13), + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_B1_01), + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_SD_B1_07), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_04), + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_AD_B0_09), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_36), + PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_01), +}; + +const mcu_periph_obj_t mcu_i2s_tx_sync_list[7] = { + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_SYNC_SELECT_INPUT, 0, &pin_GPIO_SD_B1_09), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_SYNC_SELECT_INPUT, 1, &pin_GPIO_AD_B1_15), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_TX_SYNC_SELECT_INPUT, 2, &pin_GPIO_B1_03), + + PERIPH_PIN(2, 2, kIOMUXC_SAI2_TX_SYNC_SELECT_INPUT, 0, &pin_GPIO_EMC_05), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_TX_SYNC_SELECT_INPUT, 1, &pin_GPIO_AD_B0_04), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_39), + PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_02), +}; + +const mcu_periph_obj_t mcu_mqs_left_list[3] = { + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_14), + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_05), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_B0_01), +}; + +const mcu_periph_obj_t mcu_mqs_right_list[3] = { + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_13), + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_04), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_B0_00), +}; + const mcu_pwm_obj_t mcu_pwm_list[67] = { PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_23_FLEXPWM1_PWMA00, &pin_GPIO_EMC_23), PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_SD_B0_00_FLEXPWM1_PWMA00, &pin_GPIO_SD_B0_00), @@ -226,17 +301,17 @@ const mcu_pwm_obj_t mcu_pwm_list[67] = { PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmX, IOMUXC_GPIO_AD_B0_12_FLEXPWM1_PWMX02, &pin_GPIO_AD_B0_12), - PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B0_10_FLEXPWM1_PWMA03, &pin_GPIO_AD_B0_10), - PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_38_FLEXPWM1_PWMA03, &pin_GPIO_EMC_38), - PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_SD_B1_00_FLEXPWM1_PWMA03, &pin_GPIO_SD_B1_00), PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_12_FLEXPWM1_PWMA03, &pin_GPIO_EMC_12), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_38_FLEXPWM1_PWMA03, &pin_GPIO_EMC_38), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B0_10_FLEXPWM1_PWMA03, &pin_GPIO_AD_B0_10), PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_B1_00_FLEXPWM1_PWMA03, &pin_GPIO_B1_00), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_SD_B1_00_FLEXPWM1_PWMA03, &pin_GPIO_SD_B1_00), - PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_AD_B0_11_FLEXPWM1_PWMB03, &pin_GPIO_AD_B0_11), - PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_39_FLEXPWM1_PWMB03, &pin_GPIO_EMC_39), - PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_SD_B1_01_FLEXPWM1_PWMB03, &pin_GPIO_SD_B1_01), PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_13_FLEXPWM1_PWMB03, &pin_GPIO_EMC_13), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_39_FLEXPWM1_PWMB03, &pin_GPIO_EMC_39), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_AD_B0_11_FLEXPWM1_PWMB03, &pin_GPIO_AD_B0_11), PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_B1_01_FLEXPWM1_PWMB03, &pin_GPIO_B1_01), + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_SD_B1_01_FLEXPWM1_PWMB03, &pin_GPIO_SD_B1_01), PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmX, IOMUXC_GPIO_AD_B0_13_FLEXPWM1_PWMX03, &pin_GPIO_AD_B0_13), @@ -258,16 +333,16 @@ const mcu_pwm_obj_t mcu_pwm_list[67] = { PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_11_FLEXPWM2_PWMB02, &pin_GPIO_EMC_11), PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_B0_11_FLEXPWM2_PWMB02, &pin_GPIO_B0_11), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_19_FLEXPWM2_PWMA03, &pin_GPIO_EMC_19), PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B0_00_FLEXPWM2_PWMA03, &pin_GPIO_AD_B0_00), PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_AD_B0_09_FLEXPWM2_PWMA03, &pin_GPIO_AD_B0_09), - PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_19_FLEXPWM2_PWMA03, &pin_GPIO_EMC_19), - PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_SD_B1_02_FLEXPWM2_PWMA03, &pin_GPIO_SD_B1_02), PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_B1_02_FLEXPWM2_PWMA03, &pin_GPIO_B1_02), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_SD_B1_02_FLEXPWM2_PWMA03, &pin_GPIO_SD_B1_02), - PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_AD_B0_01_FLEXPWM2_PWMB03, &pin_GPIO_AD_B0_01), PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_20_FLEXPWM2_PWMB03, &pin_GPIO_EMC_20), - PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_SD_B1_03_FLEXPWM2_PWMB03, &pin_GPIO_SD_B1_03), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_AD_B0_01_FLEXPWM2_PWMB03, &pin_GPIO_AD_B0_01), PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_B1_03_FLEXPWM2_PWMB03, &pin_GPIO_B1_03), + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_SD_B1_03_FLEXPWM2_PWMB03, &pin_GPIO_SD_B1_03), PWM_PIN(PWM3, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_29_FLEXPWM3_PWMA00, &pin_GPIO_EMC_29), @@ -285,90 +360,23 @@ const mcu_pwm_obj_t mcu_pwm_list[67] = { PWM_PIN(PWM3, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_22_FLEXPWM3_PWMB03, &pin_GPIO_EMC_22), - PWM_PIN(PWM4, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_AD_B1_08_FLEXPWM4_PWMA00, &pin_GPIO_AD_B1_08), PWM_PIN(PWM4, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_00_FLEXPWM4_PWMA00, &pin_GPIO_EMC_00), + PWM_PIN(PWM4, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_AD_B1_08_FLEXPWM4_PWMA00, &pin_GPIO_AD_B1_08), PWM_PIN(PWM4, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_01_FLEXPWM4_PWMB00, &pin_GPIO_EMC_01), - PWM_PIN(PWM4, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_AD_B1_09_FLEXPWM4_PWMA01, &pin_GPIO_AD_B1_09), PWM_PIN(PWM4, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_02_FLEXPWM4_PWMA01, &pin_GPIO_EMC_02), + PWM_PIN(PWM4, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_AD_B1_09_FLEXPWM4_PWMA01, &pin_GPIO_AD_B1_09), PWM_PIN(PWM4, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_03_FLEXPWM4_PWMB01, &pin_GPIO_EMC_03), - PWM_PIN(PWM4, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_B1_14_FLEXPWM4_PWMA02, &pin_GPIO_B1_14), PWM_PIN(PWM4, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_04_FLEXPWM4_PWMA02, &pin_GPIO_EMC_04), + PWM_PIN(PWM4, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_B1_14_FLEXPWM4_PWMA02, &pin_GPIO_B1_14), PWM_PIN(PWM4, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_05_FLEXPWM4_PWMB02, &pin_GPIO_EMC_05), - PWM_PIN(PWM4, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_B1_15_FLEXPWM4_PWMA03, &pin_GPIO_B1_15), PWM_PIN(PWM4, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_17_FLEXPWM4_PWMA03, &pin_GPIO_EMC_17), + PWM_PIN(PWM4, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_B1_15_FLEXPWM4_PWMA03, &pin_GPIO_B1_15), PWM_PIN(PWM4, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_18_FLEXPWM4_PWMB03, &pin_GPIO_EMC_18), - -}; - -const mcu_periph_obj_t mcu_sai_rx_bclk_list[] = { - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_11), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_B0_15), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_SD_B1_05), - PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_10), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_AD_B0_06), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_35), - PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_00), -}; - -const mcu_periph_obj_t mcu_sai_rx_data0_list[] = { - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_B1_00), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_12), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_06), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_AD_B0_08), - PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_08), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_33), - PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_00), -}; -const mcu_periph_obj_t mcu_sai_rx_sync_list[] = { - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_11), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_B0_15), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_SD_B1_05), - PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_09), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_AD_B0_06), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_34), - PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_05), -}; -const mcu_periph_obj_t mcu_sai_tx_bclk_list[] = { - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_SD_B1_08), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_B1_02), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_14), - PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_AD_B0_05), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_06), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_38), - PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_03), -}; -const mcu_periph_obj_t mcu_sai_tx_data0_list[] = { - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_13), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_B1_01), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_SD_B1_07), - PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_04), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_AD_B0_09), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_36), - PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_01), -}; -const mcu_periph_obj_t mcu_sai_tx_sync_list[] = { - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_15), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_B1_03), - PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_SD_B1_09), - PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_AD_B0_04), - PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_05), - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_39), - PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_02), -}; -const mcu_periph_obj_t mcu_mqs_left_list[] = { - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_14), - PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_B0_01), - PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_05), -}; -const mcu_periph_obj_t mcu_mqs_right_list[] = { - PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_13), - PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_B0_00), - PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_04), }; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h index 28ea8e3742..7917a2ebdb 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h @@ -3,7 +3,9 @@ * * The MIT License (MIT) * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 @@ -24,37 +26,30 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_MIMXRT10XX_MIMXRT1062_PERIPHERALS_MIMXRT1011_PERIPH_H -#define MICROPY_INCLUDED_MIMXRT10XX_MIMXRT1062_PERIPHERALS_MIMXRT1011_PERIPH_H - +#pragma once extern LPI2C_Type *const mcu_i2c_banks[4]; - extern const mcu_periph_obj_t mcu_i2c_sda_list[9]; extern const mcu_periph_obj_t mcu_i2c_scl_list[9]; extern LPSPI_Type *const mcu_spi_banks[4]; - extern const mcu_periph_obj_t mcu_spi_sck_list[8]; -extern const mcu_periph_obj_t mcu_spi_mosi_list[8]; -extern const mcu_periph_obj_t mcu_spi_miso_list[8]; +extern const mcu_periph_obj_t mcu_spi_sdo_list[8]; +extern const mcu_periph_obj_t mcu_spi_sdi_list[8]; extern LPUART_Type *const mcu_uart_banks[8]; - extern const mcu_periph_obj_t mcu_uart_rx_list[18]; extern const mcu_periph_obj_t mcu_uart_tx_list[18]; extern const mcu_periph_obj_t mcu_uart_rts_list[9]; extern const mcu_periph_obj_t mcu_uart_cts_list[9]; -extern const mcu_pwm_obj_t mcu_pwm_list[67]; - -extern const mcu_periph_obj_t mcu_sai_rx_bclk_list[7]; -extern const mcu_periph_obj_t mcu_sai_rx_data0_list[7]; -extern const mcu_periph_obj_t mcu_sai_rx_sync_list[7]; -extern const mcu_periph_obj_t mcu_sai_tx_bclk_list[7]; -extern const mcu_periph_obj_t mcu_sai_tx_data0_list[7]; -extern const mcu_periph_obj_t mcu_sai_tx_sync_list[7]; +extern I2S_Type *const mcu_i2s_banks[3]; +extern const mcu_periph_obj_t mcu_i2s_rx_data0_list[7]; +extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[7]; +extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[7]; +extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[7]; +extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[7]; extern const mcu_periph_obj_t mcu_mqs_left_list[3]; extern const mcu_periph_obj_t mcu_mqs_right_list[3]; -#endif // MICROPY_INCLUDED_MIMXRT10XX_MIMXRT1062_PERIPHERALS_MIMXRT1011_PERIPH_H +extern const mcu_pwm_obj_t mcu_pwm_list[67]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pin_names.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pin_names.h new file mode 100644 index 0000000000..4b9df709cf --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pin_names.h @@ -0,0 +1,165 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + + +// define FORMAT_PIN(pin_name) and then include this file. + +FORMAT_PIN(GPIO_EMC_00) +FORMAT_PIN(GPIO_EMC_01) +FORMAT_PIN(GPIO_EMC_02) +FORMAT_PIN(GPIO_EMC_03) +FORMAT_PIN(GPIO_EMC_04) +FORMAT_PIN(GPIO_EMC_05) +FORMAT_PIN(GPIO_EMC_06) +FORMAT_PIN(GPIO_EMC_07) +FORMAT_PIN(GPIO_EMC_08) +FORMAT_PIN(GPIO_EMC_09) +FORMAT_PIN(GPIO_EMC_10) +FORMAT_PIN(GPIO_EMC_11) +FORMAT_PIN(GPIO_EMC_12) +FORMAT_PIN(GPIO_EMC_13) +FORMAT_PIN(GPIO_EMC_14) +FORMAT_PIN(GPIO_EMC_15) +FORMAT_PIN(GPIO_EMC_16) +FORMAT_PIN(GPIO_EMC_17) +FORMAT_PIN(GPIO_EMC_18) +FORMAT_PIN(GPIO_EMC_19) +FORMAT_PIN(GPIO_EMC_20) +FORMAT_PIN(GPIO_EMC_21) +FORMAT_PIN(GPIO_EMC_22) +FORMAT_PIN(GPIO_EMC_23) +FORMAT_PIN(GPIO_EMC_24) +FORMAT_PIN(GPIO_EMC_25) +FORMAT_PIN(GPIO_EMC_26) +FORMAT_PIN(GPIO_EMC_27) +FORMAT_PIN(GPIO_EMC_28) +FORMAT_PIN(GPIO_EMC_29) +FORMAT_PIN(GPIO_EMC_30) +FORMAT_PIN(GPIO_EMC_31) +FORMAT_PIN(GPIO_EMC_32) +FORMAT_PIN(GPIO_EMC_33) +FORMAT_PIN(GPIO_EMC_34) +FORMAT_PIN(GPIO_EMC_35) +FORMAT_PIN(GPIO_EMC_36) +FORMAT_PIN(GPIO_EMC_37) +FORMAT_PIN(GPIO_EMC_38) +FORMAT_PIN(GPIO_EMC_39) +FORMAT_PIN(GPIO_EMC_40) +FORMAT_PIN(GPIO_EMC_41) + +FORMAT_PIN(GPIO_AD_B0_00) +FORMAT_PIN(GPIO_AD_B0_01) +FORMAT_PIN(GPIO_AD_B0_02) +FORMAT_PIN(GPIO_AD_B0_03) +FORMAT_PIN(GPIO_AD_B0_04) +FORMAT_PIN(GPIO_AD_B0_05) +FORMAT_PIN(GPIO_AD_B0_06) +FORMAT_PIN(GPIO_AD_B0_07) +FORMAT_PIN(GPIO_AD_B0_08) +FORMAT_PIN(GPIO_AD_B0_09) +FORMAT_PIN(GPIO_AD_B0_10) +FORMAT_PIN(GPIO_AD_B0_11) +FORMAT_PIN(GPIO_AD_B0_12) +FORMAT_PIN(GPIO_AD_B0_13) +FORMAT_PIN(GPIO_AD_B0_14) +FORMAT_PIN(GPIO_AD_B0_15) + +FORMAT_PIN(GPIO_AD_B1_00) +FORMAT_PIN(GPIO_AD_B1_01) +FORMAT_PIN(GPIO_AD_B1_02) +FORMAT_PIN(GPIO_AD_B1_03) +FORMAT_PIN(GPIO_AD_B1_04) +FORMAT_PIN(GPIO_AD_B1_05) +FORMAT_PIN(GPIO_AD_B1_06) +FORMAT_PIN(GPIO_AD_B1_07) +FORMAT_PIN(GPIO_AD_B1_08) +FORMAT_PIN(GPIO_AD_B1_09) +FORMAT_PIN(GPIO_AD_B1_10) +FORMAT_PIN(GPIO_AD_B1_11) +FORMAT_PIN(GPIO_AD_B1_12) +FORMAT_PIN(GPIO_AD_B1_13) +FORMAT_PIN(GPIO_AD_B1_14) +FORMAT_PIN(GPIO_AD_B1_15) + +FORMAT_PIN(GPIO_B0_00) +FORMAT_PIN(GPIO_B0_01) +FORMAT_PIN(GPIO_B0_02) +FORMAT_PIN(GPIO_B0_03) +FORMAT_PIN(GPIO_B0_04) +FORMAT_PIN(GPIO_B0_05) +FORMAT_PIN(GPIO_B0_06) +FORMAT_PIN(GPIO_B0_07) +FORMAT_PIN(GPIO_B0_08) +FORMAT_PIN(GPIO_B0_09) +FORMAT_PIN(GPIO_B0_10) +FORMAT_PIN(GPIO_B0_11) +FORMAT_PIN(GPIO_B0_12) +FORMAT_PIN(GPIO_B0_13) +FORMAT_PIN(GPIO_B0_14) +FORMAT_PIN(GPIO_B0_15) + +FORMAT_PIN(GPIO_B1_00) +FORMAT_PIN(GPIO_B1_01) +FORMAT_PIN(GPIO_B1_02) +FORMAT_PIN(GPIO_B1_03) +FORMAT_PIN(GPIO_B1_04) +FORMAT_PIN(GPIO_B1_05) +FORMAT_PIN(GPIO_B1_06) +FORMAT_PIN(GPIO_B1_07) +FORMAT_PIN(GPIO_B1_08) +FORMAT_PIN(GPIO_B1_09) +FORMAT_PIN(GPIO_B1_10) +FORMAT_PIN(GPIO_B1_11) +FORMAT_PIN(GPIO_B1_12) +FORMAT_PIN(GPIO_B1_13) +FORMAT_PIN(GPIO_B1_14) +FORMAT_PIN(GPIO_B1_15) + +FORMAT_PIN(GPIO_SD_B0_00) +FORMAT_PIN(GPIO_SD_B0_01) +FORMAT_PIN(GPIO_SD_B0_02) +FORMAT_PIN(GPIO_SD_B0_03) +FORMAT_PIN(GPIO_SD_B0_04) +FORMAT_PIN(GPIO_SD_B0_05) + +FORMAT_PIN(GPIO_SD_B1_00) +FORMAT_PIN(GPIO_SD_B1_01) +FORMAT_PIN(GPIO_SD_B1_02) +FORMAT_PIN(GPIO_SD_B1_03) +FORMAT_PIN(GPIO_SD_B1_04) +FORMAT_PIN(GPIO_SD_B1_05) +FORMAT_PIN(GPIO_SD_B1_06) +FORMAT_PIN(GPIO_SD_B1_07) +FORMAT_PIN(GPIO_SD_B1_08) +FORMAT_PIN(GPIO_SD_B1_09) +FORMAT_PIN(GPIO_SD_B1_10) +FORMAT_PIN(GPIO_SD_B1_11) +FORMAT_PIN(USB_OTG1_DN) +FORMAT_PIN(USB_OTG1_DP) +FORMAT_PIN(USB_OTG2_DN) +FORMAT_PIN(USB_OTG2_DP) diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c index 7fb5e7a9be..472677ff24 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c @@ -5,6 +5,7 @@ * * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 @@ -56,7 +57,7 @@ const mcu_pin_obj_t pin_GPIO_EMC_23 = PIN(GPIO4, 23, GPIO_EMC_23, NO_ADC, 0, 0x0 const mcu_pin_obj_t pin_GPIO_EMC_24 = PIN(GPIO4, 24, GPIO_EMC_24, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_EMC_25 = PIN(GPIO4, 25, GPIO_EMC_25, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_EMC_26 = PIN(GPIO4, 26, GPIO_EMC_26, NO_ADC, 0, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_EMC_27 = PIN(GPIO4, 27, GPIO_EMC_27, NO_ADC, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_EMC_27 = PIN(GPIO4, 27, GPIO_EMC_27, NO_ADC, 0, 0x00000005, 0x000030B0); const mcu_pin_obj_t pin_GPIO_EMC_28 = PIN(GPIO4, 28, GPIO_EMC_28, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_EMC_29 = PIN(GPIO4, 29, GPIO_EMC_29, NO_ADC, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_EMC_30 = PIN(GPIO4, 30, GPIO_EMC_30, NO_ADC, 0, 0x00000005, 0x000010B0); @@ -87,18 +88,18 @@ const mcu_pin_obj_t pin_GPIO_AD_B0_12 = PIN(GPIO1, 12, GPIO_AD_B0_12, ADC1, 1, 0 const mcu_pin_obj_t pin_GPIO_AD_B0_13 = PIN(GPIO1, 13, GPIO_AD_B0_13, ADC1, 2, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_AD_B0_14 = PIN(GPIO1, 14, GPIO_AD_B0_14, ADC1, 3, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_AD_B0_15 = PIN(GPIO1, 15, GPIO_AD_B0_15, ADC1, 4, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 16, GPIO_AD_B1_00, ADC1, 5, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 17, GPIO_AD_B1_01, ADC1, 6, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 18, GPIO_AD_B1_02, ADC1, 7, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 19, GPIO_AD_B1_03, ADC1, 8, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 20, GPIO_AD_B1_04, ADC1, 9, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 21, GPIO_AD_B1_05, ADC1, 10, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 22, GPIO_AD_B1_06, ADC1, 11, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 23, GPIO_AD_B1_07, ADC1, 12, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_08 = PIN(GPIO1, 24, GPIO_AD_B1_08, ADC1, 13, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_09 = PIN(GPIO1, 25, GPIO_AD_B1_09, ADC1, 14, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 26, GPIO_AD_B1_10, ADC1, 15, 0x00000005, 0x000010B0); -const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 27, GPIO_AD_B1_11, ADC1, 0, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_00 = PIN(GPIO1, 16, GPIO_AD_B1_00, ADC2, 5, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_01 = PIN(GPIO1, 17, GPIO_AD_B1_01, ADC2, 6, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_02 = PIN(GPIO1, 18, GPIO_AD_B1_02, ADC2, 7, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_03 = PIN(GPIO1, 19, GPIO_AD_B1_03, ADC2, 8, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_04 = PIN(GPIO1, 20, GPIO_AD_B1_04, ADC2, 9, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_05 = PIN(GPIO1, 21, GPIO_AD_B1_05, ADC2, 10, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_06 = PIN(GPIO1, 22, GPIO_AD_B1_06, ADC2, 11, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_07 = PIN(GPIO1, 23, GPIO_AD_B1_07, ADC2, 12, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_08 = PIN(GPIO1, 24, GPIO_AD_B1_08, ADC2, 13, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_09 = PIN(GPIO1, 25, GPIO_AD_B1_09, ADC2, 14, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_10 = PIN(GPIO1, 26, GPIO_AD_B1_10, ADC2, 15, 0x00000005, 0x000010B0); +const mcu_pin_obj_t pin_GPIO_AD_B1_11 = PIN(GPIO1, 27, GPIO_AD_B1_11, ADC2, 0, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_AD_B1_12 = PIN(GPIO1, 28, GPIO_AD_B1_12, ADC2, 1, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_AD_B1_13 = PIN(GPIO1, 29, GPIO_AD_B1_13, ADC2, 2, 0x00000005, 0x000010B0); const mcu_pin_obj_t pin_GPIO_AD_B1_14 = PIN(GPIO1, 30, GPIO_AD_B1_14, ADC2, 3, 0x00000005, 0x000010B0); diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h index 109882df93..6e40d30c2b 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h @@ -3,7 +3,9 @@ * * The MIT License (MIT) * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 @@ -24,145 +26,11 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1062_PINS_H -#define MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1062_PINS_H +#pragma once -extern const mcu_pin_obj_t pin_GPIO_EMC_00; -extern const mcu_pin_obj_t pin_GPIO_EMC_01; -extern const mcu_pin_obj_t pin_GPIO_EMC_02; -extern const mcu_pin_obj_t pin_GPIO_EMC_03; -extern const mcu_pin_obj_t pin_GPIO_EMC_04; -extern const mcu_pin_obj_t pin_GPIO_EMC_05; -extern const mcu_pin_obj_t pin_GPIO_EMC_06; -extern const mcu_pin_obj_t pin_GPIO_EMC_07; -extern const mcu_pin_obj_t pin_GPIO_EMC_08; -extern const mcu_pin_obj_t pin_GPIO_EMC_09; -extern const mcu_pin_obj_t pin_GPIO_EMC_10; -extern const mcu_pin_obj_t pin_GPIO_EMC_11; -extern const mcu_pin_obj_t pin_GPIO_EMC_12; -extern const mcu_pin_obj_t pin_GPIO_EMC_13; -extern const mcu_pin_obj_t pin_GPIO_EMC_14; -extern const mcu_pin_obj_t pin_GPIO_EMC_15; -extern const mcu_pin_obj_t pin_GPIO_EMC_16; -extern const mcu_pin_obj_t pin_GPIO_EMC_17; -extern const mcu_pin_obj_t pin_GPIO_EMC_18; -extern const mcu_pin_obj_t pin_GPIO_EMC_19; -extern const mcu_pin_obj_t pin_GPIO_EMC_20; -extern const mcu_pin_obj_t pin_GPIO_EMC_21; -extern const mcu_pin_obj_t pin_GPIO_EMC_22; -extern const mcu_pin_obj_t pin_GPIO_EMC_23; -extern const mcu_pin_obj_t pin_GPIO_EMC_24; -extern const mcu_pin_obj_t pin_GPIO_EMC_25; -extern const mcu_pin_obj_t pin_GPIO_EMC_26; -extern const mcu_pin_obj_t pin_GPIO_EMC_27; -extern const mcu_pin_obj_t pin_GPIO_EMC_28; -extern const mcu_pin_obj_t pin_GPIO_EMC_29; -extern const mcu_pin_obj_t pin_GPIO_EMC_30; -extern const mcu_pin_obj_t pin_GPIO_EMC_31; -extern const mcu_pin_obj_t pin_GPIO_EMC_32; -extern const mcu_pin_obj_t pin_GPIO_EMC_33; -extern const mcu_pin_obj_t pin_GPIO_EMC_34; -extern const mcu_pin_obj_t pin_GPIO_EMC_35; -extern const mcu_pin_obj_t pin_GPIO_EMC_36; -extern const mcu_pin_obj_t pin_GPIO_EMC_37; -extern const mcu_pin_obj_t pin_GPIO_EMC_38; -extern const mcu_pin_obj_t pin_GPIO_EMC_39; -extern const mcu_pin_obj_t pin_GPIO_EMC_40; -extern const mcu_pin_obj_t pin_GPIO_EMC_41; +#define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; +#include "pin_names.h" +#undef FORMAT_PIN -extern const mcu_pin_obj_t pin_GPIO_AD_B0_00; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_01; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_02; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_03; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_04; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_05; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_06; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_07; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_08; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_09; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_10; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_11; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_12; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_13; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_14; -extern const mcu_pin_obj_t pin_GPIO_AD_B0_15; - -extern const mcu_pin_obj_t pin_GPIO_AD_B1_00; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_01; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_02; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_03; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_04; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_05; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_06; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_07; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_08; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_09; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_10; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_11; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_12; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_13; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_14; -extern const mcu_pin_obj_t pin_GPIO_AD_B1_15; - -extern const mcu_pin_obj_t pin_GPIO_B0_00; -extern const mcu_pin_obj_t pin_GPIO_B0_01; -extern const mcu_pin_obj_t pin_GPIO_B0_02; -extern const mcu_pin_obj_t pin_GPIO_B0_03; -extern const mcu_pin_obj_t pin_GPIO_B0_04; -extern const mcu_pin_obj_t pin_GPIO_B0_05; -extern const mcu_pin_obj_t pin_GPIO_B0_06; -extern const mcu_pin_obj_t pin_GPIO_B0_07; -extern const mcu_pin_obj_t pin_GPIO_B0_08; -extern const mcu_pin_obj_t pin_GPIO_B0_09; -extern const mcu_pin_obj_t pin_GPIO_B0_10; -extern const mcu_pin_obj_t pin_GPIO_B0_11; -extern const mcu_pin_obj_t pin_GPIO_B0_12; -extern const mcu_pin_obj_t pin_GPIO_B0_13; -extern const mcu_pin_obj_t pin_GPIO_B0_14; -extern const mcu_pin_obj_t pin_GPIO_B0_15; - -extern const mcu_pin_obj_t pin_GPIO_B1_00; -extern const mcu_pin_obj_t pin_GPIO_B1_01; -extern const mcu_pin_obj_t pin_GPIO_B1_02; -extern const mcu_pin_obj_t pin_GPIO_B1_03; -extern const mcu_pin_obj_t pin_GPIO_B1_04; -extern const mcu_pin_obj_t pin_GPIO_B1_05; -extern const mcu_pin_obj_t pin_GPIO_B1_06; -extern const mcu_pin_obj_t pin_GPIO_B1_07; -extern const mcu_pin_obj_t pin_GPIO_B1_08; -extern const mcu_pin_obj_t pin_GPIO_B1_09; -extern const mcu_pin_obj_t pin_GPIO_B1_10; -extern const mcu_pin_obj_t pin_GPIO_B1_11; -extern const mcu_pin_obj_t pin_GPIO_B1_12; -extern const mcu_pin_obj_t pin_GPIO_B1_13; -extern const mcu_pin_obj_t pin_GPIO_B1_14; -extern const mcu_pin_obj_t pin_GPIO_B1_15; - -extern const mcu_pin_obj_t pin_GPIO_SD_B0_00; -extern const mcu_pin_obj_t pin_GPIO_SD_B0_01; -extern const mcu_pin_obj_t pin_GPIO_SD_B0_02; -extern const mcu_pin_obj_t pin_GPIO_SD_B0_03; -extern const mcu_pin_obj_t pin_GPIO_SD_B0_04; -extern const mcu_pin_obj_t pin_GPIO_SD_B0_05; - -extern const mcu_pin_obj_t pin_GPIO_SD_B1_00; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_01; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_02; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_03; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_04; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_05; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_06; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_07; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_08; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_09; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_10; -extern const mcu_pin_obj_t pin_GPIO_SD_B1_11; - -extern const mcu_pin_obj_t pin_USB_OTG1_DN; -extern const mcu_pin_obj_t pin_USB_OTG1_DP; -extern const mcu_pin_obj_t pin_USB_OTG2_DN; -extern const mcu_pin_obj_t pin_USB_OTG2_DP; - -extern const mcu_pin_obj_t mcu_pin_list[IOMUXC_SW_PAD_CTL_PAD_COUNT]; - -#endif // MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_MIMXRT1062_PINS_H +#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 4) +extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/clocks.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/clocks.c new file mode 100644 index 0000000000..1252d48135 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/clocks.c @@ -0,0 +1,672 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Artur Pacholec + * + * 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. + */ +/* + * Copyright 2019 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "mpconfigport.h" + +#include "fsl_clock.h" +#include "fsl_iomuxc.h" +#include "fsl_dcdc.h" +#include "fsl_device_registers.h" +#include "fsl_pmu.h" + +#include "clocks.h" + +#ifndef SKIP_POWER_ADJUSTMENT +#if __CORTEX_M == 7 +#define BYPASS_LDO_LPSR 1 +#define SKIP_LDO_ADJUSTMENT 1 +#elif __CORTEX_M == 4 +#define SKIP_DCDC_ADJUSTMENT 1 +#define SKIP_FBB_ENABLE 1 +#endif +#endif + +const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN = +{ + .postDivider = kCLOCK_PllPostDiv2, /* Post divider, 0 - DIV by 2, 1 - DIV by 4, 2 - DIV by 8, 3 - DIV by 1 */ + .loopDivider = 166, /* PLL Loop divider, Fout = Fin * ( loopDivider / ( 2 * postDivider ) ) */ +}; + +const clock_sys_pll2_config_t sysPll2Config_BOARD_BootClockRUN = +{ + .mfd = 268435455, /* Denominator of spread spectrum */ + .ss = NULL, /* Spread spectrum parameter */ + .ssEnable = false, /* Enable spread spectrum or not */ +}; + +const clock_video_pll_config_t videoPllConfig_BOARD_BootClockRUN = +{ + .loopDivider = 41, /* PLL Loop divider, valid range for DIV_SELECT divider value: 27 ~ 54. */ + .postDivider = 0, /* Divider after PLL, should only be 1, 2, 4, 8, 16, 32 */ + .numerator = 1, /* 30 bit numerator of fractional loop divider, Fout = Fin * ( loopDivider + numerator / denominator ) */ + .denominator = 960000, /* 30 bit denominator of fractional loop divider, Fout = Fin * ( loopDivider + numerator / denominator ) */ + .ss = NULL, /* Spread spectrum parameter */ + .ssEnable = false, /* Enable spread spectrum or not */ +}; + +/******************************************************************************* + * Code for BOARD_BootClockRUN configuration + ******************************************************************************/ +void clocks_init(void) { + clock_root_config_t rootCfg = {0}; + + /* Set DCDC to DCM mode to improve the efficiency for light loading in run mode and transient performance with a big loading step. */ + DCDC_BootIntoDCM(DCDC); + + #if !defined(SKIP_DCDC_ADJUSTMENT) || (!SKIP_DCDC_ADJUSTMENT) + if ((OCOTP->FUSEN[16].FUSE == 0x57AC5969U) && ((OCOTP->FUSEN[17].FUSE & 0xFFU) == 0x0BU)) { + DCDC_SetVDD1P0BuckModeTargetVoltage(DCDC, kDCDC_1P0BuckTarget1P15V); + } else { + /* Set 1.125V for production samples to align with data sheet requirement */ + DCDC_SetVDD1P0BuckModeTargetVoltage(DCDC, kDCDC_1P0BuckTarget1P125V); + } + #endif + + #if !defined(SKIP_FBB_ENABLE) || (!SKIP_FBB_ENABLE) + /* Check if FBB need to be enabled in OverDrive(OD) mode */ + if (((OCOTP->FUSEN[7].FUSE & 0x10U) >> 4U) != 1) { + PMU_EnableBodyBias(ANADIG_PMU, kPMU_FBB_CM7, true); + } else { + PMU_EnableBodyBias(ANADIG_PMU, kPMU_FBB_CM7, false); + } + #endif + + #if defined(BYPASS_LDO_LPSR) && BYPASS_LDO_LPSR + PMU_StaticEnableLpsrAnaLdoBypassMode(ANADIG_LDO_SNVS, true); + PMU_StaticEnableLpsrDigLdoBypassMode(ANADIG_LDO_SNVS, true); + #endif + + #if !defined(SKIP_LDO_ADJUSTMENT) || (!SKIP_LDO_ADJUSTMENT) + pmu_static_lpsr_ana_ldo_config_t lpsrAnaConfig; + pmu_static_lpsr_dig_config_t lpsrDigConfig; + + if ((ANADIG_LDO_SNVS->PMU_LDO_LPSR_ANA & ANADIG_LDO_SNVS_PMU_LDO_LPSR_ANA_BYPASS_MODE_EN_MASK) == 0UL) { + PMU_StaticGetLpsrAnaLdoDefaultConfig(&lpsrAnaConfig); + PMU_StaticLpsrAnaLdoInit(ANADIG_LDO_SNVS, &lpsrAnaConfig); + } + + if ((ANADIG_LDO_SNVS->PMU_LDO_LPSR_DIG & ANADIG_LDO_SNVS_PMU_LDO_LPSR_DIG_BYPASS_MODE_MASK) == 0UL) { + PMU_StaticGetLpsrDigLdoDefaultConfig(&lpsrDigConfig); + lpsrDigConfig.targetVoltage = kPMU_LpsrDigTargetStableVoltage1P117V; + PMU_StaticLpsrDigLdoInit(ANADIG_LDO_SNVS, &lpsrDigConfig); + } + #endif + + /* Config CLK_1M */ + CLOCK_OSC_Set1MHzOutputBehavior(kCLOCK_1MHzOutEnableFreeRunning1Mhz); + + /* Init OSC RC 16M */ + ANADIG_OSC->OSC_16M_CTRL |= ANADIG_OSC_OSC_16M_CTRL_EN_IRC4M16M_MASK; + + /* Init OSC RC 400M */ + CLOCK_OSC_EnableOscRc400M(); + CLOCK_OSC_GateOscRc400M(true); + + /* Init OSC RC 48M */ + CLOCK_OSC_EnableOsc48M(true); + CLOCK_OSC_EnableOsc48MDiv2(true); + + /* Config OSC 24M */ + ANADIG_OSC->OSC_24M_CTRL |= ANADIG_OSC_OSC_24M_CTRL_OSC_EN(1) | ANADIG_OSC_OSC_24M_CTRL_BYPASS_EN(0) | ANADIG_OSC_OSC_24M_CTRL_BYPASS_CLK(0) | ANADIG_OSC_OSC_24M_CTRL_LP_EN(1) | ANADIG_OSC_OSC_24M_CTRL_OSC_24M_GATE(0); + /* Wait for 24M OSC to be stable. */ + while (ANADIG_OSC_OSC_24M_CTRL_OSC_24M_STABLE_MASK != + (ANADIG_OSC->OSC_24M_CTRL & ANADIG_OSC_OSC_24M_CTRL_OSC_24M_STABLE_MASK)) { + } + + /* Switch both core, M7 Systick and Bus_Lpsr to OscRC48MDiv2 first */ + #if __CORTEX_M == 7 + rootCfg.mux = kCLOCK_M7_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_M7, &rootCfg); + + rootCfg.mux = kCLOCK_M7_SYSTICK_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_M7_Systick, &rootCfg); + #endif + + #if __CORTEX_M == 4 + rootCfg.mux = kCLOCK_M4_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_M4, &rootCfg); + + rootCfg.mux = kCLOCK_BUS_LPSR_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Bus_Lpsr, &rootCfg); + #endif + + /* + * if DCD is used, please make sure the clock source of SEMC is not changed in the following PLL/PFD configuration code. + */ + /* Init Arm Pll. */ + CLOCK_InitArmPll(&armPllConfig_BOARD_BootClockRUN); + + /* Bypass Sys Pll1. */ + CLOCK_SetPllBypass(kCLOCK_PllSys1, true); + + /* DeInit Sys Pll1. */ + CLOCK_DeinitSysPll1(); + + /* Init Sys Pll2. */ + CLOCK_InitSysPll2(&sysPll2Config_BOARD_BootClockRUN); + + /* Init System Pll2 pfd0. */ + CLOCK_InitPfd(kCLOCK_PllSys2, kCLOCK_Pfd0, 27); + + /* Init System Pll2 pfd1. */ + CLOCK_InitPfd(kCLOCK_PllSys2, kCLOCK_Pfd1, 16); + + /* Init System Pll2 pfd2. */ + CLOCK_InitPfd(kCLOCK_PllSys2, kCLOCK_Pfd2, 24); + + /* Init System Pll2 pfd3. */ + CLOCK_InitPfd(kCLOCK_PllSys2, kCLOCK_Pfd3, 32); + + /* Init Sys Pll3. */ + CLOCK_InitSysPll3(); + + /* Init System Pll3 pfd0. */ + CLOCK_InitPfd(kCLOCK_PllSys3, kCLOCK_Pfd0, 13); + + /* Init System Pll3 pfd1. */ + CLOCK_InitPfd(kCLOCK_PllSys3, kCLOCK_Pfd1, 17); + + /* Init System Pll3 pfd2. */ + CLOCK_InitPfd(kCLOCK_PllSys3, kCLOCK_Pfd2, 32); + + /* Init System Pll3 pfd3. */ + CLOCK_InitPfd(kCLOCK_PllSys3, kCLOCK_Pfd3, 22); + + /* Bypass Audio Pll. */ + CLOCK_SetPllBypass(kCLOCK_PllAudio, true); + + /* DeInit Audio Pll. */ + CLOCK_DeinitAudioPll(); + + /* Init Video Pll. */ + CLOCK_InitVideoPll(&videoPllConfig_BOARD_BootClockRUN); + + /* Module clock root configurations. */ + /* Configure M7 using ARM_PLL_CLK */ + #if __CORTEX_M == 7 + rootCfg.mux = kCLOCK_M7_ClockRoot_MuxArmPllOut; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_M7, &rootCfg); + #endif + + /* Configure M4 using SYS_PLL3_PFD3_CLK */ + #if __CORTEX_M == 4 + rootCfg.mux = kCLOCK_M4_ClockRoot_MuxSysPll3Pfd3; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_M4, &rootCfg); + #endif + + /* Configure BUS using SYS_PLL3_CLK */ + rootCfg.mux = kCLOCK_BUS_ClockRoot_MuxSysPll3Out; + rootCfg.div = 2; + CLOCK_SetRootClock(kCLOCK_Root_Bus, &rootCfg); + + /* Configure BUS_LPSR using SYS_PLL3_CLK */ + rootCfg.mux = kCLOCK_BUS_LPSR_ClockRoot_MuxSysPll3Out; + rootCfg.div = 3; + CLOCK_SetRootClock(kCLOCK_Root_Bus_Lpsr, &rootCfg); + + /* Configure SEMC using SYS_PLL2_PFD1_CLK */ + #ifndef SKIP_SEMC_INIT + rootCfg.mux = kCLOCK_SEMC_ClockRoot_MuxSysPll2Pfd1; + rootCfg.div = 3; + CLOCK_SetRootClock(kCLOCK_Root_Semc, &rootCfg); + #endif + + #if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1) + #if defined(XIP_BOOT_HEADER_DCD_ENABLE) && (XIP_BOOT_HEADER_DCD_ENABLE == 1) + UpdateSemcClock(); + #endif + #endif + + /* Configure CSSYS using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_CSSYS_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Cssys, &rootCfg); + + /* Configure CSTRACE using SYS_PLL2_CLK */ + rootCfg.mux = kCLOCK_CSTRACE_ClockRoot_MuxSysPll2Out; + rootCfg.div = 4; + CLOCK_SetRootClock(kCLOCK_Root_Cstrace, &rootCfg); + + /* Configure M4_SYSTICK using OSC_RC_48M_DIV2 */ + #if __CORTEX_M == 4 + rootCfg.mux = kCLOCK_M4_SYSTICK_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_M4_Systick, &rootCfg); + #endif + + /* Configure M7_SYSTICK using OSC_RC_48M_DIV2 */ + #if __CORTEX_M == 7 + rootCfg.mux = kCLOCK_M7_SYSTICK_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 240; + CLOCK_SetRootClock(kCLOCK_Root_M7_Systick, &rootCfg); + #endif + + /* Configure ADC1 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_ADC1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Adc1, &rootCfg); + + /* Configure ADC2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_ADC2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Adc2, &rootCfg); + + /* Configure ACMP using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_ACMP_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Acmp, &rootCfg); + + /* Configure FLEXIO1 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_FLEXIO1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Flexio1, &rootCfg); + + /* Configure FLEXIO2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_FLEXIO2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Flexio2, &rootCfg); + + /* Configure GPT1 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_GPT1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Gpt1, &rootCfg); + + /* Configure GPT2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_GPT2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Gpt2, &rootCfg); + + /* Configure GPT3 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_GPT3_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Gpt3, &rootCfg); + + /* Configure GPT4 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_GPT4_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Gpt4, &rootCfg); + + /* Configure GPT5 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_GPT5_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Gpt5, &rootCfg); + + /* Configure GPT6 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_GPT6_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Gpt6, &rootCfg); + + /* Configure FLEXSPI1 using OSC_RC_48M_DIV2 */ + #if !(defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1) || defined(FLEXSPI_IN_USE)) + rootCfg.mux = kCLOCK_FLEXSPI1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Flexspi1, &rootCfg); + #endif + + /* Configure FLEXSPI2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_FLEXSPI2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Flexspi2, &rootCfg); + + /* Configure CAN1 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_CAN1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Can1, &rootCfg); + + /* Configure CAN2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_CAN2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Can2, &rootCfg); + + /* Configure CAN3 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_CAN3_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Can3, &rootCfg); + + /* Configure LPUART1 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPUART1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpuart1, &rootCfg); + + /* Configure LPUART2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPUART2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpuart2, &rootCfg); + + /* Configure LPUART3 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPUART3_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpuart3, &rootCfg); + + /* Configure LPUART4 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPUART4_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpuart4, &rootCfg); + + /* Configure LPUART5 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPUART5_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpuart5, &rootCfg); + + /* Configure LPUART6 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPUART6_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpuart6, &rootCfg); + + /* Configure LPUART7 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPUART7_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpuart7, &rootCfg); + + /* Configure LPUART8 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPUART8_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpuart8, &rootCfg); + + /* Configure LPUART9 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPUART9_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpuart9, &rootCfg); + + /* Configure LPUART10 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPUART10_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpuart10, &rootCfg); + + /* Configure LPUART11 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPUART11_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpuart11, &rootCfg); + + /* Configure LPUART12 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPUART12_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpuart12, &rootCfg); + + /* Configure LPI2C1 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPI2C1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpi2c1, &rootCfg); + + /* Configure LPI2C2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPI2C2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpi2c2, &rootCfg); + + /* Configure LPI2C3 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPI2C3_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpi2c3, &rootCfg); + + /* Configure LPI2C4 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPI2C4_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpi2c4, &rootCfg); + + /* Configure LPI2C5 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPI2C5_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpi2c5, &rootCfg); + + /* Configure LPI2C6 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPI2C6_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpi2c6, &rootCfg); + + /* Configure LPSPI1 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPSPI1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpspi1, &rootCfg); + + /* Configure LPSPI2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPSPI2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpspi2, &rootCfg); + + /* Configure LPSPI3 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPSPI3_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpspi3, &rootCfg); + + /* Configure LPSPI4 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPSPI4_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpspi4, &rootCfg); + + /* Configure LPSPI5 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPSPI5_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpspi5, &rootCfg); + + /* Configure LPSPI6 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LPSPI6_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lpspi6, &rootCfg); + + /* Configure EMV1 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_EMV1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Emv1, &rootCfg); + + /* Configure EMV2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_EMV2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Emv2, &rootCfg); + + /* Configure ENET1 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_ENET1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Enet1, &rootCfg); + + /* Configure ENET2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_ENET2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Enet2, &rootCfg); + + /* Configure ENET_QOS using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_ENET_QOS_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Enet_Qos, &rootCfg); + + /* Configure ENET_25M using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_ENET_25M_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Enet_25m, &rootCfg); + + /* Configure ENET_TIMER1 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_ENET_TIMER1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Enet_Timer1, &rootCfg); + + /* Configure ENET_TIMER2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_ENET_TIMER2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Enet_Timer2, &rootCfg); + + /* Configure ENET_TIMER3 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_ENET_TIMER3_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Enet_Timer3, &rootCfg); + + /* Configure USDHC1 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_USDHC1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Usdhc1, &rootCfg); + + /* Configure USDHC2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_USDHC2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Usdhc2, &rootCfg); + + /* Configure ASRC using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_ASRC_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Asrc, &rootCfg); + + /* Configure MQS using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_MQS_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Mqs, &rootCfg); + + /* Configure MIC using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_MIC_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Mic, &rootCfg); + + /* Configure SPDIF using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_SPDIF_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Spdif, &rootCfg); + + /* Configure SAI1 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_SAI1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Sai1, &rootCfg); + + /* Configure SAI2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_SAI2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Sai2, &rootCfg); + + /* Configure SAI3 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_SAI3_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Sai3, &rootCfg); + + /* Configure SAI4 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_SAI4_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Sai4, &rootCfg); + + /* Configure GC355 using PLL_VIDEO_CLK */ + rootCfg.mux = kCLOCK_GC355_ClockRoot_MuxVideoPllOut; + rootCfg.div = 2; + CLOCK_SetRootClock(kCLOCK_Root_Gc355, &rootCfg); + + /* Configure LCDIF using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LCDIF_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lcdif, &rootCfg); + + /* Configure LCDIFV2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_LCDIFV2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Lcdifv2, &rootCfg); + + /* Configure MIPI_REF using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_MIPI_REF_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Mipi_Ref, &rootCfg); + + /* Configure MIPI_ESC using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_MIPI_ESC_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Mipi_Esc, &rootCfg); + + /* Configure CSI2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_CSI2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Csi2, &rootCfg); + + /* Configure CSI2_ESC using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_CSI2_ESC_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Csi2_Esc, &rootCfg); + + /* Configure CSI2_UI using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_CSI2_UI_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Csi2_Ui, &rootCfg); + + /* Configure CSI using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_CSI_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Csi, &rootCfg); + + /* Configure CKO1 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_CKO1_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Cko1, &rootCfg); + + /* Configure CKO2 using OSC_RC_48M_DIV2 */ + rootCfg.mux = kCLOCK_CKO2_ClockRoot_MuxOscRc48MDiv2; + rootCfg.div = 1; + CLOCK_SetRootClock(kCLOCK_Root_Cko2, &rootCfg); + + /* Set SAI1 MCLK1 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk1Sel, 0); + /* Set SAI1 MCLK2 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk2Sel, 3); + /* Set SAI1 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI1MClk3Sel, 0); + /* Set SAI2 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI2MClk3Sel, 0); + /* Set SAI3 MCLK3 clock source. */ + IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI3MClk3Sel, 0); + + /* Set MQS configuration. */ + IOMUXC_MQSConfig(IOMUXC_GPR,kIOMUXC_MqsPwmOverSampleRate32, 0); + /* Set ENET Ref clock source. */ + IOMUXC_GPR->GPR4 &= ~IOMUXC_GPR_GPR4_ENET_REF_CLK_DIR_MASK; + /* Set ENET_1G Tx clock source. */ + IOMUXC_GPR->GPR5 = ((IOMUXC_GPR->GPR5 & ~IOMUXC_GPR_GPR5_ENET1G_TX_CLK_SEL_MASK) | IOMUXC_GPR_GPR5_ENET1G_RGMII_EN_MASK); + /* Set ENET_1G Ref clock source. */ + IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_ENET1G_REF_CLK_DIR_MASK; + /* Set ENET_QOS Tx clock source. */ + IOMUXC_GPR->GPR6 &= ~IOMUXC_GPR_GPR6_ENET_QOS_RGMII_EN_MASK; + /* Set ENET_QOS Ref clock source. */ + IOMUXC_GPR->GPR6 &= ~IOMUXC_GPR_GPR6_ENET_QOS_REF_CLK_DIR_MASK; + /* Set GPT1 High frequency reference clock source. */ + IOMUXC_GPR->GPR22 &= ~IOMUXC_GPR_GPR22_REF_1M_CLK_GPT1_MASK; + /* Set GPT2 High frequency reference clock source. */ + IOMUXC_GPR->GPR23 &= ~IOMUXC_GPR_GPR23_REF_1M_CLK_GPT2_MASK; + /* Set GPT3 High frequency reference clock source. */ + IOMUXC_GPR->GPR24 &= ~IOMUXC_GPR_GPR24_REF_1M_CLK_GPT3_MASK; + /* Set GPT4 High frequency reference clock source. */ + IOMUXC_GPR->GPR25 &= ~IOMUXC_GPR_GPR25_REF_1M_CLK_GPT4_MASK; + /* Set GPT5 High frequency reference clock source. */ + IOMUXC_GPR->GPR26 &= ~IOMUXC_GPR_GPR26_REF_1M_CLK_GPT5_MASK; + /* Set GPT6 High frequency reference clock source. */ + IOMUXC_GPR->GPR27 &= ~IOMUXC_GPR_GPR27_REF_1M_CLK_GPT6_MASK; + + #if __CORTEX_M == 7 + SystemCoreClock = CLOCK_GetRootClockFreq(kCLOCK_Root_M7); + #else + SystemCoreClock = CLOCK_GetRootClockFreq(kCLOCK_Root_M4); + #endif +} diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.c new file mode 100644 index 0000000000..3263bdea09 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.c @@ -0,0 +1,358 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 "py/obj.h" +#include "py/mphal.h" +#include "mimxrt10xx/periph.h" + +LPI2C_Type *const mcu_i2c_banks[6] = { LPI2C1, LPI2C2, LPI2C3, LPI2C4, LPI2C5, LPI2C6 }; + +const mcu_periph_obj_t mcu_i2c_sda_list[8] = { + PERIPH_PIN(1, 1, 0, 0, &pin_GPIO_AD_09), + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_33), + + PERIPH_PIN(2, 9, 0, 0, &pin_GPIO_EMC_B2_01), + PERIPH_PIN(2, 9, 0, 0, &pin_GPIO_AD_19), + + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_DISP_B1_03), + PERIPH_PIN(3, 6, 0, 0, &pin_GPIO_DISP_B2_11), + + PERIPH_PIN(4, 9, 0, 0, &pin_GPIO_AD_25), + PERIPH_PIN(4, 6, 0, 0, &pin_GPIO_DISP_B2_13), +}; + +const mcu_periph_obj_t mcu_i2c_scl_list[8] = { + PERIPH_PIN(1, 1, 0, 0, &pin_GPIO_AD_08), + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_32), + + PERIPH_PIN(2, 9, 0, 0, &pin_GPIO_EMC_B2_00), + PERIPH_PIN(2, 9, 0, 0, &pin_GPIO_AD_18), + + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_DISP_B1_02), + PERIPH_PIN(3, 6, 0, 0, &pin_GPIO_DISP_B2_10), + + PERIPH_PIN(4, 9, 0, 0, &pin_GPIO_AD_24), + PERIPH_PIN(4, 6, 0, 0, &pin_GPIO_DISP_B2_12), +}; + +LPSPI_Type *const mcu_spi_banks[6] = { LPSPI1, LPSPI2, LPSPI3, LPSPI4, LPSPI5, LPSPI6 }; + +const mcu_periph_obj_t mcu_spi_sck_list[8] = { + PERIPH_PIN(1, 8, 0, 0, &pin_GPIO_EMC_B2_00), + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_28), + + PERIPH_PIN(2, 1, 0, 0, &pin_GPIO_AD_24), + PERIPH_PIN(2, 6, 0, 0, &pin_GPIO_SD_B2_07), + + PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_EMC_B2_04), + PERIPH_PIN(3, 9, 0, 0, &pin_GPIO_DISP_B1_04), + + PERIPH_PIN(4, 4, 0, 0, &pin_GPIO_SD_B2_00), + PERIPH_PIN(4, 9, 0, 0, &pin_GPIO_DISP_B2_12), +}; + +const mcu_periph_obj_t mcu_spi_sdo_list[0] = { +}; + +const mcu_periph_obj_t mcu_spi_sdi_list[0] = { +}; + +LPUART_Type *const mcu_uart_banks[12] = { LPUART1, LPUART2, LPUART3, LPUART4, LPUART5, LPUART6, LPUART7, LPUART8, LPUART9, LPUART10, LPUART11, LPUART12 }; + +const mcu_periph_obj_t mcu_uart_rx_list[15] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_25), + PERIPH_PIN(1, 9, 0, 0, &pin_GPIO_DISP_B1_03), + PERIPH_PIN(1, 9, 0, 0, &pin_GPIO_DISP_B2_09), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_DISP_B2_11), + + PERIPH_PIN(3, 4, 0, 0, &pin_GPIO_AD_31), + + PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_DISP_B1_04), + + PERIPH_PIN(5, 1, 0, 0, &pin_GPIO_AD_29), + + PERIPH_PIN(6, 3, 0, 0, &pin_GPIO_EMC_B1_41), + + PERIPH_PIN(7, 6, 0, 0, &pin_GPIO_AD_01), + PERIPH_PIN(7, 2, 0, 0, &pin_GPIO_DISP_B2_07), + + PERIPH_PIN(8, 6, 0, 0, &pin_GPIO_AD_03), + PERIPH_PIN(8, 2, 0, 0, &pin_GPIO_DISP_B2_09), + + PERIPH_PIN(9, 3, 0, 0, &pin_GPIO_SD_B2_01), + + PERIPH_PIN(10, 1, 0, 0, &pin_GPIO_AD_16), + PERIPH_PIN(10, 8, 0, 0, &pin_GPIO_AD_33), +}; + +const mcu_periph_obj_t mcu_uart_tx_list[15] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_24), + PERIPH_PIN(1, 9, 0, 0, &pin_GPIO_DISP_B1_02), + PERIPH_PIN(1, 9, 0, 0, &pin_GPIO_DISP_B2_08), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_DISP_B2_10), + + PERIPH_PIN(3, 4, 0, 0, &pin_GPIO_AD_30), + + PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_DISP_B1_06), + + PERIPH_PIN(5, 1, 0, 0, &pin_GPIO_AD_28), + + PERIPH_PIN(6, 3, 0, 0, &pin_GPIO_EMC_B1_40), + + PERIPH_PIN(7, 6, 0, 0, &pin_GPIO_AD_00), + PERIPH_PIN(7, 2, 0, 0, &pin_GPIO_DISP_B2_06), + + PERIPH_PIN(8, 6, 0, 0, &pin_GPIO_AD_02), + PERIPH_PIN(8, 2, 0, 0, &pin_GPIO_DISP_B2_08), + + PERIPH_PIN(9, 3, 0, 0, &pin_GPIO_SD_B2_00), + + PERIPH_PIN(10, 1, 0, 0, &pin_GPIO_AD_15), + PERIPH_PIN(10, 8, 0, 0, &pin_GPIO_AD_32), +}; + +const mcu_periph_obj_t mcu_uart_rts_list[10] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_27), + + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_DISP_B2_13), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B2_08), + + PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_DISP_B1_07), + + PERIPH_PIN(5, 3, 0, 0, &pin_GPIO_SD_B2_10), + + PERIPH_PIN(6, 3, 0, 0, &pin_GPIO_EMC_B2_01), + + PERIPH_PIN(7, 1, 0, 0, &pin_GPIO_AD_03), + + PERIPH_PIN(8, 1, 0, 0, &pin_GPIO_AD_05), + + PERIPH_PIN(9, 3, 0, 0, &pin_GPIO_SD_B2_03), + + PERIPH_PIN(10, 8, 0, 0, &pin_GPIO_AD_35), +}; + +const mcu_periph_obj_t mcu_uart_cts_list[10] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_26), + + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_DISP_B2_12), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B2_07), + + PERIPH_PIN(4, 2, 0, 0, &pin_GPIO_DISP_B1_05), + + PERIPH_PIN(5, 3, 0, 0, &pin_GPIO_SD_B2_09), + + PERIPH_PIN(6, 3, 0, 0, &pin_GPIO_EMC_B2_00), + + PERIPH_PIN(7, 1, 0, 0, &pin_GPIO_AD_02), + + PERIPH_PIN(8, 1, 0, 0, &pin_GPIO_AD_04), + + PERIPH_PIN(9, 3, 0, 0, &pin_GPIO_SD_B2_02), + + PERIPH_PIN(10, 8, 0, 0, &pin_GPIO_AD_34), +}; + +I2S_Type *const mcu_i2s_banks[4] = { SAI1, SAI2, SAI3, SAI4 }; + +const mcu_periph_obj_t mcu_i2s_rx_data0_list[4] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_20), + PERIPH_PIN(1, 4, 0, 0, &pin_GPIO_DISP_B2_06), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_B2_07), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_B2_13), +}; + +const mcu_periph_obj_t mcu_i2s_rx_sync_list[4] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_18), + PERIPH_PIN(1, 4, 0, 0, &pin_GPIO_DISP_B2_04), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_B2_05), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_B2_11), +}; + +const mcu_periph_obj_t mcu_i2s_tx_bclk_list[4] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_22), + PERIPH_PIN(1, 4, 0, 0, &pin_GPIO_DISP_B2_08), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_B2_09), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_B2_15), +}; + +const mcu_periph_obj_t mcu_i2s_tx_data0_list[4] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_21), + PERIPH_PIN(1, 4, 0, 0, &pin_GPIO_DISP_B2_07), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_B2_08), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_B2_14), +}; + +const mcu_periph_obj_t mcu_i2s_tx_sync_list[4] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_23), + PERIPH_PIN(1, 4, 0, 0, &pin_GPIO_DISP_B2_09), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_B2_10), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_B2_16), +}; + +const mcu_periph_obj_t mcu_mqs_left_list[2] = { + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_B1_41), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_DISP_B2_01), +}; + +const mcu_periph_obj_t mcu_mqs_right_list[2] = { + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_B1_40), + PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_DISP_B2_00), +}; + +const mcu_pwm_obj_t mcu_pwm_list[68] = { + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_23_FLEXPWM1_PWM0_A, &pin_GPIO_EMC_B1_23), + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_AD_00_FLEXPWM1_PWM0_A, &pin_GPIO_AD_00), + + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_24_FLEXPWM1_PWM0_B, &pin_GPIO_EMC_B1_24), + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_AD_01_FLEXPWM1_PWM0_B, &pin_GPIO_AD_01), + + PWM_PIN(PWM1, kPWM_Module_0, kPWM_PwmX, IOMUXC_GPIO_AD_06_FLEXPWM1_PWM0_X, &pin_GPIO_AD_06), + + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_25_FLEXPWM1_PWM1_A, &pin_GPIO_EMC_B1_25), + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_AD_02_FLEXPWM1_PWM1_A, &pin_GPIO_AD_02), + + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_26_FLEXPWM1_PWM1_B, &pin_GPIO_EMC_B1_26), + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_AD_03_FLEXPWM1_PWM1_B, &pin_GPIO_AD_03), + + PWM_PIN(PWM1, kPWM_Module_1, kPWM_PwmX, IOMUXC_GPIO_AD_07_FLEXPWM1_PWM1_X, &pin_GPIO_AD_07), + + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_27_FLEXPWM1_PWM2_A, &pin_GPIO_EMC_B1_27), + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_AD_04_FLEXPWM1_PWM2_A, &pin_GPIO_AD_04), + + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_28_FLEXPWM1_PWM2_B, &pin_GPIO_EMC_B1_28), + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_AD_05_FLEXPWM1_PWM2_B, &pin_GPIO_AD_05), + + PWM_PIN(PWM1, kPWM_Module_2, kPWM_PwmX, IOMUXC_GPIO_AD_08_FLEXPWM1_PWM2_X, &pin_GPIO_AD_08), + + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_38_FLEXPWM1_PWM3_A, &pin_GPIO_EMC_B1_38), + + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_39_FLEXPWM1_PWM3_B, &pin_GPIO_EMC_B1_39), + + PWM_PIN(PWM1, kPWM_Module_3, kPWM_PwmX, IOMUXC_GPIO_AD_09_FLEXPWM1_PWM3_X, &pin_GPIO_AD_09), + + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_06_FLEXPWM2_PWM0_A, &pin_GPIO_EMC_B1_06), + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_AD_24_FLEXPWM2_PWM0_A, &pin_GPIO_AD_24), + + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_07_FLEXPWM2_PWM0_B, &pin_GPIO_EMC_B1_07), + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_AD_25_FLEXPWM2_PWM0_B, &pin_GPIO_AD_25), + + PWM_PIN(PWM2, kPWM_Module_0, kPWM_PwmX, IOMUXC_GPIO_AD_10_FLEXPWM2_PWM0_X, &pin_GPIO_AD_10), + + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_08_FLEXPWM2_PWM1_A, &pin_GPIO_EMC_B1_08), + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_AD_26_FLEXPWM2_PWM1_A, &pin_GPIO_AD_26), + + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_09_FLEXPWM2_PWM1_B, &pin_GPIO_EMC_B1_09), + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_AD_27_FLEXPWM2_PWM1_B, &pin_GPIO_AD_27), + + PWM_PIN(PWM2, kPWM_Module_1, kPWM_PwmX, IOMUXC_GPIO_AD_11_FLEXPWM2_PWM1_X, &pin_GPIO_AD_11), + + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_10_FLEXPWM2_PWM2_A, &pin_GPIO_EMC_B1_10), + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_AD_28_FLEXPWM2_PWM2_A, &pin_GPIO_AD_28), + + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_11_FLEXPWM2_PWM2_B, &pin_GPIO_EMC_B1_11), + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_AD_29_FLEXPWM2_PWM2_B, &pin_GPIO_AD_29), + + PWM_PIN(PWM2, kPWM_Module_2, kPWM_PwmX, IOMUXC_GPIO_AD_12_FLEXPWM2_PWM2_X, &pin_GPIO_AD_12), + + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_19_FLEXPWM2_PWM3_A, &pin_GPIO_EMC_B1_19), + + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_20_FLEXPWM2_PWM3_B, &pin_GPIO_EMC_B1_20), + + PWM_PIN(PWM2, kPWM_Module_3, kPWM_PwmX, IOMUXC_GPIO_AD_13_FLEXPWM2_PWM3_X, &pin_GPIO_AD_13), + + PWM_PIN(PWM3, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_29_FLEXPWM3_PWM0_A, &pin_GPIO_EMC_B1_29), + PWM_PIN(PWM3, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_B2_00_FLEXPWM3_PWM0_A, &pin_GPIO_EMC_B2_00), + + PWM_PIN(PWM3, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_30_FLEXPWM3_PWM0_B, &pin_GPIO_EMC_B1_30), + PWM_PIN(PWM3, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_B2_01_FLEXPWM3_PWM0_B, &pin_GPIO_EMC_B2_01), + + PWM_PIN(PWM3, kPWM_Module_0, kPWM_PwmX, IOMUXC_GPIO_AD_14_FLEXPWM3_PWM0_X, &pin_GPIO_AD_14), + + PWM_PIN(PWM3, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_31_FLEXPWM3_PWM1_A, &pin_GPIO_EMC_B1_31), + PWM_PIN(PWM3, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_B2_02_FLEXPWM3_PWM1_A, &pin_GPIO_EMC_B2_02), + + PWM_PIN(PWM3, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_32_FLEXPWM3_PWM1_B, &pin_GPIO_EMC_B1_32), + PWM_PIN(PWM3, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_B2_03_FLEXPWM3_PWM1_B, &pin_GPIO_EMC_B2_03), + + PWM_PIN(PWM3, kPWM_Module_1, kPWM_PwmX, IOMUXC_GPIO_AD_15_FLEXPWM3_PWM1_X, &pin_GPIO_AD_15), + + PWM_PIN(PWM3, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_33_FLEXPWM3_PWM2_A, &pin_GPIO_EMC_B1_33), + PWM_PIN(PWM3, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_B2_04_FLEXPWM3_PWM2_A, &pin_GPIO_EMC_B2_04), + + PWM_PIN(PWM3, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_34_FLEXPWM3_PWM2_B, &pin_GPIO_EMC_B1_34), + PWM_PIN(PWM3, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_B2_05_FLEXPWM3_PWM2_B, &pin_GPIO_EMC_B2_05), + + PWM_PIN(PWM3, kPWM_Module_2, kPWM_PwmX, IOMUXC_GPIO_AD_16_FLEXPWM3_PWM2_X, &pin_GPIO_AD_16), + + PWM_PIN(PWM3, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_21_FLEXPWM3_PWM3_A, &pin_GPIO_EMC_B1_21), + PWM_PIN(PWM3, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_B2_06_FLEXPWM3_PWM3_A, &pin_GPIO_EMC_B2_06), + + PWM_PIN(PWM3, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_22_FLEXPWM3_PWM3_B, &pin_GPIO_EMC_B1_22), + PWM_PIN(PWM3, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_B2_07_FLEXPWM3_PWM3_B, &pin_GPIO_EMC_B2_07), + + PWM_PIN(PWM3, kPWM_Module_3, kPWM_PwmX, IOMUXC_GPIO_AD_17_FLEXPWM3_PWM3_X, &pin_GPIO_AD_17), + + PWM_PIN(PWM4, kPWM_Module_0, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_00_FLEXPWM4_PWM0_A, &pin_GPIO_EMC_B1_00), + + PWM_PIN(PWM4, kPWM_Module_0, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_01_FLEXPWM4_PWM0_B, &pin_GPIO_EMC_B1_01), + + PWM_PIN(PWM4, kPWM_Module_0, kPWM_PwmX, IOMUXC_GPIO_AD_18_FLEXPWM4_PWM0_X, &pin_GPIO_AD_18), + + PWM_PIN(PWM4, kPWM_Module_1, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_02_FLEXPWM4_PWM1_A, &pin_GPIO_EMC_B1_02), + + PWM_PIN(PWM4, kPWM_Module_1, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_03_FLEXPWM4_PWM1_B, &pin_GPIO_EMC_B1_03), + + PWM_PIN(PWM4, kPWM_Module_1, kPWM_PwmX, IOMUXC_GPIO_AD_19_FLEXPWM4_PWM1_X, &pin_GPIO_AD_19), + + PWM_PIN(PWM4, kPWM_Module_2, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_04_FLEXPWM4_PWM2_A, &pin_GPIO_EMC_B1_04), + + PWM_PIN(PWM4, kPWM_Module_2, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_05_FLEXPWM4_PWM2_B, &pin_GPIO_EMC_B1_05), + + PWM_PIN(PWM4, kPWM_Module_2, kPWM_PwmX, IOMUXC_GPIO_AD_20_FLEXPWM4_PWM2_X, &pin_GPIO_AD_20), + + PWM_PIN(PWM4, kPWM_Module_3, kPWM_PwmA, IOMUXC_GPIO_EMC_B1_17_FLEXPWM4_PWM3_A, &pin_GPIO_EMC_B1_17), + + PWM_PIN(PWM4, kPWM_Module_3, kPWM_PwmB, IOMUXC_GPIO_EMC_B1_18_FLEXPWM4_PWM3_B, &pin_GPIO_EMC_B1_18), + + PWM_PIN(PWM4, kPWM_Module_3, kPWM_PwmX, IOMUXC_GPIO_AD_21_FLEXPWM4_PWM3_X, &pin_GPIO_AD_21), +}; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.h new file mode 100644 index 0000000000..41695d655b --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.h @@ -0,0 +1,55 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + +#pragma once +extern LPI2C_Type *const mcu_i2c_banks[6]; +extern const mcu_periph_obj_t mcu_i2c_sda_list[8]; +extern const mcu_periph_obj_t mcu_i2c_scl_list[8]; + +extern LPSPI_Type *const mcu_spi_banks[6]; +extern const mcu_periph_obj_t mcu_spi_sck_list[8]; +extern const mcu_periph_obj_t mcu_spi_sdo_list[0]; +extern const mcu_periph_obj_t mcu_spi_sdi_list[0]; + +extern LPUART_Type *const mcu_uart_banks[12]; +extern const mcu_periph_obj_t mcu_uart_rx_list[15]; +extern const mcu_periph_obj_t mcu_uart_tx_list[15]; +extern const mcu_periph_obj_t mcu_uart_rts_list[10]; +extern const mcu_periph_obj_t mcu_uart_cts_list[10]; + +extern I2S_Type *const mcu_i2s_banks[4]; +extern const mcu_periph_obj_t mcu_i2s_rx_data0_list[4]; +extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[4]; +extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[4]; +extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[4]; +extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[4]; + +extern const mcu_periph_obj_t mcu_mqs_left_list[2]; +extern const mcu_periph_obj_t mcu_mqs_right_list[2]; + +extern const mcu_pwm_obj_t mcu_pwm_list[68]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pin_names.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pin_names.h new file mode 100644 index 0000000000..6dcd77a6a2 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pin_names.h @@ -0,0 +1,182 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + + +// define FORMAT_PIN(pin_name) and then include this file. + +FORMAT_PIN(GPIO_EMC_B1_00) +FORMAT_PIN(GPIO_EMC_B1_01) +FORMAT_PIN(GPIO_EMC_B1_02) +FORMAT_PIN(GPIO_EMC_B1_03) +FORMAT_PIN(GPIO_EMC_B1_04) +FORMAT_PIN(GPIO_EMC_B1_05) +FORMAT_PIN(GPIO_EMC_B1_06) +FORMAT_PIN(GPIO_EMC_B1_07) +FORMAT_PIN(GPIO_EMC_B1_08) +FORMAT_PIN(GPIO_EMC_B1_09) +FORMAT_PIN(GPIO_EMC_B1_10) +FORMAT_PIN(GPIO_EMC_B1_11) +FORMAT_PIN(GPIO_EMC_B1_12) +FORMAT_PIN(GPIO_EMC_B1_13) +FORMAT_PIN(GPIO_EMC_B1_14) +FORMAT_PIN(GPIO_EMC_B1_15) +FORMAT_PIN(GPIO_EMC_B1_16) +FORMAT_PIN(GPIO_EMC_B1_17) +FORMAT_PIN(GPIO_EMC_B1_18) +FORMAT_PIN(GPIO_EMC_B1_19) +FORMAT_PIN(GPIO_EMC_B1_20) +FORMAT_PIN(GPIO_EMC_B1_21) +FORMAT_PIN(GPIO_EMC_B1_22) +FORMAT_PIN(GPIO_EMC_B1_23) +FORMAT_PIN(GPIO_EMC_B1_24) +FORMAT_PIN(GPIO_EMC_B1_25) +FORMAT_PIN(GPIO_EMC_B1_26) +FORMAT_PIN(GPIO_EMC_B1_27) +FORMAT_PIN(GPIO_EMC_B1_28) +FORMAT_PIN(GPIO_EMC_B1_29) +FORMAT_PIN(GPIO_EMC_B1_30) +FORMAT_PIN(GPIO_EMC_B1_31) +FORMAT_PIN(GPIO_EMC_B1_32) +FORMAT_PIN(GPIO_EMC_B1_33) +FORMAT_PIN(GPIO_EMC_B1_34) +FORMAT_PIN(GPIO_EMC_B1_35) +FORMAT_PIN(GPIO_EMC_B1_36) +FORMAT_PIN(GPIO_EMC_B1_37) +FORMAT_PIN(GPIO_EMC_B1_38) +FORMAT_PIN(GPIO_EMC_B1_39) +FORMAT_PIN(GPIO_EMC_B1_40) +FORMAT_PIN(GPIO_EMC_B1_41) + +FORMAT_PIN(GPIO_EMC_B2_00) +FORMAT_PIN(GPIO_EMC_B2_01) +FORMAT_PIN(GPIO_EMC_B2_02) +FORMAT_PIN(GPIO_EMC_B2_03) +FORMAT_PIN(GPIO_EMC_B2_04) +FORMAT_PIN(GPIO_EMC_B2_05) +FORMAT_PIN(GPIO_EMC_B2_06) +FORMAT_PIN(GPIO_EMC_B2_07) +FORMAT_PIN(GPIO_EMC_B2_08) +FORMAT_PIN(GPIO_EMC_B2_09) +FORMAT_PIN(GPIO_EMC_B2_10) +FORMAT_PIN(GPIO_EMC_B2_11) +FORMAT_PIN(GPIO_EMC_B2_12) +FORMAT_PIN(GPIO_EMC_B2_13) +FORMAT_PIN(GPIO_EMC_B2_14) +FORMAT_PIN(GPIO_EMC_B2_15) +FORMAT_PIN(GPIO_EMC_B2_16) +FORMAT_PIN(GPIO_EMC_B2_17) +FORMAT_PIN(GPIO_EMC_B2_18) +FORMAT_PIN(GPIO_EMC_B2_19) +FORMAT_PIN(GPIO_EMC_B2_20) + +FORMAT_PIN(GPIO_AD_00) +FORMAT_PIN(GPIO_AD_01) +FORMAT_PIN(GPIO_AD_02) +FORMAT_PIN(GPIO_AD_03) +FORMAT_PIN(GPIO_AD_04) +FORMAT_PIN(GPIO_AD_05) +FORMAT_PIN(GPIO_AD_06) +FORMAT_PIN(GPIO_AD_07) +FORMAT_PIN(GPIO_AD_08) +FORMAT_PIN(GPIO_AD_09) +FORMAT_PIN(GPIO_AD_10) +FORMAT_PIN(GPIO_AD_11) +FORMAT_PIN(GPIO_AD_12) +FORMAT_PIN(GPIO_AD_13) +FORMAT_PIN(GPIO_AD_14) +FORMAT_PIN(GPIO_AD_15) +FORMAT_PIN(GPIO_AD_16) +FORMAT_PIN(GPIO_AD_17) +FORMAT_PIN(GPIO_AD_18) +FORMAT_PIN(GPIO_AD_19) +FORMAT_PIN(GPIO_AD_20) +FORMAT_PIN(GPIO_AD_21) +FORMAT_PIN(GPIO_AD_22) +FORMAT_PIN(GPIO_AD_23) +FORMAT_PIN(GPIO_AD_24) +FORMAT_PIN(GPIO_AD_25) +FORMAT_PIN(GPIO_AD_26) +FORMAT_PIN(GPIO_AD_27) +FORMAT_PIN(GPIO_AD_28) +FORMAT_PIN(GPIO_AD_29) +FORMAT_PIN(GPIO_AD_30) +FORMAT_PIN(GPIO_AD_31) +FORMAT_PIN(GPIO_AD_32) +FORMAT_PIN(GPIO_AD_33) +FORMAT_PIN(GPIO_AD_34) +FORMAT_PIN(GPIO_AD_35) + +FORMAT_PIN(GPIO_SD_B1_00) +FORMAT_PIN(GPIO_SD_B1_01) +FORMAT_PIN(GPIO_SD_B1_02) +FORMAT_PIN(GPIO_SD_B1_03) +FORMAT_PIN(GPIO_SD_B1_04) +FORMAT_PIN(GPIO_SD_B1_05) + +FORMAT_PIN(GPIO_SD_B2_00) +FORMAT_PIN(GPIO_SD_B2_01) +FORMAT_PIN(GPIO_SD_B2_02) +FORMAT_PIN(GPIO_SD_B2_03) +FORMAT_PIN(GPIO_SD_B2_04) +FORMAT_PIN(GPIO_SD_B2_05) +FORMAT_PIN(GPIO_SD_B2_06) +FORMAT_PIN(GPIO_SD_B2_07) +FORMAT_PIN(GPIO_SD_B2_08) +FORMAT_PIN(GPIO_SD_B2_09) +FORMAT_PIN(GPIO_SD_B2_10) +FORMAT_PIN(GPIO_SD_B2_11) + +FORMAT_PIN(GPIO_DISP_B1_00) +FORMAT_PIN(GPIO_DISP_B1_01) +FORMAT_PIN(GPIO_DISP_B1_02) +FORMAT_PIN(GPIO_DISP_B1_03) +FORMAT_PIN(GPIO_DISP_B1_04) +FORMAT_PIN(GPIO_DISP_B1_05) +FORMAT_PIN(GPIO_DISP_B1_06) +FORMAT_PIN(GPIO_DISP_B1_07) +FORMAT_PIN(GPIO_DISP_B1_08) +FORMAT_PIN(GPIO_DISP_B1_09) +FORMAT_PIN(GPIO_DISP_B1_10) +FORMAT_PIN(GPIO_DISP_B1_11) + +FORMAT_PIN(GPIO_DISP_B2_00) +FORMAT_PIN(GPIO_DISP_B2_01) +FORMAT_PIN(GPIO_DISP_B2_02) +FORMAT_PIN(GPIO_DISP_B2_03) +FORMAT_PIN(GPIO_DISP_B2_04) +FORMAT_PIN(GPIO_DISP_B2_05) +FORMAT_PIN(GPIO_DISP_B2_06) +FORMAT_PIN(GPIO_DISP_B2_07) +FORMAT_PIN(GPIO_DISP_B2_08) +FORMAT_PIN(GPIO_DISP_B2_09) +FORMAT_PIN(GPIO_DISP_B2_10) +FORMAT_PIN(GPIO_DISP_B2_11) +FORMAT_PIN(GPIO_DISP_B2_12) +FORMAT_PIN(GPIO_DISP_B2_13) +FORMAT_PIN(GPIO_DISP_B2_14) +FORMAT_PIN(GPIO_DISP_B2_15) diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.c new file mode 100644 index 0000000000..71562462e6 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.c @@ -0,0 +1,177 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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 "py/obj.h" +#include "py/mphal.h" +#include "mimxrt10xx/pins.h" + +const mcu_pin_obj_t pin_GPIO_EMC_B1_00 = PIN(GPIO7, 0, GPIO_EMC_B1_00, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_01 = PIN(GPIO7, 1, GPIO_EMC_B1_01, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_02 = PIN(GPIO7, 2, GPIO_EMC_B1_02, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_03 = PIN(GPIO7, 3, GPIO_EMC_B1_03, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_04 = PIN(GPIO7, 4, GPIO_EMC_B1_04, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_05 = PIN(GPIO7, 5, GPIO_EMC_B1_05, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_06 = PIN(GPIO7, 6, GPIO_EMC_B1_06, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_07 = PIN(GPIO7, 7, GPIO_EMC_B1_07, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_08 = PIN(GPIO7, 8, GPIO_EMC_B1_08, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_09 = PIN(GPIO7, 9, GPIO_EMC_B1_09, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_10 = PIN(GPIO7, 10, GPIO_EMC_B1_10, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_11 = PIN(GPIO7, 11, GPIO_EMC_B1_11, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_12 = PIN(GPIO7, 12, GPIO_EMC_B1_12, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_13 = PIN(GPIO7, 13, GPIO_EMC_B1_13, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_14 = PIN(GPIO7, 14, GPIO_EMC_B1_14, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_15 = PIN(GPIO7, 15, GPIO_EMC_B1_15, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_16 = PIN(GPIO7, 16, GPIO_EMC_B1_16, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_17 = PIN(GPIO7, 17, GPIO_EMC_B1_17, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_18 = PIN(GPIO7, 18, GPIO_EMC_B1_18, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_19 = PIN(GPIO7, 19, GPIO_EMC_B1_19, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_20 = PIN(GPIO7, 20, GPIO_EMC_B1_20, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_21 = PIN(GPIO7, 21, GPIO_EMC_B1_21, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_22 = PIN(GPIO7, 22, GPIO_EMC_B1_22, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_23 = PIN(GPIO7, 23, GPIO_EMC_B1_23, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_24 = PIN(GPIO7, 24, GPIO_EMC_B1_24, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_25 = PIN(GPIO7, 25, GPIO_EMC_B1_25, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_26 = PIN(GPIO7, 26, GPIO_EMC_B1_26, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_27 = PIN(GPIO7, 27, GPIO_EMC_B1_27, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_28 = PIN(GPIO7, 28, GPIO_EMC_B1_28, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_29 = PIN(GPIO7, 29, GPIO_EMC_B1_29, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_30 = PIN(GPIO7, 30, GPIO_EMC_B1_30, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_31 = PIN(GPIO7, 31, GPIO_EMC_B1_31, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_32 = PIN(GPIO8, 0, GPIO_EMC_B1_32, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_33 = PIN(GPIO8, 1, GPIO_EMC_B1_33, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_34 = PIN(GPIO8, 2, GPIO_EMC_B1_34, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_35 = PIN(GPIO8, 3, GPIO_EMC_B1_35, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_36 = PIN(GPIO8, 4, GPIO_EMC_B1_36, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_37 = PIN(GPIO8, 5, GPIO_EMC_B1_37, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_38 = PIN(GPIO8, 6, GPIO_EMC_B1_38, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_39 = PIN(GPIO8, 7, GPIO_EMC_B1_39, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_40 = PIN(GPIO8, 8, GPIO_EMC_B1_40, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B1_41 = PIN(GPIO8, 9, GPIO_EMC_B1_41, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_00 = PIN(GPIO8, 10, GPIO_EMC_B2_00, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_01 = PIN(GPIO8, 11, GPIO_EMC_B2_01, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_02 = PIN(GPIO8, 12, GPIO_EMC_B2_02, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_03 = PIN(GPIO8, 13, GPIO_EMC_B2_03, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_04 = PIN(GPIO8, 14, GPIO_EMC_B2_04, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_05 = PIN(GPIO8, 15, GPIO_EMC_B2_05, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_06 = PIN(GPIO8, 16, GPIO_EMC_B2_06, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_07 = PIN(GPIO8, 17, GPIO_EMC_B2_07, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_08 = PIN(GPIO8, 18, GPIO_EMC_B2_08, NO_ADC, 0, 0x00000005, 0x00000004); +const mcu_pin_obj_t pin_GPIO_EMC_B2_09 = PIN(GPIO8, 19, GPIO_EMC_B2_09, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_10 = PIN(GPIO8, 20, GPIO_EMC_B2_10, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_11 = PIN(GPIO8, 21, GPIO_EMC_B2_11, NO_ADC, 0, 0x00000005, 0x00000004); +const mcu_pin_obj_t pin_GPIO_EMC_B2_12 = PIN(GPIO8, 22, GPIO_EMC_B2_12, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_13 = PIN(GPIO8, 23, GPIO_EMC_B2_13, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_14 = PIN(GPIO8, 24, GPIO_EMC_B2_14, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_15 = PIN(GPIO8, 25, GPIO_EMC_B2_15, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_16 = PIN(GPIO8, 26, GPIO_EMC_B2_16, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_17 = PIN(GPIO8, 27, GPIO_EMC_B2_17, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_18 = PIN(GPIO8, 28, GPIO_EMC_B2_18, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_19 = PIN(GPIO8, 29, GPIO_EMC_B2_19, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_EMC_B2_20 = PIN(GPIO8, 30, GPIO_EMC_B2_20, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_AD_00 = PIN(GPIO8, 31, GPIO_AD_00, NO_ADC, 0, 0x00000005, 0x0000000E); +const mcu_pin_obj_t pin_GPIO_AD_01 = PIN(GPIO9, 0, GPIO_AD_01, NO_ADC, 0, 0x00000005, 0x0000000E); +const mcu_pin_obj_t pin_GPIO_AD_02 = PIN(GPIO9, 1, GPIO_AD_02, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_03 = PIN(GPIO9, 2, GPIO_AD_03, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_04 = PIN(GPIO9, 3, GPIO_AD_04, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_05 = PIN(GPIO9, 4, GPIO_AD_05, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_06 = PIN(GPIO9, 5, GPIO_AD_06, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_07 = PIN(GPIO9, 6, GPIO_AD_07, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_08 = PIN(GPIO9, 7, GPIO_AD_08, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_09 = PIN(GPIO9, 8, GPIO_AD_09, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_10 = PIN(GPIO9, 9, GPIO_AD_10, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_11 = PIN(GPIO9, 10, GPIO_AD_11, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_12 = PIN(GPIO9, 11, GPIO_AD_12, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_13 = PIN(GPIO9, 12, GPIO_AD_13, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_14 = PIN(GPIO9, 13, GPIO_AD_14, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_15 = PIN(GPIO9, 14, GPIO_AD_15, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_16 = PIN(GPIO9, 15, GPIO_AD_16, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_17 = PIN(GPIO9, 16, GPIO_AD_17, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_18 = PIN(GPIO9, 17, GPIO_AD_18, NO_ADC, 0, 0x00000005, 0x0000000E); +const mcu_pin_obj_t pin_GPIO_AD_19 = PIN(GPIO9, 18, GPIO_AD_19, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_20 = PIN(GPIO9, 19, GPIO_AD_20, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_21 = PIN(GPIO9, 20, GPIO_AD_21, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_22 = PIN(GPIO9, 21, GPIO_AD_22, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_23 = PIN(GPIO9, 22, GPIO_AD_23, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_24 = PIN(GPIO9, 23, GPIO_AD_24, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_25 = PIN(GPIO9, 24, GPIO_AD_25, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_26 = PIN(GPIO9, 25, GPIO_AD_26, NO_ADC, 0, 0x00000005, 0x0000000E); +const mcu_pin_obj_t pin_GPIO_AD_27 = PIN(GPIO9, 26, GPIO_AD_27, NO_ADC, 0, 0x00000005, 0x0000000E); +const mcu_pin_obj_t pin_GPIO_AD_28 = PIN(GPIO9, 27, GPIO_AD_28, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_29 = PIN(GPIO9, 28, GPIO_AD_29, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_30 = PIN(GPIO9, 29, GPIO_AD_30, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_31 = PIN(GPIO9, 30, GPIO_AD_31, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_32 = PIN(GPIO9, 31, GPIO_AD_32, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_33 = PIN(GPIO10, 0, GPIO_AD_33, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_34 = PIN(GPIO10, 1, GPIO_AD_34, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_AD_35 = PIN(GPIO10, 2, GPIO_AD_35, NO_ADC, 0, 0x00000005, 0x0000000E); +const mcu_pin_obj_t pin_GPIO_SD_B1_00 = PIN(GPIO10, 3, GPIO_SD_B1_00, NO_ADC, 0, 0x00000005, 0x00000004); +const mcu_pin_obj_t pin_GPIO_SD_B1_01 = PIN(GPIO10, 4, GPIO_SD_B1_01, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_SD_B1_02 = PIN(GPIO10, 5, GPIO_SD_B1_02, NO_ADC, 0, 0x00000005, 0x00000004); +const mcu_pin_obj_t pin_GPIO_SD_B1_03 = PIN(GPIO10, 6, GPIO_SD_B1_03, NO_ADC, 0, 0x00000005, 0x00000004); +const mcu_pin_obj_t pin_GPIO_SD_B1_04 = PIN(GPIO10, 7, GPIO_SD_B1_04, NO_ADC, 0, 0x00000005, 0x00000004); +const mcu_pin_obj_t pin_GPIO_SD_B1_05 = PIN(GPIO10, 8, GPIO_SD_B1_05, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_SD_B2_00 = PIN(GPIO10, 9, GPIO_SD_B2_00, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_SD_B2_01 = PIN(GPIO10, 10, GPIO_SD_B2_01, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_SD_B2_02 = PIN(GPIO10, 11, GPIO_SD_B2_02, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_SD_B2_03 = PIN(GPIO10, 12, GPIO_SD_B2_03, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_SD_B2_04 = PIN(GPIO10, 13, GPIO_SD_B2_04, NO_ADC, 0, 0x00000005, 0x00000004); +const mcu_pin_obj_t pin_GPIO_SD_B2_05 = PIN(GPIO10, 14, GPIO_SD_B2_05, NO_ADC, 0, 0x00000005, 0x00000004); +const mcu_pin_obj_t pin_GPIO_SD_B2_06 = PIN(GPIO10, 15, GPIO_SD_B2_06, NO_ADC, 0, 0x00000005, 0x00000004); +const mcu_pin_obj_t pin_GPIO_SD_B2_07 = PIN(GPIO10, 16, GPIO_SD_B2_07, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_SD_B2_08 = PIN(GPIO10, 17, GPIO_SD_B2_08, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_SD_B2_09 = PIN(GPIO10, 18, GPIO_SD_B2_09, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_SD_B2_10 = PIN(GPIO10, 19, GPIO_SD_B2_10, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_SD_B2_11 = PIN(GPIO10, 20, GPIO_SD_B2_11, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_DISP_B1_00 = PIN(GPIO10, 21, GPIO_DISP_B1_00, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_DISP_B1_01 = PIN(GPIO10, 22, GPIO_DISP_B1_01, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_DISP_B1_02 = PIN(GPIO10, 23, GPIO_DISP_B1_02, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_DISP_B1_03 = PIN(GPIO10, 24, GPIO_DISP_B1_03, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_DISP_B1_04 = PIN(GPIO10, 25, GPIO_DISP_B1_04, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_DISP_B1_05 = PIN(GPIO10, 26, GPIO_DISP_B1_05, NO_ADC, 0, 0x00000005, 0x00000008); +const mcu_pin_obj_t pin_GPIO_DISP_B1_06 = PIN(GPIO10, 27, GPIO_DISP_B1_06, NO_ADC, 0, 0x00000005, 0x0000000C); +const mcu_pin_obj_t pin_GPIO_DISP_B1_07 = PIN(GPIO10, 28, GPIO_DISP_B1_07, NO_ADC, 0, 0x00000005, 0x0000000C); +const mcu_pin_obj_t pin_GPIO_DISP_B1_08 = PIN(GPIO10, 29, GPIO_DISP_B1_08, NO_ADC, 0, 0x00000005, 0x0000000C); +const mcu_pin_obj_t pin_GPIO_DISP_B1_09 = PIN(GPIO10, 30, GPIO_DISP_B1_09, NO_ADC, 0, 0x00000005, 0x0000000C); +const mcu_pin_obj_t pin_GPIO_DISP_B1_10 = PIN(GPIO10, 31, GPIO_DISP_B1_10, NO_ADC, 0, 0x00000005, 0x0000000C); +const mcu_pin_obj_t pin_GPIO_DISP_B1_11 = PIN(GPIO11, 0, GPIO_DISP_B1_11, NO_ADC, 0, 0x00000005, 0x0000000C); +const mcu_pin_obj_t pin_GPIO_DISP_B2_00 = PIN(GPIO11, 1, GPIO_DISP_B2_00, NO_ADC, 0, 0x00000005, 0x00000002); +const mcu_pin_obj_t pin_GPIO_DISP_B2_01 = PIN(GPIO11, 2, GPIO_DISP_B2_01, NO_ADC, 0, 0x00000005, 0x00000002); +const mcu_pin_obj_t pin_GPIO_DISP_B2_02 = PIN(GPIO11, 3, GPIO_DISP_B2_02, NO_ADC, 0, 0x00000005, 0x00000002); +const mcu_pin_obj_t pin_GPIO_DISP_B2_03 = PIN(GPIO11, 4, GPIO_DISP_B2_03, NO_ADC, 0, 0x00000005, 0x00000002); +const mcu_pin_obj_t pin_GPIO_DISP_B2_04 = PIN(GPIO11, 5, GPIO_DISP_B2_04, NO_ADC, 0, 0x00000005, 0x00000002); +const mcu_pin_obj_t pin_GPIO_DISP_B2_05 = PIN(GPIO11, 6, GPIO_DISP_B2_05, NO_ADC, 0, 0x00000005, 0x00000002); +const mcu_pin_obj_t pin_GPIO_DISP_B2_06 = PIN(GPIO11, 7, GPIO_DISP_B2_06, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_DISP_B2_07 = PIN(GPIO11, 8, GPIO_DISP_B2_07, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_DISP_B2_08 = PIN(GPIO11, 9, GPIO_DISP_B2_08, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_DISP_B2_09 = PIN(GPIO11, 10, GPIO_DISP_B2_09, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_DISP_B2_10 = PIN(GPIO11, 11, GPIO_DISP_B2_10, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_DISP_B2_11 = PIN(GPIO11, 12, GPIO_DISP_B2_11, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_DISP_B2_12 = PIN(GPIO11, 13, GPIO_DISP_B2_12, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_DISP_B2_13 = PIN(GPIO11, 14, GPIO_DISP_B2_13, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_DISP_B2_14 = PIN(GPIO11, 15, GPIO_DISP_B2_14, NO_ADC, 0, 0x00000005, 0x00000006); +const mcu_pin_obj_t pin_GPIO_DISP_B2_15 = PIN(GPIO11, 16, GPIO_DISP_B2_15, NO_ADC, 0, 0x00000005, 0x0000000E); diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.h new file mode 100644 index 0000000000..0d99219c8a --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.h @@ -0,0 +1,36 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ + +#pragma once + +#define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; +#include "pin_names.h" +#undef FORMAT_PIN + +#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 0) +extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/periph.h index 8184d5b135..ffbd72339e 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/periph.h @@ -78,10 +78,18 @@ extern LPUART_Type *const mcu_uart_banks[]; #ifdef MIMXRT1011_SERIES #include "MIMXRT1011/periph.h" +#elif defined(MIMXRT1015_SERIES) +#include "MIMXRT1015/periph.h" #elif defined(MIMXRT1021_SERIES) #include "MIMXRT1021/periph.h" +#elif defined(MIMXRT1042_SERIES) +#include "MIMXRT1042/periph.h" +#elif defined(MIMXRT1052_SERIES) +#include "MIMXRT1052/periph.h" #elif defined(MIMXRT1062_SERIES) #include "MIMXRT1062/periph.h" +#elif defined(MIMXRT1176_cm7_SERIES) +#include "MIMXRT1176/periph.h" #endif #endif // MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_PERIPH_H diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/pin_names.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/pin_names.h new file mode 100644 index 0000000000..37db5c2261 --- /dev/null +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/pin_names.h @@ -0,0 +1,42 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * + * 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. + */ + +// OK to include more than once because FORMAT_PIN may be different. + +#ifdef MIMXRT1011_SERIES +#include "MIMXRT1011/pin_names.h" +#elif defined(MIMXRT1021_SERIES) +#include "MIMXRT1021/pin_names.h" +#elif defined(MIMXRT1042_SERIES) +#include "MIMXRT1042/pin_names.h" +#elif defined(MIMXRT1052_SERIES) +#include "MIMXRT1052/pin_names.h" +#elif defined(MIMXRT1062_SERIES) +#include "MIMXRT1062/pin_names.h" +#elif defined(MIMXRT1176_cm7_SERIES) +#include "MIMXRT1176/pin_names.h" +#endif diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h index 0457a09a1a..8ffc17ba07 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/pins.h @@ -78,10 +78,18 @@ void enable_pin_change_interrupt(const mcu_pin_obj_t *pin, gpio_change_interrupt #ifdef MIMXRT1011_SERIES #include "MIMXRT1011/pins.h" +#elif defined(MIMXRT1015_SERIES) +#include "MIMXRT1015/pins.h" #elif defined(MIMXRT1021_SERIES) #include "MIMXRT1021/pins.h" +#elif defined(MIMXRT1042_SERIES) +#include "MIMXRT1042/pins.h" +#elif defined(MIMXRT1052_SERIES) +#include "MIMXRT1052/pins.h" #elif defined(MIMXRT1062_SERIES) #include "MIMXRT1062/pins.h" +#elif defined(MIMXRT1176_cm7_SERIES) +#include "MIMXRT1176/pins.h" #endif #endif // MICROPY_INCLUDED_MIMXRT10XX_PERIPHERALS_PINS_H diff --git a/ports/mimxrt10xx/sdk b/ports/mimxrt10xx/sdk index 2b9354539e..9990f264f9 160000 --- a/ports/mimxrt10xx/sdk +++ b/ports/mimxrt10xx/sdk @@ -1 +1 @@ -Subproject commit 2b9354539e6e4f722749e87b0bdc22966dc080d9 +Subproject commit 9990f264f98430f6d885041ab0f24224d68f4958 diff --git a/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c b/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c index e32eaf8832..3ccd67096a 100644 --- a/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c +++ b/ports/mimxrt10xx/supervisor/flexspi_nor_flash_ops.c @@ -137,7 +137,7 @@ status_t PLACE_IN_ITCM(flexspi_nor_flash_page_program)(FLEXSPI_Type * base, uint status = flexspi_nor_wait_bus_busy(base); /* Do software reset. */ - #if defined(FSL_FEATURE_SOC_OTFAD_COUNT) + #if defined(FSL_FEATURE_SOC_OTFAD_COUNT) && FSL_FEATURE_SOC_OTFAD_COUNT == 1 base->AHBCR |= FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK; base->AHBCR &= ~(FLEXSPI_AHBCR_CLRAHBRXBUF_MASK | FLEXSPI_AHBCR_CLRAHBTXBUF_MASK); #else diff --git a/ports/mimxrt10xx/supervisor/internal_flash.c b/ports/mimxrt10xx/supervisor/internal_flash.c index bacb62854a..cd4dd33ba0 100644 --- a/ports/mimxrt10xx/supervisor/internal_flash.c +++ b/ports/mimxrt10xx/supervisor/internal_flash.c @@ -52,6 +52,11 @@ extern uint32_t __fatfs_flash_length[]; uint8_t _flash_cache[SECTOR_SIZE] __attribute__((aligned(4))); uint32_t _flash_page_addr = NO_CACHE; +#ifndef FLEXSPI +#define FLEXSPI FLEXSPI1 +#define FlexSPI_AMBA_BASE FlexSPI1_AMBA_BASE +#endif + void PLACE_IN_ITCM(supervisor_flash_init)(void) { // Update the LUT to make sure all entries are available. Copy the values to // memory first so that we don't read from the flash as we update the LUT. @@ -62,6 +67,41 @@ void PLACE_IN_ITCM(supervisor_flash_init)(void) { __DSB(); __ISB(); flexspi_nor_init(); + + #if IMXRT10XX + // Disable interrupts of priority 8+. They likely use code in flash + // itself. Higher priority interrupts (<8) should ensure all of their + // code is in RAM. + __set_BASEPRI(8 << (8 - __NVIC_PRIO_BITS)); + + // Increase clock speed to 120 MHz + // Wait for bus idle before change flash configuration. + while (!FLEXSPI_GetBusIdleStatus(FLEXSPI)) { + } + FLEXSPI_Enable(FLEXSPI, false); + + // Disable FlexSPI clock + CCM->CCGR6 &= ~CCM_CCGR6_CG5_MASK; + + // Changing the clock is OK now. + + // The PFD is 480 * 18 / PFD0_FRAC. We do / 18 which outputs 480 MHz. + CCM_ANALOG->PFD_480 = (CCM_ANALOG->PFD_480 & ~CCM_ANALOG_PFD_480_TOG_PFD0_FRAC_MASK) | CCM_ANALOG_PFD_480_TOG_PFD0_FRAC(18); + + // This divides down the 480 Mhz by PODF + 1. So 480 / (3 + 1) = 120 MHz. + CCM->CSCMR1 = (CCM->CSCMR1 & ~CCM_CSCMR1_FLEXSPI_PODF_MASK) | CCM_CSCMR1_FLEXSPI_PODF(3); + + // Re-enable FlexSPI + CCM->CCGR6 |= CCM_CCGR6_CG5_MASK; + + FLEXSPI_Enable(FLEXSPI, true); + + FLEXSPI_SoftwareReset(FLEXSPI); + + while (!FLEXSPI_GetBusIdleStatus(FLEXSPI)) { + } + __set_BASEPRI(0U); + #endif } static inline uint32_t lba2addr(uint32_t block) { diff --git a/ports/mimxrt10xx/supervisor/port.c b/ports/mimxrt10xx/supervisor/port.c index feb8566aad..997a97ba49 100644 --- a/ports/mimxrt10xx/supervisor/port.c +++ b/ports/mimxrt10xx/supervisor/port.c @@ -89,11 +89,13 @@ extern uint32_t _ld_stack_top; extern uint32_t __isr_vector[]; +extern uint32_t _ld_ocram_start; extern uint32_t _ld_ocram_bss_start; extern uint32_t _ld_ocram_bss_size; extern uint32_t _ld_ocram_data_destination; extern uint32_t _ld_ocram_data_size; extern uint32_t _ld_ocram_data_flash_copy; +extern uint32_t _ld_ocram_end; extern uint32_t _ld_dtcm_bss_start; extern uint32_t _ld_dtcm_bss_size; extern uint32_t _ld_dtcm_data_destination; @@ -106,36 +108,6 @@ extern uint32_t _ld_isr_destination; extern uint32_t _ld_isr_size; extern uint32_t _ld_isr_flash_copy; -// Remove these once the SDK re-includes them. -// https://github.com/nxp-mcuxpresso/mcux-sdk/issues/110 -/*! @name GPR14 - GPR14 General Purpose Register */ -/*! @{ */ -#define IOMUXC_GPR_GPR14_CM7_CFGITCMSZ_MASK (0xF0000U) -#define IOMUXC_GPR_GPR14_CM7_CFGITCMSZ_SHIFT (16U) -/*! CM7_CFGITCMSZ - * 0b0000..0 KB (No ITCM) - * 0b0011..4 KB - * 0b0100..8 KB - * 0b0101..16 KB - * 0b0110..32 KB - * 0b0111..64 KB - * 0b1000..128 KB - */ -#define IOMUXC_GPR_GPR14_CM7_CFGITCMSZ(x) (((uint32_t)(((uint32_t)(x)) << IOMUXC_GPR_GPR14_CM7_CFGITCMSZ_SHIFT)) & IOMUXC_GPR_GPR14_CM7_CFGITCMSZ_MASK) -#define IOMUXC_GPR_GPR14_CM7_CFGDTCMSZ_MASK (0xF00000U) -#define IOMUXC_GPR_GPR14_CM7_CFGDTCMSZ_SHIFT (20U) -/*! CM7_CFGDTCMSZ - * 0b0000..0 KB (No DTCM) - * 0b0011..4 KB - * 0b0100..8 KB - * 0b0101..16 KB - * 0b0110..32 KB - * 0b0111..64 KB - * 0b1000..128 KB - */ -#define IOMUXC_GPR_GPR14_CM7_CFGDTCMSZ(x) (((uint32_t)(((uint32_t)(x)) << IOMUXC_GPR_GPR14_CM7_CFGDTCMSZ_SHIFT)) & IOMUXC_GPR_GPR14_CM7_CFGDTCMSZ_MASK) -/*! @} */ - extern void main(void); // This replaces the Reset_Handler in startup_*.S and SystemInit in system_*.c. @@ -159,18 +131,27 @@ __attribute__((used, naked, no_instrument_function, optimize("no-tree-loop-distr // then the return will jump to an invalid address. // Configure FlexRAM. The e is one block of ITCM (0b11) and DTCM (0b10). The rest is two OCRAM // (0b01). We shift in zeroes for all unimplemented banks. - IOMUXC_GPR->GPR17 = (0xe5555555) >> (32 - 2 * FSL_FEATURE_FLEXRAM_INTERNAL_RAM_TOTAL_BANK_NUMBERS); + uint32_t flexram_config = (0xe5555555) >> (32 - 2 * FSL_FEATURE_FLEXRAM_INTERNAL_RAM_TOTAL_BANK_NUMBERS); + // imxrt1176 splits the config across two registers. + #ifdef IOMUXC_GPR_GPR17_FLEXRAM_BANK_CFG_LOW_MASK + IOMUXC_GPR->GPR17 = flexram_config & IOMUXC_GPR_GPR17_FLEXRAM_BANK_CFG_LOW_MASK; + IOMUXC_GPR->GPR18 = (flexram_config >> 16) & IOMUXC_GPR_GPR18_FLEXRAM_BANK_CFG_HIGH_MASK; + #else + IOMUXC_GPR->GPR17 = flexram_config; + #endif // Switch from FlexRAM fuse config to the IOMUXC values. IOMUXC_GPR->GPR16 |= IOMUXC_GPR_GPR16_FLEXRAM_BANK_CFG_SEL(1); // Let the core know the TCM sizes changed. + #ifdef IOMUXC_GPR_GPR14_CM7_CFGDTCMSZ_MASK uint32_t current_gpr14 = IOMUXC_GPR->GPR14; current_gpr14 &= ~IOMUXC_GPR_GPR14_CM7_CFGDTCMSZ_MASK; current_gpr14 |= IOMUXC_GPR_GPR14_CM7_CFGDTCMSZ(0x6); current_gpr14 &= ~IOMUXC_GPR_GPR14_CM7_CFGITCMSZ_MASK; current_gpr14 |= IOMUXC_GPR_GPR14_CM7_CFGITCMSZ(0x6); IOMUXC_GPR->GPR14 = current_gpr14; + #endif // Enable FlexRAM interrupts on invalid access. FLEXRAM->INT_STAT_EN = FLEXRAM_INT_STAT_EN_ITCM_ERR_STAT_EN(1) | @@ -182,6 +163,7 @@ __attribute__((used, naked, no_instrument_function, optimize("no-tree-loop-distr #endif /* ((__FPU_PRESENT == 1) && (__FPU_USED == 1)) */ /* Disable Watchdog Power Down Counter */ + #if defined(RTWDOG) WDOG1->WMCR &= ~WDOG_WMCR_PDE_MASK; WDOG2->WMCR &= ~WDOG_WMCR_PDE_MASK; @@ -191,6 +173,32 @@ __attribute__((used, naked, no_instrument_function, optimize("no-tree-loop-distr RTWDOG->CNT = 0xD928C520U; /* 0xD928C520U is the update key */ RTWDOG->TOVAL = 0xFFFF; RTWDOG->CS = (uint32_t)((RTWDOG->CS) & ~RTWDOG_CS_EN_MASK) | RTWDOG_CS_UPDATE_MASK; + #endif + + #if defined(RTWDOG3) + if ((WDOG1->WCR & WDOG_WCR_WDE_MASK) != 0U) { + WDOG1->WCR &= ~(uint16_t)WDOG_WCR_WDE_MASK; + } + if ((WDOG2->WCR & WDOG_WCR_WDE_MASK) != 0U) { + WDOG2->WCR &= ~(uint16_t)WDOG_WCR_WDE_MASK; + } + if ((RTWDOG3->CS & RTWDOG_CS_CMD32EN_MASK) != 0U) { + RTWDOG3->CNT = 0xD928C520U; /* 0xD928C520U is the update key */ + } else { + RTWDOG3->CNT = 0xC520U; + RTWDOG3->CNT = 0xD928U; + } + RTWDOG3->TOVAL = 0xFFFF; + RTWDOG3->CS = (uint32_t)((RTWDOG3->CS) & ~RTWDOG_CS_EN_MASK) | RTWDOG_CS_UPDATE_MASK; + if ((RTWDOG4->CS & RTWDOG_CS_CMD32EN_MASK) != 0U) { + RTWDOG4->CNT = 0xD928C520U; /* 0xD928C520U is the update key */ + } else { + RTWDOG4->CNT = 0xC520U; + RTWDOG4->CNT = 0xD928U; + } + RTWDOG4->TOVAL = 0xFFFF; + RTWDOG4->CS = (uint32_t)((RTWDOG4->CS) & ~RTWDOG_CS_EN_MASK) | RTWDOG_CS_UPDATE_MASK; + #endif /* Disable Systick which might be enabled by bootrom */ if (SysTick->CTRL & SysTick_CTRL_ENABLE_Msk) { @@ -227,6 +235,9 @@ __attribute__((used, naked, no_instrument_function, optimize("no-tree-loop-distr // FlexSPI2 is 0x70000000 // This the first portion (1MB, 2MB or 4MB) of flash is the bootloader and CircuitPython read-only data. + #if !defined(FlexSPI_AMBA_BASE) + #define FlexSPI_AMBA_BASE FlexSPI1_AMBA_BASE + #endif MPU->RBAR = ARM_MPU_RBAR(10, FlexSPI_AMBA_BASE); uint32_t region_size = ARM_MPU_REGION_SIZE_32B; uint32_t code_size = ((uint32_t)&_ld_filesystem_start) - FlexSPI_AMBA_BASE; @@ -265,13 +276,18 @@ __attribute__((used, naked, no_instrument_function, optimize("no-tree-loop-distr // This is OCRAM. We mark it as shareable so that it isn't cached. This makes USB work at the // cost of 1/4 speed OCRAM accesses. It will leave more room for caching data from the flash // too which might be a net win. - MPU->RBAR = ARM_MPU_RBAR(14, 0x20200000U); + MPU->RBAR = ARM_MPU_RBAR(14, ((uint32_t)&_ld_ocram_start)); MPU->RASR = ARM_MPU_RASR(NO_EXECUTION, ARM_MPU_AP_FULL, NORMAL, NOT_SHAREABLE, CACHEABLE, BUFFERABLE, NO_SUBREGIONS, ARM_MPU_REGION_SIZE_512KB); + #if IMXRT10XX // We steal 64k from FlexRAM for ITCM and DTCM so disable those memory regions here. // We use 64k from FlexRAM for ITCM and DTCM so disable those memory regions here. - MPU->RBAR = ARM_MPU_RBAR(15, 0x20280000U); + MPU->RBAR = ARM_MPU_RBAR(15, ((uint32_t)&_ld_ocram_end)); MPU->RASR = ARM_MPU_RASR(EXECUTION, ARM_MPU_AP_FULL, NORMAL, NOT_SHAREABLE, CACHEABLE, BUFFERABLE, 0x80, ARM_MPU_REGION_SIZE_512KB); + #else + // On the iMX RT 11xx OCRAM is not flexram (for now). So no need to mask it off. + #endif + /* Enable MPU */ ARM_MPU_Enable(MPU_CTRL_PRIVDEFENA_Msk); @@ -330,7 +346,9 @@ void __attribute__((no_instrument_function,section(".itcm.profile_exit"),long_ca } safe_mode_t port_init(void) { + #if IMXRT10XX CLOCK_SetMode(kCLOCK_ModeRun); + #endif clocks_init(); @@ -380,6 +398,9 @@ safe_mode_t port_init(void) { for (uint16_t i = 0; i < NUMBER_OF_INT_VECTORS; i++) { NVIC_SetPriority(i, (1UL << __NVIC_PRIO_BITS) - 1UL); } + #ifdef MIMXRT1042_SERIES + #define USB_OTG1_IRQn USB_OTG_IRQn + #endif NVIC_SetPriority(USB_OTG1_IRQn, 1); #ifdef USBPHY2 NVIC_SetPriority(USB_OTG2_IRQn, 1); @@ -398,7 +419,21 @@ safe_mode_t port_init(void) { // Always enable the SNVS interrupt. The GPC won't wake us up unless at least one interrupt is // enabled. It won't occur very often so it'll be low overhead. + #if IMXRT11XX + NVIC_EnableIRQ(SNVS_HP_NON_TZ_IRQn); + #else NVIC_EnableIRQ(SNVS_HP_WRAPPER_IRQn); + #endif + + #if IMXRT11XX + /* Save SRSR to another register so we can read it later. */ + SRC->GPR[11] = SRC->SRSR; + SRC->SRSR = 0xFFFFFFFFU; + + if ((SRC->GPR[11] & SRC_SRSR_M7_LOCKUP_M7_MASK) != 0) { + return SAFE_MODE_HARD_FAULT; + } + #endif // Note that `reset_port` CANNOT GO HERE, unlike other ports, because `board_init` hasn't been // run yet, which uses `never_reset` to protect critical pins from being reset by `reset_port`. @@ -411,7 +446,9 @@ safe_mode_t port_init(void) { } void reset_port(void) { + #if CIRCUITPY_BUSIO spi_reset(); + #endif #if CIRCUITPY_AUDIOIO audio_dma_reset(); @@ -497,9 +534,15 @@ uint64_t port_get_raw_ticks(uint8_t *subticks) { return ticks / 32; } +#if IMXRT10XX void SNVS_HP_WRAPPER_IRQHandler(void); __attribute__((used)) void PLACE_IN_ITCM(SNVS_HP_WRAPPER_IRQHandler)(void) { +#else +void SNVS_HP_NON_TZ_IRQHandler(void); +__attribute__((used)) +void PLACE_IN_ITCM(SNVS_HP_NON_TZ_IRQHandler)(void) { + #endif if ((SNVS->HPSR & SNVS_HPSR_PI_MASK) != 0) { supervisor_tick(); SNVS->HPSR = SNVS_HPSR_PI_MASK; @@ -552,7 +595,11 @@ void port_idle_until_interrupt(void) { common_hal_mcu_disable_interrupts(); if (!background_callback_pending()) { + #if IMXRT11XX + NVIC_ClearPendingIRQ(SNVS_HP_NON_TZ_IRQn); + #else NVIC_ClearPendingIRQ(SNVS_HP_WRAPPER_IRQn); + #endif __WFI(); } common_hal_mcu_enable_interrupts(); diff --git a/ports/mimxrt10xx/supervisor/usb.c b/ports/mimxrt10xx/supervisor/usb.c index bc6bc5f0cd..64a2639c16 100644 --- a/ports/mimxrt10xx/supervisor/usb.c +++ b/ports/mimxrt10xx/supervisor/usb.c @@ -79,8 +79,13 @@ STATIC void init_usb_instance(mp_int_t instance) { // Provide the prototypes for the interrupt handlers. The iMX RT SDK doesn't. // The SDK only links to them from assembly. + #ifdef MIMXRT1042_SERIES + void USB_OTG_IRQHandler(void); + void PLACE_IN_ITCM(USB_OTG_IRQHandler)(void) { + #else void USB_OTG1_IRQHandler(void); void PLACE_IN_ITCM(USB_OTG1_IRQHandler)(void) { + #endif usb_irq_handler(0); } diff --git a/ports/mimxrt10xx/tools/gen_peripherals_data.py b/ports/mimxrt10xx/tools/gen_peripherals_data.py new file mode 100644 index 0000000000..0b4f215279 --- /dev/null +++ b/ports/mimxrt10xx/tools/gen_peripherals_data.py @@ -0,0 +1,356 @@ +import sys +import pathlib +import xml.etree.ElementTree as ET + +SIGNALS = { + "LPI2C": ["SDA", "SCL"], + "LPSPI": ["SCK", "SDO", "SDI"], + "LPUART": ["RX", "TX", "RTS", "CTS"], + "I2S": ["RX_DATA0", "RX_SYNC", "TX_BCLK", "TX_DATA0", "TX_SYNC"], + "MQS": ["LEFT", "RIGHT"], +} + +SIGNAL_RENAME = { + "CTS_B": "CTS", + "RTS_B": "RTS", + "RXD": "RX", + "TXD": "TX", + "TX_DATA00": "TX_DATA0", + "RX_DATA00": "RX_DATA0", + "TX_DATA": "TX_DATA0", + "RX_DATA": "RX_DATA0", +} + +SKIP_LPSR = True + +svd_folder = pathlib.Path(sys.argv[1]) + +# Download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data +config_data_folder = pathlib.Path(sys.argv[2]) +devices = sys.argv[3:] + +peripherals_dir = pathlib.Path("peripherals/mimxrt10xx") + +copyright = """/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Lucian Copeland for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * Copyright (c) 2023 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. + */ +""" + +for device in devices: + print(device) + svd_fn = svd_folder / device / (device + ".xml") + if not svd_fn.exists(): + svd_fn = svd_folder / device / (device + "_cm7.xml") + + pin_to_analog = {} + out_dir = peripherals_dir / device + largest_signals = None + for signal_file in config_data_folder.glob( + f"{device}*ConfigTools_data*/**/signal_configuration.xml" + ): + if largest_signals is None or signal_file.stat().st_size > largest_signals.stat().st_size: + largest_signals = signal_file + + # Use the signal file to find analog connections + signal_tree = ET.parse(largest_signals) + signal_root = signal_tree.getroot() + for connection in signal_root.iter("connections"): + if "name_part" not in connection.attrib or not connection.attrib["name_part"].startswith( + "ADC" + ): + continue + name_part = connection.attrib["name_part"] + try: + assign = next(connection.iter("assign")) + except StopIteration: + continue + split_pin = assign.attrib["register"].split("_") + pin_name = "_".join(split_pin[split_pin.index("GPIO") :]) + adc_instance, adc_channel = name_part.split("_") + + try: + adc_channel = int(adc_channel[2:]) + except ValueError: + continue + pin_to_analog[pin_name] = (adc_instance, adc_channel) + + # Find USB pins + usb_pins = [] + all_pins = set() + for pin in signal_root.iter("pin"): + pin_name = pin.get("name") + if SKIP_LPSR and "LPSR" in pin_name: + continue + all_pins.add(pin_name) + if not pin_name.startswith("USB_OTG"): + continue + if not pin_name.endswith(("DN", "DP")): + continue + usb_pins.append(pin_name) + + # Find peripherals + all_peripherals = {} + for peripheral in signal_root.iter("peripheral"): + ptype = peripheral.get("peripheral_type") + if ptype not in all_peripherals: + all_peripherals[ptype] = [] + all_peripherals[ptype].append(peripheral.get("id")) + + print(svd_fn) + tree = ET.parse(svd_fn) + root = tree.getroot() + pin_number = 0 + last_gpio_base = None + mux_register_base = None + + pins_h = [ + copyright, + "#pragma once", + "", + "#define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name;", + '#include "pin_names.h"', + "#undef FORMAT_PIN", + ] + pins_c = [ + copyright, + '#include "py/obj.h"', + '#include "py/mphal.h"', + '#include "mimxrt10xx/pins.h"', + "", + ] + pin_names_h = [copyright, "", "// define FORMAT_PIN(pin_name) and then include this file."] + mux_registers_by_pin = {} + peripheral_inputs = {} + pwm_outputs = [] + for register in root.iter("register"): + name = register.find("name").text + if name.endswith("SELECT_INPUT"): + name_split = name.split("_") + instance = name_split[0] + signal = "_".join(name_split[1:-2]) + signal = SIGNAL_RENAME.get(signal, signal) + if instance not in peripheral_inputs: + peripheral_inputs[instance] = {} + if signal not in peripheral_inputs[instance]: + peripheral_inputs[instance][signal] = {} + for evalue in register.iter("enumeratedValue"): + ename = evalue.find("name").text.strip("_") + if "_ALT" in ename: + pin_name, alt = ename.rsplit("_", maxsplit=1) + else: + pin_name = ename + alt = evalue.find("description").text.rsplit(maxsplit=1)[1] + if SKIP_LPSR and "LPSR" in pin_name: + continue + alt = int(alt[3:]) + value = int(evalue.find("value").text, 0) + peripheral_inputs[instance][signal][pin_name] = [alt, name, value] + # Mux registers come before PAD registers. + elif name.startswith("SW_MUX_CTL_PAD_GPIO"): + address_offset = int(register.find("addressOffset").text, 16) + if mux_register_base is None: + mux_register_base = address_offset + + split_pin = name.split("_") + pin_name = "_".join(split_pin[4:]) + if pin_name not in all_pins: + continue + gpio_base = "_".join(split_pin[4:-1]) + + mux_registers_by_pin[pin_name] = register + + if last_gpio_base != gpio_base: + pin_names_h.append("") + last_gpio_base = gpio_base + + pin_number += 1 + + pin_names_h.append(f"FORMAT_PIN({pin_name})") + elif name.startswith("SW_PAD_CTL_PAD_GPIO"): + split_pin = name.split("_") + pin_name = "_".join(split_pin[4:]) + if pin_name not in all_pins: + continue + mux_register = mux_registers_by_pin[pin_name] + mux_reset = int(mux_register.find("resetValue").text, 16) + + pad_reset = int(register.find("resetValue").text, 16) + + # Look through alt modes to find GPIO. + mux_field = mux_register.find("fields").find("field") + assert mux_field.find("name").text == "MUX_MODE" + for alt in mux_field.iter("enumeratedValue"): + desc = alt.find("description").text + if "FLEXPWM" in desc: + desc_split = desc.split() + alt = desc_split[3] + connection = desc_split[6] + pwm_instance = int(connection[7:8]) + if connection.count("_") == 1: + # Form: FLEXPWM#_PWMC## + channel = connection[-3:-2] + module = int(connection[-2:]) + else: # two _ + # Form: FLEXPWM#_PWM#_C + channel = connection[-1:] + module = int(connection[-3:-2]) + pwm_outputs.append((pwm_instance, module, channel, connection, pin_name)) + elif "GPIO" in desc: + alt_name = desc.split()[-4] + # The 117x has a GPIO mux between GPIOn and CM7_GPIOn. For now, + # we use the the slow, default GPIOn. + if alt_name.startswith("GPIO_MUX"): + alt_name = alt_name.replace("GPIO_MUX", "GPIO") + gpio_instance, gpio_number = alt_name.split("_") + if gpio_instance == "GPIOMUX": + gpio_instance = "GPIO1" + gpio_number = int(gpio_number[2:]) + else: + desc_split = desc.split() + alt = desc_split[3] + connection = desc_split[6] + alt = int(alt[3:]) + if "_" not in connection: + print("skipping", pin_name, connection) + continue + instance, signal = connection.split("_", maxsplit=1) + signal = SIGNAL_RENAME.get(signal, signal) + if instance not in peripheral_inputs: + peripheral_inputs[instance] = {} + if signal not in peripheral_inputs[instance]: + peripheral_inputs[instance][signal] = {} + peripheral_inputs[instance][signal][pin_name] = [alt, None, 0] + + if pin_name in pin_to_analog: + adc_instance, adc_channel = pin_to_analog[pin_name] + else: + adc_instance = "NO_ADC" + adc_channel = 0 + + pins_c.append( + f"const mcu_pin_obj_t pin_{pin_name} = PIN({gpio_instance}, {gpio_number}, {pin_name}, {adc_instance}, {adc_channel}, 0x{mux_reset:08X}, 0x{pad_reset:08X});" + ) + + pins_c.append("") + + for pin_name in sorted(usb_pins): + pin_names_h.append(f"FORMAT_PIN({pin_name})") + pins_c.append(f"const mcu_pin_obj_t pin_{pin_name} = {{ {{ &mcu_pin_type }}, }};") + + pin_names_h.append("") + pins_c.append("") + + pins_h.append("") + pins_h.append(f"#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + {len(usb_pins)})") + pins_h.append(f"extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT];") + pins_h.append("") + + out_dir.mkdir(exist_ok=True) + + (out_dir / "pin_names.h").write_text("\n".join(pin_names_h)) + (out_dir / "pins.h").write_text("\n".join(pins_h)) + (out_dir / "pins.c").write_text("\n".join(pins_c)) + + periph_h = [copyright, "#pragma once"] + periph_c = [ + copyright, + '#include "py/obj.h"', + '#include "py/mphal.h"', + '#include "mimxrt10xx/periph.h"', + "", + ] + + for ptype in SIGNALS: + instances = all_peripherals[ptype] + short_name = ptype.lower() + if short_name.startswith("lp"): + short_name = short_name[2:] + # Only one MQS exists and it is related to SAI3 + if ptype != "MQS": + periph_h.append( + f"extern {ptype}_Type *const mcu_{short_name}_banks[{len(instances)}];" + ) + joined_instances = ", ".join(instances) + periph_c.append( + f"{ptype}_Type *const mcu_{short_name}_banks[{len(instances)}] = {{ {joined_instances} }};" + ) + periph_c.append("") + for signal in SIGNALS[ptype]: + pin_count = 0 + for instance in instances: + if instance not in peripheral_inputs or signal not in peripheral_inputs[instance]: + continue + pin_count += len(peripheral_inputs[instance][signal]) + periph_h.append( + f"extern const mcu_periph_obj_t mcu_{short_name}_{signal.lower()}_list[{pin_count}];" + ) + periph_c.append( + f"const mcu_periph_obj_t mcu_{short_name}_{signal.lower()}_list[{pin_count}] = {{" + ) + for instance in instances: + if instance not in peripheral_inputs or signal not in peripheral_inputs[instance]: + continue + # MQS is tied to SAI3 + if instance == "MQS": + instance_number = 3 + else: + instance_number = int(instance[len(ptype) :]) + if instance_number > 1: + periph_c.append("") + pins = peripheral_inputs[instance][signal] + pin_names = list(pins.keys()) + pin_names.sort(key=lambda x: pins[x][-1]) + for pin_name in pin_names: + alt, select_input, input_value = pins[pin_name] + if select_input: + select_input = f"kIOMUXC_{select_input}" + else: + select_input = "0" + periph_c.append( + f" PERIPH_PIN({instance_number}, {alt}, {select_input}, {input_value}, &pin_{pin_name})," + ) + periph_c.append(f"}};") + periph_c.append(f"") + periph_h.append("") + + pwm_outputs.sort(key=lambda x: x[:3]) + periph_c.append(f"const mcu_pwm_obj_t mcu_pwm_list[{len(pwm_outputs)}] = {{") + periph_h.append(f"extern const mcu_pwm_obj_t mcu_pwm_list[{len(pwm_outputs)}];") + last_channel = None + for pwm_instance, module, channel, connection, pin_name in pwm_outputs: + this_channel = (pwm_instance, module, channel) + if last_channel is not None and last_channel != this_channel: + periph_c.append("") + last_channel = this_channel + periph_c.append( + f" PWM_PIN(PWM{pwm_instance}, kPWM_Module_{module}, kPWM_Pwm{channel}, IOMUXC_{pin_name}_{connection}, &pin_{pin_name})," + ) + periph_c.append(f"}};") + periph_c.append("") + + (out_dir / "periph.h").write_text("\n".join(periph_h)) + (out_dir / "periph.c").write_text("\n".join(periph_c)) diff --git a/py/stackctrl.c b/py/stackctrl.c index 546987f04d..e534a2f5f9 100644 --- a/py/stackctrl.c +++ b/py/stackctrl.c @@ -30,8 +30,11 @@ void mp_stack_ctrl_init(void) { // Force routine to not be inlined. Better guarantee than MP_NOINLINE for -flto. __asm volatile (""); + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdangling-pointer" volatile int stack_dummy; MP_STATE_THREAD(stack_top) = (char *)&stack_dummy; + #pragma GCC diagnostic pop } void mp_stack_set_top(void *top) { diff --git a/supervisor/linker.h b/supervisor/linker.h index 9666c4ca12..2d88812da4 100644 --- a/supervisor/linker.h +++ b/supervisor/linker.h @@ -29,7 +29,7 @@ #ifndef MICROPY_INCLUDED_SUPERVISOR_LINKER_H #define MICROPY_INCLUDED_SUPERVISOR_LINKER_H -#if defined(IMXRT10XX) || defined(FOMU) || defined(STM32H7) || defined(RASPBERRYPI) +#if defined(IMXRT1XXX) || defined(FOMU) || defined(STM32H7) || defined(RASPBERRYPI) #define PLACE_IN_DTCM_DATA(name) name __attribute__((section(".dtcm_data." #name))) #define PLACE_IN_DTCM_BSS(name) name __attribute__((section(".dtcm_bss." #name))) // Don't inline ITCM functions because that may pull them out of ITCM into other sections. diff --git a/tools/cortex-m-fault-gdb.py b/tools/cortex-m-fault-gdb.py index 2ed2d13909..54a921e91f 100644 --- a/tools/cortex-m-fault-gdb.py +++ b/tools/cortex-m-fault-gdb.py @@ -74,12 +74,19 @@ class CortexMFault(gdb.Command): print("No preempted exceptions") else: print("Another exception was preempted") + print("icsr", hex(icsr)) vectactive = icsr & 0x1FF if vectactive != 0: if vectactive in EXCEPTIONS: print(EXCEPTIONS[vectactive]) else: print(vectactive - 16) + vectpending = (icsr >> 12) & 0x1FF + if vectpending != 0: + if vectpending in EXCEPTIONS: + print(EXCEPTIONS[vectpending]) + else: + print(vectpending - 16) vtor = self._read(VTOR) print("vtor", hex(vtor)) From f837f2438a93303fb6c814a222cc990347b8f308 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 28 Apr 2023 11:16:45 -0700 Subject: [PATCH 0948/1712] Update USB PIDs --- ports/mimxrt10xx/boards/imxrt1015_evk/mpconfigboard.mk | 2 +- ports/mimxrt10xx/boards/imxrt1040_evk/mpconfigboard.mk | 2 +- ports/mimxrt10xx/boards/imxrt1050_evkb/mpconfigboard.mk | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/mimxrt10xx/boards/imxrt1015_evk/mpconfigboard.mk b/ports/mimxrt10xx/boards/imxrt1015_evk/mpconfigboard.mk index 0f446e13bf..8d73671c8a 100644 --- a/ports/mimxrt10xx/boards/imxrt1015_evk/mpconfigboard.mk +++ b/ports/mimxrt10xx/boards/imxrt1015_evk/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x239A -USB_PID = 0x8078 +USB_PID = 0x8138 USB_PRODUCT = "IMXRT1015-EVK" USB_MANUFACTURER = "NXP" diff --git a/ports/mimxrt10xx/boards/imxrt1040_evk/mpconfigboard.mk b/ports/mimxrt10xx/boards/imxrt1040_evk/mpconfigboard.mk index cf351d906e..9667647c83 100644 --- a/ports/mimxrt10xx/boards/imxrt1040_evk/mpconfigboard.mk +++ b/ports/mimxrt10xx/boards/imxrt1040_evk/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x239A -USB_PID = 0x8084 +USB_PID = 0x8136 USB_PRODUCT = "iMX RT 1040 EVK" USB_MANUFACTURER = "NXP" diff --git a/ports/mimxrt10xx/boards/imxrt1050_evkb/mpconfigboard.mk b/ports/mimxrt10xx/boards/imxrt1050_evkb/mpconfigboard.mk index 6627d46681..22b26b41a5 100644 --- a/ports/mimxrt10xx/boards/imxrt1050_evkb/mpconfigboard.mk +++ b/ports/mimxrt10xx/boards/imxrt1050_evkb/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x239A -USB_PID = 0x8084 +USB_PID = 0x8134 USB_PRODUCT = "iMX RT 1050 EVKB" USB_MANUFACTURER = "NXP" From 18207cd547e1ffbfbf1ead9f5a32eea69d079ec6 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 28 Apr 2023 11:28:48 -0700 Subject: [PATCH 0949/1712] Guard GCC13 pragma --- py/stackctrl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/py/stackctrl.c b/py/stackctrl.c index e534a2f5f9..fa5f16d662 100644 --- a/py/stackctrl.c +++ b/py/stackctrl.c @@ -31,7 +31,10 @@ void mp_stack_ctrl_init(void) { // Force routine to not be inlined. Better guarantee than MP_NOINLINE for -flto. __asm volatile (""); #pragma GCC diagnostic push + #if __GNUC__ > 12 + // Introduced in GCC 13 #pragma GCC diagnostic ignored "-Wdangling-pointer" + #endif volatile int stack_dummy; MP_STATE_THREAD(stack_top) = (char *)&stack_dummy; #pragma GCC diagnostic pop From 1fb6d4d77ed006a95722c203e79158da06b39802 Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Fri, 28 Apr 2023 16:58:39 -0400 Subject: [PATCH 0950/1712] I2S pin names per Dan's suggestions on iMX PR --- ports/raspberrypi/boards/pimoroni_pico_dv_base/pins.c | 6 +++--- ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base/pins.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base/pins.c index c331d5cbf9..d5fe927474 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base/pins.c +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base/pins.c @@ -53,17 +53,17 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, - { MP_ROM_QSTR(MP_QSTR_I2S_WS), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, - { MP_ROM_QSTR(MP_QSTR_I2S_BCLK), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_I2S_BIT_CLOCK), MP_ROM_PTR(&pin_GPIO27) }, { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, - { MP_ROM_QSTR(MP_QSTR_I2S_OUT), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO28) }, { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c index 346a2ae44c..6ab85f3c34 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c @@ -50,17 +50,17 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2) }, - { MP_ROM_QSTR(MP_QSTR_I2S_WS), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, - { MP_ROM_QSTR(MP_QSTR_I2S_BCLK), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_I2S_BIT_CLOCK), MP_ROM_PTR(&pin_GPIO27) }, { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, - { MP_ROM_QSTR(MP_QSTR_I2S_OUT), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO28) }, { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, From 8104b824e0b304a6edfaf6a9a1d1fd9b925ff22b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 28 Apr 2023 16:19:43 -0700 Subject: [PATCH 0951/1712] Standardize CPU temp and voltage. Add autogen warning --- .../common-hal/microcontroller/Processor.c | 2 +- .../common-hal/microcontroller/Processor.c | 2 +- .../common-hal/microcontroller/Processor.c | 2 +- .../mimxrt10xx/MIMXRT1011/periph.c | 8 ++++++++ .../mimxrt10xx/MIMXRT1011/periph.h | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1011/pins.c | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1011/pins.h | 8 ++++++++ .../mimxrt10xx/MIMXRT1015/periph.c | 8 ++++++++ .../mimxrt10xx/MIMXRT1015/periph.h | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1015/pins.c | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1015/pins.h | 8 ++++++++ .../mimxrt10xx/MIMXRT1021/periph.c | 8 ++++++++ .../mimxrt10xx/MIMXRT1021/periph.h | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1021/pins.c | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1021/pins.h | 8 ++++++++ .../mimxrt10xx/MIMXRT1042/periph.c | 8 ++++++++ .../mimxrt10xx/MIMXRT1042/periph.h | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1042/pins.c | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1042/pins.h | 8 ++++++++ .../mimxrt10xx/MIMXRT1052/periph.c | 8 ++++++++ .../mimxrt10xx/MIMXRT1052/periph.h | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1052/pins.c | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1052/pins.h | 8 ++++++++ .../mimxrt10xx/MIMXRT1062/periph.c | 8 ++++++++ .../mimxrt10xx/MIMXRT1062/periph.h | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1062/pins.c | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1062/pins.h | 8 ++++++++ .../mimxrt10xx/MIMXRT1176/periph.c | 8 ++++++++ .../mimxrt10xx/MIMXRT1176/periph.h | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1176/pins.c | 8 ++++++++ .../peripherals/mimxrt10xx/MIMXRT1176/pins.h | 8 ++++++++ .../mimxrt10xx/tools/gen_peripherals_data.py | 20 +++++++++++++++++-- .../common-hal/microcontroller/Processor.c | 2 +- .../common-hal/microcontroller/Processor.c | 2 +- .../common-hal/microcontroller/Processor.c | 4 ++-- 35 files changed, 249 insertions(+), 9 deletions(-) diff --git a/ports/broadcom/common-hal/microcontroller/Processor.c b/ports/broadcom/common-hal/microcontroller/Processor.c index 70984dd0e4..d49baaee35 100644 --- a/ports/broadcom/common-hal/microcontroller/Processor.c +++ b/ports/broadcom/common-hal/microcontroller/Processor.c @@ -34,7 +34,7 @@ float common_hal_mcu_processor_get_temperature(void) { } float common_hal_mcu_processor_get_voltage(void) { - return 1.2f; + return NAN; } uint32_t common_hal_mcu_processor_get_frequency(void) { diff --git a/ports/espressif/common-hal/microcontroller/Processor.c b/ports/espressif/common-hal/microcontroller/Processor.c index c0e72c85b9..5b7463c9ff 100644 --- a/ports/espressif/common-hal/microcontroller/Processor.c +++ b/ports/espressif/common-hal/microcontroller/Processor.c @@ -47,7 +47,7 @@ float common_hal_mcu_processor_get_temperature(void) { float tsens_out; #if defined(CONFIG_IDF_TARGET_ESP32) - mp_raise_NotImplementedError(NULL); + return NAN; #else temp_sensor_config_t temp_sensor = TSENS_CONFIG_DEFAULT(); // DEFAULT: range:-10℃ ~ 80℃, error < 1℃. temp_sensor_set_config(temp_sensor); diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c index bd7d77f4fa..8d20e10c48 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Processor.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Processor.c @@ -54,7 +54,7 @@ float common_hal_mcu_processor_get_temperature(void) { return temp; #else - return 0; + return NAN; #endif } diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c index fd8ef69f7e..a1468971dc 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1011` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/periph.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h index e03e2c7967..f3bee9e464 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1011` to update this file. + */ + #pragma once extern LPI2C_Type *const mcu_i2c_banks[2]; extern const mcu_periph_obj_t mcu_i2c_sda_list[8]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c index a2b38a8a67..ac45fbb833 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1011` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/pins.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h index 118eff9335..8e901f0980 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1011` to update this file. + */ + #pragma once #define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.c index 9c56c47dc0..c6b2c6b872 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1015` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/periph.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.h index af53706d6f..cef33f1ffa 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1015` to update this file. + */ + #pragma once extern LPI2C_Type *const mcu_i2c_banks[2]; extern const mcu_periph_obj_t mcu_i2c_sda_list[2]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.c index efa7abcedf..ab9d9765b1 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1015` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/pins.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.h index 118eff9335..8655bf872f 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1015` to update this file. + */ + #pragma once #define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c index 8615e6cfc5..9129c64272 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1021` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/periph.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h index 496e0ab153..3dea33fa00 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1021` to update this file. + */ + #pragma once extern LPI2C_Type *const mcu_i2c_banks[4]; extern const mcu_periph_obj_t mcu_i2c_sda_list[8]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c index e349f43542..f76da7a29e 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1021` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/pins.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h index 118eff9335..b4f991a879 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1021` to update this file. + */ + #pragma once #define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.c index bbd41e7007..104960b417 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1042` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/periph.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.h index 69a15dc50c..3df1a06d98 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1042` to update this file. + */ + #pragma once extern LPI2C_Type *const mcu_i2c_banks[4]; extern const mcu_periph_obj_t mcu_i2c_sda_list[9]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.c index 64d35c2d67..6033d199e4 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1042` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/pins.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.h index 118eff9335..f666962907 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1042` to update this file. + */ + #pragma once #define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.c index 35b097f675..3ff474d7f4 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1052` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/periph.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.h index ae6566f974..7d428eae1c 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1052` to update this file. + */ + #pragma once extern LPI2C_Type *const mcu_i2c_banks[4]; extern const mcu_periph_obj_t mcu_i2c_sda_list[9]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.c index 83bbe18e42..48d8a2a3d6 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1052` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/pins.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.h index 6e40d30c2b..4ee8d2ae28 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1052` to update this file. + */ + #pragma once #define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c index 12c9a09621..ab8fb2b4d8 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1062` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/periph.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h index 7917a2ebdb..36a42eba64 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1062` to update this file. + */ + #pragma once extern LPI2C_Type *const mcu_i2c_banks[4]; extern const mcu_periph_obj_t mcu_i2c_sda_list[9]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c index 472677ff24..7208ac418e 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1062` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/pins.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h index 6e40d30c2b..6f746f3b4c 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1062` to update this file. + */ + #pragma once #define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.c index 3263bdea09..f53136c94f 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1176` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/periph.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.h index 41695d655b..266300df18 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1176` to update this file. + */ + #pragma once extern LPI2C_Type *const mcu_i2c_banks[6]; extern const mcu_periph_obj_t mcu_i2c_sda_list[8]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.c index 71562462e6..e9241c07c7 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.c @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1176` to update this file. + */ + #include "py/obj.h" #include "py/mphal.h" #include "mimxrt10xx/pins.h" diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.h index 0d99219c8a..35be6dd36e 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.h @@ -26,6 +26,14 @@ * THE SOFTWARE. */ +/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py MIMXRT1176` to update this file. + */ + #pragma once #define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name; diff --git a/ports/mimxrt10xx/tools/gen_peripherals_data.py b/ports/mimxrt10xx/tools/gen_peripherals_data.py index 0b4f215279..4193ae7228 100644 --- a/ports/mimxrt10xx/tools/gen_peripherals_data.py +++ b/ports/mimxrt10xx/tools/gen_peripherals_data.py @@ -60,8 +60,18 @@ copyright = """/* */ """ +autogen_warning_template = """/* + * This file is autogenerated! Do NOT hand edit it. Instead, edit tools/gen_peripherals_data.py and + * then rerun the script. You'll need to 1) clone https://github.com/nxp-mcuxpresso/mcux-soc-svd/ + * and 2) download and extract config tools data from https://mcuxpresso.nxp.com/en/select_config_tools_data. + * + * Run `python tools/gen_peripherals_data.py {}` to update this file. + */ +""" + for device in devices: print(device) + autogen_warning = autogen_warning_template.format(device) svd_fn = svd_folder / device / (device + ".xml") if not svd_fn.exists(): svd_fn = svd_folder / device / (device + "_cm7.xml") @@ -129,6 +139,7 @@ for device in devices: pins_h = [ copyright, + autogen_warning, "#pragma once", "", "#define FORMAT_PIN(pin_name) extern const mcu_pin_obj_t pin_##pin_name;", @@ -137,6 +148,7 @@ for device in devices: ] pins_c = [ copyright, + autogen_warning, '#include "py/obj.h"', '#include "py/mphal.h"', '#include "mimxrt10xx/pins.h"', @@ -255,7 +267,8 @@ for device in devices: f"const mcu_pin_obj_t pin_{pin_name} = PIN({gpio_instance}, {gpio_number}, {pin_name}, {adc_instance}, {adc_channel}, 0x{mux_reset:08X}, 0x{pad_reset:08X});" ) - pins_c.append("") + if usb_pins: + pins_c.append("") for pin_name in sorted(usb_pins): pin_names_h.append(f"FORMAT_PIN({pin_name})") @@ -275,9 +288,10 @@ for device in devices: (out_dir / "pins.h").write_text("\n".join(pins_h)) (out_dir / "pins.c").write_text("\n".join(pins_c)) - periph_h = [copyright, "#pragma once"] + periph_h = [copyright, autogen_warning, "#pragma once"] periph_c = [ copyright, + autogen_warning, '#include "py/obj.h"', '#include "py/mphal.h"', '#include "mimxrt10xx/periph.h"', @@ -352,5 +366,7 @@ for device in devices: periph_c.append(f"}};") periph_c.append("") + periph_h.append("") + (out_dir / "periph.h").write_text("\n".join(periph_h)) (out_dir / "periph.c").write_text("\n".join(periph_c)) diff --git a/ports/raspberrypi/common-hal/microcontroller/Processor.c b/ports/raspberrypi/common-hal/microcontroller/Processor.c index b22d385eec..ace9060c91 100644 --- a/ports/raspberrypi/common-hal/microcontroller/Processor.c +++ b/ports/raspberrypi/common-hal/microcontroller/Processor.c @@ -53,7 +53,7 @@ float common_hal_mcu_processor_get_temperature(void) { } float common_hal_mcu_processor_get_voltage(void) { - return 3.3f; + return NAN; } uint32_t common_hal_mcu_processor_get_frequency(void) { diff --git a/ports/silabs/common-hal/microcontroller/Processor.c b/ports/silabs/common-hal/microcontroller/Processor.c index 1414a28df6..841f3ba35f 100644 --- a/ports/silabs/common-hal/microcontroller/Processor.c +++ b/ports/silabs/common-hal/microcontroller/Processor.c @@ -46,7 +46,7 @@ float common_hal_mcu_processor_get_temperature(void) { float common_hal_mcu_processor_get_voltage(void) { // xG24 does not have built-in direct reading of processor voltage // Have Only 1 of IADC, already used for analogio module - return 3.3f; + return NAN; } uint32_t common_hal_mcu_processor_get_frequency(void) { diff --git a/ports/stm/common-hal/microcontroller/Processor.c b/ports/stm/common-hal/microcontroller/Processor.c index 67cf9a73e4..8e21ca8d82 100644 --- a/ports/stm/common-hal/microcontroller/Processor.c +++ b/ports/stm/common-hal/microcontroller/Processor.c @@ -96,7 +96,7 @@ float common_hal_mcu_processor_get_temperature(void) { float core_temp_avg_slope = (*ADC_CAL2 - *ADC_CAL1) / 80.0; return (((float)value * adc_refcor - *ADC_CAL1) / core_temp_avg_slope) + 30.0f; #else - return false; + return NAN; #endif } @@ -129,7 +129,7 @@ float common_hal_mcu_processor_get_voltage(void) { return adc_refcor * 3.3f; #else - return false; + return NAN; #endif } From b08714bb8fcca13b6765fd2a1c8beaa848b5d758 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 28 Apr 2023 17:13:17 -0700 Subject: [PATCH 0952/1712] Take in framebuffer resolution, not output res Fixes #7911 --- .../bindings/picodvi/Framebuffer.c | 16 ++++---- .../adafruit_feather_rp2040_dvi/board.c | 2 +- .../common-hal/picodvi/Framebuffer.c | 37 ++++++++++--------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/ports/raspberrypi/bindings/picodvi/Framebuffer.c b/ports/raspberrypi/bindings/picodvi/Framebuffer.c index e4584370af..4e522d0f5f 100644 --- a/ports/raspberrypi/bindings/picodvi/Framebuffer.c +++ b/ports/raspberrypi/bindings/picodvi/Framebuffer.c @@ -53,7 +53,7 @@ //| blue_dn: microcontroller.Pin, //| color_depth: int = 8, //| ) -> None: -//| """Create a Framebuffer object with the given dimensions (640x480 or 800x480). Memory is +//| """Create a Framebuffer object with the given dimensions. Memory is //| allocated outside of onto the heap and then moved outside on VM //| end. //| @@ -67,22 +67,22 @@ //| less than dn for all pairs or dp must be greater than dn for all pairs. //| //| The framebuffer pixel format varies depending on color_depth: +//| //| * 1 - Each bit is a pixel. Either white (1) or black (0). //| * 2 - Each 2 bits is a pixels. Grayscale between white (0x3) and black (0x0). //| * 8 - Each byte is a pixels in RGB332 format. //| * 16 - Each two bytes are a pixel in RGB565 format. //| -//| Monochrome framebuffers (color_depth=1 or 2) will be full resolution. -//| Color framebuffers will be half resolution and pixels will be -//| duplicated to create a signal with the target dimensions. +//| Two output resolutions are currently supported, 640x480 and 800x480. +//| Monochrome framebuffers (color_depth=1 or 2) must be full resolution. +//| Color framebuffers must be half resolution (320x240 or 400x240) and +//| pixels will be duplicated to create the signal. //| //| A Framebuffer is often used in conjunction with a //| `framebufferio.FramebufferDisplay`. //| -//| :param int width: the width of the target display signal. It will be halved when -//| color_depth >= 8 when creating the framebuffer. Only 640 or 800 is currently supported. -//| :param int height: the height of the target display signal. It will be halved when -//| color_depth >= 8 when creating the framebuffer. Only 480 is currently supported. +//| :param int width: the width of the target display signal. Only 320, 400, 640 or 800 is currently supported depending on color_depth. +//| :param int height: the height of the target display signal. Only 240 or 480 is currently supported depenting on color_depth. //| :param ~microcontroller.Pin clk_dp: the positive clock signal pin //| :param ~microcontroller.Pin clk_dn: the negative clock signal pin //| :param ~microcontroller.Pin red_dp: the positive red signal pin diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/board.c b/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/board.c index 140a15cc04..c6112a5555 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/board.c +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_dvi/board.c @@ -33,7 +33,7 @@ void board_init(void) { picodvi_framebuffer_obj_t *fb = &allocate_display_bus()->picodvi; fb->base.type = &picodvi_framebuffer_type; - common_hal_picodvi_framebuffer_construct(fb, 640, 480, + common_hal_picodvi_framebuffer_construct(fb, 320, 240, &pin_GPIO17, &pin_GPIO16, &pin_GPIO19, &pin_GPIO18, &pin_GPIO21, &pin_GPIO20, diff --git a/ports/raspberrypi/common-hal/picodvi/Framebuffer.c b/ports/raspberrypi/common-hal/picodvi/Framebuffer.c index 20f447a824..5629d67d1c 100644 --- a/ports/raspberrypi/common-hal/picodvi/Framebuffer.c +++ b/ports/raspberrypi/common-hal/picodvi/Framebuffer.c @@ -138,23 +138,25 @@ void common_hal_picodvi_framebuffer_construct(picodvi_framebuffer_obj_t *self, const mcu_pin_obj_t *green_dp, const mcu_pin_obj_t *green_dn, const mcu_pin_obj_t *blue_dp, const mcu_pin_obj_t *blue_dn, mp_uint_t color_depth) { - - const struct dvi_timing *timing = NULL; - if (width == 640 && height == 480) { - timing = &dvi_timing_640x480p_60hz; - } else if (width == 800 && height == 480) { - timing = &dvi_timing_800x480p_60hz; - } else { - if (height == 480) { - mp_raise_ValueError_varg(translate("%q must be %d"), MP_QSTR_width, 480); - } - mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_height); - } - if (active_picodvi != NULL) { mp_raise_msg_varg(&mp_type_RuntimeError, translate("%q in use"), MP_QSTR_picodvi); } + bool color_framebuffer = color_depth >= 8; + const struct dvi_timing *timing = NULL; + if ((!color_framebuffer && width == 640 && height == 480) || + (color_framebuffer && width == 320 && height == 240)) { + timing = &dvi_timing_640x480p_60hz; + } else if ((!color_framebuffer && width == 800 && height == 480) || + (color_framebuffer && width == 400 && height == 240)) { + timing = &dvi_timing_800x480p_60hz; + } else { + if (height != 480 && height != 240) { + mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_height); + } + mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_width); + } + bool invert_diffpairs = clk_dn->number < clk_dp->number; int8_t other_pins[4]; int8_t *a; @@ -214,12 +216,12 @@ void common_hal_picodvi_framebuffer_construct(picodvi_framebuffer_obj_t *self, self->height = height; size_t tmds_bufs_per_scanline; - if (color_depth >= 8) { + size_t scanline_width = width; + if (color_framebuffer) { dvi_vertical_repeat = 2; dvi_monochrome_tmds = false; - self->width /= 2; - self->height /= 2; tmds_bufs_per_scanline = 3; + scanline_width *= 2; } else { dvi_vertical_repeat = 1; dvi_monochrome_tmds = true; @@ -233,8 +235,7 @@ void common_hal_picodvi_framebuffer_construct(picodvi_framebuffer_obj_t *self, } self->pitch /= sizeof(uint32_t); size_t framebuffer_size = self->pitch * self->height; - // use width here because it hasn't been downsized for the frame buffer - self->tmdsbuf_size = tmds_bufs_per_scanline * width / DVI_SYMBOLS_PER_WORD + 1; + self->tmdsbuf_size = tmds_bufs_per_scanline * scanline_width / DVI_SYMBOLS_PER_WORD + 1; size_t total_allocation_size = sizeof(uint32_t) * (framebuffer_size + DVI_N_TMDS_BUFFERS * self->tmdsbuf_size); self->allocation = allocate_memory(total_allocation_size, false, true); if (self->allocation == NULL) { From a7c3955c4163220925d3a28fc90987e6aaba6c40 Mon Sep 17 00:00:00 2001 From: Yutaro Urata Date: Fri, 28 Apr 2023 17:01:51 +0000 Subject: [PATCH 0953/1712] Translated using Weblate (Japanese) Currently translated at 40.8% (408 of 999 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ja/ --- locale/ja.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/ja.po b/locale/ja.po index 805dc10e8e..effefafb1c 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -8,15 +8,15 @@ 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: 2023-01-05 02:52+0000\n" -"Last-Translator: Matt Watson \n" +"PO-Revision-Date: 2023-04-29 17:47+0000\n" +"Last-Translator: Yutaro Urata \n" "Language-Team: none\n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.15.1-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -350,11 +350,11 @@ msgstr "" #: shared-module/struct/__init__.c msgid "'S' and 'O' are not supported format types" -msgstr "" +msgstr "'S'と'O'はフォーマットタイプではありません" #: py/compile.c msgid "'align' requires 1 argument" -msgstr "" +msgstr "'align'は引数が一つ必要です" #: py/compile.c msgid "'await' outside function" From 0aa71ed6e657c0ba4c118bce1b564688f68b9d91 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 1 May 2023 11:30:04 -0700 Subject: [PATCH 0954/1712] Tweak the picodvi docs and arg checking --- .../bindings/picodvi/Framebuffer.c | 23 ++++++++----------- .../common-hal/picodvi/Framebuffer.c | 14 +++++++---- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/ports/raspberrypi/bindings/picodvi/Framebuffer.c b/ports/raspberrypi/bindings/picodvi/Framebuffer.c index 4e522d0f5f..f6fa7f986a 100644 --- a/ports/raspberrypi/bindings/picodvi/Framebuffer.c +++ b/ports/raspberrypi/bindings/picodvi/Framebuffer.c @@ -36,8 +36,6 @@ #include "shared-module/framebufferio/FramebufferDisplay.h" //| class Framebuffer: -//| """A PicoDVI managed frame buffer.""" -//| //| def __init__( //| self, //| width: int, @@ -54,13 +52,14 @@ //| color_depth: int = 8, //| ) -> None: //| """Create a Framebuffer object with the given dimensions. Memory is -//| allocated outside of onto the heap and then moved outside on VM -//| end. +//| allocated outside of onto the heap and then moved outside on VM end. //| -//| This will change the system clock speed to match the DVI signal. -//| Make sure to initialize other objects after this one so they account -//| for the changed clock. This also allocates a very large framebuffer -//| and is most likely to succeed the earlier it is attempted. +//| .. warning:: This will change the system clock speed to match the DVI signal. +//| Make sure to initialize other objects after this one so they account +//| for the changed clock. +//| +//| This allocates a very large framebuffer and is most likely to succeed +//| the earlier it is attempted. //| //| Each dp and dn pair of pins must be neighboring, such as 19 and 20. //| They must also be ordered the same way. In other words, dp must be @@ -82,7 +81,7 @@ //| `framebufferio.FramebufferDisplay`. //| //| :param int width: the width of the target display signal. Only 320, 400, 640 or 800 is currently supported depending on color_depth. -//| :param int height: the height of the target display signal. Only 240 or 480 is currently supported depenting on color_depth. +//| :param int height: the height of the target display signal. Only 240 or 480 is currently supported depending on color_depth. //| :param ~microcontroller.Pin clk_dp: the positive clock signal pin //| :param ~microcontroller.Pin clk_dn: the negative clock signal pin //| :param ~microcontroller.Pin red_dp: the positive red signal pin @@ -160,8 +159,7 @@ static void check_for_deinit(picodvi_framebuffer_obj_t *self) { } //| width: int -//| """The width of the framebuffer, in pixels. It may be doubled for output (and half of what -//| width was given to __init__.)""" +//| """The width of the framebuffer, in pixels. It may be doubled for output.""" STATIC mp_obj_t picodvi_framebuffer_get_width(mp_obj_t self_in) { picodvi_framebuffer_obj_t *self = (picodvi_framebuffer_obj_t *)self_in; check_for_deinit(self); @@ -172,8 +170,7 @@ MP_PROPERTY_GETTER(picodvi_framebuffer_width_obj, (mp_obj_t)&picodvi_framebuffer_get_width_obj); //| height: int -//| """The width of the framebuffer, in pixels. It may be doubled for output (and half of what -//| width was given to __init__.)""" +//| """The width of the framebuffer, in pixels. It may be doubled for output.""" //| STATIC mp_obj_t picodvi_framebuffer_get_height(mp_obj_t self_in) { picodvi_framebuffer_obj_t *self = (picodvi_framebuffer_obj_t *)self_in; diff --git a/ports/raspberrypi/common-hal/picodvi/Framebuffer.c b/ports/raspberrypi/common-hal/picodvi/Framebuffer.c index 5629d67d1c..6ad824d080 100644 --- a/ports/raspberrypi/common-hal/picodvi/Framebuffer.c +++ b/ports/raspberrypi/common-hal/picodvi/Framebuffer.c @@ -144,11 +144,11 @@ void common_hal_picodvi_framebuffer_construct(picodvi_framebuffer_obj_t *self, bool color_framebuffer = color_depth >= 8; const struct dvi_timing *timing = NULL; - if ((!color_framebuffer && width == 640 && height == 480) || - (color_framebuffer && width == 320 && height == 240)) { + if ((width == 640 && height == 480) || + (width == 320 && height == 240)) { timing = &dvi_timing_640x480p_60hz; - } else if ((!color_framebuffer && width == 800 && height == 480) || - (color_framebuffer && width == 400 && height == 240)) { + } else if ((width == 800 && height == 480) || + (width == 400 && height == 240)) { timing = &dvi_timing_800x480p_60hz; } else { if (height != 480 && height != 240) { @@ -157,6 +157,12 @@ void common_hal_picodvi_framebuffer_construct(picodvi_framebuffer_obj_t *self, mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_width); } + // If the width is > 400, then it must not be color frame buffer and vice + // versa. + if ((width > 400) == color_framebuffer) { + mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_color_depth); + } + bool invert_diffpairs = clk_dn->number < clk_dp->number; int8_t other_pins[4]; int8_t *a; From 051540f8da54d1dd5ca2344afac93dd296700662 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 1 May 2023 11:38:13 -0700 Subject: [PATCH 0955/1712] Fix broadcom NAN --- ports/broadcom/common-hal/microcontroller/Processor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/broadcom/common-hal/microcontroller/Processor.c b/ports/broadcom/common-hal/microcontroller/Processor.c index d49baaee35..259ecb6c5f 100644 --- a/ports/broadcom/common-hal/microcontroller/Processor.c +++ b/ports/broadcom/common-hal/microcontroller/Processor.c @@ -26,6 +26,8 @@ #include "shared-bindings/microcontroller/Processor.h" +#include + #include "peripherals/broadcom/vcmailbox.h" float common_hal_mcu_processor_get_temperature(void) { From cba7a812fc8cd5ec9adf2673e834427c84d0011c Mon Sep 17 00:00:00 2001 From: Liz Date: Tue, 2 May 2023 17:02:59 -0400 Subject: [PATCH 0956/1712] Minor update for Feather RP2040 ThinkInk hihi - updating board name from EPD to ThinkInk and adding pin def for board.BUTTON --- .../boards/adafruit_feather_rp2040_epd/mpconfigboard.h | 2 +- .../boards/adafruit_feather_rp2040_epd/mpconfigboard.mk | 2 +- ports/raspberrypi/boards/adafruit_feather_rp2040_epd/pins.c | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/mpconfigboard.h b/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/mpconfigboard.h index 356f0f5b54..e76281e893 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/mpconfigboard.h +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/mpconfigboard.h @@ -1,4 +1,4 @@ -#define MICROPY_HW_BOARD_NAME "Adafruit Feather RP2040 EPD" +#define MICROPY_HW_BOARD_NAME "Adafruit Feather RP2040 ThinkInk" #define MICROPY_HW_MCU_NAME "rp2040" #define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO20) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/mpconfigboard.mk index 3b457b93cb..1f71dcb76b 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/mpconfigboard.mk +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/mpconfigboard.mk @@ -1,6 +1,6 @@ USB_VID = 0x239A USB_PID = 0x812C -USB_PRODUCT = "Feather RP2040 EPD" +USB_PRODUCT = "Feather RP2040 ThinkInk" USB_MANUFACTURER = "Adafruit" CHIP_VARIANT = RP2040 diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/pins.c b/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/pins.c index 22ae43adad..72793fbd56 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/pins.c +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/pins.c @@ -21,6 +21,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, From facd3a4e784a8decd5b9eeed16824963c105d1d5 Mon Sep 17 00:00:00 2001 From: Liz Date: Tue, 2 May 2023 17:07:49 -0400 Subject: [PATCH 0957/1712] Updating directory name --- .../board.c | 0 .../mpconfigboard.h | 0 .../mpconfigboard.mk | 0 .../pico-sdk-configboard.h | 0 .../pins.c | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename ports/raspberrypi/boards/{adafruit_feather_rp2040_epd => adafruit_feather_rp2040_thinkink}/board.c (100%) rename ports/raspberrypi/boards/{adafruit_feather_rp2040_epd => adafruit_feather_rp2040_thinkink}/mpconfigboard.h (100%) rename ports/raspberrypi/boards/{adafruit_feather_rp2040_epd => adafruit_feather_rp2040_thinkink}/mpconfigboard.mk (100%) rename ports/raspberrypi/boards/{adafruit_feather_rp2040_epd => adafruit_feather_rp2040_thinkink}/pico-sdk-configboard.h (100%) rename ports/raspberrypi/boards/{adafruit_feather_rp2040_epd => adafruit_feather_rp2040_thinkink}/pins.c (100%) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/board.c b/ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/board.c similarity index 100% rename from ports/raspberrypi/boards/adafruit_feather_rp2040_epd/board.c rename to ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/board.c diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/mpconfigboard.h b/ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/mpconfigboard.h similarity index 100% rename from ports/raspberrypi/boards/adafruit_feather_rp2040_epd/mpconfigboard.h rename to ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/mpconfigboard.h diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/mpconfigboard.mk similarity index 100% rename from ports/raspberrypi/boards/adafruit_feather_rp2040_epd/mpconfigboard.mk rename to ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/mpconfigboard.mk diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/pico-sdk-configboard.h b/ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/pico-sdk-configboard.h similarity index 100% rename from ports/raspberrypi/boards/adafruit_feather_rp2040_epd/pico-sdk-configboard.h rename to ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/pico-sdk-configboard.h diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_epd/pins.c b/ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/pins.c similarity index 100% rename from ports/raspberrypi/boards/adafruit_feather_rp2040_epd/pins.c rename to ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/pins.c From 480c4f10816325ac685150c2f3a261a99113fa14 Mon Sep 17 00:00:00 2001 From: Liz Date: Tue, 2 May 2023 17:27:53 -0400 Subject: [PATCH 0958/1712] Update pins.c --- .../raspberrypi/boards/adafruit_feather_rp2040_thinkink/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/pins.c b/ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/pins.c index 72793fbd56..919b495abc 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/pins.c +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_thinkink/pins.c @@ -21,7 +21,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, From c369527ace24363bc2739c473a8a8d6275b38e46 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 2 May 2023 19:17:51 -0500 Subject: [PATCH 0959/1712] remove line added while debugging failed doc builds Co-authored-by: Scott Shawcroft --- shared-bindings/synthio/__init__.c | 1 - 1 file changed, 1 deletion(-) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 703966defc..15d4e3f3c7 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -41,7 +41,6 @@ //| //| At least 2 simultaneous notes are supported. samd5x, mimxrt10xx and rp2040 platforms support up to 12 notes. //| -//| I'm a little teapot. I'm not on line 11, but I don't know what is. //| """ //| //| class Envelope: From b2f32a5397c14576fe1107ef852e22b2b36cf96b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 2 May 2023 19:22:10 -0500 Subject: [PATCH 0960/1712] Apply suggestions from code review Co-authored-by: Scott Shawcroft --- shared-bindings/synthio/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 15d4e3f3c7..95dc097313 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -132,7 +132,7 @@ const mp_obj_namedtuple_type_t synthio_envelope_type_obj = { //| *, //| sample_rate: int = 11025, //| waveform: Optional[ReadableBuffer] = None, -//| envelope: Optional[ReadableBuffer] = None, +//| envelope: Optional[Envelope] = None, //| ) -> MidiTrack: //| """Create an AudioSample from an already opened MIDI file. //| Currently, only single-track MIDI (type 0) is supported. From d8550f4e7c08509be184bda7f9e0b2aafac5aaf5 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 2 May 2023 15:59:34 -0500 Subject: [PATCH 0961/1712] synthio: fix offset in default square waveform --- shared-module/synthio/__init__.c | 2 +- tests/circuitpython-manual/synthio/.gitignore | 1 + .../synthio/wave/.gitignore | 1 - tests/circuitpython/miditrack.py.exp | 2 +- tests/circuitpython/synthesizer.py.exp | 44 +++++++++---------- 5 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 tests/circuitpython-manual/synthio/.gitignore delete mode 100644 tests/circuitpython-manual/synthio/wave/.gitignore diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 1385059b99..c7e1096632 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -31,7 +31,7 @@ #include #include -STATIC const int16_t square_wave[] = {-32768, 0}; +STATIC const int16_t square_wave[] = {-32768, 32767}; STATIC const uint16_t notes[] = {8372, 8870, 9397, 9956, 10548, 11175, 11840, 12544, 13290, 14080, 14917, 15804}; // 9th octave diff --git a/tests/circuitpython-manual/synthio/.gitignore b/tests/circuitpython-manual/synthio/.gitignore new file mode 100644 index 0000000000..d8dd7532ab --- /dev/null +++ b/tests/circuitpython-manual/synthio/.gitignore @@ -0,0 +1 @@ +*.wav diff --git a/tests/circuitpython-manual/synthio/wave/.gitignore b/tests/circuitpython-manual/synthio/wave/.gitignore deleted file mode 100644 index c212df9c3d..0000000000 --- a/tests/circuitpython-manual/synthio/wave/.gitignore +++ /dev/null @@ -1 +0,0 @@ -tune.wav diff --git a/tests/circuitpython/miditrack.py.exp b/tests/circuitpython/miditrack.py.exp index 2d9e2548a0..6de9f947c6 100644 --- a/tests/circuitpython/miditrack.py.exp +++ b/tests/circuitpython/miditrack.py.exp @@ -1,4 +1,4 @@ (0, 1, 512, 1) -1 [-16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0] +1 [-16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382] (0, 1, 512, 1) 1 [0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0] diff --git a/tests/circuitpython/synthesizer.py.exp b/tests/circuitpython/synthesizer.py.exp index 70eb647bab..826290fe27 100644 --- a/tests/circuitpython/synthesizer.py.exp +++ b/tests/circuitpython/synthesizer.py.exp @@ -1,30 +1,30 @@ () [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (80,) -[-16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383] +[-16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383] (80, 91) -[-8191, -8191, 0, 0, -8191, -16382, -16382, -8191, 0, 0, -8191, -8191, 0, -8191, -8191, -16382, -16382, -8191, 0, 0, -8191, -8191, 0, -8191] +[0, 0, 16382, 16382, 0, -16382, -16382, 0, 16382, 16382, 0, 0, 16382, 0, 0, -16382, -16382, 0, 16382, 16382, 0, 0, 16382, 0] (91,) -[-16382, -8191, -8191, 0, -8191, -8191, 0, 0, -8191, -16382, -16382, -8191, 0, 0, -8191, -8191, 0, -8191, -8191, -16382, -16382, -16382, 0, 0] -(-5242, 0) -(-10484, 0) -(-15727, 0) -(-16383, 0) -(-14286, 0) -(-13106, 0) -(-13106, 0) -(-13106, 0) -(-13106, 0) -(-13106, 0) -(-13106, 0) -(-13106, 0) -(-13106, 0) -(-11009, 0) -(-8912, 0) -(-6815, 0) -(-4718, 0) -(-2621, 0) -(-524, 0) +[-16382, 0, 0, 16382, 0, 0, 16382, 16382, 0, -16382, -16382, 0, 16382, 16382, 0, 0, 16382, 0, 0, -16382, -16382, -16382, 16382, 16382] +(-5242, 5241) +(-10484, 10484) +(-15727, 15726) +(-16383, 16382) +(-14286, 14285) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-11009, 11008) +(-8912, 8911) +(-6815, 6814) +(-4718, 4717) +(-2621, 2620) +(-524, 523) (0, 0) (0, 0) (0, 0) From dd262258e0889cb1e18de0fa4ef4e631feb53b9e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 3 May 2023 08:45:37 -0500 Subject: [PATCH 0962/1712] synthio: Add `MidiTrack.error_location` to record errors .. instead of just printing the unraiseable error on the repl --- shared-bindings/synthio/MidiTrack.c | 18 ++++++++++++++++++ shared-bindings/synthio/MidiTrack.h | 1 + shared-module/synthio/MidiTrack.c | 7 ++++++- shared-module/synthio/MidiTrack.h | 1 + 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/shared-bindings/synthio/MidiTrack.c b/shared-bindings/synthio/MidiTrack.c index 6916a21689..084bad204c 100644 --- a/shared-bindings/synthio/MidiTrack.c +++ b/shared-bindings/synthio/MidiTrack.c @@ -151,6 +151,23 @@ MP_DEFINE_CONST_FUN_OBJ_1(synthio_miditrack_get_sample_rate_obj, synthio_miditra MP_PROPERTY_GETTER(synthio_miditrack_sample_rate_obj, (mp_obj_t)&synthio_miditrack_get_sample_rate_obj); +//| error_location: Optional[int] +//| """Offset, in bytes within the midi data, of a decoding error""" +//| +STATIC mp_obj_t synthio_miditrack_obj_get_error_location(mp_obj_t self_in) { + synthio_miditrack_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + mp_int_t location = common_hal_synthio_miditrack_get_error_location(self); + if (location >= 0) { + return MP_OBJ_NEW_SMALL_INT(location); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_miditrack_get_error_location_obj, synthio_miditrack_obj_get_error_location); + +MP_PROPERTY_GETTER(synthio_miditrack_error_location_obj, + (mp_obj_t)&synthio_miditrack_get_error_location_obj); + STATIC const mp_rom_map_elem_t synthio_miditrack_locals_dict_table[] = { // Methods { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&synthio_miditrack_deinit_obj) }, @@ -159,6 +176,7 @@ STATIC const mp_rom_map_elem_t synthio_miditrack_locals_dict_table[] = { // Properties { MP_ROM_QSTR(MP_QSTR_sample_rate), MP_ROM_PTR(&synthio_miditrack_sample_rate_obj) }, + { MP_ROM_QSTR(MP_QSTR_error_location), MP_ROM_PTR(&synthio_miditrack_error_location_obj) }, }; STATIC MP_DEFINE_CONST_DICT(synthio_miditrack_locals_dict, synthio_miditrack_locals_dict_table); diff --git a/shared-bindings/synthio/MidiTrack.h b/shared-bindings/synthio/MidiTrack.h index 046163c2de..1a76ed36f4 100644 --- a/shared-bindings/synthio/MidiTrack.h +++ b/shared-bindings/synthio/MidiTrack.h @@ -39,3 +39,4 @@ bool common_hal_synthio_miditrack_deinited(synthio_miditrack_obj_t *self); uint32_t common_hal_synthio_miditrack_get_sample_rate(synthio_miditrack_obj_t *self); uint8_t common_hal_synthio_miditrack_get_bits_per_sample(synthio_miditrack_obj_t *self); uint8_t common_hal_synthio_miditrack_get_channel_count(synthio_miditrack_obj_t *self); +mp_int_t common_hal_synthio_miditrack_get_error_location(synthio_miditrack_obj_t *self); diff --git a/shared-module/synthio/MidiTrack.c b/shared-module/synthio/MidiTrack.c index 6a021af85c..c59fa23bef 100644 --- a/shared-module/synthio/MidiTrack.c +++ b/shared-module/synthio/MidiTrack.c @@ -29,7 +29,7 @@ STATIC void print_midi_stream_error(synthio_miditrack_obj_t *self) { - mp_cprintf(&mp_plat_print, translate("Error in MIDI stream at position %d"), self->pos); + self->error_location = self->pos; self->pos = self->track.len; } @@ -106,6 +106,7 @@ static void decode_until_pause(synthio_miditrack_obj_t *self) { STATIC void start_parse(synthio_miditrack_obj_t *self) { self->pos = 0; + self->error_location = -1; self->synth.span.dur = decode_duration(self); if (self->synth.span.dur == 0) { // the usual case: the file starts with some MIDI event, not a delay @@ -135,6 +136,10 @@ bool common_hal_synthio_miditrack_deinited(synthio_miditrack_obj_t *self) { return synthio_synth_deinited(&self->synth); } +mp_int_t common_hal_synthio_miditrack_get_error_location(synthio_miditrack_obj_t *self) { + return self->error_location; +} + uint32_t common_hal_synthio_miditrack_get_sample_rate(synthio_miditrack_obj_t *self) { return self->synth.sample_rate; } diff --git a/shared-module/synthio/MidiTrack.h b/shared-module/synthio/MidiTrack.h index 549e72fb25..2f843dcc3d 100644 --- a/shared-module/synthio/MidiTrack.h +++ b/shared-module/synthio/MidiTrack.h @@ -37,6 +37,7 @@ typedef struct { mp_buffer_info_t track; // invariant: after initial startup, pos always points just after an encoded duration, i.e., at a midi message (or at EOF) size_t pos; + mp_int_t error_location; uint32_t tempo; } synthio_miditrack_obj_t; From eea9b629784f2ac3a31162b30a41d287d90cce8f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 3 May 2023 08:45:57 -0500 Subject: [PATCH 0963/1712] synthio: MidiTrack: sample_rate is always available --- shared-bindings/synthio/MidiTrack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/synthio/MidiTrack.c b/shared-bindings/synthio/MidiTrack.c index 084bad204c..31d8cbc7f0 100644 --- a/shared-bindings/synthio/MidiTrack.c +++ b/shared-bindings/synthio/MidiTrack.c @@ -138,7 +138,7 @@ STATIC mp_obj_t synthio_miditrack_obj___exit__(size_t n_args, const mp_obj_t *ar } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(synthio_miditrack___exit___obj, 4, 4, synthio_miditrack_obj___exit__); -//| sample_rate: Optional[int] +//| sample_rate: int //| """32 bit value that tells how quickly samples are played in Hertz (cycles per second).""" //| STATIC mp_obj_t synthio_miditrack_obj_get_sample_rate(mp_obj_t self_in) { From 1fafa4dc2496671a4aedbd393d76a0b19cb45d8d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 3 May 2023 09:06:41 -0500 Subject: [PATCH 0964/1712] synthio: improve Envelope constructor --- shared-bindings/synthio/__init__.c | 63 ++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 95dc097313..eaf67cc0e7 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -37,6 +37,20 @@ #include "shared-bindings/synthio/MidiTrack.h" #include "shared-bindings/synthio/Synthesizer.h" +#define default_attack_time (MICROPY_FLOAT_CONST(0.1)) +#define default_decay_time (MICROPY_FLOAT_CONST(0.05)) +#define default_release_time (MICROPY_FLOAT_CONST(0.2)) +#define default_attack_level (MICROPY_FLOAT_CONST(1.)) +#define default_sustain_level (MICROPY_FLOAT_CONST(0.8)) + +static const mp_arg_t envelope_properties[] = { + { MP_QSTR_attack_time, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL } }, + { MP_QSTR_decay_time, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL } }, + { MP_QSTR_release_time, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL } }, + { MP_QSTR_attack_level, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL } }, + { MP_QSTR_sustain_level, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL } }, +}; + //| """Support for multi-channel audio synthesis //| //| At least 2 simultaneous notes are supported. samd5x, mimxrt10xx and rp2040 platforms support up to 12 notes. @@ -46,11 +60,12 @@ //| class Envelope: //| def __init__( //| self, -//| attack_time: float, -//| decay_time: float, -//| release_time: float, -//| attack_level: float, -//| sustain_level: float, +//| *, +//| attack_time: Optional[float] = 0.1, +//| decay_time: Optional[float] = 0.05, +//| release_time: Optional[float] = 0.2, +//| attack_level: Optional[float] = 1.0, +//| sustain_level: Optional[float] = 0.8, //| ) -> None: //| """Construct an Envelope object //| @@ -82,20 +97,36 @@ //| """The relative level, in the range ``0.0`` to ``1.0`` of the volume of the sustain phase""" //| -STATIC mp_obj_t synthio_envelope_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args) { - mp_obj_t new_obj = namedtuple_make_new(type_in, n_args, n_kw, args); - mp_obj_t *fields; - size_t len; - mp_obj_tuple_get(new_obj, &len, &fields); +STATIC mp_obj_t synthio_envelope_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + mp_arg_val_t args[MP_ARRAY_SIZE(envelope_properties)]; + enum { ARG_attack_time, ARG_decay_time, ARG_release_time, ARG_attack_level, ARG_sustain_level }; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(envelope_properties), envelope_properties, args); - mp_arg_validate_obj_float_non_negative(fields[0], 0., MP_QSTR_attack_time); - mp_arg_validate_obj_float_non_negative(fields[1], 0., MP_QSTR_decay_time); - mp_arg_validate_obj_float_non_negative(fields[2], 0., MP_QSTR_release_time); + if (args[ARG_attack_time].u_obj == MP_OBJ_NULL) { + args[ARG_attack_time].u_obj = mp_obj_new_float(default_attack_time); + } + if (args[ARG_decay_time].u_obj == MP_OBJ_NULL) { + args[ARG_decay_time].u_obj = mp_obj_new_float(default_decay_time); + } + if (args[ARG_release_time].u_obj == MP_OBJ_NULL) { + args[ARG_release_time].u_obj = mp_obj_new_float(default_release_time); + } + if (args[ARG_attack_level].u_obj == MP_OBJ_NULL) { + args[ARG_attack_level].u_obj = mp_obj_new_float(default_attack_level); + } + if (args[ARG_sustain_level].u_obj == MP_OBJ_NULL) { + args[ARG_sustain_level].u_obj = mp_obj_new_float(default_sustain_level); + } - mp_arg_validate_obj_float_range(fields[3], 0, 1, MP_QSTR_attack_level); - mp_arg_validate_obj_float_range(fields[4], 0, 1, MP_QSTR_sustain_level); + mp_arg_validate_obj_float_non_negative(args[ARG_attack_time].u_obj, 0., MP_QSTR_attack_time); + mp_arg_validate_obj_float_non_negative(args[ARG_decay_time].u_obj, 0., MP_QSTR_decay_time); + mp_arg_validate_obj_float_non_negative(args[ARG_release_time].u_obj, 0., MP_QSTR_release_time); - return new_obj; + mp_arg_validate_obj_float_range(args[ARG_attack_level].u_obj, 0, 1, MP_QSTR_attack_level); + mp_arg_validate_obj_float_range(args[ARG_sustain_level].u_obj, 0, 1, MP_QSTR_sustain_level); + + MP_STATIC_ASSERT(sizeof(mp_arg_val_t) == sizeof(mp_obj_t)); + return namedtuple_make_new(type_in, MP_ARRAY_SIZE(args), 0, &args[0].u_obj); }; const mp_obj_namedtuple_type_t synthio_envelope_type_obj = { From b33c9f6b4b0ae428682560496c8c89015542496e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 3 May 2023 09:32:51 -0500 Subject: [PATCH 0965/1712] synthio: put license notice on copied files --- tests/circuitpython-manual/synthio/wave/audioop.py | 4 ++++ tests/circuitpython-manual/synthio/wave/chunk.py | 4 ++++ tests/circuitpython-manual/synthio/wave/wave.py | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/tests/circuitpython-manual/synthio/wave/audioop.py b/tests/circuitpython-manual/synthio/wave/audioop.py index 6ec637a3a1..cab2fb4a7a 100644 --- a/tests/circuitpython-manual/synthio/wave/audioop.py +++ b/tests/circuitpython-manual/synthio/wave/audioop.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2023 Guido van Rossum and others. +# +# SPDX-License-Identifier: PSF-2.0 + import struct diff --git a/tests/circuitpython-manual/synthio/wave/chunk.py b/tests/circuitpython-manual/synthio/wave/chunk.py index eea83c42d6..c1e6364b0f 100644 --- a/tests/circuitpython-manual/synthio/wave/chunk.py +++ b/tests/circuitpython-manual/synthio/wave/chunk.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2023 Guido van Rossum and others. +# +# SPDX-License-Identifier: PSF-2.0 + """Simple class to read IFF chunks. An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File diff --git a/tests/circuitpython-manual/synthio/wave/wave.py b/tests/circuitpython-manual/synthio/wave/wave.py index 903295a4ba..dc6d5407a7 100644 --- a/tests/circuitpython-manual/synthio/wave/wave.py +++ b/tests/circuitpython-manual/synthio/wave/wave.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2023 Guido van Rossum and others. +# +# SPDX-License-Identifier: PSF-2.0 + """Stuff to parse WAVE files. Usage. From 4f7d88676b49f22e7656ec0a4fac89a5c3c9fd4d Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Wed, 3 May 2023 17:30:01 -0400 Subject: [PATCH 0966/1712] Remove pico-w version --- .../boards/pimoroni_pico_dv_base_w/board.c | 52 ----------- .../boards/pimoroni_pico_dv_base_w/link.ld | 1 - .../pimoroni_pico_dv_base_w/mpconfigboard.h | 10 --- .../pimoroni_pico_dv_base_w/mpconfigboard.mk | 29 ------ .../pico-sdk-configboard.h | 4 - .../boards/pimoroni_pico_dv_base_w/pins.c | 89 ------------------- 6 files changed, 185 deletions(-) delete mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c delete mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/link.ld delete mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h delete mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk delete mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h delete mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c deleted file mode 100644 index bc5878bf24..0000000000 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2021 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 "bindings/picodvi/Framebuffer.h" -#include "shared-module/displayio/__init__.h" -#include "shared-bindings/framebufferio/FramebufferDisplay.h" - -void board_init(void) { - picodvi_framebuffer_obj_t *fb = &allocate_display_bus()->picodvi; - fb->base.type = &picodvi_framebuffer_type; - common_hal_picodvi_framebuffer_construct(fb, 640, 480, - &pin_GPIO7, &pin_GPIO6, - &pin_GPIO9, &pin_GPIO8, - &pin_GPIO11, &pin_GPIO10, - &pin_GPIO13, &pin_GPIO12, - 8); - - framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; - display->base.type = &framebufferio_framebufferdisplay_type; - common_hal_framebufferio_framebufferdisplay_construct( - display, - MP_OBJ_FROM_PTR(fb), - 0, - true); -} - -// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/link.ld b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/link.ld deleted file mode 100644 index e814bead4c..0000000000 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/link.ld +++ /dev/null @@ -1 +0,0 @@ -firmware_size = 1532k; diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h deleted file mode 100644 index df6539734e..0000000000 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h +++ /dev/null @@ -1,10 +0,0 @@ -#define MICROPY_HW_BOARD_NAME "Pimoroni Pico DV Base W" -#define MICROPY_HW_MCU_NAME "rp2040" - -#define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1) -#define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1) - -#define MICROPY_HW_LED_STATUS (&pin_CYW0) - -#define DEFAULT_UART_BUS_RX (&pin_GPIO1) -#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk deleted file mode 100644 index b7919a1847..0000000000 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk +++ /dev/null @@ -1,29 +0,0 @@ -USB_VID = 0x2E8A -USB_PID = 0x105A -USB_PRODUCT = "Pimoroni Pico DV Demo Base for Pico W" -USB_MANUFACTURER = "Pimoroni" - -CHIP_VARIANT = RP2040 -CHIP_FAMILY = rp2 - -EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" - -CIRCUITPY__EVE = 1 - -CIRCUITPY_CYW43 = 1 -CIRCUITPY_SSL = 1 -CIRCUITPY_SSL_MBEDTLS = 1 -CIRCUITPY_HASHLIB = 1 -CIRCUITPY_WEB_WORKFLOW = 1 -CIRCUITPY_MDNS = 1 -CIRCUITPY_SOCKETPOOL = 1 -CIRCUITPY_WIFI = 1 - -CIRCUITPY_PICODVI = 1 - -CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 -# Must be accompanied by a linker script change -CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' - -# Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h deleted file mode 100644 index a41131dd22..0000000000 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h +++ /dev/null @@ -1,4 +0,0 @@ -// Put board-specific pico-sdk definitions here. This file must exist. - -// Allow extra time for xosc to start. -#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c deleted file mode 100644 index 6ab85f3c34..0000000000 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c +++ /dev/null @@ -1,89 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -#include "shared-module/displayio/__init__.h" - -STATIC const mp_rom_map_elem_t board_module_globals_table[] = { - CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS - - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, - { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, - - { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, - { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, - { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, - { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, - { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, - - { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, - - { MP_ROM_QSTR(MP_QSTR_BUTTON_B), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, - - { MP_ROM_QSTR(MP_QSTR_BUTTON_C), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, - { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, - { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, - { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, - - // SD Card - { MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO5)}, - { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO18)}, - { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO19)}, - { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO22)}, - - { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_CYW1) }, - - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_CYW0) }, - - { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2) }, - - { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO26) }, - { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, - { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, - - { MP_ROM_QSTR(MP_QSTR_I2S_BIT_CLOCK), MP_ROM_PTR(&pin_GPIO27) }, - { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, - { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, - - { MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO28) }, - { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, - { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, - - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, - { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, - - // DVI VIDEO - { MP_ROM_QSTR(MP_QSTR_DV_CEC), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_DV_SCL), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_DV_SDA), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_CKN), MP_ROM_PTR(&pin_GPIO6) }, - { MP_ROM_QSTR(MP_QSTR_CKP), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_D0N), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_D0P), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_D1N), MP_ROM_PTR(&pin_GPIO10) }, - { MP_ROM_QSTR(MP_QSTR_D1P), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_D2N), MP_ROM_PTR(&pin_GPIO12) }, - { MP_ROM_QSTR(MP_QSTR_D2P), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_DV_HPD), MP_ROM_PTR(&pin_GPIO17) }, - - { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].framebuffer_display)}, - -}; - -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 5514e3065da2cdd4e81670d9f6691269eeff6392 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 25 Apr 2023 16:42:05 -0500 Subject: [PATCH 0967/1712] synthio: add midi_to_hz to convert notes in the MIDI 1-127 note scale to floating point Hz --- shared-bindings/synthio/__init__.c | 7 +++++++ shared-bindings/synthio/__init__.h | 1 + shared-module/synthio/__init__.c | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index eaf67cc0e7..89929b0563 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -262,12 +262,19 @@ STATIC mp_obj_t synthio_from_file(size_t n_args, const mp_obj_t *pos_args, mp_ma } MP_DEFINE_CONST_FUN_OBJ_KW(synthio_from_file_obj, 1, synthio_from_file); +STATIC mp_obj_t midi_to_hz(mp_obj_t arg) { + mp_int_t note = mp_arg_validate_int_range(mp_obj_get_int(arg), 1, 127, MP_QSTR_note); + return mp_obj_new_float(common_hal_synthio_midi_to_hz_float(note)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_midi_to_hz_obj, midi_to_hz); + STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_synthio) }, { MP_ROM_QSTR(MP_QSTR_MidiTrack), MP_ROM_PTR(&synthio_miditrack_type) }, { MP_ROM_QSTR(MP_QSTR_Synthesizer), MP_ROM_PTR(&synthio_synthesizer_type) }, { MP_ROM_QSTR(MP_QSTR_from_file), MP_ROM_PTR(&synthio_from_file_obj) }, { MP_ROM_QSTR(MP_QSTR_Envelope), MP_ROM_PTR(&synthio_envelope_type_obj) }, + { MP_ROM_QSTR(MP_QSTR_midi_to_hz), MP_ROM_PTR(&synthio_midi_to_hz_obj) }, }; STATIC MP_DEFINE_CONST_DICT(synthio_module_globals, synthio_module_globals_table); diff --git a/shared-bindings/synthio/__init__.h b/shared-bindings/synthio/__init__.h index 6ea323905a..d3ccc1ce04 100644 --- a/shared-bindings/synthio/__init__.h +++ b/shared-bindings/synthio/__init__.h @@ -33,3 +33,4 @@ extern int16_t shared_bindings_synthio_square_wave[]; extern const mp_obj_namedtuple_type_t synthio_envelope_type_obj; void synthio_synth_envelope_set(synthio_synth_t *synth, mp_obj_t envelope_obj); mp_obj_t synthio_synth_envelope_get(synthio_synth_t *synth); +mp_float_t common_hal_synthio_midi_to_hz_float(mp_int_t note); diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index c7e1096632..8c17dfdeed 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -36,6 +36,12 @@ STATIC const int16_t square_wave[] = {-32768, 32767}; STATIC const uint16_t notes[] = {8372, 8870, 9397, 9956, 10548, 11175, 11840, 12544, 13290, 14080, 14917, 15804}; // 9th octave +mp_float_t common_hal_synthio_midi_to_hz_float(mp_int_t arg) { + uint8_t octave = arg / 12; + uint16_t base_freq = notes[arg % 12]; + return MICROPY_FLOAT_C_FUN(ldexp)(base_freq, octave - 10); +} + STATIC int16_t convert_time_to_rate(uint32_t sample_rate, mp_obj_t time_in, int16_t difference) { mp_float_t time = mp_obj_get_float(time_in); int num_samples = (int)MICROPY_FLOAT_C_FUN(round)(time * sample_rate); From c22fd2a18e4732b2b7dab6e58e924615adeffb12 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 1 May 2023 09:39:40 -0500 Subject: [PATCH 0968/1712] runtime: Add mp_arg_validate_float_range --- py/argcheck.c | 7 ++++++- py/runtime.h | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/py/argcheck.c b/py/argcheck.c index 265b303901..8a4419f88f 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -194,11 +194,16 @@ mp_float_t mp_arg_validate_type_float(mp_obj_t obj, qstr arg_name) { return a_float; } -void mp_arg_validate_obj_float_range(mp_obj_t float_in, mp_int_t min, mp_int_t max, qstr arg_name) { +mp_float_t mp_arg_validate_obj_float_range(mp_obj_t float_in, mp_int_t min, mp_int_t max, qstr arg_name) { const mp_float_t f = mp_arg_validate_type_float(float_in, arg_name); + return mp_arg_validate_float_range(f, min, max, arg_name); +} + +mp_float_t mp_arg_validate_float_range(mp_float_t f, mp_int_t min, mp_int_t max, qstr arg_name) { if (f < (mp_float_t)min || f > (mp_float_t)max) { mp_raise_ValueError_varg(translate("%q must be %d-%d"), arg_name, min, max); } + return f; } mp_float_t mp_arg_validate_obj_float_non_negative(mp_obj_t float_in, mp_float_t default_for_null, qstr arg_name) { diff --git a/py/runtime.h b/py/runtime.h index f7b96a27ae..196874bff9 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -103,7 +103,8 @@ mp_int_t mp_arg_validate_int_max(mp_int_t i, mp_int_t j, qstr arg_name); mp_int_t mp_arg_validate_int_range(mp_int_t i, mp_int_t min, mp_int_t max, qstr arg_name); #if MICROPY_PY_BUILTINS_FLOAT mp_float_t mp_arg_validate_obj_float_non_negative(mp_obj_t float_in, mp_float_t default_for_null, qstr arg_name); -void mp_arg_validate_obj_float_range(mp_obj_t float_in, mp_int_t min, mp_int_t max, qstr arg_name); +mp_float_t mp_arg_validate_obj_float_range(mp_obj_t float_in, mp_int_t min, mp_int_t max, qstr arg_name); +mp_float_t mp_arg_validate_float_range(mp_float_t float_in, mp_int_t min, mp_int_t max, qstr arg_name); mp_float_t mp_arg_validate_type_float(mp_obj_t obj, qstr arg_name); #endif mp_uint_t mp_arg_validate_length_min(mp_uint_t length, mp_uint_t min, qstr arg_name); From bc03e03b9e62048de4d6d2b12e75301eda4b1652 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 3 May 2023 09:11:17 -0500 Subject: [PATCH 0969/1712] util: Add properties_print_helper --- shared-bindings/util.c | 12 ++++++++++++ shared-bindings/util.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/shared-bindings/util.c b/shared-bindings/util.c index 5c5eafad4a..78960a7552 100644 --- a/shared-bindings/util.c +++ b/shared-bindings/util.c @@ -37,5 +37,17 @@ void raise_deinited_error(void) { mp_raise_ValueError(translate("Object has been deinitialized and can no longer be used. Create a new object.")); } +void properties_print_helper(const mp_print_t *print, mp_obj_t self_in, const mp_arg_t *properties, size_t n_properties) { + const mp_obj_type_t *type = mp_obj_get_type(self_in); + mp_printf(print, "%q(", type->name); + for (size_t i = 0; i < n_properties; i++) { + if (i > 0) { + mp_print_str(print, ", "); + } + mp_printf(print, "%q=", properties[i].qst); + mp_obj_print_helper(print, mp_load_attr(self_in, properties[i].qst), PRINT_REPR); + } + mp_print_str(print, ")"); +} #endif // MICROPY_INCLUDED_SHARED_BINDINGS_UTIL_H diff --git a/shared-bindings/util.h b/shared-bindings/util.h index 33454f10ef..b35e903d38 100644 --- a/shared-bindings/util.h +++ b/shared-bindings/util.h @@ -27,7 +27,11 @@ #ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_UTIL_H #define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_UTIL_H +#include "py/mpprint.h" +#include "py/runtime.h" + void raise_deinited_error(void); +void properties_print_helper(const mp_print_t *print, mp_obj_t self_in, const mp_arg_t *properties, size_t n_properties); #endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_UTIL_H From a7da245ad062078ab7b7a67111446adc8e9afc5e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 1 May 2023 09:41:05 -0500 Subject: [PATCH 0970/1712] synthio: Add synthio.Note This class allows much more expressive sound synthesis: * tremolo & vibrato * arbitrary frequency * different evelope & waveform per note * all properties dynamically settable from Python code --- .../unix/variants/coverage/mpconfigvariant.mk | 2 + py/circuitpy_defns.mk | 1 + shared-bindings/synthio/Note.c | 252 ++++++++++++++++++ shared-bindings/synthio/Note.h | 30 +++ shared-bindings/synthio/Synthesizer.c | 38 +-- shared-bindings/synthio/__init__.c | 3 +- shared-module/synthio/MidiTrack.c | 8 +- shared-module/synthio/Note.c | 158 +++++++++++ shared-module/synthio/Note.h | 54 ++++ shared-module/synthio/Synthesizer.c | 38 ++- shared-module/synthio/__init__.c | 131 +++++++-- shared-module/synthio/__init__.h | 27 +- .../synthio/note/README.md | 5 + .../synthio/note/audioop.py | 1 + .../synthio/note/chunk.py | 1 + .../circuitpython-manual/synthio/note/code.py | 100 +++++++ .../circuitpython-manual/synthio/note/wave.py | 1 + .../synthio/wave/README.md | 2 +- tests/circuitpython/synthesizer_note.py | 41 +++ tests/circuitpython/synthesizer_note.py.exp | 32 +++ 20 files changed, 863 insertions(+), 62 deletions(-) create mode 100644 shared-bindings/synthio/Note.c create mode 100644 shared-bindings/synthio/Note.h create mode 100644 shared-module/synthio/Note.c create mode 100644 shared-module/synthio/Note.h create mode 100644 tests/circuitpython-manual/synthio/note/README.md create mode 120000 tests/circuitpython-manual/synthio/note/audioop.py create mode 120000 tests/circuitpython-manual/synthio/note/chunk.py create mode 100644 tests/circuitpython-manual/synthio/note/code.py create mode 120000 tests/circuitpython-manual/synthio/note/wave.py create mode 100644 tests/circuitpython/synthesizer_note.py create mode 100644 tests/circuitpython/synthesizer_note.py.exp diff --git a/ports/unix/variants/coverage/mpconfigvariant.mk b/ports/unix/variants/coverage/mpconfigvariant.mk index 854d052c6c..41f44df2b4 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.mk +++ b/ports/unix/variants/coverage/mpconfigvariant.mk @@ -42,6 +42,7 @@ SRC_BITMAP := \ shared-bindings/struct/__init__.c \ shared-bindings/synthio/__init__.c \ shared-bindings/synthio/MidiTrack.c \ + shared-bindings/synthio/Note.c \ shared-bindings/synthio/Synthesizer.c \ shared-bindings/traceback/__init__.c \ shared-bindings/util.c \ @@ -64,6 +65,7 @@ SRC_BITMAP := \ shared-module/struct/__init__.c \ shared-module/synthio/__init__.c \ shared-module/synthio/MidiTrack.c \ + shared-module/synthio/Note.c \ shared-module/synthio/Synthesizer.c \ shared-module/traceback/__init__.c \ shared-module/zlib/__init__.c \ diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index d9af56356a..553490d99b 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -651,6 +651,7 @@ SRC_SHARED_MODULE_ALL = \ supervisor/__init__.c \ supervisor/StatusBar.c \ synthio/MidiTrack.c \ + synthio/Note.c \ synthio/Synthesizer.c \ synthio/__init__.c \ terminalio/Terminal.c \ diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c new file mode 100644 index 0000000000..0e2dad40d6 --- /dev/null +++ b/shared-bindings/synthio/Note.c @@ -0,0 +1,252 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Artyom Skrobov + * Copyright (c) 2023 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/objproperty.h" +#include "py/runtime.h" +#include "shared-bindings/util.h" +#include "shared-bindings/synthio/Note.h" +#include "shared-module/synthio/Note.h" + +static const mp_arg_t note_properties[] = { + { MP_QSTR_frequency, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = NULL } }, + { MP_QSTR_amplitude, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(1) } }, + { MP_QSTR_tremolo_rate, MP_ARG_OBJ, {.u_obj = NULL } }, + { MP_QSTR_tremolo_depth, MP_ARG_OBJ, {.u_obj = NULL } }, + { MP_QSTR_vibrato_rate, MP_ARG_OBJ, {.u_obj = NULL } }, + { MP_QSTR_vibrato_depth, MP_ARG_OBJ, {.u_obj = NULL } }, + { MP_QSTR_waveform, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE } }, + { MP_QSTR_envelope, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE } }, +}; +//| class Note: +//| def __init__( +//| self, +//| frequency: float, +//| amplitude: float = 1.0, +//| waveform: Optional[ReadableBuffer] = None, +//| envelope: Optional[Envelope] = None, +//| tremolo_depth: float = 0.0, +//| tremolo_rate: float = 0.0, +//| vibrato_depth: float = 0.0, +//| vibrato_rate: float = 0.0, +//| ) -> None: +//| """Construct a Note object, with a frequency in Hz, and optional amplitude (volume), waveform, envelope, tremolo (volume change) and vibrato (frequency change). +//| +//| If waveform or envelope are `None` the synthesizer object's default waveform or envelope are used. +//| +//| If the same Note object is played on multiple Synthesizer objects, the result is undefined. +//| """ +STATIC mp_obj_t synthio_note_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_frequency, ARG_amplitude, ARG_waveform, ARG_envelope, ARG_tremolo_rate, ARG_tremolo_depth, ARG_vibrato_rate, ARG_vibrato_depth }; + mp_arg_val_t args[MP_ARRAY_SIZE(note_properties)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(note_properties), note_properties, args); + + synthio_note_obj_t *self = m_new_obj(synthio_note_obj_t); + self->base.type = &synthio_note_type; + + mp_obj_t result = MP_OBJ_FROM_PTR(self); + for (size_t i = 0; i < MP_ARRAY_SIZE(note_properties); i++) { + if (args[i].u_obj != NULL) { + mp_store_attr(result, note_properties[i].qst, args[i].u_obj); + } + } + + return result; +}; + +//| frequency: float +//| """The base frequency of the note, in Hz.""" +STATIC mp_obj_t synthio_note_get_frequency(mp_obj_t self_in) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_synthio_note_get_frequency(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_frequency_obj, synthio_note_get_frequency); + +STATIC mp_obj_t synthio_note_set_frequency(mp_obj_t self_in, mp_obj_t arg) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_note_set_frequency(self, mp_obj_get_float(arg)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_frequency_obj, synthio_note_set_frequency); +MP_PROPERTY_GETSET(synthio_note_frequency_obj, + (mp_obj_t)&synthio_note_get_frequency_obj, + (mp_obj_t)&synthio_note_set_frequency_obj); + +//| amplitude: float +//| """The base amplitude of the note, from 0 to 1""" +STATIC mp_obj_t synthio_note_get_amplitude(mp_obj_t self_in) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_synthio_note_get_amplitude(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_amplitude_obj, synthio_note_get_amplitude); + +STATIC mp_obj_t synthio_note_set_amplitude(mp_obj_t self_in, mp_obj_t arg) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_note_set_amplitude(self, mp_obj_get_float(arg)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_amplitude_obj, synthio_note_set_amplitude); +MP_PROPERTY_GETSET(synthio_note_amplitude_obj, + (mp_obj_t)&synthio_note_get_amplitude_obj, + (mp_obj_t)&synthio_note_set_amplitude_obj); + + +//| tremolo_depth: float +//| """The tremolo depth of the note, from 0 to 1""" +STATIC mp_obj_t synthio_note_get_tremolo_depth(mp_obj_t self_in) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_synthio_note_get_tremolo_depth(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_tremolo_depth_obj, synthio_note_get_tremolo_depth); + +STATIC mp_obj_t synthio_note_set_tremolo_depth(mp_obj_t self_in, mp_obj_t arg) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_note_set_tremolo_depth(self, mp_obj_get_float(arg)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_tremolo_depth_obj, synthio_note_set_tremolo_depth); +MP_PROPERTY_GETSET(synthio_note_tremolo_depth_obj, + (mp_obj_t)&synthio_note_get_tremolo_depth_obj, + (mp_obj_t)&synthio_note_set_tremolo_depth_obj); + +//| tremolo_rate: float +//| """The tremolo rate of the note, in Hz.""" +STATIC mp_obj_t synthio_note_get_tremolo_rate(mp_obj_t self_in) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_synthio_note_get_tremolo_rate(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_tremolo_rate_obj, synthio_note_get_tremolo_rate); + +STATIC mp_obj_t synthio_note_set_tremolo_rate(mp_obj_t self_in, mp_obj_t arg) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_note_set_tremolo_rate(self, mp_obj_get_float(arg)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_tremolo_rate_obj, synthio_note_set_tremolo_rate); +MP_PROPERTY_GETSET(synthio_note_tremolo_rate_obj, + (mp_obj_t)&synthio_note_get_tremolo_rate_obj, + (mp_obj_t)&synthio_note_set_tremolo_rate_obj); + +//| vibrato_depth: float +//| """The vibrato depth of the note, from 0 to 1""" +STATIC mp_obj_t synthio_note_get_vibrato_depth(mp_obj_t self_in) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_synthio_note_get_vibrato_depth(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_vibrato_depth_obj, synthio_note_get_vibrato_depth); + +STATIC mp_obj_t synthio_note_set_vibrato_depth(mp_obj_t self_in, mp_obj_t arg) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_note_set_vibrato_depth(self, mp_obj_get_float(arg)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_vibrato_depth_obj, synthio_note_set_vibrato_depth); +MP_PROPERTY_GETSET(synthio_note_vibrato_depth_obj, + (mp_obj_t)&synthio_note_get_vibrato_depth_obj, + (mp_obj_t)&synthio_note_set_vibrato_depth_obj); + +//| vibrato_rate: float +//| """The vibrato rate of the note, in Hz.""" +STATIC mp_obj_t synthio_note_get_vibrato_rate(mp_obj_t self_in) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_synthio_note_get_vibrato_rate(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_vibrato_rate_obj, synthio_note_get_vibrato_rate); + +STATIC mp_obj_t synthio_note_set_vibrato_rate(mp_obj_t self_in, mp_obj_t arg) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_note_set_vibrato_rate(self, mp_obj_get_float(arg)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_vibrato_rate_obj, synthio_note_set_vibrato_rate); +MP_PROPERTY_GETSET(synthio_note_vibrato_rate_obj, + (mp_obj_t)&synthio_note_get_vibrato_rate_obj, + (mp_obj_t)&synthio_note_set_vibrato_rate_obj); + +//| waveform: Optional[ReadableBuffer] +//| """The waveform of this note. Setting the waveform to a buffer of a different size resets the note's phase.""" +STATIC mp_obj_t synthio_note_get_waveform(mp_obj_t self_in) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_synthio_note_get_waveform_obj(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_waveform_obj, synthio_note_get_waveform); + +STATIC mp_obj_t synthio_note_set_waveform(mp_obj_t self_in, mp_obj_t arg) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_note_set_waveform(self, arg); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_waveform_obj, synthio_note_set_waveform); +MP_PROPERTY_GETSET(synthio_note_waveform_obj, + (mp_obj_t)&synthio_note_get_waveform_obj, + (mp_obj_t)&synthio_note_set_waveform_obj); + + +//| envelope: Envelope +//| """The envelope of this note""" +//| +STATIC mp_obj_t synthio_note_get_envelope(mp_obj_t self_in) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_synthio_note_get_envelope_obj(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_envelope_obj, synthio_note_get_envelope); + +STATIC mp_obj_t synthio_note_set_envelope(mp_obj_t self_in, mp_obj_t arg) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_note_set_envelope(self, arg); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_envelope_obj, synthio_note_set_envelope); +MP_PROPERTY_GETSET(synthio_note_envelope_obj, + (mp_obj_t)&synthio_note_get_envelope_obj, + (mp_obj_t)&synthio_note_set_envelope_obj); + +static void note_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { + (void)kind; + properties_print_helper(print, self_in, note_properties, MP_ARRAY_SIZE(note_properties)); +} + +STATIC const mp_rom_map_elem_t synthio_note_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_PTR(&synthio_note_frequency_obj) }, + { MP_ROM_QSTR(MP_QSTR_amplitude), MP_ROM_PTR(&synthio_note_amplitude_obj) }, + { MP_ROM_QSTR(MP_QSTR_waveform), MP_ROM_PTR(&synthio_note_waveform_obj) }, + { MP_ROM_QSTR(MP_QSTR_envelope), MP_ROM_PTR(&synthio_note_envelope_obj) }, + { MP_ROM_QSTR(MP_QSTR_tremolo_depth), MP_ROM_PTR(&synthio_note_tremolo_depth_obj) }, + { MP_ROM_QSTR(MP_QSTR_tremolo_rate), MP_ROM_PTR(&synthio_note_tremolo_rate_obj) }, + { MP_ROM_QSTR(MP_QSTR_vibrato_depth), MP_ROM_PTR(&synthio_note_vibrato_depth_obj) }, + { MP_ROM_QSTR(MP_QSTR_vibrato_rate), MP_ROM_PTR(&synthio_note_vibrato_rate_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(synthio_note_locals_dict, synthio_note_locals_dict_table); + +const mp_obj_type_t synthio_note_type = { + { &mp_type_type }, + .name = MP_QSTR_Note, + .make_new = synthio_note_make_new, + .locals_dict = (mp_obj_dict_t *)&synthio_note_locals_dict, + .print = note_print, +}; diff --git a/shared-bindings/synthio/Note.h b/shared-bindings/synthio/Note.h new file mode 100644 index 0000000000..ab9d925f03 --- /dev/null +++ b/shared-bindings/synthio/Note.h @@ -0,0 +1,30 @@ +#pragma once + +#include "py/obj.h" + +typedef struct synthio_note_obj synthio_note_obj_t; +extern const mp_obj_type_t synthio_note_type; + +mp_float_t common_hal_synthio_note_get_frequency(synthio_note_obj_t *self); +void common_hal_synthio_note_set_frequency(synthio_note_obj_t *self, mp_float_t value); + +mp_float_t common_hal_synthio_note_get_amplitude(synthio_note_obj_t *self); +void common_hal_synthio_note_set_amplitude(synthio_note_obj_t *self, mp_float_t value); + +mp_float_t common_hal_synthio_note_get_tremolo_rate(synthio_note_obj_t *self); +void common_hal_synthio_note_set_tremolo_rate(synthio_note_obj_t *self, mp_float_t value); + +mp_float_t common_hal_synthio_note_get_tremolo_depth(synthio_note_obj_t *self); +void common_hal_synthio_note_set_tremolo_depth(synthio_note_obj_t *self, mp_float_t value); + +mp_float_t common_hal_synthio_note_get_vibrato_rate(synthio_note_obj_t *self); +void common_hal_synthio_note_set_vibrato_rate(synthio_note_obj_t *self, mp_float_t value); + +mp_float_t common_hal_synthio_note_get_vibrato_depth(synthio_note_obj_t *self); +void common_hal_synthio_note_set_vibrato_depth(synthio_note_obj_t *self, mp_float_t value); + +mp_obj_t common_hal_synthio_note_get_waveform_obj(synthio_note_obj_t *self); +void common_hal_synthio_note_set_waveform(synthio_note_obj_t *self, mp_obj_t value); + +mp_obj_t common_hal_synthio_note_get_envelope_obj(synthio_note_obj_t *self); +void common_hal_synthio_note_set_envelope(synthio_note_obj_t *self, mp_obj_t value); diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index 97941b860b..5d9be09f70 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -36,6 +36,9 @@ #include "shared-bindings/synthio/__init__.h" #include "supervisor/shared/translate/translate.h" +//| NoteSequence = Sequence[Union[int, Note]] +//| """A sequence of notes, which can each be integer MIDI notes or `Note` objects""" +//| //| class Synthesizer: //| def __init__( //| self, @@ -48,7 +51,9 @@ //| //| This API is experimental. //| -//| Notes use MIDI note numbering, with 60 being C4 or Middle C, approximately 262Hz. +//| Integer notes use MIDI note numbering, with 60 being C4 or Middle C, +//| approximately 262Hz. Integer notes use the given waveform & envelope, +//| and do not support advanced features like tremolo or vibrato. //| //| :param int sample_rate: The desired playback sample rate; higher sample rate requires more memory //| :param ReadableBuffer waveform: A single-cycle waveform. Default is a 50% duty cycle square wave. If specified, must be a ReadableBuffer of type 'h' (signed 16 bit) @@ -76,7 +81,6 @@ STATIC mp_obj_t synthio_synthesizer_make_new(const mp_obj_type_t *type, size_t n bufinfo_waveform.len / 2, args[ARG_envelope].u_obj); - return MP_OBJ_FROM_PTR(self); } @@ -86,12 +90,12 @@ STATIC void check_for_deinit(synthio_synthesizer_obj_t *self) { } } -//| def press(self, /, press: Sequence[int] = ()) -> None: -//| """Turn some notes on. Notes use MIDI numbering, with 60 being middle C, approximately 262Hz. +//| def press(self, /, press: NoteSequence = ()) -> None: +//| """Turn some notes on. //| //| Pressing a note that was already pressed has no effect. //| -//| :param Sequence[int] press: Any sequence of integer notes.""" +//| :param NoteSequence press: Any sequence of notes.""" STATIC mp_obj_t synthio_synthesizer_press(mp_obj_t self_in, mp_obj_t press) { synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -99,12 +103,12 @@ STATIC mp_obj_t synthio_synthesizer_press(mp_obj_t self_in, mp_obj_t press) { return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_press_obj, synthio_synthesizer_press); -//| def release(self, /, release: Sequence[int] = ()) -> None: -//| """Turn some notes off. Notes use MIDI numbering, with 60 being middle C, approximately 262Hz. +//| def release(self, /, release: NoteSequence = ()) -> None: +//| """Turn some notes off. //| //| Releasing a note that was already released has no effect. //| -//| :param Sequence[int] release: Any sequence of integer notes.""" +//| :param NoteSequence release: Any sequence of notes.""" STATIC mp_obj_t synthio_synthesizer_release(mp_obj_t self_in, mp_obj_t release) { synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -113,10 +117,8 @@ STATIC mp_obj_t synthio_synthesizer_release(mp_obj_t self_in, mp_obj_t release) } STATIC MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_release_obj, synthio_synthesizer_release); -//| def release_then_press( -//| self, release: Sequence[int] = (), press: Sequence[int] = () -//| ) -> None: -//| """Turn some notes on and/or off. Notes use MIDI numbering, with 60 being middle C. +//| def release_then_press(self, release: NoteSequence = (), press: NoteSequence = ()) -> None: +//| """Turn some notes on and/or off. //| //| It is OK to release note that was not actually turned on. //| @@ -125,8 +127,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_release_obj, synthio_synthe //| Releasing and pressing the note again has little effect, but does reset the phase //| of the note, which may be perceptible as a small glitch. //| -//| :param Sequence[int] release: Any sequence of integer notes. -//| :param Sequence[int] press: Any sequence of integer notes.""" +//| :param NoteSequence release: Any sequence of notes. +//| :param NoteSequence press: Any sequence of notes.""" STATIC mp_obj_t synthio_synthesizer_release_then_press(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_release, ARG_press }; static const mp_arg_t allowed_args[] = { @@ -146,13 +148,13 @@ STATIC mp_obj_t synthio_synthesizer_release_then_press(mp_uint_t n_args, const m STATIC MP_DEFINE_CONST_FUN_OBJ_KW(synthio_synthesizer_release_then_press_obj, 1, synthio_synthesizer_release_then_press); // -//| def release_all_then_press(self, /, press: Sequence[int]) -> None: +//| def release_all_then_press(self, /, press: NoteSequence) -> None: //| """Turn any currently-playing notes off, then turn on the given notes //| //| Releasing and pressing the note again has little effect, but does reset the phase //| of the note, which may be perceptible as a small glitch. //| -//| :param Sequence[int] press: Any sequence of integer notes.""" +//| :param NoteSequence press: Any sequence of notes.""" STATIC mp_obj_t synthio_synthesizer_release_all_then_press(mp_obj_t self_in, mp_obj_t press) { synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -183,7 +185,7 @@ STATIC mp_obj_t synthio_synthesizer_deinit(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(synthio_synthesizer_deinit_obj, synthio_synthesizer_deinit); -//| def __enter__(self) -> MidiTrack: +//| def __enter__(self) -> Synthesizer: //| """No-op used by Context Managers.""" //| ... // Provided by context manager helper. @@ -232,7 +234,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(synthio_synthesizer_get_sample_rate_obj, synthio_synth MP_PROPERTY_GETTER(synthio_synthesizer_sample_rate_obj, (mp_obj_t)&synthio_synthesizer_get_sample_rate_obj); -//| pressed: Tuple[int] +//| pressed: NoteSequence //| """A sequence of the currently pressed notes (read-only property)""" //| STATIC mp_obj_t synthio_synthesizer_obj_get_pressed(mp_obj_t self_in) { diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 89929b0563..7478925dcc 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -35,6 +35,7 @@ #include "shared-bindings/synthio/__init__.h" #include "shared-bindings/synthio/MidiTrack.h" +#include "shared-bindings/synthio/Note.h" #include "shared-bindings/synthio/Synthesizer.h" #define default_attack_time (MICROPY_FLOAT_CONST(0.1)) @@ -157,7 +158,6 @@ const mp_obj_namedtuple_type_t synthio_envelope_type_obj = { }, }; - //| def from_file( //| file: typing.BinaryIO, //| *, @@ -271,6 +271,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(synthio_midi_to_hz_obj, midi_to_hz); STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_synthio) }, { MP_ROM_QSTR(MP_QSTR_MidiTrack), MP_ROM_PTR(&synthio_miditrack_type) }, + { MP_ROM_QSTR(MP_QSTR_Note), MP_ROM_PTR(&synthio_note_type) }, { MP_ROM_QSTR(MP_QSTR_Synthesizer), MP_ROM_PTR(&synthio_synthesizer_type) }, { MP_ROM_QSTR(MP_QSTR_from_file), MP_ROM_PTR(&synthio_from_file_obj) }, { MP_ROM_QSTR(MP_QSTR_Envelope), MP_ROM_PTR(&synthio_envelope_type_obj) }, diff --git a/shared-module/synthio/MidiTrack.c b/shared-module/synthio/MidiTrack.c index c59fa23bef..343a107db2 100644 --- a/shared-module/synthio/MidiTrack.c +++ b/shared-module/synthio/MidiTrack.c @@ -33,7 +33,7 @@ STATIC void print_midi_stream_error(synthio_miditrack_obj_t *self) { self->pos = self->track.len; } -STATIC uint8_t parse_note(synthio_miditrack_obj_t *self) { +STATIC mp_obj_t parse_note(synthio_miditrack_obj_t *self) { uint8_t *buffer = self->track.buf; size_t len = self->track.len; if (self->pos + 1 >= len) { @@ -43,7 +43,7 @@ STATIC uint8_t parse_note(synthio_miditrack_obj_t *self) { if (note > 127 || buffer[(self->pos)++] > 127) { print_midi_stream_error(self); } - return note; + return MP_OBJ_NEW_SMALL_INT(note); } static int decode_duration(synthio_miditrack_obj_t *self) { @@ -72,12 +72,12 @@ static void decode_until_pause(synthio_miditrack_obj_t *self) { do { switch (buffer[self->pos++] >> 4) { case 8: { // Note Off - uint8_t note = parse_note(self); + mp_obj_t note = parse_note(self); synthio_span_change_note(&self->synth, note, SYNTHIO_SILENCE); break; } case 9: { // Note On - uint8_t note = parse_note(self); + mp_obj_t note = parse_note(self); synthio_span_change_note(&self->synth, SYNTHIO_SILENCE, note); break; } diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c new file mode 100644 index 0000000000..d31acb31f0 --- /dev/null +++ b/shared-module/synthio/Note.c @@ -0,0 +1,158 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "shared-module/synthio/Note.h" +#include "shared-bindings/synthio/Note.h" +#include "shared-bindings/synthio/__init__.h" + +static int32_t round_float_to_int(mp_float_t f) { + return (int32_t)(f + MICROPY_FLOAT_CONST(0.5)); +} + +mp_float_t common_hal_synthio_note_get_frequency(synthio_note_obj_t *self) { + return self->frequency; +} + +void common_hal_synthio_note_set_frequency(synthio_note_obj_t *self, mp_float_t value_in) { + mp_float_t val = mp_arg_validate_float_range(value_in, 0, 32767, MP_QSTR_frequency); + self->frequency = val; + self->frequency_scaled = synthio_frequency_convert_float_to_scaled(val); +} + +mp_float_t common_hal_synthio_note_get_amplitude(synthio_note_obj_t *self) { + return self->amplitude; +} + +void common_hal_synthio_note_set_amplitude(synthio_note_obj_t *self, mp_float_t value_in) { + mp_float_t val = mp_arg_validate_float_range(value_in, 0, 1, MP_QSTR_amplitude); + self->amplitude = val; + self->amplitude_scaled = round_float_to_int(val * 32767); +} + +mp_float_t common_hal_synthio_note_get_tremolo_depth(synthio_note_obj_t *self) { + return self->tremolo_descr.amplitude; +} + +void common_hal_synthio_note_set_tremolo_depth(synthio_note_obj_t *self, mp_float_t value_in) { + mp_float_t val = mp_arg_validate_float_range(value_in, 0, 1, MP_QSTR_tremolo_depth); + self->tremolo_descr.amplitude = val; + self->tremolo_state.amplitude_scaled = round_float_to_int(val * 32767); +} + +mp_float_t common_hal_synthio_note_get_tremolo_rate(synthio_note_obj_t *self) { + return self->tremolo_descr.frequency; +} + +void common_hal_synthio_note_set_tremolo_rate(synthio_note_obj_t *self, mp_float_t value_in) { + mp_float_t val = mp_arg_validate_float_range(value_in, 0, 60, MP_QSTR_tremolo_rate); + self->tremolo_descr.frequency = val; + if (self->sample_rate != 0) { + self->tremolo_state.dds = synthio_frequency_convert_float_to_dds(val, self->sample_rate); + } +} + +mp_float_t common_hal_synthio_note_get_vibrato_depth(synthio_note_obj_t *self) { + return self->vibrato_descr.amplitude; +} + +void common_hal_synthio_note_set_vibrato_depth(synthio_note_obj_t *self, mp_float_t value_in) { + mp_float_t val = mp_arg_validate_float_range(value_in, 0, 1, MP_QSTR_vibrato_depth); + self->vibrato_descr.amplitude = val; + self->vibrato_state.amplitude_scaled = round_float_to_int(val * 32767); +} + +mp_float_t common_hal_synthio_note_get_vibrato_rate(synthio_note_obj_t *self) { + return self->vibrato_descr.frequency; +} + +void common_hal_synthio_note_set_vibrato_rate(synthio_note_obj_t *self, mp_float_t value_in) { + mp_float_t val = mp_arg_validate_float_range(value_in, 0, 60, MP_QSTR_vibrato_rate); + self->vibrato_descr.frequency = val; + if (self->sample_rate != 0) { + self->vibrato_state.dds = synthio_frequency_convert_float_to_dds(val, self->sample_rate); + } +} + +mp_obj_t common_hal_synthio_note_get_envelope_obj(synthio_note_obj_t *self) { + return self->envelope_obj; +} + +void common_hal_synthio_note_set_envelope(synthio_note_obj_t *self, mp_obj_t envelope_in) { + if (envelope_in != mp_const_none) { + mp_arg_validate_type(envelope_in, (mp_obj_type_t *)&synthio_envelope_type_obj, MP_QSTR_envelope); + } + self->envelope_obj = envelope_in; +} + +mp_obj_t common_hal_synthio_note_get_waveform_obj(synthio_note_obj_t *self) { + return self->waveform_obj; +} + +void common_hal_synthio_note_set_waveform(synthio_note_obj_t *self, mp_obj_t waveform_in) { + if (waveform_in == mp_const_none) { + memset(&self->waveform_buf, 0, sizeof(self->waveform_buf)); + } else { + mp_buffer_info_t bufinfo_waveform; + synthio_synth_parse_waveform(&bufinfo_waveform, waveform_in); + self->waveform_buf = bufinfo_waveform; + } + self->waveform_obj = waveform_in; +} + +void synthio_note_recalculate(synthio_note_obj_t *self, int32_t sample_rate) { + if (sample_rate == self->sample_rate) { + return; + } + self->sample_rate = sample_rate; + + if (self->envelope_obj != mp_const_none) { + synthio_envelope_definition_set(&self->envelope_def, self->envelope_obj, sample_rate); + } + + synthio_lfo_set(&self->tremolo_state, &self->tremolo_descr, sample_rate); + self->tremolo_state.offset_scaled = 32768 - self->tremolo_state.amplitude_scaled; + synthio_lfo_set(&self->vibrato_state, &self->vibrato_descr, sample_rate); + self->vibrato_state.offset_scaled = 32768; +} + +void synthio_note_start(synthio_note_obj_t *self, int32_t sample_rate) { + synthio_note_recalculate(self, sample_rate); + self->phase = 0; +} + +uint32_t synthio_note_envelope(synthio_note_obj_t *self) { + return self->amplitude_scaled; +} + +uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, uint16_t *loudness) { + int tremolo_value = synthio_lfo_step(&self->tremolo_state, dur); + int vibrato_value = synthio_lfo_step(&self->vibrato_state, dur); + *loudness = (*loudness * tremolo_value) >> 15; + uint32_t frequency_scaled = ((uint64_t)self->frequency_scaled * vibrato_value) >> 15; + return frequency_scaled; +} diff --git a/shared-module/synthio/Note.h b/shared-module/synthio/Note.h new file mode 100644 index 0000000000..4b66997996 --- /dev/null +++ b/shared-module/synthio/Note.h @@ -0,0 +1,54 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "shared-module/synthio/__init__.h" + +typedef struct synthio_note_obj { + mp_obj_base_t base; + + mp_float_t frequency; + mp_float_t amplitude; + mp_obj_t waveform_obj, envelope_obj; + + int32_t sample_rate; + + int32_t phase; + int32_t frequency_scaled; + int32_t amplitude_scaled; + synthio_lfo_descr_t tremolo_descr, vibrato_descr; + synthio_lfo_state_t tremolo_state, vibrato_state; + + mp_buffer_info_t waveform_buf; + synthio_envelope_definition_t envelope_def; +} synthio_note_obj_t; + +void synthio_note_recalculate(synthio_note_obj_t *self, int32_t sample_rate); +uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, uint16_t *loudness); +void synthio_note_start(synthio_note_obj_t *self, int32_t sample_rate); +bool synthio_note_playing(synthio_note_obj_t *self); +uint32_t synthio_note_envelope(synthio_note_obj_t *self); diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index 42d0468845..02d98a521e 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -26,6 +26,8 @@ #include "py/runtime.h" #include "shared-bindings/synthio/Synthesizer.h" +#include "shared-bindings/synthio/Note.h" +#include "shared-module/synthio/Note.h" @@ -72,40 +74,58 @@ void synthio_synthesizer_get_buffer_structure(synthio_synthesizer_obj_t *self, b void common_hal_synthio_synthesizer_release_all(synthio_synthesizer_obj_t *self) { for (size_t i = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { - if (self->synth.span.note[i] != SYNTHIO_SILENCE) { - synthio_span_change_note(&self->synth, self->synth.span.note[i], SYNTHIO_SILENCE); + if (self->synth.span.note_obj[i] != SYNTHIO_SILENCE) { + synthio_span_change_note(&self->synth, self->synth.span.note_obj[i], SYNTHIO_SILENCE); } } } + +STATIC mp_obj_t validate_note(mp_obj_t note_in) { + if (mp_obj_is_small_int(note_in)) { + mp_arg_validate_int_range(mp_obj_get_int(note_in), 0, 127, MP_QSTR_note); + } else { + const mp_obj_type_t *note_type = mp_obj_get_type(note_in); + if (note_type != &synthio_note_type) { + mp_raise_TypeError_varg(translate("%q must be of type %q or %q, not %q"), MP_QSTR_note, MP_QSTR_int, MP_QSTR_Note, note_type->name); + } + } + return note_in; +} + void common_hal_synthio_synthesizer_release(synthio_synthesizer_obj_t *self, mp_obj_t to_release) { mp_obj_iter_buf_t iter_buf; mp_obj_t iterable = mp_getiter(to_release, &iter_buf); mp_obj_t item; while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - synthio_span_change_note(&self->synth, mp_arg_validate_int_range(mp_obj_get_int(item), 0, 127, MP_QSTR_note), SYNTHIO_SILENCE); + synthio_span_change_note(&self->synth, validate_note(item), SYNTHIO_SILENCE); } } void common_hal_synthio_synthesizer_press(synthio_synthesizer_obj_t *self, mp_obj_t to_press) { mp_obj_iter_buf_t iter_buf; mp_obj_t iterable = mp_getiter(to_press, &iter_buf); - mp_obj_t item; - while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - synthio_span_change_note(&self->synth, SYNTHIO_SILENCE, mp_arg_validate_int_range(mp_obj_get_int(item), 0, 127, MP_QSTR_note)); + mp_obj_t note_obj; + while ((note_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { + if (synthio_span_change_note(&self->synth, SYNTHIO_SILENCE, validate_note(note_obj))) { + if (!mp_obj_is_small_int(note_obj)) { + synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); + synthio_note_start(note, self->synth.sample_rate); + } + } } } mp_obj_t common_hal_synthio_synthesizer_get_pressed_notes(synthio_synthesizer_obj_t *self) { int count = 0; for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { - if (self->synth.span.note[chan] != SYNTHIO_SILENCE && self->synth.envelope_state[chan].state != SYNTHIO_ENVELOPE_STATE_RELEASE) { + if (self->synth.span.note_obj[chan] != SYNTHIO_SILENCE && SYNTHIO_NOTE_IS_PLAYING(&self->synth, chan)) { count += 1; } } mp_obj_tuple_t *result = MP_OBJ_TO_PTR(mp_obj_new_tuple(count, NULL)); for (size_t chan = 0, j = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { - if (self->synth.span.note[chan] != SYNTHIO_SILENCE && self->synth.envelope_state[chan].state != SYNTHIO_ENVELOPE_STATE_RELEASE) { - result->items[j++] = MP_OBJ_NEW_SMALL_INT(self->synth.span.note[chan]); + if (self->synth.span.note_obj[chan] != SYNTHIO_SILENCE && SYNTHIO_NOTE_IS_PLAYING(&self->synth, chan)) { + result->items[j++] = self->synth.span.note_obj[chan]; } } return MP_OBJ_FROM_PTR(result); diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 8c17dfdeed..857f483780 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -27,6 +27,7 @@ #include "shared-module/synthio/__init__.h" #include "shared-bindings/synthio/__init__.h" +#include "shared-module/synthio/Note.h" #include "py/runtime.h" #include #include @@ -36,6 +37,14 @@ STATIC const int16_t square_wave[] = {-32768, 32767}; STATIC const uint16_t notes[] = {8372, 8870, 9397, 9956, 10548, 11175, 11840, 12544, 13290, 14080, 14917, 15804}; // 9th octave +static int32_t round_float_to_int(mp_float_t f) { + return (int32_t)(f + MICROPY_FLOAT_CONST(0.5)); +} + +static int64_t round_float_to_int64(mp_float_t f) { + return (int64_t)(f + MICROPY_FLOAT_CONST(0.5)); +} + mp_float_t common_hal_synthio_midi_to_hz_float(mp_int_t arg) { uint8_t octave = arg / 12; uint16_t base_freq = notes[arg % 12]; @@ -52,7 +61,7 @@ STATIC int16_t convert_time_to_rate(uint32_t sample_rate, mp_obj_t time_in, int1 return (difference < 0) ? -result : result; } -STATIC void synthio_envelope_definition_set(synthio_envelope_definition_t *envelope, mp_obj_t obj, uint32_t sample_rate) { +void synthio_envelope_definition_set(synthio_envelope_definition_t *envelope, mp_obj_t obj, uint32_t sample_rate) { if (obj == mp_const_none) { envelope->attack_level = 32767; envelope->sustain_level = 32767; @@ -141,7 +150,7 @@ STATIC void synthio_envelope_state_release(synthio_envelope_state_t *state, synt STATIC uint32_t synthio_synth_sum_envelope(synthio_synth_t *synth) { uint32_t result = 0; for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { - if (synth->span.note[chan] != SYNTHIO_SILENCE) { + if (synth->span.note_obj[chan] != SYNTHIO_SILENCE) { result += synth->envelope_state[chan].level; } } @@ -168,12 +177,10 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t int32_t sample_rate = synth->sample_rate; uint32_t total_envelope = synthio_synth_sum_envelope(synth); - const int16_t *waveform = synth->waveform; - uint32_t waveform_length = synth->waveform_length; if (total_envelope > 0) { uint16_t ovl_loudness = 0x7fffffff / MAX(0x8000, total_envelope); for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { - if (synth->span.note[chan] == SYNTHIO_SILENCE) { + if (synth->span.note_obj[chan] == SYNTHIO_SILENCE) { synth->accum[chan] = 0; continue; } @@ -182,25 +189,52 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t if (synth->envelope_state[chan].level == 0) { // note is truly finished - synth->span.note[chan] = SYNTHIO_SILENCE; + synth->span.note_obj[chan] = SYNTHIO_SILENCE; } - uint8_t octave = synth->span.note[chan] / 12; - uint16_t base_freq = notes[synth->span.note[chan] % 12]; + + uint32_t dds_rate; + const int16_t *waveform = synth->waveform; + uint32_t waveform_length = synth->waveform_length; + mp_obj_t note_obj = synth->span.note_obj[chan]; + if (mp_obj_is_small_int(note_obj)) { + uint8_t note = mp_obj_get_int(note_obj); + uint8_t octave = note / 12; + uint16_t base_freq = notes[note % 12]; + // rate = base_freq * waveform_length + // den = sample_rate * 2 ^ (10 - octave) + // den = sample_rate * 2 ^ 10 / 2^octave + // dds_rate = 2^SHIFT * rate / den + // dds_rate = 2^(SHIFT-10+octave) * base_freq * waveform_length / sample_rate + dds_rate = (sample_rate / 2 + ((uint64_t)(base_freq * waveform_length) << (SYNTHIO_FREQUENCY_SHIFT - 10 + octave))) / sample_rate; + } else { + synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); + int32_t frequency_scaled = synthio_note_step(note, sample_rate, dur, &loudness); + if (note->waveform_buf.buf) { + waveform = note->waveform_buf.buf; + waveform_length = note->waveform_buf.len / 2; + } + dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)frequency_scaled * waveform_length, sample_rate); + } + uint32_t accum = synth->accum[chan]; -#define SHIFT (16) - // rate = base_freq * waveform_length - // den = sample_rate * 2 ^ (10 - octave) - // den = sample_rate * 2 ^ 10 / 2^octave - // dds_rate = 2^SHIFT * rate / den - // dds_rate = 2^(SHIFT-10+octave) * base_freq * waveform_length / sample_rate - uint32_t dds_rate = (sample_rate / 2 + ((uint64_t)(base_freq * waveform_length) << (SHIFT - 10 + octave))) / sample_rate; + uint32_t lim = waveform_length << SYNTHIO_FREQUENCY_SHIFT; + if (dds_rate > lim / 2) { + // beyond nyquist, can't play note + continue; + } + + // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided + if (accum > lim) { + accum %= lim; + } for (uint16_t i = 0; i < dur; i++) { accum += dds_rate; - if (accum > waveform_length << SHIFT) { - accum -= waveform_length << SHIFT; + // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed + if (accum > lim) { + accum -= lim; } - int16_t idx = accum >> SHIFT; + int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; out_buffer[i] += (waveform[idx] * loudness) / 65536; } synth->accum[chan] = accum; @@ -209,7 +243,18 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t // advance envelope states for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { - synthio_envelope_state_step(&synth->envelope_state[chan], &synth->envelope_definition, dur); + mp_obj_t note_obj = synth->span.note_obj[chan]; + if (note_obj == SYNTHIO_SILENCE) { + continue; + } + synthio_envelope_definition_t *def = &synth->envelope_definition; + if (!mp_obj_is_small_int(note_obj)) { + synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); + if (note->envelope_obj != mp_const_none) { + def = ¬e->envelope_def; + } + } + synthio_envelope_state_step(&synth->envelope_state[chan], def, dur); } *buffer_length = synth->last_buffer_length = dur * SYNTHIO_BYTES_PER_SAMPLE; @@ -254,7 +299,7 @@ void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, const int1 synthio_synth_envelope_set(synth, envelope_obj); for (size_t i = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { - synth->span.note[i] = SYNTHIO_SILENCE; + synth->span.note_obj[i] = SYNTHIO_SILENCE; } } @@ -283,16 +328,16 @@ void synthio_synth_parse_waveform(mp_buffer_info_t *bufinfo_waveform, mp_obj_t w parse_common(bufinfo_waveform, waveform_obj, MP_QSTR_waveform); } -STATIC int find_channel_with_note(synthio_synth_t *synth, uint8_t note) { +STATIC int find_channel_with_note(synthio_synth_t *synth, mp_obj_t note) { for (int i = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { - if (synth->span.note[i] == note) { + if (synth->span.note_obj[i] == note) { return i; } } if (note == SYNTHIO_SILENCE) { // we need a victim note that is releasing. simple algorithm: lowest numbered slot for (int i = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { - if (SYNTHIO_VOICE_IS_RELEASING(synth, i)) { + if (!SYNTHIO_NOTE_IS_PLAYING(synth, i)) { return i; } } @@ -300,7 +345,7 @@ STATIC int find_channel_with_note(synthio_synth_t *synth, uint8_t note) { return -1; } -bool synthio_span_change_note(synthio_synth_t *synth, uint8_t old_note, uint8_t new_note) { +bool synthio_span_change_note(synthio_synth_t *synth, mp_obj_t old_note, mp_obj_t new_note) { int channel; if (new_note != SYNTHIO_SILENCE && (channel = find_channel_with_note(synth, new_note)) != -1) { // note already playing, re-strike @@ -313,7 +358,7 @@ bool synthio_span_change_note(synthio_synth_t *synth, uint8_t old_note, uint8_t if (new_note == SYNTHIO_SILENCE) { synthio_envelope_state_release(&synth->envelope_state[channel], &synth->envelope_definition); } else { - synth->span.note[channel] = new_note; + synth->span.note_obj[channel] = new_note; synthio_envelope_state_init(&synth->envelope_state[channel], &synth->envelope_definition); synth->accum[channel] = 0; } @@ -321,3 +366,39 @@ bool synthio_span_change_note(synthio_synth_t *synth, uint8_t old_note, uint8_t } return false; } + +uint64_t synthio_frequency_convert_float_to_scaled(mp_float_t val) { + return round_float_to_int64(val * (1 << SYNTHIO_FREQUENCY_SHIFT)); +} + +uint32_t synthio_frequency_convert_float_to_dds(mp_float_t frequency_hz, int32_t sample_rate) { + return synthio_frequency_convert_scaled_to_dds(synthio_frequency_convert_float_to_scaled(frequency_hz), sample_rate); +} + +uint32_t synthio_frequency_convert_scaled_to_dds(uint64_t frequency_scaled, int32_t sample_rate) { + return (sample_rate / 2 + frequency_scaled) / sample_rate; +} + +void synthio_lfo_set(synthio_lfo_state_t *state, const synthio_lfo_descr_t *descr, uint32_t sample_rate) { + state->amplitude_scaled = round_float_to_int(descr->amplitude * 32768); + state->dds = synthio_frequency_convert_float_to_dds(descr->frequency * 65536, sample_rate); +} + +int synthio_lfo_step(synthio_lfo_state_t *state, uint16_t dur) { + uint32_t phase = state->phase; + uint16_t whole_phase = phase >> 16; + + // advance the phase accumulator + state->phase = phase + state->dds * dur; + + // create a triangle wave, it's quick and easy + int v; + if (whole_phase < 16384) { // ramp from 0 to amplitude + v = (state->amplitude_scaled * whole_phase); + } else if (whole_phase < 49152) { // ramp from +amplitude to -amplitude + v = (state->amplitude_scaled * (32768 - whole_phase)); + } else { // from -amplitude to 0 + v = (state->amplitude_scaled * (whole_phase - 65536)); + } + return v / 16384 + state->offset_scaled; +} diff --git a/shared-module/synthio/__init__.h b/shared-module/synthio/__init__.h index 56521d3208..42e4ee79d4 100644 --- a/shared-module/synthio/__init__.h +++ b/shared-module/synthio/__init__.h @@ -29,14 +29,16 @@ #define SYNTHIO_BITS_PER_SAMPLE (16) #define SYNTHIO_BYTES_PER_SAMPLE (SYNTHIO_BITS_PER_SAMPLE / 8) #define SYNTHIO_MAX_DUR (256) -#define SYNTHIO_SILENCE (0x80) -#define SYNTHIO_VOICE_IS_RELEASING(synth, i) (synth->envelope_state[i].state == SYNTHIO_ENVELOPE_STATE_RELEASE) +#define SYNTHIO_SILENCE (mp_const_none) +#define SYNTHIO_NOTE_IS_SIMPLE(note) (mp_obj_is_small_int(note)) +#define SYNTHIO_NOTE_IS_PLAYING(synth, i) ((synth)->envelope_state[(i)].state != SYNTHIO_ENVELOPE_STATE_RELEASE) +#define SYNTHIO_FREQUENCY_SHIFT (16) #include "shared-module/audiocore/__init__.h" typedef struct { uint16_t dur; - uint8_t note[CIRCUITPY_SYNTHIO_MAX_CHANNELS]; + mp_obj_t note_obj[CIRCUITPY_SYNTHIO_MAX_CHANNELS]; } synthio_midi_span_t; typedef struct { @@ -73,6 +75,15 @@ typedef struct synthio_synth { synthio_envelope_state_t envelope_state[CIRCUITPY_SYNTHIO_MAX_CHANNELS]; } synthio_synth_t; +typedef struct { + mp_float_t amplitude, frequency; +} synthio_lfo_descr_t; + +typedef struct { + uint32_t amplitude_scaled, offset_scaled, dds, phase; +} synthio_lfo_state_t; + + void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **buffer, uint32_t *buffer_length, uint8_t channel); void synthio_synth_deinit(synthio_synth_t *synth); bool synthio_synth_deinited(synthio_synth_t *synth); @@ -84,6 +95,14 @@ void synthio_synth_reset_buffer(synthio_synth_t *synth, bool single_channel_outp void synthio_synth_parse_waveform(mp_buffer_info_t *bufinfo_waveform, mp_obj_t waveform_obj); void synthio_synth_parse_envelope(uint16_t *envelope_sustain_index, mp_buffer_info_t *bufinfo_envelope, mp_obj_t envelope_obj, mp_obj_t envelope_hold_obj); -bool synthio_span_change_note(synthio_synth_t *synth, uint8_t old_note, uint8_t new_note); +bool synthio_span_change_note(synthio_synth_t *synth, mp_obj_t old_note, mp_obj_t new_note); void synthio_envelope_step(synthio_envelope_definition_t *definition, synthio_envelope_state_t *state, int n_samples); +void synthio_envelope_definition_set(synthio_envelope_definition_t *envelope, mp_obj_t obj, uint32_t sample_rate); + +uint64_t synthio_frequency_convert_float_to_scaled(mp_float_t frequency_hz); +uint32_t synthio_frequency_convert_float_to_dds(mp_float_t frequency_hz, int32_t sample_rate); +uint32_t synthio_frequency_convert_scaled_to_dds(uint64_t frequency_scaled, int32_t sample_rate); + +void synthio_lfo_set(synthio_lfo_state_t *state, const synthio_lfo_descr_t *descr, uint32_t sample_rate); +int synthio_lfo_step(synthio_lfo_state_t *state, uint16_t dur); diff --git a/tests/circuitpython-manual/synthio/note/README.md b/tests/circuitpython-manual/synthio/note/README.md new file mode 100644 index 0000000000..84ac1cbd6f --- /dev/null +++ b/tests/circuitpython-manual/synthio/note/README.md @@ -0,0 +1,5 @@ +# Test synthio without hardware + +Build the unix port then run `....../ports/unix/micropython-coverage code.py`. + +This will create `tune.wav` as output, which you can listen to using any old audio player. diff --git a/tests/circuitpython-manual/synthio/note/audioop.py b/tests/circuitpython-manual/synthio/note/audioop.py new file mode 120000 index 0000000000..31896fe265 --- /dev/null +++ b/tests/circuitpython-manual/synthio/note/audioop.py @@ -0,0 +1 @@ +../wave/audioop.py \ No newline at end of file diff --git a/tests/circuitpython-manual/synthio/note/chunk.py b/tests/circuitpython-manual/synthio/note/chunk.py new file mode 120000 index 0000000000..00983c1f72 --- /dev/null +++ b/tests/circuitpython-manual/synthio/note/chunk.py @@ -0,0 +1 @@ +../wave/chunk.py \ No newline at end of file diff --git a/tests/circuitpython-manual/synthio/note/code.py b/tests/circuitpython-manual/synthio/note/code.py new file mode 100644 index 0000000000..72783d1b55 --- /dev/null +++ b/tests/circuitpython-manual/synthio/note/code.py @@ -0,0 +1,100 @@ +import random +import audiocore +import synthio +from ulab import numpy as np +import wave + +SAMPLE_SIZE = 1024 +VOLUME = 14700 +sine = np.array( + np.sin(np.linspace(0, 2 * np.pi, SAMPLE_SIZE, endpoint=False)) * VOLUME, + dtype=np.int16, +) + +envelope = synthio.Envelope( + attack_time=0.1, decay_time=0.05, release_time=0.2, attack_level=1, sustain_level=0.8 +) + +synth = synthio.Synthesizer(sample_rate=48000) + + +def synthesize(synth): + random.seed(3) + target_notes = [synthio.midi_to_hz(n + o) for n in (60, 64, 67, 70) for o in (-12, 12, 0)] + print(target_notes) + notes = [ + synthio.Note(frequency=random.randint(60, 20000), waveform=sine, envelope=envelope) + for note in target_notes + ] + synth.press(notes) + target = synthio.midi_to_hz(72) + factor = 0.98 + for i in range(600): + yield 1 + for ni, ti in zip(notes, target_notes): + print(ni.frequency, ti) + break + for ni, ti in zip(notes, target_notes): + ni.frequency = (ni.frequency * factor) + (ti * (1 - factor)) + synth.release_all() + yield 36 + + +def synthesize2(synth): + n = synthio.Note( + frequency=synthio.midi_to_hz(60), + tremolo_depth=0.2, + tremolo_rate=2, + waveform=sine, + envelope=envelope, + ) + synth.press((n,)) + yield 360 + synth.release_all() + yield 36 + + +def synthesize3(synth): + n = synthio.Note( + frequency=synthio.midi_to_hz(60), + vibrato_depth=0.1, + vibrato_rate=8, + waveform=sine, + envelope=envelope, + ) + synth.press((n,)) + yield 360 + synth.release_all() + yield 36 + + +def synthesize4(synth): + n = synthio.Note( + frequency=synthio.midi_to_hz(60), + tremolo_depth=0.1, + tremolo_rate=1.5, + vibrato_depth=0.1, + vibrato_rate=3, + waveform=sine, + envelope=envelope, + ) + synth.press((n,)) + yield 720 + synth.release_all() + yield 36 + + +def chain(*args): + for a in args: + yield from a + + +# sox -r 48000 -e signed -b 16 -c 1 tune.raw tune.wav +with wave.open("tune-noenv.wav", "w") as f: + f.setnchannels(1) + f.setsampwidth(2) + f.setframerate(48000) + for n in chain(synthesize2(synth), synthesize3(synth), synthesize4(synth)): + for i in range(n): + result, data = audiocore.get_buffer(synth) + f.writeframes(data) diff --git a/tests/circuitpython-manual/synthio/note/wave.py b/tests/circuitpython-manual/synthio/note/wave.py new file mode 120000 index 0000000000..45884bd29a --- /dev/null +++ b/tests/circuitpython-manual/synthio/note/wave.py @@ -0,0 +1 @@ +../wave/wave.py \ No newline at end of file diff --git a/tests/circuitpython-manual/synthio/wave/README.md b/tests/circuitpython-manual/synthio/wave/README.md index 27868bf9f3..83639b374d 100644 --- a/tests/circuitpython-manual/synthio/wave/README.md +++ b/tests/circuitpython-manual/synthio/wave/README.md @@ -1,5 +1,5 @@ # Test synthio without hardware -Build the uninx port then run `....../ports/unix/micropython-coverage midi2wav.py`. +Build the unix port then run `....../ports/unix/micropython-coverage midi2wav.py`. This will create `tune.wav` as output, which you can listen to using any old audio player. diff --git a/tests/circuitpython/synthesizer_note.py b/tests/circuitpython/synthesizer_note.py new file mode 100644 index 0000000000..77420e66f6 --- /dev/null +++ b/tests/circuitpython/synthesizer_note.py @@ -0,0 +1,41 @@ +import struct +import synthio +import audiocore + + +def dump_samples(): + print([i for i in audiocore.get_buffer(s)[1][:24]]) + + +n80 = synthio.Note(synthio.midi_to_hz(80)) +n91 = synthio.Note(synthio.midi_to_hz(80)) + +s = synthio.Synthesizer(sample_rate=8000) +print(s.pressed) +dump_samples() + +s.press((n80,)) +print(s.pressed) +dump_samples() + +s.press((n91,)) +print(s.pressed) +dump_samples() + +s.release_then_press((n80,)) +print(s.pressed) +dump_samples() + +envelope = synthio.Envelope( + attack_time=0.1, decay_time=0.05, release_time=0.2, attack_level=1, sustain_level=0.8 +) +n60 = synthio.Note(synthio.midi_to_hz(60), envelope=envelope) +s = synthio.Synthesizer(sample_rate=8000, envelope=envelope) +s.press((n60,)) +for _ in range(12): + buf = audiocore.get_buffer(s)[1] + print((min(buf), max(buf))) +s.release_all() +for _ in range(12): + buf = audiocore.get_buffer(s)[1] + print((min(buf), max(buf))) diff --git a/tests/circuitpython/synthesizer_note.py.exp b/tests/circuitpython/synthesizer_note.py.exp new file mode 100644 index 0000000000..82ae685c07 --- /dev/null +++ b/tests/circuitpython/synthesizer_note.py.exp @@ -0,0 +1,32 @@ +() +[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +(Note(frequency=830.625, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None),) +[-16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383] +(Note(frequency=830.625, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None), Note(frequency=830.625, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None)) +[0, 0, 0, 0, 0, 0, 0, 0, 16382, 0, 0, 0, 0, -16382, 0, 0, 0, 0, 16382, 0, 0, 0, 0, -16382] +(Note(frequency=830.625, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None),) +[0, 0, 0, 16382, 0, 0, 0, 0, 0, 0, 0, 0, 16382, 0, 0, 0, 0, -16382, 0, 0, 0, 0, 16382, 0] +(-5242, 5241) +(-10484, 10484) +(-15727, 15726) +(-16383, 16382) +(-14286, 14285) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-11009, 11008) +(-8912, 8911) +(-6815, 6814) +(-4718, 4717) +(-2621, 2620) +(-524, 523) +(0, 0) +(0, 0) +(0, 0) +(0, 0) +(0, 0) From 4f56b7646e9c7107a4a0e9d1addf58d6df4d5a5d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 2 May 2023 14:14:50 -0500 Subject: [PATCH 0971/1712] synthio: slow ramp overall envelope back up .. and account releasing notes at their sustain level until they're done. this ameliorates the effect where multiple releasing notes don't seem to actually be releasing, but stay at a constant volume. --- shared-module/synthio/__init__.c | 30 ++++++++++++++++++++++++------ shared-module/synthio/__init__.h | 1 + 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 857f483780..19e9990b17 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -151,7 +151,12 @@ STATIC uint32_t synthio_synth_sum_envelope(synthio_synth_t *synth) { uint32_t result = 0; for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { if (synth->span.note_obj[chan] != SYNTHIO_SILENCE) { - result += synth->envelope_state[chan].level; + synthio_envelope_state_t *state = &synth->envelope_state[chan]; + if (state->state == SYNTHIO_ENVELOPE_STATE_RELEASE) { + result += synth->envelope_definition.sustain_level; + } else { + result += state->level; + } } } return result; @@ -177,25 +182,38 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t int32_t sample_rate = synth->sample_rate; uint32_t total_envelope = synthio_synth_sum_envelope(synth); + if (total_envelope < synth->total_envelope) { + // total envelope is decreasing. Slowly let remaining notes get louder + // the time constant is arbitrary, on the order of 1s at 48kHz + total_envelope = synth->total_envelope = ( + total_envelope + synth->total_envelope * 255) / 256; + } else { + // total envelope is steady or increasing, so just store this as + // the high water mark + synth->total_envelope = total_envelope; + } if (total_envelope > 0) { uint16_t ovl_loudness = 0x7fffffff / MAX(0x8000, total_envelope); + for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { - if (synth->span.note_obj[chan] == SYNTHIO_SILENCE) { + mp_obj_t note_obj = synth->span.note_obj[chan]; + if (note_obj == SYNTHIO_SILENCE) { synth->accum[chan] = 0; continue; } - // adjust loudness by envelope - uint16_t loudness = (ovl_loudness * synth->envelope_state[chan].level) >> 16; if (synth->envelope_state[chan].level == 0) { - // note is truly finished + // note is truly finished, but we only just noticed synth->span.note_obj[chan] = SYNTHIO_SILENCE; + continue; } + // adjust loudness by envelope + uint16_t loudness = (ovl_loudness * synth->envelope_state[chan].level) >> 16; + uint32_t dds_rate; const int16_t *waveform = synth->waveform; uint32_t waveform_length = synth->waveform_length; - mp_obj_t note_obj = synth->span.note_obj[chan]; if (mp_obj_is_small_int(note_obj)) { uint8_t note = mp_obj_get_int(note_obj); uint8_t octave = note / 12; diff --git a/shared-module/synthio/__init__.h b/shared-module/synthio/__init__.h index 42e4ee79d4..29520dfb5b 100644 --- a/shared-module/synthio/__init__.h +++ b/shared-module/synthio/__init__.h @@ -62,6 +62,7 @@ typedef struct { typedef struct synthio_synth { uint32_t sample_rate; + uint32_t total_envelope; int16_t *buffers[2]; const int16_t *waveform; uint16_t buffer_length; From c06597c07aaacf7ae0125467d905e7b169d23fc2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 2 May 2023 14:00:31 -0500 Subject: [PATCH 0972/1712] synthio: replace the quietest releasing note when over-writing --- shared-module/synthio/__init__.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 19e9990b17..4b32ec3e91 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -352,15 +352,21 @@ STATIC int find_channel_with_note(synthio_synth_t *synth, mp_obj_t note) { return i; } } + int result = -1; if (note == SYNTHIO_SILENCE) { - // we need a victim note that is releasing. simple algorithm: lowest numbered slot - for (int i = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { - if (!SYNTHIO_NOTE_IS_PLAYING(synth, i)) { - return i; + // replace the releasing note with lowest volume level + int level = 32768; + for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { + if (!SYNTHIO_NOTE_IS_PLAYING(synth, chan)) { + synthio_envelope_state_t *state = &synth->envelope_state[chan]; + if (state->level < level) { + result = chan; + level = state->level; + } } } } - return -1; + return result; } bool synthio_span_change_note(synthio_synth_t *synth, mp_obj_t old_note, mp_obj_t new_note) { From 1701552decff4fa50e1f92240d2833f03118339b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 4 May 2023 07:22:02 -0500 Subject: [PATCH 0973/1712] synthio: make sustain level relative to attack level and re-vamp overall envelope calculation again. Now, if you set a low overall attack level like 0.2 this avoids the "diminishing volume" effect when many notes sound at once. You need simply choose a maximum attack level that is appropriate for the max number of voices that will actually be played. --- shared-bindings/synthio/__init__.c | 8 ++++---- shared-module/synthio/__init__.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 7478925dcc..5af352b404 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -79,8 +79,8 @@ static const mp_arg_t envelope_properties[] = { //| :param float attack_time: The time in seconds it takes to ramp from 0 volume to attack_volume //| :param float decay_time: The time in seconds it takes to ramp from attack_volume to sustain_volume //| :param float release_time: The time in seconds it takes to ramp from sustain_volume to release_volume. When a note is released before it has reached the sustain phase, the release is done with the same slope indicated by ``release_time`` and ``sustain_level`` -//| :param float attack_level: The relative level, in the range ``0.0`` to ``1.0`` of the peak volume of the attack phase -//| :param float sustain_level: The relative level, in the range ``0.0`` to ``1.0`` of the volume of the sustain phase +//| :param float attack_level: The level, in the range ``0.0`` to ``1.0`` of the peak volume of the attack phase +//| :param float sustain_level: The level, in the range ``0.0`` to ``1.0`` of the volume of the sustain phase relative to the attack level //| """ //| attack_time: float //| """The time in seconds it takes to ramp from 0 volume to attack_volume""" @@ -92,10 +92,10 @@ static const mp_arg_t envelope_properties[] = { //| """The time in seconds it takes to ramp from sustain_volume to release_volume. When a note is released before it has reached the sustain phase, the release is done with the same slope indicated by ``release_time`` and ``sustain_level``""" //| //| attack_level: float -//| """The relative level, in the range ``0.0`` to ``1.0`` of the peak volume of the attack phase""" +//| """The level, in the range ``0.0`` to ``1.0`` of the peak volume of the attack phase""" //| //| sustain_level: float -//| """The relative level, in the range ``0.0`` to ``1.0`` of the volume of the sustain phase""" +//| """The level, in the range ``0.0`` to ``1.0`` of the volume of the sustain phase relative to the attack level""" //| STATIC mp_obj_t synthio_envelope_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 4b32ec3e91..fc9d31f029 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -77,7 +77,7 @@ void synthio_envelope_definition_set(synthio_envelope_definition_t *envelope, mp mp_obj_tuple_get(obj, &len, &fields); envelope->attack_level = (int)(32767 * mp_obj_get_float(fields[3])); - envelope->sustain_level = (int)(32767 * mp_obj_get_float(fields[4])); + envelope->sustain_level = (int)(32767 * mp_obj_get_float(fields[4]) * mp_obj_get_float(fields[3])); envelope->attack_step = convert_time_to_rate( sample_rate, fields[0], envelope->attack_level); @@ -152,10 +152,10 @@ STATIC uint32_t synthio_synth_sum_envelope(synthio_synth_t *synth) { for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { if (synth->span.note_obj[chan] != SYNTHIO_SILENCE) { synthio_envelope_state_t *state = &synth->envelope_state[chan]; - if (state->state == SYNTHIO_ENVELOPE_STATE_RELEASE) { - result += synth->envelope_definition.sustain_level; - } else { + if (state->state == SYNTHIO_ENVELOPE_STATE_ATTACK) { result += state->level; + } else { + result += synth->envelope_definition.attack_level; } } } From 021aaa4599718901bd45c06c440c736a892126d0 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 4 May 2023 07:22:20 -0500 Subject: [PATCH 0974/1712] synthio: remove unused 'phase' from Note objects --- shared-module/synthio/Note.c | 1 - shared-module/synthio/Note.h | 1 - 2 files changed, 2 deletions(-) diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index d31acb31f0..b6357559ee 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -142,7 +142,6 @@ void synthio_note_recalculate(synthio_note_obj_t *self, int32_t sample_rate) { void synthio_note_start(synthio_note_obj_t *self, int32_t sample_rate) { synthio_note_recalculate(self, sample_rate); - self->phase = 0; } uint32_t synthio_note_envelope(synthio_note_obj_t *self) { diff --git a/shared-module/synthio/Note.h b/shared-module/synthio/Note.h index 4b66997996..4efb197c07 100644 --- a/shared-module/synthio/Note.h +++ b/shared-module/synthio/Note.h @@ -37,7 +37,6 @@ typedef struct synthio_note_obj { int32_t sample_rate; - int32_t phase; int32_t frequency_scaled; int32_t amplitude_scaled; synthio_lfo_descr_t tremolo_descr, vibrato_descr; From 2b0231e9d313a4657a95b4a4a5c364f94c582859 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 4 May 2023 07:23:17 -0500 Subject: [PATCH 0975/1712] synthio: re-striking a note should re-enter attack .. without changing the current note amplitude --- shared-module/synthio/__init__.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index fc9d31f029..6a9911aa9f 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -372,9 +372,8 @@ STATIC int find_channel_with_note(synthio_synth_t *synth, mp_obj_t note) { bool synthio_span_change_note(synthio_synth_t *synth, mp_obj_t old_note, mp_obj_t new_note) { int channel; if (new_note != SYNTHIO_SILENCE && (channel = find_channel_with_note(synth, new_note)) != -1) { - // note already playing, re-strike - synthio_envelope_state_init(&synth->envelope_state[channel], &synth->envelope_definition); - synth->accum[channel] = 0; + // note already playing, re-enter attack phase + synth->envelope_state[channel].state = SYNTHIO_ENVELOPE_STATE_ATTACK; return true; } channel = find_channel_with_note(synth, old_note); From e23e7d3b3f7779f2157bbef2e0f447e7706cbdc4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 4 May 2023 07:45:45 -0500 Subject: [PATCH 0976/1712] synthio: get_buffer: return error if object deinited this may fix a weird crash during shutdown --- shared-module/synthio/MidiTrack.c | 4 ++++ shared-module/synthio/Synthesizer.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/shared-module/synthio/MidiTrack.c b/shared-module/synthio/MidiTrack.c index 343a107db2..66f28409d9 100644 --- a/shared-module/synthio/MidiTrack.c +++ b/shared-module/synthio/MidiTrack.c @@ -158,6 +158,10 @@ void synthio_miditrack_reset_buffer(synthio_miditrack_obj_t *self, audioio_get_buffer_result_t synthio_miditrack_get_buffer(synthio_miditrack_obj_t *self, bool single_channel_output, uint8_t channel, uint8_t **buffer, uint32_t *buffer_length) { + if (common_hal_synthio_miditrack_deinited(self)) { + *buffer_length = 0; + return GET_BUFFER_ERROR; + } synthio_synth_synthesize(&self->synth, buffer, buffer_length, single_channel_output ? 0 : channel); if (self->synth.span.dur == 0) { diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index 02d98a521e..e7fb324d25 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -62,6 +62,10 @@ void synthio_synthesizer_reset_buffer(synthio_synthesizer_obj_t *self, audioio_get_buffer_result_t synthio_synthesizer_get_buffer(synthio_synthesizer_obj_t *self, bool single_channel_output, uint8_t channel, uint8_t **buffer, uint32_t *buffer_length) { + if (common_hal_synthio_synthesizer_deinited(self)) { + *buffer_length = 0; + return GET_BUFFER_ERROR; + } self->synth.span.dur = SYNTHIO_MAX_DUR; synthio_synth_synthesize(&self->synth, buffer, buffer_length, single_channel_output ? channel : 0); return GET_BUFFER_MORE_DATA; From a388a59543550359226d40fbe6b7dc9652f70048 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 4 May 2023 08:41:23 -0500 Subject: [PATCH 0977/1712] rp2040: fix audio glitch at soft-reload The internal flash cache wasn't being properly used, because `write_blocks` unconditionally performed the flash write. Fixing this so that the write's not done until `internal_flash_flush` fixes the problem in my test program with i2sout & synthio. as a future optimization, `flash_read_blocks` could learn to read out of the cache, but that's probably not super important. --- ports/raspberrypi/supervisor/internal_flash.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ports/raspberrypi/supervisor/internal_flash.c b/ports/raspberrypi/supervisor/internal_flash.c index 010528559d..9216f1ebe2 100644 --- a/ports/raspberrypi/supervisor/internal_flash.c +++ b/ports/raspberrypi/supervisor/internal_flash.c @@ -95,14 +95,16 @@ void port_internal_flash_flush(void) { if (_cache_lba == NO_CACHE) { return; } + // Make sure we don't have an interrupt while we do flash operations. common_hal_mcu_disable_interrupts(); flash_range_erase(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, SECTOR_SIZE); flash_range_program(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, _cache, SECTOR_SIZE); - common_hal_mcu_enable_interrupts(); _cache_lba = NO_CACHE; + common_hal_mcu_enable_interrupts(); } mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) { + port_internal_flash_flush(); // we never read out of the cache, so we have to write it if dirty memcpy(dest, (void *)(XIP_BASE + CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + block * FILESYSTEM_BLOCK_SIZE), num_blocks * FILESYSTEM_BLOCK_SIZE); @@ -118,6 +120,7 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32 uint8_t block_offset = block_address % blocks_per_sector; if (_cache_lba != block_address) { + port_internal_flash_flush(); memcpy(_cache, (void *)(XIP_BASE + CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + sector_offset), SECTOR_SIZE); @@ -133,11 +136,6 @@ mp_uint_t supervisor_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32 FILESYSTEM_BLOCK_SIZE); block++; } - // Make sure we don't have an interrupt while we do flash operations. - common_hal_mcu_disable_interrupts(); - flash_range_erase(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + sector_offset, SECTOR_SIZE); - flash_range_program(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + sector_offset, _cache, SECTOR_SIZE); - common_hal_mcu_enable_interrupts(); } return 0; // success From c839888e28c7064fb7bd6698488f1d66c3481434 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 4 May 2023 08:45:31 -0500 Subject: [PATCH 0978/1712] synthio: rename function that records error position --- shared-module/synthio/MidiTrack.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shared-module/synthio/MidiTrack.c b/shared-module/synthio/MidiTrack.c index 66f28409d9..e22753cb26 100644 --- a/shared-module/synthio/MidiTrack.c +++ b/shared-module/synthio/MidiTrack.c @@ -28,7 +28,7 @@ #include "shared-bindings/synthio/MidiTrack.h" -STATIC void print_midi_stream_error(synthio_miditrack_obj_t *self) { +STATIC void record_midi_stream_error(synthio_miditrack_obj_t *self) { self->error_location = self->pos; self->pos = self->track.len; } @@ -37,11 +37,11 @@ STATIC mp_obj_t parse_note(synthio_miditrack_obj_t *self) { uint8_t *buffer = self->track.buf; size_t len = self->track.len; if (self->pos + 1 >= len) { - print_midi_stream_error(self); + record_midi_stream_error(self); } uint8_t note = buffer[(self->pos)++]; if (note > 127 || buffer[(self->pos)++] > 127) { - print_midi_stream_error(self); + record_midi_stream_error(self); } return MP_OBJ_NEW_SMALL_INT(note); } @@ -60,7 +60,7 @@ static int decode_duration(synthio_miditrack_obj_t *self) { // errors cannot be raised from the background task, so simply end the track. if (c & 0x80) { self->pos = self->track.len; - print_midi_stream_error(self); + record_midi_stream_error(self); } return delta * self->synth.sample_rate / self->tempo; } @@ -89,14 +89,14 @@ static void decode_until_pause(synthio_miditrack_obj_t *self) { case 12: case 13: // one data byte to ignore if (self->pos >= len || buffer[self->pos++] > 127) { - print_midi_stream_error(self); + record_midi_stream_error(self); } break; case 15: // the full syntax is too complicated, just assume it's "End of Track" event self->pos = len; break; default: // invalid event - print_midi_stream_error(self); + record_midi_stream_error(self); } if (self->pos < len) { self->synth.span.dur = decode_duration(self); From a94031d094a44fa157a480351225c3da9af428c3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 4 May 2023 10:16:19 -0500 Subject: [PATCH 0979/1712] synthio: make most Note constructor args kw-only for similar reasons as Envelope. The mandatory frequency argument can still be given as a positional argument. --- shared-bindings/synthio/Note.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index 0e2dad40d6..427f65097b 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -35,17 +35,18 @@ static const mp_arg_t note_properties[] = { { MP_QSTR_frequency, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = NULL } }, - { MP_QSTR_amplitude, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(1) } }, - { MP_QSTR_tremolo_rate, MP_ARG_OBJ, {.u_obj = NULL } }, - { MP_QSTR_tremolo_depth, MP_ARG_OBJ, {.u_obj = NULL } }, - { MP_QSTR_vibrato_rate, MP_ARG_OBJ, {.u_obj = NULL } }, - { MP_QSTR_vibrato_depth, MP_ARG_OBJ, {.u_obj = NULL } }, - { MP_QSTR_waveform, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE } }, - { MP_QSTR_envelope, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE } }, + { MP_QSTR_amplitude, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, + { MP_QSTR_tremolo_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, + { MP_QSTR_tremolo_depth, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, + { MP_QSTR_vibrato_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, + { MP_QSTR_vibrato_depth, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, + { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, + { MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, }; //| class Note: //| def __init__( //| self, +//| *, //| frequency: float, //| amplitude: float = 1.0, //| waveform: Optional[ReadableBuffer] = None, From eebd4a7f521541d850a6d5aaaed9fd3c1cb04a0d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 4 May 2023 10:16:58 -0500 Subject: [PATCH 0980/1712] synthio: no longer fits on feather m4 can --- ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk index 1c337d6256..8c9779e5f9 100644 --- a/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk @@ -12,5 +12,6 @@ LONGINT_IMPL = MPZ CIRCUITPY__EVE = 1 CIRCUITPY_CANIO = 1 +CIRCUITPY_SYNTHIO = 0 CIRCUITPY_LTO_PARTITION = one From d2aca7eba072710a91d27be95aef1801b58ccf67 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 4 May 2023 12:23:45 -0500 Subject: [PATCH 0981/1712] synthio: fix per-note envelope & envelope modification .. and simplify the envelope advance logic by handling 'instant' values more intelligently. --- shared-module/synthio/Note.c | 3 ++ shared-module/synthio/Synthesizer.c | 9 ++-- shared-module/synthio/__init__.c | 77 +++++++++++++---------------- shared-module/synthio/__init__.h | 2 +- 4 files changed, 41 insertions(+), 50 deletions(-) diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index b6357559ee..e86253cdd1 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -105,6 +105,9 @@ mp_obj_t common_hal_synthio_note_get_envelope_obj(synthio_note_obj_t *self) { void common_hal_synthio_note_set_envelope(synthio_note_obj_t *self, mp_obj_t envelope_in) { if (envelope_in != mp_const_none) { mp_arg_validate_type(envelope_in, (mp_obj_type_t *)&synthio_envelope_type_obj, MP_QSTR_envelope); + if (self->sample_rate != 0) { + synthio_envelope_definition_set(&self->envelope_def, envelope_in, self->sample_rate); + } } self->envelope_obj = envelope_in; } diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index e7fb324d25..ad37cccce5 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -110,12 +110,11 @@ void common_hal_synthio_synthesizer_press(synthio_synthesizer_obj_t *self, mp_ob mp_obj_t iterable = mp_getiter(to_press, &iter_buf); mp_obj_t note_obj; while ((note_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - if (synthio_span_change_note(&self->synth, SYNTHIO_SILENCE, validate_note(note_obj))) { - if (!mp_obj_is_small_int(note_obj)) { - synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); - synthio_note_start(note, self->synth.sample_rate); - } + if (!mp_obj_is_small_int(note_obj)) { + synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); + synthio_note_start(note, self->synth.sample_rate); } + synthio_span_change_note(&self->synth, SYNTHIO_SILENCE, validate_note(note_obj)); } } diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 6a9911aa9f..d5efb0f842 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -37,11 +37,11 @@ STATIC const int16_t square_wave[] = {-32768, 32767}; STATIC const uint16_t notes[] = {8372, 8870, 9397, 9956, 10548, 11175, 11840, 12544, 13290, 14080, 14917, 15804}; // 9th octave -static int32_t round_float_to_int(mp_float_t f) { +STATIC int32_t round_float_to_int(mp_float_t f) { return (int32_t)(f + MICROPY_FLOAT_CONST(0.5)); } -static int64_t round_float_to_int64(mp_float_t f) { +STATIC int64_t round_float_to_int64(mp_float_t f) { return (int64_t)(f + MICROPY_FLOAT_CONST(0.5)); } @@ -55,7 +55,7 @@ STATIC int16_t convert_time_to_rate(uint32_t sample_rate, mp_obj_t time_in, int1 mp_float_t time = mp_obj_get_float(time_in); int num_samples = (int)MICROPY_FLOAT_C_FUN(round)(time * sample_rate); if (num_samples == 0) { - return 0; + return 32767; } int16_t result = MIN(32767, MAX(1, abs(difference * SYNTHIO_MAX_DUR) / num_samples)); return (difference < 0) ? -result : result; @@ -102,34 +102,19 @@ STATIC void synthio_envelope_state_step(synthio_envelope_state_t *state, synthio case SYNTHIO_ENVELOPE_STATE_SUSTAIN: break; case SYNTHIO_ENVELOPE_STATE_ATTACK: - if (def->attack_step != 0) { - state->level = MIN(state->level + def->attack_step, def->attack_level); - if (state->level == def->attack_level) { - state->state = SYNTHIO_ENVELOPE_STATE_DECAY; - } - break; - } - state->state = SYNTHIO_ENVELOPE_STATE_DECAY; - MP_FALLTHROUGH; - case SYNTHIO_ENVELOPE_STATE_DECAY: - if (def->decay_step != 0) { - state->level = MAX(state->level + def->decay_step, def->sustain_level); - assert(state->level >= 0); - if (state->level == def->sustain_level) { - state->state = SYNTHIO_ENVELOPE_STATE_SUSTAIN; - } - break; - } - state->state = SYNTHIO_ENVELOPE_STATE_RELEASE; - MP_FALLTHROUGH; - case SYNTHIO_ENVELOPE_STATE_RELEASE: - if (def->release_step != 0) { - int delta = def->release_step; - state->level = MAX(state->level + delta, 0); - } else { - state->level = 0; + state->level = MIN(state->level + def->attack_step, def->attack_level); + if (state->level == def->attack_level) { + state->state = SYNTHIO_ENVELOPE_STATE_DECAY; } break; + case SYNTHIO_ENVELOPE_STATE_DECAY: + state->level = MAX(state->level + def->decay_step, def->sustain_level); + if (state->level == def->sustain_level) { + state->state = SYNTHIO_ENVELOPE_STATE_SUSTAIN; + } + break; + case SYNTHIO_ENVELOPE_STATE_RELEASE: + state->level = MAX(state->level + def->release_step, 0); } } } @@ -146,23 +131,34 @@ STATIC void synthio_envelope_state_release(synthio_envelope_state_t *state, synt state->state = SYNTHIO_ENVELOPE_STATE_RELEASE; } +STATIC synthio_envelope_definition_t *synthio_synth_get_note_envelope(synthio_synth_t *synth, mp_obj_t note_obj) { + synthio_envelope_definition_t *def = &synth->global_envelope_definition; + if (!mp_obj_is_small_int(note_obj)) { + synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); + if (note->envelope_obj != mp_const_none) { + def = ¬e->envelope_def; + } + } + return def; +} + STATIC uint32_t synthio_synth_sum_envelope(synthio_synth_t *synth) { uint32_t result = 0; for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { - if (synth->span.note_obj[chan] != SYNTHIO_SILENCE) { + mp_obj_t note_obj = synth->span.note_obj[chan]; + if (note_obj != SYNTHIO_SILENCE) { synthio_envelope_state_t *state = &synth->envelope_state[chan]; if (state->state == SYNTHIO_ENVELOPE_STATE_ATTACK) { result += state->level; } else { - result += synth->envelope_definition.attack_level; + result += synthio_synth_get_note_envelope(synth, note_obj)->attack_level; } } } return result; } - void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t *buffer_length, uint8_t channel) { if (channel == synth->other_channel) { @@ -265,14 +261,7 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t if (note_obj == SYNTHIO_SILENCE) { continue; } - synthio_envelope_definition_t *def = &synth->envelope_definition; - if (!mp_obj_is_small_int(note_obj)) { - synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); - if (note->envelope_obj != mp_const_none) { - def = ¬e->envelope_def; - } - } - synthio_envelope_state_step(&synth->envelope_state[chan], def, dur); + synthio_envelope_state_step(&synth->envelope_state[chan], synthio_synth_get_note_envelope(synth, note_obj), dur); } *buffer_length = synth->last_buffer_length = dur * SYNTHIO_BYTES_PER_SAMPLE; @@ -298,7 +287,7 @@ void synthio_synth_deinit(synthio_synth_t *synth) { } void synthio_synth_envelope_set(synthio_synth_t *synth, mp_obj_t envelope_obj) { - synthio_envelope_definition_set(&synth->envelope_definition, envelope_obj, synth->sample_rate); + synthio_envelope_definition_set(&synth->global_envelope_definition, envelope_obj, synth->sample_rate); synth->envelope_obj = envelope_obj; } @@ -329,7 +318,7 @@ void synthio_synth_get_buffer_structure(synthio_synth_t *synth, bool single_chan *spacing = 1; } -static bool parse_common(mp_buffer_info_t *bufinfo, mp_obj_t o, int16_t what) { +STATIC bool parse_common(mp_buffer_info_t *bufinfo, mp_obj_t o, int16_t what) { if (o != mp_const_none) { mp_get_buffer_raise(o, bufinfo, MP_BUFFER_READ); if (bufinfo->typecode != 'h') { @@ -379,10 +368,10 @@ bool synthio_span_change_note(synthio_synth_t *synth, mp_obj_t old_note, mp_obj_ channel = find_channel_with_note(synth, old_note); if (channel != -1) { if (new_note == SYNTHIO_SILENCE) { - synthio_envelope_state_release(&synth->envelope_state[channel], &synth->envelope_definition); + synthio_envelope_state_release(&synth->envelope_state[channel], synthio_synth_get_note_envelope(synth, old_note)); } else { synth->span.note_obj[channel] = new_note; - synthio_envelope_state_init(&synth->envelope_state[channel], &synth->envelope_definition); + synthio_envelope_state_init(&synth->envelope_state[channel], synthio_synth_get_note_envelope(synth, new_note)); synth->accum[channel] = 0; } return true; diff --git a/shared-module/synthio/__init__.h b/shared-module/synthio/__init__.h index 29520dfb5b..4ea04a09e3 100644 --- a/shared-module/synthio/__init__.h +++ b/shared-module/synthio/__init__.h @@ -69,7 +69,7 @@ typedef struct synthio_synth { uint16_t last_buffer_length; uint8_t other_channel, buffer_index, other_buffer_index; uint16_t waveform_length; - synthio_envelope_definition_t envelope_definition; + synthio_envelope_definition_t global_envelope_definition; mp_obj_t envelope_obj; synthio_midi_span_t span; uint32_t accum[CIRCUITPY_SYNTHIO_MAX_CHANNELS]; From 298bd16529235a7b478818e4feb45c667071c8ad Mon Sep 17 00:00:00 2001 From: Alec Delaney <89490472+tekktrik@users.noreply.github.com> Date: Thu, 4 May 2023 15:55:33 -0400 Subject: [PATCH 0982/1712] Fix creating virtual environment for stub creation --- tools/test-stubs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test-stubs.sh b/tools/test-stubs.sh index c977ad26d9..6c6c991015 100755 --- a/tools/test-stubs.sh +++ b/tools/test-stubs.sh @@ -1,6 +1,6 @@ #!/bin/sh -e rm -rf test-stubs -python3 -mvenv test-stubs +python3 -m venv test-stubs . test-stubs/bin/activate pip install mypy isort black adafruit-circuitpython-typing wheel rm -rf circuitpython-stubs .mypy_cache From 66411fdd38b95e3b0d3ae6fad7dbe35c873569a4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 5 May 2023 17:09:20 -0500 Subject: [PATCH 0983/1712] espressif: check return value from esp_ping_new_session MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit esp_ping_new_session can fail, particularly if ping is called quickly many times in succession. This is because `esp_ping_new_session` has to do a bunch of stuff including creating a task and a socket. Calling `esp_ping_delete_session` doesn't clean up these resources immediately. Instead, it signals the task to clean up resources and exit 'soon', but 'soon' is defined as 1 second. When the calls are frequent, the in-use sockets and tasks fill up available slots—I didn't actually check which resource gets used up first. With this change, the ping call will raise an exception instead of continuing with a call to esp_ping_start that crashes. Closes #5980 based on my testing on an ESP32S3-N8R2. --- ports/espressif/common-hal/wifi/Radio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/espressif/common-hal/wifi/Radio.c b/ports/espressif/common-hal/wifi/Radio.c index 0ce535899a..851e1bea25 100644 --- a/ports/espressif/common-hal/wifi/Radio.c +++ b/ports/espressif/common-hal/wifi/Radio.c @@ -29,6 +29,7 @@ #include +#include "bindings/espidf/__init__.h" #include "common-hal/wifi/__init__.h" #include "shared/runtime/interrupt_char.h" #include "py/gc.h" @@ -497,7 +498,7 @@ mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address, size_t timeout_ms = timeout * 1000; esp_ping_handle_t ping; - esp_ping_new_session(&ping_config, NULL, &ping); + CHECK_ESP_RESULT(esp_ping_new_session(&ping_config, NULL, &ping)); esp_ping_start(ping); uint32_t received = 0; From a52d0c742e073b1eebefaaba5b94d41332c9cdcf Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Sat, 6 May 2023 03:16:38 -0400 Subject: [PATCH 0984/1712] Add call to rtc_reset --- ports/silabs/supervisor/port.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/silabs/supervisor/port.c b/ports/silabs/supervisor/port.c index b5deebf979..8247c813a7 100644 --- a/ports/silabs/supervisor/port.c +++ b/ports/silabs/supervisor/port.c @@ -188,6 +188,10 @@ void reset_port(void) { #if CIRCUITPY_BLEIO bleio_reset(); #endif + + #if CIRCUITPY_RTC + rtc_reset(); + #endif } void reset_to_bootloader(void) { From a854e554f4f2492aaa881da659c601afdeef047e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 5 May 2023 18:25:51 -0500 Subject: [PATCH 0985/1712] synthio: add midi_to_hz to docs --- shared-bindings/synthio/__init__.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 5af352b404..b48e279028 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -262,6 +262,10 @@ STATIC mp_obj_t synthio_from_file(size_t n_args, const mp_obj_t *pos_args, mp_ma } MP_DEFINE_CONST_FUN_OBJ_KW(synthio_from_file_obj, 1, synthio_from_file); +//| def midi_to_hz(midi_note: int) -> float: +//| """Converts the given midi note (60 = middle C, 69 = concert A) to Hz""" +//| +/ STATIC mp_obj_t midi_to_hz(mp_obj_t arg) { mp_int_t note = mp_arg_validate_int_range(mp_obj_get_int(arg), 1, 127, MP_QSTR_note); return mp_obj_new_float(common_hal_synthio_midi_to_hz_float(note)); From a53c0ed0663ce0b15e7ea7089b9b7c54c62d7b7f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 6 May 2023 08:35:48 -0500 Subject: [PATCH 0986/1712] synthio: add onevo_to_hz, implement midi_to_hz in terms of it this has the side effect of making some notes more accurate, the new frequency= value in the test is closer to the true midi frequency of 830.609...Hz. --- shared-bindings/synthio/__init__.c | 20 +++++++++++++++++--- shared-bindings/synthio/__init__.h | 3 ++- shared-module/synthio/__init__.c | 10 ++++++---- tests/circuitpython/synthesizer_note.py.exp | 6 +++--- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index b48e279028..2e4fd7b8a4 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -262,16 +262,29 @@ STATIC mp_obj_t synthio_from_file(size_t n_args, const mp_obj_t *pos_args, mp_ma } MP_DEFINE_CONST_FUN_OBJ_KW(synthio_from_file_obj, 1, synthio_from_file); -//| def midi_to_hz(midi_note: int) -> float: +//| def midi_to_hz(midi_note: float) -> float: //| """Converts the given midi note (60 = middle C, 69 = concert A) to Hz""" //| -/ + STATIC mp_obj_t midi_to_hz(mp_obj_t arg) { - mp_int_t note = mp_arg_validate_int_range(mp_obj_get_int(arg), 1, 127, MP_QSTR_note); + mp_float_t note = mp_arg_validate_obj_float_range(arg, 1, 127, MP_QSTR_note); return mp_obj_new_float(common_hal_synthio_midi_to_hz_float(note)); } MP_DEFINE_CONST_FUN_OBJ_1(synthio_midi_to_hz_obj, midi_to_hz); +//| def onevo_to_hz(ctrl: float) -> float: +//| """Converts a 1v/octave signal to Hz. +//| +//| 60/12 (5.0) corresponds to middle C, 69/12 is concert A.""" +//| + +STATIC mp_obj_t onevo_to_hz(mp_obj_t arg) { + mp_float_t note = mp_arg_validate_obj_float_range(arg, 0, 11, MP_QSTR_ctrl); + return mp_obj_new_float(common_hal_synthio_onevo_to_hz_float(note)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_onevo_to_hz_obj, onevo_to_hz); + + STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_synthio) }, { MP_ROM_QSTR(MP_QSTR_MidiTrack), MP_ROM_PTR(&synthio_miditrack_type) }, @@ -280,6 +293,7 @@ STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_from_file), MP_ROM_PTR(&synthio_from_file_obj) }, { MP_ROM_QSTR(MP_QSTR_Envelope), MP_ROM_PTR(&synthio_envelope_type_obj) }, { MP_ROM_QSTR(MP_QSTR_midi_to_hz), MP_ROM_PTR(&synthio_midi_to_hz_obj) }, + { MP_ROM_QSTR(MP_QSTR_onevo_to_hz), MP_ROM_PTR(&synthio_midi_to_hz_obj) }, }; STATIC MP_DEFINE_CONST_DICT(synthio_module_globals, synthio_module_globals_table); diff --git a/shared-bindings/synthio/__init__.h b/shared-bindings/synthio/__init__.h index d3ccc1ce04..37a5c77b34 100644 --- a/shared-bindings/synthio/__init__.h +++ b/shared-bindings/synthio/__init__.h @@ -33,4 +33,5 @@ extern int16_t shared_bindings_synthio_square_wave[]; extern const mp_obj_namedtuple_type_t synthio_envelope_type_obj; void synthio_synth_envelope_set(synthio_synth_t *synth, mp_obj_t envelope_obj); mp_obj_t synthio_synth_envelope_get(synthio_synth_t *synth); -mp_float_t common_hal_synthio_midi_to_hz_float(mp_int_t note); +mp_float_t common_hal_synthio_midi_to_hz_float(mp_float_t note); +mp_float_t common_hal_synthio_onevo_to_hz_float(mp_float_t note); diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index d5efb0f842..596f3fb184 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -45,10 +45,12 @@ STATIC int64_t round_float_to_int64(mp_float_t f) { return (int64_t)(f + MICROPY_FLOAT_CONST(0.5)); } -mp_float_t common_hal_synthio_midi_to_hz_float(mp_int_t arg) { - uint8_t octave = arg / 12; - uint16_t base_freq = notes[arg % 12]; - return MICROPY_FLOAT_C_FUN(ldexp)(base_freq, octave - 10); +mp_float_t common_hal_synthio_midi_to_hz_float(mp_float_t arg) { + return common_hal_synthio_onevo_to_hz_float(arg / 12.); +} + +mp_float_t common_hal_synthio_onevo_to_hz_float(mp_float_t octave) { + return notes[0] * MICROPY_FLOAT_C_FUN(pow)(2., octave - 10); } STATIC int16_t convert_time_to_rate(uint32_t sample_rate, mp_obj_t time_in, int16_t difference) { diff --git a/tests/circuitpython/synthesizer_note.py.exp b/tests/circuitpython/synthesizer_note.py.exp index 82ae685c07..e51cea1755 100644 --- a/tests/circuitpython/synthesizer_note.py.exp +++ b/tests/circuitpython/synthesizer_note.py.exp @@ -1,10 +1,10 @@ () [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -(Note(frequency=830.625, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None),) +(Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None),) [-16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383] -(Note(frequency=830.625, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None), Note(frequency=830.625, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None)) +(Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None), Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None)) [0, 0, 0, 0, 0, 0, 0, 0, 16382, 0, 0, 0, 0, -16382, 0, 0, 0, 0, 16382, 0, 0, 0, 0, -16382] -(Note(frequency=830.625, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None),) +(Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None),) [0, 0, 0, 16382, 0, 0, 0, 0, 0, 0, 0, 0, 16382, 0, 0, 0, 0, -16382, 0, 0, 0, 0, 16382, 0] (-5242, 5241) (-10484, 10484) From 9a9f3229fa4559865bdaa9b44995bf3ea5abaac3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 6 May 2023 21:34:48 -0500 Subject: [PATCH 0987/1712] synthio: Perform vibrato in pitch, not as frequency ratio Now the vibrato 'units' are 1.0 = one octave, 1/12 = one semitone, 1/1200 = one cent. Before, the units were somewhat arbitrary and were not perceptually "symmetrical" around the base frequency. For vibrato_depth = 1/12 and base frequency of 440, before: pitch from 403.33 to 476.67Hz, not corresponding to any notes after: pitch from 415.30 to 466.16Hz, corresponding to G# and A# --- shared-bindings/synthio/Note.c | 14 ++++++++++++-- shared-module/synthio/Note.c | 27 ++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index 427f65097b..4cd0abe0d4 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -118,7 +118,12 @@ MP_PROPERTY_GETSET(synthio_note_amplitude_obj, //| tremolo_depth: float -//| """The tremolo depth of the note, from 0 to 1""" +//| """The tremolo depth of the note, from 0 to 1 +//| +//| A depth of 0 disables tremolo. A nonzero value enables tremolo, +//| with the maximum decrease in amplitude being equal to the tremolo +//| depth. A note with a tremolo depth of 1 will fade out to nothing, while +//| a tremolo depth of 0.1 will give a minimum amplitude of 0.9.""" STATIC mp_obj_t synthio_note_get_tremolo_depth(mp_obj_t self_in) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_float(common_hal_synthio_note_get_tremolo_depth(self)); @@ -154,7 +159,12 @@ MP_PROPERTY_GETSET(synthio_note_tremolo_rate_obj, (mp_obj_t)&synthio_note_set_tremolo_rate_obj); //| vibrato_depth: float -//| """The vibrato depth of the note, from 0 to 1""" +//| """The vibrato depth of the note, from 0 to 1 +//| +//| A depth of 0 disables vibrato. A depth of 1 corresponds to a vibrato of ±1 +//| octave. A depth of (1/12) = 0.833 corresponds to a vibrato of ±1 semitone, +//| and a depth of .00833 corresponds to one musical cent. +//| """ STATIC mp_obj_t synthio_note_get_vibrato_depth(mp_obj_t self_in) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_float(common_hal_synthio_note_get_vibrato_depth(self)); diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index e86253cdd1..84949163a7 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -151,10 +151,35 @@ uint32_t synthio_note_envelope(synthio_note_obj_t *self) { return self->amplitude_scaled; } +// Perform a pitch bend operation +// +// bend_value is in the range [0, 65535]. "no change" is 32768. The bend unit is 32768/octave. +// +// compare to (frequency_scaled * pow(2, (bend_value-32768)/32768)) +// a 13-entry pitch table +#define BEND_SCALE (32768) +#define BEND_OFFSET (BEND_SCALE) + +STATIC uint16_t pitch_bend_table[] = { 0, 1948, 4013, 6200, 8517, 10972, 13573, 16329, 19248, 22341, 25618, 29090, 32768 }; + +STATIC uint32_t pitch_bend(uint32_t frequency_scaled, uint16_t bend_value) { + bool down = (bend_value < 32768); + if (!down) { + bend_value -= 32768; + } + uint32_t bend_value_semitone = (uint32_t)bend_value * 24; // 65536/semitone + uint32_t semitone = bend_value_semitone >> 16; + uint32_t fractone = bend_value_semitone & 0xffff; + uint32_t f_lo = pitch_bend_table[semitone]; + uint32_t f_hi = pitch_bend_table[semitone + 1]; // table has 13 entries, indexing with semitone=12 is OK + uint32_t f = ((f_lo * (65535 - fractone) + f_hi * fractone) >> 16) + BEND_OFFSET; + return (frequency_scaled * (uint64_t)f) >> (15 + down); +} + uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, uint16_t *loudness) { int tremolo_value = synthio_lfo_step(&self->tremolo_state, dur); int vibrato_value = synthio_lfo_step(&self->vibrato_state, dur); *loudness = (*loudness * tremolo_value) >> 15; - uint32_t frequency_scaled = ((uint64_t)self->frequency_scaled * vibrato_value) >> 15; + uint32_t frequency_scaled = pitch_bend(self->frequency_scaled, vibrato_value); return frequency_scaled; } From f4079b6799b586a6e7f6f8b19f20688eafd46185 Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Sun, 7 May 2023 16:47:57 +0300 Subject: [PATCH 0988/1712] add preliminary support for m5stack_timer_camera_x --- .../boards/m5stack_timer_camera_x/board.c | 45 +++++++++++++++++++ .../m5stack_timer_camera_x/mpconfigboard.h | 42 +++++++++++++++++ .../m5stack_timer_camera_x/mpconfigboard.mk | 8 ++++ .../boards/m5stack_timer_camera_x/pins.c | 40 +++++++++++++++++ .../boards/m5stack_timer_camera_x/sdkconfig | 23 ++++++++++ 5 files changed, 158 insertions(+) create mode 100755 ports/espressif/boards/m5stack_timer_camera_x/board.c create mode 100644 ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.h create mode 100644 ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk create mode 100644 ports/espressif/boards/m5stack_timer_camera_x/pins.c create mode 100644 ports/espressif/boards/m5stack_timer_camera_x/sdkconfig diff --git a/ports/espressif/boards/m5stack_timer_camera_x/board.c b/ports/espressif/boards/m5stack_timer_camera_x/board.c new file mode 100755 index 0000000000..4000c201e3 --- /dev/null +++ b/ports/espressif/boards/m5stack_timer_camera_x/board.c @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 Bill Sideris, independently providing these changes. + * + * 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 "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" +#include "components/hal/include/hal/gpio_hal.h" +#include "common-hal/microcontroller/Pin.h" + +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + if (pin_number == 33) { + // Turn on BAT_HOLD by default, so that the board does not power off. + gpio_set_direction(pin_number, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(pin_number, true); + return true; + } + + return false; +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.h b/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.h new file mode 100644 index 0000000000..451ee5ebf4 --- /dev/null +++ b/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.h @@ -0,0 +1,42 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 Bill Sideris, independently providing these changes. + * + * 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. + */ + +#define MICROPY_HW_BOARD_NAME "M5Stack Timer Camera X" +#define MICROPY_HW_MCU_NAME "ESP32" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO2) + +#define CIRCUITPY_BOARD_I2C (2) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO13, .sda = &pin_GPIO4}, \ + {.scl = &pin_GPIO14, .sda = &pin_GPIO12}} + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO3) + +#define CIRCUITPY_I2C_ALLOW_INTERNAL_PULL_UP (1) + +#define DEFAULT_RESERVED_PSRAM (1048576) diff --git a/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk b/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk new file mode 100644 index 0000000000..fb432ba51f --- /dev/null +++ b/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0x10151015 +CIRCUITPY_CREATION_ID = 0x00320007 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/m5stack_timer_camera_x/pins.c b/ports/espressif/boards/m5stack_timer_camera_x/pins.c new file mode 100644 index 0000000000..37446b6386 --- /dev/null +++ b/ports/espressif/boards/m5stack_timer_camera_x/pins.c @@ -0,0 +1,40 @@ +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + +CIRCUITPY_BOARD_BUS_SINGLETON(bm8563_i2c, i2c, 1) + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_G4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_G13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + + { MP_ROM_QSTR(MP_QSTR_G33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_BAT_HOLD), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_G38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_BAT_ADC), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_G14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_G12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_BM8563_SCL), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_BM8563_SDA), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_BM8563_I2C), MP_ROM_PTR(&board_bm8563_i2c_obj) }, + + { MP_ROM_QSTR(MP_QSTR_G22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_VSYNC), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_G26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_HREF), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_G21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_PCLK), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_G27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_XCLK), MP_ROM_PTR(&pin_GPIO27) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/m5stack_timer_camera_x/sdkconfig b/ports/espressif/boards/m5stack_timer_camera_x/sdkconfig new file mode 100644 index 0000000000..4f7eaf9075 --- /dev/null +++ b/ports/espressif/boards/m5stack_timer_camera_x/sdkconfig @@ -0,0 +1,23 @@ +CONFIG_ESP32_SPIRAM_SUPPORT=y +CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y +CONFIG_ESP32_REV_MIN_3=y + +CONFIG_D0WD_PSRAM_CLK_IO=17 +CONFIG_D0WD_PSRAM_CS_IO=16 + +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +CONFIG_SPIRAM_SPEED_80M=y + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +CONFIG_SPIRAM_USE_MEMMAP=y +CONFIG_SPIRAM_MEMTEST=y + +CONFIG_LWIP_LOCAL_HOSTNAME="M5StackTimerX" + +CONFIG_OV3660_SUPPORT=y +CONFIG_GC_SENSOR_SUBSAMPLE_MODE=y +CONFIG_CAMERA_CORE0=y +CONFIG_CAMERA_DMA_BUFFER_SIZE_MAX=32768 From 3abcc6a2c3365cba5bb54c3c005bc24dfcbe324a Mon Sep 17 00:00:00 2001 From: Phil Underwood Date: Sun, 7 May 2023 15:58:25 +0100 Subject: [PATCH 0989/1712] Add memorymap support for the nRF processors. This gives very permissive access to the internals of the microprocessor. It needs the user to be **very** careful that they do not break things --- ports/nrf/common-hal/memorymap/AddressRange.c | 136 ++++++++++++++++++ ports/nrf/common-hal/memorymap/AddressRange.h | 38 +++++ ports/nrf/common-hal/memorymap/__init__.c | 1 + ports/nrf/mpconfigport.mk | 3 + 4 files changed, 178 insertions(+) create mode 100644 ports/nrf/common-hal/memorymap/AddressRange.c create mode 100644 ports/nrf/common-hal/memorymap/AddressRange.h create mode 100644 ports/nrf/common-hal/memorymap/__init__.c diff --git a/ports/nrf/common-hal/memorymap/AddressRange.c b/ports/nrf/common-hal/memorymap/AddressRange.c new file mode 100644 index 0000000000..eaef202d0d --- /dev/null +++ b/ports/nrf/common-hal/memorymap/AddressRange.c @@ -0,0 +1,136 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * 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 "nrf.h" + +#include "shared-bindings/memorymap/AddressRange.h" + +#include "py/runtime.h" + + +#ifdef NRF51_SERIES +size_t allow_ranges[][2] = { + // FLASH + {0x00000000, 0x00040000}, + // FICR & UICR ranges + {0x10000000, 0x10002000}, + // RAM + {0x20000000, 0x20010000}, + // PERIPHERALS + {0x40000000, 0x60000000} +}; +#elif defined NRF52_SERIES +size_t allow_ranges[][2] = { + // FLASH + {0x00000000, 0x00100000}, + // FICR & UICR ranges + {0x10000000, 0x10002000}, + // RAM + {0x20000000, 0x20040000}, + // PERIPHERALS + {0x40000000, 0x60000000} +}; +#elif defined NRF53_SERIES +size_t allow_ranges[][2] = { + // FLASH + {0x00000000, 0x00100000}, + // FICR & UICR ranges + {0x00FF0000, 0x01000000}, + // RAM + {0x20000000, 0x20080000}, + // PERIPHERALS + {0x40000000, 0x60000000}, + {0xE0000000, 0xE0100000} +}; +#else +#error "Unsupported nRF variant" +#endif + +void common_hal_memorymap_addressrange_construct(memorymap_addressrange_obj_t *self, uint8_t *start_address, size_t length) { + bool allowed = false; + for (size_t i = 0; i < MP_ARRAY_SIZE(allow_ranges); i++) { + uint8_t *allowed_start = (uint8_t *)allow_ranges[i][0]; + uint8_t *allowed_end = (uint8_t *)allow_ranges[i][1]; + if (allowed_start <= start_address && + (start_address + length) <= allowed_end) { + allowed = true; + break; + } + } + + if (!allowed) { + mp_raise_ValueError(translate("Address range not allowed")); + } + + self->start_address = start_address; + self->len = length; +} + +uint32_t common_hal_memorymap_addressrange_get_length(const memorymap_addressrange_obj_t *self) { + return self->len; +} + + +bool common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_obj_t *self, + uint32_t start_index, uint8_t *values, uint32_t len) { + uint8_t *address = self->start_address + start_index; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" + if (len == 1) { + *((uint8_t *)address) = values[0]; + } else if (len == sizeof(uint16_t) && (((size_t)address) % sizeof(uint16_t)) == 0) { + *((uint16_t *)address) = ((uint16_t *)values)[0]; + } else if (len == sizeof(uint32_t) && (((size_t)address) % sizeof(uint32_t)) == 0) { + *((uint32_t *)address) = ((uint32_t *)values)[0]; + } else if (len == sizeof(uint64_t) && (((size_t)address) % sizeof(uint64_t)) == 0) { + *((uint64_t *)address) = ((uint64_t *)values)[0]; + } else { + memcpy(address, values, len); + } + #pragma GCC diagnostic pop + + return true; +} + +void common_hal_memorymap_addressrange_get_bytes(const memorymap_addressrange_obj_t *self, + uint32_t start_index, uint32_t len, uint8_t *values) { + uint8_t *address = self->start_address + start_index; + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" + if (len == 1) { + values[0] = *((uint8_t *)address); + } else if (len == sizeof(uint16_t) && (((size_t)address) % sizeof(uint16_t)) == 0) { + ((uint16_t *)values)[0] = *((uint16_t *)address); + } else if (len == sizeof(uint32_t) && (((size_t)address) % sizeof(uint32_t)) == 0) { + ((uint32_t *)values)[0] = *((uint32_t *)address); + } else if (len == sizeof(uint64_t) && (((size_t)address) % sizeof(uint64_t)) == 0) { + ((uint64_t *)values)[0] = *((uint64_t *)address); + } else { + memcpy(values, address, len); + } + #pragma GCC diagnostic pop +} diff --git a/ports/nrf/common-hal/memorymap/AddressRange.h b/ports/nrf/common-hal/memorymap/AddressRange.h new file mode 100644 index 0000000000..20f59f3c73 --- /dev/null +++ b/ports/nrf/common-hal/memorymap/AddressRange.h @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * + * 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_NRF_COMMON_HAL_MEMORYMAP_ADDRESSRANGE_H +#define MICROPY_INCLUDED_NRF_COMMON_HAL_MEMORYMAP_ADDRESSRANGE_H + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + uint8_t *start_address; + size_t len; +} memorymap_addressrange_obj_t; + +#endif // MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_MEMORYMAP_ADDRESSRANGE_H diff --git a/ports/nrf/common-hal/memorymap/__init__.c b/ports/nrf/common-hal/memorymap/__init__.c new file mode 100644 index 0000000000..c15b17f451 --- /dev/null +++ b/ports/nrf/common-hal/memorymap/__init__.c @@ -0,0 +1 @@ +// No memorymap module functions. diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk index 04c4f3bce6..91929749ca 100644 --- a/ports/nrf/mpconfigport.mk +++ b/ports/nrf/mpconfigport.mk @@ -46,6 +46,8 @@ CIRCUITPY_BLE_FILE_SERVICE ?= 1 CIRCUITPY_SERIAL_BLE ?= 1 CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE ?= 1 +CIRCUITPY_MEMORYMAP ?= 1 + # nRF52840-specific @@ -69,6 +71,7 @@ SOFTDEV_VERSION ?= 6.1.0 BOOT_SETTING_ADDR = 0xFF000 NRF_DEFINES += -DNRF52840_XXAA -DNRF52840 + # CircuitPython doesn't yet support NFC so force the NFC antenna pins to be GPIO. # See https://github.com/adafruit/circuitpython/issues/1300 # Defined here because system_nrf52840.c doesn't #include any of our own include files. From fe90cc759a91a4d5e665c39838ce3be10f1e02d8 Mon Sep 17 00:00:00 2001 From: Phil Underwood Date: Sun, 7 May 2023 16:08:56 +0100 Subject: [PATCH 0990/1712] remove excess line --- ports/nrf/mpconfigport.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk index 91929749ca..7937b83ddc 100644 --- a/ports/nrf/mpconfigport.mk +++ b/ports/nrf/mpconfigport.mk @@ -71,7 +71,6 @@ SOFTDEV_VERSION ?= 6.1.0 BOOT_SETTING_ADDR = 0xFF000 NRF_DEFINES += -DNRF52840_XXAA -DNRF52840 - # CircuitPython doesn't yet support NFC so force the NFC antenna pins to be GPIO. # See https://github.com/adafruit/circuitpython/issues/1300 # Defined here because system_nrf52840.c doesn't #include any of our own include files. From bcd9d6bacc368728f53c649b700af18a16a22463 Mon Sep 17 00:00:00 2001 From: Phil Underwood Date: Sun, 7 May 2023 18:21:22 +0100 Subject: [PATCH 0991/1712] Add memorymap to nrf52840 devices only --- ports/nrf/mpconfigport.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk index 7937b83ddc..7973453c2f 100644 --- a/ports/nrf/mpconfigport.mk +++ b/ports/nrf/mpconfigport.mk @@ -46,7 +46,6 @@ CIRCUITPY_BLE_FILE_SERVICE ?= 1 CIRCUITPY_SERIAL_BLE ?= 1 CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE ?= 1 -CIRCUITPY_MEMORYMAP ?= 1 # nRF52840-specific @@ -58,6 +57,7 @@ MCU_SUB_VARIANT = nrf52840 # Fits on nrf52840 but space is tight on nrf52833. CIRCUITPY_AESIO ?= 1 +CIRCUITPY_MEMORYMAP ?= 1 CIRCUITPY_RGBMATRIX ?= 1 CIRCUITPY_FRAMEBUFFERIO ?= 1 From c031bda5dd78294ba6498d56cfa4ab8c511bdbb3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 8 May 2023 09:20:46 -0500 Subject: [PATCH 0992/1712] synthio: implement a range compressor with hard knee This really improves the loudness of the output with multiple notes while being a nice simple algorithm to implement. --- shared-module/synthio/__init__.c | 184 +++++++++--------- .../circuitpython-manual/synthio/note/code.py | 21 +- tests/circuitpython/miditrack.py.exp | 4 +- tests/circuitpython/synthesizer.py.exp | 44 ++--- tests/circuitpython/synthesizer_note.py.exp | 44 ++--- 5 files changed, 160 insertions(+), 137 deletions(-) diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 596f3fb184..5ee72aeb79 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -145,20 +145,30 @@ STATIC synthio_envelope_definition_t *synthio_synth_get_note_envelope(synthio_sy } -STATIC uint32_t synthio_synth_sum_envelope(synthio_synth_t *synth) { - uint32_t result = 0; - for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { - mp_obj_t note_obj = synth->span.note_obj[chan]; - if (note_obj != SYNTHIO_SILENCE) { - synthio_envelope_state_t *state = &synth->envelope_state[chan]; - if (state->state == SYNTHIO_ENVELOPE_STATE_ATTACK) { - result += state->level; - } else { - result += synthio_synth_get_note_envelope(synth, note_obj)->attack_level; - } - } +#define RANGE_LOW (-28000) +#define RANGE_HIGH (28000) +#define RANGE_SHIFT (16) +#define RANGE_SCALE (0xfffffff / (32768 * CIRCUITPY_SYNTHIO_MAX_CHANNELS - RANGE_HIGH)) + +// dynamic range compression via a downward compressor with hard knee +// +// When the output value is within the range +-28000 (about 85% of full scale), +// it is unchanged. Otherwise, it undergoes a gain reduction so that the +// largest possible values, (+32768,-32767) * CIRCUITPY_SYNTHIO_MAX_CHANNELS, +// still fit within the output range +// +// This produces a much louder overall volume with multiple voices, without +// much additional processing. +// +// https://en.wikipedia.org/wiki/Dynamic_range_compression +STATIC +int16_t mix_down_sample(int32_t sample) { + if (sample < RANGE_LOW) { + sample = (((sample - RANGE_LOW) * RANGE_SCALE) >> RANGE_SHIFT) + RANGE_LOW; + } else if (sample > RANGE_HIGH) { + sample = (((sample - RANGE_HIGH) * RANGE_SCALE) >> RANGE_SHIFT) + RANGE_HIGH; } - return result; + return sample; } void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t *buffer_length, uint8_t channel) { @@ -172,89 +182,83 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t synth->buffer_index = !synth->buffer_index; synth->other_channel = 1 - channel; synth->other_buffer_index = synth->buffer_index; - int16_t *out_buffer = (int16_t *)(void *)synth->buffers[synth->buffer_index]; uint16_t dur = MIN(SYNTHIO_MAX_DUR, synth->span.dur); synth->span.dur -= dur; - memset(out_buffer, 0, synth->buffer_length); int32_t sample_rate = synth->sample_rate; - uint32_t total_envelope = synthio_synth_sum_envelope(synth); - if (total_envelope < synth->total_envelope) { - // total envelope is decreasing. Slowly let remaining notes get louder - // the time constant is arbitrary, on the order of 1s at 48kHz - total_envelope = synth->total_envelope = ( - total_envelope + synth->total_envelope * 255) / 256; - } else { - // total envelope is steady or increasing, so just store this as - // the high water mark - synth->total_envelope = total_envelope; - } - if (total_envelope > 0) { - uint16_t ovl_loudness = 0x7fffffff / MAX(0x8000, total_envelope); + int32_t out_buffer32[dur]; - for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { - mp_obj_t note_obj = synth->span.note_obj[chan]; - if (note_obj == SYNTHIO_SILENCE) { - synth->accum[chan] = 0; - continue; - } - - if (synth->envelope_state[chan].level == 0) { - // note is truly finished, but we only just noticed - synth->span.note_obj[chan] = SYNTHIO_SILENCE; - continue; - } - - // adjust loudness by envelope - uint16_t loudness = (ovl_loudness * synth->envelope_state[chan].level) >> 16; - - uint32_t dds_rate; - const int16_t *waveform = synth->waveform; - uint32_t waveform_length = synth->waveform_length; - if (mp_obj_is_small_int(note_obj)) { - uint8_t note = mp_obj_get_int(note_obj); - uint8_t octave = note / 12; - uint16_t base_freq = notes[note % 12]; - // rate = base_freq * waveform_length - // den = sample_rate * 2 ^ (10 - octave) - // den = sample_rate * 2 ^ 10 / 2^octave - // dds_rate = 2^SHIFT * rate / den - // dds_rate = 2^(SHIFT-10+octave) * base_freq * waveform_length / sample_rate - dds_rate = (sample_rate / 2 + ((uint64_t)(base_freq * waveform_length) << (SYNTHIO_FREQUENCY_SHIFT - 10 + octave))) / sample_rate; - } else { - synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); - int32_t frequency_scaled = synthio_note_step(note, sample_rate, dur, &loudness); - if (note->waveform_buf.buf) { - waveform = note->waveform_buf.buf; - waveform_length = note->waveform_buf.len / 2; - } - dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)frequency_scaled * waveform_length, sample_rate); - } - - uint32_t accum = synth->accum[chan]; - uint32_t lim = waveform_length << SYNTHIO_FREQUENCY_SHIFT; - if (dds_rate > lim / 2) { - // beyond nyquist, can't play note - continue; - } - - // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided - if (accum > lim) { - accum %= lim; - } - - for (uint16_t i = 0; i < dur; i++) { - accum += dds_rate; - // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed - if (accum > lim) { - accum -= lim; - } - int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; - out_buffer[i] += (waveform[idx] * loudness) / 65536; - } - synth->accum[chan] = accum; + memset(out_buffer32, 0, sizeof(out_buffer32)); + for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { + mp_obj_t note_obj = synth->span.note_obj[chan]; + if (note_obj == SYNTHIO_SILENCE) { + synth->accum[chan] = 0; + continue; } + + if (synth->envelope_state[chan].level == 0) { + // note is truly finished, but we only just noticed + synth->span.note_obj[chan] = SYNTHIO_SILENCE; + continue; + } + + // adjust loudness by envelope + uint16_t loudness = synth->envelope_state[chan].level; + + uint32_t dds_rate; + const int16_t *waveform = synth->waveform; + uint32_t waveform_length = synth->waveform_length; + if (mp_obj_is_small_int(note_obj)) { + uint8_t note = mp_obj_get_int(note_obj); + uint8_t octave = note / 12; + uint16_t base_freq = notes[note % 12]; + // rate = base_freq * waveform_length + // den = sample_rate * 2 ^ (10 - octave) + // den = sample_rate * 2 ^ 10 / 2^octave + // dds_rate = 2^SHIFT * rate / den + // dds_rate = 2^(SHIFT-10+octave) * base_freq * waveform_length / sample_rate + dds_rate = (sample_rate / 2 + ((uint64_t)(base_freq * waveform_length) << (SYNTHIO_FREQUENCY_SHIFT - 10 + octave))) / sample_rate; + } else { + synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); + int32_t frequency_scaled = synthio_note_step(note, sample_rate, dur, &loudness); + if (note->waveform_buf.buf) { + waveform = note->waveform_buf.buf; + waveform_length = note->waveform_buf.len / 2; + } + dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)frequency_scaled * waveform_length, sample_rate); + } + + uint32_t accum = synth->accum[chan]; + uint32_t lim = waveform_length << SYNTHIO_FREQUENCY_SHIFT; + if (dds_rate > lim / 2) { + // beyond nyquist, can't play note + continue; + } + + // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided + if (accum > lim) { + accum %= lim; + } + + for (uint16_t i = 0; i < dur; i++) { + accum += dds_rate; + // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed + if (accum > lim) { + accum -= lim; + } + int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; + out_buffer32[i] += (waveform[idx] * loudness) / 65536; + } + synth->accum[chan] = accum; + } + + int16_t *out_buffer16 = (int16_t *)(void *)synth->buffers[synth->buffer_index]; + + // mix down audio + for (size_t i = 0; i < dur; i++) { + int32_t sample = out_buffer32[i]; + out_buffer16[i] = mix_down_sample(sample); } // advance envelope states @@ -267,7 +271,7 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t } *buffer_length = synth->last_buffer_length = dur * SYNTHIO_BYTES_PER_SAMPLE; - *bufptr = (uint8_t *)out_buffer; + *bufptr = (uint8_t *)out_buffer16; } void synthio_synth_reset_buffer(synthio_synth_t *synth, bool single_channel_output, uint8_t channel) { diff --git a/tests/circuitpython-manual/synthio/note/code.py b/tests/circuitpython-manual/synthio/note/code.py index 72783d1b55..3814c57279 100644 --- a/tests/circuitpython-manual/synthio/note/code.py +++ b/tests/circuitpython-manual/synthio/note/code.py @@ -84,6 +84,25 @@ def synthesize4(synth): yield 36 +def synthesize5(synth): + notes = [ + synthio.Note( + frequency=synthio.midi_to_hz(60 + i + o), + waveform=sine, + envelope=envelope, + ) + for i in [0, 4, 7] + for o in [0, -12, 12] + ] + + for n in notes: + print(n) + synth.press((n,)) + yield 120 + synth.release_all() + yield 36 + + def chain(*args): for a in args: yield from a @@ -94,7 +113,7 @@ with wave.open("tune-noenv.wav", "w") as f: f.setnchannels(1) f.setsampwidth(2) f.setframerate(48000) - for n in chain(synthesize2(synth), synthesize3(synth), synthesize4(synth)): + for n in chain(synthesize5(synth)): for i in range(n): result, data = audiocore.get_buffer(synth) f.writeframes(data) diff --git a/tests/circuitpython/miditrack.py.exp b/tests/circuitpython/miditrack.py.exp index 6de9f947c6..22a78e5445 100644 --- a/tests/circuitpython/miditrack.py.exp +++ b/tests/circuitpython/miditrack.py.exp @@ -1,4 +1,4 @@ (0, 1, 512, 1) -1 [-16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16382, 16382] +1 [-16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383] (0, 1, 512, 1) -1 [0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16382, 16382, 16382, 16382, 16382, 16382, 0, 0] +1 [0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0] diff --git a/tests/circuitpython/synthesizer.py.exp b/tests/circuitpython/synthesizer.py.exp index 826290fe27..98f45f8bf8 100644 --- a/tests/circuitpython/synthesizer.py.exp +++ b/tests/circuitpython/synthesizer.py.exp @@ -1,30 +1,30 @@ () [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (80,) -[-16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383] +[-16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383] (80, 91) -[0, 0, 16382, 16382, 0, -16382, -16382, 0, 16382, 16382, 0, 0, 16382, 0, 0, -16382, -16382, 0, 16382, 16382, 0, 0, 16382, 0] +[0, 0, 28045, 28045, 0, -28046, -28046, 0, 28045, 28045, 0, 0, 28045, 0, 0, -28046, -28046, 0, 28045, 28045, 0, 0, 28045, 0] (91,) -[-16382, 0, 0, 16382, 0, 0, 16382, 16382, 0, -16382, -16382, 0, 16382, 16382, 0, 0, 16382, 0, 0, -16382, -16382, -16382, 16382, 16382] -(-5242, 5241) -(-10484, 10484) -(-15727, 15726) -(-16383, 16382) -(-14286, 14285) -(-13106, 13105) -(-13106, 13105) -(-13106, 13105) -(-13106, 13105) -(-13106, 13105) -(-13106, 13105) -(-13106, 13105) -(-13106, 13105) -(-11009, 11008) -(-8912, 8911) -(-6815, 6814) -(-4718, 4717) -(-2621, 2620) -(-524, 523) +[-28046, 0, 0, 28045, 0, 0, 28045, 28045, 0, -28046, -28046, 0, 28045, 28045, 0, 0, 28045, 0, 0, -28046, -28046, -28046, 28045, 28045] +(-5242, 5242) +(-10485, 10484) +(-15727, 15727) +(-16383, 16383) +(-14286, 14286) +(-13106, 13106) +(-13106, 13106) +(-13106, 13106) +(-13106, 13106) +(-13106, 13106) +(-13106, 13106) +(-13106, 13106) +(-13106, 13106) +(-11009, 11009) +(-8912, 8912) +(-6815, 6815) +(-4718, 4718) +(-2621, 2621) +(-524, 524) (0, 0) (0, 0) (0, 0) diff --git a/tests/circuitpython/synthesizer_note.py.exp b/tests/circuitpython/synthesizer_note.py.exp index e51cea1755..787243e2a5 100644 --- a/tests/circuitpython/synthesizer_note.py.exp +++ b/tests/circuitpython/synthesizer_note.py.exp @@ -1,30 +1,30 @@ () [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None),) -[-16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383] +[-16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383] (Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None), Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None)) -[0, 0, 0, 0, 0, 0, 0, 0, 16382, 0, 0, 0, 0, -16382, 0, 0, 0, 0, 16382, 0, 0, 0, 0, -16382] +[0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046] (Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None),) -[0, 0, 0, 16382, 0, 0, 0, 0, 0, 0, 0, 0, 16382, 0, 0, 0, 0, -16382, 0, 0, 0, 0, 16382, 0] -(-5242, 5241) -(-10484, 10484) -(-15727, 15726) -(-16383, 16382) -(-14286, 14285) -(-13106, 13105) -(-13106, 13105) -(-13106, 13105) -(-13106, 13105) -(-13106, 13105) -(-13106, 13105) -(-13106, 13105) -(-13106, 13105) -(-11009, 11008) -(-8912, 8911) -(-6815, 6814) -(-4718, 4717) -(-2621, 2620) -(-524, 523) +[0, 0, 0, 28045, 0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0] +(-5242, 5242) +(-10485, 10484) +(-15727, 15727) +(-16383, 16383) +(-14286, 14286) +(-13106, 13106) +(-13106, 13106) +(-13106, 13106) +(-13106, 13106) +(-13106, 13106) +(-13106, 13106) +(-13106, 13106) +(-13106, 13106) +(-11009, 11009) +(-8912, 8912) +(-6815, 6815) +(-4718, 4718) +(-2621, 2621) +(-524, 524) (0, 0) (0, 0) (0, 0) From 2f2a9e7e28cca84d1abe42d67ff633dbfac0938e Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Mon, 8 May 2023 13:25:52 -0500 Subject: [PATCH 0993/1712] Allow Access Point static IPv4 on the espressif port. --- ports/espressif/common-hal/wifi/Radio.c | 23 +++++- shared-bindings/wifi/Radio.c | 103 +++++++++++++++++------- shared-bindings/wifi/Radio.h | 3 + 3 files changed, 100 insertions(+), 29 deletions(-) diff --git a/ports/espressif/common-hal/wifi/Radio.c b/ports/espressif/common-hal/wifi/Radio.c index 851e1bea25..d0592b718f 100644 --- a/ports/espressif/common-hal/wifi/Radio.c +++ b/ports/espressif/common-hal/wifi/Radio.c @@ -475,8 +475,16 @@ void common_hal_wifi_radio_stop_dhcp_client(wifi_radio_obj_t *self) { esp_netif_dhcpc_stop(self->netif); } +void common_hal_wifi_radio_start_dhcp_server(wifi_radio_obj_t *self) { + esp_netif_dhcps_start(self->ap_netif); +} + +void common_hal_wifi_radio_stop_dhcp_server(wifi_radio_obj_t *self) { + esp_netif_dhcps_stop(self->ap_netif); +} + void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway, mp_obj_t ipv4_dns) { - common_hal_wifi_radio_stop_dhcp_client(self); // Must stop DHCP to set a manual address + common_hal_wifi_radio_stop_dhcp_client(self); // Must stop station DHCP to set a manual address esp_netif_ip_info_t ip_info; ipaddress_ipaddress_to_esp_idf_ip4(ipv4, &ip_info.ip); @@ -490,6 +498,19 @@ void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv } } +void common_hal_wifi_radio_set_ipv4_address_ap(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway) { + common_hal_wifi_radio_stop_dhcp_server(self); // Must stop access point DHCP to set a manual address + + esp_netif_ip_info_t ip_info; + ipaddress_ipaddress_to_esp_idf_ip4(ipv4, &ip_info.ip); + ipaddress_ipaddress_to_esp_idf_ip4(netmask, &ip_info.netmask); + ipaddress_ipaddress_to_esp_idf_ip4(gateway, &ip_info.gw); + + esp_netif_set_ip_info(self->ap_netif, &ip_info); + + common_hal_wifi_radio_start_dhcp_server(self); // restart access point DHCP +} + mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address, mp_float_t timeout) { esp_ping_config_t ping_config = ESP_PING_DEFAULT_CONFIG(); ipaddress_ipaddress_to_esp_idf(ip_address, &ping_config.target_addr); diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 7c6175590b..7af8d6264f 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -545,34 +545,60 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_ipv4_subnet_ap_obj, wifi_radio_get_ipv4 MP_PROPERTY_GETTER(wifi_radio_ipv4_subnet_ap_obj, (mp_obj_t)&wifi_radio_get_ipv4_subnet_ap_obj); -//| def set_ipv4_address( -//| self, -//| *, -//| ipv4: ipaddress.IPv4Address, -//| netmask: ipaddress.IPv4Address, -//| gateway: ipaddress.IPv4Address, -//| ipv4_dns: Optional[ipaddress.IPv4Address] -//| ) -> None: -//| """Sets the IP v4 address of the station. Must include the netmask and gateway. DNS address is optional. -//| Setting the address manually will stop the DHCP client.""" -//| ... -STATIC mp_obj_t wifi_radio_set_ipv4_address(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_ipv4, ARG_netmask, ARG_gateway, ARG_ipv4_dns }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_ipv4, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, - { MP_QSTR_netmask, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, - { MP_QSTR_gateway, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, - { MP_QSTR_ipv4_dns, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL} }, - }; + //| def set_ipv4_address( + //| self, + //| *, + //| ipv4: ipaddress.IPv4Address, + //| netmask: ipaddress.IPv4Address, + //| gateway: ipaddress.IPv4Address, + //| ipv4_dns: Optional[ipaddress.IPv4Address] + //| ) -> None: + //| """Sets the IP v4 address of the station. Must include the netmask and gateway. DNS address is optional. + //| Setting the address manually will stop the DHCP client.""" + //| ... + STATIC mp_obj_t wifi_radio_set_ipv4_address(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_ipv4, ARG_netmask, ARG_gateway, ARG_ipv4_dns }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_ipv4, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + { MP_QSTR_netmask, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + { MP_QSTR_gateway, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + { MP_QSTR_ipv4_dns, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL} }, + }; - wifi_radio_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + wifi_radio_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - common_hal_wifi_radio_set_ipv4_address(self, args[ARG_ipv4].u_obj, args[ARG_netmask].u_obj, args[ARG_gateway].u_obj, args[ARG_ipv4_dns].u_obj); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_set_ipv4_address_obj, 1, wifi_radio_set_ipv4_address); + common_hal_wifi_radio_set_ipv4_address(self, args[ARG_ipv4].u_obj, args[ARG_netmask].u_obj, args[ARG_gateway].u_obj, args[ARG_ipv4_dns].u_obj); + return mp_const_none; + } + STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_set_ipv4_address_obj, 1, wifi_radio_set_ipv4_address); + + //| def set_ipv4_address_ap( + //| self, + //| *, + //| ipv4: ipaddress.IPv4Address, + //| netmask: ipaddress.IPv4Address, + //| gateway: ipaddress.IPv4Address, + //| ) -> None: + //| """Sets the IP v4 address of the access point. Must include the netmask and gateway.""" + //| ... + STATIC mp_obj_t wifi_radio_set_ipv4_address_ap(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_ipv4, ARG_netmask, ARG_gateway }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_ipv4, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + { MP_QSTR_netmask, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + { MP_QSTR_gateway, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + }; + + wifi_radio_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + common_hal_wifi_radio_set_ipv4_address_ap(self, args[ARG_ipv4].u_obj, args[ARG_netmask].u_obj, args[ARG_gateway].u_obj); + return mp_const_none; + } + STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_set_ipv4_address_ap_obj, 1, wifi_radio_set_ipv4_address_ap); //| ipv4_address: Optional[ipaddress.IPv4Address] //| """IP v4 Address of the station when connected to an access point. None otherwise. (read-only)""" @@ -620,7 +646,7 @@ STATIC mp_obj_t wifi_radio_get_ap_info(mp_obj_t self) { MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_ap_info_obj, wifi_radio_get_ap_info); //| def start_dhcp(self) -> None: -//| """Starts the DHCP client.""" +//| """Starts the station DHCP client.""" //| ... STATIC mp_obj_t wifi_radio_start_dhcp_client(mp_obj_t self) { common_hal_wifi_radio_start_dhcp_client(self); @@ -629,7 +655,7 @@ STATIC mp_obj_t wifi_radio_start_dhcp_client(mp_obj_t self) { MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_start_dhcp_client_obj, wifi_radio_start_dhcp_client); //| def stop_dhcp(self) -> None: -//| """Stops the DHCP client. Needed to assign a static IP address.""" +//| """Stops the station DHCP client. Needed to assign a static IP address.""" //| ... STATIC mp_obj_t wifi_radio_stop_dhcp_client(mp_obj_t self) { common_hal_wifi_radio_stop_dhcp_client(self); @@ -637,6 +663,24 @@ STATIC mp_obj_t wifi_radio_stop_dhcp_client(mp_obj_t self) { } MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_dhcp_client_obj, wifi_radio_stop_dhcp_client); +//| def start_dhcp_ap(self) -> None: +//| """Starts the access point DHCP client.""" +//| ... +STATIC mp_obj_t wifi_radio_start_dhcp_server(mp_obj_t self) { + common_hal_wifi_radio_start_dhcp_server(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_start_dhcp_server_obj, wifi_radio_start_dhcp_server); + +//| def stop_dhcp_ap(self) -> None: +//| """Stops the access point DHCP client. Needed to assign a static IP address.""" +//| ... +STATIC mp_obj_t wifi_radio_stop_dhcp_server(mp_obj_t self) { + common_hal_wifi_radio_stop_dhcp_server(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_dhcp_server_obj, wifi_radio_stop_dhcp_server); + MP_PROPERTY_GETTER(wifi_radio_ap_info_obj, (mp_obj_t)&wifi_radio_get_ap_info_obj); @@ -693,6 +737,8 @@ STATIC const mp_rom_map_elem_t wifi_radio_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_start_dhcp), MP_ROM_PTR(&wifi_radio_start_dhcp_client_obj) }, { MP_ROM_QSTR(MP_QSTR_stop_dhcp), MP_ROM_PTR(&wifi_radio_stop_dhcp_client_obj) }, + { MP_ROM_QSTR(MP_QSTR_start_dhcp_ap), MP_ROM_PTR(&wifi_radio_start_dhcp_server_obj) }, + { MP_ROM_QSTR(MP_QSTR_stop_dhcp_ap), MP_ROM_PTR(&wifi_radio_stop_dhcp_server_obj) }, { MP_ROM_QSTR(MP_QSTR_connect), MP_ROM_PTR(&wifi_radio_connect_obj) }, // { MP_ROM_QSTR(MP_QSTR_connect_to_enterprise), MP_ROM_PTR(&wifi_radio_connect_to_enterprise_obj) }, @@ -708,6 +754,7 @@ STATIC const mp_rom_map_elem_t wifi_radio_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_ipv4_address_ap), MP_ROM_PTR(&wifi_radio_ipv4_address_ap_obj) }, { MP_ROM_QSTR(MP_QSTR_set_ipv4_address), MP_ROM_PTR(&wifi_radio_set_ipv4_address_obj) }, + { MP_ROM_QSTR(MP_QSTR_set_ipv4_address_ap), MP_ROM_PTR(&wifi_radio_set_ipv4_address_ap_obj) }, { MP_ROM_QSTR(MP_QSTR_ping), MP_ROM_PTR(&wifi_radio_ping_obj) }, }; diff --git a/shared-bindings/wifi/Radio.h b/shared-bindings/wifi/Radio.h index 1fb70ef818..5a8b48a172 100644 --- a/shared-bindings/wifi/Radio.h +++ b/shared-bindings/wifi/Radio.h @@ -99,6 +99,8 @@ extern bool common_hal_wifi_radio_get_ap_active(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_start_dhcp_client(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_stop_dhcp_client(wifi_radio_obj_t *self); +extern void common_hal_wifi_radio_start_dhcp_server(wifi_radio_obj_t *self); +extern void common_hal_wifi_radio_stop_dhcp_server(wifi_radio_obj_t *self); extern wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, mp_float_t timeout, uint8_t *bssid, size_t bssid_len); extern bool common_hal_wifi_radio_get_connected(wifi_radio_obj_t *self); @@ -115,6 +117,7 @@ extern mp_obj_t common_hal_wifi_radio_get_ipv4_address(wifi_radio_obj_t *self); extern mp_obj_t common_hal_wifi_radio_get_ipv4_address_ap(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway, mp_obj_t ipv4_dns_addr); +extern void common_hal_wifi_radio_set_ipv4_address_ap(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway); extern mp_int_t common_hal_wifi_radio_ping(wifi_radio_obj_t *self, mp_obj_t ip_address, mp_float_t timeout); From 7581d3d0b0e1cbcffae51d38d3041346d78ba97c Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Mon, 8 May 2023 13:30:32 -0500 Subject: [PATCH 0994/1712] Fix docstring --- 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 7af8d6264f..2bd227a1bb 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -664,7 +664,7 @@ STATIC mp_obj_t wifi_radio_stop_dhcp_client(mp_obj_t self) { MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_dhcp_client_obj, wifi_radio_stop_dhcp_client); //| def start_dhcp_ap(self) -> None: -//| """Starts the access point DHCP client.""" +//| """Starts the access point DHCP server.""" //| ... STATIC mp_obj_t wifi_radio_start_dhcp_server(mp_obj_t self) { common_hal_wifi_radio_start_dhcp_server(self); @@ -673,7 +673,7 @@ STATIC mp_obj_t wifi_radio_start_dhcp_server(mp_obj_t self) { MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_start_dhcp_server_obj, wifi_radio_start_dhcp_server); //| def stop_dhcp_ap(self) -> None: -//| """Stops the access point DHCP client. Needed to assign a static IP address.""" +//| """Stops the access point DHCP server. Needed to assign a static IP address.""" //| ... STATIC mp_obj_t wifi_radio_stop_dhcp_server(mp_obj_t self) { common_hal_wifi_radio_stop_dhcp_server(self); From d78e5bd64c7a67669cc22913afdf5fe5a1a5c1ad Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Mon, 8 May 2023 14:18:06 -0500 Subject: [PATCH 0995/1712] fix accidental indent --- shared-bindings/wifi/Radio.c | 98 ++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 2bd227a1bb..29ea084b14 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -545,60 +545,60 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_get_ipv4_subnet_ap_obj, wifi_radio_get_ipv4 MP_PROPERTY_GETTER(wifi_radio_ipv4_subnet_ap_obj, (mp_obj_t)&wifi_radio_get_ipv4_subnet_ap_obj); - //| def set_ipv4_address( - //| self, - //| *, - //| ipv4: ipaddress.IPv4Address, - //| netmask: ipaddress.IPv4Address, - //| gateway: ipaddress.IPv4Address, - //| ipv4_dns: Optional[ipaddress.IPv4Address] - //| ) -> None: - //| """Sets the IP v4 address of the station. Must include the netmask and gateway. DNS address is optional. - //| Setting the address manually will stop the DHCP client.""" - //| ... - STATIC mp_obj_t wifi_radio_set_ipv4_address(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_ipv4, ARG_netmask, ARG_gateway, ARG_ipv4_dns }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_ipv4, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, - { MP_QSTR_netmask, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, - { MP_QSTR_gateway, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, - { MP_QSTR_ipv4_dns, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL} }, - }; +//| def set_ipv4_address( +//| self, +//| *, +//| ipv4: ipaddress.IPv4Address, +//| netmask: ipaddress.IPv4Address, +//| gateway: ipaddress.IPv4Address, +//| ipv4_dns: Optional[ipaddress.IPv4Address] +//| ) -> None: +//| """Sets the IP v4 address of the station. Must include the netmask and gateway. DNS address is optional. +//| Setting the address manually will stop the DHCP client.""" +//| ... +STATIC mp_obj_t wifi_radio_set_ipv4_address(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_ipv4, ARG_netmask, ARG_gateway, ARG_ipv4_dns }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_ipv4, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + { MP_QSTR_netmask, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + { MP_QSTR_gateway, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + { MP_QSTR_ipv4_dns, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL} }, + }; - wifi_radio_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + wifi_radio_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - common_hal_wifi_radio_set_ipv4_address(self, args[ARG_ipv4].u_obj, args[ARG_netmask].u_obj, args[ARG_gateway].u_obj, args[ARG_ipv4_dns].u_obj); - return mp_const_none; - } - STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_set_ipv4_address_obj, 1, wifi_radio_set_ipv4_address); + common_hal_wifi_radio_set_ipv4_address(self, args[ARG_ipv4].u_obj, args[ARG_netmask].u_obj, args[ARG_gateway].u_obj, args[ARG_ipv4_dns].u_obj); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_set_ipv4_address_obj, 1, wifi_radio_set_ipv4_address); - //| def set_ipv4_address_ap( - //| self, - //| *, - //| ipv4: ipaddress.IPv4Address, - //| netmask: ipaddress.IPv4Address, - //| gateway: ipaddress.IPv4Address, - //| ) -> None: - //| """Sets the IP v4 address of the access point. Must include the netmask and gateway.""" - //| ... - STATIC mp_obj_t wifi_radio_set_ipv4_address_ap(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_ipv4, ARG_netmask, ARG_gateway }; - static const mp_arg_t allowed_args[] = { - { MP_QSTR_ipv4, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, - { MP_QSTR_netmask, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, - { MP_QSTR_gateway, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, - }; +//| def set_ipv4_address_ap( +//| self, +//| *, +//| ipv4: ipaddress.IPv4Address, +//| netmask: ipaddress.IPv4Address, +//| gateway: ipaddress.IPv4Address, +//| ) -> None: +//| """Sets the IP v4 address of the access point. Must include the netmask and gateway.""" +//| ... +STATIC mp_obj_t wifi_radio_set_ipv4_address_ap(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_ipv4, ARG_netmask, ARG_gateway }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_ipv4, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + { MP_QSTR_netmask, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + { MP_QSTR_gateway, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ, }, + }; - wifi_radio_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + wifi_radio_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - common_hal_wifi_radio_set_ipv4_address_ap(self, args[ARG_ipv4].u_obj, args[ARG_netmask].u_obj, args[ARG_gateway].u_obj); - return mp_const_none; - } - STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_set_ipv4_address_ap_obj, 1, wifi_radio_set_ipv4_address_ap); + common_hal_wifi_radio_set_ipv4_address_ap(self, args[ARG_ipv4].u_obj, args[ARG_netmask].u_obj, args[ARG_gateway].u_obj); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_set_ipv4_address_ap_obj, 1, wifi_radio_set_ipv4_address_ap); //| ipv4_address: Optional[ipaddress.IPv4Address] //| """IP v4 Address of the station when connected to an access point. None otherwise. (read-only)""" From 82c173e8cf9269522606b4ce8c0b88dee71ba378 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Mon, 8 May 2023 14:26:01 -0500 Subject: [PATCH 0996/1712] assuming the answer to that is 'yes' --- shared-bindings/wifi/Radio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 29ea084b14..0c632a68b2 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -317,7 +317,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station); //| *, //| channel: int = 1, //| authmode: Optional[AuthMode] = None, -//| max_connections: Optional[int] = 4 +//| max_connections: Optional[int] = 4, //| ) -> None: //| """Starts running an access point with the specified ssid and password. //| @@ -416,7 +416,7 @@ MP_PROPERTY_GETTER(wifi_radio_ap_active_obj, //| *, //| channel: int = 0, //| bssid: Optional[Union[str | ReadableBuffer]] = None, -//| timeout: Optional[float] = None +//| timeout: Optional[float] = None, //| ) -> None: //| """Connects to the given ssid and waits for an ip address. Reconnections are handled //| automatically once one connection succeeds. @@ -551,7 +551,7 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_subnet_ap_obj, //| ipv4: ipaddress.IPv4Address, //| netmask: ipaddress.IPv4Address, //| gateway: ipaddress.IPv4Address, -//| ipv4_dns: Optional[ipaddress.IPv4Address] +//| ipv4_dns: Optional[ipaddress.IPv4Address], //| ) -> None: //| """Sets the IP v4 address of the station. Must include the netmask and gateway. DNS address is optional. //| Setting the address manually will stop the DHCP client.""" From 56d9798b1d52edf2b3c999e36b1eb1793b9955b9 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 8 May 2023 15:39:19 -0500 Subject: [PATCH 0997/1712] validate point type is tuple in vectorio Polygon --- shared-module/vectorio/Polygon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/shared-module/vectorio/Polygon.c b/shared-module/vectorio/Polygon.c index 5d1e0d3e58..d35d489c61 100644 --- a/shared-module/vectorio/Polygon.c +++ b/shared-module/vectorio/Polygon.c @@ -36,6 +36,7 @@ static void _clobber_points_list(vectorio_polygon_t *self, mp_obj_t points_tuple for (uint16_t i = 0; i < len; ++i) { size_t tuple_len = 0; mp_obj_t *tuple_items; + mp_arg_validate_type(items[i], &mp_type_tuple, MP_QSTR_point); mp_obj_tuple_get(items[i], &tuple_len, &tuple_items); mp_arg_validate_length(tuple_len, 2, MP_QSTR_point); From 7c685477babd6f87c5751b49bca3fc9303daef0c Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 8 May 2023 16:41:57 -0500 Subject: [PATCH 0998/1712] adding __contains__ stub to displayio.Group --- shared-bindings/displayio/Group.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index 24064a74c1..48bbd50801 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -249,6 +249,10 @@ STATIC mp_obj_t displayio_group_obj_remove(mp_obj_t self_in, mp_obj_t layer) { MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_remove_obj, displayio_group_obj_remove); //| def __bool__(self) -> bool: ... +//| def __contains__( +//| self, +//| item: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid], +//| ) -> bool: ... //| def __len__(self) -> int: //| """Returns the number of layers in a Group""" //| ... From 29bf64decb8e895b823f3dcc14a83d3e03c92c87 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Mon, 8 May 2023 22:41:33 -0500 Subject: [PATCH 0999/1712] raspberrypi common-hal f(x)s Not Implemented --- ports/raspberrypi/common-hal/wifi/Radio.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index 0ef4f8bb76..12674a499b 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -358,6 +358,14 @@ void common_hal_wifi_radio_stop_dhcp_client(wifi_radio_obj_t *self) { dhcp_stop(NETIF_STA); } +void common_hal_wifi_radio_start_dhcp_server(wifi_radio_obj_t *self) { + mp_raise_NotImplementedError(NULL); +} + +void common_hal_wifi_radio_stop_dhcp_server(wifi_radio_obj_t *self) { + mp_raise_NotImplementedError(NULL); +} + void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway, mp_obj_t ipv4_dns) { common_hal_wifi_radio_stop_dhcp_client(self); @@ -371,6 +379,10 @@ void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv } } +void common_hal_wifi_radio_set_ipv4_address_ap(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway) { + mp_raise_NotImplementedError(NULL); +} + volatile bool ping_received; uint32_t ping_time; From bb2af51d25f671175f9fb7b2fb39bbc6e0a0ff29 Mon Sep 17 00:00:00 2001 From: Neradoc Date: Tue, 9 May 2023 05:39:39 +0200 Subject: [PATCH 1000/1712] document CIRCUITPY_PYSTACK_SIZE --- docs/environment.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/environment.rst b/docs/environment.rst index f8144407ef..bb6f8d2821 100644 --- a/docs/environment.rst +++ b/docs/environment.rst @@ -60,6 +60,12 @@ CIRCUITPY_BLE_NAME ~~~~~~~~~~~~~~~~~~ Default BLE name the board advertises as, including for the BLE workflow. +CIRCUITPY_PYSTACK_SIZE +~~~~~~~~~~~~~~~~~~~~~~ +Sets the size of the python stack. Must be a multiple of 4. The default value is currently 1536. +Increasing the stack reduces the size of the heap available to python code. +Used to avoid "Pystack exhausted" errors when the code can't be reworked to avoid it. + CIRCUITPY_RESERVED_PSRAM ~~~~~~~~~~~~~~~~~~~~~~~~ On boards with Espressif microcontrollers with PSRAM (also called SPIRAM), permanently reserve a portion of PSRAM for use by esp-idf. From 6f8670a2841e6074cbba8bc0142db3683f3482ef Mon Sep 17 00:00:00 2001 From: Tekktrik Date: Tue, 9 May 2023 22:01:24 -0400 Subject: [PATCH 1001/1712] Updated how stubs are built --- .github/workflows/build.yml | 2 +- Makefile | 2 +- requirements-doc.txt | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b504d34c7..730f03a15d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -209,7 +209,7 @@ jobs: TWINE_USERNAME: ${{ secrets.pypi_username }} TWINE_PASSWORD: ${{ secrets.pypi_password }} run: | - # setup.py sdist was run by 'make stubs' + # python -m build was run by 'make stubs' [ -z "$TWINE_USERNAME" ] || echo "Uploading dev release to PyPi" [ -z "$TWINE_USERNAME" ] || twine upload circuitpython-stubs/dist/* diff --git a/Makefile b/Makefile index d611dff49d..05d3618658 100644 --- a/Makefile +++ b/Makefile @@ -266,7 +266,7 @@ stubs: @cp setup.py-stubs circuitpython-stubs/setup.py @cp README.rst-stubs circuitpython-stubs/README.rst @cp MANIFEST.in-stubs circuitpython-stubs/MANIFEST.in - @(cd circuitpython-stubs && $(PYTHON) setup.py -q sdist) + @$(PYTHON) -m build circuitpython-stubs .PHONY: check-stubs check-stubs: stubs diff --git a/requirements-doc.txt b/requirements-doc.txt index 0489dc0b9f..15df3b1378 100644 --- a/requirements-doc.txt +++ b/requirements-doc.txt @@ -3,6 +3,7 @@ mypy black isort twine +build wheel astroid setuptools>=45 From 57cd45124535692414ac54a8a7330dc2f07ccb18 Mon Sep 17 00:00:00 2001 From: Tekktrik Date: Tue, 9 May 2023 22:31:24 -0400 Subject: [PATCH 1002/1712] Add build to pio install command --- tools/test-stubs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/test-stubs.sh b/tools/test-stubs.sh index 6c6c991015..f4169f5de9 100755 --- a/tools/test-stubs.sh +++ b/tools/test-stubs.sh @@ -2,7 +2,7 @@ rm -rf test-stubs python3 -m venv test-stubs . test-stubs/bin/activate -pip install mypy isort black adafruit-circuitpython-typing wheel +pip install mypy isort black adafruit-circuitpython-typing wheel build rm -rf circuitpython-stubs .mypy_cache make stubs pip install --force-reinstall circuitpython-stubs/dist/circuitpython-stubs-*.tar.gz From 55d8f0db4eb8eaf572cc36ee942c48577b5528da Mon Sep 17 00:00:00 2001 From: Alex Sirota <67526318+ajs256@users.noreply.github.com> Date: Wed, 10 May 2023 11:19:47 -0700 Subject: [PATCH 1003/1712] Add board.DISPLAY to hack_club_sprig --- ports/raspberrypi/boards/hack_club_sprig/pins.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/raspberrypi/boards/hack_club_sprig/pins.c b/ports/raspberrypi/boards/hack_club_sprig/pins.c index f82b8fafc5..f0a38cbc07 100644 --- a/ports/raspberrypi/boards/hack_club_sprig/pins.c +++ b/ports/raspberrypi/boards/hack_club_sprig/pins.c @@ -1,5 +1,8 @@ #include "shared-bindings/board/__init__.h" +#include "supervisor/board.h" +#include "shared-module/displayio/__init__.h" + STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS @@ -81,5 +84,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_WHITE_LED), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}, + }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From c9bb53b48afeb8009d83d98266ff9ff69cb2f3b7 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Thu, 11 May 2023 07:52:03 -0500 Subject: [PATCH 1004/1712] adding __iter__ stub to displayio.Group --- shared-bindings/displayio/Group.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index 48bbd50801..279e1f161b 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -253,6 +253,11 @@ MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_remove_obj, displayio_group_obj_remove //| self, //| item: Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid], //| ) -> bool: ... +//| def __iter__( +//| self, +//| ) -> Iterator[ +//| Union[vectorio.Circle, vectorio.Rectangle, vectorio.Polygon, Group, TileGrid] +//| ]: ... //| def __len__(self) -> int: //| """Returns the number of layers in a Group""" //| ... From 91978522c533e65d5e9c7d0fcd85942b6c0b3e68 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 10 May 2023 07:11:26 -0500 Subject: [PATCH 1005/1712] synthio: Add adafruit_wave and use it in the manual test --- .gitmodules | 3 + frozen/Adafruit_CircuitPython_Wave | 1 + .../synthio/note/audioop.py | 1 - .../synthio/note/chunk.py | 1 - .../circuitpython-manual/synthio/note/code.py | 8 +- .../circuitpython-manual/synthio/note/wave.py | 1 - .../synthio/wave/audioop.py | 11 - .../synthio/wave/chunk.py | 173 ------ .../synthio/wave/midi2wav.py | 8 +- .../circuitpython-manual/synthio/wave/wave.py | 550 ------------------ 10 files changed, 18 insertions(+), 739 deletions(-) create mode 160000 frozen/Adafruit_CircuitPython_Wave delete mode 120000 tests/circuitpython-manual/synthio/note/audioop.py delete mode 120000 tests/circuitpython-manual/synthio/note/chunk.py delete mode 120000 tests/circuitpython-manual/synthio/note/wave.py delete mode 100644 tests/circuitpython-manual/synthio/wave/audioop.py delete mode 100644 tests/circuitpython-manual/synthio/wave/chunk.py delete mode 100644 tests/circuitpython-manual/synthio/wave/wave.py diff --git a/.gitmodules b/.gitmodules index c690e714e8..91afffe6a6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -338,3 +338,6 @@ [submodule "frozen/circuitpython-pcf85063a"] path = frozen/circuitpython-pcf85063a url = https://github.com/bablokb/circuitpython-pcf85063a +[submodule "frozen/Adafruit_CircuitPython_Wave"] + path = frozen/Adafruit_CircuitPython_Wave + url = http://github.com/adafruit/Adafruit_CircuitPython_Wave.git diff --git a/frozen/Adafruit_CircuitPython_Wave b/frozen/Adafruit_CircuitPython_Wave new file mode 160000 index 0000000000..02b748f2e6 --- /dev/null +++ b/frozen/Adafruit_CircuitPython_Wave @@ -0,0 +1 @@ +Subproject commit 02b748f2e6826dc442c842885e58b07ad10d9287 diff --git a/tests/circuitpython-manual/synthio/note/audioop.py b/tests/circuitpython-manual/synthio/note/audioop.py deleted file mode 120000 index 31896fe265..0000000000 --- a/tests/circuitpython-manual/synthio/note/audioop.py +++ /dev/null @@ -1 +0,0 @@ -../wave/audioop.py \ No newline at end of file diff --git a/tests/circuitpython-manual/synthio/note/chunk.py b/tests/circuitpython-manual/synthio/note/chunk.py deleted file mode 120000 index 00983c1f72..0000000000 --- a/tests/circuitpython-manual/synthio/note/chunk.py +++ /dev/null @@ -1 +0,0 @@ -../wave/chunk.py \ No newline at end of file diff --git a/tests/circuitpython-manual/synthio/note/code.py b/tests/circuitpython-manual/synthio/note/code.py index 3814c57279..d088ede50e 100644 --- a/tests/circuitpython-manual/synthio/note/code.py +++ b/tests/circuitpython-manual/synthio/note/code.py @@ -1,8 +1,14 @@ +import sys + +sys.path.insert( + 0, f"{__file__.rpartition('/')[0] or '.'}/../../../../frozen/Adafruit_CircuitPython_Wave" +) + import random import audiocore import synthio from ulab import numpy as np -import wave +import adafruit_wave as wave SAMPLE_SIZE = 1024 VOLUME = 14700 diff --git a/tests/circuitpython-manual/synthio/note/wave.py b/tests/circuitpython-manual/synthio/note/wave.py deleted file mode 120000 index 45884bd29a..0000000000 --- a/tests/circuitpython-manual/synthio/note/wave.py +++ /dev/null @@ -1 +0,0 @@ -../wave/wave.py \ No newline at end of file diff --git a/tests/circuitpython-manual/synthio/wave/audioop.py b/tests/circuitpython-manual/synthio/wave/audioop.py deleted file mode 100644 index cab2fb4a7a..0000000000 --- a/tests/circuitpython-manual/synthio/wave/audioop.py +++ /dev/null @@ -1,11 +0,0 @@ -# SPDX-FileCopyrightText: 2023 Guido van Rossum and others. -# -# SPDX-License-Identifier: PSF-2.0 - -import struct - - -def byteswap(data, sampwidth): - print(data) - raise - ch = "I" if sampwidth == 16 else "H" diff --git a/tests/circuitpython-manual/synthio/wave/chunk.py b/tests/circuitpython-manual/synthio/wave/chunk.py deleted file mode 100644 index c1e6364b0f..0000000000 --- a/tests/circuitpython-manual/synthio/wave/chunk.py +++ /dev/null @@ -1,173 +0,0 @@ -# SPDX-FileCopyrightText: 2023 Guido van Rossum and others. -# -# SPDX-License-Identifier: PSF-2.0 - -"""Simple class to read IFF chunks. - -An IFF chunk (used in formats such as AIFF, TIFF, RMFF (RealMedia File -Format)) has the following structure: - -+----------------+ -| ID (4 bytes) | -+----------------+ -| size (4 bytes) | -+----------------+ -| data | -| ... | -+----------------+ - -The ID is a 4-byte string which identifies the type of chunk. - -The size field (a 32-bit value, encoded using big-endian byte order) -gives the size of the whole chunk, including the 8-byte header. - -Usually an IFF-type file consists of one or more chunks. The proposed -usage of the Chunk class defined here is to instantiate an instance at -the start of each chunk and read from the instance until it reaches -the end, after which a new instance can be instantiated. At the end -of the file, creating a new instance will fail with an EOFError -exception. - -Usage: -while True: - try: - chunk = Chunk(file) - except EOFError: - break - chunktype = chunk.getname() - while True: - data = chunk.read(nbytes) - if not data: - pass - # do something with data - -The interface is file-like. The implemented methods are: -read, close, seek, tell, isatty. -Extra methods are: skip() (called by close, skips to the end of the chunk), -getname() (returns the name (ID) of the chunk) - -The __init__ method has one required argument, a file-like object -(including a chunk instance), and one optional argument, a flag which -specifies whether or not chunks are aligned on 2-byte boundaries. The -default is 1, i.e. aligned. -""" - - -class Chunk: - def __init__(self, file, align=True, bigendian=True, inclheader=False): - import struct - - self.closed = False - self.align = align # whether to align to word (2-byte) boundaries - if bigendian: - strflag = ">" - else: - strflag = "<" - self.file = file - self.chunkname = file.read(4) - if len(self.chunkname) < 4: - raise EOFError - try: - self.chunksize = struct.unpack_from(strflag + "L", file.read(4))[0] - except struct.error: - raise EOFError from None - if inclheader: - self.chunksize = self.chunksize - 8 # subtract header - self.size_read = 0 - try: - self.offset = self.file.tell() - except (AttributeError, OSError): - self.seekable = False - else: - self.seekable = True - - def getname(self): - """Return the name (ID) of the current chunk.""" - return self.chunkname - - def getsize(self): - """Return the size of the current chunk.""" - return self.chunksize - - def close(self): - if not self.closed: - try: - self.skip() - finally: - self.closed = True - - def isatty(self): - if self.closed: - raise ValueError("I/O operation on closed file") - return False - - def seek(self, pos, whence=0): - """Seek to specified position into the chunk. - Default position is 0 (start of chunk). - If the file is not seekable, this will result in an error. - """ - - if self.closed: - raise ValueError("I/O operation on closed file") - if not self.seekable: - raise OSError("cannot seek") - if whence == 1: - pos = pos + self.size_read - elif whence == 2: - pos = pos + self.chunksize - if pos < 0 or pos > self.chunksize: - raise RuntimeError - self.file.seek(self.offset + pos, 0) - self.size_read = pos - - def tell(self): - if self.closed: - raise ValueError("I/O operation on closed file") - return self.size_read - - def read(self, size=-1): - """Read at most size bytes from the chunk. - If size is omitted or negative, read until the end - of the chunk. - """ - - if self.closed: - raise ValueError("I/O operation on closed file") - if self.size_read >= self.chunksize: - return b"" - if size < 0: - size = self.chunksize - self.size_read - if size > self.chunksize - self.size_read: - size = self.chunksize - self.size_read - data = self.file.read(size) - self.size_read = self.size_read + len(data) - if self.size_read == self.chunksize and self.align and (self.chunksize & 1): - dummy = self.file.read(1) - self.size_read = self.size_read + len(dummy) - return data - - def skip(self): - """Skip the rest of the chunk. - If you are not interested in the contents of the chunk, - this method should be called so that the file points to - the start of the next chunk. - """ - - if self.closed: - raise ValueError("I/O operation on closed file") - if self.seekable: - try: - n = self.chunksize - self.size_read - # maybe fix alignment - if self.align and (self.chunksize & 1): - n = n + 1 - self.file.seek(n, 1) - self.size_read = self.size_read + n - return - except OSError: - pass - while self.size_read < self.chunksize: - n = min(8192, self.chunksize - self.size_read) - dummy = self.read(n) - if not dummy: - raise EOFError diff --git a/tests/circuitpython-manual/synthio/wave/midi2wav.py b/tests/circuitpython-manual/synthio/wave/midi2wav.py index daa46a28c0..5d626e7baa 100644 --- a/tests/circuitpython-manual/synthio/wave/midi2wav.py +++ b/tests/circuitpython-manual/synthio/wave/midi2wav.py @@ -1,7 +1,13 @@ +import sys + +sys.path.insert( + 0, f"{__file__.rpartition('/')[0] or '.'}/../../../../frozen/Adafruit_CircuitPython_Wave" +) + import audiocore import synthio from ulab import numpy as np -import wave +import adafruit_wave as wave SAMPLE_SIZE = 1024 VOLUME = 32700 diff --git a/tests/circuitpython-manual/synthio/wave/wave.py b/tests/circuitpython-manual/synthio/wave/wave.py deleted file mode 100644 index dc6d5407a7..0000000000 --- a/tests/circuitpython-manual/synthio/wave/wave.py +++ /dev/null @@ -1,550 +0,0 @@ -# SPDX-FileCopyrightText: 2023 Guido van Rossum and others. -# -# SPDX-License-Identifier: PSF-2.0 - -"""Stuff to parse WAVE files. - -Usage. - -Reading WAVE files: - f = wave.open(file, 'r') -where file is either the name of a file or an open file pointer. -The open file pointer must have methods read(), seek(), and close(). -When the setpos() and rewind() methods are not used, the seek() -method is not necessary. - -This returns an instance of a class with the following public methods: - getnchannels() -- returns number of audio channels (1 for - mono, 2 for stereo) - getsampwidth() -- returns sample width in bytes - getframerate() -- returns sampling frequency - getnframes() -- returns number of audio frames - getcomptype() -- returns compression type ('NONE' for linear samples) - getcompname() -- returns human-readable version of - compression type ('not compressed' linear samples) - getparams() -- returns a namedtuple consisting of all of the - above in the above order - getmarkers() -- returns None (for compatibility with the - aifc module) - getmark(id) -- raises an error since the mark does not - exist (for compatibility with the aifc module) - readframes(n) -- returns at most n frames of audio - rewind() -- rewind to the beginning of the audio stream - setpos(pos) -- seek to the specified position - tell() -- return the current position - close() -- close the instance (make it unusable) -The position returned by tell() and the position given to setpos() -are compatible and have nothing to do with the actual position in the -file. -The close() method is called automatically when the class instance -is destroyed. - -Writing WAVE files: - f = wave.open(file, 'w') -where file is either the name of a file or an open file pointer. -The open file pointer must have methods write(), tell(), seek(), and -close(). - -This returns an instance of a class with the following public methods: - setnchannels(n) -- set the number of channels - setsampwidth(n) -- set the sample width - setframerate(n) -- set the frame rate - setnframes(n) -- set the number of frames - setcomptype(type, name) - -- set the compression type and the - human-readable compression type - setparams(tuple) - -- set all parameters at once - tell() -- return current position in output file - writeframesraw(data) - -- write audio frames without patching up the - file header - writeframes(data) - -- write audio frames and patch up the file header - close() -- patch up the file header and close the - output file -You should set the parameters before the first writeframesraw or -writeframes. The total number of frames does not need to be set, -but when it is set to the correct value, the header does not have to -be patched up. -It is best to first set all parameters, perhaps possibly the -compression type, and then write audio frames using writeframesraw. -When all frames have been written, either call writeframes(b'') or -close() to patch up the sizes in the header. -The close() method is called automatically when the class instance -is destroyed. -""" - -from chunk import Chunk -from collections import namedtuple -import audioop -import builtins -import struct -import sys - - -__all__ = ["open", "Error", "Wave_read", "Wave_write"] - - -class Error(Exception): - pass - - -WAVE_FORMAT_PCM = 0x0001 - -_array_fmts = None, "b", "h", None, "i" - -_wave_params = namedtuple( - "_wave_params", "nchannels sampwidth framerate nframes comptype compname" -) - - -class Wave_read: - """Variables used in this class: - - These variables are available to the user though appropriate - methods of this class: - _file -- the open file with methods read(), close(), and seek() - set through the __init__() method - _nchannels -- the number of audio channels - available through the getnchannels() method - _nframes -- the number of audio frames - available through the getnframes() method - _sampwidth -- the number of bytes per audio sample - available through the getsampwidth() method - _framerate -- the sampling frequency - available through the getframerate() method - _comptype -- the AIFF-C compression type ('NONE' if AIFF) - available through the getcomptype() method - _compname -- the human-readable AIFF-C compression type - available through the getcomptype() method - _soundpos -- the position in the audio stream - available through the tell() method, set through the - setpos() method - - These variables are used internally only: - _fmt_chunk_read -- 1 iff the FMT chunk has been read - _data_seek_needed -- 1 iff positioned correctly in audio - file for readframes() - _data_chunk -- instantiation of a chunk class for the DATA chunk - _framesize -- size of one frame in the file - """ - - def initfp(self, file): - self._convert = None - self._soundpos = 0 - self._file = Chunk(file, bigendian=0) - if self._file.getname() != b"RIFF": - raise Error("file does not start with RIFF id") - if self._file.read(4) != b"WAVE": - raise Error("not a WAVE file") - self._fmt_chunk_read = 0 - self._data_chunk = None - while 1: - self._data_seek_needed = 1 - try: - chunk = Chunk(self._file, bigendian=0) - except EOFError: - break - chunkname = chunk.getname() - if chunkname == b"fmt ": - self._read_fmt_chunk(chunk) - self._fmt_chunk_read = 1 - elif chunkname == b"data": - if not self._fmt_chunk_read: - raise Error("data chunk before fmt chunk") - self._data_chunk = chunk - self._nframes = chunk.chunksize // self._framesize - self._data_seek_needed = 0 - break - chunk.skip() - if not self._fmt_chunk_read or not self._data_chunk: - raise Error("fmt chunk and/or data chunk missing") - - def __init__(self, f): - self._i_opened_the_file = None - if isinstance(f, str): - f = builtins.open(f, "rb") - self._i_opened_the_file = f - # else, assume it is an open file object already - try: - self.initfp(f) - except: - if self._i_opened_the_file: - f.close() - raise - - def __del__(self): - self.close() - - def __enter__(self): - return self - - def __exit__(self, *args): - self.close() - - # - # User visible methods. - # - def getfp(self): - return self._file - - def rewind(self): - self._data_seek_needed = 1 - self._soundpos = 0 - - def close(self): - self._file = None - file = self._i_opened_the_file - if file: - self._i_opened_the_file = None - file.close() - - def tell(self): - return self._soundpos - - def getnchannels(self): - return self._nchannels - - def getnframes(self): - return self._nframes - - def getsampwidth(self): - return self._sampwidth - - def getframerate(self): - return self._framerate - - def getcomptype(self): - return self._comptype - - def getcompname(self): - return self._compname - - def getparams(self): - return _wave_params( - self.getnchannels(), - self.getsampwidth(), - self.getframerate(), - self.getnframes(), - self.getcomptype(), - self.getcompname(), - ) - - def getmarkers(self): - return None - - def getmark(self, id): - raise Error("no marks") - - def setpos(self, pos): - if pos < 0 or pos > self._nframes: - raise Error("position not in range") - self._soundpos = pos - self._data_seek_needed = 1 - - def readframes(self, nframes): - if self._data_seek_needed: - self._data_chunk.seek(0, 0) - pos = self._soundpos * self._framesize - if pos: - self._data_chunk.seek(pos, 0) - self._data_seek_needed = 0 - if nframes == 0: - return b"" - data = self._data_chunk.read(nframes * self._framesize) - if self._sampwidth != 1 and sys.byteorder == "big": - data = audioop.byteswap(data, self._sampwidth) - if self._convert and data: - data = self._convert(data) - self._soundpos = self._soundpos + len(data) // (self._nchannels * self._sampwidth) - return data - - # - # Internal methods. - # - - def _read_fmt_chunk(self, chunk): - try: - ( - wFormatTag, - self._nchannels, - self._framerate, - dwAvgBytesPerSec, - wBlockAlign, - ) = struct.unpack_from(" 4: - raise Error("bad sample width") - self._sampwidth = sampwidth - - def getsampwidth(self): - if not self._sampwidth: - raise Error("sample width not set") - return self._sampwidth - - def setframerate(self, framerate): - if self._datawritten: - raise Error("cannot change parameters after starting to write") - if framerate <= 0: - raise Error("bad frame rate") - self._framerate = int(round(framerate)) - - def getframerate(self): - if not self._framerate: - raise Error("frame rate not set") - return self._framerate - - def setnframes(self, nframes): - if self._datawritten: - raise Error("cannot change parameters after starting to write") - self._nframes = nframes - - def getnframes(self): - return self._nframeswritten - - def setcomptype(self, comptype, compname): - if self._datawritten: - raise Error("cannot change parameters after starting to write") - if comptype not in ("NONE",): - raise Error("unsupported compression type") - self._comptype = comptype - self._compname = compname - - def getcomptype(self): - return self._comptype - - def getcompname(self): - return self._compname - - def setparams(self, params): - nchannels, sampwidth, framerate, nframes, comptype, compname = params - if self._datawritten: - raise Error("cannot change parameters after starting to write") - self.setnchannels(nchannels) - self.setsampwidth(sampwidth) - self.setframerate(framerate) - self.setnframes(nframes) - self.setcomptype(comptype, compname) - - def getparams(self): - if not self._nchannels or not self._sampwidth or not self._framerate: - raise Error("not all parameters set") - return _wave_params( - self._nchannels, - self._sampwidth, - self._framerate, - self._nframes, - self._comptype, - self._compname, - ) - - def setmark(self, id, pos, name): - raise Error("setmark() not supported") - - def getmark(self, id): - raise Error("no marks") - - def getmarkers(self): - return None - - def tell(self): - return self._nframeswritten - - def writeframesraw(self, data): - if not isinstance(data, (bytes, bytearray)): - data = memoryview(data).cast("B") - self._ensure_header_written(len(data)) - nframes = len(data) // (self._sampwidth * self._nchannels) - if self._convert: - data = self._convert(data) - if self._sampwidth != 1 and sys.byteorder == "big": - data = audioop.byteswap(data, self._sampwidth) - self._file.write(data) - self._datawritten += len(data) - self._nframeswritten = self._nframeswritten + nframes - - def writeframes(self, data): - self.writeframesraw(data) - if self._datalength != self._datawritten: - self._patchheader() - - def close(self): - try: - if self._file: - self._ensure_header_written(0) - if self._datalength != self._datawritten: - self._patchheader() - self._file.flush() - finally: - self._file = None - file = self._i_opened_the_file - if file: - self._i_opened_the_file = None - file.close() - - # - # Internal methods. - # - - def _ensure_header_written(self, datasize): - if not self._headerwritten: - if not self._nchannels: - raise Error("# channels not specified") - if not self._sampwidth: - raise Error("sample width not specified") - if not self._framerate: - raise Error("sampling rate not specified") - self._write_header(datasize) - - def _write_header(self, initlength): - assert not self._headerwritten - self._file.write(b"RIFF") - if not self._nframes: - self._nframes = initlength // (self._nchannels * self._sampwidth) - self._datalength = self._nframes * self._nchannels * self._sampwidth - try: - self._form_length_pos = self._file.tell() - except (AttributeError, OSError): - self._form_length_pos = None - self._file.write( - struct.pack( - " Date: Wed, 10 May 2023 07:31:25 -0500 Subject: [PATCH 1006/1712] synthio: Add `synthio.BendType` --- shared-bindings/synthio/__init__.c | 32 ++++++++++++++++++++++++++++++ shared-bindings/synthio/__init__.h | 5 +++++ 2 files changed, 37 insertions(+) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 2e4fd7b8a4..61c4e9a8be 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -26,6 +26,7 @@ #include +#include "py/enum.h" #include "py/mperrno.h" #include "py/obj.h" #include "py/objnamedtuple.h" @@ -52,6 +53,7 @@ static const mp_arg_t envelope_properties[] = { { MP_QSTR_sustain_level, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL } }, }; +//| //| """Support for multi-channel audio synthesis //| //| At least 2 simultaneous notes are supported. samd5x, mimxrt10xx and rp2040 platforms support up to 12 notes. @@ -284,9 +286,39 @@ STATIC mp_obj_t onevo_to_hz(mp_obj_t arg) { } MP_DEFINE_CONST_FUN_OBJ_1(synthio_onevo_to_hz_obj, onevo_to_hz); +MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, STATIC, SYNTHIO_BEND_MODE_STATIC); +MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, TREMOLO, SYNTHIO_BEND_MODE_TREMOLO); +MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, SWEEP, SYNTHIO_BEND_MODE_SWEEP); + +//| +//| class BendType: +//| """Controls the way the ``Note.pitch_bend_depth`` and ``Note.pitch_bend_rate`` properties are interpreted.""" +//| +//| STATIC: object +//| """The Note's pitch is modified by its ``pitch_bend_depth``. ``pitch_bend_rate`` is ignored.""" +//| +//| TREMOLO: object +//| """The Note's pitch varies by ``±pitch_bend_depth` at a rate of ``pitch_bend_rate``Hz.""" +//| +//| SWEEP: object +//| """The Note's pitch starts at ``Note.frequency`` then sweeps up or down by ``pitch_bend_depth`` over ``1/pitch_bend_rate`` seconds.""" +//| +MAKE_ENUM_MAP(synthio_bend_mode) { + MAKE_ENUM_MAP_ENTRY(bend_mode, STATIC), + MAKE_ENUM_MAP_ENTRY(bend_mode, TREMOLO), + MAKE_ENUM_MAP_ENTRY(bend_mode, SWEEP), +}; + +STATIC MP_DEFINE_CONST_DICT(synthio_bend_mode_locals_dict, synthio_bend_mode_locals_table); + +MAKE_PRINTER(synthio, synthio_bend_mode); + +MAKE_ENUM_TYPE(synthio, BendType, synthio_bend_mode); + STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_synthio) }, + { MP_ROM_QSTR(MP_QSTR_BendType), MP_ROM_PTR(&synthio_bend_mode_type) }, { MP_ROM_QSTR(MP_QSTR_MidiTrack), MP_ROM_PTR(&synthio_miditrack_type) }, { MP_ROM_QSTR(MP_QSTR_Note), MP_ROM_PTR(&synthio_note_type) }, { MP_ROM_QSTR(MP_QSTR_Synthesizer), MP_ROM_PTR(&synthio_synthesizer_type) }, diff --git a/shared-bindings/synthio/__init__.h b/shared-bindings/synthio/__init__.h index 37a5c77b34..e6be579c58 100644 --- a/shared-bindings/synthio/__init__.h +++ b/shared-bindings/synthio/__init__.h @@ -28,6 +28,11 @@ #include "py/objnamedtuple.h" +typedef enum { + SYNTHIO_BEND_MODE_STATIC, SYNTHIO_BEND_MODE_TREMOLO, SYNTHIO_BEND_MODE_SWEEP +} synthio_bend_mode_t; + +extern const mp_obj_type_t synthio_bend_mode_type; typedef struct synthio_synth synthio_synth_t; extern int16_t shared_bindings_synthio_square_wave[]; extern const mp_obj_namedtuple_type_t synthio_envelope_type_obj; From 1d1907b98bca84aa784846d24a408db1fde12d33 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 10 May 2023 08:40:09 -0500 Subject: [PATCH 1007/1712] synthio: Generalize vibrato into bend bend can be static, sweep, or vibrato --- shared-bindings/synthio/Note.c | 87 ++++++++++++------- shared-bindings/synthio/Note.h | 12 ++- shared-bindings/synthio/__init__.c | 6 +- shared-bindings/synthio/__init__.h | 6 +- shared-module/synthio/Note.c | 54 ++++++++---- shared-module/synthio/Note.h | 6 +- shared-module/synthio/__init__.c | 12 +++ shared-module/synthio/__init__.h | 4 +- .../circuitpython-manual/synthio/note/code.py | 29 +++++-- tests/circuitpython/synthesizer_note.py.exp | 6 +- 10 files changed, 153 insertions(+), 69 deletions(-) diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index 4cd0abe0d4..905243b4bf 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -30,6 +30,7 @@ #include "py/objproperty.h" #include "py/runtime.h" #include "shared-bindings/util.h" +#include "shared-bindings/synthio/__init__.h" #include "shared-bindings/synthio/Note.h" #include "shared-module/synthio/Note.h" @@ -38,8 +39,9 @@ static const mp_arg_t note_properties[] = { { MP_QSTR_amplitude, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, { MP_QSTR_tremolo_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, { MP_QSTR_tremolo_depth, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, - { MP_QSTR_vibrato_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, - { MP_QSTR_vibrato_depth, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, + { MP_QSTR_bend_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, + { MP_QSTR_bend_depth, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, + { MP_QSTR_bend_mode, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = (mp_obj_t)MP_ROM_PTR(&bend_mode_VIBRATO_obj) } }, { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, { MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, }; @@ -53,17 +55,16 @@ static const mp_arg_t note_properties[] = { //| envelope: Optional[Envelope] = None, //| tremolo_depth: float = 0.0, //| tremolo_rate: float = 0.0, -//| vibrato_depth: float = 0.0, -//| vibrato_rate: float = 0.0, +//| bend_depth: float = 0.0, +//| bend_rate: float = 0.0, //| ) -> None: -//| """Construct a Note object, with a frequency in Hz, and optional amplitude (volume), waveform, envelope, tremolo (volume change) and vibrato (frequency change). +//| """Construct a Note object, with a frequency in Hz, and optional amplitude (volume), waveform, envelope, tremolo (volume change) and bend (frequency change). //| //| If waveform or envelope are `None` the synthesizer object's default waveform or envelope are used. //| //| If the same Note object is played on multiple Synthesizer objects, the result is undefined. //| """ STATIC mp_obj_t synthio_note_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_frequency, ARG_amplitude, ARG_waveform, ARG_envelope, ARG_tremolo_rate, ARG_tremolo_depth, ARG_vibrato_rate, ARG_vibrato_depth }; mp_arg_val_t args[MP_ARRAY_SIZE(note_properties)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(note_properties), note_properties, args); @@ -158,46 +159,67 @@ MP_PROPERTY_GETSET(synthio_note_tremolo_rate_obj, (mp_obj_t)&synthio_note_get_tremolo_rate_obj, (mp_obj_t)&synthio_note_set_tremolo_rate_obj); -//| vibrato_depth: float -//| """The vibrato depth of the note, from 0 to 1 //| -//| A depth of 0 disables vibrato. A depth of 1 corresponds to a vibrato of ±1 -//| octave. A depth of (1/12) = 0.833 corresponds to a vibrato of ±1 semitone, +//| bend_mode: BendMode +//| """The type of bend operation""" +STATIC mp_obj_t synthio_note_get_bend_mode(mp_obj_t self_in) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + return cp_enum_find(&synthio_bend_mode_type, common_hal_synthio_note_get_bend_mode(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_bend_mode_obj, synthio_note_get_bend_mode); + +STATIC mp_obj_t synthio_note_set_bend_mode(mp_obj_t self_in, mp_obj_t arg) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_note_set_bend_mode(self, cp_enum_value(&synthio_bend_mode_type, arg, MP_QSTR_bend_mode)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_bend_mode_obj, synthio_note_set_bend_mode); +MP_PROPERTY_GETSET(synthio_note_bend_mode_obj, + (mp_obj_t)&synthio_note_get_bend_mode_obj, + (mp_obj_t)&synthio_note_set_bend_mode_obj); + +// +//| +//| bend_depth: float +//| """The bend depth of the note, from -1 to +1 +//| +//| A depth of 0 disables bend. A depth of 1 corresponds to a bend of 1 +//| octave. A depth of (1/12) = 0.833 corresponds to a bend of 1 semitone, //| and a depth of .00833 corresponds to one musical cent. //| """ -STATIC mp_obj_t synthio_note_get_vibrato_depth(mp_obj_t self_in) { +STATIC mp_obj_t synthio_note_get_bend_depth(mp_obj_t self_in) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_float(common_hal_synthio_note_get_vibrato_depth(self)); + return mp_obj_new_float(common_hal_synthio_note_get_bend_depth(self)); } -MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_vibrato_depth_obj, synthio_note_get_vibrato_depth); +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_bend_depth_obj, synthio_note_get_bend_depth); -STATIC mp_obj_t synthio_note_set_vibrato_depth(mp_obj_t self_in, mp_obj_t arg) { +STATIC mp_obj_t synthio_note_set_bend_depth(mp_obj_t self_in, mp_obj_t arg) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_synthio_note_set_vibrato_depth(self, mp_obj_get_float(arg)); + common_hal_synthio_note_set_bend_depth(self, mp_obj_get_float(arg)); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_vibrato_depth_obj, synthio_note_set_vibrato_depth); -MP_PROPERTY_GETSET(synthio_note_vibrato_depth_obj, - (mp_obj_t)&synthio_note_get_vibrato_depth_obj, - (mp_obj_t)&synthio_note_set_vibrato_depth_obj); +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_bend_depth_obj, synthio_note_set_bend_depth); +MP_PROPERTY_GETSET(synthio_note_bend_depth_obj, + (mp_obj_t)&synthio_note_get_bend_depth_obj, + (mp_obj_t)&synthio_note_set_bend_depth_obj); -//| vibrato_rate: float -//| """The vibrato rate of the note, in Hz.""" -STATIC mp_obj_t synthio_note_get_vibrato_rate(mp_obj_t self_in) { +//| bend_rate: float +//| """The bend rate of the note, in Hz.""" +STATIC mp_obj_t synthio_note_get_bend_rate(mp_obj_t self_in) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_float(common_hal_synthio_note_get_vibrato_rate(self)); + return mp_obj_new_float(common_hal_synthio_note_get_bend_rate(self)); } -MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_vibrato_rate_obj, synthio_note_get_vibrato_rate); +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_bend_rate_obj, synthio_note_get_bend_rate); -STATIC mp_obj_t synthio_note_set_vibrato_rate(mp_obj_t self_in, mp_obj_t arg) { +STATIC mp_obj_t synthio_note_set_bend_rate(mp_obj_t self_in, mp_obj_t arg) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_synthio_note_set_vibrato_rate(self, mp_obj_get_float(arg)); + common_hal_synthio_note_set_bend_rate(self, mp_obj_get_float(arg)); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_vibrato_rate_obj, synthio_note_set_vibrato_rate); -MP_PROPERTY_GETSET(synthio_note_vibrato_rate_obj, - (mp_obj_t)&synthio_note_get_vibrato_rate_obj, - (mp_obj_t)&synthio_note_set_vibrato_rate_obj); +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_bend_rate_obj, synthio_note_set_bend_rate); +MP_PROPERTY_GETSET(synthio_note_bend_rate_obj, + (mp_obj_t)&synthio_note_get_bend_rate_obj, + (mp_obj_t)&synthio_note_set_bend_rate_obj); //| waveform: Optional[ReadableBuffer] //| """The waveform of this note. Setting the waveform to a buffer of a different size resets the note's phase.""" @@ -249,8 +271,9 @@ STATIC const mp_rom_map_elem_t synthio_note_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_envelope), MP_ROM_PTR(&synthio_note_envelope_obj) }, { MP_ROM_QSTR(MP_QSTR_tremolo_depth), MP_ROM_PTR(&synthio_note_tremolo_depth_obj) }, { MP_ROM_QSTR(MP_QSTR_tremolo_rate), MP_ROM_PTR(&synthio_note_tremolo_rate_obj) }, - { MP_ROM_QSTR(MP_QSTR_vibrato_depth), MP_ROM_PTR(&synthio_note_vibrato_depth_obj) }, - { MP_ROM_QSTR(MP_QSTR_vibrato_rate), MP_ROM_PTR(&synthio_note_vibrato_rate_obj) }, + { MP_ROM_QSTR(MP_QSTR_bend_depth), MP_ROM_PTR(&synthio_note_bend_depth_obj) }, + { MP_ROM_QSTR(MP_QSTR_bend_rate), MP_ROM_PTR(&synthio_note_bend_rate_obj) }, + { MP_ROM_QSTR(MP_QSTR_bend_mode), MP_ROM_PTR(&synthio_note_bend_mode_obj) }, }; STATIC MP_DEFINE_CONST_DICT(synthio_note_locals_dict, synthio_note_locals_dict_table); diff --git a/shared-bindings/synthio/Note.h b/shared-bindings/synthio/Note.h index ab9d925f03..90d933fd3f 100644 --- a/shared-bindings/synthio/Note.h +++ b/shared-bindings/synthio/Note.h @@ -4,6 +4,7 @@ typedef struct synthio_note_obj synthio_note_obj_t; extern const mp_obj_type_t synthio_note_type; +typedef enum synthio_bend_mode_e synthio_bend_mode_t; mp_float_t common_hal_synthio_note_get_frequency(synthio_note_obj_t *self); void common_hal_synthio_note_set_frequency(synthio_note_obj_t *self, mp_float_t value); @@ -17,11 +18,14 @@ void common_hal_synthio_note_set_tremolo_rate(synthio_note_obj_t *self, mp_float mp_float_t common_hal_synthio_note_get_tremolo_depth(synthio_note_obj_t *self); void common_hal_synthio_note_set_tremolo_depth(synthio_note_obj_t *self, mp_float_t value); -mp_float_t common_hal_synthio_note_get_vibrato_rate(synthio_note_obj_t *self); -void common_hal_synthio_note_set_vibrato_rate(synthio_note_obj_t *self, mp_float_t value); +synthio_bend_mode_t common_hal_synthio_note_get_bend_mode(synthio_note_obj_t *self); +void common_hal_synthio_note_set_bend_mode(synthio_note_obj_t *self, synthio_bend_mode_t value); -mp_float_t common_hal_synthio_note_get_vibrato_depth(synthio_note_obj_t *self); -void common_hal_synthio_note_set_vibrato_depth(synthio_note_obj_t *self, mp_float_t value); +mp_float_t common_hal_synthio_note_get_bend_rate(synthio_note_obj_t *self); +void common_hal_synthio_note_set_bend_rate(synthio_note_obj_t *self, mp_float_t value); + +mp_float_t common_hal_synthio_note_get_bend_depth(synthio_note_obj_t *self); +void common_hal_synthio_note_set_bend_depth(synthio_note_obj_t *self, mp_float_t value); mp_obj_t common_hal_synthio_note_get_waveform_obj(synthio_note_obj_t *self); void common_hal_synthio_note_set_waveform(synthio_note_obj_t *self, mp_obj_t value); diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 61c4e9a8be..2739d81e88 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -287,7 +287,7 @@ STATIC mp_obj_t onevo_to_hz(mp_obj_t arg) { MP_DEFINE_CONST_FUN_OBJ_1(synthio_onevo_to_hz_obj, onevo_to_hz); MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, STATIC, SYNTHIO_BEND_MODE_STATIC); -MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, TREMOLO, SYNTHIO_BEND_MODE_TREMOLO); +MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, VIBRATO, SYNTHIO_BEND_MODE_VIBRATO); MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, SWEEP, SYNTHIO_BEND_MODE_SWEEP); //| @@ -297,7 +297,7 @@ MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, SWEEP, SYNTHIO_BEND_MODE_SWEE //| STATIC: object //| """The Note's pitch is modified by its ``pitch_bend_depth``. ``pitch_bend_rate`` is ignored.""" //| -//| TREMOLO: object +//| VIBRATO: object //| """The Note's pitch varies by ``±pitch_bend_depth` at a rate of ``pitch_bend_rate``Hz.""" //| //| SWEEP: object @@ -305,7 +305,7 @@ MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, SWEEP, SYNTHIO_BEND_MODE_SWEE //| MAKE_ENUM_MAP(synthio_bend_mode) { MAKE_ENUM_MAP_ENTRY(bend_mode, STATIC), - MAKE_ENUM_MAP_ENTRY(bend_mode, TREMOLO), + MAKE_ENUM_MAP_ENTRY(bend_mode, VIBRATO), MAKE_ENUM_MAP_ENTRY(bend_mode, SWEEP), }; diff --git a/shared-bindings/synthio/__init__.h b/shared-bindings/synthio/__init__.h index e6be579c58..d09fab815e 100644 --- a/shared-bindings/synthio/__init__.h +++ b/shared-bindings/synthio/__init__.h @@ -27,11 +27,13 @@ #pragma once #include "py/objnamedtuple.h" +#include "py/enum.h" -typedef enum { - SYNTHIO_BEND_MODE_STATIC, SYNTHIO_BEND_MODE_TREMOLO, SYNTHIO_BEND_MODE_SWEEP +typedef enum synthio_bend_mode_e { + SYNTHIO_BEND_MODE_STATIC, SYNTHIO_BEND_MODE_VIBRATO, SYNTHIO_BEND_MODE_SWEEP } synthio_bend_mode_t; +extern const cp_enum_obj_t bend_mode_VIBRATO_obj; extern const mp_obj_type_t synthio_bend_mode_type; typedef struct synthio_synth synthio_synth_t; extern int16_t shared_bindings_synthio_square_wave[]; diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index 84949163a7..65c20024a7 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -76,25 +76,34 @@ void common_hal_synthio_note_set_tremolo_rate(synthio_note_obj_t *self, mp_float } } -mp_float_t common_hal_synthio_note_get_vibrato_depth(synthio_note_obj_t *self) { - return self->vibrato_descr.amplitude; +mp_float_t common_hal_synthio_note_get_bend_depth(synthio_note_obj_t *self) { + return self->bend_descr.amplitude; } -void common_hal_synthio_note_set_vibrato_depth(synthio_note_obj_t *self, mp_float_t value_in) { - mp_float_t val = mp_arg_validate_float_range(value_in, 0, 1, MP_QSTR_vibrato_depth); - self->vibrato_descr.amplitude = val; - self->vibrato_state.amplitude_scaled = round_float_to_int(val * 32767); +void common_hal_synthio_note_set_bend_depth(synthio_note_obj_t *self, mp_float_t value_in) { + mp_float_t val = mp_arg_validate_float_range(value_in, -1, 1, MP_QSTR_bend_depth); + self->bend_descr.amplitude = val; + self->bend_state.amplitude_scaled = round_float_to_int(val * 32767); } -mp_float_t common_hal_synthio_note_get_vibrato_rate(synthio_note_obj_t *self) { - return self->vibrato_descr.frequency; +mp_float_t common_hal_synthio_note_get_bend_rate(synthio_note_obj_t *self) { + return self->bend_descr.frequency; } -void common_hal_synthio_note_set_vibrato_rate(synthio_note_obj_t *self, mp_float_t value_in) { - mp_float_t val = mp_arg_validate_float_range(value_in, 0, 60, MP_QSTR_vibrato_rate); - self->vibrato_descr.frequency = val; +synthio_bend_mode_t common_hal_synthio_note_get_bend_mode(synthio_note_obj_t *self) { + return self->bend_mode; +} + +void common_hal_synthio_note_set_bend_mode(synthio_note_obj_t *self, synthio_bend_mode_t value) { + self->bend_mode = value; +} + + +void common_hal_synthio_note_set_bend_rate(synthio_note_obj_t *self, mp_float_t value_in) { + mp_float_t val = mp_arg_validate_float_range(value_in, 0, 60, MP_QSTR_bend_rate); + self->bend_descr.frequency = val; if (self->sample_rate != 0) { - self->vibrato_state.dds = synthio_frequency_convert_float_to_dds(val, self->sample_rate); + self->bend_state.dds = synthio_frequency_convert_float_to_dds(val, self->sample_rate); } } @@ -139,8 +148,8 @@ void synthio_note_recalculate(synthio_note_obj_t *self, int32_t sample_rate) { synthio_lfo_set(&self->tremolo_state, &self->tremolo_descr, sample_rate); self->tremolo_state.offset_scaled = 32768 - self->tremolo_state.amplitude_scaled; - synthio_lfo_set(&self->vibrato_state, &self->vibrato_descr, sample_rate); - self->vibrato_state.offset_scaled = 32768; + synthio_lfo_set(&self->bend_state, &self->bend_descr, sample_rate); + self->bend_state.offset_scaled = 32768; } void synthio_note_start(synthio_note_obj_t *self, int32_t sample_rate) { @@ -176,10 +185,23 @@ STATIC uint32_t pitch_bend(uint32_t frequency_scaled, uint16_t bend_value) { return (frequency_scaled * (uint64_t)f) >> (15 + down); } +STATIC int synthio_bend_value(synthio_note_obj_t *self, int16_t dur) { + switch (self->bend_mode) { + case SYNTHIO_BEND_MODE_STATIC: + return self->bend_state.amplitude_scaled + self->bend_state.offset_scaled; + case SYNTHIO_BEND_MODE_VIBRATO: + return synthio_lfo_step(&self->bend_state, dur); + case SYNTHIO_BEND_MODE_SWEEP: + return synthio_sweep_step(&self->bend_state, dur); + default: + return 32768; + } +} + uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, uint16_t *loudness) { int tremolo_value = synthio_lfo_step(&self->tremolo_state, dur); - int vibrato_value = synthio_lfo_step(&self->vibrato_state, dur); *loudness = (*loudness * tremolo_value) >> 15; - uint32_t frequency_scaled = pitch_bend(self->frequency_scaled, vibrato_value); + int bend_value = synthio_bend_value(self, dur); + uint32_t frequency_scaled = pitch_bend(self->frequency_scaled, bend_value); return frequency_scaled; } diff --git a/shared-module/synthio/Note.h b/shared-module/synthio/Note.h index 4efb197c07..ffaf7295fa 100644 --- a/shared-module/synthio/Note.h +++ b/shared-module/synthio/Note.h @@ -27,6 +27,7 @@ #pragma once #include "shared-module/synthio/__init__.h" +#include "shared-bindings/synthio/__init__.h" typedef struct synthio_note_obj { mp_obj_base_t base; @@ -39,8 +40,9 @@ typedef struct synthio_note_obj { int32_t frequency_scaled; int32_t amplitude_scaled; - synthio_lfo_descr_t tremolo_descr, vibrato_descr; - synthio_lfo_state_t tremolo_state, vibrato_state; + synthio_bend_mode_t bend_mode; + synthio_lfo_descr_t tremolo_descr, bend_descr; + synthio_lfo_state_t tremolo_state, bend_state; mp_buffer_info_t waveform_buf; synthio_envelope_definition_t envelope_def; diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 5ee72aeb79..0bd02a3436 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -402,6 +402,18 @@ void synthio_lfo_set(synthio_lfo_state_t *state, const synthio_lfo_descr_t *desc state->dds = synthio_frequency_convert_float_to_dds(descr->frequency * 65536, sample_rate); } +int synthio_sweep_step(synthio_lfo_state_t *state, uint16_t dur) { + uint32_t phase = state->phase; + uint16_t whole_phase = phase >> 16; + + // advance the phase accumulator + state->phase = phase + state->dds * dur; + if (state->phase < phase) { + state->phase = 0xffffffff; + } + return (state->amplitude_scaled * whole_phase) / 65536 + state->offset_scaled; +} + int synthio_lfo_step(synthio_lfo_state_t *state, uint16_t dur) { uint32_t phase = state->phase; uint16_t whole_phase = phase >> 16; diff --git a/shared-module/synthio/__init__.h b/shared-module/synthio/__init__.h index 4ea04a09e3..53706f0e6c 100644 --- a/shared-module/synthio/__init__.h +++ b/shared-module/synthio/__init__.h @@ -81,7 +81,8 @@ typedef struct { } synthio_lfo_descr_t; typedef struct { - uint32_t amplitude_scaled, offset_scaled, dds, phase; + int32_t amplitude_scaled; + uint32_t offset_scaled, dds, phase; } synthio_lfo_state_t; @@ -107,3 +108,4 @@ uint32_t synthio_frequency_convert_scaled_to_dds(uint64_t frequency_scaled, int3 void synthio_lfo_set(synthio_lfo_state_t *state, const synthio_lfo_descr_t *descr, uint32_t sample_rate); int synthio_lfo_step(synthio_lfo_state_t *state, uint16_t dur); +int synthio_sweep_step(synthio_lfo_state_t *state, uint16_t dur); diff --git a/tests/circuitpython-manual/synthio/note/code.py b/tests/circuitpython-manual/synthio/note/code.py index d088ede50e..6a6a9556dc 100644 --- a/tests/circuitpython-manual/synthio/note/code.py +++ b/tests/circuitpython-manual/synthio/note/code.py @@ -18,7 +18,7 @@ sine = np.array( ) envelope = synthio.Envelope( - attack_time=0.1, decay_time=0.05, release_time=0.2, attack_level=1, sustain_level=0.8 + attack_time=0.1, decay_time=0.05, release_time=0.2, attack_level=0.8, sustain_level=0.8 ) synth = synthio.Synthesizer(sample_rate=48000) @@ -63,8 +63,8 @@ def synthesize2(synth): def synthesize3(synth): n = synthio.Note( frequency=synthio.midi_to_hz(60), - vibrato_depth=0.1, - vibrato_rate=8, + bend_depth=0.1, + bend_rate=8, waveform=sine, envelope=envelope, ) @@ -79,8 +79,8 @@ def synthesize4(synth): frequency=synthio.midi_to_hz(60), tremolo_depth=0.1, tremolo_rate=1.5, - vibrato_depth=0.1, - vibrato_rate=3, + bend_depth=0.1, + bend_rate=3, waveform=sine, envelope=envelope, ) @@ -109,6 +109,23 @@ def synthesize5(synth): yield 36 +def synthesize6(synth): + n = synthio.Note( + frequency=synthio.midi_to_hz(60), + tremolo_depth=0.1, + tremolo_rate=1.5, + bend_depth=-5 / 12, + bend_rate=1 / 2, + bend_mode=synthio.BendType.SWEEP, + waveform=sine, + envelope=envelope, + ) + synth.press((n,)) + yield 720 + synth.release_all() + yield 36 + + def chain(*args): for a in args: yield from a @@ -119,7 +136,7 @@ with wave.open("tune-noenv.wav", "w") as f: f.setnchannels(1) f.setsampwidth(2) f.setframerate(48000) - for n in chain(synthesize5(synth)): + for n in chain(synthesize6(synth)): for i in range(n): result, data = audiocore.get_buffer(synth) f.writeframes(data) diff --git a/tests/circuitpython/synthesizer_note.py.exp b/tests/circuitpython/synthesizer_note.py.exp index 787243e2a5..bb34c0a6c3 100644 --- a/tests/circuitpython/synthesizer_note.py.exp +++ b/tests/circuitpython/synthesizer_note.py.exp @@ -1,10 +1,10 @@ () [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -(Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None),) +(Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None),) [-16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383] -(Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None), Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None)) +(Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None), Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None)) [0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046] -(Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, vibrato_rate=0.0, vibrato_depth=0.0, waveform=None, envelope=None),) +(Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None),) [0, 0, 0, 28045, 0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0] (-5242, 5242) (-10485, 10484) From 2062b2bfb766709935c0c9b7b383802bf1bf67a7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 10 May 2023 09:27:47 -0500 Subject: [PATCH 1008/1712] synthio: add a noise program to the manual tests --- .../synthio/note/noise.py | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 tests/circuitpython-manual/synthio/note/noise.py diff --git a/tests/circuitpython-manual/synthio/note/noise.py b/tests/circuitpython-manual/synthio/note/noise.py new file mode 100644 index 0000000000..53257966cb --- /dev/null +++ b/tests/circuitpython-manual/synthio/note/noise.py @@ -0,0 +1,71 @@ +import sys + +sys.path.insert( + 0, f"{__file__.rpartition('/')[0] or '.'}/../../../../frozen/Adafruit_CircuitPython_Wave" +) + +import random +import audiocore +import synthio +from ulab import numpy as np +import adafruit_wave as wave + +random.seed(9) +SAMPLE_SIZE = 1024 +VOLUME = 14700 +noise = np.array( + [random.randint(-32768, 32767) for i in range(SAMPLE_SIZE)], + dtype=np.int16, +) + +envelope = synthio.Envelope( + attack_time=0, + decay_time=0.2, + sustain_level=0, +) + +synth = synthio.Synthesizer(sample_rate=48000) + + +def randf(lo, hi): + return random.random() * (hi - lo) + lo + + +def synthesize(synth): + notes = [ + synthio.Note( + frequency=synthio.midi_to_hz(1 + i), + waveform=noise, + envelope=envelope, + bend_mode=synthio.BendType.SWEEP, + bend_depth=random.choice((-1, 1)), + bend_rate=randf(4, 12), + ) + for i in range(12) + ] + + random.seed(9) + for _ in range(16): + n = random.choice(notes) + d = random.randint(30, 60) + print(n, d) + synth.press((n,)) + yield d + synth.release_all() + yield 36 + + +def chain(*args): + for a in args: + yield from a + + +# sox -r 48000 -e signed -b 16 -c 1 tune.raw tune.wav +with wave.open("noise.wav", "w") as f: + f.setnchannels(1) + f.setsampwidth(2) + f.setframerate(48000) + for n in chain(synthesize(synth)): + for i in range(n): + result, data = audiocore.get_buffer(synth) + f.writeframes(data) From e87e7ee54f667e114058ccfba109a425eaf990ae Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 10 May 2023 11:16:22 -0500 Subject: [PATCH 1009/1712] synthio: add stereo & Note.panning A note can be placed in the center (panning=0) or moved to just the left (panning=1) or right (panning=-1) channels. Fractional panning values place it partially in both channels. --- shared-bindings/synthio/Note.c | 36 ++++++++++++++++----------- shared-bindings/synthio/Note.h | 4 +-- shared-bindings/synthio/Synthesizer.c | 6 ++++- shared-bindings/synthio/Synthesizer.h | 2 +- shared-module/synthio/MidiTrack.c | 2 +- shared-module/synthio/Note.c | 21 ++++++++++------ shared-module/synthio/Note.h | 5 ++-- shared-module/synthio/Synthesizer.c | 6 ++--- shared-module/synthio/__init__.c | 31 +++++++++++++++-------- shared-module/synthio/__init__.h | 3 ++- 10 files changed, 73 insertions(+), 43 deletions(-) diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index 905243b4bf..5912ab30c9 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -36,7 +36,7 @@ static const mp_arg_t note_properties[] = { { MP_QSTR_frequency, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = NULL } }, - { MP_QSTR_amplitude, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, + { MP_QSTR_panning, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } }, { MP_QSTR_tremolo_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, { MP_QSTR_tremolo_depth, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, { MP_QSTR_bend_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, @@ -50,15 +50,16 @@ static const mp_arg_t note_properties[] = { //| self, //| *, //| frequency: float, -//| amplitude: float = 1.0, +//| panning: float = 0.0, //| waveform: Optional[ReadableBuffer] = None, //| envelope: Optional[Envelope] = None, //| tremolo_depth: float = 0.0, //| tremolo_rate: float = 0.0, //| bend_depth: float = 0.0, //| bend_rate: float = 0.0, +//| bend_mode: BendMode = BendMode.VIBRATO, //| ) -> None: -//| """Construct a Note object, with a frequency in Hz, and optional amplitude (volume), waveform, envelope, tremolo (volume change) and bend (frequency change). +//| """Construct a Note object, with a frequency in Hz, and optional panning, waveform, envelope, tremolo (volume change) and bend (frequency change). //| //| If waveform or envelope are `None` the synthesizer object's default waveform or envelope are used. //| @@ -99,23 +100,28 @@ MP_PROPERTY_GETSET(synthio_note_frequency_obj, (mp_obj_t)&synthio_note_get_frequency_obj, (mp_obj_t)&synthio_note_set_frequency_obj); -//| amplitude: float -//| """The base amplitude of the note, from 0 to 1""" -STATIC mp_obj_t synthio_note_get_amplitude(mp_obj_t self_in) { +//| panning: float +//| """Defines the channel(s) in which the note appears. +//| +//| -1 is left channel only, 0 is both channels, and 1 is right channel. +//| For fractional values, the note plays at full amplitude in one channel +//| and partial amplitude in the other channel. For instance -.5 plays at full +//| amplitude in the left channel and 1/2 amplitude in the right channel.""" +STATIC mp_obj_t synthio_note_get_panning(mp_obj_t self_in) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_float(common_hal_synthio_note_get_amplitude(self)); + return mp_obj_new_float(common_hal_synthio_note_get_panning(self)); } -MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_amplitude_obj, synthio_note_get_amplitude); +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_panning_obj, synthio_note_get_panning); -STATIC mp_obj_t synthio_note_set_amplitude(mp_obj_t self_in, mp_obj_t arg) { +STATIC mp_obj_t synthio_note_set_panning(mp_obj_t self_in, mp_obj_t arg) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_synthio_note_set_amplitude(self, mp_obj_get_float(arg)); + common_hal_synthio_note_set_panning(self, mp_obj_get_float(arg)); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_amplitude_obj, synthio_note_set_amplitude); -MP_PROPERTY_GETSET(synthio_note_amplitude_obj, - (mp_obj_t)&synthio_note_get_amplitude_obj, - (mp_obj_t)&synthio_note_set_amplitude_obj); +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_panning_obj, synthio_note_set_panning); +MP_PROPERTY_GETSET(synthio_note_panning_obj, + (mp_obj_t)&synthio_note_get_panning_obj, + (mp_obj_t)&synthio_note_set_panning_obj); //| tremolo_depth: float @@ -266,7 +272,7 @@ static void note_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_ STATIC const mp_rom_map_elem_t synthio_note_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_PTR(&synthio_note_frequency_obj) }, - { MP_ROM_QSTR(MP_QSTR_amplitude), MP_ROM_PTR(&synthio_note_amplitude_obj) }, + { MP_ROM_QSTR(MP_QSTR_panning), MP_ROM_PTR(&synthio_note_panning_obj) }, { MP_ROM_QSTR(MP_QSTR_waveform), MP_ROM_PTR(&synthio_note_waveform_obj) }, { MP_ROM_QSTR(MP_QSTR_envelope), MP_ROM_PTR(&synthio_note_envelope_obj) }, { MP_ROM_QSTR(MP_QSTR_tremolo_depth), MP_ROM_PTR(&synthio_note_tremolo_depth_obj) }, diff --git a/shared-bindings/synthio/Note.h b/shared-bindings/synthio/Note.h index 90d933fd3f..f441c9ae43 100644 --- a/shared-bindings/synthio/Note.h +++ b/shared-bindings/synthio/Note.h @@ -9,8 +9,8 @@ typedef enum synthio_bend_mode_e synthio_bend_mode_t; mp_float_t common_hal_synthio_note_get_frequency(synthio_note_obj_t *self); void common_hal_synthio_note_set_frequency(synthio_note_obj_t *self, mp_float_t value); -mp_float_t common_hal_synthio_note_get_amplitude(synthio_note_obj_t *self); -void common_hal_synthio_note_set_amplitude(synthio_note_obj_t *self, mp_float_t value); +mp_float_t common_hal_synthio_note_get_panning(synthio_note_obj_t *self); +void common_hal_synthio_note_set_panning(synthio_note_obj_t *self, mp_float_t value); mp_float_t common_hal_synthio_note_get_tremolo_rate(synthio_note_obj_t *self); void common_hal_synthio_note_set_tremolo_rate(synthio_note_obj_t *self, mp_float_t value); diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index 5d9be09f70..e7e442d90f 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -44,6 +44,7 @@ //| self, //| *, //| sample_rate: int = 11025, +//| channel_count: int = 1, //| waveform: Optional[ReadableBuffer] = None, //| envelope: Optional[Envelope] = None, //| ) -> None: @@ -56,13 +57,15 @@ //| and do not support advanced features like tremolo or vibrato. //| //| :param int sample_rate: The desired playback sample rate; higher sample rate requires more memory +//| :param int channel_count: The number of output channels (1=mono, 2=stereo) //| :param ReadableBuffer waveform: A single-cycle waveform. Default is a 50% duty cycle square wave. If specified, must be a ReadableBuffer of type 'h' (signed 16 bit) //| :param Optional[Envelope] envelope: An object that defines the loudness of a note over time. The default envelope, `None` provides no ramping, voices turn instantly on and off. //| """ STATIC mp_obj_t synthio_synthesizer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_sample_rate, ARG_waveform, ARG_envelope }; + enum { ARG_sample_rate, ARG_channel_count, ARG_waveform, ARG_envelope }; static const mp_arg_t allowed_args[] = { { MP_QSTR_sample_rate, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 11025} }, + { MP_QSTR_channel_count, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} }, { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, { MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, }; @@ -77,6 +80,7 @@ STATIC mp_obj_t synthio_synthesizer_make_new(const mp_obj_type_t *type, size_t n common_hal_synthio_synthesizer_construct(self, args[ARG_sample_rate].u_int, + args[ARG_channel_count].u_int, bufinfo_waveform.buf, bufinfo_waveform.len / 2, args[ARG_envelope].u_obj); diff --git a/shared-bindings/synthio/Synthesizer.h b/shared-bindings/synthio/Synthesizer.h index ba6c3b99e3..4568dafdaf 100644 --- a/shared-bindings/synthio/Synthesizer.h +++ b/shared-bindings/synthio/Synthesizer.h @@ -32,7 +32,7 @@ extern const mp_obj_type_t synthio_synthesizer_type; void common_hal_synthio_synthesizer_construct(synthio_synthesizer_obj_t *self, - uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_length, + uint32_t sample_rate, int channel_count, const int16_t *waveform, uint16_t waveform_length, mp_obj_t envelope); void common_hal_synthio_synthesizer_deinit(synthio_synthesizer_obj_t *self); bool common_hal_synthio_synthesizer_deinited(synthio_synthesizer_obj_t *self); diff --git a/shared-module/synthio/MidiTrack.c b/shared-module/synthio/MidiTrack.c index e22753cb26..a24071800b 100644 --- a/shared-module/synthio/MidiTrack.c +++ b/shared-module/synthio/MidiTrack.c @@ -123,7 +123,7 @@ void common_hal_synthio_miditrack_construct(synthio_miditrack_obj_t *self, self->track.buf = (void *)buffer; self->track.len = len; - synthio_synth_init(&self->synth, sample_rate, waveform, waveform_length, envelope); + synthio_synth_init(&self->synth, sample_rate, 1, waveform, waveform_length, envelope); start_parse(self); } diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index 65c20024a7..bbd84c729f 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -44,14 +44,20 @@ void common_hal_synthio_note_set_frequency(synthio_note_obj_t *self, mp_float_t self->frequency_scaled = synthio_frequency_convert_float_to_scaled(val); } -mp_float_t common_hal_synthio_note_get_amplitude(synthio_note_obj_t *self) { - return self->amplitude; +mp_float_t common_hal_synthio_note_get_panning(synthio_note_obj_t *self) { + return self->panning; } -void common_hal_synthio_note_set_amplitude(synthio_note_obj_t *self, mp_float_t value_in) { - mp_float_t val = mp_arg_validate_float_range(value_in, 0, 1, MP_QSTR_amplitude); - self->amplitude = val; - self->amplitude_scaled = round_float_to_int(val * 32767); +void common_hal_synthio_note_set_panning(synthio_note_obj_t *self, mp_float_t value_in) { + mp_float_t val = mp_arg_validate_float_range(value_in, -1, 1, MP_QSTR_panning); + self->panning = val; + if (val >= 0) { + self->left_panning_scaled = 32768; + self->right_panning_scaled = 32768 - round_float_to_int(val * 32768); + } else { + self->right_panning_scaled = 32768; + self->left_panning_scaled = 32768 + round_float_to_int(val * 32768); + } } mp_float_t common_hal_synthio_note_get_tremolo_depth(synthio_note_obj_t *self) { @@ -200,7 +206,8 @@ STATIC int synthio_bend_value(synthio_note_obj_t *self, int16_t dur) { uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, uint16_t *loudness) { int tremolo_value = synthio_lfo_step(&self->tremolo_state, dur); - *loudness = (*loudness * tremolo_value) >> 15; + loudness[0] = (((loudness[0] * tremolo_value) >> 15) * self->left_panning_scaled) >> 15; + loudness[1] = (((loudness[1] * tremolo_value) >> 15) * self->right_panning_scaled) >> 15; int bend_value = synthio_bend_value(self, dur); uint32_t frequency_scaled = pitch_bend(self->frequency_scaled, bend_value); return frequency_scaled; diff --git a/shared-module/synthio/Note.h b/shared-module/synthio/Note.h index ffaf7295fa..ec1f262dc5 100644 --- a/shared-module/synthio/Note.h +++ b/shared-module/synthio/Note.h @@ -33,13 +33,14 @@ typedef struct synthio_note_obj { mp_obj_base_t base; mp_float_t frequency; - mp_float_t amplitude; + mp_float_t panning; mp_obj_t waveform_obj, envelope_obj; int32_t sample_rate; int32_t frequency_scaled; int32_t amplitude_scaled; + int32_t left_panning_scaled, right_panning_scaled; synthio_bend_mode_t bend_mode; synthio_lfo_descr_t tremolo_descr, bend_descr; synthio_lfo_state_t tremolo_state, bend_state; @@ -49,7 +50,7 @@ typedef struct synthio_note_obj { } synthio_note_obj_t; void synthio_note_recalculate(synthio_note_obj_t *self, int32_t sample_rate); -uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, uint16_t *loudness); +uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, uint16_t loudness[2]); void synthio_note_start(synthio_note_obj_t *self, int32_t sample_rate); bool synthio_note_playing(synthio_note_obj_t *self); uint32_t synthio_note_envelope(synthio_note_obj_t *self); diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index ad37cccce5..42e234fef1 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -32,10 +32,10 @@ void common_hal_synthio_synthesizer_construct(synthio_synthesizer_obj_t *self, - uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_length, + uint32_t sample_rate, int channel_count, const int16_t *waveform, uint16_t waveform_length, mp_obj_t envelope) { - synthio_synth_init(&self->synth, sample_rate, waveform, waveform_length, envelope); + synthio_synth_init(&self->synth, sample_rate, channel_count, waveform, waveform_length, envelope); } void common_hal_synthio_synthesizer_deinit(synthio_synthesizer_obj_t *self) { @@ -52,7 +52,7 @@ uint8_t common_hal_synthio_synthesizer_get_bits_per_sample(synthio_synthesizer_o return SYNTHIO_BITS_PER_SAMPLE; } uint8_t common_hal_synthio_synthesizer_get_channel_count(synthio_synthesizer_obj_t *self) { - return 1; + return self->synth.channel_count; } void synthio_synthesizer_reset_buffer(synthio_synthesizer_obj_t *self, diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 0bd02a3436..051fb522f7 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -187,7 +187,7 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t synth->span.dur -= dur; int32_t sample_rate = synth->sample_rate; - int32_t out_buffer32[dur]; + int32_t out_buffer32[dur * synth->channel_count]; memset(out_buffer32, 0, sizeof(out_buffer32)); for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { @@ -204,7 +204,7 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t } // adjust loudness by envelope - uint16_t loudness = synth->envelope_state[chan].level; + uint16_t loudness[2] = {synth->envelope_state[chan].level,synth->envelope_state[chan].level}; uint32_t dds_rate; const int16_t *waveform = synth->waveform; @@ -221,7 +221,7 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t dds_rate = (sample_rate / 2 + ((uint64_t)(base_freq * waveform_length) << (SYNTHIO_FREQUENCY_SHIFT - 10 + octave))) / sample_rate; } else { synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); - int32_t frequency_scaled = synthio_note_step(note, sample_rate, dur, &loudness); + int32_t frequency_scaled = synthio_note_step(note, sample_rate, dur, loudness); if (note->waveform_buf.buf) { waveform = note->waveform_buf.buf; waveform_length = note->waveform_buf.len / 2; @@ -241,14 +241,19 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t accum %= lim; } - for (uint16_t i = 0; i < dur; i++) { + int synth_chan = synth->channel_count; + for (uint16_t i = 0, j = 0; i < dur; i++) { accum += dds_rate; // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed if (accum > lim) { accum -= lim; } int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; - out_buffer32[i] += (waveform[idx] * loudness) / 65536; + int16_t wi = waveform[idx]; + for (int c = 0; c < synth_chan; c++) { + out_buffer32[j] += (wi * loudness[c]) / 65536; + j++; + } } synth->accum[chan] = accum; } @@ -256,7 +261,7 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t int16_t *out_buffer16 = (int16_t *)(void *)synth->buffers[synth->buffer_index]; // mix down audio - for (size_t i = 0; i < dur; i++) { + for (size_t i = 0; i < MP_ARRAY_SIZE(out_buffer32); i++) { int32_t sample = out_buffer32[i]; out_buffer16[i] = mix_down_sample(sample); } @@ -270,7 +275,7 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t synthio_envelope_state_step(&synth->envelope_state[chan], synthio_synth_get_note_envelope(synth, note_obj), dur); } - *buffer_length = synth->last_buffer_length = dur * SYNTHIO_BYTES_PER_SAMPLE; + *buffer_length = synth->last_buffer_length = dur * SYNTHIO_BYTES_PER_SAMPLE * synth->channel_count; *bufptr = (uint8_t *)out_buffer16; } @@ -301,10 +306,12 @@ mp_obj_t synthio_synth_envelope_get(synthio_synth_t *synth) { return synth->envelope_obj; } -void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_length, mp_obj_t envelope_obj) { - synth->buffer_length = SYNTHIO_MAX_DUR * SYNTHIO_BYTES_PER_SAMPLE; +void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channel_count, const int16_t *waveform, uint16_t waveform_length, mp_obj_t envelope_obj) { + mp_arg_validate_int_range(channel_count, 1, 2, MP_QSTR_channel_count); + synth->buffer_length = SYNTHIO_MAX_DUR * SYNTHIO_BYTES_PER_SAMPLE * channel_count; synth->buffers[0] = m_malloc(synth->buffer_length, false); synth->buffers[1] = m_malloc(synth->buffer_length, false); + synth->channel_count = channel_count; synth->other_channel = -1; synth->waveform = waveform; synth->waveform_length = waveform_length; @@ -321,7 +328,11 @@ void synthio_synth_get_buffer_structure(synthio_synth_t *synth, bool single_chan *single_buffer = false; *samples_signed = true; *max_buffer_length = synth->buffer_length; - *spacing = 1; + if (single_channel_output) { + *spacing = synth->channel_count; + } else { + *spacing = 1; + } } STATIC bool parse_common(mp_buffer_info_t *bufinfo, mp_obj_t o, int16_t what) { diff --git a/shared-module/synthio/__init__.h b/shared-module/synthio/__init__.h index 53706f0e6c..f4b90a9cac 100644 --- a/shared-module/synthio/__init__.h +++ b/shared-module/synthio/__init__.h @@ -65,6 +65,7 @@ typedef struct synthio_synth { uint32_t total_envelope; int16_t *buffers[2]; const int16_t *waveform; + uint8_t channel_count; uint16_t buffer_length; uint16_t last_buffer_length; uint8_t other_channel, buffer_index, other_buffer_index; @@ -89,7 +90,7 @@ typedef struct { void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **buffer, uint32_t *buffer_length, uint8_t channel); void synthio_synth_deinit(synthio_synth_t *synth); bool synthio_synth_deinited(synthio_synth_t *synth); -void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_length, +void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channel_count, const int16_t *waveform, uint16_t waveform_length, mp_obj_t envelope); void synthio_synth_get_buffer_structure(synthio_synth_t *synth, bool single_channel_output, bool *single_buffer, bool *samples_signed, uint32_t *max_buffer_length, uint8_t *spacing); From 095e0208095a5d26d3b884d9e34a930b8a98536a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 10 May 2023 12:07:01 -0500 Subject: [PATCH 1010/1712] synthio: Add ring modulation --- shared-bindings/synthio/Note.c | 47 +++++++++++++ shared-bindings/synthio/Note.h | 6 ++ shared-module/synthio/Note.c | 25 +++++++ shared-module/synthio/Note.h | 6 +- shared-module/synthio/__init__.c | 111 +++++++++++++++++++++++++------ shared-module/synthio/__init__.h | 1 + 6 files changed, 172 insertions(+), 24 deletions(-) diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index 5912ab30c9..b12e015378 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -44,6 +44,8 @@ static const mp_arg_t note_properties[] = { { MP_QSTR_bend_mode, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = (mp_obj_t)MP_ROM_PTR(&bend_mode_VIBRATO_obj) } }, { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, { MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, + { MP_QSTR_ring_frequency, MP_ARG_OBJ, {.u_obj = NULL } }, + { MP_QSTR_ring_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, }; //| class Note: //| def __init__( @@ -265,6 +267,49 @@ MP_PROPERTY_GETSET(synthio_note_envelope_obj, (mp_obj_t)&synthio_note_get_envelope_obj, (mp_obj_t)&synthio_note_set_envelope_obj); +//| ring_frequency: float +//| """The ring frequency of the note, in Hz. Zero disables. +//| +//| For ring to take effect, both ring_frequency and ring_wavefor must be set.""" +STATIC mp_obj_t synthio_note_get_ring_frequency(mp_obj_t self_in) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_synthio_note_get_ring_frequency(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_ring_frequency_obj, synthio_note_get_ring_frequency); + +STATIC mp_obj_t synthio_note_set_ring_frequency(mp_obj_t self_in, mp_obj_t arg) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_note_set_ring_frequency(self, mp_obj_get_float(arg)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_ring_frequency_obj, synthio_note_set_ring_frequency); +MP_PROPERTY_GETSET(synthio_note_ring_frequency_obj, + (mp_obj_t)&synthio_note_get_ring_frequency_obj, + (mp_obj_t)&synthio_note_set_ring_frequency_obj); + +//| ring_waveform: Optional[ReadableBuffer] +//| """The ring waveform of this note. Setting the ring_waveform to a buffer of a different size resets the note's phase. +//| +//| For ring to take effect, both ring_frequency and ring_wavefor must be set.""" +//| +STATIC mp_obj_t synthio_note_get_ring_waveform(mp_obj_t self_in) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_synthio_note_get_ring_waveform_obj(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_ring_waveform_obj, synthio_note_get_ring_waveform); + +STATIC mp_obj_t synthio_note_set_ring_waveform(mp_obj_t self_in, mp_obj_t arg) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_note_set_ring_waveform(self, arg); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_ring_waveform_obj, synthio_note_set_ring_waveform); +MP_PROPERTY_GETSET(synthio_note_ring_waveform_obj, + (mp_obj_t)&synthio_note_get_ring_waveform_obj, + (mp_obj_t)&synthio_note_set_ring_waveform_obj); + + + static void note_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { (void)kind; properties_print_helper(print, self_in, note_properties, MP_ARRAY_SIZE(note_properties)); @@ -280,6 +325,8 @@ STATIC const mp_rom_map_elem_t synthio_note_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_bend_depth), MP_ROM_PTR(&synthio_note_bend_depth_obj) }, { MP_ROM_QSTR(MP_QSTR_bend_rate), MP_ROM_PTR(&synthio_note_bend_rate_obj) }, { MP_ROM_QSTR(MP_QSTR_bend_mode), MP_ROM_PTR(&synthio_note_bend_mode_obj) }, + { MP_ROM_QSTR(MP_QSTR_ring_frequency), MP_ROM_PTR(&synthio_note_ring_frequency_obj) }, + { MP_ROM_QSTR(MP_QSTR_ring_waveform), MP_ROM_PTR(&synthio_note_ring_waveform_obj) }, }; STATIC MP_DEFINE_CONST_DICT(synthio_note_locals_dict, synthio_note_locals_dict_table); diff --git a/shared-bindings/synthio/Note.h b/shared-bindings/synthio/Note.h index f441c9ae43..e548f9b5a7 100644 --- a/shared-bindings/synthio/Note.h +++ b/shared-bindings/synthio/Note.h @@ -9,6 +9,9 @@ typedef enum synthio_bend_mode_e synthio_bend_mode_t; mp_float_t common_hal_synthio_note_get_frequency(synthio_note_obj_t *self); void common_hal_synthio_note_set_frequency(synthio_note_obj_t *self, mp_float_t value); +mp_float_t common_hal_synthio_note_get_ring_frequency(synthio_note_obj_t *self); +void common_hal_synthio_note_set_ring_frequency(synthio_note_obj_t *self, mp_float_t value); + mp_float_t common_hal_synthio_note_get_panning(synthio_note_obj_t *self); void common_hal_synthio_note_set_panning(synthio_note_obj_t *self, mp_float_t value); @@ -30,5 +33,8 @@ void common_hal_synthio_note_set_bend_depth(synthio_note_obj_t *self, mp_float_t mp_obj_t common_hal_synthio_note_get_waveform_obj(synthio_note_obj_t *self); void common_hal_synthio_note_set_waveform(synthio_note_obj_t *self, mp_obj_t value); +mp_obj_t common_hal_synthio_note_get_ring_waveform_obj(synthio_note_obj_t *self); +void common_hal_synthio_note_set_ring_waveform(synthio_note_obj_t *self, mp_obj_t value); + mp_obj_t common_hal_synthio_note_get_envelope_obj(synthio_note_obj_t *self); void common_hal_synthio_note_set_envelope(synthio_note_obj_t *self, mp_obj_t value); diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index bbd84c729f..87d32da031 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -44,6 +44,16 @@ void common_hal_synthio_note_set_frequency(synthio_note_obj_t *self, mp_float_t self->frequency_scaled = synthio_frequency_convert_float_to_scaled(val); } +mp_float_t common_hal_synthio_note_get_ring_frequency(synthio_note_obj_t *self) { + return self->ring_frequency; +} + +void common_hal_synthio_note_set_ring_frequency(synthio_note_obj_t *self, mp_float_t value_in) { + mp_float_t val = mp_arg_validate_float_range(value_in, 0, 32767, MP_QSTR_ring_frequency); + self->ring_frequency = val; + self->ring_frequency_scaled = synthio_frequency_convert_float_to_scaled(val); +} + mp_float_t common_hal_synthio_note_get_panning(synthio_note_obj_t *self) { return self->panning; } @@ -142,6 +152,21 @@ void common_hal_synthio_note_set_waveform(synthio_note_obj_t *self, mp_obj_t wav self->waveform_obj = waveform_in; } +mp_obj_t common_hal_synthio_note_get_ring_waveform_obj(synthio_note_obj_t *self) { + return self->ring_waveform_obj; +} + +void common_hal_synthio_note_set_ring_waveform(synthio_note_obj_t *self, mp_obj_t ring_waveform_in) { + if (ring_waveform_in == mp_const_none) { + memset(&self->ring_waveform_buf, 0, sizeof(self->ring_waveform_buf)); + } else { + mp_buffer_info_t bufinfo_ring_waveform; + synthio_synth_parse_waveform(&bufinfo_ring_waveform, ring_waveform_in); + self->ring_waveform_buf = bufinfo_ring_waveform; + } + self->ring_waveform_obj = ring_waveform_in; +} + void synthio_note_recalculate(synthio_note_obj_t *self, int32_t sample_rate) { if (sample_rate == self->sample_rate) { return; diff --git a/shared-module/synthio/Note.h b/shared-module/synthio/Note.h index ec1f262dc5..db3495f8b3 100644 --- a/shared-module/synthio/Note.h +++ b/shared-module/synthio/Note.h @@ -32,13 +32,14 @@ typedef struct synthio_note_obj { mp_obj_base_t base; - mp_float_t frequency; + mp_float_t frequency, ring_frequency; mp_float_t panning; - mp_obj_t waveform_obj, envelope_obj; + mp_obj_t waveform_obj, envelope_obj, ring_waveform_obj; int32_t sample_rate; int32_t frequency_scaled; + int32_t ring_frequency_scaled; int32_t amplitude_scaled; int32_t left_panning_scaled, right_panning_scaled; synthio_bend_mode_t bend_mode; @@ -46,6 +47,7 @@ typedef struct synthio_note_obj { synthio_lfo_state_t tremolo_state, bend_state; mp_buffer_info_t waveform_buf; + mp_buffer_info_t ring_waveform_buf; synthio_envelope_definition_t envelope_def; } synthio_note_obj_t; diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 051fb522f7..a7b2e0c25c 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -209,6 +209,11 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t uint32_t dds_rate; const int16_t *waveform = synth->waveform; uint32_t waveform_length = synth->waveform_length; + + uint32_t ring_dds_rate = 0; + const int16_t *ring_waveform = NULL; + uint32_t ring_waveform_length = 0; + if (mp_obj_is_small_int(note_obj)) { uint8_t note = mp_obj_get_int(note_obj); uint8_t octave = note / 12; @@ -227,35 +232,97 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t waveform_length = note->waveform_buf.len / 2; } dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)frequency_scaled * waveform_length, sample_rate); - } - - uint32_t accum = synth->accum[chan]; - uint32_t lim = waveform_length << SYNTHIO_FREQUENCY_SHIFT; - if (dds_rate > lim / 2) { - // beyond nyquist, can't play note - continue; - } - - // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided - if (accum > lim) { - accum %= lim; + if (note->ring_frequency_scaled != 0 && note->ring_waveform_buf.buf) { + ring_waveform = note->ring_waveform_buf.buf; + ring_waveform_length = note->ring_waveform_buf.len / 2; + ring_dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)note->ring_frequency_scaled * ring_waveform_length, sample_rate); + uint32_t lim = ring_waveform_length << SYNTHIO_FREQUENCY_SHIFT; + if (ring_dds_rate > lim / 2) { + ring_dds_rate = 0; // can't ring at that frequency + } + } } int synth_chan = synth->channel_count; - for (uint16_t i = 0, j = 0; i < dur; i++) { - accum += dds_rate; - // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed + if (ring_dds_rate) { + uint32_t lim = waveform_length << SYNTHIO_FREQUENCY_SHIFT; + uint32_t accum = synth->accum[chan]; + + if (dds_rate > lim / 2) { + // beyond nyquist, can't play note + continue; + } + + // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided if (accum > lim) { - accum -= lim; + accum %= lim; } - int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; - int16_t wi = waveform[idx]; - for (int c = 0; c < synth_chan; c++) { - out_buffer32[j] += (wi * loudness[c]) / 65536; - j++; + + int32_t ring_buffer[dur]; + // first, fill with waveform + for (uint16_t i = 0; i < dur; i++) { + accum += dds_rate; + // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed + if (accum > lim) { + accum -= lim; + } + int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; + ring_buffer[i] = waveform[idx]; } + synth->accum[chan] = accum; + + // now modulate by ring and accumulate + accum = synth->ring_accum[chan]; + lim = ring_waveform_length << SYNTHIO_FREQUENCY_SHIFT; + + // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided + if (accum > lim) { + accum %= lim; + } + + for (uint16_t i = 0, j = 0; i < dur; i++) { + accum += ring_dds_rate; + // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed + if (accum > lim) { + accum -= lim; + } + int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; + int16_t wi = (ring_waveform[idx] * ring_buffer[i]) / 32768; + for (int c = 0; c < synth_chan; c++) { + out_buffer32[j] += (wi * loudness[c]) / 32768; + j++; + } + } + synth->ring_accum[chan] = accum; + } else { + uint32_t lim = waveform_length << SYNTHIO_FREQUENCY_SHIFT; + uint32_t accum = synth->accum[chan]; + + if (dds_rate > lim / 2) { + // beyond nyquist, can't play note + continue; + } + + // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided + if (accum > lim) { + accum %= lim; + } + + for (uint16_t i = 0, j = 0; i < dur; i++) { + accum += dds_rate; + // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed + if (accum > lim) { + accum -= lim; + } + int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; + int16_t wi = waveform[idx]; + for (int c = 0; c < synth_chan; c++) { + out_buffer32[j] += (wi * loudness[c]) / 65536; + j++; + } + } + synth->accum[chan] = accum; } - synth->accum[chan] = accum; } int16_t *out_buffer16 = (int16_t *)(void *)synth->buffers[synth->buffer_index]; diff --git a/shared-module/synthio/__init__.h b/shared-module/synthio/__init__.h index f4b90a9cac..895b0cae5b 100644 --- a/shared-module/synthio/__init__.h +++ b/shared-module/synthio/__init__.h @@ -74,6 +74,7 @@ typedef struct synthio_synth { mp_obj_t envelope_obj; synthio_midi_span_t span; uint32_t accum[CIRCUITPY_SYNTHIO_MAX_CHANNELS]; + uint32_t ring_accum[CIRCUITPY_SYNTHIO_MAX_CHANNELS]; synthio_envelope_state_t envelope_state[CIRCUITPY_SYNTHIO_MAX_CHANNELS]; } synthio_synth_t; From 89080564b4c47296fba4fd33471da2fe5d768b3a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 10:19:48 -0500 Subject: [PATCH 1011/1712] synthio: Fix release time of zero-sustain envelopes When there's no sustain, the release step needs to be calculated from the attack level, not the sustain level. Otherwise, contrary to intent, this leads to the actual release taking a loooonnngg time. --- shared-bindings/synthio/__init__.c | 2 +- shared-module/synthio/__init__.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 2739d81e88..de1366717c 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -80,7 +80,7 @@ static const mp_arg_t envelope_properties[] = { //| //| :param float attack_time: The time in seconds it takes to ramp from 0 volume to attack_volume //| :param float decay_time: The time in seconds it takes to ramp from attack_volume to sustain_volume -//| :param float release_time: The time in seconds it takes to ramp from sustain_volume to release_volume. When a note is released before it has reached the sustain phase, the release is done with the same slope indicated by ``release_time`` and ``sustain_level`` +//| :param float release_time: The time in seconds it takes to ramp from sustain_volume to release_volume. When a note is released before it has reached the sustain phase, the release is done with the same slope indicated by ``release_time`` and ``sustain_level``. If the ``sustain_level`` is ``0.0`` then the release slope calculations use the ``attack_level`` instead. //| :param float attack_level: The level, in the range ``0.0`` to ``1.0`` of the peak volume of the attack phase //| :param float sustain_level: The level, in the range ``0.0`` to ``1.0`` of the volume of the sustain phase relative to the attack level //| """ diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index a7b2e0c25c..2bca3db439 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -89,7 +89,7 @@ void synthio_envelope_definition_set(synthio_envelope_definition_t *envelope, mp envelope->release_step = -convert_time_to_rate( sample_rate, fields[2], - envelope->decay_step + envelope->sustain_level ? envelope->sustain_level : envelope->attack_level); } From ec3096373109ad556ab4885c77fcbaa377a2e760 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 10:21:56 -0500 Subject: [PATCH 1012/1712] synthio: fix a -Warray-parameter diagnostic --- shared-module/synthio/Note.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index 87d32da031..9b72129834 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -229,7 +229,7 @@ STATIC int synthio_bend_value(synthio_note_obj_t *self, int16_t dur) { } } -uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, uint16_t *loudness) { +uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, uint16_t loudness[2]) { int tremolo_value = synthio_lfo_step(&self->tremolo_state, dur); loudness[0] = (((loudness[0] * tremolo_value) >> 15) * self->left_panning_scaled) >> 15; loudness[1] = (((loudness[1] * tremolo_value) >> 15) * self->right_panning_scaled) >> 15; From cbd02b74df786d60dd5e7d2e1f2a59a176c3bcba Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 10:22:51 -0500 Subject: [PATCH 1013/1712] synthio: endorse updated test result --- tests/circuitpython/synthesizer_note.py.exp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/circuitpython/synthesizer_note.py.exp b/tests/circuitpython/synthesizer_note.py.exp index bb34c0a6c3..e8a1f1e020 100644 --- a/tests/circuitpython/synthesizer_note.py.exp +++ b/tests/circuitpython/synthesizer_note.py.exp @@ -1,10 +1,10 @@ () [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -(Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None),) +(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None),) [-16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383] -(Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None), Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None)) +(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None), Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None)) [0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046] -(Note(frequency=830.6076004423605, amplitude=1.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None),) +(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None),) [0, 0, 0, 28045, 0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0] (-5242, 5242) (-10485, 10484) From cbfb2d0f55a59d025c186cb6bdfea8ce5a8afb6c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 11 May 2023 12:12:34 -0700 Subject: [PATCH 1014/1712] Add Pimoroni Inky Frame 5.7 Tweak DTCM and ITCM loading and prevent epd refresh while waiting for autoreload. --- main.c | 4 +- .../boards/pimoroni_inky_frame_5_7/board.c | 114 ++++++++++++++++++ .../boards/pimoroni_inky_frame_5_7/link.ld | 1 + .../pimoroni_inky_frame_5_7/mpconfigboard.h | 17 +++ .../pimoroni_inky_frame_5_7/mpconfigboard.mk | 26 ++++ .../pico-sdk-configboard.h | 1 + .../boards/pimoroni_inky_frame_5_7/pins.c | 52 ++++++++ ports/raspberrypi/supervisor/port.c | 17 +-- tools/cortex-m-fault-gdb.py | 6 +- 9 files changed, 224 insertions(+), 14 deletions(-) create mode 100644 ports/raspberrypi/boards/pimoroni_inky_frame_5_7/board.c create mode 100644 ports/raspberrypi/boards/pimoroni_inky_frame_5_7/link.ld create mode 100644 ports/raspberrypi/boards/pimoroni_inky_frame_5_7/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/pimoroni_inky_frame_5_7/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/pimoroni_inky_frame_5_7/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/pimoroni_inky_frame_5_7/pins.c diff --git a/main.c b/main.c index ae8c339172..122f079129 100644 --- a/main.c +++ b/main.c @@ -666,8 +666,10 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) { #endif { // Refresh the ePaper display if we have one. That way it'll show an error message. + // Skip if we're about to autoreload. Otherwise we may delay when user code can update + // the display. #if CIRCUITPY_DISPLAYIO - if (time_to_epaper_refresh > 0) { + if (time_to_epaper_refresh > 0 && !autoreload_pending()) { time_to_epaper_refresh = maybe_refresh_epaperdisplay(); } diff --git a/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/board.c b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/board.c new file mode 100644 index 0000000000..53fd01b75a --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/board.c @@ -0,0 +1,114 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "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-bindings/board/__init__.h" +#include "supervisor/shared/board.h" + +#define DELAY 0x80 + +// This is an SPD1656 control chip. The display is a 5.7" ACeP EInk. + +const uint8_t display_start_sequence[] = { + 0x01, 4, 0x37, 0x00, 0x23, 0x23, // power setting + 0x00, 2, 0xef, 0x08, // panel setting (PSR) + 0x03, 1, 0x00, // PFS + 0x06, 3, 0xc7, 0xc7, 0x1d, // booster + 0x30, 1, 0x3c, // PLL setting + 0x41, 1, 0x00, // TSE + 0x50, 1, 0x37, // vcom and data interval setting + 0x60, 1, 0x22, // tcon setting + 0x61, 4, 0x02, 0x58, 0x01, 0xc0, // tres + 0xe3, 1, 0xaa, // PWS + 0x04, DELAY | 0, 0xc8, // VCM DC and delay 200ms +}; + +const uint8_t display_stop_sequence[] = { + 0x02, 1, 0x00, // power off + 0x07, 1, 0xa5 // deep sleep +}; + +const uint8_t refresh_sequence[] = { + 0x12, 0x00 +}; + +void board_init(void) { + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = common_hal_board_create_spi(0); + + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_GPIO28, // EPD_DC Command or data + &pin_GPIO17, // EPD_CS Chip select + &pin_GPIO27, // EPD_RST Reset + 1000000, // Baudrate + 0, // Polarity + 0); // Phase + + displayio_epaperdisplay_obj_t *display = &allocate_display()->epaper_display; + display->base.type = &displayio_epaperdisplay_type; + common_hal_displayio_epaperdisplay_construct( + display, + bus, + display_start_sequence, sizeof(display_start_sequence), + 1.0, // start up time + display_stop_sequence, sizeof(display_stop_sequence), + 600, // width + 448, // height + 640, // ram_width + 480, // ram_height + 0, // colstart + 0, // rowstart + 180, // rotation + NO_COMMAND, // set_column_window_command + NO_COMMAND, // set_row_window_command + NO_COMMAND, // set_current_column_command + NO_COMMAND, // set_current_row_command + 0x10, // write_black_ram_command + false, // black_bits_inverted + NO_COMMAND, // write_color_ram_command + false, // color_bits_inverted + 0x000000, // highlight_color + refresh_sequence, sizeof(refresh_sequence), + 28.0, // refresh_time + NULL, // busy_pin + false, // busy_state + 30.0, // seconds_per_frame + false, // always_toggle_chip_select + false, // grayscale + true, // acep + false, // two_byte_sequence_length + false); // address_little_endian +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/link.ld b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/link.ld new file mode 100644 index 0000000000..e814bead4c --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/link.ld @@ -0,0 +1 @@ +firmware_size = 1532k; diff --git a/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/mpconfigboard.h b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/mpconfigboard.h new file mode 100644 index 0000000000..0817a6c594 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/mpconfigboard.h @@ -0,0 +1,17 @@ +#define MICROPY_HW_BOARD_NAME "Pimoroni Inky Frame 5.7" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1) +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO6) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO5) + +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO18) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO19) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO16) diff --git a/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/mpconfigboard.mk new file mode 100644 index 0000000000..40583e1b96 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/mpconfigboard.mk @@ -0,0 +1,26 @@ +USB_VID = 0x2E8A +USB_PID = 0x1018 +USB_PRODUCT = "Inky Frame 5.7" +USB_MANUFACTURER = "Pimoroni" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY__EVE = 1 + +CIRCUITPY_CYW43 = 1 +CIRCUITPY_SSL = 1 +CIRCUITPY_SSL_MBEDTLS = 1 +CIRCUITPY_HASHLIB = 1 +CIRCUITPY_WEB_WORKFLOW = 1 +CIRCUITPY_MDNS = 1 +CIRCUITPY_SOCKETPOOL = 1 +CIRCUITPY_WIFI = 1 + +CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 +# Must be accompanied by a linker script change +CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/pico-sdk-configboard.h b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/pins.c b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/pins.c new file mode 100644 index 0000000000..4496790c6c --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_inky_frame_5_7/pins.c @@ -0,0 +1,52 @@ +#include "shared-bindings/board/__init__.h" + +#include "supervisor/board.h" +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_HOLD_SYS_EN), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_I2C_INT), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_LED_ACT), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_LED_CONN), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_SWITCH_CLK), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_SWITCH_LATCH), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_SWITCH_OUT), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_LED_A), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_LED_C), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_LED_D), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_LED_E), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_INKY_CS), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_SCLK), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_SD_DAT1), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_SD_DAT2), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_INKY_RES), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_INKY_DC), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_CYW1) }, + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].epaper_display)}, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index e45fa8837a..08a9d96c2e 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -104,22 +104,23 @@ safe_mode_t port_init(void) { _binary_info(); // Set brown out. + // Load from the XIP memory space that doesn't cache. That way we don't + // evict anything else. The code we're loading is linked to the RAM address + // anyway. + size_t nocache = 0x03000000; + // Copy all of the "tightly coupled memory" code and data to run from RAM. // This lets us use the 16k cache for dynamically used data and code. // We must do this before we try and call any of its code or load the data. + uint32_t *itcm_flash_copy = (uint32_t *)(((size_t)&_ld_itcm_flash_copy) | nocache); for (uint32_t i = 0; i < ((size_t)&_ld_itcm_size) / 4; i++) { - (&_ld_itcm_destination)[i] = (&_ld_itcm_flash_copy)[i]; - // Now zero it out to evict the line from the XIP cache. Without this, - // it'll stay in the XIP cache anyway. - (&_ld_itcm_flash_copy)[i] = 0x0; + (&_ld_itcm_destination)[i] = itcm_flash_copy[i]; } // Copy all of the data to run from DTCM. + uint32_t *dtcm_flash_copy = (uint32_t *)(((size_t)&_ld_dtcm_data_flash_copy) | nocache); for (uint32_t i = 0; i < ((size_t)&_ld_dtcm_data_size) / 4; i++) { - (&_ld_dtcm_data_destination)[i] = (&_ld_dtcm_data_flash_copy)[i]; - // Now zero it out to evict the line from the XIP cache. Without this, - // it'll stay in the XIP cache anyway. - (&_ld_dtcm_data_flash_copy)[i] = 0x0; + (&_ld_dtcm_data_destination)[i] = dtcm_flash_copy[i]; } // Clear DTCM bss. diff --git a/tools/cortex-m-fault-gdb.py b/tools/cortex-m-fault-gdb.py index 54a921e91f..898630ab4e 100644 --- a/tools/cortex-m-fault-gdb.py +++ b/tools/cortex-m-fault-gdb.py @@ -45,12 +45,8 @@ class CortexMFault(gdb.Command): print("vtor", hex(vtor)) icsr = self._read(ICSR) - if (icsr & (1 << 23)) != 0: - print("No preempted exceptions") - else: - print("Another exception was preempted") vectactive = icsr & 0x1FF - print(hex(icsr), vectactive) + print("icsr", hex(icsr), vectactive) if vectactive != 0: if vectactive in EXCEPTIONS: vectactive = EXCEPTIONS[vectactive] From 23baf02399f02f9d4a9fecab2ec9cdc974aacee5 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 15:22:48 -0500 Subject: [PATCH 1015/1712] synthio: disable on a few boards where it doesn't fit --- ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk | 1 + ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk | 1 + ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk | 1 + 3 files changed, 3 insertions(+) diff --git a/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk index 2606572d8c..9a5008be85 100644 --- a/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk @@ -11,3 +11,4 @@ EXTERNAL_FLASH_DEVICES = GD25Q16C LONGINT_IMPL = MPZ CIRCUITPY__EVE = 1 +CIRCUITPY_SYNTHIO = 0 diff --git a/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk index 1e63476596..ed1cd2455c 100644 --- a/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk +++ b/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk @@ -11,3 +11,4 @@ EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C" LONGINT_IMPL = MPZ CIRCUITPY__EVE = 1 +CIRCUITPY_SYNTHIO = 0 diff --git a/ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk index 553bf14f2e..50780cff07 100644 --- a/ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk @@ -11,3 +11,4 @@ EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C" LONGINT_IMPL = MPZ CIRCUITPY__EVE = 1 +CIRCUITPY_SYNTHIO = 0 From 17df23814579c1557f4c00b58923d2fe2d906b2b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 15:23:54 -0500 Subject: [PATCH 1016/1712] synthio: doc fixes, rename BendType to BendMode --- shared-bindings/synthio/Note.c | 6 +++--- shared-bindings/synthio/__init__.c | 13 +++++++++---- tests/circuitpython-manual/synthio/note/code.py | 2 +- tests/circuitpython-manual/synthio/note/noise.py | 2 +- tests/circuitpython/synthesizer_note.py.exp | 6 +++--- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index b12e015378..dbf0f44495 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -59,7 +59,7 @@ static const mp_arg_t note_properties[] = { //| tremolo_rate: float = 0.0, //| bend_depth: float = 0.0, //| bend_rate: float = 0.0, -//| bend_mode: BendMode = BendMode.VIBRATO, +//| bend_mode: "BendMode" = BendMode.VIBRATO, //| ) -> None: //| """Construct a Note object, with a frequency in Hz, and optional panning, waveform, envelope, tremolo (volume change) and bend (frequency change). //| @@ -270,7 +270,7 @@ MP_PROPERTY_GETSET(synthio_note_envelope_obj, //| ring_frequency: float //| """The ring frequency of the note, in Hz. Zero disables. //| -//| For ring to take effect, both ring_frequency and ring_wavefor must be set.""" +//| For ring to take effect, both ``ring_frequency`` and ``ring_waveform`` must be set.""" STATIC mp_obj_t synthio_note_get_ring_frequency(mp_obj_t self_in) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_float(common_hal_synthio_note_get_ring_frequency(self)); @@ -290,7 +290,7 @@ MP_PROPERTY_GETSET(synthio_note_ring_frequency_obj, //| ring_waveform: Optional[ReadableBuffer] //| """The ring waveform of this note. Setting the ring_waveform to a buffer of a different size resets the note's phase. //| -//| For ring to take effect, both ring_frequency and ring_wavefor must be set.""" +//| For ring to take effect, both ``ring_frequency`` and ``ring_waveform`` must be set.""" //| STATIC mp_obj_t synthio_note_get_ring_waveform(mp_obj_t self_in) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index de1366717c..87591c564e 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -289,36 +289,41 @@ MP_DEFINE_CONST_FUN_OBJ_1(synthio_onevo_to_hz_obj, onevo_to_hz); MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, STATIC, SYNTHIO_BEND_MODE_STATIC); MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, VIBRATO, SYNTHIO_BEND_MODE_VIBRATO); MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, SWEEP, SYNTHIO_BEND_MODE_SWEEP); +MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, SWEEP_IN, SYNTHIO_BEND_MODE_SWEEP_IN); //| -//| class BendType: +//| class BendMode: //| """Controls the way the ``Note.pitch_bend_depth`` and ``Note.pitch_bend_rate`` properties are interpreted.""" //| //| STATIC: object //| """The Note's pitch is modified by its ``pitch_bend_depth``. ``pitch_bend_rate`` is ignored.""" //| //| VIBRATO: object -//| """The Note's pitch varies by ``±pitch_bend_depth` at a rate of ``pitch_bend_rate``Hz.""" +//| """The Note's pitch varies by ``±pitch_bend_depth`` at a rate of ``pitch_bend_rate`` Hz.""" //| //| SWEEP: object //| """The Note's pitch starts at ``Note.frequency`` then sweeps up or down by ``pitch_bend_depth`` over ``1/pitch_bend_rate`` seconds.""" //| +//| SWEEP_IN: object +//| """The Note's pitch sweep is the reverse of ``SWEEP`` mode, starting at the bent pitch and arriving at the tuned pitch.""" +//| MAKE_ENUM_MAP(synthio_bend_mode) { MAKE_ENUM_MAP_ENTRY(bend_mode, STATIC), MAKE_ENUM_MAP_ENTRY(bend_mode, VIBRATO), MAKE_ENUM_MAP_ENTRY(bend_mode, SWEEP), + MAKE_ENUM_MAP_ENTRY(bend_mode, SWEEP_IN), }; STATIC MP_DEFINE_CONST_DICT(synthio_bend_mode_locals_dict, synthio_bend_mode_locals_table); MAKE_PRINTER(synthio, synthio_bend_mode); -MAKE_ENUM_TYPE(synthio, BendType, synthio_bend_mode); +MAKE_ENUM_TYPE(synthio, BendMode, synthio_bend_mode); STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_synthio) }, - { MP_ROM_QSTR(MP_QSTR_BendType), MP_ROM_PTR(&synthio_bend_mode_type) }, + { MP_ROM_QSTR(MP_QSTR_BendMode), MP_ROM_PTR(&synthio_bend_mode_type) }, { MP_ROM_QSTR(MP_QSTR_MidiTrack), MP_ROM_PTR(&synthio_miditrack_type) }, { MP_ROM_QSTR(MP_QSTR_Note), MP_ROM_PTR(&synthio_note_type) }, { MP_ROM_QSTR(MP_QSTR_Synthesizer), MP_ROM_PTR(&synthio_synthesizer_type) }, diff --git a/tests/circuitpython-manual/synthio/note/code.py b/tests/circuitpython-manual/synthio/note/code.py index 6a6a9556dc..43f5dfb8a5 100644 --- a/tests/circuitpython-manual/synthio/note/code.py +++ b/tests/circuitpython-manual/synthio/note/code.py @@ -116,7 +116,7 @@ def synthesize6(synth): tremolo_rate=1.5, bend_depth=-5 / 12, bend_rate=1 / 2, - bend_mode=synthio.BendType.SWEEP, + bend_mode=synthio.BendMode.SWEEP, waveform=sine, envelope=envelope, ) diff --git a/tests/circuitpython-manual/synthio/note/noise.py b/tests/circuitpython-manual/synthio/note/noise.py index 53257966cb..b31658b818 100644 --- a/tests/circuitpython-manual/synthio/note/noise.py +++ b/tests/circuitpython-manual/synthio/note/noise.py @@ -37,7 +37,7 @@ def synthesize(synth): frequency=synthio.midi_to_hz(1 + i), waveform=noise, envelope=envelope, - bend_mode=synthio.BendType.SWEEP, + bend_mode=synthio.BendMode.SWEEP, bend_depth=random.choice((-1, 1)), bend_rate=randf(4, 12), ) diff --git a/tests/circuitpython/synthesizer_note.py.exp b/tests/circuitpython/synthesizer_note.py.exp index e8a1f1e020..8c224982a2 100644 --- a/tests/circuitpython/synthesizer_note.py.exp +++ b/tests/circuitpython/synthesizer_note.py.exp @@ -1,10 +1,10 @@ () [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None),) +(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None),) [-16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383] -(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None), Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None)) +(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None), Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None)) [0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046] -(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendType.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None),) +(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None),) [0, 0, 0, 28045, 0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0] (-5242, 5242) (-10485, 10484) From d99b0634f77d2747190475b780ce315d02d04adb Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 11 May 2023 16:57:07 -0400 Subject: [PATCH 1017/1712] Report SPI frequency accurately on Espressif --- ports/espressif/common-hal/busio/SPI.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ports/espressif/common-hal/busio/SPI.c b/ports/espressif/common-hal/busio/SPI.c index da9170a5b0..5218fdbf9d 100644 --- a/ports/espressif/common-hal/busio/SPI.c +++ b/ports/espressif/common-hal/busio/SPI.c @@ -56,8 +56,10 @@ void spi_reset(void) { static void set_spi_config(busio_spi_obj_t *self, uint32_t baudrate, uint8_t polarity, uint8_t phase, uint8_t bits) { + // 128 is a 50% duty cycle. + const int closest_clock = spi_get_actual_clock(APB_CLK_FREQ, baudrate, 128); const spi_device_interface_config_t device_config = { - .clock_speed_hz = baudrate, + .clock_speed_hz = closest_clock, .mode = phase | (polarity << 1), .spics_io_num = -1, // No CS pin .queue_size = MAX_SPI_TRANSACTIONS, @@ -67,7 +69,7 @@ static void set_spi_config(busio_spi_obj_t *self, if (result != ESP_OK) { mp_raise_RuntimeError(translate("SPI configuration failed")); } - self->baudrate = baudrate; + self->baudrate = closest_clock; self->polarity = polarity; self->phase = phase; self->bits = bits; From 9c45551880ed2333f033c7cef8184d7c572e612b Mon Sep 17 00:00:00 2001 From: Ted Hess Date: Thu, 11 May 2023 12:33:01 -0400 Subject: [PATCH 1018/1712] Do not enable web_workflow background callbacks if wifi is not enabled/connected --- supervisor/shared/web_workflow/web_workflow.c | 11 +++++----- supervisor/shared/web_workflow/web_workflow.h | 2 +- supervisor/shared/workflow.c | 21 +++++++++++++------ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index 648af72ccb..3e61eee360 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -258,7 +258,7 @@ void supervisor_web_workflow_status(void) { } #endif -void supervisor_start_web_workflow(void) { +bool supervisor_start_web_workflow(void) { #if CIRCUITPY_WEB_WORKFLOW && CIRCUITPY_WIFI && CIRCUITPY_OS_GETENV // Skip starting the workflow if we're not starting from power on or reset. @@ -268,7 +268,7 @@ void supervisor_start_web_workflow(void) { reset_reason != RESET_REASON_DEEP_SLEEP_ALARM && reset_reason != RESET_REASON_UNKNOWN && reset_reason != RESET_REASON_SOFTWARE) { - return; + return false; } char ssid[33]; @@ -276,7 +276,7 @@ void supervisor_start_web_workflow(void) { os_getenv_err_t result = common_hal_os_getenv_str("CIRCUITPY_WIFI_SSID", ssid, sizeof(ssid)); if (result != GETENV_OK) { - return; + return false; } result = common_hal_os_getenv_str("CIRCUITPY_WIFI_PASSWORD", password, sizeof(password)); @@ -284,7 +284,7 @@ void supervisor_start_web_workflow(void) { // if password is unspecified, assume an open network password[0] = '\0'; } else if (result != GETENV_OK) { - return; + return false; } result = common_hal_os_getenv_str("CIRCUITPY_WEB_INSTANCE_NAME", web_instance_name, sizeof(web_instance_name)); @@ -309,7 +309,7 @@ void supervisor_start_web_workflow(void) { if (_wifi_status != WIFI_RADIO_ERROR_NONE) { common_hal_wifi_radio_set_enabled(&common_hal_wifi_radio_obj, false); - return; + return false; } // (leaves new_port unchanged on any failure) @@ -363,6 +363,7 @@ void supervisor_start_web_workflow(void) { // Wake polling thread (maybe) socketpool_socket_poll_resume(); #endif + return true; } void web_workflow_send_raw(socketpool_socket_obj_t *socket, const uint8_t *buf, int len) { diff --git a/supervisor/shared/web_workflow/web_workflow.h b/supervisor/shared/web_workflow/web_workflow.h index 85205b04d6..c325c0ff5d 100644 --- a/supervisor/shared/web_workflow/web_workflow.h +++ b/supervisor/shared/web_workflow/web_workflow.h @@ -36,7 +36,7 @@ void supervisor_web_workflow_background(void *data); bool supervisor_web_workflow_status_dirty(void); void supervisor_web_workflow_status(void); -void supervisor_start_web_workflow(void); +bool supervisor_start_web_workflow(void); void supervisor_stop_web_workflow(void); // Share the MDNS object with user code. diff --git a/supervisor/shared/workflow.c b/supervisor/shared/workflow.c index 64f1021df2..aebdcc821a 100644 --- a/supervisor/shared/workflow.c +++ b/supervisor/shared/workflow.c @@ -45,8 +45,9 @@ #if CIRCUITPY_WEB_WORKFLOW #include "supervisor/shared/web_workflow/web_workflow.h" -#endif static background_callback_t workflow_background_cb = {NULL, NULL}; +#endif + // Called during a VM reset. Doesn't actually reset things. void supervisor_workflow_reset(void) { @@ -56,17 +57,23 @@ void supervisor_workflow_reset(void) { #if CIRCUITPY_WEB_WORKFLOW if (workflow_background_cb.fun) { - supervisor_start_web_workflow(); - supervisor_workflow_request_background(); + if (supervisor_start_web_workflow()) { + supervisor_workflow_request_background(); + } } #endif } void supervisor_workflow_request_background(void) { + #if CIRCUITPY_WEB_WORKFLOW if (workflow_background_cb.fun) { workflow_background_cb.data = NULL; background_callback_add_core(&workflow_background_cb); + } else { + // Unblock polling thread if necessary + socketpool_socket_poll_resume(); } + #endif } // Return true if host has completed connection to us (such as USB enumeration). @@ -98,9 +105,11 @@ void supervisor_workflow_start(void) { #endif #if CIRCUITPY_WEB_WORKFLOW - supervisor_start_web_workflow(); - memset(&workflow_background_cb, 0, sizeof(workflow_background_cb)); - workflow_background_cb.fun = supervisor_web_workflow_background; + if (supervisor_start_web_workflow()) { + // Enable background callbacks if web_workflow startup successful + memset(&workflow_background_cb, 0, sizeof(workflow_background_cb)); + workflow_background_cb.fun = supervisor_web_workflow_background; + } #endif } From 53e13f15a3f4a0466be84dbffabdf82bd1ee37ac Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 16:53:40 -0500 Subject: [PATCH 1019/1712] synthio: Finish ading SWEEP_IN --- shared-bindings/synthio/__init__.h | 2 +- shared-module/synthio/Note.c | 2 ++ shared-module/synthio/__init__.c | 26 ++++++++++++++++++-------- shared-module/synthio/__init__.h | 1 + 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/shared-bindings/synthio/__init__.h b/shared-bindings/synthio/__init__.h index d09fab815e..6f3aed0124 100644 --- a/shared-bindings/synthio/__init__.h +++ b/shared-bindings/synthio/__init__.h @@ -30,7 +30,7 @@ #include "py/enum.h" typedef enum synthio_bend_mode_e { - SYNTHIO_BEND_MODE_STATIC, SYNTHIO_BEND_MODE_VIBRATO, SYNTHIO_BEND_MODE_SWEEP + SYNTHIO_BEND_MODE_STATIC, SYNTHIO_BEND_MODE_VIBRATO, SYNTHIO_BEND_MODE_SWEEP, SYNTHIO_BEND_MODE_SWEEP_IN } synthio_bend_mode_t; extern const cp_enum_obj_t bend_mode_VIBRATO_obj; diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index 9b72129834..89de8bce16 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -224,6 +224,8 @@ STATIC int synthio_bend_value(synthio_note_obj_t *self, int16_t dur) { return synthio_lfo_step(&self->bend_state, dur); case SYNTHIO_BEND_MODE_SWEEP: return synthio_sweep_step(&self->bend_state, dur); + case SYNTHIO_BEND_MODE_SWEEP_IN: + return synthio_sweep_in_step(&self->bend_state, dur); default: return 32768; } diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 2bca3db439..36ca709541 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -480,25 +480,35 @@ void synthio_lfo_set(synthio_lfo_state_t *state, const synthio_lfo_descr_t *desc state->dds = synthio_frequency_convert_float_to_dds(descr->frequency * 65536, sample_rate); } -int synthio_sweep_step(synthio_lfo_state_t *state, uint16_t dur) { +STATIC int synthio_lfo_step_common(synthio_lfo_state_t *state, uint16_t dur) { uint32_t phase = state->phase; uint16_t whole_phase = phase >> 16; // advance the phase accumulator state->phase = phase + state->dds * dur; - if (state->phase < phase) { + + return whole_phase; +} +STATIC int synthio_lfo_sweep_common(synthio_lfo_state_t *state, uint16_t dur) { + uint16_t whole_phase = synthio_lfo_step_common(state, dur); + if (state->phase < state->dds) { state->phase = 0xffffffff; } + return whole_phase; +} + +int synthio_sweep_step(synthio_lfo_state_t *state, uint16_t dur) { + uint16_t whole_phase = synthio_lfo_sweep_common(state, dur); + return (state->amplitude_scaled * whole_phase) / 65536 + state->offset_scaled; +} + +int synthio_sweep_in_step(synthio_lfo_state_t *state, uint16_t dur) { + uint16_t whole_phase = 65535 - synthio_lfo_sweep_common(state, dur); return (state->amplitude_scaled * whole_phase) / 65536 + state->offset_scaled; } int synthio_lfo_step(synthio_lfo_state_t *state, uint16_t dur) { - uint32_t phase = state->phase; - uint16_t whole_phase = phase >> 16; - - // advance the phase accumulator - state->phase = phase + state->dds * dur; - + uint16_t whole_phase = synthio_lfo_step_common(state, dur); // create a triangle wave, it's quick and easy int v; if (whole_phase < 16384) { // ramp from 0 to amplitude diff --git a/shared-module/synthio/__init__.h b/shared-module/synthio/__init__.h index 895b0cae5b..c68fb00f97 100644 --- a/shared-module/synthio/__init__.h +++ b/shared-module/synthio/__init__.h @@ -111,3 +111,4 @@ uint32_t synthio_frequency_convert_scaled_to_dds(uint64_t frequency_scaled, int3 void synthio_lfo_set(synthio_lfo_state_t *state, const synthio_lfo_descr_t *descr, uint32_t sample_rate); int synthio_lfo_step(synthio_lfo_state_t *state, uint16_t dur); int synthio_sweep_step(synthio_lfo_state_t *state, uint16_t dur); +int synthio_sweep_in_step(synthio_lfo_state_t *state, uint16_t dur); From a56174dc101236f6c869c43df24a06cd00a24fa8 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 11 May 2023 15:02:56 -0700 Subject: [PATCH 1020/1712] Correct pad count. This prevents running into the pins that cannot be reset. On 1011 it was off by one pin that isn't attached to the package. So, having the USB pins forbidden prevented resetting to a NULL address. Fixes #7952 --- ports/mimxrt10xx/boards/imxrt1010_evk/board.c | 3 --- ports/mimxrt10xx/boards/imxrt1015_evk/board.c | 3 --- ports/mimxrt10xx/boards/imxrt1020_evk/board.c | 4 ---- ports/mimxrt10xx/boards/imxrt1040_evk/board.c | 3 --- ports/mimxrt10xx/boards/imxrt1050_evkb/board.c | 4 ++-- ports/mimxrt10xx/boards/imxrt1060_evk/board.c | 4 ++-- ports/mimxrt10xx/common-hal/microcontroller/Pin.c | 13 +++++++++---- .../peripherals/mimxrt10xx/MIMXRT1011/pins.h | 4 +++- .../peripherals/mimxrt10xx/MIMXRT1015/pins.h | 4 +++- .../peripherals/mimxrt10xx/MIMXRT1021/pins.h | 4 +++- .../peripherals/mimxrt10xx/MIMXRT1042/pins.h | 4 +++- .../peripherals/mimxrt10xx/MIMXRT1052/pins.h | 4 +++- .../peripherals/mimxrt10xx/MIMXRT1062/pins.h | 4 +++- .../peripherals/mimxrt10xx/MIMXRT1176/pins.h | 4 +++- ports/mimxrt10xx/tools/gen_peripherals_data.py | 6 +++++- 15 files changed, 39 insertions(+), 29 deletions(-) diff --git a/ports/mimxrt10xx/boards/imxrt1010_evk/board.c b/ports/mimxrt10xx/boards/imxrt1010_evk/board.c index c5237c8a8e..9c7f4a256f 100644 --- a/ports/mimxrt10xx/boards/imxrt1010_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1010_evk/board.c @@ -41,9 +41,6 @@ const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { &pin_GPIO_SD_08, &pin_GPIO_SD_07, &pin_GPIO_SD_06, - // USB Pins - &pin_USB_OTG1_DN, - &pin_USB_OTG1_DP, NULL, // Must end in NULL. }; diff --git a/ports/mimxrt10xx/boards/imxrt1015_evk/board.c b/ports/mimxrt10xx/boards/imxrt1015_evk/board.c index 568945a3eb..06b3dd22d5 100644 --- a/ports/mimxrt10xx/boards/imxrt1015_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1015_evk/board.c @@ -40,9 +40,6 @@ const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { &pin_GPIO_SD_B1_09, &pin_GPIO_SD_B1_10, &pin_GPIO_SD_B1_11, - // USB Pins - &pin_USB_OTG1_DN, - &pin_USB_OTG1_DP, NULL, // Must end in NULL. }; diff --git a/ports/mimxrt10xx/boards/imxrt1020_evk/board.c b/ports/mimxrt10xx/boards/imxrt1020_evk/board.c index f814afd956..540e416525 100644 --- a/ports/mimxrt10xx/boards/imxrt1020_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1020_evk/board.c @@ -42,10 +42,6 @@ const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { &pin_GPIO_SD_B1_09, &pin_GPIO_SD_B1_10, &pin_GPIO_SD_B1_11, - - // USB Pins - &pin_USB_OTG1_DN, - &pin_USB_OTG1_DP, NULL, // Must end in NULL. }; diff --git a/ports/mimxrt10xx/boards/imxrt1040_evk/board.c b/ports/mimxrt10xx/boards/imxrt1040_evk/board.c index 0e97d87b60..6ab54be8a6 100644 --- a/ports/mimxrt10xx/boards/imxrt1040_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1040_evk/board.c @@ -44,9 +44,6 @@ const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { &pin_GPIO_SD_B1_10, &pin_GPIO_SD_B1_11, - &pin_USB_OTG1_DN, - &pin_USB_OTG1_DP, - NULL, // Must end in NULL. }; diff --git a/ports/mimxrt10xx/boards/imxrt1050_evkb/board.c b/ports/mimxrt10xx/boards/imxrt1050_evkb/board.c index 8a34fc4210..6e31888c53 100644 --- a/ports/mimxrt10xx/boards/imxrt1050_evkb/board.c +++ b/ports/mimxrt10xx/boards/imxrt1050_evkb/board.c @@ -45,8 +45,8 @@ const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { &pin_GPIO_SD_B1_11, // USB Pins - &pin_GPIO_AD_B0_01, - &pin_GPIO_AD_B0_03, + &pin_GPIO_AD_B0_01, // ID Pin + &pin_GPIO_AD_B0_03, // OC/Fault Pin NULL, // Must end in NULL. }; diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/board.c b/ports/mimxrt10xx/boards/imxrt1060_evk/board.c index f27f549c64..4a2e6e0913 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/board.c @@ -50,8 +50,8 @@ const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { &pin_GPIO_SD_B1_11, // USB Pins - &pin_GPIO_AD_B0_01, - &pin_GPIO_AD_B0_03, + &pin_GPIO_AD_B0_01, // ID Pin + &pin_GPIO_AD_B0_03, // OC/Fault Pin NULL, // Must end in NULL. }; diff --git a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c index 9f9e306dd9..2cd53e9560 100644 --- a/ports/mimxrt10xx/common-hal/microcontroller/Pin.c +++ b/ports/mimxrt10xx/common-hal/microcontroller/Pin.c @@ -31,8 +31,8 @@ #include "py/gc.h" -STATIC bool claimed_pins[IOMUXC_SW_PAD_CTL_PAD_COUNT]; -STATIC bool never_reset_pins[IOMUXC_SW_PAD_CTL_PAD_COUNT]; +STATIC bool claimed_pins[PAD_COUNT]; +STATIC bool never_reset_pins[PAD_COUNT]; // Default is that no pins are forbidden to reset. MP_WEAK const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { @@ -55,10 +55,10 @@ STATIC bool _reset_forbidden(const mcu_pin_obj_t *pin) { // and GPIO port and number, used to store claimed and reset tagging. The two number // systems are not related and one cannot determine the other without a pin object void reset_all_pins(void) { - for (uint8_t i = 0; i < IOMUXC_SW_PAD_CTL_PAD_COUNT; i++) { + for (uint8_t i = 0; i < PAD_COUNT; i++) { claimed_pins[i] = never_reset_pins[i]; } - for (uint8_t i = 0; i < IOMUXC_SW_PAD_CTL_PAD_COUNT; i++) { + for (uint8_t i = 0; i < PAD_COUNT; i++) { mcu_pin_obj_t *pin = mcu_pin_globals.map.table[i].value; if (never_reset_pins[pin->mux_idx]) { continue; @@ -90,6 +90,11 @@ void common_hal_reset_pin(const mcu_pin_obj_t *pin) { disable_pin_change_interrupt(pin); never_reset_pins[pin->mux_idx] = false; claimed_pins[pin->mux_idx] = false; + + // This should never be true, but protect against it anyway. + if (pin->mux_reg == 0) { + return; + } *(uint32_t *)pin->mux_reg = pin->mux_reset; *(uint32_t *)pin->cfg_reg = pin->pad_reset; } diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h index 8e901f0980..2b63b84ecb 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/pins.h @@ -40,5 +40,7 @@ #include "pin_names.h" #undef FORMAT_PIN -#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 2) +// Pads can be reset. Other pins like USB cannot be. +#define PAD_COUNT (43) +#define PIN_COUNT (PAD_COUNT + 2) extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.h index 8655bf872f..9c66fc82f3 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/pins.h @@ -40,5 +40,7 @@ #include "pin_names.h" #undef FORMAT_PIN -#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 2) +// Pads can be reset. Other pins like USB cannot be. +#define PAD_COUNT (56) +#define PIN_COUNT (PAD_COUNT + 2) extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h index b4f991a879..5d4f992e89 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.h @@ -40,5 +40,7 @@ #include "pin_names.h" #undef FORMAT_PIN -#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 2) +// Pads can be reset. Other pins like USB cannot be. +#define PAD_COUNT (93) +#define PIN_COUNT (PAD_COUNT + 2) extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.h index f666962907..c62c0ecaa0 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/pins.h @@ -40,5 +40,7 @@ #include "pin_names.h" #undef FORMAT_PIN -#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 2) +// Pads can be reset. Other pins like USB cannot be. +#define PAD_COUNT (112) +#define PIN_COUNT (PAD_COUNT + 2) extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.h index 4ee8d2ae28..e02f1208bd 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/pins.h @@ -40,5 +40,7 @@ #include "pin_names.h" #undef FORMAT_PIN -#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 4) +// Pads can be reset. Other pins like USB cannot be. +#define PAD_COUNT (124) +#define PIN_COUNT (PAD_COUNT + 4) extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h index 6f746f3b4c..135d9f9565 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/pins.h @@ -40,5 +40,7 @@ #include "pin_names.h" #undef FORMAT_PIN -#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 4) +// Pads can be reset. Other pins like USB cannot be. +#define PAD_COUNT (124) +#define PIN_COUNT (PAD_COUNT + 4) extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.h index 35be6dd36e..786b0a248c 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/pins.h @@ -40,5 +40,7 @@ #include "pin_names.h" #undef FORMAT_PIN -#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + 0) +// Pads can be reset. Other pins like USB cannot be. +#define PAD_COUNT (145) +#define PIN_COUNT (PAD_COUNT + 0) extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT]; diff --git a/ports/mimxrt10xx/tools/gen_peripherals_data.py b/ports/mimxrt10xx/tools/gen_peripherals_data.py index 4193ae7228..d87e9022b2 100644 --- a/ports/mimxrt10xx/tools/gen_peripherals_data.py +++ b/ports/mimxrt10xx/tools/gen_peripherals_data.py @@ -190,6 +190,7 @@ for device in devices: split_pin = name.split("_") pin_name = "_".join(split_pin[4:]) if pin_name not in all_pins: + print("skip", pin_name) continue gpio_base = "_".join(split_pin[4:-1]) @@ -278,7 +279,10 @@ for device in devices: pins_c.append("") pins_h.append("") - pins_h.append(f"#define PIN_COUNT (IOMUXC_SW_PAD_CTL_PAD_COUNT + {len(usb_pins)})") + + pins_h.append("// Pads can be reset. Other pins like USB cannot be.") + pins_h.append(f"#define PAD_COUNT ({pin_number})") + pins_h.append(f"#define PIN_COUNT (PAD_COUNT + {len(usb_pins)})") pins_h.append(f"extern const mcu_pin_obj_t mcu_pin_list[PIN_COUNT];") pins_h.append("") From d3eda0ad5299c4f26beafd2c683cba13f1e34d1a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 17:32:42 -0500 Subject: [PATCH 1021/1712] synthio: fix a typing error --- shared-bindings/synthio/__init__.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 87591c564e..f776dab251 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -295,16 +295,16 @@ MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, SWEEP_IN, SYNTHIO_BEND_MODE_S //| class BendMode: //| """Controls the way the ``Note.pitch_bend_depth`` and ``Note.pitch_bend_rate`` properties are interpreted.""" //| -//| STATIC: object +//| STATIC: "BendMode" //| """The Note's pitch is modified by its ``pitch_bend_depth``. ``pitch_bend_rate`` is ignored.""" //| -//| VIBRATO: object +//| VIBRATO: "BendMode" //| """The Note's pitch varies by ``±pitch_bend_depth`` at a rate of ``pitch_bend_rate`` Hz.""" //| -//| SWEEP: object +//| SWEEP: "BendMode" //| """The Note's pitch starts at ``Note.frequency`` then sweeps up or down by ``pitch_bend_depth`` over ``1/pitch_bend_rate`` seconds.""" //| -//| SWEEP_IN: object +//| SWEEP_IN: "BendMode" //| """The Note's pitch sweep is the reverse of ``SWEEP`` mode, starting at the bent pitch and arriving at the tuned pitch.""" //| MAKE_ENUM_MAP(synthio_bend_mode) { From 33fb771b76bfbc2897fb0677d3c6271446329d64 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 17:56:11 -0500 Subject: [PATCH 1022/1712] synthio: Add `filter` argument to Synthesizer constructor as step 1/n of adding FIR filtering --- shared-bindings/synthio/MidiTrack.c | 7 ++----- shared-bindings/synthio/MidiTrack.h | 5 ++--- shared-bindings/synthio/Synthesizer.c | 11 +++++------ shared-bindings/synthio/Synthesizer.h | 4 ++-- shared-bindings/synthio/__init__.c | 7 ++----- shared-module/synthio/MidiTrack.c | 5 ++--- shared-module/synthio/Synthesizer.c | 6 +++--- shared-module/synthio/__init__.c | 20 ++++++++++++-------- shared-module/synthio/__init__.h | 7 ++++--- 9 files changed, 34 insertions(+), 38 deletions(-) diff --git a/shared-bindings/synthio/MidiTrack.c b/shared-bindings/synthio/MidiTrack.c index 31d8cbc7f0..2d0d2ab69f 100644 --- a/shared-bindings/synthio/MidiTrack.c +++ b/shared-bindings/synthio/MidiTrack.c @@ -88,9 +88,6 @@ STATIC mp_obj_t synthio_miditrack_make_new(const mp_obj_type_t *type, size_t n_a mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); - mp_buffer_info_t bufinfo_waveform; - synthio_synth_parse_waveform(&bufinfo_waveform, args[ARG_waveform].u_obj); - synthio_miditrack_obj_t *self = m_new_obj(synthio_miditrack_obj_t); self->base.type = &synthio_miditrack_type; @@ -98,8 +95,8 @@ STATIC mp_obj_t synthio_miditrack_make_new(const mp_obj_type_t *type, size_t n_a (uint8_t *)bufinfo.buf, bufinfo.len, args[ARG_tempo].u_int, args[ARG_sample_rate].u_int, - bufinfo_waveform.buf, - bufinfo_waveform.len / 2, + args[ARG_waveform].u_obj, + mp_const_none, args[ARG_envelope].u_obj ); diff --git a/shared-bindings/synthio/MidiTrack.h b/shared-bindings/synthio/MidiTrack.h index 1a76ed36f4..5c6bce46cd 100644 --- a/shared-bindings/synthio/MidiTrack.h +++ b/shared-bindings/synthio/MidiTrack.h @@ -27,12 +27,11 @@ #pragma once #include "shared-module/synthio/MidiTrack.h" +#include "py/obj.h" extern const mp_obj_type_t synthio_miditrack_type; -void common_hal_synthio_miditrack_construct(synthio_miditrack_obj_t *self, - const uint8_t *buffer, uint32_t len, uint32_t tempo, uint32_t sample_rate, const int16_t *waveform, uint16_t waveform_len, - mp_obj_t envelope); +void common_hal_synthio_miditrack_construct(synthio_miditrack_obj_t *self, const uint8_t *buffer, uint32_t len, uint32_t tempo, uint32_t sample_rate, mp_obj_t waveform_obj, mp_obj_t filter_obj, mp_obj_t envelope_obj); void common_hal_synthio_miditrack_deinit(synthio_miditrack_obj_t *self); bool common_hal_synthio_miditrack_deinited(synthio_miditrack_obj_t *self); diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index e7e442d90f..67707a763d 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -59,30 +59,29 @@ //| :param int sample_rate: The desired playback sample rate; higher sample rate requires more memory //| :param int channel_count: The number of output channels (1=mono, 2=stereo) //| :param ReadableBuffer waveform: A single-cycle waveform. Default is a 50% duty cycle square wave. If specified, must be a ReadableBuffer of type 'h' (signed 16 bit) +//| :param ReadableBuffer filter: Coefficients of an FIR filter to apply to notes with ``filter=True``. If specified, must be a ReadableBuffer of type 'h' (signed 16 bit) //| :param Optional[Envelope] envelope: An object that defines the loudness of a note over time. The default envelope, `None` provides no ramping, voices turn instantly on and off. //| """ STATIC mp_obj_t synthio_synthesizer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_sample_rate, ARG_channel_count, ARG_waveform, ARG_envelope }; + enum { ARG_sample_rate, ARG_channel_count, ARG_waveform, ARG_envelope, ARG_filter }; static const mp_arg_t allowed_args[] = { { MP_QSTR_sample_rate, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 11025} }, { MP_QSTR_channel_count, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} }, { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, { MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, + { MP_QSTR_filter, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - mp_buffer_info_t bufinfo_waveform; - synthio_synth_parse_waveform(&bufinfo_waveform, args[ARG_waveform].u_obj); - synthio_synthesizer_obj_t *self = m_new_obj(synthio_synthesizer_obj_t); self->base.type = &synthio_synthesizer_type; common_hal_synthio_synthesizer_construct(self, args[ARG_sample_rate].u_int, args[ARG_channel_count].u_int, - bufinfo_waveform.buf, - bufinfo_waveform.len / 2, + args[ARG_waveform].u_obj, + args[ARG_filter].u_obj, args[ARG_envelope].u_obj); return MP_OBJ_FROM_PTR(self); diff --git a/shared-bindings/synthio/Synthesizer.h b/shared-bindings/synthio/Synthesizer.h index 4568dafdaf..d8000681b8 100644 --- a/shared-bindings/synthio/Synthesizer.h +++ b/shared-bindings/synthio/Synthesizer.h @@ -32,8 +32,8 @@ extern const mp_obj_type_t synthio_synthesizer_type; void common_hal_synthio_synthesizer_construct(synthio_synthesizer_obj_t *self, - uint32_t sample_rate, int channel_count, const int16_t *waveform, uint16_t waveform_length, - mp_obj_t envelope); + uint32_t sample_rate, int channel_count, mp_obj_t waveform_obj, mp_obj_t filter_obj, + mp_obj_t envelope_obj); void common_hal_synthio_synthesizer_deinit(synthio_synthesizer_obj_t *self); bool common_hal_synthio_synthesizer_deinited(synthio_synthesizer_obj_t *self); uint32_t common_hal_synthio_synthesizer_get_sample_rate(synthio_synthesizer_obj_t *self); diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index f776dab251..132b254942 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -207,10 +207,6 @@ STATIC mp_obj_t synthio_from_file(size_t n_args, const mp_obj_t *pos_args, mp_ma } pyb_file_obj_t *file = MP_OBJ_TO_PTR(args[ARG_file].u_obj); - - mp_buffer_info_t bufinfo_waveform; - synthio_synth_parse_waveform(&bufinfo_waveform, args[ARG_waveform].u_obj); - uint8_t chunk_header[14]; f_rewind(&file->fp); UINT bytes_read; @@ -250,7 +246,8 @@ STATIC mp_obj_t synthio_from_file(size_t n_args, const mp_obj_t *pos_args, mp_ma result->base.type = &synthio_miditrack_type; common_hal_synthio_miditrack_construct(result, buffer, track_size, - tempo, args[ARG_sample_rate].u_int, bufinfo_waveform.buf, bufinfo_waveform.len / 2, + tempo, args[ARG_sample_rate].u_int, args[ARG_waveform].u_obj, + mp_const_none, args[ARG_envelope].u_obj ); diff --git a/shared-module/synthio/MidiTrack.c b/shared-module/synthio/MidiTrack.c index a24071800b..50c7151811 100644 --- a/shared-module/synthio/MidiTrack.c +++ b/shared-module/synthio/MidiTrack.c @@ -116,14 +116,13 @@ STATIC void start_parse(synthio_miditrack_obj_t *self) { void common_hal_synthio_miditrack_construct(synthio_miditrack_obj_t *self, const uint8_t *buffer, uint32_t len, uint32_t tempo, uint32_t sample_rate, - const int16_t *waveform, uint16_t waveform_length, - mp_obj_t envelope) { + mp_obj_t waveform_obj, mp_obj_t filter_obj, mp_obj_t envelope_obj) { self->tempo = tempo; self->track.buf = (void *)buffer; self->track.len = len; - synthio_synth_init(&self->synth, sample_rate, 1, waveform, waveform_length, envelope); + synthio_synth_init(&self->synth, sample_rate, 1, waveform_obj, mp_const_none, envelope_obj); start_parse(self); } diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index 42e234fef1..c18c067976 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -32,10 +32,10 @@ void common_hal_synthio_synthesizer_construct(synthio_synthesizer_obj_t *self, - uint32_t sample_rate, int channel_count, const int16_t *waveform, uint16_t waveform_length, - mp_obj_t envelope) { + uint32_t sample_rate, int channel_count, mp_obj_t waveform_obj, mp_obj_t filter_obj, + mp_obj_t envelope_obj) { - synthio_synth_init(&self->synth, sample_rate, channel_count, waveform, waveform_length, envelope); + synthio_synth_init(&self->synth, sample_rate, channel_count, waveform_obj, filter_obj, envelope_obj); } void common_hal_synthio_synthesizer_deinit(synthio_synthesizer_obj_t *self) { diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 36ca709541..71b8250034 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -373,15 +373,16 @@ mp_obj_t synthio_synth_envelope_get(synthio_synth_t *synth) { return synth->envelope_obj; } -void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channel_count, const int16_t *waveform, uint16_t waveform_length, mp_obj_t envelope_obj) { +void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channel_count, mp_obj_t waveform_obj, mp_obj_t filter_obj, mp_obj_t envelope_obj) { mp_arg_validate_int_range(channel_count, 1, 2, MP_QSTR_channel_count); synth->buffer_length = SYNTHIO_MAX_DUR * SYNTHIO_BYTES_PER_SAMPLE * channel_count; synth->buffers[0] = m_malloc(synth->buffer_length, false); synth->buffers[1] = m_malloc(synth->buffer_length, false); synth->channel_count = channel_count; synth->other_channel = -1; - synth->waveform = waveform; - synth->waveform_length = waveform_length; + synth->waveform_obj = waveform_obj; + synthio_synth_parse_waveform(&synth->waveform_bufinfo, waveform_obj); + synthio_synth_parse_filter(&synth->filter_bufinfo, filter_obj); synth->sample_rate = sample_rate; synthio_synth_envelope_set(synth, envelope_obj); @@ -402,21 +403,24 @@ void synthio_synth_get_buffer_structure(synthio_synth_t *synth, bool single_chan } } -STATIC bool parse_common(mp_buffer_info_t *bufinfo, mp_obj_t o, int16_t what) { +STATIC void parse_common(mp_buffer_info_t *bufinfo, mp_obj_t o, int16_t what, mp_int_t max_len) { if (o != mp_const_none) { mp_get_buffer_raise(o, bufinfo, MP_BUFFER_READ); if (bufinfo->typecode != 'h') { mp_raise_ValueError_varg(translate("%q must be array of type 'h'"), what); } - mp_arg_validate_length_range(bufinfo->len / 2, 2, 1024, what); - return true; + mp_arg_validate_length_range(bufinfo->len / 2, 2, max_len, what); } - return false; } void synthio_synth_parse_waveform(mp_buffer_info_t *bufinfo_waveform, mp_obj_t waveform_obj) { *bufinfo_waveform = ((mp_buffer_info_t) { .buf = (void *)square_wave, .len = 4 }); - parse_common(bufinfo_waveform, waveform_obj, MP_QSTR_waveform); + parse_common(bufinfo_waveform, waveform_obj, MP_QSTR_waveform, 16384); +} + +void synthio_synth_parse_filter(mp_buffer_info_t *bufinfo_filter, mp_obj_t filter_obj) { + *bufinfo_filter = ((mp_buffer_info_t) { .buf = NULL, .len = 0 }); + parse_common(bufinfo_filter, filter_obj, MP_QSTR_filter, 128); } STATIC int find_channel_with_note(synthio_synth_t *synth, mp_obj_t note) { diff --git a/shared-module/synthio/__init__.h b/shared-module/synthio/__init__.h index c68fb00f97..6241771d33 100644 --- a/shared-module/synthio/__init__.h +++ b/shared-module/synthio/__init__.h @@ -70,8 +70,9 @@ typedef struct synthio_synth { uint16_t last_buffer_length; uint8_t other_channel, buffer_index, other_buffer_index; uint16_t waveform_length; + mp_buffer_info_t waveform_bufinfo, filter_bufinfo; synthio_envelope_definition_t global_envelope_definition; - mp_obj_t envelope_obj; + mp_obj_t waveform_obj, filter_obj, envelope_obj; synthio_midi_span_t span; uint32_t accum[CIRCUITPY_SYNTHIO_MAX_CHANNELS]; uint32_t ring_accum[CIRCUITPY_SYNTHIO_MAX_CHANNELS]; @@ -91,12 +92,12 @@ typedef struct { void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **buffer, uint32_t *buffer_length, uint8_t channel); void synthio_synth_deinit(synthio_synth_t *synth); bool synthio_synth_deinited(synthio_synth_t *synth); -void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channel_count, const int16_t *waveform, uint16_t waveform_length, - mp_obj_t envelope); +void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channel_count, mp_obj_t waveform_obj, mp_obj_t filter_obj, mp_obj_t envelope); void synthio_synth_get_buffer_structure(synthio_synth_t *synth, bool single_channel_output, bool *single_buffer, bool *samples_signed, uint32_t *max_buffer_length, uint8_t *spacing); void synthio_synth_reset_buffer(synthio_synth_t *synth, bool single_channel_output, uint8_t channel); void synthio_synth_parse_waveform(mp_buffer_info_t *bufinfo_waveform, mp_obj_t waveform_obj); +void synthio_synth_parse_filter(mp_buffer_info_t *bufinfo_filter, mp_obj_t filter_obj); void synthio_synth_parse_envelope(uint16_t *envelope_sustain_index, mp_buffer_info_t *bufinfo_envelope, mp_obj_t envelope_obj, mp_obj_t envelope_hold_obj); bool synthio_span_change_note(synthio_synth_t *synth, mp_obj_t old_note, mp_obj_t new_note); From 7845a1b13b21b0e2f0f8b61df48ddccfa7f3b9d8 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 17:58:09 -0500 Subject: [PATCH 1023/1712] synthio: Add `filter` boolean property to Note objects --- shared-bindings/synthio/Note.c | 20 ++++++++++++++++++++ shared-bindings/synthio/Note.h | 3 +++ shared-module/synthio/Note.c | 8 ++++++++ shared-module/synthio/Note.h | 1 + 4 files changed, 32 insertions(+) diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index dbf0f44495..f058b16d2e 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -44,6 +44,7 @@ static const mp_arg_t note_properties[] = { { MP_QSTR_bend_mode, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = (mp_obj_t)MP_ROM_PTR(&bend_mode_VIBRATO_obj) } }, { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, { MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, + { MP_QSTR_filter, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, { MP_QSTR_ring_frequency, MP_ARG_OBJ, {.u_obj = NULL } }, { MP_QSTR_ring_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, }; @@ -102,6 +103,24 @@ MP_PROPERTY_GETSET(synthio_note_frequency_obj, (mp_obj_t)&synthio_note_get_frequency_obj, (mp_obj_t)&synthio_note_set_frequency_obj); +//| filter: bool +//| """True if the note should be processed via the synthesizer's FIR filter.""" +STATIC mp_obj_t synthio_note_get_filter(mp_obj_t self_in) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_bool(common_hal_synthio_note_get_filter(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_filter_obj, synthio_note_get_filter); + +STATIC mp_obj_t synthio_note_set_filter(mp_obj_t self_in, mp_obj_t arg) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_note_set_filter(self, mp_obj_is_true(arg)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_filter_obj, synthio_note_set_filter); +MP_PROPERTY_GETSET(synthio_note_filter_obj, + (mp_obj_t)&synthio_note_get_filter_obj, + (mp_obj_t)&synthio_note_set_filter_obj); + //| panning: float //| """Defines the channel(s) in which the note appears. //| @@ -317,6 +336,7 @@ static void note_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_ STATIC const mp_rom_map_elem_t synthio_note_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_PTR(&synthio_note_frequency_obj) }, + { MP_ROM_QSTR(MP_QSTR_filter), MP_ROM_PTR(&synthio_note_filter_obj) }, { MP_ROM_QSTR(MP_QSTR_panning), MP_ROM_PTR(&synthio_note_panning_obj) }, { MP_ROM_QSTR(MP_QSTR_waveform), MP_ROM_PTR(&synthio_note_waveform_obj) }, { MP_ROM_QSTR(MP_QSTR_envelope), MP_ROM_PTR(&synthio_note_envelope_obj) }, diff --git a/shared-bindings/synthio/Note.h b/shared-bindings/synthio/Note.h index e548f9b5a7..b87310576a 100644 --- a/shared-bindings/synthio/Note.h +++ b/shared-bindings/synthio/Note.h @@ -9,6 +9,9 @@ typedef enum synthio_bend_mode_e synthio_bend_mode_t; mp_float_t common_hal_synthio_note_get_frequency(synthio_note_obj_t *self); void common_hal_synthio_note_set_frequency(synthio_note_obj_t *self, mp_float_t value); +bool common_hal_synthio_note_get_filter(synthio_note_obj_t *self); +void common_hal_synthio_note_set_filter(synthio_note_obj_t *self, bool value); + mp_float_t common_hal_synthio_note_get_ring_frequency(synthio_note_obj_t *self); void common_hal_synthio_note_set_ring_frequency(synthio_note_obj_t *self, mp_float_t value); diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index 89de8bce16..e6269eaf2e 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -44,6 +44,14 @@ void common_hal_synthio_note_set_frequency(synthio_note_obj_t *self, mp_float_t self->frequency_scaled = synthio_frequency_convert_float_to_scaled(val); } +bool common_hal_synthio_note_get_filter(synthio_note_obj_t *self) { + return self->filter; +} + +void common_hal_synthio_note_set_filter(synthio_note_obj_t *self, bool value_in) { + self->filter = value_in; +} + mp_float_t common_hal_synthio_note_get_ring_frequency(synthio_note_obj_t *self) { return self->ring_frequency; } diff --git a/shared-module/synthio/Note.h b/shared-module/synthio/Note.h index db3495f8b3..d7b9a6f67f 100644 --- a/shared-module/synthio/Note.h +++ b/shared-module/synthio/Note.h @@ -42,6 +42,7 @@ typedef struct synthio_note_obj { int32_t ring_frequency_scaled; int32_t amplitude_scaled; int32_t left_panning_scaled, right_panning_scaled; + bool filter; synthio_bend_mode_t bend_mode; synthio_lfo_descr_t tremolo_descr, bend_descr; synthio_lfo_state_t tremolo_state, bend_state; From 9d8dcf7d33b39a00156a675f3cb246b6b26e2ac2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 18:11:52 -0500 Subject: [PATCH 1024/1712] synthio: endorse new test result --- tests/circuitpython/synthesizer_note.py.exp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/circuitpython/synthesizer_note.py.exp b/tests/circuitpython/synthesizer_note.py.exp index 8c224982a2..801f97131e 100644 --- a/tests/circuitpython/synthesizer_note.py.exp +++ b/tests/circuitpython/synthesizer_note.py.exp @@ -1,10 +1,10 @@ () [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None),) +(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_waveform=None),) [-16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383] -(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None), Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None)) +(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_waveform=None), Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_waveform=None)) [0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046] -(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, ring_frequency=0.0, ring_waveform=None),) +(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_waveform=None),) [0, 0, 0, 28045, 0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0] (-5242, 5242) (-10485, 10484) From 62e6de8ed5fe836b0d7be4ffee8cb4fd7b081dd8 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 18:13:20 -0500 Subject: [PATCH 1025/1712] synthio: Factor out `synth_note_into_buffer`, start adding filter buffer --- shared-module/synthio/__init__.c | 284 ++++++++++++++++--------------- shared-module/synthio/__init__.h | 5 +- 2 files changed, 149 insertions(+), 140 deletions(-) diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 71b8250034..ac7f6edde7 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -171,6 +171,144 @@ int16_t mix_down_sample(int32_t sample) { return sample; } +static void synth_note_into_buffer(synthio_synth_t *synth, int chan, int32_t *out_buffer32, int16_t dur) { + mp_obj_t note_obj = synth->span.note_obj[chan]; + + if (note_obj == SYNTHIO_SILENCE) { + synth->accum[chan] = 0; + return; + } + + if (synth->envelope_state[chan].level == 0) { + // note is truly finished, but we only just noticed + synth->span.note_obj[chan] = SYNTHIO_SILENCE; + return; + } + + int32_t sample_rate = synth->sample_rate; + + // adjust loudness by envelope + uint16_t loudness[2] = {synth->envelope_state[chan].level,synth->envelope_state[chan].level}; + + uint32_t dds_rate; + const int16_t *waveform = synth->waveform_bufinfo.buf; + uint32_t waveform_length = synth->waveform_bufinfo.len / 2; + + uint32_t ring_dds_rate = 0; + const int16_t *ring_waveform = NULL; + uint32_t ring_waveform_length = 0; + + if (mp_obj_is_small_int(note_obj)) { + uint8_t note = mp_obj_get_int(note_obj); + uint8_t octave = note / 12; + uint16_t base_freq = notes[note % 12]; + // rate = base_freq * waveform_length + // den = sample_rate * 2 ^ (10 - octave) + // den = sample_rate * 2 ^ 10 / 2^octave + // dds_rate = 2^SHIFT * rate / den + // dds_rate = 2^(SHIFT-10+octave) * base_freq * waveform_length / sample_rate + dds_rate = (sample_rate / 2 + ((uint64_t)(base_freq * waveform_length) << (SYNTHIO_FREQUENCY_SHIFT - 10 + octave))) / sample_rate; + } else { + synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); + int32_t frequency_scaled = synthio_note_step(note, sample_rate, dur, loudness); + if (note->waveform_buf.buf) { + waveform = note->waveform_buf.buf; + waveform_length = note->waveform_buf.len / 2; + } + dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)frequency_scaled * waveform_length, sample_rate); + if (note->ring_frequency_scaled != 0 && note->ring_waveform_buf.buf) { + ring_waveform = note->ring_waveform_buf.buf; + ring_waveform_length = note->ring_waveform_buf.len / 2; + ring_dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)note->ring_frequency_scaled * ring_waveform_length, sample_rate); + uint32_t lim = ring_waveform_length << SYNTHIO_FREQUENCY_SHIFT; + if (ring_dds_rate > lim / 2) { + ring_dds_rate = 0; // can't ring at that frequency + } + } + } + + int synth_chan = synth->channel_count; + if (ring_dds_rate) { + uint32_t lim = waveform_length << SYNTHIO_FREQUENCY_SHIFT; + uint32_t accum = synth->accum[chan]; + + if (dds_rate > lim / 2) { + // beyond nyquist, can't play note + return; + } + + // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided + if (accum > lim) { + accum %= lim; + } + + int32_t ring_buffer[dur]; + // first, fill with waveform + for (uint16_t i = 0; i < dur; i++) { + accum += dds_rate; + // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed + if (accum > lim) { + accum -= lim; + } + int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; + ring_buffer[i] = waveform[idx]; + } + synth->accum[chan] = accum; + + // now modulate by ring and accumulate + accum = synth->ring_accum[chan]; + lim = ring_waveform_length << SYNTHIO_FREQUENCY_SHIFT; + + // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided + if (accum > lim) { + accum %= lim; + } + + for (uint16_t i = 0, j = 0; i < dur; i++) { + accum += ring_dds_rate; + // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed + if (accum > lim) { + accum -= lim; + } + int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; + int16_t wi = (ring_waveform[idx] * ring_buffer[i]) / 32768; + for (int c = 0; c < synth_chan; c++) { + out_buffer32[j] += (wi * loudness[c]) / 32768; + j++; + } + } + synth->ring_accum[chan] = accum; + } else { + uint32_t lim = waveform_length << SYNTHIO_FREQUENCY_SHIFT; + uint32_t accum = synth->accum[chan]; + + if (dds_rate > lim / 2) { + // beyond nyquist, can't play note + return; + } + + // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided + if (accum > lim) { + accum %= lim; + } + + for (uint16_t i = 0, j = 0; i < dur; i++) { + accum += dds_rate; + // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed + if (accum > lim) { + accum -= lim; + } + int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; + int16_t wi = waveform[idx]; + for (int c = 0; c < synth_chan; c++) { + out_buffer32[j] += (wi * loudness[c]) / 65536; + j++; + } + } + synth->accum[chan] = accum; + } +} + void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t *buffer_length, uint8_t channel) { if (channel == synth->other_channel) { @@ -186,145 +324,14 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t uint16_t dur = MIN(SYNTHIO_MAX_DUR, synth->span.dur); synth->span.dur -= dur; - int32_t sample_rate = synth->sample_rate; int32_t out_buffer32[dur * synth->channel_count]; memset(out_buffer32, 0, sizeof(out_buffer32)); for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { - mp_obj_t note_obj = synth->span.note_obj[chan]; - if (note_obj == SYNTHIO_SILENCE) { - synth->accum[chan] = 0; - continue; - } - - if (synth->envelope_state[chan].level == 0) { - // note is truly finished, but we only just noticed - synth->span.note_obj[chan] = SYNTHIO_SILENCE; - continue; - } - - // adjust loudness by envelope - uint16_t loudness[2] = {synth->envelope_state[chan].level,synth->envelope_state[chan].level}; - - uint32_t dds_rate; - const int16_t *waveform = synth->waveform; - uint32_t waveform_length = synth->waveform_length; - - uint32_t ring_dds_rate = 0; - const int16_t *ring_waveform = NULL; - uint32_t ring_waveform_length = 0; - - if (mp_obj_is_small_int(note_obj)) { - uint8_t note = mp_obj_get_int(note_obj); - uint8_t octave = note / 12; - uint16_t base_freq = notes[note % 12]; - // rate = base_freq * waveform_length - // den = sample_rate * 2 ^ (10 - octave) - // den = sample_rate * 2 ^ 10 / 2^octave - // dds_rate = 2^SHIFT * rate / den - // dds_rate = 2^(SHIFT-10+octave) * base_freq * waveform_length / sample_rate - dds_rate = (sample_rate / 2 + ((uint64_t)(base_freq * waveform_length) << (SYNTHIO_FREQUENCY_SHIFT - 10 + octave))) / sample_rate; - } else { - synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); - int32_t frequency_scaled = synthio_note_step(note, sample_rate, dur, loudness); - if (note->waveform_buf.buf) { - waveform = note->waveform_buf.buf; - waveform_length = note->waveform_buf.len / 2; - } - dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)frequency_scaled * waveform_length, sample_rate); - if (note->ring_frequency_scaled != 0 && note->ring_waveform_buf.buf) { - ring_waveform = note->ring_waveform_buf.buf; - ring_waveform_length = note->ring_waveform_buf.len / 2; - ring_dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)note->ring_frequency_scaled * ring_waveform_length, sample_rate); - uint32_t lim = ring_waveform_length << SYNTHIO_FREQUENCY_SHIFT; - if (ring_dds_rate > lim / 2) { - ring_dds_rate = 0; // can't ring at that frequency - } - } - } - - int synth_chan = synth->channel_count; - if (ring_dds_rate) { - uint32_t lim = waveform_length << SYNTHIO_FREQUENCY_SHIFT; - uint32_t accum = synth->accum[chan]; - - if (dds_rate > lim / 2) { - // beyond nyquist, can't play note - continue; - } - - // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided - if (accum > lim) { - accum %= lim; - } - - int32_t ring_buffer[dur]; - // first, fill with waveform - for (uint16_t i = 0; i < dur; i++) { - accum += dds_rate; - // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed - if (accum > lim) { - accum -= lim; - } - int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; - ring_buffer[i] = waveform[idx]; - } - synth->accum[chan] = accum; - - // now modulate by ring and accumulate - accum = synth->ring_accum[chan]; - lim = ring_waveform_length << SYNTHIO_FREQUENCY_SHIFT; - - // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided - if (accum > lim) { - accum %= lim; - } - - for (uint16_t i = 0, j = 0; i < dur; i++) { - accum += ring_dds_rate; - // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed - if (accum > lim) { - accum -= lim; - } - int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; - int16_t wi = (ring_waveform[idx] * ring_buffer[i]) / 32768; - for (int c = 0; c < synth_chan; c++) { - out_buffer32[j] += (wi * loudness[c]) / 32768; - j++; - } - } - synth->ring_accum[chan] = accum; - } else { - uint32_t lim = waveform_length << SYNTHIO_FREQUENCY_SHIFT; - uint32_t accum = synth->accum[chan]; - - if (dds_rate > lim / 2) { - // beyond nyquist, can't play note - continue; - } - - // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided - if (accum > lim) { - accum %= lim; - } - - for (uint16_t i = 0, j = 0; i < dur; i++) { - accum += dds_rate; - // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed - if (accum > lim) { - accum -= lim; - } - int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; - int16_t wi = waveform[idx]; - for (int c = 0; c < synth_chan; c++) { - out_buffer32[j] += (wi * loudness[c]) / 65536; - j++; - } - } - synth->accum[chan] = accum; - } + synth_note_into_buffer(synth, chan, out_buffer32, dur); } + int16_t *out_buffer16 = (int16_t *)(void *)synth->buffers[synth->buffer_index]; // mix down audio @@ -358,8 +365,7 @@ bool synthio_synth_deinited(synthio_synth_t *synth) { } void synthio_synth_deinit(synthio_synth_t *synth) { - m_del(uint8_t, synth->buffers[0], synth->buffer_length); - m_del(uint8_t, synth->buffers[1], synth->buffer_length); + synth->filter_buffer = NULL; synth->buffers[0] = NULL; synth->buffers[1] = NULL; } @@ -374,15 +380,19 @@ mp_obj_t synthio_synth_envelope_get(synthio_synth_t *synth) { } void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channel_count, mp_obj_t waveform_obj, mp_obj_t filter_obj, mp_obj_t envelope_obj) { + synthio_synth_parse_waveform(&synth->waveform_bufinfo, waveform_obj); + synthio_synth_parse_filter(&synth->filter_bufinfo, filter_obj); mp_arg_validate_int_range(channel_count, 1, 2, MP_QSTR_channel_count); synth->buffer_length = SYNTHIO_MAX_DUR * SYNTHIO_BYTES_PER_SAMPLE * channel_count; synth->buffers[0] = m_malloc(synth->buffer_length, false); synth->buffers[1] = m_malloc(synth->buffer_length, false); + if (synth->filter_bufinfo.len) { + synth->filter_buffer_length = (synth->filter_bufinfo.len + SYNTHIO_MAX_DUR) * channel_count * sizeof(int32_t); + synth->filter_buffer = m_malloc(synth->filter_buffer_length, false); + } synth->channel_count = channel_count; synth->other_channel = -1; synth->waveform_obj = waveform_obj; - synthio_synth_parse_waveform(&synth->waveform_bufinfo, waveform_obj); - synthio_synth_parse_filter(&synth->filter_bufinfo, filter_obj); synth->sample_rate = sample_rate; synthio_synth_envelope_set(synth, envelope_obj); diff --git a/shared-module/synthio/__init__.h b/shared-module/synthio/__init__.h index 6241771d33..a3d0ca57fd 100644 --- a/shared-module/synthio/__init__.h +++ b/shared-module/synthio/__init__.h @@ -64,12 +64,11 @@ typedef struct synthio_synth { uint32_t sample_rate; uint32_t total_envelope; int16_t *buffers[2]; - const int16_t *waveform; + int32_t *filter_buffer; uint8_t channel_count; - uint16_t buffer_length; + uint16_t buffer_length, filter_buffer_length; uint16_t last_buffer_length; uint8_t other_channel, buffer_index, other_buffer_index; - uint16_t waveform_length; mp_buffer_info_t waveform_bufinfo, filter_bufinfo; synthio_envelope_definition_t global_envelope_definition; mp_obj_t waveform_obj, filter_obj, envelope_obj; From f52bb65da6e81299de2e3618e50dde01b906e061 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 18:41:52 -0500 Subject: [PATCH 1026/1712] synthio: add some new manual tests --- .../synthio/note/envelope.py | 58 ++++++++++ .../circuitpython-manual/synthio/note/fir.py | 104 ++++++++++++++++++ .../synthio/note/panning.py | 57 ++++++++++ .../circuitpython-manual/synthio/note/ring.py | 60 ++++++++++ 4 files changed, 279 insertions(+) create mode 100644 tests/circuitpython-manual/synthio/note/envelope.py create mode 100644 tests/circuitpython-manual/synthio/note/fir.py create mode 100644 tests/circuitpython-manual/synthio/note/panning.py create mode 100644 tests/circuitpython-manual/synthio/note/ring.py diff --git a/tests/circuitpython-manual/synthio/note/envelope.py b/tests/circuitpython-manual/synthio/note/envelope.py new file mode 100644 index 0000000000..9421cf8c1c --- /dev/null +++ b/tests/circuitpython-manual/synthio/note/envelope.py @@ -0,0 +1,58 @@ +import sys + +sys.path.insert( + 0, f"{__file__.rpartition('/')[0] or '.'}/../../../../frozen/Adafruit_CircuitPython_Wave" +) + +import random +import audiocore +import synthio +from ulab import numpy as np +import adafruit_wave as wave + +SAMPLE_SIZE = 1024 +VOLUME = 32767 +sine = np.array( + np.sin(np.linspace(0, 2 * np.pi, SAMPLE_SIZE, endpoint=False)) * VOLUME, + dtype=np.int16, +) + +envelope = synthio.Envelope(attack_time=0.05, decay_time=8, release_time=0.25, sustain_level=0) +fast_decay_envelope = synthio.Envelope( + attack_time=0.05, decay_time=0.25, release_time=0.25, sustain_level=0 +) + +synth = synthio.Synthesizer(sample_rate=48000) + + +def synthesize(synth): + notes = (synthio.Note(frequency=440, waveform=sine, envelope=envelope),) + synth.press(notes) + yield 360 + notes[0].envelope = fast_decay_envelope + yield 180 + synth.release_all() + + +def synthesize2(synth): + notes = (synthio.Note(frequency=440, waveform=sine, envelope=envelope),) + synth.press(notes) + yield 360 + synth.release_all() + yield 180 + + +def chain(*args): + for a in args: + yield from a + + +# sox -r 48000 -e signed -b 16 -c 1 tune.raw tune.wav +with wave.open("envelope.wav", "w") as f: + f.setnchannels(1) + f.setsampwidth(2) + f.setframerate(48000) + for n in chain(synthesize(synth), synthesize2(synth)): + for i in range(n): + result, data = audiocore.get_buffer(synth) + f.writeframes(data) diff --git a/tests/circuitpython-manual/synthio/note/fir.py b/tests/circuitpython-manual/synthio/note/fir.py new file mode 100644 index 0000000000..9d40b584be --- /dev/null +++ b/tests/circuitpython-manual/synthio/note/fir.py @@ -0,0 +1,104 @@ +import sys + +sys.path.insert( + 0, f"{__file__.rpartition('/')[0] or '.'}/../../../../frozen/Adafruit_CircuitPython_Wave" +) + +import random +import audiocore +import synthio +from ulab import numpy as np +import adafruit_wave as wave + +random.seed(9) + +envelope = synthio.Envelope( + attack_time=0.1, decay_time=0.05, release_time=0.2, attack_level=0.8, sustain_level=0.8 +) + +h = np.array( + [ + -0.001229734800309099, + -0.008235561806605458, + -0.015082497016061390, + -0.020940136918319988, + -0.024981800822463429, + -0.026464233332370746, + -0.024803890156806906, + -0.019642276775473012, + -0.010893620860173042, + 0.001230341899766145, + 0.016221637398855598, + 0.033304135659230648, + 0.051486665261155681, + 0.069636961761409016, + 0.086570197432542767, + 0.101144354207918147, + 0.112353938422488253, + 0.119413577288191297, + 0.121823886314051028, + 0.119413577288191297, + 0.112353938422488253, + 0.101144354207918147, + 0.086570197432542767, + 0.069636961761409016, + 0.051486665261155681, + 0.033304135659230648, + 0.016221637398855598, + 0.001230341899766145, + -0.010893620860173042, + -0.019642276775473012, + -0.024803890156806906, + -0.026464233332370746, + -0.024981800822463429, + -0.020940136918319988, + -0.015082497016061390, + -0.008235561806605458, + -0.001229734800309099, + ] +) + +filter_coeffs = np.array(h[::-1] * 32768, dtype=np.int16) + +synth = synthio.Synthesizer(sample_rate=48000, filter=filter_coeffs) + + +def synthesize(synth): + n = synthio.Note( + frequency=120, + envelope=envelope, + filter=False, + ) + + print(synth, n) + synth.press((n,)) + for _ in range(20): + n.frequency *= 1.0595 + yield 36 + synth.release_all() + yield 36 + + n.filter = True + n.frequency = 120 + synth.press((n,)) + for _ in range(20): + n.frequency *= 1.0595 + yield 36 + synth.release_all() + yield 36 + + +def chain(*args): + for a in args: + yield from a + + +# sox -r 48000 -e signed -b 16 -c 1 tune.raw tune.wav +with wave.open("fir.wav", "w") as f: + f.setnchannels(1) + f.setsampwidth(2) + f.setframerate(48000) + for n in chain(synthesize(synth)): + for i in range(n): + result, data = audiocore.get_buffer(synth) + f.writeframes(data) diff --git a/tests/circuitpython-manual/synthio/note/panning.py b/tests/circuitpython-manual/synthio/note/panning.py new file mode 100644 index 0000000000..0b7fb1e2a6 --- /dev/null +++ b/tests/circuitpython-manual/synthio/note/panning.py @@ -0,0 +1,57 @@ +import sys + +sys.path.insert( + 0, f"{__file__.rpartition('/')[0] or '.'}/../../../../frozen/Adafruit_CircuitPython_Wave" +) + +import random +import audiocore +import synthio +from ulab import numpy as np +import adafruit_wave as wave + +random.seed(9) +SAMPLE_SIZE = 1024 +VOLUME = 14700 +sine = np.array( + np.sin(np.linspace(0, 2 * np.pi, SAMPLE_SIZE, endpoint=False)) * VOLUME, + dtype=np.int16, +) + +envelope = synthio.Envelope( + attack_time=0.1, decay_time=0.05, release_time=0.2, attack_level=0.8, sustain_level=0.8 +) + +synth = synthio.Synthesizer(sample_rate=48000, channel_count=2) + + +def synthesize(synth): + n = synthio.Note( + frequency=440, + waveform=sine, + envelope=envelope, + ) + + print(synth, n) + synth.press((n,)) + for p in range(-10, 11, 1): + n.panning = p / 10 + yield 36 + synth.release_all() + yield 36 + + +def chain(*args): + for a in args: + yield from a + + +# sox -r 48000 -e signed -b 16 -c 1 tune.raw tune.wav +with wave.open("panning.wav", "w") as f: + f.setnchannels(2) + f.setsampwidth(2) + f.setframerate(48000) + for n in chain(synthesize(synth)): + for i in range(n): + result, data = audiocore.get_buffer(synth) + f.writeframes(data) diff --git a/tests/circuitpython-manual/synthio/note/ring.py b/tests/circuitpython-manual/synthio/note/ring.py new file mode 100644 index 0000000000..7a418da3af --- /dev/null +++ b/tests/circuitpython-manual/synthio/note/ring.py @@ -0,0 +1,60 @@ +import sys + +sys.path.insert( + 0, f"{__file__.rpartition('/')[0] or '.'}/../../../../frozen/Adafruit_CircuitPython_Wave" +) + +import random +import audiocore +import synthio +from ulab import numpy as np +import adafruit_wave as wave + +random.seed(9) +SAMPLE_SIZE = 1024 +VOLUME = 32767 +sine = np.array( + np.sin(np.linspace(0, 2 * np.pi, SAMPLE_SIZE, endpoint=False)) * VOLUME, + dtype=np.int16, +) + +envelope = synthio.Envelope( + attack_time=0.1, decay_time=0.05, release_time=0.2, attack_level=0.8, sustain_level=0.8 +) + +synth = synthio.Synthesizer(sample_rate=48000) + + +def synthesize(synth): + n = synthio.Note( + frequency=120, + waveform=sine, + ring_waveform=sine, + ring_frequency=769, + envelope=envelope, + bend_mode=synthio.BendType.VIBRATO, + bend_depth=50 / 1200, + bend_rate=7, + ) + + print(synth, n) + synth.press((n,)) + yield 720 + synth.release_all() + yield 36 + + +def chain(*args): + for a in args: + yield from a + + +# sox -r 48000 -e signed -b 16 -c 1 tune.raw tune.wav +with wave.open("ring.wav", "w") as f: + f.setnchannels(1) + f.setsampwidth(2) + f.setframerate(48000) + for n in chain(synthesize(synth)): + for i in range(n): + result, data = audiocore.get_buffer(synth) + f.writeframes(data) From bc7feb30a512fef8927061a724fc0caa46c88a58 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 18:42:18 -0500 Subject: [PATCH 1027/1712] synthio: implement FIR filtering A 37-tap filter worked fine on RP2040 (prop maker) at 48kHz, so you can probably pretty much go nuts on M7. --- shared-module/synthio/__init__.c | 68 +++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 9 deletions(-) diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index ac7f6edde7..0175629c18 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -192,7 +192,7 @@ static void synth_note_into_buffer(synthio_synth_t *synth, int chan, int32_t *ou uint32_t dds_rate; const int16_t *waveform = synth->waveform_bufinfo.buf; - uint32_t waveform_length = synth->waveform_bufinfo.len / 2; + uint32_t waveform_length = synth->waveform_bufinfo.len / sizeof(int16_t); uint32_t ring_dds_rate = 0; const int16_t *ring_waveform = NULL; @@ -213,15 +213,15 @@ static void synth_note_into_buffer(synthio_synth_t *synth, int chan, int32_t *ou int32_t frequency_scaled = synthio_note_step(note, sample_rate, dur, loudness); if (note->waveform_buf.buf) { waveform = note->waveform_buf.buf; - waveform_length = note->waveform_buf.len / 2; + waveform_length = note->waveform_buf.len / sizeof(int16_t); } dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)frequency_scaled * waveform_length, sample_rate); if (note->ring_frequency_scaled != 0 && note->ring_waveform_buf.buf) { ring_waveform = note->ring_waveform_buf.buf; - ring_waveform_length = note->ring_waveform_buf.len / 2; + ring_waveform_length = note->ring_waveform_buf.len / sizeof(int16_t); ring_dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)note->ring_frequency_scaled * ring_waveform_length, sample_rate); uint32_t lim = ring_waveform_length << SYNTHIO_FREQUENCY_SHIFT; - if (ring_dds_rate > lim / 2) { + if (ring_dds_rate > lim / sizeof(int16_t)) { ring_dds_rate = 0; // can't ring at that frequency } } @@ -309,6 +309,37 @@ static void synth_note_into_buffer(synthio_synth_t *synth, int chan, int32_t *ou } } +STATIC void run_fir(synthio_synth_t *synth, int32_t *out_buffer32, uint16_t dur) { + int16_t *coeff = (int16_t *)synth->filter_bufinfo.buf; + size_t fir_len = synth->filter_bufinfo.len / sizeof(int16_t); + int32_t *in_buf = synth->filter_buffer; + + // FIR and copy values to output buffer + for (int16_t i = 0; i < dur; i++) { + int32_t acc = 0; + for (size_t j = 0; j < fir_len; j++) { + // shift 5 here is good for up to 32 filtered voices, else might wrap + acc = acc + (in_buf[j] * (coeff[j] >> 5)); + } + *out_buffer32++ = acc >> 10; + in_buf++; + } + + // Move values down so that they get filtered next time + memmove(synth->filter_buffer, &synth->filter_buffer[dur], fir_len * sizeof(int32_t)); +} + +STATIC bool synthio_synth_get_note_filtered(mp_obj_t note_obj) { + if (note_obj == mp_const_none) { + return false; + } + if (!mp_obj_is_small_int(note_obj)) { + synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); + return note->filter; + } + return true; +} + void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t *buffer_length, uint8_t channel) { if (channel == synth->other_channel) { @@ -326,11 +357,30 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t int32_t out_buffer32[dur * synth->channel_count]; - memset(out_buffer32, 0, sizeof(out_buffer32)); - for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { - synth_note_into_buffer(synth, chan, out_buffer32, dur); + if (synth->filter_buffer) { + int32_t *filter_start = &synth->filter_buffer[synth->filter_bufinfo.len * synth->channel_count / sizeof(int16_t)]; + memset(filter_start, 0, dur * sizeof(int32_t)); + + for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { + mp_obj_t note_obj = synth->span.note_obj[chan]; + if (!synthio_synth_get_note_filtered(note_obj)) { + continue; + } + synth_note_into_buffer(synth, chan, filter_start, dur); + } + + run_fir(synth, out_buffer32, dur); + } else { + memset(out_buffer32, 0, sizeof(out_buffer32)); } + for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { + mp_obj_t note_obj = synth->span.note_obj[chan]; + if (synth->filter_buffer && synthio_synth_get_note_filtered(note_obj)) { + continue; + } + synth_note_into_buffer(synth, chan, out_buffer32, dur); + } int16_t *out_buffer16 = (int16_t *)(void *)synth->buffers[synth->buffer_index]; @@ -387,7 +437,7 @@ void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channe synth->buffers[0] = m_malloc(synth->buffer_length, false); synth->buffers[1] = m_malloc(synth->buffer_length, false); if (synth->filter_bufinfo.len) { - synth->filter_buffer_length = (synth->filter_bufinfo.len + SYNTHIO_MAX_DUR) * channel_count * sizeof(int32_t); + synth->filter_buffer_length = (synth->filter_bufinfo.len / 2 + SYNTHIO_MAX_DUR) * channel_count * sizeof(int32_t); synth->filter_buffer = m_malloc(synth->filter_buffer_length, false); } synth->channel_count = channel_count; @@ -419,7 +469,7 @@ STATIC void parse_common(mp_buffer_info_t *bufinfo, mp_obj_t o, int16_t what, mp if (bufinfo->typecode != 'h') { mp_raise_ValueError_varg(translate("%q must be array of type 'h'"), what); } - mp_arg_validate_length_range(bufinfo->len / 2, 2, max_len, what); + mp_arg_validate_length_range(bufinfo->len / sizeof(int16_t), 2, max_len, what); } } From 585b1c23b5b2b9b0eb94b2c8834fbfe7760be45b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 11 May 2023 19:13:11 -0500 Subject: [PATCH 1028/1712] synthio: Fix sweep-type pitch bends The accumulator saturate logic was wrong, and the sweep was never restarted either --- shared-module/synthio/Note.c | 3 +++ shared-module/synthio/__init__.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index e6269eaf2e..16727b2152 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -193,6 +193,9 @@ void synthio_note_recalculate(synthio_note_obj_t *self, int32_t sample_rate) { void synthio_note_start(synthio_note_obj_t *self, int32_t sample_rate) { synthio_note_recalculate(self, sample_rate); + if (self->bend_mode != SYNTHIO_BEND_MODE_VIBRATO) { + self->bend_state.phase = 0; + } } uint32_t synthio_note_envelope(synthio_note_obj_t *self) { diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 0175629c18..2fed9a5122 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -554,8 +554,9 @@ STATIC int synthio_lfo_step_common(synthio_lfo_state_t *state, uint16_t dur) { return whole_phase; } STATIC int synthio_lfo_sweep_common(synthio_lfo_state_t *state, uint16_t dur) { + uint32_t old_phase = state->phase; uint16_t whole_phase = synthio_lfo_step_common(state, dur); - if (state->phase < state->dds) { + if (state->phase < old_phase) { state->phase = 0xffffffff; } return whole_phase; From 5a5474b5dc168143875ef3b23fb1653cb67f2a0c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 9 May 2023 07:37:47 -0500 Subject: [PATCH 1029/1712] mimxrt: 101x: MIDI_RX_BUFSIZE must be 512 It's not clear why this is required, but otherwise it stops midi_intest1 from ever receiving any MIDI events. Closes: #7944 --- ports/mimxrt10xx/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index b10466bb2d..bbee67bebe 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -50,7 +50,7 @@ CFLAGS += -ftree-vrp -DNDEBUG # TinyUSB defines CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX -DCFG_TUD_CDC_RX_BUFSIZE=512 -DCFG_TUD_CDC_TX_BUFSIZE=512 ifeq ($(CHIP_FAMILY),$(filter $(CHIP_FAMILY),MIMXRT1011 MIMXRT1015)) -CFLAGS += -DCFG_TUD_MIDI_RX_BUFSIZE=64 -DCFG_TUD_MIDI_TX_BUFSIZE=64 -DCFG_TUD_MSC_BUFSIZE=512 +CFLAGS += -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_TUD_MIDI_TX_BUFSIZE=64 -DCFG_TUD_MSC_BUFSIZE=512 else CFLAGS += -DCFG_TUD_MIDI_RX_BUFSIZE=512 -DCFG_TUD_MIDI_TX_BUFSIZE=512 -DCFG_TUD_MSC_BUFSIZE=1024 endif From 0b2f8575423177d5c336c5d64dc85befa11ad878 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 12 May 2023 00:28:37 -0400 Subject: [PATCH 1030/1712] STM: monotonic time even when RTC is changed --- ports/stm/peripherals/rtc.c | 100 +++++++++++++++++++++--------------- ports/stm/peripherals/rtc.h | 2 +- ports/stm/supervisor/port.c | 2 +- 3 files changed, 61 insertions(+), 43 deletions(-) diff --git a/ports/stm/peripherals/rtc.c b/ports/stm/peripherals/rtc.c index 15f82ba78d..c6cccfc93b 100644 --- a/ports/stm/peripherals/rtc.c +++ b/ports/stm/peripherals/rtc.c @@ -47,6 +47,11 @@ volatile uint32_t cached_date = 0; volatile uint32_t seconds_to_minute = 0; volatile uint32_t cached_hours_minutes = 0; +// The RTC starts at 2000-01-01 when it comes up. +// If the RTC is set to a later time, the ticks the RTC returns will be offset by the new time. +// Remember that offset so it can be removed when returning a monotonic tick count. +static int64_t rtc_ticks_offset; + volatile bool alarmed_already[2]; bool peripherals_wkup_on = false; @@ -59,6 +64,8 @@ uint32_t stm32_peripherals_get_rtc_freq(void) { } void stm32_peripherals_rtc_init(void) { + rtc_ticks_offset = 0; + // RTC oscillator selection is handled in peripherals///clocks.c __HAL_RCC_RTC_ENABLE(); hrtc.Instance = RTC; @@ -74,49 +81,9 @@ void stm32_peripherals_rtc_init(void) { HAL_NVIC_EnableIRQ(RTC_Alarm_IRQn); } -#if CIRCUITPY_RTC -void stm32_peripherals_rtc_get_time(timeutils_struct_time_t *tm) { - RTC_DateTypeDef date = {0}; - RTC_TimeTypeDef time = {0}; - - int code; - if ((code = HAL_RTC_GetTime(&hrtc, &time, RTC_FORMAT_BIN)) == HAL_OK && - (code = HAL_RTC_GetDate(&hrtc, &date, RTC_FORMAT_BIN)) == HAL_OK) { - tm->tm_hour = time.Hours; - tm->tm_min = time.Minutes; - tm->tm_sec = time.Seconds; - tm->tm_wday = date.WeekDay - 1; - tm->tm_mday = date.Date; - tm->tm_mon = date.Month; - tm->tm_year = date.Year + 2000; - tm->tm_yday = -1; - } -} - -void stm32_peripherals_rtc_set_time(timeutils_struct_time_t *tm) { - RTC_DateTypeDef date = {0}; - RTC_TimeTypeDef time = {0}; - - time.Hours = tm->tm_hour; - time.Minutes = tm->tm_min; - time.Seconds = tm->tm_sec; - date.WeekDay = tm->tm_wday + 1; - date.Date = tm->tm_mday; - date.Month = tm->tm_mon; - date.Year = tm->tm_year - 2000; - time.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; - time.StoreOperation = RTC_STOREOPERATION_RESET; - - if (HAL_RTC_SetTime(&hrtc, &time, RTC_FORMAT_BIN) != HAL_OK || - HAL_RTC_SetDate(&hrtc, &date, RTC_FORMAT_BIN) != HAL_OK) { - // todo - throw an exception - } -} -#endif - // This function is called often for timing so we cache the seconds elapsed computation based on the // register value. The STM HAL always does shifts and conversion if we use it directly. -uint64_t stm32_peripherals_rtc_raw_ticks(uint8_t *subticks) { +STATIC uint64_t stm32_peripherals_rtc_raw_ticks(uint8_t *subticks) { // Disable IRQs to ensure we read all of the RTC registers as close in time as possible. Read // SSR twice to make sure we didn't read across a tick. __disable_irq(); @@ -164,6 +131,57 @@ uint64_t stm32_peripherals_rtc_raw_ticks(uint8_t *subticks) { return raw_ticks; } +// This function returns monotonically increasing ticks by adjusting away the RTC tick offset +// from the last time the date was set. +uint64_t stm32_peripherals_rtc_monotonic_ticks(uint8_t *subticks) { + return stm32_peripherals_rtc_raw_ticks(subticks) - rtc_ticks_offset; +} + +#if CIRCUITPY_RTC +void stm32_peripherals_rtc_get_time(timeutils_struct_time_t *tm) { + RTC_DateTypeDef date = {0}; + RTC_TimeTypeDef time = {0}; + + int code; + if ((code = HAL_RTC_GetTime(&hrtc, &time, RTC_FORMAT_BIN)) == HAL_OK && + (code = HAL_RTC_GetDate(&hrtc, &date, RTC_FORMAT_BIN)) == HAL_OK) { + tm->tm_hour = time.Hours; + tm->tm_min = time.Minutes; + tm->tm_sec = time.Seconds; + tm->tm_wday = date.WeekDay - 1; + tm->tm_mday = date.Date; + tm->tm_mon = date.Month; + tm->tm_year = date.Year + 2000; + tm->tm_yday = -1; + } +} + +void stm32_peripherals_rtc_set_time(timeutils_struct_time_t *tm) { + RTC_DateTypeDef date = {0}; + RTC_TimeTypeDef time = {0}; + + uint64_t current_monotonic_ticks = stm32_peripherals_rtc_monotonic_ticks(NULL); + + time.Hours = tm->tm_hour; + time.Minutes = tm->tm_min; + time.Seconds = tm->tm_sec; + date.WeekDay = tm->tm_wday + 1; + date.Date = tm->tm_mday; + date.Month = tm->tm_mon; + date.Year = tm->tm_year - 2000; + time.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; + time.StoreOperation = RTC_STOREOPERATION_RESET; + + if (HAL_RTC_SetTime(&hrtc, &time, RTC_FORMAT_BIN) != HAL_OK || + HAL_RTC_SetDate(&hrtc, &date, RTC_FORMAT_BIN) != HAL_OK) { + // todo - throw an exception + } + + rtc_ticks_offset = stm32_peripherals_rtc_raw_ticks(NULL) - current_monotonic_ticks; + ; +} +#endif + void stm32_peripherals_rtc_assign_wkup_callback(void (*callback)(void)) { wkup_callback = callback; } diff --git a/ports/stm/peripherals/rtc.h b/ports/stm/peripherals/rtc.h index 474cba1881..93febbb5cc 100644 --- a/ports/stm/peripherals/rtc.h +++ b/ports/stm/peripherals/rtc.h @@ -36,7 +36,7 @@ uint32_t stm32_peripherals_get_rtc_freq(void); void stm32_peripherals_rtc_init(void); -uint64_t stm32_peripherals_rtc_raw_ticks(uint8_t *subticks); +uint64_t stm32_peripherals_rtc_monotonic_ticks(uint8_t *subticks); void stm32_peripherals_rtc_assign_wkup_callback(void (*callback)(void)); void stm32_peripherals_rtc_set_wakeup_mode_seconds(uint32_t seconds); diff --git a/ports/stm/supervisor/port.c b/ports/stm/supervisor/port.c index 1fb3f36377..0a8d9a5b19 100644 --- a/ports/stm/supervisor/port.c +++ b/ports/stm/supervisor/port.c @@ -385,7 +385,7 @@ __attribute__((used)) void HardFault_Handler(void) { } uint64_t port_get_raw_ticks(uint8_t *subticks) { - return stm32_peripherals_rtc_raw_ticks(subticks); + return stm32_peripherals_rtc_monotonic_ticks(subticks); } // Enable 1/1024 second tick. From 74624e7c228cad8a08c5b79e0d2fd5330a465f5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bojan=20Poto=C4=8Dnik?= Date: Fri, 12 May 2023 09:10:26 +0200 Subject: [PATCH 1031/1712] Add missing ESP32-S3 pins to microcontroller module ESP32-S3 defines two additional general use pins in ports/espressif/peripherals/esp32s3/pins.h, for which support is missing in the microcontroller module HAL. --- ports/espressif/common-hal/microcontroller/__init__.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ports/espressif/common-hal/microcontroller/__init__.c b/ports/espressif/common-hal/microcontroller/__init__.c index 23c7c153e9..7ec9b215f1 100644 --- a/ports/espressif/common-hal/microcontroller/__init__.c +++ b/ports/espressif/common-hal/microcontroller/__init__.c @@ -304,5 +304,11 @@ STATIC const mp_rom_map_elem_t mcu_pin_global_dict_table[] = { #ifdef GPIO46_EXISTS { MP_ROM_QSTR(MP_QSTR_GPIO46), MP_ROM_PTR(&pin_GPIO46) }, #endif + #ifdef GPIO47_EXISTS + { MP_ROM_QSTR(MP_QSTR_GPIO47), MP_ROM_PTR(&pin_GPIO47) }, + #endif + #ifdef GPIO48_EXISTS + { MP_ROM_QSTR(MP_QSTR_GPIO48), MP_ROM_PTR(&pin_GPIO48) }, + #endif }; MP_DEFINE_CONST_DICT(mcu_pin_globals, mcu_pin_global_dict_table); From e8067851f5958c72ec828b14186affc22b8a5d60 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 12 May 2023 14:39:57 -0400 Subject: [PATCH 1032/1712] fix subticks handling --- ports/stm/peripherals/rtc.c | 47 +++++++++++++++++++++++++++-------- shared-module/time/__init__.c | 2 ++ 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/ports/stm/peripherals/rtc.c b/ports/stm/peripherals/rtc.c index c6cccfc93b..7c8cb65e17 100644 --- a/ports/stm/peripherals/rtc.c +++ b/ports/stm/peripherals/rtc.c @@ -32,7 +32,9 @@ #include "shared/timeutils/timeutils.h" // Default period for ticks is 1/1024 second -#define TICK_DIVISOR 1024 +#define TICKS_PER_SECOND 1024 +// Based on a 32768 kHz clock +#define SUBTICKS_PER_TICK 32 STATIC RTC_HandleTypeDef hrtc; @@ -51,6 +53,8 @@ volatile uint32_t cached_hours_minutes = 0; // If the RTC is set to a later time, the ticks the RTC returns will be offset by the new time. // Remember that offset so it can be removed when returning a monotonic tick count. static int64_t rtc_ticks_offset; +// Normalized to be 0-31 inclusive, so always positive. +static uint8_t rtc_subticks_offset; volatile bool alarmed_already[2]; @@ -65,6 +69,7 @@ uint32_t stm32_peripherals_get_rtc_freq(void) { void stm32_peripherals_rtc_init(void) { rtc_ticks_offset = 0; + rtc_subticks_offset = 0; // RTC oscillator selection is handled in peripherals///clocks.c __HAL_RCC_RTC_ENABLE(); @@ -124,17 +129,27 @@ STATIC uint64_t stm32_peripherals_rtc_raw_ticks(uint8_t *subticks) { uint8_t seconds = (uint8_t)(time & (RTC_TR_ST | RTC_TR_SU)); seconds = (uint8_t)RTC_Bcd2ToByte(seconds); if (subticks != NULL) { - *subticks = subseconds % 32; + *subticks = subseconds % SUBTICKS_PER_TICK; } - uint64_t raw_ticks = ((uint64_t)TICK_DIVISOR) * (seconds_to_date + seconds_to_minute + seconds) + subseconds / 32; + uint64_t raw_ticks = ((uint64_t)TICKS_PER_SECOND) * (seconds_to_date + seconds_to_minute + seconds) + subseconds / SUBTICKS_PER_TICK; return raw_ticks; } // This function returns monotonically increasing ticks by adjusting away the RTC tick offset // from the last time the date was set. uint64_t stm32_peripherals_rtc_monotonic_ticks(uint8_t *subticks) { - return stm32_peripherals_rtc_raw_ticks(subticks) - rtc_ticks_offset; + uint8_t raw_subticks; + uint64_t monotonic_ticks = stm32_peripherals_rtc_raw_ticks(&raw_subticks) - rtc_ticks_offset; + int8_t monotonic_subticks = raw_subticks - rtc_subticks_offset; + // Difference might be negative. Normalize to 0-31. + // `while` not really necessary; should only loop 0 or 1 times. + while (monotonic_subticks < 0) { + monotonic_ticks--; + monotonic_subticks += SUBTICKS_PER_TICK; + } + *subticks = (uint8_t)monotonic_subticks; + return monotonic_ticks; } #if CIRCUITPY_RTC @@ -160,8 +175,10 @@ void stm32_peripherals_rtc_set_time(timeutils_struct_time_t *tm) { RTC_DateTypeDef date = {0}; RTC_TimeTypeDef time = {0}; - uint64_t current_monotonic_ticks = stm32_peripherals_rtc_monotonic_ticks(NULL); + uint8_t current_monotonic_subticks; + uint64_t current_monotonic_ticks = stm32_peripherals_rtc_monotonic_ticks(¤t_monotonic_subticks); + // SubSeconds will always be set to zero. time.Hours = tm->tm_hour; time.Minutes = tm->tm_min; time.Seconds = tm->tm_sec; @@ -177,8 +194,16 @@ void stm32_peripherals_rtc_set_time(timeutils_struct_time_t *tm) { // todo - throw an exception } - rtc_ticks_offset = stm32_peripherals_rtc_raw_ticks(NULL) - current_monotonic_ticks; - ; + uint8_t raw_subticks; + rtc_ticks_offset = stm32_peripherals_rtc_raw_ticks(&raw_subticks) - current_monotonic_ticks; + int8_t rtc_subticks_offset_signed = raw_subticks - current_monotonic_subticks; + // Difference might be negative. Normalize subticks to 0-31. + // `while` not really necessary; should only loop 0 or 1 times. + while (rtc_subticks_offset_signed < 0) { + rtc_ticks_offset--; + rtc_subticks_offset_signed += SUBTICKS_PER_TICK; + } + rtc_subticks_offset = (uint8_t)rtc_subticks_offset_signed; } #endif @@ -195,7 +220,7 @@ void stm32_peripherals_rtc_set_wakeup_mode_seconds(uint32_t seconds) { } void stm32_peripherals_rtc_set_wakeup_mode_tick(void) { - HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, (rtc_clock_frequency / 16) / TICK_DIVISOR, RTC_WAKEUPCLOCK_RTCCLK_DIV2); + HAL_RTCEx_SetWakeUpTimer_IT(&hrtc, (rtc_clock_frequency / 16) / TICKS_PER_SECOND, RTC_WAKEUPCLOCK_RTCCLK_DIV2); } void stm32_peripherals_rtc_enable_wakeup_timer(void) { @@ -223,9 +248,9 @@ void stm32_peripherals_rtc_set_alarm(uint8_t alarm_idx, uint32_t ticks) { uint64_t raw_ticks = stm32_peripherals_rtc_raw_ticks(NULL) + ticks; RTC_AlarmTypeDef alarm; - if (ticks > TICK_DIVISOR) { + if (ticks > TICKS_PER_SECOND) { timeutils_struct_time_t tm; - timeutils_seconds_since_2000_to_struct_time(raw_ticks / TICK_DIVISOR, &tm); + timeutils_seconds_since_2000_to_struct_time(raw_ticks / TICKS_PER_SECOND, &tm); alarm.AlarmTime.Hours = tm.tm_hour; alarm.AlarmTime.Minutes = tm.tm_min; alarm.AlarmTime.Seconds = tm.tm_sec; @@ -239,7 +264,7 @@ void stm32_peripherals_rtc_set_alarm(uint8_t alarm_idx, uint32_t ticks) { } alarm.AlarmTime.SubSeconds = rtc_clock_frequency - 1 - - ((raw_ticks % TICK_DIVISOR) * 32); + ((raw_ticks % TICKS_PER_SECOND) * SUBTICKS_PER_TICK); if (alarm.AlarmTime.SubSeconds > rtc_clock_frequency) { alarm.AlarmTime.SubSeconds = alarm.AlarmTime.SubSeconds + rtc_clock_frequency; diff --git a/shared-module/time/__init__.c b/shared-module/time/__init__.c index b4575b18a2..7d4f585ea1 100644 --- a/shared-module/time/__init__.c +++ b/shared-module/time/__init__.c @@ -38,6 +38,8 @@ uint64_t common_hal_time_monotonic_ns(void) { uint64_t ticks = port_get_raw_ticks(&subticks); // A tick is 976562.5 nanoseconds so multiply it by the base and add half instead of doing float // math. + // A subtick is 1/32 of a tick. + // 30518 is 1e9 / 32768 return 976562 * ticks + ticks / 2 + 30518 * subticks; } From 522c5a9a114c616d1daf6a9c495039b3c8e99bb4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 12 May 2023 11:49:08 -0500 Subject: [PATCH 1033/1712] synthio: fix crash on synthesizer.press((float,)) --- shared-module/synthio/Synthesizer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index c18c067976..54bc283148 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -110,11 +110,12 @@ void common_hal_synthio_synthesizer_press(synthio_synthesizer_obj_t *self, mp_ob mp_obj_t iterable = mp_getiter(to_press, &iter_buf); mp_obj_t note_obj; while ((note_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { + note_obj = validate_note(note_obj); if (!mp_obj_is_small_int(note_obj)) { synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); synthio_note_start(note, self->synth.sample_rate); } - synthio_span_change_note(&self->synth, SYNTHIO_SILENCE, validate_note(note_obj)); + synthio_span_change_note(&self->synth, SYNTHIO_SILENCE, note_obj); } } From 03abc623efc34910d4e430e4bbd995cf30a93b25 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 12 May 2023 13:44:27 -0500 Subject: [PATCH 1034/1712] synthio: note: fix assigning bend & tremolo coefficients dynamically --- shared-module/synthio/Note.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index 16727b2152..680c1c1a1d 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -85,7 +85,7 @@ mp_float_t common_hal_synthio_note_get_tremolo_depth(synthio_note_obj_t *self) { void common_hal_synthio_note_set_tremolo_depth(synthio_note_obj_t *self, mp_float_t value_in) { mp_float_t val = mp_arg_validate_float_range(value_in, 0, 1, MP_QSTR_tremolo_depth); self->tremolo_descr.amplitude = val; - self->tremolo_state.amplitude_scaled = round_float_to_int(val * 32767); + self->tremolo_state.amplitude_scaled = round_float_to_int(val * 32768); } mp_float_t common_hal_synthio_note_get_tremolo_rate(synthio_note_obj_t *self) { @@ -96,7 +96,7 @@ void common_hal_synthio_note_set_tremolo_rate(synthio_note_obj_t *self, mp_float mp_float_t val = mp_arg_validate_float_range(value_in, 0, 60, MP_QSTR_tremolo_rate); self->tremolo_descr.frequency = val; if (self->sample_rate != 0) { - self->tremolo_state.dds = synthio_frequency_convert_float_to_dds(val, self->sample_rate); + self->tremolo_state.dds = synthio_frequency_convert_float_to_dds(val * 65536, self->sample_rate); } } @@ -107,7 +107,7 @@ mp_float_t common_hal_synthio_note_get_bend_depth(synthio_note_obj_t *self) { void common_hal_synthio_note_set_bend_depth(synthio_note_obj_t *self, mp_float_t value_in) { mp_float_t val = mp_arg_validate_float_range(value_in, -1, 1, MP_QSTR_bend_depth); self->bend_descr.amplitude = val; - self->bend_state.amplitude_scaled = round_float_to_int(val * 32767); + self->bend_state.amplitude_scaled = round_float_to_int(val * 32768); } mp_float_t common_hal_synthio_note_get_bend_rate(synthio_note_obj_t *self) { @@ -127,7 +127,7 @@ void common_hal_synthio_note_set_bend_rate(synthio_note_obj_t *self, mp_float_t mp_float_t val = mp_arg_validate_float_range(value_in, 0, 60, MP_QSTR_bend_rate); self->bend_descr.frequency = val; if (self->sample_rate != 0) { - self->bend_state.dds = synthio_frequency_convert_float_to_dds(val, self->sample_rate); + self->bend_state.dds = synthio_frequency_convert_float_to_dds(val * 65536, self->sample_rate); } } From f68ab9c5c2d81fd91af163fc868c53acdd99b907 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 12 May 2023 13:44:49 -0500 Subject: [PATCH 1035/1712] synthio: Fix FIR filtering when audio is stereo --- shared-module/synthio/__init__.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 2fed9a5122..6b6a45f446 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -314,19 +314,21 @@ STATIC void run_fir(synthio_synth_t *synth, int32_t *out_buffer32, uint16_t dur) size_t fir_len = synth->filter_bufinfo.len / sizeof(int16_t); int32_t *in_buf = synth->filter_buffer; + + int synth_chan = synth->channel_count; // FIR and copy values to output buffer - for (int16_t i = 0; i < dur; i++) { + for (int16_t i = 0; i < dur * synth_chan; i++) { int32_t acc = 0; for (size_t j = 0; j < fir_len; j++) { // shift 5 here is good for up to 32 filtered voices, else might wrap - acc = acc + (in_buf[j] * (coeff[j] >> 5)); + acc = acc + (in_buf[j * synth_chan] * (coeff[j] >> 5)); } *out_buffer32++ = acc >> 10; in_buf++; } // Move values down so that they get filtered next time - memmove(synth->filter_buffer, &synth->filter_buffer[dur], fir_len * sizeof(int32_t)); + memmove(synth->filter_buffer, &synth->filter_buffer[dur * synth_chan], fir_len * sizeof(int32_t) * synth_chan); } STATIC bool synthio_synth_get_note_filtered(mp_obj_t note_obj) { @@ -359,7 +361,7 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t if (synth->filter_buffer) { int32_t *filter_start = &synth->filter_buffer[synth->filter_bufinfo.len * synth->channel_count / sizeof(int16_t)]; - memset(filter_start, 0, dur * sizeof(int32_t)); + memset(filter_start, 0, dur * synth->channel_count * sizeof(int32_t)); for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { mp_obj_t note_obj = synth->span.note_obj[chan]; From 91a51039108e4f8f3c390ed39b5d90f7d3ef6e0f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 12 May 2023 13:57:33 -0500 Subject: [PATCH 1036/1712] synthio: add a host demo of all major features --- .../circuitpython-manual/synthio/note/demo.py | 282 ++++++++++++++++++ 1 file changed, 282 insertions(+) create mode 100644 tests/circuitpython-manual/synthio/note/demo.py diff --git a/tests/circuitpython-manual/synthio/note/demo.py b/tests/circuitpython-manual/synthio/note/demo.py new file mode 100644 index 0000000000..49a811fd43 --- /dev/null +++ b/tests/circuitpython-manual/synthio/note/demo.py @@ -0,0 +1,282 @@ +import random +import audiocore +import synthio +from ulab import numpy as np +import adafruit_wave as wave + +h = np.array( + [ + -0.001229734800309099, + -0.008235561806605458, + -0.015082497016061390, + -0.020940136918319988, + -0.024981800822463429, + -0.026464233332370746, + -0.024803890156806906, + -0.019642276775473012, + -0.010893620860173042, + 0.001230341899766145, + 0.016221637398855598, + 0.033304135659230648, + 0.051486665261155681, + 0.069636961761409016, + 0.086570197432542767, + 0.101144354207918147, + 0.112353938422488253, + 0.119413577288191297, + 0.121823886314051028, + 0.119413577288191297, + 0.112353938422488253, + 0.101144354207918147, + 0.086570197432542767, + 0.069636961761409016, + 0.051486665261155681, + 0.033304135659230648, + 0.016221637398855598, + 0.001230341899766145, + -0.010893620860173042, + -0.019642276775473012, + -0.024803890156806906, + -0.026464233332370746, + -0.024981800822463429, + -0.020940136918319988, + -0.015082497016061390, + -0.008235561806605458, + -0.001229734800309099, + ] +) + +filter_coeffs = np.array(h[::-1] * 32768, dtype=np.int16) + + +def randf(lo, hi): + return random.random() * (hi - lo) + lo + + +SAMPLE_SIZE = 1024 +VOLUME = 14700 +sine = np.array( + np.sin(np.linspace(0, 2 * np.pi, SAMPLE_SIZE, endpoint=False)) * VOLUME, dtype=np.int16 +) +square = np.array([24000] * (SAMPLE_SIZE // 2) + [-24000] * (SAMPLE_SIZE // 2), dtype=np.int16) + +noise = np.array( + [random.randint(-32768, 32767) for i in range(SAMPLE_SIZE)], + dtype=np.int16, +) + +envelope = synthio.Envelope( + attack_time=0.1, decay_time=0.05, release_time=0.2, attack_level=1, sustain_level=0.8 +) + +instant = synthio.Envelope( + attack_time=0, decay_time=0, release_time=0, attack_level=1, sustain_level=1 +) +synth = synthio.Synthesizer( + sample_rate=48000, envelope=None, filter=filter_coeffs, channel_count=2 +) + + +def synthesize(synth): + print( + """you can use arbitrary waveforms, including ones calculated on the fly or read from wave files (up to 1024 points)""" + ) + + waveform = np.zeros(SAMPLE_SIZE, dtype=np.int16) + chord = [ + synthio.Note(synthio.midi_to_hz(n), waveform=waveform, envelope=envelope) + for n in (60, 64, 67, 70) + ] + synth.press(chord) + + for i in range(256): + ctrl = i / 255 + waveform[:] = np.array(square * (1 - ctrl) + sine * ctrl, dtype=np.int16) + yield 4 + + +def synthesize2(synth): + print("""Envelope controls how notes fade in or out""") + + chord = [ + synthio.Note(synthio.midi_to_hz(n), waveform=sine, envelope=instant) + for n in (60, 64, 67, 70) + ] + + for i in range(4): + for c in chord: + synth.release_all_then_press((c,)) + yield 24 + synth.release_all() + + chord = [ + synthio.Note(synthio.midi_to_hz(n), waveform=sine, envelope=envelope) + for n in (60, 64, 67, 70) + ] + + for i in range(4): + for c in chord: + old = (c,) + synth.release_all_then_press((c,)) + yield 24 + + +def synthesize3(synth): + print("""A noise waveform creates percussive sounds""") + + env = synthio.Envelope( + attack_time=0, + decay_time=0.2, + sustain_level=0, + ) + + notes = [ + synthio.Note( + frequency=synthio.midi_to_hz(1 + i), + waveform=noise, + envelope=env, + ) + for i in range(12) + ] + + random.seed(9) + for _ in range(16): + n = random.choice(notes) + d = random.randint(30, 60) + synth.press((n,)) + yield d + + +def synthesize4(synth): + print("""Tremolo varies the note volume within a range at a low frequency""") + + chord = [ + synthio.Note(synthio.midi_to_hz(n), waveform=sine, envelope=None) for n in (60, 64, 67, 70) + ] + + synth.press(chord) + for i in range(16): + for c in chord: + c.tremolo_depth = i / 50 + c.tremolo_rate = (i + 1) / 4 + yield 48 + yield 36 + + +def synthesize5(synth): + print("""You can add vibrato or frequency sweep to notes""") + + chord = [synthio.Note(synthio.midi_to_hz(n), waveform=sine) for n in (60, 64, 67, 70)] + + synth.press(chord) + for i in range(16): + for c in chord: + c.bend_depth = 1 / 24 + c.bend_rate = (i + 1) / 2 + yield 24 + synth.release_all() + yield 100 + + for c in chord: + synth.release_all() + c.bend_mode = synthio.BendMode.SWEEP_IN + c.bend_depth = randf(-1, 1) + c.bend_rate = 1 / 2 + synth.press(chord) + yield 320 + + +def synthesize6(synth): + print("""Ring modulation multiplies two waveforms together to create rich sounds""") + + chord = [ + synthio.Note(synthio.midi_to_hz(n), waveform=square, ring_waveform=sine, envelope=envelope) + for n in (60,) + ] + + synth.press(chord) + yield 200 + + random.seed(75) + + for _ in range(3): + synth.release_all() + yield 36 + for note in chord: + note.ring_frequency = note.frequency * (random.random() * 35 / 1200 + 8) + synth.press(chord) + yield 200 + + +def synthesize7(synth): + print("""FIR filtering can reproduce low, high, notch and band filters""") + chord = [ + synthio.Note(synthio.midi_to_hz(n), waveform=square, filter=False) + for n in (60, 64, 67, 70) + ] + + for i in range(4): + for c in chord: + synth.release_all_then_press((c,)) + yield 24 + synth.release_all() + + for note in chord: + note.filter = True + + for i in range(4): + for c in chord: + synth.release_all_then_press((c,)) + yield 24 + + +def synthesize8(synth): + print("""Notes can be panned between channels""") + chord = [ + synthio.Note(synthio.midi_to_hz(n), waveform=square, envelope=envelope) + for n in (60, 64, 67, 70) + ] + synth.press(chord) + for p in range(-10, 11, 1): + for note in chord: + note.panning = p / 10 + yield 36 + + +def delay(synth): + synth.release_all() + yield 200 + + +def chain(*args): + for a in args: + yield from a + + +# sox -r 48000 -e signed -b 16 -c 1 tune.raw tune.wav +with wave.open("demo.wav", "w") as f: + f.setnchannels(2) + f.setsampwidth(2) + f.setframerate(48000) + import array + + for n in chain( + synthesize(synth), + delay(synth), + synthesize2(synth), + delay(synth), + synthesize3(synth), + delay(synth), + synthesize4(synth), + delay(synth), + synthesize5(synth), + delay(synth), + synthesize6(synth), + delay(synth), + synthesize7(synth), + delay(synth), + synthesize8(synth), + ): + for i in range(n): + result, data = audiocore.get_buffer(synth) + f.writeframes(data) From fe386e7c738ad01bc106e00a675928ba9b4b6a4b Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 12 May 2023 15:29:59 -0400 Subject: [PATCH 1037/1712] adafruit_bus_device SPIDevice can have None for chip select --- .../adafruit_bus_device/spi_device/SPIDevice.c | 10 +++++----- .../adafruit_bus_device/spi_device/SPIDevice.c | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c index 6108247aa1..13b57477e4 100644 --- a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c +++ b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c @@ -44,7 +44,7 @@ //| def __init__( //| self, //| spi: busio.SPI, -//| chip_select: digitalio.DigitalInOut, +//| chip_select: Optional[digitalio.DigitalInOut] = None, //| *, //| baudrate: int = 100000, //| polarity: int = 0, @@ -55,7 +55,7 @@ //| Represents a single SPI device and manages locking the bus and the device address. //| //| :param ~busio.SPI spi: The SPI bus the device is on -//| :param ~digitalio.DigitalInOut chip_select: The chip select pin object that implements the DigitalInOut API. +//| :param ~digitalio.DigitalInOut chip_select: The chip select pin object that implements the DigitalInOut API. ``None`` if a chip select pin is not being used. //| :param bool cs_active_value: Set to true if your device requires CS to be active high. Defaults to false. //| :param int extra_clocks: The minimum number of clock cycles to cycle the bus after CS is high. (Used for SD cards.) //| @@ -84,7 +84,7 @@ STATIC mp_obj_t adafruit_bus_device_spidevice_make_new(const mp_obj_type_t *type enum { ARG_spi, ARG_chip_select, ARG_cs_active_value, ARG_baudrate, ARG_polarity, ARG_phase, ARG_extra_clocks }; static const mp_arg_t allowed_args[] = { { MP_QSTR_spi, MP_ARG_REQUIRED | MP_ARG_OBJ }, - { MP_QSTR_chip_select, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_chip_select, MP_ARG_OBJ, {.u_obj = mp_const_none} }, { MP_QSTR_cs_active_value, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = false} }, { MP_QSTR_baudrate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 100000} }, { MP_QSTR_polarity, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, @@ -96,12 +96,12 @@ STATIC mp_obj_t adafruit_bus_device_spidevice_make_new(const mp_obj_type_t *type busio_spi_obj_t *spi = args[ARG_spi].u_obj; - mp_arg_validate_type(args[ARG_chip_select].u_obj, &digitalio_digitalinout_type, MP_QSTR_chip_select); + mp_arg_validate_type_or_none(args[ARG_chip_select].u_obj, &digitalio_digitalinout_type, MP_QSTR_chip_select); common_hal_adafruit_bus_device_spidevice_construct(MP_OBJ_TO_PTR(self), spi, args[ARG_chip_select].u_obj, args[ARG_cs_active_value].u_bool, args[ARG_baudrate].u_int, args[ARG_polarity].u_int, args[ARG_phase].u_int, args[ARG_extra_clocks].u_int); - if (args[ARG_chip_select].u_obj != MP_OBJ_NULL) { + if (args[ARG_chip_select].u_obj != mp_const_none) { digitalinout_result_t result = common_hal_digitalio_digitalinout_switch_to_output(MP_OBJ_TO_PTR(args[ARG_chip_select].u_obj), true, DRIVE_MODE_PUSH_PULL); #if CIRCUITPY_DIGITALIO_HAVE_INPUT_ONLY diff --git a/shared-module/adafruit_bus_device/spi_device/SPIDevice.c b/shared-module/adafruit_bus_device/spi_device/SPIDevice.c index 2f4ab4dddf..9c5d62cbe5 100644 --- a/shared-module/adafruit_bus_device/spi_device/SPIDevice.c +++ b/shared-module/adafruit_bus_device/spi_device/SPIDevice.c @@ -38,6 +38,7 @@ void common_hal_adafruit_bus_device_spidevice_construct(adafruit_bus_device_spid self->polarity = polarity; self->phase = phase; self->extra_clocks = extra_clocks; + // May be mp_const_none if CS not used. self->chip_select = cs; self->cs_active_value = cs_active_value; } @@ -66,14 +67,14 @@ mp_obj_t common_hal_adafruit_bus_device_spidevice_enter(adafruit_bus_device_spid mp_call_method_n_kw(0, 4, dest); } - if (self->chip_select != MP_OBJ_NULL) { + if (self->chip_select != mp_const_none) { common_hal_digitalio_digitalinout_set_value(MP_OBJ_TO_PTR(self->chip_select), self->cs_active_value); } return self->spi; } void common_hal_adafruit_bus_device_spidevice_exit(adafruit_bus_device_spidevice_obj_t *self) { - if (self->chip_select != MP_OBJ_NULL) { + if (self->chip_select != mp_const_none) { common_hal_digitalio_digitalinout_set_value(MP_OBJ_TO_PTR(self->chip_select), !(self->cs_active_value)); } From bd2c1198d9fa94cb70d15ff38e52823277b2de94 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 12 May 2023 14:51:59 -0700 Subject: [PATCH 1038/1712] Minor C3 debug tweaks --- ports/espressif/Makefile | 30 +++++++++++-------- .../common-hal/microcontroller/Pin.c | 5 ++++ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 2151c8e03c..740a87e322 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -120,19 +120,25 @@ CFLAGS += -DSTACK_CANARY_VALUE=0xa5a5a5a5 #Debugging/Optimization ifeq ($(DEBUG), 1) - CFLAGS += -DDEBUG -ggdb - OPTIMIZATION_FLAGS ?= -Og - # You may want to enable these flags to make setting breakpoints easier. - # CFLAGS += -fno-inline -fno-ipa-sra + CFLAGS += -ggdb + ifeq ($(IDF_TARGET_ARCH),riscv) + OPTIMIZATION_FLAGS ?= -Os + CFLAGS += -DNDEBUG + else + OPTIMIZATION_FLAGS ?= -Og + CFLAGS += -DDEBUG + endif + # You may want to enable these flags to make setting breakpoints easier. + # CFLAGS += -fno-inline -fno-ipa-sra else - CFLAGS += -DNDEBUG -ggdb3 - # RISC-V is larger than xtensa - # Use -Os for RISC-V when it overflows - ifeq ($(IDF_TARGET_ARCH),riscv) - OPTIMIZATION_FLAGS ?= -Os - else - OPTIMIZATION_FLAGS ?= -O2 - endif + CFLAGS += -DNDEBUG -ggdb3 + # RISC-V is larger than xtensa + # Use -Os for RISC-V when it overflows + ifeq ($(IDF_TARGET_ARCH),riscv) + OPTIMIZATION_FLAGS ?= -Os + else + OPTIMIZATION_FLAGS ?= -O2 + endif endif # option to override compiler optimization level, set in boards/$(BOARD)/mpconfigboard.mk diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index 12081c7e40..7c0d05526f 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -62,6 +62,11 @@ static const uint64_t pin_mask_reset_forbidden = GPIO_SEL_18 | // USB D- GPIO_SEL_19 | // USB D+ #endif + #if CONFIG_ESP_CONSOLE_UART_DEFAULT && CONFIG_ESP_CONSOLE_UART_NUM == 0 + // Never reset debug UART/console pins. + GPIO_SEL_20 | + GPIO_SEL_21 | + #endif #endif // ESP32C3 #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) From bd097de27787baaa3ec073d2247b8cb6638474b0 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 12 May 2023 16:49:11 -0700 Subject: [PATCH 1039/1712] Check usb/jtag for incoming chars too --- ports/espressif/supervisor/usb_serial_jtag.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ports/espressif/supervisor/usb_serial_jtag.c b/ports/espressif/supervisor/usb_serial_jtag.c index 646d2c3a5e..9350d1bf97 100644 --- a/ports/espressif/supervisor/usb_serial_jtag.c +++ b/ports/espressif/supervisor/usb_serial_jtag.c @@ -101,21 +101,28 @@ bool usb_serial_jtag_connected(void) { } char usb_serial_jtag_read_char(void) { - if (ringbuf_num_filled(&ringbuf) == 0) { + if (ringbuf_num_filled(&ringbuf) == 0 && !usb_serial_jtag_ll_rxfifo_data_available()) { return -1; } - char c = ringbuf_get(&ringbuf); + char c = -1; + if (ringbuf_num_filled(&ringbuf) > 0) { + c = ringbuf_get(&ringbuf); + } // Maybe re-enable the recv interrupt if we've emptied the ringbuf. if (ringbuf_num_filled(&ringbuf) == 0) { usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT); _copy_out_of_fifo(); usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT); + // May have only been ctrl-c. + if (c == -1 && ringbuf_num_filled(&ringbuf) > 0) { + c = ringbuf_get(&ringbuf); + } } return c; } bool usb_serial_jtag_bytes_available(void) { - return ringbuf_num_filled(&ringbuf) > 0; + return ringbuf_num_filled(&ringbuf) > 0 || usb_serial_jtag_ll_rxfifo_data_available(); } void usb_serial_jtag_write(const char *text, uint32_t length) { From 8a3dc929208ab68f3a97bba1f2b117979ec1e206 Mon Sep 17 00:00:00 2001 From: Eric Rong Date: Fri, 12 May 2023 17:45:33 -0700 Subject: [PATCH 1040/1712] Update with the official VID/PID for CircuitPython --- .../boards/lilygo_t_display_rp2040/mpconfigboard.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.mk index 005429e0ff..3306fc01a6 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.mk +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/mpconfigboard.mk @@ -1,5 +1,5 @@ -USB_VID = 0x303A -USB_PID = 0x8008 +USB_VID = 0x1209 +USB_PID = 0x2023 USB_PRODUCT = "T-Display" USB_MANUFACTURER = "Lilygo" From 285131a87a7e89ccc679712c7b0f51696b8bcf15 Mon Sep 17 00:00:00 2001 From: Eric Rong Date: Fri, 12 May 2023 18:04:07 -0700 Subject: [PATCH 1041/1712] Update typo on pin GP2 --- ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c index 16ba17dba9..22816201d6 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c @@ -8,7 +8,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_BUTTON_L), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, From 49a5518bd3edc76f3772930e49f24a95e5e62b06 Mon Sep 17 00:00:00 2001 From: Eric Rong Date: Fri, 12 May 2023 18:19:49 -0700 Subject: [PATCH 1042/1712] Attempt to fix build error --- ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c index d99578984a..1d0fdf0b14 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c @@ -30,8 +30,6 @@ #include "shared-module/displayio/__init__.h" #include "shared-module/displayio/mipi_constants.h" -displayio_fourwire_obj_t board_display_obj; - #define DELAY 0x80 #define LCD_POWER 22 From 91380f19571d9b0f83b77234b3e096b31f063478 Mon Sep 17 00:00:00 2001 From: Eric Rong Date: Fri, 12 May 2023 22:28:11 -0700 Subject: [PATCH 1043/1712] Update to use new display construct. --- ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c index 1d0fdf0b14..3d00f460ee 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c @@ -66,7 +66,8 @@ uint8_t display_init_sequence[] = { }; static void display_init(void) { - busio_spi_obj_t *spi = &displays[0].fourwire_bus.inline_bus; + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct( spi, @@ -77,7 +78,6 @@ static void display_init(void) { 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( @@ -91,7 +91,7 @@ static void display_init(void) { 0 // phase ); - displayio_display_obj_t *display = &displays[0].display; + displayio_display_obj_t *display = &allocate_display()->display; display->base.type = &displayio_display_type; common_hal_displayio_display_construct( From 16c8c9a739cfe0db2c712696eb340de2d7944d41 Mon Sep 17 00:00:00 2001 From: Neradoc Date: Sat, 13 May 2023 22:13:47 +0200 Subject: [PATCH 1044/1712] Add the Feather RP2040 button to the board module --- ports/raspberrypi/boards/adafruit_feather_rp2040/pins.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040/pins.c b/ports/raspberrypi/boards/adafruit_feather_rp2040/pins.c index a6bcaea125..d965768fa4 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040/pins.c +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040/pins.c @@ -26,8 +26,11 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { 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_LED), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_BOOT), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO16) }, From 8196366c944a660726dd149490a8d91fc3b634ab Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Sat, 13 May 2023 22:06:16 -0500 Subject: [PATCH 1045/1712] initial --- ports/raspberrypi/common-hal/wifi/Radio.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index 12674a499b..ae011d5d9f 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -359,11 +359,11 @@ void common_hal_wifi_radio_stop_dhcp_client(wifi_radio_obj_t *self) { } void common_hal_wifi_radio_start_dhcp_server(wifi_radio_obj_t *self) { - mp_raise_NotImplementedError(NULL); + dhcp_stop(NETIF_AP); } void common_hal_wifi_radio_stop_dhcp_server(wifi_radio_obj_t *self) { - mp_raise_NotImplementedError(NULL); + dhcp_stop(NETIF_AP); } void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway, mp_obj_t ipv4_dns) { @@ -380,7 +380,15 @@ void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv } void common_hal_wifi_radio_set_ipv4_address_ap(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway) { - mp_raise_NotImplementedError(NULL); + common_hal_wifi_radio_stop_dhcp_server(self); + + ip4_addr_t ipv4_addr, netmask_addr, gateway_addr; + ipaddress_ipaddress_to_lwip(ipv4, &ipv4_addr); + ipaddress_ipaddress_to_lwip(netmask, &netmask_addr); + ipaddress_ipaddress_to_lwip(gateway, &gateway_addr); + netif_set_addr(NETIF_AP, &ipv4_addr, &netmask_addr, &gateway_addr); + + common_hal_wifi_radio_start_dhcp_server(self); } volatile bool ping_received; From cd41fb101af9a6be6a0e8852474f3051d605150d Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Sat, 13 May 2023 22:55:08 -0500 Subject: [PATCH 1046/1712] oops --- ports/raspberrypi/common-hal/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index ae011d5d9f..31a57cbe1a 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -359,7 +359,7 @@ void common_hal_wifi_radio_stop_dhcp_client(wifi_radio_obj_t *self) { } void common_hal_wifi_radio_start_dhcp_server(wifi_radio_obj_t *self) { - dhcp_stop(NETIF_AP); + dhcp_start(NETIF_AP); } void common_hal_wifi_radio_stop_dhcp_server(wifi_radio_obj_t *self) { From 6dd2e8672703d4a9e00560df62359219e26e93c0 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Sun, 14 May 2023 14:52:49 -0500 Subject: [PATCH 1047/1712] remove dhcp calls --- ports/raspberrypi/common-hal/wifi/Radio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index 31a57cbe1a..77fcd01391 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -359,11 +359,9 @@ void common_hal_wifi_radio_stop_dhcp_client(wifi_radio_obj_t *self) { } void common_hal_wifi_radio_start_dhcp_server(wifi_radio_obj_t *self) { - dhcp_start(NETIF_AP); } void common_hal_wifi_radio_stop_dhcp_server(wifi_radio_obj_t *self) { - dhcp_stop(NETIF_AP); } void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway, mp_obj_t ipv4_dns) { From 4ac7e7643a40b2c9fffedcc60eb69cc2b94db2f6 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Sun, 14 May 2023 17:44:27 -0500 Subject: [PATCH 1048/1712] netutils dhcp server --- ports/raspberrypi/common-hal/wifi/Radio.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index 77fcd01391..667a16d755 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -48,6 +48,8 @@ #include "lwip/raw.h" #include "lwip_src/ping.h" +#include "shared/netutils/dhcpserver.h" + #define MAC_ADDRESS_LENGTH 6 #define NETIF_STA (&cyw43_state.netif[CYW43_ITF_STA]) @@ -359,9 +361,14 @@ void common_hal_wifi_radio_stop_dhcp_client(wifi_radio_obj_t *self) { } void common_hal_wifi_radio_start_dhcp_server(wifi_radio_obj_t *self) { + ip4_addr_t ipv4_addr, netmask_addr; + ipaddress_ipaddress_to_lwip(common_hal_wifi_radio_get_ipv4_address_ap(self), &ipv4_addr); + ipaddress_ipaddress_to_lwip(common_hal_wifi_radio_get_ipv4_subnet_ap(self), &netmask_addr); + dhcp_server_init(&cyw43_state.dhcp_server, &ipv4_addr, &netmask_addr); } void common_hal_wifi_radio_stop_dhcp_server(wifi_radio_obj_t *self) { + dhcp_server_deinit(&cyw43_state.dhcp_server); } void common_hal_wifi_radio_set_ipv4_address(wifi_radio_obj_t *self, mp_obj_t ipv4, mp_obj_t netmask, mp_obj_t gateway, mp_obj_t ipv4_dns) { From ed31c7dc8f8cb630e36b89753aa769d01bdb2dbd Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Mon, 15 May 2023 22:38:59 +0300 Subject: [PATCH 1049/1712] Await down on stop_station --- ports/raspberrypi/common-hal/wifi/Radio.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index 12674a499b..76375ad2fc 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -161,7 +161,15 @@ void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self) { // (by tcpip_link_status). However since ap disconnection isn't working // either, this is not an issue. cyw43_wifi_leave(&cyw43_state, CYW43_ITF_AP); - + size_t timeout_ms = (size_t)MICROPY_FLOAT_C_FUN(ceil)(500); + uint64_t start = port_get_raw_ticks(NULL); + uint64_t deadline = start + timeout_ms; + while (port_get_raw_ticks(NULL) < deadline && (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_DOWN)) { + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + break; + } + } bindings_cyw43_wifi_enforce_pm(); } From 10b2e6bb4ac58899e43f1c6ff6bcb8914e7da943 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 15 May 2023 13:04:12 -0700 Subject: [PATCH 1050/1712] Add defined check --- ports/espressif/common-hal/microcontroller/Pin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index 7c0d05526f..003543a043 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -62,7 +62,7 @@ static const uint64_t pin_mask_reset_forbidden = GPIO_SEL_18 | // USB D- GPIO_SEL_19 | // USB D+ #endif - #if CONFIG_ESP_CONSOLE_UART_DEFAULT && CONFIG_ESP_CONSOLE_UART_NUM == 0 + #if defined(CONFIG_ESP_CONSOLE_UART_DEFAULT) && CONFIG_ESP_CONSOLE_UART_DEFAULT && CONFIG_ESP_CONSOLE_UART_NUM == 0 // Never reset debug UART/console pins. GPIO_SEL_20 | GPIO_SEL_21 | From 0f96711ccd55dedbc596922aacc074a4ab89b8b3 Mon Sep 17 00:00:00 2001 From: Phil Underwood Date: Mon, 15 May 2023 21:35:16 +0100 Subject: [PATCH 1051/1712] Fix for #2204 --- py/gc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/py/gc.c b/py/gc.c index 1812507c61..d723272f04 100644 --- a/py/gc.c +++ b/py/gc.c @@ -1013,6 +1013,7 @@ bool gc_never_free(void *ptr) { // Pointers are stored in a linked list where each block is BYTES_PER_BLOCK long and the first // pointer is the next block of pointers. void **current_reference_block = MP_STATE_MEM(permanent_pointers); + void **last_reference_block = NULL; while (current_reference_block != NULL) { for (size_t i = 1; i < BYTES_PER_BLOCK / sizeof(void *); i++) { if (current_reference_block[i] == NULL) { @@ -1020,6 +1021,7 @@ bool gc_never_free(void *ptr) { return true; } } + last_reference_block = current_reference_block; // keep a record of last "proper" reference block current_reference_block = current_reference_block[0]; } void **next_block = gc_alloc(BYTES_PER_BLOCK, false, true); @@ -1029,7 +1031,7 @@ bool gc_never_free(void *ptr) { if (MP_STATE_MEM(permanent_pointers) == NULL) { MP_STATE_MEM(permanent_pointers) = next_block; } else { - current_reference_block[0] = next_block; + last_reference_block[0] = next_block; } next_block[1] = ptr; return true; From 95c1d849d391a1e66b62f7481843b39b968240a8 Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Tue, 16 May 2023 04:47:44 +0300 Subject: [PATCH 1052/1712] Just 500 Co-authored-by: Dan Halbert --- ports/raspberrypi/common-hal/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index 76375ad2fc..aa603f1be3 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -161,7 +161,7 @@ void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self) { // (by tcpip_link_status). However since ap disconnection isn't working // either, this is not an issue. cyw43_wifi_leave(&cyw43_state, CYW43_ITF_AP); - size_t timeout_ms = (size_t)MICROPY_FLOAT_C_FUN(ceil)(500); + const size_t timeout_ms = 500; uint64_t start = port_get_raw_ticks(NULL); uint64_t deadline = start + timeout_ms; while (port_get_raw_ticks(NULL) < deadline && (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_DOWN)) { From f83212314e6d255bce757e0ab5b0df5f77a6b122 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 15 May 2023 10:49:42 -0500 Subject: [PATCH 1053/1712] synthio: Add LFOs --- .../unix/variants/coverage/mpconfigvariant.mk | 2 + py/circuitpy_defns.mk | 1 + shared-bindings/synthio/LFO.c | 234 ++++++++++++++++++ shared-bindings/synthio/LFO.h | 53 ++++ shared-bindings/synthio/Note.c | 180 ++++++-------- shared-bindings/synthio/Note.h | 30 +-- shared-bindings/synthio/__init__.c | 61 ++--- shared-bindings/util.c | 11 +- shared-bindings/util.h | 7 +- shared-module/synthio/LFO.c | 155 ++++++++++++ shared-module/synthio/LFO.h | 62 +++++ shared-module/synthio/Note.c | 137 ++++------ shared-module/synthio/Note.h | 12 +- shared-module/synthio/__init__.c | 12 +- shared-module/synthio/__init__.h | 4 + .../circuitpython-manual/synthio/note/demo.py | 13 +- .../synthio/note/envelope.py | 3 + tests/circuitpython/synthesizer_note.py.exp | 50 ++-- 18 files changed, 722 insertions(+), 305 deletions(-) create mode 100644 shared-bindings/synthio/LFO.c create mode 100644 shared-bindings/synthio/LFO.h create mode 100644 shared-module/synthio/LFO.c create mode 100644 shared-module/synthio/LFO.h diff --git a/ports/unix/variants/coverage/mpconfigvariant.mk b/ports/unix/variants/coverage/mpconfigvariant.mk index 41f44df2b4..8af5eea172 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.mk +++ b/ports/unix/variants/coverage/mpconfigvariant.mk @@ -42,6 +42,7 @@ SRC_BITMAP := \ shared-bindings/struct/__init__.c \ shared-bindings/synthio/__init__.c \ shared-bindings/synthio/MidiTrack.c \ + shared-bindings/synthio/LFO.c \ shared-bindings/synthio/Note.c \ shared-bindings/synthio/Synthesizer.c \ shared-bindings/traceback/__init__.c \ @@ -65,6 +66,7 @@ SRC_BITMAP := \ shared-module/struct/__init__.c \ shared-module/synthio/__init__.c \ shared-module/synthio/MidiTrack.c \ + shared-module/synthio/LFO.c \ shared-module/synthio/Note.c \ shared-module/synthio/Synthesizer.c \ shared-module/traceback/__init__.c \ diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 553490d99b..44f896cb7b 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -650,6 +650,7 @@ SRC_SHARED_MODULE_ALL = \ struct/__init__.c \ supervisor/__init__.c \ supervisor/StatusBar.c \ + synthio/LFO.c \ synthio/MidiTrack.c \ synthio/Note.c \ synthio/Synthesizer.c \ diff --git a/shared-bindings/synthio/LFO.c b/shared-bindings/synthio/LFO.c new file mode 100644 index 0000000000..ce64881f7d --- /dev/null +++ b/shared-bindings/synthio/LFO.c @@ -0,0 +1,234 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Artyom Skrobov + * Copyright (c) 2023 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/obj.h" +#include "py/objproperty.h" +#include "py/runtime.h" +#include "shared-bindings/util.h" +#include "shared-bindings/synthio/LFO.h" +#include "shared-module/synthio/LFO.h" + +//| class LFO: +//| """A low-frequency oscillator +//| +//| Every `rate` seconds, the output of the LFO cycles through its `waveform`. +//| The output at any particular moment is ``waveform[idx] * scale + offset``. +//| Internally, the calculation takes place in fixed point for speed. +//| +//| `rate`, `offset`, `scale`, and `once` can be changed at run-time. +//| +//| An LFO only updates if it is actually associated with a playing Note, +//| including if it is indirectly associated with the Note via an intermediate +//| LFO. +//| +//| Using the same LFO as an input to multiple other LFOs or Notes is OK, but +//| the result if an LFO is tied to multiple Synthtesizer objects is undefined.""" +//| +//| def __init__( +//| self, +//| waveform: ReadableBuffer, +//| *, +//| rate: BlockInput = 1.0, +//| scale: BlockInput = 1.0, +//| offset: BlockInput = 0, +//| once=False +//| ): +//| pass +static const mp_arg_t lfo_properties[] = { + { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = NULL } }, + { MP_QSTR_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, + { MP_QSTR_scale, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, + { MP_QSTR_offset, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } }, + { MP_QSTR_once, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } }, +}; + +STATIC mp_obj_t synthio_lfo_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_waveform }; // others never directly referred to by argument number + + mp_arg_val_t args[MP_ARRAY_SIZE(lfo_properties)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(lfo_properties), lfo_properties, args); + + synthio_lfo_obj_t *self = m_new_obj(synthio_lfo_obj_t); + self->base.type = &synthio_lfo_type; + + synthio_synth_parse_waveform(&self->waveform_bufinfo, args[ARG_waveform].u_obj); + self->waveform_obj = args[ARG_waveform].u_obj; + self->last_tick = synthio_global_tick; + + mp_obj_t result = MP_OBJ_FROM_PTR(self); + properties_construct_helper(result, lfo_properties + 1, args + 1, MP_ARRAY_SIZE(lfo_properties) - 1); + + return result; +}; + +//| waveform: Optional[ReadableBuffer] +//| """The waveform of this lfo. (read-only, but the values in the buffer may be modified dynamically)""" +STATIC mp_obj_t synthio_lfo_get_waveform(mp_obj_t self_in) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_synthio_lfo_get_waveform_obj(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_lfo_get_waveform_obj, synthio_lfo_get_waveform); + +MP_PROPERTY_GETTER(synthio_lfo_waveform_obj, + (mp_obj_t)&synthio_lfo_get_waveform_obj); + +//| rate: BlockInput +//| """The rate (in Hz) at which the LFO cycles through its waveform""" +STATIC mp_obj_t synthio_lfo_get_rate(mp_obj_t self_in) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_synthio_lfo_get_rate_obj(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_lfo_get_rate_obj, synthio_lfo_get_rate); + +STATIC mp_obj_t synthio_lfo_set_rate(mp_obj_t self_in, mp_obj_t arg) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_lfo_set_rate_obj(self, arg); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_lfo_set_rate_obj, synthio_lfo_set_rate); +MP_PROPERTY_GETSET(synthio_lfo_rate_obj, + (mp_obj_t)&synthio_lfo_get_rate_obj, + (mp_obj_t)&synthio_lfo_set_rate_obj); + + +//| offset: BlockInput +//| """An additive value applied to the LFO's output""" +STATIC mp_obj_t synthio_lfo_get_offset(mp_obj_t self_in) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_synthio_lfo_get_offset_obj(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_lfo_get_offset_obj, synthio_lfo_get_offset); + +STATIC mp_obj_t synthio_lfo_set_offset(mp_obj_t self_in, mp_obj_t arg) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_lfo_set_offset_obj(self, arg); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_lfo_set_offset_obj, synthio_lfo_set_offset); +MP_PROPERTY_GETSET(synthio_lfo_offset_obj, + (mp_obj_t)&synthio_lfo_get_offset_obj, + (mp_obj_t)&synthio_lfo_set_offset_obj); + +//| scale: BlockInput +//| """An additive value applied to the LFO's output""" +STATIC mp_obj_t synthio_lfo_get_scale(mp_obj_t self_in) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_synthio_lfo_get_scale_obj(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_lfo_get_scale_obj, synthio_lfo_get_scale); + +STATIC mp_obj_t synthio_lfo_set_scale(mp_obj_t self_in, mp_obj_t arg) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_lfo_set_scale_obj(self, arg); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_lfo_set_scale_obj, synthio_lfo_set_scale); +MP_PROPERTY_GETSET(synthio_lfo_scale_obj, + (mp_obj_t)&synthio_lfo_get_scale_obj, + (mp_obj_t)&synthio_lfo_set_scale_obj); + +//| +//| once: bool +//| """True if the waveform should stop when it reaches its last output value, false if it should re-start at the beginning of its waveform""" +STATIC mp_obj_t synthio_lfo_get_once(mp_obj_t self_in) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_bool(common_hal_synthio_lfo_get_once(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_lfo_get_once_obj, synthio_lfo_get_once); + +STATIC mp_obj_t synthio_lfo_set_once(mp_obj_t self_in, mp_obj_t arg) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_lfo_set_once(self, mp_obj_is_true(arg)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_lfo_set_once_obj, synthio_lfo_set_once); +MP_PROPERTY_GETSET(synthio_lfo_once_obj, + (mp_obj_t)&synthio_lfo_get_once_obj, + (mp_obj_t)&synthio_lfo_set_once_obj); + + +//| +//| phase: float +//| """The phase of the oscillator, in the range 0 to 1 (read-only)""" +STATIC mp_obj_t synthio_lfo_get_phase(mp_obj_t self_in) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_synthio_lfo_get_phase(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_lfo_get_phase_obj, synthio_lfo_get_phase); + +MP_PROPERTY_GETTER(synthio_lfo_phase_obj, + (mp_obj_t)&synthio_lfo_get_phase_obj); + + +//| +//| value: float +//| """The value of the oscillator (read-only)""" +STATIC mp_obj_t synthio_lfo_get_value(mp_obj_t self_in) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_synthio_lfo_get_value(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_lfo_get_value_obj, synthio_lfo_get_value); + +MP_PROPERTY_GETTER(synthio_lfo_value_obj, + (mp_obj_t)&synthio_lfo_get_value_obj); + + +//| +//| def retrigger(self): +//| """Reset the LFO's internal index to the start of the waveform. Most useful when it its `once` property is `True`.""" +//| +STATIC mp_obj_t synthio_lfo_retrigger(mp_obj_t self_in) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_lfo_retrigger(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_lfo_retrigger_obj, synthio_lfo_retrigger); + +static void lfo_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { + (void)kind; + properties_print_helper(print, self_in, lfo_properties, MP_ARRAY_SIZE(lfo_properties)); +} + +STATIC const mp_rom_map_elem_t synthio_lfo_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_waveform), MP_ROM_PTR(&synthio_lfo_waveform_obj) }, + { MP_ROM_QSTR(MP_QSTR_rate), MP_ROM_PTR(&synthio_lfo_rate_obj) }, + { MP_ROM_QSTR(MP_QSTR_scale), MP_ROM_PTR(&synthio_lfo_scale_obj) }, + { MP_ROM_QSTR(MP_QSTR_offset), MP_ROM_PTR(&synthio_lfo_offset_obj) }, + { MP_ROM_QSTR(MP_QSTR_once), MP_ROM_PTR(&synthio_lfo_once_obj) }, + { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&synthio_lfo_value_obj) }, + { MP_ROM_QSTR(MP_QSTR_phase), MP_ROM_PTR(&synthio_lfo_phase_obj) }, + { MP_ROM_QSTR(MP_QSTR_retrigger), MP_ROM_PTR(&synthio_lfo_retrigger_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(synthio_lfo_locals_dict, synthio_lfo_locals_dict_table); + +const mp_obj_type_t synthio_lfo_type = { + { &mp_type_type }, + .name = MP_QSTR_LFO, + .make_new = synthio_lfo_make_new, + .locals_dict = (mp_obj_dict_t *)&synthio_lfo_locals_dict, + .print = lfo_print, +}; diff --git a/shared-bindings/synthio/LFO.h b/shared-bindings/synthio/LFO.h new file mode 100644 index 0000000000..e0123dc5b2 --- /dev/null +++ b/shared-bindings/synthio/LFO.h @@ -0,0 +1,53 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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" + +typedef struct synthio_lfo_obj synthio_lfo_obj_t; +extern const mp_obj_type_t synthio_lfo_type; + +mp_obj_t common_hal_synthio_lfo_get_waveform_obj(synthio_lfo_obj_t *self); +void common_hal_synthio_lfo_set_waveform_obj(synthio_lfo_obj_t *self, mp_obj_t arg); + +mp_obj_t common_hal_synthio_lfo_get_rate_obj(synthio_lfo_obj_t *self); +void common_hal_synthio_lfo_set_rate_obj(synthio_lfo_obj_t *self, mp_obj_t arg); + +mp_obj_t common_hal_synthio_lfo_get_scale_obj(synthio_lfo_obj_t *self); +void common_hal_synthio_lfo_set_scale_obj(synthio_lfo_obj_t *self, mp_obj_t arg); + +mp_obj_t common_hal_synthio_lfo_get_offset_obj(synthio_lfo_obj_t *self); +void common_hal_synthio_lfo_set_offset_obj(synthio_lfo_obj_t *self, mp_obj_t arg); + +bool common_hal_synthio_lfo_get_once(synthio_lfo_obj_t *self); +void common_hal_synthio_lfo_set_once(synthio_lfo_obj_t *self, bool arg); + +mp_float_t common_hal_synthio_lfo_get_value(synthio_lfo_obj_t *self); + +mp_float_t common_hal_synthio_lfo_get_phase(synthio_lfo_obj_t *self); + +void common_hal_synthio_lfo_retrigger(synthio_lfo_obj_t *self); diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index f058b16d2e..a0b258653f 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -37,15 +37,13 @@ static const mp_arg_t note_properties[] = { { MP_QSTR_frequency, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = NULL } }, { MP_QSTR_panning, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } }, - { MP_QSTR_tremolo_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, - { MP_QSTR_tremolo_depth, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, - { MP_QSTR_bend_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, - { MP_QSTR_bend_depth, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = NULL } }, - { MP_QSTR_bend_mode, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = (mp_obj_t)MP_ROM_PTR(&bend_mode_VIBRATO_obj) } }, + { MP_QSTR_amplitude, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, + { MP_QSTR_bend, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } }, { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, { MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, { MP_QSTR_filter, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, - { MP_QSTR_ring_frequency, MP_ARG_OBJ, {.u_obj = NULL } }, + { MP_QSTR_ring_frequency, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(0) } }, + { MP_QSTR_ring_bend, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(0) } }, { MP_QSTR_ring_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, }; //| class Note: @@ -53,14 +51,11 @@ static const mp_arg_t note_properties[] = { //| self, //| *, //| frequency: float, -//| panning: float = 0.0, +//| panning: BlockInput = 0.0, //| waveform: Optional[ReadableBuffer] = None, //| envelope: Optional[Envelope] = None, -//| tremolo_depth: float = 0.0, -//| tremolo_rate: float = 0.0, -//| bend_depth: float = 0.0, -//| bend_rate: float = 0.0, -//| bend_mode: "BendMode" = BendMode.VIBRATO, +//| amplitude: BlockInput = 0.0, +//| bend: BlockInput = 0.0, //| ) -> None: //| """Construct a Note object, with a frequency in Hz, and optional panning, waveform, envelope, tremolo (volume change) and bend (frequency change). //| @@ -76,16 +71,12 @@ STATIC mp_obj_t synthio_note_make_new(const mp_obj_type_t *type_in, size_t n_arg self->base.type = &synthio_note_type; mp_obj_t result = MP_OBJ_FROM_PTR(self); - for (size_t i = 0; i < MP_ARRAY_SIZE(note_properties); i++) { - if (args[i].u_obj != NULL) { - mp_store_attr(result, note_properties[i].qst, args[i].u_obj); - } - } + properties_construct_helper(result, note_properties, args, MP_ARRAY_SIZE(note_properties)); return result; }; -//| frequency: float +//| frequency: BlockInput //| """The base frequency of the note, in Hz.""" STATIC mp_obj_t synthio_note_get_frequency(mp_obj_t self_in) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -121,7 +112,7 @@ MP_PROPERTY_GETSET(synthio_note_filter_obj, (mp_obj_t)&synthio_note_get_filter_obj, (mp_obj_t)&synthio_note_set_filter_obj); -//| panning: float +//| panning: BlockInput //| """Defines the channel(s) in which the note appears. //| //| -1 is left channel only, 0 is both channels, and 1 is right channel. @@ -130,13 +121,13 @@ MP_PROPERTY_GETSET(synthio_note_filter_obj, //| amplitude in the left channel and 1/2 amplitude in the right channel.""" STATIC mp_obj_t synthio_note_get_panning(mp_obj_t self_in) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_float(common_hal_synthio_note_get_panning(self)); + return common_hal_synthio_note_get_panning(self); } MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_panning_obj, synthio_note_get_panning); STATIC mp_obj_t synthio_note_set_panning(mp_obj_t self_in, mp_obj_t arg) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_synthio_note_set_panning(self, mp_obj_get_float(arg)); + common_hal_synthio_note_set_panning(self, arg); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_panning_obj, synthio_note_set_panning); @@ -145,108 +136,54 @@ MP_PROPERTY_GETSET(synthio_note_panning_obj, (mp_obj_t)&synthio_note_set_panning_obj); -//| tremolo_depth: float -//| """The tremolo depth of the note, from 0 to 1 +//| amplitude: BlockInput +//| """The relative amplitude of the note, from 0 to 1 //| -//| A depth of 0 disables tremolo. A nonzero value enables tremolo, -//| with the maximum decrease in amplitude being equal to the tremolo -//| depth. A note with a tremolo depth of 1 will fade out to nothing, while -//| a tremolo depth of 0.1 will give a minimum amplitude of 0.9.""" -STATIC mp_obj_t synthio_note_get_tremolo_depth(mp_obj_t self_in) { +//| An amplitude of 0 makes the note inaudible. It is combined multiplicatively with +//| the value from the note's envelope. +//| +//| To achieve a tremolo effect, attach an LFO here.""" +STATIC mp_obj_t synthio_note_get_amplitude(mp_obj_t self_in) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_float(common_hal_synthio_note_get_tremolo_depth(self)); + return common_hal_synthio_note_get_amplitude(self); } -MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_tremolo_depth_obj, synthio_note_get_tremolo_depth); +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_amplitude_obj, synthio_note_get_amplitude); -STATIC mp_obj_t synthio_note_set_tremolo_depth(mp_obj_t self_in, mp_obj_t arg) { +STATIC mp_obj_t synthio_note_set_amplitude(mp_obj_t self_in, mp_obj_t arg) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_synthio_note_set_tremolo_depth(self, mp_obj_get_float(arg)); + common_hal_synthio_note_set_amplitude(self, arg); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_tremolo_depth_obj, synthio_note_set_tremolo_depth); -MP_PROPERTY_GETSET(synthio_note_tremolo_depth_obj, - (mp_obj_t)&synthio_note_get_tremolo_depth_obj, - (mp_obj_t)&synthio_note_set_tremolo_depth_obj); - -//| tremolo_rate: float -//| """The tremolo rate of the note, in Hz.""" -STATIC mp_obj_t synthio_note_get_tremolo_rate(mp_obj_t self_in) { - synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_float(common_hal_synthio_note_get_tremolo_rate(self)); -} -MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_tremolo_rate_obj, synthio_note_get_tremolo_rate); - -STATIC mp_obj_t synthio_note_set_tremolo_rate(mp_obj_t self_in, mp_obj_t arg) { - synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_synthio_note_set_tremolo_rate(self, mp_obj_get_float(arg)); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_tremolo_rate_obj, synthio_note_set_tremolo_rate); -MP_PROPERTY_GETSET(synthio_note_tremolo_rate_obj, - (mp_obj_t)&synthio_note_get_tremolo_rate_obj, - (mp_obj_t)&synthio_note_set_tremolo_rate_obj); +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_amplitude_obj, synthio_note_set_amplitude); +MP_PROPERTY_GETSET(synthio_note_amplitude_obj, + (mp_obj_t)&synthio_note_get_amplitude_obj, + (mp_obj_t)&synthio_note_set_amplitude_obj); //| -//| bend_mode: BendMode -//| """The type of bend operation""" -STATIC mp_obj_t synthio_note_get_bend_mode(mp_obj_t self_in) { - synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - return cp_enum_find(&synthio_bend_mode_type, common_hal_synthio_note_get_bend_mode(self)); -} -MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_bend_mode_obj, synthio_note_get_bend_mode); - -STATIC mp_obj_t synthio_note_set_bend_mode(mp_obj_t self_in, mp_obj_t arg) { - synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_synthio_note_set_bend_mode(self, cp_enum_value(&synthio_bend_mode_type, arg, MP_QSTR_bend_mode)); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_bend_mode_obj, synthio_note_set_bend_mode); -MP_PROPERTY_GETSET(synthio_note_bend_mode_obj, - (mp_obj_t)&synthio_note_get_bend_mode_obj, - (mp_obj_t)&synthio_note_set_bend_mode_obj); - -// +//| bend: BlockInput +//| """The pitch bend depth of the note, from -1 to +1 //| -//| bend_depth: float -//| """The bend depth of the note, from -1 to +1 -//| -//| A depth of 0 disables bend. A depth of 1 corresponds to a bend of 1 +//| A depth of 0 plays the programmed frequency. A depth of 1 corresponds to a bend of 1 //| octave. A depth of (1/12) = 0.833 corresponds to a bend of 1 semitone, -//| and a depth of .00833 corresponds to one musical cent. +//| and a depth of .00833 corresponds to one musical cent. Values of ±1 octave are supported. +//| +//| To achieve a vibrato or sweep effect, attach an LFO here. //| """ -STATIC mp_obj_t synthio_note_get_bend_depth(mp_obj_t self_in) { +STATIC mp_obj_t synthio_note_get_bend(mp_obj_t self_in) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_float(common_hal_synthio_note_get_bend_depth(self)); + return common_hal_synthio_note_get_bend(self); } -MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_bend_depth_obj, synthio_note_get_bend_depth); +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_bend_obj, synthio_note_get_bend); -STATIC mp_obj_t synthio_note_set_bend_depth(mp_obj_t self_in, mp_obj_t arg) { +STATIC mp_obj_t synthio_note_set_bend(mp_obj_t self_in, mp_obj_t arg) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_synthio_note_set_bend_depth(self, mp_obj_get_float(arg)); + common_hal_synthio_note_set_bend(self, arg); return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_bend_depth_obj, synthio_note_set_bend_depth); -MP_PROPERTY_GETSET(synthio_note_bend_depth_obj, - (mp_obj_t)&synthio_note_get_bend_depth_obj, - (mp_obj_t)&synthio_note_set_bend_depth_obj); - -//| bend_rate: float -//| """The bend rate of the note, in Hz.""" -STATIC mp_obj_t synthio_note_get_bend_rate(mp_obj_t self_in) { - synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_float(common_hal_synthio_note_get_bend_rate(self)); -} -MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_bend_rate_obj, synthio_note_get_bend_rate); - -STATIC mp_obj_t synthio_note_set_bend_rate(mp_obj_t self_in, mp_obj_t arg) { - synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_synthio_note_set_bend_rate(self, mp_obj_get_float(arg)); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_bend_rate_obj, synthio_note_set_bend_rate); -MP_PROPERTY_GETSET(synthio_note_bend_rate_obj, - (mp_obj_t)&synthio_note_get_bend_rate_obj, - (mp_obj_t)&synthio_note_set_bend_rate_obj); +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_bend_obj, synthio_note_set_bend); +MP_PROPERTY_GETSET(synthio_note_bend_obj, + (mp_obj_t)&synthio_note_get_bend_obj, + (mp_obj_t)&synthio_note_set_bend_obj); //| waveform: Optional[ReadableBuffer] //| """The waveform of this note. Setting the waveform to a buffer of a different size resets the note's phase.""" @@ -306,6 +243,31 @@ MP_PROPERTY_GETSET(synthio_note_ring_frequency_obj, (mp_obj_t)&synthio_note_get_ring_frequency_obj, (mp_obj_t)&synthio_note_set_ring_frequency_obj); +//| ring_bend: float +//| """The pitch bend depth of the note's ring waveform, from -1 to +1 +//| +//| A depth of 0 plays the programmed frequency. A depth of 1 corresponds to a bend of 1 +//| octave. A depth of (1/12) = 0.833 corresponds to a bend of 1 semitone, +//| and a depth of .00833 corresponds to one musical cent. Values of ±1 octave are supported. +//| +//| To achieve a vibrato or sweep effect on the ring waveform, attach an LFO here. +//| """ +STATIC mp_obj_t synthio_note_get_ring_bend(mp_obj_t self_in) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_synthio_note_get_ring_bend(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_ring_bend_obj, synthio_note_get_ring_bend); + +STATIC mp_obj_t synthio_note_set_ring_bend(mp_obj_t self_in, mp_obj_t arg) { + synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_note_set_ring_bend(self, arg); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_ring_bend_obj, synthio_note_set_ring_bend); +MP_PROPERTY_GETSET(synthio_note_ring_bend_obj, + (mp_obj_t)&synthio_note_get_ring_bend_obj, + (mp_obj_t)&synthio_note_set_ring_bend_obj); + //| ring_waveform: Optional[ReadableBuffer] //| """The ring waveform of this note. Setting the ring_waveform to a buffer of a different size resets the note's phase. //| @@ -340,12 +302,10 @@ STATIC const mp_rom_map_elem_t synthio_note_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_panning), MP_ROM_PTR(&synthio_note_panning_obj) }, { MP_ROM_QSTR(MP_QSTR_waveform), MP_ROM_PTR(&synthio_note_waveform_obj) }, { MP_ROM_QSTR(MP_QSTR_envelope), MP_ROM_PTR(&synthio_note_envelope_obj) }, - { MP_ROM_QSTR(MP_QSTR_tremolo_depth), MP_ROM_PTR(&synthio_note_tremolo_depth_obj) }, - { MP_ROM_QSTR(MP_QSTR_tremolo_rate), MP_ROM_PTR(&synthio_note_tremolo_rate_obj) }, - { MP_ROM_QSTR(MP_QSTR_bend_depth), MP_ROM_PTR(&synthio_note_bend_depth_obj) }, - { MP_ROM_QSTR(MP_QSTR_bend_rate), MP_ROM_PTR(&synthio_note_bend_rate_obj) }, - { MP_ROM_QSTR(MP_QSTR_bend_mode), MP_ROM_PTR(&synthio_note_bend_mode_obj) }, + { MP_ROM_QSTR(MP_QSTR_amplitude), MP_ROM_PTR(&synthio_note_amplitude_obj) }, + { MP_ROM_QSTR(MP_QSTR_bend), MP_ROM_PTR(&synthio_note_bend_obj) }, { MP_ROM_QSTR(MP_QSTR_ring_frequency), MP_ROM_PTR(&synthio_note_ring_frequency_obj) }, + { MP_ROM_QSTR(MP_QSTR_ring_bend), MP_ROM_PTR(&synthio_note_ring_bend_obj) }, { MP_ROM_QSTR(MP_QSTR_ring_waveform), MP_ROM_PTR(&synthio_note_ring_waveform_obj) }, }; STATIC MP_DEFINE_CONST_DICT(synthio_note_locals_dict, synthio_note_locals_dict_table); diff --git a/shared-bindings/synthio/Note.h b/shared-bindings/synthio/Note.h index b87310576a..271268dc33 100644 --- a/shared-bindings/synthio/Note.h +++ b/shared-bindings/synthio/Note.h @@ -12,30 +12,24 @@ void common_hal_synthio_note_set_frequency(synthio_note_obj_t *self, mp_float_t bool common_hal_synthio_note_get_filter(synthio_note_obj_t *self); void common_hal_synthio_note_set_filter(synthio_note_obj_t *self, bool value); -mp_float_t common_hal_synthio_note_get_ring_frequency(synthio_note_obj_t *self); -void common_hal_synthio_note_set_ring_frequency(synthio_note_obj_t *self, mp_float_t value); +mp_obj_t common_hal_synthio_note_get_panning(synthio_note_obj_t *self); +void common_hal_synthio_note_set_panning(synthio_note_obj_t *self, mp_obj_t value); -mp_float_t common_hal_synthio_note_get_panning(synthio_note_obj_t *self); -void common_hal_synthio_note_set_panning(synthio_note_obj_t *self, mp_float_t value); +mp_obj_t common_hal_synthio_note_get_amplitude(synthio_note_obj_t *self); +void common_hal_synthio_note_set_amplitude(synthio_note_obj_t *self, mp_obj_t value); -mp_float_t common_hal_synthio_note_get_tremolo_rate(synthio_note_obj_t *self); -void common_hal_synthio_note_set_tremolo_rate(synthio_note_obj_t *self, mp_float_t value); - -mp_float_t common_hal_synthio_note_get_tremolo_depth(synthio_note_obj_t *self); -void common_hal_synthio_note_set_tremolo_depth(synthio_note_obj_t *self, mp_float_t value); - -synthio_bend_mode_t common_hal_synthio_note_get_bend_mode(synthio_note_obj_t *self); -void common_hal_synthio_note_set_bend_mode(synthio_note_obj_t *self, synthio_bend_mode_t value); - -mp_float_t common_hal_synthio_note_get_bend_rate(synthio_note_obj_t *self); -void common_hal_synthio_note_set_bend_rate(synthio_note_obj_t *self, mp_float_t value); - -mp_float_t common_hal_synthio_note_get_bend_depth(synthio_note_obj_t *self); -void common_hal_synthio_note_set_bend_depth(synthio_note_obj_t *self, mp_float_t value); +mp_obj_t common_hal_synthio_note_get_bend(synthio_note_obj_t *self); +void common_hal_synthio_note_set_bend(synthio_note_obj_t *self, mp_obj_t value); mp_obj_t common_hal_synthio_note_get_waveform_obj(synthio_note_obj_t *self); void common_hal_synthio_note_set_waveform(synthio_note_obj_t *self, mp_obj_t value); +mp_float_t common_hal_synthio_note_get_ring_frequency(synthio_note_obj_t *self); +void common_hal_synthio_note_set_ring_frequency(synthio_note_obj_t *self, mp_float_t value); + +mp_obj_t common_hal_synthio_note_get_ring_bend(synthio_note_obj_t *self); +void common_hal_synthio_note_set_ring_bend(synthio_note_obj_t *self, mp_obj_t value); + mp_obj_t common_hal_synthio_note_get_ring_waveform_obj(synthio_note_obj_t *self); void common_hal_synthio_note_set_ring_waveform(synthio_note_obj_t *self, mp_obj_t value); diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 132b254942..eb9df13a25 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include #include #include "py/enum.h" @@ -35,10 +36,13 @@ #include "extmod/vfs_posix.h" #include "shared-bindings/synthio/__init__.h" +#include "shared-bindings/synthio/LFO.h" #include "shared-bindings/synthio/MidiTrack.h" #include "shared-bindings/synthio/Note.h" #include "shared-bindings/synthio/Synthesizer.h" +#include "shared-module/synthio/LFO.h" + #define default_attack_time (MICROPY_FLOAT_CONST(0.1)) #define default_decay_time (MICROPY_FLOAT_CONST(0.05)) #define default_release_time (MICROPY_FLOAT_CONST(0.2)) @@ -57,9 +61,11 @@ static const mp_arg_t envelope_properties[] = { //| """Support for multi-channel audio synthesis //| //| At least 2 simultaneous notes are supported. samd5x, mimxrt10xx and rp2040 platforms support up to 12 notes. -//| //| """ //| +//| BlockInput = Union["LFO", float] +//| """LFOs and Notes can take any of these types as inputs on certain attributes""" +//| //| class Envelope: //| def __init__( //| self, @@ -283,51 +289,34 @@ STATIC mp_obj_t onevo_to_hz(mp_obj_t arg) { } MP_DEFINE_CONST_FUN_OBJ_1(synthio_onevo_to_hz_obj, onevo_to_hz); -MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, STATIC, SYNTHIO_BEND_MODE_STATIC); -MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, VIBRATO, SYNTHIO_BEND_MODE_VIBRATO); -MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, SWEEP, SYNTHIO_BEND_MODE_SWEEP); -MAKE_ENUM_VALUE(synthio_bend_mode_type, bend_mode, SWEEP_IN, SYNTHIO_BEND_MODE_SWEEP_IN); - -//| -//| class BendMode: -//| """Controls the way the ``Note.pitch_bend_depth`` and ``Note.pitch_bend_rate`` properties are interpreted.""" -//| -//| STATIC: "BendMode" -//| """The Note's pitch is modified by its ``pitch_bend_depth``. ``pitch_bend_rate`` is ignored.""" -//| -//| VIBRATO: "BendMode" -//| """The Note's pitch varies by ``±pitch_bend_depth`` at a rate of ``pitch_bend_rate`` Hz.""" -//| -//| SWEEP: "BendMode" -//| """The Note's pitch starts at ``Note.frequency`` then sweeps up or down by ``pitch_bend_depth`` over ``1/pitch_bend_rate`` seconds.""" -//| -//| SWEEP_IN: "BendMode" -//| """The Note's pitch sweep is the reverse of ``SWEEP`` mode, starting at the bent pitch and arriving at the tuned pitch.""" -//| -MAKE_ENUM_MAP(synthio_bend_mode) { - MAKE_ENUM_MAP_ENTRY(bend_mode, STATIC), - MAKE_ENUM_MAP_ENTRY(bend_mode, VIBRATO), - MAKE_ENUM_MAP_ENTRY(bend_mode, SWEEP), - MAKE_ENUM_MAP_ENTRY(bend_mode, SWEEP_IN), -}; - -STATIC MP_DEFINE_CONST_DICT(synthio_bend_mode_locals_dict, synthio_bend_mode_locals_table); - -MAKE_PRINTER(synthio, synthio_bend_mode); - -MAKE_ENUM_TYPE(synthio, BendMode, synthio_bend_mode); - +#if CIRCUITPY_AUDIOCORE_DEBUG +STATIC mp_obj_t synthio_lfo_tick(size_t n, const mp_obj_t *args) { + shared_bindings_synthio_lfo_tick(48000); + mp_obj_t result[n]; + for (size_t i = 0; i < n; i++) { + synthio_lfo_slot_t slot; + synthio_lfo_assign_input(args[i], &slot, MP_QSTR_arg); + mp_float_t value = synthio_lfo_obj_tick(&slot); + result[i] = mp_obj_new_float(value); + } + return mp_obj_new_tuple(n, result); +} +MP_DEFINE_CONST_FUN_OBJ_VAR(synthio_lfo_tick_obj, 1, synthio_lfo_tick); +#endif STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_synthio) }, - { MP_ROM_QSTR(MP_QSTR_BendMode), MP_ROM_PTR(&synthio_bend_mode_type) }, { MP_ROM_QSTR(MP_QSTR_MidiTrack), MP_ROM_PTR(&synthio_miditrack_type) }, { MP_ROM_QSTR(MP_QSTR_Note), MP_ROM_PTR(&synthio_note_type) }, + { MP_ROM_QSTR(MP_QSTR_LFO), MP_ROM_PTR(&synthio_lfo_type) }, { MP_ROM_QSTR(MP_QSTR_Synthesizer), MP_ROM_PTR(&synthio_synthesizer_type) }, { MP_ROM_QSTR(MP_QSTR_from_file), MP_ROM_PTR(&synthio_from_file_obj) }, { MP_ROM_QSTR(MP_QSTR_Envelope), MP_ROM_PTR(&synthio_envelope_type_obj) }, { MP_ROM_QSTR(MP_QSTR_midi_to_hz), MP_ROM_PTR(&synthio_midi_to_hz_obj) }, { MP_ROM_QSTR(MP_QSTR_onevo_to_hz), MP_ROM_PTR(&synthio_midi_to_hz_obj) }, + #if CIRCUITPY_AUDIOCORE_DEBUG + { MP_ROM_QSTR(MP_QSTR_lfo_tick), MP_ROM_PTR(&synthio_lfo_tick_obj) }, + #endif }; STATIC MP_DEFINE_CONST_DICT(synthio_module_globals, synthio_module_globals_table); diff --git a/shared-bindings/util.c b/shared-bindings/util.c index 78960a7552..7cb0d51176 100644 --- a/shared-bindings/util.c +++ b/shared-bindings/util.c @@ -24,9 +24,6 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_UTIL_H -#define MICROPY_INCLUDED_SHARED_BINDINGS_UTIL_H - #include "py/runtime.h" #include "shared-bindings/util.h" @@ -50,4 +47,10 @@ void properties_print_helper(const mp_print_t *print, mp_obj_t self_in, const mp mp_print_str(print, ")"); } -#endif // MICROPY_INCLUDED_SHARED_BINDINGS_UTIL_H +void properties_construct_helper(mp_obj_t self_in, const mp_arg_t *args, const mp_arg_val_t *vals, size_t n_properties) { + for (size_t i = 0; i < n_properties; i++) { + if (vals[i].u_obj != NULL) { + mp_store_attr(self_in, args[i].qst, vals[i].u_obj); + } + } +} diff --git a/shared-bindings/util.h b/shared-bindings/util.h index b35e903d38..b03c5b67bb 100644 --- a/shared-bindings/util.h +++ b/shared-bindings/util.h @@ -24,14 +24,11 @@ * THE SOFTWARE. */ -#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_UTIL_H -#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_UTIL_H +#pragma once #include "py/mpprint.h" #include "py/runtime.h" void raise_deinited_error(void); void properties_print_helper(const mp_print_t *print, mp_obj_t self_in, const mp_arg_t *properties, size_t n_properties); - - -#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_UTIL_H +void properties_construct_helper(mp_obj_t self_in, const mp_arg_t *args, const mp_arg_val_t *vals, size_t n_properties); diff --git a/shared-module/synthio/LFO.c b/shared-module/synthio/LFO.c new file mode 100644 index 0000000000..b3f31e48f2 --- /dev/null +++ b/shared-module/synthio/LFO.c @@ -0,0 +1,155 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "shared-bindings/synthio/LFO.h" +#include "shared-module/synthio/LFO.h" +#include + +#define ONE (MICROPY_FLOAT_CONST(1.)) +#define ZERO (MICROPY_FLOAT_CONST(0.)) + + +mp_float_t synthio_lfo_obj_tick(synthio_lfo_slot_t *slot) { + mp_obj_t obj = slot->obj; + + if (!mp_obj_is_type(obj, &synthio_lfo_type)) { + return slot->value; + } + + synthio_lfo_obj_t *lfo = MP_OBJ_TO_PTR(obj); + if (lfo->last_tick == synthio_global_tick) { + slot->value = lfo->value; + return slot->value; + } + + lfo->last_tick = synthio_global_tick; + + mp_float_t rate = synthio_lfo_obj_tick(&lfo->rate) * synthio_global_rate_scale; + ; + + mp_float_t accum = lfo->accum + rate; + int len = lfo->waveform_bufinfo.len / 2; + mp_float_t frac = accum - MICROPY_FLOAT_C_FUN(floor)(accum); + size_t idx = (int)(frac * len); + + if (lfo->once) { + if (rate > 0) { + if (accum >= ONE) { + frac = ONE; + idx = len - 1; + } + } else if (rate < 0 && accum < ZERO) { + frac = ZERO; + idx = 0; + } + } + + lfo->accum = frac; + + int16_t *waveform = lfo->waveform_bufinfo.buf; + assert(idx < lfo->waveform_bufinfo.len / 2); + mp_float_t scale = synthio_lfo_obj_tick(&lfo->scale); + mp_float_t offset = synthio_lfo_obj_tick(&lfo->offset); + mp_float_t value = MICROPY_FLOAT_C_FUN(ldexp)(waveform[idx], -15) * scale + offset; + + lfo->value = slot->value = value; + return value; +} + +mp_float_t synthio_lfo_obj_tick_limited(synthio_lfo_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi) { + mp_float_t value = synthio_lfo_obj_tick(lfo_slot); + if (value < lo) { + return lo; + } + if (value > hi) { + return hi; + } + return value; +} + +int32_t synthio_lfo_obj_tick_scaled(synthio_lfo_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi, int shift) { + mp_float_t value = synthio_lfo_obj_tick_limited(lfo_slot, lo, hi); + return (int32_t)MICROPY_FLOAT_C_FUN(round)(MICROPY_FLOAT_C_FUN(ldexp)(value, shift)); +} + +void synthio_lfo_assign_input(mp_obj_t obj, synthio_lfo_slot_t *slot, qstr arg_name) { + if (mp_obj_is_type(obj, &synthio_lfo_type)) { + slot->obj = obj; + return; + } + + if (!mp_obj_get_float_maybe(obj, &slot->value)) { + mp_raise_TypeError_varg(translate("%q must be of type %q or %q, not %q"), arg_name, MP_QSTR_Lfo, MP_QSTR_float, mp_obj_get_type_qstr(obj)); + } + + slot->value = mp_obj_get_float(obj); + slot->obj = obj; +} + +mp_obj_t common_hal_synthio_lfo_get_waveform_obj(synthio_lfo_obj_t *self) { + return self->waveform_obj; +} + +mp_obj_t common_hal_synthio_lfo_get_rate_obj(synthio_lfo_obj_t *self) { + return self->rate.obj; +} + +void common_hal_synthio_lfo_set_rate_obj(synthio_lfo_obj_t *self, mp_obj_t arg) { + synthio_lfo_assign_input(arg, &self->rate, MP_QSTR_rate); +} + +mp_obj_t common_hal_synthio_lfo_get_scale_obj(synthio_lfo_obj_t *self) { + return self->scale.obj; +} +void common_hal_synthio_lfo_set_scale_obj(synthio_lfo_obj_t *self, mp_obj_t arg) { + synthio_lfo_assign_input(arg, &self->scale, MP_QSTR_scale); +} + +mp_obj_t common_hal_synthio_lfo_get_offset_obj(synthio_lfo_obj_t *self) { + return self->offset.obj; +} +void common_hal_synthio_lfo_set_offset_obj(synthio_lfo_obj_t *self, mp_obj_t arg) { + synthio_lfo_assign_input(arg, &self->offset, MP_QSTR_offset); +} + +bool common_hal_synthio_lfo_get_once(synthio_lfo_obj_t *self) { + return self->once; +} +void common_hal_synthio_lfo_set_once(synthio_lfo_obj_t *self, bool arg) { + self->once = arg; +} + +mp_float_t common_hal_synthio_lfo_get_value(synthio_lfo_obj_t *self) { + return self->value; +} + +mp_float_t common_hal_synthio_lfo_get_phase(synthio_lfo_obj_t *self) { + return self->accum; +} + +void common_hal_synthio_lfo_retrigger(synthio_lfo_obj_t *self) { + self->accum = 0; +} diff --git a/shared-module/synthio/LFO.h b/shared-module/synthio/LFO.h new file mode 100644 index 0000000000..8012d4c433 --- /dev/null +++ b/shared-module/synthio/LFO.h @@ -0,0 +1,62 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "shared-module/synthio/__init__.h" +#include "shared-bindings/synthio/__init__.h" + +typedef struct synthio_lfo_slot { + mp_obj_t obj; + mp_float_t value; +} synthio_lfo_slot_t; + +typedef struct synthio_lfo_obj { + mp_obj_base_t base; + + int32_t sample_rate; + + uint8_t last_tick; + bool once; + + synthio_lfo_slot_t rate, scale, offset; + mp_float_t accum, value; + + mp_obj_t waveform_obj; + mp_buffer_info_t waveform_bufinfo; +} synthio_lfo_obj_t; + +// Update the value inside the lfo slot if the value is an LFO, returning the new value +mp_float_t synthio_lfo_obj_tick(synthio_lfo_slot_t *lfo_slot); +// the same, but the output is constrained to be between lo and hi +mp_float_t synthio_lfo_obj_tick_limited(synthio_lfo_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi); +// the same, but the output is constrained to be between lo and hi and converted to an integer with `shift` fractional bits +int32_t synthio_lfo_obj_tick_scaled(synthio_lfo_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi, int shift); + +// Assign an object (which may be a float or a synthio_lfo_obj_t) to an lfo slot +void synthio_lfo_assign_input(mp_obj_t obj, synthio_lfo_slot_t *lfo_slot, qstr arg_name); diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index 680c1c1a1d..6f12166020 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -30,10 +30,6 @@ #include "shared-bindings/synthio/Note.h" #include "shared-bindings/synthio/__init__.h" -static int32_t round_float_to_int(mp_float_t f) { - return (int32_t)(f + MICROPY_FLOAT_CONST(0.5)); -} - mp_float_t common_hal_synthio_note_get_frequency(synthio_note_obj_t *self) { return self->frequency; } @@ -62,73 +58,36 @@ void common_hal_synthio_note_set_ring_frequency(synthio_note_obj_t *self, mp_flo self->ring_frequency_scaled = synthio_frequency_convert_float_to_scaled(val); } -mp_float_t common_hal_synthio_note_get_panning(synthio_note_obj_t *self) { - return self->panning; +mp_obj_t common_hal_synthio_note_get_panning(synthio_note_obj_t *self) { + return self->panning.obj; } -void common_hal_synthio_note_set_panning(synthio_note_obj_t *self, mp_float_t value_in) { - mp_float_t val = mp_arg_validate_float_range(value_in, -1, 1, MP_QSTR_panning); - self->panning = val; - if (val >= 0) { - self->left_panning_scaled = 32768; - self->right_panning_scaled = 32768 - round_float_to_int(val * 32768); - } else { - self->right_panning_scaled = 32768; - self->left_panning_scaled = 32768 + round_float_to_int(val * 32768); - } +void common_hal_synthio_note_set_panning(synthio_note_obj_t *self, mp_obj_t value_in) { + synthio_lfo_assign_input(value_in, &self->panning, MP_QSTR_panning); } -mp_float_t common_hal_synthio_note_get_tremolo_depth(synthio_note_obj_t *self) { - return self->tremolo_descr.amplitude; +mp_obj_t common_hal_synthio_note_get_amplitude(synthio_note_obj_t *self) { + return self->amplitude.obj; } -void common_hal_synthio_note_set_tremolo_depth(synthio_note_obj_t *self, mp_float_t value_in) { - mp_float_t val = mp_arg_validate_float_range(value_in, 0, 1, MP_QSTR_tremolo_depth); - self->tremolo_descr.amplitude = val; - self->tremolo_state.amplitude_scaled = round_float_to_int(val * 32768); +void common_hal_synthio_note_set_amplitude(synthio_note_obj_t *self, mp_obj_t value_in) { + synthio_lfo_assign_input(value_in, &self->amplitude, MP_QSTR_amplitude); } -mp_float_t common_hal_synthio_note_get_tremolo_rate(synthio_note_obj_t *self) { - return self->tremolo_descr.frequency; +mp_obj_t common_hal_synthio_note_get_bend(synthio_note_obj_t *self) { + return self->bend.obj; } -void common_hal_synthio_note_set_tremolo_rate(synthio_note_obj_t *self, mp_float_t value_in) { - mp_float_t val = mp_arg_validate_float_range(value_in, 0, 60, MP_QSTR_tremolo_rate); - self->tremolo_descr.frequency = val; - if (self->sample_rate != 0) { - self->tremolo_state.dds = synthio_frequency_convert_float_to_dds(val * 65536, self->sample_rate); - } +void common_hal_synthio_note_set_bend(synthio_note_obj_t *self, mp_obj_t value_in) { + synthio_lfo_assign_input(value_in, &self->bend, MP_QSTR_bend); } -mp_float_t common_hal_synthio_note_get_bend_depth(synthio_note_obj_t *self) { - return self->bend_descr.amplitude; +mp_obj_t common_hal_synthio_note_get_ring_bend(synthio_note_obj_t *self) { + return self->ring_bend.obj; } -void common_hal_synthio_note_set_bend_depth(synthio_note_obj_t *self, mp_float_t value_in) { - mp_float_t val = mp_arg_validate_float_range(value_in, -1, 1, MP_QSTR_bend_depth); - self->bend_descr.amplitude = val; - self->bend_state.amplitude_scaled = round_float_to_int(val * 32768); -} - -mp_float_t common_hal_synthio_note_get_bend_rate(synthio_note_obj_t *self) { - return self->bend_descr.frequency; -} - -synthio_bend_mode_t common_hal_synthio_note_get_bend_mode(synthio_note_obj_t *self) { - return self->bend_mode; -} - -void common_hal_synthio_note_set_bend_mode(synthio_note_obj_t *self, synthio_bend_mode_t value) { - self->bend_mode = value; -} - - -void common_hal_synthio_note_set_bend_rate(synthio_note_obj_t *self, mp_float_t value_in) { - mp_float_t val = mp_arg_validate_float_range(value_in, 0, 60, MP_QSTR_bend_rate); - self->bend_descr.frequency = val; - if (self->sample_rate != 0) { - self->bend_state.dds = synthio_frequency_convert_float_to_dds(val * 65536, self->sample_rate); - } +void common_hal_synthio_note_set_ring_bend(synthio_note_obj_t *self, mp_obj_t value_in) { + synthio_lfo_assign_input(value_in, &self->ring_bend, MP_QSTR_ring_bend); } mp_obj_t common_hal_synthio_note_get_envelope_obj(synthio_note_obj_t *self) { @@ -184,22 +143,10 @@ void synthio_note_recalculate(synthio_note_obj_t *self, int32_t sample_rate) { if (self->envelope_obj != mp_const_none) { synthio_envelope_definition_set(&self->envelope_def, self->envelope_obj, sample_rate); } - - synthio_lfo_set(&self->tremolo_state, &self->tremolo_descr, sample_rate); - self->tremolo_state.offset_scaled = 32768 - self->tremolo_state.amplitude_scaled; - synthio_lfo_set(&self->bend_state, &self->bend_descr, sample_rate); - self->bend_state.offset_scaled = 32768; } void synthio_note_start(synthio_note_obj_t *self, int32_t sample_rate) { synthio_note_recalculate(self, sample_rate); - if (self->bend_mode != SYNTHIO_BEND_MODE_VIBRATO) { - self->bend_state.phase = 0; - } -} - -uint32_t synthio_note_envelope(synthio_note_obj_t *self) { - return self->amplitude_scaled; } // Perform a pitch bend operation @@ -213,10 +160,10 @@ uint32_t synthio_note_envelope(synthio_note_obj_t *self) { STATIC uint16_t pitch_bend_table[] = { 0, 1948, 4013, 6200, 8517, 10972, 13573, 16329, 19248, 22341, 25618, 29090, 32768 }; -STATIC uint32_t pitch_bend(uint32_t frequency_scaled, uint16_t bend_value) { - bool down = (bend_value < 32768); - if (!down) { - bend_value -= 32768; +STATIC uint32_t pitch_bend(uint32_t frequency_scaled, int16_t bend_value) { + bool down = (bend_value < 0); + if (down) { + bend_value += 32768; } uint32_t bend_value_semitone = (uint32_t)bend_value * 24; // 65536/semitone uint32_t semitone = bend_value_semitone >> 16; @@ -227,26 +174,34 @@ STATIC uint32_t pitch_bend(uint32_t frequency_scaled, uint16_t bend_value) { return (frequency_scaled * (uint64_t)f) >> (15 + down); } -STATIC int synthio_bend_value(synthio_note_obj_t *self, int16_t dur) { - switch (self->bend_mode) { - case SYNTHIO_BEND_MODE_STATIC: - return self->bend_state.amplitude_scaled + self->bend_state.offset_scaled; - case SYNTHIO_BEND_MODE_VIBRATO: - return synthio_lfo_step(&self->bend_state, dur); - case SYNTHIO_BEND_MODE_SWEEP: - return synthio_sweep_step(&self->bend_state, dur); - case SYNTHIO_BEND_MODE_SWEEP_IN: - return synthio_sweep_in_step(&self->bend_state, dur); - default: - return 32768; - } -} +#define ZERO MICROPY_FLOAT_CONST(0.) +#define ONE MICROPY_FLOAT_CONST(1.) +#define ALMOST_ONE (MICROPY_FLOAT_CONST(32767.) / 32768) uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, uint16_t loudness[2]) { - int tremolo_value = synthio_lfo_step(&self->tremolo_state, dur); - loudness[0] = (((loudness[0] * tremolo_value) >> 15) * self->left_panning_scaled) >> 15; - loudness[1] = (((loudness[1] * tremolo_value) >> 15) * self->right_panning_scaled) >> 15; - int bend_value = synthio_bend_value(self, dur); + int panning = synthio_lfo_obj_tick_scaled(&self->panning, -ALMOST_ONE, ALMOST_ONE, 15); + int left_panning_scaled, right_panning_scaled; + if (panning >= 0) { + left_panning_scaled = 32768; + right_panning_scaled = 32767 - panning; + } else { + right_panning_scaled = 32768; + left_panning_scaled = 32767 + panning; + } + + int amplitude = synthio_lfo_obj_tick_scaled(&self->amplitude, ZERO, ALMOST_ONE, 15); + left_panning_scaled = (left_panning_scaled * amplitude) >> 15; + right_panning_scaled = (right_panning_scaled * amplitude) >> 15; + loudness[0] = (loudness[0] * left_panning_scaled) >> 15; + loudness[1] = (loudness[1] * right_panning_scaled) >> 15; + + if (self->ring_frequency_scaled != 0) { + int ring_bend_value = synthio_lfo_obj_tick_scaled(&self->ring_bend, -ONE, ALMOST_ONE, 15); + self->ring_frequency_bent = pitch_bend(self->ring_frequency_scaled, ring_bend_value); + } + + int bend_value = synthio_lfo_obj_tick_scaled(&self->bend, -ONE, ALMOST_ONE, 15); uint32_t frequency_scaled = pitch_bend(self->frequency_scaled, bend_value); return frequency_scaled; + } diff --git a/shared-module/synthio/Note.h b/shared-module/synthio/Note.h index d7b9a6f67f..6586e396a7 100644 --- a/shared-module/synthio/Note.h +++ b/shared-module/synthio/Note.h @@ -27,25 +27,22 @@ #pragma once #include "shared-module/synthio/__init__.h" +#include "shared-module/synthio/LFO.h" #include "shared-bindings/synthio/__init__.h" typedef struct synthio_note_obj { mp_obj_base_t base; + synthio_lfo_slot_t panning, bend, amplitude, ring_bend; + mp_float_t frequency, ring_frequency; - mp_float_t panning; mp_obj_t waveform_obj, envelope_obj, ring_waveform_obj; int32_t sample_rate; int32_t frequency_scaled; - int32_t ring_frequency_scaled; - int32_t amplitude_scaled; - int32_t left_panning_scaled, right_panning_scaled; + int32_t ring_frequency_scaled, ring_frequency_bent; bool filter; - synthio_bend_mode_t bend_mode; - synthio_lfo_descr_t tremolo_descr, bend_descr; - synthio_lfo_state_t tremolo_state, bend_state; mp_buffer_info_t waveform_buf; mp_buffer_info_t ring_waveform_buf; @@ -56,4 +53,3 @@ void synthio_note_recalculate(synthio_note_obj_t *self, int32_t sample_rate); uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, uint16_t loudness[2]); void synthio_note_start(synthio_note_obj_t *self, int32_t sample_rate); bool synthio_note_playing(synthio_note_obj_t *self); -uint32_t synthio_note_envelope(synthio_note_obj_t *self); diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 6b6a45f446..37ac87465e 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -32,6 +32,9 @@ #include #include +mp_float_t synthio_global_rate_scale; +uint8_t synthio_global_tick; + STATIC const int16_t square_wave[] = {-32768, 32767}; STATIC const uint16_t notes[] = {8372, 8870, 9397, 9956, 10548, 11175, 11840, @@ -219,7 +222,7 @@ static void synth_note_into_buffer(synthio_synth_t *synth, int chan, int32_t *ou if (note->ring_frequency_scaled != 0 && note->ring_waveform_buf.buf) { ring_waveform = note->ring_waveform_buf.buf; ring_waveform_length = note->ring_waveform_buf.len / sizeof(int16_t); - ring_dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)note->ring_frequency_scaled * ring_waveform_length, sample_rate); + ring_dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)note->ring_frequency_bent * ring_waveform_length, sample_rate); uint32_t lim = ring_waveform_length << SYNTHIO_FREQUENCY_SHIFT; if (ring_dds_rate > lim / sizeof(int16_t)) { ring_dds_rate = 0; // can't ring at that frequency @@ -350,6 +353,8 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t return; } + shared_bindings_synthio_lfo_tick(synth->sample_rate); + synth->buffer_index = !synth->buffer_index; synth->other_channel = 1 - channel; synth->other_buffer_index = synth->buffer_index; @@ -587,3 +592,8 @@ int synthio_lfo_step(synthio_lfo_state_t *state, uint16_t dur) { } return v / 16384 + state->offset_scaled; } + +void shared_bindings_synthio_lfo_tick(uint32_t sample_rate) { + synthio_global_rate_scale = (mp_float_t)SYNTHIO_MAX_DUR / sample_rate; + synthio_global_tick++; +} diff --git a/shared-module/synthio/__init__.h b/shared-module/synthio/__init__.h index a3d0ca57fd..5586ce87f9 100644 --- a/shared-module/synthio/__init__.h +++ b/shared-module/synthio/__init__.h @@ -112,3 +112,7 @@ void synthio_lfo_set(synthio_lfo_state_t *state, const synthio_lfo_descr_t *desc int synthio_lfo_step(synthio_lfo_state_t *state, uint16_t dur); int synthio_sweep_step(synthio_lfo_state_t *state, uint16_t dur); int synthio_sweep_in_step(synthio_lfo_state_t *state, uint16_t dur); + +extern mp_float_t synthio_global_rate_scale; +extern uint8_t synthio_global_tick; +void shared_bindings_synthio_lfo_tick(uint32_t sample_rate); diff --git a/tests/circuitpython-manual/synthio/note/demo.py b/tests/circuitpython-manual/synthio/note/demo.py index 49a811fd43..8320613f22 100644 --- a/tests/circuitpython-manual/synthio/note/demo.py +++ b/tests/circuitpython-manual/synthio/note/demo.py @@ -65,6 +65,8 @@ noise = np.array( dtype=np.int16, ) +bend_in = np.linspace(32767, 0, num=SAMPLE_SIZE, endpoint=True, dtype=np.int16) + envelope = synthio.Envelope( attack_time=0.1, decay_time=0.05, release_time=0.2, attack_level=1, sustain_level=0.8 ) @@ -157,8 +159,8 @@ def synthesize4(synth): synth.press(chord) for i in range(16): for c in chord: - c.tremolo_depth = i / 50 - c.tremolo_rate = (i + 1) / 4 + d = i / 50 + c.amplitude = synthio.LFO(scale=d / 2, offset=1 - d, rate=(i + 1) / 4, waveform=sine) yield 48 yield 36 @@ -171,17 +173,14 @@ def synthesize5(synth): synth.press(chord) for i in range(16): for c in chord: - c.bend_depth = 1 / 24 - c.bend_rate = (i + 1) / 2 + c.bend = synthio.LFO(scale=1 / 24, rate=(i + 1) / 2, waveform=sine) yield 24 synth.release_all() yield 100 for c in chord: synth.release_all() - c.bend_mode = synthio.BendMode.SWEEP_IN - c.bend_depth = randf(-1, 1) - c.bend_rate = 1 / 2 + c.bend = synthio.LFO(scale=randf(-1, 1), rate=1 / 2, waveform=bend_in) synth.press(chord) yield 320 diff --git a/tests/circuitpython-manual/synthio/note/envelope.py b/tests/circuitpython-manual/synthio/note/envelope.py index 9421cf8c1c..e5a9e957c8 100644 --- a/tests/circuitpython-manual/synthio/note/envelope.py +++ b/tests/circuitpython-manual/synthio/note/envelope.py @@ -25,6 +25,9 @@ fast_decay_envelope = synthio.Envelope( synth = synthio.Synthesizer(sample_rate=48000) +# for a note without sustain phase, +# switching to an envelope with decay_time 0.25 is about the same as +# releasing with a release time of 0.25 def synthesize(synth): notes = (synthio.Note(frequency=440, waveform=sine, envelope=envelope),) synth.press(notes) diff --git a/tests/circuitpython/synthesizer_note.py.exp b/tests/circuitpython/synthesizer_note.py.exp index 801f97131e..7b834870e9 100644 --- a/tests/circuitpython/synthesizer_note.py.exp +++ b/tests/circuitpython/synthesizer_note.py.exp @@ -1,30 +1,30 @@ () [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_waveform=None),) -[-16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383] -(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_waveform=None), Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_waveform=None)) -[0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046] -(Note(frequency=830.6076004423605, panning=0.0, tremolo_rate=0.0, tremolo_depth=0.0, bend_rate=0.0, bend_depth=0.0, bend_mode=synthio.BendMode.VIBRATO, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_waveform=None),) -[0, 0, 0, 28045, 0, 0, 0, 0, 0, 0, 0, 0, 28045, 0, 0, 0, 0, -28046, 0, 0, 0, 0, 28045, 0] -(-5242, 5242) -(-10485, 10484) -(-15727, 15727) -(-16383, 16383) -(-14286, 14286) -(-13106, 13106) -(-13106, 13106) -(-13106, 13106) -(-13106, 13106) -(-13106, 13106) -(-13106, 13106) -(-13106, 13106) -(-13106, 13106) -(-11009, 11009) -(-8912, 8912) -(-6815, 6815) -(-4718, 4718) -(-2621, 2621) -(-524, 524) +(Note(frequency=830.6076004423605, panning=0, amplitude=1, bend=0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0, ring_waveform=None),) +[-16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383] +(Note(frequency=830.6076004423605, panning=0, amplitude=1, bend=0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0, ring_waveform=None), Note(frequency=830.6076004423605, panning=0, amplitude=1, bend=0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0, ring_waveform=None)) +[-1, -1, -1, -1, -1, -1, -1, -1, 28045, -1, -1, -1, -1, -28046, -1, -1, -1, -1, 28045, -1, -1, -1, -1, -28046] +(Note(frequency=830.6076004423605, panning=0, amplitude=1, bend=0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0, ring_waveform=None),) +[-1, -1, -1, 28045, -1, -1, -1, -1, -1, -1, -1, -1, 28045, -1, -1, -1, -1, -28046, -1, -1, -1, -1, 28045, -1] +(-5242, 5241) +(-10484, 10484) +(-15727, 15726) +(-16383, 16382) +(-14286, 14285) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-13106, 13105) +(-11009, 11008) +(-8912, 8911) +(-6815, 6814) +(-4718, 4717) +(-2621, 2620) +(-524, 523) (0, 0) (0, 0) (0, 0) From 8ca87a5d273912d9747ddcb5659d63c3f9db83e2 Mon Sep 17 00:00:00 2001 From: silabs-ChatNguyen Date: Tue, 16 May 2023 09:46:15 +0700 Subject: [PATCH 1054/1712] Fix ble bonding fail --- ports/silabs/Makefile | 2 +- .../custom_brd2601b_cp_support.slcc | 1 - .../devkit_xg24_brd2601b/mpconfigboard.mk | 5 +- .../boards/devkit_xg24_brd2601b/pins.csv | 4 +- .../custom_brd2703a_cp_support.slcc | 2 - .../explorerkit_xg24_brd2703a/mpconfigboard.h | 4 +- .../mpconfigboard.mk | 1 + ports/silabs/circuitpython_efr32.slcp | 1 - ports/silabs/common-hal/_bleio/Adapter.c | 7 +-- ports/silabs/common-hal/_bleio/__init__.c | 54 ++++++------------- ports/silabs/common-hal/analogio/AnalogIn.c | 8 +-- ports/silabs/silabs.pintool | 28 ---------- 12 files changed, 32 insertions(+), 85 deletions(-) delete mode 100644 ports/silabs/silabs.pintool diff --git a/ports/silabs/Makefile b/ports/silabs/Makefile index 06ddf3a57d..39f493287a 100644 --- a/ports/silabs/Makefile +++ b/ports/silabs/Makefile @@ -88,7 +88,7 @@ SRC_C += \ mphalport.c \ $(SILABS_BUILD)/pins.c\ -ifeq ('$(BOARD)','brd2601b') +ifneq (,$(wildcard boards/$(BOARD)/sensor.c)) SRC_C += boards/$(BOARD)/sensor.c endif diff --git a/ports/silabs/boards/devkit_xg24_brd2601b/custom_brd2601b_cp_support.slcc b/ports/silabs/boards/devkit_xg24_brd2601b/custom_brd2601b_cp_support.slcc index b1731a306f..f0a7d66c47 100644 --- a/ports/silabs/boards/devkit_xg24_brd2601b/custom_brd2601b_cp_support.slcc +++ b/ports/silabs/boards/devkit_xg24_brd2601b/custom_brd2601b_cp_support.slcc @@ -24,4 +24,3 @@ requires: recommends: - id: sensor_rht - id: sensor_lux - - id: bt_rail_compatibility_fix diff --git a/ports/silabs/boards/devkit_xg24_brd2601b/mpconfigboard.mk b/ports/silabs/boards/devkit_xg24_brd2601b/mpconfigboard.mk index 9c40c6fe7c..58c6d15ba6 100644 --- a/ports/silabs/boards/devkit_xg24_brd2601b/mpconfigboard.mk +++ b/ports/silabs/boards/devkit_xg24_brd2601b/mpconfigboard.mk @@ -1,14 +1,15 @@ BOARD_BRD = brd2601b -INTERNAL_FLASH_FILESYSTEM = 0 +INTERNAL_FLASH_FILESYSTEM = 1 QSPI_FLASH_FILESYSTEM = 0 -SPI_FLASH_FILESYSTEM = 1 +SPI_FLASH_FILESYSTEM = 0 EXTERNAL_FLASH_DEVICES = MX25R3235F MCU_SERIES = MG24 MCU_VARIANT = EFR32MG24B310F1536IM48 CIRCUITPY_USB = 0 +CIRCUITPY_SDCARDIO = 1 CIRCUITPY_CREATOR_ID = 0x19960000 CIRCUITPY_CREATION_ID = 0x00242601 diff --git a/ports/silabs/boards/devkit_xg24_brd2601b/pins.csv b/ports/silabs/boards/devkit_xg24_brd2601b/pins.csv index c1d9a5a252..47ab01ab3f 100644 --- a/ports/silabs/boards/devkit_xg24_brd2601b/pins.csv +++ b/ports/silabs/boards/devkit_xg24_brd2601b/pins.csv @@ -10,8 +10,8 @@ PB2,BTN0,1,2 PB3,BTN1,1,3 PC0,FLASH_CS,2,0 PC1,SCLK,2,1 -PC2,CIPO,2,2 -PC3,COPI,2,3 +PC2,MISO,2,2 +PC3,MOSI,2,3 PC4,SCL,2,4 PC5,SDA,2,5 PC9,SENSOR_CS,2,9 diff --git a/ports/silabs/boards/explorerkit_xg24_brd2703a/custom_brd2703a_cp_support.slcc b/ports/silabs/boards/explorerkit_xg24_brd2703a/custom_brd2703a_cp_support.slcc index b78d83ce51..872897c4fb 100644 --- a/ports/silabs/boards/explorerkit_xg24_brd2703a/custom_brd2703a_cp_support.slcc +++ b/ports/silabs/boards/explorerkit_xg24_brd2703a/custom_brd2703a_cp_support.slcc @@ -16,5 +16,3 @@ provides: - name: custom_brd2703a_cp_support requires: - name: efr32mg24b210f1536im48 -recommends: - - id: bt_rail_compatibility_fix diff --git a/ports/silabs/boards/explorerkit_xg24_brd2703a/mpconfigboard.h b/ports/silabs/boards/explorerkit_xg24_brd2703a/mpconfigboard.h index 87da017fb7..eb1efca12d 100644 --- a/ports/silabs/boards/explorerkit_xg24_brd2703a/mpconfigboard.h +++ b/ports/silabs/boards/explorerkit_xg24_brd2703a/mpconfigboard.h @@ -37,8 +37,8 @@ #define BOARD_HSE_SOURCE (RCC_HSE_BYPASS) #define BOARD_HAS_LOW_SPEED_CRYSTAL (0) -#define DEFAULT_I2C_BUS_SDA (&pin_PB5) -#define DEFAULT_I2C_BUS_SCL (&pin_PB4) +#define DEFAULT_I2C_BUS_SDA (&pin_PC5) +#define DEFAULT_I2C_BUS_SCL (&pin_PC4) #define DEFAULT_I2C_PERIPHERAL I2C0 #define DEFAULT_SPI_BUS_SCK (&pin_PC1) diff --git a/ports/silabs/boards/explorerkit_xg24_brd2703a/mpconfigboard.mk b/ports/silabs/boards/explorerkit_xg24_brd2703a/mpconfigboard.mk index dd63b4da17..849f11ffeb 100644 --- a/ports/silabs/boards/explorerkit_xg24_brd2703a/mpconfigboard.mk +++ b/ports/silabs/boards/explorerkit_xg24_brd2703a/mpconfigboard.mk @@ -7,6 +7,7 @@ MCU_SERIES = MG24 MCU_VARIANT = EFR32MG24B210F1536IM48 CIRCUITPY_USB = 0 +CIRCUITPY_SDCARDIO = 1 CIRCUITPY_CREATOR_ID = 0x19960000 CIRCUITPY_CREATION_ID = 0x00242703 diff --git a/ports/silabs/circuitpython_efr32.slcp b/ports/silabs/circuitpython_efr32.slcp index e7010b08cd..d645f2b1ed 100644 --- a/ports/silabs/circuitpython_efr32.slcp +++ b/ports/silabs/circuitpython_efr32.slcp @@ -42,7 +42,6 @@ component: - {id: sleeptimer} - {id: emlib_wdog} - {id: bluetooth_feature_connection} -- {id: rail_lib_multiprotocol} - {id: bluetooth_feature_dynamic_gattdb} - {id: bluetooth_feature_system} - {id: bluetooth_feature_scanner} diff --git a/ports/silabs/common-hal/_bleio/Adapter.c b/ports/silabs/common-hal/_bleio/Adapter.c index cbfdcbce55..ec2e6632ec 100644 --- a/ports/silabs/common-hal/_bleio/Adapter.c +++ b/ports/silabs/common-hal/_bleio/Adapter.c @@ -280,9 +280,10 @@ uint32_t _common_hal_bleio_adapter_start_advertising( const bleio_address_obj_t *directed_to) { sl_status_t sc = SL_STATUS_FAIL; + int16_t power = tx_power * 10; // TX power in 0.1 dBm steps int16_t set_power; - uint32_t interval_min = 160; - uint32_t interval_max = 160; + uint32_t interval_min = (uint32_t)(interval * 1600); // (milliseconds * 1.6) + uint32_t interval_max = (uint32_t)(interval * 1600); // (milliseconds * 1.6) bd_addr address; uint8_t address_type; uint8_t system_id[8]; @@ -328,7 +329,7 @@ uint32_t _common_hal_bleio_adapter_start_advertising( } sc = sl_bt_advertiser_set_tx_power(self->advertising_handle, - tx_power, + power, &set_power); if (SL_STATUS_OK != sc) { return sc; diff --git a/ports/silabs/common-hal/_bleio/__init__.c b/ports/silabs/common-hal/_bleio/__init__.c index e7323c7793..79a0b764e9 100644 --- a/ports/silabs/common-hal/_bleio/__init__.c +++ b/ports/silabs/common-hal/_bleio/__init__.c @@ -41,6 +41,7 @@ STATIC conn_state_t conn_state; osMutexId_t bluetooth_connection_mutex_id; bleio_adapter_obj_t common_hal_bleio_adapter_obj; +uint8_t ble_bonding_handle = 0xFF; __ALIGNED(4) static uint8_t bluetooth_connection_mutex_cb[osMutexCbSize]; const osMutexAttr_t bluetooth_connection_mutex_attr = { @@ -106,7 +107,6 @@ void common_hal_bleio_check_connected(uint16_t conn_handle) { // Bluetooth stack event handler. void sl_bt_on_event(sl_bt_msg_t *evt) { - sl_status_t sc = SL_STATUS_OK; bd_addr address; uint8_t address_type = 0; STATIC uint8_t serv_idx = 0; @@ -122,23 +122,18 @@ void sl_bt_on_event(sl_bt_msg_t *evt) { case sl_bt_evt_system_boot_id: - sc = sl_bt_system_get_identity_address(&address, &address_type); + sl_bt_system_get_identity_address(&address, &address_type); snprintf((char *)device_name, 14 + 1, "CIRCUITPY-%X%X",address.addr[1], address.addr[0]); sl_bt_gatt_server_write_attribute_value(gattdb_device_name, 0,14,device_name); - sc = sl_bt_sm_configure(0x00,sl_bt_sm_io_capability_noinputnooutput); - if (SL_STATUS_OK != sc) { - mp_raise_bleio_BluetoothError(translate("Sm configure fail")); - } + sl_bt_sm_store_bonding_configuration(5,2); - sc = sl_bt_sm_set_bondable_mode(1); - if (SL_STATUS_OK != sc) { - mp_raise_bleio_BluetoothError(translate("Set bondable mode fail")); - } - sl_bt_sm_delete_bondings(); + sl_bt_sm_configure(0x00,sl_bt_sm_io_capability_noinputnooutput); + + sl_bt_sm_set_bondable_mode(1); break; // This event indicates that a new connection was opened. @@ -154,14 +149,7 @@ void sl_bt_on_event(sl_bt_msg_t *evt) { bleio_connections[0].is_central = false; bleio_connections[0].mtu = 0; } - - sc = sl_bt_sm_increase_security( - evt->data.evt_connection_opened.connection); - - if (SL_STATUS_OK != sc) { - mp_raise_bleio_BluetoothError( - translate("Increase security fail.")); - } + ble_bonding_handle = evt->data.evt_connection_opened.bonding; osMutexRelease(bluetooth_connection_mutex_id); break; @@ -181,6 +169,8 @@ void sl_bt_on_event(sl_bt_msg_t *evt) { case sl_bt_evt_connection_closed_id: common_hal_bleio_adapter_remove_connection( evt->data.evt_connection_closed.connection); + // reset bonding handle variable to avoid deleting wrong bonding info + ble_bonding_handle = 0xFF; break; case sl_bt_evt_system_external_signal_id: @@ -306,7 +296,7 @@ void sl_bt_on_event(sl_bt_msg_t *evt) { && serv_idx < connection->remote_service_list->len) { service = connection->remote_service_list->items[serv_idx]; - sc = sl_bt_gatt_discover_characteristics( + sl_bt_gatt_discover_characteristics( evt->data.evt_gatt_procedure_completed.connection, service->handle); @@ -366,34 +356,20 @@ void sl_bt_on_event(sl_bt_msg_t *evt) { break; case sl_bt_evt_sm_confirm_bonding_id: - sc = sl_bt_sm_bonding_confirm( - evt->data.evt_sm_confirm_bonding.connection,1); - if (SL_STATUS_OK != sc) { - mp_raise_bleio_BluetoothError( - translate("Bonding confirm fail")); - } + sl_bt_sm_bonding_confirm(evt->data.evt_sm_confirm_bonding.connection,1); break; case sl_bt_evt_sm_bonded_id: break; case sl_bt_evt_sm_bonding_failed_id: + if (ble_bonding_handle != 0xFF) { + sl_bt_sm_delete_bonding(ble_bonding_handle); + ble_bonding_handle = 0xFF; + } break; case sl_bt_evt_connection_parameters_id: - switch (evt->data.evt_connection_parameters.security_mode) - { - case connection_mode1_level1: - break; - case connection_mode1_level2: - break; - case connection_mode1_level3: - break; - case connection_mode1_level4: - break; - default: - break; - } break; default: diff --git a/ports/silabs/common-hal/analogio/AnalogIn.c b/ports/silabs/common-hal/analogio/AnalogIn.c index ecf61ca268..e22c5b3493 100644 --- a/ports/silabs/common-hal/analogio/AnalogIn.c +++ b/ports/silabs/common-hal/analogio/AnalogIn.c @@ -91,10 +91,10 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, // Resolution is not configurable directly but is based on the // selected oversampling ratio (osrHighSpeed), which defaults to // 2x and generates 12-bit results. - initAllConfigs.configs[0].reference = iadcCfgReferenceInt1V2; - initAllConfigs.configs[0].vRef = 1210; + initAllConfigs.configs[0].reference = iadcCfgReferenceVddx; + initAllConfigs.configs[0].vRef = 3300; initAllConfigs.configs[0].osrHighSpeed = iadcCfgOsrHighSpeed2x; - initAllConfigs.configs[0].analogGain = iadcCfgAnalogGain0P5x; + initAllConfigs.configs[0].analogGain = iadcCfgAnalogGain1x; // Divide CLK_SRC_ADC to set the CLK_ADC frequency initAllConfigs.configs[0].adcClkPrescale @@ -212,5 +212,5 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { // Get adc ref value float common_hal_analogio_analogin_get_reference_voltage (analogio_analogin_obj_t *self) { - return 2.42f; + return 3.3f; } diff --git a/ports/silabs/silabs.pintool b/ports/silabs/silabs.pintool deleted file mode 100644 index 1121cb391d..0000000000 --- a/ports/silabs/silabs.pintool +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - From b2c6f9b1a4cd72f70a9ec4ec91776d619d178d0f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 16 May 2023 10:07:07 -0500 Subject: [PATCH 1055/1712] synthio: add Synthesizer.lfo, retrigger option --- shared-bindings/synthio/Synthesizer.c | 38 ++++++++++++++++++++++----- shared-bindings/synthio/Synthesizer.h | 2 ++ shared-module/synthio/Synthesizer.c | 31 +++++++++++++++++++++- shared-module/synthio/Synthesizer.h | 1 + 4 files changed, 65 insertions(+), 7 deletions(-) diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index 67707a763d..fae0649193 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -33,6 +33,7 @@ #include "py/runtime.h" #include "shared-bindings/util.h" #include "shared-bindings/synthio/Synthesizer.h" +#include "shared-bindings/synthio/LFO.h" #include "shared-bindings/synthio/__init__.h" #include "supervisor/shared/translate/translate.h" @@ -120,23 +121,29 @@ STATIC mp_obj_t synthio_synthesizer_release(mp_obj_t self_in, mp_obj_t release) } STATIC MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_release_obj, synthio_synthesizer_release); -//| def release_then_press(self, release: NoteSequence = (), press: NoteSequence = ()) -> None: +//| def release_then_press( +//| self, release: NoteSequence = (), press: NoteSequence = (), retrigger=LFOSequence +//| ) -> None: //| """Turn some notes on and/or off. //| //| It is OK to release note that was not actually turned on. //| -//| Pressing a note that was already pressed has no effect. +//| Pressing a note that was already pressed returns it to the attack phase +//| but without resetting its amplitude. Releasing a note and immediately +//| pressing it again returns it to the attack phase with an initial +//| amplitude of 0. //| -//| Releasing and pressing the note again has little effect, but does reset the phase -//| of the note, which may be perceptible as a small glitch. +//| At the same time, the passed LFOs (if any) are retriggered. //| //| :param NoteSequence release: Any sequence of notes. -//| :param NoteSequence press: Any sequence of notes.""" +//| :param NoteSequence press: Any sequence of notes. +//| :param LFOSequence retrigger: Any sequence of LFOs.""" STATIC mp_obj_t synthio_synthesizer_release_then_press(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum { ARG_release, ARG_press }; + enum { ARG_release, ARG_press, ARG_retrigger }; static const mp_arg_t allowed_args[] = { { MP_QSTR_release, MP_ARG_OBJ, {.u_obj = mp_const_empty_tuple } }, { MP_QSTR_press, MP_ARG_OBJ, {.u_obj = mp_const_empty_tuple } }, + { MP_QSTR_retrigger, MP_ARG_OBJ, {.u_obj = mp_const_empty_tuple } }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; @@ -146,6 +153,7 @@ STATIC mp_obj_t synthio_synthesizer_release_then_press(mp_uint_t n_args, const m check_for_deinit(self); common_hal_synthio_synthesizer_release(self, args[ARG_release].u_obj); common_hal_synthio_synthesizer_press(self, args[ARG_press].u_obj); + common_hal_synthio_synthesizer_retrigger(self, args[ARG_retrigger].u_obj); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(synthio_synthesizer_release_then_press_obj, 1, synthio_synthesizer_release_then_press); @@ -250,6 +258,23 @@ MP_DEFINE_CONST_FUN_OBJ_1(synthio_synthesizer_get_pressed_obj, synthio_synthesiz MP_PROPERTY_GETTER(synthio_synthesizer_pressed_obj, (mp_obj_t)&synthio_synthesizer_get_pressed_obj); +//| lfos: List[LFO] +//| """A list of LFOs to advance whether or not they are associated with a playing note. +//| +//| This can be used to implement 'free-running' LFOs. LFOs associated with playing notes are advanced whether or not they are in this list. +//| +//| This attribute is read-only but its contents may be modified by e.g., calling append() or remove(). It is initially an empty list.""" +//| +STATIC mp_obj_t synthio_synthesizer_obj_get_lfos(mp_obj_t self_in) { + synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + return common_hal_synthio_synthesizer_get_lfos(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_synthesizer_get_lfos_obj, synthio_synthesizer_obj_get_lfos); + +MP_PROPERTY_GETTER(synthio_synthesizer_lfos_obj, + (mp_obj_t)&synthio_synthesizer_get_lfos_obj); + //| max_polyphony: int //| """Maximum polyphony of the synthesizer (read-only class property)""" //| @@ -270,6 +295,7 @@ STATIC const mp_rom_map_elem_t synthio_synthesizer_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_sample_rate), MP_ROM_PTR(&synthio_synthesizer_sample_rate_obj) }, { MP_ROM_QSTR(MP_QSTR_max_polyphony), MP_ROM_INT(CIRCUITPY_SYNTHIO_MAX_CHANNELS) }, { MP_ROM_QSTR(MP_QSTR_pressed), MP_ROM_PTR(&synthio_synthesizer_pressed_obj) }, + { MP_ROM_QSTR(MP_QSTR_lfos), MP_ROM_PTR(&synthio_synthesizer_lfos_obj) }, }; STATIC MP_DEFINE_CONST_DICT(synthio_synthesizer_locals_dict, synthio_synthesizer_locals_dict_table); diff --git a/shared-bindings/synthio/Synthesizer.h b/shared-bindings/synthio/Synthesizer.h index d8000681b8..a5f5582ac7 100644 --- a/shared-bindings/synthio/Synthesizer.h +++ b/shared-bindings/synthio/Synthesizer.h @@ -41,5 +41,7 @@ uint8_t common_hal_synthio_synthesizer_get_bits_per_sample(synthio_synthesizer_o uint8_t common_hal_synthio_synthesizer_get_channel_count(synthio_synthesizer_obj_t *self); void common_hal_synthio_synthesizer_release(synthio_synthesizer_obj_t *self, mp_obj_t to_release); void common_hal_synthio_synthesizer_press(synthio_synthesizer_obj_t *self, mp_obj_t to_press); +void common_hal_synthio_synthesizer_retrigger(synthio_synthesizer_obj_t *self, mp_obj_t to_retrigger); void common_hal_synthio_synthesizer_release_all(synthio_synthesizer_obj_t *self); mp_obj_t common_hal_synthio_synthesizer_get_pressed_notes(synthio_synthesizer_obj_t *self); +mp_obj_t common_hal_synthio_synthesizer_get_lfos(synthio_synthesizer_obj_t *self); diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index 54bc283148..83201ac5e0 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -25,8 +25,9 @@ */ #include "py/runtime.h" -#include "shared-bindings/synthio/Synthesizer.h" +#include "shared-bindings/synthio/LFO.h" #include "shared-bindings/synthio/Note.h" +#include "shared-bindings/synthio/Synthesizer.h" #include "shared-module/synthio/Note.h" @@ -36,6 +37,7 @@ void common_hal_synthio_synthesizer_construct(synthio_synthesizer_obj_t *self, mp_obj_t envelope_obj) { synthio_synth_init(&self->synth, sample_rate, channel_count, waveform_obj, filter_obj, envelope_obj); + self->lfos = mp_obj_new_list(0, NULL); } void common_hal_synthio_synthesizer_deinit(synthio_synthesizer_obj_t *self) { @@ -67,7 +69,20 @@ audioio_get_buffer_result_t synthio_synthesizer_get_buffer(synthio_synthesizer_o return GET_BUFFER_ERROR; } self->synth.span.dur = SYNTHIO_MAX_DUR; + + synthio_synth_synthesize(&self->synth, buffer, buffer_length, single_channel_output ? channel : 0); + + // free-running LFOs + mp_obj_iter_buf_t iter_buf; + mp_obj_t iterable = mp_getiter(self->lfos, &iter_buf); + mp_obj_t item; + while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { + synthio_lfo_slot_t slot = { .obj = item }; + // does not error for invalid type, so it's OK that we don't police + // list contents + (void)synthio_lfo_obj_tick(&slot); + } return GET_BUFFER_MORE_DATA; } @@ -119,6 +134,16 @@ void common_hal_synthio_synthesizer_press(synthio_synthesizer_obj_t *self, mp_ob } } +void common_hal_synthio_synthesizer_retrigger(synthio_synthesizer_obj_t *self, mp_obj_t to_retrigger) { + mp_obj_iter_buf_t iter_buf; + mp_obj_t iterable = mp_getiter(to_retrigger, &iter_buf); + mp_obj_t lfo_obj; + while ((lfo_obj = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { + synthio_lfo_obj_t *lfo = MP_OBJ_TO_PTR(mp_arg_validate_type(lfo_obj, &synthio_lfo_type, MP_QSTR_retrigger)); + common_hal_synthio_lfo_retrigger(lfo); + } +} + mp_obj_t common_hal_synthio_synthesizer_get_pressed_notes(synthio_synthesizer_obj_t *self) { int count = 0; for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { @@ -134,3 +159,7 @@ mp_obj_t common_hal_synthio_synthesizer_get_pressed_notes(synthio_synthesizer_ob } return MP_OBJ_FROM_PTR(result); } + +mp_obj_t common_hal_synthio_synthesizer_get_lfos(synthio_synthesizer_obj_t *self) { + return self->lfos; +} diff --git a/shared-module/synthio/Synthesizer.h b/shared-module/synthio/Synthesizer.h index 256b6137f2..487e73a2ac 100644 --- a/shared-module/synthio/Synthesizer.h +++ b/shared-module/synthio/Synthesizer.h @@ -34,6 +34,7 @@ typedef struct { mp_obj_base_t base; synthio_synth_t synth; + mp_obj_t lfos; } synthio_synthesizer_obj_t; From e6c5e83a452a56994fe02f546e190b191df75896 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 16 May 2023 10:07:22 -0500 Subject: [PATCH 1056/1712] synthio: remove more dead code --- shared-module/synthio/__init__.c | 50 -------------------------------- 1 file changed, 50 deletions(-) diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 37ac87465e..83baba02a2 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -40,9 +40,6 @@ STATIC const int16_t square_wave[] = {-32768, 32767}; STATIC const uint16_t notes[] = {8372, 8870, 9397, 9956, 10548, 11175, 11840, 12544, 13290, 14080, 14917, 15804}; // 9th octave -STATIC int32_t round_float_to_int(mp_float_t f) { - return (int32_t)(f + MICROPY_FLOAT_CONST(0.5)); -} STATIC int64_t round_float_to_int64(mp_float_t f) { return (int64_t)(f + MICROPY_FLOAT_CONST(0.5)); @@ -546,53 +543,6 @@ uint32_t synthio_frequency_convert_scaled_to_dds(uint64_t frequency_scaled, int3 return (sample_rate / 2 + frequency_scaled) / sample_rate; } -void synthio_lfo_set(synthio_lfo_state_t *state, const synthio_lfo_descr_t *descr, uint32_t sample_rate) { - state->amplitude_scaled = round_float_to_int(descr->amplitude * 32768); - state->dds = synthio_frequency_convert_float_to_dds(descr->frequency * 65536, sample_rate); -} - -STATIC int synthio_lfo_step_common(synthio_lfo_state_t *state, uint16_t dur) { - uint32_t phase = state->phase; - uint16_t whole_phase = phase >> 16; - - // advance the phase accumulator - state->phase = phase + state->dds * dur; - - return whole_phase; -} -STATIC int synthio_lfo_sweep_common(synthio_lfo_state_t *state, uint16_t dur) { - uint32_t old_phase = state->phase; - uint16_t whole_phase = synthio_lfo_step_common(state, dur); - if (state->phase < old_phase) { - state->phase = 0xffffffff; - } - return whole_phase; -} - -int synthio_sweep_step(synthio_lfo_state_t *state, uint16_t dur) { - uint16_t whole_phase = synthio_lfo_sweep_common(state, dur); - return (state->amplitude_scaled * whole_phase) / 65536 + state->offset_scaled; -} - -int synthio_sweep_in_step(synthio_lfo_state_t *state, uint16_t dur) { - uint16_t whole_phase = 65535 - synthio_lfo_sweep_common(state, dur); - return (state->amplitude_scaled * whole_phase) / 65536 + state->offset_scaled; -} - -int synthio_lfo_step(synthio_lfo_state_t *state, uint16_t dur) { - uint16_t whole_phase = synthio_lfo_step_common(state, dur); - // create a triangle wave, it's quick and easy - int v; - if (whole_phase < 16384) { // ramp from 0 to amplitude - v = (state->amplitude_scaled * whole_phase); - } else if (whole_phase < 49152) { // ramp from +amplitude to -amplitude - v = (state->amplitude_scaled * (32768 - whole_phase)); - } else { // from -amplitude to 0 - v = (state->amplitude_scaled * (whole_phase - 65536)); - } - return v / 16384 + state->offset_scaled; -} - void shared_bindings_synthio_lfo_tick(uint32_t sample_rate) { synthio_global_rate_scale = (mp_float_t)SYNTHIO_MAX_DUR / sample_rate; synthio_global_tick++; From 0b926f8fd41269704ddc4fc4b262f3f3590ce383 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 16 May 2023 10:26:56 -0500 Subject: [PATCH 1057/1712] synthio: improve release/press/change Semi-incompatible name change: The method `release_then_press` is now `change`. For now a compatibility alias is supported. Everywhere a `NoteSequence` was accepted, a single note is now accepted. So for instance, `synth.press(30)` can be written instead of requiring ``synth.press((30,))`. The same goes for `change.retrigger`, which will accept a single LFO or a sequence. --- shared-bindings/synthio/Synthesizer.c | 49 +++++++++++++++++---------- shared-module/synthio/Synthesizer.c | 24 +++++++++++++ 2 files changed, 55 insertions(+), 18 deletions(-) diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index fae0649193..8fb0d57386 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -38,7 +38,11 @@ #include "supervisor/shared/translate/translate.h" //| NoteSequence = Sequence[Union[int, Note]] -//| """A sequence of notes, which can each be integer MIDI notes or `Note` objects""" +//| """A sequence of notes, which can each be integer MIDI note numbers or `Note` objects""" +//| NoteOrNoteSequence = Union[int, Note, NoteSequence] +//| """A note or sequence of notes""" +//| LFOOrLFOSequence = Union["LFO", Sequence["LFO"]] +//| """An LFO or a sequence of LFOs""" //| //| class Synthesizer: //| def __init__( @@ -94,12 +98,12 @@ STATIC void check_for_deinit(synthio_synthesizer_obj_t *self) { } } -//| def press(self, /, press: NoteSequence = ()) -> None: +//| def press(self, /, press: NoteOrNoteSequence = ()) -> None: //| """Turn some notes on. //| //| Pressing a note that was already pressed has no effect. //| -//| :param NoteSequence press: Any sequence of notes.""" +//| :param NoteOrNoteSequence press: Any sequence of notes.""" STATIC mp_obj_t synthio_synthesizer_press(mp_obj_t self_in, mp_obj_t press) { synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -107,12 +111,12 @@ STATIC mp_obj_t synthio_synthesizer_press(mp_obj_t self_in, mp_obj_t press) { return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_press_obj, synthio_synthesizer_press); -//| def release(self, /, release: NoteSequence = ()) -> None: +//| def release(self, /, release: NoteOrNoteSequence = ()) -> None: //| """Turn some notes off. //| //| Releasing a note that was already released has no effect. //| -//| :param NoteSequence release: Any sequence of notes.""" +//| :param NoteOrNoteSequence release: Any sequence of notes.""" STATIC mp_obj_t synthio_synthesizer_release(mp_obj_t self_in, mp_obj_t release) { synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -121,10 +125,15 @@ STATIC mp_obj_t synthio_synthesizer_release(mp_obj_t self_in, mp_obj_t release) } STATIC MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_release_obj, synthio_synthesizer_release); -//| def release_then_press( -//| self, release: NoteSequence = (), press: NoteSequence = (), retrigger=LFOSequence +//| def change( +//| self, +//| release: NoteOrNoteSequence = (), +//| press: NoteOrNoteSequence = (), +//| retrigger=LFOOrLFOSequence, //| ) -> None: -//| """Turn some notes on and/or off. +//| """Start notes, stop them, and/or re-trigger some LFOs. +//| +//| The changes all happen atomically with respect to output generation. //| //| It is OK to release note that was not actually turned on. //| @@ -135,10 +144,13 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_release_obj, synthio_synthe //| //| At the same time, the passed LFOs (if any) are retriggered. //| -//| :param NoteSequence release: Any sequence of notes. -//| :param NoteSequence press: Any sequence of notes. -//| :param LFOSequence retrigger: Any sequence of LFOs.""" -STATIC mp_obj_t synthio_synthesizer_release_then_press(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +//| :param NoteOrNoteSequence release: Any sequence of notes. +//| :param NoteOrNoteSequence press: Any sequence of notes. +//| :param LFOOrLFOSequence retrigger: Any sequence of LFOs. +//| +//| Note: for compatibility, ``release_then_press`` may be used as an alias +//| for this function. This compatibility name will be removed in 9.0.""" +STATIC mp_obj_t synthio_synthesizer_change(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_release, ARG_press, ARG_retrigger }; static const mp_arg_t allowed_args[] = { { MP_QSTR_release, MP_ARG_OBJ, {.u_obj = mp_const_empty_tuple } }, @@ -156,16 +168,16 @@ STATIC mp_obj_t synthio_synthesizer_release_then_press(mp_uint_t n_args, const m common_hal_synthio_synthesizer_retrigger(self, args[ARG_retrigger].u_obj); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_KW(synthio_synthesizer_release_then_press_obj, 1, synthio_synthesizer_release_then_press); +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(synthio_synthesizer_change_obj, 1, synthio_synthesizer_change); // -//| def release_all_then_press(self, /, press: NoteSequence) -> None: +//| def release_all_then_press(self, /, press: NoteOrNoteSequence) -> None: //| """Turn any currently-playing notes off, then turn on the given notes //| -//| Releasing and pressing the note again has little effect, but does reset the phase -//| of the note, which may be perceptible as a small glitch. +//| Releasing a note and immediately pressing it again returns it to the +//| attack phase with an initial amplitude of 0. //| -//| :param NoteSequence press: Any sequence of notes.""" +//| :param NoteOrNoteSequence press: Any sequence of notes.""" STATIC mp_obj_t synthio_synthesizer_release_all_then_press(mp_obj_t self_in, mp_obj_t press) { synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); @@ -284,7 +296,8 @@ STATIC const mp_rom_map_elem_t synthio_synthesizer_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_press), MP_ROM_PTR(&synthio_synthesizer_press_obj) }, { MP_ROM_QSTR(MP_QSTR_release), MP_ROM_PTR(&synthio_synthesizer_release_obj) }, { MP_ROM_QSTR(MP_QSTR_release_all), MP_ROM_PTR(&synthio_synthesizer_release_all_obj) }, - { MP_ROM_QSTR(MP_QSTR_release_then_press), MP_ROM_PTR(&synthio_synthesizer_release_then_press_obj) }, + { MP_ROM_QSTR(MP_QSTR_change), MP_ROM_PTR(&synthio_synthesizer_change_obj) }, + { MP_ROM_QSTR(MP_QSTR_release_then_press), MP_ROM_PTR(&synthio_synthesizer_change_obj) }, { MP_ROM_QSTR(MP_QSTR_release_all_then_press), MP_ROM_PTR(&synthio_synthesizer_release_all_then_press_obj) }, { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&synthio_synthesizer_deinit_obj) }, { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index 83201ac5e0..d6e147d6df 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -99,6 +99,10 @@ void common_hal_synthio_synthesizer_release_all(synthio_synthesizer_obj_t *self) } } +STATIC bool is_note(mp_obj_t note_in) { + return mp_obj_is_small_int(note_in) || mp_obj_is_type(note_in, &synthio_note_type); +} + STATIC mp_obj_t validate_note(mp_obj_t note_in) { if (mp_obj_is_small_int(note_in)) { mp_arg_validate_int_range(mp_obj_get_int(note_in), 0, 127, MP_QSTR_note); @@ -112,6 +116,11 @@ STATIC mp_obj_t validate_note(mp_obj_t note_in) { } void common_hal_synthio_synthesizer_release(synthio_synthesizer_obj_t *self, mp_obj_t to_release) { + if (is_note(to_release)) { + synthio_span_change_note(&self->synth, validate_note(to_release), SYNTHIO_SILENCE); + return; + } + mp_obj_iter_buf_t iter_buf; mp_obj_t iterable = mp_getiter(to_release, &iter_buf); mp_obj_t item; @@ -121,6 +130,15 @@ void common_hal_synthio_synthesizer_release(synthio_synthesizer_obj_t *self, mp_ } void common_hal_synthio_synthesizer_press(synthio_synthesizer_obj_t *self, mp_obj_t to_press) { + if (is_note(to_press)) { + if (!mp_obj_is_small_int(to_press)) { + synthio_note_obj_t *note = MP_OBJ_TO_PTR(to_press); + synthio_note_start(note, self->synth.sample_rate); + } + synthio_span_change_note(&self->synth, SYNTHIO_SILENCE, validate_note(to_press)); + return; + } + mp_obj_iter_buf_t iter_buf; mp_obj_t iterable = mp_getiter(to_press, &iter_buf); mp_obj_t note_obj; @@ -135,6 +153,12 @@ void common_hal_synthio_synthesizer_press(synthio_synthesizer_obj_t *self, mp_ob } void common_hal_synthio_synthesizer_retrigger(synthio_synthesizer_obj_t *self, mp_obj_t to_retrigger) { + if (mp_obj_is_type(to_retrigger, &synthio_lfo_type)) { + synthio_lfo_obj_t *lfo = MP_OBJ_TO_PTR(mp_arg_validate_type(to_retrigger, &synthio_lfo_type, MP_QSTR_retrigger)); + common_hal_synthio_lfo_retrigger(lfo); + return; + } + mp_obj_iter_buf_t iter_buf; mp_obj_t iterable = mp_getiter(to_retrigger, &iter_buf); mp_obj_t lfo_obj; From a568a0ba4a4580c980eabcbfa5ecc70b249b1630 Mon Sep 17 00:00:00 2001 From: Luis Ruiz San Segundo Date: Mon, 15 May 2023 18:54:53 +0000 Subject: [PATCH 1058/1712] Translated using Weblate (Spanish) Currently translated at 100.0% (999 of 999 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/locale/es.po b/locale/es.po index c9ba32682f..ab4e118b7c 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-04-22 15:51+0000\n" -"Last-Translator: Jose David M \n" +"PO-Revision-Date: 2023-05-16 19:50+0000\n" +"Last-Translator: Luis Ruiz San Segundo \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" @@ -206,7 +206,7 @@ msgstr "%q debe ser un bytearray o array de tipo 'H' o 'B'" #: shared-bindings/audiocore/RawSample.c msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" -msgstr "%q debe ser un byte-matriz o matriz de tipo 'h', 'H', 'b', o 'B'" +msgstr "%q debe ser un bytearray o array de tipo 'h', 'H', 'b', o 'B'" #: ports/espressif/common-hal/analogbufio/BufferedIn.c msgid "%q must be array of type 'H'" @@ -601,8 +601,7 @@ msgstr "Por debajo de la tasa mínima de refrescamiento" #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must be sequential pins" -msgstr "" -"Los pines de reloj de bit y de selector de palabra deben ser secuenciales" +msgstr "Los pines \"clock\" y \"word-select\" deben ser consecutivos" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Bit clock and word select must share a clock unit" From d4294de62ba5caab0133f4f6970ef8df0d375cc1 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 16 May 2023 16:57:51 -0500 Subject: [PATCH 1059/1712] synthio: Allow bends of more than one octave up to +-12 sounds good, right? --- shared-bindings/synthio/Note.c | 4 ++-- shared-module/synthio/Note.c | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index a0b258653f..4a90531c21 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -161,7 +161,7 @@ MP_PROPERTY_GETSET(synthio_note_amplitude_obj, //| //| bend: BlockInput -//| """The pitch bend depth of the note, from -1 to +1 +//| """The pitch bend depth of the note, from -12 to +12 //| //| A depth of 0 plays the programmed frequency. A depth of 1 corresponds to a bend of 1 //| octave. A depth of (1/12) = 0.833 corresponds to a bend of 1 semitone, @@ -244,7 +244,7 @@ MP_PROPERTY_GETSET(synthio_note_ring_frequency_obj, (mp_obj_t)&synthio_note_set_ring_frequency_obj); //| ring_bend: float -//| """The pitch bend depth of the note's ring waveform, from -1 to +1 +//| """The pitch bend depth of the note's ring waveform, from -12 to +12 //| //| A depth of 0 plays the programmed frequency. A depth of 1 corresponds to a bend of 1 //| octave. A depth of (1/12) = 0.833 corresponds to a bend of 1 semitone, diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index 6f12166020..55a57f0ed3 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -160,18 +160,16 @@ void synthio_note_start(synthio_note_obj_t *self, int32_t sample_rate) { STATIC uint16_t pitch_bend_table[] = { 0, 1948, 4013, 6200, 8517, 10972, 13573, 16329, 19248, 22341, 25618, 29090, 32768 }; -STATIC uint32_t pitch_bend(uint32_t frequency_scaled, int16_t bend_value) { - bool down = (bend_value < 0); - if (down) { - bend_value += 32768; - } +STATIC uint32_t pitch_bend(uint32_t frequency_scaled, int32_t bend_value) { + int octave = bend_value >> 15; + bend_value &= 0x7fff; uint32_t bend_value_semitone = (uint32_t)bend_value * 24; // 65536/semitone uint32_t semitone = bend_value_semitone >> 16; uint32_t fractone = bend_value_semitone & 0xffff; uint32_t f_lo = pitch_bend_table[semitone]; uint32_t f_hi = pitch_bend_table[semitone + 1]; // table has 13 entries, indexing with semitone=12 is OK uint32_t f = ((f_lo * (65535 - fractone) + f_hi * fractone) >> 16) + BEND_OFFSET; - return (frequency_scaled * (uint64_t)f) >> (15 + down); + return (frequency_scaled * (uint64_t)f) >> (15 - octave); } #define ZERO MICROPY_FLOAT_CONST(0.) @@ -196,11 +194,11 @@ uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_ loudness[1] = (loudness[1] * right_panning_scaled) >> 15; if (self->ring_frequency_scaled != 0) { - int ring_bend_value = synthio_lfo_obj_tick_scaled(&self->ring_bend, -ONE, ALMOST_ONE, 15); + int ring_bend_value = synthio_lfo_obj_tick_scaled(&self->ring_bend, -12, 12, 15); self->ring_frequency_bent = pitch_bend(self->ring_frequency_scaled, ring_bend_value); } - int bend_value = synthio_lfo_obj_tick_scaled(&self->bend, -ONE, ALMOST_ONE, 15); + int bend_value = synthio_lfo_obj_tick_scaled(&self->bend, -12, 12, 15); uint32_t frequency_scaled = pitch_bend(self->frequency_scaled, bend_value); return frequency_scaled; From 32e5d9e5c417936c7b7c479cba712123d391f194 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 17 May 2023 08:57:06 -0500 Subject: [PATCH 1060/1712] update ulab to 6.0.12 w/sinc function --- extmod/ulab | 2 +- locale/circuitpython.pot | 51 ++++++++++++++++------------------------ 2 files changed, 21 insertions(+), 32 deletions(-) diff --git a/extmod/ulab b/extmod/ulab index f2dd2230c4..6619c20b3b 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit f2dd2230c4fdf1aa5c7a160782efdde18e8204bb +Subproject commit 6619c20b3b75864554fcee5f88846fac27df5701 diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 61fd0d0a6b..2d7ac500d1 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -165,11 +165,15 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "" @@ -203,6 +207,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/LFO.c shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -425,6 +430,7 @@ msgid "Address must be %d bytes long" msgstr "" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" @@ -608,13 +614,6 @@ msgstr "" msgid "Both pins must support hardware interrupts" msgstr "" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -927,11 +926,6 @@ msgstr "" msgid "EXTINT channel already in use" msgstr "" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "" - #: extmod/modure.c msgid "Error in regex" msgstr "" @@ -1343,11 +1337,6 @@ msgstr "" msgid "Mapping must be a tuple" msgstr "" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -2479,6 +2468,10 @@ msgstr "" msgid "annotation must be an identifier" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2651,6 +2644,10 @@ msgstr "" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "" @@ -2802,6 +2799,10 @@ msgstr "" msgid "cannot import name %q" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "" @@ -3251,10 +3252,6 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3968,7 +3965,7 @@ msgid "set unsupported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" +msgid "shape must be integer or tuple of integers" msgstr "" #: shared-module/msgpack/__init__.c @@ -4342,18 +4339,10 @@ msgstr "" msgid "wrong output type" msgstr "" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" From a682b421808fef7df07914502b6a74bbffa8fef0 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 17 May 2023 08:54:58 -0500 Subject: [PATCH 1061/1712] fir filtering demo --- .../circuitpython-manual/synthio/note/fir.py | 85 +++----------- .../synthio/note/mkfilter.py | 105 ++++++++++++++++++ 2 files changed, 122 insertions(+), 68 deletions(-) create mode 100644 tests/circuitpython-manual/synthio/note/mkfilter.py diff --git a/tests/circuitpython-manual/synthio/note/fir.py b/tests/circuitpython-manual/synthio/note/fir.py index 9d40b584be..4593dcb376 100644 --- a/tests/circuitpython-manual/synthio/note/fir.py +++ b/tests/circuitpython-manual/synthio/note/fir.py @@ -9,6 +9,7 @@ import audiocore import synthio from ulab import numpy as np import adafruit_wave as wave +import mkfilter random.seed(9) @@ -16,89 +17,37 @@ envelope = synthio.Envelope( attack_time=0.1, decay_time=0.05, release_time=0.2, attack_level=0.8, sustain_level=0.8 ) -h = np.array( - [ - -0.001229734800309099, - -0.008235561806605458, - -0.015082497016061390, - -0.020940136918319988, - -0.024981800822463429, - -0.026464233332370746, - -0.024803890156806906, - -0.019642276775473012, - -0.010893620860173042, - 0.001230341899766145, - 0.016221637398855598, - 0.033304135659230648, - 0.051486665261155681, - 0.069636961761409016, - 0.086570197432542767, - 0.101144354207918147, - 0.112353938422488253, - 0.119413577288191297, - 0.121823886314051028, - 0.119413577288191297, - 0.112353938422488253, - 0.101144354207918147, - 0.086570197432542767, - 0.069636961761409016, - 0.051486665261155681, - 0.033304135659230648, - 0.016221637398855598, - 0.001230341899766145, - -0.010893620860173042, - -0.019642276775473012, - -0.024803890156806906, - -0.026464233332370746, - -0.024981800822463429, - -0.020940136918319988, - -0.015082497016061390, - -0.008235561806605458, - -0.001229734800309099, - ] -) +SAMPLE_SIZE = 1024 +bend_out = np.linspace(0, 32767, num=SAMPLE_SIZE, endpoint=True, dtype=np.int16) -filter_coeffs = np.array(h[::-1] * 32768, dtype=np.int16) - -synth = synthio.Synthesizer(sample_rate=48000, filter=filter_coeffs) +filter_rectangular = mkfilter.LPF(48000, 800, 13) +filter_rectangular_big = mkfilter.LPF(48000, 800, 59) +filter_blackman = mkfilter.LPF(48000, 800, 59, win=mkfilter.blackman) +print(filter_blackman) def synthesize(synth): n = synthio.Note( frequency=120, envelope=envelope, - filter=False, + filter=True, + bend=synthio.LFO(bend_out, once=True, rate=1 / 2, scale=5), ) + synth.press(n) print(synth, n) - synth.press((n,)) - for _ in range(20): - n.frequency *= 1.0595 - yield 36 - synth.release_all() - yield 36 - - n.filter = True - n.frequency = 120 - synth.press((n,)) - for _ in range(20): - n.frequency *= 1.0595 - yield 36 + yield 2 * 48000 // 256 synth.release_all() yield 36 -def chain(*args): - for a in args: - yield from a - - -# sox -r 48000 -e signed -b 16 -c 1 tune.raw tune.wav with wave.open("fir.wav", "w") as f: f.setnchannels(1) f.setsampwidth(2) f.setframerate(48000) - for n in chain(synthesize(synth)): - for i in range(n): - result, data = audiocore.get_buffer(synth) - f.writeframes(data) + for filter_coeffs in [None, filter_rectangular, filter_rectangular_big, filter_blackman]: + synth = synthio.Synthesizer(sample_rate=48000, filter=filter_coeffs) + for n in synthesize(synth): + for i in range(n): + result, data = audiocore.get_buffer(synth) + f.writeframes(data) diff --git a/tests/circuitpython-manual/synthio/note/mkfilter.py b/tests/circuitpython-manual/synthio/note/mkfilter.py new file mode 100644 index 0000000000..20a4203af2 --- /dev/null +++ b/tests/circuitpython-manual/synthio/note/mkfilter.py @@ -0,0 +1,105 @@ +try: + from ulab import numpy as np +except ImportError: + import numpy as np + + +def lpf(fS, f, N, win=lambda N: 1): + if not (N & 1): + raise ValueError("filter length must be odd") + h = np.sinc(2 * f / fS * (np.arange(N) - (N - 1) / 2)) + h = h * win(N) + return h * (1 / np.sum(h)) + + +def hpf(fS, f, N, win=lambda N: 1): + if not (N & 1): + raise ValueError("filter length must be odd") + h = -lpf(fS, f, N) + h = h * win(N) + h[(N - 1) // 2] += 1 + return h + + +def brf(fS, fL, NL, fH, NH, win=lambda N: 1): + hlpf = lpf(fS, fL, NL, win) + hhpf = hpf(fS, fH, NH, win) + + if NH > NL: + h = hhpf + h[(NH - NL) // 2 : (NH - NL) // 2 + NL] += hlpf + else: + h = hlpf + h[(NL - NH) // 2 : (NL - NH) // 2 + NH] += hhpf + + return h + + +def bpf(fS, fL, NL, fH, NH, win=lambda N: 1): + hlpf = lpf(fS, fL, NL, win) + hhpf = hpf(fS, fH, NH, win) + return np.convolve(hlpf, hhpf) + + +def blackman(M): + n = np.arange(1 - M, M, 2) + return 0.42 + 0.5 * np.cos(np.pi * n / (M - 1)) + 0.08 * np.cos(2.0 * np.pi * n / (M - 1)) + + +def tosynthio(coeffs): + result = np.array(coeffs * 32767, dtype=np.int16) + return trim_zeros(result) + + +def trim_zeros(arr): + i = 0 + j = len(arr) - 1 + while i < len(arr) and arr[i] == 0: + i += 1 + while j > i and arr[j] == 0: + j -= 1 + return arr[i : j + 1] + + +# fiiir.com uses factor 4.6 for blackman window, 0.91 for rectangular +def ntaps(fS, fB, factor=4.6): + b = fB / fS + return round(factor / b) | 1 + + +def LPF(*args, **kw): + return tosynthio(lpf(*args, **kw)) + + +def HPF(*args, **kw): + return tosynthio(hpf(*args, **kw)) + + +def BRF(*args, **kw): + return tosynthio(brf(*args, **kw)) + + +def BPF(*args, **kw): + return tosynthio(bpf(*args, **kw)) + + +if __name__ == "__main__": + print("lpf(24000, 2040, 13) # 1920Hz transition window") + print(list(lpf(24000, 2040, 13))) + + print("hpf(24000, 9600, 13) # 960Hz transition window") + print(list(hpf(24000, 9600, 23))) + + print("bpf(24000, 1200, 11, 3960, 15) # 2400Hz, 1600Hz transition windows") + print(list(bpf(24000, 1200, 11, 3960, 15))) + + print("brf(24000, 960, 19, 2400, 13) # 1200, 1800Hz transition windows") + brf_tst = brf(24000, 960, 19, 2400, 13) + print(brf_tst) + + print("brf(24000, 960, 13, 2400, 19) # 1200, 1800Hz transition windows") + brf_tst = brf(24000, 960, 13, 2400, 19) + print(brf_tst) + + print("lpf(1, 0.1, 59, blackman) # 1920Hz transition window, blackman") + print(lpf(1, 0.1, 59, blackman)) From 3d2db5dbe0f233e02bfbf89b51d7e33967e6cd87 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 17 May 2023 11:11:02 -0500 Subject: [PATCH 1062/1712] synthio: improve documentation, simplify synthio_lfo_obj_tick_scaled --- shared-bindings/synthio/LFO.c | 19 +++++++++++++------ shared-module/synthio/LFO.c | 4 ++-- shared-module/synthio/LFO.h | 4 ++-- shared-module/synthio/Note.c | 8 ++++---- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/shared-bindings/synthio/LFO.c b/shared-bindings/synthio/LFO.c index ce64881f7d..61c66c7fa9 100644 --- a/shared-bindings/synthio/LFO.c +++ b/shared-bindings/synthio/LFO.c @@ -37,16 +37,23 @@ //| //| Every `rate` seconds, the output of the LFO cycles through its `waveform`. //| The output at any particular moment is ``waveform[idx] * scale + offset``. -//| Internally, the calculation takes place in fixed point for speed. //| -//| `rate`, `offset`, `scale`, and `once` can be changed at run-time. +//| `rate`, `offset`, `scale`, and `once` can be changed at run-time. `waveform` may be mutated. //| -//| An LFO only updates if it is actually associated with a playing Note, -//| including if it is indirectly associated with the Note via an intermediate -//| LFO. +//| `waveform` must be a ``ReadableBuffer`` with elements of type `h` (16-bit signed integer). +//| Internally, the elements of `waveform` are scaled so that the input +//| range ``[-32768,32767]`` maps to ``[-1.0, 0.99996]``. +//| +//| An LFO only updates if it is actually associated with a playing `Synthesizer`, +//| including indirectly via a `Note` or another intermediate LFO. //| //| Using the same LFO as an input to multiple other LFOs or Notes is OK, but -//| the result if an LFO is tied to multiple Synthtesizer objects is undefined.""" +//| the result if an LFO is tied to multiple Synthtesizer objects is undefined. +//| +//| In the current implementation, LFOs are updated every 256 samples. This +//| should be considered an implementation detail, though it affects how LFOs +//| behave for instance when used to implement an integrator (``l.offset = l``). +//| """ //| //| def __init__( //| self, diff --git a/shared-module/synthio/LFO.c b/shared-module/synthio/LFO.c index b3f31e48f2..d0a69fb3d5 100644 --- a/shared-module/synthio/LFO.c +++ b/shared-module/synthio/LFO.c @@ -90,9 +90,9 @@ mp_float_t synthio_lfo_obj_tick_limited(synthio_lfo_slot_t *lfo_slot, mp_float_t return value; } -int32_t synthio_lfo_obj_tick_scaled(synthio_lfo_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi, int shift) { +int32_t synthio_lfo_obj_tick_scaled(synthio_lfo_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi) { mp_float_t value = synthio_lfo_obj_tick_limited(lfo_slot, lo, hi); - return (int32_t)MICROPY_FLOAT_C_FUN(round)(MICROPY_FLOAT_C_FUN(ldexp)(value, shift)); + return (int32_t)MICROPY_FLOAT_C_FUN(round)(MICROPY_FLOAT_C_FUN(ldexp)(value, 15)); } void synthio_lfo_assign_input(mp_obj_t obj, synthio_lfo_slot_t *slot, qstr arg_name) { diff --git a/shared-module/synthio/LFO.h b/shared-module/synthio/LFO.h index 8012d4c433..9b8aaf4e3d 100644 --- a/shared-module/synthio/LFO.h +++ b/shared-module/synthio/LFO.h @@ -55,8 +55,8 @@ typedef struct synthio_lfo_obj { mp_float_t synthio_lfo_obj_tick(synthio_lfo_slot_t *lfo_slot); // the same, but the output is constrained to be between lo and hi mp_float_t synthio_lfo_obj_tick_limited(synthio_lfo_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi); -// the same, but the output is constrained to be between lo and hi and converted to an integer with `shift` fractional bits -int32_t synthio_lfo_obj_tick_scaled(synthio_lfo_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi, int shift); +// the same, but the output is constrained to be between lo and hi and converted to an integer with 15 fractional bits +int32_t synthio_lfo_obj_tick_scaled(synthio_lfo_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi); // Assign an object (which may be a float or a synthio_lfo_obj_t) to an lfo slot void synthio_lfo_assign_input(mp_obj_t obj, synthio_lfo_slot_t *lfo_slot, qstr arg_name); diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index 55a57f0ed3..f69f149bb4 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -177,7 +177,7 @@ STATIC uint32_t pitch_bend(uint32_t frequency_scaled, int32_t bend_value) { #define ALMOST_ONE (MICROPY_FLOAT_CONST(32767.) / 32768) uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, uint16_t loudness[2]) { - int panning = synthio_lfo_obj_tick_scaled(&self->panning, -ALMOST_ONE, ALMOST_ONE, 15); + int panning = synthio_lfo_obj_tick_scaled(&self->panning, -ALMOST_ONE, ALMOST_ONE); int left_panning_scaled, right_panning_scaled; if (panning >= 0) { left_panning_scaled = 32768; @@ -187,18 +187,18 @@ uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_ left_panning_scaled = 32767 + panning; } - int amplitude = synthio_lfo_obj_tick_scaled(&self->amplitude, ZERO, ALMOST_ONE, 15); + int amplitude = synthio_lfo_obj_tick_scaled(&self->amplitude, ZERO, ALMOST_ONE); left_panning_scaled = (left_panning_scaled * amplitude) >> 15; right_panning_scaled = (right_panning_scaled * amplitude) >> 15; loudness[0] = (loudness[0] * left_panning_scaled) >> 15; loudness[1] = (loudness[1] * right_panning_scaled) >> 15; if (self->ring_frequency_scaled != 0) { - int ring_bend_value = synthio_lfo_obj_tick_scaled(&self->ring_bend, -12, 12, 15); + int ring_bend_value = synthio_lfo_obj_tick_scaled(&self->ring_bend, -12, 12); self->ring_frequency_bent = pitch_bend(self->ring_frequency_scaled, ring_bend_value); } - int bend_value = synthio_lfo_obj_tick_scaled(&self->bend, -12, 12, 15); + int bend_value = synthio_lfo_obj_tick_scaled(&self->bend, -12, 12); uint32_t frequency_scaled = pitch_bend(self->frequency_scaled, bend_value); return frequency_scaled; From 5de4d197a2504ae27cb446de9fe58bd42e9c8b0f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 17 May 2023 15:05:34 -0500 Subject: [PATCH 1063/1712] synthio: start generalizing LFO to Block --- shared-bindings/synthio/LFO.c | 31 +++++++++++-- shared-bindings/synthio/LFO.h | 1 + shared-bindings/synthio/__init__.c | 6 +-- shared-module/synthio/LFO.c | 71 ++++++++++++++++------------- shared-module/synthio/LFO.h | 37 +++++++++------ shared-module/synthio/Note.c | 16 +++---- shared-module/synthio/Note.h | 2 +- shared-module/synthio/Synthesizer.c | 7 ++- 8 files changed, 103 insertions(+), 68 deletions(-) diff --git a/shared-bindings/synthio/LFO.c b/shared-bindings/synthio/LFO.c index 61c66c7fa9..98e7102666 100644 --- a/shared-bindings/synthio/LFO.c +++ b/shared-bindings/synthio/LFO.c @@ -27,6 +27,7 @@ #include "py/obj.h" #include "py/objproperty.h" +#include "py/proto.h" #include "py/runtime.h" #include "shared-bindings/util.h" #include "shared-bindings/synthio/LFO.h" @@ -40,9 +41,9 @@ //| //| `rate`, `offset`, `scale`, and `once` can be changed at run-time. `waveform` may be mutated. //| -//| `waveform` must be a ``ReadableBuffer`` with elements of type `h` (16-bit signed integer). -//| Internally, the elements of `waveform` are scaled so that the input -//| range ``[-32768,32767]`` maps to ``[-1.0, 0.99996]``. +//| `waveform` must be a ``ReadableBuffer`` with elements of type ``'h'`` +//| (16-bit signed integer). Internally, the elements of `waveform` are scaled +//| so that the input range ``[-32768,32767]`` maps to ``[-1.0, 0.99996]``. //| //| An LFO only updates if it is actually associated with a playing `Synthesizer`, //| including indirectly via a `Note` or another intermediate LFO. @@ -80,11 +81,11 @@ STATIC mp_obj_t synthio_lfo_make_new(const mp_obj_type_t *type_in, size_t n_args mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(lfo_properties), lfo_properties, args); synthio_lfo_obj_t *self = m_new_obj(synthio_lfo_obj_t); - self->base.type = &synthio_lfo_type; + self->base.base.type = &synthio_lfo_type; synthio_synth_parse_waveform(&self->waveform_bufinfo, args[ARG_waveform].u_obj); self->waveform_obj = args[ARG_waveform].u_obj; - self->last_tick = synthio_global_tick; + self->base.last_tick = synthio_global_tick; mp_obj_t result = MP_OBJ_FROM_PTR(self); properties_construct_helper(result, lfo_properties + 1, args + 1, MP_ARRAY_SIZE(lfo_properties) - 1); @@ -232,10 +233,30 @@ STATIC const mp_rom_map_elem_t synthio_lfo_locals_dict_table[] = { }; STATIC MP_DEFINE_CONST_DICT(synthio_lfo_locals_dict, synthio_lfo_locals_dict_table); + +STATIC const synthio_block_proto_t lfo_proto = { + MP_PROTO_IMPLEMENT(MP_QSTR_synthio_block) + .tick = common_hal_synthio_lfo_tick, +}; + const mp_obj_type_t synthio_lfo_type = { { &mp_type_type }, + .flags = MP_TYPE_FLAG_EXTENDED, .name = MP_QSTR_LFO, .make_new = synthio_lfo_make_new, .locals_dict = (mp_obj_dict_t *)&synthio_lfo_locals_dict, .print = lfo_print, + MP_TYPE_EXTENDED_FIELDS( + .protocol = &lfo_proto, + ), }; + +#if 0 +const mp_obj_type_t synthio_math_type = { + { &mp_type_type }, + .name = MP_QSTR_Math, + .make_new = synthio_math_make_new, + .locals_dict = (mp_obj_dict_t *)&synthio_math_locals_dict, + .print = math_print, +}; +#endif diff --git a/shared-bindings/synthio/LFO.h b/shared-bindings/synthio/LFO.h index e0123dc5b2..f7deabbd4a 100644 --- a/shared-bindings/synthio/LFO.h +++ b/shared-bindings/synthio/LFO.h @@ -51,3 +51,4 @@ mp_float_t common_hal_synthio_lfo_get_value(synthio_lfo_obj_t *self); mp_float_t common_hal_synthio_lfo_get_phase(synthio_lfo_obj_t *self); void common_hal_synthio_lfo_retrigger(synthio_lfo_obj_t *self); +mp_float_t common_hal_synthio_lfo_tick(mp_obj_t self_in); diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index eb9df13a25..0142f5721d 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -294,9 +294,9 @@ STATIC mp_obj_t synthio_lfo_tick(size_t n, const mp_obj_t *args) { shared_bindings_synthio_lfo_tick(48000); mp_obj_t result[n]; for (size_t i = 0; i < n; i++) { - synthio_lfo_slot_t slot; - synthio_lfo_assign_input(args[i], &slot, MP_QSTR_arg); - mp_float_t value = synthio_lfo_obj_tick(&slot); + synthio_block_slot_t slot; + synthio_block_assign_slot(args[i], &slot, MP_QSTR_arg); + mp_float_t value = synthio_block_slot_get(&slot); result[i] = mp_obj_new_float(value); } return mp_obj_new_tuple(n, result); diff --git a/shared-module/synthio/LFO.c b/shared-module/synthio/LFO.c index d0a69fb3d5..5f1e30146f 100644 --- a/shared-module/synthio/LFO.c +++ b/shared-module/synthio/LFO.c @@ -31,24 +31,10 @@ #define ONE (MICROPY_FLOAT_CONST(1.)) #define ZERO (MICROPY_FLOAT_CONST(0.)) +mp_float_t common_hal_synthio_lfo_tick(mp_obj_t self_in) { + synthio_lfo_obj_t *lfo = MP_OBJ_TO_PTR(self_in); -mp_float_t synthio_lfo_obj_tick(synthio_lfo_slot_t *slot) { - mp_obj_t obj = slot->obj; - - if (!mp_obj_is_type(obj, &synthio_lfo_type)) { - return slot->value; - } - - synthio_lfo_obj_t *lfo = MP_OBJ_TO_PTR(obj); - if (lfo->last_tick == synthio_global_tick) { - slot->value = lfo->value; - return slot->value; - } - - lfo->last_tick = synthio_global_tick; - - mp_float_t rate = synthio_lfo_obj_tick(&lfo->rate) * synthio_global_rate_scale; - ; + mp_float_t rate = synthio_block_slot_get(&lfo->rate) * synthio_global_rate_scale; mp_float_t accum = lfo->accum + rate; int len = lfo->waveform_bufinfo.len / 2; @@ -71,16 +57,37 @@ mp_float_t synthio_lfo_obj_tick(synthio_lfo_slot_t *slot) { int16_t *waveform = lfo->waveform_bufinfo.buf; assert(idx < lfo->waveform_bufinfo.len / 2); - mp_float_t scale = synthio_lfo_obj_tick(&lfo->scale); - mp_float_t offset = synthio_lfo_obj_tick(&lfo->offset); + mp_float_t scale = synthio_block_slot_get(&lfo->scale); + mp_float_t offset = synthio_block_slot_get(&lfo->offset); mp_float_t value = MICROPY_FLOAT_C_FUN(ldexp)(waveform[idx], -15) * scale + offset; - lfo->value = slot->value = value; return value; } -mp_float_t synthio_lfo_obj_tick_limited(synthio_lfo_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi) { - mp_float_t value = synthio_lfo_obj_tick(lfo_slot); +mp_float_t synthio_block_slot_get(synthio_block_slot_t *slot) { + if (slot->obj == mp_const_none) { + return MICROPY_FLOAT_CONST(0.); + } + + mp_float_t value; + if (mp_obj_get_float_maybe(slot->obj, &value)) { + return value; + } + + synthio_block_base_t *block = MP_OBJ_TO_PTR(slot->obj); + if (block->last_tick == synthio_global_tick) { + return block->value; + } + + block->last_tick = synthio_global_tick; + // previously verified by call to mp_proto_get + const synthio_block_proto_t *p = mp_type_get_protocol_slot(mp_obj_get_type(slot->obj)); + block->value = value = p->tick(slot); + return value; +} + +mp_float_t synthio_block_slot_get_limited(synthio_block_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi) { + mp_float_t value = synthio_block_slot_get(lfo_slot); if (value < lo) { return lo; } @@ -90,22 +97,22 @@ mp_float_t synthio_lfo_obj_tick_limited(synthio_lfo_slot_t *lfo_slot, mp_float_t return value; } -int32_t synthio_lfo_obj_tick_scaled(synthio_lfo_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi) { - mp_float_t value = synthio_lfo_obj_tick_limited(lfo_slot, lo, hi); +int32_t synthio_block_slot_get_scaled(synthio_block_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi) { + mp_float_t value = synthio_block_slot_get_limited(lfo_slot, lo, hi); return (int32_t)MICROPY_FLOAT_C_FUN(round)(MICROPY_FLOAT_C_FUN(ldexp)(value, 15)); } -void synthio_lfo_assign_input(mp_obj_t obj, synthio_lfo_slot_t *slot, qstr arg_name) { - if (mp_obj_is_type(obj, &synthio_lfo_type)) { +void synthio_block_assign_slot(mp_obj_t obj, synthio_block_slot_t *slot, qstr arg_name) { + if (mp_proto_get(MP_QSTR_synthio_block, obj)) { slot->obj = obj; return; } - if (!mp_obj_get_float_maybe(obj, &slot->value)) { + mp_float_t value; + if (obj != mp_const_none && !mp_obj_get_float_maybe(obj, &value)) { mp_raise_TypeError_varg(translate("%q must be of type %q or %q, not %q"), arg_name, MP_QSTR_Lfo, MP_QSTR_float, mp_obj_get_type_qstr(obj)); } - slot->value = mp_obj_get_float(obj); slot->obj = obj; } @@ -118,21 +125,21 @@ mp_obj_t common_hal_synthio_lfo_get_rate_obj(synthio_lfo_obj_t *self) { } void common_hal_synthio_lfo_set_rate_obj(synthio_lfo_obj_t *self, mp_obj_t arg) { - synthio_lfo_assign_input(arg, &self->rate, MP_QSTR_rate); + synthio_block_assign_slot(arg, &self->rate, MP_QSTR_rate); } mp_obj_t common_hal_synthio_lfo_get_scale_obj(synthio_lfo_obj_t *self) { return self->scale.obj; } void common_hal_synthio_lfo_set_scale_obj(synthio_lfo_obj_t *self, mp_obj_t arg) { - synthio_lfo_assign_input(arg, &self->scale, MP_QSTR_scale); + synthio_block_assign_slot(arg, &self->scale, MP_QSTR_scale); } mp_obj_t common_hal_synthio_lfo_get_offset_obj(synthio_lfo_obj_t *self) { return self->offset.obj; } void common_hal_synthio_lfo_set_offset_obj(synthio_lfo_obj_t *self, mp_obj_t arg) { - synthio_lfo_assign_input(arg, &self->offset, MP_QSTR_offset); + synthio_block_assign_slot(arg, &self->offset, MP_QSTR_offset); } bool common_hal_synthio_lfo_get_once(synthio_lfo_obj_t *self) { @@ -143,7 +150,7 @@ void common_hal_synthio_lfo_set_once(synthio_lfo_obj_t *self, bool arg) { } mp_float_t common_hal_synthio_lfo_get_value(synthio_lfo_obj_t *self) { - return self->value; + return self->base.value; } mp_float_t common_hal_synthio_lfo_get_phase(synthio_lfo_obj_t *self) { diff --git a/shared-module/synthio/LFO.h b/shared-module/synthio/LFO.h index 9b8aaf4e3d..e716ea0b39 100644 --- a/shared-module/synthio/LFO.h +++ b/shared-module/synthio/LFO.h @@ -27,36 +27,43 @@ #pragma once #include "py/obj.h" +#include "py/proto.h" #include "shared-module/synthio/__init__.h" #include "shared-bindings/synthio/__init__.h" -typedef struct synthio_lfo_slot { - mp_obj_t obj; +typedef struct synthio_block_base { + mp_obj_base_t base; + uint8_t last_tick; mp_float_t value; -} synthio_lfo_slot_t; +} synthio_block_base_t; + +typedef struct synthio_block_slot { + mp_obj_t obj; +} synthio_block_slot_t; + +typedef struct { + MP_PROTOCOL_HEAD; + mp_float_t (*tick)(mp_obj_t obj); +} synthio_block_proto_t; typedef struct synthio_lfo_obj { - mp_obj_base_t base; - - int32_t sample_rate; - - uint8_t last_tick; + synthio_block_base_t base; bool once; - synthio_lfo_slot_t rate, scale, offset; - mp_float_t accum, value; + synthio_block_slot_t rate, scale, offset; + mp_float_t accum; mp_obj_t waveform_obj; mp_buffer_info_t waveform_bufinfo; } synthio_lfo_obj_t; // Update the value inside the lfo slot if the value is an LFO, returning the new value -mp_float_t synthio_lfo_obj_tick(synthio_lfo_slot_t *lfo_slot); +mp_float_t synthio_block_slot_get(synthio_block_slot_t *block_slot); // the same, but the output is constrained to be between lo and hi -mp_float_t synthio_lfo_obj_tick_limited(synthio_lfo_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi); +mp_float_t synthio_block_slot_get_limited(synthio_block_slot_t *block_slot, mp_float_t lo, mp_float_t hi); // the same, but the output is constrained to be between lo and hi and converted to an integer with 15 fractional bits -int32_t synthio_lfo_obj_tick_scaled(synthio_lfo_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi); +int32_t synthio_block_slot_get_scaled(synthio_block_slot_t *block_slot, mp_float_t lo, mp_float_t hi); -// Assign an object (which may be a float or a synthio_lfo_obj_t) to an lfo slot -void synthio_lfo_assign_input(mp_obj_t obj, synthio_lfo_slot_t *lfo_slot, qstr arg_name); +// Assign an object (which may be a float or a synthio_block_obj_t) to an block slot +void synthio_block_assign_slot(mp_obj_t obj, synthio_block_slot_t *block_slot, qstr arg_name); diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index f69f149bb4..6a8982f6b2 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -63,7 +63,7 @@ mp_obj_t common_hal_synthio_note_get_panning(synthio_note_obj_t *self) { } void common_hal_synthio_note_set_panning(synthio_note_obj_t *self, mp_obj_t value_in) { - synthio_lfo_assign_input(value_in, &self->panning, MP_QSTR_panning); + synthio_block_assign_slot(value_in, &self->panning, MP_QSTR_panning); } mp_obj_t common_hal_synthio_note_get_amplitude(synthio_note_obj_t *self) { @@ -71,7 +71,7 @@ mp_obj_t common_hal_synthio_note_get_amplitude(synthio_note_obj_t *self) { } void common_hal_synthio_note_set_amplitude(synthio_note_obj_t *self, mp_obj_t value_in) { - synthio_lfo_assign_input(value_in, &self->amplitude, MP_QSTR_amplitude); + synthio_block_assign_slot(value_in, &self->amplitude, MP_QSTR_amplitude); } mp_obj_t common_hal_synthio_note_get_bend(synthio_note_obj_t *self) { @@ -79,7 +79,7 @@ mp_obj_t common_hal_synthio_note_get_bend(synthio_note_obj_t *self) { } void common_hal_synthio_note_set_bend(synthio_note_obj_t *self, mp_obj_t value_in) { - synthio_lfo_assign_input(value_in, &self->bend, MP_QSTR_bend); + synthio_block_assign_slot(value_in, &self->bend, MP_QSTR_bend); } mp_obj_t common_hal_synthio_note_get_ring_bend(synthio_note_obj_t *self) { @@ -87,7 +87,7 @@ mp_obj_t common_hal_synthio_note_get_ring_bend(synthio_note_obj_t *self) { } void common_hal_synthio_note_set_ring_bend(synthio_note_obj_t *self, mp_obj_t value_in) { - synthio_lfo_assign_input(value_in, &self->ring_bend, MP_QSTR_ring_bend); + synthio_block_assign_slot(value_in, &self->ring_bend, MP_QSTR_ring_bend); } mp_obj_t common_hal_synthio_note_get_envelope_obj(synthio_note_obj_t *self) { @@ -177,7 +177,7 @@ STATIC uint32_t pitch_bend(uint32_t frequency_scaled, int32_t bend_value) { #define ALMOST_ONE (MICROPY_FLOAT_CONST(32767.) / 32768) uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_t dur, uint16_t loudness[2]) { - int panning = synthio_lfo_obj_tick_scaled(&self->panning, -ALMOST_ONE, ALMOST_ONE); + int panning = synthio_block_slot_get_scaled(&self->panning, -ALMOST_ONE, ALMOST_ONE); int left_panning_scaled, right_panning_scaled; if (panning >= 0) { left_panning_scaled = 32768; @@ -187,18 +187,18 @@ uint32_t synthio_note_step(synthio_note_obj_t *self, int32_t sample_rate, int16_ left_panning_scaled = 32767 + panning; } - int amplitude = synthio_lfo_obj_tick_scaled(&self->amplitude, ZERO, ALMOST_ONE); + int amplitude = synthio_block_slot_get_scaled(&self->amplitude, ZERO, ALMOST_ONE); left_panning_scaled = (left_panning_scaled * amplitude) >> 15; right_panning_scaled = (right_panning_scaled * amplitude) >> 15; loudness[0] = (loudness[0] * left_panning_scaled) >> 15; loudness[1] = (loudness[1] * right_panning_scaled) >> 15; if (self->ring_frequency_scaled != 0) { - int ring_bend_value = synthio_lfo_obj_tick_scaled(&self->ring_bend, -12, 12); + int ring_bend_value = synthio_block_slot_get_scaled(&self->ring_bend, -12, 12); self->ring_frequency_bent = pitch_bend(self->ring_frequency_scaled, ring_bend_value); } - int bend_value = synthio_lfo_obj_tick_scaled(&self->bend, -12, 12); + int bend_value = synthio_block_slot_get_scaled(&self->bend, -12, 12); uint32_t frequency_scaled = pitch_bend(self->frequency_scaled, bend_value); return frequency_scaled; diff --git a/shared-module/synthio/Note.h b/shared-module/synthio/Note.h index 6586e396a7..ba777c237c 100644 --- a/shared-module/synthio/Note.h +++ b/shared-module/synthio/Note.h @@ -33,7 +33,7 @@ typedef struct synthio_note_obj { mp_obj_base_t base; - synthio_lfo_slot_t panning, bend, amplitude, ring_bend; + synthio_block_slot_t panning, bend, amplitude, ring_bend; mp_float_t frequency, ring_frequency; mp_obj_t waveform_obj, envelope_obj, ring_waveform_obj; diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index d6e147d6df..f773f4d640 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -78,10 +78,9 @@ audioio_get_buffer_result_t synthio_synthesizer_get_buffer(synthio_synthesizer_o mp_obj_t iterable = mp_getiter(self->lfos, &iter_buf); mp_obj_t item; while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - synthio_lfo_slot_t slot = { .obj = item }; - // does not error for invalid type, so it's OK that we don't police - // list contents - (void)synthio_lfo_obj_tick(&slot); + synthio_block_slot_t slot; + synthio_block_assign_slot(item, &slot, MP_QSTR_arg); + (void)synthio_block_slot_get(&slot); } return GET_BUFFER_MORE_DATA; } From 391438102b2d570c25d480a9a2b3a153555fa534 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 17 May 2023 16:15:31 -0500 Subject: [PATCH 1064/1712] synthio: Finish implementing Math blocks --- .../unix/variants/coverage/mpconfigvariant.mk | 2 + py/circuitpy_defns.mk | 1 + shared-bindings/synthio/LFO.c | 2 +- shared-bindings/synthio/Math.c | 286 ++++++++++++++++++ shared-bindings/synthio/Math.h | 60 ++++ shared-bindings/synthio/__init__.c | 7 +- shared-module/synthio/LFO.c | 52 ---- shared-module/synthio/LFO.h | 21 +- shared-module/synthio/Math.c | 122 ++++++++ shared-module/synthio/Math.h | 34 +++ shared-module/synthio/__init__.c | 52 ++++ shared-module/synthio/block.h | 58 ++++ tests/circuitpython/synthmath.py | 8 + tests/circuitpython/synthmath.py.exp | 203 +++++++++++++ 14 files changed, 833 insertions(+), 75 deletions(-) create mode 100644 shared-bindings/synthio/Math.c create mode 100644 shared-bindings/synthio/Math.h create mode 100644 shared-module/synthio/Math.c create mode 100644 shared-module/synthio/Math.h create mode 100644 shared-module/synthio/block.h create mode 100644 tests/circuitpython/synthmath.py create mode 100644 tests/circuitpython/synthmath.py.exp diff --git a/ports/unix/variants/coverage/mpconfigvariant.mk b/ports/unix/variants/coverage/mpconfigvariant.mk index 8af5eea172..7fe2afdb36 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.mk +++ b/ports/unix/variants/coverage/mpconfigvariant.mk @@ -41,6 +41,7 @@ SRC_BITMAP := \ shared-bindings/rainbowio/__init__.c \ shared-bindings/struct/__init__.c \ shared-bindings/synthio/__init__.c \ + shared-bindings/synthio/Math.c \ shared-bindings/synthio/MidiTrack.c \ shared-bindings/synthio/LFO.c \ shared-bindings/synthio/Note.c \ @@ -65,6 +66,7 @@ SRC_BITMAP := \ shared-module/rainbowio/__init__.c \ shared-module/struct/__init__.c \ shared-module/synthio/__init__.c \ + shared-module/synthio/Math.c \ shared-module/synthio/MidiTrack.c \ shared-module/synthio/LFO.c \ shared-module/synthio/Note.c \ diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 44f896cb7b..ae4b1bf3db 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -651,6 +651,7 @@ SRC_SHARED_MODULE_ALL = \ supervisor/__init__.c \ supervisor/StatusBar.c \ synthio/LFO.c \ + synthio/Math.c \ synthio/MidiTrack.c \ synthio/Note.c \ synthio/Synthesizer.c \ diff --git a/shared-bindings/synthio/LFO.c b/shared-bindings/synthio/LFO.c index 98e7102666..731561d9b2 100644 --- a/shared-bindings/synthio/LFO.c +++ b/shared-bindings/synthio/LFO.c @@ -34,7 +34,7 @@ #include "shared-module/synthio/LFO.h" //| class LFO: -//| """A low-frequency oscillator +//| """A low-frequency oscillator block //| //| Every `rate` seconds, the output of the LFO cycles through its `waveform`. //| The output at any particular moment is ``waveform[idx] * scale + offset``. diff --git a/shared-bindings/synthio/Math.c b/shared-bindings/synthio/Math.c new file mode 100644 index 0000000000..1f0db572b1 --- /dev/null +++ b/shared-bindings/synthio/Math.c @@ -0,0 +1,286 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Artyom Skrobov + * Copyright (c) 2023 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/obj.h" +#include "py/objproperty.h" +#include "py/proto.h" +#include "py/runtime.h" +#include "shared-bindings/util.h" +#include "shared-bindings/synthio/Math.h" +#include "shared-module/synthio/Math.h" + +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, SUM, OP_SUM); +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, ADD_SUB, OP_ADD_SUB); +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, PRODUCT, OP_PRODUCT); +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, MUL_DIV, OP_MUL_DIV); +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, SCALE_OFFSET, OP_SCALE_OFFSET); +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, OFFSET_SCALE, OP_OFFSET_SCALE); +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, LERP, OP_LERP); +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, CONSTRAINED_LERP, OP_CONSTRAINED_LERP); +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, DIV_ADD, OP_DIV_ADD); +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, ADD_DIV, OP_ADD_DIV); +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, MID, OP_MID); +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, MAX, OP_MAX); +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, MIN, OP_MIN); +MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, ABS, OP_ABS); + +//| class MathOperation: +//| """Operation for a Math block""" +//| +//| SUM: "MathOperation" +//| """Computes ``a+b+c``. For 2-input sum, set one argument to ``0.0``. To hold a control value for multiple subscribers, set two arguments to ``0.0``.""" +//| +//| ADD_SUB: "MathOperation" +//| """Computes ``a+b-c``. For 2-input subtraction, set ``b`` to ``0.0``.""" +//| +//| PRODUCT: "MathOperation" +//| """Computes ``a*b*c``. For 2-input product, set one argument to ``1.0``.""" +//| +//| MUL_DIV: "MathOperation" +//| """Computes ``a*b/c``. If ``c`` is zero, the output is ``1.0``.""" +//| +//| SCALE_OFFSET: "MathOperation" +//| """Computes ``(a*b)+c``.""" +//| +//| OFFSET_SCALE: "MathOperation" +//| """Computes ``(a+b)*c``. For 2-input multiplication, set ``b`` to 0.""" +//| +//| LERP: "MathOperation" +//| """Computes ``a * (1-c) + b * c``.""" +//| +//| CONSTRAINED_LERP: "MathOperation" +//| """Computes ``a * (1-c') + b * c'``, where ``c'`` is constrained to be between ``0.0`` and ``1.0``.""" +//| +//| DIV_ADD: "MathOperation" +//| """Computes ``a/b+c``. If ``b`` is zero, the output is ``c``.""" +//| +//| ADD_DIV: "MathOperation" +//| """Computes ``(a+b)/c``. For 2-input product, set ``b`` to ``0.0``.""" +//| +//| MID: "MathOperation" +//| """Returns the middle of the 3 input values.""" +//| +//| MAX: "MathOperation" +//| """Returns the biggest of the 3 input values.""" +//| +//| MIN: "MathOperation" +//| """Returns the smallest of the 3 input values.""" +//| +//| ABS: "MathOperation" +//| """Returns the absolute value of ``a``.""" +//| +MAKE_ENUM_MAP(synthio_math_operation) { + MAKE_ENUM_MAP_ENTRY(math_op, SUM), + MAKE_ENUM_MAP_ENTRY(math_op, ADD_SUB), + MAKE_ENUM_MAP_ENTRY(math_op, PRODUCT), + MAKE_ENUM_MAP_ENTRY(math_op, MUL_DIV), + MAKE_ENUM_MAP_ENTRY(math_op, SCALE_OFFSET), + MAKE_ENUM_MAP_ENTRY(math_op, OFFSET_SCALE), + MAKE_ENUM_MAP_ENTRY(math_op, LERP), + MAKE_ENUM_MAP_ENTRY(math_op, CONSTRAINED_LERP), + MAKE_ENUM_MAP_ENTRY(math_op, DIV_ADD), + MAKE_ENUM_MAP_ENTRY(math_op, ADD_DIV), + MAKE_ENUM_MAP_ENTRY(math_op, MID), + MAKE_ENUM_MAP_ENTRY(math_op, MAX), + MAKE_ENUM_MAP_ENTRY(math_op, MIN), + MAKE_ENUM_MAP_ENTRY(math_op, ABS), +}; + +STATIC MP_DEFINE_CONST_DICT(synthio_math_operation_locals_dict, synthio_math_operation_locals_table); +MAKE_PRINTER(synthio, synthio_math_operation); +MAKE_ENUM_TYPE(synthio, MathOperation, synthio_math_operation); + +//| class Math: +//| """An arithmetic block +//| +//| Performs an arithmetic operation on up to 3 inputs. See the +//| documentation of ``MathOperation`` for the specific functions available. +//| +//| The properties can all be changed at run-time. +//| +//| An Math only updates if it is actually associated with a playing `Synthesizer`, +//| including indirectly via a `Note` or another intermediate Math. +//| +//| Using the same Math as an input to multiple other Maths or Notes is OK, but +//| the result if an Math is tied to multiple Synthtesizer objects is undefined. +//| +//| In the current implementation, Maths are updated every 256 samples. This +//| should be considered an implementation detail. +//| """ +//| +//| def __init__( +//| self, +//| operation: MathOperation, +//| a: BlockInput, +//| b: BlockInput = 0.0, +//| c: BlockInput = 1.0, +//| ): +//| pass +static const mp_arg_t math_properties[] = { + { MP_QSTR_operation, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = NULL } }, + { MP_QSTR_a, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = NULL } }, + { MP_QSTR_b, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(0) } }, + { MP_QSTR_c, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(1) } }, +}; + +STATIC mp_obj_t synthio_math_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + mp_arg_val_t args[MP_ARRAY_SIZE(math_properties)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(math_properties), math_properties, args); + + synthio_math_obj_t *self = m_new_obj(synthio_math_obj_t); + self->base.base.type = &synthio_math_type; + + self->base.last_tick = synthio_global_tick; + + mp_obj_t result = MP_OBJ_FROM_PTR(self); + properties_construct_helper(result, math_properties, args, MP_ARRAY_SIZE(math_properties)); + + return result; +}; + +//| a: BlockInput +//| """The first input to the operation""" +STATIC mp_obj_t synthio_math_get_a(mp_obj_t self_in) { + synthio_math_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_synthio_math_get_input_obj(self, 0); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_math_get_a_obj, synthio_math_get_a); + +STATIC mp_obj_t synthio_math_set_a(mp_obj_t self_in, mp_obj_t arg) { + synthio_math_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_math_set_input_obj(self, 0, arg, MP_QSTR_a); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_math_set_a_obj, synthio_math_set_a); +MP_PROPERTY_GETSET(synthio_math_a_obj, + (mp_obj_t)&synthio_math_get_a_obj, + (mp_obj_t)&synthio_math_set_a_obj); + + +//| b: BlockInput +//| """The second input to the operation""" +STATIC mp_obj_t synthio_math_get_b(mp_obj_t self_in) { + synthio_math_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_synthio_math_get_input_obj(self, 1); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_math_get_b_obj, synthio_math_get_b); + +STATIC mp_obj_t synthio_math_set_b(mp_obj_t self_in, mp_obj_t arg) { + synthio_math_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_math_set_input_obj(self, 1, arg, MP_QSTR_b); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_math_set_b_obj, synthio_math_set_b); +MP_PROPERTY_GETSET(synthio_math_b_obj, + (mp_obj_t)&synthio_math_get_b_obj, + (mp_obj_t)&synthio_math_set_b_obj); + + +//| c: BlockInput +//| """The third input to the operation""" +STATIC mp_obj_t synthio_math_get_c(mp_obj_t self_in) { + synthio_math_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_synthio_math_get_input_obj(self, 2); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_math_get_c_obj, synthio_math_get_c); + +STATIC mp_obj_t synthio_math_set_c(mp_obj_t self_in, mp_obj_t arg) { + synthio_math_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_math_set_input_obj(self, 2, arg, MP_QSTR_c); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_math_set_c_obj, synthio_math_set_c); +MP_PROPERTY_GETSET(synthio_math_c_obj, + (mp_obj_t)&synthio_math_get_c_obj, + (mp_obj_t)&synthio_math_set_c_obj); + + +//| operation: MathOperation +//| """The function to compute""" +STATIC mp_obj_t synthio_math_get_operation(mp_obj_t self_in) { + synthio_math_obj_t *self = MP_OBJ_TO_PTR(self_in); + return cp_enum_find(&synthio_math_operation_type, common_hal_synthio_math_get_operation(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_math_get_operation_obj, synthio_math_get_operation); + +STATIC mp_obj_t synthio_math_set_operation(mp_obj_t self_in, mp_obj_t arg) { + synthio_math_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_math_set_operation(self, cp_enum_value(&synthio_math_operation_type, arg, MP_QSTR_operation)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_math_set_operation_obj, synthio_math_set_operation); +MP_PROPERTY_GETSET(synthio_math_operation_obj, + (mp_obj_t)&synthio_math_get_operation_obj, + (mp_obj_t)&synthio_math_set_operation_obj); + + + +//| +//| value: float +//| """The value of the oscillator (read-only)""" +//| +STATIC mp_obj_t synthio_math_get_value(mp_obj_t self_in) { + synthio_math_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_float(common_hal_synthio_math_get_value(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_math_get_value_obj, synthio_math_get_value); + +MP_PROPERTY_GETTER(synthio_math_value_obj, + (mp_obj_t)&synthio_math_get_value_obj); + + +static void math_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { + (void)kind; + properties_print_helper(print, self_in, math_properties, MP_ARRAY_SIZE(math_properties)); +} + +STATIC const mp_rom_map_elem_t synthio_math_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_a), MP_ROM_PTR(&synthio_math_a_obj) }, + { MP_ROM_QSTR(MP_QSTR_b), MP_ROM_PTR(&synthio_math_b_obj) }, + { MP_ROM_QSTR(MP_QSTR_c), MP_ROM_PTR(&synthio_math_c_obj) }, + { MP_ROM_QSTR(MP_QSTR_operation), MP_ROM_PTR(&synthio_math_operation_obj) }, + { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&synthio_math_value_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(synthio_math_locals_dict, synthio_math_locals_dict_table); + + +STATIC const synthio_block_proto_t math_proto = { + MP_PROTO_IMPLEMENT(MP_QSTR_synthio_block) + .tick = common_hal_synthio_math_tick, +}; + +const mp_obj_type_t synthio_math_type = { + { &mp_type_type }, + .flags = MP_TYPE_FLAG_EXTENDED, + .name = MP_QSTR_Math, + .make_new = synthio_math_make_new, + .locals_dict = (mp_obj_dict_t *)&synthio_math_locals_dict, + .print = math_print, + MP_TYPE_EXTENDED_FIELDS( + .protocol = &math_proto, + ), +}; diff --git a/shared-bindings/synthio/Math.h b/shared-bindings/synthio/Math.h new file mode 100644 index 0000000000..472546fc42 --- /dev/null +++ b/shared-bindings/synthio/Math.h @@ -0,0 +1,60 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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" + +typedef enum { + OP_SUM, + OP_ADD_SUB, + OP_PRODUCT, + OP_MUL_DIV, + OP_SCALE_OFFSET, + OP_OFFSET_SCALE, + OP_LERP, + OP_CONSTRAINED_LERP, + OP_DIV_ADD, + OP_ADD_DIV, + OP_MID, + OP_MIN, + OP_MAX, + OP_ABS +} synthio_math_operation_t; + +typedef struct synthio_math_obj synthio_math_obj_t; +extern const mp_obj_type_t synthio_math_type; +extern const mp_obj_type_t synthio_math_operation_type; + +mp_obj_t common_hal_synthio_math_get_input_obj(synthio_math_obj_t *self, size_t i); +void common_hal_synthio_math_set_input_obj(synthio_math_obj_t *self, size_t i, mp_obj_t arg, qstr argname); + +synthio_math_operation_t common_hal_synthio_math_get_operation(synthio_math_obj_t *self); +void common_hal_synthio_math_set_operation(synthio_math_obj_t *self, synthio_math_operation_t arg); + +mp_float_t common_hal_synthio_math_get_value(synthio_math_obj_t *self); + +mp_float_t common_hal_synthio_math_tick(mp_obj_t self_in); diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 0142f5721d..72104332af 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -37,6 +37,7 @@ #include "shared-bindings/synthio/__init__.h" #include "shared-bindings/synthio/LFO.h" +#include "shared-bindings/synthio/Math.h" #include "shared-bindings/synthio/MidiTrack.h" #include "shared-bindings/synthio/Note.h" #include "shared-bindings/synthio/Synthesizer.h" @@ -63,8 +64,8 @@ static const mp_arg_t envelope_properties[] = { //| At least 2 simultaneous notes are supported. samd5x, mimxrt10xx and rp2040 platforms support up to 12 notes. //| """ //| -//| BlockInput = Union["LFO", float] -//| """LFOs and Notes can take any of these types as inputs on certain attributes""" +//| BlockInput = Union["Math", "LFO", float, None] +//| """Blocks and Notes can take any of these types as inputs on certain attributes""" //| //| class Envelope: //| def __init__( @@ -306,6 +307,8 @@ MP_DEFINE_CONST_FUN_OBJ_VAR(synthio_lfo_tick_obj, 1, synthio_lfo_tick); STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_synthio) }, + { MP_ROM_QSTR(MP_QSTR_Math), MP_ROM_PTR(&synthio_math_type) }, + { MP_ROM_QSTR(MP_QSTR_MathOperation), MP_ROM_PTR(&synthio_math_operation_type) }, { MP_ROM_QSTR(MP_QSTR_MidiTrack), MP_ROM_PTR(&synthio_miditrack_type) }, { MP_ROM_QSTR(MP_QSTR_Note), MP_ROM_PTR(&synthio_note_type) }, { MP_ROM_QSTR(MP_QSTR_LFO), MP_ROM_PTR(&synthio_lfo_type) }, diff --git a/shared-module/synthio/LFO.c b/shared-module/synthio/LFO.c index 5f1e30146f..b4fe2dc7ac 100644 --- a/shared-module/synthio/LFO.c +++ b/shared-module/synthio/LFO.c @@ -64,58 +64,6 @@ mp_float_t common_hal_synthio_lfo_tick(mp_obj_t self_in) { return value; } -mp_float_t synthio_block_slot_get(synthio_block_slot_t *slot) { - if (slot->obj == mp_const_none) { - return MICROPY_FLOAT_CONST(0.); - } - - mp_float_t value; - if (mp_obj_get_float_maybe(slot->obj, &value)) { - return value; - } - - synthio_block_base_t *block = MP_OBJ_TO_PTR(slot->obj); - if (block->last_tick == synthio_global_tick) { - return block->value; - } - - block->last_tick = synthio_global_tick; - // previously verified by call to mp_proto_get - const synthio_block_proto_t *p = mp_type_get_protocol_slot(mp_obj_get_type(slot->obj)); - block->value = value = p->tick(slot); - return value; -} - -mp_float_t synthio_block_slot_get_limited(synthio_block_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi) { - mp_float_t value = synthio_block_slot_get(lfo_slot); - if (value < lo) { - return lo; - } - if (value > hi) { - return hi; - } - return value; -} - -int32_t synthio_block_slot_get_scaled(synthio_block_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi) { - mp_float_t value = synthio_block_slot_get_limited(lfo_slot, lo, hi); - return (int32_t)MICROPY_FLOAT_C_FUN(round)(MICROPY_FLOAT_C_FUN(ldexp)(value, 15)); -} - -void synthio_block_assign_slot(mp_obj_t obj, synthio_block_slot_t *slot, qstr arg_name) { - if (mp_proto_get(MP_QSTR_synthio_block, obj)) { - slot->obj = obj; - return; - } - - mp_float_t value; - if (obj != mp_const_none && !mp_obj_get_float_maybe(obj, &value)) { - mp_raise_TypeError_varg(translate("%q must be of type %q or %q, not %q"), arg_name, MP_QSTR_Lfo, MP_QSTR_float, mp_obj_get_type_qstr(obj)); - } - - slot->obj = obj; -} - mp_obj_t common_hal_synthio_lfo_get_waveform_obj(synthio_lfo_obj_t *self) { return self->waveform_obj; } diff --git a/shared-module/synthio/LFO.h b/shared-module/synthio/LFO.h index e716ea0b39..4e97477ddd 100644 --- a/shared-module/synthio/LFO.h +++ b/shared-module/synthio/LFO.h @@ -26,26 +26,7 @@ #pragma once -#include "py/obj.h" -#include "py/proto.h" - -#include "shared-module/synthio/__init__.h" -#include "shared-bindings/synthio/__init__.h" - -typedef struct synthio_block_base { - mp_obj_base_t base; - uint8_t last_tick; - mp_float_t value; -} synthio_block_base_t; - -typedef struct synthio_block_slot { - mp_obj_t obj; -} synthio_block_slot_t; - -typedef struct { - MP_PROTOCOL_HEAD; - mp_float_t (*tick)(mp_obj_t obj); -} synthio_block_proto_t; +#include "shared-module/synthio/block.h" typedef struct synthio_lfo_obj { synthio_block_base_t base; diff --git a/shared-module/synthio/Math.c b/shared-module/synthio/Math.c new file mode 100644 index 0000000000..f1a67d29b5 --- /dev/null +++ b/shared-module/synthio/Math.c @@ -0,0 +1,122 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "shared-bindings/synthio/Math.h" +#include "shared-module/synthio/Math.h" + +mp_obj_t common_hal_synthio_math_get_input_obj(synthio_math_obj_t *self, size_t i) { + return self->inputs[i].obj; +} + +void common_hal_synthio_math_set_input_obj(synthio_math_obj_t *self, size_t i, mp_obj_t arg, qstr argname) { + assert(i < MP_ARRAY_SIZE(self->inputs)); + synthio_block_assign_slot(arg, &self->inputs[i], argname); +} + +synthio_math_operation_t common_hal_synthio_math_get_operation(synthio_math_obj_t *self) { + return self->operation; +} + +void common_hal_synthio_math_set_operation(synthio_math_obj_t *self, synthio_math_operation_t arg) { + self->operation = arg; +} + +#define ZERO (MICROPY_FLOAT_CONST(0.)) + +mp_float_t common_hal_synthio_math_get_value(synthio_math_obj_t *self) { + return self->base.value; +} + +mp_float_t common_hal_synthio_math_tick(mp_obj_t self_in) { + synthio_math_obj_t *self = MP_OBJ_TO_PTR(self_in); + mp_float_t a = synthio_block_slot_get(&self->inputs[0]); + + if (self->operation == OP_ABS) { + return MICROPY_FLOAT_C_FUN(fabs)(a); + } + + mp_float_t b = synthio_block_slot_get(&self->inputs[1]); + mp_float_t c = synthio_block_slot_get(&self->inputs[2]); + + switch (self->operation) { + case OP_SUM: + return a + b + c; + case OP_ADD_SUB: + return a + b - c; + case OP_PRODUCT: + return a * b * c; + case OP_MUL_DIV: + if (fpclassify(c) == FP_ZERO) { + return 0; + } + return a * b / c; + case OP_SCALE_OFFSET: + return a * b + c; + case OP_OFFSET_SCALE: + return (a + b) * c; + case OP_CONSTRAINED_LERP: + c = MIN(1, MAX(0, c)); + MP_FALLTHROUGH; + case OP_LERP: + return a * (1 - c) + b * c; + case OP_DIV_ADD: + if (fpclassify(b) == FP_ZERO) { + return ZERO; + } + return a / b + c; + case OP_ADD_DIV: + if (fpclassify(c) == FP_ZERO) { + return ZERO; + } + return (a + b) / c; + case OP_MID: + if (a < b) { + if (b < c) { + return b; + } + if (a < c) { + return c; + } + return a; + } + if (a < c) { + return a; + } + if (c < b) { + return b; + } + return c; + case OP_MIN: + return MIN(a,MIN(b,c)); + case OP_MAX: + return MAX(a,MAX(b,c)); + case OP_ABS: + break; + } + return ZERO; +} diff --git a/shared-module/synthio/Math.h b/shared-module/synthio/Math.h new file mode 100644 index 0000000000..b689f7783e --- /dev/null +++ b/shared-module/synthio/Math.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "shared-module/synthio/block.h" + +typedef struct synthio_math_obj { + synthio_block_base_t base; + synthio_block_slot_t inputs[3]; + synthio_math_operation_t operation; +} synthio_math_obj_t; diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 83baba02a2..e6e08c36e6 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -547,3 +547,55 @@ void shared_bindings_synthio_lfo_tick(uint32_t sample_rate) { synthio_global_rate_scale = (mp_float_t)SYNTHIO_MAX_DUR / sample_rate; synthio_global_tick++; } + +mp_float_t synthio_block_slot_get(synthio_block_slot_t *slot) { + if (slot->obj == mp_const_none) { + return MICROPY_FLOAT_CONST(0.); + } + + mp_float_t value; + if (mp_obj_get_float_maybe(slot->obj, &value)) { + return value; + } + + synthio_block_base_t *block = MP_OBJ_TO_PTR(slot->obj); + if (block->last_tick == synthio_global_tick) { + return block->value; + } + + block->last_tick = synthio_global_tick; + // previously verified by call to mp_proto_get + const synthio_block_proto_t *p = mp_type_get_protocol_slot(mp_obj_get_type(slot->obj)); + block->value = value = p->tick(slot->obj); + return value; +} + +mp_float_t synthio_block_slot_get_limited(synthio_block_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi) { + mp_float_t value = synthio_block_slot_get(lfo_slot); + if (value < lo) { + return lo; + } + if (value > hi) { + return hi; + } + return value; +} + +int32_t synthio_block_slot_get_scaled(synthio_block_slot_t *lfo_slot, mp_float_t lo, mp_float_t hi) { + mp_float_t value = synthio_block_slot_get_limited(lfo_slot, lo, hi); + return (int32_t)MICROPY_FLOAT_C_FUN(round)(MICROPY_FLOAT_C_FUN(ldexp)(value, 15)); +} + +void synthio_block_assign_slot(mp_obj_t obj, synthio_block_slot_t *slot, qstr arg_name) { + if (mp_proto_get(MP_QSTR_synthio_block, obj)) { + slot->obj = obj; + return; + } + + mp_float_t value; + if (obj != mp_const_none && !mp_obj_get_float_maybe(obj, &value)) { + mp_raise_TypeError_varg(translate("%q must be of type %q, not %q"), arg_name, MP_QSTR_BlockInput, mp_obj_get_type_qstr(obj)); + } + + slot->obj = obj; +} diff --git a/shared-module/synthio/block.h b/shared-module/synthio/block.h new file mode 100644 index 0000000000..eca92b2248 --- /dev/null +++ b/shared-module/synthio/block.h @@ -0,0 +1,58 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "py/proto.h" + +#include "shared-module/synthio/__init__.h" +#include "shared-bindings/synthio/__init__.h" + +typedef struct synthio_block_base { + mp_obj_base_t base; + uint8_t last_tick; + mp_float_t value; +} synthio_block_base_t; + +typedef struct synthio_block_slot { + mp_obj_t obj; +} synthio_block_slot_t; + +typedef struct { + MP_PROTOCOL_HEAD; + mp_float_t (*tick)(mp_obj_t obj); +} synthio_block_proto_t; + +// Update the value inside the lfo slot if the value is an LFO, returning the new value +mp_float_t synthio_block_slot_get(synthio_block_slot_t *block_slot); +// the same, but the output is constrained to be between lo and hi +mp_float_t synthio_block_slot_get_limited(synthio_block_slot_t *block_slot, mp_float_t lo, mp_float_t hi); +// the same, but the output is constrained to be between lo and hi and converted to an integer with 15 fractional bits +int32_t synthio_block_slot_get_scaled(synthio_block_slot_t *block_slot, mp_float_t lo, mp_float_t hi); + +// Assign an object (which may be a float or a synthio_block_obj_t) to an block slot +void synthio_block_assign_slot(mp_obj_t obj, synthio_block_slot_t *block_slot, qstr arg_name); diff --git a/tests/circuitpython/synthmath.py b/tests/circuitpython/synthmath.py new file mode 100644 index 0000000000..3ca8b432d3 --- /dev/null +++ b/tests/circuitpython/synthmath.py @@ -0,0 +1,8 @@ +from synthio import * + +for values in ((-1, 4, 9), (4, -1, 9), (9, 4, -1), (0, 0, 0), (3, 2, 1), (2, 1), (1,)): + for op in MathOperation.__dict__.values(): + o = Math(op, *values) + print(op, o) + print(lfo_tick(o)) + print() diff --git a/tests/circuitpython/synthmath.py.exp b/tests/circuitpython/synthmath.py.exp new file mode 100644 index 0000000000..902cbb60ce --- /dev/null +++ b/tests/circuitpython/synthmath.py.exp @@ -0,0 +1,203 @@ +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=-1, b=4, c=9) +(12.0,) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=-1, b=4, c=9) +(-6.0,) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=-1, b=4, c=9) +(-36.0,) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=-1, b=4, c=9) +(-0.4444444444444445,) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=-1, b=4, c=9) +(5.0,) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=-1, b=4, c=9) +(27.0,) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=-1, b=4, c=9) +(44.0,) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=-1, b=4, c=9) +(4.0,) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=-1, b=4, c=9) +(8.75,) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=-1, b=4, c=9) +(0.3333333333333333,) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=-1, b=4, c=9) +(4.0,) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=-1, b=4, c=9) +(9.0,) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=-1, b=4, c=9) +(-1.0,) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=-1, b=4, c=9) +(1.0,) + +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=4, b=-1, c=9) +(12.0,) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=4, b=-1, c=9) +(-6.0,) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=4, b=-1, c=9) +(-36.0,) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=4, b=-1, c=9) +(-0.4444444444444445,) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=4, b=-1, c=9) +(5.0,) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=4, b=-1, c=9) +(27.0,) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=4, b=-1, c=9) +(-41.0,) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=4, b=-1, c=9) +(-1.0,) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=4, b=-1, c=9) +(5.0,) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=4, b=-1, c=9) +(0.3333333333333333,) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=4, b=-1, c=9) +(4.0,) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=4, b=-1, c=9) +(9.0,) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=4, b=-1, c=9) +(-1.0,) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=4, b=-1, c=9) +(4.0,) + +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=9, b=4, c=-1) +(12.0,) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=9, b=4, c=-1) +(14.0,) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=9, b=4, c=-1) +(-36.0,) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=9, b=4, c=-1) +(-36.0,) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=9, b=4, c=-1) +(35.0,) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=9, b=4, c=-1) +(-13.0,) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=9, b=4, c=-1) +(14.0,) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=9, b=4, c=-1) +(9.0,) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=9, b=4, c=-1) +(1.25,) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=9, b=4, c=-1) +(-13.0,) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=9, b=4, c=-1) +(4.0,) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=9, b=4, c=-1) +(9.0,) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=9, b=4, c=-1) +(-1.0,) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=9, b=4, c=-1) +(9.0,) + +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=0, b=0, c=0) +(0.0,) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=0, b=0, c=0) +(0.0,) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=0, b=0, c=0) +(0.0,) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=0, b=0, c=0) +(0.0,) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=0, b=0, c=0) +(0.0,) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=0, b=0, c=0) +(0.0,) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=0, b=0, c=0) +(0.0,) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=0, b=0, c=0) +(0.0,) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=0, b=0, c=0) +(0.0,) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=0, b=0, c=0) +(0.0,) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=0, b=0, c=0) +(0.0,) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=0, b=0, c=0) +(0.0,) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=0, b=0, c=0) +(0.0,) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=0, b=0, c=0) +(0.0,) + +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=3, b=2, c=1) +(6.0,) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=3, b=2, c=1) +(4.0,) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=3, b=2, c=1) +(6.0,) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=3, b=2, c=1) +(6.0,) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=3, b=2, c=1) +(7.0,) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=3, b=2, c=1) +(5.0,) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=3, b=2, c=1) +(2.0,) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=3, b=2, c=1) +(2.0,) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=3, b=2, c=1) +(2.5,) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=3, b=2, c=1) +(5.0,) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=3, b=2, c=1) +(2.0,) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=3, b=2, c=1) +(3.0,) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=3, b=2, c=1) +(1.0,) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=3, b=2, c=1) +(3.0,) + +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=2, b=1, c=1) +(4.0,) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=2, b=1, c=1) +(2.0,) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=2, b=1, c=1) +(2.0,) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=2, b=1, c=1) +(2.0,) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=2, b=1, c=1) +(3.0,) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=2, b=1, c=1) +(3.0,) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=2, b=1, c=1) +(1.0,) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=2, b=1, c=1) +(1.0,) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=2, b=1, c=1) +(3.0,) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=2, b=1, c=1) +(3.0,) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=2, b=1, c=1) +(1.0,) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=2, b=1, c=1) +(2.0,) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=2, b=1, c=1) +(1.0,) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=2, b=1, c=1) +(2.0,) + +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=1, b=0, c=1) +(2.0,) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=1, b=0, c=1) +(0.0,) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=1, b=0, c=1) +(0.0,) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=1, b=0, c=1) +(0.0,) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=1, b=0, c=1) +(1.0,) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=1, b=0, c=1) +(1.0,) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=1, b=0, c=1) +(0.0,) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=1, b=0, c=1) +(0.0,) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=1, b=0, c=1) +(0.0,) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=1, b=0, c=1) +(1.0,) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=1, b=0, c=1) +(1.0,) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=1, b=0, c=1) +(1.0,) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=1, b=0, c=1) +(0.0,) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=1, b=0, c=1) +(1.0,) + From bd2a153eaeecaf2771fb95fdefd008138c1b3622 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 17 May 2023 16:37:12 -0500 Subject: [PATCH 1065/1712] synthio: there is a midi note 0 --- shared-bindings/synthio/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 72104332af..18a7e8043e 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -273,7 +273,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(synthio_from_file_obj, 1, synthio_from_file); //| STATIC mp_obj_t midi_to_hz(mp_obj_t arg) { - mp_float_t note = mp_arg_validate_obj_float_range(arg, 1, 127, MP_QSTR_note); + mp_float_t note = mp_arg_validate_obj_float_range(arg, 0, 127, MP_QSTR_note); return mp_obj_new_float(common_hal_synthio_midi_to_hz_float(note)); } MP_DEFINE_CONST_FUN_OBJ_1(synthio_midi_to_hz_obj, midi_to_hz); From 4901bdceb7f8fde9bc92332fe734b61ebb33d562 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 17 May 2023 18:49:45 -0500 Subject: [PATCH 1066/1712] synthio: disable on more boards where it stopped fitting --- ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.mk | 1 + .../atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk | 1 + ports/atmel-samd/boards/datalore_ip_m4/mpconfigboard.mk | 1 + ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk | 1 + ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk | 1 + ports/atmel-samd/boards/openbook_m4/mpconfigboard.mk | 1 + .../atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.mk | 1 + ports/atmel-samd/boards/silicognition-m4-shim/mpconfigboard.mk | 1 + ports/atmel-samd/boards/uartlogger2/mpconfigboard.mk | 1 + ports/stm/boards/thunderpack_v12/mpconfigboard.mk | 3 ++- 10 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.mk b/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.mk index 3b5b05020d..a46a36a811 100644 --- a/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.mk +++ b/ports/atmel-samd/boards/aloriumtech_evo_m51/mpconfigboard.mk @@ -13,3 +13,4 @@ EXTERNAL_FLASH_DEVICES = GD25Q16C LONGINT_IMPL = MPZ CIRCUITPY_PS2IO = 1 +CIRCUITPY_SYNTHIO = 0 diff --git a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk index a96326c3b1..1346c73756 100755 --- a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/mpconfigboard.mk @@ -11,3 +11,4 @@ EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ, S25FL064L" LONGINT_IMPL = MPZ CIRCUITPY_PS2IO = 1 +CIRCUITPY_SYNTHIO = 0 diff --git a/ports/atmel-samd/boards/datalore_ip_m4/mpconfigboard.mk b/ports/atmel-samd/boards/datalore_ip_m4/mpconfigboard.mk index b07f86c160..5aba5a76f6 100644 --- a/ports/atmel-samd/boards/datalore_ip_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/datalore_ip_m4/mpconfigboard.mk @@ -9,3 +9,4 @@ CHIP_FAMILY = samd51 QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q16JVxQ, W25Q16JVxM" LONGINT_IMPL = MPZ +CIRCUITPY_SYNTHIO = 0 diff --git a/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk index 51fccc56e5..3924186d4b 100644 --- a/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/hallowing_m4_express/mpconfigboard.mk @@ -9,3 +9,4 @@ CHIP_FAMILY = samd51 QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ" LONGINT_IMPL = MPZ +CIRCUITPY_SYNTHIO = 0 diff --git a/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk b/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk index 56dab1d788..87efe005f3 100644 --- a/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk +++ b/ports/atmel-samd/boards/monster_m4sk/mpconfigboard.mk @@ -9,3 +9,4 @@ CHIP_FAMILY = samd51 QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ" LONGINT_IMPL = MPZ +CIRCUITPY_SYNTHIO = 0 diff --git a/ports/atmel-samd/boards/openbook_m4/mpconfigboard.mk b/ports/atmel-samd/boards/openbook_m4/mpconfigboard.mk index c46ed6a9fd..e624b8b94e 100644 --- a/ports/atmel-samd/boards/openbook_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/openbook_m4/mpconfigboard.mk @@ -11,3 +11,4 @@ EXTERNAL_FLASH_DEVICES = GD25Q16C LONGINT_IMPL = MPZ CIRCUITPY_KEYPAD = 1 +CIRCUITPY_SYNTHIO = 0 diff --git a/ports/atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.mk b/ports/atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.mk index fefc78addc..3441e601b8 100644 --- a/ports/atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.mk +++ b/ports/atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.mk @@ -9,3 +9,4 @@ CHIP_FAMILY = samd51 QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ" LONGINT_IMPL = MPZ +CIRCUITPY_SYNTHIO = 0 diff --git a/ports/atmel-samd/boards/silicognition-m4-shim/mpconfigboard.mk b/ports/atmel-samd/boards/silicognition-m4-shim/mpconfigboard.mk index 58411aa03e..d7a12fc21c 100644 --- a/ports/atmel-samd/boards/silicognition-m4-shim/mpconfigboard.mk +++ b/ports/atmel-samd/boards/silicognition-m4-shim/mpconfigboard.mk @@ -9,3 +9,4 @@ CHIP_FAMILY = samd51 QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = GD25Q16C LONGINT_IMPL = MPZ +CIRCUITPY_SYNTHIO = 0 diff --git a/ports/atmel-samd/boards/uartlogger2/mpconfigboard.mk b/ports/atmel-samd/boards/uartlogger2/mpconfigboard.mk index 87619b5783..edacd59a1b 100644 --- a/ports/atmel-samd/boards/uartlogger2/mpconfigboard.mk +++ b/ports/atmel-samd/boards/uartlogger2/mpconfigboard.mk @@ -9,3 +9,4 @@ CHIP_FAMILY = samd51 QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ" LONGINT_IMPL = MPZ +CIRCUITPY_SYNTHIO = 0 diff --git a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk index 526415ca30..51d0429327 100644 --- a/ports/stm/boards/thunderpack_v12/mpconfigboard.mk +++ b/ports/stm/boards/thunderpack_v12/mpconfigboard.mk @@ -11,9 +11,10 @@ LONGINT_IMPL = NONE SPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = GD25Q16C -CIRCUITPY_NVM = 1 CIRCUITPY_BITMAPTOOLS = 0 CIRCUITPY_BLEIO_HCI = 0 +CIRCUITPY_NVM = 1 +CIRCUITPY_SYNTHIO = 0 CIRCUITPY_ZLIB = 0 MCU_SERIES = F4 From ed0cc9295ffc7bda7c23aa3df4e61880b7c9891a Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Thu, 18 May 2023 19:07:48 +0300 Subject: [PATCH 1067/1712] More camera pin definition improvements --- .../boards/m5stack_timer_camera_x/pins.c | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/ports/espressif/boards/m5stack_timer_camera_x/pins.c b/ports/espressif/boards/m5stack_timer_camera_x/pins.c index 37446b6386..93b4f13e1d 100644 --- a/ports/espressif/boards/m5stack_timer_camera_x/pins.c +++ b/ports/espressif/boards/m5stack_timer_camera_x/pins.c @@ -1,40 +1,64 @@ +#include "py/objtuple.h" #include "shared-bindings/board/__init__.h" #include "shared-module/displayio/__init__.h" CIRCUITPY_BOARD_BUS_SINGLETON(bm8563_i2c, i2c, 1) +STATIC const mp_rom_obj_tuple_t camera_data_tuple = { + {&mp_type_tuple}, + 8, + { + MP_ROM_PTR(&pin_GPIO19), + MP_ROM_PTR(&pin_GPIO36), + MP_ROM_PTR(&pin_GPIO18), + MP_ROM_PTR(&pin_GPIO39), + MP_ROM_PTR(&pin_GPIO5), + MP_ROM_PTR(&pin_GPIO34), + MP_ROM_PTR(&pin_GPIO35), + MP_ROM_PTR(&pin_GPIO32) + } +}; + STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO2) }, + // Connector, the label says G V SDA/G4 SCL/G13 { MP_ROM_QSTR(MP_QSTR_G4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_G13), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_G33), MP_ROM_PTR(&pin_GPIO33) }, + // Battery pins, no alternative names as they cannot be used for anything else. { MP_ROM_QSTR(MP_QSTR_BAT_HOLD), MP_ROM_PTR(&pin_GPIO33) }, - { MP_ROM_QSTR(MP_QSTR_G38), MP_ROM_PTR(&pin_GPIO38) }, { MP_ROM_QSTR(MP_QSTR_BAT_ADC), MP_ROM_PTR(&pin_GPIO38) }, - { MP_ROM_QSTR(MP_QSTR_G14), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_G12), MP_ROM_PTR(&pin_GPIO12) }, + // BM8563 I2C bus, no alternative names as they cannot be used for anything else. { MP_ROM_QSTR(MP_QSTR_BM8563_SCL), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_BM8563_SDA), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_BM8563_I2C), MP_ROM_PTR(&board_bm8563_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_G22), MP_ROM_PTR(&pin_GPIO22) }, + // Camera pins { MP_ROM_QSTR(MP_QSTR_CAMERA_VSYNC), MP_ROM_PTR(&pin_GPIO22) }, - - { MP_ROM_QSTR(MP_QSTR_G26), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_CAMERA_HREF), MP_ROM_PTR(&pin_GPIO26) }, - - { MP_ROM_QSTR(MP_QSTR_G21), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_CAMERA_PCLK), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_XCLK), MP_ROM_PTR(&pin_GPIO27) }, // xclk_freq_hz = 20000000 + { MP_ROM_QSTR(MP_QSTR_CAMERA_RESET), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_G27), MP_ROM_PTR(&pin_GPIO27) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_XCLK), MP_ROM_PTR(&pin_GPIO27) } + { MP_ROM_QSTR(MP_QSTR_CAMERA_SSCB_SDA), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_SSCB_SCL), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA), MP_ROM_PTR(&camera_data_tuple) }, + + { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA7), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA6), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA5), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA4), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA3), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA2), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA1), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA0), MP_ROM_PTR(&pin_GPIO32) } }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From c435c469f45e985dcef7c0197ef1b7787cb917aa Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 18 May 2023 11:55:01 -0500 Subject: [PATCH 1068/1712] synthio: simplify block logic a bit by converting from float just once --- shared-module/synthio/__init__.c | 16 +- shared-module/synthio/block.h | 1 + tests/circuitpython/synthesizer_note.py.exp | 6 +- tests/circuitpython/synthmath.py.exp | 196 ++++++++++---------- 4 files changed, 112 insertions(+), 107 deletions(-) diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index e6e08c36e6..8050eb276e 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -553,9 +553,9 @@ mp_float_t synthio_block_slot_get(synthio_block_slot_t *slot) { return MICROPY_FLOAT_CONST(0.); } - mp_float_t value; - if (mp_obj_get_float_maybe(slot->obj, &value)) { - return value; + // all numbers previously converted to float in synthio_block_assign_slot + if (mp_obj_is_float(slot->obj)) { + return mp_obj_get_float(slot->obj); } synthio_block_base_t *block = MP_OBJ_TO_PTR(slot->obj); @@ -564,9 +564,10 @@ mp_float_t synthio_block_slot_get(synthio_block_slot_t *slot) { } block->last_tick = synthio_global_tick; - // previously verified by call to mp_proto_get + // previously verified by call to mp_proto_get in synthio_block_assign_slot const synthio_block_proto_t *p = mp_type_get_protocol_slot(mp_obj_get_type(slot->obj)); - block->value = value = p->tick(slot->obj); + mp_float_t value = p->tick(slot->obj); + block->value = value; return value; } @@ -597,5 +598,8 @@ void synthio_block_assign_slot(mp_obj_t obj, synthio_block_slot_t *slot, qstr ar mp_raise_TypeError_varg(translate("%q must be of type %q, not %q"), arg_name, MP_QSTR_BlockInput, mp_obj_get_type_qstr(obj)); } - slot->obj = obj; + slot->obj = mp_obj_new_float(value); +} +bool synthio_obj_is_block(mp_obj_t obj) { + return mp_proto_get(MP_QSTR_synthio_block, obj); } diff --git a/shared-module/synthio/block.h b/shared-module/synthio/block.h index eca92b2248..9f7da06ab2 100644 --- a/shared-module/synthio/block.h +++ b/shared-module/synthio/block.h @@ -56,3 +56,4 @@ int32_t synthio_block_slot_get_scaled(synthio_block_slot_t *block_slot, mp_float // Assign an object (which may be a float or a synthio_block_obj_t) to an block slot void synthio_block_assign_slot(mp_obj_t obj, synthio_block_slot_t *block_slot, qstr arg_name); +bool synthio_obj_is_block(mp_obj_t obj); diff --git a/tests/circuitpython/synthesizer_note.py.exp b/tests/circuitpython/synthesizer_note.py.exp index 7b834870e9..f9173c6470 100644 --- a/tests/circuitpython/synthesizer_note.py.exp +++ b/tests/circuitpython/synthesizer_note.py.exp @@ -1,10 +1,10 @@ () [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -(Note(frequency=830.6076004423605, panning=0, amplitude=1, bend=0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0, ring_waveform=None),) +(Note(frequency=830.6076004423605, panning=0.0, amplitude=1.0, bend=0.0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0.0, ring_waveform=None),) [-16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383] -(Note(frequency=830.6076004423605, panning=0, amplitude=1, bend=0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0, ring_waveform=None), Note(frequency=830.6076004423605, panning=0, amplitude=1, bend=0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0, ring_waveform=None)) +(Note(frequency=830.6076004423605, panning=0.0, amplitude=1.0, bend=0.0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0.0, ring_waveform=None), Note(frequency=830.6076004423605, panning=0.0, amplitude=1.0, bend=0.0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0.0, ring_waveform=None)) [-1, -1, -1, -1, -1, -1, -1, -1, 28045, -1, -1, -1, -1, -28046, -1, -1, -1, -1, 28045, -1, -1, -1, -1, -28046] -(Note(frequency=830.6076004423605, panning=0, amplitude=1, bend=0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0, ring_waveform=None),) +(Note(frequency=830.6076004423605, panning=0.0, amplitude=1.0, bend=0.0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0.0, ring_waveform=None),) [-1, -1, -1, 28045, -1, -1, -1, -1, -1, -1, -1, -1, 28045, -1, -1, -1, -1, -28046, -1, -1, -1, -1, 28045, -1] (-5242, 5241) (-10484, 10484) diff --git a/tests/circuitpython/synthmath.py.exp b/tests/circuitpython/synthmath.py.exp index 902cbb60ce..e1ae158c73 100644 --- a/tests/circuitpython/synthmath.py.exp +++ b/tests/circuitpython/synthmath.py.exp @@ -1,203 +1,203 @@ -synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=-1, b=4, c=9) +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=-1.0, b=4.0, c=9.0) (12.0,) -synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=-1, b=4, c=9) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=-1.0, b=4.0, c=9.0) (-6.0,) -synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=-1, b=4, c=9) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=-1.0, b=4.0, c=9.0) (-36.0,) -synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=-1, b=4, c=9) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=-1.0, b=4.0, c=9.0) (-0.4444444444444445,) -synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=-1, b=4, c=9) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=-1.0, b=4.0, c=9.0) (5.0,) -synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=-1, b=4, c=9) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=-1.0, b=4.0, c=9.0) (27.0,) -synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=-1, b=4, c=9) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=-1.0, b=4.0, c=9.0) (44.0,) -synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=-1, b=4, c=9) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=-1.0, b=4.0, c=9.0) (4.0,) -synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=-1, b=4, c=9) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=-1.0, b=4.0, c=9.0) (8.75,) -synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=-1, b=4, c=9) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=-1.0, b=4.0, c=9.0) (0.3333333333333333,) -synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=-1, b=4, c=9) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=-1.0, b=4.0, c=9.0) (4.0,) -synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=-1, b=4, c=9) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=-1.0, b=4.0, c=9.0) (9.0,) -synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=-1, b=4, c=9) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=-1.0, b=4.0, c=9.0) (-1.0,) -synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=-1, b=4, c=9) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=-1.0, b=4.0, c=9.0) (1.0,) -synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=4, b=-1, c=9) +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=4.0, b=-1.0, c=9.0) (12.0,) -synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=4, b=-1, c=9) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=4.0, b=-1.0, c=9.0) (-6.0,) -synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=4, b=-1, c=9) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=4.0, b=-1.0, c=9.0) (-36.0,) -synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=4, b=-1, c=9) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=4.0, b=-1.0, c=9.0) (-0.4444444444444445,) -synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=4, b=-1, c=9) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=4.0, b=-1.0, c=9.0) (5.0,) -synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=4, b=-1, c=9) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=4.0, b=-1.0, c=9.0) (27.0,) -synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=4, b=-1, c=9) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=4.0, b=-1.0, c=9.0) (-41.0,) -synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=4, b=-1, c=9) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=4.0, b=-1.0, c=9.0) (-1.0,) -synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=4, b=-1, c=9) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=4.0, b=-1.0, c=9.0) (5.0,) -synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=4, b=-1, c=9) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=4.0, b=-1.0, c=9.0) (0.3333333333333333,) -synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=4, b=-1, c=9) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=4.0, b=-1.0, c=9.0) (4.0,) -synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=4, b=-1, c=9) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=4.0, b=-1.0, c=9.0) (9.0,) -synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=4, b=-1, c=9) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=4.0, b=-1.0, c=9.0) (-1.0,) -synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=4, b=-1, c=9) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=4.0, b=-1.0, c=9.0) (4.0,) -synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=9, b=4, c=-1) +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=9.0, b=4.0, c=-1.0) (12.0,) -synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=9, b=4, c=-1) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=9.0, b=4.0, c=-1.0) (14.0,) -synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=9, b=4, c=-1) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=9.0, b=4.0, c=-1.0) (-36.0,) -synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=9, b=4, c=-1) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=9.0, b=4.0, c=-1.0) (-36.0,) -synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=9, b=4, c=-1) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=9.0, b=4.0, c=-1.0) (35.0,) -synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=9, b=4, c=-1) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=9.0, b=4.0, c=-1.0) (-13.0,) -synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=9, b=4, c=-1) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=9.0, b=4.0, c=-1.0) (14.0,) -synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=9, b=4, c=-1) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=9.0, b=4.0, c=-1.0) (9.0,) -synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=9, b=4, c=-1) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=9.0, b=4.0, c=-1.0) (1.25,) -synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=9, b=4, c=-1) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=9.0, b=4.0, c=-1.0) (-13.0,) -synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=9, b=4, c=-1) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=9.0, b=4.0, c=-1.0) (4.0,) -synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=9, b=4, c=-1) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=9.0, b=4.0, c=-1.0) (9.0,) -synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=9, b=4, c=-1) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=9.0, b=4.0, c=-1.0) (-1.0,) -synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=9, b=4, c=-1) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=9.0, b=4.0, c=-1.0) (9.0,) -synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=0, b=0, c=0) +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=0, b=0, c=0) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=0, b=0, c=0) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=0, b=0, c=0) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=0, b=0, c=0) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=0, b=0, c=0) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=0, b=0, c=0) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=0, b=0, c=0) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=0, b=0, c=0) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=0, b=0, c=0) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=0, b=0, c=0) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=0, b=0, c=0) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=0, b=0, c=0) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=0, b=0, c=0) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=0.0, b=0.0, c=0.0) (0.0,) -synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=3, b=2, c=1) +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=3.0, b=2.0, c=1.0) (6.0,) -synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=3, b=2, c=1) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=3.0, b=2.0, c=1.0) (4.0,) -synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=3, b=2, c=1) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=3.0, b=2.0, c=1.0) (6.0,) -synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=3, b=2, c=1) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=3.0, b=2.0, c=1.0) (6.0,) -synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=3, b=2, c=1) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=3.0, b=2.0, c=1.0) (7.0,) -synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=3, b=2, c=1) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=3.0, b=2.0, c=1.0) (5.0,) -synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=3, b=2, c=1) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=3.0, b=2.0, c=1.0) (2.0,) -synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=3, b=2, c=1) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=3.0, b=2.0, c=1.0) (2.0,) -synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=3, b=2, c=1) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=3.0, b=2.0, c=1.0) (2.5,) -synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=3, b=2, c=1) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=3.0, b=2.0, c=1.0) (5.0,) -synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=3, b=2, c=1) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=3.0, b=2.0, c=1.0) (2.0,) -synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=3, b=2, c=1) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=3.0, b=2.0, c=1.0) (3.0,) -synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=3, b=2, c=1) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=3.0, b=2.0, c=1.0) (1.0,) -synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=3, b=2, c=1) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=3.0, b=2.0, c=1.0) (3.0,) -synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=2, b=1, c=1) +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=2.0, b=1.0, c=1.0) (4.0,) -synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=2, b=1, c=1) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=2.0, b=1.0, c=1.0) (2.0,) -synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=2, b=1, c=1) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=2.0, b=1.0, c=1.0) (2.0,) -synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=2, b=1, c=1) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=2.0, b=1.0, c=1.0) (2.0,) -synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=2, b=1, c=1) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=2.0, b=1.0, c=1.0) (3.0,) -synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=2, b=1, c=1) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=2.0, b=1.0, c=1.0) (3.0,) -synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=2, b=1, c=1) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=2.0, b=1.0, c=1.0) (1.0,) -synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=2, b=1, c=1) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=2.0, b=1.0, c=1.0) (1.0,) -synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=2, b=1, c=1) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=2.0, b=1.0, c=1.0) (3.0,) -synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=2, b=1, c=1) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=2.0, b=1.0, c=1.0) (3.0,) -synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=2, b=1, c=1) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=2.0, b=1.0, c=1.0) (1.0,) -synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=2, b=1, c=1) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=2.0, b=1.0, c=1.0) (2.0,) -synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=2, b=1, c=1) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=2.0, b=1.0, c=1.0) (1.0,) -synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=2, b=1, c=1) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=2.0, b=1.0, c=1.0) (2.0,) -synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=1, b=0, c=1) +synthio.MathOperation.SUM Math(operation=synthio.MathOperation.SUM, a=1.0, b=0.0, c=1.0) (2.0,) -synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=1, b=0, c=1) +synthio.MathOperation.ADD_SUB Math(operation=synthio.MathOperation.ADD_SUB, a=1.0, b=0.0, c=1.0) (0.0,) -synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=1, b=0, c=1) +synthio.MathOperation.PRODUCT Math(operation=synthio.MathOperation.PRODUCT, a=1.0, b=0.0, c=1.0) (0.0,) -synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=1, b=0, c=1) +synthio.MathOperation.MUL_DIV Math(operation=synthio.MathOperation.MUL_DIV, a=1.0, b=0.0, c=1.0) (0.0,) -synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=1, b=0, c=1) +synthio.MathOperation.SCALE_OFFSET Math(operation=synthio.MathOperation.SCALE_OFFSET, a=1.0, b=0.0, c=1.0) (1.0,) -synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=1, b=0, c=1) +synthio.MathOperation.OFFSET_SCALE Math(operation=synthio.MathOperation.OFFSET_SCALE, a=1.0, b=0.0, c=1.0) (1.0,) -synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=1, b=0, c=1) +synthio.MathOperation.LERP Math(operation=synthio.MathOperation.LERP, a=1.0, b=0.0, c=1.0) (0.0,) -synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=1, b=0, c=1) +synthio.MathOperation.CONSTRAINED_LERP Math(operation=synthio.MathOperation.CONSTRAINED_LERP, a=1.0, b=0.0, c=1.0) (0.0,) -synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=1, b=0, c=1) +synthio.MathOperation.DIV_ADD Math(operation=synthio.MathOperation.DIV_ADD, a=1.0, b=0.0, c=1.0) (0.0,) -synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=1, b=0, c=1) +synthio.MathOperation.ADD_DIV Math(operation=synthio.MathOperation.ADD_DIV, a=1.0, b=0.0, c=1.0) (1.0,) -synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=1, b=0, c=1) +synthio.MathOperation.MID Math(operation=synthio.MathOperation.MID, a=1.0, b=0.0, c=1.0) (1.0,) -synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=1, b=0, c=1) +synthio.MathOperation.MAX Math(operation=synthio.MathOperation.MAX, a=1.0, b=0.0, c=1.0) (1.0,) -synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=1, b=0, c=1) +synthio.MathOperation.MIN Math(operation=synthio.MathOperation.MIN, a=1.0, b=0.0, c=1.0) (0.0,) -synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=1, b=0, c=1) +synthio.MathOperation.ABS Math(operation=synthio.MathOperation.ABS, a=1.0, b=0.0, c=1.0) (1.0,) From 302cdad4ca85cc8780ddaabc25ec1017b4a5cc70 Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Thu, 18 May 2023 21:39:59 +0300 Subject: [PATCH 1069/1712] m5x camera working --- .../boards/m5stack_timer_camera_x/board.c | 8 +- .../m5stack_timer_camera_x/mpconfigboard.h | 12 ++- .../boards/m5stack_timer_camera_x/pins.c | 81 ++++++++++++------- .../boards/m5stack_timer_camera_x/sdkconfig | 4 + 4 files changed, 71 insertions(+), 34 deletions(-) diff --git a/ports/espressif/boards/m5stack_timer_camera_x/board.c b/ports/espressif/boards/m5stack_timer_camera_x/board.c index 4000c201e3..65b857c3ae 100755 --- a/ports/espressif/boards/m5stack_timer_camera_x/board.c +++ b/ports/espressif/boards/m5stack_timer_camera_x/board.c @@ -33,12 +33,16 @@ bool espressif_board_reset_pin_number(gpio_num_t pin_number) { if (pin_number == 33) { - // Turn on BAT_HOLD by default, so that the board does not power off. + /* + * Turn on BAT_HOLD by default, + * so that the board does not power off + * when usb is disconnected or + * the power button is released. + */ gpio_set_direction(pin_number, GPIO_MODE_DEF_OUTPUT); gpio_set_level(pin_number, true); return true; } - return false; } diff --git a/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.h b/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.h index 451ee5ebf4..395e7590eb 100644 --- a/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.h +++ b/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.h @@ -29,9 +29,14 @@ #define MICROPY_HW_LED_STATUS (&pin_GPIO2) -#define CIRCUITPY_BOARD_I2C (2) +#define CIRCUITPY_BOARD_I2C (3) #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO13, .sda = &pin_GPIO4}, \ - {.scl = &pin_GPIO14, .sda = &pin_GPIO12}} + {.scl = &pin_GPIO14, .sda = &pin_GPIO12}, \ + {.scl = &pin_GPIO23, .sda = &pin_GPIO25}} + +// Ext. Port +// BM8563 +// Camera sensor // UART pins attached to the USB-serial converter chip #define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) @@ -39,4 +44,5 @@ #define CIRCUITPY_I2C_ALLOW_INTERNAL_PULL_UP (1) -#define DEFAULT_RESERVED_PSRAM (1048576) +// espcamera.FrameSize.QXGA, half a megabyte result image.jpeg +#define DEFAULT_RESERVED_PSRAM (1572864) diff --git a/ports/espressif/boards/m5stack_timer_camera_x/pins.c b/ports/espressif/boards/m5stack_timer_camera_x/pins.c index 93b4f13e1d..97b2099ae0 100644 --- a/ports/espressif/boards/m5stack_timer_camera_x/pins.c +++ b/ports/espressif/boards/m5stack_timer_camera_x/pins.c @@ -2,20 +2,25 @@ #include "shared-bindings/board/__init__.h" #include "shared-module/displayio/__init__.h" -CIRCUITPY_BOARD_BUS_SINGLETON(bm8563_i2c, i2c, 1) +CIRCUITPY_BOARD_BUS_SINGLETON(bm8563_i2c, i2c, 1) // RTC +CIRCUITPY_BOARD_BUS_SINGLETON(sscb_i2c, i2c, 2) // Camera sensor STATIC const mp_rom_obj_tuple_t camera_data_tuple = { + // The order matters. + // They must be ordered from low to high (Y2, Y3 .. Y9). + + // Do not include any of the control pins in here. {&mp_type_tuple}, 8, { - MP_ROM_PTR(&pin_GPIO19), - MP_ROM_PTR(&pin_GPIO36), - MP_ROM_PTR(&pin_GPIO18), - MP_ROM_PTR(&pin_GPIO39), - MP_ROM_PTR(&pin_GPIO5), - MP_ROM_PTR(&pin_GPIO34), - MP_ROM_PTR(&pin_GPIO35), - MP_ROM_PTR(&pin_GPIO32) + MP_ROM_PTR(&pin_GPIO32), // Y2 + MP_ROM_PTR(&pin_GPIO35), // Y3 + MP_ROM_PTR(&pin_GPIO34), // Y4 + MP_ROM_PTR(&pin_GPIO5), // Y5 + MP_ROM_PTR(&pin_GPIO39), // Y6 + MP_ROM_PTR(&pin_GPIO18), // Y7 + MP_ROM_PTR(&pin_GPIO36), // Y8 + MP_ROM_PTR(&pin_GPIO19) // Y9 } }; @@ -24,41 +29,59 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO2) }, - // Connector, the label says G V SDA/G4 SCL/G13 + // "Ext. Port", the label says [G, V, SDA/G4, SCL/G13] { MP_ROM_QSTR(MP_QSTR_G4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_G13), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - // Battery pins, no alternative names as they cannot be used for anything else. + /* Battery + * + * No alternative names as they are not broken out + * and cannot be used for anything else. + */ { MP_ROM_QSTR(MP_QSTR_BAT_HOLD), MP_ROM_PTR(&pin_GPIO33) }, { MP_ROM_QSTR(MP_QSTR_BAT_ADC), MP_ROM_PTR(&pin_GPIO38) }, - // BM8563 I2C bus, no alternative names as they cannot be used for anything else. + /* BM8563 I2C bus + * + * No alternative names as they are not broken out + * and cannot be used for anything else. + */ { MP_ROM_QSTR(MP_QSTR_BM8563_SCL), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_BM8563_SDA), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_BM8563_I2C), MP_ROM_PTR(&board_bm8563_i2c_obj) }, - // Camera pins - { MP_ROM_QSTR(MP_QSTR_CAMERA_VSYNC), MP_ROM_PTR(&pin_GPIO22) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_HREF), MP_ROM_PTR(&pin_GPIO26) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_PCLK), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_XCLK), MP_ROM_PTR(&pin_GPIO27) }, // xclk_freq_hz = 20000000 - { MP_ROM_QSTR(MP_QSTR_CAMERA_RESET), MP_ROM_PTR(&pin_GPIO15) }, + // Camera control + { MP_ROM_QSTR(MP_QSTR_VSYNC), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_HREF), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_PCLK), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_XCLK), MP_ROM_PTR(&pin_GPIO27) }, // xclk_freq_hz = 20000000 + { MP_ROM_QSTR(MP_QSTR_RESET), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_SSCB_SDA), MP_ROM_PTR(&pin_GPIO25) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_SSCB_SCL), MP_ROM_PTR(&pin_GPIO23) }, + // Camera sensor I2C bus + { MP_ROM_QSTR(MP_QSTR_SSCB_SDA), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_SSCB_SCL), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_SSCB_I2C), MP_ROM_PTR(&board_sscb_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA), MP_ROM_PTR(&camera_data_tuple) }, + /* + * Camera data + * + * We don't really need to individually name each one, + * but they look cool in the tuple listing if we do. + * + * These are also not broken out. + */ + { MP_ROM_QSTR(MP_QSTR_D), MP_ROM_PTR(&camera_data_tuple) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA7), MP_ROM_PTR(&pin_GPIO19) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA6), MP_ROM_PTR(&pin_GPIO36) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA5), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA4), MP_ROM_PTR(&pin_GPIO39) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA3), MP_ROM_PTR(&pin_GPIO5) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA2), MP_ROM_PTR(&pin_GPIO34) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA1), MP_ROM_PTR(&pin_GPIO35) }, - { MP_ROM_QSTR(MP_QSTR_CAMERA_DATA0), MP_ROM_PTR(&pin_GPIO32) } + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO32) } }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/m5stack_timer_camera_x/sdkconfig b/ports/espressif/boards/m5stack_timer_camera_x/sdkconfig index 4f7eaf9075..06cce7a595 100644 --- a/ports/espressif/boards/m5stack_timer_camera_x/sdkconfig +++ b/ports/espressif/boards/m5stack_timer_camera_x/sdkconfig @@ -1,7 +1,9 @@ +# ESP32-D0WDQ6-V3 (revision 3) CONFIG_ESP32_SPIRAM_SUPPORT=y CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y CONFIG_ESP32_REV_MIN_3=y +# PSRAM CONFIG_D0WD_PSRAM_CLK_IO=17 CONFIG_D0WD_PSRAM_CS_IO=16 @@ -15,8 +17,10 @@ CONFIG_SPIRAM_BOOT_INIT=y CONFIG_SPIRAM_USE_MEMMAP=y CONFIG_SPIRAM_MEMTEST=y +# Hostname CONFIG_LWIP_LOCAL_HOSTNAME="M5StackTimerX" +# Camera CONFIG_OV3660_SUPPORT=y CONFIG_GC_SENSOR_SUBSAMPLE_MODE=y CONFIG_CAMERA_CORE0=y From a731c26f010cfdaa621a66bba6e2e2ac8ab461e5 Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Thu, 18 May 2023 22:29:21 +0300 Subject: [PATCH 1070/1712] Update m5x creator id --- ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk b/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk index fb432ba51f..6339db806b 100644 --- a/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk @@ -1,5 +1,5 @@ CIRCUITPY_CREATOR_ID = 0x10151015 -CIRCUITPY_CREATION_ID = 0x00320007 +CIRCUITPY_CREATION_ID = 0x00320009 IDF_TARGET = esp32 From 9d11bda9e8bea0f202165d649849daf63bff4465 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 18 May 2023 13:24:50 -0700 Subject: [PATCH 1071/1712] Fix memoryview.cast over sliced memoryview Fixes #4758 --- ports/unix/main.c | 2 +- py/objarray.c | 10 ++++++---- tests/basics/memoryview_cast.py | 21 +++++++++++++++++++++ 3 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 tests/basics/memoryview_cast.py diff --git a/ports/unix/main.c b/ports/unix/main.c index 5ebcf9193b..dcc1c68fe6 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -716,7 +716,7 @@ MP_NOINLINE int main_(int argc, char **argv) { } #if !MICROPY_VFS -uint mp_import_stat(const char *path) { +mp_import_stat_t mp_import_stat(const char *path) { struct stat st; if (stat(path, &st) == 0) { if (S_ISDIR(st.st_mode)) { diff --git a/py/objarray.c b/py/objarray.c index 518c3aba52..c4a9e7cec4 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -254,12 +254,14 @@ STATIC mp_obj_t memoryview_make_new(const mp_obj_type_t *type_in, size_t n_args, STATIC mp_obj_t memoryview_cast(const mp_obj_t self_in, const mp_obj_t typecode_in) { mp_obj_array_t *self = MP_OBJ_TO_PTR(self_in); const char *typecode = mp_obj_str_get_str(typecode_in); - size_t element_size = mp_binary_get_size('@', typecode[0], NULL); - size_t bytelen = self->len * mp_binary_get_size('@', self->typecode & ~MP_OBJ_ARRAY_TYPECODE_FLAG_RW, NULL); - if (bytelen % element_size != 0) { + size_t new_element_size = mp_binary_get_size('@', typecode[0], NULL); + size_t old_element_size = mp_binary_get_size('@', self->typecode & ~MP_OBJ_ARRAY_TYPECODE_FLAG_RW, NULL); + size_t bytelen = self->len * old_element_size; + if (bytelen % new_element_size != 0) { mp_raise_TypeError(MP_ERROR_TEXT("memoryview: length is not a multiple of itemsize")); } - mp_obj_array_t *result = MP_OBJ_TO_PTR(mp_obj_new_memoryview(*typecode, bytelen / element_size, self->items)); + mp_obj_array_t *result = MP_OBJ_TO_PTR(mp_obj_new_memoryview(*typecode, bytelen / new_element_size, self->items)); + result->memview_offset = (self->memview_offset * old_element_size) / new_element_size; // test if the object can be written to if (self->typecode & MP_OBJ_ARRAY_TYPECODE_FLAG_RW) { diff --git a/tests/basics/memoryview_cast.py b/tests/basics/memoryview_cast.py new file mode 100644 index 0000000000..24c04e8e5a --- /dev/null +++ b/tests/basics/memoryview_cast.py @@ -0,0 +1,21 @@ +try: + memoryview(b'a').cast +except: + print("SKIP") + raise SystemExit + +b = bytearray(range(16)) + +def print_memview(mv): + print(", ".join(hex(v) for v in mv)) + +mv = memoryview(b) +print_memview(mv) +print_memview(mv[4:]) + +words = mv.cast("I") +print_memview(words) +print_memview(mv[4:].cast("I")) +print_memview(words[1:]) + +print_memview(words.cast("B")) From 177b98174e82272b45d80e0fa2b8fdd01d5804fc Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 18 May 2023 16:24:37 -0700 Subject: [PATCH 1072/1712] Shrink by combining error messages --- locale/circuitpython.pot | 43 +++++++----------------- ports/atmel-samd/common-hal/busio/UART.c | 6 ++-- 2 files changed, 16 insertions(+), 33 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 61fd0d0a6b..bd2d35398f 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -165,11 +165,15 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "" @@ -203,6 +207,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -425,6 +430,7 @@ msgid "Address must be %d bytes long" msgstr "" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" @@ -608,13 +614,6 @@ msgstr "" msgid "Both pins must support hardware interrupts" msgstr "" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -927,11 +926,6 @@ msgstr "" msgid "EXTINT channel already in use" msgstr "" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "" - #: extmod/modure.c msgid "Error in regex" msgstr "" @@ -1343,11 +1337,6 @@ msgstr "" msgid "Mapping must be a tuple" msgstr "" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1441,6 +1430,10 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1489,14 +1482,12 @@ msgstr "" msgid "No MOSI pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2123,8 +2114,8 @@ msgstr "" msgid "UART de-init" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "" @@ -4342,18 +4333,10 @@ msgstr "" msgid "wrong output type" msgstr "" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" diff --git a/ports/atmel-samd/common-hal/busio/UART.c b/ports/atmel-samd/common-hal/busio/UART.c index 280e8d10b6..92dbc9757e 100644 --- a/ports/atmel-samd/common-hal/busio/UART.c +++ b/ports/atmel-samd/common-hal/busio/UART.c @@ -241,7 +241,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, } if (usart_async_init(usart_desc_p, sercom, self->buffer, self->buffer_length, NULL) != ERR_NONE) { - mp_raise_RuntimeError(translate("UART init")); + mp_raise_RuntimeError(NULL); } // usart_async_init() sets a number of defaults based on a prototypical SERCOM @@ -396,7 +396,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { // Read characters. size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) { if (self->rx_pin == NO_PIN) { - mp_raise_ValueError(translate("No RX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_rx); } // This assignment is only here because the usart_async routines take a *const argument. @@ -453,7 +453,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t // Write characters. size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) { if (self->tx_pin == NO_PIN) { - mp_raise_ValueError(translate("No TX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_tx); } // This assignment is only here because the usart_async routines take a *const argument. From 8a05361dd4f64150b8320c9237bdacb61b227bc3 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Fri, 19 May 2023 17:48:33 +0200 Subject: [PATCH 1073/1712] 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 | 56 +++++++++++++++++-------------------- locale/cs.po | 54 ++++++++++++++++-------------------- locale/de_DE.po | 60 ++++++++++++++++++++-------------------- locale/el.po | 46 +++++++++++------------------- locale/en_GB.po | 60 ++++++++++++++++++++-------------------- locale/es.po | 60 ++++++++++++++++++++-------------------- locale/fil.po | 53 ++++++++++++++--------------------- locale/fr.po | 60 ++++++++++++++++++++-------------------- locale/hi.po | 43 +++++++++------------------- locale/it_IT.po | 60 +++++++++++++++++++--------------------- locale/ja.po | 52 +++++++++++++++------------------- locale/ko.po | 43 +++++++++------------------- locale/nl.po | 56 +++++++++++++++++-------------------- locale/pl.po | 56 +++++++++++++++++-------------------- locale/pt_BR.po | 60 ++++++++++++++++++++-------------------- locale/ru.po | 54 ++++++++++++++++-------------------- locale/sv.po | 60 ++++++++++++++++++++-------------------- locale/tr.po | 54 ++++++++++++++++-------------------- locale/zh_Latn_pinyin.po | 60 ++++++++++++++++++++-------------------- 19 files changed, 473 insertions(+), 574 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index b629eeb48e..c3b49fb492 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -168,11 +168,15 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "%q harus %d-%d" @@ -206,6 +210,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -428,6 +433,7 @@ msgid "Address must be %d bytes long" msgstr "Alamat harus sepanjang %d byte" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" @@ -613,13 +619,6 @@ msgstr "" msgid "Both pins must support hardware interrupts" msgstr "Kedua pin harus mendukung hardware interrut" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "Kecerahan harus di antara 0-1.0" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -937,11 +936,6 @@ msgstr "" msgid "EXTINT channel already in use" msgstr "Channel EXTINT sedang digunakan" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "" - #: extmod/modure.c msgid "Error in regex" msgstr "Error pada regex" @@ -1355,11 +1349,6 @@ msgstr "" msgid "Mapping must be a tuple" msgstr "" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "Nilai x maksimum ketika dicerminkan adalah %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Penundaan mulai mikrofon harus dalam kisaran 0,0 hingga 1,0" @@ -1453,6 +1442,10 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1501,14 +1494,12 @@ msgstr "Tidak ada Pin MOSI" msgid "No MOSI pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Tidak pin RX" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2149,8 +2140,8 @@ msgstr "Diperlukan argumen Tuple atau struct_time" msgid "UART de-init" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "" @@ -4371,18 +4362,10 @@ msgstr "" msgid "wrong output type" msgstr "tipe output salah" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "nilai x di luar batas" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "xTaskCreate gagal" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "Nilai y di luar batas" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi harus ndarray" @@ -4395,6 +4378,19 @@ msgstr "zi harus berjenis float" msgid "zi must be of shape (n_section, 2)" msgstr "Zi harus berbentuk (n_section, 2)" +#~ msgid "Brightness must be 0-1.0" +#~ msgstr "Kecerahan harus di antara 0-1.0" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "Nilai x maksimum ketika dicerminkan adalah %d" + +#~ msgid "x value out of bounds" +#~ msgstr "nilai x di luar batas" + +#~ msgid "y value out of bounds" +#~ msgstr "Nilai y di luar batas" + #~ msgid "No key was specified" #~ msgstr "Tidak ada kunci yang ditentukan" diff --git a/locale/cs.po b/locale/cs.po index 2b7854a27f..0098691211 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -169,11 +169,15 @@ msgstr "Délka %q musí být <= %d" msgid "%q length must be >= %d" msgstr "Délka %q musí být >= %d" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "%q musí být %d" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "%q musí být %d-%d" @@ -207,6 +211,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -429,6 +434,7 @@ msgid "Address must be %d bytes long" msgstr "Adresa musí být %d bajtů dlouhá" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" @@ -614,13 +620,6 @@ msgstr "RX a TX jsou vyžadovány pro kontrolu toku" msgid "Both pins must support hardware interrupts" msgstr "Oba piny musí podporovat hardwarové přerušení" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "Jas musí být 0-1,0" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -935,11 +934,6 @@ msgstr "" msgid "EXTINT channel already in use" msgstr "EXTINT kanál se již používá" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "Chyba v MIDI přenosu na pozici %d" - #: extmod/modure.c msgid "Error in regex" msgstr "Chyba v regulárním výrazu" @@ -1355,11 +1349,6 @@ msgstr "MAC adresa byla chybná" msgid "Mapping must be a tuple" msgstr "" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "Maximální hodnota x při zrcadlení je %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1453,6 +1442,10 @@ msgstr "Nová bitmapa musí mít stejnou velikost jako původní bitmapa" msgid "Nimble out of memory" msgstr "" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1501,14 +1494,12 @@ msgstr "Žádný pin MOSI" msgid "No MOSI pin" msgstr "Žádný MOSI pin" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Žádný RX pin" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2138,8 +2129,8 @@ msgstr "" msgid "UART de-init" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "" @@ -4357,18 +4348,10 @@ msgstr "" msgid "wrong output type" msgstr "" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" @@ -4381,6 +4364,17 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Brightness must be 0-1.0" +#~ msgstr "Jas musí být 0-1,0" + +#, c-format +#~ msgid "Error in MIDI stream at position %d" +#~ msgstr "Chyba v MIDI přenosu na pozici %d" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "Maximální hodnota x při zrcadlení je %d" + #~ msgid "64 bit types" #~ msgstr "64 bit typy" diff --git a/locale/de_DE.po b/locale/de_DE.po index 21fea5273f..cb83251a7d 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -177,11 +177,15 @@ msgstr "%q länge muss kleiner oder gleich %d sein" msgid "%q length must be >= %d" msgstr "%q länge muss größer oder gleich %d sein" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "%q muss %d entsprechen" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "%q muss %d-%d sein" @@ -216,6 +220,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "%q muss von Typ %q oder %q sein, nicht %q" @@ -439,6 +444,7 @@ msgid "Address must be %d bytes long" msgstr "Die Adresse muss %d Bytes lang sein" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Adressbereich nicht erlaubt" @@ -624,13 +630,6 @@ msgstr "Sowohl RX als auch TX sind zu Flusssteuerung erforderlich" msgid "Both pins must support hardware interrupts" msgstr "Beide Pins müssen Hardware-Interrupts unterstützen" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "Die Helligkeit muss zwischen 0 und 1.0 liegen" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -951,11 +950,6 @@ msgstr "ESP-IDF Speicherallozierung fehlgeschlagen" msgid "EXTINT channel already in use" msgstr "EXTINT Kanal ist schon in Benutzung" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "Fehler in MIDI Datenstrom um Position %d" - #: extmod/modure.c msgid "Error in regex" msgstr "Fehler in regex" @@ -1379,11 +1373,6 @@ msgstr "MAC Adresse war ungültig" msgid "Mapping must be a tuple" msgstr "Zuordnung muss ein Tupel sein" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "Maximaler x-Wert beim Spiegeln ist %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1478,6 +1467,10 @@ msgstr "Neue Bitmap muss die gleiche Größe wie alte Bitmap haben" msgid "Nimble out of memory" msgstr "Kein Speicher mehr für Nible vorhanden" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1526,14 +1519,12 @@ msgstr "Kein MOSI-Pin" msgid "No MOSI pin" msgstr "MOSI Pin fehlt" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Kein RX-Pin" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2181,8 +2172,8 @@ msgstr "Tuple- oder struct_time-Argument erforderlich" msgid "UART de-init" msgstr "UART wird de-initialisiert" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "UART-Initialisierung" @@ -4444,18 +4435,10 @@ msgstr "falsche Anzahl zu entpackender Werte" msgid "wrong output type" msgstr "Falscher Ausgabetyp" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "x Wert außerhalb der Grenzen" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "xTaskCreate fehlgeschlagen" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "y Wert außerhalb der Grenzen" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi muss ein ndarray sein" @@ -4468,6 +4451,23 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "Brightness must be 0-1.0" +#~ msgstr "Die Helligkeit muss zwischen 0 und 1.0 liegen" + +#, c-format +#~ msgid "Error in MIDI stream at position %d" +#~ msgstr "Fehler in MIDI Datenstrom um Position %d" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "Maximaler x-Wert beim Spiegeln ist %d" + +#~ msgid "x value out of bounds" +#~ msgstr "x Wert außerhalb der Grenzen" + +#~ msgid "y value out of bounds" +#~ msgstr "y Wert außerhalb der Grenzen" + #~ msgid "I2SOut not available" #~ msgstr "I2SOut nicht verfügbar" diff --git a/locale/el.po b/locale/el.po index f7bc0aa360..0a327daae9 100644 --- a/locale/el.po +++ b/locale/el.po @@ -173,11 +173,15 @@ msgstr "%q μήκος πρέπει να είναι <= %d" msgid "%q length must be >= %d" msgstr "%q μήκος πρέπει να είναι >= %d" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "%q πρέπει να είναι %d" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "%q πρέπει να είναι %d-%d" @@ -211,6 +215,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -433,6 +438,7 @@ msgid "Address must be %d bytes long" msgstr "Η διεύθυνση πρέπει να είναι %d bytes μεγάλη" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" @@ -618,13 +624,6 @@ msgstr "Και RX και TX απαιτούνται για έλεγχο flow" msgid "Both pins must support hardware interrupts" msgstr "Και τα δύο pin πρέπει να υποστηρίζουν interrupts υλικού" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "Η φωτινότητα πρέπει να είναι μεταξύ 0-1.0" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -947,11 +946,6 @@ msgstr "" msgid "EXTINT channel already in use" msgstr "" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "" - #: extmod/modure.c msgid "Error in regex" msgstr "" @@ -1363,11 +1357,6 @@ msgstr "" msgid "Mapping must be a tuple" msgstr "" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1461,6 +1450,10 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1509,14 +1502,12 @@ msgstr "" msgid "No MOSI pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2145,8 +2136,8 @@ msgstr "" msgid "UART de-init" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "" @@ -4364,18 +4355,10 @@ msgstr "" msgid "wrong output type" msgstr "" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" @@ -4388,6 +4371,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Brightness must be 0-1.0" +#~ msgstr "Η φωτινότητα πρέπει να είναι μεταξύ 0-1.0" + #, fuzzy #~ msgid "64 bit types" #~ msgstr "64 bit τύποι" diff --git a/locale/en_GB.po b/locale/en_GB.po index 4452427b1a..ed9f289595 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -178,11 +178,15 @@ msgstr "%q length must be <= %d" msgid "%q length must be >= %d" msgstr "%q length must be >= %d" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "%q must be %d" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "%q must be %d-%d" @@ -216,6 +220,7 @@ msgstr "%q must be array of type 'h'" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "%q must be of type %q or %q, not %q" @@ -438,6 +443,7 @@ msgid "Address must be %d bytes long" msgstr "Address must be %d bytes long" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Address range not allowed" @@ -623,13 +629,6 @@ msgstr "Both RX and TX required for flow control" msgid "Both pins must support hardware interrupts" msgstr "Both pins must support hardware interrupts" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "Brightness must be 0-1.0" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -944,11 +943,6 @@ msgstr "ESP-IDF memory allocation failed" msgid "EXTINT channel already in use" msgstr "EXTINT channel already in use" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "Error in MIDI stream at position %d" - #: extmod/modure.c msgid "Error in regex" msgstr "Error in regex" @@ -1364,11 +1358,6 @@ msgstr "MAC address was invalid" msgid "Mapping must be a tuple" msgstr "Mapping must be a tuple" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "Maximum x value when mirrored is %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Microphone startup delay must be in range 0.0 to 1.0" @@ -1462,6 +1451,10 @@ msgstr "New bitmap must be same size as old bitmap" msgid "Nimble out of memory" msgstr "Nimble out of memory" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1510,14 +1503,12 @@ msgstr "No MOSI pin" msgid "No MOSI pin" msgstr "No MOSI pin" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "No RX pin" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2154,8 +2145,8 @@ msgstr "Tuple or struct_time argument required" msgid "UART de-init" msgstr "UART de-init" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "UART init" @@ -4385,18 +4376,10 @@ msgstr "wrong number of values to unpack" msgid "wrong output type" msgstr "wrong output type" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "x value out of bounds" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "xTaskCreate failed" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "y value out of bounds" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi must be an ndarray" @@ -4409,6 +4392,23 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "Brightness must be 0-1.0" +#~ msgstr "Brightness must be 0-1.0" + +#, c-format +#~ msgid "Error in MIDI stream at position %d" +#~ msgstr "Error in MIDI stream at position %d" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "Maximum x value when mirrored is %d" + +#~ msgid "x value out of bounds" +#~ msgstr "x value out of bounds" + +#~ msgid "y value out of bounds" +#~ msgstr "y value out of bounds" + #~ msgid "I2SOut not available" #~ msgstr "I2SOut not available" diff --git a/locale/es.po b/locale/es.po index ab4e118b7c..2f39335871 100644 --- a/locale/es.po +++ b/locale/es.po @@ -180,11 +180,15 @@ msgstr "%q longitud debe ser <= %d" msgid "%q length must be >= %d" msgstr "%q longitud debe ser >= %d" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "%q debe ser %d" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "%q debe ser %d-%d" @@ -218,6 +222,7 @@ msgstr "%q debe ser una matriz de tipo 'h'" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "%q debe ser del tipo %q o %q, y no %q" @@ -440,6 +445,7 @@ msgid "Address must be %d bytes long" msgstr "La dirección debe tener %d bytes de longitud" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Rango de dirección no permitido" @@ -627,13 +633,6 @@ msgstr "Ambos RX y TX requeridos para control de flujo" msgid "Both pins must support hardware interrupts" msgstr "Ambos pines deben soportar interrupciones por hardware" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "El brillo debe ser 0-1.0" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -956,11 +955,6 @@ msgstr "Fallo ESP-IDF al tomar la memoria" msgid "EXTINT channel already in use" msgstr "El canal EXTINT ya está siendo utilizado" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "Error en el flujo MIDI en la posición %d" - #: extmod/modure.c msgid "Error in regex" msgstr "Error en regex" @@ -1388,11 +1382,6 @@ msgstr "La dirección MAC es incorrecta" msgid "Mapping must be a tuple" msgstr "El mapping debe ser una dupla" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "Valor máximo de x cuando se refleja es %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Micrófono demora de inicio debe estar en el rango 0.0 a 1.0" @@ -1490,6 +1479,10 @@ msgstr "El nuevo bitmap debe ser del mismo tamaño que el bitmap anterior" msgid "Nimble out of memory" msgstr "Nimble sin memoria" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1538,14 +1531,12 @@ msgstr "Sin pin MOSI" msgid "No MOSI pin" msgstr "No pin MOSI" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Sin pin RX" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2193,8 +2184,8 @@ msgstr "Argumento tuple o struct_time requerido" msgid "UART de-init" msgstr "Desinicialización de UART" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "Inicialización de UART" @@ -4440,18 +4431,10 @@ msgstr "numero erroneo de valores a descomprimir" msgid "wrong output type" msgstr "tipo de salida incorrecta" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "valor x fuera de límites" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "fallo en xTaskCreate" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "valor y fuera de límites" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi debe ser un ndarray" @@ -4464,6 +4447,23 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Brightness must be 0-1.0" +#~ msgstr "El brillo debe ser 0-1.0" + +#, c-format +#~ msgid "Error in MIDI stream at position %d" +#~ msgstr "Error en el flujo MIDI en la posición %d" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "Valor máximo de x cuando se refleja es %d" + +#~ msgid "x value out of bounds" +#~ msgstr "valor x fuera de límites" + +#~ msgid "y value out of bounds" +#~ msgstr "valor y fuera de límites" + #~ msgid "I2SOut not available" #~ msgstr "I2SOut no disponible" diff --git a/locale/fil.po b/locale/fil.po index c7c0aeb635..7542bfbd35 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -166,11 +166,15 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "" @@ -204,6 +208,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -427,6 +432,7 @@ msgid "Address must be %d bytes long" msgstr "ang palette ay dapat 32 bytes ang haba" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" @@ -613,13 +619,6 @@ msgstr "" msgid "Both pins must support hardware interrupts" msgstr "Ang parehong mga pin ay dapat na sumusuporta sa hardware interrupts" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -937,11 +936,6 @@ msgstr "" msgid "EXTINT channel already in use" msgstr "Ginagamit na ang EXTINT channel" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "" - #: extmod/modure.c msgid "Error in regex" msgstr "May pagkakamali sa REGEX" @@ -1355,11 +1349,6 @@ msgstr "" msgid "Mapping must be a tuple" msgstr "" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Ang delay ng startup ng mikropono ay dapat na nasa 0.0 hanggang 1.0" @@ -1453,6 +1442,10 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1501,14 +1494,12 @@ msgstr "" msgid "No MOSI pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Walang RX pin" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2139,8 +2130,8 @@ msgstr "Tuple o struct_time argument kailangan" msgid "UART de-init" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "" @@ -4378,20 +4369,10 @@ msgstr "maling number ng value na i-unpack" msgid "wrong output type" msgstr "" -#: shared-module/displayio/Shape.c -#, fuzzy -msgid "x value out of bounds" -msgstr "wala sa sakop ang address" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "" -#: shared-module/displayio/Shape.c -#, fuzzy -msgid "y value out of bounds" -msgstr "wala sa sakop ang address" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" @@ -4404,6 +4385,14 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#, fuzzy +#~ msgid "x value out of bounds" +#~ msgstr "wala sa sakop ang address" + +#, fuzzy +#~ msgid "y value out of bounds" +#~ msgstr "wala sa sakop ang address" + #~ msgid "too many arguments provided with the given format" #~ msgstr "masyadong maraming mga argumento na ibinigay sa ibinigay na format" diff --git a/locale/fr.po b/locale/fr.po index ac83978de1..99f4345ce4 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -180,11 +180,15 @@ msgstr "La longeur de %q doit être <= %d" msgid "%q length must be >= %d" msgstr "La longeur de %q doit être >= %d" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "%q doit être %d" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "%q doit être %d-%d" @@ -218,6 +222,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "%q doit être de type %q ou %q, pas %q" @@ -440,6 +445,7 @@ msgid "Address must be %d bytes long" msgstr "L'adresse doit être longue de %d octets" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Plage d'adresses non autorisée" @@ -627,13 +633,6 @@ msgstr "RX et TX requis pour le contrôle de flux" msgid "Both pins must support hardware interrupts" msgstr "Les deux broches doivent supporter les interruptions matérielles" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "La luminosité doit être de 0 à 1.0" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -962,11 +961,6 @@ msgstr "ESP-IDF échec d'allocation de la mémoire" msgid "EXTINT channel already in use" msgstr "Canal EXTINT déjà utilisé" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "Erreur dans le flot MIDI à la position %d" - #: extmod/modure.c msgid "Error in regex" msgstr "Erreur dans l'expression régulière" @@ -1399,11 +1393,6 @@ msgstr "Adresse physique (MAC) invalide" msgid "Mapping must be a tuple" msgstr "Le mapping doit être un tuple" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "La valeur maximale de x est %d lors d'une opération miroir" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Le délais au démarrage du micro doit être entre 0.0 et 1.0" @@ -1500,6 +1489,10 @@ msgstr "La taille du nouveau bitmap doit être la même que l'ancien" msgid "Nimble out of memory" msgstr "Nimble n'a plus de mémoire" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1548,14 +1541,12 @@ msgstr "Pas de broche MOSI" msgid "No MOSI pin" msgstr "Aucune broche MOSI" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Pas de broche RX" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2200,8 +2191,8 @@ msgstr "Paramètre de type tuple ou struct_time requis" msgid "UART de-init" msgstr "Dé-initialisation du UART" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "Initialisation UART" @@ -4463,18 +4454,10 @@ msgstr "mauvais nombre de valeurs à dégrouper" msgid "wrong output type" msgstr "type de sortie incorrect" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "valeur x hors limites" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "Échec de xTaskCreate" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "valeur y hors limites" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi doit être un ndarray" @@ -4487,6 +4470,23 @@ 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 "Brightness must be 0-1.0" +#~ msgstr "La luminosité doit être de 0 à 1.0" + +#, c-format +#~ msgid "Error in MIDI stream at position %d" +#~ msgstr "Erreur dans le flot MIDI à la position %d" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "La valeur maximale de x est %d lors d'une opération miroir" + +#~ msgid "x value out of bounds" +#~ msgstr "valeur x hors limites" + +#~ msgid "y value out of bounds" +#~ msgstr "valeur y hors limites" + #~ msgid "I2SOut not available" #~ msgstr "I2SOut n'est pas disponible" diff --git a/locale/hi.po b/locale/hi.po index e264d5e692..c174cc1a35 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -165,11 +165,15 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "" @@ -203,6 +207,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -425,6 +430,7 @@ msgid "Address must be %d bytes long" msgstr "" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" @@ -608,13 +614,6 @@ msgstr "" msgid "Both pins must support hardware interrupts" msgstr "" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -927,11 +926,6 @@ msgstr "" msgid "EXTINT channel already in use" msgstr "" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "" - #: extmod/modure.c msgid "Error in regex" msgstr "" @@ -1343,11 +1337,6 @@ msgstr "" msgid "Mapping must be a tuple" msgstr "" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1441,6 +1430,10 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1489,14 +1482,12 @@ msgstr "" msgid "No MOSI pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2123,8 +2114,8 @@ msgstr "" msgid "UART de-init" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "" @@ -4342,18 +4333,10 @@ msgstr "" msgid "wrong output type" msgstr "" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 52fb4b00a3..0e37e651de 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -169,11 +169,15 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "" @@ -207,6 +211,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -430,6 +435,7 @@ msgid "Address must be %d bytes long" msgstr "L'indirizzo deve essere lungo %d byte" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" @@ -617,13 +623,6 @@ msgstr "Sia RX che TX richiedono il controllo del flow" msgid "Both pins must support hardware interrupts" msgstr "Entrambi i pin devono supportare gli interrupt hardware" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "La luminosità deve essere tra 0-1.0" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -939,11 +938,6 @@ msgstr "" msgid "EXTINT channel already in use" msgstr "Canale EXTINT già in uso" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "" - #: extmod/modure.c msgid "Error in regex" msgstr "Errore nella regex" @@ -1357,11 +1351,6 @@ msgstr "" msgid "Mapping must be a tuple" msgstr "" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "Valore massimo di x quando rispachiato è %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1456,6 +1445,10 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1504,14 +1497,12 @@ msgstr "" msgid "No MOSI pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Nessun pin RX" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2146,8 +2137,8 @@ msgstr "Tupla o struct_time richiesto come argomento" msgid "UART de-init" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "" @@ -4388,20 +4379,10 @@ msgstr "numero di valori da scompattare non corretto" msgid "wrong output type" msgstr "" -#: shared-module/displayio/Shape.c -#, fuzzy -msgid "x value out of bounds" -msgstr "indirizzo fuori limite" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "" -#: shared-module/displayio/Shape.c -#, fuzzy -msgid "y value out of bounds" -msgstr "indirizzo fuori limite" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" @@ -4414,6 +4395,21 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Brightness must be 0-1.0" +#~ msgstr "La luminosità deve essere tra 0-1.0" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "Valore massimo di x quando rispachiato è %d" + +#, fuzzy +#~ msgid "x value out of bounds" +#~ msgstr "indirizzo fuori limite" + +#, fuzzy +#~ msgid "y value out of bounds" +#~ msgstr "indirizzo fuori limite" + #~ msgid "64 bit types" #~ msgstr "Tipo 64 bits" diff --git a/locale/ja.po b/locale/ja.po index effefafb1c..da4f814724 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -172,11 +172,15 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "" @@ -210,6 +214,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -432,6 +437,7 @@ msgid "Address must be %d bytes long" msgstr "アドレスは、%dバイト長でなければなりません" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" @@ -617,13 +623,6 @@ msgstr "フロー制御のためRXとTXの両方が必要" msgid "Both pins must support hardware interrupts" msgstr "両方のピンにハードウェア割り込み対応が必要" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "brightnessは0から1.0まででなければなりません" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -938,11 +937,6 @@ msgstr "" msgid "EXTINT channel already in use" msgstr "EXTINTチャネルはすでに使用されています" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "" - #: extmod/modure.c msgid "Error in regex" msgstr "正規表現にエラーがあります" @@ -1356,11 +1350,6 @@ msgstr "" msgid "Mapping must be a tuple" msgstr "" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "マイクのスタートアップディレイは 0.0 から 1.0 の間でなければなりません" @@ -1454,6 +1443,10 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1502,14 +1495,12 @@ msgstr "MOSIピンがありません" msgid "No MOSI pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "RXピンがありません" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2139,8 +2130,8 @@ msgstr "" msgid "UART de-init" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "" @@ -4366,18 +4357,10 @@ msgstr "アンパックする値の個数が不正です" msgid "wrong output type" msgstr "" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "xが範囲外" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "yが範囲外" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "ziはndarrayでなければなりません" @@ -4390,6 +4373,15 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Brightness must be 0-1.0" +#~ msgstr "brightnessは0から1.0まででなければなりません" + +#~ msgid "x value out of bounds" +#~ msgstr "xが範囲外" + +#~ msgid "y value out of bounds" +#~ msgstr "yが範囲外" + #~ msgid "I2SOut not available" #~ msgstr "I2SOutが利用できません" diff --git a/locale/ko.po b/locale/ko.po index 061c70bdfa..cae445c289 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -166,11 +166,15 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "" @@ -204,6 +208,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -426,6 +431,7 @@ msgid "Address must be %d bytes long" msgstr "" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" @@ -611,13 +617,6 @@ msgstr "" msgid "Both pins must support hardware interrupts" msgstr "" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -930,11 +929,6 @@ msgstr "" msgid "EXTINT channel already in use" msgstr "" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "" - #: extmod/modure.c msgid "Error in regex" msgstr "Regex에 오류가 있습니다." @@ -1346,11 +1340,6 @@ msgstr "" msgid "Mapping must be a tuple" msgstr "" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1444,6 +1433,10 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1492,14 +1485,12 @@ msgstr "" msgid "No MOSI pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2126,8 +2117,8 @@ msgstr "" msgid "UART de-init" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "" @@ -4346,18 +4337,10 @@ msgstr "" msgid "wrong output type" msgstr "" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 3f14b144c6..71700109e3 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -165,11 +165,15 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "" @@ -203,6 +207,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -425,6 +430,7 @@ msgid "Address must be %d bytes long" msgstr "Adres moet %d bytes lang zijn" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" @@ -610,13 +616,6 @@ msgstr "RX en TX zijn beide vereist voor stroomregeling" msgid "Both pins must support hardware interrupts" msgstr "Beide pinnen moeten hardware interrupts ondersteunen" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "Helderheid moet tussen de 0 en 1.0 liggen" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -932,11 +931,6 @@ msgstr "ESP-IDF geheugen toewijzing mislukt" msgid "EXTINT channel already in use" msgstr "EXTINT kanaal al in gebruik" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "" - #: extmod/modure.c msgid "Error in regex" msgstr "Fout in regex" @@ -1351,11 +1345,6 @@ msgstr "" msgid "Mapping must be a tuple" msgstr "" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "Maximale x waarde indien gespiegeld is %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Microfoon opstart vertraging moet in bereik van 0.0 tot 1.0 zijn" @@ -1449,6 +1438,10 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1497,14 +1490,12 @@ msgstr "Geen MOSI pin" msgid "No MOSI pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Geen RX pin" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2144,8 +2135,8 @@ msgstr "Tuple of struct_time argument vereist" msgid "UART de-init" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "" @@ -4376,18 +4367,10 @@ msgstr "verkeerd aantal waarden om uit te pakken" msgid "wrong output type" msgstr "onjuist uitvoer type" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "x-waarde buiten bereik" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "y-waarde buiten bereik" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi moet een ndarray zijn" @@ -4400,6 +4383,19 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "Brightness must be 0-1.0" +#~ msgstr "Helderheid moet tussen de 0 en 1.0 liggen" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "Maximale x waarde indien gespiegeld is %d" + +#~ msgid "x value out of bounds" +#~ msgstr "x-waarde buiten bereik" + +#~ msgid "y value out of bounds" +#~ msgstr "y-waarde buiten bereik" + #~ msgid "I2SOut not available" #~ msgstr "I2SOut is niet beschikbaar" diff --git a/locale/pl.po b/locale/pl.po index f6c35b87b2..26b0cb12b6 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -167,11 +167,15 @@ msgstr "" msgid "%q length must be >= %d" msgstr "" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "" @@ -205,6 +209,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -427,6 +432,7 @@ msgid "Address must be %d bytes long" msgstr "Adres musi mieć %d bajtów" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" @@ -612,13 +618,6 @@ msgstr "Do kontroli przepływu wymagane są zarówno RX, jak i TX" msgid "Both pins must support hardware interrupts" msgstr "Obie nóżki muszą wspierać przerwania sprzętowe" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "Jasność musi wynosić 0-1,0" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -933,11 +932,6 @@ msgstr "" msgid "EXTINT channel already in use" msgstr "Kanał EXTINT w użyciu" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "" - #: extmod/modure.c msgid "Error in regex" msgstr "Błąd w regex" @@ -1351,11 +1345,6 @@ msgstr "" msgid "Mapping must be a tuple" msgstr "" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "Największa wartość x przy odwróceniu to %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Opóźnienie włączenia mikrofonu musi być w zakresie od 0.0 do 1.0" @@ -1449,6 +1438,10 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1497,14 +1490,12 @@ msgstr "Brak pinu MOSI" msgid "No MOSI pin" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Brak nóżki RX" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2131,8 +2122,8 @@ msgstr "Wymagana krotka lub struct_time" msgid "UART de-init" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "" @@ -4352,18 +4343,10 @@ msgstr "zła liczba wartości do rozpakowania" msgid "wrong output type" msgstr "nieprawidłowy typ wyjścia" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "x poza zakresem" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "y poza zakresem" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" @@ -4376,6 +4359,19 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Brightness must be 0-1.0" +#~ msgstr "Jasność musi wynosić 0-1,0" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "Największa wartość x przy odwróceniu to %d" + +#~ msgid "x value out of bounds" +#~ msgstr "x poza zakresem" + +#~ msgid "y value out of bounds" +#~ msgstr "y poza zakresem" + #~ msgid "I2SOut not available" #~ msgstr "I2SOut niedostępne" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index c31b7e0134..278ba89d3f 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -178,11 +178,15 @@ msgstr "o comprimento de %q deve ser <= %d" msgid "%q length must be >= %d" msgstr "o comprimento de %q deve ser >= %d" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "%q deve ser %d" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "o %q deve ser %d-%d" @@ -216,6 +220,7 @@ msgstr "%q deve ser uma matriz do tipo 'h'" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "%q deve ser do tipo %q ou %q e não %q" @@ -442,6 +447,7 @@ msgid "Address must be %d bytes long" msgstr "O endereço deve ter %d bytes de comprimento" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Intervalo de endereços não permitido" @@ -629,13 +635,6 @@ msgstr "Ambos os RX e TX são necessários para o controle do fluxo" msgid "Both pins must support hardware interrupts" msgstr "Ambos os pinos devem suportar interrupções de hardware" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "O brilho deve ser 0-1,0" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -955,11 +954,6 @@ msgstr "Houve uma falha na alocação da memória ESP-IDF" msgid "EXTINT channel already in use" msgstr "Canal EXTINT em uso" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "Houve um erro no fluxo MIDI na posição %d" - #: extmod/modure.c msgid "Error in regex" msgstr "Erro no regex" @@ -1385,11 +1379,6 @@ msgstr "Endereço MAC inválido" msgid "Mapping must be a tuple" msgstr "O mapeamento deve ser uma tupla" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "O valor máximo de x quando espelhado é %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "O atraso na inicialização do microfone deve estar entre 0,0 e 1,0" @@ -1483,6 +1472,10 @@ msgstr "O novo bitmap deve ter o mesmo tamanho que o bitmap antigo" msgid "Nimble out of memory" msgstr "Ágil fora da memória" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1531,14 +1524,12 @@ msgstr "Nenhum pino MOSI" msgid "No MOSI pin" msgstr "Nenhum pino MOSI" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Nenhum pino RX" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2188,8 +2179,8 @@ msgstr "O argumento de tupla ou struct_time é necessário" msgid "UART de-init" msgstr "descontinuar o início UART" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "inicialização do UART" @@ -4441,18 +4432,10 @@ msgstr "quantidade incorreta dos valores para descompressão" msgid "wrong output type" msgstr "tipo da saída incorreta" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "o valor x está fora dos limites" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "o xTaskCreate falhou" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "o valor y está fora dos limites" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi deve ser um ndarray" @@ -4465,6 +4448,23 @@ 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 "Brightness must be 0-1.0" +#~ msgstr "O brilho deve ser 0-1,0" + +#, c-format +#~ msgid "Error in MIDI stream at position %d" +#~ msgstr "Houve um erro no fluxo MIDI na posição %d" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "O valor máximo de x quando espelhado é %d" + +#~ msgid "x value out of bounds" +#~ msgstr "o valor x está fora dos limites" + +#~ msgid "y value out of bounds" +#~ msgstr "o valor y está fora dos limites" + #~ msgid "I2SOut not available" #~ msgstr "O I2SOut não está disponível" diff --git a/locale/ru.po b/locale/ru.po index 82bf8504f9..a77de6e17a 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -172,11 +172,15 @@ msgstr "Длинна %q должна быть <= %d" msgid "%q length must be >= %d" msgstr "Длинна %q должна быть >= %d" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "%q должно быть %d" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "%q должно быть %d-%d" @@ -210,6 +214,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -432,6 +437,7 @@ msgid "Address must be %d bytes long" msgstr "Адрес должен быть длиной %d байт" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Диапазон адресов не разрешен" @@ -621,13 +627,6 @@ msgstr "Для управления потоком требуется как RX, msgid "Both pins must support hardware interrupts" msgstr "Оба пина должны поддерживать аппаратные прерывания" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "Яркость должна быть в диапазоне от 0 до 1.0" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -956,11 +955,6 @@ msgstr "Ошибка выделения памяти ESP-IDF" msgid "EXTINT channel already in use" msgstr "Канал EXTINT уже используется" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "Ошибка в MIDI-потоке на позиции %d" - #: extmod/modure.c msgid "Error in regex" msgstr "Ошибка в регулярном выражении(regex)" @@ -1390,11 +1384,6 @@ msgstr "MAC адрес был недействительным" msgid "Mapping must be a tuple" msgstr "" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "Максимальное значение x при зеркальном отображении - %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Задержка включения микрофона должна быть в диапазоне от 0.0 до 1.0" @@ -1489,6 +1478,10 @@ msgstr "Новый bitmap должен быть того же размера ч msgid "Nimble out of memory" msgstr "" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1537,14 +1530,12 @@ msgstr "Нет пина MOSI" msgid "No MOSI pin" msgstr "Нет пина MOSI" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Нет пина RX" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2186,8 +2177,8 @@ msgstr "" msgid "UART de-init" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "" @@ -4405,18 +4396,10 @@ msgstr "" msgid "wrong output type" msgstr "неверный тип вывода" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "xTaskCreate провалился" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi должен быть bytearray" @@ -4429,6 +4412,17 @@ msgstr "zi должно быть типа float" msgid "zi must be of shape (n_section, 2)" msgstr "zi должен иметь форму (n_section, 2)" +#~ msgid "Brightness must be 0-1.0" +#~ msgstr "Яркость должна быть в диапазоне от 0 до 1.0" + +#, c-format +#~ msgid "Error in MIDI stream at position %d" +#~ msgstr "Ошибка в MIDI-потоке на позиции %d" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "Максимальное значение x при зеркальном отображении - %d" + #~ msgid "I2SOut not available" #~ msgstr "I2SOut недоступен" diff --git a/locale/sv.po b/locale/sv.po index c5dece498d..6cf765bcab 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -177,11 +177,15 @@ msgstr "längden på %q måste vara <= %d" msgid "%q length must be >= %d" msgstr "längden på %q måste vara >= %d" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "%q måste vara %d" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "%q måste vara %d-%d" @@ -217,6 +221,7 @@ msgstr "%q måste vara en matris av typen 'h'" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "%q måste vara av typen %q eller %q, inte %q" @@ -439,6 +444,7 @@ msgid "Address must be %d bytes long" msgstr "Adressen måste vara %d byte lång" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Adressintervallet är inte tillåtet" @@ -624,13 +630,6 @@ msgstr "Både RX och TX krävs för handskakning" msgid "Both pins must support hardware interrupts" msgstr "Båda pinnarna måste stödja maskinvaruavbrott" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "Ljusstyrkan måste vara mellan 0 och 1,0" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -948,11 +947,6 @@ msgstr "ESP-IDF-minnetilldelning misslyckades" msgid "EXTINT channel already in use" msgstr "EXTINT-kanalen används redan" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "Fel i MIDI-ström vid position %d" - #: extmod/modure.c msgid "Error in regex" msgstr "Fel i regex" @@ -1370,11 +1364,6 @@ msgstr "MAC-adressen var ogiltig" msgid "Mapping must be a tuple" msgstr "Mappning måste vara en tuple" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "Maximum x-värde vid spegling är %d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1469,6 +1458,10 @@ msgstr "Ny bitmapp måste ha samma storlek som tidigare bitmapp" msgid "Nimble out of memory" msgstr "Nimble har inget minne kvar" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1517,14 +1510,12 @@ msgstr "Ingen MOSI-pinne" msgid "No MOSI pin" msgstr "Ingen MOSI-pinne" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Ingen RX-pinne" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2165,8 +2156,8 @@ msgstr "Tuple- eller struct_time-argument krävs" msgid "UART de-init" msgstr "UART omstart" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "UART start" @@ -4403,18 +4394,10 @@ msgstr "fel antal värden för att packa upp" msgid "wrong output type" msgstr "fel utdatatyp" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "x-värde utanför intervall" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "xTaskCreate misslyckades" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "y-värde utanför intervall" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi måste vara en ndarray" @@ -4427,6 +4410,23 @@ 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 "Brightness must be 0-1.0" +#~ msgstr "Ljusstyrkan måste vara mellan 0 och 1,0" + +#, c-format +#~ msgid "Error in MIDI stream at position %d" +#~ msgstr "Fel i MIDI-ström vid position %d" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "Maximum x-värde vid spegling är %d" + +#~ msgid "x value out of bounds" +#~ msgstr "x-värde utanför intervall" + +#~ msgid "y value out of bounds" +#~ msgstr "y-värde utanför intervall" + #~ msgid "I2SOut not available" #~ msgstr "I2SOut är inte tillgängligt" diff --git a/locale/tr.po b/locale/tr.po index 1bcf4b9cfb..1cfbc19ac9 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -173,11 +173,15 @@ msgstr "%q boyutu <= %d olmalıdır" msgid "%q length must be >= %d" msgstr "%q boyutu >= %d olmalıdır" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "%q, %d olmalıdır" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "%q, %d-%d olmalıdır" @@ -211,6 +215,7 @@ msgstr "" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "" @@ -434,6 +439,7 @@ msgid "Address must be %d bytes long" msgstr "Adres %d byte uzunluğunda olmalıdır" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" @@ -619,13 +625,6 @@ msgstr "Hem RX hem de TX akış kontrolü için gerekli" msgid "Both pins must support hardware interrupts" msgstr "Her iki pin de donanım kesintilerini desteklemelidir" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "Parlaklık 0-1.0 aralığında olmalı" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -939,11 +938,6 @@ msgstr "" msgid "EXTINT channel already in use" msgstr "EXTINT kanalı zaten kullanımda" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "%d konumundaki MIDI akışında hata" - #: extmod/modure.c msgid "Error in regex" msgstr "regex'te hata" @@ -1362,11 +1356,6 @@ msgstr "MAC adresi geçersiz" msgid "Mapping must be a tuple" msgstr "Map tuple olmalıdır" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "İkizlendiğinde maksimum x değeri %d'dir" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "" @@ -1460,6 +1449,10 @@ msgstr "" msgid "Nimble out of memory" msgstr "" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1508,14 +1501,12 @@ msgstr "MOSI pini yok" msgid "No MOSI pin" msgstr "MOSI pini yok" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "RX pini yok" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2145,8 +2136,8 @@ msgstr "" msgid "UART de-init" msgstr "" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "" @@ -4364,18 +4355,10 @@ msgstr "" msgid "wrong output type" msgstr "" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "" @@ -4388,6 +4371,17 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Brightness must be 0-1.0" +#~ msgstr "Parlaklık 0-1.0 aralığında olmalı" + +#, c-format +#~ msgid "Error in MIDI stream at position %d" +#~ msgstr "%d konumundaki MIDI akışında hata" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "İkizlendiğinde maksimum x değeri %d'dir" + #~ msgid "I2SOut not available" #~ msgstr "I2SOut uygundeğil" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 133958f5a6..3d4f53689f 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -180,11 +180,15 @@ msgstr "%q chángdù bìxū <= %d" msgid "%q length must be >= %d" msgstr "%q chángdù bìxū >= %d" -#: ports/raspberrypi/common-hal/picodvi/Framebuffer.c py/argcheck.c +#: py/argcheck.c msgid "%q must be %d" msgstr "%q bìxū %d" #: py/argcheck.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/is31fl3741/FrameBuffer.c +#: shared-bindings/rgbmatrix/RGBMatrix.c msgid "%q must be %d-%d" msgstr "%q bì xū wéi %d-%d" @@ -219,6 +223,7 @@ msgstr "%q bìxū shì lèixíng wéi 'h' de shùzǔ" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c +#: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" msgstr "%q de lèi xíng bì xū shì %q huò %q, ér bù shì %q" @@ -441,6 +446,7 @@ msgid "Address must be %d bytes long" msgstr "dìzhǐ chángdù bìxū shì %d zìjié" #: ports/espressif/common-hal/memorymap/AddressRange.c +#: ports/nrf/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "bù yǔn xǔ de dì zhǐ fàn wéi" @@ -626,13 +632,6 @@ msgstr "RX hé TX dōu xū yào liúliàng kòngzhì" msgid "Both pins must support hardware interrupts" msgstr "liǎnggè yǐnjiǎo dōu bìxū zhīchí yìngjiàn zhōngduàn" -#: shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -#: shared-bindings/is31fl3741/FrameBuffer.c -#: shared-bindings/rgbmatrix/RGBMatrix.c -msgid "Brightness must be 0-1.0" -msgstr "Liàngdù bìxū wèi 0-1.0" - #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Brightness not adjustable" @@ -950,11 +949,6 @@ msgstr "ESP-IDF nèicún fēnpèi shībài" msgid "EXTINT channel already in use" msgstr "EXTINT píndào yǐjīng shǐyòng" -#: shared-module/synthio/MidiTrack.c -#, c-format -msgid "Error in MIDI stream at position %d" -msgstr "wèi yú %d wèi zhì de MIDI liú zhōng de cuò wù" - #: extmod/modure.c msgid "Error in regex" msgstr "Zhèngzé biǎodá shì cuòwù" @@ -1377,11 +1371,6 @@ msgstr "MAC dì zhǐ wú xiào" msgid "Mapping must be a tuple" msgstr "yìng shè bì xū shì yuán zǔ" -#: shared-module/displayio/Shape.c -#, c-format -msgid "Maximum x value when mirrored is %d" -msgstr "Jìngxiàng shí de zuìdà X zhí wèi%d" - #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" msgstr "Màikèfēng qǐdòng yánchí bìxū zài 0.0 Dào 1.0 De fànwéi nèi" @@ -1476,6 +1465,10 @@ msgstr "xīn wèi tú de dàxiǎo bìxū yǔ jiù wèi tú xiāngtóng" msgid "Nimble out of memory" msgstr "líng huó de bǎi tuō jì yì" +#: ports/atmel-samd/common-hal/busio/UART.c +msgid "No %q pin" +msgstr "" + #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" @@ -1524,14 +1517,12 @@ msgstr "Méiyǒu MOSI yǐn jiǎo" msgid "No MOSI pin" msgstr "wú MOSI pin" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "No RX pin" msgstr "Wèi zhǎodào RX yǐn jiǎo" -#: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c #: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c @@ -2170,8 +2161,8 @@ msgstr "Xūyào Tuple huò struct_time cānshù" msgid "UART de-init" msgstr "UART qù chūshǐhuà" -#: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c -#: ports/espressif/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c +#: ports/stm/common-hal/busio/UART.c msgid "UART init" msgstr "UART chūshǐhuà" @@ -4409,18 +4400,10 @@ msgstr "wúfǎ jiě bāo de zhí shù" msgid "wrong output type" msgstr "cuòwù de shūchū lèixíng" -#: shared-module/displayio/Shape.c -msgid "x value out of bounds" -msgstr "x zhí chāochū biānjiè" - #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" msgstr "xTaskCreate shī bài" -#: shared-module/displayio/Shape.c -msgid "y value out of bounds" -msgstr "y zhí chāochū biānjiè" - #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" msgstr "zi bìxū shì ndarray" @@ -4433,6 +4416,23 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Brightness must be 0-1.0" +#~ msgstr "Liàngdù bìxū wèi 0-1.0" + +#, c-format +#~ msgid "Error in MIDI stream at position %d" +#~ msgstr "wèi yú %d wèi zhì de MIDI liú zhōng de cuò wù" + +#, c-format +#~ msgid "Maximum x value when mirrored is %d" +#~ msgstr "Jìngxiàng shí de zuìdà X zhí wèi%d" + +#~ msgid "x value out of bounds" +#~ msgstr "x zhí chāochū biānjiè" + +#~ msgid "y value out of bounds" +#~ msgstr "y zhí chāochū biānjiè" + #~ msgid "I2SOut not available" #~ msgstr "I2SOut bù kě yòng" From 53c4fa0002bf1e5f2e2e9ea48e8bd7c628781db3 Mon Sep 17 00:00:00 2001 From: Jose David M Date: Fri, 19 May 2023 16:11:03 +0000 Subject: [PATCH 1074/1712] Translated using Weblate (Spanish) Currently translated at 100.0% (995 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/es.po b/locale/es.po index 2f39335871..b4f55be7e4 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-05-16 19:50+0000\n" -"Last-Translator: Luis Ruiz San Segundo \n" +"PO-Revision-Date: 2023-05-19 16:13+0000\n" +"Last-Translator: Jose David M \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" @@ -1481,7 +1481,7 @@ msgstr "Nimble sin memoria" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "No %q pin" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From af5c793e3dcb754cf21b322d8971a0b506521ad4 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 19 May 2023 15:52:42 +0000 Subject: [PATCH 1075/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (995 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 278ba89d3f..f9f3ddb50f 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: 2023-04-22 06:48+0000\n" +"PO-Revision-Date: 2023-05-19 16:13+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1474,7 +1474,7 @@ msgstr "Ágil fora da memória" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "Sem pin %q" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From 45a8b78a0e97672810c35306ae50b1522dd378b7 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Fri, 19 May 2023 15:53:25 +0000 Subject: [PATCH 1076/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (995 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 6cf765bcab..a2f7eb2069 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-04-22 06:48+0000\n" +"PO-Revision-Date: 2023-05-19 16:13+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -1460,7 +1460,7 @@ msgstr "Nimble har inget minne kvar" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "Ingen %q-pinne" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From 9e995a5e980d50b843df7ad740a75c7248a11e3f Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 19 May 2023 12:36:28 -0400 Subject: [PATCH 1077/1712] Fix Espressif TouchAlarm --- ports/espressif/common-hal/alarm/touch/TouchAlarm.c | 5 +++++ ports/espressif/peripherals/touch.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ports/espressif/common-hal/alarm/touch/TouchAlarm.c b/ports/espressif/common-hal/alarm/touch/TouchAlarm.c index b58234c9a8..16cecabfa9 100644 --- a/ports/espressif/common-hal/alarm/touch/TouchAlarm.c +++ b/ports/espressif/common-hal/alarm/touch/TouchAlarm.c @@ -44,6 +44,7 @@ void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *s self->pin = pin; } +// Used for light sleep. mp_obj_t alarm_touch_touchalarm_find_triggered_alarm(const size_t n_alarms, const mp_obj_t *alarms) { for (size_t i = 0; i < n_alarms; i++) { if (mp_obj_is_type(alarms[i], &alarm_touch_touchalarm_type)) { @@ -76,6 +77,8 @@ mp_obj_t alarm_touch_touchalarm_record_wake_alarm(void) { const mcu_pin_obj_t *pin_obj = MP_OBJ_TO_PTR(mcu_pin_globals.map.table[i].value); if (pin_obj->touch_channel == wake_channel) { alarm->pin = mcu_pin_globals.map.table[i].value; + // Undo the never reset in case it was a fake deep sleep. + reset_pin_number(alarm->pin->number); break; } } @@ -101,6 +104,8 @@ void alarm_touch_touchalarm_set_alarm(const bool deep_sleep, const size_t n_alar } touch_alarm = MP_OBJ_TO_PTR(alarms[i]); touch_channel_mask |= 1 << touch_alarm->pin->number; + // Resetting the pin will set a pull-up, which we don't want. + never_reset_pin_number(touch_alarm->pin->number); touch_alarm_set = true; } } diff --git a/ports/espressif/peripherals/touch.c b/ports/espressif/peripherals/touch.c index 9cf718b501..6e9988de0f 100644 --- a/ports/espressif/peripherals/touch.c +++ b/ports/espressif/peripherals/touch.c @@ -43,7 +43,7 @@ void peripherals_touch_never_reset(const bool enable) { void peripherals_touch_init(const touch_pad_t touchpad) { if (!touch_inited) { touch_pad_init(); - touch_pad_set_fsm_mode(TOUCH_FSM_MODE_SW); + touch_pad_set_fsm_mode(TOUCH_FSM_MODE_TIMER); } // touch_pad_config() must be done before touch_pad_fsm_start() the first time. // Otherwise the calibration is wrong and we get maximum raw values if there is From d755238005e84a90cb9b98151bdb6c8d3f344ddf Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 19 May 2023 15:05:44 -0400 Subject: [PATCH 1078/1712] add pin_skip_reset_once capability --- .../common-hal/alarm/touch/TouchAlarm.c | 16 ++++++++++------ .../espressif/common-hal/microcontroller/Pin.c | 17 +++++++++++++++++ .../espressif/common-hal/microcontroller/Pin.h | 1 + ports/espressif/peripherals/touch.c | 5 ++--- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/ports/espressif/common-hal/alarm/touch/TouchAlarm.c b/ports/espressif/common-hal/alarm/touch/TouchAlarm.c index 16cecabfa9..f85ca5ad92 100644 --- a/ports/espressif/common-hal/alarm/touch/TouchAlarm.c +++ b/ports/espressif/common-hal/alarm/touch/TouchAlarm.c @@ -77,8 +77,6 @@ mp_obj_t alarm_touch_touchalarm_record_wake_alarm(void) { const mcu_pin_obj_t *pin_obj = MP_OBJ_TO_PTR(mcu_pin_globals.map.table[i].value); if (pin_obj->touch_channel == wake_channel) { alarm->pin = mcu_pin_globals.map.table[i].value; - // Undo the never reset in case it was a fake deep sleep. - reset_pin_number(alarm->pin->number); break; } } @@ -105,7 +103,7 @@ void alarm_touch_touchalarm_set_alarm(const bool deep_sleep, const size_t n_alar touch_alarm = MP_OBJ_TO_PTR(alarms[i]); touch_channel_mask |= 1 << touch_alarm->pin->number; // Resetting the pin will set a pull-up, which we don't want. - never_reset_pin_number(touch_alarm->pin->number); + skip_reset_once_pin_number(touch_alarm->pin->number); touch_alarm_set = true; } } @@ -133,8 +131,11 @@ void alarm_touch_touchalarm_set_alarm(const bool deep_sleep, const size_t n_alar // configure trigger threshold #if defined(CONFIG_IDF_TARGET_ESP32) uint16_t touch_value; + // ESP32 touch_pad_read() returns a lower value when a pin is touched, not a higher value + // Typical values on a Feather ESP32 V2 are 600 with a short jumper untouched, + // 70 touched. touch_pad_read(touch_channel, &touch_value); - touch_pad_set_thresh(touch_channel, touch_value / 10); // 10% + touch_pad_set_thresh(touch_channel, touch_value / 2); #else uint32_t touch_value; touch_pad_read_benchmark(touch_channel, &touch_value); @@ -186,8 +187,11 @@ void alarm_touch_touchalarm_prepare_for_deep_sleep(void) { // configure trigger threshold #if defined(CONFIG_IDF_TARGET_ESP32) uint16_t touch_value; - touch_pad_read_filtered(touch_channel, &touch_value); - touch_pad_set_thresh(touch_channel, touch_value); + touch_pad_read(touch_channel, &touch_value); + // ESP32 touch_pad_read() returns a lower value when a pin is touched, not a higher value + // Typical values on a Feather ESP32 V2 are 600 with a short jumper untouched, + // 70 touched. + touch_pad_set_thresh(touch_channel, touch_value / 2); #else uint32_t touch_value; touch_pad_sleep_channel_read_smooth(touch_channel, &touch_value); diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index 003543a043..4e1efa868f 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -34,6 +34,7 @@ #include "components/hal/include/hal/gpio_hal.h" STATIC uint64_t _never_reset_pin_mask; +STATIC uint64_t _skip_reset_once_pin_mask; STATIC uint64_t _preserved_pin_mask; STATIC uint64_t _in_use_pin_mask; @@ -112,6 +113,15 @@ void never_reset_pin_number(gpio_num_t pin_number) { _never_reset_pin_mask |= PIN_BIT(pin_number); } +void skip_reset_once_pin_number(gpio_num_t pin_number) { + // Some CircuitPython APIs deal in uint8_t pin numbers, but NO_PIN is -1. + // Also allow pin 255 to be treated as NO_PIN to avoid crashes + if (pin_number == NO_PIN || pin_number == (uint8_t)NO_PIN) { + return; + } + _skip_reset_once_pin_mask |= PIN_BIT(pin_number); +} + void common_hal_never_reset_pin(const mcu_pin_obj_t *pin) { if (pin == NULL) { return; @@ -131,6 +141,10 @@ STATIC bool _never_reset(gpio_num_t pin_number) { return _never_reset_pin_mask & PIN_BIT(pin_number); } +STATIC bool _skip_reset_once(gpio_num_t pin_number) { + return _skip_reset_once_pin_mask & PIN_BIT(pin_number); +} + STATIC bool _preserved_pin(gpio_num_t pin_number) { return _preserved_pin_mask & PIN_BIT(pin_number); } @@ -224,12 +238,15 @@ void reset_all_pins(void) { uint32_t iomux_address = GPIO_PIN_MUX_REG[i]; if (iomux_address == 0 || _never_reset(i) || + _skip_reset_once(i) || _preserved_pin(i)) { continue; } _reset_pin(i); } _in_use_pin_mask = _never_reset_pin_mask; + // Don't continue to skip resetting these pins. + _skip_reset_once_pin_mask = 0; } void claim_pin_number(gpio_num_t pin_number) { diff --git a/ports/espressif/common-hal/microcontroller/Pin.h b/ports/espressif/common-hal/microcontroller/Pin.h index 55927fe068..05c8fe880d 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.h +++ b/ports/espressif/common-hal/microcontroller/Pin.h @@ -41,6 +41,7 @@ extern void reset_all_pins(void); // reset_pin_number takes the pin number instead of the pointer so that objects don't // need to store a full pointer. extern void reset_pin_number(gpio_num_t pin_number); +extern void skip_reset_once_pin_number(gpio_num_t pin_number); extern void claim_pin(const mcu_pin_obj_t *pin); extern void claim_pin_number(gpio_num_t pin_number); extern bool pin_number_is_free(gpio_num_t pin_number); diff --git a/ports/espressif/peripherals/touch.c b/ports/espressif/peripherals/touch.c index 6e9988de0f..98ecf10dfd 100644 --- a/ports/espressif/peripherals/touch.c +++ b/ports/espressif/peripherals/touch.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include "py/gc.h" #include "peripherals/touch.h" static bool touch_inited = false; @@ -61,14 +62,12 @@ uint16_t peripherals_touch_read(touch_pad_t touchpad) { #if defined(CONFIG_IDF_TARGET_ESP32) uint16_t touch_value; touch_pad_read(touchpad, &touch_value); + // ESP32 touch_pad_read() returns a lower value when a pin is touched instead of a higher value. // Flip the values around to be consistent with TouchIn assumptions. return UINT16_MAX - touch_value; #else uint32_t touch_value; - touch_pad_sw_start(); - while (!touch_pad_meas_is_done()) { - } touch_pad_read_raw_data(touchpad, &touch_value); if (touch_value > UINT16_MAX) { return UINT16_MAX; From 57e77d733e019603e70ae00c2dcf09df128c27ef Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:22:01 +0000 Subject: [PATCH 1079/1712] Translated using Weblate (Indonesian) Currently translated at 34.3% (342 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/id/ --- locale/ID.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index c3b49fb492..c9208d6149 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -6,15 +6,15 @@ 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-11-08 18:50+0000\n" -"Last-Translator: Reza Almanda \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \n" "Language-Team: LANGUAGE \n" "Language: ID\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.9-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1444,7 +1444,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "Tidak pin %q" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From 84908e674da537b55ec7bf0d71bd777430d7f2e8 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:21:23 +0000 Subject: [PATCH 1080/1712] Translated using Weblate (German) Currently translated at 99.7% (993 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/de/ --- locale/de_DE.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/de_DE.po b/locale/de_DE.po index cb83251a7d..697e08fd1a 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -6,14 +6,14 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-03-31 14:39+0000\n" -"Last-Translator: Ettore Atalan \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \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.17-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1469,7 +1469,7 @@ msgstr "Kein Speicher mehr für Nible vorhanden" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "Kein %q-Pin" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From 28a5b5034931122fdb6db20386d426204601d6c9 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:24:28 +0000 Subject: [PATCH 1081/1712] Translated using Weblate (Spanish) Currently translated at 100.0% (995 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/es.po b/locale/es.po index b4f55be7e4..f59aa02672 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-05-19 16:13+0000\n" -"Last-Translator: Jose David M \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" @@ -1481,7 +1481,7 @@ msgstr "Nimble sin memoria" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "No %q pin" +msgstr "Sin pin %q" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From 70f69793252fa07e05317f1d192dbded1e58062a Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:20:45 +0000 Subject: [PATCH 1082/1712] Translated using Weblate (Filipino) Currently translated at 33.3% (332 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fil/ --- locale/fil.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/fil.po b/locale/fil.po index 7542bfbd35..080eddf285 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -6,8 +6,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2022-12-27 18:02+0000\n" -"Last-Translator: Blinka CircuitPython \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \n" "Language-Team: fil\n" "Language: fil\n" "MIME-Version: 1.0\n" @@ -15,7 +15,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1 && n != 2 && n != 3 && (n % 10 == 4 " "|| n % 10 == 6 || n % 10 == 9);\n" -"X-Generator: Weblate 4.15.1-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1444,7 +1444,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "Walang %q pin" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From 82c669859e549fea9c80f6cde7a896d6e44f1640 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:21:04 +0000 Subject: [PATCH 1083/1712] Translated using Weblate (French) Currently translated at 97.7% (973 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 99f4345ce4..f56db9abeb 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,14 +8,14 @@ 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: 2023-04-18 13:22+0000\n" -"Last-Translator: Jeff Epler \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \n" "Language: fr\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.17\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1491,7 +1491,7 @@ msgstr "Nimble n'a plus de mémoire" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "Pas de broche %q" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From 7958712a30974f2e044a0cb27930886cc779fba3 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:22:17 +0000 Subject: [PATCH 1084/1712] Translated using Weblate (Italian) Currently translated at 33.2% (331 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/it/ --- locale/it_IT.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/it_IT.po b/locale/it_IT.po index 0e37e651de..618f7da559 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -7,15 +7,15 @@ 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-03-16 14:54+0000\n" -"Last-Translator: Alessandro Mandelli \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \n" "Language-Team: \n" "Language: it_IT\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.5.2-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1447,7 +1447,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "Nessun pin %q" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From 40e309326debee68eec7ebf9ca9eb7dc5138c90f Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:23:06 +0000 Subject: [PATCH 1085/1712] Translated using Weblate (Polish) Currently translated at 46.0% (458 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pl/ --- locale/pl.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/pl.po b/locale/pl.po index 26b0cb12b6..6e0134e62c 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -7,8 +7,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2022-02-09 18:11+0000\n" -"Last-Translator: Maciej Stankiewicz \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \n" "Language-Team: pl\n" "Language: pl\n" "MIME-Version: 1.0\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 4.11-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1440,7 +1440,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "Brak nóżki %q" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From c80664698a5d0c75d7d001c42d893a214613d2a1 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:20:05 +0000 Subject: [PATCH 1086/1712] Translated using Weblate (Czech) Currently translated at 23.4% (233 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/cs/ --- locale/cs.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/cs.po b/locale/cs.po index 0098691211..a3bee5475c 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -6,15 +6,15 @@ 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: 2022-06-11 10:17+0000\n" -"Last-Translator: Matěj Soukup \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \n" "Language-Team: LANGUAGE \n" "Language: cs\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" -"X-Generator: Weblate 4.13-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1444,7 +1444,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "Žádný %q pin" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From 54f7d8a4badaf3ad713f85817cd8a16e06fbc9df Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:19:41 +0000 Subject: [PATCH 1087/1712] Translated using Weblate (Dutch) Currently translated at 62.7% (624 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/nl/ --- locale/nl.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/nl.po b/locale/nl.po index 71700109e3..1acf9d4d6e 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -6,15 +6,15 @@ 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-08-23 14:19+0000\n" -"Last-Translator: Jeff Epler \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \n" "Language-Team: none\n" "Language: nl\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.8.1-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1440,7 +1440,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "Geen %q pin" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From 240cdd0be8c2c0b00ce37be9cda1396b1becbbea Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:19:13 +0000 Subject: [PATCH 1088/1712] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (995 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 3d4f53689f..1586a6ec2f 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,15 +7,15 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-04-09 17:51+0000\n" -"Last-Translator: hexthat \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.17-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1467,7 +1467,7 @@ msgstr "líng huó de bǎi tuō jì yì" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "Wèi zhǎodào %q yǐn jiǎo" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From 3c84847e698735bfaa1afd064ae62ef00ce85cd2 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:22:42 +0000 Subject: [PATCH 1089/1712] Translated using Weblate (Japanese) Currently translated at 40.8% (406 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ja/ --- locale/ja.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/ja.po b/locale/ja.po index da4f814724..ce8efe97c9 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -8,8 +8,8 @@ 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: 2023-04-29 17:47+0000\n" -"Last-Translator: Yutaro Urata \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \n" "Language-Team: none\n" "Language: ja\n" "MIME-Version: 1.0\n" @@ -1445,7 +1445,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "%qピンがありません" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From aaa14e7c1f966d3e68e22488faee017a2ac12515 Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Fri, 19 May 2023 23:54:20 +0000 Subject: [PATCH 1090/1712] Translated using Weblate (Greek) Currently translated at 18.0% (180 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/el/ --- locale/el.po | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/locale/el.po b/locale/el.po index 0a327daae9..0b08a441cb 100644 --- a/locale/el.po +++ b/locale/el.po @@ -8,7 +8,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: 2022-10-05 12:23+0000\n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" "Last-Translator: Bill Sideris \n" "Language-Team: none\n" "Language: el\n" @@ -16,7 +16,7 @@ msgstr "" "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.14.1\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -41,18 +41,25 @@ msgid "" "Please file an issue with your program at https://github.com/adafruit/" "circuitpython/issues." msgstr "" +"\n" +"Παρακαλώ δημιουργήστε ένα πρόβλημα στο https://github.com/adafruit/" +"circuitpython/issues με το πρόγραμμά σας." #: supervisor/shared/safe_mode.c msgid "" "\n" "Press reset to exit safe mode.\n" msgstr "" +"\n" +"Πατήστε reset για να βγείτε από την ασφαλή λειτουργία.\n" #: supervisor/shared/safe_mode.c msgid "" "\n" "You are in safe mode because:\n" msgstr "" +"\n" +"Είσαστε τε ασφαλή λειτουργία διότι:\n" #: py/obj.c msgid " File \"%q\"" @@ -77,12 +84,12 @@ msgstr " έξοδος:\n" #: py/objstr.c #, c-format msgid "%%c requires int or char" -msgstr "%%c απαιτεί int ή char" +msgstr "%%c απαιτεί ακέραιο ή χαρακτήρα" #: main.c #, c-format msgid "%02X" -msgstr "" +msgstr "%02X" #: shared-module/os/getenv.c #, c-format @@ -130,7 +137,7 @@ msgstr "%q αποτυχία: %d" #: py/argcheck.c msgid "%q in %q must be of type %q, not %q" -msgstr "" +msgstr "%q στο %q πρέπει να είναι τύπου %q, όχι %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c @@ -151,11 +158,11 @@ msgstr "%q εκκίνηση απέτυχε" #: ports/espressif/bindings/espnow/Peer.c shared-bindings/dualbank/__init__.c msgid "%q is %q" -msgstr "" +msgstr "%q είναι %q" #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "%q is read-only for this board" -msgstr "" +msgstr "%q είναι μόνο για ανάγνωση για αυτήν την πλακέτα" #: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" @@ -199,7 +206,7 @@ msgstr "%q πρέπει να είναι >= %d" #: shared-bindings/analogbufio/BufferedIn.c msgid "%q must be a bytearray or array of type 'H' or 'B'" -msgstr "" +msgstr "%q πρέπει να είναι bytearray ή array τύπου 'H' ή 'B'" #: shared-bindings/audiocore/RawSample.c msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" @@ -207,17 +214,17 @@ msgstr "%q πρέπει να είναι bytearray ή array τύπου 'h', 'H', #: ports/espressif/common-hal/analogbufio/BufferedIn.c msgid "%q must be array of type 'H'" -msgstr "" +msgstr "%q πρέπει να είναι πίνακας τύπου 'H'" #: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" -msgstr "" +msgstr "%q πρέπει να είναι λίστα τύπου 'h'" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c #: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" -msgstr "" +msgstr "%q πρέπει να είναι τύπου %q ή %q, όχι %q" #: py/argcheck.c py/obj.c py/objstrunicode.c msgid "%q must be of type %q, not %q" From 446546f8292c6bff27537d310aba069ae2c84a4c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:20:26 +0000 Subject: [PATCH 1091/1712] Translated using Weblate (English (United Kingdom)) Currently translated at 100.0% (995 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/en_GB/ --- locale/en_GB.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/en_GB.po b/locale/en_GB.po index ed9f289595..eb26c58d6c 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-04-22 06:48+0000\n" -"Last-Translator: Andi Chandler \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \n" "Language-Team: none\n" "Language: en_GB\n" "MIME-Version: 1.0\n" @@ -1453,7 +1453,7 @@ msgstr "Nimble out of memory" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "No %q pin" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From aeb41044aa8624f780b0bc07ea0234e594d5a341 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:23:30 +0000 Subject: [PATCH 1092/1712] Translated using Weblate (Russian) Currently translated at 33.6% (335 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ru/ --- locale/ru.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/ru.po b/locale/ru.po index a77de6e17a..384ae2e662 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -7,16 +7,16 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2022-12-27 17:42+0000\n" -"Last-Translator: Clay \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \n" "Language-Team: none\n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 4.15.1-dev\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1480,7 +1480,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "Нет пина %q" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From 13eada2a15c13c06ff613988401c9b33df958b92 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 19 May 2023 16:23:51 +0000 Subject: [PATCH 1093/1712] Translated using Weblate (Turkish) Currently translated at 24.9% (248 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/tr/ --- locale/tr.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/tr.po b/locale/tr.po index 1cfbc19ac9..0958a8ff01 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -7,15 +7,15 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2022-12-05 21:48+0000\n" -"Last-Translator: Boran Roni \n" +"PO-Revision-Date: 2023-05-21 00:49+0000\n" +"Last-Translator: Scott Shawcroft \n" "Language-Team: none\n" "Language: tr\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.15-dev\n" +"X-Generator: Weblate 4.18-dev\n" #: main.c msgid "" @@ -1451,7 +1451,7 @@ msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c msgid "No %q pin" -msgstr "" +msgstr "%q pini yok" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c From 437d8d7a3872e37d81a2e5caed9ccd4f77244dd1 Mon Sep 17 00:00:00 2001 From: David Sullivan <311316+tkroo@users.noreply.github.com> Date: Sat, 20 May 2023 18:17:10 -0700 Subject: [PATCH 1094/1712] Board files for LOLIN S3 MINI --- ports/espressif/boards/lolin_s3_mini/board.c | 31 +++++ .../boards/lolin_s3_mini/mpconfigboard.h | 44 ++++++ .../boards/lolin_s3_mini/mpconfigboard.mk | 16 +++ ports/espressif/boards/lolin_s3_mini/pins.c | 129 ++++++++++++++++++ .../espressif/boards/lolin_s3_mini/sdkconfig | 48 +++++++ 5 files changed, 268 insertions(+) create mode 100644 ports/espressif/boards/lolin_s3_mini/board.c create mode 100644 ports/espressif/boards/lolin_s3_mini/mpconfigboard.h create mode 100644 ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk create mode 100644 ports/espressif/boards/lolin_s3_mini/pins.c create mode 100644 ports/espressif/boards/lolin_s3_mini/sdkconfig diff --git a/ports/espressif/boards/lolin_s3_mini/board.c b/ports/espressif/boards/lolin_s3_mini/board.c new file mode 100644 index 0000000000..ac27ce4970 --- /dev/null +++ b/ports/espressif/boards/lolin_s3_mini/board.c @@ -0,0 +1,31 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.h b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.h new file mode 100644 index 0000000000..099cde306e --- /dev/null +++ b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.h @@ -0,0 +1,44 @@ +/* + * 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 "LOLIN S3 MINI 4MB Flash 2MB PSRAM" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO47) + +// #define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO36) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO35) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO12) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO13) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk new file mode 100644 index 0000000000..aae8f9dabb --- /dev/null +++ b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk @@ -0,0 +1,16 @@ +USB_VID = 0x303a +USB_PID = 0x8168 +USB_PRODUCT = "LOLIN S3 MINI 4MB Flash 2MB PSRAM" +USB_MANUFACTURER = "WEMOS" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB + +OPTIMIZATION_FLAGS = -Os +CIRCUITPY_ESPCAMERA = 0 + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel \ No newline at end of file diff --git a/ports/espressif/boards/lolin_s3_mini/pins.c b/ports/espressif/boards/lolin_s3_mini/pins.c new file mode 100644 index 0000000000..76a0f7eea6 --- /dev/null +++ b/ports/espressif/boards/lolin_s3_mini/pins.c @@ -0,0 +1,129 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + + + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A13), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A14), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_A16), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_A17), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_D47), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO47) }, + + + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + { 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_UART), MP_ROM_PTR(&board_uart_obj) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/lolin_s3_mini/sdkconfig b/ports/espressif/boards/lolin_s3_mini/sdkconfig new file mode 100644 index 0000000000..d7d73360d8 --- /dev/null +++ b/ports/espressif/boards/lolin_s3_mini/sdkconfig @@ -0,0 +1,48 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +# CONFIG_SPIRAM_SPEED_40M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_MODE_OCT=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="LOLIN-S3-MINI" +# end of LWIP + +# end of Component config From a4a4bdfeb08a86754b261896bd223f2290899a65 Mon Sep 17 00:00:00 2001 From: rcarteraz Date: Sat, 20 May 2023 18:33:37 -0700 Subject: [PATCH 1095/1712] Update board.c Change column start from 52 to 53 to fix a line at the top of the display. --- ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c index 3d00f460ee..4c4c659913 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c @@ -99,7 +99,7 @@ static void display_init(void) { bus, 240, // width (after rotation) 135, // height (after rotation) - 52, // column start + 53, // column start 40, // row start 90, // rotation 16, // color depth From e684d19c7634de50459c36f131500ff2895e9d20 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 20 May 2023 23:42:30 -0400 Subject: [PATCH 1096/1712] apt-get update before apt-get install for mpy-cross --- .github/workflows/build-mpy-cross.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-mpy-cross.yml b/.github/workflows/build-mpy-cross.yml index 10c4498bc8..f60ef6cb3d 100644 --- a/.github/workflows/build-mpy-cross.yml +++ b/.github/workflows/build-mpy-cross.yml @@ -43,10 +43,14 @@ jobs: - name: Install toolchain (aarch64) if: matrix.mpy-cross == 'static-aarch64' - run: sudo apt-get install -y gcc-aarch64-linux-gnu + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu - name: Install toolchain (mingw) if: matrix.mpy-cross == 'static-mingw' - run: sudo apt-get install -y mingw-w64 + run: | + sudo apt-get update + sudo apt-get install -y mingw-w64 - name: Build mpy-cross.${{ matrix.mpy-cross }} run: make -C mpy-cross -j2 -f Makefile.${{ matrix.mpy-cross }} From e259f8d1ba270d38589e58495607afa01632ff2b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 19 May 2023 19:35:56 -0500 Subject: [PATCH 1097/1712] synthio: Move some divide-by-twos to get_buffer these are always h-type buffers, so let's make the "len" be the element count, not the byte count. --- shared-module/synthio/LFO.c | 2 +- shared-module/synthio/__init__.c | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/shared-module/synthio/LFO.c b/shared-module/synthio/LFO.c index b4fe2dc7ac..d93ae04955 100644 --- a/shared-module/synthio/LFO.c +++ b/shared-module/synthio/LFO.c @@ -37,7 +37,6 @@ mp_float_t common_hal_synthio_lfo_tick(mp_obj_t self_in) { mp_float_t rate = synthio_block_slot_get(&lfo->rate) * synthio_global_rate_scale; mp_float_t accum = lfo->accum + rate; - int len = lfo->waveform_bufinfo.len / 2; mp_float_t frac = accum - MICROPY_FLOAT_C_FUN(floor)(accum); size_t idx = (int)(frac * len); @@ -53,6 +52,7 @@ mp_float_t common_hal_synthio_lfo_tick(mp_obj_t self_in) { } } + int len = lfo->waveform_bufinfo.len; lfo->accum = frac; int16_t *waveform = lfo->waveform_bufinfo.buf; diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 8050eb276e..fa70ee35fd 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -192,7 +192,7 @@ static void synth_note_into_buffer(synthio_synth_t *synth, int chan, int32_t *ou uint32_t dds_rate; const int16_t *waveform = synth->waveform_bufinfo.buf; - uint32_t waveform_length = synth->waveform_bufinfo.len / sizeof(int16_t); + uint32_t waveform_length = synth->waveform_bufinfo.len; uint32_t ring_dds_rate = 0; const int16_t *ring_waveform = NULL; @@ -213,12 +213,12 @@ static void synth_note_into_buffer(synthio_synth_t *synth, int chan, int32_t *ou int32_t frequency_scaled = synthio_note_step(note, sample_rate, dur, loudness); if (note->waveform_buf.buf) { waveform = note->waveform_buf.buf; - waveform_length = note->waveform_buf.len / sizeof(int16_t); + waveform_length = note->waveform_buf.len; } dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)frequency_scaled * waveform_length, sample_rate); if (note->ring_frequency_scaled != 0 && note->ring_waveform_buf.buf) { ring_waveform = note->ring_waveform_buf.buf; - ring_waveform_length = note->ring_waveform_buf.len / sizeof(int16_t); + ring_waveform_length = note->ring_waveform_buf.len; ring_dds_rate = synthio_frequency_convert_scaled_to_dds((uint64_t)note->ring_frequency_bent * ring_waveform_length, sample_rate); uint32_t lim = ring_waveform_length << SYNTHIO_FREQUENCY_SHIFT; if (ring_dds_rate > lim / sizeof(int16_t)) { @@ -311,7 +311,7 @@ static void synth_note_into_buffer(synthio_synth_t *synth, int chan, int32_t *ou STATIC void run_fir(synthio_synth_t *synth, int32_t *out_buffer32, uint16_t dur) { int16_t *coeff = (int16_t *)synth->filter_bufinfo.buf; - size_t fir_len = synth->filter_bufinfo.len / sizeof(int16_t); + size_t fir_len = synth->filter_bufinfo.len; int32_t *in_buf = synth->filter_buffer; @@ -362,7 +362,7 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t int32_t out_buffer32[dur * synth->channel_count]; if (synth->filter_buffer) { - int32_t *filter_start = &synth->filter_buffer[synth->filter_bufinfo.len * synth->channel_count / sizeof(int16_t)]; + int32_t *filter_start = &synth->filter_buffer[synth->filter_bufinfo.len * synth->channel_count]; memset(filter_start, 0, dur * synth->channel_count * sizeof(int32_t)); for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { @@ -441,7 +441,7 @@ void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channe synth->buffers[0] = m_malloc(synth->buffer_length, false); synth->buffers[1] = m_malloc(synth->buffer_length, false); if (synth->filter_bufinfo.len) { - synth->filter_buffer_length = (synth->filter_bufinfo.len / 2 + SYNTHIO_MAX_DUR) * channel_count * sizeof(int32_t); + synth->filter_buffer_length = (synth->filter_bufinfo.len + SYNTHIO_MAX_DUR) * channel_count * sizeof(int32_t); synth->filter_buffer = m_malloc(synth->filter_buffer_length, false); } synth->channel_count = channel_count; @@ -473,12 +473,13 @@ STATIC void parse_common(mp_buffer_info_t *bufinfo, mp_obj_t o, int16_t what, mp if (bufinfo->typecode != 'h') { mp_raise_ValueError_varg(translate("%q must be array of type 'h'"), what); } - mp_arg_validate_length_range(bufinfo->len / sizeof(int16_t), 2, max_len, what); + bufinfo->len /= 2; + mp_arg_validate_length_range(bufinfo->len, 2, max_len, what); } } void synthio_synth_parse_waveform(mp_buffer_info_t *bufinfo_waveform, mp_obj_t waveform_obj) { - *bufinfo_waveform = ((mp_buffer_info_t) { .buf = (void *)square_wave, .len = 4 }); + *bufinfo_waveform = ((mp_buffer_info_t) { .buf = (void *)square_wave, .len = 2 }); parse_common(bufinfo_waveform, waveform_obj, MP_QSTR_waveform, 16384); } From e0cfae1d0576ecab3f60aed21ec041da4b87ee59 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 20 May 2023 19:43:15 -0500 Subject: [PATCH 1098/1712] synthio: add (untested) phase offset --- shared-bindings/synthio/LFO.c | 25 ++++++++++++++++++++++++- shared-bindings/synthio/LFO.h | 3 +++ shared-module/synthio/LFO.c | 27 +++++++++++++++++---------- shared-module/synthio/LFO.h | 2 +- 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/shared-bindings/synthio/LFO.c b/shared-bindings/synthio/LFO.c index 731561d9b2..77ba2260cf 100644 --- a/shared-bindings/synthio/LFO.c +++ b/shared-bindings/synthio/LFO.c @@ -63,6 +63,7 @@ //| rate: BlockInput = 1.0, //| scale: BlockInput = 1.0, //| offset: BlockInput = 0, +//| phase_offset: BlockInput = 0, //| once=False //| ): //| pass @@ -71,6 +72,7 @@ static const mp_arg_t lfo_properties[] = { { MP_QSTR_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, { MP_QSTR_scale, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, { MP_QSTR_offset, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } }, + { MP_QSTR_phase_offset, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } }, { MP_QSTR_once, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } }, }; @@ -141,6 +143,24 @@ MP_PROPERTY_GETSET(synthio_lfo_offset_obj, (mp_obj_t)&synthio_lfo_get_offset_obj, (mp_obj_t)&synthio_lfo_set_offset_obj); +//| phase_offset: BlockInput +//| """An additive value applied to the LFO's phase""" +STATIC mp_obj_t synthio_lfo_get_phase_offset(mp_obj_t self_in) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + return common_hal_synthio_lfo_get_phase_offset_obj(self); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_lfo_get_phase_offset_obj, synthio_lfo_get_phase_offset); + +STATIC mp_obj_t synthio_lfo_set_phase_offset(mp_obj_t self_in, mp_obj_t arg) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_lfo_set_phase_offset_obj(self, arg); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_lfo_set_phase_offset_obj, synthio_lfo_set_phase_offset); +MP_PROPERTY_GETSET(synthio_lfo_phase_offset_obj, + (mp_obj_t)&synthio_lfo_get_phase_offset_obj, + (mp_obj_t)&synthio_lfo_set_phase_offset_obj); + //| scale: BlockInput //| """An additive value applied to the LFO's output""" STATIC mp_obj_t synthio_lfo_get_scale(mp_obj_t self_in) { @@ -161,7 +181,9 @@ MP_PROPERTY_GETSET(synthio_lfo_scale_obj, //| //| once: bool -//| """True if the waveform should stop when it reaches its last output value, false if it should re-start at the beginning of its waveform""" +//| """True if the waveform should stop when it reaches its last output value, false if it should re-start at the beginning of its waveform +//| +//| This applies to the ``phase`` *before* the addition of any ``phase_offset`` """ STATIC mp_obj_t synthio_lfo_get_once(mp_obj_t self_in) { synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); return mp_obj_new_bool(common_hal_synthio_lfo_get_once(self)); @@ -226,6 +248,7 @@ STATIC const mp_rom_map_elem_t synthio_lfo_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_rate), MP_ROM_PTR(&synthio_lfo_rate_obj) }, { MP_ROM_QSTR(MP_QSTR_scale), MP_ROM_PTR(&synthio_lfo_scale_obj) }, { MP_ROM_QSTR(MP_QSTR_offset), MP_ROM_PTR(&synthio_lfo_offset_obj) }, + { MP_ROM_QSTR(MP_QSTR_phase_offset), MP_ROM_PTR(&synthio_lfo_phase_offset_obj) }, { MP_ROM_QSTR(MP_QSTR_once), MP_ROM_PTR(&synthio_lfo_once_obj) }, { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&synthio_lfo_value_obj) }, { MP_ROM_QSTR(MP_QSTR_phase), MP_ROM_PTR(&synthio_lfo_phase_obj) }, diff --git a/shared-bindings/synthio/LFO.h b/shared-bindings/synthio/LFO.h index f7deabbd4a..7c045e4f84 100644 --- a/shared-bindings/synthio/LFO.h +++ b/shared-bindings/synthio/LFO.h @@ -40,6 +40,9 @@ void common_hal_synthio_lfo_set_rate_obj(synthio_lfo_obj_t *self, mp_obj_t arg); mp_obj_t common_hal_synthio_lfo_get_scale_obj(synthio_lfo_obj_t *self); void common_hal_synthio_lfo_set_scale_obj(synthio_lfo_obj_t *self, mp_obj_t arg); +mp_obj_t common_hal_synthio_lfo_get_phase_offset_obj(synthio_lfo_obj_t *self); +void common_hal_synthio_lfo_set_phase_offset_obj(synthio_lfo_obj_t *self, mp_obj_t arg); + mp_obj_t common_hal_synthio_lfo_get_offset_obj(synthio_lfo_obj_t *self); void common_hal_synthio_lfo_set_offset_obj(synthio_lfo_obj_t *self, mp_obj_t arg); diff --git a/shared-module/synthio/LFO.c b/shared-module/synthio/LFO.c index d93ae04955..cb06477e7f 100644 --- a/shared-module/synthio/LFO.c +++ b/shared-module/synthio/LFO.c @@ -35,32 +35,32 @@ mp_float_t common_hal_synthio_lfo_tick(mp_obj_t self_in) { synthio_lfo_obj_t *lfo = MP_OBJ_TO_PTR(self_in); mp_float_t rate = synthio_block_slot_get(&lfo->rate) * synthio_global_rate_scale; + mp_float_t phase_offset = synthio_block_slot_get(&lfo->phase_offset); - mp_float_t accum = lfo->accum + rate; - mp_float_t frac = accum - MICROPY_FLOAT_C_FUN(floor)(accum); - size_t idx = (int)(frac * len); + mp_float_t accum = lfo->accum + rate + phase_offset; if (lfo->once) { if (rate > 0) { if (accum >= ONE) { - frac = ONE; - idx = len - 1; + accum = ONE; } } else if (rate < 0 && accum < ZERO) { - frac = ZERO; - idx = 0; + accum = ZERO; } + } else { + accum = accum - MICROPY_FLOAT_C_FUN(floor)(accum); } int len = lfo->waveform_bufinfo.len; - lfo->accum = frac; + size_t idx = (int)(accum * len); // rounds down towards zero + assert(idx < lfo->waveform_bufinfo.len); - int16_t *waveform = lfo->waveform_bufinfo.buf; - assert(idx < lfo->waveform_bufinfo.len / 2); mp_float_t scale = synthio_block_slot_get(&lfo->scale); mp_float_t offset = synthio_block_slot_get(&lfo->offset); + int16_t *waveform = lfo->waveform_bufinfo.buf; mp_float_t value = MICROPY_FLOAT_C_FUN(ldexp)(waveform[idx], -15) * scale + offset; + lfo->accum = accum - phase_offset; return value; } @@ -83,6 +83,13 @@ void common_hal_synthio_lfo_set_scale_obj(synthio_lfo_obj_t *self, mp_obj_t arg) synthio_block_assign_slot(arg, &self->scale, MP_QSTR_scale); } +mp_obj_t common_hal_synthio_lfo_get_phase_offset_obj(synthio_lfo_obj_t *self) { + return self->phase_offset.obj; +} +void common_hal_synthio_lfo_set_phase_offset_obj(synthio_lfo_obj_t *self, mp_obj_t arg) { + synthio_block_assign_slot(arg, &self->phase_offset, MP_QSTR_phase_offset); +} + mp_obj_t common_hal_synthio_lfo_get_offset_obj(synthio_lfo_obj_t *self) { return self->offset.obj; } diff --git a/shared-module/synthio/LFO.h b/shared-module/synthio/LFO.h index 4e97477ddd..4d9eed33da 100644 --- a/shared-module/synthio/LFO.h +++ b/shared-module/synthio/LFO.h @@ -32,7 +32,7 @@ typedef struct synthio_lfo_obj { synthio_block_base_t base; bool once; - synthio_block_slot_t rate, scale, offset; + synthio_block_slot_t rate, scale, offset, phase_offset; mp_float_t accum; mp_obj_t waveform_obj; From e6c4d12eafddec66683061a7de039277c9bf4de4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 21 May 2023 12:45:43 -0500 Subject: [PATCH 1099/1712] synthio: doc improvement --- shared-bindings/synthio/Synthesizer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index 8fb0d57386..183284f015 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -275,7 +275,7 @@ MP_PROPERTY_GETTER(synthio_synthesizer_pressed_obj, //| //| This can be used to implement 'free-running' LFOs. LFOs associated with playing notes are advanced whether or not they are in this list. //| -//| This attribute is read-only but its contents may be modified by e.g., calling append() or remove(). It is initially an empty list.""" +//| This property is read-only but its contents may be modified by e.g., calling ``synth.lfos.append()` or ``synth.lfos.remove(). It is initially an empty list.""" //| STATIC mp_obj_t synthio_synthesizer_obj_get_lfos(mp_obj_t self_in) { synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); From 4ff08e02ebedc8872c0b56df5fbc96a8afe9e185 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 21 May 2023 12:48:08 -0500 Subject: [PATCH 1100/1712] synthio: lfo: bugfixes & improvements LFO waveforms are now linearly interpolated by default, but a new property (interpolated=False) can disable this. The 'once' logic was improved --- shared-bindings/synthio/LFO.c | 25 +++++++++++++++++++++++- shared-bindings/synthio/LFO.h | 3 +++ shared-module/synthio/LFO.c | 36 +++++++++++++++++++++++++++++------ shared-module/synthio/LFO.h | 2 +- 4 files changed, 58 insertions(+), 8 deletions(-) diff --git a/shared-bindings/synthio/LFO.c b/shared-bindings/synthio/LFO.c index 77ba2260cf..79e05d83ce 100644 --- a/shared-bindings/synthio/LFO.c +++ b/shared-bindings/synthio/LFO.c @@ -64,7 +64,8 @@ //| scale: BlockInput = 1.0, //| offset: BlockInput = 0, //| phase_offset: BlockInput = 0, -//| once=False +//| once=False, +//| interpolate=True //| ): //| pass static const mp_arg_t lfo_properties[] = { @@ -74,6 +75,7 @@ static const mp_arg_t lfo_properties[] = { { MP_QSTR_offset, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } }, { MP_QSTR_phase_offset, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } }, { MP_QSTR_once, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } }, + { MP_QSTR_interpolate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, }; STATIC mp_obj_t synthio_lfo_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { @@ -201,6 +203,26 @@ MP_PROPERTY_GETSET(synthio_lfo_once_obj, (mp_obj_t)&synthio_lfo_set_once_obj); +//| +//| interpolate: bool +//| """True if the waveform should perform linear interpolation between values""" +STATIC mp_obj_t synthio_lfo_get_interpolate(mp_obj_t self_in) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + return mp_obj_new_bool(common_hal_synthio_lfo_get_interpolate(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(synthio_lfo_get_interpolate_obj, synthio_lfo_get_interpolate); + +STATIC mp_obj_t synthio_lfo_set_interpolate(mp_obj_t self_in, mp_obj_t arg) { + synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); + common_hal_synthio_lfo_set_interpolate(self, mp_obj_is_true(arg)); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_lfo_set_interpolate_obj, synthio_lfo_set_interpolate); +MP_PROPERTY_GETSET(synthio_lfo_interpolate_obj, + (mp_obj_t)&synthio_lfo_get_interpolate_obj, + (mp_obj_t)&synthio_lfo_set_interpolate_obj); + + //| //| phase: float //| """The phase of the oscillator, in the range 0 to 1 (read-only)""" @@ -250,6 +272,7 @@ STATIC const mp_rom_map_elem_t synthio_lfo_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_offset), MP_ROM_PTR(&synthio_lfo_offset_obj) }, { MP_ROM_QSTR(MP_QSTR_phase_offset), MP_ROM_PTR(&synthio_lfo_phase_offset_obj) }, { MP_ROM_QSTR(MP_QSTR_once), MP_ROM_PTR(&synthio_lfo_once_obj) }, + { MP_ROM_QSTR(MP_QSTR_interpolate), MP_ROM_PTR(&synthio_lfo_interpolate_obj) }, { MP_ROM_QSTR(MP_QSTR_value), MP_ROM_PTR(&synthio_lfo_value_obj) }, { MP_ROM_QSTR(MP_QSTR_phase), MP_ROM_PTR(&synthio_lfo_phase_obj) }, { MP_ROM_QSTR(MP_QSTR_retrigger), MP_ROM_PTR(&synthio_lfo_retrigger_obj) }, diff --git a/shared-bindings/synthio/LFO.h b/shared-bindings/synthio/LFO.h index 7c045e4f84..8bcea7c328 100644 --- a/shared-bindings/synthio/LFO.h +++ b/shared-bindings/synthio/LFO.h @@ -49,6 +49,9 @@ void common_hal_synthio_lfo_set_offset_obj(synthio_lfo_obj_t *self, mp_obj_t arg bool common_hal_synthio_lfo_get_once(synthio_lfo_obj_t *self); void common_hal_synthio_lfo_set_once(synthio_lfo_obj_t *self, bool arg); +bool common_hal_synthio_lfo_get_interpolate(synthio_lfo_obj_t *self); +void common_hal_synthio_lfo_set_interpolate(synthio_lfo_obj_t *self, bool arg); + mp_float_t common_hal_synthio_lfo_get_value(synthio_lfo_obj_t *self); mp_float_t common_hal_synthio_lfo_get_phase(synthio_lfo_obj_t *self); diff --git a/shared-module/synthio/LFO.c b/shared-module/synthio/LFO.c index cb06477e7f..f0ffecfc9e 100644 --- a/shared-module/synthio/LFO.c +++ b/shared-module/synthio/LFO.c @@ -31,6 +31,8 @@ #define ONE (MICROPY_FLOAT_CONST(1.)) #define ZERO (MICROPY_FLOAT_CONST(0.)) +#define ALMOST_ONE (MICROPY_FLOAT_CONST(32767.) / 32768) + mp_float_t common_hal_synthio_lfo_tick(mp_obj_t self_in) { synthio_lfo_obj_t *lfo = MP_OBJ_TO_PTR(self_in); @@ -41,8 +43,8 @@ mp_float_t common_hal_synthio_lfo_tick(mp_obj_t self_in) { if (lfo->once) { if (rate > 0) { - if (accum >= ONE) { - accum = ONE; + if (accum > ALMOST_ONE) { + accum = ALMOST_ONE; } } else if (rate < 0 && accum < ZERO) { accum = ZERO; @@ -50,17 +52,32 @@ mp_float_t common_hal_synthio_lfo_tick(mp_obj_t self_in) { } else { accum = accum - MICROPY_FLOAT_C_FUN(floor)(accum); } + lfo->accum = accum - phase_offset; int len = lfo->waveform_bufinfo.len; - size_t idx = (int)(accum * len); // rounds down towards zero + + mp_float_t scaled_accum = accum * (len - lfo->once); + size_t idx = (size_t)MICROPY_FLOAT_C_FUN(floor)(scaled_accum); assert(idx < lfo->waveform_bufinfo.len); + int16_t *waveform = lfo->waveform_bufinfo.buf; + mp_float_t value = waveform[idx]; + + if (lfo->interpolate) { + + mp_float_t frac = scaled_accum - idx; + + size_t idxp1 = idx + 1; + if (idxp1 == lfo->waveform_bufinfo.len) { + idxp1 = lfo->once ? idx : 0; + } + value = value * (1 - frac) + waveform[idxp1] * frac; + } + mp_float_t scale = synthio_block_slot_get(&lfo->scale); mp_float_t offset = synthio_block_slot_get(&lfo->offset); - int16_t *waveform = lfo->waveform_bufinfo.buf; - mp_float_t value = MICROPY_FLOAT_C_FUN(ldexp)(waveform[idx], -15) * scale + offset; + value = MICROPY_FLOAT_C_FUN(ldexp)(value, -15) * scale + offset; - lfo->accum = accum - phase_offset; return value; } @@ -104,6 +121,13 @@ void common_hal_synthio_lfo_set_once(synthio_lfo_obj_t *self, bool arg) { self->once = arg; } +bool common_hal_synthio_lfo_get_interpolate(synthio_lfo_obj_t *self) { + return self->interpolate; +} +void common_hal_synthio_lfo_set_interpolate(synthio_lfo_obj_t *self, bool arg) { + self->interpolate = arg; +} + mp_float_t common_hal_synthio_lfo_get_value(synthio_lfo_obj_t *self) { return self->base.value; } diff --git a/shared-module/synthio/LFO.h b/shared-module/synthio/LFO.h index 4d9eed33da..0b08bb18dd 100644 --- a/shared-module/synthio/LFO.h +++ b/shared-module/synthio/LFO.h @@ -30,7 +30,7 @@ typedef struct synthio_lfo_obj { synthio_block_base_t base; - bool once; + bool once, interpolate; synthio_block_slot_t rate, scale, offset, phase_offset; mp_float_t accum; From 76101c035e26fc9c6c05b1a195ea29ca89fe856b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 21 May 2023 12:48:52 -0500 Subject: [PATCH 1101/1712] core: Allow `enum` types to specify additional fields in the object this will be used to make MathOperation enum values callable to construct a Math object with that function --- py/enum.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/py/enum.h b/py/enum.h index 63191047e0..b83257e00f 100644 --- a/py/enum.h +++ b/py/enum.h @@ -50,12 +50,13 @@ typedef struct { cp_enum_obj_print_helper(MP_QSTR_##module, print, self_in, kind); \ } -#define MAKE_ENUM_TYPE(module, type, typename) \ +#define MAKE_ENUM_TYPE(module, type, typename, ...) \ const mp_obj_type_t typename##_type = { \ { &mp_type_type }, \ .name = MP_QSTR_##type, \ .print = typename##_print, \ .locals_dict = (mp_obj_dict_t *)&typename##_locals_dict, \ + ##__VA_ARGS__ \ } From c084ab92c88c37f2ed5f127a6099bc983635fdf3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 21 May 2023 12:49:19 -0500 Subject: [PATCH 1102/1712] synthio: Enable `synthio.MathOperation.SUM(3,4,5)` --- shared-bindings/synthio/Math.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/shared-bindings/synthio/Math.c b/shared-bindings/synthio/Math.c index 1f0db572b1..22efbc0489 100644 --- a/shared-bindings/synthio/Math.c +++ b/shared-bindings/synthio/Math.c @@ -33,6 +33,9 @@ #include "shared-bindings/synthio/Math.h" #include "shared-module/synthio/Math.h" +static const mp_arg_t math_properties[4]; +STATIC mp_obj_t synthio_math_make_new_common(mp_arg_val_t args[MP_ARRAY_SIZE(math_properties)]); + MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, SUM, OP_SUM); MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, ADD_SUB, OP_ADD_SUB); MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, PRODUCT, OP_PRODUCT); @@ -110,9 +113,21 @@ MAKE_ENUM_MAP(synthio_math_operation) { MAKE_ENUM_MAP_ENTRY(math_op, ABS), }; + +STATIC mp_obj_t mathop_call(mp_obj_t fun, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + mp_arg_val_t args[4]; + args[0].u_obj = fun; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(math_properties) - 1, math_properties + 1, &args[1]); + return synthio_math_make_new_common(args); +} + STATIC MP_DEFINE_CONST_DICT(synthio_math_operation_locals_dict, synthio_math_operation_locals_table); MAKE_PRINTER(synthio, synthio_math_operation); -MAKE_ENUM_TYPE(synthio, MathOperation, synthio_math_operation); +MAKE_ENUM_TYPE(synthio, MathOperation, synthio_math_operation, + .flags = MP_TYPE_FLAG_EXTENDED, + MP_TYPE_EXTENDED_FIELDS( + .call = mathop_call, + )); //| class Math: //| """An arithmetic block @@ -151,6 +166,10 @@ STATIC mp_obj_t synthio_math_make_new(const mp_obj_type_t *type_in, size_t n_arg mp_arg_val_t args[MP_ARRAY_SIZE(math_properties)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(math_properties), math_properties, args); + return synthio_math_make_new_common(args); +} + +STATIC mp_obj_t synthio_math_make_new_common(mp_arg_val_t args[MP_ARRAY_SIZE(math_properties)]) { synthio_math_obj_t *self = m_new_obj(synthio_math_obj_t); self->base.base.type = &synthio_math_type; From 11c110e0daff4551df58e7c369000015a065b7c5 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 21 May 2023 12:51:55 -0500 Subject: [PATCH 1103/1712] synthio: remove 'none' case from lfo_tick --- shared-module/synthio/__init__.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index fa70ee35fd..bc81beadb3 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -550,11 +550,7 @@ void shared_bindings_synthio_lfo_tick(uint32_t sample_rate) { } mp_float_t synthio_block_slot_get(synthio_block_slot_t *slot) { - if (slot->obj == mp_const_none) { - return MICROPY_FLOAT_CONST(0.); - } - - // all numbers previously converted to float in synthio_block_assign_slot + // all numbers (and None!) previously converted to float in synthio_block_assign_slot if (mp_obj_is_float(slot->obj)) { return mp_obj_get_float(slot->obj); } @@ -594,7 +590,7 @@ void synthio_block_assign_slot(mp_obj_t obj, synthio_block_slot_t *slot, qstr ar return; } - mp_float_t value; + mp_float_t value = MICROPY_FLOAT_CONST(0.); if (obj != mp_const_none && !mp_obj_get_float_maybe(obj, &value)) { mp_raise_TypeError_varg(translate("%q must be of type %q, not %q"), arg_name, MP_QSTR_BlockInput, mp_obj_get_type_qstr(obj)); } From 823a02c0b769886462e19998b07135db2f8fb60d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 21 May 2023 13:11:42 -0500 Subject: [PATCH 1104/1712] synthio: Add a new test of synthio.LFO --- tests/circuitpython/synthlfo.py | 21 ++++++ tests/circuitpython/synthlfo.py.exp | 100 ++++++++++++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 tests/circuitpython/synthlfo.py create mode 100644 tests/circuitpython/synthlfo.py.exp diff --git a/tests/circuitpython/synthlfo.py b/tests/circuitpython/synthlfo.py new file mode 100644 index 0000000000..c1f8ece1bf --- /dev/null +++ b/tests/circuitpython/synthlfo.py @@ -0,0 +1,21 @@ +import array +from math import sin, pi +from synthio import LFO, lfo_tick + +bend_out = array.array("h", [0, 32767]) +bend_in = array.array("h", [32767, 0]) +triangle = array.array("h", [0, 32767, 0, -32767]) +sine = array.array("h", [int(32767 * sin(i * 2 * pi / 600)) for i in range(600)]) + +lfos = [ + LFO(bend_out, once=True, rate=4), + LFO(bend_in, once=True, rate=2.5, scale=2), + LFO(triangle, rate=3) + # LFO(bend_in, interpolate=False, rate=5), + # LFO(bend_in, interpolate=True, rate=5), +] +lfos[2].rate = lfos[1] +lfos[2].offset = lfos[0] + +for i in range(100): + print(i * 256 / 48000, *list(lfo_tick(*lfos)) + [l.phase for l in lfos]) diff --git a/tests/circuitpython/synthlfo.py.exp b/tests/circuitpython/synthlfo.py.exp new file mode 100644 index 0000000000..fd5bdf3333 --- /dev/null +++ b/tests/circuitpython/synthlfo.py.exp @@ -0,0 +1,100 @@ +0.0 0.02133268229166667 1.973273111979167 0.06342789066420661 0.02133333333333333 0.01333333333333333 0.01052412326388889 +0.005333333333333333 0.04266536458333333 1.946607259114583 0.1262869271612167 0.04266666666666667 0.02666666666666667 0.02090602864583333 +0.01066666666666667 0.06399804687500001 1.91994140625 0.1885771094910304 0.064 0.03999999999999999 0.03114571614583333 +0.016 0.08533072916666667 1.893275553385417 0.2502984376536475 0.08533333333333333 0.05333333333333333 0.04124318576388888 +0.02133333333333333 0.1066634114583333 1.866609700520833 0.3114509116490682 0.1066666666666667 0.06666666666666666 0.05119843749999999 +0.02666666666666667 0.12799609375 1.83994384765625 0.3720345314772924 0.128 0.08 0.06101147135416667 +0.032 0.1493287760416667 1.813277994791667 0.4320492971383201 0.1493333333333333 0.09333333333333334 0.07068228732638888 +0.03733333333333333 0.1706614583333334 1.786612141927083 0.4914952086321512 0.1706666666666667 0.1066666666666667 0.08021088541666666 +0.04266666666666667 0.191994140625 1.7599462890625 0.550372265958786 0.192 0.12 0.08959726562499998 +0.048 0.2133268229166667 1.733280436197917 0.6086804691182243 0.2133333333333334 0.1333333333333333 0.09884142795138889 +0.05333333333333333 0.2346595052083334 1.706614583333333 0.666419818110466 0.2346666666666667 0.1466666666666667 0.1079433723958333 +0.05866666666666667 0.2559921875000001 1.67994873046875 0.7235903129355112 0.256 0.16 0.1169030989583333 +0.064 0.2773248697916667 1.653282877604167 0.78019195359336 0.2773333333333334 0.1733333333333333 0.1257206076388889 +0.06933333333333334 0.2986575520833333 1.626617024739583 0.8362247400840124 0.2986666666666667 0.1866666666666667 0.1343958984375 +0.07466666666666667 0.319990234375 1.599951171875 0.8916886724074683 0.32 0.2 0.1429289713541666 +0.08 0.3413229166666667 1.573285319010417 0.9465837505637273 0.3413333333333333 0.2133333333333333 0.1513198263888889 +0.08533333333333333 0.3626555989583333 1.546619466145833 1.00090997455279 0.3626666666666666 0.2266666666666667 0.1595684635416666 +0.09066666666666666 0.3839882812499999 1.51995361328125 1.054667344374657 0.384 0.24 0.1676748828125 +0.096 0.4053209635416666 1.493287760416667 1.107855860029326 0.4053333333333333 0.2533333333333334 0.1756390842013889 +0.1013333333333333 0.4266536458333333 1.466621907552083 1.1604755215168 0.4266666666666666 0.2666666666666667 0.1834610677083333 +0.1066666666666667 0.4479863281249999 1.4399560546875 1.212526328837077 0.4479999999999999 0.28 0.1911408333333333 +0.112 0.4693190104166666 1.413290201822917 1.264008281990157 0.4693333333333332 0.2933333333333333 0.1986783810763889 +0.1173333333333333 0.4906516927083332 1.386624348958333 1.314921380976041 0.4906666666666665 0.3066666666666666 0.2060737109375 +0.1226666666666667 0.5119843749999999 1.35995849609375 1.365265625794728 0.5119999999999999 0.3199999999999999 0.2133268229166667 +0.128 0.5333170572916666 1.333292643229167 1.415041016446219 0.5333333333333332 0.3333333333333332 0.2204377170138889 +0.1333333333333333 0.5546497395833332 1.306626790364584 1.464247552930514 0.5546666666666665 0.3466666666666665 0.2274063932291666 +0.1386666666666667 0.5759824218749998 1.2799609375 1.512885235247612 0.5759999999999998 0.3599999999999998 0.2342328515625 +0.144 0.5973151041666664 1.253295084635417 1.560954063397513 0.5973333333333332 0.3733333333333331 0.2409170920138889 +0.1493333333333333 0.6186477864583332 1.226629231770834 1.608454037380218 0.6186666666666665 0.3866666666666664 0.2474591145833333 +0.1546666666666667 0.6399804687499998 1.199963378906251 1.624514745148023 0.6399999999999998 0.3999999999999997 0.2538589192708333 +0.16 0.6613131510416665 1.173297526041667 1.620817844083044 0.6613333333333332 0.413333333333333 0.2601165060763889 +0.1653333333333333 0.682645833333333 1.146631673177084 1.617689797185262 0.6826666666666664 0.4266666666666664 0.266231875 +0.1706666666666667 0.7039785156249997 1.1199658203125 1.615130604454676 0.7039999999999997 0.4399999999999997 0.2722050260416667 +0.176 0.7253111979166665 1.093299967447918 1.613140265891287 0.725333333333333 0.453333333333333 0.2780359592013889 +0.1813333333333333 0.7466438802083331 1.066634114583334 1.611718781495094 0.7466666666666663 0.4666666666666663 0.2837246744791667 +0.1866666666666667 0.7679765624999996 1.039968261718751 1.610866151266098 0.7679999999999997 0.4799999999999996 0.289271171875 +0.192 0.7893092447916663 1.013302408854167 1.610582375204298 0.789333333333333 0.4933333333333329 0.2946754513888889 +0.1973333333333333 0.810641927083333 0.9866365559895842 1.610867453309694 0.8106666666666664 0.5066666666666663 0.2999375130208333 +0.2026666666666666 0.8319746093749997 0.9599707031250009 1.611721385582288 0.8319999999999997 0.5199999999999996 0.3050573567708334 +0.208 0.8533072916666663 0.9333048502604175 1.613144172022077 0.853333333333333 0.5333333333333329 0.3100349826388889 +0.2133333333333333 0.874639973958333 0.9066389973958342 1.615135812629064 0.8746666666666663 0.5466666666666661 0.314870390625 +0.2186666666666667 0.8959726562499995 0.879973144531251 1.617696307403246 0.8959999999999996 0.5599999999999995 0.3195635807291667 +0.224 0.9173053385416662 0.8533072916666677 1.620825656344625 0.9173333333333328 0.5733333333333328 0.3241145529513889 +0.2293333333333333 0.9386380208333328 0.8266414388020845 1.624523859453201 0.9386666666666661 0.5866666666666661 0.3285233072916667 +0.2346666666666667 0.9599707031249995 0.7999755859375012 1.628790916728973 0.9599999999999994 0.5999999999999995 0.33278984375 +0.24 0.9813033854166662 0.7733097330729178 1.633626828171941 0.9813333333333329 0.6133333333333328 0.3369141623263889 +0.2453333333333333 0.9999389657750726 0.7466438802083346 1.636334491848846 0.999969482421875 0.626666666666666 0.3408962630208334 +0.2506666666666666 0.9999389657750726 0.7199780273437513 1.620975429334541 0.999969482421875 0.6399999999999993 0.3447361458333334 +0.256 0.9999389657750726 0.6933121744791681 1.606185220987432 0.999969482421875 0.6533333333333326 0.348433810763889 +0.2613333333333333 0.9999389657750726 0.6666463216145847 1.59196386680752 0.999969482421875 0.666666666666666 0.3519892578125001 +0.2666666666666667 0.9999389657750726 0.6399804687500015 1.578311366794804 0.999969482421875 0.6799999999999993 0.3554024869791668 +0.272 0.9999389657750726 0.6133146158854181 1.565227720949285 0.999969482421875 0.6933333333333326 0.358673498263889 +0.2773333333333333 0.9999389657750726 0.5866487630208349 1.552712929270962 0.999969482421875 0.7066666666666659 0.3618022916666668 +0.2826666666666667 0.9999389657750726 0.5599829101562515 1.540766991759836 0.999969482421875 0.7199999999999992 0.3647888671875001 +0.288 0.9999389657750726 0.5333170572916684 1.529389908415906 0.999969482421875 0.7333333333333325 0.3676332248263891 +0.2933333333333334 0.9999389657750726 0.506651204427085 1.518581679239173 0.999969482421875 0.7466666666666658 0.3703353645833335 +0.2986666666666667 0.9999389657750726 0.4799853515625018 1.508342304229636 0.999969482421875 0.7599999999999991 0.3728952864583335 +0.304 0.9999389657750726 0.4533194986979185 1.498671783387296 0.999969482421875 0.7733333333333325 0.375312990451389 +0.3093333333333334 0.9999389657750726 0.4266536458333352 1.489570116712152 0.999969482421875 0.7866666666666657 0.3775884765625002 +0.3146666666666667 0.9999389657750726 0.3999877929687519 1.481037304204205 0.999969482421875 0.799999999999999 0.3797217447916668 +0.32 0.9999389657750726 0.3733219401041686 1.473073345863454 0.999969482421875 0.8133333333333324 0.381712795138889 +0.3253333333333333 0.9999389657750726 0.3466560872395854 1.4656782416899 0.999969482421875 0.8266666666666657 0.3835616276041669 +0.3306666666666667 0.9999389657750726 0.3199902343750021 1.458851991683542 0.999969482421875 0.839999999999999 0.3852682421875002 +0.336 0.9999389657750726 0.2933243815104188 1.452594595844381 0.999969482421875 0.8533333333333323 0.3868326388888891 +0.3413333333333333 0.9999389657750726 0.2666585286458355 1.446906054172416 0.999969482421875 0.8666666666666655 0.3882548177083335 +0.3466666666666667 0.9999389657750726 0.2399926757812522 1.441786366667647 0.999969482421875 0.8799999999999988 0.3895347786458335 +0.352 0.9999389657750726 0.2133268229166689 1.437235533330075 0.999969482421875 0.8933333333333323 0.3906725217013891 +0.3573333333333333 0.9999389657750726 0.1866609700520856 1.4332535541597 0.999969482421875 0.9066666666666656 0.3916680468750002 +0.3626666666666667 0.9999389657750726 0.1599951171875024 1.429840429156521 0.999969482421875 0.9199999999999989 0.3925213541666669 +0.368 0.9999389657750726 0.1333292643229191 1.426996158320538 0.999969482421875 0.9333333333333321 0.3932324435763892 +0.3733333333333333 0.9999389657750726 0.1066634114583358 1.424720741651752 0.999969482421875 0.9466666666666654 0.393801315104167 +0.3786666666666667 0.9999389657750726 0.07999755859375251 1.423014179150163 0.999969482421875 0.9599999999999987 0.3942279687500003 +0.384 0.9999389657750726 0.05333170572916924 1.42187647081577 0.999969482421875 0.973333333333332 0.3945124045138892 +0.3893333333333333 0.9999389657750726 0.02666585286458595 1.421307616648573 0.999969482421875 0.9866666666666653 0.3946546223958336 +0.3946666666666667 0.9999389657750726 6.103329360485077e-05 1.421306314644712 0.999969482421875 0.999969482421875 0.3946549479067329 +0.4 0.9999389657750726 6.103329360485077e-05 1.42130501264085 0.999969482421875 0.999969482421875 0.3946552734176321 +0.4053333333333333 0.9999389657750726 6.103329360485077e-05 1.421303710636988 0.999969482421875 0.999969482421875 0.3946555989285314 +0.4106666666666666 0.9999389657750726 6.103329360485077e-05 1.421302408633126 0.999969482421875 0.999969482421875 0.3946559244394306 +0.416 0.9999389657750726 6.103329360485077e-05 1.421301106629265 0.999969482421875 0.999969482421875 0.3946562499503298 +0.4213333333333333 0.9999389657750726 6.103329360485077e-05 1.421299804625403 0.999969482421875 0.999969482421875 0.3946565754612291 +0.4266666666666667 0.9999389657750726 6.103329360485077e-05 1.421298502621541 0.999969482421875 0.999969482421875 0.3946569009721283 +0.432 0.9999389657750726 6.103329360485077e-05 1.42129720061768 0.999969482421875 0.999969482421875 0.3946572264830275 +0.4373333333333333 0.9999389657750726 6.103329360485077e-05 1.421295898613818 0.999969482421875 0.999969482421875 0.3946575519939268 +0.4426666666666667 0.9999389657750726 6.103329360485077e-05 1.421294596609956 0.999969482421875 0.999969482421875 0.394657877504826 +0.448 0.9999389657750726 6.103329360485077e-05 1.421293294606095 0.999969482421875 0.999969482421875 0.3946582030157252 +0.4533333333333333 0.9999389657750726 6.103329360485077e-05 1.421291992602233 0.999969482421875 0.999969482421875 0.3946585285266245 +0.4586666666666667 0.9999389657750726 6.103329360485077e-05 1.421290690598371 0.999969482421875 0.999969482421875 0.3946588540375237 +0.4640000000000001 0.9999389657750726 6.103329360485077e-05 1.421289388594509 0.999969482421875 0.999969482421875 0.3946591795484229 +0.4693333333333333 0.9999389657750726 6.103329360485077e-05 1.421288086590648 0.999969482421875 0.999969482421875 0.3946595050593222 +0.4746666666666667 0.9999389657750726 6.103329360485077e-05 1.421286784586786 0.999969482421875 0.999969482421875 0.3946598305702214 +0.48 0.9999389657750726 6.103329360485077e-05 1.421285482582924 0.999969482421875 0.999969482421875 0.3946601560811207 +0.4853333333333333 0.9999389657750726 6.103329360485077e-05 1.421284180579062 0.999969482421875 0.999969482421875 0.3946604815920199 +0.4906666666666666 0.9999389657750726 6.103329360485077e-05 1.421282878575201 0.999969482421875 0.999969482421875 0.3946608071029191 +0.496 0.9999389657750726 6.103329360485077e-05 1.421281576571339 0.999969482421875 0.999969482421875 0.3946611326138184 +0.5013333333333333 0.9999389657750726 6.103329360485077e-05 1.421280274567477 0.999969482421875 0.999969482421875 0.3946614581247176 +0.5066666666666667 0.9999389657750726 6.103329360485077e-05 1.421278972563615 0.999969482421875 0.999969482421875 0.3946617836356168 +0.512 0.9999389657750726 6.103329360485077e-05 1.421277670559754 0.999969482421875 0.999969482421875 0.3946621091465161 +0.5173333333333333 0.9999389657750726 6.103329360485077e-05 1.421276368555892 0.999969482421875 0.999969482421875 0.3946624346574153 +0.5226666666666667 0.9999389657750726 6.103329360485077e-05 1.42127506655203 0.999969482421875 0.999969482421875 0.3946627601683145 +0.528 0.9999389657750726 6.103329360485077e-05 1.421273764548169 0.999969482421875 0.999969482421875 0.3946630856792138 From c5615995d93cf9ab8613dd975920cb158645a138 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 21 May 2023 13:13:00 -0500 Subject: [PATCH 1105/1712] synthio: fix docstring --- shared-bindings/synthio/LFO.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/synthio/LFO.c b/shared-bindings/synthio/LFO.c index 79e05d83ce..ac817b93b6 100644 --- a/shared-bindings/synthio/LFO.c +++ b/shared-bindings/synthio/LFO.c @@ -164,7 +164,7 @@ MP_PROPERTY_GETSET(synthio_lfo_phase_offset_obj, (mp_obj_t)&synthio_lfo_set_phase_offset_obj); //| scale: BlockInput -//| """An additive value applied to the LFO's output""" +//| """An multiplier value applied to the LFO's output""" STATIC mp_obj_t synthio_lfo_get_scale(mp_obj_t self_in) { synthio_lfo_obj_t *self = MP_OBJ_TO_PTR(self_in); return common_hal_synthio_lfo_get_scale_obj(self); From 78e75f69773f071689ef5a614eb564193224d45d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 21 May 2023 13:16:27 -0500 Subject: [PATCH 1106/1712] synthio: enable additional LFO test cases --- tests/circuitpython/synthlfo.py | 6 +- tests/circuitpython/synthlfo.py.exp | 200 ++++++++++++++-------------- 2 files changed, 103 insertions(+), 103 deletions(-) diff --git a/tests/circuitpython/synthlfo.py b/tests/circuitpython/synthlfo.py index c1f8ece1bf..a7bd1e8973 100644 --- a/tests/circuitpython/synthlfo.py +++ b/tests/circuitpython/synthlfo.py @@ -10,9 +10,9 @@ sine = array.array("h", [int(32767 * sin(i * 2 * pi / 600)) for i in range(600)] lfos = [ LFO(bend_out, once=True, rate=4), LFO(bend_in, once=True, rate=2.5, scale=2), - LFO(triangle, rate=3) - # LFO(bend_in, interpolate=False, rate=5), - # LFO(bend_in, interpolate=True, rate=5), + LFO(triangle, rate=3), + LFO(bend_in, interpolate=False, rate=5), + LFO(bend_in, interpolate=True, rate=5), ] lfos[2].rate = lfos[1] lfos[2].offset = lfos[0] diff --git a/tests/circuitpython/synthlfo.py.exp b/tests/circuitpython/synthlfo.py.exp index fd5bdf3333..60662b7f05 100644 --- a/tests/circuitpython/synthlfo.py.exp +++ b/tests/circuitpython/synthlfo.py.exp @@ -1,100 +1,100 @@ -0.0 0.02133268229166667 1.973273111979167 0.06342789066420661 0.02133333333333333 0.01333333333333333 0.01052412326388889 -0.005333333333333333 0.04266536458333333 1.946607259114583 0.1262869271612167 0.04266666666666667 0.02666666666666667 0.02090602864583333 -0.01066666666666667 0.06399804687500001 1.91994140625 0.1885771094910304 0.064 0.03999999999999999 0.03114571614583333 -0.016 0.08533072916666667 1.893275553385417 0.2502984376536475 0.08533333333333333 0.05333333333333333 0.04124318576388888 -0.02133333333333333 0.1066634114583333 1.866609700520833 0.3114509116490682 0.1066666666666667 0.06666666666666666 0.05119843749999999 -0.02666666666666667 0.12799609375 1.83994384765625 0.3720345314772924 0.128 0.08 0.06101147135416667 -0.032 0.1493287760416667 1.813277994791667 0.4320492971383201 0.1493333333333333 0.09333333333333334 0.07068228732638888 -0.03733333333333333 0.1706614583333334 1.786612141927083 0.4914952086321512 0.1706666666666667 0.1066666666666667 0.08021088541666666 -0.04266666666666667 0.191994140625 1.7599462890625 0.550372265958786 0.192 0.12 0.08959726562499998 -0.048 0.2133268229166667 1.733280436197917 0.6086804691182243 0.2133333333333334 0.1333333333333333 0.09884142795138889 -0.05333333333333333 0.2346595052083334 1.706614583333333 0.666419818110466 0.2346666666666667 0.1466666666666667 0.1079433723958333 -0.05866666666666667 0.2559921875000001 1.67994873046875 0.7235903129355112 0.256 0.16 0.1169030989583333 -0.064 0.2773248697916667 1.653282877604167 0.78019195359336 0.2773333333333334 0.1733333333333333 0.1257206076388889 -0.06933333333333334 0.2986575520833333 1.626617024739583 0.8362247400840124 0.2986666666666667 0.1866666666666667 0.1343958984375 -0.07466666666666667 0.319990234375 1.599951171875 0.8916886724074683 0.32 0.2 0.1429289713541666 -0.08 0.3413229166666667 1.573285319010417 0.9465837505637273 0.3413333333333333 0.2133333333333333 0.1513198263888889 -0.08533333333333333 0.3626555989583333 1.546619466145833 1.00090997455279 0.3626666666666666 0.2266666666666667 0.1595684635416666 -0.09066666666666666 0.3839882812499999 1.51995361328125 1.054667344374657 0.384 0.24 0.1676748828125 -0.096 0.4053209635416666 1.493287760416667 1.107855860029326 0.4053333333333333 0.2533333333333334 0.1756390842013889 -0.1013333333333333 0.4266536458333333 1.466621907552083 1.1604755215168 0.4266666666666666 0.2666666666666667 0.1834610677083333 -0.1066666666666667 0.4479863281249999 1.4399560546875 1.212526328837077 0.4479999999999999 0.28 0.1911408333333333 -0.112 0.4693190104166666 1.413290201822917 1.264008281990157 0.4693333333333332 0.2933333333333333 0.1986783810763889 -0.1173333333333333 0.4906516927083332 1.386624348958333 1.314921380976041 0.4906666666666665 0.3066666666666666 0.2060737109375 -0.1226666666666667 0.5119843749999999 1.35995849609375 1.365265625794728 0.5119999999999999 0.3199999999999999 0.2133268229166667 -0.128 0.5333170572916666 1.333292643229167 1.415041016446219 0.5333333333333332 0.3333333333333332 0.2204377170138889 -0.1333333333333333 0.5546497395833332 1.306626790364584 1.464247552930514 0.5546666666666665 0.3466666666666665 0.2274063932291666 -0.1386666666666667 0.5759824218749998 1.2799609375 1.512885235247612 0.5759999999999998 0.3599999999999998 0.2342328515625 -0.144 0.5973151041666664 1.253295084635417 1.560954063397513 0.5973333333333332 0.3733333333333331 0.2409170920138889 -0.1493333333333333 0.6186477864583332 1.226629231770834 1.608454037380218 0.6186666666666665 0.3866666666666664 0.2474591145833333 -0.1546666666666667 0.6399804687499998 1.199963378906251 1.624514745148023 0.6399999999999998 0.3999999999999997 0.2538589192708333 -0.16 0.6613131510416665 1.173297526041667 1.620817844083044 0.6613333333333332 0.413333333333333 0.2601165060763889 -0.1653333333333333 0.682645833333333 1.146631673177084 1.617689797185262 0.6826666666666664 0.4266666666666664 0.266231875 -0.1706666666666667 0.7039785156249997 1.1199658203125 1.615130604454676 0.7039999999999997 0.4399999999999997 0.2722050260416667 -0.176 0.7253111979166665 1.093299967447918 1.613140265891287 0.725333333333333 0.453333333333333 0.2780359592013889 -0.1813333333333333 0.7466438802083331 1.066634114583334 1.611718781495094 0.7466666666666663 0.4666666666666663 0.2837246744791667 -0.1866666666666667 0.7679765624999996 1.039968261718751 1.610866151266098 0.7679999999999997 0.4799999999999996 0.289271171875 -0.192 0.7893092447916663 1.013302408854167 1.610582375204298 0.789333333333333 0.4933333333333329 0.2946754513888889 -0.1973333333333333 0.810641927083333 0.9866365559895842 1.610867453309694 0.8106666666666664 0.5066666666666663 0.2999375130208333 -0.2026666666666666 0.8319746093749997 0.9599707031250009 1.611721385582288 0.8319999999999997 0.5199999999999996 0.3050573567708334 -0.208 0.8533072916666663 0.9333048502604175 1.613144172022077 0.853333333333333 0.5333333333333329 0.3100349826388889 -0.2133333333333333 0.874639973958333 0.9066389973958342 1.615135812629064 0.8746666666666663 0.5466666666666661 0.314870390625 -0.2186666666666667 0.8959726562499995 0.879973144531251 1.617696307403246 0.8959999999999996 0.5599999999999995 0.3195635807291667 -0.224 0.9173053385416662 0.8533072916666677 1.620825656344625 0.9173333333333328 0.5733333333333328 0.3241145529513889 -0.2293333333333333 0.9386380208333328 0.8266414388020845 1.624523859453201 0.9386666666666661 0.5866666666666661 0.3285233072916667 -0.2346666666666667 0.9599707031249995 0.7999755859375012 1.628790916728973 0.9599999999999994 0.5999999999999995 0.33278984375 -0.24 0.9813033854166662 0.7733097330729178 1.633626828171941 0.9813333333333329 0.6133333333333328 0.3369141623263889 -0.2453333333333333 0.9999389657750726 0.7466438802083346 1.636334491848846 0.999969482421875 0.626666666666666 0.3408962630208334 -0.2506666666666666 0.9999389657750726 0.7199780273437513 1.620975429334541 0.999969482421875 0.6399999999999993 0.3447361458333334 -0.256 0.9999389657750726 0.6933121744791681 1.606185220987432 0.999969482421875 0.6533333333333326 0.348433810763889 -0.2613333333333333 0.9999389657750726 0.6666463216145847 1.59196386680752 0.999969482421875 0.666666666666666 0.3519892578125001 -0.2666666666666667 0.9999389657750726 0.6399804687500015 1.578311366794804 0.999969482421875 0.6799999999999993 0.3554024869791668 -0.272 0.9999389657750726 0.6133146158854181 1.565227720949285 0.999969482421875 0.6933333333333326 0.358673498263889 -0.2773333333333333 0.9999389657750726 0.5866487630208349 1.552712929270962 0.999969482421875 0.7066666666666659 0.3618022916666668 -0.2826666666666667 0.9999389657750726 0.5599829101562515 1.540766991759836 0.999969482421875 0.7199999999999992 0.3647888671875001 -0.288 0.9999389657750726 0.5333170572916684 1.529389908415906 0.999969482421875 0.7333333333333325 0.3676332248263891 -0.2933333333333334 0.9999389657750726 0.506651204427085 1.518581679239173 0.999969482421875 0.7466666666666658 0.3703353645833335 -0.2986666666666667 0.9999389657750726 0.4799853515625018 1.508342304229636 0.999969482421875 0.7599999999999991 0.3728952864583335 -0.304 0.9999389657750726 0.4533194986979185 1.498671783387296 0.999969482421875 0.7733333333333325 0.375312990451389 -0.3093333333333334 0.9999389657750726 0.4266536458333352 1.489570116712152 0.999969482421875 0.7866666666666657 0.3775884765625002 -0.3146666666666667 0.9999389657750726 0.3999877929687519 1.481037304204205 0.999969482421875 0.799999999999999 0.3797217447916668 -0.32 0.9999389657750726 0.3733219401041686 1.473073345863454 0.999969482421875 0.8133333333333324 0.381712795138889 -0.3253333333333333 0.9999389657750726 0.3466560872395854 1.4656782416899 0.999969482421875 0.8266666666666657 0.3835616276041669 -0.3306666666666667 0.9999389657750726 0.3199902343750021 1.458851991683542 0.999969482421875 0.839999999999999 0.3852682421875002 -0.336 0.9999389657750726 0.2933243815104188 1.452594595844381 0.999969482421875 0.8533333333333323 0.3868326388888891 -0.3413333333333333 0.9999389657750726 0.2666585286458355 1.446906054172416 0.999969482421875 0.8666666666666655 0.3882548177083335 -0.3466666666666667 0.9999389657750726 0.2399926757812522 1.441786366667647 0.999969482421875 0.8799999999999988 0.3895347786458335 -0.352 0.9999389657750726 0.2133268229166689 1.437235533330075 0.999969482421875 0.8933333333333323 0.3906725217013891 -0.3573333333333333 0.9999389657750726 0.1866609700520856 1.4332535541597 0.999969482421875 0.9066666666666656 0.3916680468750002 -0.3626666666666667 0.9999389657750726 0.1599951171875024 1.429840429156521 0.999969482421875 0.9199999999999989 0.3925213541666669 -0.368 0.9999389657750726 0.1333292643229191 1.426996158320538 0.999969482421875 0.9333333333333321 0.3932324435763892 -0.3733333333333333 0.9999389657750726 0.1066634114583358 1.424720741651752 0.999969482421875 0.9466666666666654 0.393801315104167 -0.3786666666666667 0.9999389657750726 0.07999755859375251 1.423014179150163 0.999969482421875 0.9599999999999987 0.3942279687500003 -0.384 0.9999389657750726 0.05333170572916924 1.42187647081577 0.999969482421875 0.973333333333332 0.3945124045138892 -0.3893333333333333 0.9999389657750726 0.02666585286458595 1.421307616648573 0.999969482421875 0.9866666666666653 0.3946546223958336 -0.3946666666666667 0.9999389657750726 6.103329360485077e-05 1.421306314644712 0.999969482421875 0.999969482421875 0.3946549479067329 -0.4 0.9999389657750726 6.103329360485077e-05 1.42130501264085 0.999969482421875 0.999969482421875 0.3946552734176321 -0.4053333333333333 0.9999389657750726 6.103329360485077e-05 1.421303710636988 0.999969482421875 0.999969482421875 0.3946555989285314 -0.4106666666666666 0.9999389657750726 6.103329360485077e-05 1.421302408633126 0.999969482421875 0.999969482421875 0.3946559244394306 -0.416 0.9999389657750726 6.103329360485077e-05 1.421301106629265 0.999969482421875 0.999969482421875 0.3946562499503298 -0.4213333333333333 0.9999389657750726 6.103329360485077e-05 1.421299804625403 0.999969482421875 0.999969482421875 0.3946565754612291 -0.4266666666666667 0.9999389657750726 6.103329360485077e-05 1.421298502621541 0.999969482421875 0.999969482421875 0.3946569009721283 -0.432 0.9999389657750726 6.103329360485077e-05 1.42129720061768 0.999969482421875 0.999969482421875 0.3946572264830275 -0.4373333333333333 0.9999389657750726 6.103329360485077e-05 1.421295898613818 0.999969482421875 0.999969482421875 0.3946575519939268 -0.4426666666666667 0.9999389657750726 6.103329360485077e-05 1.421294596609956 0.999969482421875 0.999969482421875 0.394657877504826 -0.448 0.9999389657750726 6.103329360485077e-05 1.421293294606095 0.999969482421875 0.999969482421875 0.3946582030157252 -0.4533333333333333 0.9999389657750726 6.103329360485077e-05 1.421291992602233 0.999969482421875 0.999969482421875 0.3946585285266245 -0.4586666666666667 0.9999389657750726 6.103329360485077e-05 1.421290690598371 0.999969482421875 0.999969482421875 0.3946588540375237 -0.4640000000000001 0.9999389657750726 6.103329360485077e-05 1.421289388594509 0.999969482421875 0.999969482421875 0.3946591795484229 -0.4693333333333333 0.9999389657750726 6.103329360485077e-05 1.421288086590648 0.999969482421875 0.999969482421875 0.3946595050593222 -0.4746666666666667 0.9999389657750726 6.103329360485077e-05 1.421286784586786 0.999969482421875 0.999969482421875 0.3946598305702214 -0.48 0.9999389657750726 6.103329360485077e-05 1.421285482582924 0.999969482421875 0.999969482421875 0.3946601560811207 -0.4853333333333333 0.9999389657750726 6.103329360485077e-05 1.421284180579062 0.999969482421875 0.999969482421875 0.3946604815920199 -0.4906666666666666 0.9999389657750726 6.103329360485077e-05 1.421282878575201 0.999969482421875 0.999969482421875 0.3946608071029191 -0.496 0.9999389657750726 6.103329360485077e-05 1.421281576571339 0.999969482421875 0.999969482421875 0.3946611326138184 -0.5013333333333333 0.9999389657750726 6.103329360485077e-05 1.421280274567477 0.999969482421875 0.999969482421875 0.3946614581247176 -0.5066666666666667 0.9999389657750726 6.103329360485077e-05 1.421278972563615 0.999969482421875 0.999969482421875 0.3946617836356168 -0.512 0.9999389657750726 6.103329360485077e-05 1.421277670559754 0.999969482421875 0.999969482421875 0.3946621091465161 -0.5173333333333333 0.9999389657750726 6.103329360485077e-05 1.421276368555892 0.999969482421875 0.999969482421875 0.3946624346574153 -0.5226666666666667 0.9999389657750726 6.103329360485077e-05 1.42127506655203 0.999969482421875 0.999969482421875 0.3946627601683145 -0.528 0.9999389657750726 6.103329360485077e-05 1.421273764548169 0.999969482421875 0.999969482421875 0.3946630856792138 +0.0 0.02133268229166667 1.973273111979167 0.06342789066420661 0.999969482421875 0.9466377766927083 0.02133333333333333 0.01333333333333333 0.01052412326388889 0.02666666666666667 0.02666666666666667 +0.005333333333333333 0.04266536458333333 1.946607259114583 0.1262869271612167 0.999969482421875 0.8933060709635416 0.04266666666666667 0.02666666666666667 0.02090602864583333 0.05333333333333333 0.05333333333333333 +0.01066666666666667 0.06399804687500001 1.91994140625 0.1885771094910304 0.999969482421875 0.8399743652343751 0.064 0.03999999999999999 0.03114571614583333 0.07999999999999998 0.07999999999999998 +0.016 0.08533072916666667 1.893275553385417 0.2502984376536475 0.999969482421875 0.7866426595052083 0.08533333333333333 0.05333333333333333 0.04124318576388888 0.1066666666666667 0.1066666666666667 +0.02133333333333333 0.1066634114583333 1.866609700520833 0.3114509116490682 0.999969482421875 0.7333109537760417 0.1066666666666667 0.06666666666666666 0.05119843749999999 0.1333333333333333 0.1333333333333333 +0.02666666666666667 0.12799609375 1.83994384765625 0.3720345314772924 0.999969482421875 0.6799792480468749 0.128 0.08 0.06101147135416667 0.16 0.16 +0.032 0.1493287760416667 1.813277994791667 0.4320492971383201 0.999969482421875 0.6266475423177083 0.1493333333333333 0.09333333333333334 0.07068228732638888 0.1866666666666667 0.1866666666666667 +0.03733333333333333 0.1706614583333334 1.786612141927083 0.4914952086321512 0.999969482421875 0.5733158365885416 0.1706666666666667 0.1066666666666667 0.08021088541666666 0.2133333333333333 0.2133333333333333 +0.04266666666666667 0.191994140625 1.7599462890625 0.550372265958786 0.999969482421875 0.519984130859375 0.192 0.12 0.08959726562499998 0.24 0.24 +0.048 0.2133268229166667 1.733280436197917 0.6086804691182243 0.999969482421875 0.4666524251302083 0.2133333333333334 0.1333333333333333 0.09884142795138889 0.2666666666666667 0.2666666666666667 +0.05333333333333333 0.2346595052083334 1.706614583333333 0.666419818110466 0.999969482421875 0.4133207194010416 0.2346666666666667 0.1466666666666667 0.1079433723958333 0.2933333333333334 0.2933333333333334 +0.05866666666666667 0.2559921875000001 1.67994873046875 0.7235903129355112 0.999969482421875 0.3599890136718749 0.256 0.16 0.1169030989583333 0.32 0.32 +0.064 0.2773248697916667 1.653282877604167 0.78019195359336 0.999969482421875 0.3066573079427083 0.2773333333333334 0.1733333333333333 0.1257206076388889 0.3466666666666667 0.3466666666666667 +0.06933333333333334 0.2986575520833333 1.626617024739583 0.8362247400840124 0.999969482421875 0.2533256022135416 0.2986666666666667 0.1866666666666667 0.1343958984375 0.3733333333333333 0.3733333333333333 +0.07466666666666667 0.319990234375 1.599951171875 0.8916886724074683 0.999969482421875 0.199993896484375 0.32 0.2 0.1429289713541666 0.4 0.4 +0.08 0.3413229166666667 1.573285319010417 0.9465837505637273 0.999969482421875 0.1466621907552083 0.3413333333333333 0.2133333333333333 0.1513198263888889 0.4266666666666667 0.4266666666666667 +0.08533333333333333 0.3626555989583333 1.546619466145833 1.00090997455279 0.999969482421875 0.09333048502604161 0.3626666666666666 0.2266666666666667 0.1595684635416666 0.4533333333333333 0.4533333333333333 +0.09066666666666666 0.3839882812499999 1.51995361328125 1.054667344374657 0.999969482421875 0.03999877929687493 0.384 0.24 0.1676748828125 0.4800000000000001 0.4800000000000001 +0.096 0.4053209635416666 1.493287760416667 1.107855860029326 0.0 0.01333292643229175 0.4053333333333333 0.2533333333333334 0.1756390842013889 0.5066666666666667 0.5066666666666667 +0.1013333333333333 0.4266536458333333 1.466621907552083 1.1604755215168 0.0 0.06666463216145832 0.4266666666666666 0.2666666666666667 0.1834610677083333 0.5333333333333333 0.5333333333333333 +0.1066666666666667 0.4479863281249999 1.4399560546875 1.212526328837077 0.0 0.1199963378906249 0.4479999999999999 0.28 0.1911408333333333 0.56 0.56 +0.112 0.4693190104166666 1.413290201822917 1.264008281990157 0.0 0.1733280436197915 0.4693333333333332 0.2933333333333333 0.1986783810763889 0.5866666666666665 0.5866666666666665 +0.1173333333333333 0.4906516927083332 1.386624348958333 1.314921380976041 0.0 0.226659749348958 0.4906666666666665 0.3066666666666666 0.2060737109375 0.6133333333333332 0.6133333333333332 +0.1226666666666667 0.5119843749999999 1.35995849609375 1.365265625794728 0.0 0.2799914550781246 0.5119999999999999 0.3199999999999999 0.2133268229166667 0.6399999999999998 0.6399999999999998 +0.128 0.5333170572916666 1.333292643229167 1.415041016446219 0.0 0.3333231608072911 0.5333333333333332 0.3333333333333332 0.2204377170138889 0.6666666666666664 0.6666666666666664 +0.1333333333333333 0.5546497395833332 1.306626790364584 1.464247552930514 0.0 0.3866548665364577 0.5546666666666665 0.3466666666666665 0.2274063932291666 0.693333333333333 0.693333333333333 +0.1386666666666667 0.5759824218749998 1.2799609375 1.512885235247612 0.0 0.4399865722656243 0.5759999999999998 0.3599999999999998 0.2342328515625 0.7199999999999997 0.7199999999999997 +0.144 0.5973151041666664 1.253295084635417 1.560954063397513 0.0 0.4933182779947908 0.5973333333333332 0.3733333333333331 0.2409170920138889 0.7466666666666662 0.7466666666666662 +0.1493333333333333 0.6186477864583332 1.226629231770834 1.608454037380218 0.0 0.5466499837239574 0.6186666666666665 0.3866666666666664 0.2474591145833333 0.7733333333333329 0.7733333333333329 +0.1546666666666667 0.6399804687499998 1.199963378906251 1.624514745148023 0.0 0.599981689453124 0.6399999999999998 0.3999999999999997 0.2538589192708333 0.7999999999999995 0.7999999999999995 +0.16 0.6613131510416665 1.173297526041667 1.620817844083044 0.0 0.6533133951822906 0.6613333333333332 0.413333333333333 0.2601165060763889 0.826666666666666 0.826666666666666 +0.1653333333333333 0.682645833333333 1.146631673177084 1.617689797185262 0.0 0.7066451009114571 0.6826666666666664 0.4266666666666664 0.266231875 0.8533333333333328 0.8533333333333328 +0.1706666666666667 0.7039785156249997 1.1199658203125 1.615130604454676 0.0 0.7599768066406237 0.7039999999999997 0.4399999999999997 0.2722050260416667 0.8799999999999994 0.8799999999999994 +0.176 0.7253111979166665 1.093299967447918 1.613140265891287 0.0 0.8133085123697903 0.725333333333333 0.453333333333333 0.2780359592013889 0.9066666666666659 0.9066666666666659 +0.1813333333333333 0.7466438802083331 1.066634114583334 1.611718781495094 0.0 0.8666402180989568 0.7466666666666663 0.4666666666666663 0.2837246744791667 0.9333333333333325 0.9333333333333325 +0.1866666666666667 0.7679765624999996 1.039968261718751 1.610866151266098 0.0 0.9199719238281235 0.7679999999999997 0.4799999999999996 0.289271171875 0.9599999999999993 0.9599999999999993 +0.192 0.7893092447916663 1.013302408854167 1.610582375204298 0.0 0.97330362955729 0.789333333333333 0.4933333333333329 0.2946754513888889 0.9866666666666658 0.9866666666666658 +0.1973333333333333 0.810641927083333 0.9866365559895842 1.610867453309694 0.999969482421875 0.9733036295572933 0.8106666666666664 0.5066666666666663 0.2999375130208333 0.01333333333333253 0.01333333333333253 +0.2026666666666666 0.8319746093749997 0.9599707031250009 1.611721385582288 0.999969482421875 0.9199719238281267 0.8319999999999997 0.5199999999999996 0.3050573567708334 0.0399999999999992 0.0399999999999992 +0.208 0.8533072916666663 0.9333048502604175 1.613144172022077 0.999969482421875 0.86664021809896 0.853333333333333 0.5333333333333329 0.3100349826388889 0.06666666666666586 0.06666666666666586 +0.2133333333333333 0.874639973958333 0.9066389973958342 1.615135812629064 0.999969482421875 0.8133085123697935 0.8746666666666663 0.5466666666666661 0.314870390625 0.0933333333333325 0.0933333333333325 +0.2186666666666667 0.8959726562499995 0.879973144531251 1.617696307403246 0.999969482421875 0.7599768066406266 0.8959999999999996 0.5599999999999995 0.3195635807291667 0.1199999999999992 0.1199999999999992 +0.224 0.9173053385416662 0.8533072916666677 1.620825656344625 0.999969482421875 0.70664510091146 0.9173333333333328 0.5733333333333328 0.3241145529513889 0.1466666666666659 0.1466666666666659 +0.2293333333333333 0.9386380208333328 0.8266414388020845 1.624523859453201 0.999969482421875 0.6533133951822933 0.9386666666666661 0.5866666666666661 0.3285233072916667 0.1733333333333325 0.1733333333333325 +0.2346666666666667 0.9599707031249995 0.7999755859375012 1.628790916728973 0.999969482421875 0.5999816894531267 0.9599999999999994 0.5999999999999995 0.33278984375 0.1999999999999992 0.1999999999999992 +0.24 0.9813033854166662 0.7733097330729178 1.633626828171941 0.999969482421875 0.5466499837239599 0.9813333333333329 0.6133333333333328 0.3369141623263889 0.2266666666666659 0.2266666666666659 +0.2453333333333333 0.9999389657750726 0.7466438802083346 1.636334491848846 0.999969482421875 0.4933182779947932 0.999969482421875 0.626666666666666 0.3408962630208334 0.2533333333333325 0.2533333333333325 +0.2506666666666666 0.9999389657750726 0.7199780273437513 1.620975429334541 0.999969482421875 0.4399865722656266 0.999969482421875 0.6399999999999993 0.3447361458333334 0.2799999999999992 0.2799999999999992 +0.256 0.9999389657750726 0.6933121744791681 1.606185220987432 0.999969482421875 0.3866548665364599 0.999969482421875 0.6533333333333326 0.348433810763889 0.3066666666666658 0.3066666666666658 +0.2613333333333333 0.9999389657750726 0.6666463216145847 1.59196386680752 0.999969482421875 0.3333231608072933 0.999969482421875 0.666666666666666 0.3519892578125001 0.3333333333333325 0.3333333333333325 +0.2666666666666667 0.9999389657750726 0.6399804687500015 1.578311366794804 0.999969482421875 0.2799914550781266 0.999969482421875 0.6799999999999993 0.3554024869791668 0.3599999999999992 0.3599999999999992 +0.272 0.9999389657750726 0.6133146158854181 1.565227720949285 0.999969482421875 0.2266597493489599 0.999969482421875 0.6933333333333326 0.358673498263889 0.3866666666666659 0.3866666666666659 +0.2773333333333333 0.9999389657750726 0.5866487630208349 1.552712929270962 0.999969482421875 0.1733280436197932 0.999969482421875 0.7066666666666659 0.3618022916666668 0.4133333333333326 0.4133333333333326 +0.2826666666666667 0.9999389657750726 0.5599829101562515 1.540766991759836 0.999969482421875 0.1199963378906266 0.999969482421875 0.7199999999999992 0.3647888671875001 0.4399999999999992 0.4399999999999992 +0.288 0.9999389657750726 0.5333170572916684 1.529389908415906 0.999969482421875 0.06666463216145988 0.999969482421875 0.7333333333333325 0.3676332248263891 0.4666666666666659 0.4666666666666659 +0.2933333333333334 0.9999389657750726 0.506651204427085 1.518581679239173 0.999969482421875 0.0133329264322932 0.999969482421875 0.7466666666666658 0.3703353645833335 0.4933333333333326 0.4933333333333326 +0.2986666666666667 0.9999389657750726 0.4799853515625018 1.508342304229636 0.0 0.03999877929687348 0.999969482421875 0.7599999999999991 0.3728952864583335 0.5199999999999992 0.5199999999999992 +0.304 0.9999389657750726 0.4533194986979185 1.498671783387296 0.0 0.09333048502604004 0.999969482421875 0.7733333333333325 0.375312990451389 0.5466666666666659 0.5466666666666659 +0.3093333333333334 0.9999389657750726 0.4266536458333352 1.489570116712152 0.0 0.1466621907552066 0.999969482421875 0.7866666666666657 0.3775884765625002 0.5733333333333325 0.5733333333333325 +0.3146666666666667 0.9999389657750726 0.3999877929687519 1.481037304204205 0.0 0.1999938964843732 0.999969482421875 0.799999999999999 0.3797217447916668 0.5999999999999991 0.5999999999999991 +0.32 0.9999389657750726 0.3733219401041686 1.473073345863454 0.0 0.2533256022135397 0.999969482421875 0.8133333333333324 0.381712795138889 0.6266666666666657 0.6266666666666657 +0.3253333333333333 0.9999389657750726 0.3466560872395854 1.4656782416899 0.0 0.3066573079427063 0.999969482421875 0.8266666666666657 0.3835616276041669 0.6533333333333323 0.6533333333333323 +0.3306666666666667 0.9999389657750726 0.3199902343750021 1.458851991683542 0.0 0.3599890136718729 0.999969482421875 0.839999999999999 0.3852682421875002 0.6799999999999989 0.6799999999999989 +0.336 0.9999389657750726 0.2933243815104188 1.452594595844381 0.0 0.4133207194010394 0.999969482421875 0.8533333333333323 0.3868326388888891 0.7066666666666656 0.7066666666666656 +0.3413333333333333 0.9999389657750726 0.2666585286458355 1.446906054172416 0.0 0.466652425130206 0.999969482421875 0.8666666666666655 0.3882548177083335 0.7333333333333321 0.7333333333333321 +0.3466666666666667 0.9999389657750726 0.2399926757812522 1.441786366667647 0.0 0.5199841308593726 0.999969482421875 0.8799999999999988 0.3895347786458335 0.7599999999999988 0.7599999999999988 +0.352 0.9999389657750726 0.2133268229166689 1.437235533330075 0.0 0.5733158365885391 0.999969482421875 0.8933333333333323 0.3906725217013891 0.7866666666666654 0.7866666666666654 +0.3573333333333333 0.9999389657750726 0.1866609700520856 1.4332535541597 0.0 0.6266475423177057 0.999969482421875 0.9066666666666656 0.3916680468750002 0.813333333333332 0.813333333333332 +0.3626666666666667 0.9999389657750726 0.1599951171875024 1.429840429156521 0.0 0.6799792480468723 0.999969482421875 0.9199999999999989 0.3925213541666669 0.8399999999999986 0.8399999999999986 +0.368 0.9999389657750726 0.1333292643229191 1.426996158320538 0.0 0.7333109537760389 0.999969482421875 0.9333333333333321 0.3932324435763892 0.8666666666666652 0.8666666666666652 +0.3733333333333333 0.9999389657750726 0.1066634114583358 1.424720741651752 0.0 0.7866426595052054 0.999969482421875 0.9466666666666654 0.393801315104167 0.8933333333333319 0.8933333333333319 +0.3786666666666667 0.9999389657750726 0.07999755859375251 1.423014179150163 0.0 0.8399743652343719 0.999969482421875 0.9599999999999987 0.3942279687500003 0.9199999999999985 0.9199999999999985 +0.384 0.9999389657750726 0.05333170572916924 1.42187647081577 0.0 0.8933060709635384 0.999969482421875 0.973333333333332 0.3945124045138892 0.9466666666666651 0.9466666666666651 +0.3893333333333333 0.9999389657750726 0.02666585286458595 1.421307616648573 0.0 0.9466377766927051 0.999969482421875 0.9866666666666653 0.3946546223958336 0.9733333333333317 0.9733333333333317 +0.3946666666666667 0.9999389657750726 6.103329360485077e-05 1.421306314644712 0.0 0.9999694824218716 0.999969482421875 0.999969482421875 0.3946549479067329 0.999999999999998 0.999999999999998 +0.4 0.9999389657750726 6.103329360485077e-05 1.42130501264085 0.999969482421875 0.9466377766927115 0.999969482421875 0.999969482421875 0.3946552734176321 0.02666666666666506 0.02666666666666506 +0.4053333333333333 0.9999389657750726 6.103329360485077e-05 1.421303710636988 0.999969482421875 0.8933060709635448 0.999969482421875 0.999969482421875 0.3946555989285314 0.05333333333333172 0.05333333333333172 +0.4106666666666666 0.9999389657750726 6.103329360485077e-05 1.421302408633126 0.999969482421875 0.8399743652343782 0.999969482421875 0.999969482421875 0.3946559244394306 0.07999999999999839 0.07999999999999839 +0.416 0.9999389657750726 6.103329360485077e-05 1.421301106629265 0.999969482421875 0.7866426595052117 0.999969482421875 0.999969482421875 0.3946562499503298 0.106666666666665 0.106666666666665 +0.4213333333333333 0.9999389657750726 6.103329360485077e-05 1.421299804625403 0.999969482421875 0.7333109537760448 0.999969482421875 0.999969482421875 0.3946565754612291 0.1333333333333317 0.1333333333333317 +0.4266666666666667 0.9999389657750726 6.103329360485077e-05 1.421298502621541 0.999969482421875 0.6799792480468783 0.999969482421875 0.999969482421875 0.3946569009721283 0.1599999999999984 0.1599999999999984 +0.432 0.9999389657750726 6.103329360485077e-05 1.42129720061768 0.999969482421875 0.6266475423177114 0.999969482421875 0.999969482421875 0.3946572264830275 0.1866666666666651 0.1866666666666651 +0.4373333333333333 0.9999389657750726 6.103329360485077e-05 1.421295898613818 0.999969482421875 0.5733158365885449 0.999969482421875 0.999969482421875 0.3946575519939268 0.2133333333333317 0.2133333333333317 +0.4426666666666667 0.9999389657750726 6.103329360485077e-05 1.421294596609956 0.999969482421875 0.5199841308593781 0.999969482421875 0.999969482421875 0.394657877504826 0.2399999999999984 0.2399999999999984 +0.448 0.9999389657750726 6.103329360485077e-05 1.421293294606095 0.999969482421875 0.4666524251302116 0.999969482421875 0.999969482421875 0.3946582030157252 0.2666666666666651 0.2666666666666651 +0.4533333333333333 0.9999389657750726 6.103329360485077e-05 1.421291992602233 0.999969482421875 0.4133207194010449 0.999969482421875 0.999969482421875 0.3946585285266245 0.2933333333333317 0.2933333333333317 +0.4586666666666667 0.9999389657750726 6.103329360485077e-05 1.421290690598371 0.999969482421875 0.3599890136718782 0.999969482421875 0.999969482421875 0.3946588540375237 0.3199999999999984 0.3199999999999984 +0.4640000000000001 0.9999389657750726 6.103329360485077e-05 1.421289388594509 0.999969482421875 0.3066573079427115 0.999969482421875 0.999969482421875 0.3946591795484229 0.3466666666666651 0.3466666666666651 +0.4693333333333333 0.9999389657750726 6.103329360485077e-05 1.421288086590648 0.999969482421875 0.2533256022135448 0.999969482421875 0.999969482421875 0.3946595050593222 0.3733333333333317 0.3733333333333317 +0.4746666666666667 0.9999389657750726 6.103329360485077e-05 1.421286784586786 0.999969482421875 0.1999938964843782 0.999969482421875 0.999969482421875 0.3946598305702214 0.3999999999999984 0.3999999999999984 +0.48 0.9999389657750726 6.103329360485077e-05 1.421285482582924 0.999969482421875 0.1466621907552115 0.999969482421875 0.999969482421875 0.3946601560811207 0.4266666666666651 0.4266666666666651 +0.4853333333333333 0.9999389657750726 6.103329360485077e-05 1.421284180579062 0.999969482421875 0.09333048502604482 0.999969482421875 0.999969482421875 0.3946604815920199 0.4533333333333317 0.4533333333333317 +0.4906666666666666 0.9999389657750726 6.103329360485077e-05 1.421282878575201 0.999969482421875 0.03999877929687814 0.999969482421875 0.999969482421875 0.3946608071029191 0.4799999999999985 0.4799999999999985 +0.496 0.9999389657750726 6.103329360485077e-05 1.421281576571339 0.0 0.01333292643228842 0.999969482421875 0.999969482421875 0.3946611326138184 0.506666666666665 0.506666666666665 +0.5013333333333333 0.9999389657750726 6.103329360485077e-05 1.421280274567477 0.0 0.066664632161455 0.999969482421875 0.999969482421875 0.3946614581247176 0.5333333333333316 0.5333333333333316 +0.5066666666666667 0.9999389657750726 6.103329360485077e-05 1.421278972563615 0.0 0.1199963378906216 0.999969482421875 0.999969482421875 0.3946617836356168 0.5599999999999983 0.5599999999999983 +0.512 0.9999389657750726 6.103329360485077e-05 1.421277670559754 0.0 0.1733280436197881 0.999969482421875 0.999969482421875 0.3946621091465161 0.5866666666666649 0.5866666666666649 +0.5173333333333333 0.9999389657750726 6.103329360485077e-05 1.421276368555892 0.0 0.2266597493489547 0.999969482421875 0.999969482421875 0.3946624346574153 0.6133333333333315 0.6133333333333315 +0.5226666666666667 0.9999389657750726 6.103329360485077e-05 1.42127506655203 0.0 0.2799914550781212 0.999969482421875 0.999969482421875 0.3946627601683145 0.6399999999999981 0.6399999999999981 +0.528 0.9999389657750726 6.103329360485077e-05 1.421273764548169 0.0 0.3333231608072878 0.999969482421875 0.999969482421875 0.3946630856792138 0.6666666666666647 0.6666666666666647 From ac02a2668e1f2844c2deaec542fe10c55ad1d22c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 21 May 2023 13:22:29 -0500 Subject: [PATCH 1107/1712] synthio: avoid exceptions inside get_buffer .. in case the items in lfos are not actually LFOs --- shared-module/synthio/Synthesizer.c | 6 ++++-- shared-module/synthio/__init__.c | 16 ++++++++++++---- shared-module/synthio/block.h | 1 + 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index f773f4d640..5371a67350 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -78,8 +78,10 @@ audioio_get_buffer_result_t synthio_synthesizer_get_buffer(synthio_synthesizer_o mp_obj_t iterable = mp_getiter(self->lfos, &iter_buf); mp_obj_t item; while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - synthio_block_slot_t slot; - synthio_block_assign_slot(item, &slot, MP_QSTR_arg); + if (!synthio_obj_is_block(item)) { + continue; + } + synthio_block_slot_t slot = { item }; (void)synthio_block_slot_get(&slot); } return GET_BUFFER_MORE_DATA; diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index bc81beadb3..85e98329fd 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -584,19 +584,27 @@ int32_t synthio_block_slot_get_scaled(synthio_block_slot_t *lfo_slot, mp_float_t return (int32_t)MICROPY_FLOAT_C_FUN(round)(MICROPY_FLOAT_C_FUN(ldexp)(value, 15)); } -void synthio_block_assign_slot(mp_obj_t obj, synthio_block_slot_t *slot, qstr arg_name) { - if (mp_proto_get(MP_QSTR_synthio_block, obj)) { +bool synthio_block_assign_slot_maybe(mp_obj_t obj, synthio_block_slot_t *slot) { + if (synthio_obj_is_block(obj)) { slot->obj = obj; - return; + return true; } mp_float_t value = MICROPY_FLOAT_CONST(0.); if (obj != mp_const_none && !mp_obj_get_float_maybe(obj, &value)) { - mp_raise_TypeError_varg(translate("%q must be of type %q, not %q"), arg_name, MP_QSTR_BlockInput, mp_obj_get_type_qstr(obj)); + return false; } slot->obj = mp_obj_new_float(value); + return true; } + +void synthio_block_assign_slot(mp_obj_t obj, synthio_block_slot_t *slot, qstr arg_name) { + if (!synthio_block_assign_slot_maybe(obj, slot)) { + mp_raise_TypeError_varg(translate("%q must be of type %q, not %q"), arg_name, MP_QSTR_BlockInput, mp_obj_get_type_qstr(obj)); + } +} + bool synthio_obj_is_block(mp_obj_t obj) { return mp_proto_get(MP_QSTR_synthio_block, obj); } diff --git a/shared-module/synthio/block.h b/shared-module/synthio/block.h index 9f7da06ab2..d89896ca61 100644 --- a/shared-module/synthio/block.h +++ b/shared-module/synthio/block.h @@ -56,4 +56,5 @@ int32_t synthio_block_slot_get_scaled(synthio_block_slot_t *block_slot, mp_float // Assign an object (which may be a float or a synthio_block_obj_t) to an block slot void synthio_block_assign_slot(mp_obj_t obj, synthio_block_slot_t *block_slot, qstr arg_name); +bool synthio_block_assign_slot_maybe(mp_obj_t obj, synthio_block_slot_t *block_slot); bool synthio_obj_is_block(mp_obj_t obj); From 18213c4e87c6a438f60ffe58acabd19382ec0514 Mon Sep 17 00:00:00 2001 From: David Sullivan Date: Sun, 21 May 2023 11:34:33 -0700 Subject: [PATCH 1108/1712] increment creation id --- ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk diff --git a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk new file mode 100644 index 0000000000..53852b59ad --- /dev/null +++ b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0x19881988 +CIRCUITPY_CREATION_ID = 0x00C30002 + +IDF_TARGET = esp32c3 + +CIRCUITPY_ESP_FLASH_MODE=qio +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=4MB From 612dbc050010cc1b4d050a66ba0588407b0c58e0 Mon Sep 17 00:00:00 2001 From: David Sullivan Date: Sun, 21 May 2023 11:34:54 -0700 Subject: [PATCH 1109/1712] update board name --- .../boards/lolin_c3_pico/mpconfigboard.h | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 ports/espressif/boards/lolin_c3_pico/mpconfigboard.h diff --git a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h new file mode 100644 index 0000000000..f5830f01c7 --- /dev/null +++ b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h @@ -0,0 +1,48 @@ +/* + * 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. + */ + +// Board setup + +#define MICROPY_HW_BOARD_NAME "Wemos Lolin C3 Pico" // from Wemos MP +#define MICROPY_HW_MCU_NAME "ESP32-C3FH4" // from Wemos MP + +// From Wemos C3 Mini Schematic +// https://www.wemos.cc/en/latest/_static/files/sch_c3_mini_v1.0.0.pdf +// And MP Config +// https://github.com/micropython/micropython/blob/master/ports/esp32/boards/LOLIN_C3_MINI +// Status LED +#define MICROPY_HW_NEOPIXEL (&pin_GPIO7) + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO6, .sda = &pin_GPIO5}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO10, .mosi = &pin_GPIO7, .miso = &pin_GPIO8}} + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} + +#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) From ebd7e29b987367d6c43547c929ebc44ba3891b94 Mon Sep 17 00:00:00 2001 From: David Sullivan Date: Sun, 21 May 2023 11:35:11 -0700 Subject: [PATCH 1110/1712] create files --- ports/espressif/boards/lolin_c3_pico/board.c | 29 +++++++ ports/espressif/boards/lolin_c3_pico/pins.c | 75 +++++++++++++++++++ .../espressif/boards/lolin_c3_pico/sdkconfig | 5 ++ 3 files changed, 109 insertions(+) create mode 100644 ports/espressif/boards/lolin_c3_pico/board.c create mode 100644 ports/espressif/boards/lolin_c3_pico/pins.c create mode 100644 ports/espressif/boards/lolin_c3_pico/sdkconfig diff --git a/ports/espressif/boards/lolin_c3_pico/board.c b/ports/espressif/boards/lolin_c3_pico/board.c new file mode 100644 index 0000000000..164430c88c --- /dev/null +++ b/ports/espressif/boards/lolin_c3_pico/board.c @@ -0,0 +1,29 @@ +/* + * 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lolin_c3_pico/pins.c b/ports/espressif/boards/lolin_c3_pico/pins.c new file mode 100644 index 0000000000..6b16020205 --- /dev/null +++ b/ports/espressif/boards/lolin_c3_pico/pins.c @@ -0,0 +1,75 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // C3 Mini Board + // Wemos Lolin C3 Mini Schematic + // https://www.wemos.cc/en/latest/_static/files/sch_c3_mini_v1.0.0.pdf + // Starting on Left side going counterclockwise + // MP Config + // https://github.com/micropython/micropython/blob/master/ports/esp32/boards/LOLIN_C3_MINI + // C3 Data Sheet + // https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO9) }, + + + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) }, + + { 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_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/lolin_c3_pico/sdkconfig b/ports/espressif/boards/lolin_c3_pico/sdkconfig new file mode 100644 index 0000000000..b801dac1e2 --- /dev/null +++ b/ports/espressif/boards/lolin_c3_pico/sdkconfig @@ -0,0 +1,5 @@ +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="lolin-c3-pico" +# end of LWIP From a64d66846bf45188d0eb9c9926cb056bd5263be5 Mon Sep 17 00:00:00 2001 From: David Sullivan Date: Sun, 21 May 2023 12:45:23 -0700 Subject: [PATCH 1111/1712] remove leftover files --- ports/espressif/boards/lolin_s3_mini/board.c | 31 ----- .../boards/lolin_s3_mini/mpconfigboard.h | 44 ------ .../boards/lolin_s3_mini/mpconfigboard.mk | 16 --- ports/espressif/boards/lolin_s3_mini/pins.c | 129 ------------------ .../espressif/boards/lolin_s3_mini/sdkconfig | 48 ------- 5 files changed, 268 deletions(-) delete mode 100644 ports/espressif/boards/lolin_s3_mini/board.c delete mode 100644 ports/espressif/boards/lolin_s3_mini/mpconfigboard.h delete mode 100644 ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk delete mode 100644 ports/espressif/boards/lolin_s3_mini/pins.c delete mode 100644 ports/espressif/boards/lolin_s3_mini/sdkconfig diff --git a/ports/espressif/boards/lolin_s3_mini/board.c b/ports/espressif/boards/lolin_s3_mini/board.c deleted file mode 100644 index ac27ce4970..0000000000 --- a/ports/espressif/boards/lolin_s3_mini/board.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 "shared-bindings/microcontroller/Pin.h" - -// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.h b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.h deleted file mode 100644 index 099cde306e..0000000000 --- a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 "LOLIN S3 MINI 4MB Flash 2MB PSRAM" -#define MICROPY_HW_MCU_NAME "ESP32S3" - -#define MICROPY_HW_NEOPIXEL (&pin_GPIO47) - -// #define MICROPY_HW_LED_STATUS (&pin_GPIO13) - -#define DEFAULT_I2C_BUS_SCL (&pin_GPIO36) -#define DEFAULT_I2C_BUS_SDA (&pin_GPIO35) - -#define DEFAULT_SPI_BUS_SCK (&pin_GPIO12) -#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO13) - -#define DEFAULT_UART_BUS_RX (&pin_GPIO44) -#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk deleted file mode 100644 index aae8f9dabb..0000000000 --- a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk +++ /dev/null @@ -1,16 +0,0 @@ -USB_VID = 0x303a -USB_PID = 0x8168 -USB_PRODUCT = "LOLIN S3 MINI 4MB Flash 2MB PSRAM" -USB_MANUFACTURER = "WEMOS" - -IDF_TARGET = esp32s3 - -CIRCUITPY_ESP_FLASH_MODE = qio -CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB - -OPTIMIZATION_FLAGS = -Os -CIRCUITPY_ESPCAMERA = 0 - -# Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel \ No newline at end of file diff --git a/ports/espressif/boards/lolin_s3_mini/pins.c b/ports/espressif/boards/lolin_s3_mini/pins.c deleted file mode 100644 index 76a0f7eea6..0000000000 --- a/ports/espressif/boards/lolin_s3_mini/pins.c +++ /dev/null @@ -1,129 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -STATIC const mp_rom_map_elem_t board_module_globals_table[] = { - CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS - - { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, - - { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO1) }, - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, - - { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, - - { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, - - { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, - - { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO5) }, - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, - - { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO6) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, - - { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, - - - { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, - - { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, - - { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, - { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO10) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, - - { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, - - - { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO12) }, - { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_GPIO12) }, - { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, - - { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, - - { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_A13), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, - - { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_A14), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, - - { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, - - { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, - { MP_ROM_QSTR(MP_QSTR_A16), MP_ROM_PTR(&pin_GPIO17) }, - { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, - - { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_A17), MP_ROM_PTR(&pin_GPIO18) }, - { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, - - { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, - - { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, - { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, - - { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) }, - { MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_GPIO34) }, - - { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, - { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, - - { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, - { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, - - { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, - { MP_ROM_QSTR(MP_QSTR_D47), MP_ROM_PTR(&pin_GPIO47) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO47) }, - - - { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO35) }, - { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, - - { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO36) }, - { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, - - - { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, - { MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_GPIO43) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, - - { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, - { MP_ROM_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_GPIO44) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, - - { 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_UART), MP_ROM_PTR(&board_uart_obj) } -}; -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/lolin_s3_mini/sdkconfig b/ports/espressif/boards/lolin_s3_mini/sdkconfig deleted file mode 100644 index d7d73360d8..0000000000 --- a/ports/espressif/boards/lolin_s3_mini/sdkconfig +++ /dev/null @@ -1,48 +0,0 @@ -# -# Component config -# -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# -# SPI RAM config -# -# CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -# CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_MODE_OCT=y -# end of SPI RAM config - -# end of ESP32S3-Specific - -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="LOLIN-S3-MINI" -# end of LWIP - -# end of Component config From 0a1b2f87714d2bf57c17b3f8d6fcdf6d066046d9 Mon Sep 17 00:00:00 2001 From: David Sullivan Date: Sun, 21 May 2023 14:30:51 -0700 Subject: [PATCH 1112/1712] include neopixel lib --- ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk index 53852b59ad..a202fd8ad3 100644 --- a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk @@ -6,3 +6,6 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE=qio CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel From 4d60c4608ebadba85e049b740d7996dc0c7908a3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 21 May 2023 17:49:30 -0500 Subject: [PATCH 1113/1712] synthio: doc fixes --- shared-bindings/synthio/Math.c | 2 ++ shared-bindings/synthio/Synthesizer.c | 2 +- shared-bindings/synthio/__init__.c | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/shared-bindings/synthio/Math.c b/shared-bindings/synthio/Math.c index 22efbc0489..57902b0dd0 100644 --- a/shared-bindings/synthio/Math.c +++ b/shared-bindings/synthio/Math.c @@ -54,6 +54,8 @@ MAKE_ENUM_VALUE(synthio_math_operation_type, math_op, ABS, OP_ABS); //| class MathOperation: //| """Operation for a Math block""" //| +//| def __call__(self, a: BlockInput, b: BlockInput = 0.0, c: BlockInput = 1.0) -> Math: +//| """A MathOperation enumeration value can be called to construct a Math block that performs that operation""" //| SUM: "MathOperation" //| """Computes ``a+b+c``. For 2-input sum, set one argument to ``0.0``. To hold a control value for multiple subscribers, set two arguments to ``0.0``.""" //| diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index 183284f015..3cfea307d1 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -275,7 +275,7 @@ MP_PROPERTY_GETTER(synthio_synthesizer_pressed_obj, //| //| This can be used to implement 'free-running' LFOs. LFOs associated with playing notes are advanced whether or not they are in this list. //| -//| This property is read-only but its contents may be modified by e.g., calling ``synth.lfos.append()` or ``synth.lfos.remove(). It is initially an empty list.""" +//| This property is read-only but its contents may be modified by e.g., calling ``synth.lfos.append()`` or ``synth.lfos.remove()``. It is initially an empty list.""" //| STATIC mp_obj_t synthio_synthesizer_obj_get_lfos(mp_obj_t self_in) { synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 18a7e8043e..82d251e60a 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -65,7 +65,10 @@ static const mp_arg_t envelope_properties[] = { //| """ //| //| BlockInput = Union["Math", "LFO", float, None] -//| """Blocks and Notes can take any of these types as inputs on certain attributes""" +//| """Blocks and Notes can take any of these types as inputs on certain attributes +//| +//| A BlockInput can be any of the following types: `Math`, `LFO`, `float`, `None` (treated same as 0). +//| """ //| //| class Envelope: //| def __init__( From 955d2723d0ed924d8637e991819b9ac69bfa58de Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 21 May 2023 19:05:25 -0400 Subject: [PATCH 1114/1712] RP2040 SleepMemory --- .../common-hal/alarm/SleepMemory.c | 41 ++++++++++++++++--- .../common-hal/alarm/SleepMemory.h | 2 + 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/ports/raspberrypi/common-hal/alarm/SleepMemory.c b/ports/raspberrypi/common-hal/alarm/SleepMemory.c index 1f0dddfc51..8cb684faa3 100644 --- a/ports/raspberrypi/common-hal/alarm/SleepMemory.c +++ b/ports/raspberrypi/common-hal/alarm/SleepMemory.c @@ -30,18 +30,47 @@ #include "common-hal/alarm/SleepMemory.h" #include "shared-bindings/alarm/SleepMemory.h" -void alarm_sleep_memory_reset(void) { -} +__attribute__((section(".uninitialized"))) static uint8_t _sleepmem[SLEEP_MEMORY_LENGTH]; +__attribute__((section(".uninitialized"))) static uint32_t _sleepmem_magicnum; +#define SLEEP_MEMORY_DATA_GUARD 0xad0000af +#define SLEEP_MEMORY_DATA_GUARD_MASK 0xff0000ff -uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self) { +static int is_sleep_memory_valid(void) { + if ((_sleepmem_magicnum & SLEEP_MEMORY_DATA_GUARD_MASK) + == SLEEP_MEMORY_DATA_GUARD) { + return 1; + } return 0; } +static void initialize_sleep_memory(void) { + memset((uint8_t *)_sleepmem, 0, SLEEP_MEMORY_LENGTH); + + _sleepmem_magicnum = SLEEP_MEMORY_DATA_GUARD; +} + +void alarm_sleep_memory_reset(void) { + if (!is_sleep_memory_valid()) { + initialize_sleep_memory(); + } +} + +uint32_t common_hal_alarm_sleep_memory_get_length(alarm_sleep_memory_obj_t *self) { + return sizeof(_sleepmem); +} + bool common_hal_alarm_sleep_memory_set_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, const uint8_t *values, uint32_t len) { - mp_raise_NotImplementedError(translate("Sleep Memory not available")); - return false; + if (start_index + len > sizeof(_sleepmem)) { + return false; + } + + memcpy((uint8_t *)(_sleepmem + start_index), values, len); + return true; } void common_hal_alarm_sleep_memory_get_bytes(alarm_sleep_memory_obj_t *self, uint32_t start_index, uint8_t *values, uint32_t len) { - mp_raise_NotImplementedError(translate("Sleep Memory not available")); + if (start_index + len > sizeof(_sleepmem)) { + return; + } + memcpy(values, (uint8_t *)(_sleepmem + start_index), len); } diff --git a/ports/raspberrypi/common-hal/alarm/SleepMemory.h b/ports/raspberrypi/common-hal/alarm/SleepMemory.h index 14848cd5a0..591801dfdb 100644 --- a/ports/raspberrypi/common-hal/alarm/SleepMemory.h +++ b/ports/raspberrypi/common-hal/alarm/SleepMemory.h @@ -28,6 +28,8 @@ #include "py/obj.h" +#define SLEEP_MEMORY_LENGTH (256) + typedef struct { mp_obj_base_t base; } alarm_sleep_memory_obj_t; From 4f671dab6f317019e63b3159e86a4bc5f1d5fc55 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 21 May 2023 19:15:34 -0500 Subject: [PATCH 1115/1712] synthio: one more doc fix --- shared-bindings/synthio/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 82d251e60a..f3ba3e73a9 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -67,7 +67,7 @@ static const mp_arg_t envelope_properties[] = { //| BlockInput = Union["Math", "LFO", float, None] //| """Blocks and Notes can take any of these types as inputs on certain attributes //| -//| A BlockInput can be any of the following types: `Math`, `LFO`, `float`, `None` (treated same as 0). +//| A BlockInput can be any of the following types: `Math`, `LFO`, `builtins.float`, `None` (treated same as 0). //| """ //| //| class Envelope: From 73299ae48c49c71592337e7fddcb3979e5015611 Mon Sep 17 00:00:00 2001 From: Christopher Hoover Date: Sun, 21 May 2023 17:42:30 -0700 Subject: [PATCH 1116/1712] Adds new board for MIMRT1060-EVKB (not to be confused with MIMRT1060-EVK). --- .../mimxrt10xx/boards/imxrt1060_evkb/board.c | 58 +++++++ .../boards/imxrt1060_evkb/flash_config.c | 143 ++++++++++++++++++ .../boards/imxrt1060_evkb/mpconfigboard.h | 25 +++ .../boards/imxrt1060_evkb/mpconfigboard.mk | 10 ++ ports/mimxrt10xx/boards/imxrt1060_evkb/pins.c | 140 +++++++++++++++++ 5 files changed, 376 insertions(+) create mode 100644 ports/mimxrt10xx/boards/imxrt1060_evkb/board.c create mode 100644 ports/mimxrt10xx/boards/imxrt1060_evkb/flash_config.c create mode 100644 ports/mimxrt10xx/boards/imxrt1060_evkb/mpconfigboard.h create mode 100644 ports/mimxrt10xx/boards/imxrt1060_evkb/mpconfigboard.mk create mode 100644 ports/mimxrt10xx/boards/imxrt1060_evkb/pins.c diff --git a/ports/mimxrt10xx/boards/imxrt1060_evkb/board.c b/ports/mimxrt10xx/boards/imxrt1060_evkb/board.c new file mode 100644 index 0000000000..4a2e6e0913 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1060_evkb/board.c @@ -0,0 +1,58 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * + * 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 "shared-bindings/microcontroller/Pin.h" + +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { + // SWD Pins + &pin_GPIO_AD_B0_06, // SWDIO + &pin_GPIO_AD_B0_07, // SWCLK + + // FLEX flash + &pin_GPIO_SD_B1_00, + &pin_GPIO_SD_B1_01, + &pin_GPIO_SD_B1_02, + &pin_GPIO_SD_B1_03, + &pin_GPIO_SD_B1_04, + &pin_GPIO_SD_B1_05, + &pin_GPIO_SD_B1_06, + &pin_GPIO_SD_B1_07, + &pin_GPIO_SD_B1_08, + &pin_GPIO_SD_B1_09, + &pin_GPIO_SD_B1_10, + &pin_GPIO_SD_B1_11, + + // USB Pins + &pin_GPIO_AD_B0_01, // ID Pin + &pin_GPIO_AD_B0_03, // OC/Fault Pin + NULL, // Must end in NULL. +}; + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/imxrt1060_evkb/flash_config.c b/ports/mimxrt10xx/boards/imxrt1060_evkb/flash_config.c new file mode 100644 index 0000000000..c75174d1c4 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1060_evkb/flash_config.c @@ -0,0 +1,143 @@ +/* + * Copyright 2017 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "boards/flash_config.h" + +#include "xip/fsl_flexspi_nor_boot.h" + +// Config for IS25WP064A with QSPI routed. +__attribute__((section(".boot_hdr.conf"))) +const flexspi_nor_config_t qspiflash_config = { + .pageSize = 256u, + .sectorSize = 4u * 1024u, + .ipcmdSerialClkFreq = kFLEXSPISerialClk_30MHz, + .blockSize = 0x00010000, + .isUniformBlockSize = false, + .memConfig = + { + .tag = FLEXSPI_CFG_BLK_TAG, + .version = FLEXSPI_CFG_BLK_VERSION, + .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromDqsPad, + .csHoldTime = 3u, + .csSetupTime = 3u, + + .busyOffset = 0u, // Status bit 0 indicates busy. + .busyBitPolarity = 0u, // Busy when the bit is 1. + + .deviceModeCfgEnable = 1u, + .deviceModeType = kDeviceConfigCmdType_QuadEnable, + .deviceModeSeq = { + .seqId = 4u, + .seqNum = 1u, + }, + .deviceModeArg = 0x40, + .deviceType = kFLEXSPIDeviceType_SerialNOR, + .sflashPadType = kSerialFlash_4Pads, + .serialClkFreq = kFLEXSPISerialClk_60MHz, + .sflashA1Size = FLASH_SIZE, + .lookupTable = + { + // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) + // The high 16 bits is command 1 and the low are command 0. + // Within a command, the top 6 bits are the opcode, the next two are the number + // of pads and then last byte is the operand. The operand's meaning changes + // per opcode. + + // Indices with ROM should always have the same function because the ROM + // bootloader uses it. + + // 0: ROM: Read LUTs + // Quad version + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, + RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), + FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, + READ_SDR, FLEXSPI_4PAD, 0x04), + // Single fast read version, good for debugging. + // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, + // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, + // READ_SDR, FLEXSPI_1PAD, 0x04), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 1: ROM: Read status + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, + READ_SDR, FLEXSPI_1PAD, 0x02), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 2: Empty + EMPTY_SEQUENCE, + + // 3: ROM: Write Enable + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, + STOP, FLEXSPI_1PAD, 0x00), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 4: Config: Write Status + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01 /* the command to send */, + WRITE_SDR, FLEXSPI_1PAD, 0x01), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 5: ROM: Erase Sector + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 6: Empty + EMPTY_SEQUENCE, + + // 7: Empty + EMPTY_SEQUENCE, + + // 8: Block Erase + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 9: ROM: Page program + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + + FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, + STOP, FLEXSPI_1PAD, 0), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 10: Empty + EMPTY_SEQUENCE, + + // 11: ROM: Chip erase + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, + STOP, FLEXSPI_1PAD, 0), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 12: Empty + EMPTY_SEQUENCE, + + // 13: ROM: Read SFDP + EMPTY_SEQUENCE, + + // 14: ROM: Restore no cmd + EMPTY_SEQUENCE, + + // 15: ROM: Dummy + EMPTY_SEQUENCE + }, + }, +}; diff --git a/ports/mimxrt10xx/boards/imxrt1060_evkb/mpconfigboard.h b/ports/mimxrt10xx/boards/imxrt1060_evkb/mpconfigboard.h new file mode 100644 index 0000000000..8f439080cb --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1060_evkb/mpconfigboard.h @@ -0,0 +1,25 @@ +#define MICROPY_HW_BOARD_NAME "iMX RT 1060 EVKB" +#define MICROPY_HW_MCU_NAME "IMXRT1062DVJ6A" + +// If you change this, then make sure to update the linker scripts as well to +// make sure you don't overwrite code +#define CIRCUITPY_INTERNAL_NVM_SIZE 0 + +#define BOARD_FLASH_SIZE (8 * 1024 * 1024) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO_AD_B0_08) +#define MICROPY_HW_LED_STATUS_INVERTED (1) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO_AD_B1_00) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO_AD_B1_01) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO_AD_B1_07) +#define DEFAULT_UART_BUS_TX (&pin_GPIO_AD_B1_06) + +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO_AD_B0_12) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO_AD_B0_13) + +// Put host on the first USB so that right angle OTG adapters can fit. This is +// the right port when looking at the board. +#define CIRCUITPY_USB_DEVICE_INSTANCE 1 +#define CIRCUITPY_USB_HOST_INSTANCE 0 diff --git a/ports/mimxrt10xx/boards/imxrt1060_evkb/mpconfigboard.mk b/ports/mimxrt10xx/boards/imxrt1060_evkb/mpconfigboard.mk new file mode 100644 index 0000000000..c70865ebd6 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1060_evkb/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x239A +USB_PID = 0x8084 +USB_PRODUCT = "iMX RT 1060 EVKB" +USB_MANUFACTURER = "NXP" + +CHIP_VARIANT = MIMXRT1062DVJ6A +CHIP_FAMILY = MIMXRT1062 +FLASH = IS25WP064A + +CIRCUITPY_USB_HOST = 1 diff --git a/ports/mimxrt10xx/boards/imxrt1060_evkb/pins.c b/ports/mimxrt10xx/boards/imxrt1060_evkb/pins.c new file mode 100644 index 0000000000..f19b24db37 --- /dev/null +++ b/ports/mimxrt10xx/boards/imxrt1060_evkb/pins.c @@ -0,0 +1,140 @@ +#include "shared-bindings/board/__init__.h" + +#include "supervisor/board.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_AD_B1_07) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO_AD_B1_07) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO_AD_B1_06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO_AD_B1_06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO_AD_B0_11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO_AD_B1_08) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO_AD_B0_09) }, // Connected to audio codec + { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO_AD_B0_10) }, // Connected to audio codec + { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO_AD_B1_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO_AD_B1_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO_AD_B0_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO_AD_B0_02) }, // Connected to audio codec + { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO_SD_B0_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO_SD_B0_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO_SD_B0_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO_SD_B0_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO_AD_B1_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO_AD_B1_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO_AD_B1_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO_AD_B1_00) }, + + // i2c sensor is on I2C1_SCL/SDA + + { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO_AD_B1_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO_AD_B1_11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO_AD_B1_04) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO_AD_B1_05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO_AD_B1_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO_AD_B1_00) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_USER_LED), MP_ROM_PTR(&pin_GPIO_AD_B0_08) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO_AD_B0_08) }, + + // Camera Sensor Interface + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_VSYNC), MP_ROM_PTR(&pin_GPIO_AD_B1_06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_PWDN), MP_ROM_PTR(&pin_GPIO_AD_B1_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_HSYNC), MP_ROM_PTR(&pin_GPIO_AD_B1_07) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D9), MP_ROM_PTR(&pin_GPIO_AD_B1_08) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_MCLK), MP_ROM_PTR(&pin_GPIO_AD_B1_05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D8), MP_ROM_PTR(&pin_GPIO_AD_B1_09) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D7), MP_ROM_PTR(&pin_GPIO_AD_B1_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_PIXCLK), MP_ROM_PTR(&pin_GPIO_AD_B1_04) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D6), MP_ROM_PTR(&pin_GPIO_AD_B1_11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D2), MP_ROM_PTR(&pin_GPIO_AD_B1_15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D5), MP_ROM_PTR(&pin_GPIO_AD_B1_12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D3), MP_ROM_PTR(&pin_GPIO_AD_B1_14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_CSI_D4), MP_ROM_PTR(&pin_GPIO_AD_B1_13) }, + + // SD Card + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CLK), MP_ROM_PTR(&pin_GPIO_SD_B0_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_SW), MP_ROM_PTR(&pin_GPIO_B1_12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CMD), MP_ROM_PTR(&pin_GPIO_SD_B0_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_D0), MP_ROM_PTR(&pin_GPIO_SD_B0_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_D1), MP_ROM_PTR(&pin_GPIO_SD_B0_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_D2), MP_ROM_PTR(&pin_GPIO_SD_B0_04) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_D3), MP_ROM_PTR(&pin_GPIO_SD_B0_05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_PWREN), MP_ROM_PTR(&pin_GPIO_AD_B1_03) }, + + // LCD Interface + { MP_ROM_QSTR(MP_QSTR_LCD_BACKLIGHT), MP_ROM_PTR(&pin_GPIO_B1_15) }, + { MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO_AD_B0_02) }, + { MP_ROM_QSTR(MP_QSTR_LCD_ENABLE), MP_ROM_PTR(&pin_GPIO_B0_01) }, + { MP_ROM_QSTR(MP_QSTR_LCD_VSYNC), MP_ROM_PTR(&pin_GPIO_B0_03) }, + { MP_ROM_QSTR(MP_QSTR_LCD_HSYNC), MP_ROM_PTR(&pin_GPIO_B0_02) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CLK), MP_ROM_PTR(&pin_GPIO_B0_00) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D0), MP_ROM_PTR(&pin_GPIO_B0_04) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D1), MP_ROM_PTR(&pin_GPIO_B0_05) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D2), MP_ROM_PTR(&pin_GPIO_B0_06) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D3), MP_ROM_PTR(&pin_GPIO_B0_07) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D4), MP_ROM_PTR(&pin_GPIO_B0_08) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D5), MP_ROM_PTR(&pin_GPIO_B0_09) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D6), MP_ROM_PTR(&pin_GPIO_B0_10) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D7), MP_ROM_PTR(&pin_GPIO_B0_11) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D8), MP_ROM_PTR(&pin_GPIO_B0_12) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D9), MP_ROM_PTR(&pin_GPIO_B0_13) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D10), MP_ROM_PTR(&pin_GPIO_B0_14) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D11), MP_ROM_PTR(&pin_GPIO_B0_15) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D12), MP_ROM_PTR(&pin_GPIO_B1_00) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D13), MP_ROM_PTR(&pin_GPIO_B1_01) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D14), MP_ROM_PTR(&pin_GPIO_B1_02) }, + { MP_ROM_QSTR(MP_QSTR_LCD_D15), MP_ROM_PTR(&pin_GPIO_B1_03) }, + + // Touch Interface + { MP_ROM_QSTR(MP_QSTR_LCD_TOUCH_INT), MP_ROM_PTR(&pin_GPIO_AD_B0_11) }, + + // Audio Interface + { MP_ROM_QSTR(MP_QSTR_AUDIO_INT), MP_ROM_PTR(&pin_GPIO_AD_B1_08) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_SYNC), MP_ROM_PTR(&pin_GPIO_AD_B1_15) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_BCLK), MP_ROM_PTR(&pin_GPIO_AD_B1_14) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_RXD), MP_ROM_PTR(&pin_GPIO_AD_B1_12) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_TXD), MP_ROM_PTR(&pin_GPIO_AD_B1_13) }, + { MP_ROM_QSTR(MP_QSTR_AUDIO_MCLK), MP_ROM_PTR(&pin_GPIO_AD_B1_09) }, + + // SPDIF + { MP_ROM_QSTR(MP_QSTR_SPDIF_IN), MP_ROM_PTR(&pin_GPIO_AD_B1_03) }, + { MP_ROM_QSTR(MP_QSTR_SPDIF_OUT), MP_ROM_PTR(&pin_GPIO_AD_B1_02) }, + + // Ethernet + { MP_ROM_QSTR(MP_QSTR_ETHERNET_MDIO), MP_ROM_PTR(&pin_GPIO_EMC_41) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_MDC), MP_ROM_PTR(&pin_GPIO_EMC_40) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_RXD0), MP_ROM_PTR(&pin_GPIO_B1_04) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_RXD1), MP_ROM_PTR(&pin_GPIO_B1_05) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_CRS_DV), MP_ROM_PTR(&pin_GPIO_B1_06) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_TXD0), MP_ROM_PTR(&pin_GPIO_B1_07) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_TXD1), MP_ROM_PTR(&pin_GPIO_B1_08) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_TXEN), MP_ROM_PTR(&pin_GPIO_B1_09) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_INT), MP_ROM_PTR(&pin_GPIO_AD_B0_10) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_RST), MP_ROM_PTR(&pin_GPIO_AD_B0_09) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_CLK), MP_ROM_PTR(&pin_GPIO_B1_10) }, + { MP_ROM_QSTR(MP_QSTR_ETHERNET_RXER), MP_ROM_PTR(&pin_GPIO_B1_11) }, + + // Freelink UART + { MP_ROM_QSTR(MP_QSTR_FREELINK_TX), MP_ROM_PTR(&pin_GPIO_AD_B0_12) }, + { MP_ROM_QSTR(MP_QSTR_FREELINK_RX), MP_ROM_PTR(&pin_GPIO_AD_B0_13) }, + + // CAN + { MP_ROM_QSTR(MP_QSTR_CAN_TX), MP_ROM_PTR(&pin_GPIO_AD_B0_14) }, + { MP_ROM_QSTR(MP_QSTR_CAN_RX), MP_ROM_PTR(&pin_GPIO_AD_B0_15) }, + { MP_ROM_QSTR(MP_QSTR_CAN_STBY), MP_ROM_PTR(&pin_GPIO_AD_B0_05) }, + + // USB + #if CIRCUITPY_USB_HOST_INSTANCE == 0 + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DP), MP_ROM_PTR(&pin_USB_OTG1_DP) }, + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DM), MP_ROM_PTR(&pin_USB_OTG1_DN) }, + #elif CIRCUITPY_USB_HOST_INSTANCE == 1 + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DP), MP_ROM_PTR(&pin_USB_OTG2_DP) }, + { MP_ROM_QSTR(MP_QSTR_USB_HOST_DM), MP_ROM_PTR(&pin_USB_OTG2_DN) }, + #endif + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 393c0bb1f64e79f5234b4fce1ae1ebb01c80c536 Mon Sep 17 00:00:00 2001 From: David Sullivan Date: Sun, 21 May 2023 23:27:58 -0700 Subject: [PATCH 1117/1712] move sck, scl, and sda pin assignments --- ports/espressif/boards/lolin_c3_pico/pins.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ports/espressif/boards/lolin_c3_pico/pins.c b/ports/espressif/boards/lolin_c3_pico/pins.c index 6b16020205..d36c9f9b14 100644 --- a/ports/espressif/boards/lolin_c3_pico/pins.c +++ b/ports/espressif/boards/lolin_c3_pico/pins.c @@ -15,10 +15,12 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO2) }, @@ -27,7 +29,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, @@ -37,11 +38,9 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, @@ -50,15 +49,15 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO9) }, { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO20) }, From 3790fd4117cadd0496cedf9c102e9241bfdd86d4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 22 May 2023 10:21:46 -0500 Subject: [PATCH 1118/1712] synthio: Add tests of all synthio math blocks I plotted and eyeballed these and they all looked plausible --- tests/circuitpython/synth_block_abs.py | 3 + tests/circuitpython/synth_block_abs.py.exp | 188 ++++++++++++++++++ tests/circuitpython/synth_block_add_div.py | 3 + .../circuitpython/synth_block_add_div.py.exp | 188 ++++++++++++++++++ tests/circuitpython/synth_block_add_sub.py | 3 + .../circuitpython/synth_block_add_sub.py.exp | 188 ++++++++++++++++++ .../synth_block_constrained_lerp.py | 3 + .../synth_block_constrained_lerp.py.exp | 188 ++++++++++++++++++ tests/circuitpython/synth_block_div_add.py | 3 + .../circuitpython/synth_block_div_add.py.exp | 188 ++++++++++++++++++ tests/circuitpython/synth_block_lerp.py | 3 + tests/circuitpython/synth_block_lerp.py.exp | 188 ++++++++++++++++++ tests/circuitpython/synth_block_max.py | 3 + tests/circuitpython/synth_block_max.py.exp | 188 ++++++++++++++++++ tests/circuitpython/synth_block_mid.py | 3 + tests/circuitpython/synth_block_mid.py.exp | 188 ++++++++++++++++++ tests/circuitpython/synth_block_min.py | 3 + tests/circuitpython/synth_block_min.py.exp | 188 ++++++++++++++++++ tests/circuitpython/synth_block_mul_div.py | 3 + .../circuitpython/synth_block_mul_div.py.exp | 188 ++++++++++++++++++ .../circuitpython/synth_block_offset_scale.py | 3 + .../synth_block_offset_scale.py.exp | 188 ++++++++++++++++++ tests/circuitpython/synth_block_product.py | 3 + .../circuitpython/synth_block_product.py.exp | 188 ++++++++++++++++++ .../circuitpython/synth_block_scale_offset.py | 3 + .../synth_block_scale_offset.py.exp | 188 ++++++++++++++++++ tests/circuitpython/synth_block_sum.py | 3 + tests/circuitpython/synth_block_sum.py.exp | 188 ++++++++++++++++++ tests/run-tests.py | 1 + tests/testlib/synthblockhelper.py | 29 +++ 30 files changed, 2704 insertions(+) create mode 100644 tests/circuitpython/synth_block_abs.py create mode 100644 tests/circuitpython/synth_block_abs.py.exp create mode 100644 tests/circuitpython/synth_block_add_div.py create mode 100644 tests/circuitpython/synth_block_add_div.py.exp create mode 100644 tests/circuitpython/synth_block_add_sub.py create mode 100644 tests/circuitpython/synth_block_add_sub.py.exp create mode 100644 tests/circuitpython/synth_block_constrained_lerp.py create mode 100644 tests/circuitpython/synth_block_constrained_lerp.py.exp create mode 100644 tests/circuitpython/synth_block_div_add.py create mode 100644 tests/circuitpython/synth_block_div_add.py.exp create mode 100644 tests/circuitpython/synth_block_lerp.py create mode 100644 tests/circuitpython/synth_block_lerp.py.exp create mode 100644 tests/circuitpython/synth_block_max.py create mode 100644 tests/circuitpython/synth_block_max.py.exp create mode 100644 tests/circuitpython/synth_block_mid.py create mode 100644 tests/circuitpython/synth_block_mid.py.exp create mode 100644 tests/circuitpython/synth_block_min.py create mode 100644 tests/circuitpython/synth_block_min.py.exp create mode 100644 tests/circuitpython/synth_block_mul_div.py create mode 100644 tests/circuitpython/synth_block_mul_div.py.exp create mode 100644 tests/circuitpython/synth_block_offset_scale.py create mode 100644 tests/circuitpython/synth_block_offset_scale.py.exp create mode 100644 tests/circuitpython/synth_block_product.py create mode 100644 tests/circuitpython/synth_block_product.py.exp create mode 100644 tests/circuitpython/synth_block_scale_offset.py create mode 100644 tests/circuitpython/synth_block_scale_offset.py.exp create mode 100644 tests/circuitpython/synth_block_sum.py create mode 100644 tests/circuitpython/synth_block_sum.py.exp create mode 100644 tests/testlib/synthblockhelper.py diff --git a/tests/circuitpython/synth_block_abs.py b/tests/circuitpython/synth_block_abs.py new file mode 100644 index 0000000000..9ec87bfc50 --- /dev/null +++ b/tests/circuitpython/synth_block_abs.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.ABS) diff --git a/tests/circuitpython/synth_block_abs.py.exp b/tests/circuitpython/synth_block_abs.py.exp new file mode 100644 index 0000000000..4adc879ea6 --- /dev/null +++ b/tests/circuitpython/synth_block_abs.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 1.978606282552083 3.0 2.0 +-1.957273600260416 1.957273600260416 3.0 2.0 +-1.93594091796875 1.93594091796875 3.0 2.0 +-1.914608235677083 1.914608235677083 3.0 2.0 +-1.893275553385417 1.893275553385417 3.0 2.0 +-1.87194287109375 1.87194287109375 3.0 2.0 +-1.850610188802083 1.850610188802083 3.0 2.0 +-1.829277506510417 1.829277506510417 3.0 2.0 +-1.80794482421875 1.80794482421875 3.0 2.0 +-1.786612141927083 1.786612141927083 3.0 2.0 +-1.765279459635417 1.765279459635417 3.0 2.0 +-1.74394677734375 1.74394677734375 3.0 2.0 +-1.722614095052083 1.722614095052083 3.0 2.0 +-1.701281412760417 1.701281412760417 3.0 2.0 +-1.67994873046875 1.67994873046875 3.0 2.0 +-1.658616048177083 1.658616048177083 3.0 2.0 +-1.637283365885417 1.637283365885417 3.0 2.0 +-1.61595068359375 1.61595068359375 3.0 2.0 +-1.594618001302083 1.594618001302083 3.0 2.0 +-1.573285319010417 1.573285319010417 3.0 2.0 +-1.55195263671875 1.55195263671875 3.0 2.0 +-1.530619954427083 1.530619954427083 3.0 2.0 +-1.509287272135417 1.509287272135417 3.0 2.0 +-1.48795458984375 1.48795458984375 3.0 2.0 +-1.466621907552084 1.466621907552084 3.0 2.0 +-1.445289225260417 1.445289225260417 3.0 2.0 +-1.42395654296875 1.42395654296875 3.0 2.0 +-1.402623860677084 1.402623860677084 3.0 2.0 +-1.381291178385417 1.381291178385417 3.0 2.0 +-1.35995849609375 1.35995849609375 3.0 2.0 +-1.338625813802083 1.338625813802083 3.0 2.0 +-1.317293131510417 1.317293131510417 3.0 2.0 +-1.29596044921875 1.29596044921875 3.0 2.0 +-1.274627766927084 1.274627766927084 3.0 2.0 +-1.253295084635417 1.253295084635417 3.0 2.0 +-1.23196240234375 1.23196240234375 3.0 2.0 +-1.210629720052084 1.210629720052084 3.0 2.0 +-1.189297037760417 1.189297037760417 3.0 2.0 +-1.16796435546875 1.16796435546875 3.0 2.0 +-1.146631673177084 1.146631673177084 3.0 2.0 +-1.125298990885417 1.125298990885417 3.0 2.0 +-1.10396630859375 1.10396630859375 3.0 2.0 +-1.082633626302084 1.082633626302084 3.0 2.0 +-1.061300944010417 1.061300944010417 3.0 2.0 +-1.039968261718751 1.039968261718751 3.0 2.0 +-1.018635579427084 1.018635579427084 3.0 2.0 +-0.9973028971354172 0.9973028971354172 3.0 2.0 +-0.9759702148437505 0.9759702148437505 3.0 2.0 +-0.9546375325520838 0.9546375325520838 3.0 2.0 +-0.9333048502604168 0.9333048502604168 3.0 2.0 +-0.9119721679687501 0.9119721679687501 3.0 2.0 +-0.8906394856770833 0.8906394856770833 3.0 2.0 +-0.8693068033854166 0.8693068033854166 3.0 2.0 +-0.8479741210937499 0.8479741210937499 3.0 2.0 +-0.8266414388020831 0.8266414388020831 3.0 2.0 +-0.8053087565104164 0.8053087565104164 3.0 2.0 +-0.7839760742187497 0.7839760742187497 3.0 2.0 +-0.7626433919270829 0.7626433919270829 3.0 2.0 +-0.7413107096354159 0.7413107096354159 3.0 2.0 +-0.7199780273437493 0.7199780273437493 3.0 2.0 +-0.6986453450520828 0.6986453450520828 3.0 2.0 +-0.6773126627604157 0.6773126627604157 3.0 2.0 +-0.6559799804687488 0.6559799804687488 3.0 2.0 +-0.6346472981770823 0.6346472981770823 3.0 2.0 +-0.6133146158854156 0.6133146158854156 3.0 2.0 +-0.5919819335937487 0.5919819335937487 3.0 2.0 +-0.5706492513020819 0.5706492513020819 3.0 2.0 +-0.5493165690104153 0.5493165690104153 3.0 2.0 +-0.5279838867187485 0.5279838867187485 3.0 2.0 +-0.5066512044270817 0.5066512044270817 3.0 2.0 +-0.4853185221354149 0.4853185221354149 3.0 2.0 +-0.4639858398437481 0.4639858398437481 3.0 2.0 +-0.4426531575520815 0.4426531575520815 3.0 2.0 +-0.4213204752604147 0.4213204752604147 3.0 2.0 +-0.3999877929687479 0.3999877929687479 3.0 2.0 +-0.3786551106770811 0.3786551106770811 3.0 2.0 +-0.3573224283854145 0.3573224283854145 3.0 2.0 +-0.3359897460937477 0.3359897460937477 3.0 2.0 +-0.3146570638020807 0.3146570638020807 3.0 2.0 +-0.2933243815104141 0.2933243815104141 3.0 2.0 +-0.2719916992187476 0.2719916992187476 3.0 2.0 +-0.2506590169270807 0.2506590169270807 3.0 2.0 +-0.2293263346354136 0.2293263346354136 3.0 2.0 +-0.2079936523437471 0.2079936523437471 3.0 2.0 +-0.1866609700520805 0.1866609700520805 3.0 2.0 +-0.1653282877604135 0.1653282877604135 3.0 2.0 +-0.1439956054687467 0.1439956054687467 3.0 2.0 +-0.1226629231770801 0.1226629231770801 3.0 2.0 +-0.1013302408854133 0.1013302408854133 3.0 2.0 +-0.07999755859374647 0.07999755859374647 3.0 2.0 +-0.05866487630207972 0.05866487630207972 3.0 2.0 +-0.0373321940104131 0.0373321940104131 3.0 2.0 +-0.01599951171874625 0.01599951171874625 3.0 2.0 +0.005333170572920487 0.005333170572920487 3.0 2.0 +0.026665852864587 0.026665852864587 3.0 2.0 +0.04799853515625363 0.04799853515625363 3.0 2.0 +0.06933121744792015 0.06933121744792015 3.0 2.0 +0.09066389973958666 0.09066389973958666 3.0 2.0 +0.1119965820312533 0.1119965820312533 3.0 2.0 +0.1333292643229198 0.1333292643229198 3.0 2.0 +0.1546619466145862 0.1546619466145862 3.0 2.0 +0.1759946289062527 0.1759946289062527 3.0 2.0 +0.1973273111979195 0.1973273111979195 3.0 2.0 +0.2186599934895859 0.2186599934895859 3.0 2.0 +0.2399926757812524 0.2399926757812524 3.0 2.0 +0.261325358072919 0.261325358072919 3.0 2.0 +0.2826580403645855 0.2826580403645855 3.0 2.0 +0.303990722656252 0.303990722656252 3.0 2.0 +0.3253234049479187 0.3253234049479187 3.0 2.0 +0.3466560872395852 0.3466560872395852 3.0 2.0 +0.3679887695312516 0.3679887695312516 3.0 2.0 +0.3893214518229181 0.3893214518229181 3.0 2.0 +0.4106541341145848 0.4106541341145848 3.0 2.0 +0.4319868164062513 0.4319868164062513 3.0 2.0 +0.4533194986979177 0.4533194986979177 3.0 2.0 +0.4746521809895844 0.4746521809895844 3.0 2.0 +0.4959848632812509 0.4959848632812509 3.0 2.0 +0.5173175455729173 0.5173175455729173 3.0 2.0 +0.5386502278645841 0.5386502278645841 3.0 2.0 +0.5599829101562506 0.5599829101562506 3.0 2.0 +0.581315592447917 0.581315592447917 3.0 2.0 +0.6026482747395835 0.6026482747395835 3.0 2.0 +0.6239809570312501 0.6239809570312501 3.0 2.0 +0.6453136393229166 0.6453136393229166 3.0 2.0 +0.6666463216145831 0.6666463216145831 3.0 2.0 +0.6879790039062498 0.6879790039062498 3.0 2.0 +0.7093116861979163 0.7093116861979163 3.0 2.0 +0.7306443684895827 0.7306443684895827 3.0 2.0 +0.7519770507812495 0.7519770507812495 3.0 2.0 +0.773309733072916 0.773309733072916 3.0 2.0 +0.7946424153645824 0.7946424153645824 3.0 2.0 +0.8159750976562488 0.8159750976562488 3.0 2.0 +0.8373077799479155 0.8373077799479155 3.0 2.0 +0.858640462239582 0.858640462239582 3.0 2.0 +0.8799731445312485 0.8799731445312485 3.0 2.0 +0.9013058268229152 0.9013058268229152 3.0 2.0 +0.9226385091145817 0.9226385091145817 3.0 2.0 +0.9439711914062482 0.9439711914062482 3.0 2.0 +0.9653038736979148 0.9653038736979148 3.0 2.0 +0.9866365559895813 0.9866365559895813 3.0 2.0 +1.007969238281248 1.007969238281248 3.0 2.0 +1.029301920572914 1.029301920572914 3.0 2.0 +1.050634602864581 1.050634602864581 3.0 2.0 +1.071967285156247 1.071967285156247 3.0 2.0 +1.093299967447914 1.093299967447914 3.0 2.0 +1.114632649739581 1.114632649739581 3.0 2.0 +1.135965332031247 1.135965332031247 3.0 2.0 +1.157298014322913 1.157298014322913 3.0 2.0 +1.17863069661458 1.17863069661458 3.0 2.0 +1.199963378906247 1.199963378906247 3.0 2.0 +1.221296061197913 1.221296061197913 3.0 2.0 +1.24262874348958 1.24262874348958 3.0 2.0 +1.263961425781246 1.263961425781246 3.0 2.0 +1.285294108072913 1.285294108072913 3.0 2.0 +1.306626790364579 1.306626790364579 3.0 2.0 +1.327959472656246 1.327959472656246 3.0 2.0 +1.349292154947912 1.349292154947912 3.0 2.0 +1.370624837239579 1.370624837239579 3.0 2.0 +1.391957519531245 1.391957519531245 3.0 2.0 +1.413290201822912 1.413290201822912 3.0 2.0 +1.434622884114579 1.434622884114579 3.0 2.0 +1.455955566406245 1.455955566406245 3.0 2.0 +1.477288248697912 1.477288248697912 3.0 2.0 +1.498620930989578 1.498620930989578 3.0 2.0 +1.519953613281245 1.519953613281245 3.0 2.0 +1.541286295572911 1.541286295572911 3.0 2.0 +1.562618977864578 1.562618977864578 3.0 2.0 +1.583951660156244 1.583951660156244 3.0 2.0 +1.605284342447911 1.605284342447911 3.0 2.0 +1.626617024739577 1.626617024739577 3.0 2.0 +1.647949707031244 1.647949707031244 3.0 2.0 +1.66928238932291 1.66928238932291 3.0 2.0 +1.690615071614577 1.690615071614577 3.0 2.0 +1.711947753906244 1.711947753906244 3.0 2.0 +1.73328043619791 1.73328043619791 3.0 2.0 +1.754613118489577 1.754613118489577 3.0 2.0 +1.775945800781243 1.775945800781243 3.0 2.0 +1.79727848307291 1.79727848307291 3.0 2.0 +1.818611165364576 1.818611165364576 3.0 2.0 +1.839943847656243 1.839943847656243 3.0 2.0 +1.861276529947909 1.861276529947909 3.0 2.0 +1.882609212239576 1.882609212239576 3.0 2.0 +1.903941894531243 1.903941894531243 3.0 2.0 +1.925274576822909 1.925274576822909 3.0 2.0 +1.946607259114575 1.946607259114575 3.0 2.0 +1.967939941406242 1.967939941406242 3.0 2.0 +1.989272623697909 1.989272623697909 3.0 2.0 +1.99981689825654 1.99981689825654 3.0 2.0 diff --git a/tests/circuitpython/synth_block_add_div.py b/tests/circuitpython/synth_block_add_div.py new file mode 100644 index 0000000000..c3f81e496d --- /dev/null +++ b/tests/circuitpython/synth_block_add_div.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.ADD_DIV) diff --git a/tests/circuitpython/synth_block_add_div.py.exp b/tests/circuitpython/synth_block_add_div.py.exp new file mode 100644 index 0000000000..9373b9058e --- /dev/null +++ b/tests/circuitpython/synth_block_add_div.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 -0.007131239149305541 -2.489303141276042 0.5054062593545195 +-1.957273600260416 -0.01424213324652782 -2.478636800130208 0.5109147744428522 +-1.93594091796875 -0.02135302734375004 -2.467970458984375 0.5165446893127459 +-1.914608235677083 -0.02846392144097217 -2.457304117838542 0.5223000618956176 +-1.893275553385417 -0.03557481553819438 -2.446637776692708 0.5281851330155682 +-1.87194287109375 -0.04268570963541674 -2.435971435546875 0.5342043368106176 +-1.850610188802083 -0.04979660373263886 -2.425305094401041 0.5403623118747168 +-1.829277506510417 -0.05690749782986107 -2.414638753255208 0.5466639131793782 +-1.80794482421875 -0.06401839192708336 -2.403972412109375 0.5531142248393119 +-1.786612141927083 -0.07112928602430557 -2.393306070963542 0.5597185737926171 +-1.765279459635417 -0.07824018012152778 -2.382639729817708 0.5664825444728905 +-1.74394677734375 -0.08535107421875006 -2.371973388671875 0.5734119945581858 +-1.722614095052083 -0.09246196831597226 -2.361307047526042 0.5805130718901758 +-1.701281412760417 -0.09957286241319441 -2.350640706380208 0.587792232666228 +-1.67994873046875 -0.1066837565104166 -2.339974365234375 0.5952562610175452 +-1.658616048177083 -0.1137946506076389 -2.329308024088542 0.6029122900981568 +-1.637283365885417 -0.1209055447048611 -2.318641682942708 0.6107678248225627 +-1.61595068359375 -0.1280164388020832 -2.307975341796875 0.6188307664043786 +-1.594618001302083 -0.1351273328993055 -2.297309000651042 0.6271094388646379 +-1.573285319010417 -0.1422382269965278 -2.286642659505208 0.6356126176967009 +-1.55195263671875 -0.14934912109375 -2.275976318359375 0.6443495608952809 +-1.530619954427083 -0.1564600151909722 -2.265309977213541 0.6533300425802326 +-1.509287272135417 -0.1635709092881944 -2.254643636067708 0.6625643894718259 +-1.48795458984375 -0.1706818033854166 -2.243977294921875 0.6720635205036801 +-1.466621907552084 -0.1777926974826388 -2.233310953776042 0.6818389898928245 +-1.445289225260417 -0.1849035915798611 -2.222644612630209 0.6919030340240839 +-1.42395654296875 -0.1920144856770832 -2.211978271484375 0.7022686225487891 +-1.402623860677084 -0.1991253797743055 -2.201311930338542 0.7129495141464894 +-1.381291178385417 -0.2062362738715278 -2.190645589192708 0.7239603174537712 +-1.35995849609375 -0.2133471679687499 -2.179979248046875 0.7353165577275557 +-1.338625813802083 -0.2204580620659722 -2.169312906901042 0.7470347498825767 +-1.317293131510417 -0.2275689561631944 -2.158646565755209 0.7591324786256143 +-1.29596044921875 -0.2346798502604166 -2.147980224609375 0.7716284865042252 +-1.274627766927084 -0.2417907443576387 -2.137313883463542 0.7845427707971828 +-1.253295084635417 -0.2489016384548609 -2.126647542317709 0.7978966903001135 +-1.23196240234375 -0.2560125325520833 -2.115981201171875 0.8117130832057434 +-1.210629720052084 -0.2631234266493054 -2.105314860026042 0.8260163974472542 +-1.189297037760417 -0.2702343207465276 -2.094648518880208 0.8408328350696262 +-1.16796435546875 -0.2773452148437499 -2.083982177734375 0.8561905124224964 +-1.146631673177084 -0.2844561089409721 -2.073315836588542 0.872119638235008 +-1.125298990885417 -0.2915670030381943 -2.062649495442709 0.888652711945624 +-1.10396630859375 -0.2986778971354165 -2.051983154296875 0.905824745026699 +-1.082633626302084 -0.3057887912326387 -2.041316813151042 0.9236735084755006 +-1.061300944010417 -0.3128996853298609 -2.030650472005209 0.9422398101534004 +-1.039968261718751 -0.3200105794270831 -2.019984130859375 0.9615678062591108 +-1.018635579427084 -0.3271214735243054 -2.009317789713542 0.9817053519399302 +-0.9973028971354172 -0.3342323676215277 -1.998651448567708 1.002704396901212 +-0.9759702148437505 -0.3413432617187498 -1.987985107421875 1.024621432899053 +-0.9546375325520838 -0.3484541558159721 -1.977318766276042 1.047518001231993 +-0.9333048502604168 -0.3555650499131944 -1.966652425130208 1.071461269831581 +-0.9119721679687501 -0.3626759440104166 -1.955986083984375 1.096524691348109 +-0.8906394856770833 -0.369786838107639 -1.945319742838542 1.122788755811537 +-0.8693068033854166 -0.376897732204861 -1.934653401692708 1.150341854113661 +-0.8479741210937499 -0.3840086263020834 -1.923987060546875 1.179281271827212 +-0.8266414388020831 -0.3911195203993056 -1.913320719401042 1.209714336906625 +-0.8053087565104164 -0.3982304144965279 -1.902654378255208 1.241759749804813 +-0.7839760742187497 -0.4053413085937501 -1.891988037109375 1.275549130751883 +-0.7626433919270829 -0.4124522026909723 -1.881321695963542 1.311228826716971 +-0.7413107096354159 -0.4195630967881947 -1.870655354817708 1.348962030363503 +-0.7199780273437493 -0.4266739908854169 -1.859989013671875 1.388931275707607 +-0.6986453450520828 -0.4337848849826391 -1.849322672526041 1.431341390996389 +-0.6773126627604157 -0.4408957790798615 -1.838656331380208 1.476423009610449 +-0.6559799804687488 -0.4480066731770838 -1.827989990234374 1.524436766020545 +-0.6346472981770823 -0.4551175672743059 -1.817323649088541 1.575678337987622 +-0.6133146158854156 -0.4622284613715281 -1.806657307942708 1.630484541048061 +-0.5919819335937487 -0.4693393554687504 -1.795990966796874 1.68924074072547 +-0.5706492513020819 -0.4764502495659728 -1.785324625651041 1.752389927294647 +-0.5493165690104153 -0.4835611436631948 -1.774658284505208 1.820443905053662 +-0.5279838867187485 -0.4906720377604172 -1.763991943359374 1.89399719414674 +-0.5066512044270817 -0.4977829318576394 -1.753325602213541 1.973744444426604 +-0.4853185221354149 -0.5048938259548618 -1.742659261067707 2.060502441983818 +-0.4639858398437481 -0.512004720052084 -1.731992919921874 2.155238186442845 +-0.4426531575520815 -0.5191156141493062 -1.721326578776041 2.259105086994308 +-0.4213204752604147 -0.5262265082465284 -1.710660237630207 2.373490154690223 +-0.3999877929687479 -0.5333374023437507 -1.699993896484374 2.500076296273703 +-0.3786551106770811 -0.5404482964409731 -1.689327555338541 2.640925665077857 +-0.3573224283854145 -0.5475591905381951 -1.678661214192707 2.798592868963103 +-0.3359897460937477 -0.5546700846354175 -1.667994873046874 2.976281305087747 +-0.3146570638020807 -0.5617809787326397 -1.65732853190104 3.178063088483531 +-0.2933243815104141 -0.568891872829862 -1.646662190755207 3.409194949464153 +-0.2719916992187476 -0.5760027669270841 -1.635995849609374 3.676582788637813 +-0.2506590169270807 -0.5831136610243064 -1.62532950846354 3.989483451500611 +-0.2293263346354136 -0.5902245551215288 -1.614663167317707 4.360598191175098 +-0.2079936523437471 -0.5973354492187509 -1.603996826171874 4.807839031295624 +-0.1866609700520805 -0.6044463433159732 -1.59333048502604 5.357306349157989 +-0.1653282877604135 -0.6115572374131956 -1.582664143880207 6.048571684533235 +-0.1439956054687467 -0.6186681315104178 -1.571997802734373 6.944656378538188 +-0.1226629231770801 -0.62577902560764 -1.56133146158854 8.152422705240511 +-0.1013302408854133 -0.6328899197048622 -1.550665120442707 9.868722222133313 +-0.07999755859374647 -0.6400008138020845 -1.539998779296873 12.500381481369 +-0.05866487630207972 -0.6471117078993069 -1.52933243815104 17.04597474732166 +-0.0373321940104131 -0.6542226019965289 -1.518666097005207 26.78653174579209 +-0.01599951171874625 -0.6613334960937513 -1.507999755859373 62.50190740685689 +0.005333170572920487 -0.6684443901909734 -1.49733341471354 -187.5057222203924 +0.026665852864587 -0.6755552842881957 -1.486667073567707 -37.50114444410019 +0.04799853515625363 -0.6826661783854179 -1.476000732421873 -20.83396913561251 +0.06933121744792015 -0.6897770724826401 -1.46533439127604 -14.42351709388595 +0.09066389973958666 -0.6968879665798622 -1.454668050130207 -11.02974836591293 +0.1119965820312533 -0.7039988606770845 -1.444001708984373 -8.928843915262917 +0.1333292643229198 -0.7111097547743066 -1.43333536783854 -7.500228888820893 +0.1546619466145862 -0.7182206488715287 -1.422669026692707 -6.465714559328388 +0.1759946289062527 -0.7253315429687509 -1.412002685546874 -5.681991582440117 +0.1973273111979195 -0.7324424370659731 -1.40133634440104 -5.067722222176327 +0.2186599934895859 -0.7395533311631953 -1.390670003255207 -4.573310298061575 +0.2399926757812524 -0.7466642252604174 -1.380003662109374 -4.166793827122775 +0.261325358072919 -0.7537751193576398 -1.36933732096354 -3.826647392255614 +0.2826580403645855 -0.7608860134548618 -1.358670979817707 -3.537843815481609 +0.303990722656252 -0.7679969075520839 -1.348004638671874 -3.289574074044307 +0.3253234049479187 -0.7751078016493063 -1.337338297526041 -3.073864298697141 +0.3466560872395852 -0.7822186957465283 -1.326671956380207 -2.884703418777319 +0.3679887695312516 -0.7893295898437506 -1.316005615234374 -2.717474235080086 +0.3893214518229181 -0.7964404839409727 -1.305339274088541 -2.56857153726748 +0.4106541341145848 -0.8035513780381949 -1.294672932942708 -2.435139249617222 +0.4319868164062513 -0.8106622721354171 -1.284006591796874 -2.314885459512669 +0.4533194986979177 -0.8177731662326392 -1.273340250651041 -2.205949673182662 +0.4746521809895844 -0.8248840603298614 -1.262673909505208 -2.106805867646363 +0.4959848632812509 -0.8319949544270836 -1.252007568359375 -2.016190561511037 +0.5173175455729173 -0.8391058485243057 -1.241341227213541 -1.93304868268584 +0.5386502278645841 -0.8462167426215281 -1.230674886067708 -1.856492299213134 +0.5599829101562506 -0.8533276367187502 -1.220008544921875 -1.785768783052634 +0.581315592447917 -0.8604385308159724 -1.209342203776042 -1.720235983674556 +0.6026482747395835 -0.8675494249131944 -1.198675862630208 -1.659342674517935 +0.6239809570312501 -0.8746603190104167 -1.188009521484375 -1.602613010431852 +0.6453136393229166 -0.8817712131076389 -1.177343180338542 -1.549634067938238 +0.6666463216145831 -0.8888821072048611 -1.166676839192708 -1.500045777764214 +0.6879790039062498 -0.8959930013020832 -1.156010498046875 -1.453532730391681 +0.7093116861979163 -0.9031038953993054 -1.145344156901042 -1.409817460304713 +0.7306443684895827 -0.9102147894965276 -1.134677815755209 -1.368654906719174 +0.7519770507812495 -0.9173256835937499 -1.124011474609375 -1.329827817166857 +0.773309733072916 -0.9244365776909721 -1.113345133463542 -1.293142911865703 +0.7946424153645824 -0.9315474717881941 -1.102678792317709 -1.258427665909577 +0.8159750976562488 -0.9386583658854162 -1.092012451171876 -1.225527596212595 +0.8373077799479155 -0.9457692599826386 -1.081346110026042 -1.19430396318807 +0.858640462239582 -0.9528801540798607 -1.070679768880209 -1.164631815034329 +0.8799731445312485 -0.9599910481770827 -1.060013427734376 -1.136398316488043 +0.9013058268229152 -0.9671019422743051 -1.049347086588542 -1.109501314914361 +0.9226385091145817 -0.9742128363715272 -1.038680745442709 -1.083848105320966 +0.9439711914062482 -0.9813237304687494 -1.028014404296876 -1.059354362827837 +0.9653038736979148 -0.9884346245659717 -1.017348063151043 -1.035943216687995 +0.9866365559895813 -0.9955455186631937 -1.006681722005209 -1.013544444435282 +1.007969238281248 -1.002656412760416 -0.9960153808593761 -0.9920937683625775 +1.029301920572914 -1.009767306857638 -0.9853490397135429 -0.971532239484597 +1.050634602864581 -1.01687820095486 -0.9746826985677096 -0.9518056965508993 +1.071967285156247 -1.023989095052082 -0.9640163574218763 -0.9328642896543641 +1.093299967447914 -1.031099989149305 -0.9533500162760431 -0.9146620596123281 +1.114632649739581 -1.038210883246527 -0.9426836751302098 -0.8971565656484554 +1.135965332031247 -1.045321777343749 -0.9320173339843764 -0.8803085550259496 +1.157298014322913 -1.052432671440971 -0.9213509928385433 -0.8640816692190196 +1.17863069661458 -1.059543565538194 -0.9106846516927099 -0.848442181993336 +1.199963378906247 -1.066654459635415 -0.9000183105468766 -0.8333587654245656 +1.221296061197913 -1.073765353732638 -0.8893519694010434 -0.8188022804389838 +1.24262874348958 -1.08087624782986 -0.8786856282552103 -0.8047455889293019 +1.263961425781246 -1.087987141927082 -0.8680192871093768 -0.7911633848967396 +1.285294108072913 -1.095098036024304 -0.8573529459635436 -0.7780320424088271 +1.306626790364579 -1.102208930121526 -0.8466866048177105 -0.765329478451132 +1.327959472656246 -1.109319824218749 -0.8360202636718769 -0.7530350289981016 +1.349292154947912 -1.116430718315971 -0.8253539225260438 -0.741129336840029 +1.370624837239579 -1.123541612413193 -0.8146875813802106 -0.7295942498853205 +1.391957519531245 -1.130652506510415 -0.8040212402343773 -0.7184127288142812 +1.413290201822912 -1.137763400607637 -0.793354899088544 -0.7075687630963296 +1.434622884114579 -1.14487429470486 -0.7826885579427108 -0.6970472945001019 +1.455955566406245 -1.151985188802082 -0.7720222167968775 -0.6868341473279393 +1.477288248697912 -1.159096082899304 -0.7613558756510441 -0.6769159646950447 +1.498620930989578 -1.166206976996526 -0.750689534505211 -0.6672801502509872 +1.519953613281245 -1.173317871093748 -0.7400231933593777 -0.6579148148088682 +1.541286295572911 -1.18042876519097 -0.7293568522135443 -0.6488087274066691 +1.562618977864578 -1.187539659288193 -0.7186905110677111 -0.6399512703772267 +1.583951660156244 -1.194650553385415 -0.7080241699218779 -0.6313323980489139 +1.605284342447911 -1.201761447482637 -0.6973578287760446 -0.6229425987392939 +1.626617024739577 -1.208872341579859 -0.6866914876302113 -0.6147728597394342 +1.647949707031244 -1.215983235677081 -0.6760251464843781 -0.6068146350178881 +1.66928238932291 -1.223094129774303 -0.6653588053385448 -0.5990598154010462 +1.690615071614577 -1.230205023871526 -0.6546924641927115 -0.5915007010111275 +1.711947753906244 -1.237315917968748 -0.6440261230468782 -0.584129975764883 +1.73328043619791 -1.24442681206597 -0.633359781901045 -0.5769406837554691 +1.754613118489577 -1.251537706163192 -0.6226934407552116 -0.5699262073572263 +1.775945800781243 -1.258648600260414 -0.6120270996093784 -0.5630802469084909 +1.79727848307291 -1.265759494357636 -0.6013607584635452 -0.5563968018413279 +1.818611165364576 -1.272870388454859 -0.590694417317712 -0.5498701531393769 +1.839943847656243 -1.279981282552081 -0.5800280761718786 -0.5434948470160217 +1.861276529947909 -1.287092176649303 -0.5693617350260453 -0.5372656797149785 +1.882609212239576 -1.294203070746525 -0.5586953938802122 -0.5311776833442706 +1.903941894531243 -1.301313964843748 -0.5480290527343787 -0.5252261126625419 +1.925274576822909 -1.30842485894097 -0.5373627115885455 -0.5194064327438435 +1.946607259114575 -1.315535753038192 -0.5266963704427123 -0.5137143074535001 +1.967939941406242 -1.322646647135414 -0.5160300292968789 -0.5081455886735162 +1.989272623697909 -1.329757541232636 -0.5053636881510457 -0.5026963062212534 +1.99981689825654 -1.333272299418847 -0.5000915508717299 -0.5000457796270297 diff --git a/tests/circuitpython/synth_block_add_sub.py b/tests/circuitpython/synth_block_add_sub.py new file mode 100644 index 0000000000..e63d56b181 --- /dev/null +++ b/tests/circuitpython/synth_block_add_sub.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.ADD_SUB) diff --git a/tests/circuitpython/synth_block_add_sub.py.exp b/tests/circuitpython/synth_block_add_sub.py.exp new file mode 100644 index 0000000000..da24baa091 --- /dev/null +++ b/tests/circuitpython/synth_block_add_sub.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 3.021393717447917 -6.978606282552083 0.9786062825520833 +-1.957273600260416 3.042726399739584 -6.957273600260416 0.9572736002604165 +-1.93594091796875 3.06405908203125 -6.93594091796875 0.93594091796875 +-1.914608235677083 3.085391764322917 -6.914608235677083 0.9146082356770835 +-1.893275553385417 3.106724446614583 -6.893275553385417 0.8932755533854168 +-1.87194287109375 3.12805712890625 -6.87194287109375 0.8719428710937498 +-1.850610188802083 3.149389811197917 -6.850610188802083 0.8506101888020833 +-1.829277506510417 3.170722493489583 -6.829277506510417 0.8292775065104168 +-1.80794482421875 3.19205517578125 -6.80794482421875 0.80794482421875 +-1.786612141927083 3.213387858072917 -6.786612141927083 0.7866121419270833 +-1.765279459635417 3.234720540364584 -6.765279459635416 0.7652794596354166 +-1.74394677734375 3.25605322265625 -6.74394677734375 0.7439467773437498 +-1.722614095052083 3.277385904947917 -6.722614095052084 0.7226140950520832 +-1.701281412760417 3.298718587239583 -6.701281412760417 0.7012814127604168 +-1.67994873046875 3.32005126953125 -6.67994873046875 0.6799487304687501 +-1.658616048177083 3.341383951822917 -6.658616048177083 0.6586160481770833 +-1.637283365885417 3.362716634114583 -6.637283365885416 0.6372833658854167 +-1.61595068359375 3.38404931640625 -6.61595068359375 0.6159506835937503 +-1.594618001302083 3.405381998697917 -6.594618001302083 0.5946180013020834 +-1.573285319010417 3.426714680989583 -6.573285319010417 0.5732853190104166 +-1.55195263671875 3.44804736328125 -6.551952636718751 0.5519526367187502 +-1.530619954427083 3.469380045572917 -6.530619954427083 0.5306199544270833 +-1.509287272135417 3.490712727864583 -6.509287272135417 0.5092872721354169 +-1.48795458984375 3.51204541015625 -6.48795458984375 0.4879545898437501 +-1.466621907552084 3.533378092447916 -6.466621907552083 0.4666219075520837 +-1.445289225260417 3.554710774739583 -6.445289225260417 0.4452892252604168 +-1.42395654296875 3.57604345703125 -6.42395654296875 0.4239565429687504 +-1.402623860677084 3.597376139322916 -6.402623860677084 0.4026238606770836 +-1.381291178385417 3.618708821614583 -6.381291178385417 0.3812911783854167 +-1.35995849609375 3.64004150390625 -6.35995849609375 0.3599584960937503 +-1.338625813802083 3.661374186197917 -6.338625813802084 0.3386258138020835 +-1.317293131510417 3.682706868489583 -6.317293131510417 0.3172931315104168 +-1.29596044921875 3.70403955078125 -6.29596044921875 0.2959604492187502 +-1.274627766927084 3.725372233072916 -6.274627766927084 0.2746277669270838 +-1.253295084635417 3.746704915364583 -6.253295084635417 0.2532950846354172 +-1.23196240234375 3.76803759765625 -6.231962402343751 0.2319624023437501 +-1.210629720052084 3.789370279947916 -6.210629720052084 0.2106297200520837 +-1.189297037760417 3.810702962239583 -6.189297037760417 0.1892970377604173 +-1.16796435546875 3.83203564453125 -6.16796435546875 0.1679643554687502 +-1.146631673177084 3.853368326822917 -6.146631673177083 0.1466316731770836 +-1.125298990885417 3.874701009114583 -6.125298990885417 0.1252989908854172 +-1.10396630859375 3.89603369140625 -6.10396630859375 0.1039663085937503 +-1.082633626302084 3.917366373697916 -6.082633626302083 0.08263362630208393 +-1.061300944010417 3.938699055989583 -6.061300944010418 0.06130094401041708 +-1.039968261718751 3.960031738281249 -6.039968261718751 0.03996826171875068 +-1.018635579427084 3.981364420572916 -6.018635579427084 0.01863557942708383 +-0.9973028971354172 4.002697102864583 -5.997302897135417 -0.002697102864582912 +-0.9759702148437505 4.02402978515625 -5.97597021484375 -0.02402978515624954 +-0.9546375325520838 4.045362467447916 -5.954637532552084 -0.04536246744791628 +-0.9333048502604168 4.066695149739584 -5.933304850260416 -0.06669514973958313 +-0.9119721679687501 4.08802783203125 -5.91197216796875 -0.08802783203124987 +-0.8906394856770833 4.109360514322917 -5.890639485677083 -0.1093605143229167 +-0.8693068033854166 4.130693196614583 -5.869306803385417 -0.1306931966145833 +-0.8479741210937499 4.15202587890625 -5.84797412109375 -0.1520258789062501 +-0.8266414388020831 4.173358561197917 -5.826641438802083 -0.1733585611979169 +-0.8053087565104164 4.194691243489584 -5.805308756510416 -0.1946912434895837 +-0.7839760742187497 4.216023925781251 -5.783976074218749 -0.2160239257812503 +-0.7626433919270829 4.237356608072917 -5.762643391927083 -0.2373566080729171 +-0.7413107096354159 4.258689290364584 -5.741310709635416 -0.2586892903645841 +-0.7199780273437493 4.28002197265625 -5.71997802734375 -0.2800219726562507 +-0.6986453450520828 4.301354654947917 -5.698645345052083 -0.3013546549479172 +-0.6773126627604157 4.322687337239584 -5.677312662760416 -0.3226873372395843 +-0.6559799804687488 4.344020019531252 -5.655979980468748 -0.3440200195312512 +-0.6346472981770823 4.365352701822918 -5.634647298177082 -0.3653527018229177 +-0.6133146158854156 4.386685384114585 -5.613314615885415 -0.3866853841145843 +-0.5919819335937487 4.408018066406251 -5.591981933593749 -0.4080180664062513 +-0.5706492513020819 4.429350748697918 -5.570649251302082 -0.4293507486979181 +-0.5493165690104153 4.450683430989585 -5.549316569010415 -0.4506834309895847 +-0.5279838867187485 4.472016113281251 -5.527983886718749 -0.4720161132812515 +-0.5066512044270817 4.493348795572919 -5.506651204427081 -0.4933487955729183 +-0.4853185221354149 4.514681477864585 -5.485318522135415 -0.5146814778645851 +-0.4639858398437481 4.536014160156252 -5.463985839843748 -0.5360141601562519 +-0.4426531575520815 4.557346842447918 -5.442653157552082 -0.5573468424479185 +-0.4213204752604147 4.578679524739585 -5.421320475260415 -0.5786795247395853 +-0.3999877929687479 4.600012207031252 -5.399987792968748 -0.6000122070312521 +-0.3786551106770811 4.621344889322919 -5.378655110677081 -0.6213448893229189 +-0.3573224283854145 4.642677571614586 -5.357322428385414 -0.6426775716145855 +-0.3359897460937477 4.664010253906252 -5.335989746093748 -0.6640102539062523 +-0.3146570638020807 4.68534293619792 -5.31465706380208 -0.6853429361979194 +-0.2933243815104141 4.706675618489585 -5.293324381510415 -0.7066756184895859 +-0.2719916992187476 4.728008300781252 -5.271991699218748 -0.7280083007812524 +-0.2506590169270807 4.749340983072919 -5.250659016927081 -0.7493409830729193 +-0.2293263346354136 4.770673665364587 -5.229326334635413 -0.7706736653645864 +-0.2079936523437471 4.792006347656253 -5.207993652343747 -0.7920063476562529 +-0.1866609700520805 4.81333902994792 -5.18666097005208 -0.8133390299479196 +-0.1653282877604135 4.834671712239587 -5.165328287760413 -0.8346717122395864 +-0.1439956054687467 4.856004394531253 -5.143995605468747 -0.8560043945312533 +-0.1226629231770801 4.87733707682292 -5.12266292317708 -0.8773370768229199 +-0.1013302408854133 4.898669759114586 -5.101330240885414 -0.8986697591145866 +-0.07999755859374647 4.920002441406254 -5.079997558593746 -0.9200024414062536 +-0.05866487630207972 4.94133512369792 -5.05866487630208 -0.9413351236979203 +-0.0373321940104131 4.962667805989587 -5.037332194010413 -0.962667805989587 +-0.01599951171874625 4.984000488281254 -5.015999511718746 -0.9840004882812538 +0.005333170572920487 5.00533317057292 -4.99466682942708 -1.00533317057292 +0.026665852864587 5.026665852864587 -4.973334147135413 -1.026665852864587 +0.04799853515625363 5.047998535156253 -4.952001464843747 -1.047998535156254 +0.06933121744792015 5.06933121744792 -4.93066878255208 -1.06933121744792 +0.09066389973958666 5.090663899739587 -4.909336100260413 -1.090663899739587 +0.1119965820312533 5.111996582031253 -4.888003417968747 -1.111996582031253 +0.1333292643229198 5.13332926432292 -4.86667073567708 -1.13332926432292 +0.1546619466145862 5.154661946614587 -4.845338053385413 -1.154661946614586 +0.1759946289062527 5.175994628906253 -4.824005371093747 -1.175994628906253 +0.1973273111979195 5.197327311197919 -4.802672688802081 -1.197327311197919 +0.2186599934895859 5.218659993489586 -4.781340006510414 -1.218659993489586 +0.2399926757812524 5.239992675781252 -4.760007324218748 -1.239992675781252 +0.261325358072919 5.261325358072919 -4.738674641927081 -1.261325358072919 +0.2826580403645855 5.282658040364586 -4.717341959635414 -1.282658040364586 +0.303990722656252 5.303990722656252 -4.696009277343748 -1.303990722656252 +0.3253234049479187 5.325323404947919 -4.674676595052081 -1.325323404947919 +0.3466560872395852 5.346656087239586 -4.653343912760414 -1.346656087239585 +0.3679887695312516 5.367988769531252 -4.632011230468748 -1.367988769531252 +0.3893214518229181 5.389321451822918 -4.610678548177082 -1.389321451822918 +0.4106541341145848 5.410654134114585 -4.589345865885415 -1.410654134114585 +0.4319868164062513 5.431986816406251 -4.568013183593749 -1.431986816406251 +0.4533194986979177 5.453319498697917 -4.546680501302083 -1.453319498697918 +0.4746521809895844 5.474652180989585 -4.525347819010415 -1.474652180989585 +0.4959848632812509 5.495984863281251 -4.504015136718749 -1.495984863281251 +0.5173175455729173 5.517317545572917 -4.482682454427083 -1.517317545572917 +0.5386502278645841 5.538650227864585 -4.461349772135415 -1.538650227864584 +0.5599829101562506 5.559982910156251 -4.440017089843749 -1.559982910156251 +0.581315592447917 5.581315592447917 -4.418684407552083 -1.581315592447917 +0.6026482747395835 5.602648274739583 -4.397351725260417 -1.602648274739583 +0.6239809570312501 5.62398095703125 -4.37601904296875 -1.62398095703125 +0.6453136393229166 5.645313639322916 -4.354686360677084 -1.645313639322917 +0.6666463216145831 5.666646321614583 -4.333353678385417 -1.666646321614583 +0.6879790039062498 5.68797900390625 -4.31202099609375 -1.68797900390625 +0.7093116861979163 5.709311686197916 -4.290688313802084 -1.709311686197916 +0.7306443684895827 5.730644368489583 -4.269355631510417 -1.730644368489583 +0.7519770507812495 5.75197705078125 -4.24802294921875 -1.75197705078125 +0.773309733072916 5.773309733072916 -4.226690266927084 -1.773309733072916 +0.7946424153645824 5.794642415364582 -4.205357584635418 -1.794642415364582 +0.8159750976562488 5.815975097656249 -4.184024902343751 -1.815975097656249 +0.8373077799479155 5.837307779947915 -4.162692220052085 -1.837307779947916 +0.858640462239582 5.858640462239582 -4.141359537760418 -1.858640462239582 +0.8799731445312485 5.879973144531249 -4.120026855468751 -1.879973144531249 +0.9013058268229152 5.901305826822915 -4.098694173177085 -1.901305826822915 +0.9226385091145817 5.922638509114582 -4.077361490885418 -1.922638509114582 +0.9439711914062482 5.943971191406249 -4.056028808593751 -1.943971191406248 +0.9653038736979148 5.965303873697914 -4.034696126302086 -1.965303873697915 +0.9866365559895813 5.986636555989581 -4.013363444010419 -1.986636555989581 +1.007969238281248 6.007969238281248 -3.992030761718752 -2.007969238281248 +1.029301920572914 6.029301920572914 -3.970698079427086 -2.029301920572914 +1.050634602864581 6.050634602864581 -3.949365397135419 -2.050634602864581 +1.071967285156247 6.071967285156248 -3.928032714843753 -2.071967285156247 +1.093299967447914 6.093299967447914 -3.906700032552086 -2.093299967447914 +1.114632649739581 6.114632649739581 -3.885367350260419 -2.114632649739581 +1.135965332031247 6.135965332031247 -3.864034667968753 -2.135965332031247 +1.157298014322913 6.157298014322913 -3.842701985677087 -2.157298014322913 +1.17863069661458 6.17863069661458 -3.82136930338542 -2.17863069661458 +1.199963378906247 6.199963378906247 -3.800036621093753 -2.199963378906247 +1.221296061197913 6.221296061197913 -3.778703938802087 -2.221296061197913 +1.24262874348958 6.242628743489579 -3.75737125651042 -2.24262874348958 +1.263961425781246 6.263961425781247 -3.736038574218754 -2.263961425781246 +1.285294108072913 6.285294108072913 -3.714705891927087 -2.285294108072913 +1.306626790364579 6.306626790364579 -3.693373209635421 -2.306626790364579 +1.327959472656246 6.327959472656246 -3.672040527343754 -2.327959472656246 +1.349292154947912 6.349292154947912 -3.650707845052088 -2.349292154947912 +1.370624837239579 6.370624837239578 -3.629375162760421 -2.370624837239579 +1.391957519531245 6.391957519531245 -3.608042480468755 -2.391957519531245 +1.413290201822912 6.413290201822912 -3.586709798177088 -2.413290201822912 +1.434622884114579 6.434622884114578 -3.565377115885421 -2.434622884114579 +1.455955566406245 6.455955566406245 -3.544044433593755 -2.455955566406245 +1.477288248697912 6.477288248697912 -3.522711751302088 -2.477288248697912 +1.498620930989578 6.498620930989578 -3.501379069010422 -2.498620930989578 +1.519953613281245 6.519953613281245 -3.480046386718755 -2.519953613281245 +1.541286295572911 6.541286295572911 -3.458713704427089 -2.541286295572911 +1.562618977864578 6.562618977864577 -3.437381022135422 -2.562618977864578 +1.583951660156244 6.583951660156244 -3.416048339843756 -2.583951660156244 +1.605284342447911 6.605284342447911 -3.394715657552089 -2.605284342447911 +1.626617024739577 6.626617024739577 -3.373382975260423 -2.626617024739577 +1.647949707031244 6.647949707031244 -3.352050292968756 -2.647949707031244 +1.66928238932291 6.669282389322911 -3.33071761067709 -2.66928238932291 +1.690615071614577 6.690615071614577 -3.309384928385423 -2.690615071614577 +1.711947753906244 6.711947753906244 -3.288052246093756 -2.711947753906244 +1.73328043619791 6.73328043619791 -3.26671956380209 -2.73328043619791 +1.754613118489577 6.754613118489576 -3.245386881510423 -2.754613118489577 +1.775945800781243 6.775945800781243 -3.224054199218757 -2.775945800781243 +1.79727848307291 6.79727848307291 -3.20272151692709 -2.79727848307291 +1.818611165364576 6.818611165364576 -3.181388834635424 -2.818611165364576 +1.839943847656243 6.839943847656243 -3.160056152343757 -2.839943847656243 +1.861276529947909 6.86127652994791 -3.138723470052091 -2.861276529947909 +1.882609212239576 6.882609212239576 -3.117390787760424 -2.882609212239576 +1.903941894531243 6.903941894531243 -3.096058105468757 -2.903941894531243 +1.925274576822909 6.925274576822909 -3.074725423177091 -2.925274576822909 +1.946607259114575 6.946607259114575 -3.053392740885425 -2.946607259114575 +1.967939941406242 6.967939941406242 -3.032060058593758 -2.967939941406242 +1.989272623697909 6.989272623697909 -3.010727376302091 -2.989272623697909 +1.99981689825654 6.99981689825654 -3.00018310174346 -2.99981689825654 diff --git a/tests/circuitpython/synth_block_constrained_lerp.py b/tests/circuitpython/synth_block_constrained_lerp.py new file mode 100644 index 0000000000..4400d5e391 --- /dev/null +++ b/tests/circuitpython/synth_block_constrained_lerp.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.CONSTRAINED_LERP) diff --git a/tests/circuitpython/synth_block_constrained_lerp.py.exp b/tests/circuitpython/synth_block_constrained_lerp.py.exp new file mode 100644 index 0000000000..3cd7acad3e --- /dev/null +++ b/tests/circuitpython/synth_block_constrained_lerp.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 -1.978606282552083 -1.978606282552083 2.0 +-1.957273600260416 -1.957273600260416 -1.957273600260416 2.0 +-1.93594091796875 -1.93594091796875 -1.93594091796875 2.0 +-1.914608235677083 -1.914608235677083 -1.914608235677083 2.0 +-1.893275553385417 -1.893275553385417 -1.893275553385417 2.0 +-1.87194287109375 -1.87194287109375 -1.87194287109375 2.0 +-1.850610188802083 -1.850610188802083 -1.850610188802083 2.0 +-1.829277506510417 -1.829277506510417 -1.829277506510417 2.0 +-1.80794482421875 -1.80794482421875 -1.80794482421875 2.0 +-1.786612141927083 -1.786612141927083 -1.786612141927083 2.0 +-1.765279459635417 -1.765279459635417 -1.765279459635417 2.0 +-1.74394677734375 -1.74394677734375 -1.74394677734375 2.0 +-1.722614095052083 -1.722614095052083 -1.722614095052083 2.0 +-1.701281412760417 -1.701281412760417 -1.701281412760417 2.0 +-1.67994873046875 -1.67994873046875 -1.67994873046875 2.0 +-1.658616048177083 -1.658616048177083 -1.658616048177083 2.0 +-1.637283365885417 -1.637283365885417 -1.637283365885417 2.0 +-1.61595068359375 -1.61595068359375 -1.61595068359375 2.0 +-1.594618001302083 -1.594618001302083 -1.594618001302083 2.0 +-1.573285319010417 -1.573285319010417 -1.573285319010417 2.0 +-1.55195263671875 -1.55195263671875 -1.55195263671875 2.0 +-1.530619954427083 -1.530619954427083 -1.530619954427083 2.0 +-1.509287272135417 -1.509287272135417 -1.509287272135417 2.0 +-1.48795458984375 -1.48795458984375 -1.48795458984375 2.0 +-1.466621907552084 -1.466621907552084 -1.466621907552084 2.0 +-1.445289225260417 -1.445289225260417 -1.445289225260417 2.0 +-1.42395654296875 -1.42395654296875 -1.42395654296875 2.0 +-1.402623860677084 -1.402623860677084 -1.402623860677084 2.0 +-1.381291178385417 -1.381291178385417 -1.381291178385417 2.0 +-1.35995849609375 -1.35995849609375 -1.35995849609375 2.0 +-1.338625813802083 -1.338625813802083 -1.338625813802083 2.0 +-1.317293131510417 -1.317293131510417 -1.317293131510417 2.0 +-1.29596044921875 -1.29596044921875 -1.29596044921875 2.0 +-1.274627766927084 -1.274627766927084 -1.274627766927084 2.0 +-1.253295084635417 -1.253295084635417 -1.253295084635417 2.0 +-1.23196240234375 -1.23196240234375 -1.23196240234375 2.0 +-1.210629720052084 -1.210629720052084 -1.210629720052084 2.0 +-1.189297037760417 -1.189297037760417 -1.189297037760417 2.0 +-1.16796435546875 -1.16796435546875 -1.16796435546875 2.0 +-1.146631673177084 -1.146631673177084 -1.146631673177084 2.0 +-1.125298990885417 -1.125298990885417 -1.125298990885417 2.0 +-1.10396630859375 -1.10396630859375 -1.10396630859375 2.0 +-1.082633626302084 -1.082633626302084 -1.082633626302084 2.0 +-1.061300944010417 -1.061300944010417 -1.061300944010417 2.0 +-1.039968261718751 -1.039968261718751 -1.039968261718751 2.0 +-1.018635579427084 -1.018635579427084 -1.018635579427084 2.0 +-0.9973028971354172 -0.9973028971354172 -0.9973028971354172 2.0 +-0.9759702148437505 -0.9759702148437505 -0.9759702148437505 2.0 +-0.9546375325520838 -0.9546375325520838 -0.9546375325520838 2.0 +-0.9333048502604168 -0.9333048502604168 -0.9333048502604168 2.0 +-0.9119721679687501 -0.9119721679687501 -0.9119721679687501 2.0 +-0.8906394856770833 -0.8906394856770833 -0.8906394856770833 2.0 +-0.8693068033854166 -0.8693068033854166 -0.8693068033854166 2.0 +-0.8479741210937499 -0.8479741210937499 -0.8479741210937499 2.0 +-0.8266414388020831 -0.8266414388020831 -0.8266414388020831 2.0 +-0.8053087565104164 -0.8053087565104164 -0.8053087565104164 2.0 +-0.7839760742187497 -0.7839760742187497 -0.7839760742187497 2.0 +-0.7626433919270829 -0.7626433919270829 -0.7626433919270829 2.0 +-0.7413107096354159 -0.7413107096354159 -0.7413107096354159 2.0 +-0.7199780273437493 -0.7199780273437493 -0.7199780273437493 2.0 +-0.6986453450520828 -0.6986453450520828 -0.6986453450520828 2.0 +-0.6773126627604157 -0.6773126627604157 -0.6773126627604157 2.0 +-0.6559799804687488 -0.6559799804687488 -0.6559799804687488 2.0 +-0.6346472981770823 -0.6346472981770823 -0.6346472981770823 2.0 +-0.6133146158854156 -0.6133146158854156 -0.6133146158854156 2.0 +-0.5919819335937487 -0.5919819335937487 -0.5919819335937487 2.0 +-0.5706492513020819 -0.5706492513020819 -0.5706492513020819 2.0 +-0.5493165690104153 -0.5493165690104153 -0.5493165690104153 2.0 +-0.5279838867187485 -0.5279838867187485 -0.5279838867187485 2.0 +-0.5066512044270817 -0.5066512044270817 -0.5066512044270817 2.0 +-0.4853185221354149 -0.4853185221354149 -0.4853185221354149 2.0 +-0.4639858398437481 -0.4639858398437481 -0.4639858398437481 2.0 +-0.4426531575520815 -0.4426531575520815 -0.4426531575520815 2.0 +-0.4213204752604147 -0.4213204752604147 -0.4213204752604147 2.0 +-0.3999877929687479 -0.3999877929687479 -0.3999877929687479 2.0 +-0.3786551106770811 -0.3786551106770811 -0.3786551106770811 2.0 +-0.3573224283854145 -0.3573224283854145 -0.3573224283854145 2.0 +-0.3359897460937477 -0.3359897460937477 -0.3359897460937477 2.0 +-0.3146570638020807 -0.3146570638020807 -0.3146570638020807 2.0 +-0.2933243815104141 -0.2933243815104141 -0.2933243815104141 2.0 +-0.2719916992187476 -0.2719916992187476 -0.2719916992187476 2.0 +-0.2506590169270807 -0.2506590169270807 -0.2506590169270807 2.0 +-0.2293263346354136 -0.2293263346354136 -0.2293263346354136 2.0 +-0.2079936523437471 -0.2079936523437471 -0.2079936523437471 2.0 +-0.1866609700520805 -0.1866609700520805 -0.1866609700520805 2.0 +-0.1653282877604135 -0.1653282877604135 -0.1653282877604135 2.0 +-0.1439956054687467 -0.1439956054687467 -0.1439956054687467 2.0 +-0.1226629231770801 -0.1226629231770801 -0.1226629231770801 2.0 +-0.1013302408854133 -0.1013302408854133 -0.1013302408854133 2.0 +-0.07999755859374647 -0.07999755859374647 -0.07999755859374647 2.0 +-0.05866487630207972 -0.05866487630207972 -0.05866487630207972 2.0 +-0.0373321940104131 -0.0373321940104131 -0.0373321940104131 2.0 +-0.01599951171874625 -0.01599951171874625 -0.01599951171874625 2.0 +0.005333170572920487 0.005333170572920487 0.005333170572920487 1.973334147135398 +0.026665852864587 0.026665852864587 0.026665852864587 1.866670735677065 +0.04799853515625363 0.04799853515625363 0.04799853515625363 1.760007324218732 +0.06933121744792015 0.06933121744792015 0.06933121744792015 1.653343912760399 +0.09066389973958666 0.09066389973958666 0.09066389973958666 1.546680501302067 +0.1119965820312533 0.1119965820312533 0.1119965820312533 1.440017089843733 +0.1333292643229198 0.1333292643229198 0.1333292643229198 1.333353678385401 +0.1546619466145862 0.1546619466145862 0.1546619466145862 1.226690266927069 +0.1759946289062527 0.1759946289062527 0.1759946289062527 1.120026855468736 +0.1973273111979195 0.1973273111979195 0.1973273111979195 1.013363444010403 +0.2186599934895859 0.2186599934895859 0.2186599934895859 0.9067000325520706 +0.2399926757812524 0.2399926757812524 0.2399926757812524 0.8000366210937381 +0.261325358072919 0.261325358072919 0.261325358072919 0.6933732096354049 +0.2826580403645855 0.2826580403645855 0.2826580403645855 0.5867097981770724 +0.303990722656252 0.303990722656252 0.303990722656252 0.4800463867187398 +0.3253234049479187 0.3253234049479187 0.3253234049479187 0.3733829752604066 +0.3466560872395852 0.3466560872395852 0.3466560872395852 0.2667195638020741 +0.3679887695312516 0.3679887695312516 0.3679887695312516 0.160056152343742 +0.3893214518229181 0.3893214518229181 0.3893214518229181 0.05339274088540935 +0.4106541341145848 0.4106541341145848 0.4106541341145848 -0.05327067057292356 +0.4319868164062513 0.4319868164062513 0.4319868164062513 -0.1599340820312563 +0.4533194986979177 0.4533194986979177 0.4533194986979177 -0.2665974934895889 +0.4746521809895844 0.4746521809895844 0.4746521809895844 -0.3732609049479219 +0.4959848632812509 0.4959848632812509 0.4959848632812509 -0.4799243164062545 +0.5173175455729173 0.5173175455729173 0.5173175455729173 -0.5865877278645866 +0.5386502278645841 0.5386502278645841 0.5386502278645841 -0.6932511393229202 +0.5599829101562506 0.5599829101562506 0.5599829101562506 -0.7999145507812528 +0.581315592447917 0.581315592447917 0.581315592447917 -0.9065779622395848 +0.6026482747395835 0.6026482747395835 0.6026482747395835 -1.013241373697918 +0.6239809570312501 0.6239809570312501 0.6239809570312501 -1.11990478515625 +0.6453136393229166 0.6453136393229166 0.6453136393229166 -1.226568196614583 +0.6666463216145831 0.6666463216145831 0.6666463216145831 -1.333231608072916 +0.6879790039062498 0.6879790039062498 0.6879790039062498 -1.439895019531249 +0.7093116861979163 0.7093116861979163 0.7093116861979163 -1.546558430989581 +0.7306443684895827 0.7306443684895827 0.7306443684895827 -1.653221842447913 +0.7519770507812495 0.7519770507812495 0.7519770507812495 -1.759885253906247 +0.773309733072916 0.773309733072916 0.773309733072916 -1.86654866536458 +0.7946424153645824 0.7946424153645824 0.7946424153645824 -1.973212076822912 +0.8159750976562488 0.8159750976562488 0.8159750976562488 -2.079875488281244 +0.8373077799479155 0.8373077799479155 0.8373077799479155 -2.186538899739578 +0.858640462239582 0.858640462239582 0.858640462239582 -2.29320231119791 +0.8799731445312485 0.8799731445312485 0.8799731445312485 -2.399865722656243 +0.9013058268229152 0.9013058268229152 0.9013058268229152 -2.506529134114576 +0.9226385091145817 0.9226385091145817 0.9226385091145817 -2.613192545572908 +0.9439711914062482 0.9439711914062482 0.9439711914062482 -2.71985595703124 +0.9653038736979148 0.9653038736979148 0.9653038736979148 -2.826519368489574 +0.9866365559895813 0.9866365559895813 0.9866365559895813 -2.933182779947907 +1.007969238281248 1.007969238281248 1.007969238281248 -3.0 +1.029301920572914 1.029301920572914 1.029301920572914 -3.0 +1.050634602864581 1.050634602864581 1.050634602864581 -3.0 +1.071967285156247 1.071967285156247 1.071967285156247 -3.0 +1.093299967447914 1.093299967447914 1.093299967447914 -3.0 +1.114632649739581 1.114632649739581 1.114632649739581 -3.0 +1.135965332031247 1.135965332031247 1.135965332031247 -3.0 +1.157298014322913 1.157298014322913 1.157298014322913 -3.0 +1.17863069661458 1.17863069661458 1.17863069661458 -3.0 +1.199963378906247 1.199963378906247 1.199963378906247 -3.0 +1.221296061197913 1.221296061197913 1.221296061197913 -3.0 +1.24262874348958 1.24262874348958 1.24262874348958 -3.0 +1.263961425781246 1.263961425781246 1.263961425781246 -3.0 +1.285294108072913 1.285294108072913 1.285294108072913 -3.0 +1.306626790364579 1.306626790364579 1.306626790364579 -3.0 +1.327959472656246 1.327959472656246 1.327959472656246 -3.0 +1.349292154947912 1.349292154947912 1.349292154947912 -3.0 +1.370624837239579 1.370624837239579 1.370624837239579 -3.0 +1.391957519531245 1.391957519531245 1.391957519531245 -3.0 +1.413290201822912 1.413290201822912 1.413290201822912 -3.0 +1.434622884114579 1.434622884114579 1.434622884114579 -3.0 +1.455955566406245 1.455955566406245 1.455955566406245 -3.0 +1.477288248697912 1.477288248697912 1.477288248697912 -3.0 +1.498620930989578 1.498620930989578 1.498620930989578 -3.0 +1.519953613281245 1.519953613281245 1.519953613281245 -3.0 +1.541286295572911 1.541286295572911 1.541286295572911 -3.0 +1.562618977864578 1.562618977864578 1.562618977864578 -3.0 +1.583951660156244 1.583951660156244 1.583951660156244 -3.0 +1.605284342447911 1.605284342447911 1.605284342447911 -3.0 +1.626617024739577 1.626617024739577 1.626617024739577 -3.0 +1.647949707031244 1.647949707031244 1.647949707031244 -3.0 +1.66928238932291 1.66928238932291 1.66928238932291 -3.0 +1.690615071614577 1.690615071614577 1.690615071614577 -3.0 +1.711947753906244 1.711947753906244 1.711947753906244 -3.0 +1.73328043619791 1.73328043619791 1.73328043619791 -3.0 +1.754613118489577 1.754613118489577 1.754613118489577 -3.0 +1.775945800781243 1.775945800781243 1.775945800781243 -3.0 +1.79727848307291 1.79727848307291 1.79727848307291 -3.0 +1.818611165364576 1.818611165364576 1.818611165364576 -3.0 +1.839943847656243 1.839943847656243 1.839943847656243 -3.0 +1.861276529947909 1.861276529947909 1.861276529947909 -3.0 +1.882609212239576 1.882609212239576 1.882609212239576 -3.0 +1.903941894531243 1.903941894531243 1.903941894531243 -3.0 +1.925274576822909 1.925274576822909 1.925274576822909 -3.0 +1.946607259114575 1.946607259114575 1.946607259114575 -3.0 +1.967939941406242 1.967939941406242 1.967939941406242 -3.0 +1.989272623697909 1.989272623697909 1.989272623697909 -3.0 +1.99981689825654 1.99981689825654 1.99981689825654 -3.0 diff --git a/tests/circuitpython/synth_block_div_add.py b/tests/circuitpython/synth_block_div_add.py new file mode 100644 index 0000000000..6c8dcfe601 --- /dev/null +++ b/tests/circuitpython/synth_block_div_add.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.DIV_ADD) diff --git a/tests/circuitpython/synth_block_div_add.py.exp b/tests/circuitpython/synth_block_div_add.py.exp new file mode 100644 index 0000000000..366d0a31a4 --- /dev/null +++ b/tests/circuitpython/synth_block_div_add.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 -3.989303141276041 3.516218778063559 -2.64527294921875 +-1.957273600260416 -3.978636800130208 3.532744323328557 -2.623940266927083 +-1.93594091796875 -3.967970458984375 3.549634067938237 -2.602607584635416 +-1.914608235677083 -3.957304117838542 3.566900185686853 -2.58127490234375 +-1.893275553385417 -3.946637776692708 3.584555399046705 -2.559942220052084 +-1.87194287109375 -3.935971435546875 3.602613010431853 -2.538609537760416 +-1.850610188802083 -3.925305094401041 3.621086935624151 -2.51727685546875 +-1.829277506510417 -3.914638753255208 3.639991739538135 -2.495944173177084 +-1.80794482421875 -3.903972412109375 3.659342674517936 -2.474611490885417 +-1.786612141927083 -3.893306070963542 3.679155721377851 -2.45327880859375 +-1.765279459635417 -3.882639729817708 3.699447633418671 -2.431946126302083 +-1.74394677734375 -3.871973388671875 3.720235983674558 -2.410613444010417 +-1.722614095052083 -3.861307047526042 3.741539215670527 -2.38928076171875 +-1.701281412760417 -3.850640706380208 3.763376697998684 -2.367948079427083 +-1.67994873046875 -3.839974365234375 3.785768783052636 -2.346615397135417 +-1.658616048177083 -3.829308024088542 3.80873687029447 -2.32528271484375 +-1.637283365885417 -3.818641682942708 3.832303474467688 -2.303950032552083 +-1.61595068359375 -3.807975341796875 3.856492299213136 -2.282617350260417 +-1.594618001302083 -3.797309000651042 3.881328316593914 -2.26128466796875 +-1.573285319010417 -3.786642659505208 3.906837853090103 -2.239951985677083 +-1.55195263671875 -3.775976318359375 3.933048682685842 -2.218619303385417 +-1.530619954427083 -3.765309977213541 3.959990127740697 -2.19728662109375 +-1.509287272135417 -3.754643636067708 3.987693168415477 -2.175953938802083 +-1.48795458984375 -3.743977294921875 4.01619056151104 -2.154621256510417 +-1.466621907552084 -3.733310953776042 4.045516969678474 -2.13328857421875 +-1.445289225260417 -3.722644612630209 4.075709102072252 -2.111955891927083 +-1.42395654296875 -3.711978271484375 4.106805867646367 -2.090623209635417 +-1.402623860677084 -3.701311930338542 4.138848542439469 -2.06929052734375 +-1.381291178385417 -3.690645589192708 4.171880952361313 -2.047957845052083 +-1.35995849609375 -3.679979248046875 4.205949673182667 -2.026625162760417 +-1.338625813802083 -3.669312906901042 4.24110424964773 -2.00529248046875 +-1.317293131510417 -3.658646565755209 4.277397435876843 -1.983959798177084 +-1.29596044921875 -3.647980224609375 4.314885459512675 -1.962627115885417 +-1.274627766927084 -3.637313883463542 4.353628312391548 -1.94129443359375 +-1.253295084635417 -3.626647542317709 4.393690070900341 -1.919961751302084 +-1.23196240234375 -3.615981201171875 4.43513924961723 -1.898629069010417 +-1.210629720052084 -3.605314860026042 4.478049192341762 -1.87729638671875 +-1.189297037760417 -3.594648518880208 4.522498505208879 -1.855963704427084 +-1.16796435546875 -3.583982177734375 4.56857153726749 -1.834631022135417 +-1.146631673177084 -3.573315836588542 4.616358914705024 -1.81329833984375 +-1.125298990885417 -3.562649495442709 4.665958135836872 -1.791965657552084 +-1.10396630859375 -3.551983154296875 4.717474235080097 -1.770632975260417 +-1.082633626302084 -3.541316813151042 4.771020525426502 -1.74930029296875 +-1.061300944010417 -3.530650472005209 4.826719430460201 -1.727967610677084 +-1.039968261718751 -3.519984130859375 4.884703418777333 -1.706634928385417 +-1.018635579427084 -3.509317789713542 4.94511605581979 -1.68530224609375 +-0.9973028971354172 -3.498651448567708 5.008113190703636 -1.663969563802084 +-0.9759702148437505 -3.487985107421875 5.073864298697158 -1.642636881510417 +-0.9546375325520838 -3.477318766276042 5.142554003695977 -1.62130419921875 +-0.9333048502604168 -3.466652425130208 5.214383809494743 -1.599971516927083 +-0.9119721679687501 -3.455986083984375 5.289574074044328 -1.578638834635417 +-0.8906394856770833 -3.445319742838542 5.368366267434613 -1.55730615234375 +-0.8693068033854166 -3.434653401692708 5.451025562340983 -1.535973470052083 +-0.8479741210937499 -3.423987060546875 5.537843815481637 -1.514640787760416 +-0.8266414388020831 -3.413320719401042 5.629143010719874 -1.49330810546875 +-0.8053087565104164 -3.402654378255208 5.72527924941444 -1.471975423177083 +-0.7839760742187497 -3.391988037109375 5.82664739225565 -1.450642740885416 +-0.7626433919270829 -3.381321695963541 5.933686480150913 -1.429310058593749 +-0.7413107096354159 -3.370655354817708 6.04688609109051 -1.407977376302083 +-0.7199780273437493 -3.359989013671875 6.166793827122821 -1.386644694010416 +-0.6986453450520828 -3.349322672526041 6.294024172989165 -1.365312011718749 +-0.6773126627604157 -3.338656331380208 6.429269028831347 -1.343979329427082 +-0.6559799804687488 -3.327989990234375 6.573310298061636 -1.322646647135415 +-0.6346472981770823 -3.317323649088541 6.727035013962867 -1.301313964843749 +-0.6133146158854156 -3.306657307942708 6.891453623144184 -1.279981282552082 +-0.5919819335937487 -3.295990966796874 7.06772222217641 -1.258648600260415 +-0.5706492513020819 -3.285324625651041 7.257169781883941 -1.237315917968749 +-0.5493165690104153 -3.274658284505207 7.461331715160988 -1.215983235677082 +-0.5279838867187485 -3.263991943359374 7.681991582440221 -1.194650553385415 +-0.5066512044270817 -3.253325602213541 7.921233333279812 -1.173317871093748 +-0.4853185221354149 -3.242659261067708 8.181507325951454 -1.151985188802082 +-0.4639858398437481 -3.231992919921874 8.465714559328536 -1.130652506510415 +-0.4426531575520815 -3.221326578776041 8.777315260982924 -1.109319824218748 +-0.4213204752604147 -3.210660237630207 9.120470464070669 -1.087987141927081 +-0.3999877929687479 -3.199993896484374 9.500228888821109 -1.066654459635414 +-0.3786551106770811 -3.189327555338541 9.922776995233571 -1.045321777343748 +-0.3573224283854145 -3.178661214192707 10.39577860688931 -1.023989095052081 +-0.3359897460937477 -3.167994873046874 10.92884391526324 -1.002656412760414 +-0.3146570638020807 -3.15732853190104 11.53418926545059 -0.9813237304687473 +-0.2933243815104141 -3.146662190755207 12.22758484839246 -0.9599910481770808 +-0.2719916992187476 -3.135995849609374 13.02974836591344 -0.9386583658854143 +-0.2506590169270807 -3.12532950846354 13.96845035450183 -0.9173256835937472 +-0.2293263346354136 -3.114663167317707 15.0817945735253 -0.8959930013020802 +-0.2079936523437471 -3.103996826171874 16.42351709388687 -0.8746603190104137 +-0.1866609700520805 -3.09333048502604 18.07191904747397 -0.8533276367187471 +-0.1653282877604135 -3.082664143880207 20.14571505359971 -0.8319949544270802 +-0.1439956054687467 -3.071997802734373 22.83396913561456 -0.8106622721354134 +-0.1226629231770801 -3.06133146158854 26.45726811572154 -0.7893295898437467 +-0.1013302408854133 -3.050665120442707 31.60616666639994 -0.7679969075520799 +-0.07999755859374647 -3.039998779296873 39.50114444410701 -0.7466642252604131 +-0.05866487630207972 -3.02933243815104 53.13792424196498 -0.7253315429687463 +-0.0373321940104131 -3.018666097005207 82.35959523737628 -0.7039988606770797 +-0.01599951171874625 -3.007999755859373 189.5057222205707 -0.6826661783854129 +0.005333170572920487 -2.99733341471354 -560.5171666611773 -0.6613334960937461 +0.026665852864587 -2.986667073567706 -110.5034333323006 -0.6400008138020796 +0.04799853515625363 -2.976000732421873 -60.50190740683752 -0.618668131510413 +0.06933121744792015 -2.96533439127604 -41.27055128165784 -0.5973354492187465 +0.09066389973958666 -2.954668050130207 -31.0892450977388 -0.57600276692708 +0.1119965820312533 -2.944001708984374 -24.78653174578875 -0.5546700846354133 +0.1333292643229198 -2.93333536783854 -20.50068666646268 -0.5333374023437468 +0.1546619466145862 -2.922669026692707 -17.39714367798517 -0.5120047200520804 +0.1759946289062527 -2.912002685546874 -15.04597474732035 -0.4906720377604139 +0.1973273111979195 -2.90133634440104 -13.20316666652898 -0.4693393554687471 +0.2186599934895859 -2.890670003255207 -11.71993089418472 -0.4480066731770807 +0.2399926757812524 -2.880003662109374 -10.50038148136833 -0.4266739908854142 +0.261325358072919 -2.86933732096354 -9.479942176766841 -0.4053413085937477 +0.2826580403645855 -2.858670979817707 -8.613531446444828 -0.3840086263020811 +0.303990722656252 -2.848004638671874 -7.86872222213292 -0.3626759440104146 +0.3253234049479187 -2.837338297526041 -7.221592896091423 -0.341343261718748 +0.3466560872395852 -2.826671956380207 -6.654110256331958 -0.3200105794270814 +0.3679887695312516 -2.816005615234374 -6.152422705240259 -0.298677897135415 +0.3893214518229181 -2.805339274088541 -5.70571461180244 -0.2773452148437485 +0.4106541341145848 -2.794672932942708 -5.305417748851666 -0.2560125325520819 +0.4319868164062513 -2.784006591796874 -4.944656378538007 -0.2346798502604154 +0.4533194986979177 -2.773340250651041 -4.617849019547987 -0.2133471679687489 +0.4746521809895844 -2.762673909505208 -4.32041760293909 -0.1920144856770822 +0.4959848632812509 -2.752007568359375 -4.04857168453311 -0.1706818033854157 +0.5173175455729173 -2.741341227213542 -3.799146048057521 -0.1493491210937493 +0.5386502278645841 -2.730674886067708 -3.569476897639401 -0.1280164388020826 +0.5599829101562506 -2.720008544921875 -3.357306349157902 -0.1066837565104161 +0.581315592447917 -2.709342203776042 -3.160707951023669 -0.08535107421874965 +0.6026482747395835 -2.698675862630208 -2.978028023553806 -0.06401839192708314 +0.6239809570312501 -2.688009521484375 -2.807839031295557 -0.04268570963541651 +0.6453136393229166 -2.677343180338542 -2.648902203814713 -0.02135302734375 +0.6666463216145831 -2.666676839192708 -2.500137333292643 -2.034505208348136e-05 +0.6879790039062498 -2.656010498046875 -2.360598191175042 0.02131233723958315 +0.7093116861979163 -2.645344156901042 -2.22945238091414 0.04264501953124967 +0.7306443684895827 -2.634677815755209 -2.105964720157524 0.06397770182291607 +0.7519770507812495 -2.624011474609375 -1.989483451500572 0.0853103841145828 +0.773309733072916 -2.613345133463542 -1.879428735597109 0.1066430664062493 +0.7946424153645824 -2.602678792317709 -1.775282997728731 0.1279757486979157 +0.8159750976562488 -2.592012451171875 -1.676582788637785 0.1493084309895822 +0.8373077799479155 -2.581346110026042 -1.58291188956421 0.1706411132812489 +0.858640462239582 -2.570679768880209 -1.493895445102988 0.1919737955729154 +0.8799731445312485 -2.560013427734376 -1.409194949464128 0.2133064778645819 +0.9013058268229152 -2.549347086588543 -1.328503944743084 0.2346391601562485 +0.9226385091145817 -2.538680745442709 -1.251544315962898 0.2559718424479151 +0.9439711914062482 -2.528014404296876 -1.178063088483511 0.2773045247395815 +0.9653038736979148 -2.517348063151043 -1.107829650063985 0.2986372070312482 +0.9866365559895813 -2.506681722005209 -1.040633333305845 0.3199698893229147 +1.007969238281248 -2.496015380859376 -0.976281305087733 0.3413025716145811 +1.029301920572914 -2.485349039713543 -0.9145967184537906 0.3626352539062475 +1.050634602864581 -2.47468269856771 -0.8554170896526978 0.3839679361979144 +1.071967285156247 -2.464016357421876 -0.7985928689630928 0.4053006184895808 +1.093299967447914 -2.453350016276043 -0.7439861788369839 0.4266333007812472 +1.114632649739581 -2.44268367513021 -0.6914696969453664 0.447965983072914 +1.135965332031247 -2.432017333984376 -0.6409256650778485 0.4692986653645804 +1.157298014322913 -2.421350992838543 -0.5922450076570591 0.4906313476562469 +1.17863069661458 -2.41068465169271 -0.5453265459800076 0.5119640299479137 +1.199963378906247 -2.400018310546876 -0.5000762962736967 0.5332967122395801 +1.221296061197913 -2.389351969401043 -0.4564068413169515 0.5546293945312465 +1.24262874348958 -2.37868562825521 -0.4142367667879054 0.5759620768229129 +1.263961425781246 -2.368019287109377 -0.3734901546902187 0.5972947591145798 +1.285294108072913 -2.357352945963544 -0.3340961272264811 0.6186274414062462 +1.306626790364579 -2.346686604817711 -0.2959884353533959 0.6399601236979126 +1.327959472656246 -2.336020263671877 -0.259105086994305 0.6612928059895794 +1.349292154947912 -2.325353922526044 -0.2233880105200869 0.6826254882812458 +1.370624837239579 -2.314687581380211 -0.1887827496559615 0.7039581705729122 +1.391957519531245 -2.304021240234377 -0.1552381864428436 0.7252908528645786 +1.413290201822912 -2.293354899088544 -0.1227062892889887 0.7466235351562455 +1.434622884114579 -2.282688557942711 -0.09114188350030528 0.7679562174479119 +1.455955566406245 -2.272022216796878 -0.0605024419838176 0.7892888997395783 +1.477288248697912 -2.261355875651044 -0.03074789408513379 0.8106215820312451 +1.498620930989578 -2.250689534505211 -0.001840450752961686 0.8319542643229115 +1.519953613281245 -2.240023193359378 0.02625555557339565 0.853286946614578 +1.541286295572911 -2.229356852213544 0.05357381777999248 0.8746196289062448 +1.562618977864578 -2.218690511067711 0.08014618886831993 0.8959523111979111 +1.583951660156244 -2.208024169921878 0.1060028058532583 0.9172849934895776 +1.605284342447911 -2.197357828776044 0.1311722037821184 0.9386176757812439 +1.626617024739577 -2.186691487630211 0.1556814207816974 0.9599503580729108 +1.647949707031244 -2.176025146484378 0.1795560949463355 0.9812830403645773 +1.66928238932291 -2.165358805338545 0.2028205537968613 1.002615722656244 +1.690615071614577 -2.154692464192712 0.2254978969666173 1.023948404947911 +1.711947753906244 -2.144026123046878 0.247610072705351 1.045281087239577 +1.73328043619791 -2.133359781901045 0.2691779487335926 1.066613769531243 +1.754613118489577 -2.122693440755212 0.2902213779283212 1.08794645182291 +1.775945800781243 -2.112027099609378 0.3107592592745274 1.109279134114577 +1.79727848307291 -2.101360758463545 0.3308095944760165 1.130611816406243 +1.818611165364576 -2.090694417317712 0.3503895405818696 1.151944498697909 +1.839943847656243 -2.080028076171879 0.3695154589519349 1.173277180989576 +1.861276529947909 -2.069361735026045 0.3882029608550646 1.194609863281243 +1.882609212239576 -2.058695393880212 0.4064669499671883 1.215942545572909 +1.903941894531243 -2.048029052734379 0.4243216620123739 1.237275227864576 +1.925274576822909 -2.037362711588545 0.4417807017684694 1.258607910156242 +1.946607259114575 -2.026696370442712 0.4588570776394998 1.279940592447909 +1.967939941406242 -2.016030029296879 0.4755632339794513 1.301273274739576 +1.989272623697909 -2.005363688151045 0.49191108133624 1.322605957031242 +1.99981689825654 -2.00009155087173 0.499862661118911 1.333150231589874 diff --git a/tests/circuitpython/synth_block_lerp.py b/tests/circuitpython/synth_block_lerp.py new file mode 100644 index 0000000000..5a21c91c34 --- /dev/null +++ b/tests/circuitpython/synth_block_lerp.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.LERP) diff --git a/tests/circuitpython/synth_block_lerp.py.exp b/tests/circuitpython/synth_block_lerp.py.exp new file mode 100644 index 0000000000..92c078ed05 --- /dev/null +++ b/tests/circuitpython/synth_block_lerp.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 -13.91442513020833 -0.9572125651041667 11.89303141276042 +-1.957273600260416 -13.82909440104167 -0.914547200520833 11.78636800130208 +-1.93594091796875 -13.743763671875 -0.8718818359374998 11.67970458984375 +-1.914608235677083 -13.65843294270833 -0.829216471354167 11.57304117838542 +-1.893275553385417 -13.57310221354167 -0.7865511067708337 11.46637776692708 +-1.87194287109375 -13.487771484375 -0.7438857421874996 11.35971435546875 +-1.850610188802083 -13.40244075520833 -0.7012203776041668 11.25305094401042 +-1.829277506510417 -13.31711002604167 -0.6585550130208335 11.14638753255208 +-1.80794482421875 -13.231779296875 -0.6158896484374998 11.03972412109375 +-1.786612141927083 -13.14644856770833 -0.5732242838541666 10.93306070963542 +-1.765279459635417 -13.06111783854167 -0.5305589192708333 10.82639729817708 +-1.74394677734375 -12.975787109375 -0.4878935546874996 10.71973388671875 +-1.722614095052083 -12.89045638020833 -0.4452281901041664 10.61307047526041 +-1.701281412760417 -12.80512565104167 -0.4025628255208336 10.50640706380208 +-1.67994873046875 -12.719794921875 -0.3598974609375003 10.39974365234375 +-1.658616048177083 -12.63446419270833 -0.3172320963541666 10.29308024088542 +-1.637283365885417 -12.54913346354167 -0.2745667317708333 10.18641682942708 +-1.61595068359375 -12.463802734375 -0.2319013671875005 10.07975341796875 +-1.594618001302083 -12.37847200520833 -0.1892360026041668 9.973090006510418 +-1.573285319010417 -12.29314127604167 -0.1465706380208331 9.866426595052083 +-1.55195263671875 -12.207810546875 -0.1039052734375003 9.759763183593751 +-1.530619954427083 -12.12247981770833 -0.06123990885416664 9.653099772135416 +-1.509287272135417 -12.03714908854167 -0.01857454427083383 9.546436360677085 +-1.48795458984375 -11.951818359375 0.02409082031249987 9.439772949218749 +-1.466621907552084 -11.86648763020833 0.06675618489583268 9.333109537760418 +-1.445289225260417 -11.78115690104167 0.1094215494791664 9.226446126302083 +-1.42395654296875 -11.695826171875 0.1520869140624992 9.119782714843751 +-1.402623860677084 -11.61049544270833 0.1947522786458329 9.013119303385418 +-1.381291178385417 -11.52516471354167 0.2374176432291666 8.906455891927084 +-1.35995849609375 -11.439833984375 0.2800830078124994 8.799792480468753 +-1.338625813802083 -11.35450325520833 0.3227483723958331 8.693129069010418 +-1.317293131510417 -11.26917252604167 0.3654137369791663 8.586465657552084 +-1.29596044921875 -11.183841796875 0.4080791015624996 8.479802246093751 +-1.274627766927084 -11.09851106770834 0.4507444661458324 8.373138834635419 +-1.253295084635417 -11.01318033854167 0.4934098307291657 8.266475423177086 +-1.23196240234375 -10.927849609375 0.5360751953124998 8.159812011718751 +-1.210629720052084 -10.84251888020833 0.5787405598958326 8.053148600260418 +-1.189297037760417 -10.75718815104167 0.6214059244791654 7.946485188802086 +-1.16796435546875 -10.671857421875 0.6640712890624996 7.839821777343751 +-1.146631673177084 -10.58652669270833 0.7067366536458328 7.733158365885417 +-1.125298990885417 -10.50119596354167 0.7494020182291656 7.626494954427086 +-1.10396630859375 -10.415865234375 0.7920673828124993 7.519831542968752 +-1.082633626302084 -10.33053450520834 0.8347327473958321 7.413168131510419 +-1.061300944010417 -10.24520377604167 0.8773981119791658 7.306504720052086 +-1.039968261718751 -10.159873046875 0.9200634765624986 7.199841308593753 +-1.018635579427084 -10.07454231770834 0.9627288411458323 7.093177897135419 +-0.9973028971354172 -9.989211588541668 1.005394205729166 6.986514485677086 +-0.9759702148437505 -9.903880859375002 1.048059570312499 6.879851074218752 +-0.9546375325520838 -9.818550130208335 1.090724934895833 6.773187662760419 +-0.9333048502604168 -9.733219401041667 1.133390299479166 6.666524251302084 +-0.9119721679687501 -9.647888671875 1.1760556640625 6.559860839843751 +-0.8906394856770833 -9.562557942708333 1.218721028645833 6.453197428385416 +-0.8693068033854166 -9.477227213541667 1.261386393229167 6.346534016927084 +-0.8479741210937499 -9.391896484375 1.3040517578125 6.23987060546875 +-0.8266414388020831 -9.306565755208332 1.346717122395834 6.133207194010415 +-0.8053087565104164 -9.221235026041665 1.389382486979167 6.026543782552082 +-0.7839760742187497 -9.135904296874999 1.432047851562501 5.919880371093749 +-0.7626433919270829 -9.050573567708332 1.474713216145834 5.813216959635414 +-0.7413107096354159 -8.965242838541663 1.517378580729168 5.70655354817708 +-0.7199780273437493 -8.879912109374997 1.560043945312501 5.599890136718747 +-0.6986453450520828 -8.794581380208331 1.602709309895834 5.493226725260413 +-0.6773126627604157 -8.709250651041662 1.645374674479169 5.386563313802078 +-0.6559799804687488 -8.623919921874995 1.688040039062502 5.279899902343744 +-0.6346472981770823 -8.538589192708329 1.730705403645835 5.173236490885412 +-0.6133146158854156 -8.453258463541662 1.773370768229169 5.066573079427078 +-0.5919819335937487 -8.367927734374994 1.816036132812503 4.959909667968743 +-0.5706492513020819 -8.282597005208327 1.858701497395836 4.85324625651041 +-0.5493165690104153 -8.197266276041661 1.901366861979169 4.746582845052076 +-0.5279838867187485 -8.111935546874994 1.944032226562503 4.639919433593743 +-0.5066512044270817 -8.026604817708327 1.986697591145837 4.533256022135408 +-0.4853185221354149 -7.941274088541659 2.02936295572917 4.426592610677075 +-0.4639858398437481 -7.855943359374992 2.072028320312504 4.31992919921874 +-0.4426531575520815 -7.770612630208326 2.114693684895837 4.213265787760408 +-0.4213204752604147 -7.685281901041659 2.157359049479171 4.106602376302074 +-0.3999877929687479 -7.599951171874991 2.200024414062504 3.999938964843739 +-0.3786551106770811 -7.514620442708324 2.242689778645838 3.893275553385406 +-0.3573224283854145 -7.429289713541658 2.285355143229171 3.786612141927073 +-0.3359897460937477 -7.343958984374991 2.328020507812504 3.679948730468738 +-0.3146570638020807 -7.258628255208323 2.370685872395839 3.573285319010403 +-0.2933243815104141 -7.173297526041656 2.413351236979172 3.46662190755207 +-0.2719916992187476 -7.087966796874991 2.456016601562505 3.359958496093738 +-0.2506590169270807 -7.002636067708323 2.498681966145838 3.253295084635404 +-0.2293263346354136 -6.917305338541654 2.541347330729173 3.146631673177068 +-0.2079936523437471 -6.831974609374988 2.584012695312506 3.039968261718736 +-0.1866609700520805 -6.746643880208322 2.626678059895839 2.933304850260402 +-0.1653282877604135 -6.661313151041654 2.669343424479173 2.826641438802067 +-0.1439956054687467 -6.575982421874986 2.712008789062507 2.719978027343733 +-0.1226629231770801 -6.490651692708321 2.75467415364584 2.6133146158854 +-0.1013302408854133 -6.405320963541653 2.797339518229173 2.506651204427067 +-0.07999755859374647 -6.319990234374986 2.840004882812507 2.399987792968732 +-0.05866487630207972 -6.234659505208318 2.882670247395841 2.293324381510399 +-0.0373321940104131 -6.149328776041653 2.925335611979174 2.186660970052066 +-0.01599951171874625 -6.063998046874985 2.968000976562507 2.079997558593731 +0.005333170572920487 -5.978667317708318 3.010666341145841 1.973334147135398 +0.026665852864587 -5.893336588541652 3.053331705729174 1.866670735677065 +0.04799853515625363 -5.808005859374985 3.095997070312507 1.760007324218732 +0.06933121744792015 -5.722675130208319 3.13866243489584 1.653343912760399 +0.09066389973958666 -5.637344401041654 3.181327799479173 1.546680501302067 +0.1119965820312533 -5.552013671874986 3.223993164062507 1.440017089843733 +0.1333292643229198 -5.466682942708321 3.26665852864584 1.333353678385401 +0.1546619466145862 -5.381352213541655 3.309323893229172 1.226690266927069 +0.1759946289062527 -5.29602148437499 3.351989257812505 1.120026855468736 +0.1973273111979195 -5.210690755208322 3.394654622395839 1.013363444010403 +0.2186599934895859 -5.125360026041657 3.437319986979172 0.9067000325520706 +0.2399926757812524 -5.040029296874991 3.479985351562505 0.8000366210937381 +0.261325358072919 -4.954698567708324 3.522650716145838 0.6933732096354049 +0.2826580403645855 -4.869367838541658 3.565316080729171 0.5867097981770724 +0.303990722656252 -4.784037109374992 3.607981445312504 0.4800463867187398 +0.3253234049479187 -4.698706380208325 3.650646809895838 0.3733829752604066 +0.3466560872395852 -4.613375651041659 3.69331217447917 0.2667195638020741 +0.3679887695312516 -4.528044921874994 3.735977539062503 0.160056152343742 +0.3893214518229181 -4.442714192708328 3.778642903645836 0.05339274088540935 +0.4106541341145848 -4.357383463541661 3.82130826822917 -0.05327067057292356 +0.4319868164062513 -4.272052734374995 3.863973632812503 -0.1599340820312563 +0.4533194986979177 -4.186722005208329 3.906638997395835 -0.2665974934895889 +0.4746521809895844 -4.101391276041662 3.949304361979169 -0.3732609049479219 +0.4959848632812509 -4.016060546874996 3.991969726562502 -0.4799243164062545 +0.5173175455729173 -3.930729817708331 4.034635091145835 -0.5865877278645866 +0.5386502278645841 -3.845399088541664 4.077300455729168 -0.6932511393229202 +0.5599829101562506 -3.760068359374998 4.119965820312501 -0.7999145507812528 +0.581315592447917 -3.674737630208332 4.162631184895834 -0.9065779622395848 +0.6026482747395835 -3.589406901041666 4.205296549479167 -1.013241373697918 +0.6239809570312501 -3.504076171875 4.2479619140625 -1.11990478515625 +0.6453136393229166 -3.418745442708333 4.290627278645833 -1.226568196614583 +0.6666463216145831 -3.333414713541667 4.333292643229166 -1.333231608072916 +0.6879790039062498 -3.248083984375001 4.3759580078125 -1.439895019531249 +0.7093116861979163 -3.162753255208335 4.418623372395833 -1.546558430989581 +0.7306443684895827 -3.077422526041669 4.461288736979165 -1.653221842447913 +0.7519770507812495 -2.992091796875002 4.503954101562499 -1.759885253906247 +0.773309733072916 -2.906761067708336 4.546619466145832 -1.86654866536458 +0.7946424153645824 -2.821430338541671 4.589284830729165 -1.973212076822912 +0.8159750976562488 -2.736099609375005 4.631950195312498 -2.079875488281244 +0.8373077799479155 -2.650768880208338 4.674615559895831 -2.186538899739578 +0.858640462239582 -2.565438151041672 4.717280924479164 -2.29320231119791 +0.8799731445312485 -2.480107421875006 4.759946289062497 -2.399865722656243 +0.9013058268229152 -2.394776692708339 4.802611653645831 -2.506529134114576 +0.9226385091145817 -2.309445963541673 4.845277018229163 -2.613192545572908 +0.9439711914062482 -2.224115234375008 4.887942382812496 -2.71985595703124 +0.9653038736979148 -2.138784505208341 4.93060774739583 -2.826519368489574 +0.9866365559895813 -2.053453776041675 4.973273111979163 -2.933182779947907 +1.007969238281248 -1.968123046875009 5.015938476562495 -3.039846191406239 +1.029301920572914 -1.882792317708343 5.058603841145828 -3.146509602864571 +1.050634602864581 -1.797461588541676 5.101269205729162 -3.253173014322905 +1.071967285156247 -1.71213085937501 5.143934570312495 -3.359836425781237 +1.093299967447914 -1.626800130208345 5.186599934895828 -3.466499837239569 +1.114632649739581 -1.541469401041677 5.229265299479161 -3.573163248697903 +1.135965332031247 -1.456138671875012 5.271930664062494 -3.679826660156235 +1.157298014322913 -1.370807942708346 5.314596028645827 -3.786490071614567 +1.17863069661458 -1.285477213541679 5.357261393229161 -3.893153483072902 +1.199963378906247 -1.200146484375013 5.399926757812493 -3.999816894531234 +1.221296061197913 -1.114815755208348 5.442592122395826 -4.106480305989566 +1.24262874348958 -1.029485026041682 5.485257486979159 -4.213143717447897 +1.263961425781246 -0.9441542968750145 5.527922851562493 -4.319807128906232 +1.285294108072913 -0.8588235677083489 5.570588216145826 -4.426470540364564 +1.306626790364579 -0.7734928385416833 5.613253580729158 -4.533133951822895 +1.327959472656246 -0.6881621093750159 5.655918945312492 -4.639797363281231 +1.349292154947912 -0.6028313802083503 5.698584309895825 -4.746460774739562 +1.370624837239579 -0.5175006510416846 5.741249674479158 -4.853124186197895 +1.391957519531245 -0.432169921875019 5.78391503906249 -4.959787597656226 +1.413290201822912 -0.3468391927083516 5.826580403645824 -5.06645100911456 +1.434622884114579 -0.261508463541686 5.869245768229157 -5.173114420572893 +1.455955566406245 -0.1761777343750204 5.91191113281249 -5.279777832031225 +1.477288248697912 -0.09084700520835298 5.954576497395824 -5.386441243489559 +1.498620930989578 -0.005516276041687362 5.997241861979156 -5.493104654947891 +1.519953613281245 0.07981445312497826 6.039907226562489 -5.599768066406223 +1.541286295572911 0.1651451822916457 6.082572591145823 -5.706431477864557 +1.562618977864578 0.2504759114583113 6.125237955729156 -5.81309488932289 +1.583951660156244 0.3358066406249769 6.167903320312488 -5.919758300781221 +1.605284342447911 0.4211373697916425 6.210568684895821 -6.026421712239553 +1.626617024739577 0.5064680989583099 6.253234049479155 -6.133085123697888 +1.647949707031244 0.5917988281249755 6.295899414062488 -6.239748535156219 +1.66928238932291 0.6771295572916411 6.338564778645821 -6.346411946614551 +1.690615071614577 0.7624602864583085 6.381230143229154 -6.453075358072886 +1.711947753906244 0.8477910156249742 6.423895507812487 -6.559738769531218 +1.73328043619791 0.9331217447916398 6.46656087239582 -6.666402180989549 +1.754613118489577 1.018452473958307 6.509226236979154 -6.773065592447884 +1.775945800781243 1.103783203124973 6.551891601562486 -6.879729003906216 +1.79727848307291 1.189113932291638 6.594556966145819 -6.986392415364548 +1.818611165364576 1.274444661458304 6.637222330729152 -7.09305582682288 +1.839943847656243 1.359775390624971 6.679887695312486 -7.199719238281214 +1.861276529947909 1.445106119791637 6.722553059895819 -7.306382649739546 +1.882609212239576 1.530436848958303 6.765218424479151 -7.413046061197878 +1.903941894531243 1.61576757812497 6.807883789062485 -7.519709472656213 +1.925274576822909 1.701098307291636 6.850549153645818 -7.626372884114544 +1.946607259114575 1.786429036458301 6.893214518229151 -7.733036295572877 +1.967939941406242 1.871759765624969 6.935879882812484 -7.839699707031211 +1.989272623697909 1.957090494791634 6.978545247395817 -7.946363118489542 +1.99981689825654 1.999267593026161 6.999633796513081 -7.999084491282701 diff --git a/tests/circuitpython/synth_block_max.py b/tests/circuitpython/synth_block_max.py new file mode 100644 index 0000000000..e8fe3d6afc --- /dev/null +++ b/tests/circuitpython/synth_block_max.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.MAX) diff --git a/tests/circuitpython/synth_block_max.py.exp b/tests/circuitpython/synth_block_max.py.exp new file mode 100644 index 0000000000..0d324f9132 --- /dev/null +++ b/tests/circuitpython/synth_block_max.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 2.0 2.0 2.0 +-1.957273600260416 2.0 2.0 2.0 +-1.93594091796875 2.0 2.0 2.0 +-1.914608235677083 2.0 2.0 2.0 +-1.893275553385417 2.0 2.0 2.0 +-1.87194287109375 2.0 2.0 2.0 +-1.850610188802083 2.0 2.0 2.0 +-1.829277506510417 2.0 2.0 2.0 +-1.80794482421875 2.0 2.0 2.0 +-1.786612141927083 2.0 2.0 2.0 +-1.765279459635417 2.0 2.0 2.0 +-1.74394677734375 2.0 2.0 2.0 +-1.722614095052083 2.0 2.0 2.0 +-1.701281412760417 2.0 2.0 2.0 +-1.67994873046875 2.0 2.0 2.0 +-1.658616048177083 2.0 2.0 2.0 +-1.637283365885417 2.0 2.0 2.0 +-1.61595068359375 2.0 2.0 2.0 +-1.594618001302083 2.0 2.0 2.0 +-1.573285319010417 2.0 2.0 2.0 +-1.55195263671875 2.0 2.0 2.0 +-1.530619954427083 2.0 2.0 2.0 +-1.509287272135417 2.0 2.0 2.0 +-1.48795458984375 2.0 2.0 2.0 +-1.466621907552084 2.0 2.0 2.0 +-1.445289225260417 2.0 2.0 2.0 +-1.42395654296875 2.0 2.0 2.0 +-1.402623860677084 2.0 2.0 2.0 +-1.381291178385417 2.0 2.0 2.0 +-1.35995849609375 2.0 2.0 2.0 +-1.338625813802083 2.0 2.0 2.0 +-1.317293131510417 2.0 2.0 2.0 +-1.29596044921875 2.0 2.0 2.0 +-1.274627766927084 2.0 2.0 2.0 +-1.253295084635417 2.0 2.0 2.0 +-1.23196240234375 2.0 2.0 2.0 +-1.210629720052084 2.0 2.0 2.0 +-1.189297037760417 2.0 2.0 2.0 +-1.16796435546875 2.0 2.0 2.0 +-1.146631673177084 2.0 2.0 2.0 +-1.125298990885417 2.0 2.0 2.0 +-1.10396630859375 2.0 2.0 2.0 +-1.082633626302084 2.0 2.0 2.0 +-1.061300944010417 2.0 2.0 2.0 +-1.039968261718751 2.0 2.0 2.0 +-1.018635579427084 2.0 2.0 2.0 +-0.9973028971354172 2.0 2.0 2.0 +-0.9759702148437505 2.0 2.0 2.0 +-0.9546375325520838 2.0 2.0 2.0 +-0.9333048502604168 2.0 2.0 2.0 +-0.9119721679687501 2.0 2.0 2.0 +-0.8906394856770833 2.0 2.0 2.0 +-0.8693068033854166 2.0 2.0 2.0 +-0.8479741210937499 2.0 2.0 2.0 +-0.8266414388020831 2.0 2.0 2.0 +-0.8053087565104164 2.0 2.0 2.0 +-0.7839760742187497 2.0 2.0 2.0 +-0.7626433919270829 2.0 2.0 2.0 +-0.7413107096354159 2.0 2.0 2.0 +-0.7199780273437493 2.0 2.0 2.0 +-0.6986453450520828 2.0 2.0 2.0 +-0.6773126627604157 2.0 2.0 2.0 +-0.6559799804687488 2.0 2.0 2.0 +-0.6346472981770823 2.0 2.0 2.0 +-0.6133146158854156 2.0 2.0 2.0 +-0.5919819335937487 2.0 2.0 2.0 +-0.5706492513020819 2.0 2.0 2.0 +-0.5493165690104153 2.0 2.0 2.0 +-0.5279838867187485 2.0 2.0 2.0 +-0.5066512044270817 2.0 2.0 2.0 +-0.4853185221354149 2.0 2.0 2.0 +-0.4639858398437481 2.0 2.0 2.0 +-0.4426531575520815 2.0 2.0 2.0 +-0.4213204752604147 2.0 2.0 2.0 +-0.3999877929687479 2.0 2.0 2.0 +-0.3786551106770811 2.0 2.0 2.0 +-0.3573224283854145 2.0 2.0 2.0 +-0.3359897460937477 2.0 2.0 2.0 +-0.3146570638020807 2.0 2.0 2.0 +-0.2933243815104141 2.0 2.0 2.0 +-0.2719916992187476 2.0 2.0 2.0 +-0.2506590169270807 2.0 2.0 2.0 +-0.2293263346354136 2.0 2.0 2.0 +-0.2079936523437471 2.0 2.0 2.0 +-0.1866609700520805 2.0 2.0 2.0 +-0.1653282877604135 2.0 2.0 2.0 +-0.1439956054687467 2.0 2.0 2.0 +-0.1226629231770801 2.0 2.0 2.0 +-0.1013302408854133 2.0 2.0 2.0 +-0.07999755859374647 2.0 2.0 2.0 +-0.05866487630207972 2.0 2.0 2.0 +-0.0373321940104131 2.0 2.0 2.0 +-0.01599951171874625 2.0 2.0 2.0 +0.005333170572920487 2.0 2.0 2.0 +0.026665852864587 2.0 2.0 2.0 +0.04799853515625363 2.0 2.0 2.0 +0.06933121744792015 2.0 2.0 2.0 +0.09066389973958666 2.0 2.0 2.0 +0.1119965820312533 2.0 2.0 2.0 +0.1333292643229198 2.0 2.0 2.0 +0.1546619466145862 2.0 2.0 2.0 +0.1759946289062527 2.0 2.0 2.0 +0.1973273111979195 2.0 2.0 2.0 +0.2186599934895859 2.0 2.0 2.0 +0.2399926757812524 2.0 2.0 2.0 +0.261325358072919 2.0 2.0 2.0 +0.2826580403645855 2.0 2.0 2.0 +0.303990722656252 2.0 2.0 2.0 +0.3253234049479187 2.0 2.0 2.0 +0.3466560872395852 2.0 2.0 2.0 +0.3679887695312516 2.0 2.0 2.0 +0.3893214518229181 2.0 2.0 2.0 +0.4106541341145848 2.0 2.0 2.0 +0.4319868164062513 2.0 2.0 2.0 +0.4533194986979177 2.0 2.0 2.0 +0.4746521809895844 2.0 2.0 2.0 +0.4959848632812509 2.0 2.0 2.0 +0.5173175455729173 2.0 2.0 2.0 +0.5386502278645841 2.0 2.0 2.0 +0.5599829101562506 2.0 2.0 2.0 +0.581315592447917 2.0 2.0 2.0 +0.6026482747395835 2.0 2.0 2.0 +0.6239809570312501 2.0 2.0 2.0 +0.6453136393229166 2.0 2.0 2.0 +0.6666463216145831 2.0 2.0 2.0 +0.6879790039062498 2.0 2.0 2.0 +0.7093116861979163 2.0 2.0 2.0 +0.7306443684895827 2.0 2.0 2.0 +0.7519770507812495 2.0 2.0 2.0 +0.773309733072916 2.0 2.0 2.0 +0.7946424153645824 2.0 2.0 2.0 +0.8159750976562488 2.0 2.0 2.0 +0.8373077799479155 2.0 2.0 2.0 +0.858640462239582 2.0 2.0 2.0 +0.8799731445312485 2.0 2.0 2.0 +0.9013058268229152 2.0 2.0 2.0 +0.9226385091145817 2.0 2.0 2.0 +0.9439711914062482 2.0 2.0 2.0 +0.9653038736979148 2.0 2.0 2.0 +0.9866365559895813 2.0 2.0 2.0 +1.007969238281248 2.0 2.0 2.0 +1.029301920572914 2.0 2.0 2.0 +1.050634602864581 2.0 2.0 2.0 +1.071967285156247 2.0 2.0 2.0 +1.093299967447914 2.0 2.0 2.0 +1.114632649739581 2.0 2.0 2.0 +1.135965332031247 2.0 2.0 2.0 +1.157298014322913 2.0 2.0 2.0 +1.17863069661458 2.0 2.0 2.0 +1.199963378906247 2.0 2.0 2.0 +1.221296061197913 2.0 2.0 2.0 +1.24262874348958 2.0 2.0 2.0 +1.263961425781246 2.0 2.0 2.0 +1.285294108072913 2.0 2.0 2.0 +1.306626790364579 2.0 2.0 2.0 +1.327959472656246 2.0 2.0 2.0 +1.349292154947912 2.0 2.0 2.0 +1.370624837239579 2.0 2.0 2.0 +1.391957519531245 2.0 2.0 2.0 +1.413290201822912 2.0 2.0 2.0 +1.434622884114579 2.0 2.0 2.0 +1.455955566406245 2.0 2.0 2.0 +1.477288248697912 2.0 2.0 2.0 +1.498620930989578 2.0 2.0 2.0 +1.519953613281245 2.0 2.0 2.0 +1.541286295572911 2.0 2.0 2.0 +1.562618977864578 2.0 2.0 2.0 +1.583951660156244 2.0 2.0 2.0 +1.605284342447911 2.0 2.0 2.0 +1.626617024739577 2.0 2.0 2.0 +1.647949707031244 2.0 2.0 2.0 +1.66928238932291 2.0 2.0 2.0 +1.690615071614577 2.0 2.0 2.0 +1.711947753906244 2.0 2.0 2.0 +1.73328043619791 2.0 2.0 2.0 +1.754613118489577 2.0 2.0 2.0 +1.775945800781243 2.0 2.0 2.0 +1.79727848307291 2.0 2.0 2.0 +1.818611165364576 2.0 2.0 2.0 +1.839943847656243 2.0 2.0 2.0 +1.861276529947909 2.0 2.0 2.0 +1.882609212239576 2.0 2.0 2.0 +1.903941894531243 2.0 2.0 2.0 +1.925274576822909 2.0 2.0 2.0 +1.946607259114575 2.0 2.0 2.0 +1.967939941406242 2.0 2.0 2.0 +1.989272623697909 2.0 2.0 2.0 +1.99981689825654 2.0 2.0 2.0 diff --git a/tests/circuitpython/synth_block_mid.py b/tests/circuitpython/synth_block_mid.py new file mode 100644 index 0000000000..826bcac619 --- /dev/null +++ b/tests/circuitpython/synth_block_mid.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.MID) diff --git a/tests/circuitpython/synth_block_mid.py.exp b/tests/circuitpython/synth_block_mid.py.exp new file mode 100644 index 0000000000..c9b3b0f91e --- /dev/null +++ b/tests/circuitpython/synth_block_mid.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 -1.978606282552083 -1.978606282552083 -1.978606282552083 +-1.957273600260416 -1.957273600260416 -1.957273600260416 -1.957273600260416 +-1.93594091796875 -1.93594091796875 -1.93594091796875 -1.93594091796875 +-1.914608235677083 -1.914608235677083 -1.914608235677083 -1.914608235677083 +-1.893275553385417 -1.893275553385417 -1.893275553385417 -1.893275553385417 +-1.87194287109375 -1.87194287109375 -1.87194287109375 -1.87194287109375 +-1.850610188802083 -1.850610188802083 -1.850610188802083 -1.850610188802083 +-1.829277506510417 -1.829277506510417 -1.829277506510417 -1.829277506510417 +-1.80794482421875 -1.80794482421875 -1.80794482421875 -1.80794482421875 +-1.786612141927083 -1.786612141927083 -1.786612141927083 -1.786612141927083 +-1.765279459635417 -1.765279459635417 -1.765279459635417 -1.765279459635417 +-1.74394677734375 -1.74394677734375 -1.74394677734375 -1.74394677734375 +-1.722614095052083 -1.722614095052083 -1.722614095052083 -1.722614095052083 +-1.701281412760417 -1.701281412760417 -1.701281412760417 -1.701281412760417 +-1.67994873046875 -1.67994873046875 -1.67994873046875 -1.67994873046875 +-1.658616048177083 -1.658616048177083 -1.658616048177083 -1.658616048177083 +-1.637283365885417 -1.637283365885417 -1.637283365885417 -1.637283365885417 +-1.61595068359375 -1.61595068359375 -1.61595068359375 -1.61595068359375 +-1.594618001302083 -1.594618001302083 -1.594618001302083 -1.594618001302083 +-1.573285319010417 -1.573285319010417 -1.573285319010417 -1.573285319010417 +-1.55195263671875 -1.55195263671875 -1.55195263671875 -1.55195263671875 +-1.530619954427083 -1.530619954427083 -1.530619954427083 -1.530619954427083 +-1.509287272135417 -1.509287272135417 -1.509287272135417 -1.509287272135417 +-1.48795458984375 -1.48795458984375 -1.48795458984375 -1.48795458984375 +-1.466621907552084 -1.466621907552084 -1.466621907552084 -1.466621907552084 +-1.445289225260417 -1.445289225260417 -1.445289225260417 -1.445289225260417 +-1.42395654296875 -1.42395654296875 -1.42395654296875 -1.42395654296875 +-1.402623860677084 -1.402623860677084 -1.402623860677084 -1.402623860677084 +-1.381291178385417 -1.381291178385417 -1.381291178385417 -1.381291178385417 +-1.35995849609375 -1.35995849609375 -1.35995849609375 -1.35995849609375 +-1.338625813802083 -1.338625813802083 -1.338625813802083 -1.338625813802083 +-1.317293131510417 -1.317293131510417 -1.317293131510417 -1.317293131510417 +-1.29596044921875 -1.29596044921875 -1.29596044921875 -1.29596044921875 +-1.274627766927084 -1.274627766927084 -1.274627766927084 -1.274627766927084 +-1.253295084635417 -1.253295084635417 -1.253295084635417 -1.253295084635417 +-1.23196240234375 -1.23196240234375 -1.23196240234375 -1.23196240234375 +-1.210629720052084 -1.210629720052084 -1.210629720052084 -1.210629720052084 +-1.189297037760417 -1.189297037760417 -1.189297037760417 -1.189297037760417 +-1.16796435546875 -1.16796435546875 -1.16796435546875 -1.16796435546875 +-1.146631673177084 -1.146631673177084 -1.146631673177084 -1.146631673177084 +-1.125298990885417 -1.125298990885417 -1.125298990885417 -1.125298990885417 +-1.10396630859375 -1.10396630859375 -1.10396630859375 -1.10396630859375 +-1.082633626302084 -1.082633626302084 -1.082633626302084 -1.082633626302084 +-1.061300944010417 -1.061300944010417 -1.061300944010417 -1.061300944010417 +-1.039968261718751 -1.039968261718751 -1.039968261718751 -1.039968261718751 +-1.018635579427084 -1.018635579427084 -1.018635579427084 -1.018635579427084 +-0.9973028971354172 -0.9973028971354172 -0.9973028971354172 -0.9973028971354172 +-0.9759702148437505 -0.9759702148437505 -0.9759702148437505 -0.9759702148437505 +-0.9546375325520838 -0.9546375325520838 -0.9546375325520838 -0.9546375325520838 +-0.9333048502604168 -0.9333048502604168 -0.9333048502604168 -0.9333048502604168 +-0.9119721679687501 -0.9119721679687501 -0.9119721679687501 -0.9119721679687501 +-0.8906394856770833 -0.8906394856770833 -0.8906394856770833 -0.8906394856770833 +-0.8693068033854166 -0.8693068033854166 -0.8693068033854166 -0.8693068033854166 +-0.8479741210937499 -0.8479741210937499 -0.8479741210937499 -0.8479741210937499 +-0.8266414388020831 -0.8266414388020831 -0.8266414388020831 -0.8266414388020831 +-0.8053087565104164 -0.8053087565104164 -0.8053087565104164 -0.8053087565104164 +-0.7839760742187497 -0.7839760742187497 -0.7839760742187497 -0.7839760742187497 +-0.7626433919270829 -0.7626433919270829 -0.7626433919270829 -0.7626433919270829 +-0.7413107096354159 -0.7413107096354159 -0.7413107096354159 -0.7413107096354159 +-0.7199780273437493 -0.7199780273437493 -0.7199780273437493 -0.7199780273437493 +-0.6986453450520828 -0.6986453450520828 -0.6986453450520828 -0.6986453450520828 +-0.6773126627604157 -0.6773126627604157 -0.6773126627604157 -0.6773126627604157 +-0.6559799804687488 -0.6559799804687488 -0.6559799804687488 -0.6559799804687488 +-0.6346472981770823 -0.6346472981770823 -0.6346472981770823 -0.6346472981770823 +-0.6133146158854156 -0.6133146158854156 -0.6133146158854156 -0.6133146158854156 +-0.5919819335937487 -0.5919819335937487 -0.5919819335937487 -0.5919819335937487 +-0.5706492513020819 -0.5706492513020819 -0.5706492513020819 -0.5706492513020819 +-0.5493165690104153 -0.5493165690104153 -0.5493165690104153 -0.5493165690104153 +-0.5279838867187485 -0.5279838867187485 -0.5279838867187485 -0.5279838867187485 +-0.5066512044270817 -0.5066512044270817 -0.5066512044270817 -0.5066512044270817 +-0.4853185221354149 -0.4853185221354149 -0.4853185221354149 -0.4853185221354149 +-0.4639858398437481 -0.4639858398437481 -0.4639858398437481 -0.4639858398437481 +-0.4426531575520815 -0.4426531575520815 -0.4426531575520815 -0.4426531575520815 +-0.4213204752604147 -0.4213204752604147 -0.4213204752604147 -0.4213204752604147 +-0.3999877929687479 -0.3999877929687479 -0.3999877929687479 -0.3999877929687479 +-0.3786551106770811 -0.3786551106770811 -0.3786551106770811 -0.3786551106770811 +-0.3573224283854145 -0.3573224283854145 -0.3573224283854145 -0.3573224283854145 +-0.3359897460937477 -0.3359897460937477 -0.3359897460937477 -0.3359897460937477 +-0.3146570638020807 -0.3146570638020807 -0.3146570638020807 -0.3146570638020807 +-0.2933243815104141 -0.2933243815104141 -0.2933243815104141 -0.2933243815104141 +-0.2719916992187476 -0.2719916992187476 -0.2719916992187476 -0.2719916992187476 +-0.2506590169270807 -0.2506590169270807 -0.2506590169270807 -0.2506590169270807 +-0.2293263346354136 -0.2293263346354136 -0.2293263346354136 -0.2293263346354136 +-0.2079936523437471 -0.2079936523437471 -0.2079936523437471 -0.2079936523437471 +-0.1866609700520805 -0.1866609700520805 -0.1866609700520805 -0.1866609700520805 +-0.1653282877604135 -0.1653282877604135 -0.1653282877604135 -0.1653282877604135 +-0.1439956054687467 -0.1439956054687467 -0.1439956054687467 -0.1439956054687467 +-0.1226629231770801 -0.1226629231770801 -0.1226629231770801 -0.1226629231770801 +-0.1013302408854133 -0.1013302408854133 -0.1013302408854133 -0.1013302408854133 +-0.07999755859374647 -0.07999755859374647 -0.07999755859374647 -0.07999755859374647 +-0.05866487630207972 -0.05866487630207972 -0.05866487630207972 -0.05866487630207972 +-0.0373321940104131 -0.0373321940104131 -0.0373321940104131 -0.0373321940104131 +-0.01599951171874625 -0.01599951171874625 -0.01599951171874625 -0.01599951171874625 +0.005333170572920487 0.005333170572920487 0.005333170572920487 0.005333170572920487 +0.026665852864587 0.026665852864587 0.026665852864587 0.026665852864587 +0.04799853515625363 0.04799853515625363 0.04799853515625363 0.04799853515625363 +0.06933121744792015 0.06933121744792015 0.06933121744792015 0.06933121744792015 +0.09066389973958666 0.09066389973958666 0.09066389973958666 0.09066389973958666 +0.1119965820312533 0.1119965820312533 0.1119965820312533 0.1119965820312533 +0.1333292643229198 0.1333292643229198 0.1333292643229198 0.1333292643229198 +0.1546619466145862 0.1546619466145862 0.1546619466145862 0.1546619466145862 +0.1759946289062527 0.1759946289062527 0.1759946289062527 0.1759946289062527 +0.1973273111979195 0.1973273111979195 0.1973273111979195 0.1973273111979195 +0.2186599934895859 0.2186599934895859 0.2186599934895859 0.2186599934895859 +0.2399926757812524 0.2399926757812524 0.2399926757812524 0.2399926757812524 +0.261325358072919 0.261325358072919 0.261325358072919 0.261325358072919 +0.2826580403645855 0.2826580403645855 0.2826580403645855 0.2826580403645855 +0.303990722656252 0.303990722656252 0.303990722656252 0.303990722656252 +0.3253234049479187 0.3253234049479187 0.3253234049479187 0.3253234049479187 +0.3466560872395852 0.3466560872395852 0.3466560872395852 0.3466560872395852 +0.3679887695312516 0.3679887695312516 0.3679887695312516 0.3679887695312516 +0.3893214518229181 0.3893214518229181 0.3893214518229181 0.3893214518229181 +0.4106541341145848 0.4106541341145848 0.4106541341145848 0.4106541341145848 +0.4319868164062513 0.4319868164062513 0.4319868164062513 0.4319868164062513 +0.4533194986979177 0.4533194986979177 0.4533194986979177 0.4533194986979177 +0.4746521809895844 0.4746521809895844 0.4746521809895844 0.4746521809895844 +0.4959848632812509 0.4959848632812509 0.4959848632812509 0.4959848632812509 +0.5173175455729173 0.5173175455729173 0.5173175455729173 0.5173175455729173 +0.5386502278645841 0.5386502278645841 0.5386502278645841 0.5386502278645841 +0.5599829101562506 0.5599829101562506 0.5599829101562506 0.5599829101562506 +0.581315592447917 0.581315592447917 0.581315592447917 0.581315592447917 +0.6026482747395835 0.6026482747395835 0.6026482747395835 0.6026482747395835 +0.6239809570312501 0.6239809570312501 0.6239809570312501 0.6239809570312501 +0.6453136393229166 0.6453136393229166 0.6453136393229166 0.6453136393229166 +0.6666463216145831 0.6666463216145831 0.6666463216145831 0.6666463216145831 +0.6879790039062498 0.6879790039062498 0.6879790039062498 0.6879790039062498 +0.7093116861979163 0.7093116861979163 0.7093116861979163 0.7093116861979163 +0.7306443684895827 0.7306443684895827 0.7306443684895827 0.7306443684895827 +0.7519770507812495 0.7519770507812495 0.7519770507812495 0.7519770507812495 +0.773309733072916 0.773309733072916 0.773309733072916 0.773309733072916 +0.7946424153645824 0.7946424153645824 0.7946424153645824 0.7946424153645824 +0.8159750976562488 0.8159750976562488 0.8159750976562488 0.8159750976562488 +0.8373077799479155 0.8373077799479155 0.8373077799479155 0.8373077799479155 +0.858640462239582 0.858640462239582 0.858640462239582 0.858640462239582 +0.8799731445312485 0.8799731445312485 0.8799731445312485 0.8799731445312485 +0.9013058268229152 0.9013058268229152 0.9013058268229152 0.9013058268229152 +0.9226385091145817 0.9226385091145817 0.9226385091145817 0.9226385091145817 +0.9439711914062482 0.9439711914062482 0.9439711914062482 0.9439711914062482 +0.9653038736979148 0.9653038736979148 0.9653038736979148 0.9653038736979148 +0.9866365559895813 0.9866365559895813 0.9866365559895813 0.9866365559895813 +1.007969238281248 1.007969238281248 1.007969238281248 1.007969238281248 +1.029301920572914 1.029301920572914 1.029301920572914 1.029301920572914 +1.050634602864581 1.050634602864581 1.050634602864581 1.050634602864581 +1.071967285156247 1.071967285156247 1.071967285156247 1.071967285156247 +1.093299967447914 1.093299967447914 1.093299967447914 1.093299967447914 +1.114632649739581 1.114632649739581 1.114632649739581 1.114632649739581 +1.135965332031247 1.135965332031247 1.135965332031247 1.135965332031247 +1.157298014322913 1.157298014322913 1.157298014322913 1.157298014322913 +1.17863069661458 1.17863069661458 1.17863069661458 1.17863069661458 +1.199963378906247 1.199963378906247 1.199963378906247 1.199963378906247 +1.221296061197913 1.221296061197913 1.221296061197913 1.221296061197913 +1.24262874348958 1.24262874348958 1.24262874348958 1.24262874348958 +1.263961425781246 1.263961425781246 1.263961425781246 1.263961425781246 +1.285294108072913 1.285294108072913 1.285294108072913 1.285294108072913 +1.306626790364579 1.306626790364579 1.306626790364579 1.306626790364579 +1.327959472656246 1.327959472656246 1.327959472656246 1.327959472656246 +1.349292154947912 1.349292154947912 1.349292154947912 1.349292154947912 +1.370624837239579 1.370624837239579 1.370624837239579 1.370624837239579 +1.391957519531245 1.391957519531245 1.391957519531245 1.391957519531245 +1.413290201822912 1.413290201822912 1.413290201822912 1.413290201822912 +1.434622884114579 1.434622884114579 1.434622884114579 1.434622884114579 +1.455955566406245 1.455955566406245 1.455955566406245 1.455955566406245 +1.477288248697912 1.477288248697912 1.477288248697912 1.477288248697912 +1.498620930989578 1.498620930989578 1.498620930989578 1.498620930989578 +1.519953613281245 1.519953613281245 1.519953613281245 1.519953613281245 +1.541286295572911 1.541286295572911 1.541286295572911 1.541286295572911 +1.562618977864578 1.562618977864578 1.562618977864578 1.562618977864578 +1.583951660156244 1.583951660156244 1.583951660156244 1.583951660156244 +1.605284342447911 1.605284342447911 1.605284342447911 1.605284342447911 +1.626617024739577 1.626617024739577 1.626617024739577 1.626617024739577 +1.647949707031244 1.647949707031244 1.647949707031244 1.647949707031244 +1.66928238932291 1.66928238932291 1.66928238932291 1.66928238932291 +1.690615071614577 1.690615071614577 1.690615071614577 1.690615071614577 +1.711947753906244 1.711947753906244 1.711947753906244 1.711947753906244 +1.73328043619791 1.73328043619791 1.73328043619791 1.73328043619791 +1.754613118489577 1.754613118489577 1.754613118489577 1.754613118489577 +1.775945800781243 1.775945800781243 1.775945800781243 1.775945800781243 +1.79727848307291 1.79727848307291 1.79727848307291 1.79727848307291 +1.818611165364576 1.818611165364576 1.818611165364576 1.818611165364576 +1.839943847656243 1.839943847656243 1.839943847656243 1.839943847656243 +1.861276529947909 1.861276529947909 1.861276529947909 1.861276529947909 +1.882609212239576 1.882609212239576 1.882609212239576 1.882609212239576 +1.903941894531243 1.903941894531243 1.903941894531243 1.903941894531243 +1.925274576822909 1.925274576822909 1.925274576822909 1.925274576822909 +1.946607259114575 1.946607259114575 1.946607259114575 1.946607259114575 +1.967939941406242 1.967939941406242 1.967939941406242 1.967939941406242 +1.989272623697909 1.989272623697909 1.989272623697909 1.989272623697909 +1.99981689825654 1.99981689825654 1.99981689825654 1.99981689825654 diff --git a/tests/circuitpython/synth_block_min.py b/tests/circuitpython/synth_block_min.py new file mode 100644 index 0000000000..a1ac08a9e5 --- /dev/null +++ b/tests/circuitpython/synth_block_min.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.MIN) diff --git a/tests/circuitpython/synth_block_min.py.exp b/tests/circuitpython/synth_block_min.py.exp new file mode 100644 index 0000000000..058d981c8b --- /dev/null +++ b/tests/circuitpython/synth_block_min.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 -3.0 -3.0 -3.0 +-1.957273600260416 -3.0 -3.0 -3.0 +-1.93594091796875 -3.0 -3.0 -3.0 +-1.914608235677083 -3.0 -3.0 -3.0 +-1.893275553385417 -3.0 -3.0 -3.0 +-1.87194287109375 -3.0 -3.0 -3.0 +-1.850610188802083 -3.0 -3.0 -3.0 +-1.829277506510417 -3.0 -3.0 -3.0 +-1.80794482421875 -3.0 -3.0 -3.0 +-1.786612141927083 -3.0 -3.0 -3.0 +-1.765279459635417 -3.0 -3.0 -3.0 +-1.74394677734375 -3.0 -3.0 -3.0 +-1.722614095052083 -3.0 -3.0 -3.0 +-1.701281412760417 -3.0 -3.0 -3.0 +-1.67994873046875 -3.0 -3.0 -3.0 +-1.658616048177083 -3.0 -3.0 -3.0 +-1.637283365885417 -3.0 -3.0 -3.0 +-1.61595068359375 -3.0 -3.0 -3.0 +-1.594618001302083 -3.0 -3.0 -3.0 +-1.573285319010417 -3.0 -3.0 -3.0 +-1.55195263671875 -3.0 -3.0 -3.0 +-1.530619954427083 -3.0 -3.0 -3.0 +-1.509287272135417 -3.0 -3.0 -3.0 +-1.48795458984375 -3.0 -3.0 -3.0 +-1.466621907552084 -3.0 -3.0 -3.0 +-1.445289225260417 -3.0 -3.0 -3.0 +-1.42395654296875 -3.0 -3.0 -3.0 +-1.402623860677084 -3.0 -3.0 -3.0 +-1.381291178385417 -3.0 -3.0 -3.0 +-1.35995849609375 -3.0 -3.0 -3.0 +-1.338625813802083 -3.0 -3.0 -3.0 +-1.317293131510417 -3.0 -3.0 -3.0 +-1.29596044921875 -3.0 -3.0 -3.0 +-1.274627766927084 -3.0 -3.0 -3.0 +-1.253295084635417 -3.0 -3.0 -3.0 +-1.23196240234375 -3.0 -3.0 -3.0 +-1.210629720052084 -3.0 -3.0 -3.0 +-1.189297037760417 -3.0 -3.0 -3.0 +-1.16796435546875 -3.0 -3.0 -3.0 +-1.146631673177084 -3.0 -3.0 -3.0 +-1.125298990885417 -3.0 -3.0 -3.0 +-1.10396630859375 -3.0 -3.0 -3.0 +-1.082633626302084 -3.0 -3.0 -3.0 +-1.061300944010417 -3.0 -3.0 -3.0 +-1.039968261718751 -3.0 -3.0 -3.0 +-1.018635579427084 -3.0 -3.0 -3.0 +-0.9973028971354172 -3.0 -3.0 -3.0 +-0.9759702148437505 -3.0 -3.0 -3.0 +-0.9546375325520838 -3.0 -3.0 -3.0 +-0.9333048502604168 -3.0 -3.0 -3.0 +-0.9119721679687501 -3.0 -3.0 -3.0 +-0.8906394856770833 -3.0 -3.0 -3.0 +-0.8693068033854166 -3.0 -3.0 -3.0 +-0.8479741210937499 -3.0 -3.0 -3.0 +-0.8266414388020831 -3.0 -3.0 -3.0 +-0.8053087565104164 -3.0 -3.0 -3.0 +-0.7839760742187497 -3.0 -3.0 -3.0 +-0.7626433919270829 -3.0 -3.0 -3.0 +-0.7413107096354159 -3.0 -3.0 -3.0 +-0.7199780273437493 -3.0 -3.0 -3.0 +-0.6986453450520828 -3.0 -3.0 -3.0 +-0.6773126627604157 -3.0 -3.0 -3.0 +-0.6559799804687488 -3.0 -3.0 -3.0 +-0.6346472981770823 -3.0 -3.0 -3.0 +-0.6133146158854156 -3.0 -3.0 -3.0 +-0.5919819335937487 -3.0 -3.0 -3.0 +-0.5706492513020819 -3.0 -3.0 -3.0 +-0.5493165690104153 -3.0 -3.0 -3.0 +-0.5279838867187485 -3.0 -3.0 -3.0 +-0.5066512044270817 -3.0 -3.0 -3.0 +-0.4853185221354149 -3.0 -3.0 -3.0 +-0.4639858398437481 -3.0 -3.0 -3.0 +-0.4426531575520815 -3.0 -3.0 -3.0 +-0.4213204752604147 -3.0 -3.0 -3.0 +-0.3999877929687479 -3.0 -3.0 -3.0 +-0.3786551106770811 -3.0 -3.0 -3.0 +-0.3573224283854145 -3.0 -3.0 -3.0 +-0.3359897460937477 -3.0 -3.0 -3.0 +-0.3146570638020807 -3.0 -3.0 -3.0 +-0.2933243815104141 -3.0 -3.0 -3.0 +-0.2719916992187476 -3.0 -3.0 -3.0 +-0.2506590169270807 -3.0 -3.0 -3.0 +-0.2293263346354136 -3.0 -3.0 -3.0 +-0.2079936523437471 -3.0 -3.0 -3.0 +-0.1866609700520805 -3.0 -3.0 -3.0 +-0.1653282877604135 -3.0 -3.0 -3.0 +-0.1439956054687467 -3.0 -3.0 -3.0 +-0.1226629231770801 -3.0 -3.0 -3.0 +-0.1013302408854133 -3.0 -3.0 -3.0 +-0.07999755859374647 -3.0 -3.0 -3.0 +-0.05866487630207972 -3.0 -3.0 -3.0 +-0.0373321940104131 -3.0 -3.0 -3.0 +-0.01599951171874625 -3.0 -3.0 -3.0 +0.005333170572920487 -3.0 -3.0 -3.0 +0.026665852864587 -3.0 -3.0 -3.0 +0.04799853515625363 -3.0 -3.0 -3.0 +0.06933121744792015 -3.0 -3.0 -3.0 +0.09066389973958666 -3.0 -3.0 -3.0 +0.1119965820312533 -3.0 -3.0 -3.0 +0.1333292643229198 -3.0 -3.0 -3.0 +0.1546619466145862 -3.0 -3.0 -3.0 +0.1759946289062527 -3.0 -3.0 -3.0 +0.1973273111979195 -3.0 -3.0 -3.0 +0.2186599934895859 -3.0 -3.0 -3.0 +0.2399926757812524 -3.0 -3.0 -3.0 +0.261325358072919 -3.0 -3.0 -3.0 +0.2826580403645855 -3.0 -3.0 -3.0 +0.303990722656252 -3.0 -3.0 -3.0 +0.3253234049479187 -3.0 -3.0 -3.0 +0.3466560872395852 -3.0 -3.0 -3.0 +0.3679887695312516 -3.0 -3.0 -3.0 +0.3893214518229181 -3.0 -3.0 -3.0 +0.4106541341145848 -3.0 -3.0 -3.0 +0.4319868164062513 -3.0 -3.0 -3.0 +0.4533194986979177 -3.0 -3.0 -3.0 +0.4746521809895844 -3.0 -3.0 -3.0 +0.4959848632812509 -3.0 -3.0 -3.0 +0.5173175455729173 -3.0 -3.0 -3.0 +0.5386502278645841 -3.0 -3.0 -3.0 +0.5599829101562506 -3.0 -3.0 -3.0 +0.581315592447917 -3.0 -3.0 -3.0 +0.6026482747395835 -3.0 -3.0 -3.0 +0.6239809570312501 -3.0 -3.0 -3.0 +0.6453136393229166 -3.0 -3.0 -3.0 +0.6666463216145831 -3.0 -3.0 -3.0 +0.6879790039062498 -3.0 -3.0 -3.0 +0.7093116861979163 -3.0 -3.0 -3.0 +0.7306443684895827 -3.0 -3.0 -3.0 +0.7519770507812495 -3.0 -3.0 -3.0 +0.773309733072916 -3.0 -3.0 -3.0 +0.7946424153645824 -3.0 -3.0 -3.0 +0.8159750976562488 -3.0 -3.0 -3.0 +0.8373077799479155 -3.0 -3.0 -3.0 +0.858640462239582 -3.0 -3.0 -3.0 +0.8799731445312485 -3.0 -3.0 -3.0 +0.9013058268229152 -3.0 -3.0 -3.0 +0.9226385091145817 -3.0 -3.0 -3.0 +0.9439711914062482 -3.0 -3.0 -3.0 +0.9653038736979148 -3.0 -3.0 -3.0 +0.9866365559895813 -3.0 -3.0 -3.0 +1.007969238281248 -3.0 -3.0 -3.0 +1.029301920572914 -3.0 -3.0 -3.0 +1.050634602864581 -3.0 -3.0 -3.0 +1.071967285156247 -3.0 -3.0 -3.0 +1.093299967447914 -3.0 -3.0 -3.0 +1.114632649739581 -3.0 -3.0 -3.0 +1.135965332031247 -3.0 -3.0 -3.0 +1.157298014322913 -3.0 -3.0 -3.0 +1.17863069661458 -3.0 -3.0 -3.0 +1.199963378906247 -3.0 -3.0 -3.0 +1.221296061197913 -3.0 -3.0 -3.0 +1.24262874348958 -3.0 -3.0 -3.0 +1.263961425781246 -3.0 -3.0 -3.0 +1.285294108072913 -3.0 -3.0 -3.0 +1.306626790364579 -3.0 -3.0 -3.0 +1.327959472656246 -3.0 -3.0 -3.0 +1.349292154947912 -3.0 -3.0 -3.0 +1.370624837239579 -3.0 -3.0 -3.0 +1.391957519531245 -3.0 -3.0 -3.0 +1.413290201822912 -3.0 -3.0 -3.0 +1.434622884114579 -3.0 -3.0 -3.0 +1.455955566406245 -3.0 -3.0 -3.0 +1.477288248697912 -3.0 -3.0 -3.0 +1.498620930989578 -3.0 -3.0 -3.0 +1.519953613281245 -3.0 -3.0 -3.0 +1.541286295572911 -3.0 -3.0 -3.0 +1.562618977864578 -3.0 -3.0 -3.0 +1.583951660156244 -3.0 -3.0 -3.0 +1.605284342447911 -3.0 -3.0 -3.0 +1.626617024739577 -3.0 -3.0 -3.0 +1.647949707031244 -3.0 -3.0 -3.0 +1.66928238932291 -3.0 -3.0 -3.0 +1.690615071614577 -3.0 -3.0 -3.0 +1.711947753906244 -3.0 -3.0 -3.0 +1.73328043619791 -3.0 -3.0 -3.0 +1.754613118489577 -3.0 -3.0 -3.0 +1.775945800781243 -3.0 -3.0 -3.0 +1.79727848307291 -3.0 -3.0 -3.0 +1.818611165364576 -3.0 -3.0 -3.0 +1.839943847656243 -3.0 -3.0 -3.0 +1.861276529947909 -3.0 -3.0 -3.0 +1.882609212239576 -3.0 -3.0 -3.0 +1.903941894531243 -3.0 -3.0 -3.0 +1.925274576822909 -3.0 -3.0 -3.0 +1.946607259114575 -3.0 -3.0 -3.0 +1.967939941406242 -3.0 -3.0 -3.0 +1.989272623697909 -3.0 -3.0 -3.0 +1.99981689825654 -3.0 -3.0 -3.0 diff --git a/tests/circuitpython/synth_block_mul_div.py b/tests/circuitpython/synth_block_mul_div.py new file mode 100644 index 0000000000..e8184eb1b2 --- /dev/null +++ b/tests/circuitpython/synth_block_mul_div.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.MUL_DIV) diff --git a/tests/circuitpython/synth_block_mul_div.py.exp b/tests/circuitpython/synth_block_mul_div.py.exp new file mode 100644 index 0000000000..f8b658ead3 --- /dev/null +++ b/tests/circuitpython/synth_block_mul_div.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 1.319070855034722 2.967909423828125 3.032437556127117 +-1.957273600260416 1.304849066840278 2.935910400390625 3.065488646657113 +-1.93594091796875 1.290627278645833 2.903911376953125 3.099268135876475 +-1.914608235677083 1.276405490451389 2.871912353515625 3.133800371373706 +-1.893275553385417 1.262183702256945 2.839913330078125 3.169110798093409 +-1.87194287109375 1.2479619140625 2.807914306640625 3.205226020863706 +-1.850610188802083 1.233740125868056 2.775915283203125 3.242173871248301 +-1.829277506510417 1.219518337673611 2.743916259765625 3.279983479076269 +-1.80794482421875 1.205296549479167 2.711917236328125 3.318685349035872 +-1.786612141927083 1.191074761284722 2.679918212890625 3.358311442755703 +-1.765279459635417 1.176852973090278 2.647919189453125 3.398895266837343 +-1.74394677734375 1.162631184895833 2.615920166015625 3.440471967349115 +-1.722614095052083 1.148409396701389 2.583921142578125 3.483078431341054 +-1.701281412760417 1.134187608506944 2.551922119140625 3.526753395997368 +-1.67994873046875 1.1199658203125 2.519923095703125 3.571537566105271 +-1.658616048177083 1.105744032118056 2.487924072265625 3.617473740588941 +-1.637283365885417 1.091522243923611 2.455925048828125 3.664606948935376 +-1.61595068359375 1.077300455729167 2.423926025390625 3.712984598426272 +-1.594618001302083 1.063078667534722 2.391927001953125 3.762656633187828 +-1.573285319010417 1.048856879340278 2.359927978515625 3.813675706180205 +-1.55195263671875 1.034635091145834 2.327928955078125 3.866097365371685 +-1.530619954427083 1.020413302951389 2.295929931640625 3.919980255481395 +-1.509287272135417 1.006191514756945 2.263930908203125 3.975386336830955 +-1.48795458984375 0.9919697265625 2.231931884765625 4.032381123022081 +-1.466621907552084 0.9777479383680557 2.199932861328126 4.091033939356946 +-1.445289225260417 0.9635261501736112 2.167933837890625 4.151418204144504 +-1.42395654296875 0.9493043619791669 2.135934814453126 4.213611735292734 +-1.402623860677084 0.9350825737847224 2.103935791015625 4.277697084878937 +-1.381291178385417 0.9208607855902779 2.071936767578125 4.343761904722627 +-1.35995849609375 0.9066389973958335 2.039937744140626 4.411899346365335 +-1.338625813802083 0.892417209201389 2.007938720703125 4.48220849929546 +-1.317293131510417 0.8781954210069445 1.975939697265625 4.554794871753685 +-1.29596044921875 0.8639736328125002 1.943940673828125 4.629770919025352 +-1.274627766927084 0.8497518446180559 1.911941650390626 4.707256624783096 +-1.253295084635417 0.8355300564236114 1.879942626953126 4.787380141800681 +-1.23196240234375 0.8213082682291667 1.847943603515625 4.870278499234461 +-1.210629720052084 0.8070864800347225 1.815944580078126 4.956098384683525 +-1.189297037760417 0.7928646918402782 1.783945556640626 5.044997010417758 +-1.16796435546875 0.7786429036458334 1.751946533203125 5.137143074534978 +-1.146631673177084 0.764421115451389 1.719947509765625 5.232717829410047 +-1.125298990885417 0.7501993272569448 1.687948486328126 5.331916271673744 +-1.10396630859375 0.7359775390625002 1.655949462890626 5.434948470160194 +-1.082633626302084 0.721755750868056 1.623950439453126 5.542041050853005 +-1.061300944010417 0.7075339626736113 1.591951416015626 5.653438860920402 +-1.039968261718751 0.6933121744791672 1.559952392578126 5.769406837554666 +-1.018635579427084 0.6790903862847225 1.527953369140626 5.890232111639581 +-0.9973028971354172 0.6648685980902781 1.495954345703126 6.016226381407273 +-0.9759702148437505 0.6506468098958337 1.463955322265626 6.147728597394317 +-0.9546375325520838 0.6364250217013891 1.431956298828126 6.285108007391956 +-0.9333048502604168 0.6222032335069446 1.399957275390625 6.428767618989487 +-0.9119721679687501 0.6079814453125001 1.367958251953125 6.579148148088657 +-0.8906394856770833 0.5937596571180555 1.335959228515625 6.736732534869225 +-0.8693068033854166 0.5795378689236111 1.303960205078125 6.902051124681966 +-0.8479741210937499 0.5653160807291666 1.271961181640625 7.075687630963274 +-0.8266414388020831 0.5510942925347221 1.239962158203125 7.258286021439748 +-0.8053087565104164 0.5368725043402776 1.207963134765625 7.45055849882888 +-0.7839760742187497 0.5226507161458331 1.175964111328125 7.653294784511298 +-0.7626433919270829 0.5084289279513886 1.143965087890624 7.867372960301827 +-0.7413107096354159 0.4942071397569439 1.111966064453124 8.09377218218102 +-0.7199780273437493 0.4799853515624995 1.079967041015624 8.333587654245642 +-0.6986453450520828 0.4657635633680552 1.047968017578124 8.588048345978331 +-0.6773126627604157 0.4515417751736105 1.015968994140624 8.858538057662694 +-0.6559799804687488 0.4373199869791659 0.9839699707031233 9.146620596123272 +-0.6346472981770823 0.4230981987847215 0.9519709472656235 9.454070027925734 +-0.6133146158854156 0.4088764105902771 0.9199719238281235 9.782907246288367 +-0.5919819335937487 0.3946546223958325 0.8879729003906231 10.13544444435282 +-0.5706492513020819 0.3804328342013879 0.8559738769531229 10.51433956376788 +-0.5493165690104153 0.3662110460069435 0.8239748535156227 10.92266343032198 +-0.5279838867187485 0.351989257812499 0.7919758300781227 11.36398316488044 +-0.5066512044270817 0.3377674696180544 0.7599768066406225 11.84246666655962 +-0.4853185221354149 0.32354568142361 0.7279777832031225 12.36301465190291 +-0.4639858398437481 0.3093238932291654 0.6959787597656222 12.93142911865707 +-0.4426531575520815 0.2951021050347209 0.6639797363281222 13.55463052196585 +-0.4213204752604147 0.2808803168402765 0.6319807128906221 14.24094092814134 +-0.3999877929687479 0.2666585286458319 0.5999816894531218 15.00045777764222 +-0.3786551106770811 0.2524367404513874 0.5679826660156218 15.84555399046714 +-0.3573224283854145 0.238214952256943 0.5359836425781217 16.79155721377862 +-0.3359897460937477 0.2239931640624985 0.5039846191406214 17.85768783052648 +-0.3146570638020807 0.2097713758680538 0.4719855957031211 19.06837853090119 +-0.2933243815104141 0.1955495876736094 0.4399865722656211 20.45516969678492 +-0.2719916992187476 0.181327799479165 0.4079875488281213 22.05949673182688 +-0.2506590169270807 0.1671060112847205 0.375988525390621 23.93690070900367 +-0.2293263346354136 0.1528842230902757 0.3439895019531205 26.16358914705059 +-0.2079936523437471 0.1386624348958314 0.3119904785156207 28.84703418777375 +-0.1866609700520805 0.124440646701387 0.2799914550781208 32.14383809494793 +-0.1653282877604135 0.1102188585069424 0.2479924316406203 36.29143010719942 +-0.1439956054687467 0.09599707031249778 0.21599340820312 41.66793827122913 +-0.1226629231770801 0.08177528211805337 0.1839943847656201 48.91453623144307 +-0.1013302408854133 0.06755349392360888 0.15199536132812 59.21233333279988 +-0.07999755859374647 0.05333170572916432 0.1199963378906197 75.00228888821401 +-0.05866487630207972 0.03910991753471982 0.08799731445311959 102.27584848393 +-0.0373321940104131 0.0248881293402754 0.05599829101561965 160.7191904747526 +-0.01599951171874625 0.01066634114583084 0.02399926757811937 375.0114444411414 +0.005333170572920487 -0.003555447048613658 -0.007999755859380731 -1125.034333322355 +0.026665852864587 -0.017777235243058 -0.03999877929688051 -225.0068666646011 +0.04799853515625363 -0.03199902343750241 -0.07199780273438044 -125.003814813675 +0.06933121744792015 -0.04622081163194677 -0.1039968261718802 -86.54110256331569 +0.09066389973958666 -0.06044259982639111 -0.13599584960938 -66.17849019547759 +0.1119965820312533 -0.07466438802083553 -0.1679948730468799 -53.5730634915775 +0.1333292643229198 -0.08888617621527988 -0.1999938964843797 -45.00137333292536 +0.1546619466145862 -0.1031079644097241 -0.2319929199218793 -38.79428735597033 +0.1759946289062527 -0.1173297526041685 -0.2639919433593791 -34.0919494946407 +0.1973273111979195 -0.131551540798613 -0.2959909667968792 -30.40633333305796 +0.2186599934895859 -0.1457733289930573 -0.3279899902343788 -27.43986178836945 +0.2399926757812524 -0.1599951171875016 -0.3599890136718786 -25.00076296273665 +0.261325358072919 -0.174216905381946 -0.3919880371093785 -22.95988435353368 +0.2826580403645855 -0.1884386935763903 -0.4239870605468782 -21.22706289288966 +0.303990722656252 -0.2026604817708347 -0.4559860839843781 -19.73744444426584 +0.3253234049479187 -0.2168822699652791 -0.487985107421878 -18.44318579218285 +0.3466560872395852 -0.2311040581597235 -0.5199841308593777 -17.30822051266392 +0.3679887695312516 -0.2453258463541677 -0.5519831542968774 -16.30484541048052 +0.3893214518229181 -0.2595476345486121 -0.5839821777343772 -15.41142922360488 +0.4106541341145848 -0.2737694227430565 -0.615981201171877 -14.61083549770333 +0.4319868164062513 -0.2879912109375009 -0.6479802246093769 -13.88931275707601 +0.4533194986979177 -0.3022129991319451 -0.6799792480468767 -13.23569803909597 +0.4746521809895844 -0.3164347873263896 -0.7119782714843765 -12.64083520587818 +0.4959848632812509 -0.3306565755208339 -0.7439772949218764 -12.09714336906622 +0.5173175455729173 -0.3448783637152782 -0.775976318359376 -11.59829209611504 +0.5386502278645841 -0.3591001519097227 -0.807975341796876 -11.1389537952788 +0.5599829101562506 -0.373321940104167 -0.8399743652343759 -10.7146126983158 +0.581315592447917 -0.3875437282986113 -0.8719733886718755 -10.32141590204734 +0.6026482747395835 -0.4017655164930557 -0.9039724121093753 -9.956056047107612 +0.6239809570312501 -0.4159873046875001 -0.9359714355468752 -9.615678062591114 +0.6453136393229166 -0.4302090928819444 -0.967970458984375 -9.297804407629426 +0.6666463216145831 -0.4444308810763888 -0.9999694824218748 -9.000274666585286 +0.6879790039062498 -0.4586526692708332 -1.031968505859375 -8.721196382350085 +0.7093116861979163 -0.4728744574652775 -1.063967529296874 -8.458904761828279 +0.7306443684895827 -0.4870962456597218 -1.095966552734374 -8.211929440315048 +0.7519770507812495 -0.5013180338541662 -1.127965576171874 -7.978966903001144 +0.773309733072916 -0.5155398220486106 -1.159964599609374 -7.758857471194218 +0.7946424153645824 -0.5297616102430549 -1.191963623046874 -7.550565995457462 +0.8159750976562488 -0.5439833984374992 -1.223962646484373 -7.353165577275569 +0.8373077799479155 -0.5582051866319437 -1.255961669921873 -7.165823779128421 +0.858640462239582 -0.5724269748263881 -1.287960693359373 -6.987790890205977 +0.8799731445312485 -0.5866487630208324 -1.319959716796873 -6.818389898928257 +0.9013058268229152 -0.6008705512152767 -1.351958740234373 -6.657007889486168 +0.9226385091145817 -0.6150923394097211 -1.383957763671873 -6.503088631925795 +0.9439711914062482 -0.6293141276041654 -1.415956787109372 -6.356126176967021 +0.9653038736979148 -0.6435359157986099 -1.447955810546872 -6.21565930012797 +0.9866365559895813 -0.6577577039930542 -1.479954833984372 -6.081266666611691 +1.007969238281248 -0.6719794921874986 -1.511953857421872 -5.952562610175466 +1.029301920572914 -0.6862012803819427 -1.543952880859371 -5.829193436907581 +1.050634602864581 -0.7004230685763874 -1.575951904296871 -5.710834179305396 +1.071967285156247 -0.7146448567708315 -1.607950927734371 -5.597185737926186 +1.093299967447914 -0.7288666449652759 -1.639949951171871 -5.487972357673968 +1.114632649739581 -0.7430884331597204 -1.671948974609371 -5.382939393890733 +1.135965332031247 -0.7573102213541647 -1.703947998046871 -5.281851330155697 +1.157298014322913 -0.771532009548609 -1.73594702148437 -5.184490015314118 +1.17863069661458 -0.7857537977430535 -1.76794604492187 -5.090653091960015 +1.199963378906247 -0.7999755859374979 -1.79994506835937 -5.000152592547393 +1.221296061197913 -0.814197374131942 -1.83194409179687 -4.912813682633903 +1.24262874348958 -0.8284191623263863 -1.863943115234369 -4.828473533575811 +1.263961425781246 -0.8426409505208309 -1.89594213867187 -4.746980309380437 +1.285294108072913 -0.8568627387152752 -1.927941162109369 -4.668192254452962 +1.306626790364579 -0.8710845269097195 -1.959940185546869 -4.591976870706792 +1.327959472656246 -0.885306315104164 -1.991939208984369 -4.51821017398861 +1.349292154947912 -0.8995281032986084 -2.023938232421869 -4.446776021040174 +1.370624837239579 -0.9137498914930525 -2.055937255859368 -4.377565499311923 +1.391957519531245 -0.9279716796874968 -2.087936279296868 -4.310476372885687 +1.413290201822912 -0.9421934678819413 -2.119935302734368 -4.245412578577977 +1.434622884114579 -0.9564152560763857 -2.151934326171868 -4.182283767000611 +1.455955566406245 -0.97063704427083 -2.183933349609367 -4.121004883967635 +1.477288248697912 -0.9848588324652745 -2.215932373046868 -4.061495788170268 +1.498620930989578 -0.9990806206597188 -2.247931396484367 -4.003680901505923 +1.519953613281245 -1.013302408854163 -2.279930419921867 -3.947488888853209 +1.541286295572911 -1.027524197048608 -2.311929443359367 -3.892852364440015 +1.562618977864578 -1.041745985243052 -2.343928466796867 -3.83970762226336 +1.583951660156244 -1.055967773437496 -2.375927490234366 -3.787994388293483 +1.605284342447911 -1.07018956163194 -2.407926513671866 -3.737655592435763 +1.626617024739577 -1.084411349826385 -2.439925537109366 -3.688637158436605 +1.647949707031244 -1.098633138020829 -2.471924560546866 -3.640887810107329 +1.66928238932291 -1.112854926215274 -2.503923583984365 -3.594358892406277 +1.690615071614577 -1.127076714409718 -2.535922607421866 -3.549004206066765 +1.711947753906244 -1.141298502604162 -2.567921630859365 -3.504779854589298 +1.73328043619791 -1.155520290798607 -2.599920654296865 -3.461644102532815 +1.754613118489577 -1.169742078993051 -2.631919677734365 -3.419557244143358 +1.775945800781243 -1.183963867187495 -2.663918701171865 -3.378481481450945 +1.79727848307291 -1.19818565538194 -2.695917724609364 -3.338380811047967 +1.818611165364576 -1.212407443576384 -2.727916748046864 -3.299220918836261 +1.839943847656243 -1.226629231770828 -2.759915771484364 -3.26096908209613 +1.861276529947909 -1.240851019965273 -2.791914794921864 -3.223594078289871 +1.882609212239576 -1.255072808159717 -2.823913818359364 -3.187066100065624 +1.903941894531243 -1.269294596354162 -2.855912841796864 -3.151356675975252 +1.925274576822909 -1.283516384548606 -2.887911865234363 -3.116438596463061 +1.946607259114575 -1.29773817274305 -2.919910888671863 -3.082285844721 +1.967939941406242 -1.311959960937495 -2.951909912109363 -3.048873532041097 +1.989272623697909 -1.326181749131939 -2.983908935546863 -3.01617783732752 +1.99981689825654 -1.33321126550436 -2.99972534738481 -3.000274677762178 diff --git a/tests/circuitpython/synth_block_offset_scale.py b/tests/circuitpython/synth_block_offset_scale.py new file mode 100644 index 0000000000..a35bb5975d --- /dev/null +++ b/tests/circuitpython/synth_block_offset_scale.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.OFFSET_SCALE) diff --git a/tests/circuitpython/synth_block_offset_scale.py.exp b/tests/circuitpython/synth_block_offset_scale.py.exp new file mode 100644 index 0000000000..b3b386c1ac --- /dev/null +++ b/tests/circuitpython/synth_block_offset_scale.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 -0.06418115234374988 -9.957212565104166 1.978606282552083 +-1.957273600260416 -0.1281791992187504 -9.914547200520833 1.957273600260416 +-1.93594091796875 -0.1921772460937503 -9.871881835937501 1.93594091796875 +-1.914608235677083 -0.2561752929687495 -9.829216471354167 1.914608235677083 +-1.893275553385417 -0.3201733398437494 -9.786551106770833 1.893275553385417 +-1.87194287109375 -0.3841713867187506 -9.7438857421875 1.87194287109375 +-1.850610188802083 -0.4481694335937498 -9.701220377604166 1.850610188802083 +-1.829277506510417 -0.5121674804687498 -9.658555013020834 1.829277506510417 +-1.80794482421875 -0.5761655273437503 -9.6158896484375 1.80794482421875 +-1.786612141927083 -0.6401635742187501 -9.573224283854167 1.786612141927083 +-1.765279459635417 -0.70416162109375 -9.530558919270833 1.765279459635417 +-1.74394677734375 -0.7681596679687505 -9.487893554687499 1.74394677734375 +-1.722614095052083 -0.8321577148437505 -9.445228190104167 1.722614095052083 +-1.701281412760417 -0.8961557617187497 -9.402562825520834 1.701281412760417 +-1.67994873046875 -0.9601538085937495 -9.3598974609375 1.67994873046875 +-1.658616048177083 -1.02415185546875 -9.317232096354166 1.658616048177083 +-1.637283365885417 -1.08814990234375 -9.274566731770832 1.637283365885417 +-1.61595068359375 -1.152147949218749 -9.231901367187501 1.61595068359375 +-1.594618001302083 -1.21614599609375 -9.189236002604167 1.594618001302083 +-1.573285319010417 -1.28014404296875 -9.146570638020833 1.573285319010417 +-1.55195263671875 -1.344142089843749 -9.103905273437501 1.55195263671875 +-1.530619954427083 -1.40814013671875 -9.061239908854166 1.530619954427083 +-1.509287272135417 -1.472138183593749 -9.018574544270834 1.509287272135417 +-1.48795458984375 -1.53613623046875 -8.9759091796875 1.48795458984375 +-1.466621907552084 -1.600134277343749 -8.933243815104166 1.466621907552084 +-1.445289225260417 -1.66413232421875 -8.890578450520835 1.445289225260417 +-1.42395654296875 -1.728130371093749 -8.847913085937501 1.42395654296875 +-1.402623860677084 -1.792128417968749 -8.805247721354167 1.402623860677084 +-1.381291178385417 -1.85612646484375 -8.762582356770833 1.381291178385417 +-1.35995849609375 -1.920124511718749 -8.7199169921875 1.35995849609375 +-1.338625813802083 -1.98412255859375 -8.677251627604168 1.338625813802083 +-1.317293131510417 -2.04812060546875 -8.634586263020834 1.317293131510417 +-1.29596044921875 -2.112118652343749 -8.5919208984375 1.29596044921875 +-1.274627766927084 -2.176116699218749 -8.549255533854168 1.274627766927084 +-1.253295084635417 -2.240114746093749 -8.506590169270835 1.253295084635417 +-1.23196240234375 -2.30411279296875 -8.463924804687501 1.23196240234375 +-1.210629720052084 -2.368110839843749 -8.421259440104167 1.210629720052084 +-1.189297037760417 -2.432108886718748 -8.378594075520834 1.189297037760417 +-1.16796435546875 -2.496106933593749 -8.3359287109375 1.16796435546875 +-1.146631673177084 -2.560104980468749 -8.293263346354166 1.146631673177084 +-1.125298990885417 -2.624103027343748 -8.250597981770834 1.125298990885417 +-1.10396630859375 -2.688101074218749 -8.207932617187501 1.10396630859375 +-1.082633626302084 -2.752099121093748 -8.165267252604167 1.082633626302084 +-1.061300944010417 -2.816097167968749 -8.122601888020835 1.061300944010417 +-1.039968261718751 -2.880095214843748 -8.079936523437501 1.039968261718751 +-1.018635579427084 -2.944093261718749 -8.037271158854168 1.018635579427084 +-0.9973028971354172 -3.008091308593749 -7.994605794270834 0.9973028971354172 +-0.9759702148437505 -3.072089355468748 -7.951940429687501 0.9759702148437505 +-0.9546375325520838 -3.136087402343749 -7.909275065104167 0.9546375325520838 +-0.9333048502604168 -3.200085449218749 -7.866609700520834 0.9333048502604168 +-0.9119721679687501 -3.26408349609375 -7.8239443359375 0.9119721679687501 +-0.8906394856770833 -3.32808154296875 -7.781278971354166 0.8906394856770833 +-0.8693068033854166 -3.39207958984375 -7.738613606770834 0.8693068033854166 +-0.8479741210937499 -3.45607763671875 -7.6959482421875 0.8479741210937499 +-0.8266414388020831 -3.520075683593751 -7.653282877604166 0.8266414388020831 +-0.8053087565104164 -3.584073730468751 -7.610617513020832 0.8053087565104164 +-0.7839760742187497 -3.648071777343751 -7.5679521484375 0.7839760742187497 +-0.7626433919270829 -3.712069824218751 -7.525286783854166 0.7626433919270829 +-0.7413107096354159 -3.776067871093752 -7.482621419270831 0.7413107096354159 +-0.7199780273437493 -3.840065917968752 -7.439956054687499 0.7199780273437493 +-0.6986453450520828 -3.904063964843751 -7.397290690104166 0.6986453450520828 +-0.6773126627604157 -3.968062011718753 -7.354625325520831 0.6773126627604157 +-0.6559799804687488 -4.032060058593753 -7.311959960937497 0.6559799804687488 +-0.6346472981770823 -4.096058105468753 -7.269294596354165 0.6346472981770823 +-0.6133146158854156 -4.160056152343753 -7.226629231770831 0.6133146158854156 +-0.5919819335937487 -4.224054199218754 -7.183963867187497 0.5919819335937487 +-0.5706492513020819 -4.288052246093755 -7.141298502604164 0.5706492513020819 +-0.5493165690104153 -4.352050292968753 -7.098633138020831 0.5493165690104153 +-0.5279838867187485 -4.416048339843755 -7.055967773437497 0.5279838867187485 +-0.5066512044270817 -4.480046386718755 -7.013302408854163 0.5066512044270817 +-0.4853185221354149 -4.544044433593756 -6.97063704427083 0.4853185221354149 +-0.4639858398437481 -4.608042480468756 -6.927971679687496 0.4639858398437481 +-0.4426531575520815 -4.672040527343755 -6.885306315104163 0.4426531575520815 +-0.4213204752604147 -4.736038574218756 -6.842640950520829 0.4213204752604147 +-0.3999877929687479 -4.800036621093756 -6.799975585937496 0.3999877929687479 +-0.3786551106770811 -4.864034667968757 -6.757310221354162 0.3786551106770811 +-0.3573224283854145 -4.928032714843756 -6.714644856770829 0.3573224283854145 +-0.3359897460937477 -4.992030761718757 -6.671979492187496 0.3359897460937477 +-0.3146570638020807 -5.056028808593758 -6.629314127604161 0.3146570638020807 +-0.2933243815104141 -5.120026855468758 -6.586648763020828 0.2933243815104141 +-0.2719916992187476 -5.184024902343757 -6.543983398437495 0.2719916992187476 +-0.2506590169270807 -5.248022949218758 -6.501318033854162 0.2506590169270807 +-0.2293263346354136 -5.312020996093759 -6.458652669270827 0.2293263346354136 +-0.2079936523437471 -5.376019042968759 -6.415987304687494 0.2079936523437471 +-0.1866609700520805 -5.440017089843758 -6.373321940104161 0.1866609700520805 +-0.1653282877604135 -5.50401513671876 -6.330656575520827 0.1653282877604135 +-0.1439956054687467 -5.56801318359376 -6.287991210937493 0.1439956054687467 +-0.1226629231770801 -5.632011230468759 -6.24532584635416 0.1226629231770801 +-0.1013302408854133 -5.696009277343761 -6.202660481770827 0.1013302408854133 +-0.07999755859374647 -5.76000732421876 -6.159995117187493 0.07999755859374647 +-0.05866487630207972 -5.824005371093762 -6.117329752604159 0.05866487630207972 +-0.0373321940104131 -5.88800341796876 -6.074664388020826 0.0373321940104131 +-0.01599951171874625 -5.952001464843761 -6.031999023437493 0.01599951171874625 +0.005333170572920487 -6.015999511718761 -5.989333658854159 -0.005333170572920487 +0.026665852864587 -6.07999755859376 -5.946668294270826 -0.026665852864587 +0.04799853515625363 -6.143995605468762 -5.904002929687493 -0.04799853515625363 +0.06933121744792015 -6.20799365234376 -5.86133756510416 -0.06933121744792015 +0.09066389973958666 -6.271991699218759 -5.818672200520827 -0.09066389973958666 +0.1119965820312533 -6.335989746093761 -5.776006835937493 -0.1119965820312533 +0.1333292643229198 -6.399987792968759 -5.73334147135416 -0.1333292643229198 +0.1546619466145862 -6.463985839843758 -5.690676106770828 -0.1546619466145862 +0.1759946289062527 -6.527983886718758 -5.648010742187495 -0.1759946289062527 +0.1973273111979195 -6.591981933593758 -5.605345377604161 -0.1973273111979195 +0.2186599934895859 -6.655979980468757 -5.562680013020828 -0.2186599934895859 +0.2399926757812524 -6.719978027343757 -5.520014648437495 -0.2399926757812524 +0.261325358072919 -6.783976074218757 -5.477349283854162 -0.261325358072919 +0.2826580403645855 -6.847974121093756 -5.434683919270829 -0.2826580403645855 +0.303990722656252 -6.911972167968756 -5.392018554687496 -0.303990722656252 +0.3253234049479187 -6.975970214843756 -5.349353190104162 -0.3253234049479187 +0.3466560872395852 -7.039968261718755 -5.30668782552083 -0.3466560872395852 +0.3679887695312516 -7.103966308593755 -5.264022460937497 -0.3679887695312516 +0.3893214518229181 -7.167964355468754 -5.221357096354164 -0.3893214518229181 +0.4106541341145848 -7.231962402343754 -5.17869173177083 -0.4106541341145848 +0.4319868164062513 -7.295960449218754 -5.136026367187497 -0.4319868164062513 +0.4533194986979177 -7.359958496093753 -5.093361002604165 -0.4533194986979177 +0.4746521809895844 -7.423956542968753 -5.050695638020831 -0.4746521809895844 +0.4959848632812509 -7.487954589843753 -5.008030273437498 -0.4959848632812509 +0.5173175455729173 -7.551952636718752 -4.965364908854165 -0.5173175455729173 +0.5386502278645841 -7.615950683593752 -4.922699544270832 -0.5386502278645841 +0.5599829101562506 -7.679948730468752 -4.880034179687499 -0.5599829101562506 +0.581315592447917 -7.743946777343751 -4.837368815104166 -0.581315592447917 +0.6026482747395835 -7.80794482421875 -4.794703450520833 -0.6026482747395835 +0.6239809570312501 -7.871942871093751 -4.7520380859375 -0.6239809570312501 +0.6453136393229166 -7.93594091796875 -4.709372721354167 -0.6453136393229166 +0.6666463216145831 -7.999938964843749 -4.666707356770834 -0.6666463216145831 +0.6879790039062498 -8.06393701171875 -4.6240419921875 -0.6879790039062498 +0.7093116861979163 -8.127935058593749 -4.581376627604167 -0.7093116861979163 +0.7306443684895827 -8.191933105468749 -4.538711263020835 -0.7306443684895827 +0.7519770507812495 -8.255931152343749 -4.496045898437501 -0.7519770507812495 +0.773309733072916 -8.319929199218748 -4.453380533854168 -0.773309733072916 +0.7946424153645824 -8.383927246093748 -4.410715169270835 -0.7946424153645824 +0.8159750976562488 -8.447925292968746 -4.368049804687502 -0.8159750976562488 +0.8373077799479155 -8.511923339843747 -4.325384440104169 -0.8373077799479155 +0.858640462239582 -8.575921386718747 -4.282719075520836 -0.858640462239582 +0.8799731445312485 -8.639919433593745 -4.240053710937503 -0.8799731445312485 +0.9013058268229152 -8.703917480468746 -4.197388346354169 -0.9013058268229152 +0.9226385091145817 -8.767915527343746 -4.154722981770837 -0.9226385091145817 +0.9439711914062482 -8.831913574218744 -4.112057617187504 -0.9439711914062482 +0.9653038736979148 -8.895911621093745 -4.06939225260417 -0.9653038736979148 +0.9866365559895813 -8.959909667968745 -4.026726888020837 -0.9866365559895813 +1.007969238281248 -9.023907714843743 -3.984061523437505 -1.007969238281248 +1.029301920572914 -9.087905761718742 -3.941396158854172 -1.029301920572914 +1.050634602864581 -9.151903808593744 -3.898730794270838 -1.050634602864581 +1.071967285156247 -9.215901855468742 -3.856065429687505 -1.071967285156247 +1.093299967447914 -9.279899902343741 -3.813400065104172 -1.093299967447914 +1.114632649739581 -9.343897949218743 -3.770734700520839 -1.114632649739581 +1.135965332031247 -9.407895996093741 -3.728069335937506 -1.135965332031247 +1.157298014322913 -9.47189404296874 -3.685403971354173 -1.157298014322913 +1.17863069661458 -9.535892089843742 -3.642738606770839 -1.17863069661458 +1.199963378906247 -9.59989013671874 -3.600073242187507 -1.199963378906247 +1.221296061197913 -9.663888183593739 -3.557407877604174 -1.221296061197913 +1.24262874348958 -9.727886230468739 -3.514742513020841 -1.24262874348958 +1.263961425781246 -9.791884277343739 -3.472077148437507 -1.263961425781246 +1.285294108072913 -9.855882324218738 -3.429411783854174 -1.285294108072913 +1.306626790364579 -9.919880371093738 -3.386746419270842 -1.306626790364579 +1.327959472656246 -9.983878417968738 -3.344081054687508 -1.327959472656246 +1.349292154947912 -10.04787646484374 -3.301415690104175 -1.349292154947912 +1.370624837239579 -10.11187451171874 -3.258750325520842 -1.370624837239579 +1.391957519531245 -10.17587255859373 -3.21608496093751 -1.391957519531245 +1.413290201822912 -10.23987060546874 -3.173419596354176 -1.413290201822912 +1.434622884114579 -10.30386865234374 -3.130754231770843 -1.434622884114579 +1.455955566406245 -10.36786669921873 -3.08808886718751 -1.455955566406245 +1.477288248697912 -10.43186474609374 -3.045423502604176 -1.477288248697912 +1.498620930989578 -10.49586279296873 -3.002758138020844 -1.498620930989578 +1.519953613281245 -10.55986083984373 -2.960092773437511 -1.519953613281245 +1.541286295572911 -10.62385888671873 -2.917427408854177 -1.541286295572911 +1.562618977864578 -10.68785693359373 -2.874762044270844 -1.562618977864578 +1.583951660156244 -10.75185498046873 -2.832096679687512 -1.583951660156244 +1.605284342447911 -10.81585302734373 -2.789431315104179 -1.605284342447911 +1.626617024739577 -10.87985107421873 -2.746765950520845 -1.626617024739577 +1.647949707031244 -10.94384912109373 -2.704100585937512 -1.647949707031244 +1.66928238932291 -11.00784716796873 -2.661435221354179 -1.66928238932291 +1.690615071614577 -11.07184521484373 -2.618769856770846 -1.690615071614577 +1.711947753906244 -11.13584326171873 -2.576104492187513 -1.711947753906244 +1.73328043619791 -11.19984130859373 -2.53343912760418 -1.73328043619791 +1.754613118489577 -11.26383935546873 -2.490773763020846 -1.754613118489577 +1.775945800781243 -11.32783740234373 -2.448108398437514 -1.775945800781243 +1.79727848307291 -11.39183544921873 -2.405443033854181 -1.79727848307291 +1.818611165364576 -11.45583349609373 -2.362777669270848 -1.818611165364576 +1.839943847656243 -11.51983154296873 -2.320112304687514 -1.839943847656243 +1.861276529947909 -11.58382958984373 -2.277446940104181 -1.861276529947909 +1.882609212239576 -11.64782763671873 -2.234781575520849 -1.882609212239576 +1.903941894531243 -11.71182568359373 -2.192116210937515 -1.903941894531243 +1.925274576822909 -11.77582373046873 -2.149450846354182 -1.925274576822909 +1.946607259114575 -11.83982177734373 -2.106785481770849 -1.946607259114575 +1.967939941406242 -11.90381982421873 -2.064120117187516 -1.967939941406242 +1.989272623697909 -11.96781787109373 -2.021454752604183 -1.989272623697909 +1.99981689825654 -11.99945069476962 -2.000366203486919 -1.99981689825654 diff --git a/tests/circuitpython/synth_block_product.py b/tests/circuitpython/synth_block_product.py new file mode 100644 index 0000000000..0920e3c7d0 --- /dev/null +++ b/tests/circuitpython/synth_block_product.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.PRODUCT) diff --git a/tests/circuitpython/synth_block_product.py.exp b/tests/circuitpython/synth_block_product.py.exp new file mode 100644 index 0000000000..0d7d05931c --- /dev/null +++ b/tests/circuitpython/synth_block_product.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 11.8716376953125 11.8716376953125 11.8716376953125 +-1.957273600260416 11.7436416015625 11.7436416015625 11.7436416015625 +-1.93594091796875 11.6156455078125 11.6156455078125 11.6156455078125 +-1.914608235677083 11.4876494140625 11.4876494140625 11.4876494140625 +-1.893275553385417 11.3596533203125 11.3596533203125 11.3596533203125 +-1.87194287109375 11.2316572265625 11.2316572265625 11.2316572265625 +-1.850610188802083 11.1036611328125 11.1036611328125 11.1036611328125 +-1.829277506510417 10.9756650390625 10.9756650390625 10.9756650390625 +-1.80794482421875 10.8476689453125 10.8476689453125 10.8476689453125 +-1.786612141927083 10.7196728515625 10.7196728515625 10.7196728515625 +-1.765279459635417 10.5916767578125 10.5916767578125 10.5916767578125 +-1.74394677734375 10.4636806640625 10.4636806640625 10.4636806640625 +-1.722614095052083 10.3356845703125 10.3356845703125 10.3356845703125 +-1.701281412760417 10.2076884765625 10.2076884765625 10.2076884765625 +-1.67994873046875 10.0796923828125 10.0796923828125 10.0796923828125 +-1.658616048177083 9.9516962890625 9.9516962890625 9.9516962890625 +-1.637283365885417 9.823700195312501 9.823700195312501 9.823700195312501 +-1.61595068359375 9.695704101562502 9.695704101562502 9.695704101562502 +-1.594618001302083 9.567708007812501 9.567708007812501 9.567708007812501 +-1.573285319010417 9.439711914062499 9.439711914062499 9.439711914062499 +-1.55195263671875 9.3117158203125 9.3117158203125 9.3117158203125 +-1.530619954427083 9.183719726562501 9.183719726562501 9.183719726562501 +-1.509287272135417 9.055723632812501 9.055723632812501 9.055723632812501 +-1.48795458984375 8.9277275390625 8.9277275390625 8.9277275390625 +-1.466621907552084 8.799731445312503 8.799731445312503 8.799731445312503 +-1.445289225260417 8.6717353515625 8.6717353515625 8.6717353515625 +-1.42395654296875 8.543739257812502 8.543739257812502 8.543739257812502 +-1.402623860677084 8.415743164062501 8.415743164062501 8.415743164062501 +-1.381291178385417 8.2877470703125 8.2877470703125 8.2877470703125 +-1.35995849609375 8.159750976562503 8.159750976562503 8.159750976562503 +-1.338625813802083 8.0317548828125 8.0317548828125 8.0317548828125 +-1.317293131510417 7.903758789062501 7.903758789062501 7.903758789062501 +-1.29596044921875 7.775762695312501 7.775762695312501 7.775762695312501 +-1.274627766927084 7.647766601562503 7.647766601562503 7.647766601562503 +-1.253295084635417 7.519770507812503 7.519770507812503 7.519770507812503 +-1.23196240234375 7.391774414062501 7.391774414062501 7.391774414062501 +-1.210629720052084 7.263778320312502 7.263778320312502 7.263778320312502 +-1.189297037760417 7.135782226562504 7.135782226562504 7.135782226562504 +-1.16796435546875 7.007786132812502 7.007786132812502 7.007786132812502 +-1.146631673177084 6.879790039062502 6.879790039062502 6.879790039062502 +-1.125298990885417 6.751793945312503 6.751793945312503 6.751793945312503 +-1.10396630859375 6.623797851562502 6.623797851562502 6.623797851562502 +-1.082633626302084 6.495801757812504 6.495801757812504 6.495801757812504 +-1.061300944010417 6.367805664062502 6.367805664062502 6.367805664062502 +-1.039968261718751 6.239809570312504 6.239809570312504 6.239809570312504 +-1.018635579427084 6.111813476562503 6.111813476562503 6.111813476562503 +-0.9973028971354172 5.983817382812503 5.983817382812503 5.983817382812503 +-0.9759702148437505 5.855821289062503 5.855821289062503 5.855821289062503 +-0.9546375325520838 5.727825195312502 5.727825195312502 5.727825195312502 +-0.9333048502604168 5.599829101562501 5.599829101562501 5.599829101562501 +-0.9119721679687501 5.471833007812501 5.471833007812501 5.471833007812501 +-0.8906394856770833 5.3438369140625 5.3438369140625 5.3438369140625 +-0.8693068033854166 5.2158408203125 5.2158408203125 5.2158408203125 +-0.8479741210937499 5.0878447265625 5.0878447265625 5.0878447265625 +-0.8266414388020831 4.959848632812498 4.959848632812498 4.959848632812498 +-0.8053087565104164 4.831852539062498 4.831852539062498 4.831852539062498 +-0.7839760742187497 4.703856445312498 4.703856445312498 4.703856445312498 +-0.7626433919270829 4.575860351562497 4.575860351562497 4.575860351562497 +-0.7413107096354159 4.447864257812496 4.447864257812496 4.447864257812496 +-0.7199780273437493 4.319868164062496 4.319868164062496 4.319868164062496 +-0.6986453450520828 4.191872070312496 4.191872070312496 4.191872070312496 +-0.6773126627604157 4.063875976562494 4.063875976562494 4.063875976562494 +-0.6559799804687488 3.935879882812493 3.935879882812493 3.935879882812493 +-0.6346472981770823 3.807883789062494 3.807883789062494 3.807883789062494 +-0.6133146158854156 3.679887695312494 3.679887695312494 3.679887695312494 +-0.5919819335937487 3.551891601562493 3.551891601562493 3.551891601562493 +-0.5706492513020819 3.423895507812492 3.423895507812492 3.423895507812492 +-0.5493165690104153 3.295899414062491 3.295899414062491 3.295899414062491 +-0.5279838867187485 3.167903320312491 3.167903320312491 3.167903320312491 +-0.5066512044270817 3.03990722656249 3.03990722656249 3.03990722656249 +-0.4853185221354149 2.91191113281249 2.91191113281249 2.91191113281249 +-0.4639858398437481 2.783915039062489 2.783915039062489 2.783915039062489 +-0.4426531575520815 2.655918945312489 2.655918945312489 2.655918945312489 +-0.4213204752604147 2.527922851562488 2.527922851562488 2.527922851562488 +-0.3999877929687479 2.399926757812487 2.399926757812487 2.399926757812487 +-0.3786551106770811 2.271930664062487 2.271930664062487 2.271930664062487 +-0.3573224283854145 2.143934570312487 2.143934570312487 2.143934570312487 +-0.3359897460937477 2.015938476562486 2.015938476562486 2.015938476562486 +-0.3146570638020807 1.887942382812484 1.887942382812484 1.887942382812484 +-0.2933243815104141 1.759946289062484 1.759946289062484 1.759946289062484 +-0.2719916992187476 1.631950195312485 1.631950195312485 1.631950195312485 +-0.2506590169270807 1.503954101562484 1.503954101562484 1.503954101562484 +-0.2293263346354136 1.375958007812482 1.375958007812482 1.375958007812482 +-0.2079936523437471 1.247961914062483 1.247961914062483 1.247961914062483 +-0.1866609700520805 1.119965820312483 1.119965820312483 1.119965820312483 +-0.1653282877604135 0.9919697265624812 0.9919697265624812 0.9919697265624812 +-0.1439956054687467 0.8639736328124801 0.8639736328124801 0.8639736328124801 +-0.1226629231770801 0.7359775390624803 0.7359775390624803 0.7359775390624803 +-0.1013302408854133 0.6079814453124799 0.6079814453124799 0.6079814453124799 +-0.07999755859374647 0.4799853515624788 0.4799853515624788 0.4799853515624788 +-0.05866487630207972 0.3519892578124784 0.3519892578124784 0.3519892578124784 +-0.0373321940104131 0.2239931640624786 0.2239931640624786 0.2239931640624786 +-0.01599951171874625 0.0959970703124775 0.0959970703124775 0.0959970703124775 +0.005333170572920487 -0.03199902343752292 -0.03199902343752292 -0.03199902343752292 +0.026665852864587 -0.159995117187522 -0.159995117187522 -0.159995117187522 +0.04799853515625363 -0.2879912109375218 -0.2879912109375218 -0.2879912109375218 +0.06933121744792015 -0.4159873046875209 -0.4159873046875209 -0.4159873046875209 +0.09066389973958666 -0.54398339843752 -0.54398339843752 -0.54398339843752 +0.1119965820312533 -0.6719794921875197 -0.6719794921875197 -0.6719794921875197 +0.1333292643229198 -0.7999755859375188 -0.7999755859375188 -0.7999755859375188 +0.1546619466145862 -0.9279716796875173 -0.9279716796875173 -0.9279716796875173 +0.1759946289062527 -1.055967773437516 -1.055967773437516 -1.055967773437516 +0.1973273111979195 -1.183963867187517 -1.183963867187517 -1.183963867187517 +0.2186599934895859 -1.311959960937515 -1.311959960937515 -1.311959960937515 +0.2399926757812524 -1.439956054687514 -1.439956054687514 -1.439956054687514 +0.261325358072919 -1.567952148437514 -1.567952148437514 -1.567952148437514 +0.2826580403645855 -1.695948242187513 -1.695948242187513 -1.695948242187513 +0.303990722656252 -1.823944335937512 -1.823944335937512 -1.823944335937512 +0.3253234049479187 -1.951940429687512 -1.951940429687512 -1.951940429687512 +0.3466560872395852 -2.079936523437511 -2.079936523437511 -2.079936523437511 +0.3679887695312516 -2.20793261718751 -2.20793261718751 -2.20793261718751 +0.3893214518229181 -2.335928710937509 -2.335928710937509 -2.335928710937509 +0.4106541341145848 -2.463924804687508 -2.463924804687508 -2.463924804687508 +0.4319868164062513 -2.591920898437508 -2.591920898437508 -2.591920898437508 +0.4533194986979177 -2.719916992187507 -2.719916992187507 -2.719916992187507 +0.4746521809895844 -2.847913085937506 -2.847913085937506 -2.847913085937506 +0.4959848632812509 -2.975909179687505 -2.975909179687505 -2.975909179687505 +0.5173175455729173 -3.103905273437504 -3.103905273437504 -3.103905273437504 +0.5386502278645841 -3.231901367187504 -3.231901367187504 -3.231901367187504 +0.5599829101562506 -3.359897460937503 -3.359897460937503 -3.359897460937503 +0.581315592447917 -3.487893554687502 -3.487893554687502 -3.487893554687502 +0.6026482747395835 -3.615889648437501 -3.615889648437501 -3.615889648437501 +0.6239809570312501 -3.7438857421875 -3.7438857421875 -3.7438857421875 +0.6453136393229166 -3.8718818359375 -3.8718818359375 -3.8718818359375 +0.6666463216145831 -3.999877929687499 -3.999877929687499 -3.999877929687499 +0.6879790039062498 -4.127874023437498 -4.127874023437498 -4.127874023437498 +0.7093116861979163 -4.255870117187498 -4.255870117187498 -4.255870117187498 +0.7306443684895827 -4.383866210937496 -4.383866210937496 -4.383866210937496 +0.7519770507812495 -4.511862304687496 -4.511862304687496 -4.511862304687496 +0.773309733072916 -4.639858398437496 -4.639858398437496 -4.639858398437496 +0.7946424153645824 -4.767854492187494 -4.767854492187494 -4.767854492187494 +0.8159750976562488 -4.895850585937493 -4.895850585937493 -4.895850585937493 +0.8373077799479155 -5.023846679687493 -5.023846679687493 -5.023846679687493 +0.858640462239582 -5.151842773437492 -5.151842773437492 -5.151842773437492 +0.8799731445312485 -5.279838867187491 -5.279838867187491 -5.279838867187491 +0.9013058268229152 -5.407834960937491 -5.407834960937491 -5.407834960937491 +0.9226385091145817 -5.53583105468749 -5.53583105468749 -5.53583105468749 +0.9439711914062482 -5.663827148437488 -5.663827148437488 -5.663827148437488 +0.9653038736979148 -5.791823242187489 -5.791823242187489 -5.791823242187489 +0.9866365559895813 -5.919819335937488 -5.919819335937488 -5.919819335937488 +1.007969238281248 -6.047815429687486 -6.047815429687486 -6.047815429687486 +1.029301920572914 -6.175811523437485 -6.175811523437485 -6.175811523437485 +1.050634602864581 -6.303807617187486 -6.303807617187486 -6.303807617187486 +1.071967285156247 -6.431803710937484 -6.431803710937484 -6.431803710937484 +1.093299967447914 -6.559799804687483 -6.559799804687483 -6.559799804687483 +1.114632649739581 -6.687795898437484 -6.687795898437484 -6.687795898437484 +1.135965332031247 -6.815791992187482 -6.815791992187482 -6.815791992187482 +1.157298014322913 -6.943788085937481 -6.943788085937481 -6.943788085937481 +1.17863069661458 -7.071784179687482 -7.071784179687482 -7.071784179687482 +1.199963378906247 -7.19978027343748 -7.19978027343748 -7.19978027343748 +1.221296061197913 -7.327776367187479 -7.327776367187479 -7.327776367187479 +1.24262874348958 -7.455772460937477 -7.455772460937477 -7.455772460937477 +1.263961425781246 -7.583768554687478 -7.583768554687478 -7.583768554687478 +1.285294108072913 -7.711764648437477 -7.711764648437477 -7.711764648437477 +1.306626790364579 -7.839760742187475 -7.839760742187475 -7.839760742187475 +1.327959472656246 -7.967756835937476 -7.967756835937476 -7.967756835937476 +1.349292154947912 -8.095752929687475 -8.095752929687475 -8.095752929687475 +1.370624837239579 -8.223749023437474 -8.223749023437474 -8.223749023437474 +1.391957519531245 -8.351745117187471 -8.351745117187471 -8.351745117187471 +1.413290201822912 -8.479741210937473 -8.479741210937473 -8.479741210937473 +1.434622884114579 -8.607737304687472 -8.607737304687472 -8.607737304687472 +1.455955566406245 -8.735733398437469 -8.735733398437469 -8.735733398437469 +1.477288248697912 -8.863729492187471 -8.863729492187471 -8.863729492187471 +1.498620930989578 -8.99172558593747 -8.99172558593747 -8.99172558593747 +1.519953613281245 -9.119721679687467 -9.119721679687467 -9.119721679687467 +1.541286295572911 -9.247717773437468 -9.247717773437468 -9.247717773437468 +1.562618977864578 -9.375713867187468 -9.375713867187468 -9.375713867187468 +1.583951660156244 -9.503709960937465 -9.503709960937465 -9.503709960937465 +1.605284342447911 -9.631706054687463 -9.631706054687463 -9.631706054687463 +1.626617024739577 -9.759702148437466 -9.759702148437466 -9.759702148437466 +1.647949707031244 -9.887698242187463 -9.887698242187463 -9.887698242187463 +1.66928238932291 -10.01569433593746 -10.01569433593746 -10.01569433593746 +1.690615071614577 -10.14369042968746 -10.14369042968746 -10.14369042968746 +1.711947753906244 -10.27168652343746 -10.27168652343746 -10.27168652343746 +1.73328043619791 -10.39968261718746 -10.39968261718746 -10.39968261718746 +1.754613118489577 -10.52767871093746 -10.52767871093746 -10.52767871093746 +1.775945800781243 -10.65567480468746 -10.65567480468746 -10.65567480468746 +1.79727848307291 -10.78367089843746 -10.78367089843746 -10.78367089843746 +1.818611165364576 -10.91166699218746 -10.91166699218746 -10.91166699218746 +1.839943847656243 -11.03966308593746 -11.03966308593746 -11.03966308593746 +1.861276529947909 -11.16765917968745 -11.16765917968745 -11.16765917968745 +1.882609212239576 -11.29565527343745 -11.29565527343745 -11.29565527343745 +1.903941894531243 -11.42365136718746 -11.42365136718746 -11.42365136718746 +1.925274576822909 -11.55164746093745 -11.55164746093745 -11.55164746093745 +1.946607259114575 -11.67964355468745 -11.67964355468745 -11.67964355468745 +1.967939941406242 -11.80763964843745 -11.80763964843745 -11.80763964843745 +1.989272623697909 -11.93563574218745 -11.93563574218745 -11.93563574218745 +1.99981689825654 -11.99890138953924 -11.99890138953924 -11.99890138953924 diff --git a/tests/circuitpython/synth_block_scale_offset.py b/tests/circuitpython/synth_block_scale_offset.py new file mode 100644 index 0000000000..5c8ece049d --- /dev/null +++ b/tests/circuitpython/synth_block_scale_offset.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.SCALE_OFFSET) diff --git a/tests/circuitpython/synth_block_scale_offset.py.exp b/tests/circuitpython/synth_block_scale_offset.py.exp new file mode 100644 index 0000000000..6a84e3deb1 --- /dev/null +++ b/tests/circuitpython/synth_block_scale_offset.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 -6.957212565104166 7.93581884765625 -7.978606282552083 +-1.957273600260416 -6.914547200520833 7.87182080078125 -7.957273600260416 +-1.93594091796875 -6.8718818359375 7.807822753906249 -7.93594091796875 +-1.914608235677083 -6.829216471354167 7.74382470703125 -7.914608235677083 +-1.893275553385417 -6.786551106770833 7.679826660156251 -7.893275553385417 +-1.87194287109375 -6.7438857421875 7.615828613281249 -7.87194287109375 +-1.850610188802083 -6.701220377604167 7.551830566406251 -7.850610188802083 +-1.829277506510417 -6.658555013020834 7.48783251953125 -7.829277506510417 +-1.80794482421875 -6.6158896484375 7.42383447265625 -7.80794482421875 +-1.786612141927083 -6.573224283854167 7.35983642578125 -7.786612141927083 +-1.765279459635417 -6.530558919270833 7.29583837890625 -7.765279459635416 +-1.74394677734375 -6.487893554687499 7.23184033203125 -7.74394677734375 +-1.722614095052083 -6.445228190104166 7.167842285156249 -7.722614095052084 +-1.701281412760417 -6.402562825520834 7.10384423828125 -7.701281412760417 +-1.67994873046875 -6.3598974609375 7.039846191406251 -7.67994873046875 +-1.658616048177083 -6.317232096354166 6.97584814453125 -7.658616048177083 +-1.637283365885417 -6.274566731770833 6.91185009765625 -7.637283365885416 +-1.61595068359375 -6.231901367187501 6.847852050781251 -7.61595068359375 +-1.594618001302083 -6.189236002604167 6.78385400390625 -7.594618001302083 +-1.573285319010417 -6.146570638020833 6.71985595703125 -7.573285319010417 +-1.55195263671875 -6.1039052734375 6.65585791015625 -7.551952636718751 +-1.530619954427083 -6.061239908854167 6.59185986328125 -7.530619954427083 +-1.509287272135417 -6.018574544270834 6.527861816406251 -7.509287272135417 +-1.48795458984375 -5.9759091796875 6.46386376953125 -7.48795458984375 +-1.466621907552084 -5.933243815104167 6.399865722656251 -7.466621907552083 +-1.445289225260417 -5.890578450520834 6.33586767578125 -7.445289225260417 +-1.42395654296875 -5.847913085937501 6.271869628906251 -7.42395654296875 +-1.402623860677084 -5.805247721354167 6.207871582031251 -7.402623860677084 +-1.381291178385417 -5.762582356770833 6.14387353515625 -7.381291178385417 +-1.35995849609375 -5.719916992187501 6.079875488281251 -7.35995849609375 +-1.338625813802083 -5.677251627604167 6.01587744140625 -7.338625813802084 +-1.317293131510417 -5.634586263020834 5.95187939453125 -7.317293131510417 +-1.29596044921875 -5.5919208984375 5.887881347656251 -7.29596044921875 +-1.274627766927084 -5.549255533854168 5.823883300781251 -7.274627766927084 +-1.253295084635417 -5.506590169270835 5.759885253906251 -7.253295084635417 +-1.23196240234375 -5.4639248046875 5.69588720703125 -7.231962402343751 +-1.210629720052084 -5.421259440104167 5.631889160156251 -7.210629720052084 +-1.189297037760417 -5.378594075520835 5.567891113281252 -7.189297037760417 +-1.16796435546875 -5.3359287109375 5.503893066406251 -7.16796435546875 +-1.146631673177084 -5.293263346354167 5.439895019531251 -7.146631673177083 +-1.125298990885417 -5.250597981770834 5.375896972656252 -7.125298990885417 +-1.10396630859375 -5.207932617187501 5.311898925781251 -7.10396630859375 +-1.082633626302084 -5.165267252604168 5.247900878906252 -7.082633626302083 +-1.061300944010417 -5.122601888020834 5.183902832031251 -7.061300944010418 +-1.039968261718751 -5.079936523437501 5.119904785156252 -7.039968261718751 +-1.018635579427084 -5.037271158854168 5.055906738281251 -7.018635579427084 +-0.9973028971354172 -4.994605794270834 4.991908691406252 -6.997302897135417 +-0.9759702148437505 -4.951940429687501 4.927910644531251 -6.97597021484375 +-0.9546375325520838 -4.909275065104167 4.863912597656251 -6.954637532552084 +-0.9333048502604168 -4.866609700520834 4.799914550781251 -6.933304850260416 +-0.9119721679687501 -4.8239443359375 4.735916503906251 -6.91197216796875 +-0.8906394856770833 -4.781278971354166 4.67191845703125 -6.890639485677084 +-0.8693068033854166 -4.738613606770834 4.60792041015625 -6.869306803385417 +-0.8479741210937499 -4.6959482421875 4.54392236328125 -6.84797412109375 +-0.8266414388020831 -4.653282877604166 4.479924316406249 -6.826641438802083 +-0.8053087565104164 -4.610617513020832 4.41592626953125 -6.805308756510416 +-0.7839760742187497 -4.5679521484375 4.351928222656249 -6.783976074218749 +-0.7626433919270829 -4.525286783854166 4.287930175781248 -6.762643391927083 +-0.7413107096354159 -4.482621419270831 4.223932128906248 -6.741310709635416 +-0.7199780273437493 -4.439956054687499 4.159934082031247 -6.71997802734375 +-0.6986453450520828 -4.397290690104166 4.095936035156248 -6.698645345052083 +-0.6773126627604157 -4.354625325520831 4.031937988281247 -6.677312662760416 +-0.6559799804687488 -4.311959960937497 3.967939941406247 -6.655979980468749 +-0.6346472981770823 -4.269294596354165 3.903941894531247 -6.634647298177082 +-0.6133146158854156 -4.226629231770831 3.839943847656247 -6.613314615885415 +-0.5919819335937487 -4.183963867187497 3.775945800781246 -6.591981933593749 +-0.5706492513020819 -4.141298502604164 3.711947753906246 -6.570649251302082 +-0.5493165690104153 -4.098633138020831 3.647949707031246 -6.549316569010415 +-0.5279838867187485 -4.055967773437497 3.583951660156246 -6.527983886718749 +-0.5066512044270817 -4.013302408854163 3.519953613281245 -6.506651204427081 +-0.4853185221354149 -3.97063704427083 3.455955566406245 -6.485318522135415 +-0.4639858398437481 -3.927971679687496 3.391957519531244 -6.463985839843748 +-0.4426531575520815 -3.885306315104163 3.327959472656244 -6.442653157552082 +-0.4213204752604147 -3.842640950520829 3.263961425781244 -6.421320475260415 +-0.3999877929687479 -3.799975585937496 3.199963378906244 -6.399987792968748 +-0.3786551106770811 -3.757310221354162 3.135965332031244 -6.378655110677081 +-0.3573224283854145 -3.714644856770829 3.071967285156243 -6.357322428385414 +-0.3359897460937477 -3.671979492187496 3.007969238281243 -6.335989746093747 +-0.3146570638020807 -3.629314127604161 2.943971191406242 -6.31465706380208 +-0.2933243815104141 -3.586648763020828 2.879973144531242 -6.293324381510415 +-0.2719916992187476 -3.543983398437495 2.815975097656242 -6.271991699218748 +-0.2506590169270807 -3.501318033854162 2.751977050781242 -6.250659016927081 +-0.2293263346354136 -3.458652669270827 2.687979003906241 -6.229326334635414 +-0.2079936523437471 -3.415987304687494 2.623980957031241 -6.207993652343747 +-0.1866609700520805 -3.373321940104161 2.559982910156242 -6.18666097005208 +-0.1653282877604135 -3.330656575520827 2.495984863281241 -6.165328287760413 +-0.1439956054687467 -3.287991210937493 2.43198681640624 -6.143995605468747 +-0.1226629231770801 -3.24532584635416 2.36798876953124 -6.12266292317708 +-0.1013302408854133 -3.202660481770827 2.30399072265624 -6.101330240885414 +-0.07999755859374647 -3.159995117187493 2.239992675781239 -6.079997558593746 +-0.05866487630207972 -3.117329752604159 2.175994628906239 -6.05866487630208 +-0.0373321940104131 -3.074664388020826 2.111996582031239 -6.037332194010413 +-0.01599951171874625 -3.031999023437493 2.047998535156239 -6.015999511718746 +0.005333170572920487 -2.989333658854159 1.984000488281239 -5.99466682942708 +0.026665852864587 -2.946668294270826 1.920002441406239 -5.973334147135413 +0.04799853515625363 -2.904002929687493 1.856004394531239 -5.952001464843747 +0.06933121744792015 -2.86133756510416 1.79200634765624 -5.93066878255208 +0.09066389973958666 -2.818672200520827 1.72800830078124 -5.909336100260413 +0.1119965820312533 -2.776006835937493 1.66401025390624 -5.888003417968747 +0.1333292643229198 -2.73334147135416 1.600012207031241 -5.86667073567708 +0.1546619466145862 -2.690676106770828 1.536014160156241 -5.845338053385413 +0.1759946289062527 -2.648010742187495 1.472016113281242 -5.824005371093747 +0.1973273111979195 -2.605345377604161 1.408018066406242 -5.802672688802081 +0.2186599934895859 -2.562680013020828 1.344020019531242 -5.781340006510414 +0.2399926757812524 -2.520014648437495 1.280021972656243 -5.760007324218748 +0.261325358072919 -2.477349283854162 1.216023925781243 -5.738674641927081 +0.2826580403645855 -2.434683919270829 1.152025878906243 -5.717341959635414 +0.303990722656252 -2.392018554687496 1.088027832031244 -5.696009277343748 +0.3253234049479187 -2.349353190104162 1.024029785156244 -5.674676595052081 +0.3466560872395852 -2.30668782552083 0.9600317382812445 -5.653343912760414 +0.3679887695312516 -2.264022460937497 0.8960336914062452 -5.632011230468748 +0.3893214518229181 -2.221357096354164 0.8320356445312456 -5.610678548177082 +0.4106541341145848 -2.17869173177083 0.7680375976562459 -5.589345865885416 +0.4319868164062513 -2.136026367187497 0.7040395507812462 -5.568013183593749 +0.4533194986979177 -2.093361002604165 0.6400415039062466 -5.546680501302082 +0.4746521809895844 -2.050695638020831 0.5760434570312469 -5.525347819010416 +0.4959848632812509 -2.008030273437498 0.5120454101562473 -5.504015136718749 +0.5173175455729173 -1.965364908854165 0.4480473632812481 -5.482682454427083 +0.5386502278645841 -1.922699544270832 0.384049316406248 -5.461349772135416 +0.5599829101562506 -1.880034179687499 0.3200512695312483 -5.440017089843749 +0.581315592447917 -1.837368815104166 0.2560532226562491 -5.418684407552083 +0.6026482747395835 -1.794703450520833 0.1920551757812494 -5.397351725260417 +0.6239809570312501 -1.7520380859375 0.1280571289062498 -5.37601904296875 +0.6453136393229166 -1.709372721354167 0.0640590820312501 -5.354686360677084 +0.6666463216145831 -1.666707356770834 6.103515625044409e-05 -5.333353678385417 +0.6879790039062498 -1.6240419921875 -0.06393701171874921 -5.31202099609375 +0.7093116861979163 -1.581376627604167 -0.1279350585937489 -5.290688313802084 +0.7306443684895827 -1.538711263020835 -0.1919331054687481 -5.269355631510417 +0.7519770507812495 -1.496045898437501 -0.2559311523437482 -5.24802294921875 +0.773309733072916 -1.453380533854168 -0.3199291992187479 -5.226690266927084 +0.7946424153645824 -1.410715169270835 -0.3839272460937471 -5.205357584635418 +0.8159750976562488 -1.368049804687502 -0.4479252929687467 -5.184024902343751 +0.8373077799479155 -1.325384440104169 -0.5119233398437464 -5.162692220052085 +0.858640462239582 -1.282719075520836 -0.575921386718746 -5.141359537760418 +0.8799731445312485 -1.240053710937503 -0.6399194335937457 -5.120026855468751 +0.9013058268229152 -1.19738834635417 -0.7039174804687454 -5.098694173177085 +0.9226385091145817 -1.154722981770837 -0.767915527343745 -5.077361490885418 +0.9439711914062482 -1.112057617187504 -0.8319135742187441 -5.056028808593751 +0.9653038736979148 -1.06939225260417 -0.8959116210937443 -5.034696126302086 +0.9866365559895813 -1.026726888020837 -0.959909667968744 -5.013363444010419 +1.007969238281248 -0.9840615234375045 -1.023907714843743 -4.992030761718752 +1.029301920572914 -0.9413961588541717 -1.087905761718742 -4.970698079427086 +1.050634602864581 -0.898730794270838 -1.151903808593743 -4.949365397135419 +1.071967285156247 -0.8560654296875052 -1.215901855468742 -4.928032714843752 +1.093299967447914 -0.8134000651041724 -1.279899902343741 -4.906700032552086 +1.114632649739581 -0.7707347005208387 -1.343897949218742 -4.885367350260419 +1.135965332031247 -0.7280693359375059 -1.407895996093741 -4.864034667968753 +1.157298014322913 -0.6854039713541731 -1.47189404296874 -4.842701985677087 +1.17863069661458 -0.6427386067708394 -1.535892089843741 -4.82136930338542 +1.199963378906247 -0.6000732421875066 -1.59989013671874 -4.800036621093753 +1.221296061197913 -0.5574078776041738 -1.663888183593739 -4.778703938802087 +1.24262874348958 -0.514742513020841 -1.727886230468739 -4.757371256510421 +1.263961425781246 -0.4720771484375073 -1.791884277343739 -4.736038574218753 +1.285294108072913 -0.4294117838541744 -1.855882324218738 -4.714705891927087 +1.306626790364579 -0.3867464192708416 -1.919880371093738 -4.693373209635421 +1.327959472656246 -0.3440810546875079 -1.983878417968738 -4.672040527343754 +1.349292154947912 -0.3014156901041751 -2.047876464843737 -4.650707845052088 +1.370624837239579 -0.2587503255208423 -2.111874511718737 -4.629375162760422 +1.391957519531245 -0.2160849609375095 -2.175872558593736 -4.608042480468755 +1.413290201822912 -0.1734195963541758 -2.239870605468736 -4.586709798177088 +1.434622884114579 -0.130754231770843 -2.303868652343736 -4.565377115885422 +1.455955566406245 -0.08808886718751019 -2.367866699218735 -4.544044433593755 +1.477288248697912 -0.04542350260417649 -2.431864746093735 -4.522711751302088 +1.498620930989578 -0.002758138020843681 -2.495862792968735 -4.501379069010422 +1.519953613281245 0.03990722656248913 -2.559860839843734 -4.480046386718755 +1.541286295572911 0.08257259114582283 -2.623858886718734 -4.458713704427089 +1.562618977864578 0.1252379557291556 -2.687856933593734 -4.437381022135423 +1.583951660156244 0.1679033203124884 -2.751854980468733 -4.416048339843756 +1.605284342447911 0.2105686848958213 -2.815853027343731 -4.394715657552089 +1.626617024739577 0.253234049479155 -2.879851074218733 -4.373382975260423 +1.647949707031244 0.2958994140624878 -2.943849121093732 -4.352050292968756 +1.66928238932291 0.3385647786458206 -3.00784716796873 -4.330717610677089 +1.690615071614577 0.3812301432291543 -3.071845214843732 -4.309384928385423 +1.711947753906244 0.4238955078124871 -3.135843261718731 -4.288052246093756 +1.73328043619791 0.4665608723958199 -3.199841308593729 -4.26671956380209 +1.754613118489577 0.5092262369791536 -3.263839355468731 -4.245386881510424 +1.775945800781243 0.5518916015624864 -3.32783740234373 -4.224054199218757 +1.79727848307291 0.5945569661458192 -3.391835449218728 -4.20272151692709 +1.818611165364576 0.637222330729152 -3.455833496093728 -4.181388834635424 +1.839943847656243 0.6798876953124857 -3.519831542968729 -4.160056152343757 +1.861276529947909 0.7225530598958185 -3.583829589843727 -4.13872347005209 +1.882609212239576 0.7652184244791513 -3.647827636718727 -4.117390787760424 +1.903941894531243 0.807883789062485 -3.711825683593728 -4.096058105468757 +1.925274576822909 0.8505491536458178 -3.775823730468726 -4.074725423177091 +1.946607259114575 0.8932145182291507 -3.839821777343726 -4.053392740885425 +1.967939941406242 0.9358798828124844 -3.903819824218727 -4.032060058593758 +1.989272623697909 0.9785452473958172 -3.967817871093725 -4.010727376302091 +1.99981689825654 0.9996337965130806 -3.999450694769621 -4.00018310174346 diff --git a/tests/circuitpython/synth_block_sum.py b/tests/circuitpython/synth_block_sum.py new file mode 100644 index 0000000000..48b67e9354 --- /dev/null +++ b/tests/circuitpython/synth_block_sum.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +mathop_test(MathOperation.SUM) diff --git a/tests/circuitpython/synth_block_sum.py.exp b/tests/circuitpython/synth_block_sum.py.exp new file mode 100644 index 0000000000..b5a9343d4c --- /dev/null +++ b/tests/circuitpython/synth_block_sum.py.exp @@ -0,0 +1,188 @@ +-1.978606282552083 -2.978606282552083 -2.978606282552083 -2.978606282552083 +-1.957273600260416 -2.957273600260416 -2.957273600260416 -2.957273600260416 +-1.93594091796875 -2.93594091796875 -2.93594091796875 -2.93594091796875 +-1.914608235677083 -2.914608235677083 -2.914608235677083 -2.914608235677083 +-1.893275553385417 -2.893275553385417 -2.893275553385417 -2.893275553385417 +-1.87194287109375 -2.87194287109375 -2.87194287109375 -2.87194287109375 +-1.850610188802083 -2.850610188802083 -2.850610188802083 -2.850610188802083 +-1.829277506510417 -2.829277506510417 -2.829277506510417 -2.829277506510417 +-1.80794482421875 -2.80794482421875 -2.80794482421875 -2.80794482421875 +-1.786612141927083 -2.786612141927083 -2.786612141927083 -2.786612141927083 +-1.765279459635417 -2.765279459635416 -2.765279459635416 -2.765279459635416 +-1.74394677734375 -2.74394677734375 -2.74394677734375 -2.74394677734375 +-1.722614095052083 -2.722614095052083 -2.722614095052084 -2.722614095052083 +-1.701281412760417 -2.701281412760417 -2.701281412760417 -2.701281412760417 +-1.67994873046875 -2.67994873046875 -2.67994873046875 -2.67994873046875 +-1.658616048177083 -2.658616048177083 -2.658616048177083 -2.658616048177083 +-1.637283365885417 -2.637283365885417 -2.637283365885416 -2.637283365885417 +-1.61595068359375 -2.61595068359375 -2.61595068359375 -2.61595068359375 +-1.594618001302083 -2.594618001302083 -2.594618001302083 -2.594618001302083 +-1.573285319010417 -2.573285319010417 -2.573285319010417 -2.573285319010417 +-1.55195263671875 -2.55195263671875 -2.551952636718751 -2.55195263671875 +-1.530619954427083 -2.530619954427083 -2.530619954427083 -2.530619954427083 +-1.509287272135417 -2.509287272135417 -2.509287272135417 -2.509287272135417 +-1.48795458984375 -2.48795458984375 -2.48795458984375 -2.48795458984375 +-1.466621907552084 -2.466621907552084 -2.466621907552083 -2.466621907552084 +-1.445289225260417 -2.445289225260417 -2.445289225260417 -2.445289225260417 +-1.42395654296875 -2.42395654296875 -2.42395654296875 -2.42395654296875 +-1.402623860677084 -2.402623860677084 -2.402623860677084 -2.402623860677084 +-1.381291178385417 -2.381291178385417 -2.381291178385417 -2.381291178385417 +-1.35995849609375 -2.35995849609375 -2.35995849609375 -2.35995849609375 +-1.338625813802083 -2.338625813802083 -2.338625813802084 -2.338625813802083 +-1.317293131510417 -2.317293131510417 -2.317293131510417 -2.317293131510417 +-1.29596044921875 -2.29596044921875 -2.29596044921875 -2.29596044921875 +-1.274627766927084 -2.274627766927084 -2.274627766927084 -2.274627766927084 +-1.253295084635417 -2.253295084635417 -2.253295084635417 -2.253295084635417 +-1.23196240234375 -2.23196240234375 -2.231962402343751 -2.23196240234375 +-1.210629720052084 -2.210629720052084 -2.210629720052084 -2.210629720052084 +-1.189297037760417 -2.189297037760417 -2.189297037760417 -2.189297037760417 +-1.16796435546875 -2.16796435546875 -2.16796435546875 -2.16796435546875 +-1.146631673177084 -2.146631673177084 -2.146631673177083 -2.146631673177084 +-1.125298990885417 -2.125298990885417 -2.125298990885417 -2.125298990885417 +-1.10396630859375 -2.10396630859375 -2.10396630859375 -2.10396630859375 +-1.082633626302084 -2.082633626302084 -2.082633626302083 -2.082633626302084 +-1.061300944010417 -2.061300944010417 -2.061300944010418 -2.061300944010417 +-1.039968261718751 -2.039968261718751 -2.039968261718751 -2.039968261718751 +-1.018635579427084 -2.018635579427084 -2.018635579427084 -2.018635579427084 +-0.9973028971354172 -1.997302897135417 -1.997302897135417 -1.997302897135417 +-0.9759702148437505 -1.97597021484375 -1.97597021484375 -1.97597021484375 +-0.9546375325520838 -1.954637532552084 -1.954637532552084 -1.954637532552084 +-0.9333048502604168 -1.933304850260417 -1.933304850260417 -1.933304850260417 +-0.9119721679687501 -1.91197216796875 -1.91197216796875 -1.91197216796875 +-0.8906394856770833 -1.890639485677083 -1.890639485677083 -1.890639485677083 +-0.8693068033854166 -1.869306803385417 -1.869306803385417 -1.869306803385417 +-0.8479741210937499 -1.84797412109375 -1.84797412109375 -1.84797412109375 +-0.8266414388020831 -1.826641438802083 -1.826641438802083 -1.826641438802083 +-0.8053087565104164 -1.805308756510416 -1.805308756510416 -1.805308756510416 +-0.7839760742187497 -1.78397607421875 -1.78397607421875 -1.78397607421875 +-0.7626433919270829 -1.762643391927083 -1.762643391927083 -1.762643391927083 +-0.7413107096354159 -1.741310709635416 -1.741310709635416 -1.741310709635416 +-0.7199780273437493 -1.719978027343749 -1.719978027343749 -1.719978027343749 +-0.6986453450520828 -1.698645345052083 -1.698645345052083 -1.698645345052083 +-0.6773126627604157 -1.677312662760416 -1.677312662760416 -1.677312662760416 +-0.6559799804687488 -1.655979980468749 -1.655979980468749 -1.655979980468749 +-0.6346472981770823 -1.634647298177082 -1.634647298177082 -1.634647298177082 +-0.6133146158854156 -1.613314615885416 -1.613314615885415 -1.613314615885416 +-0.5919819335937487 -1.591981933593749 -1.591981933593749 -1.591981933593749 +-0.5706492513020819 -1.570649251302082 -1.570649251302082 -1.570649251302082 +-0.5493165690104153 -1.549316569010415 -1.549316569010415 -1.549316569010415 +-0.5279838867187485 -1.527983886718749 -1.527983886718749 -1.527983886718749 +-0.5066512044270817 -1.506651204427082 -1.506651204427082 -1.506651204427082 +-0.4853185221354149 -1.485318522135415 -1.485318522135415 -1.485318522135415 +-0.4639858398437481 -1.463985839843748 -1.463985839843748 -1.463985839843748 +-0.4426531575520815 -1.442653157552082 -1.442653157552082 -1.442653157552082 +-0.4213204752604147 -1.421320475260415 -1.421320475260415 -1.421320475260415 +-0.3999877929687479 -1.399987792968748 -1.399987792968748 -1.399987792968748 +-0.3786551106770811 -1.378655110677081 -1.378655110677081 -1.378655110677081 +-0.3573224283854145 -1.357322428385415 -1.357322428385415 -1.357322428385415 +-0.3359897460937477 -1.335989746093748 -1.335989746093748 -1.335989746093748 +-0.3146570638020807 -1.314657063802081 -1.31465706380208 -1.314657063802081 +-0.2933243815104141 -1.293324381510414 -1.293324381510414 -1.293324381510414 +-0.2719916992187476 -1.271991699218748 -1.271991699218748 -1.271991699218748 +-0.2506590169270807 -1.250659016927081 -1.250659016927081 -1.250659016927081 +-0.2293263346354136 -1.229326334635414 -1.229326334635414 -1.229326334635414 +-0.2079936523437471 -1.207993652343747 -1.207993652343747 -1.207993652343747 +-0.1866609700520805 -1.18666097005208 -1.18666097005208 -1.18666097005208 +-0.1653282877604135 -1.165328287760413 -1.165328287760413 -1.165328287760413 +-0.1439956054687467 -1.143995605468747 -1.143995605468747 -1.143995605468747 +-0.1226629231770801 -1.12266292317708 -1.12266292317708 -1.12266292317708 +-0.1013302408854133 -1.101330240885413 -1.101330240885413 -1.101330240885413 +-0.07999755859374647 -1.079997558593746 -1.079997558593746 -1.079997558593746 +-0.05866487630207972 -1.05866487630208 -1.05866487630208 -1.05866487630208 +-0.0373321940104131 -1.037332194010413 -1.037332194010413 -1.037332194010413 +-0.01599951171874625 -1.015999511718746 -1.015999511718746 -1.015999511718746 +0.005333170572920487 -0.9946668294270795 -0.9946668294270795 -0.9946668294270795 +0.026665852864587 -0.973334147135413 -0.973334147135413 -0.973334147135413 +0.04799853515625363 -0.9520014648437463 -0.9520014648437463 -0.9520014648437463 +0.06933121744792015 -0.9306687825520799 -0.9306687825520799 -0.9306687825520799 +0.09066389973958666 -0.9093361002604134 -0.9093361002604134 -0.9093361002604134 +0.1119965820312533 -0.8880034179687467 -0.8880034179687467 -0.8880034179687467 +0.1333292643229198 -0.8666707356770802 -0.8666707356770802 -0.8666707356770802 +0.1546619466145862 -0.8453380533854137 -0.8453380533854137 -0.8453380533854137 +0.1759946289062527 -0.8240053710937474 -0.8240053710937474 -0.8240053710937472 +0.1973273111979195 -0.8026726888020805 -0.8026726888020805 -0.8026726888020805 +0.2186599934895859 -0.7813400065104141 -0.7813400065104141 -0.7813400065104141 +0.2399926757812524 -0.7600073242187477 -0.7600073242187477 -0.7600073242187476 +0.261325358072919 -0.7386746419270809 -0.7386746419270809 -0.738674641927081 +0.2826580403645855 -0.7173419596354145 -0.7173419596354145 -0.7173419596354145 +0.303990722656252 -0.6960092773437481 -0.6960092773437481 -0.696009277343748 +0.3253234049479187 -0.6746765950520812 -0.6746765950520812 -0.6746765950520813 +0.3466560872395852 -0.6533439127604148 -0.6533439127604148 -0.6533439127604148 +0.3679887695312516 -0.6320112304687484 -0.6320112304687484 -0.6320112304687484 +0.3893214518229181 -0.610678548177082 -0.610678548177082 -0.6106785481770819 +0.4106541341145848 -0.5893458658854152 -0.5893458658854152 -0.5893458658854152 +0.4319868164062513 -0.5680131835937487 -0.5680131835937487 -0.5680131835937487 +0.4533194986979177 -0.5466805013020823 -0.5466805013020823 -0.5466805013020823 +0.4746521809895844 -0.5253478190104155 -0.5253478190104155 -0.5253478190104156 +0.4959848632812509 -0.5040151367187491 -0.5040151367187491 -0.5040151367187491 +0.5173175455729173 -0.4826824544270827 -0.4826824544270827 -0.4826824544270827 +0.5386502278645841 -0.4613497721354158 -0.4613497721354158 -0.4613497721354159 +0.5599829101562506 -0.4400170898437494 -0.4400170898437494 -0.4400170898437494 +0.581315592447917 -0.418684407552083 -0.418684407552083 -0.418684407552083 +0.6026482747395835 -0.3973517252604166 -0.3973517252604166 -0.3973517252604165 +0.6239809570312501 -0.3760190429687498 -0.3760190429687498 -0.3760190429687499 +0.6453136393229166 -0.3546863606770834 -0.3546863606770834 -0.3546863606770834 +0.6666463216145831 -0.333353678385417 -0.333353678385417 -0.3333536783854169 +0.6879790039062498 -0.3120209960937501 -0.3120209960937501 -0.3120209960937502 +0.7093116861979163 -0.2906883138020837 -0.2906883138020837 -0.2906883138020837 +0.7306443684895827 -0.2693556315104173 -0.2693556315104173 -0.2693556315104173 +0.7519770507812495 -0.2480229492187505 -0.2480229492187505 -0.2480229492187505 +0.773309733072916 -0.226690266927084 -0.226690266927084 -0.226690266927084 +0.7946424153645824 -0.2053575846354176 -0.2053575846354176 -0.2053575846354176 +0.8159750976562488 -0.1840249023437512 -0.1840249023437512 -0.1840249023437511 +0.8373077799479155 -0.1626922200520844 -0.1626922200520844 -0.1626922200520845 +0.858640462239582 -0.141359537760418 -0.141359537760418 -0.141359537760418 +0.8799731445312485 -0.1200268554687516 -0.1200268554687516 -0.1200268554687515 +0.9013058268229152 -0.09869417317708473 -0.09869417317708473 -0.09869417317708484 +0.9226385091145817 -0.07736149088541833 -0.07736149088541833 -0.07736149088541833 +0.9439711914062482 -0.05602880859375192 -0.05602880859375192 -0.05602880859375192 +0.9653038736979148 -0.03469612630208507 -0.03469612630208507 -0.03469612630208518 +0.9866365559895813 -0.01336344401041867 -0.01336344401041867 -0.01336344401041867 +1.007969238281248 0.007969238281247737 0.007969238281247737 0.007969238281247737 +1.029301920572914 0.02930192057291414 0.02930192057291414 0.02930192057291414 +1.050634602864581 0.05063460286458099 0.05063460286458099 0.05063460286458099 +1.071967285156247 0.0719672851562474 0.0719672851562474 0.0719672851562474 +1.093299967447914 0.0932999674479138 0.0932999674479138 0.0932999674479138 +1.114632649739581 0.1146326497395806 0.1146326497395806 0.1146326497395806 +1.135965332031247 0.1359653320312471 0.1359653320312471 0.1359653320312471 +1.157298014322913 0.1572980143229135 0.1572980143229135 0.1572980143229135 +1.17863069661458 0.1786306966145803 0.1786306966145803 0.1786306966145803 +1.199963378906247 0.1999633789062467 0.1999633789062467 0.1999633789062467 +1.221296061197913 0.2212960611979131 0.2212960611979131 0.2212960611979131 +1.24262874348958 0.2426287434895795 0.2426287434895795 0.2426287434895795 +1.263961425781246 0.2639614257812464 0.2639614257812464 0.2639614257812464 +1.285294108072913 0.2852941080729128 0.2852941080729128 0.2852941080729128 +1.306626790364579 0.3066267903645792 0.3066267903645792 0.3066267903645792 +1.327959472656246 0.327959472656246 0.327959472656246 0.327959472656246 +1.349292154947912 0.3492921549479124 0.3492921549479124 0.3492921549479124 +1.370624837239579 0.3706248372395788 0.3706248372395788 0.3706248372395788 +1.391957519531245 0.3919575195312452 0.3919575195312452 0.3919575195312452 +1.413290201822912 0.4132902018229121 0.4132902018229121 0.4132902018229121 +1.434622884114579 0.4346228841145785 0.4346228841145785 0.4346228841145785 +1.455955566406245 0.4559555664062449 0.4559555664062449 0.4559555664062449 +1.477288248697912 0.4772882486979118 0.4772882486979118 0.4772882486979118 +1.498620930989578 0.4986209309895782 0.4986209309895782 0.4986209309895782 +1.519953613281245 0.5199536132812446 0.5199536132812446 0.5199536132812446 +1.541286295572911 0.5412862955729114 0.5412862955729114 0.5412862955729114 +1.562618977864578 0.5626189778645778 0.5626189778645778 0.5626189778645778 +1.583951660156244 0.5839516601562442 0.5839516601562442 0.5839516601562442 +1.605284342447911 0.6052843424479106 0.6052843424479106 0.6052843424479106 +1.626617024739577 0.6266170247395775 0.6266170247395775 0.6266170247395775 +1.647949707031244 0.6479497070312439 0.6479497070312439 0.6479497070312439 +1.66928238932291 0.6692823893229103 0.6692823893229103 0.6692823893229103 +1.690615071614577 0.6906150716145771 0.6906150716145771 0.6906150716145771 +1.711947753906244 0.7119477539062435 0.7119477539062435 0.7119477539062435 +1.73328043619791 0.7332804361979099 0.7332804361979099 0.7332804361979099 +1.754613118489577 0.7546131184895768 0.7546131184895768 0.7546131184895768 +1.775945800781243 0.7759458007812432 0.7759458007812432 0.7759458007812432 +1.79727848307291 0.7972784830729096 0.7972784830729096 0.7972784830729096 +1.818611165364576 0.818611165364576 0.818611165364576 0.818611165364576 +1.839943847656243 0.8399438476562429 0.8399438476562429 0.8399438476562429 +1.861276529947909 0.8612765299479094 0.8612765299479094 0.8612765299479094 +1.882609212239576 0.8826092122395757 0.8826092122395757 0.8826092122395757 +1.903941894531243 0.9039418945312425 0.9039418945312425 0.9039418945312425 +1.925274576822909 0.925274576822909 0.925274576822909 0.925274576822909 +1.946607259114575 0.9466072591145753 0.9466072591145753 0.9466072591145753 +1.967939941406242 0.9679399414062422 0.9679399414062422 0.9679399414062422 +1.989272623697909 0.9892726236979087 0.9892726236979087 0.9892726236979087 +1.99981689825654 0.9998168982565403 0.9998168982565403 0.9998168982565403 diff --git a/tests/run-tests.py b/tests/run-tests.py index 7a7b3adbcb..c756729ff9 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -887,6 +887,7 @@ the last matching regex is used: os.environ["MICROPYPATH"] = os.pathsep.join( [ "", + "testlib", ".frozen", base_path("../frozen/Adafruit_CircuitPython_asyncio"), base_path("../frozen/Adafruit_CircuitPython_Ticks"), diff --git a/tests/testlib/synthblockhelper.py b/tests/testlib/synthblockhelper.py new file mode 100644 index 0000000000..d1b616f713 --- /dev/null +++ b/tests/testlib/synthblockhelper.py @@ -0,0 +1,29 @@ +import array +from math import sin, pi +from synthio import LFO, MathOperation, lfo_tick + +bend_out = array.array("h", [0, 32767]) +bend_in = array.array("h", [32767, 0]) +sweep = array.array("h", [-32767, 32767]) +triangle = array.array("h", [0, 32767, 0, -32767]) +sine = array.array("h", [int(32767 * sin(i * 2 * pi / 600)) for i in range(600)]) + + +def print_result(*blocks): + for i in range(48000 / 256): + print(*lfo_tick(*blocks)) + + +def mathop_test(kind): + v = LFO(sweep, rate=1, scale=2, once=True) + varying_a = kind(v, 2, -3) + varying_b = kind(-3, v, 2) + varying_c = kind(2, -3, v) + print_result(v, varying_a, varying_b, varying_c) + + +def lfo_test(sweep_input_name, **inputs): + sweep = LFO(sweep, rate=1, scale=2) + test = LFO(sine, **inputs) + setattr(test, sweep_input_name, sweep) + print_result(sweep, test) From 1059c99f6ec3b7e47e6686e1213b0ba436881066 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 22 May 2023 10:43:57 -0500 Subject: [PATCH 1119/1712] synthio: Add tests of each varying lfo input I looked at all the results and they pleased me --- tests/circuitpython/synthlfo_offset.py | 3 + tests/circuitpython/synthlfo_offset.py.exp | 188 ++++++++++++++++++ tests/circuitpython/synthlfo_phase_offset.py | 3 + .../synthlfo_phase_offset.py.exp | 188 ++++++++++++++++++ tests/circuitpython/synthlfo_rate.py | 3 + tests/circuitpython/synthlfo_rate.py.exp | 188 ++++++++++++++++++ tests/circuitpython/synthlfo_scale.py | 3 + tests/circuitpython/synthlfo_scale.py.exp | 188 ++++++++++++++++++ tests/testlib/synthblockhelper.py | 8 +- 9 files changed, 769 insertions(+), 3 deletions(-) create mode 100644 tests/circuitpython/synthlfo_offset.py create mode 100644 tests/circuitpython/synthlfo_offset.py.exp create mode 100644 tests/circuitpython/synthlfo_phase_offset.py create mode 100644 tests/circuitpython/synthlfo_phase_offset.py.exp create mode 100644 tests/circuitpython/synthlfo_rate.py create mode 100644 tests/circuitpython/synthlfo_rate.py.exp create mode 100644 tests/circuitpython/synthlfo_scale.py create mode 100644 tests/circuitpython/synthlfo_scale.py.exp diff --git a/tests/circuitpython/synthlfo_offset.py b/tests/circuitpython/synthlfo_offset.py new file mode 100644 index 0000000000..d52ad6424a --- /dev/null +++ b/tests/circuitpython/synthlfo_offset.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +lfo_test("offset") diff --git a/tests/circuitpython/synthlfo_offset.py.exp b/tests/circuitpython/synthlfo_offset.py.exp new file mode 100644 index 0000000000..b46b23fa81 --- /dev/null +++ b/tests/circuitpython/synthlfo_offset.py.exp @@ -0,0 +1,188 @@ +0.005333170572916667 0.01599951171875 0.18274755859375 +0.01066634114583333 0.0319990234375 0.3608259277343749 +0.01599951171875 0.04799853515625 0.5297185058593748 +0.02133268229166667 0.06399804687500001 0.6851223144531248 +0.02666585286458333 0.07999755859375001 0.8231005859374999 +0.0319990234375 0.0959970703125 0.94029638671875 +0.03733219401041667 0.11199658203125 1.033810546875 +0.04266536458333333 0.12799609375 1.101537353515625 +0.04799853515625001 0.14399560546875 1.1419814453125 +0.05333170572916668 0.1599951171875 1.154471435546875 +0.05866487630208335 0.17599462890625 1.139098876953125 +0.06399804687500001 0.1919941406250001 1.096779296875 +0.06933121744791668 0.2079936523437501 1.029099609375 +0.07466438802083333 0.2239931640625001 0.9384401855468752 +0.07999755859375001 0.2399926757812501 0.8277307128906251 +0.08533072916666667 0.2559921875000001 0.7006027832031252 +0.09066389973958334 0.2719916992187501 0.5609931640625001 +0.09599707031249999 0.2879912109375002 0.4132963867187502 +0.1013302408854166 0.3039907226562502 0.2621206054687502 +0.1066634114583333 0.3199902343750002 0.1121044921875002 +0.11199658203125 0.3359897460937502 -0.03211328124999924 +0.1173297526041666 0.3519892578125002 -0.1660161132812494 +0.1226629231770833 0.3679887695312502 -0.2853925781249989 +0.12799609375 0.3839882812500002 -0.386489013671874 +0.1333292643229167 0.3999877929687503 -0.4660095214843738 +0.1386624348958333 0.4159873046875003 -0.5212380371093741 +0.1439956054687499 0.4319868164062503 -0.5502519531249993 +0.1493287760416666 0.4479863281250003 -0.5517390136718747 +0.1546619466145833 0.4639858398437503 -0.5252414550781252 +0.1599951171874999 0.4799853515625003 -0.4710339355468756 +0.1653282877604166 0.4959848632812504 -0.3901845703125013 +0.1706614583333333 0.5119843750000004 -0.2844938964843768 +0.1759946289062499 0.5279838867187504 -0.1565253906250021 +0.1813277994791666 0.5439833984375003 -0.009361328125003677 +0.1866609700520833 0.5599829101562504 0.153275146484371 +0.1919941406249999 0.5759824218750004 0.3273251953124958 +0.1973273111979166 0.5919819335937504 0.5083332519531194 +0.2026604817708332 0.6079814453125004 0.6916301269531204 +0.2079936523437499 0.6239809570312504 0.8726381835937456 +0.2133268229166666 0.6399804687500005 1.046688232421871 +0.2186599934895832 0.6559799804687505 1.209324707031246 +0.2239931640624999 0.6719794921875005 1.356488769531247 +0.2293263346354165 0.6879790039062506 1.484457275390623 +0.2346595052083332 0.7039785156250005 1.590147949218748 +0.2399926757812499 0.7199780273437505 1.670997314453124 +0.2453258463541665 0.7359775390625005 1.725204833984375 +0.2506590169270832 0.7519770507812505 1.751702392578126 +0.2559921874999999 0.7679765625000005 1.750215332031251 +0.2613253580729165 0.7839760742187506 1.721201416015627 +0.2666585286458333 0.7999755859375006 1.665972900390628 +0.2719916992187499 0.8159750976562506 1.586452392578129 +0.2773248697916666 0.8319746093750007 1.485355957031254 +0.2826580403645833 0.8479741210937506 1.365979492187505 +0.2879912109375 0.8639736328125005 1.232076660156255 +0.2933243815104167 0.8799731445312506 1.087858886718755 +0.2986575520833334 0.8959726562500007 0.9378427734375055 +0.3039907226562501 0.9119721679687506 0.7866669921875054 +0.3093238932291668 0.9279716796875007 0.6389702148437558 +0.3146570638020835 0.9439711914062507 0.4993605957031305 +0.3199902343750002 0.9599707031250007 0.3722326660156305 +0.3253234049479168 0.9759702148437508 0.26152319335938 +0.3306565755208335 0.9919697265625008 0.1708637695312545 +0.3359897460937503 1.007969238281251 0.1031840820312535 +0.3413229166666669 1.023968750000001 0.06086450195312764 +0.3466560872395836 1.039968261718751 0.04549194335937646 +0.3519892578125003 1.055967773437501 0.05798193359375037 +0.357322428385417 1.071967285156251 0.09842602539062407 +0.3626555989583337 1.087966796875001 0.1661528320312475 +0.3679887695312503 1.103966308593751 0.2596669921874963 +0.3733219401041671 1.119965820312501 0.3768627929687453 +0.3786551106770837 1.135965332031251 0.5148410644531184 +0.3839882812500004 1.151964843750001 0.6702448730468674 +0.3893214518229172 1.167964355468751 0.8391374511718668 +0.3946546223958338 1.183963867187501 1.01721582031249 +0.3999877929687505 1.199963378906251 1.19996337890624 +0.4053209635416672 1.215962890625001 1.382710937499991 +0.4106541341145839 1.231962402343751 1.560789306640616 +0.4159873046875006 1.247961914062501 1.729681884765617 +0.4213204752604173 1.263961425781251 1.885085693359368 +0.426653645833334 1.279960937500001 2.023063964843744 +0.4319868164062506 1.295960449218751 2.140259765624995 +0.4373199869791674 1.311959960937501 2.233773925781247 +0.4426531575520841 1.327959472656251 2.301500732421874 +0.4479863281250007 1.343958984375001 2.34194482421875 +0.4533194986979174 1.359958496093751 2.354434814453127 +0.4586526692708341 1.375958007812501 2.339062255859379 +0.4639858398437508 1.391957519531251 2.296742675781255 +0.4693190104166675 1.407957031250001 2.229062988281257 +0.4746521809895841 1.423956542968751 2.138403564453133 +0.4799853515625009 1.439956054687501 2.027694091796884 +0.4853185221354176 1.455955566406251 1.900566162109385 +0.4906516927083342 1.471955078125001 1.760956542968761 +0.495984863281251 1.487954589843751 1.613259765625011 +0.5013180338541677 1.503954101562501 1.462083984375011 +0.5066512044270842 1.519953613281251 1.312067871093762 +0.5119843750000009 1.535953125000001 1.167850097656261 +0.5173175455729176 1.551952636718751 1.033947265625011 +0.5226507161458342 1.567952148437501 0.9145708007812598 +0.5279838867187508 1.583951660156251 0.8134743652343838 +0.5333170572916675 1.599951171875001 0.7339538574218824 +0.5386502278645841 1.615950683593751 0.6787253417968806 +0.5439833984375007 1.631950195312501 0.6497114257812537 +0.5493165690104174 1.647949707031251 0.6482243652343765 +0.554649739583334 1.663949218750001 0.6747219238281246 +0.5599829101562506 1.679948730468751 0.7289294433593721 +0.5653160807291673 1.695948242187501 0.8097788085937447 +0.5706492513020839 1.711947753906251 0.9154694824218678 +0.5759824218750005 1.727947265625001 1.043437988281241 +0.5813155924479172 1.743946777343751 1.190602050781238 +0.5866487630208338 1.759946289062501 1.353238525390612 +0.5919819335937504 1.775945800781251 1.527288574218737 +0.597315104166667 1.791945312500001 1.708296630859361 +0.6026482747395837 1.807944824218751 1.89159350585936 +0.6079814453125003 1.823944335937501 2.072601562499986 +0.6133146158854169 1.839943847656252 2.246651611328112 +0.6186477864583336 1.855943359375001 2.409288085937488 +0.6239809570312502 1.871942871093751 2.55645214843749 +0.6293141276041668 1.887942382812501 2.684420654296867 +0.6346472981770836 1.903941894531251 2.790111328124994 +0.6399804687500001 1.919941406250001 2.870960693359372 +0.6453136393229167 1.935940917968751 2.925168212890624 +0.6506468098958333 1.951940429687502 2.951665771484377 +0.6559799804687501 1.967939941406252 2.950178710937505 +0.6613131510416666 1.983939453125002 2.921164794921882 +0.6666463216145832 1.999877931550145 2.865875246003278 +0.6719794921875 1.999877931550145 2.77035522647203 +0.6773126627604166 1.999877931550145 2.653259279206408 +0.6826458333333331 1.999877931550145 2.517883302643909 +0.6879790039062499 1.999877931550145 2.36798095889391 +0.6933121744791665 1.999877931550145 2.207763673737661 +0.698645345052083 1.999877931550145 2.041748048737661 +0.7039785156249997 1.999877931550145 1.874572755768911 +0.7093116861979164 1.999877931550145 1.71087646670641 +0.714644856770833 1.999877931550145 1.555267335847035 +0.7199780273437496 1.999877931550145 1.412139894440784 +0.7253111979166663 1.999877931550145 1.285430910065782 +0.7306443684895829 1.999877931550145 1.178771974518905 +0.7359775390624995 1.999877931550145 1.095092775300153 +0.7413107096354162 1.999877931550145 1.036773683503275 +0.7466438802083328 1.999877931550145 1.005401613190772 +0.7519770507812495 1.999877931550145 1.001892091706394 +0.757310221354166 1.999877931550145 1.026336671784516 +0.7626433919270827 1.999877931550145 1.078063966706388 +0.7679765624999994 1.999877931550145 1.155578615143885 +0.773309733072916 1.999877931550145 1.256774904206382 +0.7786429036458326 1.999877931550145 1.378753663972005 +0.7839760742187493 1.999877931550145 1.518157960847002 +0.7893092447916659 1.999877931550145 1.67105102725325 +0.7946424153645825 1.999877931550145 1.833129884675124 +0.7999755859374992 1.999877931550145 1.999877931550124 +0.8053087565104157 1.999877931550145 2.166625978425124 +0.8106419270833324 1.999877931550145 2.328704835847 +0.815975097656249 1.999877931550145 2.481597902253251 +0.8213082682291656 1.999877931550145 2.621002199128253 +0.8266414388020824 1.999877931550145 2.742980958893881 +0.8319746093749989 1.999877931550145 2.844177247956384 +0.8373077799479155 1.999877931550145 2.921691896393887 +0.8426409505208323 1.999877931550145 2.973419191315765 +0.8479741210937489 1.999877931550145 2.997863771393894 +0.8533072916666654 1.999877931550145 2.994354249909522 +0.8586404622395822 1.999877931550145 2.962982179597026 +0.8639736328124988 1.999877931550145 2.904663087800154 +0.8693068033854153 1.999877931550145 2.820983888581407 +0.8746399739583321 1.999877931550145 2.714324953034535 +0.8799731445312487 1.999877931550145 2.587615968659537 +0.8853063151041653 1.999877931550145 2.444488527253289 +0.890639485677082 1.999877931550145 2.288879396393915 +0.8959726562499986 1.999877931550145 2.125183107331416 +0.9013058268229152 1.999877931550145 1.958007814362666 +0.9066389973958319 1.999877931550145 1.791992189362666 +0.9119721679687485 1.999877931550145 1.631774904206416 +0.9173053385416651 1.999877931550145 1.481872560456414 +0.9226385091145819 1.999877931550145 1.346496583893912 +0.9279716796874984 1.999877931550145 1.229400636628285 +0.933304850260415 1.999877931550145 1.133880617097032 +0.9386380208333318 1.999877931550145 1.062652589753279 +0.9439711914062483 1.999877931550145 1.0176391620189 +0.9493043619791649 1.999877931550145 1.000152589753271 +0.9546375325520815 1.999877931550145 1.010650636628267 +0.9599707031249983 1.999877931550145 1.048858644440763 +0.9653038736979148 1.999877931550145 1.113708497956384 +0.9706370442708314 1.999877931550145 1.203399660065755 +0.9759702148437482 1.999877931550145 1.315368654206376 +0.9813033854166648 1.999877931550145 1.446533204987623 +0.9866365559895813 1.999877931550145 1.593170167878246 +0.9919697265624981 1.999877931550145 1.75122070498762 +0.9973028971354147 1.999877931550145 1.916229249909493 +0.9999389657750726 1.999877931550145 2.083526613190743 diff --git a/tests/circuitpython/synthlfo_phase_offset.py b/tests/circuitpython/synthlfo_phase_offset.py new file mode 100644 index 0000000000..a1d005d38d --- /dev/null +++ b/tests/circuitpython/synthlfo_phase_offset.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +lfo_test("phase_offset") diff --git a/tests/circuitpython/synthlfo_phase_offset.py.exp b/tests/circuitpython/synthlfo_phase_offset.py.exp new file mode 100644 index 0000000000..f363543425 --- /dev/null +++ b/tests/circuitpython/synthlfo_phase_offset.py.exp @@ -0,0 +1,188 @@ +0.005333170572916667 0.01599951171875 0.2648468941450119 +0.01066634114583333 0.0319990234375 0.5107979476451874 +0.01599951171875 0.04799853515625 0.7202511847019196 +0.02133268229166667 0.06399804687500001 0.8782473087310791 +0.02666585286458333 0.07999755859375001 0.9735376834869385 +0.0319990234375 0.0959970703125 0.9992316007614136 +0.03733219401041667 0.11199658203125 0.9535648584365845 +0.04266536458333333 0.12799609375 0.8397716045379637 +0.04799853515625001 0.14399560546875 0.6659934997558594 +0.05333170572916668 0.1599951171875 0.4446379542350767 +0.05866487630208335 0.17599462890625 0.191494324803352 +0.06399804687500001 0.1919941406250001 -0.07526237964630139 +0.06933121744791668 0.2079936523437501 -0.3366994023323058 +0.07466438802083333 0.2239931640625001 -0.5740737140178678 +0.07999755859375001 0.2399926757812501 -0.7704477906227112 +0.08533072916666667 0.2559921875000001 -0.9117594718933105 +0.09066389973958334 0.2719916992187501 -0.9879498600959778 +0.09599707031249999 0.2879912109375002 -0.993554699420929 +0.1013302408854166 0.3039907226562502 -0.9281892985105516 +0.1066634114583333 0.3199902343750002 -0.7965151071548462 +0.11199658203125 0.3359897460937502 -0.6079369992017748 +0.1173297526041666 0.3519892578125002 -0.3759292483329777 +0.1226629231770833 0.3679887695312502 -0.1170743107795711 +0.12799609375 0.3839882812500002 0.1501225709915152 +0.1333292643229167 0.3999877929687503 0.4066375792026513 +0.1386624348958333 0.4159873046875003 0.6340812325477597 +0.1439956054687499 0.4319868164062503 0.8162488311529156 +0.1493287760416666 0.4479863281250003 0.9400766611099241 +0.1546619466145833 0.4639858398437503 0.9967825502157211 +0.1599951171874999 0.4799853515625003 0.9822556674480438 +0.1653282877604166 0.4959848632812504 0.897545513510704 +0.1706614583333333 0.5119843750000004 0.7487346649169919 +0.1759946289062499 0.5279838867187504 0.5464466869831082 +0.1813277994791666 0.5439833984375003 0.3050981819629667 +0.1866609700520833 0.5599829101562504 0.04197713732719421 +0.1919941406249999 0.5759824218750004 -0.2241353392601011 +0.1973273111979166 0.5919819335937504 -0.4742717653512956 +0.2026604817708332 0.6079814453125004 -0.6905037820339201 +0.2079936523437499 0.6239809570312504 -0.8574032306671141 +0.2133268229166666 0.6399804687500005 -0.9630706310272215 +0.2186599934895832 0.6559799804687505 -0.9999443352222443 +0.2239931640624999 0.6719794921875005 -0.9653600990772247 +0.2293263346354165 0.6879790039062506 -0.8618161618709559 +0.2346595052083332 0.7039785156250005 -0.6967093229293821 +0.2399926757812499 0.7199780273437505 -0.4818406701087942 +0.2453258463541665 0.7359775390625005 -0.2325470328330984 +0.2506590169270832 0.7519770507812505 0.0333519607782382 +0.2559921874999999 0.7679765625000005 0.29686851501465 +0.2613253580729165 0.7839760742187506 0.5391983419656766 +0.2666585286458333 0.7999755859375006 0.7429997622966775 +0.2719916992187499 0.8159750976562506 0.8937102973461156 +0.2773248697916666 0.8319746093750007 0.9805967569351198 +0.2826580403645833 0.8479741210937506 0.9974352151155472 +0.2879912109375 0.8639736328125005 0.9429876506328583 +0.2933243815104167 0.8799731445312506 0.821201354265213 +0.2986575520833334 0.8959726562500007 0.640732264518738 +0.3039907226562501 0.9119721679687506 0.4145088762044906 +0.3093238932291668 0.9279716796875007 0.1586474716663362 +0.3146570638020835 0.9439711914062507 -0.1085054248571398 +0.3199902343750002 0.9599707031250007 -0.3679313659667974 +0.3253234049479168 0.9759702148437508 -0.6010590612888343 +0.3306565755208335 0.9919697265625008 -0.7912848472595223 +0.3359897460937503 1.007969238281251 -0.9249622702598575 +0.3413229166666669 1.023968750000001 -0.9925424575805666 +0.3466560872395836 1.039968261718751 -0.9892551898956297 +0.3519892578125003 1.055967773437501 -0.9152791857719418 +0.357322428385417 1.071967285156251 -0.7759051352739338 +0.3626555989583337 1.087966796875001 -0.5811199426651007 +0.3679887695312503 1.103966308593751 -0.3448092401027677 +0.3733219401041671 1.119965820312501 -0.08386272192001464 +0.3786551106770837 1.135965332031251 0.1830197185277934 +0.3839882812500004 1.151964843750001 0.436892795562743 +0.3893214518229172 1.167964355468751 0.659535548090934 +0.3946546223958338 1.183963867187501 0.835056281089782 +0.3999877929687505 1.199963378906251 0.9509468674659725 +0.4053209635416672 1.215962890625001 0.998878288269043 +0.4106541341145839 1.231962402343751 0.9754490494728094 +0.4159873046875006 1.247961914062501 0.8823510468006145 +0.4213204752604173 1.263961425781251 0.7262172013521216 +0.426653645833334 1.279960937500001 0.5182142257690453 +0.4319868164062506 1.295960449218751 0.273157685995105 +0.4373199869791674 1.311959960937501 0.008625489473345752 +0.4426531575520841 1.327959472656251 -0.2565163254737818 +0.4479863281250007 1.343958984375001 -0.5033604621887179 +0.4533194986979174 1.359958496093751 -0.7142631113529175 +0.4586526692708341 1.375958007812501 -0.8740972161293012 +0.4639858398437508 1.391957519531251 -0.9715259075164784 +0.4693190104166675 1.407957031250001 -0.9995126962661745 +0.4746521809895841 1.423956542968751 -0.9561228483915343 +0.4799853515625009 1.439956054687501 -0.844445765018466 +0.4853185221354176 1.455955566406251 -0.6724051415920295 +0.4906516927083342 1.471955078125001 -0.4523329973220872 +0.495984863281251 1.487954589843751 -0.1999619960784966 +0.5013180338541677 1.503954101562501 0.066662037372583 +0.5066512044270842 1.519953613281251 0.3285517096519417 +0.5119843750000009 1.535953125000001 0.5669812202453559 +0.5173175455729176 1.551952636718751 0.7649154067039442 +0.5226507161458342 1.567952148437501 0.9081746101379366 +0.5279838867187508 1.583951660156251 0.9865846186876283 +0.5333170572916675 1.599951171875001 0.9945067167282112 +0.5386502278645841 1.615950683593751 0.9313567727804212 +0.5439833984375007 1.631950195312501 0.8016954302787823 +0.5493165690104174 1.647949707031251 0.6147811114788119 +0.554649739583334 1.663949218750001 0.3839068174362252 +0.5599829101562506 1.679948730468751 0.1256243586540305 +0.5653160807291673 1.695948242187501 -0.1415845155715852 +0.5706492513020839 1.711947753906251 -0.3987413585185924 +0.5759824218750005 1.727947265625001 -0.6273850083351061 +0.5813155924479172 1.743946777343751 -0.8112369775772041 +0.5866487630208338 1.759946289062501 -0.9371063411235772 +0.5919819335937504 1.775945800781251 -0.9960507780313483 +0.597315104166667 1.791945312500001 -0.9838399410247822 +0.6026482747395837 1.807944824218751 -0.9013213992118876 +0.6079814453125003 1.823944335937501 -0.7544295668602059 +0.6133146158854169 1.839943847656252 -0.5536377578973849 +0.6186477864583336 1.855943359375001 -0.3133080720901593 +0.6239809570312502 1.871942871093751 -0.05057747960091872 +0.6293141276041668 1.887942382812501 0.2157110273837934 +0.6346472981770836 1.903941894531251 0.4666443347930801 +0.6399804687500001 1.919941406250001 0.6842399835586463 +0.6453136393229167 1.935940917968751 0.8529374569654401 +0.6506468098958333 1.951940429687502 0.960706794261929 +0.6559799804687501 1.967939941406252 0.9998652279376982 +0.6613131510416666 1.983939453125002 0.9675708174705537 +0.6666463216145832 1.999877931550145 0.8663772882655508 +0.6719794921875 1.999877931550145 0.7709623203177363 +0.6773126627604166 1.999877931550145 0.6539602489351815 +0.6826458333333331 1.999877931550145 0.5186580319950938 +0.6879790039062499 1.999877931550145 0.3688138018869942 +0.6933121744791665 1.999877931550145 0.2086345141119875 +0.698645345052083 1.999877931550145 0.04263453509249916 +0.7039785156249997 1.999877931550145 -0.1245452281563965 +0.7093116861979164 1.999877931550145 -0.2882661037597 +0.714644856770833 1.999877931550145 -0.44392217256061 +0.7199780273437496 1.999877931550145 -0.5871166681690525 +0.7253111979166663 1.999877931550145 -0.7139061175866843 +0.7306443684895829 1.999877931550145 -0.8206656344368486 +0.7359775390624995 1.999877931550145 -0.9044543555191806 +0.7413107096354162 1.999877931550145 -0.9628941448800031 +0.7466438802083328 1.999877931550145 -0.994391383036597 +0.7519770507812495 1.999877931550145 -0.9980305426452121 +0.757310221354166 1.999877931550145 -0.9737111304111812 +0.7626433919270827 1.999877931550145 -0.9221090033334004 +0.7679765624999994 1.999877931550145 -0.8447061118995558 +0.773309733072916 1.999877931550145 -0.743612639280419 +0.7786429036458326 1.999877931550145 -0.621721049977646 +0.7839760742187493 1.999877931550145 -0.4823905127250588 +0.7893092447916659 1.999877931550145 -0.3295510896805634 +0.7946424153645825 1.999877931550145 -0.1675035242197132 +0.7999755859374992 1.999877931550145 -0.0007666530450788009 +0.8053087565104157 1.999877931550145 0.1659903343902136 +0.8106419270833324 1.999877931550145 0.3281027189131851 +0.815975097656249 1.999877931550145 0.4810471935411165 +0.8213082682291656 1.999877931550145 0.620520779758383 +0.8266414388020824 1.999877931550145 0.7425867099868594 +0.8319746093749989 1.999877931550145 0.8438835803526496 +0.8373077799479155 1.999877931550145 0.9215144560739517 +0.8426409505208323 1.999877931550145 0.9733624485597751 +0.8479741210937489 1.999877931550145 0.9979344316220681 +0.8533072916666654 1.999877931550145 0.9945523131218613 +0.8586404622395822 1.999877931550145 0.9633076457935294 +0.8639736328124988 1.999877931550145 0.9051070164205303 +0.8693068033854153 1.999877931550145 0.8215395742054367 +0.8746399739583321 1.999877931550145 0.7149789848217795 +0.8799731445312487 1.999877931550145 0.5883571709096317 +0.8853063151041653 1.999877931550145 0.4452945485655028 +0.890639485677082 1.999877931550145 0.2897345907877371 +0.8959726562499986 1.999877931550145 0.1260651234061148 +0.9013058268229152 1.999877931550145 -0.04110346414241525 +0.9066389973958319 1.999877931550145 -0.2071347351229272 +0.9119721679687485 1.999877931550145 -0.3673877825203467 +0.9173053385416651 1.999877931550145 -0.517346004772175 +0.9226385091145819 1.999877931550145 -0.6527979760971613 +0.9279716796874984 1.999877931550145 -0.7699855641057849 +0.933304850260415 1.999877931550145 -0.865608400080399 +0.9386380208333318 1.999877931550145 -0.9369548898480252 +0.9439711914062483 1.999877931550145 -0.9820912502864228 +0.9493043619791649 1.999877931550145 -0.9997052255362167 +0.9546375325520815 1.999877931550145 -0.9893345816453859 +0.9599707031249983 1.999877931550145 -0.9512517416769819 +0.9653038736979148 1.999877931550145 -0.8865203505852335 +0.9706370442708314 1.999877931550145 -0.796938710339443 +0.9759702148437482 1.999877931550145 -0.6850658272219636 +0.9813033854166648 1.999877931550145 -0.553981741483347 +0.9866365559895813 1.999877931550145 -0.4074073625147701 +0.9919697265624981 1.999877931550145 -0.2493992930667849 +0.9973028971354147 1.999877931550145 -0.08441309954564256 +0.9999389657750726 1.999877931550145 0.0828842637356076 diff --git a/tests/circuitpython/synthlfo_rate.py b/tests/circuitpython/synthlfo_rate.py new file mode 100644 index 0000000000..54269b165c --- /dev/null +++ b/tests/circuitpython/synthlfo_rate.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +lfo_test("rate") diff --git a/tests/circuitpython/synthlfo_rate.py.exp b/tests/circuitpython/synthlfo_rate.py.exp new file mode 100644 index 0000000000..7ccc08c43a --- /dev/null +++ b/tests/circuitpython/synthlfo_rate.py.exp @@ -0,0 +1,188 @@ +0.005333170572916667 0.01599951171875 0.0005359211444854738 +0.01066634114583333 0.0319990234375 0.001607763433456421 +0.01599951171875 0.04799853515625 0.003215526866912843 +0.02133268229166667 0.06399804687500001 0.005359211444854736 +0.02666585286458333 0.07999755859375001 0.008038817167282106 +0.0319990234375 0.0959970703125 0.01125434403419495 +0.03733219401041667 0.11199658203125 0.01500579204559326 +0.04266536458333333 0.12799609375 0.01929316120147706 +0.04799853515625001 0.14399560546875 0.02411645150184631 +0.05333170572916668 0.1599951171875 0.02947566294670105 +0.05866487630208335 0.17599462890625 0.03537079553604126 +0.06399804687500001 0.1919941406250001 0.04180184926986694 +0.06933121744791668 0.2079936523437501 0.04874871129989625 +0.07466438802083333 0.2239931640625001 0.05624120259284975 +0.07999755859375001 0.2399926757812501 0.06427563095092774 +0.08533072916666667 0.2559921875000001 0.07282537002563477 +0.09066389973958334 0.2719916992187501 0.08190946779251099 +0.09599707031249999 0.2879912109375002 0.09152792425155642 +0.1013302408854166 0.3039907226562502 0.101680739402771 +0.1066634114583333 0.3199902343750002 0.1123449740409852 +0.11199658203125 0.3359897460937502 0.1235084619522095 +0.1173297526041666 0.3519892578125002 0.1351956052780152 +0.1226629231770833 0.3679887695312502 0.1474099916458131 +0.12799609375 0.3839882812500002 0.1601221036911011 +0.1333292643229167 0.3999877929687503 0.1733443713188172 +0.1386624348958333 0.4159873046875003 0.1870455803394318 +0.1439956054687499 0.4319868164062503 0.2012515609741212 +0.1493287760416666 0.4479863281250003 0.2159271082878114 +0.1546619466145833 0.4639858398437503 0.2310980525016785 +0.1599951171874999 0.4799853515625003 0.2467045526504518 +0.1653282877604166 0.4959848632812504 0.2627732749938966 +0.1706614583333333 0.5119843750000004 0.2792902519226075 +0.1759946289062499 0.5279838867187504 0.2962317531585695 +0.1813277994791666 0.5439833984375003 0.3135974402427675 +0.1866609700520833 0.5599829101562504 0.3313484210968018 +0.1919941406249999 0.5759824218750004 0.3495028429985048 +0.1973273111979166 0.5919819335937504 0.3680298004150391 +0.2026604817708332 0.6079814453125004 0.3868823050975801 +0.2079936523437499 0.6239809570312504 0.4060828037261964 +0.2133268229166666 0.6399804687500005 0.4255867166519167 +0.2186599934895832 0.6559799804687505 0.4453749857902529 +0.2239931640624999 0.6719794921875005 0.4654109336853029 +0.2293263346354165 0.6879790039062506 0.4856908130645754 +0.2346595052083332 0.7039785156250005 0.5061703529357913 +0.2399926757812499 0.7199780273437505 0.526830803871155 +0.2453258463541665 0.7359775390625005 0.5476323281288149 +0.2506590169270832 0.7519770507812505 0.5685354618072511 +0.2559921874999999 0.7679765625000005 0.5895078556060794 +0.2613253580729165 0.7839760742187506 0.610535811185837 +0.2666585286458333 0.7999755859375006 0.6315292382240298 +0.2719916992187499 0.8159750976562506 0.6524982434272768 +0.2773248697916666 0.8319746093750007 0.6733724214553836 +0.2826580403645833 0.8479741210937506 0.6940973254203797 +0.2879912109375 0.8639736328125005 0.7146625905036927 +0.2933243815104167 0.8799731445312506 0.7349555463790893 +0.2986575520833334 0.8959726562500007 0.7549765506744386 +0.3039907226562501 0.9119721679687506 0.7746560891628266 +0.3093238932291668 0.9279716796875007 0.7939425514221191 +0.3146570638020835 0.9439711914062507 0.8127821922302246 +0.3199902343750002 0.9599707031250007 0.8310877380371092 +0.3253234049479168 0.9759702148437508 0.8488329054832459 +0.3306565755208335 0.9919697265625008 0.8659471261024475 +0.3359897460937503 1.007969238281251 0.8823176284790039 +0.3413229166666669 1.023968750000001 0.8979310684204101 +0.3466560872395836 1.039968261718751 0.9127359642982483 +0.3519892578125003 1.055967773437501 0.9266164445400239 +0.357322428385417 1.071967285156251 0.9394941648483277 +0.3626555989583337 1.087966796875001 0.9513732780456545 +0.3679887695312503 1.103966308593751 0.9620836577415467 +0.3733219401041671 1.119965820312501 0.9716567802429202 +0.3786551106770837 1.135965332031251 0.9799323863983156 +0.3839882812500004 1.151964843750001 0.9868842210769655 +0.3893214518229172 1.167964355468751 0.9924245046138765 +0.3946546223958338 1.183963867187501 0.9965223062038422 +0.3999877929687505 1.199963378906251 0.9990432357788086 +0.4053209635416672 1.215962890625001 0.9999576799392699 +0.4106541341145839 1.231962402343751 0.9991764253616333 +0.4159873046875006 1.247961914062501 0.9966722283840179 +0.4213204752604173 1.263961425781251 0.9923318614959715 +0.426653645833334 1.279960937500001 0.9861583995819089 +0.4319868164062506 1.295960449218751 0.9780215210437772 +0.4373199869791674 1.311959960937501 0.9679302793979641 +0.4426531575520841 1.327959472656251 0.9558028239250181 +0.4479863281250007 1.343958984375001 0.9416040492057796 +0.4533194986979174 1.359958496093751 0.9253174390792843 +0.4586526692708341 1.375958007812501 0.9068358436584468 +0.4639858398437508 1.391957519531251 0.8862287553787226 +0.4693190104166675 1.407957031250001 0.8633790241241449 +0.4746521809895841 1.423956542968751 0.838337660789489 +0.4799853515625009 1.439956054687501 0.8110803127288813 +0.4853185221354176 1.455955566406251 0.7815831980705253 +0.4906516927083342 1.471955078125001 0.7498737560272208 +0.495984863281251 1.487954589843751 0.7159841267585745 +0.5013180338541677 1.503954101562501 0.6799054906368247 +0.5066512044270842 1.519953613281251 0.641685115814208 +0.5119843750000009 1.535953125000001 0.6013763595581044 +0.5173175455729176 1.551952636718751 0.5590313894748677 +0.5226507161458342 1.567952148437501 0.5147318117618552 +0.5279838867187508 1.583951660156251 0.4685239028930655 +0.5333170572916675 1.599951171875001 0.4205106806755056 +0.5386502278645841 1.615950683593751 0.3707897278785696 +0.5439833984375007 1.631950195312501 0.3194791543960562 +0.5493165690104174 1.647949707031251 0.2666798967361439 +0.554649739583334 1.663949218750001 0.2125530385971059 +0.5599829101562506 1.679948730468751 0.1572374179363243 +0.5653160807291673 1.695948242187501 0.1009079602241508 +0.5706492513020839 1.711947753906251 0.04370106258392271 +0.5759824218750005 1.727947265625001 -0.0141730673789986 +0.5813155924479172 1.743946777343751 -0.07252943181991649 +0.5866487630208338 1.759946289062501 -0.1311827611923228 +0.5919819335937504 1.775945800781251 -0.1899132472991953 +0.597315104166667 1.791945312500001 -0.2484922042846694 +0.6026482747395837 1.807944824218751 -0.3066866287708292 +0.6079814453125003 1.823944335937501 -0.3642530059814467 +0.6133146158854169 1.839943847656252 -0.4209442992210398 +0.6186477864583336 1.855943359375001 -0.476507924175264 +0.6239809570312502 1.871942871093751 -0.5306713529109969 +0.6293141276041668 1.887942382812501 -0.5831926224708571 +0.6346472981770836 1.903941894531251 -0.6337927379608167 +0.6399804687500001 1.919941406250001 -0.6822163305282607 +0.6453136393229167 1.935940917968751 -0.728188266706468 +0.6506468098958333 1.951940429687502 -0.7714168461322794 +0.6559799804687501 1.967939941406252 -0.8116716575622569 +0.6613131510416666 1.983939453125002 -0.8486754179000865 +0.6666463216145832 1.999877931550145 -0.8821773529345601 +0.6719794921875 1.999877931550145 -0.9117239237348265 +0.6773126627604166 1.999877931550145 -0.9371762991611837 +0.6826458333333331 1.999877931550145 -0.9584190011730247 +0.6879790039062499 1.999877931550145 -0.9753641129231257 +0.6933121744791665 1.999877931550145 -0.9879348278613181 +0.698645345052083 1.999877931550145 -0.996067500153913 +0.7039785156249997 1.999877931550145 -0.9997211575639085 +0.7093116861979164 1.999877931550145 -0.9988967895245878 +0.714644856770833 1.999877931550145 -0.9935671567225654 +0.7199780273437496 1.999877931550145 -0.9838083981207092 +0.7253111979166663 1.999877931550145 -0.9696048257901566 +0.7306443684895829 1.999877931550145 -0.9510738370343461 +0.7359775390624995 1.999877931550145 -0.9282358523949373 +0.7413107096354162 1.999877931550145 -0.9012530322805109 +0.7466438802083328 1.999877931550145 -0.8702429528057113 +0.7519770507812495 1.999877931550145 -0.8352882379440423 +0.757310221354166 1.999877931550145 -0.7965986006667672 +0.7626433919270827 1.999877931550145 -0.7543339244661195 +0.7679765624999994 1.999877931550145 -0.7086859455841491 +0.773309733072916 1.999877931550145 -0.6598651399255703 +0.7786429036458326 1.999877931550145 -0.6080582250160679 +0.7839760742187493 1.999877931550145 -0.5535281884667733 +0.7893092447916659 1.999877931550145 -0.49652716983401 +0.7946424153645825 1.999877931550145 -0.4372966752351231 +0.7999755859374992 1.999877931550145 -0.3760827764730514 +0.8053087565104157 1.999877931550145 -0.3131953700267354 +0.8106419270833324 1.999877931550145 -0.2488907320279421 +0.815975097656249 1.999877931550145 -0.1834746819839012 +0.8213082682291656 1.999877931550145 -0.1172516327424122 +0.8266414388020824 1.999877931550145 -0.05047249601157423 +0.8319746093749989 1.999877931550145 0.01649044951772869 +0.8373077799479155 1.999877931550145 0.08338775840056392 +0.8426409505208323 1.999877931550145 0.1499326369270383 +0.8479741210937489 1.999877931550145 0.2158008835185647 +0.8533072916666654 1.999877931550145 0.2807064673987006 +0.8586404622395822 1.999877931550145 0.344349577209865 +0.8639736328124988 1.999877931550145 0.406449486995549 +0.8693068033854153 1.999877931550145 0.4667140982259265 +0.8746399739583321 1.999877931550145 0.5248871347692297 +0.8799731445312487 1.999877931550145 0.5807123204936913 +0.8853063151041653 1.999877931550145 0.6339115878399724 +0.890639485677082 1.999877931550145 0.6842878599725708 +0.8959726562499986 1.999877931550145 0.7315787930063353 +0.9013058268229152 1.999877931550145 0.7755785483002886 +0.9066389973958319 1.999877931550145 0.8161155597957965 +0.9119721679687485 1.999877931550145 0.852964665035868 +0.9173053385416651 1.999877931550145 0.8860178127040836 +0.9226385091145819 1.999877931550145 0.9150661480805852 +0.9279716796874984 1.999877931550145 0.9399922620061249 +0.933304850260415 1.999877931550145 0.9607174405235117 +0.9386380208333318 1.999877931550145 0.9771250374069487 +0.9439711914062483 1.999877931550145 0.9891752248055122 +0.9493043619791649 1.999877931550145 0.9967621925145064 +0.9546375325520815 1.999877931550145 0.9998656750325608 +0.9599707031249983 1.999877931550145 0.9984948633064052 +0.9653038736979148 1.999877931550145 0.9926089282553225 +0.9706370442708314 1.999877931550145 0.9823056095152431 +0.9759702148437482 1.999877931550145 0.9675677051744069 +0.9813033854166648 1.999877931550145 0.9484997260704413 +0.9866365559895813 1.999877931550145 0.9251813873903313 +0.9919697265624981 1.999877931550145 0.8976710660117543 +0.9973028971354147 1.999877931550145 0.8661878089496907 +0.9999389657750726 1.999877931550145 0.8307594276964677 diff --git a/tests/circuitpython/synthlfo_scale.py b/tests/circuitpython/synthlfo_scale.py new file mode 100644 index 0000000000..802ca03255 --- /dev/null +++ b/tests/circuitpython/synthlfo_scale.py @@ -0,0 +1,3 @@ +from synthblockhelper import * + +lfo_test("scale") diff --git a/tests/circuitpython/synthlfo_scale.py.exp b/tests/circuitpython/synthlfo_scale.py.exp new file mode 100644 index 0000000000..3a3b0b743b --- /dev/null +++ b/tests/circuitpython/synthlfo_scale.py.exp @@ -0,0 +1,188 @@ +0.005333170572916667 0.01599951171875 0.002667887330055236 +0.01066634114583333 0.0319990234375 0.01052213981747627 +0.01599951171875 0.04799853515625 0.02312185294926166 +0.02133268229166667 0.06399804687500001 0.03975073999166488 +0.02666585286458333 0.07999755859375001 0.05944642797112465 +0.0319990234375 0.0959970703125 0.08105026084184647 +0.03733219401041667 0.11199658203125 0.1032400133311749 +0.04266536458333333 0.12799609375 0.124609478354454 +0.04799853515625001 0.14399560546875 0.1437055752575398 +0.05333170572916668 0.1599951171875 0.1591113550961018 +0.05866487630208335 0.17599462890625 0.1695011747330427 +0.06399804687500001 0.1919941406250001 0.1737134485244751 +0.06933121744791668 0.2079936523437501 0.17078482696414 +0.07466438802083333 0.2239931640625001 0.1600312488973141 +0.07999755859375001 0.2399926757812501 0.1410528241842986 +0.08533072916666667 0.2559921875000001 0.1138168389797211 +0.09066389973958334 0.2719916992187501 0.07860599949955943 +0.09599707031249999 0.2879912109375002 0.0360867893099785 +0.1013302408854166 0.3039907226562502 -0.01272812718153 +0.1066634114583333 0.3199902343750002 -0.06652140736579899 +0.11199658203125 0.3359897460937502 -0.1236788426935671 +0.1173297526041666 0.3519892578125002 -0.1823323261141776 +0.1226629231770833 0.3679887695312502 -0.2404369981586931 +0.12799609375 0.3839882812500002 -0.2958542522192 +0.1333292643229167 0.3999877929687503 -0.3463883545249699 +0.1386624348958333 0.4159873046875003 -0.3898738438189029 +0.1439956054687499 0.4319868164062503 -0.4243141990005971 +0.1493287760416666 0.4479863281250003 -0.4478632850050928 +0.1546619466145833 0.4639858398437503 -0.4589874572306877 +0.1599951171874999 0.4799853515625003 -0.4564753268659122 +0.1653282877604166 0.4959848632812504 -0.43952662536502 +0.1706614583333333 0.5119843750000004 -0.4077844300270094 +0.1759946289062499 0.5279838867187504 -0.3614098687469975 +0.1813277994791666 0.5439833984375003 -0.3010103448629402 +0.1866609700520833 0.5599829101562504 -0.2277493970841195 +0.1919941406249999 0.5759824218750004 -0.1432221915721921 +0.1973273111979166 0.5919819335937504 -0.04951850830018875 +0.2026604817708332 0.6079814453125004 0.05085684636234935 +0.2079936523437499 0.6239809570312504 0.1551573742032022 +0.2133268229166666 0.6399804687500005 0.2602850252389881 +0.2186599934895832 0.6559799804687505 0.362983062922952 +0.2239931640624999 0.6719794921875005 0.4599761965870836 +0.2293263346354165 0.6879790039062506 0.5479603278487905 +0.2346595052083332 0.7039785156250005 0.6238442424535738 +0.2399926757812499 0.7199780273437505 0.6847129902988664 +0.2453258463541665 0.7359775390625005 0.7280490700900554 +0.2506590169270832 0.7519770507812505 0.7517705141156918 +0.2559921874999999 0.7679765625000005 0.7543363537788403 +0.2613253580729165 0.7839760742187506 0.7347622441202421 +0.2666585286458333 0.7999755859375006 0.6927767090499426 +0.2719916992187499 0.8159750976562506 0.6286902859658035 +0.2773248697916666 0.8319746093750007 0.5435966914892233 +0.2826580403645833 0.8479741210937506 0.4392551492750681 +0.2879912109375 0.8639736328125005 0.3180313097834627 +0.2933243815104167 0.8799731445312506 0.1829338702559513 +0.2986575520833334 0.8959726562500007 0.03751448011398744 +0.3039907226562501 0.9119721679687506 -0.1142748328149277 +0.3093238932291668 0.9279716796875007 -0.2681851747631981 +0.3146570638020835 0.9439711914062507 -0.4196995937377172 +0.3199902343750002 0.9599707031250007 -0.5642112967371899 +0.3253234049479168 0.9759702148437508 -0.6972790130525793 +0.3306565755208335 0.9919697265625008 -0.8145122516751259 +0.3359897460937503 1.007969238281251 -0.911995604753492 +0.3413229166666669 1.023968750000001 -0.9861886529922474 +0.3466560872395836 1.039968261718751 -1.034223808124661 +0.3519892578125003 1.055967773437501 -1.053840885221959 +0.357322428385417 1.071967285156251 -1.043604381218555 +0.3626555989583337 1.087966796875001 -1.002902986645702 +0.3679887695312503 1.103966308593751 -0.93207799968124 +0.3733219401041671 1.119965820312501 -0.8322499915957518 +0.3786551106770837 1.135965332031251 -0.7055756348520607 +0.3839882812500004 1.151964843750001 -0.5549244707822899 +0.3893214518229172 1.167964355468751 -0.3840581033378947 +0.3946546223958338 1.183963867187501 -0.1974236624241001 +0.3999877929687505 1.199963378906251 -1.285182707021075e-14 +0.4053209635416672 1.215962890625001 0.202759437084186 +0.4106541341145839 1.231962402343751 0.405102382972825 +0.4159873046875006 1.247961914062501 0.6011681766807927 +0.4213204752604173 1.263961425781251 0.7850771148353719 +0.426653645833334 1.279960937500001 0.9511428475379864 +0.4319868164062506 1.295960449218751 1.094178521364921 +0.4373199869791674 1.311959960937501 1.209383013308044 +0.4426531575520841 1.327959472656251 1.292823337927459 +0.4479863281250007 1.343958984375001 1.341252035737038 +0.4533194986979174 1.359958496093751 1.352446518316867 +0.4586526692708341 1.375958007812501 1.325191002458339 +0.4639858398437508 1.391957519531251 1.259422501802451 +0.4693190104166675 1.407957031250001 1.156081905603418 +0.4746521809895841 1.423956542968751 1.017341510847222 +0.4799853515625009 1.439956054687501 0.8463169451058034 +0.4853185221354176 1.455955566406251 0.6473332716971768 +0.4906516927083342 1.471955078125001 0.425397173762336 +0.495984863281251 1.487954589843751 0.1864484114349039 +0.5013180338541677 1.503954101562501 -0.06297073447702799 +0.5066512044270842 1.519953613281251 -0.3159766849875294 +0.5119843750000009 1.535953125000001 -0.5653889951705783 +0.5173175455729176 1.551952636718751 -0.8039198015034055 +0.5226507161458342 1.567952148437501 -1.024470687806594 +0.5279838867187508 1.583951660156251 -1.220398790404189 +0.5333170572916675 1.599951171875001 -1.385553418099871 +0.5386502278645841 1.615950683593751 -1.51450993175804 +0.5439833984375007 1.631950195312501 -1.60296475178003 +0.5493165690104174 1.647949707031251 -1.647497084125877 +0.554649739583334 1.663949218750001 -1.646023984551434 +0.5599829101562506 1.679948730468751 -1.597663644030698 +0.5653160807291673 1.695948242187501 -1.502897493183625 +0.5706492513020839 1.711947753906251 -1.363529187902824 +0.5759824218750005 1.727947265625001 -1.182795934081097 +0.5813155924479172 1.743946777343751 -0.9650037526488536 +0.5866487630208338 1.759946289062501 -0.71578381940725 +0.5919819335937504 1.775945800781251 -0.4416017573476108 +0.597315104166667 1.791945312500001 -0.1498938629627505 +0.6026482747395837 1.807944824218751 0.1512322010248609 +0.6079814453125003 1.823944335937501 0.4535369399785713 +0.6133146158854169 1.839943847656252 0.7483194475620717 +0.6186477864583336 1.855943359375001 1.026976470708822 +0.6239809570312502 1.871942871093751 1.281362261921146 +0.6293141276041668 1.887942382812501 1.503705085724575 +0.6346472981770836 1.903941894531251 1.687215110272156 +0.6399804687500001 1.919941406250001 1.825901307463638 +0.6453136393229167 1.935940917968751 1.915085597410795 +0.6506468098958333 1.951940429687502 1.951404313236477 +0.6559799804687501 1.967939941406252 1.932986906558282 +0.6613131510416666 1.983939453125002 1.859398332059396 +0.6666463216145832 1.999877931550145 1.731888917956512 +0.6719794921875 1.999877931550145 1.540860538874731 +0.6773126627604166 1.999877931550145 1.306682938064252 +0.6826458333333331 1.999877931550145 1.035947510074861 +0.6879790039062499 1.999877931550145 0.7361611209215951 +0.6933121744791665 1.999877931550145 0.4157461080847357 +0.698645345052083 1.999877931550145 0.08373512335473171 +0.7039785156249997 1.999877931550145 -0.2505950557539017 +0.7093116861979164 1.999877931550145 -0.57796765172665 +0.714644856770833 1.999877931550145 -0.8891669184800135 +0.7199780273437496 1.999877931550145 -1.175404329947612 +0.7253111979166663 1.999877931550145 -1.42880683152831 +0.7306443684895829 1.999877931550145 -1.642111682931139 +0.7359775390624995 1.999877931550145 -1.809459866778509 +0.7413107096354162 1.999877931550145 -1.926090931451133 +0.7466438802083328 1.999877931550145 -1.988831242536147 +0.7519770507812495 1.999877931550145 -1.995849857103055 +0.757310221354166 1.999877931550145 -1.946963680858809 +0.7626433919270827 1.999877931550145 -1.843515405285772 +0.7679765624999994 1.999877931550145 -1.688495570503754 +0.773309733072916 1.999877931550145 -1.486115345252897 +0.7786429036458326 1.999877931550145 -1.242172715479771 +0.7839760742187493 1.999877931550145 -0.9633811385961975 +0.7893092447916659 1.999877931550145 -0.6576136692033123 +0.7946424153645825 1.999877931550145 -0.3334757390744438 +0.7999755859374992 1.999877931550145 -4.28381162119136e-14 +0.8053087565104157 1.999877931550145 0.3334757390743597 +0.8106419270833324 1.999877931550145 0.6576136692032318 +0.815975097656249 1.999877931550145 0.9633811385961248 +0.8213082682291656 1.999877931550145 1.242172715479706 +0.8266414388020824 1.999877931550145 1.486115345252841 +0.8319746093749989 1.999877931550145 1.68849557050371 +0.8373077799479155 1.999877931550145 1.84351540528574 +0.8426409505208323 1.999877931550145 1.946963680858791 +0.8479741210937489 1.999877931550145 1.995849857103051 +0.8533072916666654 1.999877931550145 1.988831242536155 +0.8586404622395822 1.999877931550145 1.926090931451154 +0.8639736328124988 1.999877931550145 1.809459866778543 +0.8693068033854153 1.999877931550145 1.642111682931183 +0.8746399739583321 1.999877931550145 1.428806831528363 +0.8799731445312487 1.999877931550145 1.175404329947673 +0.8853063151041653 1.999877931550145 0.8891669184800811 +0.890639485677082 1.999877931550145 0.5779676517267206 +0.8959726562499986 1.999877931550145 0.2505950557539749 +0.9013058268229152 1.999877931550145 -0.08373512335465684 +0.9066389973958319 1.999877931550145 -0.4157461080846623 +0.9119721679687485 1.999877931550145 -0.7361611209215242 +0.9173053385416651 1.999877931550145 -1.035947510074796 +0.9226385091145819 1.999877931550145 -1.306682938064193 +0.9279716796874984 1.999877931550145 -1.540860538874681 +0.933304850260415 1.999877931550145 -1.731888917956473 +0.9386380208333318 1.999877931550145 -1.874336277949095 +0.9439711914062483 1.999877931550145 -1.964357638698507 +0.9493043619791649 1.999877931550145 -1.999328648670995 +0.9546375325520815 1.999877931550145 -1.978333836401312 +0.9599707031249983 1.999877931550145 -1.901922484768606 +0.9653038736979148 1.999877931550145 -1.772230693858455 +0.9706370442708314 1.999877931550145 -1.592859318100838 +0.9759702148437482 1.999877931550145 -1.368934997701141 +0.9813033854166648 1.999877931550145 -1.106621907192037 +0.9866365559895813 1.999877931550145 -0.8133658811575424 +0.9919697265624981 1.999877931550145 -0.497284099922859 +0.9973028971354147 1.999877931550145 -0.1672871524164043 +0.9999389657750726 1.999877931550145 0.1672871524162952 diff --git a/tests/testlib/synthblockhelper.py b/tests/testlib/synthblockhelper.py index d1b616f713..255ffcf35d 100644 --- a/tests/testlib/synthblockhelper.py +++ b/tests/testlib/synthblockhelper.py @@ -23,7 +23,9 @@ def mathop_test(kind): def lfo_test(sweep_input_name, **inputs): - sweep = LFO(sweep, rate=1, scale=2) + inputs.setdefault("rate", 5) + t = LFO(bend_out, rate=1, once=True) + v = LFO(bend_out, rate=1.5, scale=2, once=True) test = LFO(sine, **inputs) - setattr(test, sweep_input_name, sweep) - print_result(sweep, test) + setattr(test, sweep_input_name, v) + print_result(t, v, test) From 8626130af72778b33e5119881d90f5b76a556fa7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 22 May 2023 10:53:29 -0500 Subject: [PATCH 1120/1712] synthio: Add default triangle waveform to LFO, improve docs --- shared-bindings/synthio/LFO.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/shared-bindings/synthio/LFO.c b/shared-bindings/synthio/LFO.c index ac817b93b6..2c34d30764 100644 --- a/shared-bindings/synthio/LFO.c +++ b/shared-bindings/synthio/LFO.c @@ -33,13 +33,17 @@ #include "shared-bindings/synthio/LFO.h" #include "shared-module/synthio/LFO.h" +STATIC const uint16_t triangle[] = {0, 32767, 0, -32767}; + //| class LFO: //| """A low-frequency oscillator block //| //| Every `rate` seconds, the output of the LFO cycles through its `waveform`. //| The output at any particular moment is ``waveform[idx] * scale + offset``. //| -//| `rate`, `offset`, `scale`, and `once` can be changed at run-time. `waveform` may be mutated. +//| If `waveform` is None, a triangle waveform is used. +//| +//| `rate`, `phase_offset`, `offset`, `scale`, and `once` can be changed at run-time. `waveform` may be mutated. //| //| `waveform` must be a ``ReadableBuffer`` with elements of type ``'h'`` //| (16-bit signed integer). Internally, the elements of `waveform` are scaled @@ -58,18 +62,18 @@ //| //| def __init__( //| self, -//| waveform: ReadableBuffer, +//| waveform: ReadableBuffer = None, //| *, //| rate: BlockInput = 1.0, //| scale: BlockInput = 1.0, -//| offset: BlockInput = 0, -//| phase_offset: BlockInput = 0, +//| offset: BlockInput = 0.0, +//| phase_offset: BlockInput = 0.0, //| once=False, //| interpolate=True //| ): //| pass static const mp_arg_t lfo_properties[] = { - { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = NULL } }, + { MP_QSTR_waveform, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE } }, { MP_QSTR_rate, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, { MP_QSTR_scale, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, { MP_QSTR_offset, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } }, @@ -87,7 +91,10 @@ STATIC mp_obj_t synthio_lfo_make_new(const mp_obj_type_t *type_in, size_t n_args synthio_lfo_obj_t *self = m_new_obj(synthio_lfo_obj_t); self->base.base.type = &synthio_lfo_type; - synthio_synth_parse_waveform(&self->waveform_bufinfo, args[ARG_waveform].u_obj); + self->waveform_bufinfo = ((mp_buffer_info_t) {.buf = triangle, .len = MP_ARRAY_SIZE(triangle)}); + if (args[ARG_waveform].u_obj != mp_const_none) { + synthio_synth_parse_waveform(&self->waveform_bufinfo, args[ARG_waveform].u_obj); + } self->waveform_obj = args[ARG_waveform].u_obj; self->base.last_tick = synthio_global_tick; From 7048ce46b1f59c841634e5fbca2066ed20486a26 Mon Sep 17 00:00:00 2001 From: David Sullivan Date: Mon, 22 May 2023 10:06:50 -0700 Subject: [PATCH 1121/1712] match pins to what wemos uses --- ports/espressif/boards/lolin_c3_pico/pins.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/espressif/boards/lolin_c3_pico/pins.c b/ports/espressif/boards/lolin_c3_pico/pins.c index d36c9f9b14..33a9432748 100644 --- a/ports/espressif/boards/lolin_c3_pico/pins.c +++ b/ports/espressif/boards/lolin_c3_pico/pins.c @@ -15,20 +15,20 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, From a5df186fa71b1138462f2b79d28fa30b7ce74868 Mon Sep 17 00:00:00 2001 From: David Sullivan Date: Mon, 22 May 2023 13:30:36 -0700 Subject: [PATCH 1122/1712] change copyright notice --- ports/espressif/boards/lolin_c3_pico/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/lolin_c3_pico/board.c b/ports/espressif/boards/lolin_c3_pico/board.c index 164430c88c..00ae21ace8 100644 --- a/ports/espressif/boards/lolin_c3_pico/board.c +++ b/ports/espressif/boards/lolin_c3_pico/board.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2023 David Sullivan * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal From a163273ee0091cdf9f8ce5c5c2b1be4e5c09a86c Mon Sep 17 00:00:00 2001 From: David Sullivan <311316+tkroo@users.noreply.github.com> Date: Mon, 22 May 2023 19:00:16 -0700 Subject: [PATCH 1123/1712] Update ports/espressif/boards/lolin_c3_pico/mpconfigboard.h update board I2C pins. Co-authored-by: Dan Halbert --- ports/espressif/boards/lolin_c3_pico/mpconfigboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h index f5830f01c7..b553186052 100644 --- a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h +++ b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h @@ -37,7 +37,7 @@ #define MICROPY_HW_NEOPIXEL (&pin_GPIO7) #define CIRCUITPY_BOARD_I2C (1) -#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO6, .sda = &pin_GPIO5}} +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO10, .sda = &pin_GPIO8}} #define CIRCUITPY_BOARD_SPI (1) #define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO10, .mosi = &pin_GPIO7, .miso = &pin_GPIO8}} From 167aa30f12126869ca9e0fb57d880722e1ebaeb4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 22 May 2023 21:50:52 -0500 Subject: [PATCH 1124/1712] synthio: remove if0'd code thanks tannewt --- shared-bindings/synthio/LFO.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/shared-bindings/synthio/LFO.c b/shared-bindings/synthio/LFO.c index 2c34d30764..805d8d701e 100644 --- a/shared-bindings/synthio/LFO.c +++ b/shared-bindings/synthio/LFO.c @@ -303,13 +303,3 @@ const mp_obj_type_t synthio_lfo_type = { .protocol = &lfo_proto, ), }; - -#if 0 -const mp_obj_type_t synthio_math_type = { - { &mp_type_type }, - .name = MP_QSTR_Math, - .make_new = synthio_math_make_new, - .locals_dict = (mp_obj_dict_t *)&synthio_math_locals_dict, - .print = math_print, -}; -#endif From 5b4d621fd29150d68c9bc70d15a13fd7dc12abff Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 22 May 2023 21:52:44 -0500 Subject: [PATCH 1125/1712] synthio: explicitly cast away const to satisfy compiler --- shared-bindings/synthio/LFO.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/synthio/LFO.c b/shared-bindings/synthio/LFO.c index 805d8d701e..00be16a15c 100644 --- a/shared-bindings/synthio/LFO.c +++ b/shared-bindings/synthio/LFO.c @@ -91,7 +91,7 @@ STATIC mp_obj_t synthio_lfo_make_new(const mp_obj_type_t *type_in, size_t n_args synthio_lfo_obj_t *self = m_new_obj(synthio_lfo_obj_t); self->base.base.type = &synthio_lfo_type; - self->waveform_bufinfo = ((mp_buffer_info_t) {.buf = triangle, .len = MP_ARRAY_SIZE(triangle)}); + self->waveform_bufinfo = ((mp_buffer_info_t) {.buf = (void *)triangle, .len = MP_ARRAY_SIZE(triangle)}); if (args[ARG_waveform].u_obj != mp_const_none) { synthio_synth_parse_waveform(&self->waveform_bufinfo, args[ARG_waveform].u_obj); } From 1b174f8b3de22420dac5a1555faaee4463fa3def Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 22 May 2023 21:52:57 -0500 Subject: [PATCH 1126/1712] synthio: remove "1-octave" caveat, is false now --- shared-bindings/synthio/Note.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index 4a90531c21..7f1d8ba4cf 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -165,7 +165,7 @@ MP_PROPERTY_GETSET(synthio_note_amplitude_obj, //| //| A depth of 0 plays the programmed frequency. A depth of 1 corresponds to a bend of 1 //| octave. A depth of (1/12) = 0.833 corresponds to a bend of 1 semitone, -//| and a depth of .00833 corresponds to one musical cent. Values of ±1 octave are supported. +//| and a depth of .00833 corresponds to one musical cent. //| //| To achieve a vibrato or sweep effect, attach an LFO here. //| """ @@ -248,7 +248,7 @@ MP_PROPERTY_GETSET(synthio_note_ring_frequency_obj, //| //| A depth of 0 plays the programmed frequency. A depth of 1 corresponds to a bend of 1 //| octave. A depth of (1/12) = 0.833 corresponds to a bend of 1 semitone, -//| and a depth of .00833 corresponds to one musical cent. Values of ±1 octave are supported. +//| and a depth of .00833 corresponds to one musical cent. //| //| To achieve a vibrato or sweep effect on the ring waveform, attach an LFO here. //| """ From af40a173ba5ae174a0c8560ecab880a4e030c6c9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 22 May 2023 21:57:54 -0500 Subject: [PATCH 1127/1712] synthio: midi_to_hz: remove arbitrary note number limitation The underlying routine can return numbers for higher and lower octaves. Other bits of the code might have frequency limitations but that doesn't mean we shouldn't let someone get a ~4Hz "note" by sending in (-12), because that's actually totally plausible as an LFO frequency. --- shared-bindings/synthio/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index f3ba3e73a9..e1dfc111f9 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -276,7 +276,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(synthio_from_file_obj, 1, synthio_from_file); //| STATIC mp_obj_t midi_to_hz(mp_obj_t arg) { - mp_float_t note = mp_arg_validate_obj_float_range(arg, 0, 127, MP_QSTR_note); + mp_float_t note = mp_arg_validate_type_float(arg, MP_QSTR_note); return mp_obj_new_float(common_hal_synthio_midi_to_hz_float(note)); } MP_DEFINE_CONST_FUN_OBJ_1(synthio_midi_to_hz_obj, midi_to_hz); From 122e00bdb3c7a11ef8e9f81c6133a80a99f54267 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 22 May 2023 21:59:27 -0500 Subject: [PATCH 1128/1712] document ring arguments to constructor thanks Mark! --- shared-bindings/synthio/Note.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index 7f1d8ba4cf..4ac5c94474 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -56,6 +56,9 @@ static const mp_arg_t note_properties[] = { //| envelope: Optional[Envelope] = None, //| amplitude: BlockInput = 0.0, //| bend: BlockInput = 0.0, +//| ring_frequency: float = 0.0, +//| ring_bend: float = 0.0, +//| ring_waveform: Optional[ReadableBuffer] = 0.0, //| ) -> None: //| """Construct a Note object, with a frequency in Hz, and optional panning, waveform, envelope, tremolo (volume change) and bend (frequency change). //| From 49b1368d65108309bd0a6756bfcd729f33fa4057 Mon Sep 17 00:00:00 2001 From: Christopher Hoover Date: Mon, 22 May 2023 20:06:50 -0700 Subject: [PATCH 1129/1712] Changed PID to 0x813C. --- ports/mimxrt10xx/boards/imxrt1060_evkb/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/mimxrt10xx/boards/imxrt1060_evkb/mpconfigboard.mk b/ports/mimxrt10xx/boards/imxrt1060_evkb/mpconfigboard.mk index c70865ebd6..78b0441e50 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evkb/mpconfigboard.mk +++ b/ports/mimxrt10xx/boards/imxrt1060_evkb/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x239A -USB_PID = 0x8084 +USB_PID = 0x813C USB_PRODUCT = "iMX RT 1060 EVKB" USB_MANUFACTURER = "NXP" From 2b42783301e9a4d7bc5173aefc6dd4deaf25ebd9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 23 May 2023 08:57:16 -0500 Subject: [PATCH 1130/1712] Apply suggestions from code review Co-authored-by: Dan Halbert --- shared-bindings/synthio/Note.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index 4ac5c94474..25abaca602 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -167,7 +167,7 @@ MP_PROPERTY_GETSET(synthio_note_amplitude_obj, //| """The pitch bend depth of the note, from -12 to +12 //| //| A depth of 0 plays the programmed frequency. A depth of 1 corresponds to a bend of 1 -//| octave. A depth of (1/12) = 0.833 corresponds to a bend of 1 semitone, +//| octave. A depth of (1/12) = 0.0833 corresponds to a bend of 1 semitone, //| and a depth of .00833 corresponds to one musical cent. //| //| To achieve a vibrato or sweep effect, attach an LFO here. @@ -250,7 +250,7 @@ MP_PROPERTY_GETSET(synthio_note_ring_frequency_obj, //| """The pitch bend depth of the note's ring waveform, from -12 to +12 //| //| A depth of 0 plays the programmed frequency. A depth of 1 corresponds to a bend of 1 -//| octave. A depth of (1/12) = 0.833 corresponds to a bend of 1 semitone, +//| octave. A depth of (1/12) = 0.0833 corresponds to a bend of 1 semitone, //| and a depth of .00833 corresponds to one musical cent. //| //| To achieve a vibrato or sweep effect on the ring waveform, attach an LFO here. From caf0e6d92407c30bd48c2bcf51c0664df7f876ad Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 23 May 2023 21:48:21 +0200 Subject: [PATCH 1131/1712] 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 | 20 ++++++++++++++------ locale/cs.po | 20 ++++++++++++++------ locale/de_DE.po | 28 +++++++++++++++++++++------- locale/el.po | 20 ++++++++++++++------ locale/en_GB.po | 28 +++++++++++++++++++++------- locale/es.po | 28 +++++++++++++++++++++------- locale/fil.po | 20 ++++++++++++++------ locale/fr.po | 28 +++++++++++++++++++++------- locale/hi.po | 20 ++++++++++++++------ locale/it_IT.po | 20 ++++++++++++++------ locale/ja.po | 20 ++++++++++++++------ locale/ko.po | 20 ++++++++++++++------ locale/nl.po | 28 +++++++++++++++++++++------- locale/pl.po | 20 ++++++++++++++------ locale/pt_BR.po | 28 +++++++++++++++++++++------- locale/ru.po | 24 ++++++++++++++++-------- locale/sv.po | 28 +++++++++++++++++++++------- locale/tr.po | 20 ++++++++++++++------ locale/zh_Latn_pinyin.po | 28 +++++++++++++++++++++------- 19 files changed, 324 insertions(+), 124 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index c9208d6149..0dd475a3c9 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -214,7 +214,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -2498,6 +2498,10 @@ msgstr "alamatnya kosong" msgid "annotation must be an identifier" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "arg berisi urutan kosong" @@ -2670,6 +2674,10 @@ msgstr "hanya mampu memiliki hingga 4 parameter untuk Thumb assembly" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "" @@ -2821,6 +2829,10 @@ msgstr "" msgid "cannot import name %q" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "" @@ -3270,10 +3282,6 @@ msgstr "" msgid "inline assembler must be a function" msgstr "inline assembler harus sebuah fungsi" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3988,7 +3996,7 @@ msgid "set unsupported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" +msgid "shape must be integer or tuple of integers" msgstr "" #: shared-module/msgpack/__init__.c diff --git a/locale/cs.po b/locale/cs.po index a3bee5475c..7ea09153a7 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -215,7 +215,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -2485,6 +2485,10 @@ msgstr "" msgid "annotation must be an identifier" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2657,6 +2661,10 @@ msgstr "" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "" @@ -2808,6 +2816,10 @@ msgstr "" msgid "cannot import name %q" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "" @@ -3257,10 +3269,6 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3974,7 +3982,7 @@ msgid "set unsupported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" +msgid "shape must be integer or tuple of integers" msgstr "" #: shared-module/msgpack/__init__.c diff --git a/locale/de_DE.po b/locale/de_DE.po index 697e08fd1a..90efb4b1e8 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -224,7 +224,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "%q muss von Typ %q oder %q sein, nicht %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q muss von Typ %q sein, nicht %q" @@ -2542,6 +2542,10 @@ msgstr "addresses ist leer" msgid "annotation must be an identifier" msgstr "Die Annotation muss ein Bezeichner sein" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "arg ist eine leere Sequenz" @@ -2714,6 +2718,10 @@ msgstr "kann nur bis zu 4 Parameter für die Thumb assembly haben" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "kann nur bis zu 4 Parameter für die Xtensa assembly haben" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "" @@ -2873,6 +2881,10 @@ msgstr "Kann Instanz nicht erstellen" msgid "cannot import name %q" msgstr "Name %q kann nicht importiert werden" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "Kann nicht eindeutig die Größe (sizeof) des Skalars ermitteln" @@ -3330,10 +3342,6 @@ msgstr "Länge von initial_value ist falsch" msgid "inline assembler must be a function" msgstr "inline assembler muss eine function sein" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "Eingabe- und Ausgabeformen sind nicht kompatibel" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "das Eingabeargument muss ein Integer, Tupel oder eine Liste sein" @@ -4059,8 +4067,8 @@ msgid "set unsupported" msgstr "nicht unterstützt" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" -msgstr "Form muss ein Tupel sein" +msgid "shape must be integer or tuple of integers" +msgstr "" #: shared-module/msgpack/__init__.c msgid "short read" @@ -4451,6 +4459,12 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "input and output shapes are not compatible" +#~ msgstr "Eingabe- und Ausgabeformen sind nicht kompatibel" + +#~ msgid "shape must be a tuple" +#~ msgstr "Form muss ein Tupel sein" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "Die Helligkeit muss zwischen 0 und 1.0 liegen" diff --git a/locale/el.po b/locale/el.po index 0b08a441cb..f320dd8d9f 100644 --- a/locale/el.po +++ b/locale/el.po @@ -226,7 +226,7 @@ msgstr "%q πρέπει να είναι λίστα τύπου 'h'" msgid "%q must be of type %q or %q, not %q" msgstr "%q πρέπει να είναι τύπου %q ή %q, όχι %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -2499,6 +2499,10 @@ msgstr "" msgid "annotation must be an identifier" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2671,6 +2675,10 @@ msgstr "" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "" @@ -2822,6 +2830,10 @@ msgstr "" msgid "cannot import name %q" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "" @@ -3271,10 +3283,6 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3988,7 +3996,7 @@ msgid "set unsupported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" +msgid "shape must be integer or tuple of integers" msgstr "" #: shared-module/msgpack/__init__.c diff --git a/locale/en_GB.po b/locale/en_GB.po index eb26c58d6c..1907efce29 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -224,7 +224,7 @@ msgstr "%q must be array of type 'h'" msgid "%q must be of type %q or %q, not %q" msgstr "%q must be of type %q or %q, not %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q must be of type %q, not %q" @@ -2508,6 +2508,10 @@ msgstr "addresses is empty" msgid "annotation must be an identifier" msgstr "annotation must be an identifier" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "arg is an empty sequence" @@ -2680,6 +2684,10 @@ msgstr "Can only have up to 4 parameters to thumb assembly" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "Can only have up to 4 parameters to xtensa assembly" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "Can't add special method to already-subclassed class" @@ -2833,6 +2841,10 @@ msgstr "can't create instance" msgid "cannot import name %q" msgstr "can't import name %q" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "cannot unambiguously get sizeof scalar" @@ -3285,10 +3297,6 @@ msgstr "initial_value length is wrong" msgid "inline assembler must be a function" msgstr "inline assembler must be a function" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "input and output shapes are not compatible" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "input argument must be an integer, a tuple, or a list" @@ -4002,8 +4010,8 @@ msgid "set unsupported" msgstr "set unsupported" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" -msgstr "shape must be a tuple" +msgid "shape must be integer or tuple of integers" +msgstr "" #: shared-module/msgpack/__init__.c msgid "short read" @@ -4392,6 +4400,12 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "input and output shapes are not compatible" +#~ msgstr "input and output shapes are not compatible" + +#~ msgid "shape must be a tuple" +#~ msgstr "shape must be a tuple" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "Brightness must be 0-1.0" diff --git a/locale/es.po b/locale/es.po index f59aa02672..8a40dab228 100644 --- a/locale/es.po +++ b/locale/es.po @@ -226,7 +226,7 @@ msgstr "%q debe ser una matriz de tipo 'h'" msgid "%q must be of type %q or %q, not %q" msgstr "%q debe ser del tipo %q o %q, y no %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q debe ser del tipo %q, y no %q" @@ -2551,6 +2551,10 @@ msgstr "addresses esta vacío" msgid "annotation must be an identifier" msgstr "la anotación debe ser un identificador" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "argumento es una secuencia vacía" @@ -2723,6 +2727,10 @@ msgstr "solo puede tener hasta 4 parámetros para ensamblar Thumb" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "solo puede tener hasta 4 parámetros para ensamblador Xtensa" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "no se puede agregar un método a una clase ya subclasificada" @@ -2879,6 +2887,10 @@ msgstr "no se puede crear instancia" msgid "cannot import name %q" msgstr "no se puede importar name '%q'" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "no se puede sin ambiguedades traer el sizeof del escalar" @@ -3332,10 +3344,6 @@ msgstr "el tamaño de initial_value es incorrecto" msgid "inline assembler must be a function" msgstr "ensamblador en línea debe ser una función" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "Formas de entrada y salida no son compatibles" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "argumento de entrada debe ser un entero, una tupla o una lista" @@ -4056,8 +4064,8 @@ msgid "set unsupported" msgstr "sin capacidades para el conjunto" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" -msgstr "forma tiene que ser una tupla" +msgid "shape must be integer or tuple of integers" +msgstr "" #: shared-module/msgpack/__init__.c msgid "short read" @@ -4447,6 +4455,12 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "input and output shapes are not compatible" +#~ msgstr "Formas de entrada y salida no son compatibles" + +#~ msgid "shape must be a tuple" +#~ msgstr "forma tiene que ser una tupla" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "El brillo debe ser 0-1.0" diff --git a/locale/fil.po b/locale/fil.po index 080eddf285..26d9ab4655 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -212,7 +212,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -2488,6 +2488,10 @@ msgstr "walang laman ang address" msgid "annotation must be an identifier" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "arg ay walang laman na sequence" @@ -2661,6 +2665,10 @@ msgstr "maaari lamang magkaroon ng hanggang 4 na parameter sa Thumb assembly" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "maaari lamang magkaroon ng hanggang 4 na parameter sa Xtensa assembly" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "" @@ -2818,6 +2826,10 @@ msgstr "hindi magawa ang instance" msgid "cannot import name %q" msgstr "hindi ma-import ang name %q" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "" @@ -3272,10 +3284,6 @@ msgstr "" msgid "inline assembler must be a function" msgstr "inline assembler ay dapat na function" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3995,7 +4003,7 @@ msgid "set unsupported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" +msgid "shape must be integer or tuple of integers" msgstr "" #: shared-module/msgpack/__init__.c diff --git a/locale/fr.po b/locale/fr.po index f56db9abeb..361952435c 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -226,7 +226,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "%q doit être de type %q ou %q, pas %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q doit être de type %q, pas %q" @@ -2563,6 +2563,10 @@ msgstr "adresses vides" msgid "annotation must be an identifier" msgstr "l'annotation doit être un identificateur" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "l'argument est une séquence vide" @@ -2735,6 +2739,10 @@ msgstr "il ne peut pas y avoir plus de 4 paramètres pour l'assemblage Thumb" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "il ne peut pas y avoir plus de 4 paramètres pour l'assemblage Xtensa" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "" @@ -2893,6 +2901,10 @@ msgstr "ne peut pas créer une instance" msgid "cannot import name %q" msgstr "ne peut pas importer le nom %q" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "ne peut récupérer sans ambigüité le sizeof d'un scalaire" @@ -3351,10 +3363,6 @@ msgstr "la longueur de initial_value est incorrecte" msgid "inline assembler must be a function" msgstr "l'assembleur doit être une fonction" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "les formes d'entrée et de sortie ne sont pas compatibles" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "Paramètre entrant doit être un chiffre entier, un tuple, ou une liste" @@ -4079,8 +4087,8 @@ msgid "set unsupported" msgstr "set non-supporté" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" -msgstr "forme doit être un tuple" +msgid "shape must be integer or tuple of integers" +msgstr "" #: shared-module/msgpack/__init__.c msgid "short read" @@ -4470,6 +4478,12 @@ 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 "input and output shapes are not compatible" +#~ msgstr "les formes d'entrée et de sortie ne sont pas compatibles" + +#~ msgid "shape must be a tuple" +#~ msgstr "forme doit être un tuple" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "La luminosité doit être de 0 à 1.0" diff --git a/locale/hi.po b/locale/hi.po index c174cc1a35..3684aee25a 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -211,7 +211,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -2470,6 +2470,10 @@ msgstr "" msgid "annotation must be an identifier" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2642,6 +2646,10 @@ msgstr "" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "" @@ -2793,6 +2801,10 @@ msgstr "" msgid "cannot import name %q" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "" @@ -3242,10 +3254,6 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3959,7 +3967,7 @@ msgid "set unsupported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" +msgid "shape must be integer or tuple of integers" msgstr "" #: shared-module/msgpack/__init__.c diff --git a/locale/it_IT.po b/locale/it_IT.po index 618f7da559..d8a609da15 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -215,7 +215,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -2495,6 +2495,10 @@ msgstr "gli indirizzi sono vuoti" msgid "annotation must be an identifier" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "l'argomento è una sequenza vuota" @@ -2671,6 +2675,10 @@ msgstr "sono disponibili fino a 4 parametri per il Xtensa assembly" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "sono disponibili fino a 4 parametri per il Xtensa assembly" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "" @@ -2822,6 +2830,10 @@ msgstr "impossibile creare un istanza" msgid "cannot import name %q" msgstr "impossibile imporate il nome %q" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "" @@ -3277,10 +3289,6 @@ msgstr "" msgid "inline assembler must be a function" msgstr "inline assembler deve essere una funzione" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -4005,7 +4013,7 @@ msgid "set unsupported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" +msgid "shape must be integer or tuple of integers" msgstr "" #: shared-module/msgpack/__init__.c diff --git a/locale/ja.po b/locale/ja.po index ce8efe97c9..13cae1e02e 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -218,7 +218,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -2487,6 +2487,10 @@ msgstr "" msgid "annotation must be an identifier" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2659,6 +2663,10 @@ msgstr "" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "サブクラス化済みのクラスに特殊メソッドを追加できません" @@ -2810,6 +2818,10 @@ msgstr "インスタンスを作れません" msgid "cannot import name %q" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "" @@ -3264,10 +3276,6 @@ msgstr "" msgid "inline assembler must be a function" msgstr "インラインアセンブラは関数でなければなりません" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3983,7 +3991,7 @@ msgid "set unsupported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" +msgid "shape must be integer or tuple of integers" msgstr "" #: shared-module/msgpack/__init__.c diff --git a/locale/ko.po b/locale/ko.po index cae445c289..dd36e49950 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -212,7 +212,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -2474,6 +2474,10 @@ msgstr "" msgid "annotation must be an identifier" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2646,6 +2650,10 @@ msgstr "" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "" @@ -2797,6 +2805,10 @@ msgstr "" msgid "cannot import name %q" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "" @@ -3246,10 +3258,6 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3963,7 +3971,7 @@ msgid "set unsupported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" +msgid "shape must be integer or tuple of integers" msgstr "" #: shared-module/msgpack/__init__.c diff --git a/locale/nl.po b/locale/nl.po index 1acf9d4d6e..ed3ca55c48 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -211,7 +211,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -2497,6 +2497,10 @@ msgstr "adressen zijn leeg" msgid "annotation must be an identifier" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "arg is een lege sequentie" @@ -2669,6 +2673,10 @@ msgstr "kan slechts 4 parameters aan Thumb assembly geven" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "kan slechts 4 parameters aan Xtensa assembly geven" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "" @@ -2821,6 +2829,10 @@ msgstr "kan geen instantie creëren" msgid "cannot import name %q" msgstr "kan naam %q niet importeren" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "" @@ -3273,10 +3285,6 @@ msgstr "lengte van initial_value is onjuist" msgid "inline assembler must be a function" msgstr "inline assembler moet een functie zijn" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "in- en uitvoervormen zijn niet compatibel" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3993,8 +4001,8 @@ msgid "set unsupported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" -msgstr "vorm moet een tupel zijn" +msgid "shape must be integer or tuple of integers" +msgstr "" #: shared-module/msgpack/__init__.c msgid "short read" @@ -4383,6 +4391,12 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "input and output shapes are not compatible" +#~ msgstr "in- en uitvoervormen zijn niet compatibel" + +#~ msgid "shape must be a tuple" +#~ msgstr "vorm moet een tupel zijn" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "Helderheid moet tussen de 0 en 1.0 liggen" diff --git a/locale/pl.po b/locale/pl.po index 6e0134e62c..359c27eaad 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -213,7 +213,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -2478,6 +2478,10 @@ msgstr "adres jest pusty" msgid "annotation must be an identifier" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "arg jest puste" @@ -2650,6 +2654,10 @@ msgstr "asembler Thumb może przyjąć do 4 parameterów" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "asembler Xtensa może przyjąć do 4 parameterów" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "nie można dodać specjalnej metody do podklasy" @@ -2801,6 +2809,10 @@ msgstr "nie można stworzyć instancji" msgid "cannot import name %q" msgstr "nie można zaimportować nazwy %q" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "" @@ -3251,10 +3263,6 @@ msgstr "długość initial_value jest nieprawidłowa" msgid "inline assembler must be a function" msgstr "wtrącony asembler musi być funkcją" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3969,7 +3977,7 @@ msgid "set unsupported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" +msgid "shape must be integer or tuple of integers" msgstr "" #: shared-module/msgpack/__init__.c diff --git a/locale/pt_BR.po b/locale/pt_BR.po index f9f3ddb50f..5a25d44e2e 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -224,7 +224,7 @@ msgstr "%q deve ser uma matriz do tipo 'h'" msgid "%q must be of type %q or %q, not %q" msgstr "%q deve ser do tipo %q ou %q e não %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q deve ser do tipo %q e não %q" @@ -2547,6 +2547,10 @@ msgstr "os endereços estão vazios" msgid "annotation must be an identifier" msgstr "a anotação deve ser um identificador" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "o arg é uma sequência vazia" @@ -2719,6 +2723,10 @@ msgstr "só pode haver até 4 parâmetros para a montagem Thumb" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "só pode haver até 4 parâmetros para a montagem Xtensa" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "não é possível adicionar o método especial à classe já subclassificada" @@ -2874,6 +2882,10 @@ msgstr "não é possível criar instância" msgid "cannot import name %q" msgstr "não pode importar nome %q" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "Não é possível obter de forma inequívoca a escala do sizeof" @@ -3330,10 +3342,6 @@ msgstr "O comprimento do initial_value está errado" msgid "inline assembler must be a function" msgstr "o assembler em linha deve ser uma função" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "as formas de entrada e saída não são compatíveis" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -4058,8 +4066,8 @@ msgid "set unsupported" msgstr "conjunto não suportado" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" -msgstr "a forma deve ser uma tupla" +msgid "shape must be integer or tuple of integers" +msgstr "" #: shared-module/msgpack/__init__.c msgid "short read" @@ -4448,6 +4456,12 @@ 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 "input and output shapes are not compatible" +#~ msgstr "as formas de entrada e saída não são compatíveis" + +#~ msgid "shape must be a tuple" +#~ msgstr "a forma deve ser uma tupla" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "O brilho deve ser 0-1,0" diff --git a/locale/ru.po b/locale/ru.po index 384ae2e662..cc79f036cd 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " -"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 4.18-dev\n" #: main.c @@ -218,7 +218,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -2533,6 +2533,10 @@ msgstr "" msgid "annotation must be an identifier" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2705,6 +2709,10 @@ msgstr "" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "" @@ -2856,6 +2864,10 @@ msgstr "" msgid "cannot import name %q" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "" @@ -3305,10 +3317,6 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -4022,7 +4030,7 @@ msgid "set unsupported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" +msgid "shape must be integer or tuple of integers" msgstr "" #: shared-module/msgpack/__init__.c diff --git a/locale/sv.po b/locale/sv.po index a2f7eb2069..8ff5aed302 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -225,7 +225,7 @@ msgstr "%q måste vara en matris av typen 'h'" msgid "%q must be of type %q or %q, not %q" msgstr "%q måste vara av typen %q eller %q, inte %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q måste vara av typen %q, inte %q" @@ -2520,6 +2520,10 @@ msgstr "adresserna är tomma" msgid "annotation must be an identifier" msgstr "Annoteringen måste vara en identifierare" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "arg är en tom sekvens" @@ -2692,6 +2696,10 @@ msgstr "kan bara ha upp till 4 parametrar för Thumbs assembly" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "kan bara ha upp till 4 parametrar att Xtensa assembly" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "kan inte lägga till särskild metod för redan subklassad klass" @@ -2845,6 +2853,10 @@ msgstr "kan inte skapa instans" msgid "cannot import name %q" msgstr "kan inte importera namn %q" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "Kan inte entydigt få sizeof scalar" @@ -3299,10 +3311,6 @@ msgstr "initial_value-längd är fel" msgid "inline assembler must be a function" msgstr "inline assembler måste vara en funktion" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "indata- och utdataformer är inte kompatibla" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "indataargument måste vara integer, en tuple eller list" @@ -4020,8 +4028,8 @@ msgid "set unsupported" msgstr "set stöds inte" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" -msgstr "shape måste vara en tuple" +msgid "shape must be integer or tuple of integers" +msgstr "" #: shared-module/msgpack/__init__.c msgid "short read" @@ -4410,6 +4418,12 @@ 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 "input and output shapes are not compatible" +#~ msgstr "indata- och utdataformer är inte kompatibla" + +#~ msgid "shape must be a tuple" +#~ msgstr "shape måste vara en tuple" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "Ljusstyrkan måste vara mellan 0 och 1,0" diff --git a/locale/tr.po b/locale/tr.po index 0958a8ff01..f64fb820b9 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -219,7 +219,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -2492,6 +2492,10 @@ msgstr "" msgid "annotation must be an identifier" msgstr "" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "" @@ -2664,6 +2668,10 @@ msgstr "" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "" @@ -2815,6 +2823,10 @@ msgstr "" msgid "cannot import name %q" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "" @@ -3264,10 +3276,6 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3981,7 +3989,7 @@ msgid "set unsupported" msgstr "" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" +msgid "shape must be integer or tuple of integers" msgstr "" #: shared-module/msgpack/__init__.c diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 1586a6ec2f..4e0cc053f9 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -227,7 +227,7 @@ msgstr "%q bìxū shì lèixíng wéi 'h' de shùzǔ" msgid "%q must be of type %q or %q, not %q" msgstr "%q de lèi xíng bì xū shì %q huò %q, ér bù shì %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c +#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q de lèi xíng bì xū shì %q, ér bù shì %q" @@ -2525,6 +2525,10 @@ msgstr "dìzhǐ wèi kōng" msgid "annotation must be an identifier" msgstr "zhù shì bì xū shì biāo zhì fú" +#: extmod/ulab/code/numpy/create.c +msgid "arange: cannot compute length" +msgstr "" + #: py/modbuiltins.c msgid "arg is an empty sequence" msgstr "cānshù shì yīgè kōng de xùliè" @@ -2697,6 +2701,10 @@ msgstr "zhǐyǒu Thumb zǔjiàn zuìduō 4 cānshù" msgid "can only have up to 4 parameters to Xtensa assembly" msgstr "zhǐyǒu Xtensa zǔjiàn zuìduō 4 cānshù" +#: extmod/ulab/code/ndarray.c +msgid "can only specify one unknown dimension" +msgstr "" + #: py/objtype.c msgid "can't add special method to already-subclassed class" msgstr "wúfǎ tiānjiā tèshū fāngfǎ dào zi fēnlèi lèi" @@ -2849,6 +2857,10 @@ msgstr "wúfǎ chuàngjiàn shílì" msgid "cannot import name %q" msgstr "wúfǎ dǎorù míngchēng %q" +#: extmod/ulab/code/ndarray.c +msgid "cannot reshape array" +msgstr "" + #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" msgstr "bù néng háo bù hán hu de dé dào dà xiǎo de lín" @@ -3305,10 +3317,6 @@ msgstr "Initial_value chángdù cuòwù" msgid "inline assembler must be a function" msgstr "nèi lián jíhé bìxū shì yīgè hánshù" -#: extmod/ulab/code/ndarray.c -msgid "input and output shapes are not compatible" -msgstr "shū rù hé shū chū xíng zhuàng bù jiān róng" - #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "shū rù cān shù bì xū shì zhěng shù, yuán zǔ huò liè biǎo" @@ -4023,8 +4031,8 @@ msgid "set unsupported" msgstr "shè zhì bù shòu zhī chí" #: extmod/ulab/code/ndarray.c -msgid "shape must be a tuple" -msgstr "xíng zhuàng bì xū shì yí gè yuán zǔ" +msgid "shape must be integer or tuple of integers" +msgstr "" #: shared-module/msgpack/__init__.c msgid "short read" @@ -4416,6 +4424,12 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "input and output shapes are not compatible" +#~ msgstr "shū rù hé shū chū xíng zhuàng bù jiān róng" + +#~ msgid "shape must be a tuple" +#~ msgstr "xíng zhuàng bì xū shì yí gè yuán zǔ" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "Liàngdù bìxū wèi 0-1.0" From 3f845fe8fda77257672f07488ef66702a1cb8f58 Mon Sep 17 00:00:00 2001 From: David Sullivan Date: Tue, 23 May 2023 14:24:28 -0700 Subject: [PATCH 1132/1712] board files for lolin-s3-mini --- ports/espressif/boards/lolin_s3_mini/board.c | 39 ++++++ .../boards/lolin_s3_mini/mpconfigboard.h | 44 ++++++ .../boards/lolin_s3_mini/mpconfigboard.mk | 16 +++ ports/espressif/boards/lolin_s3_mini/pins.c | 125 ++++++++++++++++++ .../espressif/boards/lolin_s3_mini/sdkconfig | 48 +++++++ 5 files changed, 272 insertions(+) create mode 100644 ports/espressif/boards/lolin_s3_mini/board.c create mode 100644 ports/espressif/boards/lolin_s3_mini/mpconfigboard.h create mode 100644 ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk create mode 100644 ports/espressif/boards/lolin_s3_mini/pins.c create mode 100644 ports/espressif/boards/lolin_s3_mini/sdkconfig diff --git a/ports/espressif/boards/lolin_s3_mini/board.c b/ports/espressif/boards/lolin_s3_mini/board.c new file mode 100644 index 0000000000..9731a30366 --- /dev/null +++ b/ports/espressif/boards/lolin_s3_mini/board.c @@ -0,0 +1,39 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 David Sullivan + * + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.h b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.h new file mode 100644 index 0000000000..d94cf9adf3 --- /dev/null +++ b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.h @@ -0,0 +1,44 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 David Sullivan + * + * 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 "LOLIN S3 MINI 4MB Flash 2MB PSRAM" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO47) + +// #define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO36) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO35) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO12) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO13) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk new file mode 100644 index 0000000000..2a02d7f231 --- /dev/null +++ b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk @@ -0,0 +1,16 @@ +USB_VID = 0x303a +USB_PID = 0x8168 +USB_PRODUCT = "LOLIN S3 MINI 4MB Flash 2MB PSRAM" +USB_MANUFACTURER = "WEMOS" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB + +# OPTIMIZATION_FLAGS = -Os +CIRCUITPY_ESPCAMERA = 0 + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/espressif/boards/lolin_s3_mini/pins.c b/ports/espressif/boards/lolin_s3_mini/pins.c new file mode 100644 index 0000000000..18a822e6a0 --- /dev/null +++ b/ports/espressif/boards/lolin_s3_mini/pins.c @@ -0,0 +1,125 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A13), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A14), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_A16), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_A17), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_D47), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO47) }, + + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + { 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_UART), MP_ROM_PTR(&board_uart_obj) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/lolin_s3_mini/sdkconfig b/ports/espressif/boards/lolin_s3_mini/sdkconfig new file mode 100644 index 0000000000..c9fa5f3e51 --- /dev/null +++ b/ports/espressif/boards/lolin_s3_mini/sdkconfig @@ -0,0 +1,48 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +# CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +# CONFIG_SPIRAM_SPEED_40M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_MODE_OCT=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="LOLIN-S3-MINI" +# end of LWIP + +# end of Component config From 02b19970a9800619dde1ef7619be75fec5486426 Mon Sep 17 00:00:00 2001 From: Jose David M Date: Tue, 23 May 2023 20:59:07 +0000 Subject: [PATCH 1133/1712] Translated using Weblate (Spanish) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/es.po b/locale/es.po index 8a40dab228..6a158b4bca 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-05-21 00:49+0000\n" -"Last-Translator: Scott Shawcroft \n" +"PO-Revision-Date: 2023-05-23 22:55+0000\n" +"Last-Translator: Jose David M \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" @@ -2553,7 +2553,7 @@ msgstr "la anotación debe ser un identificador" #: extmod/ulab/code/numpy/create.c msgid "arange: cannot compute length" -msgstr "" +msgstr "arange: no se puede calcular la longitud" #: py/modbuiltins.c msgid "arg is an empty sequence" @@ -2729,7 +2729,7 @@ msgstr "solo puede tener hasta 4 parámetros para ensamblador Xtensa" #: extmod/ulab/code/ndarray.c msgid "can only specify one unknown dimension" -msgstr "" +msgstr "sólo puede especificar una dimensión desconocida" #: py/objtype.c msgid "can't add special method to already-subclassed class" @@ -2889,7 +2889,7 @@ msgstr "no se puede importar name '%q'" #: extmod/ulab/code/ndarray.c msgid "cannot reshape array" -msgstr "" +msgstr "no puede remodelar la matriz" #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" @@ -4065,7 +4065,7 @@ msgstr "sin capacidades para el conjunto" #: extmod/ulab/code/ndarray.c msgid "shape must be integer or tuple of integers" -msgstr "" +msgstr "la forma debe ser un número entero o una tupla de números enteros" #: shared-module/msgpack/__init__.c msgid "short read" From fd7f1f7c6a39740b9d49b304d6c8be186d46a690 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 23 May 2023 21:10:38 +0000 Subject: [PATCH 1134/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 5a25d44e2e..705ff49b73 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: 2023-05-19 16:13+0000\n" +"PO-Revision-Date: 2023-05-23 22:55+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -2549,7 +2549,7 @@ msgstr "a anotação deve ser um identificador" #: extmod/ulab/code/numpy/create.c msgid "arange: cannot compute length" -msgstr "" +msgstr "arange: não é possível calcular o comprimento" #: py/modbuiltins.c msgid "arg is an empty sequence" @@ -2725,7 +2725,7 @@ msgstr "só pode haver até 4 parâmetros para a montagem Xtensa" #: extmod/ulab/code/ndarray.c msgid "can only specify one unknown dimension" -msgstr "" +msgstr "só é possível definir uma dimensão desconhecida" #: py/objtype.c msgid "can't add special method to already-subclassed class" @@ -2884,7 +2884,7 @@ msgstr "não pode importar nome %q" #: extmod/ulab/code/ndarray.c msgid "cannot reshape array" -msgstr "" +msgstr "não é possível remodelar a matriz" #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" @@ -4067,7 +4067,7 @@ msgstr "conjunto não suportado" #: extmod/ulab/code/ndarray.c msgid "shape must be integer or tuple of integers" -msgstr "" +msgstr "a forma deve ser inteira ou tupla de inteiros" #: shared-module/msgpack/__init__.c msgid "short read" From d0138d435519b627edcf5bb8f0b1a5e73da39cf0 Mon Sep 17 00:00:00 2001 From: Andi Chandler Date: Tue, 23 May 2023 21:39:43 +0000 Subject: [PATCH 1135/1712] Translated using Weblate (English (United Kingdom)) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/en_GB/ --- locale/en_GB.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/en_GB.po b/locale/en_GB.po index 1907efce29..35eb8275c4 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-05-21 00:49+0000\n" -"Last-Translator: Scott Shawcroft \n" +"PO-Revision-Date: 2023-05-23 22:55+0000\n" +"Last-Translator: Andi Chandler \n" "Language-Team: none\n" "Language: en_GB\n" "MIME-Version: 1.0\n" @@ -2510,7 +2510,7 @@ msgstr "annotation must be an identifier" #: extmod/ulab/code/numpy/create.c msgid "arange: cannot compute length" -msgstr "" +msgstr "arange: cannot compute length" #: py/modbuiltins.c msgid "arg is an empty sequence" @@ -2686,7 +2686,7 @@ msgstr "Can only have up to 4 parameters to xtensa assembly" #: extmod/ulab/code/ndarray.c msgid "can only specify one unknown dimension" -msgstr "" +msgstr "can only specify one unknown dimension" #: py/objtype.c msgid "can't add special method to already-subclassed class" @@ -2843,7 +2843,7 @@ msgstr "can't import name %q" #: extmod/ulab/code/ndarray.c msgid "cannot reshape array" -msgstr "" +msgstr "cannot reshape array" #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" @@ -4011,7 +4011,7 @@ msgstr "set unsupported" #: extmod/ulab/code/ndarray.c msgid "shape must be integer or tuple of integers" -msgstr "" +msgstr "shape must be integer or tuple of integers" #: shared-module/msgpack/__init__.c msgid "short read" From 72b1bc890f2b5eee36b35e43b355021d61a5a3ea Mon Sep 17 00:00:00 2001 From: David Sullivan <311316+tkroo@users.noreply.github.com> Date: Tue, 23 May 2023 17:27:53 -0700 Subject: [PATCH 1136/1712] Update spi pins in mpconfigboard.h --- ports/espressif/boards/lolin_c3_pico/mpconfigboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h index b553186052..3e68e6adf9 100644 --- a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h +++ b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h @@ -40,7 +40,7 @@ #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO10, .sda = &pin_GPIO8}} #define CIRCUITPY_BOARD_SPI (1) -#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO10, .mosi = &pin_GPIO7, .miso = &pin_GPIO8}} +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO1, .mosi = &pin_GPIO4, .miso = &pin_GPIO0}} #define CIRCUITPY_BOARD_UART (1) #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} From 1847c2b72a96d4c6158897f718376baad1f717ff Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 23 May 2023 18:41:15 -0500 Subject: [PATCH 1137/1712] synthio: fix, rename voct_to_hz todbot discovered that this function wasn't working right, and wasn't well-named. --- shared-bindings/synthio/__init__.c | 14 +++++++------- shared-bindings/synthio/__init__.h | 2 +- shared-module/synthio/__init__.c | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index e1dfc111f9..b6185051fc 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -281,17 +281,17 @@ STATIC mp_obj_t midi_to_hz(mp_obj_t arg) { } MP_DEFINE_CONST_FUN_OBJ_1(synthio_midi_to_hz_obj, midi_to_hz); -//| def onevo_to_hz(ctrl: float) -> float: +//| def voct_to_hz(ctrl: float) -> float: //| """Converts a 1v/octave signal to Hz. //| -//| 60/12 (5.0) corresponds to middle C, 69/12 is concert A.""" +//| 24/12 (2.0) corresponds to middle C, 33/12 (2.75) is concert A.""" //| -STATIC mp_obj_t onevo_to_hz(mp_obj_t arg) { - mp_float_t note = mp_arg_validate_obj_float_range(arg, 0, 11, MP_QSTR_ctrl); - return mp_obj_new_float(common_hal_synthio_onevo_to_hz_float(note)); +STATIC mp_obj_t voct_to_hz(mp_obj_t arg) { + mp_float_t note = mp_arg_validate_obj_float_range(arg, -11, 11, MP_QSTR_ctrl); + return mp_obj_new_float(common_hal_synthio_voct_to_hz_float(note)); } -MP_DEFINE_CONST_FUN_OBJ_1(synthio_onevo_to_hz_obj, onevo_to_hz); +MP_DEFINE_CONST_FUN_OBJ_1(synthio_voct_to_hz_obj, voct_to_hz); #if CIRCUITPY_AUDIOCORE_DEBUG STATIC mp_obj_t synthio_lfo_tick(size_t n, const mp_obj_t *args) { @@ -319,7 +319,7 @@ STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_from_file), MP_ROM_PTR(&synthio_from_file_obj) }, { MP_ROM_QSTR(MP_QSTR_Envelope), MP_ROM_PTR(&synthio_envelope_type_obj) }, { MP_ROM_QSTR(MP_QSTR_midi_to_hz), MP_ROM_PTR(&synthio_midi_to_hz_obj) }, - { MP_ROM_QSTR(MP_QSTR_onevo_to_hz), MP_ROM_PTR(&synthio_midi_to_hz_obj) }, + { MP_ROM_QSTR(MP_QSTR_voct_to_hz), MP_ROM_PTR(&synthio_voct_to_hz_obj) }, #if CIRCUITPY_AUDIOCORE_DEBUG { MP_ROM_QSTR(MP_QSTR_lfo_tick), MP_ROM_PTR(&synthio_lfo_tick_obj) }, #endif diff --git a/shared-bindings/synthio/__init__.h b/shared-bindings/synthio/__init__.h index 6f3aed0124..2315d92e58 100644 --- a/shared-bindings/synthio/__init__.h +++ b/shared-bindings/synthio/__init__.h @@ -41,4 +41,4 @@ extern const mp_obj_namedtuple_type_t synthio_envelope_type_obj; void synthio_synth_envelope_set(synthio_synth_t *synth, mp_obj_t envelope_obj); mp_obj_t synthio_synth_envelope_get(synthio_synth_t *synth); mp_float_t common_hal_synthio_midi_to_hz_float(mp_float_t note); -mp_float_t common_hal_synthio_onevo_to_hz_float(mp_float_t note); +mp_float_t common_hal_synthio_voct_to_hz_float(mp_float_t note); diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 85e98329fd..7c8e627404 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -46,11 +46,11 @@ STATIC int64_t round_float_to_int64(mp_float_t f) { } mp_float_t common_hal_synthio_midi_to_hz_float(mp_float_t arg) { - return common_hal_synthio_onevo_to_hz_float(arg / 12.); + return common_hal_synthio_voct_to_hz_float(arg / 12. - 3); } -mp_float_t common_hal_synthio_onevo_to_hz_float(mp_float_t octave) { - return notes[0] * MICROPY_FLOAT_C_FUN(pow)(2., octave - 10); +mp_float_t common_hal_synthio_voct_to_hz_float(mp_float_t octave) { + return notes[0] * MICROPY_FLOAT_C_FUN(pow)(2., octave - 7); } STATIC int16_t convert_time_to_rate(uint32_t sample_rate, mp_obj_t time_in, int16_t difference) { From c20e862790744a5805733c6f4867c0d76287faae Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 23 May 2023 18:51:20 -0500 Subject: [PATCH 1138/1712] synthio: note frequency can only be a float, for now --- shared-bindings/synthio/Note.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index 25abaca602..651bf8f33a 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -79,7 +79,7 @@ STATIC mp_obj_t synthio_note_make_new(const mp_obj_type_t *type_in, size_t n_arg return result; }; -//| frequency: BlockInput +//| frequency: float //| """The base frequency of the note, in Hz.""" STATIC mp_obj_t synthio_note_get_frequency(mp_obj_t self_in) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); From 11d8a6ec3a98c7aae960d9dfd38629ad8fc66ef8 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 23 May 2023 18:51:48 -0500 Subject: [PATCH 1139/1712] synthio: rename synthesizer.lfos to .blocks .. since math blocks can be placed in it too (and that's useful) --- shared-bindings/synthio/Synthesizer.c | 18 +++++++++--------- shared-bindings/synthio/Synthesizer.h | 2 +- shared-module/synthio/Synthesizer.c | 8 ++++---- shared-module/synthio/Synthesizer.h | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index 3cfea307d1..c3b2c40fe5 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -270,22 +270,22 @@ MP_DEFINE_CONST_FUN_OBJ_1(synthio_synthesizer_get_pressed_obj, synthio_synthesiz MP_PROPERTY_GETTER(synthio_synthesizer_pressed_obj, (mp_obj_t)&synthio_synthesizer_get_pressed_obj); -//| lfos: List[LFO] -//| """A list of LFOs to advance whether or not they are associated with a playing note. +//| blocks: List[BlockInput] +//| """A list of blocks to advance whether or not they are associated with a playing note. //| //| This can be used to implement 'free-running' LFOs. LFOs associated with playing notes are advanced whether or not they are in this list. //| -//| This property is read-only but its contents may be modified by e.g., calling ``synth.lfos.append()`` or ``synth.lfos.remove()``. It is initially an empty list.""" +//| This property is read-only but its contents may be modified by e.g., calling ``synth.blocks.append()`` or ``synth.blocks.remove()``. It is initially an empty list.""" //| -STATIC mp_obj_t synthio_synthesizer_obj_get_lfos(mp_obj_t self_in) { +STATIC mp_obj_t synthio_synthesizer_obj_get_blocks(mp_obj_t self_in) { synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); - return common_hal_synthio_synthesizer_get_lfos(self); + return common_hal_synthio_synthesizer_get_blocks(self); } -MP_DEFINE_CONST_FUN_OBJ_1(synthio_synthesizer_get_lfos_obj, synthio_synthesizer_obj_get_lfos); +MP_DEFINE_CONST_FUN_OBJ_1(synthio_synthesizer_get_blocks_obj, synthio_synthesizer_obj_get_blocks); -MP_PROPERTY_GETTER(synthio_synthesizer_lfos_obj, - (mp_obj_t)&synthio_synthesizer_get_lfos_obj); +MP_PROPERTY_GETTER(synthio_synthesizer_blocks_obj, + (mp_obj_t)&synthio_synthesizer_get_blocks_obj); //| max_polyphony: int //| """Maximum polyphony of the synthesizer (read-only class property)""" @@ -308,7 +308,7 @@ STATIC const mp_rom_map_elem_t synthio_synthesizer_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_sample_rate), MP_ROM_PTR(&synthio_synthesizer_sample_rate_obj) }, { MP_ROM_QSTR(MP_QSTR_max_polyphony), MP_ROM_INT(CIRCUITPY_SYNTHIO_MAX_CHANNELS) }, { MP_ROM_QSTR(MP_QSTR_pressed), MP_ROM_PTR(&synthio_synthesizer_pressed_obj) }, - { MP_ROM_QSTR(MP_QSTR_lfos), MP_ROM_PTR(&synthio_synthesizer_lfos_obj) }, + { MP_ROM_QSTR(MP_QSTR_blocks), MP_ROM_PTR(&synthio_synthesizer_blocks_obj) }, }; STATIC MP_DEFINE_CONST_DICT(synthio_synthesizer_locals_dict, synthio_synthesizer_locals_dict_table); diff --git a/shared-bindings/synthio/Synthesizer.h b/shared-bindings/synthio/Synthesizer.h index a5f5582ac7..9c7ba68588 100644 --- a/shared-bindings/synthio/Synthesizer.h +++ b/shared-bindings/synthio/Synthesizer.h @@ -44,4 +44,4 @@ void common_hal_synthio_synthesizer_press(synthio_synthesizer_obj_t *self, mp_ob void common_hal_synthio_synthesizer_retrigger(synthio_synthesizer_obj_t *self, mp_obj_t to_retrigger); void common_hal_synthio_synthesizer_release_all(synthio_synthesizer_obj_t *self); mp_obj_t common_hal_synthio_synthesizer_get_pressed_notes(synthio_synthesizer_obj_t *self); -mp_obj_t common_hal_synthio_synthesizer_get_lfos(synthio_synthesizer_obj_t *self); +mp_obj_t common_hal_synthio_synthesizer_get_blocks(synthio_synthesizer_obj_t *self); diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index 5371a67350..dd2f977bd7 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -37,7 +37,7 @@ void common_hal_synthio_synthesizer_construct(synthio_synthesizer_obj_t *self, mp_obj_t envelope_obj) { synthio_synth_init(&self->synth, sample_rate, channel_count, waveform_obj, filter_obj, envelope_obj); - self->lfos = mp_obj_new_list(0, NULL); + self->blocks = mp_obj_new_list(0, NULL); } void common_hal_synthio_synthesizer_deinit(synthio_synthesizer_obj_t *self) { @@ -75,7 +75,7 @@ audioio_get_buffer_result_t synthio_synthesizer_get_buffer(synthio_synthesizer_o // free-running LFOs mp_obj_iter_buf_t iter_buf; - mp_obj_t iterable = mp_getiter(self->lfos, &iter_buf); + mp_obj_t iterable = mp_getiter(self->blocks, &iter_buf); mp_obj_t item; while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { if (!synthio_obj_is_block(item)) { @@ -185,6 +185,6 @@ mp_obj_t common_hal_synthio_synthesizer_get_pressed_notes(synthio_synthesizer_ob return MP_OBJ_FROM_PTR(result); } -mp_obj_t common_hal_synthio_synthesizer_get_lfos(synthio_synthesizer_obj_t *self) { - return self->lfos; +mp_obj_t common_hal_synthio_synthesizer_get_blocks(synthio_synthesizer_obj_t *self) { + return self->blocks; } diff --git a/shared-module/synthio/Synthesizer.h b/shared-module/synthio/Synthesizer.h index 487e73a2ac..c5e3eeb9be 100644 --- a/shared-module/synthio/Synthesizer.h +++ b/shared-module/synthio/Synthesizer.h @@ -34,7 +34,7 @@ typedef struct { mp_obj_base_t base; synthio_synth_t synth; - mp_obj_t lfos; + mp_obj_t blocks; } synthio_synthesizer_obj_t; From 9f138dc18808641340b54c5a884800e67330068e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 23 May 2023 18:55:08 -0500 Subject: [PATCH 1140/1712] synthio: list filter in the constructor --- shared-bindings/synthio/Synthesizer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index c3b2c40fe5..84882fa657 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -52,6 +52,7 @@ //| channel_count: int = 1, //| waveform: Optional[ReadableBuffer] = None, //| envelope: Optional[Envelope] = None, +//| filter: Optional[ReadableBuffer] = None, //| ) -> None: //| """Create a synthesizer object. //| From d570b8b4ef0da668d1e4fbdd4fbfaee0b6a635b0 Mon Sep 17 00:00:00 2001 From: David Sullivan Date: Tue, 23 May 2023 17:42:36 -0700 Subject: [PATCH 1141/1712] update spi pins to match schematic --- ports/espressif/boards/lolin_c3_pico/pins.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/espressif/boards/lolin_c3_pico/pins.c b/ports/espressif/boards/lolin_c3_pico/pins.c index 33a9432748..d36c9f9b14 100644 --- a/ports/espressif/boards/lolin_c3_pico/pins.c +++ b/ports/espressif/boards/lolin_c3_pico/pins.c @@ -15,20 +15,20 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, From 2d7fa6dd8ae35a86bb358cc000e3cc9258804015 Mon Sep 17 00:00:00 2001 From: phamhuyvn Date: Wed, 24 May 2023 08:44:57 +0700 Subject: [PATCH 1142/1712] Update pins.c Fixed Button_R from GPIO6 to GPIO7 Fixed LCD_BACKLIGHT from GPIO29 to GPIO26 --- ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c index 22816201d6..e87db1e399 100644 --- a/ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c +++ b/ports/raspberrypi/boards/lilygo_t_display_rp2040/pins.c @@ -13,7 +13,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_BUTTON_L), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON_R), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_R), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, @@ -57,7 +57,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) }, - { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, From eda43d747411954ea301c631a3ab805172f11878 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 24 May 2023 10:00:12 -0500 Subject: [PATCH 1143/1712] Add some more Note tests --- tests/circuitpython/synth_note_amplitude.py | 10 + .../circuitpython/synth_note_amplitude.py.exp | 2048 +++++++++++++++++ tests/circuitpython/synth_note_bend.py | 10 + tests/circuitpython/synth_note_bend.py.exp | 2048 +++++++++++++++++ tests/circuitpython/synth_note_envelope.py | 10 + .../circuitpython/synth_note_envelope.py.exp | 2048 +++++++++++++++++ tests/circuitpython/synth_note_ring.py | 10 + tests/circuitpython/synth_note_ring.py.exp | 2048 +++++++++++++++++ tests/testlib/synthnotehelper.py | 82 + 9 files changed, 8314 insertions(+) create mode 100644 tests/circuitpython/synth_note_amplitude.py create mode 100644 tests/circuitpython/synth_note_amplitude.py.exp create mode 100644 tests/circuitpython/synth_note_bend.py create mode 100644 tests/circuitpython/synth_note_bend.py.exp create mode 100644 tests/circuitpython/synth_note_envelope.py create mode 100644 tests/circuitpython/synth_note_envelope.py.exp create mode 100644 tests/circuitpython/synth_note_ring.py create mode 100644 tests/circuitpython/synth_note_ring.py.exp create mode 100644 tests/testlib/synthnotehelper.py diff --git a/tests/circuitpython/synth_note_amplitude.py b/tests/circuitpython/synth_note_amplitude.py new file mode 100644 index 0000000000..f7e41b4dc8 --- /dev/null +++ b/tests/circuitpython/synth_note_amplitude.py @@ -0,0 +1,10 @@ +from synthnotehelper import * + + +@synth_test +def gen(synth): + l = LFO(bend_out, offset=0.2, scale=0.8, rate=4, once=True) + yield [l] + n = Note(128, amplitude=l) + synth.press(n) + yield 1 / 4 diff --git a/tests/circuitpython/synth_note_amplitude.py.exp b/tests/circuitpython/synth_note_amplitude.py.exp new file mode 100644 index 0000000000..d4c7d0adc2 --- /dev/null +++ b/tests/circuitpython/synth_note_amplitude.py.exp @@ -0,0 +1,2048 @@ +0.0 0.01422119140625 0.302396875 +0.000125 0.029876708984375 0.302396875 +0.00025 0.043670654296875 0.302396875 +0.000375 0.058563232421875 0.302396875 +0.0005 0.07281494140625 0.302396875 +0.000625 0.0849609375 0.302396875 +0.00075 0.097564697265625 0.302396875 +0.0008750000000000002 0.108001708984375 0.302396875 +0.001 0.11846923828125 0.302396875 +0.001125 0.12762451171875 0.302396875 +0.00125 0.134674072265625 0.302396875 +0.001375 0.14111328125 0.302396875 +0.0015 0.145599365234375 0.302396875 +0.001625 0.1490478515625 0.302396875 +0.00175 0.15087890625 0.302396875 +0.001875 0.151092529296875 0.302396875 +0.002 0.149749755859375 0.302396875 +0.002125 0.14715576171875 0.302396875 +0.00225 0.14276123046875 0.302396875 +0.002375 0.13677978515625 0.302396875 +0.0025 0.130096435546875 0.302396875 +0.002625 0.121337890625 0.302396875 +0.00275 0.112335205078125 0.302396875 +0.002875 0.10113525390625 0.302396875 +0.003 0.088836669921875 0.302396875 +0.003125 0.076934814453125 0.302396875 +0.00325 0.06292724609375 0.302396875 +0.003375 0.049713134765625 0.302396875 +0.0035 0.034515380859375 0.302396875 +0.003625 0.0189208984375 0.302396875 +0.00375 0.004730224609375 0.302396875 +0.003875 -0.01104736328125 0.302396875 +0.004 -0.02520751953125 0.302396875 +0.004125 -0.0406494140625 0.302396875 +0.00425 -0.055633544921875 0.302396875 +0.004375000000000001 -0.068603515625 0.302396875 +0.004500000000000001 -0.08233642578125 0.302396875 +0.004625 -0.093902587890625 0.302396875 +0.00475 -0.105743408203125 0.302396875 +0.004875 -0.116455078125 0.302396875 +0.005 -0.125030517578125 0.302396875 +0.005125000000000001 -0.133209228515625 0.302396875 +0.00525 -0.13934326171875 0.302396875 +0.005375000000000001 -0.14471435546875 0.302396875 +0.005499999999999999 -0.14849853515625 0.302396875 +0.005625 -0.150482177734375 0.302396875 +0.00575 -0.151153564453125 0.302396875 +0.005874999999999999 -0.15032958984375 0.302396875 +0.006 -0.147857666015625 0.302396875 +0.006125 -0.143768310546875 0.302396875 +0.00625 -0.13873291015625 0.302396875 +0.006375 -0.131683349609375 0.302396875 +0.0065 -0.124114990234375 0.302396875 +0.006625000000000001 -0.114410400390625 0.302396875 +0.00675 -0.103485107421875 0.302396875 +0.006875 -0.0926513671875 0.302396875 +0.007000000000000001 -0.07965087890625 0.302396875 +0.007125000000000002 -0.06719970703125 0.302396875 +0.007250000000000001 -0.05267333984375 0.302396875 +0.007375 -0.037567138671875 0.302396875 +0.0075 -0.02362060546875 0.302396875 +0.007625 -0.007904052734375 0.302396875 +0.00775 0.006317138671875 0.302396875 +0.007875 0.022064208984375 0.302396875 +0.008 0.037567138671875 0.302396875 +0.008125 0.051177978515625 0.302396875 +0.00825 0.0657958984375 0.302396875 +0.008375 0.07830810546875 0.302396875 +0.0085 0.09136962890625 0.302396875 +0.008625 0.103485107421875 0.302396875 +0.008750000000000002 0.113372802734375 0.302396875 +0.008875 0.123199462890625 0.302396875 +0.009000000000000002 0.13092041015625 0.302396875 +0.009125 0.138092041015625 0.302396875 +0.00925 0.143768310546875 0.302396875 +0.009375 0.14752197265625 0.302396875 +0.0095 0.150146484375 0.302396875 +0.009625 0.151123046875 0.302396875 +0.00975 0.150634765625 0.302396875 +0.009875 0.14849853515625 0.302396875 +0.01 0.145172119140625 0.302396875 +0.010125 0.13995361328125 0.302396875 +0.01025 0.13397216796875 0.302396875 +0.010375 0.12591552734375 0.302396875 +0.0105 0.116455078125 0.302396875 +0.010625 0.10687255859375 0.302396875 +0.01075 0.095123291015625 0.302396875 +0.010875 0.083648681640625 0.302396875 +0.011 0.07000732421875 0.302396875 +0.011125 0.055633544921875 0.302396875 +0.01125 0.042144775390625 0.302396875 +0.011375 0.026763916015625 0.302396875 +0.0115 0.01263427734375 0.302396875 +0.011625 -0.003143310546875 0.302396875 +0.01175 -0.0189208984375 0.302396875 +0.011875 -0.032958984375 0.302396875 +0.012 -0.0482177734375 0.302396875 +0.012125 -0.06146240234375 0.302396875 +0.01225 -0.0755615234375 0.302396875 +0.012375 -0.088836669921875 0.302396875 +0.0125 -0.0999755859375 0.302396875 +0.012625 -0.11126708984375 0.302396875 +0.01275 -0.120391845703125 0.302396875 +0.012875 -0.129302978515625 0.302396875 +0.013 -0.13677978515625 0.302396875 +0.013125 -0.1422119140625 0.302396875 +0.01325 -0.14678955078125 0.302396875 +0.013375 -0.1495361328125 0.302396875 +0.0135 -0.151031494140625 0.302396875 +0.013625 -0.15087890625 0.302396875 +0.01375 -0.1492919921875 0.302396875 +0.013875 -0.14599609375 0.302396875 +0.014 -0.141693115234375 0.302396875 +0.014125 -0.135406494140625 0.302396875 +0.01425 -0.12762451171875 0.302396875 +0.014375 -0.11944580078125 0.302396875 +0.0145 -0.109100341796875 0.302396875 +0.014625 -0.0987548828125 0.302396875 +0.01475 -0.086273193359375 0.302396875 +0.014875 -0.07281494140625 0.302396875 +0.015 -0.060028076171875 0.302396875 +0.015125 -0.045196533203125 0.302396875 +0.01525 -0.031402587890625 0.302396875 +0.015375 -0.015777587890625 0.302396875 +0.0155 0.0 0.302396875 +0.015625 0.01422119140625 0.302396875 +0.01575 0.029876708984375 0.302396875 +0.015875 0.043670654296875 0.302396875 +0.016 0.058563232421875 0.302396875 +0.016125 0.07281494140625 0.302396875 +0.01625 0.0849609375 0.302396875 +0.016375 0.097564697265625 0.302396875 +0.0165 0.108001708984375 0.302396875 +0.016625 0.11846923828125 0.302396875 +0.01675 0.12762451171875 0.302396875 +0.016875 0.134674072265625 0.302396875 +0.017 0.14111328125 0.302396875 +0.017125 0.145599365234375 0.302396875 +0.01725 0.1490478515625 0.302396875 +0.017375 0.15087890625 0.302396875 +0.0175 0.151092529296875 0.302396875 +0.017625 0.149749755859375 0.302396875 +0.01775 0.14715576171875 0.302396875 +0.017875 0.14276123046875 0.302396875 +0.018 0.13677978515625 0.302396875 +0.018125 0.130096435546875 0.302396875 +0.01825 0.121337890625 0.302396875 +0.018375 0.112335205078125 0.302396875 +0.0185 0.10113525390625 0.302396875 +0.018625 0.088836669921875 0.302396875 +0.01875 0.076934814453125 0.302396875 +0.018875 0.06292724609375 0.302396875 +0.019 0.049713134765625 0.302396875 +0.019125 0.034515380859375 0.302396875 +0.01925 0.0189208984375 0.302396875 +0.019375 0.004730224609375 0.302396875 +0.0195 -0.01104736328125 0.302396875 +0.019625 -0.02520751953125 0.302396875 +0.01975 -0.0406494140625 0.302396875 +0.019875 -0.055633544921875 0.302396875 +0.02 -0.068603515625 0.302396875 +0.020125 -0.08233642578125 0.302396875 +0.02025 -0.093902587890625 0.302396875 +0.020375 -0.105743408203125 0.302396875 +0.0205 -0.116455078125 0.302396875 +0.020625 -0.125030517578125 0.302396875 +0.02075 -0.133209228515625 0.302396875 +0.020875 -0.13934326171875 0.302396875 +0.021 -0.14471435546875 0.302396875 +0.021125 -0.14849853515625 0.302396875 +0.02125 -0.150482177734375 0.302396875 +0.021375 -0.151153564453125 0.302396875 +0.0215 -0.15032958984375 0.302396875 +0.021625 -0.147857666015625 0.302396875 +0.02175 -0.143768310546875 0.302396875 +0.021875 -0.13873291015625 0.302396875 +0.022 -0.131683349609375 0.302396875 +0.022125 -0.124114990234375 0.302396875 +0.02225 -0.114410400390625 0.302396875 +0.022375 -0.103485107421875 0.302396875 +0.0225 -0.0926513671875 0.302396875 +0.022625 -0.07965087890625 0.302396875 +0.02275 -0.06719970703125 0.302396875 +0.022875 -0.05267333984375 0.302396875 +0.023 -0.037567138671875 0.302396875 +0.023125 -0.02362060546875 0.302396875 +0.02325 -0.007904052734375 0.302396875 +0.023375 0.006317138671875 0.302396875 +0.0235 0.022064208984375 0.302396875 +0.023625 0.037567138671875 0.302396875 +0.02375 0.051177978515625 0.302396875 +0.023875 0.0657958984375 0.302396875 +0.024 0.07830810546875 0.302396875 +0.024125 0.09136962890625 0.302396875 +0.02425 0.103485107421875 0.302396875 +0.024375 0.113372802734375 0.302396875 +0.0245 0.123199462890625 0.302396875 +0.024625 0.13092041015625 0.302396875 +0.02475 0.138092041015625 0.302396875 +0.024875 0.143768310546875 0.302396875 +0.025 0.14752197265625 0.302396875 +0.025125 0.150146484375 0.302396875 +0.02525 0.151123046875 0.302396875 +0.02537500000000001 0.150634765625 0.302396875 +0.0255 0.14849853515625 0.302396875 +0.025625 0.145172119140625 0.302396875 +0.02575 0.13995361328125 0.302396875 +0.025875 0.13397216796875 0.302396875 +0.026 0.12591552734375 0.302396875 +0.026125 0.116455078125 0.302396875 +0.02625 0.10687255859375 0.302396875 +0.026375 0.095123291015625 0.302396875 +0.0265 0.083648681640625 0.302396875 +0.026625 0.07000732421875 0.302396875 +0.02675 0.055633544921875 0.302396875 +0.026875 0.042144775390625 0.302396875 +0.027 0.026763916015625 0.302396875 +0.027125 0.01263427734375 0.302396875 +0.02725 -0.003143310546875 0.302396875 +0.027375 -0.0189208984375 0.302396875 +0.0275 -0.032958984375 0.302396875 +0.027625 -0.0482177734375 0.302396875 +0.02775 -0.06146240234375 0.302396875 +0.027875 -0.0755615234375 0.302396875 +0.028 -0.088836669921875 0.302396875 +0.028125 -0.0999755859375 0.302396875 +0.02825 -0.11126708984375 0.302396875 +0.028375 -0.120391845703125 0.302396875 +0.02850000000000001 -0.129302978515625 0.302396875 +0.028625 -0.13677978515625 0.302396875 +0.02875 -0.1422119140625 0.302396875 +0.028875 -0.14678955078125 0.302396875 +0.029 -0.1495361328125 0.302396875 +0.029125 -0.151031494140625 0.302396875 +0.02925 -0.15087890625 0.302396875 +0.029375 -0.1492919921875 0.302396875 +0.0295 -0.14599609375 0.302396875 +0.029625 -0.141693115234375 0.302396875 +0.02975000000000001 -0.135406494140625 0.302396875 +0.029875 -0.12762451171875 0.302396875 +0.03 -0.11944580078125 0.302396875 +0.030125 -0.109100341796875 0.302396875 +0.03025 -0.0987548828125 0.302396875 +0.030375 -0.086273193359375 0.302396875 +0.0305 -0.07281494140625 0.302396875 +0.030625 -0.060028076171875 0.302396875 +0.03075 -0.045196533203125 0.302396875 +0.03087499999999999 -0.031402587890625 0.302396875 +0.031 -0.015777587890625 0.302396875 +0.031125 0.0 0.302396875 +0.03125 0.01422119140625 0.302396875 +0.031375 0.029876708984375 0.302396875 +0.0315 0.043670654296875 0.302396875 +0.03162500000000001 0.058563232421875 0.302396875 +0.03175 0.07281494140625 0.302396875 +0.031875 0.0849609375 0.302396875 +0.032 0.130615234375 0.4047937500000001 +0.032125 0.144561767578125 0.4047937500000001 +0.03225 0.1585693359375 0.4047937500000001 +0.032375 0.17083740234375 0.4047937500000001 +0.0325 0.1802978515625 0.4047937500000001 +0.032625 0.18890380859375 0.4047937500000001 +0.03275 0.19488525390625 0.4047937500000001 +0.032875 0.19952392578125 0.4047937500000001 +0.033 0.20196533203125 0.4047937500000001 +0.033125 0.202239990234375 0.4047937500000001 +0.03325 0.200469970703125 0.4047937500000001 +0.033375 0.197021484375 0.4047937500000001 +0.0335 0.19110107421875 0.4047937500000001 +0.03362500000000001 0.18310546875 0.4047937500000001 +0.03375 0.174163818359375 0.4047937500000001 +0.033875 0.162445068359375 0.4047937500000001 +0.034 0.150360107421875 0.4047937500000001 +0.03412500000000001 0.135406494140625 0.4047937500000001 +0.03425 0.118927001953125 0.4047937500000001 +0.034375 0.102996826171875 0.4047937500000001 +0.0345 0.084228515625 0.4047937500000001 +0.034625 0.0665283203125 0.4047937500000001 +0.03475000000000001 0.04620361328125 0.4047937500000001 +0.034875 0.02532958984375 0.4047937500000001 +0.035 0.00634765625 0.4047937500000001 +0.03512500000000001 -0.014801025390625 0.4047937500000001 +0.03525 -0.033721923828125 0.4047937500000001 +0.035375 -0.054412841796875 0.4047937500000001 +0.0355 -0.074493408203125 0.4047937500000001 +0.03562500000000001 -0.09185791015625 0.4047937500000001 +0.03575 -0.110198974609375 0.4047937500000001 +0.035875 -0.12567138671875 0.4047937500000001 +0.03600000000000001 -0.141571044921875 0.4047937500000001 +0.036125 -0.155914306640625 0.4047937500000001 +0.03625 -0.1673583984375 0.4047937500000001 +0.036375 -0.1783447265625 0.4047937500000001 +0.0365 -0.186553955078125 0.4047937500000001 +0.036625 -0.1937255859375 0.4047937500000001 +0.03675 -0.198760986328125 0.4047937500000001 +0.036875 -0.201446533203125 0.4047937500000001 +0.037 -0.20233154296875 0.4047937500000001 +0.03712499999999999 -0.20123291015625 0.4047937500000001 +0.03725 -0.19793701171875 0.4047937500000001 +0.037375 -0.19244384765625 0.4047937500000001 +0.0375 -0.185699462890625 0.4047937500000001 +0.037625 -0.176300048828125 0.4047937500000001 +0.03775 -0.166168212890625 0.4047937500000001 +0.037875 -0.153167724609375 0.4047937500000001 +0.038 -0.138519287109375 0.4047937500000001 +0.038125 -0.1240234375 0.4047937500000001 +0.03825 -0.10662841796875 0.4047937500000001 +0.038375 -0.0899658203125 0.4047937500000001 +0.0385 -0.070526123046875 0.4047937500000001 +0.038625 -0.05029296875 0.4047937500000001 +0.03875 -0.031646728515625 0.4047937500000001 +0.038875 -0.01055908203125 0.4047937500000001 +0.039 0.008453369140625 0.4047937500000001 +0.039125 0.029541015625 0.4047937500000001 +0.03925 0.05029296875 0.4047937500000001 +0.039375 0.06854248046875 0.4047937500000001 +0.0395 0.08807373046875 0.4047937500000001 +0.039625 0.104827880859375 0.4047937500000001 +0.03975 0.122344970703125 0.4047937500000001 +0.039875 0.138519287109375 0.4047937500000001 +0.04 0.15179443359375 0.4047937500000001 +0.040125 0.164947509765625 0.4047937500000001 +0.04025 0.17523193359375 0.4047937500000001 +0.040375 0.184844970703125 0.4047937500000001 +0.04050000000000001 0.19244384765625 0.4047937500000001 +0.040625 0.197479248046875 0.4047937500000001 +0.04075 0.201019287109375 0.4047937500000001 +0.040875 0.202301025390625 0.4047937500000001 +0.04100000000000001 0.20166015625 0.4047937500000001 +0.041125 0.198760986328125 0.4047937500000001 +0.04125 0.194305419921875 0.4047937500000001 +0.041375 0.187347412109375 0.4047937500000001 +0.0415 0.1793212890625 0.4047937500000001 +0.041625 0.168548583984375 0.4047937500000001 +0.04175000000000001 0.155914306640625 0.4047937500000001 +0.041875 0.14306640625 0.4047937500000001 +0.042 0.127349853515625 0.4047937500000001 +0.042125 0.111968994140625 0.4047937500000001 +0.04225000000000001 0.09375 0.4047937500000001 +0.042375 0.074493408203125 0.4047937500000001 +0.0425 0.056427001953125 0.4047937500000001 +0.042625 0.03582763671875 0.4047937500000001 +0.04275 0.01690673828125 0.4047937500000001 +0.04287500000000001 -0.00421142578125 0.4047937500000001 +0.04300000000000001 -0.02532958984375 0.4047937500000001 +0.043125 -0.04412841796875 0.4047937500000001 +0.04325 -0.064544677734375 0.4047937500000001 +0.043375 -0.082305908203125 0.4047937500000001 +0.04350000000000001 -0.101165771484375 0.4047937500000001 +0.04362500000000001 -0.118927001953125 0.4047937500000001 +0.04375000000000001 -0.133819580078125 0.4047937500000001 +0.043875 -0.148956298828125 0.4047937500000001 +0.04399999999999999 -0.161163330078125 0.4047937500000001 +0.044125 -0.173095703125 0.4047937500000001 +0.04425 -0.18310546875 0.4047937500000001 +0.044375 -0.190399169921875 0.4047937500000001 +0.04449999999999999 -0.196502685546875 0.4047937500000001 +0.04462499999999999 -0.2001953125 0.4047937500000001 +0.04475 -0.202178955078125 0.4047937500000001 +0.044875 -0.20196533203125 0.4047937500000001 +0.045 -0.199859619140625 0.4047937500000001 +0.045125 -0.195465087890625 0.4047937500000001 +0.04525 -0.189666748046875 0.4047937500000001 +0.045375 -0.181243896484375 0.4047937500000001 +0.0455 -0.17083740234375 0.4047937500000001 +0.045625 -0.159881591796875 0.4047937500000001 +0.04575 -0.14605712890625 0.4047937500000001 +0.045875 -0.1322021484375 0.4047937500000001 +0.046 -0.115478515625 0.4047937500000001 +0.046125 -0.09747314453125 0.4047937500000001 +0.04625 -0.080352783203125 0.4047937500000001 +0.046375 -0.06048583984375 0.4047937500000001 +0.04649999999999999 -0.04205322265625 0.4047937500000001 +0.046625 -0.021148681640625 0.4047937500000001 +0.04675000000000001 0.0 0.4047937500000001 +0.046875 0.019012451171875 0.4047937500000001 +0.04699999999999999 0.03997802734375 0.4047937500000001 +0.047125 0.0584716796875 0.4047937500000001 +0.04725000000000001 0.078399658203125 0.4047937500000001 +0.047375 0.09747314453125 0.4047937500000001 +0.0475 0.113739013671875 0.4047937500000001 +0.047625 0.130615234375 0.4047937500000001 +0.04775 0.144561767578125 0.4047937500000001 +0.047875 0.1585693359375 0.4047937500000001 +0.048 0.17083740234375 0.4047937500000001 +0.048125 0.1802978515625 0.4047937500000001 +0.04825 0.18890380859375 0.4047937500000001 +0.048375 0.19488525390625 0.4047937500000001 +0.0485 0.19952392578125 0.4047937500000001 +0.048625 0.20196533203125 0.4047937500000001 +0.04875 0.202239990234375 0.4047937500000001 +0.048875 0.200469970703125 0.4047937500000001 +0.049 0.197021484375 0.4047937500000001 +0.04912500000000001 0.19110107421875 0.4047937500000001 +0.04925000000000001 0.18310546875 0.4047937500000001 +0.049375 0.174163818359375 0.4047937500000001 +0.0495 0.162445068359375 0.4047937500000001 +0.049625 0.150360107421875 0.4047937500000001 +0.04975000000000001 0.135406494140625 0.4047937500000001 +0.04987500000000001 0.118927001953125 0.4047937500000001 +0.05 0.102996826171875 0.4047937500000001 +0.05012499999999999 0.084228515625 0.4047937500000001 +0.05025 0.0665283203125 0.4047937500000001 +0.05037500000000001 0.04620361328125 0.4047937500000001 +0.0505 0.02532958984375 0.4047937500000001 +0.05062500000000001 0.00634765625 0.4047937500000001 +0.05075000000000001 -0.014801025390625 0.4047937500000001 +0.050875 -0.033721923828125 0.4047937500000001 +0.051 -0.054412841796875 0.4047937500000001 +0.051125 -0.074493408203125 0.4047937500000001 +0.05125000000000001 -0.09185791015625 0.4047937500000001 +0.051375 -0.110198974609375 0.4047937500000001 +0.0515 -0.12567138671875 0.4047937500000001 +0.05162500000000001 -0.141571044921875 0.4047937500000001 +0.05175000000000001 -0.155914306640625 0.4047937500000001 +0.051875 -0.1673583984375 0.4047937500000001 +0.052 -0.1783447265625 0.4047937500000001 +0.052125 -0.186553955078125 0.4047937500000001 +0.05225 -0.1937255859375 0.4047937500000001 +0.05237499999999999 -0.198760986328125 0.4047937500000001 +0.0525 -0.201446533203125 0.4047937500000001 +0.052625 -0.20233154296875 0.4047937500000001 +0.05274999999999999 -0.20123291015625 0.4047937500000001 +0.052875 -0.19793701171875 0.4047937500000001 +0.05300000000000001 -0.19244384765625 0.4047937500000001 +0.053125 -0.185699462890625 0.4047937500000001 +0.05324999999999999 -0.176300048828125 0.4047937500000001 +0.05337499999999999 -0.166168212890625 0.4047937500000001 +0.05350000000000001 -0.153167724609375 0.4047937500000001 +0.053625 -0.138519287109375 0.4047937500000001 +0.05375 -0.1240234375 0.4047937500000001 +0.05387499999999999 -0.10662841796875 0.4047937500000001 +0.054 -0.0899658203125 0.4047937500000001 +0.054125 -0.070526123046875 0.4047937500000001 +0.05425 -0.05029296875 0.4047937500000001 +0.054375 -0.031646728515625 0.4047937500000001 +0.0545 -0.01055908203125 0.4047937500000001 +0.054625 0.008453369140625 0.4047937500000001 +0.05475 0.029541015625 0.4047937500000001 +0.054875 0.05029296875 0.4047937500000001 +0.055 0.06854248046875 0.4047937500000001 +0.055125 0.08807373046875 0.4047937500000001 +0.05525 0.104827880859375 0.4047937500000001 +0.055375 0.122344970703125 0.4047937500000001 +0.05550000000000001 0.138519287109375 0.4047937500000001 +0.055625 0.15179443359375 0.4047937500000001 +0.05575 0.164947509765625 0.4047937500000001 +0.05587499999999999 0.17523193359375 0.4047937500000001 +0.05600000000000001 0.184844970703125 0.4047937500000001 +0.05612500000000001 0.19244384765625 0.4047937500000001 +0.05625 0.197479248046875 0.4047937500000001 +0.05637499999999999 0.201019287109375 0.4047937500000001 +0.0565 0.202301025390625 0.4047937500000001 +0.05662500000000001 0.20166015625 0.4047937500000001 +0.05675 0.198760986328125 0.4047937500000001 +0.056875 0.194305419921875 0.4047937500000001 +0.05700000000000001 0.187347412109375 0.4047937500000001 +0.057125 0.1793212890625 0.4047937500000001 +0.05725 0.168548583984375 0.4047937500000001 +0.057375 0.155914306640625 0.4047937500000001 +0.05750000000000001 0.14306640625 0.4047937500000001 +0.057625 0.127349853515625 0.4047937500000001 +0.05775 0.111968994140625 0.4047937500000001 +0.057875 0.09375 0.4047937500000001 +0.05800000000000001 0.074493408203125 0.4047937500000001 +0.058125 0.056427001953125 0.4047937500000001 +0.05825 0.03582763671875 0.4047937500000001 +0.058375 0.01690673828125 0.4047937500000001 +0.05850000000000001 -0.00421142578125 0.4047937500000001 +0.05862500000000001 -0.02532958984375 0.4047937500000001 +0.05875 -0.04412841796875 0.4047937500000001 +0.058875 -0.064544677734375 0.4047937500000001 +0.059 -0.082305908203125 0.4047937500000001 +0.05912500000000001 -0.101165771484375 0.4047937500000001 +0.05925000000000001 -0.118927001953125 0.4047937500000001 +0.059375 -0.133819580078125 0.4047937500000001 +0.05950000000000001 -0.148956298828125 0.4047937500000001 +0.059625 -0.161163330078125 0.4047937500000001 +0.05975000000000001 -0.173095703125 0.4047937500000001 +0.059875 -0.18310546875 0.4047937500000001 +0.06 -0.190399169921875 0.4047937500000001 +0.06012499999999999 -0.196502685546875 0.4047937500000001 +0.06025 -0.2001953125 0.4047937500000001 +0.060375 -0.202178955078125 0.4047937500000001 +0.0605 -0.20196533203125 0.4047937500000001 +0.060625 -0.199859619140625 0.4047937500000001 +0.06074999999999999 -0.195465087890625 0.4047937500000001 +0.060875 -0.189666748046875 0.4047937500000001 +0.061 -0.181243896484375 0.4047937500000001 +0.061125 -0.17083740234375 0.4047937500000001 +0.06125 -0.159881591796875 0.4047937500000001 +0.061375 -0.14605712890625 0.4047937500000001 +0.0615 -0.1322021484375 0.4047937500000001 +0.061625 -0.115478515625 0.4047937500000001 +0.06174999999999999 -0.09747314453125 0.4047937500000001 +0.061875 -0.080352783203125 0.4047937500000001 +0.062 -0.06048583984375 0.4047937500000001 +0.06212499999999999 -0.04205322265625 0.4047937500000001 +0.06225000000000001 -0.021148681640625 0.4047937500000001 +0.06237500000000001 0.0 0.4047937500000001 +0.0625 0.019012451171875 0.4047937500000001 +0.06262499999999999 0.03997802734375 0.4047937500000001 +0.06274999999999999 0.0584716796875 0.4047937500000001 +0.06287500000000001 0.078399658203125 0.4047937500000001 +0.063 0.09747314453125 0.4047937500000001 +0.063125 0.113739013671875 0.4047937500000001 +0.06325000000000001 0.130615234375 0.4047937500000001 +0.063375 0.144561767578125 0.4047937500000001 +0.0635 0.1585693359375 0.4047937500000001 +0.063625 0.17083740234375 0.4047937500000001 +0.06375 0.1802978515625 0.4047937500000001 +0.063875 0.18890380859375 0.4047937500000001 +0.064 0.24420166015625 0.507190625 +0.064125 0.25 0.507190625 +0.06425000000000001 0.2530517578125 0.507190625 +0.064375 0.25341796875 0.507190625 +0.0645 0.251220703125 0.507190625 +0.064625 0.246856689453125 0.507190625 +0.06475 0.23944091796875 0.507190625 +0.06487500000000001 0.22943115234375 0.507190625 +0.065 0.218231201171875 0.507190625 +0.065125 0.20355224609375 0.507190625 +0.06525 0.18841552734375 0.507190625 +0.06537500000000001 0.169647216796875 0.507190625 +0.06550000000000001 0.149017333984375 0.507190625 +0.065625 0.129058837890625 0.507190625 +0.06574999999999999 0.10552978515625 0.507190625 +0.065875 0.0833740234375 0.507190625 +0.06600000000000001 0.057891845703125 0.507190625 +0.066125 0.031768798828125 0.507190625 +0.06625000000000001 0.0079345703125 0.507190625 +0.06637500000000001 -0.0185546875 0.507190625 +0.0665 -0.042266845703125 0.507190625 +0.066625 -0.06817626953125 0.507190625 +0.06675 -0.09332275390625 0.507190625 +0.06687500000000001 -0.1151123046875 0.507190625 +0.067 -0.138092041015625 0.507190625 +0.067125 -0.157501220703125 0.507190625 +0.06725000000000001 -0.177398681640625 0.507190625 +0.06737500000000001 -0.19537353515625 0.507190625 +0.0675 -0.209716796875 0.507190625 +0.067625 -0.22344970703125 0.507190625 +0.06775 -0.233734130859375 0.507190625 +0.06787500000000001 -0.24273681640625 0.507190625 +0.06800000000000001 -0.249053955078125 0.507190625 +0.068125 -0.25244140625 0.507190625 +0.06825000000000001 -0.2535400390625 0.507190625 +0.068375 -0.252166748046875 0.507190625 +0.06850000000000001 -0.248016357421875 0.507190625 +0.06862500000000001 -0.24114990234375 0.507190625 +0.06875 -0.232696533203125 0.507190625 +0.06887500000000001 -0.220916748046875 0.507190625 +0.069 -0.20819091796875 0.507190625 +0.06912500000000001 -0.191925048828125 0.507190625 +0.06925000000000001 -0.173553466796875 0.507190625 +0.06937500000000001 -0.1553955078125 0.507190625 +0.06950000000000001 -0.13360595703125 0.507190625 +0.069625 -0.11273193359375 0.507190625 +0.06975 -0.08837890625 0.507190625 +0.06987500000000001 -0.06304931640625 0.507190625 +0.07000000000000001 -0.039642333984375 0.507190625 +0.070125 -0.01324462890625 0.507190625 +0.07025000000000001 0.010589599609375 0.507190625 +0.07037500000000001 0.037017822265625 0.507190625 +0.07050000000000001 0.06304931640625 0.507190625 +0.070625 0.08587646484375 0.507190625 +0.07075 0.1103515625 0.507190625 +0.07087500000000001 0.13134765625 0.507190625 +0.07100000000000001 0.153289794921875 0.507190625 +0.07112500000000001 0.173553466796875 0.507190625 +0.07125000000000002 0.190185546875 0.507190625 +0.07137500000000001 0.206695556640625 0.507190625 +0.0715 0.2196044921875 0.507190625 +0.07162500000000001 0.23162841796875 0.507190625 +0.07175000000000001 0.24114990234375 0.507190625 +0.07187500000000001 0.2474365234375 0.507190625 +0.07200000000000001 0.251861572265625 0.507190625 +0.07212499999999999 0.253509521484375 0.507190625 +0.07225 0.252685546875 0.507190625 +0.07237499999999999 0.249053955078125 0.507190625 +0.0725 0.243499755859375 0.507190625 +0.07262499999999999 0.234771728515625 0.507190625 +0.07274999999999999 0.224700927734375 0.507190625 +0.072875 0.211181640625 0.507190625 +0.073 0.19537353515625 0.507190625 +0.073125 0.179290771484375 0.507190625 +0.07324999999999999 0.1595458984375 0.507190625 +0.07337499999999999 0.14031982421875 0.507190625 +0.0735 0.117462158203125 0.507190625 +0.073625 0.09332275390625 0.507190625 +0.07374999999999999 0.07073974609375 0.507190625 +0.073875 0.044891357421875 0.507190625 +0.074 0.021209716796875 0.507190625 +0.074125 -0.005279541015625 0.507190625 +0.07424999999999999 -0.031768798828125 0.507190625 +0.07437499999999999 -0.0552978515625 0.507190625 +0.0745 -0.08087158203125 0.507190625 +0.07462499999999999 -0.103118896484375 0.507190625 +0.07475 -0.12677001953125 0.507190625 +0.07487500000000001 -0.149017333984375 0.507190625 +0.075 -0.16766357421875 0.507190625 +0.07512499999999999 -0.1866455078125 0.507190625 +0.07524999999999999 -0.20196533203125 0.507190625 +0.075375 -0.216888427734375 0.507190625 +0.0755 -0.22943115234375 0.507190625 +0.075625 -0.238555908203125 0.507190625 +0.07574999999999999 -0.246246337890625 0.507190625 +0.075875 -0.250823974609375 0.507190625 +0.076 -0.253326416015625 0.507190625 +0.076125 -0.2530517578125 0.507190625 +0.07625 -0.25042724609375 0.507190625 +0.07637499999999999 -0.244903564453125 0.507190625 +0.0765 -0.237640380859375 0.507190625 +0.076625 -0.22711181640625 0.507190625 +0.07675 -0.214080810546875 0.507190625 +0.076875 -0.200347900390625 0.507190625 +0.077 -0.183013916015625 0.507190625 +0.077125 -0.165679931640625 0.507190625 +0.07725 -0.14471435546875 0.507190625 +0.07737499999999999 -0.12213134765625 0.507190625 +0.0775 -0.100677490234375 0.507190625 +0.077625 -0.0758056640625 0.507190625 +0.07774999999999999 -0.052703857421875 0.507190625 +0.07787500000000001 -0.0264892578125 0.507190625 +0.07800000000000001 0.0 0.507190625 +0.078125 0.023834228515625 0.507190625 +0.07824999999999999 0.05010986328125 0.507190625 +0.07837499999999999 0.073272705078125 0.507190625 +0.07850000000000001 0.098236083984375 0.507190625 +0.078625 0.12213134765625 0.507190625 +0.07875 0.14251708984375 0.507190625 +0.07887500000000001 0.163665771484375 0.507190625 +0.079 0.18115234375 0.507190625 +0.079125 0.198699951171875 0.507190625 +0.07925 0.214080810546875 0.507190625 +0.079375 0.225921630859375 0.507190625 +0.0795 0.236724853515625 0.507190625 +0.079625 0.24420166015625 0.507190625 +0.07975 0.25 0.507190625 +0.07987500000000001 0.2530517578125 0.507190625 +0.08 0.25341796875 0.507190625 +0.08012499999999999 0.251220703125 0.507190625 +0.08025 0.246856689453125 0.507190625 +0.080375 0.23944091796875 0.507190625 +0.08050000000000001 0.22943115234375 0.507190625 +0.080625 0.218231201171875 0.507190625 +0.08074999999999999 0.20355224609375 0.507190625 +0.080875 0.18841552734375 0.507190625 +0.08100000000000001 0.169647216796875 0.507190625 +0.08112500000000001 0.149017333984375 0.507190625 +0.08125 0.129058837890625 0.507190625 +0.08137499999999999 0.10552978515625 0.507190625 +0.0815 0.0833740234375 0.507190625 +0.081625 0.057891845703125 0.507190625 +0.08175000000000001 0.031768798828125 0.507190625 +0.081875 0.0079345703125 0.507190625 +0.08200000000000001 -0.0185546875 0.507190625 +0.082125 -0.042266845703125 0.507190625 +0.08225 -0.06817626953125 0.507190625 +0.08237500000000001 -0.09332275390625 0.507190625 +0.0825 -0.1151123046875 0.507190625 +0.08262500000000001 -0.138092041015625 0.507190625 +0.08275 -0.157501220703125 0.507190625 +0.08287500000000001 -0.177398681640625 0.507190625 +0.08300000000000001 -0.19537353515625 0.507190625 +0.083125 -0.209716796875 0.507190625 +0.08324999999999999 -0.22344970703125 0.507190625 +0.083375 -0.233734130859375 0.507190625 +0.08350000000000001 -0.24273681640625 0.507190625 +0.08362500000000001 -0.249053955078125 0.507190625 +0.08375 -0.25244140625 0.507190625 +0.08387500000000001 -0.2535400390625 0.507190625 +0.084 -0.252166748046875 0.507190625 +0.08412500000000001 -0.248016357421875 0.507190625 +0.08425000000000001 -0.24114990234375 0.507190625 +0.084375 -0.232696533203125 0.507190625 +0.08450000000000001 -0.220916748046875 0.507190625 +0.084625 -0.20819091796875 0.507190625 +0.08475 -0.191925048828125 0.507190625 +0.08487500000000001 -0.173553466796875 0.507190625 +0.085 -0.1553955078125 0.507190625 +0.08512500000000001 -0.13360595703125 0.507190625 +0.08525 -0.11273193359375 0.507190625 +0.085375 -0.08837890625 0.507190625 +0.08550000000000001 -0.06304931640625 0.507190625 +0.085625 -0.039642333984375 0.507190625 +0.08575000000000001 -0.01324462890625 0.507190625 +0.08587500000000002 0.010589599609375 0.507190625 +0.08600000000000001 0.037017822265625 0.507190625 +0.08612500000000001 0.06304931640625 0.507190625 +0.08625 0.08587646484375 0.507190625 +0.08637499999999999 0.1103515625 0.507190625 +0.0865 0.13134765625 0.507190625 +0.08662500000000001 0.153289794921875 0.507190625 +0.08675000000000001 0.173553466796875 0.507190625 +0.08687500000000002 0.190185546875 0.507190625 +0.08700000000000001 0.206695556640625 0.507190625 +0.087125 0.2196044921875 0.507190625 +0.08725000000000001 0.23162841796875 0.507190625 +0.08737500000000001 0.24114990234375 0.507190625 +0.08750000000000002 0.2474365234375 0.507190625 +0.08762500000000001 0.251861572265625 0.507190625 +0.08775 0.253509521484375 0.507190625 +0.08787500000000001 0.252685546875 0.507190625 +0.08799999999999999 0.249053955078125 0.507190625 +0.088125 0.243499755859375 0.507190625 +0.08824999999999999 0.234771728515625 0.507190625 +0.08837499999999999 0.224700927734375 0.507190625 +0.0885 0.211181640625 0.507190625 +0.08862500000000001 0.19537353515625 0.507190625 +0.08875 0.179290771484375 0.507190625 +0.08887499999999999 0.1595458984375 0.507190625 +0.08899999999999999 0.14031982421875 0.507190625 +0.089125 0.117462158203125 0.507190625 +0.08924999999999999 0.09332275390625 0.507190625 +0.089375 0.07073974609375 0.507190625 +0.08949999999999999 0.044891357421875 0.507190625 +0.089625 0.021209716796875 0.507190625 +0.08975 -0.005279541015625 0.507190625 +0.08987499999999999 -0.031768798828125 0.507190625 +0.09 -0.0552978515625 0.507190625 +0.09012499999999999 -0.08087158203125 0.507190625 +0.09025 -0.103118896484375 0.507190625 +0.090375 -0.12677001953125 0.507190625 +0.09050000000000001 -0.149017333984375 0.507190625 +0.090625 -0.16766357421875 0.507190625 +0.09074999999999999 -0.1866455078125 0.507190625 +0.09087499999999999 -0.20196533203125 0.507190625 +0.091 -0.216888427734375 0.507190625 +0.09112500000000001 -0.22943115234375 0.507190625 +0.09125 -0.238555908203125 0.507190625 +0.09137499999999999 -0.246246337890625 0.507190625 +0.0915 -0.250823974609375 0.507190625 +0.091625 -0.253326416015625 0.507190625 +0.09175000000000001 -0.2530517578125 0.507190625 +0.091875 -0.25042724609375 0.507190625 +0.09199999999999999 -0.244903564453125 0.507190625 +0.092125 -0.237640380859375 0.507190625 +0.09225 -0.22711181640625 0.507190625 +0.09237499999999999 -0.214080810546875 0.507190625 +0.0925 -0.200347900390625 0.507190625 +0.09262499999999999 -0.183013916015625 0.507190625 +0.09275 -0.165679931640625 0.507190625 +0.092875 -0.14471435546875 0.507190625 +0.09299999999999999 -0.12213134765625 0.507190625 +0.093125 -0.100677490234375 0.507190625 +0.09324999999999999 -0.0758056640625 0.507190625 +0.093375 -0.052703857421875 0.507190625 +0.09350000000000001 -0.0264892578125 0.507190625 +0.09362500000000001 0.0 0.507190625 +0.09375 0.023834228515625 0.507190625 +0.09387499999999999 0.05010986328125 0.507190625 +0.09399999999999999 0.073272705078125 0.507190625 +0.094125 0.098236083984375 0.507190625 +0.09425000000000001 0.12213134765625 0.507190625 +0.094375 0.14251708984375 0.507190625 +0.09450000000000001 0.163665771484375 0.507190625 +0.094625 0.18115234375 0.507190625 +0.09475 0.198699951171875 0.507190625 +0.09487500000000001 0.214080810546875 0.507190625 +0.095 0.225921630859375 0.507190625 +0.09512500000000001 0.236724853515625 0.507190625 +0.09525 0.24420166015625 0.507190625 +0.095375 0.25 0.507190625 +0.09550000000000001 0.2530517578125 0.507190625 +0.095625 0.25341796875 0.507190625 +0.09574999999999999 0.251220703125 0.507190625 +0.095875 0.246856689453125 0.507190625 +0.096 0.287811279296875 0.6095875 +0.09612500000000001 0.2757568359375 0.6095875 +0.09625 0.262298583984375 0.6095875 +0.09637499999999999 0.244659423828125 0.6095875 +0.0965 0.226470947265625 0.6095875 +0.09662500000000001 0.20391845703125 0.6095875 +0.09675000000000001 0.179107666015625 0.6095875 +0.096875 0.155120849609375 0.6095875 +0.09699999999999999 0.126861572265625 0.6095875 +0.097125 0.100189208984375 0.6095875 +0.09725 0.069580078125 0.6095875 +0.09737500000000001 0.038177490234375 0.6095875 +0.0975 0.009552001953125 0.6095875 +0.09762500000000001 -0.022308349609375 0.6095875 +0.09775 -0.050811767578125 0.6095875 +0.097875 -0.081939697265625 0.6095875 +0.09800000000000001 -0.1121826171875 0.6095875 +0.098125 -0.138336181640625 0.6095875 +0.09825000000000001 -0.165985107421875 0.6095875 +0.098375 -0.189300537109375 0.6095875 +0.09850000000000001 -0.213226318359375 0.6095875 +0.09862500000000001 -0.23480224609375 0.6095875 +0.09875 -0.252044677734375 0.6095875 +0.09887499999999999 -0.268585205078125 0.6095875 +0.099 -0.28094482421875 0.6095875 +0.09912500000000001 -0.291748046875 0.6095875 +0.09925000000000001 -0.299346923828125 0.6095875 +0.099375 -0.30340576171875 0.6095875 +0.09950000000000001 -0.30474853515625 0.6095875 +0.099625 -0.303070068359375 0.6095875 +0.09975000000000001 -0.298095703125 0.6095875 +0.09987500000000001 -0.289825439453125 0.6095875 +0.1 -0.279693603515625 0.6095875 +0.100125 -0.2655029296875 0.6095875 +0.10025 -0.250244140625 0.6095875 +0.100375 -0.230682373046875 0.6095875 +0.1005 -0.2086181640625 0.6095875 +0.100625 -0.186767578125 0.6095875 +0.10075 -0.16058349609375 0.6095875 +0.100875 -0.135498046875 0.6095875 +0.101 -0.106201171875 0.6095875 +0.101125 -0.075775146484375 0.6095875 +0.10125 -0.047637939453125 0.6095875 +0.101375 -0.01593017578125 0.6095875 +0.1015 0.01275634765625 0.6095875 +0.101625 0.04449462890625 0.6095875 +0.10175 0.075775146484375 0.6095875 +0.101875 0.10321044921875 0.6095875 +0.102 0.13262939453125 0.6095875 +0.102125 0.157867431640625 0.6095875 +0.10225 0.184234619140625 0.6095875 +0.102375 0.2086181640625 0.6095875 +0.1025 0.22857666015625 0.6095875 +0.102625 0.2484130859375 0.6095875 +0.10275 0.263916015625 0.6095875 +0.102875 0.278411865234375 0.6095875 +0.103 0.289825439453125 0.6095875 +0.103125 0.297393798828125 0.6095875 +0.10325 0.302734375 0.6095875 +0.103375 0.3046875 0.6095875 +0.1035 0.303680419921875 0.6095875 +0.103625 0.299346923828125 0.6095875 +0.10375 0.292633056640625 0.6095875 +0.103875 0.28216552734375 0.6095875 +0.104 0.27008056640625 0.6095875 +0.104125 0.25384521484375 0.6095875 +0.10425 0.23480224609375 0.6095875 +0.104375 0.215484619140625 0.6095875 +0.1045 0.1917724609375 0.6095875 +0.104625 0.16864013671875 0.6095875 +0.10475 0.14117431640625 0.6095875 +0.104875 0.1121826171875 0.6095875 +0.105 0.084991455078125 0.6095875 +0.105125 0.053955078125 0.6095875 +0.10525 0.025482177734375 0.6095875 +0.105375 -0.006378173828125 0.6095875 +0.1055 -0.038177490234375 0.6095875 +0.105625 -0.06646728515625 0.6095875 +0.10575 -0.097198486328125 0.6095875 +0.105875 -0.123931884765625 0.6095875 +0.106 -0.152374267578125 0.6095875 +0.106125 -0.179107666015625 0.6095875 +0.10625 -0.2015380859375 0.6095875 +0.106375 -0.22430419921875 0.6095875 +0.1065 -0.24273681640625 0.6095875 +0.106625 -0.26068115234375 0.6095875 +0.10675 -0.2757568359375 0.6095875 +0.106875 -0.2867431640625 0.6095875 +0.107 -0.29595947265625 0.6095875 +0.107125 -0.301483154296875 0.6095875 +0.10725 -0.304473876953125 0.6095875 +0.107375 -0.30413818359375 0.6095875 +0.1075 -0.300994873046875 0.6095875 +0.107625 -0.29437255859375 0.6095875 +0.10775 -0.28564453125 0.6095875 +0.107875 -0.27294921875 0.6095875 +0.108 -0.25732421875 0.6095875 +0.108125 -0.240814208984375 0.6095875 +0.10825 -0.219940185546875 0.6095875 +0.108375 -0.199127197265625 0.6095875 +0.1085 -0.173919677734375 0.6095875 +0.108625 -0.14678955078125 0.6095875 +0.10875 -0.12103271484375 0.6095875 +0.108875 -0.09112548828125 0.6095875 +0.109 -0.0633544921875 0.6095875 +0.109125 -0.031829833984375 0.6095875 +0.10925 0.0 0.6095875 +0.109375 0.028656005859375 0.6095875 +0.1095 0.060211181640625 0.6095875 +0.109625 0.08807373046875 0.6095875 +0.10975 0.118072509765625 0.6095875 +0.109875 0.14678955078125 0.6095875 +0.11 0.171295166015625 0.6095875 +0.110125 0.196685791015625 0.6095875 +0.11025 0.217742919921875 0.6095875 +0.110375 0.23883056640625 0.6095875 +0.1105 0.25732421875 0.6095875 +0.110625 0.27154541015625 0.6095875 +0.11075 0.284515380859375 0.6095875 +0.110875 0.29351806640625 0.6095875 +0.111 0.30047607421875 0.6095875 +0.111125 0.30413818359375 0.6095875 +0.11125 0.304595947265625 0.6095875 +0.111375 0.30194091796875 0.6095875 +0.1115 0.29669189453125 0.6095875 +0.111625 0.287811279296875 0.6095875 +0.11175 0.2757568359375 0.6095875 +0.111875 0.262298583984375 0.6095875 +0.112 0.244659423828125 0.6095875 +0.112125 0.226470947265625 0.6095875 +0.11225 0.20391845703125 0.6095875 +0.112375 0.179107666015625 0.6095875 +0.1125 0.155120849609375 0.6095875 +0.112625 0.126861572265625 0.6095875 +0.11275 0.100189208984375 0.6095875 +0.112875 0.069580078125 0.6095875 +0.113 0.038177490234375 0.6095875 +0.113125 0.009552001953125 0.6095875 +0.11325 -0.022308349609375 0.6095875 +0.113375 -0.050811767578125 0.6095875 +0.1135 -0.081939697265625 0.6095875 +0.113625 -0.1121826171875 0.6095875 +0.11375 -0.138336181640625 0.6095875 +0.113875 -0.165985107421875 0.6095875 +0.114 -0.189300537109375 0.6095875 +0.114125 -0.213226318359375 0.6095875 +0.11425 -0.23480224609375 0.6095875 +0.114375 -0.252044677734375 0.6095875 +0.1145 -0.268585205078125 0.6095875 +0.114625 -0.28094482421875 0.6095875 +0.11475 -0.291748046875 0.6095875 +0.114875 -0.299346923828125 0.6095875 +0.115 -0.30340576171875 0.6095875 +0.115125 -0.30474853515625 0.6095875 +0.11525 -0.303070068359375 0.6095875 +0.115375 -0.298095703125 0.6095875 +0.1155 -0.289825439453125 0.6095875 +0.115625 -0.279693603515625 0.6095875 +0.11575 -0.2655029296875 0.6095875 +0.115875 -0.250244140625 0.6095875 +0.116 -0.230682373046875 0.6095875 +0.116125 -0.2086181640625 0.6095875 +0.11625 -0.186767578125 0.6095875 +0.116375 -0.16058349609375 0.6095875 +0.1165 -0.135498046875 0.6095875 +0.116625 -0.106201171875 0.6095875 +0.11675 -0.075775146484375 0.6095875 +0.116875 -0.047637939453125 0.6095875 +0.117 -0.01593017578125 0.6095875 +0.117125 0.01275634765625 0.6095875 +0.11725 0.04449462890625 0.6095875 +0.117375 0.075775146484375 0.6095875 +0.1175 0.10321044921875 0.6095875 +0.117625 0.13262939453125 0.6095875 +0.11775 0.157867431640625 0.6095875 +0.117875 0.184234619140625 0.6095875 +0.118 0.2086181640625 0.6095875 +0.118125 0.22857666015625 0.6095875 +0.11825 0.2484130859375 0.6095875 +0.118375 0.263916015625 0.6095875 +0.1185 0.278411865234375 0.6095875 +0.118625 0.289825439453125 0.6095875 +0.11875 0.297393798828125 0.6095875 +0.118875 0.302734375 0.6095875 +0.119 0.3046875 0.6095875 +0.119125 0.303680419921875 0.6095875 +0.11925 0.299346923828125 0.6095875 +0.119375 0.292633056640625 0.6095875 +0.1195 0.28216552734375 0.6095875 +0.119625 0.27008056640625 0.6095875 +0.11975 0.25384521484375 0.6095875 +0.119875 0.23480224609375 0.6095875 +0.12 0.215484619140625 0.6095875 +0.120125 0.1917724609375 0.6095875 +0.12025 0.16864013671875 0.6095875 +0.120375 0.14117431640625 0.6095875 +0.1205 0.1121826171875 0.6095875 +0.120625 0.084991455078125 0.6095875 +0.12075 0.053955078125 0.6095875 +0.120875 0.025482177734375 0.6095875 +0.121 -0.006378173828125 0.6095875 +0.121125 -0.038177490234375 0.6095875 +0.12125 -0.06646728515625 0.6095875 +0.121375 -0.097198486328125 0.6095875 +0.1215 -0.123931884765625 0.6095875 +0.121625 -0.152374267578125 0.6095875 +0.12175 -0.179107666015625 0.6095875 +0.121875 -0.2015380859375 0.6095875 +0.122 -0.22430419921875 0.6095875 +0.122125 -0.24273681640625 0.6095875 +0.12225 -0.26068115234375 0.6095875 +0.122375 -0.2757568359375 0.6095875 +0.1225 -0.2867431640625 0.6095875 +0.122625 -0.29595947265625 0.6095875 +0.12275 -0.301483154296875 0.6095875 +0.122875 -0.304473876953125 0.6095875 +0.123 -0.30413818359375 0.6095875 +0.123125 -0.300994873046875 0.6095875 +0.12325 -0.29437255859375 0.6095875 +0.123375 -0.28564453125 0.6095875 +0.1235 -0.27294921875 0.6095875 +0.123625 -0.25732421875 0.6095875 +0.12375 -0.240814208984375 0.6095875 +0.123875 -0.219940185546875 0.6095875 +0.124 -0.199127197265625 0.6095875 +0.124125 -0.173919677734375 0.6095875 +0.12425 -0.14678955078125 0.6095875 +0.124375 -0.12103271484375 0.6095875 +0.1245 -0.09112548828125 0.6095875 +0.124625 -0.0633544921875 0.6095875 +0.12475 -0.031829833984375 0.6095875 +0.124875 0.0 0.6095875 +0.125 0.028656005859375 0.6095875 +0.125125 0.060211181640625 0.6095875 +0.12525 0.08807373046875 0.6095875 +0.125375 0.118072509765625 0.6095875 +0.1255 0.14678955078125 0.6095875 +0.125625 0.171295166015625 0.6095875 +0.12575 0.196685791015625 0.6095875 +0.125875 0.217742919921875 0.6095875 +0.126 0.23883056640625 0.6095875 +0.126125 0.25732421875 0.6095875 +0.12625 0.27154541015625 0.6095875 +0.126375 0.284515380859375 0.6095875 +0.1265 0.29351806640625 0.6095875 +0.126625 0.30047607421875 0.6095875 +0.12675 0.30413818359375 0.6095875 +0.126875 0.304595947265625 0.6095875 +0.127 0.30194091796875 0.6095875 +0.127125 0.29669189453125 0.6095875 +0.12725 0.287811279296875 0.6095875 +0.127375 0.2757568359375 0.6095875 +0.1275 0.262298583984375 0.6095875 +0.127625 0.244659423828125 0.6095875 +0.12775 0.226470947265625 0.6095875 +0.127875 0.20391845703125 0.6095875 +0.128 0.209197998046875 0.7119843750000001 +0.128125 0.181182861328125 0.7119843750000001 +0.12825 0.148162841796875 0.7119843750000001 +0.128375 0.117034912109375 0.7119843750000001 +0.1285 0.081268310546875 0.7119843750000001 +0.128625 0.044586181640625 0.7119843750000001 +0.12875 0.01116943359375 0.7119843750000001 +0.128875 -0.026031494140625 0.7119843750000001 +0.129 -0.059356689453125 0.7119843750000001 +0.129125 -0.095703125 0.7119843750000001 +0.12925 -0.131011962890625 0.7119843750000001 +0.129375 -0.161590576171875 0.7119843750000001 +0.1295 -0.19384765625 0.7119843750000001 +0.129625 -0.221099853515625 0.7119843750000001 +0.12975 -0.2490234375 0.7119843750000001 +0.129875 -0.274261474609375 0.7119843750000001 +0.13 -0.29437255859375 0.7119843750000001 +0.130125 -0.313690185546875 0.7119843750000001 +0.13025 -0.328125 0.7119843750000001 +0.130375 -0.34075927734375 0.7119843750000001 +0.1305 -0.349639892578125 0.7119843750000001 +0.130625 -0.3543701171875 0.7119843750000001 +0.13075 -0.355926513671875 0.7119843750000001 +0.130875 -0.35400390625 0.7119843750000001 +0.131 -0.34814453125 0.7119843750000001 +0.131125 -0.338531494140625 0.7119843750000001 +0.13125 -0.32666015625 0.7119843750000001 +0.131375 -0.310089111328125 0.7119843750000001 +0.1315 -0.292266845703125 0.7119843750000001 +0.131625 -0.269439697265625 0.7119843750000001 +0.13175 -0.24365234375 0.7119843750000001 +0.131875 -0.2181396484375 0.7119843750000001 +0.132 -0.18756103515625 0.7119843750000001 +0.132125 -0.15826416015625 0.7119843750000001 +0.13225 -0.124053955078125 0.7119843750000001 +0.132375 -0.0885009765625 0.7119843750000001 +0.1325 -0.0556640625 0.7119843750000001 +0.132625 -0.01861572265625 0.7119843750000001 +0.13275 0.014892578125 0.7119843750000001 +0.132875 0.051971435546875 0.7119843750000001 +0.133 0.0885009765625 0.7119843750000001 +0.133125 0.12054443359375 0.7119843750000001 +0.13325 0.1549072265625 0.7119843750000001 +0.133375 0.18438720703125 0.7119843750000001 +0.1335 0.215179443359375 0.7119843750000001 +0.133625 0.24365234375 0.7119843750000001 +0.13375 0.266998291015625 0.7119843750000001 +0.133875 0.290130615234375 0.7119843750000001 +0.134 0.308258056640625 0.7119843750000001 +0.134125 0.325164794921875 0.7119843750000001 +0.13425 0.338531494140625 0.7119843750000001 +0.134375 0.34735107421875 0.7119843750000001 +0.1345 0.35357666015625 0.7119843750000001 +0.134625 0.355865478515625 0.7119843750000001 +0.13475 0.354705810546875 0.7119843750000001 +0.134875 0.349639892578125 0.7119843750000001 +0.135 0.341796875 0.7119843750000001 +0.135125 0.329559326171875 0.7119843750000001 +0.13525 0.3154296875 0.7119843750000001 +0.135375 0.296478271484375 0.7119843750000001 +0.1355 0.274261474609375 0.7119843750000001 +0.135625 0.251678466796875 0.7119843750000001 +0.13575 0.2239990234375 0.7119843750000001 +0.135875 0.19696044921875 0.7119843750000001 +0.136 0.164886474609375 0.7119843750000001 +0.136125 0.131011962890625 0.7119843750000001 +0.13625 0.099273681640625 0.7119843750000001 +0.136375 0.063018798828125 0.7119843750000001 +0.1365 0.029754638671875 0.7119843750000001 +0.136625 -0.0074462890625 0.7119843750000001 +0.13675 -0.044586181640625 0.7119843750000001 +0.136875 -0.07763671875 0.7119843750000001 +0.137 -0.113525390625 0.7119843750000001 +0.137125 -0.144775390625 0.7119843750000001 +0.13725 -0.177947998046875 0.7119843750000001 +0.137375 -0.209197998046875 0.7119843750000001 +0.1375 -0.235382080078125 0.7119843750000001 +0.137625 -0.261993408203125 0.7119843750000001 +0.13775 -0.28350830078125 0.7119843750000001 +0.137875 -0.304443359375 0.7119843750000001 +0.138 -0.322052001953125 0.7119843750000001 +0.138125 -0.33489990234375 0.7119843750000001 +0.13825 -0.345672607421875 0.7119843750000001 +0.138375 -0.35211181640625 0.7119843750000001 +0.1385 -0.355621337890625 0.7119843750000001 +0.138625 -0.355255126953125 0.7119843750000001 +0.13875 -0.3515625 0.7119843750000001 +0.138875 -0.34381103515625 0.7119843750000001 +0.139 -0.3336181640625 0.7119843750000001 +0.139125 -0.318817138671875 0.7119843750000001 +0.13925 -0.300537109375 0.7119843750000001 +0.139375 -0.28125 0.7119843750000001 +0.1395 -0.25689697265625 0.7119843750000001 +0.139625 -0.232574462890625 0.7119843750000001 +0.13975 -0.203125 0.7119843750000001 +0.139875 -0.171478271484375 0.7119843750000001 +0.14 -0.141357421875 0.7119843750000001 +0.140125 -0.106414794921875 0.7119843750000001 +0.14025 -0.073974609375 0.7119843750000001 +0.140375 -0.037200927734375 0.7119843750000001 +0.1405 0.0 0.7119843750000001 +0.140625 0.033477783203125 0.7119843750000001 +0.14075 0.070343017578125 0.7119843750000001 +0.140875 0.102874755859375 0.7119843750000001 +0.141 0.137908935546875 0.7119843750000001 +0.141125 0.171478271484375 0.7119843750000001 +0.14125 0.200042724609375 0.7119843750000001 +0.141375 0.229736328125 0.7119843750000001 +0.1415 0.254302978515625 0.7119843750000001 +0.141625 0.278961181640625 0.7119843750000001 +0.14175 0.300537109375 0.7119843750000001 +0.141875 0.317138671875 0.7119843750000001 +0.142 0.332305908203125 0.7119843750000001 +0.142125 0.34283447265625 0.7119843750000001 +0.14225 0.3509521484375 0.7119843750000001 +0.142375 0.355255126953125 0.7119843750000001 +0.1425 0.35577392578125 0.7119843750000001 +0.142625 0.352630615234375 0.7119843750000001 +0.14275 0.346527099609375 0.7119843750000001 +0.142875 0.336151123046875 0.7119843750000001 +0.143 0.322052001953125 0.7119843750000001 +0.143125 0.306365966796875 0.7119843750000001 +0.14325 0.285736083984375 0.7119843750000001 +0.143375 0.264495849609375 0.7119843750000001 +0.1435 0.2381591796875 0.7119843750000001 +0.143625 0.209197998046875 0.7119843750000001 +0.14375 0.181182861328125 0.7119843750000001 +0.143875 0.148162841796875 0.7119843750000001 +0.144 0.117034912109375 0.7119843750000001 +0.144125 0.081268310546875 0.7119843750000001 +0.14425 0.044586181640625 0.7119843750000001 +0.144375 0.01116943359375 0.7119843750000001 +0.1445 -0.026031494140625 0.7119843750000001 +0.144625 -0.059356689453125 0.7119843750000001 +0.14475 -0.095703125 0.7119843750000001 +0.144875 -0.131011962890625 0.7119843750000001 +0.145 -0.161590576171875 0.7119843750000001 +0.145125 -0.19384765625 0.7119843750000001 +0.14525 -0.221099853515625 0.7119843750000001 +0.145375 -0.2490234375 0.7119843750000001 +0.1455 -0.274261474609375 0.7119843750000001 +0.145625 -0.29437255859375 0.7119843750000001 +0.14575 -0.313690185546875 0.7119843750000001 +0.145875 -0.328125 0.7119843750000001 +0.146 -0.34075927734375 0.7119843750000001 +0.146125 -0.349639892578125 0.7119843750000001 +0.14625 -0.3543701171875 0.7119843750000001 +0.146375 -0.355926513671875 0.7119843750000001 +0.1465 -0.35400390625 0.7119843750000001 +0.146625 -0.34814453125 0.7119843750000001 +0.14675 -0.338531494140625 0.7119843750000001 +0.146875 -0.32666015625 0.7119843750000001 +0.147 -0.310089111328125 0.7119843750000001 +0.147125 -0.292266845703125 0.7119843750000001 +0.14725 -0.269439697265625 0.7119843750000001 +0.147375 -0.24365234375 0.7119843750000001 +0.1475 -0.2181396484375 0.7119843750000001 +0.147625 -0.18756103515625 0.7119843750000001 +0.14775 -0.15826416015625 0.7119843750000001 +0.147875 -0.124053955078125 0.7119843750000001 +0.148 -0.0885009765625 0.7119843750000001 +0.148125 -0.0556640625 0.7119843750000001 +0.14825 -0.01861572265625 0.7119843750000001 +0.148375 0.014892578125 0.7119843750000001 +0.1485 0.051971435546875 0.7119843750000001 +0.148625 0.0885009765625 0.7119843750000001 +0.14875 0.12054443359375 0.7119843750000001 +0.148875 0.1549072265625 0.7119843750000001 +0.149 0.18438720703125 0.7119843750000001 +0.149125 0.215179443359375 0.7119843750000001 +0.14925 0.24365234375 0.7119843750000001 +0.149375 0.266998291015625 0.7119843750000001 +0.1495 0.290130615234375 0.7119843750000001 +0.149625 0.308258056640625 0.7119843750000001 +0.14975 0.325164794921875 0.7119843750000001 +0.149875 0.338531494140625 0.7119843750000001 +0.15 0.34735107421875 0.7119843750000001 +0.150125 0.35357666015625 0.7119843750000001 +0.15025 0.355865478515625 0.7119843750000001 +0.150375 0.354705810546875 0.7119843750000001 +0.1505 0.349639892578125 0.7119843750000001 +0.150625 0.341796875 0.7119843750000001 +0.15075 0.329559326171875 0.7119843750000001 +0.150875 0.3154296875 0.7119843750000001 +0.151 0.296478271484375 0.7119843750000001 +0.151125 0.274261474609375 0.7119843750000001 +0.15125 0.251678466796875 0.7119843750000001 +0.151375 0.2239990234375 0.7119843750000001 +0.1515 0.19696044921875 0.7119843750000001 +0.151625 0.164886474609375 0.7119843750000001 +0.15175 0.131011962890625 0.7119843750000001 +0.151875 0.099273681640625 0.7119843750000001 +0.152 0.063018798828125 0.7119843750000001 +0.152125 0.029754638671875 0.7119843750000001 +0.15225 -0.0074462890625 0.7119843750000001 +0.152375 -0.044586181640625 0.7119843750000001 +0.1525 -0.07763671875 0.7119843750000001 +0.152625 -0.113525390625 0.7119843750000001 +0.15275 -0.144775390625 0.7119843750000001 +0.152875 -0.177947998046875 0.7119843750000001 +0.153 -0.209197998046875 0.7119843750000001 +0.153125 -0.235382080078125 0.7119843750000001 +0.15325 -0.261993408203125 0.7119843750000001 +0.153375 -0.28350830078125 0.7119843750000001 +0.1535 -0.304443359375 0.7119843750000001 +0.153625 -0.322052001953125 0.7119843750000001 +0.15375 -0.33489990234375 0.7119843750000001 +0.153875 -0.345672607421875 0.7119843750000001 +0.154 -0.35211181640625 0.7119843750000001 +0.154125 -0.355621337890625 0.7119843750000001 +0.15425 -0.355255126953125 0.7119843750000001 +0.154375 -0.3515625 0.7119843750000001 +0.1545 -0.34381103515625 0.7119843750000001 +0.154625 -0.3336181640625 0.7119843750000001 +0.15475 -0.318817138671875 0.7119843750000001 +0.154875 -0.300537109375 0.7119843750000001 +0.155 -0.28125 0.7119843750000001 +0.155125 -0.25689697265625 0.7119843750000001 +0.15525 -0.232574462890625 0.7119843750000001 +0.155375 -0.203125 0.7119843750000001 +0.1555 -0.171478271484375 0.7119843750000001 +0.155625 -0.141357421875 0.7119843750000001 +0.15575 -0.106414794921875 0.7119843750000001 +0.155875 -0.073974609375 0.7119843750000001 +0.156 -0.037200927734375 0.7119843750000001 +0.156125 0.0 0.7119843750000001 +0.15625 0.033477783203125 0.7119843750000001 +0.156375 0.070343017578125 0.7119843750000001 +0.1565 0.102874755859375 0.7119843750000001 +0.156625 0.137908935546875 0.7119843750000001 +0.15675 0.171478271484375 0.7119843750000001 +0.156875 0.200042724609375 0.7119843750000001 +0.157 0.229736328125 0.7119843750000001 +0.157125 0.254302978515625 0.7119843750000001 +0.15725 0.278961181640625 0.7119843750000001 +0.157375 0.300537109375 0.7119843750000001 +0.1575 0.317138671875 0.7119843750000001 +0.157625 0.332305908203125 0.7119843750000001 +0.15775 0.34283447265625 0.7119843750000001 +0.157875 0.3509521484375 0.7119843750000001 +0.158 0.355255126953125 0.7119843750000001 +0.158125 0.35577392578125 0.7119843750000001 +0.15825 0.352630615234375 0.7119843750000001 +0.158375 0.346527099609375 0.7119843750000001 +0.1585 0.336151123046875 0.7119843750000001 +0.158625 0.322052001953125 0.7119843750000001 +0.15875 0.306365966796875 0.7119843750000001 +0.158875 0.285736083984375 0.7119843750000001 +0.159 0.264495849609375 0.7119843750000001 +0.159125 0.2381591796875 0.7119843750000001 +0.15925 0.209197998046875 0.7119843750000001 +0.159375 0.181182861328125 0.7119843750000001 +0.1595 0.148162841796875 0.7119843750000001 +0.159625 0.117034912109375 0.7119843750000001 +0.15975 0.081268310546875 0.7119843750000001 +0.159875 0.044586181640625 0.7119843750000001 +0.16 0.01275634765625 0.8143812500000001 +0.160125 -0.02978515625 0.8143812500000001 +0.16025 -0.06787109375 0.8143812500000001 +0.160375 -0.109466552734375 0.8143812500000001 +0.1605 -0.149871826171875 0.8143812500000001 +0.160625 -0.184814453125 0.8143812500000001 +0.16075 -0.22174072265625 0.8143812500000001 +0.160875 -0.252899169921875 0.8143812500000001 +0.161 -0.28485107421875 0.8143812500000001 +0.161125 -0.313720703125 0.8143812500000001 +0.16125 -0.33673095703125 0.8143812500000001 +0.161375 -0.35882568359375 0.8143812500000001 +0.1615 -0.375335693359375 0.8143812500000001 +0.161625 -0.3897705078125 0.8143812500000001 +0.16175 -0.399932861328125 0.8143812500000001 +0.161875 -0.40533447265625 0.8143812500000001 +0.162 -0.407135009765625 0.8143812500000001 +0.162125 -0.4049072265625 0.8143812500000001 +0.16225 -0.39825439453125 0.8143812500000001 +0.162375 -0.38720703125 0.8143812500000001 +0.1625 -0.3736572265625 0.8143812500000001 +0.162625 -0.354705810546875 0.8143812500000001 +0.16275 -0.334320068359375 0.8143812500000001 +0.162875 -0.308197021484375 0.8143812500000001 +0.163 -0.278717041015625 0.8143812500000001 +0.163125 -0.249542236328125 0.8143812500000001 +0.16325 -0.21453857421875 0.8143812500000001 +0.163375 -0.1810302734375 0.8143812500000001 +0.1635 -0.14190673828125 0.8143812500000001 +0.163625 -0.101226806640625 0.8143812500000001 +0.16375 -0.06365966796875 0.8143812500000001 +0.163875 -0.021270751953125 0.8143812500000001 +0.164 0.01702880859375 0.8143812500000001 +0.164125 0.0594482421875 0.8143812500000001 +0.16425 0.101226806640625 0.8143812500000001 +0.164375 0.137908935546875 0.8143812500000001 +0.1645 0.17718505859375 0.8143812500000001 +0.164625 0.210906982421875 0.8143812500000001 +0.16475 0.24615478515625 0.8143812500000001 +0.164875 0.278717041015625 0.8143812500000001 +0.165 0.305389404296875 0.8143812500000001 +0.165125 0.331878662109375 0.8143812500000001 +0.16525 0.35260009765625 0.8143812500000001 +0.165375 0.3719482421875 0.8143812500000001 +0.1655 0.38720703125 0.8143812500000001 +0.165625 0.3973388671875 0.8143812500000001 +0.16575 0.404449462890625 0.8143812500000001 +0.165875 0.40704345703125 0.8143812500000001 +0.166 0.405731201171875 0.8143812500000001 +0.166125 0.399932861328125 0.8143812500000001 +0.16625 0.390960693359375 0.8143812500000001 +0.166375 0.376983642578125 0.8143812500000001 +0.1665 0.360809326171875 0.8143812500000001 +0.166625 0.339111328125 0.8143812500000001 +0.16675 0.313720703125 0.8143812500000001 +0.166875 0.287872314453125 0.8143812500000001 +0.167 0.2562255859375 0.8143812500000001 +0.167125 0.225311279296875 0.8143812500000001 +0.16725 0.188629150390625 0.8143812500000001 +0.167375 0.149871826171875 0.8143812500000001 +0.1675 0.11358642578125 0.8143812500000001 +0.167625 0.07208251953125 0.8143812500000001 +0.16775 0.0340576171875 0.8143812500000001 +0.167875 -0.008514404296875 0.8143812500000001 +0.168 -0.050994873046875 0.8143812500000001 +0.168125 -0.08880615234375 0.8143812500000001 +0.16825 -0.129852294921875 0.8143812500000001 +0.168375 -0.16558837890625 0.8143812500000001 +0.1685 -0.20355224609375 0.8143812500000001 +0.168625 -0.239288330078125 0.8143812500000001 +0.16875 -0.269256591796875 0.8143812500000001 +0.168875 -0.2996826171875 0.8143812500000001 +0.169 -0.324310302734375 0.8143812500000001 +0.169125 -0.3482666015625 0.8143812500000001 +0.16925 -0.368408203125 0.8143812500000001 +0.169375 -0.383056640625 0.8143812500000001 +0.1695 -0.3953857421875 0.8143812500000001 +0.169625 -0.40277099609375 0.8143812500000001 +0.16975 -0.40679931640625 0.8143812500000001 +0.169875 -0.406341552734375 0.8143812500000001 +0.17 -0.402130126953125 0.8143812500000001 +0.170125 -0.393280029296875 0.8143812500000001 +0.17025 -0.381591796875 0.8143812500000001 +0.170375 -0.36468505859375 0.8143812500000001 +0.1705 -0.343780517578125 0.8143812500000001 +0.170625 -0.32171630859375 0.8143812500000001 +0.17075 -0.293853759765625 0.8143812500000001 +0.170875 -0.266021728515625 0.8143812500000001 +0.171 -0.23236083984375 0.8143812500000001 +0.171125 -0.196136474609375 0.8143812500000001 +0.17125 -0.16168212890625 0.8143812500000001 +0.171375 -0.121734619140625 0.8143812500000001 +0.1715 -0.084625244140625 0.8143812500000001 +0.171625 -0.04254150390625 0.8143812500000001 +0.17175 0.0 0.8143812500000001 +0.171875 0.038299560546875 0.8143812500000001 +0.172 0.0804443359375 0.8143812500000001 +0.172125 0.11767578125 0.8143812500000001 +0.17225 0.157745361328125 0.8143812500000001 +0.172375 0.196136474609375 0.8143812500000001 +0.1725 0.228851318359375 0.8143812500000001 +0.172625 0.262786865234375 0.8143812500000001 +0.17275 0.2908935546875 0.8143812500000001 +0.172875 0.319061279296875 0.8143812500000001 +0.173 0.343780517578125 0.8143812500000001 +0.173125 0.362762451171875 0.8143812500000001 +0.17325 0.380096435546875 0.8143812500000001 +0.173375 0.39215087890625 0.8143812500000001 +0.1735 0.401458740234375 0.8143812500000001 +0.173625 0.406341552734375 0.8143812500000001 +0.17375 0.406951904296875 0.8143812500000001 +0.173875 0.40338134765625 0.8143812500000001 +0.174 0.396392822265625 0.8143812500000001 +0.174125 0.384490966796875 0.8143812500000001 +0.17425 0.368408203125 0.8143812500000001 +0.174375 0.350433349609375 0.8143812500000001 +0.1745 0.32684326171875 0.8143812500000001 +0.174625 0.30255126953125 0.8143812500000001 +0.17475 0.272430419921875 0.8143812500000001 +0.174875 0.239288330078125 0.8143812500000001 +0.175 0.207244873046875 0.8143812500000001 +0.175125 0.169464111328125 0.8143812500000001 +0.17525 0.133880615234375 0.8143812500000001 +0.175375 0.09295654296875 0.8143812500000001 +0.1755 0.050994873046875 0.8143812500000001 +0.175625 0.01275634765625 0.8143812500000001 +0.17575 -0.02978515625 0.8143812500000001 +0.175875 -0.06787109375 0.8143812500000001 +0.176 -0.109466552734375 0.8143812500000001 +0.176125 -0.149871826171875 0.8143812500000001 +0.17625 -0.184814453125 0.8143812500000001 +0.176375 -0.22174072265625 0.8143812500000001 +0.1765 -0.252899169921875 0.8143812500000001 +0.176625 -0.28485107421875 0.8143812500000001 +0.17675 -0.313720703125 0.8143812500000001 +0.176875 -0.33673095703125 0.8143812500000001 +0.177 -0.35882568359375 0.8143812500000001 +0.177125 -0.375335693359375 0.8143812500000001 +0.17725 -0.3897705078125 0.8143812500000001 +0.177375 -0.399932861328125 0.8143812500000001 +0.1775 -0.40533447265625 0.8143812500000001 +0.177625 -0.407135009765625 0.8143812500000001 +0.17775 -0.4049072265625 0.8143812500000001 +0.177875 -0.39825439453125 0.8143812500000001 +0.178 -0.38720703125 0.8143812500000001 +0.178125 -0.3736572265625 0.8143812500000001 +0.17825 -0.354705810546875 0.8143812500000001 +0.178375 -0.334320068359375 0.8143812500000001 +0.1785 -0.308197021484375 0.8143812500000001 +0.178625 -0.278717041015625 0.8143812500000001 +0.17875 -0.249542236328125 0.8143812500000001 +0.178875 -0.21453857421875 0.8143812500000001 +0.179 -0.1810302734375 0.8143812500000001 +0.179125 -0.14190673828125 0.8143812500000001 +0.17925 -0.101226806640625 0.8143812500000001 +0.179375 -0.06365966796875 0.8143812500000001 +0.1795 -0.021270751953125 0.8143812500000001 +0.179625 0.01702880859375 0.8143812500000001 +0.17975 0.0594482421875 0.8143812500000001 +0.179875 0.101226806640625 0.8143812500000001 +0.18 0.137908935546875 0.8143812500000001 +0.180125 0.17718505859375 0.8143812500000001 +0.18025 0.210906982421875 0.8143812500000001 +0.180375 0.24615478515625 0.8143812500000001 +0.1805 0.278717041015625 0.8143812500000001 +0.180625 0.305389404296875 0.8143812500000001 +0.18075 0.331878662109375 0.8143812500000001 +0.180875 0.35260009765625 0.8143812500000001 +0.181 0.3719482421875 0.8143812500000001 +0.181125 0.38720703125 0.8143812500000001 +0.18125 0.3973388671875 0.8143812500000001 +0.181375 0.404449462890625 0.8143812500000001 +0.1815 0.40704345703125 0.8143812500000001 +0.181625 0.405731201171875 0.8143812500000001 +0.18175 0.399932861328125 0.8143812500000001 +0.181875 0.390960693359375 0.8143812500000001 +0.182 0.376983642578125 0.8143812500000001 +0.182125 0.360809326171875 0.8143812500000001 +0.18225 0.339111328125 0.8143812500000001 +0.182375 0.313720703125 0.8143812500000001 +0.1825 0.287872314453125 0.8143812500000001 +0.182625 0.2562255859375 0.8143812500000001 +0.18275 0.225311279296875 0.8143812500000001 +0.182875 0.188629150390625 0.8143812500000001 +0.183 0.149871826171875 0.8143812500000001 +0.183125 0.11358642578125 0.8143812500000001 +0.18325 0.07208251953125 0.8143812500000001 +0.183375 0.0340576171875 0.8143812500000001 +0.1835 -0.008514404296875 0.8143812500000001 +0.183625 -0.050994873046875 0.8143812500000001 +0.18375 -0.08880615234375 0.8143812500000001 +0.183875 -0.129852294921875 0.8143812500000001 +0.184 -0.16558837890625 0.8143812500000001 +0.184125 -0.20355224609375 0.8143812500000001 +0.18425 -0.239288330078125 0.8143812500000001 +0.184375 -0.269256591796875 0.8143812500000001 +0.1845 -0.2996826171875 0.8143812500000001 +0.184625 -0.324310302734375 0.8143812500000001 +0.18475 -0.3482666015625 0.8143812500000001 +0.184875 -0.368408203125 0.8143812500000001 +0.185 -0.383056640625 0.8143812500000001 +0.185125 -0.3953857421875 0.8143812500000001 +0.18525 -0.40277099609375 0.8143812500000001 +0.185375 -0.40679931640625 0.8143812500000001 +0.1855 -0.406341552734375 0.8143812500000001 +0.185625 -0.402130126953125 0.8143812500000001 +0.18575 -0.393280029296875 0.8143812500000001 +0.185875 -0.381591796875 0.8143812500000001 +0.186 -0.36468505859375 0.8143812500000001 +0.186125 -0.343780517578125 0.8143812500000001 +0.18625 -0.32171630859375 0.8143812500000001 +0.186375 -0.293853759765625 0.8143812500000001 +0.1865 -0.266021728515625 0.8143812500000001 +0.186625 -0.23236083984375 0.8143812500000001 +0.18675 -0.196136474609375 0.8143812500000001 +0.186875 -0.16168212890625 0.8143812500000001 +0.187 -0.121734619140625 0.8143812500000001 +0.187125 -0.084625244140625 0.8143812500000001 +0.18725 -0.04254150390625 0.8143812500000001 +0.187375 0.0 0.8143812500000001 +0.1875 0.038299560546875 0.8143812500000001 +0.187625 0.0804443359375 0.8143812500000001 +0.18775 0.11767578125 0.8143812500000001 +0.187875 0.157745361328125 0.8143812500000001 +0.188 0.196136474609375 0.8143812500000001 +0.188125 0.228851318359375 0.8143812500000001 +0.18825 0.262786865234375 0.8143812500000001 +0.188375 0.2908935546875 0.8143812500000001 +0.1885 0.319061279296875 0.8143812500000001 +0.188625 0.343780517578125 0.8143812500000001 +0.18875 0.362762451171875 0.8143812500000001 +0.188875 0.380096435546875 0.8143812500000001 +0.189 0.39215087890625 0.8143812500000001 +0.189125 0.401458740234375 0.8143812500000001 +0.18925 0.406341552734375 0.8143812500000001 +0.189375 0.406951904296875 0.8143812500000001 +0.1895 0.40338134765625 0.8143812500000001 +0.189625 0.396392822265625 0.8143812500000001 +0.18975 0.384490966796875 0.8143812500000001 +0.189875 0.368408203125 0.8143812500000001 +0.19 0.350433349609375 0.8143812500000001 +0.190125 0.32684326171875 0.8143812500000001 +0.19025 0.30255126953125 0.8143812500000001 +0.190375 0.272430419921875 0.8143812500000001 +0.1905 0.239288330078125 0.8143812500000001 +0.190625 0.207244873046875 0.8143812500000001 +0.19075 0.169464111328125 0.8143812500000001 +0.190875 0.133880615234375 0.8143812500000001 +0.191 0.09295654296875 0.8143812500000001 +0.191125 0.050994873046875 0.8143812500000001 +0.19125 0.01275634765625 0.8143812500000001 +0.191375 -0.02978515625 0.8143812500000001 +0.1915 -0.06787109375 0.8143812500000001 +0.191625 -0.109466552734375 0.8143812500000001 +0.19175 -0.149871826171875 0.8143812500000001 +0.191875 -0.184814453125 0.8143812500000001 +0.192 -0.2496337890625 0.9167781250000001 +0.192125 -0.284698486328125 0.9167781250000001 +0.19225 -0.3206787109375 0.9167781250000001 +0.192375 -0.3531494140625 0.9167781250000001 +0.1925 -0.379058837890625 0.9167781250000001 +0.192625 -0.4039306640625 0.9167781250000001 +0.19275 -0.422515869140625 0.9167781250000001 +0.192875 -0.43878173828125 0.9167781250000001 +0.193 -0.450225830078125 0.9167781250000001 +0.193125 -0.456298828125 0.9167781250000001 +0.19325 -0.45831298828125 0.9167781250000001 +0.193375 -0.455841064453125 0.9167781250000001 +0.1935 -0.44830322265625 0.9167781250000001 +0.193625 -0.4359130859375 0.9167781250000001 +0.19375 -0.420654296875 0.9167781250000001 +0.193875 -0.399322509765625 0.9167781250000001 +0.194 -0.376373291015625 0.9167781250000001 +0.194125 -0.346954345703125 0.9167781250000001 +0.19425 -0.313751220703125 0.9167781250000001 +0.194375 -0.280914306640625 0.9167781250000001 +0.1945 -0.24151611328125 0.9167781250000001 +0.194625 -0.20379638671875 0.9167781250000001 +0.19475 -0.159759521484375 0.9167781250000001 +0.194875 -0.11395263671875 0.9167781250000001 +0.195 -0.071685791015625 0.9167781250000001 +0.195125 -0.023956298828125 0.9167781250000001 +0.19525 0.0191650390625 0.9167781250000001 +0.195375 0.066925048828125 0.9167781250000001 +0.1955 0.11395263671875 0.9167781250000001 +0.195625 0.155242919921875 0.9167781250000001 +0.19575 0.199462890625 0.9167781250000001 +0.195875 0.2374267578125 0.9167781250000001 +0.196 0.277099609375 0.9167781250000001 +0.196125 0.313751220703125 0.9167781250000001 +0.19625 0.343780517578125 0.9167781250000001 +0.196375 0.37359619140625 0.9167781250000001 +0.1965 0.396942138671875 0.9167781250000001 +0.196625 0.418701171875 0.9167781250000001 +0.19675 0.4359130859375 0.9167781250000001 +0.196875 0.447296142578125 0.9167781250000001 +0.197 0.455291748046875 0.9167781250000001 +0.197125 0.458221435546875 0.9167781250000001 +0.19725 0.45672607421875 0.9167781250000001 +0.197375 0.450225830078125 0.9167781250000001 +0.1975 0.44012451171875 0.9167781250000001 +0.197625 0.42437744140625 0.9167781250000001 +0.19775 0.40618896484375 0.9167781250000001 +0.197875 0.381744384765625 0.9167781250000001 +0.198 0.3531494140625 0.9167781250000001 +0.198125 0.3240966796875 0.9167781250000001 +0.19825 0.288421630859375 0.9167781250000001 +0.198375 0.253631591796875 0.9167781250000001 +0.1985 0.21234130859375 0.9167781250000001 +0.198625 0.168701171875 0.9167781250000001 +0.19875 0.127838134765625 0.9167781250000001 +0.198875 0.081146240234375 0.9167781250000001 +0.199 0.038330078125 0.9167781250000001 +0.199125 -0.00958251953125 0.9167781250000001 +0.19925 -0.05743408203125 0.9167781250000001 +0.199375 -0.099945068359375 0.9167781250000001 +0.1995 -0.14617919921875 0.9167781250000001 +0.199625 -0.1864013671875 0.9167781250000001 +0.19975 -0.229156494140625 0.9167781250000001 +0.199875 -0.269378662109375 0.9167781250000001 +0.2 -0.3031005859375 0.9167781250000001 +0.200125 -0.337371826171875 0.9167781250000001 +0.20025 -0.365081787109375 0.9167781250000001 +0.200375 -0.39202880859375 0.9167781250000001 +0.2005 -0.414703369140625 0.9167781250000001 +0.200625 -0.431243896484375 0.9167781250000001 +0.20075 -0.445098876953125 0.9167781250000001 +0.200875 -0.45343017578125 0.9167781250000001 +0.201 -0.45794677734375 0.9167781250000001 +0.201125 -0.457427978515625 0.9167781250000001 +0.20125 -0.45269775390625 0.9167781250000001 +0.201375 -0.442718505859375 0.9167781250000001 +0.2015 -0.429595947265625 0.9167781250000001 +0.201625 -0.4105224609375 0.9167781250000001 +0.20175 -0.386993408203125 0.9167781250000001 +0.201875 -0.362152099609375 0.9167781250000001 +0.202 -0.330810546875 0.9167781250000001 +0.202125 -0.299468994140625 0.9167781250000001 +0.20225 -0.261566162109375 0.9167781250000001 +0.202375 -0.220794677734375 0.9167781250000001 +0.2025 -0.1820068359375 0.9167781250000001 +0.202625 -0.137054443359375 0.9167781250000001 +0.20275 -0.09527587890625 0.9167781250000001 +0.202875 -0.047882080078125 0.9167781250000001 +0.203 0.0 0.9167781250000001 +0.203125 0.043121337890625 0.9167781250000001 +0.20325 0.090576171875 0.9167781250000001 +0.203375 0.1324462890625 0.9167781250000001 +0.2035 0.177581787109375 0.9167781250000001 +0.203625 0.220794677734375 0.9167781250000001 +0.20375 0.257598876953125 0.9167781250000001 +0.203875 0.29583740234375 0.9167781250000001 +0.204 0.32745361328125 0.9167781250000001 +0.204125 0.35919189453125 0.9167781250000001 +0.20425 0.386993408203125 0.9167781250000001 +0.204375 0.40838623046875 0.9167781250000001 +0.2045 0.427886962890625 0.9167781250000001 +0.204625 0.441436767578125 0.9167781250000001 +0.20475 0.451934814453125 0.9167781250000001 +0.204875 0.457427978515625 0.9167781250000001 +0.205 0.458099365234375 0.9167781250000001 +0.205125 0.4541015625 0.9167781250000001 +0.20525 0.44622802734375 0.9167781250000001 +0.205375 0.432830810546875 0.9167781250000001 +0.2055 0.414703369140625 0.9167781250000001 +0.205625 0.394500732421875 0.9167781250000001 +0.20575 0.367950439453125 0.9167781250000001 +0.205875 0.340606689453125 0.9167781250000001 +0.206 0.306671142578125 0.9167781250000001 +0.206125 0.269378662109375 0.9167781250000001 +0.20625 0.233306884765625 0.9167781250000001 +0.206375 0.1907958984375 0.9167781250000001 +0.2065 0.15069580078125 0.9167781250000001 +0.206625 0.104644775390625 0.9167781250000001 +0.20675 0.05743408203125 0.9167781250000001 +0.206875 0.014373779296875 0.9167781250000001 +0.207 -0.033538818359375 0.9167781250000001 +0.207125 -0.076416015625 0.9167781250000001 +0.20725 -0.12322998046875 0.9167781250000001 +0.207375 -0.168701171875 0.9167781250000001 +0.2075 -0.20806884765625 0.9167781250000001 +0.207625 -0.2496337890625 0.9167781250000001 +0.20775 -0.284698486328125 0.9167781250000001 +0.207875 -0.3206787109375 0.9167781250000001 +0.208 -0.3531494140625 0.9167781250000001 +0.208125 -0.379058837890625 0.9167781250000001 +0.20825 -0.4039306640625 0.9167781250000001 +0.208375 -0.422515869140625 0.9167781250000001 +0.2085 -0.43878173828125 0.9167781250000001 +0.208625 -0.450225830078125 0.9167781250000001 +0.20875 -0.456298828125 0.9167781250000001 +0.208875 -0.45831298828125 0.9167781250000001 +0.209 -0.455841064453125 0.9167781250000001 +0.209125 -0.44830322265625 0.9167781250000001 +0.20925 -0.4359130859375 0.9167781250000001 +0.209375 -0.420654296875 0.9167781250000001 +0.2095 -0.399322509765625 0.9167781250000001 +0.209625 -0.376373291015625 0.9167781250000001 +0.20975 -0.346954345703125 0.9167781250000001 +0.209875 -0.313751220703125 0.9167781250000001 +0.21 -0.280914306640625 0.9167781250000001 +0.210125 -0.24151611328125 0.9167781250000001 +0.21025 -0.20379638671875 0.9167781250000001 +0.210375 -0.159759521484375 0.9167781250000001 +0.2105 -0.11395263671875 0.9167781250000001 +0.210625 -0.071685791015625 0.9167781250000001 +0.21075 -0.023956298828125 0.9167781250000001 +0.210875 0.0191650390625 0.9167781250000001 +0.211 0.066925048828125 0.9167781250000001 +0.211125 0.11395263671875 0.9167781250000001 +0.21125 0.155242919921875 0.9167781250000001 +0.211375 0.199462890625 0.9167781250000001 +0.2115 0.2374267578125 0.9167781250000001 +0.211625 0.277099609375 0.9167781250000001 +0.21175 0.313751220703125 0.9167781250000001 +0.211875 0.343780517578125 0.9167781250000001 +0.212 0.37359619140625 0.9167781250000001 +0.212125 0.396942138671875 0.9167781250000001 +0.21225 0.418701171875 0.9167781250000001 +0.212375 0.4359130859375 0.9167781250000001 +0.2125 0.447296142578125 0.9167781250000001 +0.212625 0.455291748046875 0.9167781250000001 +0.21275 0.458221435546875 0.9167781250000001 +0.212875 0.45672607421875 0.9167781250000001 +0.213 0.450225830078125 0.9167781250000001 +0.213125 0.44012451171875 0.9167781250000001 +0.21325 0.42437744140625 0.9167781250000001 +0.213375 0.40618896484375 0.9167781250000001 +0.2135 0.381744384765625 0.9167781250000001 +0.213625 0.3531494140625 0.9167781250000001 +0.21375 0.3240966796875 0.9167781250000001 +0.213875 0.288421630859375 0.9167781250000001 +0.214 0.253631591796875 0.9167781250000001 +0.214125 0.21234130859375 0.9167781250000001 +0.21425 0.168701171875 0.9167781250000001 +0.214375 0.127838134765625 0.9167781250000001 +0.2145 0.081146240234375 0.9167781250000001 +0.214625 0.038330078125 0.9167781250000001 +0.21475 -0.00958251953125 0.9167781250000001 +0.214875 -0.05743408203125 0.9167781250000001 +0.215 -0.099945068359375 0.9167781250000001 +0.215125 -0.14617919921875 0.9167781250000001 +0.21525 -0.1864013671875 0.9167781250000001 +0.215375 -0.229156494140625 0.9167781250000001 +0.2155 -0.269378662109375 0.9167781250000001 +0.215625 -0.3031005859375 0.9167781250000001 +0.21575 -0.337371826171875 0.9167781250000001 +0.215875 -0.365081787109375 0.9167781250000001 +0.216 -0.39202880859375 0.9167781250000001 +0.216125 -0.414703369140625 0.9167781250000001 +0.21625 -0.431243896484375 0.9167781250000001 +0.216375 -0.445098876953125 0.9167781250000001 +0.2165 -0.45343017578125 0.9167781250000001 +0.216625 -0.45794677734375 0.9167781250000001 +0.21675 -0.457427978515625 0.9167781250000001 +0.216875 -0.45269775390625 0.9167781250000001 +0.217 -0.442718505859375 0.9167781250000001 +0.217125 -0.429595947265625 0.9167781250000001 +0.21725 -0.4105224609375 0.9167781250000001 +0.217375 -0.386993408203125 0.9167781250000001 +0.2175 -0.362152099609375 0.9167781250000001 +0.217625 -0.330810546875 0.9167781250000001 +0.21775 -0.299468994140625 0.9167781250000001 +0.217875 -0.261566162109375 0.9167781250000001 +0.218 -0.220794677734375 0.9167781250000001 +0.218125 -0.1820068359375 0.9167781250000001 +0.21825 -0.137054443359375 0.9167781250000001 +0.218375 -0.09527587890625 0.9167781250000001 +0.2185 -0.047882080078125 0.9167781250000001 +0.218625 0.0 0.9167781250000001 +0.21875 0.043121337890625 0.9167781250000001 +0.218875 0.090576171875 0.9167781250000001 +0.219 0.1324462890625 0.9167781250000001 +0.219125 0.177581787109375 0.9167781250000001 +0.21925 0.220794677734375 0.9167781250000001 +0.219375 0.257598876953125 0.9167781250000001 +0.2195 0.29583740234375 0.9167781250000001 +0.219625 0.32745361328125 0.9167781250000001 +0.21975 0.35919189453125 0.9167781250000001 +0.219875 0.386993408203125 0.9167781250000001 +0.22 0.40838623046875 0.9167781250000001 +0.220125 0.427886962890625 0.9167781250000001 +0.22025 0.441436767578125 0.9167781250000001 +0.220375 0.451934814453125 0.9167781250000001 +0.2205 0.457427978515625 0.9167781250000001 +0.220625 0.458099365234375 0.9167781250000001 +0.22075 0.4541015625 0.9167781250000001 +0.220875 0.44622802734375 0.9167781250000001 +0.221 0.432830810546875 0.9167781250000001 +0.221125 0.414703369140625 0.9167781250000001 +0.22125 0.394500732421875 0.9167781250000001 +0.221375 0.367950439453125 0.9167781250000001 +0.2215 0.340606689453125 0.9167781250000001 +0.221625 0.306671142578125 0.9167781250000001 +0.22175 0.269378662109375 0.9167781250000001 +0.221875 0.233306884765625 0.9167781250000001 +0.222 0.1907958984375 0.9167781250000001 +0.222125 0.15069580078125 0.9167781250000001 +0.22225 0.104644775390625 0.9167781250000001 +0.222375 0.05743408203125 0.9167781250000001 +0.2225 0.014373779296875 0.9167781250000001 +0.222625 -0.033538818359375 0.9167781250000001 +0.22275 -0.076416015625 0.9167781250000001 +0.222875 -0.12322998046875 0.9167781250000001 +0.223 -0.168701171875 0.9167781250000001 +0.223125 -0.20806884765625 0.9167781250000001 +0.22325 -0.2496337890625 0.9167781250000001 +0.223375 -0.284698486328125 0.9167781250000001 +0.2235 -0.3206787109375 0.9167781250000001 +0.223625 -0.3531494140625 0.9167781250000001 +0.22375 -0.379058837890625 0.9167781250000001 +0.223875 -0.4039306640625 0.9167781250000001 +0.224 -0.460845947265625 0.9999511726200581 +0.224125 -0.47857666015625 0.9999511726200581 +0.22425 -0.491058349609375 0.9999511726200581 +0.224375 -0.497711181640625 0.9999511726200581 +0.2245 -0.499908447265625 0.9999511726200581 +0.224625 -0.4971923828125 0.9999511726200581 +0.22475 -0.488983154296875 0.9999511726200581 +0.224875 -0.4754638671875 0.9999511726200581 +0.225 -0.45880126953125 0.9999511726200581 +0.225125 -0.435546875 0.9999511726200581 +0.22525 -0.410491943359375 0.9999511726200581 +0.225375 -0.37841796875 0.9999511726200581 +0.2255 -0.342193603515625 0.9999511726200581 +0.225625 -0.306396484375 0.9999511726200581 +0.22575 -0.263427734375 0.9999511726200581 +0.225875 -0.222259521484375 0.9999511726200581 +0.226 -0.174224853515625 0.9999511726200581 +0.226125 -0.124298095703125 0.9999511726200581 +0.22625 -0.07818603515625 0.9999511726200581 +0.226375 -0.026123046875 0.9999511726200581 +0.2265 0.020904541015625 0.9999511726200581 +0.226625 0.072998046875 0.9999511726200581 +0.22675 0.124298095703125 0.9999511726200581 +0.226875 0.1693115234375 0.9999511726200581 +0.227 0.217559814453125 0.9999511726200581 +0.227125 0.25897216796875 0.9999511726200581 +0.22725 0.30224609375 0.9999511726200581 +0.227375 0.342193603515625 0.9999511726200581 +0.2275 0.374969482421875 0.9999511726200581 +0.227625 0.407501220703125 0.9999511726200581 +0.22775 0.432952880859375 0.9999511726200581 +0.227875 0.456695556640625 0.9999511726200581 +0.228 0.4754638671875 0.9999511726200581 +0.228125 0.487884521484375 0.9999511726200581 +0.22825 0.496612548828125 0.9999511726200581 +0.228375 0.49981689453125 0.9999511726200581 +0.2285 0.4981689453125 0.9999511726200581 +0.228625 0.491058349609375 0.9999511726200581 +0.22875 0.480072021484375 0.9999511726200581 +0.228875 0.462860107421875 0.9999511726200581 +0.229 0.443023681640625 0.9999511726200581 +0.229125 0.4163818359375 0.9999511726200581 +0.22925 0.38519287109375 0.9999511726200581 +0.229375 0.353485107421875 0.9999511726200581 +0.2295 0.314605712890625 0.9999511726200581 +0.229625 0.276641845703125 0.9999511726200581 +0.22975 0.231597900390625 0.9999511726200581 +0.229875 0.18402099609375 0.9999511726200581 +0.23 0.13946533203125 0.9999511726200581 +0.230125 0.0885009765625 0.9999511726200581 +0.23025 0.04180908203125 0.9999511726200581 +0.230375 -0.01043701171875 0.9999511726200581 +0.2305 -0.0626220703125 0.9999511726200581 +0.230625 -0.109039306640625 0.9999511726200581 +0.23075 -0.159454345703125 0.9999511726200581 +0.230875 -0.20330810546875 0.9999511726200581 +0.231 -0.24993896484375 0.9999511726200581 +0.231125 -0.2938232421875 0.9999511726200581 +0.23125 -0.330596923828125 0.9999511726200581 +0.231375 -0.36798095703125 0.9999511726200581 +0.2315 -0.398193359375 0.9999511726200581 +0.231625 -0.4276123046875 0.9999511726200581 +0.23175 -0.45233154296875 0.9999511726200581 +0.231875 -0.470367431640625 0.9999511726200581 +0.232 -0.485504150390625 0.9999511726200581 +0.232125 -0.49456787109375 0.9999511726200581 +0.23225 -0.499481201171875 0.9999511726200581 +0.232375 -0.498931884765625 0.9999511726200581 +0.2325 -0.4937744140625 0.9999511726200581 +0.232625 -0.482879638671875 0.9999511726200581 +0.23275 -0.46856689453125 0.9999511726200581 +0.232875 -0.447784423828125 0.9999511726200581 +0.233 -0.422088623046875 0.9999511726200581 +0.233125 -0.39501953125 0.9999511726200581 +0.23325 -0.360809326171875 0.9999511726200581 +0.233375 -0.32666015625 0.9999511726200581 +0.2335 -0.285308837890625 0.9999511726200581 +0.233625 -0.240814208984375 0.9999511726200581 +0.23375 -0.198516845703125 0.9999511726200581 +0.233875 -0.14947509765625 0.9999511726200581 +0.234 -0.103912353515625 0.9999511726200581 +0.234125 -0.05224609375 0.9999511726200581 +0.23425 0.0 0.9999511726200581 +0.234375 0.047027587890625 0.9999511726200581 +0.2345 0.098785400390625 0.9999511726200581 +0.234625 0.14447021484375 0.9999511726200581 +0.23475 0.193695068359375 0.9999511726200581 +0.234875 0.240814208984375 0.9999511726200581 +0.235 0.280975341796875 0.9999511726200581 +0.235125 0.322662353515625 0.9999511726200581 +0.23525 0.357177734375 0.9999511726200581 +0.235375 0.39178466796875 0.9999511726200581 +0.2355 0.422088623046875 0.9999511726200581 +0.235625 0.4454345703125 0.9999511726200581 +0.23575 0.466705322265625 0.9999511726200581 +0.235875 0.48150634765625 0.9999511726200581 +0.236 0.492919921875 0.9999511726200581 +0.236125 0.498931884765625 0.9999511726200581 +0.23625 0.499664306640625 0.9999511726200581 +0.236375 0.49530029296875 0.9999511726200581 +0.2365 0.486724853515625 0.9999511726200581 +0.236625 0.47210693359375 0.9999511726200581 +0.23675 0.45233154296875 0.9999511726200581 +0.236875 0.4302978515625 0.9999511726200581 +0.237 0.401336669921875 0.9999511726200581 +0.237125 0.371490478515625 0.9999511726200581 +0.23725 0.334503173828125 0.9999511726200581 +0.237375 0.2938232421875 0.9999511726200581 +0.2375 0.25445556640625 0.9999511726200581 +0.237625 0.208099365234375 0.9999511726200581 +0.23775 0.164398193359375 0.9999511726200581 +0.237875 0.1141357421875 0.9999511726200581 +0.238 0.0626220703125 0.9999511726200581 +0.238125 0.01568603515625 0.9999511726200581 +0.23825 -0.036590576171875 0.9999511726200581 +0.238375 -0.083343505859375 0.9999511726200581 +0.2385 -0.134429931640625 0.9999511726200581 +0.238625 -0.18402099609375 0.9999511726200581 +0.23875 -0.2269287109375 0.9999511726200581 +0.238875 -0.27227783203125 0.9999511726200581 +0.239 -0.310516357421875 0.9999511726200581 +0.239125 -0.349761962890625 0.9999511726200581 +0.23925 -0.38519287109375 0.9999511726200581 +0.239375 -0.4134521484375 0.9999511726200581 +0.2395 -0.440582275390625 0.9999511726200581 +0.239625 -0.460845947265625 0.9999511726200581 +0.23975 -0.47857666015625 0.9999511726200581 +0.239875 -0.491058349609375 0.9999511726200581 +0.24 -0.497711181640625 0.9999511726200581 +0.240125 -0.499908447265625 0.9999511726200581 +0.24025 -0.4971923828125 0.9999511726200581 +0.240375 -0.488983154296875 0.9999511726200581 +0.2405 -0.4754638671875 0.9999511726200581 +0.240625 -0.45880126953125 0.9999511726200581 +0.24075 -0.435546875 0.9999511726200581 +0.240875 -0.410491943359375 0.9999511726200581 +0.241 -0.37841796875 0.9999511726200581 +0.241125 -0.342193603515625 0.9999511726200581 +0.24125 -0.306396484375 0.9999511726200581 +0.241375 -0.263427734375 0.9999511726200581 +0.2415 -0.222259521484375 0.9999511726200581 +0.241625 -0.174224853515625 0.9999511726200581 +0.24175 -0.124298095703125 0.9999511726200581 +0.241875 -0.07818603515625 0.9999511726200581 +0.242 -0.026123046875 0.9999511726200581 +0.242125 0.020904541015625 0.9999511726200581 +0.24225 0.072998046875 0.9999511726200581 +0.242375 0.124298095703125 0.9999511726200581 +0.2425 0.1693115234375 0.9999511726200581 +0.242625 0.217559814453125 0.9999511726200581 +0.24275 0.25897216796875 0.9999511726200581 +0.242875 0.30224609375 0.9999511726200581 +0.243 0.342193603515625 0.9999511726200581 +0.243125 0.374969482421875 0.9999511726200581 +0.24325 0.407501220703125 0.9999511726200581 +0.243375 0.432952880859375 0.9999511726200581 +0.2435 0.456695556640625 0.9999511726200581 +0.243625 0.4754638671875 0.9999511726200581 +0.24375 0.487884521484375 0.9999511726200581 +0.243875 0.496612548828125 0.9999511726200581 +0.244 0.49981689453125 0.9999511726200581 +0.244125 0.4981689453125 0.9999511726200581 +0.24425 0.491058349609375 0.9999511726200581 +0.244375 0.480072021484375 0.9999511726200581 +0.2445 0.462860107421875 0.9999511726200581 +0.244625 0.443023681640625 0.9999511726200581 +0.24475 0.4163818359375 0.9999511726200581 +0.244875 0.38519287109375 0.9999511726200581 +0.245 0.353485107421875 0.9999511726200581 +0.245125 0.314605712890625 0.9999511726200581 +0.24525 0.276641845703125 0.9999511726200581 +0.245375 0.231597900390625 0.9999511726200581 +0.2455 0.18402099609375 0.9999511726200581 +0.245625 0.13946533203125 0.9999511726200581 +0.24575 0.0885009765625 0.9999511726200581 +0.245875 0.04180908203125 0.9999511726200581 +0.246 -0.01043701171875 0.9999511726200581 +0.246125 -0.0626220703125 0.9999511726200581 +0.24625 -0.109039306640625 0.9999511726200581 +0.246375 -0.159454345703125 0.9999511726200581 +0.2465 -0.20330810546875 0.9999511726200581 +0.246625 -0.24993896484375 0.9999511726200581 +0.24675 -0.2938232421875 0.9999511726200581 +0.246875 -0.330596923828125 0.9999511726200581 +0.247 -0.36798095703125 0.9999511726200581 +0.247125 -0.398193359375 0.9999511726200581 +0.24725 -0.4276123046875 0.9999511726200581 +0.247375 -0.45233154296875 0.9999511726200581 +0.2475 -0.470367431640625 0.9999511726200581 +0.247625 -0.485504150390625 0.9999511726200581 +0.24775 -0.49456787109375 0.9999511726200581 +0.247875 -0.499481201171875 0.9999511726200581 +0.248 -0.498931884765625 0.9999511726200581 +0.248125 -0.4937744140625 0.9999511726200581 +0.24825 -0.482879638671875 0.9999511726200581 +0.248375 -0.46856689453125 0.9999511726200581 +0.2485 -0.447784423828125 0.9999511726200581 +0.248625 -0.422088623046875 0.9999511726200581 +0.24875 -0.39501953125 0.9999511726200581 +0.248875 -0.360809326171875 0.9999511726200581 +0.249 -0.32666015625 0.9999511726200581 +0.249125 -0.285308837890625 0.9999511726200581 +0.24925 -0.240814208984375 0.9999511726200581 +0.249375 -0.198516845703125 0.9999511726200581 +0.2495 -0.14947509765625 0.9999511726200581 +0.249625 -0.103912353515625 0.9999511726200581 +0.24975 -0.05224609375 0.9999511726200581 +0.249875 0.0 0.9999511726200581 +0.25 0.047027587890625 0.9999511726200581 +0.250125 0.098785400390625 0.9999511726200581 +0.25025 0.14447021484375 0.9999511726200581 +0.250375 0.193695068359375 0.9999511726200581 +0.2505 0.240814208984375 0.9999511726200581 +0.250625 0.280975341796875 0.9999511726200581 +0.25075 0.322662353515625 0.9999511726200581 +0.250875 0.357177734375 0.9999511726200581 +0.251 0.39178466796875 0.9999511726200581 +0.251125 0.422088623046875 0.9999511726200581 +0.25125 0.4454345703125 0.9999511726200581 +0.251375 0.466705322265625 0.9999511726200581 +0.2515 0.48150634765625 0.9999511726200581 +0.251625 0.492919921875 0.9999511726200581 +0.25175 0.498931884765625 0.9999511726200581 +0.251875 0.499664306640625 0.9999511726200581 +0.252 0.49530029296875 0.9999511726200581 +0.252125 0.486724853515625 0.9999511726200581 +0.25225 0.47210693359375 0.9999511726200581 +0.252375 0.45233154296875 0.9999511726200581 +0.2525 0.4302978515625 0.9999511726200581 +0.252625 0.401336669921875 0.9999511726200581 +0.25275 0.371490478515625 0.9999511726200581 +0.252875 0.334503173828125 0.9999511726200581 +0.253 0.2938232421875 0.9999511726200581 +0.253125 0.25445556640625 0.9999511726200581 +0.25325 0.208099365234375 0.9999511726200581 +0.253375 0.164398193359375 0.9999511726200581 +0.2535 0.1141357421875 0.9999511726200581 +0.253625 0.0626220703125 0.9999511726200581 +0.2537500000000001 0.01568603515625 0.9999511726200581 +0.253875 -0.036590576171875 0.9999511726200581 +0.254 -0.083343505859375 0.9999511726200581 +0.254125 -0.134429931640625 0.9999511726200581 +0.25425 -0.18402099609375 0.9999511726200581 +0.254375 -0.2269287109375 0.9999511726200581 +0.2545 -0.27227783203125 0.9999511726200581 +0.254625 -0.310516357421875 0.9999511726200581 +0.25475 -0.349761962890625 0.9999511726200581 +0.254875 -0.38519287109375 0.9999511726200581 +0.255 -0.4134521484375 0.9999511726200581 +0.255125 -0.440582275390625 0.9999511726200581 +0.25525 -0.460845947265625 0.9999511726200581 +0.255375 -0.47857666015625 0.9999511726200581 +0.2555 -0.491058349609375 0.9999511726200581 +0.255625 -0.497711181640625 0.9999511726200581 +0.25575 -0.499908447265625 0.9999511726200581 +0.255875 -0.4971923828125 0.9999511726200581 diff --git a/tests/circuitpython/synth_note_bend.py b/tests/circuitpython/synth_note_bend.py new file mode 100644 index 0000000000..89a1b487c2 --- /dev/null +++ b/tests/circuitpython/synth_note_bend.py @@ -0,0 +1,10 @@ +from synthnotehelper import * + + +@synth_test +def gen(synth): + l = LFO(sweep, rate=4, once=True) + yield [l] + n = Note(32, bend=l) + synth.press(n) + yield 1 / 4 diff --git a/tests/circuitpython/synth_note_bend.py.exp b/tests/circuitpython/synth_note_bend.py.exp new file mode 100644 index 0000000000..e79811509e --- /dev/null +++ b/tests/circuitpython/synth_note_bend.py.exp @@ -0,0 +1,2048 @@ +0.0 0.005218505859375 -0.743977294921875 +0.000125 0.01043701171875 -0.743977294921875 +0.00025 0.020904541015625 -0.743977294921875 +0.000375 0.026123046875 -0.743977294921875 +0.0005 0.036590576171875 -0.743977294921875 +0.000625 0.04180908203125 -0.743977294921875 +0.00075 0.05224609375 -0.743977294921875 +0.0008750000000000002 0.05743408203125 -0.743977294921875 +0.001 0.0626220703125 -0.743977294921875 +0.001125 0.072998046875 -0.743977294921875 +0.00125 0.07818603515625 -0.743977294921875 +0.001375 0.0885009765625 -0.743977294921875 +0.0015 0.093658447265625 -0.743977294921875 +0.001625 0.103912353515625 -0.743977294921875 +0.00175 0.109039306640625 -0.743977294921875 +0.001875 0.1141357421875 -0.743977294921875 +0.002 0.124298095703125 -0.743977294921875 +0.002125 0.129364013671875 -0.743977294921875 +0.00225 0.13946533203125 -0.743977294921875 +0.002375 0.14447021484375 -0.743977294921875 +0.0025 0.15447998046875 -0.743977294921875 +0.002625 0.159454345703125 -0.743977294921875 +0.00275 0.164398193359375 -0.743977294921875 +0.002875 0.17425537109375 -0.743977294921875 +0.003 0.17913818359375 -0.743977294921875 +0.003125 0.188873291015625 -0.743977294921875 +0.00325 0.1937255859375 -0.743977294921875 +0.003375 0.203338623046875 -0.743977294921875 +0.0035 0.208099365234375 -0.743977294921875 +0.003625 0.212860107421875 -0.743977294921875 +0.00375 0.2222900390625 -0.743977294921875 +0.003875 0.226959228515625 -0.743977294921875 +0.004 0.236236572265625 -0.743977294921875 +0.004125 0.2408447265625 -0.743977294921875 +0.00425 0.249969482421875 -0.743977294921875 +0.004375000000000001 0.25445556640625 -0.743977294921875 +0.004500000000000001 0.263427734375 -0.743977294921875 +0.004625 0.267852783203125 -0.743977294921875 +0.00475 0.27227783203125 -0.743977294921875 +0.004875 0.280975341796875 -0.743977294921875 +0.005 0.285308837890625 -0.743977294921875 +0.005125000000000001 0.2938232421875 -0.743977294921875 +0.00525 0.298065185546875 -0.743977294921875 +0.005375000000000001 0.306396484375 -0.743977294921875 +0.005499999999999999 0.310516357421875 -0.743977294921875 +0.005625 0.314605712890625 -0.743977294921875 +0.00575 0.322662353515625 -0.743977294921875 +0.005874999999999999 0.32666015625 -0.743977294921875 +0.006 0.334503173828125 -0.743977294921875 +0.006125 0.33837890625 -0.743977294921875 +0.00625 0.34600830078125 -0.743977294921875 +0.006375 0.349761962890625 -0.743977294921875 +0.0065 0.353485107421875 -0.743977294921875 +0.006625000000000001 0.360809326171875 -0.743977294921875 +0.00675 0.36444091796875 -0.743977294921875 +0.006875 0.37152099609375 -0.743977294921875 +0.007000000000000001 0.375 -0.743977294921875 +0.007125000000000002 0.3818359375 -0.743977294921875 +0.007250000000000001 0.38519287109375 -0.743977294921875 +0.007375 0.388519287109375 -0.743977294921875 +0.0075 0.39501953125 -0.743977294921875 +0.007625 0.398193359375 -0.743977294921875 +0.00775 0.404449462890625 -0.743977294921875 +0.007875 0.407501220703125 -0.743977294921875 +0.008 0.413482666015625 -0.743977294921875 +0.008125 0.416412353515625 -0.743977294921875 +0.00825 0.422119140625 -0.743977294921875 +0.008375 0.424896240234375 -0.743977294921875 +0.0085 0.4276123046875 -0.743977294921875 +0.008625 0.432952880859375 -0.743977294921875 +0.008750000000000002 0.435546875 -0.743977294921875 +0.008875 0.440582275390625 -0.743977294921875 +0.009000000000000002 0.44305419921875 -0.743977294921875 +0.009125 0.447784423828125 -0.743977294921875 +0.00925 0.450103759765625 -0.743977294921875 +0.009375 0.452362060546875 -0.743977294921875 +0.0095 0.45672607421875 -0.743977294921875 +0.009625 0.458831787109375 -0.743977294921875 +0.00975 0.462890625 -0.743977294921875 +0.009875 0.464813232421875 -0.743977294921875 +0.01 0.46856689453125 -0.743977294921875 +0.010125 0.470367431640625 -0.743977294921875 +0.01025 0.472137451171875 -0.743977294921875 +0.010375 0.4754638671875 -0.743977294921875 +0.0105 0.47705078125 -0.743977294921875 +0.010625 0.480072021484375 -0.743977294921875 +0.01075 0.48150634765625 -0.743977294921875 +0.010875 0.484222412109375 -0.743977294921875 +0.011 0.485504150390625 -0.743977294921875 +0.011125 0.486724853515625 -0.743977294921875 +0.01125 0.489013671875 -0.743977294921875 +0.011375 0.490081787109375 -0.743977294921875 +0.0115 0.492034912109375 -0.743977294921875 +0.011625 0.492950439453125 -0.743977294921875 +0.01175 0.49456787109375 -0.743977294921875 +0.011875 0.49530029296875 -0.743977294921875 +0.012 0.496612548828125 -0.743977294921875 +0.012125 0.4971923828125 -0.743977294921875 +0.01225 0.497711181640625 -0.743977294921875 +0.012375 0.49859619140625 -0.743977294921875 +0.0125 0.49896240234375 -0.743977294921875 +0.012625 0.49951171875 -0.743977294921875 +0.01275 0.49969482421875 -0.743977294921875 +0.012875 0.499908447265625 -0.743977294921875 +0.013 0.49993896484375 -0.743977294921875 +0.013125 0.499908447265625 -0.743977294921875 +0.01325 0.49969482421875 -0.743977294921875 +0.013375 0.49951171875 -0.743977294921875 +0.0135 0.49896240234375 -0.743977294921875 +0.013625 0.49859619140625 -0.743977294921875 +0.01375 0.497711181640625 -0.743977294921875 +0.013875 0.4971923828125 -0.743977294921875 +0.014 0.496612548828125 -0.743977294921875 +0.014125 0.49530029296875 -0.743977294921875 +0.01425 0.49456787109375 -0.743977294921875 +0.014375 0.492950439453125 -0.743977294921875 +0.0145 0.492034912109375 -0.743977294921875 +0.014625 0.490081787109375 -0.743977294921875 +0.01475 0.489013671875 -0.743977294921875 +0.014875 0.487884521484375 -0.743977294921875 +0.015 0.485504150390625 -0.743977294921875 +0.015125 0.484222412109375 -0.743977294921875 +0.01525 0.48150634765625 -0.743977294921875 +0.015375 0.480072021484375 -0.743977294921875 +0.0155 0.47705078125 -0.743977294921875 +0.015625 0.4754638671875 -0.743977294921875 +0.01575 0.472137451171875 -0.743977294921875 +0.015875 0.470367431640625 -0.743977294921875 +0.016 0.46856689453125 -0.743977294921875 +0.016125 0.464813232421875 -0.743977294921875 +0.01625 0.462890625 -0.743977294921875 +0.016375 0.458831787109375 -0.743977294921875 +0.0165 0.45672607421875 -0.743977294921875 +0.016625 0.452362060546875 -0.743977294921875 +0.01675 0.450103759765625 -0.743977294921875 +0.016875 0.447784423828125 -0.743977294921875 +0.017 0.44305419921875 -0.743977294921875 +0.017125 0.440582275390625 -0.743977294921875 +0.01725 0.435546875 -0.743977294921875 +0.017375 0.432952880859375 -0.743977294921875 +0.0175 0.4276123046875 -0.743977294921875 +0.017625 0.424896240234375 -0.743977294921875 +0.01775 0.422119140625 -0.743977294921875 +0.017875 0.416412353515625 -0.743977294921875 +0.018 0.413482666015625 -0.743977294921875 +0.018125 0.407501220703125 -0.743977294921875 +0.01825 0.404449462890625 -0.743977294921875 +0.018375 0.398193359375 -0.743977294921875 +0.0185 0.39501953125 -0.743977294921875 +0.018625 0.39178466796875 -0.743977294921875 +0.01875 0.38519287109375 -0.743977294921875 +0.018875 0.3818359375 -0.743977294921875 +0.019 0.375 -0.743977294921875 +0.019125 0.37152099609375 -0.743977294921875 +0.01925 0.36444091796875 -0.743977294921875 +0.019375 0.360809326171875 -0.743977294921875 +0.0195 0.353485107421875 -0.743977294921875 +0.019625 0.349761962890625 -0.743977294921875 +0.01975 0.34600830078125 -0.743977294921875 +0.019875 0.33837890625 -0.743977294921875 +0.02 0.334503173828125 -0.743977294921875 +0.020125 0.32666015625 -0.743977294921875 +0.02025 0.322662353515625 -0.743977294921875 +0.020375 0.314605712890625 -0.743977294921875 +0.0205 0.310516357421875 -0.743977294921875 +0.020625 0.306396484375 -0.743977294921875 +0.02075 0.298065185546875 -0.743977294921875 +0.020875 0.2938232421875 -0.743977294921875 +0.021 0.285308837890625 -0.743977294921875 +0.021125 0.280975341796875 -0.743977294921875 +0.02125 0.27227783203125 -0.743977294921875 +0.021375 0.267852783203125 -0.743977294921875 +0.0215 0.263427734375 -0.743977294921875 +0.021625 0.25445556640625 -0.743977294921875 +0.02175 0.249969482421875 -0.743977294921875 +0.021875 0.2408447265625 -0.743977294921875 +0.022 0.236236572265625 -0.743977294921875 +0.022125 0.226959228515625 -0.743977294921875 +0.02225 0.2222900390625 -0.743977294921875 +0.022375 0.21759033203125 -0.743977294921875 +0.0225 0.208099365234375 -0.743977294921875 +0.022625 0.203338623046875 -0.743977294921875 +0.02275 0.1937255859375 -0.743977294921875 +0.022875 0.188873291015625 -0.743977294921875 +0.023 0.17913818359375 -0.743977294921875 +0.023125 0.17425537109375 -0.743977294921875 +0.02325 0.164398193359375 -0.743977294921875 +0.023375 0.159454345703125 -0.743977294921875 +0.0235 0.15447998046875 -0.743977294921875 +0.023625 0.14447021484375 -0.743977294921875 +0.02375 0.13946533203125 -0.743977294921875 +0.023875 0.129364013671875 -0.743977294921875 +0.024 0.124298095703125 -0.743977294921875 +0.024125 0.1141357421875 -0.743977294921875 +0.02425 0.109039306640625 -0.743977294921875 +0.024375 0.103912353515625 -0.743977294921875 +0.0245 0.093658447265625 -0.743977294921875 +0.024625 0.0885009765625 -0.743977294921875 +0.02475 0.07818603515625 -0.743977294921875 +0.024875 0.072998046875 -0.743977294921875 +0.025 0.0626220703125 -0.743977294921875 +0.025125 0.05743408203125 -0.743977294921875 +0.02525 0.05224609375 -0.743977294921875 +0.02537500000000001 0.04180908203125 -0.743977294921875 +0.0255 0.036590576171875 -0.743977294921875 +0.025625 0.026123046875 -0.743977294921875 +0.02575 0.020904541015625 -0.743977294921875 +0.025875 0.01043701171875 -0.743977294921875 +0.026 0.005218505859375 -0.743977294921875 +0.026125 0.0 -0.743977294921875 +0.02625 -0.01043701171875 -0.743977294921875 +0.026375 -0.01568603515625 -0.743977294921875 +0.0265 -0.026123046875 -0.743977294921875 +0.026625 -0.0313720703125 -0.743977294921875 +0.02675 -0.04180908203125 -0.743977294921875 +0.026875 -0.047027587890625 -0.743977294921875 +0.027 -0.05224609375 -0.743977294921875 +0.027125 -0.0626220703125 -0.743977294921875 +0.02725 -0.06781005859375 -0.743977294921875 +0.027375 -0.07818603515625 -0.743977294921875 +0.0275 -0.083343505859375 -0.743977294921875 +0.027625 -0.093658447265625 -0.743977294921875 +0.02775 -0.098785400390625 -0.743977294921875 +0.027875 -0.109039306640625 -0.743977294921875 +0.028 -0.1141357421875 -0.743977294921875 +0.028125 -0.119232177734375 -0.743977294921875 +0.02825 -0.129364013671875 -0.743977294921875 +0.028375 -0.134429931640625 -0.743977294921875 +0.02850000000000001 -0.14447021484375 -0.743977294921875 +0.028625 -0.14947509765625 -0.743977294921875 +0.02875 -0.159454345703125 -0.743977294921875 +0.028875 -0.164398193359375 -0.743977294921875 +0.029 -0.169342041015625 -0.743977294921875 +0.029125 -0.17913818359375 -0.743977294921875 +0.02925 -0.18402099609375 -0.743977294921875 +0.029375 -0.1937255859375 -0.743977294921875 +0.0295 -0.19854736328125 -0.743977294921875 +0.029625 -0.208099365234375 -0.743977294921875 +0.02975000000000001 -0.212860107421875 -0.743977294921875 +0.029875 -0.21759033203125 -0.743977294921875 +0.03 -0.226959228515625 -0.743977294921875 +0.030125 -0.231597900390625 -0.743977294921875 +0.03025 -0.2408447265625 -0.743977294921875 +0.030375 -0.24542236328125 -0.743977294921875 +0.0305 -0.25445556640625 -0.743977294921875 +0.030625 -0.25897216796875 -0.743977294921875 +0.03075 -0.263427734375 -0.743977294921875 +0.03087499999999999 -0.27227783203125 -0.743977294921875 +0.031 -0.276641845703125 -0.743977294921875 +0.031125 -0.285308837890625 -0.743977294921875 +0.03125 -0.289581298828125 -0.743977294921875 +0.031375 -0.298065185546875 -0.743977294921875 +0.0315 -0.30224609375 -0.743977294921875 +0.03162500000000001 -0.310516357421875 -0.743977294921875 +0.03175 -0.314605712890625 -0.743977294921875 +0.031875 -0.31866455078125 -0.743977294921875 +0.032 -0.32666015625 -0.487985107421875 +0.032125 -0.334503173828125 -0.487985107421875 +0.03225 -0.34222412109375 -0.487985107421875 +0.032375 -0.34600830078125 -0.487985107421875 +0.0325 -0.353485107421875 -0.487985107421875 +0.032625 -0.360809326171875 -0.487985107421875 +0.03275 -0.36444091796875 -0.487985107421875 +0.032875 -0.37152099609375 -0.487985107421875 +0.033 -0.378448486328125 -0.487985107421875 +0.033125 -0.38519287109375 -0.487985107421875 +0.03325 -0.388519287109375 -0.487985107421875 +0.033375 -0.39501953125 -0.487985107421875 +0.0335 -0.401336669921875 -0.487985107421875 +0.03362500000000001 -0.404449462890625 -0.487985107421875 +0.03375 -0.4105224609375 -0.487985107421875 +0.033875 -0.416412353515625 -0.487985107421875 +0.034 -0.419281005859375 -0.487985107421875 +0.03412500000000001 -0.424896240234375 -0.487985107421875 +0.03425 -0.4302978515625 -0.487985107421875 +0.034375 -0.435546875 -0.487985107421875 +0.0345 -0.438079833984375 -0.487985107421875 +0.034625 -0.44305419921875 -0.487985107421875 +0.03475000000000001 -0.447784423828125 -0.487985107421875 +0.034875 -0.450103759765625 -0.487985107421875 +0.035 -0.454559326171875 -0.487985107421875 +0.03512500000000001 -0.458831787109375 -0.487985107421875 +0.03525 -0.462890625 -0.487985107421875 +0.035375 -0.464813232421875 -0.487985107421875 +0.0355 -0.46856689453125 -0.487985107421875 +0.03562500000000001 -0.472137451171875 -0.487985107421875 +0.03575 -0.47381591796875 -0.487985107421875 +0.035875 -0.47705078125 -0.487985107421875 +0.03600000000000001 -0.480072021484375 -0.487985107421875 +0.036125 -0.48291015625 -0.487985107421875 +0.03625 -0.484222412109375 -0.487985107421875 +0.036375 -0.486724853515625 -0.487985107421875 +0.0365 -0.489013671875 -0.487985107421875 +0.036625 -0.490081787109375 -0.487985107421875 +0.03675 -0.492034912109375 -0.487985107421875 +0.036875 -0.4937744140625 -0.487985107421875 +0.037 -0.49530029296875 -0.487985107421875 +0.03712499999999999 -0.496002197265625 -0.487985107421875 +0.03725 -0.4971923828125 -0.487985107421875 +0.037375 -0.498199462890625 -0.487985107421875 +0.0375 -0.49859619140625 -0.487985107421875 +0.037625 -0.499267578125 -0.487985107421875 +0.03775 -0.49969482421875 -0.487985107421875 +0.037875 -0.499908447265625 -0.487985107421875 +0.038 -0.49993896484375 -0.487985107421875 +0.038125 -0.49981689453125 -0.487985107421875 +0.03825 -0.49951171875 -0.487985107421875 +0.038375 -0.499267578125 -0.487985107421875 +0.0385 -0.49859619140625 -0.487985107421875 +0.038625 -0.497711181640625 -0.487985107421875 +0.03875 -0.496612548828125 -0.487985107421875 +0.038875 -0.496002197265625 -0.487985107421875 +0.039 -0.49456787109375 -0.487985107421875 +0.039125 -0.492950439453125 -0.487985107421875 +0.03925 -0.492034912109375 -0.487985107421875 +0.039375 -0.490081787109375 -0.487985107421875 +0.0395 -0.487884521484375 -0.487985107421875 +0.039625 -0.485504150390625 -0.487985107421875 +0.03975 -0.484222412109375 -0.487985107421875 +0.039875 -0.48150634765625 -0.487985107421875 +0.04 -0.478607177734375 -0.487985107421875 +0.040125 -0.47705078125 -0.487985107421875 +0.04025 -0.47381591796875 -0.487985107421875 +0.040375 -0.470367431640625 -0.487985107421875 +0.04050000000000001 -0.46856689453125 -0.487985107421875 +0.040625 -0.464813232421875 -0.487985107421875 +0.04075 -0.46087646484375 -0.487985107421875 +0.040875 -0.45672607421875 -0.487985107421875 +0.04100000000000001 -0.454559326171875 -0.487985107421875 +0.041125 -0.450103759765625 -0.487985107421875 +0.04125 -0.4454345703125 -0.487985107421875 +0.041375 -0.44305419921875 -0.487985107421875 +0.0415 -0.438079833984375 -0.487985107421875 +0.041625 -0.432952880859375 -0.487985107421875 +0.04175000000000001 -0.4276123046875 -0.487985107421875 +0.041875 -0.424896240234375 -0.487985107421875 +0.042 -0.419281005859375 -0.487985107421875 +0.042125 -0.413482666015625 -0.487985107421875 +0.04225000000000001 -0.4105224609375 -0.487985107421875 +0.042375 -0.404449462890625 -0.487985107421875 +0.0425 -0.398193359375 -0.487985107421875 +0.042625 -0.39178466796875 -0.487985107421875 +0.04275 -0.388519287109375 -0.487985107421875 +0.04287500000000001 -0.3818359375 -0.487985107421875 +0.04300000000000001 -0.375 -0.487985107421875 +0.043125 -0.37152099609375 -0.487985107421875 +0.04325 -0.36444091796875 -0.487985107421875 +0.043375 -0.357177734375 -0.487985107421875 +0.04350000000000001 -0.349761962890625 -0.487985107421875 +0.04362500000000001 -0.34600830078125 -0.487985107421875 +0.04375000000000001 -0.33837890625 -0.487985107421875 +0.043875 -0.330596923828125 -0.487985107421875 +0.04399999999999999 -0.32666015625 -0.487985107421875 +0.044125 -0.31866455078125 -0.487985107421875 +0.04425 -0.310516357421875 -0.487985107421875 +0.044375 -0.30224609375 -0.487985107421875 +0.04449999999999999 -0.298065185546875 -0.487985107421875 +0.04462499999999999 -0.289581298828125 -0.487985107421875 +0.04475 -0.280975341796875 -0.487985107421875 +0.044875 -0.276641845703125 -0.487985107421875 +0.045 -0.267852783203125 -0.487985107421875 +0.045125 -0.25897216796875 -0.487985107421875 +0.04525 -0.249969482421875 -0.487985107421875 +0.045375 -0.24542236328125 -0.487985107421875 +0.0455 -0.236236572265625 -0.487985107421875 +0.045625 -0.226959228515625 -0.487985107421875 +0.04575 -0.2222900390625 -0.487985107421875 +0.045875 -0.212860107421875 -0.487985107421875 +0.046 -0.203338623046875 -0.487985107421875 +0.046125 -0.1937255859375 -0.487985107421875 +0.04625 -0.188873291015625 -0.487985107421875 +0.046375 -0.17913818359375 -0.487985107421875 +0.04649999999999999 -0.169342041015625 -0.487985107421875 +0.046625 -0.164398193359375 -0.487985107421875 +0.04675000000000001 -0.15447998046875 -0.487985107421875 +0.046875 -0.14447021484375 -0.487985107421875 +0.04699999999999999 -0.13946533203125 -0.487985107421875 +0.047125 -0.129364013671875 -0.487985107421875 +0.04725000000000001 -0.119232177734375 -0.487985107421875 +0.047375 -0.109039306640625 -0.487985107421875 +0.0475 -0.103912353515625 -0.487985107421875 +0.047625 -0.093658447265625 -0.487985107421875 +0.04775 -0.083343505859375 -0.487985107421875 +0.047875 -0.07818603515625 -0.487985107421875 +0.048 -0.06781005859375 -0.487985107421875 +0.048125 -0.05743408203125 -0.487985107421875 +0.04825 -0.047027587890625 -0.487985107421875 +0.048375 -0.04180908203125 -0.487985107421875 +0.0485 -0.0313720703125 -0.487985107421875 +0.048625 -0.020904541015625 -0.487985107421875 +0.04875 -0.01568603515625 -0.487985107421875 +0.048875 -0.005218505859375 -0.487985107421875 +0.049 0.005218505859375 -0.487985107421875 +0.04912500000000001 0.01568603515625 -0.487985107421875 +0.04925000000000001 0.020904541015625 -0.487985107421875 +0.049375 0.0313720703125 -0.487985107421875 +0.0495 0.04180908203125 -0.487985107421875 +0.049625 0.047027587890625 -0.487985107421875 +0.04975000000000001 0.05743408203125 -0.487985107421875 +0.04987500000000001 0.06781005859375 -0.487985107421875 +0.05 0.07818603515625 -0.487985107421875 +0.05012499999999999 0.083343505859375 -0.487985107421875 +0.05025 0.093658447265625 -0.487985107421875 +0.05037500000000001 0.103912353515625 -0.487985107421875 +0.0505 0.109039306640625 -0.487985107421875 +0.05062500000000001 0.119232177734375 -0.487985107421875 +0.05075000000000001 0.129364013671875 -0.487985107421875 +0.050875 0.13946533203125 -0.487985107421875 +0.051 0.14447021484375 -0.487985107421875 +0.051125 0.15447998046875 -0.487985107421875 +0.05125000000000001 0.164398193359375 -0.487985107421875 +0.051375 0.169342041015625 -0.487985107421875 +0.0515 0.17913818359375 -0.487985107421875 +0.05162500000000001 0.188873291015625 -0.487985107421875 +0.05175000000000001 0.19854736328125 -0.487985107421875 +0.051875 0.203338623046875 -0.487985107421875 +0.052 0.212860107421875 -0.487985107421875 +0.052125 0.2222900390625 -0.487985107421875 +0.05225 0.226959228515625 -0.487985107421875 +0.05237499999999999 0.236236572265625 -0.487985107421875 +0.0525 0.24542236328125 -0.487985107421875 +0.052625 0.25445556640625 -0.487985107421875 +0.05274999999999999 0.25897216796875 -0.487985107421875 +0.052875 0.267852783203125 -0.487985107421875 +0.05300000000000001 0.276641845703125 -0.487985107421875 +0.053125 0.280975341796875 -0.487985107421875 +0.05324999999999999 0.289581298828125 -0.487985107421875 +0.05337499999999999 0.298065185546875 -0.487985107421875 +0.05350000000000001 0.30224609375 -0.487985107421875 +0.053625 0.310516357421875 -0.487985107421875 +0.05375 0.31866455078125 -0.487985107421875 +0.05387499999999999 0.32666015625 -0.487985107421875 +0.054 0.330596923828125 -0.487985107421875 +0.054125 0.33837890625 -0.487985107421875 +0.05425 0.34600830078125 -0.487985107421875 +0.054375 0.349761962890625 -0.487985107421875 +0.0545 0.357177734375 -0.487985107421875 +0.054625 0.36444091796875 -0.487985107421875 +0.05475 0.37152099609375 -0.487985107421875 +0.054875 0.375 -0.487985107421875 +0.055 0.3818359375 -0.487985107421875 +0.055125 0.388519287109375 -0.487985107421875 +0.05525 0.39178466796875 -0.487985107421875 +0.055375 0.398193359375 -0.487985107421875 +0.05550000000000001 0.404449462890625 -0.487985107421875 +0.055625 0.4105224609375 -0.487985107421875 +0.05575 0.413482666015625 -0.487985107421875 +0.05587499999999999 0.419281005859375 -0.487985107421875 +0.05600000000000001 0.424896240234375 -0.487985107421875 +0.05612500000000001 0.4276123046875 -0.487985107421875 +0.05625 0.432952880859375 -0.487985107421875 +0.05637499999999999 0.438079833984375 -0.487985107421875 +0.0565 0.44305419921875 -0.487985107421875 +0.05662500000000001 0.4454345703125 -0.487985107421875 +0.05675 0.450103759765625 -0.487985107421875 +0.056875 0.454559326171875 -0.487985107421875 +0.05700000000000001 0.45672607421875 -0.487985107421875 +0.057125 0.46087646484375 -0.487985107421875 +0.05725 0.464813232421875 -0.487985107421875 +0.057375 0.46856689453125 -0.487985107421875 +0.05750000000000001 0.470367431640625 -0.487985107421875 +0.057625 0.47381591796875 -0.487985107421875 +0.05775 0.47705078125 -0.487985107421875 +0.057875 0.478607177734375 -0.487985107421875 +0.05800000000000001 0.48150634765625 -0.487985107421875 +0.058125 0.484222412109375 -0.487985107421875 +0.05825 0.486724853515625 -0.487985107421875 +0.058375 0.487884521484375 -0.487985107421875 +0.05850000000000001 0.490081787109375 -0.487985107421875 +0.05862500000000001 0.492034912109375 -0.487985107421875 +0.05875 0.492950439453125 -0.487985107421875 +0.058875 0.49456787109375 -0.487985107421875 +0.059 0.496002197265625 -0.487985107421875 +0.05912500000000001 0.4971923828125 -0.487985107421875 +0.05925000000000001 0.497711181640625 -0.487985107421875 +0.059375 0.49859619140625 -0.487985107421875 +0.05950000000000001 0.499267578125 -0.487985107421875 +0.059625 0.49951171875 -0.487985107421875 +0.05975000000000001 0.49981689453125 -0.487985107421875 +0.059875 0.49993896484375 -0.487985107421875 +0.06 0.499908447265625 -0.487985107421875 +0.06012499999999999 0.49969482421875 -0.487985107421875 +0.06025 0.499267578125 -0.487985107421875 +0.060375 0.49859619140625 -0.487985107421875 +0.0605 0.498199462890625 -0.487985107421875 +0.060625 0.4971923828125 -0.487985107421875 +0.06074999999999999 0.496002197265625 -0.487985107421875 +0.060875 0.49530029296875 -0.487985107421875 +0.061 0.4937744140625 -0.487985107421875 +0.061125 0.492034912109375 -0.487985107421875 +0.06125 0.490081787109375 -0.487985107421875 +0.061375 0.489013671875 -0.487985107421875 +0.0615 0.486724853515625 -0.487985107421875 +0.061625 0.484222412109375 -0.487985107421875 +0.06174999999999999 0.48291015625 -0.487985107421875 +0.061875 0.480072021484375 -0.487985107421875 +0.062 0.47705078125 -0.487985107421875 +0.06212499999999999 0.47381591796875 -0.487985107421875 +0.06225000000000001 0.472137451171875 -0.487985107421875 +0.06237500000000001 0.46856689453125 -0.487985107421875 +0.0625 0.464813232421875 -0.487985107421875 +0.06262499999999999 0.462890625 -0.487985107421875 +0.06274999999999999 0.458831787109375 -0.487985107421875 +0.06287500000000001 0.454559326171875 -0.487985107421875 +0.063 0.450103759765625 -0.487985107421875 +0.063125 0.447784423828125 -0.487985107421875 +0.06325000000000001 0.44305419921875 -0.487985107421875 +0.063375 0.438079833984375 -0.487985107421875 +0.0635 0.435546875 -0.487985107421875 +0.063625 0.4302978515625 -0.487985107421875 +0.06375 0.424896240234375 -0.487985107421875 +0.063875 0.419281005859375 -0.487985107421875 +0.064 0.413482666015625 -0.2319929199218749 +0.064125 0.407501220703125 -0.2319929199218749 +0.06425000000000001 0.401336669921875 -0.2319929199218749 +0.064375 0.39501953125 -0.2319929199218749 +0.0645 0.388519287109375 -0.2319929199218749 +0.064625 0.3818359375 -0.2319929199218749 +0.06475 0.375 -0.2319929199218749 +0.06487500000000001 0.36798095703125 -0.2319929199218749 +0.065 0.360809326171875 -0.2319929199218749 +0.065125 0.353485107421875 -0.2319929199218749 +0.06525 0.34600830078125 -0.2319929199218749 +0.06537500000000001 0.33837890625 -0.2319929199218749 +0.06550000000000001 0.330596923828125 -0.2319929199218749 +0.065625 0.322662353515625 -0.2319929199218749 +0.06574999999999999 0.314605712890625 -0.2319929199218749 +0.065875 0.306396484375 -0.2319929199218749 +0.06600000000000001 0.298065185546875 -0.2319929199218749 +0.066125 0.289581298828125 -0.2319929199218749 +0.06625000000000001 0.280975341796875 -0.2319929199218749 +0.06637500000000001 0.27227783203125 -0.2319929199218749 +0.0665 0.263427734375 -0.2319929199218749 +0.066625 0.249969482421875 -0.2319929199218749 +0.06675 0.2408447265625 -0.2319929199218749 +0.06687500000000001 0.231597900390625 -0.2319929199218749 +0.067 0.2222900390625 -0.2319929199218749 +0.067125 0.212860107421875 -0.2319929199218749 +0.06725000000000001 0.203338623046875 -0.2319929199218749 +0.06737500000000001 0.1937255859375 -0.2319929199218749 +0.0675 0.18402099609375 -0.2319929199218749 +0.067625 0.17425537109375 -0.2319929199218749 +0.06775 0.164398193359375 -0.2319929199218749 +0.06787500000000001 0.15447998046875 -0.2319929199218749 +0.06800000000000001 0.14447021484375 -0.2319929199218749 +0.068125 0.134429931640625 -0.2319929199218749 +0.06825000000000001 0.124298095703125 -0.2319929199218749 +0.068375 0.1141357421875 -0.2319929199218749 +0.06850000000000001 0.103912353515625 -0.2319929199218749 +0.06862500000000001 0.093658447265625 -0.2319929199218749 +0.06875 0.083343505859375 -0.2319929199218749 +0.06887500000000001 0.072998046875 -0.2319929199218749 +0.069 0.0626220703125 -0.2319929199218749 +0.06912500000000001 0.05224609375 -0.2319929199218749 +0.06925000000000001 0.04180908203125 -0.2319929199218749 +0.06937500000000001 0.0313720703125 -0.2319929199218749 +0.06950000000000001 0.01568603515625 -0.2319929199218749 +0.069625 0.005218505859375 -0.2319929199218749 +0.06975 -0.005218505859375 -0.2319929199218749 +0.06987500000000001 -0.01568603515625 -0.2319929199218749 +0.07000000000000001 -0.026123046875 -0.2319929199218749 +0.070125 -0.036590576171875 -0.2319929199218749 +0.07025000000000001 -0.047027587890625 -0.2319929199218749 +0.07037500000000001 -0.05743408203125 -0.2319929199218749 +0.07050000000000001 -0.06781005859375 -0.2319929199218749 +0.070625 -0.07818603515625 -0.2319929199218749 +0.07075 -0.0885009765625 -0.2319929199218749 +0.07087500000000001 -0.098785400390625 -0.2319929199218749 +0.07100000000000001 -0.109039306640625 -0.2319929199218749 +0.07112500000000001 -0.119232177734375 -0.2319929199218749 +0.07125000000000002 -0.129364013671875 -0.2319929199218749 +0.07137500000000001 -0.13946533203125 -0.2319929199218749 +0.0715 -0.14947509765625 -0.2319929199218749 +0.07162500000000001 -0.159454345703125 -0.2319929199218749 +0.07175000000000001 -0.169342041015625 -0.2319929199218749 +0.07187500000000001 -0.17913818359375 -0.2319929199218749 +0.07200000000000001 -0.188873291015625 -0.2319929199218749 +0.07212499999999999 -0.19854736328125 -0.2319929199218749 +0.07225 -0.212860107421875 -0.2319929199218749 +0.07237499999999999 -0.2222900390625 -0.2319929199218749 +0.0725 -0.231597900390625 -0.2319929199218749 +0.07262499999999999 -0.2408447265625 -0.2319929199218749 +0.07274999999999999 -0.249969482421875 -0.2319929199218749 +0.072875 -0.25897216796875 -0.2319929199218749 +0.073 -0.267852783203125 -0.2319929199218749 +0.073125 -0.276641845703125 -0.2319929199218749 +0.07324999999999999 -0.285308837890625 -0.2319929199218749 +0.07337499999999999 -0.2938232421875 -0.2319929199218749 +0.0735 -0.30224609375 -0.2319929199218749 +0.073625 -0.310516357421875 -0.2319929199218749 +0.07374999999999999 -0.31866455078125 -0.2319929199218749 +0.073875 -0.32666015625 -0.2319929199218749 +0.074 -0.334503173828125 -0.2319929199218749 +0.074125 -0.34222412109375 -0.2319929199218749 +0.07424999999999999 -0.349761962890625 -0.2319929199218749 +0.07437499999999999 -0.357177734375 -0.2319929199218749 +0.0745 -0.36444091796875 -0.2319929199218749 +0.07462499999999999 -0.37152099609375 -0.2319929199218749 +0.07475 -0.378448486328125 -0.2319929199218749 +0.07487500000000001 -0.38519287109375 -0.2319929199218749 +0.075 -0.39178466796875 -0.2319929199218749 +0.07512499999999999 -0.401336669921875 -0.2319929199218749 +0.07524999999999999 -0.407501220703125 -0.2319929199218749 +0.075375 -0.413482666015625 -0.2319929199218749 +0.0755 -0.419281005859375 -0.2319929199218749 +0.075625 -0.424896240234375 -0.2319929199218749 +0.07574999999999999 -0.4302978515625 -0.2319929199218749 +0.075875 -0.435546875 -0.2319929199218749 +0.076 -0.440582275390625 -0.2319929199218749 +0.076125 -0.4454345703125 -0.2319929199218749 +0.07625 -0.450103759765625 -0.2319929199218749 +0.07637499999999999 -0.454559326171875 -0.2319929199218749 +0.0765 -0.458831787109375 -0.2319929199218749 +0.076625 -0.462890625 -0.2319929199218749 +0.07675 -0.46673583984375 -0.2319929199218749 +0.076875 -0.470367431640625 -0.2319929199218749 +0.077 -0.47381591796875 -0.2319929199218749 +0.077125 -0.47705078125 -0.2319929199218749 +0.07725 -0.480072021484375 -0.2319929199218749 +0.07737499999999999 -0.48291015625 -0.2319929199218749 +0.0775 -0.485504150390625 -0.2319929199218749 +0.077625 -0.487884521484375 -0.2319929199218749 +0.07774999999999999 -0.490081787109375 -0.2319929199218749 +0.07787500000000001 -0.492034912109375 -0.2319929199218749 +0.07800000000000001 -0.49456787109375 -0.2319929199218749 +0.078125 -0.496002197265625 -0.2319929199218749 +0.07824999999999999 -0.4971923828125 -0.2319929199218749 +0.07837499999999999 -0.498199462890625 -0.2319929199218749 +0.07850000000000001 -0.49896240234375 -0.2319929199218749 +0.078625 -0.49951171875 -0.2319929199218749 +0.07875 -0.49981689453125 -0.2319929199218749 +0.07887500000000001 -0.49993896484375 -0.2319929199218749 +0.079 -0.49981689453125 -0.2319929199218749 +0.079125 -0.49951171875 -0.2319929199218749 +0.07925 -0.49896240234375 -0.2319929199218749 +0.079375 -0.498199462890625 -0.2319929199218749 +0.0795 -0.4971923828125 -0.2319929199218749 +0.079625 -0.496002197265625 -0.2319929199218749 +0.07975 -0.49456787109375 -0.2319929199218749 +0.07987500000000001 -0.492950439453125 -0.2319929199218749 +0.08 -0.4910888671875 -0.2319929199218749 +0.08012499999999999 -0.489013671875 -0.2319929199218749 +0.08025 -0.486724853515625 -0.2319929199218749 +0.080375 -0.484222412109375 -0.2319929199218749 +0.08050000000000001 -0.48150634765625 -0.2319929199218749 +0.080625 -0.478607177734375 -0.2319929199218749 +0.08074999999999999 -0.47381591796875 -0.2319929199218749 +0.080875 -0.470367431640625 -0.2319929199218749 +0.08100000000000001 -0.46673583984375 -0.2319929199218749 +0.08112500000000001 -0.462890625 -0.2319929199218749 +0.08125 -0.458831787109375 -0.2319929199218749 +0.08137499999999999 -0.454559326171875 -0.2319929199218749 +0.0815 -0.450103759765625 -0.2319929199218749 +0.081625 -0.4454345703125 -0.2319929199218749 +0.08175000000000001 -0.440582275390625 -0.2319929199218749 +0.081875 -0.435546875 -0.2319929199218749 +0.08200000000000001 -0.4302978515625 -0.2319929199218749 +0.082125 -0.424896240234375 -0.2319929199218749 +0.08225 -0.419281005859375 -0.2319929199218749 +0.08237500000000001 -0.413482666015625 -0.2319929199218749 +0.0825 -0.407501220703125 -0.2319929199218749 +0.08262500000000001 -0.401336669921875 -0.2319929199218749 +0.08275 -0.39501953125 -0.2319929199218749 +0.08287500000000001 -0.388519287109375 -0.2319929199218749 +0.08300000000000001 -0.3818359375 -0.2319929199218749 +0.083125 -0.375 -0.2319929199218749 +0.08324999999999999 -0.36798095703125 -0.2319929199218749 +0.083375 -0.360809326171875 -0.2319929199218749 +0.08350000000000001 -0.353485107421875 -0.2319929199218749 +0.08362500000000001 -0.34222412109375 -0.2319929199218749 +0.08375 -0.334503173828125 -0.2319929199218749 +0.08387500000000001 -0.32666015625 -0.2319929199218749 +0.084 -0.31866455078125 -0.2319929199218749 +0.08412500000000001 -0.310516357421875 -0.2319929199218749 +0.08425000000000001 -0.30224609375 -0.2319929199218749 +0.084375 -0.2938232421875 -0.2319929199218749 +0.08450000000000001 -0.285308837890625 -0.2319929199218749 +0.084625 -0.276641845703125 -0.2319929199218749 +0.08475 -0.267852783203125 -0.2319929199218749 +0.08487500000000001 -0.25897216796875 -0.2319929199218749 +0.085 -0.249969482421875 -0.2319929199218749 +0.08512500000000001 -0.2408447265625 -0.2319929199218749 +0.08525 -0.231597900390625 -0.2319929199218749 +0.085375 -0.2222900390625 -0.2319929199218749 +0.08550000000000001 -0.212860107421875 -0.2319929199218749 +0.085625 -0.203338623046875 -0.2319929199218749 +0.08575000000000001 -0.1937255859375 -0.2319929199218749 +0.08587500000000002 -0.18402099609375 -0.2319929199218749 +0.08600000000000001 -0.17425537109375 -0.2319929199218749 +0.08612500000000001 -0.164398193359375 -0.2319929199218749 +0.08625 -0.15447998046875 -0.2319929199218749 +0.08637499999999999 -0.14447021484375 -0.2319929199218749 +0.0865 -0.129364013671875 -0.2319929199218749 +0.08662500000000001 -0.119232177734375 -0.2319929199218749 +0.08675000000000001 -0.109039306640625 -0.2319929199218749 +0.08687500000000002 -0.098785400390625 -0.2319929199218749 +0.08700000000000001 -0.0885009765625 -0.2319929199218749 +0.087125 -0.07818603515625 -0.2319929199218749 +0.08725000000000001 -0.06781005859375 -0.2319929199218749 +0.08737500000000001 -0.05743408203125 -0.2319929199218749 +0.08750000000000002 -0.047027587890625 -0.2319929199218749 +0.08762500000000001 -0.036590576171875 -0.2319929199218749 +0.08775 -0.026123046875 -0.2319929199218749 +0.08787500000000001 -0.01568603515625 -0.2319929199218749 +0.08799999999999999 -0.005218505859375 -0.2319929199218749 +0.088125 0.005218505859375 -0.2319929199218749 +0.08824999999999999 0.01568603515625 -0.2319929199218749 +0.08837499999999999 0.026123046875 -0.2319929199218749 +0.0885 0.036590576171875 -0.2319929199218749 +0.08862500000000001 0.047027587890625 -0.2319929199218749 +0.08875 0.05743408203125 -0.2319929199218749 +0.08887499999999999 0.06781005859375 -0.2319929199218749 +0.08899999999999999 0.07818603515625 -0.2319929199218749 +0.089125 0.0885009765625 -0.2319929199218749 +0.08924999999999999 0.098785400390625 -0.2319929199218749 +0.089375 0.1141357421875 -0.2319929199218749 +0.08949999999999999 0.124298095703125 -0.2319929199218749 +0.089625 0.134429931640625 -0.2319929199218749 +0.08975 0.14447021484375 -0.2319929199218749 +0.08987499999999999 0.15447998046875 -0.2319929199218749 +0.09 0.164398193359375 -0.2319929199218749 +0.09012499999999999 0.17425537109375 -0.2319929199218749 +0.09025 0.18402099609375 -0.2319929199218749 +0.090375 0.1937255859375 -0.2319929199218749 +0.09050000000000001 0.203338623046875 -0.2319929199218749 +0.090625 0.212860107421875 -0.2319929199218749 +0.09074999999999999 0.2222900390625 -0.2319929199218749 +0.09087499999999999 0.231597900390625 -0.2319929199218749 +0.091 0.2408447265625 -0.2319929199218749 +0.09112500000000001 0.249969482421875 -0.2319929199218749 +0.09125 0.25897216796875 -0.2319929199218749 +0.09137499999999999 0.267852783203125 -0.2319929199218749 +0.0915 0.276641845703125 -0.2319929199218749 +0.091625 0.285308837890625 -0.2319929199218749 +0.09175000000000001 0.2938232421875 -0.2319929199218749 +0.091875 0.30224609375 -0.2319929199218749 +0.09199999999999999 0.310516357421875 -0.2319929199218749 +0.092125 0.322662353515625 -0.2319929199218749 +0.09225 0.330596923828125 -0.2319929199218749 +0.09237499999999999 0.33837890625 -0.2319929199218749 +0.0925 0.34600830078125 -0.2319929199218749 +0.09262499999999999 0.353485107421875 -0.2319929199218749 +0.09275 0.360809326171875 -0.2319929199218749 +0.092875 0.36798095703125 -0.2319929199218749 +0.09299999999999999 0.375 -0.2319929199218749 +0.093125 0.3818359375 -0.2319929199218749 +0.09324999999999999 0.388519287109375 -0.2319929199218749 +0.093375 0.39501953125 -0.2319929199218749 +0.09350000000000001 0.401336669921875 -0.2319929199218749 +0.09362500000000001 0.407501220703125 -0.2319929199218749 +0.09375 0.413482666015625 -0.2319929199218749 +0.09387499999999999 0.419281005859375 -0.2319929199218749 +0.09399999999999999 0.424896240234375 -0.2319929199218749 +0.094125 0.4302978515625 -0.2319929199218749 +0.09425000000000001 0.435546875 -0.2319929199218749 +0.094375 0.440582275390625 -0.2319929199218749 +0.09450000000000001 0.4454345703125 -0.2319929199218749 +0.094625 0.450103759765625 -0.2319929199218749 +0.09475 0.454559326171875 -0.2319929199218749 +0.09487500000000001 0.458831787109375 -0.2319929199218749 +0.095 0.464813232421875 -0.2319929199218749 +0.09512500000000001 0.46856689453125 -0.2319929199218749 +0.09525 0.472137451171875 -0.2319929199218749 +0.095375 0.4754638671875 -0.2319929199218749 +0.09550000000000001 0.478607177734375 -0.2319929199218749 +0.095625 0.48150634765625 -0.2319929199218749 +0.09574999999999999 0.484222412109375 -0.2319929199218749 +0.095875 0.486724853515625 -0.2319929199218749 +0.096 0.489013671875 0.02399926757812504 +0.09612500000000001 0.492034912109375 0.02399926757812504 +0.09625 0.4937744140625 0.02399926757812504 +0.09637499999999999 0.496002197265625 0.02399926757812504 +0.0965 0.4971923828125 0.02399926757812504 +0.09662500000000001 0.498199462890625 0.02399926757812504 +0.09675000000000001 0.499267578125 0.02399926757812504 +0.096875 0.49969482421875 0.02399926757812504 +0.09699999999999999 0.49993896484375 0.02399926757812504 +0.097125 0.49981689453125 0.02399926757812504 +0.09725 0.499267578125 0.02399926757812504 +0.09737500000000001 0.49859619140625 0.02399926757812504 +0.0975 0.4971923828125 0.02399926757812504 +0.09762500000000001 0.496002197265625 0.02399926757812504 +0.09775 0.49456787109375 0.02399926757812504 +0.097875 0.492034912109375 0.02399926757812504 +0.09800000000000001 0.490081787109375 0.02399926757812504 +0.098125 0.486724853515625 0.02399926757812504 +0.09825000000000001 0.484222412109375 0.02399926757812504 +0.098375 0.480072021484375 0.02399926757812504 +0.09850000000000001 0.47705078125 0.02399926757812504 +0.09862500000000001 0.472137451171875 0.02399926757812504 +0.09875 0.46856689453125 0.02399926757812504 +0.09887499999999999 0.464813232421875 0.02399926757812504 +0.099 0.458831787109375 0.02399926757812504 +0.09912500000000001 0.454559326171875 0.02399926757812504 +0.09925000000000001 0.447784423828125 0.02399926757812504 +0.099375 0.44305419921875 0.02399926757812504 +0.09950000000000001 0.435546875 0.02399926757812504 +0.099625 0.4302978515625 0.02399926757812504 +0.09975000000000001 0.422119140625 0.02399926757812504 +0.09987500000000001 0.416412353515625 0.02399926757812504 +0.1 0.4105224609375 0.02399926757812504 +0.100125 0.401336669921875 0.02399926757812504 +0.10025 0.39501953125 0.02399926757812504 +0.100375 0.38519287109375 0.02399926757812504 +0.1005 0.378448486328125 0.02399926757812504 +0.100625 0.36798095703125 0.02399926757812504 +0.10075 0.360809326171875 0.02399926757812504 +0.100875 0.353485107421875 0.02399926757812504 +0.101 0.34222412109375 0.02399926757812504 +0.101125 0.334503173828125 0.02399926757812504 +0.10125 0.322662353515625 0.02399926757812504 +0.101375 0.314605712890625 0.02399926757812504 +0.1015 0.30224609375 0.02399926757812504 +0.101625 0.2938232421875 0.02399926757812504 +0.10175 0.280975341796875 0.02399926757812504 +0.101875 0.27227783203125 0.02399926757812504 +0.102 0.263427734375 0.02399926757812504 +0.102125 0.249969482421875 0.02399926757812504 +0.10225 0.2408447265625 0.02399926757812504 +0.102375 0.226959228515625 0.02399926757812504 +0.1025 0.21759033203125 0.02399926757812504 +0.102625 0.203338623046875 0.02399926757812504 +0.10275 0.1937255859375 0.02399926757812504 +0.102875 0.17913818359375 0.02399926757812504 +0.103 0.169342041015625 0.02399926757812504 +0.103125 0.159454345703125 0.02399926757812504 +0.10325 0.14447021484375 0.02399926757812504 +0.103375 0.134429931640625 0.02399926757812504 +0.1035 0.119232177734375 0.02399926757812504 +0.103625 0.109039306640625 0.02399926757812504 +0.10375 0.093658447265625 0.02399926757812504 +0.103875 0.083343505859375 0.02399926757812504 +0.104 0.072998046875 0.02399926757812504 +0.104125 0.05743408203125 0.02399926757812504 +0.10425 0.047027587890625 0.02399926757812504 +0.104375 0.0313720703125 0.02399926757812504 +0.1045 0.020904541015625 0.02399926757812504 +0.104625 0.005218505859375 0.02399926757812504 +0.10475 -0.005218505859375 0.02399926757812504 +0.104875 -0.020904541015625 0.02399926757812504 +0.105 -0.0313720703125 0.02399926757812504 +0.105125 -0.04180908203125 0.02399926757812504 +0.10525 -0.05743408203125 0.02399926757812504 +0.105375 -0.06781005859375 0.02399926757812504 +0.1055 -0.083343505859375 0.02399926757812504 +0.105625 -0.093658447265625 0.02399926757812504 +0.10575 -0.109039306640625 0.02399926757812504 +0.105875 -0.119232177734375 0.02399926757812504 +0.106 -0.134429931640625 0.02399926757812504 +0.106125 -0.14447021484375 0.02399926757812504 +0.10625 -0.15447998046875 0.02399926757812504 +0.106375 -0.169342041015625 0.02399926757812504 +0.1065 -0.17913818359375 0.02399926757812504 +0.106625 -0.1937255859375 0.02399926757812504 +0.10675 -0.203338623046875 0.02399926757812504 +0.106875 -0.21759033203125 0.02399926757812504 +0.107 -0.226959228515625 0.02399926757812504 +0.107125 -0.2408447265625 0.02399926757812504 +0.10725 -0.249969482421875 0.02399926757812504 +0.107375 -0.25897216796875 0.02399926757812504 +0.1075 -0.27227783203125 0.02399926757812504 +0.107625 -0.280975341796875 0.02399926757812504 +0.10775 -0.2938232421875 0.02399926757812504 +0.107875 -0.30224609375 0.02399926757812504 +0.108 -0.314605712890625 0.02399926757812504 +0.108125 -0.322662353515625 0.02399926757812504 +0.10825 -0.330596923828125 0.02399926757812504 +0.108375 -0.34222412109375 0.02399926757812504 +0.1085 -0.349761962890625 0.02399926757812504 +0.108625 -0.360809326171875 0.02399926757812504 +0.10875 -0.36798095703125 0.02399926757812504 +0.108875 -0.378448486328125 0.02399926757812504 +0.109 -0.38519287109375 0.02399926757812504 +0.109125 -0.39501953125 0.02399926757812504 +0.10925 -0.401336669921875 0.02399926757812504 +0.109375 -0.407501220703125 0.02399926757812504 +0.1095 -0.416412353515625 0.02399926757812504 +0.109625 -0.422119140625 0.02399926757812504 +0.10975 -0.4302978515625 0.02399926757812504 +0.109875 -0.435546875 0.02399926757812504 +0.11 -0.44305419921875 0.02399926757812504 +0.110125 -0.447784423828125 0.02399926757812504 +0.11025 -0.454559326171875 0.02399926757812504 +0.110375 -0.458831787109375 0.02399926757812504 +0.1105 -0.462890625 0.02399926757812504 +0.110625 -0.46856689453125 0.02399926757812504 +0.11075 -0.472137451171875 0.02399926757812504 +0.110875 -0.47705078125 0.02399926757812504 +0.111 -0.480072021484375 0.02399926757812504 +0.111125 -0.484222412109375 0.02399926757812504 +0.11125 -0.486724853515625 0.02399926757812504 +0.111375 -0.490081787109375 0.02399926757812504 +0.1115 -0.492034912109375 0.02399926757812504 +0.111625 -0.4937744140625 0.02399926757812504 +0.11175 -0.496002197265625 0.02399926757812504 +0.111875 -0.4971923828125 0.02399926757812504 +0.112 -0.49859619140625 0.02399926757812504 +0.112125 -0.499267578125 0.02399926757812504 +0.11225 -0.49981689453125 0.02399926757812504 +0.112375 -0.49993896484375 0.02399926757812504 +0.1125 -0.49981689453125 0.02399926757812504 +0.112625 -0.499267578125 0.02399926757812504 +0.11275 -0.49859619140625 0.02399926757812504 +0.112875 -0.4971923828125 0.02399926757812504 +0.113 -0.496002197265625 0.02399926757812504 +0.113125 -0.4937744140625 0.02399926757812504 +0.11325 -0.492034912109375 0.02399926757812504 +0.113375 -0.489013671875 0.02399926757812504 +0.1135 -0.486724853515625 0.02399926757812504 +0.113625 -0.484222412109375 0.02399926757812504 +0.11375 -0.480072021484375 0.02399926757812504 +0.113875 -0.47705078125 0.02399926757812504 +0.114 -0.472137451171875 0.02399926757812504 +0.114125 -0.46856689453125 0.02399926757812504 +0.11425 -0.462890625 0.02399926757812504 +0.114375 -0.458831787109375 0.02399926757812504 +0.1145 -0.452362060546875 0.02399926757812504 +0.114625 -0.447784423828125 0.02399926757812504 +0.11475 -0.44305419921875 0.02399926757812504 +0.114875 -0.435546875 0.02399926757812504 +0.115 -0.4302978515625 0.02399926757812504 +0.115125 -0.422119140625 0.02399926757812504 +0.11525 -0.416412353515625 0.02399926757812504 +0.115375 -0.407501220703125 0.02399926757812504 +0.1155 -0.401336669921875 0.02399926757812504 +0.115625 -0.39178466796875 0.02399926757812504 +0.11575 -0.38519287109375 0.02399926757812504 +0.115875 -0.378448486328125 0.02399926757812504 +0.116 -0.36798095703125 0.02399926757812504 +0.116125 -0.360809326171875 0.02399926757812504 +0.11625 -0.349761962890625 0.02399926757812504 +0.116375 -0.34222412109375 0.02399926757812504 +0.1165 -0.330596923828125 0.02399926757812504 +0.116625 -0.322662353515625 0.02399926757812504 +0.11675 -0.314605712890625 0.02399926757812504 +0.116875 -0.30224609375 0.02399926757812504 +0.117 -0.2938232421875 0.02399926757812504 +0.117125 -0.280975341796875 0.02399926757812504 +0.11725 -0.27227783203125 0.02399926757812504 +0.117375 -0.25897216796875 0.02399926757812504 +0.1175 -0.249969482421875 0.02399926757812504 +0.117625 -0.236236572265625 0.02399926757812504 +0.11775 -0.226959228515625 0.02399926757812504 +0.117875 -0.21759033203125 0.02399926757812504 +0.118 -0.203338623046875 0.02399926757812504 +0.118125 -0.1937255859375 0.02399926757812504 +0.11825 -0.17913818359375 0.02399926757812504 +0.118375 -0.169342041015625 0.02399926757812504 +0.1185 -0.15447998046875 0.02399926757812504 +0.118625 -0.14447021484375 0.02399926757812504 +0.11875 -0.129364013671875 0.02399926757812504 +0.118875 -0.119232177734375 0.02399926757812504 +0.119 -0.109039306640625 0.02399926757812504 +0.119125 -0.093658447265625 0.02399926757812504 +0.11925 -0.083343505859375 0.02399926757812504 +0.119375 -0.06781005859375 0.02399926757812504 +0.1195 -0.05743408203125 0.02399926757812504 +0.119625 -0.04180908203125 0.02399926757812504 +0.11975 -0.0313720703125 0.02399926757812504 +0.119875 -0.01568603515625 0.02399926757812504 +0.12 -0.005218505859375 0.02399926757812504 +0.120125 0.005218505859375 0.02399926757812504 +0.12025 0.020904541015625 0.02399926757812504 +0.120375 0.0313720703125 0.02399926757812504 +0.1205 0.047027587890625 0.02399926757812504 +0.120625 0.05743408203125 0.02399926757812504 +0.12075 0.072998046875 0.02399926757812504 +0.120875 0.083343505859375 0.02399926757812504 +0.121 0.093658447265625 0.02399926757812504 +0.121125 0.109039306640625 0.02399926757812504 +0.12125 0.119232177734375 0.02399926757812504 +0.121375 0.134429931640625 0.02399926757812504 +0.1215 0.14447021484375 0.02399926757812504 +0.121625 0.159454345703125 0.02399926757812504 +0.12175 0.169342041015625 0.02399926757812504 +0.121875 0.18402099609375 0.02399926757812504 +0.122 0.1937255859375 0.02399926757812504 +0.122125 0.203338623046875 0.02399926757812504 +0.12225 0.21759033203125 0.02399926757812504 +0.122375 0.226959228515625 0.02399926757812504 +0.1225 0.2408447265625 0.02399926757812504 +0.122625 0.249969482421875 0.02399926757812504 +0.12275 0.263427734375 0.02399926757812504 +0.122875 0.27227783203125 0.02399926757812504 +0.123 0.285308837890625 0.02399926757812504 +0.123125 0.2938232421875 0.02399926757812504 +0.12325 0.30224609375 0.02399926757812504 +0.123375 0.314605712890625 0.02399926757812504 +0.1235 0.322662353515625 0.02399926757812504 +0.123625 0.334503173828125 0.02399926757812504 +0.12375 0.34222412109375 0.02399926757812504 +0.123875 0.353485107421875 0.02399926757812504 +0.124 0.360809326171875 0.02399926757812504 +0.124125 0.37152099609375 0.02399926757812504 +0.12425 0.378448486328125 0.02399926757812504 +0.124375 0.38519287109375 0.02399926757812504 +0.1245 0.39501953125 0.02399926757812504 +0.124625 0.401336669921875 0.02399926757812504 +0.12475 0.4105224609375 0.02399926757812504 +0.124875 0.416412353515625 0.02399926757812504 +0.125 0.424896240234375 0.02399926757812504 +0.125125 0.4302978515625 0.02399926757812504 +0.12525 0.435546875 0.02399926757812504 +0.125375 0.44305419921875 0.02399926757812504 +0.1255 0.447784423828125 0.02399926757812504 +0.125625 0.454559326171875 0.02399926757812504 +0.12575 0.458831787109375 0.02399926757812504 +0.125875 0.464813232421875 0.02399926757812504 +0.126 0.46856689453125 0.02399926757812504 +0.126125 0.47381591796875 0.02399926757812504 +0.12625 0.47705078125 0.02399926757812504 +0.126375 0.480072021484375 0.02399926757812504 +0.1265 0.484222412109375 0.02399926757812504 +0.126625 0.486724853515625 0.02399926757812504 +0.12675 0.490081787109375 0.02399926757812504 +0.126875 0.492034912109375 0.02399926757812504 +0.127 0.49456787109375 0.02399926757812504 +0.127125 0.496002197265625 0.02399926757812504 +0.12725 0.497711181640625 0.02399926757812504 +0.127375 0.49859619140625 0.02399926757812504 +0.1275 0.499267578125 0.02399926757812504 +0.127625 0.49981689453125 0.02399926757812504 +0.12775 0.49993896484375 0.02399926757812504 +0.127875 0.49969482421875 0.02399926757812504 +0.128 0.49896240234375 0.2799914550781251 +0.128125 0.497711181640625 0.2799914550781251 +0.12825 0.496612548828125 0.2799914550781251 +0.128375 0.49456787109375 0.2799914550781251 +0.1285 0.492034912109375 0.2799914550781251 +0.128625 0.489013671875 0.2799914550781251 +0.12875 0.485504150390625 0.2799914550781251 +0.128875 0.48150634765625 0.2799914550781251 +0.129 0.47705078125 0.2799914550781251 +0.129125 0.472137451171875 0.2799914550781251 +0.12925 0.46673583984375 0.2799914550781251 +0.129375 0.46087646484375 0.2799914550781251 +0.1295 0.454559326171875 0.2799914550781251 +0.129625 0.447784423828125 0.2799914550781251 +0.12975 0.44305419921875 0.2799914550781251 +0.129875 0.435546875 0.2799914550781251 +0.13 0.4276123046875 0.2799914550781251 +0.130125 0.419281005859375 0.2799914550781251 +0.13025 0.4105224609375 0.2799914550781251 +0.130375 0.401336669921875 0.2799914550781251 +0.1305 0.39178466796875 0.2799914550781251 +0.130625 0.3818359375 0.2799914550781251 +0.13075 0.37152099609375 0.2799914550781251 +0.130875 0.360809326171875 0.2799914550781251 +0.131 0.349761962890625 0.2799914550781251 +0.131125 0.33837890625 0.2799914550781251 +0.13125 0.330596923828125 0.2799914550781251 +0.131375 0.31866455078125 0.2799914550781251 +0.1315 0.306396484375 0.2799914550781251 +0.131625 0.2938232421875 0.2799914550781251 +0.13175 0.280975341796875 0.2799914550781251 +0.131875 0.267852783203125 0.2799914550781251 +0.132 0.25445556640625 0.2799914550781251 +0.132125 0.2408447265625 0.2799914550781251 +0.13225 0.226959228515625 0.2799914550781251 +0.132375 0.212860107421875 0.2799914550781251 +0.1325 0.19854736328125 0.2799914550781251 +0.132625 0.18402099609375 0.2799914550781251 +0.13275 0.17425537109375 0.2799914550781251 +0.132875 0.159454345703125 0.2799914550781251 +0.133 0.14447021484375 0.2799914550781251 +0.133125 0.129364013671875 0.2799914550781251 +0.13325 0.1141357421875 0.2799914550781251 +0.133375 0.098785400390625 0.2799914550781251 +0.1335 0.083343505859375 0.2799914550781251 +0.133625 0.06781005859375 0.2799914550781251 +0.13375 0.05224609375 0.2799914550781251 +0.133875 0.036590576171875 0.2799914550781251 +0.134 0.020904541015625 0.2799914550781251 +0.134125 0.01043701171875 0.2799914550781251 +0.13425 -0.005218505859375 0.2799914550781251 +0.134375 -0.020904541015625 0.2799914550781251 +0.1345 -0.036590576171875 0.2799914550781251 +0.134625 -0.05224609375 0.2799914550781251 +0.13475 -0.06781005859375 0.2799914550781251 +0.134875 -0.083343505859375 0.2799914550781251 +0.135 -0.098785400390625 0.2799914550781251 +0.135125 -0.1141357421875 0.2799914550781251 +0.13525 -0.129364013671875 0.2799914550781251 +0.135375 -0.14447021484375 0.2799914550781251 +0.1355 -0.159454345703125 0.2799914550781251 +0.135625 -0.169342041015625 0.2799914550781251 +0.13575 -0.18402099609375 0.2799914550781251 +0.135875 -0.19854736328125 0.2799914550781251 +0.136 -0.212860107421875 0.2799914550781251 +0.136125 -0.226959228515625 0.2799914550781251 +0.13625 -0.2408447265625 0.2799914550781251 +0.136375 -0.25445556640625 0.2799914550781251 +0.1365 -0.267852783203125 0.2799914550781251 +0.136625 -0.280975341796875 0.2799914550781251 +0.13675 -0.2938232421875 0.2799914550781251 +0.136875 -0.306396484375 0.2799914550781251 +0.137 -0.31866455078125 0.2799914550781251 +0.137125 -0.32666015625 0.2799914550781251 +0.13725 -0.33837890625 0.2799914550781251 +0.137375 -0.349761962890625 0.2799914550781251 +0.1375 -0.360809326171875 0.2799914550781251 +0.137625 -0.37152099609375 0.2799914550781251 +0.13775 -0.3818359375 0.2799914550781251 +0.137875 -0.39178466796875 0.2799914550781251 +0.138 -0.401336669921875 0.2799914550781251 +0.138125 -0.4105224609375 0.2799914550781251 +0.13825 -0.419281005859375 0.2799914550781251 +0.138375 -0.4276123046875 0.2799914550781251 +0.1385 -0.435546875 0.2799914550781251 +0.138625 -0.440582275390625 0.2799914550781251 +0.13875 -0.447784423828125 0.2799914550781251 +0.138875 -0.454559326171875 0.2799914550781251 +0.139 -0.46087646484375 0.2799914550781251 +0.139125 -0.46673583984375 0.2799914550781251 +0.13925 -0.472137451171875 0.2799914550781251 +0.139375 -0.47705078125 0.2799914550781251 +0.1395 -0.48150634765625 0.2799914550781251 +0.139625 -0.485504150390625 0.2799914550781251 +0.13975 -0.489013671875 0.2799914550781251 +0.139875 -0.492034912109375 0.2799914550781251 +0.14 -0.4937744140625 0.2799914550781251 +0.140125 -0.496002197265625 0.2799914550781251 +0.14025 -0.497711181640625 0.2799914550781251 +0.140375 -0.49896240234375 0.2799914550781251 +0.1405 -0.49969482421875 0.2799914550781251 +0.140625 -0.49993896484375 0.2799914550781251 +0.14075 -0.49969482421875 0.2799914550781251 +0.140875 -0.49896240234375 0.2799914550781251 +0.141 -0.497711181640625 0.2799914550781251 +0.141125 -0.496002197265625 0.2799914550781251 +0.14125 -0.4937744140625 0.2799914550781251 +0.141375 -0.4910888671875 0.2799914550781251 +0.1415 -0.489013671875 0.2799914550781251 +0.141625 -0.485504150390625 0.2799914550781251 +0.14175 -0.48150634765625 0.2799914550781251 +0.141875 -0.47705078125 0.2799914550781251 +0.142 -0.472137451171875 0.2799914550781251 +0.142125 -0.46673583984375 0.2799914550781251 +0.14225 -0.46087646484375 0.2799914550781251 +0.142375 -0.454559326171875 0.2799914550781251 +0.1425 -0.447784423828125 0.2799914550781251 +0.142625 -0.440582275390625 0.2799914550781251 +0.14275 -0.432952880859375 0.2799914550781251 +0.142875 -0.424896240234375 0.2799914550781251 +0.143 -0.419281005859375 0.2799914550781251 +0.143125 -0.4105224609375 0.2799914550781251 +0.14325 -0.401336669921875 0.2799914550781251 +0.143375 -0.39178466796875 0.2799914550781251 +0.1435 -0.3818359375 0.2799914550781251 +0.143625 -0.37152099609375 0.2799914550781251 +0.14375 -0.360809326171875 0.2799914550781251 +0.143875 -0.349761962890625 0.2799914550781251 +0.144 -0.33837890625 0.2799914550781251 +0.144125 -0.32666015625 0.2799914550781251 +0.14425 -0.314605712890625 0.2799914550781251 +0.144375 -0.30224609375 0.2799914550781251 +0.1445 -0.2938232421875 0.2799914550781251 +0.144625 -0.280975341796875 0.2799914550781251 +0.14475 -0.267852783203125 0.2799914550781251 +0.144875 -0.25445556640625 0.2799914550781251 +0.145 -0.2408447265625 0.2799914550781251 +0.145125 -0.226959228515625 0.2799914550781251 +0.14525 -0.212860107421875 0.2799914550781251 +0.145375 -0.19854736328125 0.2799914550781251 +0.1455 -0.18402099609375 0.2799914550781251 +0.145625 -0.169342041015625 0.2799914550781251 +0.14575 -0.15447998046875 0.2799914550781251 +0.145875 -0.13946533203125 0.2799914550781251 +0.146 -0.129364013671875 0.2799914550781251 +0.146125 -0.1141357421875 0.2799914550781251 +0.14625 -0.098785400390625 0.2799914550781251 +0.146375 -0.083343505859375 0.2799914550781251 +0.1465 -0.06781005859375 0.2799914550781251 +0.146625 -0.05224609375 0.2799914550781251 +0.14675 -0.036590576171875 0.2799914550781251 +0.146875 -0.020904541015625 0.2799914550781251 +0.147 -0.005218505859375 0.2799914550781251 +0.147125 0.01043701171875 0.2799914550781251 +0.14725 0.026123046875 0.2799914550781251 +0.147375 0.036590576171875 0.2799914550781251 +0.1475 0.05224609375 0.2799914550781251 +0.147625 0.06781005859375 0.2799914550781251 +0.14775 0.083343505859375 0.2799914550781251 +0.147875 0.098785400390625 0.2799914550781251 +0.148 0.1141357421875 0.2799914550781251 +0.148125 0.129364013671875 0.2799914550781251 +0.14825 0.14447021484375 0.2799914550781251 +0.148375 0.159454345703125 0.2799914550781251 +0.1485 0.17425537109375 0.2799914550781251 +0.148625 0.188873291015625 0.2799914550781251 +0.14875 0.203338623046875 0.2799914550781251 +0.148875 0.212860107421875 0.2799914550781251 +0.149 0.226959228515625 0.2799914550781251 +0.149125 0.2408447265625 0.2799914550781251 +0.14925 0.25445556640625 0.2799914550781251 +0.149375 0.267852783203125 0.2799914550781251 +0.1495 0.280975341796875 0.2799914550781251 +0.149625 0.2938232421875 0.2799914550781251 +0.14975 0.306396484375 0.2799914550781251 +0.149875 0.31866455078125 0.2799914550781251 +0.15 0.330596923828125 0.2799914550781251 +0.150125 0.34222412109375 0.2799914550781251 +0.15025 0.353485107421875 0.2799914550781251 +0.150375 0.360809326171875 0.2799914550781251 +0.1505 0.37152099609375 0.2799914550781251 +0.150625 0.3818359375 0.2799914550781251 +0.15075 0.39178466796875 0.2799914550781251 +0.150875 0.401336669921875 0.2799914550781251 +0.151 0.4105224609375 0.2799914550781251 +0.151125 0.419281005859375 0.2799914550781251 +0.15125 0.4276123046875 0.2799914550781251 +0.151375 0.435546875 0.2799914550781251 +0.1515 0.44305419921875 0.2799914550781251 +0.151625 0.450103759765625 0.2799914550781251 +0.15175 0.45672607421875 0.2799914550781251 +0.151875 0.46087646484375 0.2799914550781251 +0.152 0.46673583984375 0.2799914550781251 +0.152125 0.472137451171875 0.2799914550781251 +0.15225 0.47705078125 0.2799914550781251 +0.152375 0.48150634765625 0.2799914550781251 +0.1525 0.485504150390625 0.2799914550781251 +0.152625 0.489013671875 0.2799914550781251 +0.15275 0.492034912109375 0.2799914550781251 +0.152875 0.49456787109375 0.2799914550781251 +0.153 0.496612548828125 0.2799914550781251 +0.153125 0.498199462890625 0.2799914550781251 +0.15325 0.49896240234375 0.2799914550781251 +0.153375 0.49969482421875 0.2799914550781251 +0.1535 0.49993896484375 0.2799914550781251 +0.153625 0.49969482421875 0.2799914550781251 +0.15375 0.49896240234375 0.2799914550781251 +0.153875 0.497711181640625 0.2799914550781251 +0.154 0.496002197265625 0.2799914550781251 +0.154125 0.4937744140625 0.2799914550781251 +0.15425 0.4910888671875 0.2799914550781251 +0.154375 0.487884521484375 0.2799914550781251 +0.1545 0.484222412109375 0.2799914550781251 +0.154625 0.480072021484375 0.2799914550781251 +0.15475 0.47705078125 0.2799914550781251 +0.154875 0.472137451171875 0.2799914550781251 +0.155 0.46673583984375 0.2799914550781251 +0.155125 0.46087646484375 0.2799914550781251 +0.15525 0.454559326171875 0.2799914550781251 +0.155375 0.447784423828125 0.2799914550781251 +0.1555 0.440582275390625 0.2799914550781251 +0.155625 0.432952880859375 0.2799914550781251 +0.15575 0.424896240234375 0.2799914550781251 +0.155875 0.416412353515625 0.2799914550781251 +0.156 0.407501220703125 0.2799914550781251 +0.156125 0.398193359375 0.2799914550781251 +0.15625 0.39178466796875 0.2799914550781251 +0.156375 0.3818359375 0.2799914550781251 +0.1565 0.37152099609375 0.2799914550781251 +0.156625 0.360809326171875 0.2799914550781251 +0.15675 0.349761962890625 0.2799914550781251 +0.156875 0.33837890625 0.2799914550781251 +0.157 0.32666015625 0.2799914550781251 +0.157125 0.314605712890625 0.2799914550781251 +0.15725 0.30224609375 0.2799914550781251 +0.157375 0.289581298828125 0.2799914550781251 +0.1575 0.276641845703125 0.2799914550781251 +0.157625 0.263427734375 0.2799914550781251 +0.15775 0.25445556640625 0.2799914550781251 +0.157875 0.2408447265625 0.2799914550781251 +0.158 0.226959228515625 0.2799914550781251 +0.158125 0.212860107421875 0.2799914550781251 +0.15825 0.19854736328125 0.2799914550781251 +0.158375 0.18402099609375 0.2799914550781251 +0.1585 0.169342041015625 0.2799914550781251 +0.158625 0.15447998046875 0.2799914550781251 +0.15875 0.13946533203125 0.2799914550781251 +0.158875 0.124298095703125 0.2799914550781251 +0.159 0.109039306640625 0.2799914550781251 +0.159125 0.093658447265625 0.2799914550781251 +0.15925 0.083343505859375 0.2799914550781251 +0.159375 0.06781005859375 0.2799914550781251 +0.1595 0.05224609375 0.2799914550781251 +0.159625 0.036590576171875 0.2799914550781251 +0.15975 0.020904541015625 0.2799914550781251 +0.159875 0.005218505859375 0.2799914550781251 +0.16 -0.01043701171875 0.535983642578125 +0.160125 -0.0313720703125 0.535983642578125 +0.16025 -0.047027587890625 0.535983642578125 +0.160375 -0.06781005859375 0.535983642578125 +0.1605 -0.083343505859375 0.535983642578125 +0.160625 -0.103912353515625 0.535983642578125 +0.16075 -0.119232177734375 0.535983642578125 +0.160875 -0.13946533203125 0.535983642578125 +0.161 -0.15447998046875 0.535983642578125 +0.161125 -0.17425537109375 0.535983642578125 +0.16125 -0.188873291015625 0.535983642578125 +0.161375 -0.208099365234375 0.535983642578125 +0.1615 -0.2222900390625 0.535983642578125 +0.161625 -0.2408447265625 0.535983642578125 +0.16175 -0.25445556640625 0.535983642578125 +0.161875 -0.27227783203125 0.535983642578125 +0.162 -0.285308837890625 0.535983642578125 +0.162125 -0.30224609375 0.535983642578125 +0.16225 -0.314605712890625 0.535983642578125 +0.162375 -0.330596923828125 0.535983642578125 +0.1625 -0.34222412109375 0.535983642578125 +0.162625 -0.357177734375 0.535983642578125 +0.16275 -0.36798095703125 0.535983642578125 +0.162875 -0.3818359375 0.535983642578125 +0.163 -0.39178466796875 0.535983642578125 +0.163125 -0.404449462890625 0.535983642578125 +0.16325 -0.413482666015625 0.535983642578125 +0.163375 -0.422119140625 0.535983642578125 +0.1635 -0.432952880859375 0.535983642578125 +0.163625 -0.440582275390625 0.535983642578125 +0.16375 -0.450103759765625 0.535983642578125 +0.163875 -0.45672607421875 0.535983642578125 +0.164 -0.464813232421875 0.535983642578125 +0.164125 -0.470367431640625 0.535983642578125 +0.16425 -0.47705078125 0.535983642578125 +0.164375 -0.48150634765625 0.535983642578125 +0.1645 -0.486724853515625 0.535983642578125 +0.164625 -0.490081787109375 0.535983642578125 +0.16475 -0.4937744140625 0.535983642578125 +0.164875 -0.496002197265625 0.535983642578125 +0.165 -0.498199462890625 0.535983642578125 +0.165125 -0.499267578125 0.535983642578125 +0.16525 -0.499908447265625 0.535983642578125 +0.165375 -0.49981689453125 0.535983642578125 +0.1655 -0.49896240234375 0.535983642578125 +0.165625 -0.497711181640625 0.535983642578125 +0.16575 -0.49530029296875 0.535983642578125 +0.165875 -0.492950439453125 0.535983642578125 +0.166 -0.489013671875 0.535983642578125 +0.166125 -0.485504150390625 0.535983642578125 +0.16625 -0.480072021484375 0.535983642578125 +0.166375 -0.4754638671875 0.535983642578125 +0.1665 -0.46856689453125 0.535983642578125 +0.166625 -0.462890625 0.535983642578125 +0.16675 -0.45672607421875 0.535983642578125 +0.166875 -0.447784423828125 0.535983642578125 +0.167 -0.440582275390625 0.535983642578125 +0.167125 -0.4302978515625 0.535983642578125 +0.16725 -0.422119140625 0.535983642578125 +0.167375 -0.4105224609375 0.535983642578125 +0.1675 -0.401336669921875 0.535983642578125 +0.167625 -0.388519287109375 0.535983642578125 +0.16775 -0.378448486328125 0.535983642578125 +0.167875 -0.36444091796875 0.535983642578125 +0.168 -0.353485107421875 0.535983642578125 +0.168125 -0.33837890625 0.535983642578125 +0.16825 -0.32666015625 0.535983642578125 +0.168375 -0.310516357421875 0.535983642578125 +0.1685 -0.298065185546875 0.535983642578125 +0.168625 -0.280975341796875 0.535983642578125 +0.16875 -0.267852783203125 0.535983642578125 +0.168875 -0.249969482421875 0.535983642578125 +0.169 -0.236236572265625 0.535983642578125 +0.169125 -0.21759033203125 0.535983642578125 +0.16925 -0.203338623046875 0.535983642578125 +0.169375 -0.18402099609375 0.535983642578125 +0.1695 -0.169342041015625 0.535983642578125 +0.169625 -0.14947509765625 0.535983642578125 +0.16975 -0.134429931640625 0.535983642578125 +0.169875 -0.119232177734375 0.535983642578125 +0.17 -0.098785400390625 0.535983642578125 +0.170125 -0.083343505859375 0.535983642578125 +0.17025 -0.0626220703125 0.535983642578125 +0.170375 -0.047027587890625 0.535983642578125 +0.1705 -0.026123046875 0.535983642578125 +0.170625 -0.01043701171875 0.535983642578125 +0.17075 0.01043701171875 0.535983642578125 +0.170875 0.026123046875 0.535983642578125 +0.171 0.047027587890625 0.535983642578125 +0.171125 0.0626220703125 0.535983642578125 +0.17125 0.083343505859375 0.535983642578125 +0.171375 0.098785400390625 0.535983642578125 +0.1715 0.119232177734375 0.535983642578125 +0.171625 0.134429931640625 0.535983642578125 +0.17175 0.15447998046875 0.535983642578125 +0.171875 0.169342041015625 0.535983642578125 +0.172 0.188873291015625 0.535983642578125 +0.172125 0.203338623046875 0.535983642578125 +0.17225 0.2222900390625 0.535983642578125 +0.172375 0.236236572265625 0.535983642578125 +0.1725 0.25445556640625 0.535983642578125 +0.172625 0.267852783203125 0.535983642578125 +0.17275 0.285308837890625 0.535983642578125 +0.172875 0.298065185546875 0.535983642578125 +0.173 0.314605712890625 0.535983642578125 +0.173125 0.32666015625 0.535983642578125 +0.17325 0.33837890625 0.535983642578125 +0.173375 0.353485107421875 0.535983642578125 +0.1735 0.36444091796875 0.535983642578125 +0.173625 0.378448486328125 0.535983642578125 +0.17375 0.388519287109375 0.535983642578125 +0.173875 0.401336669921875 0.535983642578125 +0.174 0.4105224609375 0.535983642578125 +0.174125 0.422119140625 0.535983642578125 +0.17425 0.4302978515625 0.535983642578125 +0.174375 0.440582275390625 0.535983642578125 +0.1745 0.447784423828125 0.535983642578125 +0.174625 0.45672607421875 0.535983642578125 +0.17475 0.462890625 0.535983642578125 +0.174875 0.470367431640625 0.535983642578125 +0.175 0.4754638671875 0.535983642578125 +0.175125 0.48150634765625 0.535983642578125 +0.17525 0.485504150390625 0.535983642578125 +0.175375 0.490081787109375 0.535983642578125 +0.1755 0.492950439453125 0.535983642578125 +0.175625 0.496002197265625 0.535983642578125 +0.17575 0.497711181640625 0.535983642578125 +0.175875 0.499267578125 0.535983642578125 +0.176 0.49981689453125 0.535983642578125 +0.176125 0.49981689453125 0.535983642578125 +0.17625 0.499267578125 0.535983642578125 +0.176375 0.497711181640625 0.535983642578125 +0.1765 0.496002197265625 0.535983642578125 +0.176625 0.4937744140625 0.535983642578125 +0.17675 0.490081787109375 0.535983642578125 +0.176875 0.486724853515625 0.535983642578125 +0.177 0.48150634765625 0.535983642578125 +0.177125 0.47705078125 0.535983642578125 +0.17725 0.470367431640625 0.535983642578125 +0.177375 0.464813232421875 0.535983642578125 +0.1775 0.45672607421875 0.535983642578125 +0.177625 0.450103759765625 0.535983642578125 +0.17775 0.440582275390625 0.535983642578125 +0.177875 0.432952880859375 0.535983642578125 +0.178 0.422119140625 0.535983642578125 +0.178125 0.413482666015625 0.535983642578125 +0.17825 0.401336669921875 0.535983642578125 +0.178375 0.39178466796875 0.535983642578125 +0.1785 0.378448486328125 0.535983642578125 +0.178625 0.36798095703125 0.535983642578125 +0.17875 0.353485107421875 0.535983642578125 +0.178875 0.34222412109375 0.535983642578125 +0.179 0.32666015625 0.535983642578125 +0.179125 0.314605712890625 0.535983642578125 +0.17925 0.298065185546875 0.535983642578125 +0.179375 0.285308837890625 0.535983642578125 +0.1795 0.267852783203125 0.535983642578125 +0.179625 0.25445556640625 0.535983642578125 +0.17975 0.236236572265625 0.535983642578125 +0.179875 0.2222900390625 0.535983642578125 +0.18 0.208099365234375 0.535983642578125 +0.180125 0.188873291015625 0.535983642578125 +0.18025 0.17425537109375 0.535983642578125 +0.180375 0.15447998046875 0.535983642578125 +0.1805 0.13946533203125 0.535983642578125 +0.180625 0.119232177734375 0.535983642578125 +0.18075 0.103912353515625 0.535983642578125 +0.180875 0.083343505859375 0.535983642578125 +0.181 0.06781005859375 0.535983642578125 +0.181125 0.047027587890625 0.535983642578125 +0.18125 0.0313720703125 0.535983642578125 +0.181375 0.01043701171875 0.535983642578125 +0.1815 -0.005218505859375 0.535983642578125 +0.181625 -0.026123046875 0.535983642578125 +0.18175 -0.04180908203125 0.535983642578125 +0.181875 -0.0626220703125 0.535983642578125 +0.182 -0.07818603515625 0.535983642578125 +0.182125 -0.098785400390625 0.535983642578125 +0.18225 -0.1141357421875 0.535983642578125 +0.182375 -0.134429931640625 0.535983642578125 +0.1825 -0.14947509765625 0.535983642578125 +0.182625 -0.169342041015625 0.535983642578125 +0.18275 -0.18402099609375 0.535983642578125 +0.182875 -0.203338623046875 0.535983642578125 +0.183 -0.21759033203125 0.535983642578125 +0.183125 -0.236236572265625 0.535983642578125 +0.18325 -0.249969482421875 0.535983642578125 +0.183375 -0.263427734375 0.535983642578125 +0.1835 -0.280975341796875 0.535983642578125 +0.183625 -0.2938232421875 0.535983642578125 +0.18375 -0.310516357421875 0.535983642578125 +0.183875 -0.322662353515625 0.535983642578125 +0.184 -0.33837890625 0.535983642578125 +0.184125 -0.349761962890625 0.535983642578125 +0.18425 -0.36444091796875 0.535983642578125 +0.184375 -0.375 0.535983642578125 +0.1845 -0.388519287109375 0.535983642578125 +0.184625 -0.398193359375 0.535983642578125 +0.18475 -0.4105224609375 0.535983642578125 +0.184875 -0.419281005859375 0.535983642578125 +0.185 -0.4302978515625 0.535983642578125 +0.185125 -0.438079833984375 0.535983642578125 +0.18525 -0.447784423828125 0.535983642578125 +0.185375 -0.454559326171875 0.535983642578125 +0.1855 -0.462890625 0.535983642578125 +0.185625 -0.46856689453125 0.535983642578125 +0.18575 -0.4754638671875 0.535983642578125 +0.185875 -0.480072021484375 0.535983642578125 +0.186 -0.485504150390625 0.535983642578125 +0.186125 -0.489013671875 0.535983642578125 +0.18625 -0.492950439453125 0.535983642578125 +0.186375 -0.49530029296875 0.535983642578125 +0.1865 -0.4971923828125 0.535983642578125 +0.186625 -0.49896240234375 0.535983642578125 +0.18675 -0.49969482421875 0.535983642578125 +0.186875 -0.499908447265625 0.535983642578125 +0.187 -0.49951171875 0.535983642578125 +0.187125 -0.498199462890625 0.535983642578125 +0.18725 -0.496612548828125 0.535983642578125 +0.187375 -0.4937744140625 0.535983642578125 +0.1875 -0.4910888671875 0.535983642578125 +0.187625 -0.486724853515625 0.535983642578125 +0.18775 -0.48291015625 0.535983642578125 +0.187875 -0.47705078125 0.535983642578125 +0.188 -0.472137451171875 0.535983642578125 +0.188125 -0.464813232421875 0.535983642578125 +0.18825 -0.458831787109375 0.535983642578125 +0.188375 -0.450103759765625 0.535983642578125 +0.1885 -0.44305419921875 0.535983642578125 +0.188625 -0.432952880859375 0.535983642578125 +0.18875 -0.424896240234375 0.535983642578125 +0.188875 -0.413482666015625 0.535983642578125 +0.189 -0.404449462890625 0.535983642578125 +0.189125 -0.39178466796875 0.535983642578125 +0.18925 -0.3818359375 0.535983642578125 +0.189375 -0.36798095703125 0.535983642578125 +0.1895 -0.357177734375 0.535983642578125 +0.189625 -0.34222412109375 0.535983642578125 +0.18975 -0.330596923828125 0.535983642578125 +0.189875 -0.31866455078125 0.535983642578125 +0.19 -0.30224609375 0.535983642578125 +0.190125 -0.289581298828125 0.535983642578125 +0.19025 -0.27227783203125 0.535983642578125 +0.190375 -0.25897216796875 0.535983642578125 +0.1905 -0.2408447265625 0.535983642578125 +0.190625 -0.226959228515625 0.535983642578125 +0.19075 -0.208099365234375 0.535983642578125 +0.190875 -0.1937255859375 0.535983642578125 +0.191 -0.17425537109375 0.535983642578125 +0.191125 -0.159454345703125 0.535983642578125 +0.19125 -0.13946533203125 0.535983642578125 +0.191375 -0.124298095703125 0.535983642578125 +0.1915 -0.103912353515625 0.535983642578125 +0.191625 -0.0885009765625 0.535983642578125 +0.19175 -0.06781005859375 0.535983642578125 +0.191875 -0.05224609375 0.535983642578125 +0.192 -0.0313720703125 0.791975830078125 +0.192125 -0.005218505859375 0.791975830078125 +0.19225 0.01568603515625 0.791975830078125 +0.192375 0.036590576171875 0.791975830078125 +0.1925 0.05743408203125 0.791975830078125 +0.192625 0.07818603515625 0.791975830078125 +0.19275 0.098785400390625 0.791975830078125 +0.192875 0.119232177734375 0.791975830078125 +0.193 0.14447021484375 0.791975830078125 +0.193125 0.164398193359375 0.791975830078125 +0.19325 0.18402099609375 0.791975830078125 +0.193375 0.203338623046875 0.791975830078125 +0.1935 0.2222900390625 0.791975830078125 +0.193625 0.2408447265625 0.791975830078125 +0.19375 0.263427734375 0.791975830078125 +0.193875 0.280975341796875 0.791975830078125 +0.194 0.298065185546875 0.791975830078125 +0.194125 0.314605712890625 0.791975830078125 +0.19425 0.330596923828125 0.791975830078125 +0.194375 0.34600830078125 0.791975830078125 +0.1945 0.360809326171875 0.791975830078125 +0.194625 0.378448486328125 0.791975830078125 +0.19475 0.39178466796875 0.791975830078125 +0.194875 0.404449462890625 0.791975830078125 +0.195 0.416412353515625 0.791975830078125 +0.195125 0.4276123046875 0.791975830078125 +0.19525 0.438079833984375 0.791975830078125 +0.195375 0.450103759765625 0.791975830078125 +0.1955 0.458831787109375 0.791975830078125 +0.195625 0.46673583984375 0.791975830078125 +0.19575 0.47381591796875 0.791975830078125 +0.195875 0.480072021484375 0.791975830078125 +0.196 0.485504150390625 0.791975830078125 +0.196125 0.4910888671875 0.791975830078125 +0.19625 0.49456787109375 0.791975830078125 +0.196375 0.4971923828125 0.791975830078125 +0.1965 0.49896240234375 0.791975830078125 +0.196625 0.49981689453125 0.791975830078125 +0.19675 0.49981689453125 0.791975830078125 +0.196875 0.49896240234375 0.791975830078125 +0.197 0.496612548828125 0.791975830078125 +0.197125 0.4937744140625 0.791975830078125 +0.19725 0.490081787109375 0.791975830078125 +0.197375 0.485504150390625 0.791975830078125 +0.1975 0.480072021484375 0.791975830078125 +0.197625 0.47381591796875 0.791975830078125 +0.19775 0.464813232421875 0.791975830078125 +0.197875 0.45672607421875 0.791975830078125 +0.198 0.447784423828125 0.791975830078125 +0.198125 0.438079833984375 0.791975830078125 +0.19825 0.4276123046875 0.791975830078125 +0.198375 0.416412353515625 0.791975830078125 +0.1985 0.401336669921875 0.791975830078125 +0.198625 0.388519287109375 0.791975830078125 +0.19875 0.375 0.791975830078125 +0.198875 0.360809326171875 0.791975830078125 +0.199 0.34600830078125 0.791975830078125 +0.199125 0.330596923828125 0.791975830078125 +0.19925 0.314605712890625 0.791975830078125 +0.199375 0.2938232421875 0.791975830078125 +0.1995 0.276641845703125 0.791975830078125 +0.199625 0.25897216796875 0.791975830078125 +0.19975 0.2408447265625 0.791975830078125 +0.199875 0.2222900390625 0.791975830078125 +0.2 0.203338623046875 0.791975830078125 +0.200125 0.17913818359375 0.791975830078125 +0.20025 0.159454345703125 0.791975830078125 +0.200375 0.13946533203125 0.791975830078125 +0.2005 0.119232177734375 0.791975830078125 +0.200625 0.098785400390625 0.791975830078125 +0.20075 0.07818603515625 0.791975830078125 +0.200875 0.05743408203125 0.791975830078125 +0.201 0.0313720703125 0.791975830078125 +0.201125 0.01043701171875 0.791975830078125 +0.20125 -0.01043701171875 0.791975830078125 +0.201375 -0.0313720703125 0.791975830078125 +0.2015 -0.05224609375 0.791975830078125 +0.201625 -0.072998046875 0.791975830078125 +0.20175 -0.098785400390625 0.791975830078125 +0.201875 -0.119232177734375 0.791975830078125 +0.202 -0.13946533203125 0.791975830078125 +0.202125 -0.159454345703125 0.791975830078125 +0.20225 -0.17913818359375 0.791975830078125 +0.202375 -0.19854736328125 0.791975830078125 +0.2025 -0.2222900390625 0.791975830078125 +0.202625 -0.2408447265625 0.791975830078125 +0.20275 -0.25897216796875 0.791975830078125 +0.202875 -0.276641845703125 0.791975830078125 +0.203 -0.2938232421875 0.791975830078125 +0.203125 -0.310516357421875 0.791975830078125 +0.20325 -0.32666015625 0.791975830078125 +0.203375 -0.34600830078125 0.791975830078125 +0.2035 -0.360809326171875 0.791975830078125 +0.203625 -0.375 0.791975830078125 +0.20375 -0.388519287109375 0.791975830078125 +0.203875 -0.401336669921875 0.791975830078125 +0.204 -0.413482666015625 0.791975830078125 +0.204125 -0.4276123046875 0.791975830078125 +0.20425 -0.438079833984375 0.791975830078125 +0.204375 -0.447784423828125 0.791975830078125 +0.2045 -0.45672607421875 0.791975830078125 +0.204625 -0.464813232421875 0.791975830078125 +0.20475 -0.472137451171875 0.791975830078125 +0.204875 -0.480072021484375 0.791975830078125 +0.205 -0.485504150390625 0.791975830078125 +0.205125 -0.490081787109375 0.791975830078125 +0.20525 -0.4937744140625 0.791975830078125 +0.205375 -0.496612548828125 0.791975830078125 +0.2055 -0.49859619140625 0.791975830078125 +0.205625 -0.49969482421875 0.791975830078125 +0.20575 -0.49981689453125 0.791975830078125 +0.205875 -0.49896240234375 0.791975830078125 +0.206 -0.4971923828125 0.791975830078125 +0.206125 -0.49456787109375 0.791975830078125 +0.20625 -0.4910888671875 0.791975830078125 +0.206375 -0.486724853515625 0.791975830078125 +0.2065 -0.480072021484375 0.791975830078125 +0.206625 -0.47381591796875 0.791975830078125 +0.20675 -0.46673583984375 0.791975830078125 +0.206875 -0.458831787109375 0.791975830078125 +0.207 -0.450103759765625 0.791975830078125 +0.207125 -0.440582275390625 0.791975830078125 +0.20725 -0.4276123046875 0.791975830078125 +0.207375 -0.416412353515625 0.791975830078125 +0.2075 -0.404449462890625 0.791975830078125 +0.207625 -0.39178466796875 0.791975830078125 +0.20775 -0.378448486328125 0.791975830078125 +0.207875 -0.36444091796875 0.791975830078125 +0.208 -0.349761962890625 0.791975830078125 +0.208125 -0.330596923828125 0.791975830078125 +0.20825 -0.314605712890625 0.791975830078125 +0.208375 -0.298065185546875 0.791975830078125 +0.2085 -0.280975341796875 0.791975830078125 +0.208625 -0.263427734375 0.791975830078125 +0.20875 -0.24542236328125 0.791975830078125 +0.208875 -0.2222900390625 0.791975830078125 +0.209 -0.203338623046875 0.791975830078125 +0.209125 -0.18402099609375 0.791975830078125 +0.20925 -0.164398193359375 0.791975830078125 +0.209375 -0.14447021484375 0.791975830078125 +0.2095 -0.124298095703125 0.791975830078125 +0.209625 -0.103912353515625 0.791975830078125 +0.20975 -0.07818603515625 0.791975830078125 +0.209875 -0.05743408203125 0.791975830078125 +0.21 -0.036590576171875 0.791975830078125 +0.210125 -0.01568603515625 0.791975830078125 +0.21025 0.005218505859375 0.791975830078125 +0.210375 0.026123046875 0.791975830078125 +0.2105 0.05224609375 0.791975830078125 +0.210625 0.072998046875 0.791975830078125 +0.21075 0.093658447265625 0.791975830078125 +0.210875 0.1141357421875 0.791975830078125 +0.211 0.134429931640625 0.791975830078125 +0.211125 0.15447998046875 0.791975830078125 +0.21125 0.17913818359375 0.791975830078125 +0.211375 0.19854736328125 0.791975830078125 +0.2115 0.21759033203125 0.791975830078125 +0.211625 0.236236572265625 0.791975830078125 +0.21175 0.25445556640625 0.791975830078125 +0.211875 0.27227783203125 0.791975830078125 +0.212 0.289581298828125 0.791975830078125 +0.212125 0.310516357421875 0.791975830078125 +0.21225 0.32666015625 0.791975830078125 +0.212375 0.34222412109375 0.791975830078125 +0.2125 0.357177734375 0.791975830078125 +0.212625 0.37152099609375 0.791975830078125 +0.21275 0.38519287109375 0.791975830078125 +0.212875 0.401336669921875 0.791975830078125 +0.213 0.413482666015625 0.791975830078125 +0.213125 0.424896240234375 0.791975830078125 +0.21325 0.435546875 0.791975830078125 +0.213375 0.4454345703125 0.791975830078125 +0.2135 0.454559326171875 0.791975830078125 +0.213625 0.464813232421875 0.791975830078125 +0.21375 0.472137451171875 0.791975830078125 +0.213875 0.478607177734375 0.791975830078125 +0.214 0.484222412109375 0.791975830078125 +0.214125 0.489013671875 0.791975830078125 +0.21425 0.492950439453125 0.791975830078125 +0.214375 0.496002197265625 0.791975830078125 +0.2145 0.49859619140625 0.791975830078125 +0.214625 0.49969482421875 0.791975830078125 +0.21475 0.499908447265625 0.791975830078125 +0.214875 0.499267578125 0.791975830078125 +0.215 0.497711181640625 0.791975830078125 +0.215125 0.49530029296875 0.791975830078125 +0.21525 0.4910888671875 0.791975830078125 +0.215375 0.486724853515625 0.791975830078125 +0.2155 0.48150634765625 0.791975830078125 +0.215625 0.4754638671875 0.791975830078125 +0.21575 0.46856689453125 0.791975830078125 +0.215875 0.46087646484375 0.791975830078125 +0.216 0.450103759765625 0.791975830078125 +0.216125 0.440582275390625 0.791975830078125 +0.21625 0.4302978515625 0.791975830078125 +0.216375 0.419281005859375 0.791975830078125 +0.2165 0.407501220703125 0.791975830078125 +0.216625 0.39501953125 0.791975830078125 +0.21675 0.3818359375 0.791975830078125 +0.216875 0.36444091796875 0.791975830078125 +0.217 0.349761962890625 0.791975830078125 +0.217125 0.334503173828125 0.791975830078125 +0.21725 0.31866455078125 0.791975830078125 +0.217375 0.30224609375 0.791975830078125 +0.2175 0.285308837890625 0.791975830078125 +0.217625 0.263427734375 0.791975830078125 +0.21775 0.24542236328125 0.791975830078125 +0.217875 0.226959228515625 0.791975830078125 +0.218 0.208099365234375 0.791975830078125 +0.218125 0.188873291015625 0.791975830078125 +0.21825 0.169342041015625 0.791975830078125 +0.218375 0.14947509765625 0.791975830078125 +0.2185 0.124298095703125 0.791975830078125 +0.218625 0.103912353515625 0.791975830078125 +0.21875 0.083343505859375 0.791975830078125 +0.218875 0.0626220703125 0.791975830078125 +0.219 0.04180908203125 0.791975830078125 +0.219125 0.020904541015625 0.791975830078125 +0.21925 -0.005218505859375 0.791975830078125 +0.219375 -0.026123046875 0.791975830078125 +0.2195 -0.047027587890625 0.791975830078125 +0.219625 -0.06781005859375 0.791975830078125 +0.21975 -0.0885009765625 0.791975830078125 +0.219875 -0.109039306640625 0.791975830078125 +0.22 -0.134429931640625 0.791975830078125 +0.220125 -0.15447998046875 0.791975830078125 +0.22025 -0.17425537109375 0.791975830078125 +0.220375 -0.1937255859375 0.791975830078125 +0.2205 -0.212860107421875 0.791975830078125 +0.220625 -0.231597900390625 0.791975830078125 +0.22075 -0.249969482421875 0.791975830078125 +0.220875 -0.27227783203125 0.791975830078125 +0.221 -0.289581298828125 0.791975830078125 +0.221125 -0.306396484375 0.791975830078125 +0.22125 -0.322662353515625 0.791975830078125 +0.221375 -0.33837890625 0.791975830078125 +0.2215 -0.353485107421875 0.791975830078125 +0.221625 -0.37152099609375 0.791975830078125 +0.22175 -0.38519287109375 0.791975830078125 +0.221875 -0.398193359375 0.791975830078125 +0.222 -0.4105224609375 0.791975830078125 +0.222125 -0.422119140625 0.791975830078125 +0.22225 -0.432952880859375 0.791975830078125 +0.222375 -0.4454345703125 0.791975830078125 +0.2225 -0.454559326171875 0.791975830078125 +0.222625 -0.462890625 0.791975830078125 +0.22275 -0.470367431640625 0.791975830078125 +0.222875 -0.47705078125 0.791975830078125 +0.223 -0.48291015625 0.791975830078125 +0.223125 -0.487884521484375 0.791975830078125 +0.22325 -0.492950439453125 0.791975830078125 +0.223375 -0.496002197265625 0.791975830078125 +0.2235 -0.498199462890625 0.791975830078125 +0.223625 -0.49951171875 0.791975830078125 +0.22375 -0.49993896484375 0.791975830078125 +0.223875 -0.49951171875 0.791975830078125 +0.224 -0.497711181640625 0.9999084491282701 +0.224125 -0.49456787109375 0.9999084491282701 +0.22425 -0.490081787109375 0.9999084491282701 +0.224375 -0.484222412109375 0.9999084491282701 +0.2245 -0.478607177734375 0.9999084491282701 +0.224625 -0.470367431640625 0.9999084491282701 +0.22475 -0.46087646484375 0.9999084491282701 +0.224875 -0.450103759765625 0.9999084491282701 +0.225 -0.438079833984375 0.9999084491282701 +0.225125 -0.4276123046875 0.9999084491282701 +0.22525 -0.413482666015625 0.9999084491282701 +0.225375 -0.398193359375 0.9999084491282701 +0.2255 -0.3818359375 0.9999084491282701 +0.225625 -0.36444091796875 0.9999084491282701 +0.22575 -0.349761962890625 0.9999084491282701 +0.225875 -0.330596923828125 0.9999084491282701 +0.226 -0.310516357421875 0.9999084491282701 +0.226125 -0.289581298828125 0.9999084491282701 +0.22625 -0.267852783203125 0.9999084491282701 +0.226375 -0.249969482421875 0.9999084491282701 +0.2265 -0.226959228515625 0.9999084491282701 +0.226625 -0.203338623046875 0.9999084491282701 +0.22675 -0.17913818359375 0.9999084491282701 +0.226875 -0.15447998046875 0.9999084491282701 +0.227 -0.134429931640625 0.9999084491282701 +0.227125 -0.109039306640625 0.9999084491282701 +0.22725 -0.083343505859375 0.9999084491282701 +0.227375 -0.05743408203125 0.9999084491282701 +0.2275 -0.0313720703125 0.9999084491282701 +0.227625 -0.01043701171875 0.9999084491282701 +0.22775 0.01568603515625 0.9999084491282701 +0.227875 0.04180908203125 0.9999084491282701 +0.228 0.06781005859375 0.9999084491282701 +0.228125 0.093658447265625 0.9999084491282701 +0.22825 0.1141357421875 0.9999084491282701 +0.228375 0.13946533203125 0.9999084491282701 +0.2285 0.164398193359375 0.9999084491282701 +0.228625 0.188873291015625 0.9999084491282701 +0.22875 0.212860107421875 0.9999084491282701 +0.228875 0.231597900390625 0.9999084491282701 +0.229 0.25445556640625 0.9999084491282701 +0.229125 0.276641845703125 0.9999084491282701 +0.22925 0.298065185546875 0.9999084491282701 +0.229375 0.31866455078125 0.9999084491282701 +0.2295 0.334503173828125 0.9999084491282701 +0.229625 0.353485107421875 0.9999084491282701 +0.22975 0.37152099609375 0.9999084491282701 +0.229875 0.388519287109375 0.9999084491282701 +0.23 0.404449462890625 0.9999084491282701 +0.230125 0.416412353515625 0.9999084491282701 +0.23025 0.4302978515625 0.9999084491282701 +0.230375 0.44305419921875 0.9999084491282701 +0.2305 0.454559326171875 0.9999084491282701 +0.230625 0.464813232421875 0.9999084491282701 +0.23075 0.472137451171875 0.9999084491282701 +0.230875 0.480072021484375 0.9999084491282701 +0.231 0.486724853515625 0.9999084491282701 +0.231125 0.492034912109375 0.9999084491282701 +0.23125 0.496002197265625 0.9999084491282701 +0.231375 0.498199462890625 0.9999084491282701 +0.2315 0.49969482421875 0.9999084491282701 +0.231625 0.49981689453125 0.9999084491282701 +0.23175 0.49859619140625 0.9999084491282701 +0.231875 0.496002197265625 0.9999084491282701 +0.232 0.492950439453125 0.9999084491282701 +0.232125 0.487884521484375 0.9999084491282701 +0.23225 0.48150634765625 0.9999084491282701 +0.232375 0.47381591796875 0.9999084491282701 +0.2325 0.464813232421875 0.9999084491282701 +0.232625 0.45672607421875 0.9999084491282701 +0.23275 0.4454345703125 0.9999084491282701 +0.232875 0.432952880859375 0.9999084491282701 +0.233 0.419281005859375 0.9999084491282701 +0.233125 0.404449462890625 0.9999084491282701 +0.23325 0.39178466796875 0.9999084491282701 +0.233375 0.375 0.9999084491282701 +0.2335 0.357177734375 0.9999084491282701 +0.233625 0.33837890625 0.9999084491282701 +0.23375 0.31866455078125 0.9999084491282701 +0.233875 0.30224609375 0.9999084491282701 +0.234 0.280975341796875 0.9999084491282701 +0.234125 0.25897216796875 0.9999084491282701 +0.23425 0.236236572265625 0.9999084491282701 +0.234375 0.212860107421875 0.9999084491282701 +0.2345 0.1937255859375 0.9999084491282701 +0.234625 0.169342041015625 0.9999084491282701 +0.23475 0.14447021484375 0.9999084491282701 +0.234875 0.119232177734375 0.9999084491282701 +0.235 0.093658447265625 0.9999084491282701 +0.235125 0.072998046875 0.9999084491282701 +0.23525 0.047027587890625 0.9999084491282701 +0.235375 0.020904541015625 0.9999084491282701 +0.2355 -0.005218505859375 0.9999084491282701 +0.235625 -0.0313720703125 0.9999084491282701 +0.23575 -0.05224609375 0.9999084491282701 +0.235875 -0.07818603515625 0.9999084491282701 +0.236 -0.103912353515625 0.9999084491282701 +0.236125 -0.129364013671875 0.9999084491282701 +0.23625 -0.15447998046875 0.9999084491282701 +0.236375 -0.17425537109375 0.9999084491282701 +0.2365 -0.19854736328125 0.9999084491282701 +0.236625 -0.2222900390625 0.9999084491282701 +0.23675 -0.24542236328125 0.9999084491282701 +0.236875 -0.267852783203125 0.9999084491282701 +0.237 -0.285308837890625 0.9999084491282701 +0.237125 -0.306396484375 0.9999084491282701 +0.23725 -0.32666015625 0.9999084491282701 +0.237375 -0.34600830078125 0.9999084491282701 +0.2375 -0.36444091796875 0.9999084491282701 +0.237625 -0.378448486328125 0.9999084491282701 +0.23775 -0.39501953125 0.9999084491282701 +0.237875 -0.4105224609375 0.9999084491282701 +0.238 -0.424896240234375 0.9999084491282701 +0.238125 -0.438079833984375 0.9999084491282701 +0.23825 -0.447784423828125 0.9999084491282701 +0.238375 -0.458831787109375 0.9999084491282701 +0.2385 -0.46856689453125 0.9999084491282701 +0.238625 -0.47705078125 0.9999084491282701 +0.23875 -0.484222412109375 0.9999084491282701 +0.238875 -0.489013671875 0.9999084491282701 +0.239 -0.4937744140625 0.9999084491282701 +0.239125 -0.4971923828125 0.9999084491282701 +0.23925 -0.499267578125 0.9999084491282701 +0.239375 -0.49993896484375 0.9999084491282701 +0.2395 -0.49951171875 0.9999084491282701 +0.239625 -0.497711181640625 0.9999084491282701 +0.23975 -0.49456787109375 0.9999084491282701 +0.239875 -0.490081787109375 0.9999084491282701 +0.24 -0.484222412109375 0.9999084491282701 +0.240125 -0.478607177734375 0.9999084491282701 +0.24025 -0.470367431640625 0.9999084491282701 +0.240375 -0.46087646484375 0.9999084491282701 +0.2405 -0.450103759765625 0.9999084491282701 +0.240625 -0.438079833984375 0.9999084491282701 +0.24075 -0.4276123046875 0.9999084491282701 +0.240875 -0.413482666015625 0.9999084491282701 +0.241 -0.398193359375 0.9999084491282701 +0.241125 -0.3818359375 0.9999084491282701 +0.24125 -0.36444091796875 0.9999084491282701 +0.241375 -0.349761962890625 0.9999084491282701 +0.2415 -0.330596923828125 0.9999084491282701 +0.241625 -0.310516357421875 0.9999084491282701 +0.24175 -0.289581298828125 0.9999084491282701 +0.241875 -0.267852783203125 0.9999084491282701 +0.242 -0.249969482421875 0.9999084491282701 +0.242125 -0.226959228515625 0.9999084491282701 +0.24225 -0.203338623046875 0.9999084491282701 +0.242375 -0.17913818359375 0.9999084491282701 +0.2425 -0.15447998046875 0.9999084491282701 +0.242625 -0.134429931640625 0.9999084491282701 +0.24275 -0.109039306640625 0.9999084491282701 +0.242875 -0.083343505859375 0.9999084491282701 +0.243 -0.05743408203125 0.9999084491282701 +0.243125 -0.0313720703125 0.9999084491282701 +0.24325 -0.01043701171875 0.9999084491282701 +0.243375 0.01568603515625 0.9999084491282701 +0.2435 0.04180908203125 0.9999084491282701 +0.243625 0.06781005859375 0.9999084491282701 +0.24375 0.093658447265625 0.9999084491282701 +0.243875 0.1141357421875 0.9999084491282701 +0.244 0.13946533203125 0.9999084491282701 +0.244125 0.164398193359375 0.9999084491282701 +0.24425 0.188873291015625 0.9999084491282701 +0.244375 0.212860107421875 0.9999084491282701 +0.2445 0.231597900390625 0.9999084491282701 +0.244625 0.25445556640625 0.9999084491282701 +0.24475 0.276641845703125 0.9999084491282701 +0.244875 0.298065185546875 0.9999084491282701 +0.245 0.31866455078125 0.9999084491282701 +0.245125 0.334503173828125 0.9999084491282701 +0.24525 0.353485107421875 0.9999084491282701 +0.245375 0.37152099609375 0.9999084491282701 +0.2455 0.388519287109375 0.9999084491282701 +0.245625 0.404449462890625 0.9999084491282701 +0.24575 0.416412353515625 0.9999084491282701 +0.245875 0.4302978515625 0.9999084491282701 +0.246 0.44305419921875 0.9999084491282701 +0.246125 0.454559326171875 0.9999084491282701 +0.24625 0.464813232421875 0.9999084491282701 +0.246375 0.472137451171875 0.9999084491282701 +0.2465 0.480072021484375 0.9999084491282701 +0.246625 0.486724853515625 0.9999084491282701 +0.24675 0.492034912109375 0.9999084491282701 +0.246875 0.496002197265625 0.9999084491282701 +0.247 0.498199462890625 0.9999084491282701 +0.247125 0.49969482421875 0.9999084491282701 +0.24725 0.49981689453125 0.9999084491282701 +0.247375 0.49859619140625 0.9999084491282701 +0.2475 0.496002197265625 0.9999084491282701 +0.247625 0.492950439453125 0.9999084491282701 +0.24775 0.487884521484375 0.9999084491282701 +0.247875 0.48150634765625 0.9999084491282701 +0.248 0.47381591796875 0.9999084491282701 +0.248125 0.464813232421875 0.9999084491282701 +0.24825 0.45672607421875 0.9999084491282701 +0.248375 0.4454345703125 0.9999084491282701 +0.2485 0.432952880859375 0.9999084491282701 +0.248625 0.419281005859375 0.9999084491282701 +0.24875 0.404449462890625 0.9999084491282701 +0.248875 0.39178466796875 0.9999084491282701 +0.249 0.375 0.9999084491282701 +0.249125 0.357177734375 0.9999084491282701 +0.24925 0.33837890625 0.9999084491282701 +0.249375 0.31866455078125 0.9999084491282701 +0.2495 0.30224609375 0.9999084491282701 +0.249625 0.280975341796875 0.9999084491282701 +0.24975 0.25897216796875 0.9999084491282701 +0.249875 0.236236572265625 0.9999084491282701 +0.25 0.212860107421875 0.9999084491282701 +0.250125 0.1937255859375 0.9999084491282701 +0.25025 0.169342041015625 0.9999084491282701 +0.250375 0.14447021484375 0.9999084491282701 +0.2505 0.119232177734375 0.9999084491282701 +0.250625 0.093658447265625 0.9999084491282701 +0.25075 0.072998046875 0.9999084491282701 +0.250875 0.047027587890625 0.9999084491282701 +0.251 0.020904541015625 0.9999084491282701 +0.251125 -0.005218505859375 0.9999084491282701 +0.25125 -0.0313720703125 0.9999084491282701 +0.251375 -0.05224609375 0.9999084491282701 +0.2515 -0.07818603515625 0.9999084491282701 +0.251625 -0.103912353515625 0.9999084491282701 +0.25175 -0.129364013671875 0.9999084491282701 +0.251875 -0.15447998046875 0.9999084491282701 +0.252 -0.17425537109375 0.9999084491282701 +0.252125 -0.19854736328125 0.9999084491282701 +0.25225 -0.2222900390625 0.9999084491282701 +0.252375 -0.24542236328125 0.9999084491282701 +0.2525 -0.267852783203125 0.9999084491282701 +0.252625 -0.285308837890625 0.9999084491282701 +0.25275 -0.306396484375 0.9999084491282701 +0.252875 -0.32666015625 0.9999084491282701 +0.253 -0.34600830078125 0.9999084491282701 +0.253125 -0.36444091796875 0.9999084491282701 +0.25325 -0.378448486328125 0.9999084491282701 +0.253375 -0.39501953125 0.9999084491282701 +0.2535 -0.4105224609375 0.9999084491282701 +0.253625 -0.424896240234375 0.9999084491282701 +0.2537500000000001 -0.438079833984375 0.9999084491282701 +0.253875 -0.447784423828125 0.9999084491282701 +0.254 -0.458831787109375 0.9999084491282701 +0.254125 -0.46856689453125 0.9999084491282701 +0.25425 -0.47705078125 0.9999084491282701 +0.254375 -0.484222412109375 0.9999084491282701 +0.2545 -0.489013671875 0.9999084491282701 +0.254625 -0.4937744140625 0.9999084491282701 +0.25475 -0.4971923828125 0.9999084491282701 +0.254875 -0.499267578125 0.9999084491282701 +0.255 -0.49993896484375 0.9999084491282701 +0.255125 -0.49951171875 0.9999084491282701 +0.25525 -0.497711181640625 0.9999084491282701 +0.255375 -0.49456787109375 0.9999084491282701 +0.2555 -0.490081787109375 0.9999084491282701 +0.255625 -0.484222412109375 0.9999084491282701 +0.25575 -0.478607177734375 0.9999084491282701 +0.255875 -0.470367431640625 0.9999084491282701 diff --git a/tests/circuitpython/synth_note_envelope.py b/tests/circuitpython/synth_note_envelope.py new file mode 100644 index 0000000000..f7e41b4dc8 --- /dev/null +++ b/tests/circuitpython/synth_note_envelope.py @@ -0,0 +1,10 @@ +from synthnotehelper import * + + +@synth_test +def gen(synth): + l = LFO(bend_out, offset=0.2, scale=0.8, rate=4, once=True) + yield [l] + n = Note(128, amplitude=l) + synth.press(n) + yield 1 / 4 diff --git a/tests/circuitpython/synth_note_envelope.py.exp b/tests/circuitpython/synth_note_envelope.py.exp new file mode 100644 index 0000000000..d4c7d0adc2 --- /dev/null +++ b/tests/circuitpython/synth_note_envelope.py.exp @@ -0,0 +1,2048 @@ +0.0 0.01422119140625 0.302396875 +0.000125 0.029876708984375 0.302396875 +0.00025 0.043670654296875 0.302396875 +0.000375 0.058563232421875 0.302396875 +0.0005 0.07281494140625 0.302396875 +0.000625 0.0849609375 0.302396875 +0.00075 0.097564697265625 0.302396875 +0.0008750000000000002 0.108001708984375 0.302396875 +0.001 0.11846923828125 0.302396875 +0.001125 0.12762451171875 0.302396875 +0.00125 0.134674072265625 0.302396875 +0.001375 0.14111328125 0.302396875 +0.0015 0.145599365234375 0.302396875 +0.001625 0.1490478515625 0.302396875 +0.00175 0.15087890625 0.302396875 +0.001875 0.151092529296875 0.302396875 +0.002 0.149749755859375 0.302396875 +0.002125 0.14715576171875 0.302396875 +0.00225 0.14276123046875 0.302396875 +0.002375 0.13677978515625 0.302396875 +0.0025 0.130096435546875 0.302396875 +0.002625 0.121337890625 0.302396875 +0.00275 0.112335205078125 0.302396875 +0.002875 0.10113525390625 0.302396875 +0.003 0.088836669921875 0.302396875 +0.003125 0.076934814453125 0.302396875 +0.00325 0.06292724609375 0.302396875 +0.003375 0.049713134765625 0.302396875 +0.0035 0.034515380859375 0.302396875 +0.003625 0.0189208984375 0.302396875 +0.00375 0.004730224609375 0.302396875 +0.003875 -0.01104736328125 0.302396875 +0.004 -0.02520751953125 0.302396875 +0.004125 -0.0406494140625 0.302396875 +0.00425 -0.055633544921875 0.302396875 +0.004375000000000001 -0.068603515625 0.302396875 +0.004500000000000001 -0.08233642578125 0.302396875 +0.004625 -0.093902587890625 0.302396875 +0.00475 -0.105743408203125 0.302396875 +0.004875 -0.116455078125 0.302396875 +0.005 -0.125030517578125 0.302396875 +0.005125000000000001 -0.133209228515625 0.302396875 +0.00525 -0.13934326171875 0.302396875 +0.005375000000000001 -0.14471435546875 0.302396875 +0.005499999999999999 -0.14849853515625 0.302396875 +0.005625 -0.150482177734375 0.302396875 +0.00575 -0.151153564453125 0.302396875 +0.005874999999999999 -0.15032958984375 0.302396875 +0.006 -0.147857666015625 0.302396875 +0.006125 -0.143768310546875 0.302396875 +0.00625 -0.13873291015625 0.302396875 +0.006375 -0.131683349609375 0.302396875 +0.0065 -0.124114990234375 0.302396875 +0.006625000000000001 -0.114410400390625 0.302396875 +0.00675 -0.103485107421875 0.302396875 +0.006875 -0.0926513671875 0.302396875 +0.007000000000000001 -0.07965087890625 0.302396875 +0.007125000000000002 -0.06719970703125 0.302396875 +0.007250000000000001 -0.05267333984375 0.302396875 +0.007375 -0.037567138671875 0.302396875 +0.0075 -0.02362060546875 0.302396875 +0.007625 -0.007904052734375 0.302396875 +0.00775 0.006317138671875 0.302396875 +0.007875 0.022064208984375 0.302396875 +0.008 0.037567138671875 0.302396875 +0.008125 0.051177978515625 0.302396875 +0.00825 0.0657958984375 0.302396875 +0.008375 0.07830810546875 0.302396875 +0.0085 0.09136962890625 0.302396875 +0.008625 0.103485107421875 0.302396875 +0.008750000000000002 0.113372802734375 0.302396875 +0.008875 0.123199462890625 0.302396875 +0.009000000000000002 0.13092041015625 0.302396875 +0.009125 0.138092041015625 0.302396875 +0.00925 0.143768310546875 0.302396875 +0.009375 0.14752197265625 0.302396875 +0.0095 0.150146484375 0.302396875 +0.009625 0.151123046875 0.302396875 +0.00975 0.150634765625 0.302396875 +0.009875 0.14849853515625 0.302396875 +0.01 0.145172119140625 0.302396875 +0.010125 0.13995361328125 0.302396875 +0.01025 0.13397216796875 0.302396875 +0.010375 0.12591552734375 0.302396875 +0.0105 0.116455078125 0.302396875 +0.010625 0.10687255859375 0.302396875 +0.01075 0.095123291015625 0.302396875 +0.010875 0.083648681640625 0.302396875 +0.011 0.07000732421875 0.302396875 +0.011125 0.055633544921875 0.302396875 +0.01125 0.042144775390625 0.302396875 +0.011375 0.026763916015625 0.302396875 +0.0115 0.01263427734375 0.302396875 +0.011625 -0.003143310546875 0.302396875 +0.01175 -0.0189208984375 0.302396875 +0.011875 -0.032958984375 0.302396875 +0.012 -0.0482177734375 0.302396875 +0.012125 -0.06146240234375 0.302396875 +0.01225 -0.0755615234375 0.302396875 +0.012375 -0.088836669921875 0.302396875 +0.0125 -0.0999755859375 0.302396875 +0.012625 -0.11126708984375 0.302396875 +0.01275 -0.120391845703125 0.302396875 +0.012875 -0.129302978515625 0.302396875 +0.013 -0.13677978515625 0.302396875 +0.013125 -0.1422119140625 0.302396875 +0.01325 -0.14678955078125 0.302396875 +0.013375 -0.1495361328125 0.302396875 +0.0135 -0.151031494140625 0.302396875 +0.013625 -0.15087890625 0.302396875 +0.01375 -0.1492919921875 0.302396875 +0.013875 -0.14599609375 0.302396875 +0.014 -0.141693115234375 0.302396875 +0.014125 -0.135406494140625 0.302396875 +0.01425 -0.12762451171875 0.302396875 +0.014375 -0.11944580078125 0.302396875 +0.0145 -0.109100341796875 0.302396875 +0.014625 -0.0987548828125 0.302396875 +0.01475 -0.086273193359375 0.302396875 +0.014875 -0.07281494140625 0.302396875 +0.015 -0.060028076171875 0.302396875 +0.015125 -0.045196533203125 0.302396875 +0.01525 -0.031402587890625 0.302396875 +0.015375 -0.015777587890625 0.302396875 +0.0155 0.0 0.302396875 +0.015625 0.01422119140625 0.302396875 +0.01575 0.029876708984375 0.302396875 +0.015875 0.043670654296875 0.302396875 +0.016 0.058563232421875 0.302396875 +0.016125 0.07281494140625 0.302396875 +0.01625 0.0849609375 0.302396875 +0.016375 0.097564697265625 0.302396875 +0.0165 0.108001708984375 0.302396875 +0.016625 0.11846923828125 0.302396875 +0.01675 0.12762451171875 0.302396875 +0.016875 0.134674072265625 0.302396875 +0.017 0.14111328125 0.302396875 +0.017125 0.145599365234375 0.302396875 +0.01725 0.1490478515625 0.302396875 +0.017375 0.15087890625 0.302396875 +0.0175 0.151092529296875 0.302396875 +0.017625 0.149749755859375 0.302396875 +0.01775 0.14715576171875 0.302396875 +0.017875 0.14276123046875 0.302396875 +0.018 0.13677978515625 0.302396875 +0.018125 0.130096435546875 0.302396875 +0.01825 0.121337890625 0.302396875 +0.018375 0.112335205078125 0.302396875 +0.0185 0.10113525390625 0.302396875 +0.018625 0.088836669921875 0.302396875 +0.01875 0.076934814453125 0.302396875 +0.018875 0.06292724609375 0.302396875 +0.019 0.049713134765625 0.302396875 +0.019125 0.034515380859375 0.302396875 +0.01925 0.0189208984375 0.302396875 +0.019375 0.004730224609375 0.302396875 +0.0195 -0.01104736328125 0.302396875 +0.019625 -0.02520751953125 0.302396875 +0.01975 -0.0406494140625 0.302396875 +0.019875 -0.055633544921875 0.302396875 +0.02 -0.068603515625 0.302396875 +0.020125 -0.08233642578125 0.302396875 +0.02025 -0.093902587890625 0.302396875 +0.020375 -0.105743408203125 0.302396875 +0.0205 -0.116455078125 0.302396875 +0.020625 -0.125030517578125 0.302396875 +0.02075 -0.133209228515625 0.302396875 +0.020875 -0.13934326171875 0.302396875 +0.021 -0.14471435546875 0.302396875 +0.021125 -0.14849853515625 0.302396875 +0.02125 -0.150482177734375 0.302396875 +0.021375 -0.151153564453125 0.302396875 +0.0215 -0.15032958984375 0.302396875 +0.021625 -0.147857666015625 0.302396875 +0.02175 -0.143768310546875 0.302396875 +0.021875 -0.13873291015625 0.302396875 +0.022 -0.131683349609375 0.302396875 +0.022125 -0.124114990234375 0.302396875 +0.02225 -0.114410400390625 0.302396875 +0.022375 -0.103485107421875 0.302396875 +0.0225 -0.0926513671875 0.302396875 +0.022625 -0.07965087890625 0.302396875 +0.02275 -0.06719970703125 0.302396875 +0.022875 -0.05267333984375 0.302396875 +0.023 -0.037567138671875 0.302396875 +0.023125 -0.02362060546875 0.302396875 +0.02325 -0.007904052734375 0.302396875 +0.023375 0.006317138671875 0.302396875 +0.0235 0.022064208984375 0.302396875 +0.023625 0.037567138671875 0.302396875 +0.02375 0.051177978515625 0.302396875 +0.023875 0.0657958984375 0.302396875 +0.024 0.07830810546875 0.302396875 +0.024125 0.09136962890625 0.302396875 +0.02425 0.103485107421875 0.302396875 +0.024375 0.113372802734375 0.302396875 +0.0245 0.123199462890625 0.302396875 +0.024625 0.13092041015625 0.302396875 +0.02475 0.138092041015625 0.302396875 +0.024875 0.143768310546875 0.302396875 +0.025 0.14752197265625 0.302396875 +0.025125 0.150146484375 0.302396875 +0.02525 0.151123046875 0.302396875 +0.02537500000000001 0.150634765625 0.302396875 +0.0255 0.14849853515625 0.302396875 +0.025625 0.145172119140625 0.302396875 +0.02575 0.13995361328125 0.302396875 +0.025875 0.13397216796875 0.302396875 +0.026 0.12591552734375 0.302396875 +0.026125 0.116455078125 0.302396875 +0.02625 0.10687255859375 0.302396875 +0.026375 0.095123291015625 0.302396875 +0.0265 0.083648681640625 0.302396875 +0.026625 0.07000732421875 0.302396875 +0.02675 0.055633544921875 0.302396875 +0.026875 0.042144775390625 0.302396875 +0.027 0.026763916015625 0.302396875 +0.027125 0.01263427734375 0.302396875 +0.02725 -0.003143310546875 0.302396875 +0.027375 -0.0189208984375 0.302396875 +0.0275 -0.032958984375 0.302396875 +0.027625 -0.0482177734375 0.302396875 +0.02775 -0.06146240234375 0.302396875 +0.027875 -0.0755615234375 0.302396875 +0.028 -0.088836669921875 0.302396875 +0.028125 -0.0999755859375 0.302396875 +0.02825 -0.11126708984375 0.302396875 +0.028375 -0.120391845703125 0.302396875 +0.02850000000000001 -0.129302978515625 0.302396875 +0.028625 -0.13677978515625 0.302396875 +0.02875 -0.1422119140625 0.302396875 +0.028875 -0.14678955078125 0.302396875 +0.029 -0.1495361328125 0.302396875 +0.029125 -0.151031494140625 0.302396875 +0.02925 -0.15087890625 0.302396875 +0.029375 -0.1492919921875 0.302396875 +0.0295 -0.14599609375 0.302396875 +0.029625 -0.141693115234375 0.302396875 +0.02975000000000001 -0.135406494140625 0.302396875 +0.029875 -0.12762451171875 0.302396875 +0.03 -0.11944580078125 0.302396875 +0.030125 -0.109100341796875 0.302396875 +0.03025 -0.0987548828125 0.302396875 +0.030375 -0.086273193359375 0.302396875 +0.0305 -0.07281494140625 0.302396875 +0.030625 -0.060028076171875 0.302396875 +0.03075 -0.045196533203125 0.302396875 +0.03087499999999999 -0.031402587890625 0.302396875 +0.031 -0.015777587890625 0.302396875 +0.031125 0.0 0.302396875 +0.03125 0.01422119140625 0.302396875 +0.031375 0.029876708984375 0.302396875 +0.0315 0.043670654296875 0.302396875 +0.03162500000000001 0.058563232421875 0.302396875 +0.03175 0.07281494140625 0.302396875 +0.031875 0.0849609375 0.302396875 +0.032 0.130615234375 0.4047937500000001 +0.032125 0.144561767578125 0.4047937500000001 +0.03225 0.1585693359375 0.4047937500000001 +0.032375 0.17083740234375 0.4047937500000001 +0.0325 0.1802978515625 0.4047937500000001 +0.032625 0.18890380859375 0.4047937500000001 +0.03275 0.19488525390625 0.4047937500000001 +0.032875 0.19952392578125 0.4047937500000001 +0.033 0.20196533203125 0.4047937500000001 +0.033125 0.202239990234375 0.4047937500000001 +0.03325 0.200469970703125 0.4047937500000001 +0.033375 0.197021484375 0.4047937500000001 +0.0335 0.19110107421875 0.4047937500000001 +0.03362500000000001 0.18310546875 0.4047937500000001 +0.03375 0.174163818359375 0.4047937500000001 +0.033875 0.162445068359375 0.4047937500000001 +0.034 0.150360107421875 0.4047937500000001 +0.03412500000000001 0.135406494140625 0.4047937500000001 +0.03425 0.118927001953125 0.4047937500000001 +0.034375 0.102996826171875 0.4047937500000001 +0.0345 0.084228515625 0.4047937500000001 +0.034625 0.0665283203125 0.4047937500000001 +0.03475000000000001 0.04620361328125 0.4047937500000001 +0.034875 0.02532958984375 0.4047937500000001 +0.035 0.00634765625 0.4047937500000001 +0.03512500000000001 -0.014801025390625 0.4047937500000001 +0.03525 -0.033721923828125 0.4047937500000001 +0.035375 -0.054412841796875 0.4047937500000001 +0.0355 -0.074493408203125 0.4047937500000001 +0.03562500000000001 -0.09185791015625 0.4047937500000001 +0.03575 -0.110198974609375 0.4047937500000001 +0.035875 -0.12567138671875 0.4047937500000001 +0.03600000000000001 -0.141571044921875 0.4047937500000001 +0.036125 -0.155914306640625 0.4047937500000001 +0.03625 -0.1673583984375 0.4047937500000001 +0.036375 -0.1783447265625 0.4047937500000001 +0.0365 -0.186553955078125 0.4047937500000001 +0.036625 -0.1937255859375 0.4047937500000001 +0.03675 -0.198760986328125 0.4047937500000001 +0.036875 -0.201446533203125 0.4047937500000001 +0.037 -0.20233154296875 0.4047937500000001 +0.03712499999999999 -0.20123291015625 0.4047937500000001 +0.03725 -0.19793701171875 0.4047937500000001 +0.037375 -0.19244384765625 0.4047937500000001 +0.0375 -0.185699462890625 0.4047937500000001 +0.037625 -0.176300048828125 0.4047937500000001 +0.03775 -0.166168212890625 0.4047937500000001 +0.037875 -0.153167724609375 0.4047937500000001 +0.038 -0.138519287109375 0.4047937500000001 +0.038125 -0.1240234375 0.4047937500000001 +0.03825 -0.10662841796875 0.4047937500000001 +0.038375 -0.0899658203125 0.4047937500000001 +0.0385 -0.070526123046875 0.4047937500000001 +0.038625 -0.05029296875 0.4047937500000001 +0.03875 -0.031646728515625 0.4047937500000001 +0.038875 -0.01055908203125 0.4047937500000001 +0.039 0.008453369140625 0.4047937500000001 +0.039125 0.029541015625 0.4047937500000001 +0.03925 0.05029296875 0.4047937500000001 +0.039375 0.06854248046875 0.4047937500000001 +0.0395 0.08807373046875 0.4047937500000001 +0.039625 0.104827880859375 0.4047937500000001 +0.03975 0.122344970703125 0.4047937500000001 +0.039875 0.138519287109375 0.4047937500000001 +0.04 0.15179443359375 0.4047937500000001 +0.040125 0.164947509765625 0.4047937500000001 +0.04025 0.17523193359375 0.4047937500000001 +0.040375 0.184844970703125 0.4047937500000001 +0.04050000000000001 0.19244384765625 0.4047937500000001 +0.040625 0.197479248046875 0.4047937500000001 +0.04075 0.201019287109375 0.4047937500000001 +0.040875 0.202301025390625 0.4047937500000001 +0.04100000000000001 0.20166015625 0.4047937500000001 +0.041125 0.198760986328125 0.4047937500000001 +0.04125 0.194305419921875 0.4047937500000001 +0.041375 0.187347412109375 0.4047937500000001 +0.0415 0.1793212890625 0.4047937500000001 +0.041625 0.168548583984375 0.4047937500000001 +0.04175000000000001 0.155914306640625 0.4047937500000001 +0.041875 0.14306640625 0.4047937500000001 +0.042 0.127349853515625 0.4047937500000001 +0.042125 0.111968994140625 0.4047937500000001 +0.04225000000000001 0.09375 0.4047937500000001 +0.042375 0.074493408203125 0.4047937500000001 +0.0425 0.056427001953125 0.4047937500000001 +0.042625 0.03582763671875 0.4047937500000001 +0.04275 0.01690673828125 0.4047937500000001 +0.04287500000000001 -0.00421142578125 0.4047937500000001 +0.04300000000000001 -0.02532958984375 0.4047937500000001 +0.043125 -0.04412841796875 0.4047937500000001 +0.04325 -0.064544677734375 0.4047937500000001 +0.043375 -0.082305908203125 0.4047937500000001 +0.04350000000000001 -0.101165771484375 0.4047937500000001 +0.04362500000000001 -0.118927001953125 0.4047937500000001 +0.04375000000000001 -0.133819580078125 0.4047937500000001 +0.043875 -0.148956298828125 0.4047937500000001 +0.04399999999999999 -0.161163330078125 0.4047937500000001 +0.044125 -0.173095703125 0.4047937500000001 +0.04425 -0.18310546875 0.4047937500000001 +0.044375 -0.190399169921875 0.4047937500000001 +0.04449999999999999 -0.196502685546875 0.4047937500000001 +0.04462499999999999 -0.2001953125 0.4047937500000001 +0.04475 -0.202178955078125 0.4047937500000001 +0.044875 -0.20196533203125 0.4047937500000001 +0.045 -0.199859619140625 0.4047937500000001 +0.045125 -0.195465087890625 0.4047937500000001 +0.04525 -0.189666748046875 0.4047937500000001 +0.045375 -0.181243896484375 0.4047937500000001 +0.0455 -0.17083740234375 0.4047937500000001 +0.045625 -0.159881591796875 0.4047937500000001 +0.04575 -0.14605712890625 0.4047937500000001 +0.045875 -0.1322021484375 0.4047937500000001 +0.046 -0.115478515625 0.4047937500000001 +0.046125 -0.09747314453125 0.4047937500000001 +0.04625 -0.080352783203125 0.4047937500000001 +0.046375 -0.06048583984375 0.4047937500000001 +0.04649999999999999 -0.04205322265625 0.4047937500000001 +0.046625 -0.021148681640625 0.4047937500000001 +0.04675000000000001 0.0 0.4047937500000001 +0.046875 0.019012451171875 0.4047937500000001 +0.04699999999999999 0.03997802734375 0.4047937500000001 +0.047125 0.0584716796875 0.4047937500000001 +0.04725000000000001 0.078399658203125 0.4047937500000001 +0.047375 0.09747314453125 0.4047937500000001 +0.0475 0.113739013671875 0.4047937500000001 +0.047625 0.130615234375 0.4047937500000001 +0.04775 0.144561767578125 0.4047937500000001 +0.047875 0.1585693359375 0.4047937500000001 +0.048 0.17083740234375 0.4047937500000001 +0.048125 0.1802978515625 0.4047937500000001 +0.04825 0.18890380859375 0.4047937500000001 +0.048375 0.19488525390625 0.4047937500000001 +0.0485 0.19952392578125 0.4047937500000001 +0.048625 0.20196533203125 0.4047937500000001 +0.04875 0.202239990234375 0.4047937500000001 +0.048875 0.200469970703125 0.4047937500000001 +0.049 0.197021484375 0.4047937500000001 +0.04912500000000001 0.19110107421875 0.4047937500000001 +0.04925000000000001 0.18310546875 0.4047937500000001 +0.049375 0.174163818359375 0.4047937500000001 +0.0495 0.162445068359375 0.4047937500000001 +0.049625 0.150360107421875 0.4047937500000001 +0.04975000000000001 0.135406494140625 0.4047937500000001 +0.04987500000000001 0.118927001953125 0.4047937500000001 +0.05 0.102996826171875 0.4047937500000001 +0.05012499999999999 0.084228515625 0.4047937500000001 +0.05025 0.0665283203125 0.4047937500000001 +0.05037500000000001 0.04620361328125 0.4047937500000001 +0.0505 0.02532958984375 0.4047937500000001 +0.05062500000000001 0.00634765625 0.4047937500000001 +0.05075000000000001 -0.014801025390625 0.4047937500000001 +0.050875 -0.033721923828125 0.4047937500000001 +0.051 -0.054412841796875 0.4047937500000001 +0.051125 -0.074493408203125 0.4047937500000001 +0.05125000000000001 -0.09185791015625 0.4047937500000001 +0.051375 -0.110198974609375 0.4047937500000001 +0.0515 -0.12567138671875 0.4047937500000001 +0.05162500000000001 -0.141571044921875 0.4047937500000001 +0.05175000000000001 -0.155914306640625 0.4047937500000001 +0.051875 -0.1673583984375 0.4047937500000001 +0.052 -0.1783447265625 0.4047937500000001 +0.052125 -0.186553955078125 0.4047937500000001 +0.05225 -0.1937255859375 0.4047937500000001 +0.05237499999999999 -0.198760986328125 0.4047937500000001 +0.0525 -0.201446533203125 0.4047937500000001 +0.052625 -0.20233154296875 0.4047937500000001 +0.05274999999999999 -0.20123291015625 0.4047937500000001 +0.052875 -0.19793701171875 0.4047937500000001 +0.05300000000000001 -0.19244384765625 0.4047937500000001 +0.053125 -0.185699462890625 0.4047937500000001 +0.05324999999999999 -0.176300048828125 0.4047937500000001 +0.05337499999999999 -0.166168212890625 0.4047937500000001 +0.05350000000000001 -0.153167724609375 0.4047937500000001 +0.053625 -0.138519287109375 0.4047937500000001 +0.05375 -0.1240234375 0.4047937500000001 +0.05387499999999999 -0.10662841796875 0.4047937500000001 +0.054 -0.0899658203125 0.4047937500000001 +0.054125 -0.070526123046875 0.4047937500000001 +0.05425 -0.05029296875 0.4047937500000001 +0.054375 -0.031646728515625 0.4047937500000001 +0.0545 -0.01055908203125 0.4047937500000001 +0.054625 0.008453369140625 0.4047937500000001 +0.05475 0.029541015625 0.4047937500000001 +0.054875 0.05029296875 0.4047937500000001 +0.055 0.06854248046875 0.4047937500000001 +0.055125 0.08807373046875 0.4047937500000001 +0.05525 0.104827880859375 0.4047937500000001 +0.055375 0.122344970703125 0.4047937500000001 +0.05550000000000001 0.138519287109375 0.4047937500000001 +0.055625 0.15179443359375 0.4047937500000001 +0.05575 0.164947509765625 0.4047937500000001 +0.05587499999999999 0.17523193359375 0.4047937500000001 +0.05600000000000001 0.184844970703125 0.4047937500000001 +0.05612500000000001 0.19244384765625 0.4047937500000001 +0.05625 0.197479248046875 0.4047937500000001 +0.05637499999999999 0.201019287109375 0.4047937500000001 +0.0565 0.202301025390625 0.4047937500000001 +0.05662500000000001 0.20166015625 0.4047937500000001 +0.05675 0.198760986328125 0.4047937500000001 +0.056875 0.194305419921875 0.4047937500000001 +0.05700000000000001 0.187347412109375 0.4047937500000001 +0.057125 0.1793212890625 0.4047937500000001 +0.05725 0.168548583984375 0.4047937500000001 +0.057375 0.155914306640625 0.4047937500000001 +0.05750000000000001 0.14306640625 0.4047937500000001 +0.057625 0.127349853515625 0.4047937500000001 +0.05775 0.111968994140625 0.4047937500000001 +0.057875 0.09375 0.4047937500000001 +0.05800000000000001 0.074493408203125 0.4047937500000001 +0.058125 0.056427001953125 0.4047937500000001 +0.05825 0.03582763671875 0.4047937500000001 +0.058375 0.01690673828125 0.4047937500000001 +0.05850000000000001 -0.00421142578125 0.4047937500000001 +0.05862500000000001 -0.02532958984375 0.4047937500000001 +0.05875 -0.04412841796875 0.4047937500000001 +0.058875 -0.064544677734375 0.4047937500000001 +0.059 -0.082305908203125 0.4047937500000001 +0.05912500000000001 -0.101165771484375 0.4047937500000001 +0.05925000000000001 -0.118927001953125 0.4047937500000001 +0.059375 -0.133819580078125 0.4047937500000001 +0.05950000000000001 -0.148956298828125 0.4047937500000001 +0.059625 -0.161163330078125 0.4047937500000001 +0.05975000000000001 -0.173095703125 0.4047937500000001 +0.059875 -0.18310546875 0.4047937500000001 +0.06 -0.190399169921875 0.4047937500000001 +0.06012499999999999 -0.196502685546875 0.4047937500000001 +0.06025 -0.2001953125 0.4047937500000001 +0.060375 -0.202178955078125 0.4047937500000001 +0.0605 -0.20196533203125 0.4047937500000001 +0.060625 -0.199859619140625 0.4047937500000001 +0.06074999999999999 -0.195465087890625 0.4047937500000001 +0.060875 -0.189666748046875 0.4047937500000001 +0.061 -0.181243896484375 0.4047937500000001 +0.061125 -0.17083740234375 0.4047937500000001 +0.06125 -0.159881591796875 0.4047937500000001 +0.061375 -0.14605712890625 0.4047937500000001 +0.0615 -0.1322021484375 0.4047937500000001 +0.061625 -0.115478515625 0.4047937500000001 +0.06174999999999999 -0.09747314453125 0.4047937500000001 +0.061875 -0.080352783203125 0.4047937500000001 +0.062 -0.06048583984375 0.4047937500000001 +0.06212499999999999 -0.04205322265625 0.4047937500000001 +0.06225000000000001 -0.021148681640625 0.4047937500000001 +0.06237500000000001 0.0 0.4047937500000001 +0.0625 0.019012451171875 0.4047937500000001 +0.06262499999999999 0.03997802734375 0.4047937500000001 +0.06274999999999999 0.0584716796875 0.4047937500000001 +0.06287500000000001 0.078399658203125 0.4047937500000001 +0.063 0.09747314453125 0.4047937500000001 +0.063125 0.113739013671875 0.4047937500000001 +0.06325000000000001 0.130615234375 0.4047937500000001 +0.063375 0.144561767578125 0.4047937500000001 +0.0635 0.1585693359375 0.4047937500000001 +0.063625 0.17083740234375 0.4047937500000001 +0.06375 0.1802978515625 0.4047937500000001 +0.063875 0.18890380859375 0.4047937500000001 +0.064 0.24420166015625 0.507190625 +0.064125 0.25 0.507190625 +0.06425000000000001 0.2530517578125 0.507190625 +0.064375 0.25341796875 0.507190625 +0.0645 0.251220703125 0.507190625 +0.064625 0.246856689453125 0.507190625 +0.06475 0.23944091796875 0.507190625 +0.06487500000000001 0.22943115234375 0.507190625 +0.065 0.218231201171875 0.507190625 +0.065125 0.20355224609375 0.507190625 +0.06525 0.18841552734375 0.507190625 +0.06537500000000001 0.169647216796875 0.507190625 +0.06550000000000001 0.149017333984375 0.507190625 +0.065625 0.129058837890625 0.507190625 +0.06574999999999999 0.10552978515625 0.507190625 +0.065875 0.0833740234375 0.507190625 +0.06600000000000001 0.057891845703125 0.507190625 +0.066125 0.031768798828125 0.507190625 +0.06625000000000001 0.0079345703125 0.507190625 +0.06637500000000001 -0.0185546875 0.507190625 +0.0665 -0.042266845703125 0.507190625 +0.066625 -0.06817626953125 0.507190625 +0.06675 -0.09332275390625 0.507190625 +0.06687500000000001 -0.1151123046875 0.507190625 +0.067 -0.138092041015625 0.507190625 +0.067125 -0.157501220703125 0.507190625 +0.06725000000000001 -0.177398681640625 0.507190625 +0.06737500000000001 -0.19537353515625 0.507190625 +0.0675 -0.209716796875 0.507190625 +0.067625 -0.22344970703125 0.507190625 +0.06775 -0.233734130859375 0.507190625 +0.06787500000000001 -0.24273681640625 0.507190625 +0.06800000000000001 -0.249053955078125 0.507190625 +0.068125 -0.25244140625 0.507190625 +0.06825000000000001 -0.2535400390625 0.507190625 +0.068375 -0.252166748046875 0.507190625 +0.06850000000000001 -0.248016357421875 0.507190625 +0.06862500000000001 -0.24114990234375 0.507190625 +0.06875 -0.232696533203125 0.507190625 +0.06887500000000001 -0.220916748046875 0.507190625 +0.069 -0.20819091796875 0.507190625 +0.06912500000000001 -0.191925048828125 0.507190625 +0.06925000000000001 -0.173553466796875 0.507190625 +0.06937500000000001 -0.1553955078125 0.507190625 +0.06950000000000001 -0.13360595703125 0.507190625 +0.069625 -0.11273193359375 0.507190625 +0.06975 -0.08837890625 0.507190625 +0.06987500000000001 -0.06304931640625 0.507190625 +0.07000000000000001 -0.039642333984375 0.507190625 +0.070125 -0.01324462890625 0.507190625 +0.07025000000000001 0.010589599609375 0.507190625 +0.07037500000000001 0.037017822265625 0.507190625 +0.07050000000000001 0.06304931640625 0.507190625 +0.070625 0.08587646484375 0.507190625 +0.07075 0.1103515625 0.507190625 +0.07087500000000001 0.13134765625 0.507190625 +0.07100000000000001 0.153289794921875 0.507190625 +0.07112500000000001 0.173553466796875 0.507190625 +0.07125000000000002 0.190185546875 0.507190625 +0.07137500000000001 0.206695556640625 0.507190625 +0.0715 0.2196044921875 0.507190625 +0.07162500000000001 0.23162841796875 0.507190625 +0.07175000000000001 0.24114990234375 0.507190625 +0.07187500000000001 0.2474365234375 0.507190625 +0.07200000000000001 0.251861572265625 0.507190625 +0.07212499999999999 0.253509521484375 0.507190625 +0.07225 0.252685546875 0.507190625 +0.07237499999999999 0.249053955078125 0.507190625 +0.0725 0.243499755859375 0.507190625 +0.07262499999999999 0.234771728515625 0.507190625 +0.07274999999999999 0.224700927734375 0.507190625 +0.072875 0.211181640625 0.507190625 +0.073 0.19537353515625 0.507190625 +0.073125 0.179290771484375 0.507190625 +0.07324999999999999 0.1595458984375 0.507190625 +0.07337499999999999 0.14031982421875 0.507190625 +0.0735 0.117462158203125 0.507190625 +0.073625 0.09332275390625 0.507190625 +0.07374999999999999 0.07073974609375 0.507190625 +0.073875 0.044891357421875 0.507190625 +0.074 0.021209716796875 0.507190625 +0.074125 -0.005279541015625 0.507190625 +0.07424999999999999 -0.031768798828125 0.507190625 +0.07437499999999999 -0.0552978515625 0.507190625 +0.0745 -0.08087158203125 0.507190625 +0.07462499999999999 -0.103118896484375 0.507190625 +0.07475 -0.12677001953125 0.507190625 +0.07487500000000001 -0.149017333984375 0.507190625 +0.075 -0.16766357421875 0.507190625 +0.07512499999999999 -0.1866455078125 0.507190625 +0.07524999999999999 -0.20196533203125 0.507190625 +0.075375 -0.216888427734375 0.507190625 +0.0755 -0.22943115234375 0.507190625 +0.075625 -0.238555908203125 0.507190625 +0.07574999999999999 -0.246246337890625 0.507190625 +0.075875 -0.250823974609375 0.507190625 +0.076 -0.253326416015625 0.507190625 +0.076125 -0.2530517578125 0.507190625 +0.07625 -0.25042724609375 0.507190625 +0.07637499999999999 -0.244903564453125 0.507190625 +0.0765 -0.237640380859375 0.507190625 +0.076625 -0.22711181640625 0.507190625 +0.07675 -0.214080810546875 0.507190625 +0.076875 -0.200347900390625 0.507190625 +0.077 -0.183013916015625 0.507190625 +0.077125 -0.165679931640625 0.507190625 +0.07725 -0.14471435546875 0.507190625 +0.07737499999999999 -0.12213134765625 0.507190625 +0.0775 -0.100677490234375 0.507190625 +0.077625 -0.0758056640625 0.507190625 +0.07774999999999999 -0.052703857421875 0.507190625 +0.07787500000000001 -0.0264892578125 0.507190625 +0.07800000000000001 0.0 0.507190625 +0.078125 0.023834228515625 0.507190625 +0.07824999999999999 0.05010986328125 0.507190625 +0.07837499999999999 0.073272705078125 0.507190625 +0.07850000000000001 0.098236083984375 0.507190625 +0.078625 0.12213134765625 0.507190625 +0.07875 0.14251708984375 0.507190625 +0.07887500000000001 0.163665771484375 0.507190625 +0.079 0.18115234375 0.507190625 +0.079125 0.198699951171875 0.507190625 +0.07925 0.214080810546875 0.507190625 +0.079375 0.225921630859375 0.507190625 +0.0795 0.236724853515625 0.507190625 +0.079625 0.24420166015625 0.507190625 +0.07975 0.25 0.507190625 +0.07987500000000001 0.2530517578125 0.507190625 +0.08 0.25341796875 0.507190625 +0.08012499999999999 0.251220703125 0.507190625 +0.08025 0.246856689453125 0.507190625 +0.080375 0.23944091796875 0.507190625 +0.08050000000000001 0.22943115234375 0.507190625 +0.080625 0.218231201171875 0.507190625 +0.08074999999999999 0.20355224609375 0.507190625 +0.080875 0.18841552734375 0.507190625 +0.08100000000000001 0.169647216796875 0.507190625 +0.08112500000000001 0.149017333984375 0.507190625 +0.08125 0.129058837890625 0.507190625 +0.08137499999999999 0.10552978515625 0.507190625 +0.0815 0.0833740234375 0.507190625 +0.081625 0.057891845703125 0.507190625 +0.08175000000000001 0.031768798828125 0.507190625 +0.081875 0.0079345703125 0.507190625 +0.08200000000000001 -0.0185546875 0.507190625 +0.082125 -0.042266845703125 0.507190625 +0.08225 -0.06817626953125 0.507190625 +0.08237500000000001 -0.09332275390625 0.507190625 +0.0825 -0.1151123046875 0.507190625 +0.08262500000000001 -0.138092041015625 0.507190625 +0.08275 -0.157501220703125 0.507190625 +0.08287500000000001 -0.177398681640625 0.507190625 +0.08300000000000001 -0.19537353515625 0.507190625 +0.083125 -0.209716796875 0.507190625 +0.08324999999999999 -0.22344970703125 0.507190625 +0.083375 -0.233734130859375 0.507190625 +0.08350000000000001 -0.24273681640625 0.507190625 +0.08362500000000001 -0.249053955078125 0.507190625 +0.08375 -0.25244140625 0.507190625 +0.08387500000000001 -0.2535400390625 0.507190625 +0.084 -0.252166748046875 0.507190625 +0.08412500000000001 -0.248016357421875 0.507190625 +0.08425000000000001 -0.24114990234375 0.507190625 +0.084375 -0.232696533203125 0.507190625 +0.08450000000000001 -0.220916748046875 0.507190625 +0.084625 -0.20819091796875 0.507190625 +0.08475 -0.191925048828125 0.507190625 +0.08487500000000001 -0.173553466796875 0.507190625 +0.085 -0.1553955078125 0.507190625 +0.08512500000000001 -0.13360595703125 0.507190625 +0.08525 -0.11273193359375 0.507190625 +0.085375 -0.08837890625 0.507190625 +0.08550000000000001 -0.06304931640625 0.507190625 +0.085625 -0.039642333984375 0.507190625 +0.08575000000000001 -0.01324462890625 0.507190625 +0.08587500000000002 0.010589599609375 0.507190625 +0.08600000000000001 0.037017822265625 0.507190625 +0.08612500000000001 0.06304931640625 0.507190625 +0.08625 0.08587646484375 0.507190625 +0.08637499999999999 0.1103515625 0.507190625 +0.0865 0.13134765625 0.507190625 +0.08662500000000001 0.153289794921875 0.507190625 +0.08675000000000001 0.173553466796875 0.507190625 +0.08687500000000002 0.190185546875 0.507190625 +0.08700000000000001 0.206695556640625 0.507190625 +0.087125 0.2196044921875 0.507190625 +0.08725000000000001 0.23162841796875 0.507190625 +0.08737500000000001 0.24114990234375 0.507190625 +0.08750000000000002 0.2474365234375 0.507190625 +0.08762500000000001 0.251861572265625 0.507190625 +0.08775 0.253509521484375 0.507190625 +0.08787500000000001 0.252685546875 0.507190625 +0.08799999999999999 0.249053955078125 0.507190625 +0.088125 0.243499755859375 0.507190625 +0.08824999999999999 0.234771728515625 0.507190625 +0.08837499999999999 0.224700927734375 0.507190625 +0.0885 0.211181640625 0.507190625 +0.08862500000000001 0.19537353515625 0.507190625 +0.08875 0.179290771484375 0.507190625 +0.08887499999999999 0.1595458984375 0.507190625 +0.08899999999999999 0.14031982421875 0.507190625 +0.089125 0.117462158203125 0.507190625 +0.08924999999999999 0.09332275390625 0.507190625 +0.089375 0.07073974609375 0.507190625 +0.08949999999999999 0.044891357421875 0.507190625 +0.089625 0.021209716796875 0.507190625 +0.08975 -0.005279541015625 0.507190625 +0.08987499999999999 -0.031768798828125 0.507190625 +0.09 -0.0552978515625 0.507190625 +0.09012499999999999 -0.08087158203125 0.507190625 +0.09025 -0.103118896484375 0.507190625 +0.090375 -0.12677001953125 0.507190625 +0.09050000000000001 -0.149017333984375 0.507190625 +0.090625 -0.16766357421875 0.507190625 +0.09074999999999999 -0.1866455078125 0.507190625 +0.09087499999999999 -0.20196533203125 0.507190625 +0.091 -0.216888427734375 0.507190625 +0.09112500000000001 -0.22943115234375 0.507190625 +0.09125 -0.238555908203125 0.507190625 +0.09137499999999999 -0.246246337890625 0.507190625 +0.0915 -0.250823974609375 0.507190625 +0.091625 -0.253326416015625 0.507190625 +0.09175000000000001 -0.2530517578125 0.507190625 +0.091875 -0.25042724609375 0.507190625 +0.09199999999999999 -0.244903564453125 0.507190625 +0.092125 -0.237640380859375 0.507190625 +0.09225 -0.22711181640625 0.507190625 +0.09237499999999999 -0.214080810546875 0.507190625 +0.0925 -0.200347900390625 0.507190625 +0.09262499999999999 -0.183013916015625 0.507190625 +0.09275 -0.165679931640625 0.507190625 +0.092875 -0.14471435546875 0.507190625 +0.09299999999999999 -0.12213134765625 0.507190625 +0.093125 -0.100677490234375 0.507190625 +0.09324999999999999 -0.0758056640625 0.507190625 +0.093375 -0.052703857421875 0.507190625 +0.09350000000000001 -0.0264892578125 0.507190625 +0.09362500000000001 0.0 0.507190625 +0.09375 0.023834228515625 0.507190625 +0.09387499999999999 0.05010986328125 0.507190625 +0.09399999999999999 0.073272705078125 0.507190625 +0.094125 0.098236083984375 0.507190625 +0.09425000000000001 0.12213134765625 0.507190625 +0.094375 0.14251708984375 0.507190625 +0.09450000000000001 0.163665771484375 0.507190625 +0.094625 0.18115234375 0.507190625 +0.09475 0.198699951171875 0.507190625 +0.09487500000000001 0.214080810546875 0.507190625 +0.095 0.225921630859375 0.507190625 +0.09512500000000001 0.236724853515625 0.507190625 +0.09525 0.24420166015625 0.507190625 +0.095375 0.25 0.507190625 +0.09550000000000001 0.2530517578125 0.507190625 +0.095625 0.25341796875 0.507190625 +0.09574999999999999 0.251220703125 0.507190625 +0.095875 0.246856689453125 0.507190625 +0.096 0.287811279296875 0.6095875 +0.09612500000000001 0.2757568359375 0.6095875 +0.09625 0.262298583984375 0.6095875 +0.09637499999999999 0.244659423828125 0.6095875 +0.0965 0.226470947265625 0.6095875 +0.09662500000000001 0.20391845703125 0.6095875 +0.09675000000000001 0.179107666015625 0.6095875 +0.096875 0.155120849609375 0.6095875 +0.09699999999999999 0.126861572265625 0.6095875 +0.097125 0.100189208984375 0.6095875 +0.09725 0.069580078125 0.6095875 +0.09737500000000001 0.038177490234375 0.6095875 +0.0975 0.009552001953125 0.6095875 +0.09762500000000001 -0.022308349609375 0.6095875 +0.09775 -0.050811767578125 0.6095875 +0.097875 -0.081939697265625 0.6095875 +0.09800000000000001 -0.1121826171875 0.6095875 +0.098125 -0.138336181640625 0.6095875 +0.09825000000000001 -0.165985107421875 0.6095875 +0.098375 -0.189300537109375 0.6095875 +0.09850000000000001 -0.213226318359375 0.6095875 +0.09862500000000001 -0.23480224609375 0.6095875 +0.09875 -0.252044677734375 0.6095875 +0.09887499999999999 -0.268585205078125 0.6095875 +0.099 -0.28094482421875 0.6095875 +0.09912500000000001 -0.291748046875 0.6095875 +0.09925000000000001 -0.299346923828125 0.6095875 +0.099375 -0.30340576171875 0.6095875 +0.09950000000000001 -0.30474853515625 0.6095875 +0.099625 -0.303070068359375 0.6095875 +0.09975000000000001 -0.298095703125 0.6095875 +0.09987500000000001 -0.289825439453125 0.6095875 +0.1 -0.279693603515625 0.6095875 +0.100125 -0.2655029296875 0.6095875 +0.10025 -0.250244140625 0.6095875 +0.100375 -0.230682373046875 0.6095875 +0.1005 -0.2086181640625 0.6095875 +0.100625 -0.186767578125 0.6095875 +0.10075 -0.16058349609375 0.6095875 +0.100875 -0.135498046875 0.6095875 +0.101 -0.106201171875 0.6095875 +0.101125 -0.075775146484375 0.6095875 +0.10125 -0.047637939453125 0.6095875 +0.101375 -0.01593017578125 0.6095875 +0.1015 0.01275634765625 0.6095875 +0.101625 0.04449462890625 0.6095875 +0.10175 0.075775146484375 0.6095875 +0.101875 0.10321044921875 0.6095875 +0.102 0.13262939453125 0.6095875 +0.102125 0.157867431640625 0.6095875 +0.10225 0.184234619140625 0.6095875 +0.102375 0.2086181640625 0.6095875 +0.1025 0.22857666015625 0.6095875 +0.102625 0.2484130859375 0.6095875 +0.10275 0.263916015625 0.6095875 +0.102875 0.278411865234375 0.6095875 +0.103 0.289825439453125 0.6095875 +0.103125 0.297393798828125 0.6095875 +0.10325 0.302734375 0.6095875 +0.103375 0.3046875 0.6095875 +0.1035 0.303680419921875 0.6095875 +0.103625 0.299346923828125 0.6095875 +0.10375 0.292633056640625 0.6095875 +0.103875 0.28216552734375 0.6095875 +0.104 0.27008056640625 0.6095875 +0.104125 0.25384521484375 0.6095875 +0.10425 0.23480224609375 0.6095875 +0.104375 0.215484619140625 0.6095875 +0.1045 0.1917724609375 0.6095875 +0.104625 0.16864013671875 0.6095875 +0.10475 0.14117431640625 0.6095875 +0.104875 0.1121826171875 0.6095875 +0.105 0.084991455078125 0.6095875 +0.105125 0.053955078125 0.6095875 +0.10525 0.025482177734375 0.6095875 +0.105375 -0.006378173828125 0.6095875 +0.1055 -0.038177490234375 0.6095875 +0.105625 -0.06646728515625 0.6095875 +0.10575 -0.097198486328125 0.6095875 +0.105875 -0.123931884765625 0.6095875 +0.106 -0.152374267578125 0.6095875 +0.106125 -0.179107666015625 0.6095875 +0.10625 -0.2015380859375 0.6095875 +0.106375 -0.22430419921875 0.6095875 +0.1065 -0.24273681640625 0.6095875 +0.106625 -0.26068115234375 0.6095875 +0.10675 -0.2757568359375 0.6095875 +0.106875 -0.2867431640625 0.6095875 +0.107 -0.29595947265625 0.6095875 +0.107125 -0.301483154296875 0.6095875 +0.10725 -0.304473876953125 0.6095875 +0.107375 -0.30413818359375 0.6095875 +0.1075 -0.300994873046875 0.6095875 +0.107625 -0.29437255859375 0.6095875 +0.10775 -0.28564453125 0.6095875 +0.107875 -0.27294921875 0.6095875 +0.108 -0.25732421875 0.6095875 +0.108125 -0.240814208984375 0.6095875 +0.10825 -0.219940185546875 0.6095875 +0.108375 -0.199127197265625 0.6095875 +0.1085 -0.173919677734375 0.6095875 +0.108625 -0.14678955078125 0.6095875 +0.10875 -0.12103271484375 0.6095875 +0.108875 -0.09112548828125 0.6095875 +0.109 -0.0633544921875 0.6095875 +0.109125 -0.031829833984375 0.6095875 +0.10925 0.0 0.6095875 +0.109375 0.028656005859375 0.6095875 +0.1095 0.060211181640625 0.6095875 +0.109625 0.08807373046875 0.6095875 +0.10975 0.118072509765625 0.6095875 +0.109875 0.14678955078125 0.6095875 +0.11 0.171295166015625 0.6095875 +0.110125 0.196685791015625 0.6095875 +0.11025 0.217742919921875 0.6095875 +0.110375 0.23883056640625 0.6095875 +0.1105 0.25732421875 0.6095875 +0.110625 0.27154541015625 0.6095875 +0.11075 0.284515380859375 0.6095875 +0.110875 0.29351806640625 0.6095875 +0.111 0.30047607421875 0.6095875 +0.111125 0.30413818359375 0.6095875 +0.11125 0.304595947265625 0.6095875 +0.111375 0.30194091796875 0.6095875 +0.1115 0.29669189453125 0.6095875 +0.111625 0.287811279296875 0.6095875 +0.11175 0.2757568359375 0.6095875 +0.111875 0.262298583984375 0.6095875 +0.112 0.244659423828125 0.6095875 +0.112125 0.226470947265625 0.6095875 +0.11225 0.20391845703125 0.6095875 +0.112375 0.179107666015625 0.6095875 +0.1125 0.155120849609375 0.6095875 +0.112625 0.126861572265625 0.6095875 +0.11275 0.100189208984375 0.6095875 +0.112875 0.069580078125 0.6095875 +0.113 0.038177490234375 0.6095875 +0.113125 0.009552001953125 0.6095875 +0.11325 -0.022308349609375 0.6095875 +0.113375 -0.050811767578125 0.6095875 +0.1135 -0.081939697265625 0.6095875 +0.113625 -0.1121826171875 0.6095875 +0.11375 -0.138336181640625 0.6095875 +0.113875 -0.165985107421875 0.6095875 +0.114 -0.189300537109375 0.6095875 +0.114125 -0.213226318359375 0.6095875 +0.11425 -0.23480224609375 0.6095875 +0.114375 -0.252044677734375 0.6095875 +0.1145 -0.268585205078125 0.6095875 +0.114625 -0.28094482421875 0.6095875 +0.11475 -0.291748046875 0.6095875 +0.114875 -0.299346923828125 0.6095875 +0.115 -0.30340576171875 0.6095875 +0.115125 -0.30474853515625 0.6095875 +0.11525 -0.303070068359375 0.6095875 +0.115375 -0.298095703125 0.6095875 +0.1155 -0.289825439453125 0.6095875 +0.115625 -0.279693603515625 0.6095875 +0.11575 -0.2655029296875 0.6095875 +0.115875 -0.250244140625 0.6095875 +0.116 -0.230682373046875 0.6095875 +0.116125 -0.2086181640625 0.6095875 +0.11625 -0.186767578125 0.6095875 +0.116375 -0.16058349609375 0.6095875 +0.1165 -0.135498046875 0.6095875 +0.116625 -0.106201171875 0.6095875 +0.11675 -0.075775146484375 0.6095875 +0.116875 -0.047637939453125 0.6095875 +0.117 -0.01593017578125 0.6095875 +0.117125 0.01275634765625 0.6095875 +0.11725 0.04449462890625 0.6095875 +0.117375 0.075775146484375 0.6095875 +0.1175 0.10321044921875 0.6095875 +0.117625 0.13262939453125 0.6095875 +0.11775 0.157867431640625 0.6095875 +0.117875 0.184234619140625 0.6095875 +0.118 0.2086181640625 0.6095875 +0.118125 0.22857666015625 0.6095875 +0.11825 0.2484130859375 0.6095875 +0.118375 0.263916015625 0.6095875 +0.1185 0.278411865234375 0.6095875 +0.118625 0.289825439453125 0.6095875 +0.11875 0.297393798828125 0.6095875 +0.118875 0.302734375 0.6095875 +0.119 0.3046875 0.6095875 +0.119125 0.303680419921875 0.6095875 +0.11925 0.299346923828125 0.6095875 +0.119375 0.292633056640625 0.6095875 +0.1195 0.28216552734375 0.6095875 +0.119625 0.27008056640625 0.6095875 +0.11975 0.25384521484375 0.6095875 +0.119875 0.23480224609375 0.6095875 +0.12 0.215484619140625 0.6095875 +0.120125 0.1917724609375 0.6095875 +0.12025 0.16864013671875 0.6095875 +0.120375 0.14117431640625 0.6095875 +0.1205 0.1121826171875 0.6095875 +0.120625 0.084991455078125 0.6095875 +0.12075 0.053955078125 0.6095875 +0.120875 0.025482177734375 0.6095875 +0.121 -0.006378173828125 0.6095875 +0.121125 -0.038177490234375 0.6095875 +0.12125 -0.06646728515625 0.6095875 +0.121375 -0.097198486328125 0.6095875 +0.1215 -0.123931884765625 0.6095875 +0.121625 -0.152374267578125 0.6095875 +0.12175 -0.179107666015625 0.6095875 +0.121875 -0.2015380859375 0.6095875 +0.122 -0.22430419921875 0.6095875 +0.122125 -0.24273681640625 0.6095875 +0.12225 -0.26068115234375 0.6095875 +0.122375 -0.2757568359375 0.6095875 +0.1225 -0.2867431640625 0.6095875 +0.122625 -0.29595947265625 0.6095875 +0.12275 -0.301483154296875 0.6095875 +0.122875 -0.304473876953125 0.6095875 +0.123 -0.30413818359375 0.6095875 +0.123125 -0.300994873046875 0.6095875 +0.12325 -0.29437255859375 0.6095875 +0.123375 -0.28564453125 0.6095875 +0.1235 -0.27294921875 0.6095875 +0.123625 -0.25732421875 0.6095875 +0.12375 -0.240814208984375 0.6095875 +0.123875 -0.219940185546875 0.6095875 +0.124 -0.199127197265625 0.6095875 +0.124125 -0.173919677734375 0.6095875 +0.12425 -0.14678955078125 0.6095875 +0.124375 -0.12103271484375 0.6095875 +0.1245 -0.09112548828125 0.6095875 +0.124625 -0.0633544921875 0.6095875 +0.12475 -0.031829833984375 0.6095875 +0.124875 0.0 0.6095875 +0.125 0.028656005859375 0.6095875 +0.125125 0.060211181640625 0.6095875 +0.12525 0.08807373046875 0.6095875 +0.125375 0.118072509765625 0.6095875 +0.1255 0.14678955078125 0.6095875 +0.125625 0.171295166015625 0.6095875 +0.12575 0.196685791015625 0.6095875 +0.125875 0.217742919921875 0.6095875 +0.126 0.23883056640625 0.6095875 +0.126125 0.25732421875 0.6095875 +0.12625 0.27154541015625 0.6095875 +0.126375 0.284515380859375 0.6095875 +0.1265 0.29351806640625 0.6095875 +0.126625 0.30047607421875 0.6095875 +0.12675 0.30413818359375 0.6095875 +0.126875 0.304595947265625 0.6095875 +0.127 0.30194091796875 0.6095875 +0.127125 0.29669189453125 0.6095875 +0.12725 0.287811279296875 0.6095875 +0.127375 0.2757568359375 0.6095875 +0.1275 0.262298583984375 0.6095875 +0.127625 0.244659423828125 0.6095875 +0.12775 0.226470947265625 0.6095875 +0.127875 0.20391845703125 0.6095875 +0.128 0.209197998046875 0.7119843750000001 +0.128125 0.181182861328125 0.7119843750000001 +0.12825 0.148162841796875 0.7119843750000001 +0.128375 0.117034912109375 0.7119843750000001 +0.1285 0.081268310546875 0.7119843750000001 +0.128625 0.044586181640625 0.7119843750000001 +0.12875 0.01116943359375 0.7119843750000001 +0.128875 -0.026031494140625 0.7119843750000001 +0.129 -0.059356689453125 0.7119843750000001 +0.129125 -0.095703125 0.7119843750000001 +0.12925 -0.131011962890625 0.7119843750000001 +0.129375 -0.161590576171875 0.7119843750000001 +0.1295 -0.19384765625 0.7119843750000001 +0.129625 -0.221099853515625 0.7119843750000001 +0.12975 -0.2490234375 0.7119843750000001 +0.129875 -0.274261474609375 0.7119843750000001 +0.13 -0.29437255859375 0.7119843750000001 +0.130125 -0.313690185546875 0.7119843750000001 +0.13025 -0.328125 0.7119843750000001 +0.130375 -0.34075927734375 0.7119843750000001 +0.1305 -0.349639892578125 0.7119843750000001 +0.130625 -0.3543701171875 0.7119843750000001 +0.13075 -0.355926513671875 0.7119843750000001 +0.130875 -0.35400390625 0.7119843750000001 +0.131 -0.34814453125 0.7119843750000001 +0.131125 -0.338531494140625 0.7119843750000001 +0.13125 -0.32666015625 0.7119843750000001 +0.131375 -0.310089111328125 0.7119843750000001 +0.1315 -0.292266845703125 0.7119843750000001 +0.131625 -0.269439697265625 0.7119843750000001 +0.13175 -0.24365234375 0.7119843750000001 +0.131875 -0.2181396484375 0.7119843750000001 +0.132 -0.18756103515625 0.7119843750000001 +0.132125 -0.15826416015625 0.7119843750000001 +0.13225 -0.124053955078125 0.7119843750000001 +0.132375 -0.0885009765625 0.7119843750000001 +0.1325 -0.0556640625 0.7119843750000001 +0.132625 -0.01861572265625 0.7119843750000001 +0.13275 0.014892578125 0.7119843750000001 +0.132875 0.051971435546875 0.7119843750000001 +0.133 0.0885009765625 0.7119843750000001 +0.133125 0.12054443359375 0.7119843750000001 +0.13325 0.1549072265625 0.7119843750000001 +0.133375 0.18438720703125 0.7119843750000001 +0.1335 0.215179443359375 0.7119843750000001 +0.133625 0.24365234375 0.7119843750000001 +0.13375 0.266998291015625 0.7119843750000001 +0.133875 0.290130615234375 0.7119843750000001 +0.134 0.308258056640625 0.7119843750000001 +0.134125 0.325164794921875 0.7119843750000001 +0.13425 0.338531494140625 0.7119843750000001 +0.134375 0.34735107421875 0.7119843750000001 +0.1345 0.35357666015625 0.7119843750000001 +0.134625 0.355865478515625 0.7119843750000001 +0.13475 0.354705810546875 0.7119843750000001 +0.134875 0.349639892578125 0.7119843750000001 +0.135 0.341796875 0.7119843750000001 +0.135125 0.329559326171875 0.7119843750000001 +0.13525 0.3154296875 0.7119843750000001 +0.135375 0.296478271484375 0.7119843750000001 +0.1355 0.274261474609375 0.7119843750000001 +0.135625 0.251678466796875 0.7119843750000001 +0.13575 0.2239990234375 0.7119843750000001 +0.135875 0.19696044921875 0.7119843750000001 +0.136 0.164886474609375 0.7119843750000001 +0.136125 0.131011962890625 0.7119843750000001 +0.13625 0.099273681640625 0.7119843750000001 +0.136375 0.063018798828125 0.7119843750000001 +0.1365 0.029754638671875 0.7119843750000001 +0.136625 -0.0074462890625 0.7119843750000001 +0.13675 -0.044586181640625 0.7119843750000001 +0.136875 -0.07763671875 0.7119843750000001 +0.137 -0.113525390625 0.7119843750000001 +0.137125 -0.144775390625 0.7119843750000001 +0.13725 -0.177947998046875 0.7119843750000001 +0.137375 -0.209197998046875 0.7119843750000001 +0.1375 -0.235382080078125 0.7119843750000001 +0.137625 -0.261993408203125 0.7119843750000001 +0.13775 -0.28350830078125 0.7119843750000001 +0.137875 -0.304443359375 0.7119843750000001 +0.138 -0.322052001953125 0.7119843750000001 +0.138125 -0.33489990234375 0.7119843750000001 +0.13825 -0.345672607421875 0.7119843750000001 +0.138375 -0.35211181640625 0.7119843750000001 +0.1385 -0.355621337890625 0.7119843750000001 +0.138625 -0.355255126953125 0.7119843750000001 +0.13875 -0.3515625 0.7119843750000001 +0.138875 -0.34381103515625 0.7119843750000001 +0.139 -0.3336181640625 0.7119843750000001 +0.139125 -0.318817138671875 0.7119843750000001 +0.13925 -0.300537109375 0.7119843750000001 +0.139375 -0.28125 0.7119843750000001 +0.1395 -0.25689697265625 0.7119843750000001 +0.139625 -0.232574462890625 0.7119843750000001 +0.13975 -0.203125 0.7119843750000001 +0.139875 -0.171478271484375 0.7119843750000001 +0.14 -0.141357421875 0.7119843750000001 +0.140125 -0.106414794921875 0.7119843750000001 +0.14025 -0.073974609375 0.7119843750000001 +0.140375 -0.037200927734375 0.7119843750000001 +0.1405 0.0 0.7119843750000001 +0.140625 0.033477783203125 0.7119843750000001 +0.14075 0.070343017578125 0.7119843750000001 +0.140875 0.102874755859375 0.7119843750000001 +0.141 0.137908935546875 0.7119843750000001 +0.141125 0.171478271484375 0.7119843750000001 +0.14125 0.200042724609375 0.7119843750000001 +0.141375 0.229736328125 0.7119843750000001 +0.1415 0.254302978515625 0.7119843750000001 +0.141625 0.278961181640625 0.7119843750000001 +0.14175 0.300537109375 0.7119843750000001 +0.141875 0.317138671875 0.7119843750000001 +0.142 0.332305908203125 0.7119843750000001 +0.142125 0.34283447265625 0.7119843750000001 +0.14225 0.3509521484375 0.7119843750000001 +0.142375 0.355255126953125 0.7119843750000001 +0.1425 0.35577392578125 0.7119843750000001 +0.142625 0.352630615234375 0.7119843750000001 +0.14275 0.346527099609375 0.7119843750000001 +0.142875 0.336151123046875 0.7119843750000001 +0.143 0.322052001953125 0.7119843750000001 +0.143125 0.306365966796875 0.7119843750000001 +0.14325 0.285736083984375 0.7119843750000001 +0.143375 0.264495849609375 0.7119843750000001 +0.1435 0.2381591796875 0.7119843750000001 +0.143625 0.209197998046875 0.7119843750000001 +0.14375 0.181182861328125 0.7119843750000001 +0.143875 0.148162841796875 0.7119843750000001 +0.144 0.117034912109375 0.7119843750000001 +0.144125 0.081268310546875 0.7119843750000001 +0.14425 0.044586181640625 0.7119843750000001 +0.144375 0.01116943359375 0.7119843750000001 +0.1445 -0.026031494140625 0.7119843750000001 +0.144625 -0.059356689453125 0.7119843750000001 +0.14475 -0.095703125 0.7119843750000001 +0.144875 -0.131011962890625 0.7119843750000001 +0.145 -0.161590576171875 0.7119843750000001 +0.145125 -0.19384765625 0.7119843750000001 +0.14525 -0.221099853515625 0.7119843750000001 +0.145375 -0.2490234375 0.7119843750000001 +0.1455 -0.274261474609375 0.7119843750000001 +0.145625 -0.29437255859375 0.7119843750000001 +0.14575 -0.313690185546875 0.7119843750000001 +0.145875 -0.328125 0.7119843750000001 +0.146 -0.34075927734375 0.7119843750000001 +0.146125 -0.349639892578125 0.7119843750000001 +0.14625 -0.3543701171875 0.7119843750000001 +0.146375 -0.355926513671875 0.7119843750000001 +0.1465 -0.35400390625 0.7119843750000001 +0.146625 -0.34814453125 0.7119843750000001 +0.14675 -0.338531494140625 0.7119843750000001 +0.146875 -0.32666015625 0.7119843750000001 +0.147 -0.310089111328125 0.7119843750000001 +0.147125 -0.292266845703125 0.7119843750000001 +0.14725 -0.269439697265625 0.7119843750000001 +0.147375 -0.24365234375 0.7119843750000001 +0.1475 -0.2181396484375 0.7119843750000001 +0.147625 -0.18756103515625 0.7119843750000001 +0.14775 -0.15826416015625 0.7119843750000001 +0.147875 -0.124053955078125 0.7119843750000001 +0.148 -0.0885009765625 0.7119843750000001 +0.148125 -0.0556640625 0.7119843750000001 +0.14825 -0.01861572265625 0.7119843750000001 +0.148375 0.014892578125 0.7119843750000001 +0.1485 0.051971435546875 0.7119843750000001 +0.148625 0.0885009765625 0.7119843750000001 +0.14875 0.12054443359375 0.7119843750000001 +0.148875 0.1549072265625 0.7119843750000001 +0.149 0.18438720703125 0.7119843750000001 +0.149125 0.215179443359375 0.7119843750000001 +0.14925 0.24365234375 0.7119843750000001 +0.149375 0.266998291015625 0.7119843750000001 +0.1495 0.290130615234375 0.7119843750000001 +0.149625 0.308258056640625 0.7119843750000001 +0.14975 0.325164794921875 0.7119843750000001 +0.149875 0.338531494140625 0.7119843750000001 +0.15 0.34735107421875 0.7119843750000001 +0.150125 0.35357666015625 0.7119843750000001 +0.15025 0.355865478515625 0.7119843750000001 +0.150375 0.354705810546875 0.7119843750000001 +0.1505 0.349639892578125 0.7119843750000001 +0.150625 0.341796875 0.7119843750000001 +0.15075 0.329559326171875 0.7119843750000001 +0.150875 0.3154296875 0.7119843750000001 +0.151 0.296478271484375 0.7119843750000001 +0.151125 0.274261474609375 0.7119843750000001 +0.15125 0.251678466796875 0.7119843750000001 +0.151375 0.2239990234375 0.7119843750000001 +0.1515 0.19696044921875 0.7119843750000001 +0.151625 0.164886474609375 0.7119843750000001 +0.15175 0.131011962890625 0.7119843750000001 +0.151875 0.099273681640625 0.7119843750000001 +0.152 0.063018798828125 0.7119843750000001 +0.152125 0.029754638671875 0.7119843750000001 +0.15225 -0.0074462890625 0.7119843750000001 +0.152375 -0.044586181640625 0.7119843750000001 +0.1525 -0.07763671875 0.7119843750000001 +0.152625 -0.113525390625 0.7119843750000001 +0.15275 -0.144775390625 0.7119843750000001 +0.152875 -0.177947998046875 0.7119843750000001 +0.153 -0.209197998046875 0.7119843750000001 +0.153125 -0.235382080078125 0.7119843750000001 +0.15325 -0.261993408203125 0.7119843750000001 +0.153375 -0.28350830078125 0.7119843750000001 +0.1535 -0.304443359375 0.7119843750000001 +0.153625 -0.322052001953125 0.7119843750000001 +0.15375 -0.33489990234375 0.7119843750000001 +0.153875 -0.345672607421875 0.7119843750000001 +0.154 -0.35211181640625 0.7119843750000001 +0.154125 -0.355621337890625 0.7119843750000001 +0.15425 -0.355255126953125 0.7119843750000001 +0.154375 -0.3515625 0.7119843750000001 +0.1545 -0.34381103515625 0.7119843750000001 +0.154625 -0.3336181640625 0.7119843750000001 +0.15475 -0.318817138671875 0.7119843750000001 +0.154875 -0.300537109375 0.7119843750000001 +0.155 -0.28125 0.7119843750000001 +0.155125 -0.25689697265625 0.7119843750000001 +0.15525 -0.232574462890625 0.7119843750000001 +0.155375 -0.203125 0.7119843750000001 +0.1555 -0.171478271484375 0.7119843750000001 +0.155625 -0.141357421875 0.7119843750000001 +0.15575 -0.106414794921875 0.7119843750000001 +0.155875 -0.073974609375 0.7119843750000001 +0.156 -0.037200927734375 0.7119843750000001 +0.156125 0.0 0.7119843750000001 +0.15625 0.033477783203125 0.7119843750000001 +0.156375 0.070343017578125 0.7119843750000001 +0.1565 0.102874755859375 0.7119843750000001 +0.156625 0.137908935546875 0.7119843750000001 +0.15675 0.171478271484375 0.7119843750000001 +0.156875 0.200042724609375 0.7119843750000001 +0.157 0.229736328125 0.7119843750000001 +0.157125 0.254302978515625 0.7119843750000001 +0.15725 0.278961181640625 0.7119843750000001 +0.157375 0.300537109375 0.7119843750000001 +0.1575 0.317138671875 0.7119843750000001 +0.157625 0.332305908203125 0.7119843750000001 +0.15775 0.34283447265625 0.7119843750000001 +0.157875 0.3509521484375 0.7119843750000001 +0.158 0.355255126953125 0.7119843750000001 +0.158125 0.35577392578125 0.7119843750000001 +0.15825 0.352630615234375 0.7119843750000001 +0.158375 0.346527099609375 0.7119843750000001 +0.1585 0.336151123046875 0.7119843750000001 +0.158625 0.322052001953125 0.7119843750000001 +0.15875 0.306365966796875 0.7119843750000001 +0.158875 0.285736083984375 0.7119843750000001 +0.159 0.264495849609375 0.7119843750000001 +0.159125 0.2381591796875 0.7119843750000001 +0.15925 0.209197998046875 0.7119843750000001 +0.159375 0.181182861328125 0.7119843750000001 +0.1595 0.148162841796875 0.7119843750000001 +0.159625 0.117034912109375 0.7119843750000001 +0.15975 0.081268310546875 0.7119843750000001 +0.159875 0.044586181640625 0.7119843750000001 +0.16 0.01275634765625 0.8143812500000001 +0.160125 -0.02978515625 0.8143812500000001 +0.16025 -0.06787109375 0.8143812500000001 +0.160375 -0.109466552734375 0.8143812500000001 +0.1605 -0.149871826171875 0.8143812500000001 +0.160625 -0.184814453125 0.8143812500000001 +0.16075 -0.22174072265625 0.8143812500000001 +0.160875 -0.252899169921875 0.8143812500000001 +0.161 -0.28485107421875 0.8143812500000001 +0.161125 -0.313720703125 0.8143812500000001 +0.16125 -0.33673095703125 0.8143812500000001 +0.161375 -0.35882568359375 0.8143812500000001 +0.1615 -0.375335693359375 0.8143812500000001 +0.161625 -0.3897705078125 0.8143812500000001 +0.16175 -0.399932861328125 0.8143812500000001 +0.161875 -0.40533447265625 0.8143812500000001 +0.162 -0.407135009765625 0.8143812500000001 +0.162125 -0.4049072265625 0.8143812500000001 +0.16225 -0.39825439453125 0.8143812500000001 +0.162375 -0.38720703125 0.8143812500000001 +0.1625 -0.3736572265625 0.8143812500000001 +0.162625 -0.354705810546875 0.8143812500000001 +0.16275 -0.334320068359375 0.8143812500000001 +0.162875 -0.308197021484375 0.8143812500000001 +0.163 -0.278717041015625 0.8143812500000001 +0.163125 -0.249542236328125 0.8143812500000001 +0.16325 -0.21453857421875 0.8143812500000001 +0.163375 -0.1810302734375 0.8143812500000001 +0.1635 -0.14190673828125 0.8143812500000001 +0.163625 -0.101226806640625 0.8143812500000001 +0.16375 -0.06365966796875 0.8143812500000001 +0.163875 -0.021270751953125 0.8143812500000001 +0.164 0.01702880859375 0.8143812500000001 +0.164125 0.0594482421875 0.8143812500000001 +0.16425 0.101226806640625 0.8143812500000001 +0.164375 0.137908935546875 0.8143812500000001 +0.1645 0.17718505859375 0.8143812500000001 +0.164625 0.210906982421875 0.8143812500000001 +0.16475 0.24615478515625 0.8143812500000001 +0.164875 0.278717041015625 0.8143812500000001 +0.165 0.305389404296875 0.8143812500000001 +0.165125 0.331878662109375 0.8143812500000001 +0.16525 0.35260009765625 0.8143812500000001 +0.165375 0.3719482421875 0.8143812500000001 +0.1655 0.38720703125 0.8143812500000001 +0.165625 0.3973388671875 0.8143812500000001 +0.16575 0.404449462890625 0.8143812500000001 +0.165875 0.40704345703125 0.8143812500000001 +0.166 0.405731201171875 0.8143812500000001 +0.166125 0.399932861328125 0.8143812500000001 +0.16625 0.390960693359375 0.8143812500000001 +0.166375 0.376983642578125 0.8143812500000001 +0.1665 0.360809326171875 0.8143812500000001 +0.166625 0.339111328125 0.8143812500000001 +0.16675 0.313720703125 0.8143812500000001 +0.166875 0.287872314453125 0.8143812500000001 +0.167 0.2562255859375 0.8143812500000001 +0.167125 0.225311279296875 0.8143812500000001 +0.16725 0.188629150390625 0.8143812500000001 +0.167375 0.149871826171875 0.8143812500000001 +0.1675 0.11358642578125 0.8143812500000001 +0.167625 0.07208251953125 0.8143812500000001 +0.16775 0.0340576171875 0.8143812500000001 +0.167875 -0.008514404296875 0.8143812500000001 +0.168 -0.050994873046875 0.8143812500000001 +0.168125 -0.08880615234375 0.8143812500000001 +0.16825 -0.129852294921875 0.8143812500000001 +0.168375 -0.16558837890625 0.8143812500000001 +0.1685 -0.20355224609375 0.8143812500000001 +0.168625 -0.239288330078125 0.8143812500000001 +0.16875 -0.269256591796875 0.8143812500000001 +0.168875 -0.2996826171875 0.8143812500000001 +0.169 -0.324310302734375 0.8143812500000001 +0.169125 -0.3482666015625 0.8143812500000001 +0.16925 -0.368408203125 0.8143812500000001 +0.169375 -0.383056640625 0.8143812500000001 +0.1695 -0.3953857421875 0.8143812500000001 +0.169625 -0.40277099609375 0.8143812500000001 +0.16975 -0.40679931640625 0.8143812500000001 +0.169875 -0.406341552734375 0.8143812500000001 +0.17 -0.402130126953125 0.8143812500000001 +0.170125 -0.393280029296875 0.8143812500000001 +0.17025 -0.381591796875 0.8143812500000001 +0.170375 -0.36468505859375 0.8143812500000001 +0.1705 -0.343780517578125 0.8143812500000001 +0.170625 -0.32171630859375 0.8143812500000001 +0.17075 -0.293853759765625 0.8143812500000001 +0.170875 -0.266021728515625 0.8143812500000001 +0.171 -0.23236083984375 0.8143812500000001 +0.171125 -0.196136474609375 0.8143812500000001 +0.17125 -0.16168212890625 0.8143812500000001 +0.171375 -0.121734619140625 0.8143812500000001 +0.1715 -0.084625244140625 0.8143812500000001 +0.171625 -0.04254150390625 0.8143812500000001 +0.17175 0.0 0.8143812500000001 +0.171875 0.038299560546875 0.8143812500000001 +0.172 0.0804443359375 0.8143812500000001 +0.172125 0.11767578125 0.8143812500000001 +0.17225 0.157745361328125 0.8143812500000001 +0.172375 0.196136474609375 0.8143812500000001 +0.1725 0.228851318359375 0.8143812500000001 +0.172625 0.262786865234375 0.8143812500000001 +0.17275 0.2908935546875 0.8143812500000001 +0.172875 0.319061279296875 0.8143812500000001 +0.173 0.343780517578125 0.8143812500000001 +0.173125 0.362762451171875 0.8143812500000001 +0.17325 0.380096435546875 0.8143812500000001 +0.173375 0.39215087890625 0.8143812500000001 +0.1735 0.401458740234375 0.8143812500000001 +0.173625 0.406341552734375 0.8143812500000001 +0.17375 0.406951904296875 0.8143812500000001 +0.173875 0.40338134765625 0.8143812500000001 +0.174 0.396392822265625 0.8143812500000001 +0.174125 0.384490966796875 0.8143812500000001 +0.17425 0.368408203125 0.8143812500000001 +0.174375 0.350433349609375 0.8143812500000001 +0.1745 0.32684326171875 0.8143812500000001 +0.174625 0.30255126953125 0.8143812500000001 +0.17475 0.272430419921875 0.8143812500000001 +0.174875 0.239288330078125 0.8143812500000001 +0.175 0.207244873046875 0.8143812500000001 +0.175125 0.169464111328125 0.8143812500000001 +0.17525 0.133880615234375 0.8143812500000001 +0.175375 0.09295654296875 0.8143812500000001 +0.1755 0.050994873046875 0.8143812500000001 +0.175625 0.01275634765625 0.8143812500000001 +0.17575 -0.02978515625 0.8143812500000001 +0.175875 -0.06787109375 0.8143812500000001 +0.176 -0.109466552734375 0.8143812500000001 +0.176125 -0.149871826171875 0.8143812500000001 +0.17625 -0.184814453125 0.8143812500000001 +0.176375 -0.22174072265625 0.8143812500000001 +0.1765 -0.252899169921875 0.8143812500000001 +0.176625 -0.28485107421875 0.8143812500000001 +0.17675 -0.313720703125 0.8143812500000001 +0.176875 -0.33673095703125 0.8143812500000001 +0.177 -0.35882568359375 0.8143812500000001 +0.177125 -0.375335693359375 0.8143812500000001 +0.17725 -0.3897705078125 0.8143812500000001 +0.177375 -0.399932861328125 0.8143812500000001 +0.1775 -0.40533447265625 0.8143812500000001 +0.177625 -0.407135009765625 0.8143812500000001 +0.17775 -0.4049072265625 0.8143812500000001 +0.177875 -0.39825439453125 0.8143812500000001 +0.178 -0.38720703125 0.8143812500000001 +0.178125 -0.3736572265625 0.8143812500000001 +0.17825 -0.354705810546875 0.8143812500000001 +0.178375 -0.334320068359375 0.8143812500000001 +0.1785 -0.308197021484375 0.8143812500000001 +0.178625 -0.278717041015625 0.8143812500000001 +0.17875 -0.249542236328125 0.8143812500000001 +0.178875 -0.21453857421875 0.8143812500000001 +0.179 -0.1810302734375 0.8143812500000001 +0.179125 -0.14190673828125 0.8143812500000001 +0.17925 -0.101226806640625 0.8143812500000001 +0.179375 -0.06365966796875 0.8143812500000001 +0.1795 -0.021270751953125 0.8143812500000001 +0.179625 0.01702880859375 0.8143812500000001 +0.17975 0.0594482421875 0.8143812500000001 +0.179875 0.101226806640625 0.8143812500000001 +0.18 0.137908935546875 0.8143812500000001 +0.180125 0.17718505859375 0.8143812500000001 +0.18025 0.210906982421875 0.8143812500000001 +0.180375 0.24615478515625 0.8143812500000001 +0.1805 0.278717041015625 0.8143812500000001 +0.180625 0.305389404296875 0.8143812500000001 +0.18075 0.331878662109375 0.8143812500000001 +0.180875 0.35260009765625 0.8143812500000001 +0.181 0.3719482421875 0.8143812500000001 +0.181125 0.38720703125 0.8143812500000001 +0.18125 0.3973388671875 0.8143812500000001 +0.181375 0.404449462890625 0.8143812500000001 +0.1815 0.40704345703125 0.8143812500000001 +0.181625 0.405731201171875 0.8143812500000001 +0.18175 0.399932861328125 0.8143812500000001 +0.181875 0.390960693359375 0.8143812500000001 +0.182 0.376983642578125 0.8143812500000001 +0.182125 0.360809326171875 0.8143812500000001 +0.18225 0.339111328125 0.8143812500000001 +0.182375 0.313720703125 0.8143812500000001 +0.1825 0.287872314453125 0.8143812500000001 +0.182625 0.2562255859375 0.8143812500000001 +0.18275 0.225311279296875 0.8143812500000001 +0.182875 0.188629150390625 0.8143812500000001 +0.183 0.149871826171875 0.8143812500000001 +0.183125 0.11358642578125 0.8143812500000001 +0.18325 0.07208251953125 0.8143812500000001 +0.183375 0.0340576171875 0.8143812500000001 +0.1835 -0.008514404296875 0.8143812500000001 +0.183625 -0.050994873046875 0.8143812500000001 +0.18375 -0.08880615234375 0.8143812500000001 +0.183875 -0.129852294921875 0.8143812500000001 +0.184 -0.16558837890625 0.8143812500000001 +0.184125 -0.20355224609375 0.8143812500000001 +0.18425 -0.239288330078125 0.8143812500000001 +0.184375 -0.269256591796875 0.8143812500000001 +0.1845 -0.2996826171875 0.8143812500000001 +0.184625 -0.324310302734375 0.8143812500000001 +0.18475 -0.3482666015625 0.8143812500000001 +0.184875 -0.368408203125 0.8143812500000001 +0.185 -0.383056640625 0.8143812500000001 +0.185125 -0.3953857421875 0.8143812500000001 +0.18525 -0.40277099609375 0.8143812500000001 +0.185375 -0.40679931640625 0.8143812500000001 +0.1855 -0.406341552734375 0.8143812500000001 +0.185625 -0.402130126953125 0.8143812500000001 +0.18575 -0.393280029296875 0.8143812500000001 +0.185875 -0.381591796875 0.8143812500000001 +0.186 -0.36468505859375 0.8143812500000001 +0.186125 -0.343780517578125 0.8143812500000001 +0.18625 -0.32171630859375 0.8143812500000001 +0.186375 -0.293853759765625 0.8143812500000001 +0.1865 -0.266021728515625 0.8143812500000001 +0.186625 -0.23236083984375 0.8143812500000001 +0.18675 -0.196136474609375 0.8143812500000001 +0.186875 -0.16168212890625 0.8143812500000001 +0.187 -0.121734619140625 0.8143812500000001 +0.187125 -0.084625244140625 0.8143812500000001 +0.18725 -0.04254150390625 0.8143812500000001 +0.187375 0.0 0.8143812500000001 +0.1875 0.038299560546875 0.8143812500000001 +0.187625 0.0804443359375 0.8143812500000001 +0.18775 0.11767578125 0.8143812500000001 +0.187875 0.157745361328125 0.8143812500000001 +0.188 0.196136474609375 0.8143812500000001 +0.188125 0.228851318359375 0.8143812500000001 +0.18825 0.262786865234375 0.8143812500000001 +0.188375 0.2908935546875 0.8143812500000001 +0.1885 0.319061279296875 0.8143812500000001 +0.188625 0.343780517578125 0.8143812500000001 +0.18875 0.362762451171875 0.8143812500000001 +0.188875 0.380096435546875 0.8143812500000001 +0.189 0.39215087890625 0.8143812500000001 +0.189125 0.401458740234375 0.8143812500000001 +0.18925 0.406341552734375 0.8143812500000001 +0.189375 0.406951904296875 0.8143812500000001 +0.1895 0.40338134765625 0.8143812500000001 +0.189625 0.396392822265625 0.8143812500000001 +0.18975 0.384490966796875 0.8143812500000001 +0.189875 0.368408203125 0.8143812500000001 +0.19 0.350433349609375 0.8143812500000001 +0.190125 0.32684326171875 0.8143812500000001 +0.19025 0.30255126953125 0.8143812500000001 +0.190375 0.272430419921875 0.8143812500000001 +0.1905 0.239288330078125 0.8143812500000001 +0.190625 0.207244873046875 0.8143812500000001 +0.19075 0.169464111328125 0.8143812500000001 +0.190875 0.133880615234375 0.8143812500000001 +0.191 0.09295654296875 0.8143812500000001 +0.191125 0.050994873046875 0.8143812500000001 +0.19125 0.01275634765625 0.8143812500000001 +0.191375 -0.02978515625 0.8143812500000001 +0.1915 -0.06787109375 0.8143812500000001 +0.191625 -0.109466552734375 0.8143812500000001 +0.19175 -0.149871826171875 0.8143812500000001 +0.191875 -0.184814453125 0.8143812500000001 +0.192 -0.2496337890625 0.9167781250000001 +0.192125 -0.284698486328125 0.9167781250000001 +0.19225 -0.3206787109375 0.9167781250000001 +0.192375 -0.3531494140625 0.9167781250000001 +0.1925 -0.379058837890625 0.9167781250000001 +0.192625 -0.4039306640625 0.9167781250000001 +0.19275 -0.422515869140625 0.9167781250000001 +0.192875 -0.43878173828125 0.9167781250000001 +0.193 -0.450225830078125 0.9167781250000001 +0.193125 -0.456298828125 0.9167781250000001 +0.19325 -0.45831298828125 0.9167781250000001 +0.193375 -0.455841064453125 0.9167781250000001 +0.1935 -0.44830322265625 0.9167781250000001 +0.193625 -0.4359130859375 0.9167781250000001 +0.19375 -0.420654296875 0.9167781250000001 +0.193875 -0.399322509765625 0.9167781250000001 +0.194 -0.376373291015625 0.9167781250000001 +0.194125 -0.346954345703125 0.9167781250000001 +0.19425 -0.313751220703125 0.9167781250000001 +0.194375 -0.280914306640625 0.9167781250000001 +0.1945 -0.24151611328125 0.9167781250000001 +0.194625 -0.20379638671875 0.9167781250000001 +0.19475 -0.159759521484375 0.9167781250000001 +0.194875 -0.11395263671875 0.9167781250000001 +0.195 -0.071685791015625 0.9167781250000001 +0.195125 -0.023956298828125 0.9167781250000001 +0.19525 0.0191650390625 0.9167781250000001 +0.195375 0.066925048828125 0.9167781250000001 +0.1955 0.11395263671875 0.9167781250000001 +0.195625 0.155242919921875 0.9167781250000001 +0.19575 0.199462890625 0.9167781250000001 +0.195875 0.2374267578125 0.9167781250000001 +0.196 0.277099609375 0.9167781250000001 +0.196125 0.313751220703125 0.9167781250000001 +0.19625 0.343780517578125 0.9167781250000001 +0.196375 0.37359619140625 0.9167781250000001 +0.1965 0.396942138671875 0.9167781250000001 +0.196625 0.418701171875 0.9167781250000001 +0.19675 0.4359130859375 0.9167781250000001 +0.196875 0.447296142578125 0.9167781250000001 +0.197 0.455291748046875 0.9167781250000001 +0.197125 0.458221435546875 0.9167781250000001 +0.19725 0.45672607421875 0.9167781250000001 +0.197375 0.450225830078125 0.9167781250000001 +0.1975 0.44012451171875 0.9167781250000001 +0.197625 0.42437744140625 0.9167781250000001 +0.19775 0.40618896484375 0.9167781250000001 +0.197875 0.381744384765625 0.9167781250000001 +0.198 0.3531494140625 0.9167781250000001 +0.198125 0.3240966796875 0.9167781250000001 +0.19825 0.288421630859375 0.9167781250000001 +0.198375 0.253631591796875 0.9167781250000001 +0.1985 0.21234130859375 0.9167781250000001 +0.198625 0.168701171875 0.9167781250000001 +0.19875 0.127838134765625 0.9167781250000001 +0.198875 0.081146240234375 0.9167781250000001 +0.199 0.038330078125 0.9167781250000001 +0.199125 -0.00958251953125 0.9167781250000001 +0.19925 -0.05743408203125 0.9167781250000001 +0.199375 -0.099945068359375 0.9167781250000001 +0.1995 -0.14617919921875 0.9167781250000001 +0.199625 -0.1864013671875 0.9167781250000001 +0.19975 -0.229156494140625 0.9167781250000001 +0.199875 -0.269378662109375 0.9167781250000001 +0.2 -0.3031005859375 0.9167781250000001 +0.200125 -0.337371826171875 0.9167781250000001 +0.20025 -0.365081787109375 0.9167781250000001 +0.200375 -0.39202880859375 0.9167781250000001 +0.2005 -0.414703369140625 0.9167781250000001 +0.200625 -0.431243896484375 0.9167781250000001 +0.20075 -0.445098876953125 0.9167781250000001 +0.200875 -0.45343017578125 0.9167781250000001 +0.201 -0.45794677734375 0.9167781250000001 +0.201125 -0.457427978515625 0.9167781250000001 +0.20125 -0.45269775390625 0.9167781250000001 +0.201375 -0.442718505859375 0.9167781250000001 +0.2015 -0.429595947265625 0.9167781250000001 +0.201625 -0.4105224609375 0.9167781250000001 +0.20175 -0.386993408203125 0.9167781250000001 +0.201875 -0.362152099609375 0.9167781250000001 +0.202 -0.330810546875 0.9167781250000001 +0.202125 -0.299468994140625 0.9167781250000001 +0.20225 -0.261566162109375 0.9167781250000001 +0.202375 -0.220794677734375 0.9167781250000001 +0.2025 -0.1820068359375 0.9167781250000001 +0.202625 -0.137054443359375 0.9167781250000001 +0.20275 -0.09527587890625 0.9167781250000001 +0.202875 -0.047882080078125 0.9167781250000001 +0.203 0.0 0.9167781250000001 +0.203125 0.043121337890625 0.9167781250000001 +0.20325 0.090576171875 0.9167781250000001 +0.203375 0.1324462890625 0.9167781250000001 +0.2035 0.177581787109375 0.9167781250000001 +0.203625 0.220794677734375 0.9167781250000001 +0.20375 0.257598876953125 0.9167781250000001 +0.203875 0.29583740234375 0.9167781250000001 +0.204 0.32745361328125 0.9167781250000001 +0.204125 0.35919189453125 0.9167781250000001 +0.20425 0.386993408203125 0.9167781250000001 +0.204375 0.40838623046875 0.9167781250000001 +0.2045 0.427886962890625 0.9167781250000001 +0.204625 0.441436767578125 0.9167781250000001 +0.20475 0.451934814453125 0.9167781250000001 +0.204875 0.457427978515625 0.9167781250000001 +0.205 0.458099365234375 0.9167781250000001 +0.205125 0.4541015625 0.9167781250000001 +0.20525 0.44622802734375 0.9167781250000001 +0.205375 0.432830810546875 0.9167781250000001 +0.2055 0.414703369140625 0.9167781250000001 +0.205625 0.394500732421875 0.9167781250000001 +0.20575 0.367950439453125 0.9167781250000001 +0.205875 0.340606689453125 0.9167781250000001 +0.206 0.306671142578125 0.9167781250000001 +0.206125 0.269378662109375 0.9167781250000001 +0.20625 0.233306884765625 0.9167781250000001 +0.206375 0.1907958984375 0.9167781250000001 +0.2065 0.15069580078125 0.9167781250000001 +0.206625 0.104644775390625 0.9167781250000001 +0.20675 0.05743408203125 0.9167781250000001 +0.206875 0.014373779296875 0.9167781250000001 +0.207 -0.033538818359375 0.9167781250000001 +0.207125 -0.076416015625 0.9167781250000001 +0.20725 -0.12322998046875 0.9167781250000001 +0.207375 -0.168701171875 0.9167781250000001 +0.2075 -0.20806884765625 0.9167781250000001 +0.207625 -0.2496337890625 0.9167781250000001 +0.20775 -0.284698486328125 0.9167781250000001 +0.207875 -0.3206787109375 0.9167781250000001 +0.208 -0.3531494140625 0.9167781250000001 +0.208125 -0.379058837890625 0.9167781250000001 +0.20825 -0.4039306640625 0.9167781250000001 +0.208375 -0.422515869140625 0.9167781250000001 +0.2085 -0.43878173828125 0.9167781250000001 +0.208625 -0.450225830078125 0.9167781250000001 +0.20875 -0.456298828125 0.9167781250000001 +0.208875 -0.45831298828125 0.9167781250000001 +0.209 -0.455841064453125 0.9167781250000001 +0.209125 -0.44830322265625 0.9167781250000001 +0.20925 -0.4359130859375 0.9167781250000001 +0.209375 -0.420654296875 0.9167781250000001 +0.2095 -0.399322509765625 0.9167781250000001 +0.209625 -0.376373291015625 0.9167781250000001 +0.20975 -0.346954345703125 0.9167781250000001 +0.209875 -0.313751220703125 0.9167781250000001 +0.21 -0.280914306640625 0.9167781250000001 +0.210125 -0.24151611328125 0.9167781250000001 +0.21025 -0.20379638671875 0.9167781250000001 +0.210375 -0.159759521484375 0.9167781250000001 +0.2105 -0.11395263671875 0.9167781250000001 +0.210625 -0.071685791015625 0.9167781250000001 +0.21075 -0.023956298828125 0.9167781250000001 +0.210875 0.0191650390625 0.9167781250000001 +0.211 0.066925048828125 0.9167781250000001 +0.211125 0.11395263671875 0.9167781250000001 +0.21125 0.155242919921875 0.9167781250000001 +0.211375 0.199462890625 0.9167781250000001 +0.2115 0.2374267578125 0.9167781250000001 +0.211625 0.277099609375 0.9167781250000001 +0.21175 0.313751220703125 0.9167781250000001 +0.211875 0.343780517578125 0.9167781250000001 +0.212 0.37359619140625 0.9167781250000001 +0.212125 0.396942138671875 0.9167781250000001 +0.21225 0.418701171875 0.9167781250000001 +0.212375 0.4359130859375 0.9167781250000001 +0.2125 0.447296142578125 0.9167781250000001 +0.212625 0.455291748046875 0.9167781250000001 +0.21275 0.458221435546875 0.9167781250000001 +0.212875 0.45672607421875 0.9167781250000001 +0.213 0.450225830078125 0.9167781250000001 +0.213125 0.44012451171875 0.9167781250000001 +0.21325 0.42437744140625 0.9167781250000001 +0.213375 0.40618896484375 0.9167781250000001 +0.2135 0.381744384765625 0.9167781250000001 +0.213625 0.3531494140625 0.9167781250000001 +0.21375 0.3240966796875 0.9167781250000001 +0.213875 0.288421630859375 0.9167781250000001 +0.214 0.253631591796875 0.9167781250000001 +0.214125 0.21234130859375 0.9167781250000001 +0.21425 0.168701171875 0.9167781250000001 +0.214375 0.127838134765625 0.9167781250000001 +0.2145 0.081146240234375 0.9167781250000001 +0.214625 0.038330078125 0.9167781250000001 +0.21475 -0.00958251953125 0.9167781250000001 +0.214875 -0.05743408203125 0.9167781250000001 +0.215 -0.099945068359375 0.9167781250000001 +0.215125 -0.14617919921875 0.9167781250000001 +0.21525 -0.1864013671875 0.9167781250000001 +0.215375 -0.229156494140625 0.9167781250000001 +0.2155 -0.269378662109375 0.9167781250000001 +0.215625 -0.3031005859375 0.9167781250000001 +0.21575 -0.337371826171875 0.9167781250000001 +0.215875 -0.365081787109375 0.9167781250000001 +0.216 -0.39202880859375 0.9167781250000001 +0.216125 -0.414703369140625 0.9167781250000001 +0.21625 -0.431243896484375 0.9167781250000001 +0.216375 -0.445098876953125 0.9167781250000001 +0.2165 -0.45343017578125 0.9167781250000001 +0.216625 -0.45794677734375 0.9167781250000001 +0.21675 -0.457427978515625 0.9167781250000001 +0.216875 -0.45269775390625 0.9167781250000001 +0.217 -0.442718505859375 0.9167781250000001 +0.217125 -0.429595947265625 0.9167781250000001 +0.21725 -0.4105224609375 0.9167781250000001 +0.217375 -0.386993408203125 0.9167781250000001 +0.2175 -0.362152099609375 0.9167781250000001 +0.217625 -0.330810546875 0.9167781250000001 +0.21775 -0.299468994140625 0.9167781250000001 +0.217875 -0.261566162109375 0.9167781250000001 +0.218 -0.220794677734375 0.9167781250000001 +0.218125 -0.1820068359375 0.9167781250000001 +0.21825 -0.137054443359375 0.9167781250000001 +0.218375 -0.09527587890625 0.9167781250000001 +0.2185 -0.047882080078125 0.9167781250000001 +0.218625 0.0 0.9167781250000001 +0.21875 0.043121337890625 0.9167781250000001 +0.218875 0.090576171875 0.9167781250000001 +0.219 0.1324462890625 0.9167781250000001 +0.219125 0.177581787109375 0.9167781250000001 +0.21925 0.220794677734375 0.9167781250000001 +0.219375 0.257598876953125 0.9167781250000001 +0.2195 0.29583740234375 0.9167781250000001 +0.219625 0.32745361328125 0.9167781250000001 +0.21975 0.35919189453125 0.9167781250000001 +0.219875 0.386993408203125 0.9167781250000001 +0.22 0.40838623046875 0.9167781250000001 +0.220125 0.427886962890625 0.9167781250000001 +0.22025 0.441436767578125 0.9167781250000001 +0.220375 0.451934814453125 0.9167781250000001 +0.2205 0.457427978515625 0.9167781250000001 +0.220625 0.458099365234375 0.9167781250000001 +0.22075 0.4541015625 0.9167781250000001 +0.220875 0.44622802734375 0.9167781250000001 +0.221 0.432830810546875 0.9167781250000001 +0.221125 0.414703369140625 0.9167781250000001 +0.22125 0.394500732421875 0.9167781250000001 +0.221375 0.367950439453125 0.9167781250000001 +0.2215 0.340606689453125 0.9167781250000001 +0.221625 0.306671142578125 0.9167781250000001 +0.22175 0.269378662109375 0.9167781250000001 +0.221875 0.233306884765625 0.9167781250000001 +0.222 0.1907958984375 0.9167781250000001 +0.222125 0.15069580078125 0.9167781250000001 +0.22225 0.104644775390625 0.9167781250000001 +0.222375 0.05743408203125 0.9167781250000001 +0.2225 0.014373779296875 0.9167781250000001 +0.222625 -0.033538818359375 0.9167781250000001 +0.22275 -0.076416015625 0.9167781250000001 +0.222875 -0.12322998046875 0.9167781250000001 +0.223 -0.168701171875 0.9167781250000001 +0.223125 -0.20806884765625 0.9167781250000001 +0.22325 -0.2496337890625 0.9167781250000001 +0.223375 -0.284698486328125 0.9167781250000001 +0.2235 -0.3206787109375 0.9167781250000001 +0.223625 -0.3531494140625 0.9167781250000001 +0.22375 -0.379058837890625 0.9167781250000001 +0.223875 -0.4039306640625 0.9167781250000001 +0.224 -0.460845947265625 0.9999511726200581 +0.224125 -0.47857666015625 0.9999511726200581 +0.22425 -0.491058349609375 0.9999511726200581 +0.224375 -0.497711181640625 0.9999511726200581 +0.2245 -0.499908447265625 0.9999511726200581 +0.224625 -0.4971923828125 0.9999511726200581 +0.22475 -0.488983154296875 0.9999511726200581 +0.224875 -0.4754638671875 0.9999511726200581 +0.225 -0.45880126953125 0.9999511726200581 +0.225125 -0.435546875 0.9999511726200581 +0.22525 -0.410491943359375 0.9999511726200581 +0.225375 -0.37841796875 0.9999511726200581 +0.2255 -0.342193603515625 0.9999511726200581 +0.225625 -0.306396484375 0.9999511726200581 +0.22575 -0.263427734375 0.9999511726200581 +0.225875 -0.222259521484375 0.9999511726200581 +0.226 -0.174224853515625 0.9999511726200581 +0.226125 -0.124298095703125 0.9999511726200581 +0.22625 -0.07818603515625 0.9999511726200581 +0.226375 -0.026123046875 0.9999511726200581 +0.2265 0.020904541015625 0.9999511726200581 +0.226625 0.072998046875 0.9999511726200581 +0.22675 0.124298095703125 0.9999511726200581 +0.226875 0.1693115234375 0.9999511726200581 +0.227 0.217559814453125 0.9999511726200581 +0.227125 0.25897216796875 0.9999511726200581 +0.22725 0.30224609375 0.9999511726200581 +0.227375 0.342193603515625 0.9999511726200581 +0.2275 0.374969482421875 0.9999511726200581 +0.227625 0.407501220703125 0.9999511726200581 +0.22775 0.432952880859375 0.9999511726200581 +0.227875 0.456695556640625 0.9999511726200581 +0.228 0.4754638671875 0.9999511726200581 +0.228125 0.487884521484375 0.9999511726200581 +0.22825 0.496612548828125 0.9999511726200581 +0.228375 0.49981689453125 0.9999511726200581 +0.2285 0.4981689453125 0.9999511726200581 +0.228625 0.491058349609375 0.9999511726200581 +0.22875 0.480072021484375 0.9999511726200581 +0.228875 0.462860107421875 0.9999511726200581 +0.229 0.443023681640625 0.9999511726200581 +0.229125 0.4163818359375 0.9999511726200581 +0.22925 0.38519287109375 0.9999511726200581 +0.229375 0.353485107421875 0.9999511726200581 +0.2295 0.314605712890625 0.9999511726200581 +0.229625 0.276641845703125 0.9999511726200581 +0.22975 0.231597900390625 0.9999511726200581 +0.229875 0.18402099609375 0.9999511726200581 +0.23 0.13946533203125 0.9999511726200581 +0.230125 0.0885009765625 0.9999511726200581 +0.23025 0.04180908203125 0.9999511726200581 +0.230375 -0.01043701171875 0.9999511726200581 +0.2305 -0.0626220703125 0.9999511726200581 +0.230625 -0.109039306640625 0.9999511726200581 +0.23075 -0.159454345703125 0.9999511726200581 +0.230875 -0.20330810546875 0.9999511726200581 +0.231 -0.24993896484375 0.9999511726200581 +0.231125 -0.2938232421875 0.9999511726200581 +0.23125 -0.330596923828125 0.9999511726200581 +0.231375 -0.36798095703125 0.9999511726200581 +0.2315 -0.398193359375 0.9999511726200581 +0.231625 -0.4276123046875 0.9999511726200581 +0.23175 -0.45233154296875 0.9999511726200581 +0.231875 -0.470367431640625 0.9999511726200581 +0.232 -0.485504150390625 0.9999511726200581 +0.232125 -0.49456787109375 0.9999511726200581 +0.23225 -0.499481201171875 0.9999511726200581 +0.232375 -0.498931884765625 0.9999511726200581 +0.2325 -0.4937744140625 0.9999511726200581 +0.232625 -0.482879638671875 0.9999511726200581 +0.23275 -0.46856689453125 0.9999511726200581 +0.232875 -0.447784423828125 0.9999511726200581 +0.233 -0.422088623046875 0.9999511726200581 +0.233125 -0.39501953125 0.9999511726200581 +0.23325 -0.360809326171875 0.9999511726200581 +0.233375 -0.32666015625 0.9999511726200581 +0.2335 -0.285308837890625 0.9999511726200581 +0.233625 -0.240814208984375 0.9999511726200581 +0.23375 -0.198516845703125 0.9999511726200581 +0.233875 -0.14947509765625 0.9999511726200581 +0.234 -0.103912353515625 0.9999511726200581 +0.234125 -0.05224609375 0.9999511726200581 +0.23425 0.0 0.9999511726200581 +0.234375 0.047027587890625 0.9999511726200581 +0.2345 0.098785400390625 0.9999511726200581 +0.234625 0.14447021484375 0.9999511726200581 +0.23475 0.193695068359375 0.9999511726200581 +0.234875 0.240814208984375 0.9999511726200581 +0.235 0.280975341796875 0.9999511726200581 +0.235125 0.322662353515625 0.9999511726200581 +0.23525 0.357177734375 0.9999511726200581 +0.235375 0.39178466796875 0.9999511726200581 +0.2355 0.422088623046875 0.9999511726200581 +0.235625 0.4454345703125 0.9999511726200581 +0.23575 0.466705322265625 0.9999511726200581 +0.235875 0.48150634765625 0.9999511726200581 +0.236 0.492919921875 0.9999511726200581 +0.236125 0.498931884765625 0.9999511726200581 +0.23625 0.499664306640625 0.9999511726200581 +0.236375 0.49530029296875 0.9999511726200581 +0.2365 0.486724853515625 0.9999511726200581 +0.236625 0.47210693359375 0.9999511726200581 +0.23675 0.45233154296875 0.9999511726200581 +0.236875 0.4302978515625 0.9999511726200581 +0.237 0.401336669921875 0.9999511726200581 +0.237125 0.371490478515625 0.9999511726200581 +0.23725 0.334503173828125 0.9999511726200581 +0.237375 0.2938232421875 0.9999511726200581 +0.2375 0.25445556640625 0.9999511726200581 +0.237625 0.208099365234375 0.9999511726200581 +0.23775 0.164398193359375 0.9999511726200581 +0.237875 0.1141357421875 0.9999511726200581 +0.238 0.0626220703125 0.9999511726200581 +0.238125 0.01568603515625 0.9999511726200581 +0.23825 -0.036590576171875 0.9999511726200581 +0.238375 -0.083343505859375 0.9999511726200581 +0.2385 -0.134429931640625 0.9999511726200581 +0.238625 -0.18402099609375 0.9999511726200581 +0.23875 -0.2269287109375 0.9999511726200581 +0.238875 -0.27227783203125 0.9999511726200581 +0.239 -0.310516357421875 0.9999511726200581 +0.239125 -0.349761962890625 0.9999511726200581 +0.23925 -0.38519287109375 0.9999511726200581 +0.239375 -0.4134521484375 0.9999511726200581 +0.2395 -0.440582275390625 0.9999511726200581 +0.239625 -0.460845947265625 0.9999511726200581 +0.23975 -0.47857666015625 0.9999511726200581 +0.239875 -0.491058349609375 0.9999511726200581 +0.24 -0.497711181640625 0.9999511726200581 +0.240125 -0.499908447265625 0.9999511726200581 +0.24025 -0.4971923828125 0.9999511726200581 +0.240375 -0.488983154296875 0.9999511726200581 +0.2405 -0.4754638671875 0.9999511726200581 +0.240625 -0.45880126953125 0.9999511726200581 +0.24075 -0.435546875 0.9999511726200581 +0.240875 -0.410491943359375 0.9999511726200581 +0.241 -0.37841796875 0.9999511726200581 +0.241125 -0.342193603515625 0.9999511726200581 +0.24125 -0.306396484375 0.9999511726200581 +0.241375 -0.263427734375 0.9999511726200581 +0.2415 -0.222259521484375 0.9999511726200581 +0.241625 -0.174224853515625 0.9999511726200581 +0.24175 -0.124298095703125 0.9999511726200581 +0.241875 -0.07818603515625 0.9999511726200581 +0.242 -0.026123046875 0.9999511726200581 +0.242125 0.020904541015625 0.9999511726200581 +0.24225 0.072998046875 0.9999511726200581 +0.242375 0.124298095703125 0.9999511726200581 +0.2425 0.1693115234375 0.9999511726200581 +0.242625 0.217559814453125 0.9999511726200581 +0.24275 0.25897216796875 0.9999511726200581 +0.242875 0.30224609375 0.9999511726200581 +0.243 0.342193603515625 0.9999511726200581 +0.243125 0.374969482421875 0.9999511726200581 +0.24325 0.407501220703125 0.9999511726200581 +0.243375 0.432952880859375 0.9999511726200581 +0.2435 0.456695556640625 0.9999511726200581 +0.243625 0.4754638671875 0.9999511726200581 +0.24375 0.487884521484375 0.9999511726200581 +0.243875 0.496612548828125 0.9999511726200581 +0.244 0.49981689453125 0.9999511726200581 +0.244125 0.4981689453125 0.9999511726200581 +0.24425 0.491058349609375 0.9999511726200581 +0.244375 0.480072021484375 0.9999511726200581 +0.2445 0.462860107421875 0.9999511726200581 +0.244625 0.443023681640625 0.9999511726200581 +0.24475 0.4163818359375 0.9999511726200581 +0.244875 0.38519287109375 0.9999511726200581 +0.245 0.353485107421875 0.9999511726200581 +0.245125 0.314605712890625 0.9999511726200581 +0.24525 0.276641845703125 0.9999511726200581 +0.245375 0.231597900390625 0.9999511726200581 +0.2455 0.18402099609375 0.9999511726200581 +0.245625 0.13946533203125 0.9999511726200581 +0.24575 0.0885009765625 0.9999511726200581 +0.245875 0.04180908203125 0.9999511726200581 +0.246 -0.01043701171875 0.9999511726200581 +0.246125 -0.0626220703125 0.9999511726200581 +0.24625 -0.109039306640625 0.9999511726200581 +0.246375 -0.159454345703125 0.9999511726200581 +0.2465 -0.20330810546875 0.9999511726200581 +0.246625 -0.24993896484375 0.9999511726200581 +0.24675 -0.2938232421875 0.9999511726200581 +0.246875 -0.330596923828125 0.9999511726200581 +0.247 -0.36798095703125 0.9999511726200581 +0.247125 -0.398193359375 0.9999511726200581 +0.24725 -0.4276123046875 0.9999511726200581 +0.247375 -0.45233154296875 0.9999511726200581 +0.2475 -0.470367431640625 0.9999511726200581 +0.247625 -0.485504150390625 0.9999511726200581 +0.24775 -0.49456787109375 0.9999511726200581 +0.247875 -0.499481201171875 0.9999511726200581 +0.248 -0.498931884765625 0.9999511726200581 +0.248125 -0.4937744140625 0.9999511726200581 +0.24825 -0.482879638671875 0.9999511726200581 +0.248375 -0.46856689453125 0.9999511726200581 +0.2485 -0.447784423828125 0.9999511726200581 +0.248625 -0.422088623046875 0.9999511726200581 +0.24875 -0.39501953125 0.9999511726200581 +0.248875 -0.360809326171875 0.9999511726200581 +0.249 -0.32666015625 0.9999511726200581 +0.249125 -0.285308837890625 0.9999511726200581 +0.24925 -0.240814208984375 0.9999511726200581 +0.249375 -0.198516845703125 0.9999511726200581 +0.2495 -0.14947509765625 0.9999511726200581 +0.249625 -0.103912353515625 0.9999511726200581 +0.24975 -0.05224609375 0.9999511726200581 +0.249875 0.0 0.9999511726200581 +0.25 0.047027587890625 0.9999511726200581 +0.250125 0.098785400390625 0.9999511726200581 +0.25025 0.14447021484375 0.9999511726200581 +0.250375 0.193695068359375 0.9999511726200581 +0.2505 0.240814208984375 0.9999511726200581 +0.250625 0.280975341796875 0.9999511726200581 +0.25075 0.322662353515625 0.9999511726200581 +0.250875 0.357177734375 0.9999511726200581 +0.251 0.39178466796875 0.9999511726200581 +0.251125 0.422088623046875 0.9999511726200581 +0.25125 0.4454345703125 0.9999511726200581 +0.251375 0.466705322265625 0.9999511726200581 +0.2515 0.48150634765625 0.9999511726200581 +0.251625 0.492919921875 0.9999511726200581 +0.25175 0.498931884765625 0.9999511726200581 +0.251875 0.499664306640625 0.9999511726200581 +0.252 0.49530029296875 0.9999511726200581 +0.252125 0.486724853515625 0.9999511726200581 +0.25225 0.47210693359375 0.9999511726200581 +0.252375 0.45233154296875 0.9999511726200581 +0.2525 0.4302978515625 0.9999511726200581 +0.252625 0.401336669921875 0.9999511726200581 +0.25275 0.371490478515625 0.9999511726200581 +0.252875 0.334503173828125 0.9999511726200581 +0.253 0.2938232421875 0.9999511726200581 +0.253125 0.25445556640625 0.9999511726200581 +0.25325 0.208099365234375 0.9999511726200581 +0.253375 0.164398193359375 0.9999511726200581 +0.2535 0.1141357421875 0.9999511726200581 +0.253625 0.0626220703125 0.9999511726200581 +0.2537500000000001 0.01568603515625 0.9999511726200581 +0.253875 -0.036590576171875 0.9999511726200581 +0.254 -0.083343505859375 0.9999511726200581 +0.254125 -0.134429931640625 0.9999511726200581 +0.25425 -0.18402099609375 0.9999511726200581 +0.254375 -0.2269287109375 0.9999511726200581 +0.2545 -0.27227783203125 0.9999511726200581 +0.254625 -0.310516357421875 0.9999511726200581 +0.25475 -0.349761962890625 0.9999511726200581 +0.254875 -0.38519287109375 0.9999511726200581 +0.255 -0.4134521484375 0.9999511726200581 +0.255125 -0.440582275390625 0.9999511726200581 +0.25525 -0.460845947265625 0.9999511726200581 +0.255375 -0.47857666015625 0.9999511726200581 +0.2555 -0.491058349609375 0.9999511726200581 +0.255625 -0.497711181640625 0.9999511726200581 +0.25575 -0.499908447265625 0.9999511726200581 +0.255875 -0.4971923828125 0.9999511726200581 diff --git a/tests/circuitpython/synth_note_ring.py b/tests/circuitpython/synth_note_ring.py new file mode 100644 index 0000000000..1a3f307869 --- /dev/null +++ b/tests/circuitpython/synth_note_ring.py @@ -0,0 +1,10 @@ +from synthnotehelper import * + + +@synth_test +def gen(synth): + l = LFO(sweep, rate=4, once=True) + yield [l] + n = Note(128, ring_waveform=sine, ring_frequency=6, ring_bend=l) + synth.press(n) + yield 1 / 4 diff --git a/tests/circuitpython/synth_note_ring.py.exp b/tests/circuitpython/synth_note_ring.py.exp new file mode 100644 index 0000000000..406c08da03 --- /dev/null +++ b/tests/circuitpython/synth_note_ring.py.exp @@ -0,0 +1,2048 @@ +0.0 0.0 -0.743977294921875 +0.000125 0.0 -0.743977294921875 +0.00025 0.0 -0.743977294921875 +0.000375 0.003997802734375 -0.743977294921875 +0.0005 0.0050048828125 -0.743977294921875 +0.000625 0.005828857421875 -0.743977294921875 +0.00075 0.0067138671875 -0.743977294921875 +0.0008750000000000002 0.014923095703125 -0.743977294921875 +0.001 0.016357421875 -0.743977294921875 +0.001125 0.01763916015625 -0.743977294921875 +0.00125 0.01861572265625 -0.743977294921875 +0.001375 0.029266357421875 -0.743977294921875 +0.0015 0.03021240234375 -0.743977294921875 +0.001625 0.030914306640625 -0.743977294921875 +0.00175 0.041748046875 -0.743977294921875 +0.001875 0.04180908203125 -0.743977294921875 +0.002 0.04144287109375 -0.743977294921875 +0.002125 0.04071044921875 -0.743977294921875 +0.00225 0.049346923828125 -0.743977294921875 +0.002375 0.047271728515625 -0.743977294921875 +0.0025 0.04498291015625 -0.743977294921875 +0.002625 0.04193115234375 -0.743977294921875 +0.00275 0.046600341796875 -0.743977294921875 +0.002875 0.041961669921875 -0.743977294921875 +0.003 0.036834716796875 -0.743977294921875 +0.003125 0.03192138671875 -0.743977294921875 +0.00325 0.030426025390625 -0.743977294921875 +0.003375 0.024017333984375 -0.743977294921875 +0.0035 0.01666259765625 -0.743977294921875 +0.003625 0.01043701171875 -0.743977294921875 +0.00375 0.002593994140625 -0.743977294921875 +0.003875 -0.006072998046875 -0.743977294921875 +0.004 -0.013916015625 -0.743977294921875 +0.004125 -0.025238037109375 -0.743977294921875 +0.00425 -0.034576416015625 -0.743977294921875 +0.004375000000000001 -0.04266357421875 -0.743977294921875 +0.004500000000000001 -0.05120849609375 -0.743977294921875 +0.004625 -0.06488037109375 -0.743977294921875 +0.00475 -0.073089599609375 -0.743977294921875 +0.004875 -0.080474853515625 -0.743977294921875 +0.005 -0.095001220703125 -0.743977294921875 +0.005125000000000001 -0.101226806640625 -0.743977294921875 +0.00525 -0.10589599609375 -0.743977294921875 +0.005375000000000001 -0.1099853515625 -0.743977294921875 +0.005499999999999999 -0.123046875 -0.743977294921875 +0.005625 -0.12469482421875 -0.743977294921875 +0.00575 -0.125244140625 -0.743977294921875 +0.005874999999999999 -0.12457275390625 -0.743977294921875 +0.006 -0.132659912109375 -0.743977294921875 +0.006125 -0.128997802734375 -0.743977294921875 +0.00625 -0.124481201171875 -0.743977294921875 +0.006375 -0.1181640625 -0.743977294921875 +0.0065 -0.119873046875 -0.743977294921875 +0.006625000000000001 -0.110504150390625 -0.743977294921875 +0.00675 -0.099945068359375 -0.743977294921875 +0.006875 -0.0958251953125 -0.743977294921875 +0.007000000000000001 -0.082366943359375 -0.743977294921875 +0.007125000000000002 -0.069488525390625 -0.743977294921875 +0.007250000000000001 -0.054473876953125 -0.743977294921875 +0.007375 -0.041412353515625 -0.743977294921875 +0.0075 -0.026031494140625 -0.743977294921875 +0.007625 -0.0086669921875 -0.743977294921875 +0.00775 0.006927490234375 -0.743977294921875 +0.007875 0.02581787109375 -0.743977294921875 +0.008 0.043975830078125 -0.743977294921875 +0.008125 0.0599365234375 -0.743977294921875 +0.00825 0.08148193359375 -0.743977294921875 +0.008375 0.097015380859375 -0.743977294921875 +0.0085 0.11322021484375 -0.743977294921875 +0.008625 0.128204345703125 -0.743977294921875 +0.008750000000000002 0.148193359375 -0.743977294921875 +0.008875 0.161041259765625 -0.743977294921875 +0.009000000000000002 0.171112060546875 -0.743977294921875 +0.009125 0.18048095703125 -0.743977294921875 +0.00925 0.197662353515625 -0.743977294921875 +0.009375 0.20281982421875 -0.743977294921875 +0.0095 0.206451416015625 -0.743977294921875 +0.009625 0.207794189453125 -0.743977294921875 +0.00975 0.21728515625 -0.743977294921875 +0.009875 0.214202880859375 -0.743977294921875 +0.01 0.209381103515625 -0.743977294921875 +0.010125 0.21136474609375 -0.743977294921875 +0.01025 0.202301025390625 -0.743977294921875 +0.010375 0.19012451171875 -0.743977294921875 +0.0105 0.175872802734375 -0.743977294921875 +0.010625 0.168609619140625 -0.743977294921875 +0.01075 0.150054931640625 -0.743977294921875 +0.010875 0.131927490234375 -0.743977294921875 +0.011 0.110443115234375 -0.743977294921875 +0.011125 0.09149169921875 -0.743977294921875 +0.01125 0.069305419921875 -0.743977294921875 +0.011375 0.043975830078125 -0.743977294921875 +0.0115 0.020751953125 -0.743977294921875 +0.011625 -0.00537109375 -0.743977294921875 +0.01175 -0.032379150390625 -0.743977294921875 +0.011875 -0.056396484375 -0.743977294921875 +0.012 -0.085723876953125 -0.743977294921875 +0.012125 -0.10931396484375 -0.743977294921875 +0.01225 -0.1343994140625 -0.743977294921875 +0.012375 -0.157989501953125 -0.743977294921875 +0.0125 -0.184417724609375 -0.743977294921875 +0.012625 -0.205291748046875 -0.743977294921875 +0.01275 -0.222137451171875 -0.743977294921875 +0.012875 -0.238555908203125 -0.743977294921875 +0.013 -0.261444091796875 -0.743977294921875 +0.013125 -0.2718505859375 -0.743977294921875 +0.01325 -0.280609130859375 -0.743977294921875 +0.013375 -0.295745849609375 -0.743977294921875 +0.0135 -0.2987060546875 -0.743977294921875 +0.013625 -0.298370361328125 -0.743977294921875 +0.01375 -0.295257568359375 -0.743977294921875 +0.013875 -0.29840087890625 -0.743977294921875 +0.014 -0.28955078125 -0.743977294921875 +0.014125 -0.276702880859375 -0.743977294921875 +0.01425 -0.260833740234375 -0.743977294921875 +0.014375 -0.251953125 -0.743977294921875 +0.0145 -0.230133056640625 -0.743977294921875 +0.014625 -0.208343505859375 -0.743977294921875 +0.01475 -0.181976318359375 -0.743977294921875 +0.014875 -0.158355712890625 -0.743977294921875 +0.015 -0.13055419921875 -0.743977294921875 +0.015125 -0.0982666015625 -0.743977294921875 +0.01525 -0.07037353515625 -0.743977294921875 +0.015375 -0.035369873046875 -0.743977294921875 +0.0155 0.0 -0.743977294921875 +0.015625 0.031829833984375 -0.743977294921875 +0.01575 0.06884765625 -0.743977294921875 +0.015875 0.100677490234375 -0.743977294921875 +0.016 0.135009765625 -0.743977294921875 +0.016125 0.1678466796875 -0.743977294921875 +0.01625 0.20135498046875 -0.743977294921875 +0.016375 0.231231689453125 -0.743977294921875 +0.0165 0.2559814453125 -0.743977294921875 +0.016625 0.288421630859375 -0.743977294921875 +0.01675 0.31072998046875 -0.743977294921875 +0.016875 0.327911376953125 -0.743977294921875 +0.017 0.343597412109375 -0.743977294921875 +0.017125 0.36383056640625 -0.743977294921875 +0.01725 0.372467041015625 -0.743977294921875 +0.017375 0.37701416015625 -0.743977294921875 +0.0175 0.3775634765625 -0.743977294921875 +0.017625 0.383819580078125 -0.743977294921875 +0.01775 0.377197265625 -0.743977294921875 +0.017875 0.365875244140625 -0.743977294921875 +0.018 0.350555419921875 -0.743977294921875 +0.018125 0.341766357421875 -0.743977294921875 +0.01825 0.318756103515625 -0.743977294921875 +0.018375 0.2950439453125 -0.743977294921875 +0.0185 0.2720947265625 -0.743977294921875 +0.018625 0.238983154296875 -0.743977294921875 +0.01875 0.20697021484375 -0.743977294921875 +0.018875 0.16925048828125 -0.743977294921875 +0.019 0.1368408203125 -0.743977294921875 +0.019125 0.095001220703125 -0.743977294921875 +0.01925 0.0521240234375 -0.743977294921875 +0.019375 0.013031005859375 -0.743977294921875 +0.0195 -0.0311279296875 -0.743977294921875 +0.019625 -0.070953369140625 -0.743977294921875 +0.01975 -0.11444091796875 -0.743977294921875 +0.019875 -0.15667724609375 -0.743977294921875 +0.02 -0.197509765625 -0.743977294921875 +0.020125 -0.236968994140625 -0.743977294921875 +0.02025 -0.270263671875 -0.743977294921875 +0.020375 -0.311004638671875 -0.743977294921875 +0.0205 -0.342529296875 -0.743977294921875 +0.020625 -0.367645263671875 -0.743977294921875 +0.02075 -0.39178466796875 -0.743977294921875 +0.020875 -0.41839599609375 -0.743977294921875 +0.021 -0.43450927734375 -0.743977294921875 +0.021125 -0.445831298828125 -0.743977294921875 +0.02125 -0.451873779296875 -0.743977294921875 +0.021375 -0.463165283203125 -0.743977294921875 +0.0215 -0.460662841796875 -0.743977294921875 +0.021625 -0.45306396484375 -0.743977294921875 +0.02175 -0.4493408203125 -0.743977294921875 +0.021875 -0.433624267578125 -0.743977294921875 +0.022 -0.41162109375 -0.743977294921875 +0.022125 -0.387969970703125 -0.743977294921875 +0.02225 -0.364593505859375 -0.743977294921875 +0.022375 -0.329681396484375 -0.743977294921875 +0.0225 -0.295196533203125 -0.743977294921875 +0.022625 -0.2537841796875 -0.743977294921875 +0.02275 -0.21820068359375 -0.743977294921875 +0.022875 -0.171051025390625 -0.743977294921875 +0.023 -0.12200927734375 -0.743977294921875 +0.023125 -0.07672119140625 -0.743977294921875 +0.02325 -0.026092529296875 -0.743977294921875 +0.023375 0.0208740234375 -0.743977294921875 +0.0235 0.072967529296875 -0.743977294921875 +0.023625 0.12652587890625 -0.743977294921875 +0.02375 0.17236328125 -0.743977294921875 +0.023875 0.221466064453125 -0.743977294921875 +0.024 0.26361083984375 -0.743977294921875 +0.024125 0.3131103515625 -0.743977294921875 +0.02425 0.354522705078125 -0.743977294921875 +0.024375 0.38848876953125 -0.743977294921875 +0.0245 0.42218017578125 -0.743977294921875 +0.024625 0.456268310546875 -0.743977294921875 +0.02475 0.481292724609375 -0.743977294921875 +0.024875 0.50103759765625 -0.743977294921875 +0.025 0.522796630859375 -0.743977294921875 +0.025125 0.532135009765625 -0.743977294921875 +0.02525 0.53558349609375 -0.743977294921875 +0.02537500000000001 0.5338134765625 -0.743977294921875 +0.0255 0.534881591796875 -0.743977294921875 +0.025625 0.52288818359375 -0.743977294921875 +0.02575 0.504150390625 -0.743977294921875 +0.025875 0.482574462890625 -0.743977294921875 +0.026 0.4608154296875 -0.743977294921875 +0.026125 0.426300048828125 -0.743977294921875 +0.02625 0.391204833984375 -0.743977294921875 +0.026375 0.34814453125 -0.743977294921875 +0.0265 0.310943603515625 -0.743977294921875 +0.026625 0.26031494140625 -0.743977294921875 +0.02675 0.20684814453125 -0.743977294921875 +0.026875 0.159149169921875 -0.743977294921875 +0.027 0.10101318359375 -0.743977294921875 +0.027125 0.047698974609375 -0.743977294921875 +0.02725 -0.01190185546875 -0.743977294921875 +0.027375 -0.072540283203125 -0.743977294921875 +0.0275 -0.12628173828125 -0.743977294921875 +0.027625 -0.1846923828125 -0.743977294921875 +0.02775 -0.23553466796875 -0.743977294921875 +0.027875 -0.293792724609375 -0.743977294921875 +0.028 -0.34539794921875 -0.743977294921875 +0.028125 -0.38861083984375 -0.743977294921875 +0.02825 -0.43878173828125 -0.743977294921875 +0.028375 -0.47479248046875 -0.743977294921875 +0.02850000000000001 -0.509857177734375 -0.743977294921875 +0.028625 -0.539337158203125 -0.743977294921875 +0.02875 -0.568695068359375 -0.743977294921875 +0.028875 -0.587005615234375 -0.743977294921875 +0.029 -0.59796142578125 -0.743977294921875 +0.029125 -0.603912353515625 -0.743977294921875 +0.02925 -0.611572265625 -0.743977294921875 +0.029375 -0.605224609375 -0.743977294921875 +0.0295 -0.591888427734375 -0.743977294921875 +0.029625 -0.5743408203125 -0.743977294921875 +0.02975000000000001 -0.556243896484375 -0.743977294921875 +0.029875 -0.52435302734375 -0.743977294921875 +0.03 -0.49072265625 -0.743977294921875 +0.030125 -0.4541015625 -0.743977294921875 +0.03025 -0.411102294921875 -0.743977294921875 +0.030375 -0.35906982421875 -0.743977294921875 +0.0305 -0.3031005859375 -0.743977294921875 +0.030625 -0.253082275390625 -0.743977294921875 +0.03075 -0.1905517578125 -0.743977294921875 +0.03087499999999999 -0.1324462890625 -0.743977294921875 +0.031 -0.06658935546875 -0.743977294921875 +0.031125 0.0 -0.743977294921875 +0.03125 0.0606689453125 -0.743977294921875 +0.031375 0.12750244140625 -0.743977294921875 +0.0315 0.186492919921875 -0.743977294921875 +0.03162500000000001 0.25311279296875 -0.743977294921875 +0.03175 0.314697265625 -0.743977294921875 +0.031875 0.3671875 -0.743977294921875 +0.032 0.4267578125 -0.487985107421875 +0.032125 0.472412109375 -0.487985107421875 +0.03225 0.518157958984375 -0.487985107421875 +0.032375 0.564849853515625 -0.487985107421875 +0.0325 0.5960693359375 -0.487985107421875 +0.032625 0.624542236328125 -0.487985107421875 +0.03275 0.65179443359375 -0.487985107421875 +0.032875 0.667266845703125 -0.487985107421875 +0.033 0.6754150390625 -0.487985107421875 +0.033125 0.684051513671875 -0.487985107421875 +0.03325 0.678070068359375 -0.487985107421875 +0.033375 0.66632080078125 -0.487985107421875 +0.0335 0.646331787109375 -0.487985107421875 +0.03362500000000001 0.626129150390625 -0.487985107421875 +0.03375 0.595611572265625 -0.487985107421875 +0.033875 0.555511474609375 -0.487985107421875 +0.034 0.519805908203125 -0.487985107421875 +0.03412500000000001 0.46807861328125 -0.487985107421875 +0.03425 0.4111328125 -0.487985107421875 +0.034375 0.35986328125 -0.487985107421875 +0.0345 0.294281005859375 -0.487985107421875 +0.034625 0.232452392578125 -0.487985107421875 +0.03475000000000001 0.1630859375 -0.487985107421875 +0.034875 0.0894775390625 -0.487985107421875 +0.035 0.02239990234375 -0.487985107421875 +0.03512500000000001 -0.05279541015625 -0.487985107421875 +0.03525 -0.12030029296875 -0.487985107421875 +0.035375 -0.194000244140625 -0.487985107421875 +0.0355 -0.268280029296875 -0.487985107421875 +0.03562500000000001 -0.33087158203125 -0.487985107421875 +0.03575 -0.396942138671875 -0.487985107421875 +0.035875 -0.457122802734375 -0.487985107421875 +0.03600000000000001 -0.514892578125 -0.487985107421875 +0.036125 -0.567047119140625 -0.487985107421875 +0.03625 -0.614501953125 -0.487985107421875 +0.036375 -0.65478515625 -0.487985107421875 +0.0365 -0.6849365234375 -0.487985107421875 +0.036625 -0.711273193359375 -0.487985107421875 +0.03675 -0.736663818359375 -0.487985107421875 +0.036875 -0.746612548828125 -0.487985107421875 +0.037 -0.749908447265625 -0.487985107421875 +0.03712499999999999 -0.752685546875 -0.487985107421875 +0.03725 -0.74029541015625 -0.487985107421875 +0.037375 -0.719818115234375 -0.487985107421875 +0.0375 -0.700836181640625 -0.487985107421875 +0.037625 -0.665313720703125 -0.487985107421875 +0.03775 -0.627044677734375 -0.487985107421875 +0.037875 -0.5831298828125 -0.487985107421875 +0.038 -0.527313232421875 -0.487985107421875 +0.038125 -0.47216796875 -0.487985107421875 +0.03825 -0.409423828125 -0.487985107421875 +0.038375 -0.345458984375 -0.487985107421875 +0.0385 -0.27081298828125 -0.487985107421875 +0.038625 -0.19482421875 -0.487985107421875 +0.03875 -0.122528076171875 -0.487985107421875 +0.038875 -0.04095458984375 -0.487985107421875 +0.039 0.033050537109375 -0.487985107421875 +0.039125 0.1153564453125 -0.487985107421875 +0.03925 0.1964111328125 -0.487985107421875 +0.039375 0.269744873046875 -0.487985107421875 +0.0395 0.346588134765625 -0.487985107421875 +0.039625 0.41253662109375 -0.487985107421875 +0.03975 0.485260009765625 -0.487985107421875 +0.039875 0.5494384765625 -0.487985107421875 +0.04 0.60205078125 -0.487985107421875 +0.040125 0.654266357421875 -0.487985107421875 +0.04025 0.70050048828125 -0.487985107421875 +0.040375 0.73895263671875 -0.487985107421875 +0.04050000000000001 0.769287109375 -0.487985107421875 +0.040625 0.79534912109375 -0.487985107421875 +0.04075 0.8095703125 -0.487985107421875 +0.040875 0.814788818359375 -0.487985107421875 +0.04100000000000001 0.818115234375 -0.487985107421875 +0.041125 0.80645751953125 -0.487985107421875 +0.04125 0.78839111328125 -0.487985107421875 +0.041375 0.765625 -0.487985107421875 +0.0415 0.732818603515625 -0.487985107421875 +0.041625 0.688751220703125 -0.487985107421875 +0.04175000000000001 0.641632080078125 -0.487985107421875 +0.041875 0.588836669921875 -0.487985107421875 +0.042 0.5240478515625 -0.487985107421875 +0.042125 0.4639892578125 -0.487985107421875 +0.04225000000000001 0.388458251953125 -0.487985107421875 +0.042375 0.30865478515625 -0.487985107421875 +0.0425 0.2354736328125 -0.487985107421875 +0.042625 0.149444580078125 -0.487985107421875 +0.04275 0.070587158203125 -0.487985107421875 +0.04287500000000001 -0.017730712890625 -0.487985107421875 +0.04300000000000001 -0.1064453125 -0.487985107421875 +0.043125 -0.185302734375 -0.487985107421875 +0.04325 -0.27099609375 -0.487985107421875 +0.043375 -0.347808837890625 -0.487985107421875 +0.04350000000000001 -0.427581787109375 -0.487985107421875 +0.04362500000000001 -0.50262451171875 -0.487985107421875 +0.04375000000000001 -0.569091796875 -0.487985107421875 +0.043875 -0.6334228515625 -0.487985107421875 +0.04399999999999999 -0.685455322265625 -0.487985107421875 +0.044125 -0.740631103515625 -0.487985107421875 +0.04425 -0.783477783203125 -0.487985107421875 +0.044375 -0.814666748046875 -0.487985107421875 +0.04449999999999999 -0.845916748046875 -0.487985107421875 +0.04462499999999999 -0.854583740234375 -0.487985107421875 +0.04475 -0.854644775390625 -0.487985107421875 +0.044875 -0.854705810546875 -0.487985107421875 +0.045 -0.8546142578125 -0.487985107421875 +0.045125 -0.846282958984375 -0.487985107421875 +0.04525 -0.82586669921875 -0.487985107421875 +0.045375 -0.789215087890625 -0.487985107421875 +0.0455 -0.74395751953125 -0.487985107421875 +0.045625 -0.700103759765625 -0.487985107421875 +0.04575 -0.639495849609375 -0.487985107421875 +0.045875 -0.57891845703125 -0.487985107421875 +0.046 -0.50836181640625 -0.487985107421875 +0.046125 -0.42913818359375 -0.487985107421875 +0.04625 -0.353790283203125 -0.487985107421875 +0.046375 -0.26776123046875 -0.487985107421875 +0.04649999999999999 -0.1861572265625 -0.487985107421875 +0.046625 -0.09356689453125 -0.487985107421875 +0.04675000000000001 0.0 -0.487985107421875 +0.046875 0.08465576171875 -0.487985107421875 +0.04699999999999999 0.177886962890625 -0.487985107421875 +0.047125 0.2601318359375 -0.487985107421875 +0.04725000000000001 0.350555419921875 -0.487985107421875 +0.047375 0.435821533203125 -0.487985107421875 +0.0475 0.508453369140625 -0.487985107421875 +0.047625 0.58673095703125 -0.487985107421875 +0.04775 0.64947509765625 -0.487985107421875 +0.047875 0.71240234375 -0.487985107421875 +0.048 0.771209716796875 -0.487985107421875 +0.048125 0.8138427734375 -0.487985107421875 +0.04825 0.85272216796875 -0.487985107421875 +0.048375 0.854766845703125 -0.487985107421875 +0.0485 0.854949951171875 -0.487985107421875 +0.048625 0.855072021484375 -0.487985107421875 +0.04875 0.8551025390625 -0.487985107421875 +0.048875 0.85504150390625 -0.487985107421875 +0.049 0.854888916015625 -0.487985107421875 +0.04912500000000001 0.85467529296875 -0.487985107421875 +0.04925000000000001 0.837615966796875 -0.487985107421875 +0.049375 0.796783447265625 -0.487985107421875 +0.0495 0.74627685546875 -0.487985107421875 +0.049625 0.6907958984375 -0.487985107421875 +0.04975000000000001 0.62200927734375 -0.487985107421875 +0.04987500000000001 0.548583984375 -0.487985107421875 +0.05 0.475128173828125 -0.487985107421875 +0.05012499999999999 0.3885498046875 -0.487985107421875 +0.05025 0.306915283203125 -0.487985107421875 +0.05037500000000001 0.213958740234375 -0.487985107421875 +0.0505 0.117401123046875 -0.487985107421875 +0.05062500000000001 0.029388427734375 -0.487985107421875 +0.05075000000000001 -0.06884765625 -0.487985107421875 +0.050875 -0.156829833984375 -0.487985107421875 +0.051 -0.2529296875 -0.487985107421875 +0.051125 -0.347564697265625 -0.487985107421875 +0.05125000000000001 -0.428619384765625 -0.487985107421875 +0.051375 -0.51422119140625 -0.487985107421875 +0.0515 -0.588592529296875 -0.487985107421875 +0.05162500000000001 -0.6629638671875 -0.487985107421875 +0.05175000000000001 -0.730133056640625 -0.487985107421875 +0.051875 -0.78643798828125 -0.487985107421875 +0.052 -0.8380126953125 -0.487985107421875 +0.052125 -0.854705810546875 -0.487985107421875 +0.05225 -0.855072021484375 -0.487985107421875 +0.05237499999999999 -0.85528564453125 -0.487985107421875 +0.0525 -0.85540771484375 -0.487985107421875 +0.052625 -0.85546875 -0.487985107421875 +0.05274999999999999 -0.855438232421875 -0.487985107421875 +0.052875 -0.85528564453125 -0.487985107421875 +0.05300000000000001 -0.855072021484375 -0.487985107421875 +0.053125 -0.854766845703125 -0.487985107421875 +0.05324999999999999 -0.836456298828125 -0.487985107421875 +0.05337499999999999 -0.78839111328125 -0.487985107421875 +0.05350000000000001 -0.72894287109375 -0.487985107421875 +0.053625 -0.6591796875 -0.487985107421875 +0.05375 -0.5902099609375 -0.487985107421875 +0.05387499999999999 -0.50885009765625 -0.487985107421875 +0.054 -0.42938232421875 -0.487985107421875 +0.054125 -0.33660888671875 -0.487985107421875 +0.05425 -0.24078369140625 -0.487985107421875 +0.054375 -0.15142822265625 -0.487985107421875 +0.0545 -0.050628662109375 -0.487985107421875 +0.054625 0.040618896484375 -0.487985107421875 +0.05475 0.14178466796875 -0.487985107421875 +0.054875 0.241424560546875 -0.487985107421875 +0.055 0.3297119140625 -0.487985107421875 +0.055125 0.42364501953125 -0.487985107421875 +0.05525 0.50421142578125 -0.487985107421875 +0.055375 0.589874267578125 -0.487985107421875 +0.05550000000000001 0.66790771484375 -0.487985107421875 +0.055625 0.73187255859375 -0.487985107421875 +0.05575 0.797149658203125 -0.487985107421875 +0.05587499999999999 0.846954345703125 -0.487985107421875 +0.05600000000000001 0.8548583984375 -0.487985107421875 +0.05612500000000001 0.855224609375 -0.487985107421875 +0.05625 0.855438232421875 -0.487985107421875 +0.05637499999999999 0.855621337890625 -0.487985107421875 +0.0565 0.855682373046875 -0.487985107421875 +0.05662500000000001 0.85565185546875 -0.487985107421875 +0.05675 0.85552978515625 -0.487985107421875 +0.056875 0.855316162109375 -0.487985107421875 +0.05700000000000001 0.855010986328125 -0.487985107421875 +0.057125 0.854644775390625 -0.487985107421875 +0.05725 0.819610595703125 -0.487985107421875 +0.057375 0.75958251953125 -0.487985107421875 +0.05750000000000001 0.697052001953125 -0.487985107421875 +0.057625 0.620361328125 -0.487985107421875 +0.05775 0.546417236328125 -0.487985107421875 +0.057875 0.457489013671875 -0.487985107421875 +0.05800000000000001 0.363494873046875 -0.487985107421875 +0.058125 0.275909423828125 -0.487985107421875 +0.05825 0.17510986328125 -0.487985107421875 +0.058375 0.08270263671875 -0.487985107421875 +0.05850000000000001 -0.02069091796875 -0.487985107421875 +0.05862500000000001 -0.12408447265625 -0.487985107421875 +0.05875 -0.216033935546875 -0.487985107421875 +0.058875 -0.316375732421875 -0.487985107421875 +0.059 -0.4034423828125 -0.487985107421875 +0.05912500000000001 -0.4959716796875 -0.487985107421875 +0.05925000000000001 -0.583740234375 -0.487985107421875 +0.059375 -0.65679931640625 -0.487985107421875 +0.05950000000000001 -0.731048583984375 -0.487985107421875 +0.059625 -0.7919921875 -0.487985107421875 +0.05975000000000001 -0.85052490234375 -0.487985107421875 +0.059875 -0.854949951171875 -0.487985107421875 +0.06 -0.85528564453125 -0.487985107421875 +0.06012499999999999 -0.855560302734375 -0.487985107421875 +0.06025 -0.855743408203125 -0.487985107421875 +0.060375 -0.8558349609375 -0.487985107421875 +0.0605 -0.8558349609375 -0.487985107421875 +0.060625 -0.855743408203125 -0.487985107421875 +0.06074999999999999 -0.85552978515625 -0.487985107421875 +0.060875 -0.855255126953125 -0.487985107421875 +0.061 -0.854888916015625 -0.487985107421875 +0.061125 -0.8419189453125 -0.487985107421875 +0.06125 -0.7884521484375 -0.487985107421875 +0.061375 -0.720184326171875 -0.487985107421875 +0.0615 -0.6519775390625 -0.487985107421875 +0.061625 -0.569793701171875 -0.487985107421875 +0.06174999999999999 -0.480987548828125 -0.487985107421875 +0.061875 -0.396514892578125 -0.487985107421875 +0.062 -0.2987060546875 -0.487985107421875 +0.06212499999999999 -0.2076416015625 -0.487985107421875 +0.06225000000000001 -0.1043701171875 -0.487985107421875 +0.06237500000000001 0.0 -0.487985107421875 +0.0625 0.093994140625 -0.487985107421875 +0.06262499999999999 0.197479248046875 -0.487985107421875 +0.06274999999999999 0.28887939453125 -0.487985107421875 +0.06287500000000001 0.3873291015625 -0.487985107421875 +0.063 0.481536865234375 -0.487985107421875 +0.063125 0.561920166015625 -0.487985107421875 +0.06325000000000001 0.645294189453125 -0.487985107421875 +0.063375 0.71429443359375 -0.487985107421875 +0.0635 0.78350830078125 -0.487985107421875 +0.063625 0.844207763671875 -0.487985107421875 +0.06375 0.854827880859375 -0.487985107421875 +0.063875 0.855224609375 -0.487985107421875 +0.064 0.855499267578125 -0.2319929199218749 +0.064125 0.855712890625 -0.2319929199218749 +0.06425000000000001 0.8558349609375 -0.2319929199218749 +0.064375 0.855865478515625 -0.2319929199218749 +0.0645 0.85577392578125 -0.2319929199218749 +0.064625 0.8555908203125 -0.2319929199218749 +0.06475 0.855316162109375 -0.2319929199218749 +0.06487500000000001 0.854949951171875 -0.2319929199218749 +0.065 0.854522705078125 -0.2319929199218749 +0.065125 0.80194091796875 -0.2319929199218749 +0.06525 0.741973876953125 -0.2319929199218749 +0.06537500000000001 0.6680908203125 -0.2319929199218749 +0.06550000000000001 0.586822509765625 -0.2319929199218749 +0.065625 0.507904052734375 -0.2319929199218749 +0.06574999999999999 0.415374755859375 -0.2319929199218749 +0.065875 0.327880859375 -0.2319929199218749 +0.06600000000000001 0.2276611328125 -0.2319929199218749 +0.066125 0.124908447265625 -0.2319929199218749 +0.06625000000000001 0.03125 -0.2319929199218749 +0.06637500000000001 -0.072906494140625 -0.2319929199218749 +0.0665 -0.166107177734375 -0.2319929199218749 +0.066625 -0.26763916015625 -0.2319929199218749 +0.06675 -0.36639404296875 -0.2319929199218749 +0.06687500000000001 -0.451385498046875 -0.2319929199218749 +0.067 -0.541534423828125 -0.2319929199218749 +0.067125 -0.61761474609375 -0.2319929199218749 +0.06725000000000001 -0.694854736328125 -0.2319929199218749 +0.06737500000000001 -0.7652587890625 -0.2319929199218749 +0.0675 -0.82037353515625 -0.2319929199218749 +0.067625 -0.854705810546875 -0.2319929199218749 +0.06775 -0.855072021484375 -0.2319929199218749 +0.06787500000000001 -0.85540771484375 -0.2319929199218749 +0.06800000000000001 -0.855621337890625 -0.2319929199218749 +0.068125 -0.85577392578125 -0.2319929199218749 +0.06825000000000001 -0.85577392578125 -0.2319929199218749 +0.068375 -0.855743408203125 -0.2319929199218749 +0.06850000000000001 -0.855560302734375 -0.2319929199218749 +0.06862500000000001 -0.855316162109375 -0.2319929199218749 +0.06875 -0.855010986328125 -0.2319929199218749 +0.06887500000000001 -0.85455322265625 -0.2319929199218749 +0.069 -0.80950927734375 -0.2319929199218749 +0.06912500000000001 -0.744903564453125 -0.2319929199218749 +0.06925000000000001 -0.673583984375 -0.2319929199218749 +0.06937500000000001 -0.60308837890625 -0.2319929199218749 +0.06950000000000001 -0.517486572265625 -0.2319929199218749 +0.069625 -0.436676025390625 -0.2319929199218749 +0.06975 -0.342315673828125 -0.2319929199218749 +0.06987500000000001 -0.243682861328125 -0.2319929199218749 +0.07000000000000001 -0.15325927734375 -0.2319929199218749 +0.070125 -0.051116943359375 -0.2319929199218749 +0.07025000000000001 0.0408935546875 -0.2319929199218749 +0.07037500000000001 0.142822265625 -0.2319929199218749 +0.07050000000000001 0.24261474609375 -0.2319929199218749 +0.070625 0.33050537109375 -0.2319929199218749 +0.07075 0.42364501953125 -0.2319929199218749 +0.07087500000000001 0.50421142578125 -0.2319929199218749 +0.07100000000000001 0.588470458984375 -0.2319929199218749 +0.07112500000000001 0.664642333984375 -0.2319929199218749 +0.07125000000000002 0.728302001953125 -0.2319929199218749 +0.07137500000000001 0.791473388671875 -0.2319929199218749 +0.0715 0.83868408203125 -0.2319929199218749 +0.07162500000000001 0.854766845703125 -0.2319929199218749 +0.07175000000000001 0.855072021484375 -0.2319929199218749 +0.07187500000000001 0.855316162109375 -0.2319929199218749 +0.07200000000000001 0.85546875 -0.2319929199218749 +0.07212499999999999 0.855499267578125 -0.2319929199218749 +0.07225 0.85546875 -0.2319929199218749 +0.07237499999999999 0.855316162109375 -0.2319929199218749 +0.0725 0.855133056640625 -0.2319929199218749 +0.07262499999999999 0.85479736328125 -0.2319929199218749 +0.07274999999999999 0.848236083984375 -0.2319929199218749 +0.072875 0.797210693359375 -0.2319929199218749 +0.073 0.73748779296875 -0.2319929199218749 +0.073125 0.674591064453125 -0.2319929199218749 +0.07324999999999999 0.600372314453125 -0.2319929199218749 +0.07337499999999999 0.526153564453125 -0.2319929199218749 +0.0735 0.440521240234375 -0.2319929199218749 +0.073625 0.35003662109375 -0.2319929199218749 +0.07374999999999999 0.26434326171875 -0.2319929199218749 +0.073875 0.167755126953125 -0.2319929199218749 +0.074 0.0792236328125 -0.2319929199218749 +0.074125 -0.01971435546875 -0.2319929199218749 +0.07424999999999999 -0.1182861328125 -0.2319929199218749 +0.07437499999999999 -0.205169677734375 -0.2319929199218749 +0.0745 -0.300018310546875 -0.2319929199218749 +0.07462499999999999 -0.382598876953125 -0.2319929199218749 +0.07475 -0.468536376953125 -0.2319929199218749 +0.07487500000000001 -0.55078125 -0.2319929199218749 +0.075 -0.61724853515625 -0.2319929199218749 +0.07512499999999999 -0.687042236328125 -0.2319929199218749 +0.07524999999999999 -0.74346923828125 -0.2319929199218749 +0.075375 -0.795135498046875 -0.2319929199218749 +0.0755 -0.84112548828125 -0.2319929199218749 +0.075625 -0.854705810546875 -0.2319929199218749 +0.07574999999999999 -0.85491943359375 -0.2319929199218749 +0.075875 -0.8551025390625 -0.2319929199218749 +0.076 -0.855133056640625 -0.2319929199218749 +0.076125 -0.855133056640625 -0.2319929199218749 +0.07625 -0.85504150390625 -0.2319929199218749 +0.07637499999999999 -0.85479736328125 -0.2319929199218749 +0.0765 -0.85455322265625 -0.2319929199218749 +0.076625 -0.818115234375 -0.2319929199218749 +0.07675 -0.771209716796875 -0.2319929199218749 +0.076875 -0.721710205078125 -0.2319929199218749 +0.077 -0.656097412109375 -0.2319929199218749 +0.077125 -0.593963623046875 -0.2319929199218749 +0.07725 -0.518768310546875 -0.2319929199218749 +0.07737499999999999 -0.435821533203125 -0.2319929199218749 +0.0775 -0.3592529296875 -0.2319929199218749 +0.077625 -0.269134521484375 -0.2319929199218749 +0.07774999999999999 -0.187103271484375 -0.2319929199218749 +0.07787500000000001 -0.09405517578125 -0.2319929199218749 +0.07800000000000001 0.0 -0.2319929199218749 +0.078125 0.084228515625 -0.2319929199218749 +0.07824999999999999 0.176025390625 -0.2319929199218749 +0.07837499999999999 0.2574462890625 -0.2319929199218749 +0.07850000000000001 0.345184326171875 -0.2319929199218749 +0.078625 0.426849365234375 -0.2319929199218749 +0.07875 0.498016357421875 -0.2319929199218749 +0.07887500000000001 0.571868896484375 -0.2319929199218749 +0.079 0.629547119140625 -0.2319929199218749 +0.079125 0.690521240234375 -0.2319929199218749 +0.07925 0.73974609375 -0.2319929199218749 +0.079375 0.7806396484375 -0.2319929199218749 +0.0795 0.81793212890625 -0.2319929199218749 +0.079625 0.838958740234375 -0.2319929199218749 +0.07975 0.854522705078125 -0.2319929199218749 +0.07987500000000001 0.854583740234375 -0.2319929199218749 +0.08 0.854583740234375 -0.2319929199218749 +0.08012499999999999 0.854522705078125 -0.2319929199218749 +0.08025 0.83782958984375 -0.2319929199218749 +0.080375 0.812713623046875 -0.2319929199218749 +0.08050000000000001 0.778656005859375 -0.2319929199218749 +0.080625 0.736083984375 -0.2319929199218749 +0.08074999999999999 0.686553955078125 -0.2319929199218749 +0.080875 0.631439208984375 -0.2319929199218749 +0.08100000000000001 0.568572998046875 -0.2319929199218749 +0.08112500000000001 0.49945068359375 -0.2319929199218749 +0.08125 0.429718017578125 -0.2319929199218749 +0.08137499999999999 0.351409912109375 -0.2319929199218749 +0.0815 0.277587890625 -0.2319929199218749 +0.081625 0.191436767578125 -0.2319929199218749 +0.08175000000000001 0.10504150390625 -0.2319929199218749 +0.081875 0.026123046875 -0.2319929199218749 +0.08200000000000001 -0.060943603515625 -0.2319929199218749 +0.082125 -0.138824462890625 -0.2319929199218749 +0.08225 -0.222320556640625 -0.2319929199218749 +0.08237500000000001 -0.30438232421875 -0.2319929199218749 +0.0825 -0.3726806640625 -0.2319929199218749 +0.08262500000000001 -0.4471435546875 -0.2319929199218749 +0.08275 -0.509918212890625 -0.2319929199218749 +0.08287500000000001 -0.5701904296875 -0.2319929199218749 +0.08300000000000001 -0.6279296875 -0.2319929199218749 +0.083125 -0.674041748046875 -0.2319929199218749 +0.08324999999999999 -0.712860107421875 -0.2319929199218749 +0.083375 -0.74566650390625 -0.2319929199218749 +0.08350000000000001 -0.768402099609375 -0.2319929199218749 +0.08362500000000001 -0.788421630859375 -0.2319929199218749 +0.08375 -0.799072265625 -0.2319929199218749 +0.08387500000000001 -0.79632568359375 -0.2319929199218749 +0.084 -0.7919921875 -0.2319929199218749 +0.08412500000000001 -0.772735595703125 -0.2319929199218749 +0.08425000000000001 -0.7513427734375 -0.2319929199218749 +0.084375 -0.72503662109375 -0.2319929199218749 +0.08450000000000001 -0.682647705078125 -0.2319929199218749 +0.084625 -0.643402099609375 -0.2319929199218749 +0.08475 -0.593109130859375 -0.2319929199218749 +0.08487500000000001 -0.5318603515625 -0.2319929199218749 +0.085 -0.476226806640625 -0.2319929199218749 +0.08512500000000001 -0.40594482421875 -0.2319929199218749 +0.08525 -0.342529296875 -0.2319929199218749 +0.085375 -0.26849365234375 -0.2319929199218749 +0.08550000000000001 -0.18988037109375 -0.2319929199218749 +0.085625 -0.119415283203125 -0.2319929199218749 +0.08575000000000001 -0.03955078125 -0.2319929199218749 +0.08587500000000002 0.031646728515625 -0.2319929199218749 +0.08600000000000001 0.110504150390625 -0.2319929199218749 +0.08612500000000001 0.18646240234375 -0.2319929199218749 +0.08625 0.253997802734375 -0.2319929199218749 +0.08637499999999999 0.326385498046875 -0.2319929199218749 +0.0865 0.3848876953125 -0.2319929199218749 +0.08662500000000001 0.449188232421875 -0.2319929199218749 +0.08675000000000001 0.503753662109375 -0.2319929199218749 +0.08687500000000002 0.552001953125 -0.2319929199218749 +0.08700000000000001 0.599884033203125 -0.2319929199218749 +0.087125 0.631195068359375 -0.2319929199218749 +0.08725000000000001 0.66583251953125 -0.2319929199218749 +0.08737500000000001 0.686279296875 -0.2319929199218749 +0.08750000000000002 0.7042236328125 -0.2319929199218749 +0.08762500000000001 0.716796875 -0.2319929199218749 +0.08775 0.71417236328125 -0.2319929199218749 +0.08787500000000001 0.71185302734375 -0.2319929199218749 +0.08799999999999999 0.701690673828125 -0.2319929199218749 +0.088125 0.678863525390625 -0.2319929199218749 +0.08824999999999999 0.654541015625 -0.2319929199218749 +0.08837499999999999 0.619903564453125 -0.2319929199218749 +0.0885 0.582611083984375 -0.2319929199218749 +0.08862500000000001 0.538970947265625 -0.2319929199218749 +0.08875 0.48931884765625 -0.2319929199218749 +0.08887499999999999 0.43548583984375 -0.2319929199218749 +0.08899999999999999 0.3829345703125 -0.2319929199218749 +0.089125 0.317047119140625 -0.2319929199218749 +0.08924999999999999 0.251922607421875 -0.2319929199218749 +0.089375 0.18878173828125 -0.2319929199218749 +0.08949999999999999 0.11981201171875 -0.2319929199218749 +0.089625 0.05657958984375 -0.2319929199218749 +0.08975 -0.01397705078125 -0.2319929199218749 +0.08987499999999999 -0.08380126953125 -0.2319929199218749 +0.09 -0.144195556640625 -0.2319929199218749 +0.09012499999999999 -0.21087646484375 -0.2319929199218749 +0.09025 -0.268890380859375 -0.2319929199218749 +0.090375 -0.326629638671875 -0.2319929199218749 +0.09050000000000001 -0.38397216796875 -0.2319929199218749 +0.090625 -0.432037353515625 -0.2319929199218749 +0.09074999999999999 -0.475006103515625 -0.2319929199218749 +0.09087499999999999 -0.51397705078125 -0.2319929199218749 +0.091 -0.54510498046875 -0.2319929199218749 +0.09112500000000001 -0.576629638671875 -0.2319929199218749 +0.09125 -0.599609375 -0.2319929199218749 +0.09137499999999999 -0.61102294921875 -0.2319929199218749 +0.0915 -0.622406005859375 -0.2319929199218749 +0.091625 -0.6204833984375 -0.2319929199218749 +0.09175000000000001 -0.61981201171875 -0.2319929199218749 +0.091875 -0.613372802734375 -0.2319929199218749 +0.09199999999999999 -0.591888427734375 -0.2319929199218749 +0.092125 -0.5743408203125 -0.2319929199218749 +0.09225 -0.548858642578125 -0.2319929199218749 +0.09237499999999999 -0.510345458984375 -0.2319929199218749 +0.0925 -0.477630615234375 -0.2319929199218749 +0.09262499999999999 -0.43023681640625 -0.2319929199218749 +0.09275 -0.389495849609375 -0.2319929199218749 +0.092875 -0.340179443359375 -0.2319929199218749 +0.09299999999999999 -0.2830810546875 -0.2319929199218749 +0.093125 -0.233367919921875 -0.2319929199218749 +0.09324999999999999 -0.17315673828125 -0.2319929199218749 +0.093375 -0.120361328125 -0.2319929199218749 +0.09350000000000001 -0.06048583984375 -0.2319929199218749 +0.09362500000000001 0.0 -0.2319929199218749 +0.09375 0.05364990234375 -0.2319929199218749 +0.09387499999999999 0.11273193359375 -0.2319929199218749 +0.09399999999999999 0.162384033203125 -0.2319929199218749 +0.094125 0.217742919921875 -0.2319929199218749 +0.09425000000000001 0.266510009765625 -0.2319929199218749 +0.094375 0.310943603515625 -0.2319929199218749 +0.09450000000000001 0.357086181640625 -0.2319929199218749 +0.094625 0.389068603515625 -0.2319929199218749 +0.09475 0.4267578125 -0.2319929199218749 +0.09487500000000001 0.45977783203125 -0.2319929199218749 +0.095 0.477325439453125 -0.2319929199218749 +0.09512500000000001 0.5001220703125 -0.2319929199218749 +0.09525 0.50738525390625 -0.2319929199218749 +0.095375 0.519439697265625 -0.2319929199218749 +0.09550000000000001 0.525787353515625 -0.2319929199218749 +0.095625 0.51763916015625 -0.2319929199218749 +0.09574999999999999 0.51312255859375 -0.2319929199218749 +0.095875 0.4954833984375 -0.2319929199218749 +0.096 0.480621337890625 0.02399926757812504 +0.09612500000000001 0.460479736328125 0.02399926757812504 +0.09625 0.430267333984375 0.02399926757812504 +0.09637499999999999 0.40130615234375 0.02399926757812504 +0.0965 0.364715576171875 0.02399926757812504 +0.09662500000000001 0.328399658203125 0.02399926757812504 +0.09675000000000001 0.2830810546875 0.02399926757812504 +0.096875 0.245147705078125 0.02399926757812504 +0.09699999999999999 0.1966552734375 0.02399926757812504 +0.097125 0.15533447265625 0.02399926757812504 +0.09725 0.105743408203125 0.02399926757812504 +0.09737500000000001 0.058013916015625 0.02399926757812504 +0.0975 0.01422119140625 0.02399926757812504 +0.09762500000000001 -0.033203125 0.02399926757812504 +0.09775 -0.075653076171875 0.02399926757812504 +0.097875 -0.1195068359375 0.02399926757812504 +0.09800000000000001 -0.163604736328125 0.02399926757812504 +0.098125 -0.197509765625 0.02399926757812504 +0.09825000000000001 -0.236968994140625 0.02399926757812504 +0.098375 -0.264404296875 0.02399926757812504 +0.09850000000000001 -0.297821044921875 0.02399926757812504 +0.09862500000000001 -0.3206787109375 0.02399926757812504 +0.09875 -0.344207763671875 0.02399926757812504 +0.09887499999999999 -0.358367919921875 0.02399926757812504 +0.099 -0.3748779296875 0.02399926757812504 +0.09912500000000001 -0.3892822265625 0.02399926757812504 +0.09925000000000001 -0.3900146484375 0.02399926757812504 +0.099375 -0.395294189453125 0.02399926757812504 +0.09950000000000001 -0.38739013671875 0.02399926757812504 +0.099625 -0.385284423828125 0.02399926757812504 +0.09975000000000001 -0.369476318359375 0.02399926757812504 +0.09987500000000001 -0.3592529296875 0.02399926757812504 +0.1 -0.3377685546875 0.02399926757812504 +0.100125 -0.320648193359375 0.02399926757812504 +0.10025 -0.294189453125 0.02399926757812504 +0.100375 -0.271209716796875 0.02399926757812504 +0.1005 -0.2452392578125 0.02399926757812504 +0.100625 -0.21356201171875 0.02399926757812504 +0.10075 -0.18359375 0.02399926757812504 +0.100875 -0.150543212890625 0.02399926757812504 +0.101 -0.118011474609375 0.02399926757812504 +0.101125 -0.08172607421875 0.02399926757812504 +0.10125 -0.0513916015625 0.02399926757812504 +0.101375 -0.016632080078125 0.02399926757812504 +0.1015 0.0133056640625 0.02399926757812504 +0.101625 0.045074462890625 0.02399926757812504 +0.10175 0.0767822265625 0.02399926757812504 +0.101875 0.101226806640625 0.02399926757812504 +0.102 0.130096435546875 0.02399926757812504 +0.102125 0.15484619140625 0.02399926757812504 +0.10225 0.1746826171875 0.02399926757812504 +0.102375 0.197784423828125 0.02399926757812504 +0.1025 0.209197998046875 0.02399926757812504 +0.102625 0.227325439453125 0.02399926757812504 +0.10275 0.232818603515625 0.02399926757812504 +0.102875 0.245574951171875 0.02399926757812504 +0.103 0.246063232421875 0.02399926757812504 +0.103125 0.25250244140625 0.02399926757812504 +0.10325 0.2469482421875 0.02399926757812504 +0.103375 0.24853515625 0.02399926757812504 +0.1035 0.24774169921875 0.02399926757812504 +0.103625 0.2342529296875 0.02399926757812504 +0.10375 0.22900390625 0.02399926757812504 +0.103875 0.21136474609375 0.02399926757812504 +0.104 0.202301025390625 0.02399926757812504 +0.104125 0.181610107421875 0.02399926757812504 +0.10425 0.167999267578125 0.02399926757812504 +0.104375 0.146942138671875 0.02399926757812504 +0.1045 0.130767822265625 0.02399926757812504 +0.104625 0.10931396484375 0.02399926757812504 +0.10475 0.091522216796875 0.02399926757812504 +0.104875 0.06890869140625 0.02399926757812504 +0.105 0.052215576171875 0.02399926757812504 +0.105125 0.033111572265625 0.02399926757812504 +0.10525 0.0147705078125 0.02399926757812504 +0.105375 -0.003662109375 0.02399926757812504 +0.1055 -0.020843505859375 0.02399926757812504 +0.105625 -0.03631591796875 0.02399926757812504 +0.10575 -0.049835205078125 0.02399926757812504 +0.105875 -0.063568115234375 0.02399926757812504 +0.106 -0.072967529296875 0.02399926757812504 +0.106125 -0.085784912109375 0.02399926757812504 +0.10625 -0.089691162109375 0.02399926757812504 +0.106375 -0.099822998046875 0.02399926757812504 +0.1065 -0.1080322265625 0.02399926757812504 +0.106625 -0.10711669921875 0.02399926757812504 +0.10675 -0.11334228515625 0.02399926757812504 +0.106875 -0.10809326171875 0.02399926757812504 +0.107 -0.111572265625 0.02399926757812504 +0.107125 -0.103363037109375 0.02399926757812504 +0.10725 -0.1043701171875 0.02399926757812504 +0.107375 -0.093841552734375 0.02399926757812504 +0.1075 -0.092864990234375 0.02399926757812504 +0.107625 -0.08074951171875 0.02399926757812504 +0.10775 -0.078338623046875 0.02399926757812504 +0.107875 -0.065521240234375 0.02399926757812504 +0.108 -0.061767578125 0.02399926757812504 +0.108125 -0.05780029296875 0.02399926757812504 +0.10825 -0.045257568359375 0.02399926757812504 +0.108375 -0.040985107421875 0.02399926757812504 +0.1085 -0.029815673828125 0.02399926757812504 +0.108625 -0.025146484375 0.02399926757812504 +0.10875 -0.016571044921875 0.02399926757812504 +0.108875 -0.012481689453125 0.02399926757812504 +0.109 -0.0064697265625 0.02399926757812504 +0.109125 -0.00323486328125 0.02399926757812504 +0.10925 0.0 0.02399926757812504 +0.109375 0.001922607421875 0.02399926757812504 +0.1095 0.00408935546875 0.02399926757812504 +0.109625 0.00299072265625 0.02399926757812504 +0.10975 0.003997802734375 0.02399926757812504 +0.109875 0.0 0.02399926757812504 +0.11 0.0 0.02399926757812504 +0.110125 -0.0067138671875 0.02399926757812504 +0.11025 -0.0074462890625 0.02399926757812504 +0.110375 -0.016357421875 0.02399926757812504 +0.1105 -0.01763916015625 0.02399926757812504 +0.110625 -0.027923583984375 0.02399926757812504 +0.11075 -0.029266357421875 0.02399926757812504 +0.110875 -0.03021240234375 0.02399926757812504 +0.111 -0.041229248046875 0.02399926757812504 +0.111125 -0.041748046875 0.02399926757812504 +0.11125 -0.05224609375 0.02399926757812504 +0.111375 -0.051788330078125 0.02399926757812504 +0.1115 -0.061065673828125 0.02399926757812504 +0.111625 -0.059234619140625 0.02399926757812504 +0.11175 -0.066192626953125 0.02399926757812504 +0.111875 -0.062957763671875 0.02399926757812504 +0.112 -0.067108154296875 0.02399926757812504 +0.112125 -0.062103271484375 0.02399926757812504 +0.11225 -0.062896728515625 0.02399926757812504 +0.112375 -0.05523681640625 0.02399926757812504 +0.1125 -0.0478515625 0.02399926757812504 +0.112625 -0.04345703125 0.02399926757812504 +0.11275 -0.034332275390625 0.02399926757812504 +0.112875 -0.02618408203125 0.02399926757812504 +0.113 -0.01434326171875 0.02399926757812504 +0.113125 -0.003875732421875 0.02399926757812504 +0.11325 0.009124755859375 0.02399926757812504 +0.113375 0.0225830078125 0.02399926757812504 +0.1135 0.03643798828125 0.02399926757812504 +0.113625 0.0537109375 0.02399926757812504 +0.11375 0.066253662109375 0.02399926757812504 +0.113875 0.079498291015625 0.02399926757812504 +0.114 0.09710693359375 0.02399926757812504 +0.114125 0.109375 0.02399926757812504 +0.11425 0.12841796875 0.02399926757812504 +0.114375 0.137847900390625 0.02399926757812504 +0.1145 0.156005859375 0.02399926757812504 +0.114625 0.163177490234375 0.02399926757812504 +0.11475 0.179290771484375 0.02399926757812504 +0.114875 0.1839599609375 0.02399926757812504 +0.115 0.196685791015625 0.02399926757812504 +0.115125 0.19757080078125 0.02399926757812504 +0.11525 0.206695556640625 0.02399926757812504 +0.115375 0.203277587890625 0.02399926757812504 +0.1155 0.197662353515625 0.02399926757812504 +0.115625 0.200103759765625 0.02399926757812504 +0.11575 0.189971923828125 0.02399926757812504 +0.115875 0.18743896484375 0.02399926757812504 +0.116 0.17279052734375 0.02399926757812504 +0.116125 0.163238525390625 0.02399926757812504 +0.11625 0.146148681640625 0.02399926757812504 +0.116375 0.1309814453125 0.02399926757812504 +0.1165 0.110504150390625 0.02399926757812504 +0.116625 0.09014892578125 0.02399926757812504 +0.11675 0.064300537109375 0.02399926757812504 +0.116875 0.040435791015625 0.02399926757812504 +0.117 0.014007568359375 0.02399926757812504 +0.117125 -0.011199951171875 0.02399926757812504 +0.11725 -0.04071044921875 0.02399926757812504 +0.117375 -0.069305419921875 0.02399926757812504 +0.1175 -0.09783935546875 0.02399926757812504 +0.117625 -0.125732421875 0.02399926757812504 +0.11775 -0.15484619140625 0.02399926757812504 +0.117875 -0.18072509765625 0.02399926757812504 +0.118 -0.211456298828125 0.02399926757812504 +0.118125 -0.231719970703125 0.02399926757812504 +0.11825 -0.251800537109375 0.02399926757812504 +0.118375 -0.276153564453125 0.02399926757812504 +0.1185 -0.29132080078125 0.02399926757812504 +0.118625 -0.31268310546875 0.02399926757812504 +0.11875 -0.320831298828125 0.02399926757812504 +0.118875 -0.336395263671875 0.02399926757812504 +0.119 -0.33856201171875 0.02399926757812504 +0.119125 -0.347259521484375 0.02399926757812504 +0.11925 -0.342315673828125 0.02399926757812504 +0.119375 -0.34405517578125 0.02399926757812504 +0.1195 -0.33172607421875 0.02399926757812504 +0.119625 -0.326141357421875 0.02399926757812504 +0.11975 -0.306549072265625 0.02399926757812504 +0.119875 -0.2835693359375 0.02399926757812504 +0.12 -0.26708984375 0.02399926757812504 +0.120125 -0.237701416015625 0.02399926757812504 +0.12025 -0.21435546875 0.02399926757812504 +0.120375 -0.179443359375 0.02399926757812504 +0.1205 -0.146148681640625 0.02399926757812504 +0.120625 -0.110748291015625 0.02399926757812504 +0.12075 -0.07196044921875 0.02399926757812504 +0.120875 -0.033966064453125 0.02399926757812504 +0.121 0.0086669921875 0.02399926757812504 +0.121125 0.0521240234375 0.02399926757812504 +0.12125 0.09075927734375 0.02399926757812504 +0.121375 0.1357421875 0.02399926757812504 +0.1215 0.173095703125 0.02399926757812504 +0.121625 0.217559814453125 0.02399926757812504 +0.12175 0.2557373046875 0.02399926757812504 +0.121875 0.293975830078125 0.02399926757812504 +0.122 0.32720947265625 0.02399926757812504 +0.122125 0.36151123046875 0.02399926757812504 +0.12225 0.388214111328125 0.02399926757812504 +0.122375 0.419097900390625 0.02399926757812504 +0.1225 0.435791015625 0.02399926757812504 +0.122625 0.458831787109375 0.02399926757812504 +0.12275 0.4674072265625 0.02399926757812504 +0.122875 0.4720458984375 0.02399926757812504 +0.123 0.480712890625 0.02399926757812504 +0.123125 0.4757080078125 0.02399926757812504 +0.12325 0.474090576171875 0.02399926757812504 +0.123375 0.46002197265625 0.02399926757812504 +0.1235 0.44775390625 0.02399926757812504 +0.123625 0.422088623046875 0.02399926757812504 +0.12375 0.402130126953125 0.02399926757812504 +0.123875 0.3673095703125 0.02399926757812504 +0.124 0.338409423828125 0.02399926757812504 +0.124125 0.295562744140625 0.02399926757812504 +0.12425 0.249481201171875 0.02399926757812504 +0.124375 0.209197998046875 0.02399926757812504 +0.1245 0.157501220703125 0.02399926757812504 +0.124625 0.111328125 0.02399926757812504 +0.12475 0.05596923828125 0.02399926757812504 +0.124875 0.0 0.02399926757812504 +0.125 -0.05120849609375 0.02399926757812504 +0.125125 -0.10931396484375 0.02399926757812504 +0.12525 -0.159881591796875 0.02399926757812504 +0.125375 -0.217742919921875 0.02399926757812504 +0.1255 -0.27069091796875 0.02399926757812504 +0.125625 -0.31585693359375 0.02399926757812504 +0.12575 -0.3682861328125 0.02399926757812504 +0.125875 -0.407684326171875 0.02399926757812504 +0.126 -0.453887939453125 0.02399926757812504 +0.126125 -0.489013671875 0.02399926757812504 +0.12625 -0.523590087890625 0.02399926757812504 +0.126375 -0.548583984375 0.02399926757812504 +0.1265 -0.574127197265625 0.02399926757812504 +0.126625 -0.587738037109375 0.02399926757812504 +0.12675 -0.603271484375 0.02399926757812504 +0.126875 -0.604156494140625 0.02399926757812504 +0.127 -0.60711669921875 0.02399926757812504 +0.127125 -0.596588134765625 0.02399926757812504 +0.12725 -0.578704833984375 0.02399926757812504 +0.127375 -0.561920166015625 0.02399926757812504 +0.1275 -0.534515380859375 0.02399926757812504 +0.127625 -0.505096435546875 0.02399926757812504 +0.12775 -0.467559814453125 0.02399926757812504 +0.127875 -0.426422119140625 0.02399926757812504 +0.128 -0.37457275390625 0.2799914550781251 +0.128125 -0.328460693359375 0.2799914550781251 +0.12825 -0.26861572265625 0.2799914550781251 +0.128375 -0.214813232421875 0.2799914550781251 +0.1285 -0.149139404296875 0.2799914550781251 +0.128625 -0.08282470703125 0.2799914550781251 +0.12875 -0.020965576171875 0.2799914550781251 +0.128875 0.0489501953125 0.2799914550781251 +0.129 0.112823486328125 0.2799914550781251 +0.129125 0.18194580078125 0.2799914550781251 +0.12925 0.251922607421875 0.2799914550781251 +0.129375 0.310699462890625 0.2799914550781251 +0.1295 0.37689208984375 0.2799914550781251 +0.129625 0.429840087890625 0.2799914550781251 +0.12975 0.489410400390625 0.2799914550781251 +0.129875 0.538970947265625 0.2799914550781251 +0.13 0.584686279296875 0.2799914550781251 +0.130125 0.629547119140625 0.2799914550781251 +0.13025 0.65850830078125 0.2799914550781251 +0.130375 0.6907958984375 0.2799914550781251 +0.1305 0.70880126953125 0.2799914550781251 +0.130625 0.7255859375 0.2799914550781251 +0.13075 0.728790283203125 0.2799914550781251 +0.130875 0.731903076171875 0.2799914550781251 +0.131 0.7198486328125 0.2799914550781251 +0.131125 0.706634521484375 0.2799914550781251 +0.13125 0.681884765625 0.2799914550781251 +0.131375 0.653350830078125 0.2799914550781251 +0.1315 0.6214599609375 0.2799914550781251 +0.131625 0.572906494140625 0.2799914550781251 +0.13175 0.522735595703125 0.2799914550781251 +0.131875 0.468048095703125 0.2799914550781251 +0.132 0.40594482421875 0.2799914550781251 +0.132125 0.342529296875 0.2799914550781251 +0.13225 0.27081298828125 0.2799914550781251 +0.132375 0.19317626953125 0.2799914550781251 +0.1325 0.122528076171875 0.2799914550781251 +0.132625 0.041290283203125 0.2799914550781251 +0.13275 -0.033050537109375 0.2799914550781251 +0.132875 -0.11627197265625 0.2799914550781251 +0.133 -0.197998046875 0.2799914550781251 +0.133125 -0.2718505859375 0.2799914550781251 +0.13325 -0.349334716796875 0.2799914550781251 +0.133375 -0.41900634765625 0.2799914550781251 +0.1335 -0.489044189453125 0.2799914550781251 +0.133625 -0.557861328125 0.2799914550781251 +0.13375 -0.611297607421875 0.2799914550781251 +0.133875 -0.669189453125 0.2799914550781251 +0.134 -0.71612548828125 0.2799914550781251 +0.134125 -0.75543212890625 0.2799914550781251 +0.13425 -0.792022705078125 0.2799914550781251 +0.134375 -0.812713623046875 0.2799914550781251 +0.1345 -0.83294677734375 0.2799914550781251 +0.134625 -0.83831787109375 0.2799914550781251 +0.13475 -0.84124755859375 0.2799914550781251 +0.134875 -0.8292236328125 0.2799914550781251 +0.135 -0.81597900390625 0.2799914550781251 +0.135125 -0.7867431640625 0.2799914550781251 +0.13525 -0.75787353515625 0.2799914550781251 +0.135375 -0.716766357421875 0.2799914550781251 +0.1355 -0.663055419921875 0.2799914550781251 +0.135625 -0.61224365234375 0.2799914550781251 +0.13575 -0.54486083984375 0.2799914550781251 +0.135875 -0.482025146484375 0.2799914550781251 +0.136 -0.403533935546875 0.2799914550781251 +0.136125 -0.322509765625 0.2799914550781251 +0.13625 -0.244384765625 0.2799914550781251 +0.136375 -0.156005859375 0.2799914550781251 +0.1365 -0.07366943359375 0.2799914550781251 +0.136625 0.01849365234375 0.2799914550781251 +0.13675 0.111602783203125 0.2799914550781251 +0.136875 0.19427490234375 0.2799914550781251 +0.137 0.285614013671875 0.2799914550781251 +0.137125 0.364227294921875 0.2799914550781251 +0.13725 0.4500732421875 0.2799914550781251 +0.137375 0.529052734375 0.2799914550781251 +0.1375 0.598236083984375 0.2799914550781251 +0.137625 0.6658935546875 0.2799914550781251 +0.13775 0.72406005859375 0.2799914550781251 +0.137875 0.777557373046875 0.2799914550781251 +0.138 0.826446533203125 0.2799914550781251 +0.138125 0.85455322265625 0.2799914550781251 +0.13825 0.854827880859375 0.2799914550781251 +0.138375 0.855010986328125 0.2799914550781251 +0.1385 0.8551025390625 0.2799914550781251 +0.138625 0.855133056640625 0.2799914550781251 +0.13875 0.85504150390625 0.2799914550781251 +0.138875 0.854888916015625 0.2799914550781251 +0.139 0.854644775390625 0.2799914550781251 +0.139125 0.8360595703125 0.2799914550781251 +0.13925 0.788116455078125 0.2799914550781251 +0.139375 0.740447998046875 0.2799914550781251 +0.1395 0.678924560546875 0.2799914550781251 +0.139625 0.614654541015625 0.2799914550781251 +0.13975 0.538848876953125 0.2799914550781251 +0.139875 0.454864501953125 0.2799914550781251 +0.14 0.376312255859375 0.2799914550781251 +0.140125 0.2833251953125 0.2799914550781251 +0.14025 0.197662353515625 0.2799914550781251 +0.140375 0.099365234375 0.2799914550781251 +0.1405 0.0 0.2799914550781251 +0.140625 -0.0897216796875 0.2799914550781251 +0.14075 -0.18914794921875 0.2799914550781251 +0.140875 -0.2774658203125 0.2799914550781251 +0.141 -0.372039794921875 0.2799914550781251 +0.141125 -0.463897705078125 0.2799914550781251 +0.14125 -0.541229248046875 0.2799914550781251 +0.141375 -0.623321533203125 0.2799914550781251 +0.1415 -0.69000244140625 0.2799914550781251 +0.141625 -0.758941650390625 0.2799914550781251 +0.14175 -0.817657470703125 0.2799914550781251 +0.141875 -0.8546142578125 0.2799914550781251 +0.142 -0.855010986328125 0.2799914550781251 +0.142125 -0.85528564453125 0.2799914550781251 +0.14225 -0.85552978515625 0.2799914550781251 +0.142375 -0.85565185546875 0.2799914550781251 +0.1425 -0.855682373046875 0.2799914550781251 +0.142625 -0.8555908203125 0.2799914550781251 +0.14275 -0.85546875 0.2799914550781251 +0.142875 -0.855194091796875 0.2799914550781251 +0.143 -0.854827880859375 0.2799914550781251 +0.143125 -0.8453369140625 0.2799914550781251 +0.14325 -0.78997802734375 0.2799914550781251 +0.143375 -0.73260498046875 0.2799914550781251 +0.1435 -0.659637451171875 0.2799914550781251 +0.143625 -0.58038330078125 0.2799914550781251 +0.14375 -0.50262451171875 0.2799914550781251 +0.143875 -0.4117431640625 0.2799914550781251 +0.144 -0.325225830078125 0.2799914550781251 +0.144125 -0.226165771484375 0.2799914550781251 +0.14425 -0.12408447265625 0.2799914550781251 +0.144375 -0.031097412109375 0.2799914550781251 +0.1445 0.07257080078125 0.2799914550781251 +0.144625 0.16558837890625 0.2799914550781251 +0.14475 0.267364501953125 0.2799914550781251 +0.144875 0.36602783203125 0.2799914550781251 +0.145 0.451873779296875 0.2799914550781251 +0.145125 0.542083740234375 0.2799914550781251 +0.14525 0.61883544921875 0.2799914550781251 +0.145375 0.697052001953125 0.2799914550781251 +0.1455 0.768310546875 0.2799914550781251 +0.145625 0.82470703125 0.2799914550781251 +0.14575 0.854705810546875 0.2799914550781251 +0.145875 0.8551025390625 0.2799914550781251 +0.146 0.855438232421875 0.2799914550781251 +0.146125 0.855682373046875 0.2799914550781251 +0.14625 0.855804443359375 0.2799914550781251 +0.146375 0.855865478515625 0.2799914550781251 +0.1465 0.855804443359375 0.2799914550781251 +0.146625 0.85565185546875 0.2799914550781251 +0.14675 0.855377197265625 0.2799914550781251 +0.146875 0.855072021484375 0.2799914550781251 +0.147 0.854644775390625 0.2799914550781251 +0.147125 0.821014404296875 0.2799914550781251 +0.14725 0.756866455078125 0.2799914550781251 +0.147375 0.684356689453125 0.2799914550781251 +0.1475 0.612640380859375 0.2799914550781251 +0.147625 0.526702880859375 0.2799914550781251 +0.14775 0.444305419921875 0.2799914550781251 +0.147875 0.348297119140625 0.2799914550781251 +0.148 0.248382568359375 0.2799914550781251 +0.148125 0.156219482421875 0.2799914550781251 +0.14825 0.05218505859375 0.2799914550781251 +0.148375 -0.041778564453125 0.2799914550781251 +0.1485 -0.145721435546875 0.2799914550781251 +0.148625 -0.24810791015625 0.2799914550781251 +0.14875 -0.337738037109375 0.2799914550781251 +0.148875 -0.433624267578125 0.2799914550781251 +0.149 -0.516082763671875 0.2799914550781251 +0.149125 -0.601776123046875 0.2799914550781251 +0.14925 -0.681365966796875 0.2799914550781251 +0.149375 -0.745849609375 0.2799914550781251 +0.1495 -0.810516357421875 0.2799914550781251 +0.149625 -0.85455322265625 0.2799914550781251 +0.14975 -0.855010986328125 0.2799914550781251 +0.149875 -0.8553466796875 0.2799914550781251 +0.15 -0.8555908203125 0.2799914550781251 +0.150125 -0.855743408203125 0.2799914550781251 +0.15025 -0.85577392578125 0.2799914550781251 +0.150375 -0.855743408203125 0.2799914550781251 +0.1505 -0.8555908203125 0.2799914550781251 +0.150625 -0.85540771484375 0.2799914550781251 +0.15075 -0.855072021484375 0.2799914550781251 +0.150875 -0.85467529296875 0.2799914550781251 +0.151 -0.819610595703125 0.2799914550781251 +0.151125 -0.758209228515625 0.2799914550781251 +0.15125 -0.694427490234375 0.2799914550781251 +0.151375 -0.618011474609375 0.2799914550781251 +0.1515 -0.542327880859375 0.2799914550781251 +0.151625 -0.45306396484375 0.2799914550781251 +0.15175 -0.3599853515625 0.2799914550781251 +0.151875 -0.272186279296875 0.2799914550781251 +0.152 -0.1727294921875 0.2799914550781251 +0.152125 -0.081390380859375 0.2799914550781251 +0.15225 0.02032470703125 0.2799914550781251 +0.152375 0.12164306640625 0.2799914550781251 +0.1525 0.211761474609375 0.2799914550781251 +0.152625 0.308868408203125 0.2799914550781251 +0.15275 0.392791748046875 0.2799914550781251 +0.152875 0.482879638671875 0.2799914550781251 +0.153 0.56597900390625 0.2799914550781251 +0.153125 0.636810302734375 0.2799914550781251 +0.15325 0.706695556640625 0.2799914550781251 +0.153375 0.764739990234375 0.2799914550781251 +0.1535 0.818695068359375 0.2799914550781251 +0.153625 0.854583740234375 0.2799914550781251 +0.15375 0.854888916015625 0.2799914550781251 +0.153875 0.85516357421875 0.2799914550781251 +0.154 0.85528564453125 0.2799914550781251 +0.154125 0.8553466796875 0.2799914550781251 +0.15425 0.8553466796875 0.2799914550781251 +0.154375 0.855224609375 0.2799914550781251 +0.1545 0.855010986328125 0.2799914550781251 +0.154625 0.854736328125 0.2799914550781251 +0.15475 0.84259033203125 0.2799914550781251 +0.154875 0.791229248046875 0.2799914550781251 +0.155 0.740447998046875 0.2799914550781251 +0.155125 0.673675537109375 0.2799914550781251 +0.15525 0.60986328125 0.2799914550781251 +0.155375 0.530487060546875 0.2799914550781251 +0.1555 0.445953369140625 0.2799914550781251 +0.155625 0.36761474609375 0.2799914550781251 +0.15575 0.27557373046875 0.2799914550781251 +0.155875 0.19158935546875 0.2799914550781251 +0.156 0.09588623046875 0.2799914550781251 +0.156125 0.0 0.2799914550781251 +0.15625 -0.085906982421875 0.2799914550781251 +0.156375 -0.18048095703125 0.2799914550781251 +0.1565 -0.2626953125 0.2799914550781251 +0.156625 -0.35223388671875 0.2799914550781251 +0.15675 -0.435821533203125 0.2799914550781251 +0.156875 -0.50592041015625 0.2799914550781251 +0.157 -0.580963134765625 0.2799914550781251 +0.157125 -0.63983154296875 0.2799914550781251 +0.15725 -0.701812744140625 0.2799914550781251 +0.157375 -0.752166748046875 0.2799914550781251 +0.1575 -0.793731689453125 0.2799914550781251 +0.157625 -0.827178955078125 0.2799914550781251 +0.15775 -0.8533935546875 0.2799914550781251 +0.157875 -0.854644775390625 0.2799914550781251 +0.158 -0.854736328125 0.2799914550781251 +0.158125 -0.854705810546875 0.2799914550781251 +0.15825 -0.854583740234375 0.2799914550781251 +0.158375 -0.848052978515625 0.2799914550781251 +0.1585 -0.817718505859375 0.2799914550781251 +0.158625 -0.783477783203125 0.2799914550781251 +0.15875 -0.740692138671875 0.2799914550781251 +0.158875 -0.69085693359375 0.2799914550781251 +0.159 -0.635498046875 0.2799914550781251 +0.159125 -0.57220458984375 0.2799914550781251 +0.15925 -0.49945068359375 0.2799914550781251 +0.159375 -0.432525634765625 0.2799914550781251 +0.1595 -0.351409912109375 0.2799914550781251 +0.159625 -0.275726318359375 0.2799914550781251 +0.15975 -0.191436767578125 0.2799914550781251 +0.159875 -0.10430908203125 0.2799914550781251 +0.16 -0.026123046875 0.535983642578125 +0.160125 0.060516357421875 0.535983642578125 +0.16025 0.136871337890625 0.535983642578125 +0.160375 0.220733642578125 0.535983642578125 +0.1605 0.29998779296875 0.535983642578125 +0.160625 0.3671875 0.535983642578125 +0.16075 0.4405517578125 0.535983642578125 +0.160875 0.498565673828125 0.535983642578125 +0.161 0.557159423828125 0.535983642578125 +0.161125 0.61358642578125 0.535983642578125 +0.16125 0.65338134765625 0.535983642578125 +0.161375 0.69622802734375 0.535983642578125 +0.1615 0.722320556640625 0.535983642578125 +0.161625 0.74383544921875 0.535983642578125 +0.16175 0.763214111328125 0.535983642578125 +0.161875 0.766937255859375 0.535983642578125 +0.162 0.76361083984375 0.535983642578125 +0.162125 0.75946044921875 0.535983642578125 +0.16225 0.74029541015625 0.535983642578125 +0.162375 0.7132568359375 0.535983642578125 +0.1625 0.688262939453125 0.535983642578125 +0.162625 0.647308349609375 0.535983642578125 +0.16275 0.60430908203125 0.535983642578125 +0.162875 0.557098388671875 0.535983642578125 +0.163 0.498931884765625 0.535983642578125 +0.163125 0.442291259765625 0.535983642578125 +0.16325 0.3802490234375 0.535983642578125 +0.163375 0.317596435546875 0.535983642578125 +0.1635 0.24639892578125 0.535983642578125 +0.163625 0.17578125 0.535983642578125 +0.16375 0.109375 0.535983642578125 +0.163875 0.036163330078125 0.535983642578125 +0.164 -0.0289306640625 0.535983642578125 +0.164125 -0.099945068359375 0.535983642578125 +0.16425 -0.168243408203125 0.535983642578125 +0.164375 -0.229217529296875 0.535983642578125 +0.1645 -0.291168212890625 0.535983642578125 +0.164625 -0.3465576171875 0.535983642578125 +0.16475 -0.399749755859375 0.535983642578125 +0.164875 -0.44720458984375 0.535983642578125 +0.165 -0.490020751953125 0.535983642578125 +0.165125 -0.5260009765625 0.535983642578125 +0.16525 -0.551910400390625 0.535983642578125 +0.165375 -0.582183837890625 0.535983642578125 +0.1655 -0.598388671875 0.535983642578125 +0.165625 -0.606048583984375 0.535983642578125 +0.16575 -0.61688232421875 0.535983642578125 +0.165875 -0.612640380859375 0.535983642578125 +0.166 -0.602325439453125 0.535983642578125 +0.166125 -0.59375 0.535983642578125 +0.16625 -0.572418212890625 0.535983642578125 +0.166375 -0.5440673828125 0.535983642578125 +0.1665 -0.520751953125 0.535983642578125 +0.166625 -0.482421875 0.535983642578125 +0.16675 -0.43963623046875 0.535983642578125 +0.166875 -0.403472900390625 0.535983642578125 +0.167 -0.3536376953125 0.535983642578125 +0.167125 -0.30615234375 0.535983642578125 +0.16725 -0.25628662109375 0.535983642578125 +0.167375 -0.200439453125 0.535983642578125 +0.1675 -0.151885986328125 0.535983642578125 +0.167625 -0.094818115234375 0.535983642578125 +0.16775 -0.044036865234375 0.535983642578125 +0.167875 0.010986328125 0.535983642578125 +0.168 0.064849853515625 0.535983642578125 +0.168125 0.1109619140625 0.535983642578125 +0.16825 0.16229248046875 0.535983642578125 +0.168375 0.20330810546875 0.535983642578125 +0.1685 0.245391845703125 0.535983642578125 +0.168625 0.2884521484375 0.535983642578125 +0.16875 0.318511962890625 0.535983642578125 +0.168875 0.3477783203125 0.535983642578125 +0.169 0.376312255859375 0.535983642578125 +0.169125 0.39617919921875 0.535983642578125 +0.16925 0.410675048828125 0.535983642578125 +0.169375 0.427032470703125 0.535983642578125 +0.1695 0.43170166015625 0.535983642578125 +0.169625 0.43048095703125 0.535983642578125 +0.16975 0.43475341796875 0.535983642578125 +0.169875 0.424835205078125 0.535983642578125 +0.17 0.41107177734375 0.535983642578125 +0.170125 0.402008056640625 0.535983642578125 +0.17025 0.381134033203125 0.535983642578125 +0.170375 0.364227294921875 0.535983642578125 +0.1705 0.335235595703125 0.535983642578125 +0.170625 0.306121826171875 0.535983642578125 +0.17075 0.27960205078125 0.535983642578125 +0.170875 0.246795654296875 0.535983642578125 +0.171 0.21002197265625 0.535983642578125 +0.171125 0.177276611328125 0.535983642578125 +0.17125 0.14227294921875 0.535983642578125 +0.171375 0.10418701171875 0.535983642578125 +0.1715 0.072418212890625 0.535983642578125 +0.171625 0.035369873046875 0.535983642578125 +0.17175 0.0 0.535983642578125 +0.171875 -0.0308837890625 0.535983642578125 +0.172 -0.06298828125 0.535983642578125 +0.172125 -0.089263916015625 0.535983642578125 +0.17225 -0.11968994140625 0.535983642578125 +0.172375 -0.14398193359375 0.535983642578125 +0.1725 -0.162384033203125 0.535983642578125 +0.172625 -0.186492919921875 0.535983642578125 +0.17275 -0.199249267578125 0.535983642578125 +0.172875 -0.210662841796875 0.535983642578125 +0.173 -0.22698974609375 0.535983642578125 +0.173125 -0.23052978515625 0.535983642578125 +0.17325 -0.241546630859375 0.535983642578125 +0.173375 -0.23944091796875 0.535983642578125 +0.1735 -0.235137939453125 0.535983642578125 +0.173625 -0.238006591796875 0.535983642578125 +0.17375 -0.2281494140625 0.535983642578125 +0.173875 -0.216033935546875 0.535983642578125 +0.174 -0.2122802734375 0.535983642578125 +0.174125 -0.196258544921875 0.535983642578125 +0.17425 -0.17877197265625 0.535983642578125 +0.174375 -0.1700439453125 0.535983642578125 +0.1745 -0.150360107421875 0.535983642578125 +0.174625 -0.13153076171875 0.535983642578125 +0.17475 -0.118438720703125 0.535983642578125 +0.174875 -0.09796142578125 0.535983642578125 +0.175 -0.079559326171875 0.535983642578125 +0.175125 -0.0650634765625 0.535983642578125 +0.17525 -0.0479736328125 0.535983642578125 +0.175375 -0.03094482421875 0.535983642578125 +0.1755 -0.0169677734375 0.535983642578125 +0.175625 -0.003875732421875 0.535983642578125 +0.17575 0.00836181640625 0.535983642578125 +0.175875 0.01910400390625 0.535983642578125 +0.176 0.028045654296875 0.535983642578125 +0.176125 0.034576416015625 0.535983642578125 +0.17625 0.04266357421875 0.535983642578125 +0.176375 0.045501708984375 0.535983642578125 +0.1765 0.051910400390625 0.535983642578125 +0.176625 0.051177978515625 0.535983642578125 +0.17675 0.048309326171875 0.535983642578125 +0.176875 0.0518798828125 0.535983642578125 +0.177 0.046051025390625 0.535983642578125 +0.177125 0.038543701171875 0.535983642578125 +0.17725 0.0400390625 0.535983642578125 +0.177375 0.030792236328125 0.535983642578125 +0.1775 0.020782470703125 0.535983642578125 +0.177625 0.0208740234375 0.535983642578125 +0.17775 0.0103759765625 0.535983642578125 +0.177875 0.0 0.535983642578125 +0.178 0.0 0.535983642578125 +0.178125 -0.009552001953125 0.535983642578125 +0.17825 -0.0181884765625 0.535983642578125 +0.178375 -0.01715087890625 0.535983642578125 +0.1785 -0.023712158203125 0.535983642578125 +0.178625 -0.02862548828125 0.535983642578125 +0.17875 -0.025604248046875 0.535983642578125 +0.178875 -0.02752685546875 0.535983642578125 +0.179 -0.027862548828125 0.535983642578125 +0.179125 -0.021820068359375 0.535983642578125 +0.17925 -0.018157958984375 0.535983642578125 +0.179375 -0.01141357421875 0.535983642578125 +0.1795 -0.00433349609375 0.535983642578125 +0.179625 0.00390625 0.535983642578125 +0.17975 0.013702392578125 0.535983642578125 +0.179875 0.02593994140625 0.535983642578125 +0.18 0.03887939453125 0.535983642578125 +0.180125 0.04998779296875 0.535983642578125 +0.18025 0.064849853515625 0.535983642578125 +0.180375 0.08197021484375 0.535983642578125 +0.1805 0.09283447265625 0.535983642578125 +0.180625 0.1094970703125 0.535983642578125 +0.18075 0.12744140625 0.535983642578125 +0.180875 0.135406494140625 0.535983642578125 +0.181 0.15228271484375 0.535983642578125 +0.181125 0.1683349609375 0.535983642578125 +0.18125 0.1727294921875 0.535983642578125 +0.181375 0.18603515625 0.535983642578125 +0.1815 0.197540283203125 0.535983642578125 +0.181625 0.1968994140625 0.535983642578125 +0.18175 0.20416259765625 0.535983642578125 +0.181875 0.209381103515625 0.535983642578125 +0.182 0.201873779296875 0.535983642578125 +0.182125 0.202301025390625 0.535983642578125 +0.18225 0.19012451171875 0.535983642578125 +0.182375 0.183746337890625 0.535983642578125 +0.1825 0.17578125 0.535983642578125 +0.182625 0.15643310546875 0.535983642578125 +0.18275 0.143157958984375 0.535983642578125 +0.182875 0.12451171875 0.535983642578125 +0.183 0.09893798828125 0.535983642578125 +0.183125 0.0777587890625 0.535983642578125 +0.18325 0.051116943359375 0.535983642578125 +0.183375 0.024139404296875 0.535983642578125 +0.1835 -0.0062255859375 0.535983642578125 +0.183625 -0.038665771484375 0.535983642578125 +0.18375 -0.067352294921875 0.535983642578125 +0.183875 -0.1016845703125 0.535983642578125 +0.184 -0.133697509765625 0.535983642578125 +0.184125 -0.16436767578125 0.535983642578125 +0.18425 -0.19903564453125 0.535983642578125 +0.184375 -0.230438232421875 0.535983642578125 +0.1845 -0.256500244140625 0.535983642578125 +0.184625 -0.285369873046875 0.535983642578125 +0.18475 -0.314788818359375 0.535983642578125 +0.184875 -0.3330078125 0.535983642578125 +0.185 -0.35540771484375 0.535983642578125 +0.185125 -0.376251220703125 0.535983642578125 +0.18525 -0.383270263671875 0.535983642578125 +0.185375 -0.396728515625 0.535983642578125 +0.1855 -0.396270751953125 0.535983642578125 +0.185625 -0.401641845703125 0.535983642578125 +0.18575 -0.402008056640625 0.535983642578125 +0.185875 -0.39007568359375 0.535983642578125 +0.186 -0.38128662109375 0.535983642578125 +0.186125 -0.367401123046875 0.535983642578125 +0.18625 -0.343841552734375 0.535983642578125 +0.186375 -0.320831298828125 0.535983642578125 +0.1865 -0.29656982421875 0.535983642578125 +0.186625 -0.259002685546875 0.535983642578125 +0.18675 -0.223114013671875 0.535983642578125 +0.186875 -0.1876220703125 0.535983642578125 +0.187 -0.1412353515625 0.535983642578125 +0.187125 -0.10009765625 0.535983642578125 +0.18725 -0.05126953125 0.535983642578125 +0.187375 0.0 0.535983642578125 +0.1875 0.0469970703125 0.535983642578125 +0.187625 0.100555419921875 0.535983642578125 +0.18775 0.147064208984375 0.535983642578125 +0.187875 0.20068359375 0.535983642578125 +0.188 0.2537841796875 0.535983642578125 +0.188125 0.296112060546875 0.535983642578125 +0.18825 0.34576416015625 0.535983642578125 +0.188375 0.38275146484375 0.535983642578125 +0.1885 0.4267578125 0.535983642578125 +0.188625 0.467132568359375 0.535983642578125 +0.18875 0.492950439453125 0.535983642578125 +0.188875 0.52459716796875 0.535983642578125 +0.189 0.549560546875 0.535983642578125 +0.189125 0.562591552734375 0.535983642578125 +0.18925 0.5780029296875 0.535983642578125 +0.189375 0.58734130859375 0.535983642578125 +0.1895 0.582183837890625 0.535983642578125 +0.189625 0.580352783203125 0.535983642578125 +0.18975 0.570831298828125 0.535983642578125 +0.189875 0.546905517578125 0.535983642578125 +0.19 0.527435302734375 0.535983642578125 +0.190125 0.498565673828125 0.535983642578125 +0.19025 0.461517333984375 0.535983642578125 +0.190375 0.420989990234375 0.535983642578125 +0.1905 0.37457275390625 0.535983642578125 +0.190625 0.32440185546875 0.535983642578125 +0.19075 0.26861572265625 0.535983642578125 +0.190875 0.214813232421875 0.535983642578125 +0.191 0.149139404296875 0.535983642578125 +0.191125 0.08282470703125 0.535983642578125 +0.19125 0.020721435546875 0.535983642578125 +0.191375 -0.0489501953125 0.535983642578125 +0.1915 -0.112823486328125 0.535983642578125 +0.191625 -0.18194580078125 0.535983642578125 +0.19175 -0.251922607421875 0.535983642578125 +0.191875 -0.31414794921875 0.535983642578125 +0.192 -0.3809814453125 0.791975830078125 +0.192125 -0.43450927734375 0.791975830078125 +0.19225 -0.49462890625 0.791975830078125 +0.192375 -0.550384521484375 0.791975830078125 +0.1925 -0.5968017578125 0.791975830078125 +0.192625 -0.63592529296875 0.791975830078125 +0.19275 -0.671875 0.791975830078125 +0.192875 -0.70452880859375 0.791975830078125 +0.193 -0.729827880859375 0.791975830078125 +0.193125 -0.746612548828125 0.791975830078125 +0.19325 -0.749908447265625 0.791975830078125 +0.193375 -0.752685546875 0.791975830078125 +0.1935 -0.7469482421875 0.791975830078125 +0.193625 -0.732666015625 0.791975830078125 +0.19375 -0.707000732421875 0.791975830078125 +0.193875 -0.676910400390625 0.791975830078125 +0.194 -0.643402099609375 0.791975830078125 +0.194125 -0.5980224609375 0.791975830078125 +0.19425 -0.545135498046875 0.791975830078125 +0.194375 -0.48809814453125 0.791975830078125 +0.1945 -0.422943115234375 0.791975830078125 +0.194625 -0.359649658203125 0.791975830078125 +0.19475 -0.2840576171875 0.791975830078125 +0.194875 -0.20263671875 0.791975830078125 +0.195 -0.128387451171875 0.791975830078125 +0.195125 -0.043212890625 0.791975830078125 +0.19525 0.034820556640625 0.791975830078125 +0.195375 0.1224365234375 0.791975830078125 +0.1955 0.20849609375 0.791975830078125 +0.195625 0.285919189453125 0.791975830078125 +0.19575 0.36981201171875 0.791975830078125 +0.195875 0.443023681640625 0.791975830078125 +0.196 0.516998291015625 0.791975830078125 +0.196125 0.589080810546875 0.791975830078125 +0.19625 0.64947509765625 0.791975830078125 +0.196375 0.71002197265625 0.791975830078125 +0.1965 0.758758544921875 0.791975830078125 +0.196625 0.800384521484375 0.791975830078125 +0.19675 0.8380126953125 0.791975830078125 +0.196875 0.854583740234375 0.791975830078125 +0.197 0.854766845703125 0.791975830078125 +0.197125 0.854827880859375 0.791975830078125 +0.19725 0.854827880859375 0.791975830078125 +0.197375 0.854766845703125 0.791975830078125 +0.1975 0.8546142578125 0.791975830078125 +0.197625 0.8416748046875 0.791975830078125 +0.19775 0.80560302734375 0.791975830078125 +0.197875 0.760772705078125 0.791975830078125 +0.198 0.707000732421875 0.791975830078125 +0.198125 0.651702880859375 0.791975830078125 +0.19825 0.58251953125 0.791975830078125 +0.198375 0.512237548828125 0.791975830078125 +0.1985 0.4306640625 0.791975830078125 +0.198625 0.343597412109375 0.791975830078125 +0.19875 0.26141357421875 0.791975830078125 +0.198875 0.1658935546875 0.791975830078125 +0.199 0.078643798828125 0.791975830078125 +0.199125 -0.01971435546875 0.791975830078125 +0.19925 -0.11871337890625 0.791975830078125 +0.199375 -0.207366943359375 0.791975830078125 +0.1995 -0.30328369140625 0.791975830078125 +0.199625 -0.388031005859375 0.791975830078125 +0.19975 -0.47857666015625 0.791975830078125 +0.199875 -0.564300537109375 0.791975830078125 +0.2 -0.634918212890625 0.791975830078125 +0.200125 -0.708831787109375 0.791975830078125 +0.20025 -0.76922607421875 0.791975830078125 +0.200375 -0.828338623046875 0.791975830078125 +0.2005 -0.854736328125 0.791975830078125 +0.200625 -0.855072021484375 0.791975830078125 +0.20075 -0.855377197265625 0.791975830078125 +0.200875 -0.855560302734375 0.791975830078125 +0.201 -0.855682373046875 0.791975830078125 +0.201125 -0.85565185546875 0.791975830078125 +0.20125 -0.8555908203125 0.791975830078125 +0.201375 -0.85540771484375 0.791975830078125 +0.2015 -0.85516357421875 0.791975830078125 +0.201625 -0.854766845703125 0.791975830078125 +0.20175 -0.832366943359375 0.791975830078125 +0.201875 -0.7802734375 0.791975830078125 +0.202 -0.7138671875 0.791975830078125 +0.202125 -0.647216796875 0.791975830078125 +0.20225 -0.565277099609375 0.791975830078125 +0.202375 -0.47784423828125 0.791975830078125 +0.2025 -0.394439697265625 0.791975830078125 +0.202625 -0.29730224609375 0.791975830078125 +0.20275 -0.2069091796875 0.791975830078125 +0.202875 -0.10400390625 0.791975830078125 +0.203 0.0 0.791975830078125 +0.203125 0.093780517578125 0.791975830078125 +0.20325 0.197174072265625 0.791975830078125 +0.203375 0.288360595703125 0.791975830078125 +0.2035 0.38690185546875 0.791975830078125 +0.203625 0.481231689453125 0.791975830078125 +0.20375 0.5616455078125 0.791975830078125 +0.203875 0.645172119140625 0.791975830078125 +0.204 0.71417236328125 0.791975830078125 +0.204125 0.78350830078125 0.791975830078125 +0.20425 0.844207763671875 0.791975830078125 +0.204375 0.854827880859375 0.791975830078125 +0.2045 0.855224609375 0.791975830078125 +0.204625 0.855499267578125 0.791975830078125 +0.20475 0.855712890625 0.791975830078125 +0.204875 0.8558349609375 0.791975830078125 +0.205 0.8558349609375 0.791975830078125 +0.205125 0.855743408203125 0.791975830078125 +0.20525 0.8555908203125 0.791975830078125 +0.205375 0.855316162109375 0.791975830078125 +0.2055 0.85491943359375 0.791975830078125 +0.205625 0.8544921875 0.791975830078125 +0.20575 0.799072265625 0.791975830078125 +0.205875 0.738922119140625 0.791975830078125 +0.206 0.66455078125 0.791975830078125 +0.206125 0.5830078125 0.791975830078125 +0.20625 0.5048828125 0.791975830078125 +0.206375 0.412353515625 0.791975830078125 +0.2065 0.325225830078125 0.791975830078125 +0.206625 0.2254638671875 0.791975830078125 +0.20675 0.123504638671875 0.791975830078125 +0.206875 0.030914306640625 0.791975830078125 +0.207 -0.072021484375 0.791975830078125 +0.207125 -0.163726806640625 0.791975830078125 +0.20725 -0.263519287109375 0.791975830078125 +0.207375 -0.36077880859375 0.791975830078125 +0.2075 -0.4439697265625 0.791975830078125 +0.207625 -0.531402587890625 0.791975830078125 +0.20775 -0.6046142578125 0.791975830078125 +0.207875 -0.6793212890625 0.791975830078125 +0.208 -0.748138427734375 0.791975830078125 +0.208125 -0.800933837890625 0.791975830078125 +0.20825 -0.851104736328125 0.791975830078125 +0.208375 -0.854827880859375 0.791975830078125 +0.2085 -0.855133056640625 0.791975830078125 +0.208625 -0.8553466796875 0.791975830078125 +0.20875 -0.855438232421875 0.791975830078125 +0.208875 -0.85546875 0.791975830078125 +0.209 -0.855377197265625 0.791975830078125 +0.209125 -0.855224609375 0.791975830078125 +0.20925 -0.854949951171875 0.791975830078125 +0.209375 -0.8546142578125 0.791975830078125 +0.2095 -0.819549560546875 0.791975830078125 +0.209625 -0.772430419921875 0.791975830078125 +0.20975 -0.7093505859375 0.791975830078125 +0.209875 -0.638946533203125 0.791975830078125 +0.21 -0.569732666015625 0.791975830078125 +0.210125 -0.48779296875 0.791975830078125 +0.21025 -0.411590576171875 0.791975830078125 +0.210375 -0.321258544921875 0.791975830078125 +0.2105 -0.2281494140625 0.791975830078125 +0.210625 -0.142822265625 0.791975830078125 +0.21075 -0.0477294921875 0.791975830078125 +0.210875 0.03802490234375 0.791975830078125 +0.211 0.132110595703125 0.791975830078125 +0.211125 0.22381591796875 0.791975830078125 +0.21125 0.303314208984375 0.791975830078125 +0.211375 0.3897705078125 0.791975830078125 +0.2115 0.46148681640625 0.791975830078125 +0.211625 0.535675048828125 0.791975830078125 +0.21175 0.6031494140625 0.791975830078125 +0.211875 0.660919189453125 0.791975830078125 +0.212 0.714141845703125 0.791975830078125 +0.212125 0.754364013671875 0.791975830078125 +0.21225 0.791015625 0.791975830078125 +0.212375 0.818450927734375 0.791975830078125 +0.2125 0.83984375 0.791975830078125 +0.212625 0.849517822265625 0.791975830078125 +0.21275 0.84954833984375 0.791975830078125 +0.212875 0.84124755859375 0.791975830078125 +0.213 0.8292236328125 0.791975830078125 +0.213125 0.805206298828125 0.791975830078125 +0.21325 0.77105712890625 0.791975830078125 +0.213375 0.732818603515625 0.791975830078125 +0.2135 0.683807373046875 0.791975830078125 +0.213625 0.632568359375 0.791975830078125 +0.21375 0.57623291015625 0.791975830078125 +0.213875 0.509002685546875 0.791975830078125 +0.214 0.44415283203125 0.791975830078125 +0.214125 0.371826171875 0.791975830078125 +0.21425 0.29315185546875 0.791975830078125 +0.214375 0.220367431640625 0.791975830078125 +0.2145 0.138702392578125 0.791975830078125 +0.214625 0.064971923828125 0.791975830078125 +0.21475 -0.0162353515625 0.791975830078125 +0.214875 -0.09649658203125 0.791975830078125 +0.215 -0.166534423828125 0.791975830078125 +0.215125 -0.241363525390625 0.791975830078125 +0.21525 -0.305023193359375 0.791975830078125 +0.215375 -0.374969482421875 0.791975830078125 +0.2155 -0.43670654296875 0.791975830078125 +0.215625 -0.4866943359375 0.791975830078125 +0.21575 -0.536468505859375 0.791975830078125 +0.215875 -0.58050537109375 0.791975830078125 +0.216 -0.617218017578125 0.791975830078125 +0.216125 -0.646331787109375 0.791975830078125 +0.21625 -0.6651611328125 0.791975830078125 +0.216375 -0.6793212890625 0.791975830078125 +0.2165 -0.6920166015625 0.791975830078125 +0.216625 -0.69140625 0.791975830078125 +0.21675 -0.68304443359375 0.791975830078125 +0.216875 -0.66839599609375 0.791975830078125 +0.217 -0.6536865234375 0.791975830078125 +0.217125 -0.62701416015625 0.791975830078125 +0.21725 -0.59222412109375 0.791975830078125 +0.217375 -0.55157470703125 0.791975830078125 +0.2175 -0.5098876953125 0.791975830078125 +0.217625 -0.46575927734375 0.791975830078125 +0.21775 -0.416412353515625 0.791975830078125 +0.217875 -0.35906982421875 0.791975830078125 +0.218 -0.299163818359375 0.791975830078125 +0.218125 -0.246612548828125 0.791975830078125 +0.21825 -0.1832275390625 0.791975830078125 +0.218375 -0.125640869140625 0.791975830078125 +0.2185 -0.062255859375 0.791975830078125 +0.218625 0.0 0.791975830078125 +0.21875 0.05523681640625 0.791975830078125 +0.218875 0.11444091796875 0.791975830078125 +0.219 0.164886474609375 0.791975830078125 +0.219125 0.217742919921875 0.791975830078125 +0.21925 0.27069091796875 0.791975830078125 +0.219375 0.310943603515625 0.791975830078125 +0.2195 0.351470947265625 0.791975830078125 +0.219625 0.38275146484375 0.791975830078125 +0.21975 0.412872314453125 0.791975830078125 +0.219875 0.44482421875 0.791975830078125 +0.22 0.46148681640625 0.791975830078125 +0.220125 0.475128173828125 0.791975830078125 +0.22025 0.481475830078125 0.791975830078125 +0.220375 0.492919921875 0.791975830078125 +0.2205 0.489837646484375 0.791975830078125 +0.220625 0.481414794921875 0.791975830078125 +0.22075 0.46807861328125 0.791975830078125 +0.220875 0.450958251953125 0.791975830078125 +0.221 0.43743896484375 0.791975830078125 +0.221125 0.410675048828125 0.791975830078125 +0.22125 0.38262939453125 0.791975830078125 +0.221375 0.349334716796875 0.791975830078125 +0.2215 0.3233642578125 0.791975830078125 +0.221625 0.284820556640625 0.791975830078125 +0.22175 0.244598388671875 0.791975830078125 +0.221875 0.20697021484375 0.791975830078125 +0.222 0.165252685546875 0.791975830078125 +0.222125 0.13055419921875 0.791975830078125 +0.22225 0.08843994140625 0.791975830078125 +0.222375 0.04730224609375 0.791975830078125 +0.2225 0.011505126953125 0.791975830078125 +0.222625 -0.02691650390625 0.791975830078125 +0.22275 -0.0596923828125 0.791975830078125 +0.222875 -0.093658447265625 0.791975830078125 +0.223 -0.1246337890625 0.791975830078125 +0.223125 -0.14923095703125 0.791975830078125 +0.22325 -0.179046630859375 0.791975830078125 +0.223375 -0.19805908203125 0.791975830078125 +0.2235 -0.21612548828125 0.791975830078125 +0.223625 -0.2303466796875 0.791975830078125 +0.22375 -0.23895263671875 0.791975830078125 +0.223875 -0.254638671875 0.791975830078125 +0.224 -0.257110595703125 0.9999084491282701 +0.224125 -0.257354736328125 0.9999084491282701 +0.22425 -0.254150390625 0.9999084491282701 +0.224375 -0.24749755859375 0.9999084491282701 +0.2245 -0.23846435546875 0.9999084491282701 +0.224625 -0.227020263671875 0.9999084491282701 +0.22475 -0.213287353515625 0.9999084491282701 +0.224875 -0.207366943359375 0.9999084491282701 +0.225 -0.19073486328125 0.9999084491282701 +0.225125 -0.172119140625 0.9999084491282701 +0.22525 -0.153778076171875 0.9999084491282701 +0.225375 -0.13397216796875 0.9999084491282701 +0.2255 -0.114105224609375 0.9999084491282701 +0.225625 -0.0958251953125 0.9999084491282701 +0.22575 -0.076904296875 0.9999084491282701 +0.225875 -0.060272216796875 0.9999084491282701 +0.226 -0.04364013671875 0.9999084491282701 +0.226125 -0.031097412109375 0.9999084491282701 +0.22625 -0.0179443359375 0.9999084491282701 +0.226375 -0.00543212890625 0.9999084491282701 +0.2265 0.00390625 0.9999084491282701 +0.226625 0.012176513671875 0.9999084491282701 +0.22675 0.018157958984375 0.9999084491282701 +0.226875 0.021209716796875 0.9999084491282701 +0.227 0.022705078125 0.9999084491282701 +0.227125 0.021636962890625 0.9999084491282701 +0.22725 0.018951416015625 0.9999084491282701 +0.227375 0.021453857421875 0.9999084491282701 +0.2275 0.015655517578125 0.9999084491282701 +0.227625 0.00848388671875 0.9999084491282701 +0.22775 0.0 0.9999084491282701 +0.227875 -0.009521484375 0.9999084491282701 +0.228 -0.019866943359375 0.9999084491282701 +0.228125 -0.030609130859375 0.9999084491282701 +0.22825 -0.041534423828125 0.9999084491282701 +0.228375 -0.05224609375 0.9999084491282701 +0.2285 -0.0625 0.9999084491282701 +0.228625 -0.061614990234375 0.9999084491282701 +0.22875 -0.07025146484375 0.9999084491282701 +0.228875 -0.077392578125 0.9999084491282701 +0.229 -0.083343505859375 0.9999084491282701 +0.229125 -0.087005615234375 0.9999084491282701 +0.22925 -0.0885009765625 0.9999084491282701 +0.229375 -0.08856201171875 0.9999084491282701 +0.2295 -0.0853271484375 0.9999084491282701 +0.229625 -0.080780029296875 0.9999084491282701 +0.22975 -0.072418212890625 0.9999084491282701 +0.229875 -0.057525634765625 0.9999084491282701 +0.23 -0.046478271484375 0.9999084491282701 +0.230125 -0.03131103515625 0.9999084491282701 +0.23025 -0.015625 0.9999084491282701 +0.230375 0.00408935546875 0.9999084491282701 +0.2305 0.0260009765625 0.9999084491282701 +0.230625 0.047515869140625 0.9999084491282701 +0.23075 0.072784423828125 0.9999084491282701 +0.230875 0.096954345703125 0.9999084491282701 +0.231 0.124267578125 0.9999084491282701 +0.231125 0.146087646484375 0.9999084491282701 +0.23125 0.17108154296875 0.9999084491282701 +0.231375 0.1978759765625 0.9999084491282701 +0.2315 0.222137451171875 0.9999084491282701 +0.231625 0.24713134765625 0.9999084491282701 +0.23175 0.2705078125 0.9999084491282701 +0.231875 0.2906494140625 0.9999084491282701 +0.232 0.309661865234375 0.9999084491282701 +0.232125 0.325225830078125 0.9999084491282701 +0.23225 0.338348388671875 0.9999084491282701 +0.232375 0.337982177734375 0.9999084491282701 +0.2325 0.34417724609375 0.9999084491282701 +0.232625 0.3460693359375 0.9999084491282701 +0.23275 0.344940185546875 0.9999084491282701 +0.232875 0.338348388671875 0.9999084491282701 +0.233 0.327117919921875 0.9999084491282701 +0.233125 0.313720703125 0.9999084491282701 +0.23325 0.293487548828125 0.9999084491282701 +0.233375 0.271942138671875 0.9999084491282701 +0.2335 0.242919921875 0.9999084491282701 +0.233625 0.205047607421875 0.9999084491282701 +0.23375 0.17279052734375 0.9999084491282701 +0.233875 0.132904052734375 0.9999084491282701 +0.234 0.094329833984375 0.9999084491282701 +0.234125 0.048370361328125 0.9999084491282701 +0.23425 0.0 0.9999084491282701 +0.234375 -0.0452880859375 0.9999084491282701 +0.2345 -0.096954345703125 0.9999084491282701 +0.234625 -0.144439697265625 0.9999084491282701 +0.23475 -0.197174072265625 0.9999084491282701 +0.234875 -0.245147705078125 0.9999084491282701 +0.235 -0.291107177734375 0.9999084491282701 +0.235125 -0.34002685546875 0.9999084491282701 +0.23525 -0.38275146484375 0.9999084491282701 +0.235375 -0.4267578125 0.9999084491282701 +0.2355 -0.467132568359375 0.9999084491282701 +0.235625 -0.50067138671875 0.9999084491282701 +0.23575 -0.532684326171875 0.9999084491282701 +0.235875 -0.55780029296875 0.9999084491282701 +0.236 -0.57940673828125 0.9999084491282701 +0.236125 -0.58648681640625 0.9999084491282701 +0.23625 -0.595794677734375 0.9999084491282701 +0.236375 -0.598846435546875 0.9999084491282701 +0.2365 -0.596588134765625 0.9999084491282701 +0.236625 -0.58648681640625 0.9999084491282701 +0.23675 -0.56927490234375 0.9999084491282701 +0.236875 -0.54852294921875 0.9999084491282701 +0.237 -0.518035888671875 0.9999084491282701 +0.237125 -0.4854736328125 0.9999084491282701 +0.23725 -0.442413330078125 0.9999084491282701 +0.237375 -0.38861083984375 0.9999084491282701 +0.2375 -0.34051513671875 0.9999084491282701 +0.237625 -0.281707763671875 0.9999084491282701 +0.23775 -0.22503662109375 0.9999084491282701 +0.237875 -0.157989501953125 0.9999084491282701 +0.238 -0.087615966796875 0.9999084491282701 +0.238125 -0.02215576171875 0.9999084491282701 +0.23825 0.05224609375 0.9999084491282701 +0.238375 0.12030029296875 0.9999084491282701 +0.2385 0.195953369140625 0.9999084491282701 +0.238625 0.268280029296875 0.9999084491282701 +0.23875 0.334075927734375 0.9999084491282701 +0.238875 0.4046630859375 0.9999084491282701 +0.239 0.4658203125 0.9999084491282701 +0.239125 0.529510498046875 0.9999084491282701 +0.23925 0.58837890625 0.9999084491282701 +0.239375 0.637115478515625 0.9999084491282701 +0.2395 0.68475341796875 0.9999084491282701 +0.239625 0.722320556640625 0.9999084491282701 +0.23975 0.75628662109375 0.9999084491282701 +0.239875 0.776031494140625 0.9999084491282701 +0.24 0.792816162109375 0.9999084491282701 +0.240125 0.8026123046875 0.9999084491282701 +0.24025 0.804443359375 0.9999084491282701 +0.240375 0.797149658203125 0.9999084491282701 +0.2405 0.78082275390625 0.9999084491282701 +0.240625 0.7589111328125 0.9999084491282701 +0.24075 0.72552490234375 0.9999084491282701 +0.240875 0.688507080078125 0.9999084491282701 +0.241 0.6390380859375 0.9999084491282701 +0.241125 0.577850341796875 0.9999084491282701 +0.24125 0.520782470703125 0.9999084491282701 +0.241375 0.45062255859375 0.9999084491282701 +0.2415 0.38262939453125 0.9999084491282701 +0.241625 0.301788330078125 0.9999084491282701 +0.24175 0.216583251953125 0.9999084491282701 +0.241875 0.136993408203125 0.9999084491282701 +0.242 0.046051025390625 0.9999084491282701 +0.242125 -0.03704833984375 0.9999084491282701 +0.24225 -0.130096435546875 0.9999084491282701 +0.242375 -0.22149658203125 0.9999084491282701 +0.2425 -0.303314208984375 0.9999084491282701 +0.242625 -0.391754150390625 0.9999084491282701 +0.24275 -0.4686279296875 0.9999084491282701 +0.242875 -0.549560546875 0.9999084491282701 +0.243 -0.625244140625 0.9999084491282701 +0.243125 -0.688262939453125 0.9999084491282701 +0.24325 -0.75128173828125 0.9999084491282701 +0.243375 -0.80169677734375 0.9999084491282701 +0.2435 -0.8492431640625 0.9999084491282701 +0.243625 -0.85479736328125 0.9999084491282701 +0.24375 -0.85504150390625 0.9999084491282701 +0.243875 -0.855224609375 0.9999084491282701 +0.244 -0.855316162109375 0.9999084491282701 +0.244125 -0.855316162109375 0.9999084491282701 +0.24425 -0.855224609375 0.9999084491282701 +0.244375 -0.855072021484375 0.9999084491282701 +0.2445 -0.854766845703125 0.9999084491282701 +0.244625 -0.848236083984375 0.9999084491282701 +0.24475 -0.7996826171875 0.9999084491282701 +0.244875 -0.739776611328125 0.9999084491282701 +0.245 -0.680908203125 0.9999084491282701 +0.245125 -0.60772705078125 0.9999084491282701 +0.24525 -0.535858154296875 0.9999084491282701 +0.245375 -0.4498291015625 0.9999084491282701 +0.2455 -0.358306884765625 0.9999084491282701 +0.245625 -0.272186279296875 0.9999084491282701 +0.24575 -0.173126220703125 0.9999084491282701 +0.245875 -0.081939697265625 0.9999084491282701 +0.246 0.0205078125 0.9999084491282701 +0.246125 0.123046875 0.9999084491282701 +0.24625 0.214599609375 0.9999084491282701 +0.246375 0.314422607421875 0.9999084491282701 +0.2465 0.401641845703125 0.9999084491282701 +0.246625 0.494537353515625 0.9999084491282701 +0.24675 0.582183837890625 0.9999084491282701 +0.246875 0.655975341796875 0.9999084491282701 +0.247 0.731048583984375 0.9999084491282701 +0.247125 0.7919921875 0.9999084491282701 +0.24725 0.851409912109375 0.9999084491282701 +0.247375 0.85491943359375 0.9999084491282701 +0.2475 0.855255126953125 0.9999084491282701 +0.247625 0.855560302734375 0.9999084491282701 +0.24775 0.855743408203125 0.9999084491282701 +0.247875 0.8558349609375 0.9999084491282701 +0.248 0.8558349609375 0.9999084491282701 +0.248125 0.855743408203125 0.9999084491282701 +0.24825 0.85552978515625 0.9999084491282701 +0.248375 0.855255126953125 0.9999084491282701 +0.2485 0.8548583984375 0.9999084491282701 +0.248625 0.844207763671875 0.9999084491282701 +0.24875 0.78997802734375 0.9999084491282701 +0.248875 0.721435546875 0.9999084491282701 +0.249 0.6529541015625 0.9999084491282701 +0.249125 0.570068359375 0.9999084491282701 +0.24925 0.480987548828125 0.9999084491282701 +0.249375 0.396270751953125 0.9999084491282701 +0.2495 0.29815673828125 0.9999084491282701 +0.249625 0.20709228515625 0.9999084491282701 +0.24975 0.10400390625 0.9999084491282701 +0.249875 0.0 0.9999084491282701 +0.25 -0.093505859375 0.9999084491282701 +0.250125 -0.196258544921875 0.9999084491282701 +0.25025 -0.286651611328125 0.9999084491282701 +0.250375 -0.383819580078125 0.9999084491282701 +0.2505 -0.476470947265625 0.9999084491282701 +0.250625 -0.555023193359375 0.9999084491282701 +0.25075 -0.63629150390625 0.9999084491282701 +0.250875 -0.70306396484375 0.9999084491282701 +0.251 -0.7696533203125 0.9999084491282701 +0.251125 -0.8292236328125 0.9999084491282701 +0.25125 -0.85467529296875 0.9999084491282701 +0.251375 -0.855072021484375 0.9999084491282701 +0.2515 -0.855316162109375 0.9999084491282701 +0.251625 -0.855499267578125 0.9999084491282701 +0.25175 -0.8555908203125 0.9999084491282701 +0.251875 -0.8555908203125 0.9999084491282701 +0.252 -0.85546875 0.9999084491282701 +0.252125 -0.85528564453125 0.9999084491282701 +0.25225 -0.855010986328125 0.9999084491282701 +0.252375 -0.854644775390625 0.9999084491282701 +0.2525 -0.8238525390625 0.9999084491282701 +0.252625 -0.76593017578125 0.9999084491282701 +0.25275 -0.706634521484375 0.9999084491282701 +0.252875 -0.634033203125 0.9999084491282701 +0.253 -0.554931640625 0.9999084491282701 +0.253125 -0.478851318359375 0.9999084491282701 +0.25325 -0.39007568359375 0.9999084491282701 +0.253375 -0.306915283203125 0.9999084491282701 +0.2535 -0.212249755859375 0.9999084491282701 +0.253625 -0.116455078125 0.9999084491282701 +0.2537500000000001 -0.029022216796875 0.9999084491282701 +0.253875 0.06744384765625 0.9999084491282701 +0.254 0.152984619140625 0.9999084491282701 +0.254125 0.245574951171875 0.9999084491282701 +0.25425 0.334625244140625 0.9999084491282701 +0.254375 0.410675048828125 0.9999084491282701 +0.2545 0.490264892578125 0.9999084491282701 +0.254625 0.556243896484375 0.9999084491282701 +0.25475 0.623260498046875 0.9999084491282701 +0.254875 0.6864013671875 0.9999084491282701 +0.255 0.732818603515625 0.9999084491282701 +0.255125 0.77655029296875 0.9999084491282701 +0.25525 0.80767822265625 0.9999084491282701 +0.255375 0.833892822265625 0.9999084491282701 +0.2555 0.85052490234375 0.9999084491282701 +0.255625 0.8544921875 0.9999084491282701 +0.25575 0.8544921875 0.9999084491282701 +0.255875 0.8450927734375 0.9999084491282701 diff --git a/tests/testlib/synthnotehelper.py b/tests/testlib/synthnotehelper.py new file mode 100644 index 0000000000..ff7092e88d --- /dev/null +++ b/tests/testlib/synthnotehelper.py @@ -0,0 +1,82 @@ +import array +from ulab import numpy as np +from math import sin, pi, ceil +from audiocore import get_buffer +from synthio import Note, LFO, MathOperation, Synthesizer + +bend_out = array.array("h", [0, 32767]) +bend_in = array.array("h", [32767, 0]) +sweep = array.array("h", [-32767, 32767]) +triangle = array.array("h", [0, 32767, 0, -32767]) +sine = array.array("h", [int(32767 * sin(i * 2 * pi / 600)) for i in range(600)]) + + +def print_result(*blocks): + for i in range(48000 / 256): + print(*lfo_tick(*blocks)) + + +def mathop_test(kind): + v = LFO(sweep, rate=1, scale=2, once=True) + varying_a = kind(v, 2, -3) + varying_b = kind(-3, v, 2) + varying_c = kind(2, -3, v) + print_result(v, varying_a, varying_b, varying_c) + + +def synth_test(_gen=None, **kw): + kw.setdefault("waveform", sine) + kw.setdefault("channel_count", 1) + kw.setdefault("sample_rate", 8000) + + def func(gen): + synth = Synthesizer(**kw) + t = 0 + dt = 1 / kw["sample_rate"] + channel_count = kw["channel_count"] + g = gen(synth) + blocks = list(next(g)) + for st in g: + nframes = ceil(st / dt / 256) + for i in range(nframes): + samples = np.frombuffer(get_buffer(synth)[1], dtype=np.int16) / 32768.0 + block_values = [b.value for b in blocks] + for k in range(0, len(samples), channel_count): + print(t * dt, *(list(samples[k : k + channel_count]) + block_values)) + t += 1 + + if _gen is None: + return func + else: + func(_gen) + + +def rms(seq): + return np.sqrt(np.mean(seq**2)) + + +def synth_test_rms(_gen=None, **kw): + kw.setdefault("waveform", sine) + kw.setdefault("channel_count", 1) + kw.setdefault("sample_rate", 8192) + + def func(gen): + synth = Synthesizer(**kw) + t = 0 + dt = 256 / kw["sample_rate"] + channel_count = kw["channel_count"] + g = gen(synth) + blocks = list(next(g)) + for st in g: + nframes = ceil(st / dt) + for i in range(nframes): + samples = np.frombuffer(get_buffer(synth)[1], dtype=np.int16) / 32768.0 + rms_values = [rms(samples[i::2]) for i in range(channel_count)] + block_values = [b.value for b in blocks] + print(t * dt, *(rms_values + block_values)) + t += 1 + + if _gen is None: + return func + else: + func(_gen) From 117e6ab7ca82d8b95d79cfa89bc33c9e1ab8a575 Mon Sep 17 00:00:00 2001 From: David Sullivan Date: Wed, 24 May 2023 14:44:37 -0700 Subject: [PATCH 1144/1712] update pins to match schematic --- ports/espressif/boards/lolin_c3_pico/mpconfigboard.h | 2 +- ports/espressif/boards/lolin_c3_pico/pins.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h index b553186052..3e68e6adf9 100644 --- a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h +++ b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h @@ -40,7 +40,7 @@ #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO10, .sda = &pin_GPIO8}} #define CIRCUITPY_BOARD_SPI (1) -#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO10, .mosi = &pin_GPIO7, .miso = &pin_GPIO8}} +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO1, .mosi = &pin_GPIO4, .miso = &pin_GPIO0}} #define CIRCUITPY_BOARD_UART (1) #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} diff --git a/ports/espressif/boards/lolin_c3_pico/pins.c b/ports/espressif/boards/lolin_c3_pico/pins.c index 33a9432748..d36c9f9b14 100644 --- a/ports/espressif/boards/lolin_c3_pico/pins.c +++ b/ports/espressif/boards/lolin_c3_pico/pins.c @@ -15,20 +15,20 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, From 88558486b7ac5d35c0c3c6d8ebf9303c4fd7af8d Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Thu, 25 May 2023 11:52:16 +0000 Subject: [PATCH 1145/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 8ff5aed302..abb457442b 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-05-19 16:13+0000\n" +"PO-Revision-Date: 2023-05-26 12:50+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -2522,7 +2522,7 @@ msgstr "Annoteringen måste vara en identifierare" #: extmod/ulab/code/numpy/create.c msgid "arange: cannot compute length" -msgstr "" +msgstr "arange: kan inte beräkna längd" #: py/modbuiltins.c msgid "arg is an empty sequence" @@ -2698,7 +2698,7 @@ msgstr "kan bara ha upp till 4 parametrar att Xtensa assembly" #: extmod/ulab/code/ndarray.c msgid "can only specify one unknown dimension" -msgstr "" +msgstr "kan enbart ange en okänd dimension" #: py/objtype.c msgid "can't add special method to already-subclassed class" @@ -2855,7 +2855,7 @@ msgstr "kan inte importera namn %q" #: extmod/ulab/code/ndarray.c msgid "cannot reshape array" -msgstr "" +msgstr "kan inte omforma matris" #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" @@ -4029,7 +4029,7 @@ msgstr "set stöds inte" #: extmod/ulab/code/ndarray.c msgid "shape must be integer or tuple of integers" -msgstr "" +msgstr "shape måste vara ett heltal eller en tupel av heltal" #: shared-module/msgpack/__init__.c msgid "short read" From 3a893594b28172f8ae359361493aed08e0989322 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 26 May 2023 12:29:43 -0400 Subject: [PATCH 1146/1712] Add Adafruit Metro RP2040 --- .../boards/adafruit_metro_rp2040/board.c | 29 ++++++++ .../adafruit_metro_rp2040/mpconfigboard.h | 14 ++++ .../adafruit_metro_rp2040/mpconfigboard.mk | 9 +++ .../pico-sdk-configboard.h | 4 ++ .../boards/adafruit_metro_rp2040/pins.c | 66 +++++++++++++++++++ 5 files changed, 122 insertions(+) create mode 100644 ports/raspberrypi/boards/adafruit_metro_rp2040/board.c create mode 100644 ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/adafruit_metro_rp2040/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/adafruit_metro_rp2040/pins.c diff --git a/ports/raspberrypi/boards/adafruit_metro_rp2040/board.c b/ports/raspberrypi/boards/adafruit_metro_rp2040/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_metro_rp2040/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.h b/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.h new file mode 100644 index 0000000000..62eabc67f8 --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "Adafruit Metro RP2040" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO14) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO17) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO16) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO18) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO19) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk new file mode 100644 index 0000000000..14b3af9d57 --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x239A +USB_PID = 0x813E +USB_PRODUCT = "Metro RP2040" +USB_MANUFACTURER = "Adafruit" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ" diff --git a/ports/raspberrypi/boards/adafruit_metro_rp2040/pico-sdk-configboard.h b/ports/raspberrypi/boards/adafruit_metro_rp2040/pico-sdk-configboard.h new file mode 100644 index 0000000000..a41131dd22 --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_metro_rp2040/pico-sdk-configboard.h @@ -0,0 +1,4 @@ +// Put board-specific pico-sdk definitions here. This file must exist. + +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/adafruit_metro_rp2040/pins.c b/ports/raspberrypi/boards/adafruit_metro_rp2040/pins.c new file mode 100644 index 0000000000..04ae94c80f --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_metro_rp2040/pins.c @@ -0,0 +1,66 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO24) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, + + // On-board switch reverses D0 and D1 connections to RX and TX. + + { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX_D0_SWITCH_LEFT), MP_ROM_PTR(&pin_GPIO0) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX_D0_SWITCH_RIGHT), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX_D1_SWITCH_LEFT), MP_ROM_PTR(&pin_GPIO1) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX_D1_SWITCH_RIGHT), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CD), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO18) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_CLOCK), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO19) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_COMMAND), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO20) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_DATA0), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_DATA1), MP_ROM_PTR(&pin_GPIO21) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_DATA2), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO23) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_DATA3), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 325037b75e77b9a6c64085eb045e89fccc8c6121 Mon Sep 17 00:00:00 2001 From: Pierre Constantineau Date: Fri, 26 May 2023 13:17:05 -0600 Subject: [PATCH 1147/1712] fix to make buttons and leds compatible with pca10056 --- ports/nrf/boards/pca10100/mpconfigboard.h | 4 ---- ports/nrf/boards/pca10100/pins.c | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/nrf/boards/pca10100/mpconfigboard.h b/ports/nrf/boards/pca10100/mpconfigboard.h index 1456f29949..31b5a350fb 100644 --- a/ports/nrf/boards/pca10100/mpconfigboard.h +++ b/ports/nrf/boards/pca10100/mpconfigboard.h @@ -30,10 +30,6 @@ #define MICROPY_HW_BOARD_NAME "PCA10100 nRF52833 DK" #define MICROPY_HW_MCU_NAME "nRF52833" -#define MICROPY_HW_LED_STATUS (&pin_P0_13) -#define MICROPY_HW_LED_TX (&pin_P0_14) -#define MICROPY_HW_LED_RX (&pin_P0_15) - #define CIRCUITPY_INTERNAL_NVM_SIZE 0 #define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (60 * 1024) diff --git a/ports/nrf/boards/pca10100/pins.c b/ports/nrf/boards/pca10100/pins.c index 68d87d0e8f..6f80514923 100644 --- a/ports/nrf/boards/pca10100/pins.c +++ b/ports/nrf/boards/pca10100/pins.c @@ -45,10 +45,14 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_LED3), MP_ROM_PTR(&pin_P0_15) }, { MP_ROM_QSTR(MP_QSTR_LED4), MP_ROM_PTR(&pin_P0_16) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON1), MP_ROM_PTR(&pin_P0_11) }, { MP_ROM_QSTR(MP_QSTR_BUTTON1_DEFAULT), MP_ROM_PTR(&pin_P0_11) }, { MP_ROM_QSTR(MP_QSTR_BUTTON1_OPTIONAL), MP_ROM_PTR(&pin_P1_07) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON2), MP_ROM_PTR(&pin_P0_12) }, { MP_ROM_QSTR(MP_QSTR_BUTTON2_DEFAULT), MP_ROM_PTR(&pin_P0_12) }, { MP_ROM_QSTR(MP_QSTR_BUTTON2_OPTIONAL), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON3), MP_ROM_PTR(&pin_P0_24) }, { MP_ROM_QSTR(MP_QSTR_BUTTON4), MP_ROM_PTR(&pin_P0_25) }, }; From 60ce38ed8bb23ef2fefe82d797ca23318b60d938 Mon Sep 17 00:00:00 2001 From: Pierre Constantineau Date: Fri, 26 May 2023 13:30:32 -0600 Subject: [PATCH 1148/1712] fix trailing space of pins.c --- ports/nrf/boards/pca10100/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/boards/pca10100/pins.c b/ports/nrf/boards/pca10100/pins.c index 6f80514923..e6ca54eb2e 100644 --- a/ports/nrf/boards/pca10100/pins.c +++ b/ports/nrf/boards/pca10100/pins.c @@ -52,7 +52,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_BUTTON2), MP_ROM_PTR(&pin_P0_12) }, { MP_ROM_QSTR(MP_QSTR_BUTTON2_DEFAULT), MP_ROM_PTR(&pin_P0_12) }, { MP_ROM_QSTR(MP_QSTR_BUTTON2_OPTIONAL), MP_ROM_PTR(&pin_P1_08) }, - + { MP_ROM_QSTR(MP_QSTR_BUTTON3), MP_ROM_PTR(&pin_P0_24) }, { MP_ROM_QSTR(MP_QSTR_BUTTON4), MP_ROM_PTR(&pin_P0_25) }, }; From c1722ad4867d865c095714cfec921eef36216354 Mon Sep 17 00:00:00 2001 From: Graeme Winter Date: Wed, 24 May 2023 06:43:51 +0100 Subject: [PATCH 1149/1712] Additional cast through void* Tell the compiler we know what we are doing, and that the bytes are correctly aligned, to avoid compiler warning: error: cast increases required alignment of target type --- extmod/moductypes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extmod/moductypes.c b/extmod/moductypes.c index f770ead006..38f700c055 100644 --- a/extmod/moductypes.c +++ b/extmod/moductypes.c @@ -544,7 +544,7 @@ STATIC mp_obj_t uctypes_struct_subscr(mp_obj_t base_in, mp_obj_t index_in, mp_ob } } else if (agg_type == PTR) { - byte *p = *(void **)self->addr; + byte *p = *(void **)(void *)self->addr; if (mp_obj_is_small_int(t->items[1])) { uint val_type = GET_TYPE(MP_OBJ_SMALL_INT_VALUE(t->items[1]), VAL_TYPE_BITS); return get_aligned(val_type, p, index); @@ -574,7 +574,7 @@ STATIC mp_obj_t uctypes_struct_unary_op(mp_unary_op_t op, mp_obj_t self_in) { mp_int_t offset = MP_OBJ_SMALL_INT_VALUE(t->items[0]); uint agg_type = GET_TYPE(offset, AGG_TYPE_BITS); if (agg_type == PTR) { - byte *p = *(void **)self->addr; + byte *p = *(void **)(void *)self->addr; return mp_obj_new_int((mp_int_t)(uintptr_t)p); } } From 60935c29ebb6140401dc4136c7592d501345a1b9 Mon Sep 17 00:00:00 2001 From: applecuckoo Date: Sun, 28 May 2023 16:01:59 +1200 Subject: [PATCH 1150/1712] Fix up EFR32 port readme --- README.rst | 1 + ports/silabs/README.md | 85 ++++++++++----------- ports/silabs/res/{Thony.png => Thonny.png} | Bin 3 files changed, 43 insertions(+), 43 deletions(-) rename ports/silabs/res/{Thony.png => Thonny.png} (100%) diff --git a/README.rst b/README.rst index 1a6dc2c33e..c07591ef3b 100644 --- a/README.rst +++ b/README.rst @@ -235,6 +235,7 @@ litex alpha mimxrt10xx alpha nrf stable raspberrypi stable +efr32 alpha stm ``F4`` stable | ``others`` beta unix alpha ================ ============================================================ diff --git a/ports/silabs/README.md b/ports/silabs/README.md index 626b8e7788..1186690911 100644 --- a/ports/silabs/README.md +++ b/ports/silabs/README.md @@ -1,4 +1,5 @@ -# Circuitpython on EFR32 # +# CircuitPython on EFR32 # + ![GitHub](https://img.shields.io/badge/Technology-Bluetooth_BLE-green) ![GitHub](https://img.shields.io/badge/CircuitPython-8.1.0--beta.0-green) ![GitHub](https://img.shields.io/badge/GSDK-v4.2.1-green) @@ -10,68 +11,69 @@ This port brings the Silicon Labs EFR32 series of MCUs to Circuitpython. Refer to **mpconfigport.mk** for a full list of enabled modules sorted by family. -## How this port is organized: ## +## How this port is organized ## -- **boards/** contains the configuration files for each development board and breakout available on the port, as well as system files and both shared and SoC-specific linker files. Board configuration includes a pin mapping of the board, oscillator information, board-specific build flags, and setup for some other peripheral where applicable. +- **boards/** contains the configuration files for each development board and breakout available on the port, as well as system files and both shared and SoC-specific linker files. Board configuration includes a pin mapping of the board, oscillator information, board-specific build flags, and setup for other peripherals where applicable. - **common-hal/** contains the port-specific module implementations, used by shared-module and shared-bindings. - **peripherals/** contains peripheral setup files and peripheral mapping information, sorted by family and sub-variant. Most files in this directory can be generated with the python scripts in **tools/**. - **supervisor/** contains port-specific implementations of internal flash and serial, as well as the **port.c** file, which initializes the port at startup. -- **tools/** contains Silicon Labs configurator (SLC) tool, python scripts for generating peripheral and pin mapping files in **peripherals/** and **board/**. +- **tools/** contains the Silicon Labs Configurator (SLC) tool, python scripts for generating peripheral and pin mapping files in **peripherals/** and **board/**. At the root level, refer to **mpconfigboard.h** and **mpconfigport.mk** for port specific settings and a list of enabled modules. ## Prerequisites ## + Please ensure you set up your build environment appropriately, as per the guide. You will need: -- Linux: https://learn.adafruit.com/building-circuitpython/linux -- Windows Subsystem for Linux (WSL): https://learn.adafruit.com/building-circuitpython/windows-subsystem-for-linux -- MacOS: Not supported yet +- Linux: +- Windows Subsystem for Linux (WSL): +- macOS: Not supported yet Install necessary packages - $ sudo apt install default-jre gcc-arm-none-eabi wget python3 python3-pip git git-lfs gettext uncrustify - $ sudo python -m pip install --upgrade pip + sudo apt install default-jre gcc-arm-none-eabi wget python3 python3-pip git git-lfs gettext uncrustify + sudo python -m pip install --upgrade pip -## Board supported ## +## Supported boards ## | Board | Code | Build CMD | | --------------------------- | ------------ | ------------------------------------------ | | xG24 Dev Kit | brd2601b | devkit_xg24_brd2601b | | xG24 Explorer Kit | brd2703a | explorerkit_xg24_brd2703a | -| Sparkfun Thing Plus MGM240P | brd2704a | sparkfun_thingplus_matter_mgm240p_brd2704a | +| SparkFun Thing Plus MGM240P | brd2704a | sparkfun_thingplus_matter_mgm240p_brd2704a | ## Build instructions ## -Ensure your clone of Circuitpython is ready to build by following the [guide on the Adafruit Website](https://learn.adafruit.com/building-circuitpython/build-circuitpython). This includes installing the toolchain, synchronizing submodules, and running `mpy-cross`. +Ensure your clone of CircuitPython is ready to build by following the [guide on the Adafruit Learning System](https://learn.adafruit.com/building-circuitpython/build-circuitpython). This includes installing the toolchain, synchronizing submodules, and running `mpy-cross`. -Clone the source code of CircuitPython from Github: +Clone the source code of CircuitPython from GitHub: - $ git clone https://github.com/SiliconLabs/circuitpython.git - $ cd circuitpython - $ make fetch-submodules + git clone https://github.com/adafruit/circuitpython.git + cd circuitpython + make fetch-submodules Checkout the branch or tag you want to build. For example: - $ git checkout main + git checkout main -Following the guideline below to install required packages for SLC tool: - https://www.silabs.com/documents/public/user-guides/ug520-software-project-generation-configuration-with-slc-cli.pdf +Follow the guide below to install the required packages for the Silicon Labs Configurator (SLC): + Once the one-time build tasks are complete, you can build at any time by navigating to the port directory: - $ make BOARD=explorerkit_xg24_brd2703a + make BOARD=explorerkit_xg24_brd2703a You may also build with certain flags available in the makefile, depending on your board and development goals: - $ make BOARD=explorerkit_xg24_brd2703a DEBUG=1 + make BOARD=explorerkit_xg24_brd2703a DEBUG=1 -Clean project by using: +Clean the project by using: - $ make BOARD=explorerkit_xg24_brd2703a clean + make BOARD=explorerkit_xg24_brd2703a clean -## Bring-up on the board ## +## Running CircuitPython ## -### Getting a REPL prompt ### +### Connecting to the Serial Console ### Connect the devkit to the PC via the USB cable. The board uses serial for REPL access and debugging because the EFR32 chips has no USB support. @@ -81,31 +83,28 @@ On Windows, we need to install a serial console e.g., PuTTY, MobaXterm. The JLin #### Linux #### -Open a terminal and issue the following command:  +Open a terminal and issue the following command: - $ ls /dev/ttyACM* + ls /dev/ttyACM* -Then note down the correct name and substitute com-port-name in the following command with it:  +Then note down the correct name and substitute com-port-name in the following command with it: - $ screen /dev/'com-port-name' + screen /dev/'com-port-name' ### Using the REPL prompt ### After flashing the firmware to the board, at your first connecting to the board, you might see a blank screen. Press enter and you should be presented with a Circuitpython prompt, >>>. If not, try to reset the board (see instructions below). -You can now type in simple commands such as:  +You can now type in simple commands such as: -```sh ->>> print("Hello world!")  - -Hello world -``` + >>> print("Hello world!")  + Hello world! If something goes wrong with the board, you can reset it. Pressing CTRL+D when the prompt is open performs a soft reset. ### Recommended editors ### -**Thonny** is a simple code editor that works with the Adafruit CircuitPython boards.  +**Thonny** is a simple code editor that works with the Adafruit CircuitPython boards. Config serial: Tools > Options > Interpreter > Select MicroPython > Select Port Jlink CDC UART Port @@ -115,18 +114,18 @@ At the boot stage, two scripts will be run (if not booting in safe mode). First, After code.py has finished executing, a REPL prompt will be presented on the serial port. Other files can also be executed by using the **Thonny** editors or using **Ampy** tool. -![Thony](./res/Thony.png) +![Thonny](./res/Thonny.png) With the boards which support USB mass storage, we can drag the files to the board file system. However, because the EFR32 boards don’t support USB mass storage, we need to use a tool like **Ampy** to copy the file to the board. You can use the latest version of **Ampy** and its  command to copy the module directories to the board. -Refer to the guideline below for installing the **Ampy** tool:  +Refer to the guide below for installing the **Ampy** tool: -https://learn.adafruit.com/micropython-basics-load-files-and-run-code/install-ampy   + -## Modules supported ## +## Built-in modules available ## | Board | Modules Available| | --------------------------- | ---------------- | -| xG24 Dev Kit | _asyncio, _bleio, _pixelmap, adafruit_ble, adafruit_bus_device, adafruit_pixelbuf, adafruit_register, aesio,analogio, array, atexit, binascii, bitmaptools, board, builtins, busio, collections, digitalio, displayio,errno, fontio, framebufferio, gc, getpass, gifio, json, math, microcontroller, micropython, msgpack, nvm, onewireio, os, pwmio, rainbowio, random, re, rtc, select, sharpdisplay, storage, struct, supervisor, sys, terminalio, time, traceback, ulab, uselect, vectorio, watchdog, zlib | -| xG24 Explorer Kit | _asyncio, _bleio, _pixelmap, adafruit_ble, adafruit_bus_device, adafruit_pixelbuf, adafruit_register, aesio,analogio, array, atexit, binascii, bitmaptools, board, builtins, busio, collections, digitalio, displayio,errno, fontio, framebufferio, gc, getpass, gifio, json, math, microcontroller, micropython, msgpack, nvm, onewireio, os, pwmio, rainbowio, random, re, rtc, sdcardio, select, sharpdisplay, storage, struct, supervisor, sys, terminalio, time, traceback, ulab, uselect, vectorio, watchdog, zlib | -| Sparkfun Thing Plus MGM240P | _asyncio, _bleio, _pixelmap, adafruit_ble, adafruit_bus_device, adafruit_pixelbuf, adafruit_register, aesio,analogio, array, atexit, binascii, bitmaptools, board, builtins, busio, collections, digitalio, displayio,errno, fontio, framebufferio, gc, getpass, gifio, json, math, microcontroller, micropython, msgpack, nvm, onewireio, os, pwmio, rainbowio, random, re, rtc, sdcardio, select, sharpdisplay, storage, struct, supervisor, sys, terminalio, time, traceback, ulab, uselect, vectorio, watchdog, zlib | +| xG24 Dev Kit | _asyncio, _bleio, _pixelmap, adafruit_ble, adafruit_bus_device, adafruit_pixelbuf, adafruit_register, aesio, analogio, array, atexit, binascii, bitmaptools, board, builtins, busio, collections, digitalio, displayio, errno, fontio, framebufferio, gc, getpass, gifio, json, math, microcontroller, micropython, msgpack, nvm, onewireio, os, pwmio, rainbowio, random, re, rtc, select, sharpdisplay, storage, struct, supervisor, sys, terminalio, time, traceback, ulab, uselect, vectorio, watchdog, zlib | +| xG24 Explorer Kit | _asyncio, _bleio, _pixelmap, adafruit_ble, adafruit_bus_device, adafruit_pixelbuf, adafruit_register, aesio, analogio, array, atexit, binascii, bitmaptools, board, builtins, busio, collections, digitalio, displayio, errno, fontio, framebufferio, gc, getpass, gifio, json, math, microcontroller, micropython, msgpack, nvm, onewireio, os, pwmio, rainbowio, random, re, rtc, sdcardio, select, sharpdisplay, storage, struct, supervisor, sys, terminalio, time, traceback, ulab, uselect, vectorio, watchdog, zlib | +| SparkFun Thing Plus MGM240P | _asyncio, _bleio, _pixelmap, adafruit_ble, adafruit_bus_device, adafruit_pixelbuf, adafruit_register, aesio, analogio, array, atexit, binascii, bitmaptools, board, builtins, busio, collections, digitalio, displayio, errno, fontio, framebufferio, gc, getpass, gifio, json, math, microcontroller, micropython, msgpack, nvm, onewireio, os, pwmio, rainbowio, random, re, rtc, sdcardio, select, sharpdisplay, storage, struct, supervisor, sys, terminalio, time, traceback, ulab, uselect, vectorio, watchdog, zlib | diff --git a/ports/silabs/res/Thony.png b/ports/silabs/res/Thonny.png similarity index 100% rename from ports/silabs/res/Thony.png rename to ports/silabs/res/Thonny.png From d73f390a4dac791943facd3d7c505b8fe0ba65fb Mon Sep 17 00:00:00 2001 From: hyx0329 Date: Sat, 27 May 2023 09:49:53 +0800 Subject: [PATCH 1151/1712] M60 keyboard: allow run on battery This also expose the battery control pin as BATTERY_ENABLE, so users can fully power off the keyboard. --- .../boards/makerdiary_m60_keyboard/board.c | 33 +++++++++++++++++++ .../makerdiary_m60_keyboard/mpconfigboard.h | 2 ++ .../nrf/boards/makerdiary_m60_keyboard/pins.c | 1 + 3 files changed, 36 insertions(+) diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/board.c b/ports/nrf/boards/makerdiary_m60_keyboard/board.c index 8074c895dc..83f42558cb 100644 --- a/ports/nrf/boards/makerdiary_m60_keyboard/board.c +++ b/ports/nrf/boards/makerdiary_m60_keyboard/board.c @@ -25,6 +25,39 @@ */ #include "supervisor/board.h" +#include "supervisor/shared/board.h" +#include "mpconfigboard.h" +static void power_on(void) { + // turn on internal battery + nrf_gpio_cfg(POWER_SWITCH_PIN->number, + NRF_GPIO_PIN_DIR_OUTPUT, + NRF_GPIO_PIN_INPUT_DISCONNECT, + NRF_GPIO_PIN_NOPULL, + NRF_GPIO_PIN_S0S1, + NRF_GPIO_PIN_NOSENSE); + nrf_gpio_pin_write(POWER_SWITCH_PIN->number, true); +} + +static void preserve_and_release_battery_pin(void) { + // Preserve the battery state. The battery is enabled by default in factory bootloader. + // Reset claimed_pins so user can control pin's state in the vm. + // The code below doesn't actually reset the pin's state, but only set the flags. + reset_pin_number(POWER_SWITCH_PIN->number); // clear claimed_pins and never_reset_pins + never_reset_pin_number(POWER_SWITCH_PIN->number); // set never_reset_pins +} + +void board_init(void) { + // As of cpy 8.1.0, board_init() runs after reset_ports() on first run. That means + // never_reset_pins won't be set at boot, the battery pin is reset, causing system + // shutdown. + // So if we need to run on battery, we must enable the battery here. + power_on(); + preserve_and_release_battery_pin(); +} + +void reset_board(void) { + preserve_and_release_battery_pin(); +} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h index 23a98c948b..eb2bf93e76 100644 --- a/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h +++ b/ports/nrf/boards/makerdiary_m60_keyboard/mpconfigboard.h @@ -49,3 +49,5 @@ #define DEFAULT_I2C_BUS_SCL (&pin_P1_06) #define DEFAULT_I2C_BUS_SDA (&pin_P1_05) + +#define POWER_SWITCH_PIN (&pin_P0_28) diff --git a/ports/nrf/boards/makerdiary_m60_keyboard/pins.c b/ports/nrf/boards/makerdiary_m60_keyboard/pins.c index 485b968f4a..9a889bdd48 100644 --- a/ports/nrf/boards/makerdiary_m60_keyboard/pins.c +++ b/ports/nrf/boards/makerdiary_m60_keyboard/pins.c @@ -39,6 +39,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_CHARGING), MP_ROM_PTR(&pin_P0_03) }, { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_02) }, { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY_ENABLE), MP_ROM_PTR(&pin_P0_28) }, { MP_ROM_QSTR(MP_QSTR_RGB_POWER), MP_ROM_PTR(&pin_P1_04) }, From 923d443a25f77c693c1ebce8ef70845d5fcba302 Mon Sep 17 00:00:00 2001 From: Ettore Atalan Date: Sat, 27 May 2023 17:33:59 +0000 Subject: [PATCH 1152/1712] Translated using Weblate (German) Currently translated at 99.4% (992 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/de/ --- locale/de_DE.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/de_DE.po b/locale/de_DE.po index 90efb4b1e8..6bca238bd0 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -6,8 +6,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-05-21 00:49+0000\n" -"Last-Translator: Scott Shawcroft \n" +"PO-Revision-Date: 2023-05-28 17:49+0000\n" +"Last-Translator: Ettore Atalan \n" "Language: de_DE\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -1318,7 +1318,7 @@ msgstr "Ungültige format chunk size" #: shared-bindings/wifi/Radio.c msgid "Invalid hex password" -msgstr "" +msgstr "Ungültiges Hex-Passwort" #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" From fed8d5825b1e2b2882b0f1b6b892eeecc316f50a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 29 May 2023 09:50:18 -0500 Subject: [PATCH 1153/1712] synthio: add biquad filter type & basic filter calculations the filter cannot be applied as yet. --- .../unix/variants/coverage/mpconfigvariant.mk | 2 + py/circuitpy_defns.mk | 1 + shared-bindings/synthio/Biquad.c | 110 ++++++++++++++++++ shared-bindings/synthio/Biquad.h | 9 ++ shared-bindings/synthio/Synthesizer.c | 108 +++++++++++++++++ shared-bindings/synthio/__init__.c | 2 + shared-module/synthio/Biquad.c | 94 +++++++++++++++ tests/circuitpython/synthio_biquad.py | 12 ++ tests/circuitpython/synthio_biquad.py.exp | 3 + 9 files changed, 341 insertions(+) create mode 100644 shared-bindings/synthio/Biquad.c create mode 100644 shared-bindings/synthio/Biquad.h create mode 100644 shared-module/synthio/Biquad.c create mode 100644 tests/circuitpython/synthio_biquad.py create mode 100644 tests/circuitpython/synthio_biquad.py.exp diff --git a/ports/unix/variants/coverage/mpconfigvariant.mk b/ports/unix/variants/coverage/mpconfigvariant.mk index 7fe2afdb36..f63054bdd6 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.mk +++ b/ports/unix/variants/coverage/mpconfigvariant.mk @@ -45,6 +45,7 @@ SRC_BITMAP := \ shared-bindings/synthio/MidiTrack.c \ shared-bindings/synthio/LFO.c \ shared-bindings/synthio/Note.c \ + shared-bindings/synthio/Biquad.c \ shared-bindings/synthio/Synthesizer.c \ shared-bindings/traceback/__init__.c \ shared-bindings/util.c \ @@ -70,6 +71,7 @@ SRC_BITMAP := \ shared-module/synthio/MidiTrack.c \ shared-module/synthio/LFO.c \ shared-module/synthio/Note.c \ + shared-module/synthio/Biquad.c \ shared-module/synthio/Synthesizer.c \ shared-module/traceback/__init__.c \ shared-module/zlib/__init__.c \ diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index ae4b1bf3db..b6bb36fa24 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -650,6 +650,7 @@ SRC_SHARED_MODULE_ALL = \ struct/__init__.c \ supervisor/__init__.c \ supervisor/StatusBar.c \ + synthio/Biquad.c \ synthio/LFO.c \ synthio/Math.c \ synthio/MidiTrack.c \ diff --git a/shared-bindings/synthio/Biquad.c b/shared-bindings/synthio/Biquad.c new file mode 100644 index 0000000000..6fd2856e02 --- /dev/null +++ b/shared-bindings/synthio/Biquad.c @@ -0,0 +1,110 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 Artyom Skrobov + * + * 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 "py/enum.h" +#include "py/mperrno.h" +#include "py/obj.h" +#include "py/objnamedtuple.h" +#include "py/runtime.h" + +#include "shared-bindings/synthio/__init__.h" +#include "shared-bindings/synthio/LFO.h" +#include "shared-bindings/synthio/Math.h" +#include "shared-bindings/synthio/MidiTrack.h" +#include "shared-bindings/synthio/Note.h" +#include "shared-bindings/synthio/Synthesizer.h" + +#include "shared-module/synthio/LFO.h" + +#define default_attack_time (MICROPY_FLOAT_CONST(0.1)) +#define default_decay_time (MICROPY_FLOAT_CONST(0.05)) +#define default_release_time (MICROPY_FLOAT_CONST(0.2)) +#define default_attack_level (MICROPY_FLOAT_CONST(1.)) +#define default_sustain_level (MICROPY_FLOAT_CONST(0.8)) + +static const mp_arg_t biquad_properties[] = { + { MP_QSTR_a1, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_a2, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_b0, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_b1, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_b2, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = MP_ROM_NONE} }, +}; + +//| class Biquad: +//| def __init__(self, b0: float, b1: float, b2: float, a1: float, a2: float) -> None: +//| """Construct a normalized biquad filter object. +//| +//| This implements the "direct form 1" biquad filter, where each coefficient +//| has been pre-divided by a0. +//| +//| Biquad objects are usually constructed via one of the related methods on a `Synthesizer` object +//| rather than directly from coefficients. +//| +//| https://github.com/WebAudio/Audio-EQ-Cookbook/blob/main/Audio-EQ-Cookbook.txt +//| """ +//| +STATIC mp_obj_t synthio_biquad_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + mp_arg_val_t args[MP_ARRAY_SIZE(biquad_properties)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(biquad_properties), biquad_properties, args); + + for (size_t i = 0; i < MP_ARRAY_SIZE(biquad_properties); i++) { + args[i].u_obj = mp_obj_new_float(mp_arg_validate_type_float(args[i].u_obj, biquad_properties[i].qst)); + } + + MP_STATIC_ASSERT(sizeof(mp_arg_val_t) == sizeof(mp_obj_t)); + return namedtuple_make_new(type_in, MP_ARRAY_SIZE(args), 0, &args[0].u_obj); +} + +const mp_obj_namedtuple_type_t synthio_biquad_type_obj = { + .base = { + .base = { + .type = &mp_type_type + }, + .flags = MP_TYPE_FLAG_EXTENDED, + .name = MP_QSTR_Biquad, + .print = namedtuple_print, + .parent = &mp_type_tuple, + .make_new = synthio_biquad_make_new, + .attr = namedtuple_attr, + MP_TYPE_EXTENDED_FIELDS( + .unary_op = mp_obj_tuple_unary_op, + .binary_op = mp_obj_tuple_binary_op, + .subscr = mp_obj_tuple_subscr, + .getiter = mp_obj_tuple_getiter, + ), + }, + .n_fields = 5, + .fields = { + MP_QSTR_a1, + MP_QSTR_a2, + MP_QSTR_b0, + MP_QSTR_b1, + MP_QSTR_b2, + }, +}; diff --git a/shared-bindings/synthio/Biquad.h b/shared-bindings/synthio/Biquad.h new file mode 100644 index 0000000000..62b6c5843b --- /dev/null +++ b/shared-bindings/synthio/Biquad.h @@ -0,0 +1,9 @@ +#pragma once + +#include "py/obj.h" +#include "py/objnamedtuple.h" + +extern const mp_obj_namedtuple_type_t synthio_biquad_type_obj; +mp_obj_t common_hal_synthio_new_lpf(mp_float_t w0, mp_float_t Q); +mp_obj_t common_hal_synthio_new_hpf(mp_float_t w0, mp_float_t Q); +mp_obj_t common_hal_synthio_new_bpf(mp_float_t w0, mp_float_t Q); diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index 84882fa657..04bb672d99 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -32,6 +32,7 @@ #include "py/objproperty.h" #include "py/runtime.h" #include "shared-bindings/util.h" +#include "shared-bindings/synthio/Biquad.h" #include "shared-bindings/synthio/Synthesizer.h" #include "shared-bindings/synthio/LFO.h" #include "shared-bindings/synthio/__init__.h" @@ -292,6 +293,110 @@ MP_PROPERTY_GETTER(synthio_synthesizer_blocks_obj, //| """Maximum polyphony of the synthesizer (read-only class property)""" //| +//| def low_pass_filter(cls, cutoff_frequency, q_factor: float = 1 / math.sqrt(2)) -> Biquad: +//| """Construct a low-pass filter with the given parameters. +//| +//| `frequency`, called f0 in the cookbook, is the corner frequency in Hz +//| of the filter. +//| +//| `q_factor`, called `Q` in the cookbook. Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. +//| """ + +enum passfilter_arg_e { ARG_f0, ARG_Q }; + +// M_PI is not part of the math.h standard and may not be defined +// And by defining our own we can ensure it uses the correct const format. +#define MP_PI MICROPY_FLOAT_CONST(3.14159265358979323846) + +static const mp_arg_t passfilter_properties[] = { + { MP_QSTR_frequency, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = MP_ROM_NONE} }, + { MP_QSTR_Q, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL } }, +}; + +STATIC mp_obj_t synthio_synthesizer_lpf(size_t n_pos, const mp_obj_t *pos_args, mp_map_t *kw_args) { + mp_arg_val_t args[MP_ARRAY_SIZE(passfilter_properties)]; + + mp_obj_t self_in = pos_args[0]; + synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); + + mp_arg_parse_all(n_pos - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(passfilter_properties), passfilter_properties, args); + + mp_float_t f0 = mp_arg_validate_type_float(args[ARG_f0].u_obj, MP_QSTR_f0); + mp_float_t Q = + args[ARG_Q].u_obj == MP_OBJ_NULL ? MICROPY_FLOAT_CONST(0.7071067811865475) : + mp_arg_validate_type_float(args[ARG_Q].u_obj, MP_QSTR_Q); + + mp_float_t w0 = f0 / self->synth.sample_rate * 2 * MP_PI; + + return common_hal_synthio_new_lpf(w0, Q); + +} + +MP_DEFINE_CONST_FUN_OBJ_KW(synthio_synthesizer_lpf_fun_obj, 1, synthio_synthesizer_lpf); + +//| def high_pass_filter(cls, cutoff_frequency, q_factor: float = 1 / math.sqrt(2)) -> Biquad: +//| """Construct a high-pass filter with the given parameters. +//| +//| `frequency`, called f0 in the cookbook, is the corner frequency in Hz +//| of the filter. +//| +//| `q_factor`, called `Q` in the cookbook. Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. +//| """ + +STATIC mp_obj_t synthio_synthesizer_hpf(size_t n_pos, const mp_obj_t *pos_args, mp_map_t *kw_args) { + mp_arg_val_t args[MP_ARRAY_SIZE(passfilter_properties)]; + + mp_obj_t self_in = pos_args[0]; + synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); + + mp_arg_parse_all(n_pos - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(passfilter_properties), passfilter_properties, args); + + mp_float_t f0 = mp_arg_validate_type_float(args[ARG_f0].u_obj, MP_QSTR_f0); + mp_float_t Q = + args[ARG_Q].u_obj == MP_OBJ_NULL ? MICROPY_FLOAT_CONST(0.7071067811865475) : + mp_arg_validate_type_float(args[ARG_Q].u_obj, MP_QSTR_Q); + + mp_float_t w0 = f0 / self->synth.sample_rate * 2 * MP_PI; + + return common_hal_synthio_new_hpf(w0, Q); + +} + +//| def band_pass_filter(cls, frequency, q_factor: float = 1 / math.sqrt(2)) -> Biquad: +//| """Construct a band-pass filter with the given parameters. +//| +//| `frequency`, called f0 in the cookbook, is the center frequency in Hz +//| of the filter. +//| +//| `q_factor`, called `Q` in the cookbook. Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. +//| +//| The coefficients are scaled such that the filter has a 0dB peak gain. +//| """ +//| + +MP_DEFINE_CONST_FUN_OBJ_KW(synthio_synthesizer_hpf_fun_obj, 1, synthio_synthesizer_hpf); + +STATIC mp_obj_t synthio_synthesizer_bpf(size_t n_pos, const mp_obj_t *pos_args, mp_map_t *kw_args) { + mp_arg_val_t args[MP_ARRAY_SIZE(passfilter_properties)]; + + mp_obj_t self_in = pos_args[0]; + synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); + + mp_arg_parse_all(n_pos - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(passfilter_properties), passfilter_properties, args); + + mp_float_t f0 = mp_arg_validate_type_float(args[ARG_f0].u_obj, MP_QSTR_f0); + mp_float_t Q = + args[ARG_Q].u_obj == MP_OBJ_NULL ? MICROPY_FLOAT_CONST(0.7071067811865475) : + mp_arg_validate_type_float(args[ARG_Q].u_obj, MP_QSTR_Q); + + mp_float_t w0 = f0 / self->synth.sample_rate * 2 * MP_PI; + + return common_hal_synthio_new_bpf(w0, Q); + +} + +MP_DEFINE_CONST_FUN_OBJ_KW(synthio_synthesizer_bpf_fun_obj, 1, synthio_synthesizer_bpf); + STATIC const mp_rom_map_elem_t synthio_synthesizer_locals_dict_table[] = { // Methods { MP_ROM_QSTR(MP_QSTR_press), MP_ROM_PTR(&synthio_synthesizer_press_obj) }, @@ -304,6 +409,9 @@ STATIC const mp_rom_map_elem_t synthio_synthesizer_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&synthio_synthesizer___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR_low_pass_filter), MP_ROM_PTR(&synthio_synthesizer_lpf_fun_obj) }, + { MP_ROM_QSTR(MP_QSTR_high_pass_filter), MP_ROM_PTR(&synthio_synthesizer_hpf_fun_obj) }, + { MP_ROM_QSTR(MP_QSTR_band_pass_filter), MP_ROM_PTR(&synthio_synthesizer_bpf_fun_obj) }, // Properties { MP_ROM_QSTR(MP_QSTR_envelope), MP_ROM_PTR(&synthio_synthesizer_envelope_obj) }, { MP_ROM_QSTR(MP_QSTR_sample_rate), MP_ROM_PTR(&synthio_synthesizer_sample_rate_obj) }, diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index b6185051fc..b295430b09 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -36,6 +36,7 @@ #include "extmod/vfs_posix.h" #include "shared-bindings/synthio/__init__.h" +#include "shared-bindings/synthio/Biquad.h" #include "shared-bindings/synthio/LFO.h" #include "shared-bindings/synthio/Math.h" #include "shared-bindings/synthio/MidiTrack.h" @@ -310,6 +311,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR(synthio_lfo_tick_obj, 1, synthio_lfo_tick); STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_synthio) }, + { MP_ROM_QSTR(MP_QSTR_Biquad), MP_ROM_PTR(&synthio_biquad_type_obj) }, { MP_ROM_QSTR(MP_QSTR_Math), MP_ROM_PTR(&synthio_math_type) }, { MP_ROM_QSTR(MP_QSTR_MathOperation), MP_ROM_PTR(&synthio_math_operation_type) }, { MP_ROM_QSTR(MP_QSTR_MidiTrack), MP_ROM_PTR(&synthio_miditrack_type) }, diff --git a/shared-module/synthio/Biquad.c b/shared-module/synthio/Biquad.c new file mode 100644 index 0000000000..9457316b3a --- /dev/null +++ b/shared-module/synthio/Biquad.c @@ -0,0 +1,94 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "shared-bindings/synthio/Biquad.h" + +mp_obj_t common_hal_synthio_new_lpf(mp_float_t w0, mp_float_t Q) { + mp_float_t s = MICROPY_FLOAT_C_FUN(sin)(w0); + mp_float_t c = MICROPY_FLOAT_C_FUN(cos)(w0); + mp_float_t alpha = s / (2 * Q); + mp_float_t a0 = 1 + alpha; + mp_float_t a1 = -2 * c; + mp_float_t a2 = 1 - alpha; + mp_float_t b0 = (1 - c) / 2; + mp_float_t b1 = 1 - c; + mp_float_t b2 = (1 - c) / 2; + + mp_obj_t out_args[] = { + mp_obj_new_float(a1 / a0), + mp_obj_new_float(a2 / a0), + mp_obj_new_float(b0 / a0), + mp_obj_new_float(b1 / a0), + mp_obj_new_float(b2 / a0), + }; + + return namedtuple_make_new((const mp_obj_type_t *)&synthio_biquad_type_obj, MP_ARRAY_SIZE(out_args), 0, out_args); +} + +mp_obj_t common_hal_synthio_new_hpf(mp_float_t w0, mp_float_t Q) { + mp_float_t s = MICROPY_FLOAT_C_FUN(sin)(w0); + mp_float_t c = MICROPY_FLOAT_C_FUN(cos)(w0); + mp_float_t alpha = s / (2 * Q); + mp_float_t a0 = 1 + alpha; + mp_float_t a1 = -2 * c; + mp_float_t a2 = 1 - alpha; + mp_float_t b0 = (1 + c) / 2; + mp_float_t b1 = -(1 + c); + mp_float_t b2 = (1 + c) / 2; + + mp_obj_t out_args[] = { + mp_obj_new_float(a1 / a0), + mp_obj_new_float(a2 / a0), + mp_obj_new_float(b0 / a0), + mp_obj_new_float(b1 / a0), + mp_obj_new_float(b2 / a0), + }; + + return namedtuple_make_new((const mp_obj_type_t *)&synthio_biquad_type_obj, MP_ARRAY_SIZE(out_args), 0, out_args); +} + +mp_obj_t common_hal_synthio_new_bpf(mp_float_t w0, mp_float_t Q) { + mp_float_t s = MICROPY_FLOAT_C_FUN(sin)(w0); + mp_float_t c = MICROPY_FLOAT_C_FUN(cos)(w0); + mp_float_t alpha = s / (2 * Q); + mp_float_t a0 = 1 + alpha; + mp_float_t a1 = -2 * c; + mp_float_t a2 = 1 - alpha; + mp_float_t b0 = alpha; + mp_float_t b1 = 0; + mp_float_t b2 = -alpha; + + mp_obj_t out_args[] = { + mp_obj_new_float(a1 / a0), + mp_obj_new_float(a2 / a0), + mp_obj_new_float(b0 / a0), + mp_obj_new_float(b1 / a0), + mp_obj_new_float(b2 / a0), + }; + + return namedtuple_make_new((const mp_obj_type_t *)&synthio_biquad_type_obj, MP_ARRAY_SIZE(out_args), 0, out_args); +} diff --git a/tests/circuitpython/synthio_biquad.py b/tests/circuitpython/synthio_biquad.py new file mode 100644 index 0000000000..92b8e64a05 --- /dev/null +++ b/tests/circuitpython/synthio_biquad.py @@ -0,0 +1,12 @@ +from synthio import Synthesizer + +s = Synthesizer(sample_rate=48000) + + +def print_filter(x): + print(" ".join(f"{v:.4g}" for v in x)) + + +print_filter(s.low_pass_filter(330)) +print_filter(s.high_pass_filter(330)) +print_filter(s.band_pass_filter(330)) diff --git a/tests/circuitpython/synthio_biquad.py.exp b/tests/circuitpython/synthio_biquad.py.exp new file mode 100644 index 0000000000..2b9ca364c6 --- /dev/null +++ b/tests/circuitpython/synthio_biquad.py.exp @@ -0,0 +1,3 @@ +-1.939 0.9407 0.0004526 0.0009052 0.0004526 +-1.939 0.9407 0.9699 -1.94 0.9699 +-1.939 0.9407 0.02963 0 -0.02963 From 51027974e589207129041bed9424426555450c15 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 29 May 2023 10:53:48 -0500 Subject: [PATCH 1154/1712] synthio: apply biquad filters during synthesis --- shared-bindings/synthio/Note.c | 15 ++- shared-bindings/synthio/Note.h | 4 +- shared-module/synthio/Biquad.c | 45 ++++++++ shared-module/synthio/Biquad.h | 37 ++++++ shared-module/synthio/Note.c | 9 +- shared-module/synthio/Note.h | 5 +- shared-module/synthio/__init__.c | 65 ++++------- .../synthio/note/biquad.py | 63 +++++++++++ .../circuitpython-manual/synthio/note/fir.py | 53 --------- .../synthio/note/mkfilter.py | 105 ------------------ tests/circuitpython/synthesizer_note.py.exp | 6 +- 11 files changed, 188 insertions(+), 219 deletions(-) create mode 100644 shared-module/synthio/Biquad.h create mode 100644 tests/circuitpython-manual/synthio/note/biquad.py delete mode 100644 tests/circuitpython-manual/synthio/note/fir.py delete mode 100644 tests/circuitpython-manual/synthio/note/mkfilter.py diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index 651bf8f33a..4dcc66666c 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -41,7 +41,7 @@ static const mp_arg_t note_properties[] = { { MP_QSTR_bend, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(0) } }, { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, { MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, - { MP_QSTR_filter, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_INT(1) } }, + { MP_QSTR_filter, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, { MP_QSTR_ring_frequency, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(0) } }, { MP_QSTR_ring_bend, MP_ARG_OBJ, {.u_obj = MP_ROM_INT(0) } }, { MP_QSTR_ring_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_ROM_NONE } }, @@ -56,6 +56,7 @@ static const mp_arg_t note_properties[] = { //| envelope: Optional[Envelope] = None, //| amplitude: BlockInput = 0.0, //| bend: BlockInput = 0.0, +//| filter: Optional[Biquad] = None, //| ring_frequency: float = 0.0, //| ring_bend: float = 0.0, //| ring_waveform: Optional[ReadableBuffer] = 0.0, @@ -97,17 +98,21 @@ MP_PROPERTY_GETSET(synthio_note_frequency_obj, (mp_obj_t)&synthio_note_get_frequency_obj, (mp_obj_t)&synthio_note_set_frequency_obj); -//| filter: bool -//| """True if the note should be processed via the synthesizer's FIR filter.""" +//| filter: Optional[Biquad] +//| """If not None, the output of this Note is filtered according to the provided coefficients. +//| +//| Construct an appropriate filter by calling a filter-making method on the +//| `Synthesizer` object where you plan to play the note, as filter coefficients depend +//| on the sample rate""" STATIC mp_obj_t synthio_note_get_filter(mp_obj_t self_in) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - return mp_obj_new_bool(common_hal_synthio_note_get_filter(self)); + return common_hal_synthio_note_get_filter_obj(self); } MP_DEFINE_CONST_FUN_OBJ_1(synthio_note_get_filter_obj, synthio_note_get_filter); STATIC mp_obj_t synthio_note_set_filter(mp_obj_t self_in, mp_obj_t arg) { synthio_note_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_synthio_note_set_filter(self, mp_obj_is_true(arg)); + common_hal_synthio_note_set_filter(self, arg); return mp_const_none; } MP_DEFINE_CONST_FUN_OBJ_2(synthio_note_set_filter_obj, synthio_note_set_filter); diff --git a/shared-bindings/synthio/Note.h b/shared-bindings/synthio/Note.h index 271268dc33..263ca701e3 100644 --- a/shared-bindings/synthio/Note.h +++ b/shared-bindings/synthio/Note.h @@ -9,8 +9,8 @@ typedef enum synthio_bend_mode_e synthio_bend_mode_t; mp_float_t common_hal_synthio_note_get_frequency(synthio_note_obj_t *self); void common_hal_synthio_note_set_frequency(synthio_note_obj_t *self, mp_float_t value); -bool common_hal_synthio_note_get_filter(synthio_note_obj_t *self); -void common_hal_synthio_note_set_filter(synthio_note_obj_t *self, bool value); +mp_obj_t common_hal_synthio_note_get_filter_obj(synthio_note_obj_t *self); +void common_hal_synthio_note_set_filter(synthio_note_obj_t *self, mp_obj_t biquad); mp_obj_t common_hal_synthio_note_get_panning(synthio_note_obj_t *self); void common_hal_synthio_note_set_panning(synthio_note_obj_t *self, mp_obj_t value); diff --git a/shared-module/synthio/Biquad.c b/shared-module/synthio/Biquad.c index 9457316b3a..29e680fd7c 100644 --- a/shared-module/synthio/Biquad.c +++ b/shared-module/synthio/Biquad.c @@ -26,6 +26,7 @@ #include #include "shared-bindings/synthio/Biquad.h" +#include "shared-module/synthio/Biquad.h" mp_obj_t common_hal_synthio_new_lpf(mp_float_t w0, mp_float_t Q) { mp_float_t s = MICROPY_FLOAT_C_FUN(sin)(w0); @@ -92,3 +93,47 @@ mp_obj_t common_hal_synthio_new_bpf(mp_float_t w0, mp_float_t Q) { return namedtuple_make_new((const mp_obj_type_t *)&synthio_biquad_type_obj, MP_ARRAY_SIZE(out_args), 0, out_args); } + +#define BIQUAD_SHIFT (16) +STATIC int32_t biquad_scale_arg_obj(mp_obj_t arg) { + return (int32_t)MICROPY_FLOAT_C_FUN(round)(MICROPY_FLOAT_C_FUN(ldexp)(mp_obj_get_float(arg), BIQUAD_SHIFT)); +} +void synthio_biquad_filter_assign(biquad_filter_state *st, mp_obj_t biquad_obj) { + if (biquad_obj != mp_const_none) { + mp_arg_validate_type(biquad_obj, (const mp_obj_type_t *)&synthio_biquad_type_obj, MP_QSTR_filter); + mp_obj_tuple_t *biquad = (mp_obj_tuple_t *)MP_OBJ_TO_PTR(biquad_obj); + st->a1 = biquad_scale_arg_obj(biquad->items[0]); + st->a2 = biquad_scale_arg_obj(biquad->items[1]); + st->b0 = biquad_scale_arg_obj(biquad->items[2]); + st->b1 = biquad_scale_arg_obj(biquad->items[3]); + st->b2 = biquad_scale_arg_obj(biquad->items[4]); + } +} + +void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *out, const int32_t *in, size_t n, size_t stride) { + int32_t a1 = st->a1; + int32_t a2 = st->a2; + int32_t b0 = st->b0; + int32_t b1 = st->b1; + int32_t b2 = st->b2; + + int32_t x0 = st->x[0]; + int32_t x1 = st->x[1]; + int32_t y0 = st->y[0]; + int32_t y1 = st->y[1]; + + for (; n; --n, in += stride, out += stride) { + int16_t input = *in; + int32_t output = (b0 * input + b1 * x0 + b2 * x1 - a1 * y0 - a2 * y1) >> BIQUAD_SHIFT; + + x1 = x0; + x0 = input; + y1 = y0; + y0 = output; + *out = output; + } + st->x[0] = x0; + st->x[1] = x1; + st->y[0] = y0; + st->y[1] = y1; +} diff --git a/shared-module/synthio/Biquad.h b/shared-module/synthio/Biquad.h new file mode 100644 index 0000000000..047fd2b6c2 --- /dev/null +++ b/shared-module/synthio/Biquad.h @@ -0,0 +1,37 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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" + +typedef struct { + int32_t a1, a2, b0, b1, b2; + int32_t x[2], y[2]; +} biquad_filter_state; + +void synthio_biquad_filter_assign(biquad_filter_state *st, mp_obj_t biquad_obj); +void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *out, const int32_t *in, size_t n, size_t stride); diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index 6a8982f6b2..2cd391679d 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -40,12 +40,13 @@ void common_hal_synthio_note_set_frequency(synthio_note_obj_t *self, mp_float_t self->frequency_scaled = synthio_frequency_convert_float_to_scaled(val); } -bool common_hal_synthio_note_get_filter(synthio_note_obj_t *self) { - return self->filter; +mp_obj_t common_hal_synthio_note_get_filter_obj(synthio_note_obj_t *self) { + return self->filter_obj; } -void common_hal_synthio_note_set_filter(synthio_note_obj_t *self, bool value_in) { - self->filter = value_in; +void common_hal_synthio_note_set_filter(synthio_note_obj_t *self, mp_obj_t filter_in) { + synthio_biquad_filter_assign(&self->filter_state, filter_in); + self->filter_obj = filter_in; } mp_float_t common_hal_synthio_note_get_ring_frequency(synthio_note_obj_t *self) { diff --git a/shared-module/synthio/Note.h b/shared-module/synthio/Note.h index ba777c237c..8ae4fd910e 100644 --- a/shared-module/synthio/Note.h +++ b/shared-module/synthio/Note.h @@ -27,6 +27,7 @@ #pragma once #include "shared-module/synthio/__init__.h" +#include "shared-module/synthio/Biquad.h" #include "shared-module/synthio/LFO.h" #include "shared-bindings/synthio/__init__.h" @@ -37,12 +38,14 @@ typedef struct synthio_note_obj { mp_float_t frequency, ring_frequency; mp_obj_t waveform_obj, envelope_obj, ring_waveform_obj; + mp_obj_t filter_obj; + + biquad_filter_state filter_state; int32_t sample_rate; int32_t frequency_scaled; int32_t ring_frequency_scaled, ring_frequency_bent; - bool filter; mp_buffer_info_t waveform_buf; mp_buffer_info_t ring_waveform_buf; diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 7c8e627404..64af797e03 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -27,6 +27,7 @@ #include "shared-module/synthio/__init__.h" #include "shared-bindings/synthio/__init__.h" +#include "shared-module/synthio/Biquad.h" #include "shared-module/synthio/Note.h" #include "py/runtime.h" #include @@ -309,37 +310,15 @@ static void synth_note_into_buffer(synthio_synth_t *synth, int chan, int32_t *ou } } -STATIC void run_fir(synthio_synth_t *synth, int32_t *out_buffer32, uint16_t dur) { - int16_t *coeff = (int16_t *)synth->filter_bufinfo.buf; - size_t fir_len = synth->filter_bufinfo.len; - int32_t *in_buf = synth->filter_buffer; - - - int synth_chan = synth->channel_count; - // FIR and copy values to output buffer - for (int16_t i = 0; i < dur * synth_chan; i++) { - int32_t acc = 0; - for (size_t j = 0; j < fir_len; j++) { - // shift 5 here is good for up to 32 filtered voices, else might wrap - acc = acc + (in_buf[j * synth_chan] * (coeff[j] >> 5)); - } - *out_buffer32++ = acc >> 10; - in_buf++; - } - - // Move values down so that they get filtered next time - memmove(synth->filter_buffer, &synth->filter_buffer[dur * synth_chan], fir_len * sizeof(int32_t) * synth_chan); -} - -STATIC bool synthio_synth_get_note_filtered(mp_obj_t note_obj) { +STATIC mp_obj_t synthio_synth_get_note_filter(mp_obj_t note_obj) { if (note_obj == mp_const_none) { - return false; + return mp_const_none; } if (!mp_obj_is_small_int(note_obj)) { synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); - return note->filter; + return note->filter_obj; } - return true; + return mp_const_none; } void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t *buffer_length, uint8_t channel) { @@ -360,30 +339,24 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t synth->span.dur -= dur; int32_t out_buffer32[dur * synth->channel_count]; - - if (synth->filter_buffer) { - int32_t *filter_start = &synth->filter_buffer[synth->filter_bufinfo.len * synth->channel_count]; - memset(filter_start, 0, dur * synth->channel_count * sizeof(int32_t)); - - for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { - mp_obj_t note_obj = synth->span.note_obj[chan]; - if (!synthio_synth_get_note_filtered(note_obj)) { - continue; - } - synth_note_into_buffer(synth, chan, filter_start, dur); - } - - run_fir(synth, out_buffer32, dur); - } else { - memset(out_buffer32, 0, sizeof(out_buffer32)); - } + memset(out_buffer32, 0, sizeof(out_buffer32)); for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { mp_obj_t note_obj = synth->span.note_obj[chan]; - if (synth->filter_buffer && synthio_synth_get_note_filtered(note_obj)) { - continue; + mp_obj_t filter_obj = synthio_synth_get_note_filter(note_obj); + if (filter_obj == mp_const_none) { + synth_note_into_buffer(synth, chan, out_buffer32, dur); + } else { + synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); + int32_t filter_buffer32[dur * synth->channel_count]; + memset(filter_buffer32, 0, sizeof(filter_buffer32)); + + synth_note_into_buffer(synth, chan, filter_buffer32, dur); + int synth_chan = synth->channel_count; + for (int i = 0; i < synth_chan; i++) { + synthio_biquad_filter_samples(¬e->filter_state, &out_buffer32[i], &filter_buffer32[i], dur, i); + } } - synth_note_into_buffer(synth, chan, out_buffer32, dur); } int16_t *out_buffer16 = (int16_t *)(void *)synth->buffers[synth->buffer_index]; diff --git a/tests/circuitpython-manual/synthio/note/biquad.py b/tests/circuitpython-manual/synthio/note/biquad.py new file mode 100644 index 0000000000..59a3f74541 --- /dev/null +++ b/tests/circuitpython-manual/synthio/note/biquad.py @@ -0,0 +1,63 @@ +import sys + +sys.path.insert( + 0, f"{__file__.rpartition('/')[0] or '.'}/../../../../frozen/Adafruit_CircuitPython_Wave" +) + +import random +import audiocore +import synthio +from ulab import numpy as np +import adafruit_wave as wave + +random.seed(9) + +envelope = synthio.Envelope( + attack_time=0, decay_time=0, release_time=0, attack_level=0.8, sustain_level=1.0 +) + +SAMPLE_SIZE = 1024 +VOLUME = 14700 +sine = np.array( + np.sin(np.linspace(0, 2 * np.pi, SAMPLE_SIZE, endpoint=False)) * VOLUME, + dtype=np.int16, +) +noise = np.array([random.randint(-VOLUME, VOLUME) for i in range(SAMPLE_SIZE)], dtype=np.int16) +bend_out = np.linspace(0, 32767, num=SAMPLE_SIZE, endpoint=True, dtype=np.int16) + + +def synthesize(synth): + for waveform in (sine, None, noise): + for biquad in ( + None, + synth.low_pass_filter(330), + synth.low_pass_filter(660), + synth.high_pass_filter(330), + synth.high_pass_filter(660), + synth.band_pass_filter(330), + synth.band_pass_filter(660), + ): + n = synthio.Note( + frequency=80, + envelope=envelope, + filter=biquad, + waveform=waveform, + bend=synthio.LFO(bend_out, once=True, rate=1 / 2, scale=5), + ) + + synth.press(n) + print(synth, n) + yield 2 * 48000 // 256 + synth.release_all() + yield 36 + + +with wave.open("biquad.wav", "w") as f: + f.setnchannels(1) + f.setsampwidth(2) + f.setframerate(48000) + synth = synthio.Synthesizer(sample_rate=48000) + for n in synthesize(synth): + for i in range(n): + result, data = audiocore.get_buffer(synth) + f.writeframes(data) diff --git a/tests/circuitpython-manual/synthio/note/fir.py b/tests/circuitpython-manual/synthio/note/fir.py deleted file mode 100644 index 4593dcb376..0000000000 --- a/tests/circuitpython-manual/synthio/note/fir.py +++ /dev/null @@ -1,53 +0,0 @@ -import sys - -sys.path.insert( - 0, f"{__file__.rpartition('/')[0] or '.'}/../../../../frozen/Adafruit_CircuitPython_Wave" -) - -import random -import audiocore -import synthio -from ulab import numpy as np -import adafruit_wave as wave -import mkfilter - -random.seed(9) - -envelope = synthio.Envelope( - attack_time=0.1, decay_time=0.05, release_time=0.2, attack_level=0.8, sustain_level=0.8 -) - -SAMPLE_SIZE = 1024 -bend_out = np.linspace(0, 32767, num=SAMPLE_SIZE, endpoint=True, dtype=np.int16) - -filter_rectangular = mkfilter.LPF(48000, 800, 13) -filter_rectangular_big = mkfilter.LPF(48000, 800, 59) -filter_blackman = mkfilter.LPF(48000, 800, 59, win=mkfilter.blackman) -print(filter_blackman) - - -def synthesize(synth): - n = synthio.Note( - frequency=120, - envelope=envelope, - filter=True, - bend=synthio.LFO(bend_out, once=True, rate=1 / 2, scale=5), - ) - - synth.press(n) - print(synth, n) - yield 2 * 48000 // 256 - synth.release_all() - yield 36 - - -with wave.open("fir.wav", "w") as f: - f.setnchannels(1) - f.setsampwidth(2) - f.setframerate(48000) - for filter_coeffs in [None, filter_rectangular, filter_rectangular_big, filter_blackman]: - synth = synthio.Synthesizer(sample_rate=48000, filter=filter_coeffs) - for n in synthesize(synth): - for i in range(n): - result, data = audiocore.get_buffer(synth) - f.writeframes(data) diff --git a/tests/circuitpython-manual/synthio/note/mkfilter.py b/tests/circuitpython-manual/synthio/note/mkfilter.py deleted file mode 100644 index 20a4203af2..0000000000 --- a/tests/circuitpython-manual/synthio/note/mkfilter.py +++ /dev/null @@ -1,105 +0,0 @@ -try: - from ulab import numpy as np -except ImportError: - import numpy as np - - -def lpf(fS, f, N, win=lambda N: 1): - if not (N & 1): - raise ValueError("filter length must be odd") - h = np.sinc(2 * f / fS * (np.arange(N) - (N - 1) / 2)) - h = h * win(N) - return h * (1 / np.sum(h)) - - -def hpf(fS, f, N, win=lambda N: 1): - if not (N & 1): - raise ValueError("filter length must be odd") - h = -lpf(fS, f, N) - h = h * win(N) - h[(N - 1) // 2] += 1 - return h - - -def brf(fS, fL, NL, fH, NH, win=lambda N: 1): - hlpf = lpf(fS, fL, NL, win) - hhpf = hpf(fS, fH, NH, win) - - if NH > NL: - h = hhpf - h[(NH - NL) // 2 : (NH - NL) // 2 + NL] += hlpf - else: - h = hlpf - h[(NL - NH) // 2 : (NL - NH) // 2 + NH] += hhpf - - return h - - -def bpf(fS, fL, NL, fH, NH, win=lambda N: 1): - hlpf = lpf(fS, fL, NL, win) - hhpf = hpf(fS, fH, NH, win) - return np.convolve(hlpf, hhpf) - - -def blackman(M): - n = np.arange(1 - M, M, 2) - return 0.42 + 0.5 * np.cos(np.pi * n / (M - 1)) + 0.08 * np.cos(2.0 * np.pi * n / (M - 1)) - - -def tosynthio(coeffs): - result = np.array(coeffs * 32767, dtype=np.int16) - return trim_zeros(result) - - -def trim_zeros(arr): - i = 0 - j = len(arr) - 1 - while i < len(arr) and arr[i] == 0: - i += 1 - while j > i and arr[j] == 0: - j -= 1 - return arr[i : j + 1] - - -# fiiir.com uses factor 4.6 for blackman window, 0.91 for rectangular -def ntaps(fS, fB, factor=4.6): - b = fB / fS - return round(factor / b) | 1 - - -def LPF(*args, **kw): - return tosynthio(lpf(*args, **kw)) - - -def HPF(*args, **kw): - return tosynthio(hpf(*args, **kw)) - - -def BRF(*args, **kw): - return tosynthio(brf(*args, **kw)) - - -def BPF(*args, **kw): - return tosynthio(bpf(*args, **kw)) - - -if __name__ == "__main__": - print("lpf(24000, 2040, 13) # 1920Hz transition window") - print(list(lpf(24000, 2040, 13))) - - print("hpf(24000, 9600, 13) # 960Hz transition window") - print(list(hpf(24000, 9600, 23))) - - print("bpf(24000, 1200, 11, 3960, 15) # 2400Hz, 1600Hz transition windows") - print(list(bpf(24000, 1200, 11, 3960, 15))) - - print("brf(24000, 960, 19, 2400, 13) # 1200, 1800Hz transition windows") - brf_tst = brf(24000, 960, 19, 2400, 13) - print(brf_tst) - - print("brf(24000, 960, 13, 2400, 19) # 1200, 1800Hz transition windows") - brf_tst = brf(24000, 960, 13, 2400, 19) - print(brf_tst) - - print("lpf(1, 0.1, 59, blackman) # 1920Hz transition window, blackman") - print(lpf(1, 0.1, 59, blackman)) diff --git a/tests/circuitpython/synthesizer_note.py.exp b/tests/circuitpython/synthesizer_note.py.exp index f9173c6470..0c2af86681 100644 --- a/tests/circuitpython/synthesizer_note.py.exp +++ b/tests/circuitpython/synthesizer_note.py.exp @@ -1,10 +1,10 @@ () [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -(Note(frequency=830.6076004423605, panning=0.0, amplitude=1.0, bend=0.0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0.0, ring_waveform=None),) +(Note(frequency=830.6076004423605, panning=0.0, amplitude=1.0, bend=0.0, waveform=None, envelope=None, filter=None, ring_frequency=0.0, ring_bend=0.0, ring_waveform=None),) [-16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383, 16382, 16382, 16382, 16382, 16382, -16383, -16383, -16383, -16383, -16383] -(Note(frequency=830.6076004423605, panning=0.0, amplitude=1.0, bend=0.0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0.0, ring_waveform=None), Note(frequency=830.6076004423605, panning=0.0, amplitude=1.0, bend=0.0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0.0, ring_waveform=None)) +(Note(frequency=830.6076004423605, panning=0.0, amplitude=1.0, bend=0.0, waveform=None, envelope=None, filter=None, ring_frequency=0.0, ring_bend=0.0, ring_waveform=None), Note(frequency=830.6076004423605, panning=0.0, amplitude=1.0, bend=0.0, waveform=None, envelope=None, filter=None, ring_frequency=0.0, ring_bend=0.0, ring_waveform=None)) [-1, -1, -1, -1, -1, -1, -1, -1, 28045, -1, -1, -1, -1, -28046, -1, -1, -1, -1, 28045, -1, -1, -1, -1, -28046] -(Note(frequency=830.6076004423605, panning=0.0, amplitude=1.0, bend=0.0, waveform=None, envelope=None, filter=True, ring_frequency=0.0, ring_bend=0.0, ring_waveform=None),) +(Note(frequency=830.6076004423605, panning=0.0, amplitude=1.0, bend=0.0, waveform=None, envelope=None, filter=None, ring_frequency=0.0, ring_bend=0.0, ring_waveform=None),) [-1, -1, -1, 28045, -1, -1, -1, -1, -1, -1, -1, -1, 28045, -1, -1, -1, -1, -28046, -1, -1, -1, -1, 28045, -1] (-5242, 5241) (-10484, 10484) From a891e149a6626d1187153ca19bc4e13811730397 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 29 May 2023 11:23:07 -0500 Subject: [PATCH 1155/1712] synthio: Fix multichannel biquad filtering --- shared-module/synthio/Biquad.c | 39 ++++++++++++++++++-------------- shared-module/synthio/Biquad.h | 4 ++-- shared-module/synthio/__init__.c | 5 +--- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/shared-module/synthio/Biquad.c b/shared-module/synthio/Biquad.c index 29e680fd7c..fb7f3a720c 100644 --- a/shared-module/synthio/Biquad.c +++ b/shared-module/synthio/Biquad.c @@ -110,30 +110,35 @@ void synthio_biquad_filter_assign(biquad_filter_state *st, mp_obj_t biquad_obj) } } -void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *out, const int32_t *in, size_t n, size_t stride) { +void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *out0, const int32_t *in0, size_t n0, size_t n_channels) { int32_t a1 = st->a1; int32_t a2 = st->a2; int32_t b0 = st->b0; int32_t b1 = st->b1; int32_t b2 = st->b2; - int32_t x0 = st->x[0]; - int32_t x1 = st->x[1]; - int32_t y0 = st->y[0]; - int32_t y1 = st->y[1]; + for (size_t i = 0; i < n_channels; i++) { + const int32_t *in = in0 + i; + int32_t *out = out0 + i; - for (; n; --n, in += stride, out += stride) { - int16_t input = *in; - int32_t output = (b0 * input + b1 * x0 + b2 * x1 - a1 * y0 - a2 * y1) >> BIQUAD_SHIFT; + int32_t x0 = st->x[i][0]; + int32_t x1 = st->x[i][1]; + int32_t y0 = st->y[i][0]; + int32_t y1 = st->y[i][1]; - x1 = x0; - x0 = input; - y1 = y0; - y0 = output; - *out = output; + for (size_t n = n0; n; --n, in += n_channels, out += n_channels) { + int32_t input = *in; + int32_t output = (b0 * input + b1 * x0 + b2 * x1 - a1 * y0 - a2 * y1) >> BIQUAD_SHIFT; + + x1 = x0; + x0 = input; + y1 = y0; + y0 = output; + *out = output; + } + st->x[i][0] = x0; + st->x[i][1] = x1; + st->y[i][0] = y0; + st->y[i][1] = y1; } - st->x[0] = x0; - st->x[1] = x1; - st->y[0] = y0; - st->y[1] = y1; } diff --git a/shared-module/synthio/Biquad.h b/shared-module/synthio/Biquad.h index 047fd2b6c2..64f6a529d3 100644 --- a/shared-module/synthio/Biquad.h +++ b/shared-module/synthio/Biquad.h @@ -30,8 +30,8 @@ typedef struct { int32_t a1, a2, b0, b1, b2; - int32_t x[2], y[2]; + int32_t x[2][2], y[2][2]; } biquad_filter_state; void synthio_biquad_filter_assign(biquad_filter_state *st, mp_obj_t biquad_obj); -void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *out, const int32_t *in, size_t n, size_t stride); +void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *out, const int32_t *in, size_t n_samples, size_t n_channels); diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 64af797e03..7783ebb113 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -352,10 +352,7 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t memset(filter_buffer32, 0, sizeof(filter_buffer32)); synth_note_into_buffer(synth, chan, filter_buffer32, dur); - int synth_chan = synth->channel_count; - for (int i = 0; i < synth_chan; i++) { - synthio_biquad_filter_samples(¬e->filter_state, &out_buffer32[i], &filter_buffer32[i], dur, i); - } + synthio_biquad_filter_samples(¬e->filter_state, out_buffer32, filter_buffer32, dur, synth->channel_count); } } From f5388e12af43039c0a5fd2e58ee011b9f6bc0be8 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 29 May 2023 11:23:45 -0500 Subject: [PATCH 1156/1712] synthio: add manual filter frequency sweeping to standalone test .. by assigning a new band pass filter to the note every 2 frames --- tests/circuitpython-manual/synthio/note/biquad.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/circuitpython-manual/synthio/note/biquad.py b/tests/circuitpython-manual/synthio/note/biquad.py index 59a3f74541..58dccc2aed 100644 --- a/tests/circuitpython-manual/synthio/note/biquad.py +++ b/tests/circuitpython-manual/synthio/note/biquad.py @@ -51,6 +51,21 @@ def synthesize(synth): synth.release_all() yield 36 + for waveform in (sine, None, noise): + n = synthio.Note( + frequency=555, + envelope=envelope, + waveform=waveform, + ) + synth.press(n) + i = 220 + while i < 1760: + n.filter = synth.band_pass_filter(i) + i *= 1.00579 + yield 1 + synth.release_all() + yield 6 + with wave.open("biquad.wav", "w") as f: f.setnchannels(1) From 1d58b550b55a5f5cb7a189652522991b433d80a2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 29 May 2023 13:07:15 -0500 Subject: [PATCH 1157/1712] synthio: fix doc build --- shared-bindings/synthio/Synthesizer.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index 04bb672d99..afc0cdd47f 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -293,13 +293,13 @@ MP_PROPERTY_GETTER(synthio_synthesizer_blocks_obj, //| """Maximum polyphony of the synthesizer (read-only class property)""" //| -//| def low_pass_filter(cls, cutoff_frequency, q_factor: float = 1 / math.sqrt(2)) -> Biquad: +//| def low_pass_filter(cls, frequency: float, q_factor: float = 0.7071067811865475) -> Biquad: //| """Construct a low-pass filter with the given parameters. //| -//| `frequency`, called f0 in the cookbook, is the corner frequency in Hz +//| ``frequency``, called f0 in the cookbook, is the corner frequency in Hz //| of the filter. //| -//| `q_factor`, called `Q` in the cookbook. Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. +//| ``q_factor``, called ``Q`` in the cookbook. Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. //| """ enum passfilter_arg_e { ARG_f0, ARG_Q }; @@ -334,13 +334,15 @@ STATIC mp_obj_t synthio_synthesizer_lpf(size_t n_pos, const mp_obj_t *pos_args, MP_DEFINE_CONST_FUN_OBJ_KW(synthio_synthesizer_lpf_fun_obj, 1, synthio_synthesizer_lpf); -//| def high_pass_filter(cls, cutoff_frequency, q_factor: float = 1 / math.sqrt(2)) -> Biquad: +//| def high_pass_filter( +//| cls, frequency: float, q_factor: float = 0.7071067811865475 +//| ) -> Biquad: //| """Construct a high-pass filter with the given parameters. //| -//| `frequency`, called f0 in the cookbook, is the corner frequency in Hz +//| ``frequency``, called f0 in the cookbook, is the corner frequency in Hz //| of the filter. //| -//| `q_factor`, called `Q` in the cookbook. Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. +//| ``q_factor``, called ``Q`` in the cookbook. Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. //| """ STATIC mp_obj_t synthio_synthesizer_hpf(size_t n_pos, const mp_obj_t *pos_args, mp_map_t *kw_args) { @@ -362,13 +364,15 @@ STATIC mp_obj_t synthio_synthesizer_hpf(size_t n_pos, const mp_obj_t *pos_args, } -//| def band_pass_filter(cls, frequency, q_factor: float = 1 / math.sqrt(2)) -> Biquad: +//| def band_pass_filter( +//| cls, frequency: float, q_factor: float = 0.7071067811865475 +//| ) -> Biquad: //| """Construct a band-pass filter with the given parameters. //| -//| `frequency`, called f0 in the cookbook, is the center frequency in Hz +//| ``frequency``, called f0 in the cookbook, is the center frequency in Hz //| of the filter. //| -//| `q_factor`, called `Q` in the cookbook. Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. +//| ``q_factor``, called ``Q`` in the cookbook. Controls how peaked the response will be at the cutoff frequency. A large value makes the response more peaked. //| //| The coefficients are scaled such that the filter has a 0dB peak gain. //| """ From 3151656f4bf90d05296eedbd9b05ed075e03e0d6 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 30 May 2023 09:24:06 -0500 Subject: [PATCH 1158/1712] synthio: more fir-filter removal; fix biquad logic errors --- shared-bindings/synthio/Synthesizer.c | 6 +----- shared-bindings/synthio/Synthesizer.h | 2 +- shared-module/synthio/Biquad.c | 8 ++++++-- shared-module/synthio/Biquad.h | 1 + shared-module/synthio/MidiTrack.c | 2 +- shared-module/synthio/Note.c | 1 + shared-module/synthio/Synthesizer.c | 4 ++-- shared-module/synthio/__init__.c | 13 +------------ shared-module/synthio/__init__.h | 7 +++---- 9 files changed, 17 insertions(+), 27 deletions(-) diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index afc0cdd47f..8e186573cd 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -53,7 +53,6 @@ //| channel_count: int = 1, //| waveform: Optional[ReadableBuffer] = None, //| envelope: Optional[Envelope] = None, -//| filter: Optional[ReadableBuffer] = None, //| ) -> None: //| """Create a synthesizer object. //| @@ -66,17 +65,15 @@ //| :param int sample_rate: The desired playback sample rate; higher sample rate requires more memory //| :param int channel_count: The number of output channels (1=mono, 2=stereo) //| :param ReadableBuffer waveform: A single-cycle waveform. Default is a 50% duty cycle square wave. If specified, must be a ReadableBuffer of type 'h' (signed 16 bit) -//| :param ReadableBuffer filter: Coefficients of an FIR filter to apply to notes with ``filter=True``. If specified, must be a ReadableBuffer of type 'h' (signed 16 bit) //| :param Optional[Envelope] envelope: An object that defines the loudness of a note over time. The default envelope, `None` provides no ramping, voices turn instantly on and off. //| """ STATIC mp_obj_t synthio_synthesizer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - enum { ARG_sample_rate, ARG_channel_count, ARG_waveform, ARG_envelope, ARG_filter }; + enum { ARG_sample_rate, ARG_channel_count, ARG_waveform, ARG_envelope }; static const mp_arg_t allowed_args[] = { { MP_QSTR_sample_rate, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 11025} }, { MP_QSTR_channel_count, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 1} }, { MP_QSTR_waveform, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, { MP_QSTR_envelope, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, - { MP_QSTR_filter, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none } }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -88,7 +85,6 @@ STATIC mp_obj_t synthio_synthesizer_make_new(const mp_obj_type_t *type, size_t n args[ARG_sample_rate].u_int, args[ARG_channel_count].u_int, args[ARG_waveform].u_obj, - args[ARG_filter].u_obj, args[ARG_envelope].u_obj); return MP_OBJ_FROM_PTR(self); diff --git a/shared-bindings/synthio/Synthesizer.h b/shared-bindings/synthio/Synthesizer.h index 9c7ba68588..16543ce2c3 100644 --- a/shared-bindings/synthio/Synthesizer.h +++ b/shared-bindings/synthio/Synthesizer.h @@ -32,7 +32,7 @@ extern const mp_obj_type_t synthio_synthesizer_type; void common_hal_synthio_synthesizer_construct(synthio_synthesizer_obj_t *self, - uint32_t sample_rate, int channel_count, mp_obj_t waveform_obj, mp_obj_t filter_obj, + uint32_t sample_rate, int channel_count, mp_obj_t waveform_obj, mp_obj_t envelope_obj); void common_hal_synthio_synthesizer_deinit(synthio_synthesizer_obj_t *self); bool common_hal_synthio_synthesizer_deinited(synthio_synthesizer_obj_t *self); diff --git a/shared-module/synthio/Biquad.c b/shared-module/synthio/Biquad.c index fb7f3a720c..99d95959e0 100644 --- a/shared-module/synthio/Biquad.c +++ b/shared-module/synthio/Biquad.c @@ -94,7 +94,7 @@ mp_obj_t common_hal_synthio_new_bpf(mp_float_t w0, mp_float_t Q) { return namedtuple_make_new((const mp_obj_type_t *)&synthio_biquad_type_obj, MP_ARRAY_SIZE(out_args), 0, out_args); } -#define BIQUAD_SHIFT (16) +#define BIQUAD_SHIFT (19) STATIC int32_t biquad_scale_arg_obj(mp_obj_t arg) { return (int32_t)MICROPY_FLOAT_C_FUN(round)(MICROPY_FLOAT_C_FUN(ldexp)(mp_obj_get_float(arg), BIQUAD_SHIFT)); } @@ -110,6 +110,10 @@ void synthio_biquad_filter_assign(biquad_filter_state *st, mp_obj_t biquad_obj) } } +void synthio_biquad_filter_reset(biquad_filter_state *st) { + memset(&st->x, 0, 8 * sizeof(int16_t)); +} + void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *out0, const int32_t *in0, size_t n0, size_t n_channels) { int32_t a1 = st->a1; int32_t a2 = st->a2; @@ -134,7 +138,7 @@ void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *out0, const x0 = input; y1 = y0; y0 = output; - *out = output; + *out += output; } st->x[i][0] = x0; st->x[i][1] = x1; diff --git a/shared-module/synthio/Biquad.h b/shared-module/synthio/Biquad.h index 64f6a529d3..1c0005ab47 100644 --- a/shared-module/synthio/Biquad.h +++ b/shared-module/synthio/Biquad.h @@ -34,4 +34,5 @@ typedef struct { } biquad_filter_state; void synthio_biquad_filter_assign(biquad_filter_state *st, mp_obj_t biquad_obj); +void synthio_biquad_filter_reset(biquad_filter_state *st); void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *out, const int32_t *in, size_t n_samples, size_t n_channels); diff --git a/shared-module/synthio/MidiTrack.c b/shared-module/synthio/MidiTrack.c index 50c7151811..41f9676b72 100644 --- a/shared-module/synthio/MidiTrack.c +++ b/shared-module/synthio/MidiTrack.c @@ -122,7 +122,7 @@ void common_hal_synthio_miditrack_construct(synthio_miditrack_obj_t *self, self->track.buf = (void *)buffer; self->track.len = len; - synthio_synth_init(&self->synth, sample_rate, 1, waveform_obj, mp_const_none, envelope_obj); + synthio_synth_init(&self->synth, sample_rate, 1, waveform_obj, envelope_obj); start_parse(self); } diff --git a/shared-module/synthio/Note.c b/shared-module/synthio/Note.c index 2cd391679d..f384269214 100644 --- a/shared-module/synthio/Note.c +++ b/shared-module/synthio/Note.c @@ -148,6 +148,7 @@ void synthio_note_recalculate(synthio_note_obj_t *self, int32_t sample_rate) { void synthio_note_start(synthio_note_obj_t *self, int32_t sample_rate) { synthio_note_recalculate(self, sample_rate); + synthio_biquad_filter_reset(&self->filter_state); } // Perform a pitch bend operation diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index dd2f977bd7..7dc888dfd0 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -33,10 +33,10 @@ void common_hal_synthio_synthesizer_construct(synthio_synthesizer_obj_t *self, - uint32_t sample_rate, int channel_count, mp_obj_t waveform_obj, mp_obj_t filter_obj, + uint32_t sample_rate, int channel_count, mp_obj_t waveform_obj, mp_obj_t envelope_obj) { - synthio_synth_init(&self->synth, sample_rate, channel_count, waveform_obj, filter_obj, envelope_obj); + synthio_synth_init(&self->synth, sample_rate, channel_count, waveform_obj, envelope_obj); self->blocks = mp_obj_new_list(0, NULL); } diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 7783ebb113..90540162b6 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -389,7 +389,6 @@ bool synthio_synth_deinited(synthio_synth_t *synth) { } void synthio_synth_deinit(synthio_synth_t *synth) { - synth->filter_buffer = NULL; synth->buffers[0] = NULL; synth->buffers[1] = NULL; } @@ -403,17 +402,12 @@ mp_obj_t synthio_synth_envelope_get(synthio_synth_t *synth) { return synth->envelope_obj; } -void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channel_count, mp_obj_t waveform_obj, mp_obj_t filter_obj, mp_obj_t envelope_obj) { +void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channel_count, mp_obj_t waveform_obj, mp_obj_t envelope_obj) { synthio_synth_parse_waveform(&synth->waveform_bufinfo, waveform_obj); - synthio_synth_parse_filter(&synth->filter_bufinfo, filter_obj); mp_arg_validate_int_range(channel_count, 1, 2, MP_QSTR_channel_count); synth->buffer_length = SYNTHIO_MAX_DUR * SYNTHIO_BYTES_PER_SAMPLE * channel_count; synth->buffers[0] = m_malloc(synth->buffer_length, false); synth->buffers[1] = m_malloc(synth->buffer_length, false); - if (synth->filter_bufinfo.len) { - synth->filter_buffer_length = (synth->filter_bufinfo.len + SYNTHIO_MAX_DUR) * channel_count * sizeof(int32_t); - synth->filter_buffer = m_malloc(synth->filter_buffer_length, false); - } synth->channel_count = channel_count; synth->other_channel = -1; synth->waveform_obj = waveform_obj; @@ -453,11 +447,6 @@ void synthio_synth_parse_waveform(mp_buffer_info_t *bufinfo_waveform, mp_obj_t w parse_common(bufinfo_waveform, waveform_obj, MP_QSTR_waveform, 16384); } -void synthio_synth_parse_filter(mp_buffer_info_t *bufinfo_filter, mp_obj_t filter_obj) { - *bufinfo_filter = ((mp_buffer_info_t) { .buf = NULL, .len = 0 }); - parse_common(bufinfo_filter, filter_obj, MP_QSTR_filter, 128); -} - STATIC int find_channel_with_note(synthio_synth_t *synth, mp_obj_t note) { for (int i = 0; i < CIRCUITPY_SYNTHIO_MAX_CHANNELS; i++) { if (synth->span.note_obj[i] == note) { diff --git a/shared-module/synthio/__init__.h b/shared-module/synthio/__init__.h index 5586ce87f9..9e4db96d50 100644 --- a/shared-module/synthio/__init__.h +++ b/shared-module/synthio/__init__.h @@ -64,12 +64,11 @@ typedef struct synthio_synth { uint32_t sample_rate; uint32_t total_envelope; int16_t *buffers[2]; - int32_t *filter_buffer; uint8_t channel_count; - uint16_t buffer_length, filter_buffer_length; + uint16_t buffer_length; uint16_t last_buffer_length; uint8_t other_channel, buffer_index, other_buffer_index; - mp_buffer_info_t waveform_bufinfo, filter_bufinfo; + mp_buffer_info_t waveform_bufinfo; synthio_envelope_definition_t global_envelope_definition; mp_obj_t waveform_obj, filter_obj, envelope_obj; synthio_midi_span_t span; @@ -91,7 +90,7 @@ typedef struct { void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **buffer, uint32_t *buffer_length, uint8_t channel); void synthio_synth_deinit(synthio_synth_t *synth); bool synthio_synth_deinited(synthio_synth_t *synth); -void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channel_count, mp_obj_t waveform_obj, mp_obj_t filter_obj, mp_obj_t envelope); +void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channel_count, mp_obj_t waveform_obj, mp_obj_t envelope); void synthio_synth_get_buffer_structure(synthio_synth_t *synth, bool single_channel_output, bool *single_buffer, bool *samples_signed, uint32_t *max_buffer_length, uint8_t *spacing); void synthio_synth_reset_buffer(synthio_synth_t *synth, bool single_channel_output, uint8_t channel); From 8a85deb1e2d71e5395bbb9b84ef8593c4159da4e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 30 May 2023 09:26:14 -0500 Subject: [PATCH 1159/1712] synthio: shift 19 was too much for a note with amplitude 1 --- shared-module/synthio/Biquad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-module/synthio/Biquad.c b/shared-module/synthio/Biquad.c index 99d95959e0..d8cf0d7889 100644 --- a/shared-module/synthio/Biquad.c +++ b/shared-module/synthio/Biquad.c @@ -94,7 +94,7 @@ mp_obj_t common_hal_synthio_new_bpf(mp_float_t w0, mp_float_t Q) { return namedtuple_make_new((const mp_obj_type_t *)&synthio_biquad_type_obj, MP_ARRAY_SIZE(out_args), 0, out_args); } -#define BIQUAD_SHIFT (19) +#define BIQUAD_SHIFT (15) STATIC int32_t biquad_scale_arg_obj(mp_obj_t arg) { return (int32_t)MICROPY_FLOAT_C_FUN(round)(MICROPY_FLOAT_C_FUN(ldexp)(mp_obj_get_float(arg), BIQUAD_SHIFT)); } From 5f7998e6f2c458e25298f6d26a883d5d31fa718f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 30 May 2023 13:43:06 -0500 Subject: [PATCH 1160/1712] synthio: improve rounding in biquad this removes a marked DC offset and may cure the 'pops' problem. --- shared-module/synthio/Biquad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-module/synthio/Biquad.c b/shared-module/synthio/Biquad.c index d8cf0d7889..d6cdb3168f 100644 --- a/shared-module/synthio/Biquad.c +++ b/shared-module/synthio/Biquad.c @@ -132,7 +132,7 @@ void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *out0, const for (size_t n = n0; n; --n, in += n_channels, out += n_channels) { int32_t input = *in; - int32_t output = (b0 * input + b1 * x0 + b2 * x1 - a1 * y0 - a2 * y1) >> BIQUAD_SHIFT; + int32_t output = (b0 * input + b1 * x0 + b2 * x1 - a1 * y0 - a2 * y1 + (1 << (BIQUAD_SHIFT - 1))) >> BIQUAD_SHIFT; x1 = x0; x0 = input; From 8a564602a120ea968d266a6a345925e7bf20ed2f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 30 May 2023 19:21:13 -0500 Subject: [PATCH 1161/1712] synthio: this modified biquad test lets me hear what I'm hunting --- .../synthio/note/biquad.py | 51 +++++++------------ 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/tests/circuitpython-manual/synthio/note/biquad.py b/tests/circuitpython-manual/synthio/note/biquad.py index 58dccc2aed..b4136a957f 100644 --- a/tests/circuitpython-manual/synthio/note/biquad.py +++ b/tests/circuitpython-manual/synthio/note/biquad.py @@ -13,7 +13,7 @@ import adafruit_wave as wave random.seed(9) envelope = synthio.Envelope( - attack_time=0, decay_time=0, release_time=0, attack_level=0.8, sustain_level=1.0 + attack_time=0.15, decay_time=0, release_time=0.08, attack_level=1.0, sustain_level=1.0 ) SAMPLE_SIZE = 1024 @@ -30,41 +30,24 @@ def synthesize(synth): for waveform in (sine, None, noise): for biquad in ( None, - synth.low_pass_filter(330), - synth.low_pass_filter(660), - synth.high_pass_filter(330), - synth.high_pass_filter(660), - synth.band_pass_filter(330), - synth.band_pass_filter(660), + synth.low_pass_filter(120), ): - n = synthio.Note( - frequency=80, - envelope=envelope, - filter=biquad, - waveform=waveform, - bend=synthio.LFO(bend_out, once=True, rate=1 / 2, scale=5), - ) + for midi_note in range(24, 90, 3): + n = synthio.Note( + frequency=synthio.midi_to_hz(midi_note), + envelope=envelope, + filter=biquad, + waveform=waveform, + bend=synthio.LFO(bend_out, once=True, rate=1 / 2, scale=5), + ) - synth.press(n) - print(synth, n) - yield 2 * 48000 // 256 - synth.release_all() - yield 36 - - for waveform in (sine, None, noise): - n = synthio.Note( - frequency=555, - envelope=envelope, - waveform=waveform, - ) - synth.press(n) - i = 220 - while i < 1760: - n.filter = synth.band_pass_filter(i) - i *= 1.00579 - yield 1 - synth.release_all() - yield 6 + synth.press(n) + print(n.frequency) + yield 24 + synth.release_all() + yield 16 + yield 24 + yield 48 with wave.open("biquad.wav", "w") as f: From 06057a63e6546b23d3356d1a8b7fc539ee570bf2 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Tue, 30 May 2023 19:25:08 -0500 Subject: [PATCH 1162/1712] don't consider refresh areas for hidden groups or tilegrids --- shared-module/displayio/Group.c | 54 ++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index 7eec72404f..bd62280c96 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -438,32 +438,36 @@ void displayio_group_finish_refresh(displayio_group_t *self) { } displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, displayio_area_t *tail) { - if (self->item_removed) { - self->dirty_area.next = tail; - tail = &self->dirty_area; - } + if (! self->hidden){ + if (self->item_removed) { + self->dirty_area.next = tail; + tail = &self->dirty_area; + } - for (int32_t i = self->members->len - 1; i >= 0; i--) { - mp_obj_t layer; - #if CIRCUITPY_VECTORIO - const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[i]); - if (draw_protocol != NULL) { - layer = draw_protocol->draw_get_protocol_self(self->members->items[i]); - tail = draw_protocol->draw_protocol_impl->draw_get_refresh_areas(layer, tail); - continue; - } - #endif - layer = mp_obj_cast_to_native_base( - self->members->items[i], &displayio_tilegrid_type); - if (layer != MP_OBJ_NULL) { - tail = displayio_tilegrid_get_refresh_areas(layer, tail); - continue; - } - layer = mp_obj_cast_to_native_base( - self->members->items[i], &displayio_group_type); - if (layer != MP_OBJ_NULL) { - tail = displayio_group_get_refresh_areas(layer, tail); - continue; + for (int32_t i = self->members->len - 1; i >= 0; i--) { + mp_obj_t layer; + #if CIRCUITPY_VECTORIO + const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[i]); + if (draw_protocol != NULL) { + layer = draw_protocol->draw_get_protocol_self(self->members->items[i]); + tail = draw_protocol->draw_protocol_impl->draw_get_refresh_areas(layer, tail); + continue; + } + #endif + layer = mp_obj_cast_to_native_base( + self->members->items[i], &displayio_tilegrid_type); + if (layer != MP_OBJ_NULL) { + if (!common_hal_displayio_tilegrid_get_hidden(layer)){ + tail = displayio_tilegrid_get_refresh_areas(layer, tail); + } + continue; + } + layer = mp_obj_cast_to_native_base( + self->members->items[i], &displayio_group_type); + if (layer != MP_OBJ_NULL) { + tail = displayio_group_get_refresh_areas(layer, tail); + continue; + } } } From 30b69a821ed4cf09d7e17b8378c4d3a5ad513593 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 30 May 2023 19:32:24 -0500 Subject: [PATCH 1163/1712] synthio: update ring mod manual test --- tests/circuitpython-manual/synthio/note/ring.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/circuitpython-manual/synthio/note/ring.py b/tests/circuitpython-manual/synthio/note/ring.py index 7a418da3af..5ba551ec17 100644 --- a/tests/circuitpython-manual/synthio/note/ring.py +++ b/tests/circuitpython-manual/synthio/note/ring.py @@ -23,18 +23,17 @@ envelope = synthio.Envelope( ) synth = synthio.Synthesizer(sample_rate=48000) +bend_out = np.linspace(0, 32767, num=SAMPLE_SIZE, endpoint=True, dtype=np.int16) def synthesize(synth): n = synthio.Note( - frequency=120, + frequency=440, waveform=sine, ring_waveform=sine, ring_frequency=769, envelope=envelope, - bend_mode=synthio.BendType.VIBRATO, - bend_depth=50 / 1200, - bend_rate=7, + bend=synthio.LFO(bend_out, scale=50 / 1200, rate=7), ) print(synth, n) @@ -43,6 +42,13 @@ def synthesize(synth): synth.release_all() yield 36 + n.ring_frequency = 0 + print(synth, n) + synth.press((n,)) + yield 720 + synth.release_all() + yield 36 + def chain(*args): for a in args: From a999e40935831235261acffe7290df5259f8d510 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 30 May 2023 19:33:56 -0500 Subject: [PATCH 1164/1712] synthio: reorganize the order of operations Apply envelope & panning after biquad filtering. This may fix the weird popping problem. It also reduces the number of operations that are done "in stereo", so it could help performance. It also fixes a previously unnoticed problem where a ring-modulated waveform had 2x the amplitude of an un-modulated waveform. The test differences look large but it's because some values got changed in the LSB after the mathematical divisions were moved around. --- shared-module/synthio/Biquad.c | 41 +- shared-module/synthio/Biquad.h | 4 +- shared-module/synthio/__init__.c | 154 +- tests/circuitpython/miditrack.py.exp | 4 +- .../circuitpython/synth_note_amplitude.py.exp | 2018 ++++---- tests/circuitpython/synth_note_bend.py.exp | 1938 ++++---- .../circuitpython/synth_note_envelope.py.exp | 2018 ++++---- tests/circuitpython/synth_note_ring.py.exp | 4048 ++++++++--------- tests/circuitpython/synthesizer.py.exp | 42 +- tests/circuitpython/synthesizer_note.py.exp | 2 +- 10 files changed, 5127 insertions(+), 5142 deletions(-) diff --git a/shared-module/synthio/Biquad.c b/shared-module/synthio/Biquad.c index d6cdb3168f..006f596a19 100644 --- a/shared-module/synthio/Biquad.c +++ b/shared-module/synthio/Biquad.c @@ -111,38 +111,33 @@ void synthio_biquad_filter_assign(biquad_filter_state *st, mp_obj_t biquad_obj) } void synthio_biquad_filter_reset(biquad_filter_state *st) { - memset(&st->x, 0, 8 * sizeof(int16_t)); + memset(&st->x, 0, 4 * sizeof(int16_t)); } -void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *out0, const int32_t *in0, size_t n0, size_t n_channels) { +void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *buffer, size_t n_samples) { int32_t a1 = st->a1; int32_t a2 = st->a2; int32_t b0 = st->b0; int32_t b1 = st->b1; int32_t b2 = st->b2; - for (size_t i = 0; i < n_channels; i++) { - const int32_t *in = in0 + i; - int32_t *out = out0 + i; + int32_t x0 = st->x[0]; + int32_t x1 = st->x[1]; + int32_t y0 = st->y[0]; + int32_t y1 = st->y[1]; - int32_t x0 = st->x[i][0]; - int32_t x1 = st->x[i][1]; - int32_t y0 = st->y[i][0]; - int32_t y1 = st->y[i][1]; + for (size_t n = n_samples; n; --n, ++buffer) { + int32_t input = *buffer; + int32_t output = (b0 * input + b1 * x0 + b2 * x1 - a1 * y0 - a2 * y1 + (1 << (BIQUAD_SHIFT - 1))) >> BIQUAD_SHIFT; - for (size_t n = n0; n; --n, in += n_channels, out += n_channels) { - int32_t input = *in; - int32_t output = (b0 * input + b1 * x0 + b2 * x1 - a1 * y0 - a2 * y1 + (1 << (BIQUAD_SHIFT - 1))) >> BIQUAD_SHIFT; - - x1 = x0; - x0 = input; - y1 = y0; - y0 = output; - *out += output; - } - st->x[i][0] = x0; - st->x[i][1] = x1; - st->y[i][0] = y0; - st->y[i][1] = y1; + x1 = x0; + x0 = input; + y1 = y0; + y0 = output; + *buffer = output; } + st->x[0] = x0; + st->x[1] = x1; + st->y[0] = y0; + st->y[1] = y1; } diff --git a/shared-module/synthio/Biquad.h b/shared-module/synthio/Biquad.h index 1c0005ab47..1ae7658131 100644 --- a/shared-module/synthio/Biquad.h +++ b/shared-module/synthio/Biquad.h @@ -30,9 +30,9 @@ typedef struct { int32_t a1, a2, b0, b1, b2; - int32_t x[2][2], y[2][2]; + int32_t x[2], y[2]; } biquad_filter_state; void synthio_biquad_filter_assign(biquad_filter_state *st, mp_obj_t biquad_obj); void synthio_biquad_filter_reset(biquad_filter_state *st); -void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *out, const int32_t *in, size_t n_samples, size_t n_channels); +void synthio_biquad_filter_samples(biquad_filter_state *st, int32_t *buffer, size_t n_samples); diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 90540162b6..4929240d3b 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -172,24 +172,11 @@ int16_t mix_down_sample(int32_t sample) { return sample; } -static void synth_note_into_buffer(synthio_synth_t *synth, int chan, int32_t *out_buffer32, int16_t dur) { +static bool synth_note_into_buffer(synthio_synth_t *synth, int chan, int32_t *out_buffer32, int16_t dur, uint16_t loudness[2]) { mp_obj_t note_obj = synth->span.note_obj[chan]; - if (note_obj == SYNTHIO_SILENCE) { - synth->accum[chan] = 0; - return; - } - - if (synth->envelope_state[chan].level == 0) { - // note is truly finished, but we only just noticed - synth->span.note_obj[chan] = SYNTHIO_SILENCE; - return; - } - int32_t sample_rate = synth->sample_rate; - // adjust loudness by envelope - uint16_t loudness[2] = {synth->envelope_state[chan].level,synth->envelope_state[chan].level}; uint32_t dds_rate; const int16_t *waveform = synth->waveform_bufinfo.buf; @@ -228,33 +215,37 @@ static void synth_note_into_buffer(synthio_synth_t *synth, int chan, int32_t *ou } } - int synth_chan = synth->channel_count; - if (ring_dds_rate) { - uint32_t lim = waveform_length << SYNTHIO_FREQUENCY_SHIFT; - uint32_t accum = synth->accum[chan]; + uint32_t lim = waveform_length << SYNTHIO_FREQUENCY_SHIFT; + uint32_t accum = synth->accum[chan]; - if (dds_rate > lim / 2) { - // beyond nyquist, can't play note - return; - } + if (dds_rate > lim / 2) { + // beyond nyquist, can't play note + return false; + } - // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided + // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided + if (accum > lim) { + accum %= lim; + } + + // first, fill with waveform + for (uint16_t i = 0; i < dur; i++) { + accum += dds_rate; + // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed if (accum > lim) { - accum %= lim; + accum -= lim; } + int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; + out_buffer32[i] = waveform[idx]; + } + synth->accum[chan] = accum; - int32_t ring_buffer[dur]; - // first, fill with waveform - for (uint16_t i = 0; i < dur; i++) { - accum += dds_rate; - // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed - if (accum > lim) { - accum -= lim; - } - int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; - ring_buffer[i] = waveform[idx]; + if (ring_dds_rate) { + if (ring_dds_rate > lim / 2) { + // beyond nyquist, can't play ring (but did synth main sound so + // return true) + return true; } - synth->accum[chan] = accum; // now modulate by ring and accumulate accum = synth->ring_accum[chan]; @@ -265,49 +256,19 @@ static void synth_note_into_buffer(synthio_synth_t *synth, int chan, int32_t *ou accum %= lim; } - for (uint16_t i = 0, j = 0; i < dur; i++) { + for (uint16_t i = 0; i < dur; i++) { accum += ring_dds_rate; // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed if (accum > lim) { accum -= lim; } int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; - int16_t wi = (ring_waveform[idx] * ring_buffer[i]) / 32768; - for (int c = 0; c < synth_chan; c++) { - out_buffer32[j] += (wi * loudness[c]) / 32768; - j++; - } + int16_t wi = (ring_waveform[idx] * out_buffer32[i]) / 32768; + out_buffer32[i] = wi; } synth->ring_accum[chan] = accum; - } else { - uint32_t lim = waveform_length << SYNTHIO_FREQUENCY_SHIFT; - uint32_t accum = synth->accum[chan]; - - if (dds_rate > lim / 2) { - // beyond nyquist, can't play note - return; - } - - // can happen if note waveform gets set mid-note, but the expensive modulo is usually avoided - if (accum > lim) { - accum %= lim; - } - - for (uint16_t i = 0, j = 0; i < dur; i++) { - accum += dds_rate; - // because dds_rate is low enough, the subtraction is guaranteed to go back into range, no expensive modulo needed - if (accum > lim) { - accum -= lim; - } - int16_t idx = accum >> SYNTHIO_FREQUENCY_SHIFT; - int16_t wi = waveform[idx]; - for (int c = 0; c < synth_chan; c++) { - out_buffer32[j] += (wi * loudness[c]) / 65536; - j++; - } - } - synth->accum[chan] = accum; } + return true; } STATIC mp_obj_t synthio_synth_get_note_filter(mp_obj_t note_obj) { @@ -321,6 +282,19 @@ STATIC mp_obj_t synthio_synth_get_note_filter(mp_obj_t note_obj) { return mp_const_none; } +STATIC void sum_with_loudness(int32_t *out_buffer32, int32_t *tmp_buffer32, uint16_t loudness[2], size_t dur, int synth_chan) { + if (synth_chan == 1) { + for (size_t i = 0; i < dur; i++) { + *out_buffer32++ += (*tmp_buffer32++ *loudness[0]) >> 16; + } + } else { + for (size_t i = 0; i < dur; i++) { + *out_buffer32++ += (*tmp_buffer32 * loudness[0]) >> 16; + *out_buffer32++ += (*tmp_buffer32++ *loudness[1]) >> 16; + } + } +} + void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t *buffer_length, uint8_t channel) { if (channel == synth->other_channel) { @@ -338,28 +312,44 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t uint16_t dur = MIN(SYNTHIO_MAX_DUR, synth->span.dur); synth->span.dur -= dur; - int32_t out_buffer32[dur * synth->channel_count]; - memset(out_buffer32, 0, sizeof(out_buffer32)); + int32_t out_buffer32[SYNTHIO_MAX_DUR * synth->channel_count]; + int32_t tmp_buffer32[SYNTHIO_MAX_DUR]; + memset(out_buffer32, 0, synth->channel_count * dur * sizeof(int32_t)); for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { mp_obj_t note_obj = synth->span.note_obj[chan]; - mp_obj_t filter_obj = synthio_synth_get_note_filter(note_obj); - if (filter_obj == mp_const_none) { - synth_note_into_buffer(synth, chan, out_buffer32, dur); - } else { - synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); - int32_t filter_buffer32[dur * synth->channel_count]; - memset(filter_buffer32, 0, sizeof(filter_buffer32)); - - synth_note_into_buffer(synth, chan, filter_buffer32, dur); - synthio_biquad_filter_samples(¬e->filter_state, out_buffer32, filter_buffer32, dur, synth->channel_count); + if (note_obj == SYNTHIO_SILENCE) { + continue; } + + if (synth->envelope_state[chan].level == 0) { + // note is truly finished, but we only just noticed + synth->span.note_obj[chan] = SYNTHIO_SILENCE; + continue; + } + + uint16_t loudness[2] = {synth->envelope_state[chan].level,synth->envelope_state[chan].level}; + + if (!synth_note_into_buffer(synth, chan, tmp_buffer32, dur, loudness)) { + // for some other reason, such as being above nyquist, note + // couldn't be synthed, so don't filter or sum it in + continue; + } + + mp_obj_t filter_obj = synthio_synth_get_note_filter(note_obj); + if (filter_obj != mp_const_none) { + synthio_note_obj_t *note = MP_OBJ_TO_PTR(note_obj); + synthio_biquad_filter_samples(¬e->filter_state, tmp_buffer32, dur); + } + + // adjust loudness by envelope + sum_with_loudness(out_buffer32, tmp_buffer32, loudness, dur, synth->channel_count); } int16_t *out_buffer16 = (int16_t *)(void *)synth->buffers[synth->buffer_index]; // mix down audio - for (size_t i = 0; i < MP_ARRAY_SIZE(out_buffer32); i++) { + for (size_t i = 0; i < dur * synth->channel_count; i++) { int32_t sample = out_buffer32[i]; out_buffer16[i] = mix_down_sample(sample); } diff --git a/tests/circuitpython/miditrack.py.exp b/tests/circuitpython/miditrack.py.exp index 22a78e5445..5aedd79a6b 100644 --- a/tests/circuitpython/miditrack.py.exp +++ b/tests/circuitpython/miditrack.py.exp @@ -1,4 +1,4 @@ (0, 1, 512, 1) -1 [-16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383] +1 [-16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, 16383, 16383] (0, 1, 512, 1) -1 [0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16383, -16383, -16383, -16383, -16383, -16383, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0] +1 [0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16384, -16384, -16384, -16384, -16384, -16384, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16384, -16384, -16384, -16384, -16384, -16384, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16384, -16384, -16384, -16384, -16384, -16384, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, 0, -16384, -16384, -16384, -16384, -16384, -16384, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16384, -16384, -16384, -16384, -16384, -16384, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16384, -16384, -16384, -16384, -16384, -16384, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16384, -16384, -16384, -16384, -16384, -16384, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16384, -16384, -16384, -16384, -16384, -16384, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16384, -16384, -16384, -16384, -16384, -16384, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0, 0, 0, 0, 0, -16384, -16384, -16384, -16384, -16384, -16384, 0, 0, 0, 0, 0, 0, 16383, 16383, 16383, 16383, 16383, 16383, 0, 0] diff --git a/tests/circuitpython/synth_note_amplitude.py.exp b/tests/circuitpython/synth_note_amplitude.py.exp index d4c7d0adc2..c490380cb3 100644 --- a/tests/circuitpython/synth_note_amplitude.py.exp +++ b/tests/circuitpython/synth_note_amplitude.py.exp @@ -29,37 +29,37 @@ 0.0035 0.034515380859375 0.302396875 0.003625 0.0189208984375 0.302396875 0.00375 0.004730224609375 0.302396875 -0.003875 -0.01104736328125 0.302396875 -0.004 -0.02520751953125 0.302396875 -0.004125 -0.0406494140625 0.302396875 -0.00425 -0.055633544921875 0.302396875 -0.004375000000000001 -0.068603515625 0.302396875 -0.004500000000000001 -0.08233642578125 0.302396875 -0.004625 -0.093902587890625 0.302396875 -0.00475 -0.105743408203125 0.302396875 -0.004875 -0.116455078125 0.302396875 -0.005 -0.125030517578125 0.302396875 -0.005125000000000001 -0.133209228515625 0.302396875 -0.00525 -0.13934326171875 0.302396875 -0.005375000000000001 -0.14471435546875 0.302396875 -0.005499999999999999 -0.14849853515625 0.302396875 -0.005625 -0.150482177734375 0.302396875 -0.00575 -0.151153564453125 0.302396875 -0.005874999999999999 -0.15032958984375 0.302396875 -0.006 -0.147857666015625 0.302396875 -0.006125 -0.143768310546875 0.302396875 -0.00625 -0.13873291015625 0.302396875 -0.006375 -0.131683349609375 0.302396875 -0.0065 -0.124114990234375 0.302396875 -0.006625000000000001 -0.114410400390625 0.302396875 -0.00675 -0.103485107421875 0.302396875 -0.006875 -0.0926513671875 0.302396875 -0.007000000000000001 -0.07965087890625 0.302396875 -0.007125000000000002 -0.06719970703125 0.302396875 -0.007250000000000001 -0.05267333984375 0.302396875 -0.007375 -0.037567138671875 0.302396875 -0.0075 -0.02362060546875 0.302396875 -0.007625 -0.007904052734375 0.302396875 +0.003875 -0.011077880859375 0.302396875 +0.004 -0.025238037109375 0.302396875 +0.004125 -0.040679931640625 0.302396875 +0.00425 -0.0556640625 0.302396875 +0.004375000000000001 -0.068634033203125 0.302396875 +0.004500000000000001 -0.082366943359375 0.302396875 +0.004625 -0.09393310546875 0.302396875 +0.00475 -0.10577392578125 0.302396875 +0.004875 -0.116485595703125 0.302396875 +0.005 -0.12506103515625 0.302396875 +0.005125000000000001 -0.13323974609375 0.302396875 +0.00525 -0.139373779296875 0.302396875 +0.005375000000000001 -0.144744873046875 0.302396875 +0.005499999999999999 -0.148529052734375 0.302396875 +0.005625 -0.1505126953125 0.302396875 +0.00575 -0.15118408203125 0.302396875 +0.005874999999999999 -0.150360107421875 0.302396875 +0.006 -0.14788818359375 0.302396875 +0.006125 -0.143798828125 0.302396875 +0.00625 -0.138763427734375 0.302396875 +0.006375 -0.1317138671875 0.302396875 +0.0065 -0.1241455078125 0.302396875 +0.006625000000000001 -0.11444091796875 0.302396875 +0.00675 -0.103515625 0.302396875 +0.006875 -0.092681884765625 0.302396875 +0.007000000000000001 -0.079681396484375 0.302396875 +0.007125000000000002 -0.067230224609375 0.302396875 +0.007250000000000001 -0.052703857421875 0.302396875 +0.007375 -0.03759765625 0.302396875 +0.0075 -0.023651123046875 0.302396875 +0.007625 -0.0079345703125 0.302396875 0.00775 0.006317138671875 0.302396875 0.007875 0.022064208984375 0.302396875 0.008 0.037567138671875 0.302396875 @@ -91,37 +91,37 @@ 0.01125 0.042144775390625 0.302396875 0.011375 0.026763916015625 0.302396875 0.0115 0.01263427734375 0.302396875 -0.011625 -0.003143310546875 0.302396875 -0.01175 -0.0189208984375 0.302396875 -0.011875 -0.032958984375 0.302396875 -0.012 -0.0482177734375 0.302396875 -0.012125 -0.06146240234375 0.302396875 -0.01225 -0.0755615234375 0.302396875 -0.012375 -0.088836669921875 0.302396875 -0.0125 -0.0999755859375 0.302396875 -0.012625 -0.11126708984375 0.302396875 -0.01275 -0.120391845703125 0.302396875 -0.012875 -0.129302978515625 0.302396875 -0.013 -0.13677978515625 0.302396875 -0.013125 -0.1422119140625 0.302396875 -0.01325 -0.14678955078125 0.302396875 -0.013375 -0.1495361328125 0.302396875 -0.0135 -0.151031494140625 0.302396875 -0.013625 -0.15087890625 0.302396875 -0.01375 -0.1492919921875 0.302396875 -0.013875 -0.14599609375 0.302396875 -0.014 -0.141693115234375 0.302396875 -0.014125 -0.135406494140625 0.302396875 -0.01425 -0.12762451171875 0.302396875 -0.014375 -0.11944580078125 0.302396875 -0.0145 -0.109100341796875 0.302396875 -0.014625 -0.0987548828125 0.302396875 -0.01475 -0.086273193359375 0.302396875 -0.014875 -0.07281494140625 0.302396875 -0.015 -0.060028076171875 0.302396875 -0.015125 -0.045196533203125 0.302396875 -0.01525 -0.031402587890625 0.302396875 -0.015375 -0.015777587890625 0.302396875 +0.011625 -0.003173828125 0.302396875 +0.01175 -0.018951416015625 0.302396875 +0.011875 -0.032989501953125 0.302396875 +0.012 -0.048248291015625 0.302396875 +0.012125 -0.061492919921875 0.302396875 +0.01225 -0.075592041015625 0.302396875 +0.012375 -0.0888671875 0.302396875 +0.0125 -0.100006103515625 0.302396875 +0.012625 -0.111297607421875 0.302396875 +0.01275 -0.12042236328125 0.302396875 +0.012875 -0.12933349609375 0.302396875 +0.013 -0.136810302734375 0.302396875 +0.013125 -0.142242431640625 0.302396875 +0.01325 -0.146820068359375 0.302396875 +0.013375 -0.149566650390625 0.302396875 +0.0135 -0.15106201171875 0.302396875 +0.013625 -0.150909423828125 0.302396875 +0.01375 -0.149322509765625 0.302396875 +0.013875 -0.146026611328125 0.302396875 +0.014 -0.1417236328125 0.302396875 +0.014125 -0.13543701171875 0.302396875 +0.01425 -0.127655029296875 0.302396875 +0.014375 -0.119476318359375 0.302396875 +0.0145 -0.109130859375 0.302396875 +0.014625 -0.098785400390625 0.302396875 +0.01475 -0.0863037109375 0.302396875 +0.014875 -0.072845458984375 0.302396875 +0.015 -0.06005859375 0.302396875 +0.015125 -0.04522705078125 0.302396875 +0.01525 -0.03143310546875 0.302396875 +0.015375 -0.01580810546875 0.302396875 0.0155 0.0 0.302396875 0.015625 0.01422119140625 0.302396875 0.01575 0.029876708984375 0.302396875 @@ -154,37 +154,37 @@ 0.019125 0.034515380859375 0.302396875 0.01925 0.0189208984375 0.302396875 0.019375 0.004730224609375 0.302396875 -0.0195 -0.01104736328125 0.302396875 -0.019625 -0.02520751953125 0.302396875 -0.01975 -0.0406494140625 0.302396875 -0.019875 -0.055633544921875 0.302396875 -0.02 -0.068603515625 0.302396875 -0.020125 -0.08233642578125 0.302396875 -0.02025 -0.093902587890625 0.302396875 -0.020375 -0.105743408203125 0.302396875 -0.0205 -0.116455078125 0.302396875 -0.020625 -0.125030517578125 0.302396875 -0.02075 -0.133209228515625 0.302396875 -0.020875 -0.13934326171875 0.302396875 -0.021 -0.14471435546875 0.302396875 -0.021125 -0.14849853515625 0.302396875 -0.02125 -0.150482177734375 0.302396875 -0.021375 -0.151153564453125 0.302396875 -0.0215 -0.15032958984375 0.302396875 -0.021625 -0.147857666015625 0.302396875 -0.02175 -0.143768310546875 0.302396875 -0.021875 -0.13873291015625 0.302396875 -0.022 -0.131683349609375 0.302396875 -0.022125 -0.124114990234375 0.302396875 -0.02225 -0.114410400390625 0.302396875 -0.022375 -0.103485107421875 0.302396875 -0.0225 -0.0926513671875 0.302396875 -0.022625 -0.07965087890625 0.302396875 -0.02275 -0.06719970703125 0.302396875 -0.022875 -0.05267333984375 0.302396875 -0.023 -0.037567138671875 0.302396875 -0.023125 -0.02362060546875 0.302396875 -0.02325 -0.007904052734375 0.302396875 +0.0195 -0.011077880859375 0.302396875 +0.019625 -0.025238037109375 0.302396875 +0.01975 -0.040679931640625 0.302396875 +0.019875 -0.0556640625 0.302396875 +0.02 -0.068634033203125 0.302396875 +0.020125 -0.082366943359375 0.302396875 +0.02025 -0.09393310546875 0.302396875 +0.020375 -0.10577392578125 0.302396875 +0.0205 -0.116485595703125 0.302396875 +0.020625 -0.12506103515625 0.302396875 +0.02075 -0.13323974609375 0.302396875 +0.020875 -0.139373779296875 0.302396875 +0.021 -0.144744873046875 0.302396875 +0.021125 -0.148529052734375 0.302396875 +0.02125 -0.1505126953125 0.302396875 +0.021375 -0.15118408203125 0.302396875 +0.0215 -0.150360107421875 0.302396875 +0.021625 -0.14788818359375 0.302396875 +0.02175 -0.143798828125 0.302396875 +0.021875 -0.138763427734375 0.302396875 +0.022 -0.1317138671875 0.302396875 +0.022125 -0.1241455078125 0.302396875 +0.02225 -0.11444091796875 0.302396875 +0.022375 -0.103515625 0.302396875 +0.0225 -0.092681884765625 0.302396875 +0.022625 -0.079681396484375 0.302396875 +0.02275 -0.067230224609375 0.302396875 +0.022875 -0.052703857421875 0.302396875 +0.023 -0.03759765625 0.302396875 +0.023125 -0.023651123046875 0.302396875 +0.02325 -0.0079345703125 0.302396875 0.023375 0.006317138671875 0.302396875 0.0235 0.022064208984375 0.302396875 0.023625 0.037567138671875 0.302396875 @@ -216,37 +216,37 @@ 0.026875 0.042144775390625 0.302396875 0.027 0.026763916015625 0.302396875 0.027125 0.01263427734375 0.302396875 -0.02725 -0.003143310546875 0.302396875 -0.027375 -0.0189208984375 0.302396875 -0.0275 -0.032958984375 0.302396875 -0.027625 -0.0482177734375 0.302396875 -0.02775 -0.06146240234375 0.302396875 -0.027875 -0.0755615234375 0.302396875 -0.028 -0.088836669921875 0.302396875 -0.028125 -0.0999755859375 0.302396875 -0.02825 -0.11126708984375 0.302396875 -0.028375 -0.120391845703125 0.302396875 -0.02850000000000001 -0.129302978515625 0.302396875 -0.028625 -0.13677978515625 0.302396875 -0.02875 -0.1422119140625 0.302396875 -0.028875 -0.14678955078125 0.302396875 -0.029 -0.1495361328125 0.302396875 -0.029125 -0.151031494140625 0.302396875 -0.02925 -0.15087890625 0.302396875 -0.029375 -0.1492919921875 0.302396875 -0.0295 -0.14599609375 0.302396875 -0.029625 -0.141693115234375 0.302396875 -0.02975000000000001 -0.135406494140625 0.302396875 -0.029875 -0.12762451171875 0.302396875 -0.03 -0.11944580078125 0.302396875 -0.030125 -0.109100341796875 0.302396875 -0.03025 -0.0987548828125 0.302396875 -0.030375 -0.086273193359375 0.302396875 -0.0305 -0.07281494140625 0.302396875 -0.030625 -0.060028076171875 0.302396875 -0.03075 -0.045196533203125 0.302396875 -0.03087499999999999 -0.031402587890625 0.302396875 -0.031 -0.015777587890625 0.302396875 +0.02725 -0.003173828125 0.302396875 +0.027375 -0.018951416015625 0.302396875 +0.0275 -0.032989501953125 0.302396875 +0.027625 -0.048248291015625 0.302396875 +0.02775 -0.061492919921875 0.302396875 +0.027875 -0.075592041015625 0.302396875 +0.028 -0.0888671875 0.302396875 +0.028125 -0.100006103515625 0.302396875 +0.02825 -0.111297607421875 0.302396875 +0.028375 -0.12042236328125 0.302396875 +0.02850000000000001 -0.12933349609375 0.302396875 +0.028625 -0.136810302734375 0.302396875 +0.02875 -0.142242431640625 0.302396875 +0.028875 -0.146820068359375 0.302396875 +0.029 -0.149566650390625 0.302396875 +0.029125 -0.15106201171875 0.302396875 +0.02925 -0.150909423828125 0.302396875 +0.029375 -0.149322509765625 0.302396875 +0.0295 -0.146026611328125 0.302396875 +0.029625 -0.1417236328125 0.302396875 +0.02975000000000001 -0.13543701171875 0.302396875 +0.029875 -0.127655029296875 0.302396875 +0.03 -0.119476318359375 0.302396875 +0.030125 -0.109130859375 0.302396875 +0.03025 -0.098785400390625 0.302396875 +0.030375 -0.0863037109375 0.302396875 +0.0305 -0.072845458984375 0.302396875 +0.030625 -0.06005859375 0.302396875 +0.03075 -0.04522705078125 0.302396875 +0.03087499999999999 -0.03143310546875 0.302396875 +0.031 -0.01580810546875 0.302396875 0.031125 0.0 0.302396875 0.03125 0.01422119140625 0.302396875 0.031375 0.029876708984375 0.302396875 @@ -279,37 +279,37 @@ 0.03475000000000001 0.04620361328125 0.4047937500000001 0.034875 0.02532958984375 0.4047937500000001 0.035 0.00634765625 0.4047937500000001 -0.03512500000000001 -0.014801025390625 0.4047937500000001 -0.03525 -0.033721923828125 0.4047937500000001 -0.035375 -0.054412841796875 0.4047937500000001 -0.0355 -0.074493408203125 0.4047937500000001 -0.03562500000000001 -0.09185791015625 0.4047937500000001 -0.03575 -0.110198974609375 0.4047937500000001 -0.035875 -0.12567138671875 0.4047937500000001 -0.03600000000000001 -0.141571044921875 0.4047937500000001 -0.036125 -0.155914306640625 0.4047937500000001 -0.03625 -0.1673583984375 0.4047937500000001 -0.036375 -0.1783447265625 0.4047937500000001 -0.0365 -0.186553955078125 0.4047937500000001 -0.036625 -0.1937255859375 0.4047937500000001 -0.03675 -0.198760986328125 0.4047937500000001 -0.036875 -0.201446533203125 0.4047937500000001 -0.037 -0.20233154296875 0.4047937500000001 -0.03712499999999999 -0.20123291015625 0.4047937500000001 -0.03725 -0.19793701171875 0.4047937500000001 -0.037375 -0.19244384765625 0.4047937500000001 -0.0375 -0.185699462890625 0.4047937500000001 -0.037625 -0.176300048828125 0.4047937500000001 -0.03775 -0.166168212890625 0.4047937500000001 -0.037875 -0.153167724609375 0.4047937500000001 -0.038 -0.138519287109375 0.4047937500000001 -0.038125 -0.1240234375 0.4047937500000001 -0.03825 -0.10662841796875 0.4047937500000001 -0.038375 -0.0899658203125 0.4047937500000001 -0.0385 -0.070526123046875 0.4047937500000001 -0.038625 -0.05029296875 0.4047937500000001 -0.03875 -0.031646728515625 0.4047937500000001 -0.038875 -0.01055908203125 0.4047937500000001 +0.03512500000000001 -0.01483154296875 0.4047937500000001 +0.03525 -0.03375244140625 0.4047937500000001 +0.035375 -0.054443359375 0.4047937500000001 +0.0355 -0.07452392578125 0.4047937500000001 +0.03562500000000001 -0.091888427734375 0.4047937500000001 +0.03575 -0.1102294921875 0.4047937500000001 +0.035875 -0.125701904296875 0.4047937500000001 +0.03600000000000001 -0.1416015625 0.4047937500000001 +0.036125 -0.15594482421875 0.4047937500000001 +0.03625 -0.167388916015625 0.4047937500000001 +0.036375 -0.178375244140625 0.4047937500000001 +0.0365 -0.18658447265625 0.4047937500000001 +0.036625 -0.193756103515625 0.4047937500000001 +0.03675 -0.19879150390625 0.4047937500000001 +0.036875 -0.20147705078125 0.4047937500000001 +0.037 -0.202362060546875 0.4047937500000001 +0.03712499999999999 -0.201263427734375 0.4047937500000001 +0.03725 -0.197967529296875 0.4047937500000001 +0.037375 -0.192474365234375 0.4047937500000001 +0.0375 -0.18572998046875 0.4047937500000001 +0.037625 -0.17633056640625 0.4047937500000001 +0.03775 -0.16619873046875 0.4047937500000001 +0.037875 -0.1531982421875 0.4047937500000001 +0.038 -0.1385498046875 0.4047937500000001 +0.038125 -0.124053955078125 0.4047937500000001 +0.03825 -0.106658935546875 0.4047937500000001 +0.038375 -0.089996337890625 0.4047937500000001 +0.0385 -0.070556640625 0.4047937500000001 +0.038625 -0.050323486328125 0.4047937500000001 +0.03875 -0.03167724609375 0.4047937500000001 +0.038875 -0.010589599609375 0.4047937500000001 0.039 0.008453369140625 0.4047937500000001 0.039125 0.029541015625 0.4047937500000001 0.03925 0.05029296875 0.4047937500000001 @@ -341,37 +341,37 @@ 0.0425 0.056427001953125 0.4047937500000001 0.042625 0.03582763671875 0.4047937500000001 0.04275 0.01690673828125 0.4047937500000001 -0.04287500000000001 -0.00421142578125 0.4047937500000001 -0.04300000000000001 -0.02532958984375 0.4047937500000001 -0.043125 -0.04412841796875 0.4047937500000001 -0.04325 -0.064544677734375 0.4047937500000001 -0.043375 -0.082305908203125 0.4047937500000001 -0.04350000000000001 -0.101165771484375 0.4047937500000001 -0.04362500000000001 -0.118927001953125 0.4047937500000001 -0.04375000000000001 -0.133819580078125 0.4047937500000001 -0.043875 -0.148956298828125 0.4047937500000001 -0.04399999999999999 -0.161163330078125 0.4047937500000001 -0.044125 -0.173095703125 0.4047937500000001 -0.04425 -0.18310546875 0.4047937500000001 -0.044375 -0.190399169921875 0.4047937500000001 -0.04449999999999999 -0.196502685546875 0.4047937500000001 -0.04462499999999999 -0.2001953125 0.4047937500000001 -0.04475 -0.202178955078125 0.4047937500000001 -0.044875 -0.20196533203125 0.4047937500000001 -0.045 -0.199859619140625 0.4047937500000001 -0.045125 -0.195465087890625 0.4047937500000001 -0.04525 -0.189666748046875 0.4047937500000001 -0.045375 -0.181243896484375 0.4047937500000001 -0.0455 -0.17083740234375 0.4047937500000001 -0.045625 -0.159881591796875 0.4047937500000001 -0.04575 -0.14605712890625 0.4047937500000001 -0.045875 -0.1322021484375 0.4047937500000001 -0.046 -0.115478515625 0.4047937500000001 -0.046125 -0.09747314453125 0.4047937500000001 -0.04625 -0.080352783203125 0.4047937500000001 -0.046375 -0.06048583984375 0.4047937500000001 -0.04649999999999999 -0.04205322265625 0.4047937500000001 -0.046625 -0.021148681640625 0.4047937500000001 +0.04287500000000001 -0.004241943359375 0.4047937500000001 +0.04300000000000001 -0.025360107421875 0.4047937500000001 +0.043125 -0.044158935546875 0.4047937500000001 +0.04325 -0.0645751953125 0.4047937500000001 +0.043375 -0.08233642578125 0.4047937500000001 +0.04350000000000001 -0.1011962890625 0.4047937500000001 +0.04362500000000001 -0.11895751953125 0.4047937500000001 +0.04375000000000001 -0.13385009765625 0.4047937500000001 +0.043875 -0.14898681640625 0.4047937500000001 +0.04399999999999999 -0.16119384765625 0.4047937500000001 +0.044125 -0.173126220703125 0.4047937500000001 +0.04425 -0.183135986328125 0.4047937500000001 +0.044375 -0.1904296875 0.4047937500000001 +0.04449999999999999 -0.196533203125 0.4047937500000001 +0.04462499999999999 -0.200225830078125 0.4047937500000001 +0.04475 -0.20220947265625 0.4047937500000001 +0.044875 -0.201995849609375 0.4047937500000001 +0.045 -0.19989013671875 0.4047937500000001 +0.045125 -0.19549560546875 0.4047937500000001 +0.04525 -0.189697265625 0.4047937500000001 +0.045375 -0.1812744140625 0.4047937500000001 +0.0455 -0.170867919921875 0.4047937500000001 +0.045625 -0.159912109375 0.4047937500000001 +0.04575 -0.146087646484375 0.4047937500000001 +0.045875 -0.132232666015625 0.4047937500000001 +0.046 -0.115509033203125 0.4047937500000001 +0.046125 -0.097503662109375 0.4047937500000001 +0.04625 -0.08038330078125 0.4047937500000001 +0.046375 -0.060516357421875 0.4047937500000001 +0.04649999999999999 -0.042083740234375 0.4047937500000001 +0.046625 -0.02117919921875 0.4047937500000001 0.04675000000000001 0.0 0.4047937500000001 0.046875 0.019012451171875 0.4047937500000001 0.04699999999999999 0.03997802734375 0.4047937500000001 @@ -404,37 +404,37 @@ 0.05037500000000001 0.04620361328125 0.4047937500000001 0.0505 0.02532958984375 0.4047937500000001 0.05062500000000001 0.00634765625 0.4047937500000001 -0.05075000000000001 -0.014801025390625 0.4047937500000001 -0.050875 -0.033721923828125 0.4047937500000001 -0.051 -0.054412841796875 0.4047937500000001 -0.051125 -0.074493408203125 0.4047937500000001 -0.05125000000000001 -0.09185791015625 0.4047937500000001 -0.051375 -0.110198974609375 0.4047937500000001 -0.0515 -0.12567138671875 0.4047937500000001 -0.05162500000000001 -0.141571044921875 0.4047937500000001 -0.05175000000000001 -0.155914306640625 0.4047937500000001 -0.051875 -0.1673583984375 0.4047937500000001 -0.052 -0.1783447265625 0.4047937500000001 -0.052125 -0.186553955078125 0.4047937500000001 -0.05225 -0.1937255859375 0.4047937500000001 -0.05237499999999999 -0.198760986328125 0.4047937500000001 -0.0525 -0.201446533203125 0.4047937500000001 -0.052625 -0.20233154296875 0.4047937500000001 -0.05274999999999999 -0.20123291015625 0.4047937500000001 -0.052875 -0.19793701171875 0.4047937500000001 -0.05300000000000001 -0.19244384765625 0.4047937500000001 -0.053125 -0.185699462890625 0.4047937500000001 -0.05324999999999999 -0.176300048828125 0.4047937500000001 -0.05337499999999999 -0.166168212890625 0.4047937500000001 -0.05350000000000001 -0.153167724609375 0.4047937500000001 -0.053625 -0.138519287109375 0.4047937500000001 -0.05375 -0.1240234375 0.4047937500000001 -0.05387499999999999 -0.10662841796875 0.4047937500000001 -0.054 -0.0899658203125 0.4047937500000001 -0.054125 -0.070526123046875 0.4047937500000001 -0.05425 -0.05029296875 0.4047937500000001 -0.054375 -0.031646728515625 0.4047937500000001 -0.0545 -0.01055908203125 0.4047937500000001 +0.05075000000000001 -0.01483154296875 0.4047937500000001 +0.050875 -0.03375244140625 0.4047937500000001 +0.051 -0.054443359375 0.4047937500000001 +0.051125 -0.07452392578125 0.4047937500000001 +0.05125000000000001 -0.091888427734375 0.4047937500000001 +0.051375 -0.1102294921875 0.4047937500000001 +0.0515 -0.125701904296875 0.4047937500000001 +0.05162500000000001 -0.1416015625 0.4047937500000001 +0.05175000000000001 -0.15594482421875 0.4047937500000001 +0.051875 -0.167388916015625 0.4047937500000001 +0.052 -0.178375244140625 0.4047937500000001 +0.052125 -0.18658447265625 0.4047937500000001 +0.05225 -0.193756103515625 0.4047937500000001 +0.05237499999999999 -0.19879150390625 0.4047937500000001 +0.0525 -0.20147705078125 0.4047937500000001 +0.052625 -0.202362060546875 0.4047937500000001 +0.05274999999999999 -0.201263427734375 0.4047937500000001 +0.052875 -0.197967529296875 0.4047937500000001 +0.05300000000000001 -0.192474365234375 0.4047937500000001 +0.053125 -0.18572998046875 0.4047937500000001 +0.05324999999999999 -0.17633056640625 0.4047937500000001 +0.05337499999999999 -0.16619873046875 0.4047937500000001 +0.05350000000000001 -0.1531982421875 0.4047937500000001 +0.053625 -0.1385498046875 0.4047937500000001 +0.05375 -0.124053955078125 0.4047937500000001 +0.05387499999999999 -0.106658935546875 0.4047937500000001 +0.054 -0.089996337890625 0.4047937500000001 +0.054125 -0.070556640625 0.4047937500000001 +0.05425 -0.050323486328125 0.4047937500000001 +0.054375 -0.03167724609375 0.4047937500000001 +0.0545 -0.010589599609375 0.4047937500000001 0.054625 0.008453369140625 0.4047937500000001 0.05475 0.029541015625 0.4047937500000001 0.054875 0.05029296875 0.4047937500000001 @@ -466,37 +466,37 @@ 0.058125 0.056427001953125 0.4047937500000001 0.05825 0.03582763671875 0.4047937500000001 0.058375 0.01690673828125 0.4047937500000001 -0.05850000000000001 -0.00421142578125 0.4047937500000001 -0.05862500000000001 -0.02532958984375 0.4047937500000001 -0.05875 -0.04412841796875 0.4047937500000001 -0.058875 -0.064544677734375 0.4047937500000001 -0.059 -0.082305908203125 0.4047937500000001 -0.05912500000000001 -0.101165771484375 0.4047937500000001 -0.05925000000000001 -0.118927001953125 0.4047937500000001 -0.059375 -0.133819580078125 0.4047937500000001 -0.05950000000000001 -0.148956298828125 0.4047937500000001 -0.059625 -0.161163330078125 0.4047937500000001 -0.05975000000000001 -0.173095703125 0.4047937500000001 -0.059875 -0.18310546875 0.4047937500000001 -0.06 -0.190399169921875 0.4047937500000001 -0.06012499999999999 -0.196502685546875 0.4047937500000001 -0.06025 -0.2001953125 0.4047937500000001 -0.060375 -0.202178955078125 0.4047937500000001 -0.0605 -0.20196533203125 0.4047937500000001 -0.060625 -0.199859619140625 0.4047937500000001 -0.06074999999999999 -0.195465087890625 0.4047937500000001 -0.060875 -0.189666748046875 0.4047937500000001 -0.061 -0.181243896484375 0.4047937500000001 -0.061125 -0.17083740234375 0.4047937500000001 -0.06125 -0.159881591796875 0.4047937500000001 -0.061375 -0.14605712890625 0.4047937500000001 -0.0615 -0.1322021484375 0.4047937500000001 -0.061625 -0.115478515625 0.4047937500000001 -0.06174999999999999 -0.09747314453125 0.4047937500000001 -0.061875 -0.080352783203125 0.4047937500000001 -0.062 -0.06048583984375 0.4047937500000001 -0.06212499999999999 -0.04205322265625 0.4047937500000001 -0.06225000000000001 -0.021148681640625 0.4047937500000001 +0.05850000000000001 -0.004241943359375 0.4047937500000001 +0.05862500000000001 -0.025360107421875 0.4047937500000001 +0.05875 -0.044158935546875 0.4047937500000001 +0.058875 -0.0645751953125 0.4047937500000001 +0.059 -0.08233642578125 0.4047937500000001 +0.05912500000000001 -0.1011962890625 0.4047937500000001 +0.05925000000000001 -0.11895751953125 0.4047937500000001 +0.059375 -0.13385009765625 0.4047937500000001 +0.05950000000000001 -0.14898681640625 0.4047937500000001 +0.059625 -0.16119384765625 0.4047937500000001 +0.05975000000000001 -0.173126220703125 0.4047937500000001 +0.059875 -0.183135986328125 0.4047937500000001 +0.06 -0.1904296875 0.4047937500000001 +0.06012499999999999 -0.196533203125 0.4047937500000001 +0.06025 -0.200225830078125 0.4047937500000001 +0.060375 -0.20220947265625 0.4047937500000001 +0.0605 -0.201995849609375 0.4047937500000001 +0.060625 -0.19989013671875 0.4047937500000001 +0.06074999999999999 -0.19549560546875 0.4047937500000001 +0.060875 -0.189697265625 0.4047937500000001 +0.061 -0.1812744140625 0.4047937500000001 +0.061125 -0.170867919921875 0.4047937500000001 +0.06125 -0.159912109375 0.4047937500000001 +0.061375 -0.146087646484375 0.4047937500000001 +0.0615 -0.132232666015625 0.4047937500000001 +0.061625 -0.115509033203125 0.4047937500000001 +0.06174999999999999 -0.097503662109375 0.4047937500000001 +0.061875 -0.08038330078125 0.4047937500000001 +0.062 -0.060516357421875 0.4047937500000001 +0.06212499999999999 -0.042083740234375 0.4047937500000001 +0.06225000000000001 -0.02117919921875 0.4047937500000001 0.06237500000000001 0.0 0.4047937500000001 0.0625 0.019012451171875 0.4047937500000001 0.06262499999999999 0.03997802734375 0.4047937500000001 @@ -529,37 +529,37 @@ 0.06600000000000001 0.057891845703125 0.507190625 0.066125 0.031768798828125 0.507190625 0.06625000000000001 0.0079345703125 0.507190625 -0.06637500000000001 -0.0185546875 0.507190625 -0.0665 -0.042266845703125 0.507190625 -0.066625 -0.06817626953125 0.507190625 -0.06675 -0.09332275390625 0.507190625 -0.06687500000000001 -0.1151123046875 0.507190625 -0.067 -0.138092041015625 0.507190625 -0.067125 -0.157501220703125 0.507190625 -0.06725000000000001 -0.177398681640625 0.507190625 -0.06737500000000001 -0.19537353515625 0.507190625 -0.0675 -0.209716796875 0.507190625 -0.067625 -0.22344970703125 0.507190625 -0.06775 -0.233734130859375 0.507190625 -0.06787500000000001 -0.24273681640625 0.507190625 -0.06800000000000001 -0.249053955078125 0.507190625 -0.068125 -0.25244140625 0.507190625 -0.06825000000000001 -0.2535400390625 0.507190625 -0.068375 -0.252166748046875 0.507190625 -0.06850000000000001 -0.248016357421875 0.507190625 -0.06862500000000001 -0.24114990234375 0.507190625 -0.06875 -0.232696533203125 0.507190625 -0.06887500000000001 -0.220916748046875 0.507190625 -0.069 -0.20819091796875 0.507190625 -0.06912500000000001 -0.191925048828125 0.507190625 -0.06925000000000001 -0.173553466796875 0.507190625 -0.06937500000000001 -0.1553955078125 0.507190625 -0.06950000000000001 -0.13360595703125 0.507190625 -0.069625 -0.11273193359375 0.507190625 -0.06975 -0.08837890625 0.507190625 -0.06987500000000001 -0.06304931640625 0.507190625 -0.07000000000000001 -0.039642333984375 0.507190625 -0.070125 -0.01324462890625 0.507190625 +0.06637500000000001 -0.018585205078125 0.507190625 +0.0665 -0.04229736328125 0.507190625 +0.066625 -0.068206787109375 0.507190625 +0.06675 -0.093353271484375 0.507190625 +0.06687500000000001 -0.115142822265625 0.507190625 +0.067 -0.13812255859375 0.507190625 +0.067125 -0.15753173828125 0.507190625 +0.06725000000000001 -0.17742919921875 0.507190625 +0.06737500000000001 -0.195404052734375 0.507190625 +0.0675 -0.209747314453125 0.507190625 +0.067625 -0.223480224609375 0.507190625 +0.06775 -0.2337646484375 0.507190625 +0.06787500000000001 -0.242767333984375 0.507190625 +0.06800000000000001 -0.24908447265625 0.507190625 +0.068125 -0.252471923828125 0.507190625 +0.06825000000000001 -0.253570556640625 0.507190625 +0.068375 -0.252197265625 0.507190625 +0.06850000000000001 -0.248046875 0.507190625 +0.06862500000000001 -0.241180419921875 0.507190625 +0.06875 -0.23272705078125 0.507190625 +0.06887500000000001 -0.220947265625 0.507190625 +0.069 -0.208221435546875 0.507190625 +0.06912500000000001 -0.19195556640625 0.507190625 +0.06925000000000001 -0.173583984375 0.507190625 +0.06937500000000001 -0.155426025390625 0.507190625 +0.06950000000000001 -0.133636474609375 0.507190625 +0.069625 -0.112762451171875 0.507190625 +0.06975 -0.088409423828125 0.507190625 +0.06987500000000001 -0.063079833984375 0.507190625 +0.07000000000000001 -0.0396728515625 0.507190625 +0.070125 -0.013275146484375 0.507190625 0.07025000000000001 0.010589599609375 0.507190625 0.07037500000000001 0.037017822265625 0.507190625 0.07050000000000001 0.06304931640625 0.507190625 @@ -591,37 +591,37 @@ 0.07374999999999999 0.07073974609375 0.507190625 0.073875 0.044891357421875 0.507190625 0.074 0.021209716796875 0.507190625 -0.074125 -0.005279541015625 0.507190625 -0.07424999999999999 -0.031768798828125 0.507190625 -0.07437499999999999 -0.0552978515625 0.507190625 -0.0745 -0.08087158203125 0.507190625 -0.07462499999999999 -0.103118896484375 0.507190625 -0.07475 -0.12677001953125 0.507190625 -0.07487500000000001 -0.149017333984375 0.507190625 -0.075 -0.16766357421875 0.507190625 -0.07512499999999999 -0.1866455078125 0.507190625 -0.07524999999999999 -0.20196533203125 0.507190625 -0.075375 -0.216888427734375 0.507190625 -0.0755 -0.22943115234375 0.507190625 -0.075625 -0.238555908203125 0.507190625 -0.07574999999999999 -0.246246337890625 0.507190625 -0.075875 -0.250823974609375 0.507190625 -0.076 -0.253326416015625 0.507190625 -0.076125 -0.2530517578125 0.507190625 -0.07625 -0.25042724609375 0.507190625 -0.07637499999999999 -0.244903564453125 0.507190625 -0.0765 -0.237640380859375 0.507190625 -0.076625 -0.22711181640625 0.507190625 -0.07675 -0.214080810546875 0.507190625 -0.076875 -0.200347900390625 0.507190625 -0.077 -0.183013916015625 0.507190625 -0.077125 -0.165679931640625 0.507190625 -0.07725 -0.14471435546875 0.507190625 -0.07737499999999999 -0.12213134765625 0.507190625 -0.0775 -0.100677490234375 0.507190625 -0.077625 -0.0758056640625 0.507190625 -0.07774999999999999 -0.052703857421875 0.507190625 -0.07787500000000001 -0.0264892578125 0.507190625 +0.074125 -0.00531005859375 0.507190625 +0.07424999999999999 -0.03179931640625 0.507190625 +0.07437499999999999 -0.055328369140625 0.507190625 +0.0745 -0.080902099609375 0.507190625 +0.07462499999999999 -0.1031494140625 0.507190625 +0.07475 -0.126800537109375 0.507190625 +0.07487500000000001 -0.1490478515625 0.507190625 +0.075 -0.167694091796875 0.507190625 +0.07512499999999999 -0.186676025390625 0.507190625 +0.07524999999999999 -0.201995849609375 0.507190625 +0.075375 -0.2169189453125 0.507190625 +0.0755 -0.229461669921875 0.507190625 +0.075625 -0.23858642578125 0.507190625 +0.07574999999999999 -0.24627685546875 0.507190625 +0.075875 -0.2508544921875 0.507190625 +0.076 -0.25335693359375 0.507190625 +0.076125 -0.253082275390625 0.507190625 +0.07625 -0.250457763671875 0.507190625 +0.07637499999999999 -0.24493408203125 0.507190625 +0.0765 -0.2376708984375 0.507190625 +0.076625 -0.227142333984375 0.507190625 +0.07675 -0.214111328125 0.507190625 +0.076875 -0.20037841796875 0.507190625 +0.077 -0.18304443359375 0.507190625 +0.077125 -0.16571044921875 0.507190625 +0.07725 -0.144744873046875 0.507190625 +0.07737499999999999 -0.122161865234375 0.507190625 +0.0775 -0.1007080078125 0.507190625 +0.077625 -0.075836181640625 0.507190625 +0.07774999999999999 -0.052734375 0.507190625 +0.07787500000000001 -0.026519775390625 0.507190625 0.07800000000000001 0.0 0.507190625 0.078125 0.023834228515625 0.507190625 0.07824999999999999 0.05010986328125 0.507190625 @@ -654,37 +654,37 @@ 0.081625 0.057891845703125 0.507190625 0.08175000000000001 0.031768798828125 0.507190625 0.081875 0.0079345703125 0.507190625 -0.08200000000000001 -0.0185546875 0.507190625 -0.082125 -0.042266845703125 0.507190625 -0.08225 -0.06817626953125 0.507190625 -0.08237500000000001 -0.09332275390625 0.507190625 -0.0825 -0.1151123046875 0.507190625 -0.08262500000000001 -0.138092041015625 0.507190625 -0.08275 -0.157501220703125 0.507190625 -0.08287500000000001 -0.177398681640625 0.507190625 -0.08300000000000001 -0.19537353515625 0.507190625 -0.083125 -0.209716796875 0.507190625 -0.08324999999999999 -0.22344970703125 0.507190625 -0.083375 -0.233734130859375 0.507190625 -0.08350000000000001 -0.24273681640625 0.507190625 -0.08362500000000001 -0.249053955078125 0.507190625 -0.08375 -0.25244140625 0.507190625 -0.08387500000000001 -0.2535400390625 0.507190625 -0.084 -0.252166748046875 0.507190625 -0.08412500000000001 -0.248016357421875 0.507190625 -0.08425000000000001 -0.24114990234375 0.507190625 -0.084375 -0.232696533203125 0.507190625 -0.08450000000000001 -0.220916748046875 0.507190625 -0.084625 -0.20819091796875 0.507190625 -0.08475 -0.191925048828125 0.507190625 -0.08487500000000001 -0.173553466796875 0.507190625 -0.085 -0.1553955078125 0.507190625 -0.08512500000000001 -0.13360595703125 0.507190625 -0.08525 -0.11273193359375 0.507190625 -0.085375 -0.08837890625 0.507190625 -0.08550000000000001 -0.06304931640625 0.507190625 -0.085625 -0.039642333984375 0.507190625 -0.08575000000000001 -0.01324462890625 0.507190625 +0.08200000000000001 -0.018585205078125 0.507190625 +0.082125 -0.04229736328125 0.507190625 +0.08225 -0.068206787109375 0.507190625 +0.08237500000000001 -0.093353271484375 0.507190625 +0.0825 -0.115142822265625 0.507190625 +0.08262500000000001 -0.13812255859375 0.507190625 +0.08275 -0.15753173828125 0.507190625 +0.08287500000000001 -0.17742919921875 0.507190625 +0.08300000000000001 -0.195404052734375 0.507190625 +0.083125 -0.209747314453125 0.507190625 +0.08324999999999999 -0.223480224609375 0.507190625 +0.083375 -0.2337646484375 0.507190625 +0.08350000000000001 -0.242767333984375 0.507190625 +0.08362500000000001 -0.24908447265625 0.507190625 +0.08375 -0.252471923828125 0.507190625 +0.08387500000000001 -0.253570556640625 0.507190625 +0.084 -0.252197265625 0.507190625 +0.08412500000000001 -0.248046875 0.507190625 +0.08425000000000001 -0.241180419921875 0.507190625 +0.084375 -0.23272705078125 0.507190625 +0.08450000000000001 -0.220947265625 0.507190625 +0.084625 -0.208221435546875 0.507190625 +0.08475 -0.19195556640625 0.507190625 +0.08487500000000001 -0.173583984375 0.507190625 +0.085 -0.155426025390625 0.507190625 +0.08512500000000001 -0.133636474609375 0.507190625 +0.08525 -0.112762451171875 0.507190625 +0.085375 -0.088409423828125 0.507190625 +0.08550000000000001 -0.063079833984375 0.507190625 +0.085625 -0.0396728515625 0.507190625 +0.08575000000000001 -0.013275146484375 0.507190625 0.08587500000000002 0.010589599609375 0.507190625 0.08600000000000001 0.037017822265625 0.507190625 0.08612500000000001 0.06304931640625 0.507190625 @@ -716,37 +716,37 @@ 0.089375 0.07073974609375 0.507190625 0.08949999999999999 0.044891357421875 0.507190625 0.089625 0.021209716796875 0.507190625 -0.08975 -0.005279541015625 0.507190625 -0.08987499999999999 -0.031768798828125 0.507190625 -0.09 -0.0552978515625 0.507190625 -0.09012499999999999 -0.08087158203125 0.507190625 -0.09025 -0.103118896484375 0.507190625 -0.090375 -0.12677001953125 0.507190625 -0.09050000000000001 -0.149017333984375 0.507190625 -0.090625 -0.16766357421875 0.507190625 -0.09074999999999999 -0.1866455078125 0.507190625 -0.09087499999999999 -0.20196533203125 0.507190625 -0.091 -0.216888427734375 0.507190625 -0.09112500000000001 -0.22943115234375 0.507190625 -0.09125 -0.238555908203125 0.507190625 -0.09137499999999999 -0.246246337890625 0.507190625 -0.0915 -0.250823974609375 0.507190625 -0.091625 -0.253326416015625 0.507190625 -0.09175000000000001 -0.2530517578125 0.507190625 -0.091875 -0.25042724609375 0.507190625 -0.09199999999999999 -0.244903564453125 0.507190625 -0.092125 -0.237640380859375 0.507190625 -0.09225 -0.22711181640625 0.507190625 -0.09237499999999999 -0.214080810546875 0.507190625 -0.0925 -0.200347900390625 0.507190625 -0.09262499999999999 -0.183013916015625 0.507190625 -0.09275 -0.165679931640625 0.507190625 -0.092875 -0.14471435546875 0.507190625 -0.09299999999999999 -0.12213134765625 0.507190625 -0.093125 -0.100677490234375 0.507190625 -0.09324999999999999 -0.0758056640625 0.507190625 -0.093375 -0.052703857421875 0.507190625 -0.09350000000000001 -0.0264892578125 0.507190625 +0.08975 -0.00531005859375 0.507190625 +0.08987499999999999 -0.03179931640625 0.507190625 +0.09 -0.055328369140625 0.507190625 +0.09012499999999999 -0.080902099609375 0.507190625 +0.09025 -0.1031494140625 0.507190625 +0.090375 -0.126800537109375 0.507190625 +0.09050000000000001 -0.1490478515625 0.507190625 +0.090625 -0.167694091796875 0.507190625 +0.09074999999999999 -0.186676025390625 0.507190625 +0.09087499999999999 -0.201995849609375 0.507190625 +0.091 -0.2169189453125 0.507190625 +0.09112500000000001 -0.229461669921875 0.507190625 +0.09125 -0.23858642578125 0.507190625 +0.09137499999999999 -0.24627685546875 0.507190625 +0.0915 -0.2508544921875 0.507190625 +0.091625 -0.25335693359375 0.507190625 +0.09175000000000001 -0.253082275390625 0.507190625 +0.091875 -0.250457763671875 0.507190625 +0.09199999999999999 -0.24493408203125 0.507190625 +0.092125 -0.2376708984375 0.507190625 +0.09225 -0.227142333984375 0.507190625 +0.09237499999999999 -0.214111328125 0.507190625 +0.0925 -0.20037841796875 0.507190625 +0.09262499999999999 -0.18304443359375 0.507190625 +0.09275 -0.16571044921875 0.507190625 +0.092875 -0.144744873046875 0.507190625 +0.09299999999999999 -0.122161865234375 0.507190625 +0.093125 -0.1007080078125 0.507190625 +0.09324999999999999 -0.075836181640625 0.507190625 +0.093375 -0.052734375 0.507190625 +0.09350000000000001 -0.026519775390625 0.507190625 0.09362500000000001 0.0 0.507190625 0.09375 0.023834228515625 0.507190625 0.09387499999999999 0.05010986328125 0.507190625 @@ -779,37 +779,37 @@ 0.09725 0.069580078125 0.6095875 0.09737500000000001 0.038177490234375 0.6095875 0.0975 0.009552001953125 0.6095875 -0.09762500000000001 -0.022308349609375 0.6095875 -0.09775 -0.050811767578125 0.6095875 -0.097875 -0.081939697265625 0.6095875 -0.09800000000000001 -0.1121826171875 0.6095875 -0.098125 -0.138336181640625 0.6095875 -0.09825000000000001 -0.165985107421875 0.6095875 -0.098375 -0.189300537109375 0.6095875 -0.09850000000000001 -0.213226318359375 0.6095875 -0.09862500000000001 -0.23480224609375 0.6095875 -0.09875 -0.252044677734375 0.6095875 -0.09887499999999999 -0.268585205078125 0.6095875 -0.099 -0.28094482421875 0.6095875 -0.09912500000000001 -0.291748046875 0.6095875 -0.09925000000000001 -0.299346923828125 0.6095875 -0.099375 -0.30340576171875 0.6095875 -0.09950000000000001 -0.30474853515625 0.6095875 -0.099625 -0.303070068359375 0.6095875 -0.09975000000000001 -0.298095703125 0.6095875 -0.09987500000000001 -0.289825439453125 0.6095875 -0.1 -0.279693603515625 0.6095875 -0.100125 -0.2655029296875 0.6095875 -0.10025 -0.250244140625 0.6095875 -0.100375 -0.230682373046875 0.6095875 -0.1005 -0.2086181640625 0.6095875 -0.100625 -0.186767578125 0.6095875 -0.10075 -0.16058349609375 0.6095875 -0.100875 -0.135498046875 0.6095875 -0.101 -0.106201171875 0.6095875 -0.101125 -0.075775146484375 0.6095875 -0.10125 -0.047637939453125 0.6095875 -0.101375 -0.01593017578125 0.6095875 +0.09762500000000001 -0.0223388671875 0.6095875 +0.09775 -0.05084228515625 0.6095875 +0.097875 -0.08197021484375 0.6095875 +0.09800000000000001 -0.112213134765625 0.6095875 +0.098125 -0.13836669921875 0.6095875 +0.09825000000000001 -0.166015625 0.6095875 +0.098375 -0.1893310546875 0.6095875 +0.09850000000000001 -0.2132568359375 0.6095875 +0.09862500000000001 -0.234832763671875 0.6095875 +0.09875 -0.2520751953125 0.6095875 +0.09887499999999999 -0.26861572265625 0.6095875 +0.099 -0.280975341796875 0.6095875 +0.09912500000000001 -0.291778564453125 0.6095875 +0.09925000000000001 -0.29937744140625 0.6095875 +0.099375 -0.303436279296875 0.6095875 +0.09950000000000001 -0.304779052734375 0.6095875 +0.099625 -0.3031005859375 0.6095875 +0.09975000000000001 -0.298126220703125 0.6095875 +0.09987500000000001 -0.28985595703125 0.6095875 +0.1 -0.27972412109375 0.6095875 +0.100125 -0.265533447265625 0.6095875 +0.10025 -0.250274658203125 0.6095875 +0.100375 -0.230712890625 0.6095875 +0.1005 -0.208648681640625 0.6095875 +0.100625 -0.186798095703125 0.6095875 +0.10075 -0.160614013671875 0.6095875 +0.100875 -0.135528564453125 0.6095875 +0.101 -0.106231689453125 0.6095875 +0.101125 -0.0758056640625 0.6095875 +0.10125 -0.04766845703125 0.6095875 +0.101375 -0.015960693359375 0.6095875 0.1015 0.01275634765625 0.6095875 0.101625 0.04449462890625 0.6095875 0.10175 0.075775146484375 0.6095875 @@ -841,37 +841,37 @@ 0.105 0.084991455078125 0.6095875 0.105125 0.053955078125 0.6095875 0.10525 0.025482177734375 0.6095875 -0.105375 -0.006378173828125 0.6095875 -0.1055 -0.038177490234375 0.6095875 -0.105625 -0.06646728515625 0.6095875 -0.10575 -0.097198486328125 0.6095875 -0.105875 -0.123931884765625 0.6095875 -0.106 -0.152374267578125 0.6095875 -0.106125 -0.179107666015625 0.6095875 -0.10625 -0.2015380859375 0.6095875 -0.106375 -0.22430419921875 0.6095875 -0.1065 -0.24273681640625 0.6095875 -0.106625 -0.26068115234375 0.6095875 -0.10675 -0.2757568359375 0.6095875 -0.106875 -0.2867431640625 0.6095875 -0.107 -0.29595947265625 0.6095875 -0.107125 -0.301483154296875 0.6095875 -0.10725 -0.304473876953125 0.6095875 -0.107375 -0.30413818359375 0.6095875 -0.1075 -0.300994873046875 0.6095875 -0.107625 -0.29437255859375 0.6095875 -0.10775 -0.28564453125 0.6095875 -0.107875 -0.27294921875 0.6095875 -0.108 -0.25732421875 0.6095875 -0.108125 -0.240814208984375 0.6095875 -0.10825 -0.219940185546875 0.6095875 -0.108375 -0.199127197265625 0.6095875 -0.1085 -0.173919677734375 0.6095875 -0.108625 -0.14678955078125 0.6095875 -0.10875 -0.12103271484375 0.6095875 -0.108875 -0.09112548828125 0.6095875 -0.109 -0.0633544921875 0.6095875 -0.109125 -0.031829833984375 0.6095875 +0.105375 -0.00640869140625 0.6095875 +0.1055 -0.0382080078125 0.6095875 +0.105625 -0.066497802734375 0.6095875 +0.10575 -0.09722900390625 0.6095875 +0.105875 -0.12396240234375 0.6095875 +0.106 -0.15240478515625 0.6095875 +0.106125 -0.17913818359375 0.6095875 +0.10625 -0.201568603515625 0.6095875 +0.106375 -0.224334716796875 0.6095875 +0.1065 -0.242767333984375 0.6095875 +0.106625 -0.260711669921875 0.6095875 +0.10675 -0.275787353515625 0.6095875 +0.106875 -0.286773681640625 0.6095875 +0.107 -0.295989990234375 0.6095875 +0.107125 -0.301513671875 0.6095875 +0.10725 -0.30450439453125 0.6095875 +0.107375 -0.304168701171875 0.6095875 +0.1075 -0.301025390625 0.6095875 +0.107625 -0.294403076171875 0.6095875 +0.10775 -0.285675048828125 0.6095875 +0.107875 -0.272979736328125 0.6095875 +0.108 -0.257354736328125 0.6095875 +0.108125 -0.2408447265625 0.6095875 +0.10825 -0.219970703125 0.6095875 +0.108375 -0.19915771484375 0.6095875 +0.1085 -0.1739501953125 0.6095875 +0.108625 -0.146820068359375 0.6095875 +0.10875 -0.121063232421875 0.6095875 +0.108875 -0.091156005859375 0.6095875 +0.109 -0.063385009765625 0.6095875 +0.109125 -0.0318603515625 0.6095875 0.10925 0.0 0.6095875 0.109375 0.028656005859375 0.6095875 0.1095 0.060211181640625 0.6095875 @@ -904,37 +904,37 @@ 0.112875 0.069580078125 0.6095875 0.113 0.038177490234375 0.6095875 0.113125 0.009552001953125 0.6095875 -0.11325 -0.022308349609375 0.6095875 -0.113375 -0.050811767578125 0.6095875 -0.1135 -0.081939697265625 0.6095875 -0.113625 -0.1121826171875 0.6095875 -0.11375 -0.138336181640625 0.6095875 -0.113875 -0.165985107421875 0.6095875 -0.114 -0.189300537109375 0.6095875 -0.114125 -0.213226318359375 0.6095875 -0.11425 -0.23480224609375 0.6095875 -0.114375 -0.252044677734375 0.6095875 -0.1145 -0.268585205078125 0.6095875 -0.114625 -0.28094482421875 0.6095875 -0.11475 -0.291748046875 0.6095875 -0.114875 -0.299346923828125 0.6095875 -0.115 -0.30340576171875 0.6095875 -0.115125 -0.30474853515625 0.6095875 -0.11525 -0.303070068359375 0.6095875 -0.115375 -0.298095703125 0.6095875 -0.1155 -0.289825439453125 0.6095875 -0.115625 -0.279693603515625 0.6095875 -0.11575 -0.2655029296875 0.6095875 -0.115875 -0.250244140625 0.6095875 -0.116 -0.230682373046875 0.6095875 -0.116125 -0.2086181640625 0.6095875 -0.11625 -0.186767578125 0.6095875 -0.116375 -0.16058349609375 0.6095875 -0.1165 -0.135498046875 0.6095875 -0.116625 -0.106201171875 0.6095875 -0.11675 -0.075775146484375 0.6095875 -0.116875 -0.047637939453125 0.6095875 -0.117 -0.01593017578125 0.6095875 +0.11325 -0.0223388671875 0.6095875 +0.113375 -0.05084228515625 0.6095875 +0.1135 -0.08197021484375 0.6095875 +0.113625 -0.112213134765625 0.6095875 +0.11375 -0.13836669921875 0.6095875 +0.113875 -0.166015625 0.6095875 +0.114 -0.1893310546875 0.6095875 +0.114125 -0.2132568359375 0.6095875 +0.11425 -0.234832763671875 0.6095875 +0.114375 -0.2520751953125 0.6095875 +0.1145 -0.26861572265625 0.6095875 +0.114625 -0.280975341796875 0.6095875 +0.11475 -0.291778564453125 0.6095875 +0.114875 -0.29937744140625 0.6095875 +0.115 -0.303436279296875 0.6095875 +0.115125 -0.304779052734375 0.6095875 +0.11525 -0.3031005859375 0.6095875 +0.115375 -0.298126220703125 0.6095875 +0.1155 -0.28985595703125 0.6095875 +0.115625 -0.27972412109375 0.6095875 +0.11575 -0.265533447265625 0.6095875 +0.115875 -0.250274658203125 0.6095875 +0.116 -0.230712890625 0.6095875 +0.116125 -0.208648681640625 0.6095875 +0.11625 -0.186798095703125 0.6095875 +0.116375 -0.160614013671875 0.6095875 +0.1165 -0.135528564453125 0.6095875 +0.116625 -0.106231689453125 0.6095875 +0.11675 -0.0758056640625 0.6095875 +0.116875 -0.04766845703125 0.6095875 +0.117 -0.015960693359375 0.6095875 0.117125 0.01275634765625 0.6095875 0.11725 0.04449462890625 0.6095875 0.117375 0.075775146484375 0.6095875 @@ -966,37 +966,37 @@ 0.120625 0.084991455078125 0.6095875 0.12075 0.053955078125 0.6095875 0.120875 0.025482177734375 0.6095875 -0.121 -0.006378173828125 0.6095875 -0.121125 -0.038177490234375 0.6095875 -0.12125 -0.06646728515625 0.6095875 -0.121375 -0.097198486328125 0.6095875 -0.1215 -0.123931884765625 0.6095875 -0.121625 -0.152374267578125 0.6095875 -0.12175 -0.179107666015625 0.6095875 -0.121875 -0.2015380859375 0.6095875 -0.122 -0.22430419921875 0.6095875 -0.122125 -0.24273681640625 0.6095875 -0.12225 -0.26068115234375 0.6095875 -0.122375 -0.2757568359375 0.6095875 -0.1225 -0.2867431640625 0.6095875 -0.122625 -0.29595947265625 0.6095875 -0.12275 -0.301483154296875 0.6095875 -0.122875 -0.304473876953125 0.6095875 -0.123 -0.30413818359375 0.6095875 -0.123125 -0.300994873046875 0.6095875 -0.12325 -0.29437255859375 0.6095875 -0.123375 -0.28564453125 0.6095875 -0.1235 -0.27294921875 0.6095875 -0.123625 -0.25732421875 0.6095875 -0.12375 -0.240814208984375 0.6095875 -0.123875 -0.219940185546875 0.6095875 -0.124 -0.199127197265625 0.6095875 -0.124125 -0.173919677734375 0.6095875 -0.12425 -0.14678955078125 0.6095875 -0.124375 -0.12103271484375 0.6095875 -0.1245 -0.09112548828125 0.6095875 -0.124625 -0.0633544921875 0.6095875 -0.12475 -0.031829833984375 0.6095875 +0.121 -0.00640869140625 0.6095875 +0.121125 -0.0382080078125 0.6095875 +0.12125 -0.066497802734375 0.6095875 +0.121375 -0.09722900390625 0.6095875 +0.1215 -0.12396240234375 0.6095875 +0.121625 -0.15240478515625 0.6095875 +0.12175 -0.17913818359375 0.6095875 +0.121875 -0.201568603515625 0.6095875 +0.122 -0.224334716796875 0.6095875 +0.122125 -0.242767333984375 0.6095875 +0.12225 -0.260711669921875 0.6095875 +0.122375 -0.275787353515625 0.6095875 +0.1225 -0.286773681640625 0.6095875 +0.122625 -0.295989990234375 0.6095875 +0.12275 -0.301513671875 0.6095875 +0.122875 -0.30450439453125 0.6095875 +0.123 -0.304168701171875 0.6095875 +0.123125 -0.301025390625 0.6095875 +0.12325 -0.294403076171875 0.6095875 +0.123375 -0.285675048828125 0.6095875 +0.1235 -0.272979736328125 0.6095875 +0.123625 -0.257354736328125 0.6095875 +0.12375 -0.2408447265625 0.6095875 +0.123875 -0.219970703125 0.6095875 +0.124 -0.19915771484375 0.6095875 +0.124125 -0.1739501953125 0.6095875 +0.12425 -0.146820068359375 0.6095875 +0.124375 -0.121063232421875 0.6095875 +0.1245 -0.091156005859375 0.6095875 +0.124625 -0.063385009765625 0.6095875 +0.12475 -0.0318603515625 0.6095875 0.124875 0.0 0.6095875 0.125 0.028656005859375 0.6095875 0.125125 0.060211181640625 0.6095875 @@ -1029,37 +1029,37 @@ 0.1285 0.081268310546875 0.7119843750000001 0.128625 0.044586181640625 0.7119843750000001 0.12875 0.01116943359375 0.7119843750000001 -0.128875 -0.026031494140625 0.7119843750000001 -0.129 -0.059356689453125 0.7119843750000001 -0.129125 -0.095703125 0.7119843750000001 -0.12925 -0.131011962890625 0.7119843750000001 -0.129375 -0.161590576171875 0.7119843750000001 -0.1295 -0.19384765625 0.7119843750000001 -0.129625 -0.221099853515625 0.7119843750000001 -0.12975 -0.2490234375 0.7119843750000001 -0.129875 -0.274261474609375 0.7119843750000001 -0.13 -0.29437255859375 0.7119843750000001 -0.130125 -0.313690185546875 0.7119843750000001 -0.13025 -0.328125 0.7119843750000001 -0.130375 -0.34075927734375 0.7119843750000001 -0.1305 -0.349639892578125 0.7119843750000001 -0.130625 -0.3543701171875 0.7119843750000001 -0.13075 -0.355926513671875 0.7119843750000001 -0.130875 -0.35400390625 0.7119843750000001 -0.131 -0.34814453125 0.7119843750000001 -0.131125 -0.338531494140625 0.7119843750000001 -0.13125 -0.32666015625 0.7119843750000001 -0.131375 -0.310089111328125 0.7119843750000001 -0.1315 -0.292266845703125 0.7119843750000001 -0.131625 -0.269439697265625 0.7119843750000001 -0.13175 -0.24365234375 0.7119843750000001 -0.131875 -0.2181396484375 0.7119843750000001 -0.132 -0.18756103515625 0.7119843750000001 -0.132125 -0.15826416015625 0.7119843750000001 -0.13225 -0.124053955078125 0.7119843750000001 -0.132375 -0.0885009765625 0.7119843750000001 -0.1325 -0.0556640625 0.7119843750000001 -0.132625 -0.01861572265625 0.7119843750000001 +0.128875 -0.02606201171875 0.7119843750000001 +0.129 -0.05938720703125 0.7119843750000001 +0.129125 -0.095733642578125 0.7119843750000001 +0.12925 -0.13104248046875 0.7119843750000001 +0.129375 -0.16162109375 0.7119843750000001 +0.1295 -0.193878173828125 0.7119843750000001 +0.129625 -0.22113037109375 0.7119843750000001 +0.12975 -0.249053955078125 0.7119843750000001 +0.129875 -0.2742919921875 0.7119843750000001 +0.13 -0.294403076171875 0.7119843750000001 +0.130125 -0.313720703125 0.7119843750000001 +0.13025 -0.328155517578125 0.7119843750000001 +0.130375 -0.340789794921875 0.7119843750000001 +0.1305 -0.34967041015625 0.7119843750000001 +0.130625 -0.354400634765625 0.7119843750000001 +0.13075 -0.35595703125 0.7119843750000001 +0.130875 -0.354034423828125 0.7119843750000001 +0.131 -0.348175048828125 0.7119843750000001 +0.131125 -0.33856201171875 0.7119843750000001 +0.13125 -0.326690673828125 0.7119843750000001 +0.131375 -0.31011962890625 0.7119843750000001 +0.1315 -0.29229736328125 0.7119843750000001 +0.131625 -0.26947021484375 0.7119843750000001 +0.13175 -0.243682861328125 0.7119843750000001 +0.131875 -0.218170166015625 0.7119843750000001 +0.132 -0.187591552734375 0.7119843750000001 +0.132125 -0.158294677734375 0.7119843750000001 +0.13225 -0.12408447265625 0.7119843750000001 +0.132375 -0.088531494140625 0.7119843750000001 +0.1325 -0.055694580078125 0.7119843750000001 +0.132625 -0.018646240234375 0.7119843750000001 0.13275 0.014892578125 0.7119843750000001 0.132875 0.051971435546875 0.7119843750000001 0.133 0.0885009765625 0.7119843750000001 @@ -1091,37 +1091,37 @@ 0.13625 0.099273681640625 0.7119843750000001 0.136375 0.063018798828125 0.7119843750000001 0.1365 0.029754638671875 0.7119843750000001 -0.136625 -0.0074462890625 0.7119843750000001 -0.13675 -0.044586181640625 0.7119843750000001 -0.136875 -0.07763671875 0.7119843750000001 -0.137 -0.113525390625 0.7119843750000001 -0.137125 -0.144775390625 0.7119843750000001 -0.13725 -0.177947998046875 0.7119843750000001 -0.137375 -0.209197998046875 0.7119843750000001 -0.1375 -0.235382080078125 0.7119843750000001 -0.137625 -0.261993408203125 0.7119843750000001 -0.13775 -0.28350830078125 0.7119843750000001 -0.137875 -0.304443359375 0.7119843750000001 -0.138 -0.322052001953125 0.7119843750000001 -0.138125 -0.33489990234375 0.7119843750000001 -0.13825 -0.345672607421875 0.7119843750000001 -0.138375 -0.35211181640625 0.7119843750000001 -0.1385 -0.355621337890625 0.7119843750000001 -0.138625 -0.355255126953125 0.7119843750000001 -0.13875 -0.3515625 0.7119843750000001 -0.138875 -0.34381103515625 0.7119843750000001 -0.139 -0.3336181640625 0.7119843750000001 -0.139125 -0.318817138671875 0.7119843750000001 -0.13925 -0.300537109375 0.7119843750000001 -0.139375 -0.28125 0.7119843750000001 -0.1395 -0.25689697265625 0.7119843750000001 -0.139625 -0.232574462890625 0.7119843750000001 -0.13975 -0.203125 0.7119843750000001 -0.139875 -0.171478271484375 0.7119843750000001 -0.14 -0.141357421875 0.7119843750000001 -0.140125 -0.106414794921875 0.7119843750000001 -0.14025 -0.073974609375 0.7119843750000001 -0.140375 -0.037200927734375 0.7119843750000001 +0.136625 -0.007476806640625 0.7119843750000001 +0.13675 -0.04461669921875 0.7119843750000001 +0.136875 -0.077667236328125 0.7119843750000001 +0.137 -0.113555908203125 0.7119843750000001 +0.137125 -0.144805908203125 0.7119843750000001 +0.13725 -0.177978515625 0.7119843750000001 +0.137375 -0.209228515625 0.7119843750000001 +0.1375 -0.23541259765625 0.7119843750000001 +0.137625 -0.26202392578125 0.7119843750000001 +0.13775 -0.283538818359375 0.7119843750000001 +0.137875 -0.304473876953125 0.7119843750000001 +0.138 -0.32208251953125 0.7119843750000001 +0.138125 -0.334930419921875 0.7119843750000001 +0.13825 -0.345703125 0.7119843750000001 +0.138375 -0.352142333984375 0.7119843750000001 +0.1385 -0.35565185546875 0.7119843750000001 +0.138625 -0.35528564453125 0.7119843750000001 +0.13875 -0.351593017578125 0.7119843750000001 +0.138875 -0.343841552734375 0.7119843750000001 +0.139 -0.333648681640625 0.7119843750000001 +0.139125 -0.31884765625 0.7119843750000001 +0.13925 -0.300567626953125 0.7119843750000001 +0.139375 -0.281280517578125 0.7119843750000001 +0.1395 -0.256927490234375 0.7119843750000001 +0.139625 -0.23260498046875 0.7119843750000001 +0.13975 -0.203155517578125 0.7119843750000001 +0.139875 -0.1715087890625 0.7119843750000001 +0.14 -0.141387939453125 0.7119843750000001 +0.140125 -0.1064453125 0.7119843750000001 +0.14025 -0.074005126953125 0.7119843750000001 +0.140375 -0.0372314453125 0.7119843750000001 0.1405 0.0 0.7119843750000001 0.140625 0.033477783203125 0.7119843750000001 0.14075 0.070343017578125 0.7119843750000001 @@ -1154,37 +1154,37 @@ 0.144125 0.081268310546875 0.7119843750000001 0.14425 0.044586181640625 0.7119843750000001 0.144375 0.01116943359375 0.7119843750000001 -0.1445 -0.026031494140625 0.7119843750000001 -0.144625 -0.059356689453125 0.7119843750000001 -0.14475 -0.095703125 0.7119843750000001 -0.144875 -0.131011962890625 0.7119843750000001 -0.145 -0.161590576171875 0.7119843750000001 -0.145125 -0.19384765625 0.7119843750000001 -0.14525 -0.221099853515625 0.7119843750000001 -0.145375 -0.2490234375 0.7119843750000001 -0.1455 -0.274261474609375 0.7119843750000001 -0.145625 -0.29437255859375 0.7119843750000001 -0.14575 -0.313690185546875 0.7119843750000001 -0.145875 -0.328125 0.7119843750000001 -0.146 -0.34075927734375 0.7119843750000001 -0.146125 -0.349639892578125 0.7119843750000001 -0.14625 -0.3543701171875 0.7119843750000001 -0.146375 -0.355926513671875 0.7119843750000001 -0.1465 -0.35400390625 0.7119843750000001 -0.146625 -0.34814453125 0.7119843750000001 -0.14675 -0.338531494140625 0.7119843750000001 -0.146875 -0.32666015625 0.7119843750000001 -0.147 -0.310089111328125 0.7119843750000001 -0.147125 -0.292266845703125 0.7119843750000001 -0.14725 -0.269439697265625 0.7119843750000001 -0.147375 -0.24365234375 0.7119843750000001 -0.1475 -0.2181396484375 0.7119843750000001 -0.147625 -0.18756103515625 0.7119843750000001 -0.14775 -0.15826416015625 0.7119843750000001 -0.147875 -0.124053955078125 0.7119843750000001 -0.148 -0.0885009765625 0.7119843750000001 -0.148125 -0.0556640625 0.7119843750000001 -0.14825 -0.01861572265625 0.7119843750000001 +0.1445 -0.02606201171875 0.7119843750000001 +0.144625 -0.05938720703125 0.7119843750000001 +0.14475 -0.095733642578125 0.7119843750000001 +0.144875 -0.13104248046875 0.7119843750000001 +0.145 -0.16162109375 0.7119843750000001 +0.145125 -0.193878173828125 0.7119843750000001 +0.14525 -0.22113037109375 0.7119843750000001 +0.145375 -0.249053955078125 0.7119843750000001 +0.1455 -0.2742919921875 0.7119843750000001 +0.145625 -0.294403076171875 0.7119843750000001 +0.14575 -0.313720703125 0.7119843750000001 +0.145875 -0.328155517578125 0.7119843750000001 +0.146 -0.340789794921875 0.7119843750000001 +0.146125 -0.34967041015625 0.7119843750000001 +0.14625 -0.354400634765625 0.7119843750000001 +0.146375 -0.35595703125 0.7119843750000001 +0.1465 -0.354034423828125 0.7119843750000001 +0.146625 -0.348175048828125 0.7119843750000001 +0.14675 -0.33856201171875 0.7119843750000001 +0.146875 -0.326690673828125 0.7119843750000001 +0.147 -0.31011962890625 0.7119843750000001 +0.147125 -0.29229736328125 0.7119843750000001 +0.14725 -0.26947021484375 0.7119843750000001 +0.147375 -0.243682861328125 0.7119843750000001 +0.1475 -0.218170166015625 0.7119843750000001 +0.147625 -0.187591552734375 0.7119843750000001 +0.14775 -0.158294677734375 0.7119843750000001 +0.147875 -0.12408447265625 0.7119843750000001 +0.148 -0.088531494140625 0.7119843750000001 +0.148125 -0.055694580078125 0.7119843750000001 +0.14825 -0.018646240234375 0.7119843750000001 0.148375 0.014892578125 0.7119843750000001 0.1485 0.051971435546875 0.7119843750000001 0.148625 0.0885009765625 0.7119843750000001 @@ -1216,37 +1216,37 @@ 0.151875 0.099273681640625 0.7119843750000001 0.152 0.063018798828125 0.7119843750000001 0.152125 0.029754638671875 0.7119843750000001 -0.15225 -0.0074462890625 0.7119843750000001 -0.152375 -0.044586181640625 0.7119843750000001 -0.1525 -0.07763671875 0.7119843750000001 -0.152625 -0.113525390625 0.7119843750000001 -0.15275 -0.144775390625 0.7119843750000001 -0.152875 -0.177947998046875 0.7119843750000001 -0.153 -0.209197998046875 0.7119843750000001 -0.153125 -0.235382080078125 0.7119843750000001 -0.15325 -0.261993408203125 0.7119843750000001 -0.153375 -0.28350830078125 0.7119843750000001 -0.1535 -0.304443359375 0.7119843750000001 -0.153625 -0.322052001953125 0.7119843750000001 -0.15375 -0.33489990234375 0.7119843750000001 -0.153875 -0.345672607421875 0.7119843750000001 -0.154 -0.35211181640625 0.7119843750000001 -0.154125 -0.355621337890625 0.7119843750000001 -0.15425 -0.355255126953125 0.7119843750000001 -0.154375 -0.3515625 0.7119843750000001 -0.1545 -0.34381103515625 0.7119843750000001 -0.154625 -0.3336181640625 0.7119843750000001 -0.15475 -0.318817138671875 0.7119843750000001 -0.154875 -0.300537109375 0.7119843750000001 -0.155 -0.28125 0.7119843750000001 -0.155125 -0.25689697265625 0.7119843750000001 -0.15525 -0.232574462890625 0.7119843750000001 -0.155375 -0.203125 0.7119843750000001 -0.1555 -0.171478271484375 0.7119843750000001 -0.155625 -0.141357421875 0.7119843750000001 -0.15575 -0.106414794921875 0.7119843750000001 -0.155875 -0.073974609375 0.7119843750000001 -0.156 -0.037200927734375 0.7119843750000001 +0.15225 -0.007476806640625 0.7119843750000001 +0.152375 -0.04461669921875 0.7119843750000001 +0.1525 -0.077667236328125 0.7119843750000001 +0.152625 -0.113555908203125 0.7119843750000001 +0.15275 -0.144805908203125 0.7119843750000001 +0.152875 -0.177978515625 0.7119843750000001 +0.153 -0.209228515625 0.7119843750000001 +0.153125 -0.23541259765625 0.7119843750000001 +0.15325 -0.26202392578125 0.7119843750000001 +0.153375 -0.283538818359375 0.7119843750000001 +0.1535 -0.304473876953125 0.7119843750000001 +0.153625 -0.32208251953125 0.7119843750000001 +0.15375 -0.334930419921875 0.7119843750000001 +0.153875 -0.345703125 0.7119843750000001 +0.154 -0.352142333984375 0.7119843750000001 +0.154125 -0.35565185546875 0.7119843750000001 +0.15425 -0.35528564453125 0.7119843750000001 +0.154375 -0.351593017578125 0.7119843750000001 +0.1545 -0.343841552734375 0.7119843750000001 +0.154625 -0.333648681640625 0.7119843750000001 +0.15475 -0.31884765625 0.7119843750000001 +0.154875 -0.300567626953125 0.7119843750000001 +0.155 -0.281280517578125 0.7119843750000001 +0.155125 -0.256927490234375 0.7119843750000001 +0.15525 -0.23260498046875 0.7119843750000001 +0.155375 -0.203155517578125 0.7119843750000001 +0.1555 -0.1715087890625 0.7119843750000001 +0.155625 -0.141387939453125 0.7119843750000001 +0.15575 -0.1064453125 0.7119843750000001 +0.155875 -0.074005126953125 0.7119843750000001 +0.156 -0.0372314453125 0.7119843750000001 0.156125 0.0 0.7119843750000001 0.15625 0.033477783203125 0.7119843750000001 0.156375 0.070343017578125 0.7119843750000001 @@ -1279,37 +1279,37 @@ 0.15975 0.081268310546875 0.7119843750000001 0.159875 0.044586181640625 0.7119843750000001 0.16 0.01275634765625 0.8143812500000001 -0.160125 -0.02978515625 0.8143812500000001 -0.16025 -0.06787109375 0.8143812500000001 -0.160375 -0.109466552734375 0.8143812500000001 -0.1605 -0.149871826171875 0.8143812500000001 -0.160625 -0.184814453125 0.8143812500000001 -0.16075 -0.22174072265625 0.8143812500000001 -0.160875 -0.252899169921875 0.8143812500000001 -0.161 -0.28485107421875 0.8143812500000001 -0.161125 -0.313720703125 0.8143812500000001 -0.16125 -0.33673095703125 0.8143812500000001 -0.161375 -0.35882568359375 0.8143812500000001 -0.1615 -0.375335693359375 0.8143812500000001 -0.161625 -0.3897705078125 0.8143812500000001 -0.16175 -0.399932861328125 0.8143812500000001 -0.161875 -0.40533447265625 0.8143812500000001 -0.162 -0.407135009765625 0.8143812500000001 -0.162125 -0.4049072265625 0.8143812500000001 -0.16225 -0.39825439453125 0.8143812500000001 -0.162375 -0.38720703125 0.8143812500000001 -0.1625 -0.3736572265625 0.8143812500000001 -0.162625 -0.354705810546875 0.8143812500000001 -0.16275 -0.334320068359375 0.8143812500000001 -0.162875 -0.308197021484375 0.8143812500000001 -0.163 -0.278717041015625 0.8143812500000001 -0.163125 -0.249542236328125 0.8143812500000001 -0.16325 -0.21453857421875 0.8143812500000001 -0.163375 -0.1810302734375 0.8143812500000001 -0.1635 -0.14190673828125 0.8143812500000001 -0.163625 -0.101226806640625 0.8143812500000001 -0.16375 -0.06365966796875 0.8143812500000001 -0.163875 -0.021270751953125 0.8143812500000001 +0.160125 -0.029815673828125 0.8143812500000001 +0.16025 -0.067901611328125 0.8143812500000001 +0.160375 -0.1094970703125 0.8143812500000001 +0.1605 -0.14990234375 0.8143812500000001 +0.160625 -0.184844970703125 0.8143812500000001 +0.16075 -0.221771240234375 0.8143812500000001 +0.160875 -0.2529296875 0.8143812500000001 +0.161 -0.284881591796875 0.8143812500000001 +0.161125 -0.313751220703125 0.8143812500000001 +0.16125 -0.336761474609375 0.8143812500000001 +0.161375 -0.358856201171875 0.8143812500000001 +0.1615 -0.3753662109375 0.8143812500000001 +0.161625 -0.389801025390625 0.8143812500000001 +0.16175 -0.39996337890625 0.8143812500000001 +0.161875 -0.405364990234375 0.8143812500000001 +0.162 -0.40716552734375 0.8143812500000001 +0.162125 -0.404937744140625 0.8143812500000001 +0.16225 -0.398284912109375 0.8143812500000001 +0.162375 -0.387237548828125 0.8143812500000001 +0.1625 -0.373687744140625 0.8143812500000001 +0.162625 -0.354736328125 0.8143812500000001 +0.16275 -0.3343505859375 0.8143812500000001 +0.162875 -0.3082275390625 0.8143812500000001 +0.163 -0.27874755859375 0.8143812500000001 +0.163125 -0.24957275390625 0.8143812500000001 +0.16325 -0.214569091796875 0.8143812500000001 +0.163375 -0.181060791015625 0.8143812500000001 +0.1635 -0.141937255859375 0.8143812500000001 +0.163625 -0.10125732421875 0.8143812500000001 +0.16375 -0.063690185546875 0.8143812500000001 +0.163875 -0.02130126953125 0.8143812500000001 0.164 0.01702880859375 0.8143812500000001 0.164125 0.0594482421875 0.8143812500000001 0.16425 0.101226806640625 0.8143812500000001 @@ -1341,37 +1341,37 @@ 0.1675 0.11358642578125 0.8143812500000001 0.167625 0.07208251953125 0.8143812500000001 0.16775 0.0340576171875 0.8143812500000001 -0.167875 -0.008514404296875 0.8143812500000001 -0.168 -0.050994873046875 0.8143812500000001 -0.168125 -0.08880615234375 0.8143812500000001 -0.16825 -0.129852294921875 0.8143812500000001 -0.168375 -0.16558837890625 0.8143812500000001 -0.1685 -0.20355224609375 0.8143812500000001 -0.168625 -0.239288330078125 0.8143812500000001 -0.16875 -0.269256591796875 0.8143812500000001 -0.168875 -0.2996826171875 0.8143812500000001 -0.169 -0.324310302734375 0.8143812500000001 -0.169125 -0.3482666015625 0.8143812500000001 -0.16925 -0.368408203125 0.8143812500000001 -0.169375 -0.383056640625 0.8143812500000001 -0.1695 -0.3953857421875 0.8143812500000001 -0.169625 -0.40277099609375 0.8143812500000001 -0.16975 -0.40679931640625 0.8143812500000001 -0.169875 -0.406341552734375 0.8143812500000001 -0.17 -0.402130126953125 0.8143812500000001 -0.170125 -0.393280029296875 0.8143812500000001 -0.17025 -0.381591796875 0.8143812500000001 -0.170375 -0.36468505859375 0.8143812500000001 -0.1705 -0.343780517578125 0.8143812500000001 -0.170625 -0.32171630859375 0.8143812500000001 -0.17075 -0.293853759765625 0.8143812500000001 -0.170875 -0.266021728515625 0.8143812500000001 -0.171 -0.23236083984375 0.8143812500000001 -0.171125 -0.196136474609375 0.8143812500000001 -0.17125 -0.16168212890625 0.8143812500000001 -0.171375 -0.121734619140625 0.8143812500000001 -0.1715 -0.084625244140625 0.8143812500000001 -0.171625 -0.04254150390625 0.8143812500000001 +0.167875 -0.008544921875 0.8143812500000001 +0.168 -0.051025390625 0.8143812500000001 +0.168125 -0.088836669921875 0.8143812500000001 +0.16825 -0.1298828125 0.8143812500000001 +0.168375 -0.165618896484375 0.8143812500000001 +0.1685 -0.203582763671875 0.8143812500000001 +0.168625 -0.23931884765625 0.8143812500000001 +0.16875 -0.269287109375 0.8143812500000001 +0.168875 -0.299713134765625 0.8143812500000001 +0.169 -0.3243408203125 0.8143812500000001 +0.169125 -0.348297119140625 0.8143812500000001 +0.16925 -0.368438720703125 0.8143812500000001 +0.169375 -0.383087158203125 0.8143812500000001 +0.1695 -0.395416259765625 0.8143812500000001 +0.169625 -0.402801513671875 0.8143812500000001 +0.16975 -0.406829833984375 0.8143812500000001 +0.169875 -0.4063720703125 0.8143812500000001 +0.17 -0.40216064453125 0.8143812500000001 +0.170125 -0.393310546875 0.8143812500000001 +0.17025 -0.381622314453125 0.8143812500000001 +0.170375 -0.364715576171875 0.8143812500000001 +0.1705 -0.34381103515625 0.8143812500000001 +0.170625 -0.321746826171875 0.8143812500000001 +0.17075 -0.29388427734375 0.8143812500000001 +0.170875 -0.26605224609375 0.8143812500000001 +0.171 -0.232391357421875 0.8143812500000001 +0.171125 -0.1961669921875 0.8143812500000001 +0.17125 -0.161712646484375 0.8143812500000001 +0.171375 -0.12176513671875 0.8143812500000001 +0.1715 -0.08465576171875 0.8143812500000001 +0.171625 -0.042572021484375 0.8143812500000001 0.17175 0.0 0.8143812500000001 0.171875 0.038299560546875 0.8143812500000001 0.172 0.0804443359375 0.8143812500000001 @@ -1404,37 +1404,37 @@ 0.175375 0.09295654296875 0.8143812500000001 0.1755 0.050994873046875 0.8143812500000001 0.175625 0.01275634765625 0.8143812500000001 -0.17575 -0.02978515625 0.8143812500000001 -0.175875 -0.06787109375 0.8143812500000001 -0.176 -0.109466552734375 0.8143812500000001 -0.176125 -0.149871826171875 0.8143812500000001 -0.17625 -0.184814453125 0.8143812500000001 -0.176375 -0.22174072265625 0.8143812500000001 -0.1765 -0.252899169921875 0.8143812500000001 -0.176625 -0.28485107421875 0.8143812500000001 -0.17675 -0.313720703125 0.8143812500000001 -0.176875 -0.33673095703125 0.8143812500000001 -0.177 -0.35882568359375 0.8143812500000001 -0.177125 -0.375335693359375 0.8143812500000001 -0.17725 -0.3897705078125 0.8143812500000001 -0.177375 -0.399932861328125 0.8143812500000001 -0.1775 -0.40533447265625 0.8143812500000001 -0.177625 -0.407135009765625 0.8143812500000001 -0.17775 -0.4049072265625 0.8143812500000001 -0.177875 -0.39825439453125 0.8143812500000001 -0.178 -0.38720703125 0.8143812500000001 -0.178125 -0.3736572265625 0.8143812500000001 -0.17825 -0.354705810546875 0.8143812500000001 -0.178375 -0.334320068359375 0.8143812500000001 -0.1785 -0.308197021484375 0.8143812500000001 -0.178625 -0.278717041015625 0.8143812500000001 -0.17875 -0.249542236328125 0.8143812500000001 -0.178875 -0.21453857421875 0.8143812500000001 -0.179 -0.1810302734375 0.8143812500000001 -0.179125 -0.14190673828125 0.8143812500000001 -0.17925 -0.101226806640625 0.8143812500000001 -0.179375 -0.06365966796875 0.8143812500000001 -0.1795 -0.021270751953125 0.8143812500000001 +0.17575 -0.029815673828125 0.8143812500000001 +0.175875 -0.067901611328125 0.8143812500000001 +0.176 -0.1094970703125 0.8143812500000001 +0.176125 -0.14990234375 0.8143812500000001 +0.17625 -0.184844970703125 0.8143812500000001 +0.176375 -0.221771240234375 0.8143812500000001 +0.1765 -0.2529296875 0.8143812500000001 +0.176625 -0.284881591796875 0.8143812500000001 +0.17675 -0.313751220703125 0.8143812500000001 +0.176875 -0.336761474609375 0.8143812500000001 +0.177 -0.358856201171875 0.8143812500000001 +0.177125 -0.3753662109375 0.8143812500000001 +0.17725 -0.389801025390625 0.8143812500000001 +0.177375 -0.39996337890625 0.8143812500000001 +0.1775 -0.405364990234375 0.8143812500000001 +0.177625 -0.40716552734375 0.8143812500000001 +0.17775 -0.404937744140625 0.8143812500000001 +0.177875 -0.398284912109375 0.8143812500000001 +0.178 -0.387237548828125 0.8143812500000001 +0.178125 -0.373687744140625 0.8143812500000001 +0.17825 -0.354736328125 0.8143812500000001 +0.178375 -0.3343505859375 0.8143812500000001 +0.1785 -0.3082275390625 0.8143812500000001 +0.178625 -0.27874755859375 0.8143812500000001 +0.17875 -0.24957275390625 0.8143812500000001 +0.178875 -0.214569091796875 0.8143812500000001 +0.179 -0.181060791015625 0.8143812500000001 +0.179125 -0.141937255859375 0.8143812500000001 +0.17925 -0.10125732421875 0.8143812500000001 +0.179375 -0.063690185546875 0.8143812500000001 +0.1795 -0.02130126953125 0.8143812500000001 0.179625 0.01702880859375 0.8143812500000001 0.17975 0.0594482421875 0.8143812500000001 0.179875 0.101226806640625 0.8143812500000001 @@ -1466,37 +1466,37 @@ 0.183125 0.11358642578125 0.8143812500000001 0.18325 0.07208251953125 0.8143812500000001 0.183375 0.0340576171875 0.8143812500000001 -0.1835 -0.008514404296875 0.8143812500000001 -0.183625 -0.050994873046875 0.8143812500000001 -0.18375 -0.08880615234375 0.8143812500000001 -0.183875 -0.129852294921875 0.8143812500000001 -0.184 -0.16558837890625 0.8143812500000001 -0.184125 -0.20355224609375 0.8143812500000001 -0.18425 -0.239288330078125 0.8143812500000001 -0.184375 -0.269256591796875 0.8143812500000001 -0.1845 -0.2996826171875 0.8143812500000001 -0.184625 -0.324310302734375 0.8143812500000001 -0.18475 -0.3482666015625 0.8143812500000001 -0.184875 -0.368408203125 0.8143812500000001 -0.185 -0.383056640625 0.8143812500000001 -0.185125 -0.3953857421875 0.8143812500000001 -0.18525 -0.40277099609375 0.8143812500000001 -0.185375 -0.40679931640625 0.8143812500000001 -0.1855 -0.406341552734375 0.8143812500000001 -0.185625 -0.402130126953125 0.8143812500000001 -0.18575 -0.393280029296875 0.8143812500000001 -0.185875 -0.381591796875 0.8143812500000001 -0.186 -0.36468505859375 0.8143812500000001 -0.186125 -0.343780517578125 0.8143812500000001 -0.18625 -0.32171630859375 0.8143812500000001 -0.186375 -0.293853759765625 0.8143812500000001 -0.1865 -0.266021728515625 0.8143812500000001 -0.186625 -0.23236083984375 0.8143812500000001 -0.18675 -0.196136474609375 0.8143812500000001 -0.186875 -0.16168212890625 0.8143812500000001 -0.187 -0.121734619140625 0.8143812500000001 -0.187125 -0.084625244140625 0.8143812500000001 -0.18725 -0.04254150390625 0.8143812500000001 +0.1835 -0.008544921875 0.8143812500000001 +0.183625 -0.051025390625 0.8143812500000001 +0.18375 -0.088836669921875 0.8143812500000001 +0.183875 -0.1298828125 0.8143812500000001 +0.184 -0.165618896484375 0.8143812500000001 +0.184125 -0.203582763671875 0.8143812500000001 +0.18425 -0.23931884765625 0.8143812500000001 +0.184375 -0.269287109375 0.8143812500000001 +0.1845 -0.299713134765625 0.8143812500000001 +0.184625 -0.3243408203125 0.8143812500000001 +0.18475 -0.348297119140625 0.8143812500000001 +0.184875 -0.368438720703125 0.8143812500000001 +0.185 -0.383087158203125 0.8143812500000001 +0.185125 -0.395416259765625 0.8143812500000001 +0.18525 -0.402801513671875 0.8143812500000001 +0.185375 -0.406829833984375 0.8143812500000001 +0.1855 -0.4063720703125 0.8143812500000001 +0.185625 -0.40216064453125 0.8143812500000001 +0.18575 -0.393310546875 0.8143812500000001 +0.185875 -0.381622314453125 0.8143812500000001 +0.186 -0.364715576171875 0.8143812500000001 +0.186125 -0.34381103515625 0.8143812500000001 +0.18625 -0.321746826171875 0.8143812500000001 +0.186375 -0.29388427734375 0.8143812500000001 +0.1865 -0.26605224609375 0.8143812500000001 +0.186625 -0.232391357421875 0.8143812500000001 +0.18675 -0.1961669921875 0.8143812500000001 +0.186875 -0.161712646484375 0.8143812500000001 +0.187 -0.12176513671875 0.8143812500000001 +0.187125 -0.08465576171875 0.8143812500000001 +0.18725 -0.042572021484375 0.8143812500000001 0.187375 0.0 0.8143812500000001 0.1875 0.038299560546875 0.8143812500000001 0.187625 0.0804443359375 0.8143812500000001 @@ -1529,37 +1529,37 @@ 0.191 0.09295654296875 0.8143812500000001 0.191125 0.050994873046875 0.8143812500000001 0.19125 0.01275634765625 0.8143812500000001 -0.191375 -0.02978515625 0.8143812500000001 -0.1915 -0.06787109375 0.8143812500000001 -0.191625 -0.109466552734375 0.8143812500000001 -0.19175 -0.149871826171875 0.8143812500000001 -0.191875 -0.184814453125 0.8143812500000001 -0.192 -0.2496337890625 0.9167781250000001 -0.192125 -0.284698486328125 0.9167781250000001 -0.19225 -0.3206787109375 0.9167781250000001 -0.192375 -0.3531494140625 0.9167781250000001 -0.1925 -0.379058837890625 0.9167781250000001 -0.192625 -0.4039306640625 0.9167781250000001 -0.19275 -0.422515869140625 0.9167781250000001 -0.192875 -0.43878173828125 0.9167781250000001 -0.193 -0.450225830078125 0.9167781250000001 -0.193125 -0.456298828125 0.9167781250000001 -0.19325 -0.45831298828125 0.9167781250000001 -0.193375 -0.455841064453125 0.9167781250000001 -0.1935 -0.44830322265625 0.9167781250000001 -0.193625 -0.4359130859375 0.9167781250000001 -0.19375 -0.420654296875 0.9167781250000001 -0.193875 -0.399322509765625 0.9167781250000001 -0.194 -0.376373291015625 0.9167781250000001 -0.194125 -0.346954345703125 0.9167781250000001 -0.19425 -0.313751220703125 0.9167781250000001 -0.194375 -0.280914306640625 0.9167781250000001 -0.1945 -0.24151611328125 0.9167781250000001 -0.194625 -0.20379638671875 0.9167781250000001 -0.19475 -0.159759521484375 0.9167781250000001 -0.194875 -0.11395263671875 0.9167781250000001 -0.195 -0.071685791015625 0.9167781250000001 -0.195125 -0.023956298828125 0.9167781250000001 +0.191375 -0.029815673828125 0.8143812500000001 +0.1915 -0.067901611328125 0.8143812500000001 +0.191625 -0.1094970703125 0.8143812500000001 +0.19175 -0.14990234375 0.8143812500000001 +0.191875 -0.184844970703125 0.8143812500000001 +0.192 -0.249664306640625 0.9167781250000001 +0.192125 -0.28472900390625 0.9167781250000001 +0.19225 -0.320709228515625 0.9167781250000001 +0.192375 -0.353179931640625 0.9167781250000001 +0.1925 -0.37908935546875 0.9167781250000001 +0.192625 -0.403961181640625 0.9167781250000001 +0.19275 -0.42254638671875 0.9167781250000001 +0.192875 -0.438812255859375 0.9167781250000001 +0.193 -0.45025634765625 0.9167781250000001 +0.193125 -0.456329345703125 0.9167781250000001 +0.19325 -0.458343505859375 0.9167781250000001 +0.193375 -0.45587158203125 0.9167781250000001 +0.1935 -0.448333740234375 0.9167781250000001 +0.193625 -0.435943603515625 0.9167781250000001 +0.19375 -0.420684814453125 0.9167781250000001 +0.193875 -0.39935302734375 0.9167781250000001 +0.194 -0.37640380859375 0.9167781250000001 +0.194125 -0.34698486328125 0.9167781250000001 +0.19425 -0.31378173828125 0.9167781250000001 +0.194375 -0.28094482421875 0.9167781250000001 +0.1945 -0.241546630859375 0.9167781250000001 +0.194625 -0.203826904296875 0.9167781250000001 +0.19475 -0.1597900390625 0.9167781250000001 +0.194875 -0.113983154296875 0.9167781250000001 +0.195 -0.07171630859375 0.9167781250000001 +0.195125 -0.02398681640625 0.9167781250000001 0.19525 0.0191650390625 0.9167781250000001 0.195375 0.066925048828125 0.9167781250000001 0.1955 0.11395263671875 0.9167781250000001 @@ -1591,37 +1591,37 @@ 0.19875 0.127838134765625 0.9167781250000001 0.198875 0.081146240234375 0.9167781250000001 0.199 0.038330078125 0.9167781250000001 -0.199125 -0.00958251953125 0.9167781250000001 -0.19925 -0.05743408203125 0.9167781250000001 -0.199375 -0.099945068359375 0.9167781250000001 -0.1995 -0.14617919921875 0.9167781250000001 -0.199625 -0.1864013671875 0.9167781250000001 -0.19975 -0.229156494140625 0.9167781250000001 -0.199875 -0.269378662109375 0.9167781250000001 -0.2 -0.3031005859375 0.9167781250000001 -0.200125 -0.337371826171875 0.9167781250000001 -0.20025 -0.365081787109375 0.9167781250000001 -0.200375 -0.39202880859375 0.9167781250000001 -0.2005 -0.414703369140625 0.9167781250000001 -0.200625 -0.431243896484375 0.9167781250000001 -0.20075 -0.445098876953125 0.9167781250000001 -0.200875 -0.45343017578125 0.9167781250000001 -0.201 -0.45794677734375 0.9167781250000001 -0.201125 -0.457427978515625 0.9167781250000001 -0.20125 -0.45269775390625 0.9167781250000001 -0.201375 -0.442718505859375 0.9167781250000001 -0.2015 -0.429595947265625 0.9167781250000001 -0.201625 -0.4105224609375 0.9167781250000001 -0.20175 -0.386993408203125 0.9167781250000001 -0.201875 -0.362152099609375 0.9167781250000001 -0.202 -0.330810546875 0.9167781250000001 -0.202125 -0.299468994140625 0.9167781250000001 -0.20225 -0.261566162109375 0.9167781250000001 -0.202375 -0.220794677734375 0.9167781250000001 -0.2025 -0.1820068359375 0.9167781250000001 -0.202625 -0.137054443359375 0.9167781250000001 -0.20275 -0.09527587890625 0.9167781250000001 -0.202875 -0.047882080078125 0.9167781250000001 +0.199125 -0.009613037109375 0.9167781250000001 +0.19925 -0.057464599609375 0.9167781250000001 +0.199375 -0.0999755859375 0.9167781250000001 +0.1995 -0.146209716796875 0.9167781250000001 +0.199625 -0.186431884765625 0.9167781250000001 +0.19975 -0.22918701171875 0.9167781250000001 +0.199875 -0.2694091796875 0.9167781250000001 +0.2 -0.303131103515625 0.9167781250000001 +0.200125 -0.33740234375 0.9167781250000001 +0.20025 -0.3651123046875 0.9167781250000001 +0.200375 -0.392059326171875 0.9167781250000001 +0.2005 -0.41473388671875 0.9167781250000001 +0.200625 -0.4312744140625 0.9167781250000001 +0.20075 -0.44512939453125 0.9167781250000001 +0.200875 -0.453460693359375 0.9167781250000001 +0.201 -0.457977294921875 0.9167781250000001 +0.201125 -0.45745849609375 0.9167781250000001 +0.20125 -0.452728271484375 0.9167781250000001 +0.201375 -0.4427490234375 0.9167781250000001 +0.2015 -0.42962646484375 0.9167781250000001 +0.201625 -0.410552978515625 0.9167781250000001 +0.20175 -0.38702392578125 0.9167781250000001 +0.201875 -0.3621826171875 0.9167781250000001 +0.202 -0.330841064453125 0.9167781250000001 +0.202125 -0.29949951171875 0.9167781250000001 +0.20225 -0.2615966796875 0.9167781250000001 +0.202375 -0.2208251953125 0.9167781250000001 +0.2025 -0.182037353515625 0.9167781250000001 +0.202625 -0.1370849609375 0.9167781250000001 +0.20275 -0.095306396484375 0.9167781250000001 +0.202875 -0.04791259765625 0.9167781250000001 0.203 0.0 0.9167781250000001 0.203125 0.043121337890625 0.9167781250000001 0.20325 0.090576171875 0.9167781250000001 @@ -1654,37 +1654,37 @@ 0.206625 0.104644775390625 0.9167781250000001 0.20675 0.05743408203125 0.9167781250000001 0.206875 0.014373779296875 0.9167781250000001 -0.207 -0.033538818359375 0.9167781250000001 -0.207125 -0.076416015625 0.9167781250000001 -0.20725 -0.12322998046875 0.9167781250000001 -0.207375 -0.168701171875 0.9167781250000001 -0.2075 -0.20806884765625 0.9167781250000001 -0.207625 -0.2496337890625 0.9167781250000001 -0.20775 -0.284698486328125 0.9167781250000001 -0.207875 -0.3206787109375 0.9167781250000001 -0.208 -0.3531494140625 0.9167781250000001 -0.208125 -0.379058837890625 0.9167781250000001 -0.20825 -0.4039306640625 0.9167781250000001 -0.208375 -0.422515869140625 0.9167781250000001 -0.2085 -0.43878173828125 0.9167781250000001 -0.208625 -0.450225830078125 0.9167781250000001 -0.20875 -0.456298828125 0.9167781250000001 -0.208875 -0.45831298828125 0.9167781250000001 -0.209 -0.455841064453125 0.9167781250000001 -0.209125 -0.44830322265625 0.9167781250000001 -0.20925 -0.4359130859375 0.9167781250000001 -0.209375 -0.420654296875 0.9167781250000001 -0.2095 -0.399322509765625 0.9167781250000001 -0.209625 -0.376373291015625 0.9167781250000001 -0.20975 -0.346954345703125 0.9167781250000001 -0.209875 -0.313751220703125 0.9167781250000001 -0.21 -0.280914306640625 0.9167781250000001 -0.210125 -0.24151611328125 0.9167781250000001 -0.21025 -0.20379638671875 0.9167781250000001 -0.210375 -0.159759521484375 0.9167781250000001 -0.2105 -0.11395263671875 0.9167781250000001 -0.210625 -0.071685791015625 0.9167781250000001 -0.21075 -0.023956298828125 0.9167781250000001 +0.207 -0.0335693359375 0.9167781250000001 +0.207125 -0.076446533203125 0.9167781250000001 +0.20725 -0.123260498046875 0.9167781250000001 +0.207375 -0.168731689453125 0.9167781250000001 +0.2075 -0.208099365234375 0.9167781250000001 +0.207625 -0.249664306640625 0.9167781250000001 +0.20775 -0.28472900390625 0.9167781250000001 +0.207875 -0.320709228515625 0.9167781250000001 +0.208 -0.353179931640625 0.9167781250000001 +0.208125 -0.37908935546875 0.9167781250000001 +0.20825 -0.403961181640625 0.9167781250000001 +0.208375 -0.42254638671875 0.9167781250000001 +0.2085 -0.438812255859375 0.9167781250000001 +0.208625 -0.45025634765625 0.9167781250000001 +0.20875 -0.456329345703125 0.9167781250000001 +0.208875 -0.458343505859375 0.9167781250000001 +0.209 -0.45587158203125 0.9167781250000001 +0.209125 -0.448333740234375 0.9167781250000001 +0.20925 -0.435943603515625 0.9167781250000001 +0.209375 -0.420684814453125 0.9167781250000001 +0.2095 -0.39935302734375 0.9167781250000001 +0.209625 -0.37640380859375 0.9167781250000001 +0.20975 -0.34698486328125 0.9167781250000001 +0.209875 -0.31378173828125 0.9167781250000001 +0.21 -0.28094482421875 0.9167781250000001 +0.210125 -0.241546630859375 0.9167781250000001 +0.21025 -0.203826904296875 0.9167781250000001 +0.210375 -0.1597900390625 0.9167781250000001 +0.2105 -0.113983154296875 0.9167781250000001 +0.210625 -0.07171630859375 0.9167781250000001 +0.21075 -0.02398681640625 0.9167781250000001 0.210875 0.0191650390625 0.9167781250000001 0.211 0.066925048828125 0.9167781250000001 0.211125 0.11395263671875 0.9167781250000001 @@ -1716,37 +1716,37 @@ 0.214375 0.127838134765625 0.9167781250000001 0.2145 0.081146240234375 0.9167781250000001 0.214625 0.038330078125 0.9167781250000001 -0.21475 -0.00958251953125 0.9167781250000001 -0.214875 -0.05743408203125 0.9167781250000001 -0.215 -0.099945068359375 0.9167781250000001 -0.215125 -0.14617919921875 0.9167781250000001 -0.21525 -0.1864013671875 0.9167781250000001 -0.215375 -0.229156494140625 0.9167781250000001 -0.2155 -0.269378662109375 0.9167781250000001 -0.215625 -0.3031005859375 0.9167781250000001 -0.21575 -0.337371826171875 0.9167781250000001 -0.215875 -0.365081787109375 0.9167781250000001 -0.216 -0.39202880859375 0.9167781250000001 -0.216125 -0.414703369140625 0.9167781250000001 -0.21625 -0.431243896484375 0.9167781250000001 -0.216375 -0.445098876953125 0.9167781250000001 -0.2165 -0.45343017578125 0.9167781250000001 -0.216625 -0.45794677734375 0.9167781250000001 -0.21675 -0.457427978515625 0.9167781250000001 -0.216875 -0.45269775390625 0.9167781250000001 -0.217 -0.442718505859375 0.9167781250000001 -0.217125 -0.429595947265625 0.9167781250000001 -0.21725 -0.4105224609375 0.9167781250000001 -0.217375 -0.386993408203125 0.9167781250000001 -0.2175 -0.362152099609375 0.9167781250000001 -0.217625 -0.330810546875 0.9167781250000001 -0.21775 -0.299468994140625 0.9167781250000001 -0.217875 -0.261566162109375 0.9167781250000001 -0.218 -0.220794677734375 0.9167781250000001 -0.218125 -0.1820068359375 0.9167781250000001 -0.21825 -0.137054443359375 0.9167781250000001 -0.218375 -0.09527587890625 0.9167781250000001 -0.2185 -0.047882080078125 0.9167781250000001 +0.21475 -0.009613037109375 0.9167781250000001 +0.214875 -0.057464599609375 0.9167781250000001 +0.215 -0.0999755859375 0.9167781250000001 +0.215125 -0.146209716796875 0.9167781250000001 +0.21525 -0.186431884765625 0.9167781250000001 +0.215375 -0.22918701171875 0.9167781250000001 +0.2155 -0.2694091796875 0.9167781250000001 +0.215625 -0.303131103515625 0.9167781250000001 +0.21575 -0.33740234375 0.9167781250000001 +0.215875 -0.3651123046875 0.9167781250000001 +0.216 -0.392059326171875 0.9167781250000001 +0.216125 -0.41473388671875 0.9167781250000001 +0.21625 -0.4312744140625 0.9167781250000001 +0.216375 -0.44512939453125 0.9167781250000001 +0.2165 -0.453460693359375 0.9167781250000001 +0.216625 -0.457977294921875 0.9167781250000001 +0.21675 -0.45745849609375 0.9167781250000001 +0.216875 -0.452728271484375 0.9167781250000001 +0.217 -0.4427490234375 0.9167781250000001 +0.217125 -0.42962646484375 0.9167781250000001 +0.21725 -0.410552978515625 0.9167781250000001 +0.217375 -0.38702392578125 0.9167781250000001 +0.2175 -0.3621826171875 0.9167781250000001 +0.217625 -0.330841064453125 0.9167781250000001 +0.21775 -0.29949951171875 0.9167781250000001 +0.217875 -0.2615966796875 0.9167781250000001 +0.218 -0.2208251953125 0.9167781250000001 +0.218125 -0.182037353515625 0.9167781250000001 +0.21825 -0.1370849609375 0.9167781250000001 +0.218375 -0.095306396484375 0.9167781250000001 +0.2185 -0.04791259765625 0.9167781250000001 0.218625 0.0 0.9167781250000001 0.21875 0.043121337890625 0.9167781250000001 0.218875 0.090576171875 0.9167781250000001 @@ -1779,37 +1779,37 @@ 0.22225 0.104644775390625 0.9167781250000001 0.222375 0.05743408203125 0.9167781250000001 0.2225 0.014373779296875 0.9167781250000001 -0.222625 -0.033538818359375 0.9167781250000001 -0.22275 -0.076416015625 0.9167781250000001 -0.222875 -0.12322998046875 0.9167781250000001 -0.223 -0.168701171875 0.9167781250000001 -0.223125 -0.20806884765625 0.9167781250000001 -0.22325 -0.2496337890625 0.9167781250000001 -0.223375 -0.284698486328125 0.9167781250000001 -0.2235 -0.3206787109375 0.9167781250000001 -0.223625 -0.3531494140625 0.9167781250000001 -0.22375 -0.379058837890625 0.9167781250000001 -0.223875 -0.4039306640625 0.9167781250000001 -0.224 -0.460845947265625 0.9999511726200581 -0.224125 -0.47857666015625 0.9999511726200581 -0.22425 -0.491058349609375 0.9999511726200581 -0.224375 -0.497711181640625 0.9999511726200581 -0.2245 -0.499908447265625 0.9999511726200581 -0.224625 -0.4971923828125 0.9999511726200581 -0.22475 -0.488983154296875 0.9999511726200581 -0.224875 -0.4754638671875 0.9999511726200581 -0.225 -0.45880126953125 0.9999511726200581 -0.225125 -0.435546875 0.9999511726200581 -0.22525 -0.410491943359375 0.9999511726200581 -0.225375 -0.37841796875 0.9999511726200581 -0.2255 -0.342193603515625 0.9999511726200581 -0.225625 -0.306396484375 0.9999511726200581 -0.22575 -0.263427734375 0.9999511726200581 -0.225875 -0.222259521484375 0.9999511726200581 -0.226 -0.174224853515625 0.9999511726200581 -0.226125 -0.124298095703125 0.9999511726200581 -0.22625 -0.07818603515625 0.9999511726200581 -0.226375 -0.026123046875 0.9999511726200581 +0.222625 -0.0335693359375 0.9167781250000001 +0.22275 -0.076446533203125 0.9167781250000001 +0.222875 -0.123260498046875 0.9167781250000001 +0.223 -0.168731689453125 0.9167781250000001 +0.223125 -0.208099365234375 0.9167781250000001 +0.22325 -0.249664306640625 0.9167781250000001 +0.223375 -0.28472900390625 0.9167781250000001 +0.2235 -0.320709228515625 0.9167781250000001 +0.223625 -0.353179931640625 0.9167781250000001 +0.22375 -0.37908935546875 0.9167781250000001 +0.223875 -0.403961181640625 0.9167781250000001 +0.224 -0.46087646484375 0.9999511726200581 +0.224125 -0.478607177734375 0.9999511726200581 +0.22425 -0.4910888671875 0.9999511726200581 +0.224375 -0.49774169921875 0.9999511726200581 +0.2245 -0.49993896484375 0.9999511726200581 +0.224625 -0.497222900390625 0.9999511726200581 +0.22475 -0.489013671875 0.9999511726200581 +0.224875 -0.475494384765625 0.9999511726200581 +0.225 -0.458831787109375 0.9999511726200581 +0.225125 -0.435577392578125 0.9999511726200581 +0.22525 -0.4105224609375 0.9999511726200581 +0.225375 -0.378448486328125 0.9999511726200581 +0.2255 -0.34222412109375 0.9999511726200581 +0.225625 -0.306427001953125 0.9999511726200581 +0.22575 -0.263458251953125 0.9999511726200581 +0.225875 -0.2222900390625 0.9999511726200581 +0.226 -0.17425537109375 0.9999511726200581 +0.226125 -0.12432861328125 0.9999511726200581 +0.22625 -0.078216552734375 0.9999511726200581 +0.226375 -0.026153564453125 0.9999511726200581 0.2265 0.020904541015625 0.9999511726200581 0.226625 0.072998046875 0.9999511726200581 0.22675 0.124298095703125 0.9999511726200581 @@ -1841,37 +1841,37 @@ 0.23 0.13946533203125 0.9999511726200581 0.230125 0.0885009765625 0.9999511726200581 0.23025 0.04180908203125 0.9999511726200581 -0.230375 -0.01043701171875 0.9999511726200581 -0.2305 -0.0626220703125 0.9999511726200581 -0.230625 -0.109039306640625 0.9999511726200581 -0.23075 -0.159454345703125 0.9999511726200581 -0.230875 -0.20330810546875 0.9999511726200581 -0.231 -0.24993896484375 0.9999511726200581 -0.231125 -0.2938232421875 0.9999511726200581 -0.23125 -0.330596923828125 0.9999511726200581 -0.231375 -0.36798095703125 0.9999511726200581 -0.2315 -0.398193359375 0.9999511726200581 -0.231625 -0.4276123046875 0.9999511726200581 -0.23175 -0.45233154296875 0.9999511726200581 -0.231875 -0.470367431640625 0.9999511726200581 -0.232 -0.485504150390625 0.9999511726200581 -0.232125 -0.49456787109375 0.9999511726200581 -0.23225 -0.499481201171875 0.9999511726200581 -0.232375 -0.498931884765625 0.9999511726200581 -0.2325 -0.4937744140625 0.9999511726200581 -0.232625 -0.482879638671875 0.9999511726200581 -0.23275 -0.46856689453125 0.9999511726200581 -0.232875 -0.447784423828125 0.9999511726200581 -0.233 -0.422088623046875 0.9999511726200581 -0.233125 -0.39501953125 0.9999511726200581 -0.23325 -0.360809326171875 0.9999511726200581 -0.233375 -0.32666015625 0.9999511726200581 -0.2335 -0.285308837890625 0.9999511726200581 -0.233625 -0.240814208984375 0.9999511726200581 -0.23375 -0.198516845703125 0.9999511726200581 -0.233875 -0.14947509765625 0.9999511726200581 -0.234 -0.103912353515625 0.9999511726200581 -0.234125 -0.05224609375 0.9999511726200581 +0.230375 -0.010467529296875 0.9999511726200581 +0.2305 -0.062652587890625 0.9999511726200581 +0.230625 -0.10906982421875 0.9999511726200581 +0.23075 -0.15948486328125 0.9999511726200581 +0.230875 -0.203338623046875 0.9999511726200581 +0.231 -0.249969482421875 0.9999511726200581 +0.231125 -0.293853759765625 0.9999511726200581 +0.23125 -0.33062744140625 0.9999511726200581 +0.231375 -0.368011474609375 0.9999511726200581 +0.2315 -0.398223876953125 0.9999511726200581 +0.231625 -0.427642822265625 0.9999511726200581 +0.23175 -0.452362060546875 0.9999511726200581 +0.231875 -0.47039794921875 0.9999511726200581 +0.232 -0.48553466796875 0.9999511726200581 +0.232125 -0.494598388671875 0.9999511726200581 +0.23225 -0.49951171875 0.9999511726200581 +0.232375 -0.49896240234375 0.9999511726200581 +0.2325 -0.493804931640625 0.9999511726200581 +0.232625 -0.48291015625 0.9999511726200581 +0.23275 -0.468597412109375 0.9999511726200581 +0.232875 -0.44781494140625 0.9999511726200581 +0.233 -0.422119140625 0.9999511726200581 +0.233125 -0.395050048828125 0.9999511726200581 +0.23325 -0.36083984375 0.9999511726200581 +0.233375 -0.326690673828125 0.9999511726200581 +0.2335 -0.28533935546875 0.9999511726200581 +0.233625 -0.2408447265625 0.9999511726200581 +0.23375 -0.19854736328125 0.9999511726200581 +0.233875 -0.149505615234375 0.9999511726200581 +0.234 -0.10394287109375 0.9999511726200581 +0.234125 -0.052276611328125 0.9999511726200581 0.23425 0.0 0.9999511726200581 0.234375 0.047027587890625 0.9999511726200581 0.2345 0.098785400390625 0.9999511726200581 @@ -1904,37 +1904,37 @@ 0.237875 0.1141357421875 0.9999511726200581 0.238 0.0626220703125 0.9999511726200581 0.238125 0.01568603515625 0.9999511726200581 -0.23825 -0.036590576171875 0.9999511726200581 -0.238375 -0.083343505859375 0.9999511726200581 -0.2385 -0.134429931640625 0.9999511726200581 -0.238625 -0.18402099609375 0.9999511726200581 -0.23875 -0.2269287109375 0.9999511726200581 -0.238875 -0.27227783203125 0.9999511726200581 -0.239 -0.310516357421875 0.9999511726200581 -0.239125 -0.349761962890625 0.9999511726200581 -0.23925 -0.38519287109375 0.9999511726200581 -0.239375 -0.4134521484375 0.9999511726200581 -0.2395 -0.440582275390625 0.9999511726200581 -0.239625 -0.460845947265625 0.9999511726200581 -0.23975 -0.47857666015625 0.9999511726200581 -0.239875 -0.491058349609375 0.9999511726200581 -0.24 -0.497711181640625 0.9999511726200581 -0.240125 -0.499908447265625 0.9999511726200581 -0.24025 -0.4971923828125 0.9999511726200581 -0.240375 -0.488983154296875 0.9999511726200581 -0.2405 -0.4754638671875 0.9999511726200581 -0.240625 -0.45880126953125 0.9999511726200581 -0.24075 -0.435546875 0.9999511726200581 -0.240875 -0.410491943359375 0.9999511726200581 -0.241 -0.37841796875 0.9999511726200581 -0.241125 -0.342193603515625 0.9999511726200581 -0.24125 -0.306396484375 0.9999511726200581 -0.241375 -0.263427734375 0.9999511726200581 -0.2415 -0.222259521484375 0.9999511726200581 -0.241625 -0.174224853515625 0.9999511726200581 -0.24175 -0.124298095703125 0.9999511726200581 -0.241875 -0.07818603515625 0.9999511726200581 -0.242 -0.026123046875 0.9999511726200581 +0.23825 -0.03662109375 0.9999511726200581 +0.238375 -0.0833740234375 0.9999511726200581 +0.2385 -0.13446044921875 0.9999511726200581 +0.238625 -0.184051513671875 0.9999511726200581 +0.23875 -0.226959228515625 0.9999511726200581 +0.238875 -0.272308349609375 0.9999511726200581 +0.239 -0.310546875 0.9999511726200581 +0.239125 -0.34979248046875 0.9999511726200581 +0.23925 -0.385223388671875 0.9999511726200581 +0.239375 -0.413482666015625 0.9999511726200581 +0.2395 -0.44061279296875 0.9999511726200581 +0.239625 -0.46087646484375 0.9999511726200581 +0.23975 -0.478607177734375 0.9999511726200581 +0.239875 -0.4910888671875 0.9999511726200581 +0.24 -0.49774169921875 0.9999511726200581 +0.240125 -0.49993896484375 0.9999511726200581 +0.24025 -0.497222900390625 0.9999511726200581 +0.240375 -0.489013671875 0.9999511726200581 +0.2405 -0.475494384765625 0.9999511726200581 +0.240625 -0.458831787109375 0.9999511726200581 +0.24075 -0.435577392578125 0.9999511726200581 +0.240875 -0.4105224609375 0.9999511726200581 +0.241 -0.378448486328125 0.9999511726200581 +0.241125 -0.34222412109375 0.9999511726200581 +0.24125 -0.306427001953125 0.9999511726200581 +0.241375 -0.263458251953125 0.9999511726200581 +0.2415 -0.2222900390625 0.9999511726200581 +0.241625 -0.17425537109375 0.9999511726200581 +0.24175 -0.12432861328125 0.9999511726200581 +0.241875 -0.078216552734375 0.9999511726200581 +0.242 -0.026153564453125 0.9999511726200581 0.242125 0.020904541015625 0.9999511726200581 0.24225 0.072998046875 0.9999511726200581 0.242375 0.124298095703125 0.9999511726200581 @@ -1966,37 +1966,37 @@ 0.245625 0.13946533203125 0.9999511726200581 0.24575 0.0885009765625 0.9999511726200581 0.245875 0.04180908203125 0.9999511726200581 -0.246 -0.01043701171875 0.9999511726200581 -0.246125 -0.0626220703125 0.9999511726200581 -0.24625 -0.109039306640625 0.9999511726200581 -0.246375 -0.159454345703125 0.9999511726200581 -0.2465 -0.20330810546875 0.9999511726200581 -0.246625 -0.24993896484375 0.9999511726200581 -0.24675 -0.2938232421875 0.9999511726200581 -0.246875 -0.330596923828125 0.9999511726200581 -0.247 -0.36798095703125 0.9999511726200581 -0.247125 -0.398193359375 0.9999511726200581 -0.24725 -0.4276123046875 0.9999511726200581 -0.247375 -0.45233154296875 0.9999511726200581 -0.2475 -0.470367431640625 0.9999511726200581 -0.247625 -0.485504150390625 0.9999511726200581 -0.24775 -0.49456787109375 0.9999511726200581 -0.247875 -0.499481201171875 0.9999511726200581 -0.248 -0.498931884765625 0.9999511726200581 -0.248125 -0.4937744140625 0.9999511726200581 -0.24825 -0.482879638671875 0.9999511726200581 -0.248375 -0.46856689453125 0.9999511726200581 -0.2485 -0.447784423828125 0.9999511726200581 -0.248625 -0.422088623046875 0.9999511726200581 -0.24875 -0.39501953125 0.9999511726200581 -0.248875 -0.360809326171875 0.9999511726200581 -0.249 -0.32666015625 0.9999511726200581 -0.249125 -0.285308837890625 0.9999511726200581 -0.24925 -0.240814208984375 0.9999511726200581 -0.249375 -0.198516845703125 0.9999511726200581 -0.2495 -0.14947509765625 0.9999511726200581 -0.249625 -0.103912353515625 0.9999511726200581 -0.24975 -0.05224609375 0.9999511726200581 +0.246 -0.010467529296875 0.9999511726200581 +0.246125 -0.062652587890625 0.9999511726200581 +0.24625 -0.10906982421875 0.9999511726200581 +0.246375 -0.15948486328125 0.9999511726200581 +0.2465 -0.203338623046875 0.9999511726200581 +0.246625 -0.249969482421875 0.9999511726200581 +0.24675 -0.293853759765625 0.9999511726200581 +0.246875 -0.33062744140625 0.9999511726200581 +0.247 -0.368011474609375 0.9999511726200581 +0.247125 -0.398223876953125 0.9999511726200581 +0.24725 -0.427642822265625 0.9999511726200581 +0.247375 -0.452362060546875 0.9999511726200581 +0.2475 -0.47039794921875 0.9999511726200581 +0.247625 -0.48553466796875 0.9999511726200581 +0.24775 -0.494598388671875 0.9999511726200581 +0.247875 -0.49951171875 0.9999511726200581 +0.248 -0.49896240234375 0.9999511726200581 +0.248125 -0.493804931640625 0.9999511726200581 +0.24825 -0.48291015625 0.9999511726200581 +0.248375 -0.468597412109375 0.9999511726200581 +0.2485 -0.44781494140625 0.9999511726200581 +0.248625 -0.422119140625 0.9999511726200581 +0.24875 -0.395050048828125 0.9999511726200581 +0.248875 -0.36083984375 0.9999511726200581 +0.249 -0.326690673828125 0.9999511726200581 +0.249125 -0.28533935546875 0.9999511726200581 +0.24925 -0.2408447265625 0.9999511726200581 +0.249375 -0.19854736328125 0.9999511726200581 +0.2495 -0.149505615234375 0.9999511726200581 +0.249625 -0.10394287109375 0.9999511726200581 +0.24975 -0.052276611328125 0.9999511726200581 0.249875 0.0 0.9999511726200581 0.25 0.047027587890625 0.9999511726200581 0.250125 0.098785400390625 0.9999511726200581 @@ -2029,20 +2029,20 @@ 0.2535 0.1141357421875 0.9999511726200581 0.253625 0.0626220703125 0.9999511726200581 0.2537500000000001 0.01568603515625 0.9999511726200581 -0.253875 -0.036590576171875 0.9999511726200581 -0.254 -0.083343505859375 0.9999511726200581 -0.254125 -0.134429931640625 0.9999511726200581 -0.25425 -0.18402099609375 0.9999511726200581 -0.254375 -0.2269287109375 0.9999511726200581 -0.2545 -0.27227783203125 0.9999511726200581 -0.254625 -0.310516357421875 0.9999511726200581 -0.25475 -0.349761962890625 0.9999511726200581 -0.254875 -0.38519287109375 0.9999511726200581 -0.255 -0.4134521484375 0.9999511726200581 -0.255125 -0.440582275390625 0.9999511726200581 -0.25525 -0.460845947265625 0.9999511726200581 -0.255375 -0.47857666015625 0.9999511726200581 -0.2555 -0.491058349609375 0.9999511726200581 -0.255625 -0.497711181640625 0.9999511726200581 -0.25575 -0.499908447265625 0.9999511726200581 -0.255875 -0.4971923828125 0.9999511726200581 +0.253875 -0.03662109375 0.9999511726200581 +0.254 -0.0833740234375 0.9999511726200581 +0.254125 -0.13446044921875 0.9999511726200581 +0.25425 -0.184051513671875 0.9999511726200581 +0.254375 -0.226959228515625 0.9999511726200581 +0.2545 -0.272308349609375 0.9999511726200581 +0.254625 -0.310546875 0.9999511726200581 +0.25475 -0.34979248046875 0.9999511726200581 +0.254875 -0.385223388671875 0.9999511726200581 +0.255 -0.413482666015625 0.9999511726200581 +0.255125 -0.44061279296875 0.9999511726200581 +0.25525 -0.46087646484375 0.9999511726200581 +0.255375 -0.478607177734375 0.9999511726200581 +0.2555 -0.4910888671875 0.9999511726200581 +0.255625 -0.49774169921875 0.9999511726200581 +0.25575 -0.49993896484375 0.9999511726200581 +0.255875 -0.497222900390625 0.9999511726200581 diff --git a/tests/circuitpython/synth_note_bend.py.exp b/tests/circuitpython/synth_note_bend.py.exp index e79811509e..fda9787b38 100644 --- a/tests/circuitpython/synth_note_bend.py.exp +++ b/tests/circuitpython/synth_note_bend.py.exp @@ -208,188 +208,188 @@ 0.025875 0.01043701171875 -0.743977294921875 0.026 0.005218505859375 -0.743977294921875 0.026125 0.0 -0.743977294921875 -0.02625 -0.01043701171875 -0.743977294921875 -0.026375 -0.01568603515625 -0.743977294921875 -0.0265 -0.026123046875 -0.743977294921875 -0.026625 -0.0313720703125 -0.743977294921875 -0.02675 -0.04180908203125 -0.743977294921875 -0.026875 -0.047027587890625 -0.743977294921875 -0.027 -0.05224609375 -0.743977294921875 -0.027125 -0.0626220703125 -0.743977294921875 -0.02725 -0.06781005859375 -0.743977294921875 -0.027375 -0.07818603515625 -0.743977294921875 -0.0275 -0.083343505859375 -0.743977294921875 -0.027625 -0.093658447265625 -0.743977294921875 -0.02775 -0.098785400390625 -0.743977294921875 -0.027875 -0.109039306640625 -0.743977294921875 -0.028 -0.1141357421875 -0.743977294921875 -0.028125 -0.119232177734375 -0.743977294921875 -0.02825 -0.129364013671875 -0.743977294921875 -0.028375 -0.134429931640625 -0.743977294921875 -0.02850000000000001 -0.14447021484375 -0.743977294921875 -0.028625 -0.14947509765625 -0.743977294921875 -0.02875 -0.159454345703125 -0.743977294921875 -0.028875 -0.164398193359375 -0.743977294921875 -0.029 -0.169342041015625 -0.743977294921875 -0.029125 -0.17913818359375 -0.743977294921875 -0.02925 -0.18402099609375 -0.743977294921875 -0.029375 -0.1937255859375 -0.743977294921875 -0.0295 -0.19854736328125 -0.743977294921875 -0.029625 -0.208099365234375 -0.743977294921875 -0.02975000000000001 -0.212860107421875 -0.743977294921875 -0.029875 -0.21759033203125 -0.743977294921875 -0.03 -0.226959228515625 -0.743977294921875 -0.030125 -0.231597900390625 -0.743977294921875 -0.03025 -0.2408447265625 -0.743977294921875 -0.030375 -0.24542236328125 -0.743977294921875 -0.0305 -0.25445556640625 -0.743977294921875 -0.030625 -0.25897216796875 -0.743977294921875 -0.03075 -0.263427734375 -0.743977294921875 -0.03087499999999999 -0.27227783203125 -0.743977294921875 -0.031 -0.276641845703125 -0.743977294921875 -0.031125 -0.285308837890625 -0.743977294921875 -0.03125 -0.289581298828125 -0.743977294921875 -0.031375 -0.298065185546875 -0.743977294921875 -0.0315 -0.30224609375 -0.743977294921875 -0.03162500000000001 -0.310516357421875 -0.743977294921875 -0.03175 -0.314605712890625 -0.743977294921875 -0.031875 -0.31866455078125 -0.743977294921875 -0.032 -0.32666015625 -0.487985107421875 -0.032125 -0.334503173828125 -0.487985107421875 -0.03225 -0.34222412109375 -0.487985107421875 -0.032375 -0.34600830078125 -0.487985107421875 -0.0325 -0.353485107421875 -0.487985107421875 -0.032625 -0.360809326171875 -0.487985107421875 -0.03275 -0.36444091796875 -0.487985107421875 -0.032875 -0.37152099609375 -0.487985107421875 -0.033 -0.378448486328125 -0.487985107421875 -0.033125 -0.38519287109375 -0.487985107421875 -0.03325 -0.388519287109375 -0.487985107421875 -0.033375 -0.39501953125 -0.487985107421875 -0.0335 -0.401336669921875 -0.487985107421875 -0.03362500000000001 -0.404449462890625 -0.487985107421875 -0.03375 -0.4105224609375 -0.487985107421875 -0.033875 -0.416412353515625 -0.487985107421875 -0.034 -0.419281005859375 -0.487985107421875 -0.03412500000000001 -0.424896240234375 -0.487985107421875 -0.03425 -0.4302978515625 -0.487985107421875 -0.034375 -0.435546875 -0.487985107421875 -0.0345 -0.438079833984375 -0.487985107421875 -0.034625 -0.44305419921875 -0.487985107421875 -0.03475000000000001 -0.447784423828125 -0.487985107421875 -0.034875 -0.450103759765625 -0.487985107421875 -0.035 -0.454559326171875 -0.487985107421875 -0.03512500000000001 -0.458831787109375 -0.487985107421875 -0.03525 -0.462890625 -0.487985107421875 -0.035375 -0.464813232421875 -0.487985107421875 -0.0355 -0.46856689453125 -0.487985107421875 -0.03562500000000001 -0.472137451171875 -0.487985107421875 -0.03575 -0.47381591796875 -0.487985107421875 -0.035875 -0.47705078125 -0.487985107421875 -0.03600000000000001 -0.480072021484375 -0.487985107421875 -0.036125 -0.48291015625 -0.487985107421875 -0.03625 -0.484222412109375 -0.487985107421875 -0.036375 -0.486724853515625 -0.487985107421875 -0.0365 -0.489013671875 -0.487985107421875 -0.036625 -0.490081787109375 -0.487985107421875 -0.03675 -0.492034912109375 -0.487985107421875 -0.036875 -0.4937744140625 -0.487985107421875 -0.037 -0.49530029296875 -0.487985107421875 -0.03712499999999999 -0.496002197265625 -0.487985107421875 -0.03725 -0.4971923828125 -0.487985107421875 -0.037375 -0.498199462890625 -0.487985107421875 -0.0375 -0.49859619140625 -0.487985107421875 -0.037625 -0.499267578125 -0.487985107421875 -0.03775 -0.49969482421875 -0.487985107421875 -0.037875 -0.499908447265625 -0.487985107421875 -0.038 -0.49993896484375 -0.487985107421875 -0.038125 -0.49981689453125 -0.487985107421875 -0.03825 -0.49951171875 -0.487985107421875 -0.038375 -0.499267578125 -0.487985107421875 -0.0385 -0.49859619140625 -0.487985107421875 -0.038625 -0.497711181640625 -0.487985107421875 -0.03875 -0.496612548828125 -0.487985107421875 -0.038875 -0.496002197265625 -0.487985107421875 -0.039 -0.49456787109375 -0.487985107421875 -0.039125 -0.492950439453125 -0.487985107421875 -0.03925 -0.492034912109375 -0.487985107421875 -0.039375 -0.490081787109375 -0.487985107421875 -0.0395 -0.487884521484375 -0.487985107421875 -0.039625 -0.485504150390625 -0.487985107421875 -0.03975 -0.484222412109375 -0.487985107421875 -0.039875 -0.48150634765625 -0.487985107421875 -0.04 -0.478607177734375 -0.487985107421875 -0.040125 -0.47705078125 -0.487985107421875 -0.04025 -0.47381591796875 -0.487985107421875 -0.040375 -0.470367431640625 -0.487985107421875 -0.04050000000000001 -0.46856689453125 -0.487985107421875 -0.040625 -0.464813232421875 -0.487985107421875 -0.04075 -0.46087646484375 -0.487985107421875 -0.040875 -0.45672607421875 -0.487985107421875 -0.04100000000000001 -0.454559326171875 -0.487985107421875 -0.041125 -0.450103759765625 -0.487985107421875 -0.04125 -0.4454345703125 -0.487985107421875 -0.041375 -0.44305419921875 -0.487985107421875 -0.0415 -0.438079833984375 -0.487985107421875 -0.041625 -0.432952880859375 -0.487985107421875 -0.04175000000000001 -0.4276123046875 -0.487985107421875 -0.041875 -0.424896240234375 -0.487985107421875 -0.042 -0.419281005859375 -0.487985107421875 -0.042125 -0.413482666015625 -0.487985107421875 -0.04225000000000001 -0.4105224609375 -0.487985107421875 -0.042375 -0.404449462890625 -0.487985107421875 -0.0425 -0.398193359375 -0.487985107421875 -0.042625 -0.39178466796875 -0.487985107421875 -0.04275 -0.388519287109375 -0.487985107421875 -0.04287500000000001 -0.3818359375 -0.487985107421875 -0.04300000000000001 -0.375 -0.487985107421875 -0.043125 -0.37152099609375 -0.487985107421875 -0.04325 -0.36444091796875 -0.487985107421875 -0.043375 -0.357177734375 -0.487985107421875 -0.04350000000000001 -0.349761962890625 -0.487985107421875 -0.04362500000000001 -0.34600830078125 -0.487985107421875 -0.04375000000000001 -0.33837890625 -0.487985107421875 -0.043875 -0.330596923828125 -0.487985107421875 -0.04399999999999999 -0.32666015625 -0.487985107421875 -0.044125 -0.31866455078125 -0.487985107421875 -0.04425 -0.310516357421875 -0.487985107421875 -0.044375 -0.30224609375 -0.487985107421875 -0.04449999999999999 -0.298065185546875 -0.487985107421875 -0.04462499999999999 -0.289581298828125 -0.487985107421875 -0.04475 -0.280975341796875 -0.487985107421875 -0.044875 -0.276641845703125 -0.487985107421875 -0.045 -0.267852783203125 -0.487985107421875 -0.045125 -0.25897216796875 -0.487985107421875 -0.04525 -0.249969482421875 -0.487985107421875 -0.045375 -0.24542236328125 -0.487985107421875 -0.0455 -0.236236572265625 -0.487985107421875 -0.045625 -0.226959228515625 -0.487985107421875 -0.04575 -0.2222900390625 -0.487985107421875 -0.045875 -0.212860107421875 -0.487985107421875 -0.046 -0.203338623046875 -0.487985107421875 -0.046125 -0.1937255859375 -0.487985107421875 -0.04625 -0.188873291015625 -0.487985107421875 -0.046375 -0.17913818359375 -0.487985107421875 -0.04649999999999999 -0.169342041015625 -0.487985107421875 -0.046625 -0.164398193359375 -0.487985107421875 -0.04675000000000001 -0.15447998046875 -0.487985107421875 -0.046875 -0.14447021484375 -0.487985107421875 -0.04699999999999999 -0.13946533203125 -0.487985107421875 -0.047125 -0.129364013671875 -0.487985107421875 -0.04725000000000001 -0.119232177734375 -0.487985107421875 -0.047375 -0.109039306640625 -0.487985107421875 -0.0475 -0.103912353515625 -0.487985107421875 -0.047625 -0.093658447265625 -0.487985107421875 -0.04775 -0.083343505859375 -0.487985107421875 -0.047875 -0.07818603515625 -0.487985107421875 -0.048 -0.06781005859375 -0.487985107421875 -0.048125 -0.05743408203125 -0.487985107421875 -0.04825 -0.047027587890625 -0.487985107421875 -0.048375 -0.04180908203125 -0.487985107421875 -0.0485 -0.0313720703125 -0.487985107421875 -0.048625 -0.020904541015625 -0.487985107421875 -0.04875 -0.01568603515625 -0.487985107421875 -0.048875 -0.005218505859375 -0.487985107421875 +0.02625 -0.010467529296875 -0.743977294921875 +0.026375 -0.015716552734375 -0.743977294921875 +0.0265 -0.026153564453125 -0.743977294921875 +0.026625 -0.031402587890625 -0.743977294921875 +0.02675 -0.041839599609375 -0.743977294921875 +0.026875 -0.04705810546875 -0.743977294921875 +0.027 -0.052276611328125 -0.743977294921875 +0.027125 -0.062652587890625 -0.743977294921875 +0.02725 -0.067840576171875 -0.743977294921875 +0.027375 -0.078216552734375 -0.743977294921875 +0.0275 -0.0833740234375 -0.743977294921875 +0.027625 -0.09368896484375 -0.743977294921875 +0.02775 -0.09881591796875 -0.743977294921875 +0.027875 -0.10906982421875 -0.743977294921875 +0.028 -0.114166259765625 -0.743977294921875 +0.028125 -0.1192626953125 -0.743977294921875 +0.02825 -0.12939453125 -0.743977294921875 +0.028375 -0.13446044921875 -0.743977294921875 +0.02850000000000001 -0.144500732421875 -0.743977294921875 +0.028625 -0.149505615234375 -0.743977294921875 +0.02875 -0.15948486328125 -0.743977294921875 +0.028875 -0.1644287109375 -0.743977294921875 +0.029 -0.16937255859375 -0.743977294921875 +0.029125 -0.179168701171875 -0.743977294921875 +0.02925 -0.184051513671875 -0.743977294921875 +0.029375 -0.193756103515625 -0.743977294921875 +0.0295 -0.198577880859375 -0.743977294921875 +0.029625 -0.2081298828125 -0.743977294921875 +0.02975000000000001 -0.212890625 -0.743977294921875 +0.029875 -0.217620849609375 -0.743977294921875 +0.03 -0.22698974609375 -0.743977294921875 +0.030125 -0.23162841796875 -0.743977294921875 +0.03025 -0.240875244140625 -0.743977294921875 +0.030375 -0.245452880859375 -0.743977294921875 +0.0305 -0.254486083984375 -0.743977294921875 +0.030625 -0.259002685546875 -0.743977294921875 +0.03075 -0.263458251953125 -0.743977294921875 +0.03087499999999999 -0.272308349609375 -0.743977294921875 +0.031 -0.27667236328125 -0.743977294921875 +0.031125 -0.28533935546875 -0.743977294921875 +0.03125 -0.28961181640625 -0.743977294921875 +0.031375 -0.298095703125 -0.743977294921875 +0.0315 -0.302276611328125 -0.743977294921875 +0.03162500000000001 -0.310546875 -0.743977294921875 +0.03175 -0.31463623046875 -0.743977294921875 +0.031875 -0.318695068359375 -0.743977294921875 +0.032 -0.326690673828125 -0.487985107421875 +0.032125 -0.33453369140625 -0.487985107421875 +0.03225 -0.342254638671875 -0.487985107421875 +0.032375 -0.346038818359375 -0.487985107421875 +0.0325 -0.353515625 -0.487985107421875 +0.032625 -0.36083984375 -0.487985107421875 +0.03275 -0.364471435546875 -0.487985107421875 +0.032875 -0.371551513671875 -0.487985107421875 +0.033 -0.37847900390625 -0.487985107421875 +0.033125 -0.385223388671875 -0.487985107421875 +0.03325 -0.3885498046875 -0.487985107421875 +0.033375 -0.395050048828125 -0.487985107421875 +0.0335 -0.4013671875 -0.487985107421875 +0.03362500000000001 -0.40447998046875 -0.487985107421875 +0.03375 -0.410552978515625 -0.487985107421875 +0.033875 -0.41644287109375 -0.487985107421875 +0.034 -0.4193115234375 -0.487985107421875 +0.03412500000000001 -0.4249267578125 -0.487985107421875 +0.03425 -0.430328369140625 -0.487985107421875 +0.034375 -0.435577392578125 -0.487985107421875 +0.0345 -0.4381103515625 -0.487985107421875 +0.034625 -0.443084716796875 -0.487985107421875 +0.03475000000000001 -0.44781494140625 -0.487985107421875 +0.034875 -0.45013427734375 -0.487985107421875 +0.035 -0.45458984375 -0.487985107421875 +0.03512500000000001 -0.4588623046875 -0.487985107421875 +0.03525 -0.462921142578125 -0.487985107421875 +0.035375 -0.46484375 -0.487985107421875 +0.0355 -0.468597412109375 -0.487985107421875 +0.03562500000000001 -0.47216796875 -0.487985107421875 +0.03575 -0.473846435546875 -0.487985107421875 +0.035875 -0.477081298828125 -0.487985107421875 +0.03600000000000001 -0.4801025390625 -0.487985107421875 +0.036125 -0.482940673828125 -0.487985107421875 +0.03625 -0.4842529296875 -0.487985107421875 +0.036375 -0.48675537109375 -0.487985107421875 +0.0365 -0.489044189453125 -0.487985107421875 +0.036625 -0.4901123046875 -0.487985107421875 +0.03675 -0.4920654296875 -0.487985107421875 +0.036875 -0.493804931640625 -0.487985107421875 +0.037 -0.495330810546875 -0.487985107421875 +0.03712499999999999 -0.49603271484375 -0.487985107421875 +0.03725 -0.497222900390625 -0.487985107421875 +0.037375 -0.49822998046875 -0.487985107421875 +0.0375 -0.498626708984375 -0.487985107421875 +0.037625 -0.499298095703125 -0.487985107421875 +0.03775 -0.499725341796875 -0.487985107421875 +0.037875 -0.49993896484375 -0.487985107421875 +0.038 -0.499969482421875 -0.487985107421875 +0.038125 -0.499847412109375 -0.487985107421875 +0.03825 -0.499542236328125 -0.487985107421875 +0.038375 -0.499298095703125 -0.487985107421875 +0.0385 -0.498626708984375 -0.487985107421875 +0.038625 -0.49774169921875 -0.487985107421875 +0.03875 -0.49664306640625 -0.487985107421875 +0.038875 -0.49603271484375 -0.487985107421875 +0.039 -0.494598388671875 -0.487985107421875 +0.039125 -0.49298095703125 -0.487985107421875 +0.03925 -0.4920654296875 -0.487985107421875 +0.039375 -0.4901123046875 -0.487985107421875 +0.0395 -0.4879150390625 -0.487985107421875 +0.039625 -0.48553466796875 -0.487985107421875 +0.03975 -0.4842529296875 -0.487985107421875 +0.039875 -0.481536865234375 -0.487985107421875 +0.04 -0.4786376953125 -0.487985107421875 +0.040125 -0.477081298828125 -0.487985107421875 +0.04025 -0.473846435546875 -0.487985107421875 +0.040375 -0.47039794921875 -0.487985107421875 +0.04050000000000001 -0.468597412109375 -0.487985107421875 +0.040625 -0.46484375 -0.487985107421875 +0.04075 -0.460906982421875 -0.487985107421875 +0.040875 -0.456756591796875 -0.487985107421875 +0.04100000000000001 -0.45458984375 -0.487985107421875 +0.041125 -0.45013427734375 -0.487985107421875 +0.04125 -0.445465087890625 -0.487985107421875 +0.041375 -0.443084716796875 -0.487985107421875 +0.0415 -0.4381103515625 -0.487985107421875 +0.041625 -0.4329833984375 -0.487985107421875 +0.04175000000000001 -0.427642822265625 -0.487985107421875 +0.041875 -0.4249267578125 -0.487985107421875 +0.042 -0.4193115234375 -0.487985107421875 +0.042125 -0.41351318359375 -0.487985107421875 +0.04225000000000001 -0.410552978515625 -0.487985107421875 +0.042375 -0.40447998046875 -0.487985107421875 +0.0425 -0.398223876953125 -0.487985107421875 +0.042625 -0.391815185546875 -0.487985107421875 +0.04275 -0.3885498046875 -0.487985107421875 +0.04287500000000001 -0.381866455078125 -0.487985107421875 +0.04300000000000001 -0.375030517578125 -0.487985107421875 +0.043125 -0.371551513671875 -0.487985107421875 +0.04325 -0.364471435546875 -0.487985107421875 +0.043375 -0.357208251953125 -0.487985107421875 +0.04350000000000001 -0.34979248046875 -0.487985107421875 +0.04362500000000001 -0.346038818359375 -0.487985107421875 +0.04375000000000001 -0.338409423828125 -0.487985107421875 +0.043875 -0.33062744140625 -0.487985107421875 +0.04399999999999999 -0.326690673828125 -0.487985107421875 +0.044125 -0.318695068359375 -0.487985107421875 +0.04425 -0.310546875 -0.487985107421875 +0.044375 -0.302276611328125 -0.487985107421875 +0.04449999999999999 -0.298095703125 -0.487985107421875 +0.04462499999999999 -0.28961181640625 -0.487985107421875 +0.04475 -0.281005859375 -0.487985107421875 +0.044875 -0.27667236328125 -0.487985107421875 +0.045 -0.26788330078125 -0.487985107421875 +0.045125 -0.259002685546875 -0.487985107421875 +0.04525 -0.25 -0.487985107421875 +0.045375 -0.245452880859375 -0.487985107421875 +0.0455 -0.23626708984375 -0.487985107421875 +0.045625 -0.22698974609375 -0.487985107421875 +0.04575 -0.222320556640625 -0.487985107421875 +0.045875 -0.212890625 -0.487985107421875 +0.046 -0.203369140625 -0.487985107421875 +0.046125 -0.193756103515625 -0.487985107421875 +0.04625 -0.18890380859375 -0.487985107421875 +0.046375 -0.179168701171875 -0.487985107421875 +0.04649999999999999 -0.16937255859375 -0.487985107421875 +0.046625 -0.1644287109375 -0.487985107421875 +0.04675000000000001 -0.154510498046875 -0.487985107421875 +0.046875 -0.144500732421875 -0.487985107421875 +0.04699999999999999 -0.139495849609375 -0.487985107421875 +0.047125 -0.12939453125 -0.487985107421875 +0.04725000000000001 -0.1192626953125 -0.487985107421875 +0.047375 -0.10906982421875 -0.487985107421875 +0.0475 -0.10394287109375 -0.487985107421875 +0.047625 -0.09368896484375 -0.487985107421875 +0.04775 -0.0833740234375 -0.487985107421875 +0.047875 -0.078216552734375 -0.487985107421875 +0.048 -0.067840576171875 -0.487985107421875 +0.048125 -0.057464599609375 -0.487985107421875 +0.04825 -0.04705810546875 -0.487985107421875 +0.048375 -0.041839599609375 -0.487985107421875 +0.0485 -0.031402587890625 -0.487985107421875 +0.048625 -0.02093505859375 -0.487985107421875 +0.04875 -0.015716552734375 -0.487985107421875 +0.048875 -0.0052490234375 -0.487985107421875 0.049 0.005218505859375 -0.487985107421875 0.04912500000000001 0.01568603515625 -0.487985107421875 0.04925000000000001 0.020904541015625 -0.487985107421875 @@ -556,153 +556,153 @@ 0.06937500000000001 0.0313720703125 -0.2319929199218749 0.06950000000000001 0.01568603515625 -0.2319929199218749 0.069625 0.005218505859375 -0.2319929199218749 -0.06975 -0.005218505859375 -0.2319929199218749 -0.06987500000000001 -0.01568603515625 -0.2319929199218749 -0.07000000000000001 -0.026123046875 -0.2319929199218749 -0.070125 -0.036590576171875 -0.2319929199218749 -0.07025000000000001 -0.047027587890625 -0.2319929199218749 -0.07037500000000001 -0.05743408203125 -0.2319929199218749 -0.07050000000000001 -0.06781005859375 -0.2319929199218749 -0.070625 -0.07818603515625 -0.2319929199218749 -0.07075 -0.0885009765625 -0.2319929199218749 -0.07087500000000001 -0.098785400390625 -0.2319929199218749 -0.07100000000000001 -0.109039306640625 -0.2319929199218749 -0.07112500000000001 -0.119232177734375 -0.2319929199218749 -0.07125000000000002 -0.129364013671875 -0.2319929199218749 -0.07137500000000001 -0.13946533203125 -0.2319929199218749 -0.0715 -0.14947509765625 -0.2319929199218749 -0.07162500000000001 -0.159454345703125 -0.2319929199218749 -0.07175000000000001 -0.169342041015625 -0.2319929199218749 -0.07187500000000001 -0.17913818359375 -0.2319929199218749 -0.07200000000000001 -0.188873291015625 -0.2319929199218749 -0.07212499999999999 -0.19854736328125 -0.2319929199218749 -0.07225 -0.212860107421875 -0.2319929199218749 -0.07237499999999999 -0.2222900390625 -0.2319929199218749 -0.0725 -0.231597900390625 -0.2319929199218749 -0.07262499999999999 -0.2408447265625 -0.2319929199218749 -0.07274999999999999 -0.249969482421875 -0.2319929199218749 -0.072875 -0.25897216796875 -0.2319929199218749 -0.073 -0.267852783203125 -0.2319929199218749 -0.073125 -0.276641845703125 -0.2319929199218749 -0.07324999999999999 -0.285308837890625 -0.2319929199218749 -0.07337499999999999 -0.2938232421875 -0.2319929199218749 -0.0735 -0.30224609375 -0.2319929199218749 -0.073625 -0.310516357421875 -0.2319929199218749 -0.07374999999999999 -0.31866455078125 -0.2319929199218749 -0.073875 -0.32666015625 -0.2319929199218749 -0.074 -0.334503173828125 -0.2319929199218749 -0.074125 -0.34222412109375 -0.2319929199218749 -0.07424999999999999 -0.349761962890625 -0.2319929199218749 -0.07437499999999999 -0.357177734375 -0.2319929199218749 -0.0745 -0.36444091796875 -0.2319929199218749 -0.07462499999999999 -0.37152099609375 -0.2319929199218749 -0.07475 -0.378448486328125 -0.2319929199218749 -0.07487500000000001 -0.38519287109375 -0.2319929199218749 -0.075 -0.39178466796875 -0.2319929199218749 -0.07512499999999999 -0.401336669921875 -0.2319929199218749 -0.07524999999999999 -0.407501220703125 -0.2319929199218749 -0.075375 -0.413482666015625 -0.2319929199218749 -0.0755 -0.419281005859375 -0.2319929199218749 -0.075625 -0.424896240234375 -0.2319929199218749 -0.07574999999999999 -0.4302978515625 -0.2319929199218749 -0.075875 -0.435546875 -0.2319929199218749 -0.076 -0.440582275390625 -0.2319929199218749 -0.076125 -0.4454345703125 -0.2319929199218749 -0.07625 -0.450103759765625 -0.2319929199218749 -0.07637499999999999 -0.454559326171875 -0.2319929199218749 -0.0765 -0.458831787109375 -0.2319929199218749 -0.076625 -0.462890625 -0.2319929199218749 -0.07675 -0.46673583984375 -0.2319929199218749 -0.076875 -0.470367431640625 -0.2319929199218749 -0.077 -0.47381591796875 -0.2319929199218749 -0.077125 -0.47705078125 -0.2319929199218749 -0.07725 -0.480072021484375 -0.2319929199218749 -0.07737499999999999 -0.48291015625 -0.2319929199218749 -0.0775 -0.485504150390625 -0.2319929199218749 -0.077625 -0.487884521484375 -0.2319929199218749 -0.07774999999999999 -0.490081787109375 -0.2319929199218749 -0.07787500000000001 -0.492034912109375 -0.2319929199218749 -0.07800000000000001 -0.49456787109375 -0.2319929199218749 -0.078125 -0.496002197265625 -0.2319929199218749 -0.07824999999999999 -0.4971923828125 -0.2319929199218749 -0.07837499999999999 -0.498199462890625 -0.2319929199218749 -0.07850000000000001 -0.49896240234375 -0.2319929199218749 -0.078625 -0.49951171875 -0.2319929199218749 -0.07875 -0.49981689453125 -0.2319929199218749 -0.07887500000000001 -0.49993896484375 -0.2319929199218749 -0.079 -0.49981689453125 -0.2319929199218749 -0.079125 -0.49951171875 -0.2319929199218749 -0.07925 -0.49896240234375 -0.2319929199218749 -0.079375 -0.498199462890625 -0.2319929199218749 -0.0795 -0.4971923828125 -0.2319929199218749 -0.079625 -0.496002197265625 -0.2319929199218749 -0.07975 -0.49456787109375 -0.2319929199218749 -0.07987500000000001 -0.492950439453125 -0.2319929199218749 -0.08 -0.4910888671875 -0.2319929199218749 -0.08012499999999999 -0.489013671875 -0.2319929199218749 -0.08025 -0.486724853515625 -0.2319929199218749 -0.080375 -0.484222412109375 -0.2319929199218749 -0.08050000000000001 -0.48150634765625 -0.2319929199218749 -0.080625 -0.478607177734375 -0.2319929199218749 -0.08074999999999999 -0.47381591796875 -0.2319929199218749 -0.080875 -0.470367431640625 -0.2319929199218749 -0.08100000000000001 -0.46673583984375 -0.2319929199218749 -0.08112500000000001 -0.462890625 -0.2319929199218749 -0.08125 -0.458831787109375 -0.2319929199218749 -0.08137499999999999 -0.454559326171875 -0.2319929199218749 -0.0815 -0.450103759765625 -0.2319929199218749 -0.081625 -0.4454345703125 -0.2319929199218749 -0.08175000000000001 -0.440582275390625 -0.2319929199218749 -0.081875 -0.435546875 -0.2319929199218749 -0.08200000000000001 -0.4302978515625 -0.2319929199218749 -0.082125 -0.424896240234375 -0.2319929199218749 -0.08225 -0.419281005859375 -0.2319929199218749 -0.08237500000000001 -0.413482666015625 -0.2319929199218749 -0.0825 -0.407501220703125 -0.2319929199218749 -0.08262500000000001 -0.401336669921875 -0.2319929199218749 -0.08275 -0.39501953125 -0.2319929199218749 -0.08287500000000001 -0.388519287109375 -0.2319929199218749 -0.08300000000000001 -0.3818359375 -0.2319929199218749 -0.083125 -0.375 -0.2319929199218749 -0.08324999999999999 -0.36798095703125 -0.2319929199218749 -0.083375 -0.360809326171875 -0.2319929199218749 -0.08350000000000001 -0.353485107421875 -0.2319929199218749 -0.08362500000000001 -0.34222412109375 -0.2319929199218749 -0.08375 -0.334503173828125 -0.2319929199218749 -0.08387500000000001 -0.32666015625 -0.2319929199218749 -0.084 -0.31866455078125 -0.2319929199218749 -0.08412500000000001 -0.310516357421875 -0.2319929199218749 -0.08425000000000001 -0.30224609375 -0.2319929199218749 -0.084375 -0.2938232421875 -0.2319929199218749 -0.08450000000000001 -0.285308837890625 -0.2319929199218749 -0.084625 -0.276641845703125 -0.2319929199218749 -0.08475 -0.267852783203125 -0.2319929199218749 -0.08487500000000001 -0.25897216796875 -0.2319929199218749 -0.085 -0.249969482421875 -0.2319929199218749 -0.08512500000000001 -0.2408447265625 -0.2319929199218749 -0.08525 -0.231597900390625 -0.2319929199218749 -0.085375 -0.2222900390625 -0.2319929199218749 -0.08550000000000001 -0.212860107421875 -0.2319929199218749 -0.085625 -0.203338623046875 -0.2319929199218749 -0.08575000000000001 -0.1937255859375 -0.2319929199218749 -0.08587500000000002 -0.18402099609375 -0.2319929199218749 -0.08600000000000001 -0.17425537109375 -0.2319929199218749 -0.08612500000000001 -0.164398193359375 -0.2319929199218749 -0.08625 -0.15447998046875 -0.2319929199218749 -0.08637499999999999 -0.14447021484375 -0.2319929199218749 -0.0865 -0.129364013671875 -0.2319929199218749 -0.08662500000000001 -0.119232177734375 -0.2319929199218749 -0.08675000000000001 -0.109039306640625 -0.2319929199218749 -0.08687500000000002 -0.098785400390625 -0.2319929199218749 -0.08700000000000001 -0.0885009765625 -0.2319929199218749 -0.087125 -0.07818603515625 -0.2319929199218749 -0.08725000000000001 -0.06781005859375 -0.2319929199218749 -0.08737500000000001 -0.05743408203125 -0.2319929199218749 -0.08750000000000002 -0.047027587890625 -0.2319929199218749 -0.08762500000000001 -0.036590576171875 -0.2319929199218749 -0.08775 -0.026123046875 -0.2319929199218749 -0.08787500000000001 -0.01568603515625 -0.2319929199218749 -0.08799999999999999 -0.005218505859375 -0.2319929199218749 +0.06975 -0.0052490234375 -0.2319929199218749 +0.06987500000000001 -0.015716552734375 -0.2319929199218749 +0.07000000000000001 -0.026153564453125 -0.2319929199218749 +0.070125 -0.03662109375 -0.2319929199218749 +0.07025000000000001 -0.04705810546875 -0.2319929199218749 +0.07037500000000001 -0.057464599609375 -0.2319929199218749 +0.07050000000000001 -0.067840576171875 -0.2319929199218749 +0.070625 -0.078216552734375 -0.2319929199218749 +0.07075 -0.088531494140625 -0.2319929199218749 +0.07087500000000001 -0.09881591796875 -0.2319929199218749 +0.07100000000000001 -0.10906982421875 -0.2319929199218749 +0.07112500000000001 -0.1192626953125 -0.2319929199218749 +0.07125000000000002 -0.12939453125 -0.2319929199218749 +0.07137500000000001 -0.139495849609375 -0.2319929199218749 +0.0715 -0.149505615234375 -0.2319929199218749 +0.07162500000000001 -0.15948486328125 -0.2319929199218749 +0.07175000000000001 -0.16937255859375 -0.2319929199218749 +0.07187500000000001 -0.179168701171875 -0.2319929199218749 +0.07200000000000001 -0.18890380859375 -0.2319929199218749 +0.07212499999999999 -0.198577880859375 -0.2319929199218749 +0.07225 -0.212890625 -0.2319929199218749 +0.07237499999999999 -0.222320556640625 -0.2319929199218749 +0.0725 -0.23162841796875 -0.2319929199218749 +0.07262499999999999 -0.240875244140625 -0.2319929199218749 +0.07274999999999999 -0.25 -0.2319929199218749 +0.072875 -0.259002685546875 -0.2319929199218749 +0.073 -0.26788330078125 -0.2319929199218749 +0.073125 -0.27667236328125 -0.2319929199218749 +0.07324999999999999 -0.28533935546875 -0.2319929199218749 +0.07337499999999999 -0.293853759765625 -0.2319929199218749 +0.0735 -0.302276611328125 -0.2319929199218749 +0.073625 -0.310546875 -0.2319929199218749 +0.07374999999999999 -0.318695068359375 -0.2319929199218749 +0.073875 -0.326690673828125 -0.2319929199218749 +0.074 -0.33453369140625 -0.2319929199218749 +0.074125 -0.342254638671875 -0.2319929199218749 +0.07424999999999999 -0.34979248046875 -0.2319929199218749 +0.07437499999999999 -0.357208251953125 -0.2319929199218749 +0.0745 -0.364471435546875 -0.2319929199218749 +0.07462499999999999 -0.371551513671875 -0.2319929199218749 +0.07475 -0.37847900390625 -0.2319929199218749 +0.07487500000000001 -0.385223388671875 -0.2319929199218749 +0.075 -0.391815185546875 -0.2319929199218749 +0.07512499999999999 -0.4013671875 -0.2319929199218749 +0.07524999999999999 -0.40753173828125 -0.2319929199218749 +0.075375 -0.41351318359375 -0.2319929199218749 +0.0755 -0.4193115234375 -0.2319929199218749 +0.075625 -0.4249267578125 -0.2319929199218749 +0.07574999999999999 -0.430328369140625 -0.2319929199218749 +0.075875 -0.435577392578125 -0.2319929199218749 +0.076 -0.44061279296875 -0.2319929199218749 +0.076125 -0.445465087890625 -0.2319929199218749 +0.07625 -0.45013427734375 -0.2319929199218749 +0.07637499999999999 -0.45458984375 -0.2319929199218749 +0.0765 -0.4588623046875 -0.2319929199218749 +0.076625 -0.462921142578125 -0.2319929199218749 +0.07675 -0.466766357421875 -0.2319929199218749 +0.076875 -0.47039794921875 -0.2319929199218749 +0.077 -0.473846435546875 -0.2319929199218749 +0.077125 -0.477081298828125 -0.2319929199218749 +0.07725 -0.4801025390625 -0.2319929199218749 +0.07737499999999999 -0.482940673828125 -0.2319929199218749 +0.0775 -0.48553466796875 -0.2319929199218749 +0.077625 -0.4879150390625 -0.2319929199218749 +0.07774999999999999 -0.4901123046875 -0.2319929199218749 +0.07787500000000001 -0.4920654296875 -0.2319929199218749 +0.07800000000000001 -0.494598388671875 -0.2319929199218749 +0.078125 -0.49603271484375 -0.2319929199218749 +0.07824999999999999 -0.497222900390625 -0.2319929199218749 +0.07837499999999999 -0.49822998046875 -0.2319929199218749 +0.07850000000000001 -0.498992919921875 -0.2319929199218749 +0.078625 -0.499542236328125 -0.2319929199218749 +0.07875 -0.499847412109375 -0.2319929199218749 +0.07887500000000001 -0.499969482421875 -0.2319929199218749 +0.079 -0.499847412109375 -0.2319929199218749 +0.079125 -0.499542236328125 -0.2319929199218749 +0.07925 -0.498992919921875 -0.2319929199218749 +0.079375 -0.49822998046875 -0.2319929199218749 +0.0795 -0.497222900390625 -0.2319929199218749 +0.079625 -0.49603271484375 -0.2319929199218749 +0.07975 -0.494598388671875 -0.2319929199218749 +0.07987500000000001 -0.49298095703125 -0.2319929199218749 +0.08 -0.491119384765625 -0.2319929199218749 +0.08012499999999999 -0.489044189453125 -0.2319929199218749 +0.08025 -0.48675537109375 -0.2319929199218749 +0.080375 -0.4842529296875 -0.2319929199218749 +0.08050000000000001 -0.481536865234375 -0.2319929199218749 +0.080625 -0.4786376953125 -0.2319929199218749 +0.08074999999999999 -0.473846435546875 -0.2319929199218749 +0.080875 -0.47039794921875 -0.2319929199218749 +0.08100000000000001 -0.466766357421875 -0.2319929199218749 +0.08112500000000001 -0.462921142578125 -0.2319929199218749 +0.08125 -0.4588623046875 -0.2319929199218749 +0.08137499999999999 -0.45458984375 -0.2319929199218749 +0.0815 -0.45013427734375 -0.2319929199218749 +0.081625 -0.445465087890625 -0.2319929199218749 +0.08175000000000001 -0.44061279296875 -0.2319929199218749 +0.081875 -0.435577392578125 -0.2319929199218749 +0.08200000000000001 -0.430328369140625 -0.2319929199218749 +0.082125 -0.4249267578125 -0.2319929199218749 +0.08225 -0.4193115234375 -0.2319929199218749 +0.08237500000000001 -0.41351318359375 -0.2319929199218749 +0.0825 -0.40753173828125 -0.2319929199218749 +0.08262500000000001 -0.4013671875 -0.2319929199218749 +0.08275 -0.395050048828125 -0.2319929199218749 +0.08287500000000001 -0.3885498046875 -0.2319929199218749 +0.08300000000000001 -0.381866455078125 -0.2319929199218749 +0.083125 -0.375030517578125 -0.2319929199218749 +0.08324999999999999 -0.368011474609375 -0.2319929199218749 +0.083375 -0.36083984375 -0.2319929199218749 +0.08350000000000001 -0.353515625 -0.2319929199218749 +0.08362500000000001 -0.342254638671875 -0.2319929199218749 +0.08375 -0.33453369140625 -0.2319929199218749 +0.08387500000000001 -0.326690673828125 -0.2319929199218749 +0.084 -0.318695068359375 -0.2319929199218749 +0.08412500000000001 -0.310546875 -0.2319929199218749 +0.08425000000000001 -0.302276611328125 -0.2319929199218749 +0.084375 -0.293853759765625 -0.2319929199218749 +0.08450000000000001 -0.28533935546875 -0.2319929199218749 +0.084625 -0.27667236328125 -0.2319929199218749 +0.08475 -0.26788330078125 -0.2319929199218749 +0.08487500000000001 -0.259002685546875 -0.2319929199218749 +0.085 -0.25 -0.2319929199218749 +0.08512500000000001 -0.240875244140625 -0.2319929199218749 +0.08525 -0.23162841796875 -0.2319929199218749 +0.085375 -0.222320556640625 -0.2319929199218749 +0.08550000000000001 -0.212890625 -0.2319929199218749 +0.085625 -0.203369140625 -0.2319929199218749 +0.08575000000000001 -0.193756103515625 -0.2319929199218749 +0.08587500000000002 -0.184051513671875 -0.2319929199218749 +0.08600000000000001 -0.174285888671875 -0.2319929199218749 +0.08612500000000001 -0.1644287109375 -0.2319929199218749 +0.08625 -0.154510498046875 -0.2319929199218749 +0.08637499999999999 -0.144500732421875 -0.2319929199218749 +0.0865 -0.12939453125 -0.2319929199218749 +0.08662500000000001 -0.1192626953125 -0.2319929199218749 +0.08675000000000001 -0.10906982421875 -0.2319929199218749 +0.08687500000000002 -0.09881591796875 -0.2319929199218749 +0.08700000000000001 -0.088531494140625 -0.2319929199218749 +0.087125 -0.078216552734375 -0.2319929199218749 +0.08725000000000001 -0.067840576171875 -0.2319929199218749 +0.08737500000000001 -0.057464599609375 -0.2319929199218749 +0.08750000000000002 -0.04705810546875 -0.2319929199218749 +0.08762500000000001 -0.03662109375 -0.2319929199218749 +0.08775 -0.026153564453125 -0.2319929199218749 +0.08787500000000001 -0.015716552734375 -0.2319929199218749 +0.08799999999999999 -0.0052490234375 -0.2319929199218749 0.088125 0.005218505859375 -0.2319929199218749 0.08824999999999999 0.01568603515625 -0.2319929199218749 0.08837499999999999 0.026123046875 -0.2319929199218749 @@ -836,129 +836,129 @@ 0.104375 0.0313720703125 0.02399926757812504 0.1045 0.020904541015625 0.02399926757812504 0.104625 0.005218505859375 0.02399926757812504 -0.10475 -0.005218505859375 0.02399926757812504 -0.104875 -0.020904541015625 0.02399926757812504 -0.105 -0.0313720703125 0.02399926757812504 -0.105125 -0.04180908203125 0.02399926757812504 -0.10525 -0.05743408203125 0.02399926757812504 -0.105375 -0.06781005859375 0.02399926757812504 -0.1055 -0.083343505859375 0.02399926757812504 -0.105625 -0.093658447265625 0.02399926757812504 -0.10575 -0.109039306640625 0.02399926757812504 -0.105875 -0.119232177734375 0.02399926757812504 -0.106 -0.134429931640625 0.02399926757812504 -0.106125 -0.14447021484375 0.02399926757812504 -0.10625 -0.15447998046875 0.02399926757812504 -0.106375 -0.169342041015625 0.02399926757812504 -0.1065 -0.17913818359375 0.02399926757812504 -0.106625 -0.1937255859375 0.02399926757812504 -0.10675 -0.203338623046875 0.02399926757812504 -0.106875 -0.21759033203125 0.02399926757812504 -0.107 -0.226959228515625 0.02399926757812504 -0.107125 -0.2408447265625 0.02399926757812504 -0.10725 -0.249969482421875 0.02399926757812504 -0.107375 -0.25897216796875 0.02399926757812504 -0.1075 -0.27227783203125 0.02399926757812504 -0.107625 -0.280975341796875 0.02399926757812504 -0.10775 -0.2938232421875 0.02399926757812504 -0.107875 -0.30224609375 0.02399926757812504 -0.108 -0.314605712890625 0.02399926757812504 -0.108125 -0.322662353515625 0.02399926757812504 -0.10825 -0.330596923828125 0.02399926757812504 -0.108375 -0.34222412109375 0.02399926757812504 -0.1085 -0.349761962890625 0.02399926757812504 -0.108625 -0.360809326171875 0.02399926757812504 -0.10875 -0.36798095703125 0.02399926757812504 -0.108875 -0.378448486328125 0.02399926757812504 -0.109 -0.38519287109375 0.02399926757812504 -0.109125 -0.39501953125 0.02399926757812504 -0.10925 -0.401336669921875 0.02399926757812504 -0.109375 -0.407501220703125 0.02399926757812504 -0.1095 -0.416412353515625 0.02399926757812504 -0.109625 -0.422119140625 0.02399926757812504 -0.10975 -0.4302978515625 0.02399926757812504 -0.109875 -0.435546875 0.02399926757812504 -0.11 -0.44305419921875 0.02399926757812504 -0.110125 -0.447784423828125 0.02399926757812504 -0.11025 -0.454559326171875 0.02399926757812504 -0.110375 -0.458831787109375 0.02399926757812504 -0.1105 -0.462890625 0.02399926757812504 -0.110625 -0.46856689453125 0.02399926757812504 -0.11075 -0.472137451171875 0.02399926757812504 -0.110875 -0.47705078125 0.02399926757812504 -0.111 -0.480072021484375 0.02399926757812504 -0.111125 -0.484222412109375 0.02399926757812504 -0.11125 -0.486724853515625 0.02399926757812504 -0.111375 -0.490081787109375 0.02399926757812504 -0.1115 -0.492034912109375 0.02399926757812504 -0.111625 -0.4937744140625 0.02399926757812504 -0.11175 -0.496002197265625 0.02399926757812504 -0.111875 -0.4971923828125 0.02399926757812504 -0.112 -0.49859619140625 0.02399926757812504 -0.112125 -0.499267578125 0.02399926757812504 -0.11225 -0.49981689453125 0.02399926757812504 -0.112375 -0.49993896484375 0.02399926757812504 -0.1125 -0.49981689453125 0.02399926757812504 -0.112625 -0.499267578125 0.02399926757812504 -0.11275 -0.49859619140625 0.02399926757812504 -0.112875 -0.4971923828125 0.02399926757812504 -0.113 -0.496002197265625 0.02399926757812504 -0.113125 -0.4937744140625 0.02399926757812504 -0.11325 -0.492034912109375 0.02399926757812504 -0.113375 -0.489013671875 0.02399926757812504 -0.1135 -0.486724853515625 0.02399926757812504 -0.113625 -0.484222412109375 0.02399926757812504 -0.11375 -0.480072021484375 0.02399926757812504 -0.113875 -0.47705078125 0.02399926757812504 -0.114 -0.472137451171875 0.02399926757812504 -0.114125 -0.46856689453125 0.02399926757812504 -0.11425 -0.462890625 0.02399926757812504 -0.114375 -0.458831787109375 0.02399926757812504 -0.1145 -0.452362060546875 0.02399926757812504 -0.114625 -0.447784423828125 0.02399926757812504 -0.11475 -0.44305419921875 0.02399926757812504 -0.114875 -0.435546875 0.02399926757812504 -0.115 -0.4302978515625 0.02399926757812504 -0.115125 -0.422119140625 0.02399926757812504 -0.11525 -0.416412353515625 0.02399926757812504 -0.115375 -0.407501220703125 0.02399926757812504 -0.1155 -0.401336669921875 0.02399926757812504 -0.115625 -0.39178466796875 0.02399926757812504 -0.11575 -0.38519287109375 0.02399926757812504 -0.115875 -0.378448486328125 0.02399926757812504 -0.116 -0.36798095703125 0.02399926757812504 -0.116125 -0.360809326171875 0.02399926757812504 -0.11625 -0.349761962890625 0.02399926757812504 -0.116375 -0.34222412109375 0.02399926757812504 -0.1165 -0.330596923828125 0.02399926757812504 -0.116625 -0.322662353515625 0.02399926757812504 -0.11675 -0.314605712890625 0.02399926757812504 -0.116875 -0.30224609375 0.02399926757812504 -0.117 -0.2938232421875 0.02399926757812504 -0.117125 -0.280975341796875 0.02399926757812504 -0.11725 -0.27227783203125 0.02399926757812504 -0.117375 -0.25897216796875 0.02399926757812504 -0.1175 -0.249969482421875 0.02399926757812504 -0.117625 -0.236236572265625 0.02399926757812504 -0.11775 -0.226959228515625 0.02399926757812504 -0.117875 -0.21759033203125 0.02399926757812504 -0.118 -0.203338623046875 0.02399926757812504 -0.118125 -0.1937255859375 0.02399926757812504 -0.11825 -0.17913818359375 0.02399926757812504 -0.118375 -0.169342041015625 0.02399926757812504 -0.1185 -0.15447998046875 0.02399926757812504 -0.118625 -0.14447021484375 0.02399926757812504 -0.11875 -0.129364013671875 0.02399926757812504 -0.118875 -0.119232177734375 0.02399926757812504 -0.119 -0.109039306640625 0.02399926757812504 -0.119125 -0.093658447265625 0.02399926757812504 -0.11925 -0.083343505859375 0.02399926757812504 -0.119375 -0.06781005859375 0.02399926757812504 -0.1195 -0.05743408203125 0.02399926757812504 -0.119625 -0.04180908203125 0.02399926757812504 -0.11975 -0.0313720703125 0.02399926757812504 -0.119875 -0.01568603515625 0.02399926757812504 -0.12 -0.005218505859375 0.02399926757812504 +0.10475 -0.0052490234375 0.02399926757812504 +0.104875 -0.02093505859375 0.02399926757812504 +0.105 -0.031402587890625 0.02399926757812504 +0.105125 -0.041839599609375 0.02399926757812504 +0.10525 -0.057464599609375 0.02399926757812504 +0.105375 -0.067840576171875 0.02399926757812504 +0.1055 -0.0833740234375 0.02399926757812504 +0.105625 -0.09368896484375 0.02399926757812504 +0.10575 -0.10906982421875 0.02399926757812504 +0.105875 -0.1192626953125 0.02399926757812504 +0.106 -0.13446044921875 0.02399926757812504 +0.106125 -0.144500732421875 0.02399926757812504 +0.10625 -0.154510498046875 0.02399926757812504 +0.106375 -0.16937255859375 0.02399926757812504 +0.1065 -0.179168701171875 0.02399926757812504 +0.106625 -0.193756103515625 0.02399926757812504 +0.10675 -0.203369140625 0.02399926757812504 +0.106875 -0.217620849609375 0.02399926757812504 +0.107 -0.22698974609375 0.02399926757812504 +0.107125 -0.240875244140625 0.02399926757812504 +0.10725 -0.25 0.02399926757812504 +0.107375 -0.259002685546875 0.02399926757812504 +0.1075 -0.272308349609375 0.02399926757812504 +0.107625 -0.281005859375 0.02399926757812504 +0.10775 -0.293853759765625 0.02399926757812504 +0.107875 -0.302276611328125 0.02399926757812504 +0.108 -0.31463623046875 0.02399926757812504 +0.108125 -0.32269287109375 0.02399926757812504 +0.10825 -0.33062744140625 0.02399926757812504 +0.108375 -0.342254638671875 0.02399926757812504 +0.1085 -0.34979248046875 0.02399926757812504 +0.108625 -0.36083984375 0.02399926757812504 +0.10875 -0.368011474609375 0.02399926757812504 +0.108875 -0.37847900390625 0.02399926757812504 +0.109 -0.385223388671875 0.02399926757812504 +0.109125 -0.395050048828125 0.02399926757812504 +0.10925 -0.4013671875 0.02399926757812504 +0.109375 -0.40753173828125 0.02399926757812504 +0.1095 -0.41644287109375 0.02399926757812504 +0.109625 -0.422149658203125 0.02399926757812504 +0.10975 -0.430328369140625 0.02399926757812504 +0.109875 -0.435577392578125 0.02399926757812504 +0.11 -0.443084716796875 0.02399926757812504 +0.110125 -0.44781494140625 0.02399926757812504 +0.11025 -0.45458984375 0.02399926757812504 +0.110375 -0.4588623046875 0.02399926757812504 +0.1105 -0.462921142578125 0.02399926757812504 +0.110625 -0.468597412109375 0.02399926757812504 +0.11075 -0.47216796875 0.02399926757812504 +0.110875 -0.477081298828125 0.02399926757812504 +0.111 -0.4801025390625 0.02399926757812504 +0.111125 -0.4842529296875 0.02399926757812504 +0.11125 -0.48675537109375 0.02399926757812504 +0.111375 -0.4901123046875 0.02399926757812504 +0.1115 -0.4920654296875 0.02399926757812504 +0.111625 -0.493804931640625 0.02399926757812504 +0.11175 -0.49603271484375 0.02399926757812504 +0.111875 -0.497222900390625 0.02399926757812504 +0.112 -0.498626708984375 0.02399926757812504 +0.112125 -0.499298095703125 0.02399926757812504 +0.11225 -0.499847412109375 0.02399926757812504 +0.112375 -0.499969482421875 0.02399926757812504 +0.1125 -0.499847412109375 0.02399926757812504 +0.112625 -0.499298095703125 0.02399926757812504 +0.11275 -0.498626708984375 0.02399926757812504 +0.112875 -0.497222900390625 0.02399926757812504 +0.113 -0.49603271484375 0.02399926757812504 +0.113125 -0.493804931640625 0.02399926757812504 +0.11325 -0.4920654296875 0.02399926757812504 +0.113375 -0.489044189453125 0.02399926757812504 +0.1135 -0.48675537109375 0.02399926757812504 +0.113625 -0.4842529296875 0.02399926757812504 +0.11375 -0.4801025390625 0.02399926757812504 +0.113875 -0.477081298828125 0.02399926757812504 +0.114 -0.47216796875 0.02399926757812504 +0.114125 -0.468597412109375 0.02399926757812504 +0.11425 -0.462921142578125 0.02399926757812504 +0.114375 -0.4588623046875 0.02399926757812504 +0.1145 -0.452392578125 0.02399926757812504 +0.114625 -0.44781494140625 0.02399926757812504 +0.11475 -0.443084716796875 0.02399926757812504 +0.114875 -0.435577392578125 0.02399926757812504 +0.115 -0.430328369140625 0.02399926757812504 +0.115125 -0.422149658203125 0.02399926757812504 +0.11525 -0.41644287109375 0.02399926757812504 +0.115375 -0.40753173828125 0.02399926757812504 +0.1155 -0.4013671875 0.02399926757812504 +0.115625 -0.391815185546875 0.02399926757812504 +0.11575 -0.385223388671875 0.02399926757812504 +0.115875 -0.37847900390625 0.02399926757812504 +0.116 -0.368011474609375 0.02399926757812504 +0.116125 -0.36083984375 0.02399926757812504 +0.11625 -0.34979248046875 0.02399926757812504 +0.116375 -0.342254638671875 0.02399926757812504 +0.1165 -0.33062744140625 0.02399926757812504 +0.116625 -0.32269287109375 0.02399926757812504 +0.11675 -0.31463623046875 0.02399926757812504 +0.116875 -0.302276611328125 0.02399926757812504 +0.117 -0.293853759765625 0.02399926757812504 +0.117125 -0.281005859375 0.02399926757812504 +0.11725 -0.272308349609375 0.02399926757812504 +0.117375 -0.259002685546875 0.02399926757812504 +0.1175 -0.25 0.02399926757812504 +0.117625 -0.23626708984375 0.02399926757812504 +0.11775 -0.22698974609375 0.02399926757812504 +0.117875 -0.217620849609375 0.02399926757812504 +0.118 -0.203369140625 0.02399926757812504 +0.118125 -0.193756103515625 0.02399926757812504 +0.11825 -0.179168701171875 0.02399926757812504 +0.118375 -0.16937255859375 0.02399926757812504 +0.1185 -0.154510498046875 0.02399926757812504 +0.118625 -0.144500732421875 0.02399926757812504 +0.11875 -0.12939453125 0.02399926757812504 +0.118875 -0.1192626953125 0.02399926757812504 +0.119 -0.10906982421875 0.02399926757812504 +0.119125 -0.09368896484375 0.02399926757812504 +0.11925 -0.0833740234375 0.02399926757812504 +0.119375 -0.067840576171875 0.02399926757812504 +0.1195 -0.057464599609375 0.02399926757812504 +0.119625 -0.041839599609375 0.02399926757812504 +0.11975 -0.031402587890625 0.02399926757812504 +0.119875 -0.015716552734375 0.02399926757812504 +0.12 -0.0052490234375 0.02399926757812504 0.120125 0.005218505859375 0.02399926757812504 0.12025 0.020904541015625 0.02399926757812504 0.120375 0.0313720703125 0.02399926757812504 @@ -1072,109 +1072,109 @@ 0.133875 0.036590576171875 0.2799914550781251 0.134 0.020904541015625 0.2799914550781251 0.134125 0.01043701171875 0.2799914550781251 -0.13425 -0.005218505859375 0.2799914550781251 -0.134375 -0.020904541015625 0.2799914550781251 -0.1345 -0.036590576171875 0.2799914550781251 -0.134625 -0.05224609375 0.2799914550781251 -0.13475 -0.06781005859375 0.2799914550781251 -0.134875 -0.083343505859375 0.2799914550781251 -0.135 -0.098785400390625 0.2799914550781251 -0.135125 -0.1141357421875 0.2799914550781251 -0.13525 -0.129364013671875 0.2799914550781251 -0.135375 -0.14447021484375 0.2799914550781251 -0.1355 -0.159454345703125 0.2799914550781251 -0.135625 -0.169342041015625 0.2799914550781251 -0.13575 -0.18402099609375 0.2799914550781251 -0.135875 -0.19854736328125 0.2799914550781251 -0.136 -0.212860107421875 0.2799914550781251 -0.136125 -0.226959228515625 0.2799914550781251 -0.13625 -0.2408447265625 0.2799914550781251 -0.136375 -0.25445556640625 0.2799914550781251 -0.1365 -0.267852783203125 0.2799914550781251 -0.136625 -0.280975341796875 0.2799914550781251 -0.13675 -0.2938232421875 0.2799914550781251 -0.136875 -0.306396484375 0.2799914550781251 -0.137 -0.31866455078125 0.2799914550781251 -0.137125 -0.32666015625 0.2799914550781251 -0.13725 -0.33837890625 0.2799914550781251 -0.137375 -0.349761962890625 0.2799914550781251 -0.1375 -0.360809326171875 0.2799914550781251 -0.137625 -0.37152099609375 0.2799914550781251 -0.13775 -0.3818359375 0.2799914550781251 -0.137875 -0.39178466796875 0.2799914550781251 -0.138 -0.401336669921875 0.2799914550781251 -0.138125 -0.4105224609375 0.2799914550781251 -0.13825 -0.419281005859375 0.2799914550781251 -0.138375 -0.4276123046875 0.2799914550781251 -0.1385 -0.435546875 0.2799914550781251 -0.138625 -0.440582275390625 0.2799914550781251 -0.13875 -0.447784423828125 0.2799914550781251 -0.138875 -0.454559326171875 0.2799914550781251 -0.139 -0.46087646484375 0.2799914550781251 -0.139125 -0.46673583984375 0.2799914550781251 -0.13925 -0.472137451171875 0.2799914550781251 -0.139375 -0.47705078125 0.2799914550781251 -0.1395 -0.48150634765625 0.2799914550781251 -0.139625 -0.485504150390625 0.2799914550781251 -0.13975 -0.489013671875 0.2799914550781251 -0.139875 -0.492034912109375 0.2799914550781251 -0.14 -0.4937744140625 0.2799914550781251 -0.140125 -0.496002197265625 0.2799914550781251 -0.14025 -0.497711181640625 0.2799914550781251 -0.140375 -0.49896240234375 0.2799914550781251 -0.1405 -0.49969482421875 0.2799914550781251 -0.140625 -0.49993896484375 0.2799914550781251 -0.14075 -0.49969482421875 0.2799914550781251 -0.140875 -0.49896240234375 0.2799914550781251 -0.141 -0.497711181640625 0.2799914550781251 -0.141125 -0.496002197265625 0.2799914550781251 -0.14125 -0.4937744140625 0.2799914550781251 -0.141375 -0.4910888671875 0.2799914550781251 -0.1415 -0.489013671875 0.2799914550781251 -0.141625 -0.485504150390625 0.2799914550781251 -0.14175 -0.48150634765625 0.2799914550781251 -0.141875 -0.47705078125 0.2799914550781251 -0.142 -0.472137451171875 0.2799914550781251 -0.142125 -0.46673583984375 0.2799914550781251 -0.14225 -0.46087646484375 0.2799914550781251 -0.142375 -0.454559326171875 0.2799914550781251 -0.1425 -0.447784423828125 0.2799914550781251 -0.142625 -0.440582275390625 0.2799914550781251 -0.14275 -0.432952880859375 0.2799914550781251 -0.142875 -0.424896240234375 0.2799914550781251 -0.143 -0.419281005859375 0.2799914550781251 -0.143125 -0.4105224609375 0.2799914550781251 -0.14325 -0.401336669921875 0.2799914550781251 -0.143375 -0.39178466796875 0.2799914550781251 -0.1435 -0.3818359375 0.2799914550781251 -0.143625 -0.37152099609375 0.2799914550781251 -0.14375 -0.360809326171875 0.2799914550781251 -0.143875 -0.349761962890625 0.2799914550781251 -0.144 -0.33837890625 0.2799914550781251 -0.144125 -0.32666015625 0.2799914550781251 -0.14425 -0.314605712890625 0.2799914550781251 -0.144375 -0.30224609375 0.2799914550781251 -0.1445 -0.2938232421875 0.2799914550781251 -0.144625 -0.280975341796875 0.2799914550781251 -0.14475 -0.267852783203125 0.2799914550781251 -0.144875 -0.25445556640625 0.2799914550781251 -0.145 -0.2408447265625 0.2799914550781251 -0.145125 -0.226959228515625 0.2799914550781251 -0.14525 -0.212860107421875 0.2799914550781251 -0.145375 -0.19854736328125 0.2799914550781251 -0.1455 -0.18402099609375 0.2799914550781251 -0.145625 -0.169342041015625 0.2799914550781251 -0.14575 -0.15447998046875 0.2799914550781251 -0.145875 -0.13946533203125 0.2799914550781251 -0.146 -0.129364013671875 0.2799914550781251 -0.146125 -0.1141357421875 0.2799914550781251 -0.14625 -0.098785400390625 0.2799914550781251 -0.146375 -0.083343505859375 0.2799914550781251 -0.1465 -0.06781005859375 0.2799914550781251 -0.146625 -0.05224609375 0.2799914550781251 -0.14675 -0.036590576171875 0.2799914550781251 -0.146875 -0.020904541015625 0.2799914550781251 -0.147 -0.005218505859375 0.2799914550781251 +0.13425 -0.0052490234375 0.2799914550781251 +0.134375 -0.02093505859375 0.2799914550781251 +0.1345 -0.03662109375 0.2799914550781251 +0.134625 -0.052276611328125 0.2799914550781251 +0.13475 -0.067840576171875 0.2799914550781251 +0.134875 -0.0833740234375 0.2799914550781251 +0.135 -0.09881591796875 0.2799914550781251 +0.135125 -0.114166259765625 0.2799914550781251 +0.13525 -0.12939453125 0.2799914550781251 +0.135375 -0.144500732421875 0.2799914550781251 +0.1355 -0.15948486328125 0.2799914550781251 +0.135625 -0.16937255859375 0.2799914550781251 +0.13575 -0.184051513671875 0.2799914550781251 +0.135875 -0.198577880859375 0.2799914550781251 +0.136 -0.212890625 0.2799914550781251 +0.136125 -0.22698974609375 0.2799914550781251 +0.13625 -0.240875244140625 0.2799914550781251 +0.136375 -0.254486083984375 0.2799914550781251 +0.1365 -0.26788330078125 0.2799914550781251 +0.136625 -0.281005859375 0.2799914550781251 +0.13675 -0.293853759765625 0.2799914550781251 +0.136875 -0.306427001953125 0.2799914550781251 +0.137 -0.318695068359375 0.2799914550781251 +0.137125 -0.326690673828125 0.2799914550781251 +0.13725 -0.338409423828125 0.2799914550781251 +0.137375 -0.34979248046875 0.2799914550781251 +0.1375 -0.36083984375 0.2799914550781251 +0.137625 -0.371551513671875 0.2799914550781251 +0.13775 -0.381866455078125 0.2799914550781251 +0.137875 -0.391815185546875 0.2799914550781251 +0.138 -0.4013671875 0.2799914550781251 +0.138125 -0.410552978515625 0.2799914550781251 +0.13825 -0.4193115234375 0.2799914550781251 +0.138375 -0.427642822265625 0.2799914550781251 +0.1385 -0.435577392578125 0.2799914550781251 +0.138625 -0.44061279296875 0.2799914550781251 +0.13875 -0.44781494140625 0.2799914550781251 +0.138875 -0.45458984375 0.2799914550781251 +0.139 -0.460906982421875 0.2799914550781251 +0.139125 -0.466766357421875 0.2799914550781251 +0.13925 -0.47216796875 0.2799914550781251 +0.139375 -0.477081298828125 0.2799914550781251 +0.1395 -0.481536865234375 0.2799914550781251 +0.139625 -0.48553466796875 0.2799914550781251 +0.13975 -0.489044189453125 0.2799914550781251 +0.139875 -0.4920654296875 0.2799914550781251 +0.14 -0.493804931640625 0.2799914550781251 +0.140125 -0.49603271484375 0.2799914550781251 +0.14025 -0.49774169921875 0.2799914550781251 +0.140375 -0.498992919921875 0.2799914550781251 +0.1405 -0.499725341796875 0.2799914550781251 +0.140625 -0.499969482421875 0.2799914550781251 +0.14075 -0.499725341796875 0.2799914550781251 +0.140875 -0.498992919921875 0.2799914550781251 +0.141 -0.49774169921875 0.2799914550781251 +0.141125 -0.49603271484375 0.2799914550781251 +0.14125 -0.493804931640625 0.2799914550781251 +0.141375 -0.491119384765625 0.2799914550781251 +0.1415 -0.489044189453125 0.2799914550781251 +0.141625 -0.48553466796875 0.2799914550781251 +0.14175 -0.481536865234375 0.2799914550781251 +0.141875 -0.477081298828125 0.2799914550781251 +0.142 -0.47216796875 0.2799914550781251 +0.142125 -0.466766357421875 0.2799914550781251 +0.14225 -0.460906982421875 0.2799914550781251 +0.142375 -0.45458984375 0.2799914550781251 +0.1425 -0.44781494140625 0.2799914550781251 +0.142625 -0.44061279296875 0.2799914550781251 +0.14275 -0.4329833984375 0.2799914550781251 +0.142875 -0.4249267578125 0.2799914550781251 +0.143 -0.4193115234375 0.2799914550781251 +0.143125 -0.410552978515625 0.2799914550781251 +0.14325 -0.4013671875 0.2799914550781251 +0.143375 -0.391815185546875 0.2799914550781251 +0.1435 -0.381866455078125 0.2799914550781251 +0.143625 -0.371551513671875 0.2799914550781251 +0.14375 -0.36083984375 0.2799914550781251 +0.143875 -0.34979248046875 0.2799914550781251 +0.144 -0.338409423828125 0.2799914550781251 +0.144125 -0.326690673828125 0.2799914550781251 +0.14425 -0.31463623046875 0.2799914550781251 +0.144375 -0.302276611328125 0.2799914550781251 +0.1445 -0.293853759765625 0.2799914550781251 +0.144625 -0.281005859375 0.2799914550781251 +0.14475 -0.26788330078125 0.2799914550781251 +0.144875 -0.254486083984375 0.2799914550781251 +0.145 -0.240875244140625 0.2799914550781251 +0.145125 -0.22698974609375 0.2799914550781251 +0.14525 -0.212890625 0.2799914550781251 +0.145375 -0.198577880859375 0.2799914550781251 +0.1455 -0.184051513671875 0.2799914550781251 +0.145625 -0.16937255859375 0.2799914550781251 +0.14575 -0.154510498046875 0.2799914550781251 +0.145875 -0.139495849609375 0.2799914550781251 +0.146 -0.12939453125 0.2799914550781251 +0.146125 -0.114166259765625 0.2799914550781251 +0.14625 -0.09881591796875 0.2799914550781251 +0.146375 -0.0833740234375 0.2799914550781251 +0.1465 -0.067840576171875 0.2799914550781251 +0.146625 -0.052276611328125 0.2799914550781251 +0.14675 -0.03662109375 0.2799914550781251 +0.146875 -0.02093505859375 0.2799914550781251 +0.147 -0.0052490234375 0.2799914550781251 0.147125 0.01043701171875 0.2799914550781251 0.14725 0.026123046875 0.2799914550781251 0.147375 0.036590576171875 0.2799914550781251 @@ -1278,92 +1278,92 @@ 0.159625 0.036590576171875 0.2799914550781251 0.15975 0.020904541015625 0.2799914550781251 0.159875 0.005218505859375 0.2799914550781251 -0.16 -0.01043701171875 0.535983642578125 -0.160125 -0.0313720703125 0.535983642578125 -0.16025 -0.047027587890625 0.535983642578125 -0.160375 -0.06781005859375 0.535983642578125 -0.1605 -0.083343505859375 0.535983642578125 -0.160625 -0.103912353515625 0.535983642578125 -0.16075 -0.119232177734375 0.535983642578125 -0.160875 -0.13946533203125 0.535983642578125 -0.161 -0.15447998046875 0.535983642578125 -0.161125 -0.17425537109375 0.535983642578125 -0.16125 -0.188873291015625 0.535983642578125 -0.161375 -0.208099365234375 0.535983642578125 -0.1615 -0.2222900390625 0.535983642578125 -0.161625 -0.2408447265625 0.535983642578125 -0.16175 -0.25445556640625 0.535983642578125 -0.161875 -0.27227783203125 0.535983642578125 -0.162 -0.285308837890625 0.535983642578125 -0.162125 -0.30224609375 0.535983642578125 -0.16225 -0.314605712890625 0.535983642578125 -0.162375 -0.330596923828125 0.535983642578125 -0.1625 -0.34222412109375 0.535983642578125 -0.162625 -0.357177734375 0.535983642578125 -0.16275 -0.36798095703125 0.535983642578125 -0.162875 -0.3818359375 0.535983642578125 -0.163 -0.39178466796875 0.535983642578125 -0.163125 -0.404449462890625 0.535983642578125 -0.16325 -0.413482666015625 0.535983642578125 -0.163375 -0.422119140625 0.535983642578125 -0.1635 -0.432952880859375 0.535983642578125 -0.163625 -0.440582275390625 0.535983642578125 -0.16375 -0.450103759765625 0.535983642578125 -0.163875 -0.45672607421875 0.535983642578125 -0.164 -0.464813232421875 0.535983642578125 -0.164125 -0.470367431640625 0.535983642578125 -0.16425 -0.47705078125 0.535983642578125 -0.164375 -0.48150634765625 0.535983642578125 -0.1645 -0.486724853515625 0.535983642578125 -0.164625 -0.490081787109375 0.535983642578125 -0.16475 -0.4937744140625 0.535983642578125 -0.164875 -0.496002197265625 0.535983642578125 -0.165 -0.498199462890625 0.535983642578125 -0.165125 -0.499267578125 0.535983642578125 -0.16525 -0.499908447265625 0.535983642578125 -0.165375 -0.49981689453125 0.535983642578125 -0.1655 -0.49896240234375 0.535983642578125 -0.165625 -0.497711181640625 0.535983642578125 -0.16575 -0.49530029296875 0.535983642578125 -0.165875 -0.492950439453125 0.535983642578125 -0.166 -0.489013671875 0.535983642578125 -0.166125 -0.485504150390625 0.535983642578125 -0.16625 -0.480072021484375 0.535983642578125 -0.166375 -0.4754638671875 0.535983642578125 -0.1665 -0.46856689453125 0.535983642578125 -0.166625 -0.462890625 0.535983642578125 -0.16675 -0.45672607421875 0.535983642578125 -0.166875 -0.447784423828125 0.535983642578125 -0.167 -0.440582275390625 0.535983642578125 -0.167125 -0.4302978515625 0.535983642578125 -0.16725 -0.422119140625 0.535983642578125 -0.167375 -0.4105224609375 0.535983642578125 -0.1675 -0.401336669921875 0.535983642578125 -0.167625 -0.388519287109375 0.535983642578125 -0.16775 -0.378448486328125 0.535983642578125 -0.167875 -0.36444091796875 0.535983642578125 -0.168 -0.353485107421875 0.535983642578125 -0.168125 -0.33837890625 0.535983642578125 -0.16825 -0.32666015625 0.535983642578125 -0.168375 -0.310516357421875 0.535983642578125 -0.1685 -0.298065185546875 0.535983642578125 -0.168625 -0.280975341796875 0.535983642578125 -0.16875 -0.267852783203125 0.535983642578125 -0.168875 -0.249969482421875 0.535983642578125 -0.169 -0.236236572265625 0.535983642578125 -0.169125 -0.21759033203125 0.535983642578125 -0.16925 -0.203338623046875 0.535983642578125 -0.169375 -0.18402099609375 0.535983642578125 -0.1695 -0.169342041015625 0.535983642578125 -0.169625 -0.14947509765625 0.535983642578125 -0.16975 -0.134429931640625 0.535983642578125 -0.169875 -0.119232177734375 0.535983642578125 -0.17 -0.098785400390625 0.535983642578125 -0.170125 -0.083343505859375 0.535983642578125 -0.17025 -0.0626220703125 0.535983642578125 -0.170375 -0.047027587890625 0.535983642578125 -0.1705 -0.026123046875 0.535983642578125 -0.170625 -0.01043701171875 0.535983642578125 +0.16 -0.010467529296875 0.535983642578125 +0.160125 -0.031402587890625 0.535983642578125 +0.16025 -0.04705810546875 0.535983642578125 +0.160375 -0.067840576171875 0.535983642578125 +0.1605 -0.0833740234375 0.535983642578125 +0.160625 -0.10394287109375 0.535983642578125 +0.16075 -0.1192626953125 0.535983642578125 +0.160875 -0.139495849609375 0.535983642578125 +0.161 -0.154510498046875 0.535983642578125 +0.161125 -0.174285888671875 0.535983642578125 +0.16125 -0.18890380859375 0.535983642578125 +0.161375 -0.2081298828125 0.535983642578125 +0.1615 -0.222320556640625 0.535983642578125 +0.161625 -0.240875244140625 0.535983642578125 +0.16175 -0.254486083984375 0.535983642578125 +0.161875 -0.272308349609375 0.535983642578125 +0.162 -0.28533935546875 0.535983642578125 +0.162125 -0.302276611328125 0.535983642578125 +0.16225 -0.31463623046875 0.535983642578125 +0.162375 -0.33062744140625 0.535983642578125 +0.1625 -0.342254638671875 0.535983642578125 +0.162625 -0.357208251953125 0.535983642578125 +0.16275 -0.368011474609375 0.535983642578125 +0.162875 -0.381866455078125 0.535983642578125 +0.163 -0.391815185546875 0.535983642578125 +0.163125 -0.40447998046875 0.535983642578125 +0.16325 -0.41351318359375 0.535983642578125 +0.163375 -0.422149658203125 0.535983642578125 +0.1635 -0.4329833984375 0.535983642578125 +0.163625 -0.44061279296875 0.535983642578125 +0.16375 -0.45013427734375 0.535983642578125 +0.163875 -0.456756591796875 0.535983642578125 +0.164 -0.46484375 0.535983642578125 +0.164125 -0.47039794921875 0.535983642578125 +0.16425 -0.477081298828125 0.535983642578125 +0.164375 -0.481536865234375 0.535983642578125 +0.1645 -0.48675537109375 0.535983642578125 +0.164625 -0.4901123046875 0.535983642578125 +0.16475 -0.493804931640625 0.535983642578125 +0.164875 -0.49603271484375 0.535983642578125 +0.165 -0.49822998046875 0.535983642578125 +0.165125 -0.499298095703125 0.535983642578125 +0.16525 -0.49993896484375 0.535983642578125 +0.165375 -0.499847412109375 0.535983642578125 +0.1655 -0.498992919921875 0.535983642578125 +0.165625 -0.49774169921875 0.535983642578125 +0.16575 -0.495330810546875 0.535983642578125 +0.165875 -0.49298095703125 0.535983642578125 +0.166 -0.489044189453125 0.535983642578125 +0.166125 -0.48553466796875 0.535983642578125 +0.16625 -0.4801025390625 0.535983642578125 +0.166375 -0.475494384765625 0.535983642578125 +0.1665 -0.468597412109375 0.535983642578125 +0.166625 -0.462921142578125 0.535983642578125 +0.16675 -0.456756591796875 0.535983642578125 +0.166875 -0.44781494140625 0.535983642578125 +0.167 -0.44061279296875 0.535983642578125 +0.167125 -0.430328369140625 0.535983642578125 +0.16725 -0.422149658203125 0.535983642578125 +0.167375 -0.410552978515625 0.535983642578125 +0.1675 -0.4013671875 0.535983642578125 +0.167625 -0.3885498046875 0.535983642578125 +0.16775 -0.37847900390625 0.535983642578125 +0.167875 -0.364471435546875 0.535983642578125 +0.168 -0.353515625 0.535983642578125 +0.168125 -0.338409423828125 0.535983642578125 +0.16825 -0.326690673828125 0.535983642578125 +0.168375 -0.310546875 0.535983642578125 +0.1685 -0.298095703125 0.535983642578125 +0.168625 -0.281005859375 0.535983642578125 +0.16875 -0.26788330078125 0.535983642578125 +0.168875 -0.25 0.535983642578125 +0.169 -0.23626708984375 0.535983642578125 +0.169125 -0.217620849609375 0.535983642578125 +0.16925 -0.203369140625 0.535983642578125 +0.169375 -0.184051513671875 0.535983642578125 +0.1695 -0.16937255859375 0.535983642578125 +0.169625 -0.149505615234375 0.535983642578125 +0.16975 -0.13446044921875 0.535983642578125 +0.169875 -0.1192626953125 0.535983642578125 +0.17 -0.09881591796875 0.535983642578125 +0.170125 -0.0833740234375 0.535983642578125 +0.17025 -0.062652587890625 0.535983642578125 +0.170375 -0.04705810546875 0.535983642578125 +0.1705 -0.026153564453125 0.535983642578125 +0.170625 -0.010467529296875 0.535983642578125 0.17075 0.01043701171875 0.535983642578125 0.170875 0.026123046875 0.535983642578125 0.171 0.047027587890625 0.535983642578125 @@ -1450,92 +1450,92 @@ 0.181125 0.047027587890625 0.535983642578125 0.18125 0.0313720703125 0.535983642578125 0.181375 0.01043701171875 0.535983642578125 -0.1815 -0.005218505859375 0.535983642578125 -0.181625 -0.026123046875 0.535983642578125 -0.18175 -0.04180908203125 0.535983642578125 -0.181875 -0.0626220703125 0.535983642578125 -0.182 -0.07818603515625 0.535983642578125 -0.182125 -0.098785400390625 0.535983642578125 -0.18225 -0.1141357421875 0.535983642578125 -0.182375 -0.134429931640625 0.535983642578125 -0.1825 -0.14947509765625 0.535983642578125 -0.182625 -0.169342041015625 0.535983642578125 -0.18275 -0.18402099609375 0.535983642578125 -0.182875 -0.203338623046875 0.535983642578125 -0.183 -0.21759033203125 0.535983642578125 -0.183125 -0.236236572265625 0.535983642578125 -0.18325 -0.249969482421875 0.535983642578125 -0.183375 -0.263427734375 0.535983642578125 -0.1835 -0.280975341796875 0.535983642578125 -0.183625 -0.2938232421875 0.535983642578125 -0.18375 -0.310516357421875 0.535983642578125 -0.183875 -0.322662353515625 0.535983642578125 -0.184 -0.33837890625 0.535983642578125 -0.184125 -0.349761962890625 0.535983642578125 -0.18425 -0.36444091796875 0.535983642578125 -0.184375 -0.375 0.535983642578125 -0.1845 -0.388519287109375 0.535983642578125 -0.184625 -0.398193359375 0.535983642578125 -0.18475 -0.4105224609375 0.535983642578125 -0.184875 -0.419281005859375 0.535983642578125 -0.185 -0.4302978515625 0.535983642578125 -0.185125 -0.438079833984375 0.535983642578125 -0.18525 -0.447784423828125 0.535983642578125 -0.185375 -0.454559326171875 0.535983642578125 -0.1855 -0.462890625 0.535983642578125 -0.185625 -0.46856689453125 0.535983642578125 -0.18575 -0.4754638671875 0.535983642578125 -0.185875 -0.480072021484375 0.535983642578125 -0.186 -0.485504150390625 0.535983642578125 -0.186125 -0.489013671875 0.535983642578125 -0.18625 -0.492950439453125 0.535983642578125 -0.186375 -0.49530029296875 0.535983642578125 -0.1865 -0.4971923828125 0.535983642578125 -0.186625 -0.49896240234375 0.535983642578125 -0.18675 -0.49969482421875 0.535983642578125 -0.186875 -0.499908447265625 0.535983642578125 -0.187 -0.49951171875 0.535983642578125 -0.187125 -0.498199462890625 0.535983642578125 -0.18725 -0.496612548828125 0.535983642578125 -0.187375 -0.4937744140625 0.535983642578125 -0.1875 -0.4910888671875 0.535983642578125 -0.187625 -0.486724853515625 0.535983642578125 -0.18775 -0.48291015625 0.535983642578125 -0.187875 -0.47705078125 0.535983642578125 -0.188 -0.472137451171875 0.535983642578125 -0.188125 -0.464813232421875 0.535983642578125 -0.18825 -0.458831787109375 0.535983642578125 -0.188375 -0.450103759765625 0.535983642578125 -0.1885 -0.44305419921875 0.535983642578125 -0.188625 -0.432952880859375 0.535983642578125 -0.18875 -0.424896240234375 0.535983642578125 -0.188875 -0.413482666015625 0.535983642578125 -0.189 -0.404449462890625 0.535983642578125 -0.189125 -0.39178466796875 0.535983642578125 -0.18925 -0.3818359375 0.535983642578125 -0.189375 -0.36798095703125 0.535983642578125 -0.1895 -0.357177734375 0.535983642578125 -0.189625 -0.34222412109375 0.535983642578125 -0.18975 -0.330596923828125 0.535983642578125 -0.189875 -0.31866455078125 0.535983642578125 -0.19 -0.30224609375 0.535983642578125 -0.190125 -0.289581298828125 0.535983642578125 -0.19025 -0.27227783203125 0.535983642578125 -0.190375 -0.25897216796875 0.535983642578125 -0.1905 -0.2408447265625 0.535983642578125 -0.190625 -0.226959228515625 0.535983642578125 -0.19075 -0.208099365234375 0.535983642578125 -0.190875 -0.1937255859375 0.535983642578125 -0.191 -0.17425537109375 0.535983642578125 -0.191125 -0.159454345703125 0.535983642578125 -0.19125 -0.13946533203125 0.535983642578125 -0.191375 -0.124298095703125 0.535983642578125 -0.1915 -0.103912353515625 0.535983642578125 -0.191625 -0.0885009765625 0.535983642578125 -0.19175 -0.06781005859375 0.535983642578125 -0.191875 -0.05224609375 0.535983642578125 -0.192 -0.0313720703125 0.791975830078125 -0.192125 -0.005218505859375 0.791975830078125 +0.1815 -0.0052490234375 0.535983642578125 +0.181625 -0.026153564453125 0.535983642578125 +0.18175 -0.041839599609375 0.535983642578125 +0.181875 -0.062652587890625 0.535983642578125 +0.182 -0.078216552734375 0.535983642578125 +0.182125 -0.09881591796875 0.535983642578125 +0.18225 -0.114166259765625 0.535983642578125 +0.182375 -0.13446044921875 0.535983642578125 +0.1825 -0.149505615234375 0.535983642578125 +0.182625 -0.16937255859375 0.535983642578125 +0.18275 -0.184051513671875 0.535983642578125 +0.182875 -0.203369140625 0.535983642578125 +0.183 -0.217620849609375 0.535983642578125 +0.183125 -0.23626708984375 0.535983642578125 +0.18325 -0.25 0.535983642578125 +0.183375 -0.263458251953125 0.535983642578125 +0.1835 -0.281005859375 0.535983642578125 +0.183625 -0.293853759765625 0.535983642578125 +0.18375 -0.310546875 0.535983642578125 +0.183875 -0.32269287109375 0.535983642578125 +0.184 -0.338409423828125 0.535983642578125 +0.184125 -0.34979248046875 0.535983642578125 +0.18425 -0.364471435546875 0.535983642578125 +0.184375 -0.375030517578125 0.535983642578125 +0.1845 -0.3885498046875 0.535983642578125 +0.184625 -0.398223876953125 0.535983642578125 +0.18475 -0.410552978515625 0.535983642578125 +0.184875 -0.4193115234375 0.535983642578125 +0.185 -0.430328369140625 0.535983642578125 +0.185125 -0.4381103515625 0.535983642578125 +0.18525 -0.44781494140625 0.535983642578125 +0.185375 -0.45458984375 0.535983642578125 +0.1855 -0.462921142578125 0.535983642578125 +0.185625 -0.468597412109375 0.535983642578125 +0.18575 -0.475494384765625 0.535983642578125 +0.185875 -0.4801025390625 0.535983642578125 +0.186 -0.48553466796875 0.535983642578125 +0.186125 -0.489044189453125 0.535983642578125 +0.18625 -0.49298095703125 0.535983642578125 +0.186375 -0.495330810546875 0.535983642578125 +0.1865 -0.497222900390625 0.535983642578125 +0.186625 -0.498992919921875 0.535983642578125 +0.18675 -0.499725341796875 0.535983642578125 +0.186875 -0.49993896484375 0.535983642578125 +0.187 -0.499542236328125 0.535983642578125 +0.187125 -0.49822998046875 0.535983642578125 +0.18725 -0.49664306640625 0.535983642578125 +0.187375 -0.493804931640625 0.535983642578125 +0.1875 -0.491119384765625 0.535983642578125 +0.187625 -0.48675537109375 0.535983642578125 +0.18775 -0.482940673828125 0.535983642578125 +0.187875 -0.477081298828125 0.535983642578125 +0.188 -0.47216796875 0.535983642578125 +0.188125 -0.46484375 0.535983642578125 +0.18825 -0.4588623046875 0.535983642578125 +0.188375 -0.45013427734375 0.535983642578125 +0.1885 -0.443084716796875 0.535983642578125 +0.188625 -0.4329833984375 0.535983642578125 +0.18875 -0.4249267578125 0.535983642578125 +0.188875 -0.41351318359375 0.535983642578125 +0.189 -0.40447998046875 0.535983642578125 +0.189125 -0.391815185546875 0.535983642578125 +0.18925 -0.381866455078125 0.535983642578125 +0.189375 -0.368011474609375 0.535983642578125 +0.1895 -0.357208251953125 0.535983642578125 +0.189625 -0.342254638671875 0.535983642578125 +0.18975 -0.33062744140625 0.535983642578125 +0.189875 -0.318695068359375 0.535983642578125 +0.19 -0.302276611328125 0.535983642578125 +0.190125 -0.28961181640625 0.535983642578125 +0.19025 -0.272308349609375 0.535983642578125 +0.190375 -0.259002685546875 0.535983642578125 +0.1905 -0.240875244140625 0.535983642578125 +0.190625 -0.22698974609375 0.535983642578125 +0.19075 -0.2081298828125 0.535983642578125 +0.190875 -0.193756103515625 0.535983642578125 +0.191 -0.174285888671875 0.535983642578125 +0.191125 -0.15948486328125 0.535983642578125 +0.19125 -0.139495849609375 0.535983642578125 +0.191375 -0.12432861328125 0.535983642578125 +0.1915 -0.10394287109375 0.535983642578125 +0.191625 -0.088531494140625 0.535983642578125 +0.19175 -0.067840576171875 0.535983642578125 +0.191875 -0.052276611328125 0.535983642578125 +0.192 -0.031402587890625 0.791975830078125 +0.192125 -0.0052490234375 0.791975830078125 0.19225 0.01568603515625 0.791975830078125 0.192375 0.036590576171875 0.791975830078125 0.1925 0.05743408203125 0.791975830078125 @@ -1608,78 +1608,78 @@ 0.200875 0.05743408203125 0.791975830078125 0.201 0.0313720703125 0.791975830078125 0.201125 0.01043701171875 0.791975830078125 -0.20125 -0.01043701171875 0.791975830078125 -0.201375 -0.0313720703125 0.791975830078125 -0.2015 -0.05224609375 0.791975830078125 -0.201625 -0.072998046875 0.791975830078125 -0.20175 -0.098785400390625 0.791975830078125 -0.201875 -0.119232177734375 0.791975830078125 -0.202 -0.13946533203125 0.791975830078125 -0.202125 -0.159454345703125 0.791975830078125 -0.20225 -0.17913818359375 0.791975830078125 -0.202375 -0.19854736328125 0.791975830078125 -0.2025 -0.2222900390625 0.791975830078125 -0.202625 -0.2408447265625 0.791975830078125 -0.20275 -0.25897216796875 0.791975830078125 -0.202875 -0.276641845703125 0.791975830078125 -0.203 -0.2938232421875 0.791975830078125 -0.203125 -0.310516357421875 0.791975830078125 -0.20325 -0.32666015625 0.791975830078125 -0.203375 -0.34600830078125 0.791975830078125 -0.2035 -0.360809326171875 0.791975830078125 -0.203625 -0.375 0.791975830078125 -0.20375 -0.388519287109375 0.791975830078125 -0.203875 -0.401336669921875 0.791975830078125 -0.204 -0.413482666015625 0.791975830078125 -0.204125 -0.4276123046875 0.791975830078125 -0.20425 -0.438079833984375 0.791975830078125 -0.204375 -0.447784423828125 0.791975830078125 -0.2045 -0.45672607421875 0.791975830078125 -0.204625 -0.464813232421875 0.791975830078125 -0.20475 -0.472137451171875 0.791975830078125 -0.204875 -0.480072021484375 0.791975830078125 -0.205 -0.485504150390625 0.791975830078125 -0.205125 -0.490081787109375 0.791975830078125 -0.20525 -0.4937744140625 0.791975830078125 -0.205375 -0.496612548828125 0.791975830078125 -0.2055 -0.49859619140625 0.791975830078125 -0.205625 -0.49969482421875 0.791975830078125 -0.20575 -0.49981689453125 0.791975830078125 -0.205875 -0.49896240234375 0.791975830078125 -0.206 -0.4971923828125 0.791975830078125 -0.206125 -0.49456787109375 0.791975830078125 -0.20625 -0.4910888671875 0.791975830078125 -0.206375 -0.486724853515625 0.791975830078125 -0.2065 -0.480072021484375 0.791975830078125 -0.206625 -0.47381591796875 0.791975830078125 -0.20675 -0.46673583984375 0.791975830078125 -0.206875 -0.458831787109375 0.791975830078125 -0.207 -0.450103759765625 0.791975830078125 -0.207125 -0.440582275390625 0.791975830078125 -0.20725 -0.4276123046875 0.791975830078125 -0.207375 -0.416412353515625 0.791975830078125 -0.2075 -0.404449462890625 0.791975830078125 -0.207625 -0.39178466796875 0.791975830078125 -0.20775 -0.378448486328125 0.791975830078125 -0.207875 -0.36444091796875 0.791975830078125 -0.208 -0.349761962890625 0.791975830078125 -0.208125 -0.330596923828125 0.791975830078125 -0.20825 -0.314605712890625 0.791975830078125 -0.208375 -0.298065185546875 0.791975830078125 -0.2085 -0.280975341796875 0.791975830078125 -0.208625 -0.263427734375 0.791975830078125 -0.20875 -0.24542236328125 0.791975830078125 -0.208875 -0.2222900390625 0.791975830078125 -0.209 -0.203338623046875 0.791975830078125 -0.209125 -0.18402099609375 0.791975830078125 -0.20925 -0.164398193359375 0.791975830078125 -0.209375 -0.14447021484375 0.791975830078125 -0.2095 -0.124298095703125 0.791975830078125 -0.209625 -0.103912353515625 0.791975830078125 -0.20975 -0.07818603515625 0.791975830078125 -0.209875 -0.05743408203125 0.791975830078125 -0.21 -0.036590576171875 0.791975830078125 -0.210125 -0.01568603515625 0.791975830078125 +0.20125 -0.010467529296875 0.791975830078125 +0.201375 -0.031402587890625 0.791975830078125 +0.2015 -0.052276611328125 0.791975830078125 +0.201625 -0.073028564453125 0.791975830078125 +0.20175 -0.09881591796875 0.791975830078125 +0.201875 -0.1192626953125 0.791975830078125 +0.202 -0.139495849609375 0.791975830078125 +0.202125 -0.15948486328125 0.791975830078125 +0.20225 -0.179168701171875 0.791975830078125 +0.202375 -0.198577880859375 0.791975830078125 +0.2025 -0.222320556640625 0.791975830078125 +0.202625 -0.240875244140625 0.791975830078125 +0.20275 -0.259002685546875 0.791975830078125 +0.202875 -0.27667236328125 0.791975830078125 +0.203 -0.293853759765625 0.791975830078125 +0.203125 -0.310546875 0.791975830078125 +0.20325 -0.326690673828125 0.791975830078125 +0.203375 -0.346038818359375 0.791975830078125 +0.2035 -0.36083984375 0.791975830078125 +0.203625 -0.375030517578125 0.791975830078125 +0.20375 -0.3885498046875 0.791975830078125 +0.203875 -0.4013671875 0.791975830078125 +0.204 -0.41351318359375 0.791975830078125 +0.204125 -0.427642822265625 0.791975830078125 +0.20425 -0.4381103515625 0.791975830078125 +0.204375 -0.44781494140625 0.791975830078125 +0.2045 -0.456756591796875 0.791975830078125 +0.204625 -0.46484375 0.791975830078125 +0.20475 -0.47216796875 0.791975830078125 +0.204875 -0.4801025390625 0.791975830078125 +0.205 -0.48553466796875 0.791975830078125 +0.205125 -0.4901123046875 0.791975830078125 +0.20525 -0.493804931640625 0.791975830078125 +0.205375 -0.49664306640625 0.791975830078125 +0.2055 -0.498626708984375 0.791975830078125 +0.205625 -0.499725341796875 0.791975830078125 +0.20575 -0.499847412109375 0.791975830078125 +0.205875 -0.498992919921875 0.791975830078125 +0.206 -0.497222900390625 0.791975830078125 +0.206125 -0.494598388671875 0.791975830078125 +0.20625 -0.491119384765625 0.791975830078125 +0.206375 -0.48675537109375 0.791975830078125 +0.2065 -0.4801025390625 0.791975830078125 +0.206625 -0.473846435546875 0.791975830078125 +0.20675 -0.466766357421875 0.791975830078125 +0.206875 -0.4588623046875 0.791975830078125 +0.207 -0.45013427734375 0.791975830078125 +0.207125 -0.44061279296875 0.791975830078125 +0.20725 -0.427642822265625 0.791975830078125 +0.207375 -0.41644287109375 0.791975830078125 +0.2075 -0.40447998046875 0.791975830078125 +0.207625 -0.391815185546875 0.791975830078125 +0.20775 -0.37847900390625 0.791975830078125 +0.207875 -0.364471435546875 0.791975830078125 +0.208 -0.34979248046875 0.791975830078125 +0.208125 -0.33062744140625 0.791975830078125 +0.20825 -0.31463623046875 0.791975830078125 +0.208375 -0.298095703125 0.791975830078125 +0.2085 -0.281005859375 0.791975830078125 +0.208625 -0.263458251953125 0.791975830078125 +0.20875 -0.245452880859375 0.791975830078125 +0.208875 -0.222320556640625 0.791975830078125 +0.209 -0.203369140625 0.791975830078125 +0.209125 -0.184051513671875 0.791975830078125 +0.20925 -0.1644287109375 0.791975830078125 +0.209375 -0.144500732421875 0.791975830078125 +0.2095 -0.12432861328125 0.791975830078125 +0.209625 -0.10394287109375 0.791975830078125 +0.20975 -0.078216552734375 0.791975830078125 +0.209875 -0.057464599609375 0.791975830078125 +0.21 -0.03662109375 0.791975830078125 +0.210125 -0.015716552734375 0.791975830078125 0.21025 0.005218505859375 0.791975830078125 0.210375 0.026123046875 0.791975830078125 0.2105 0.05224609375 0.791975830078125 @@ -1752,74 +1752,74 @@ 0.218875 0.0626220703125 0.791975830078125 0.219 0.04180908203125 0.791975830078125 0.219125 0.020904541015625 0.791975830078125 -0.21925 -0.005218505859375 0.791975830078125 -0.219375 -0.026123046875 0.791975830078125 -0.2195 -0.047027587890625 0.791975830078125 -0.219625 -0.06781005859375 0.791975830078125 -0.21975 -0.0885009765625 0.791975830078125 -0.219875 -0.109039306640625 0.791975830078125 -0.22 -0.134429931640625 0.791975830078125 -0.220125 -0.15447998046875 0.791975830078125 -0.22025 -0.17425537109375 0.791975830078125 -0.220375 -0.1937255859375 0.791975830078125 -0.2205 -0.212860107421875 0.791975830078125 -0.220625 -0.231597900390625 0.791975830078125 -0.22075 -0.249969482421875 0.791975830078125 -0.220875 -0.27227783203125 0.791975830078125 -0.221 -0.289581298828125 0.791975830078125 -0.221125 -0.306396484375 0.791975830078125 -0.22125 -0.322662353515625 0.791975830078125 -0.221375 -0.33837890625 0.791975830078125 -0.2215 -0.353485107421875 0.791975830078125 -0.221625 -0.37152099609375 0.791975830078125 -0.22175 -0.38519287109375 0.791975830078125 -0.221875 -0.398193359375 0.791975830078125 -0.222 -0.4105224609375 0.791975830078125 -0.222125 -0.422119140625 0.791975830078125 -0.22225 -0.432952880859375 0.791975830078125 -0.222375 -0.4454345703125 0.791975830078125 -0.2225 -0.454559326171875 0.791975830078125 -0.222625 -0.462890625 0.791975830078125 -0.22275 -0.470367431640625 0.791975830078125 -0.222875 -0.47705078125 0.791975830078125 -0.223 -0.48291015625 0.791975830078125 -0.223125 -0.487884521484375 0.791975830078125 -0.22325 -0.492950439453125 0.791975830078125 -0.223375 -0.496002197265625 0.791975830078125 -0.2235 -0.498199462890625 0.791975830078125 -0.223625 -0.49951171875 0.791975830078125 -0.22375 -0.49993896484375 0.791975830078125 -0.223875 -0.49951171875 0.791975830078125 -0.224 -0.497711181640625 0.9999084491282701 -0.224125 -0.49456787109375 0.9999084491282701 -0.22425 -0.490081787109375 0.9999084491282701 -0.224375 -0.484222412109375 0.9999084491282701 -0.2245 -0.478607177734375 0.9999084491282701 -0.224625 -0.470367431640625 0.9999084491282701 -0.22475 -0.46087646484375 0.9999084491282701 -0.224875 -0.450103759765625 0.9999084491282701 -0.225 -0.438079833984375 0.9999084491282701 -0.225125 -0.4276123046875 0.9999084491282701 -0.22525 -0.413482666015625 0.9999084491282701 -0.225375 -0.398193359375 0.9999084491282701 -0.2255 -0.3818359375 0.9999084491282701 -0.225625 -0.36444091796875 0.9999084491282701 -0.22575 -0.349761962890625 0.9999084491282701 -0.225875 -0.330596923828125 0.9999084491282701 -0.226 -0.310516357421875 0.9999084491282701 -0.226125 -0.289581298828125 0.9999084491282701 -0.22625 -0.267852783203125 0.9999084491282701 -0.226375 -0.249969482421875 0.9999084491282701 -0.2265 -0.226959228515625 0.9999084491282701 -0.226625 -0.203338623046875 0.9999084491282701 -0.22675 -0.17913818359375 0.9999084491282701 -0.226875 -0.15447998046875 0.9999084491282701 -0.227 -0.134429931640625 0.9999084491282701 -0.227125 -0.109039306640625 0.9999084491282701 -0.22725 -0.083343505859375 0.9999084491282701 -0.227375 -0.05743408203125 0.9999084491282701 -0.2275 -0.0313720703125 0.9999084491282701 -0.227625 -0.01043701171875 0.9999084491282701 +0.21925 -0.0052490234375 0.791975830078125 +0.219375 -0.026153564453125 0.791975830078125 +0.2195 -0.04705810546875 0.791975830078125 +0.219625 -0.067840576171875 0.791975830078125 +0.21975 -0.088531494140625 0.791975830078125 +0.219875 -0.10906982421875 0.791975830078125 +0.22 -0.13446044921875 0.791975830078125 +0.220125 -0.154510498046875 0.791975830078125 +0.22025 -0.174285888671875 0.791975830078125 +0.220375 -0.193756103515625 0.791975830078125 +0.2205 -0.212890625 0.791975830078125 +0.220625 -0.23162841796875 0.791975830078125 +0.22075 -0.25 0.791975830078125 +0.220875 -0.272308349609375 0.791975830078125 +0.221 -0.28961181640625 0.791975830078125 +0.221125 -0.306427001953125 0.791975830078125 +0.22125 -0.32269287109375 0.791975830078125 +0.221375 -0.338409423828125 0.791975830078125 +0.2215 -0.353515625 0.791975830078125 +0.221625 -0.371551513671875 0.791975830078125 +0.22175 -0.385223388671875 0.791975830078125 +0.221875 -0.398223876953125 0.791975830078125 +0.222 -0.410552978515625 0.791975830078125 +0.222125 -0.422149658203125 0.791975830078125 +0.22225 -0.4329833984375 0.791975830078125 +0.222375 -0.445465087890625 0.791975830078125 +0.2225 -0.45458984375 0.791975830078125 +0.222625 -0.462921142578125 0.791975830078125 +0.22275 -0.47039794921875 0.791975830078125 +0.222875 -0.477081298828125 0.791975830078125 +0.223 -0.482940673828125 0.791975830078125 +0.223125 -0.4879150390625 0.791975830078125 +0.22325 -0.49298095703125 0.791975830078125 +0.223375 -0.49603271484375 0.791975830078125 +0.2235 -0.49822998046875 0.791975830078125 +0.223625 -0.499542236328125 0.791975830078125 +0.22375 -0.499969482421875 0.791975830078125 +0.223875 -0.499542236328125 0.791975830078125 +0.224 -0.49774169921875 0.9999084491282701 +0.224125 -0.494598388671875 0.9999084491282701 +0.22425 -0.4901123046875 0.9999084491282701 +0.224375 -0.4842529296875 0.9999084491282701 +0.2245 -0.4786376953125 0.9999084491282701 +0.224625 -0.47039794921875 0.9999084491282701 +0.22475 -0.460906982421875 0.9999084491282701 +0.224875 -0.45013427734375 0.9999084491282701 +0.225 -0.4381103515625 0.9999084491282701 +0.225125 -0.427642822265625 0.9999084491282701 +0.22525 -0.41351318359375 0.9999084491282701 +0.225375 -0.398223876953125 0.9999084491282701 +0.2255 -0.381866455078125 0.9999084491282701 +0.225625 -0.364471435546875 0.9999084491282701 +0.22575 -0.34979248046875 0.9999084491282701 +0.225875 -0.33062744140625 0.9999084491282701 +0.226 -0.310546875 0.9999084491282701 +0.226125 -0.28961181640625 0.9999084491282701 +0.22625 -0.26788330078125 0.9999084491282701 +0.226375 -0.25 0.9999084491282701 +0.2265 -0.22698974609375 0.9999084491282701 +0.226625 -0.203369140625 0.9999084491282701 +0.22675 -0.179168701171875 0.9999084491282701 +0.226875 -0.154510498046875 0.9999084491282701 +0.227 -0.13446044921875 0.9999084491282701 +0.227125 -0.10906982421875 0.9999084491282701 +0.22725 -0.0833740234375 0.9999084491282701 +0.227375 -0.057464599609375 0.9999084491282701 +0.2275 -0.031402587890625 0.9999084491282701 +0.227625 -0.010467529296875 0.9999084491282701 0.22775 0.01568603515625 0.9999084491282701 0.227875 0.04180908203125 0.9999084491282701 0.228 0.06781005859375 0.9999084491282701 @@ -1882,69 +1882,69 @@ 0.235125 0.072998046875 0.9999084491282701 0.23525 0.047027587890625 0.9999084491282701 0.235375 0.020904541015625 0.9999084491282701 -0.2355 -0.005218505859375 0.9999084491282701 -0.235625 -0.0313720703125 0.9999084491282701 -0.23575 -0.05224609375 0.9999084491282701 -0.235875 -0.07818603515625 0.9999084491282701 -0.236 -0.103912353515625 0.9999084491282701 -0.236125 -0.129364013671875 0.9999084491282701 -0.23625 -0.15447998046875 0.9999084491282701 -0.236375 -0.17425537109375 0.9999084491282701 -0.2365 -0.19854736328125 0.9999084491282701 -0.236625 -0.2222900390625 0.9999084491282701 -0.23675 -0.24542236328125 0.9999084491282701 -0.236875 -0.267852783203125 0.9999084491282701 -0.237 -0.285308837890625 0.9999084491282701 -0.237125 -0.306396484375 0.9999084491282701 -0.23725 -0.32666015625 0.9999084491282701 -0.237375 -0.34600830078125 0.9999084491282701 -0.2375 -0.36444091796875 0.9999084491282701 -0.237625 -0.378448486328125 0.9999084491282701 -0.23775 -0.39501953125 0.9999084491282701 -0.237875 -0.4105224609375 0.9999084491282701 -0.238 -0.424896240234375 0.9999084491282701 -0.238125 -0.438079833984375 0.9999084491282701 -0.23825 -0.447784423828125 0.9999084491282701 -0.238375 -0.458831787109375 0.9999084491282701 -0.2385 -0.46856689453125 0.9999084491282701 -0.238625 -0.47705078125 0.9999084491282701 -0.23875 -0.484222412109375 0.9999084491282701 -0.238875 -0.489013671875 0.9999084491282701 -0.239 -0.4937744140625 0.9999084491282701 -0.239125 -0.4971923828125 0.9999084491282701 -0.23925 -0.499267578125 0.9999084491282701 -0.239375 -0.49993896484375 0.9999084491282701 -0.2395 -0.49951171875 0.9999084491282701 -0.239625 -0.497711181640625 0.9999084491282701 -0.23975 -0.49456787109375 0.9999084491282701 -0.239875 -0.490081787109375 0.9999084491282701 -0.24 -0.484222412109375 0.9999084491282701 -0.240125 -0.478607177734375 0.9999084491282701 -0.24025 -0.470367431640625 0.9999084491282701 -0.240375 -0.46087646484375 0.9999084491282701 -0.2405 -0.450103759765625 0.9999084491282701 -0.240625 -0.438079833984375 0.9999084491282701 -0.24075 -0.4276123046875 0.9999084491282701 -0.240875 -0.413482666015625 0.9999084491282701 -0.241 -0.398193359375 0.9999084491282701 -0.241125 -0.3818359375 0.9999084491282701 -0.24125 -0.36444091796875 0.9999084491282701 -0.241375 -0.349761962890625 0.9999084491282701 -0.2415 -0.330596923828125 0.9999084491282701 -0.241625 -0.310516357421875 0.9999084491282701 -0.24175 -0.289581298828125 0.9999084491282701 -0.241875 -0.267852783203125 0.9999084491282701 -0.242 -0.249969482421875 0.9999084491282701 -0.242125 -0.226959228515625 0.9999084491282701 -0.24225 -0.203338623046875 0.9999084491282701 -0.242375 -0.17913818359375 0.9999084491282701 -0.2425 -0.15447998046875 0.9999084491282701 -0.242625 -0.134429931640625 0.9999084491282701 -0.24275 -0.109039306640625 0.9999084491282701 -0.242875 -0.083343505859375 0.9999084491282701 -0.243 -0.05743408203125 0.9999084491282701 -0.243125 -0.0313720703125 0.9999084491282701 -0.24325 -0.01043701171875 0.9999084491282701 +0.2355 -0.0052490234375 0.9999084491282701 +0.235625 -0.031402587890625 0.9999084491282701 +0.23575 -0.052276611328125 0.9999084491282701 +0.235875 -0.078216552734375 0.9999084491282701 +0.236 -0.10394287109375 0.9999084491282701 +0.236125 -0.12939453125 0.9999084491282701 +0.23625 -0.154510498046875 0.9999084491282701 +0.236375 -0.174285888671875 0.9999084491282701 +0.2365 -0.198577880859375 0.9999084491282701 +0.236625 -0.222320556640625 0.9999084491282701 +0.23675 -0.245452880859375 0.9999084491282701 +0.236875 -0.26788330078125 0.9999084491282701 +0.237 -0.28533935546875 0.9999084491282701 +0.237125 -0.306427001953125 0.9999084491282701 +0.23725 -0.326690673828125 0.9999084491282701 +0.237375 -0.346038818359375 0.9999084491282701 +0.2375 -0.364471435546875 0.9999084491282701 +0.237625 -0.37847900390625 0.9999084491282701 +0.23775 -0.395050048828125 0.9999084491282701 +0.237875 -0.410552978515625 0.9999084491282701 +0.238 -0.4249267578125 0.9999084491282701 +0.238125 -0.4381103515625 0.9999084491282701 +0.23825 -0.44781494140625 0.9999084491282701 +0.238375 -0.4588623046875 0.9999084491282701 +0.2385 -0.468597412109375 0.9999084491282701 +0.238625 -0.477081298828125 0.9999084491282701 +0.23875 -0.4842529296875 0.9999084491282701 +0.238875 -0.489044189453125 0.9999084491282701 +0.239 -0.493804931640625 0.9999084491282701 +0.239125 -0.497222900390625 0.9999084491282701 +0.23925 -0.499298095703125 0.9999084491282701 +0.239375 -0.499969482421875 0.9999084491282701 +0.2395 -0.499542236328125 0.9999084491282701 +0.239625 -0.49774169921875 0.9999084491282701 +0.23975 -0.494598388671875 0.9999084491282701 +0.239875 -0.4901123046875 0.9999084491282701 +0.24 -0.4842529296875 0.9999084491282701 +0.240125 -0.4786376953125 0.9999084491282701 +0.24025 -0.47039794921875 0.9999084491282701 +0.240375 -0.460906982421875 0.9999084491282701 +0.2405 -0.45013427734375 0.9999084491282701 +0.240625 -0.4381103515625 0.9999084491282701 +0.24075 -0.427642822265625 0.9999084491282701 +0.240875 -0.41351318359375 0.9999084491282701 +0.241 -0.398223876953125 0.9999084491282701 +0.241125 -0.381866455078125 0.9999084491282701 +0.24125 -0.364471435546875 0.9999084491282701 +0.241375 -0.34979248046875 0.9999084491282701 +0.2415 -0.33062744140625 0.9999084491282701 +0.241625 -0.310546875 0.9999084491282701 +0.24175 -0.28961181640625 0.9999084491282701 +0.241875 -0.26788330078125 0.9999084491282701 +0.242 -0.25 0.9999084491282701 +0.242125 -0.22698974609375 0.9999084491282701 +0.24225 -0.203369140625 0.9999084491282701 +0.242375 -0.179168701171875 0.9999084491282701 +0.2425 -0.154510498046875 0.9999084491282701 +0.242625 -0.13446044921875 0.9999084491282701 +0.24275 -0.10906982421875 0.9999084491282701 +0.242875 -0.0833740234375 0.9999084491282701 +0.243 -0.057464599609375 0.9999084491282701 +0.243125 -0.031402587890625 0.9999084491282701 +0.24325 -0.010467529296875 0.9999084491282701 0.243375 0.01568603515625 0.9999084491282701 0.2435 0.04180908203125 0.9999084491282701 0.243625 0.06781005859375 0.9999084491282701 @@ -2007,42 +2007,42 @@ 0.25075 0.072998046875 0.9999084491282701 0.250875 0.047027587890625 0.9999084491282701 0.251 0.020904541015625 0.9999084491282701 -0.251125 -0.005218505859375 0.9999084491282701 -0.25125 -0.0313720703125 0.9999084491282701 -0.251375 -0.05224609375 0.9999084491282701 -0.2515 -0.07818603515625 0.9999084491282701 -0.251625 -0.103912353515625 0.9999084491282701 -0.25175 -0.129364013671875 0.9999084491282701 -0.251875 -0.15447998046875 0.9999084491282701 -0.252 -0.17425537109375 0.9999084491282701 -0.252125 -0.19854736328125 0.9999084491282701 -0.25225 -0.2222900390625 0.9999084491282701 -0.252375 -0.24542236328125 0.9999084491282701 -0.2525 -0.267852783203125 0.9999084491282701 -0.252625 -0.285308837890625 0.9999084491282701 -0.25275 -0.306396484375 0.9999084491282701 -0.252875 -0.32666015625 0.9999084491282701 -0.253 -0.34600830078125 0.9999084491282701 -0.253125 -0.36444091796875 0.9999084491282701 -0.25325 -0.378448486328125 0.9999084491282701 -0.253375 -0.39501953125 0.9999084491282701 -0.2535 -0.4105224609375 0.9999084491282701 -0.253625 -0.424896240234375 0.9999084491282701 -0.2537500000000001 -0.438079833984375 0.9999084491282701 -0.253875 -0.447784423828125 0.9999084491282701 -0.254 -0.458831787109375 0.9999084491282701 -0.254125 -0.46856689453125 0.9999084491282701 -0.25425 -0.47705078125 0.9999084491282701 -0.254375 -0.484222412109375 0.9999084491282701 -0.2545 -0.489013671875 0.9999084491282701 -0.254625 -0.4937744140625 0.9999084491282701 -0.25475 -0.4971923828125 0.9999084491282701 -0.254875 -0.499267578125 0.9999084491282701 -0.255 -0.49993896484375 0.9999084491282701 -0.255125 -0.49951171875 0.9999084491282701 -0.25525 -0.497711181640625 0.9999084491282701 -0.255375 -0.49456787109375 0.9999084491282701 -0.2555 -0.490081787109375 0.9999084491282701 -0.255625 -0.484222412109375 0.9999084491282701 -0.25575 -0.478607177734375 0.9999084491282701 -0.255875 -0.470367431640625 0.9999084491282701 +0.251125 -0.0052490234375 0.9999084491282701 +0.25125 -0.031402587890625 0.9999084491282701 +0.251375 -0.052276611328125 0.9999084491282701 +0.2515 -0.078216552734375 0.9999084491282701 +0.251625 -0.10394287109375 0.9999084491282701 +0.25175 -0.12939453125 0.9999084491282701 +0.251875 -0.154510498046875 0.9999084491282701 +0.252 -0.174285888671875 0.9999084491282701 +0.252125 -0.198577880859375 0.9999084491282701 +0.25225 -0.222320556640625 0.9999084491282701 +0.252375 -0.245452880859375 0.9999084491282701 +0.2525 -0.26788330078125 0.9999084491282701 +0.252625 -0.28533935546875 0.9999084491282701 +0.25275 -0.306427001953125 0.9999084491282701 +0.252875 -0.326690673828125 0.9999084491282701 +0.253 -0.346038818359375 0.9999084491282701 +0.253125 -0.364471435546875 0.9999084491282701 +0.25325 -0.37847900390625 0.9999084491282701 +0.253375 -0.395050048828125 0.9999084491282701 +0.2535 -0.410552978515625 0.9999084491282701 +0.253625 -0.4249267578125 0.9999084491282701 +0.2537500000000001 -0.4381103515625 0.9999084491282701 +0.253875 -0.44781494140625 0.9999084491282701 +0.254 -0.4588623046875 0.9999084491282701 +0.254125 -0.468597412109375 0.9999084491282701 +0.25425 -0.477081298828125 0.9999084491282701 +0.254375 -0.4842529296875 0.9999084491282701 +0.2545 -0.489044189453125 0.9999084491282701 +0.254625 -0.493804931640625 0.9999084491282701 +0.25475 -0.497222900390625 0.9999084491282701 +0.254875 -0.499298095703125 0.9999084491282701 +0.255 -0.499969482421875 0.9999084491282701 +0.255125 -0.499542236328125 0.9999084491282701 +0.25525 -0.49774169921875 0.9999084491282701 +0.255375 -0.494598388671875 0.9999084491282701 +0.2555 -0.4901123046875 0.9999084491282701 +0.255625 -0.4842529296875 0.9999084491282701 +0.25575 -0.4786376953125 0.9999084491282701 +0.255875 -0.47039794921875 0.9999084491282701 diff --git a/tests/circuitpython/synth_note_envelope.py.exp b/tests/circuitpython/synth_note_envelope.py.exp index d4c7d0adc2..c490380cb3 100644 --- a/tests/circuitpython/synth_note_envelope.py.exp +++ b/tests/circuitpython/synth_note_envelope.py.exp @@ -29,37 +29,37 @@ 0.0035 0.034515380859375 0.302396875 0.003625 0.0189208984375 0.302396875 0.00375 0.004730224609375 0.302396875 -0.003875 -0.01104736328125 0.302396875 -0.004 -0.02520751953125 0.302396875 -0.004125 -0.0406494140625 0.302396875 -0.00425 -0.055633544921875 0.302396875 -0.004375000000000001 -0.068603515625 0.302396875 -0.004500000000000001 -0.08233642578125 0.302396875 -0.004625 -0.093902587890625 0.302396875 -0.00475 -0.105743408203125 0.302396875 -0.004875 -0.116455078125 0.302396875 -0.005 -0.125030517578125 0.302396875 -0.005125000000000001 -0.133209228515625 0.302396875 -0.00525 -0.13934326171875 0.302396875 -0.005375000000000001 -0.14471435546875 0.302396875 -0.005499999999999999 -0.14849853515625 0.302396875 -0.005625 -0.150482177734375 0.302396875 -0.00575 -0.151153564453125 0.302396875 -0.005874999999999999 -0.15032958984375 0.302396875 -0.006 -0.147857666015625 0.302396875 -0.006125 -0.143768310546875 0.302396875 -0.00625 -0.13873291015625 0.302396875 -0.006375 -0.131683349609375 0.302396875 -0.0065 -0.124114990234375 0.302396875 -0.006625000000000001 -0.114410400390625 0.302396875 -0.00675 -0.103485107421875 0.302396875 -0.006875 -0.0926513671875 0.302396875 -0.007000000000000001 -0.07965087890625 0.302396875 -0.007125000000000002 -0.06719970703125 0.302396875 -0.007250000000000001 -0.05267333984375 0.302396875 -0.007375 -0.037567138671875 0.302396875 -0.0075 -0.02362060546875 0.302396875 -0.007625 -0.007904052734375 0.302396875 +0.003875 -0.011077880859375 0.302396875 +0.004 -0.025238037109375 0.302396875 +0.004125 -0.040679931640625 0.302396875 +0.00425 -0.0556640625 0.302396875 +0.004375000000000001 -0.068634033203125 0.302396875 +0.004500000000000001 -0.082366943359375 0.302396875 +0.004625 -0.09393310546875 0.302396875 +0.00475 -0.10577392578125 0.302396875 +0.004875 -0.116485595703125 0.302396875 +0.005 -0.12506103515625 0.302396875 +0.005125000000000001 -0.13323974609375 0.302396875 +0.00525 -0.139373779296875 0.302396875 +0.005375000000000001 -0.144744873046875 0.302396875 +0.005499999999999999 -0.148529052734375 0.302396875 +0.005625 -0.1505126953125 0.302396875 +0.00575 -0.15118408203125 0.302396875 +0.005874999999999999 -0.150360107421875 0.302396875 +0.006 -0.14788818359375 0.302396875 +0.006125 -0.143798828125 0.302396875 +0.00625 -0.138763427734375 0.302396875 +0.006375 -0.1317138671875 0.302396875 +0.0065 -0.1241455078125 0.302396875 +0.006625000000000001 -0.11444091796875 0.302396875 +0.00675 -0.103515625 0.302396875 +0.006875 -0.092681884765625 0.302396875 +0.007000000000000001 -0.079681396484375 0.302396875 +0.007125000000000002 -0.067230224609375 0.302396875 +0.007250000000000001 -0.052703857421875 0.302396875 +0.007375 -0.03759765625 0.302396875 +0.0075 -0.023651123046875 0.302396875 +0.007625 -0.0079345703125 0.302396875 0.00775 0.006317138671875 0.302396875 0.007875 0.022064208984375 0.302396875 0.008 0.037567138671875 0.302396875 @@ -91,37 +91,37 @@ 0.01125 0.042144775390625 0.302396875 0.011375 0.026763916015625 0.302396875 0.0115 0.01263427734375 0.302396875 -0.011625 -0.003143310546875 0.302396875 -0.01175 -0.0189208984375 0.302396875 -0.011875 -0.032958984375 0.302396875 -0.012 -0.0482177734375 0.302396875 -0.012125 -0.06146240234375 0.302396875 -0.01225 -0.0755615234375 0.302396875 -0.012375 -0.088836669921875 0.302396875 -0.0125 -0.0999755859375 0.302396875 -0.012625 -0.11126708984375 0.302396875 -0.01275 -0.120391845703125 0.302396875 -0.012875 -0.129302978515625 0.302396875 -0.013 -0.13677978515625 0.302396875 -0.013125 -0.1422119140625 0.302396875 -0.01325 -0.14678955078125 0.302396875 -0.013375 -0.1495361328125 0.302396875 -0.0135 -0.151031494140625 0.302396875 -0.013625 -0.15087890625 0.302396875 -0.01375 -0.1492919921875 0.302396875 -0.013875 -0.14599609375 0.302396875 -0.014 -0.141693115234375 0.302396875 -0.014125 -0.135406494140625 0.302396875 -0.01425 -0.12762451171875 0.302396875 -0.014375 -0.11944580078125 0.302396875 -0.0145 -0.109100341796875 0.302396875 -0.014625 -0.0987548828125 0.302396875 -0.01475 -0.086273193359375 0.302396875 -0.014875 -0.07281494140625 0.302396875 -0.015 -0.060028076171875 0.302396875 -0.015125 -0.045196533203125 0.302396875 -0.01525 -0.031402587890625 0.302396875 -0.015375 -0.015777587890625 0.302396875 +0.011625 -0.003173828125 0.302396875 +0.01175 -0.018951416015625 0.302396875 +0.011875 -0.032989501953125 0.302396875 +0.012 -0.048248291015625 0.302396875 +0.012125 -0.061492919921875 0.302396875 +0.01225 -0.075592041015625 0.302396875 +0.012375 -0.0888671875 0.302396875 +0.0125 -0.100006103515625 0.302396875 +0.012625 -0.111297607421875 0.302396875 +0.01275 -0.12042236328125 0.302396875 +0.012875 -0.12933349609375 0.302396875 +0.013 -0.136810302734375 0.302396875 +0.013125 -0.142242431640625 0.302396875 +0.01325 -0.146820068359375 0.302396875 +0.013375 -0.149566650390625 0.302396875 +0.0135 -0.15106201171875 0.302396875 +0.013625 -0.150909423828125 0.302396875 +0.01375 -0.149322509765625 0.302396875 +0.013875 -0.146026611328125 0.302396875 +0.014 -0.1417236328125 0.302396875 +0.014125 -0.13543701171875 0.302396875 +0.01425 -0.127655029296875 0.302396875 +0.014375 -0.119476318359375 0.302396875 +0.0145 -0.109130859375 0.302396875 +0.014625 -0.098785400390625 0.302396875 +0.01475 -0.0863037109375 0.302396875 +0.014875 -0.072845458984375 0.302396875 +0.015 -0.06005859375 0.302396875 +0.015125 -0.04522705078125 0.302396875 +0.01525 -0.03143310546875 0.302396875 +0.015375 -0.01580810546875 0.302396875 0.0155 0.0 0.302396875 0.015625 0.01422119140625 0.302396875 0.01575 0.029876708984375 0.302396875 @@ -154,37 +154,37 @@ 0.019125 0.034515380859375 0.302396875 0.01925 0.0189208984375 0.302396875 0.019375 0.004730224609375 0.302396875 -0.0195 -0.01104736328125 0.302396875 -0.019625 -0.02520751953125 0.302396875 -0.01975 -0.0406494140625 0.302396875 -0.019875 -0.055633544921875 0.302396875 -0.02 -0.068603515625 0.302396875 -0.020125 -0.08233642578125 0.302396875 -0.02025 -0.093902587890625 0.302396875 -0.020375 -0.105743408203125 0.302396875 -0.0205 -0.116455078125 0.302396875 -0.020625 -0.125030517578125 0.302396875 -0.02075 -0.133209228515625 0.302396875 -0.020875 -0.13934326171875 0.302396875 -0.021 -0.14471435546875 0.302396875 -0.021125 -0.14849853515625 0.302396875 -0.02125 -0.150482177734375 0.302396875 -0.021375 -0.151153564453125 0.302396875 -0.0215 -0.15032958984375 0.302396875 -0.021625 -0.147857666015625 0.302396875 -0.02175 -0.143768310546875 0.302396875 -0.021875 -0.13873291015625 0.302396875 -0.022 -0.131683349609375 0.302396875 -0.022125 -0.124114990234375 0.302396875 -0.02225 -0.114410400390625 0.302396875 -0.022375 -0.103485107421875 0.302396875 -0.0225 -0.0926513671875 0.302396875 -0.022625 -0.07965087890625 0.302396875 -0.02275 -0.06719970703125 0.302396875 -0.022875 -0.05267333984375 0.302396875 -0.023 -0.037567138671875 0.302396875 -0.023125 -0.02362060546875 0.302396875 -0.02325 -0.007904052734375 0.302396875 +0.0195 -0.011077880859375 0.302396875 +0.019625 -0.025238037109375 0.302396875 +0.01975 -0.040679931640625 0.302396875 +0.019875 -0.0556640625 0.302396875 +0.02 -0.068634033203125 0.302396875 +0.020125 -0.082366943359375 0.302396875 +0.02025 -0.09393310546875 0.302396875 +0.020375 -0.10577392578125 0.302396875 +0.0205 -0.116485595703125 0.302396875 +0.020625 -0.12506103515625 0.302396875 +0.02075 -0.13323974609375 0.302396875 +0.020875 -0.139373779296875 0.302396875 +0.021 -0.144744873046875 0.302396875 +0.021125 -0.148529052734375 0.302396875 +0.02125 -0.1505126953125 0.302396875 +0.021375 -0.15118408203125 0.302396875 +0.0215 -0.150360107421875 0.302396875 +0.021625 -0.14788818359375 0.302396875 +0.02175 -0.143798828125 0.302396875 +0.021875 -0.138763427734375 0.302396875 +0.022 -0.1317138671875 0.302396875 +0.022125 -0.1241455078125 0.302396875 +0.02225 -0.11444091796875 0.302396875 +0.022375 -0.103515625 0.302396875 +0.0225 -0.092681884765625 0.302396875 +0.022625 -0.079681396484375 0.302396875 +0.02275 -0.067230224609375 0.302396875 +0.022875 -0.052703857421875 0.302396875 +0.023 -0.03759765625 0.302396875 +0.023125 -0.023651123046875 0.302396875 +0.02325 -0.0079345703125 0.302396875 0.023375 0.006317138671875 0.302396875 0.0235 0.022064208984375 0.302396875 0.023625 0.037567138671875 0.302396875 @@ -216,37 +216,37 @@ 0.026875 0.042144775390625 0.302396875 0.027 0.026763916015625 0.302396875 0.027125 0.01263427734375 0.302396875 -0.02725 -0.003143310546875 0.302396875 -0.027375 -0.0189208984375 0.302396875 -0.0275 -0.032958984375 0.302396875 -0.027625 -0.0482177734375 0.302396875 -0.02775 -0.06146240234375 0.302396875 -0.027875 -0.0755615234375 0.302396875 -0.028 -0.088836669921875 0.302396875 -0.028125 -0.0999755859375 0.302396875 -0.02825 -0.11126708984375 0.302396875 -0.028375 -0.120391845703125 0.302396875 -0.02850000000000001 -0.129302978515625 0.302396875 -0.028625 -0.13677978515625 0.302396875 -0.02875 -0.1422119140625 0.302396875 -0.028875 -0.14678955078125 0.302396875 -0.029 -0.1495361328125 0.302396875 -0.029125 -0.151031494140625 0.302396875 -0.02925 -0.15087890625 0.302396875 -0.029375 -0.1492919921875 0.302396875 -0.0295 -0.14599609375 0.302396875 -0.029625 -0.141693115234375 0.302396875 -0.02975000000000001 -0.135406494140625 0.302396875 -0.029875 -0.12762451171875 0.302396875 -0.03 -0.11944580078125 0.302396875 -0.030125 -0.109100341796875 0.302396875 -0.03025 -0.0987548828125 0.302396875 -0.030375 -0.086273193359375 0.302396875 -0.0305 -0.07281494140625 0.302396875 -0.030625 -0.060028076171875 0.302396875 -0.03075 -0.045196533203125 0.302396875 -0.03087499999999999 -0.031402587890625 0.302396875 -0.031 -0.015777587890625 0.302396875 +0.02725 -0.003173828125 0.302396875 +0.027375 -0.018951416015625 0.302396875 +0.0275 -0.032989501953125 0.302396875 +0.027625 -0.048248291015625 0.302396875 +0.02775 -0.061492919921875 0.302396875 +0.027875 -0.075592041015625 0.302396875 +0.028 -0.0888671875 0.302396875 +0.028125 -0.100006103515625 0.302396875 +0.02825 -0.111297607421875 0.302396875 +0.028375 -0.12042236328125 0.302396875 +0.02850000000000001 -0.12933349609375 0.302396875 +0.028625 -0.136810302734375 0.302396875 +0.02875 -0.142242431640625 0.302396875 +0.028875 -0.146820068359375 0.302396875 +0.029 -0.149566650390625 0.302396875 +0.029125 -0.15106201171875 0.302396875 +0.02925 -0.150909423828125 0.302396875 +0.029375 -0.149322509765625 0.302396875 +0.0295 -0.146026611328125 0.302396875 +0.029625 -0.1417236328125 0.302396875 +0.02975000000000001 -0.13543701171875 0.302396875 +0.029875 -0.127655029296875 0.302396875 +0.03 -0.119476318359375 0.302396875 +0.030125 -0.109130859375 0.302396875 +0.03025 -0.098785400390625 0.302396875 +0.030375 -0.0863037109375 0.302396875 +0.0305 -0.072845458984375 0.302396875 +0.030625 -0.06005859375 0.302396875 +0.03075 -0.04522705078125 0.302396875 +0.03087499999999999 -0.03143310546875 0.302396875 +0.031 -0.01580810546875 0.302396875 0.031125 0.0 0.302396875 0.03125 0.01422119140625 0.302396875 0.031375 0.029876708984375 0.302396875 @@ -279,37 +279,37 @@ 0.03475000000000001 0.04620361328125 0.4047937500000001 0.034875 0.02532958984375 0.4047937500000001 0.035 0.00634765625 0.4047937500000001 -0.03512500000000001 -0.014801025390625 0.4047937500000001 -0.03525 -0.033721923828125 0.4047937500000001 -0.035375 -0.054412841796875 0.4047937500000001 -0.0355 -0.074493408203125 0.4047937500000001 -0.03562500000000001 -0.09185791015625 0.4047937500000001 -0.03575 -0.110198974609375 0.4047937500000001 -0.035875 -0.12567138671875 0.4047937500000001 -0.03600000000000001 -0.141571044921875 0.4047937500000001 -0.036125 -0.155914306640625 0.4047937500000001 -0.03625 -0.1673583984375 0.4047937500000001 -0.036375 -0.1783447265625 0.4047937500000001 -0.0365 -0.186553955078125 0.4047937500000001 -0.036625 -0.1937255859375 0.4047937500000001 -0.03675 -0.198760986328125 0.4047937500000001 -0.036875 -0.201446533203125 0.4047937500000001 -0.037 -0.20233154296875 0.4047937500000001 -0.03712499999999999 -0.20123291015625 0.4047937500000001 -0.03725 -0.19793701171875 0.4047937500000001 -0.037375 -0.19244384765625 0.4047937500000001 -0.0375 -0.185699462890625 0.4047937500000001 -0.037625 -0.176300048828125 0.4047937500000001 -0.03775 -0.166168212890625 0.4047937500000001 -0.037875 -0.153167724609375 0.4047937500000001 -0.038 -0.138519287109375 0.4047937500000001 -0.038125 -0.1240234375 0.4047937500000001 -0.03825 -0.10662841796875 0.4047937500000001 -0.038375 -0.0899658203125 0.4047937500000001 -0.0385 -0.070526123046875 0.4047937500000001 -0.038625 -0.05029296875 0.4047937500000001 -0.03875 -0.031646728515625 0.4047937500000001 -0.038875 -0.01055908203125 0.4047937500000001 +0.03512500000000001 -0.01483154296875 0.4047937500000001 +0.03525 -0.03375244140625 0.4047937500000001 +0.035375 -0.054443359375 0.4047937500000001 +0.0355 -0.07452392578125 0.4047937500000001 +0.03562500000000001 -0.091888427734375 0.4047937500000001 +0.03575 -0.1102294921875 0.4047937500000001 +0.035875 -0.125701904296875 0.4047937500000001 +0.03600000000000001 -0.1416015625 0.4047937500000001 +0.036125 -0.15594482421875 0.4047937500000001 +0.03625 -0.167388916015625 0.4047937500000001 +0.036375 -0.178375244140625 0.4047937500000001 +0.0365 -0.18658447265625 0.4047937500000001 +0.036625 -0.193756103515625 0.4047937500000001 +0.03675 -0.19879150390625 0.4047937500000001 +0.036875 -0.20147705078125 0.4047937500000001 +0.037 -0.202362060546875 0.4047937500000001 +0.03712499999999999 -0.201263427734375 0.4047937500000001 +0.03725 -0.197967529296875 0.4047937500000001 +0.037375 -0.192474365234375 0.4047937500000001 +0.0375 -0.18572998046875 0.4047937500000001 +0.037625 -0.17633056640625 0.4047937500000001 +0.03775 -0.16619873046875 0.4047937500000001 +0.037875 -0.1531982421875 0.4047937500000001 +0.038 -0.1385498046875 0.4047937500000001 +0.038125 -0.124053955078125 0.4047937500000001 +0.03825 -0.106658935546875 0.4047937500000001 +0.038375 -0.089996337890625 0.4047937500000001 +0.0385 -0.070556640625 0.4047937500000001 +0.038625 -0.050323486328125 0.4047937500000001 +0.03875 -0.03167724609375 0.4047937500000001 +0.038875 -0.010589599609375 0.4047937500000001 0.039 0.008453369140625 0.4047937500000001 0.039125 0.029541015625 0.4047937500000001 0.03925 0.05029296875 0.4047937500000001 @@ -341,37 +341,37 @@ 0.0425 0.056427001953125 0.4047937500000001 0.042625 0.03582763671875 0.4047937500000001 0.04275 0.01690673828125 0.4047937500000001 -0.04287500000000001 -0.00421142578125 0.4047937500000001 -0.04300000000000001 -0.02532958984375 0.4047937500000001 -0.043125 -0.04412841796875 0.4047937500000001 -0.04325 -0.064544677734375 0.4047937500000001 -0.043375 -0.082305908203125 0.4047937500000001 -0.04350000000000001 -0.101165771484375 0.4047937500000001 -0.04362500000000001 -0.118927001953125 0.4047937500000001 -0.04375000000000001 -0.133819580078125 0.4047937500000001 -0.043875 -0.148956298828125 0.4047937500000001 -0.04399999999999999 -0.161163330078125 0.4047937500000001 -0.044125 -0.173095703125 0.4047937500000001 -0.04425 -0.18310546875 0.4047937500000001 -0.044375 -0.190399169921875 0.4047937500000001 -0.04449999999999999 -0.196502685546875 0.4047937500000001 -0.04462499999999999 -0.2001953125 0.4047937500000001 -0.04475 -0.202178955078125 0.4047937500000001 -0.044875 -0.20196533203125 0.4047937500000001 -0.045 -0.199859619140625 0.4047937500000001 -0.045125 -0.195465087890625 0.4047937500000001 -0.04525 -0.189666748046875 0.4047937500000001 -0.045375 -0.181243896484375 0.4047937500000001 -0.0455 -0.17083740234375 0.4047937500000001 -0.045625 -0.159881591796875 0.4047937500000001 -0.04575 -0.14605712890625 0.4047937500000001 -0.045875 -0.1322021484375 0.4047937500000001 -0.046 -0.115478515625 0.4047937500000001 -0.046125 -0.09747314453125 0.4047937500000001 -0.04625 -0.080352783203125 0.4047937500000001 -0.046375 -0.06048583984375 0.4047937500000001 -0.04649999999999999 -0.04205322265625 0.4047937500000001 -0.046625 -0.021148681640625 0.4047937500000001 +0.04287500000000001 -0.004241943359375 0.4047937500000001 +0.04300000000000001 -0.025360107421875 0.4047937500000001 +0.043125 -0.044158935546875 0.4047937500000001 +0.04325 -0.0645751953125 0.4047937500000001 +0.043375 -0.08233642578125 0.4047937500000001 +0.04350000000000001 -0.1011962890625 0.4047937500000001 +0.04362500000000001 -0.11895751953125 0.4047937500000001 +0.04375000000000001 -0.13385009765625 0.4047937500000001 +0.043875 -0.14898681640625 0.4047937500000001 +0.04399999999999999 -0.16119384765625 0.4047937500000001 +0.044125 -0.173126220703125 0.4047937500000001 +0.04425 -0.183135986328125 0.4047937500000001 +0.044375 -0.1904296875 0.4047937500000001 +0.04449999999999999 -0.196533203125 0.4047937500000001 +0.04462499999999999 -0.200225830078125 0.4047937500000001 +0.04475 -0.20220947265625 0.4047937500000001 +0.044875 -0.201995849609375 0.4047937500000001 +0.045 -0.19989013671875 0.4047937500000001 +0.045125 -0.19549560546875 0.4047937500000001 +0.04525 -0.189697265625 0.4047937500000001 +0.045375 -0.1812744140625 0.4047937500000001 +0.0455 -0.170867919921875 0.4047937500000001 +0.045625 -0.159912109375 0.4047937500000001 +0.04575 -0.146087646484375 0.4047937500000001 +0.045875 -0.132232666015625 0.4047937500000001 +0.046 -0.115509033203125 0.4047937500000001 +0.046125 -0.097503662109375 0.4047937500000001 +0.04625 -0.08038330078125 0.4047937500000001 +0.046375 -0.060516357421875 0.4047937500000001 +0.04649999999999999 -0.042083740234375 0.4047937500000001 +0.046625 -0.02117919921875 0.4047937500000001 0.04675000000000001 0.0 0.4047937500000001 0.046875 0.019012451171875 0.4047937500000001 0.04699999999999999 0.03997802734375 0.4047937500000001 @@ -404,37 +404,37 @@ 0.05037500000000001 0.04620361328125 0.4047937500000001 0.0505 0.02532958984375 0.4047937500000001 0.05062500000000001 0.00634765625 0.4047937500000001 -0.05075000000000001 -0.014801025390625 0.4047937500000001 -0.050875 -0.033721923828125 0.4047937500000001 -0.051 -0.054412841796875 0.4047937500000001 -0.051125 -0.074493408203125 0.4047937500000001 -0.05125000000000001 -0.09185791015625 0.4047937500000001 -0.051375 -0.110198974609375 0.4047937500000001 -0.0515 -0.12567138671875 0.4047937500000001 -0.05162500000000001 -0.141571044921875 0.4047937500000001 -0.05175000000000001 -0.155914306640625 0.4047937500000001 -0.051875 -0.1673583984375 0.4047937500000001 -0.052 -0.1783447265625 0.4047937500000001 -0.052125 -0.186553955078125 0.4047937500000001 -0.05225 -0.1937255859375 0.4047937500000001 -0.05237499999999999 -0.198760986328125 0.4047937500000001 -0.0525 -0.201446533203125 0.4047937500000001 -0.052625 -0.20233154296875 0.4047937500000001 -0.05274999999999999 -0.20123291015625 0.4047937500000001 -0.052875 -0.19793701171875 0.4047937500000001 -0.05300000000000001 -0.19244384765625 0.4047937500000001 -0.053125 -0.185699462890625 0.4047937500000001 -0.05324999999999999 -0.176300048828125 0.4047937500000001 -0.05337499999999999 -0.166168212890625 0.4047937500000001 -0.05350000000000001 -0.153167724609375 0.4047937500000001 -0.053625 -0.138519287109375 0.4047937500000001 -0.05375 -0.1240234375 0.4047937500000001 -0.05387499999999999 -0.10662841796875 0.4047937500000001 -0.054 -0.0899658203125 0.4047937500000001 -0.054125 -0.070526123046875 0.4047937500000001 -0.05425 -0.05029296875 0.4047937500000001 -0.054375 -0.031646728515625 0.4047937500000001 -0.0545 -0.01055908203125 0.4047937500000001 +0.05075000000000001 -0.01483154296875 0.4047937500000001 +0.050875 -0.03375244140625 0.4047937500000001 +0.051 -0.054443359375 0.4047937500000001 +0.051125 -0.07452392578125 0.4047937500000001 +0.05125000000000001 -0.091888427734375 0.4047937500000001 +0.051375 -0.1102294921875 0.4047937500000001 +0.0515 -0.125701904296875 0.4047937500000001 +0.05162500000000001 -0.1416015625 0.4047937500000001 +0.05175000000000001 -0.15594482421875 0.4047937500000001 +0.051875 -0.167388916015625 0.4047937500000001 +0.052 -0.178375244140625 0.4047937500000001 +0.052125 -0.18658447265625 0.4047937500000001 +0.05225 -0.193756103515625 0.4047937500000001 +0.05237499999999999 -0.19879150390625 0.4047937500000001 +0.0525 -0.20147705078125 0.4047937500000001 +0.052625 -0.202362060546875 0.4047937500000001 +0.05274999999999999 -0.201263427734375 0.4047937500000001 +0.052875 -0.197967529296875 0.4047937500000001 +0.05300000000000001 -0.192474365234375 0.4047937500000001 +0.053125 -0.18572998046875 0.4047937500000001 +0.05324999999999999 -0.17633056640625 0.4047937500000001 +0.05337499999999999 -0.16619873046875 0.4047937500000001 +0.05350000000000001 -0.1531982421875 0.4047937500000001 +0.053625 -0.1385498046875 0.4047937500000001 +0.05375 -0.124053955078125 0.4047937500000001 +0.05387499999999999 -0.106658935546875 0.4047937500000001 +0.054 -0.089996337890625 0.4047937500000001 +0.054125 -0.070556640625 0.4047937500000001 +0.05425 -0.050323486328125 0.4047937500000001 +0.054375 -0.03167724609375 0.4047937500000001 +0.0545 -0.010589599609375 0.4047937500000001 0.054625 0.008453369140625 0.4047937500000001 0.05475 0.029541015625 0.4047937500000001 0.054875 0.05029296875 0.4047937500000001 @@ -466,37 +466,37 @@ 0.058125 0.056427001953125 0.4047937500000001 0.05825 0.03582763671875 0.4047937500000001 0.058375 0.01690673828125 0.4047937500000001 -0.05850000000000001 -0.00421142578125 0.4047937500000001 -0.05862500000000001 -0.02532958984375 0.4047937500000001 -0.05875 -0.04412841796875 0.4047937500000001 -0.058875 -0.064544677734375 0.4047937500000001 -0.059 -0.082305908203125 0.4047937500000001 -0.05912500000000001 -0.101165771484375 0.4047937500000001 -0.05925000000000001 -0.118927001953125 0.4047937500000001 -0.059375 -0.133819580078125 0.4047937500000001 -0.05950000000000001 -0.148956298828125 0.4047937500000001 -0.059625 -0.161163330078125 0.4047937500000001 -0.05975000000000001 -0.173095703125 0.4047937500000001 -0.059875 -0.18310546875 0.4047937500000001 -0.06 -0.190399169921875 0.4047937500000001 -0.06012499999999999 -0.196502685546875 0.4047937500000001 -0.06025 -0.2001953125 0.4047937500000001 -0.060375 -0.202178955078125 0.4047937500000001 -0.0605 -0.20196533203125 0.4047937500000001 -0.060625 -0.199859619140625 0.4047937500000001 -0.06074999999999999 -0.195465087890625 0.4047937500000001 -0.060875 -0.189666748046875 0.4047937500000001 -0.061 -0.181243896484375 0.4047937500000001 -0.061125 -0.17083740234375 0.4047937500000001 -0.06125 -0.159881591796875 0.4047937500000001 -0.061375 -0.14605712890625 0.4047937500000001 -0.0615 -0.1322021484375 0.4047937500000001 -0.061625 -0.115478515625 0.4047937500000001 -0.06174999999999999 -0.09747314453125 0.4047937500000001 -0.061875 -0.080352783203125 0.4047937500000001 -0.062 -0.06048583984375 0.4047937500000001 -0.06212499999999999 -0.04205322265625 0.4047937500000001 -0.06225000000000001 -0.021148681640625 0.4047937500000001 +0.05850000000000001 -0.004241943359375 0.4047937500000001 +0.05862500000000001 -0.025360107421875 0.4047937500000001 +0.05875 -0.044158935546875 0.4047937500000001 +0.058875 -0.0645751953125 0.4047937500000001 +0.059 -0.08233642578125 0.4047937500000001 +0.05912500000000001 -0.1011962890625 0.4047937500000001 +0.05925000000000001 -0.11895751953125 0.4047937500000001 +0.059375 -0.13385009765625 0.4047937500000001 +0.05950000000000001 -0.14898681640625 0.4047937500000001 +0.059625 -0.16119384765625 0.4047937500000001 +0.05975000000000001 -0.173126220703125 0.4047937500000001 +0.059875 -0.183135986328125 0.4047937500000001 +0.06 -0.1904296875 0.4047937500000001 +0.06012499999999999 -0.196533203125 0.4047937500000001 +0.06025 -0.200225830078125 0.4047937500000001 +0.060375 -0.20220947265625 0.4047937500000001 +0.0605 -0.201995849609375 0.4047937500000001 +0.060625 -0.19989013671875 0.4047937500000001 +0.06074999999999999 -0.19549560546875 0.4047937500000001 +0.060875 -0.189697265625 0.4047937500000001 +0.061 -0.1812744140625 0.4047937500000001 +0.061125 -0.170867919921875 0.4047937500000001 +0.06125 -0.159912109375 0.4047937500000001 +0.061375 -0.146087646484375 0.4047937500000001 +0.0615 -0.132232666015625 0.4047937500000001 +0.061625 -0.115509033203125 0.4047937500000001 +0.06174999999999999 -0.097503662109375 0.4047937500000001 +0.061875 -0.08038330078125 0.4047937500000001 +0.062 -0.060516357421875 0.4047937500000001 +0.06212499999999999 -0.042083740234375 0.4047937500000001 +0.06225000000000001 -0.02117919921875 0.4047937500000001 0.06237500000000001 0.0 0.4047937500000001 0.0625 0.019012451171875 0.4047937500000001 0.06262499999999999 0.03997802734375 0.4047937500000001 @@ -529,37 +529,37 @@ 0.06600000000000001 0.057891845703125 0.507190625 0.066125 0.031768798828125 0.507190625 0.06625000000000001 0.0079345703125 0.507190625 -0.06637500000000001 -0.0185546875 0.507190625 -0.0665 -0.042266845703125 0.507190625 -0.066625 -0.06817626953125 0.507190625 -0.06675 -0.09332275390625 0.507190625 -0.06687500000000001 -0.1151123046875 0.507190625 -0.067 -0.138092041015625 0.507190625 -0.067125 -0.157501220703125 0.507190625 -0.06725000000000001 -0.177398681640625 0.507190625 -0.06737500000000001 -0.19537353515625 0.507190625 -0.0675 -0.209716796875 0.507190625 -0.067625 -0.22344970703125 0.507190625 -0.06775 -0.233734130859375 0.507190625 -0.06787500000000001 -0.24273681640625 0.507190625 -0.06800000000000001 -0.249053955078125 0.507190625 -0.068125 -0.25244140625 0.507190625 -0.06825000000000001 -0.2535400390625 0.507190625 -0.068375 -0.252166748046875 0.507190625 -0.06850000000000001 -0.248016357421875 0.507190625 -0.06862500000000001 -0.24114990234375 0.507190625 -0.06875 -0.232696533203125 0.507190625 -0.06887500000000001 -0.220916748046875 0.507190625 -0.069 -0.20819091796875 0.507190625 -0.06912500000000001 -0.191925048828125 0.507190625 -0.06925000000000001 -0.173553466796875 0.507190625 -0.06937500000000001 -0.1553955078125 0.507190625 -0.06950000000000001 -0.13360595703125 0.507190625 -0.069625 -0.11273193359375 0.507190625 -0.06975 -0.08837890625 0.507190625 -0.06987500000000001 -0.06304931640625 0.507190625 -0.07000000000000001 -0.039642333984375 0.507190625 -0.070125 -0.01324462890625 0.507190625 +0.06637500000000001 -0.018585205078125 0.507190625 +0.0665 -0.04229736328125 0.507190625 +0.066625 -0.068206787109375 0.507190625 +0.06675 -0.093353271484375 0.507190625 +0.06687500000000001 -0.115142822265625 0.507190625 +0.067 -0.13812255859375 0.507190625 +0.067125 -0.15753173828125 0.507190625 +0.06725000000000001 -0.17742919921875 0.507190625 +0.06737500000000001 -0.195404052734375 0.507190625 +0.0675 -0.209747314453125 0.507190625 +0.067625 -0.223480224609375 0.507190625 +0.06775 -0.2337646484375 0.507190625 +0.06787500000000001 -0.242767333984375 0.507190625 +0.06800000000000001 -0.24908447265625 0.507190625 +0.068125 -0.252471923828125 0.507190625 +0.06825000000000001 -0.253570556640625 0.507190625 +0.068375 -0.252197265625 0.507190625 +0.06850000000000001 -0.248046875 0.507190625 +0.06862500000000001 -0.241180419921875 0.507190625 +0.06875 -0.23272705078125 0.507190625 +0.06887500000000001 -0.220947265625 0.507190625 +0.069 -0.208221435546875 0.507190625 +0.06912500000000001 -0.19195556640625 0.507190625 +0.06925000000000001 -0.173583984375 0.507190625 +0.06937500000000001 -0.155426025390625 0.507190625 +0.06950000000000001 -0.133636474609375 0.507190625 +0.069625 -0.112762451171875 0.507190625 +0.06975 -0.088409423828125 0.507190625 +0.06987500000000001 -0.063079833984375 0.507190625 +0.07000000000000001 -0.0396728515625 0.507190625 +0.070125 -0.013275146484375 0.507190625 0.07025000000000001 0.010589599609375 0.507190625 0.07037500000000001 0.037017822265625 0.507190625 0.07050000000000001 0.06304931640625 0.507190625 @@ -591,37 +591,37 @@ 0.07374999999999999 0.07073974609375 0.507190625 0.073875 0.044891357421875 0.507190625 0.074 0.021209716796875 0.507190625 -0.074125 -0.005279541015625 0.507190625 -0.07424999999999999 -0.031768798828125 0.507190625 -0.07437499999999999 -0.0552978515625 0.507190625 -0.0745 -0.08087158203125 0.507190625 -0.07462499999999999 -0.103118896484375 0.507190625 -0.07475 -0.12677001953125 0.507190625 -0.07487500000000001 -0.149017333984375 0.507190625 -0.075 -0.16766357421875 0.507190625 -0.07512499999999999 -0.1866455078125 0.507190625 -0.07524999999999999 -0.20196533203125 0.507190625 -0.075375 -0.216888427734375 0.507190625 -0.0755 -0.22943115234375 0.507190625 -0.075625 -0.238555908203125 0.507190625 -0.07574999999999999 -0.246246337890625 0.507190625 -0.075875 -0.250823974609375 0.507190625 -0.076 -0.253326416015625 0.507190625 -0.076125 -0.2530517578125 0.507190625 -0.07625 -0.25042724609375 0.507190625 -0.07637499999999999 -0.244903564453125 0.507190625 -0.0765 -0.237640380859375 0.507190625 -0.076625 -0.22711181640625 0.507190625 -0.07675 -0.214080810546875 0.507190625 -0.076875 -0.200347900390625 0.507190625 -0.077 -0.183013916015625 0.507190625 -0.077125 -0.165679931640625 0.507190625 -0.07725 -0.14471435546875 0.507190625 -0.07737499999999999 -0.12213134765625 0.507190625 -0.0775 -0.100677490234375 0.507190625 -0.077625 -0.0758056640625 0.507190625 -0.07774999999999999 -0.052703857421875 0.507190625 -0.07787500000000001 -0.0264892578125 0.507190625 +0.074125 -0.00531005859375 0.507190625 +0.07424999999999999 -0.03179931640625 0.507190625 +0.07437499999999999 -0.055328369140625 0.507190625 +0.0745 -0.080902099609375 0.507190625 +0.07462499999999999 -0.1031494140625 0.507190625 +0.07475 -0.126800537109375 0.507190625 +0.07487500000000001 -0.1490478515625 0.507190625 +0.075 -0.167694091796875 0.507190625 +0.07512499999999999 -0.186676025390625 0.507190625 +0.07524999999999999 -0.201995849609375 0.507190625 +0.075375 -0.2169189453125 0.507190625 +0.0755 -0.229461669921875 0.507190625 +0.075625 -0.23858642578125 0.507190625 +0.07574999999999999 -0.24627685546875 0.507190625 +0.075875 -0.2508544921875 0.507190625 +0.076 -0.25335693359375 0.507190625 +0.076125 -0.253082275390625 0.507190625 +0.07625 -0.250457763671875 0.507190625 +0.07637499999999999 -0.24493408203125 0.507190625 +0.0765 -0.2376708984375 0.507190625 +0.076625 -0.227142333984375 0.507190625 +0.07675 -0.214111328125 0.507190625 +0.076875 -0.20037841796875 0.507190625 +0.077 -0.18304443359375 0.507190625 +0.077125 -0.16571044921875 0.507190625 +0.07725 -0.144744873046875 0.507190625 +0.07737499999999999 -0.122161865234375 0.507190625 +0.0775 -0.1007080078125 0.507190625 +0.077625 -0.075836181640625 0.507190625 +0.07774999999999999 -0.052734375 0.507190625 +0.07787500000000001 -0.026519775390625 0.507190625 0.07800000000000001 0.0 0.507190625 0.078125 0.023834228515625 0.507190625 0.07824999999999999 0.05010986328125 0.507190625 @@ -654,37 +654,37 @@ 0.081625 0.057891845703125 0.507190625 0.08175000000000001 0.031768798828125 0.507190625 0.081875 0.0079345703125 0.507190625 -0.08200000000000001 -0.0185546875 0.507190625 -0.082125 -0.042266845703125 0.507190625 -0.08225 -0.06817626953125 0.507190625 -0.08237500000000001 -0.09332275390625 0.507190625 -0.0825 -0.1151123046875 0.507190625 -0.08262500000000001 -0.138092041015625 0.507190625 -0.08275 -0.157501220703125 0.507190625 -0.08287500000000001 -0.177398681640625 0.507190625 -0.08300000000000001 -0.19537353515625 0.507190625 -0.083125 -0.209716796875 0.507190625 -0.08324999999999999 -0.22344970703125 0.507190625 -0.083375 -0.233734130859375 0.507190625 -0.08350000000000001 -0.24273681640625 0.507190625 -0.08362500000000001 -0.249053955078125 0.507190625 -0.08375 -0.25244140625 0.507190625 -0.08387500000000001 -0.2535400390625 0.507190625 -0.084 -0.252166748046875 0.507190625 -0.08412500000000001 -0.248016357421875 0.507190625 -0.08425000000000001 -0.24114990234375 0.507190625 -0.084375 -0.232696533203125 0.507190625 -0.08450000000000001 -0.220916748046875 0.507190625 -0.084625 -0.20819091796875 0.507190625 -0.08475 -0.191925048828125 0.507190625 -0.08487500000000001 -0.173553466796875 0.507190625 -0.085 -0.1553955078125 0.507190625 -0.08512500000000001 -0.13360595703125 0.507190625 -0.08525 -0.11273193359375 0.507190625 -0.085375 -0.08837890625 0.507190625 -0.08550000000000001 -0.06304931640625 0.507190625 -0.085625 -0.039642333984375 0.507190625 -0.08575000000000001 -0.01324462890625 0.507190625 +0.08200000000000001 -0.018585205078125 0.507190625 +0.082125 -0.04229736328125 0.507190625 +0.08225 -0.068206787109375 0.507190625 +0.08237500000000001 -0.093353271484375 0.507190625 +0.0825 -0.115142822265625 0.507190625 +0.08262500000000001 -0.13812255859375 0.507190625 +0.08275 -0.15753173828125 0.507190625 +0.08287500000000001 -0.17742919921875 0.507190625 +0.08300000000000001 -0.195404052734375 0.507190625 +0.083125 -0.209747314453125 0.507190625 +0.08324999999999999 -0.223480224609375 0.507190625 +0.083375 -0.2337646484375 0.507190625 +0.08350000000000001 -0.242767333984375 0.507190625 +0.08362500000000001 -0.24908447265625 0.507190625 +0.08375 -0.252471923828125 0.507190625 +0.08387500000000001 -0.253570556640625 0.507190625 +0.084 -0.252197265625 0.507190625 +0.08412500000000001 -0.248046875 0.507190625 +0.08425000000000001 -0.241180419921875 0.507190625 +0.084375 -0.23272705078125 0.507190625 +0.08450000000000001 -0.220947265625 0.507190625 +0.084625 -0.208221435546875 0.507190625 +0.08475 -0.19195556640625 0.507190625 +0.08487500000000001 -0.173583984375 0.507190625 +0.085 -0.155426025390625 0.507190625 +0.08512500000000001 -0.133636474609375 0.507190625 +0.08525 -0.112762451171875 0.507190625 +0.085375 -0.088409423828125 0.507190625 +0.08550000000000001 -0.063079833984375 0.507190625 +0.085625 -0.0396728515625 0.507190625 +0.08575000000000001 -0.013275146484375 0.507190625 0.08587500000000002 0.010589599609375 0.507190625 0.08600000000000001 0.037017822265625 0.507190625 0.08612500000000001 0.06304931640625 0.507190625 @@ -716,37 +716,37 @@ 0.089375 0.07073974609375 0.507190625 0.08949999999999999 0.044891357421875 0.507190625 0.089625 0.021209716796875 0.507190625 -0.08975 -0.005279541015625 0.507190625 -0.08987499999999999 -0.031768798828125 0.507190625 -0.09 -0.0552978515625 0.507190625 -0.09012499999999999 -0.08087158203125 0.507190625 -0.09025 -0.103118896484375 0.507190625 -0.090375 -0.12677001953125 0.507190625 -0.09050000000000001 -0.149017333984375 0.507190625 -0.090625 -0.16766357421875 0.507190625 -0.09074999999999999 -0.1866455078125 0.507190625 -0.09087499999999999 -0.20196533203125 0.507190625 -0.091 -0.216888427734375 0.507190625 -0.09112500000000001 -0.22943115234375 0.507190625 -0.09125 -0.238555908203125 0.507190625 -0.09137499999999999 -0.246246337890625 0.507190625 -0.0915 -0.250823974609375 0.507190625 -0.091625 -0.253326416015625 0.507190625 -0.09175000000000001 -0.2530517578125 0.507190625 -0.091875 -0.25042724609375 0.507190625 -0.09199999999999999 -0.244903564453125 0.507190625 -0.092125 -0.237640380859375 0.507190625 -0.09225 -0.22711181640625 0.507190625 -0.09237499999999999 -0.214080810546875 0.507190625 -0.0925 -0.200347900390625 0.507190625 -0.09262499999999999 -0.183013916015625 0.507190625 -0.09275 -0.165679931640625 0.507190625 -0.092875 -0.14471435546875 0.507190625 -0.09299999999999999 -0.12213134765625 0.507190625 -0.093125 -0.100677490234375 0.507190625 -0.09324999999999999 -0.0758056640625 0.507190625 -0.093375 -0.052703857421875 0.507190625 -0.09350000000000001 -0.0264892578125 0.507190625 +0.08975 -0.00531005859375 0.507190625 +0.08987499999999999 -0.03179931640625 0.507190625 +0.09 -0.055328369140625 0.507190625 +0.09012499999999999 -0.080902099609375 0.507190625 +0.09025 -0.1031494140625 0.507190625 +0.090375 -0.126800537109375 0.507190625 +0.09050000000000001 -0.1490478515625 0.507190625 +0.090625 -0.167694091796875 0.507190625 +0.09074999999999999 -0.186676025390625 0.507190625 +0.09087499999999999 -0.201995849609375 0.507190625 +0.091 -0.2169189453125 0.507190625 +0.09112500000000001 -0.229461669921875 0.507190625 +0.09125 -0.23858642578125 0.507190625 +0.09137499999999999 -0.24627685546875 0.507190625 +0.0915 -0.2508544921875 0.507190625 +0.091625 -0.25335693359375 0.507190625 +0.09175000000000001 -0.253082275390625 0.507190625 +0.091875 -0.250457763671875 0.507190625 +0.09199999999999999 -0.24493408203125 0.507190625 +0.092125 -0.2376708984375 0.507190625 +0.09225 -0.227142333984375 0.507190625 +0.09237499999999999 -0.214111328125 0.507190625 +0.0925 -0.20037841796875 0.507190625 +0.09262499999999999 -0.18304443359375 0.507190625 +0.09275 -0.16571044921875 0.507190625 +0.092875 -0.144744873046875 0.507190625 +0.09299999999999999 -0.122161865234375 0.507190625 +0.093125 -0.1007080078125 0.507190625 +0.09324999999999999 -0.075836181640625 0.507190625 +0.093375 -0.052734375 0.507190625 +0.09350000000000001 -0.026519775390625 0.507190625 0.09362500000000001 0.0 0.507190625 0.09375 0.023834228515625 0.507190625 0.09387499999999999 0.05010986328125 0.507190625 @@ -779,37 +779,37 @@ 0.09725 0.069580078125 0.6095875 0.09737500000000001 0.038177490234375 0.6095875 0.0975 0.009552001953125 0.6095875 -0.09762500000000001 -0.022308349609375 0.6095875 -0.09775 -0.050811767578125 0.6095875 -0.097875 -0.081939697265625 0.6095875 -0.09800000000000001 -0.1121826171875 0.6095875 -0.098125 -0.138336181640625 0.6095875 -0.09825000000000001 -0.165985107421875 0.6095875 -0.098375 -0.189300537109375 0.6095875 -0.09850000000000001 -0.213226318359375 0.6095875 -0.09862500000000001 -0.23480224609375 0.6095875 -0.09875 -0.252044677734375 0.6095875 -0.09887499999999999 -0.268585205078125 0.6095875 -0.099 -0.28094482421875 0.6095875 -0.09912500000000001 -0.291748046875 0.6095875 -0.09925000000000001 -0.299346923828125 0.6095875 -0.099375 -0.30340576171875 0.6095875 -0.09950000000000001 -0.30474853515625 0.6095875 -0.099625 -0.303070068359375 0.6095875 -0.09975000000000001 -0.298095703125 0.6095875 -0.09987500000000001 -0.289825439453125 0.6095875 -0.1 -0.279693603515625 0.6095875 -0.100125 -0.2655029296875 0.6095875 -0.10025 -0.250244140625 0.6095875 -0.100375 -0.230682373046875 0.6095875 -0.1005 -0.2086181640625 0.6095875 -0.100625 -0.186767578125 0.6095875 -0.10075 -0.16058349609375 0.6095875 -0.100875 -0.135498046875 0.6095875 -0.101 -0.106201171875 0.6095875 -0.101125 -0.075775146484375 0.6095875 -0.10125 -0.047637939453125 0.6095875 -0.101375 -0.01593017578125 0.6095875 +0.09762500000000001 -0.0223388671875 0.6095875 +0.09775 -0.05084228515625 0.6095875 +0.097875 -0.08197021484375 0.6095875 +0.09800000000000001 -0.112213134765625 0.6095875 +0.098125 -0.13836669921875 0.6095875 +0.09825000000000001 -0.166015625 0.6095875 +0.098375 -0.1893310546875 0.6095875 +0.09850000000000001 -0.2132568359375 0.6095875 +0.09862500000000001 -0.234832763671875 0.6095875 +0.09875 -0.2520751953125 0.6095875 +0.09887499999999999 -0.26861572265625 0.6095875 +0.099 -0.280975341796875 0.6095875 +0.09912500000000001 -0.291778564453125 0.6095875 +0.09925000000000001 -0.29937744140625 0.6095875 +0.099375 -0.303436279296875 0.6095875 +0.09950000000000001 -0.304779052734375 0.6095875 +0.099625 -0.3031005859375 0.6095875 +0.09975000000000001 -0.298126220703125 0.6095875 +0.09987500000000001 -0.28985595703125 0.6095875 +0.1 -0.27972412109375 0.6095875 +0.100125 -0.265533447265625 0.6095875 +0.10025 -0.250274658203125 0.6095875 +0.100375 -0.230712890625 0.6095875 +0.1005 -0.208648681640625 0.6095875 +0.100625 -0.186798095703125 0.6095875 +0.10075 -0.160614013671875 0.6095875 +0.100875 -0.135528564453125 0.6095875 +0.101 -0.106231689453125 0.6095875 +0.101125 -0.0758056640625 0.6095875 +0.10125 -0.04766845703125 0.6095875 +0.101375 -0.015960693359375 0.6095875 0.1015 0.01275634765625 0.6095875 0.101625 0.04449462890625 0.6095875 0.10175 0.075775146484375 0.6095875 @@ -841,37 +841,37 @@ 0.105 0.084991455078125 0.6095875 0.105125 0.053955078125 0.6095875 0.10525 0.025482177734375 0.6095875 -0.105375 -0.006378173828125 0.6095875 -0.1055 -0.038177490234375 0.6095875 -0.105625 -0.06646728515625 0.6095875 -0.10575 -0.097198486328125 0.6095875 -0.105875 -0.123931884765625 0.6095875 -0.106 -0.152374267578125 0.6095875 -0.106125 -0.179107666015625 0.6095875 -0.10625 -0.2015380859375 0.6095875 -0.106375 -0.22430419921875 0.6095875 -0.1065 -0.24273681640625 0.6095875 -0.106625 -0.26068115234375 0.6095875 -0.10675 -0.2757568359375 0.6095875 -0.106875 -0.2867431640625 0.6095875 -0.107 -0.29595947265625 0.6095875 -0.107125 -0.301483154296875 0.6095875 -0.10725 -0.304473876953125 0.6095875 -0.107375 -0.30413818359375 0.6095875 -0.1075 -0.300994873046875 0.6095875 -0.107625 -0.29437255859375 0.6095875 -0.10775 -0.28564453125 0.6095875 -0.107875 -0.27294921875 0.6095875 -0.108 -0.25732421875 0.6095875 -0.108125 -0.240814208984375 0.6095875 -0.10825 -0.219940185546875 0.6095875 -0.108375 -0.199127197265625 0.6095875 -0.1085 -0.173919677734375 0.6095875 -0.108625 -0.14678955078125 0.6095875 -0.10875 -0.12103271484375 0.6095875 -0.108875 -0.09112548828125 0.6095875 -0.109 -0.0633544921875 0.6095875 -0.109125 -0.031829833984375 0.6095875 +0.105375 -0.00640869140625 0.6095875 +0.1055 -0.0382080078125 0.6095875 +0.105625 -0.066497802734375 0.6095875 +0.10575 -0.09722900390625 0.6095875 +0.105875 -0.12396240234375 0.6095875 +0.106 -0.15240478515625 0.6095875 +0.106125 -0.17913818359375 0.6095875 +0.10625 -0.201568603515625 0.6095875 +0.106375 -0.224334716796875 0.6095875 +0.1065 -0.242767333984375 0.6095875 +0.106625 -0.260711669921875 0.6095875 +0.10675 -0.275787353515625 0.6095875 +0.106875 -0.286773681640625 0.6095875 +0.107 -0.295989990234375 0.6095875 +0.107125 -0.301513671875 0.6095875 +0.10725 -0.30450439453125 0.6095875 +0.107375 -0.304168701171875 0.6095875 +0.1075 -0.301025390625 0.6095875 +0.107625 -0.294403076171875 0.6095875 +0.10775 -0.285675048828125 0.6095875 +0.107875 -0.272979736328125 0.6095875 +0.108 -0.257354736328125 0.6095875 +0.108125 -0.2408447265625 0.6095875 +0.10825 -0.219970703125 0.6095875 +0.108375 -0.19915771484375 0.6095875 +0.1085 -0.1739501953125 0.6095875 +0.108625 -0.146820068359375 0.6095875 +0.10875 -0.121063232421875 0.6095875 +0.108875 -0.091156005859375 0.6095875 +0.109 -0.063385009765625 0.6095875 +0.109125 -0.0318603515625 0.6095875 0.10925 0.0 0.6095875 0.109375 0.028656005859375 0.6095875 0.1095 0.060211181640625 0.6095875 @@ -904,37 +904,37 @@ 0.112875 0.069580078125 0.6095875 0.113 0.038177490234375 0.6095875 0.113125 0.009552001953125 0.6095875 -0.11325 -0.022308349609375 0.6095875 -0.113375 -0.050811767578125 0.6095875 -0.1135 -0.081939697265625 0.6095875 -0.113625 -0.1121826171875 0.6095875 -0.11375 -0.138336181640625 0.6095875 -0.113875 -0.165985107421875 0.6095875 -0.114 -0.189300537109375 0.6095875 -0.114125 -0.213226318359375 0.6095875 -0.11425 -0.23480224609375 0.6095875 -0.114375 -0.252044677734375 0.6095875 -0.1145 -0.268585205078125 0.6095875 -0.114625 -0.28094482421875 0.6095875 -0.11475 -0.291748046875 0.6095875 -0.114875 -0.299346923828125 0.6095875 -0.115 -0.30340576171875 0.6095875 -0.115125 -0.30474853515625 0.6095875 -0.11525 -0.303070068359375 0.6095875 -0.115375 -0.298095703125 0.6095875 -0.1155 -0.289825439453125 0.6095875 -0.115625 -0.279693603515625 0.6095875 -0.11575 -0.2655029296875 0.6095875 -0.115875 -0.250244140625 0.6095875 -0.116 -0.230682373046875 0.6095875 -0.116125 -0.2086181640625 0.6095875 -0.11625 -0.186767578125 0.6095875 -0.116375 -0.16058349609375 0.6095875 -0.1165 -0.135498046875 0.6095875 -0.116625 -0.106201171875 0.6095875 -0.11675 -0.075775146484375 0.6095875 -0.116875 -0.047637939453125 0.6095875 -0.117 -0.01593017578125 0.6095875 +0.11325 -0.0223388671875 0.6095875 +0.113375 -0.05084228515625 0.6095875 +0.1135 -0.08197021484375 0.6095875 +0.113625 -0.112213134765625 0.6095875 +0.11375 -0.13836669921875 0.6095875 +0.113875 -0.166015625 0.6095875 +0.114 -0.1893310546875 0.6095875 +0.114125 -0.2132568359375 0.6095875 +0.11425 -0.234832763671875 0.6095875 +0.114375 -0.2520751953125 0.6095875 +0.1145 -0.26861572265625 0.6095875 +0.114625 -0.280975341796875 0.6095875 +0.11475 -0.291778564453125 0.6095875 +0.114875 -0.29937744140625 0.6095875 +0.115 -0.303436279296875 0.6095875 +0.115125 -0.304779052734375 0.6095875 +0.11525 -0.3031005859375 0.6095875 +0.115375 -0.298126220703125 0.6095875 +0.1155 -0.28985595703125 0.6095875 +0.115625 -0.27972412109375 0.6095875 +0.11575 -0.265533447265625 0.6095875 +0.115875 -0.250274658203125 0.6095875 +0.116 -0.230712890625 0.6095875 +0.116125 -0.208648681640625 0.6095875 +0.11625 -0.186798095703125 0.6095875 +0.116375 -0.160614013671875 0.6095875 +0.1165 -0.135528564453125 0.6095875 +0.116625 -0.106231689453125 0.6095875 +0.11675 -0.0758056640625 0.6095875 +0.116875 -0.04766845703125 0.6095875 +0.117 -0.015960693359375 0.6095875 0.117125 0.01275634765625 0.6095875 0.11725 0.04449462890625 0.6095875 0.117375 0.075775146484375 0.6095875 @@ -966,37 +966,37 @@ 0.120625 0.084991455078125 0.6095875 0.12075 0.053955078125 0.6095875 0.120875 0.025482177734375 0.6095875 -0.121 -0.006378173828125 0.6095875 -0.121125 -0.038177490234375 0.6095875 -0.12125 -0.06646728515625 0.6095875 -0.121375 -0.097198486328125 0.6095875 -0.1215 -0.123931884765625 0.6095875 -0.121625 -0.152374267578125 0.6095875 -0.12175 -0.179107666015625 0.6095875 -0.121875 -0.2015380859375 0.6095875 -0.122 -0.22430419921875 0.6095875 -0.122125 -0.24273681640625 0.6095875 -0.12225 -0.26068115234375 0.6095875 -0.122375 -0.2757568359375 0.6095875 -0.1225 -0.2867431640625 0.6095875 -0.122625 -0.29595947265625 0.6095875 -0.12275 -0.301483154296875 0.6095875 -0.122875 -0.304473876953125 0.6095875 -0.123 -0.30413818359375 0.6095875 -0.123125 -0.300994873046875 0.6095875 -0.12325 -0.29437255859375 0.6095875 -0.123375 -0.28564453125 0.6095875 -0.1235 -0.27294921875 0.6095875 -0.123625 -0.25732421875 0.6095875 -0.12375 -0.240814208984375 0.6095875 -0.123875 -0.219940185546875 0.6095875 -0.124 -0.199127197265625 0.6095875 -0.124125 -0.173919677734375 0.6095875 -0.12425 -0.14678955078125 0.6095875 -0.124375 -0.12103271484375 0.6095875 -0.1245 -0.09112548828125 0.6095875 -0.124625 -0.0633544921875 0.6095875 -0.12475 -0.031829833984375 0.6095875 +0.121 -0.00640869140625 0.6095875 +0.121125 -0.0382080078125 0.6095875 +0.12125 -0.066497802734375 0.6095875 +0.121375 -0.09722900390625 0.6095875 +0.1215 -0.12396240234375 0.6095875 +0.121625 -0.15240478515625 0.6095875 +0.12175 -0.17913818359375 0.6095875 +0.121875 -0.201568603515625 0.6095875 +0.122 -0.224334716796875 0.6095875 +0.122125 -0.242767333984375 0.6095875 +0.12225 -0.260711669921875 0.6095875 +0.122375 -0.275787353515625 0.6095875 +0.1225 -0.286773681640625 0.6095875 +0.122625 -0.295989990234375 0.6095875 +0.12275 -0.301513671875 0.6095875 +0.122875 -0.30450439453125 0.6095875 +0.123 -0.304168701171875 0.6095875 +0.123125 -0.301025390625 0.6095875 +0.12325 -0.294403076171875 0.6095875 +0.123375 -0.285675048828125 0.6095875 +0.1235 -0.272979736328125 0.6095875 +0.123625 -0.257354736328125 0.6095875 +0.12375 -0.2408447265625 0.6095875 +0.123875 -0.219970703125 0.6095875 +0.124 -0.19915771484375 0.6095875 +0.124125 -0.1739501953125 0.6095875 +0.12425 -0.146820068359375 0.6095875 +0.124375 -0.121063232421875 0.6095875 +0.1245 -0.091156005859375 0.6095875 +0.124625 -0.063385009765625 0.6095875 +0.12475 -0.0318603515625 0.6095875 0.124875 0.0 0.6095875 0.125 0.028656005859375 0.6095875 0.125125 0.060211181640625 0.6095875 @@ -1029,37 +1029,37 @@ 0.1285 0.081268310546875 0.7119843750000001 0.128625 0.044586181640625 0.7119843750000001 0.12875 0.01116943359375 0.7119843750000001 -0.128875 -0.026031494140625 0.7119843750000001 -0.129 -0.059356689453125 0.7119843750000001 -0.129125 -0.095703125 0.7119843750000001 -0.12925 -0.131011962890625 0.7119843750000001 -0.129375 -0.161590576171875 0.7119843750000001 -0.1295 -0.19384765625 0.7119843750000001 -0.129625 -0.221099853515625 0.7119843750000001 -0.12975 -0.2490234375 0.7119843750000001 -0.129875 -0.274261474609375 0.7119843750000001 -0.13 -0.29437255859375 0.7119843750000001 -0.130125 -0.313690185546875 0.7119843750000001 -0.13025 -0.328125 0.7119843750000001 -0.130375 -0.34075927734375 0.7119843750000001 -0.1305 -0.349639892578125 0.7119843750000001 -0.130625 -0.3543701171875 0.7119843750000001 -0.13075 -0.355926513671875 0.7119843750000001 -0.130875 -0.35400390625 0.7119843750000001 -0.131 -0.34814453125 0.7119843750000001 -0.131125 -0.338531494140625 0.7119843750000001 -0.13125 -0.32666015625 0.7119843750000001 -0.131375 -0.310089111328125 0.7119843750000001 -0.1315 -0.292266845703125 0.7119843750000001 -0.131625 -0.269439697265625 0.7119843750000001 -0.13175 -0.24365234375 0.7119843750000001 -0.131875 -0.2181396484375 0.7119843750000001 -0.132 -0.18756103515625 0.7119843750000001 -0.132125 -0.15826416015625 0.7119843750000001 -0.13225 -0.124053955078125 0.7119843750000001 -0.132375 -0.0885009765625 0.7119843750000001 -0.1325 -0.0556640625 0.7119843750000001 -0.132625 -0.01861572265625 0.7119843750000001 +0.128875 -0.02606201171875 0.7119843750000001 +0.129 -0.05938720703125 0.7119843750000001 +0.129125 -0.095733642578125 0.7119843750000001 +0.12925 -0.13104248046875 0.7119843750000001 +0.129375 -0.16162109375 0.7119843750000001 +0.1295 -0.193878173828125 0.7119843750000001 +0.129625 -0.22113037109375 0.7119843750000001 +0.12975 -0.249053955078125 0.7119843750000001 +0.129875 -0.2742919921875 0.7119843750000001 +0.13 -0.294403076171875 0.7119843750000001 +0.130125 -0.313720703125 0.7119843750000001 +0.13025 -0.328155517578125 0.7119843750000001 +0.130375 -0.340789794921875 0.7119843750000001 +0.1305 -0.34967041015625 0.7119843750000001 +0.130625 -0.354400634765625 0.7119843750000001 +0.13075 -0.35595703125 0.7119843750000001 +0.130875 -0.354034423828125 0.7119843750000001 +0.131 -0.348175048828125 0.7119843750000001 +0.131125 -0.33856201171875 0.7119843750000001 +0.13125 -0.326690673828125 0.7119843750000001 +0.131375 -0.31011962890625 0.7119843750000001 +0.1315 -0.29229736328125 0.7119843750000001 +0.131625 -0.26947021484375 0.7119843750000001 +0.13175 -0.243682861328125 0.7119843750000001 +0.131875 -0.218170166015625 0.7119843750000001 +0.132 -0.187591552734375 0.7119843750000001 +0.132125 -0.158294677734375 0.7119843750000001 +0.13225 -0.12408447265625 0.7119843750000001 +0.132375 -0.088531494140625 0.7119843750000001 +0.1325 -0.055694580078125 0.7119843750000001 +0.132625 -0.018646240234375 0.7119843750000001 0.13275 0.014892578125 0.7119843750000001 0.132875 0.051971435546875 0.7119843750000001 0.133 0.0885009765625 0.7119843750000001 @@ -1091,37 +1091,37 @@ 0.13625 0.099273681640625 0.7119843750000001 0.136375 0.063018798828125 0.7119843750000001 0.1365 0.029754638671875 0.7119843750000001 -0.136625 -0.0074462890625 0.7119843750000001 -0.13675 -0.044586181640625 0.7119843750000001 -0.136875 -0.07763671875 0.7119843750000001 -0.137 -0.113525390625 0.7119843750000001 -0.137125 -0.144775390625 0.7119843750000001 -0.13725 -0.177947998046875 0.7119843750000001 -0.137375 -0.209197998046875 0.7119843750000001 -0.1375 -0.235382080078125 0.7119843750000001 -0.137625 -0.261993408203125 0.7119843750000001 -0.13775 -0.28350830078125 0.7119843750000001 -0.137875 -0.304443359375 0.7119843750000001 -0.138 -0.322052001953125 0.7119843750000001 -0.138125 -0.33489990234375 0.7119843750000001 -0.13825 -0.345672607421875 0.7119843750000001 -0.138375 -0.35211181640625 0.7119843750000001 -0.1385 -0.355621337890625 0.7119843750000001 -0.138625 -0.355255126953125 0.7119843750000001 -0.13875 -0.3515625 0.7119843750000001 -0.138875 -0.34381103515625 0.7119843750000001 -0.139 -0.3336181640625 0.7119843750000001 -0.139125 -0.318817138671875 0.7119843750000001 -0.13925 -0.300537109375 0.7119843750000001 -0.139375 -0.28125 0.7119843750000001 -0.1395 -0.25689697265625 0.7119843750000001 -0.139625 -0.232574462890625 0.7119843750000001 -0.13975 -0.203125 0.7119843750000001 -0.139875 -0.171478271484375 0.7119843750000001 -0.14 -0.141357421875 0.7119843750000001 -0.140125 -0.106414794921875 0.7119843750000001 -0.14025 -0.073974609375 0.7119843750000001 -0.140375 -0.037200927734375 0.7119843750000001 +0.136625 -0.007476806640625 0.7119843750000001 +0.13675 -0.04461669921875 0.7119843750000001 +0.136875 -0.077667236328125 0.7119843750000001 +0.137 -0.113555908203125 0.7119843750000001 +0.137125 -0.144805908203125 0.7119843750000001 +0.13725 -0.177978515625 0.7119843750000001 +0.137375 -0.209228515625 0.7119843750000001 +0.1375 -0.23541259765625 0.7119843750000001 +0.137625 -0.26202392578125 0.7119843750000001 +0.13775 -0.283538818359375 0.7119843750000001 +0.137875 -0.304473876953125 0.7119843750000001 +0.138 -0.32208251953125 0.7119843750000001 +0.138125 -0.334930419921875 0.7119843750000001 +0.13825 -0.345703125 0.7119843750000001 +0.138375 -0.352142333984375 0.7119843750000001 +0.1385 -0.35565185546875 0.7119843750000001 +0.138625 -0.35528564453125 0.7119843750000001 +0.13875 -0.351593017578125 0.7119843750000001 +0.138875 -0.343841552734375 0.7119843750000001 +0.139 -0.333648681640625 0.7119843750000001 +0.139125 -0.31884765625 0.7119843750000001 +0.13925 -0.300567626953125 0.7119843750000001 +0.139375 -0.281280517578125 0.7119843750000001 +0.1395 -0.256927490234375 0.7119843750000001 +0.139625 -0.23260498046875 0.7119843750000001 +0.13975 -0.203155517578125 0.7119843750000001 +0.139875 -0.1715087890625 0.7119843750000001 +0.14 -0.141387939453125 0.7119843750000001 +0.140125 -0.1064453125 0.7119843750000001 +0.14025 -0.074005126953125 0.7119843750000001 +0.140375 -0.0372314453125 0.7119843750000001 0.1405 0.0 0.7119843750000001 0.140625 0.033477783203125 0.7119843750000001 0.14075 0.070343017578125 0.7119843750000001 @@ -1154,37 +1154,37 @@ 0.144125 0.081268310546875 0.7119843750000001 0.14425 0.044586181640625 0.7119843750000001 0.144375 0.01116943359375 0.7119843750000001 -0.1445 -0.026031494140625 0.7119843750000001 -0.144625 -0.059356689453125 0.7119843750000001 -0.14475 -0.095703125 0.7119843750000001 -0.144875 -0.131011962890625 0.7119843750000001 -0.145 -0.161590576171875 0.7119843750000001 -0.145125 -0.19384765625 0.7119843750000001 -0.14525 -0.221099853515625 0.7119843750000001 -0.145375 -0.2490234375 0.7119843750000001 -0.1455 -0.274261474609375 0.7119843750000001 -0.145625 -0.29437255859375 0.7119843750000001 -0.14575 -0.313690185546875 0.7119843750000001 -0.145875 -0.328125 0.7119843750000001 -0.146 -0.34075927734375 0.7119843750000001 -0.146125 -0.349639892578125 0.7119843750000001 -0.14625 -0.3543701171875 0.7119843750000001 -0.146375 -0.355926513671875 0.7119843750000001 -0.1465 -0.35400390625 0.7119843750000001 -0.146625 -0.34814453125 0.7119843750000001 -0.14675 -0.338531494140625 0.7119843750000001 -0.146875 -0.32666015625 0.7119843750000001 -0.147 -0.310089111328125 0.7119843750000001 -0.147125 -0.292266845703125 0.7119843750000001 -0.14725 -0.269439697265625 0.7119843750000001 -0.147375 -0.24365234375 0.7119843750000001 -0.1475 -0.2181396484375 0.7119843750000001 -0.147625 -0.18756103515625 0.7119843750000001 -0.14775 -0.15826416015625 0.7119843750000001 -0.147875 -0.124053955078125 0.7119843750000001 -0.148 -0.0885009765625 0.7119843750000001 -0.148125 -0.0556640625 0.7119843750000001 -0.14825 -0.01861572265625 0.7119843750000001 +0.1445 -0.02606201171875 0.7119843750000001 +0.144625 -0.05938720703125 0.7119843750000001 +0.14475 -0.095733642578125 0.7119843750000001 +0.144875 -0.13104248046875 0.7119843750000001 +0.145 -0.16162109375 0.7119843750000001 +0.145125 -0.193878173828125 0.7119843750000001 +0.14525 -0.22113037109375 0.7119843750000001 +0.145375 -0.249053955078125 0.7119843750000001 +0.1455 -0.2742919921875 0.7119843750000001 +0.145625 -0.294403076171875 0.7119843750000001 +0.14575 -0.313720703125 0.7119843750000001 +0.145875 -0.328155517578125 0.7119843750000001 +0.146 -0.340789794921875 0.7119843750000001 +0.146125 -0.34967041015625 0.7119843750000001 +0.14625 -0.354400634765625 0.7119843750000001 +0.146375 -0.35595703125 0.7119843750000001 +0.1465 -0.354034423828125 0.7119843750000001 +0.146625 -0.348175048828125 0.7119843750000001 +0.14675 -0.33856201171875 0.7119843750000001 +0.146875 -0.326690673828125 0.7119843750000001 +0.147 -0.31011962890625 0.7119843750000001 +0.147125 -0.29229736328125 0.7119843750000001 +0.14725 -0.26947021484375 0.7119843750000001 +0.147375 -0.243682861328125 0.7119843750000001 +0.1475 -0.218170166015625 0.7119843750000001 +0.147625 -0.187591552734375 0.7119843750000001 +0.14775 -0.158294677734375 0.7119843750000001 +0.147875 -0.12408447265625 0.7119843750000001 +0.148 -0.088531494140625 0.7119843750000001 +0.148125 -0.055694580078125 0.7119843750000001 +0.14825 -0.018646240234375 0.7119843750000001 0.148375 0.014892578125 0.7119843750000001 0.1485 0.051971435546875 0.7119843750000001 0.148625 0.0885009765625 0.7119843750000001 @@ -1216,37 +1216,37 @@ 0.151875 0.099273681640625 0.7119843750000001 0.152 0.063018798828125 0.7119843750000001 0.152125 0.029754638671875 0.7119843750000001 -0.15225 -0.0074462890625 0.7119843750000001 -0.152375 -0.044586181640625 0.7119843750000001 -0.1525 -0.07763671875 0.7119843750000001 -0.152625 -0.113525390625 0.7119843750000001 -0.15275 -0.144775390625 0.7119843750000001 -0.152875 -0.177947998046875 0.7119843750000001 -0.153 -0.209197998046875 0.7119843750000001 -0.153125 -0.235382080078125 0.7119843750000001 -0.15325 -0.261993408203125 0.7119843750000001 -0.153375 -0.28350830078125 0.7119843750000001 -0.1535 -0.304443359375 0.7119843750000001 -0.153625 -0.322052001953125 0.7119843750000001 -0.15375 -0.33489990234375 0.7119843750000001 -0.153875 -0.345672607421875 0.7119843750000001 -0.154 -0.35211181640625 0.7119843750000001 -0.154125 -0.355621337890625 0.7119843750000001 -0.15425 -0.355255126953125 0.7119843750000001 -0.154375 -0.3515625 0.7119843750000001 -0.1545 -0.34381103515625 0.7119843750000001 -0.154625 -0.3336181640625 0.7119843750000001 -0.15475 -0.318817138671875 0.7119843750000001 -0.154875 -0.300537109375 0.7119843750000001 -0.155 -0.28125 0.7119843750000001 -0.155125 -0.25689697265625 0.7119843750000001 -0.15525 -0.232574462890625 0.7119843750000001 -0.155375 -0.203125 0.7119843750000001 -0.1555 -0.171478271484375 0.7119843750000001 -0.155625 -0.141357421875 0.7119843750000001 -0.15575 -0.106414794921875 0.7119843750000001 -0.155875 -0.073974609375 0.7119843750000001 -0.156 -0.037200927734375 0.7119843750000001 +0.15225 -0.007476806640625 0.7119843750000001 +0.152375 -0.04461669921875 0.7119843750000001 +0.1525 -0.077667236328125 0.7119843750000001 +0.152625 -0.113555908203125 0.7119843750000001 +0.15275 -0.144805908203125 0.7119843750000001 +0.152875 -0.177978515625 0.7119843750000001 +0.153 -0.209228515625 0.7119843750000001 +0.153125 -0.23541259765625 0.7119843750000001 +0.15325 -0.26202392578125 0.7119843750000001 +0.153375 -0.283538818359375 0.7119843750000001 +0.1535 -0.304473876953125 0.7119843750000001 +0.153625 -0.32208251953125 0.7119843750000001 +0.15375 -0.334930419921875 0.7119843750000001 +0.153875 -0.345703125 0.7119843750000001 +0.154 -0.352142333984375 0.7119843750000001 +0.154125 -0.35565185546875 0.7119843750000001 +0.15425 -0.35528564453125 0.7119843750000001 +0.154375 -0.351593017578125 0.7119843750000001 +0.1545 -0.343841552734375 0.7119843750000001 +0.154625 -0.333648681640625 0.7119843750000001 +0.15475 -0.31884765625 0.7119843750000001 +0.154875 -0.300567626953125 0.7119843750000001 +0.155 -0.281280517578125 0.7119843750000001 +0.155125 -0.256927490234375 0.7119843750000001 +0.15525 -0.23260498046875 0.7119843750000001 +0.155375 -0.203155517578125 0.7119843750000001 +0.1555 -0.1715087890625 0.7119843750000001 +0.155625 -0.141387939453125 0.7119843750000001 +0.15575 -0.1064453125 0.7119843750000001 +0.155875 -0.074005126953125 0.7119843750000001 +0.156 -0.0372314453125 0.7119843750000001 0.156125 0.0 0.7119843750000001 0.15625 0.033477783203125 0.7119843750000001 0.156375 0.070343017578125 0.7119843750000001 @@ -1279,37 +1279,37 @@ 0.15975 0.081268310546875 0.7119843750000001 0.159875 0.044586181640625 0.7119843750000001 0.16 0.01275634765625 0.8143812500000001 -0.160125 -0.02978515625 0.8143812500000001 -0.16025 -0.06787109375 0.8143812500000001 -0.160375 -0.109466552734375 0.8143812500000001 -0.1605 -0.149871826171875 0.8143812500000001 -0.160625 -0.184814453125 0.8143812500000001 -0.16075 -0.22174072265625 0.8143812500000001 -0.160875 -0.252899169921875 0.8143812500000001 -0.161 -0.28485107421875 0.8143812500000001 -0.161125 -0.313720703125 0.8143812500000001 -0.16125 -0.33673095703125 0.8143812500000001 -0.161375 -0.35882568359375 0.8143812500000001 -0.1615 -0.375335693359375 0.8143812500000001 -0.161625 -0.3897705078125 0.8143812500000001 -0.16175 -0.399932861328125 0.8143812500000001 -0.161875 -0.40533447265625 0.8143812500000001 -0.162 -0.407135009765625 0.8143812500000001 -0.162125 -0.4049072265625 0.8143812500000001 -0.16225 -0.39825439453125 0.8143812500000001 -0.162375 -0.38720703125 0.8143812500000001 -0.1625 -0.3736572265625 0.8143812500000001 -0.162625 -0.354705810546875 0.8143812500000001 -0.16275 -0.334320068359375 0.8143812500000001 -0.162875 -0.308197021484375 0.8143812500000001 -0.163 -0.278717041015625 0.8143812500000001 -0.163125 -0.249542236328125 0.8143812500000001 -0.16325 -0.21453857421875 0.8143812500000001 -0.163375 -0.1810302734375 0.8143812500000001 -0.1635 -0.14190673828125 0.8143812500000001 -0.163625 -0.101226806640625 0.8143812500000001 -0.16375 -0.06365966796875 0.8143812500000001 -0.163875 -0.021270751953125 0.8143812500000001 +0.160125 -0.029815673828125 0.8143812500000001 +0.16025 -0.067901611328125 0.8143812500000001 +0.160375 -0.1094970703125 0.8143812500000001 +0.1605 -0.14990234375 0.8143812500000001 +0.160625 -0.184844970703125 0.8143812500000001 +0.16075 -0.221771240234375 0.8143812500000001 +0.160875 -0.2529296875 0.8143812500000001 +0.161 -0.284881591796875 0.8143812500000001 +0.161125 -0.313751220703125 0.8143812500000001 +0.16125 -0.336761474609375 0.8143812500000001 +0.161375 -0.358856201171875 0.8143812500000001 +0.1615 -0.3753662109375 0.8143812500000001 +0.161625 -0.389801025390625 0.8143812500000001 +0.16175 -0.39996337890625 0.8143812500000001 +0.161875 -0.405364990234375 0.8143812500000001 +0.162 -0.40716552734375 0.8143812500000001 +0.162125 -0.404937744140625 0.8143812500000001 +0.16225 -0.398284912109375 0.8143812500000001 +0.162375 -0.387237548828125 0.8143812500000001 +0.1625 -0.373687744140625 0.8143812500000001 +0.162625 -0.354736328125 0.8143812500000001 +0.16275 -0.3343505859375 0.8143812500000001 +0.162875 -0.3082275390625 0.8143812500000001 +0.163 -0.27874755859375 0.8143812500000001 +0.163125 -0.24957275390625 0.8143812500000001 +0.16325 -0.214569091796875 0.8143812500000001 +0.163375 -0.181060791015625 0.8143812500000001 +0.1635 -0.141937255859375 0.8143812500000001 +0.163625 -0.10125732421875 0.8143812500000001 +0.16375 -0.063690185546875 0.8143812500000001 +0.163875 -0.02130126953125 0.8143812500000001 0.164 0.01702880859375 0.8143812500000001 0.164125 0.0594482421875 0.8143812500000001 0.16425 0.101226806640625 0.8143812500000001 @@ -1341,37 +1341,37 @@ 0.1675 0.11358642578125 0.8143812500000001 0.167625 0.07208251953125 0.8143812500000001 0.16775 0.0340576171875 0.8143812500000001 -0.167875 -0.008514404296875 0.8143812500000001 -0.168 -0.050994873046875 0.8143812500000001 -0.168125 -0.08880615234375 0.8143812500000001 -0.16825 -0.129852294921875 0.8143812500000001 -0.168375 -0.16558837890625 0.8143812500000001 -0.1685 -0.20355224609375 0.8143812500000001 -0.168625 -0.239288330078125 0.8143812500000001 -0.16875 -0.269256591796875 0.8143812500000001 -0.168875 -0.2996826171875 0.8143812500000001 -0.169 -0.324310302734375 0.8143812500000001 -0.169125 -0.3482666015625 0.8143812500000001 -0.16925 -0.368408203125 0.8143812500000001 -0.169375 -0.383056640625 0.8143812500000001 -0.1695 -0.3953857421875 0.8143812500000001 -0.169625 -0.40277099609375 0.8143812500000001 -0.16975 -0.40679931640625 0.8143812500000001 -0.169875 -0.406341552734375 0.8143812500000001 -0.17 -0.402130126953125 0.8143812500000001 -0.170125 -0.393280029296875 0.8143812500000001 -0.17025 -0.381591796875 0.8143812500000001 -0.170375 -0.36468505859375 0.8143812500000001 -0.1705 -0.343780517578125 0.8143812500000001 -0.170625 -0.32171630859375 0.8143812500000001 -0.17075 -0.293853759765625 0.8143812500000001 -0.170875 -0.266021728515625 0.8143812500000001 -0.171 -0.23236083984375 0.8143812500000001 -0.171125 -0.196136474609375 0.8143812500000001 -0.17125 -0.16168212890625 0.8143812500000001 -0.171375 -0.121734619140625 0.8143812500000001 -0.1715 -0.084625244140625 0.8143812500000001 -0.171625 -0.04254150390625 0.8143812500000001 +0.167875 -0.008544921875 0.8143812500000001 +0.168 -0.051025390625 0.8143812500000001 +0.168125 -0.088836669921875 0.8143812500000001 +0.16825 -0.1298828125 0.8143812500000001 +0.168375 -0.165618896484375 0.8143812500000001 +0.1685 -0.203582763671875 0.8143812500000001 +0.168625 -0.23931884765625 0.8143812500000001 +0.16875 -0.269287109375 0.8143812500000001 +0.168875 -0.299713134765625 0.8143812500000001 +0.169 -0.3243408203125 0.8143812500000001 +0.169125 -0.348297119140625 0.8143812500000001 +0.16925 -0.368438720703125 0.8143812500000001 +0.169375 -0.383087158203125 0.8143812500000001 +0.1695 -0.395416259765625 0.8143812500000001 +0.169625 -0.402801513671875 0.8143812500000001 +0.16975 -0.406829833984375 0.8143812500000001 +0.169875 -0.4063720703125 0.8143812500000001 +0.17 -0.40216064453125 0.8143812500000001 +0.170125 -0.393310546875 0.8143812500000001 +0.17025 -0.381622314453125 0.8143812500000001 +0.170375 -0.364715576171875 0.8143812500000001 +0.1705 -0.34381103515625 0.8143812500000001 +0.170625 -0.321746826171875 0.8143812500000001 +0.17075 -0.29388427734375 0.8143812500000001 +0.170875 -0.26605224609375 0.8143812500000001 +0.171 -0.232391357421875 0.8143812500000001 +0.171125 -0.1961669921875 0.8143812500000001 +0.17125 -0.161712646484375 0.8143812500000001 +0.171375 -0.12176513671875 0.8143812500000001 +0.1715 -0.08465576171875 0.8143812500000001 +0.171625 -0.042572021484375 0.8143812500000001 0.17175 0.0 0.8143812500000001 0.171875 0.038299560546875 0.8143812500000001 0.172 0.0804443359375 0.8143812500000001 @@ -1404,37 +1404,37 @@ 0.175375 0.09295654296875 0.8143812500000001 0.1755 0.050994873046875 0.8143812500000001 0.175625 0.01275634765625 0.8143812500000001 -0.17575 -0.02978515625 0.8143812500000001 -0.175875 -0.06787109375 0.8143812500000001 -0.176 -0.109466552734375 0.8143812500000001 -0.176125 -0.149871826171875 0.8143812500000001 -0.17625 -0.184814453125 0.8143812500000001 -0.176375 -0.22174072265625 0.8143812500000001 -0.1765 -0.252899169921875 0.8143812500000001 -0.176625 -0.28485107421875 0.8143812500000001 -0.17675 -0.313720703125 0.8143812500000001 -0.176875 -0.33673095703125 0.8143812500000001 -0.177 -0.35882568359375 0.8143812500000001 -0.177125 -0.375335693359375 0.8143812500000001 -0.17725 -0.3897705078125 0.8143812500000001 -0.177375 -0.399932861328125 0.8143812500000001 -0.1775 -0.40533447265625 0.8143812500000001 -0.177625 -0.407135009765625 0.8143812500000001 -0.17775 -0.4049072265625 0.8143812500000001 -0.177875 -0.39825439453125 0.8143812500000001 -0.178 -0.38720703125 0.8143812500000001 -0.178125 -0.3736572265625 0.8143812500000001 -0.17825 -0.354705810546875 0.8143812500000001 -0.178375 -0.334320068359375 0.8143812500000001 -0.1785 -0.308197021484375 0.8143812500000001 -0.178625 -0.278717041015625 0.8143812500000001 -0.17875 -0.249542236328125 0.8143812500000001 -0.178875 -0.21453857421875 0.8143812500000001 -0.179 -0.1810302734375 0.8143812500000001 -0.179125 -0.14190673828125 0.8143812500000001 -0.17925 -0.101226806640625 0.8143812500000001 -0.179375 -0.06365966796875 0.8143812500000001 -0.1795 -0.021270751953125 0.8143812500000001 +0.17575 -0.029815673828125 0.8143812500000001 +0.175875 -0.067901611328125 0.8143812500000001 +0.176 -0.1094970703125 0.8143812500000001 +0.176125 -0.14990234375 0.8143812500000001 +0.17625 -0.184844970703125 0.8143812500000001 +0.176375 -0.221771240234375 0.8143812500000001 +0.1765 -0.2529296875 0.8143812500000001 +0.176625 -0.284881591796875 0.8143812500000001 +0.17675 -0.313751220703125 0.8143812500000001 +0.176875 -0.336761474609375 0.8143812500000001 +0.177 -0.358856201171875 0.8143812500000001 +0.177125 -0.3753662109375 0.8143812500000001 +0.17725 -0.389801025390625 0.8143812500000001 +0.177375 -0.39996337890625 0.8143812500000001 +0.1775 -0.405364990234375 0.8143812500000001 +0.177625 -0.40716552734375 0.8143812500000001 +0.17775 -0.404937744140625 0.8143812500000001 +0.177875 -0.398284912109375 0.8143812500000001 +0.178 -0.387237548828125 0.8143812500000001 +0.178125 -0.373687744140625 0.8143812500000001 +0.17825 -0.354736328125 0.8143812500000001 +0.178375 -0.3343505859375 0.8143812500000001 +0.1785 -0.3082275390625 0.8143812500000001 +0.178625 -0.27874755859375 0.8143812500000001 +0.17875 -0.24957275390625 0.8143812500000001 +0.178875 -0.214569091796875 0.8143812500000001 +0.179 -0.181060791015625 0.8143812500000001 +0.179125 -0.141937255859375 0.8143812500000001 +0.17925 -0.10125732421875 0.8143812500000001 +0.179375 -0.063690185546875 0.8143812500000001 +0.1795 -0.02130126953125 0.8143812500000001 0.179625 0.01702880859375 0.8143812500000001 0.17975 0.0594482421875 0.8143812500000001 0.179875 0.101226806640625 0.8143812500000001 @@ -1466,37 +1466,37 @@ 0.183125 0.11358642578125 0.8143812500000001 0.18325 0.07208251953125 0.8143812500000001 0.183375 0.0340576171875 0.8143812500000001 -0.1835 -0.008514404296875 0.8143812500000001 -0.183625 -0.050994873046875 0.8143812500000001 -0.18375 -0.08880615234375 0.8143812500000001 -0.183875 -0.129852294921875 0.8143812500000001 -0.184 -0.16558837890625 0.8143812500000001 -0.184125 -0.20355224609375 0.8143812500000001 -0.18425 -0.239288330078125 0.8143812500000001 -0.184375 -0.269256591796875 0.8143812500000001 -0.1845 -0.2996826171875 0.8143812500000001 -0.184625 -0.324310302734375 0.8143812500000001 -0.18475 -0.3482666015625 0.8143812500000001 -0.184875 -0.368408203125 0.8143812500000001 -0.185 -0.383056640625 0.8143812500000001 -0.185125 -0.3953857421875 0.8143812500000001 -0.18525 -0.40277099609375 0.8143812500000001 -0.185375 -0.40679931640625 0.8143812500000001 -0.1855 -0.406341552734375 0.8143812500000001 -0.185625 -0.402130126953125 0.8143812500000001 -0.18575 -0.393280029296875 0.8143812500000001 -0.185875 -0.381591796875 0.8143812500000001 -0.186 -0.36468505859375 0.8143812500000001 -0.186125 -0.343780517578125 0.8143812500000001 -0.18625 -0.32171630859375 0.8143812500000001 -0.186375 -0.293853759765625 0.8143812500000001 -0.1865 -0.266021728515625 0.8143812500000001 -0.186625 -0.23236083984375 0.8143812500000001 -0.18675 -0.196136474609375 0.8143812500000001 -0.186875 -0.16168212890625 0.8143812500000001 -0.187 -0.121734619140625 0.8143812500000001 -0.187125 -0.084625244140625 0.8143812500000001 -0.18725 -0.04254150390625 0.8143812500000001 +0.1835 -0.008544921875 0.8143812500000001 +0.183625 -0.051025390625 0.8143812500000001 +0.18375 -0.088836669921875 0.8143812500000001 +0.183875 -0.1298828125 0.8143812500000001 +0.184 -0.165618896484375 0.8143812500000001 +0.184125 -0.203582763671875 0.8143812500000001 +0.18425 -0.23931884765625 0.8143812500000001 +0.184375 -0.269287109375 0.8143812500000001 +0.1845 -0.299713134765625 0.8143812500000001 +0.184625 -0.3243408203125 0.8143812500000001 +0.18475 -0.348297119140625 0.8143812500000001 +0.184875 -0.368438720703125 0.8143812500000001 +0.185 -0.383087158203125 0.8143812500000001 +0.185125 -0.395416259765625 0.8143812500000001 +0.18525 -0.402801513671875 0.8143812500000001 +0.185375 -0.406829833984375 0.8143812500000001 +0.1855 -0.4063720703125 0.8143812500000001 +0.185625 -0.40216064453125 0.8143812500000001 +0.18575 -0.393310546875 0.8143812500000001 +0.185875 -0.381622314453125 0.8143812500000001 +0.186 -0.364715576171875 0.8143812500000001 +0.186125 -0.34381103515625 0.8143812500000001 +0.18625 -0.321746826171875 0.8143812500000001 +0.186375 -0.29388427734375 0.8143812500000001 +0.1865 -0.26605224609375 0.8143812500000001 +0.186625 -0.232391357421875 0.8143812500000001 +0.18675 -0.1961669921875 0.8143812500000001 +0.186875 -0.161712646484375 0.8143812500000001 +0.187 -0.12176513671875 0.8143812500000001 +0.187125 -0.08465576171875 0.8143812500000001 +0.18725 -0.042572021484375 0.8143812500000001 0.187375 0.0 0.8143812500000001 0.1875 0.038299560546875 0.8143812500000001 0.187625 0.0804443359375 0.8143812500000001 @@ -1529,37 +1529,37 @@ 0.191 0.09295654296875 0.8143812500000001 0.191125 0.050994873046875 0.8143812500000001 0.19125 0.01275634765625 0.8143812500000001 -0.191375 -0.02978515625 0.8143812500000001 -0.1915 -0.06787109375 0.8143812500000001 -0.191625 -0.109466552734375 0.8143812500000001 -0.19175 -0.149871826171875 0.8143812500000001 -0.191875 -0.184814453125 0.8143812500000001 -0.192 -0.2496337890625 0.9167781250000001 -0.192125 -0.284698486328125 0.9167781250000001 -0.19225 -0.3206787109375 0.9167781250000001 -0.192375 -0.3531494140625 0.9167781250000001 -0.1925 -0.379058837890625 0.9167781250000001 -0.192625 -0.4039306640625 0.9167781250000001 -0.19275 -0.422515869140625 0.9167781250000001 -0.192875 -0.43878173828125 0.9167781250000001 -0.193 -0.450225830078125 0.9167781250000001 -0.193125 -0.456298828125 0.9167781250000001 -0.19325 -0.45831298828125 0.9167781250000001 -0.193375 -0.455841064453125 0.9167781250000001 -0.1935 -0.44830322265625 0.9167781250000001 -0.193625 -0.4359130859375 0.9167781250000001 -0.19375 -0.420654296875 0.9167781250000001 -0.193875 -0.399322509765625 0.9167781250000001 -0.194 -0.376373291015625 0.9167781250000001 -0.194125 -0.346954345703125 0.9167781250000001 -0.19425 -0.313751220703125 0.9167781250000001 -0.194375 -0.280914306640625 0.9167781250000001 -0.1945 -0.24151611328125 0.9167781250000001 -0.194625 -0.20379638671875 0.9167781250000001 -0.19475 -0.159759521484375 0.9167781250000001 -0.194875 -0.11395263671875 0.9167781250000001 -0.195 -0.071685791015625 0.9167781250000001 -0.195125 -0.023956298828125 0.9167781250000001 +0.191375 -0.029815673828125 0.8143812500000001 +0.1915 -0.067901611328125 0.8143812500000001 +0.191625 -0.1094970703125 0.8143812500000001 +0.19175 -0.14990234375 0.8143812500000001 +0.191875 -0.184844970703125 0.8143812500000001 +0.192 -0.249664306640625 0.9167781250000001 +0.192125 -0.28472900390625 0.9167781250000001 +0.19225 -0.320709228515625 0.9167781250000001 +0.192375 -0.353179931640625 0.9167781250000001 +0.1925 -0.37908935546875 0.9167781250000001 +0.192625 -0.403961181640625 0.9167781250000001 +0.19275 -0.42254638671875 0.9167781250000001 +0.192875 -0.438812255859375 0.9167781250000001 +0.193 -0.45025634765625 0.9167781250000001 +0.193125 -0.456329345703125 0.9167781250000001 +0.19325 -0.458343505859375 0.9167781250000001 +0.193375 -0.45587158203125 0.9167781250000001 +0.1935 -0.448333740234375 0.9167781250000001 +0.193625 -0.435943603515625 0.9167781250000001 +0.19375 -0.420684814453125 0.9167781250000001 +0.193875 -0.39935302734375 0.9167781250000001 +0.194 -0.37640380859375 0.9167781250000001 +0.194125 -0.34698486328125 0.9167781250000001 +0.19425 -0.31378173828125 0.9167781250000001 +0.194375 -0.28094482421875 0.9167781250000001 +0.1945 -0.241546630859375 0.9167781250000001 +0.194625 -0.203826904296875 0.9167781250000001 +0.19475 -0.1597900390625 0.9167781250000001 +0.194875 -0.113983154296875 0.9167781250000001 +0.195 -0.07171630859375 0.9167781250000001 +0.195125 -0.02398681640625 0.9167781250000001 0.19525 0.0191650390625 0.9167781250000001 0.195375 0.066925048828125 0.9167781250000001 0.1955 0.11395263671875 0.9167781250000001 @@ -1591,37 +1591,37 @@ 0.19875 0.127838134765625 0.9167781250000001 0.198875 0.081146240234375 0.9167781250000001 0.199 0.038330078125 0.9167781250000001 -0.199125 -0.00958251953125 0.9167781250000001 -0.19925 -0.05743408203125 0.9167781250000001 -0.199375 -0.099945068359375 0.9167781250000001 -0.1995 -0.14617919921875 0.9167781250000001 -0.199625 -0.1864013671875 0.9167781250000001 -0.19975 -0.229156494140625 0.9167781250000001 -0.199875 -0.269378662109375 0.9167781250000001 -0.2 -0.3031005859375 0.9167781250000001 -0.200125 -0.337371826171875 0.9167781250000001 -0.20025 -0.365081787109375 0.9167781250000001 -0.200375 -0.39202880859375 0.9167781250000001 -0.2005 -0.414703369140625 0.9167781250000001 -0.200625 -0.431243896484375 0.9167781250000001 -0.20075 -0.445098876953125 0.9167781250000001 -0.200875 -0.45343017578125 0.9167781250000001 -0.201 -0.45794677734375 0.9167781250000001 -0.201125 -0.457427978515625 0.9167781250000001 -0.20125 -0.45269775390625 0.9167781250000001 -0.201375 -0.442718505859375 0.9167781250000001 -0.2015 -0.429595947265625 0.9167781250000001 -0.201625 -0.4105224609375 0.9167781250000001 -0.20175 -0.386993408203125 0.9167781250000001 -0.201875 -0.362152099609375 0.9167781250000001 -0.202 -0.330810546875 0.9167781250000001 -0.202125 -0.299468994140625 0.9167781250000001 -0.20225 -0.261566162109375 0.9167781250000001 -0.202375 -0.220794677734375 0.9167781250000001 -0.2025 -0.1820068359375 0.9167781250000001 -0.202625 -0.137054443359375 0.9167781250000001 -0.20275 -0.09527587890625 0.9167781250000001 -0.202875 -0.047882080078125 0.9167781250000001 +0.199125 -0.009613037109375 0.9167781250000001 +0.19925 -0.057464599609375 0.9167781250000001 +0.199375 -0.0999755859375 0.9167781250000001 +0.1995 -0.146209716796875 0.9167781250000001 +0.199625 -0.186431884765625 0.9167781250000001 +0.19975 -0.22918701171875 0.9167781250000001 +0.199875 -0.2694091796875 0.9167781250000001 +0.2 -0.303131103515625 0.9167781250000001 +0.200125 -0.33740234375 0.9167781250000001 +0.20025 -0.3651123046875 0.9167781250000001 +0.200375 -0.392059326171875 0.9167781250000001 +0.2005 -0.41473388671875 0.9167781250000001 +0.200625 -0.4312744140625 0.9167781250000001 +0.20075 -0.44512939453125 0.9167781250000001 +0.200875 -0.453460693359375 0.9167781250000001 +0.201 -0.457977294921875 0.9167781250000001 +0.201125 -0.45745849609375 0.9167781250000001 +0.20125 -0.452728271484375 0.9167781250000001 +0.201375 -0.4427490234375 0.9167781250000001 +0.2015 -0.42962646484375 0.9167781250000001 +0.201625 -0.410552978515625 0.9167781250000001 +0.20175 -0.38702392578125 0.9167781250000001 +0.201875 -0.3621826171875 0.9167781250000001 +0.202 -0.330841064453125 0.9167781250000001 +0.202125 -0.29949951171875 0.9167781250000001 +0.20225 -0.2615966796875 0.9167781250000001 +0.202375 -0.2208251953125 0.9167781250000001 +0.2025 -0.182037353515625 0.9167781250000001 +0.202625 -0.1370849609375 0.9167781250000001 +0.20275 -0.095306396484375 0.9167781250000001 +0.202875 -0.04791259765625 0.9167781250000001 0.203 0.0 0.9167781250000001 0.203125 0.043121337890625 0.9167781250000001 0.20325 0.090576171875 0.9167781250000001 @@ -1654,37 +1654,37 @@ 0.206625 0.104644775390625 0.9167781250000001 0.20675 0.05743408203125 0.9167781250000001 0.206875 0.014373779296875 0.9167781250000001 -0.207 -0.033538818359375 0.9167781250000001 -0.207125 -0.076416015625 0.9167781250000001 -0.20725 -0.12322998046875 0.9167781250000001 -0.207375 -0.168701171875 0.9167781250000001 -0.2075 -0.20806884765625 0.9167781250000001 -0.207625 -0.2496337890625 0.9167781250000001 -0.20775 -0.284698486328125 0.9167781250000001 -0.207875 -0.3206787109375 0.9167781250000001 -0.208 -0.3531494140625 0.9167781250000001 -0.208125 -0.379058837890625 0.9167781250000001 -0.20825 -0.4039306640625 0.9167781250000001 -0.208375 -0.422515869140625 0.9167781250000001 -0.2085 -0.43878173828125 0.9167781250000001 -0.208625 -0.450225830078125 0.9167781250000001 -0.20875 -0.456298828125 0.9167781250000001 -0.208875 -0.45831298828125 0.9167781250000001 -0.209 -0.455841064453125 0.9167781250000001 -0.209125 -0.44830322265625 0.9167781250000001 -0.20925 -0.4359130859375 0.9167781250000001 -0.209375 -0.420654296875 0.9167781250000001 -0.2095 -0.399322509765625 0.9167781250000001 -0.209625 -0.376373291015625 0.9167781250000001 -0.20975 -0.346954345703125 0.9167781250000001 -0.209875 -0.313751220703125 0.9167781250000001 -0.21 -0.280914306640625 0.9167781250000001 -0.210125 -0.24151611328125 0.9167781250000001 -0.21025 -0.20379638671875 0.9167781250000001 -0.210375 -0.159759521484375 0.9167781250000001 -0.2105 -0.11395263671875 0.9167781250000001 -0.210625 -0.071685791015625 0.9167781250000001 -0.21075 -0.023956298828125 0.9167781250000001 +0.207 -0.0335693359375 0.9167781250000001 +0.207125 -0.076446533203125 0.9167781250000001 +0.20725 -0.123260498046875 0.9167781250000001 +0.207375 -0.168731689453125 0.9167781250000001 +0.2075 -0.208099365234375 0.9167781250000001 +0.207625 -0.249664306640625 0.9167781250000001 +0.20775 -0.28472900390625 0.9167781250000001 +0.207875 -0.320709228515625 0.9167781250000001 +0.208 -0.353179931640625 0.9167781250000001 +0.208125 -0.37908935546875 0.9167781250000001 +0.20825 -0.403961181640625 0.9167781250000001 +0.208375 -0.42254638671875 0.9167781250000001 +0.2085 -0.438812255859375 0.9167781250000001 +0.208625 -0.45025634765625 0.9167781250000001 +0.20875 -0.456329345703125 0.9167781250000001 +0.208875 -0.458343505859375 0.9167781250000001 +0.209 -0.45587158203125 0.9167781250000001 +0.209125 -0.448333740234375 0.9167781250000001 +0.20925 -0.435943603515625 0.9167781250000001 +0.209375 -0.420684814453125 0.9167781250000001 +0.2095 -0.39935302734375 0.9167781250000001 +0.209625 -0.37640380859375 0.9167781250000001 +0.20975 -0.34698486328125 0.9167781250000001 +0.209875 -0.31378173828125 0.9167781250000001 +0.21 -0.28094482421875 0.9167781250000001 +0.210125 -0.241546630859375 0.9167781250000001 +0.21025 -0.203826904296875 0.9167781250000001 +0.210375 -0.1597900390625 0.9167781250000001 +0.2105 -0.113983154296875 0.9167781250000001 +0.210625 -0.07171630859375 0.9167781250000001 +0.21075 -0.02398681640625 0.9167781250000001 0.210875 0.0191650390625 0.9167781250000001 0.211 0.066925048828125 0.9167781250000001 0.211125 0.11395263671875 0.9167781250000001 @@ -1716,37 +1716,37 @@ 0.214375 0.127838134765625 0.9167781250000001 0.2145 0.081146240234375 0.9167781250000001 0.214625 0.038330078125 0.9167781250000001 -0.21475 -0.00958251953125 0.9167781250000001 -0.214875 -0.05743408203125 0.9167781250000001 -0.215 -0.099945068359375 0.9167781250000001 -0.215125 -0.14617919921875 0.9167781250000001 -0.21525 -0.1864013671875 0.9167781250000001 -0.215375 -0.229156494140625 0.9167781250000001 -0.2155 -0.269378662109375 0.9167781250000001 -0.215625 -0.3031005859375 0.9167781250000001 -0.21575 -0.337371826171875 0.9167781250000001 -0.215875 -0.365081787109375 0.9167781250000001 -0.216 -0.39202880859375 0.9167781250000001 -0.216125 -0.414703369140625 0.9167781250000001 -0.21625 -0.431243896484375 0.9167781250000001 -0.216375 -0.445098876953125 0.9167781250000001 -0.2165 -0.45343017578125 0.9167781250000001 -0.216625 -0.45794677734375 0.9167781250000001 -0.21675 -0.457427978515625 0.9167781250000001 -0.216875 -0.45269775390625 0.9167781250000001 -0.217 -0.442718505859375 0.9167781250000001 -0.217125 -0.429595947265625 0.9167781250000001 -0.21725 -0.4105224609375 0.9167781250000001 -0.217375 -0.386993408203125 0.9167781250000001 -0.2175 -0.362152099609375 0.9167781250000001 -0.217625 -0.330810546875 0.9167781250000001 -0.21775 -0.299468994140625 0.9167781250000001 -0.217875 -0.261566162109375 0.9167781250000001 -0.218 -0.220794677734375 0.9167781250000001 -0.218125 -0.1820068359375 0.9167781250000001 -0.21825 -0.137054443359375 0.9167781250000001 -0.218375 -0.09527587890625 0.9167781250000001 -0.2185 -0.047882080078125 0.9167781250000001 +0.21475 -0.009613037109375 0.9167781250000001 +0.214875 -0.057464599609375 0.9167781250000001 +0.215 -0.0999755859375 0.9167781250000001 +0.215125 -0.146209716796875 0.9167781250000001 +0.21525 -0.186431884765625 0.9167781250000001 +0.215375 -0.22918701171875 0.9167781250000001 +0.2155 -0.2694091796875 0.9167781250000001 +0.215625 -0.303131103515625 0.9167781250000001 +0.21575 -0.33740234375 0.9167781250000001 +0.215875 -0.3651123046875 0.9167781250000001 +0.216 -0.392059326171875 0.9167781250000001 +0.216125 -0.41473388671875 0.9167781250000001 +0.21625 -0.4312744140625 0.9167781250000001 +0.216375 -0.44512939453125 0.9167781250000001 +0.2165 -0.453460693359375 0.9167781250000001 +0.216625 -0.457977294921875 0.9167781250000001 +0.21675 -0.45745849609375 0.9167781250000001 +0.216875 -0.452728271484375 0.9167781250000001 +0.217 -0.4427490234375 0.9167781250000001 +0.217125 -0.42962646484375 0.9167781250000001 +0.21725 -0.410552978515625 0.9167781250000001 +0.217375 -0.38702392578125 0.9167781250000001 +0.2175 -0.3621826171875 0.9167781250000001 +0.217625 -0.330841064453125 0.9167781250000001 +0.21775 -0.29949951171875 0.9167781250000001 +0.217875 -0.2615966796875 0.9167781250000001 +0.218 -0.2208251953125 0.9167781250000001 +0.218125 -0.182037353515625 0.9167781250000001 +0.21825 -0.1370849609375 0.9167781250000001 +0.218375 -0.095306396484375 0.9167781250000001 +0.2185 -0.04791259765625 0.9167781250000001 0.218625 0.0 0.9167781250000001 0.21875 0.043121337890625 0.9167781250000001 0.218875 0.090576171875 0.9167781250000001 @@ -1779,37 +1779,37 @@ 0.22225 0.104644775390625 0.9167781250000001 0.222375 0.05743408203125 0.9167781250000001 0.2225 0.014373779296875 0.9167781250000001 -0.222625 -0.033538818359375 0.9167781250000001 -0.22275 -0.076416015625 0.9167781250000001 -0.222875 -0.12322998046875 0.9167781250000001 -0.223 -0.168701171875 0.9167781250000001 -0.223125 -0.20806884765625 0.9167781250000001 -0.22325 -0.2496337890625 0.9167781250000001 -0.223375 -0.284698486328125 0.9167781250000001 -0.2235 -0.3206787109375 0.9167781250000001 -0.223625 -0.3531494140625 0.9167781250000001 -0.22375 -0.379058837890625 0.9167781250000001 -0.223875 -0.4039306640625 0.9167781250000001 -0.224 -0.460845947265625 0.9999511726200581 -0.224125 -0.47857666015625 0.9999511726200581 -0.22425 -0.491058349609375 0.9999511726200581 -0.224375 -0.497711181640625 0.9999511726200581 -0.2245 -0.499908447265625 0.9999511726200581 -0.224625 -0.4971923828125 0.9999511726200581 -0.22475 -0.488983154296875 0.9999511726200581 -0.224875 -0.4754638671875 0.9999511726200581 -0.225 -0.45880126953125 0.9999511726200581 -0.225125 -0.435546875 0.9999511726200581 -0.22525 -0.410491943359375 0.9999511726200581 -0.225375 -0.37841796875 0.9999511726200581 -0.2255 -0.342193603515625 0.9999511726200581 -0.225625 -0.306396484375 0.9999511726200581 -0.22575 -0.263427734375 0.9999511726200581 -0.225875 -0.222259521484375 0.9999511726200581 -0.226 -0.174224853515625 0.9999511726200581 -0.226125 -0.124298095703125 0.9999511726200581 -0.22625 -0.07818603515625 0.9999511726200581 -0.226375 -0.026123046875 0.9999511726200581 +0.222625 -0.0335693359375 0.9167781250000001 +0.22275 -0.076446533203125 0.9167781250000001 +0.222875 -0.123260498046875 0.9167781250000001 +0.223 -0.168731689453125 0.9167781250000001 +0.223125 -0.208099365234375 0.9167781250000001 +0.22325 -0.249664306640625 0.9167781250000001 +0.223375 -0.28472900390625 0.9167781250000001 +0.2235 -0.320709228515625 0.9167781250000001 +0.223625 -0.353179931640625 0.9167781250000001 +0.22375 -0.37908935546875 0.9167781250000001 +0.223875 -0.403961181640625 0.9167781250000001 +0.224 -0.46087646484375 0.9999511726200581 +0.224125 -0.478607177734375 0.9999511726200581 +0.22425 -0.4910888671875 0.9999511726200581 +0.224375 -0.49774169921875 0.9999511726200581 +0.2245 -0.49993896484375 0.9999511726200581 +0.224625 -0.497222900390625 0.9999511726200581 +0.22475 -0.489013671875 0.9999511726200581 +0.224875 -0.475494384765625 0.9999511726200581 +0.225 -0.458831787109375 0.9999511726200581 +0.225125 -0.435577392578125 0.9999511726200581 +0.22525 -0.4105224609375 0.9999511726200581 +0.225375 -0.378448486328125 0.9999511726200581 +0.2255 -0.34222412109375 0.9999511726200581 +0.225625 -0.306427001953125 0.9999511726200581 +0.22575 -0.263458251953125 0.9999511726200581 +0.225875 -0.2222900390625 0.9999511726200581 +0.226 -0.17425537109375 0.9999511726200581 +0.226125 -0.12432861328125 0.9999511726200581 +0.22625 -0.078216552734375 0.9999511726200581 +0.226375 -0.026153564453125 0.9999511726200581 0.2265 0.020904541015625 0.9999511726200581 0.226625 0.072998046875 0.9999511726200581 0.22675 0.124298095703125 0.9999511726200581 @@ -1841,37 +1841,37 @@ 0.23 0.13946533203125 0.9999511726200581 0.230125 0.0885009765625 0.9999511726200581 0.23025 0.04180908203125 0.9999511726200581 -0.230375 -0.01043701171875 0.9999511726200581 -0.2305 -0.0626220703125 0.9999511726200581 -0.230625 -0.109039306640625 0.9999511726200581 -0.23075 -0.159454345703125 0.9999511726200581 -0.230875 -0.20330810546875 0.9999511726200581 -0.231 -0.24993896484375 0.9999511726200581 -0.231125 -0.2938232421875 0.9999511726200581 -0.23125 -0.330596923828125 0.9999511726200581 -0.231375 -0.36798095703125 0.9999511726200581 -0.2315 -0.398193359375 0.9999511726200581 -0.231625 -0.4276123046875 0.9999511726200581 -0.23175 -0.45233154296875 0.9999511726200581 -0.231875 -0.470367431640625 0.9999511726200581 -0.232 -0.485504150390625 0.9999511726200581 -0.232125 -0.49456787109375 0.9999511726200581 -0.23225 -0.499481201171875 0.9999511726200581 -0.232375 -0.498931884765625 0.9999511726200581 -0.2325 -0.4937744140625 0.9999511726200581 -0.232625 -0.482879638671875 0.9999511726200581 -0.23275 -0.46856689453125 0.9999511726200581 -0.232875 -0.447784423828125 0.9999511726200581 -0.233 -0.422088623046875 0.9999511726200581 -0.233125 -0.39501953125 0.9999511726200581 -0.23325 -0.360809326171875 0.9999511726200581 -0.233375 -0.32666015625 0.9999511726200581 -0.2335 -0.285308837890625 0.9999511726200581 -0.233625 -0.240814208984375 0.9999511726200581 -0.23375 -0.198516845703125 0.9999511726200581 -0.233875 -0.14947509765625 0.9999511726200581 -0.234 -0.103912353515625 0.9999511726200581 -0.234125 -0.05224609375 0.9999511726200581 +0.230375 -0.010467529296875 0.9999511726200581 +0.2305 -0.062652587890625 0.9999511726200581 +0.230625 -0.10906982421875 0.9999511726200581 +0.23075 -0.15948486328125 0.9999511726200581 +0.230875 -0.203338623046875 0.9999511726200581 +0.231 -0.249969482421875 0.9999511726200581 +0.231125 -0.293853759765625 0.9999511726200581 +0.23125 -0.33062744140625 0.9999511726200581 +0.231375 -0.368011474609375 0.9999511726200581 +0.2315 -0.398223876953125 0.9999511726200581 +0.231625 -0.427642822265625 0.9999511726200581 +0.23175 -0.452362060546875 0.9999511726200581 +0.231875 -0.47039794921875 0.9999511726200581 +0.232 -0.48553466796875 0.9999511726200581 +0.232125 -0.494598388671875 0.9999511726200581 +0.23225 -0.49951171875 0.9999511726200581 +0.232375 -0.49896240234375 0.9999511726200581 +0.2325 -0.493804931640625 0.9999511726200581 +0.232625 -0.48291015625 0.9999511726200581 +0.23275 -0.468597412109375 0.9999511726200581 +0.232875 -0.44781494140625 0.9999511726200581 +0.233 -0.422119140625 0.9999511726200581 +0.233125 -0.395050048828125 0.9999511726200581 +0.23325 -0.36083984375 0.9999511726200581 +0.233375 -0.326690673828125 0.9999511726200581 +0.2335 -0.28533935546875 0.9999511726200581 +0.233625 -0.2408447265625 0.9999511726200581 +0.23375 -0.19854736328125 0.9999511726200581 +0.233875 -0.149505615234375 0.9999511726200581 +0.234 -0.10394287109375 0.9999511726200581 +0.234125 -0.052276611328125 0.9999511726200581 0.23425 0.0 0.9999511726200581 0.234375 0.047027587890625 0.9999511726200581 0.2345 0.098785400390625 0.9999511726200581 @@ -1904,37 +1904,37 @@ 0.237875 0.1141357421875 0.9999511726200581 0.238 0.0626220703125 0.9999511726200581 0.238125 0.01568603515625 0.9999511726200581 -0.23825 -0.036590576171875 0.9999511726200581 -0.238375 -0.083343505859375 0.9999511726200581 -0.2385 -0.134429931640625 0.9999511726200581 -0.238625 -0.18402099609375 0.9999511726200581 -0.23875 -0.2269287109375 0.9999511726200581 -0.238875 -0.27227783203125 0.9999511726200581 -0.239 -0.310516357421875 0.9999511726200581 -0.239125 -0.349761962890625 0.9999511726200581 -0.23925 -0.38519287109375 0.9999511726200581 -0.239375 -0.4134521484375 0.9999511726200581 -0.2395 -0.440582275390625 0.9999511726200581 -0.239625 -0.460845947265625 0.9999511726200581 -0.23975 -0.47857666015625 0.9999511726200581 -0.239875 -0.491058349609375 0.9999511726200581 -0.24 -0.497711181640625 0.9999511726200581 -0.240125 -0.499908447265625 0.9999511726200581 -0.24025 -0.4971923828125 0.9999511726200581 -0.240375 -0.488983154296875 0.9999511726200581 -0.2405 -0.4754638671875 0.9999511726200581 -0.240625 -0.45880126953125 0.9999511726200581 -0.24075 -0.435546875 0.9999511726200581 -0.240875 -0.410491943359375 0.9999511726200581 -0.241 -0.37841796875 0.9999511726200581 -0.241125 -0.342193603515625 0.9999511726200581 -0.24125 -0.306396484375 0.9999511726200581 -0.241375 -0.263427734375 0.9999511726200581 -0.2415 -0.222259521484375 0.9999511726200581 -0.241625 -0.174224853515625 0.9999511726200581 -0.24175 -0.124298095703125 0.9999511726200581 -0.241875 -0.07818603515625 0.9999511726200581 -0.242 -0.026123046875 0.9999511726200581 +0.23825 -0.03662109375 0.9999511726200581 +0.238375 -0.0833740234375 0.9999511726200581 +0.2385 -0.13446044921875 0.9999511726200581 +0.238625 -0.184051513671875 0.9999511726200581 +0.23875 -0.226959228515625 0.9999511726200581 +0.238875 -0.272308349609375 0.9999511726200581 +0.239 -0.310546875 0.9999511726200581 +0.239125 -0.34979248046875 0.9999511726200581 +0.23925 -0.385223388671875 0.9999511726200581 +0.239375 -0.413482666015625 0.9999511726200581 +0.2395 -0.44061279296875 0.9999511726200581 +0.239625 -0.46087646484375 0.9999511726200581 +0.23975 -0.478607177734375 0.9999511726200581 +0.239875 -0.4910888671875 0.9999511726200581 +0.24 -0.49774169921875 0.9999511726200581 +0.240125 -0.49993896484375 0.9999511726200581 +0.24025 -0.497222900390625 0.9999511726200581 +0.240375 -0.489013671875 0.9999511726200581 +0.2405 -0.475494384765625 0.9999511726200581 +0.240625 -0.458831787109375 0.9999511726200581 +0.24075 -0.435577392578125 0.9999511726200581 +0.240875 -0.4105224609375 0.9999511726200581 +0.241 -0.378448486328125 0.9999511726200581 +0.241125 -0.34222412109375 0.9999511726200581 +0.24125 -0.306427001953125 0.9999511726200581 +0.241375 -0.263458251953125 0.9999511726200581 +0.2415 -0.2222900390625 0.9999511726200581 +0.241625 -0.17425537109375 0.9999511726200581 +0.24175 -0.12432861328125 0.9999511726200581 +0.241875 -0.078216552734375 0.9999511726200581 +0.242 -0.026153564453125 0.9999511726200581 0.242125 0.020904541015625 0.9999511726200581 0.24225 0.072998046875 0.9999511726200581 0.242375 0.124298095703125 0.9999511726200581 @@ -1966,37 +1966,37 @@ 0.245625 0.13946533203125 0.9999511726200581 0.24575 0.0885009765625 0.9999511726200581 0.245875 0.04180908203125 0.9999511726200581 -0.246 -0.01043701171875 0.9999511726200581 -0.246125 -0.0626220703125 0.9999511726200581 -0.24625 -0.109039306640625 0.9999511726200581 -0.246375 -0.159454345703125 0.9999511726200581 -0.2465 -0.20330810546875 0.9999511726200581 -0.246625 -0.24993896484375 0.9999511726200581 -0.24675 -0.2938232421875 0.9999511726200581 -0.246875 -0.330596923828125 0.9999511726200581 -0.247 -0.36798095703125 0.9999511726200581 -0.247125 -0.398193359375 0.9999511726200581 -0.24725 -0.4276123046875 0.9999511726200581 -0.247375 -0.45233154296875 0.9999511726200581 -0.2475 -0.470367431640625 0.9999511726200581 -0.247625 -0.485504150390625 0.9999511726200581 -0.24775 -0.49456787109375 0.9999511726200581 -0.247875 -0.499481201171875 0.9999511726200581 -0.248 -0.498931884765625 0.9999511726200581 -0.248125 -0.4937744140625 0.9999511726200581 -0.24825 -0.482879638671875 0.9999511726200581 -0.248375 -0.46856689453125 0.9999511726200581 -0.2485 -0.447784423828125 0.9999511726200581 -0.248625 -0.422088623046875 0.9999511726200581 -0.24875 -0.39501953125 0.9999511726200581 -0.248875 -0.360809326171875 0.9999511726200581 -0.249 -0.32666015625 0.9999511726200581 -0.249125 -0.285308837890625 0.9999511726200581 -0.24925 -0.240814208984375 0.9999511726200581 -0.249375 -0.198516845703125 0.9999511726200581 -0.2495 -0.14947509765625 0.9999511726200581 -0.249625 -0.103912353515625 0.9999511726200581 -0.24975 -0.05224609375 0.9999511726200581 +0.246 -0.010467529296875 0.9999511726200581 +0.246125 -0.062652587890625 0.9999511726200581 +0.24625 -0.10906982421875 0.9999511726200581 +0.246375 -0.15948486328125 0.9999511726200581 +0.2465 -0.203338623046875 0.9999511726200581 +0.246625 -0.249969482421875 0.9999511726200581 +0.24675 -0.293853759765625 0.9999511726200581 +0.246875 -0.33062744140625 0.9999511726200581 +0.247 -0.368011474609375 0.9999511726200581 +0.247125 -0.398223876953125 0.9999511726200581 +0.24725 -0.427642822265625 0.9999511726200581 +0.247375 -0.452362060546875 0.9999511726200581 +0.2475 -0.47039794921875 0.9999511726200581 +0.247625 -0.48553466796875 0.9999511726200581 +0.24775 -0.494598388671875 0.9999511726200581 +0.247875 -0.49951171875 0.9999511726200581 +0.248 -0.49896240234375 0.9999511726200581 +0.248125 -0.493804931640625 0.9999511726200581 +0.24825 -0.48291015625 0.9999511726200581 +0.248375 -0.468597412109375 0.9999511726200581 +0.2485 -0.44781494140625 0.9999511726200581 +0.248625 -0.422119140625 0.9999511726200581 +0.24875 -0.395050048828125 0.9999511726200581 +0.248875 -0.36083984375 0.9999511726200581 +0.249 -0.326690673828125 0.9999511726200581 +0.249125 -0.28533935546875 0.9999511726200581 +0.24925 -0.2408447265625 0.9999511726200581 +0.249375 -0.19854736328125 0.9999511726200581 +0.2495 -0.149505615234375 0.9999511726200581 +0.249625 -0.10394287109375 0.9999511726200581 +0.24975 -0.052276611328125 0.9999511726200581 0.249875 0.0 0.9999511726200581 0.25 0.047027587890625 0.9999511726200581 0.250125 0.098785400390625 0.9999511726200581 @@ -2029,20 +2029,20 @@ 0.2535 0.1141357421875 0.9999511726200581 0.253625 0.0626220703125 0.9999511726200581 0.2537500000000001 0.01568603515625 0.9999511726200581 -0.253875 -0.036590576171875 0.9999511726200581 -0.254 -0.083343505859375 0.9999511726200581 -0.254125 -0.134429931640625 0.9999511726200581 -0.25425 -0.18402099609375 0.9999511726200581 -0.254375 -0.2269287109375 0.9999511726200581 -0.2545 -0.27227783203125 0.9999511726200581 -0.254625 -0.310516357421875 0.9999511726200581 -0.25475 -0.349761962890625 0.9999511726200581 -0.254875 -0.38519287109375 0.9999511726200581 -0.255 -0.4134521484375 0.9999511726200581 -0.255125 -0.440582275390625 0.9999511726200581 -0.25525 -0.460845947265625 0.9999511726200581 -0.255375 -0.47857666015625 0.9999511726200581 -0.2555 -0.491058349609375 0.9999511726200581 -0.255625 -0.497711181640625 0.9999511726200581 -0.25575 -0.499908447265625 0.9999511726200581 -0.255875 -0.4971923828125 0.9999511726200581 +0.253875 -0.03662109375 0.9999511726200581 +0.254 -0.0833740234375 0.9999511726200581 +0.254125 -0.13446044921875 0.9999511726200581 +0.25425 -0.184051513671875 0.9999511726200581 +0.254375 -0.226959228515625 0.9999511726200581 +0.2545 -0.272308349609375 0.9999511726200581 +0.254625 -0.310546875 0.9999511726200581 +0.25475 -0.34979248046875 0.9999511726200581 +0.254875 -0.385223388671875 0.9999511726200581 +0.255 -0.413482666015625 0.9999511726200581 +0.255125 -0.44061279296875 0.9999511726200581 +0.25525 -0.46087646484375 0.9999511726200581 +0.255375 -0.478607177734375 0.9999511726200581 +0.2555 -0.4910888671875 0.9999511726200581 +0.255625 -0.49774169921875 0.9999511726200581 +0.25575 -0.49993896484375 0.9999511726200581 +0.255875 -0.497222900390625 0.9999511726200581 diff --git a/tests/circuitpython/synth_note_ring.py.exp b/tests/circuitpython/synth_note_ring.py.exp index 406c08da03..b45858d5aa 100644 --- a/tests/circuitpython/synth_note_ring.py.exp +++ b/tests/circuitpython/synth_note_ring.py.exp @@ -1,2048 +1,2048 @@ 0.0 0.0 -0.743977294921875 0.000125 0.0 -0.743977294921875 0.00025 0.0 -0.743977294921875 -0.000375 0.003997802734375 -0.743977294921875 -0.0005 0.0050048828125 -0.743977294921875 -0.000625 0.005828857421875 -0.743977294921875 -0.00075 0.0067138671875 -0.743977294921875 -0.0008750000000000002 0.014923095703125 -0.743977294921875 -0.001 0.016357421875 -0.743977294921875 -0.001125 0.01763916015625 -0.743977294921875 -0.00125 0.01861572265625 -0.743977294921875 -0.001375 0.029266357421875 -0.743977294921875 -0.0015 0.03021240234375 -0.743977294921875 -0.001625 0.030914306640625 -0.743977294921875 -0.00175 0.041748046875 -0.743977294921875 -0.001875 0.04180908203125 -0.743977294921875 -0.002 0.04144287109375 -0.743977294921875 -0.002125 0.04071044921875 -0.743977294921875 -0.00225 0.049346923828125 -0.743977294921875 -0.002375 0.047271728515625 -0.743977294921875 -0.0025 0.04498291015625 -0.743977294921875 -0.002625 0.04193115234375 -0.743977294921875 -0.00275 0.046600341796875 -0.743977294921875 -0.002875 0.041961669921875 -0.743977294921875 -0.003 0.036834716796875 -0.743977294921875 -0.003125 0.03192138671875 -0.743977294921875 -0.00325 0.030426025390625 -0.743977294921875 -0.003375 0.024017333984375 -0.743977294921875 -0.0035 0.01666259765625 -0.743977294921875 -0.003625 0.01043701171875 -0.743977294921875 -0.00375 0.002593994140625 -0.743977294921875 -0.003875 -0.006072998046875 -0.743977294921875 -0.004 -0.013916015625 -0.743977294921875 -0.004125 -0.025238037109375 -0.743977294921875 -0.00425 -0.034576416015625 -0.743977294921875 -0.004375000000000001 -0.04266357421875 -0.743977294921875 -0.004500000000000001 -0.05120849609375 -0.743977294921875 -0.004625 -0.06488037109375 -0.743977294921875 -0.00475 -0.073089599609375 -0.743977294921875 -0.004875 -0.080474853515625 -0.743977294921875 -0.005 -0.095001220703125 -0.743977294921875 -0.005125000000000001 -0.101226806640625 -0.743977294921875 -0.00525 -0.10589599609375 -0.743977294921875 -0.005375000000000001 -0.1099853515625 -0.743977294921875 -0.005499999999999999 -0.123046875 -0.743977294921875 -0.005625 -0.12469482421875 -0.743977294921875 -0.00575 -0.125244140625 -0.743977294921875 -0.005874999999999999 -0.12457275390625 -0.743977294921875 -0.006 -0.132659912109375 -0.743977294921875 -0.006125 -0.128997802734375 -0.743977294921875 -0.00625 -0.124481201171875 -0.743977294921875 -0.006375 -0.1181640625 -0.743977294921875 -0.0065 -0.119873046875 -0.743977294921875 -0.006625000000000001 -0.110504150390625 -0.743977294921875 -0.00675 -0.099945068359375 -0.743977294921875 -0.006875 -0.0958251953125 -0.743977294921875 -0.007000000000000001 -0.082366943359375 -0.743977294921875 -0.007125000000000002 -0.069488525390625 -0.743977294921875 -0.007250000000000001 -0.054473876953125 -0.743977294921875 -0.007375 -0.041412353515625 -0.743977294921875 -0.0075 -0.026031494140625 -0.743977294921875 -0.007625 -0.0086669921875 -0.743977294921875 -0.00775 0.006927490234375 -0.743977294921875 -0.007875 0.02581787109375 -0.743977294921875 -0.008 0.043975830078125 -0.743977294921875 -0.008125 0.0599365234375 -0.743977294921875 -0.00825 0.08148193359375 -0.743977294921875 -0.008375 0.097015380859375 -0.743977294921875 -0.0085 0.11322021484375 -0.743977294921875 -0.008625 0.128204345703125 -0.743977294921875 -0.008750000000000002 0.148193359375 -0.743977294921875 -0.008875 0.161041259765625 -0.743977294921875 -0.009000000000000002 0.171112060546875 -0.743977294921875 -0.009125 0.18048095703125 -0.743977294921875 -0.00925 0.197662353515625 -0.743977294921875 -0.009375 0.20281982421875 -0.743977294921875 -0.0095 0.206451416015625 -0.743977294921875 -0.009625 0.207794189453125 -0.743977294921875 -0.00975 0.21728515625 -0.743977294921875 -0.009875 0.214202880859375 -0.743977294921875 -0.01 0.209381103515625 -0.743977294921875 -0.010125 0.21136474609375 -0.743977294921875 -0.01025 0.202301025390625 -0.743977294921875 -0.010375 0.19012451171875 -0.743977294921875 -0.0105 0.175872802734375 -0.743977294921875 -0.010625 0.168609619140625 -0.743977294921875 -0.01075 0.150054931640625 -0.743977294921875 -0.010875 0.131927490234375 -0.743977294921875 -0.011 0.110443115234375 -0.743977294921875 -0.011125 0.09149169921875 -0.743977294921875 -0.01125 0.069305419921875 -0.743977294921875 -0.011375 0.043975830078125 -0.743977294921875 -0.0115 0.020751953125 -0.743977294921875 -0.011625 -0.00537109375 -0.743977294921875 -0.01175 -0.032379150390625 -0.743977294921875 -0.011875 -0.056396484375 -0.743977294921875 -0.012 -0.085723876953125 -0.743977294921875 -0.012125 -0.10931396484375 -0.743977294921875 -0.01225 -0.1343994140625 -0.743977294921875 -0.012375 -0.157989501953125 -0.743977294921875 -0.0125 -0.184417724609375 -0.743977294921875 -0.012625 -0.205291748046875 -0.743977294921875 -0.01275 -0.222137451171875 -0.743977294921875 -0.012875 -0.238555908203125 -0.743977294921875 -0.013 -0.261444091796875 -0.743977294921875 -0.013125 -0.2718505859375 -0.743977294921875 -0.01325 -0.280609130859375 -0.743977294921875 -0.013375 -0.295745849609375 -0.743977294921875 -0.0135 -0.2987060546875 -0.743977294921875 -0.013625 -0.298370361328125 -0.743977294921875 -0.01375 -0.295257568359375 -0.743977294921875 -0.013875 -0.29840087890625 -0.743977294921875 -0.014 -0.28955078125 -0.743977294921875 -0.014125 -0.276702880859375 -0.743977294921875 -0.01425 -0.260833740234375 -0.743977294921875 -0.014375 -0.251953125 -0.743977294921875 -0.0145 -0.230133056640625 -0.743977294921875 -0.014625 -0.208343505859375 -0.743977294921875 -0.01475 -0.181976318359375 -0.743977294921875 -0.014875 -0.158355712890625 -0.743977294921875 -0.015 -0.13055419921875 -0.743977294921875 -0.015125 -0.0982666015625 -0.743977294921875 -0.01525 -0.07037353515625 -0.743977294921875 -0.015375 -0.035369873046875 -0.743977294921875 +0.000375 0.001983642578125 -0.743977294921875 +0.0005 0.00250244140625 -0.743977294921875 +0.000625 0.002899169921875 -0.743977294921875 +0.00075 0.00335693359375 -0.743977294921875 +0.0008750000000000002 0.0074462890625 -0.743977294921875 +0.001 0.0081787109375 -0.743977294921875 +0.001125 0.008819580078125 -0.743977294921875 +0.00125 0.009307861328125 -0.743977294921875 +0.001375 0.014617919921875 -0.743977294921875 +0.0015 0.015106201171875 -0.743977294921875 +0.001625 0.01544189453125 -0.743977294921875 +0.00175 0.0208740234375 -0.743977294921875 +0.001875 0.020904541015625 -0.743977294921875 +0.002 0.020721435546875 -0.743977294921875 +0.002125 0.020355224609375 -0.743977294921875 +0.00225 0.024658203125 -0.743977294921875 +0.002375 0.02362060546875 -0.743977294921875 +0.0025 0.022491455078125 -0.743977294921875 +0.002625 0.020965576171875 -0.743977294921875 +0.00275 0.023284912109375 -0.743977294921875 +0.002875 0.020965576171875 -0.743977294921875 +0.003 0.018402099609375 -0.743977294921875 +0.003125 0.015960693359375 -0.743977294921875 +0.00325 0.01519775390625 -0.743977294921875 +0.003375 0.011993408203125 -0.743977294921875 +0.0035 0.008331298828125 -0.743977294921875 +0.003625 0.005218505859375 -0.743977294921875 +0.00375 0.00128173828125 -0.743977294921875 +0.003875 -0.0030517578125 -0.743977294921875 +0.004 -0.006988525390625 -0.743977294921875 +0.004125 -0.01263427734375 -0.743977294921875 +0.00425 -0.017303466796875 -0.743977294921875 +0.004375000000000001 -0.0213623046875 -0.743977294921875 +0.004500000000000001 -0.025634765625 -0.743977294921875 +0.004625 -0.032470703125 -0.743977294921875 +0.00475 -0.03656005859375 -0.743977294921875 +0.004875 -0.040252685546875 -0.743977294921875 +0.005 -0.047515869140625 -0.743977294921875 +0.005125000000000001 -0.050628662109375 -0.743977294921875 +0.00525 -0.052978515625 -0.743977294921875 +0.005375000000000001 -0.055023193359375 -0.743977294921875 +0.005499999999999999 -0.061553955078125 -0.743977294921875 +0.005625 -0.0623779296875 -0.743977294921875 +0.00575 -0.062652587890625 -0.743977294921875 +0.005874999999999999 -0.06231689453125 -0.743977294921875 +0.006 -0.06634521484375 -0.743977294921875 +0.006125 -0.06451416015625 -0.743977294921875 +0.00625 -0.062255859375 -0.743977294921875 +0.006375 -0.059112548828125 -0.743977294921875 +0.0065 -0.059967041015625 -0.743977294921875 +0.006625000000000001 -0.055267333984375 -0.743977294921875 +0.00675 -0.04998779296875 -0.743977294921875 +0.006875 -0.047943115234375 -0.743977294921875 +0.007000000000000001 -0.04119873046875 -0.743977294921875 +0.007125000000000002 -0.034759521484375 -0.743977294921875 +0.007250000000000001 -0.027252197265625 -0.743977294921875 +0.007375 -0.020721435546875 -0.743977294921875 +0.0075 -0.013031005859375 -0.743977294921875 +0.007625 -0.004364013671875 -0.743977294921875 +0.00775 0.003448486328125 -0.743977294921875 +0.007875 0.012908935546875 -0.743977294921875 +0.008 0.02197265625 -0.743977294921875 +0.008125 0.02996826171875 -0.743977294921875 +0.00825 0.040740966796875 -0.743977294921875 +0.008375 0.048492431640625 -0.743977294921875 +0.0085 0.056610107421875 -0.743977294921875 +0.008625 0.0640869140625 -0.743977294921875 +0.008750000000000002 0.0740966796875 -0.743977294921875 +0.008875 0.08050537109375 -0.743977294921875 +0.009000000000000002 0.085540771484375 -0.743977294921875 +0.009125 0.090240478515625 -0.743977294921875 +0.00925 0.09881591796875 -0.743977294921875 +0.009375 0.101409912109375 -0.743977294921875 +0.0095 0.10321044921875 -0.743977294921875 +0.009625 0.1038818359375 -0.743977294921875 +0.00975 0.108642578125 -0.743977294921875 +0.009875 0.107086181640625 -0.743977294921875 +0.01 0.10467529296875 -0.743977294921875 +0.010125 0.105682373046875 -0.743977294921875 +0.01025 0.10113525390625 -0.743977294921875 +0.010375 0.095062255859375 -0.743977294921875 +0.0105 0.087921142578125 -0.743977294921875 +0.010625 0.08428955078125 -0.743977294921875 +0.01075 0.07501220703125 -0.743977294921875 +0.010875 0.065948486328125 -0.743977294921875 +0.011 0.055206298828125 -0.743977294921875 +0.011125 0.045745849609375 -0.743977294921875 +0.01125 0.034637451171875 -0.743977294921875 +0.011375 0.02197265625 -0.743977294921875 +0.0115 0.0103759765625 -0.743977294921875 +0.011625 -0.002716064453125 -0.743977294921875 +0.01175 -0.016204833984375 -0.743977294921875 +0.011875 -0.028228759765625 -0.743977294921875 +0.012 -0.042877197265625 -0.743977294921875 +0.012125 -0.0546875 -0.743977294921875 +0.01225 -0.067230224609375 -0.743977294921875 +0.012375 -0.079010009765625 -0.743977294921875 +0.0125 -0.09222412109375 -0.743977294921875 +0.012625 -0.1026611328125 -0.743977294921875 +0.01275 -0.111083984375 -0.743977294921875 +0.012875 -0.119293212890625 -0.743977294921875 +0.013 -0.1307373046875 -0.743977294921875 +0.013125 -0.135955810546875 -0.743977294921875 +0.01325 -0.14031982421875 -0.743977294921875 +0.013375 -0.14788818359375 -0.743977294921875 +0.0135 -0.149383544921875 -0.743977294921875 +0.013625 -0.149200439453125 -0.743977294921875 +0.01375 -0.14764404296875 -0.743977294921875 +0.013875 -0.14923095703125 -0.743977294921875 +0.014 -0.144805908203125 -0.743977294921875 +0.014125 -0.13836669921875 -0.743977294921875 +0.01425 -0.13043212890625 -0.743977294921875 +0.014375 -0.126007080078125 -0.743977294921875 +0.0145 -0.115081787109375 -0.743977294921875 +0.014625 -0.10418701171875 -0.743977294921875 +0.01475 -0.09100341796875 -0.743977294921875 +0.014875 -0.079193115234375 -0.743977294921875 +0.015 -0.0653076171875 -0.743977294921875 +0.015125 -0.049163818359375 -0.743977294921875 +0.01525 -0.03521728515625 -0.743977294921875 +0.015375 -0.0177001953125 -0.743977294921875 0.0155 0.0 -0.743977294921875 -0.015625 0.031829833984375 -0.743977294921875 -0.01575 0.06884765625 -0.743977294921875 -0.015875 0.100677490234375 -0.743977294921875 -0.016 0.135009765625 -0.743977294921875 -0.016125 0.1678466796875 -0.743977294921875 -0.01625 0.20135498046875 -0.743977294921875 -0.016375 0.231231689453125 -0.743977294921875 -0.0165 0.2559814453125 -0.743977294921875 -0.016625 0.288421630859375 -0.743977294921875 -0.01675 0.31072998046875 -0.743977294921875 -0.016875 0.327911376953125 -0.743977294921875 -0.017 0.343597412109375 -0.743977294921875 -0.017125 0.36383056640625 -0.743977294921875 -0.01725 0.372467041015625 -0.743977294921875 -0.017375 0.37701416015625 -0.743977294921875 -0.0175 0.3775634765625 -0.743977294921875 -0.017625 0.383819580078125 -0.743977294921875 -0.01775 0.377197265625 -0.743977294921875 -0.017875 0.365875244140625 -0.743977294921875 -0.018 0.350555419921875 -0.743977294921875 -0.018125 0.341766357421875 -0.743977294921875 -0.01825 0.318756103515625 -0.743977294921875 -0.018375 0.2950439453125 -0.743977294921875 -0.0185 0.2720947265625 -0.743977294921875 -0.018625 0.238983154296875 -0.743977294921875 -0.01875 0.20697021484375 -0.743977294921875 -0.018875 0.16925048828125 -0.743977294921875 -0.019 0.1368408203125 -0.743977294921875 -0.019125 0.095001220703125 -0.743977294921875 -0.01925 0.0521240234375 -0.743977294921875 -0.019375 0.013031005859375 -0.743977294921875 -0.0195 -0.0311279296875 -0.743977294921875 -0.019625 -0.070953369140625 -0.743977294921875 -0.01975 -0.11444091796875 -0.743977294921875 -0.019875 -0.15667724609375 -0.743977294921875 -0.02 -0.197509765625 -0.743977294921875 -0.020125 -0.236968994140625 -0.743977294921875 -0.02025 -0.270263671875 -0.743977294921875 -0.020375 -0.311004638671875 -0.743977294921875 -0.0205 -0.342529296875 -0.743977294921875 -0.020625 -0.367645263671875 -0.743977294921875 -0.02075 -0.39178466796875 -0.743977294921875 -0.020875 -0.41839599609375 -0.743977294921875 -0.021 -0.43450927734375 -0.743977294921875 -0.021125 -0.445831298828125 -0.743977294921875 -0.02125 -0.451873779296875 -0.743977294921875 -0.021375 -0.463165283203125 -0.743977294921875 -0.0215 -0.460662841796875 -0.743977294921875 -0.021625 -0.45306396484375 -0.743977294921875 -0.02175 -0.4493408203125 -0.743977294921875 -0.021875 -0.433624267578125 -0.743977294921875 -0.022 -0.41162109375 -0.743977294921875 -0.022125 -0.387969970703125 -0.743977294921875 -0.02225 -0.364593505859375 -0.743977294921875 -0.022375 -0.329681396484375 -0.743977294921875 -0.0225 -0.295196533203125 -0.743977294921875 -0.022625 -0.2537841796875 -0.743977294921875 -0.02275 -0.21820068359375 -0.743977294921875 -0.022875 -0.171051025390625 -0.743977294921875 -0.023 -0.12200927734375 -0.743977294921875 -0.023125 -0.07672119140625 -0.743977294921875 -0.02325 -0.026092529296875 -0.743977294921875 -0.023375 0.0208740234375 -0.743977294921875 -0.0235 0.072967529296875 -0.743977294921875 -0.023625 0.12652587890625 -0.743977294921875 -0.02375 0.17236328125 -0.743977294921875 -0.023875 0.221466064453125 -0.743977294921875 -0.024 0.26361083984375 -0.743977294921875 -0.024125 0.3131103515625 -0.743977294921875 -0.02425 0.354522705078125 -0.743977294921875 -0.024375 0.38848876953125 -0.743977294921875 -0.0245 0.42218017578125 -0.743977294921875 -0.024625 0.456268310546875 -0.743977294921875 -0.02475 0.481292724609375 -0.743977294921875 -0.024875 0.50103759765625 -0.743977294921875 -0.025 0.522796630859375 -0.743977294921875 -0.025125 0.532135009765625 -0.743977294921875 -0.02525 0.53558349609375 -0.743977294921875 -0.02537500000000001 0.5338134765625 -0.743977294921875 -0.0255 0.534881591796875 -0.743977294921875 -0.025625 0.52288818359375 -0.743977294921875 -0.02575 0.504150390625 -0.743977294921875 -0.025875 0.482574462890625 -0.743977294921875 -0.026 0.4608154296875 -0.743977294921875 -0.026125 0.426300048828125 -0.743977294921875 -0.02625 0.391204833984375 -0.743977294921875 -0.026375 0.34814453125 -0.743977294921875 -0.0265 0.310943603515625 -0.743977294921875 -0.026625 0.26031494140625 -0.743977294921875 -0.02675 0.20684814453125 -0.743977294921875 -0.026875 0.159149169921875 -0.743977294921875 -0.027 0.10101318359375 -0.743977294921875 -0.027125 0.047698974609375 -0.743977294921875 -0.02725 -0.01190185546875 -0.743977294921875 -0.027375 -0.072540283203125 -0.743977294921875 -0.0275 -0.12628173828125 -0.743977294921875 -0.027625 -0.1846923828125 -0.743977294921875 -0.02775 -0.23553466796875 -0.743977294921875 -0.027875 -0.293792724609375 -0.743977294921875 -0.028 -0.34539794921875 -0.743977294921875 -0.028125 -0.38861083984375 -0.743977294921875 -0.02825 -0.43878173828125 -0.743977294921875 -0.028375 -0.47479248046875 -0.743977294921875 -0.02850000000000001 -0.509857177734375 -0.743977294921875 -0.028625 -0.539337158203125 -0.743977294921875 -0.02875 -0.568695068359375 -0.743977294921875 -0.028875 -0.587005615234375 -0.743977294921875 -0.029 -0.59796142578125 -0.743977294921875 -0.029125 -0.603912353515625 -0.743977294921875 -0.02925 -0.611572265625 -0.743977294921875 -0.029375 -0.605224609375 -0.743977294921875 -0.0295 -0.591888427734375 -0.743977294921875 -0.029625 -0.5743408203125 -0.743977294921875 -0.02975000000000001 -0.556243896484375 -0.743977294921875 -0.029875 -0.52435302734375 -0.743977294921875 -0.03 -0.49072265625 -0.743977294921875 -0.030125 -0.4541015625 -0.743977294921875 -0.03025 -0.411102294921875 -0.743977294921875 -0.030375 -0.35906982421875 -0.743977294921875 -0.0305 -0.3031005859375 -0.743977294921875 -0.030625 -0.253082275390625 -0.743977294921875 -0.03075 -0.1905517578125 -0.743977294921875 -0.03087499999999999 -0.1324462890625 -0.743977294921875 -0.031 -0.06658935546875 -0.743977294921875 +0.015625 0.015899658203125 -0.743977294921875 +0.01575 0.034423828125 -0.743977294921875 +0.015875 0.050323486328125 -0.743977294921875 +0.016 0.0675048828125 -0.743977294921875 +0.016125 0.08392333984375 -0.743977294921875 +0.01625 0.100677490234375 -0.743977294921875 +0.016375 0.1156005859375 -0.743977294921875 +0.0165 0.12799072265625 -0.743977294921875 +0.016625 0.144195556640625 -0.743977294921875 +0.01675 0.155364990234375 -0.743977294921875 +0.016875 0.1639404296875 -0.743977294921875 +0.017 0.171783447265625 -0.743977294921875 +0.017125 0.181915283203125 -0.743977294921875 +0.01725 0.18621826171875 -0.743977294921875 +0.017375 0.188507080078125 -0.743977294921875 +0.0175 0.18878173828125 -0.743977294921875 +0.017625 0.19189453125 -0.743977294921875 +0.01775 0.1885986328125 -0.743977294921875 +0.017875 0.18292236328125 -0.743977294921875 +0.018 0.175262451171875 -0.743977294921875 +0.018125 0.170867919921875 -0.743977294921875 +0.01825 0.15936279296875 -0.743977294921875 +0.018375 0.14752197265625 -0.743977294921875 +0.0185 0.13604736328125 -0.743977294921875 +0.018625 0.119476318359375 -0.743977294921875 +0.01875 0.103485107421875 -0.743977294921875 +0.018875 0.084625244140625 -0.743977294921875 +0.019 0.06842041015625 -0.743977294921875 +0.019125 0.0474853515625 -0.743977294921875 +0.01925 0.02606201171875 -0.743977294921875 +0.019375 0.006500244140625 -0.743977294921875 +0.0195 -0.015594482421875 -0.743977294921875 +0.019625 -0.035491943359375 -0.743977294921875 +0.01975 -0.0572509765625 -0.743977294921875 +0.019875 -0.078369140625 -0.743977294921875 +0.02 -0.098785400390625 -0.743977294921875 +0.020125 -0.118499755859375 -0.743977294921875 +0.02025 -0.135162353515625 -0.743977294921875 +0.020375 -0.155517578125 -0.743977294921875 +0.0205 -0.171295166015625 -0.743977294921875 +0.020625 -0.183837890625 -0.743977294921875 +0.02075 -0.1959228515625 -0.743977294921875 +0.020875 -0.209228515625 -0.743977294921875 +0.021 -0.21728515625 -0.743977294921875 +0.021125 -0.222930908203125 -0.743977294921875 +0.02125 -0.2259521484375 -0.743977294921875 +0.021375 -0.231597900390625 -0.743977294921875 +0.0215 -0.2303466796875 -0.743977294921875 +0.021625 -0.2265625 -0.743977294921875 +0.02175 -0.224700927734375 -0.743977294921875 +0.021875 -0.216827392578125 -0.743977294921875 +0.022 -0.205841064453125 -0.743977294921875 +0.022125 -0.194000244140625 -0.743977294921875 +0.02225 -0.18231201171875 -0.743977294921875 +0.022375 -0.16485595703125 -0.743977294921875 +0.0225 -0.147613525390625 -0.743977294921875 +0.022625 -0.126922607421875 -0.743977294921875 +0.02275 -0.109130859375 -0.743977294921875 +0.022875 -0.085540771484375 -0.743977294921875 +0.023 -0.06103515625 -0.743977294921875 +0.023125 -0.03839111328125 -0.743977294921875 +0.02325 -0.0130615234375 -0.743977294921875 +0.023375 0.01043701171875 -0.743977294921875 +0.0235 0.036468505859375 -0.743977294921875 +0.023625 0.063262939453125 -0.743977294921875 +0.02375 0.086181640625 -0.743977294921875 +0.023875 0.1107177734375 -0.743977294921875 +0.024 0.131805419921875 -0.743977294921875 +0.024125 0.15655517578125 -0.743977294921875 +0.02425 0.17724609375 -0.743977294921875 +0.024375 0.194244384765625 -0.743977294921875 +0.0245 0.211090087890625 -0.743977294921875 +0.024625 0.228118896484375 -0.743977294921875 +0.02475 0.240631103515625 -0.743977294921875 +0.024875 0.250518798828125 -0.743977294921875 +0.025 0.261383056640625 -0.743977294921875 +0.025125 0.26605224609375 -0.743977294921875 +0.02525 0.267791748046875 -0.743977294921875 +0.02537500000000001 0.26690673828125 -0.743977294921875 +0.0255 0.267425537109375 -0.743977294921875 +0.025625 0.261444091796875 -0.743977294921875 +0.02575 0.2520751953125 -0.743977294921875 +0.025875 0.24127197265625 -0.743977294921875 +0.026 0.23040771484375 -0.743977294921875 +0.026125 0.213134765625 -0.743977294921875 +0.02625 0.195587158203125 -0.743977294921875 +0.026375 0.174072265625 -0.743977294921875 +0.0265 0.15545654296875 -0.743977294921875 +0.026625 0.130157470703125 -0.743977294921875 +0.02675 0.103424072265625 -0.743977294921875 +0.026875 0.079559326171875 -0.743977294921875 +0.027 0.050506591796875 -0.743977294921875 +0.027125 0.023834228515625 -0.743977294921875 +0.02725 -0.0059814453125 -0.743977294921875 +0.027375 -0.036285400390625 -0.743977294921875 +0.0275 -0.06317138671875 -0.743977294921875 +0.027625 -0.092376708984375 -0.743977294921875 +0.02775 -0.1177978515625 -0.743977294921875 +0.027875 -0.14691162109375 -0.743977294921875 +0.028 -0.1727294921875 -0.743977294921875 +0.028125 -0.1943359375 -0.743977294921875 +0.02825 -0.21942138671875 -0.743977294921875 +0.028375 -0.2374267578125 -0.743977294921875 +0.02850000000000001 -0.25494384765625 -0.743977294921875 +0.028625 -0.269683837890625 -0.743977294921875 +0.02875 -0.28436279296875 -0.743977294921875 +0.028875 -0.29351806640625 -0.743977294921875 +0.029 -0.29901123046875 -0.743977294921875 +0.029125 -0.301971435546875 -0.743977294921875 +0.02925 -0.305816650390625 -0.743977294921875 +0.029375 -0.302642822265625 -0.743977294921875 +0.0295 -0.29595947265625 -0.743977294921875 +0.029625 -0.287200927734375 -0.743977294921875 +0.02975000000000001 -0.27813720703125 -0.743977294921875 +0.029875 -0.26220703125 -0.743977294921875 +0.03 -0.245391845703125 -0.743977294921875 +0.030125 -0.227081298828125 -0.743977294921875 +0.03025 -0.20556640625 -0.743977294921875 +0.030375 -0.1795654296875 -0.743977294921875 +0.0305 -0.151580810546875 -0.743977294921875 +0.030625 -0.126556396484375 -0.743977294921875 +0.03075 -0.095306396484375 -0.743977294921875 +0.03087499999999999 -0.066253662109375 -0.743977294921875 +0.031 -0.0333251953125 -0.743977294921875 0.031125 0.0 -0.743977294921875 -0.03125 0.0606689453125 -0.743977294921875 -0.031375 0.12750244140625 -0.743977294921875 -0.0315 0.186492919921875 -0.743977294921875 -0.03162500000000001 0.25311279296875 -0.743977294921875 -0.03175 0.314697265625 -0.743977294921875 -0.031875 0.3671875 -0.743977294921875 -0.032 0.4267578125 -0.487985107421875 -0.032125 0.472412109375 -0.487985107421875 -0.03225 0.518157958984375 -0.487985107421875 -0.032375 0.564849853515625 -0.487985107421875 -0.0325 0.5960693359375 -0.487985107421875 -0.032625 0.624542236328125 -0.487985107421875 -0.03275 0.65179443359375 -0.487985107421875 -0.032875 0.667266845703125 -0.487985107421875 -0.033 0.6754150390625 -0.487985107421875 -0.033125 0.684051513671875 -0.487985107421875 -0.03325 0.678070068359375 -0.487985107421875 -0.033375 0.66632080078125 -0.487985107421875 -0.0335 0.646331787109375 -0.487985107421875 -0.03362500000000001 0.626129150390625 -0.487985107421875 -0.03375 0.595611572265625 -0.487985107421875 -0.033875 0.555511474609375 -0.487985107421875 -0.034 0.519805908203125 -0.487985107421875 -0.03412500000000001 0.46807861328125 -0.487985107421875 -0.03425 0.4111328125 -0.487985107421875 -0.034375 0.35986328125 -0.487985107421875 -0.0345 0.294281005859375 -0.487985107421875 -0.034625 0.232452392578125 -0.487985107421875 -0.03475000000000001 0.1630859375 -0.487985107421875 -0.034875 0.0894775390625 -0.487985107421875 -0.035 0.02239990234375 -0.487985107421875 -0.03512500000000001 -0.05279541015625 -0.487985107421875 -0.03525 -0.12030029296875 -0.487985107421875 -0.035375 -0.194000244140625 -0.487985107421875 -0.0355 -0.268280029296875 -0.487985107421875 -0.03562500000000001 -0.33087158203125 -0.487985107421875 -0.03575 -0.396942138671875 -0.487985107421875 -0.035875 -0.457122802734375 -0.487985107421875 -0.03600000000000001 -0.514892578125 -0.487985107421875 -0.036125 -0.567047119140625 -0.487985107421875 -0.03625 -0.614501953125 -0.487985107421875 -0.036375 -0.65478515625 -0.487985107421875 -0.0365 -0.6849365234375 -0.487985107421875 -0.036625 -0.711273193359375 -0.487985107421875 -0.03675 -0.736663818359375 -0.487985107421875 -0.036875 -0.746612548828125 -0.487985107421875 -0.037 -0.749908447265625 -0.487985107421875 -0.03712499999999999 -0.752685546875 -0.487985107421875 -0.03725 -0.74029541015625 -0.487985107421875 -0.037375 -0.719818115234375 -0.487985107421875 -0.0375 -0.700836181640625 -0.487985107421875 -0.037625 -0.665313720703125 -0.487985107421875 -0.03775 -0.627044677734375 -0.487985107421875 -0.037875 -0.5831298828125 -0.487985107421875 -0.038 -0.527313232421875 -0.487985107421875 -0.038125 -0.47216796875 -0.487985107421875 -0.03825 -0.409423828125 -0.487985107421875 -0.038375 -0.345458984375 -0.487985107421875 -0.0385 -0.27081298828125 -0.487985107421875 -0.038625 -0.19482421875 -0.487985107421875 -0.03875 -0.122528076171875 -0.487985107421875 -0.038875 -0.04095458984375 -0.487985107421875 -0.039 0.033050537109375 -0.487985107421875 -0.039125 0.1153564453125 -0.487985107421875 -0.03925 0.1964111328125 -0.487985107421875 -0.039375 0.269744873046875 -0.487985107421875 -0.0395 0.346588134765625 -0.487985107421875 -0.039625 0.41253662109375 -0.487985107421875 -0.03975 0.485260009765625 -0.487985107421875 -0.039875 0.5494384765625 -0.487985107421875 -0.04 0.60205078125 -0.487985107421875 -0.040125 0.654266357421875 -0.487985107421875 -0.04025 0.70050048828125 -0.487985107421875 -0.040375 0.73895263671875 -0.487985107421875 -0.04050000000000001 0.769287109375 -0.487985107421875 -0.040625 0.79534912109375 -0.487985107421875 -0.04075 0.8095703125 -0.487985107421875 -0.040875 0.814788818359375 -0.487985107421875 -0.04100000000000001 0.818115234375 -0.487985107421875 -0.041125 0.80645751953125 -0.487985107421875 -0.04125 0.78839111328125 -0.487985107421875 -0.041375 0.765625 -0.487985107421875 -0.0415 0.732818603515625 -0.487985107421875 -0.041625 0.688751220703125 -0.487985107421875 -0.04175000000000001 0.641632080078125 -0.487985107421875 -0.041875 0.588836669921875 -0.487985107421875 -0.042 0.5240478515625 -0.487985107421875 -0.042125 0.4639892578125 -0.487985107421875 -0.04225000000000001 0.388458251953125 -0.487985107421875 -0.042375 0.30865478515625 -0.487985107421875 -0.0425 0.2354736328125 -0.487985107421875 -0.042625 0.149444580078125 -0.487985107421875 -0.04275 0.070587158203125 -0.487985107421875 -0.04287500000000001 -0.017730712890625 -0.487985107421875 -0.04300000000000001 -0.1064453125 -0.487985107421875 -0.043125 -0.185302734375 -0.487985107421875 -0.04325 -0.27099609375 -0.487985107421875 -0.043375 -0.347808837890625 -0.487985107421875 -0.04350000000000001 -0.427581787109375 -0.487985107421875 -0.04362500000000001 -0.50262451171875 -0.487985107421875 -0.04375000000000001 -0.569091796875 -0.487985107421875 -0.043875 -0.6334228515625 -0.487985107421875 -0.04399999999999999 -0.685455322265625 -0.487985107421875 -0.044125 -0.740631103515625 -0.487985107421875 -0.04425 -0.783477783203125 -0.487985107421875 -0.044375 -0.814666748046875 -0.487985107421875 -0.04449999999999999 -0.845916748046875 -0.487985107421875 -0.04462499999999999 -0.854583740234375 -0.487985107421875 -0.04475 -0.854644775390625 -0.487985107421875 -0.044875 -0.854705810546875 -0.487985107421875 -0.045 -0.8546142578125 -0.487985107421875 -0.045125 -0.846282958984375 -0.487985107421875 -0.04525 -0.82586669921875 -0.487985107421875 -0.045375 -0.789215087890625 -0.487985107421875 -0.0455 -0.74395751953125 -0.487985107421875 -0.045625 -0.700103759765625 -0.487985107421875 -0.04575 -0.639495849609375 -0.487985107421875 -0.045875 -0.57891845703125 -0.487985107421875 -0.046 -0.50836181640625 -0.487985107421875 -0.046125 -0.42913818359375 -0.487985107421875 -0.04625 -0.353790283203125 -0.487985107421875 -0.046375 -0.26776123046875 -0.487985107421875 -0.04649999999999999 -0.1861572265625 -0.487985107421875 -0.046625 -0.09356689453125 -0.487985107421875 +0.03125 0.03033447265625 -0.743977294921875 +0.031375 0.063751220703125 -0.743977294921875 +0.0315 0.093231201171875 -0.743977294921875 +0.03162500000000001 0.126556396484375 -0.743977294921875 +0.03175 0.1573486328125 -0.743977294921875 +0.031875 0.18359375 -0.743977294921875 +0.032 0.21337890625 -0.487985107421875 +0.032125 0.2362060546875 -0.487985107421875 +0.03225 0.259063720703125 -0.487985107421875 +0.032375 0.28240966796875 -0.487985107421875 +0.0325 0.29803466796875 -0.487985107421875 +0.032625 0.312255859375 -0.487985107421875 +0.03275 0.325897216796875 -0.487985107421875 +0.032875 0.3336181640625 -0.487985107421875 +0.033 0.33770751953125 -0.487985107421875 +0.033125 0.342010498046875 -0.487985107421875 +0.03325 0.339019775390625 -0.487985107421875 +0.033375 0.333160400390625 -0.487985107421875 +0.0335 0.323150634765625 -0.487985107421875 +0.03362500000000001 0.31304931640625 -0.487985107421875 +0.03375 0.29779052734375 -0.487985107421875 +0.033875 0.277740478515625 -0.487985107421875 +0.034 0.2598876953125 -0.487985107421875 +0.03412500000000001 0.234039306640625 -0.487985107421875 +0.03425 0.20556640625 -0.487985107421875 +0.034375 0.179931640625 -0.487985107421875 +0.0345 0.147125244140625 -0.487985107421875 +0.034625 0.1162109375 -0.487985107421875 +0.03475000000000001 0.08154296875 -0.487985107421875 +0.034875 0.04473876953125 -0.487985107421875 +0.035 0.011199951171875 -0.487985107421875 +0.03512500000000001 -0.02642822265625 -0.487985107421875 +0.03525 -0.0601806640625 -0.487985107421875 +0.035375 -0.097015380859375 -0.487985107421875 +0.0355 -0.1341552734375 -0.487985107421875 +0.03562500000000001 -0.16546630859375 -0.487985107421875 +0.03575 -0.198486328125 -0.487985107421875 +0.035875 -0.22857666015625 -0.487985107421875 +0.03600000000000001 -0.257476806640625 -0.487985107421875 +0.036125 -0.283538818359375 -0.487985107421875 +0.03625 -0.307281494140625 -0.487985107421875 +0.036375 -0.327423095703125 -0.487985107421875 +0.0365 -0.342498779296875 -0.487985107421875 +0.036625 -0.35565185546875 -0.487985107421875 +0.03675 -0.36834716796875 -0.487985107421875 +0.036875 -0.373321533203125 -0.487985107421875 +0.037 -0.374969482421875 -0.487985107421875 +0.03712499999999999 -0.376373291015625 -0.487985107421875 +0.03725 -0.37017822265625 -0.487985107421875 +0.037375 -0.35992431640625 -0.487985107421875 +0.0375 -0.350433349609375 -0.487985107421875 +0.037625 -0.332672119140625 -0.487985107421875 +0.03775 -0.31353759765625 -0.487985107421875 +0.037875 -0.291595458984375 -0.487985107421875 +0.038 -0.263671875 -0.487985107421875 +0.038125 -0.236114501953125 -0.487985107421875 +0.03825 -0.204742431640625 -0.487985107421875 +0.038375 -0.172760009765625 -0.487985107421875 +0.0385 -0.13543701171875 -0.487985107421875 +0.038625 -0.097442626953125 -0.487985107421875 +0.03875 -0.061279296875 -0.487985107421875 +0.038875 -0.0205078125 -0.487985107421875 +0.039 0.016510009765625 -0.487985107421875 +0.039125 0.05767822265625 -0.487985107421875 +0.03925 0.09820556640625 -0.487985107421875 +0.039375 0.134857177734375 -0.487985107421875 +0.0395 0.17327880859375 -0.487985107421875 +0.039625 0.206268310546875 -0.487985107421875 +0.03975 0.24261474609375 -0.487985107421875 +0.039875 0.27471923828125 -0.487985107421875 +0.04 0.301025390625 -0.487985107421875 +0.040125 0.327117919921875 -0.487985107421875 +0.04025 0.350250244140625 -0.487985107421875 +0.040375 0.369476318359375 -0.487985107421875 +0.04050000000000001 0.3846435546875 -0.487985107421875 +0.040625 0.397674560546875 -0.487985107421875 +0.04075 0.40478515625 -0.487985107421875 +0.040875 0.407379150390625 -0.487985107421875 +0.04100000000000001 0.4090576171875 -0.487985107421875 +0.041125 0.403228759765625 -0.487985107421875 +0.04125 0.394195556640625 -0.487985107421875 +0.041375 0.3828125 -0.487985107421875 +0.0415 0.36639404296875 -0.487985107421875 +0.041625 0.3443603515625 -0.487985107421875 +0.04175000000000001 0.32080078125 -0.487985107421875 +0.041875 0.294403076171875 -0.487985107421875 +0.042 0.26202392578125 -0.487985107421875 +0.042125 0.23199462890625 -0.487985107421875 +0.04225000000000001 0.1942138671875 -0.487985107421875 +0.042375 0.154327392578125 -0.487985107421875 +0.0425 0.11773681640625 -0.487985107421875 +0.042625 0.07470703125 -0.487985107421875 +0.04275 0.0352783203125 -0.487985107421875 +0.04287500000000001 -0.008880615234375 -0.487985107421875 +0.04300000000000001 -0.053253173828125 -0.487985107421875 +0.043125 -0.092681884765625 -0.487985107421875 +0.04325 -0.135528564453125 -0.487985107421875 +0.043375 -0.173919677734375 -0.487985107421875 +0.04350000000000001 -0.21380615234375 -0.487985107421875 +0.04362500000000001 -0.2513427734375 -0.487985107421875 +0.04375000000000001 -0.284576416015625 -0.487985107421875 +0.043875 -0.316741943359375 -0.487985107421875 +0.04399999999999999 -0.342742919921875 -0.487985107421875 +0.044125 -0.370330810546875 -0.487985107421875 +0.04425 -0.391754150390625 -0.487985107421875 +0.044375 -0.4073486328125 -0.487985107421875 +0.04449999999999999 -0.4229736328125 -0.487985107421875 +0.04462499999999999 -0.430877685546875 -0.487985107421875 +0.04475 -0.4351806640625 -0.487985107421875 +0.044875 -0.437225341796875 -0.487985107421875 +0.045 -0.432708740234375 -0.487985107421875 +0.045125 -0.42315673828125 -0.487985107421875 +0.04525 -0.4129638671875 -0.487985107421875 +0.045375 -0.394622802734375 -0.487985107421875 +0.0455 -0.37200927734375 -0.487985107421875 +0.045625 -0.350067138671875 -0.487985107421875 +0.04575 -0.31976318359375 -0.487985107421875 +0.045875 -0.28948974609375 -0.487985107421875 +0.046 -0.25421142578125 -0.487985107421875 +0.046125 -0.214599609375 -0.487985107421875 +0.04625 -0.176910400390625 -0.487985107421875 +0.046375 -0.1339111328125 -0.487985107421875 +0.04649999999999999 -0.093109130859375 -0.487985107421875 +0.046625 -0.04681396484375 -0.487985107421875 0.04675000000000001 0.0 -0.487985107421875 -0.046875 0.08465576171875 -0.487985107421875 -0.04699999999999999 0.177886962890625 -0.487985107421875 -0.047125 0.2601318359375 -0.487985107421875 -0.04725000000000001 0.350555419921875 -0.487985107421875 -0.047375 0.435821533203125 -0.487985107421875 -0.0475 0.508453369140625 -0.487985107421875 -0.047625 0.58673095703125 -0.487985107421875 -0.04775 0.64947509765625 -0.487985107421875 -0.047875 0.71240234375 -0.487985107421875 -0.048 0.771209716796875 -0.487985107421875 -0.048125 0.8138427734375 -0.487985107421875 -0.04825 0.85272216796875 -0.487985107421875 -0.048375 0.854766845703125 -0.487985107421875 -0.0485 0.854949951171875 -0.487985107421875 -0.048625 0.855072021484375 -0.487985107421875 -0.04875 0.8551025390625 -0.487985107421875 -0.048875 0.85504150390625 -0.487985107421875 -0.049 0.854888916015625 -0.487985107421875 -0.04912500000000001 0.85467529296875 -0.487985107421875 -0.04925000000000001 0.837615966796875 -0.487985107421875 -0.049375 0.796783447265625 -0.487985107421875 -0.0495 0.74627685546875 -0.487985107421875 -0.049625 0.6907958984375 -0.487985107421875 -0.04975000000000001 0.62200927734375 -0.487985107421875 -0.04987500000000001 0.548583984375 -0.487985107421875 -0.05 0.475128173828125 -0.487985107421875 -0.05012499999999999 0.3885498046875 -0.487985107421875 -0.05025 0.306915283203125 -0.487985107421875 -0.05037500000000001 0.213958740234375 -0.487985107421875 -0.0505 0.117401123046875 -0.487985107421875 -0.05062500000000001 0.029388427734375 -0.487985107421875 -0.05075000000000001 -0.06884765625 -0.487985107421875 -0.050875 -0.156829833984375 -0.487985107421875 -0.051 -0.2529296875 -0.487985107421875 -0.051125 -0.347564697265625 -0.487985107421875 -0.05125000000000001 -0.428619384765625 -0.487985107421875 -0.051375 -0.51422119140625 -0.487985107421875 -0.0515 -0.588592529296875 -0.487985107421875 -0.05162500000000001 -0.6629638671875 -0.487985107421875 -0.05175000000000001 -0.730133056640625 -0.487985107421875 -0.051875 -0.78643798828125 -0.487985107421875 -0.052 -0.8380126953125 -0.487985107421875 -0.052125 -0.854705810546875 -0.487985107421875 -0.05225 -0.855072021484375 -0.487985107421875 -0.05237499999999999 -0.85528564453125 -0.487985107421875 -0.0525 -0.85540771484375 -0.487985107421875 -0.052625 -0.85546875 -0.487985107421875 -0.05274999999999999 -0.855438232421875 -0.487985107421875 -0.052875 -0.85528564453125 -0.487985107421875 -0.05300000000000001 -0.855072021484375 -0.487985107421875 -0.053125 -0.854766845703125 -0.487985107421875 -0.05324999999999999 -0.836456298828125 -0.487985107421875 -0.05337499999999999 -0.78839111328125 -0.487985107421875 -0.05350000000000001 -0.72894287109375 -0.487985107421875 -0.053625 -0.6591796875 -0.487985107421875 -0.05375 -0.5902099609375 -0.487985107421875 -0.05387499999999999 -0.50885009765625 -0.487985107421875 -0.054 -0.42938232421875 -0.487985107421875 -0.054125 -0.33660888671875 -0.487985107421875 -0.05425 -0.24078369140625 -0.487985107421875 -0.054375 -0.15142822265625 -0.487985107421875 -0.0545 -0.050628662109375 -0.487985107421875 -0.054625 0.040618896484375 -0.487985107421875 -0.05475 0.14178466796875 -0.487985107421875 -0.054875 0.241424560546875 -0.487985107421875 -0.055 0.3297119140625 -0.487985107421875 -0.055125 0.42364501953125 -0.487985107421875 -0.05525 0.50421142578125 -0.487985107421875 -0.055375 0.589874267578125 -0.487985107421875 -0.05550000000000001 0.66790771484375 -0.487985107421875 -0.055625 0.73187255859375 -0.487985107421875 -0.05575 0.797149658203125 -0.487985107421875 -0.05587499999999999 0.846954345703125 -0.487985107421875 -0.05600000000000001 0.8548583984375 -0.487985107421875 -0.05612500000000001 0.855224609375 -0.487985107421875 -0.05625 0.855438232421875 -0.487985107421875 -0.05637499999999999 0.855621337890625 -0.487985107421875 -0.0565 0.855682373046875 -0.487985107421875 -0.05662500000000001 0.85565185546875 -0.487985107421875 -0.05675 0.85552978515625 -0.487985107421875 -0.056875 0.855316162109375 -0.487985107421875 -0.05700000000000001 0.855010986328125 -0.487985107421875 -0.057125 0.854644775390625 -0.487985107421875 -0.05725 0.819610595703125 -0.487985107421875 -0.057375 0.75958251953125 -0.487985107421875 -0.05750000000000001 0.697052001953125 -0.487985107421875 -0.057625 0.620361328125 -0.487985107421875 -0.05775 0.546417236328125 -0.487985107421875 -0.057875 0.457489013671875 -0.487985107421875 -0.05800000000000001 0.363494873046875 -0.487985107421875 -0.058125 0.275909423828125 -0.487985107421875 -0.05825 0.17510986328125 -0.487985107421875 -0.058375 0.08270263671875 -0.487985107421875 -0.05850000000000001 -0.02069091796875 -0.487985107421875 -0.05862500000000001 -0.12408447265625 -0.487985107421875 -0.05875 -0.216033935546875 -0.487985107421875 -0.058875 -0.316375732421875 -0.487985107421875 -0.059 -0.4034423828125 -0.487985107421875 -0.05912500000000001 -0.4959716796875 -0.487985107421875 -0.05925000000000001 -0.583740234375 -0.487985107421875 -0.059375 -0.65679931640625 -0.487985107421875 -0.05950000000000001 -0.731048583984375 -0.487985107421875 -0.059625 -0.7919921875 -0.487985107421875 -0.05975000000000001 -0.85052490234375 -0.487985107421875 -0.059875 -0.854949951171875 -0.487985107421875 -0.06 -0.85528564453125 -0.487985107421875 -0.06012499999999999 -0.855560302734375 -0.487985107421875 -0.06025 -0.855743408203125 -0.487985107421875 -0.060375 -0.8558349609375 -0.487985107421875 -0.0605 -0.8558349609375 -0.487985107421875 -0.060625 -0.855743408203125 -0.487985107421875 -0.06074999999999999 -0.85552978515625 -0.487985107421875 -0.060875 -0.855255126953125 -0.487985107421875 -0.061 -0.854888916015625 -0.487985107421875 -0.061125 -0.8419189453125 -0.487985107421875 -0.06125 -0.7884521484375 -0.487985107421875 -0.061375 -0.720184326171875 -0.487985107421875 -0.0615 -0.6519775390625 -0.487985107421875 -0.061625 -0.569793701171875 -0.487985107421875 -0.06174999999999999 -0.480987548828125 -0.487985107421875 -0.061875 -0.396514892578125 -0.487985107421875 -0.062 -0.2987060546875 -0.487985107421875 -0.06212499999999999 -0.2076416015625 -0.487985107421875 -0.06225000000000001 -0.1043701171875 -0.487985107421875 +0.046875 0.042327880859375 -0.487985107421875 +0.04699999999999999 0.08892822265625 -0.487985107421875 +0.047125 0.13006591796875 -0.487985107421875 +0.04725000000000001 0.175262451171875 -0.487985107421875 +0.047375 0.2178955078125 -0.487985107421875 +0.0475 0.25421142578125 -0.487985107421875 +0.047625 0.293365478515625 -0.487985107421875 +0.04775 0.324737548828125 -0.487985107421875 +0.047875 0.356201171875 -0.487985107421875 +0.048 0.385589599609375 -0.487985107421875 +0.048125 0.40692138671875 -0.487985107421875 +0.04825 0.426361083984375 -0.487985107421875 +0.048375 0.44189453125 -0.487985107421875 +0.0485 0.452362060546875 -0.487985107421875 +0.048625 0.4578857421875 -0.487985107421875 +0.04875 0.460601806640625 -0.487985107421875 +0.048875 0.456573486328125 -0.487985107421875 +0.049 0.44866943359375 -0.487985107421875 +0.04912500000000001 0.437103271484375 -0.487985107421875 +0.04925000000000001 0.418792724609375 -0.487985107421875 +0.049375 0.39837646484375 -0.487985107421875 +0.0495 0.373138427734375 -0.487985107421875 +0.049625 0.34539794921875 -0.487985107421875 +0.04975000000000001 0.311004638671875 -0.487985107421875 +0.04987500000000001 0.2742919921875 -0.487985107421875 +0.05 0.237548828125 -0.487985107421875 +0.05012499999999999 0.19427490234375 -0.487985107421875 +0.05025 0.1534423828125 -0.487985107421875 +0.05037500000000001 0.106964111328125 -0.487985107421875 +0.0505 0.058685302734375 -0.487985107421875 +0.05062500000000001 0.014678955078125 -0.487985107421875 +0.05075000000000001 -0.034454345703125 -0.487985107421875 +0.050875 -0.07843017578125 -0.487985107421875 +0.051 -0.126495361328125 -0.487985107421875 +0.051125 -0.173797607421875 -0.487985107421875 +0.05125000000000001 -0.214324951171875 -0.487985107421875 +0.051375 -0.25714111328125 -0.487985107421875 +0.0515 -0.2943115234375 -0.487985107421875 +0.05162500000000001 -0.331512451171875 -0.487985107421875 +0.05175000000000001 -0.365081787109375 -0.487985107421875 +0.051875 -0.39324951171875 -0.487985107421875 +0.052 -0.419036865234375 -0.487985107421875 +0.052125 -0.438323974609375 -0.487985107421875 +0.05225 -0.456695556640625 -0.487985107421875 +0.05237499999999999 -0.468597412109375 -0.487985107421875 +0.0525 -0.474945068359375 -0.487985107421875 +0.052625 -0.47857666015625 -0.487985107421875 +0.05274999999999999 -0.475982666015625 -0.487985107421875 +0.052875 -0.4681396484375 -0.487985107421875 +0.05300000000000001 -0.456573486328125 -0.487985107421875 +0.053125 -0.44061279296875 -0.487985107421875 +0.05324999999999999 -0.418243408203125 -0.487985107421875 +0.05337499999999999 -0.39422607421875 -0.487985107421875 +0.05350000000000001 -0.364501953125 -0.487985107421875 +0.053625 -0.329620361328125 -0.487985107421875 +0.05375 -0.295135498046875 -0.487985107421875 +0.05387499999999999 -0.25445556640625 -0.487985107421875 +0.054 -0.2147216796875 -0.487985107421875 +0.054125 -0.1683349609375 -0.487985107421875 +0.05425 -0.12042236328125 -0.487985107421875 +0.054375 -0.07574462890625 -0.487985107421875 +0.0545 -0.02532958984375 -0.487985107421875 +0.054625 0.020294189453125 -0.487985107421875 +0.05475 0.070892333984375 -0.487985107421875 +0.054875 0.120697021484375 -0.487985107421875 +0.055 0.16485595703125 -0.487985107421875 +0.055125 0.211822509765625 -0.487985107421875 +0.05525 0.252105712890625 -0.487985107421875 +0.055375 0.294921875 -0.487985107421875 +0.05550000000000001 0.333953857421875 -0.487985107421875 +0.055625 0.365936279296875 -0.487985107421875 +0.05575 0.3985595703125 -0.487985107421875 +0.05587499999999999 0.4234619140625 -0.487985107421875 +0.05600000000000001 0.44671630859375 -0.487985107421875 +0.05612500000000001 0.466064453125 -0.487985107421875 +0.05625 0.478240966796875 -0.487985107421875 +0.05637499999999999 0.486785888671875 -0.487985107421875 +0.0565 0.490936279296875 -0.487985107421875 +0.05662500000000001 0.489349365234375 -0.487985107421875 +0.05675 0.48236083984375 -0.487985107421875 +0.056875 0.4715576171875 -0.487985107421875 +0.05700000000000001 0.455535888671875 -0.487985107421875 +0.057125 0.43603515625 -0.487985107421875 +0.05725 0.4097900390625 -0.487985107421875 +0.057375 0.379791259765625 -0.487985107421875 +0.05750000000000001 0.3485107421875 -0.487985107421875 +0.057625 0.3101806640625 -0.487985107421875 +0.05775 0.273193359375 -0.487985107421875 +0.057875 0.228729248046875 -0.487985107421875 +0.05800000000000001 0.181732177734375 -0.487985107421875 +0.058125 0.137939453125 -0.487985107421875 +0.05825 0.087554931640625 -0.487985107421875 +0.058375 0.041351318359375 -0.487985107421875 +0.05850000000000001 -0.0103759765625 -0.487985107421875 +0.05862500000000001 -0.06207275390625 -0.487985107421875 +0.05875 -0.1080322265625 -0.487985107421875 +0.058875 -0.158203125 -0.487985107421875 +0.059 -0.201751708984375 -0.487985107421875 +0.05912500000000001 -0.248016357421875 -0.487985107421875 +0.05925000000000001 -0.291900634765625 -0.487985107421875 +0.059375 -0.32843017578125 -0.487985107421875 +0.05950000000000001 -0.36553955078125 -0.487985107421875 +0.059625 -0.396026611328125 -0.487985107421875 +0.05975000000000001 -0.42529296875 -0.487985107421875 +0.059875 -0.44989013671875 -0.487985107421875 +0.06 -0.468292236328125 -0.487985107421875 +0.06012499999999999 -0.483367919921875 -0.487985107421875 +0.06025 -0.49237060546875 -0.487985107421875 +0.060375 -0.497283935546875 -0.487985107421875 +0.0605 -0.497222900390625 -0.487985107421875 +0.060625 -0.4920654296875 -0.487985107421875 +0.06074999999999999 -0.481201171875 -0.487985107421875 +0.060875 -0.467315673828125 -0.487985107421875 +0.061 -0.44659423828125 -0.487985107421875 +0.061125 -0.420989990234375 -0.487985107421875 +0.06125 -0.394256591796875 -0.487985107421875 +0.061375 -0.360107421875 -0.487985107421875 +0.0615 -0.326019287109375 -0.487985107421875 +0.061625 -0.284912109375 -0.487985107421875 +0.06174999999999999 -0.240509033203125 -0.487985107421875 +0.061875 -0.198272705078125 -0.487985107421875 +0.062 -0.149383544921875 -0.487985107421875 +0.06212499999999999 -0.103851318359375 -0.487985107421875 +0.06225000000000001 -0.052215576171875 -0.487985107421875 0.06237500000000001 0.0 -0.487985107421875 -0.0625 0.093994140625 -0.487985107421875 -0.06262499999999999 0.197479248046875 -0.487985107421875 -0.06274999999999999 0.28887939453125 -0.487985107421875 -0.06287500000000001 0.3873291015625 -0.487985107421875 -0.063 0.481536865234375 -0.487985107421875 -0.063125 0.561920166015625 -0.487985107421875 -0.06325000000000001 0.645294189453125 -0.487985107421875 -0.063375 0.71429443359375 -0.487985107421875 -0.0635 0.78350830078125 -0.487985107421875 -0.063625 0.844207763671875 -0.487985107421875 -0.06375 0.854827880859375 -0.487985107421875 -0.063875 0.855224609375 -0.487985107421875 -0.064 0.855499267578125 -0.2319929199218749 -0.064125 0.855712890625 -0.2319929199218749 -0.06425000000000001 0.8558349609375 -0.2319929199218749 -0.064375 0.855865478515625 -0.2319929199218749 -0.0645 0.85577392578125 -0.2319929199218749 -0.064625 0.8555908203125 -0.2319929199218749 -0.06475 0.855316162109375 -0.2319929199218749 -0.06487500000000001 0.854949951171875 -0.2319929199218749 -0.065 0.854522705078125 -0.2319929199218749 -0.065125 0.80194091796875 -0.2319929199218749 -0.06525 0.741973876953125 -0.2319929199218749 -0.06537500000000001 0.6680908203125 -0.2319929199218749 -0.06550000000000001 0.586822509765625 -0.2319929199218749 -0.065625 0.507904052734375 -0.2319929199218749 -0.06574999999999999 0.415374755859375 -0.2319929199218749 -0.065875 0.327880859375 -0.2319929199218749 -0.06600000000000001 0.2276611328125 -0.2319929199218749 -0.066125 0.124908447265625 -0.2319929199218749 -0.06625000000000001 0.03125 -0.2319929199218749 -0.06637500000000001 -0.072906494140625 -0.2319929199218749 -0.0665 -0.166107177734375 -0.2319929199218749 -0.066625 -0.26763916015625 -0.2319929199218749 -0.06675 -0.36639404296875 -0.2319929199218749 -0.06687500000000001 -0.451385498046875 -0.2319929199218749 -0.067 -0.541534423828125 -0.2319929199218749 -0.067125 -0.61761474609375 -0.2319929199218749 -0.06725000000000001 -0.694854736328125 -0.2319929199218749 -0.06737500000000001 -0.7652587890625 -0.2319929199218749 -0.0675 -0.82037353515625 -0.2319929199218749 -0.067625 -0.854705810546875 -0.2319929199218749 -0.06775 -0.855072021484375 -0.2319929199218749 -0.06787500000000001 -0.85540771484375 -0.2319929199218749 -0.06800000000000001 -0.855621337890625 -0.2319929199218749 -0.068125 -0.85577392578125 -0.2319929199218749 -0.06825000000000001 -0.85577392578125 -0.2319929199218749 -0.068375 -0.855743408203125 -0.2319929199218749 -0.06850000000000001 -0.855560302734375 -0.2319929199218749 -0.06862500000000001 -0.855316162109375 -0.2319929199218749 -0.06875 -0.855010986328125 -0.2319929199218749 -0.06887500000000001 -0.85455322265625 -0.2319929199218749 -0.069 -0.80950927734375 -0.2319929199218749 -0.06912500000000001 -0.744903564453125 -0.2319929199218749 -0.06925000000000001 -0.673583984375 -0.2319929199218749 -0.06937500000000001 -0.60308837890625 -0.2319929199218749 -0.06950000000000001 -0.517486572265625 -0.2319929199218749 -0.069625 -0.436676025390625 -0.2319929199218749 -0.06975 -0.342315673828125 -0.2319929199218749 -0.06987500000000001 -0.243682861328125 -0.2319929199218749 -0.07000000000000001 -0.15325927734375 -0.2319929199218749 -0.070125 -0.051116943359375 -0.2319929199218749 -0.07025000000000001 0.0408935546875 -0.2319929199218749 -0.07037500000000001 0.142822265625 -0.2319929199218749 -0.07050000000000001 0.24261474609375 -0.2319929199218749 -0.070625 0.33050537109375 -0.2319929199218749 -0.07075 0.42364501953125 -0.2319929199218749 -0.07087500000000001 0.50421142578125 -0.2319929199218749 -0.07100000000000001 0.588470458984375 -0.2319929199218749 -0.07112500000000001 0.664642333984375 -0.2319929199218749 -0.07125000000000002 0.728302001953125 -0.2319929199218749 -0.07137500000000001 0.791473388671875 -0.2319929199218749 -0.0715 0.83868408203125 -0.2319929199218749 -0.07162500000000001 0.854766845703125 -0.2319929199218749 -0.07175000000000001 0.855072021484375 -0.2319929199218749 -0.07187500000000001 0.855316162109375 -0.2319929199218749 -0.07200000000000001 0.85546875 -0.2319929199218749 -0.07212499999999999 0.855499267578125 -0.2319929199218749 -0.07225 0.85546875 -0.2319929199218749 -0.07237499999999999 0.855316162109375 -0.2319929199218749 -0.0725 0.855133056640625 -0.2319929199218749 -0.07262499999999999 0.85479736328125 -0.2319929199218749 -0.07274999999999999 0.848236083984375 -0.2319929199218749 -0.072875 0.797210693359375 -0.2319929199218749 -0.073 0.73748779296875 -0.2319929199218749 -0.073125 0.674591064453125 -0.2319929199218749 -0.07324999999999999 0.600372314453125 -0.2319929199218749 -0.07337499999999999 0.526153564453125 -0.2319929199218749 -0.0735 0.440521240234375 -0.2319929199218749 -0.073625 0.35003662109375 -0.2319929199218749 -0.07374999999999999 0.26434326171875 -0.2319929199218749 -0.073875 0.167755126953125 -0.2319929199218749 -0.074 0.0792236328125 -0.2319929199218749 -0.074125 -0.01971435546875 -0.2319929199218749 -0.07424999999999999 -0.1182861328125 -0.2319929199218749 -0.07437499999999999 -0.205169677734375 -0.2319929199218749 -0.0745 -0.300018310546875 -0.2319929199218749 -0.07462499999999999 -0.382598876953125 -0.2319929199218749 -0.07475 -0.468536376953125 -0.2319929199218749 -0.07487500000000001 -0.55078125 -0.2319929199218749 -0.075 -0.61724853515625 -0.2319929199218749 -0.07512499999999999 -0.687042236328125 -0.2319929199218749 -0.07524999999999999 -0.74346923828125 -0.2319929199218749 -0.075375 -0.795135498046875 -0.2319929199218749 -0.0755 -0.84112548828125 -0.2319929199218749 -0.075625 -0.854705810546875 -0.2319929199218749 -0.07574999999999999 -0.85491943359375 -0.2319929199218749 -0.075875 -0.8551025390625 -0.2319929199218749 -0.076 -0.855133056640625 -0.2319929199218749 -0.076125 -0.855133056640625 -0.2319929199218749 -0.07625 -0.85504150390625 -0.2319929199218749 -0.07637499999999999 -0.85479736328125 -0.2319929199218749 -0.0765 -0.85455322265625 -0.2319929199218749 -0.076625 -0.818115234375 -0.2319929199218749 -0.07675 -0.771209716796875 -0.2319929199218749 -0.076875 -0.721710205078125 -0.2319929199218749 -0.077 -0.656097412109375 -0.2319929199218749 -0.077125 -0.593963623046875 -0.2319929199218749 -0.07725 -0.518768310546875 -0.2319929199218749 -0.07737499999999999 -0.435821533203125 -0.2319929199218749 -0.0775 -0.3592529296875 -0.2319929199218749 -0.077625 -0.269134521484375 -0.2319929199218749 -0.07774999999999999 -0.187103271484375 -0.2319929199218749 -0.07787500000000001 -0.09405517578125 -0.2319929199218749 +0.0625 0.0469970703125 -0.487985107421875 +0.06262499999999999 0.098724365234375 -0.487985107421875 +0.06274999999999999 0.144439697265625 -0.487985107421875 +0.06287500000000001 0.19366455078125 -0.487985107421875 +0.063 0.240753173828125 -0.487985107421875 +0.063125 0.28094482421875 -0.487985107421875 +0.06325000000000001 0.3226318359375 -0.487985107421875 +0.063375 0.357147216796875 -0.487985107421875 +0.0635 0.391754150390625 -0.487985107421875 +0.063625 0.422088623046875 -0.487985107421875 +0.06375 0.4454345703125 -0.487985107421875 +0.063875 0.466705322265625 -0.487985107421875 +0.064 0.481475830078125 -0.2319929199218749 +0.064125 0.492889404296875 -0.2319929199218749 +0.06425000000000001 0.498809814453125 -0.2319929199218749 +0.064375 0.499542236328125 -0.2319929199218749 +0.0645 0.49517822265625 -0.2319929199218749 +0.064625 0.4864501953125 -0.2319929199218749 +0.06475 0.47186279296875 -0.2319929199218749 +0.06487500000000001 0.451934814453125 -0.2319929199218749 +0.065 0.429901123046875 -0.2319929199218749 +0.065125 0.400970458984375 -0.2319929199218749 +0.06525 0.3709716796875 -0.2319929199218749 +0.06537500000000001 0.33404541015625 -0.2319929199218749 +0.06550000000000001 0.29339599609375 -0.2319929199218749 +0.065625 0.253936767578125 -0.2319929199218749 +0.06574999999999999 0.207672119140625 -0.2319929199218749 +0.065875 0.1639404296875 -0.2319929199218749 +0.06600000000000001 0.11383056640625 -0.2319929199218749 +0.066125 0.06243896484375 -0.2319929199218749 +0.06625000000000001 0.015625 -0.2319929199218749 +0.06637500000000001 -0.036468505859375 -0.2319929199218749 +0.0665 -0.08306884765625 -0.2319929199218749 +0.066625 -0.13385009765625 -0.2319929199218749 +0.06675 -0.1832275390625 -0.2319929199218749 +0.06687500000000001 -0.2257080078125 -0.2319929199218749 +0.067 -0.270782470703125 -0.2319929199218749 +0.067125 -0.308837890625 -0.2319929199218749 +0.06725000000000001 -0.347442626953125 -0.2319929199218749 +0.06737500000000001 -0.382659912109375 -0.2319929199218749 +0.0675 -0.41021728515625 -0.2319929199218749 +0.067625 -0.437103271484375 -0.2319929199218749 +0.06775 -0.457244873046875 -0.2319929199218749 +0.06787500000000001 -0.47418212890625 -0.2319929199218749 +0.06800000000000001 -0.486541748046875 -0.2319929199218749 +0.068125 -0.49310302734375 -0.2319929199218749 +0.06825000000000001 -0.49456787109375 -0.2319929199218749 +0.068375 -0.491851806640625 -0.2319929199218749 +0.06850000000000001 -0.48297119140625 -0.2319929199218749 +0.06862500000000001 -0.4696044921875 -0.2319929199218749 +0.06875 -0.45318603515625 -0.2319929199218749 +0.06887500000000001 -0.429473876953125 -0.2319929199218749 +0.069 -0.40478515625 -0.2319929199218749 +0.06912500000000001 -0.372467041015625 -0.2319929199218749 +0.06925000000000001 -0.336822509765625 -0.2319929199218749 +0.06937500000000001 -0.30157470703125 -0.2319929199218749 +0.06950000000000001 -0.258758544921875 -0.2319929199218749 +0.069625 -0.218353271484375 -0.2319929199218749 +0.06975 -0.171173095703125 -0.2319929199218749 +0.06987500000000001 -0.121856689453125 -0.2319929199218749 +0.07000000000000001 -0.07666015625 -0.2319929199218749 +0.070125 -0.02557373046875 -0.2319929199218749 +0.07025000000000001 0.02044677734375 -0.2319929199218749 +0.07037500000000001 0.0714111328125 -0.2319929199218749 +0.07050000000000001 0.121307373046875 -0.2319929199218749 +0.070625 0.165252685546875 -0.2319929199218749 +0.07075 0.211822509765625 -0.2319929199218749 +0.07087500000000001 0.252105712890625 -0.2319929199218749 +0.07100000000000001 0.294219970703125 -0.2319929199218749 +0.07112500000000001 0.332305908203125 -0.2319929199218749 +0.07125000000000002 0.3641357421875 -0.2319929199218749 +0.07137500000000001 0.395721435546875 -0.2319929199218749 +0.0715 0.419342041015625 -0.2319929199218749 +0.07162500000000001 0.442352294921875 -0.2319929199218749 +0.07175000000000001 0.459228515625 -0.2319929199218749 +0.07187500000000001 0.471221923828125 -0.2319929199218749 +0.07200000000000001 0.47967529296875 -0.2319929199218749 +0.07212499999999999 0.48138427734375 -0.2319929199218749 +0.07225 0.47979736328125 -0.2319929199218749 +0.07237499999999999 0.4715576171875 -0.2319929199218749 +0.0725 0.460968017578125 -0.2319929199218749 +0.07262499999999999 0.4444580078125 -0.2319929199218749 +0.07274999999999999 0.424102783203125 -0.2319929199218749 +0.072875 0.398590087890625 -0.2319929199218749 +0.073 0.368743896484375 -0.2319929199218749 +0.073125 0.3372802734375 -0.2319929199218749 +0.07324999999999999 0.3001708984375 -0.2319929199218749 +0.07337499999999999 0.2630615234375 -0.2319929199218749 +0.0735 0.220245361328125 -0.2319929199218749 +0.073625 0.175018310546875 -0.2319929199218749 +0.07374999999999999 0.132171630859375 -0.2319929199218749 +0.073875 0.0838623046875 -0.2319929199218749 +0.074 0.03961181640625 -0.2319929199218749 +0.074125 -0.0098876953125 -0.2319929199218749 +0.07424999999999999 -0.059173583984375 -0.2319929199218749 +0.07437499999999999 -0.10260009765625 -0.2319929199218749 +0.0745 -0.1500244140625 -0.2319929199218749 +0.07462499999999999 -0.191314697265625 -0.2319929199218749 +0.07475 -0.234283447265625 -0.2319929199218749 +0.07487500000000001 -0.275421142578125 -0.2319929199218749 +0.075 -0.30865478515625 -0.2319929199218749 +0.07512499999999999 -0.343536376953125 -0.2319929199218749 +0.07524999999999999 -0.37176513671875 -0.2319929199218749 +0.075375 -0.3975830078125 -0.2319929199218749 +0.0755 -0.42059326171875 -0.2319929199218749 +0.075625 -0.437347412109375 -0.2319929199218749 +0.07574999999999999 -0.44952392578125 -0.2319929199218749 +0.075875 -0.457916259765625 -0.2319929199218749 +0.076 -0.460479736328125 -0.2319929199218749 +0.076125 -0.4599609375 -0.2319929199218749 +0.07625 -0.4552001953125 -0.2319929199218749 +0.07637499999999999 -0.44317626953125 -0.2319929199218749 +0.0765 -0.4300537109375 -0.2319929199218749 +0.076625 -0.409088134765625 -0.2319929199218749 +0.07675 -0.3856201171875 -0.2319929199218749 +0.076875 -0.360870361328125 -0.2319929199218749 +0.077 -0.32806396484375 -0.2319929199218749 +0.077125 -0.2969970703125 -0.2319929199218749 +0.07725 -0.2593994140625 -0.2319929199218749 +0.07737499999999999 -0.217926025390625 -0.2319929199218749 +0.0775 -0.179656982421875 -0.2319929199218749 +0.077625 -0.13458251953125 -0.2319929199218749 +0.07774999999999999 -0.09356689453125 -0.2319929199218749 +0.07787500000000001 -0.04705810546875 -0.2319929199218749 0.07800000000000001 0.0 -0.2319929199218749 -0.078125 0.084228515625 -0.2319929199218749 -0.07824999999999999 0.176025390625 -0.2319929199218749 -0.07837499999999999 0.2574462890625 -0.2319929199218749 -0.07850000000000001 0.345184326171875 -0.2319929199218749 -0.078625 0.426849365234375 -0.2319929199218749 -0.07875 0.498016357421875 -0.2319929199218749 -0.07887500000000001 0.571868896484375 -0.2319929199218749 -0.079 0.629547119140625 -0.2319929199218749 -0.079125 0.690521240234375 -0.2319929199218749 -0.07925 0.73974609375 -0.2319929199218749 -0.079375 0.7806396484375 -0.2319929199218749 -0.0795 0.81793212890625 -0.2319929199218749 -0.079625 0.838958740234375 -0.2319929199218749 -0.07975 0.854522705078125 -0.2319929199218749 -0.07987500000000001 0.854583740234375 -0.2319929199218749 -0.08 0.854583740234375 -0.2319929199218749 -0.08012499999999999 0.854522705078125 -0.2319929199218749 -0.08025 0.83782958984375 -0.2319929199218749 -0.080375 0.812713623046875 -0.2319929199218749 -0.08050000000000001 0.778656005859375 -0.2319929199218749 -0.080625 0.736083984375 -0.2319929199218749 -0.08074999999999999 0.686553955078125 -0.2319929199218749 -0.080875 0.631439208984375 -0.2319929199218749 -0.08100000000000001 0.568572998046875 -0.2319929199218749 -0.08112500000000001 0.49945068359375 -0.2319929199218749 -0.08125 0.429718017578125 -0.2319929199218749 -0.08137499999999999 0.351409912109375 -0.2319929199218749 -0.0815 0.277587890625 -0.2319929199218749 -0.081625 0.191436767578125 -0.2319929199218749 -0.08175000000000001 0.10504150390625 -0.2319929199218749 -0.081875 0.026123046875 -0.2319929199218749 -0.08200000000000001 -0.060943603515625 -0.2319929199218749 -0.082125 -0.138824462890625 -0.2319929199218749 -0.08225 -0.222320556640625 -0.2319929199218749 -0.08237500000000001 -0.30438232421875 -0.2319929199218749 -0.0825 -0.3726806640625 -0.2319929199218749 -0.08262500000000001 -0.4471435546875 -0.2319929199218749 -0.08275 -0.509918212890625 -0.2319929199218749 -0.08287500000000001 -0.5701904296875 -0.2319929199218749 -0.08300000000000001 -0.6279296875 -0.2319929199218749 -0.083125 -0.674041748046875 -0.2319929199218749 -0.08324999999999999 -0.712860107421875 -0.2319929199218749 -0.083375 -0.74566650390625 -0.2319929199218749 -0.08350000000000001 -0.768402099609375 -0.2319929199218749 -0.08362500000000001 -0.788421630859375 -0.2319929199218749 -0.08375 -0.799072265625 -0.2319929199218749 -0.08387500000000001 -0.79632568359375 -0.2319929199218749 -0.084 -0.7919921875 -0.2319929199218749 -0.08412500000000001 -0.772735595703125 -0.2319929199218749 -0.08425000000000001 -0.7513427734375 -0.2319929199218749 -0.084375 -0.72503662109375 -0.2319929199218749 -0.08450000000000001 -0.682647705078125 -0.2319929199218749 -0.084625 -0.643402099609375 -0.2319929199218749 -0.08475 -0.593109130859375 -0.2319929199218749 -0.08487500000000001 -0.5318603515625 -0.2319929199218749 -0.085 -0.476226806640625 -0.2319929199218749 -0.08512500000000001 -0.40594482421875 -0.2319929199218749 -0.08525 -0.342529296875 -0.2319929199218749 -0.085375 -0.26849365234375 -0.2319929199218749 -0.08550000000000001 -0.18988037109375 -0.2319929199218749 -0.085625 -0.119415283203125 -0.2319929199218749 -0.08575000000000001 -0.03955078125 -0.2319929199218749 -0.08587500000000002 0.031646728515625 -0.2319929199218749 -0.08600000000000001 0.110504150390625 -0.2319929199218749 -0.08612500000000001 0.18646240234375 -0.2319929199218749 -0.08625 0.253997802734375 -0.2319929199218749 -0.08637499999999999 0.326385498046875 -0.2319929199218749 -0.0865 0.3848876953125 -0.2319929199218749 -0.08662500000000001 0.449188232421875 -0.2319929199218749 -0.08675000000000001 0.503753662109375 -0.2319929199218749 -0.08687500000000002 0.552001953125 -0.2319929199218749 -0.08700000000000001 0.599884033203125 -0.2319929199218749 -0.087125 0.631195068359375 -0.2319929199218749 -0.08725000000000001 0.66583251953125 -0.2319929199218749 -0.08737500000000001 0.686279296875 -0.2319929199218749 -0.08750000000000002 0.7042236328125 -0.2319929199218749 -0.08762500000000001 0.716796875 -0.2319929199218749 -0.08775 0.71417236328125 -0.2319929199218749 -0.08787500000000001 0.71185302734375 -0.2319929199218749 -0.08799999999999999 0.701690673828125 -0.2319929199218749 -0.088125 0.678863525390625 -0.2319929199218749 -0.08824999999999999 0.654541015625 -0.2319929199218749 -0.08837499999999999 0.619903564453125 -0.2319929199218749 -0.0885 0.582611083984375 -0.2319929199218749 -0.08862500000000001 0.538970947265625 -0.2319929199218749 -0.08875 0.48931884765625 -0.2319929199218749 -0.08887499999999999 0.43548583984375 -0.2319929199218749 -0.08899999999999999 0.3829345703125 -0.2319929199218749 -0.089125 0.317047119140625 -0.2319929199218749 -0.08924999999999999 0.251922607421875 -0.2319929199218749 -0.089375 0.18878173828125 -0.2319929199218749 -0.08949999999999999 0.11981201171875 -0.2319929199218749 -0.089625 0.05657958984375 -0.2319929199218749 -0.08975 -0.01397705078125 -0.2319929199218749 -0.08987499999999999 -0.08380126953125 -0.2319929199218749 -0.09 -0.144195556640625 -0.2319929199218749 -0.09012499999999999 -0.21087646484375 -0.2319929199218749 -0.09025 -0.268890380859375 -0.2319929199218749 -0.090375 -0.326629638671875 -0.2319929199218749 -0.09050000000000001 -0.38397216796875 -0.2319929199218749 -0.090625 -0.432037353515625 -0.2319929199218749 -0.09074999999999999 -0.475006103515625 -0.2319929199218749 -0.09087499999999999 -0.51397705078125 -0.2319929199218749 -0.091 -0.54510498046875 -0.2319929199218749 -0.09112500000000001 -0.576629638671875 -0.2319929199218749 -0.09125 -0.599609375 -0.2319929199218749 -0.09137499999999999 -0.61102294921875 -0.2319929199218749 -0.0915 -0.622406005859375 -0.2319929199218749 -0.091625 -0.6204833984375 -0.2319929199218749 -0.09175000000000001 -0.61981201171875 -0.2319929199218749 -0.091875 -0.613372802734375 -0.2319929199218749 -0.09199999999999999 -0.591888427734375 -0.2319929199218749 -0.092125 -0.5743408203125 -0.2319929199218749 -0.09225 -0.548858642578125 -0.2319929199218749 -0.09237499999999999 -0.510345458984375 -0.2319929199218749 -0.0925 -0.477630615234375 -0.2319929199218749 -0.09262499999999999 -0.43023681640625 -0.2319929199218749 -0.09275 -0.389495849609375 -0.2319929199218749 -0.092875 -0.340179443359375 -0.2319929199218749 -0.09299999999999999 -0.2830810546875 -0.2319929199218749 -0.093125 -0.233367919921875 -0.2319929199218749 -0.09324999999999999 -0.17315673828125 -0.2319929199218749 -0.093375 -0.120361328125 -0.2319929199218749 -0.09350000000000001 -0.06048583984375 -0.2319929199218749 +0.078125 0.0421142578125 -0.2319929199218749 +0.07824999999999999 0.0880126953125 -0.2319929199218749 +0.07837499999999999 0.12872314453125 -0.2319929199218749 +0.07850000000000001 0.172576904296875 -0.2319929199218749 +0.078625 0.213409423828125 -0.2319929199218749 +0.07875 0.248992919921875 -0.2319929199218749 +0.07887500000000001 0.285919189453125 -0.2319929199218749 +0.079 0.31475830078125 -0.2319929199218749 +0.079125 0.345245361328125 -0.2319929199218749 +0.07925 0.369873046875 -0.2319929199218749 +0.079375 0.39031982421875 -0.2319929199218749 +0.0795 0.408966064453125 -0.2319929199218749 +0.079625 0.419464111328125 -0.2319929199218749 +0.07975 0.429443359375 -0.2319929199218749 +0.07987500000000001 0.43206787109375 -0.2319929199218749 +0.08 0.432708740234375 -0.2319929199218749 +0.08012499999999999 0.428924560546875 -0.2319929199218749 +0.08025 0.418914794921875 -0.2319929199218749 +0.080375 0.406341552734375 -0.2319929199218749 +0.08050000000000001 0.389312744140625 -0.2319929199218749 +0.080625 0.3680419921875 -0.2319929199218749 +0.08074999999999999 0.34326171875 -0.2319929199218749 +0.080875 0.315704345703125 -0.2319929199218749 +0.08100000000000001 0.284271240234375 -0.2319929199218749 +0.08112500000000001 0.249725341796875 -0.2319929199218749 +0.08125 0.21484375 -0.2319929199218749 +0.08137499999999999 0.175689697265625 -0.2319929199218749 +0.0815 0.1387939453125 -0.2319929199218749 +0.081625 0.095703125 -0.2319929199218749 +0.08175000000000001 0.052520751953125 -0.2319929199218749 +0.081875 0.0130615234375 -0.2319929199218749 +0.08200000000000001 -0.030487060546875 -0.2319929199218749 +0.082125 -0.069427490234375 -0.2319929199218749 +0.08225 -0.111175537109375 -0.2319929199218749 +0.08237500000000001 -0.1522216796875 -0.2319929199218749 +0.0825 -0.186370849609375 -0.2319929199218749 +0.08262500000000001 -0.223602294921875 -0.2319929199218749 +0.08275 -0.254974365234375 -0.2319929199218749 +0.08287500000000001 -0.285125732421875 -0.2319929199218749 +0.08300000000000001 -0.313995361328125 -0.2319929199218749 +0.083125 -0.3370361328125 -0.2319929199218749 +0.08324999999999999 -0.3564453125 -0.2319929199218749 +0.083375 -0.37286376953125 -0.2319929199218749 +0.08350000000000001 -0.38421630859375 -0.2319929199218749 +0.08362500000000001 -0.39422607421875 -0.2319929199218749 +0.08375 -0.399566650390625 -0.2319929199218749 +0.08387500000000001 -0.398193359375 -0.2319929199218749 +0.084 -0.396026611328125 -0.2319929199218749 +0.08412500000000001 -0.386383056640625 -0.2319929199218749 +0.08425000000000001 -0.375701904296875 -0.2319929199218749 +0.084375 -0.362548828125 -0.2319929199218749 +0.08450000000000001 -0.341339111328125 -0.2319929199218749 +0.084625 -0.32171630859375 -0.2319929199218749 +0.08475 -0.29656982421875 -0.2319929199218749 +0.08487500000000001 -0.265960693359375 -0.2319929199218749 +0.085 -0.238128662109375 -0.2319929199218749 +0.08512500000000001 -0.2030029296875 -0.2319929199218749 +0.08525 -0.171295166015625 -0.2319929199218749 +0.085375 -0.13427734375 -0.2319929199218749 +0.08550000000000001 -0.094970703125 -0.2319929199218749 +0.085625 -0.059722900390625 -0.2319929199218749 +0.08575000000000001 -0.019805908203125 -0.2319929199218749 +0.08587500000000002 0.01580810546875 -0.2319929199218749 +0.08600000000000001 0.05523681640625 -0.2319929199218749 +0.08612500000000001 0.093231201171875 -0.2319929199218749 +0.08625 0.126983642578125 -0.2319929199218749 +0.08637499999999999 0.163177490234375 -0.2319929199218749 +0.0865 0.19244384765625 -0.2319929199218749 +0.08662500000000001 0.224578857421875 -0.2319929199218749 +0.08675000000000001 0.251861572265625 -0.2319929199218749 +0.08687500000000002 0.2760009765625 -0.2319929199218749 +0.08700000000000001 0.2999267578125 -0.2319929199218749 +0.087125 0.315582275390625 -0.2319929199218749 +0.08725000000000001 0.332916259765625 -0.2319929199218749 +0.08737500000000001 0.3431396484375 -0.2319929199218749 +0.08750000000000002 0.35211181640625 -0.2319929199218749 +0.08762500000000001 0.3583984375 -0.2319929199218749 +0.08775 0.357086181640625 -0.2319929199218749 +0.08787500000000001 0.355926513671875 -0.2319929199218749 +0.08799999999999999 0.350830078125 -0.2319929199218749 +0.088125 0.33941650390625 -0.2319929199218749 +0.08824999999999999 0.3272705078125 -0.2319929199218749 +0.08837499999999999 0.3099365234375 -0.2319929199218749 +0.0885 0.291290283203125 -0.2319929199218749 +0.08862500000000001 0.26947021484375 -0.2319929199218749 +0.08875 0.244659423828125 -0.2319929199218749 +0.08887499999999999 0.217742919921875 -0.2319929199218749 +0.08899999999999999 0.19146728515625 -0.2319929199218749 +0.089125 0.15850830078125 -0.2319929199218749 +0.08924999999999999 0.125946044921875 -0.2319929199218749 +0.089375 0.094390869140625 -0.2319929199218749 +0.08949999999999999 0.059906005859375 -0.2319929199218749 +0.089625 0.028289794921875 -0.2319929199218749 +0.08975 -0.00701904296875 -0.2319929199218749 +0.08987499999999999 -0.04193115234375 -0.2319929199218749 +0.09 -0.072113037109375 -0.2319929199218749 +0.09012499999999999 -0.10546875 -0.2319929199218749 +0.09025 -0.13446044921875 -0.2319929199218749 +0.090375 -0.163330078125 -0.2319929199218749 +0.09050000000000001 -0.1920166015625 -0.2319929199218749 +0.090625 -0.216033935546875 -0.2319929199218749 +0.09074999999999999 -0.237518310546875 -0.2319929199218749 +0.09087499999999999 -0.25701904296875 -0.2319929199218749 +0.091 -0.2725830078125 -0.2319929199218749 +0.09112500000000001 -0.288330078125 -0.2319929199218749 +0.09125 -0.299835205078125 -0.2319929199218749 +0.09137499999999999 -0.3055419921875 -0.2319929199218749 +0.0915 -0.31121826171875 -0.2319929199218749 +0.091625 -0.310272216796875 -0.2319929199218749 +0.09175000000000001 -0.3099365234375 -0.2319929199218749 +0.091875 -0.30670166015625 -0.2319929199218749 +0.09199999999999999 -0.29595947265625 -0.2319929199218749 +0.092125 -0.287200927734375 -0.2319929199218749 +0.09225 -0.274444580078125 -0.2319929199218749 +0.09237499999999999 -0.25518798828125 -0.2319929199218749 +0.0925 -0.23883056640625 -0.2319929199218749 +0.09262499999999999 -0.21514892578125 -0.2319929199218749 +0.09275 -0.19476318359375 -0.2319929199218749 +0.092875 -0.17010498046875 -0.2319929199218749 +0.09299999999999999 -0.141571044921875 -0.2319929199218749 +0.093125 -0.11669921875 -0.2319929199218749 +0.09324999999999999 -0.08660888671875 -0.2319929199218749 +0.093375 -0.060211181640625 -0.2319929199218749 +0.09350000000000001 -0.0302734375 -0.2319929199218749 0.09362500000000001 0.0 -0.2319929199218749 -0.09375 0.05364990234375 -0.2319929199218749 -0.09387499999999999 0.11273193359375 -0.2319929199218749 -0.09399999999999999 0.162384033203125 -0.2319929199218749 -0.094125 0.217742919921875 -0.2319929199218749 -0.09425000000000001 0.266510009765625 -0.2319929199218749 -0.094375 0.310943603515625 -0.2319929199218749 -0.09450000000000001 0.357086181640625 -0.2319929199218749 -0.094625 0.389068603515625 -0.2319929199218749 -0.09475 0.4267578125 -0.2319929199218749 -0.09487500000000001 0.45977783203125 -0.2319929199218749 -0.095 0.477325439453125 -0.2319929199218749 -0.09512500000000001 0.5001220703125 -0.2319929199218749 -0.09525 0.50738525390625 -0.2319929199218749 -0.095375 0.519439697265625 -0.2319929199218749 -0.09550000000000001 0.525787353515625 -0.2319929199218749 -0.095625 0.51763916015625 -0.2319929199218749 -0.09574999999999999 0.51312255859375 -0.2319929199218749 -0.095875 0.4954833984375 -0.2319929199218749 -0.096 0.480621337890625 0.02399926757812504 -0.09612500000000001 0.460479736328125 0.02399926757812504 -0.09625 0.430267333984375 0.02399926757812504 -0.09637499999999999 0.40130615234375 0.02399926757812504 -0.0965 0.364715576171875 0.02399926757812504 -0.09662500000000001 0.328399658203125 0.02399926757812504 -0.09675000000000001 0.2830810546875 0.02399926757812504 -0.096875 0.245147705078125 0.02399926757812504 -0.09699999999999999 0.1966552734375 0.02399926757812504 -0.097125 0.15533447265625 0.02399926757812504 -0.09725 0.105743408203125 0.02399926757812504 -0.09737500000000001 0.058013916015625 0.02399926757812504 -0.0975 0.01422119140625 0.02399926757812504 -0.09762500000000001 -0.033203125 0.02399926757812504 -0.09775 -0.075653076171875 0.02399926757812504 -0.097875 -0.1195068359375 0.02399926757812504 -0.09800000000000001 -0.163604736328125 0.02399926757812504 -0.098125 -0.197509765625 0.02399926757812504 -0.09825000000000001 -0.236968994140625 0.02399926757812504 -0.098375 -0.264404296875 0.02399926757812504 -0.09850000000000001 -0.297821044921875 0.02399926757812504 -0.09862500000000001 -0.3206787109375 0.02399926757812504 -0.09875 -0.344207763671875 0.02399926757812504 -0.09887499999999999 -0.358367919921875 0.02399926757812504 -0.099 -0.3748779296875 0.02399926757812504 -0.09912500000000001 -0.3892822265625 0.02399926757812504 -0.09925000000000001 -0.3900146484375 0.02399926757812504 -0.099375 -0.395294189453125 0.02399926757812504 -0.09950000000000001 -0.38739013671875 0.02399926757812504 -0.099625 -0.385284423828125 0.02399926757812504 -0.09975000000000001 -0.369476318359375 0.02399926757812504 -0.09987500000000001 -0.3592529296875 0.02399926757812504 -0.1 -0.3377685546875 0.02399926757812504 -0.100125 -0.320648193359375 0.02399926757812504 -0.10025 -0.294189453125 0.02399926757812504 -0.100375 -0.271209716796875 0.02399926757812504 -0.1005 -0.2452392578125 0.02399926757812504 -0.100625 -0.21356201171875 0.02399926757812504 -0.10075 -0.18359375 0.02399926757812504 -0.100875 -0.150543212890625 0.02399926757812504 -0.101 -0.118011474609375 0.02399926757812504 -0.101125 -0.08172607421875 0.02399926757812504 -0.10125 -0.0513916015625 0.02399926757812504 -0.101375 -0.016632080078125 0.02399926757812504 -0.1015 0.0133056640625 0.02399926757812504 -0.101625 0.045074462890625 0.02399926757812504 -0.10175 0.0767822265625 0.02399926757812504 -0.101875 0.101226806640625 0.02399926757812504 -0.102 0.130096435546875 0.02399926757812504 -0.102125 0.15484619140625 0.02399926757812504 -0.10225 0.1746826171875 0.02399926757812504 -0.102375 0.197784423828125 0.02399926757812504 -0.1025 0.209197998046875 0.02399926757812504 -0.102625 0.227325439453125 0.02399926757812504 -0.10275 0.232818603515625 0.02399926757812504 -0.102875 0.245574951171875 0.02399926757812504 -0.103 0.246063232421875 0.02399926757812504 -0.103125 0.25250244140625 0.02399926757812504 -0.10325 0.2469482421875 0.02399926757812504 -0.103375 0.24853515625 0.02399926757812504 -0.1035 0.24774169921875 0.02399926757812504 -0.103625 0.2342529296875 0.02399926757812504 -0.10375 0.22900390625 0.02399926757812504 -0.103875 0.21136474609375 0.02399926757812504 -0.104 0.202301025390625 0.02399926757812504 -0.104125 0.181610107421875 0.02399926757812504 -0.10425 0.167999267578125 0.02399926757812504 -0.104375 0.146942138671875 0.02399926757812504 -0.1045 0.130767822265625 0.02399926757812504 -0.104625 0.10931396484375 0.02399926757812504 -0.10475 0.091522216796875 0.02399926757812504 -0.104875 0.06890869140625 0.02399926757812504 -0.105 0.052215576171875 0.02399926757812504 -0.105125 0.033111572265625 0.02399926757812504 -0.10525 0.0147705078125 0.02399926757812504 -0.105375 -0.003662109375 0.02399926757812504 -0.1055 -0.020843505859375 0.02399926757812504 -0.105625 -0.03631591796875 0.02399926757812504 -0.10575 -0.049835205078125 0.02399926757812504 -0.105875 -0.063568115234375 0.02399926757812504 -0.106 -0.072967529296875 0.02399926757812504 -0.106125 -0.085784912109375 0.02399926757812504 -0.10625 -0.089691162109375 0.02399926757812504 -0.106375 -0.099822998046875 0.02399926757812504 -0.1065 -0.1080322265625 0.02399926757812504 -0.106625 -0.10711669921875 0.02399926757812504 -0.10675 -0.11334228515625 0.02399926757812504 -0.106875 -0.10809326171875 0.02399926757812504 -0.107 -0.111572265625 0.02399926757812504 -0.107125 -0.103363037109375 0.02399926757812504 -0.10725 -0.1043701171875 0.02399926757812504 -0.107375 -0.093841552734375 0.02399926757812504 -0.1075 -0.092864990234375 0.02399926757812504 -0.107625 -0.08074951171875 0.02399926757812504 -0.10775 -0.078338623046875 0.02399926757812504 -0.107875 -0.065521240234375 0.02399926757812504 -0.108 -0.061767578125 0.02399926757812504 -0.108125 -0.05780029296875 0.02399926757812504 -0.10825 -0.045257568359375 0.02399926757812504 -0.108375 -0.040985107421875 0.02399926757812504 -0.1085 -0.029815673828125 0.02399926757812504 -0.108625 -0.025146484375 0.02399926757812504 -0.10875 -0.016571044921875 0.02399926757812504 -0.108875 -0.012481689453125 0.02399926757812504 -0.109 -0.0064697265625 0.02399926757812504 -0.109125 -0.00323486328125 0.02399926757812504 +0.09375 0.026824951171875 -0.2319929199218749 +0.09387499999999999 0.056365966796875 -0.2319929199218749 +0.09399999999999999 0.0811767578125 -0.2319929199218749 +0.094125 0.108856201171875 -0.2319929199218749 +0.09425000000000001 0.13323974609375 -0.2319929199218749 +0.094375 0.15545654296875 -0.2319929199218749 +0.09450000000000001 0.17852783203125 -0.2319929199218749 +0.094625 0.19451904296875 -0.2319929199218749 +0.09475 0.21337890625 -0.2319929199218749 +0.09487500000000001 0.229888916015625 -0.2319929199218749 +0.095 0.2386474609375 -0.2319929199218749 +0.09512500000000001 0.25006103515625 -0.2319929199218749 +0.09525 0.253692626953125 -0.2319929199218749 +0.095375 0.25970458984375 -0.2319929199218749 +0.09550000000000001 0.26287841796875 -0.2319929199218749 +0.095625 0.258819580078125 -0.2319929199218749 +0.09574999999999999 0.256561279296875 -0.2319929199218749 +0.095875 0.24774169921875 -0.2319929199218749 +0.096 0.24029541015625 0.02399926757812504 +0.09612500000000001 0.230224609375 0.02399926757812504 +0.09625 0.215118408203125 0.02399926757812504 +0.09637499999999999 0.200653076171875 0.02399926757812504 +0.0965 0.182342529296875 0.02399926757812504 +0.09662500000000001 0.1641845703125 0.02399926757812504 +0.09675000000000001 0.14154052734375 0.02399926757812504 +0.096875 0.12255859375 0.02399926757812504 +0.09699999999999999 0.09832763671875 0.02399926757812504 +0.097125 0.077667236328125 0.02399926757812504 +0.09725 0.0528564453125 0.02399926757812504 +0.09737500000000001 0.02899169921875 0.02399926757812504 +0.0975 0.007110595703125 0.02399926757812504 +0.09762500000000001 -0.016632080078125 0.02399926757812504 +0.09775 -0.037841796875 0.02399926757812504 +0.097875 -0.059783935546875 0.02399926757812504 +0.09800000000000001 -0.081817626953125 0.02399926757812504 +0.098125 -0.098785400390625 0.02399926757812504 +0.09825000000000001 -0.118499755859375 0.02399926757812504 +0.098375 -0.132232666015625 0.02399926757812504 +0.09850000000000001 -0.14892578125 0.02399926757812504 +0.09862500000000001 -0.160369873046875 0.02399926757812504 +0.09875 -0.172119140625 0.02399926757812504 +0.09887499999999999 -0.17919921875 0.02399926757812504 +0.099 -0.187469482421875 0.02399926757812504 +0.09912500000000001 -0.194671630859375 0.02399926757812504 +0.09925000000000001 -0.195037841796875 0.02399926757812504 +0.099375 -0.197662353515625 0.02399926757812504 +0.09950000000000001 -0.1937255859375 0.02399926757812504 +0.099625 -0.192657470703125 0.02399926757812504 +0.09975000000000001 -0.18475341796875 0.02399926757812504 +0.09987500000000001 -0.179656982421875 0.02399926757812504 +0.1 -0.168914794921875 0.02399926757812504 +0.100125 -0.16033935546875 0.02399926757812504 +0.10025 -0.147125244140625 0.02399926757812504 +0.100375 -0.1356201171875 0.02399926757812504 +0.1005 -0.122650146484375 0.02399926757812504 +0.100625 -0.1068115234375 0.02399926757812504 +0.10075 -0.091827392578125 0.02399926757812504 +0.100875 -0.075286865234375 0.02399926757812504 +0.101 -0.05902099609375 0.02399926757812504 +0.101125 -0.0408935546875 0.02399926757812504 +0.10125 -0.025726318359375 0.02399926757812504 +0.101375 -0.008331298828125 0.02399926757812504 +0.1015 0.00665283203125 0.02399926757812504 +0.101625 0.02252197265625 0.02399926757812504 +0.10175 0.03839111328125 0.02399926757812504 +0.101875 0.05059814453125 0.02399926757812504 +0.102 0.065032958984375 0.02399926757812504 +0.102125 0.077423095703125 0.02399926757812504 +0.10225 0.08734130859375 0.02399926757812504 +0.102375 0.098876953125 0.02399926757812504 +0.1025 0.104583740234375 0.02399926757812504 +0.102625 0.1136474609375 0.02399926757812504 +0.10275 0.11639404296875 0.02399926757812504 +0.102875 0.122772216796875 0.02399926757812504 +0.103 0.123016357421875 0.02399926757812504 +0.103125 0.126251220703125 0.02399926757812504 +0.10325 0.12347412109375 0.02399926757812504 +0.103375 0.124267578125 0.02399926757812504 +0.1035 0.123870849609375 0.02399926757812504 +0.103625 0.11712646484375 0.02399926757812504 +0.10375 0.114501953125 0.02399926757812504 +0.103875 0.105682373046875 0.02399926757812504 +0.104 0.10113525390625 0.02399926757812504 +0.104125 0.090789794921875 0.02399926757812504 +0.10425 0.083984375 0.02399926757812504 +0.104375 0.073455810546875 0.02399926757812504 +0.1045 0.06536865234375 0.02399926757812504 +0.104625 0.054656982421875 0.02399926757812504 +0.10475 0.045745849609375 0.02399926757812504 +0.104875 0.034454345703125 0.02399926757812504 +0.105 0.026092529296875 0.02399926757812504 +0.105125 0.01654052734375 0.02399926757812504 +0.10525 0.00738525390625 0.02399926757812504 +0.105375 -0.001861572265625 0.02399926757812504 +0.1055 -0.01043701171875 0.02399926757812504 +0.105625 -0.0181884765625 0.02399926757812504 +0.10575 -0.024932861328125 0.02399926757812504 +0.105875 -0.03179931640625 0.02399926757812504 +0.106 -0.0364990234375 0.02399926757812504 +0.106125 -0.04290771484375 0.02399926757812504 +0.10625 -0.04486083984375 0.02399926757812504 +0.106375 -0.0499267578125 0.02399926757812504 +0.1065 -0.054046630859375 0.02399926757812504 +0.106625 -0.0535888671875 0.02399926757812504 +0.10675 -0.05670166015625 0.02399926757812504 +0.106875 -0.0540771484375 0.02399926757812504 +0.107 -0.055816650390625 0.02399926757812504 +0.107125 -0.05169677734375 0.02399926757812504 +0.10725 -0.052215576171875 0.02399926757812504 +0.107375 -0.04693603515625 0.02399926757812504 +0.1075 -0.04644775390625 0.02399926757812504 +0.107625 -0.0404052734375 0.02399926757812504 +0.10775 -0.0391845703125 0.02399926757812504 +0.107875 -0.03277587890625 0.02399926757812504 +0.108 -0.030914306640625 0.02399926757812504 +0.108125 -0.0289306640625 0.02399926757812504 +0.10825 -0.02264404296875 0.02399926757812504 +0.108375 -0.0205078125 0.02399926757812504 +0.1085 -0.014923095703125 0.02399926757812504 +0.108625 -0.012603759765625 0.02399926757812504 +0.10875 -0.00830078125 0.02399926757812504 +0.108875 -0.006256103515625 0.02399926757812504 +0.109 -0.003265380859375 0.02399926757812504 +0.109125 -0.00164794921875 0.02399926757812504 0.10925 0.0 0.02399926757812504 -0.109375 0.001922607421875 0.02399926757812504 -0.1095 0.00408935546875 0.02399926757812504 -0.109625 0.00299072265625 0.02399926757812504 -0.10975 0.003997802734375 0.02399926757812504 +0.109375 0.000946044921875 0.02399926757812504 +0.1095 0.002044677734375 0.02399926757812504 +0.109625 0.001495361328125 0.02399926757812504 +0.10975 0.001983642578125 0.02399926757812504 0.109875 0.0 0.02399926757812504 0.11 0.0 0.02399926757812504 -0.110125 -0.0067138671875 0.02399926757812504 -0.11025 -0.0074462890625 0.02399926757812504 -0.110375 -0.016357421875 0.02399926757812504 -0.1105 -0.01763916015625 0.02399926757812504 -0.110625 -0.027923583984375 0.02399926757812504 -0.11075 -0.029266357421875 0.02399926757812504 -0.110875 -0.03021240234375 0.02399926757812504 -0.111 -0.041229248046875 0.02399926757812504 -0.111125 -0.041748046875 0.02399926757812504 -0.11125 -0.05224609375 0.02399926757812504 -0.111375 -0.051788330078125 0.02399926757812504 -0.1115 -0.061065673828125 0.02399926757812504 -0.111625 -0.059234619140625 0.02399926757812504 -0.11175 -0.066192626953125 0.02399926757812504 -0.111875 -0.062957763671875 0.02399926757812504 -0.112 -0.067108154296875 0.02399926757812504 -0.112125 -0.062103271484375 0.02399926757812504 -0.11225 -0.062896728515625 0.02399926757812504 -0.112375 -0.05523681640625 0.02399926757812504 -0.1125 -0.0478515625 0.02399926757812504 -0.112625 -0.04345703125 0.02399926757812504 -0.11275 -0.034332275390625 0.02399926757812504 -0.112875 -0.02618408203125 0.02399926757812504 -0.113 -0.01434326171875 0.02399926757812504 -0.113125 -0.003875732421875 0.02399926757812504 -0.11325 0.009124755859375 0.02399926757812504 -0.113375 0.0225830078125 0.02399926757812504 -0.1135 0.03643798828125 0.02399926757812504 -0.113625 0.0537109375 0.02399926757812504 -0.11375 0.066253662109375 0.02399926757812504 -0.113875 0.079498291015625 0.02399926757812504 -0.114 0.09710693359375 0.02399926757812504 -0.114125 0.109375 0.02399926757812504 -0.11425 0.12841796875 0.02399926757812504 -0.114375 0.137847900390625 0.02399926757812504 -0.1145 0.156005859375 0.02399926757812504 -0.114625 0.163177490234375 0.02399926757812504 -0.11475 0.179290771484375 0.02399926757812504 -0.114875 0.1839599609375 0.02399926757812504 -0.115 0.196685791015625 0.02399926757812504 -0.115125 0.19757080078125 0.02399926757812504 -0.11525 0.206695556640625 0.02399926757812504 -0.115375 0.203277587890625 0.02399926757812504 -0.1155 0.197662353515625 0.02399926757812504 -0.115625 0.200103759765625 0.02399926757812504 -0.11575 0.189971923828125 0.02399926757812504 -0.115875 0.18743896484375 0.02399926757812504 -0.116 0.17279052734375 0.02399926757812504 -0.116125 0.163238525390625 0.02399926757812504 -0.11625 0.146148681640625 0.02399926757812504 -0.116375 0.1309814453125 0.02399926757812504 -0.1165 0.110504150390625 0.02399926757812504 -0.116625 0.09014892578125 0.02399926757812504 -0.11675 0.064300537109375 0.02399926757812504 -0.116875 0.040435791015625 0.02399926757812504 -0.117 0.014007568359375 0.02399926757812504 -0.117125 -0.011199951171875 0.02399926757812504 -0.11725 -0.04071044921875 0.02399926757812504 -0.117375 -0.069305419921875 0.02399926757812504 -0.1175 -0.09783935546875 0.02399926757812504 -0.117625 -0.125732421875 0.02399926757812504 -0.11775 -0.15484619140625 0.02399926757812504 -0.117875 -0.18072509765625 0.02399926757812504 -0.118 -0.211456298828125 0.02399926757812504 -0.118125 -0.231719970703125 0.02399926757812504 -0.11825 -0.251800537109375 0.02399926757812504 -0.118375 -0.276153564453125 0.02399926757812504 -0.1185 -0.29132080078125 0.02399926757812504 -0.118625 -0.31268310546875 0.02399926757812504 -0.11875 -0.320831298828125 0.02399926757812504 -0.118875 -0.336395263671875 0.02399926757812504 -0.119 -0.33856201171875 0.02399926757812504 -0.119125 -0.347259521484375 0.02399926757812504 -0.11925 -0.342315673828125 0.02399926757812504 -0.119375 -0.34405517578125 0.02399926757812504 -0.1195 -0.33172607421875 0.02399926757812504 -0.119625 -0.326141357421875 0.02399926757812504 -0.11975 -0.306549072265625 0.02399926757812504 -0.119875 -0.2835693359375 0.02399926757812504 -0.12 -0.26708984375 0.02399926757812504 -0.120125 -0.237701416015625 0.02399926757812504 -0.12025 -0.21435546875 0.02399926757812504 -0.120375 -0.179443359375 0.02399926757812504 -0.1205 -0.146148681640625 0.02399926757812504 -0.120625 -0.110748291015625 0.02399926757812504 -0.12075 -0.07196044921875 0.02399926757812504 -0.120875 -0.033966064453125 0.02399926757812504 -0.121 0.0086669921875 0.02399926757812504 -0.121125 0.0521240234375 0.02399926757812504 -0.12125 0.09075927734375 0.02399926757812504 -0.121375 0.1357421875 0.02399926757812504 -0.1215 0.173095703125 0.02399926757812504 -0.121625 0.217559814453125 0.02399926757812504 -0.12175 0.2557373046875 0.02399926757812504 -0.121875 0.293975830078125 0.02399926757812504 -0.122 0.32720947265625 0.02399926757812504 -0.122125 0.36151123046875 0.02399926757812504 -0.12225 0.388214111328125 0.02399926757812504 -0.122375 0.419097900390625 0.02399926757812504 -0.1225 0.435791015625 0.02399926757812504 -0.122625 0.458831787109375 0.02399926757812504 -0.12275 0.4674072265625 0.02399926757812504 -0.122875 0.4720458984375 0.02399926757812504 -0.123 0.480712890625 0.02399926757812504 -0.123125 0.4757080078125 0.02399926757812504 -0.12325 0.474090576171875 0.02399926757812504 -0.123375 0.46002197265625 0.02399926757812504 -0.1235 0.44775390625 0.02399926757812504 -0.123625 0.422088623046875 0.02399926757812504 -0.12375 0.402130126953125 0.02399926757812504 -0.123875 0.3673095703125 0.02399926757812504 -0.124 0.338409423828125 0.02399926757812504 -0.124125 0.295562744140625 0.02399926757812504 -0.12425 0.249481201171875 0.02399926757812504 -0.124375 0.209197998046875 0.02399926757812504 -0.1245 0.157501220703125 0.02399926757812504 -0.124625 0.111328125 0.02399926757812504 -0.12475 0.05596923828125 0.02399926757812504 +0.110125 -0.003387451171875 0.02399926757812504 +0.11025 -0.003753662109375 0.02399926757812504 +0.110375 -0.008209228515625 0.02399926757812504 +0.1105 -0.00885009765625 0.02399926757812504 +0.110625 -0.01397705078125 0.02399926757812504 +0.11075 -0.0146484375 0.02399926757812504 +0.110875 -0.01513671875 0.02399926757812504 +0.111 -0.0206298828125 0.02399926757812504 +0.111125 -0.020904541015625 0.02399926757812504 +0.11125 -0.026153564453125 0.02399926757812504 +0.111375 -0.025909423828125 0.02399926757812504 +0.1115 -0.030548095703125 0.02399926757812504 +0.111625 -0.029632568359375 0.02399926757812504 +0.11175 -0.033111572265625 0.02399926757812504 +0.111875 -0.031494140625 0.02399926757812504 +0.112 -0.0335693359375 0.02399926757812504 +0.112125 -0.03106689453125 0.02399926757812504 +0.11225 -0.031463623046875 0.02399926757812504 +0.112375 -0.02764892578125 0.02399926757812504 +0.1125 -0.023956298828125 0.02399926757812504 +0.112625 -0.021759033203125 0.02399926757812504 +0.11275 -0.017181396484375 0.02399926757812504 +0.112875 -0.01312255859375 0.02399926757812504 +0.113 -0.0072021484375 0.02399926757812504 +0.113125 -0.001953125 0.02399926757812504 +0.11325 0.004547119140625 0.02399926757812504 +0.113375 0.01129150390625 0.02399926757812504 +0.1135 0.018218994140625 0.02399926757812504 +0.113625 0.02685546875 0.02399926757812504 +0.11375 0.033111572265625 0.02399926757812504 +0.113875 0.03973388671875 0.02399926757812504 +0.114 0.048553466796875 0.02399926757812504 +0.114125 0.0546875 0.02399926757812504 +0.11425 0.064208984375 0.02399926757812504 +0.114375 0.06890869140625 0.02399926757812504 +0.1145 0.0780029296875 0.02399926757812504 +0.114625 0.081573486328125 0.02399926757812504 +0.11475 0.089630126953125 0.02399926757812504 +0.114875 0.09197998046875 0.02399926757812504 +0.115 0.09832763671875 0.02399926757812504 +0.115125 0.098785400390625 0.02399926757812504 +0.11525 0.10333251953125 0.02399926757812504 +0.115375 0.10162353515625 0.02399926757812504 +0.1155 0.09881591796875 0.02399926757812504 +0.115625 0.10003662109375 0.02399926757812504 +0.11575 0.094970703125 0.02399926757812504 +0.115875 0.093719482421875 0.02399926757812504 +0.116 0.086395263671875 0.02399926757812504 +0.116125 0.08160400390625 0.02399926757812504 +0.11625 0.07305908203125 0.02399926757812504 +0.116375 0.06549072265625 0.02399926757812504 +0.1165 0.05523681640625 0.02399926757812504 +0.116625 0.045074462890625 0.02399926757812504 +0.11675 0.032135009765625 0.02399926757812504 +0.116875 0.02020263671875 0.02399926757812504 +0.117 0.006988525390625 0.02399926757812504 +0.117125 -0.005615234375 0.02399926757812504 +0.11725 -0.0203857421875 0.02399926757812504 +0.117375 -0.03466796875 0.02399926757812504 +0.1175 -0.0489501953125 0.02399926757812504 +0.117625 -0.062896728515625 0.02399926757812504 +0.11775 -0.07745361328125 0.02399926757812504 +0.117875 -0.09039306640625 0.02399926757812504 +0.118 -0.105743408203125 0.02399926757812504 +0.118125 -0.115875244140625 0.02399926757812504 +0.11825 -0.12591552734375 0.02399926757812504 +0.118375 -0.138092041015625 0.02399926757812504 +0.1185 -0.14569091796875 0.02399926757812504 +0.118625 -0.1563720703125 0.02399926757812504 +0.11875 -0.160430908203125 0.02399926757812504 +0.118875 -0.168212890625 0.02399926757812504 +0.119 -0.1693115234375 0.02399926757812504 +0.119125 -0.17364501953125 0.02399926757812504 +0.11925 -0.171173095703125 0.02399926757812504 +0.119375 -0.17205810546875 0.02399926757812504 +0.1195 -0.1658935546875 0.02399926757812504 +0.119625 -0.1630859375 0.02399926757812504 +0.11975 -0.153289794921875 0.02399926757812504 +0.119875 -0.141815185546875 0.02399926757812504 +0.12 -0.133575439453125 0.02399926757812504 +0.120125 -0.118865966796875 0.02399926757812504 +0.12025 -0.107208251953125 0.02399926757812504 +0.120375 -0.089752197265625 0.02399926757812504 +0.1205 -0.073089599609375 0.02399926757812504 +0.120625 -0.055389404296875 0.02399926757812504 +0.12075 -0.0360107421875 0.02399926757812504 +0.120875 -0.016998291015625 0.02399926757812504 +0.121 0.00433349609375 0.02399926757812504 +0.121125 0.02606201171875 0.02399926757812504 +0.12125 0.045379638671875 0.02399926757812504 +0.121375 0.06787109375 0.02399926757812504 +0.1215 0.0865478515625 0.02399926757812504 +0.121625 0.1087646484375 0.02399926757812504 +0.12175 0.12786865234375 0.02399926757812504 +0.121875 0.14697265625 0.02399926757812504 +0.122 0.163604736328125 0.02399926757812504 +0.122125 0.180755615234375 0.02399926757812504 +0.12225 0.194091796875 0.02399926757812504 +0.122375 0.20953369140625 0.02399926757812504 +0.1225 0.2178955078125 0.02399926757812504 +0.122625 0.229400634765625 0.02399926757812504 +0.12275 0.23370361328125 0.02399926757812504 +0.122875 0.23602294921875 0.02399926757812504 +0.123 0.2403564453125 0.02399926757812504 +0.123125 0.23785400390625 0.02399926757812504 +0.12325 0.237030029296875 0.02399926757812504 +0.123375 0.230010986328125 0.02399926757812504 +0.1235 0.223876953125 0.02399926757812504 +0.123625 0.211029052734375 0.02399926757812504 +0.12375 0.2010498046875 0.02399926757812504 +0.123875 0.18365478515625 0.02399926757812504 +0.124 0.169189453125 0.02399926757812504 +0.124125 0.14776611328125 0.02399926757812504 +0.12425 0.124725341796875 0.02399926757812504 +0.124375 0.104583740234375 0.02399926757812504 +0.1245 0.0787353515625 0.02399926757812504 +0.124625 0.0556640625 0.02399926757812504 +0.12475 0.027984619140625 0.02399926757812504 0.124875 0.0 0.02399926757812504 -0.125 -0.05120849609375 0.02399926757812504 -0.125125 -0.10931396484375 0.02399926757812504 -0.12525 -0.159881591796875 0.02399926757812504 -0.125375 -0.217742919921875 0.02399926757812504 -0.1255 -0.27069091796875 0.02399926757812504 -0.125625 -0.31585693359375 0.02399926757812504 -0.12575 -0.3682861328125 0.02399926757812504 -0.125875 -0.407684326171875 0.02399926757812504 -0.126 -0.453887939453125 0.02399926757812504 -0.126125 -0.489013671875 0.02399926757812504 -0.12625 -0.523590087890625 0.02399926757812504 -0.126375 -0.548583984375 0.02399926757812504 -0.1265 -0.574127197265625 0.02399926757812504 -0.126625 -0.587738037109375 0.02399926757812504 -0.12675 -0.603271484375 0.02399926757812504 -0.126875 -0.604156494140625 0.02399926757812504 -0.127 -0.60711669921875 0.02399926757812504 -0.127125 -0.596588134765625 0.02399926757812504 -0.12725 -0.578704833984375 0.02399926757812504 -0.127375 -0.561920166015625 0.02399926757812504 -0.1275 -0.534515380859375 0.02399926757812504 -0.127625 -0.505096435546875 0.02399926757812504 -0.12775 -0.467559814453125 0.02399926757812504 -0.127875 -0.426422119140625 0.02399926757812504 -0.128 -0.37457275390625 0.2799914550781251 -0.128125 -0.328460693359375 0.2799914550781251 -0.12825 -0.26861572265625 0.2799914550781251 -0.128375 -0.214813232421875 0.2799914550781251 -0.1285 -0.149139404296875 0.2799914550781251 -0.128625 -0.08282470703125 0.2799914550781251 -0.12875 -0.020965576171875 0.2799914550781251 -0.128875 0.0489501953125 0.2799914550781251 -0.129 0.112823486328125 0.2799914550781251 -0.129125 0.18194580078125 0.2799914550781251 -0.12925 0.251922607421875 0.2799914550781251 -0.129375 0.310699462890625 0.2799914550781251 -0.1295 0.37689208984375 0.2799914550781251 -0.129625 0.429840087890625 0.2799914550781251 -0.12975 0.489410400390625 0.2799914550781251 -0.129875 0.538970947265625 0.2799914550781251 -0.13 0.584686279296875 0.2799914550781251 -0.130125 0.629547119140625 0.2799914550781251 -0.13025 0.65850830078125 0.2799914550781251 -0.130375 0.6907958984375 0.2799914550781251 -0.1305 0.70880126953125 0.2799914550781251 -0.130625 0.7255859375 0.2799914550781251 -0.13075 0.728790283203125 0.2799914550781251 -0.130875 0.731903076171875 0.2799914550781251 -0.131 0.7198486328125 0.2799914550781251 -0.131125 0.706634521484375 0.2799914550781251 -0.13125 0.681884765625 0.2799914550781251 -0.131375 0.653350830078125 0.2799914550781251 -0.1315 0.6214599609375 0.2799914550781251 -0.131625 0.572906494140625 0.2799914550781251 -0.13175 0.522735595703125 0.2799914550781251 -0.131875 0.468048095703125 0.2799914550781251 -0.132 0.40594482421875 0.2799914550781251 -0.132125 0.342529296875 0.2799914550781251 -0.13225 0.27081298828125 0.2799914550781251 -0.132375 0.19317626953125 0.2799914550781251 -0.1325 0.122528076171875 0.2799914550781251 -0.132625 0.041290283203125 0.2799914550781251 -0.13275 -0.033050537109375 0.2799914550781251 -0.132875 -0.11627197265625 0.2799914550781251 -0.133 -0.197998046875 0.2799914550781251 -0.133125 -0.2718505859375 0.2799914550781251 -0.13325 -0.349334716796875 0.2799914550781251 -0.133375 -0.41900634765625 0.2799914550781251 -0.1335 -0.489044189453125 0.2799914550781251 -0.133625 -0.557861328125 0.2799914550781251 -0.13375 -0.611297607421875 0.2799914550781251 -0.133875 -0.669189453125 0.2799914550781251 -0.134 -0.71612548828125 0.2799914550781251 -0.134125 -0.75543212890625 0.2799914550781251 -0.13425 -0.792022705078125 0.2799914550781251 -0.134375 -0.812713623046875 0.2799914550781251 -0.1345 -0.83294677734375 0.2799914550781251 -0.134625 -0.83831787109375 0.2799914550781251 -0.13475 -0.84124755859375 0.2799914550781251 -0.134875 -0.8292236328125 0.2799914550781251 -0.135 -0.81597900390625 0.2799914550781251 -0.135125 -0.7867431640625 0.2799914550781251 -0.13525 -0.75787353515625 0.2799914550781251 -0.135375 -0.716766357421875 0.2799914550781251 -0.1355 -0.663055419921875 0.2799914550781251 -0.135625 -0.61224365234375 0.2799914550781251 -0.13575 -0.54486083984375 0.2799914550781251 -0.135875 -0.482025146484375 0.2799914550781251 -0.136 -0.403533935546875 0.2799914550781251 -0.136125 -0.322509765625 0.2799914550781251 -0.13625 -0.244384765625 0.2799914550781251 -0.136375 -0.156005859375 0.2799914550781251 -0.1365 -0.07366943359375 0.2799914550781251 -0.136625 0.01849365234375 0.2799914550781251 -0.13675 0.111602783203125 0.2799914550781251 -0.136875 0.19427490234375 0.2799914550781251 -0.137 0.285614013671875 0.2799914550781251 -0.137125 0.364227294921875 0.2799914550781251 -0.13725 0.4500732421875 0.2799914550781251 -0.137375 0.529052734375 0.2799914550781251 -0.1375 0.598236083984375 0.2799914550781251 -0.137625 0.6658935546875 0.2799914550781251 -0.13775 0.72406005859375 0.2799914550781251 -0.137875 0.777557373046875 0.2799914550781251 -0.138 0.826446533203125 0.2799914550781251 -0.138125 0.85455322265625 0.2799914550781251 -0.13825 0.854827880859375 0.2799914550781251 -0.138375 0.855010986328125 0.2799914550781251 -0.1385 0.8551025390625 0.2799914550781251 -0.138625 0.855133056640625 0.2799914550781251 -0.13875 0.85504150390625 0.2799914550781251 -0.138875 0.854888916015625 0.2799914550781251 -0.139 0.854644775390625 0.2799914550781251 -0.139125 0.8360595703125 0.2799914550781251 -0.13925 0.788116455078125 0.2799914550781251 -0.139375 0.740447998046875 0.2799914550781251 -0.1395 0.678924560546875 0.2799914550781251 -0.139625 0.614654541015625 0.2799914550781251 -0.13975 0.538848876953125 0.2799914550781251 -0.139875 0.454864501953125 0.2799914550781251 -0.14 0.376312255859375 0.2799914550781251 -0.140125 0.2833251953125 0.2799914550781251 -0.14025 0.197662353515625 0.2799914550781251 -0.140375 0.099365234375 0.2799914550781251 +0.125 -0.025634765625 0.02399926757812504 +0.125125 -0.0546875 0.02399926757812504 +0.12525 -0.0799560546875 0.02399926757812504 +0.125375 -0.10888671875 0.02399926757812504 +0.1255 -0.1353759765625 0.02399926757812504 +0.125625 -0.157958984375 0.02399926757812504 +0.12575 -0.184173583984375 0.02399926757812504 +0.125875 -0.203857421875 0.02399926757812504 +0.126 -0.226959228515625 0.02399926757812504 +0.126125 -0.244537353515625 0.02399926757812504 +0.12625 -0.261810302734375 0.02399926757812504 +0.126375 -0.274322509765625 0.02399926757812504 +0.1265 -0.287078857421875 0.02399926757812504 +0.126625 -0.29388427734375 0.02399926757812504 +0.12675 -0.301666259765625 0.02399926757812504 +0.126875 -0.302093505859375 0.02399926757812504 +0.127 -0.3035888671875 0.02399926757812504 +0.127125 -0.298309326171875 0.02399926757812504 +0.12725 -0.28936767578125 0.02399926757812504 +0.127375 -0.280975341796875 0.02399926757812504 +0.1275 -0.26727294921875 0.02399926757812504 +0.127625 -0.2525634765625 0.02399926757812504 +0.12775 -0.233795166015625 0.02399926757812504 +0.127875 -0.213226318359375 0.02399926757812504 +0.128 -0.18731689453125 0.2799914550781251 +0.128125 -0.16424560546875 0.2799914550781251 +0.12825 -0.13433837890625 0.2799914550781251 +0.128375 -0.107421875 0.2799914550781251 +0.1285 -0.0745849609375 0.2799914550781251 +0.128625 -0.04144287109375 0.2799914550781251 +0.12875 -0.010498046875 0.2799914550781251 +0.128875 0.02447509765625 0.2799914550781251 +0.129 0.056396484375 0.2799914550781251 +0.129125 0.090972900390625 0.2799914550781251 +0.12925 0.125946044921875 0.2799914550781251 +0.129375 0.15533447265625 0.2799914550781251 +0.1295 0.188446044921875 0.2799914550781251 +0.129625 0.21490478515625 0.2799914550781251 +0.12975 0.24468994140625 0.2799914550781251 +0.129875 0.26947021484375 0.2799914550781251 +0.13 0.292327880859375 0.2799914550781251 +0.130125 0.31475830078125 0.2799914550781251 +0.13025 0.329254150390625 0.2799914550781251 +0.130375 0.34539794921875 0.2799914550781251 +0.1305 0.354400634765625 0.2799914550781251 +0.130625 0.36279296875 0.2799914550781251 +0.13075 0.3643798828125 0.2799914550781251 +0.130875 0.365936279296875 0.2799914550781251 +0.131 0.35992431640625 0.2799914550781251 +0.131125 0.353302001953125 0.2799914550781251 +0.13125 0.3409423828125 0.2799914550781251 +0.131375 0.32666015625 0.2799914550781251 +0.1315 0.31072998046875 0.2799914550781251 +0.131625 0.28643798828125 0.2799914550781251 +0.13175 0.2613525390625 0.2799914550781251 +0.131875 0.2340087890625 0.2799914550781251 +0.132 0.202972412109375 0.2799914550781251 +0.132125 0.1712646484375 0.2799914550781251 +0.13225 0.135406494140625 0.2799914550781251 +0.132375 0.096588134765625 0.2799914550781251 +0.1325 0.061248779296875 0.2799914550781251 +0.132625 0.0206298828125 0.2799914550781251 +0.13275 -0.01654052734375 0.2799914550781251 +0.132875 -0.05816650390625 0.2799914550781251 +0.133 -0.099029541015625 0.2799914550781251 +0.133125 -0.135955810546875 0.2799914550781251 +0.13325 -0.1746826171875 0.2799914550781251 +0.133375 -0.20953369140625 0.2799914550781251 +0.1335 -0.244537353515625 0.2799914550781251 +0.133625 -0.278961181640625 0.2799914550781251 +0.13375 -0.3056640625 0.2799914550781251 +0.133875 -0.334625244140625 0.2799914550781251 +0.134 -0.35809326171875 0.2799914550781251 +0.134125 -0.37774658203125 0.2799914550781251 +0.13425 -0.396026611328125 0.2799914550781251 +0.134375 -0.4063720703125 0.2799914550781251 +0.1345 -0.41650390625 0.2799914550781251 +0.134625 -0.419189453125 0.2799914550781251 +0.13475 -0.420654296875 0.2799914550781251 +0.134875 -0.414642333984375 0.2799914550781251 +0.135 -0.40802001953125 0.2799914550781251 +0.135125 -0.393402099609375 0.2799914550781251 +0.13525 -0.37896728515625 0.2799914550781251 +0.135375 -0.3583984375 0.2799914550781251 +0.1355 -0.33154296875 0.2799914550781251 +0.135625 -0.30615234375 0.2799914550781251 +0.13575 -0.2724609375 0.2799914550781251 +0.135875 -0.24102783203125 0.2799914550781251 +0.136 -0.2017822265625 0.2799914550781251 +0.136125 -0.161285400390625 0.2799914550781251 +0.13625 -0.122222900390625 0.2799914550781251 +0.136375 -0.078033447265625 0.2799914550781251 +0.1365 -0.036865234375 0.2799914550781251 +0.136625 0.009246826171875 0.2799914550781251 +0.13675 0.0557861328125 0.2799914550781251 +0.136875 0.097137451171875 0.2799914550781251 +0.137 0.142791748046875 0.2799914550781251 +0.137125 0.182098388671875 0.2799914550781251 +0.13725 0.22503662109375 0.2799914550781251 +0.137375 0.2645263671875 0.2799914550781251 +0.1375 0.299102783203125 0.2799914550781251 +0.137625 0.33294677734375 0.2799914550781251 +0.13775 0.362030029296875 0.2799914550781251 +0.137875 0.388763427734375 0.2799914550781251 +0.138 0.4132080078125 0.2799914550781251 +0.138125 0.431671142578125 0.2799914550781251 +0.13825 0.445556640625 0.2799914550781251 +0.138375 0.455902099609375 0.2799914550781251 +0.1385 0.46044921875 0.2799914550781251 +0.138625 0.461944580078125 0.2799914550781251 +0.13875 0.4571533203125 0.2799914550781251 +0.138875 0.448944091796875 0.2799914550781251 +0.139 0.435638427734375 0.2799914550781251 +0.139125 0.41802978515625 0.2799914550781251 +0.13925 0.39404296875 0.2799914550781251 +0.139375 0.370208740234375 0.2799914550781251 +0.1395 0.339447021484375 0.2799914550781251 +0.139625 0.30731201171875 0.2799914550781251 +0.13975 0.2694091796875 0.2799914550781251 +0.139875 0.2274169921875 0.2799914550781251 +0.14 0.188140869140625 0.2799914550781251 +0.140125 0.14166259765625 0.2799914550781251 +0.14025 0.09881591796875 0.2799914550781251 +0.140375 0.0496826171875 0.2799914550781251 0.1405 0.0 0.2799914550781251 -0.140625 -0.0897216796875 0.2799914550781251 -0.14075 -0.18914794921875 0.2799914550781251 -0.140875 -0.2774658203125 0.2799914550781251 -0.141 -0.372039794921875 0.2799914550781251 -0.141125 -0.463897705078125 0.2799914550781251 -0.14125 -0.541229248046875 0.2799914550781251 -0.141375 -0.623321533203125 0.2799914550781251 -0.1415 -0.69000244140625 0.2799914550781251 -0.141625 -0.758941650390625 0.2799914550781251 -0.14175 -0.817657470703125 0.2799914550781251 -0.141875 -0.8546142578125 0.2799914550781251 -0.142 -0.855010986328125 0.2799914550781251 -0.142125 -0.85528564453125 0.2799914550781251 -0.14225 -0.85552978515625 0.2799914550781251 -0.142375 -0.85565185546875 0.2799914550781251 -0.1425 -0.855682373046875 0.2799914550781251 -0.142625 -0.8555908203125 0.2799914550781251 -0.14275 -0.85546875 0.2799914550781251 -0.142875 -0.855194091796875 0.2799914550781251 -0.143 -0.854827880859375 0.2799914550781251 -0.143125 -0.8453369140625 0.2799914550781251 -0.14325 -0.78997802734375 0.2799914550781251 -0.143375 -0.73260498046875 0.2799914550781251 -0.1435 -0.659637451171875 0.2799914550781251 -0.143625 -0.58038330078125 0.2799914550781251 -0.14375 -0.50262451171875 0.2799914550781251 -0.143875 -0.4117431640625 0.2799914550781251 -0.144 -0.325225830078125 0.2799914550781251 -0.144125 -0.226165771484375 0.2799914550781251 -0.14425 -0.12408447265625 0.2799914550781251 -0.144375 -0.031097412109375 0.2799914550781251 -0.1445 0.07257080078125 0.2799914550781251 -0.144625 0.16558837890625 0.2799914550781251 -0.14475 0.267364501953125 0.2799914550781251 -0.144875 0.36602783203125 0.2799914550781251 -0.145 0.451873779296875 0.2799914550781251 -0.145125 0.542083740234375 0.2799914550781251 -0.14525 0.61883544921875 0.2799914550781251 -0.145375 0.697052001953125 0.2799914550781251 -0.1455 0.768310546875 0.2799914550781251 -0.145625 0.82470703125 0.2799914550781251 -0.14575 0.854705810546875 0.2799914550781251 -0.145875 0.8551025390625 0.2799914550781251 -0.146 0.855438232421875 0.2799914550781251 -0.146125 0.855682373046875 0.2799914550781251 -0.14625 0.855804443359375 0.2799914550781251 -0.146375 0.855865478515625 0.2799914550781251 -0.1465 0.855804443359375 0.2799914550781251 -0.146625 0.85565185546875 0.2799914550781251 -0.14675 0.855377197265625 0.2799914550781251 -0.146875 0.855072021484375 0.2799914550781251 -0.147 0.854644775390625 0.2799914550781251 -0.147125 0.821014404296875 0.2799914550781251 -0.14725 0.756866455078125 0.2799914550781251 -0.147375 0.684356689453125 0.2799914550781251 -0.1475 0.612640380859375 0.2799914550781251 -0.147625 0.526702880859375 0.2799914550781251 -0.14775 0.444305419921875 0.2799914550781251 -0.147875 0.348297119140625 0.2799914550781251 -0.148 0.248382568359375 0.2799914550781251 -0.148125 0.156219482421875 0.2799914550781251 -0.14825 0.05218505859375 0.2799914550781251 -0.148375 -0.041778564453125 0.2799914550781251 -0.1485 -0.145721435546875 0.2799914550781251 -0.148625 -0.24810791015625 0.2799914550781251 -0.14875 -0.337738037109375 0.2799914550781251 -0.148875 -0.433624267578125 0.2799914550781251 -0.149 -0.516082763671875 0.2799914550781251 -0.149125 -0.601776123046875 0.2799914550781251 -0.14925 -0.681365966796875 0.2799914550781251 -0.149375 -0.745849609375 0.2799914550781251 -0.1495 -0.810516357421875 0.2799914550781251 -0.149625 -0.85455322265625 0.2799914550781251 -0.14975 -0.855010986328125 0.2799914550781251 -0.149875 -0.8553466796875 0.2799914550781251 -0.15 -0.8555908203125 0.2799914550781251 -0.150125 -0.855743408203125 0.2799914550781251 -0.15025 -0.85577392578125 0.2799914550781251 -0.150375 -0.855743408203125 0.2799914550781251 -0.1505 -0.8555908203125 0.2799914550781251 -0.150625 -0.85540771484375 0.2799914550781251 -0.15075 -0.855072021484375 0.2799914550781251 -0.150875 -0.85467529296875 0.2799914550781251 -0.151 -0.819610595703125 0.2799914550781251 -0.151125 -0.758209228515625 0.2799914550781251 -0.15125 -0.694427490234375 0.2799914550781251 -0.151375 -0.618011474609375 0.2799914550781251 -0.1515 -0.542327880859375 0.2799914550781251 -0.151625 -0.45306396484375 0.2799914550781251 -0.15175 -0.3599853515625 0.2799914550781251 -0.151875 -0.272186279296875 0.2799914550781251 -0.152 -0.1727294921875 0.2799914550781251 -0.152125 -0.081390380859375 0.2799914550781251 -0.15225 0.02032470703125 0.2799914550781251 -0.152375 0.12164306640625 0.2799914550781251 -0.1525 0.211761474609375 0.2799914550781251 -0.152625 0.308868408203125 0.2799914550781251 -0.15275 0.392791748046875 0.2799914550781251 -0.152875 0.482879638671875 0.2799914550781251 -0.153 0.56597900390625 0.2799914550781251 -0.153125 0.636810302734375 0.2799914550781251 -0.15325 0.706695556640625 0.2799914550781251 -0.153375 0.764739990234375 0.2799914550781251 -0.1535 0.818695068359375 0.2799914550781251 -0.153625 0.854583740234375 0.2799914550781251 -0.15375 0.854888916015625 0.2799914550781251 -0.153875 0.85516357421875 0.2799914550781251 -0.154 0.85528564453125 0.2799914550781251 -0.154125 0.8553466796875 0.2799914550781251 -0.15425 0.8553466796875 0.2799914550781251 -0.154375 0.855224609375 0.2799914550781251 -0.1545 0.855010986328125 0.2799914550781251 -0.154625 0.854736328125 0.2799914550781251 -0.15475 0.84259033203125 0.2799914550781251 -0.154875 0.791229248046875 0.2799914550781251 -0.155 0.740447998046875 0.2799914550781251 -0.155125 0.673675537109375 0.2799914550781251 -0.15525 0.60986328125 0.2799914550781251 -0.155375 0.530487060546875 0.2799914550781251 -0.1555 0.445953369140625 0.2799914550781251 -0.155625 0.36761474609375 0.2799914550781251 -0.15575 0.27557373046875 0.2799914550781251 -0.155875 0.19158935546875 0.2799914550781251 -0.156 0.09588623046875 0.2799914550781251 +0.140625 -0.044891357421875 0.2799914550781251 +0.14075 -0.0946044921875 0.2799914550781251 +0.140875 -0.138763427734375 0.2799914550781251 +0.141 -0.18603515625 0.2799914550781251 +0.141125 -0.231964111328125 0.2799914550781251 +0.14125 -0.2706298828125 0.2799914550781251 +0.141375 -0.311676025390625 0.2799914550781251 +0.1415 -0.34503173828125 0.2799914550781251 +0.141625 -0.379486083984375 0.2799914550781251 +0.14175 -0.408843994140625 0.2799914550781251 +0.141875 -0.432586669921875 0.2799914550781251 +0.142 -0.4532470703125 0.2799914550781251 +0.142125 -0.468780517578125 0.2799914550781251 +0.14225 -0.4810791015625 0.2799914550781251 +0.142375 -0.4869384765625 0.2799914550781251 +0.1425 -0.48876953125 0.2799914550781251 +0.142625 -0.484466552734375 0.2799914550781251 +0.14275 -0.477142333984375 0.2799914550781251 +0.142875 -0.46282958984375 0.2799914550781251 +0.143 -0.4443359375 0.2799914550781251 +0.143125 -0.422698974609375 0.2799914550781251 +0.14325 -0.39501953125 0.2799914550781251 +0.143375 -0.3663330078125 0.2799914550781251 +0.1435 -0.329833984375 0.2799914550781251 +0.143625 -0.29022216796875 0.2799914550781251 +0.14375 -0.2513427734375 0.2799914550781251 +0.143875 -0.205902099609375 0.2799914550781251 +0.144 -0.162628173828125 0.2799914550781251 +0.144125 -0.11309814453125 0.2799914550781251 +0.14425 -0.06207275390625 0.2799914550781251 +0.144375 -0.01556396484375 0.2799914550781251 +0.1445 0.036285400390625 0.2799914550781251 +0.144625 0.082794189453125 0.2799914550781251 +0.14475 0.1336669921875 0.2799914550781251 +0.144875 0.183013916015625 0.2799914550781251 +0.145 0.225921630859375 0.2799914550781251 +0.145125 0.271026611328125 0.2799914550781251 +0.14525 0.309417724609375 0.2799914550781251 +0.145375 0.3485107421875 0.2799914550781251 +0.1455 0.3841552734375 0.2799914550781251 +0.145625 0.412353515625 0.2799914550781251 +0.14575 0.439697265625 0.2799914550781251 +0.145875 0.459930419921875 0.2799914550781251 +0.146 0.4779052734375 0.2799914550781251 +0.146125 0.490631103515625 0.2799914550781251 +0.14625 0.49725341796875 0.2799914550781251 +0.146375 0.4996337890625 0.2799914550781251 +0.1465 0.496917724609375 0.2799914550781251 +0.146625 0.488861083984375 0.2799914550781251 +0.14675 0.475341796875 0.2799914550781251 +0.146875 0.458770751953125 0.2799914550781251 +0.147 0.435516357421875 0.2799914550781251 +0.147125 0.410491943359375 0.2799914550781251 +0.14725 0.37841796875 0.2799914550781251 +0.147375 0.3421630859375 0.2799914550781251 +0.1475 0.306304931640625 0.2799914550781251 +0.147625 0.263336181640625 0.2799914550781251 +0.14775 0.222137451171875 0.2799914550781251 +0.147875 0.17413330078125 0.2799914550781251 +0.148 0.124176025390625 0.2799914550781251 +0.148125 0.078094482421875 0.2799914550781251 +0.14825 0.026092529296875 0.2799914550781251 +0.148375 -0.020904541015625 0.2799914550781251 +0.1485 -0.0728759765625 0.2799914550781251 +0.148625 -0.12408447265625 0.2799914550781251 +0.14875 -0.16888427734375 0.2799914550781251 +0.148875 -0.216827392578125 0.2799914550781251 +0.149 -0.258056640625 0.2799914550781251 +0.149125 -0.3009033203125 0.2799914550781251 +0.14925 -0.3406982421875 0.2799914550781251 +0.149375 -0.372955322265625 0.2799914550781251 +0.1495 -0.4052734375 0.2799914550781251 +0.149625 -0.430084228515625 0.2799914550781251 +0.14975 -0.45367431640625 0.2799914550781251 +0.149875 -0.471710205078125 0.2799914550781251 +0.15 -0.484039306640625 0.2799914550781251 +0.150125 -0.492034912109375 0.2799914550781251 +0.15025 -0.494476318359375 0.2799914550781251 +0.150375 -0.49285888671875 0.2799914550781251 +0.1505 -0.48504638671875 0.2799914550781251 +0.150625 -0.47418212890625 0.2799914550781251 +0.15075 -0.4564208984375 0.2799914550781251 +0.150875 -0.436859130859375 0.2799914550781251 +0.151 -0.409820556640625 0.2799914550781251 +0.151125 -0.379119873046875 0.2799914550781251 +0.15125 -0.34722900390625 0.2799914550781251 +0.151375 -0.30902099609375 0.2799914550781251 +0.1515 -0.27117919921875 0.2799914550781251 +0.151625 -0.2265625 0.2799914550781251 +0.15175 -0.180023193359375 0.2799914550781251 +0.151875 -0.1361083984375 0.2799914550781251 +0.152 -0.086395263671875 0.2799914550781251 +0.152125 -0.04071044921875 0.2799914550781251 +0.15225 0.010162353515625 0.2799914550781251 +0.152375 0.060821533203125 0.2799914550781251 +0.1525 0.105865478515625 0.2799914550781251 +0.152625 0.1544189453125 0.2799914550781251 +0.15275 0.196380615234375 0.2799914550781251 +0.152875 0.241424560546875 0.2799914550781251 +0.153 0.282989501953125 0.2799914550781251 +0.153125 0.318389892578125 0.2799914550781251 +0.15325 0.35333251953125 0.2799914550781251 +0.153375 0.382354736328125 0.2799914550781251 +0.1535 0.409332275390625 0.2799914550781251 +0.153625 0.433013916015625 0.2799914550781251 +0.15375 0.448822021484375 0.2799914550781251 +0.153875 0.4632568359375 0.2799914550781251 +0.154 0.4703369140625 0.2799914550781251 +0.154125 0.473388671875 0.2799914550781251 +0.15425 0.472869873046875 0.2799914550781251 +0.154375 0.466278076171875 0.2799914550781251 +0.1545 0.456024169921875 0.2799914550781251 +0.154625 0.440826416015625 0.2799914550781251 +0.15475 0.421295166015625 0.2799914550781251 +0.154875 0.395599365234375 0.2799914550781251 +0.155 0.370208740234375 0.2799914550781251 +0.155125 0.336822509765625 0.2799914550781251 +0.15525 0.304931640625 0.2799914550781251 +0.155375 0.265228271484375 0.2799914550781251 +0.1555 0.22296142578125 0.2799914550781251 +0.155625 0.183807373046875 0.2799914550781251 +0.15575 0.137786865234375 0.2799914550781251 +0.155875 0.095794677734375 0.2799914550781251 +0.156 0.047943115234375 0.2799914550781251 0.156125 0.0 0.2799914550781251 -0.15625 -0.085906982421875 0.2799914550781251 -0.156375 -0.18048095703125 0.2799914550781251 -0.1565 -0.2626953125 0.2799914550781251 -0.156625 -0.35223388671875 0.2799914550781251 -0.15675 -0.435821533203125 0.2799914550781251 -0.156875 -0.50592041015625 0.2799914550781251 -0.157 -0.580963134765625 0.2799914550781251 -0.157125 -0.63983154296875 0.2799914550781251 -0.15725 -0.701812744140625 0.2799914550781251 -0.157375 -0.752166748046875 0.2799914550781251 -0.1575 -0.793731689453125 0.2799914550781251 -0.157625 -0.827178955078125 0.2799914550781251 -0.15775 -0.8533935546875 0.2799914550781251 -0.157875 -0.854644775390625 0.2799914550781251 -0.158 -0.854736328125 0.2799914550781251 -0.158125 -0.854705810546875 0.2799914550781251 -0.15825 -0.854583740234375 0.2799914550781251 -0.158375 -0.848052978515625 0.2799914550781251 -0.1585 -0.817718505859375 0.2799914550781251 -0.158625 -0.783477783203125 0.2799914550781251 -0.15875 -0.740692138671875 0.2799914550781251 -0.158875 -0.69085693359375 0.2799914550781251 -0.159 -0.635498046875 0.2799914550781251 -0.159125 -0.57220458984375 0.2799914550781251 -0.15925 -0.49945068359375 0.2799914550781251 -0.159375 -0.432525634765625 0.2799914550781251 -0.1595 -0.351409912109375 0.2799914550781251 -0.159625 -0.275726318359375 0.2799914550781251 -0.15975 -0.191436767578125 0.2799914550781251 -0.159875 -0.10430908203125 0.2799914550781251 -0.16 -0.026123046875 0.535983642578125 -0.160125 0.060516357421875 0.535983642578125 -0.16025 0.136871337890625 0.535983642578125 -0.160375 0.220733642578125 0.535983642578125 -0.1605 0.29998779296875 0.535983642578125 -0.160625 0.3671875 0.535983642578125 -0.16075 0.4405517578125 0.535983642578125 -0.160875 0.498565673828125 0.535983642578125 -0.161 0.557159423828125 0.535983642578125 -0.161125 0.61358642578125 0.535983642578125 -0.16125 0.65338134765625 0.535983642578125 -0.161375 0.69622802734375 0.535983642578125 -0.1615 0.722320556640625 0.535983642578125 -0.161625 0.74383544921875 0.535983642578125 -0.16175 0.763214111328125 0.535983642578125 -0.161875 0.766937255859375 0.535983642578125 -0.162 0.76361083984375 0.535983642578125 -0.162125 0.75946044921875 0.535983642578125 -0.16225 0.74029541015625 0.535983642578125 -0.162375 0.7132568359375 0.535983642578125 -0.1625 0.688262939453125 0.535983642578125 -0.162625 0.647308349609375 0.535983642578125 -0.16275 0.60430908203125 0.535983642578125 -0.162875 0.557098388671875 0.535983642578125 -0.163 0.498931884765625 0.535983642578125 -0.163125 0.442291259765625 0.535983642578125 -0.16325 0.3802490234375 0.535983642578125 -0.163375 0.317596435546875 0.535983642578125 -0.1635 0.24639892578125 0.535983642578125 -0.163625 0.17578125 0.535983642578125 -0.16375 0.109375 0.535983642578125 -0.163875 0.036163330078125 0.535983642578125 -0.164 -0.0289306640625 0.535983642578125 -0.164125 -0.099945068359375 0.535983642578125 -0.16425 -0.168243408203125 0.535983642578125 -0.164375 -0.229217529296875 0.535983642578125 -0.1645 -0.291168212890625 0.535983642578125 -0.164625 -0.3465576171875 0.535983642578125 -0.16475 -0.399749755859375 0.535983642578125 -0.164875 -0.44720458984375 0.535983642578125 -0.165 -0.490020751953125 0.535983642578125 -0.165125 -0.5260009765625 0.535983642578125 -0.16525 -0.551910400390625 0.535983642578125 -0.165375 -0.582183837890625 0.535983642578125 -0.1655 -0.598388671875 0.535983642578125 -0.165625 -0.606048583984375 0.535983642578125 -0.16575 -0.61688232421875 0.535983642578125 -0.165875 -0.612640380859375 0.535983642578125 -0.166 -0.602325439453125 0.535983642578125 -0.166125 -0.59375 0.535983642578125 -0.16625 -0.572418212890625 0.535983642578125 -0.166375 -0.5440673828125 0.535983642578125 -0.1665 -0.520751953125 0.535983642578125 -0.166625 -0.482421875 0.535983642578125 -0.16675 -0.43963623046875 0.535983642578125 -0.166875 -0.403472900390625 0.535983642578125 -0.167 -0.3536376953125 0.535983642578125 -0.167125 -0.30615234375 0.535983642578125 -0.16725 -0.25628662109375 0.535983642578125 -0.167375 -0.200439453125 0.535983642578125 -0.1675 -0.151885986328125 0.535983642578125 -0.167625 -0.094818115234375 0.535983642578125 -0.16775 -0.044036865234375 0.535983642578125 -0.167875 0.010986328125 0.535983642578125 -0.168 0.064849853515625 0.535983642578125 -0.168125 0.1109619140625 0.535983642578125 -0.16825 0.16229248046875 0.535983642578125 -0.168375 0.20330810546875 0.535983642578125 -0.1685 0.245391845703125 0.535983642578125 -0.168625 0.2884521484375 0.535983642578125 -0.16875 0.318511962890625 0.535983642578125 -0.168875 0.3477783203125 0.535983642578125 -0.169 0.376312255859375 0.535983642578125 -0.169125 0.39617919921875 0.535983642578125 -0.16925 0.410675048828125 0.535983642578125 -0.169375 0.427032470703125 0.535983642578125 -0.1695 0.43170166015625 0.535983642578125 -0.169625 0.43048095703125 0.535983642578125 -0.16975 0.43475341796875 0.535983642578125 -0.169875 0.424835205078125 0.535983642578125 -0.17 0.41107177734375 0.535983642578125 -0.170125 0.402008056640625 0.535983642578125 -0.17025 0.381134033203125 0.535983642578125 -0.170375 0.364227294921875 0.535983642578125 -0.1705 0.335235595703125 0.535983642578125 -0.170625 0.306121826171875 0.535983642578125 -0.17075 0.27960205078125 0.535983642578125 -0.170875 0.246795654296875 0.535983642578125 -0.171 0.21002197265625 0.535983642578125 -0.171125 0.177276611328125 0.535983642578125 -0.17125 0.14227294921875 0.535983642578125 -0.171375 0.10418701171875 0.535983642578125 -0.1715 0.072418212890625 0.535983642578125 -0.171625 0.035369873046875 0.535983642578125 +0.15625 -0.04296875 0.2799914550781251 +0.156375 -0.09027099609375 0.2799914550781251 +0.1565 -0.131378173828125 0.2799914550781251 +0.156625 -0.1761474609375 0.2799914550781251 +0.15675 -0.217926025390625 0.2799914550781251 +0.156875 -0.25299072265625 0.2799914550781251 +0.157 -0.290496826171875 0.2799914550781251 +0.157125 -0.3199462890625 0.2799914550781251 +0.15725 -0.350921630859375 0.2799914550781251 +0.157375 -0.3760986328125 0.2799914550781251 +0.1575 -0.396881103515625 0.2799914550781251 +0.157625 -0.413604736328125 0.2799914550781251 +0.15775 -0.426727294921875 0.2799914550781251 +0.157875 -0.434417724609375 0.2799914550781251 +0.158 -0.439727783203125 0.2799914550781251 +0.158125 -0.4378662109375 0.2799914550781251 +0.15825 -0.4315185546875 0.2799914550781251 +0.158375 -0.424041748046875 0.2799914550781251 +0.1585 -0.40887451171875 0.2799914550781251 +0.158625 -0.391754150390625 0.2799914550781251 +0.15875 -0.370361328125 0.2799914550781251 +0.158875 -0.345458984375 0.2799914550781251 +0.159 -0.317779541015625 0.2799914550781251 +0.159125 -0.2861328125 0.2799914550781251 +0.15925 -0.249755859375 0.2799914550781251 +0.159375 -0.216278076171875 0.2799914550781251 +0.1595 -0.17572021484375 0.2799914550781251 +0.159625 -0.13787841796875 0.2799914550781251 +0.15975 -0.095733642578125 0.2799914550781251 +0.159875 -0.05218505859375 0.2799914550781251 +0.16 -0.013092041015625 0.535983642578125 +0.160125 0.030242919921875 0.535983642578125 +0.16025 0.06842041015625 0.535983642578125 +0.160375 0.1103515625 0.535983642578125 +0.1605 0.149993896484375 0.535983642578125 +0.160625 0.18359375 0.535983642578125 +0.16075 0.22027587890625 0.535983642578125 +0.160875 0.249267578125 0.535983642578125 +0.161 0.278564453125 0.535983642578125 +0.161125 0.306793212890625 0.535983642578125 +0.16125 0.326690673828125 0.535983642578125 +0.161375 0.348114013671875 0.535983642578125 +0.1615 0.36114501953125 0.535983642578125 +0.161625 0.371917724609375 0.535983642578125 +0.16175 0.381591796875 0.535983642578125 +0.161875 0.383453369140625 0.535983642578125 +0.162 0.381805419921875 0.535983642578125 +0.162125 0.379730224609375 0.535983642578125 +0.16225 0.370147705078125 0.535983642578125 +0.162375 0.35662841796875 0.535983642578125 +0.1625 0.3441162109375 0.535983642578125 +0.162625 0.323638916015625 0.535983642578125 +0.16275 0.302154541015625 0.535983642578125 +0.162875 0.278533935546875 0.535983642578125 +0.163 0.24945068359375 0.535983642578125 +0.163125 0.22113037109375 0.535983642578125 +0.16325 0.19012451171875 0.535983642578125 +0.163375 0.158782958984375 0.535983642578125 +0.1635 0.123199462890625 0.535983642578125 +0.163625 0.087890625 0.535983642578125 +0.16375 0.0546875 0.535983642578125 +0.163875 0.01806640625 0.535983642578125 +0.164 -0.014495849609375 0.535983642578125 +0.164125 -0.04998779296875 0.535983642578125 +0.16425 -0.084136962890625 0.535983642578125 +0.164375 -0.1146240234375 0.535983642578125 +0.1645 -0.145599365234375 0.535983642578125 +0.164625 -0.173309326171875 0.535983642578125 +0.16475 -0.19989013671875 0.535983642578125 +0.164875 -0.2236328125 0.535983642578125 +0.165 -0.245025634765625 0.535983642578125 +0.165125 -0.263031005859375 0.535983642578125 +0.16525 -0.275970458984375 0.535983642578125 +0.165375 -0.291107177734375 0.535983642578125 +0.1655 -0.299224853515625 0.535983642578125 +0.165625 -0.30303955078125 0.535983642578125 +0.16575 -0.3084716796875 0.535983642578125 +0.165875 -0.30633544921875 0.535983642578125 +0.166 -0.301177978515625 0.535983642578125 +0.166125 -0.296905517578125 0.535983642578125 +0.16625 -0.286224365234375 0.535983642578125 +0.166375 -0.272064208984375 0.535983642578125 +0.1665 -0.260406494140625 0.535983642578125 +0.166625 -0.241241455078125 0.535983642578125 +0.16675 -0.2198486328125 0.535983642578125 +0.166875 -0.201751708984375 0.535983642578125 +0.167 -0.176849365234375 0.535983642578125 +0.167125 -0.153106689453125 0.535983642578125 +0.16725 -0.128173828125 0.535983642578125 +0.167375 -0.100250244140625 0.535983642578125 +0.1675 -0.075958251953125 0.535983642578125 +0.167625 -0.04742431640625 0.535983642578125 +0.16775 -0.02203369140625 0.535983642578125 +0.167875 0.0054931640625 0.535983642578125 +0.168 0.03240966796875 0.535983642578125 +0.168125 0.05548095703125 0.535983642578125 +0.16825 0.081146240234375 0.535983642578125 +0.168375 0.101654052734375 0.535983642578125 +0.1685 0.1226806640625 0.535983642578125 +0.168625 0.14422607421875 0.535983642578125 +0.16875 0.15924072265625 0.535983642578125 +0.168875 0.17388916015625 0.535983642578125 +0.169 0.188140869140625 0.535983642578125 +0.169125 0.198089599609375 0.535983642578125 +0.16925 0.205322265625 0.535983642578125 +0.169375 0.2135009765625 0.535983642578125 +0.1695 0.215850830078125 0.535983642578125 +0.169625 0.215240478515625 0.535983642578125 +0.16975 0.217376708984375 0.535983642578125 +0.169875 0.21240234375 0.535983642578125 +0.17 0.205535888671875 0.535983642578125 +0.170125 0.20098876953125 0.535983642578125 +0.17025 0.1905517578125 0.535983642578125 +0.170375 0.182098388671875 0.535983642578125 +0.1705 0.1676025390625 0.535983642578125 +0.170625 0.153045654296875 0.535983642578125 +0.17075 0.139801025390625 0.535983642578125 +0.170875 0.123382568359375 0.535983642578125 +0.171 0.105010986328125 0.535983642578125 +0.171125 0.088623046875 0.535983642578125 +0.17125 0.071136474609375 0.535983642578125 +0.171375 0.052093505859375 0.535983642578125 +0.1715 0.03619384765625 0.535983642578125 +0.171625 0.017669677734375 0.535983642578125 0.17175 0.0 0.535983642578125 -0.171875 -0.0308837890625 0.535983642578125 -0.172 -0.06298828125 0.535983642578125 -0.172125 -0.089263916015625 0.535983642578125 -0.17225 -0.11968994140625 0.535983642578125 -0.172375 -0.14398193359375 0.535983642578125 -0.1725 -0.162384033203125 0.535983642578125 -0.172625 -0.186492919921875 0.535983642578125 -0.17275 -0.199249267578125 0.535983642578125 -0.172875 -0.210662841796875 0.535983642578125 -0.173 -0.22698974609375 0.535983642578125 -0.173125 -0.23052978515625 0.535983642578125 -0.17325 -0.241546630859375 0.535983642578125 -0.173375 -0.23944091796875 0.535983642578125 -0.1735 -0.235137939453125 0.535983642578125 -0.173625 -0.238006591796875 0.535983642578125 -0.17375 -0.2281494140625 0.535983642578125 -0.173875 -0.216033935546875 0.535983642578125 -0.174 -0.2122802734375 0.535983642578125 -0.174125 -0.196258544921875 0.535983642578125 -0.17425 -0.17877197265625 0.535983642578125 -0.174375 -0.1700439453125 0.535983642578125 -0.1745 -0.150360107421875 0.535983642578125 -0.174625 -0.13153076171875 0.535983642578125 -0.17475 -0.118438720703125 0.535983642578125 -0.174875 -0.09796142578125 0.535983642578125 -0.175 -0.079559326171875 0.535983642578125 -0.175125 -0.0650634765625 0.535983642578125 -0.17525 -0.0479736328125 0.535983642578125 -0.175375 -0.03094482421875 0.535983642578125 -0.1755 -0.0169677734375 0.535983642578125 -0.175625 -0.003875732421875 0.535983642578125 -0.17575 0.00836181640625 0.535983642578125 -0.175875 0.01910400390625 0.535983642578125 -0.176 0.028045654296875 0.535983642578125 -0.176125 0.034576416015625 0.535983642578125 -0.17625 0.04266357421875 0.535983642578125 -0.176375 0.045501708984375 0.535983642578125 -0.1765 0.051910400390625 0.535983642578125 -0.176625 0.051177978515625 0.535983642578125 -0.17675 0.048309326171875 0.535983642578125 -0.176875 0.0518798828125 0.535983642578125 -0.177 0.046051025390625 0.535983642578125 -0.177125 0.038543701171875 0.535983642578125 -0.17725 0.0400390625 0.535983642578125 -0.177375 0.030792236328125 0.535983642578125 -0.1775 0.020782470703125 0.535983642578125 -0.177625 0.0208740234375 0.535983642578125 -0.17775 0.0103759765625 0.535983642578125 +0.171875 -0.015472412109375 0.535983642578125 +0.172 -0.031524658203125 0.535983642578125 +0.172125 -0.044647216796875 0.535983642578125 +0.17225 -0.05987548828125 0.535983642578125 +0.172375 -0.072021484375 0.535983642578125 +0.1725 -0.081207275390625 0.535983642578125 +0.172625 -0.09326171875 0.535983642578125 +0.17275 -0.099639892578125 0.535983642578125 +0.172875 -0.1053466796875 0.535983642578125 +0.173 -0.113525390625 0.535983642578125 +0.173125 -0.11529541015625 0.535983642578125 +0.17325 -0.12078857421875 0.535983642578125 +0.173375 -0.1197509765625 0.535983642578125 +0.1735 -0.117584228515625 0.535983642578125 +0.173625 -0.1190185546875 0.535983642578125 +0.17375 -0.114105224609375 0.535983642578125 +0.173875 -0.1080322265625 0.535983642578125 +0.174 -0.106170654296875 0.535983642578125 +0.174125 -0.09814453125 0.535983642578125 +0.17425 -0.08941650390625 0.535983642578125 +0.174375 -0.085052490234375 0.535983642578125 +0.1745 -0.0751953125 0.535983642578125 +0.174625 -0.0657958984375 0.535983642578125 +0.17475 -0.059234619140625 0.535983642578125 +0.174875 -0.04901123046875 0.535983642578125 +0.175 -0.039794921875 0.535983642578125 +0.175125 -0.032562255859375 0.535983642578125 +0.17525 -0.024017333984375 0.535983642578125 +0.175375 -0.0155029296875 0.535983642578125 +0.1755 -0.008514404296875 0.535983642578125 +0.175625 -0.001953125 0.535983642578125 +0.17575 0.004180908203125 0.535983642578125 +0.175875 0.009552001953125 0.535983642578125 +0.176 0.014007568359375 0.535983642578125 +0.176125 0.01727294921875 0.535983642578125 +0.17625 0.021331787109375 0.535983642578125 +0.176375 0.022735595703125 0.535983642578125 +0.1765 0.02593994140625 0.535983642578125 +0.176625 0.02557373046875 0.535983642578125 +0.17675 0.024139404296875 0.535983642578125 +0.176875 0.02593994140625 0.535983642578125 +0.177 0.02301025390625 0.535983642578125 +0.177125 0.019256591796875 0.535983642578125 +0.17725 0.02001953125 0.535983642578125 +0.177375 0.015380859375 0.535983642578125 +0.1775 0.0103759765625 0.535983642578125 +0.177625 0.01043701171875 0.535983642578125 +0.17775 0.00518798828125 0.535983642578125 0.177875 0.0 0.535983642578125 0.178 0.0 0.535983642578125 -0.178125 -0.009552001953125 0.535983642578125 -0.17825 -0.0181884765625 0.535983642578125 -0.178375 -0.01715087890625 0.535983642578125 -0.1785 -0.023712158203125 0.535983642578125 -0.178625 -0.02862548828125 0.535983642578125 -0.17875 -0.025604248046875 0.535983642578125 -0.178875 -0.02752685546875 0.535983642578125 -0.179 -0.027862548828125 0.535983642578125 -0.179125 -0.021820068359375 0.535983642578125 -0.17925 -0.018157958984375 0.535983642578125 -0.179375 -0.01141357421875 0.535983642578125 -0.1795 -0.00433349609375 0.535983642578125 -0.179625 0.00390625 0.535983642578125 -0.17975 0.013702392578125 0.535983642578125 -0.179875 0.02593994140625 0.535983642578125 -0.18 0.03887939453125 0.535983642578125 -0.180125 0.04998779296875 0.535983642578125 -0.18025 0.064849853515625 0.535983642578125 -0.180375 0.08197021484375 0.535983642578125 -0.1805 0.09283447265625 0.535983642578125 -0.180625 0.1094970703125 0.535983642578125 -0.18075 0.12744140625 0.535983642578125 -0.180875 0.135406494140625 0.535983642578125 -0.181 0.15228271484375 0.535983642578125 -0.181125 0.1683349609375 0.535983642578125 -0.18125 0.1727294921875 0.535983642578125 -0.181375 0.18603515625 0.535983642578125 -0.1815 0.197540283203125 0.535983642578125 -0.181625 0.1968994140625 0.535983642578125 -0.18175 0.20416259765625 0.535983642578125 -0.181875 0.209381103515625 0.535983642578125 -0.182 0.201873779296875 0.535983642578125 -0.182125 0.202301025390625 0.535983642578125 -0.18225 0.19012451171875 0.535983642578125 -0.182375 0.183746337890625 0.535983642578125 -0.1825 0.17578125 0.535983642578125 -0.182625 0.15643310546875 0.535983642578125 -0.18275 0.143157958984375 0.535983642578125 -0.182875 0.12451171875 0.535983642578125 -0.183 0.09893798828125 0.535983642578125 -0.183125 0.0777587890625 0.535983642578125 -0.18325 0.051116943359375 0.535983642578125 -0.183375 0.024139404296875 0.535983642578125 -0.1835 -0.0062255859375 0.535983642578125 -0.183625 -0.038665771484375 0.535983642578125 -0.18375 -0.067352294921875 0.535983642578125 -0.183875 -0.1016845703125 0.535983642578125 -0.184 -0.133697509765625 0.535983642578125 -0.184125 -0.16436767578125 0.535983642578125 -0.18425 -0.19903564453125 0.535983642578125 -0.184375 -0.230438232421875 0.535983642578125 -0.1845 -0.256500244140625 0.535983642578125 -0.184625 -0.285369873046875 0.535983642578125 -0.18475 -0.314788818359375 0.535983642578125 -0.184875 -0.3330078125 0.535983642578125 -0.185 -0.35540771484375 0.535983642578125 -0.185125 -0.376251220703125 0.535983642578125 -0.18525 -0.383270263671875 0.535983642578125 -0.185375 -0.396728515625 0.535983642578125 -0.1855 -0.396270751953125 0.535983642578125 -0.185625 -0.401641845703125 0.535983642578125 -0.18575 -0.402008056640625 0.535983642578125 -0.185875 -0.39007568359375 0.535983642578125 -0.186 -0.38128662109375 0.535983642578125 -0.186125 -0.367401123046875 0.535983642578125 -0.18625 -0.343841552734375 0.535983642578125 -0.186375 -0.320831298828125 0.535983642578125 -0.1865 -0.29656982421875 0.535983642578125 -0.186625 -0.259002685546875 0.535983642578125 -0.18675 -0.223114013671875 0.535983642578125 -0.186875 -0.1876220703125 0.535983642578125 -0.187 -0.1412353515625 0.535983642578125 -0.187125 -0.10009765625 0.535983642578125 -0.18725 -0.05126953125 0.535983642578125 +0.178125 -0.004791259765625 0.535983642578125 +0.17825 -0.009124755859375 0.535983642578125 +0.178375 -0.00860595703125 0.535983642578125 +0.1785 -0.011871337890625 0.535983642578125 +0.178625 -0.01434326171875 0.535983642578125 +0.17875 -0.0128173828125 0.535983642578125 +0.178875 -0.0137939453125 0.535983642578125 +0.179 -0.013946533203125 0.535983642578125 +0.179125 -0.01092529296875 0.535983642578125 +0.17925 -0.00909423828125 0.535983642578125 +0.179375 -0.0057373046875 0.535983642578125 +0.1795 -0.002197265625 0.535983642578125 +0.179625 0.001953125 0.535983642578125 +0.17975 0.0068359375 0.535983642578125 +0.179875 0.012969970703125 0.535983642578125 +0.18 0.019439697265625 0.535983642578125 +0.180125 0.024993896484375 0.535983642578125 +0.18025 0.03240966796875 0.535983642578125 +0.180375 0.040985107421875 0.535983642578125 +0.1805 0.046417236328125 0.535983642578125 +0.180625 0.05474853515625 0.535983642578125 +0.18075 0.063720703125 0.535983642578125 +0.180875 0.06768798828125 0.535983642578125 +0.181 0.076141357421875 0.535983642578125 +0.181125 0.08416748046875 0.535983642578125 +0.18125 0.08636474609375 0.535983642578125 +0.181375 0.093017578125 0.535983642578125 +0.1815 0.0987548828125 0.535983642578125 +0.181625 0.09844970703125 0.535983642578125 +0.18175 0.102081298828125 0.535983642578125 +0.181875 0.10467529296875 0.535983642578125 +0.182 0.100921630859375 0.535983642578125 +0.182125 0.10113525390625 0.535983642578125 +0.18225 0.095062255859375 0.535983642578125 +0.182375 0.09185791015625 0.535983642578125 +0.1825 0.087890625 0.535983642578125 +0.182625 0.078216552734375 0.535983642578125 +0.18275 0.071563720703125 0.535983642578125 +0.182875 0.062255859375 0.535983642578125 +0.183 0.049468994140625 0.535983642578125 +0.183125 0.03887939453125 0.535983642578125 +0.18325 0.025543212890625 0.535983642578125 +0.183375 0.012054443359375 0.535983642578125 +0.1835 -0.003143310546875 0.535983642578125 +0.183625 -0.01934814453125 0.535983642578125 +0.18375 -0.03369140625 0.535983642578125 +0.183875 -0.050872802734375 0.535983642578125 +0.184 -0.066864013671875 0.535983642578125 +0.184125 -0.08221435546875 0.535983642578125 +0.18425 -0.09954833984375 0.535983642578125 +0.184375 -0.115234375 0.535983642578125 +0.1845 -0.128265380859375 0.535983642578125 +0.184625 -0.1427001953125 0.535983642578125 +0.18475 -0.15740966796875 0.535983642578125 +0.184875 -0.166534423828125 0.535983642578125 +0.185 -0.177734375 0.535983642578125 +0.185125 -0.188140869140625 0.535983642578125 +0.18525 -0.191650390625 0.535983642578125 +0.185375 -0.198394775390625 0.535983642578125 +0.1855 -0.198150634765625 0.535983642578125 +0.185625 -0.200836181640625 0.535983642578125 +0.18575 -0.201019287109375 0.535983642578125 +0.185875 -0.195068359375 0.535983642578125 +0.186 -0.190673828125 0.535983642578125 +0.186125 -0.1837158203125 0.535983642578125 +0.18625 -0.17193603515625 0.535983642578125 +0.186375 -0.160430908203125 0.535983642578125 +0.1865 -0.1483154296875 0.535983642578125 +0.186625 -0.1295166015625 0.535983642578125 +0.18675 -0.111572265625 0.535983642578125 +0.186875 -0.093841552734375 0.535983642578125 +0.187 -0.070648193359375 0.535983642578125 +0.187125 -0.050079345703125 0.535983642578125 +0.18725 -0.025665283203125 0.535983642578125 0.187375 0.0 0.535983642578125 -0.1875 0.0469970703125 0.535983642578125 -0.187625 0.100555419921875 0.535983642578125 -0.18775 0.147064208984375 0.535983642578125 -0.187875 0.20068359375 0.535983642578125 -0.188 0.2537841796875 0.535983642578125 -0.188125 0.296112060546875 0.535983642578125 -0.18825 0.34576416015625 0.535983642578125 -0.188375 0.38275146484375 0.535983642578125 -0.1885 0.4267578125 0.535983642578125 -0.188625 0.467132568359375 0.535983642578125 -0.18875 0.492950439453125 0.535983642578125 -0.188875 0.52459716796875 0.535983642578125 -0.189 0.549560546875 0.535983642578125 -0.189125 0.562591552734375 0.535983642578125 -0.18925 0.5780029296875 0.535983642578125 -0.189375 0.58734130859375 0.535983642578125 -0.1895 0.582183837890625 0.535983642578125 -0.189625 0.580352783203125 0.535983642578125 -0.18975 0.570831298828125 0.535983642578125 -0.189875 0.546905517578125 0.535983642578125 -0.19 0.527435302734375 0.535983642578125 -0.190125 0.498565673828125 0.535983642578125 -0.19025 0.461517333984375 0.535983642578125 -0.190375 0.420989990234375 0.535983642578125 -0.1905 0.37457275390625 0.535983642578125 -0.190625 0.32440185546875 0.535983642578125 -0.19075 0.26861572265625 0.535983642578125 -0.190875 0.214813232421875 0.535983642578125 -0.191 0.149139404296875 0.535983642578125 -0.191125 0.08282470703125 0.535983642578125 -0.19125 0.020721435546875 0.535983642578125 -0.191375 -0.0489501953125 0.535983642578125 -0.1915 -0.112823486328125 0.535983642578125 -0.191625 -0.18194580078125 0.535983642578125 -0.19175 -0.251922607421875 0.535983642578125 -0.191875 -0.31414794921875 0.535983642578125 -0.192 -0.3809814453125 0.791975830078125 -0.192125 -0.43450927734375 0.791975830078125 -0.19225 -0.49462890625 0.791975830078125 -0.192375 -0.550384521484375 0.791975830078125 -0.1925 -0.5968017578125 0.791975830078125 -0.192625 -0.63592529296875 0.791975830078125 -0.19275 -0.671875 0.791975830078125 -0.192875 -0.70452880859375 0.791975830078125 -0.193 -0.729827880859375 0.791975830078125 -0.193125 -0.746612548828125 0.791975830078125 -0.19325 -0.749908447265625 0.791975830078125 -0.193375 -0.752685546875 0.791975830078125 -0.1935 -0.7469482421875 0.791975830078125 -0.193625 -0.732666015625 0.791975830078125 -0.19375 -0.707000732421875 0.791975830078125 -0.193875 -0.676910400390625 0.791975830078125 -0.194 -0.643402099609375 0.791975830078125 -0.194125 -0.5980224609375 0.791975830078125 -0.19425 -0.545135498046875 0.791975830078125 -0.194375 -0.48809814453125 0.791975830078125 -0.1945 -0.422943115234375 0.791975830078125 -0.194625 -0.359649658203125 0.791975830078125 -0.19475 -0.2840576171875 0.791975830078125 -0.194875 -0.20263671875 0.791975830078125 -0.195 -0.128387451171875 0.791975830078125 -0.195125 -0.043212890625 0.791975830078125 -0.19525 0.034820556640625 0.791975830078125 -0.195375 0.1224365234375 0.791975830078125 -0.1955 0.20849609375 0.791975830078125 -0.195625 0.285919189453125 0.791975830078125 -0.19575 0.36981201171875 0.791975830078125 -0.195875 0.443023681640625 0.791975830078125 -0.196 0.516998291015625 0.791975830078125 -0.196125 0.589080810546875 0.791975830078125 -0.19625 0.64947509765625 0.791975830078125 -0.196375 0.71002197265625 0.791975830078125 -0.1965 0.758758544921875 0.791975830078125 -0.196625 0.800384521484375 0.791975830078125 -0.19675 0.8380126953125 0.791975830078125 -0.196875 0.854583740234375 0.791975830078125 -0.197 0.854766845703125 0.791975830078125 -0.197125 0.854827880859375 0.791975830078125 -0.19725 0.854827880859375 0.791975830078125 -0.197375 0.854766845703125 0.791975830078125 -0.1975 0.8546142578125 0.791975830078125 -0.197625 0.8416748046875 0.791975830078125 -0.19775 0.80560302734375 0.791975830078125 -0.197875 0.760772705078125 0.791975830078125 -0.198 0.707000732421875 0.791975830078125 -0.198125 0.651702880859375 0.791975830078125 -0.19825 0.58251953125 0.791975830078125 -0.198375 0.512237548828125 0.791975830078125 -0.1985 0.4306640625 0.791975830078125 -0.198625 0.343597412109375 0.791975830078125 -0.19875 0.26141357421875 0.791975830078125 -0.198875 0.1658935546875 0.791975830078125 -0.199 0.078643798828125 0.791975830078125 -0.199125 -0.01971435546875 0.791975830078125 -0.19925 -0.11871337890625 0.791975830078125 -0.199375 -0.207366943359375 0.791975830078125 -0.1995 -0.30328369140625 0.791975830078125 -0.199625 -0.388031005859375 0.791975830078125 -0.19975 -0.47857666015625 0.791975830078125 -0.199875 -0.564300537109375 0.791975830078125 -0.2 -0.634918212890625 0.791975830078125 -0.200125 -0.708831787109375 0.791975830078125 -0.20025 -0.76922607421875 0.791975830078125 -0.200375 -0.828338623046875 0.791975830078125 -0.2005 -0.854736328125 0.791975830078125 -0.200625 -0.855072021484375 0.791975830078125 -0.20075 -0.855377197265625 0.791975830078125 -0.200875 -0.855560302734375 0.791975830078125 -0.201 -0.855682373046875 0.791975830078125 -0.201125 -0.85565185546875 0.791975830078125 -0.20125 -0.8555908203125 0.791975830078125 -0.201375 -0.85540771484375 0.791975830078125 -0.2015 -0.85516357421875 0.791975830078125 -0.201625 -0.854766845703125 0.791975830078125 -0.20175 -0.832366943359375 0.791975830078125 -0.201875 -0.7802734375 0.791975830078125 -0.202 -0.7138671875 0.791975830078125 -0.202125 -0.647216796875 0.791975830078125 -0.20225 -0.565277099609375 0.791975830078125 -0.202375 -0.47784423828125 0.791975830078125 -0.2025 -0.394439697265625 0.791975830078125 -0.202625 -0.29730224609375 0.791975830078125 -0.20275 -0.2069091796875 0.791975830078125 -0.202875 -0.10400390625 0.791975830078125 +0.1875 0.02349853515625 0.535983642578125 +0.187625 0.050262451171875 0.535983642578125 +0.18775 0.073516845703125 0.535983642578125 +0.187875 0.100341796875 0.535983642578125 +0.188 0.12689208984375 0.535983642578125 +0.188125 0.148040771484375 0.535983642578125 +0.18825 0.172882080078125 0.535983642578125 +0.188375 0.191375732421875 0.535983642578125 +0.1885 0.21337890625 0.535983642578125 +0.188625 0.233551025390625 0.535983642578125 +0.18875 0.2464599609375 0.535983642578125 +0.188875 0.262298583984375 0.535983642578125 +0.189 0.2747802734375 0.535983642578125 +0.189125 0.281280517578125 0.535983642578125 +0.18925 0.28900146484375 0.535983642578125 +0.189375 0.293670654296875 0.535983642578125 +0.1895 0.29107666015625 0.535983642578125 +0.189625 0.2901611328125 0.535983642578125 +0.18975 0.285400390625 0.535983642578125 +0.189875 0.2734375 0.535983642578125 +0.19 0.263702392578125 0.535983642578125 +0.190125 0.249267578125 0.535983642578125 +0.19025 0.230743408203125 0.535983642578125 +0.190375 0.210479736328125 0.535983642578125 +0.1905 0.187286376953125 0.535983642578125 +0.190625 0.162200927734375 0.535983642578125 +0.19075 0.134307861328125 0.535983642578125 +0.190875 0.107391357421875 0.535983642578125 +0.191 0.074554443359375 0.535983642578125 +0.191125 0.041412353515625 0.535983642578125 +0.19125 0.010345458984375 0.535983642578125 +0.191375 -0.024505615234375 0.535983642578125 +0.1915 -0.056427001953125 0.535983642578125 +0.191625 -0.09100341796875 0.535983642578125 +0.19175 -0.1259765625 0.535983642578125 +0.191875 -0.1571044921875 0.535983642578125 +0.192 -0.190521240234375 0.791975830078125 +0.192125 -0.21728515625 0.791975830078125 +0.19225 -0.247344970703125 0.791975830078125 +0.192375 -0.27520751953125 0.791975830078125 +0.1925 -0.298431396484375 0.791975830078125 +0.192625 -0.3179931640625 0.791975830078125 +0.19275 -0.335968017578125 0.791975830078125 +0.192875 -0.352294921875 0.791975830078125 +0.193 -0.36492919921875 0.791975830078125 +0.193125 -0.373321533203125 0.791975830078125 +0.19325 -0.374969482421875 0.791975830078125 +0.193375 -0.376373291015625 0.791975830078125 +0.1935 -0.373504638671875 0.791975830078125 +0.193625 -0.366363525390625 0.791975830078125 +0.19375 -0.353515625 0.791975830078125 +0.193875 -0.338470458984375 0.791975830078125 +0.194 -0.32171630859375 0.791975830078125 +0.194125 -0.299041748046875 0.791975830078125 +0.19425 -0.2725830078125 0.791975830078125 +0.194375 -0.24407958984375 0.791975830078125 +0.1945 -0.21148681640625 0.791975830078125 +0.194625 -0.179840087890625 0.791975830078125 +0.19475 -0.142059326171875 0.791975830078125 +0.194875 -0.101348876953125 0.791975830078125 +0.195 -0.064208984375 0.791975830078125 +0.195125 -0.021636962890625 0.791975830078125 +0.19525 0.01739501953125 0.791975830078125 +0.195375 0.06121826171875 0.791975830078125 +0.1955 0.104248046875 0.791975830078125 +0.195625 0.1429443359375 0.791975830078125 +0.19575 0.184906005859375 0.791975830078125 +0.195875 0.22149658203125 0.791975830078125 +0.196 0.25848388671875 0.791975830078125 +0.196125 0.294525146484375 0.791975830078125 +0.19625 0.324737548828125 0.791975830078125 +0.196375 0.355010986328125 0.791975830078125 +0.1965 0.379364013671875 0.791975830078125 +0.196625 0.400177001953125 0.791975830078125 +0.19675 0.41900634765625 0.791975830078125 +0.196875 0.432342529296875 0.791975830078125 +0.197 0.44244384765625 0.791975830078125 +0.197125 0.4453125 0.791975830078125 +0.19725 0.446197509765625 0.791975830078125 +0.197375 0.442108154296875 0.791975830078125 +0.1975 0.434356689453125 0.791975830078125 +0.197625 0.42083740234375 0.791975830078125 +0.19775 0.402801513671875 0.791975830078125 +0.197875 0.38037109375 0.791975830078125 +0.198 0.353485107421875 0.791975830078125 +0.198125 0.325836181640625 0.791975830078125 +0.19825 0.291259765625 0.791975830078125 +0.198375 0.256103515625 0.791975830078125 +0.1985 0.21533203125 0.791975830078125 +0.198625 0.171783447265625 0.791975830078125 +0.19875 0.130706787109375 0.791975830078125 +0.198875 0.08294677734375 0.791975830078125 +0.199 0.039306640625 0.791975830078125 +0.199125 -0.0098876953125 0.791975830078125 +0.19925 -0.05938720703125 0.791975830078125 +0.199375 -0.10369873046875 0.791975830078125 +0.1995 -0.15167236328125 0.791975830078125 +0.199625 -0.19403076171875 0.791975830078125 +0.19975 -0.23931884765625 0.791975830078125 +0.199875 -0.28216552734375 0.791975830078125 +0.2 -0.317474365234375 0.791975830078125 +0.200125 -0.35443115234375 0.791975830078125 +0.20025 -0.3846435546875 0.791975830078125 +0.200375 -0.4141845703125 0.791975830078125 +0.2005 -0.439300537109375 0.791975830078125 +0.200625 -0.456817626953125 0.791975830078125 +0.20075 -0.472686767578125 0.791975830078125 +0.200875 -0.482666015625 0.791975830078125 +0.201 -0.48858642578125 0.791975830078125 +0.201125 -0.488037109375 0.791975830078125 +0.20125 -0.484039306640625 0.791975830078125 +0.201375 -0.474334716796875 0.791975830078125 +0.2015 -0.461181640625 0.791975830078125 +0.201625 -0.4415283203125 0.791975830078125 +0.20175 -0.41619873046875 0.791975830078125 +0.201875 -0.390167236328125 0.791975830078125 +0.202 -0.356964111328125 0.791975830078125 +0.202125 -0.323638916015625 0.791975830078125 +0.20225 -0.28265380859375 0.791975830078125 +0.202375 -0.23895263671875 0.791975830078125 +0.2025 -0.197235107421875 0.791975830078125 +0.202625 -0.148681640625 0.791975830078125 +0.20275 -0.103485107421875 0.791975830078125 +0.202875 -0.052032470703125 0.791975830078125 0.203 0.0 0.791975830078125 -0.203125 0.093780517578125 0.791975830078125 -0.20325 0.197174072265625 0.791975830078125 -0.203375 0.288360595703125 0.791975830078125 -0.2035 0.38690185546875 0.791975830078125 -0.203625 0.481231689453125 0.791975830078125 -0.20375 0.5616455078125 0.791975830078125 -0.203875 0.645172119140625 0.791975830078125 -0.204 0.71417236328125 0.791975830078125 -0.204125 0.78350830078125 0.791975830078125 -0.20425 0.844207763671875 0.791975830078125 -0.204375 0.854827880859375 0.791975830078125 -0.2045 0.855224609375 0.791975830078125 -0.204625 0.855499267578125 0.791975830078125 -0.20475 0.855712890625 0.791975830078125 -0.204875 0.8558349609375 0.791975830078125 -0.205 0.8558349609375 0.791975830078125 -0.205125 0.855743408203125 0.791975830078125 -0.20525 0.8555908203125 0.791975830078125 -0.205375 0.855316162109375 0.791975830078125 -0.2055 0.85491943359375 0.791975830078125 -0.205625 0.8544921875 0.791975830078125 -0.20575 0.799072265625 0.791975830078125 -0.205875 0.738922119140625 0.791975830078125 -0.206 0.66455078125 0.791975830078125 -0.206125 0.5830078125 0.791975830078125 -0.20625 0.5048828125 0.791975830078125 -0.206375 0.412353515625 0.791975830078125 -0.2065 0.325225830078125 0.791975830078125 -0.206625 0.2254638671875 0.791975830078125 -0.20675 0.123504638671875 0.791975830078125 -0.206875 0.030914306640625 0.791975830078125 -0.207 -0.072021484375 0.791975830078125 -0.207125 -0.163726806640625 0.791975830078125 -0.20725 -0.263519287109375 0.791975830078125 -0.207375 -0.36077880859375 0.791975830078125 -0.2075 -0.4439697265625 0.791975830078125 -0.207625 -0.531402587890625 0.791975830078125 -0.20775 -0.6046142578125 0.791975830078125 -0.207875 -0.6793212890625 0.791975830078125 -0.208 -0.748138427734375 0.791975830078125 -0.208125 -0.800933837890625 0.791975830078125 -0.20825 -0.851104736328125 0.791975830078125 -0.208375 -0.854827880859375 0.791975830078125 -0.2085 -0.855133056640625 0.791975830078125 -0.208625 -0.8553466796875 0.791975830078125 -0.20875 -0.855438232421875 0.791975830078125 -0.208875 -0.85546875 0.791975830078125 -0.209 -0.855377197265625 0.791975830078125 -0.209125 -0.855224609375 0.791975830078125 -0.20925 -0.854949951171875 0.791975830078125 -0.209375 -0.8546142578125 0.791975830078125 -0.2095 -0.819549560546875 0.791975830078125 -0.209625 -0.772430419921875 0.791975830078125 -0.20975 -0.7093505859375 0.791975830078125 -0.209875 -0.638946533203125 0.791975830078125 -0.21 -0.569732666015625 0.791975830078125 -0.210125 -0.48779296875 0.791975830078125 -0.21025 -0.411590576171875 0.791975830078125 -0.210375 -0.321258544921875 0.791975830078125 -0.2105 -0.2281494140625 0.791975830078125 -0.210625 -0.142822265625 0.791975830078125 -0.21075 -0.0477294921875 0.791975830078125 -0.210875 0.03802490234375 0.791975830078125 -0.211 0.132110595703125 0.791975830078125 -0.211125 0.22381591796875 0.791975830078125 -0.21125 0.303314208984375 0.791975830078125 -0.211375 0.3897705078125 0.791975830078125 -0.2115 0.46148681640625 0.791975830078125 -0.211625 0.535675048828125 0.791975830078125 -0.21175 0.6031494140625 0.791975830078125 -0.211875 0.660919189453125 0.791975830078125 -0.212 0.714141845703125 0.791975830078125 -0.212125 0.754364013671875 0.791975830078125 -0.21225 0.791015625 0.791975830078125 -0.212375 0.818450927734375 0.791975830078125 -0.2125 0.83984375 0.791975830078125 -0.212625 0.849517822265625 0.791975830078125 -0.21275 0.84954833984375 0.791975830078125 -0.212875 0.84124755859375 0.791975830078125 -0.213 0.8292236328125 0.791975830078125 -0.213125 0.805206298828125 0.791975830078125 -0.21325 0.77105712890625 0.791975830078125 -0.213375 0.732818603515625 0.791975830078125 -0.2135 0.683807373046875 0.791975830078125 -0.213625 0.632568359375 0.791975830078125 -0.21375 0.57623291015625 0.791975830078125 -0.213875 0.509002685546875 0.791975830078125 -0.214 0.44415283203125 0.791975830078125 -0.214125 0.371826171875 0.791975830078125 -0.21425 0.29315185546875 0.791975830078125 -0.214375 0.220367431640625 0.791975830078125 -0.2145 0.138702392578125 0.791975830078125 -0.214625 0.064971923828125 0.791975830078125 -0.21475 -0.0162353515625 0.791975830078125 -0.214875 -0.09649658203125 0.791975830078125 -0.215 -0.166534423828125 0.791975830078125 -0.215125 -0.241363525390625 0.791975830078125 -0.21525 -0.305023193359375 0.791975830078125 -0.215375 -0.374969482421875 0.791975830078125 -0.2155 -0.43670654296875 0.791975830078125 -0.215625 -0.4866943359375 0.791975830078125 -0.21575 -0.536468505859375 0.791975830078125 -0.215875 -0.58050537109375 0.791975830078125 -0.216 -0.617218017578125 0.791975830078125 -0.216125 -0.646331787109375 0.791975830078125 -0.21625 -0.6651611328125 0.791975830078125 -0.216375 -0.6793212890625 0.791975830078125 -0.2165 -0.6920166015625 0.791975830078125 -0.216625 -0.69140625 0.791975830078125 -0.21675 -0.68304443359375 0.791975830078125 -0.216875 -0.66839599609375 0.791975830078125 -0.217 -0.6536865234375 0.791975830078125 -0.217125 -0.62701416015625 0.791975830078125 -0.21725 -0.59222412109375 0.791975830078125 -0.217375 -0.55157470703125 0.791975830078125 -0.2175 -0.5098876953125 0.791975830078125 -0.217625 -0.46575927734375 0.791975830078125 -0.21775 -0.416412353515625 0.791975830078125 -0.217875 -0.35906982421875 0.791975830078125 -0.218 -0.299163818359375 0.791975830078125 -0.218125 -0.246612548828125 0.791975830078125 -0.21825 -0.1832275390625 0.791975830078125 -0.218375 -0.125640869140625 0.791975830078125 -0.2185 -0.062255859375 0.791975830078125 +0.203125 0.046875 0.791975830078125 +0.20325 0.09857177734375 0.791975830078125 +0.203375 0.1441650390625 0.791975830078125 +0.2035 0.193450927734375 0.791975830078125 +0.203625 0.2406005859375 0.791975830078125 +0.20375 0.28082275390625 0.791975830078125 +0.203875 0.32257080078125 0.791975830078125 +0.204 0.357086181640625 0.791975830078125 +0.204125 0.391754150390625 0.791975830078125 +0.20425 0.422088623046875 0.791975830078125 +0.204375 0.445404052734375 0.791975830078125 +0.2045 0.4666748046875 0.791975830078125 +0.204625 0.48138427734375 0.791975830078125 +0.20475 0.49267578125 0.791975830078125 +0.204875 0.498504638671875 0.791975830078125 +0.205 0.498992919921875 0.791975830078125 +0.205125 0.494598388671875 0.791975830078125 +0.20525 0.485748291015625 0.791975830078125 +0.205375 0.4708251953125 0.791975830078125 +0.2055 0.45074462890625 0.791975830078125 +0.205625 0.42877197265625 0.791975830078125 +0.20575 0.3995361328125 0.791975830078125 +0.205875 0.36944580078125 0.791975830078125 +0.206 0.332275390625 0.791975830078125 +0.206125 0.29150390625 0.791975830078125 +0.20625 0.25244140625 0.791975830078125 +0.206375 0.2061767578125 0.791975830078125 +0.2065 0.16259765625 0.791975830078125 +0.206625 0.11273193359375 0.791975830078125 +0.20675 0.061737060546875 0.791975830078125 +0.206875 0.01544189453125 0.791975830078125 +0.207 -0.036041259765625 0.791975830078125 +0.207125 -0.081878662109375 0.791975830078125 +0.20725 -0.13177490234375 0.791975830078125 +0.207375 -0.180419921875 0.791975830078125 +0.2075 -0.222015380859375 0.791975830078125 +0.207625 -0.265716552734375 0.791975830078125 +0.20775 -0.302337646484375 0.791975830078125 +0.207875 -0.339691162109375 0.791975830078125 +0.208 -0.37408447265625 0.791975830078125 +0.208125 -0.400482177734375 0.791975830078125 +0.20825 -0.425567626953125 0.791975830078125 +0.208375 -0.443878173828125 0.791975830078125 +0.2085 -0.460968017578125 0.791975830078125 +0.208625 -0.471588134765625 0.791975830078125 +0.20875 -0.476470947265625 0.791975830078125 +0.208875 -0.47705078125 0.791975830078125 +0.209 -0.472869873046875 0.791975830078125 +0.209125 -0.465087890625 0.791975830078125 +0.20925 -0.45062255859375 0.791975830078125 +0.209375 -0.433319091796875 0.791975830078125 +0.2095 -0.4097900390625 0.791975830078125 +0.209625 -0.38623046875 0.791975830078125 +0.20975 -0.354705810546875 0.791975830078125 +0.209875 -0.319488525390625 0.791975830078125 +0.21 -0.284881591796875 0.791975830078125 +0.210125 -0.243927001953125 0.791975830078125 +0.21025 -0.205810546875 0.791975830078125 +0.210375 -0.16064453125 0.791975830078125 +0.2105 -0.114105224609375 0.791975830078125 +0.210625 -0.071441650390625 0.791975830078125 +0.21075 -0.023895263671875 0.791975830078125 +0.210875 0.019012451171875 0.791975830078125 +0.211 0.0660400390625 0.791975830078125 +0.211125 0.111907958984375 0.791975830078125 +0.21125 0.151641845703125 0.791975830078125 +0.211375 0.19488525390625 0.791975830078125 +0.2115 0.230743408203125 0.791975830078125 +0.211625 0.267822265625 0.791975830078125 +0.21175 0.30157470703125 0.791975830078125 +0.211875 0.3304443359375 0.791975830078125 +0.212 0.3570556640625 0.791975830078125 +0.212125 0.377166748046875 0.791975830078125 +0.21225 0.3955078125 0.791975830078125 +0.212375 0.409210205078125 0.791975830078125 +0.2125 0.419921875 0.791975830078125 +0.212625 0.42474365234375 0.791975830078125 +0.21275 0.424774169921875 0.791975830078125 +0.212875 0.420623779296875 0.791975830078125 +0.213 0.41461181640625 0.791975830078125 +0.213125 0.402587890625 0.791975830078125 +0.21325 0.385528564453125 0.791975830078125 +0.213375 0.36639404296875 0.791975830078125 +0.2135 0.341888427734375 0.791975830078125 +0.213625 0.3162841796875 0.791975830078125 +0.21375 0.288116455078125 0.791975830078125 +0.213875 0.254486083984375 0.791975830078125 +0.214 0.222076416015625 0.791975830078125 +0.214125 0.1859130859375 0.791975830078125 +0.21425 0.146575927734375 0.791975830078125 +0.214375 0.11016845703125 0.791975830078125 +0.2145 0.0693359375 0.791975830078125 +0.214625 0.032470703125 0.791975830078125 +0.21475 -0.008148193359375 0.791975830078125 +0.214875 -0.04827880859375 0.791975830078125 +0.215 -0.083282470703125 0.791975830078125 +0.215125 -0.120697021484375 0.791975830078125 +0.21525 -0.15252685546875 0.791975830078125 +0.215375 -0.1875 0.791975830078125 +0.2155 -0.2183837890625 0.791975830078125 +0.215625 -0.243377685546875 0.791975830078125 +0.21575 -0.26824951171875 0.791975830078125 +0.215875 -0.290283203125 0.791975830078125 +0.216 -0.308624267578125 0.791975830078125 +0.216125 -0.32318115234375 0.791975830078125 +0.21625 -0.332611083984375 0.791975830078125 +0.216375 -0.339691162109375 0.791975830078125 +0.2165 -0.346038818359375 0.791975830078125 +0.216625 -0.345733642578125 0.791975830078125 +0.21675 -0.341552734375 0.791975830078125 +0.216875 -0.334228515625 0.791975830078125 +0.217 -0.326873779296875 0.791975830078125 +0.217125 -0.31353759765625 0.791975830078125 +0.21725 -0.296142578125 0.791975830078125 +0.217375 -0.27581787109375 0.791975830078125 +0.2175 -0.254974365234375 0.791975830078125 +0.217625 -0.23291015625 0.791975830078125 +0.21775 -0.208221435546875 0.791975830078125 +0.217875 -0.1795654296875 0.791975830078125 +0.218 -0.14959716796875 0.791975830078125 +0.218125 -0.123321533203125 0.791975830078125 +0.21825 -0.091644287109375 0.791975830078125 +0.218375 -0.062835693359375 0.791975830078125 +0.2185 -0.031158447265625 0.791975830078125 0.218625 0.0 0.791975830078125 -0.21875 0.05523681640625 0.791975830078125 -0.218875 0.11444091796875 0.791975830078125 -0.219 0.164886474609375 0.791975830078125 -0.219125 0.217742919921875 0.791975830078125 -0.21925 0.27069091796875 0.791975830078125 -0.219375 0.310943603515625 0.791975830078125 -0.2195 0.351470947265625 0.791975830078125 -0.219625 0.38275146484375 0.791975830078125 -0.21975 0.412872314453125 0.791975830078125 -0.219875 0.44482421875 0.791975830078125 -0.22 0.46148681640625 0.791975830078125 -0.220125 0.475128173828125 0.791975830078125 -0.22025 0.481475830078125 0.791975830078125 -0.220375 0.492919921875 0.791975830078125 -0.2205 0.489837646484375 0.791975830078125 -0.220625 0.481414794921875 0.791975830078125 -0.22075 0.46807861328125 0.791975830078125 -0.220875 0.450958251953125 0.791975830078125 -0.221 0.43743896484375 0.791975830078125 -0.221125 0.410675048828125 0.791975830078125 -0.22125 0.38262939453125 0.791975830078125 -0.221375 0.349334716796875 0.791975830078125 -0.2215 0.3233642578125 0.791975830078125 -0.221625 0.284820556640625 0.791975830078125 -0.22175 0.244598388671875 0.791975830078125 -0.221875 0.20697021484375 0.791975830078125 -0.222 0.165252685546875 0.791975830078125 -0.222125 0.13055419921875 0.791975830078125 -0.22225 0.08843994140625 0.791975830078125 -0.222375 0.04730224609375 0.791975830078125 -0.2225 0.011505126953125 0.791975830078125 -0.222625 -0.02691650390625 0.791975830078125 -0.22275 -0.0596923828125 0.791975830078125 -0.222875 -0.093658447265625 0.791975830078125 -0.223 -0.1246337890625 0.791975830078125 -0.223125 -0.14923095703125 0.791975830078125 -0.22325 -0.179046630859375 0.791975830078125 -0.223375 -0.19805908203125 0.791975830078125 -0.2235 -0.21612548828125 0.791975830078125 -0.223625 -0.2303466796875 0.791975830078125 -0.22375 -0.23895263671875 0.791975830078125 -0.223875 -0.254638671875 0.791975830078125 -0.224 -0.257110595703125 0.9999084491282701 -0.224125 -0.257354736328125 0.9999084491282701 -0.22425 -0.254150390625 0.9999084491282701 -0.224375 -0.24749755859375 0.9999084491282701 -0.2245 -0.23846435546875 0.9999084491282701 -0.224625 -0.227020263671875 0.9999084491282701 -0.22475 -0.213287353515625 0.9999084491282701 -0.224875 -0.207366943359375 0.9999084491282701 -0.225 -0.19073486328125 0.9999084491282701 -0.225125 -0.172119140625 0.9999084491282701 -0.22525 -0.153778076171875 0.9999084491282701 -0.225375 -0.13397216796875 0.9999084491282701 -0.2255 -0.114105224609375 0.9999084491282701 -0.225625 -0.0958251953125 0.9999084491282701 -0.22575 -0.076904296875 0.9999084491282701 -0.225875 -0.060272216796875 0.9999084491282701 -0.226 -0.04364013671875 0.9999084491282701 -0.226125 -0.031097412109375 0.9999084491282701 -0.22625 -0.0179443359375 0.9999084491282701 -0.226375 -0.00543212890625 0.9999084491282701 -0.2265 0.00390625 0.9999084491282701 -0.226625 0.012176513671875 0.9999084491282701 -0.22675 0.018157958984375 0.9999084491282701 -0.226875 0.021209716796875 0.9999084491282701 -0.227 0.022705078125 0.9999084491282701 -0.227125 0.021636962890625 0.9999084491282701 -0.22725 0.018951416015625 0.9999084491282701 -0.227375 0.021453857421875 0.9999084491282701 -0.2275 0.015655517578125 0.9999084491282701 -0.227625 0.00848388671875 0.9999084491282701 +0.21875 0.027618408203125 0.791975830078125 +0.218875 0.057220458984375 0.791975830078125 +0.219 0.082427978515625 0.791975830078125 +0.219125 0.108856201171875 0.791975830078125 +0.21925 0.135345458984375 0.791975830078125 +0.219375 0.15545654296875 0.791975830078125 +0.2195 0.17572021484375 0.791975830078125 +0.219625 0.191375732421875 0.791975830078125 +0.21975 0.2064208984375 0.791975830078125 +0.219875 0.222412109375 0.791975830078125 +0.22 0.230743408203125 0.791975830078125 +0.220125 0.237548828125 0.791975830078125 +0.22025 0.24072265625 0.791975830078125 +0.220375 0.2464599609375 0.791975830078125 +0.2205 0.244903564453125 0.791975830078125 +0.220625 0.240692138671875 0.791975830078125 +0.22075 0.234039306640625 0.791975830078125 +0.220875 0.2254638671875 0.791975830078125 +0.221 0.218719482421875 0.791975830078125 +0.221125 0.205322265625 0.791975830078125 +0.22125 0.191314697265625 0.791975830078125 +0.221375 0.174652099609375 0.791975830078125 +0.2215 0.16168212890625 0.791975830078125 +0.221625 0.14239501953125 0.791975830078125 +0.22175 0.122283935546875 0.791975830078125 +0.221875 0.103485107421875 0.791975830078125 +0.222 0.082611083984375 0.791975830078125 +0.222125 0.065277099609375 0.791975830078125 +0.22225 0.044219970703125 0.791975830078125 +0.222375 0.023651123046875 0.791975830078125 +0.2225 0.0057373046875 0.791975830078125 +0.222625 -0.01348876953125 0.791975830078125 +0.22275 -0.029876708984375 0.791975830078125 +0.222875 -0.046844482421875 0.791975830078125 +0.223 -0.062347412109375 0.791975830078125 +0.223125 -0.07464599609375 0.791975830078125 +0.22325 -0.08953857421875 0.791975830078125 +0.223375 -0.09906005859375 0.791975830078125 +0.2235 -0.10809326171875 0.791975830078125 +0.223625 -0.115203857421875 0.791975830078125 +0.22375 -0.1195068359375 0.791975830078125 +0.223875 -0.127349853515625 0.791975830078125 +0.224 -0.128570556640625 0.9999084491282701 +0.224125 -0.128692626953125 0.9999084491282701 +0.22425 -0.127105712890625 0.9999084491282701 +0.224375 -0.123779296875 0.9999084491282701 +0.2245 -0.1192626953125 0.9999084491282701 +0.224625 -0.113525390625 0.9999084491282701 +0.22475 -0.106658935546875 0.9999084491282701 +0.224875 -0.10369873046875 0.9999084491282701 +0.225 -0.09539794921875 0.9999084491282701 +0.225125 -0.086090087890625 0.9999084491282701 +0.22525 -0.076904296875 0.9999084491282701 +0.225375 -0.0670166015625 0.9999084491282701 +0.2255 -0.05706787109375 0.9999084491282701 +0.225625 -0.047943115234375 0.9999084491282701 +0.22575 -0.038482666015625 0.9999084491282701 +0.225875 -0.0301513671875 0.9999084491282701 +0.226 -0.0218505859375 0.9999084491282701 +0.226125 -0.01556396484375 0.9999084491282701 +0.22625 -0.009002685546875 0.9999084491282701 +0.226375 -0.00274658203125 0.9999084491282701 +0.2265 0.001953125 0.9999084491282701 +0.226625 0.006072998046875 0.9999084491282701 +0.22675 0.009063720703125 0.9999084491282701 +0.226875 0.010589599609375 0.9999084491282701 +0.227 0.0113525390625 0.9999084491282701 +0.227125 0.01080322265625 0.9999084491282701 +0.22725 0.00946044921875 0.9999084491282701 +0.227375 0.010711669921875 0.9999084491282701 +0.2275 0.0078125 0.9999084491282701 +0.227625 0.004241943359375 0.9999084491282701 0.22775 0.0 0.9999084491282701 -0.227875 -0.009521484375 0.9999084491282701 -0.228 -0.019866943359375 0.9999084491282701 -0.228125 -0.030609130859375 0.9999084491282701 -0.22825 -0.041534423828125 0.9999084491282701 -0.228375 -0.05224609375 0.9999084491282701 -0.2285 -0.0625 0.9999084491282701 -0.228625 -0.061614990234375 0.9999084491282701 -0.22875 -0.07025146484375 0.9999084491282701 -0.228875 -0.077392578125 0.9999084491282701 -0.229 -0.083343505859375 0.9999084491282701 -0.229125 -0.087005615234375 0.9999084491282701 -0.22925 -0.0885009765625 0.9999084491282701 -0.229375 -0.08856201171875 0.9999084491282701 -0.2295 -0.0853271484375 0.9999084491282701 -0.229625 -0.080780029296875 0.9999084491282701 -0.22975 -0.072418212890625 0.9999084491282701 -0.229875 -0.057525634765625 0.9999084491282701 -0.23 -0.046478271484375 0.9999084491282701 -0.230125 -0.03131103515625 0.9999084491282701 -0.23025 -0.015625 0.9999084491282701 -0.230375 0.00408935546875 0.9999084491282701 -0.2305 0.0260009765625 0.9999084491282701 -0.230625 0.047515869140625 0.9999084491282701 -0.23075 0.072784423828125 0.9999084491282701 -0.230875 0.096954345703125 0.9999084491282701 -0.231 0.124267578125 0.9999084491282701 -0.231125 0.146087646484375 0.9999084491282701 -0.23125 0.17108154296875 0.9999084491282701 -0.231375 0.1978759765625 0.9999084491282701 -0.2315 0.222137451171875 0.9999084491282701 -0.231625 0.24713134765625 0.9999084491282701 -0.23175 0.2705078125 0.9999084491282701 -0.231875 0.2906494140625 0.9999084491282701 -0.232 0.309661865234375 0.9999084491282701 -0.232125 0.325225830078125 0.9999084491282701 -0.23225 0.338348388671875 0.9999084491282701 -0.232375 0.337982177734375 0.9999084491282701 -0.2325 0.34417724609375 0.9999084491282701 -0.232625 0.3460693359375 0.9999084491282701 -0.23275 0.344940185546875 0.9999084491282701 -0.232875 0.338348388671875 0.9999084491282701 -0.233 0.327117919921875 0.9999084491282701 -0.233125 0.313720703125 0.9999084491282701 -0.23325 0.293487548828125 0.9999084491282701 -0.233375 0.271942138671875 0.9999084491282701 -0.2335 0.242919921875 0.9999084491282701 -0.233625 0.205047607421875 0.9999084491282701 -0.23375 0.17279052734375 0.9999084491282701 -0.233875 0.132904052734375 0.9999084491282701 -0.234 0.094329833984375 0.9999084491282701 -0.234125 0.048370361328125 0.9999084491282701 +0.227875 -0.004791259765625 0.9999084491282701 +0.228 -0.00994873046875 0.9999084491282701 +0.228125 -0.01531982421875 0.9999084491282701 +0.22825 -0.020782470703125 0.9999084491282701 +0.228375 -0.026153564453125 0.9999084491282701 +0.2285 -0.031280517578125 0.9999084491282701 +0.228625 -0.03082275390625 0.9999084491282701 +0.22875 -0.03515625 0.9999084491282701 +0.228875 -0.038726806640625 0.9999084491282701 +0.229 -0.04168701171875 0.9999084491282701 +0.229125 -0.04351806640625 0.9999084491282701 +0.22925 -0.044281005859375 0.9999084491282701 +0.229375 -0.0443115234375 0.9999084491282701 +0.2295 -0.042694091796875 0.9999084491282701 +0.229625 -0.0404052734375 0.9999084491282701 +0.22975 -0.036224365234375 0.9999084491282701 +0.229875 -0.028778076171875 0.9999084491282701 +0.23 -0.02325439453125 0.9999084491282701 +0.230125 -0.01568603515625 0.9999084491282701 +0.23025 -0.007843017578125 0.9999084491282701 +0.230375 0.002044677734375 0.9999084491282701 +0.2305 0.01300048828125 0.9999084491282701 +0.230625 0.02374267578125 0.9999084491282701 +0.23075 0.036376953125 0.9999084491282701 +0.230875 0.0484619140625 0.9999084491282701 +0.231 0.0621337890625 0.9999084491282701 +0.231125 0.073028564453125 0.9999084491282701 +0.23125 0.085540771484375 0.9999084491282701 +0.231375 0.09893798828125 0.9999084491282701 +0.2315 0.111053466796875 0.9999084491282701 +0.231625 0.123565673828125 0.9999084491282701 +0.23175 0.13525390625 0.9999084491282701 +0.231875 0.14532470703125 0.9999084491282701 +0.232 0.154815673828125 0.9999084491282701 +0.232125 0.16259765625 0.9999084491282701 +0.23225 0.169158935546875 0.9999084491282701 +0.232375 0.168975830078125 0.9999084491282701 +0.2325 0.172088623046875 0.9999084491282701 +0.232625 0.17303466796875 0.9999084491282701 +0.23275 0.172454833984375 0.9999084491282701 +0.232875 0.169158935546875 0.9999084491282701 +0.233 0.163543701171875 0.9999084491282701 +0.233125 0.1568603515625 0.9999084491282701 +0.23325 0.146728515625 0.9999084491282701 +0.233375 0.135955810546875 0.9999084491282701 +0.2335 0.1214599609375 0.9999084491282701 +0.233625 0.102508544921875 0.9999084491282701 +0.23375 0.086395263671875 0.9999084491282701 +0.233875 0.066436767578125 0.9999084491282701 +0.234 0.047149658203125 0.9999084491282701 +0.234125 0.024169921875 0.9999084491282701 0.23425 0.0 0.9999084491282701 -0.234375 -0.0452880859375 0.9999084491282701 -0.2345 -0.096954345703125 0.9999084491282701 -0.234625 -0.144439697265625 0.9999084491282701 -0.23475 -0.197174072265625 0.9999084491282701 -0.234875 -0.245147705078125 0.9999084491282701 -0.235 -0.291107177734375 0.9999084491282701 -0.235125 -0.34002685546875 0.9999084491282701 -0.23525 -0.38275146484375 0.9999084491282701 -0.235375 -0.4267578125 0.9999084491282701 -0.2355 -0.467132568359375 0.9999084491282701 -0.235625 -0.50067138671875 0.9999084491282701 -0.23575 -0.532684326171875 0.9999084491282701 -0.235875 -0.55780029296875 0.9999084491282701 -0.236 -0.57940673828125 0.9999084491282701 -0.236125 -0.58648681640625 0.9999084491282701 -0.23625 -0.595794677734375 0.9999084491282701 -0.236375 -0.598846435546875 0.9999084491282701 -0.2365 -0.596588134765625 0.9999084491282701 -0.236625 -0.58648681640625 0.9999084491282701 -0.23675 -0.56927490234375 0.9999084491282701 -0.236875 -0.54852294921875 0.9999084491282701 -0.237 -0.518035888671875 0.9999084491282701 -0.237125 -0.4854736328125 0.9999084491282701 -0.23725 -0.442413330078125 0.9999084491282701 -0.237375 -0.38861083984375 0.9999084491282701 -0.2375 -0.34051513671875 0.9999084491282701 -0.237625 -0.281707763671875 0.9999084491282701 -0.23775 -0.22503662109375 0.9999084491282701 -0.237875 -0.157989501953125 0.9999084491282701 -0.238 -0.087615966796875 0.9999084491282701 -0.238125 -0.02215576171875 0.9999084491282701 -0.23825 0.05224609375 0.9999084491282701 -0.238375 0.12030029296875 0.9999084491282701 -0.2385 0.195953369140625 0.9999084491282701 -0.238625 0.268280029296875 0.9999084491282701 -0.23875 0.334075927734375 0.9999084491282701 -0.238875 0.4046630859375 0.9999084491282701 -0.239 0.4658203125 0.9999084491282701 -0.239125 0.529510498046875 0.9999084491282701 -0.23925 0.58837890625 0.9999084491282701 -0.239375 0.637115478515625 0.9999084491282701 -0.2395 0.68475341796875 0.9999084491282701 -0.239625 0.722320556640625 0.9999084491282701 -0.23975 0.75628662109375 0.9999084491282701 -0.239875 0.776031494140625 0.9999084491282701 -0.24 0.792816162109375 0.9999084491282701 -0.240125 0.8026123046875 0.9999084491282701 -0.24025 0.804443359375 0.9999084491282701 -0.240375 0.797149658203125 0.9999084491282701 -0.2405 0.78082275390625 0.9999084491282701 -0.240625 0.7589111328125 0.9999084491282701 -0.24075 0.72552490234375 0.9999084491282701 -0.240875 0.688507080078125 0.9999084491282701 -0.241 0.6390380859375 0.9999084491282701 -0.241125 0.577850341796875 0.9999084491282701 -0.24125 0.520782470703125 0.9999084491282701 -0.241375 0.45062255859375 0.9999084491282701 -0.2415 0.38262939453125 0.9999084491282701 -0.241625 0.301788330078125 0.9999084491282701 -0.24175 0.216583251953125 0.9999084491282701 -0.241875 0.136993408203125 0.9999084491282701 -0.242 0.046051025390625 0.9999084491282701 -0.242125 -0.03704833984375 0.9999084491282701 -0.24225 -0.130096435546875 0.9999084491282701 -0.242375 -0.22149658203125 0.9999084491282701 -0.2425 -0.303314208984375 0.9999084491282701 -0.242625 -0.391754150390625 0.9999084491282701 -0.24275 -0.4686279296875 0.9999084491282701 -0.242875 -0.549560546875 0.9999084491282701 -0.243 -0.625244140625 0.9999084491282701 -0.243125 -0.688262939453125 0.9999084491282701 -0.24325 -0.75128173828125 0.9999084491282701 -0.243375 -0.80169677734375 0.9999084491282701 -0.2435 -0.8492431640625 0.9999084491282701 -0.243625 -0.85479736328125 0.9999084491282701 -0.24375 -0.85504150390625 0.9999084491282701 -0.243875 -0.855224609375 0.9999084491282701 -0.244 -0.855316162109375 0.9999084491282701 -0.244125 -0.855316162109375 0.9999084491282701 -0.24425 -0.855224609375 0.9999084491282701 -0.244375 -0.855072021484375 0.9999084491282701 -0.2445 -0.854766845703125 0.9999084491282701 -0.244625 -0.848236083984375 0.9999084491282701 -0.24475 -0.7996826171875 0.9999084491282701 -0.244875 -0.739776611328125 0.9999084491282701 -0.245 -0.680908203125 0.9999084491282701 -0.245125 -0.60772705078125 0.9999084491282701 -0.24525 -0.535858154296875 0.9999084491282701 -0.245375 -0.4498291015625 0.9999084491282701 -0.2455 -0.358306884765625 0.9999084491282701 -0.245625 -0.272186279296875 0.9999084491282701 -0.24575 -0.173126220703125 0.9999084491282701 -0.245875 -0.081939697265625 0.9999084491282701 -0.246 0.0205078125 0.9999084491282701 -0.246125 0.123046875 0.9999084491282701 -0.24625 0.214599609375 0.9999084491282701 -0.246375 0.314422607421875 0.9999084491282701 -0.2465 0.401641845703125 0.9999084491282701 -0.246625 0.494537353515625 0.9999084491282701 -0.24675 0.582183837890625 0.9999084491282701 -0.246875 0.655975341796875 0.9999084491282701 -0.247 0.731048583984375 0.9999084491282701 -0.247125 0.7919921875 0.9999084491282701 -0.24725 0.851409912109375 0.9999084491282701 -0.247375 0.85491943359375 0.9999084491282701 -0.2475 0.855255126953125 0.9999084491282701 -0.247625 0.855560302734375 0.9999084491282701 -0.24775 0.855743408203125 0.9999084491282701 -0.247875 0.8558349609375 0.9999084491282701 -0.248 0.8558349609375 0.9999084491282701 -0.248125 0.855743408203125 0.9999084491282701 -0.24825 0.85552978515625 0.9999084491282701 -0.248375 0.855255126953125 0.9999084491282701 -0.2485 0.8548583984375 0.9999084491282701 -0.248625 0.844207763671875 0.9999084491282701 -0.24875 0.78997802734375 0.9999084491282701 -0.248875 0.721435546875 0.9999084491282701 -0.249 0.6529541015625 0.9999084491282701 -0.249125 0.570068359375 0.9999084491282701 -0.24925 0.480987548828125 0.9999084491282701 -0.249375 0.396270751953125 0.9999084491282701 -0.2495 0.29815673828125 0.9999084491282701 -0.249625 0.20709228515625 0.9999084491282701 -0.24975 0.10400390625 0.9999084491282701 +0.234375 -0.022674560546875 0.9999084491282701 +0.2345 -0.048492431640625 0.9999084491282701 +0.234625 -0.072235107421875 0.9999084491282701 +0.23475 -0.098602294921875 0.9999084491282701 +0.234875 -0.122589111328125 0.9999084491282701 +0.235 -0.14556884765625 0.9999084491282701 +0.235125 -0.1700439453125 0.9999084491282701 +0.23525 -0.19140625 0.9999084491282701 +0.235375 -0.213409423828125 0.9999084491282701 +0.2355 -0.23358154296875 0.9999084491282701 +0.235625 -0.2503662109375 0.9999084491282701 +0.23575 -0.266357421875 0.9999084491282701 +0.235875 -0.2789306640625 0.9999084491282701 +0.236 -0.28973388671875 0.9999084491282701 +0.236125 -0.29327392578125 0.9999084491282701 +0.23625 -0.29791259765625 0.9999084491282701 +0.236375 -0.2994384765625 0.9999084491282701 +0.2365 -0.298309326171875 0.9999084491282701 +0.236625 -0.29327392578125 0.9999084491282701 +0.23675 -0.28466796875 0.9999084491282701 +0.236875 -0.2742919921875 0.9999084491282701 +0.237 -0.259033203125 0.9999084491282701 +0.237125 -0.242767333984375 0.9999084491282701 +0.23725 -0.221221923828125 0.9999084491282701 +0.237375 -0.1943359375 0.9999084491282701 +0.2375 -0.1702880859375 0.9999084491282701 +0.237625 -0.140869140625 0.9999084491282701 +0.23775 -0.112548828125 0.9999084491282701 +0.237875 -0.079010009765625 0.9999084491282701 +0.238 -0.0438232421875 0.9999084491282701 +0.238125 -0.0111083984375 0.9999084491282701 +0.23825 0.026123046875 0.9999084491282701 +0.238375 0.060150146484375 0.9999084491282701 +0.2385 0.09796142578125 0.9999084491282701 +0.238625 0.134124755859375 0.9999084491282701 +0.23875 0.167022705078125 0.9999084491282701 +0.238875 0.20233154296875 0.9999084491282701 +0.239 0.23291015625 0.9999084491282701 +0.239125 0.264739990234375 0.9999084491282701 +0.23925 0.294189453125 0.9999084491282701 +0.239375 0.31854248046875 0.9999084491282701 +0.2395 0.342376708984375 0.9999084491282701 +0.239625 0.36114501953125 0.9999084491282701 +0.23975 0.378143310546875 0.9999084491282701 +0.239875 0.38800048828125 0.9999084491282701 +0.24 0.396392822265625 0.9999084491282701 +0.240125 0.40130615234375 0.9999084491282701 +0.24025 0.4022216796875 0.9999084491282701 +0.240375 0.3985595703125 0.9999084491282701 +0.2405 0.390411376953125 0.9999084491282701 +0.240625 0.37945556640625 0.9999084491282701 +0.24075 0.362762451171875 0.9999084491282701 +0.240875 0.34423828125 0.9999084491282701 +0.241 0.31951904296875 0.9999084491282701 +0.241125 0.288909912109375 0.9999084491282701 +0.24125 0.2603759765625 0.9999084491282701 +0.241375 0.225311279296875 0.9999084491282701 +0.2415 0.191314697265625 0.9999084491282701 +0.241625 0.15087890625 0.9999084491282701 +0.24175 0.1082763671875 0.9999084491282701 +0.241875 0.0684814453125 0.9999084491282701 +0.242 0.02301025390625 0.9999084491282701 +0.242125 -0.0185546875 0.9999084491282701 +0.24225 -0.0650634765625 0.9999084491282701 +0.242375 -0.11077880859375 0.9999084491282701 +0.2425 -0.15167236328125 0.9999084491282701 +0.242625 -0.195892333984375 0.9999084491282701 +0.24275 -0.234344482421875 0.9999084491282701 +0.242875 -0.274810791015625 0.9999084491282701 +0.243 -0.312652587890625 0.9999084491282701 +0.243125 -0.344146728515625 0.9999084491282701 +0.24325 -0.37567138671875 0.9999084491282701 +0.243375 -0.40087890625 0.9999084491282701 +0.2435 -0.424652099609375 0.9999084491282701 +0.243625 -0.44207763671875 0.9999084491282701 +0.24375 -0.455474853515625 0.9999084491282701 +0.243875 -0.4654541015625 0.9999084491282701 +0.244 -0.47027587890625 0.9999084491282701 +0.244125 -0.470489501953125 0.9999084491282701 +0.24425 -0.465423583984375 0.9999084491282701 +0.244375 -0.456573486328125 0.9999084491282701 +0.2445 -0.44171142578125 0.9999084491282701 +0.244625 -0.42413330078125 0.9999084491282701 +0.24475 -0.399871826171875 0.9999084491282701 +0.244875 -0.369903564453125 0.9999084491282701 +0.245 -0.340484619140625 0.9999084491282701 +0.245125 -0.30389404296875 0.9999084491282701 +0.24525 -0.2679443359375 0.9999084491282701 +0.245375 -0.224945068359375 0.9999084491282701 +0.2455 -0.179168701171875 0.9999084491282701 +0.245625 -0.1361083984375 0.9999084491282701 +0.24575 -0.086578369140625 0.9999084491282701 +0.245875 -0.040985107421875 0.9999084491282701 +0.246 0.01025390625 0.9999084491282701 +0.246125 0.0615234375 0.9999084491282701 +0.24625 0.1072998046875 0.9999084491282701 +0.246375 0.157196044921875 0.9999084491282701 +0.2465 0.2008056640625 0.9999084491282701 +0.246625 0.24725341796875 0.9999084491282701 +0.24675 0.29107666015625 0.9999084491282701 +0.246875 0.327972412109375 0.9999084491282701 +0.247 0.365509033203125 0.9999084491282701 +0.247125 0.39599609375 0.9999084491282701 +0.24725 0.425689697265625 0.9999084491282701 +0.247375 0.4503173828125 0.9999084491282701 +0.2475 0.46868896484375 0.9999084491282701 +0.247625 0.48419189453125 0.9999084491282701 +0.24775 0.493560791015625 0.9999084491282701 +0.247875 0.498809814453125 0.9999084491282701 +0.248 0.498504638671875 0.9999084491282701 +0.248125 0.493499755859375 0.9999084491282701 +0.24825 0.482757568359375 0.9999084491282701 +0.248375 0.468536376953125 0.9999084491282701 +0.2485 0.447784423828125 0.9999084491282701 +0.248625 0.422088623046875 0.9999084491282701 +0.24875 0.394989013671875 0.9999084491282701 +0.248875 0.3607177734375 0.9999084491282701 +0.249 0.32647705078125 0.9999084491282701 +0.249125 0.2850341796875 0.9999084491282701 +0.24925 0.240478515625 0.9999084491282701 +0.249375 0.1981201171875 0.9999084491282701 +0.2495 0.149078369140625 0.9999084491282701 +0.249625 0.103546142578125 0.9999084491282701 +0.24975 0.052001953125 0.9999084491282701 0.249875 0.0 0.9999084491282701 -0.25 -0.093505859375 0.9999084491282701 -0.250125 -0.196258544921875 0.9999084491282701 -0.25025 -0.286651611328125 0.9999084491282701 -0.250375 -0.383819580078125 0.9999084491282701 -0.2505 -0.476470947265625 0.9999084491282701 -0.250625 -0.555023193359375 0.9999084491282701 -0.25075 -0.63629150390625 0.9999084491282701 -0.250875 -0.70306396484375 0.9999084491282701 -0.251 -0.7696533203125 0.9999084491282701 -0.251125 -0.8292236328125 0.9999084491282701 -0.25125 -0.85467529296875 0.9999084491282701 -0.251375 -0.855072021484375 0.9999084491282701 -0.2515 -0.855316162109375 0.9999084491282701 -0.251625 -0.855499267578125 0.9999084491282701 -0.25175 -0.8555908203125 0.9999084491282701 -0.251875 -0.8555908203125 0.9999084491282701 -0.252 -0.85546875 0.9999084491282701 -0.252125 -0.85528564453125 0.9999084491282701 -0.25225 -0.855010986328125 0.9999084491282701 -0.252375 -0.854644775390625 0.9999084491282701 -0.2525 -0.8238525390625 0.9999084491282701 -0.252625 -0.76593017578125 0.9999084491282701 -0.25275 -0.706634521484375 0.9999084491282701 -0.252875 -0.634033203125 0.9999084491282701 -0.253 -0.554931640625 0.9999084491282701 -0.253125 -0.478851318359375 0.9999084491282701 -0.25325 -0.39007568359375 0.9999084491282701 -0.253375 -0.306915283203125 0.9999084491282701 -0.2535 -0.212249755859375 0.9999084491282701 -0.253625 -0.116455078125 0.9999084491282701 -0.2537500000000001 -0.029022216796875 0.9999084491282701 -0.253875 0.06744384765625 0.9999084491282701 -0.254 0.152984619140625 0.9999084491282701 -0.254125 0.245574951171875 0.9999084491282701 -0.25425 0.334625244140625 0.9999084491282701 -0.254375 0.410675048828125 0.9999084491282701 -0.2545 0.490264892578125 0.9999084491282701 -0.254625 0.556243896484375 0.9999084491282701 -0.25475 0.623260498046875 0.9999084491282701 -0.254875 0.6864013671875 0.9999084491282701 -0.255 0.732818603515625 0.9999084491282701 -0.255125 0.77655029296875 0.9999084491282701 -0.25525 0.80767822265625 0.9999084491282701 -0.255375 0.833892822265625 0.9999084491282701 -0.2555 0.85052490234375 0.9999084491282701 -0.255625 0.8544921875 0.9999084491282701 -0.25575 0.8544921875 0.9999084491282701 -0.255875 0.8450927734375 0.9999084491282701 +0.25 -0.046783447265625 0.9999084491282701 +0.250125 -0.09814453125 0.9999084491282701 +0.25025 -0.143341064453125 0.9999084491282701 +0.250375 -0.191925048828125 0.9999084491282701 +0.2505 -0.238250732421875 0.9999084491282701 +0.250625 -0.27752685546875 0.9999084491282701 +0.25075 -0.31817626953125 0.9999084491282701 +0.250875 -0.3515625 0.9999084491282701 +0.251 -0.384857177734375 0.9999084491282701 +0.251125 -0.414642333984375 0.9999084491282701 +0.25125 -0.4366455078125 0.9999084491282701 +0.251375 -0.456512451171875 0.9999084491282701 +0.2515 -0.46990966796875 0.9999084491282701 +0.251625 -0.47991943359375 0.9999084491282701 +0.25175 -0.48455810546875 0.9999084491282701 +0.251875 -0.483978271484375 0.9999084491282701 +0.252 -0.478424072265625 0.9999084491282701 +0.252125 -0.468780517578125 0.9999084491282701 +0.25225 -0.453369140625 0.9999084491282701 +0.252375 -0.43438720703125 0.9999084491282701 +0.2525 -0.411956787109375 0.9999084491282701 +0.252625 -0.38299560546875 0.9999084491282701 +0.25275 -0.35333251953125 0.9999084491282701 +0.252875 -0.317047119140625 0.9999084491282701 +0.253 -0.277496337890625 0.9999084491282701 +0.253125 -0.23944091796875 0.9999084491282701 +0.25325 -0.195068359375 0.9999084491282701 +0.253375 -0.153472900390625 0.9999084491282701 +0.2535 -0.10614013671875 0.9999084491282701 +0.253625 -0.058258056640625 0.9999084491282701 +0.2537500000000001 -0.0145263671875 0.9999084491282701 +0.253875 0.033721923828125 0.9999084491282701 +0.254 0.07647705078125 0.9999084491282701 +0.254125 0.122772216796875 0.9999084491282701 +0.25425 0.16729736328125 0.9999084491282701 +0.254375 0.205322265625 0.9999084491282701 +0.2545 0.2451171875 0.9999084491282701 +0.254625 0.278106689453125 0.9999084491282701 +0.25475 0.311614990234375 0.9999084491282701 +0.254875 0.34320068359375 0.9999084491282701 +0.255 0.36639404296875 0.9999084491282701 +0.255125 0.388275146484375 0.9999084491282701 +0.25525 0.403839111328125 0.9999084491282701 +0.255375 0.41693115234375 0.9999084491282701 +0.2555 0.425262451171875 0.9999084491282701 +0.255625 0.428375244140625 0.9999084491282701 +0.25575 0.427581787109375 0.9999084491282701 +0.255875 0.42254638671875 0.9999084491282701 diff --git a/tests/circuitpython/synthesizer.py.exp b/tests/circuitpython/synthesizer.py.exp index 98f45f8bf8..fb2e8c07bd 100644 --- a/tests/circuitpython/synthesizer.py.exp +++ b/tests/circuitpython/synthesizer.py.exp @@ -1,30 +1,30 @@ () [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (80,) -[-16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383, 16383, 16383, 16383, 16383, 16383, -16383, -16383, -16383, -16383, -16383] +[-16384, -16384, -16384, -16384, 16383, 16383, 16383, 16383, 16383, -16384, -16384, -16384, -16384, -16384, 16383, 16383, 16383, 16383, 16383, -16384, -16384, -16384, -16384, -16384] (80, 91) -[0, 0, 28045, 28045, 0, -28046, -28046, 0, 28045, 28045, 0, 0, 28045, 0, 0, -28046, -28046, 0, 28045, 28045, 0, 0, 28045, 0] +[-1, -1, 28045, 28045, -1, -28046, -28046, -1, 28045, 28045, -1, -1, 28045, -1, -1, -28046, -28046, -1, 28045, 28045, -1, -1, 28045, -1] (91,) -[-28046, 0, 0, 28045, 0, 0, 28045, 28045, 0, -28046, -28046, 0, 28045, 28045, 0, 0, 28045, 0, 0, -28046, -28046, -28046, 28045, 28045] -(-5242, 5242) +[-28046, -1, -1, 28045, -1, -1, 28045, 28045, -1, -28046, -28046, -1, 28045, 28045, -1, -1, 28045, -1, -1, -28046, -28046, -28046, 28045, 28045] +(-5243, 5242) (-10485, 10484) -(-15727, 15727) -(-16383, 16383) -(-14286, 14286) -(-13106, 13106) -(-13106, 13106) -(-13106, 13106) -(-13106, 13106) -(-13106, 13106) -(-13106, 13106) -(-13106, 13106) -(-13106, 13106) -(-11009, 11009) -(-8912, 8912) -(-6815, 6815) -(-4718, 4718) -(-2621, 2621) -(-524, 524) +(-15728, 15727) +(-16384, 16383) +(-14287, 14286) +(-13107, 13106) +(-13107, 13106) +(-13107, 13106) +(-13107, 13106) +(-13107, 13106) +(-13107, 13106) +(-13107, 13106) +(-13107, 13106) +(-11010, 11009) +(-8913, 8912) +(-6816, 6815) +(-4719, 4718) +(-2622, 2621) +(-525, 524) (0, 0) (0, 0) (0, 0) diff --git a/tests/circuitpython/synthesizer_note.py.exp b/tests/circuitpython/synthesizer_note.py.exp index 0c2af86681..24b517ce96 100644 --- a/tests/circuitpython/synthesizer_note.py.exp +++ b/tests/circuitpython/synthesizer_note.py.exp @@ -7,7 +7,7 @@ (Note(frequency=830.6076004423605, panning=0.0, amplitude=1.0, bend=0.0, waveform=None, envelope=None, filter=None, ring_frequency=0.0, ring_bend=0.0, ring_waveform=None),) [-1, -1, -1, 28045, -1, -1, -1, -1, -1, -1, -1, -1, 28045, -1, -1, -1, -1, -28046, -1, -1, -1, -1, 28045, -1] (-5242, 5241) -(-10484, 10484) +(-10485, 10484) (-15727, 15726) (-16383, 16382) (-14286, 14285) From 4ad54b285378744a796a2ad2c25e83ab8e12573e Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 31 May 2023 20:57:17 -0500 Subject: [PATCH 1165/1712] debugging prints. add rendered_hidden field to tilegrid --- shared-module/displayio/Display.c | 3 +++ shared-module/displayio/Group.c | 8 +++++--- shared-module/displayio/TileGrid.c | 25 +++++++++++++++++++------ shared-module/displayio/TileGrid.h | 3 +++ 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 093604214d..ae2b4efe6b 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -330,7 +330,10 @@ STATIC void _refresh_display(displayio_display_obj_t *self) { return; } const displayio_area_t *current_area = _get_refresh_areas(self); + int i = 0; while (current_area != NULL) { + mp_printf(&mp_plat_print, "calling refresh area: %d \n", i); + i = i + 1; _refresh_area(self, current_area); current_area = current_area->next; } diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index bd62280c96..3cdb32ca2f 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -438,7 +438,7 @@ void displayio_group_finish_refresh(displayio_group_t *self) { } displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, displayio_area_t *tail) { - if (! self->hidden){ + //if (! self->hidden){ if (self->item_removed) { self->dirty_area.next = tail; tail = &self->dirty_area; @@ -457,8 +457,10 @@ displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, dis layer = mp_obj_cast_to_native_base( self->members->items[i], &displayio_tilegrid_type); if (layer != MP_OBJ_NULL) { - if (!common_hal_displayio_tilegrid_get_hidden(layer)){ + if (!displayio_tilegrid_get_rendered_hidden(layer)) { + //if (!common_hal_displayio_tilegrid_get_hidden(layer)){ tail = displayio_tilegrid_get_refresh_areas(layer, tail); + //} } continue; } @@ -468,7 +470,7 @@ displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, dis tail = displayio_group_get_refresh_areas(layer, tail); continue; } - } + // } } return tail; diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index 723aa41682..fd972a9b5e 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -82,10 +82,16 @@ bool common_hal_displayio_tilegrid_get_hidden(displayio_tilegrid_t *self) { return self->hidden; } +bool displayio_tilegrid_get_rendered_hidden(displayio_tilegrid_t *self) { + return self->rendered_hidden; +} + void common_hal_displayio_tilegrid_set_hidden(displayio_tilegrid_t *self, bool hidden) { self->hidden = hidden; if (!hidden) { self->full_change = true; + }else{ + self->rendered_hidden = false; } } @@ -578,16 +584,23 @@ void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) { } displayio_area_t *displayio_tilegrid_get_refresh_areas(displayio_tilegrid_t *self, displayio_area_t *tail) { + //mp_printf(&mp_plat_print, "x1 : %d x2: %d \n", self->previous_area.x1, self->previous_area.x2); bool first_draw = self->previous_area.x1 == self->previous_area.x2; bool hidden = self->hidden || self->hidden_by_parent; + //mp_printf(&mp_plat_print, "first draw: %d\n", first_draw); // Check hidden first because it trumps all other changes. if (hidden) { - if (!first_draw) { - self->previous_area.next = tail; - return &self->previous_area; - } else { - return tail; - } + //mp_printf(&mp_plat_print, "rendered_hidden: %d\n", self->rendered_hidden); + //if (!self->rendered_hidden){ + self->rendered_hidden = true; + if (!first_draw) { + self->previous_area.next = tail; + return &self->previous_area; + } else { + return tail; + } + //} + } else if (self->moved && !first_draw) { displayio_area_union(&self->previous_area, &self->current_area, &self->dirty_area); if (displayio_area_size(&self->dirty_area) <= 2U * self->pixel_width * self->pixel_height) { diff --git a/shared-module/displayio/TileGrid.h b/shared-module/displayio/TileGrid.h index b5aab51348..4f5cfbc62f 100644 --- a/shared-module/displayio/TileGrid.h +++ b/shared-module/displayio/TileGrid.h @@ -66,6 +66,7 @@ typedef struct { bool transpose_xy : 1; bool hidden : 1; bool hidden_by_parent : 1; + bool rendered_hidden : 1; uint8_t padding : 6; } displayio_tilegrid_t; @@ -86,4 +87,6 @@ void displayio_tilegrid_update_transform(displayio_tilegrid_t *group, const disp bool displayio_tilegrid_get_previous_area(displayio_tilegrid_t *self, displayio_area_t *area); void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self); +bool displayio_tilegrid_get_rendered_hidden(displayio_tilegrid_t *self); + #endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_TILEGRID_H From f8948c2718ec5a3d72c9363b39be05a4916b0620 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 31 May 2023 20:58:04 -0500 Subject: [PATCH 1166/1712] format --- shared-module/displayio/TileGrid.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index fd972a9b5e..18f22629ab 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -90,7 +90,7 @@ void common_hal_displayio_tilegrid_set_hidden(displayio_tilegrid_t *self, bool h self->hidden = hidden; if (!hidden) { self->full_change = true; - }else{ + } else { self->rendered_hidden = false; } } @@ -584,22 +584,22 @@ void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) { } displayio_area_t *displayio_tilegrid_get_refresh_areas(displayio_tilegrid_t *self, displayio_area_t *tail) { - //mp_printf(&mp_plat_print, "x1 : %d x2: %d \n", self->previous_area.x1, self->previous_area.x2); + // mp_printf(&mp_plat_print, "x1 : %d x2: %d \n", self->previous_area.x1, self->previous_area.x2); bool first_draw = self->previous_area.x1 == self->previous_area.x2; bool hidden = self->hidden || self->hidden_by_parent; - //mp_printf(&mp_plat_print, "first draw: %d\n", first_draw); + // mp_printf(&mp_plat_print, "first draw: %d\n", first_draw); // Check hidden first because it trumps all other changes. if (hidden) { - //mp_printf(&mp_plat_print, "rendered_hidden: %d\n", self->rendered_hidden); - //if (!self->rendered_hidden){ - self->rendered_hidden = true; - if (!first_draw) { - self->previous_area.next = tail; - return &self->previous_area; - } else { - return tail; - } - //} + // mp_printf(&mp_plat_print, "rendered_hidden: %d\n", self->rendered_hidden); + // if (!self->rendered_hidden){ + self->rendered_hidden = true; + if (!first_draw) { + self->previous_area.next = tail; + return &self->previous_area; + } else { + return tail; + } + // } } else if (self->moved && !first_draw) { displayio_area_union(&self->previous_area, &self->current_area, &self->dirty_area); From 4712a9d301ee43aef6e37194f69651fb76ccfb6e Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 31 May 2023 21:00:02 -0500 Subject: [PATCH 1167/1712] remove old conditions --- shared-module/displayio/Group.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index 3cdb32ca2f..29ea340c00 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -438,7 +438,6 @@ void displayio_group_finish_refresh(displayio_group_t *self) { } displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, displayio_area_t *tail) { - //if (! self->hidden){ if (self->item_removed) { self->dirty_area.next = tail; tail = &self->dirty_area; @@ -458,9 +457,7 @@ displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, dis self->members->items[i], &displayio_tilegrid_type); if (layer != MP_OBJ_NULL) { if (!displayio_tilegrid_get_rendered_hidden(layer)) { - //if (!common_hal_displayio_tilegrid_get_hidden(layer)){ tail = displayio_tilegrid_get_refresh_areas(layer, tail); - //} } continue; } @@ -470,7 +467,6 @@ displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, dis tail = displayio_group_get_refresh_areas(layer, tail); continue; } - // } } return tail; From 31f2faa977235f051ed4f71e411996d572fea4eb Mon Sep 17 00:00:00 2001 From: tomiahola <59969326+tomiahola@users.noreply.github.com> Date: Thu, 1 Jun 2023 08:36:25 +0300 Subject: [PATCH 1168/1712] SAM E54 Xplained Pro: add support for SST26VF064B flash chip --- ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk b/ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk index 53aac7df2a..449023893f 100644 --- a/ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk +++ b/ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk @@ -7,7 +7,7 @@ CHIP_VARIANT = SAME54P20A CHIP_FAMILY = same54 QSPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICES = "N25Q256A" +EXTERNAL_FLASH_DEVICES = "N25Q256A", "SST26VF064B" LONGINT_IMPL = MPZ CIRCUITPY_SDIOIO = 1 From f2f19e93ec9188b2cedb35224d260a8106621257 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 1 Jun 2023 09:47:30 -0700 Subject: [PATCH 1169/1712] Fix listing --- ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk b/ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk index 449023893f..d5038030e4 100644 --- a/ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk +++ b/ports/atmel-samd/boards/same54_xplained/mpconfigboard.mk @@ -7,7 +7,7 @@ CHIP_VARIANT = SAME54P20A CHIP_FAMILY = same54 QSPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICES = "N25Q256A", "SST26VF064B" +EXTERNAL_FLASH_DEVICES = "N25Q256A,SST26VF064B" LONGINT_IMPL = MPZ CIRCUITPY_SDIOIO = 1 From 6fd700eb11879662baad81b66d1ef2b659be750a Mon Sep 17 00:00:00 2001 From: Pierre Constantineau Date: Thu, 1 Jun 2023 10:56:43 -0600 Subject: [PATCH 1170/1712] added HW_LED_STATUS as requested --- ports/nrf/boards/pca10100/mpconfigboard.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/nrf/boards/pca10100/mpconfigboard.h b/ports/nrf/boards/pca10100/mpconfigboard.h index 31b5a350fb..8b1ff19a89 100644 --- a/ports/nrf/boards/pca10100/mpconfigboard.h +++ b/ports/nrf/boards/pca10100/mpconfigboard.h @@ -30,6 +30,8 @@ #define MICROPY_HW_BOARD_NAME "PCA10100 nRF52833 DK" #define MICROPY_HW_MCU_NAME "nRF52833" +#define MICROPY_HW_LED_STATUS (&pin_P0_13) + #define CIRCUITPY_INTERNAL_NVM_SIZE 0 #define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE (60 * 1024) From 2fb42579e8aab930a68920aa44ec21df5e0d98bc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 17 Nov 2022 09:46:08 -0600 Subject: [PATCH 1171/1712] Add minimally tested Adafruit MatrixPortal S3 board def tested: * board.LED * neopixel as status LED * i2c scan finds lis3dh sensor * psram capacity not tested: * rgb matrix o_O * the gpio pins Introduce new `board` properties for matrixportal-style boards: * MTX_COMMON * MTX_ADDRESS These are intended to simplify use of the RGBMatrix constructor: ```py matrix = RGBMatrix(..., addr_pins=MTX_ADDRESS[:3], **MTX_COMMON) ``` removing the need for sending in the following individual parameters: * rgb_pins * clock_pin * latch_pin * output_enable_pins and making construction of a 16/32/64-row display easy by slicing a tuple of all address pins rather than writing out the individual pins. If it works out it'll be ported back to the matrixportal m4 as well. --- .../boards/adafruit_matrixportal_s3/board.c | 34 +++++++ .../adafruit_matrixportal_s3/mpconfigboard.h | 42 +++++++++ .../adafruit_matrixportal_s3/mpconfigboard.mk | 12 +++ .../boards/adafruit_matrixportal_s3/pins.c | 94 +++++++++++++++++++ .../boards/adafruit_matrixportal_s3/sdkconfig | 39 ++++++++ 5 files changed, 221 insertions(+) create mode 100644 ports/espressif/boards/adafruit_matrixportal_s3/board.c create mode 100644 ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.h create mode 100644 ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.mk create mode 100644 ports/espressif/boards/adafruit_matrixportal_s3/pins.c create mode 100644 ports/espressif/boards/adafruit_matrixportal_s3/sdkconfig diff --git a/ports/espressif/boards/adafruit_matrixportal_s3/board.c b/ports/espressif/boards/adafruit_matrixportal_s3/board.c new file mode 100644 index 0000000000..a023845eb0 --- /dev/null +++ b/ports/espressif/boards/adafruit_matrixportal_s3/board.c @@ -0,0 +1,34 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" +#include "components/hal/include/hal/gpio_hal.h" +#include "common-hal/microcontroller/Pin.h" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.h b/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.h new file mode 100644 index 0000000000..8854729aae --- /dev/null +++ b/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.h @@ -0,0 +1,42 @@ +/* + * 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 "Adafruit MatrixPortal S3" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO4) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO17) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO16) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO8) +#define DEFAULT_UART_BUS_TX (&pin_GPIO18) + +#define DOUBLE_TAP_PIN (&pin_GPIO1) diff --git a/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.mk b/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.mk new file mode 100644 index 0000000000..0c681bf5a3 --- /dev/null +++ b/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.mk @@ -0,0 +1,12 @@ +USB_VID = 0x239A +USB_PID = 0x8126 +USB_PRODUCT = "MatrixPortal S3" +USB_MANUFACTURER = "Adafruit" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/adafruit_matrixportal_s3/pins.c b/ports/espressif/boards/adafruit_matrixportal_s3/pins.c new file mode 100644 index 0000000000..8284047aae --- /dev/null +++ b/ports/espressif/boards/adafruit_matrixportal_s3/pins.c @@ -0,0 +1,94 @@ +#include "py/objtuple.h" +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_obj_tuple_t matrix_addr_tuple = { + {&mp_type_tuple}, + 5, + { + MP_ROM_PTR(&pin_GPIO35), + MP_ROM_PTR(&pin_GPIO36), + MP_ROM_PTR(&pin_GPIO48), + MP_ROM_PTR(&pin_GPIO45), + MP_ROM_PTR(&pin_GPIO21), + } +}; + +STATIC const mp_rom_obj_tuple_t matrix_data_tuple = { + {&mp_type_tuple}, + 6, + { + MP_ROM_PTR(&pin_GPIO42), + MP_ROM_PTR(&pin_GPIO41), + MP_ROM_PTR(&pin_GPIO40), + + MP_ROM_PTR(&pin_GPIO38), + MP_ROM_PTR(&pin_GPIO39), + MP_ROM_PTR(&pin_GPIO37), + } +}; + +STATIC const mp_rom_map_elem_t matrix_common_table[] = { + { MP_OBJ_NEW_QSTR(MP_QSTR_rgb_pins),MP_ROM_PTR(&matrix_data_tuple) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_clock_pin),MP_ROM_PTR(&pin_GPIO2) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_latch_pin),MP_ROM_PTR(&pin_GPIO47) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_output_enable_pin),MP_ROM_PTR(&pin_GPIO14) }, +}; +MP_DEFINE_CONST_DICT(matrix_common_dict, matrix_common_table); + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + { 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_A4), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRESS),MP_ROM_PTR(&matrix_addr_tuple) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_COMMON),MP_ROM_PTR(&matrix_common_dict) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_R1),MP_ROM_PTR(&pin_GPIO42) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_G1),MP_ROM_PTR(&pin_GPIO41) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_B1),MP_ROM_PTR(&pin_GPIO40) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_R2),MP_ROM_PTR(&pin_GPIO38) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_G2),MP_ROM_PTR(&pin_GPIO39) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_B2),MP_ROM_PTR(&pin_GPIO37) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRA),MP_ROM_PTR(&pin_GPIO35) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRB),MP_ROM_PTR(&pin_GPIO36) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRC),MP_ROM_PTR(&pin_GPIO48) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRD),MP_ROM_PTR(&pin_GPIO45) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRE),MP_ROM_PTR(&pin_GPIO21) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_CLK),MP_ROM_PTR(&pin_GPIO2) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_LAT),MP_ROM_PTR(&pin_GPIO47) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_OE),MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_matrixportal_s3/sdkconfig b/ports/espressif/boards/adafruit_matrixportal_s3/sdkconfig new file mode 100644 index 0000000000..2b65102e5a --- /dev/null +++ b/ports/espressif/boards/adafruit_matrixportal_s3/sdkconfig @@ -0,0 +1,39 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +CONFIG_LWIP_LOCAL_HOSTNAME="matrixportal-s3" From ce84ecf3f672f61f62b184b77d05d0bc38c458f9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 1 Jun 2023 18:57:18 -0500 Subject: [PATCH 1172/1712] Fix flash size --- .../espressif/boards/adafruit_matrixportal_s3/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.mk b/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.mk index 0c681bf5a3..865fc06d96 100644 --- a/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.mk @@ -7,6 +7,6 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP32_CAMERA = 0 From a1ea6331db965560ebfa06d31f4d5e50d669d1ae Mon Sep 17 00:00:00 2001 From: Ettore Atalan Date: Thu, 1 Jun 2023 20:03:33 +0000 Subject: [PATCH 1173/1712] Translated using Weblate (German) Currently translated at 99.5% (993 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/de/ --- locale/de_DE.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/de_DE.po b/locale/de_DE.po index 6bca238bd0..b4b6af060c 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-05-28 17:49+0000\n" +"PO-Revision-Date: 2023-06-02 20:48+0000\n" "Last-Translator: Ettore Atalan \n" "Language: de_DE\n" "MIME-Version: 1.0\n" @@ -2544,7 +2544,7 @@ msgstr "Die Annotation muss ein Bezeichner sein" #: extmod/ulab/code/numpy/create.c msgid "arange: cannot compute length" -msgstr "" +msgstr "arange: kann Länge nicht berechnen" #: py/modbuiltins.c msgid "arg is an empty sequence" From 38f6fa27e344461b64c4c77b0bacdbc2261f684a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 5 Jun 2023 17:16:25 -0400 Subject: [PATCH 1174/1712] fetch-port-submodules; fetch-all-submodules --- BUILDING.md | 6 +++++- Makefile | 26 +++++++------------------- ports/atmel-samd/Makefile | 4 ++++ ports/broadcom/Makefile | 4 ++++ ports/cxd56/Makefile | 4 ++++ ports/espressif/Makefile | 6 ++++++ ports/litex/Makefile | 4 ++++ ports/mimxrt10xx/Makefile | 4 ++++ ports/nrf/Makefile | 4 ++++ ports/raspberrypi/Makefile | 4 ++++ ports/silabs/Makefile | 4 ++++ ports/silabs/README.md | 4 ++-- ports/stm/Makefile | 6 +++++- py/circuitpy_defns.mk | 12 ++++++++++++ py/circuitpy_mkenv.mk | 28 +++++++++++----------------- tools/fetch-submodules.sh | 24 ++++++++++++++++++++++++ 16 files changed, 104 insertions(+), 40 deletions(-) create mode 100755 tools/fetch-submodules.sh diff --git a/BUILDING.md b/BUILDING.md index f108675b7c..1c47eb7b45 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -27,7 +27,11 @@ This project has a bunch of git submodules. You will need to update them regula In the root folder of the CircuitPython repository, execute the following: - make fetch-submodules + make fetch-all-submodules + +Or, in the ports directory for the particular port you are building, do: + + make fetch-port-submodules ### Required Python Packages diff --git a/Makefile b/Makefile index 05d3618658..88f8c54ad2 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,6 @@ TRANSLATE_SOURCES_EXC = -path "ports/*/build-*" \ help: @echo "Please use \`make ' where is one of" - @echo " fetch-submodules to fetch dependencies from submodules, run this right after you clone the repo" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @@ -84,6 +83,8 @@ help: @echo " pseudoxml to make pseudoxml-XML files for display purposes" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" + @echo " fetch-all-submodules to fetch submodules for all ports" + @echo " remove-all-submodules remove all submodules, including files and .git/ data" clean: rm -rf $(BUILDDIR)/* @@ -324,25 +325,12 @@ clean-stm: $(MAKE) -C ports/stm BOARD=feather_stm32f405_express clean -# If available, do blobless partial clones of submodules to save time and space. -# A blobless partial clone lazily fetches data as needed, but has all the metadata available (tags, etc.) -# so it does not have the idiosyncrasies of a shallow clone. -# -# If not available, do a fetch that will fail, and then fix it up with a second fetch. -# (Only works for git servers that allow sha fetches.) -.PHONY: fetch-submodules -fetch-submodules: - git submodule sync - ##################################################################################### - # NOTE: Ideally, use git version 2.36.0 or later, to do partial clones of submodules. - # If an older git is used, submodules will be cloned with a shallow clone of depth 1. - # You will see a git usage message first if the git version is too old to do - # clones of submodules. - ##################################################################################### - git submodule update --init --filter=blob:none || git submodule update --init -N --depth 1 || git submodule foreach 'git fetch --tags --depth 1 origin $$sha1 && git checkout -q $$sha1' || echo 'make fetch-submodules FAILED' +.PHONY: fetch-all-submodules +fetch-all-submodules: + tools/fetch-submodules.sh -.PHONY: remove-submodules -remove-submodules: +.PHONY: remove-all-submodules +remove-all-submodules: git submodule deinit -f --all rm -rf .git/modules/* diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index ca906ab98f..4595998953 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -363,11 +363,15 @@ SRC_QSTR_PREPROCESSOR += peripherals/samd/$(PERIPHERALS_CHIP_FAMILY)/clocks.c all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 +ifeq ($(VALID_BOARD),) +$(BUILD)/firmware.elf: invalid-board +else $(BUILD)/firmware.elf: $(OBJ) $(GENERATED_LD_FILE) $(STEPECHO) "LINK $@" $(Q)echo $(OBJ) > $(BUILD)/firmware.objs $(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--print-memory-usage -Wl,--start-group $(LIBS) -Wl,--end-group $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(GENERATED_LD_FILE) $(BUILD) +endif $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" diff --git a/ports/broadcom/Makefile b/ports/broadcom/Makefile index b6dd62dedf..9af0503fbb 100644 --- a/ports/broadcom/Makefile +++ b/ports/broadcom/Makefile @@ -142,10 +142,14 @@ all: $(BUILD)/firmware.kernel$(SUFFIX).img $(BUILD)/firmware.disk.img.zip %.o: %.c $(CC) $(CFLAGS) -c $< -o $@ +ifeq ($(VALID_BOARD),) +$(BUILD)/kernel$(SUFFIX).elf: invalid-board +else $(BUILD)/kernel$(SUFFIX).elf: $(OBJ) $(STEPECHO) "LINK $@" $(Q)echo $(OBJ) > $(BUILD)/firmware.objs $(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group +endif $(BUILD)/kernel$(SUFFIX).img: $(BUILD)/kernel$(SUFFIX).elf $(STEPECHO) "Create $@" diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile index f90b6dd460..2fbb599c25 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -183,9 +183,13 @@ $(BUILD)/firmware.elf: $(BUILD)/libmpy.a $(MKSPK): $(MAKE) -C mkspk +ifeq ($(VALID_BOARD),) +$(BUILD)/firmware.spk: invalid-board +else $(BUILD)/firmware.spk: $(BUILD)/firmware.elf $(MKSPK) $(ECHO) "Creating $@" $(MKSPK) -c 2 $(BUILD)/firmware.elf nuttx $(BUILD)/firmware.spk +endif flash: $(BUILD)/firmware.spk $(ECHO) "Writing $< to the board" diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 740a87e322..10ac738cac 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -411,6 +411,7 @@ ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/esp32-camera/libesp32-ca #$(error $(ESP_IDF_COMPONENTS_EXPANDED)) endif +ifneq ($(VALID_BOARD),) # BOOTLOADER_OFFSET is determined by chip type, based on the ROM bootloader, and is not changeable. ifeq ($(IDF_TARGET),esp32) BOOTLOADER_OFFSET = 0x1000 @@ -423,6 +424,7 @@ BOOTLOADER_OFFSET = 0x1000 else $(error unknown IDF_TARGET $(IDF_TARGET)) endif +endif IDF_CMAKE_TARGETS = \ bootloader/bootloader.bin \ @@ -457,8 +459,12 @@ $(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf | tools/build_memory_ $(Q)esptool.py --chip $(IDF_TARGET) elf2image $(FLASH_FLAGS) --elf-sha256-offset 0xb0 -o $@ $^ $(Q)$(PYTHON) tools/build_memory_info.py $< $(BUILD)/esp-idf/sdkconfig $@ $(BUILD) +ifeq ($(VALID_BOARD),) +$(BUILD)/firmware.bin: invalid-board +else $(BUILD)/firmware.bin: $(BUILD)/circuitpython-firmware.bin | esp-idf-stamp $(Q)$(PYTHON) ../../tools/join_bins.py $@ $(BOOTLOADER_OFFSET) $(BUILD)/esp-idf/bootloader/bootloader.bin $(PARTITION_TABLE_OFFSET) $(BUILD)/esp-idf/partition_table/partition-table.bin $(FIRMWARE_OFFSET) $(BUILD)/circuitpython-firmware.bin +endif UF2_FAMILY_ID_esp32s2 = 0xbfdd4eee UF2_FAMILY_ID_esp32s3 = 0xc47e5767 diff --git a/ports/litex/Makefile b/ports/litex/Makefile index 5556dea11d..47a18781f9 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -133,10 +133,14 @@ SRC_QSTR_PREPROCESSOR += all: $(BUILD)/firmware.bin $(BUILD)/firmware.dfu +ifeq ($(VALID_BOARD),) +$(BUILD)/firmware.elf: invalid-board +else $(BUILD)/firmware.elf: $(OBJ) $(STEPECHO) "LINK $@" $(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(LD_FILE) $(BUILD) +endif $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index bbee67bebe..c591cf189e 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -200,9 +200,13 @@ SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_M all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 $(BUILD)/firmware.hex +ifeq ($(VALID_BOARD),) +$(BUILD)/firmware.elf: invalid-board +else $(BUILD)/firmware.elf: $(OBJ) $(LD_FILES) $(STEPECHO) "LINK $@" $(Q)$(CC) -o $@ $(LDFLAGS) $(filter-out %.ld, $^) -Wl,--print-memory-usage -Wl,--start-group $(LIBS) -Wl,--end-group +endif # -R excludes sections from the output files. $(BUILD)/firmware.bin: $(BUILD)/firmware.elf diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 412ff86cde..8a8625bd95 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -208,11 +208,15 @@ UF2_FAMILY_ID_nrf52833 = 0x621E937A all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 $(BUILD)/firmware.combined.hex +ifeq ($(VALID_BOARD),) +$(BUILD)/firmware.elf: invalid-board +else $(BUILD)/firmware.elf: $(OBJ) $(GENERATED_LD_FILE) $(STEPECHO) "LINK $@" $(Q)echo $(OBJ) > $(BUILD)/firmware.objs $(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(GENERATED_LD_FILE) $(BUILD) +endif $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index f23da5a51d..7eb67b77ba 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -434,11 +434,15 @@ endif LINKER_SCRIPTS += -Wl,-T,link.ld +ifeq ($(VALID_BOARD),) +$(BUILD)/firmware.elf: invalid-board +else $(BUILD)/firmware.elf: $(OBJ) $(BOARD_LD) link.ld $(STEPECHO) "LINK $@" $(Q)echo $(OBJ) > $(BUILD)/firmware.objs $(Q)echo $(PICO_LDFLAGS) > $(BUILD)/firmware.ldflags $(Q)$(CC) -o $@ $(CFLAGS) @$(BUILD)/firmware.ldflags $(LINKER_SCRIPTS) -Wl,--print-memory-usage -Wl,-Map=$@.map -Wl,-cref -Wl,--gc-sections @$(BUILD)/firmware.objs -Wl,-lc +endif $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" diff --git a/ports/silabs/Makefile b/ports/silabs/Makefile index 39f493287a..66749b4320 100644 --- a/ports/silabs/Makefile +++ b/ports/silabs/Makefile @@ -137,9 +137,13 @@ MCU_SECTIONS = $^ $@ # Default goal all: $(OUTPUT_DIR)/firmware.bin +ifeq ($(VALID_BOARD),) +$(BUILD)/firmware.bin: invalid-board +else $(OUTPUT_DIR)/firmware.bin: $(SILABS_BUILD)/$(PROJECTNAME).Makefile $(OUTPUT_DIR)/firmware.hex +@$(MAKE) --no-print-directory $(OUTPUT_DIR)/firmware.out @echo 'Done.' +endif $(SILABS_BUILD)/$(PROJECTNAME).Makefile: +@$(MAKE) --no-print-directory slc-generate diff --git a/ports/silabs/README.md b/ports/silabs/README.md index 626b8e7788..b448825668 100644 --- a/ports/silabs/README.md +++ b/ports/silabs/README.md @@ -47,8 +47,8 @@ Ensure your clone of Circuitpython is ready to build by following the [guide on Clone the source code of CircuitPython from Github: $ git clone https://github.com/SiliconLabs/circuitpython.git - $ cd circuitpython - $ make fetch-submodules + $ cd circuitpython/ports/silabs + $ make fetch-port-submodules Checkout the branch or tag you want to build. For example: diff --git a/ports/stm/Makefile b/ports/stm/Makefile index d6afeb5f29..b9709d0c2e 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -52,7 +52,7 @@ INC += -I../../supervisor/shared/usb #Debugging/Optimization ifeq ($(DEBUG), 1) CFLAGS += -ggdb3 - # You may want to enable these flags to make setting breakpoints easier. +# You may want to enable these flags to make setting breakpoints easier. CFLAGS += -fno-inline -fno-ipa-sra else CFLAGS += -DNDEBUG @@ -264,11 +264,15 @@ endif all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 +ifeq ($(VALID_BOARD),) +$(BUILD)/firmware.elf: invalid-board +else $(BUILD)/firmware.elf: $(OBJ) $(STEPECHO) "LINK $@" $(Q)echo $^ > $(BUILD)/firmware.objs $(Q)$(CC) -o $@ $(LDFLAGS) @$(BUILD)/firmware.objs -Wl,--start-group $(LIBS) -Wl,--end-group $(Q)$(SIZE) $@ | $(PYTHON) $(TOP)/tools/build_memory_info.py $(LD_FILE) $(BUILD) +endif $(BUILD)/firmware.bin: $(BUILD)/firmware.elf $(STEPECHO) "Create $@" diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index ae4b1bf3db..be12a1a6df 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -829,3 +829,15 @@ check-release-needs-clean-build: # Ignore these errors $(BUILD)/lib/libm/kf_rem_pio2.o: CFLAGS += -Wno-maybe-uninitialized + +# Fetch only submodules needed for this particular port. +.PHONY: fetch-port-submodules +fetch-port-submodules: + $(TOP)/tools/fetch-submodules.sh data extmod frozen lib $(CURDIR) + +.PHONY: invalid-board +invalid-board: + $(Q)if [ -z "$(BOARD)" ] ; then echo "ERROR: No BOARD specified" ; else echo "ERROR: Invalid BOARD $(BOARD) specified"; fi && \ + echo "Valid boards:" && \ + printf '%s\n' $(ALL_BOARDS_IN_PORT) | column -xc $$(tput cols || echo 80) 1>&2 && \ + false diff --git a/py/circuitpy_mkenv.mk b/py/circuitpy_mkenv.mk index d776cc2fef..7bdf943a14 100644 --- a/py/circuitpy_mkenv.mk +++ b/py/circuitpy_mkenv.mk @@ -24,22 +24,10 @@ # Common Makefile items that can be shared across CircuitPython ports. -# Select the board to build for. -define show_board_error -$(info Valid boards:) -$(shell printf '%s\n' $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) | column -xc $$(tput cols || echo 80) 1>&2) -$(error Rerun with $(MAKE) BOARD=) -endef - -ifeq ($(BOARD),) - $(info No BOARD specified) - $(call show_board_error) -else - ifeq ($(wildcard boards/$(BOARD)/.),) - $(info Invalid BOARD specified) - $(call show_board_error) - endif -endif +ALL_BOARDS_IN_PORT := $(patsubst boards/%/mpconfigboard.mk,%,$(wildcard boards/*/mpconfigboard.mk)) +# An incorrect BOARD might have been specified, so check against the list. +# There is deliberately no space after the := +VALID_BOARD :=$(filter $(BOARD),$(ALL_BOARDS_IN_PORT)) # If the flash PORT is not given, use the default /dev/tty.SLAB_USBtoUART. PORT ?= /dev/tty.SLAB_USBtoUART @@ -47,16 +35,22 @@ PORT ?= /dev/tty.SLAB_USBtoUART # If the build directory is not given, make it reflect the board name. BUILD ?= build-$(BOARD) +# First makefile with targets. Defines the default target. include ../../py/mkenv.mk -# Board-specific +# Board-specific. Skip if the rule requested is not board-specific. +ifneq ($(VALID_BOARD),) include boards/$(BOARD)/mpconfigboard.mk +endif # Port-specific include mpconfigport.mk +# Also board-specific. Skip if the rule requested is not board-specific. +ifneq ($(VALID_BOARD),) # CircuitPython-specific include $(TOP)/py/circuitpy_mpconfig.mk +endif # qstr definitions (must come before including py.mk) QSTR_DEFS = qstrdefsport.h diff --git a/tools/fetch-submodules.sh b/tools/fetch-submodules.sh new file mode 100755 index 0000000000..8f853e754f --- /dev/null +++ b/tools/fetch-submodules.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env sh +# Pass the directories of submodules to fetch as command-line arguments. For example: +# ./fetch-submodules.sh lib tools +# If no arguments are passed, all submodules will be fetched. +# This script handles being called at other than the top level by making the paths +# for the submodules absolute. + +TOP=$(git rev-parse --show-toplevel) + +git submodule sync --quiet +# Prefix all the args with the absolute path to the top of the repo. +abs_submodules="" +for d in "$@"; do + abs_submodules="${abs_submodules} ${TOP}/${d}" +done +echo ${abs_submodules} + +# Fetch submodules as partial clones if possible. If that fails due to an older version of git, +# do a shallow init with no fetch and then check out the proper commit. +git submodule update --init --filter=blob:none ${abs_submodules} || \ + git submodule update --init --no-fetch --depth 1 ${abs_submodules} || \ + git submodule foreach $* \ + 'git fetch --tags --depth 1 origin $$sha1 && git checkout -q $$sha1' || \ + echo "ERROR: fetch-submodules.sh FAILED" From a7da1c4ad4ec336ed2f088eb9875000f1f2d70ce Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 5 Jun 2023 19:01:51 -0400 Subject: [PATCH 1175/1712] fix ports path arg to fetch-submodules.sh --- py/circuitpy_defns.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index be12a1a6df..6ea224bae4 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -833,7 +833,8 @@ $(BUILD)/lib/libm/kf_rem_pio2.o: CFLAGS += -Wno-maybe-uninitialized # Fetch only submodules needed for this particular port. .PHONY: fetch-port-submodules fetch-port-submodules: - $(TOP)/tools/fetch-submodules.sh data extmod frozen lib $(CURDIR) + echo $(basename $(CURDIR)) + $(TOP)/tools/fetch-submodules.sh data extmod frozen lib ports/$(shell basename $(CURDIR)) .PHONY: invalid-board invalid-board: From b576ec21b302ab6cd507f677161e115c66675af8 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 5 Jun 2023 19:04:32 -0400 Subject: [PATCH 1176/1712] add tools to common submodules to fetch --- py/circuitpy_defns.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 6ea224bae4..bd2c15a943 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -834,7 +834,7 @@ $(BUILD)/lib/libm/kf_rem_pio2.o: CFLAGS += -Wno-maybe-uninitialized .PHONY: fetch-port-submodules fetch-port-submodules: echo $(basename $(CURDIR)) - $(TOP)/tools/fetch-submodules.sh data extmod frozen lib ports/$(shell basename $(CURDIR)) + $(TOP)/tools/fetch-submodules.sh data extmod frozen lib tools ports/$(shell basename $(CURDIR)) .PHONY: invalid-board invalid-board: From 46c5be07ffadb14f4219d8d1f43622d929de2fa1 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 6 Jun 2023 11:04:27 -0400 Subject: [PATCH 1177/1712] remove debugging print --- py/circuitpy_defns.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index bd2c15a943..106dd74945 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -833,7 +833,6 @@ $(BUILD)/lib/libm/kf_rem_pio2.o: CFLAGS += -Wno-maybe-uninitialized # Fetch only submodules needed for this particular port. .PHONY: fetch-port-submodules fetch-port-submodules: - echo $(basename $(CURDIR)) $(TOP)/tools/fetch-submodules.sh data extmod frozen lib tools ports/$(shell basename $(CURDIR)) .PHONY: invalid-board From 40a31390aa6da1222892b00ecb67b3c6a81b53d3 Mon Sep 17 00:00:00 2001 From: applecuckoo Date: Wed, 7 Jun 2023 07:30:02 +1200 Subject: [PATCH 1178/1712] Remove available modules section --- ports/silabs/README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/ports/silabs/README.md b/ports/silabs/README.md index 1186690911..6c2043e522 100644 --- a/ports/silabs/README.md +++ b/ports/silabs/README.md @@ -120,12 +120,4 @@ With the boards which support USB mass storage, we can drag the files to the boa Refer to the guide below for installing the **Ampy** tool: - - -## Built-in modules available ## - -| Board | Modules Available| -| --------------------------- | ---------------- | -| xG24 Dev Kit | _asyncio, _bleio, _pixelmap, adafruit_ble, adafruit_bus_device, adafruit_pixelbuf, adafruit_register, aesio, analogio, array, atexit, binascii, bitmaptools, board, builtins, busio, collections, digitalio, displayio, errno, fontio, framebufferio, gc, getpass, gifio, json, math, microcontroller, micropython, msgpack, nvm, onewireio, os, pwmio, rainbowio, random, re, rtc, select, sharpdisplay, storage, struct, supervisor, sys, terminalio, time, traceback, ulab, uselect, vectorio, watchdog, zlib | -| xG24 Explorer Kit | _asyncio, _bleio, _pixelmap, adafruit_ble, adafruit_bus_device, adafruit_pixelbuf, adafruit_register, aesio, analogio, array, atexit, binascii, bitmaptools, board, builtins, busio, collections, digitalio, displayio, errno, fontio, framebufferio, gc, getpass, gifio, json, math, microcontroller, micropython, msgpack, nvm, onewireio, os, pwmio, rainbowio, random, re, rtc, sdcardio, select, sharpdisplay, storage, struct, supervisor, sys, terminalio, time, traceback, ulab, uselect, vectorio, watchdog, zlib | -| SparkFun Thing Plus MGM240P | _asyncio, _bleio, _pixelmap, adafruit_ble, adafruit_bus_device, adafruit_pixelbuf, adafruit_register, aesio, analogio, array, atexit, binascii, bitmaptools, board, builtins, busio, collections, digitalio, displayio, errno, fontio, framebufferio, gc, getpass, gifio, json, math, microcontroller, micropython, msgpack, nvm, onewireio, os, pwmio, rainbowio, random, re, rtc, sdcardio, select, sharpdisplay, storage, struct, supervisor, sys, terminalio, time, traceback, ulab, uselect, vectorio, watchdog, zlib | + \ No newline at end of file From dd71ae10b9ca72ca786353c59756d7a84a69125c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 6 Jun 2023 16:20:47 -0700 Subject: [PATCH 1179/1712] Slim down stack frames This reduces the stack frame size of mp_builtin___import__ by limiting the support path length of files from 256 to 96. This function can be called recursively for nested imports so it adds up. Also reduce mp_execute_bytecode (vm.c) from 206 a bc call to 124. This too is recursive and adds up. It is reduced by preventing some inlining. It may decrease performance slightly when importing and unpacking. Adds two new scripts for debugging. One is used from gdb to print frame sizes in a backtrace. The other prints what pcs use a particular stack offset. This helps find infrequently used stack space. Fixes #8053. --- py/circuitpy_mpconfig.h | 4 +-- py/runtime.c | 10 +++---- tools/gdb-stack-size.py | 64 ++++++++++++++++++++++++++++++++++++++++ tools/stack-loc-to-pc.py | 28 ++++++++++++++++++ 4 files changed, 99 insertions(+), 7 deletions(-) create mode 100644 tools/gdb-stack-size.py create mode 100644 tools/stack-loc-to-pc.py diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index cc7886cb37..e1909a064f 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -59,8 +59,8 @@ extern void common_hal_mcu_enable_interrupts(void); // // default is 128; consider raising to reduce fragmentation. #define MICROPY_ALLOC_PARSE_CHUNK_INIT (16) -// default is 512. -#define MICROPY_ALLOC_PATH_MAX (256) +// default is 512. Longest path in .py bundle as of June 6th, 2023 is 73 characters. +#define MICROPY_ALLOC_PATH_MAX (96) #define MICROPY_CAN_OVERRIDE_BUILTINS (1) #define MICROPY_COMP_CONST (1) #define MICROPY_COMP_DOUBLE_TUPLE_ASSIGN (1) diff --git a/py/runtime.c b/py/runtime.c index 804b955e07..ebe1590484 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -201,7 +201,7 @@ mp_obj_t MICROPY_WRAP_MP_LOAD_GLOBAL(mp_load_global)(qstr qst) { return elem->value; } -mp_obj_t mp_load_build_class(void) { +mp_obj_t __attribute__((noinline)) mp_load_build_class(void) { DEBUG_OP_printf("load_build_class\n"); #if MICROPY_CAN_OVERRIDE_BUILTINS if (MP_STATE_VM(mp_module_builtins_override_dict) != NULL) { @@ -858,7 +858,7 @@ mp_obj_t mp_call_method_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ob } // unpacked items are stored in reverse order into the array pointed to by items -void mp_unpack_sequence(mp_obj_t seq_in, size_t num, mp_obj_t *items) { +void __attribute__((noinline,)) mp_unpack_sequence(mp_obj_t seq_in, size_t num, mp_obj_t *items) { size_t seq_len; if (mp_obj_is_type(seq_in, &mp_type_tuple) || mp_obj_is_type(seq_in, &mp_type_list)) { mp_obj_t *seq_items; @@ -905,7 +905,7 @@ too_long: } // unpacked items are stored in reverse order into the array pointed to by items -void mp_unpack_ex(mp_obj_t seq_in, size_t num_in, mp_obj_t *items) { +void __attribute__((noinline)) mp_unpack_ex(mp_obj_t seq_in, size_t num_in, mp_obj_t *items) { size_t num_left = num_in & 0xff; size_t num_right = (num_in >> 8) & 0xff; DEBUG_OP_printf("unpack ex " UINT_FMT " " UINT_FMT "\n", num_left, num_right); @@ -1482,7 +1482,7 @@ mp_obj_t mp_import_name(qstr name, mp_obj_t fromlist, mp_obj_t level) { return mp_builtin___import__(5, args); } -mp_obj_t mp_import_from(mp_obj_t module, qstr name) { +mp_obj_t __attribute__((noinline,)) mp_import_from(mp_obj_t module, qstr name) { DEBUG_printf("import from %p %s\n", module, qstr_str(name)); mp_obj_t dest[2]; @@ -1528,7 +1528,7 @@ mp_obj_t mp_import_from(mp_obj_t module, qstr name) { #endif } -void mp_import_all(mp_obj_t module) { +void __attribute__((noinline)) mp_import_all(mp_obj_t module) { DEBUG_printf("import all %p\n", module); // TODO: Support __all__ diff --git a/tools/gdb-stack-size.py b/tools/gdb-stack-size.py new file mode 100644 index 0000000000..4d3fc9fe08 --- /dev/null +++ b/tools/gdb-stack-size.py @@ -0,0 +1,64 @@ +"""Source this file into gdb `source ../../tools/gdb-stack-size.py` then run + `stack-size` to print a backtrace with each frame size next to it.""" + + +class StackSize(gdb.Command): + def __init__(self): + super(StackSize, self).__init__("stack-size", gdb.COMMAND_USER) + + def invoke(self, arg, from_tty): + frame = gdb.newest_frame() + total_size = 0 + while frame: + sp = frame.read_register("sp") + frame_up = frame.older() + if not frame_up: + break + f = frame.function() + l = frame.level() + if l < 10: + l = "#" + str(l) + " " + else: + l = "#" + str(l) + size = frame_up.read_register("sp") - sp + total_size += size + print(l, sp, frame.type(), f, " " * (40 - len(str(f))), size) + # print(dir(f)) + # Tweak this if for more detail for a specific function. + if False and f.name == "mp_execute_bytecode": + b = frame.block() + prev_b = None + while not b.is_static: + print(" block", hex(b.start), hex(b.end), b.function) + for sym in b: + if not sym.needs_frame: + continue + v = sym.value(frame) + print(" ", sym.addr_class, v.address, sym.type.sizeof, sym, sym.type, v) + prev_b = b + b = b.superblock + + if b.function == f: + break + b = prev_b + print("pc scan", hex(b.start), hex(b.end)) + seen = set() + for pc in range(b.start, b.end, 2): + b = gdb.block_for_pc(pc) + r = (b.start, b.end) + if r in seen: + continue + seen.add(r) + print(" ", hex(pc), hex(b.start), hex(b.end), b.function) + for sym in b: + if not sym.needs_frame: + continue + # if sym.type.sizeof <= 4: + # continue + v = sym.value(frame) + print(" ", sym.addr_class, v.address, sym.type.sizeof, sym, sym.type, v) + frame = frame_up + print("total size:", total_size) + + +StackSize() diff --git a/tools/stack-loc-to-pc.py b/tools/stack-loc-to-pc.py new file mode 100644 index 0000000000..a1ce788f2b --- /dev/null +++ b/tools/stack-loc-to-pc.py @@ -0,0 +1,28 @@ +"""Prints the pcs that access each stack location in a function. Useful for finding + infrequently used stack space. + + Pipe in disassembly like so: + + arm-none-eabi-objdump --disassemble=mp_execute_bytecode build-metro_m0_express/firmware.elf | python ../../tools/stack-loc-to-pc.py + """ + +import sys +import re + +offset = re.compile(r"sp, #(\d+)") + +offsets = {} +for line in sys.stdin: + if "sp" in line: + m = offset.search(line) + o = int(m.groups()[0]) + pc = line.split(":")[0] + if o not in offsets: + offsets[o] = [] + offsets[o].append(pc.strip()) + +print("Offset", "Size", "PCs", sep="\t") +last_o = 0 +for o in sorted(offsets): + print(o, o - last_o, offsets[o], sep="\t") + last_o = o From 561caae35c51b2c3ca370de5d3692b3a81df08cc Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 6 Jun 2023 21:38:56 -0400 Subject: [PATCH 1180/1712] fix fetch-submodules.sh for older git --- tools/fetch-submodules.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/fetch-submodules.sh b/tools/fetch-submodules.sh index 8f853e754f..707edd992b 100755 --- a/tools/fetch-submodules.sh +++ b/tools/fetch-submodules.sh @@ -16,9 +16,8 @@ done echo ${abs_submodules} # Fetch submodules as partial clones if possible. If that fails due to an older version of git, -# do a shallow init with no fetch and then check out the proper commit. +# do a shallow init and fetch tags. git submodule update --init --filter=blob:none ${abs_submodules} || \ - git submodule update --init --no-fetch --depth 1 ${abs_submodules} || \ - git submodule foreach $* \ - 'git fetch --tags --depth 1 origin $$sha1 && git checkout -q $$sha1' || \ + git submodule update --init --depth 1 ${abs_submodules} && \ + git submodule foreach 'git fetch --tags --depth 1' || \ echo "ERROR: fetch-submodules.sh FAILED" From d4913b04e099fe191d9b7240eadaeb27a9172ca1 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 5 Jun 2023 10:36:31 -0500 Subject: [PATCH 1181/1712] rgbmatrix: update protomatter and re-organize so that esp32 s2/s3 don't do as much at reset .. it's not necessary (because most data is in esp-idf managed memory) and doing this saves me from having to debug why reconstruct isn't working properly on that platform. This needs to be tested on other platforms again before being merged! --- lib/protomatter | 2 +- .../common-hal/rgbmatrix/RGBMatrix.c | 14 ++- ports/espressif/mpconfigport.mk | 2 + py/circuitpy_mpconfig.mk | 2 + shared-bindings/rgbmatrix/RGBMatrix.c | 19 ++-- shared-bindings/rgbmatrix/RGBMatrix.h | 2 +- shared-module/rgbmatrix/RGBMatrix.c | 86 ++++++++++++------- shared-module/rgbmatrix/allocator.h | 8 ++ supervisor/shared/display.c | 2 +- 9 files changed, 89 insertions(+), 48 deletions(-) diff --git a/lib/protomatter b/lib/protomatter index d0a07e14ad..ce18b6d465 160000 --- a/lib/protomatter +++ b/lib/protomatter @@ -1 +1 @@ -Subproject commit d0a07e14adcd71a7c22bcceb16c55aadb5e0d104 +Subproject commit ce18b6d465d94d89e970ea39a48072a396ad7c27 diff --git a/ports/espressif/common-hal/rgbmatrix/RGBMatrix.c b/ports/espressif/common-hal/rgbmatrix/RGBMatrix.c index d42829985f..1ac1fe2005 100644 --- a/ports/espressif/common-hal/rgbmatrix/RGBMatrix.c +++ b/ports/espressif/common-hal/rgbmatrix/RGBMatrix.c @@ -31,7 +31,7 @@ #include "peripherals/timer.h" void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self) { - const timer_config_t config = { + static const timer_config_t config = { .alarm_en = false, .counter_en = false, .intr_type = TIMER_INTR_LEVEL, @@ -43,6 +43,7 @@ void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self) { timer_index_t *timer = malloc(sizeof(timer_index_t)); bool res = peripherals_timer_init(&config, timer); if (!res) { + free(timer); return NULL; } peripherals_timer_never_reset(timer); @@ -52,6 +53,11 @@ void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self) { extern bool _PM_esp32timerCallback(void *arg); void common_hal_rgbmatrix_timer_enable(void *ptr) { + timer_index_t *timer = (timer_index_t *)ptr; + if (timer->idx == TIMER_MAX) { + return; + } + timer_start(timer->group, timer->idx); } void common_hal_rgbmatrix_timer_disable(void *ptr) { @@ -60,8 +66,6 @@ void common_hal_rgbmatrix_timer_disable(void *ptr) { return; } timer_pause(timer->group, timer->idx); - timer_disable_intr(timer->group, timer->idx); - timer_isr_callback_remove(timer->group, timer->idx); } void common_hal_rgbmatrix_timer_free(void *ptr) { @@ -70,6 +74,8 @@ void common_hal_rgbmatrix_timer_free(void *ptr) { return; } common_hal_rgbmatrix_timer_disable(ptr); + timer_disable_intr(timer->group, timer->idx); + timer_isr_callback_remove(timer->group, timer->idx); peripherals_timer_deinit(timer); - timer->idx = TIMER_MAX; + free(timer); } diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 4637d971a4..1b9808ad64 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -70,10 +70,12 @@ CIRCUITPY_USB = 0 else ifeq ($(IDF_TARGET),esp32s2) # Modules CIRCUITPY_BLEIO = 0 +CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION = 0 else ifeq ($(IDF_TARGET),esp32s3) # Modules CIRCUITPY_PARALLELDISPLAY = 0 +CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION = 0 endif # No room for dualbank on boards with 2MB flash diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 639fae9bbc..3e43909687 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -385,6 +385,8 @@ CFLAGS += -DCIRCUITPY_RP2PIO=$(CIRCUITPY_RP2PIO) CIRCUITPY_RGBMATRIX ?= 0 CFLAGS += -DCIRCUITPY_RGBMATRIX=$(CIRCUITPY_RGBMATRIX) +CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION ?= 1 +CFLAGS += -DCIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION=$(CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION) CIRCUITPY_ROTARYIO ?= 1 CFLAGS += -DCIRCUITPY_ROTARYIO=$(CIRCUITPY_ROTARYIO) diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 129d77e321..0f5cc91fc7 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -62,13 +62,16 @@ STATIC void claim_and_never_reset_pins(mp_obj_t seq) { } STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_t rgb_pin_count, bool allow_inefficient) { - uint32_t port = clock_pin / 32; - uint32_t bit_mask = 1 << (clock_pin % 32); - if (rgb_pin_count <= 0 || rgb_pin_count % 6 != 0 || rgb_pin_count > 30) { mp_raise_ValueError_varg(translate("The length of rgb_pins must be 6, 12, 18, 24, or 30")); } +// Most ports have a strict requirement for how the rgbmatrix pins are laid +// out; these two micros don't. Special-case it here. + #if !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32S2) + uint32_t port = clock_pin / 32; + uint32_t bit_mask = 1 << (clock_pin % 32); + for (uint8_t i = 0; i < rgb_pin_count; i++) { uint32_t pin_port = rgb_pins[i] / 32; @@ -130,6 +133,7 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ translate("Pinout uses %d bytes per element, which consumes more than the ideal %d bytes. If this cannot be avoided, pass allow_inefficient=True to the constructor"), bytes_per_element, ideal_bytes_per_element); } + #endif } //| def __init__( @@ -236,12 +240,6 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n preflight_pins_or_throw(clock_pin, rgb_pins, rgb_count, true); - mp_obj_t framebuffer = args[ARG_framebuffer].u_obj; - if (framebuffer == mp_const_none) { - int bufsize = 2 * width * computed_height; - framebuffer = mp_obj_new_bytearray_of_zeros(bufsize); - } - common_hal_rgbmatrix_rgbmatrix_construct(self, width, bit_depth, @@ -249,7 +247,7 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n addr_count, addr_pins, clock_pin, latch_pin, output_enable_pin, args[ARG_doublebuffer].u_bool, - framebuffer, tile, args[ARG_serpentine].u_bool, NULL); + args[ARG_framebuffer].u_obj, tile, args[ARG_serpentine].u_bool, NULL); claim_and_never_reset_pins(args[ARG_rgb_list].u_obj); claim_and_never_reset_pins(args[ARG_addr_list].u_obj); @@ -353,7 +351,6 @@ STATIC MP_DEFINE_CONST_DICT(rgbmatrix_rgbmatrix_locals_dict, rgbmatrix_rgbmatrix STATIC void rgbmatrix_rgbmatrix_get_bufinfo(mp_obj_t self_in, mp_buffer_info_t *bufinfo) { rgbmatrix_rgbmatrix_obj_t *self = (rgbmatrix_rgbmatrix_obj_t *)self_in; - check_for_deinit(self); *bufinfo = self->bufinfo; } diff --git a/shared-bindings/rgbmatrix/RGBMatrix.h b/shared-bindings/rgbmatrix/RGBMatrix.h index 127f920da1..9d85bf2b95 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.h +++ b/shared-bindings/rgbmatrix/RGBMatrix.h @@ -34,7 +34,7 @@ extern const mp_obj_type_t rgbmatrix_RGBMatrix_type; void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, int width, int bit_depth, uint8_t rgb_count, uint8_t *rgb_pins, uint8_t addr_count, uint8_t *addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, int8_t tile, bool serpentine, void *timer); void common_hal_rgbmatrix_rgbmatrix_deinit(rgbmatrix_rgbmatrix_obj_t *); void rgbmatrix_rgbmatrix_collect_ptrs(rgbmatrix_rgbmatrix_obj_t *); -void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t *self, mp_obj_t framebuffer); +void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t *self); void common_hal_rgbmatrix_rgbmatrix_set_paused(rgbmatrix_rgbmatrix_obj_t *self, bool paused); bool common_hal_rgbmatrix_rgbmatrix_get_paused(rgbmatrix_rgbmatrix_obj_t *self); void common_hal_rgbmatrix_rgbmatrix_refresh(rgbmatrix_rgbmatrix_obj_t *self); diff --git a/shared-module/rgbmatrix/RGBMatrix.c b/shared-module/rgbmatrix/RGBMatrix.c index 5e8f95b139..556ef431ed 100644 --- a/shared-module/rgbmatrix/RGBMatrix.c +++ b/shared-module/rgbmatrix/RGBMatrix.c @@ -42,6 +42,8 @@ extern Protomatter_core *_PM_protoPtr; +STATIC void common_hal_rgbmatrix_rgbmatrix_construct1(rgbmatrix_rgbmatrix_obj_t *self, mp_obj_t framebuffer); + void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, int width, int bit_depth, uint8_t rgb_count, uint8_t *rgb_pins, uint8_t addr_count, uint8_t *addr_pins, uint8_t clock_pin, uint8_t latch_pin, uint8_t oe_pin, bool doublebuffer, mp_obj_t framebuffer, int8_t tile, bool serpentine, void *timer) { self->width = width; self->bit_depth = bit_depth; @@ -64,15 +66,11 @@ void common_hal_rgbmatrix_rgbmatrix_construct(rgbmatrix_rgbmatrix_obj_t *self, i self->width = width; self->bufsize = 2 * width * common_hal_rgbmatrix_rgbmatrix_get_height(self); - common_hal_rgbmatrix_rgbmatrix_reconstruct(self, framebuffer); + common_hal_rgbmatrix_rgbmatrix_construct1(self, framebuffer); } -void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t *self, mp_obj_t framebuffer) { - self->paused = 1; - - common_hal_rgbmatrix_timer_disable(self->timer); - if (framebuffer) { - self->framebuffer = framebuffer; +STATIC void common_hal_rgbmatrix_rgbmatrix_construct1(rgbmatrix_rgbmatrix_obj_t *self, mp_obj_t framebuffer) { + if (framebuffer != mp_const_none) { mp_get_buffer_raise(self->framebuffer, &self->bufinfo, MP_BUFFER_READ); if (mp_get_buffer(self->framebuffer, &self->bufinfo, MP_BUFFER_RW)) { self->bufinfo.typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW; @@ -82,16 +80,11 @@ void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t *self, // verify that the matrix is big enough mp_get_index(mp_obj_get_type(self->framebuffer), self->bufinfo.len, MP_OBJ_NEW_SMALL_INT(self->bufsize - 1), false); } else { - common_hal_rgbmatrix_free_impl(self->bufinfo.buf); - common_hal_rgbmatrix_free_impl(self->protomatter.rgbPins); - common_hal_rgbmatrix_free_impl(self->protomatter.addr); - common_hal_rgbmatrix_free_impl(self->protomatter.screenData); - - self->framebuffer = NULL; self->bufinfo.buf = common_hal_rgbmatrix_allocator_impl(self->bufsize); self->bufinfo.len = self->bufsize; self->bufinfo.typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW; } + self->framebuffer = framebuffer; memset(&self->protomatter, 0, sizeof(self->protomatter)); ProtomatterStatus stat = _PM_init(&self->protomatter, @@ -115,6 +108,9 @@ void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t *self, if (stat != PROTOMATTER_OK) { common_hal_rgbmatrix_rgbmatrix_deinit(self); + if (!gc_alloc_possible()) { + return; + } switch (stat) { case PROTOMATTER_ERR_PINS: raise_ValueError_invalid_pin(); @@ -148,35 +144,65 @@ STATIC void free_pin_seq(uint8_t *seq, int count) { } } -void common_hal_rgbmatrix_rgbmatrix_deinit(rgbmatrix_rgbmatrix_obj_t *self) { - if (self->timer) { - common_hal_rgbmatrix_timer_free(self->timer); - self->timer = 0; - } +extern int pm_row_count; +STATIC void common_hal_rgbmatrix_rgbmatrix_deinit1(rgbmatrix_rgbmatrix_obj_t *self) { + common_hal_rgbmatrix_timer_disable(self->timer); if (_PM_protoPtr == &self->protomatter) { _PM_protoPtr = NULL; } + if (self->protomatter.rgbPins) { + _PM_deallocate(&self->protomatter); + } + + memset(&self->protomatter, 0, sizeof(self->protomatter)); + + // If it was supervisor-allocated, it is supervisor-freed and the pointer + // is zeroed, otherwise the pointer is just zeroed + if (self->bufinfo.buf) { + common_hal_rgbmatrix_free_impl(self->bufinfo.buf); + self->bufinfo.buf = NULL; + } + + + // If a framebuffer was passed in to the constructor, clear the reference + // here so that it will become GC'able + self->framebuffer = mp_const_none; +} + +void common_hal_rgbmatrix_rgbmatrix_deinit(rgbmatrix_rgbmatrix_obj_t *self) { + common_hal_rgbmatrix_rgbmatrix_deinit1(self); + if (self->timer) { + common_hal_rgbmatrix_timer_free(self->timer); + self->timer = 0; + } + free_pin_seq(self->rgb_pins, self->rgb_count); free_pin_seq(self->addr_pins, self->addr_count); free_pin(&self->clock_pin); free_pin(&self->latch_pin); free_pin(&self->oe_pin); - if (self->protomatter.rgbPins) { - _PM_deallocate(&self->protomatter); + self->base.type = &mp_type_NoneType; +} + +void common_hal_rgbmatrix_rgbmatrix_reconstruct(rgbmatrix_rgbmatrix_obj_t *self) { + if (self->framebuffer != mp_const_none) { + memset(&self->bufinfo, 0, sizeof(self->bufinfo)); } - memset(&self->protomatter, 0, sizeof(self->protomatter)); - - // If it was supervisor-allocated, it is supervisor-freed and the pointer - // is zeroed, otherwise the pointer is just zeroed - _PM_free(self->bufinfo.buf); - self->base.type = NULL; - - // If a framebuffer was passed in to the constructor, NULL the reference - // here so that it will become GC'able - self->framebuffer = NULL; + #if CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION + common_hal_rgbmatrix_rgbmatrix_set_paused(self, true); + common_hal_rgbmatrix_rgbmatrix_deinit1(self); + common_hal_rgbmatrix_rgbmatrix_construct1(self, mp_const_none); + #endif + if (self->bufinfo.buf == NULL) { + self->bufinfo.buf = common_hal_rgbmatrix_allocator_impl(self->bufsize); + self->bufinfo.len = self->bufsize; + self->bufinfo.typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW; + } + memset(self->bufinfo.buf, 0, self->bufinfo.len); + common_hal_rgbmatrix_rgbmatrix_set_paused(self, false); } void rgbmatrix_rgbmatrix_collect_ptrs(rgbmatrix_rgbmatrix_obj_t *self) { diff --git a/shared-module/rgbmatrix/allocator.h b/shared-module/rgbmatrix/allocator.h index 5c11ad52a7..2a395983d6 100644 --- a/shared-module/rgbmatrix/allocator.h +++ b/shared-module/rgbmatrix/allocator.h @@ -31,7 +31,15 @@ #include "py/misc.h" #include "supervisor/memory.h" +#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32S2) +// Use DMA-capable RAM (not PSRAM) for framebuffer: +#include "components/heap/include/esp_heap_caps.h" +#define _PM_allocate(x) heap_caps_malloc(x, MALLOC_CAP_DMA | MALLOC_CAP_8BIT) +#define _PM_free(x) heap_caps_free(x) +#else #define _PM_allocate common_hal_rgbmatrix_allocator_impl #define _PM_free(x) (common_hal_rgbmatrix_free_impl((x)), (x) = NULL, (void)0) +#endif + extern void *common_hal_rgbmatrix_allocator_impl(size_t sz); extern void common_hal_rgbmatrix_free_impl(void *); diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index 939a13340d..ce7d78c42c 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -191,7 +191,7 @@ void supervisor_display_move_memory(void) { #if CIRCUITPY_RGBMATRIX if (display_buses[i].rgbmatrix.base.type == &rgbmatrix_RGBMatrix_type) { rgbmatrix_rgbmatrix_obj_t *pm = &display_buses[i].rgbmatrix; - common_hal_rgbmatrix_rgbmatrix_reconstruct(pm, NULL); + common_hal_rgbmatrix_rgbmatrix_reconstruct(pm); } #endif #if CIRCUITPY_SHARPDISPLAY From 1e3f1d745ad5babbae310038e98c6e9c65541d9d Mon Sep 17 00:00:00 2001 From: Mario Bodemann Date: Thu, 8 Jun 2023 18:20:09 +0200 Subject: [PATCH 1182/1712] Update badger2040 start sequence for more contrast This change is taken from the pico-sdk: https://github.com/pimoroni/pimoroni-pico/blob/main/drivers/uc8151_legacy/uc8151_legacy.cpp#L67-L120 and increases the contrast of pictures sent dramatically. It comes with the expense of using way more time when updating though. --- .../boards/pimoroni_badger2040/board.c | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/ports/raspberrypi/boards/pimoroni_badger2040/board.c b/ports/raspberrypi/boards/pimoroni_badger2040/board.c index cd7cd3a194..6163919e97 100644 --- a/ports/raspberrypi/boards/pimoroni_badger2040/board.c +++ b/ports/raspberrypi/boards/pimoroni_badger2040/board.c @@ -206,9 +206,9 @@ const uint8_t display_start_sequence[] = { // Look up tables for voltage sequence for pixel transition // Common voltage LUT_VCOM, 44, - 0x00, 0x16, 0x16, 0x0d, 0x00, 0x01, - 0x00, 0x23, 0x23, 0x00, 0x00, 0x02, - 0x00, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0x00, 0x64, 0x64, 0x37, 0x00, 0x01, + 0x00, 0x8c, 0x8c, 0x00, 0x00, 0x04, + 0x00, 0x64, 0x64, 0x37, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -217,9 +217,9 @@ const uint8_t display_start_sequence[] = { // White to white LUT_WW, 42, - 0x54, 0x16, 0x16, 0x0d, 0x00, 0x01, - 0x60, 0x23, 0x23, 0x00, 0x00, 0x02, - 0xa8, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0x54, 0x64, 0x64, 0x37, 0x00, 0x01, + 0x60, 0x8c, 0x8c, 0x00, 0x00, 0x04, + 0xa8, 0x64, 0x64, 0x37, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -227,9 +227,9 @@ const uint8_t display_start_sequence[] = { // Black to white LUT_BW, 42, - 0x54, 0x16, 0x16, 0x0d, 0x00, 0x01, - 0x60, 0x23, 0x23, 0x00, 0x00, 0x02, - 0xa8, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0x54, 0x64, 0x64, 0x37, 0x00, 0x01, + 0x60, 0x8c, 0x8c, 0x00, 0x00, 0x04, + 0xa8, 0x64, 0x64, 0x37, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -237,9 +237,9 @@ const uint8_t display_start_sequence[] = { // White to black LUT_WB, 42, - 0xa8, 0x16, 0x16, 0x0d, 0x00, 0x01, - 0x60, 0x23, 0x23, 0x00, 0x00, 0x02, - 0x54, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0xa8, 0x64, 0x64, 0x37, 0x00, 0x01, + 0x60, 0x8c, 0x8c, 0x00, 0x00, 0x04, + 0x54, 0x64, 0x64, 0x37, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -247,9 +247,9 @@ const uint8_t display_start_sequence[] = { // Black to black LUT_BB, 42, - 0xa8, 0x16, 0x16, 0x0d, 0x00, 0x01, - 0x60, 0x23, 0x23, 0x00, 0x00, 0x02, - 0x54, 0x16, 0x16, 0x0d, 0x00, 0x01, + 0xa8, 0x64, 0x64, 0x37, 0x00, 0x01, + 0x60, 0x8c, 0x8c, 0x00, 0x00, 0x04, + 0x54, 0x64, 0x64, 0x37, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, From ec21dc6975f5e5fb879e00cfad4a48df40628f28 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Thu, 8 Jun 2023 12:01:39 -0500 Subject: [PATCH 1183/1712] added debug prints --- shared-module/displayio/TileGrid.c | 5 +++++ shared-module/displayio/__init__.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index 18f22629ab..c0a5bb8f6e 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -555,6 +555,11 @@ bool displayio_tilegrid_fill_area(displayio_tilegrid_t *self, } void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) { + + mp_printf(&mp_plat_print, "(cx1: %d, cy1: %d )\n", self->current_area.x1, self->current_area.y1); + //mp_printf(&mp_plat_print, "x1: %d \n", self->previous_area.x1); + //mp_printf(&mp_plat_print, "(x1: %d, y1: %d),(x2: %d, y2: %d)\n", self->previous_area.x1, self->previous_area.y1, self->previous_area.x2, self->previous_area.y2); + //mp_printf(&mp_plat_print, "Hello ", 1); bool first_draw = self->previous_area.x1 == self->previous_area.x2; bool hidden = self->hidden || self->hidden_by_parent; if (!first_draw && hidden) { diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index e9431dee14..691005c58e 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -293,8 +293,9 @@ void reset_displays(void) { if (display_type == &displayio_display_type) { reset_display(&displays[i].display); } else if (display_type == &displayio_epaperdisplay_type) { - displayio_epaperdisplay_obj_t *display = &displays[i].epaper_display; - common_hal_displayio_epaperdisplay_show(display, NULL); + //displayio_epaperdisplay_obj_t *display = &displays[i].epaper_display; + //common_hal_displayio_epaperdisplay_show(display, NULL); + mp_printf(&mp_plat_print, "Skipping EPaperDisplay show terminal\n"); #if CIRCUITPY_FRAMEBUFFERIO } else if (display_type == &framebufferio_framebufferdisplay_type) { framebufferio_framebufferdisplay_reset(&displays[i].framebuffer_display); From 4d5caff0ed39fd53ad3c0a016e04e5c6a9e89c24 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 8 Jun 2023 13:02:24 -0400 Subject: [PATCH 1184/1712] fix missing newline --- ports/silabs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/silabs/README.md b/ports/silabs/README.md index 1637a9a4bf..17423f57a3 100644 --- a/ports/silabs/README.md +++ b/ports/silabs/README.md @@ -120,4 +120,4 @@ With the boards which support USB mass storage, we can drag the files to the boa Refer to the guide below for installing the **Ampy** tool: - \ No newline at end of file + From 50951d8019dd23104218358876f1d492da766113 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 8 Jun 2023 12:30:39 -0500 Subject: [PATCH 1185/1712] bump protomatter once more --- lib/protomatter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/protomatter b/lib/protomatter index ce18b6d465..ecab2fa75e 160000 --- a/lib/protomatter +++ b/lib/protomatter @@ -1 +1 @@ -Subproject commit ce18b6d465d94d89e970ea39a48072a396ad7c27 +Subproject commit ecab2fa75e9d7675785d2b87f29a22f027da8ce5 From edaff6d1fa173cc22afd62840d26a39db48dda64 Mon Sep 17 00:00:00 2001 From: Reza Almanda Date: Thu, 8 Jun 2023 10:29:55 +0000 Subject: [PATCH 1186/1712] Translated using Weblate (Indonesian) Currently translated at 34.4% (343 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/id/ --- locale/ID.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 0dd475a3c9..94348e18a8 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -6,8 +6,8 @@ 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: 2023-05-21 00:49+0000\n" -"Last-Translator: Scott Shawcroft \n" +"PO-Revision-Date: 2023-06-09 10:50+0000\n" +"Last-Translator: Reza Almanda \n" "Language-Team: LANGUAGE \n" "Language: ID\n" "MIME-Version: 1.0\n" @@ -4364,7 +4364,7 @@ msgstr "jumlah argumen salah" #: py/runtime.c msgid "wrong number of values to unpack" -msgstr "" +msgstr "jumlah nilai yang salah untuk dibongkar" #: extmod/ulab/code/numpy/vector.c msgid "wrong output type" From d5a2293784a1243b19fe271f2bf51104c3b2eb71 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 9 Jun 2023 11:27:54 -0500 Subject: [PATCH 1187/1712] nrf52840: allow 12 voices In my testing, the feather bluefruit can do 12 voices at 48kHz! This is a simple case (no LFOs, no ring modulation) so other situations might require a lower sample rate, fewer voices, or both. The sound is a little artifacty & low-fi but I think that's down to the speaker & use of PWM instead of I2S. --- ports/nrf/mpconfigport.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk index 7973453c2f..58700817d5 100644 --- a/ports/nrf/mpconfigport.mk +++ b/ports/nrf/mpconfigport.mk @@ -20,6 +20,7 @@ CIRCUITPY_AUDIOBUSIO ?= 1 CIRCUITPY_AUDIOCORE ?= 1 CIRCUITPY_AUDIOMIXER ?= 1 CIRCUITPY_AUDIOPWMIO ?= 1 +CIRCUITPY_SYNTHIO_MAX_CHANNELS = 12 # Native BLEIO is not compatible with HCI _bleio. CIRCUITPY_BLEIO_HCI = 0 From 18faeb86c7c545970b6d1817113cc78710333c78 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Fri, 9 Jun 2023 14:53:11 -0500 Subject: [PATCH 1188/1712] more debug prints --- shared-module/displayio/TileGrid.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index c0a5bb8f6e..d6cab6ab11 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -556,7 +556,20 @@ bool displayio_tilegrid_fill_area(displayio_tilegrid_t *self, void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) { - mp_printf(&mp_plat_print, "(cx1: %d, cy1: %d )\n", self->current_area.x1, self->current_area.y1); + //mp_printf(&mp_plat_print, "(cy1: %d)\n", self->current_area.y1); + + //mp_printf(&mp_plat_print, "(px1: %d, py1: %d)\n", self->previous_area.x1, self->previous_area.y1); + mp_printf(&mp_plat_print, "(px2: %d, py2: %d)\n", self->previous_area.x2, self->previous_area.y2); + + //mp_printf(&mp_plat_print, "(cx1: %d, cy1: %d)\n", self->current_area.x1, self->current_area.y1); + //mp_printf(&mp_plat_print, "(cx2: %d, cy2: %d)\n", self->current_area.x2, self->current_area.y2); + + + //mp_printf(&mp_plat_print, "(cx2: %d)\n", self->current_area.x2); + //mp_printf(&mp_plat_print, "(cy2: %d)\n", self->current_area.y2); + + //mp_printf(&mp_plat_print, "(cx1: %d, cy1: %d), (cx2: %d, cy2: %d)\n", self->current_area.x1, self->current_area.y1, self->current_area.x2, self->current_area.y2); + //mp_printf(&mp_plat_print, "x1: %d \n", self->previous_area.x1); //mp_printf(&mp_plat_print, "(x1: %d, y1: %d),(x2: %d, y2: %d)\n", self->previous_area.x1, self->previous_area.y1, self->previous_area.x2, self->previous_area.y2); //mp_printf(&mp_plat_print, "Hello ", 1); From 14af662ab951a6cbbbd60140118a84d990cafcb5 Mon Sep 17 00:00:00 2001 From: Seon Rozenblum Date: Mon, 12 Jun 2023 20:32:46 +1000 Subject: [PATCH 1189/1712] Added support for Unexpected Maker NANOS3 --- .../boards/unexpectedmaker_nanos3/board.c | 37 ++++++ .../unexpectedmaker_nanos3/mpconfigboard.h | 43 ++++++ .../unexpectedmaker_nanos3/mpconfigboard.mk | 15 +++ .../boards/unexpectedmaker_nanos3/pins.c | 123 ++++++++++++++++++ .../boards/unexpectedmaker_nanos3/sdkconfig | 39 ++++++ 5 files changed, 257 insertions(+) create mode 100644 ports/espressif/boards/unexpectedmaker_nanos3/board.c create mode 100644 ports/espressif/boards/unexpectedmaker_nanos3/mpconfigboard.h create mode 100644 ports/espressif/boards/unexpectedmaker_nanos3/mpconfigboard.mk create mode 100644 ports/espressif/boards/unexpectedmaker_nanos3/pins.c create mode 100644 ports/espressif/boards/unexpectedmaker_nanos3/sdkconfig diff --git a/ports/espressif/boards/unexpectedmaker_nanos3/board.c b/ports/espressif/boards/unexpectedmaker_nanos3/board.c new file mode 100644 index 0000000000..8fd94f6c8b --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_nanos3/board.c @@ -0,0 +1,37 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ +} diff --git a/ports/espressif/boards/unexpectedmaker_nanos3/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_nanos3/mpconfigboard.h new file mode 100644 index 0000000000..ed7a9ebf74 --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_nanos3/mpconfigboard.h @@ -0,0 +1,43 @@ +/* + * 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 "NanoS3" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO42) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO41) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/unexpectedmaker_nanos3/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_nanos3/mpconfigboard.mk new file mode 100644 index 0000000000..c61654bfc3 --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_nanos3/mpconfigboard.mk @@ -0,0 +1,15 @@ +USB_VID = 0x303A +USB_PID = 0x817A +USB_PRODUCT = "NanoS3" +USB_MANUFACTURER = "UnexpectedMaker" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB + +# CIRCUITPY_BITBANG_NEOPIXEL = 1 + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/espressif/boards/unexpectedmaker_nanos3/pins.c b/ports/espressif/boards/unexpectedmaker_nanos3/pins.c new file mode 100644 index 0000000000..58cf58568c --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_nanos3/pins.c @@ -0,0 +1,123 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A13), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A14), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_A15), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_A16), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_A17), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_MO), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_SDO), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_MI), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_SDI), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO41) }, + + { 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_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/unexpectedmaker_nanos3/sdkconfig b/ports/espressif/boards/unexpectedmaker_nanos3/sdkconfig new file mode 100644 index 0000000000..c1dee83717 --- /dev/null +++ b/ports/espressif/boards/unexpectedmaker_nanos3/sdkconfig @@ -0,0 +1,39 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y + +# +# SPI RAM config +# +# CONFIG_SPIRAM_TYPE_AUTO is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 + +# +# PSRAM clock and cs IO for ESP32S2 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM clock and cs IO for ESP32S2 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +# CONFIG_SPIRAM_SPEED_26M is not set +# CONFIG_SPIRAM_SPEED_20M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +# CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# end of SPI RAM config + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="UMNanoS3" +# end of LWIP From 46de2cb6828dac92e6611f4938e615a566a71508 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 13 Jun 2023 07:59:33 -0700 Subject: [PATCH 1190/1712] Add buttons and accelerometer interrupt --- ports/espressif/boards/adafruit_matrixportal_s3/pins.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ports/espressif/boards/adafruit_matrixportal_s3/pins.c b/ports/espressif/boards/adafruit_matrixportal_s3/pins.c index 8284047aae..bc2de4299b 100644 --- a/ports/espressif/boards/adafruit_matrixportal_s3/pins.c +++ b/ports/espressif/boards/adafruit_matrixportal_s3/pins.c @@ -87,6 +87,12 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_LAT),MP_ROM_PTR(&pin_GPIO47) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_OE),MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_ACCELEROMETER_INTERRUPT), MP_ROM_PTR(&pin_GPIO15) }, + + // Grounded when closed. + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_UP),MP_ROM_PTR(&pin_GPIO6) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_DOWN),MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) } From 979f2f5ef3dbde361aa088472a27ddaa6dd025f6 Mon Sep 17 00:00:00 2001 From: Kamil Tomaszewski Date: Wed, 14 Jun 2023 12:24:00 +0200 Subject: [PATCH 1191/1712] spresense: update SDK to 3.0.1 --- ports/cxd56/Makefile | 2 -- ports/cxd56/README.md | 2 +- ports/cxd56/configs/circuitpython/defconfig | 8 +++----- ports/cxd56/spresense-exported-sdk | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile index 2fbb599c25..35a4df1393 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -102,8 +102,6 @@ LIBGCC = "${shell "$(CC)" $(CFLAGS) -print-libgcc-file-name}" LDFLAGS = \ --entry=__start \ - -nostartfiles \ - -nodefaultlibs \ -T$(SPRESENSE_SDK)/nuttx/scripts/ramconfig.ld \ --gc-sections \ -Map=$(BUILD)/output.map \ diff --git a/ports/cxd56/README.md b/ports/cxd56/README.md index 4266c61c0c..d727722249 100644 --- a/ports/cxd56/README.md +++ b/ports/cxd56/README.md @@ -75,7 +75,7 @@ Bootloader information: * You have to accept the End User License Agreement to be able to download and use the Spresense bootloader binary. -Download the spresense binaries zip archive from: [Spresense firmware v2-4-000](https://developer.sony.com/file/download/download-spresense-firmware-v2-4-000) +Download the spresense binaries zip archive from: [Spresense firmware v3-0-0](https://developer.sony.com/file/download/download-spresense-firmware-v3-0-0) Extract spresense binaries in your PC to ports/spresense/spresense-exported-sdk/firmware/ diff --git a/ports/cxd56/configs/circuitpython/defconfig b/ports/cxd56/configs/circuitpython/defconfig index 92e282649b..3655a5fdcd 100644 --- a/ports/cxd56/configs/circuitpython/defconfig +++ b/ports/cxd56/configs/circuitpython/defconfig @@ -17,6 +17,7 @@ # CONFIG_STANDARD_SERIAL is not set CONFIG_ARCH="arm" CONFIG_ARCH_BOARD="spresense" +CONFIG_ARCH_BOARD_COMMON=y CONFIG_ARCH_BOARD_SPRESENSE=y CONFIG_ARCH_CHIP="cxd56xx" CONFIG_ARCH_CHIP_CXD56XX=y @@ -33,7 +34,6 @@ CONFIG_BOARD_CRASHDUMP=y CONFIG_BOARD_LATE_INITIALIZE=y CONFIG_BOARD_LOOPSPERMSEC=5434 CONFIG_BOOT_RUNFROMISRAM=y -CONFIG_CLOCK_MONOTONIC=y CONFIG_CXD56_ADC=y CONFIG_CXD56_BINARY=y CONFIG_CXD56_CHARGER=y @@ -63,7 +63,8 @@ CONFIG_CXD56_SPI=y CONFIG_CXD56_UART2=y CONFIG_DRIVERS_VIDEO=y CONFIG_FS_FAT=y -CONFIG_LIBC_FLOATINGPOINT=y +CONFIG_INIT_ENTRYPOINT="spresense_main" +CONFIG_INIT_STACKSIZE=8192 CONFIG_MMCSD=y CONFIG_MMCSD_SDIO=y CONFIG_MTD=y @@ -91,7 +92,6 @@ CONFIG_SCHED_HPWORK=y CONFIG_SCHED_LPNTHREADS=3 CONFIG_SCHED_LPWORK=y CONFIG_SCHED_WAITPID=y -CONFIG_SDCLONE_DISABLE=y CONFIG_SDIO_MUXBUS=y CONFIG_SERIAL_TERMIOS=y CONFIG_SPI=y @@ -110,8 +110,6 @@ CONFIG_USBDEV=y CONFIG_USBDEV_DMA=y CONFIG_USBDEV_DUALSPEED=y CONFIG_USEC_PER_TICK=1000 -CONFIG_USERMAIN_STACKSIZE=8192 -CONFIG_USER_ENTRYPOINT="spresense_main" CONFIG_VIDEO_ISX012=y CONFIG_VIDEO_ISX019=y CONFIG_VIDEO_STREAM=y diff --git a/ports/cxd56/spresense-exported-sdk b/ports/cxd56/spresense-exported-sdk index 4f902ca3ff..c12296c5ff 160000 --- a/ports/cxd56/spresense-exported-sdk +++ b/ports/cxd56/spresense-exported-sdk @@ -1 +1 @@ -Subproject commit 4f902ca3ffeb327e6c325940ef5133eda588c2e4 +Subproject commit c12296c5ffbd0779e630a653c76a78558b463271 From 7354e2ad0355e73c494f8fe9f03b649ca8ef42b5 Mon Sep 17 00:00:00 2001 From: leosun Date: Thu, 15 Jun 2023 07:48:19 +0800 Subject: [PATCH 1192/1712] fix `invalid pin` error when create `busio.SPI` on specific SCK/MOSI/MISO pins, the `common_hal_busio_spi_construct` method always skip miso pins which will lead to a `invalid pin` exception when SPI initilized --- ports/mimxrt10xx/common-hal/busio/SPI.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/mimxrt10xx/common-hal/busio/SPI.c b/ports/mimxrt10xx/common-hal/busio/SPI.c index 641714bcca..1ab9394244 100644 --- a/ports/mimxrt10xx/common-hal/busio/SPI.c +++ b/ports/mimxrt10xx/common-hal/busio/SPI.c @@ -109,7 +109,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, // if both MOSI and MISO exist, loop search normally if ((mosi != NULL) && (miso != NULL)) { for (uint j = 0; j < mosi_count; j++) { - if ((mcu_spi_sdo_list[i].pin != mosi) + if ((mcu_spi_sdo_list[j].pin != mosi) || (mcu_spi_sck_list[i].bank_idx != mcu_spi_sdo_list[j].bank_idx)) { continue; } From b0e0b4adced39d8e2e7cb46d9f0300d5df995710 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Thu, 15 Jun 2023 20:20:17 -0500 Subject: [PATCH 1193/1712] ap channel validation --- shared-bindings/wifi/Radio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 0c632a68b2..0380d33bc7 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -374,6 +374,8 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_ } } + mp_int_t channel = mp_arg_validate_int_range(args[ARG_channel].u_int, 1, 13, MP_QSTR_channel); + if (authmodes == AUTHMODE_OPEN && password.len > 0) { mp_raise_ValueError(translate("AuthMode.OPEN is not used with password")); } @@ -385,7 +387,7 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_ } } - common_hal_wifi_radio_start_ap(self, ssid.buf, ssid.len, password.buf, password.len, args[ARG_channel].u_int, authmodes, args[ARG_max_connections].u_int); + common_hal_wifi_radio_start_ap(self, ssid.buf, ssid.len, password.buf, password.len, channel, authmodes, args[ARG_max_connections].u_int); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_start_ap_obj, 1, wifi_radio_start_ap); From 340506be5852477c6ce2fa8595edcc6fac5493c4 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Fri, 16 Jun 2023 16:43:10 -0500 Subject: [PATCH 1194/1712] revert unrelated epd change --- shared-module/displayio/TileGrid.c | 2 +- shared-module/displayio/__init__.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index d6cab6ab11..70e81545de 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -559,7 +559,7 @@ void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) { //mp_printf(&mp_plat_print, "(cy1: %d)\n", self->current_area.y1); //mp_printf(&mp_plat_print, "(px1: %d, py1: %d)\n", self->previous_area.x1, self->previous_area.y1); - mp_printf(&mp_plat_print, "(px2: %d, py2: %d)\n", self->previous_area.x2, self->previous_area.y2); + //mp_printf(&mp_plat_print, "(px2: %d, py2: %d)\n", self->previous_area.x2, self->previous_area.y2); //mp_printf(&mp_plat_print, "(cx1: %d, cy1: %d)\n", self->current_area.x1, self->current_area.y1); //mp_printf(&mp_plat_print, "(cx2: %d, cy2: %d)\n", self->current_area.x2, self->current_area.y2); diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index 691005c58e..e9431dee14 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -293,9 +293,8 @@ void reset_displays(void) { if (display_type == &displayio_display_type) { reset_display(&displays[i].display); } else if (display_type == &displayio_epaperdisplay_type) { - //displayio_epaperdisplay_obj_t *display = &displays[i].epaper_display; - //common_hal_displayio_epaperdisplay_show(display, NULL); - mp_printf(&mp_plat_print, "Skipping EPaperDisplay show terminal\n"); + displayio_epaperdisplay_obj_t *display = &displays[i].epaper_display; + common_hal_displayio_epaperdisplay_show(display, NULL); #if CIRCUITPY_FRAMEBUFFERIO } else if (display_type == &framebufferio_framebufferdisplay_type) { framebufferio_framebufferdisplay_reset(&displays[i].framebuffer_display); From 0e3cdea51e660e6df7a530c6213ed685c1616984 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Fri, 16 Jun 2023 16:47:24 -0500 Subject: [PATCH 1195/1712] remove prints --- shared-module/displayio/Display.c | 3 --- shared-module/displayio/TileGrid.c | 22 ---------------------- 2 files changed, 25 deletions(-) diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index ae2b4efe6b..093604214d 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -330,10 +330,7 @@ STATIC void _refresh_display(displayio_display_obj_t *self) { return; } const displayio_area_t *current_area = _get_refresh_areas(self); - int i = 0; while (current_area != NULL) { - mp_printf(&mp_plat_print, "calling refresh area: %d \n", i); - i = i + 1; _refresh_area(self, current_area); current_area = current_area->next; } diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index 70e81545de..6b4753b129 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -556,23 +556,6 @@ bool displayio_tilegrid_fill_area(displayio_tilegrid_t *self, void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) { - //mp_printf(&mp_plat_print, "(cy1: %d)\n", self->current_area.y1); - - //mp_printf(&mp_plat_print, "(px1: %d, py1: %d)\n", self->previous_area.x1, self->previous_area.y1); - //mp_printf(&mp_plat_print, "(px2: %d, py2: %d)\n", self->previous_area.x2, self->previous_area.y2); - - //mp_printf(&mp_plat_print, "(cx1: %d, cy1: %d)\n", self->current_area.x1, self->current_area.y1); - //mp_printf(&mp_plat_print, "(cx2: %d, cy2: %d)\n", self->current_area.x2, self->current_area.y2); - - - //mp_printf(&mp_plat_print, "(cx2: %d)\n", self->current_area.x2); - //mp_printf(&mp_plat_print, "(cy2: %d)\n", self->current_area.y2); - - //mp_printf(&mp_plat_print, "(cx1: %d, cy1: %d), (cx2: %d, cy2: %d)\n", self->current_area.x1, self->current_area.y1, self->current_area.x2, self->current_area.y2); - - //mp_printf(&mp_plat_print, "x1: %d \n", self->previous_area.x1); - //mp_printf(&mp_plat_print, "(x1: %d, y1: %d),(x2: %d, y2: %d)\n", self->previous_area.x1, self->previous_area.y1, self->previous_area.x2, self->previous_area.y2); - //mp_printf(&mp_plat_print, "Hello ", 1); bool first_draw = self->previous_area.x1 == self->previous_area.x2; bool hidden = self->hidden || self->hidden_by_parent; if (!first_draw && hidden) { @@ -602,14 +585,10 @@ void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) { } displayio_area_t *displayio_tilegrid_get_refresh_areas(displayio_tilegrid_t *self, displayio_area_t *tail) { - // mp_printf(&mp_plat_print, "x1 : %d x2: %d \n", self->previous_area.x1, self->previous_area.x2); bool first_draw = self->previous_area.x1 == self->previous_area.x2; bool hidden = self->hidden || self->hidden_by_parent; - // mp_printf(&mp_plat_print, "first draw: %d\n", first_draw); // Check hidden first because it trumps all other changes. if (hidden) { - // mp_printf(&mp_plat_print, "rendered_hidden: %d\n", self->rendered_hidden); - // if (!self->rendered_hidden){ self->rendered_hidden = true; if (!first_draw) { self->previous_area.next = tail; @@ -617,7 +596,6 @@ displayio_area_t *displayio_tilegrid_get_refresh_areas(displayio_tilegrid_t *sel } else { return tail; } - // } } else if (self->moved && !first_draw) { displayio_area_union(&self->previous_area, &self->current_area, &self->dirty_area); From 3222cdf847a9066f14fd5882ba0681db068c3f20 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Fri, 16 Jun 2023 16:50:01 -0500 Subject: [PATCH 1196/1712] revert indention change --- shared-module/displayio/Group.c | 54 ++++++++++++++++----------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index 29ea340c00..0152343df8 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -438,35 +438,35 @@ void displayio_group_finish_refresh(displayio_group_t *self) { } displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, displayio_area_t *tail) { - if (self->item_removed) { - self->dirty_area.next = tail; - tail = &self->dirty_area; - } + if (self->item_removed) { + self->dirty_area.next = tail; + tail = &self->dirty_area; + } - for (int32_t i = self->members->len - 1; i >= 0; i--) { - mp_obj_t layer; - #if CIRCUITPY_VECTORIO - const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[i]); - if (draw_protocol != NULL) { - layer = draw_protocol->draw_get_protocol_self(self->members->items[i]); - tail = draw_protocol->draw_protocol_impl->draw_get_refresh_areas(layer, tail); - continue; - } - #endif - layer = mp_obj_cast_to_native_base( - self->members->items[i], &displayio_tilegrid_type); - if (layer != MP_OBJ_NULL) { - if (!displayio_tilegrid_get_rendered_hidden(layer)) { - tail = displayio_tilegrid_get_refresh_areas(layer, tail); - } - continue; - } - layer = mp_obj_cast_to_native_base( - self->members->items[i], &displayio_group_type); - if (layer != MP_OBJ_NULL) { - tail = displayio_group_get_refresh_areas(layer, tail); - continue; + for (int32_t i = self->members->len - 1; i >= 0; i--) { + mp_obj_t layer; + #if CIRCUITPY_VECTORIO + const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[i]); + if (draw_protocol != NULL) { + layer = draw_protocol->draw_get_protocol_self(self->members->items[i]); + tail = draw_protocol->draw_protocol_impl->draw_get_refresh_areas(layer, tail); + continue; + } + #endif + layer = mp_obj_cast_to_native_base( + self->members->items[i], &displayio_tilegrid_type); + if (layer != MP_OBJ_NULL) { + if (!displayio_tilegrid_get_rendered_hidden(layer)) { + tail = displayio_tilegrid_get_refresh_areas(layer, tail); } + continue; + } + layer = mp_obj_cast_to_native_base( + self->members->items[i], &displayio_group_type); + if (layer != MP_OBJ_NULL) { + tail = displayio_group_get_refresh_areas(layer, tail); + continue; + } } return tail; From 074c13488b6fade34dce5698d65b7fb5aaf49585 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Fri, 16 Jun 2023 16:57:37 -0500 Subject: [PATCH 1197/1712] revert whitespace change. handle hidden by parent --- shared-module/displayio/Group.c | 4 ++-- shared-module/displayio/TileGrid.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index 0152343df8..bd92d20c2d 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -454,7 +454,7 @@ displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, dis } #endif layer = mp_obj_cast_to_native_base( - self->members->items[i], &displayio_tilegrid_type); + self->members->items[i], &displayio_tilegrid_type); if (layer != MP_OBJ_NULL) { if (!displayio_tilegrid_get_rendered_hidden(layer)) { tail = displayio_tilegrid_get_refresh_areas(layer, tail); @@ -462,7 +462,7 @@ displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, dis continue; } layer = mp_obj_cast_to_native_base( - self->members->items[i], &displayio_group_type); + self->members->items[i], &displayio_group_type); if (layer != MP_OBJ_NULL) { tail = displayio_group_get_refresh_areas(layer, tail); continue; diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index 6b4753b129..0b2cba5e0e 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -99,6 +99,8 @@ void displayio_tilegrid_set_hidden_by_parent(displayio_tilegrid_t *self, bool hi self->hidden_by_parent = hidden; if (!hidden) { self->full_change = true; + }else { + self->rendered_hidden = false; } } @@ -555,7 +557,6 @@ bool displayio_tilegrid_fill_area(displayio_tilegrid_t *self, } void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) { - bool first_draw = self->previous_area.x1 == self->previous_area.x2; bool hidden = self->hidden || self->hidden_by_parent; if (!first_draw && hidden) { @@ -596,7 +597,6 @@ displayio_area_t *displayio_tilegrid_get_refresh_areas(displayio_tilegrid_t *sel } else { return tail; } - } else if (self->moved && !first_draw) { displayio_area_union(&self->previous_area, &self->current_area, &self->dirty_area); if (displayio_area_size(&self->dirty_area) <= 2U * self->pixel_width * self->pixel_height) { From 4bf4d148c1c7a6b69fb907d95d469786922fb87c Mon Sep 17 00:00:00 2001 From: foamyguy Date: Fri, 16 Jun 2023 18:05:39 -0500 Subject: [PATCH 1198/1712] always set rendered_hidden false when hidden changes --- shared-module/displayio/TileGrid.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index 0b2cba5e0e..ea65920027 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -88,19 +88,17 @@ bool displayio_tilegrid_get_rendered_hidden(displayio_tilegrid_t *self) { void common_hal_displayio_tilegrid_set_hidden(displayio_tilegrid_t *self, bool hidden) { self->hidden = hidden; + self->rendered_hidden = false; if (!hidden) { self->full_change = true; - } else { - self->rendered_hidden = false; } } void displayio_tilegrid_set_hidden_by_parent(displayio_tilegrid_t *self, bool hidden) { self->hidden_by_parent = hidden; + self->rendered_hidden = false; if (!hidden) { self->full_change = true; - }else { - self->rendered_hidden = false; } } From ec1e7a03b38c625664a4615e60d26956205d7a67 Mon Sep 17 00:00:00 2001 From: Phil Underwood Date: Sat, 17 Jun 2023 22:42:12 +0100 Subject: [PATCH 1199/1712] Reset UART on deinit, reduces power consumption --- ports/nrf/common-hal/busio/UART.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index 10a34e09df..94201774de 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -266,8 +266,15 @@ bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) { } void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { + volatile uint32_t *power_cycle = (void*)(self->uarte->p_reg) + 0xFFC; if (!common_hal_busio_uart_deinited(self)) { + nrfx_uarte_rx_abort(self->uarte); + nrfx_uarte_tx_abort(self->uarte); nrfx_uarte_uninit(self->uarte); + // power cycle the peripheral as per https://devzone.nordicsemi.com/f/nordic-q-a/26030/how-to-reach-nrf52840-uarte-current-supply-specification/102605#102605 + *power_cycle = 0; + *power_cycle; + *power_cycle = 1; reset_pin_number(self->tx_pin_number); reset_pin_number(self->rx_pin_number); reset_pin_number(self->rts_pin_number); From 4bb475b930d4237f09f26ac3a6f841fbd690d026 Mon Sep 17 00:00:00 2001 From: Phil Underwood Date: Sat, 17 Jun 2023 22:49:47 +0100 Subject: [PATCH 1200/1712] formatting --- ports/nrf/common-hal/busio/UART.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index 94201774de..626956946f 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -266,7 +266,7 @@ bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) { } void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { - volatile uint32_t *power_cycle = (void*)(self->uarte->p_reg) + 0xFFC; + volatile uint32_t *power_cycle = (void *)(self->uarte->p_reg) + 0xFFC; if (!common_hal_busio_uart_deinited(self)) { nrfx_uarte_rx_abort(self->uarte); nrfx_uarte_tx_abort(self->uarte); From 0aa7854d5b3f6a7a3756f8e4c8243d38e301c95b Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Mon, 19 Jun 2023 18:00:49 +0300 Subject: [PATCH 1201/1712] Update pico-sdk to 1.5.1 --- ports/raspberrypi/sdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/sdk b/ports/raspberrypi/sdk index 2ccab115de..6a7db34ff6 160000 --- a/ports/raspberrypi/sdk +++ b/ports/raspberrypi/sdk @@ -1 +1 @@ -Subproject commit 2ccab115de0d42d31d6611cca19ef0cd0d2ccaa7 +Subproject commit 6a7db34ff63345a7badec79ebea3aaef1712f374 From fae14cc55b7f9978b97f161654e8707246ce9011 Mon Sep 17 00:00:00 2001 From: Phil Underwood Date: Mon, 19 Jun 2023 22:20:46 +0100 Subject: [PATCH 1202/1712] Fix for #8093 This adds a check to make sure that SDA and SCL are in a sane condition before starting any I2C operation. If they are not it tries to rectify it, and then returns an error code if unable to do so. --- ports/nrf/Makefile | 1 + ports/nrf/common-hal/busio/I2C.c | 56 ++++++++++++++++++++++++++++---- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 8a8625bd95..d0d5e2a6eb 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -114,6 +114,7 @@ SRC_NRFX = $(addprefix nrfx/,\ drivers/src/nrfx_spim.c \ drivers/src/nrfx_timer.c \ drivers/src/nrfx_twim.c \ + drivers/src/nrfx_twi_twim.c \ drivers/src/nrfx_uarte.c \ drivers/src/nrfx_gpiote.c \ drivers/src/nrfx_rtc.c \ diff --git a/ports/nrf/common-hal/busio/I2C.c b/ports/nrf/common-hal/busio/I2C.c index 2bd1416f5a..23b2413441 100644 --- a/ports/nrf/common-hal/busio/I2C.c +++ b/ports/nrf/common-hal/busio/I2C.c @@ -79,20 +79,54 @@ void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) { } } +#define TWI_TWIM_PIN_CONFIGURE(_pin) nrf_gpio_cfg((_pin), \ + NRF_GPIO_PIN_DIR_OUTPUT, \ + NRF_GPIO_PIN_INPUT_CONNECT, \ + NRF_GPIO_PIN_PULLUP, \ + NRF_GPIO_PIN_S0D1, \ + NRF_GPIO_PIN_NOSENSE) + +static nrfx_err_t _safe_twim_enable(busio_i2c_obj_t *self) { + // check to see if bus is in sensible state before enabling twim + nrfx_err_t recover_result; + nrf_gpio_cfg_input(self->scl_pin_number, NRF_GPIO_PIN_PULLDOWN); + nrf_gpio_cfg_input(self->sda_pin_number, NRF_GPIO_PIN_PULLDOWN); + + common_hal_mcu_delay_us(10); + + nrf_gpio_cfg_input(self->scl_pin_number, NRF_GPIO_PIN_NOPULL); + nrf_gpio_cfg_input(self->sda_pin_number, NRF_GPIO_PIN_NOPULL); + + // We must pull up within 3us to achieve 400khz. + common_hal_mcu_delay_us(3); + + if (!nrf_gpio_pin_read(self->sda_pin_number) || !nrf_gpio_pin_read(self->scl_pin_number)) { + // bus not in a sane state - try to recover + recover_result = nrfx_twim_bus_recover(self->scl_pin_number, self->sda_pin_number); + if (NRFX_SUCCESS != recover_result) { + // return error message if unable to recover the bus + return recover_result; + } + } + + nrfx_twim_enable(&self->twim_peripheral->twim); + return NRFX_SUCCESS; +} + static uint8_t twi_error_to_mp(const nrfx_err_t err) { switch (err) { case NRFX_ERROR_DRV_TWI_ERR_ANACK: return MP_ENODEV; case NRFX_ERROR_BUSY: return MP_EBUSY; + case NRFX_SUCCESS: + return 0; case NRFX_ERROR_DRV_TWI_ERR_DNACK: case NRFX_ERROR_INVALID_ADDR: - return MP_EIO; + case NRFX_ERROR_INTERNAL: default: - break; + return MP_EIO; } - - return 0; } void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *scl, const mcu_pin_obj_t *sda, uint32_t frequency, uint32_t timeout) { @@ -188,7 +222,9 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) { NRF_TWIM_Type *reg = self->twim_peripheral->twim.p_twim; bool found = true; - nrfx_twim_enable(&self->twim_peripheral->twim); + if (NRFX_SUCCESS != _safe_twim_enable(self)) { + return false; + } nrf_twim_address_set(reg, addr); nrf_twim_tx_buffer_set(reg, NULL, 0); @@ -246,7 +282,10 @@ STATIC uint8_t _common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr, nrfx_err_t err = NRFX_SUCCESS; - nrfx_twim_enable(&self->twim_peripheral->twim); + err = _safe_twim_enable(self); + if (NRFX_SUCCESS != err) { + return twi_error_to_mp(err); + } // break into MAX_XFER_LEN transaction while (len) { @@ -278,7 +317,10 @@ uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr, uint8_t nrfx_err_t err = NRFX_SUCCESS; - nrfx_twim_enable(&self->twim_peripheral->twim); + err = _safe_twim_enable(self); + if (NRFX_SUCCESS != err) { + return twi_error_to_mp(err); + } // break into MAX_XFER_LEN transaction while (len) { From 028a81922bdac954ea59b194f6252cb0930eb4ae Mon Sep 17 00:00:00 2001 From: Phil Underwood Date: Tue, 20 Jun 2023 13:36:12 +0100 Subject: [PATCH 1203/1712] Remove unneeded #define from I2C.c --- ports/nrf/common-hal/busio/I2C.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/ports/nrf/common-hal/busio/I2C.c b/ports/nrf/common-hal/busio/I2C.c index 23b2413441..d64bdcfea4 100644 --- a/ports/nrf/common-hal/busio/I2C.c +++ b/ports/nrf/common-hal/busio/I2C.c @@ -79,13 +79,6 @@ void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) { } } -#define TWI_TWIM_PIN_CONFIGURE(_pin) nrf_gpio_cfg((_pin), \ - NRF_GPIO_PIN_DIR_OUTPUT, \ - NRF_GPIO_PIN_INPUT_CONNECT, \ - NRF_GPIO_PIN_PULLUP, \ - NRF_GPIO_PIN_S0D1, \ - NRF_GPIO_PIN_NOSENSE) - static nrfx_err_t _safe_twim_enable(busio_i2c_obj_t *self) { // check to see if bus is in sensible state before enabling twim nrfx_err_t recover_result; From cae02f1cdfdf0c4b3f67d83a4abc12b2f5f36a94 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 20 Jun 2023 11:01:46 -0500 Subject: [PATCH 1204/1712] Speed LTO builds by using multiple threads On my i5-1235U laptop this speeds LTO "partition=balanced" builds substantially, because each "partition" can be run on a separate CPU thread. I used "pygamer" as my test build with a parallelism of `-j4`, and took the best elapsed time reported over 4 builds. The improvement was from 34.6s to 24.0s (-30%). A link-only build (rm build-pygamer/firmware.elf; make -j...) improved from1 17.4s to 5.1s (-70%) The size of the resulting firmware is unchanged. Boards that are nearly full use "-flto-partition=one" to improve code size optimization. When LTO partition is "one", this feature doesn't help but it doesn't seem to negatively affect anything either (tested building trinket_m0) --- py/circuitpy_defns.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index ae4b1bf3db..4bfd55b0c9 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -70,7 +70,7 @@ endif CIRCUITPY_LTO ?= 0 CIRCUITPY_LTO_PARTITION ?= balanced ifeq ($(CIRCUITPY_LTO),1) -CFLAGS += -flto -flto-partition=$(CIRCUITPY_LTO_PARTITION) -DCIRCUITPY_LTO=1 +CFLAGS += -flto=jobserver -flto-partition=$(CIRCUITPY_LTO_PARTITION) -DCIRCUITPY_LTO=1 else CFLAGS += -DCIRCUITPY_LTO=0 endif From f5c03e64e58829580e822940896375682dc26ce1 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 20 Jun 2023 12:50:36 -0400 Subject: [PATCH 1205/1712] fix typos: "CTX mode" -> "CTR mode" --- shared-bindings/aesio/aes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/aesio/aes.c b/shared-bindings/aesio/aes.c index c5c50515ea..7ab895a1bd 100644 --- a/shared-bindings/aesio/aes.c +++ b/shared-bindings/aesio/aes.c @@ -170,7 +170,7 @@ STATIC void validate_length(aesio_aes_obj_t *self, size_t src_length, //| //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the //| buffers must be a multiple of 16 bytes, and must be equal length. For -//| CTX mode, there are no restrictions.""" +//| CTR mode, there are no restrictions.""" //| ... STATIC mp_obj_t aesio_aes_encrypt_into(mp_obj_t self_in, mp_obj_t src, mp_obj_t dest) { aesio_aes_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -192,7 +192,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(aesio_aes_encrypt_into_obj, aesio_aes_encrypt_i //| """Decrypt the buffer from ``src`` into ``dest``. //| For ECB mode, the buffers must be 16 bytes long. For CBC mode, the //| buffers must be a multiple of 16 bytes, and must be equal length. For -//| CTX mode, there are no restrictions.""" +//| CTR mode, there are no restrictions.""" //| ... //| STATIC mp_obj_t aesio_aes_decrypt_into(mp_obj_t self_in, mp_obj_t src, mp_obj_t dest) { From a7534908993ab75c095400d70ad675f247c617fc Mon Sep 17 00:00:00 2001 From: Phil Underwood Date: Tue, 20 Jun 2023 23:32:00 +0100 Subject: [PATCH 1206/1712] Refactor out test for bus sanity state --- ports/nrf/common-hal/busio/I2C.c | 45 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/ports/nrf/common-hal/busio/I2C.c b/ports/nrf/common-hal/busio/I2C.c index d64bdcfea4..d5b61ffeea 100644 --- a/ports/nrf/common-hal/busio/I2C.c +++ b/ports/nrf/common-hal/busio/I2C.c @@ -79,21 +79,33 @@ void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) { } } -static nrfx_err_t _safe_twim_enable(busio_i2c_obj_t *self) { - // check to see if bus is in sensible state before enabling twim - nrfx_err_t recover_result; - nrf_gpio_cfg_input(self->scl_pin_number, NRF_GPIO_PIN_PULLDOWN); - nrf_gpio_cfg_input(self->sda_pin_number, NRF_GPIO_PIN_PULLDOWN); +static bool _bus_is_sane(uint32_t scl_pin, uint32_t sda_pin) { + #if CIRCUITPY_REQUIRE_I2C_PULLUPS + nrf_gpio_cfg_input(scl_pin, NRF_GPIO_PIN_PULLDOWN); + nrf_gpio_cfg_input(sda_pin, NRF_GPIO_PIN_PULLDOWN); common_hal_mcu_delay_us(10); - nrf_gpio_cfg_input(self->scl_pin_number, NRF_GPIO_PIN_NOPULL); - nrf_gpio_cfg_input(self->sda_pin_number, NRF_GPIO_PIN_NOPULL); + nrf_gpio_cfg_input(scl_pin, NRF_GPIO_PIN_NOPULL); + nrf_gpio_cfg_input(sda_pin, NRF_GPIO_PIN_NOPULL); // We must pull up within 3us to achieve 400khz. common_hal_mcu_delay_us(3); + if (!nrf_gpio_pin_read(sda_pin) || !nrf_gpio_pin_read(scl_pin)) { + return false; + } else { + return true; + } + #else + return true; + #endif +} - if (!nrf_gpio_pin_read(self->sda_pin_number) || !nrf_gpio_pin_read(self->scl_pin_number)) { +static nrfx_err_t _safe_twim_enable(busio_i2c_obj_t *self) { + // check to see if bus is in sensible state before enabling twim + nrfx_err_t recover_result; + + if (!_bus_is_sane(self->scl_pin_number, self->sda_pin_number)) { // bus not in a sane state - try to recover recover_result = nrfx_twim_bus_recover(self->scl_pin_number, self->sda_pin_number); if (NRFX_SUCCESS != recover_result) { @@ -141,25 +153,12 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t * mp_raise_ValueError(translate("All I2C peripherals are in use")); } - #if CIRCUITPY_REQUIRE_I2C_PULLUPS - // Test that the pins are in a high state. (Hopefully indicating they are pulled up.) - nrf_gpio_cfg_input(scl->number, NRF_GPIO_PIN_PULLDOWN); - nrf_gpio_cfg_input(sda->number, NRF_GPIO_PIN_PULLDOWN); - - common_hal_mcu_delay_us(10); - - nrf_gpio_cfg_input(scl->number, NRF_GPIO_PIN_NOPULL); - nrf_gpio_cfg_input(sda->number, NRF_GPIO_PIN_NOPULL); - - // We must pull up within 3us to achieve 400khz. - common_hal_mcu_delay_us(3); - - if (!nrf_gpio_pin_read(sda->number) || !nrf_gpio_pin_read(scl->number)) { + // check bus is in a sane state + if (!_bus_is_sane(scl->number,sda->number)) { reset_pin_number(sda->number); reset_pin_number(scl->number); mp_raise_RuntimeError(translate("No pull up found on SDA or SCL; check your wiring")); } - #endif nrfx_twim_config_t config = NRFX_TWIM_DEFAULT_CONFIG(scl->number, sda->number); From e139cd9ec06bdb3dd0520d6774809d33c1b9275a Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Wed, 21 Jun 2023 01:35:52 +0300 Subject: [PATCH 1207/1712] Update cyw43 to 1.0.1 --- ports/raspberrypi/lib/cyw43-driver | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/lib/cyw43-driver b/ports/raspberrypi/lib/cyw43-driver index e52dd14a15..8ef38a6d32 160000 --- a/ports/raspberrypi/lib/cyw43-driver +++ b/ports/raspberrypi/lib/cyw43-driver @@ -1 +1 @@ -Subproject commit e52dd14a15e6a53e6263840704470246aa77c5ce +Subproject commit 8ef38a6d32c54f850bff8f189bdca19ded33792a From 112f0fd7675960f7cbf403882364e67e5ee39309 Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Wed, 21 Jun 2023 01:43:10 +0300 Subject: [PATCH 1208/1712] Add `-Wno-undef` to rp2 makefile for sdk --- ports/raspberrypi/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 7eb67b77ba..9c7c8549ca 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -142,6 +142,7 @@ INC += \ -Isdk_config \ -I../../lib/tinyusb/src \ -I../../supervisor/shared/usb \ + -I../bindings/cyw43/__init__.h \ -I$(BUILD) # Pico specific configuration @@ -171,7 +172,7 @@ else endif # Remove -Wno-stringop-overflow after we can test with CI's GCC 10. Mac's looks weird. -DISABLE_WARNINGS = -Wno-stringop-overflow -Wno-cast-align +DISABLE_WARNINGS = -Wno-stringop-overflow -Wno-cast-align -Wno-undef CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) -Werror=missing-prototypes From 9a2e9f7e41fe969870bd7f2e8f5e51c035816ae9 Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 20 Jun 2023 18:50:15 -0400 Subject: [PATCH 1209/1712] added bee data logger --- .../smartbeedesigns_bee_data_logger/board.c | 39 ++++++++ .../mpconfigboard.h | 41 +++++++++ .../mpconfigboard.mk | 18 ++++ .../smartbeedesigns_bee_data_logger/pins.c | 88 +++++++++++++++++++ .../smartbeedesigns_bee_data_logger/sdkconfig | 6 ++ 5 files changed, 192 insertions(+) create mode 100644 ports/espressif/boards/smartbeedesigns_bee_data_logger/board.c create mode 100644 ports/espressif/boards/smartbeedesigns_bee_data_logger/mpconfigboard.h create mode 100644 ports/espressif/boards/smartbeedesigns_bee_data_logger/mpconfigboard.mk create mode 100644 ports/espressif/boards/smartbeedesigns_bee_data_logger/pins.c create mode 100644 ports/espressif/boards/smartbeedesigns_bee_data_logger/sdkconfig diff --git a/ports/espressif/boards/smartbeedesigns_bee_data_logger/board.c b/ports/espressif/boards/smartbeedesigns_bee_data_logger/board.c new file mode 100644 index 0000000000..b3c8cb4191 --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_data_logger/board.c @@ -0,0 +1,39 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/smartbeedesigns_bee_data_logger/mpconfigboard.h b/ports/espressif/boards/smartbeedesigns_bee_data_logger/mpconfigboard.h new file mode 100644 index 0000000000..1506b34573 --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_data_logger/mpconfigboard.h @@ -0,0 +1,41 @@ +/* + * 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 "Bee-Data-Logger" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO48) +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO36) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO37) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO48) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO46) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO45) diff --git a/ports/espressif/boards/smartbeedesigns_bee_data_logger/mpconfigboard.mk b/ports/espressif/boards/smartbeedesigns_bee_data_logger/mpconfigboard.mk new file mode 100644 index 0000000000..4c9b6c9d20 --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_data_logger/mpconfigboard.mk @@ -0,0 +1,18 @@ +USB_VID = 0x303A +USB_PID = 0x815D +USB_PRODUCT = "Bee-Data-Logger" +USB_MANUFACTURER = "Smart Bee Designs" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB + + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DS3231 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/smartbeedesigns_bee_data_logger/pins.c b/ports/espressif/boards/smartbeedesigns_bee_data_logger/pins.c new file mode 100644 index 0000000000..2f2c1108aa --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_data_logger/pins.c @@ -0,0 +1,88 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + + + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_GPIO41) }, + + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_GPIO42) }, + + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO48) }, + + + + { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO34) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_D43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44)}, + { MP_ROM_QSTR(MP_QSTR_D44), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_BOOT_BTN), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_VBAT_SENSE), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO34) }, + + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/smartbeedesigns_bee_data_logger/sdkconfig b/ports/espressif/boards/smartbeedesigns_bee_data_logger/sdkconfig new file mode 100644 index 0000000000..4008263f8d --- /dev/null +++ b/ports/espressif/boards/smartbeedesigns_bee_data_logger/sdkconfig @@ -0,0 +1,6 @@ +# CONFIG_ESP32S3_SPIRAM_SUPPORT is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="smartbeedesigns_bee_data_logger" +# end of LWIP From 1f2a1a6e78f1a8d5b38a0cebad0f668217e3e93c Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 22 Jun 2023 14:24:48 -0400 Subject: [PATCH 1210/1712] Improve OnDiskGif doc; check image width --- shared-bindings/gifio/OnDiskGif.c | 6 ++++++ shared-module/gifio/OnDiskGif.c | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/shared-bindings/gifio/OnDiskGif.c b/shared-bindings/gifio/OnDiskGif.c index e4335f9e44..8a7bba3a7f 100644 --- a/shared-bindings/gifio/OnDiskGif.c +++ b/shared-bindings/gifio/OnDiskGif.c @@ -114,6 +114,12 @@ //| `displayio` expects little-endian, so the example above uses `Colorspace.RGB565_SWAPPED`. //| //| :param file file: The name of the GIF file. +//| +//| If the image is too large it will be cropped at the bottom and right when displayed. +//| +//| **Limitations**: The image width is limited to 320 pixels at present. `ValueError` +//| will be raised if the image is too wide. The height +//| is not limited but images that are too large will cause a memory exception. //| """ //| ... STATIC mp_obj_t gifio_ondiskgif_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { diff --git a/shared-module/gifio/OnDiskGif.c b/shared-module/gifio/OnDiskGif.c index c1e6d1f2c2..039e77cf45 100644 --- a/shared-module/gifio/OnDiskGif.c +++ b/shared-module/gifio/OnDiskGif.c @@ -169,7 +169,14 @@ void common_hal_gifio_ondiskgif_construct(gifio_ondiskgif_t *self, pyb_file_obj_ int result = GIF_init(&self->gif); if (result != 1) { - mp_arg_error_invalid(MP_QSTR_file); + switch (self->gif.iError) { + case GIF_TOO_WIDE: + mp_raise_ValueError_varg(translate("%q must be <= %d"), MP_QSTR_width, MAX_WIDTH); + break; + default: + mp_arg_error_invalid(MP_QSTR_file); + break; + } } int bpp = 16; From 8acc8581df86e153bb73bc2218a73d5789595d62 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 22 Jun 2023 14:53:40 -0400 Subject: [PATCH 1211/1712] note RP2040 countio limitations --- shared-bindings/countio/Counter.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shared-bindings/countio/Counter.c b/shared-bindings/countio/Counter.c index fc60994f5c..89b205e763 100644 --- a/shared-bindings/countio/Counter.c +++ b/shared-bindings/countio/Counter.c @@ -41,6 +41,10 @@ //| if pin_counter.count >= 100: //| pin_counter.reset() //| print(pin_counter.count) +//| +//| **Limitations:** On RP2040, `Counter` uses the PWM peripheral, and +//| is limited to using PWM channel B pins due to hardware restrictions. +//| See the pin assignments for your board to see which pins can be used. //| """ //| ... STATIC mp_obj_t countio_counter_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { From 540bf581021cc57353d2703f9e6070f25c0467de Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 22 Jun 2023 16:17:47 -0400 Subject: [PATCH 1212/1712] improve start_ap() doc; make "authmode" use consistent internally --- ports/espressif/common-hal/wifi/Radio.c | 16 ++++---- ports/raspberrypi/common-hal/wifi/Radio.c | 2 +- shared-bindings/wifi/Radio.c | 45 ++++++++++++----------- shared-bindings/wifi/Radio.h | 2 +- 4 files changed, 34 insertions(+), 31 deletions(-) diff --git a/ports/espressif/common-hal/wifi/Radio.c b/ports/espressif/common-hal/wifi/Radio.c index d0592b718f..0dcb02a327 100644 --- a/ports/espressif/common-hal/wifi/Radio.c +++ b/ports/espressif/common-hal/wifi/Radio.c @@ -206,22 +206,22 @@ void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self) { set_mode_station(self, false); } -void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint32_t authmodes, uint8_t max_connections) { +void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint32_t authmode, uint8_t max_connections) { set_mode_ap(self, true); - uint8_t authmode = 0; - switch (authmodes) { + uint8_t esp_authmode = 0; + switch (authmode) { case AUTHMODE_OPEN: - authmode = WIFI_AUTH_OPEN; + esp_authmode = WIFI_AUTH_OPEN; break; case AUTHMODE_WPA | AUTHMODE_PSK: - authmode = WIFI_AUTH_WPA_PSK; + esp_authmode = WIFI_AUTH_WPA_PSK; break; case AUTHMODE_WPA2 | AUTHMODE_PSK: - authmode = WIFI_AUTH_WPA2_PSK; + esp_authmode = WIFI_AUTH_WPA2_PSK; break; case AUTHMODE_WPA | AUTHMODE_WPA2 | AUTHMODE_PSK: - authmode = WIFI_AUTH_WPA_WPA2_PSK; + esp_authmode = WIFI_AUTH_WPA_WPA2_PSK; break; default: mp_arg_error_invalid(MP_QSTR_authmode); @@ -234,7 +234,7 @@ void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_ memcpy(&config->ap.password, password, password_len); config->ap.password[password_len] = 0; config->ap.channel = channel; - config->ap.authmode = authmode; + config->ap.authmode = esp_authmode; mp_arg_validate_int_range(max_connections, 0, 10, MP_QSTR_max_connections); diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index c6ee5492ad..e17b35d108 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -175,7 +175,7 @@ void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self) { bindings_cyw43_wifi_enforce_pm(); } -void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint32_t authmodes, uint8_t max_connections) { +void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint32_t authmode, uint8_t max_connections) { if (!common_hal_wifi_radio_get_enabled(self)) { mp_raise_RuntimeError(translate("Wifi is not enabled")); } diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 0380d33bc7..66502426cd 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -316,7 +316,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station); //| password: Union[str | ReadableBuffer] = b"", //| *, //| channel: int = 1, -//| authmode: Optional[AuthMode] = None, +//| authmode: Iterable[AuthMode] = (), //| max_connections: Optional[int] = 4, //| ) -> None: //| """Starts running an access point with the specified ssid and password. @@ -324,11 +324,16 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station); //| If ``channel`` is given, the access point will use that channel unless //| a station is already operating on a different channel. //| -//| If ``authmode`` is not None, the access point will use that Authentication -//| mode. If a non-empty password is given, ``authmode`` must not be ``OPEN``. -//| If ``authmode`` is not given or is None, -//| ``OPEN`` will be used when the password is the empty string, -//| otherwise ``authmode`` will be ``WPA_WPA2_PSK``. +//| If ``authmode`` is not None, the access point will use the given authentication modes. +//| If a non-empty password is given, ``authmode`` must not include ``OPEN``. +//| If ``authmode`` is not given or is an empty iterable, +//| ``(wifi.AuthMode.OPEN,)`` will be used when the password is the empty string, +//| otherwise ``authmode`` will be ``(wifi.AuthMode.WPA, wifi.AuthMode.WPA2, wifi.AuthMode.PSK)``. +//| +//| **Limitations:** On Espressif, ``authmode`` with a non-empty password must include +//| `wifi.AuthMode.PSK`, and one or both of `wifi.AuthMode.WPA` and `wifi.AuthMode.WPA2`. +//| On Pi Pico W, ``authmode`` is ignored; it is always ``(wifi.AuthMode.WPA2, wifi.AuthMode.PSK)` +//| with a non-empty password, or ``(wifi.AuthMode.OPEN,)`` when no password is given. //| //| The length of ``password`` must be 8-63 characters if it is ASCII, //| or exactly 64 hexadecimal characters if it is the hex form of the 256-bit key. @@ -342,7 +347,7 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_ { MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_password, MP_ARG_OBJ, {.u_obj = mp_const_empty_bytes} }, { MP_QSTR_channel, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, - { MP_QSTR_authmode, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none } }, + { MP_QSTR_authmode, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_empty_tuple } }, { MP_QSTR_max_connections, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 4} }, }; @@ -350,14 +355,12 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_ mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - // 0 indicates mode wasn't given. - uint32_t authmodes = 0; - if (args[ARG_authmode].u_obj != mp_const_none) { - mp_obj_iter_buf_t iter_buf; - mp_obj_t item, iterable = mp_getiter(args[ARG_authmode].u_obj, &iter_buf); - while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { - authmodes |= cp_enum_value(&wifi_authmode_type, item, MP_QSTR_authmode); - } + // 0 indicates no modes were given. Otherwise authmode is the OR of bits signifying the modes. + uint32_t authmode = 0; + mp_obj_iter_buf_t iter_buf; + mp_obj_t item, iterable = mp_getiter(args[ARG_authmode].u_obj, &iter_buf); + while ((item = mp_iternext(iterable)) != MP_OBJ_STOP_ITERATION) { + authmode |= cp_enum_value(&wifi_authmode_type, item, MP_QSTR_authmode); } mp_buffer_info_t ssid; @@ -366,28 +369,28 @@ STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_ mp_buffer_info_t password; mp_get_buffer_raise(args[ARG_password].u_obj, &password, MP_BUFFER_READ); - if (authmodes == 0) { + if (authmode == 0) { if (password.len == 0) { - authmodes = AUTHMODE_OPEN; + authmode = AUTHMODE_OPEN; } else { - authmodes = AUTHMODE_WPA | AUTHMODE_WPA2 | AUTHMODE_PSK; + authmode = AUTHMODE_WPA | AUTHMODE_WPA2 | AUTHMODE_PSK; } } mp_int_t channel = mp_arg_validate_int_range(args[ARG_channel].u_int, 1, 13, MP_QSTR_channel); - if (authmodes == AUTHMODE_OPEN && password.len > 0) { + if (authmode == AUTHMODE_OPEN && password.len > 0) { mp_raise_ValueError(translate("AuthMode.OPEN is not used with password")); } - if (authmodes != AUTHMODE_OPEN) { + if (authmode != AUTHMODE_OPEN) { mp_arg_validate_length_range(password.len, 8, 64, MP_QSTR_password); if (password.len == 64) { validate_hex_password(password.buf, password.len); } } - common_hal_wifi_radio_start_ap(self, ssid.buf, ssid.len, password.buf, password.len, channel, authmodes, args[ARG_max_connections].u_int); + common_hal_wifi_radio_start_ap(self, ssid.buf, ssid.len, password.buf, password.len, channel, authmode, args[ARG_max_connections].u_int); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(wifi_radio_start_ap_obj, 1, wifi_radio_start_ap); diff --git a/shared-bindings/wifi/Radio.h b/shared-bindings/wifi/Radio.h index 5a8b48a172..83c1c8be88 100644 --- a/shared-bindings/wifi/Radio.h +++ b/shared-bindings/wifi/Radio.h @@ -93,7 +93,7 @@ extern void common_hal_wifi_radio_stop_scanning_networks(wifi_radio_obj_t *self) extern void common_hal_wifi_radio_start_station(wifi_radio_obj_t *self); extern void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self); -extern void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint32_t authmodes, uint8_t max_connections); +extern void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, uint32_t authmode, uint8_t max_connections); extern void common_hal_wifi_radio_stop_ap(wifi_radio_obj_t *self); extern bool common_hal_wifi_radio_get_ap_active(wifi_radio_obj_t *self); From fde63427052a7a9e0c4d4d71c85b1784279c59da Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 23 Jun 2023 13:20:41 -0400 Subject: [PATCH 1213/1712] Revert "nrf: prevent I2C hangs" --- ports/nrf/Makefile | 1 - ports/nrf/common-hal/busio/I2C.c | 78 +++++++++----------------------- 2 files changed, 22 insertions(+), 57 deletions(-) diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index d0d5e2a6eb..8a8625bd95 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -114,7 +114,6 @@ SRC_NRFX = $(addprefix nrfx/,\ drivers/src/nrfx_spim.c \ drivers/src/nrfx_timer.c \ drivers/src/nrfx_twim.c \ - drivers/src/nrfx_twi_twim.c \ drivers/src/nrfx_uarte.c \ drivers/src/nrfx_gpiote.c \ drivers/src/nrfx_rtc.c \ diff --git a/ports/nrf/common-hal/busio/I2C.c b/ports/nrf/common-hal/busio/I2C.c index d5b61ffeea..2bd1416f5a 100644 --- a/ports/nrf/common-hal/busio/I2C.c +++ b/ports/nrf/common-hal/busio/I2C.c @@ -79,59 +79,20 @@ void common_hal_busio_i2c_never_reset(busio_i2c_obj_t *self) { } } -static bool _bus_is_sane(uint32_t scl_pin, uint32_t sda_pin) { - #if CIRCUITPY_REQUIRE_I2C_PULLUPS - nrf_gpio_cfg_input(scl_pin, NRF_GPIO_PIN_PULLDOWN); - nrf_gpio_cfg_input(sda_pin, NRF_GPIO_PIN_PULLDOWN); - - common_hal_mcu_delay_us(10); - - nrf_gpio_cfg_input(scl_pin, NRF_GPIO_PIN_NOPULL); - nrf_gpio_cfg_input(sda_pin, NRF_GPIO_PIN_NOPULL); - - // We must pull up within 3us to achieve 400khz. - common_hal_mcu_delay_us(3); - if (!nrf_gpio_pin_read(sda_pin) || !nrf_gpio_pin_read(scl_pin)) { - return false; - } else { - return true; - } - #else - return true; - #endif -} - -static nrfx_err_t _safe_twim_enable(busio_i2c_obj_t *self) { - // check to see if bus is in sensible state before enabling twim - nrfx_err_t recover_result; - - if (!_bus_is_sane(self->scl_pin_number, self->sda_pin_number)) { - // bus not in a sane state - try to recover - recover_result = nrfx_twim_bus_recover(self->scl_pin_number, self->sda_pin_number); - if (NRFX_SUCCESS != recover_result) { - // return error message if unable to recover the bus - return recover_result; - } - } - - nrfx_twim_enable(&self->twim_peripheral->twim); - return NRFX_SUCCESS; -} - static uint8_t twi_error_to_mp(const nrfx_err_t err) { switch (err) { case NRFX_ERROR_DRV_TWI_ERR_ANACK: return MP_ENODEV; case NRFX_ERROR_BUSY: return MP_EBUSY; - case NRFX_SUCCESS: - return 0; case NRFX_ERROR_DRV_TWI_ERR_DNACK: case NRFX_ERROR_INVALID_ADDR: - case NRFX_ERROR_INTERNAL: - default: return MP_EIO; + default: + break; } + + return 0; } void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t *scl, const mcu_pin_obj_t *sda, uint32_t frequency, uint32_t timeout) { @@ -153,12 +114,25 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, const mcu_pin_obj_t * mp_raise_ValueError(translate("All I2C peripherals are in use")); } - // check bus is in a sane state - if (!_bus_is_sane(scl->number,sda->number)) { + #if CIRCUITPY_REQUIRE_I2C_PULLUPS + // Test that the pins are in a high state. (Hopefully indicating they are pulled up.) + nrf_gpio_cfg_input(scl->number, NRF_GPIO_PIN_PULLDOWN); + nrf_gpio_cfg_input(sda->number, NRF_GPIO_PIN_PULLDOWN); + + common_hal_mcu_delay_us(10); + + nrf_gpio_cfg_input(scl->number, NRF_GPIO_PIN_NOPULL); + nrf_gpio_cfg_input(sda->number, NRF_GPIO_PIN_NOPULL); + + // We must pull up within 3us to achieve 400khz. + common_hal_mcu_delay_us(3); + + if (!nrf_gpio_pin_read(sda->number) || !nrf_gpio_pin_read(scl->number)) { reset_pin_number(sda->number); reset_pin_number(scl->number); mp_raise_RuntimeError(translate("No pull up found on SDA or SCL; check your wiring")); } + #endif nrfx_twim_config_t config = NRFX_TWIM_DEFAULT_CONFIG(scl->number, sda->number); @@ -214,9 +188,7 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) { NRF_TWIM_Type *reg = self->twim_peripheral->twim.p_twim; bool found = true; - if (NRFX_SUCCESS != _safe_twim_enable(self)) { - return false; - } + nrfx_twim_enable(&self->twim_peripheral->twim); nrf_twim_address_set(reg, addr); nrf_twim_tx_buffer_set(reg, NULL, 0); @@ -274,10 +246,7 @@ STATIC uint8_t _common_hal_busio_i2c_write(busio_i2c_obj_t *self, uint16_t addr, nrfx_err_t err = NRFX_SUCCESS; - err = _safe_twim_enable(self); - if (NRFX_SUCCESS != err) { - return twi_error_to_mp(err); - } + nrfx_twim_enable(&self->twim_peripheral->twim); // break into MAX_XFER_LEN transaction while (len) { @@ -309,10 +278,7 @@ uint8_t common_hal_busio_i2c_read(busio_i2c_obj_t *self, uint16_t addr, uint8_t nrfx_err_t err = NRFX_SUCCESS; - err = _safe_twim_enable(self); - if (NRFX_SUCCESS != err) { - return twi_error_to_mp(err); - } + nrfx_twim_enable(&self->twim_peripheral->twim); // break into MAX_XFER_LEN transaction while (len) { From 25498ee5622f3c8533511b5f053a4d1c8325295f Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Thu, 22 Jun 2023 17:41:48 +0000 Subject: [PATCH 1214/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 705ff49b73..68e345351f 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: 2023-05-23 22:55+0000\n" +"PO-Revision-Date: 2023-06-23 20:35+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "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.18-dev\n" +"X-Generator: Weblate 4.18.1\n" #: main.c msgid "" @@ -1373,7 +1373,7 @@ msgstr "A camada deve ser uma subclasse Group ou TileGrid" #: ports/espressif/common-hal/espidf/__init__.c msgid "MAC address was invalid" -msgstr "Endereço MAC inválido" +msgstr "O endereço MAC era inválido" #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" From c4b57dc2fec7a4d2d5acf2bcdc80c4ae05dcf43c Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sat, 24 Jun 2023 12:42:00 -0500 Subject: [PATCH 1215/1712] fix shape.set_boundary() --- shared-bindings/displayio/Shape.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/displayio/Shape.c b/shared-bindings/displayio/Shape.c index c8b3959837..e7ed29cbad 100644 --- a/shared-bindings/displayio/Shape.c +++ b/shared-bindings/displayio/Shape.c @@ -82,8 +82,8 @@ STATIC mp_obj_t displayio_shape_obj_set_boundary(size_t n_args, const mp_obj_t * (void)n_args; displayio_shape_t *self = MP_OBJ_TO_PTR(args[0]); mp_int_t y = mp_arg_validate_type_int(args[1], MP_QSTR_y); - mp_int_t start_x = mp_arg_validate_type_int(args[1], MP_QSTR_start_x); - mp_int_t end_x = mp_arg_validate_type_int(args[1], MP_QSTR_end_x); + mp_int_t start_x = mp_arg_validate_type_int(args[2], MP_QSTR_start_x); + mp_int_t end_x = mp_arg_validate_type_int(args[3], MP_QSTR_end_x); common_hal_displayio_shape_set_boundary(self, y, start_x, end_x); return mp_const_none; From 6bdfed2bb03077d006b78d257832d2c538d0052d Mon Sep 17 00:00:00 2001 From: Noah Axon Date: Sun, 25 Jun 2023 07:08:59 -0500 Subject: [PATCH 1216/1712] Adding support for M5Stack Stick C Plus --- .../boards/m5stack_stick_c_plus/board.c | 245 ++++++++++++++++++ .../m5stack_stick_c_plus/mpconfigboard.h | 47 ++++ .../m5stack_stick_c_plus/mpconfigboard.mk | 11 + .../boards/m5stack_stick_c_plus/pins.c | 62 +++++ .../boards/m5stack_stick_c_plus/sdkconfig | 26 ++ 5 files changed, 391 insertions(+) create mode 100755 ports/espressif/boards/m5stack_stick_c_plus/board.c create mode 100644 ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h create mode 100644 ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.mk create mode 100644 ports/espressif/boards/m5stack_stick_c_plus/pins.c create mode 100644 ports/espressif/boards/m5stack_stick_c_plus/sdkconfig diff --git a/ports/espressif/boards/m5stack_stick_c_plus/board.c b/ports/espressif/boards/m5stack_stick_c_plus/board.c new file mode 100755 index 0000000000..8188ac9ded --- /dev/null +++ b/ports/espressif/boards/m5stack_stick_c_plus/board.c @@ -0,0 +1,245 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 n0xa + * + * 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 "shared-bindings/busio/SPI.h" +#include "shared-bindings/busio/I2C.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" +#include "shared-bindings/board/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" +#include "components/hal/include/hal/gpio_hal.h" +#include "common-hal/microcontroller/Pin.h" + +#include "../../pmic/axp192/axp192.h" + +// display init sequence according to adafruit_st7735r.py library +uint8_t display_init_sequence[] = { + 0x01,0x80,0x96, // SWRESET and Delay 150ms + 0x11,0x80,0xff, // SLPOUT and Delay + 0xb1,0x03,0x01,0x2C,0x2D, // _FRMCTR1 + 0xb2,0x03,0x01,0x2C,0x2D, // _FRMCTR2 + 0xb3,0x06,0x01,0x2C,0x2D,0x01,0x2C,0x2D, // _FRMCTR3 + 0xb4,0x01,0x07, // _INVCTR line inversion + 0xc0,0x03,0xa2,0x02,0x84, // _PWCTR1 GVDD = 4.7V, 1.0uA + 0xc1,0x01,0xc5, // _PWCTR2 VGH=14.7V, VGL=-7.35V + 0xc2,0x02,0x0a,0x00, // _PWCTR3 Opamp current small, Boost frequency + 0xc3,0x02,0x8a,0x2a, + 0xc4,0x02,0x8a,0xee, + 0xc5,0x01,0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V + 0x36,0x01,0xc8, // MADCTL Rotate display + 0x21,0x00, // _INVON + 0x3a,0x01,0x05, // COLMOD - 16bit color + 0xe0,0x10,0x02,0x1c,0x07,0x12,0x37,0x32,0x29,0x2d,0x29,0x25,0x2B,0x39,0x00,0x01,0x03,0x10, // _GMCTRP1 Gamma + 0xe1,0x10,0x03,0x1d,0x07,0x06,0x2E,0x2C,0x29,0x2D,0x2E,0x2E,0x37,0x3F,0x00,0x00,0x02,0x10, // _GMCTRN1 + 0x13,0x80,0x0a, // _NORON + 0x29,0x80,0x64 // _DISPON +}; + +static bool pmic_init(busio_i2c_obj_t *i2c) { + int rc; + uint8_t write_buf[2]; + + if (!pmic_common_init(i2c)) { + return false; + } + + // Reg: 30h + // The VBUS-IPSOUT path can be selected to be opened regardless of the status of N_VBUSEN + // VBUS VHOLD pressure limit control disabled + // VBUS current limit control disabled + write_buf[0] = AXP192_VBUS_IPSOUT; + write_buf[1] = AXP192_VBUS_IPSOUT_IGNORE_VBUSEN; + rc = common_hal_busio_i2c_write(i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 33h + // Charge function enable control bit, including internal and external channels + // Charging target voltage: 4.2V + // Charging end current: End charging when charging current is less than 10% setting + // Internal path charging current: 100mA + write_buf[0] = AXP192_CHARGING_CTRL1; + write_buf[1] = AXP192_CHARGING_CTRL1_ENABLE | + AXP192_CHARGING_CTRL1_VOLTAGE_4_20V | + AXP192_CHARGING_CTRL1_CURRENT_100mA; + rc = common_hal_busio_i2c_write(i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 90h + // GPIO0(LDOio0) floating + write_buf[0] = AXP192_GPIO0_FUNCTION; + write_buf[1] = AXP192_GPIO0_FUNCTION_FLOATING; + rc = common_hal_busio_i2c_write(i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 91h + // GPIO0(LDOio0) 2.8V + write_buf[0] = AXP192_GPIO0_LDO_VOLTAGE; + write_buf[1] = AXP192_GPIO0_LDO_VOLTAGE_2_8V; + rc = common_hal_busio_i2c_write(i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 28h + // LDO2 (TFT backlight): 2.8V + // LDO3 (TFT logic): 3.0V + write_buf[0] = AXP192_LDO23_OUT_VOLTAGE; + write_buf[1] = AXP192_LDO23_OUT_VOLTAGE_LDO2_2_8V | + AXP192_LDO23_OUT_VOLTAGE_LDO3_3_0V; + rc = common_hal_busio_i2c_write(i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 12h + // Enable CTRL_EXTEN, DCDC1, LDO2 and LDO3 + write_buf[0] = AXP192_DCDC13_LDO23_CTRL; + write_buf[1] = AXP192_DCDC13_LDO23_CTRL_EXTEN | + AXP192_DCDC13_LDO23_CTRL_LDO3 | + AXP192_DCDC13_LDO23_CTRL_LDO2 | + AXP192_DCDC13_LDO23_CTRL_DCDC1; + rc = common_hal_busio_i2c_write(i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + // Reg: 26h + // DCDC1 (ESP32 VDD): 3.350V + write_buf[0] = AXP192_DCDC1_OUT_VOLTAGE; + write_buf[1] = AXP192_DCDC1_OUT_VOLTAGE_3_350V; + rc = common_hal_busio_i2c_write(i2c, AXP192_I2C_ADDRESS, write_buf, sizeof(write_buf)); + if (rc != 0) { + return false; + } + + if (!pmic_disable_all_irq(i2c)) { + return false; + } + + if (!pmic_clear_all_irq(i2c)) { + return false; + } + + if (!pmic_enable_power_key_press_irq(i2c)) { + return false; + } + + if (!pmic_enable_low_battery_irq(i2c)) { + return false; + } + + return true; +} + +static bool display_init(void) { + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO13, &pin_GPIO15, NULL, false); + common_hal_busio_spi_never_reset(spi); + + bus->base.type = &displayio_fourwire_type; + + common_hal_displayio_fourwire_construct( + bus, + spi, + &pin_GPIO23, // DC + &pin_GPIO5, // CS + &pin_GPIO18, // RST + 10000000, // baudrate + 0, // polarity + 0 // phase + ); + + displayio_display_obj_t *display = &allocate_display()->display; + display->base.type = &displayio_display_type; + + common_hal_displayio_display_construct( + display, + bus, + 135, // width (after rotation) + 240, // height (after rotation) + 40, // column start + 52, // row start + 1, // rotation + 16, // color depth + false, // grayscale + false, // pixels in a byte share a row. Only valid for depths < 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 + display_init_sequence, + sizeof(display_init_sequence), + NULL, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 80, // native_frames_per_second + false, // backlight_on_high + false, // SH1107_addressing + 50000 // backlight pwm frequency + ); + + return true; +} + +void board_init(void) { + busio_i2c_obj_t *internal_i2c = common_hal_board_create_i2c(0); + + if (!pmic_init(internal_i2c)) { + mp_printf(&mp_plat_print, "could not initialize axp192 pmic\n"); + return; + } + + if (!display_init()) { + mp_printf(&mp_plat_print, "could not initialize the display"); + return; + } +} + +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + // Set IR led gpio high to prevent power drain from the led + if (pin_number == 9) { + gpio_set_direction(pin_number, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(pin_number, true); + return true; + } + return false; +} diff --git a/ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h b/ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h new file mode 100644 index 0000000000..3e988248c6 --- /dev/null +++ b/ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 n0xa + * + * 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 "M5Stack Stick C Plus" +#define MICROPY_HW_MCU_NAME "ESP32" + +#define MICROPY_HW_LED_STATUS (&pin_GPIO10) +#define MICROPY_HW_LED_STATUS_INVERTED (1) + +#define CIRCUITPY_BOARD_I2C (2) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO22, .sda = &pin_GPIO21}, \ + {.scl = &pin_GPIO33, .sda = &pin_GPIO32}} + +// For entering safe mode +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO37) + +// Explanation of how a user got into safe mode +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed button A at start up.") + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO3) diff --git a/ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.mk b/ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.mk new file mode 100644 index 0000000000..ce4d23a303 --- /dev/null +++ b/ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.mk @@ -0,0 +1,11 @@ +CIRCUITPY_CREATOR_ID = 0x10151015 +CIRCUITPY_CREATION_ID = 0x00320007 + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESPCAMERA = 0 + +SRC_C += pmic/axp192/axp192.c diff --git a/ports/espressif/boards/m5stack_stick_c_plus/pins.c b/ports/espressif/boards/m5stack_stick_c_plus/pins.c new file mode 100644 index 0000000000..63e3f2d8d9 --- /dev/null +++ b/ports/espressif/boards/m5stack_stick_c_plus/pins.c @@ -0,0 +1,62 @@ +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + +CIRCUITPY_BOARD_BUS_SINGLETON(porta_i2c, i2c, 1) + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // External pins are in silkscreen order, from top to bottom, left side, then right side + + { MP_ROM_QSTR(MP_QSTR_A26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_A36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_PORTA_SDA), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32) }, + + { MP_ROM_QSTR(MP_QSTR_PORTA_SCL), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IR_LED), MP_ROM_PTR(&pin_GPIO9) }, + + // buttons + { MP_ROM_QSTR(MP_QSTR_BTN_A), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_BTN_B), MP_ROM_PTR(&pin_GPIO39) }, + + // internal i2c bus + { MP_ROM_QSTR(MP_QSTR_SYS_SDA), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_SYS_SCL), MP_ROM_PTR(&pin_GPIO22) }, + + // internal devices interrupt + { MP_ROM_QSTR(MP_QSTR_SYS_INT), MP_ROM_PTR(&pin_GPIO35) }, + + // pmu AXP192 + { MP_ROM_QSTR(MP_QSTR_PMU_N_VBUSEN), MP_ROM_PTR(&pin_GPIO27) }, + + // pdm microphone + { MP_ROM_QSTR(MP_QSTR_PDM_MIC_CLK), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_PDM_MIC_DATA), MP_ROM_PTR(&pin_GPIO34) }, + + // buzzer + { MP_ROM_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_GPIO2) }, + + // lcd spi bus + { MP_ROM_QSTR(MP_QSTR_LCD_MOSI), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CLK), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_LCD_RST), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_SYS_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_PORTA_I2C), MP_ROM_PTR(&board_porta_i2c_obj) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/m5stack_stick_c_plus/sdkconfig b/ports/espressif/boards/m5stack_stick_c_plus/sdkconfig new file mode 100644 index 0000000000..a37e88cedf --- /dev/null +++ b/ports/espressif/boards/m5stack_stick_c_plus/sdkconfig @@ -0,0 +1,26 @@ +CONFIG_ESP32_SPIRAM_SUPPORT=n + +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskStickCPlus" +# end of LWIP + +# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins +### # +### # ESP System Settings +### # +### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y +### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set +### CONFIG_ESP_CONSOLE_UART_CUSTOM=y +### CONFIG_ESP_CONSOLE_NONE is not set +### CONFIG_ESP_CONSOLE_UART=y +### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set +### CONFIG_ESP_CONSOLE_UART_NUM=0 +### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 +### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 +### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +### # end of ESP System Settings From 75dbb7d102d1be7ccbfacff4c0aa3f41621ffb52 Mon Sep 17 00:00:00 2001 From: Noah Axon Date: Sun, 25 Jun 2023 07:29:18 -0500 Subject: [PATCH 1217/1712] Added a new creation ID for this board --- ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.mk b/ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.mk index ce4d23a303..101ef3c2e0 100644 --- a/ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.mk @@ -1,5 +1,5 @@ CIRCUITPY_CREATOR_ID = 0x10151015 -CIRCUITPY_CREATION_ID = 0x00320007 +CIRCUITPY_CREATION_ID = 0x0032000A IDF_TARGET = esp32 From 232e096f93640d22a577903f21520cc4797b3bbf Mon Sep 17 00:00:00 2001 From: Neradoc Date: Sun, 25 Jun 2023 17:05:49 +0200 Subject: [PATCH 1218/1712] fix board.BUTTON on espressif_esp32c3_devkitm_1_n4 --- ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/pins.c b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/pins.c index e948ae3fc8..243b6040d0 100644 --- a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/pins.c +++ b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/pins.c @@ -53,7 +53,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_MTCK), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_MTDO), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO9) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, From b4be2317cbe1c343f76494b72f11349e8ce073b3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 26 Jun 2023 10:33:41 -0500 Subject: [PATCH 1219/1712] rp2040: Avoid screeches due to audio underflow during flash writes By pausing audio during flash writes, the worst screeching of #8121 is avoided. I don't consider this a full fix, but it greatly improves the by far most common scenario in which the problem occurs. Tested on rp2040 prop feather with a midi synth playing arpeggios. When writing to the flash e.g., with ``` dd bs=512 count=32 if=/dev/zero of=/media/jepler/CIRCUITPY/boop ``` the audio goes "tap tap tap tap" during the flash write instead of the squawking. This isn't a 100% fix; it will still glitch out, including during USB enumeration which must be taking a long time without servicing background tasks. Add a delay if not usb-connected at startup ameliorates this greatly. --- ports/raspberrypi/audio_dma.c | 21 +++++++++++++++++++ ports/raspberrypi/audio_dma.h | 3 +++ ports/raspberrypi/supervisor/internal_flash.c | 4 ++++ 3 files changed, 28 insertions(+) diff --git a/ports/raspberrypi/audio_dma.c b/ports/raspberrypi/audio_dma.c index 612fbbde4c..3b7ef5ec44 100644 --- a/ports/raspberrypi/audio_dma.c +++ b/ports/raspberrypi/audio_dma.c @@ -388,6 +388,27 @@ bool audio_dma_get_paused(audio_dma_t *dma) { return (control & DMA_CH0_CTRL_TRIG_EN_BITS) == 0; } +uint32_t audio_dma_pause_all(void) { + uint32_t result = 0; + for (size_t channel = 0; channel < NUM_DMA_CHANNELS; channel++) { + audio_dma_t *dma = MP_STATE_PORT(playing_audio)[channel]; + if (dma != NULL && !audio_dma_get_paused(dma)) { + audio_dma_pause(dma); + result |= (1 << channel); + } + } + return result; +} + +void audio_dma_unpause_cookie(uint32_t cookie) { + for (size_t channel = 0; channel < NUM_DMA_CHANNELS; channel++) { + audio_dma_t *dma = MP_STATE_PORT(playing_audio)[channel]; + if (dma != NULL && (cookie & (1 << channel))) { + audio_dma_resume(dma); + } + } +} + void audio_dma_init(audio_dma_t *dma) { dma->buffer[0] = NULL; dma->buffer[1] = NULL; diff --git a/ports/raspberrypi/audio_dma.h b/ports/raspberrypi/audio_dma.h index ae9a07a604..91d692f8ac 100644 --- a/ports/raspberrypi/audio_dma.h +++ b/ports/raspberrypi/audio_dma.h @@ -89,4 +89,7 @@ void audio_dma_pause(audio_dma_t *dma); void audio_dma_resume(audio_dma_t *dma); bool audio_dma_get_paused(audio_dma_t *dma); +uint32_t audio_dma_pause_all(void); +void audio_dma_unpause_cookie(uint32_t cookie); + #endif // MICROPY_INCLUDED_RASPBERRYPI_AUDIO_DMA_OUT_H diff --git a/ports/raspberrypi/supervisor/internal_flash.c b/ports/raspberrypi/supervisor/internal_flash.c index 9216f1ebe2..b0b89d38f1 100644 --- a/ports/raspberrypi/supervisor/internal_flash.c +++ b/ports/raspberrypi/supervisor/internal_flash.c @@ -39,6 +39,7 @@ #include "lib/oofatfs/ff.h" #include "shared-bindings/microcontroller/__init__.h" +#include "audio_dma.h" #include "supervisor/flash.h" #include "supervisor/usb.h" @@ -97,9 +98,12 @@ void port_internal_flash_flush(void) { } // Make sure we don't have an interrupt while we do flash operations. common_hal_mcu_disable_interrupts(); + // and audio DMA must be paused as well + uint32_t cookie = audio_dma_pause_all(); flash_range_erase(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, SECTOR_SIZE); flash_range_program(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, _cache, SECTOR_SIZE); _cache_lba = NO_CACHE; + audio_dma_unpause_cookie(cookie); common_hal_mcu_enable_interrupts(); } From 385366128f067bc0315a108bb046075f5d7366bf Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 27 Jun 2023 09:59:02 -0500 Subject: [PATCH 1220/1712] Don't use "cookie" variable/function name --- ports/raspberrypi/audio_dma.c | 4 ++-- ports/raspberrypi/audio_dma.h | 2 +- ports/raspberrypi/supervisor/internal_flash.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/raspberrypi/audio_dma.c b/ports/raspberrypi/audio_dma.c index 3b7ef5ec44..b5bd8c069c 100644 --- a/ports/raspberrypi/audio_dma.c +++ b/ports/raspberrypi/audio_dma.c @@ -400,10 +400,10 @@ uint32_t audio_dma_pause_all(void) { return result; } -void audio_dma_unpause_cookie(uint32_t cookie) { +void audio_dma_unpause_mask(uint32_t channel_mask) { for (size_t channel = 0; channel < NUM_DMA_CHANNELS; channel++) { audio_dma_t *dma = MP_STATE_PORT(playing_audio)[channel]; - if (dma != NULL && (cookie & (1 << channel))) { + if (dma != NULL && (channel_mask & (1 << channel))) { audio_dma_resume(dma); } } diff --git a/ports/raspberrypi/audio_dma.h b/ports/raspberrypi/audio_dma.h index 91d692f8ac..e84a79df26 100644 --- a/ports/raspberrypi/audio_dma.h +++ b/ports/raspberrypi/audio_dma.h @@ -90,6 +90,6 @@ void audio_dma_resume(audio_dma_t *dma); bool audio_dma_get_paused(audio_dma_t *dma); uint32_t audio_dma_pause_all(void); -void audio_dma_unpause_cookie(uint32_t cookie); +void audio_dma_unpause_mask(uint32_t channel_mask); #endif // MICROPY_INCLUDED_RASPBERRYPI_AUDIO_DMA_OUT_H diff --git a/ports/raspberrypi/supervisor/internal_flash.c b/ports/raspberrypi/supervisor/internal_flash.c index b0b89d38f1..42223b29e3 100644 --- a/ports/raspberrypi/supervisor/internal_flash.c +++ b/ports/raspberrypi/supervisor/internal_flash.c @@ -99,11 +99,11 @@ void port_internal_flash_flush(void) { // Make sure we don't have an interrupt while we do flash operations. common_hal_mcu_disable_interrupts(); // and audio DMA must be paused as well - uint32_t cookie = audio_dma_pause_all(); + uint32_t channel_mask = audio_dma_pause_all(); flash_range_erase(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, SECTOR_SIZE); flash_range_program(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, _cache, SECTOR_SIZE); _cache_lba = NO_CACHE; - audio_dma_unpause_cookie(cookie); + audio_dma_unpause_mask(channel_mask); common_hal_mcu_enable_interrupts(); } From 3795de03b6284b5480a38cef692a86125ab47dfb Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 27 Jun 2023 10:05:14 -0500 Subject: [PATCH 1221/1712] update ulab to 6.3.2 --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index 6619c20b3b..319df10cfe 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 6619c20b3b75864554fcee5f88846fac27df5701 +Subproject commit 319df10cfe9cb8f6e5e24627bda3fe1556d8b06b From 9a3fadc072e632bc636faa627b51f3b0e2d3d4f4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 27 Jun 2023 10:23:26 -0500 Subject: [PATCH 1222/1712] run pre-commit --- locale/circuitpython.pot | 45 ++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 282d229856..3d0b516562 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -182,6 +182,7 @@ msgid "%q must be 1 when %q is True" msgstr "" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "" @@ -1950,10 +1951,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." @@ -2797,6 +2794,10 @@ msgstr "" msgid "cannot create instance" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "" @@ -3254,6 +3255,14 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3582,6 +3591,10 @@ msgstr "" msgid "native yield" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3685,6 +3698,10 @@ msgstr "" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "" @@ -3795,8 +3812,8 @@ msgstr "" msgid "opcode" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "" @@ -3833,10 +3850,26 @@ msgstr "" msgid "out array is too small" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "" From bfcb967edd97673244c2ef9ce5fd1447ab282d52 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 27 Jun 2023 10:41:02 -0500 Subject: [PATCH 1223/1712] Add expected-output file for this test .. because the first test is actually accepted on python 3.10 and newer. --- tests/basics/string_format_error.py.exp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/basics/string_format_error.py.exp diff --git a/tests/basics/string_format_error.py.exp b/tests/basics/string_format_error.py.exp new file mode 100644 index 0000000000..d6d28b2111 --- /dev/null +++ b/tests/basics/string_format_error.py.exp @@ -0,0 +1,17 @@ +ValueError +IndexError +ValueError +ValueError +ValueError +ValueError +ValueError +ValueError +IndexError +KeyError +ValueError +IndexError +ValueError +ValueError +ValueError +ValueError +ValueError From a9c987d3ce07c8300ef4173c123589f49373b21e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 27 Jun 2023 10:41:02 -0500 Subject: [PATCH 1224/1712] Add expected-output file for this test .. because the first test is actually accepted on python 3.10 and newer. --- tests/basics/string_format_error.py.exp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/basics/string_format_error.py.exp diff --git a/tests/basics/string_format_error.py.exp b/tests/basics/string_format_error.py.exp new file mode 100644 index 0000000000..d6d28b2111 --- /dev/null +++ b/tests/basics/string_format_error.py.exp @@ -0,0 +1,17 @@ +ValueError +IndexError +ValueError +ValueError +ValueError +ValueError +ValueError +ValueError +IndexError +KeyError +ValueError +IndexError +ValueError +ValueError +ValueError +ValueError +ValueError From b5ad7f91a30e2a57ffdb6dcbf3f16a110023eae7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 27 Jun 2023 11:11:23 -0500 Subject: [PATCH 1225/1712] update expected data for test skip all the byecode hex data, it's adequately checked by the disassembly just below This was tripped up because in exactly the right conditions some qstr could be of the form 'xx 63' and make the expression `\.\+63` match something other than what was intended. This test was re-worked upstream for mpy version 6 so it'll be a conflict to resolve when we get to that. :-/ --- tests/cmdline/cmd_parsetree.py.exp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/cmdline/cmd_parsetree.py.exp b/tests/cmdline/cmd_parsetree.py.exp index bee4fc99d1..291cc7ecda 100644 --- a/tests/cmdline/cmd_parsetree.py.exp +++ b/tests/cmdline/cmd_parsetree.py.exp @@ -42,7 +42,6 @@ File cmdline/cmd_parsetree.py, code block '' (descriptor: \.\+, bytecode @\.\+ bytes) Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): ######## -\.\+63 arg names: (N_STATE 5) (N_EXC_STACK 0) From 0f241c9415429d4eb8fd1b92eb20d55a9bf9d2ce Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 27 Jun 2023 10:41:02 -0500 Subject: [PATCH 1226/1712] bump ulab to fix rp2040 build error --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index 319df10cfe..3728d22732 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 319df10cfe9cb8f6e5e24627bda3fe1556d8b06b +Subproject commit 3728d22732dedc8a591b7df18a16d3ef1aed6a39 From d3aea0e15a85540db86b328c36b2c2294f22c731 Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Tue, 27 Jun 2023 17:14:24 +1000 Subject: [PATCH 1227/1712] shared-bindings/zlib: Fix docs for zlib.decompress. The docs say the method is called `zlib_decompress` but should be just `decompress`. Signed-off-by: Jim Mussared --- shared-bindings/zlib/__init__.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/shared-bindings/zlib/__init__.c b/shared-bindings/zlib/__init__.c index ba02914638..3b45e605e6 100644 --- a/shared-bindings/zlib/__init__.c +++ b/shared-bindings/zlib/__init__.c @@ -48,9 +48,7 @@ //| (commonly used in zlib library and gzip archiver). Compression is not yet implemented.""" //| -//| def zlib_decompress( -//| data: bytes, wbits: Optional[int] = 0, bufsize: Optional[int] = 0 -//| ) -> bytes: +//| def decompress(data: bytes, wbits: Optional[int] = 0, bufsize: Optional[int] = 0) -> bytes: //| """Return decompressed *data* as bytes. *wbits* is DEFLATE dictionary window //| size used during compression (8-15, the dictionary size is power of 2 of //| that value). Additionally, if value is positive, *data* is assumed to be From 77b3a0570ea7ca9058e2d5772484aea2953cba86 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 27 Jun 2023 19:11:25 -0400 Subject: [PATCH 1228/1712] add Adafruit Metro M7 1011 SD --- .../boards/adafruit_metro_m7_1011_sd/board.c | 64 ++++++++ .../adafruit_metro_m7_1011_sd/flash_config.c | 153 ++++++++++++++++++ .../adafruit_metro_m7_1011_sd/mpconfigboard.h | 20 +++ .../mpconfigboard.mk | 8 + .../boards/adafruit_metro_m7_1011_sd/pins.c | 60 +++++++ .../boards/metro_m7_1011/mpconfigboard.mk | 2 +- ports/mimxrt10xx/boards/metro_m7_1011/pins.c | 5 + 7 files changed, 311 insertions(+), 1 deletion(-) create mode 100644 ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/board.c create mode 100644 ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/flash_config.c create mode 100644 ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.h create mode 100644 ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.mk create mode 100644 ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/pins.c diff --git a/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/board.c b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/board.c new file mode 100644 index 0000000000..62be2303a5 --- /dev/null +++ b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/board.c @@ -0,0 +1,64 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * + * 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 "shared-bindings/microcontroller/Pin.h" + +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { + // SWD Pins + &pin_GPIO_AD_13,// SWDIO + &pin_GPIO_AD_12,// SWCLK + + // FLEX flash + &pin_GPIO_SD_12, + &pin_GPIO_SD_11, + &pin_GPIO_SD_10, + &pin_GPIO_SD_09, + &pin_GPIO_SD_08, + &pin_GPIO_SD_07, + &pin_GPIO_SD_06, + NULL, // Must end in NULL. +}; + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. + +bool mimxrt10xx_board_reset_pin_number(const mcu_pin_obj_t *pin) { + #if CIRCUITPY_SWO_TRACE + if (pin == &pin_GPIO_AD_09) { + IOMUXC_SetPinMux( /* Add these lines*/ + IOMUXC_GPIO_AD_09_ARM_TRACE_SWO, + 0U); + IOMUXC_SetPinConfig( /* Add these lines*/ + IOMUXC_GPIO_AD_09_ARM_TRACE_SWO, + 0x00F9U); + return true; + } + #endif + return false; +} diff --git a/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/flash_config.c b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/flash_config.c new file mode 100644 index 0000000000..3b47af1d6c --- /dev/null +++ b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/flash_config.c @@ -0,0 +1,153 @@ +/* + * Copyright 2017 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "boards/flash_config.h" + +#include "xip/fsl_flexspi_nor_boot.h" + +// Config for W25Q32JV with QSPI routed. (compatible with GD25Q32) +__attribute__((section(".boot_hdr.conf"))) +const flexspi_nor_config_t qspiflash_config = { + .pageSize = 256u, + .sectorSize = 4u * 1024u, + .ipcmdSerialClkFreq = kFLEXSPISerialClk_133MHz, + .blockSize = 0x00010000, + .isUniformBlockSize = false, + .memConfig = + { + .tag = FLEXSPI_CFG_BLK_TAG, + .version = FLEXSPI_CFG_BLK_VERSION, + .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromSckPad, + .csHoldTime = 3u, + .csSetupTime = 3u, + + .busyOffset = 0u, // Status bit 0 indicates busy. + .busyBitPolarity = 0u, // Busy when the bit is 1. + + .deviceModeCfgEnable = 1u, + .deviceModeType = kDeviceConfigCmdType_QuadEnable, + .deviceModeSeq = { + .seqId = 4u, + .seqNum = 1u, + }, + .deviceModeArg = 0x0200, + .configCmdEnable = 1u, + .configModeType[0] = kDeviceConfigCmdType_Generic, + .configCmdSeqs[0] = { + .seqId = 2u, + .seqNum = 1u, + }, + .deviceType = kFLEXSPIDeviceType_SerialNOR, + .sflashPadType = kSerialFlash_4Pads, + .serialClkFreq = kFLEXSPISerialClk_133MHz, + .sflashA1Size = FLASH_SIZE, + .lookupTable = + { + // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) + // The high 16 bits is command 1 and the low are command 0. + // Within a command, the top 6 bits are the opcode, the next two are the number + // of pads and then last byte is the operand. The operand's meaning changes + // per opcode. + + // Indices with ROM should always have the same function because the ROM + // bootloader uses it. + + // 0: ROM: Read LUTs + // Quad version + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, + RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), + FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, + READ_SDR, FLEXSPI_4PAD, 0x04), + // Single fast read version, good for debugging. + // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, + // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, + // READ_SDR, FLEXSPI_1PAD, 0x04), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 1: ROM: Read status + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, + READ_SDR, FLEXSPI_1PAD, 0x02), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 2: Empty + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x35 /* the command to send */, + DUMMY_SDR, FLEXSPI_1PAD, 8), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 3: ROM: Write Enable + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, + STOP, FLEXSPI_1PAD, 0x00), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 4: Config: Write Status + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01 /* the command to send */, + WRITE_SDR, FLEXSPI_1PAD, 0x02), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 5: ROM: Erase Sector + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 6: Empty + EMPTY_SEQUENCE, + + // 7: Empty + EMPTY_SEQUENCE, + + // 8: Block Erase + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 9: ROM: Page program + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + + FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, + STOP, FLEXSPI_1PAD, 0), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 10: Empty + EMPTY_SEQUENCE, + + // 11: ROM: Chip erase + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, + STOP, FLEXSPI_1PAD, 0), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 12: Empty + EMPTY_SEQUENCE, + + // 13: ROM: Read SFDP + EMPTY_SEQUENCE, + + // 14: ROM: Restore no cmd + EMPTY_SEQUENCE, + + // 15: ROM: Dummy + EMPTY_SEQUENCE + }, + }, +}; diff --git a/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.h b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.h new file mode 100644 index 0000000000..589b2a2b65 --- /dev/null +++ b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.h @@ -0,0 +1,20 @@ +#define MICROPY_HW_BOARD_NAME "Metro MIMXRT1011" +#define MICROPY_HW_MCU_NAME "IMXRT1011DAE5A" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO_00) + +// If you change this, then make sure to update the linker scripts as well to +// make sure you don't overwrite code +#define CIRCUITPY_INTERNAL_NVM_SIZE 0 + +#define BOARD_FLASH_SIZE (8 * 1024 * 1024) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO_02) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO_01) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO_AD_06) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO_AD_04) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO_AD_03) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO_09) +#define DEFAULT_UART_BUS_TX (&pin_GPIO_10) diff --git a/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.mk b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.mk new file mode 100644 index 0000000000..ec4c04c78e --- /dev/null +++ b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.mk @@ -0,0 +1,8 @@ +USB_VID = 0x239A +USB_PID = 0x8142 +USB_PRODUCT = "Metro M7 iMX RT1011 SD" +USB_MANUFACTURER = "Adafruit" + +CHIP_VARIANT = MIMXRT1011DAE5A +CHIP_FAMILY = MIMXRT1011 +FLASH = W25Q64JV diff --git a/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/pins.c b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/pins.c new file mode 100644 index 0000000000..8096973aaf --- /dev/null +++ b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/pins.c @@ -0,0 +1,60 @@ +#include "shared-bindings/board/__init__.h" + +#include "supervisor/board.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // Analog + { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO_AD_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO_AD_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO_AD_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO_AD_05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO_AD_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO_AD_08) }, + + // Digital + { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_09) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO_09) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO_13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO_12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO_SD_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO_SD_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO_SD_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO_11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO_08) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO_07) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO_06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO_05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO_04) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_GPIO_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_GPIO_03) }, + + // SD control + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CD), MP_ROM_PTR(&pin_GPIO_AD_11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO_AD_14) }, + + // SPI + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO_AD_06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO_AD_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO_AD_04) }, + + // I2C + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO_02) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO_00) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO_06) }, // D10 + { MP_ROM_QSTR(MP_QSTR_I2S_BIT_CLOCK), MP_ROM_PTR(&pin_GPIO_07) }, // D9 + { MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO_04) }, // D12 +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk b/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk index 56155aa4d0..ec7c6c2f1c 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk +++ b/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk @@ -1,6 +1,6 @@ USB_VID = 0x239A USB_PID = 0x80E2 -USB_PRODUCT = "Metro M7 iMX RT1011" +USB_PRODUCT = "Metro M7 iMX RT1011 AirLift" USB_MANUFACTURER = "Adafruit" CHIP_VARIANT = MIMXRT1011DAE5A diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/pins.c b/ports/mimxrt10xx/boards/metro_m7_1011/pins.c index 98082e3c11..fe03d09764 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/pins.c +++ b/ports/mimxrt10xx/boards/metro_m7_1011/pins.c @@ -58,8 +58,13 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO_06) }, // D10 { MP_ROM_QSTR(MP_QSTR_I2S_WSEL), MP_ROM_PTR(&pin_GPIO_06) }, // D10 + + { MP_ROM_QSTR(MP_QSTR_I2S_BIT_CLOCK), MP_ROM_PTR(&pin_GPIO_07) }, // D9 { MP_ROM_QSTR(MP_QSTR_I2S_BCLK), MP_ROM_PTR(&pin_GPIO_07) }, // D9 + + { MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO_04) }, // D12 { MP_ROM_QSTR(MP_QSTR_I2S_DOUT), MP_ROM_PTR(&pin_GPIO_04) }, // D12 }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From f1d9ee0de3255a3a1605077477812e7c390cab4b Mon Sep 17 00:00:00 2001 From: Neradoc Date: Wed, 28 Jun 2023 15:11:23 +0200 Subject: [PATCH 1229/1712] Fix PSRAM on espressif ESP32S3 box and box lite --- ports/espressif/boards/espressif_esp32s3_box/sdkconfig | 1 + ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/ports/espressif/boards/espressif_esp32s3_box/sdkconfig b/ports/espressif/boards/espressif_esp32s3_box/sdkconfig index ead0088da5..6884299abe 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_box/sdkconfig @@ -1,3 +1,4 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y CONFIG_SPIRAM=y CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_SPEED_80M=y diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig index ead0088da5..6884299abe 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig @@ -1,3 +1,4 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y CONFIG_SPIRAM=y CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_SPEED_80M=y From 2a8d6d655c97dde6e40b326955bffefe916236de Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 28 Jun 2023 22:56:08 -0400 Subject: [PATCH 1230/1712] adafruit_qtpy_esp32s3_4mbflash_2mbpsram --- .../board.c | 39 ++++++++++++ .../mpconfigboard.h | 45 ++++++++++++++ .../mpconfigboard.mk | 13 ++++ .../pins.c | 62 +++++++++++++++++++ .../sdkconfig | 47 ++++++++++++++ .../mpconfigboard.mk | 3 - 6 files changed, 206 insertions(+), 3 deletions(-) create mode 100644 ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/board.c create mode 100644 ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.h create mode 100644 ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk create mode 100644 ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/pins.c create mode 100644 ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/sdkconfig diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/board.c b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/board.c new file mode 100644 index 0000000000..3b1f5efd87 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/board.c @@ -0,0 +1,39 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.h b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.h new file mode 100644 index 0000000000..36319ce107 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/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 "Adafruit QT Py ESP32-S3 4MB Flash 2MB PSRAM" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO39) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO38) + +#define CIRCUITPY_BOARD_I2C (2) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO6, .sda = &pin_GPIO7}, \ + {.scl = &pin_GPIO40, .sda = &pin_GPIO41}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO36, .mosi = &pin_GPIO35, .miso = &pin_GPIO37}} + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO5, .rx = &pin_GPIO16}} + +#define DOUBLE_TAP_PIN (&pin_GPIO10) diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk new file mode 100644 index 0000000000..50b1394a25 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk @@ -0,0 +1,13 @@ +USB_VID = 0x239A +USB_PID = 0x8144 + +USB_PRODUCT = "QT Py ESP32S3 4MB Flash 2MB PSRAM" +USB_MANUFACTURER = "Adafruit" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB + +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/pins.c b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/pins.c new file mode 100644 index 0000000000..5d0a3c0baa --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/pins.c @@ -0,0 +1,62 @@ +#include "shared-bindings/board/__init__.h" + +CIRCUITPY_BOARD_BUS_SINGLETON(stemma_i2c, i2c, 1) + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_SCL1), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_D40), MP_ROM_PTR(&pin_GPIO40) }, + + { MP_ROM_QSTR(MP_QSTR_SDA1), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_GPIO41) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_stemma_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/sdkconfig new file mode 100644 index 0000000000..9a05ab0205 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/sdkconfig @@ -0,0 +1,47 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP + +# end of Component config diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk index e695bae635..ac1e32a40d 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk @@ -10,7 +10,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register CIRCUITPY_ESPCAMERA = 0 From 1787e7638983550843d0a7a732d92440aaf5444d Mon Sep 17 00:00:00 2001 From: Miroslav Zuzelka Date: Fri, 30 Jun 2023 11:01:00 +0200 Subject: [PATCH 1231/1712] Add ES3ink board definition --- ports/espressif/boards/es3ink/board.c | 39 ++++++++++++ ports/espressif/boards/es3ink/mpconfigboard.h | 38 ++++++++++++ .../espressif/boards/es3ink/mpconfigboard.mk | 10 ++++ ports/espressif/boards/es3ink/pins.c | 59 +++++++++++++++++++ ports/espressif/boards/es3ink/sdkconfig | 16 +++++ 5 files changed, 162 insertions(+) create mode 100644 ports/espressif/boards/es3ink/board.c create mode 100644 ports/espressif/boards/es3ink/mpconfigboard.h create mode 100644 ports/espressif/boards/es3ink/mpconfigboard.mk create mode 100644 ports/espressif/boards/es3ink/pins.c create mode 100644 ports/espressif/boards/es3ink/sdkconfig diff --git a/ports/espressif/boards/es3ink/board.c b/ports/espressif/boards/es3ink/board.c new file mode 100644 index 0000000000..b3c8cb4191 --- /dev/null +++ b/ports/espressif/boards/es3ink/board.c @@ -0,0 +1,39 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif /* DEBUG */ +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/es3ink/mpconfigboard.h b/ports/espressif/boards/es3ink/mpconfigboard.h new file mode 100644 index 0000000000..0be6f5abe7 --- /dev/null +++ b/ports/espressif/boards/es3ink/mpconfigboard.h @@ -0,0 +1,38 @@ +/* + * 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 "ES3ink" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO4) diff --git a/ports/espressif/boards/es3ink/mpconfigboard.mk b/ports/espressif/boards/es3ink/mpconfigboard.mk new file mode 100644 index 0000000000..48ea9f122e --- /dev/null +++ b/ports/espressif/boards/es3ink/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x239A +USB_PID = 0x2031 +USB_PRODUCT = "ES3ink" +USB_MANUFACTURER = "Czech maker" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=16MB diff --git a/ports/espressif/boards/es3ink/pins.c b/ports/espressif/boards/es3ink/pins.c new file mode 100644 index 0000000000..e9ddf81a7a --- /dev/null +++ b/ports/espressif/boards/es3ink/pins.c @@ -0,0 +1,59 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/es3ink/sdkconfig b/ports/espressif/boards/es3ink/sdkconfig new file mode 100644 index 0000000000..89d29d8ea9 --- /dev/null +++ b/ports/espressif/boards/es3ink/sdkconfig @@ -0,0 +1,16 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y + +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_SPEED_80M=y + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 + +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +CONFIG_SPIRAM_USE_MEMMAP=y +CONFIG_SPIRAM_MEMTEST=y + +CONFIG_LWIP_LOCAL_HOSTNAME="es3ink" From abf15125fff9029404d82eb9066db77212dabed2 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sat, 1 Jul 2023 11:50:24 -0500 Subject: [PATCH 1232/1712] adding skip_self_index argument to bitmap.blit() --- shared-bindings/displayio/Bitmap.c | 24 ++++++++++++++++++++---- shared-bindings/displayio/Bitmap.h | 2 +- shared-module/displayio/Bitmap.c | 16 +++++++++++++--- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index 5b939c5892..9ff8050eab 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -196,7 +196,8 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val //| y1: int, //| x2: int, //| y2: int, -//| skip_index: int +//| skip_index: int, +//| skip_self_index: int //| ) -> None: //| """Inserts the source_bitmap region defined by rectangular boundaries //| (x1,y1) and (x2,y2) into the bitmap at the specified (x,y) location. @@ -211,10 +212,12 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val //| :param int x2: Maximum x-value (exclusive) for rectangular bounding box to be copied from the source bitmap //| :param int y2: Maximum y-value (exclusive) for rectangular bounding box to be copied from the source bitmap //| :param int skip_index: bitmap palette index in the source that will not be copied, -//| set to None to copy all pixels""" +//| set to None to copy all pixels +//| :param int skip_self_index: bitmap palette index in the self bitmap that will not get overwritten +//| by the pixels from the source""" //| ... STATIC mp_obj_t displayio_bitmap_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum {ARG_x, ARG_y, ARG_source, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_skip_index}; + enum {ARG_x, ARG_y, ARG_source, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_skip_index, ARG_skip_self_index}; static const mp_arg_t allowed_args[] = { {MP_QSTR_x, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL} }, {MP_QSTR_y, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL} }, @@ -224,6 +227,7 @@ STATIC mp_obj_t displayio_bitmap_obj_blit(size_t n_args, const mp_obj_t *pos_arg {MP_QSTR_x2, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to source->width {MP_QSTR_y2, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to source->height {MP_QSTR_skip_index, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, + {MP_QSTR_skip_self_index, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -283,7 +287,19 @@ STATIC mp_obj_t displayio_bitmap_obj_blit(size_t n_args, const mp_obj_t *pos_arg skip_index_none = false; } - common_hal_displayio_bitmap_blit(self, x, y, source, x1, y1, x2, y2, skip_index, skip_index_none); + uint32_t skip_self_index; + bool skip_self_index_none; // flag whether skip_self_value was None + + if (args[ARG_skip_self_index].u_obj == mp_const_none) { + skip_self_index = 0; + skip_self_index_none = true; + } else { + skip_self_index = mp_obj_get_int(args[ARG_skip_self_index].u_obj); + skip_self_index_none = false; + } + + common_hal_displayio_bitmap_blit(self, x, y, source, x1, y1, x2, y2, skip_index, skip_index_none, skip_self_index, + skip_self_index_none); return mp_const_none; } diff --git a/shared-bindings/displayio/Bitmap.h b/shared-bindings/displayio/Bitmap.h index b35f4eadbc..8f52cb8f62 100644 --- a/shared-bindings/displayio/Bitmap.h +++ b/shared-bindings/displayio/Bitmap.h @@ -44,7 +44,7 @@ uint32_t common_hal_displayio_bitmap_get_bits_per_value(displayio_bitmap_t *self void common_hal_displayio_bitmap_set_pixel(displayio_bitmap_t *bitmap, int16_t x, int16_t y, uint32_t value); void common_hal_displayio_bitmap_blit(displayio_bitmap_t *self, int16_t x, int16_t y, displayio_bitmap_t *source, int16_t x1, int16_t y1, int16_t x2, int16_t y2, - uint32_t skip_index, bool skip_index_none); + uint32_t skip_index, bool skip_index_none, uint32_t skip_self_index, bool skip_self_index_none); uint32_t common_hal_displayio_bitmap_get_pixel(displayio_bitmap_t *bitmap, int16_t x, int16_t y); void common_hal_displayio_bitmap_fill(displayio_bitmap_t *bitmap, uint32_t value); int common_hal_displayio_bitmap_get_buffer(displayio_bitmap_t *self, mp_buffer_info_t *bufinfo, mp_uint_t flags); diff --git a/shared-module/displayio/Bitmap.c b/shared-module/displayio/Bitmap.c index c9212f6a85..f8b8170395 100644 --- a/shared-module/displayio/Bitmap.c +++ b/shared-module/displayio/Bitmap.c @@ -175,7 +175,8 @@ void displayio_bitmap_write_pixel(displayio_bitmap_t *self, int16_t x, int16_t y } void common_hal_displayio_bitmap_blit(displayio_bitmap_t *self, int16_t x, int16_t y, displayio_bitmap_t *source, - int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t skip_index, bool skip_index_none) { + int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t skip_index, bool skip_index_none, uint32_t skip_self_index, + bool skip_self_index_none) { if (self->read_only) { mp_raise_RuntimeError(translate("Read-only")); } @@ -222,8 +223,17 @@ void common_hal_displayio_bitmap_blit(displayio_bitmap_t *self, int16_t x, int16 if ((yd_index >= 0) && (yd_index < self->height)) { uint32_t value = common_hal_displayio_bitmap_get_pixel(source, xs_index, ys_index); - if ((skip_index_none) || (value != skip_index)) { // write if skip_value_none is True - displayio_bitmap_write_pixel(self, xd_index, yd_index, value); + if (skip_self_index_none) { // if skip_self_index is none, then only check source skip + if ((skip_index_none) || (value != skip_index)) { // write if skip_value_none is True + displayio_bitmap_write_pixel(self, xd_index, yd_index, value); + } + } else { // check dest_value index against skip_self_index and skip if they match + uint32_t dest_value = common_hal_displayio_bitmap_get_pixel(self, xd_index, yd_index); + if (dest_value != skip_self_index) { + if ((skip_index_none) || (value != skip_index)) { // write if skip_value_none is True + displayio_bitmap_write_pixel(self, xd_index, yd_index, value); + } + } } } } From 96d3e662b3c77804ddcd2193085aed0ec4cb9465 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sun, 2 Jul 2023 14:35:40 -0500 Subject: [PATCH 1233/1712] refactor bitmap.blit into bitmaptools --- shared-bindings/bitmaptools/__init__.c | 127 +++++++++++++++++++++++++ shared-bindings/bitmaptools/__init__.h | 4 + shared-bindings/displayio/Bitmap.c | 120 ----------------------- shared-bindings/displayio/Bitmap.h | 3 - shared-module/bitmaptools/__init__.c | 67 +++++++++++++ shared-module/displayio/Bitmap.c | 67 ------------- 6 files changed, 198 insertions(+), 190 deletions(-) diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index d0aea33ef9..6d0680626d 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -949,6 +949,132 @@ STATIC mp_obj_t bitmaptools_obj_draw_circle(size_t n_args, const mp_obj_t *pos_a MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_draw_circle_obj, 0, bitmaptools_obj_draw_circle); +//| def blit( +//| dest_bitmap: Bitmap, +//| source_bitmap: Bitmap, +//| x: int, +//| y: int, +//| *, +//| x1: int, +//| y1: int, +//| x2: int, +//| y2: int, +//| skip_index: int, +//| skip_dest_index: int +//| ) -> None: +//| """Inserts the source_bitmap region defined by rectangular boundaries +//| (x1,y1) and (x2,y2) into the bitmap at the specified (x,y) location. +//| +//| :param bitmap dest_bitmap: Destination bitmap that the area will be copied into. +//| :param bitmap source_bitmap: Source bitmap that contains the graphical region to be copied +//| :param int x: Horizontal pixel location in bitmap where source_bitmap upper-left +//| corner will be placed +//| :param int y: Vertical pixel location in bitmap where source_bitmap upper-left +//| corner will be placed +//| :param int x1: Minimum x-value for rectangular bounding box to be copied from the source bitmap +//| :param int y1: Minimum y-value for rectangular bounding box to be copied from the source bitmap +//| :param int x2: Maximum x-value (exclusive) for rectangular bounding box to be copied from the source bitmap +//| :param int y2: Maximum y-value (exclusive) for rectangular bounding box to be copied from the source bitmap +//| :param int skip_index: bitmap palette index in the source that will not be copied, +//| set to None to copy all pixels +//| :param int skip_dest_index: bitmap palette index in the destination bitmap that will not get overwritten +//| by the pixels from the source""" +//| ... +//| +STATIC mp_obj_t bitmaptools_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum {ARG_destination, ARG_source, ARG_x, ARG_y, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_skip_index, ARG_skip_dest_index}; + static const mp_arg_t allowed_args[] = { + {MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + {MP_QSTR_source_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + {MP_QSTR_x, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL} }, + {MP_QSTR_y, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL} }, + {MP_QSTR_x1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + {MP_QSTR_y1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + {MP_QSTR_x2, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to source->width + {MP_QSTR_y2, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to source->height + {MP_QSTR_skip_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + {MP_QSTR_skip_dest_index, 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 - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + // displayio_bitmap_t *self = MP_OBJ_TO_PTR(pos_args[0]); + displayio_bitmap_t *destination = mp_arg_validate_type(args[ARG_destination].u_obj, &displayio_bitmap_type, MP_QSTR_dest_bitmap); + // check_for_deinit(destination); + + // Check x,y are within self (target) bitmap boundary + int16_t x = mp_arg_validate_int_range(args[ARG_x].u_int, 0, MAX(0, destination->width - 1), MP_QSTR_x); + int16_t y = mp_arg_validate_int_range(args[ARG_y].u_int, 0, MAX(0, destination->height - 1), MP_QSTR_y); + + + displayio_bitmap_t *source = mp_arg_validate_type(args[ARG_source].u_obj, &displayio_bitmap_type, MP_QSTR_source_bitmap); + + + // ensure that the target bitmap (self) has at least as many `bits_per_value` as the source + if (destination->bits_per_value < source->bits_per_value) { + mp_raise_ValueError(translate("source palette too large")); + } + + // Check x1,y1,x2,y2 are within source bitmap boundary + int16_t x1 = mp_arg_validate_int_range(args[ARG_x1].u_int, 0, MAX(0, source->width - 1), MP_QSTR_x1); + int16_t y1 = mp_arg_validate_int_range(args[ARG_y1].u_int, 0, MAX(0, source->height - 1), MP_QSTR_y1); + int16_t x2, y2; + // if x2 or y2 is None, then set as the maximum size of the source bitmap + if (args[ARG_x2].u_obj == mp_const_none) { + x2 = source->width; + } else { + x2 = mp_arg_validate_int_range(mp_obj_get_int(args[ARG_x2].u_obj), 0, source->width, MP_QSTR_x2); + } + // int16_t y2; + if (args[ARG_y2].u_obj == mp_const_none) { + y2 = source->height; + } else { + y2 = mp_arg_validate_int_range(mp_obj_get_int(args[ARG_y2].u_obj), 0, source->height, MP_QSTR_y2); + } + + // Ensure x1 < x2 and y1 < y2 + if (x1 > x2) { + int16_t temp = x2; + x2 = x1; + x1 = temp; + } + if (y1 > y2) { + int16_t temp = y2; + y2 = y1; + y1 = temp; + } + + uint32_t skip_index; + bool skip_index_none; // flag whether skip_value was None + + if (args[ARG_skip_index].u_obj == mp_const_none) { + skip_index = 0; + skip_index_none = true; + } else { + skip_index = mp_obj_get_int(args[ARG_skip_index].u_obj); + skip_index_none = false; + } + + uint32_t skip_dest_index; + bool skip_dest_index_none; // flag whether skip_self_value was None + + if (args[ARG_skip_dest_index].u_obj == mp_const_none) { + skip_dest_index = 0; + skip_dest_index_none = true; + } else { + skip_dest_index = mp_obj_get_int(args[ARG_skip_dest_index].u_obj); + skip_dest_index_none = false; + } + + common_hal_bitmaptools_blit(destination, source, x, y, x1, y1, x2, y2, skip_index, skip_index_none, skip_dest_index, + skip_dest_index_none); + + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_blit_obj, 1, bitmaptools_obj_blit); + + STATIC const mp_rom_map_elem_t bitmaptools_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_bitmaptools) }, { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&bitmaptools_readinto_obj) }, @@ -960,6 +1086,7 @@ STATIC const mp_rom_map_elem_t bitmaptools_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_draw_line), MP_ROM_PTR(&bitmaptools_draw_line_obj) }, { MP_ROM_QSTR(MP_QSTR_draw_polygon), MP_ROM_PTR(&bitmaptools_draw_polygon_obj) }, { MP_ROM_QSTR(MP_QSTR_draw_circle), MP_ROM_PTR(&bitmaptools_draw_circle_obj) }, + { MP_ROM_QSTR(MP_QSTR_blit), MP_ROM_PTR(&bitmaptools_blit_obj) }, { MP_ROM_QSTR(MP_QSTR_dither), MP_ROM_PTR(&bitmaptools_dither_obj) }, { MP_ROM_QSTR(MP_QSTR_DitherAlgorithm), MP_ROM_PTR(&bitmaptools_dither_algorithm_type) }, }; diff --git a/shared-bindings/bitmaptools/__init__.h b/shared-bindings/bitmaptools/__init__.h index 21fb1b50ab..456d2fcdfb 100644 --- a/shared-bindings/bitmaptools/__init__.h +++ b/shared-bindings/bitmaptools/__init__.h @@ -69,6 +69,10 @@ void common_hal_bitmaptools_draw_circle(displayio_bitmap_t *destination, int16_t radius, uint32_t value); +void common_hal_bitmaptools_blit(displayio_bitmap_t *destination, displayio_bitmap_t *source, int16_t x, int16_t y, + int16_t x1, int16_t y1, int16_t x2, int16_t y2, + uint32_t skip_index, bool skip_index_none, uint32_t skip_self_index, bool skip_self_index_none); + void common_hal_bitmaptools_draw_polygon(displayio_bitmap_t *destination, void *xs, void *ys, size_t points_len, int point_size, uint32_t value, bool close); void common_hal_bitmaptools_readinto(displayio_bitmap_t *self, mp_obj_t *file, int element_size, int bits_per_pixel, bool reverse_pixels_in_word, bool swap_bytes, bool reverse_rows); void common_hal_bitmaptools_arrayblit(displayio_bitmap_t *self, void *data, int element_size, int x1, int y1, int x2, int y2, bool skip_specified, uint32_t skip_index); diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index 9ff8050eab..c678a76703 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -186,125 +186,6 @@ STATIC mp_obj_t bitmap_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t val return mp_const_none; } -//| def blit( -//| self, -//| x: int, -//| y: int, -//| source_bitmap: Bitmap, -//| *, -//| x1: int, -//| y1: int, -//| x2: int, -//| y2: int, -//| skip_index: int, -//| skip_self_index: int -//| ) -> None: -//| """Inserts the source_bitmap region defined by rectangular boundaries -//| (x1,y1) and (x2,y2) into the bitmap at the specified (x,y) location. -//| -//| :param int x: Horizontal pixel location in bitmap where source_bitmap upper-left -//| corner will be placed -//| :param int y: Vertical pixel location in bitmap where source_bitmap upper-left -//| corner will be placed -//| :param bitmap source_bitmap: Source bitmap that contains the graphical region to be copied -//| :param int x1: Minimum x-value for rectangular bounding box to be copied from the source bitmap -//| :param int y1: Minimum y-value for rectangular bounding box to be copied from the source bitmap -//| :param int x2: Maximum x-value (exclusive) for rectangular bounding box to be copied from the source bitmap -//| :param int y2: Maximum y-value (exclusive) for rectangular bounding box to be copied from the source bitmap -//| :param int skip_index: bitmap palette index in the source that will not be copied, -//| set to None to copy all pixels -//| :param int skip_self_index: bitmap palette index in the self bitmap that will not get overwritten -//| by the pixels from the source""" -//| ... -STATIC mp_obj_t displayio_bitmap_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum {ARG_x, ARG_y, ARG_source, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_skip_index, ARG_skip_self_index}; - static const mp_arg_t allowed_args[] = { - {MP_QSTR_x, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL} }, - {MP_QSTR_y, MP_ARG_REQUIRED | MP_ARG_INT, {.u_obj = MP_OBJ_NULL} }, - {MP_QSTR_source_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, - {MP_QSTR_x1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, - {MP_QSTR_y1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, - {MP_QSTR_x2, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to source->width - {MP_QSTR_y2, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to source->height - {MP_QSTR_skip_index, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, - {MP_QSTR_skip_self_index, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, - }; - mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - - displayio_bitmap_t *self = MP_OBJ_TO_PTR(pos_args[0]); - check_for_deinit(self); - - // Check x,y are within self (target) bitmap boundary - int16_t x = mp_arg_validate_int_range(args[ARG_x].u_int, 0, MAX(0, self->width - 1), MP_QSTR_x); - int16_t y = mp_arg_validate_int_range(args[ARG_y].u_int, 0, MAX(0, self->height - 1), MP_QSTR_y); - - displayio_bitmap_t *source = mp_arg_validate_type(args[ARG_source].u_obj, &displayio_bitmap_type, MP_QSTR_source_bitmap); - - - // ensure that the target bitmap (self) has at least as many `bits_per_value` as the source - if (self->bits_per_value < source->bits_per_value) { - mp_raise_ValueError(translate("source palette too large")); - } - - // Check x1,y1,x2,y2 are within source bitmap boundary - int16_t x1 = mp_arg_validate_int_range(args[ARG_x1].u_int, 0, MAX(0, source->width - 1), MP_QSTR_x1); - int16_t y1 = mp_arg_validate_int_range(args[ARG_y1].u_int, 0, MAX(0, source->height - 1), MP_QSTR_y1); - int16_t x2, y2; - // if x2 or y2 is None, then set as the maximum size of the source bitmap - if (args[ARG_x2].u_obj == mp_const_none) { - x2 = source->width; - } else { - x2 = mp_arg_validate_int_range(mp_obj_get_int(args[ARG_x2].u_obj), 0, source->width, MP_QSTR_x2); - } - // int16_t y2; - if (args[ARG_y2].u_obj == mp_const_none) { - y2 = source->height; - } else { - y2 = mp_arg_validate_int_range(mp_obj_get_int(args[ARG_y2].u_obj), 0, source->height, MP_QSTR_y2); - } - - // Ensure x1 < x2 and y1 < y2 - if (x1 > x2) { - int16_t temp = x2; - x2 = x1; - x1 = temp; - } - if (y1 > y2) { - int16_t temp = y2; - y2 = y1; - y1 = temp; - } - - uint32_t skip_index; - bool skip_index_none; // flag whether skip_value was None - - if (args[ARG_skip_index].u_obj == mp_const_none) { - skip_index = 0; - skip_index_none = true; - } else { - skip_index = mp_obj_get_int(args[ARG_skip_index].u_obj); - skip_index_none = false; - } - - uint32_t skip_self_index; - bool skip_self_index_none; // flag whether skip_self_value was None - - if (args[ARG_skip_self_index].u_obj == mp_const_none) { - skip_self_index = 0; - skip_self_index_none = true; - } else { - skip_self_index = mp_obj_get_int(args[ARG_skip_self_index].u_obj); - skip_self_index_none = false; - } - - common_hal_displayio_bitmap_blit(self, x, y, source, x1, y1, x2, y2, skip_index, skip_index_none, skip_self_index, - skip_self_index_none); - - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_KW(displayio_bitmap_blit_obj, 1, displayio_bitmap_obj_blit); - //| def fill(self, value: int) -> None: //| """Fills the bitmap with the supplied palette index value.""" //| ... @@ -379,7 +260,6 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_bitmap_deinit_obj, displayio_bitmap_obj_dein STATIC const mp_rom_map_elem_t displayio_bitmap_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_bitmap_height_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_bitmap_width_obj) }, - { MP_ROM_QSTR(MP_QSTR_blit), MP_ROM_PTR(&displayio_bitmap_blit_obj) }, { MP_ROM_QSTR(MP_QSTR_fill), MP_ROM_PTR(&displayio_bitmap_fill_obj) }, { MP_ROM_QSTR(MP_QSTR_dirty), MP_ROM_PTR(&displayio_bitmap_dirty_obj) }, { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&displayio_bitmap_deinit_obj) }, diff --git a/shared-bindings/displayio/Bitmap.h b/shared-bindings/displayio/Bitmap.h index 8f52cb8f62..8f30b3a330 100644 --- a/shared-bindings/displayio/Bitmap.h +++ b/shared-bindings/displayio/Bitmap.h @@ -42,9 +42,6 @@ uint16_t common_hal_displayio_bitmap_get_height(displayio_bitmap_t *self); uint16_t common_hal_displayio_bitmap_get_width(displayio_bitmap_t *self); uint32_t common_hal_displayio_bitmap_get_bits_per_value(displayio_bitmap_t *self); void common_hal_displayio_bitmap_set_pixel(displayio_bitmap_t *bitmap, int16_t x, int16_t y, uint32_t value); -void common_hal_displayio_bitmap_blit(displayio_bitmap_t *self, int16_t x, int16_t y, displayio_bitmap_t *source, - int16_t x1, int16_t y1, int16_t x2, int16_t y2, - uint32_t skip_index, bool skip_index_none, uint32_t skip_self_index, bool skip_self_index_none); uint32_t common_hal_displayio_bitmap_get_pixel(displayio_bitmap_t *bitmap, int16_t x, int16_t y); void common_hal_displayio_bitmap_fill(displayio_bitmap_t *bitmap, uint32_t value); int common_hal_displayio_bitmap_get_buffer(displayio_bitmap_t *self, mp_buffer_info_t *bufinfo, mp_uint_t flags); diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index 0ded6d6abb..2b3b73030a 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -982,3 +982,70 @@ void common_hal_bitmaptools_draw_circle(displayio_bitmap_t *destination, draw_circle(destination, x, y, radius, value); } + +void common_hal_bitmaptools_blit(displayio_bitmap_t *destination, displayio_bitmap_t *source, int16_t x, int16_t y, + int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t skip_index, bool skip_index_none, uint32_t skip_dest_index, + bool skip_dest_index_none) { + if (destination->read_only) { + mp_raise_RuntimeError(translate("Read-only")); + } + // Copy region of "source" bitmap into "destination" bitmap at location x,y in the "destination" + // If skip_value is encountered in the source bitmap, it will not be copied. + // If skip_value is `None`, then all pixels are copied. + // This function assumes input checks were performed for pixel index entries. + + // Update the dirty area + int16_t dirty_x_max = (x + (x2 - x1)); + if (dirty_x_max > destination->width) { + dirty_x_max = destination->width; + } + int16_t dirty_y_max = y + (y2 - y1); + if (dirty_y_max > destination->height) { + dirty_y_max = destination->height; + } + + displayio_area_t a = { x, y, dirty_x_max, dirty_y_max, NULL}; + displayio_bitmap_set_dirty_area(destination, &a); + + bool x_reverse = false; + bool y_reverse = false; + + // Add reverse direction option to protect blitting of destination bitmap back into destination bitmap + if (x > x1) { + x_reverse = true; + } + if (y > y1) { + y_reverse = true; + } + + // simplest version - use internal functions for get/set pixels + for (int16_t i = 0; i < (x2 - x1); i++) { + + const int xs_index = x_reverse ? ((x2) - i - 1) : x1 + i; // x-index into the source bitmap + const int xd_index = x_reverse ? ((x + (x2 - x1)) - i - 1) : x + i; // x-index into the destination bitmap + + if ((xd_index >= 0) && (xd_index < destination->width)) { + for (int16_t j = 0; j < (y2 - y1); j++) { + + const int ys_index = y_reverse ? ((y2) - j - 1) : y1 + j; // y-index into the source bitmap + const int yd_index = y_reverse ? ((y + (y2 - y1)) - j - 1) : y + j; // y-index into the destination bitmap + + if ((yd_index >= 0) && (yd_index < destination->height)) { + uint32_t value = common_hal_displayio_bitmap_get_pixel(source, xs_index, ys_index); + if (skip_dest_index_none) { // if skip_dest_index is none, then only check source skip + if ((skip_index_none) || (value != skip_index)) { // write if skip_value_none is True + displayio_bitmap_write_pixel(destination, xd_index, yd_index, value); + } + } else { // check dest_value index against skip_dest_index and skip if they match + uint32_t dest_value = common_hal_displayio_bitmap_get_pixel(destination, xd_index, yd_index); + if (dest_value != skip_dest_index) { + if ((skip_index_none) || (value != skip_index)) { // write if skip_value_none is True + displayio_bitmap_write_pixel(destination, xd_index, yd_index, value); + } + } + } + } + } + } + } +} diff --git a/shared-module/displayio/Bitmap.c b/shared-module/displayio/Bitmap.c index f8b8170395..794e2dac19 100644 --- a/shared-module/displayio/Bitmap.c +++ b/shared-module/displayio/Bitmap.c @@ -174,73 +174,6 @@ void displayio_bitmap_write_pixel(displayio_bitmap_t *self, int16_t x, int16_t y } } -void common_hal_displayio_bitmap_blit(displayio_bitmap_t *self, int16_t x, int16_t y, displayio_bitmap_t *source, - int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t skip_index, bool skip_index_none, uint32_t skip_self_index, - bool skip_self_index_none) { - if (self->read_only) { - mp_raise_RuntimeError(translate("Read-only")); - } - // Copy region of "source" bitmap into "self" bitmap at location x,y in the "self" - // If skip_value is encountered in the source bitmap, it will not be copied. - // If skip_value is `None`, then all pixels are copied. - // This function assumes input checks were performed for pixel index entries. - - // Update the dirty area - int16_t dirty_x_max = (x + (x2 - x1)); - if (dirty_x_max > self->width) { - dirty_x_max = self->width; - } - int16_t dirty_y_max = y + (y2 - y1); - if (dirty_y_max > self->height) { - dirty_y_max = self->height; - } - - displayio_area_t a = { x, y, dirty_x_max, dirty_y_max, NULL}; - displayio_bitmap_set_dirty_area(self, &a); - - bool x_reverse = false; - bool y_reverse = false; - - // Add reverse direction option to protect blitting of self bitmap back into self bitmap - if (x > x1) { - x_reverse = true; - } - if (y > y1) { - y_reverse = true; - } - - // simplest version - use internal functions for get/set pixels - for (int16_t i = 0; i < (x2 - x1); i++) { - - const int xs_index = x_reverse ? ((x2) - i - 1) : x1 + i; // x-index into the source bitmap - const int xd_index = x_reverse ? ((x + (x2 - x1)) - i - 1) : x + i; // x-index into the destination bitmap - - if ((xd_index >= 0) && (xd_index < self->width)) { - for (int16_t j = 0; j < (y2 - y1); j++) { - - const int ys_index = y_reverse ? ((y2) - j - 1) : y1 + j; // y-index into the source bitmap - const int yd_index = y_reverse ? ((y + (y2 - y1)) - j - 1) : y + j; // y-index into the destination bitmap - - if ((yd_index >= 0) && (yd_index < self->height)) { - uint32_t value = common_hal_displayio_bitmap_get_pixel(source, xs_index, ys_index); - if (skip_self_index_none) { // if skip_self_index is none, then only check source skip - if ((skip_index_none) || (value != skip_index)) { // write if skip_value_none is True - displayio_bitmap_write_pixel(self, xd_index, yd_index, value); - } - } else { // check dest_value index against skip_self_index and skip if they match - uint32_t dest_value = common_hal_displayio_bitmap_get_pixel(self, xd_index, yd_index); - if (dest_value != skip_self_index) { - if ((skip_index_none) || (value != skip_index)) { // write if skip_value_none is True - displayio_bitmap_write_pixel(self, xd_index, yd_index, value); - } - } - } - } - } - } - } -} - void common_hal_displayio_bitmap_set_pixel(displayio_bitmap_t *self, int16_t x, int16_t y, uint32_t value) { if (self->read_only) { mp_raise_RuntimeError(translate("Read-only")); From a2ff9527dc2b5baa40eb7272315979b83d733343 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sun, 2 Jul 2023 14:40:56 -0500 Subject: [PATCH 1234/1712] format --- shared-module/bitmaptools/__init__.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index 2b3b73030a..aa13ba4acb 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -984,8 +984,9 @@ void common_hal_bitmaptools_draw_circle(displayio_bitmap_t *destination, } void common_hal_bitmaptools_blit(displayio_bitmap_t *destination, displayio_bitmap_t *source, int16_t x, int16_t y, - int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t skip_index, bool skip_index_none, uint32_t skip_dest_index, - bool skip_dest_index_none) { + int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t skip_index, bool skip_index_none, uint32_t skip_dest_index, + bool skip_dest_index_none) { + if (destination->read_only) { mp_raise_RuntimeError(translate("Read-only")); } From 16d92ddd3453ca4a478c2172aa7e9755201aad50 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sun, 2 Jul 2023 14:57:44 -0500 Subject: [PATCH 1235/1712] docs fix --- shared-bindings/bitmaptools/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index 6d0680626d..3a95ff5500 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -950,8 +950,8 @@ STATIC mp_obj_t bitmaptools_obj_draw_circle(size_t n_args, const mp_obj_t *pos_a MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_draw_circle_obj, 0, bitmaptools_obj_draw_circle); //| def blit( -//| dest_bitmap: Bitmap, -//| source_bitmap: Bitmap, +//| dest_bitmap: displayio.Bitmap, +//| source_bitmap: displayio.Bitmap, //| x: int, //| y: int, //| *, From 5dc7e9472bb7894225678d7e82ff3e2bc4f4ac0c Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 3 Jul 2023 12:08:10 -0700 Subject: [PATCH 1236/1712] Swapped address pins for Rev C --- ports/espressif/boards/adafruit_matrixportal_s3/pins.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/espressif/boards/adafruit_matrixportal_s3/pins.c b/ports/espressif/boards/adafruit_matrixportal_s3/pins.c index bc2de4299b..5cdd9ab92c 100644 --- a/ports/espressif/boards/adafruit_matrixportal_s3/pins.c +++ b/ports/espressif/boards/adafruit_matrixportal_s3/pins.c @@ -77,10 +77,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_G2),MP_ROM_PTR(&pin_GPIO39) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_B2),MP_ROM_PTR(&pin_GPIO37) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRA),MP_ROM_PTR(&pin_GPIO35) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRA),MP_ROM_PTR(&pin_GPIO45) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRB),MP_ROM_PTR(&pin_GPIO36) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRC),MP_ROM_PTR(&pin_GPIO48) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRD),MP_ROM_PTR(&pin_GPIO45) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRD),MP_ROM_PTR(&pin_GPIO35) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRE),MP_ROM_PTR(&pin_GPIO21) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_CLK),MP_ROM_PTR(&pin_GPIO2) }, From 72857994f2e3c8562926b2bc05464671401e9283 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 5 Jul 2023 17:27:41 -0500 Subject: [PATCH 1237/1712] change skip_index to skip_source_index --- shared-bindings/bitmaptools/__init__.c | 24 ++++++++++++------------ shared-bindings/bitmaptools/__init__.h | 2 +- shared-module/bitmaptools/__init__.c | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index 3a95ff5500..5139a55645 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -959,7 +959,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_draw_circle_obj, 0, bitmaptools_obj_draw_ //| y1: int, //| x2: int, //| y2: int, -//| skip_index: int, +//| skip_source_index: int, //| skip_dest_index: int //| ) -> None: //| """Inserts the source_bitmap region defined by rectangular boundaries @@ -975,14 +975,14 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_draw_circle_obj, 0, bitmaptools_obj_draw_ //| :param int y1: Minimum y-value for rectangular bounding box to be copied from the source bitmap //| :param int x2: Maximum x-value (exclusive) for rectangular bounding box to be copied from the source bitmap //| :param int y2: Maximum y-value (exclusive) for rectangular bounding box to be copied from the source bitmap -//| :param int skip_index: bitmap palette index in the source that will not be copied, +//| :param int skip_source_index: bitmap palette index in the source that will not be copied, //| set to None to copy all pixels //| :param int skip_dest_index: bitmap palette index in the destination bitmap that will not get overwritten //| by the pixels from the source""" //| ... //| STATIC mp_obj_t bitmaptools_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum {ARG_destination, ARG_source, ARG_x, ARG_y, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_skip_index, ARG_skip_dest_index}; + enum {ARG_destination, ARG_source, ARG_x, ARG_y, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_skip_source_index, ARG_skip_dest_index}; static const mp_arg_t allowed_args[] = { {MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, {MP_QSTR_source_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, @@ -992,7 +992,7 @@ STATIC mp_obj_t bitmaptools_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp {MP_QSTR_y1, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, {MP_QSTR_x2, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to source->width {MP_QSTR_y2, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, // None convert to source->height - {MP_QSTR_skip_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + {MP_QSTR_skip_source_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, {MP_QSTR_skip_dest_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; @@ -1045,15 +1045,15 @@ STATIC mp_obj_t bitmaptools_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp y1 = temp; } - uint32_t skip_index; - bool skip_index_none; // flag whether skip_value was None + uint32_t skip_source_index; + bool skip_source_index_none; // flag whether skip_value was None - if (args[ARG_skip_index].u_obj == mp_const_none) { - skip_index = 0; - skip_index_none = true; + if (args[ARG_skip_source_index].u_obj == mp_const_none) { + skip_source_index = 0; + skip_source_index_none = true; } else { - skip_index = mp_obj_get_int(args[ARG_skip_index].u_obj); - skip_index_none = false; + skip_source_index = mp_obj_get_int(args[ARG_skip_source_index].u_obj); + skip_source_index_none = false; } uint32_t skip_dest_index; @@ -1067,7 +1067,7 @@ STATIC mp_obj_t bitmaptools_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp skip_dest_index_none = false; } - common_hal_bitmaptools_blit(destination, source, x, y, x1, y1, x2, y2, skip_index, skip_index_none, skip_dest_index, + common_hal_bitmaptools_blit(destination, source, x, y, x1, y1, x2, y2, skip_source_index, skip_source_index_none, skip_dest_index, skip_dest_index_none); return mp_const_none; diff --git a/shared-bindings/bitmaptools/__init__.h b/shared-bindings/bitmaptools/__init__.h index 456d2fcdfb..be0811cb80 100644 --- a/shared-bindings/bitmaptools/__init__.h +++ b/shared-bindings/bitmaptools/__init__.h @@ -71,7 +71,7 @@ void common_hal_bitmaptools_draw_circle(displayio_bitmap_t *destination, void common_hal_bitmaptools_blit(displayio_bitmap_t *destination, displayio_bitmap_t *source, int16_t x, int16_t y, int16_t x1, int16_t y1, int16_t x2, int16_t y2, - uint32_t skip_index, bool skip_index_none, uint32_t skip_self_index, bool skip_self_index_none); + uint32_t skip_source_index, bool skip_source_index_none, uint32_t skip_dest_index, bool skip_dest_index_none); void common_hal_bitmaptools_draw_polygon(displayio_bitmap_t *destination, void *xs, void *ys, size_t points_len, int point_size, uint32_t value, bool close); void common_hal_bitmaptools_readinto(displayio_bitmap_t *self, mp_obj_t *file, int element_size, int bits_per_pixel, bool reverse_pixels_in_word, bool swap_bytes, bool reverse_rows); diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index aa13ba4acb..e6c0a9439d 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -984,7 +984,7 @@ void common_hal_bitmaptools_draw_circle(displayio_bitmap_t *destination, } void common_hal_bitmaptools_blit(displayio_bitmap_t *destination, displayio_bitmap_t *source, int16_t x, int16_t y, - int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t skip_index, bool skip_index_none, uint32_t skip_dest_index, + int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint32_t skip_source_index, bool skip_source_index_none, uint32_t skip_dest_index, bool skip_dest_index_none) { if (destination->read_only) { @@ -1034,13 +1034,13 @@ void common_hal_bitmaptools_blit(displayio_bitmap_t *destination, displayio_bitm if ((yd_index >= 0) && (yd_index < destination->height)) { uint32_t value = common_hal_displayio_bitmap_get_pixel(source, xs_index, ys_index); if (skip_dest_index_none) { // if skip_dest_index is none, then only check source skip - if ((skip_index_none) || (value != skip_index)) { // write if skip_value_none is True + if ((skip_source_index_none) || (value != skip_source_index)) { // write if skip_value_none is True displayio_bitmap_write_pixel(destination, xd_index, yd_index, value); } } else { // check dest_value index against skip_dest_index and skip if they match uint32_t dest_value = common_hal_displayio_bitmap_get_pixel(destination, xd_index, yd_index); if (dest_value != skip_dest_index) { - if ((skip_index_none) || (value != skip_index)) { // write if skip_value_none is True + if ((skip_source_index_none) || (value != skip_source_index)) { // write if skip_value_none is True displayio_bitmap_write_pixel(destination, xd_index, yd_index, value); } } From 5fcd90d8fbac07b45ce0fe7410d2d4c8352f5e0b Mon Sep 17 00:00:00 2001 From: Marco van der Kolk Date: Thu, 6 Jul 2023 23:31:15 +0200 Subject: [PATCH 1238/1712] Extended to support multiple data pins Signed-off-by: Marco van der Kolk --- shared-bindings/keypad/ShiftRegisterKeys.c | 53 ++++++++++- shared-bindings/keypad/ShiftRegisterKeys.h | 2 +- shared-module/keypad/ShiftRegisterKeys.c | 105 ++++++++++++++++----- shared-module/keypad/ShiftRegisterKeys.h | 6 +- 4 files changed, 134 insertions(+), 32 deletions(-) diff --git a/shared-bindings/keypad/ShiftRegisterKeys.c b/shared-bindings/keypad/ShiftRegisterKeys.c index 1fcf517ac3..73e3264ac4 100644 --- a/shared-bindings/keypad/ShiftRegisterKeys.c +++ b/shared-bindings/keypad/ShiftRegisterKeys.c @@ -62,6 +62,7 @@ //| :param microcontroller.Pin clock: The shift register clock pin. //| The shift register should clock on a low-to-high transition. //| :param microcontroller.Pin data: the incoming shift register data pin +//| :param Sequence[microcontroller.Pin] data: a list of incoming shift register data pins //| :param microcontroller.Pin latch: //| Pin used to latch parallel data going into the shift register. //| :param bool value_to_latch: Pin state to latch data being read. @@ -70,6 +71,7 @@ //| The default is ``True``, which is how the 74HC165 operates. The CD4021 latch is the opposite. //| Once the data is latched, it will be shifted out by toggling the clock pin. //| :param int key_count: number of data lines to clock in +//| :param Sequence[int] key_count: a list of key_counts equal sized to data pins //| :param bool value_when_pressed: ``True`` if the pin reads high when the key is pressed. //| ``False`` if the pin reads low (is grounded) when the key is pressed. //| :param float interval: Scan keys no more often than ``interval`` to allow for debouncing. @@ -91,7 +93,7 @@ STATIC mp_obj_t keypad_shiftregisterkeys_make_new(const mp_obj_type_t *type, siz { MP_QSTR_data, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_latch, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_value_to_latch, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} }, - { MP_QSTR_key_count, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_key_count, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_value_when_pressed, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_BOOL }, { MP_QSTR_interval, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_max_events, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 64} }, @@ -99,21 +101,64 @@ STATIC mp_obj_t keypad_shiftregisterkeys_make_new(const mp_obj_type_t *type, siz mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + size_t num_data_pins; + + if (mp_obj_is_type(args[ARG_data].u_obj, &mcu_pin_type)) { + num_data_pins = 1; + } else { + num_data_pins = (size_t)MP_OBJ_SMALL_INT_VALUE(mp_obj_len(args[ARG_data].u_obj)); + } + + const mcu_pin_obj_t *data_pins_array[num_data_pins]; + + if (mp_obj_is_type(args[ARG_data].u_obj, &mcu_pin_type)) { + const mcu_pin_obj_t *datapin = validate_obj_is_free_pin(args[ARG_data].u_obj, MP_QSTR_data); + data_pins_array[0] = datapin; + } else { + for (size_t pin = 0; pin < num_data_pins; pin++) { + const mcu_pin_obj_t *datapin = + validate_obj_is_free_pin(mp_obj_subscr(args[ARG_data].u_obj, MP_OBJ_NEW_SMALL_INT(pin), MP_OBJ_SENTINEL), MP_QSTR_data); + data_pins_array[pin] = datapin; + } + } + + size_t num_key_counts; + + if (mp_obj_is_int(args[ARG_key_count].u_obj)) { + num_key_counts = 1; + } else { + num_key_counts = (size_t)MP_OBJ_SMALL_INT_VALUE(mp_obj_len(args[ARG_key_count].u_obj)); + } + + mp_arg_validate_length(num_key_counts, num_data_pins, MP_QSTR_key_count); + + size_t key_count_array[num_key_counts]; + + if (mp_obj_is_int(args[ARG_key_count].u_obj)) { + const size_t key_count = (size_t)mp_arg_validate_int_min(args[ARG_key_count].u_int, 1, MP_QSTR_key_count); + key_count_array[0] = key_count; + } else { + for (size_t kc = 0; kc < num_key_counts; kc++) { + mp_int_t mpint = mp_obj_get_int(mp_obj_subscr(args[ARG_key_count].u_obj, MP_OBJ_NEW_SMALL_INT(kc), MP_OBJ_SENTINEL)); + const size_t key_count = (size_t)mp_arg_validate_int_min(mpint, 1, MP_QSTR_key_count); + key_count_array[kc] = key_count; + } + } + const mcu_pin_obj_t *clock = validate_obj_is_free_pin(args[ARG_clock].u_obj, MP_QSTR_clock); - const mcu_pin_obj_t *data = validate_obj_is_free_pin(args[ARG_data].u_obj, MP_QSTR_data); const mcu_pin_obj_t *latch = validate_obj_is_free_pin(args[ARG_latch].u_obj, MP_QSTR_latch); const bool value_to_latch = args[ARG_value_to_latch].u_bool; - const size_t key_count = (size_t)mp_arg_validate_int_min(args[ARG_key_count].u_int, 1, MP_QSTR_key_count); const bool value_when_pressed = args[ARG_value_when_pressed].u_bool; const mp_float_t interval = mp_arg_validate_obj_float_non_negative(args[ARG_interval].u_obj, 0.020f, MP_QSTR_interval); const size_t max_events = (size_t)mp_arg_validate_int_min(args[ARG_max_events].u_int, 1, MP_QSTR_max_events); common_hal_keypad_shiftregisterkeys_construct( - self, clock, data, latch, value_to_latch, key_count, value_when_pressed, interval, max_events); + self, clock, num_data_pins, data_pins_array, latch, value_to_latch, num_key_counts, key_count_array, value_when_pressed, interval, max_events); return MP_OBJ_FROM_PTR(self); + #else mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_ShiftRegisterKeys); #endif diff --git a/shared-bindings/keypad/ShiftRegisterKeys.h b/shared-bindings/keypad/ShiftRegisterKeys.h index bc91c78ab0..e3d1bc20be 100644 --- a/shared-bindings/keypad/ShiftRegisterKeys.h +++ b/shared-bindings/keypad/ShiftRegisterKeys.h @@ -32,7 +32,7 @@ extern const mp_obj_type_t keypad_shiftregisterkeys_type; -void common_hal_keypad_shiftregisterkeys_construct(keypad_shiftregisterkeys_obj_t *self, const mcu_pin_obj_t *clock_pin, const mcu_pin_obj_t *data_pin, const mcu_pin_obj_t *latch_pin, bool value_to_latch, size_t key_count, bool value_when_pressed, mp_float_t interval, size_t max_events); +void common_hal_keypad_shiftregisterkeys_construct(keypad_shiftregisterkeys_obj_t *self, const mcu_pin_obj_t *clock_pin, mp_uint_t num_data_pins, const mcu_pin_obj_t *data_pins[], const mcu_pin_obj_t *latch_pin, bool value_to_latch, size_t num_key_count, size_t key_counts[], bool value_when_pressed, mp_float_t interval, size_t max_events); void common_hal_keypad_shiftregisterkeys_deinit(keypad_shiftregisterkeys_obj_t *self); diff --git a/shared-module/keypad/ShiftRegisterKeys.c b/shared-module/keypad/ShiftRegisterKeys.c index b2b10c65a2..ee42c2c4b3 100644 --- a/shared-module/keypad/ShiftRegisterKeys.c +++ b/shared-module/keypad/ShiftRegisterKeys.c @@ -44,7 +44,7 @@ static keypad_scanner_funcs_t shiftregisterkeys_funcs = { .get_key_count = shiftregisterkeys_get_key_count, }; -void common_hal_keypad_shiftregisterkeys_construct(keypad_shiftregisterkeys_obj_t *self, const mcu_pin_obj_t *clock_pin, const mcu_pin_obj_t *data_pin, const mcu_pin_obj_t *latch_pin, bool value_to_latch, size_t key_count, bool value_when_pressed, mp_float_t interval, size_t max_events) { +void common_hal_keypad_shiftregisterkeys_construct(keypad_shiftregisterkeys_obj_t *self, const mcu_pin_obj_t *clock_pin, mp_uint_t num_data_pins, const mcu_pin_obj_t *data_pins[], const mcu_pin_obj_t *latch_pin, bool value_to_latch, mp_uint_t num_key_counts, size_t key_counts[], bool value_when_pressed, mp_float_t interval, size_t max_events) { digitalio_digitalinout_obj_t *clock = m_new_obj(digitalio_digitalinout_obj_t); clock->base.type = &digitalio_digitalinout_type; @@ -52,22 +52,46 @@ void common_hal_keypad_shiftregisterkeys_construct(keypad_shiftregisterkeys_obj_ common_hal_digitalio_digitalinout_switch_to_output(clock, false, DRIVE_MODE_PUSH_PULL); self->clock = clock; - digitalio_digitalinout_obj_t *data = m_new_obj(digitalio_digitalinout_obj_t); - data->base.type = &digitalio_digitalinout_type; - common_hal_digitalio_digitalinout_construct(data, data_pin); - common_hal_digitalio_digitalinout_switch_to_input(data, PULL_NONE); - self->data = data; - digitalio_digitalinout_obj_t *latch = m_new_obj(digitalio_digitalinout_obj_t); latch->base.type = &digitalio_digitalinout_type; common_hal_digitalio_digitalinout_construct(latch, latch_pin); common_hal_digitalio_digitalinout_switch_to_output(latch, true, DRIVE_MODE_PUSH_PULL); self->latch = latch; - self->value_to_latch = value_to_latch; + mp_obj_t dios[num_data_pins]; + + for (size_t i = 0; i < num_data_pins; i++) { + digitalio_digitalinout_obj_t *dio = m_new_obj(digitalio_digitalinout_obj_t); + dio->base.type = &digitalio_digitalinout_type; + common_hal_digitalio_digitalinout_construct(dio, data_pins[i]); + common_hal_digitalio_digitalinout_switch_to_input(dio, PULL_NONE); + dios[i] = dio; + } + + // Allocate a tuple object with the data pins + self->data = mp_obj_new_tuple(num_data_pins, dios); + + self->key_counts = (mp_uint_t *)gc_alloc(sizeof(mp_uint_t) * num_key_counts, false, false); + self->num_key_counts = num_key_counts; + + // copy to a gc_alloc() and on the fly record pin with largest Shift register + mp_uint_t max = 0; + + for (mp_uint_t i = 0; i < self->num_key_counts; i++) { + mp_uint_t cnt = key_counts[i]; + + if (cnt > max) { + max = cnt; + } + + self->key_counts[i] = cnt; + } + + self->max_key_count = max; + + self->value_to_latch = value_to_latch; self->value_when_pressed = value_when_pressed; - self->key_count = key_count; self->funcs = &shiftregisterkeys_funcs; keypad_construct_common((keypad_scanner_obj_t *)self, interval, max_events); @@ -85,18 +109,33 @@ void common_hal_keypad_shiftregisterkeys_deinit(keypad_shiftregisterkeys_obj_t * common_hal_digitalio_digitalinout_deinit(self->clock); self->clock = MP_ROM_NONE; +/* common_hal_digitalio_digitalinout_deinit(self->data); self->data = MP_ROM_NONE; +*/ common_hal_digitalio_digitalinout_deinit(self->latch); self->latch = MP_ROM_NONE; + for (size_t key = 0; key < self->datas->len; key++) { + common_hal_digitalio_digitalinout_deinit(self->datas->items[key]); + } + self->data = MP_ROM_NONE; + common_hal_keypad_deinit_core(self); } size_t shiftregisterkeys_get_key_count(void *self_in) { keypad_shiftregisterkeys_obj_t *self = self_in; - return self->key_count; + + size_t total = 0; + + for (mp_uint_t i = 0; i < self->num_key_counts; i++) + { + total += self->key_counts[i]; + } + + return total; } static void shiftregisterkeys_scan_now(void *self_in, mp_obj_t timestamp) { @@ -105,28 +144,44 @@ static void shiftregisterkeys_scan_now(void *self_in, mp_obj_t timestamp) { // Latch (freeze) the current state of the input pins. common_hal_digitalio_digitalinout_set_value(self->latch, self->value_to_latch); - const size_t key_count = shiftregisterkeys_get_key_count(self); - - for (mp_uint_t key_number = 0; key_number < key_count; key_number++) { - // Zero-th data appears on on the data pin immediately, without shifting. + // Scan for max_key_count bit + for (mp_uint_t scan_number = 0; scan_number < self->max_key_count; scan_number++) { common_hal_digitalio_digitalinout_set_value(self->clock, false); - // Remember the previous up/down state. - const bool previous = self->currently_pressed[key_number]; - self->previously_pressed[key_number] = previous; + // Zero-th data appears on on the data pin immediately, without shifting. - // Get the current state. - const bool current = - common_hal_digitalio_digitalinout_get_value(self->data) == self->value_when_pressed; - self->currently_pressed[key_number] = current; + // Loop through all the data pins that share the latch + mp_uint_t index = 0; + + for (mp_uint_t i = 0; i < self->datas->len; i++) { + + // When this data pin has less shiftable bits, ignore it + if (scan_number >= self->key_counts[i]) { + continue; + } + + mp_uint_t key_number = scan_number + index; + + // Remember the previous up/down state. + const bool previous = self->currently_pressed[key_number]; + self->previously_pressed[key_number] = previous; + + // Get the current state. + const bool current = + common_hal_digitalio_digitalinout_get_value(self->datas->items[i]) == self->value_when_pressed; + self->currently_pressed[key_number] = current; + + // Record any transitions. + if (previous != current) { + keypad_eventqueue_record(self->events, key_number, current, timestamp); + } + + index += self->key_counts[i]; + } // Trigger a shift to get the next bit. common_hal_digitalio_digitalinout_set_value(self->clock, true); - // Record any transitions. - if (previous != current) { - keypad_eventqueue_record(self->events, key_number, current, timestamp); - } } // Start reading the input pins again. diff --git a/shared-module/keypad/ShiftRegisterKeys.h b/shared-module/keypad/ShiftRegisterKeys.h index 84c66ef627..9ce9692cda 100644 --- a/shared-module/keypad/ShiftRegisterKeys.h +++ b/shared-module/keypad/ShiftRegisterKeys.h @@ -37,9 +37,11 @@ typedef struct { KEYPAD_SCANNER_COMMON_FIELDS; digitalio_digitalinout_obj_t *clock; - digitalio_digitalinout_obj_t *data; digitalio_digitalinout_obj_t *latch; - size_t key_count; + mp_obj_tuple_t *data; + mp_uint_t *key_counts; + mp_uint_t num_key_counts; + mp_uint_t max_key_count; bool value_when_pressed; bool value_to_latch; } keypad_shiftregisterkeys_obj_t; From 4ba4c2a9428e714b53d6eeb2d6e528e572b65878 Mon Sep 17 00:00:00 2001 From: Marco van der Kolk Date: Fri, 7 Jul 2023 00:28:07 +0200 Subject: [PATCH 1239/1712] Renamed 'datas' to 'data_pins' to keep codespell happy Signed-off-by: Marco van der Kolk --- shared-module/keypad/ShiftRegisterKeys.c | 17 ++++++----------- shared-module/keypad/ShiftRegisterKeys.h | 2 +- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/shared-module/keypad/ShiftRegisterKeys.c b/shared-module/keypad/ShiftRegisterKeys.c index ee42c2c4b3..ae5fa35636 100644 --- a/shared-module/keypad/ShiftRegisterKeys.c +++ b/shared-module/keypad/ShiftRegisterKeys.c @@ -70,7 +70,7 @@ void common_hal_keypad_shiftregisterkeys_construct(keypad_shiftregisterkeys_obj_ } // Allocate a tuple object with the data pins - self->data = mp_obj_new_tuple(num_data_pins, dios); + self->data_pins = mp_obj_new_tuple(num_data_pins, dios); self->key_counts = (mp_uint_t *)gc_alloc(sizeof(mp_uint_t) * num_key_counts, false, false); self->num_key_counts = num_key_counts; @@ -109,18 +109,13 @@ void common_hal_keypad_shiftregisterkeys_deinit(keypad_shiftregisterkeys_obj_t * common_hal_digitalio_digitalinout_deinit(self->clock); self->clock = MP_ROM_NONE; -/* - common_hal_digitalio_digitalinout_deinit(self->data); - self->data = MP_ROM_NONE; -*/ - common_hal_digitalio_digitalinout_deinit(self->latch); self->latch = MP_ROM_NONE; - for (size_t key = 0; key < self->datas->len; key++) { - common_hal_digitalio_digitalinout_deinit(self->datas->items[key]); + for (size_t key = 0; key < self->data_pins->len; key++) { + common_hal_digitalio_digitalinout_deinit(self->data_pins->items[key]); } - self->data = MP_ROM_NONE; + self->data_pins = MP_ROM_NONE; common_hal_keypad_deinit_core(self); } @@ -153,7 +148,7 @@ static void shiftregisterkeys_scan_now(void *self_in, mp_obj_t timestamp) { // Loop through all the data pins that share the latch mp_uint_t index = 0; - for (mp_uint_t i = 0; i < self->datas->len; i++) { + for (mp_uint_t i = 0; i < self->data_pins->len; i++) { // When this data pin has less shiftable bits, ignore it if (scan_number >= self->key_counts[i]) { @@ -168,7 +163,7 @@ static void shiftregisterkeys_scan_now(void *self_in, mp_obj_t timestamp) { // Get the current state. const bool current = - common_hal_digitalio_digitalinout_get_value(self->datas->items[i]) == self->value_when_pressed; + common_hal_digitalio_digitalinout_get_value(self->data_pins->items[i]) == self->value_when_pressed; self->currently_pressed[key_number] = current; // Record any transitions. diff --git a/shared-module/keypad/ShiftRegisterKeys.h b/shared-module/keypad/ShiftRegisterKeys.h index 9ce9692cda..0c2ccfb63b 100644 --- a/shared-module/keypad/ShiftRegisterKeys.h +++ b/shared-module/keypad/ShiftRegisterKeys.h @@ -38,7 +38,7 @@ typedef struct { KEYPAD_SCANNER_COMMON_FIELDS; digitalio_digitalinout_obj_t *clock; digitalio_digitalinout_obj_t *latch; - mp_obj_tuple_t *data; + mp_obj_tuple_t *data_pins; mp_uint_t *key_counts; mp_uint_t num_key_counts; mp_uint_t max_key_count; From 5fedf02806c3edac8fa684a7c8d8e975a82f1add Mon Sep 17 00:00:00 2001 From: Zelin Cai Date: Fri, 7 Jul 2023 00:09:05 +0800 Subject: [PATCH 1240/1712] Added Makerdiary nRF52840 Connect Kit. Signed-off-by: Zelin Cai --- .../makerdiary_nrf52840_connectkit/README.md | 32 +++++++ .../makerdiary_nrf52840_connectkit/board.c | 29 +++++++ .../mpconfigboard.h | 30 +++++++ .../mpconfigboard.mk | 14 ++++ .../makerdiary_nrf52840_connectkit/pins.c | 84 +++++++++++++++++++ 5 files changed, 189 insertions(+) create mode 100644 ports/nrf/boards/makerdiary_nrf52840_connectkit/README.md create mode 100644 ports/nrf/boards/makerdiary_nrf52840_connectkit/board.c create mode 100644 ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.h create mode 100644 ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.mk create mode 100644 ports/nrf/boards/makerdiary_nrf52840_connectkit/pins.c diff --git a/ports/nrf/boards/makerdiary_nrf52840_connectkit/README.md b/ports/nrf/boards/makerdiary_nrf52840_connectkit/README.md new file mode 100644 index 0000000000..2d06ff73a0 --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_connectkit/README.md @@ -0,0 +1,32 @@ +# Makerdiary nRF52840 Connect Kit + +## Introduction + +[nRF52840 Connect Kit](https://makerdiary.com/products/nrf52840-connectkit) is an open-source prototyping +kit designed for connected projects. It is built using the nRF52840 SoC, which has protocol support for +Bluetooth LE, Bluetooth mesh, Thread, Zigbee, 802.15.4, ANT and 2.4 GHz proprietary stacks. It provides +Arm TrustZone® CryptoCell cryptographic unit as well as numerous peripherals such as USB 2.0, NFC-A, GPIO, +UART, SPI, TWI, PDM, I2S, QSPI, PWM, ADC, QDEC to support a wide range of applications. + +The design is available in an easy-to-use form factor with USB-C and 40 pin DIP/SMT type, including up to +32 multi-function GPIO pins (7 can be used as ADC inputs) and Serial Wire Debug (SWD) port. It features +RGB LED, Buttons, external 64 Mbit QSPI flash and flexible power management with various options for easily +powering the unit from USB-C, external supplies or batteries, and also has Chip antenna and U.FL receptacle +options to support various wireless scenarios. + +Refer to [nRF52840 Connect Kit wiki page](https://wiki.makerdiary.com/nrf52840-connectkit) for more details. + +![](https://wiki.makerdiary.com/nrf52840-connectkit/assets/images/nrf52840_connectkit_hero.png) + +## Hardware diagram + +The following figure illustrates the nRF52840 Connect Kit hardware diagram. The design is available in +Chip antenna and U.FL receptacle options, both have most of the same components except the antenna +interface. + +[![](https://wiki.makerdiary.com/nrf52840-connectkit/assets/images/pinout.png)](https://wiki.makerdiary.com/nrf52840-connectkit/assets/attachments/nrf52840-connectkit-quick-start-guide.pdf) + +## Get Involved + +We think the best way to learn is by doing. And to help you run CircuitPython on nRF52840 Connect Kit, +we have provided an extensive set of documentation. Find the details [here](https://wiki.makerdiary.com/nrf52840-connectkit/guides/python/). diff --git a/ports/nrf/boards/makerdiary_nrf52840_connectkit/board.c b/ports/nrf/boards/makerdiary_nrf52840_connectkit/board.c new file mode 100644 index 0000000000..fb1ce4fb83 --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_connectkit/board.c @@ -0,0 +1,29 @@ +/* + * 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.h b/ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.h new file mode 100644 index 0000000000..3cb15ca66b --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.h @@ -0,0 +1,30 @@ +#include "nrfx/hal/nrf_gpio.h" + +#define MICROPY_HW_BOARD_NAME "Makerdiary nRF52840 Connect Kit" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#if QSPI_FLASH_FILESYSTEM +#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 20) +#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 21) +#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 22) +#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 23) +#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19) +#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 17) +#endif + +#define BOARD_HAS_CRYSTAL 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_P0_24) +#define DEFAULT_I2C_BUS_SDA (&pin_P0_25) + +#define DEFAULT_SPI_BUS_SCK (&pin_P0_14) +#define DEFAULT_SPI_BUS_MOSI (&pin_P0_15) +#define DEFAULT_SPI_BUS_MISO (&pin_P0_16) + +#define DEFAULT_UART_BUS_RX (&pin_P0_12) +#define DEFAULT_UART_BUS_TX (&pin_P0_13) + +#define CIRCUITPY_RGB_STATUS_INVERTED_PWM +#define CIRCUITPY_RGB_STATUS_R (&pin_P1_10) +#define CIRCUITPY_RGB_STATUS_G (&pin_P1_11) +#define CIRCUITPY_RGB_STATUS_B (&pin_P1_12) diff --git a/ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.mk b/ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.mk new file mode 100644 index 0000000000..0e5c1181c7 --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.mk @@ -0,0 +1,14 @@ +USB_VID = 0x2886 +USB_PID = 0xF003 +USB_PRODUCT = "Makerdiary nRF52840 Connect Kit" +USB_MANUFACTURER = "Makerdiary" +SOFTDEV_VERSION=7.0.1 + +MCU_CHIP = nrf52840 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICES = "MX25R6435F" + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BLE +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/nrf/boards/makerdiary_nrf52840_connectkit/pins.c b/ports/nrf/boards/makerdiary_nrf52840_connectkit/pins.c new file mode 100644 index 0000000000..80478ca03f --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_connectkit/pins.c @@ -0,0 +1,84 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_P3), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_P4), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_P5), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_P6), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_P7), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_P8), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_P9), MP_ROM_PTR(&pin_P0_09) }, + { MP_ROM_QSTR(MP_QSTR_P10), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_P11), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_P12), MP_ROM_PTR(&pin_P0_12) }, + { MP_ROM_QSTR(MP_QSTR_P13), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_P14), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_P15), MP_ROM_PTR(&pin_P0_15) }, + { MP_ROM_QSTR(MP_QSTR_P16), MP_ROM_PTR(&pin_P0_16) }, + { MP_ROM_QSTR(MP_QSTR_P18), MP_ROM_PTR(&pin_P0_18) }, + { MP_ROM_QSTR(MP_QSTR_P24), MP_ROM_PTR(&pin_P0_24) }, + { MP_ROM_QSTR(MP_QSTR_P25), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_P26), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_P27), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_P28), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_P29), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_P30), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_P31), MP_ROM_PTR(&pin_P0_31) }, + { MP_ROM_QSTR(MP_QSTR_P32), MP_ROM_PTR(&pin_P1_00) }, + { MP_ROM_QSTR(MP_QSTR_P33), MP_ROM_PTR(&pin_P1_01) }, + { MP_ROM_QSTR(MP_QSTR_P34), MP_ROM_PTR(&pin_P1_02) }, + { MP_ROM_QSTR(MP_QSTR_P35), MP_ROM_PTR(&pin_P1_03) }, + { MP_ROM_QSTR(MP_QSTR_P36), MP_ROM_PTR(&pin_P1_04) }, + { MP_ROM_QSTR(MP_QSTR_P37), MP_ROM_PTR(&pin_P1_05) }, + { MP_ROM_QSTR(MP_QSTR_P38), MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_P39), MP_ROM_PTR(&pin_P1_07) }, + { MP_ROM_QSTR(MP_QSTR_P40), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR_P41), MP_ROM_PTR(&pin_P1_09) }, + { MP_ROM_QSTR(MP_QSTR_P42), MP_ROM_PTR(&pin_P1_10) }, + { MP_ROM_QSTR(MP_QSTR_P43), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_P44), MP_ROM_PTR(&pin_P1_12) }, + { MP_ROM_QSTR(MP_QSTR_P45), MP_ROM_PTR(&pin_P1_13) }, + { MP_ROM_QSTR(MP_QSTR_P46), MP_ROM_PTR(&pin_P1_14) }, + { MP_ROM_QSTR(MP_QSTR_P47), MP_ROM_PTR(&pin_P1_15) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR_MEAS_EN), MP_ROM_PTR(&pin_P1_14) }, + { MP_ROM_QSTR(MP_QSTR_MODE), MP_ROM_PTR(&pin_P1_13) }, + + { MP_ROM_QSTR(MP_QSTR_USER), MP_ROM_PTR(&pin_P1_00) }, + { MP_ROM_QSTR(MP_QSTR_RESET), MP_ROM_PTR(&pin_P0_18) }, + + { MP_ROM_QSTR(MP_QSTR_LED0), MP_ROM_PTR(&pin_P1_15) }, + { MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_P1_10) }, + { MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_LED3), MP_ROM_PTR(&pin_P1_12) }, + { MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P1_10) }, + { MP_ROM_QSTR(MP_QSTR_GREEN_LED), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_P1_12) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_12) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_24) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_25) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_15) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_16) }, + + { 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_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 8991f0cd7a7d2074f3e8127cec7baaa4427020e8 Mon Sep 17 00:00:00 2001 From: Miroslav Zuzelka Date: Fri, 7 Jul 2023 11:48:03 +0200 Subject: [PATCH 1241/1712] Update ES3ink board definition - fix wrong VID - add NEOPIXEL definition - add DOUBLE_TAP_PIN definition - add definition for default SPI bus --- ports/espressif/boards/es3ink/mpconfigboard.h | 9 ++++++++ .../espressif/boards/es3ink/mpconfigboard.mk | 2 +- ports/espressif/boards/es3ink/pins.c | 21 +++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ports/espressif/boards/es3ink/mpconfigboard.h b/ports/espressif/boards/es3ink/mpconfigboard.h index 0be6f5abe7..5aa60a122a 100644 --- a/ports/espressif/boards/es3ink/mpconfigboard.h +++ b/ports/espressif/boards/es3ink/mpconfigboard.h @@ -29,6 +29,9 @@ #define MICROPY_HW_BOARD_NAME "ES3ink" #define MICROPY_HW_MCU_NAME "ESP32S3" +#define MICROPY_HW_NEOPIXEL (&pin_GPIO8) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO18) + #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) #define DEFAULT_UART_BUS_RX (&pin_GPIO44) @@ -36,3 +39,9 @@ #define DEFAULT_I2C_BUS_SCL (&pin_GPIO3) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO4) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO12) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO13) + +#define DOUBLE_TAP_PIN (&pin_GPIO38) diff --git a/ports/espressif/boards/es3ink/mpconfigboard.mk b/ports/espressif/boards/es3ink/mpconfigboard.mk index 48ea9f122e..bd55e68379 100644 --- a/ports/espressif/boards/es3ink/mpconfigboard.mk +++ b/ports/espressif/boards/es3ink/mpconfigboard.mk @@ -1,4 +1,4 @@ -USB_VID = 0x239A +USB_VID = 0x1209 USB_PID = 0x2031 USB_PRODUCT = "ES3ink" USB_MANUFACTURER = "Czech maker" diff --git a/ports/espressif/boards/es3ink/pins.c b/ports/espressif/boards/es3ink/pins.c index e9ddf81a7a..f316137b7f 100644 --- a/ports/espressif/boards/es3ink/pins.c +++ b/ports/espressif/boards/es3ink/pins.c @@ -3,9 +3,14 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) }, @@ -16,18 +21,29 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, @@ -52,8 +68,13 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, { 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_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) } }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From e8c7b4a9f4d448dd5ecee5ba9ea7c46161e7c2e9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 7 Jul 2023 11:28:42 -0500 Subject: [PATCH 1242/1712] test a zero-byte environment file --- tests/circuitpython/getenv.py | 2 ++ tests/circuitpython/getenv.py.exp | 1 + 2 files changed, 3 insertions(+) diff --git a/tests/circuitpython/getenv.py b/tests/circuitpython/getenv.py index 68dd328cfb..f01189a551 100644 --- a/tests/circuitpython/getenv.py +++ b/tests/circuitpython/getenv.py @@ -72,6 +72,8 @@ def run_test(key, content): print(key, str(e)) +run_test("key", b"") + for i in range(13): run_test(f"key{i}", content_good) diff --git a/tests/circuitpython/getenv.py.exp b/tests/circuitpython/getenv.py.exp index ba1b1b3f90..925dafb469 100644 --- a/tests/circuitpython/getenv.py.exp +++ b/tests/circuitpython/getenv.py.exp @@ -1,3 +1,4 @@ +key None key0 'hello world' key1 7 key2 '\n' From 6dab35e0766fd2f0b9e2aceea9940dd7cfc82057 Mon Sep 17 00:00:00 2001 From: Marco van der Kolk Date: Sat, 8 Jul 2023 15:21:58 +0200 Subject: [PATCH 1243/1712] Assign key_count to MP_ROM_NONE on deinit (for gc) Signed-off-by: Marco van der Kolk --- shared-module/keypad/ShiftRegisterKeys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-module/keypad/ShiftRegisterKeys.c b/shared-module/keypad/ShiftRegisterKeys.c index ae5fa35636..44a7e3323a 100644 --- a/shared-module/keypad/ShiftRegisterKeys.c +++ b/shared-module/keypad/ShiftRegisterKeys.c @@ -116,6 +116,7 @@ void common_hal_keypad_shiftregisterkeys_deinit(keypad_shiftregisterkeys_obj_t * common_hal_digitalio_digitalinout_deinit(self->data_pins->items[key]); } self->data_pins = MP_ROM_NONE; + self->key_counts = MP_ROM_NONE; common_hal_keypad_deinit_core(self); } @@ -125,8 +126,7 @@ size_t shiftregisterkeys_get_key_count(void *self_in) { size_t total = 0; - for (mp_uint_t i = 0; i < self->num_key_counts; i++) - { + for (mp_uint_t i = 0; i < self->num_key_counts; i++) { total += self->key_counts[i]; } From 8704ba158b7b409e037613efb0ab70f2cedcdc1a Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+microdev1@users.noreply.github.com> Date: Sun, 9 Jul 2023 21:25:37 +0530 Subject: [PATCH 1244/1712] fix set hostname --- ports/raspberrypi/common-hal/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index e17b35d108..8571d490c4 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -88,7 +88,7 @@ mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self) { void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *hostname) { assert(strlen(hostname) < MP_ARRAY_SIZE(self->hostname)); - memcpy(self->hostname, hostname, strlen(hostname)); + strncpy(self->hostname, hostname, MP_ARRAY_SIZE(self->hostname) - 1); netif_set_hostname(NETIF_STA, self->hostname); netif_set_hostname(NETIF_AP, self->hostname); } From 21d08646e153763b5567ffa56a0c8a153fe37a7a Mon Sep 17 00:00:00 2001 From: Marco van der Kolk Date: Mon, 10 Jul 2023 12:04:26 +0200 Subject: [PATCH 1245/1712] updated documentation --- shared-bindings/keypad/ShiftRegisterKeys.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/shared-bindings/keypad/ShiftRegisterKeys.c b/shared-bindings/keypad/ShiftRegisterKeys.c index 73e3264ac4..8765e04c1e 100644 --- a/shared-bindings/keypad/ShiftRegisterKeys.c +++ b/shared-bindings/keypad/ShiftRegisterKeys.c @@ -41,10 +41,10 @@ //| self, //| *, //| clock: microcontroller.Pin, -//| data: microcontroller.Pin, +//| data: Union[microcontroller.Pin, List[microcontroller.Pin]], //| latch: microcontroller.Pin, //| value_to_latch: bool = True, -//| key_count: int, +//| key_count: Union[int, List[int]] //| value_when_pressed: bool, //| interval: float = 0.020, //| max_events: int = 64 @@ -56,13 +56,14 @@ //| //| Key number 0 is the first (or more properly, the zero-th) bit read. In the //| 74HC165, this bit is labeled ``Q7``. Key number 1 will be the value of ``Q6``, etc. +//| When specifying multiple data pins, the key numbers are sequential. +//| So with two data Pins in parallel and key_count[0] = 32, the keys of data[1] will start with 32. //| //| An `EventQueue` is created when this object is created and is available in the `events` attribute. //| //| :param microcontroller.Pin clock: The shift register clock pin. //| The shift register should clock on a low-to-high transition. -//| :param microcontroller.Pin data: the incoming shift register data pin -//| :param Sequence[microcontroller.Pin] data: a list of incoming shift register data pins +//| :param Union[microcontroller.Pin, List[microcontroller.Pin]] data: the incoming shift register data pin(s) //| :param microcontroller.Pin latch: //| Pin used to latch parallel data going into the shift register. //| :param bool value_to_latch: Pin state to latch data being read. @@ -70,8 +71,7 @@ //| ``False`` if the data is latched when ``latch`` goes low. //| The default is ``True``, which is how the 74HC165 operates. The CD4021 latch is the opposite. //| Once the data is latched, it will be shifted out by toggling the clock pin. -//| :param int key_count: number of data lines to clock in -//| :param Sequence[int] key_count: a list of key_counts equal sized to data pins +//| :param Union[int, List[int]] key_count: number of data lines to clock in (per data pin) //| :param bool value_when_pressed: ``True`` if the pin reads high when the key is pressed. //| ``False`` if the pin reads low (is grounded) when the key is pressed. //| :param float interval: Scan keys no more often than ``interval`` to allow for debouncing. @@ -84,7 +84,7 @@ //| ... STATIC mp_obj_t keypad_shiftregisterkeys_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - #if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS +#if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS keypad_shiftregisterkeys_obj_t *self = m_new_obj(keypad_shiftregisterkeys_obj_t); self->base.type = &keypad_shiftregisterkeys_type; enum { ARG_clock, ARG_data, ARG_latch, ARG_value_to_latch, ARG_key_count, ARG_value_when_pressed, ARG_interval, ARG_max_events }; @@ -159,9 +159,9 @@ STATIC mp_obj_t keypad_shiftregisterkeys_make_new(const mp_obj_type_t *type, siz return MP_OBJ_FROM_PTR(self); - #else +#else mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_ShiftRegisterKeys); - #endif +#endif } #if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS @@ -225,7 +225,7 @@ const mp_obj_type_t keypad_shiftregisterkeys_type = { { &mp_type_type }, .name = MP_QSTR_ShiftRegisterKeys, .make_new = keypad_shiftregisterkeys_make_new, - #if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS +#if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS .locals_dict = (mp_obj_t)&keypad_shiftregisterkeys_locals_dict, - #endif +#endif }; From 2860593425e356664af3910f3c7e5c0c312fcf49 Mon Sep 17 00:00:00 2001 From: kolkmvd Date: Mon, 10 Jul 2023 12:28:36 +0200 Subject: [PATCH 1246/1712] fixed missing comma --- shared-bindings/keypad/ShiftRegisterKeys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/keypad/ShiftRegisterKeys.c b/shared-bindings/keypad/ShiftRegisterKeys.c index 8765e04c1e..b96c7b0a50 100644 --- a/shared-bindings/keypad/ShiftRegisterKeys.c +++ b/shared-bindings/keypad/ShiftRegisterKeys.c @@ -44,7 +44,7 @@ //| data: Union[microcontroller.Pin, List[microcontroller.Pin]], //| latch: microcontroller.Pin, //| value_to_latch: bool = True, -//| key_count: Union[int, List[int]] +//| key_count: Union[int, List[int]], //| value_when_pressed: bool, //| interval: float = 0.020, //| max_events: int = 64 From 036eca8123a659a257b780e9af9a2823794d360e Mon Sep 17 00:00:00 2001 From: Leah Post Date: Thu, 6 Jul 2023 20:14:09 +0200 Subject: [PATCH 1247/1712] Add new board: splitkb.com's Liatris --- .../boards/splitkb_liatris/board.c | 29 ++++++++++ .../boards/splitkb_liatris/mpconfigboard.h | 14 +++++ .../boards/splitkb_liatris/mpconfigboard.mk | 9 +++ .../splitkb_liatris/pico-sdk-configboard.h | 1 + .../raspberrypi/boards/splitkb_liatris/pins.c | 55 +++++++++++++++++++ 5 files changed, 108 insertions(+) create mode 100644 ports/raspberrypi/boards/splitkb_liatris/board.c create mode 100644 ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/splitkb_liatris/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/splitkb_liatris/pins.c diff --git a/ports/raspberrypi/boards/splitkb_liatris/board.c b/ports/raspberrypi/boards/splitkb_liatris/board.c new file mode 100644 index 0000000000..7d8b03d5f4 --- /dev/null +++ b/ports/raspberrypi/boards/splitkb_liatris/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 Conor Burns 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.h b/ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.h new file mode 100644 index 0000000000..a38b4a5550 --- /dev/null +++ b/ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "splitkb.com Liatris" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO25) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO22) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO23) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.mk b/ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.mk new file mode 100644 index 0000000000..9ce0b7b925 --- /dev/null +++ b/ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x2E8A +USB_PID = 0x1060 +USB_PRODUCT = "Liatris" +USB_MANUFACTURER = "splitkb.com" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q128JVxQ" diff --git a/ports/raspberrypi/boards/splitkb_liatris/pico-sdk-configboard.h b/ports/raspberrypi/boards/splitkb_liatris/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/splitkb_liatris/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/splitkb_liatris/pins.c b/ports/raspberrypi/boards/splitkb_liatris/pins.c new file mode 100644 index 0000000000..8086ee7fb9 --- /dev/null +++ b/ports/raspberrypi/boards/splitkb_liatris/pins.c @@ -0,0 +1,55 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // Left, top->bottom + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D4), 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_D7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + + // Right, top->bottom + { MP_ROM_QSTR(MP_QSTR_D29), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_D28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + // Bottom, left->right + { 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_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + // Internals + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_POWER_LED), MP_ROM_PTR(&pin_GPIO24) }, + + { 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_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From cf67cfa707289f1e4d38a45d5b9fe23c548c6fb3 Mon Sep 17 00:00:00 2001 From: Luc Date: Sun, 9 Jul 2023 14:29:28 +0000 Subject: [PATCH 1248/1712] Translated using Weblate (German) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/de/ --- locale/de_DE.po | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/locale/de_DE.po b/locale/de_DE.po index b4b6af060c..df78415721 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -6,14 +6,14 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-06-02 20:48+0000\n" -"Last-Translator: Ettore Atalan \n" +"PO-Revision-Date: 2023-07-10 14:50+0000\n" +"Last-Translator: Luc \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.18-dev\n" +"X-Generator: Weblate 5.0-dev\n" #: main.c msgid "" @@ -216,7 +216,7 @@ msgstr "%q muss ein Array vom Typ 'H' sein" #: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" -msgstr "" +msgstr "%q muss ein Array vom Typ 'h' sein" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c @@ -2481,7 +2481,7 @@ msgstr "Knopf A wurde beim Starten gedrückt." #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" -msgstr "Der BOOT-Knopf wurde beim Starten gedrückt." +msgstr "Der BOOT-Knopf wurde beim Starten gedrückt" #: ports/espressif/boards/adafruit_huzzah32_breakout/mpconfigboard.h msgid "You pressed the GPIO0 button at start up." @@ -2683,7 +2683,7 @@ msgstr "Puffersegmente müssen gleich lang sein" #: py/modstruct.c shared-bindings/struct/__init__.c #: shared-module/struct/__init__.c msgid "buffer too small" -msgstr "Der Puffer ist zu klein" +msgstr "Puffer zu klein" #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "buffer too small for requested bytes" @@ -2720,7 +2720,7 @@ msgstr "kann nur bis zu 4 Parameter für die Xtensa assembly haben" #: extmod/ulab/code/ndarray.c msgid "can only specify one unknown dimension" -msgstr "" +msgstr "nur eine einzige unbekannte Dimension kann angegeben werden" #: py/objtype.c msgid "can't add special method to already-subclassed class" @@ -2883,7 +2883,7 @@ msgstr "Name %q kann nicht importiert werden" #: extmod/ulab/code/ndarray.c msgid "cannot reshape array" -msgstr "" +msgstr "Array kann nicht umgeformt werden" #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" @@ -4068,7 +4068,7 @@ msgstr "nicht unterstützt" #: extmod/ulab/code/ndarray.c msgid "shape must be integer or tuple of integers" -msgstr "" +msgstr "Form muss eine Ganzzahl oder ein Tupel von Ganzzahlen sein" #: shared-module/msgpack/__init__.c msgid "short read" From 293f1e32c45857d36b54644b0cf566b8014f01a3 Mon Sep 17 00:00:00 2001 From: Jose David M Date: Sun, 9 Jul 2023 03:02:18 +0000 Subject: [PATCH 1249/1712] Translated using Weblate (Spanish) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/es.po b/locale/es.po index 6a158b4bca..7fe8ac2cb1 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-05-23 22:55+0000\n" +"PO-Revision-Date: 2023-07-10 14:50+0000\n" "Last-Translator: Jose David M \n" "Language-Team: \n" "Language: es\n" @@ -16,7 +16,7 @@ msgstr "" "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.18-dev\n" +"X-Generator: Weblate 5.0-dev\n" #: main.c msgid "" @@ -1213,7 +1213,7 @@ msgstr "La instruccion %d mueve mas bits que la cuenta del pin" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Instruction %d shifts out more bits than pin count" -msgstr "La instruccion %d mueve mas bits que la cuenta del pin" +msgstr "La instrucción %d mueve mas bits que la cuenta del pin" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format From 164fcb22c25f61a9578c70e2c631d500bd01f3af Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 28 Jun 2023 09:59:57 -0500 Subject: [PATCH 1250/1712] Enable "from __future__ import annotations" on unix build --- .../unix/variants/coverage/mpconfigvariant.mk | 2 ++ tests/unix/extra_coverage.py.exp | 32 +++++++++---------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/ports/unix/variants/coverage/mpconfigvariant.mk b/ports/unix/variants/coverage/mpconfigvariant.mk index f63054bdd6..9289e9cb4d 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.mk +++ b/ports/unix/variants/coverage/mpconfigvariant.mk @@ -28,6 +28,7 @@ $(BUILD)/lib/quirc/lib/%.o: CFLAGS += -Wno-shadow -Wno-sign-compare -include sha SRC_BITMAP := \ shared/runtime/context_manager_helpers.c \ displayio_min.c \ + shared-bindings/__future__/__init__.c \ shared-bindings/aesio/aes.c \ shared-bindings/aesio/__init__.c \ shared-bindings/audiocore/__init__.c \ @@ -85,6 +86,7 @@ CFLAGS += \ -DCIRCUITPY_AUDIOCORE_DEBUG=1 \ -DCIRCUITPY_BITMAPTOOLS=1 \ -DCIRCUITPY_DISPLAYIO_UNIX=1 \ + -DCIRCUITPY_FUTURE=1 \ -DCIRCUITPY_GIFIO=1 \ -DCIRCUITPY_OS_GETENV=1 \ -DCIRCUITPY_RAINBOWIO=1 \ diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index c750ca0e95..0711da6a22 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -29,22 +29,22 @@ RuntimeError: ame__ mport -builtins micropython _asyncio _thread -_uasyncio aesio array audiocore -audiomixer binascii bitmaptools btree -cexample cmath collections cppexample -displayio errno ffi framebuf -gc hashlib json math -qrio rainbowio re struct -synthio sys termios traceback -ubinascii uctypes uerrno uheapq -uio ujson ulab ulab.numpy -ulab.numpy.fft ulab.numpy.linalg ulab.scipy -ulab.scipy.linalg ulab.scipy.optimize -ulab.scipy.signal ulab.scipy.special -ulab.utils uos urandom ure -uselect utime utimeq uzlib -zlib +builtins micropython __future__ _asyncio +_thread _uasyncio aesio array +audiocore audiomixer binascii bitmaptools +btree cexample cmath collections +cppexample displayio errno ffi +framebuf gc hashlib json +math qrio rainbowio re +struct synthio sys termios +traceback ubinascii uctypes uerrno +uheapq uio ujson ulab +ulab.numpy ulab.numpy.fft ulab.numpy.linalg +ulab.scipy ulab.scipy.linalg +ulab.scipy.optimize ulab.scipy.signal +ulab.scipy.special ulab.utils uos +urandom ure uselect utime +utimeq uzlib zlib ime utime utimeq From f8edecf473198bcdb3bd5e2665a196e2540c2525 Mon Sep 17 00:00:00 2001 From: Marco van der Kolk Date: Mon, 10 Jul 2023 22:16:22 +0200 Subject: [PATCH 1251/1712] corrected formatting --- shared-bindings/keypad/ShiftRegisterKeys.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/shared-bindings/keypad/ShiftRegisterKeys.c b/shared-bindings/keypad/ShiftRegisterKeys.c index b96c7b0a50..3d1a8d6842 100644 --- a/shared-bindings/keypad/ShiftRegisterKeys.c +++ b/shared-bindings/keypad/ShiftRegisterKeys.c @@ -84,7 +84,7 @@ //| ... STATIC mp_obj_t keypad_shiftregisterkeys_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { -#if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS + #if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS keypad_shiftregisterkeys_obj_t *self = m_new_obj(keypad_shiftregisterkeys_obj_t); self->base.type = &keypad_shiftregisterkeys_type; enum { ARG_clock, ARG_data, ARG_latch, ARG_value_to_latch, ARG_key_count, ARG_value_when_pressed, ARG_interval, ARG_max_events }; @@ -159,9 +159,9 @@ STATIC mp_obj_t keypad_shiftregisterkeys_make_new(const mp_obj_type_t *type, siz return MP_OBJ_FROM_PTR(self); -#else + #else mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_ShiftRegisterKeys); -#endif + #endif } #if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS @@ -225,7 +225,7 @@ const mp_obj_type_t keypad_shiftregisterkeys_type = { { &mp_type_type }, .name = MP_QSTR_ShiftRegisterKeys, .make_new = keypad_shiftregisterkeys_make_new, -#if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS + #if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS .locals_dict = (mp_obj_t)&keypad_shiftregisterkeys_locals_dict, -#endif + #endif }; From 2686beab36e73975cbb91d0cb87bda1e66a8c83c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 2 May 2023 12:13:54 -0700 Subject: [PATCH 1252/1712] Basic USB host support and keyboard workflow Connects up read, write and ctrl_transfer to TinyUSB. USB Host support is available on iMX RT and RP2040. Fixes #6527 (imx) and fixes #5986 (rp2). --- .gitmodules | 4 + lib/tinyusb | 2 +- locale/circuitpython.pot | 9 +- ports/mimxrt10xx/Makefile | 23 +- .../boards/imxrt1060_evk/mpconfigboard.h | 4 +- ports/mimxrt10xx/linking/common.ld | 7 + ports/raspberrypi/Makefile | 14 +- .../adafruit_feather_rp2040_usb_host/board.c | 14 + .../mpconfigboard.h | 5 + .../common-hal/rp2pio/StateMachine.h | 2 + ports/raspberrypi/common-hal/usb_host/Port.c | 165 ++++++++++++ ports/raspberrypi/common-hal/usb_host/Port.h | 38 +++ .../common-hal/usb_host/__init__.c | 27 ++ ports/raspberrypi/lib/Pico-PIO-USB | 1 + ports/raspberrypi/link.ld | 7 +- ports/raspberrypi/mpconfigport.h | 11 + ports/raspberrypi/mpconfigport.mk | 1 + ports/raspberrypi/supervisor/port.c | 7 +- py/circuitpy_mpconfig.mk | 3 + shared-bindings/usb/core/Device.c | 30 ++- shared-bindings/usb/core/Device.h | 5 +- shared-bindings/usb/core/__init__.c | 13 +- shared-module/usb/core/Device.c | 192 +++++++++++--- shared-module/usb/core/Device.h | 2 + supervisor/shared/background_callback.c | 6 +- supervisor/shared/serial.c | 12 + supervisor/shared/usb/host_keyboard.c | 241 ++++++++++++++++++ supervisor/shared/usb/tusb_config.h | 8 +- supervisor/shared/usb/usb.c | 5 +- supervisor/shared/workflow.c | 3 + supervisor/supervisor.mk | 2 + supervisor/usb.h | 10 + 32 files changed, 811 insertions(+), 62 deletions(-) create mode 100644 ports/raspberrypi/common-hal/usb_host/Port.c create mode 100644 ports/raspberrypi/common-hal/usb_host/Port.h create mode 100644 ports/raspberrypi/common-hal/usb_host/__init__.c create mode 160000 ports/raspberrypi/lib/Pico-PIO-USB create mode 100644 supervisor/shared/usb/host_keyboard.c diff --git a/.gitmodules b/.gitmodules index 91afffe6a6..5c29c41b9f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -341,3 +341,7 @@ [submodule "frozen/Adafruit_CircuitPython_Wave"] path = frozen/Adafruit_CircuitPython_Wave url = http://github.com/adafruit/Adafruit_CircuitPython_Wave.git +[submodule "ports/raspberrypi/lib/Pico-PIO-USB"] + path = ports/raspberrypi/lib/Pico-PIO-USB + url = https://github.com/sekigon-gonnoc/Pico-PIO-USB.git + branch = main diff --git a/lib/tinyusb b/lib/tinyusb index e3b3229d61..f1e006d09b 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit e3b3229d61676585879c81d5f2e3393a2a1f1b16 +Subproject commit f1e006d09bd32088ab421d0b519eb89c531eda4e diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 282d229856..368836a4db 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -471,12 +471,17 @@ msgstr "" msgid "All channels in use" msgstr "" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "" @@ -1950,10 +1955,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index c591cf189e..24e3c59b13 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -229,12 +229,19 @@ include $(TOP)/py/mkrules.mk print-%: @echo $* = $($*) -ifeq ($(CHIP_FAMILY), MIMXRT1062) -PYOCD_TARGET = mimxrt1060 -endif +# Flash using jlink +define jlink_script +halt +loadfile $^ +r +go +exit +endef +export jlink_script -# Flash using pyocd -PYOCD_OPTION ?= -flash: $(BUILD)/firmware.hex - pyocd flash -t $(PYOCD_TARGET) $(PYOCD_OPTION) $< - pyocd reset -t $(PYOCD_TARGET) +JLINKEXE = JLinkExe +flash-jlink: $(BUILD)/firmware.elf + @echo "$$jlink_script" > $(BUILD)/firmware.jlink + $(JLINKEXE) -device $(CHIP_FAMILY)xxx5A -if swd -JTAGConf -1,-1 -speed auto -CommandFile $(BUILD)/firmware.jlink + +flash: flash-jlink diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.h b/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.h index 3b63172328..23058e6952 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.h +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/mpconfigboard.h @@ -21,5 +21,5 @@ // Put host on the first USB so that right angle OTG adapters can fit. This is // the right port when looking at the board. -#define CIRCUITPY_USB_DEVICE_INSTANCE 1 -#define CIRCUITPY_USB_HOST_INSTANCE 0 +#define CIRCUITPY_USB_DEVICE_INSTANCE 0 +#define CIRCUITPY_USB_HOST_INSTANCE 1 diff --git a/ports/mimxrt10xx/linking/common.ld b/ports/mimxrt10xx/linking/common.ld index a3ed2dbdbf..71e2c457c3 100644 --- a/ports/mimxrt10xx/linking/common.ld +++ b/ports/mimxrt10xx/linking/common.ld @@ -72,6 +72,7 @@ SECTIONS *(EXCLUDE_FILE( *fsl_flexspi.o *dcd_ci_hs.o + *ehci.o *tusb_fifo.o *usbd.o *string0.o @@ -88,6 +89,11 @@ SECTIONS We try to only keep USB interrupt related functions. */ *dcd_ci_hs.o(.text.process_*_request .text.dcd_edpt* .text.dcd_init .text.dcd_set_address) *usbd.o(.text.process_*_request .text.process_[gs]et* .text.tud_* .text.usbd_* .text.configuration_reset .text.invoke_*) + *ehci.o(.text.hcd_edpt* .text.hcd_setup* .text.ehci_init* .text.hcd_port* .text.hcd_device* .text.qtd_init* .text.list_remove*) + + /* Less critical portions of the runtime. */ + *runtime.o(.text.mp_import* .text.mp_resume* .text.mp_make_raise* .text.mp_init) + *gc.o(.text.gc_never_free .text.gc_make_long_lived) /* Anything marked cold/unlikely should be in flash. */ *(.text.unlikely.*) @@ -146,6 +152,7 @@ SECTIONS *(.itcm.*) *fsl_flexspi.o(.text*) *dcd_ci_hs.o(.text*) + *ehci.o(.text*) *tusb_fifo.o(.text*) *py/objboundmeth.o(.text*) *py/objtype.o(.text*) diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 7eb67b77ba..f635750415 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -148,7 +148,7 @@ INC += \ CFLAGS += -DRASPBERRYPI -DPICO_ON_DEVICE=1 -DPICO_NO_BINARY_INFO=0 -DPICO_TIME_DEFAULT_ALARM_POOL_DISABLED=0 -DPICO_DIVIDER_CALL_IDIV0=0 -DPICO_DIVIDER_CALL_LDIV0=0 -DPICO_DIVIDER_HARDWARE=1 -DPICO_DOUBLE_ROM=1 -DPICO_FLOAT_ROM=1 -DPICO_MULTICORE=1 -DPICO_BITS_IN_RAM=0 -DPICO_DIVIDER_IN_RAM=0 -DPICO_DOUBLE_PROPAGATE_NANS=0 -DPICO_DOUBLE_IN_RAM=0 -DPICO_MEM_IN_RAM=0 -DPICO_FLOAT_IN_RAM=0 -DPICO_FLOAT_PROPAGATE_NANS=1 -DPICO_NO_FLASH=0 -DPICO_COPY_TO_RAM=0 -DPICO_DISABLE_SHARED_IRQ_HANDLERS=0 -DPICO_NO_BI_BOOTSEL_VIA_DOUBLE_RESET=0 -DDVI_1BPP_BIT_REVERSE=0 OPTIMIZATION_FLAGS ?= -O3 # TinyUSB defines -CFLAGS += -DTUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX=1 -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 +CFLAGS += -DCFG_TUSB_OS=OPT_OS_PICO -DTUD_OPT_RP2040_USB_DEVICE_ENUMERATION_FIX=1 -DCFG_TUSB_MCU=OPT_MCU_RP2040 -DCFG_TUD_MIDI_RX_BUFSIZE=128 -DCFG_TUD_CDC_RX_BUFSIZE=256 -DCFG_TUD_MIDI_TX_BUFSIZE=128 -DCFG_TUD_CDC_TX_BUFSIZE=256 -DCFG_TUD_MSC_BUFSIZE=1024 # option to override default optimization level, set in boards/$(BOARD)/mpconfigboard.mk CFLAGS += $(OPTIMIZATION_FLAGS) @@ -258,6 +258,18 @@ SRC_C += \ $(SRC_CYW43) \ $(SRC_LWIP) \ + +ifeq ($(CIRCUITPY_USB_HOST), 1) +SRC_C += \ + lib/tinyusb/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c \ + lib/Pico-PIO-USB/src/pio_usb.c \ + lib/Pico-PIO-USB/src/pio_usb_host.c \ + lib/Pico-PIO-USB/src/usb_crc.c \ + +INC += \ + -isystem lib/Pico-PIO-USB/src +endif + ifeq ($(CIRCUITPY_PICODVI),1) SRC_C += \ bindings/picodvi/__init__.c \ diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/board.c b/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/board.c index 331653173e..724fde1d27 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/board.c +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/board.c @@ -26,4 +26,18 @@ #include "supervisor/board.h" +#include "shared-bindings/digitalio/DigitalInOut.h" +#include "shared-bindings/usb_host/Port.h" + // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. + +usb_host_port_obj_t _host_port; +digitalio_digitalinout_obj_t _host_power; + +void board_init(void) { + common_hal_digitalio_digitalinout_construct(&_host_power, &pin_GPIO18); + common_hal_digitalio_digitalinout_never_reset(&_host_power); + common_hal_digitalio_digitalinout_switch_to_output(&_host_power, true, DRIVE_MODE_PUSH_PULL); + + common_hal_usb_host_port_construct(&_host_port, &pin_GPIO16, &pin_GPIO17); +} diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h b/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h index f300bfe711..ba62bca2cb 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h @@ -12,3 +12,8 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO1) #define DEFAULT_UART_BUS_TX (&pin_GPIO0) + +#define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX +#define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX + +#define CIRCUITPY_USB_HOST_INSTANCE 1 diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.h b/ports/raspberrypi/common-hal/rp2pio/StateMachine.h index 71f85b1f11..f2d642bbad 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.h +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.h @@ -98,6 +98,8 @@ void rp2pio_statemachine_dma_complete(rp2pio_statemachine_obj_t *self, int chann void rp2pio_statemachine_reset_ok(PIO pio, int sm); void rp2pio_statemachine_never_reset(PIO pio, int sm); +uint8_t rp2pio_statemachine_find_pio(int program_size, int sm_count); + extern const mp_obj_type_t rp2pio_statemachine_type; #endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_RP2PIO_STATEMACHINE_H diff --git a/ports/raspberrypi/common-hal/usb_host/Port.c b/ports/raspberrypi/common-hal/usb_host/Port.c new file mode 100644 index 0000000000..9ad28c73ea --- /dev/null +++ b/ports/raspberrypi/common-hal/usb_host/Port.c @@ -0,0 +1,165 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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 "bindings/rp2pio/StateMachine.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/microcontroller/Processor.h" +#include "shared-bindings/usb_host/Port.h" +#include "supervisor/usb.h" + +#include "src/common/pico_time/include/pico/time.h" +#include "src/rp2040/hardware_structs/include/hardware/structs/mpu.h" +#include "src/rp2_common/cmsis/stub/CMSIS/Device/RaspberryPi/RP2040/Include/RP2040.h" +#include "src/rp2_common/hardware_dma/include/hardware/dma.h" +#include "src/rp2_common/pico_multicore/include/pico/multicore.h" + +#include "py/runtime.h" + +#include "tusb.h" + +#include "lib/Pico-PIO-USB/src/pio_usb.h" +#include "lib/Pico-PIO-USB/src/pio_usb_configuration.h" + +#include "supervisor/serial.h" + +bool usb_host_init; + +STATIC PIO pio_instances[2] = {pio0, pio1}; +volatile bool _core1_ready = false; + +static void __not_in_flash_func(core1_main)(void) { + // The MPU is reset before this starts. + SysTick->LOAD = (uint32_t)((common_hal_mcu_processor_get_frequency() / 1000) - 1UL); + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | // Processor clock. + SysTick_CTRL_ENABLE_Msk; + + // Turn off flash access. After this, it will hard fault. Better than messing + // up CIRCUITPY. + MPU->CTRL = MPU_CTRL_PRIVDEFENA_Msk | MPU_CTRL_ENABLE_Msk; + MPU->RNR = 6; // 7 is used by pico-sdk stack protection. + MPU->RBAR = XIP_MAIN_BASE | MPU_RBAR_VALID_Msk; + MPU->RASR = MPU_RASR_XN_Msk | // Set execute never and everything else is restricted. + MPU_RASR_ENABLE_Msk | + (0x1b << MPU_RASR_SIZE_Pos); // Size is 0x10000000 which masks up to SRAM region. + MPU->RNR = 7; + + _core1_ready = true; + + while (true) { + pio_usb_host_frame(); + if (tuh_task_event_ready()) { + // Queue the tinyusb background task. + usb_background_schedule(); + } + // Wait for systick to reload. + while ((SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk) == 0) { + } + } +} + +STATIC uint8_t _sm_free_count(uint8_t pio_index) { + PIO pio = pio_instances[pio_index]; + uint8_t free_count = 0; + for (size_t j = 0; j < NUM_PIO_STATE_MACHINES; j++) { + if (!pio_sm_is_claimed(pio, j)) { + free_count++; + } + } + return free_count; +} + +STATIC bool _has_program_room(uint8_t pio_index, uint8_t program_size) { + PIO pio = pio_instances[pio_index]; + pio_program_t program_struct = { + .instructions = NULL, + .length = program_size, + .origin = -1 + }; + return pio_can_add_program(pio, &program_struct); +} + +void common_hal_usb_host_port_construct(usb_host_port_obj_t *self, const mcu_pin_obj_t *dp, const mcu_pin_obj_t *dm) { + if (dp->number + 1 != dm->number) { + raise_ValueError_invalid_pins(); + } + pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG; + pio_cfg.skip_alarm_pool = true; + pio_cfg.pin_dp = dp->number; + pio_cfg.pio_tx_num = 0; + pio_cfg.pio_rx_num = 1; + // PIO with room for 22 instructions + // PIO with room for 31 instructions and two free SM. + if (!_has_program_room(pio_cfg.pio_tx_num, 22) || _sm_free_count(pio_cfg.pio_tx_num) < 1 || + !_has_program_room(pio_cfg.pio_rx_num, 31) || _sm_free_count(pio_cfg.pio_rx_num) < 2) { + mp_raise_RuntimeError(translate("All state machines in use")); + } + pio_cfg.tx_ch = dma_claim_unused_channel(false); // DMA channel + if (pio_cfg.tx_ch < 0) { + mp_raise_RuntimeError(translate("All dma channels in use")); + } + + PIO tx_pio = pio_instances[pio_cfg.pio_tx_num]; + pio_cfg.sm_tx = pio_claim_unused_sm(tx_pio, false); + PIO rx_pio = pio_instances[pio_cfg.pio_rx_num]; + pio_cfg.sm_rx = pio_claim_unused_sm(rx_pio, false); + pio_cfg.sm_eop = pio_claim_unused_sm(rx_pio, false); + + // Unclaim everything so that the library can. + dma_channel_unclaim(pio_cfg.tx_ch); + pio_sm_unclaim(tx_pio, pio_cfg.sm_tx); + pio_sm_unclaim(rx_pio, pio_cfg.sm_rx); + pio_sm_unclaim(rx_pio, pio_cfg.sm_eop); + + // Set all of the state machines to never reset. + rp2pio_statemachine_never_reset(tx_pio, pio_cfg.sm_tx); + rp2pio_statemachine_never_reset(rx_pio, pio_cfg.sm_rx); + rp2pio_statemachine_never_reset(rx_pio, pio_cfg.sm_eop); + + common_hal_never_reset_pin(dp); + common_hal_never_reset_pin(dm); + + // Core 1 will run the SOF interrupt directly. + _core1_ready = false; + multicore_launch_core1(core1_main); + while (!_core1_ready) { + } + + tuh_configure(TUH_OPT_RHPORT, TUH_CFGID_RPI_PIO_USB_CONFIGURATION, &pio_cfg); + tuh_init(TUH_OPT_RHPORT); + + self->init = true; + usb_host_init = true; +} + +void common_hal_usb_host_port_deinit(usb_host_port_obj_t *self) { + self->init = false; + usb_host_init = false; +} + +bool common_hal_usb_host_port_deinited(usb_host_port_obj_t *self) { + return !self->init; +} diff --git a/ports/raspberrypi/common-hal/usb_host/Port.h b/ports/raspberrypi/common-hal/usb_host/Port.h new file mode 100644 index 0000000000..c9294debb2 --- /dev/null +++ b/ports/raspberrypi/common-hal/usb_host/Port.h @@ -0,0 +1,38 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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. + */ + +#pragma once + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + bool init; +} usb_host_port_obj_t; + +// Cheater state so that the usb module knows if it should return the TinyUSB +// state. +extern bool usb_host_init; diff --git a/ports/raspberrypi/common-hal/usb_host/__init__.c b/ports/raspberrypi/common-hal/usb_host/__init__.c new file mode 100644 index 0000000000..3b54bd6a5d --- /dev/null +++ b/ports/raspberrypi/common-hal/usb_host/__init__.c @@ -0,0 +1,27 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +// Nothing diff --git a/ports/raspberrypi/lib/Pico-PIO-USB b/ports/raspberrypi/lib/Pico-PIO-USB new file mode 160000 index 0000000000..5a7aa8d4e7 --- /dev/null +++ b/ports/raspberrypi/lib/Pico-PIO-USB @@ -0,0 +1 @@ +Subproject commit 5a7aa8d4e78f9a50e4fb9defcf3488b3fc44aff1 diff --git a/ports/raspberrypi/link.ld b/ports/raspberrypi/link.ld index 1e758f61bf..0e584c94ac 100644 --- a/ports/raspberrypi/link.ld +++ b/ports/raspberrypi/link.ld @@ -80,7 +80,9 @@ SECTIONS *(.property_getset) __property_getset_end = .; - *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a: *interp.o *divider.o) .text*) + *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a: *interp.o *divider.o *tusb_fifo.o *mem_ops_aeabi.o *usbh.o) .text*) + /* Allow everything in usbh.o except tuh_task_event_ready because we read it from core 1. */ + *usbh.o (.text.[_uphc]* .text.tuh_[cmvied]* .text.tuh_task_ext*) *(.fini) /* Pull all c'tors into .text */ *crtbegin.o(.ctors) @@ -169,7 +171,7 @@ SECTIONS . = ALIGN(4); /* init data */ PROVIDE_HIDDEN (__init_array_start = .); - KEEP(*(SORT(.init_array.*))) + KEEP(*(SORT(.init_array*))) KEEP(*(.init_array)) PROVIDE_HIDDEN (__init_array_end = .); @@ -248,6 +250,7 @@ SECTIONS __scratch_x_start__ = .; *(.scratch_x.*) *tmds_encode.o (.time_critical*) + *timer.o (.text.hardware_alarm_irq_handler) . = ALIGN(4); __scratch_x_end__ = .; } > SCRATCH_X AT > FLASH_FIRMWARE diff --git a/ports/raspberrypi/mpconfigport.h b/ports/raspberrypi/mpconfigport.h index a2eb9a15ef..4458107974 100644 --- a/ports/raspberrypi/mpconfigport.h +++ b/ports/raspberrypi/mpconfigport.h @@ -48,6 +48,10 @@ #define CIRCUITPY_PROCESSOR_COUNT (2) +#if CIRCUITPY_USB_HOST +#define CIRCUITPY_USB_HOST_INSTANCE 1 +#endif + // This also includes mpconfigboard.h. #include "py/circuitpy_mpconfig.h" @@ -64,4 +68,11 @@ #define MICROPY_PY_LWIP_EXIT cyw43_arch_lwip_end(); #endif +// Protect the background queue with a lock because both cores may modify it. +#include "pico/critical_section.h" +extern critical_section_t background_queue_lock; +#define CALLBACK_CRITICAL_BEGIN (critical_section_enter_blocking(&background_queue_lock)) +#define CALLBACK_CRITICAL_END (critical_section_exit(&background_queue_lock)) + + #endif // __INCLUDED_MPCONFIGPORT_H diff --git a/ports/raspberrypi/mpconfigport.mk b/ports/raspberrypi/mpconfigport.mk index cdee964410..fdc2b0922a 100644 --- a/ports/raspberrypi/mpconfigport.mk +++ b/ports/raspberrypi/mpconfigport.mk @@ -20,6 +20,7 @@ CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_DISPLAYIO) CIRCUITPY_ROTARYIO ?= 1 CIRCUITPY_ROTARYIO_SOFTENCODER = 1 CIRCUITPY_SYNTHIO_MAX_CHANNELS = 12 +CIRCUITPY_USB_HOST ?= 1 # Things that need to be implemented. # Use PWM internally diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index 08a9d96c2e..9415d36aa6 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -76,6 +76,8 @@ #include "tusb.h" #include +critical_section_t background_queue_lock; + extern volatile bool mp_msc_enabled; STATIC void _tick_callback(uint alarm_num); @@ -128,6 +130,9 @@ safe_mode_t port_init(void) { (&_ld_dtcm_bss_start)[i] = 0; } + // Set up the critical section to protect the background task queue. + critical_section_init(&background_queue_lock); + #if CIRCUITPY_CYW43 never_reset_pin_number(23); never_reset_pin_number(24); @@ -299,7 +304,7 @@ void port_interrupt_after_ticks(uint32_t ticks) { void port_idle_until_interrupt(void) { common_hal_mcu_disable_interrupts(); - if (!background_callback_pending() && !tud_task_event_ready() && !_woken_up) { + if (!background_callback_pending() && !tud_task_event_ready() && !tuh_task_event_ready() && !_woken_up) { __DSB(); __WFI(); } diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 3e43909687..210c402c77 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -525,6 +525,9 @@ CFLAGS += -DCIRCUITPY_USB_HOST=$(CIRCUITPY_USB_HOST) CIRCUITPY_USB_IDENTIFICATION ?= $(CIRCUITPY_USB) CFLAGS += -DCIRCUITPY_USB_IDENTIFICATION=$(CIRCUITPY_USB_IDENTIFICATION) +CIRCUITPY_USB_KEYBOARD_WORKFLOW ?= $(CIRCUITPY_USB_HOST) +CFLAGS += -DCIRCUITPY_USB_KEYBOARD_WORKFLOW=$(CIRCUITPY_USB_KEYBOARD_WORKFLOW) + # MIDI is available by default, but is not turned on if there are fewer than 8 endpoints. CIRCUITPY_USB_MIDI ?= $(CIRCUITPY_USB) CFLAGS += -DCIRCUITPY_USB_MIDI=$(CIRCUITPY_USB_MIDI) diff --git a/shared-bindings/usb/core/Device.c b/shared-bindings/usb/core/Device.c index 40bb01dc08..d5525431a3 100644 --- a/shared-bindings/usb/core/Device.c +++ b/shared-bindings/usb/core/Device.c @@ -123,6 +123,30 @@ MP_DEFINE_CONST_FUN_OBJ_1(usb_core_device_get_manufacturer_obj, usb_core_device_ MP_PROPERTY_GETTER(usb_core_device_manufacturer_obj, (mp_obj_t)&usb_core_device_get_manufacturer_obj); +//| def set_configuration(self, configuration=None): +//| """Set the active configuration. +//| +//| The configuration parameter is the bConfigurationValue field of the +//| configuration you want to set as active. If you call this method +//| without parameter, it will use the first configuration found. As a +//| device hardly ever has more than one configuration, calling the method +//| without arguments is enough to get the device ready. +//| """ +//| ... +STATIC mp_obj_t usb_core_device_set_configuration(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_configuration }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_configuration, MP_ARG_INT, {.u_int = 0x100} }, + }; + usb_core_device_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + common_hal_usb_core_device_set_configuration(self, args[ARG_configuration].u_int); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_KW(usb_core_device_set_configuration_obj, 1, usb_core_device_set_configuration); + //| def write(self, endpoint: int, data: ReadableBuffer, timeout: Optional[int] = None) -> int: //| """Write data to a specific endpoint on the device. //| @@ -223,7 +247,10 @@ STATIC mp_obj_t usb_core_device_ctrl_transfer(size_t n_args, const mp_obj_t *pos mp_buffer_info_t bufinfo; // check request type - if ((args[ARG_bmRequestType].u_int & 0x80) != 0) { + if (args[ARG_data_or_wLength].u_obj == mp_const_none) { + bufinfo.len = 0; + bufinfo.buf = NULL; + } else if ((args[ARG_bmRequestType].u_int & 0x80) != 0) { mp_get_buffer_raise(args[ARG_data_or_wLength].u_obj, &bufinfo, MP_BUFFER_WRITE); } else { mp_get_buffer_raise(args[ARG_data_or_wLength].u_obj, &bufinfo, MP_BUFFER_READ); @@ -292,6 +319,7 @@ STATIC const mp_rom_map_elem_t usb_core_device_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_product), MP_ROM_PTR(&usb_core_device_product_obj) }, { MP_ROM_QSTR(MP_QSTR_manufacturer), MP_ROM_PTR(&usb_core_device_manufacturer_obj) }, + { MP_ROM_QSTR(MP_QSTR_set_configuration),MP_ROM_PTR(&usb_core_device_set_configuration_obj) }, { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&usb_core_device_write_obj) }, { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&usb_core_device_read_obj) }, { MP_ROM_QSTR(MP_QSTR_ctrl_transfer), MP_ROM_PTR(&usb_core_device_ctrl_transfer_obj) }, diff --git a/shared-bindings/usb/core/Device.h b/shared-bindings/usb/core/Device.h index c7086e99ff..c9de5d505f 100644 --- a/shared-bindings/usb/core/Device.h +++ b/shared-bindings/usb/core/Device.h @@ -39,8 +39,9 @@ uint16_t common_hal_usb_core_device_get_idProduct(usb_core_device_obj_t *self); mp_obj_t common_hal_usb_core_device_get_serial_number(usb_core_device_obj_t *self); mp_obj_t common_hal_usb_core_device_get_product(usb_core_device_obj_t *self); mp_obj_t common_hal_usb_core_device_get_manufacturer(usb_core_device_obj_t *self); -mp_obj_t common_hal_usb_core_device_write(usb_core_device_obj_t *self, mp_int_t endpoint, const uint8_t *buffer, mp_int_t len, mp_int_t timeout); -mp_obj_t common_hal_usb_core_device_read(usb_core_device_obj_t *self, mp_int_t endpoint, uint8_t *buffer, mp_int_t len, mp_int_t timeout); +void common_hal_usb_core_device_set_configuration(usb_core_device_obj_t *self, mp_int_t configuration); +mp_int_t common_hal_usb_core_device_write(usb_core_device_obj_t *self, mp_int_t endpoint, const uint8_t *buffer, mp_int_t len, mp_int_t timeout); +mp_int_t common_hal_usb_core_device_read(usb_core_device_obj_t *self, mp_int_t endpoint, uint8_t *buffer, mp_int_t len, mp_int_t timeout); mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self, mp_int_t bmRequestType, mp_int_t bRequest, mp_int_t wValue, mp_int_t wIndex, diff --git a/shared-bindings/usb/core/__init__.c b/shared-bindings/usb/core/__init__.c index faeef23a88..7c171e85d6 100644 --- a/shared-bindings/usb/core/__init__.c +++ b/shared-bindings/usb/core/__init__.c @@ -49,10 +49,15 @@ //| MP_DEFINE_USB_CORE_EXCEPTION(USBError, OSError) NORETURN void mp_raise_usb_core_USBError(const compressed_string_t *fmt, ...) { - va_list argptr; - va_start(argptr,fmt); - mp_obj_t exception = mp_obj_new_exception_msg_vlist(&mp_type_usb_core_USBError, fmt, argptr); - va_end(argptr); + mp_obj_t exception; + if (fmt == NULL) { + exception = mp_obj_new_exception(&mp_type_usb_core_USBError); + } else { + va_list argptr; + va_start(argptr,fmt); + exception = mp_obj_new_exception_msg_vlist(&mp_type_usb_core_USBError, fmt, argptr); + va_end(argptr); + } nlr_raise(exception); } diff --git a/shared-module/usb/core/Device.c b/shared-module/usb/core/Device.c index 706c94eec3..67756341ec 100644 --- a/shared-module/usb/core/Device.c +++ b/shared-module/usb/core/Device.c @@ -34,15 +34,30 @@ #include "shared-bindings/usb/core/__init__.h" #include "shared-module/usb/utf16le.h" #include "supervisor/shared/tick.h" +#include "supervisor/usb.h" +// Track what device numbers are mounted. We can't use tuh_ready() because it is +// true before enumeration completes and TinyUSB drivers are started. +STATIC size_t _mounted_devices = 0; + +void tuh_mount_cb(uint8_t dev_addr) { + _mounted_devices |= 1 << dev_addr; +} + +void tuh_umount_cb(uint8_t dev_addr) { + _mounted_devices &= ~(1 << dev_addr); +} + +STATIC xfer_result_t _xfer_result; bool common_hal_usb_core_device_construct(usb_core_device_obj_t *self, uint8_t device_number) { if (device_number == 0 || device_number > CFG_TUH_DEVICE_MAX + CFG_TUH_HUB) { return false; } - if (!tuh_ready(device_number)) { + if ((_mounted_devices & (1 << device_number)) == 0) { return false; } self->device_number = device_number; + _xfer_result = 0xff; return true; } @@ -60,19 +75,21 @@ uint16_t common_hal_usb_core_device_get_idProduct(usb_core_device_obj_t *self) { return pid; } -STATIC xfer_result_t _get_string_result; STATIC void _transfer_done_cb(tuh_xfer_t *xfer) { // Store the result so we stop waiting for the transfer. - _get_string_result = xfer->result; + _xfer_result = xfer->result; } -STATIC void _wait_for_callback(void) { +STATIC bool _wait_for_callback(void) { while (!mp_hal_is_interrupted() && - _get_string_result == 0xff) { + _xfer_result == 0xff) { // The background tasks include TinyUSB which will call the function // we provided above. In other words, the callback isn't in an interrupt. RUN_BACKGROUND_TASKS; } + xfer_result_t result = _xfer_result; + _xfer_result = 0xff; + return result == XFER_RESULT_SUCCESS; } STATIC mp_obj_t _get_string(const uint16_t *temp_buf) { @@ -84,46 +101,145 @@ STATIC mp_obj_t _get_string(const uint16_t *temp_buf) { } mp_obj_t common_hal_usb_core_device_get_serial_number(usb_core_device_obj_t *self) { - _get_string_result = 0xff; uint16_t temp_buf[127]; - if (!tuh_descriptor_get_serial_string(self->device_number, 0, temp_buf, MP_ARRAY_SIZE(temp_buf), _transfer_done_cb, 0)) { + if (!tuh_descriptor_get_serial_string(self->device_number, 0, temp_buf, MP_ARRAY_SIZE(temp_buf), _transfer_done_cb, 0) || + !_wait_for_callback()) { return mp_const_none; } - _wait_for_callback(); return _get_string(temp_buf); } mp_obj_t common_hal_usb_core_device_get_product(usb_core_device_obj_t *self) { - _get_string_result = 0xff; uint16_t temp_buf[127]; - if (!tuh_descriptor_get_product_string(self->device_number, 0, temp_buf, MP_ARRAY_SIZE(temp_buf), _transfer_done_cb, 0)) { + if (!tuh_descriptor_get_product_string(self->device_number, 0, temp_buf, MP_ARRAY_SIZE(temp_buf), _transfer_done_cb, 0) || + !_wait_for_callback()) { return mp_const_none; } - _wait_for_callback(); return _get_string(temp_buf); } mp_obj_t common_hal_usb_core_device_get_manufacturer(usb_core_device_obj_t *self) { - _get_string_result = 0xff; uint16_t temp_buf[127]; - if (!tuh_descriptor_get_manufacturer_string(self->device_number, 0, temp_buf, MP_ARRAY_SIZE(temp_buf), _transfer_done_cb, 0)) { + if (!tuh_descriptor_get_manufacturer_string(self->device_number, 0, temp_buf, MP_ARRAY_SIZE(temp_buf), _transfer_done_cb, 0) || + !_wait_for_callback()) { return mp_const_none; } - _wait_for_callback(); return _get_string(temp_buf); } -mp_obj_t common_hal_usb_core_device_write(usb_core_device_obj_t *self, mp_int_t endpoint, const uint8_t *buffer, mp_int_t len, mp_int_t timeout) { - return mp_const_none; +void common_hal_usb_core_device_set_configuration(usb_core_device_obj_t *self, mp_int_t configuration) { + if (configuration == 0x100) { + tusb_desc_configuration_t desc; + if (!tuh_descriptor_get_configuration(self->device_number, 0, &desc, sizeof(desc), _transfer_done_cb, 0) || + !_wait_for_callback()) { + return; + } + configuration = desc.bConfigurationValue; + } + tuh_configuration_set(self->device_number, configuration, _transfer_done_cb, 0); + _wait_for_callback(); } -mp_obj_t common_hal_usb_core_device_read(usb_core_device_obj_t *self, mp_int_t endpoint, uint8_t *buffer, mp_int_t len, mp_int_t timeout) { - return mp_const_none; +STATIC size_t _xfer(tuh_xfer_t *xfer, mp_int_t timeout) { + _xfer_result = 0xff; + xfer->complete_cb = _transfer_done_cb; + if (!tuh_edpt_xfer(xfer)) { + mp_raise_usb_core_USBError(NULL); + } + uint32_t start_time = supervisor_ticks_ms32(); + while ((timeout == 0 || supervisor_ticks_ms32() - start_time < (uint32_t)timeout) && + !mp_hal_is_interrupted() && + _xfer_result == 0xff) { + // The background tasks include TinyUSB which will call the function + // we provided above. In other words, the callback isn't in an interrupt. + RUN_BACKGROUND_TASKS; + } + if (mp_hal_is_interrupted()) { + return 0; + } + xfer_result_t result = _xfer_result; + _xfer_result = 0xff; + if (result == XFER_RESULT_STALLED || result == 0xff) { + mp_raise_usb_core_USBTimeoutError(); + } + if (result == XFER_RESULT_SUCCESS) { + return xfer->actual_len; + } + + return 0; } -xfer_result_t control_result; -STATIC void _control_complete_cb(tuh_xfer_t *xfer) { - control_result = xfer->result; +STATIC bool _open_endpoint(usb_core_device_obj_t *self, mp_int_t endpoint) { + bool endpoint_open = false; + size_t open_size = sizeof(self->open_endpoints); + size_t first_free = open_size; + for (size_t i = 0; i < open_size; i++) { + if (self->open_endpoints[i] == endpoint) { + endpoint_open = true; + } else if (first_free == open_size && self->open_endpoints[i] == 0) { + first_free = i; + } + } + if (endpoint_open) { + return true; + } + + // Fetch the full configuration descriptor and search for the endpoint's descriptor. + uint8_t desc_buf[128]; + if (!tuh_descriptor_get_configuration(self->device_number, self->configuration_index, &desc_buf, sizeof(desc_buf), _transfer_done_cb, 0) || + !_wait_for_callback()) { + return false; + } + tusb_desc_configuration_t *desc_cfg = (tusb_desc_configuration_t *)desc_buf; + + uint8_t const *desc_end = ((uint8_t const *)desc_cfg) + tu_le16toh(desc_cfg->wTotalLength); + uint8_t const *p_desc = tu_desc_next(desc_cfg); + + // parse each interfaces + while (p_desc < desc_end) { + if (TUSB_DESC_ENDPOINT == tu_desc_type(p_desc)) { + tusb_desc_endpoint_t const *desc_ep = (tusb_desc_endpoint_t const *)p_desc; + if (desc_ep->bEndpointAddress == endpoint) { + break; + } + } + + p_desc = tu_desc_next(p_desc); + } + if (p_desc >= desc_end) { + return false; + } + tusb_desc_endpoint_t const *desc_ep = (tusb_desc_endpoint_t const *)p_desc; + + bool open = tuh_edpt_open(self->device_number, desc_ep); + if (open) { + self->open_endpoints[first_free] = endpoint; + } + return open; +} + +mp_int_t common_hal_usb_core_device_write(usb_core_device_obj_t *self, mp_int_t endpoint, const uint8_t *buffer, mp_int_t len, mp_int_t timeout) { + if (!_open_endpoint(self, endpoint)) { + mp_raise_usb_core_USBError(NULL); + } + tuh_xfer_t xfer; + xfer.daddr = self->device_number; + xfer.ep_addr = endpoint; + xfer.buffer = (uint8_t *)buffer; + xfer.buflen = len; + return _xfer(&xfer, timeout); +} + +mp_int_t common_hal_usb_core_device_read(usb_core_device_obj_t *self, mp_int_t endpoint, uint8_t *buffer, mp_int_t len, mp_int_t timeout) { + if (!_open_endpoint(self, endpoint)) { + mp_raise_usb_core_USBError(NULL); + } + tuh_xfer_t xfer; + xfer.daddr = self->device_number; + xfer.ep_addr = endpoint; + xfer.buffer = buffer; + xfer.buflen = len; + return _xfer(&xfer, timeout); } mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self, @@ -144,27 +260,31 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self, .ep_addr = 0, .setup = &request, .buffer = buffer, - .complete_cb = _control_complete_cb, + .complete_cb = _transfer_done_cb, }; - control_result = XFER_RESULT_STALLED; + _xfer_result = 0xff; - bool result = tuh_control_xfer(&xfer); - if (!result) { + if (!tuh_control_xfer(&xfer)) { mp_raise_usb_core_USBError(NULL); } uint32_t start_time = supervisor_ticks_ms32(); - while (supervisor_ticks_ms32() - start_time < (uint32_t)timeout && + while ((timeout == 0 || supervisor_ticks_ms32() - start_time < (uint32_t)timeout) && !mp_hal_is_interrupted() && - control_result == XFER_RESULT_STALLED) { + _xfer_result == 0xff) { // The background tasks include TinyUSB which will call the function // we provided above. In other words, the callback isn't in an interrupt. RUN_BACKGROUND_TASKS; } - if (control_result == XFER_RESULT_STALLED) { + if (mp_hal_is_interrupted()) { + return 0; + } + xfer_result_t result = _xfer_result; + _xfer_result = 0xff; + if (result == XFER_RESULT_STALLED || result == 0xff) { mp_raise_usb_core_USBTimeoutError(); } - if (control_result == XFER_RESULT_SUCCESS) { + if (result == XFER_RESULT_SUCCESS) { return len; } @@ -172,14 +292,22 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self, } bool common_hal_usb_core_device_is_kernel_driver_active(usb_core_device_obj_t *self, mp_int_t interface) { - // TODO: Implement this when CP natively uses a keyboard. + #if CIRCUITPY_USB_KEYBOARD_WORKFLOW + if (usb_keyboard_in_use(self->device_number, interface)) { + return true; + } + #endif return false; } void common_hal_usb_core_device_detach_kernel_driver(usb_core_device_obj_t *self, mp_int_t interface) { - // TODO: Implement this when CP natively uses a keyboard. + #if CIRCUITPY_USB_KEYBOARD_WORKFLOW + usb_keyboard_detach(self->device_number, interface); + #endif } void common_hal_usb_core_device_attach_kernel_driver(usb_core_device_obj_t *self, mp_int_t interface) { - // TODO: Implement this when CP natively uses a keyboard. + #if CIRCUITPY_USB_KEYBOARD_WORKFLOW + usb_keyboard_attach(self->device_number, interface); + #endif } diff --git a/shared-module/usb/core/Device.h b/shared-module/usb/core/Device.h index 5959639fc8..bb32cb5766 100644 --- a/shared-module/usb/core/Device.h +++ b/shared-module/usb/core/Device.h @@ -32,6 +32,8 @@ typedef struct { mp_obj_base_t base; uint8_t device_number; + uint8_t configuration_index; // not number + uint8_t open_endpoints[8]; } usb_core_device_obj_t; #endif // MICROPY_INCLUDED_SHARED_MODULE_USB_CORE_DEVICE_H diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c index 80f70b528a..17fed37e22 100644 --- a/supervisor/shared/background_callback.c +++ b/supervisor/shared/background_callback.c @@ -36,10 +36,14 @@ STATIC volatile background_callback_t *volatile callback_head, *volatile callback_tail; +#ifndef CALLBACK_CRITICAL_BEGIN #define CALLBACK_CRITICAL_BEGIN (common_hal_mcu_disable_interrupts()) +#endif +#ifndef CALLBACK_CRITICAL_END #define CALLBACK_CRITICAL_END (common_hal_mcu_enable_interrupts()) +#endif -MP_WEAK void port_wake_main_task(void) { +MP_WEAK void PLACE_IN_ITCM(port_wake_main_task)(void) { } void PLACE_IN_ITCM(background_callback_add_core)(background_callback_t * cb) { diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index e683e8eb7c..7bf10ae530 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -238,6 +238,12 @@ char serial_read(void) { } #endif + #if CIRCUITPY_USB_KEYBOARD_WORKFLOW + if (usb_keyboard_chars_available() > 0) { + return usb_keyboard_read_char(); + } + #endif + if (port_serial_bytes_available() > 0) { return port_serial_read(); } @@ -279,6 +285,12 @@ bool serial_bytes_available(void) { } #endif + #if CIRCUITPY_USB_KEYBOARD_WORKFLOW + if (usb_keyboard_chars_available() > 0) { + return true; + } + #endif + #if CIRCUITPY_USB_CDC if (usb_cdc_console_enabled() && tud_cdc_available() > 0) { return true; diff --git a/supervisor/shared/usb/host_keyboard.c b/supervisor/shared/usb/host_keyboard.c new file mode 100644 index 0000000000..831914d87a --- /dev/null +++ b/supervisor/shared/usb/host_keyboard.c @@ -0,0 +1,241 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2023 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 "tusb.h" + +#include "py/ringbuf.h" +#include "py/runtime.h" +#include "shared/runtime/interrupt_char.h" +#include "supervisor/usb.h" + +// Buffer the incoming serial data in the background so that we can look for the +// interrupt character. +STATIC ringbuf_t _incoming_ringbuf; +STATIC uint8_t _buf[16]; + +uint8_t _dev_addr; +uint8_t _interface; + +#define FLAG_ALPHABETIC (1) +#define FLAG_SHIFT (2) +#define FLAG_NUMLOCK (4) +#define FLAG_CTRL (8) +#define FLAG_LUT (16) + +const char *const lut[] = { + "!@#$%^&*()", /* 0 - shifted numeric keys */ + "\r\x1b\10\t -=[]\\#;'`,./", /* 1 - symbol keys */ + "\n\x1b\177\t _+{}|~:\"~<>?", /* 2 - shifted */ + "\12\13\10\22", /* 3 - arrow keys RLDU */ + "/*-+\n1234567890.", /* 4 - keypad w/numlock */ + "/*-+\n\xff\2\xff\4\xff\3\xff\1\xff\xff.", /* 5 - keypad w/o numlock */ +}; + +struct keycode_mapper { + uint8_t first, last, code, flags; +} keycode_to_ascii[] = { + { HID_KEY_A, HID_KEY_Z, 'a', FLAG_ALPHABETIC, }, + + { HID_KEY_1, HID_KEY_9, 0, FLAG_SHIFT | FLAG_LUT, }, + { HID_KEY_1, HID_KEY_9, '1', 0, }, + { HID_KEY_0, HID_KEY_0, ')', FLAG_SHIFT, }, + { HID_KEY_0, HID_KEY_0, '0', 0, }, + + { HID_KEY_ENTER, HID_KEY_ENTER, '\n', FLAG_CTRL }, + { HID_KEY_ENTER, HID_KEY_SLASH, 2, FLAG_SHIFT | FLAG_LUT, }, + { HID_KEY_ENTER, HID_KEY_SLASH, 1, FLAG_LUT, }, + + { HID_KEY_F1, HID_KEY_F1, 0x1e, 0, }, // help key on xerox 820 kbd + + { HID_KEY_ARROW_RIGHT, HID_KEY_ARROW_UP, 3, FLAG_LUT }, + + { HID_KEY_KEYPAD_DIVIDE, HID_KEY_KEYPAD_DECIMAL, 4, FLAG_NUMLOCK | FLAG_LUT }, + { HID_KEY_KEYPAD_DIVIDE, HID_KEY_KEYPAD_DECIMAL, 5, FLAG_LUT }, +}; + +STATIC bool report_contains(const hid_keyboard_report_t *report, uint8_t key) { + for (int i = 0; i < 6; i++) { + if (report->keycode[i] == key) { + return true; + } + } + return false; +} + +int old_ascii = -1; +uint32_t repeat_timeout; +// this matches Linux default of 500ms to first repeat, 1/20s thereafter +const uint32_t default_repeat_time = 50; +const uint32_t initial_repeat_time = 500; + +STATIC void send_ascii(uint8_t code, uint32_t repeat_time) { + old_ascii = code; + // repeat_timeout = millis() + repeat_time; + if (code == mp_interrupt_char) { + mp_sched_keyboard_interrupt(); + return; + } + if (ringbuf_num_empty(&_incoming_ringbuf) == 0) { + // Drop on the floor + return; + } + ringbuf_put(&_incoming_ringbuf, code); +} + +hid_keyboard_report_t old_report; + +STATIC void process_event(uint8_t dev_addr, uint8_t instance, const hid_keyboard_report_t *report) { + bool alt = report->modifier & 0x44; + bool shift = report->modifier & 0x22; + bool ctrl = report->modifier & 0x11; + bool caps = old_report.reserved & 1; + bool num = old_report.reserved & 2; + uint8_t code = 0; + + if (report->keycode[0] == 1 && report->keycode[1] == 1) { + // keyboard says it has exceeded max kro + return; + } + + // something was pressed or release, so cancel any key repeat + old_ascii = -1; + + for (int i = 0; i < 6; i++) { + uint8_t keycode = report->keycode[i]; + if (keycode == 0) { + continue; + } + if (report_contains(&old_report, keycode)) { + continue; + } + + /* key is newly pressed */ + if (keycode == HID_KEY_NUM_LOCK) { + num = !num; + } else if (keycode == HID_KEY_CAPS_LOCK) { + caps = !caps; + } else { + for (size_t j = 0; j < MP_ARRAY_SIZE(keycode_to_ascii); j++) { + struct keycode_mapper *mapper = &keycode_to_ascii[j]; + if (!(keycode >= mapper->first && keycode <= mapper->last)) { + continue; + } + if (mapper->flags & FLAG_SHIFT && !shift) { + continue; + } + if (mapper->flags & FLAG_NUMLOCK && !num) { + continue; + } + if (mapper->flags & FLAG_CTRL && !ctrl) { + continue; + } + if (mapper->flags & FLAG_LUT) { + code = lut[mapper->code][keycode - mapper->first]; + } else { + code = keycode - mapper->first + mapper->code; + } + if (mapper->flags & FLAG_ALPHABETIC) { + if (shift ^ caps) { + code ^= ('a' ^ 'A'); + } + } + if (ctrl) { + code &= 0x1f; + } + if (alt) { + code ^= 0x80; + } + send_ascii(code, initial_repeat_time); + break; + } + } + } + + uint8_t leds = (caps | (num << 1)); + if (leds != old_report.reserved) { + tuh_hid_set_report(dev_addr, instance /*idx*/, 0 /*report_id*/, HID_REPORT_TYPE_OUTPUT /*report_type*/, &leds, sizeof(leds)); + } + old_report = *report; + old_report.reserved = leds; +} + +bool usb_keyboard_in_use(uint8_t dev_addr, uint8_t interface) { + return _dev_addr == dev_addr && _interface == interface; +} + +void usb_keyboard_detach(uint8_t dev_addr, uint8_t interface) { + if (!usb_keyboard_in_use(dev_addr, interface)) { + return; + } + _dev_addr = 0; + _interface = 0; +} + +void usb_keyboard_attach(uint8_t dev_addr, uint8_t interface) { + if (usb_keyboard_in_use(dev_addr, interface) || _dev_addr != 0) { + return; + } + uint8_t const itf_protocol = tuh_hid_interface_protocol(dev_addr, interface); + if (itf_protocol == HID_ITF_PROTOCOL_KEYBOARD) { + _dev_addr = dev_addr; + _interface = interface; + tuh_hid_receive_report(dev_addr, interface); + } +} + +void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t interface, uint8_t const *desc_report, uint16_t desc_len) { + usb_keyboard_attach(dev_addr, interface); +} + +void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t interface) { + usb_keyboard_detach(dev_addr, interface); +} + +void tuh_hid_report_received_cb(uint8_t dev_addr, uint8_t instance, uint8_t const *report, uint16_t len) { + if (len != sizeof(hid_keyboard_report_t)) { + return; + } else { + process_event(dev_addr, instance, (hid_keyboard_report_t *)report); + } + // continue to request to receive report + tuh_hid_receive_report(dev_addr, instance); +} + +void usb_keyboard_init(void) { + ringbuf_init(&_incoming_ringbuf, _buf, sizeof(_buf) - 1); +} + +bool usb_keyboard_chars_available(void) { + return ringbuf_num_filled(&_incoming_ringbuf) > 0; +} + +char usb_keyboard_read_char(void) { + if (ringbuf_num_filled(&_incoming_ringbuf) > 0) { + return ringbuf_get(&_incoming_ringbuf); + } + return -1; +} diff --git a/supervisor/shared/usb/tusb_config.h b/supervisor/shared/usb/tusb_config.h index c2ad1362a3..19f5c0a0ce 100644 --- a/supervisor/shared/usb/tusb_config.h +++ b/supervisor/shared/usb/tusb_config.h @@ -51,7 +51,7 @@ extern "C" { // When debugging TinyUSB, only output to the console UART link. #if CIRCUITPY_DEBUG_TINYUSB > 0 && defined(CIRCUITPY_CONSOLE_UART) #define CFG_TUSB_DEBUG CIRCUITPY_DEBUG_TINYUSB -#define CFG_TUSB_DEBUG_PRINTF debug_uart_printf +#define CFG_TUSB_DEBUG_PRINTF console_uart_printf #endif /*------------- RTOS -------------*/ @@ -127,6 +127,10 @@ extern "C" { // -------------------------------------------------------------------- #if CIRCUITPY_USB_HOST +#define CFG_TUH_ENABLED 1 + +// Always use PIO to do host on RP2. +#define CFG_TUH_RPI_PIO_USB 1 #if CIRCUITPY_USB_HOST_INSTANCE == 0 #if USB_HIGHSPEED @@ -147,10 +151,12 @@ extern "C" { #define CFG_TUH_ENUMERATION_BUFSIZE 256 #endif +#define CFG_TUH_HID 2 #define CFG_TUH_HUB 1 #define CFG_TUH_CDC 0 #define CFG_TUH_MSC 0 #define CFG_TUH_VENDOR 0 +#define CFG_TUH_API_EDPT_XFER 1 // max device support (excluding hub device) #define CFG_TUH_DEVICE_MAX (CFG_TUH_HUB ? 4 : 1) // hub typically has 4 ports diff --git a/supervisor/shared/usb/usb.c b/supervisor/shared/usb/usb.c index 133a97a99d..56c8b1897f 100644 --- a/supervisor/shared/usb/usb.c +++ b/supervisor/shared/usb/usb.c @@ -87,7 +87,8 @@ MP_WEAK void post_usb_init(void) { void usb_init(void) { init_usb_hardware(); - tusb_init(); + // Only init device. Host gets inited by the `usb_host` module common-hal. + tud_init(TUD_OPT_RHPORT); post_usb_init(); @@ -199,7 +200,7 @@ void usb_disconnect(void) { void usb_background(void) { if (usb_enabled()) { - #if CFG_TUSB_OS == OPT_OS_NONE + #if CFG_TUSB_OS == OPT_OS_NONE || CFG_TUSB_OS == OPT_OS_PICO tud_task(); #if CIRCUITPY_USB_HOST tuh_task(); diff --git a/supervisor/shared/workflow.c b/supervisor/shared/workflow.c index aebdcc821a..b4e7852b2a 100644 --- a/supervisor/shared/workflow.c +++ b/supervisor/shared/workflow.c @@ -112,6 +112,9 @@ void supervisor_workflow_start(void) { } #endif + #if CIRCUITPY_USB_KEYBOARD_WORKFLOW + usb_keyboard_init(); + #endif } FRESULT supervisor_workflow_mkdir_parents(FATFS *fs, char *path) { diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index c461c5353f..374edf1310 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -161,8 +161,10 @@ ifeq ($(CIRCUITPY_USB),1) ifeq ($(CIRCUITPY_USB_HOST), 1) SRC_SUPERVISOR += \ + lib/tinyusb/src/class/hid/hid_host.c \ lib/tinyusb/src/host/hub.c \ lib/tinyusb/src/host/usbh.c \ + supervisor/shared/usb/host_keyboard.c \ endif endif diff --git a/supervisor/usb.h b/supervisor/usb.h index 3c8da6f3b7..11a9cc27d6 100644 --- a/supervisor/usb.h +++ b/supervisor/usb.h @@ -96,4 +96,14 @@ bool usb_msc_lock(void); void usb_msc_unlock(void); #endif +#if CIRCUITPY_USB_KEYBOARD_WORKFLOW +void usb_keyboard_init(void); +bool usb_keyboard_chars_available(void); +char usb_keyboard_read_char(void); + +bool usb_keyboard_in_use(uint8_t dev_addr, uint8_t interface); +void usb_keyboard_detach(uint8_t dev_addr, uint8_t interface); +void usb_keyboard_attach(uint8_t dev_addr, uint8_t interface); +#endif + #endif // MICROPY_INCLUDED_SUPERVISOR_USB_H From ae844415758de8dbecd21f8df76709a8497a1ed2 Mon Sep 17 00:00:00 2001 From: Petr Sedlacek Date: Mon, 10 Jul 2023 22:57:45 +0200 Subject: [PATCH 1253/1712] Update 42. Keebs Frood support for Rev7 --- ports/raspberrypi/boards/42keebs_frood/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/42keebs_frood/mpconfigboard.mk b/ports/raspberrypi/boards/42keebs_frood/mpconfigboard.mk index 955d8d63f5..50d28c6ea9 100644 --- a/ports/raspberrypi/boards/42keebs_frood/mpconfigboard.mk +++ b/ports/raspberrypi/boards/42keebs_frood/mpconfigboard.mk @@ -6,4 +6,4 @@ USB_MANUFACTURER = "42. Keebs" CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 -EXTERNAL_FLASH_DEVICES = "ZD25WQ16B" +EXTERNAL_FLASH_DEVICES = "ZD25WQ16B, W25Q32JVxQ" From 52ca0504d99d72a281e35313fb9bab2658ad9840 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 10 Jul 2023 15:37:57 -0700 Subject: [PATCH 1254/1712] Comment out debug UART on RP2040 USB host feather --- .../boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h b/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h index ba62bca2cb..fbf194ed8d 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h @@ -13,7 +13,7 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO1) #define DEFAULT_UART_BUS_TX (&pin_GPIO0) -#define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX -#define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX +// #define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX +// #define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX #define CIRCUITPY_USB_HOST_INSTANCE 1 From 449416f5e1f74b60b2d153b86536ae169b9c7d56 Mon Sep 17 00:00:00 2001 From: Sylwester Date: Tue, 11 Jul 2023 09:52:47 +0200 Subject: [PATCH 1255/1712] Add Datanoise PicoADK --- .../boards/datanoise_picoadk/board.c | 29 +++++++++++ .../boards/datanoise_picoadk/mpconfigboard.h | 14 +++++ .../boards/datanoise_picoadk/mpconfigboard.mk | 9 ++++ .../datanoise_picoadk/pico-sdk-configboard.h | 4 ++ .../boards/datanoise_picoadk/pins.c | 51 +++++++++++++++++++ 5 files changed, 107 insertions(+) create mode 100644 ports/raspberrypi/boards/datanoise_picoadk/board.c create mode 100644 ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/datanoise_picoadk/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/datanoise_picoadk/pins.c diff --git a/ports/raspberrypi/boards/datanoise_picoadk/board.c b/ports/raspberrypi/boards/datanoise_picoadk/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/datanoise_picoadk/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.h b/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.h new file mode 100644 index 0000000000..f287893eeb --- /dev/null +++ b/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "Datanoise PicoADK" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO15) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO18) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO12) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk b/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk new file mode 100644 index 0000000000..1398f0b97f --- /dev/null +++ b/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x2E8A +USB_PID = 0x104B +USB_PRODUCT = "PicoADK" +USB_MANUFACTURER = "Datanoise" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "GD25Q32C,W25Q32JVxQ" diff --git a/ports/raspberrypi/boards/datanoise_picoadk/pico-sdk-configboard.h b/ports/raspberrypi/boards/datanoise_picoadk/pico-sdk-configboard.h new file mode 100644 index 0000000000..a41131dd22 --- /dev/null +++ b/ports/raspberrypi/boards/datanoise_picoadk/pico-sdk-configboard.h @@ -0,0 +1,4 @@ +// Put board-specific pico-sdk definitions here. This file must exist. + +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/datanoise_picoadk/pins.c b/ports/raspberrypi/boards/datanoise_picoadk/pins.c new file mode 100644 index 0000000000..7bcfd9a6f2 --- /dev/null +++ b/ports/raspberrypi/boards/datanoise_picoadk/pins.c @@ -0,0 +1,51 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D4), 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_D7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_ADC_SCK), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_ADC_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_ADC_MISO), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_ADC_CS), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D29), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_DOUT), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_I2S_BCLK), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_I2S_LRCLK), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_I2S_DEMP), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_I2S_XSMT), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 9b80943885c8e928896b9e480075a05fd5e21152 Mon Sep 17 00:00:00 2001 From: Sylwester Date: Tue, 11 Jul 2023 10:01:46 +0200 Subject: [PATCH 1256/1712] Add Datanoise PicoADK --- ports/raspberrypi/boards/datanoise_picoadk/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/datanoise_picoadk/pins.c b/ports/raspberrypi/boards/datanoise_picoadk/pins.c index 7bcfd9a6f2..9f1cc85b56 100644 --- a/ports/raspberrypi/boards/datanoise_picoadk/pins.c +++ b/ports/raspberrypi/boards/datanoise_picoadk/pins.c @@ -42,7 +42,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_I2S_XSMT), MP_ROM_PTR(&pin_GPIO25) }, { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO24) }, - + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, From 0c606c534cdb08f4412ba196e0e0a12f77bebcc9 Mon Sep 17 00:00:00 2001 From: Marco van der Kolk Date: Tue, 11 Jul 2023 11:18:29 +0200 Subject: [PATCH 1257/1712] Documentation: Sequences are supported, not just Lists Signed-off-by: Marco van der Kolk --- shared-bindings/keypad/ShiftRegisterKeys.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/shared-bindings/keypad/ShiftRegisterKeys.c b/shared-bindings/keypad/ShiftRegisterKeys.c index 3d1a8d6842..0e8789e0cf 100644 --- a/shared-bindings/keypad/ShiftRegisterKeys.c +++ b/shared-bindings/keypad/ShiftRegisterKeys.c @@ -41,10 +41,10 @@ //| self, //| *, //| clock: microcontroller.Pin, -//| data: Union[microcontroller.Pin, List[microcontroller.Pin]], +//| data: Union[microcontroller.Pin, Sequence[microcontroller.Pin]], //| latch: microcontroller.Pin, //| value_to_latch: bool = True, -//| key_count: Union[int, List[int]], +//| key_count: Union[int, Sequence[int]], //| value_when_pressed: bool, //| interval: float = 0.020, //| max_events: int = 64 @@ -63,7 +63,7 @@ //| //| :param microcontroller.Pin clock: The shift register clock pin. //| The shift register should clock on a low-to-high transition. -//| :param Union[microcontroller.Pin, List[microcontroller.Pin]] data: the incoming shift register data pin(s) +//| :param Union[microcontroller.Pin, Sequence[microcontroller.Pin]] data: the incoming shift register data pin(s) //| :param microcontroller.Pin latch: //| Pin used to latch parallel data going into the shift register. //| :param bool value_to_latch: Pin state to latch data being read. @@ -71,7 +71,7 @@ //| ``False`` if the data is latched when ``latch`` goes low. //| The default is ``True``, which is how the 74HC165 operates. The CD4021 latch is the opposite. //| Once the data is latched, it will be shifted out by toggling the clock pin. -//| :param Union[int, List[int]] key_count: number of data lines to clock in (per data pin) +//| :param Union[int, Sequence[int]] key_count: number of data lines to clock in (per data pin) //| :param bool value_when_pressed: ``True`` if the pin reads high when the key is pressed. //| ``False`` if the pin reads low (is grounded) when the key is pressed. //| :param float interval: Scan keys no more often than ``interval`` to allow for debouncing. @@ -200,7 +200,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(keypad_shiftregisterkeys___exit___obj //| ... //| key_count: int -//| """The number of keys that are being scanned. (read-only) +//| """The total number of keys that are being scanned. (read-only) //| """ //| events: EventQueue From bdf9336b8076d08b2202cdfa4dfef30d3f5618e2 Mon Sep 17 00:00:00 2001 From: Marco van der Kolk Date: Tue, 11 Jul 2023 12:09:51 +0200 Subject: [PATCH 1258/1712] Improved help text Signed-off-by: Marco van der Kolk --- shared-bindings/keypad/ShiftRegisterKeys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/keypad/ShiftRegisterKeys.c b/shared-bindings/keypad/ShiftRegisterKeys.c index 0e8789e0cf..e85e9af837 100644 --- a/shared-bindings/keypad/ShiftRegisterKeys.c +++ b/shared-bindings/keypad/ShiftRegisterKeys.c @@ -53,11 +53,11 @@ //| Create a `Keys` object that will scan keys attached to a parallel-in serial-out shift register //| like the 74HC165 or CD4021. //| Note that you may chain shift registers to load in as many values as you need. +//| Furthermore, you can put multiple shift registers in parallel and share clock and latch. //| //| Key number 0 is the first (or more properly, the zero-th) bit read. In the //| 74HC165, this bit is labeled ``Q7``. Key number 1 will be the value of ``Q6``, etc. -//| When specifying multiple data pins, the key numbers are sequential. -//| So with two data Pins in parallel and key_count[0] = 32, the keys of data[1] will start with 32. +//| With multiple data pins, key numbers of the next pin are sequentially to the current pin. //| //| An `EventQueue` is created when this object is created and is available in the `events` attribute. //| From 96aced8c37c46a3de9ea5bf33742acea789add76 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 11 Jul 2023 18:50:18 +0200 Subject: [PATCH 1259/1712] 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 | 9 +++++---- locale/cs.po | 9 +++++---- locale/de_DE.po | 12 ++++++++---- locale/el.po | 9 +++++---- locale/en_GB.po | 12 ++++++++---- locale/es.po | 12 ++++++++---- locale/fil.po | 9 +++++---- locale/fr.po | 12 ++++++++---- locale/hi.po | 9 +++++---- locale/it_IT.po | 9 +++++---- locale/ja.po | 9 +++++---- locale/ko.po | 9 +++++---- locale/nl.po | 9 +++++---- locale/pl.po | 9 +++++---- locale/pt_BR.po | 12 ++++++++---- locale/ru.po | 9 +++++---- locale/sv.po | 12 ++++++++---- locale/tr.po | 9 +++++---- locale/zh_Latn_pinyin.po | 12 ++++++++---- 19 files changed, 116 insertions(+), 76 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 94348e18a8..6208de5540 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -474,12 +474,17 @@ msgstr "Semua perangkat UART sedang digunakan" msgid "All channels in use" msgstr "" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Semua channel event sedang digunakan" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "" @@ -1976,10 +1981,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/locale/cs.po b/locale/cs.po index 7ea09153a7..751d6394b0 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -475,12 +475,17 @@ msgstr "Všechny UART periferie jsou používány" msgid "All channels in use" msgstr "Všechny kanály jsou používány" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Všechny kanály událostí jsou již používány" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "" @@ -1965,10 +1970,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/locale/de_DE.po b/locale/de_DE.po index df78415721..41d873e7ff 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -485,12 +485,17 @@ msgstr "Alle UART-Peripheriegeräte sind in Benutzung" msgid "All channels in use" msgstr "Alle Kanäle werden verwendet" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Alle Event-Kanäle werden benutzt" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "Alle State-Maschinen in Verwendung" @@ -1999,10 +2004,6 @@ msgstr "Serverseitiger Kontext kann keinen Hostnamen haben" msgid "Size not supported" msgstr "Größe nicht unterstützt" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "Sleep-Speicher nicht verfügbar" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." @@ -4459,6 +4460,9 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "Sleep Memory not available" +#~ msgstr "Sleep-Speicher nicht verfügbar" + #~ msgid "input and output shapes are not compatible" #~ msgstr "Eingabe- und Ausgabeformen sind nicht kompatibel" diff --git a/locale/el.po b/locale/el.po index f320dd8d9f..5e002f27df 100644 --- a/locale/el.po +++ b/locale/el.po @@ -486,12 +486,17 @@ msgstr "Όλα τα UART περιφεριακά ειναι σε χρήση" msgid "All channels in use" msgstr "Όλα τα κανάλια είναι σε χρήση" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Όλα τα κανάλια συμβάντων είναι σε χρήση" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "Όλες οι μηχανές κατάστασης είναι σε χρήση" @@ -1979,10 +1984,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/locale/en_GB.po b/locale/en_GB.po index 35eb8275c4..c4d1039de7 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -484,12 +484,17 @@ msgstr "All UART peripherals are in use" msgid "All channels in use" msgstr "All channels in use" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "All event channels in use" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "All state machines in use" @@ -1979,10 +1984,6 @@ msgstr "Server side context cannot have hostname" msgid "Size not supported" msgstr "Size not supported" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "Sleep Memory not available" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." @@ -4400,6 +4401,9 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "Sleep Memory not available" +#~ msgstr "Sleep Memory not available" + #~ msgid "input and output shapes are not compatible" #~ msgstr "input and output shapes are not compatible" diff --git a/locale/es.po b/locale/es.po index 7fe8ac2cb1..6b832dccfd 100644 --- a/locale/es.po +++ b/locale/es.po @@ -486,12 +486,17 @@ msgstr "Todos los periféricos UART están en uso" msgid "All channels in use" msgstr "Todos los canales están en uso" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Todos los canales de eventos están en uso" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "Todas las máquinas de estado están en uso" @@ -2014,10 +2019,6 @@ msgstr "El contexto del lado del servidor no puede tener un hostname" msgid "Size not supported" msgstr "Sin capacidades para el tamaño" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "Memoria de sueño no disponible" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." @@ -4455,6 +4456,9 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Sleep Memory not available" +#~ msgstr "Memoria de sueño no disponible" + #~ msgid "input and output shapes are not compatible" #~ msgstr "Formas de entrada y salida no son compatibles" diff --git a/locale/fil.po b/locale/fil.po index 26d9ab4655..ac2ddf6698 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -474,12 +474,17 @@ msgstr "Lahat ng I2C peripherals ginagamit" msgid "All channels in use" msgstr "" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Lahat ng event channels ginagamit" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "" @@ -1966,10 +1971,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/locale/fr.po b/locale/fr.po index 361952435c..27495cda1b 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -486,12 +486,17 @@ msgstr "Tous les périphériques UART sont utilisés" msgid "All channels in use" msgstr "Tout les canaux sont utilisés" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Tous les canaux d'événements sont utilisés" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "Tous les automates finis sont utilisés" @@ -2024,10 +2029,6 @@ msgstr "Un contexte niveau serveur ne peut avoir de hostname" msgid "Size not supported" msgstr "Taille n'est pas supportée" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "La mémoire de sommeil n'est pas disponible" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." @@ -4478,6 +4479,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 "Sleep Memory not available" +#~ msgstr "La mémoire de sommeil n'est pas disponible" + #~ msgid "input and output shapes are not compatible" #~ msgstr "les formes d'entrée et de sortie ne sont pas compatibles" diff --git a/locale/hi.po b/locale/hi.po index 3684aee25a..bdbcd835dd 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -471,12 +471,17 @@ msgstr "" msgid "All channels in use" msgstr "" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "" @@ -1950,10 +1955,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/locale/it_IT.po b/locale/it_IT.po index d8a609da15..f5519b25cc 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -477,12 +477,17 @@ msgstr "Tutte le periferiche I2C sono in uso" msgid "All channels in use" msgstr "" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Tutti i canali eventi utilizati" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "Tutte le state machines sono in uso" @@ -1973,10 +1978,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/locale/ja.po b/locale/ja.po index 13cae1e02e..65b6274cd4 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -478,12 +478,17 @@ msgstr "全てのUART周辺機器が使用中" msgid "All channels in use" msgstr "" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "全てのイベントチャネルが使用中" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "" @@ -1966,10 +1971,6 @@ msgstr "" msgid "Size not supported" msgstr "サイズは対応していません" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/locale/ko.po b/locale/ko.po index dd36e49950..cb0dad97e2 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -472,12 +472,17 @@ msgstr "사용중인 모든 UART주변 기기" msgid "All channels in use" msgstr "" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "" @@ -1953,10 +1958,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/locale/nl.po b/locale/nl.po index ed3ca55c48..cb2338ad92 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -471,12 +471,17 @@ msgstr "Alle UART peripherals zijn in gebruik" msgid "All channels in use" msgstr "" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Alle event kanalen zijn in gebruik" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "" @@ -1971,10 +1976,6 @@ msgstr "Context aan de serverkant kan geen hostnaam hebben" msgid "Size not supported" msgstr "Afmeting niet ondersteund" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/locale/pl.po b/locale/pl.po index 359c27eaad..a6af1932ee 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -473,12 +473,17 @@ msgstr "Wszystkie peryferia UART w użyciu" msgid "All channels in use" msgstr "" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Wszystkie kanały zdarzeń w użyciu" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "" @@ -1958,10 +1963,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 68e345351f..6f810d93ef 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -488,12 +488,17 @@ msgstr "Todos os periféricos UART estão em uso" msgid "All channels in use" msgstr "Todos os canais estão em uso" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Todos os canais de eventos em uso" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "O estado de todas as máquinas em uso" @@ -2009,10 +2014,6 @@ msgstr "O contexto do lado do servidor não pode ter nome de host" msgid "Size not supported" msgstr "O tamanho não é suportado" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "Sleep memory não está disponível" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." @@ -4456,6 +4457,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 "Sleep Memory not available" +#~ msgstr "Sleep memory não está disponível" + #~ msgid "input and output shapes are not compatible" #~ msgstr "as formas de entrada e saída não são compatíveis" diff --git a/locale/ru.po b/locale/ru.po index cc79f036cd..d4bbd20cac 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -478,12 +478,17 @@ msgstr "Все периферийные устройства UART уже исп msgid "All channels in use" msgstr "Все каналы уже используются" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Все каналы событий уже используются" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "Все машины состояний уже используются" @@ -2011,10 +2016,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/locale/sv.po b/locale/sv.po index abb457442b..c869d14a7a 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -485,12 +485,17 @@ msgstr "Alla UART-kringutrustning används" msgid "All channels in use" msgstr "Alla kanaler används" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Alla händelsekanaler används" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "Alla tillståndsmaskiner används" @@ -1990,10 +1995,6 @@ msgstr "Serversidans kontext kan inte ha värdnamn" msgid "Size not supported" msgstr "Storleken stöds inte" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "Sömnminne inte tillgängligt" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." @@ -4418,6 +4419,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 "Sleep Memory not available" +#~ msgstr "Sömnminne inte tillgängligt" + #~ msgid "input and output shapes are not compatible" #~ msgstr "indata- och utdataformer är inte kompatibla" diff --git a/locale/tr.po b/locale/tr.po index f64fb820b9..6fe4fabeab 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -480,12 +480,17 @@ msgstr "Tüm UART çevre birimleri kullanımda" msgid "All channels in use" msgstr "Tüm kanallar kullanımda" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "Tüm olay kanalları kullanımda" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "Tüm durum makineleri kullanımda" @@ -1972,10 +1977,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 4e0cc053f9..ba6a621b6b 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -487,12 +487,17 @@ msgstr "suǒyǒu UART wàishè dōu zài shǐyòng zhōng" msgid "All channels in use" msgstr "suǒyǒu píndào dōu zài shǐyòng zhōng" +#: ports/raspberrypi/common-hal/usb_host/Port.c +msgid "All dma channels in use" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" msgstr "suǒyǒu shìjiàn píndào dōu zài shǐyòng zhōng" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All state machines in use" msgstr "suǒyǒu zhuàngtàijī dōu zài shǐyòng zhōng" @@ -1995,10 +2000,6 @@ msgstr "Fúwùqì duān shàngxiàwén bùnéng jùyǒu zhǔjī míng" msgid "Size not supported" msgstr "bù zhī chí dà xiǎo" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "shuì mián jì yì bù kě yòng" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." @@ -4424,6 +4425,9 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Sleep Memory not available" +#~ msgstr "shuì mián jì yì bù kě yòng" + #~ msgid "input and output shapes are not compatible" #~ msgstr "shū rù hé shū chū xíng zhuàng bù jiān róng" From 22424ab545739561c403d19fd52b5477d9d18248 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Tue, 11 Jul 2023 16:56:49 +0000 Subject: [PATCH 1260/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index c869d14a7a..d5ab3cb7f2 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-05-26 12:50+0000\n" +"PO-Revision-Date: 2023-07-11 17:05+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "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.18-dev\n" +"X-Generator: Weblate 5.0-dev\n" #: main.c msgid "" @@ -450,7 +450,7 @@ msgstr "Adressintervallet är inte tillåtet" #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" -msgstr "All I2C-kringutrustning används" +msgstr "All CAN-kringutrustning används" #: ports/espressif/common-hal/busio/I2C.c #: ports/espressif/common-hal/i2ctarget/I2CTarget.c @@ -487,7 +487,7 @@ msgstr "Alla kanaler används" #: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All dma channels in use" -msgstr "" +msgstr "Alla dma-kanaler används" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" @@ -501,7 +501,7 @@ msgstr "Alla tillståndsmaskiner används" #: ports/atmel-samd/audio_dma.c msgid "All sync event channels in use" -msgstr "Alla händelsekanaler används" +msgstr "Alla synkroniseringskanaler används" #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: shared-bindings/pwmio/PWMOut.c @@ -1072,7 +1072,7 @@ msgstr "För RGB-färgrymder måste indatabitmappen ha 16 bitar per pixel" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" -msgstr "Formatet stöds inte" +msgstr "Format stöds inte" #: ports/mimxrt10xx/common-hal/microcontroller/Processor.c msgid "" @@ -2243,7 +2243,7 @@ msgstr "Kan inte initiera tolken" #: ports/espressif/common-hal/analogbufio/BufferedIn.c #, c-format msgid "Unable to initialize ADC DMA controller, ErrorCode:%d" -msgstr "Kan inte konfigurera ADC DMA controller, Felkod:%d" +msgstr "Kan inte inititiera ADC DMA-controller, Felkod:%d" #: shared-module/displayio/OnDiskBitmap.c msgid "Unable to read color palette data" @@ -2354,7 +2354,7 @@ msgstr "Busstyp för display stöds inte" #: shared-module/audiocore/WaveFile.c msgid "Unsupported format" -msgstr "Formatet stöds inte" +msgstr "Format stöds inte" #: shared-bindings/hashlib/__init__.c msgid "Unsupported hash algorithm" From 5e97ff80f2426e978e2de451ccd224e2e723816a Mon Sep 17 00:00:00 2001 From: madcitygeek Date: Tue, 11 Jul 2023 14:56:10 -0500 Subject: [PATCH 1261/1712] Added a varient of the luatos board with on-board ch343 --- .../boards/luatos_core_esp32c3_ch343/board.c | 29 ++++++++++++ .../luatos_core_esp32c3_ch343/mpconfigboard.h | 44 +++++++++++++++++++ .../mpconfigboard.mk | 8 ++++ .../boards/luatos_core_esp32c3_ch343/pins.c | 36 +++++++++++++++ .../luatos_core_esp32c3_ch343/sdkconfig | 5 +++ 5 files changed, 122 insertions(+) create mode 100644 ports/espressif/boards/luatos_core_esp32c3_ch343/board.c create mode 100644 ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.h create mode 100644 ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk create mode 100644 ports/espressif/boards/luatos_core_esp32c3_ch343/pins.c create mode 100644 ports/espressif/boards/luatos_core_esp32c3_ch343/sdkconfig diff --git a/ports/espressif/boards/luatos_core_esp32c3_ch343/board.c b/ports/espressif/boards/luatos_core_esp32c3_ch343/board.c new file mode 100644 index 0000000000..164430c88c --- /dev/null +++ b/ports/espressif/boards/luatos_core_esp32c3_ch343/board.c @@ -0,0 +1,29 @@ +/* + * 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.h b/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.h new file mode 100644 index 0000000000..000056e5ee --- /dev/null +++ b/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.h @@ -0,0 +1,44 @@ +/* + * 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. + */ + +// Board setup + +#define MICROPY_HW_BOARD_NAME "Luatos Core-ESP32C3" +#define MICROPY_HW_MCU_NAME "ESP32-C3" + +// Status LED +#define MICROPY_HW_LED_STATUS (&pin_GPIO12) + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} + +// Default bus pins +#define DEFAULT_UART_BUS_RX (&pin_GPIO20) +#define DEFAULT_UART_BUS_TX (&pin_GPIO21) + +// Serial over UART +#define CIRCUITPY_CONSOLE_UART_RX DEFAULT_UART_BUS_RX +#define CIRCUITPY_CONSOLE_UART_TX DEFAULT_UART_BUS_TX diff --git a/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk b/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk new file mode 100644 index 0000000000..e0df58f756 --- /dev/null +++ b/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0xDEADBEEF +CIRCUITPY_CREATION_ID = 0x00C30001 + +IDF_TARGET = esp32c3 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=80m +CIRCUITPY_ESP_FLASH_SIZE=4MB diff --git a/ports/espressif/boards/luatos_core_esp32c3_ch343/pins.c b/ports/espressif/boards/luatos_core_esp32c3_ch343/pins.c new file mode 100644 index 0000000000..f45205b5c3 --- /dev/null +++ b/ports/espressif/boards/luatos_core_esp32c3_ch343/pins.c @@ -0,0 +1,36 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // Luatos Core ESP32-C3 + // Documentation (Chinese only): + // https://wiki.luatos.com/chips/esp32c3/index.html + // Pinout: + // https://wiki.luatos.com/_images/20221023.png + // C3 Data Sheet + // https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + // IO11 used internally on this board version despite being broken out to a pin + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/luatos_core_esp32c3_ch343/sdkconfig b/ports/espressif/boards/luatos_core_esp32c3_ch343/sdkconfig new file mode 100644 index 0000000000..ccc70917b5 --- /dev/null +++ b/ports/espressif/boards/luatos_core_esp32c3_ch343/sdkconfig @@ -0,0 +1,5 @@ +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="luatos-core-esp32c3" +# end of LWIP From 2746709dfcb25c61ec7c95d9d9917ab29f65697e Mon Sep 17 00:00:00 2001 From: Miroslav Zuzelka Date: Tue, 11 Jul 2023 22:58:12 +0200 Subject: [PATCH 1262/1712] Update pins.c Add EPD pins definition --- ports/espressif/boards/es3ink/pins.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ports/espressif/boards/es3ink/pins.c b/ports/espressif/boards/es3ink/pins.c index f316137b7f..2a5acc434b 100644 --- a/ports/espressif/boards/es3ink/pins.c +++ b/ports/espressif/boards/es3ink/pins.c @@ -19,14 +19,21 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_EPD_RESET), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_EPD_BUSY), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_EPD_CS), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_EPD_DC), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, From 8d6ef37a7c7cb1bb05baec82bc165dfdc7156add Mon Sep 17 00:00:00 2001 From: Miroslav Zuzelka Date: Tue, 11 Jul 2023 23:12:46 +0200 Subject: [PATCH 1263/1712] Update pins.c Fix pre-commit error --- ports/espressif/boards/es3ink/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/es3ink/pins.c b/ports/espressif/boards/es3ink/pins.c index 2a5acc434b..3706eb09a6 100644 --- a/ports/espressif/boards/es3ink/pins.c +++ b/ports/espressif/boards/es3ink/pins.c @@ -23,7 +23,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_EPD_BUSY), MP_ROM_PTR(&pin_GPIO6) }, - + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, From 910fcf1c939be54e42a795eda994f14d69583e97 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 30 Jun 2023 11:27:50 -0500 Subject: [PATCH 1264/1712] usb host keyboard: add keymap support This is confined to pure ASCII, but does support Alt Gr. This is enough to make a French keyboard layout work: * home row is "qsdfghjklm" * numerals are all shifted * keys like {} require Alt Gr While not tested, this should also support layouts like Colemak with the necssary keymap file. Layouts can be produced from Neradoc's keyboard layout modules on the device & loaded at runtime. Code to do so is at https://gist.github.com/jepler/597c0a00e0eb014a433e03c0ae363a08 as well as a sketch of how an extended format could support dead keys & the full Unicode BMP instead of just ASCII. --- shared-bindings/usb/__init__.c | 33 ++++++ supervisor/shared/usb/host_keyboard.c | 163 ++++++++++++++++++-------- supervisor/usb.h | 1 + 3 files changed, 151 insertions(+), 46 deletions(-) diff --git a/shared-bindings/usb/__init__.c b/shared-bindings/usb/__init__.c index 443d5cf788..b22fce8011 100644 --- a/shared-bindings/usb/__init__.c +++ b/shared-bindings/usb/__init__.c @@ -30,15 +30,48 @@ #include "shared-bindings/usb/__init__.h" #include "shared-bindings/usb/core/__init__.h" +#include "supervisor/usb.h" //| """PyUSB-compatible USB host API //| //| The `usb` is a subset of PyUSB that allows you to communicate to USB devices. //| """ +//| +//| def set_user_keymap(keymap: ReadableBuffer, /) -> None: +//| """Set the keymap used by a USB HID keyboard in kernel mode +//| +//| The keymap consists of 256 or 384 1-byte entries that map from USB keycodes +//| to ASCII codes. The first 128 entries are for unmodified keys, +//| the next 128 entries are for shifted keys,and the next optional 128 entries are +//| for altgr-modified keys. +//| +//| The values must all be ASCII (32 through 126 inclusive); other values are not valid. +//| +//| The values at index 0, 128, and 256 (if the keymap has 384 entries) must be +//| 0; other values are reserved for future expansion to indicate alternate +//| keymap formats. +//| +//| At other indices, the value 0 is used to indicate that the normal +//| definition is still used. For instance, the entry for HID_KEY_ARROW_UP +//| (0x52) is usually 0 so that the default behavior of sending an escape code +//| is preserved. +//| +//| This function is a CircuitPython extension not present in PyUSB +//| """ +//| +STATIC mp_obj_t usb_set_user_keymap(mp_obj_t buf_in) { + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); + usb_keymap_set(bufinfo.buf, bufinfo.len); + return mp_const_none; +} + +MP_DEFINE_CONST_FUN_OBJ_1(usb_set_user_keymap_obj, usb_set_user_keymap); STATIC mp_rom_map_elem_t usb_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_usb) }, { MP_ROM_QSTR(MP_QSTR_core), MP_OBJ_FROM_PTR(&usb_core_module) }, + { MP_ROM_QSTR(MP_QSTR_set_user_keymap), MP_OBJ_FROM_PTR(&usb_set_user_keymap_obj) }, }; STATIC MP_DEFINE_CONST_DICT(usb_module_globals, usb_module_globals_table); diff --git a/supervisor/shared/usb/host_keyboard.c b/supervisor/shared/usb/host_keyboard.c index 831914d87a..7fa7d1e138 100644 --- a/supervisor/shared/usb/host_keyboard.c +++ b/supervisor/shared/usb/host_keyboard.c @@ -32,49 +32,70 @@ #include "shared/runtime/interrupt_char.h" #include "supervisor/usb.h" +#ifndef DEBUG +#define DEBUG (0) +#endif + // Buffer the incoming serial data in the background so that we can look for the // interrupt character. STATIC ringbuf_t _incoming_ringbuf; STATIC uint8_t _buf[16]; -uint8_t _dev_addr; -uint8_t _interface; +STATIC uint8_t _dev_addr; +STATIC uint8_t _interface; -#define FLAG_ALPHABETIC (1) -#define FLAG_SHIFT (2) -#define FLAG_NUMLOCK (4) -#define FLAG_CTRL (8) -#define FLAG_LUT (16) +#define FLAG_SHIFT (1) +#define FLAG_NUMLOCK (2) +#define FLAG_CTRL (4) +#define FLAG_STRING (8) -const char *const lut[] = { - "!@#$%^&*()", /* 0 - shifted numeric keys */ - "\r\x1b\10\t -=[]\\#;'`,./", /* 1 - symbol keys */ - "\n\x1b\177\t _+{}|~:\"~<>?", /* 2 - shifted */ - "\12\13\10\22", /* 3 - arrow keys RLDU */ - "/*-+\n1234567890.", /* 4 - keypad w/numlock */ - "/*-+\n\xff\2\xff\4\xff\3\xff\1\xff\xff.", /* 5 - keypad w/o numlock */ -}; +STATIC uint8_t user_keymap[384]; +STATIC size_t user_keymap_len = 0; + +void usb_keymap_set(const uint8_t *buf, size_t len) { + user_keymap_len = len = MIN(len, sizeof(user_keymap)); + memcpy(user_keymap, buf, len); + memset(user_keymap + len, 0, sizeof(user_keymap) - len); +} struct keycode_mapper { uint8_t first, last, code, flags; -} keycode_to_ascii[] = { - { HID_KEY_A, HID_KEY_Z, 'a', FLAG_ALPHABETIC, }, + const char *data; +}; - { HID_KEY_1, HID_KEY_9, 0, FLAG_SHIFT | FLAG_LUT, }, +#define SEP "\0" // separator in FLAG_STRING sequences +#define NOTHING "" // in FLAG_STRING sequences +#define CURSOR_UP "\e[A" +#define CURSOR_DOWN "\e[B" +#define CURSOR_LEFT "\e[D" +#define CURSOR_RIGHT "\e[C" +#define CURSOR_PGUP "\e[5~" +#define CURSOR_PGDN "\e[6~" +#define CURSOR_HOME "\e[H" +#define CURSOR_END "\e[F" +#define CURSOR_INS "\e[2~" +#define CURSOR_DEL "\e[3~" + +STATIC struct keycode_mapper keycode_to_ascii[] = { + { HID_KEY_A, HID_KEY_Z, 'a', 0, NULL}, + + { HID_KEY_1, HID_KEY_9, 0, FLAG_SHIFT, "!@#$%^&*()" }, { HID_KEY_1, HID_KEY_9, '1', 0, }, { HID_KEY_0, HID_KEY_0, ')', FLAG_SHIFT, }, { HID_KEY_0, HID_KEY_0, '0', 0, }, { HID_KEY_ENTER, HID_KEY_ENTER, '\n', FLAG_CTRL }, - { HID_KEY_ENTER, HID_KEY_SLASH, 2, FLAG_SHIFT | FLAG_LUT, }, - { HID_KEY_ENTER, HID_KEY_SLASH, 1, FLAG_LUT, }, + { HID_KEY_ENTER, HID_KEY_SLASH, 0, FLAG_SHIFT, "\n\x1b\177\t _+{}|~:\"~<>?" }, + { HID_KEY_ENTER, HID_KEY_SLASH, 0, 0, "\r\x1b\10\t -=[]\\#;'`,./" }, { HID_KEY_F1, HID_KEY_F1, 0x1e, 0, }, // help key on xerox 820 kbd - { HID_KEY_ARROW_RIGHT, HID_KEY_ARROW_UP, 3, FLAG_LUT }, + { HID_KEY_KEYPAD_DIVIDE, HID_KEY_KEYPAD_DECIMAL, 0, FLAG_NUMLOCK | FLAG_STRING, + "/\0" "*\0" "-\0" "+\0" "\n\0" CURSOR_END SEP CURSOR_DOWN SEP CURSOR_PGDN SEP CURSOR_LEFT SEP NOTHING SEP CURSOR_RIGHT SEP CURSOR_HOME SEP CURSOR_UP SEP CURSOR_PGDN SEP CURSOR_INS SEP CURSOR_DEL}, + { HID_KEY_KEYPAD_DIVIDE, HID_KEY_KEYPAD_DECIMAL, 0, 0, "/*-+\n1234567890." }, + + { HID_KEY_ARROW_RIGHT, HID_KEY_ARROW_UP, 0, FLAG_STRING, CURSOR_RIGHT SEP CURSOR_LEFT SEP CURSOR_DOWN SEP CURSOR_UP }, - { HID_KEY_KEYPAD_DIVIDE, HID_KEY_KEYPAD_DECIMAL, 4, FLAG_NUMLOCK | FLAG_LUT }, - { HID_KEY_KEYPAD_DIVIDE, HID_KEY_KEYPAD_DECIMAL, 5, FLAG_LUT }, }; STATIC bool report_contains(const hid_keyboard_report_t *report, uint8_t key) { @@ -86,30 +107,63 @@ STATIC bool report_contains(const hid_keyboard_report_t *report, uint8_t key) { return false; } -int old_ascii = -1; -uint32_t repeat_timeout; +STATIC const char *old_buf = NULL; +STATIC size_t buf_size = 0; // this matches Linux default of 500ms to first repeat, 1/20s thereafter -const uint32_t default_repeat_time = 50; -const uint32_t initial_repeat_time = 500; +STATIC const uint32_t initial_repeat_time = 500; -STATIC void send_ascii(uint8_t code, uint32_t repeat_time) { - old_ascii = code; +STATIC void send_bufn(const char *buf, size_t n, uint32_t repeat_time) { + old_buf = buf; + buf_size = n; // repeat_timeout = millis() + repeat_time; - if (code == mp_interrupt_char) { - mp_sched_keyboard_interrupt(); - return; + for (; n--; buf++) { + int code = *buf; + if (code == mp_interrupt_char) { + mp_sched_keyboard_interrupt(); + return; + } + if (ringbuf_num_empty(&_incoming_ringbuf) == 0) { + // Drop on the floor + return; + } + ringbuf_put(&_incoming_ringbuf, code); } - if (ringbuf_num_empty(&_incoming_ringbuf) == 0) { - // Drop on the floor - return; - } - ringbuf_put(&_incoming_ringbuf, code); } +STATIC void send_bufz(const char *buf, uint32_t repeat_time) { + send_bufn(buf, strlen(buf), repeat_time); +} + +STATIC void send_byte(uint8_t code, uint32_t repeat_time) { + static char buf[1]; + buf[0] = code; + send_bufn(buf, 1, repeat_time); +} + +#if 0 +STATIC uint32_t repeat_timeout; +STATIC const uint32_t default_repeat_time = 50; +// TODO: nothing actually SENDS the repetitions... +STATIC void send_repeat() { + if (old_buf) { + send_bufn(old_buf, old_buf_size, default_repeat_time); + } +} +#endif + hid_keyboard_report_t old_report; +STATIC const char *skip_nuls(const char *buf, size_t n) { + while (n--) { + buf += strlen(buf) + 1; + } + return buf; +} + STATIC void process_event(uint8_t dev_addr, uint8_t instance, const hid_keyboard_report_t *report) { - bool alt = report->modifier & 0x44; + bool has_altgr = (user_keymap_len > 256); + bool altgr = has_altgr && report->modifier & 0x40; + bool alt = has_altgr ? report->modifier & 0x4 : report->modifier & 0x44; bool shift = report->modifier & 0x22; bool ctrl = report->modifier & 0x11; bool caps = old_report.reserved & 1; @@ -122,7 +176,7 @@ STATIC void process_event(uint8_t dev_addr, uint8_t instance, const hid_keyboard } // something was pressed or release, so cancel any key repeat - old_ascii = -1; + old_buf = NULL; for (int i = 0; i < 6; i++) { uint8_t keycode = report->keycode[i]; @@ -139,6 +193,22 @@ STATIC void process_event(uint8_t dev_addr, uint8_t instance, const hid_keyboard } else if (keycode == HID_KEY_CAPS_LOCK) { caps = !caps; } else { + size_t idx = keycode + (altgr ? 256 : shift ? 128 : 0); + uint8_t ascii = user_keymap[idx]; + #if DEBUG + mp_printf(&mp_plat_print, "lookup HID keycode %d mod %x at idx %d -> ascii %d (%c)\n", + keycode, report->modifier, idx, ascii, ascii >= 32 && ascii <= 126 ? ascii : '.'); + #endif + if (ascii != 0) { + if (ctrl) { + ascii &= 0x1f; + } else if (ascii >= 'a' && ascii <= 'z' && caps) { + ascii ^= ('a' ^ 'A'); + } + send_byte(ascii, initial_repeat_time); + continue; + } + for (size_t j = 0; j < MP_ARRAY_SIZE(keycode_to_ascii); j++) { struct keycode_mapper *mapper = &keycode_to_ascii[j]; if (!(keycode >= mapper->first && keycode <= mapper->last)) { @@ -153,15 +223,16 @@ STATIC void process_event(uint8_t dev_addr, uint8_t instance, const hid_keyboard if (mapper->flags & FLAG_CTRL && !ctrl) { continue; } - if (mapper->flags & FLAG_LUT) { - code = lut[mapper->code][keycode - mapper->first]; + if (mapper->flags & FLAG_STRING) { + const char *msg = skip_nuls(mapper->data, keycode - mapper->first); + send_bufz(msg, initial_repeat_time); + } else if (mapper->data) { + code = mapper->data[keycode - mapper->first]; } else { code = keycode - mapper->first + mapper->code; } - if (mapper->flags & FLAG_ALPHABETIC) { - if (shift ^ caps) { - code ^= ('a' ^ 'A'); - } + if (code >= 'a' && code <= 'z' && (shift ^ caps)) { + code ^= ('a' ^ 'A'); } if (ctrl) { code &= 0x1f; @@ -169,7 +240,7 @@ STATIC void process_event(uint8_t dev_addr, uint8_t instance, const hid_keyboard if (alt) { code ^= 0x80; } - send_ascii(code, initial_repeat_time); + send_byte(code, initial_repeat_time); break; } } diff --git a/supervisor/usb.h b/supervisor/usb.h index 11a9cc27d6..e05dbc1bab 100644 --- a/supervisor/usb.h +++ b/supervisor/usb.h @@ -104,6 +104,7 @@ char usb_keyboard_read_char(void); bool usb_keyboard_in_use(uint8_t dev_addr, uint8_t interface); void usb_keyboard_detach(uint8_t dev_addr, uint8_t interface); void usb_keyboard_attach(uint8_t dev_addr, uint8_t interface); +void usb_keymap_set(const uint8_t *buf, size_t len); #endif #endif // MICROPY_INCLUDED_SUPERVISOR_USB_H From 1a06169e1882a4b30b322e9024fd1a371cbb9979 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 10 Jul 2023 10:00:23 -0500 Subject: [PATCH 1265/1712] Implement key-repeat --- supervisor/shared/usb/host_keyboard.c | 54 ++++++++++++++++++--------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/supervisor/shared/usb/host_keyboard.c b/supervisor/shared/usb/host_keyboard.c index 7fa7d1e138..518dcf7f77 100644 --- a/supervisor/shared/usb/host_keyboard.c +++ b/supervisor/shared/usb/host_keyboard.c @@ -31,6 +31,8 @@ #include "py/runtime.h" #include "shared/runtime/interrupt_char.h" #include "supervisor/usb.h" +#include "supervisor/background_callback.h" +#include "supervisor/shared/tick.h" #ifndef DEBUG #define DEBUG (0) @@ -110,9 +112,17 @@ STATIC bool report_contains(const hid_keyboard_report_t *report, uint8_t key) { STATIC const char *old_buf = NULL; STATIC size_t buf_size = 0; // this matches Linux default of 500ms to first repeat, 1/20s thereafter -STATIC const uint32_t initial_repeat_time = 500; +enum { initial_repeat_time = 500, default_repeat_time = 50 }; +STATIC uint64_t repeat_deadline; +STATIC void repeat_f(void *unused); +background_callback_t repeat_cb = {repeat_f, NULL, NULL, NULL}; -STATIC void send_bufn(const char *buf, size_t n, uint32_t repeat_time) { +STATIC void set_repeat_deadline(uint64_t new_deadline) { + repeat_deadline = new_deadline; + background_callback_add_core(&repeat_cb); +} + +STATIC void send_bufn_core(const char *buf, size_t n) { old_buf = buf; buf_size = n; // repeat_timeout = millis() + repeat_time; @@ -130,26 +140,36 @@ STATIC void send_bufn(const char *buf, size_t n, uint32_t repeat_time) { } } -STATIC void send_bufz(const char *buf, uint32_t repeat_time) { - send_bufn(buf, strlen(buf), repeat_time); +STATIC void send_bufn(const char *buf, size_t n) { + send_bufn_core(buf, n); + set_repeat_deadline(supervisor_ticks_ms64() + initial_repeat_time); } -STATIC void send_byte(uint8_t code, uint32_t repeat_time) { +STATIC void send_bufz(const char *buf) { + send_bufn(buf, strlen(buf)); +} + +STATIC void send_byte(uint8_t code) { static char buf[1]; buf[0] = code; - send_bufn(buf, 1, repeat_time); + send_bufn(buf, 1); } -#if 0 -STATIC uint32_t repeat_timeout; -STATIC const uint32_t default_repeat_time = 50; -// TODO: nothing actually SENDS the repetitions... -STATIC void send_repeat() { +STATIC void send_repeat(void) { if (old_buf) { - send_bufn(old_buf, old_buf_size, default_repeat_time); + uint64_t now = supervisor_ticks_ms64(); + if (now >= repeat_deadline) { + send_bufn_core(old_buf, buf_size); + set_repeat_deadline(now + default_repeat_time); + } else { + background_callback_add_core(&repeat_cb); + } } } -#endif + +STATIC void repeat_f(void *unused) { + send_repeat(); +} hid_keyboard_report_t old_report; @@ -175,7 +195,7 @@ STATIC void process_event(uint8_t dev_addr, uint8_t instance, const hid_keyboard return; } - // something was pressed or release, so cancel any key repeat + // something was pressed or released, so cancel any key repeat old_buf = NULL; for (int i = 0; i < 6; i++) { @@ -205,7 +225,7 @@ STATIC void process_event(uint8_t dev_addr, uint8_t instance, const hid_keyboard } else if (ascii >= 'a' && ascii <= 'z' && caps) { ascii ^= ('a' ^ 'A'); } - send_byte(ascii, initial_repeat_time); + send_byte(ascii); continue; } @@ -225,7 +245,7 @@ STATIC void process_event(uint8_t dev_addr, uint8_t instance, const hid_keyboard } if (mapper->flags & FLAG_STRING) { const char *msg = skip_nuls(mapper->data, keycode - mapper->first); - send_bufz(msg, initial_repeat_time); + send_bufz(msg); } else if (mapper->data) { code = mapper->data[keycode - mapper->first]; } else { @@ -240,7 +260,7 @@ STATIC void process_event(uint8_t dev_addr, uint8_t instance, const hid_keyboard if (alt) { code ^= 0x80; } - send_byte(code, initial_repeat_time); + send_byte(code); break; } } From 843ea86978c10af168b14ca52edf92668bc010fd Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 10 Jul 2023 13:49:28 -0500 Subject: [PATCH 1266/1712] fix repeating cursor keys --- supervisor/shared/usb/host_keyboard.c | 1 + 1 file changed, 1 insertion(+) diff --git a/supervisor/shared/usb/host_keyboard.c b/supervisor/shared/usb/host_keyboard.c index 518dcf7f77..0fd64d2662 100644 --- a/supervisor/shared/usb/host_keyboard.c +++ b/supervisor/shared/usb/host_keyboard.c @@ -246,6 +246,7 @@ STATIC void process_event(uint8_t dev_addr, uint8_t instance, const hid_keyboard if (mapper->flags & FLAG_STRING) { const char *msg = skip_nuls(mapper->data, keycode - mapper->first); send_bufz(msg); + break; } else if (mapper->data) { code = mapper->data[keycode - mapper->first]; } else { From 6174e585af89fc2f3974862822fca1853491030e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 11 Jul 2023 10:51:41 -0500 Subject: [PATCH 1267/1712] usb.core.Device: fix trailing NUL on e.g., product string .. and simplify the code to use vstr_add_char. --- shared-module/usb/utf16le.c | 79 ++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 45 deletions(-) diff --git a/shared-module/usb/utf16le.c b/shared-module/usb/utf16le.c index 24ccd09360..2b55dc6bab 100644 --- a/shared-module/usb/utf16le.c +++ b/shared-module/usb/utf16le.c @@ -26,60 +26,49 @@ #include "shared-module/usb/utf16le.h" -STATIC void _convert_utf16le_to_utf8(const uint16_t *utf16, size_t utf16_len, uint8_t *utf8, size_t utf8_len) { - // TODO: Check for runover. - (void)utf8_len; +typedef struct { + const uint16_t *buf; + size_t len; +} utf16_str; - for (size_t i = 0; i < utf16_len; i++) { - uint16_t chr = utf16[i]; - if (chr < 0x80) { - *utf8++ = chr & 0xff; - } else if (chr < 0x800) { - *utf8++ = (uint8_t)(0xC0 | (chr >> 6 & 0x1F)); - *utf8++ = (uint8_t)(0x80 | (chr >> 0 & 0x3F)); - } else if (chr < 0x10000) { - // TODO: Verify surrogate. - *utf8++ = (uint8_t)(0xE0 | (chr >> 12 & 0x0F)); - *utf8++ = (uint8_t)(0x80 | (chr >> 6 & 0x3F)); - *utf8++ = (uint8_t)(0x80 | (chr >> 0 & 0x3F)); - } else { - // TODO: Handle UTF-16 code points that take two entries. - uint32_t hc = ((chr & 0xFFFF0000) - 0xD8000000) >> 6; /* Get high 10 bits */ - chr = (chr & 0xFFFF) - 0xDC00; /* Get low 10 bits */ - chr = (hc | chr) + 0x10000; - *utf8++ = (uint8_t)(0xF0 | (chr >> 18 & 0x07)); - *utf8++ = (uint8_t)(0x80 | (chr >> 12 & 0x3F)); - *utf8++ = (uint8_t)(0x80 | (chr >> 6 & 0x3F)); - *utf8++ = (uint8_t)(0x80 | (chr >> 0 & 0x3F)); - } +STATIC uint32_t utf16str_peek_unit(utf16_str *utf) { + if (!utf->len) { + return 0; } + return *utf->buf; } -// Count how many bytes a utf-16-le encoded string will take in utf-8. -STATIC mp_int_t _count_utf8_bytes(const uint16_t *buf, size_t len) { - size_t total_bytes = 0; - for (size_t i = 0; i < len; i++) { - uint16_t chr = buf[i]; - if (chr < 0x80) { - total_bytes += 1; - } else if (chr < 0x800) { - total_bytes += 2; - } else if (chr < 0x10000) { - total_bytes += 3; - } else { - total_bytes += 4; +STATIC uint32_t utf16str_next_unit(utf16_str *utf) { + uint32_t result = utf16str_peek_unit(utf); + if (utf->len) { + utf->len--; + utf->buf++; + } + return result; +} +STATIC uint32_t utf16str_next_codepoint(utf16_str *utf) { + uint32_t unichr = utf16str_next_unit(utf); + if (unichr >= 0xd800 && unichr < 0xdc00) { + uint32_t low_surrogate = utf16str_peek_unit(utf); + if (low_surrogate >= 0xdc00 && low_surrogate < 0xe000) { + (void)utf16str_next_unit(utf); + unichr = (unichr - 0xd800) * 0x400 + low_surrogate - 0xdc00 + 0x10000; } } - return total_bytes; + return unichr; +} + +STATIC void _convert_utf16le_to_utf8(vstr_t *vstr, utf16_str *utf) { + while (utf->len) { + vstr_add_char(vstr, utf16str_next_codepoint(utf)); + } } mp_obj_t utf16le_to_string(const uint16_t *buf, size_t utf16_len) { - size_t size = _count_utf8_bytes(buf, utf16_len); + // will grow if necessary, but will never grow for an all-ASCII descriptor vstr_t vstr; - vstr_init_len(&vstr, size + 1); - byte *p = (byte *)vstr.buf; - // Null terminate. - p[size] = '\0'; - _convert_utf16le_to_utf8(buf, utf16_len, p, size); + vstr_init(&vstr, utf16_len); + utf16_str utf = {buf, utf16_len}; + _convert_utf16le_to_utf8(&vstr, &utf); return mp_obj_new_str_from_vstr(&mp_type_str, &vstr); } From 31c3d7ca429d3559fe87191a4118752f31dc2046 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Wed, 12 Jul 2023 00:02:26 +0000 Subject: [PATCH 1268/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 6f810d93ef..5b6cca5fb3 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: 2023-06-23 20:35+0000\n" +"PO-Revision-Date: 2023-07-13 00:51+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "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.18.1\n" +"X-Generator: Weblate 5.0-dev\n" #: main.c msgid "" @@ -490,7 +490,7 @@ msgstr "Todos os canais estão em uso" #: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All dma channels in use" -msgstr "" +msgstr "Todos os canais dma estão em uso" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" From efd4fffea61ec921f2bdf673626f9a232e2548d7 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 12 Jul 2023 22:49:39 -0500 Subject: [PATCH 1269/1712] start_ap max_connections ignored --- shared-bindings/wifi/Radio.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 66502426cd..e28725c46c 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -339,7 +339,12 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station); //| or exactly 64 hexadecimal characters if it is the hex form of the 256-bit key. //| //| If ``max_connections`` is given, the access point will allow up to -//| that number of stations to connect.""" +//| that number of stations to connect. +//| +//| .. note:: +//| +//| In the raspberrypi port (RP2040 CYW43), ``max_connections`` is ignored. +//| """ //| ... STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_ssid, ARG_password, ARG_channel, ARG_authmode, ARG_max_connections }; From a7bbb05e25b035cc37530ef8a9a40456ff2b2e5f Mon Sep 17 00:00:00 2001 From: madcitygeek Date: Wed, 12 Jul 2023 22:59:43 -0500 Subject: [PATCH 1270/1712] Update mpconfigboard.mk Use unique CIRCUITPY_CREATION_ID --- .../espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk b/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk index e0df58f756..6a19c783f1 100644 --- a/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk +++ b/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk @@ -1,5 +1,5 @@ CIRCUITPY_CREATOR_ID = 0xDEADBEEF -CIRCUITPY_CREATION_ID = 0x00C30001 +CIRCUITPY_CREATION_ID = 0x00C30002 IDF_TARGET = esp32c3 From bd2072123a9f9f6ba073a597be42237d34cad4dc Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 12 Jul 2023 23:24:33 -0500 Subject: [PATCH 1271/1712] web workflow: uses an mdns port service slot --- docs/workflows.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/workflows.md b/docs/workflows.md index 453b425491..a82130e63c 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -94,6 +94,10 @@ MDNS is used to resolve [`circuitpython.local`](http://circuitpython.local) to a hostname of the form `cpy-XXXXXX.local`. The `XXXXXX` is based on network MAC address. The device also provides the MDNS service with service type `_circuitpython` and protocol `_tcp`. +Since port 80 (or the port assigned to `CIRCUITPY_WEB_API_PORT`) is used for MDNS, the `mdns` +[module](https://docs.circuitpython.org/en/latest/shared-bindings/mdns/index.html#mdns.Server.advertise_service) +can't also advertise a service on that port. + ### HTTP The web server is HTTP 1.1 and may use chunked responses so that it doesn't need to precompute content length. From cf5028e85bf13b0d3ce8411ff3f5efbd8385b8f2 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 12 Jul 2023 23:32:44 -0500 Subject: [PATCH 1272/1712] mdns: can't use web workflow port --- shared-bindings/mdns/Server.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shared-bindings/mdns/Server.c b/shared-bindings/mdns/Server.c index 0d06d67f0d..2afc64e02b 100644 --- a/shared-bindings/mdns/Server.c +++ b/shared-bindings/mdns/Server.c @@ -171,6 +171,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mdns_server_find_obj, 1, _mdns_server_find); //| ``service_type`` and ``protocol`` can only occur on one port. Any call after the first //| will update the entry's port. //| +//| If web workflow is active, the port it uses can't also be used to advertise a service. +//| //| :param str service_type: The service type such as "_http" //| :param str protocol: The service protocol such as "_tcp" //| :param int port: The port used by the service""" From d4ac8e75e83b69b73c792c80ffbfac25821a959a Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 12 Jul 2023 23:41:14 -0500 Subject: [PATCH 1273/1712] raspberrypi: start AP before set IPv4 --- shared-bindings/wifi/Radio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index e28725c46c..157803d45c 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -565,6 +565,11 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_subnet_ap_obj, //| ) -> None: //| """Sets the IP v4 address of the station. Must include the netmask and gateway. DNS address is optional. //| Setting the address manually will stop the DHCP client.""" +//| +//| .. note:: +//| +//| In the raspberrypi port (RP2040 CYW43), the access point needs to be started before the IP v4 address can be set. +//| """ //| ... STATIC mp_obj_t wifi_radio_set_ipv4_address(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_ipv4, ARG_netmask, ARG_gateway, ARG_ipv4_dns }; From 69d2f5ec2a0481d764f80f8dc342348ad6ea8fb8 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 12 Jul 2023 23:53:52 -0500 Subject: [PATCH 1274/1712] formatting fix --- shared-bindings/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 157803d45c..17a16eab63 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -564,7 +564,7 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_subnet_ap_obj, //| ipv4_dns: Optional[ipaddress.IPv4Address], //| ) -> None: //| """Sets the IP v4 address of the station. Must include the netmask and gateway. DNS address is optional. -//| Setting the address manually will stop the DHCP client.""" +//| Setting the address manually will stop the DHCP client. //| //| .. note:: //| From 3ac84281bf2fa7a3fcb1323e2ef4d3cf98b279db Mon Sep 17 00:00:00 2001 From: Sylwester Date: Thu, 13 Jul 2023 12:04:27 +0200 Subject: [PATCH 1275/1712] Add NeoPixel Library for Datanoise PicoADK. --- ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk b/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk index 1398f0b97f..405821da3e 100644 --- a/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk +++ b/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk @@ -7,3 +7,6 @@ CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 EXTERNAL_FLASH_DEVICES = "GD25Q32C,W25Q32JVxQ" + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel From 235983652fb4ea19a555814d7c79f2f9514907ff Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 13 Jul 2023 09:47:38 -0500 Subject: [PATCH 1276/1712] throw an exception if os.getenv is used on a board without settings.toml support --- shared-bindings/os/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index e9e5f0885f..4ff48499a5 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -103,7 +103,7 @@ STATIC mp_obj_t os_getenv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ return common_hal_os_getenv(mp_obj_str_get_str(args[ARG_key].u_obj), args[ARG_default].u_obj); #else - return mp_const_none; + mp_raise_NotImplementedError(NULL); #endif } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(os_getenv_obj, 1, os_getenv); From 73af1b8a30159fbce89a1e59cd6336c92ccbaba7 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:41:07 -0500 Subject: [PATCH 1277/1712] Update docs/workflows.md Co-authored-by: Scott Shawcroft --- docs/workflows.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/workflows.md b/docs/workflows.md index a82130e63c..10d2897870 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -94,9 +94,9 @@ MDNS is used to resolve [`circuitpython.local`](http://circuitpython.local) to a hostname of the form `cpy-XXXXXX.local`. The `XXXXXX` is based on network MAC address. The device also provides the MDNS service with service type `_circuitpython` and protocol `_tcp`. -Since port 80 (or the port assigned to `CIRCUITPY_WEB_API_PORT`) is used for MDNS, the `mdns` +Since port 80 (or the port assigned to `CIRCUITPY_WEB_API_PORT`) is used for web workflow, the `mdns` [module](https://docs.circuitpython.org/en/latest/shared-bindings/mdns/index.html#mdns.Server.advertise_service) -can't also advertise a service on that port. +can't advertise an additional service on that port. ### HTTP The web server is HTTP 1.1 and may use chunked responses so that it doesn't need to precompute From 4e01674cbde4021731d452f0fa92bedb6664bb69 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 13 Jul 2023 14:49:08 -0700 Subject: [PATCH 1278/1712] Fix rp2 safe mode via reset press The picodvi PR #7880 switched the saved word to the watchdog register since it reworked the RAM layout. This works for reset_into_safe_mode because the watchdog scratch registers are preserved by soft resets. They *aren't* preserved for pressing the reset button. So it broken manual safe mode. Switch back to using RAM to store the saved word but use the pico-sdks "uninitialized" designation instead of a fixed location. Also fixes USB host feather status neopixel by setting the power pin. --- .../adafruit_feather_rp2040_usb_host/mpconfigboard.h | 1 + ports/raspberrypi/supervisor/port.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h b/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h index f300bfe711..053d5b523b 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/mpconfigboard.h @@ -2,6 +2,7 @@ #define MICROPY_HW_MCU_NAME "rp2040" #define MICROPY_HW_NEOPIXEL (&pin_GPIO21) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO20) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO3) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) diff --git a/ports/raspberrypi/supervisor/port.c b/ports/raspberrypi/supervisor/port.c index 08a9d96c2e..cfbf3b6a04 100644 --- a/ports/raspberrypi/supervisor/port.c +++ b/ports/raspberrypi/supervisor/port.c @@ -247,14 +247,15 @@ uint32_t *port_heap_get_top(void) { return port_stack_get_top(); } +uint32_t __uninitialized_ram(saved_word); void port_set_saved_word(uint32_t value) { - // Store in a watchdog scratch register instead of RAM. 4-7 are used by the - // sdk. 0 is used by alarm. 1-3 are free. - watchdog_hw->scratch[1] = value; + // Store in RAM because the watchdog scratch registers don't survive + // resetting by pulling the RUN pin low. + saved_word = value; } uint32_t port_get_saved_word(void) { - return watchdog_hw->scratch[1]; + return saved_word; } static volatile bool ticks_enabled; From 9642e387839c7fad564edc9909f22e8fcf2bec2e Mon Sep 17 00:00:00 2001 From: Seon Rozenblum Date: Tue, 13 Jun 2023 19:00:08 +1000 Subject: [PATCH 1279/1712] Added second I2C B\bus IO and stuff for FeatherS3 --- .../unexpectedmaker_feathers3/mpconfigboard.h | 5 +-- .../boards/unexpectedmaker_feathers3/pins.c | 32 +++++++++++++++---- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h index 67054b8664..1d51cb77d9 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h @@ -34,8 +34,9 @@ #define MICROPY_HW_LED_STATUS (&pin_GPIO13) -#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) -#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) +#define CIRCUITPY_BOARD_I2C (2) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO9, .sda = &pin_GPIO8}, \ + {.scl = &pin_GPIO15, .sda = &pin_GPIO16}} #define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/pins.c b/ports/espressif/boards/unexpectedmaker_feathers3/pins.c index 9a2fde5a0c..4480e01438 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/pins.c +++ b/ports/espressif/boards/unexpectedmaker_feathers3/pins.c @@ -1,5 +1,7 @@ #include "shared-bindings/board/__init__.h" +CIRCUITPY_BOARD_BUS_SINGLETON(stemma_i2c, i2c, 1) + STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS @@ -89,11 +91,16 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, // Blue LED + // Blue LED + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + + // STEMMA QT Vertical Connector I2C IO + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_SCL2), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_SDA2), MP_ROM_PTR(&pin_GPIO16) }, // Battery voltage sense pin - // I really don't know what name to use here. Adafruit use BATTERY & VOLTAGE_MONITOR - // I prefer VBAT or VBAT_SENSE { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_VBAT_SENSE), MP_ROM_PTR(&pin_GPIO2) }, @@ -103,18 +110,29 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_VBUS), MP_ROM_PTR(&pin_GPIO34) }, { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO34) }, + // Neopixel pins { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO39) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO40) }, - { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, // Ambient Light Sensor - { MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, // Ambient Light Sensor + // Ambient Light Sensor + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO39) }, // Second LDO Enable control - { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, // Second LDO Enable control + // Second LDO Enable control + { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + // I2C { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_VERTICAL_I2C), MP_ROM_PTR(&board_stemma_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA2_I2C), MP_ROM_PTR(&board_stemma_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C2), MP_ROM_PTR(&board_stemma_i2c_obj) }, + + // SPI { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + + // UART { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 03e93f8e6c5e92ee6d580c998343cd18834c6a37 Mon Sep 17 00:00:00 2001 From: KB Sriram Date: Fri, 14 Jul 2023 21:53:58 -0700 Subject: [PATCH 1280/1712] py/objdict: Fix fromkeys to return the right type. Fixes https://github.com/adafruit/circuitpython/issues/8173 It looks like a small fix, and mostly independent of upstream plans around https://github.com/micropython/micropython/pull/6173 I also filed an issue upstream https://github.com/micropython/micropython/issues/12011 --- py/objdict.c | 16 ++++++++++++---- tests/basics/ordereddict1.py | 11 +++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/py/objdict.c b/py/objdict.c index 02aedacdd6..b63ea89137 100644 --- a/py/objdict.c +++ b/py/objdict.c @@ -110,8 +110,10 @@ STATIC void dict_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_ } } -mp_obj_t mp_obj_dict_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { - mp_obj_t dict_out = mp_obj_new_dict(0); +// This is a helper function to initialize an empty, but typed dictionary with +// a given number of slots. +STATIC mp_obj_t dict_new_typed(const mp_obj_type_t *type, const size_t n) { + mp_obj_t dict_out = mp_obj_new_dict(n); mp_obj_dict_t *dict = MP_OBJ_TO_PTR(dict_out); dict->base.type = type; #if MICROPY_PY_COLLECTIONS_ORDEREDDICT @@ -119,6 +121,11 @@ mp_obj_t mp_obj_dict_make_new(const mp_obj_type_t *type, size_t n_args, size_t n dict->map.is_ordered = 1; } #endif + return dict_out; +} + +mp_obj_t mp_obj_dict_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { + mp_obj_t dict_out = dict_new_typed(type, 0); if (n_args > 0 || n_kw > 0) { mp_obj_t args2[2] = {dict_out, args[0]}; // args[0] is always valid, even if it's not a positional arg mp_map_t kwargs; @@ -264,6 +271,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_copy_obj, mp_obj_dict_copy); #if MICROPY_PY_BUILTINS_DICT_FROMKEYS // this is a classmethod STATIC mp_obj_t dict_fromkeys(size_t n_args, const mp_obj_t *args) { + mp_obj_type_t *type = MP_OBJ_TO_PTR(args[0]); mp_obj_t iter = mp_getiter(args[1], NULL); mp_obj_t value = mp_const_none; mp_obj_t next = MP_OBJ_NULL; @@ -277,9 +285,9 @@ STATIC mp_obj_t dict_fromkeys(size_t n_args, const mp_obj_t *args) { mp_obj_t len = mp_obj_len_maybe(args[1]); if (len == MP_OBJ_NULL) { /* object's type doesn't have a __len__ slot */ - self_out = mp_obj_new_dict(0); + self_out = dict_new_typed(type, 0); } else { - self_out = mp_obj_new_dict(MP_OBJ_SMALL_INT_VALUE(len)); + self_out = dict_new_typed(type, MP_OBJ_SMALL_INT_VALUE(len)); } mp_obj_dict_t *self = MP_OBJ_TO_PTR(self_out); diff --git a/tests/basics/ordereddict1.py b/tests/basics/ordereddict1.py index a6f305ff78..b70d7ff5d1 100644 --- a/tests/basics/ordereddict1.py +++ b/tests/basics/ordereddict1.py @@ -41,3 +41,14 @@ try: d.popitem() except: print('empty') + +# fromkeys returns the correct type and order +d = dict.fromkeys('abcdefghij') +print(type(d) == dict) +d = OrderedDict.fromkeys('abcdefghij') +print(type(d) == OrderedDict) +print(''.join(d)) + +# fromkey handles ordering with duplicates +d = OrderedDict.fromkeys('abcdefghijjihgfedcba') +print(''.join(d)) From 1e2b25be56f95ae7d36b67c5c69a115a05c917c9 Mon Sep 17 00:00:00 2001 From: Jose David M Date: Sat, 15 Jul 2023 01:18:59 +0000 Subject: [PATCH 1281/1712] Translated using Weblate (Spanish) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/es.po b/locale/es.po index 6b832dccfd..ba8b07d0dd 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-07-10 14:50+0000\n" +"PO-Revision-Date: 2023-07-16 04:32+0000\n" "Last-Translator: Jose David M \n" "Language-Team: \n" "Language: es\n" @@ -488,7 +488,7 @@ msgstr "Todos los canales están en uso" #: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All dma channels in use" -msgstr "" +msgstr "Todos los canales DMA en uso" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" From 2295b1f1ea8e13d11997df8815714c5948f0853a Mon Sep 17 00:00:00 2001 From: hexthat Date: Sat, 15 Jul 2023 03:49:33 +0000 Subject: [PATCH 1282/1712] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index ba6a621b6b..4f56b14dfd 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,15 +7,15 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-05-21 00:49+0000\n" -"Last-Translator: Scott Shawcroft \n" +"PO-Revision-Date: 2023-07-16 04:32+0000\n" +"Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.18-dev\n" +"X-Generator: Weblate 5.0-dev\n" #: main.c msgid "" @@ -489,7 +489,7 @@ msgstr "suǒyǒu píndào dōu zài shǐyòng zhōng" #: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All dma channels in use" -msgstr "" +msgstr "suǒyǒu Zhíjiē nèicún fǎngwèn dōu zài shǐyòng zhōng" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" @@ -2528,7 +2528,7 @@ msgstr "zhù shì bì xū shì biāo zhì fú" #: extmod/ulab/code/numpy/create.c msgid "arange: cannot compute length" -msgstr "" +msgstr "fànwéi: wúfǎ jìsuàn chángdù" #: py/modbuiltins.c msgid "arg is an empty sequence" @@ -2704,7 +2704,7 @@ msgstr "zhǐyǒu Xtensa zǔjiàn zuìduō 4 cānshù" #: extmod/ulab/code/ndarray.c msgid "can only specify one unknown dimension" -msgstr "" +msgstr "zhǐ néngzhǐ dìngyígè wèizhī wéidù" #: py/objtype.c msgid "can't add special method to already-subclassed class" @@ -2860,7 +2860,7 @@ msgstr "wúfǎ dǎorù míngchēng %q" #: extmod/ulab/code/ndarray.c msgid "cannot reshape array" -msgstr "" +msgstr "wúfǎ chóngsù zhènliè xíngzhuàng" #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" @@ -4033,7 +4033,7 @@ msgstr "shè zhì bù shòu zhī chí" #: extmod/ulab/code/ndarray.c msgid "shape must be integer or tuple of integers" -msgstr "" +msgstr "xíngzhuàng bìxū shì zhěngshù huò zhěngshù yuánzǔ" #: shared-module/msgpack/__init__.c msgid "short read" From 8289722679678ce3cf45c642c0658bce0a33d558 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Sun, 16 Jul 2023 20:35:49 -0500 Subject: [PATCH 1283/1712] docs: wifi.radio.ipv4_address_ap is read-only --- shared-bindings/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 66502426cd..c3c271b0da 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -616,7 +616,7 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_address_obj, (mp_obj_t)&wifi_radio_get_ipv4_address_obj); //| ipv4_address_ap: Optional[ipaddress.IPv4Address] -//| """IP v4 Address of the access point, when enabled. None otherwise.""" +//| """IP v4 Address of the access point, when enabled. None otherwise. (read-only)""" STATIC mp_obj_t wifi_radio_get_ipv4_address_ap(mp_obj_t self) { return common_hal_wifi_radio_get_ipv4_address_ap(self); } From fd1fdee312881c020f75e3f82c3b89df858b7c71 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 17 Jul 2023 09:08:13 -0500 Subject: [PATCH 1284/1712] move set_user_keymap to usb_host module --- shared-bindings/usb/__init__.c | 31 --------------------------- shared-bindings/usb_host/__init__.c | 33 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 31 deletions(-) diff --git a/shared-bindings/usb/__init__.c b/shared-bindings/usb/__init__.c index b22fce8011..1227db01e1 100644 --- a/shared-bindings/usb/__init__.c +++ b/shared-bindings/usb/__init__.c @@ -37,41 +37,10 @@ //| The `usb` is a subset of PyUSB that allows you to communicate to USB devices. //| """ //| -//| def set_user_keymap(keymap: ReadableBuffer, /) -> None: -//| """Set the keymap used by a USB HID keyboard in kernel mode -//| -//| The keymap consists of 256 or 384 1-byte entries that map from USB keycodes -//| to ASCII codes. The first 128 entries are for unmodified keys, -//| the next 128 entries are for shifted keys,and the next optional 128 entries are -//| for altgr-modified keys. -//| -//| The values must all be ASCII (32 through 126 inclusive); other values are not valid. -//| -//| The values at index 0, 128, and 256 (if the keymap has 384 entries) must be -//| 0; other values are reserved for future expansion to indicate alternate -//| keymap formats. -//| -//| At other indices, the value 0 is used to indicate that the normal -//| definition is still used. For instance, the entry for HID_KEY_ARROW_UP -//| (0x52) is usually 0 so that the default behavior of sending an escape code -//| is preserved. -//| -//| This function is a CircuitPython extension not present in PyUSB -//| """ -//| -STATIC mp_obj_t usb_set_user_keymap(mp_obj_t buf_in) { - mp_buffer_info_t bufinfo; - mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); - usb_keymap_set(bufinfo.buf, bufinfo.len); - return mp_const_none; -} - -MP_DEFINE_CONST_FUN_OBJ_1(usb_set_user_keymap_obj, usb_set_user_keymap); STATIC mp_rom_map_elem_t usb_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_usb) }, { MP_ROM_QSTR(MP_QSTR_core), MP_OBJ_FROM_PTR(&usb_core_module) }, - { MP_ROM_QSTR(MP_QSTR_set_user_keymap), MP_OBJ_FROM_PTR(&usb_set_user_keymap_obj) }, }; STATIC MP_DEFINE_CONST_DICT(usb_module_globals, usb_module_globals_table); diff --git a/shared-bindings/usb_host/__init__.c b/shared-bindings/usb_host/__init__.c index 5c884b3ec2..74ee78b3b3 100644 --- a/shared-bindings/usb_host/__init__.c +++ b/shared-bindings/usb_host/__init__.c @@ -30,16 +30,49 @@ #include "shared-bindings/usb_host/__init__.h" #include "shared-bindings/usb_host/Port.h" +#include "supervisor/usb.h" //| """USB Host //| //| The `usb_host` module allows you to manage USB host ports. To communicate //| with devices use the `usb` module that is a subset of PyUSB's API. //| """ +//| +//| def set_user_keymap(keymap: ReadableBuffer, /) -> None: +//| """Set the keymap used by a USB HID keyboard in kernel mode +//| +//| The keymap consists of 256 or 384 1-byte entries that map from USB keycodes +//| to ASCII codes. The first 128 entries are for unmodified keys, +//| the next 128 entries are for shifted keys,and the next optional 128 entries are +//| for altgr-modified keys. +//| +//| The values must all be ASCII (32 through 126 inclusive); other values are not valid. +//| +//| The values at index 0, 128, and 256 (if the keymap has 384 entries) must be +//| 0; other values are reserved for future expansion to indicate alternate +//| keymap formats. +//| +//| At other indices, the value 0 is used to indicate that the normal +//| definition is still used. For instance, the entry for HID_KEY_ARROW_UP +//| (0x52) is usually 0 so that the default behavior of sending an escape code +//| is preserved. +//| +//| This function is a CircuitPython extension not present in PyUSB +//| """ +//| +STATIC mp_obj_t usb_set_user_keymap(mp_obj_t buf_in) { + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_READ); + usb_keymap_set(bufinfo.buf, bufinfo.len); + return mp_const_none; +} + +MP_DEFINE_CONST_FUN_OBJ_1(usb_set_user_keymap_obj, usb_set_user_keymap); STATIC mp_map_elem_t usb_host_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_OBJ_NEW_QSTR(MP_QSTR_usb_host) }, { MP_ROM_QSTR(MP_QSTR_Port), MP_OBJ_FROM_PTR(&usb_host_port_type) }, + { MP_ROM_QSTR(MP_QSTR_set_user_keymap), MP_OBJ_FROM_PTR(&usb_set_user_keymap_obj) }, }; STATIC MP_DEFINE_CONST_DICT(usb_host_module_globals, usb_host_module_globals_table); From 4f090782934219332d0137f0f07b3bc775d2034e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 17 Jul 2023 12:56:55 -0500 Subject: [PATCH 1285/1712] update metro rp2040 to work with 16MB flash --- ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk index 14b3af9d57..20c3042b7a 100644 --- a/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk +++ b/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk @@ -6,4 +6,4 @@ USB_MANUFACTURER = "Adafruit" CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 -EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ" +EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ,W25Q128JV" From dd266f2622ebb864342e75ca778e5a9ca9363626 Mon Sep 17 00:00:00 2001 From: ladyada Date: Tue, 18 Jul 2023 01:02:38 -0400 Subject: [PATCH 1286/1712] renamed since we are now s3 --- .../board.c | 0 .../mpconfigboard.h | 2 +- .../mpconfigboard.mk | 4 ++- .../pins.c | 0 .../sdkconfig | 29 +++++++++++++++---- 5 files changed, 27 insertions(+), 8 deletions(-) rename ports/espressif/boards/{adafruit_esp32s2_camera => adafruit_esp32s3_camera}/board.c (100%) rename ports/espressif/boards/{adafruit_esp32s2_camera => adafruit_esp32s3_camera}/mpconfigboard.h (97%) rename ports/espressif/boards/{adafruit_esp32s2_camera => adafruit_esp32s3_camera}/mpconfigboard.mk (79%) rename ports/espressif/boards/{adafruit_esp32s2_camera => adafruit_esp32s3_camera}/pins.c (100%) rename ports/espressif/boards/{adafruit_esp32s2_camera => adafruit_esp32s3_camera}/sdkconfig (61%) diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/board.c b/ports/espressif/boards/adafruit_esp32s3_camera/board.c similarity index 100% rename from ports/espressif/boards/adafruit_esp32s2_camera/board.c rename to ports/espressif/boards/adafruit_esp32s3_camera/board.c diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.h similarity index 97% rename from ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h rename to ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.h index 64ab1b966d..8c0c9cdaae 100644 --- a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.h @@ -27,7 +27,7 @@ // Micropython setup #define MICROPY_HW_BOARD_NAME "Adafruit Camera" -#define MICROPY_HW_MCU_NAME "ESP32S2" +#define MICROPY_HW_MCU_NAME "ESP32S3" #define MICROPY_HW_NEOPIXEL (&pin_GPIO21) #define MICROPY_HW_NEOPIXEL_COUNT (1) diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk similarity index 79% rename from ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.mk rename to ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk index 1823c1dd88..df7e62511a 100644 --- a/ports/espressif/boards/adafruit_esp32s2_camera/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk @@ -3,8 +3,10 @@ USB_PID = 0x8118 USB_PRODUCT = "Camera" USB_MANUFACTURER = "Adafruit" -IDF_TARGET = esp32s2 +IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESPCAMERA = 1 diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/pins.c b/ports/espressif/boards/adafruit_esp32s3_camera/pins.c similarity index 100% rename from ports/espressif/boards/adafruit_esp32s2_camera/pins.c rename to ports/espressif/boards/adafruit_esp32s3_camera/pins.c diff --git a/ports/espressif/boards/adafruit_esp32s2_camera/sdkconfig b/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig similarity index 61% rename from ports/espressif/boards/adafruit_esp32s2_camera/sdkconfig rename to ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig index 9d8bbde967..02056b1348 100644 --- a/ports/espressif/boards/adafruit_esp32s2_camera/sdkconfig +++ b/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig @@ -1,25 +1,32 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y # # SPI RAM config # -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set # CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set # CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set CONFIG_SPIRAM_SIZE=2097152 # -# PSRAM clock and cs IO for ESP32S2 +# PSRAM Clock and CS IO for ESP32S3 # CONFIG_DEFAULT_PSRAM_CLK_IO=30 CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 +# end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set # CONFIG_SPIRAM_RODATA is not set # CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y +CONFIG_SPIRAM_SPEED_80M=y # CONFIG_SPIRAM_SPEED_26M is not set # CONFIG_SPIRAM_SPEED_20M is not set CONFIG_SPIRAM=y @@ -31,3 +38,13 @@ CONFIG_SPIRAM_USE_MEMMAP=y CONFIG_SPIRAM_MEMTEST=y # CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP + +# end of Component config From 1629faf8b3c662d86a9f572b8388263cf9711800 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 13 Jul 2023 14:47:05 -0700 Subject: [PATCH 1287/1712] Make usb_host.Port a singleton This allows you to initialize usb_host.Port once successfully and then returns the same object as long as you pass the same arguments in. It does allow you to fix incorrect pins but not switching from one valid set to another. (It needs a reset for that.) This also moves hcd cache operations to RAM so that they don't access the cache when doing maintenance. --- lib/tinyusb | 2 +- ports/mimxrt10xx/boards/imxrt1060_evk/board.c | 6 +++ .../mimxrt10xx/boards/imxrt1060_evkb/board.c | 8 ++- ports/mimxrt10xx/boards/teensy41/board.c | 6 +++ ports/mimxrt10xx/common-hal/usb_host/Port.c | 35 +++++++++---- ports/mimxrt10xx/common-hal/usb_host/Port.h | 7 +-- ports/mimxrt10xx/linking/common.ld | 5 +- ports/mimxrt10xx/supervisor/usb.c | 7 ++- .../adafruit_feather_rp2040_usb_host/board.c | 3 +- ports/raspberrypi/common-hal/usb_host/Port.c | 33 +++++++----- ports/raspberrypi/common-hal/usb_host/Port.h | 7 +-- shared-bindings/usb_host/Port.c | 51 +++++-------------- shared-bindings/usb_host/Port.h | 8 +-- supervisor/shared/usb/tusb_config.h | 3 +- 14 files changed, 97 insertions(+), 84 deletions(-) diff --git a/lib/tinyusb b/lib/tinyusb index f1e006d09b..6c7c9f2ef5 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit f1e006d09bd32088ab421d0b519eb89c531eda4e +Subproject commit 6c7c9f2ef5a80d5a6879e9c3558162188c6cf889 diff --git a/ports/mimxrt10xx/boards/imxrt1060_evk/board.c b/ports/mimxrt10xx/boards/imxrt1060_evk/board.c index 4a2e6e0913..12278acabb 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evk/board.c +++ b/ports/mimxrt10xx/boards/imxrt1060_evk/board.c @@ -28,6 +28,8 @@ #include "supervisor/board.h" #include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/usb_host/Port.h" + // These pins should never ever be reset; doing so could interfere with basic operation. // Used in common-hal/microcontroller/Pin.c const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { @@ -55,4 +57,8 @@ const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { NULL, // Must end in NULL. }; +void board_init(void) { + common_hal_usb_host_port_construct(&pin_USB_OTG2_DP, &pin_USB_OTG2_DN); +} + // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/imxrt1060_evkb/board.c b/ports/mimxrt10xx/boards/imxrt1060_evkb/board.c index 4a2e6e0913..26dd28cbb4 100644 --- a/ports/mimxrt10xx/boards/imxrt1060_evkb/board.c +++ b/ports/mimxrt10xx/boards/imxrt1060_evkb/board.c @@ -28,6 +28,8 @@ #include "supervisor/board.h" #include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/usb_host/Port.h" + // These pins should never ever be reset; doing so could interfere with basic operation. // Used in common-hal/microcontroller/Pin.c const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { @@ -52,7 +54,11 @@ const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { // USB Pins &pin_GPIO_AD_B0_01, // ID Pin &pin_GPIO_AD_B0_03, // OC/Fault Pin - NULL, // Must end in NULL. + NULL, // Must end in NULL. }; +void board_init(void) { + common_hal_usb_host_port_construct(&pin_USB_OTG2_DP, &pin_USB_OTG2_DN); +} + // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/boards/teensy41/board.c b/ports/mimxrt10xx/boards/teensy41/board.c index 8ece1546d7..3418cff43f 100644 --- a/ports/mimxrt10xx/boards/teensy41/board.c +++ b/ports/mimxrt10xx/boards/teensy41/board.c @@ -28,6 +28,8 @@ #include "supervisor/board.h" #include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/usb_host/Port.h" + // These pins should never ever be reset; doing so could interfere with basic operation. // Used in common-hal/microcontroller/Pin.c const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { @@ -54,4 +56,8 @@ const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { NULL, // Must end in NULL. }; +void board_init(void) { + common_hal_usb_host_port_construct(&pin_USB_OTG2_DP, &pin_USB_OTG2_DN); +} + // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/mimxrt10xx/common-hal/usb_host/Port.c b/ports/mimxrt10xx/common-hal/usb_host/Port.c index 126160c69c..444c410729 100644 --- a/ports/mimxrt10xx/common-hal/usb_host/Port.c +++ b/ports/mimxrt10xx/common-hal/usb_host/Port.c @@ -29,9 +29,13 @@ #include "py/runtime.h" -bool usb_host_init; +#include "tusb.h" -void common_hal_usb_host_port_construct(usb_host_port_obj_t *self, const mcu_pin_obj_t *dp, const mcu_pin_obj_t *dm) { +#include "imx_usb.h" + +usb_host_port_obj_t usb_host_instance; + +usb_host_port_obj_t *common_hal_usb_host_port_construct(const mcu_pin_obj_t *dp, const mcu_pin_obj_t *dm) { const mcu_pin_obj_t *supported_dp; const mcu_pin_obj_t *supported_dm; if (CIRCUITPY_USB_HOST_INSTANCE == 0) { @@ -41,18 +45,27 @@ void common_hal_usb_host_port_construct(usb_host_port_obj_t *self, const mcu_pin supported_dp = &pin_USB_OTG2_DP; supported_dm = &pin_USB_OTG2_DN; } + // Return the singleton if given the same pins. + usb_host_port_obj_t *self = &usb_host_instance; + if (self->dp != NULL) { + if (self->dp != dp || self->dm != dm) { + mp_raise_msg_varg(&mp_type_RuntimeError, translate("%q in use"), MP_QSTR_usb_host); + } + return self; + } if (dp != supported_dp || dm != supported_dm) { raise_ValueError_invalid_pins(); } - self->init = true; - usb_host_init = true; -} -void common_hal_usb_host_port_deinit(usb_host_port_obj_t *self) { - self->init = false; - usb_host_init = false; -} + assert_pin_free(dp); + assert_pin_free(dm); -bool common_hal_usb_host_port_deinited(usb_host_port_obj_t *self) { - return !self->init; + init_usb_instance(CIRCUITPY_USB_HOST_INSTANCE); + tuh_init(TUH_OPT_RHPORT); + + self->base.type = &usb_host_port_type; + self->dp = dp; + self->dm = dm; + + return self; } diff --git a/ports/mimxrt10xx/common-hal/usb_host/Port.h b/ports/mimxrt10xx/common-hal/usb_host/Port.h index dad1adf3a2..59f7735439 100644 --- a/ports/mimxrt10xx/common-hal/usb_host/Port.h +++ b/ports/mimxrt10xx/common-hal/usb_host/Port.h @@ -31,11 +31,8 @@ typedef struct { mp_obj_base_t base; - bool init; + const mcu_pin_obj_t *dp; + const mcu_pin_obj_t *dm; } usb_host_port_obj_t; -// Cheater state so that the usb module knows if it should return the TinyUSB -// state. -extern bool usb_host_init; - #endif // MICROPY_INCLUDED_MIMXRT10XX_COMMON_HAL_USB_HOST_PORT_H diff --git a/ports/mimxrt10xx/linking/common.ld b/ports/mimxrt10xx/linking/common.ld index 71e2c457c3..6e674a49f2 100644 --- a/ports/mimxrt10xx/linking/common.ld +++ b/ports/mimxrt10xx/linking/common.ld @@ -71,7 +71,7 @@ SECTIONS . = ALIGN(4); *(EXCLUDE_FILE( *fsl_flexspi.o - *dcd_ci_hs.o + *cd_ci_hs.o *ehci.o *tusb_fifo.o *usbd.o @@ -88,6 +88,9 @@ SECTIONS /* Keep USB processing functions out of RAM because we don't know which will be used. We try to only keep USB interrupt related functions. */ *dcd_ci_hs.o(.text.process_*_request .text.dcd_edpt* .text.dcd_init .text.dcd_set_address) + /* Move hcd_dcache* routines to RAM so that we don't cross execution from + the cache during cache maintenance. Weird things happen when we do. */ + *hcd_ci_hs.o(.text.hcd_i*) *usbd.o(.text.process_*_request .text.process_[gs]et* .text.tud_* .text.usbd_* .text.configuration_reset .text.invoke_*) *ehci.o(.text.hcd_edpt* .text.hcd_setup* .text.ehci_init* .text.hcd_port* .text.hcd_device* .text.qtd_init* .text.list_remove*) diff --git a/ports/mimxrt10xx/supervisor/usb.c b/ports/mimxrt10xx/supervisor/usb.c index 64a2639c16..ab0bd15b51 100644 --- a/ports/mimxrt10xx/supervisor/usb.c +++ b/ports/mimxrt10xx/supervisor/usb.c @@ -31,7 +31,9 @@ #include "supervisor/linker.h" #include "supervisor/usb.h" -STATIC void init_usb_instance(mp_int_t instance) { +#include "imx_usb.h" + +void init_usb_instance(mp_int_t instance) { if (instance < 0) { return; } @@ -72,9 +74,6 @@ STATIC void init_usb_instance(mp_int_t instance) { void init_usb_hardware(void) { init_usb_instance(CIRCUITPY_USB_DEVICE_INSTANCE); - // We can't dynamically start the USB Host port at the moment, so do it - // up front. - init_usb_instance(CIRCUITPY_USB_HOST_INSTANCE); } // Provide the prototypes for the interrupt handlers. The iMX RT SDK doesn't. diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/board.c b/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/board.c index 724fde1d27..1d054a03ac 100644 --- a/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/board.c +++ b/ports/raspberrypi/boards/adafruit_feather_rp2040_usb_host/board.c @@ -31,7 +31,6 @@ // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. -usb_host_port_obj_t _host_port; digitalio_digitalinout_obj_t _host_power; void board_init(void) { @@ -39,5 +38,5 @@ void board_init(void) { common_hal_digitalio_digitalinout_never_reset(&_host_power); common_hal_digitalio_digitalinout_switch_to_output(&_host_power, true, DRIVE_MODE_PUSH_PULL); - common_hal_usb_host_port_construct(&_host_port, &pin_GPIO16, &pin_GPIO17); + common_hal_usb_host_port_construct(&pin_GPIO16, &pin_GPIO17); } diff --git a/ports/raspberrypi/common-hal/usb_host/Port.c b/ports/raspberrypi/common-hal/usb_host/Port.c index 9ad28c73ea..93d19acd69 100644 --- a/ports/raspberrypi/common-hal/usb_host/Port.c +++ b/ports/raspberrypi/common-hal/usb_host/Port.c @@ -45,7 +45,7 @@ #include "supervisor/serial.h" -bool usb_host_init; +usb_host_port_obj_t usb_host_instance; STATIC PIO pio_instances[2] = {pio0, pio1}; volatile bool _core1_ready = false; @@ -102,10 +102,23 @@ STATIC bool _has_program_room(uint8_t pio_index, uint8_t program_size) { return pio_can_add_program(pio, &program_struct); } -void common_hal_usb_host_port_construct(usb_host_port_obj_t *self, const mcu_pin_obj_t *dp, const mcu_pin_obj_t *dm) { +usb_host_port_obj_t *common_hal_usb_host_port_construct(const mcu_pin_obj_t *dp, const mcu_pin_obj_t *dm) { if (dp->number + 1 != dm->number) { raise_ValueError_invalid_pins(); } + usb_host_port_obj_t *self = &usb_host_instance; + + // Return the singleton if given the same pins. + if (self->dp != NULL) { + if (self->dp != dp || self->dm != dm) { + mp_raise_msg_varg(&mp_type_RuntimeError, translate("%q in use"), MP_QSTR_usb_host); + } + return self; + } + + assert_pin_free(dp); + assert_pin_free(dm); + pio_usb_configuration_t pio_cfg = PIO_USB_DEFAULT_CONFIG; pio_cfg.skip_alarm_pool = true; pio_cfg.pin_dp = dp->number; @@ -122,6 +135,10 @@ void common_hal_usb_host_port_construct(usb_host_port_obj_t *self, const mcu_pin mp_raise_RuntimeError(translate("All dma channels in use")); } + self->base.type = &usb_host_port_type; + self->dp = dp; + self->dm = dm; + PIO tx_pio = pio_instances[pio_cfg.pio_tx_num]; pio_cfg.sm_tx = pio_claim_unused_sm(tx_pio, false); PIO rx_pio = pio_instances[pio_cfg.pio_rx_num]; @@ -151,15 +168,5 @@ void common_hal_usb_host_port_construct(usb_host_port_obj_t *self, const mcu_pin tuh_configure(TUH_OPT_RHPORT, TUH_CFGID_RPI_PIO_USB_CONFIGURATION, &pio_cfg); tuh_init(TUH_OPT_RHPORT); - self->init = true; - usb_host_init = true; -} - -void common_hal_usb_host_port_deinit(usb_host_port_obj_t *self) { - self->init = false; - usb_host_init = false; -} - -bool common_hal_usb_host_port_deinited(usb_host_port_obj_t *self) { - return !self->init; + return self; } diff --git a/ports/raspberrypi/common-hal/usb_host/Port.h b/ports/raspberrypi/common-hal/usb_host/Port.h index c9294debb2..69a7f8deaf 100644 --- a/ports/raspberrypi/common-hal/usb_host/Port.h +++ b/ports/raspberrypi/common-hal/usb_host/Port.h @@ -30,9 +30,6 @@ typedef struct { mp_obj_base_t base; - bool init; + const mcu_pin_obj_t *dp; + const mcu_pin_obj_t *dm; } usb_host_port_obj_t; - -// Cheater state so that the usb module knows if it should return the TinyUSB -// state. -extern bool usb_host_init; diff --git a/shared-bindings/usb_host/Port.c b/shared-bindings/usb_host/Port.c index 53b1fec54f..9be6da9df3 100644 --- a/shared-bindings/usb_host/Port.c +++ b/shared-bindings/usb_host/Port.c @@ -35,59 +35,36 @@ //| //| def __init__(self, dp: microcontroller.Pin, dm: microcontroller.Pin) -> None: //| """Create a USB host port on the given pins. Access attached devices -//| through the `usb` module. Keep this object referenced while -//| interacting with devices, otherwise they will be disconnected. +//| through the `usb` module. +//| +//| The resulting object lives longer than the CircuitPython VM so that +//| USB devices such as keyboards can continue to be used. Subsequent +//| calls to this constructor will return the same object and *not* +//| reinitialize the USB host port. It will raise an exception when +//| given different arguments from the first successful call. //| //| :param ~microcontroller.Pin dp: The data plus pin //| :param ~microcontroller.Pin dm: The data minus pin //| """ //| ... +//| STATIC mp_obj_t usb_host_port_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { // check number of arguments mp_arg_check_num(n_args, n_kw, 2, 2, false); - const mcu_pin_obj_t *dp = validate_obj_is_free_pin(args[0], MP_QSTR_dp); - const mcu_pin_obj_t *dm = validate_obj_is_free_pin(args[1], MP_QSTR_dm); + const mcu_pin_obj_t *dp = validate_obj_is_pin(args[0], MP_QSTR_dp); + const mcu_pin_obj_t *dm = validate_obj_is_pin(args[1], MP_QSTR_dm); - usb_host_port_obj_t *self = m_new_obj(usb_host_port_obj_t); - self->base.type = &usb_host_port_type; - common_hal_usb_host_port_construct(self, dp, dm); + // Pin in use checks happen in the implementation so they can be ignored + // when returning the singleton. + + usb_host_port_obj_t *self = common_hal_usb_host_port_construct(dp, dm); return (mp_obj_t)self; } -//| def deinit(self) -> None: -//| """Turn off the USB host port and release the pins for other use.""" -//| ... -STATIC mp_obj_t usb_host_port_obj_deinit(mp_obj_t self_in) { - usb_host_port_obj_t *self = MP_OBJ_TO_PTR(self_in); - common_hal_usb_host_port_deinit(self); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(usb_host_port_deinit_obj, usb_host_port_obj_deinit); - -//| def __enter__(self) -> Port: -//| """No-op used by Context Managers.""" -//| ... -// Provided by context manager helper. - -//| def __exit__(self) -> None: -//| """Automatically deinitializes the hardware when exiting a context. See -//| :ref:`lifetime-and-contextmanagers` for more info.""" -//| ... -//| -STATIC mp_obj_t usb_host_port_obj___exit__(size_t n_args, const mp_obj_t *args) { - (void)n_args; - common_hal_usb_host_port_deinit(MP_OBJ_TO_PTR(args[0])); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(usb_host_port_obj___exit___obj, 4, 4, usb_host_port_obj___exit__); - STATIC const mp_rom_map_elem_t usb_host_port_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&usb_host_port_deinit_obj) }, - { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }, - { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&usb_host_port_obj___exit___obj) }, }; STATIC MP_DEFINE_CONST_DICT(usb_host_port_locals_dict, usb_host_port_locals_dict_table); diff --git a/shared-bindings/usb_host/Port.h b/shared-bindings/usb_host/Port.h index 68645d1146..ba8d298517 100644 --- a/shared-bindings/usb_host/Port.h +++ b/shared-bindings/usb_host/Port.h @@ -35,8 +35,10 @@ extern const mp_obj_type_t usb_host_port_type; -void common_hal_usb_host_port_construct(usb_host_port_obj_t *self, const mcu_pin_obj_t *dp, const mcu_pin_obj_t *dm); -void common_hal_usb_host_port_deinit(usb_host_port_obj_t *self); -bool common_hal_usb_host_port_deinited(usb_host_port_obj_t *self); +// This is unique to common_hal constructs because it returns a globally stored +// object instead of taking on in that may be on the heap. This allows the +// method to check the internals of the global object against the given arguments +// to determine whether to return the singleton or raise an exception. +usb_host_port_obj_t *common_hal_usb_host_port_construct(const mcu_pin_obj_t *dp, const mcu_pin_obj_t *dm); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_USB_HOST_PORT_H diff --git a/supervisor/shared/usb/tusb_config.h b/supervisor/shared/usb/tusb_config.h index 19f5c0a0ce..d097005aac 100644 --- a/supervisor/shared/usb/tusb_config.h +++ b/supervisor/shared/usb/tusb_config.h @@ -152,7 +152,8 @@ extern "C" { #endif #define CFG_TUH_HID 2 -#define CFG_TUH_HUB 1 +// 2 hubs so we can support "7 port" hubs which have two internal hubs. +#define CFG_TUH_HUB 2 #define CFG_TUH_CDC 0 #define CFG_TUH_MSC 0 #define CFG_TUH_VENDOR 0 From 3f3ec1c8350c1cf6eca3031b9b551034abf6e1ba Mon Sep 17 00:00:00 2001 From: Qyriad Date: Tue, 18 Jul 2023 16:47:37 -0600 Subject: [PATCH 1288/1712] samx5x: support external clock sources Adds two board config define's, which can be added in a board's mpconfigboard.h: BOARD_XOSC_FREQ_HZ, and BOARD_XOSC_IS_CRYSTAL, which are passed to clock_init(). External clock sources are currently only implemented for SAM_D5X_E5X series chips, so defining BOARD_XOSC_FREQ_HZ for a SAMD21 board will emit an error. Signed-off-by: Qyriad --- ports/atmel-samd/mpconfigport.h | 24 ++++++++++++++++++++++++ ports/atmel-samd/peripherals | 2 +- ports/atmel-samd/supervisor/port.c | 4 ++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/mpconfigport.h b/ports/atmel-samd/mpconfigport.h index 73686e1445..6fb969e47b 100644 --- a/ports/atmel-samd/mpconfigport.h +++ b/ports/atmel-samd/mpconfigport.h @@ -173,6 +173,30 @@ #define BOARD_HAS_CRYSTAL (0) #endif +#ifndef BOARD_XOSC_FREQ_HZ +// 0 Indicates XOSC is not used. + #define BOARD_XOSC_FREQ_HZ (0) +#else +// For now, only allow external clock sources that divide cleanly into +// the system clock frequency of 120 MHz. + #if (120000000 % BOARD_XOSC_FREQ_HZ) != 0 + #error "BOARD_XOSC_FREQ_HZ must be an integer factor of 120 MHz" + #endif +#endif + +#if BOARD_XOSC_FREQ_HZ != 0 +// External clock sources are currently not implemented for SAMD21 chips. + #ifdef SAMD21 + #error "BOARD_XOSC_FREQ_HZ is non-zero but external clock sources are not yet supported for SAMD21 chips" + #endif + #ifndef BOARD_XOSC_IS_CRYSTAL + #error "BOARD_XOSC_IS_CRYSTAL must be defined to 0 or 1 if BOARD_XOSC_FREQ_HZ is not 0" + #endif +#else +// It doesn't matter what the value is in this case. + #define BOARD_XOSC_IS_CRYSTAL (0) +#endif + // if CALIBRATE_CRYSTALLESS is requested, make room for storing // calibration data generated from external USB. #ifndef CIRCUITPY_INTERNAL_CONFIG_SIZE diff --git a/ports/atmel-samd/peripherals b/ports/atmel-samd/peripherals index baca4c0843..82e514b6e0 160000 --- a/ports/atmel-samd/peripherals +++ b/ports/atmel-samd/peripherals @@ -1 +1 @@ -Subproject commit baca4c084334aa8625f525a4032d66a397199ea6 +Subproject commit 82e514b6e0d1a2b09dc73be9973663b6b837a817 diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 8cba5c61e0..8ae2d3740e 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -353,10 +353,10 @@ safe_mode_t port_init(void) { if (strcmp((char *)CIRCUITPY_INTERNAL_CONFIG_START_ADDR, "CIRCUITPYTHON1") == 0) { fine = ((uint16_t *)CIRCUITPY_INTERNAL_CONFIG_START_ADDR)[8]; } - clock_init(BOARD_HAS_CRYSTAL, fine); + clock_init(BOARD_HAS_CRYSTAL, BOARD_XOSC_FREQ_HZ, BOARD_XOSC_IS_CRYSTAL, fine); #else // Use a default fine value - clock_init(BOARD_HAS_CRYSTAL, DEFAULT_DFLL48M_FINE_CALIBRATION); + clock_init(BOARD_HAS_CRYSTAL, BOARD_XOSC_FREQ_HZ, BOARD_XOSC_IS_CRYSTAL, DEFAULT_DFLL48M_FINE_CALIBRATION); #endif rtc_init(); From e81ed62cfd8e024929c70d6aeed6c2994de52cd4 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 19 Jul 2023 11:46:04 -0700 Subject: [PATCH 1289/1712] Add missing header file --- ports/mimxrt10xx/imx_usb.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 ports/mimxrt10xx/imx_usb.h diff --git a/ports/mimxrt10xx/imx_usb.h b/ports/mimxrt10xx/imx_usb.h new file mode 100644 index 0000000000..7ae7df8461 --- /dev/null +++ b/ports/mimxrt10xx/imx_usb.h @@ -0,0 +1,31 @@ +/* + * This file is part of the Micro Python project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2022 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. + */ + +#pragma once + +// Provided by supervisor/usb.c that has a shared, non-port-specific header. So, +// just define it here. +void init_usb_instance(mp_int_t instance); From b10294e939bd97614f8a81c89701f1aed4995236 Mon Sep 17 00:00:00 2001 From: Luc Date: Tue, 18 Jul 2023 20:48:23 +0000 Subject: [PATCH 1290/1712] Translated using Weblate (German) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/de/ --- locale/de_DE.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/de_DE.po b/locale/de_DE.po index 41d873e7ff..e706cb81c5 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-07-10 14:50+0000\n" +"PO-Revision-Date: 2023-07-19 21:06+0000\n" "Last-Translator: Luc \n" "Language: de_DE\n" "MIME-Version: 1.0\n" @@ -487,7 +487,7 @@ msgstr "Alle Kanäle werden verwendet" #: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All dma channels in use" -msgstr "" +msgstr "All DMA-Kanäle in Verwendung" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" From b2c329735807aaca1a100663ebee9ca03f0276e1 Mon Sep 17 00:00:00 2001 From: Andi Chandler Date: Mon, 17 Jul 2023 20:14:52 +0000 Subject: [PATCH 1291/1712] Translated using Weblate (English (United Kingdom)) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/en_GB/ --- locale/en_GB.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/en_GB.po b/locale/en_GB.po index c4d1039de7..02d8748cf8 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-05-23 22:55+0000\n" +"PO-Revision-Date: 2023-07-19 21:06+0000\n" "Last-Translator: Andi Chandler \n" "Language-Team: none\n" "Language: en_GB\n" @@ -15,7 +15,7 @@ msgstr "" "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.18-dev\n" +"X-Generator: Weblate 5.0-dev\n" #: main.c msgid "" @@ -486,7 +486,7 @@ msgstr "All channels in use" #: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All dma channels in use" -msgstr "" +msgstr "All DMA channels in use" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" @@ -1378,7 +1378,7 @@ msgstr "Mismatched swap flag" #: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "Missing MISO or MOSI Pin" -msgstr "Missing MISO or MOSI pin" +msgstr "Missing MISO or MOSI Pin" #: ports/stm/common-hal/busio/SPI.c msgid "Missing MISO or MOSI pin" @@ -1493,7 +1493,7 @@ msgstr "No IP" #: ports/espressif/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MISO Pin" -msgstr "No MISO pin" +msgstr "No MISO Pin" #: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c msgid "No MISO pin" @@ -1502,7 +1502,7 @@ msgstr "No MISO pin" #: ports/espressif/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/SPI.c msgid "No MOSI Pin" -msgstr "No MOSI pin" +msgstr "No MOSI Pin" #: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c msgid "No MOSI pin" From 8ea0835ff62c487b23e5574e9dce95f9474e0cf9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 20 Jul 2023 10:51:11 -0500 Subject: [PATCH 1292/1712] Allow any files to be rendered as jinja templates by including a comment ".. jinja" anywhere in the file. By convention, this should be at the top. os.getenv will use this so it can render a 'supported boards' list. --- docs/rstjinja.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/rstjinja.py b/docs/rstjinja.py index 7ab92a9793..5cac1a5e15 100644 --- a/docs/rstjinja.py +++ b/docs/rstjinja.py @@ -1,6 +1,15 @@ # Derived from code on Eric Holscher's blog, found at: # https://www.ericholscher.com/blog/2016/jul/25/integrating-jinja-rst-sphinx/ +import re + +def render_with_jinja(docname, source): + if "shared-bindings/support_matrix" in docname: + return True + if re.search('^\s+.. jinja$', source[0], re.M): + return True + return False + def rstjinja(app, docname, source): """ Render our pages as a jinja template for fancy templating goodness. @@ -9,12 +18,12 @@ def rstjinja(app, docname, source): if app.builder.format not in ("html", "latex"): return - # we only want our one jinja template to run through this func - if "shared-bindings/support_matrix" not in docname: + # we only want specific files to run through this func + if not render_with_jinja(docname, source): return src = rendered = source[0] - print(docname) + print(f"rendering {docname} as jinja templates") if app.builder.format == "html": rendered = app.builder.templates.render_string( From d7ff56b00e1ff20cf85d220241b1f93b799bd789 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 20 Jul 2023 10:51:27 -0500 Subject: [PATCH 1293/1712] sort a block of items --- docs/shared_bindings_matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index f7efb47385..011bf595cc 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -73,8 +73,8 @@ ADDITIONAL_MODULES = { "fontio": "CIRCUITPY_DISPLAYIO", "io": "CIRCUITPY_IO", "select": "MICROPY_PY_USELECT_SELECT", - "terminalio": "CIRCUITPY_DISPLAYIO", "sys": "CIRCUITPY_SYS", + "terminalio": "CIRCUITPY_DISPLAYIO", "usb": "CIRCUITPY_USB_HOST", } From 9593ec44b1463a58020afdff18fae72ee6689dc8 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 20 Jul 2023 10:51:35 -0500 Subject: [PATCH 1294/1712] add os.getenv to the support matrix --- docs/shared_bindings_matrix.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 011bf595cc..9d7ea470e4 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -72,6 +72,7 @@ ADDITIONAL_MODULES = { "collections": "CIRCUITPY_COLLECTIONS", "fontio": "CIRCUITPY_DISPLAYIO", "io": "CIRCUITPY_IO", + "os.getenv": "CIRCUITPY_OS_GETENV", "select": "MICROPY_PY_USELECT_SELECT", "sys": "CIRCUITPY_SYS", "terminalio": "CIRCUITPY_DISPLAYIO", @@ -86,6 +87,7 @@ MODULES_NOT_IN_BINDINGS = [ "collections", "errno", "json", + "os.getenv", "re", "select", "sys", From 6a2499227a3c3910def42fdc14af0591001008bc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 20 Jul 2023 10:51:53 -0500 Subject: [PATCH 1295/1712] render the board support list within the docs of os.getenv --- shared-bindings/os/__init__.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index e9e5f0885f..18fec53049 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -41,6 +41,8 @@ //| """functions that an OS normally provides //| //| |see_cpython_module| :mod:`cpython:os`. +//| +//| .. jinja //| """ //| //| import typing @@ -88,7 +90,24 @@ MP_DEFINE_CONST_FUN_OBJ_0(os_getcwd_obj, os_getcwd); //| def getenv(key: str, default: Optional[str] = None) -> Optional[str]: //| """Get the environment variable value for the given key or return ``default``. //| -//| This may load values from disk so cache the result instead of calling this often.""" +//| This may load values from disk so cache the result instead of calling this often. +//| +//| On boards that do not support ``settings.toml`` reading in the core, this function will raise NotImplementedError. +//| +//| .. raw:: html +//| +//|

+//|

+//| Available on these boards +//|
    +//| {% for board in support_matrix_reverse["os.getenv"] %} +//|
  • {{ board }} +//| {% endfor %} +//|
+//|
+//|

+//| +//| """ //| ... //| STATIC mp_obj_t os_getenv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { From aca93d0ebb3c61fea0fc3390aabb659ced71c9a3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 20 Jul 2023 11:13:57 -0500 Subject: [PATCH 1296/1712] MODULES_NOT_IN_BINDINGS can skip listing things in ADDITIONAL_MODULES --- docs/shared_bindings_matrix.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 9d7ea470e4..be001ac792 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -79,20 +79,7 @@ ADDITIONAL_MODULES = { "usb": "CIRCUITPY_USB_HOST", } -MODULES_NOT_IN_BINDINGS = [ - "_asyncio", - "array", - "binascii", - "builtins", - "collections", - "errno", - "json", - "os.getenv", - "re", - "select", - "sys", - "ulab", -] +MODULES_NOT_IN_BINDINGS = [ "binascii", "errno", "json", "re", "ulab" ] FROZEN_EXCLUDES = ["examples", "docs", "tests", "utils", "conf.py", "setup.py"] """Files and dirs at the root of a frozen directory that should be ignored. @@ -119,7 +106,7 @@ def get_bindings(): bindings_modules = [] for d in get_circuitpython_root_dir().glob("ports/*/bindings"): bindings_modules.extend(module.name for module in d.iterdir() if d.is_dir()) - return shared_bindings_modules + bindings_modules + MODULES_NOT_IN_BINDINGS + return shared_bindings_modules + bindings_modules + MODULES_NOT_IN_BINDINGS + list(ADDITIONAL_MODULES.keys()) def get_board_mapping(): From f15eceb24c2d74b4e7df07360a7d0a41230ef05a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 20 Jul 2023 11:14:50 -0500 Subject: [PATCH 1297/1712] Document more classes that can be separately enabled --- docs/shared_bindings_matrix.py | 5 +++++ shared-bindings/busio/SPI.c | 17 ++++++++++++++++- shared-bindings/busio/UART.c | 17 ++++++++++++++++- shared-bindings/busio/__init__.c | 2 ++ shared-bindings/keypad/KeyMatrix.c | 17 ++++++++++++++++- shared-bindings/keypad/Keys.c | 17 ++++++++++++++++- shared-bindings/keypad/ShiftRegisterKeys.c | 17 ++++++++++++++++- shared-bindings/keypad/__init__.c | 2 ++ 8 files changed, 89 insertions(+), 5 deletions(-) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index be001ac792..e61c28abcb 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -69,9 +69,14 @@ ADDITIONAL_MODULES = { "array": "CIRCUITPY_ARRAY", # always available, so depend on something that's always 1. "builtins": "CIRCUITPY", + "busio.SPI": "CIRCUITPY_BUSIO_SPI", + "busio.UART": "CIRCUITPY_BUSIO_UART", "collections": "CIRCUITPY_COLLECTIONS", "fontio": "CIRCUITPY_DISPLAYIO", "io": "CIRCUITPY_IO", + "keypad.KeyMatrix": "CIRCUITPY_KEYPAD_KEYMATRIX", + "keypad.Keys": "CIRCUITPY_KEYPAD_KEYS", + "keypad.ShiftRegisterKeys": "CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS", "os.getenv": "CIRCUITPY_OS_GETENV", "select": "MICROPY_PY_USELECT_SELECT", "sys": "CIRCUITPY_SYS", diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index ccdceb5760..4a85a8372f 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -52,7 +52,22 @@ //| `!MOSI`, `!MISO`. Its up to the client to manage the appropriate //| select line, often abbreviated `!CS` or `!SS`. (This is common because //| multiple secondaries can share the `!clock`, `!MOSI` and `!MISO` lines -//| and therefore the hardware.)""" +//| and therefore the hardware.) +//| +//| .. raw:: html +//| +//|

+//|

+//| Available on these boards +//|
    +//| {% for board in support_matrix_reverse["busio.SPI"] %} +//|
  • {{ board }} +//| {% endfor %} +//|
+//|
+//|

+//| +//| """ //| //| def __init__( //| self, diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index a10dc8efad..44fcd770ab 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -44,7 +44,22 @@ // #define STREAM_DEBUG(...) mp_printf(&mp_plat_print __VA_OPT__(,) __VA_ARGS__) //| class UART: -//| """A bidirectional serial protocol""" +//| """A bidirectional serial protocol +//| +//| .. raw:: html +//| +//|

+//|

+//| Available on these boards +//|
    +//| {% for board in support_matrix_reverse["busio.UART"] %} +//|
  • {{ board }} +//| {% endfor %} +//|
+//|
+//|

+//| +//| """ //| //| def __init__( //| self, diff --git a/shared-bindings/busio/__init__.c b/shared-bindings/busio/__init__.c index 4d62c8333e..776920385e 100644 --- a/shared-bindings/busio/__init__.c +++ b/shared-bindings/busio/__init__.c @@ -77,6 +77,8 @@ //| //| Tutorial for UART: //| https://learn.adafruit.com/circuitpython-essentials/circuitpython-uart-serial +//| +//| .. jinja //| """ STATIC const mp_rom_map_elem_t busio_module_globals_table[] = { diff --git a/shared-bindings/keypad/KeyMatrix.c b/shared-bindings/keypad/KeyMatrix.c index 2209f3f68f..d4ccb906b9 100644 --- a/shared-bindings/keypad/KeyMatrix.c +++ b/shared-bindings/keypad/KeyMatrix.c @@ -35,7 +35,22 @@ #include "shared-bindings/util.h" //| class KeyMatrix: -//| """Manage a 2D matrix of keys with row and column pins.""" +//| """Manage a 2D matrix of keys with row and column pins. +//| +//| .. raw:: html +//| +//|

+//|

+//| Available on these boards +//|
    +//| {% for board in support_matrix_reverse["keypad.KeyMatrix"] %} +//|
  • {{ board }} +//| {% endfor %} +//|
+//|
+//|

+//| +//| """ //| //| def __init__( //| self, diff --git a/shared-bindings/keypad/Keys.c b/shared-bindings/keypad/Keys.c index 2481fedc6b..090b9a47c8 100644 --- a/shared-bindings/keypad/Keys.c +++ b/shared-bindings/keypad/Keys.c @@ -35,7 +35,22 @@ #include "shared-bindings/util.h" //| class Keys: -//| """Manage a set of independent keys.""" +//| """Manage a set of independent keys. +//| +//| .. raw:: html +//| +//|

+//|

+//| Available on these boards +//|
    +//| {% for board in support_matrix_reverse["keypad.Keys"] %} +//|
  • {{ board }} +//| {% endfor %} +//|
+//|
+//|

+//| +//| """ //| //| def __init__( //| self, diff --git a/shared-bindings/keypad/ShiftRegisterKeys.c b/shared-bindings/keypad/ShiftRegisterKeys.c index 1fcf517ac3..803f485a99 100644 --- a/shared-bindings/keypad/ShiftRegisterKeys.c +++ b/shared-bindings/keypad/ShiftRegisterKeys.c @@ -35,7 +35,22 @@ #include "shared-bindings/util.h" //| class ShiftRegisterKeys: -//| """Manage a set of keys attached to an incoming shift register.""" +//| """Manage a set of keys attached to an incoming shift register. +//| +//| .. raw:: html +//| +//|

+//|

+//| Available on these boards +//|
    +//| {% for board in support_matrix_reverse["keypad.ShiftRegisterKeys"] %} +//|
  • {{ board }} +//| {% endfor %} +//|
+//|
+//|

+//| +//| """ //| //| def __init__( //| self, diff --git a/shared-bindings/keypad/__init__.c b/shared-bindings/keypad/__init__.c index 7dd76c1947..f53c58a398 100644 --- a/shared-bindings/keypad/__init__.c +++ b/shared-bindings/keypad/__init__.c @@ -89,6 +89,8 @@ const mp_obj_property_t keypad_generic_events_obj = { //| //| For more information about working with the `keypad` module in CircuitPython, //| see `this Learn guide `_. +//| +//| .. jinja //| """ STATIC mp_rom_map_elem_t keypad_module_globals_table[] = { From f41e314f486cda69d331693612788ef198d77fdd Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 20 Jul 2023 11:15:54 -0500 Subject: [PATCH 1298/1712] document builtins.pow3 availability this makes it show up in the support matrix --- docs/shared_bindings_matrix.py | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index e61c28abcb..4cc9409325 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -69,6 +69,7 @@ ADDITIONAL_MODULES = { "array": "CIRCUITPY_ARRAY", # always available, so depend on something that's always 1. "builtins": "CIRCUITPY", + "builtins.pow3": "CIRCUITPY_BUILTINS_POW3", "busio.SPI": "CIRCUITPY_BUSIO_SPI", "busio.UART": "CIRCUITPY_BUSIO_UART", "collections": "CIRCUITPY_COLLECTIONS", From 346f08f8b9aa7a71e41096339018197f3d649eee Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 20 Jul 2023 13:16:00 -0500 Subject: [PATCH 1299/1712] synthio: Add Synthesizer.note_state This enables the specific use case of checking whether a note's release phase has ended, but is also potentially useful to implement a sort of "voice stealing" algorithm in Python code, which can take account of the note's envelope state as well as other factors specific to the program. --- shared-bindings/synthio/Synthesizer.c | 23 +++++++++++++++++++- shared-bindings/synthio/Synthesizer.h | 1 + shared-bindings/synthio/__init__.c | 17 +++++++++++++++ shared-bindings/synthio/__init__.h | 6 +++++ shared-module/synthio/Synthesizer.c | 11 ++++++++++ shared-module/synthio/__init__.h | 6 +---- tests/circuitpython/synthio_note_info.py | 17 +++++++++++++++ tests/circuitpython/synthio_note_info.py.exp | 23 ++++++++++++++++++++ 8 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 tests/circuitpython/synthio_note_info.py create mode 100644 tests/circuitpython/synthio_note_info.py.exp diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index 8e186573cd..148e773b6b 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -31,6 +31,7 @@ #include "py/binary.h" #include "py/objproperty.h" #include "py/runtime.h" +#include "py/enum.h" #include "shared-bindings/util.h" #include "shared-bindings/synthio/Biquad.h" #include "shared-bindings/synthio/Synthesizer.h" @@ -256,7 +257,9 @@ MP_PROPERTY_GETTER(synthio_synthesizer_sample_rate_obj, (mp_obj_t)&synthio_synthesizer_get_sample_rate_obj); //| pressed: NoteSequence -//| """A sequence of the currently pressed notes (read-only property)""" +//| """A sequence of the currently pressed notes (read-only property). +//| +//| This does not include notes in the release phase of the envelope.""" //| STATIC mp_obj_t synthio_synthesizer_obj_get_pressed(mp_obj_t self_in) { synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -268,6 +271,23 @@ MP_DEFINE_CONST_FUN_OBJ_1(synthio_synthesizer_get_pressed_obj, synthio_synthesiz MP_PROPERTY_GETTER(synthio_synthesizer_pressed_obj, (mp_obj_t)&synthio_synthesizer_get_pressed_obj); +//| def note_info(note: Note) -> Tuple[Optional[EnvelopeState], float]: +//| """Get info about a note's current envelope state +//| +//| If the note is currently playing (including in the release phase), the returned value gives the current envelope state and the current envelope value. +//| +//| If the note is not playing on this synthesizer, returns the tuple ``(None, 0.0)``.""" +STATIC mp_obj_t synthio_synthesizer_obj_note_info(mp_obj_t self_in, mp_obj_t note) { + synthio_synthesizer_obj_t *self = MP_OBJ_TO_PTR(self_in); + check_for_deinit(self); + mp_float_t vol = MICROPY_FLOAT_CONST(0.0); + envelope_state_e state = common_hal_synthio_synthesizer_note_info(self, note, &vol); + return MP_OBJ_NEW_TUPLE( + cp_enum_find(&synthio_note_state_type, state), + mp_obj_new_float(vol)); +} +MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_note_info_obj, synthio_synthesizer_obj_note_info); + //| blocks: List[BlockInput] //| """A list of blocks to advance whether or not they are associated with a playing note. //| @@ -417,6 +437,7 @@ STATIC const mp_rom_map_elem_t synthio_synthesizer_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_sample_rate), MP_ROM_PTR(&synthio_synthesizer_sample_rate_obj) }, { MP_ROM_QSTR(MP_QSTR_max_polyphony), MP_ROM_INT(CIRCUITPY_SYNTHIO_MAX_CHANNELS) }, { MP_ROM_QSTR(MP_QSTR_pressed), MP_ROM_PTR(&synthio_synthesizer_pressed_obj) }, + { MP_ROM_QSTR(MP_QSTR_note_info), MP_ROM_PTR(&synthio_synthesizer_note_info_obj) }, { MP_ROM_QSTR(MP_QSTR_blocks), MP_ROM_PTR(&synthio_synthesizer_blocks_obj) }, }; STATIC MP_DEFINE_CONST_DICT(synthio_synthesizer_locals_dict, synthio_synthesizer_locals_dict_table); diff --git a/shared-bindings/synthio/Synthesizer.h b/shared-bindings/synthio/Synthesizer.h index 16543ce2c3..8ae0af3bf3 100644 --- a/shared-bindings/synthio/Synthesizer.h +++ b/shared-bindings/synthio/Synthesizer.h @@ -45,3 +45,4 @@ void common_hal_synthio_synthesizer_retrigger(synthio_synthesizer_obj_t *self, m void common_hal_synthio_synthesizer_release_all(synthio_synthesizer_obj_t *self); mp_obj_t common_hal_synthio_synthesizer_get_pressed_notes(synthio_synthesizer_obj_t *self); mp_obj_t common_hal_synthio_synthesizer_get_blocks(synthio_synthesizer_obj_t *self); +envelope_state_e common_hal_synthio_synthesizer_note_info(synthio_synthesizer_obj_t *self, mp_obj_t note, mp_float_t *vol_out); diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index b295430b09..8eba79d2a0 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -45,6 +45,22 @@ #include "shared-module/synthio/LFO.h" +MAKE_ENUM_VALUE(synthio_note_state_type, note_state, ATTACK, SYNTHIO_ENVELOPE_STATE_ATTACK); +MAKE_ENUM_VALUE(synthio_note_state_type, note_state, DECAY, SYNTHIO_ENVELOPE_STATE_DECAY); +MAKE_ENUM_VALUE(synthio_note_state_type, note_state, SUSTAIN, SYNTHIO_ENVELOPE_STATE_SUSTAIN); +MAKE_ENUM_VALUE(synthio_note_state_type, note_state, RELEASE, SYNTHIO_ENVELOPE_STATE_RELEASE); + +MAKE_ENUM_MAP(synthio_note_state) { + MAKE_ENUM_MAP_ENTRY(note_state, ATTACK), + MAKE_ENUM_MAP_ENTRY(note_state, DECAY), + MAKE_ENUM_MAP_ENTRY(note_state, SUSTAIN), + MAKE_ENUM_MAP_ENTRY(note_state, RELEASE), +}; + +STATIC MP_DEFINE_CONST_DICT(synthio_note_state_locals_dict, synthio_note_state_locals_table); +MAKE_PRINTER(synthio, synthio_note_state); +MAKE_ENUM_TYPE(synthio, NoteState, synthio_note_state); + #define default_attack_time (MICROPY_FLOAT_CONST(0.1)) #define default_decay_time (MICROPY_FLOAT_CONST(0.05)) #define default_release_time (MICROPY_FLOAT_CONST(0.2)) @@ -316,6 +332,7 @@ STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_MathOperation), MP_ROM_PTR(&synthio_math_operation_type) }, { MP_ROM_QSTR(MP_QSTR_MidiTrack), MP_ROM_PTR(&synthio_miditrack_type) }, { MP_ROM_QSTR(MP_QSTR_Note), MP_ROM_PTR(&synthio_note_type) }, + { MP_ROM_QSTR(MP_QSTR_NoteState), MP_ROM_PTR(&synthio_note_state_type) }, { MP_ROM_QSTR(MP_QSTR_LFO), MP_ROM_PTR(&synthio_lfo_type) }, { MP_ROM_QSTR(MP_QSTR_Synthesizer), MP_ROM_PTR(&synthio_synthesizer_type) }, { MP_ROM_QSTR(MP_QSTR_from_file), MP_ROM_PTR(&synthio_from_file_obj) }, diff --git a/shared-bindings/synthio/__init__.h b/shared-bindings/synthio/__init__.h index 2315d92e58..4a44277e85 100644 --- a/shared-bindings/synthio/__init__.h +++ b/shared-bindings/synthio/__init__.h @@ -29,10 +29,16 @@ #include "py/objnamedtuple.h" #include "py/enum.h" +typedef enum { + SYNTHIO_ENVELOPE_STATE_ATTACK, SYNTHIO_ENVELOPE_STATE_DECAY, + SYNTHIO_ENVELOPE_STATE_SUSTAIN, SYNTHIO_ENVELOPE_STATE_RELEASE +} envelope_state_e; + typedef enum synthio_bend_mode_e { SYNTHIO_BEND_MODE_STATIC, SYNTHIO_BEND_MODE_VIBRATO, SYNTHIO_BEND_MODE_SWEEP, SYNTHIO_BEND_MODE_SWEEP_IN } synthio_bend_mode_t; +extern const mp_obj_type_t synthio_note_state_type; extern const cp_enum_obj_t bend_mode_VIBRATO_obj; extern const mp_obj_type_t synthio_bend_mode_type; typedef struct synthio_synth synthio_synth_t; diff --git a/shared-module/synthio/Synthesizer.c b/shared-module/synthio/Synthesizer.c index 7dc888dfd0..672ac5b9e6 100644 --- a/shared-module/synthio/Synthesizer.c +++ b/shared-module/synthio/Synthesizer.c @@ -185,6 +185,17 @@ mp_obj_t common_hal_synthio_synthesizer_get_pressed_notes(synthio_synthesizer_ob return MP_OBJ_FROM_PTR(result); } +envelope_state_e common_hal_synthio_synthesizer_note_info(synthio_synthesizer_obj_t *self, mp_obj_t note, mp_float_t *vol_out) { + for (int chan = 0; chan < CIRCUITPY_SYNTHIO_MAX_CHANNELS; chan++) { + if (self->synth.span.note_obj[chan] == note) { + *vol_out = self->synth.envelope_state[chan].level / 32767.; + return self->synth.envelope_state[chan].state; + } + } + return (envelope_state_e) - 1; +} + + mp_obj_t common_hal_synthio_synthesizer_get_blocks(synthio_synthesizer_obj_t *self) { return self->blocks; } diff --git a/shared-module/synthio/__init__.h b/shared-module/synthio/__init__.h index 9e4db96d50..178e4fb866 100644 --- a/shared-module/synthio/__init__.h +++ b/shared-module/synthio/__init__.h @@ -35,6 +35,7 @@ #define SYNTHIO_FREQUENCY_SHIFT (16) #include "shared-module/audiocore/__init__.h" +#include "shared-bindings/synthio/__init__.h" typedef struct { uint16_t dur; @@ -49,11 +50,6 @@ typedef struct { uint16_t attack_level, sustain_level; } synthio_envelope_definition_t; -typedef enum { - SYNTHIO_ENVELOPE_STATE_ATTACK, SYNTHIO_ENVELOPE_STATE_DECAY, - SYNTHIO_ENVELOPE_STATE_SUSTAIN, SYNTHIO_ENVELOPE_STATE_RELEASE -} envelope_state_e; - typedef struct { int16_t level; uint16_t substep; diff --git a/tests/circuitpython/synthio_note_info.py b/tests/circuitpython/synthio_note_info.py new file mode 100644 index 0000000000..4d4e7a59ae --- /dev/null +++ b/tests/circuitpython/synthio_note_info.py @@ -0,0 +1,17 @@ +from synthio import Synthesizer, Note, Envelope +from audiocore import get_buffer + +s = Synthesizer() +n = Note(440, envelope=Envelope()) +print("{} {:.2f}".format(*s.note_info(n))) +s.press(n) +print("press") +for _ in range(9): + print("{} {:.2f}".format(*s.note_info(n))) + get_buffer(s) + +s.release(n) +print("release") +for _ in range(11): + print("{} {:.2f}".format(*s.note_info(n))) + get_buffer(s) diff --git a/tests/circuitpython/synthio_note_info.py.exp b/tests/circuitpython/synthio_note_info.py.exp new file mode 100644 index 0000000000..a69fb3c8c0 --- /dev/null +++ b/tests/circuitpython/synthio_note_info.py.exp @@ -0,0 +1,23 @@ +None 0.00 +press +synthio.NoteState.ATTACK 0.23 +synthio.NoteState.ATTACK 0.46 +synthio.NoteState.ATTACK 0.70 +synthio.NoteState.ATTACK 0.93 +synthio.NoteState.DECAY 1.00 +synthio.NoteState.DECAY 0.91 +synthio.NoteState.DECAY 0.81 +synthio.NoteState.SUSTAIN 0.80 +synthio.NoteState.SUSTAIN 0.80 +release +synthio.NoteState.RELEASE 0.80 +synthio.NoteState.RELEASE 0.71 +synthio.NoteState.RELEASE 0.61 +synthio.NoteState.RELEASE 0.52 +synthio.NoteState.RELEASE 0.43 +synthio.NoteState.RELEASE 0.34 +synthio.NoteState.RELEASE 0.24 +synthio.NoteState.RELEASE 0.15 +synthio.NoteState.RELEASE 0.06 +synthio.NoteState.RELEASE 0.00 +None 0.00 From 5f082561b32ea010b9bd2a2f797d577d037cae46 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 20 Jul 2023 11:16:31 -0700 Subject: [PATCH 1300/1712] Unify some error strings --- locale/circuitpython.pot | 70 +++++-------------- ports/broadcom/common-hal/busio/UART.c | 4 +- ports/espressif/common-hal/busio/SPI.c | 8 +-- ports/espressif/common-hal/busio/UART.c | 4 +- ports/mimxrt10xx/common-hal/busio/SPI.c | 13 ++-- ports/mimxrt10xx/common-hal/busio/UART.c | 4 +- ports/nrf/common-hal/busio/UART.c | 4 +- ports/raspberrypi/common-hal/busio/UART.c | 4 +- ports/silabs/common-hal/busio/I2C.c | 2 +- ports/silabs/common-hal/busio/SPI.c | 2 +- ports/silabs/common-hal/busio/UART.c | 2 +- ports/stm/common-hal/busio/I2C.c | 2 +- ports/stm/common-hal/busio/SPI.c | 15 ++-- ports/stm/common-hal/busio/UART.c | 4 +- ports/stm/common-hal/canio/CAN.c | 2 +- ports/stm/common-hal/sdioio/SDCard.c | 2 +- shared-bindings/displayio/FourWire.c | 2 +- shared-bindings/displayio/I2CDisplay.c | 2 +- shared-bindings/paralleldisplay/ParallelBus.c | 2 +- shared-module/bitbangio/SPI.c | 11 +-- 20 files changed, 65 insertions(+), 94 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 368836a4db..9ebb85d13f 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -126,8 +126,10 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -182,6 +184,7 @@ msgid "%q must be 1 when %q is True" msgstr "" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "" @@ -779,10 +782,6 @@ msgstr "" msgid "Cannot subclass slice" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" @@ -1090,13 +1089,10 @@ msgstr "" msgid "Half duplex SPI is not implemented" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "" @@ -1355,14 +1351,6 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1436,6 +1424,14 @@ msgid "Nimble out of memory" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "" @@ -1469,36 +1465,6 @@ msgstr "" msgid "No IP" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "" @@ -2405,6 +2371,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "" @@ -3628,11 +3595,6 @@ msgstr "" msgid "no module named '%q'" msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "" diff --git a/ports/broadcom/common-hal/busio/UART.c b/ports/broadcom/common-hal/busio/UART.c index 5be098cf03..0eb72b1456 100644 --- a/ports/broadcom/common-hal/busio/UART.c +++ b/ports/broadcom/common-hal/busio/UART.c @@ -352,7 +352,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { // Write characters. size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) { if (self->tx_pin == NULL) { - mp_raise_ValueError(translate("No TX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_tx); } COMPLETE_MEMORY_READS; @@ -400,7 +400,7 @@ STATIC void enable_interrupt(busio_uart_obj_t *self) { // Read characters. size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) { if (self->rx_pin == NULL) { - mp_raise_ValueError(translate("No RX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_rx); } if (len == 0) { diff --git a/ports/espressif/common-hal/busio/SPI.c b/ports/espressif/common-hal/busio/SPI.c index 5218fdbf9d..0b6b395c51 100644 --- a/ports/espressif/common-hal/busio/SPI.c +++ b/ports/espressif/common-hal/busio/SPI.c @@ -186,7 +186,7 @@ void common_hal_busio_spi_unlock(busio_spi_obj_t *self) { bool common_hal_busio_spi_write(busio_spi_obj_t *self, const uint8_t *data, size_t len) { if (self->MOSI == NULL) { - mp_raise_ValueError(translate("No MOSI Pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi); } return common_hal_busio_spi_transfer(self, data, NULL, len); } @@ -194,7 +194,7 @@ bool common_hal_busio_spi_write(busio_spi_obj_t *self, bool common_hal_busio_spi_read(busio_spi_obj_t *self, uint8_t *data, size_t len, uint8_t write_value) { if (self->MISO == NULL) { - mp_raise_ValueError(translate("No MISO Pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso); } if (self->MOSI == NULL) { return common_hal_busio_spi_transfer(self, NULL, data, len); @@ -210,10 +210,10 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, return true; } if (self->MOSI == NULL && data_out != NULL) { - mp_raise_ValueError(translate("No MOSI Pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi); } if (self->MISO == NULL && data_in != NULL) { - mp_raise_ValueError(translate("No MISO Pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso); } spi_transaction_t transactions[MAX_SPI_TRANSACTIONS]; diff --git a/ports/espressif/common-hal/busio/UART.c b/ports/espressif/common-hal/busio/UART.c index c13bdedac0..37e0092726 100644 --- a/ports/espressif/common-hal/busio/UART.c +++ b/ports/espressif/common-hal/busio/UART.c @@ -304,7 +304,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { // Read characters. size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) { if (self->rx_pin == NULL) { - mp_raise_ValueError(translate("No RX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_rx); } if (len == 0) { // Nothing to read. @@ -357,7 +357,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t // Write characters. size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) { if (self->tx_pin == NULL) { - mp_raise_ValueError(translate("No TX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_tx); } size_t left_to_write = len; diff --git a/ports/mimxrt10xx/common-hal/busio/SPI.c b/ports/mimxrt10xx/common-hal/busio/SPI.c index 1ab9394244..e32b635611 100644 --- a/ports/mimxrt10xx/common-hal/busio/SPI.c +++ b/ports/mimxrt10xx/common-hal/busio/SPI.c @@ -182,7 +182,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, self->spi = mcu_spi_banks[self->clock->bank_idx - 1]; } else { if (spi_taken) { - mp_raise_ValueError(translate("Hardware busy, try alternative pins")); + mp_raise_ValueError(translate("Hardware in use, try alternative pins")); } else { raise_ValueError_invalid_pins(); } @@ -331,7 +331,7 @@ bool common_hal_busio_spi_write(busio_spi_obj_t *self, return true; } if (self->mosi == NULL) { - mp_raise_ValueError(translate("No MOSI Pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi); } lpspi_transfer_t xfer = { 0 }; @@ -349,7 +349,7 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self, return true; } if (self->miso == NULL) { - mp_raise_ValueError(translate("No MISO Pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso); } LPSPI_SetDummyData(self->spi, write_value); @@ -367,8 +367,11 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou if (len == 0) { return true; } - if (self->miso == NULL || self->mosi == NULL) { - mp_raise_ValueError(translate("Missing MISO or MOSI Pin")); + if (self->MOSI == NULL && data_out != NULL) { + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi); + } + if (self->MISO == NULL && data_in != NULL) { + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso); } LPSPI_SetDummyData(self->spi, 0xFF); diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c index e4d5fda6ae..d069836295 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.c +++ b/ports/mimxrt10xx/common-hal/busio/UART.c @@ -401,7 +401,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { // Read characters. size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) { if (self->rx == NULL) { - mp_raise_ValueError(translate("No RX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_rx); } if (len == 0) { @@ -458,7 +458,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t // Write characters. size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) { if (self->tx == NULL) { - mp_raise_ValueError(translate("No TX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_tx); } if (self->rs485_dir && len) { GPIO_PinWrite(self->rs485_dir->gpio, self->rs485_dir->number, !self->rs485_invert); diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index 626956946f..1c63e73092 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -297,7 +297,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { // Read characters. size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) { if (nrf_uarte_rx_pin_get(self->uarte->p_reg) == NRF_UARTE_PSEL_DISCONNECTED) { - mp_raise_ValueError(translate("No RX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_rx); } uint64_t start_ticks = supervisor_ticks_ms64(); @@ -347,7 +347,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t // Write characters. size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) { if (nrf_uarte_tx_pin_get(self->uarte->p_reg) == NRF_UARTE_PSEL_DISCONNECTED) { - mp_raise_ValueError(translate("No TX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_tx); } if (len == 0) { diff --git a/ports/raspberrypi/common-hal/busio/UART.c b/ports/raspberrypi/common-hal/busio/UART.c index 156a5e11ce..28cfc8b052 100644 --- a/ports/raspberrypi/common-hal/busio/UART.c +++ b/ports/raspberrypi/common-hal/busio/UART.c @@ -211,7 +211,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { // Write characters. size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) { if (self->tx_pin == NO_PIN) { - mp_raise_ValueError(translate("No TX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_tx); } if (self->rs485_dir_pin != NO_PIN) { @@ -239,7 +239,7 @@ size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, // Read characters. size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) { if (self->rx_pin == NO_PIN) { - mp_raise_ValueError(translate("No RX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_rx); } if (len == 0) { diff --git a/ports/silabs/common-hal/busio/I2C.c b/ports/silabs/common-hal/busio/I2C.c index 6d858be85e..62ac14f4e9 100644 --- a/ports/silabs/common-hal/busio/I2C.c +++ b/ports/silabs/common-hal/busio/I2C.c @@ -72,7 +72,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, common_hal_mcu_pin_claim(sda); in_used = true; } else { - mp_raise_ValueError(translate("Hardware busy, try alternative pins")); + mp_raise_ValueError(translate("Hardware in use, try alternative pins")); } } else { raise_ValueError_invalid_pins(); diff --git a/ports/silabs/common-hal/busio/SPI.c b/ports/silabs/common-hal/busio/SPI.c index a6f3109a32..89c8012477 100644 --- a/ports/silabs/common-hal/busio/SPI.c +++ b/ports/silabs/common-hal/busio/SPI.c @@ -95,7 +95,7 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self, mp_raise_ValueError(translate("SPI init error")); } } else { - mp_raise_ValueError(translate("Hardware busy, try alternative pins")); + mp_raise_ValueError(translate("Hardware in use, try alternative pins")); } } else { raise_ValueError_invalid_pins(); diff --git a/ports/silabs/common-hal/busio/UART.c b/ports/silabs/common-hal/busio/UART.c index 8b1883d906..75c46f4725 100644 --- a/ports/silabs/common-hal/busio/UART.c +++ b/ports/silabs/common-hal/busio/UART.c @@ -131,7 +131,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, context = self; } else { - mp_raise_ValueError(translate("Hardware busy, try alternative pins")); + mp_raise_ValueError(translate("Hardware in use, try alternative pins")); } } else { diff --git a/ports/stm/common-hal/busio/I2C.c b/ports/stm/common-hal/busio/I2C.c index 259d678f2b..42c32b2b52 100644 --- a/ports/stm/common-hal/busio/I2C.c +++ b/ports/stm/common-hal/busio/I2C.c @@ -117,7 +117,7 @@ void common_hal_busio_i2c_construct(busio_i2c_obj_t *self, I2Cx = mcu_i2c_banks[self->sda->periph_index - 1]; } else { if (i2c_taken) { - mp_raise_ValueError(translate("Hardware busy, try alternative pins")); + mp_raise_ValueError(translate("Hardware in use, try alternative pins")); } else { raise_ValueError_invalid_pins(); } diff --git a/ports/stm/common-hal/busio/SPI.c b/ports/stm/common-hal/busio/SPI.c index 89ec4b7cdc..2fea1149eb 100644 --- a/ports/stm/common-hal/busio/SPI.c +++ b/ports/stm/common-hal/busio/SPI.c @@ -160,7 +160,7 @@ STATIC int check_pins(busio_spi_obj_t *self, } if (spi_taken) { - mp_raise_ValueError(translate("Hardware busy, try alternative pins")); + mp_raise_ValueError(translate("Hardware in use, try alternative pins")); } else { raise_ValueError_invalid_pin(); } @@ -347,7 +347,7 @@ void common_hal_busio_spi_unlock(busio_spi_obj_t *self) { bool common_hal_busio_spi_write(busio_spi_obj_t *self, const uint8_t *data, size_t len) { if (self->mosi == NULL) { - mp_raise_ValueError(translate("No MOSI pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi); } HAL_StatusTypeDef result = HAL_SPI_Transmit(&self->handle, (uint8_t *)data, (uint16_t)len, HAL_MAX_DELAY); return result == HAL_OK; @@ -356,9 +356,9 @@ bool common_hal_busio_spi_write(busio_spi_obj_t *self, bool common_hal_busio_spi_read(busio_spi_obj_t *self, uint8_t *data, size_t len, uint8_t write_value) { if (self->miso == NULL && !self->half_duplex) { - mp_raise_ValueError(translate("No MISO pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso); } else if (self->half_duplex && self->mosi == NULL) { - mp_raise_ValueError(translate("No MOSI pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi); } HAL_StatusTypeDef result = HAL_OK; if ((!self->half_duplex && self->mosi == NULL) || (self->half_duplex && self->mosi != NULL && self->miso == NULL)) { @@ -372,8 +372,11 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self, bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_out, uint8_t *data_in, size_t len) { - if (self->miso == NULL || self->mosi == NULL) { - mp_raise_ValueError(translate("Missing MISO or MOSI pin")); + if (self->mosi == NULL && data_out != NULL) { + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi); + } + if (self->miso == NULL && data_in != NULL) { + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso); } HAL_StatusTypeDef result = HAL_SPI_TransmitReceive(&self->handle, (uint8_t *)data_out, data_in, (uint16_t)len,HAL_MAX_DELAY); diff --git a/ports/stm/common-hal/busio/UART.c b/ports/stm/common-hal/busio/UART.c index cdace31639..abf37ab881 100644 --- a/ports/stm/common-hal/busio/UART.c +++ b/ports/stm/common-hal/busio/UART.c @@ -293,7 +293,7 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t len, int *errcode) { if (self->rx == NULL) { - mp_raise_ValueError(translate("No RX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_rx); } uint64_t start_ticks = supervisor_ticks_ms64(); @@ -327,7 +327,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, size_t // Write characters. size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, size_t len, int *errcode) { if (self->tx == NULL) { - mp_raise_ValueError(translate("No TX pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_tx); } // Disable UART IRQ to avoid resource hazards in Rx IRQ handler diff --git a/ports/stm/common-hal/canio/CAN.c b/ports/stm/common-hal/canio/CAN.c index 992745b80a..ca857d5643 100644 --- a/ports/stm/common-hal/canio/CAN.c +++ b/ports/stm/common-hal/canio/CAN.c @@ -69,7 +69,7 @@ void common_hal_canio_can_construct(canio_can_obj_t *self, const mcu_pin_obj_t * } if (reserved_can[periph_index]) { - mp_raise_ValueError(translate("Hardware busy, try alternative pins")); + mp_raise_ValueError(translate("Hardware in use, try alternative pins")); } const uint32_t can_frequency = 42000000; diff --git a/ports/stm/common-hal/sdioio/SDCard.c b/ports/stm/common-hal/sdioio/SDCard.c index 8eeae2781d..6f3eb682df 100644 --- a/ports/stm/common-hal/sdioio/SDCard.c +++ b/ports/stm/common-hal/sdioio/SDCard.c @@ -113,7 +113,7 @@ STATIC int check_pins(sdioio_sdcard_obj_t *self, } if (sdio_taken) { - mp_raise_ValueError(translate("Hardware busy, try alternative pins")); + mp_raise_ValueError(translate("Hardware in use, try alternative pins")); } else { raise_ValueError_invalid_pin(); } diff --git a/shared-bindings/displayio/FourWire.c b/shared-bindings/displayio/FourWire.c index 1f099f5061..29cdf09299 100644 --- a/shared-bindings/displayio/FourWire.c +++ b/shared-bindings/displayio/FourWire.c @@ -114,7 +114,7 @@ STATIC mp_obj_t displayio_fourwire_obj_reset(mp_obj_t self_in) { displayio_fourwire_obj_t *self = self_in; if (!common_hal_displayio_fourwire_reset(self)) { - mp_raise_RuntimeError(translate("no reset pin available")); + mp_raise_RuntimeError_varg(translate("No %q pin"), MP_QSTR_reset); } return mp_const_none; } diff --git a/shared-bindings/displayio/I2CDisplay.c b/shared-bindings/displayio/I2CDisplay.c index f2647b0b16..ca5968421c 100644 --- a/shared-bindings/displayio/I2CDisplay.c +++ b/shared-bindings/displayio/I2CDisplay.c @@ -91,7 +91,7 @@ STATIC mp_obj_t displayio_i2cdisplay_obj_reset(mp_obj_t self_in) { displayio_i2cdisplay_obj_t *self = self_in; if (!common_hal_displayio_i2cdisplay_reset(self)) { - mp_raise_RuntimeError(translate("no reset pin available")); + mp_raise_RuntimeError_varg(translate("No %q pin"), MP_QSTR_reset); } return mp_const_none; } diff --git a/shared-bindings/paralleldisplay/ParallelBus.c b/shared-bindings/paralleldisplay/ParallelBus.c index ad9a1efdce..f8ab6470e4 100644 --- a/shared-bindings/paralleldisplay/ParallelBus.c +++ b/shared-bindings/paralleldisplay/ParallelBus.c @@ -122,7 +122,7 @@ STATIC mp_obj_t paralleldisplay_parallelbus_obj_reset(mp_obj_t self_in) { paralleldisplay_parallelbus_obj_t *self = self_in; if (!common_hal_paralleldisplay_parallelbus_reset(self)) { - mp_raise_RuntimeError(translate("no reset pin available")); + mp_raise_RuntimeError_varg(translate("No %q pin"), MP_QSTR_reset); } return mp_const_none; } diff --git a/shared-module/bitbangio/SPI.c b/shared-module/bitbangio/SPI.c index d740a214e7..c82cecff62 100644 --- a/shared-module/bitbangio/SPI.c +++ b/shared-module/bitbangio/SPI.c @@ -123,7 +123,7 @@ void shared_module_bitbangio_spi_unlock(bitbangio_spi_obj_t *self) { // Writes out the given data. bool shared_module_bitbangio_spi_write(bitbangio_spi_obj_t *self, const uint8_t *data, size_t len) { if (len > 0 && !self->has_mosi) { - mp_raise_ValueError(translate("No MOSI pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi); } uint32_t delay_half = self->delay_half; @@ -178,7 +178,7 @@ bool shared_module_bitbangio_spi_write(bitbangio_spi_obj_t *self, const uint8_t // Reads in len bytes while outputting zeroes. bool shared_module_bitbangio_spi_read(bitbangio_spi_obj_t *self, uint8_t *data, size_t len, uint8_t write_data) { if (len > 0 && !self->has_miso) { - mp_raise_ValueError(translate("No MISO pin")); + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso); } uint32_t delay_half = self->delay_half; @@ -245,8 +245,11 @@ bool shared_module_bitbangio_spi_read(bitbangio_spi_obj_t *self, uint8_t *data, // transfer bool shared_module_bitbangio_spi_transfer(bitbangio_spi_obj_t *self, const uint8_t *dout, uint8_t *din, size_t len) { - if (len > 0 && (!self->has_mosi || !self->has_miso)) { - mp_raise_ValueError(translate("Cannot transfer without MOSI and MISO pins")); + if (!self->has_mosi && dout != NULL) { + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi); + } + if (!self->has_miso && din != NULL) { + mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso); } uint32_t delay_half = self->delay_half; From d7fa7380b877aaac628f65acc760fa76624355ca Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 20 Jul 2023 11:18:00 -0700 Subject: [PATCH 1301/1712] Move some find_qstr wrappers to tcm next to it --- py/qstr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/py/qstr.c b/py/qstr.c index 96e2a79192..09ef9ea7ed 100644 --- a/py/qstr.c +++ b/py/qstr.c @@ -289,18 +289,18 @@ mp_uint_t PLACE_IN_ITCM(qstr_hash)(qstr q) { return attr.hash; } -size_t qstr_len(qstr q) { +size_t PLACE_IN_ITCM(qstr_len)(qstr q) { qstr_attr_t attr; find_qstr(q, &attr); return attr.len; } -const char *qstr_str(qstr q) { +const char *PLACE_IN_ITCM(qstr_str)(qstr q) { qstr_attr_t attr; return find_qstr(q, &attr); } -const byte *qstr_data(qstr q, size_t *len) { +const byte *PLACE_IN_ITCM(qstr_data)(qstr q, size_t *len) { qstr_attr_t attr; const char *qd = find_qstr(q, &attr); *len = attr.len; From a56e97db1df6d5c050c8506414ba9c7c0423fc53 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 20 Jul 2023 11:19:57 -0700 Subject: [PATCH 1302/1712] Align MP heap allocations to cache lines --- ports/mimxrt10xx/mpconfigport.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ports/mimxrt10xx/mpconfigport.h b/ports/mimxrt10xx/mpconfigport.h index 16cc63bc2d..7cc17494bf 100644 --- a/ports/mimxrt10xx/mpconfigport.h +++ b/ports/mimxrt10xx/mpconfigport.h @@ -37,7 +37,6 @@ extern uint8_t _ld_filesystem_start; extern uint8_t _ld_filesystem_end; extern uint8_t _ld_default_stack_size; -// 20kiB stack #define CIRCUITPY_DEFAULT_STACK_SIZE ((uint32_t)&_ld_default_stack_size) #define MICROPY_PY_BUILTINS_NOTIMPLEMENTED (0) #define MICROPY_PY_FUNCTION_ATTRS (0) @@ -47,6 +46,10 @@ extern uint8_t _ld_default_stack_size; #define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_START_ADDR ((uint32_t)&_ld_filesystem_start) #define CIRCUITPY_INTERNAL_FLASH_FILESYSTEM_SIZE ((uint32_t)(&_ld_filesystem_end - &_ld_filesystem_start)) +// Allocate 32 bytes at a time instead of the default 16 so that allocated buffers +// are aligned to cache lines. +#define MICROPY_BYTES_PER_GC_BLOCK (32) + #include "py/circuitpy_mpconfig.h" #define MICROPY_PORT_ROOT_POINTERS \ From 29a4364ba77e11348a7958296ea55ebfc7b69826 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 20 Jul 2023 14:05:56 -0500 Subject: [PATCH 1303/1712] fix method signature --- shared-bindings/synthio/Synthesizer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index 148e773b6b..25d26fc661 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -271,7 +271,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(synthio_synthesizer_get_pressed_obj, synthio_synthesiz MP_PROPERTY_GETTER(synthio_synthesizer_pressed_obj, (mp_obj_t)&synthio_synthesizer_get_pressed_obj); -//| def note_info(note: Note) -> Tuple[Optional[EnvelopeState], float]: +//| def note_info(self, note: Note) -> Tuple[Optional[EnvelopeState], float]: //| """Get info about a note's current envelope state //| //| If the note is currently playing (including in the release phase), the returned value gives the current envelope state and the current envelope value. From f71831dea93b9e84a8d476025851cea46a71d29f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 20 Jul 2023 14:10:44 -0500 Subject: [PATCH 1304/1712] skip all the byecode hex data, it's adequately checked ... by the disassembly just below This was tripped up because in exactly the right conditions some qstr could be of the form 'xx 63' and make the expression `\.\+63` match something other than what was intended. This test was re-worked upstream for mpy version 6 so it'll be a conflict to resolve when we get to that. :-/ --- tests/cmdline/cmd_showbc.py.exp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/cmdline/cmd_showbc.py.exp b/tests/cmdline/cmd_showbc.py.exp index 22712b79ee..c3dbfd74f8 100644 --- a/tests/cmdline/cmd_showbc.py.exp +++ b/tests/cmdline/cmd_showbc.py.exp @@ -1,7 +1,6 @@ File cmdline/cmd_showbc.py, code block '' (descriptor: \.\+, bytecode @\.\+ bytes) Raw bytecode (code_info_size=\\d\+, bytecode_size=\\d\+): ######## -\.\+63 arg names: (N_STATE 3) (N_EXC_STACK 0) From 70cf0610cc397b0dd71ff64d259a246822f0cf56 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 20 Jul 2023 14:18:03 -0500 Subject: [PATCH 1305/1712] disable synthio on this board, it's very full --- ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk b/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk index c3e21a4c36..fcbbbd5bf9 100644 --- a/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk +++ b/ports/atmel-samd/boards/mini_sam_m4/mpconfigboard.mk @@ -12,6 +12,7 @@ LONGINT_IMPL = MPZ # No I2S on SAMD51G CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_SYNTHIO = 0 CIRCUITPY_BITBANG_APA102 = 1 From 60b233f160e0ee30f1abf412c0798bce50e7425c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 20 Jul 2023 16:25:23 -0500 Subject: [PATCH 1306/1712] document EnvelopeState --- shared-bindings/synthio/__init__.c | 14 ++++++-- tests/circuitpython/synthio_note_info.py.exp | 38 ++++++++++---------- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 8eba79d2a0..52d30cd2c4 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -45,6 +45,16 @@ #include "shared-module/synthio/LFO.h" +//| class EnvelopeState: +//| ATTACK: EnvelopeState +//| """The note is in its attack phase""" +//| DECAY: EnvelopeState +//| """The note is in its decay phase""" +//| SUSTAIN: EnvelopeState +//| """The note is in its sustain phase""" +//| RELEASE: EnvelopeState +//| """The note is in its release phase""" +//| MAKE_ENUM_VALUE(synthio_note_state_type, note_state, ATTACK, SYNTHIO_ENVELOPE_STATE_ATTACK); MAKE_ENUM_VALUE(synthio_note_state_type, note_state, DECAY, SYNTHIO_ENVELOPE_STATE_DECAY); MAKE_ENUM_VALUE(synthio_note_state_type, note_state, SUSTAIN, SYNTHIO_ENVELOPE_STATE_SUSTAIN); @@ -59,7 +69,7 @@ MAKE_ENUM_MAP(synthio_note_state) { STATIC MP_DEFINE_CONST_DICT(synthio_note_state_locals_dict, synthio_note_state_locals_table); MAKE_PRINTER(synthio, synthio_note_state); -MAKE_ENUM_TYPE(synthio, NoteState, synthio_note_state); +MAKE_ENUM_TYPE(synthio, EnvelopeState, synthio_note_state); #define default_attack_time (MICROPY_FLOAT_CONST(0.1)) #define default_decay_time (MICROPY_FLOAT_CONST(0.05)) @@ -332,7 +342,7 @@ STATIC const mp_rom_map_elem_t synthio_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_MathOperation), MP_ROM_PTR(&synthio_math_operation_type) }, { MP_ROM_QSTR(MP_QSTR_MidiTrack), MP_ROM_PTR(&synthio_miditrack_type) }, { MP_ROM_QSTR(MP_QSTR_Note), MP_ROM_PTR(&synthio_note_type) }, - { MP_ROM_QSTR(MP_QSTR_NoteState), MP_ROM_PTR(&synthio_note_state_type) }, + { MP_ROM_QSTR(MP_QSTR_EnvelopeState), MP_ROM_PTR(&synthio_note_state_type) }, { MP_ROM_QSTR(MP_QSTR_LFO), MP_ROM_PTR(&synthio_lfo_type) }, { MP_ROM_QSTR(MP_QSTR_Synthesizer), MP_ROM_PTR(&synthio_synthesizer_type) }, { MP_ROM_QSTR(MP_QSTR_from_file), MP_ROM_PTR(&synthio_from_file_obj) }, diff --git a/tests/circuitpython/synthio_note_info.py.exp b/tests/circuitpython/synthio_note_info.py.exp index a69fb3c8c0..cd75174a11 100644 --- a/tests/circuitpython/synthio_note_info.py.exp +++ b/tests/circuitpython/synthio_note_info.py.exp @@ -1,23 +1,23 @@ None 0.00 press -synthio.NoteState.ATTACK 0.23 -synthio.NoteState.ATTACK 0.46 -synthio.NoteState.ATTACK 0.70 -synthio.NoteState.ATTACK 0.93 -synthio.NoteState.DECAY 1.00 -synthio.NoteState.DECAY 0.91 -synthio.NoteState.DECAY 0.81 -synthio.NoteState.SUSTAIN 0.80 -synthio.NoteState.SUSTAIN 0.80 +synthio.EnvelopeState.ATTACK 0.23 +synthio.EnvelopeState.ATTACK 0.46 +synthio.EnvelopeState.ATTACK 0.70 +synthio.EnvelopeState.ATTACK 0.93 +synthio.EnvelopeState.DECAY 1.00 +synthio.EnvelopeState.DECAY 0.91 +synthio.EnvelopeState.DECAY 0.81 +synthio.EnvelopeState.SUSTAIN 0.80 +synthio.EnvelopeState.SUSTAIN 0.80 release -synthio.NoteState.RELEASE 0.80 -synthio.NoteState.RELEASE 0.71 -synthio.NoteState.RELEASE 0.61 -synthio.NoteState.RELEASE 0.52 -synthio.NoteState.RELEASE 0.43 -synthio.NoteState.RELEASE 0.34 -synthio.NoteState.RELEASE 0.24 -synthio.NoteState.RELEASE 0.15 -synthio.NoteState.RELEASE 0.06 -synthio.NoteState.RELEASE 0.00 +synthio.EnvelopeState.RELEASE 0.80 +synthio.EnvelopeState.RELEASE 0.71 +synthio.EnvelopeState.RELEASE 0.61 +synthio.EnvelopeState.RELEASE 0.52 +synthio.EnvelopeState.RELEASE 0.43 +synthio.EnvelopeState.RELEASE 0.34 +synthio.EnvelopeState.RELEASE 0.24 +synthio.EnvelopeState.RELEASE 0.15 +synthio.EnvelopeState.RELEASE 0.06 +synthio.EnvelopeState.RELEASE 0.00 None 0.00 From 525dad71c3e26c076e24f587cf9c5c11e0302422 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 20 Jul 2023 16:00:43 -0700 Subject: [PATCH 1307/1712] Add RuntimeError_varg and fix imx capitalization --- ports/mimxrt10xx/common-hal/busio/SPI.c | 4 ++-- py/runtime.c | 7 +++++++ py/runtime.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ports/mimxrt10xx/common-hal/busio/SPI.c b/ports/mimxrt10xx/common-hal/busio/SPI.c index e32b635611..11dea30a48 100644 --- a/ports/mimxrt10xx/common-hal/busio/SPI.c +++ b/ports/mimxrt10xx/common-hal/busio/SPI.c @@ -367,10 +367,10 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, const uint8_t *data_ou if (len == 0) { return true; } - if (self->MOSI == NULL && data_out != NULL) { + if (self->mosi == NULL && data_out != NULL) { mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_mosi); } - if (self->MISO == NULL && data_in != NULL) { + if (self->miso == NULL && data_in != NULL) { mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso); } diff --git a/py/runtime.c b/py/runtime.c index ebe1590484..9bc5f9a584 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -1655,6 +1655,13 @@ NORETURN MP_COLD void mp_raise_RuntimeError(const compressed_string_t *msg) { mp_raise_msg(&mp_type_RuntimeError, msg); } +NORETURN MP_COLD void mp_raise_RuntimeError_varg(const compressed_string_t *fmt, ...) { + va_list argptr; + va_start(argptr,fmt); + mp_raise_msg_vlist(&mp_type_RuntimeError, fmt, argptr); + va_end(argptr); +} + NORETURN MP_COLD void mp_raise_ImportError(const compressed_string_t *msg) { mp_raise_msg(&mp_type_ImportError, msg); } diff --git a/py/runtime.h b/py/runtime.h index 196874bff9..d870bbc634 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -219,6 +219,7 @@ NORETURN void mp_raise_TypeError(const compressed_string_t *msg); NORETURN void mp_raise_TypeError_varg(const compressed_string_t *fmt, ...); NORETURN void mp_raise_AttributeError(const compressed_string_t *msg); NORETURN void mp_raise_RuntimeError(const compressed_string_t *msg); +NORETURN void mp_raise_RuntimeError_varg(const compressed_string_t *fmt, ...); NORETURN void mp_raise_ImportError(const compressed_string_t *msg); NORETURN void mp_raise_IndexError(const compressed_string_t *msg); NORETURN void mp_raise_IndexError_varg(const compressed_string_t *msg, ...); From c0de8a9cd946f8545d010ea60f69179401cf661c Mon Sep 17 00:00:00 2001 From: hexthat Date: Wed, 19 Jul 2023 23:24:25 +0000 Subject: [PATCH 1308/1712] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 4f56b14dfd..8ff874492e 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-07-16 04:32+0000\n" +"PO-Revision-Date: 2023-07-21 00:10+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -1641,7 +1641,7 @@ msgstr "Bù zhīchí jīshù" #: supervisor/shared/bluetooth/bluetooth.c msgid "Off" -msgstr "guānbì" +msgstr "Guānbì" #: supervisor/shared/bluetooth/bluetooth.c msgid "Ok" @@ -3286,7 +3286,7 @@ msgstr "bù zhèngquè de tiánchōng" #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" -msgstr "suǒyǐn chāochū fànwéi" +msgstr "suǒyǐn yuèjiè" #: shared-bindings/_pixelmap/PixelMap.c msgid "index must be tuple or int" From a5fc766b2f78d4bb960ba6a77dbd5ec9cfd23e02 Mon Sep 17 00:00:00 2001 From: Tod Kurt Date: Fri, 21 Jul 2023 10:06:17 -0700 Subject: [PATCH 1309/1712] ESP32 synthio channels to 12 --- ports/espressif/mpconfigport.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 1b9808ad64..63cea3d0a8 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -38,6 +38,7 @@ CIRCUITPY_NVM ?= 1 CIRCUITPY_PS2IO ?= 1 CIRCUITPY_RGBMATRIX ?= 1 CIRCUITPY_ROTARYIO ?= 1 +CIRCUITPY_SYNTHIO_MAX_CHANNELS ?= 12 CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1 CIRCUITPY_WATCHDOG ?= 1 CIRCUITPY_WIFI ?= 1 From ed2e30b4d1646dd7093554f168714e2be946b159 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Fri, 21 Jul 2023 13:07:05 -0700 Subject: [PATCH 1310/1712] Added Arduino Nano ESP32-S3 --- .../boards/arduino_nano_esp32s3/board.c | 39 ++++++++++++ .../arduino_nano_esp32s3/mpconfigboard.h | 57 +++++++++++++++++ .../arduino_nano_esp32s3/mpconfigboard.mk | 17 +++++ .../boards/arduino_nano_esp32s3/pins.c | 63 +++++++++++++++++++ .../boards/arduino_nano_esp32s3/sdkconfig | 43 +++++++++++++ 5 files changed, 219 insertions(+) create mode 100644 ports/espressif/boards/arduino_nano_esp32s3/board.c create mode 100644 ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h create mode 100644 ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk create mode 100644 ports/espressif/boards/arduino_nano_esp32s3/pins.c create mode 100644 ports/espressif/boards/arduino_nano_esp32s3/sdkconfig diff --git a/ports/espressif/boards/arduino_nano_esp32s3/board.c b/ports/espressif/boards/arduino_nano_esp32s3/board.c new file mode 100644 index 0000000000..3b1f5efd87 --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3/board.c @@ -0,0 +1,39 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h new file mode 100644 index 0000000000..8e55a9285d --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h @@ -0,0 +1,57 @@ +/* + * 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 "Arduino Nano ESP32" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +// Status LED +#define CIRCUITPY_RGB_STATUS_INVERTED_PWM +#define CIRCUITPY_RGB_STATUS_R (&pin_GPIO46) +#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO0) +#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO45) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#if QSPI_FLASH_FILESYSTEM +#define MICROPY_QSPI_DATA0 (&pin_GPIO32) +#define MICROPY_QSPI_DATA1 (&pin_GPIO31) +#define MICROPY_QSPI_DATA2 (&pin_GPIO28) +#define MICROPY_QSPI_DATA3 (&pin_GPIO27) +#define MICROPY_QSPI_SCK (&pin_GPIO30) +#define MICROPY_QSPI_CS (&pin_GPIO29) +#endif + + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO12, .sda = &pin_GPIO11}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO48, .mosi = &pin_GPIO38, .miso = &pin_GPIO47}} + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO43, .rx = &pin_GPIO44}} diff --git a/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk new file mode 100644 index 0000000000..c9af3af25e --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x2341 +USB_PID = 0x0070 + +USB_PRODUCT = "Arduino Nano ESP32" +USB_MANUFACTURER = "Arduino" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB + +INTERNAL_FLASH_FILESYSTEM = 0 +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICES = GD25WQ128E + +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/arduino_nano_esp32s3/pins.c b/ports/espressif/boards/arduino_nano_esp32s3/pins.c new file mode 100644 index 0000000000..5eb6e2360e --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3/pins.c @@ -0,0 +1,63 @@ +#include "shared-bindings/board/__init__.h" + +CIRCUITPY_BOARD_BUS_SINGLETON(stemma_i2c, i2c, 1) + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_B0), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO48) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO48) }, + + { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO45) }, + + { MP_ROM_QSTR(MP_QSTR_TX0), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX0), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig b/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig new file mode 100644 index 0000000000..5e920f29ff --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig @@ -0,0 +1,43 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y + +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP \ No newline at end of file From e47e7bcdde760f80799d853d9191797f0dae276b Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Fri, 21 Jul 2023 14:50:24 -0700 Subject: [PATCH 1311/1712] Ran pre-commit --- ports/espressif/boards/arduino_nano_esp32s3/sdkconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig b/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig index 5e920f29ff..2acf08a4a7 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig +++ b/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig @@ -40,4 +40,4 @@ CONFIG_SPIRAM_MEMTEST=y # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" -# end of LWIP \ No newline at end of file +# end of LWIP From e58496feb281450235ca54c25d31b3de6e5ed723 Mon Sep 17 00:00:00 2001 From: Gaweng Tan Date: Sat, 22 Jul 2023 13:26:34 +0200 Subject: [PATCH 1312/1712] added Mapping to bits_per_value getter --- shared-bindings/displayio/Bitmap.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index c678a76703..17a4b4c87f 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -116,6 +116,21 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_bitmap_get_height_obj, displayio_bitmap_obj_ MP_PROPERTY_GETTER(displayio_bitmap_height_obj, (mp_obj_t)&displayio_bitmap_get_height_obj); +//| bits_per_value: int +//| """Bits per Pixel of the bitmap. (read only)""" +STATIC mp_obj_t displayio_bitmap_obj_get_bits_per_value(mp_obj_t self_in) { + displayio_bitmap_t *self = MP_OBJ_TO_PTR(self_in); + + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_displayio_bitmap_get_bits_per_value(self)); +} + +MP_DEFINE_CONST_FUN_OBJ_1(displayio_bitmap_get_bits_per_value_obj, displayio_bitmap_obj_get_bits_per_value); + +MP_PROPERTY_GETTER(displayio_bitmap_bits_per_value_obj, + (mp_obj_t)&displayio_bitmap_get_bits_per_value_obj); + + //| def __getitem__(self, index: Union[Tuple[int, int], int]) -> int: //| """Returns the value at the given index. The index can either be an x,y tuple or an int equal //| to ``y * width + x``. @@ -260,6 +275,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_bitmap_deinit_obj, displayio_bitmap_obj_dein STATIC const mp_rom_map_elem_t displayio_bitmap_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_bitmap_height_obj) }, { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&displayio_bitmap_width_obj) }, + { MP_ROM_QSTR(MP_QSTR_bits_per_value), MP_ROM_PTR(&displayio_bitmap_bits_per_value_obj) }, { MP_ROM_QSTR(MP_QSTR_fill), MP_ROM_PTR(&displayio_bitmap_fill_obj) }, { MP_ROM_QSTR(MP_QSTR_dirty), MP_ROM_PTR(&displayio_bitmap_dirty_obj) }, { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&displayio_bitmap_deinit_obj) }, From 8140d0cb03cdb3b49ff5c22631a5478a52e72c9b Mon Sep 17 00:00:00 2001 From: Gaweng Tan Date: Sat, 22 Jul 2023 14:34:06 +0200 Subject: [PATCH 1313/1712] Mapping python None to NULL in cadata var --- shared-bindings/ssl/SSLContext.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shared-bindings/ssl/SSLContext.c b/shared-bindings/ssl/SSLContext.c index ac5f7ad42d..ef227542fe 100644 --- a/shared-bindings/ssl/SSLContext.c +++ b/shared-bindings/ssl/SSLContext.c @@ -108,7 +108,10 @@ STATIC mp_obj_t ssl_sslcontext_load_verify_locations(size_t n_args, const mp_obj mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - const char *cadata = mp_obj_str_get_str(args[ARG_cadata].u_obj); + const char *cadata = NULL; + if (args[ARG_cadata].u_obj != mp_const_none) { + cadata = mp_obj_str_get_str(args[ARG_cadata].u_obj); + } common_hal_ssl_sslcontext_load_verify_locations(self, cadata); return mp_const_none; From 4bc12d9fb0887a7db264afea4e14f1978bfc76e4 Mon Sep 17 00:00:00 2001 From: Unexpected Maker Date: Sun, 23 Jul 2023 13:39:53 +1000 Subject: [PATCH 1314/1712] Update pins.c Changed naming of the second I2C board reference to match how others name things. --- ports/espressif/boards/unexpectedmaker_feathers3/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/pins.c b/ports/espressif/boards/unexpectedmaker_feathers3/pins.c index 4480e01438..5cdfc69ed2 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/pins.c +++ b/ports/espressif/boards/unexpectedmaker_feathers3/pins.c @@ -126,7 +126,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_VERTICAL_I2C), MP_ROM_PTR(&board_stemma_i2c_obj) }, - { MP_ROM_QSTR(MP_QSTR_STEMMA2_I2C), MP_ROM_PTR(&board_stemma_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C2), MP_ROM_PTR(&board_stemma_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_I2C2), MP_ROM_PTR(&board_stemma_i2c_obj) }, // SPI From 391bb1c45f22f3d25e8bc26c31904ed373b27ca0 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 26 May 2023 12:29:43 -0400 Subject: [PATCH 1315/1712] Add Adafruit Metro RP2040 --- .../boards/adafruit_metro_rp2040/board.c | 29 ++++++++ .../adafruit_metro_rp2040/mpconfigboard.h | 14 ++++ .../adafruit_metro_rp2040/mpconfigboard.mk | 9 +++ .../pico-sdk-configboard.h | 4 ++ .../boards/adafruit_metro_rp2040/pins.c | 66 +++++++++++++++++++ 5 files changed, 122 insertions(+) create mode 100644 ports/raspberrypi/boards/adafruit_metro_rp2040/board.c create mode 100644 ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/adafruit_metro_rp2040/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/adafruit_metro_rp2040/pins.c diff --git a/ports/raspberrypi/boards/adafruit_metro_rp2040/board.c b/ports/raspberrypi/boards/adafruit_metro_rp2040/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_metro_rp2040/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.h b/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.h new file mode 100644 index 0000000000..62eabc67f8 --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "Adafruit Metro RP2040" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO14) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO17) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO16) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO18) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO19) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk new file mode 100644 index 0000000000..14b3af9d57 --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x239A +USB_PID = 0x813E +USB_PRODUCT = "Metro RP2040" +USB_MANUFACTURER = "Adafruit" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ" diff --git a/ports/raspberrypi/boards/adafruit_metro_rp2040/pico-sdk-configboard.h b/ports/raspberrypi/boards/adafruit_metro_rp2040/pico-sdk-configboard.h new file mode 100644 index 0000000000..a41131dd22 --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_metro_rp2040/pico-sdk-configboard.h @@ -0,0 +1,4 @@ +// Put board-specific pico-sdk definitions here. This file must exist. + +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/adafruit_metro_rp2040/pins.c b/ports/raspberrypi/boards/adafruit_metro_rp2040/pins.c new file mode 100644 index 0000000000..04ae94c80f --- /dev/null +++ b/ports/raspberrypi/boards/adafruit_metro_rp2040/pins.c @@ -0,0 +1,66 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO24) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, + + // On-board switch reverses D0 and D1 connections to RX and TX. + + { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX_D0_SWITCH_LEFT), MP_ROM_PTR(&pin_GPIO0) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX_D0_SWITCH_RIGHT), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX_D1_SWITCH_LEFT), MP_ROM_PTR(&pin_GPIO1) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX_D1_SWITCH_RIGHT), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CD), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO18) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_CLOCK), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO19) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_COMMAND), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO20) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_DATA0), MP_ROM_PTR(&pin_GPIO20) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_DATA1), MP_ROM_PTR(&pin_GPIO21) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_DATA2), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO23) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDIO_DATA3), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 9a9fe1240df246263a98da1f42e5cfbdc6503fc0 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 17 Jul 2023 12:56:55 -0500 Subject: [PATCH 1316/1712] update metro rp2040 to work with 16MB flash --- ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk index 14b3af9d57..20c3042b7a 100644 --- a/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk +++ b/ports/raspberrypi/boards/adafruit_metro_rp2040/mpconfigboard.mk @@ -6,4 +6,4 @@ USB_MANUFACTURER = "Adafruit" CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 -EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ" +EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ,W25Q128JV" From 90ec0f2ee0f710cf5d46666556e21651f8d3727a Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Tue, 27 Jun 2023 17:14:24 +1000 Subject: [PATCH 1317/1712] shared-bindings/zlib: Fix docs for zlib.decompress. The docs say the method is called `zlib_decompress` but should be just `decompress`. Signed-off-by: Jim Mussared --- shared-bindings/zlib/__init__.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/shared-bindings/zlib/__init__.c b/shared-bindings/zlib/__init__.c index ba02914638..3b45e605e6 100644 --- a/shared-bindings/zlib/__init__.c +++ b/shared-bindings/zlib/__init__.c @@ -48,9 +48,7 @@ //| (commonly used in zlib library and gzip archiver). Compression is not yet implemented.""" //| -//| def zlib_decompress( -//| data: bytes, wbits: Optional[int] = 0, bufsize: Optional[int] = 0 -//| ) -> bytes: +//| def decompress(data: bytes, wbits: Optional[int] = 0, bufsize: Optional[int] = 0) -> bytes: //| """Return decompressed *data* as bytes. *wbits* is DEFLATE dictionary window //| size used during compression (8-15, the dictionary size is power of 2 of //| that value). Additionally, if value is positive, *data* is assumed to be From 311f6b0c79052e2e4f6b21dbfa55bb1fe32604d3 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 27 Jun 2023 19:11:25 -0400 Subject: [PATCH 1318/1712] add Adafruit Metro M7 1011 SD --- .../boards/adafruit_metro_m7_1011_sd/board.c | 64 ++++++++ .../adafruit_metro_m7_1011_sd/flash_config.c | 153 ++++++++++++++++++ .../adafruit_metro_m7_1011_sd/mpconfigboard.h | 20 +++ .../mpconfigboard.mk | 8 + .../boards/adafruit_metro_m7_1011_sd/pins.c | 60 +++++++ .../boards/metro_m7_1011/mpconfigboard.mk | 2 +- ports/mimxrt10xx/boards/metro_m7_1011/pins.c | 5 + 7 files changed, 311 insertions(+), 1 deletion(-) create mode 100644 ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/board.c create mode 100644 ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/flash_config.c create mode 100644 ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.h create mode 100644 ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.mk create mode 100644 ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/pins.c diff --git a/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/board.c b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/board.c new file mode 100644 index 0000000000..62be2303a5 --- /dev/null +++ b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/board.c @@ -0,0 +1,64 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2019 Artur Pacholec + * + * 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 "shared-bindings/microcontroller/Pin.h" + +// These pins should never ever be reset; doing so could interfere with basic operation. +// Used in common-hal/microcontroller/Pin.c +const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { + // SWD Pins + &pin_GPIO_AD_13,// SWDIO + &pin_GPIO_AD_12,// SWCLK + + // FLEX flash + &pin_GPIO_SD_12, + &pin_GPIO_SD_11, + &pin_GPIO_SD_10, + &pin_GPIO_SD_09, + &pin_GPIO_SD_08, + &pin_GPIO_SD_07, + &pin_GPIO_SD_06, + NULL, // Must end in NULL. +}; + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. + +bool mimxrt10xx_board_reset_pin_number(const mcu_pin_obj_t *pin) { + #if CIRCUITPY_SWO_TRACE + if (pin == &pin_GPIO_AD_09) { + IOMUXC_SetPinMux( /* Add these lines*/ + IOMUXC_GPIO_AD_09_ARM_TRACE_SWO, + 0U); + IOMUXC_SetPinConfig( /* Add these lines*/ + IOMUXC_GPIO_AD_09_ARM_TRACE_SWO, + 0x00F9U); + return true; + } + #endif + return false; +} diff --git a/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/flash_config.c b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/flash_config.c new file mode 100644 index 0000000000..3b47af1d6c --- /dev/null +++ b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/flash_config.c @@ -0,0 +1,153 @@ +/* + * Copyright 2017 NXP + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include "boards/flash_config.h" + +#include "xip/fsl_flexspi_nor_boot.h" + +// Config for W25Q32JV with QSPI routed. (compatible with GD25Q32) +__attribute__((section(".boot_hdr.conf"))) +const flexspi_nor_config_t qspiflash_config = { + .pageSize = 256u, + .sectorSize = 4u * 1024u, + .ipcmdSerialClkFreq = kFLEXSPISerialClk_133MHz, + .blockSize = 0x00010000, + .isUniformBlockSize = false, + .memConfig = + { + .tag = FLEXSPI_CFG_BLK_TAG, + .version = FLEXSPI_CFG_BLK_VERSION, + .readSampleClkSrc = kFLEXSPIReadSampleClk_LoopbackFromSckPad, + .csHoldTime = 3u, + .csSetupTime = 3u, + + .busyOffset = 0u, // Status bit 0 indicates busy. + .busyBitPolarity = 0u, // Busy when the bit is 1. + + .deviceModeCfgEnable = 1u, + .deviceModeType = kDeviceConfigCmdType_QuadEnable, + .deviceModeSeq = { + .seqId = 4u, + .seqNum = 1u, + }, + .deviceModeArg = 0x0200, + .configCmdEnable = 1u, + .configModeType[0] = kDeviceConfigCmdType_Generic, + .configCmdSeqs[0] = { + .seqId = 2u, + .seqNum = 1u, + }, + .deviceType = kFLEXSPIDeviceType_SerialNOR, + .sflashPadType = kSerialFlash_4Pads, + .serialClkFreq = kFLEXSPISerialClk_133MHz, + .sflashA1Size = FLASH_SIZE, + .lookupTable = + { + // FSL_ROM_FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1) + // The high 16 bits is command 1 and the low are command 0. + // Within a command, the top 6 bits are the opcode, the next two are the number + // of pads and then last byte is the operand. The operand's meaning changes + // per opcode. + + // Indices with ROM should always have the same function because the ROM + // bootloader uses it. + + // 0: ROM: Read LUTs + // Quad version + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB /* the command to send */, + RADDR_SDR, FLEXSPI_4PAD, 24 /* bits to transmit */), + FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 6 /* 6 dummy cycles, 2 for M7-0 and 4 dummy */, + READ_SDR, FLEXSPI_4PAD, 0x04), + // Single fast read version, good for debugging. + // FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B /* the command to send */, + // RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + // FSL_ROM_FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 8 /* 8 dummy clocks */, + // READ_SDR, FLEXSPI_1PAD, 0x04), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 1: ROM: Read status + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05 /* the command to send */, + READ_SDR, FLEXSPI_1PAD, 0x02), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 2: Empty + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x35 /* the command to send */, + DUMMY_SDR, FLEXSPI_1PAD, 8), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 3: ROM: Write Enable + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06 /* the command to send */, + STOP, FLEXSPI_1PAD, 0x00), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 4: Config: Write Status + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01 /* the command to send */, + WRITE_SDR, FLEXSPI_1PAD, 0x02), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 5: ROM: Erase Sector + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 6: Empty + EMPTY_SEQUENCE, + + // 7: Empty + EMPTY_SEQUENCE, + + // 8: Block Erase + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 9: ROM: Page program + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02 /* the command to send */, + RADDR_SDR, FLEXSPI_1PAD, 24 /* bits to transmit */), + + FSL_ROM_FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04 /* data out */, + STOP, FLEXSPI_1PAD, 0), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 10: Empty + EMPTY_SEQUENCE, + + // 11: ROM: Chip erase + SEQUENCE(FSL_ROM_FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60 /* the command to send */, + STOP, FLEXSPI_1PAD, 0), + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS, + TWO_EMPTY_STEPS), + + // 12: Empty + EMPTY_SEQUENCE, + + // 13: ROM: Read SFDP + EMPTY_SEQUENCE, + + // 14: ROM: Restore no cmd + EMPTY_SEQUENCE, + + // 15: ROM: Dummy + EMPTY_SEQUENCE + }, + }, +}; diff --git a/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.h b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.h new file mode 100644 index 0000000000..589b2a2b65 --- /dev/null +++ b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.h @@ -0,0 +1,20 @@ +#define MICROPY_HW_BOARD_NAME "Metro MIMXRT1011" +#define MICROPY_HW_MCU_NAME "IMXRT1011DAE5A" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO_00) + +// If you change this, then make sure to update the linker scripts as well to +// make sure you don't overwrite code +#define CIRCUITPY_INTERNAL_NVM_SIZE 0 + +#define BOARD_FLASH_SIZE (8 * 1024 * 1024) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO_02) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO_01) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO_AD_06) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO_AD_04) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO_AD_03) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO_09) +#define DEFAULT_UART_BUS_TX (&pin_GPIO_10) diff --git a/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.mk b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.mk new file mode 100644 index 0000000000..ec4c04c78e --- /dev/null +++ b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/mpconfigboard.mk @@ -0,0 +1,8 @@ +USB_VID = 0x239A +USB_PID = 0x8142 +USB_PRODUCT = "Metro M7 iMX RT1011 SD" +USB_MANUFACTURER = "Adafruit" + +CHIP_VARIANT = MIMXRT1011DAE5A +CHIP_FAMILY = MIMXRT1011 +FLASH = W25Q64JV diff --git a/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/pins.c b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/pins.c new file mode 100644 index 0000000000..8096973aaf --- /dev/null +++ b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/pins.c @@ -0,0 +1,60 @@ +#include "shared-bindings/board/__init__.h" + +#include "supervisor/board.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // Analog + { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO_AD_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO_AD_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO_AD_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO_AD_05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO_AD_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO_AD_08) }, + + // Digital + { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_09) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO_09) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO_10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO_13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO_12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO_SD_00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO_SD_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO_SD_02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO_11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO_08) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO_07) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO_06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO_05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO_04) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_GPIO_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_GPIO_03) }, + + // SD control + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CD), MP_ROM_PTR(&pin_GPIO_AD_11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO_AD_14) }, + + // SPI + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO_AD_06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO_AD_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO_AD_04) }, + + // I2C + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO_01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO_02) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO_00) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO_06) }, // D10 + { MP_ROM_QSTR(MP_QSTR_I2S_BIT_CLOCK), MP_ROM_PTR(&pin_GPIO_07) }, // D9 + { MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO_04) }, // D12 +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk b/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk index 56155aa4d0..ec7c6c2f1c 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk +++ b/ports/mimxrt10xx/boards/metro_m7_1011/mpconfigboard.mk @@ -1,6 +1,6 @@ USB_VID = 0x239A USB_PID = 0x80E2 -USB_PRODUCT = "Metro M7 iMX RT1011" +USB_PRODUCT = "Metro M7 iMX RT1011 AirLift" USB_MANUFACTURER = "Adafruit" CHIP_VARIANT = MIMXRT1011DAE5A diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/pins.c b/ports/mimxrt10xx/boards/metro_m7_1011/pins.c index 98082e3c11..fe03d09764 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/pins.c +++ b/ports/mimxrt10xx/boards/metro_m7_1011/pins.c @@ -58,8 +58,13 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO_06) }, // D10 { MP_ROM_QSTR(MP_QSTR_I2S_WSEL), MP_ROM_PTR(&pin_GPIO_06) }, // D10 + + { MP_ROM_QSTR(MP_QSTR_I2S_BIT_CLOCK), MP_ROM_PTR(&pin_GPIO_07) }, // D9 { MP_ROM_QSTR(MP_QSTR_I2S_BCLK), MP_ROM_PTR(&pin_GPIO_07) }, // D9 + + { MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO_04) }, // D12 { MP_ROM_QSTR(MP_QSTR_I2S_DOUT), MP_ROM_PTR(&pin_GPIO_04) }, // D12 }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 31aa9b2bb06c1745aa18c2ac67117ea03d91a80f Mon Sep 17 00:00:00 2001 From: Neradoc Date: Wed, 28 Jun 2023 15:11:23 +0200 Subject: [PATCH 1319/1712] Fix PSRAM on espressif ESP32S3 box and box lite --- ports/espressif/boards/espressif_esp32s3_box/sdkconfig | 1 + ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/ports/espressif/boards/espressif_esp32s3_box/sdkconfig b/ports/espressif/boards/espressif_esp32s3_box/sdkconfig index ead0088da5..6884299abe 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_box/sdkconfig @@ -1,3 +1,4 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y CONFIG_SPIRAM=y CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_SPEED_80M=y diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig index ead0088da5..6884299abe 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig @@ -1,3 +1,4 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y CONFIG_SPIRAM=y CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_SPEED_80M=y From 66d0d95f237dfb1b2202165819fa5eaf38669482 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 28 Jun 2023 22:56:08 -0400 Subject: [PATCH 1320/1712] adafruit_qtpy_esp32s3_4mbflash_2mbpsram --- .../board.c | 39 ++++++++++++ .../mpconfigboard.h | 45 ++++++++++++++ .../mpconfigboard.mk | 13 ++++ .../pins.c | 62 +++++++++++++++++++ .../sdkconfig | 47 ++++++++++++++ .../mpconfigboard.mk | 3 - 6 files changed, 206 insertions(+), 3 deletions(-) create mode 100644 ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/board.c create mode 100644 ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.h create mode 100644 ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk create mode 100644 ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/pins.c create mode 100644 ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/sdkconfig diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/board.c b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/board.c new file mode 100644 index 0000000000..3b1f5efd87 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/board.c @@ -0,0 +1,39 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.h b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.h new file mode 100644 index 0000000000..36319ce107 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/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 "Adafruit QT Py ESP32-S3 4MB Flash 2MB PSRAM" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO39) +#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO38) + +#define CIRCUITPY_BOARD_I2C (2) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO6, .sda = &pin_GPIO7}, \ + {.scl = &pin_GPIO40, .sda = &pin_GPIO41}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO36, .mosi = &pin_GPIO35, .miso = &pin_GPIO37}} + +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO5, .rx = &pin_GPIO16}} + +#define DOUBLE_TAP_PIN (&pin_GPIO10) diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk new file mode 100644 index 0000000000..50b1394a25 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk @@ -0,0 +1,13 @@ +USB_VID = 0x239A +USB_PID = 0x8144 + +USB_PRODUCT = "QT Py ESP32S3 4MB Flash 2MB PSRAM" +USB_MANUFACTURER = "Adafruit" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB + +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/pins.c b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/pins.c new file mode 100644 index 0000000000..5d0a3c0baa --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/pins.c @@ -0,0 +1,62 @@ +#include "shared-bindings/board/__init__.h" + +CIRCUITPY_BOARD_BUS_SINGLETON(stemma_i2c, i2c, 1) + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_SCL1), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_D40), MP_ROM_PTR(&pin_GPIO40) }, + + { MP_ROM_QSTR(MP_QSTR_SDA1), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_D41), MP_ROM_PTR(&pin_GPIO41) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_stemma_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/sdkconfig new file mode 100644 index 0000000000..9a05ab0205 --- /dev/null +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/sdkconfig @@ -0,0 +1,47 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP + +# end of Component config diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk index e695bae635..ac1e32a40d 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/mpconfigboard.mk @@ -10,7 +10,4 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register CIRCUITPY_ESPCAMERA = 0 From 97a8d713567701bc83fef41f361517ccc625cfbd Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 3 Jul 2023 12:08:10 -0700 Subject: [PATCH 1321/1712] Swapped address pins for Rev C --- ports/espressif/boards/adafruit_matrixportal_s3/pins.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/espressif/boards/adafruit_matrixportal_s3/pins.c b/ports/espressif/boards/adafruit_matrixportal_s3/pins.c index bc2de4299b..5cdd9ab92c 100644 --- a/ports/espressif/boards/adafruit_matrixportal_s3/pins.c +++ b/ports/espressif/boards/adafruit_matrixportal_s3/pins.c @@ -77,10 +77,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_G2),MP_ROM_PTR(&pin_GPIO39) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_B2),MP_ROM_PTR(&pin_GPIO37) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRA),MP_ROM_PTR(&pin_GPIO35) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRA),MP_ROM_PTR(&pin_GPIO45) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRB),MP_ROM_PTR(&pin_GPIO36) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRC),MP_ROM_PTR(&pin_GPIO48) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRD),MP_ROM_PTR(&pin_GPIO45) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRD),MP_ROM_PTR(&pin_GPIO35) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRE),MP_ROM_PTR(&pin_GPIO21) }, { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_CLK),MP_ROM_PTR(&pin_GPIO2) }, From 4dc9b0dde7e3502e95a3a3ea2df49031e005848f Mon Sep 17 00:00:00 2001 From: Zelin Cai Date: Fri, 7 Jul 2023 00:09:05 +0800 Subject: [PATCH 1322/1712] Added Makerdiary nRF52840 Connect Kit. Signed-off-by: Zelin Cai --- .../makerdiary_nrf52840_connectkit/README.md | 32 +++++++ .../makerdiary_nrf52840_connectkit/board.c | 29 +++++++ .../mpconfigboard.h | 30 +++++++ .../mpconfigboard.mk | 14 ++++ .../makerdiary_nrf52840_connectkit/pins.c | 84 +++++++++++++++++++ 5 files changed, 189 insertions(+) create mode 100644 ports/nrf/boards/makerdiary_nrf52840_connectkit/README.md create mode 100644 ports/nrf/boards/makerdiary_nrf52840_connectkit/board.c create mode 100644 ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.h create mode 100644 ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.mk create mode 100644 ports/nrf/boards/makerdiary_nrf52840_connectkit/pins.c diff --git a/ports/nrf/boards/makerdiary_nrf52840_connectkit/README.md b/ports/nrf/boards/makerdiary_nrf52840_connectkit/README.md new file mode 100644 index 0000000000..2d06ff73a0 --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_connectkit/README.md @@ -0,0 +1,32 @@ +# Makerdiary nRF52840 Connect Kit + +## Introduction + +[nRF52840 Connect Kit](https://makerdiary.com/products/nrf52840-connectkit) is an open-source prototyping +kit designed for connected projects. It is built using the nRF52840 SoC, which has protocol support for +Bluetooth LE, Bluetooth mesh, Thread, Zigbee, 802.15.4, ANT and 2.4 GHz proprietary stacks. It provides +Arm TrustZone® CryptoCell cryptographic unit as well as numerous peripherals such as USB 2.0, NFC-A, GPIO, +UART, SPI, TWI, PDM, I2S, QSPI, PWM, ADC, QDEC to support a wide range of applications. + +The design is available in an easy-to-use form factor with USB-C and 40 pin DIP/SMT type, including up to +32 multi-function GPIO pins (7 can be used as ADC inputs) and Serial Wire Debug (SWD) port. It features +RGB LED, Buttons, external 64 Mbit QSPI flash and flexible power management with various options for easily +powering the unit from USB-C, external supplies or batteries, and also has Chip antenna and U.FL receptacle +options to support various wireless scenarios. + +Refer to [nRF52840 Connect Kit wiki page](https://wiki.makerdiary.com/nrf52840-connectkit) for more details. + +![](https://wiki.makerdiary.com/nrf52840-connectkit/assets/images/nrf52840_connectkit_hero.png) + +## Hardware diagram + +The following figure illustrates the nRF52840 Connect Kit hardware diagram. The design is available in +Chip antenna and U.FL receptacle options, both have most of the same components except the antenna +interface. + +[![](https://wiki.makerdiary.com/nrf52840-connectkit/assets/images/pinout.png)](https://wiki.makerdiary.com/nrf52840-connectkit/assets/attachments/nrf52840-connectkit-quick-start-guide.pdf) + +## Get Involved + +We think the best way to learn is by doing. And to help you run CircuitPython on nRF52840 Connect Kit, +we have provided an extensive set of documentation. Find the details [here](https://wiki.makerdiary.com/nrf52840-connectkit/guides/python/). diff --git a/ports/nrf/boards/makerdiary_nrf52840_connectkit/board.c b/ports/nrf/boards/makerdiary_nrf52840_connectkit/board.c new file mode 100644 index 0000000000..fb1ce4fb83 --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_connectkit/board.c @@ -0,0 +1,29 @@ +/* + * 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.h b/ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.h new file mode 100644 index 0000000000..3cb15ca66b --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.h @@ -0,0 +1,30 @@ +#include "nrfx/hal/nrf_gpio.h" + +#define MICROPY_HW_BOARD_NAME "Makerdiary nRF52840 Connect Kit" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#if QSPI_FLASH_FILESYSTEM +#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 20) +#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 21) +#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 22) +#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 23) +#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19) +#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 17) +#endif + +#define BOARD_HAS_CRYSTAL 1 + +#define DEFAULT_I2C_BUS_SCL (&pin_P0_24) +#define DEFAULT_I2C_BUS_SDA (&pin_P0_25) + +#define DEFAULT_SPI_BUS_SCK (&pin_P0_14) +#define DEFAULT_SPI_BUS_MOSI (&pin_P0_15) +#define DEFAULT_SPI_BUS_MISO (&pin_P0_16) + +#define DEFAULT_UART_BUS_RX (&pin_P0_12) +#define DEFAULT_UART_BUS_TX (&pin_P0_13) + +#define CIRCUITPY_RGB_STATUS_INVERTED_PWM +#define CIRCUITPY_RGB_STATUS_R (&pin_P1_10) +#define CIRCUITPY_RGB_STATUS_G (&pin_P1_11) +#define CIRCUITPY_RGB_STATUS_B (&pin_P1_12) diff --git a/ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.mk b/ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.mk new file mode 100644 index 0000000000..0e5c1181c7 --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_connectkit/mpconfigboard.mk @@ -0,0 +1,14 @@ +USB_VID = 0x2886 +USB_PID = 0xF003 +USB_PRODUCT = "Makerdiary nRF52840 Connect Kit" +USB_MANUFACTURER = "Makerdiary" +SOFTDEV_VERSION=7.0.1 + +MCU_CHIP = nrf52840 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICES = "MX25R6435F" + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BLE +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/nrf/boards/makerdiary_nrf52840_connectkit/pins.c b/ports/nrf/boards/makerdiary_nrf52840_connectkit/pins.c new file mode 100644 index 0000000000..80478ca03f --- /dev/null +++ b/ports/nrf/boards/makerdiary_nrf52840_connectkit/pins.c @@ -0,0 +1,84 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_P3), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_P4), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_P5), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_P6), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_P7), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_P8), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_P9), MP_ROM_PTR(&pin_P0_09) }, + { MP_ROM_QSTR(MP_QSTR_P10), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_P11), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_P12), MP_ROM_PTR(&pin_P0_12) }, + { MP_ROM_QSTR(MP_QSTR_P13), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_P14), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_P15), MP_ROM_PTR(&pin_P0_15) }, + { MP_ROM_QSTR(MP_QSTR_P16), MP_ROM_PTR(&pin_P0_16) }, + { MP_ROM_QSTR(MP_QSTR_P18), MP_ROM_PTR(&pin_P0_18) }, + { MP_ROM_QSTR(MP_QSTR_P24), MP_ROM_PTR(&pin_P0_24) }, + { MP_ROM_QSTR(MP_QSTR_P25), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_P26), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_P27), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_P28), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_P29), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_P30), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_P31), MP_ROM_PTR(&pin_P0_31) }, + { MP_ROM_QSTR(MP_QSTR_P32), MP_ROM_PTR(&pin_P1_00) }, + { MP_ROM_QSTR(MP_QSTR_P33), MP_ROM_PTR(&pin_P1_01) }, + { MP_ROM_QSTR(MP_QSTR_P34), MP_ROM_PTR(&pin_P1_02) }, + { MP_ROM_QSTR(MP_QSTR_P35), MP_ROM_PTR(&pin_P1_03) }, + { MP_ROM_QSTR(MP_QSTR_P36), MP_ROM_PTR(&pin_P1_04) }, + { MP_ROM_QSTR(MP_QSTR_P37), MP_ROM_PTR(&pin_P1_05) }, + { MP_ROM_QSTR(MP_QSTR_P38), MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_P39), MP_ROM_PTR(&pin_P1_07) }, + { MP_ROM_QSTR(MP_QSTR_P40), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR_P41), MP_ROM_PTR(&pin_P1_09) }, + { MP_ROM_QSTR(MP_QSTR_P42), MP_ROM_PTR(&pin_P1_10) }, + { MP_ROM_QSTR(MP_QSTR_P43), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_P44), MP_ROM_PTR(&pin_P1_12) }, + { MP_ROM_QSTR(MP_QSTR_P45), MP_ROM_PTR(&pin_P1_13) }, + { MP_ROM_QSTR(MP_QSTR_P46), MP_ROM_PTR(&pin_P1_14) }, + { MP_ROM_QSTR(MP_QSTR_P47), MP_ROM_PTR(&pin_P1_15) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR_MEAS_EN), MP_ROM_PTR(&pin_P1_14) }, + { MP_ROM_QSTR(MP_QSTR_MODE), MP_ROM_PTR(&pin_P1_13) }, + + { MP_ROM_QSTR(MP_QSTR_USER), MP_ROM_PTR(&pin_P1_00) }, + { MP_ROM_QSTR(MP_QSTR_RESET), MP_ROM_PTR(&pin_P0_18) }, + + { MP_ROM_QSTR(MP_QSTR_LED0), MP_ROM_PTR(&pin_P1_15) }, + { MP_ROM_QSTR(MP_QSTR_LED1), MP_ROM_PTR(&pin_P1_10) }, + { MP_ROM_QSTR(MP_QSTR_LED2), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_LED3), MP_ROM_PTR(&pin_P1_12) }, + { MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_P1_10) }, + { MP_ROM_QSTR(MP_QSTR_GREEN_LED), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_P1_12) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_12) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_24) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_25) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_15) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_16) }, + + { 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_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From b6d4488b317c626234fd4a37c5a90ebeed6a0f50 Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+microdev1@users.noreply.github.com> Date: Sun, 9 Jul 2023 21:25:37 +0530 Subject: [PATCH 1323/1712] fix set hostname --- ports/raspberrypi/common-hal/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index e17b35d108..8571d490c4 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -88,7 +88,7 @@ mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self) { void common_hal_wifi_radio_set_hostname(wifi_radio_obj_t *self, const char *hostname) { assert(strlen(hostname) < MP_ARRAY_SIZE(self->hostname)); - memcpy(self->hostname, hostname, strlen(hostname)); + strncpy(self->hostname, hostname, MP_ARRAY_SIZE(self->hostname) - 1); netif_set_hostname(NETIF_STA, self->hostname); netif_set_hostname(NETIF_AP, self->hostname); } From 317cab87a7539016516689557bb429388a25f9b0 Mon Sep 17 00:00:00 2001 From: Leah Post Date: Thu, 6 Jul 2023 20:14:09 +0200 Subject: [PATCH 1324/1712] Add new board: splitkb.com's Liatris --- .../boards/splitkb_liatris/board.c | 29 ++++++++++ .../boards/splitkb_liatris/mpconfigboard.h | 14 +++++ .../boards/splitkb_liatris/mpconfigboard.mk | 9 +++ .../splitkb_liatris/pico-sdk-configboard.h | 1 + .../raspberrypi/boards/splitkb_liatris/pins.c | 55 +++++++++++++++++++ 5 files changed, 108 insertions(+) create mode 100644 ports/raspberrypi/boards/splitkb_liatris/board.c create mode 100644 ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/splitkb_liatris/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/splitkb_liatris/pins.c diff --git a/ports/raspberrypi/boards/splitkb_liatris/board.c b/ports/raspberrypi/boards/splitkb_liatris/board.c new file mode 100644 index 0000000000..7d8b03d5f4 --- /dev/null +++ b/ports/raspberrypi/boards/splitkb_liatris/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 Conor Burns 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.h b/ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.h new file mode 100644 index 0000000000..a38b4a5550 --- /dev/null +++ b/ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "splitkb.com Liatris" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO25) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO3) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO2) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO22) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO23) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.mk b/ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.mk new file mode 100644 index 0000000000..9ce0b7b925 --- /dev/null +++ b/ports/raspberrypi/boards/splitkb_liatris/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x2E8A +USB_PID = 0x1060 +USB_PRODUCT = "Liatris" +USB_MANUFACTURER = "splitkb.com" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q128JVxQ" diff --git a/ports/raspberrypi/boards/splitkb_liatris/pico-sdk-configboard.h b/ports/raspberrypi/boards/splitkb_liatris/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/splitkb_liatris/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/splitkb_liatris/pins.c b/ports/raspberrypi/boards/splitkb_liatris/pins.c new file mode 100644 index 0000000000..8086ee7fb9 --- /dev/null +++ b/ports/raspberrypi/boards/splitkb_liatris/pins.c @@ -0,0 +1,55 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // Left, top->bottom + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D4), 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_D7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + + // Right, top->bottom + { MP_ROM_QSTR(MP_QSTR_D29), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_D28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + + // Bottom, left->right + { 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_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + + // Internals + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_POWER_LED), MP_ROM_PTR(&pin_GPIO24) }, + + { 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_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From df821bf22c5b6ef973e4f483e1b5418c0fe1a541 Mon Sep 17 00:00:00 2001 From: Petr Sedlacek Date: Mon, 10 Jul 2023 22:57:45 +0200 Subject: [PATCH 1325/1712] Update 42. Keebs Frood support for Rev7 --- ports/raspberrypi/boards/42keebs_frood/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/42keebs_frood/mpconfigboard.mk b/ports/raspberrypi/boards/42keebs_frood/mpconfigboard.mk index 955d8d63f5..50d28c6ea9 100644 --- a/ports/raspberrypi/boards/42keebs_frood/mpconfigboard.mk +++ b/ports/raspberrypi/boards/42keebs_frood/mpconfigboard.mk @@ -6,4 +6,4 @@ USB_MANUFACTURER = "42. Keebs" CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 -EXTERNAL_FLASH_DEVICES = "ZD25WQ16B" +EXTERNAL_FLASH_DEVICES = "ZD25WQ16B, W25Q32JVxQ" From b87ceb26aa09011fada7b3dad740cae1ae346b76 Mon Sep 17 00:00:00 2001 From: Sylwester Date: Tue, 11 Jul 2023 09:52:47 +0200 Subject: [PATCH 1326/1712] Add Datanoise PicoADK --- .../boards/datanoise_picoadk/board.c | 29 +++++++++++ .../boards/datanoise_picoadk/mpconfigboard.h | 14 +++++ .../boards/datanoise_picoadk/mpconfigboard.mk | 9 ++++ .../datanoise_picoadk/pico-sdk-configboard.h | 4 ++ .../boards/datanoise_picoadk/pins.c | 51 +++++++++++++++++++ 5 files changed, 107 insertions(+) create mode 100644 ports/raspberrypi/boards/datanoise_picoadk/board.c create mode 100644 ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/datanoise_picoadk/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/datanoise_picoadk/pins.c diff --git a/ports/raspberrypi/boards/datanoise_picoadk/board.c b/ports/raspberrypi/boards/datanoise_picoadk/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/datanoise_picoadk/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.h b/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.h new file mode 100644 index 0000000000..f287893eeb --- /dev/null +++ b/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.h @@ -0,0 +1,14 @@ +#define MICROPY_HW_BOARD_NAME "Datanoise PicoADK" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO15) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO18) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO12) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO20) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) diff --git a/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk b/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk new file mode 100644 index 0000000000..1398f0b97f --- /dev/null +++ b/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk @@ -0,0 +1,9 @@ +USB_VID = 0x2E8A +USB_PID = 0x104B +USB_PRODUCT = "PicoADK" +USB_MANUFACTURER = "Datanoise" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "GD25Q32C,W25Q32JVxQ" diff --git a/ports/raspberrypi/boards/datanoise_picoadk/pico-sdk-configboard.h b/ports/raspberrypi/boards/datanoise_picoadk/pico-sdk-configboard.h new file mode 100644 index 0000000000..a41131dd22 --- /dev/null +++ b/ports/raspberrypi/boards/datanoise_picoadk/pico-sdk-configboard.h @@ -0,0 +1,4 @@ +// Put board-specific pico-sdk definitions here. This file must exist. + +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/datanoise_picoadk/pins.c b/ports/raspberrypi/boards/datanoise_picoadk/pins.c new file mode 100644 index 0000000000..7bcfd9a6f2 --- /dev/null +++ b/ports/raspberrypi/boards/datanoise_picoadk/pins.c @@ -0,0 +1,51 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D4), 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_D7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_ADC_SCK), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_ADC_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_ADC_MISO), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_ADC_CS), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D29), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_DOUT), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_I2S_BCLK), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_I2S_LRCLK), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_I2S_DEMP), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_I2S_XSMT), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) } +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From a4b4f57ff14166443aebeb804061a8ec4f6aea09 Mon Sep 17 00:00:00 2001 From: Sylwester Date: Tue, 11 Jul 2023 10:01:46 +0200 Subject: [PATCH 1327/1712] Add Datanoise PicoADK --- ports/raspberrypi/boards/datanoise_picoadk/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/datanoise_picoadk/pins.c b/ports/raspberrypi/boards/datanoise_picoadk/pins.c index 7bcfd9a6f2..9f1cc85b56 100644 --- a/ports/raspberrypi/boards/datanoise_picoadk/pins.c +++ b/ports/raspberrypi/boards/datanoise_picoadk/pins.c @@ -42,7 +42,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_I2S_XSMT), MP_ROM_PTR(&pin_GPIO25) }, { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO24) }, - + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, From 6d45f4504c71b3825cc875c82a2d4549b3ff158e Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 12 Jul 2023 23:24:33 -0500 Subject: [PATCH 1328/1712] web workflow: uses an mdns port service slot --- docs/workflows.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/workflows.md b/docs/workflows.md index 453b425491..a82130e63c 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -94,6 +94,10 @@ MDNS is used to resolve [`circuitpython.local`](http://circuitpython.local) to a hostname of the form `cpy-XXXXXX.local`. The `XXXXXX` is based on network MAC address. The device also provides the MDNS service with service type `_circuitpython` and protocol `_tcp`. +Since port 80 (or the port assigned to `CIRCUITPY_WEB_API_PORT`) is used for MDNS, the `mdns` +[module](https://docs.circuitpython.org/en/latest/shared-bindings/mdns/index.html#mdns.Server.advertise_service) +can't also advertise a service on that port. + ### HTTP The web server is HTTP 1.1 and may use chunked responses so that it doesn't need to precompute content length. From 3d212f70ebcddba7d4ac849a5b3e87cd3798369e Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 12 Jul 2023 23:32:44 -0500 Subject: [PATCH 1329/1712] mdns: can't use web workflow port --- shared-bindings/mdns/Server.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shared-bindings/mdns/Server.c b/shared-bindings/mdns/Server.c index 0d06d67f0d..2afc64e02b 100644 --- a/shared-bindings/mdns/Server.c +++ b/shared-bindings/mdns/Server.c @@ -171,6 +171,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mdns_server_find_obj, 1, _mdns_server_find); //| ``service_type`` and ``protocol`` can only occur on one port. Any call after the first //| will update the entry's port. //| +//| If web workflow is active, the port it uses can't also be used to advertise a service. +//| //| :param str service_type: The service type such as "_http" //| :param str protocol: The service protocol such as "_tcp" //| :param int port: The port used by the service""" From 104cf0bb3a405d066f2f0094f7c272b923d94494 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 12 Jul 2023 23:41:14 -0500 Subject: [PATCH 1330/1712] raspberrypi: start AP before set IPv4 --- shared-bindings/wifi/Radio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 66502426cd..46f8f50f48 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -560,6 +560,11 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_subnet_ap_obj, //| ) -> None: //| """Sets the IP v4 address of the station. Must include the netmask and gateway. DNS address is optional. //| Setting the address manually will stop the DHCP client.""" +//| +//| .. note:: +//| +//| In the raspberrypi port (RP2040 CYW43), the access point needs to be started before the IP v4 address can be set. +//| """ //| ... STATIC mp_obj_t wifi_radio_set_ipv4_address(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_ipv4, ARG_netmask, ARG_gateway, ARG_ipv4_dns }; From 939149bb2fb02c954d03694d451311864395a607 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 12 Jul 2023 23:53:52 -0500 Subject: [PATCH 1331/1712] formatting fix --- shared-bindings/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 46f8f50f48..ac97db85af 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -559,7 +559,7 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_subnet_ap_obj, //| ipv4_dns: Optional[ipaddress.IPv4Address], //| ) -> None: //| """Sets the IP v4 address of the station. Must include the netmask and gateway. DNS address is optional. -//| Setting the address manually will stop the DHCP client.""" +//| Setting the address manually will stop the DHCP client. //| //| .. note:: //| From 54b23feb060df2b520f78b47b79a7f1e62b9fcfe Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:41:07 -0500 Subject: [PATCH 1332/1712] Update docs/workflows.md Co-authored-by: Scott Shawcroft --- docs/workflows.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/workflows.md b/docs/workflows.md index a82130e63c..10d2897870 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -94,9 +94,9 @@ MDNS is used to resolve [`circuitpython.local`](http://circuitpython.local) to a hostname of the form `cpy-XXXXXX.local`. The `XXXXXX` is based on network MAC address. The device also provides the MDNS service with service type `_circuitpython` and protocol `_tcp`. -Since port 80 (or the port assigned to `CIRCUITPY_WEB_API_PORT`) is used for MDNS, the `mdns` +Since port 80 (or the port assigned to `CIRCUITPY_WEB_API_PORT`) is used for web workflow, the `mdns` [module](https://docs.circuitpython.org/en/latest/shared-bindings/mdns/index.html#mdns.Server.advertise_service) -can't also advertise a service on that port. +can't advertise an additional service on that port. ### HTTP The web server is HTTP 1.1 and may use chunked responses so that it doesn't need to precompute From d84c69c056f449e321ad68f17963fa4eb4dbb8e8 Mon Sep 17 00:00:00 2001 From: Sylwester Date: Thu, 13 Jul 2023 12:04:27 +0200 Subject: [PATCH 1333/1712] Add NeoPixel Library for Datanoise PicoADK. --- ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk b/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk index 1398f0b97f..405821da3e 100644 --- a/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk +++ b/ports/raspberrypi/boards/datanoise_picoadk/mpconfigboard.mk @@ -7,3 +7,6 @@ CHIP_VARIANT = RP2040 CHIP_FAMILY = rp2 EXTERNAL_FLASH_DEVICES = "GD25Q32C,W25Q32JVxQ" + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel From aba171656d37569e8c3e5e7f5b6ca1094e884782 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 13 Jul 2023 09:47:38 -0500 Subject: [PATCH 1334/1712] throw an exception if os.getenv is used on a board without settings.toml support --- shared-bindings/os/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index 18fec53049..d8d4f404e8 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -122,7 +122,7 @@ STATIC mp_obj_t os_getenv(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_ return common_hal_os_getenv(mp_obj_str_get_str(args[ARG_key].u_obj), args[ARG_default].u_obj); #else - return mp_const_none; + mp_raise_NotImplementedError(NULL); #endif } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(os_getenv_obj, 1, os_getenv); From 8abcbf3f3e732166e286a5f3a08c1ffed4a90a9a Mon Sep 17 00:00:00 2001 From: KB Sriram Date: Fri, 14 Jul 2023 21:53:58 -0700 Subject: [PATCH 1335/1712] py/objdict: Fix fromkeys to return the right type. Fixes https://github.com/adafruit/circuitpython/issues/8173 It looks like a small fix, and mostly independent of upstream plans around https://github.com/micropython/micropython/pull/6173 I also filed an issue upstream https://github.com/micropython/micropython/issues/12011 --- py/objdict.c | 16 ++++++++++++---- tests/basics/ordereddict1.py | 11 +++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/py/objdict.c b/py/objdict.c index 02aedacdd6..b63ea89137 100644 --- a/py/objdict.c +++ b/py/objdict.c @@ -110,8 +110,10 @@ STATIC void dict_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_ } } -mp_obj_t mp_obj_dict_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { - mp_obj_t dict_out = mp_obj_new_dict(0); +// This is a helper function to initialize an empty, but typed dictionary with +// a given number of slots. +STATIC mp_obj_t dict_new_typed(const mp_obj_type_t *type, const size_t n) { + mp_obj_t dict_out = mp_obj_new_dict(n); mp_obj_dict_t *dict = MP_OBJ_TO_PTR(dict_out); dict->base.type = type; #if MICROPY_PY_COLLECTIONS_ORDEREDDICT @@ -119,6 +121,11 @@ mp_obj_t mp_obj_dict_make_new(const mp_obj_type_t *type, size_t n_args, size_t n dict->map.is_ordered = 1; } #endif + return dict_out; +} + +mp_obj_t mp_obj_dict_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { + mp_obj_t dict_out = dict_new_typed(type, 0); if (n_args > 0 || n_kw > 0) { mp_obj_t args2[2] = {dict_out, args[0]}; // args[0] is always valid, even if it's not a positional arg mp_map_t kwargs; @@ -264,6 +271,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(dict_copy_obj, mp_obj_dict_copy); #if MICROPY_PY_BUILTINS_DICT_FROMKEYS // this is a classmethod STATIC mp_obj_t dict_fromkeys(size_t n_args, const mp_obj_t *args) { + mp_obj_type_t *type = MP_OBJ_TO_PTR(args[0]); mp_obj_t iter = mp_getiter(args[1], NULL); mp_obj_t value = mp_const_none; mp_obj_t next = MP_OBJ_NULL; @@ -277,9 +285,9 @@ STATIC mp_obj_t dict_fromkeys(size_t n_args, const mp_obj_t *args) { mp_obj_t len = mp_obj_len_maybe(args[1]); if (len == MP_OBJ_NULL) { /* object's type doesn't have a __len__ slot */ - self_out = mp_obj_new_dict(0); + self_out = dict_new_typed(type, 0); } else { - self_out = mp_obj_new_dict(MP_OBJ_SMALL_INT_VALUE(len)); + self_out = dict_new_typed(type, MP_OBJ_SMALL_INT_VALUE(len)); } mp_obj_dict_t *self = MP_OBJ_TO_PTR(self_out); diff --git a/tests/basics/ordereddict1.py b/tests/basics/ordereddict1.py index a6f305ff78..b70d7ff5d1 100644 --- a/tests/basics/ordereddict1.py +++ b/tests/basics/ordereddict1.py @@ -41,3 +41,14 @@ try: d.popitem() except: print('empty') + +# fromkeys returns the correct type and order +d = dict.fromkeys('abcdefghij') +print(type(d) == dict) +d = OrderedDict.fromkeys('abcdefghij') +print(type(d) == OrderedDict) +print(''.join(d)) + +# fromkey handles ordering with duplicates +d = OrderedDict.fromkeys('abcdefghijjihgfedcba') +print(''.join(d)) From bbf5e67fbb74b7c993136997eadd1f7c6a1d4f33 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Sun, 16 Jul 2023 20:35:49 -0500 Subject: [PATCH 1336/1712] docs: wifi.radio.ipv4_address_ap is read-only --- shared-bindings/wifi/Radio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 66502426cd..c3c271b0da 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -616,7 +616,7 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_address_obj, (mp_obj_t)&wifi_radio_get_ipv4_address_obj); //| ipv4_address_ap: Optional[ipaddress.IPv4Address] -//| """IP v4 Address of the access point, when enabled. None otherwise.""" +//| """IP v4 Address of the access point, when enabled. None otherwise. (read-only)""" STATIC mp_obj_t wifi_radio_get_ipv4_address_ap(mp_obj_t self) { return common_hal_wifi_radio_get_ipv4_address_ap(self); } From 3ee9aaff970c97d3a8abe493722ddee1d9949d61 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Mon, 24 Jul 2023 18:42:48 +0200 Subject: [PATCH 1337/1712] 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 | 88 +++++++++++++-------------------- locale/cs.po | 97 ++++++++++++++++-------------------- locale/de_DE.po | 103 +++++++++++++++++++-------------------- locale/el.po | 73 ++++++++------------------- locale/en_GB.po | 103 +++++++++++++++++++-------------------- locale/es.po | 103 +++++++++++++++++++-------------------- locale/fil.po | 76 +++++++++-------------------- locale/fr.po | 103 +++++++++++++++++++-------------------- locale/hi.po | 70 ++++++-------------------- locale/it_IT.po | 76 +++++++++-------------------- locale/ja.po | 91 ++++++++++++++-------------------- locale/ko.po | 70 ++++++-------------------- locale/nl.po | 91 ++++++++++++++-------------------- locale/pl.po | 88 +++++++++++++-------------------- locale/pt_BR.po | 103 +++++++++++++++++++-------------------- locale/ru.po | 103 +++++++++++++++++++-------------------- locale/sv.po | 103 +++++++++++++++++++-------------------- locale/tr.po | 100 +++++++++++++++++-------------------- locale/zh_Latn_pinyin.po | 103 +++++++++++++++++++-------------------- 19 files changed, 718 insertions(+), 1026 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 6208de5540..65084356f1 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -129,8 +129,10 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -185,6 +187,7 @@ msgid "%q must be 1 when %q is True" msgstr "" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "%q harus <= %d" @@ -786,10 +789,6 @@ msgstr "Tidak dapat menentukan RTS atau CTS dalam mode RS485" msgid "Cannot subclass slice" msgstr "Tidak dapat membuat subkelas dari irisan" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" @@ -1100,13 +1099,10 @@ msgstr "Grup sudah digunakan" msgid "Half duplex SPI is not implemented" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "Perangkat keras sibuk, coba pin alternatif" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "Perangkat keras sedang digunakan, coba pin alternatif" @@ -1367,14 +1363,6 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "Tidak menemukan Pin MISO atau MOSI" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1448,6 +1436,14 @@ msgid "Nimble out of memory" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "Tidak pin %q" @@ -1481,36 +1477,6 @@ msgstr "" msgid "No IP" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "Tidak ada Pin MISO" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "Tidak ada Pin MOSI" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "Tidak pin RX" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "Tidak ada pin TX" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "Tidak ada clocks yang tersedia" @@ -2433,6 +2399,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "" @@ -3656,11 +3623,6 @@ msgstr "" msgid "no module named '%q'" msgstr "tidak ada modul yang bernama '%q'" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "" @@ -4387,6 +4349,24 @@ msgstr "zi harus berjenis float" msgid "zi must be of shape (n_section, 2)" msgstr "Zi harus berbentuk (n_section, 2)" +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "Perangkat keras sibuk, coba pin alternatif" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "Tidak menemukan Pin MISO atau MOSI" + +#~ msgid "No MISO Pin" +#~ msgstr "Tidak ada Pin MISO" + +#~ msgid "No MOSI Pin" +#~ msgstr "Tidak ada Pin MOSI" + +#~ msgid "No RX pin" +#~ msgstr "Tidak pin RX" + +#~ msgid "No TX pin" +#~ msgstr "Tidak ada pin TX" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "Kecerahan harus di antara 0-1.0" diff --git a/locale/cs.po b/locale/cs.po index 751d6394b0..501cfed1c4 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -130,8 +130,10 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -186,6 +188,7 @@ msgid "%q must be 1 when %q is True" msgstr "%q musí být 1, pokud %q je True" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "%q musí být <= %d" @@ -786,10 +789,6 @@ msgstr "Nelze určit RTS nebo CTS v režimu RS485" msgid "Cannot subclass slice" msgstr "Nelze použít řez podtřídy" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Nelze měnit frekvenci časovače, který je již používán" @@ -1100,13 +1099,10 @@ msgstr "Skupina již byla použita" msgid "Half duplex SPI is not implemented" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "Hardware je zaneprázdněn, zkuste alternativní piny" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "Hardware je používán, zkuste alternativní piny" @@ -1367,14 +1363,6 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "Chybí pin MISO nebo MOSI" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "Chybějící MISO nebo MOSI pin" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1448,6 +1436,14 @@ msgid "Nimble out of memory" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "Žádný %q pin" @@ -1481,36 +1477,6 @@ msgstr "Žádné I2C zařízení na adrese: 0x%x" msgid "No IP" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "Žádný pin MISO" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "Žádný MISO pin" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "Žádný pin MOSI" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "Žádný MOSI pin" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "Žádný RX pin" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "Žádný TX pin" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "Žádné dostupné hodiny" @@ -2420,6 +2386,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "" @@ -3643,11 +3610,6 @@ msgstr "" msgid "no module named '%q'" msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "" @@ -4373,6 +4335,33 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "Hardware je zaneprázdněn, zkuste alternativní piny" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "Chybí pin MISO nebo MOSI" + +#~ msgid "Missing MISO or MOSI pin" +#~ msgstr "Chybějící MISO nebo MOSI pin" + +#~ msgid "No MISO Pin" +#~ msgstr "Žádný pin MISO" + +#~ msgid "No MISO pin" +#~ msgstr "Žádný MISO pin" + +#~ msgid "No MOSI Pin" +#~ msgstr "Žádný pin MOSI" + +#~ msgid "No MOSI pin" +#~ msgstr "Žádný MOSI pin" + +#~ msgid "No RX pin" +#~ msgstr "Žádný RX pin" + +#~ msgid "No TX pin" +#~ msgstr "Žádný TX pin" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "Jas musí být 0-1,0" diff --git a/locale/de_DE.po b/locale/de_DE.po index e706cb81c5..16c48fa6b6 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -138,8 +138,10 @@ msgstr "%q in %q muss von Typ %q sein, nicht %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -194,6 +196,7 @@ msgid "%q must be 1 when %q is True" msgstr "%q muss 1 sein, wenn %q wahr ist" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "%q muss <= %d sein" @@ -798,10 +801,6 @@ msgstr "RTS oder CTS können im RS485-Modus nicht angegeben werden" msgid "Cannot subclass slice" msgstr "Slice kann keine sub-klasse sein" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "Kann nicht ohne MISO und MOSI Pins transferieren" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" @@ -1119,13 +1118,10 @@ msgstr "Gruppe schon benutzt" msgid "Half duplex SPI is not implemented" msgstr "Hald-Duplex SPI is tnicht implementiert" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "Hardware beschäftigt, versuche alternative Pins" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "Hardware in Benutzung, probiere alternative Pins" @@ -1392,14 +1388,6 @@ msgstr "Nicht übereinstimmende Datengröße" msgid "Mismatched swap flag" msgstr "Nicht übereinstimmendes Swap-Flag" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "Fehlender MISO- oder MOSI-Pin" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "MISO oder MOSI Pin fehlt" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1473,6 +1461,14 @@ msgid "Nimble out of memory" msgstr "Kein Speicher mehr für Nible vorhanden" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "Kein %q-Pin" @@ -1506,36 +1502,6 @@ msgstr "Kein I2C-Gerät an Adresse: 0x%x" msgid "No IP" msgstr "Keine IP" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "Kein MISO-Pin" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "Miso Pin fehlt" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "Kein MOSI-Pin" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "MOSI Pin fehlt" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "Kein RX-Pin" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "Kein TX-Pin" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "Keine Taktgeber verfügbar" @@ -2477,6 +2443,7 @@ msgstr "Beide Knöpfe wurden beim Starten gedrückt." #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "Knopf A wurde beim Starten gedrückt." @@ -3722,11 +3689,6 @@ msgstr "kein Standard-Seed" msgid "no module named '%q'" msgstr "Kein Modul mit dem Namen '%q'" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "kein Reset Pin verfügbar" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "keine Antwort von der SD-Karte" @@ -4460,6 +4422,39 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "Cannot transfer without MOSI and MISO pins" +#~ msgstr "Kann nicht ohne MISO und MOSI Pins transferieren" + +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "Hardware beschäftigt, versuche alternative Pins" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "Fehlender MISO- oder MOSI-Pin" + +#~ msgid "Missing MISO or MOSI pin" +#~ msgstr "MISO oder MOSI Pin fehlt" + +#~ msgid "No MISO Pin" +#~ msgstr "Kein MISO-Pin" + +#~ msgid "No MISO pin" +#~ msgstr "Miso Pin fehlt" + +#~ msgid "No MOSI Pin" +#~ msgstr "Kein MOSI-Pin" + +#~ msgid "No MOSI pin" +#~ msgstr "MOSI Pin fehlt" + +#~ msgid "No RX pin" +#~ msgstr "Kein RX-Pin" + +#~ msgid "No TX pin" +#~ msgstr "Kein TX-Pin" + +#~ msgid "no reset pin available" +#~ msgstr "kein Reset Pin verfügbar" + #~ msgid "Sleep Memory not available" #~ msgstr "Sleep-Speicher nicht verfügbar" diff --git a/locale/el.po b/locale/el.po index 5e002f27df..d8b55956e8 100644 --- a/locale/el.po +++ b/locale/el.po @@ -141,8 +141,10 @@ msgstr "%q στο %q πρέπει να είναι τύπου %q, όχι %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -197,6 +199,7 @@ msgid "%q must be 1 when %q is True" msgstr "%q πρέπει να είναι 1 όταν %q είναι True" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "%q πρέπει να είναι <= %d" @@ -802,10 +805,6 @@ msgstr "Δεν μπορεί να οριστεί RTS ή CTS σε RS485 mode" msgid "Cannot subclass slice" msgstr "Δεν γίνεται υποκατηγορία ενός slice" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "Δεν μπορεί να γίνει μεταφορά χωρίς MOSI και MISO pins" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" @@ -1117,13 +1116,10 @@ msgstr "" msgid "Half duplex SPI is not implemented" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "" @@ -1382,14 +1378,6 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1463,6 +1451,14 @@ msgid "Nimble out of memory" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "" @@ -1496,36 +1492,6 @@ msgstr "" msgid "No IP" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "" @@ -2434,6 +2400,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "" @@ -3657,11 +3624,6 @@ msgstr "" msgid "no module named '%q'" msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "" @@ -4387,6 +4349,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Cannot transfer without MOSI and MISO pins" +#~ msgstr "Δεν μπορεί να γίνει μεταφορά χωρίς MOSI και MISO pins" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "Η φωτινότητα πρέπει να είναι μεταξύ 0-1.0" diff --git a/locale/en_GB.po b/locale/en_GB.po index 02d8748cf8..0984565599 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -139,8 +139,10 @@ msgstr "%q in %q must be of type %q, not %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -195,6 +197,7 @@ msgid "%q must be 1 when %q is True" msgstr "%q must be 1 when %q is True" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "%q must be <= %d" @@ -794,10 +797,6 @@ msgstr "Cannot specify RTS or CTS in RS485 mode" msgid "Cannot subclass slice" msgstr "Cannot subclass slice" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "Cannot transfer without MOSI and MISO pins" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Cannot vary frequency on a timer that is already in use" @@ -1108,13 +1107,10 @@ msgstr "Group already used" msgid "Half duplex SPI is not implemented" msgstr "Half duplex SPI is not implemented" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "Hardware busy, try alternative pins" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "Hardware in use, try alternative pins" @@ -1376,14 +1372,6 @@ msgstr "Mismatched data size" msgid "Mismatched swap flag" msgstr "Mismatched swap flag" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "Missing MISO or MOSI Pin" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "Missing MISO or MOSI pin" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1457,6 +1445,14 @@ msgid "Nimble out of memory" msgstr "Nimble out of memory" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "No %q pin" @@ -1490,36 +1486,6 @@ msgstr "No I2C device at address: 0x%x" msgid "No IP" msgstr "No IP" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "No MISO Pin" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "No MISO pin" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "No MOSI Pin" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "No MOSI pin" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "No RX pin" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "No TX pin" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "No available clocks" @@ -2443,6 +2409,7 @@ msgstr "You pressed both buttons at start up." #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "You pressed button A at start up." @@ -3671,11 +3638,6 @@ msgstr "no default seed" msgid "no module named '%q'" msgstr "no module named '%q'" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "no reset pin available" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "no response from SD card" @@ -4401,6 +4363,39 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "Cannot transfer without MOSI and MISO pins" +#~ msgstr "Cannot transfer without MOSI and MISO pins" + +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "Hardware busy, try alternative pins" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "Missing MISO or MOSI Pin" + +#~ msgid "Missing MISO or MOSI pin" +#~ msgstr "Missing MISO or MOSI pin" + +#~ msgid "No MISO Pin" +#~ msgstr "No MISO Pin" + +#~ msgid "No MISO pin" +#~ msgstr "No MISO pin" + +#~ msgid "No MOSI Pin" +#~ msgstr "No MOSI Pin" + +#~ msgid "No MOSI pin" +#~ msgstr "No MOSI pin" + +#~ msgid "No RX pin" +#~ msgstr "No RX pin" + +#~ msgid "No TX pin" +#~ msgstr "No TX pin" + +#~ msgid "no reset pin available" +#~ msgstr "no reset pin available" + #~ msgid "Sleep Memory not available" #~ msgstr "Sleep Memory not available" diff --git a/locale/es.po b/locale/es.po index ba8b07d0dd..931c391e50 100644 --- a/locale/es.po +++ b/locale/es.po @@ -141,8 +141,10 @@ msgstr "%q en %q debe ser del tipo %q, no %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -197,6 +199,7 @@ msgid "%q must be 1 when %q is True" msgstr "%q debe ser 1 cuando %q es True" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "%q debe ser <= %d" @@ -805,10 +808,6 @@ msgstr "No se puede especificar RTS o CTS en modo RS485" msgid "Cannot subclass slice" msgstr "No se puede manejar la partición en una subclase" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "No puede ser transferido si los pines MOSI y MISO" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "No puede variar la frecuencia en un temporizador que ya está en uso" @@ -1125,13 +1124,10 @@ msgstr "Grupo ya está siendo utilizado" msgid "Half duplex SPI is not implemented" msgstr "SPI Half Duplex no está implementado" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "Hardware ocupado, pruebe pines alternativos" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "Hardware en uso, pruebe pines alternativos" @@ -1400,14 +1396,6 @@ msgstr "Inconsistencia en el tamaño de los datos" msgid "Mismatched swap flag" msgstr "Inconsistencia en el flag de recambio" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "Falta el pin MISO o MOSI" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "Falta el pin MISO o MOSI" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1485,6 +1473,14 @@ msgid "Nimble out of memory" msgstr "Nimble sin memoria" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "Sin pin %q" @@ -1518,36 +1514,6 @@ msgstr "No hay dispositivo en la dirección: 0x%x" msgid "No IP" msgstr "No IP" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "Sin pin MISO" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "No pin MISO" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "Sin pin MOSI" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "No pin MOSI" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "Sin pin RX" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "Sin pin TX" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "Relojes no disponibles" @@ -2486,6 +2452,7 @@ msgstr "Usted presionó ambos botones al iniciar." #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "Usted presionó el botón A al iniciar." @@ -3722,11 +3689,6 @@ msgstr "sin semilla por omisión" msgid "no module named '%q'" msgstr "ningún módulo se llama '%q'" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "no hay pin de reinicio disponible" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "no hay respuesta de la tarjeta SD" @@ -4456,6 +4418,39 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Cannot transfer without MOSI and MISO pins" +#~ msgstr "No puede ser transferido si los pines MOSI y MISO" + +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "Hardware ocupado, pruebe pines alternativos" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "Falta el pin MISO o MOSI" + +#~ msgid "Missing MISO or MOSI pin" +#~ msgstr "Falta el pin MISO o MOSI" + +#~ msgid "No MISO Pin" +#~ msgstr "Sin pin MISO" + +#~ msgid "No MISO pin" +#~ msgstr "No pin MISO" + +#~ msgid "No MOSI Pin" +#~ msgstr "Sin pin MOSI" + +#~ msgid "No MOSI pin" +#~ msgstr "No pin MOSI" + +#~ msgid "No RX pin" +#~ msgstr "Sin pin RX" + +#~ msgid "No TX pin" +#~ msgstr "Sin pin TX" + +#~ msgid "no reset pin available" +#~ msgstr "no hay pin de reinicio disponible" + #~ msgid "Sleep Memory not available" #~ msgstr "Memoria de sueño no disponible" diff --git a/locale/fil.po b/locale/fil.po index ac2ddf6698..bc3f3bc1e6 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -127,8 +127,10 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -183,6 +185,7 @@ msgid "%q must be 1 when %q is True" msgstr "" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "" @@ -786,10 +789,6 @@ msgstr "" msgid "Cannot subclass slice" msgstr "Hindi magawa ang sublcass slice" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" @@ -1100,13 +1099,10 @@ msgstr "" msgid "Half duplex SPI is not implemented" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "" @@ -1367,14 +1363,6 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1448,6 +1436,14 @@ msgid "Nimble out of memory" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "Walang %q pin" @@ -1481,36 +1477,6 @@ msgstr "" msgid "No IP" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "Walang RX pin" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "Walang TX pin" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "" @@ -2423,6 +2389,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "" @@ -3662,11 +3629,6 @@ msgstr "" msgid "no module named '%q'" msgstr "walang module na '%q'" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "" @@ -4394,6 +4356,12 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "No RX pin" +#~ msgstr "Walang RX pin" + +#~ msgid "No TX pin" +#~ msgstr "Walang TX pin" + #, fuzzy #~ msgid "x value out of bounds" #~ msgstr "wala sa sakop ang address" diff --git a/locale/fr.po b/locale/fr.po index 27495cda1b..a466a12359 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -141,8 +141,10 @@ msgstr "%q dans %q doit être de type %q, pas %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -197,6 +199,7 @@ msgid "%q must be 1 when %q is True" msgstr "%q doit être 1 quand %q est True" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "%q doit être <= %d" @@ -807,10 +810,6 @@ msgstr "Impossible de spécifier RTS ou CTS en mode RS485" msgid "Cannot subclass slice" msgstr "On ne peut faire de sous-classes de tranches" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "Impossible de transférer sans une broche MOSI ou MISO" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Impossible de faire varier la fréquence sur un minuteur déjà utilisée" @@ -1133,13 +1132,10 @@ msgstr "Groupe déjà utilisé" msgid "Half duplex SPI is not implemented" msgstr "Le half duplex du SPI n'est pas implémenté" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "Matériel occupé, essayez d'autres broches" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "Matériel utilisé, essayez d'autres broches" @@ -1411,14 +1407,6 @@ msgstr "La taille des données ne correspond pas" msgid "Mismatched swap flag" msgstr "Le drapeau d'échange ne correspond pas" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "Broche MISO ou MOSI manquante" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "La broche MISO ou MOSI est manquante" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1495,6 +1483,14 @@ msgid "Nimble out of memory" msgstr "Nimble n'a plus de mémoire" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "Pas de broche %q" @@ -1528,36 +1524,6 @@ msgstr "Aucun périphérique I2S à l'adresse : 0x%x" msgid "No IP" msgstr "Aucune IP" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "Pas de broche MISO" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "Aucune broche MISO" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "Pas de broche MOSI" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "Aucune broche MOSI" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "Pas de broche RX" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "Pas de broche TX" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "Pas d'horloge disponible" @@ -2498,6 +2464,7 @@ msgstr "Vous avez appuyé les deux boutons au démarrage." #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "Vous avez appuyé le bouton A au démarrage." @@ -3743,11 +3710,6 @@ msgstr "aucun seed par défaut" msgid "no module named '%q'" msgstr "pas de module '%q'" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "pas de broche de réinitialisation disponible" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "pas de réponse de la carte SD" @@ -4479,6 +4441,39 @@ 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 "Cannot transfer without MOSI and MISO pins" +#~ msgstr "Impossible de transférer sans une broche MOSI ou MISO" + +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "Matériel occupé, essayez d'autres broches" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "Broche MISO ou MOSI manquante" + +#~ msgid "Missing MISO or MOSI pin" +#~ msgstr "La broche MISO ou MOSI est manquante" + +#~ msgid "No MISO Pin" +#~ msgstr "Pas de broche MISO" + +#~ msgid "No MISO pin" +#~ msgstr "Aucune broche MISO" + +#~ msgid "No MOSI Pin" +#~ msgstr "Pas de broche MOSI" + +#~ msgid "No MOSI pin" +#~ msgstr "Aucune broche MOSI" + +#~ msgid "No RX pin" +#~ msgstr "Pas de broche RX" + +#~ msgid "No TX pin" +#~ msgstr "Pas de broche TX" + +#~ msgid "no reset pin available" +#~ msgstr "pas de broche de réinitialisation disponible" + #~ msgid "Sleep Memory not available" #~ msgstr "La mémoire de sommeil n'est pas disponible" diff --git a/locale/hi.po b/locale/hi.po index bdbcd835dd..f684a9d9b8 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -126,8 +126,10 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -182,6 +184,7 @@ msgid "%q must be 1 when %q is True" msgstr "" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "" @@ -779,10 +782,6 @@ msgstr "" msgid "Cannot subclass slice" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" @@ -1090,13 +1089,10 @@ msgstr "" msgid "Half duplex SPI is not implemented" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "" @@ -1355,14 +1351,6 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1436,6 +1424,14 @@ msgid "Nimble out of memory" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "" @@ -1469,36 +1465,6 @@ msgstr "" msgid "No IP" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "" @@ -2405,6 +2371,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "" @@ -3628,11 +3595,6 @@ msgstr "" msgid "no module named '%q'" msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index f5519b25cc..ba9b3dc227 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -130,8 +130,10 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -186,6 +188,7 @@ msgid "%q must be 1 when %q is True" msgstr "" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "" @@ -789,10 +792,6 @@ msgstr "" msgid "Cannot subclass slice" msgstr "Impossibile subclasare slice" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" @@ -1102,13 +1101,10 @@ msgstr "" msgid "Half duplex SPI is not implemented" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "" @@ -1370,14 +1366,6 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1451,6 +1439,14 @@ msgid "Nimble out of memory" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "Nessun pin %q" @@ -1484,36 +1480,6 @@ msgstr "" msgid "No IP" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "Nessun pin RX" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "Nessun pin TX" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "Nessun orologio a disposizione" @@ -2430,6 +2396,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "" @@ -3668,11 +3635,6 @@ msgstr "" msgid "no module named '%q'" msgstr "nessun modulo chiamato '%q'" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "" @@ -4404,6 +4366,12 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "No RX pin" +#~ msgstr "Nessun pin RX" + +#~ msgid "No TX pin" +#~ msgstr "Nessun pin TX" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "La luminosità deve essere tra 0-1.0" diff --git a/locale/ja.po b/locale/ja.po index 65b6274cd4..0d7498178c 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -133,8 +133,10 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -189,6 +191,7 @@ msgid "%q must be 1 when %q is True" msgstr "" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "" @@ -790,10 +793,6 @@ msgstr "RS485モードにRTSまたはCTSを指定できません" msgid "Cannot subclass slice" msgstr "sliceをサブクラス化することはできません" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "使用中のタイマー上では周波数を変えられません" @@ -1101,13 +1100,10 @@ msgstr "グループはすでに使われています" msgid "Half duplex SPI is not implemented" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "ハードウェアビジー。代替のピンを試してください" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "ハードウェア使用中。代わりのピンを試してください" @@ -1368,14 +1364,6 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "MISOまたはMOSIピンがありません" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1449,6 +1437,14 @@ msgid "Nimble out of memory" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "%qピンがありません" @@ -1482,36 +1478,6 @@ msgstr "" msgid "No IP" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "MISOピンなし" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "MOSIピンがありません" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "RXピンがありません" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "TXピンがありません" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "利用できるクロックがありません" @@ -2422,6 +2388,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "" @@ -3650,11 +3617,6 @@ msgstr "" msgid "no module named '%q'" msgstr "'%q' という名前のモジュールはありません" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "利用可能なリセットピンがありません" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "SDカードからの応答がありません" @@ -4382,6 +4344,27 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "ハードウェアビジー。代替のピンを試してください" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "MISOまたはMOSIピンがありません" + +#~ msgid "No MISO Pin" +#~ msgstr "MISOピンなし" + +#~ msgid "No MOSI Pin" +#~ msgstr "MOSIピンがありません" + +#~ msgid "No RX pin" +#~ msgstr "RXピンがありません" + +#~ msgid "No TX pin" +#~ msgstr "TXピンがありません" + +#~ msgid "no reset pin available" +#~ msgstr "利用可能なリセットピンがありません" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "brightnessは0から1.0まででなければなりません" diff --git a/locale/ko.po b/locale/ko.po index cb0dad97e2..2fc43e592c 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -127,8 +127,10 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -183,6 +185,7 @@ msgid "%q must be 1 when %q is True" msgstr "" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "" @@ -782,10 +785,6 @@ msgstr "" msgid "Cannot subclass slice" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "" @@ -1093,13 +1092,10 @@ msgstr "" msgid "Half duplex SPI is not implemented" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "" @@ -1358,14 +1354,6 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1439,6 +1427,14 @@ msgid "Nimble out of memory" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "" @@ -1472,36 +1468,6 @@ msgstr "" msgid "No IP" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "" @@ -2409,6 +2375,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "" @@ -3632,11 +3599,6 @@ msgstr "" msgid "no module named '%q'" msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index cb2338ad92..719efe6914 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -126,8 +126,10 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -182,6 +184,7 @@ msgid "%q must be 1 when %q is True" msgstr "" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "" @@ -782,10 +785,6 @@ msgstr "Kan RTS of CTS niet specificeren in RS485 modus" msgid "Cannot subclass slice" msgstr "Kan slice niet subclasseren" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Kan de frequentie van een timer die al in gebruik is niet variëren" @@ -1096,13 +1095,10 @@ msgstr "Groep al gebruikt" msgid "Half duplex SPI is not implemented" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "Hardware bezig, probeer alternatieve pinnen" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "Hardware in gebruik, probeer alternatieve pinnen" @@ -1363,14 +1359,6 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "Ontbrekende MISO of MOSI Pin" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1444,6 +1432,14 @@ msgid "Nimble out of memory" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "Geen %q pin" @@ -1477,36 +1473,6 @@ msgstr "" msgid "No IP" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "Geen MISO pin" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "Geen MOSI pin" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "Geen RX pin" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "Geen TX pin" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "Geen klokken beschikbaar" @@ -2432,6 +2398,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "" @@ -3662,11 +3629,6 @@ msgstr "" msgid "no module named '%q'" msgstr "geen module met naam '%q'" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "geen reset pin beschikbaar" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "geen antwoord van SD kaart" @@ -4392,6 +4354,27 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "Hardware bezig, probeer alternatieve pinnen" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "Ontbrekende MISO of MOSI Pin" + +#~ msgid "No MISO Pin" +#~ msgstr "Geen MISO pin" + +#~ msgid "No MOSI Pin" +#~ msgstr "Geen MOSI pin" + +#~ msgid "No RX pin" +#~ msgstr "Geen RX pin" + +#~ msgid "No TX pin" +#~ msgstr "Geen TX pin" + +#~ msgid "no reset pin available" +#~ msgstr "geen reset pin beschikbaar" + #~ msgid "input and output shapes are not compatible" #~ msgstr "in- en uitvoervormen zijn niet compatibel" diff --git a/locale/pl.po b/locale/pl.po index a6af1932ee..35cc808126 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -128,8 +128,10 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -184,6 +186,7 @@ msgid "%q must be 1 when %q is True" msgstr "" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "" @@ -783,10 +786,6 @@ msgstr "Nie można określić RTS ani CTS w trybie RS485" msgid "Cannot subclass slice" msgstr "Nie można dziedziczyć ze slice" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Nie można zmieniać częstotliwości timera, który jest już używany" @@ -1096,13 +1095,10 @@ msgstr "Grupa już używana" msgid "Half duplex SPI is not implemented" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "Sprzęt zajęty, wypróbuj alternatywne piny" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "Sprzęt w użyciu, wypróbuj alternatywne piny" @@ -1363,14 +1359,6 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "Brak pinu MISO lub MOSI" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1444,6 +1432,14 @@ msgid "Nimble out of memory" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "Brak nóżki %q" @@ -1477,36 +1473,6 @@ msgstr "" msgid "No IP" msgstr "" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "Brak pinu MISO" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "Brak pinu MOSI" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "Brak nóżki RX" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "Brak nóżki TX" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "Brak wolnych zegarów" @@ -2413,6 +2379,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "" @@ -3637,11 +3604,6 @@ msgstr "" msgid "no module named '%q'" msgstr "brak modułu o nazwie '%q'" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "" @@ -4368,6 +4330,24 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "Sprzęt zajęty, wypróbuj alternatywne piny" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "Brak pinu MISO lub MOSI" + +#~ msgid "No MISO Pin" +#~ msgstr "Brak pinu MISO" + +#~ msgid "No MOSI Pin" +#~ msgstr "Brak pinu MOSI" + +#~ msgid "No RX pin" +#~ msgstr "Brak nóżki RX" + +#~ msgid "No TX pin" +#~ msgstr "Brak nóżki TX" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "Jasność musi wynosić 0-1,0" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 5b6cca5fb3..d44d309ad6 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -139,8 +139,10 @@ msgstr "%q em %q deve ser do tipo %q e não %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -195,6 +197,7 @@ msgid "%q must be 1 when %q is True" msgstr "%q deve ser 1 quando %q for verdadeiro" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "%q deve ser <= %d" @@ -806,10 +809,6 @@ msgstr "Não é possível definir o RTS ou CTS no modo RS485" msgid "Cannot subclass slice" msgstr "Não é possível subclassificar a fatia" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "Não é possível transferir sem os pinos MOSI e MISO" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Não é possível variar a frequência em um timer que já esteja em uso" @@ -1122,13 +1121,10 @@ msgstr "O grupo já está em uso" msgid "Half duplex SPI is not implemented" msgstr "O SPI half duplex ainda não está implementado" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "O hardware está ocupado, tente os pinos alternativos" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "O hardware está em uso, tente os pinos alternativos" @@ -1397,14 +1393,6 @@ msgstr "O tamanho dos dados é incompatível" msgid "Mismatched swap flag" msgstr "Sinalizador de troca incompatível" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "O pino MISO ou MOSI está ausente" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "Falta o pino MISO ou o MOSI" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1478,6 +1466,14 @@ msgid "Nimble out of memory" msgstr "Ágil fora da memória" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "Sem pin %q" @@ -1511,36 +1507,6 @@ msgstr "Não há nenhum dispositivo I2C no endereço: 0x%x" msgid "No IP" msgstr "Sem IP" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "Nenhum pino MISO" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "Nenhum pino MISO" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "Nenhum pino MOSI" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "Nenhum pino MOSI" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "Nenhum pino RX" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "Nenhum pino TX" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "Nenhum clock disponível" @@ -2482,6 +2448,7 @@ msgstr "Você pressionou os dois botões durante a inicialização." #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "Você pressionou o botão A na inicialização." @@ -3722,11 +3689,6 @@ msgstr "nenhuma semente padrão" msgid "no module named '%q'" msgstr "nenhum módulo chamado '%q'" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "nenhum pino de redefinição está disponível" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "não houve resposta do cartão SD" @@ -4457,6 +4419,39 @@ 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 "Cannot transfer without MOSI and MISO pins" +#~ msgstr "Não é possível transferir sem os pinos MOSI e MISO" + +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "O hardware está ocupado, tente os pinos alternativos" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "O pino MISO ou MOSI está ausente" + +#~ msgid "Missing MISO or MOSI pin" +#~ msgstr "Falta o pino MISO ou o MOSI" + +#~ msgid "No MISO Pin" +#~ msgstr "Nenhum pino MISO" + +#~ msgid "No MISO pin" +#~ msgstr "Nenhum pino MISO" + +#~ msgid "No MOSI Pin" +#~ msgstr "Nenhum pino MOSI" + +#~ msgid "No MOSI pin" +#~ msgstr "Nenhum pino MOSI" + +#~ msgid "No RX pin" +#~ msgstr "Nenhum pino RX" + +#~ msgid "No TX pin" +#~ msgstr "Nenhum pino TX" + +#~ msgid "no reset pin available" +#~ msgstr "nenhum pino de redefinição está disponível" + #~ msgid "Sleep Memory not available" #~ msgstr "Sleep memory não está disponível" diff --git a/locale/ru.po b/locale/ru.po index d4bbd20cac..8dd6627ad5 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -133,8 +133,10 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -189,6 +191,7 @@ msgid "%q must be 1 when %q is True" msgstr "%q должно быть 1 когда %q is True" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "%q должно быть <= %d" @@ -799,10 +802,6 @@ msgstr "Невозможно указать RTS или CTS в режиме RS485 msgid "Cannot subclass slice" msgstr "Срез субкласса невозможен" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "Невозможно передать данные без пинов MOSI и MISO" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Невозможно изменить частоту на таймере, который уже используется" @@ -1127,13 +1126,10 @@ msgstr "Группа уже используется" msgid "Half duplex SPI is not implemented" msgstr "Полудуплексный SPI не реализован" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "Оборудование занято, попробуйте использовать другие пины" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "Оборудование используется, попробуйте использовать другие пины" @@ -1402,14 +1398,6 @@ msgstr "Размер данных различается" msgid "Mismatched swap flag" msgstr "Несоответствие флага swap" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "Отсутствует пин MISO или MOSI" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "Отсутствует пин MISO или MOSI" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1484,6 +1472,14 @@ msgid "Nimble out of memory" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "Нет пина %q" @@ -1517,36 +1513,6 @@ msgstr "Не найдено устройство I2C по адресу: %x" msgid "No IP" msgstr "Нет IP" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "Нет пина MISO" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "Нет пина MISO" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "Нет пина MOSI" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "Нет пина MOSI" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "Нет пина RX" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "Нет пина TX" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "" @@ -2468,6 +2434,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "" @@ -3691,11 +3658,6 @@ msgstr "" msgid "no module named '%q'" msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "нет доступного контакта сброса" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "" @@ -4421,6 +4383,39 @@ msgstr "zi должно быть типа float" msgid "zi must be of shape (n_section, 2)" msgstr "zi должен иметь форму (n_section, 2)" +#~ msgid "Cannot transfer without MOSI and MISO pins" +#~ msgstr "Невозможно передать данные без пинов MOSI и MISO" + +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "Оборудование занято, попробуйте использовать другие пины" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "Отсутствует пин MISO или MOSI" + +#~ msgid "Missing MISO or MOSI pin" +#~ msgstr "Отсутствует пин MISO или MOSI" + +#~ msgid "No MISO Pin" +#~ msgstr "Нет пина MISO" + +#~ msgid "No MISO pin" +#~ msgstr "Нет пина MISO" + +#~ msgid "No MOSI Pin" +#~ msgstr "Нет пина MOSI" + +#~ msgid "No MOSI pin" +#~ msgstr "Нет пина MOSI" + +#~ msgid "No RX pin" +#~ msgstr "Нет пина RX" + +#~ msgid "No TX pin" +#~ msgstr "Нет пина TX" + +#~ msgid "no reset pin available" +#~ msgstr "нет доступного контакта сброса" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "Яркость должна быть в диапазоне от 0 до 1.0" diff --git a/locale/sv.po b/locale/sv.po index d5ab3cb7f2..28e2ee490e 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -138,8 +138,10 @@ msgstr "%q i %q måste vara av typen %q, inte %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -194,6 +196,7 @@ msgid "%q must be 1 when %q is True" msgstr "%q måste vara 1 när %q är sann" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "%q måste vara <= %d" @@ -797,10 +800,6 @@ msgstr "Det går inte att specificera RTS eller CTS i RS485-läget" msgid "Cannot subclass slice" msgstr "Det går inte att subklassa slice" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "Det går inte att överföra utan MOSI- och MISO-pinnar" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Det går inte att ändra frekvensen på en timer som redan används" @@ -1113,13 +1112,10 @@ msgstr "Grupp används redan" msgid "Half duplex SPI is not implemented" msgstr "Halvduplex SPI är inte implementerat" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "Hårdvaran är upptagen, prova alternativa pinnar" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "Hårdvaran används redan, prova alternativa pinnar" @@ -1383,14 +1379,6 @@ msgstr "Datastorlek matchar inte" msgid "Mismatched swap flag" msgstr "Felaktig swapflagga" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "MISO- eller MOSI-pinne saknas" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "Saknad MISO- eller MOSI-pinne" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1464,6 +1452,14 @@ msgid "Nimble out of memory" msgstr "Nimble har inget minne kvar" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "Ingen %q-pinne" @@ -1497,36 +1493,6 @@ msgstr "Ingen I2C-enhet på adress: 0x%x" msgid "No IP" msgstr "Ingen IP" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "Ingen MISO-pinne" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "Ingen MISO-pinne" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "Ingen MOSI-pinne" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "Ingen MOSI-pinne" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "Ingen RX-pinne" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "Ingen TX-pinne" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "Inga tillgängliga klockor" @@ -2455,6 +2421,7 @@ msgstr "Du tryckte ner båda knapparna vid start." #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "Du tryckte ner knapp A vid start." @@ -3688,11 +3655,6 @@ msgstr "inget standard seed" msgid "no module named '%q'" msgstr "ingen modul med namnet '%q'" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "ingen reset-pinne tillgänglig" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "inget svar från SD-kort" @@ -4419,6 +4381,39 @@ 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 "Cannot transfer without MOSI and MISO pins" +#~ msgstr "Det går inte att överföra utan MOSI- och MISO-pinnar" + +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "Hårdvaran är upptagen, prova alternativa pinnar" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "MISO- eller MOSI-pinne saknas" + +#~ msgid "Missing MISO or MOSI pin" +#~ msgstr "Saknad MISO- eller MOSI-pinne" + +#~ msgid "No MISO Pin" +#~ msgstr "Ingen MISO-pinne" + +#~ msgid "No MISO pin" +#~ msgstr "Ingen MISO-pinne" + +#~ msgid "No MOSI Pin" +#~ msgstr "Ingen MOSI-pinne" + +#~ msgid "No MOSI pin" +#~ msgstr "Ingen MOSI-pinne" + +#~ msgid "No RX pin" +#~ msgstr "Ingen RX-pinne" + +#~ msgid "No TX pin" +#~ msgstr "Ingen TX-pinne" + +#~ msgid "no reset pin available" +#~ msgstr "ingen reset-pinne tillgänglig" + #~ msgid "Sleep Memory not available" #~ msgstr "Sömnminne inte tillgängligt" diff --git a/locale/tr.po b/locale/tr.po index 6fe4fabeab..71ba460288 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -134,8 +134,10 @@ msgstr "" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -190,6 +192,7 @@ msgid "%q must be 1 when %q is True" msgstr "%q 1 olmalı, %q True olduğu zaman" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "%q <= %d olmalıdır" @@ -791,10 +794,6 @@ msgstr "RS485 modunda RTS veya CTS belirtilemez" msgid "Cannot subclass slice" msgstr "" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "MOSI ve MISO pinleri olmadan transfer edilemiyor" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Kullanımda olan bir zamanlayıcının frekansı değiştirilemez" @@ -1106,13 +1105,10 @@ msgstr "Grup zaten kullanılıyor" msgid "Half duplex SPI is not implemented" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "Donanım meşgul, alternatif pinleri deneyin" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "Donanım kullanımda, alternatif pinleri deneyin" @@ -1374,14 +1370,6 @@ msgstr "" msgid "Mismatched swap flag" msgstr "" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "Eksik MISO veya MOSI pini" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "Eksik MISO veya MOSI pini" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1455,6 +1443,14 @@ msgid "Nimble out of memory" msgstr "" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "%q pini yok" @@ -1488,36 +1484,6 @@ msgstr "" msgid "No IP" msgstr "IP yok" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "MISO pini yok" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "MISO pini yok" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "MOSI pini yok" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "MOSI pini yok" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "RX pini yok" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "TX pini yok" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "Kullanılabilir saat yok" @@ -2427,6 +2393,7 @@ msgstr "" #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "" @@ -3650,11 +3617,6 @@ msgstr "" msgid "no module named '%q'" msgstr "" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "" @@ -4380,6 +4342,36 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Cannot transfer without MOSI and MISO pins" +#~ msgstr "MOSI ve MISO pinleri olmadan transfer edilemiyor" + +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "Donanım meşgul, alternatif pinleri deneyin" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "Eksik MISO veya MOSI pini" + +#~ msgid "Missing MISO or MOSI pin" +#~ msgstr "Eksik MISO veya MOSI pini" + +#~ msgid "No MISO Pin" +#~ msgstr "MISO pini yok" + +#~ msgid "No MISO pin" +#~ msgstr "MISO pini yok" + +#~ msgid "No MOSI Pin" +#~ msgstr "MOSI pini yok" + +#~ msgid "No MOSI pin" +#~ msgstr "MOSI pini yok" + +#~ msgid "No RX pin" +#~ msgstr "RX pini yok" + +#~ msgid "No TX pin" +#~ msgstr "TX pini yok" + #~ msgid "Brightness must be 0-1.0" #~ msgstr "Parlaklık 0-1.0 aralığında olmalı" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 8ff874492e..9bcb0640c2 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -141,8 +141,10 @@ msgstr "%q zhōng de %q bì xū shì %q lèi xíng, ér bù shì %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c +#: ports/mimxrt10xx/common-hal/usb_host/Port.c #: ports/raspberrypi/common-hal/picodvi/Framebuffer.c #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +#: ports/raspberrypi/common-hal/usb_host/Port.c #: shared-bindings/digitalio/DigitalInOut.c #: shared-bindings/microcontroller/Pin.c msgid "%q in use" @@ -197,6 +199,7 @@ msgid "%q must be 1 when %q is True" msgstr "sāng %q wèi True shí, %q bìxū wèi 1" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "%q bìxū <= %d" @@ -800,10 +803,6 @@ msgstr "wúfǎ zài RS485 móshì xià zhǐdìng RTS huò CTS" msgid "Cannot subclass slice" msgstr "bùnéng zǐlèihuà qiēpiàn" -#: shared-module/bitbangio/SPI.c -msgid "Cannot transfer without MOSI and MISO pins" -msgstr "méiyǒu MOSI hé MISO yǐnjiǎo, wúfǎ chuánshū" - #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" msgstr "Wúfǎ zài shǐyòng zhōng de jìshí qì shàng gēnggǎi pínlǜ" @@ -1117,13 +1116,10 @@ msgstr "Jítuán yǐjīng shǐyòngguò" msgid "Half duplex SPI is not implemented" msgstr "wèi shí xiàn bàn shuāng gōng SPI" -#: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c -#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c -#: ports/stm/common-hal/sdioio/SDCard.c -msgid "Hardware busy, try alternative pins" -msgstr "Yìngjiàn máng, qǐng chángshì qítā zhēnjiǎo" - -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c +#: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c +#: ports/stm/common-hal/canio/CAN.c ports/stm/common-hal/sdioio/SDCard.c msgid "Hardware in use, try alternative pins" msgstr "Shǐyòng de yìngjiàn, qǐng chángshì qítā yǐn jiǎo" @@ -1389,14 +1385,6 @@ msgstr "shùjù dàxiǎo bù pǐpèi" msgid "Mismatched swap flag" msgstr "jiāohuàn biāozhì bù pǐpèi" -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI Pin" -msgstr "Quēshǎo MISO huò MOSI yǐn jiǎo" - -#: ports/stm/common-hal/busio/SPI.c -msgid "Missing MISO or MOSI pin" -msgstr "quēshǎo MISO huò MOSI yǐn jiǎo" - #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c #, c-format msgid "Missing first_in_pin. Instruction %d reads pin(s)" @@ -1471,6 +1459,14 @@ msgid "Nimble out of memory" msgstr "líng huó de bǎi tuō jì yì" #: ports/atmel-samd/common-hal/busio/UART.c +#: ports/espressif/common-hal/busio/SPI.c +#: ports/espressif/common-hal/busio/UART.c +#: ports/mimxrt10xx/common-hal/busio/SPI.c +#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c +#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/SPI.c +#: ports/stm/common-hal/busio/UART.c shared-bindings/displayio/FourWire.c +#: shared-bindings/displayio/I2CDisplay.c +#: shared-bindings/paralleldisplay/ParallelBus.c shared-module/bitbangio/SPI.c msgid "No %q pin" msgstr "Wèi zhǎodào %q yǐn jiǎo" @@ -1504,36 +1500,6 @@ msgstr "dì zhǐ: 0x%x shí méi yǒu I2C qì jiàn" msgid "No IP" msgstr "wú IP" -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MISO Pin" -msgstr "Méiyǒu MISO yǐn jiǎo" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MISO pin" -msgstr "wú MISO pin" - -#: ports/espressif/common-hal/busio/SPI.c -#: ports/mimxrt10xx/common-hal/busio/SPI.c -msgid "No MOSI Pin" -msgstr "Méiyǒu MOSI yǐn jiǎo" - -#: ports/stm/common-hal/busio/SPI.c shared-module/bitbangio/SPI.c -msgid "No MOSI pin" -msgstr "wú MOSI pin" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No RX pin" -msgstr "Wèi zhǎodào RX yǐn jiǎo" - -#: ports/espressif/common-hal/busio/UART.c -#: ports/mimxrt10xx/common-hal/busio/UART.c ports/nrf/common-hal/busio/UART.c -#: ports/raspberrypi/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c -msgid "No TX pin" -msgstr "Wèi zhǎodào TX yǐn jiǎo" - #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" msgstr "Méiyǒu kěyòng de shízhōng" @@ -2460,6 +2426,7 @@ msgstr "nín zài qǐ dòng shí àn xià le liǎng gè àn niǔ." #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h +#: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." msgstr "nín zài qǐ dòng shí àn xià le àn niǔ A." @@ -3692,11 +3659,6 @@ msgstr "wú mò rèn zhǒng zi" msgid "no module named '%q'" msgstr "méiyǒu mókuài '%q'" -#: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c -#: shared-bindings/paralleldisplay/ParallelBus.c -msgid "no reset pin available" -msgstr "Méiyǒu kěyòng de fùwèi yǐn jiǎo" - #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" msgstr "SD kǎ wú huíyīng" @@ -4425,6 +4387,39 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Cannot transfer without MOSI and MISO pins" +#~ msgstr "méiyǒu MOSI hé MISO yǐnjiǎo, wúfǎ chuánshū" + +#~ msgid "Hardware busy, try alternative pins" +#~ msgstr "Yìngjiàn máng, qǐng chángshì qítā zhēnjiǎo" + +#~ msgid "Missing MISO or MOSI Pin" +#~ msgstr "Quēshǎo MISO huò MOSI yǐn jiǎo" + +#~ msgid "Missing MISO or MOSI pin" +#~ msgstr "quēshǎo MISO huò MOSI yǐn jiǎo" + +#~ msgid "No MISO Pin" +#~ msgstr "Méiyǒu MISO yǐn jiǎo" + +#~ msgid "No MISO pin" +#~ msgstr "wú MISO pin" + +#~ msgid "No MOSI Pin" +#~ msgstr "Méiyǒu MOSI yǐn jiǎo" + +#~ msgid "No MOSI pin" +#~ msgstr "wú MOSI pin" + +#~ msgid "No RX pin" +#~ msgstr "Wèi zhǎodào RX yǐn jiǎo" + +#~ msgid "No TX pin" +#~ msgstr "Wèi zhǎodào TX yǐn jiǎo" + +#~ msgid "no reset pin available" +#~ msgstr "Méiyǒu kěyòng de fùwèi yǐn jiǎo" + #~ msgid "Sleep Memory not available" #~ msgstr "shuì mián jì yì bù kě yòng" From 7f8f1b37fd078c37667c7b8f26772ebebc48b1ca Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 24 Jul 2023 10:47:37 -0700 Subject: [PATCH 1338/1712] Fix pin names --- .../boards/arduino_nano_esp32s3/pins.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/ports/espressif/boards/arduino_nano_esp32s3/pins.c b/ports/espressif/boards/arduino_nano_esp32s3/pins.c index 5eb6e2360e..bf14bda2b9 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3/pins.c +++ b/ports/espressif/boards/arduino_nano_esp32s3/pins.c @@ -9,7 +9,11 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO7) }, @@ -19,9 +23,16 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO17) }, { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO48) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO1) }, { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO1) }, @@ -49,15 +60,12 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO48) }, - { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_GPIO46) }, { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO45) }, - { MP_ROM_QSTR(MP_QSTR_TX0), MP_ROM_PTR(&pin_GPIO43) }, - { MP_ROM_QSTR(MP_QSTR_RX0), MP_ROM_PTR(&pin_GPIO44) }, - + { 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_UART), MP_ROM_PTR(&board_uart_obj) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From f26d92fdb80affca378c36959fe1f6d822ddab1b Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 24 Jul 2023 15:11:22 -0700 Subject: [PATCH 1339/1712] Add inverted board and fix pins --- .../arduino_nano_esp32s3/mpconfigboard.h | 14 ++-- .../boards/arduino_nano_esp32s3/pins.c | 7 -- .../board.c | 39 +++++++++++ .../mpconfigboard.h | 54 ++++++++++++++++ .../mpconfigboard.mk | 17 +++++ .../pins.c | 64 +++++++++++++++++++ .../sdkconfig | 43 +++++++++++++ 7 files changed, 224 insertions(+), 14 deletions(-) create mode 100644 ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c create mode 100644 ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.h create mode 100644 ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk create mode 100644 ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/pins.c create mode 100644 ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig diff --git a/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h index 8e55a9285d..b9f22dab85 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h +++ b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h @@ -46,12 +46,12 @@ #define MICROPY_QSPI_CS (&pin_GPIO29) #endif +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO12) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO11) -#define CIRCUITPY_BOARD_I2C (1) -#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO12, .sda = &pin_GPIO11}} +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO48) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO38) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO47) -#define CIRCUITPY_BOARD_SPI (1) -#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO48, .mosi = &pin_GPIO38, .miso = &pin_GPIO47}} - -#define CIRCUITPY_BOARD_UART (1) -#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO43, .rx = &pin_GPIO44}} +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) \ No newline at end of file diff --git a/ports/espressif/boards/arduino_nano_esp32s3/pins.c b/ports/espressif/boards/arduino_nano_esp32s3/pins.c index bf14bda2b9..ca56c8900c 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3/pins.c +++ b/ports/espressif/boards/arduino_nano_esp32s3/pins.c @@ -1,7 +1,5 @@ #include "shared-bindings/board/__init__.h" -CIRCUITPY_BOARD_BUS_SINGLETON(stemma_i2c, i2c, 1) - STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS @@ -9,11 +7,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_GPIO0) }, { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO44) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, - { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO43) }, - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO7) }, @@ -66,6 +60,5 @@ STATIC const mp_rom_map_elem_t board_module_globals_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_UART), MP_ROM_PTR(&board_uart_obj) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c new file mode 100644 index 0000000000..3b1f5efd87 --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c @@ -0,0 +1,39 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.h b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.h new file mode 100644 index 0000000000..71ad8d10ce --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.h @@ -0,0 +1,54 @@ +/* + * 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 "Arduino Nano ESP32" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +// Status LED +#define CIRCUITPY_RGB_STATUS_INVERTED_PWM +#define CIRCUITPY_RGB_STATUS_R (&pin_GPIO46) +#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO45) +#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO0) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#if QSPI_FLASH_FILESYSTEM +#define MICROPY_QSPI_DATA0 (&pin_GPIO32) +#define MICROPY_QSPI_DATA1 (&pin_GPIO31) +#define MICROPY_QSPI_DATA2 (&pin_GPIO28) +#define MICROPY_QSPI_DATA3 (&pin_GPIO27) +#define MICROPY_QSPI_SCK (&pin_GPIO30) +#define MICROPY_QSPI_CS (&pin_GPIO29) +#endif + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO12) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO11) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO48) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO38) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO47) \ No newline at end of file diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk new file mode 100644 index 0000000000..c9af3af25e --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x2341 +USB_PID = 0x0070 + +USB_PRODUCT = "Arduino Nano ESP32" +USB_MANUFACTURER = "Arduino" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB + +INTERNAL_FLASH_FILESYSTEM = 0 +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICES = GD25WQ128E + +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/pins.c b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/pins.c new file mode 100644 index 0000000000..aa89a58ee4 --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/pins.c @@ -0,0 +1,64 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_B0), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO47) }, + + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO48) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO0) }, + + { 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_module_globals_table); diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig new file mode 100644 index 0000000000..2acf08a4a7 --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig @@ -0,0 +1,43 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y + +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP From cd961982420b2772069ff6b557545693c986664f Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 24 Jul 2023 15:18:07 -0700 Subject: [PATCH 1340/1712] Ran pre-commit --- ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h | 2 +- .../arduino_nano_esp32s3_inverted_statusled/mpconfigboard.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h index b9f22dab85..7c046d9b72 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h +++ b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h @@ -54,4 +54,4 @@ #define DEFAULT_SPI_BUS_MISO (&pin_GPIO47) #define DEFAULT_UART_BUS_RX (&pin_GPIO44) -#define DEFAULT_UART_BUS_TX (&pin_GPIO43) \ No newline at end of file +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.h b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.h index 71ad8d10ce..4d4adcf1cb 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.h +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.h @@ -51,4 +51,4 @@ #define DEFAULT_SPI_BUS_SCK (&pin_GPIO48) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO38) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO47) \ No newline at end of file +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO47) From 8f1ebdbd1087dc3581e5487d95b7b9720d31090f Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 24 Jul 2023 18:41:52 -0700 Subject: [PATCH 1341/1712] Added initial Adafruit Metro ESP32-S3 --- .../boards/adafruit_metro_esp32s3/board.c | 29 ++++++++ .../adafruit_metro_esp32s3/mpconfigboard.h | 46 ++++++++++++ .../adafruit_metro_esp32s3/mpconfigboard.mk | 10 +++ .../boards/adafruit_metro_esp32s3/pins.c | 71 +++++++++++++++++++ .../boards/adafruit_metro_esp32s3/sdkconfig | 46 ++++++++++++ 5 files changed, 202 insertions(+) create mode 100644 ports/espressif/boards/adafruit_metro_esp32s3/board.c create mode 100644 ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.h create mode 100644 ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.mk create mode 100644 ports/espressif/boards/adafruit_metro_esp32s3/pins.c create mode 100644 ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/board.c b/ports/espressif/boards/adafruit_metro_esp32s3/board.c new file mode 100644 index 0000000000..164430c88c --- /dev/null +++ b/ports/espressif/boards/adafruit_metro_esp32s3/board.c @@ -0,0 +1,29 @@ +/* + * 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.h b/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.h new file mode 100644 index 0000000000..d1e0ba0c26 --- /dev/null +++ b/ports/espressif/boards/adafruit_metro_esp32s3/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 "Adafruit Metro ESP32S3" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO45) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO48) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO47) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO41) +#define DEFAULT_UART_BUS_TX (&pin_GPIO40) + +#define DOUBLE_TAP_PIN (&pin_GPIO38) diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.mk b/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.mk new file mode 100644 index 0000000000..039c689eaf --- /dev/null +++ b/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x239A +USB_PID = 0x0145 +USB_PRODUCT = "Metro ESP32-S3" +USB_MANUFACTURER = "Adafruit" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 16MB diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c new file mode 100644 index 0000000000..e27f72f3bb --- /dev/null +++ b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c @@ -0,0 +1,71 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO17) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO18) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO1) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO40) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO41) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_GPIO47) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO47),MP_ROM_PTR(&pin_GPIO47) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_GPIO48) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO48),MP_ROM_PTR(&pin_GPIO48) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_GPIO35) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO35),MP_ROM_PTR(&pin_GPIO35) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_GPIO37) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO37),MP_ROM_PTR(&pin_GPIO37) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO45) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_TX), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig b/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig new file mode 100644 index 0000000000..2d819ad274 --- /dev/null +++ b/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig @@ -0,0 +1,46 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=8388608 +# end of SPI RAM config + +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="Metro-ESP32S3" +# end of LWIP From ad782664ad7abee86070b84e721462f06f632937 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 24 Jul 2023 21:29:30 -0500 Subject: [PATCH 1342/1712] update esp32spi and requests submodules --- frozen/Adafruit_CircuitPython_ESP32SPI | 2 +- frozen/Adafruit_CircuitPython_Requests | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frozen/Adafruit_CircuitPython_ESP32SPI b/frozen/Adafruit_CircuitPython_ESP32SPI index ee6bfcf9e6..c8bb6258a0 160000 --- a/frozen/Adafruit_CircuitPython_ESP32SPI +++ b/frozen/Adafruit_CircuitPython_ESP32SPI @@ -1 +1 @@ -Subproject commit ee6bfcf9e676eb435c8890db37f07719984a60a1 +Subproject commit c8bb6258a0444c31ab5ae69e3af1fffbd7761a99 diff --git a/frozen/Adafruit_CircuitPython_Requests b/frozen/Adafruit_CircuitPython_Requests index 558fff7223..36f1bb0f1b 160000 --- a/frozen/Adafruit_CircuitPython_Requests +++ b/frozen/Adafruit_CircuitPython_Requests @@ -1 +1 @@ -Subproject commit 558fff7223178eae6228e5262f3a08d3a4101394 +Subproject commit 36f1bb0f1b739a06b7e2782580ce08eecf17c78a From ae0ebfef2f209561ff0b73bef4aacb220354ba17 Mon Sep 17 00:00:00 2001 From: Tod Kurt Date: Fri, 21 Jul 2023 10:06:17 -0700 Subject: [PATCH 1343/1712] ESP32 synthio channels to 12 --- ports/espressif/mpconfigport.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 1b9808ad64..63cea3d0a8 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -38,6 +38,7 @@ CIRCUITPY_NVM ?= 1 CIRCUITPY_PS2IO ?= 1 CIRCUITPY_RGBMATRIX ?= 1 CIRCUITPY_ROTARYIO ?= 1 +CIRCUITPY_SYNTHIO_MAX_CHANNELS ?= 12 CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1 CIRCUITPY_WATCHDOG ?= 1 CIRCUITPY_WIFI ?= 1 From c781204105fcc83edac4897ab576e8835de2b279 Mon Sep 17 00:00:00 2001 From: Vladimir Smitka Date: Tue, 25 Jul 2023 14:40:53 +0200 Subject: [PATCH 1344/1712] Add PicoPad support --- .../boards/pajenicko_picopad/board.c | 114 ++++++++++++++++++ .../boards/pajenicko_picopad/link.ld | 1 + .../boards/pajenicko_picopad/mpconfigboard.h | 12 ++ .../boards/pajenicko_picopad/mpconfigboard.mk | 34 ++++++ .../pajenicko_picopad/pico-sdk-configboard.h | 1 + .../boards/pajenicko_picopad/pins.c | 113 +++++++++++++++++ 6 files changed, 275 insertions(+) create mode 100644 ports/raspberrypi/boards/pajenicko_picopad/board.c create mode 100644 ports/raspberrypi/boards/pajenicko_picopad/link.ld create mode 100644 ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/pajenicko_picopad/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/pajenicko_picopad/pins.c diff --git a/ports/raspberrypi/boards/pajenicko_picopad/board.c b/ports/raspberrypi/boards/pajenicko_picopad/board.c new file mode 100644 index 0000000000..0d092a1f4d --- /dev/null +++ b/ports/raspberrypi/boards/pajenicko_picopad/board.c @@ -0,0 +1,114 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" +#include "supervisor/shared/board.h" + +displayio_fourwire_obj_t board_display_obj; + +#define DELAY 0x80 + +uint8_t display_init_sequence[] = { + 0x01, 0 | DELAY, 150, // SWRESET + + 0x36, 1, 0x68, // MADCTL + 0x35, 1, 0x00, // TEON + 0xB2, 5, 0x0c, 0x0c, 0x00, 0x33, 0x33, // FRMCTR2 + 0x3A, 1, 0x05, // COLMOD + 0xB7, 1, 0x14, // GCTRL + 0xBB, 1, 0x37, // VCOMS + 0xC0, 1, 0x2c, // LCMCTRL + 0xC2, 1, 0x01, // VDVVRHEN + 0xC3, 1, 0x12, // VRHS + 0xC4, 1, 0x20, // VDVS + 0xD0, 2, 0xa4, 0xa1, // PWRCTRL1 + 0xC6, 1, 0x0f, // FRCTRL2 + 0xE0, 14, 0xd0, 0x04, 0x0d, 0x11, 0x13, 0x2b, 0x3f, 0x54, 0x4c, 0x18, 0x0d, 0x0b, 0x1f, 0x23, // GMCTRP1 + 0xE1, 14, 0xd0, 0x04, 0x0c, 0x11, 0x13, 0x2c, 0x3f, 0x44, 0x51, 0x2f, 0x1f, 0x1f, 0x20, 0x23, // GMCTRN1 + 0x21, 0, // INVON + + 0x11, 0 | DELAY, 255, // SLPOUT + 0x29, 0 | DELAY, 100, // DISPON + + 0x2a, 4, 0x00, 0, 0x00, 0xfe, // CASET + 0x2b, 4, 0x00, 0, 0x00, 0xfe, // RASET + 0x2c, 0, // RAMWR +}; + +void board_init(void) { + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO19, NULL, false); + common_hal_busio_spi_never_reset(spi); + + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_GPIO17, // TFT_DC Command or data + &pin_GPIO21, // TFT_CS Chip select + &pin_GPIO20, // TFT_RST Reset + 60000000, // Baudrate + 0, // Polarity + 0); // Phase + + displayio_display_obj_t *display = &allocate_display()->display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 320, // Width + 240, // Height + 0, // column start + 0, // row start + 0, // rotation + 16, // Color depth + false, // Grayscale + false, // pixels in a byte share a row. Only valid for depths < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_bytes_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 + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO16, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + true, // backlight_on_high + false, // SH1107_addressing + 50000); // backlight pwm frequency +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pajenicko_picopad/link.ld b/ports/raspberrypi/boards/pajenicko_picopad/link.ld new file mode 100644 index 0000000000..e814bead4c --- /dev/null +++ b/ports/raspberrypi/boards/pajenicko_picopad/link.ld @@ -0,0 +1 @@ +firmware_size = 1532k; diff --git a/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.h b/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.h new file mode 100644 index 0000000000..26b8447860 --- /dev/null +++ b/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.h @@ -0,0 +1,12 @@ +#define MICROPY_HW_BOARD_NAME "Pajenicko PicoPad" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1) +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1) + +#define MICROPY_HW_LED_STATUS (&pin_CYW0) + +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO0) +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO1) diff --git a/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk b/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk new file mode 100644 index 0000000000..2eeea9723f --- /dev/null +++ b/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk @@ -0,0 +1,34 @@ +USB_VID = 0x2E8A +USB_PID = 0x1063 + +USB_PRODUCT = "PicoPad" +USB_MANUFACTURER = "Pajenicko s.r.o." + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY_KEYPAD = 1 +CIRCUITPY_STAGE = 1 +CIRCUITPY_AUDIOIO = 1 + +CIRCUITPY__EVE = 1 + +CIRCUITPY_CYW43 = 1 +CIRCUITPY_SSL = 1 +CIRCUITPY_SSL_MBEDTLS = 1 +CIRCUITPY_HASHLIB = 1 +CIRCUITPY_WEB_WORKFLOW = 1 +CIRCUITPY_MDNS = 1 +CIRCUITPY_SOCKETPOOL = 1 +CIRCUITPY_WIFI = 1 + +CIRCUITPY_PICODVI = 1 + +# Pimoroni PicoSystem peripherals are compatible, we can use of existing ugame.py +FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/picosystem + +CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 +# Must be accompanied by a linker script change +CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' \ No newline at end of file diff --git a/ports/raspberrypi/boards/pajenicko_picopad/pico-sdk-configboard.h b/ports/raspberrypi/boards/pajenicko_picopad/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/pajenicko_picopad/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/pajenicko_picopad/pins.c b/ports/raspberrypi/boards/pajenicko_picopad/pins.c new file mode 100644 index 0000000000..de59502d69 --- /dev/null +++ b/ports/raspberrypi/boards/pajenicko_picopad/pins.c @@ -0,0 +1,113 @@ +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + //Default RPi Pico Pins + {MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0)}, + {MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1)}, + {MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2)}, + {MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3)}, + {MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4)}, + {MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5)}, + {MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6)}, + {MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7)}, + {MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8)}, + {MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9)}, + {MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10)}, + {MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11)}, + {MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12)}, + {MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13)}, + {MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14)}, + {MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15)}, + {MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16)}, + {MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17)}, + {MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18)}, + {MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19)}, + {MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20)}, + {MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21)}, + {MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22)}, + {MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26)}, + {MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27)}, + {MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28)}, + + //PicoPad external connector + /* + ┌──────┐ + GND -│1 2│- GND + 3V3 -│3 4│- VBAT + D5/A2 -│5 6│- ADC_VREF + D4/A1 -│7 8│- AGND + D3/TX/SDA -│9 10│- D0/A0 + D2/RX/SCL -│11 12│- D1 + └──────┘ + */ + + {MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO26)}, + {MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO14)}, + {MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO1)}, + {MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO0)}, + {MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO27)}, + {MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO28)}, + + {MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26)}, + {MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27)}, + {MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28)}, + + //PicoPad LCD + {MP_ROM_QSTR(MP_QSTR_LCD_RESET), MP_ROM_PTR(&pin_GPIO20)}, + {MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO21)}, + {MP_ROM_QSTR(MP_QSTR_LCD_SCLK), MP_ROM_PTR(&pin_GPIO18)}, + {MP_ROM_QSTR(MP_QSTR_LCD_MOSI), MP_ROM_PTR(&pin_GPIO19)}, + {MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO17)}, + {MP_ROM_QSTR(MP_QSTR_LCD_BL), MP_ROM_PTR(&pin_GPIO16)}, + + //PicoPad Audio + {MP_ROM_QSTR(MP_QSTR_AUDIO), MP_ROM_PTR(&pin_GPIO15)}, + + //PicoPad USR LED (yellow) + {MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO22)}, + + //PicoPad Buttons + {MP_ROM_QSTR(MP_QSTR_SW_X), MP_ROM_PTR(&pin_GPIO9)}, + {MP_ROM_QSTR(MP_QSTR_SW_Y), MP_ROM_PTR(&pin_GPIO8)}, + {MP_ROM_QSTR(MP_QSTR_SW_A), MP_ROM_PTR(&pin_GPIO7)}, + {MP_ROM_QSTR(MP_QSTR_SW_B), MP_ROM_PTR(&pin_GPIO6)}, + + {MP_ROM_QSTR(MP_QSTR_SW_DOWN), MP_ROM_PTR(&pin_GPIO5)}, + {MP_ROM_QSTR(MP_QSTR_SW_RIGHT), MP_ROM_PTR(&pin_GPIO2)}, + {MP_ROM_QSTR(MP_QSTR_SW_LEFT), MP_ROM_PTR(&pin_GPIO3)}, + {MP_ROM_QSTR(MP_QSTR_SW_UP), MP_ROM_PTR(&pin_GPIO4)}, + + //PicoPad SD Card + {MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO13)}, + {MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO10)}, + {MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO11)}, + {MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO12)}, + + //PicoPad Battery + {MP_ROM_QSTR(MP_QSTR_BAT_SENSE), MP_ROM_PTR(&pin_GPIO29)}, + + //PicoPad UART0 + {MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0)}, + {MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1)}, + + //PicoPad I2C0 + {MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO0)}, + {MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO1)}, + + //PicoPad I2C1 + {MP_ROM_QSTR(MP_QSTR_SDA_ALT), MP_ROM_PTR(&pin_GPIO14)}, + {MP_ROM_QSTR(MP_QSTR_SCL_ALT), MP_ROM_PTR(&pin_GPIO27)}, + + + {MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj)}, + {MP_ROM_QSTR(MP_QSTR_I2C_ALT), MP_ROM_PTR(&board_i2c_obj)}, + {MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj)}, + + {MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_CYW1)}, + {MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_CYW0)}, + {MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2)}, + {MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 8b6800e4d47c377591597ab295d5a5f86d229b7f Mon Sep 17 00:00:00 2001 From: foamyguy Date: Tue, 25 Jul 2023 08:58:37 -0500 Subject: [PATCH 1345/1712] update frozen libraries --- frozen/Adafruit_CircuitPython_APDS9960 | 2 +- frozen/Adafruit_CircuitPython_BLE | 2 +- frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center | 2 +- frozen/Adafruit_CircuitPython_BusDevice | 2 +- frozen/Adafruit_CircuitPython_CircuitPlayground | 2 +- frozen/Adafruit_CircuitPython_Crickit | 2 +- frozen/Adafruit_CircuitPython_DRV2605 | 2 +- frozen/Adafruit_CircuitPython_DS3231 | 2 +- frozen/Adafruit_CircuitPython_Display_Shapes | 2 +- frozen/Adafruit_CircuitPython_Display_Text | 2 +- frozen/Adafruit_CircuitPython_DotStar | 2 +- frozen/Adafruit_CircuitPython_FakeRequests | 2 +- frozen/Adafruit_CircuitPython_FocalTouch | 2 +- frozen/Adafruit_CircuitPython_HID | 2 +- frozen/Adafruit_CircuitPython_IRRemote | 2 +- frozen/Adafruit_CircuitPython_IS31FL3731 | 2 +- frozen/Adafruit_CircuitPython_LC709203F | 2 +- frozen/Adafruit_CircuitPython_LIS3DH | 2 +- frozen/Adafruit_CircuitPython_LSM6DS | 2 +- frozen/Adafruit_CircuitPython_MIDI | 2 +- frozen/Adafruit_CircuitPython_Motor | 2 +- frozen/Adafruit_CircuitPython_NeoPixel | 2 +- frozen/Adafruit_CircuitPython_PortalBase | 2 +- frozen/Adafruit_CircuitPython_ProgressBar | 2 +- frozen/Adafruit_CircuitPython_RFM69 | 2 +- frozen/Adafruit_CircuitPython_RFM9x | 2 +- frozen/Adafruit_CircuitPython_Register | 2 +- frozen/Adafruit_CircuitPython_SD | 2 +- frozen/Adafruit_CircuitPython_SSD1680 | 2 +- frozen/Adafruit_CircuitPython_ST7789 | 2 +- frozen/Adafruit_CircuitPython_SimpleIO | 2 +- frozen/Adafruit_CircuitPython_SimpleMath | 2 +- frozen/Adafruit_CircuitPython_Thermistor | 2 +- frozen/Adafruit_CircuitPython_Ticks | 2 +- frozen/Adafruit_CircuitPython_UC8151D | 2 +- frozen/Adafruit_CircuitPython_Wave | 2 +- frozen/Adafruit_CircuitPython_asyncio | 2 +- frozen/Adafruit_CircuitPython_seesaw | 2 +- 38 files changed, 38 insertions(+), 38 deletions(-) diff --git a/frozen/Adafruit_CircuitPython_APDS9960 b/frozen/Adafruit_CircuitPython_APDS9960 index 9ddd596505..2582575b50 160000 --- a/frozen/Adafruit_CircuitPython_APDS9960 +++ b/frozen/Adafruit_CircuitPython_APDS9960 @@ -1 +1 @@ -Subproject commit 9ddd59650598b7a0641d70aabcc8aab71799cb93 +Subproject commit 2582575b500547f26dae04c83e540367c121c7b4 diff --git a/frozen/Adafruit_CircuitPython_BLE b/frozen/Adafruit_CircuitPython_BLE index e07e1853d7..f32e7b953e 160000 --- a/frozen/Adafruit_CircuitPython_BLE +++ b/frozen/Adafruit_CircuitPython_BLE @@ -1 +1 @@ -Subproject commit e07e1853d7e995b9797a064c098bccc5c384632e +Subproject commit f32e7b953ec93f71fcb292074b6d25c7c4355a88 diff --git a/frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center b/frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center index b06b47037a..8455eb0b1f 160000 --- a/frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center +++ b/frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center @@ -1 +1 @@ -Subproject commit b06b47037aed97475b1676b104d1f4b05c3f5e86 +Subproject commit 8455eb0b1f5be39638a88df84c9ab360f50ecc90 diff --git a/frozen/Adafruit_CircuitPython_BusDevice b/frozen/Adafruit_CircuitPython_BusDevice index 9ace770b04..14f5a0b957 160000 --- a/frozen/Adafruit_CircuitPython_BusDevice +++ b/frozen/Adafruit_CircuitPython_BusDevice @@ -1 +1 @@ -Subproject commit 9ace770b048be9ab0da4a154af279dbb643bbdb0 +Subproject commit 14f5a0b957a11814339f0e22896243fecc9a78f2 diff --git a/frozen/Adafruit_CircuitPython_CircuitPlayground b/frozen/Adafruit_CircuitPython_CircuitPlayground index 47f848f13f..bdf4373d73 160000 --- a/frozen/Adafruit_CircuitPython_CircuitPlayground +++ b/frozen/Adafruit_CircuitPython_CircuitPlayground @@ -1 +1 @@ -Subproject commit 47f848f13f75d2f62d16407edaaf6dd0ec1fc3cc +Subproject commit bdf4373d734a5c000ef500f70c94b5b24d2663af diff --git a/frozen/Adafruit_CircuitPython_Crickit b/frozen/Adafruit_CircuitPython_Crickit index a37c7cc836..a1f6652943 160000 --- a/frozen/Adafruit_CircuitPython_Crickit +++ b/frozen/Adafruit_CircuitPython_Crickit @@ -1 +1 @@ -Subproject commit a37c7cc83685f2ff84a171a519207567a75d0947 +Subproject commit a1f66529437232d85dbbd3ce7d9688357966cc26 diff --git a/frozen/Adafruit_CircuitPython_DRV2605 b/frozen/Adafruit_CircuitPython_DRV2605 index ab0ffa938d..547a7d2a73 160000 --- a/frozen/Adafruit_CircuitPython_DRV2605 +++ b/frozen/Adafruit_CircuitPython_DRV2605 @@ -1 +1 @@ -Subproject commit ab0ffa938dfa7eb1fd7260353a7a4e28f55e537a +Subproject commit 547a7d2a738eeee18e511d71505a645915094395 diff --git a/frozen/Adafruit_CircuitPython_DS3231 b/frozen/Adafruit_CircuitPython_DS3231 index e6a9a0140e..fc3a6a651e 160000 --- a/frozen/Adafruit_CircuitPython_DS3231 +++ b/frozen/Adafruit_CircuitPython_DS3231 @@ -1 +1 @@ -Subproject commit e6a9a0140ed44ef5f15d8040fce35b5319c1f216 +Subproject commit fc3a6a651ee6211b02903ec0bc6808b359bf6d4b diff --git a/frozen/Adafruit_CircuitPython_Display_Shapes b/frozen/Adafruit_CircuitPython_Display_Shapes index cf2b173d0f..12beb94e47 160000 --- a/frozen/Adafruit_CircuitPython_Display_Shapes +++ b/frozen/Adafruit_CircuitPython_Display_Shapes @@ -1 +1 @@ -Subproject commit cf2b173d0fc3ac2cd961754c6adf8f614a1c7c39 +Subproject commit 12beb94e4758d6d0f4965b731b086a1bf8c3704e diff --git a/frozen/Adafruit_CircuitPython_Display_Text b/frozen/Adafruit_CircuitPython_Display_Text index 911201504a..c8bc5431f9 160000 --- a/frozen/Adafruit_CircuitPython_Display_Text +++ b/frozen/Adafruit_CircuitPython_Display_Text @@ -1 +1 @@ -Subproject commit 911201504a269dbfc49b04ca59bc54adabd4716a +Subproject commit c8bc5431f9ac20ca5b40d0760ac407368d640c4d diff --git a/frozen/Adafruit_CircuitPython_DotStar b/frozen/Adafruit_CircuitPython_DotStar index 187279a95e..67f8c35e2c 160000 --- a/frozen/Adafruit_CircuitPython_DotStar +++ b/frozen/Adafruit_CircuitPython_DotStar @@ -1 +1 @@ -Subproject commit 187279a95e5cdd634d233af59352558cea4c1227 +Subproject commit 67f8c35e2ce4a8abc3cfb24ab5029b40a64857b8 diff --git a/frozen/Adafruit_CircuitPython_FakeRequests b/frozen/Adafruit_CircuitPython_FakeRequests index 8eedf860be..bf7763ef99 160000 --- a/frozen/Adafruit_CircuitPython_FakeRequests +++ b/frozen/Adafruit_CircuitPython_FakeRequests @@ -1 +1 @@ -Subproject commit 8eedf860beca0d32219189b72ea6fc8eea7e66db +Subproject commit bf7763ef99ca00d1808a9aa47bb1d593a2cc0334 diff --git a/frozen/Adafruit_CircuitPython_FocalTouch b/frozen/Adafruit_CircuitPython_FocalTouch index 3d7d404a1c..5e4d371d21 160000 --- a/frozen/Adafruit_CircuitPython_FocalTouch +++ b/frozen/Adafruit_CircuitPython_FocalTouch @@ -1 +1 @@ -Subproject commit 3d7d404a1cafc02f6c3391b100157490132e5c5f +Subproject commit 5e4d371d210bbe00e63f83ce698f5bfa8652fa51 diff --git a/frozen/Adafruit_CircuitPython_HID b/frozen/Adafruit_CircuitPython_HID index 93c7e0ed55..9ec404f8b3 160000 --- a/frozen/Adafruit_CircuitPython_HID +++ b/frozen/Adafruit_CircuitPython_HID @@ -1 +1 @@ -Subproject commit 93c7e0ed55e7ed011908ac9a1c0f8228f0f4323b +Subproject commit 9ec404f8b318af5b4f02855311e5a00233ce29b5 diff --git a/frozen/Adafruit_CircuitPython_IRRemote b/frozen/Adafruit_CircuitPython_IRRemote index 340c62ef6c..fc377ac405 160000 --- a/frozen/Adafruit_CircuitPython_IRRemote +++ b/frozen/Adafruit_CircuitPython_IRRemote @@ -1 +1 @@ -Subproject commit 340c62ef6ce867b3924d166afc3d2a171680f799 +Subproject commit fc377ac4050c95eb8ea5eeacb8b68ef0d6152abb diff --git a/frozen/Adafruit_CircuitPython_IS31FL3731 b/frozen/Adafruit_CircuitPython_IS31FL3731 index 5433ba3760..31a6a9b69e 160000 --- a/frozen/Adafruit_CircuitPython_IS31FL3731 +++ b/frozen/Adafruit_CircuitPython_IS31FL3731 @@ -1 +1 @@ -Subproject commit 5433ba3760ca605267223de883a44cb8394f40a5 +Subproject commit 31a6a9b69e75144bdf29377b95f52213dab83e8a diff --git a/frozen/Adafruit_CircuitPython_LC709203F b/frozen/Adafruit_CircuitPython_LC709203F index 38bd02f014..02b4bacba3 160000 --- a/frozen/Adafruit_CircuitPython_LC709203F +++ b/frozen/Adafruit_CircuitPython_LC709203F @@ -1 +1 @@ -Subproject commit 38bd02f014403954ab52154e3877e502d83862dc +Subproject commit 02b4bacba30d029422e1df49be917e89f496067d diff --git a/frozen/Adafruit_CircuitPython_LIS3DH b/frozen/Adafruit_CircuitPython_LIS3DH index 240fe51935..6791d3fe75 160000 --- a/frozen/Adafruit_CircuitPython_LIS3DH +++ b/frozen/Adafruit_CircuitPython_LIS3DH @@ -1 +1 @@ -Subproject commit 240fe51935f4a9def33ef347d40b13862a60b7ac +Subproject commit 6791d3fe751239acbfc8dc293652b068f0dcc2f6 diff --git a/frozen/Adafruit_CircuitPython_LSM6DS b/frozen/Adafruit_CircuitPython_LSM6DS index d689ca77c6..691fefb264 160000 --- a/frozen/Adafruit_CircuitPython_LSM6DS +++ b/frozen/Adafruit_CircuitPython_LSM6DS @@ -1 +1 @@ -Subproject commit d689ca77c67806484037e00110c669cf55846b6e +Subproject commit 691fefb26458b872520988acf315ad72fd67798d diff --git a/frozen/Adafruit_CircuitPython_MIDI b/frozen/Adafruit_CircuitPython_MIDI index e38bf1f9cf..c572416239 160000 --- a/frozen/Adafruit_CircuitPython_MIDI +++ b/frozen/Adafruit_CircuitPython_MIDI @@ -1 +1 @@ -Subproject commit e38bf1f9cf1e8faeb7d15a1d10674fb2c0a81e72 +Subproject commit c572416239621066656c18dd88ee69ce383cfff5 diff --git a/frozen/Adafruit_CircuitPython_Motor b/frozen/Adafruit_CircuitPython_Motor index 9c3de3abce..cc5fa11ceb 160000 --- a/frozen/Adafruit_CircuitPython_Motor +++ b/frozen/Adafruit_CircuitPython_Motor @@ -1 +1 @@ -Subproject commit 9c3de3abce00b50ba936f4f8daad0a8a6bee34a6 +Subproject commit cc5fa11ceb68af5597f6a308fed5d9c8480c32a3 diff --git a/frozen/Adafruit_CircuitPython_NeoPixel b/frozen/Adafruit_CircuitPython_NeoPixel index 9516aa97e9..8211388d13 160000 --- a/frozen/Adafruit_CircuitPython_NeoPixel +++ b/frozen/Adafruit_CircuitPython_NeoPixel @@ -1 +1 @@ -Subproject commit 9516aa97e9216eac2b229fbb7dac34fa60c347c4 +Subproject commit 8211388d13f216a3933e7dc896c1fe054edc7bed diff --git a/frozen/Adafruit_CircuitPython_PortalBase b/frozen/Adafruit_CircuitPython_PortalBase index 759c5c3488..98d1d12b79 160000 --- a/frozen/Adafruit_CircuitPython_PortalBase +++ b/frozen/Adafruit_CircuitPython_PortalBase @@ -1 +1 @@ -Subproject commit 759c5c348878932adc5fcc9e4f3b3f570b43e17f +Subproject commit 98d1d12b79674e5e7722dcc31123ba990e3e83f7 diff --git a/frozen/Adafruit_CircuitPython_ProgressBar b/frozen/Adafruit_CircuitPython_ProgressBar index 74a1c26110..80501daf8f 160000 --- a/frozen/Adafruit_CircuitPython_ProgressBar +++ b/frozen/Adafruit_CircuitPython_ProgressBar @@ -1 +1 @@ -Subproject commit 74a1c261103cda43172053ff2370777255b9bf8d +Subproject commit 80501daf8f0cd7710d53f107a13821f63875a874 diff --git a/frozen/Adafruit_CircuitPython_RFM69 b/frozen/Adafruit_CircuitPython_RFM69 index af1cba8a7e..34c48e70f4 160000 --- a/frozen/Adafruit_CircuitPython_RFM69 +++ b/frozen/Adafruit_CircuitPython_RFM69 @@ -1 +1 @@ -Subproject commit af1cba8a7e4e3950fcc5367e9c55a024d9ab9f64 +Subproject commit 34c48e70f4209c363dac65d1a265ce9bb819c0a3 diff --git a/frozen/Adafruit_CircuitPython_RFM9x b/frozen/Adafruit_CircuitPython_RFM9x index c46c59e300..769bcbfe4b 160000 --- a/frozen/Adafruit_CircuitPython_RFM9x +++ b/frozen/Adafruit_CircuitPython_RFM9x @@ -1 +1 @@ -Subproject commit c46c59e3004817c708c78c59d247b02161c6bf06 +Subproject commit 769bcbfe4bc4366ab59958ca3042ded0029362ce diff --git a/frozen/Adafruit_CircuitPython_Register b/frozen/Adafruit_CircuitPython_Register index 46a49205f3..59ebc1930d 160000 --- a/frozen/Adafruit_CircuitPython_Register +++ b/frozen/Adafruit_CircuitPython_Register @@ -1 +1 @@ -Subproject commit 46a49205f3f14546273dd1267e66cad82f03986c +Subproject commit 59ebc1930d1e82b9a5a82e855077151ff6454fe2 diff --git a/frozen/Adafruit_CircuitPython_SD b/frozen/Adafruit_CircuitPython_SD index eb17bffa75..5537f45295 160000 --- a/frozen/Adafruit_CircuitPython_SD +++ b/frozen/Adafruit_CircuitPython_SD @@ -1 +1 @@ -Subproject commit eb17bffa757dc8c0a53fe9e61c45246c06418099 +Subproject commit 5537f452959b4f2d44742f24808fac7f7098c03d diff --git a/frozen/Adafruit_CircuitPython_SSD1680 b/frozen/Adafruit_CircuitPython_SSD1680 index 91b6867aca..916bf37b92 160000 --- a/frozen/Adafruit_CircuitPython_SSD1680 +++ b/frozen/Adafruit_CircuitPython_SSD1680 @@ -1 +1 @@ -Subproject commit 91b6867aca2b0511571fed14ab051d37f1f1544c +Subproject commit 916bf37b9270dfd60596a455e1405de01150397b diff --git a/frozen/Adafruit_CircuitPython_ST7789 b/frozen/Adafruit_CircuitPython_ST7789 index e23c487145..d939bbf939 160000 --- a/frozen/Adafruit_CircuitPython_ST7789 +++ b/frozen/Adafruit_CircuitPython_ST7789 @@ -1 +1 @@ -Subproject commit e23c4871456cdf0ef1bfb59d1c2f6e38b7b640ee +Subproject commit d939bbf9395a27d3200d12de333d7c78956a80a4 diff --git a/frozen/Adafruit_CircuitPython_SimpleIO b/frozen/Adafruit_CircuitPython_SimpleIO index eac33b430b..6897d6ff21 160000 --- a/frozen/Adafruit_CircuitPython_SimpleIO +++ b/frozen/Adafruit_CircuitPython_SimpleIO @@ -1 +1 @@ -Subproject commit eac33b430b0cbe1f6f583000f6b29f75bfe8507e +Subproject commit 6897d6ff21132e99111c72b2e60cf1d20223e9bb diff --git a/frozen/Adafruit_CircuitPython_SimpleMath b/frozen/Adafruit_CircuitPython_SimpleMath index dc605bb229..d85c19bf00 160000 --- a/frozen/Adafruit_CircuitPython_SimpleMath +++ b/frozen/Adafruit_CircuitPython_SimpleMath @@ -1 +1 @@ -Subproject commit dc605bb22914d77d80c5342cbb4c10f773aede95 +Subproject commit d85c19bf00e01f32382b1ef0ad9218bea4b6b234 diff --git a/frozen/Adafruit_CircuitPython_Thermistor b/frozen/Adafruit_CircuitPython_Thermistor index 43a4f15d60..16e712f385 160000 --- a/frozen/Adafruit_CircuitPython_Thermistor +++ b/frozen/Adafruit_CircuitPython_Thermistor @@ -1 +1 @@ -Subproject commit 43a4f15d604919d6e143e975a85abf7b96a4061d +Subproject commit 16e712f385526f2edbdf37394addf764cea35f29 diff --git a/frozen/Adafruit_CircuitPython_Ticks b/frozen/Adafruit_CircuitPython_Ticks index 2634ca0163..1542544d27 160000 --- a/frozen/Adafruit_CircuitPython_Ticks +++ b/frozen/Adafruit_CircuitPython_Ticks @@ -1 +1 @@ -Subproject commit 2634ca0163020bebec300fcca6e0b5afcdc655b8 +Subproject commit 1542544d2774895c4d9ef732f851b8a40796fe5c diff --git a/frozen/Adafruit_CircuitPython_UC8151D b/frozen/Adafruit_CircuitPython_UC8151D index b6d9f852f5..b9a599ae27 160000 --- a/frozen/Adafruit_CircuitPython_UC8151D +++ b/frozen/Adafruit_CircuitPython_UC8151D @@ -1 +1 @@ -Subproject commit b6d9f852f50b489615f3f357f9758d0073335334 +Subproject commit b9a599ae279f560d434206b947e3353e9c35bbea diff --git a/frozen/Adafruit_CircuitPython_Wave b/frozen/Adafruit_CircuitPython_Wave index 02b748f2e6..c4c4453f9a 160000 --- a/frozen/Adafruit_CircuitPython_Wave +++ b/frozen/Adafruit_CircuitPython_Wave @@ -1 +1 @@ -Subproject commit 02b748f2e6826dc442c842885e58b07ad10d9287 +Subproject commit c4c4453f9a7097df2683cf29341cb2d9e1167da6 diff --git a/frozen/Adafruit_CircuitPython_asyncio b/frozen/Adafruit_CircuitPython_asyncio index 596cc896e5..18a411eb87 160000 --- a/frozen/Adafruit_CircuitPython_asyncio +++ b/frozen/Adafruit_CircuitPython_asyncio @@ -1 +1 @@ -Subproject commit 596cc896e5c8815caa2a6f405560833193848149 +Subproject commit 18a411eb8749b8de94dcd9ddd0a2863f3ff17622 diff --git a/frozen/Adafruit_CircuitPython_seesaw b/frozen/Adafruit_CircuitPython_seesaw index d4ff0388f3..b317568508 160000 --- a/frozen/Adafruit_CircuitPython_seesaw +++ b/frozen/Adafruit_CircuitPython_seesaw @@ -1 +1 @@ -Subproject commit d4ff0388f3e3af2745864f2c3e5926f500673a40 +Subproject commit b317568508d67ed07f8078b9f941cf72945859fe From 8579766edea063dc681a8cac503f0af8101f569e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 25 Jul 2023 09:35:49 -0500 Subject: [PATCH 1346/1712] Optimize ulab for size on samd51/same51 --- ports/atmel-samd/mpconfigport.mk | 2 ++ py/circuitpy_mpconfig.mk | 3 +++ py/py.mk | 3 +++ 3 files changed, 8 insertions(+) diff --git a/ports/atmel-samd/mpconfigport.mk b/ports/atmel-samd/mpconfigport.mk index 032e49ce36..5f4bf1e603 100644 --- a/ports/atmel-samd/mpconfigport.mk +++ b/ports/atmel-samd/mpconfigport.mk @@ -106,6 +106,7 @@ CIRCUITPY_PS2IO ?= 1 CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_FRAMEBUFFERIO) CIRCUITPY_SAMD ?= 1 CIRCUITPY_SYNTHIO_MAX_CHANNELS = 12 +CIRCUITPY_ULAB_OPTIMIZE_SIZE ?= 1 CIRCUITPY_WATCHDOG ?= 1 endif # samd51 @@ -131,6 +132,7 @@ CIRCUITPY_SAMD ?= 1 CIRCUITPY_FLOPPYIO ?= $(CIRCUITPY_FULL_BUILD) CIRCUITPY_FRAMEBUFFERIO ?= $(CIRCUITPY_FULL_BUILD) CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_FRAMEBUFFERIO) +CIRCUITPY_ULAB_OPTIMIZE_SIZE ?= 1 endif # same51 ###################################################################### diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 3e43909687..90ef13ad9b 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -559,6 +559,9 @@ CFLAGS += -DCIRCUITPY_ZLIB=$(CIRCUITPY_ZLIB) CIRCUITPY_ULAB ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_ULAB=$(CIRCUITPY_ULAB) +# whether to use -Os optimization on files in ulab +CIRCUITPY_ULAB_OPTIMIZE_SIZE ?= 0 + # CIRCUITPY_VIDEOCORE is handled in the broadcom tree. # Only for Broadcom chips. # Assume not a Broadcom build. diff --git a/py/py.mk b/py/py.mk index c598f44cbd..4a2d8544f1 100644 --- a/py/py.mk +++ b/py/py.mk @@ -57,6 +57,9 @@ ULAB_SRCS := $(shell find $(TOP)/extmod/ulab/code -type f -name "*.c") SRC_MOD += $(patsubst $(TOP)/%,%,$(ULAB_SRCS)) CFLAGS_MOD += -DCIRCUITPY_ULAB=1 -DMODULE_ULAB_ENABLED=1 -DULAB_HAS_USER_MODULE=0 -iquote $(TOP)/extmod/ulab/code $(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Wno-missing-declarations -Wno-missing-prototypes -Wno-unused-parameter -Wno-float-equal -Wno-sign-compare -Wno-cast-align -Wno-shadow -DCIRCUITPY +ifeq ($(CIRCUITPY_ULAB_OPTIMIZE_SIZE),1) +$(BUILD)/extmod/ulab/code/%.o: CFLAGS += -Os +endif endif # py object files From adc2dab3a99f2facda156874e354b3e42fb04014 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 25 Jul 2023 09:35:55 -0500 Subject: [PATCH 1347/1712] disable ulab on pyb_nano_v2 --- ports/stm/boards/pyb_nano_v2/mpconfigboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/stm/boards/pyb_nano_v2/mpconfigboard.mk b/ports/stm/boards/pyb_nano_v2/mpconfigboard.mk index c8b548c50f..1ab3c91a08 100644 --- a/ports/stm/boards/pyb_nano_v2/mpconfigboard.mk +++ b/ports/stm/boards/pyb_nano_v2/mpconfigboard.mk @@ -17,3 +17,4 @@ LD_FILE = boards/STM32F411_fs.ld CIRCUITPY_AUDIOCORE = 0 CIRCUITPY_AUDIOPWMIO = 0 CIRCUITPY_BLEIO_HCI = 0 +CIRCUITPY_ULAB = 0 From 509ddf2f890dffc106d0685b8ba3f95184088524 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 25 Jul 2023 10:48:35 -0500 Subject: [PATCH 1348/1712] samd: disable some modules so updated ulab fits * floppyio: disable on itsybitsy m4, metro m4 express & airlift, pybadge, pygamer, wio terminal * gifio: disable on itsybitsy m4 express * framebufferio: disable on treills m4 express, wio terminal * terminalio: disable on metro m4 express/airlift for ja/ko/ru --- .../boards/itsybitsy_m4_express/mpconfigboard.mk | 2 ++ .../boards/metro_m4_airlift_lite/mpconfigboard.mk | 11 +++++++++++ .../boards/metro_m4_express/mpconfigboard.mk | 11 +++++++++++ ports/atmel-samd/boards/pybadge/mpconfigboard.mk | 1 + ports/atmel-samd/boards/pygamer/mpconfigboard.mk | 1 + .../boards/seeeduino_wio_terminal/mpconfigboard.mk | 2 ++ .../boards/trellis_m4_express/mpconfigboard.mk | 2 ++ 7 files changed, 30 insertions(+) diff --git a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk index 7a45ef21e9..d805d49aff 100644 --- a/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/itsybitsy_m4_express/mpconfigboard.mk @@ -12,5 +12,7 @@ LONGINT_IMPL = MPZ # No I2S on SAMD51G CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_FLOPPYIO = 0 +CIRCUITPY_GIFIO = 0 CIRCUITPY_BITBANG_APA102 = 1 diff --git a/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk index ed1cd2455c..065c48d064 100644 --- a/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk +++ b/ports/atmel-samd/boards/metro_m4_airlift_lite/mpconfigboard.mk @@ -11,4 +11,15 @@ EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C" LONGINT_IMPL = MPZ CIRCUITPY__EVE = 1 +CIRCUITPY_FLOPPYIO = 0 CIRCUITPY_SYNTHIO = 0 + +# We don't have room for the fonts for terminalio for certain languages, +# so turn off terminalio, and if it's off and displayio is on, +# force a clean build. +# Note that we cannot test $(CIRCUITPY_DISPLAYIO) directly with an +# ifeq, because it's not set yet. +ifneq (,$(filter $(TRANSLATION),ja ko ru)) +CIRCUITPY_TERMINALIO = 0 +RELEASE_NEEDS_CLEAN_BUILD = $(CIRCUITPY_DISPLAYIO) +endif diff --git a/ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk index 50780cff07..61bc46ea4b 100644 --- a/ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/metro_m4_express/mpconfigboard.mk @@ -11,4 +11,15 @@ EXTERNAL_FLASH_DEVICES = "S25FL116K, S25FL216K, GD25Q16C" LONGINT_IMPL = MPZ CIRCUITPY__EVE = 1 +CIRCUITPY_FLOPPYIO = 0 CIRCUITPY_SYNTHIO = 0 + +# We don't have room for the fonts for terminalio for certain languages, +# so turn off terminalio, and if it's off and displayio is on, +# force a clean build. +# Note that we cannot test $(CIRCUITPY_DISPLAYIO) directly with an +# ifeq, because it's not set yet. +ifneq (,$(filter $(TRANSLATION),ja ko ru)) +CIRCUITPY_TERMINALIO = 0 +RELEASE_NEEDS_CLEAN_BUILD = $(CIRCUITPY_DISPLAYIO) +endif diff --git a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk index fd002609b1..baaea5ca63 100644 --- a/ports/atmel-samd/boards/pybadge/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pybadge/mpconfigboard.mk @@ -11,6 +11,7 @@ EXTERNAL_FLASH_DEVICES = GD25Q16C LONGINT_IMPL = MPZ CIRCUITPY_AESIO = 0 +CIRCUITPY_FLOPPYIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_GIFIO = 0 CIRCUITPY_KEYPAD = 1 diff --git a/ports/atmel-samd/boards/pygamer/mpconfigboard.mk b/ports/atmel-samd/boards/pygamer/mpconfigboard.mk index f6112b4110..080592bcd3 100644 --- a/ports/atmel-samd/boards/pygamer/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pygamer/mpconfigboard.mk @@ -11,6 +11,7 @@ EXTERNAL_FLASH_DEVICES = "GD25Q64C,W25Q64JVxQ" LONGINT_IMPL = MPZ CIRCUITPY_AESIO = 0 +CIRCUITPY_FLOPPYIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_GIFIO = 0 CIRCUITPY_KEYPAD = 1 diff --git a/ports/atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.mk b/ports/atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.mk index 3441e601b8..dd8afd51f6 100644 --- a/ports/atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.mk +++ b/ports/atmel-samd/boards/seeeduino_wio_terminal/mpconfigboard.mk @@ -9,4 +9,6 @@ CHIP_FAMILY = samd51 QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ" LONGINT_IMPL = MPZ +CIRCUITPY_FLOPPYIO = 0 +CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_SYNTHIO = 0 diff --git a/ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.mk index 81df26b0c6..687138a1f7 100644 --- a/ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/trellis_m4_express/mpconfigboard.mk @@ -12,5 +12,7 @@ LONGINT_IMPL = MPZ # No I2S on SAMD51G CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_FLOPPYIO = 0 +CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_BITBANG_APA102 = 1 From 6a5e4e665257a13d65559c57001fc11d9cea16f8 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 25 Jul 2023 11:19:16 -0500 Subject: [PATCH 1349/1712] turn off terminalio in a few more builds for space --- .../atmel-samd/boards/feather_m4_can/mpconfigboard.mk | 10 ++++++++++ .../boards/feather_m4_express/mpconfigboard.mk | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk index 8c9779e5f9..b1ea31f867 100644 --- a/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk @@ -15,3 +15,13 @@ CIRCUITPY_CANIO = 1 CIRCUITPY_SYNTHIO = 0 CIRCUITPY_LTO_PARTITION = one + +# We don't have room for the fonts for terminalio for certain languages, +# so turn off terminalio, and if it's off and displayio is on, +# force a clean build. +# Note that we cannot test $(CIRCUITPY_DISPLAYIO) directly with an +# ifeq, because it's not set yet. +ifneq (,$(filter $(TRANSLATION),ja ko ru)) +CIRCUITPY_TERMINALIO = 0 +RELEASE_NEEDS_CLEAN_BUILD = $(CIRCUITPY_DISPLAYIO) +endif diff --git a/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk index 9a5008be85..c763fa44d5 100644 --- a/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk @@ -12,3 +12,13 @@ LONGINT_IMPL = MPZ CIRCUITPY__EVE = 1 CIRCUITPY_SYNTHIO = 0 + +# We don't have room for the fonts for terminalio for certain languages, +# so turn off terminalio, and if it's off and displayio is on, +# force a clean build. +# Note that we cannot test $(CIRCUITPY_DISPLAYIO) directly with an +# ifeq, because it's not set yet. +ifneq (,$(filter $(TRANSLATION),ja ko ru)) +CIRCUITPY_TERMINALIO = 0 +RELEASE_NEEDS_CLEAN_BUILD = $(CIRCUITPY_DISPLAYIO) +endif From 58d6c3ac9d18371851270692c9beeb6f6cdd06b4 Mon Sep 17 00:00:00 2001 From: Vladimir Smitka Date: Tue, 25 Jul 2023 19:25:27 +0200 Subject: [PATCH 1350/1712] Formatting --- .../boards/pajenicko_picopad/mpconfigboard.mk | 2 +- .../boards/pajenicko_picopad/pins.c | 27 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk b/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk index 2eeea9723f..65ad4bba91 100644 --- a/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk +++ b/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk @@ -31,4 +31,4 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/picosystem CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 # Must be accompanied by a linker script change -CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' \ No newline at end of file +CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' diff --git a/ports/raspberrypi/boards/pajenicko_picopad/pins.c b/ports/raspberrypi/boards/pajenicko_picopad/pins.c index de59502d69..da1fe3b9dc 100644 --- a/ports/raspberrypi/boards/pajenicko_picopad/pins.c +++ b/ports/raspberrypi/boards/pajenicko_picopad/pins.c @@ -3,7 +3,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS - //Default RPi Pico Pins + // Default RPi Pico Pins {MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0)}, {MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1)}, {MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2)}, @@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27)}, {MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28)}, - //PicoPad external connector + // PicoPad external connector /* ┌──────┐ GND -│1 2│- GND @@ -40,7 +40,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { D4/A1 -│7 8│- AGND D3/TX/SDA -│9 10│- D0/A0 D2/RX/SCL -│11 12│- D1 - └──────┘ + └──────┘ */ {MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO26)}, @@ -54,7 +54,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27)}, {MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28)}, - //PicoPad LCD + // PicoPad LCD {MP_ROM_QSTR(MP_QSTR_LCD_RESET), MP_ROM_PTR(&pin_GPIO20)}, {MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO21)}, {MP_ROM_QSTR(MP_QSTR_LCD_SCLK), MP_ROM_PTR(&pin_GPIO18)}, @@ -62,13 +62,13 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO17)}, {MP_ROM_QSTR(MP_QSTR_LCD_BL), MP_ROM_PTR(&pin_GPIO16)}, - //PicoPad Audio + // PicoPad Audio {MP_ROM_QSTR(MP_QSTR_AUDIO), MP_ROM_PTR(&pin_GPIO15)}, - //PicoPad USR LED (yellow) + // PicoPad USR LED (yellow) {MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO22)}, - //PicoPad Buttons + // PicoPad Buttons {MP_ROM_QSTR(MP_QSTR_SW_X), MP_ROM_PTR(&pin_GPIO9)}, {MP_ROM_QSTR(MP_QSTR_SW_Y), MP_ROM_PTR(&pin_GPIO8)}, {MP_ROM_QSTR(MP_QSTR_SW_A), MP_ROM_PTR(&pin_GPIO7)}, @@ -79,24 +79,24 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_SW_LEFT), MP_ROM_PTR(&pin_GPIO3)}, {MP_ROM_QSTR(MP_QSTR_SW_UP), MP_ROM_PTR(&pin_GPIO4)}, - //PicoPad SD Card + // PicoPad SD Card {MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO13)}, {MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO10)}, {MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO11)}, {MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO12)}, - //PicoPad Battery + // PicoPad Battery {MP_ROM_QSTR(MP_QSTR_BAT_SENSE), MP_ROM_PTR(&pin_GPIO29)}, - //PicoPad UART0 + // PicoPad UART0 {MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0)}, {MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1)}, - //PicoPad I2C0 + // PicoPad I2C0 {MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO0)}, {MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO1)}, - //PicoPad I2C1 + // PicoPad I2C1 {MP_ROM_QSTR(MP_QSTR_SDA_ALT), MP_ROM_PTR(&pin_GPIO14)}, {MP_ROM_QSTR(MP_QSTR_SCL_ALT), MP_ROM_PTR(&pin_GPIO27)}, @@ -108,6 +108,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_CYW1)}, {MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_CYW0)}, {MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2)}, - {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_module_globals_table); From eef5e8943a246feb90f401b1c7a9b7f7cbff8a60 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 25 Jul 2023 10:53:03 -0700 Subject: [PATCH 1351/1712] Updated duplicate vid checker --- tools/ci_check_duplicate_usb_vid_pid.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index f20630e886..dd7531dbb6 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -63,6 +63,7 @@ DEFAULT_CLUSTERLIST = { ], "0x239A:0x102E": ["weact_studio_pico", "weact_studio_pico_16mb"], "0x303A:0x8166": ["yd_esp32_s3_n8r8", "yd_esp32_s3_n16r8"], + "0x2341:0x0070": ["arduino_nano_esp32s3", "arduino_nano_esp32s3_inverted_statusled"], } cli_parser = argparse.ArgumentParser( From 318191433d0d01519db869ee72a536ebc0801cf6 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 25 Jul 2023 14:03:47 -0500 Subject: [PATCH 1352/1712] disable gifio on feather_m4_can --- ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk index b1ea31f867..b68a2c989b 100644 --- a/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m4_can/mpconfigboard.mk @@ -13,6 +13,7 @@ LONGINT_IMPL = MPZ CIRCUITPY__EVE = 1 CIRCUITPY_CANIO = 1 CIRCUITPY_SYNTHIO = 0 +CIRCUITPY_GIFIO = 0 CIRCUITPY_LTO_PARTITION = one From 767b7a0506772c231b5b4dfd3138240da057b54c Mon Sep 17 00:00:00 2001 From: ladyada Date: Tue, 25 Jul 2023 16:12:53 -0400 Subject: [PATCH 1353/1712] compiling --- .../boards/adafruit_esp32s3_camera/board.c | 2 +- .../boards/adafruit_esp32s3_camera/mpconfigboard.h | 4 +--- .../adafruit_esp32s3_camera/mpconfigboard.mk | 1 + .../boards/adafruit_esp32s3_camera/pins.c | 14 +++++++------- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/board.c b/ports/espressif/boards/adafruit_esp32s3_camera/board.c index 4799a07b79..0ec1046901 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/board.c +++ b/ports/espressif/boards/adafruit_esp32s3_camera/board.c @@ -84,7 +84,7 @@ void board_init(void) { MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command display_init_sequence, sizeof(display_init_sequence), - &pin_GPIO41, // backlight pin + NULL, // backlight pin NO_BRIGHTNESS_COMMAND, 1.0f, // brightness false, // single_byte_bounds diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.h b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.h index 8c0c9cdaae..daa9bc92e5 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.h @@ -29,11 +29,9 @@ #define MICROPY_HW_BOARD_NAME "Adafruit Camera" #define MICROPY_HW_MCU_NAME "ESP32S3" -#define MICROPY_HW_NEOPIXEL (&pin_GPIO21) +#define MICROPY_HW_NEOPIXEL (&pin_GPIO1) #define MICROPY_HW_NEOPIXEL_COUNT (1) -#define MICROPY_HW_LED_STATUS (&pin_GPIO1) - #define DEFAULT_I2C_BUS_SDA (&pin_GPIO33) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO34) diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk index df7e62511a..c60cc8b563 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk @@ -10,3 +10,4 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESPCAMERA = 1 +CIRCUITPY_ULAB = 0 diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/pins.c b/ports/espressif/boards/adafruit_esp32s3_camera/pins.c index 5de2d800aa..743788bb7f 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/pins.c +++ b/ports/espressif/boards/adafruit_esp32s3_camera/pins.c @@ -24,21 +24,21 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, - { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO41) }, - { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO40) }, - { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO39) }, { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO40) }, - { MP_ROM_QSTR(MP_QSTR_CARD_CS), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_CARD_CS), MP_ROM_PTR(&pin_GPIO48) }, { MP_ROM_QSTR(MP_QSTR_IRQ), MP_ROM_PTR(&pin_GPIO3) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO1) }, - { MP_ROM_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_GPIO41) }, { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_BATTERY_MONITOR), MP_ROM_PTR(&pin_GPIO4) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO17) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO18) }, From fd60cccb069db6a159ccec45f564465bcf513cfd Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 25 Jul 2023 16:01:11 -0500 Subject: [PATCH 1354/1712] Re-enable ulab at the expense of some other modules .. and gate audiomixer based on audiocore (should be no net change) .. and get rid of now-redundant enables in the espressif mpconfigport --- .../boards/adafruit_esp32s3_camera/mpconfigboard.mk | 9 ++++++++- ports/espressif/mpconfigport.mk | 2 -- py/circuitpy_mpconfig.mk | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk index c60cc8b563..fc22fd2cd7 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk @@ -9,5 +9,12 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_CANIO = 0 CIRCUITPY_ESPCAMERA = 1 -CIRCUITPY_ULAB = 0 +CIRCUITPY_FRAMEBUFFERIO = 0 +CIRCUITPY_KEYPAD = 0 +CIRCUITPY_ONEWIREIO = 0 +CIRCUITPY_PARALLELDISPLAY = 0 +CIRCUITPY_RGBMATRIX = 0 +CIRCUITPY_ROTARYIO = 0 diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 63cea3d0a8..7c6e5610d9 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -16,9 +16,7 @@ CIRCUITPY_ANALOGBUFIO ?= 1 CIRCUITPY_AUDIOBUSIO ?= 1 CIRCUITPY_AUDIOBUSIO_I2SOUT ?= 1 CIRCUITPY_AUDIOBUSIO_PDMIN ?= 0 -CIRCUITPY_AUDIOCORE ?= 1 CIRCUITPY_AUDIOIO ?= 0 -CIRCUITPY_AUDIOMIXER ?= 1 CIRCUITPY_AUDIOMP3 ?= 0 CIRCUITPY_BLEIO ?= 1 CIRCUITPY_BLEIO_HCI = 0 diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 210c402c77..1c4b48f75c 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -104,7 +104,7 @@ endif endif CFLAGS += -DCIRCUITPY_AUDIOCORE=$(CIRCUITPY_AUDIOCORE) -CIRCUITPY_AUDIOMIXER ?= $(CIRCUITPY_AUDIOIO) +CIRCUITPY_AUDIOMIXER ?= $(CIRCUITPY_AUDIOCORE) CFLAGS += -DCIRCUITPY_AUDIOMIXER=$(CIRCUITPY_AUDIOMIXER) ifndef CIRCUITPY_AUDIOCORE_DEBUG From 6030d87025c5db315ac74d29bc80c015e65492da Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 25 Jul 2023 16:30:21 -0700 Subject: [PATCH 1355/1712] Change to octal ram --- ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig b/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig index 2d819ad274..2d72ed5391 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig +++ b/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig @@ -8,8 +8,8 @@ CONFIG_ESP32S3_SPIRAM_SUPPORT=y # # SPI RAM config # -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_TYPE_AUTO=y # CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set # CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set From 9a18524c3098ac44f723f5b918377b48dbfe0d11 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 25 Jul 2023 18:25:59 -0500 Subject: [PATCH 1356/1712] simplify circuitpy_mpconfig with enable-if-any, -all and make corresponding simplifications in shared-bindings-matrix, but directly using the final defines from CFLAGS instead of the status quo. The net changes are to disable audiocore & audiomixer on some espressif devices that have no audio output at all. Other than that, the shared-bindings-matrix seems to be identical. --- docs/shared_bindings_matrix.py | 45 +++++----------------------- ports/espressif/mpconfigport.mk | 1 - py/circuitpy_mpconfig.mk | 52 ++++++++++++--------------------- 3 files changed, 27 insertions(+), 71 deletions(-) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index f7efb47385..75f5e37337 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -148,50 +148,21 @@ def get_board_mapping(): return boards -def read_mpconfig(): - """Open 'circuitpy_mpconfig.mk' and return the contents.""" - configs = [] - cpy_mpcfg = get_circuitpython_root_dir() / "py" / "circuitpy_mpconfig.mk" - with open(cpy_mpcfg) as mpconfig: - configs = mpconfig.read() - - return configs - - def build_module_map(): """Establish the base of the JSON file, based on the contents from - `configs`. Base will contain module names, if they're part of - the `FULL_BUILD`, or their default value (0, 1, or a list of - modules that determine default [see audiocore, audiomixer, etc.]). - + `configs`. Base contains the module name and the controlling C macro name. """ base = dict() modules = get_bindings() - configs = read_mpconfig() - full_build = False for module in modules: full_name = module if module in ADDITIONAL_MODULES: search_identifier = ADDITIONAL_MODULES[module] else: search_identifier = "CIRCUITPY_" + module.lstrip("_").upper() - re_pattern = f"{re.escape(search_identifier)}\s*\??=\s*(.+)" - find_config = re.findall(re_pattern, configs) - if not find_config: - continue - find_config = ", ".join([x.strip("$()") for x in find_config]) - - full_build = int("CIRCUITPY_FULL_BUILD" in find_config) - if not full_build: - default_val = find_config - else: - default_val = "None" base[module] = { "name": full_name, - "full_build": str(full_build), - "default_value": default_val, - "excluded": {}, "key": search_identifier, } @@ -199,15 +170,14 @@ def build_module_map(): def get_settings_from_makefile(port_dir, board_name): - """Invoke make in a mode which prints the database, then parse it for - settings. + """Invoke make to print the value of critical build settings This means that the effect of all Makefile directives is taken into account, without having to re-encode the logic that sets them in this script, something that has proved error-prone """ contents = subprocess.run( - ["make", "-C", port_dir, f"BOARD={board_name}", "-qp", "print-CC"], + ["make", "-C", port_dir, "-f", "Makefile", f"BOARD={board_name}", "print-CFLAGS", "print-CIRCUITPY_BUILD_EXTENSIONS", "print-FROZEN_MPY_DIRS"], encoding="utf-8", errors="replace", stdout=subprocess.PIPE, @@ -223,9 +193,10 @@ def get_settings_from_makefile(port_dir, board_name): settings = {} for line in contents.stdout.split("\n"): - # Handle both = and := definitions. - m = re.match(r"^([A-Z][A-Z0-9_]*) :?= (.*)$", line) - if m: + if line.startswith('CFLAGS ='): + for m in re.findall('-D([A-Z][A-Z0-9_]*)=(\d+)', line): + settings[m[0]] = m[1] + elif m := re.match(r"^([A-Z][A-Z0-9_]*) = (.*)$", line): settings[m.group(1)] = m.group(2) return settings @@ -280,7 +251,7 @@ def frozen_modules_from_dirs(frozen_mpy_dirs, withurl): """ frozen_modules = [] for frozen_path in filter(lambda x: x, frozen_mpy_dirs.split(" ")): - source_dir = get_circuitpython_root_dir() / frozen_path[7:] + source_dir = get_circuitpython_root_dir() / frozen_path[6:] url_repository = get_repository_url(source_dir) for sub in source_dir.glob("*"): if sub.name in FROZEN_EXCLUDES: diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 7c6e5610d9..982e3bde36 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -14,7 +14,6 @@ CIRCUITPY_FULL_BUILD ?= 1 CIRCUITPY_ALARM ?= 1 CIRCUITPY_ANALOGBUFIO ?= 1 CIRCUITPY_AUDIOBUSIO ?= 1 -CIRCUITPY_AUDIOBUSIO_I2SOUT ?= 1 CIRCUITPY_AUDIOBUSIO_PDMIN ?= 0 CIRCUITPY_AUDIOIO ?= 0 CIRCUITPY_AUDIOMP3 ?= 0 diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 1c4b48f75c..780dd1d854 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -26,6 +26,18 @@ # Boards default to all modules enabled (with exceptions) # Manually disable by overriding in #mpconfigboard.mk +enable-if-any=$(lastword $(sort $(1) 0)) +enable-if-all=$(firstword $(sort $(1) 1)) + +#$(info enable-if-any 0 1 -> $(call enable-if-any,0 1)) +#$(info enable-if-any 1 0 -> $(call enable-if-any,1 0)) +#$(info enable-if-any 1 1 -> $(call enable-if-any,1 1)) +#$(info enable-if-any 0 0 -> $(call enable-if-any,0 0)) +#$(info enable-if-all 0 1 -> $(call enable-if-all,0 1)) +#$(info enable-if-all 1 0 -> $(call enable-if-all,1 0)) +#$(info enable-if-all 1 1 -> $(call enable-if-all,1 1)) +#$(info enable-if-all 0 0 -> $(call enable-if-all,0 0)) + # Always on. Present here to help generate documentation module support matrix for "builtins". CIRCUITPY = 1 CFLAGS += -DCIRCUITPY=$(CIRCUITPY) @@ -95,13 +107,7 @@ CFLAGS += -DCIRCUITPY_AUDIOIO=$(CIRCUITPY_AUDIOIO) CIRCUITPY_AUDIOPWMIO ?= 0 CFLAGS += -DCIRCUITPY_AUDIOPWMIO=$(CIRCUITPY_AUDIOPWMIO) -ifndef CIRCUITPY_AUDIOCORE -ifeq ($(CIRCUITPY_AUDIOPWMIO),1) -CIRCUITPY_AUDIOCORE = $(CIRCUITPY_AUDIOPWMIO) -else -CIRCUITPY_AUDIOCORE = $(CIRCUITPY_AUDIOIO) -endif -endif +CIRCUITPY_AUDIOCORE ?= $(call enable-if-any,$(CIRCUITPY_AUDIOPWMIO) $(CIRCUITPY_AUDIOIO) $(CIRCUITPY_AUDIOBUSIO)) CFLAGS += -DCIRCUITPY_AUDIOCORE=$(CIRCUITPY_AUDIOCORE) CIRCUITPY_AUDIOMIXER ?= $(CIRCUITPY_AUDIOCORE) @@ -112,13 +118,7 @@ CIRCUITPY_AUDIOCORE_DEBUG ?= 0 endif CFLAGS += -DCIRCUITPY_AUDIOCORE_DEBUG=$(CIRCUITPY_AUDIOCORE_DEBUG) -ifndef CIRCUITPY_AUDIOMP3 -ifeq ($(CIRCUITPY_FULL_BUILD),1) -CIRCUITPY_AUDIOMP3 = $(CIRCUITPY_AUDIOCORE) -else -CIRCUITPY_AUDIOMP3 = 0 -endif -endif +CIRCUITPY_AUDIOMP3 ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_AUDIOCORE)) CFLAGS += -DCIRCUITPY_AUDIOMP3=$(CIRCUITPY_AUDIOMP3) CIRCUITPY_BINASCII ?= $(CIRCUITPY_FULL_BUILD) @@ -200,15 +200,9 @@ endif CFLAGS += -DCIRCUITPY_PARALLELDISPLAY=$(CIRCUITPY_PARALLELDISPLAY) # bitmaptools and framebufferio rely on displayio -ifeq ($(CIRCUITPY_DISPLAYIO),1) -CIRCUITPY_BITMAPTOOLS ?= $(CIRCUITPY_FULL_BUILD) -CIRCUITPY_FRAMEBUFFERIO ?= $(CIRCUITPY_FULL_BUILD) -CIRCUITPY_VECTORIO ?= 1 -else -CIRCUITPY_BITMAPTOOLS ?= 0 -CIRCUITPY_FRAMEBUFFERIO ?= 0 -CIRCUITPY_VECTORIO ?= 0 -endif +CIRCUITPY_BITMAPTOOLS ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_DISPLAYIO)) +CIRCUITPY_FRAMEBUFFERIO ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_DISPLAYIO)) +CIRCUITPY_VECTORIO ?= $(CIRCUITPY_DISPLAYIO) CFLAGS += -DCIRCUITPY_BITMAPTOOLS=$(CIRCUITPY_BITMAPTOOLS) CFLAGS += -DCIRCUITPY_FRAMEBUFFERIO=$(CIRCUITPY_FRAMEBUFFERIO) CFLAGS += -DCIRCUITPY_VECTORIO=$(CIRCUITPY_VECTORIO) @@ -255,12 +249,7 @@ CFLAGS += -DCIRCUITPY_FUTURE=$(CIRCUITPY_FUTURE) CIRCUITPY_GETPASS ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_GETPASS=$(CIRCUITPY_GETPASS) -ifeq ($(CIRCUITPY_DISPLAYIO),1) -#CIRCUITPY_GIFIO ?= $(CIRCUITPY_CAMERA) -CIRCUITPY_GIFIO ?= 1 -else -CIRCUITPY_GIFIO ?= 0 -endif +CIRCUITPY_GIFIO ?= $(call enable-if-any,$(CIRCUITPY_DISPLAYIO) $(CIRCUITPY_CAMERA)) CFLAGS += -DCIRCUITPY_GIFIO=$(CIRCUITPY_GIFIO) CIRCUITPY_GNSS ?= 0 @@ -468,10 +457,7 @@ CFLAGS += -DCIRCUITPY_SYS=$(CIRCUITPY_SYS) CIRCUITPY_TERMINALIO ?= $(CIRCUITPY_DISPLAYIO) CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO) -ifeq ($(CIRCUITPY_DISPLAYIO),1) -CIRCUITPY_FONTIO ?= $(CIRCUITPY_TERMINALIO) -endif -CFLAGS += -DCIRCUITPY_FONTIO=$(CIRCUITPY_FONTIO) +CIRCUITPY_FONTIO ?= $(call enable-if-all,$(CIRCUITPY_DISPLAYIO) $(CIRCUITPY_TERMINALIO)) CIRCUITPY_TIME ?= 1 CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME) From d83b8db67875749a7373e17704d3f6d8fbc9d3f8 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 25 Jul 2023 21:34:57 -0500 Subject: [PATCH 1357/1712] restore fontio define --- py/circuitpy_mpconfig.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 780dd1d854..724151c4bd 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -458,6 +458,7 @@ CIRCUITPY_TERMINALIO ?= $(CIRCUITPY_DISPLAYIO) CFLAGS += -DCIRCUITPY_TERMINALIO=$(CIRCUITPY_TERMINALIO) CIRCUITPY_FONTIO ?= $(call enable-if-all,$(CIRCUITPY_DISPLAYIO) $(CIRCUITPY_TERMINALIO)) +CFLAGS += -DCIRCUITPY_FONTIO=$(CIRCUITPY_FONTIO) CIRCUITPY_TIME ?= 1 CFLAGS += -DCIRCUITPY_TIME=$(CIRCUITPY_TIME) From f503b37b2b14b0a5b1a2a16a1155f7dfe252726b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 26 Jul 2023 08:32:25 -0500 Subject: [PATCH 1358/1712] espressif: allow setting FLASH_SDKCONFIG at board level --- ports/espressif/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 10ac738cac..151c31c373 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -330,13 +330,13 @@ $(BUILD)/esp-idf: TARGET_SDKCONFIG = esp-idf-config/sdkconfig-$(IDF_TARGET).defaults ifeq ($(CIRCUITPY_ESP_FLASH_SIZE), 2MB) - FLASH_SDKCONFIG = esp-idf-config/sdkconfig-$(CIRCUITPY_ESP_FLASH_SIZE)-no-ota-no-uf2.defaults + FLASH_SDKCONFIG ?= esp-idf-config/sdkconfig-$(CIRCUITPY_ESP_FLASH_SIZE)-no-ota-no-uf2.defaults else UF2_BOOTLOADER ?= $(CIRCUITPY_USB) ifeq ($(UF2_BOOTLOADER), 1) - FLASH_SDKCONFIG = esp-idf-config/sdkconfig-$(CIRCUITPY_ESP_FLASH_SIZE).defaults + FLASH_SDKCONFIG ?= esp-idf-config/sdkconfig-$(CIRCUITPY_ESP_FLASH_SIZE).defaults else - FLASH_SDKCONFIG = esp-idf-config/sdkconfig-$(CIRCUITPY_ESP_FLASH_SIZE)-no-uf2.defaults + FLASH_SDKCONFIG ?= esp-idf-config/sdkconfig-$(CIRCUITPY_ESP_FLASH_SIZE)-no-uf2.defaults endif endif From 9edd8957a1e33cca610419ffbfadb36a8e2e6daf Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 26 Jul 2023 08:38:30 -0500 Subject: [PATCH 1359/1712] Add a "4MB without OTA" partition scheme This is needed on the camera board, because we have a lot of code. --- .../esp-idf-config/partitions-4MB-no-ota.csv | 7 +++++++ .../sdkconfig-4MB-no-ota.defaults | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 ports/espressif/esp-idf-config/partitions-4MB-no-ota.csv create mode 100644 ports/espressif/esp-idf-config/sdkconfig-4MB-no-ota.defaults diff --git a/ports/espressif/esp-idf-config/partitions-4MB-no-ota.csv b/ports/espressif/esp-idf-config/partitions-4MB-no-ota.csv new file mode 100644 index 0000000000..24a0695dc9 --- /dev/null +++ b/ports/espressif/esp-idf-config/partitions-4MB-no-ota.csv @@ -0,0 +1,7 @@ +# Name, Type, SubType, Offset, Size +# bootloader, app, boot, 0x1000/0x0, 28/32K +# partition_table, data, table, 0x8000, 4K +nvs, data, nvs, 0x9000, 28K +ota_0, app, ota_0, 0x10000, 2112K +uf2, app, factory, 0x220000, 256K +user_fs, data, fat, 0x260000, 1664K diff --git a/ports/espressif/esp-idf-config/sdkconfig-4MB-no-ota.defaults b/ports/espressif/esp-idf-config/sdkconfig-4MB-no-ota.defaults new file mode 100644 index 0000000000..36899aeda9 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-4MB-no-ota.defaults @@ -0,0 +1,18 @@ +# +# Serial flasher config +# +# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE="4MB" +CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +# end of Serial flasher config + +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB-no-ota.csv" +# +# Partition Table +# +CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-no-ota.csv" +# end of Partition Table From c516870f89ffa82b33e52ade0e96baff5e31cc85 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 26 Jul 2023 08:38:59 -0500 Subject: [PATCH 1360/1712] switch camera to use the no-ota partition scheme this gives us a comfortable few hundred kB flash space left for the app 1398912 bytes used, 763776 bytes free in flash firmware space out of 2162688 bytes (2112.0kB). --- .../boards/adafruit_esp32s3_camera/mpconfigboard.mk | 1 + .../boards/adafruit_esp32s3_camera/sdkconfig | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk index fc22fd2cd7..6455e68a90 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk @@ -8,6 +8,7 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB +FLASH_SDKCONFIG = esp-idf-config/sdkconfig-4MB-no-ota.defaults CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_CANIO = 0 diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig b/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig index 02056b1348..cf6a6def7c 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig +++ b/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig @@ -47,4 +47,16 @@ CONFIG_SPIRAM_MEMTEST=y CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP +# CONFIG_OV7670_SUPPORT is not set +# CONFIG_NT99141_SUPPORT is not set +CONFIG_OV3360_SUPPORT=n +# CONFIG_OV2640_SUPPORT is not set +CONFIG_OV5640_SUPPORT=y +# CONFIG_GC2145_SUPPORT is not set +# CONFIG_GC032A_SUPPORT is not set +# CONFIG_GC0308_SUPPORT is not set +# CONFIG_BF3005_SUPPORT is not set +# CONFIG_BF20A6_SUPPORT is not set +# CONFIG_SC101IOT_SUPPORT is not set +# CONFIG_SC030IOT_SUPPORT is not set # end of Component config From c026704fd29b760f7189654aaf20beaf6260a242 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 26 Jul 2023 08:54:02 -0500 Subject: [PATCH 1361/1712] gifio does require displayio --- py/circuitpy_mpconfig.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 724151c4bd..47025d564c 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -249,7 +249,7 @@ CFLAGS += -DCIRCUITPY_FUTURE=$(CIRCUITPY_FUTURE) CIRCUITPY_GETPASS ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_GETPASS=$(CIRCUITPY_GETPASS) -CIRCUITPY_GIFIO ?= $(call enable-if-any,$(CIRCUITPY_DISPLAYIO) $(CIRCUITPY_CAMERA)) +CIRCUITPY_GIFIO ?= $(CIRCUITPY_DISPLAYIO) CFLAGS += -DCIRCUITPY_GIFIO=$(CIRCUITPY_GIFIO) CIRCUITPY_GNSS ?= 0 From 46d7771152abca30dfee095cd72bc3ebb6a26f32 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 26 Jul 2023 09:41:10 -0500 Subject: [PATCH 1362/1712] tinyuf2 adopted the partition scheme called "1ota" .. which irritated our partition table parser in build_memory_info, so make it work again. --- .../boards/adafruit_esp32s3_camera/mpconfigboard.mk | 2 +- ports/espressif/esp-idf-config/partitions-4MB-1ota.csv | 10 ++++++++++ .../espressif/esp-idf-config/partitions-4MB-no-ota.csv | 7 ------- ...4MB-no-ota.defaults => sdkconfig-4MB-1ota.defaults} | 4 ++-- ports/espressif/tools/build_memory_info.py | 4 +++- 5 files changed, 16 insertions(+), 11 deletions(-) create mode 100644 ports/espressif/esp-idf-config/partitions-4MB-1ota.csv delete mode 100644 ports/espressif/esp-idf-config/partitions-4MB-no-ota.csv rename ports/espressif/esp-idf-config/{sdkconfig-4MB-no-ota.defaults => sdkconfig-4MB-1ota.defaults} (82%) diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk index 6455e68a90..6b94c979dc 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk @@ -8,7 +8,7 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB -FLASH_SDKCONFIG = esp-idf-config/sdkconfig-4MB-no-ota.defaults +FLASH_SDKCONFIG = esp-idf-config/sdkconfig-4MB-1ota.defaults CIRCUITPY_AUDIOBUSIO = 0 CIRCUITPY_CANIO = 0 diff --git a/ports/espressif/esp-idf-config/partitions-4MB-1ota.csv b/ports/espressif/esp-idf-config/partitions-4MB-1ota.csv new file mode 100644 index 0000000000..ab7fa8669d --- /dev/null +++ b/ports/espressif/esp-idf-config/partitions-4MB-1ota.csv @@ -0,0 +1,10 @@ +# ESP-IDF Partition Table +# Name, Type, SubType, Offset, Size, Flags +# bootloader.bin,, 0x1000, 32K +# partition table, 0x8000, 4K + +nvs, data, nvs, 0x9000, 20K, +otadata, data, ota, 0xe000, 8K, +ota_0, app, ota_0, 0x10000, 2816K, +uf2, app, factory,0x2d0000, 256K, +ffat, data, fat, 0x310000, 960K, diff --git a/ports/espressif/esp-idf-config/partitions-4MB-no-ota.csv b/ports/espressif/esp-idf-config/partitions-4MB-no-ota.csv deleted file mode 100644 index 24a0695dc9..0000000000 --- a/ports/espressif/esp-idf-config/partitions-4MB-no-ota.csv +++ /dev/null @@ -1,7 +0,0 @@ -# Name, Type, SubType, Offset, Size -# bootloader, app, boot, 0x1000/0x0, 28/32K -# partition_table, data, table, 0x8000, 4K -nvs, data, nvs, 0x9000, 28K -ota_0, app, ota_0, 0x10000, 2112K -uf2, app, factory, 0x220000, 256K -user_fs, data, fat, 0x260000, 1664K diff --git a/ports/espressif/esp-idf-config/sdkconfig-4MB-no-ota.defaults b/ports/espressif/esp-idf-config/sdkconfig-4MB-1ota.defaults similarity index 82% rename from ports/espressif/esp-idf-config/sdkconfig-4MB-no-ota.defaults rename to ports/espressif/esp-idf-config/sdkconfig-4MB-1ota.defaults index 36899aeda9..5677b79418 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-4MB-no-ota.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-4MB-1ota.defaults @@ -10,9 +10,9 @@ CONFIG_ESPTOOLPY_FLASHSIZE="4MB" CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y # end of Serial flasher config -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB-no-ota.csv" +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB-1ota.csv" # # Partition Table # -CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-no-ota.csv" +CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-1ota.csv" # end of Partition Table diff --git a/ports/espressif/tools/build_memory_info.py b/ports/espressif/tools/build_memory_info.py index a11bef82bc..bbcd3d2df7 100644 --- a/ports/espressif/tools/build_memory_info.py +++ b/ports/espressif/tools/build_memory_info.py @@ -73,7 +73,9 @@ with open(sys.argv[2], "r") as f: ota = None app = None for partition in csv.reader(f): - if partition[0][0] == "#": + if not partition: # empty row + continue + if partition[0].startswith("#"): continue subtype = partition[2].strip() if subtype == "factory": From 245bbdfd80c76995a10b4ef703c8277b546d2f91 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 26 Jul 2023 17:54:52 +0200 Subject: [PATCH 1363/1712] 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 | 40 ++++++++++++++++++++++++++++++++++++++-- locale/cs.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/de_DE.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/el.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/en_GB.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/es.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/fil.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/fr.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/hi.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/it_IT.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/ja.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/ko.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/nl.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/pl.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/pt_BR.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/ru.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/sv.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/tr.po | 40 ++++++++++++++++++++++++++++++++++++++-- locale/zh_Latn_pinyin.po | 40 ++++++++++++++++++++++++++++++++++++++-- 19 files changed, 722 insertions(+), 38 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 65084356f1..483c5f48ac 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -2793,6 +2793,10 @@ msgstr "" msgid "cannot create instance" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "" @@ -3250,6 +3254,14 @@ msgstr "" msgid "inline assembler must be a function" msgstr "inline assembler harus sebuah fungsi" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3578,6 +3590,10 @@ msgstr "" msgid "native yield" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3676,6 +3692,10 @@ msgstr "" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "" @@ -3787,8 +3807,8 @@ msgstr "" msgid "opcode" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "" @@ -3825,10 +3845,26 @@ msgstr "" msgid "out array is too small" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 501cfed1c4..0ffa07aed8 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -2780,6 +2780,10 @@ msgstr "" msgid "cannot create instance" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "" @@ -3237,6 +3241,14 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3565,6 +3577,10 @@ msgstr "" msgid "native yield" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3663,6 +3679,10 @@ msgstr "" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "" @@ -3773,8 +3793,8 @@ msgstr "" msgid "opcode" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "" @@ -3811,10 +3831,26 @@ msgstr "" msgid "out array is too small" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 16c48fa6b6..609437e439 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -2845,6 +2845,10 @@ msgstr "Kann '%q' Instanzen nicht erstellen" msgid "cannot create instance" msgstr "Kann Instanz nicht erstellen" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "Name %q kann nicht importiert werden" @@ -3310,6 +3314,14 @@ msgstr "Länge von initial_value ist falsch" msgid "inline assembler must be a function" msgstr "inline assembler muss eine function sein" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "das Eingabeargument muss ein Integer, Tupel oder eine Liste sein" @@ -3644,6 +3656,10 @@ msgstr "native Methode zu groß" msgid "native yield" msgstr "natives yield" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3744,6 +3760,10 @@ msgstr "Nicht genügend Argumente für die Formatzeichenfolge" msgid "not implemented for complex dtype" msgstr "nicht implementiert für komplexe dtype" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "Die Anzahl der Punkte muss mindestens 2 betragen" @@ -3856,8 +3876,8 @@ msgstr "" msgid "opcode" msgstr "Opcode" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "Operanden konnten nicht zusammen gesendet werden" @@ -3896,10 +3916,26 @@ msgstr "" msgid "out array is too small" msgstr "Ausgabe-Array ist zu klein" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "Ausgabe muss ein floatdichtes Array sein" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "Außerhalb des Bereichs des Ziels" diff --git a/locale/el.po b/locale/el.po index d8b55956e8..57fd874dd6 100644 --- a/locale/el.po +++ b/locale/el.po @@ -2794,6 +2794,10 @@ msgstr "" msgid "cannot create instance" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "" @@ -3251,6 +3255,14 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3579,6 +3591,10 @@ msgstr "" msgid "native yield" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3677,6 +3693,10 @@ msgstr "" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "" @@ -3787,8 +3807,8 @@ msgstr "" msgid "opcode" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "" @@ -3825,10 +3845,26 @@ msgstr "" msgid "out array is too small" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index 0984565599..e524cd27af 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -2805,6 +2805,10 @@ msgstr "can't create '%q' instances" msgid "cannot create instance" msgstr "can't create instance" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "can't import name %q" @@ -3265,6 +3269,14 @@ msgstr "initial_value length is wrong" msgid "inline assembler must be a function" msgstr "inline assembler must be a function" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "input argument must be an integer, a tuple, or a list" @@ -3593,6 +3605,10 @@ msgstr "native method too big" msgid "native yield" msgstr "native yield" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3691,6 +3707,10 @@ msgstr "not enough arguments for format string" msgid "not implemented for complex dtype" msgstr "not implemented for complex dtype" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "number of points must be at least 2" @@ -3801,8 +3821,8 @@ msgstr "only slices with step=1 (aka None) are supported" msgid "opcode" msgstr "opcode" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "operands could not be broadcast together" @@ -3839,10 +3859,26 @@ msgstr "ord() expected a character, but string of length %d found" msgid "out array is too small" msgstr "out array is too small" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "out must be a float dense array" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "out of range of target" diff --git a/locale/es.po b/locale/es.po index 931c391e50..92af54c327 100644 --- a/locale/es.po +++ b/locale/es.po @@ -2851,6 +2851,10 @@ msgstr "no se pueden crear '%q' instancias" msgid "cannot create instance" msgstr "no se puede crear instancia" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "no se puede importar name '%q'" @@ -3312,6 +3316,14 @@ msgstr "el tamaño de initial_value es incorrecto" msgid "inline assembler must be a function" msgstr "ensamblador en línea debe ser una función" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "argumento de entrada debe ser un entero, una tupla o una lista" @@ -3644,6 +3656,10 @@ msgstr "método nativo muy grande" msgid "native yield" msgstr "yield nativo" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3745,6 +3761,10 @@ msgstr "no suficientes argumentos para format string" msgid "not implemented for complex dtype" msgstr "no esta implementado para complex dtype" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "el número de puntos debe ser al menos 2" @@ -3855,8 +3875,8 @@ msgstr "solo se admiten segmentos con step=1 (alias None)" msgid "opcode" msgstr "código de operación" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "los operandos no se pueden transmitir juntos" @@ -3893,10 +3913,26 @@ msgstr "ord() espera un carácter, pero encontró un string de longitud %d" msgid "out array is too small" msgstr "La matriz de salida es demasiado pequeña" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "la matriz de salida debe ser densa de números float" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "fuera de rango del objetivo" diff --git a/locale/fil.po b/locale/fil.po index bc3f3bc1e6..aff40a5bb7 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -2790,6 +2790,10 @@ msgstr "hindi magawa '%q' instances" msgid "cannot create instance" msgstr "hindi magawa ang instance" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "hindi ma-import ang name %q" @@ -3252,6 +3256,14 @@ msgstr "" msgid "inline assembler must be a function" msgstr "inline assembler ay dapat na function" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3584,6 +3596,10 @@ msgstr "" msgid "native yield" msgstr "native yield" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3682,6 +3698,10 @@ msgstr "kulang sa arguments para sa format string" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "" @@ -3793,8 +3813,8 @@ msgstr "ang mga slices lamang na may hakbang = 1 (aka None) ang sinusuportahan" msgid "opcode" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "" @@ -3831,10 +3851,26 @@ msgstr "ord() umaasa ng character pero string ng %d haba ang nakita" msgid "out array is too small" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index a466a12359..18c0d68845 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -2865,6 +2865,10 @@ msgstr "ne peut pas créer une instance de '%q'" msgid "cannot create instance" msgstr "ne peut pas créer une instance" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "ne peut pas importer le nom %q" @@ -3331,6 +3335,14 @@ msgstr "la longueur de initial_value est incorrecte" msgid "inline assembler must be a function" msgstr "l'assembleur doit être une fonction" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "Paramètre entrant doit être un chiffre entier, un tuple, ou une liste" @@ -3665,6 +3677,10 @@ msgstr "la méthode native est trop longue" msgid "native yield" msgstr "'yield' natif" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3765,6 +3781,10 @@ msgstr "pas assez d'arguments pour la chaîne de format" msgid "not implemented for complex dtype" msgstr "n'est pas implémenté pour les dtype complexes" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "le nombre de points doit être d'au moins 2" @@ -3876,8 +3896,8 @@ msgstr "seules les tranches avec 'step=1' (cad None) sont supportées" msgid "opcode" msgstr "opcode" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "les opérandes ne pouvaient pas être diffusés ensemble" @@ -3915,10 +3935,26 @@ msgstr "" msgid "out array is too small" msgstr "matrice de sortie est trop petite" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "la matrice sortante doit être de type float" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "dépassement des bornes de target" diff --git a/locale/hi.po b/locale/hi.po index f684a9d9b8..7469814d21 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -2765,6 +2765,10 @@ msgstr "" msgid "cannot create instance" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "" @@ -3222,6 +3226,14 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3550,6 +3562,10 @@ msgstr "" msgid "native yield" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3648,6 +3664,10 @@ msgstr "" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "" @@ -3758,8 +3778,8 @@ msgstr "" msgid "opcode" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "" @@ -3796,10 +3816,26 @@ msgstr "" msgid "out array is too small" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index ba9b3dc227..6a4e37a0ef 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -2794,6 +2794,10 @@ msgstr "creare '%q' istanze" msgid "cannot create instance" msgstr "impossibile creare un istanza" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "impossibile imporate il nome %q" @@ -3257,6 +3261,14 @@ msgstr "" msgid "inline assembler must be a function" msgstr "inline assembler deve essere una funzione" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3590,6 +3602,10 @@ msgstr "" msgid "native yield" msgstr "yield nativo" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3690,6 +3706,10 @@ msgstr "argomenti non sufficienti per la stringa di formattazione" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "" @@ -3801,8 +3821,8 @@ msgstr "solo slice con step=1 (aka None) sono supportate" msgid "opcode" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "" @@ -3840,10 +3860,26 @@ msgstr "" msgid "out array is too small" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index 0d7498178c..32b5569072 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -2782,6 +2782,10 @@ msgstr "" msgid "cannot create instance" msgstr "インスタンスを作れません" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "" @@ -3244,6 +3248,14 @@ msgstr "" msgid "inline assembler must be a function" msgstr "インラインアセンブラは関数でなければなりません" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3572,6 +3584,10 @@ msgstr "" msgid "native yield" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3670,6 +3686,10 @@ msgstr "書式化文字列への引数が足りません" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "" @@ -3780,8 +3800,8 @@ msgstr "" msgid "opcode" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "" @@ -3818,10 +3838,26 @@ msgstr "ord()は1文字を要求しますが、長さ %d の文字列が与え msgid "out array is too small" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 2fc43e592c..0dd12d03e5 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -2769,6 +2769,10 @@ msgstr "" msgid "cannot create instance" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "" @@ -3226,6 +3230,14 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3554,6 +3566,10 @@ msgstr "" msgid "native yield" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3652,6 +3668,10 @@ msgstr "" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "" @@ -3762,8 +3782,8 @@ msgstr "" msgid "opcode" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "" @@ -3800,10 +3820,26 @@ msgstr "" msgid "out array is too small" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 719efe6914..7d115254be 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -2793,6 +2793,10 @@ msgstr "kan geen instanties van '%q' creëren" msgid "cannot create instance" msgstr "kan geen instantie creëren" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "kan naam %q niet importeren" @@ -3253,6 +3257,14 @@ msgstr "lengte van initial_value is onjuist" msgid "inline assembler must be a function" msgstr "inline assembler moet een functie zijn" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3584,6 +3596,10 @@ msgstr "" msgid "native yield" msgstr "natuurlijke opbrengst (native yield)" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3682,6 +3698,10 @@ msgstr "niet genoeg argumenten om string te formatteren" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "aantal punten moet minimaal 2 zijn" @@ -3792,8 +3812,8 @@ msgstr "alleen segmenten met step=1 (ook wel None) worden ondersteund" msgid "opcode" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "operands konden niet samen verzonden worden" @@ -3830,10 +3850,26 @@ msgstr "ord() verwacht een teken (char) maar vond een string van lengte %d" msgid "out array is too small" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "buiten bereik van doel" diff --git a/locale/pl.po b/locale/pl.po index 35cc808126..b97a3ba2a8 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -2773,6 +2773,10 @@ msgstr "nie można tworzyć instancji '%q'" msgid "cannot create instance" msgstr "nie można stworzyć instancji" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "nie można zaimportować nazwy %q" @@ -3231,6 +3235,14 @@ msgstr "długość initial_value jest nieprawidłowa" msgid "inline assembler must be a function" msgstr "wtrącony asembler musi być funkcją" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3559,6 +3571,10 @@ msgstr "" msgid "native yield" msgstr "natywny yield" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3657,6 +3673,10 @@ msgstr "nie dość argumentów przy formatowaniu" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "liczba punktów musi wynosić co najmniej 2" @@ -3767,8 +3787,8 @@ msgstr "tylko fragmenty ze step=1 (lub None) są wspierane" msgid "opcode" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "operandy nie mogły być rozgłaszane razem" @@ -3805,10 +3825,26 @@ msgstr "ord() oczekuje znaku, a jest łańcuch od długości %d" msgid "out array is too small" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index d44d309ad6..13f70534df 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -2846,6 +2846,10 @@ msgstr "não é possível criar instâncias '%q'" msgid "cannot create instance" msgstr "não é possível criar instância" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "não pode importar nome %q" @@ -3310,6 +3314,14 @@ msgstr "O comprimento do initial_value está errado" msgid "inline assembler must be a function" msgstr "o assembler em linha deve ser uma função" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3644,6 +3656,10 @@ msgstr "o método nativo é grande demais" msgid "native yield" msgstr "rendimento nativo" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3742,6 +3758,10 @@ msgstr "argumentos insuficientes para o formato da string" msgid "not implemented for complex dtype" msgstr "não foi implementado para dtype complexo" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "a quantidade dos pontos deve ser pelo menos 2" @@ -3853,8 +3873,8 @@ msgstr "" msgid "opcode" msgstr "opcode" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "os operandos não puderam ser transmitidos juntos" @@ -3893,10 +3913,26 @@ msgstr "" msgid "out array is too small" msgstr "a matriz externa é muito pequena" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "deve ser uma matriz densa flutuante" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "fora do alcance do alvo" diff --git a/locale/ru.po b/locale/ru.po index 8dd6627ad5..12040cc439 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -2828,6 +2828,10 @@ msgstr "" msgid "cannot create instance" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "" @@ -3285,6 +3289,14 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3613,6 +3625,10 @@ msgstr "" msgid "native yield" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3711,6 +3727,10 @@ msgstr "" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "" @@ -3821,8 +3841,8 @@ msgstr "" msgid "opcode" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "" @@ -3859,10 +3879,26 @@ msgstr "" msgid "out array is too small" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "" diff --git a/locale/sv.po b/locale/sv.po index 28e2ee490e..fd8c63a0a6 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -2817,6 +2817,10 @@ msgstr "kan inte skapa instanser av '%q'" msgid "cannot create instance" msgstr "kan inte skapa instans" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "kan inte importera namn %q" @@ -3279,6 +3283,14 @@ msgstr "initial_value-längd är fel" msgid "inline assembler must be a function" msgstr "inline assembler måste vara en funktion" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "indataargument måste vara integer, en tuple eller list" @@ -3610,6 +3622,10 @@ msgstr "inbyggd metod för stor" msgid "native yield" msgstr "native yield" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3708,6 +3724,10 @@ msgstr "inte tillräckligt med argument för formatsträng" msgid "not implemented for complex dtype" msgstr "inte implementerat för complex dtype" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "antal punkter måste vara minst 2" @@ -3818,8 +3838,8 @@ msgstr "endast segment med steg=1 (aka Ingen) stöds" msgid "opcode" msgstr "opkod" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "operander kan inte sändas tillsammans" @@ -3856,10 +3876,26 @@ msgstr "ord() förväntade sig ett tecken, men en sträng med längden %d hittad msgid "out array is too small" msgstr "matrisen för out är för liten" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "out måste vara en float dense array" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "utanför räckvidd för target" diff --git a/locale/tr.po b/locale/tr.po index 71ba460288..851fef7f94 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -2787,6 +2787,10 @@ msgstr "" msgid "cannot create instance" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "" @@ -3244,6 +3248,14 @@ msgstr "" msgid "inline assembler must be a function" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "" @@ -3572,6 +3584,10 @@ msgstr "" msgid "native yield" msgstr "" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3670,6 +3686,10 @@ msgstr "" msgid "not implemented for complex dtype" msgstr "" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "" @@ -3780,8 +3800,8 @@ msgstr "" msgid "opcode" msgstr "" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "" @@ -3818,10 +3838,26 @@ msgstr "" msgid "out array is too small" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 9bcb0640c2..3853fdc0d7 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -2821,6 +2821,10 @@ msgstr "wúfǎ chuàngjiàn '%q' ' shílì" msgid "cannot create instance" msgstr "wúfǎ chuàngjiàn shílì" +#: extmod/ulab/code/ndarray.c +msgid "cannot delete array elements" +msgstr "" + #: py/runtime.c msgid "cannot import name %q" msgstr "wúfǎ dǎorù míngchēng %q" @@ -3285,6 +3289,14 @@ msgstr "Initial_value chángdù cuòwù" msgid "inline assembler must be a function" msgstr "nèi lián jíhé bìxū shì yīgè hánshù" +#: extmod/ulab/code/numpy/vector.c +msgid "input and output dimensions differ" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "input and output shapes differ" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" msgstr "shū rù cān shù bì xū shì zhěng shù, yuán zǔ huò liè biǎo" @@ -3614,6 +3626,10 @@ msgstr "yuán shēng fāng fǎ tài dà" msgid "native yield" msgstr "yuán chǎn" +#: extmod/ulab/code/ndarray.c +msgid "ndarray length overflows" +msgstr "" + #: py/runtime.c #, c-format msgid "need more than %d values to unpack" @@ -3712,6 +3728,10 @@ msgstr "géshì zìfú chuàn cān shǔ bùzú" msgid "not implemented for complex dtype" msgstr "wèi zhēn duì fù zá de dtype shí xiàn" +#: extmod/ulab/code/numpy/bitwise.c +msgid "not supported for input types" +msgstr "" + #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" msgstr "diǎnshù bìxū zhìshǎo wèi 2" @@ -3822,8 +3842,8 @@ msgstr "jǐn zhīchí bù zhǎng = 1(jí wú) de qiēpiàn" msgid "opcode" msgstr "cāo zuò dài mǎ" -#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/compare.c -#: extmod/ulab/code/numpy/vector.c +#: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c +#: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" msgstr "cāozuò shǔ bùnéng yīqǐ guǎngbò" @@ -3860,10 +3880,26 @@ msgstr "ord() yùqí zìfú, dàn chángdù zìfú chuàn %d" msgid "out array is too small" msgstr "chū zhèn liè tài xiǎo" +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for complex dtype" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out keyword is not supported for function" +msgstr "" + #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" msgstr "chū bì xū shì yí gè fú dòng mì jí zhèn liè" +#: extmod/ulab/code/numpy/vector.c +msgid "out must be an ndarray" +msgstr "" + +#: extmod/ulab/code/numpy/vector.c +msgid "out must be of float dtype" +msgstr "" + #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" msgstr "mù biāo fàn wéi wài" From 020e4d2e0c1904fc54b1d0c8ce3f7fb09f3d169a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 26 Jul 2023 12:55:44 -0500 Subject: [PATCH 1364/1712] update camera submodule --- ports/espressif/esp32-camera | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/esp32-camera b/ports/espressif/esp32-camera index 4ff7f348d0..2cd2a6d69f 160000 --- a/ports/espressif/esp32-camera +++ b/ports/espressif/esp32-camera @@ -1 +1 @@ -Subproject commit 4ff7f348d0713ea8eca022f73a059b0fe0934531 +Subproject commit 2cd2a6d69faaba9ebb6105814a50039d82e2f899 From 197a7f31ab864fa44a2ba9de8fe2bf67c603757c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 26 Jul 2023 15:02:05 -0500 Subject: [PATCH 1365/1712] bump protomatter to 1.5.9 --- lib/protomatter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/protomatter b/lib/protomatter index ecab2fa75e..5f0b40ed59 160000 --- a/lib/protomatter +++ b/lib/protomatter @@ -1 +1 @@ -Subproject commit ecab2fa75e9d7675785d2b87f29a22f027da8ce5 +Subproject commit 5f0b40ed5991e22da63add5dbaeb7c194b72b607 From e45a61f57e505d80f4828f568ebb78239851487e Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 27 Jul 2023 09:15:58 -0700 Subject: [PATCH 1366/1712] Align fatfs window buffer for tinyusb Also, update tinyusb. --- lib/oofatfs/ff.h | 2 +- lib/oofatfs/ffconf.h | 6 ++++++ lib/tinyusb | 2 +- locale/circuitpython.pot | 9 +++++++-- ports/raspberrypi/lib/Pico-PIO-USB | 2 +- py/circuitpy_mpconfig.h | 6 ++++++ shared-module/usb/core/Device.c | 21 +++++++++++++++++---- 7 files changed, 39 insertions(+), 9 deletions(-) diff --git a/lib/oofatfs/ff.h b/lib/oofatfs/ff.h index b133d770db..d77ddf5761 100644 --- a/lib/oofatfs/ff.h +++ b/lib/oofatfs/ff.h @@ -162,7 +162,7 @@ typedef struct { DWORD bitbase; /* Allocation bitmap base sector */ #endif DWORD winsect; /* Current sector appearing in the win[] */ - BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */ + __attribute__((aligned(FF_WINDOW_ALIGNMENT),)) BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg). */ } FATFS; diff --git a/lib/oofatfs/ffconf.h b/lib/oofatfs/ffconf.h index 52ff6d0a7a..2967244118 100644 --- a/lib/oofatfs/ffconf.h +++ b/lib/oofatfs/ffconf.h @@ -267,6 +267,12 @@ / for variable sector size mode and disk_ioctl() function needs to implement / GET_SECTOR_SIZE command. */ +#ifdef MICROPY_FATFS_WINDOW_ALIGNMENT +#define FF_WINDOW_ALIGNMENT (MICROPY_FATFS_WINDOW_ALIGNMENT) +#else +#define FF_WINDOW_ALIGNMENT 1 +#endif + #define FF_USE_TRIM 0 /* This option switches support for ATA-TRIM. (0:Disable or 1:Enable) diff --git a/lib/tinyusb b/lib/tinyusb index 6c7c9f2ef5..db59494b1b 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 6c7c9f2ef5a80d5a6879e9c3558162188c6cf889 +Subproject commit db59494b1b24f7dad26c5c66c85a195a2cf09466 diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 9ebb85d13f..892b1368c4 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -1748,6 +1748,10 @@ msgstr "" msgid "Pins must share PWM slice" msgstr "" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1825,7 +1829,8 @@ msgstr "" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -3985,7 +3990,7 @@ msgstr "" msgid "sosfilt requires iterable arguments" msgstr "" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "" diff --git a/ports/raspberrypi/lib/Pico-PIO-USB b/ports/raspberrypi/lib/Pico-PIO-USB index 5a7aa8d4e7..d00a10a8c4 160000 --- a/ports/raspberrypi/lib/Pico-PIO-USB +++ b/ports/raspberrypi/lib/Pico-PIO-USB @@ -1 +1 @@ -Subproject commit 5a7aa8d4e78f9a50e4fb9defcf3488b3fc44aff1 +Subproject commit d00a10a8c425d0d40f81b87169102944b01f3bb3 diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index e1909a064f..7e858212a5 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -611,6 +611,12 @@ void background_callback_run_all(void); #define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (0) #endif +// Align the internal sector buffer. Useful when it is passed into TinyUSB for +// loads. +#ifndef MICROPY_FATFS_WINDOW_ALIGNMENT +#define MICROPY_FATFS_WINDOW_ALIGNMENT CIRCUITPY_TUSB_MEM_ALIGN +#endif + #define FF_FS_CASE_INSENSITIVE_COMPARISON_ASCII_ONLY (1) #define FF_FS_MAKE_VOLID (1) diff --git a/shared-module/usb/core/Device.c b/shared-module/usb/core/Device.c index 67756341ec..faed49e383 100644 --- a/shared-module/usb/core/Device.c +++ b/shared-module/usb/core/Device.c @@ -49,6 +49,7 @@ void tuh_umount_cb(uint8_t dev_addr) { } STATIC xfer_result_t _xfer_result; +STATIC size_t _actual_len; bool common_hal_usb_core_device_construct(usb_core_device_obj_t *self, uint8_t device_number) { if (device_number == 0 || device_number > CFG_TUH_DEVICE_MAX + CFG_TUH_HUB) { return false; @@ -78,6 +79,9 @@ uint16_t common_hal_usb_core_device_get_idProduct(usb_core_device_obj_t *self) { STATIC void _transfer_done_cb(tuh_xfer_t *xfer) { // Store the result so we stop waiting for the transfer. _xfer_result = xfer->result; + // The passed in xfer is not the original one we passed in, so we need to + // copy any info out that we want (like actual_len.) + _actual_len = xfer->actual_len; } STATIC bool _wait_for_callback(void) { @@ -159,11 +163,14 @@ STATIC size_t _xfer(tuh_xfer_t *xfer, mp_int_t timeout) { } xfer_result_t result = _xfer_result; _xfer_result = 0xff; - if (result == XFER_RESULT_STALLED || result == 0xff) { + if (result == XFER_RESULT_STALLED) { + mp_raise_usb_core_USBError(translate("Pipe error")); + } + if (result == 0xff) { mp_raise_usb_core_USBTimeoutError(); } if (result == XFER_RESULT_SUCCESS) { - return xfer->actual_len; + return _actual_len; } return 0; @@ -192,7 +199,10 @@ STATIC bool _open_endpoint(usb_core_device_obj_t *self, mp_int_t endpoint) { } tusb_desc_configuration_t *desc_cfg = (tusb_desc_configuration_t *)desc_buf; - uint8_t const *desc_end = ((uint8_t const *)desc_cfg) + tu_le16toh(desc_cfg->wTotalLength); + uint32_t total_length = tu_le16toh(desc_cfg->wTotalLength); + // Cap to the buffer size we requested. + total_length = MIN(total_length, sizeof(desc_buf)); + uint8_t const *desc_end = ((uint8_t const *)desc_cfg) + total_length; uint8_t const *p_desc = tu_desc_next(desc_cfg); // parse each interfaces @@ -281,7 +291,10 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self, } xfer_result_t result = _xfer_result; _xfer_result = 0xff; - if (result == XFER_RESULT_STALLED || result == 0xff) { + if (result == XFER_RESULT_STALLED) { + mp_raise_usb_core_USBError(translate("Pipe error")); + } + if (result == 0xff) { mp_raise_usb_core_USBTimeoutError(); } if (result == XFER_RESULT_SUCCESS) { From d6e47fd76fac42cacf9575c8b3d5a1a956d1e0b6 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Wed, 26 Jul 2023 16:09:47 +0000 Subject: [PATCH 1367/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (995 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 13f70534df..af480bd9aa 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: 2023-07-13 00:51+0000\n" +"PO-Revision-Date: 2023-07-27 17:07+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -2848,7 +2848,7 @@ msgstr "não é possível criar instância" #: extmod/ulab/code/ndarray.c msgid "cannot delete array elements" -msgstr "" +msgstr "não é possível excluir os elementos da matriz" #: py/runtime.c msgid "cannot import name %q" @@ -3316,11 +3316,11 @@ msgstr "o assembler em linha deve ser uma função" #: extmod/ulab/code/numpy/vector.c msgid "input and output dimensions differ" -msgstr "" +msgstr "as dimensões da entrada e da saída diferem" #: extmod/ulab/code/numpy/vector.c msgid "input and output shapes differ" -msgstr "" +msgstr "as formas da entrada e da saída diferem" #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" @@ -3658,7 +3658,7 @@ msgstr "rendimento nativo" #: extmod/ulab/code/ndarray.c msgid "ndarray length overflows" -msgstr "" +msgstr "estouros de comprimento no ndarray" #: py/runtime.c #, c-format @@ -3760,7 +3760,7 @@ msgstr "não foi implementado para dtype complexo" #: extmod/ulab/code/numpy/bitwise.c msgid "not supported for input types" -msgstr "" +msgstr "não compatível para os tipos de entrada" #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" @@ -3915,11 +3915,11 @@ msgstr "a matriz externa é muito pequena" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for complex dtype" -msgstr "" +msgstr "a palavra-chave out não é compatível para o dtype complexo" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for function" -msgstr "" +msgstr "a palavra-chave out não é compatível com a função" #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" @@ -3927,11 +3927,11 @@ msgstr "deve ser uma matriz densa flutuante" #: extmod/ulab/code/numpy/vector.c msgid "out must be an ndarray" -msgstr "" +msgstr "out deve ser um ndarray" #: extmod/ulab/code/numpy/vector.c msgid "out must be of float dtype" -msgstr "" +msgstr "out deve ser do tipo float dtype" #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" From ab33ec6332fdae0ec152c57dca5665a22e483773 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Wed, 26 Jul 2023 16:00:16 +0000 Subject: [PATCH 1368/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (995 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index fd8c63a0a6..1b927ef549 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-07-11 17:05+0000\n" +"PO-Revision-Date: 2023-07-27 17:07+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -2819,7 +2819,7 @@ msgstr "kan inte skapa instans" #: extmod/ulab/code/ndarray.c msgid "cannot delete array elements" -msgstr "" +msgstr "kan inte ta bort arrayelement" #: py/runtime.c msgid "cannot import name %q" @@ -3285,11 +3285,11 @@ msgstr "inline assembler måste vara en funktion" #: extmod/ulab/code/numpy/vector.c msgid "input and output dimensions differ" -msgstr "" +msgstr "In- och utdimensionerna skiljer sig åt" #: extmod/ulab/code/numpy/vector.c msgid "input and output shapes differ" -msgstr "" +msgstr "In- och utdataformerna skiljer sig åt" #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" @@ -3624,7 +3624,7 @@ msgstr "native yield" #: extmod/ulab/code/ndarray.c msgid "ndarray length overflows" -msgstr "" +msgstr "ndarray-längden överskriden" #: py/runtime.c #, c-format @@ -3726,7 +3726,7 @@ msgstr "inte implementerat för complex dtype" #: extmod/ulab/code/numpy/bitwise.c msgid "not supported for input types" -msgstr "" +msgstr "stöds inte för indatatyper" #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" @@ -3878,11 +3878,11 @@ msgstr "matrisen för out är för liten" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for complex dtype" -msgstr "" +msgstr "nyckelordet out stöds inte för komplex dtyp" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for function" -msgstr "" +msgstr "nyckelordet out stöds inte för function" #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" @@ -3890,11 +3890,11 @@ msgstr "out måste vara en float dense array" #: extmod/ulab/code/numpy/vector.c msgid "out must be an ndarray" -msgstr "" +msgstr "out måste vara en ndarray" #: extmod/ulab/code/numpy/vector.c msgid "out must be of float dtype" -msgstr "" +msgstr "out måste vara av float dtype" #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" From 5780d9a3d2d7597ffdf954a591d26b140076040b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 27 Jul 2023 11:39:40 -0500 Subject: [PATCH 1369/1712] rp2: Add StateMachine.may_exec and also sanity-check the init instructions, thanks to the newly factored-out checker. Closes: #8221 --- locale/circuitpython.pot | 62 ++--- .../bindings/rp2pio/StateMachine.c | 12 +- .../bindings/rp2pio/StateMachine.h | 1 + .../common-hal/audiobusio/I2SOut.c | 3 +- .../raspberrypi/common-hal/audiobusio/PDMIn.c | 1 + .../imagecapture/ParallelImageCapture.c | 1 + .../common-hal/paralleldisplay/ParallelBus.c | 1 + .../raspberrypi/common-hal/pulseio/PulseIn.c | 1 + .../common-hal/rotaryio/IncrementalEncoder.c | 1 + .../common-hal/rp2pio/StateMachine.c | 223 ++++++++++-------- 10 files changed, 167 insertions(+), 139 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 3d21ca793e..ee22656685 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -251,6 +251,22 @@ msgstr "" msgid "%q=%q" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1161,26 +1177,6 @@ msgstr "" msgid "Input/output error" msgstr "" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "" @@ -1352,38 +1348,31 @@ msgid "Mismatched swap flag" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c @@ -1825,7 +1814,8 @@ msgstr "" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -4021,7 +4011,7 @@ msgstr "" msgid "sosfilt requires iterable arguments" msgstr "" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "" diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index bbf076ba68..757edc7004 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -100,6 +100,10 @@ //| :param int frequency: the target clock frequency of the state machine. Actual may be less. Use 0 for system clock speed. //| :param ReadableBuffer init: a program to run once at start up. This is run after program //| is started so instructions may be intermingled +//| :param ReadableBuffer may_exec: Instructions that may be executed via `StateMachine.exec` calls. +//| Some elements of the `StateMachine`'s configuration are inferred from the instructions used; +//| for instance, if there is no ``in`` or ``push`` instruction, then the `StateMachine` is configured without a receive FIFO. +//| In this case, passing a ``may_exec`` program containing an ``in`` instruction such as ``in x``, a receive FIFO will be configured. //| :param ~microcontroller.Pin first_out_pin: the first pin to use with the OUT instruction //| :param int out_pin_count: the count of consecutive pins to use with OUT starting at first_out_pin //| :param int initial_out_pin_state: the initial output value for out pins starting at first_out_pin @@ -152,7 +156,7 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { rp2pio_statemachine_obj_t *self = m_new_obj(rp2pio_statemachine_obj_t); self->base.type = &rp2pio_statemachine_type; - enum { ARG_program, ARG_frequency, ARG_init, + enum { ARG_program, ARG_frequency, ARG_init, ARG_may_exec, ARG_first_out_pin, ARG_out_pin_count, ARG_initial_out_pin_state, ARG_initial_out_pin_direction, ARG_first_in_pin, ARG_in_pin_count, ARG_pull_in_pin_up, ARG_pull_in_pin_down, @@ -171,6 +175,7 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n { MP_QSTR_program, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_frequency, MP_ARG_REQUIRED | MP_ARG_INT }, { MP_QSTR_init, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_may_exec, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, { MP_QSTR_first_out_pin, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, { MP_QSTR_out_pin_count, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 1} }, @@ -220,6 +225,10 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n init_bufinfo.len = 0; mp_get_buffer(args[ARG_init].u_obj, &init_bufinfo, MP_BUFFER_READ); + mp_buffer_info_t may_exec_bufinfo; + may_exec_bufinfo.len = 0; + mp_get_buffer(args[ARG_may_exec].u_obj, &may_exec_bufinfo, MP_BUFFER_READ); + // We don't validate pin in use here because we may be ok sharing them within a PIO. const mcu_pin_obj_t *first_out_pin = validate_obj_is_pin_or_none(args[ARG_first_out_pin].u_obj, MP_QSTR_first_out_pin); @@ -264,6 +273,7 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n bufinfo.buf, bufinfo.len / 2, args[ARG_frequency].u_int, init_bufinfo.buf, init_bufinfo.len / 2, + may_exec_bufinfo.buf, bufinfo.len / 2, first_out_pin, out_pin_count, args[ARG_initial_out_pin_state].u_int, args[ARG_initial_out_pin_direction].u_int, first_in_pin, in_pin_count, args[ARG_pull_in_pin_up].u_int, args[ARG_pull_in_pin_down].u_int, first_set_pin, set_pin_count, args[ARG_initial_set_pin_state].u_int, args[ARG_initial_set_pin_direction].u_int, diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.h b/ports/raspberrypi/bindings/rp2pio/StateMachine.h index 6f07ac1fa1..3238d0dfbd 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.h +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.h @@ -41,6 +41,7 @@ void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, const uint16_t *program, size_t program_len, size_t frequency, const uint16_t *init, size_t init_len, + const uint16_t *may_exec, size_t may_exec_len, const mcu_pin_obj_t *first_out_pin, uint8_t out_pin_count, uint32_t initial_out_pin_state, uint32_t initial_out_pin_direction, const mcu_pin_obj_t *first_in_pin, uint8_t in_pin_count, uint32_t pull_pin_up, uint32_t pull_pin_down, const mcu_pin_obj_t *first_set_pin, uint8_t set_pin_count, uint32_t initial_set_pin_state, uint32_t initial_set_pin_direction, diff --git a/ports/raspberrypi/common-hal/audiobusio/I2SOut.c b/ports/raspberrypi/common-hal/audiobusio/I2SOut.c index 7db053a39d..1e16b51241 100644 --- a/ports/raspberrypi/common-hal/audiobusio/I2SOut.c +++ b/ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -121,7 +121,8 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t *self, &self->state_machine, program, program_len, 44100 * 32 * 6, // Clock at 44.1 khz to warm the DAC up. - NULL, 0, + NULL, 0, // init + NULL, 0, // may_exec data, 1, 0, 0xffffffff, // out pin NULL, 0, // in pins 0, 0, // in pulls diff --git a/ports/raspberrypi/common-hal/audiobusio/PDMIn.c b/ports/raspberrypi/common-hal/audiobusio/PDMIn.c index c3aadd2bbe..3f84dfe18e 100644 --- a/ports/raspberrypi/common-hal/audiobusio/PDMIn.c +++ b/ports/raspberrypi/common-hal/audiobusio/PDMIn.c @@ -66,6 +66,7 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t *self, pdmin, MP_ARRAY_SIZE(pdmin), sample_rate * 32 * 2, // Frequency based on sample rate NULL, 0, + NULL, 0, // may_exec NULL, 1, 0, 0xffffffff, // out pin data_pin, 1, // in pins 0, 0, // in pulls diff --git a/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c b/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c index 7ad6acbaff..7f065b92a0 100644 --- a/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c +++ b/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c @@ -102,6 +102,7 @@ void common_hal_imagecapture_parallelimagecapture_construct(imagecapture_paralle imagecapture_code, MP_ARRAY_SIZE(imagecapture_code), common_hal_mcu_processor_get_frequency(), // full speed (4 instructions per loop -> max pclk 30MHz @ 120MHz) 0, 0, // init + NULL, 0, // may_exec NULL, 0, 0, 0, // out pins pin_from_number(data_pins[0]), data_count, // in pins 0, 0, // in pulls diff --git a/ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c b/ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c index 96c89ade95..8d25471821 100644 --- a/ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c +++ b/ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c @@ -98,6 +98,7 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu parallel_program, MP_ARRAY_SIZE(parallel_program), frequency * 2, // frequency multiplied by 2 as 2 PIO instructions NULL, 0, // init + NULL, 0, // may_exec data0, 8, 0, 255, // first out pin, # out pins NULL, 0, 0, 0, // first in pin, # in pins NULL, 0, 0, 0, // first set pin diff --git a/ports/raspberrypi/common-hal/pulseio/PulseIn.c b/ports/raspberrypi/common-hal/pulseio/PulseIn.c index 346c0951ed..247b48eea0 100644 --- a/ports/raspberrypi/common-hal/pulseio/PulseIn.c +++ b/ports/raspberrypi/common-hal/pulseio/PulseIn.c @@ -61,6 +61,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, pulsein_program, MP_ARRAY_SIZE(pulsein_program), 1000000, // frequency NULL, 0, // init, init_len + NULL, 0, // may_exec NULL, 0, 0, 0, // first out pin, # out pins, initial_out_pin_state pin, 1, 0, 0, // first in pin, # in pins NULL, 0, 0, 0, // first set pin diff --git a/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c b/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c index 7cb4c84382..06397a590f 100644 --- a/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c +++ b/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c @@ -81,6 +81,7 @@ void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencode encoder, MP_ARRAY_SIZE(encoder), 1000000, encoder_init, MP_ARRAY_SIZE(encoder_init), // init + NULL, 0, // may_exec NULL, 0, 0, 0, // out pin pins[0], 2, // in pins 3, 0, // in pulls diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index 9034b64242..2c0bd8d66a 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -387,10 +387,115 @@ static uint32_t mask_and_rotate(const mcu_pin_obj_t *first_pin, uint32_t bit_cou return value << shift | value >> (32 - shift); } +typedef struct { + uint32_t pins_we_use, in_pin_count, out_pin_count; + bool has_jmp_pin, auto_push, auto_pull, has_in_pin, has_out_pin, has_set_pin; + bool tx_fifo, rx_fifo, in_loaded, out_loaded, in_used, out_used; +} introspect_t; + +static void consider_instruction(introspect_t *state, uint16_t full_instruction, qstr what, size_t i) { + uint16_t instruction = full_instruction & 0xe000; + if (instruction == 0x8000) { + if ((full_instruction & 0xe080) == pio_instr_bits_push) { + state->rx_fifo = true; + state->in_loaded = true; + } else { // pull otherwise. + state->tx_fifo = true; + state->out_loaded = true; + } + } + if (instruction == pio_instr_bits_jmp) { + uint16_t condition = (full_instruction & 0x00e0) >> 5; + if ((condition == 0x6) && !state->has_jmp_pin) { + mp_raise_ValueError_varg(translate("Missing jmp_pin. %q[%u] jumps on pin"), what, i); + } + } + if (instruction == pio_instr_bits_wait) { + uint16_t wait_source = (full_instruction & 0x0060) >> 5; + uint16_t wait_index = full_instruction & 0x001f; + if (wait_source == 0 && (state->pins_we_use & (1 << wait_index)) == 0) { // GPIO + mp_raise_ValueError_varg(translate("%q[%u] uses extra pin"), i); + } + if (wait_source == 1) { // Input pin + if (state->has_in_pin) { + mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] waits based on pin"), what, i); + } + if (wait_index >= state->in_pin_count) { + mp_raise_ValueError_varg(translate("%q[%u] waits on input outside of count"), what, i); + } + } + } + if (instruction == pio_instr_bits_in) { + uint16_t source = (full_instruction & 0x00e0) >> 5; + uint16_t bit_count = full_instruction & 0x001f; + if (source == 0) { + if (!state->has_in_pin) { + mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] shifts in from pin(s)"), i); + } + if (bit_count > state->in_pin_count) { + mp_raise_ValueError_varg(translate("%q[%u] shifts in more bits than pin count"), i); + } + } + if (state->auto_push) { + state->in_loaded = true; + state->rx_fifo = true; + } + state->in_used = true; + } + if (instruction == pio_instr_bits_out) { + uint16_t bit_count = full_instruction & 0x001f; + uint16_t destination = (full_instruction & 0x00e0) >> 5; + // Check for pins or pindirs destination. + if (destination == 0x0 || destination == 0x4) { + if (!state->has_out_pin) { + mp_raise_ValueError_varg(translate("Missing first_out_pin. %q[%u] shifts out to pin(s)"), i); + } + if (bit_count > state->out_pin_count) { + mp_raise_ValueError_varg(translate("%q[%u] shifts out more bits than pin count"), i); + } + } + if (state->auto_pull) { + state->out_loaded = true; + state->tx_fifo = true; + } + state->out_used = true; + } + if (instruction == pio_instr_bits_set) { + uint16_t destination = (full_instruction & 0x00e0) >> 5; + // Check for pins or pindirs destination. + if ((destination == 0x00 || destination == 0x4) && !state->has_set_pin) { + mp_raise_ValueError_varg(translate("Missing first_set_pin. %q[%u] sets pin(s)"), i); + } + } + if (instruction == pio_instr_bits_mov) { + uint16_t source = full_instruction & 0x0007; + uint16_t destination = (full_instruction & 0x00e0) >> 5; + // Check for pins or pindirs destination. + if (destination == 0x0 && !state->has_out_pin) { + mp_raise_ValueError_varg(translate("Missing first_out_pin. %q[%u] writes pin(s)"), i); + } + if (source == 0x0 && !state->has_out_pin) { + mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] reads pin(s)"), i); + } + if (destination == 0x6) { + state->in_loaded = true; + } else if (destination == 0x7) { + state->out_loaded = true; + } + } +} + +static void consider_program(introspect_t *state, const uint16_t *program, size_t program_len, qstr what) { + for (size_t i = 0; i < program_len; i++) { + consider_instruction(state, program[i], what, i); + } +} + void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, const uint16_t *program, size_t program_len, size_t frequency, const uint16_t *init, size_t init_len, + const uint16_t *may_exec, size_t may_exec_len, const mcu_pin_obj_t *first_out_pin, uint8_t out_pin_count, uint32_t initial_out_pin_state, uint32_t initial_out_pin_direction, const mcu_pin_obj_t *first_in_pin, uint8_t in_pin_count, uint32_t pull_pin_up, uint32_t pull_pin_down, @@ -415,109 +520,25 @@ void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, pins_we_use |= _check_pins_free(jmp_pin, 1, exclusive_pin_use); // Look through the program to see what we reference and make sure it was provided. - bool tx_fifo = false; - bool rx_fifo = false; - bool in_loaded = false; // can be loaded in other ways besides the fifo - bool out_loaded = false; - bool in_used = false; - bool out_used = false; - for (size_t i = 0; i < program_len; i++) { - uint16_t full_instruction = program[i]; - uint16_t instruction = full_instruction & 0xe000; - if (instruction == 0x8000) { - if ((full_instruction & 0xe080) == pio_instr_bits_push) { - rx_fifo = true; - in_loaded = true; - } else { // pull otherwise. - tx_fifo = true; - out_loaded = true; - } - } - if (instruction == pio_instr_bits_jmp) { - uint16_t condition = (full_instruction & 0x00e0) >> 5; - if ((condition == 0x6) && (jmp_pin == NULL)) { - mp_raise_ValueError_varg(translate("Missing jmp_pin. Instruction %d jumps on pin"), i); - } - } - if (instruction == pio_instr_bits_wait) { - uint16_t wait_source = (full_instruction & 0x0060) >> 5; - uint16_t wait_index = full_instruction & 0x001f; - if (wait_source == 0 && (pins_we_use & (1 << wait_index)) == 0) { // GPIO - mp_raise_ValueError_varg(translate("Instruction %d uses extra pin"), i); - } - if (wait_source == 1) { // Input pin - if (first_in_pin == NULL) { - mp_raise_ValueError_varg(translate("Missing first_in_pin. Instruction %d waits based on pin"), i); - } - if (wait_index >= in_pin_count) { - mp_raise_ValueError_varg(translate("Instruction %d waits on input outside of count"), i); - } - } - } - if (instruction == pio_instr_bits_in) { - uint16_t source = (full_instruction & 0x00e0) >> 5; - uint16_t bit_count = full_instruction & 0x001f; - if (source == 0) { - if (first_in_pin == NULL) { - mp_raise_ValueError_varg(translate("Missing first_in_pin. Instruction %d shifts in from pin(s)"), i); - } - if (bit_count > in_pin_count) { - mp_raise_ValueError_varg(translate("Instruction %d shifts in more bits than pin count"), i); - } - } - if (auto_push) { - in_loaded = true; - rx_fifo = true; - } - in_used = true; - } - if (instruction == pio_instr_bits_out) { - uint16_t bit_count = full_instruction & 0x001f; - uint16_t destination = (full_instruction & 0x00e0) >> 5; - // Check for pins or pindirs destination. - if (destination == 0x0 || destination == 0x4) { - if (first_out_pin == NULL) { - mp_raise_ValueError_varg(translate("Missing first_out_pin. Instruction %d shifts out to pin(s)"), i); - } - if (bit_count > out_pin_count) { - mp_raise_ValueError_varg(translate("Instruction %d shifts out more bits than pin count"), i); - } - } - if (auto_pull) { - out_loaded = true; - tx_fifo = true; - } - out_used = true; - } - if (instruction == pio_instr_bits_set) { - uint16_t destination = (full_instruction & 0x00e0) >> 5; - // Check for pins or pindirs destination. - if ((destination == 0x00 || destination == 0x4) && first_set_pin == NULL) { - mp_raise_ValueError_varg(translate("Missing first_set_pin. Instruction %d sets pin(s)"), i); - } - } - if (instruction == pio_instr_bits_mov) { - uint16_t source = full_instruction & 0x0007; - uint16_t destination = (full_instruction & 0x00e0) >> 5; - // Check for pins or pindirs destination. - if (destination == 0x0 && first_out_pin == NULL) { - mp_raise_ValueError_varg(translate("Missing first_out_pin. Instruction %d writes pin(s)"), i); - } - if (source == 0x0 && first_in_pin == NULL) { - mp_raise_ValueError_varg(translate("Missing first_in_pin. Instruction %d reads pin(s)"), i); - } - if (destination == 0x6) { - in_loaded = true; - } else if (destination == 0x7) { - out_loaded = true; - } - } - } + introspect_t state = { + .pins_we_use = pins_we_use, + .has_jmp_pin = jmp_pin != NULL, + .has_in_pin = first_in_pin != NULL, + .has_out_pin = first_out_pin != NULL, + .has_set_pin = first_set_pin != NULL, + .in_pin_count = in_pin_count, + .out_pin_count = out_pin_count, + .auto_pull = auto_pull, + .auto_push = auto_push, + }; + consider_program(&state, program, program_len, MP_QSTR_program); + consider_program(&state, init, init_len, MP_QSTR_init); + consider_program(&state, may_exec, may_exec_len, MP_QSTR_may_exec); - if (!in_loaded && in_used) { + if (!state.in_loaded && state.in_used) { mp_raise_ValueError_varg(translate("Program does IN without loading ISR")); } - if (!out_loaded && out_used) { + if (!state.out_loaded && state.out_used) { mp_raise_ValueError_varg(translate("Program does OUT without loading OSR")); } @@ -570,7 +591,7 @@ void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, first_sideset_pin, sideset_pin_count, initial_pin_state, initial_pin_direction, jmp_pin, - pins_we_use, tx_fifo, rx_fifo, + pins_we_use, state.tx_fifo, state.rx_fifo, auto_pull, pull_threshold, out_shift_right, wait_for_txstall, auto_push, push_threshold, in_shift_right, From 92e21340091a575178521214dcb2559c3e356593 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 27 Jul 2023 11:58:43 -0500 Subject: [PATCH 1370/1712] rp2: StateMachine: Allow loading programs at fixed offsets --- .../bindings/rp2pio/StateMachine.c | 10 +++++-- .../bindings/rp2pio/StateMachine.h | 3 +- .../common-hal/audiobusio/I2SOut.c | 3 +- .../raspberrypi/common-hal/audiobusio/PDMIn.c | 4 +-- .../imagecapture/ParallelImageCapture.c | 3 +- .../common-hal/neopixel_write/__init__.c | 4 ++- .../common-hal/paralleldisplay/ParallelBus.c | 3 +- .../raspberrypi/common-hal/pulseio/PulseIn.c | 3 +- .../common-hal/rotaryio/IncrementalEncoder.c | 3 +- .../common-hal/rp2pio/StateMachine.c | 30 +++++++++++++++---- .../common-hal/rp2pio/StateMachine.h | 4 ++- 11 files changed, 52 insertions(+), 18 deletions(-) diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index 757edc7004..8615875e87 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -93,6 +93,7 @@ //| user_interruptible: bool = True, //| wrap_target: int = 0, //| wrap: int = -1, +//| offset: int = -1, //| ) -> None: //| """Construct a StateMachine object on the given pins with the given program. //| @@ -150,6 +151,9 @@ //| :param int wrap: The instruction after which to wrap to the ``wrap`` //| instruction. As a special case, -1 (the default) indicates the //| last instruction of the program. +//| :param int offset: A specific offset in the state machine's program memory where the program must be loaded. +//| The default value, -1, allows the program to be loaded at any offset. +//| This is appropriate for most programs. //| """ //| ... @@ -170,7 +174,8 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n ARG_auto_push, ARG_push_threshold, ARG_in_shift_right, ARG_user_interruptible, ARG_wrap_target, - ARG_wrap,}; + ARG_wrap, + ARG_offset,}; static const mp_arg_t allowed_args[] = { { MP_QSTR_program, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_frequency, MP_ARG_REQUIRED | MP_ARG_INT }, @@ -214,6 +219,7 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n { MP_QSTR_wrap_target, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_wrap, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, + { MP_QSTR_offset, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = -1} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); @@ -286,7 +292,7 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n args[ARG_wait_for_txstall].u_bool, args[ARG_auto_push].u_bool, push_threshold, args[ARG_in_shift_right].u_bool, args[ARG_user_interruptible].u_bool, - wrap_target, wrap); + wrap_target, wrap, args[ARG_offset].u_int); return MP_OBJ_FROM_PTR(self); } diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.h b/ports/raspberrypi/bindings/rp2pio/StateMachine.h index 3238d0dfbd..c1c7d6cd27 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.h +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.h @@ -54,7 +54,8 @@ void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, bool wait_for_txstall, bool auto_push, uint8_t push_threshold, bool in_shift_right, bool user_interruptible, - int wrap_taget, int wrap); + int wrap_taget, int wrap, + int offset); void common_hal_rp2pio_statemachine_deinit(rp2pio_statemachine_obj_t *self); bool common_hal_rp2pio_statemachine_deinited(rp2pio_statemachine_obj_t *self); diff --git a/ports/raspberrypi/common-hal/audiobusio/I2SOut.c b/ports/raspberrypi/common-hal/audiobusio/I2SOut.c index 1e16b51241..62d4058d1d 100644 --- a/ports/raspberrypi/common-hal/audiobusio/I2SOut.c +++ b/ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -136,7 +136,8 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t *self, false, // Wait for txstall false, 32, false, // in settings false, // Not user-interruptible. - 0, -1); // wrap settings + 0, -1, // wrap settings + PIO_ANY_OFFSET); self->playing = false; audio_dma_init(&self->dma); diff --git a/ports/raspberrypi/common-hal/audiobusio/PDMIn.c b/ports/raspberrypi/common-hal/audiobusio/PDMIn.c index 3f84dfe18e..5d94afcecc 100644 --- a/ports/raspberrypi/common-hal/audiobusio/PDMIn.c +++ b/ports/raspberrypi/common-hal/audiobusio/PDMIn.c @@ -80,8 +80,8 @@ void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t *self, false, // Wait for txstall false, 32, true, // in settings false, // Not user-interruptible. - 0, -1); // wrap settings - + 0, -1, // wrap settings + PIO_ANY_OFFSET); uint32_t actual_frequency = common_hal_rp2pio_statemachine_get_frequency(&self->state_machine); if (actual_frequency < MIN_MIC_CLOCK) { mp_raise_ValueError(translate("sampling rate out of range")); diff --git a/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c b/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c index 7f065b92a0..501e905af1 100644 --- a/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c +++ b/ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c @@ -120,7 +120,8 @@ void common_hal_imagecapture_parallelimagecapture_construct(imagecapture_paralle false, // wait for txstall true, 32, true, // in settings false, // Not user-interruptible. - 2, 5); // wrap settings + 2, 5, // wrap settings + PIO_ANY_OFFSET); } void common_hal_imagecapture_parallelimagecapture_deinit(imagecapture_parallelimagecapture_obj_t *self) { diff --git a/ports/raspberrypi/common-hal/neopixel_write/__init__.c b/ports/raspberrypi/common-hal/neopixel_write/__init__.c index d473285b02..c4a2282bdf 100644 --- a/ports/raspberrypi/common-hal/neopixel_write/__init__.c +++ b/ports/raspberrypi/common-hal/neopixel_write/__init__.c @@ -79,7 +79,9 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout, false, // claim pins false, // Not user-interruptible. false, // No sideset enable - 0, -1); // wrap + 0, -1, // wrap + PIO_ANY_OFFSET // offset + ); if (!ok) { // Do nothing. Maybe bitbang? return; diff --git a/ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c b/ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c index 8d25471821..827b72ebd7 100644 --- a/ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c +++ b/ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c @@ -111,7 +111,8 @@ void common_hal_paralleldisplay_parallelbus_construct(paralleldisplay_parallelbu false, // wait for TX stall false, 32, true, // RX setting we don't use false, // Not user-interruptible. - 0, -1); // wrap settings + 0, -1, // wrap settings + PIO_ANY_OFFSET); common_hal_rp2pio_statemachine_never_reset(&self->state_machine); } diff --git a/ports/raspberrypi/common-hal/pulseio/PulseIn.c b/ports/raspberrypi/common-hal/pulseio/PulseIn.c index 247b48eea0..2d21713e60 100644 --- a/ports/raspberrypi/common-hal/pulseio/PulseIn.c +++ b/ports/raspberrypi/common-hal/pulseio/PulseIn.c @@ -74,7 +74,8 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, false, // wait for TX stall true, 32, true, // RX auto pull every 32 bits. shift left to output msb first false, // Not user-interruptible. - 0, -1); // wrap settings + 0, -1, // wrap settings + PIO_ANY_OFFSET); common_hal_pulseio_pulsein_pause(self); diff --git a/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c b/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c index 06397a590f..54d0fd7858 100644 --- a/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c +++ b/ports/raspberrypi/common-hal/rotaryio/IncrementalEncoder.c @@ -95,7 +95,8 @@ void common_hal_rotaryio_incrementalencoder_construct(rotaryio_incrementalencode false, // Wait for txstall false, 32, false, // in settings false, // Not user-interruptible. - 0, MP_ARRAY_SIZE(encoder) - 1 // wrap settings + 0, MP_ARRAY_SIZE(encoder) - 1, // wrap settings + PIO_ANY_OFFSET ); // We're guaranteed by the init code that some output will be available promptly diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index 2c0bd8d66a..20ff359461 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -178,6 +178,21 @@ STATIC uint32_t _check_pins_free(const mcu_pin_obj_t *first_pin, uint8_t pin_cou return pins_we_use; } +static bool can_add_program(PIO pio, const pio_program_t *program, int offset) { + if (offset == -1) { + return pio_can_add_program(pio, program); + } + return pio_can_add_program_at_offset(pio, program, offset); +} + +static uint add_program(PIO pio, const pio_program_t *program, int offset) { + if (offset == -1) { + return pio_add_program(pio, program); + } else { + pio_add_program_at_offset(pio, program, offset); + return offset; + } +} bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, const uint16_t *program, size_t program_len, @@ -197,7 +212,8 @@ bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, bool claim_pins, bool user_interruptible, bool sideset_enable, - int wrap_target, int wrap + int wrap_target, int wrap, + int offset ) { // Create a program id that isn't the pointer so we can store it without storing the original object. uint32_t program_id = ~((uint32_t)program); @@ -215,14 +231,15 @@ bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, uint8_t free_count = 0; for (size_t j = 0; j < NUM_PIO_STATE_MACHINES; j++) { if (_current_program_id[i][j] == program_id && - _current_program_len[i][j] == program_len) { + _current_program_len[i][j] == program_len && + (offset == -1 || offset == _current_program_offset[i][j])) { program_offset = _current_program_offset[i][j]; } if (!pio_sm_is_claimed(pio, j)) { free_count++; } } - if (free_count > 0 && (program_offset < 32 || pio_can_add_program(pio, &program_struct))) { + if (free_count > 0 && (program_offset < 32 || can_add_program(pio, &program_struct, offset))) { pio_index = i; if (program_offset < 32) { break; @@ -254,7 +271,7 @@ bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, self->pio = pio_instances[pio_index]; self->state_machine = state_machine; if (program_offset == 32) { - program_offset = pio_add_program(self->pio, &program_struct); + program_offset = add_program(self->pio, &program_struct, offset); } self->offset = program_offset; _current_program_id[pio_index][state_machine] = program_id; @@ -509,7 +526,8 @@ void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, bool wait_for_txstall, bool auto_push, uint8_t push_threshold, bool in_shift_right, bool user_interruptible, - int wrap_target, int wrap) { + int wrap_target, int wrap, + int offset) { // First, check that all pins are free OR already in use by any PIO if exclusive_pin_use is false. uint32_t pins_we_use = wait_gpio_mask; @@ -598,7 +616,7 @@ void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, true /* claim pins */, user_interruptible, sideset_enable, - wrap_target, wrap); + wrap_target, wrap, offset); if (!ok) { mp_raise_RuntimeError(translate("All state machines in use")); } diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.h b/ports/raspberrypi/common-hal/rp2pio/StateMachine.h index f2d642bbad..fde578a9e6 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.h +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.h @@ -32,6 +32,8 @@ #include "common-hal/microcontroller/Pin.h" #include "src/rp2_common/hardware_pio/include/hardware/pio.h" +enum { PIO_ANY_OFFSET = -1 }; + typedef struct sm_buf_info { mp_obj_t obj; mp_buffer_info_t info; @@ -88,7 +90,7 @@ bool rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, bool claim_pins, bool interruptible, bool sideset_enable, - int wrap_target, int wrap); + int wrap_target, int wrap, int offset); uint8_t rp2pio_statemachine_program_offset(rp2pio_statemachine_obj_t *self); From ffb1cf116d2fa40df56ac5d4ac22ac784e5e4a2a Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Thu, 27 Jul 2023 16:46:15 -0700 Subject: [PATCH 1371/1712] Add D pins --- .../boards/adafruit_metro_esp32s3/pins.c | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c index e27f72f3bb..4ac6c49d29 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c +++ b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c @@ -27,18 +27,42 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO41) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_GPIO47) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO47),MP_ROM_PTR(&pin_GPIO47) }, @@ -55,8 +79,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_GPIO37) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO37),MP_ROM_PTR(&pin_GPIO37) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO45) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, From 1ff3097c77b5f473e129af84b95455e9e0b6cf3c Mon Sep 17 00:00:00 2001 From: Andi Chandler Date: Fri, 28 Jul 2023 00:08:52 +0000 Subject: [PATCH 1372/1712] Translated using Weblate (English (United Kingdom)) Currently translated at 100.0% (995 of 995 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/en_GB/ --- locale/en_GB.po | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/locale/en_GB.po b/locale/en_GB.po index e524cd27af..13de7645fe 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-07-19 21:06+0000\n" +"PO-Revision-Date: 2023-07-28 00:10+0000\n" "Last-Translator: Andi Chandler \n" "Language-Team: none\n" "Language: en_GB\n" @@ -2807,7 +2807,7 @@ msgstr "can't create instance" #: extmod/ulab/code/ndarray.c msgid "cannot delete array elements" -msgstr "" +msgstr "cannot delete array elements" #: py/runtime.c msgid "cannot import name %q" @@ -3271,11 +3271,11 @@ msgstr "inline assembler must be a function" #: extmod/ulab/code/numpy/vector.c msgid "input and output dimensions differ" -msgstr "" +msgstr "input and output dimensions differ" #: extmod/ulab/code/numpy/vector.c msgid "input and output shapes differ" -msgstr "" +msgstr "input and output shapes differ" #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" @@ -3607,7 +3607,7 @@ msgstr "native yield" #: extmod/ulab/code/ndarray.c msgid "ndarray length overflows" -msgstr "" +msgstr "ndarray length overflows" #: py/runtime.c #, c-format @@ -3709,7 +3709,7 @@ msgstr "not implemented for complex dtype" #: extmod/ulab/code/numpy/bitwise.c msgid "not supported for input types" -msgstr "" +msgstr "not supported for input types" #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" @@ -3861,11 +3861,11 @@ msgstr "out array is too small" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for complex dtype" -msgstr "" +msgstr "out keyword is not supported for complex dtype" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for function" -msgstr "" +msgstr "out keyword is not supported for function" #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" @@ -3873,11 +3873,11 @@ msgstr "out must be a float dense array" #: extmod/ulab/code/numpy/vector.c msgid "out must be an ndarray" -msgstr "" +msgstr "out must be an ndarray" #: extmod/ulab/code/numpy/vector.c msgid "out must be of float dtype" -msgstr "" +msgstr "out must be of float dtype" #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" From e9eaa63aef2e8d3b56b617841f2fe7f5f34f33c3 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Fri, 28 Jul 2023 02:35:32 +0200 Subject: [PATCH 1373/1712] 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 | 9 +++++++-- locale/cs.po | 9 +++++++-- locale/de_DE.po | 9 +++++++-- locale/el.po | 9 +++++++-- locale/en_GB.po | 9 +++++++-- locale/es.po | 9 +++++++-- locale/fil.po | 9 +++++++-- locale/fr.po | 9 +++++++-- locale/hi.po | 9 +++++++-- locale/it_IT.po | 9 +++++++-- locale/ja.po | 9 +++++++-- locale/ko.po | 9 +++++++-- locale/nl.po | 9 +++++++-- locale/pl.po | 9 +++++++-- locale/pt_BR.po | 9 +++++++-- locale/ru.po | 9 +++++++-- locale/sv.po | 9 +++++++-- locale/tr.po | 9 +++++++-- locale/zh_Latn_pinyin.po | 9 +++++++-- 19 files changed, 133 insertions(+), 38 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 483c5f48ac..51ecc1b3ce 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -1770,6 +1770,10 @@ msgstr "" msgid "Pins must share PWM slice" msgstr "" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Tambahkan module apapun pada filesystem\n" @@ -1849,7 +1853,8 @@ msgstr "Kesalahan pembuatan nomor acak" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Baca-saja" @@ -4050,7 +4055,7 @@ msgstr "" msgid "sosfilt requires iterable arguments" msgstr "" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 0ffa07aed8..063af8520e 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -1761,6 +1761,10 @@ msgstr "" msgid "Pins must share PWM slice" msgstr "" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1840,7 +1844,8 @@ msgstr "" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -4036,7 +4041,7 @@ msgstr "" msgid "sosfilt requires iterable arguments" msgstr "" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 609437e439..ade8b1e291 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -1794,6 +1794,10 @@ msgstr "Pins müssen geordnete GPIO-Pins sein" msgid "Pins must share PWM slice" msgstr "Pins muss ein geteiltes PWM-Stück sein" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "und alle Module im Dateisystem\n" @@ -1874,7 +1878,8 @@ msgstr "Fehler bei der Erzeugung von Zufallszahlen" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Nur lesen möglich, da Schreibgeschützt" @@ -4121,7 +4126,7 @@ msgstr "sos[:, 3] sollten alle Einsen sein" msgid "sosfilt requires iterable arguments" msgstr "sosfilt erfordert iterierbare Argumente" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "Quell-Palette zu groß" diff --git a/locale/el.po b/locale/el.po index 57fd874dd6..7c8998b140 100644 --- a/locale/el.po +++ b/locale/el.po @@ -1775,6 +1775,10 @@ msgstr "" msgid "Pins must share PWM slice" msgstr "" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1854,7 +1858,8 @@ msgstr "" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -4050,7 +4055,7 @@ msgstr "" msgid "sosfilt requires iterable arguments" msgstr "" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index 13de7645fe..cdda9a8f9b 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -1777,6 +1777,10 @@ msgstr "Pins must be sequential GPIO pins" msgid "Pins must share PWM slice" msgstr "Pins must share PWM slice" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Plus any modules on the filesystem\n" @@ -1854,7 +1858,8 @@ msgstr "Random number generation error" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Read-only" @@ -4064,7 +4069,7 @@ msgstr "sos[:, 3] should be all ones" msgid "sosfilt requires iterable arguments" msgstr "sosfilt requires iterable arguments" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "source palette too large" diff --git a/locale/es.po b/locale/es.po index 92af54c327..0e892a1636 100644 --- a/locale/es.po +++ b/locale/es.po @@ -1808,6 +1808,10 @@ msgstr "Los pines deben ser pines GPIO secuenciales" msgid "Pins must share PWM slice" msgstr "Los pines deben compartir la división PWM" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Además de cualquier módulo en el sistema de archivos\n" @@ -1888,7 +1892,8 @@ msgstr "Error de generación de números aleatorios" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Solo-lectura" @@ -4118,7 +4123,7 @@ msgstr "sos[:, 3] deberían ser todos unos" msgid "sosfilt requires iterable arguments" msgstr "sosfilt requiere argumentos iterables" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "paleta fuente muy larga" diff --git a/locale/fil.po b/locale/fil.po index aff40a5bb7..8d7ea45e45 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -1764,6 +1764,10 @@ msgstr "" msgid "Pins must share PWM slice" msgstr "" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Kasama ang kung ano pang modules na sa filesystem\n" @@ -1841,7 +1845,8 @@ msgstr "" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Basahin-lamang" @@ -4057,7 +4062,7 @@ msgstr "" msgid "sosfilt requires iterable arguments" msgstr "" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index 18c0d68845..1d8a0b8b4b 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -1818,6 +1818,10 @@ msgstr "Les broches doivent être des broches GPIO à la suite" msgid "Pins must share PWM slice" msgstr "Les broches doivent partager la tranche PWM" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Ainsi que tout autres modules présents sur le système de fichiers\n" @@ -1899,7 +1903,8 @@ msgstr "Erreur de génération de chiffres aléatoires" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Lecture seule" @@ -4141,7 +4146,7 @@ msgstr "sos[:, 3] doivent tous être à un" msgid "sosfilt requires iterable arguments" msgstr "sosfilt nécessite des argument itératifs" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "la palette source est trop grande" diff --git a/locale/hi.po b/locale/hi.po index 7469814d21..e3faa63ef1 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -1748,6 +1748,10 @@ msgstr "" msgid "Pins must share PWM slice" msgstr "" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1825,7 +1829,8 @@ msgstr "" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -4021,7 +4026,7 @@ msgstr "" msgid "sosfilt requires iterable arguments" msgstr "" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 6a4e37a0ef..4e020abc59 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -1770,6 +1770,10 @@ msgstr "" msgid "Pins must share PWM slice" msgstr "" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c #, fuzzy msgid "Plus any modules on the filesystem\n" @@ -1848,7 +1852,8 @@ msgstr "" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Sola lettura" @@ -4067,7 +4072,7 @@ msgstr "" msgid "sosfilt requires iterable arguments" msgstr "" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index 32b5569072..898ee0ecec 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -1763,6 +1763,10 @@ msgstr "" msgid "Pins must share PWM slice" msgstr "" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1841,7 +1845,8 @@ msgstr "乱数生成エラー" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "読み込み専用" @@ -4045,7 +4050,7 @@ msgstr "" msgid "sosfilt requires iterable arguments" msgstr "" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 0dd12d03e5..a9f2802a24 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -1751,6 +1751,10 @@ msgstr "" msgid "Pins must share PWM slice" msgstr "" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1828,7 +1832,8 @@ msgstr "" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -4025,7 +4030,7 @@ msgstr "" msgid "sosfilt requires iterable arguments" msgstr "" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 7d115254be..380f48f925 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -1767,6 +1767,10 @@ msgstr "" msgid "Pins must share PWM slice" msgstr "" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "En iedere module in het bestandssysteem\n" @@ -1846,7 +1850,8 @@ msgstr "Random number generatie fout" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Alleen-lezen" @@ -4055,7 +4060,7 @@ msgstr "sos[:, 3] moeten allemaal 1 zijn" msgid "sosfilt requires iterable arguments" msgstr "sosfilt vereist itereerbare argumenten" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "bronpalet te groot" diff --git a/locale/pl.po b/locale/pl.po index b97a3ba2a8..4f7e4c4f3e 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -1756,6 +1756,10 @@ msgstr "" msgid "Pins must share PWM slice" msgstr "" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Oraz moduły w systemie plików\n" @@ -1833,7 +1837,8 @@ msgstr "Błąd generowania liczb losowych" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Tylko do odczytu" @@ -4031,7 +4036,7 @@ msgstr "" msgid "sosfilt requires iterable arguments" msgstr "" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "źródłowa paleta jest zbyt duża" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index af480bd9aa..0343664e30 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -1802,6 +1802,10 @@ msgstr "Pinos devem ser pinos GPIO sequenciais" msgid "Pins must share PWM slice" msgstr "Os pinos devem compartilhar a fatia do PWM" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Além de quaisquer módulos no sistema de arquivos\n" @@ -1884,7 +1888,8 @@ msgstr "Houve um erro na geração do número aleatório" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Somente leitura" @@ -4120,7 +4125,7 @@ msgstr "sos[:, 3] deve ser um em todos" msgid "sosfilt requires iterable arguments" msgstr "o sosfilt requer que os argumentos sejam iteráveis" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "a paleta de origem é muito grande" diff --git a/locale/ru.po b/locale/ru.po index 12040cc439..7d7effef42 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -1807,6 +1807,10 @@ msgstr "Пины должны быть последовательными выв msgid "Pins must share PWM slice" msgstr "Пины должны иметь общий срез ШИМ" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1886,7 +1890,8 @@ msgstr "" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -4084,7 +4089,7 @@ msgstr "" msgid "sosfilt requires iterable arguments" msgstr "" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "" diff --git a/locale/sv.po b/locale/sv.po index 1b927ef549..ac191b0efc 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -1786,6 +1786,10 @@ msgstr "Pins måste vara sekventiella GPIO-pinnar" msgid "Pins must share PWM slice" msgstr "Pinnar måste dela PWM-segment" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Plus eventuella moduler i filsystemet\n" @@ -1865,7 +1869,8 @@ msgstr "Fel vid generering av slumptal" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Skrivskyddad" @@ -4082,7 +4087,7 @@ msgstr "sos[:, 3] måste vara ettor" msgid "sosfilt requires iterable arguments" msgstr "sosfilt kräver iterable argument" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "källpalett för stor" diff --git a/locale/tr.po b/locale/tr.po index 851fef7f94..d2a7184bd8 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -1767,6 +1767,10 @@ msgstr "" msgid "Pins must share PWM slice" msgstr "" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "" @@ -1847,7 +1851,8 @@ msgstr "" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "" @@ -4043,7 +4048,7 @@ msgstr "" msgid "sosfilt requires iterable arguments" msgstr "" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 3853fdc0d7..bd67ab9500 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -1791,6 +1791,10 @@ msgstr "yǐn jiǎo bì xū shì lián xù de GPIO yǐn jiǎo" msgid "Pins must share PWM slice" msgstr "yǐn jiǎo bì xū gòng xiǎng PWM qiē piàn" +#: shared-module/usb/core/Device.c +msgid "Pipe error" +msgstr "" + #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" msgstr "Zài wénjiàn xìtǒng shàng tiānjiā rènhé mókuài\n" @@ -1870,7 +1874,8 @@ msgstr "Suíjī shù shēngchéng cuòwù" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c -#: shared-bindings/pulseio/PulseIn.c shared-module/displayio/Bitmap.c +#: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c +#: shared-module/displayio/Bitmap.c msgid "Read-only" msgstr "Zhǐ dú" @@ -4085,7 +4090,7 @@ msgstr "sos [:, 3] yīnggāi quán shì" msgid "sosfilt requires iterable arguments" msgstr "sosfilt xūyào diédài cānshù" -#: shared-bindings/bitmaptools/__init__.c shared-bindings/displayio/Bitmap.c +#: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" msgstr "yuán miànbǎn tài dà" From 6083de017a0058f146e7602b5c7699a30c64bc79 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 27 Jul 2023 20:09:13 -0500 Subject: [PATCH 1374/1712] fix method name in docstr --- ports/raspberrypi/bindings/rp2pio/StateMachine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index 8615875e87..a885a844b9 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -101,7 +101,7 @@ //| :param int frequency: the target clock frequency of the state machine. Actual may be less. Use 0 for system clock speed. //| :param ReadableBuffer init: a program to run once at start up. This is run after program //| is started so instructions may be intermingled -//| :param ReadableBuffer may_exec: Instructions that may be executed via `StateMachine.exec` calls. +//| :param ReadableBuffer may_exec: Instructions that may be executed via `StateMachine.run` calls. //| Some elements of the `StateMachine`'s configuration are inferred from the instructions used; //| for instance, if there is no ``in`` or ``push`` instruction, then the `StateMachine` is configured without a receive FIFO. //| In this case, passing a ``may_exec`` program containing an ``in`` instruction such as ``in x``, a receive FIFO will be configured. From 45b1c42be517fc6c03eed0d5aa101634b6842efd Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Thu, 27 Jul 2023 19:26:37 -0700 Subject: [PATCH 1375/1712] Add D0 and D1 --- ports/espressif/boards/adafruit_metro_esp32s3/pins.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c index 4ac6c49d29..dfad4381ef 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c +++ b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c @@ -21,12 +21,14 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO1) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO40) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, - + { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO41) }, { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO41) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO40) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO40) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, From 76d69283a46229293ef8f426d4177f58a30351b4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 28 Jul 2023 10:44:38 -0500 Subject: [PATCH 1376/1712] update certificates to nina-fw 1.7.5 --- lib/certificates/nina-fw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/certificates/nina-fw b/lib/certificates/nina-fw index d73fe315cc..21205e4005 160000 --- a/lib/certificates/nina-fw +++ b/lib/certificates/nina-fw @@ -1 +1 @@ -Subproject commit d73fe315cc7f9148a0918490d3b75430c8444bf7 +Subproject commit 21205e400515a698266abaaea902bd1ea897bb5d From 1ece85ee1e72bc1e5b8fc44870d5ca462976df5f Mon Sep 17 00:00:00 2001 From: elpekenin Date: Fri, 28 Jul 2023 23:49:45 +0200 Subject: [PATCH 1377/1712] Fix logic (i think) --- ports/stm/supervisor/internal_flash.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/stm/supervisor/internal_flash.c b/ports/stm/supervisor/internal_flash.c index f3f9719753..c7b792616c 100644 --- a/ports/stm/supervisor/internal_flash.c +++ b/ports/stm/supervisor/internal_flash.c @@ -303,9 +303,8 @@ mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t n flash_get_sector_info(src, §or_start_addr, §or_size); // Count how many blocks are left in the sector uint32_t count = (sector_size - (src - sector_start_addr)) / FILESYSTEM_BLOCK_SIZE; - count = MIN(num_blocks, count); - if (count < num_blocks && _cache_flash_addr == sector_start_addr) { + if (count <= num_blocks && _cache_flash_addr == sector_start_addr) { // Read is contained in the cache, so just read cache memcpy(dest, (_flash_cache + (src - sector_start_addr)), FILESYSTEM_BLOCK_SIZE * num_blocks); } else { From c4e915c3b271dd652d99fc1e1d8443cacbe8bbe2 Mon Sep 17 00:00:00 2001 From: elpekenin Date: Sat, 29 Jul 2023 14:39:44 +0200 Subject: [PATCH 1378/1712] Improve error message --- locale/circuitpython.pot | 2 +- shared-module/displayio/__init__.c | 2 +- tools/check_translations.py | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 1892339213..665594c1b9 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2056,7 +2056,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses" +msgid "Too many display busses; forgot display.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index e9431dee14..2ec0fa7316 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -386,5 +386,5 @@ primary_display_bus_t *allocate_display_bus_or_raise(void) { if (result) { return result; } - mp_raise_RuntimeError(translate("Too many display busses")); + mp_raise_RuntimeError(translate("Too many display busses; forgot display.release_displays() ?")); } diff --git a/tools/check_translations.py b/tools/check_translations.py index 95776a5449..19bfa8afb0 100644 --- a/tools/check_translations.py +++ b/tools/check_translations.py @@ -22,7 +22,9 @@ for po_filename in po_filenames: missing = all_ids - po_ids if missing: - print("Missing message id. Please run `make translate`") + print( + "Missing message id. Please run `make translate` and then `git commit locale/circuitpython.pot`" + ) print(missing) sys.exit(-1) else: From 9dbdf593676685285329660a5f65124007bcb2e3 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 28 Jul 2023 02:58:23 +0000 Subject: [PATCH 1379/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (996 of 996 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 0343664e30..e9368e97ef 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: 2023-07-27 17:07+0000\n" +"PO-Revision-Date: 2023-07-29 12:56+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1804,7 +1804,7 @@ msgstr "Os pinos devem compartilhar a fatia do PWM" #: shared-module/usb/core/Device.c msgid "Pipe error" -msgstr "" +msgstr "Erro de pipe" #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" From 6843901aa29674a7e1a05ead78a16c62b625596f Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Fri, 28 Jul 2023 12:38:42 +0000 Subject: [PATCH 1380/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (996 of 996 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index ac191b0efc..5160cb795a 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-07-27 17:07+0000\n" +"PO-Revision-Date: 2023-07-29 12:56+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -1788,7 +1788,7 @@ msgstr "Pinnar måste dela PWM-segment" #: shared-module/usb/core/Device.c msgid "Pipe error" -msgstr "" +msgstr "Pipe-fel" #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" From e46fe64ea3101c6c1cf72348ccac445dca64edba Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sat, 29 Jul 2023 14:56:43 +0200 Subject: [PATCH 1381/1712] 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 | 7 +++++-- locale/cs.po | 2 +- locale/de_DE.po | 7 +++++-- locale/el.po | 2 +- locale/en_GB.po | 7 +++++-- locale/es.po | 7 +++++-- locale/fil.po | 2 +- locale/fr.po | 7 +++++-- locale/hi.po | 2 +- locale/it_IT.po | 2 +- locale/ja.po | 2 +- locale/ko.po | 2 +- locale/nl.po | 7 +++++-- locale/pl.po | 7 +++++-- locale/pt_BR.po | 7 +++++-- locale/ru.po | 2 +- locale/sv.po | 7 +++++-- locale/tr.po | 2 +- locale/zh_Latn_pinyin.po | 7 +++++-- 19 files changed, 59 insertions(+), 29 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 51ecc1b3ce..45523b9085 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -2082,8 +2082,8 @@ msgid "Too many channels in sample." msgstr "Terlalu banyak channel dalam sampel" #: shared-module/displayio/__init__.c -msgid "Too many display busses" -msgstr "Terlalu banyak tampilan bus" +msgid "Too many display busses; forgot display.release_displays() ?" +msgstr "" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -4390,6 +4390,9 @@ msgstr "zi harus berjenis float" msgid "zi must be of shape (n_section, 2)" msgstr "Zi harus berbentuk (n_section, 2)" +#~ msgid "Too many display busses" +#~ msgstr "Terlalu banyak tampilan bus" + #~ msgid "Hardware busy, try alternative pins" #~ msgstr "Perangkat keras sibuk, coba pin alternatif" diff --git a/locale/cs.po b/locale/cs.po index 063af8520e..ed7a98bf0b 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -2071,7 +2071,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses" +msgid "Too many display busses; forgot display.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/de_DE.po b/locale/de_DE.po index ade8b1e291..42d8107441 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -2114,8 +2114,8 @@ msgid "Too many channels in sample." msgstr "Zu viele Kanäle im sample." #: shared-module/displayio/__init__.c -msgid "Too many display busses" -msgstr "Zu viele Anzeigebusse" +msgid "Too many display busses; forgot display.release_displays() ?" +msgstr "" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -4463,6 +4463,9 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "Too many display busses" +#~ msgstr "Zu viele Anzeigebusse" + #~ msgid "Cannot transfer without MOSI and MISO pins" #~ msgstr "Kann nicht ohne MISO und MOSI Pins transferieren" diff --git a/locale/el.po b/locale/el.po index 7c8998b140..db55e92252 100644 --- a/locale/el.po +++ b/locale/el.po @@ -2085,7 +2085,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses" +msgid "Too many display busses; forgot display.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/en_GB.po b/locale/en_GB.po index cdda9a8f9b..7b1646a846 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -2087,8 +2087,8 @@ msgid "Too many channels in sample." msgstr "Too many channels in sample." #: shared-module/displayio/__init__.c -msgid "Too many display busses" -msgstr "Too many display busses" +msgid "Too many display busses; forgot display.release_displays() ?" +msgstr "" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -4404,6 +4404,9 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "Too many display busses" +#~ msgstr "Too many display busses" + #~ msgid "Cannot transfer without MOSI and MISO pins" #~ msgstr "Cannot transfer without MOSI and MISO pins" diff --git a/locale/es.po b/locale/es.po index 0e892a1636..070fe6cc41 100644 --- a/locale/es.po +++ b/locale/es.po @@ -2126,8 +2126,8 @@ msgid "Too many channels in sample." msgstr "Demasiados canales en sample." #: shared-module/displayio/__init__.c -msgid "Too many display busses" -msgstr "Demasiados buses de pantalla" +msgid "Too many display busses; forgot display.release_displays() ?" +msgstr "" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -4459,6 +4459,9 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Too many display busses" +#~ msgstr "Demasiados buses de pantalla" + #~ msgid "Cannot transfer without MOSI and MISO pins" #~ msgstr "No puede ser transferido si los pines MOSI y MISO" diff --git a/locale/fil.po b/locale/fil.po index 8d7ea45e45..8f0c316c0e 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -2072,7 +2072,7 @@ msgid "Too many channels in sample." msgstr "Sobra ang channels sa sample." #: shared-module/displayio/__init__.c -msgid "Too many display busses" +msgid "Too many display busses; forgot display.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/fr.po b/locale/fr.po index 1d8a0b8b4b..b6f111e30e 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -2133,8 +2133,8 @@ msgid "Too many channels in sample." msgstr "Trop de canaux dans l'échantillon." #: shared-module/displayio/__init__.c -msgid "Too many display busses" -msgstr "Trop de bus d'affichage" +msgid "Too many display busses; forgot display.release_displays() ?" +msgstr "" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -4482,6 +4482,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 "Too many display busses" +#~ msgstr "Trop de bus d'affichage" + #~ msgid "Cannot transfer without MOSI and MISO pins" #~ msgstr "Impossible de transférer sans une broche MOSI ou MISO" diff --git a/locale/hi.po b/locale/hi.po index e3faa63ef1..0f2d364447 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -2056,7 +2056,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses" +msgid "Too many display busses; forgot display.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/it_IT.po b/locale/it_IT.po index 4e020abc59..9f469e92ed 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -2079,7 +2079,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses" +msgid "Too many display busses; forgot display.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/ja.po b/locale/ja.po index 898ee0ecec..d20c5050a7 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -2072,7 +2072,7 @@ msgid "Too many channels in sample." msgstr "サンプルのチャンネル数が多すぎます" #: shared-module/displayio/__init__.c -msgid "Too many display busses" +msgid "Too many display busses; forgot display.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/ko.po b/locale/ko.po index a9f2802a24..e6d207ed28 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -2059,7 +2059,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses" +msgid "Too many display busses; forgot display.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/nl.po b/locale/nl.po index 380f48f925..ded4e7f621 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -2077,8 +2077,8 @@ msgid "Too many channels in sample." msgstr "Teveel kanalen in sample." #: shared-module/displayio/__init__.c -msgid "Too many display busses" -msgstr "Teveel beeldscherm bussen" +msgid "Too many display busses; forgot display.release_displays() ?" +msgstr "" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -4395,6 +4395,9 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "Too many display busses" +#~ msgstr "Teveel beeldscherm bussen" + #~ msgid "Hardware busy, try alternative pins" #~ msgstr "Hardware bezig, probeer alternatieve pinnen" diff --git a/locale/pl.po b/locale/pl.po index 4f7e4c4f3e..075faf0766 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -2064,8 +2064,8 @@ msgid "Too many channels in sample." msgstr "Zbyt wiele kanałów." #: shared-module/displayio/__init__.c -msgid "Too many display busses" -msgstr "Zbyt wiele magistrali" +msgid "Too many display busses; forgot display.release_displays() ?" +msgstr "" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -4371,6 +4371,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Too many display busses" +#~ msgstr "Zbyt wiele magistrali" + #~ msgid "Hardware busy, try alternative pins" #~ msgstr "Sprzęt zajęty, wypróbuj alternatywne piny" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index e9368e97ef..9eca832ae9 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -2121,8 +2121,8 @@ msgid "Too many channels in sample." msgstr "Muitos canais na amostra." #: shared-module/displayio/__init__.c -msgid "Too many display busses" -msgstr "Muitos barramentos estão sendo exibidos" +msgid "Too many display busses; forgot display.release_displays() ?" +msgstr "" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -4460,6 +4460,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 "Too many display busses" +#~ msgstr "Muitos barramentos estão sendo exibidos" + #~ msgid "Cannot transfer without MOSI and MISO pins" #~ msgstr "Não é possível transferir sem os pinos MOSI e MISO" diff --git a/locale/ru.po b/locale/ru.po index 7d7effef42..cf7d8724f1 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -2119,7 +2119,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses" +msgid "Too many display busses; forgot display.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/sv.po b/locale/sv.po index 5160cb795a..9b6b650966 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -2098,8 +2098,8 @@ msgid "Too many channels in sample." msgstr "För många kanaler i sampling." #: shared-module/displayio/__init__.c -msgid "Too many display busses" -msgstr "För många display-bussar" +msgid "Too many display busses; forgot display.release_displays() ?" +msgstr "" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -4422,6 +4422,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 "Too many display busses" +#~ msgstr "För många display-bussar" + #~ msgid "Cannot transfer without MOSI and MISO pins" #~ msgstr "Det går inte att överföra utan MOSI- och MISO-pinnar" diff --git a/locale/tr.po b/locale/tr.po index d2a7184bd8..0e2b0e1122 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -2078,7 +2078,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses" +msgid "Too many display busses; forgot display.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index bd67ab9500..3ebc8166f1 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -2103,8 +2103,8 @@ msgid "Too many channels in sample." msgstr "Chōuyàng zhōng de píndào tài duō." #: shared-module/displayio/__init__.c -msgid "Too many display busses" -msgstr "Xiǎnshì zǒngxiàn tài duōle" +msgid "Too many display busses; forgot display.release_displays() ?" +msgstr "" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -4428,6 +4428,9 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Too many display busses" +#~ msgstr "Xiǎnshì zǒngxiàn tài duōle" + #~ msgid "Cannot transfer without MOSI and MISO pins" #~ msgstr "méiyǒu MOSI hé MISO yǐnjiǎo, wúfǎ chuánshū" From a51be16d9ec6ff29c758ebe68725479e48a4a4bf Mon Sep 17 00:00:00 2001 From: elpekenin Date: Sat, 29 Jul 2023 15:10:09 +0200 Subject: [PATCH 1382/1712] Fix typo, oopsie --- locale/circuitpython.pot | 2 +- shared-module/displayio/__init__.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 665594c1b9..f32d14c409 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2056,7 +2056,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/shared-module/displayio/__init__.c b/shared-module/displayio/__init__.c index 2ec0fa7316..f01cca781e 100644 --- a/shared-module/displayio/__init__.c +++ b/shared-module/displayio/__init__.c @@ -386,5 +386,5 @@ primary_display_bus_t *allocate_display_bus_or_raise(void) { if (result) { return result; } - mp_raise_RuntimeError(translate("Too many display busses; forgot display.release_displays() ?")); + mp_raise_RuntimeError(translate("Too many display busses; forgot displayio.release_displays() ?")); } From e1fd97170a5a9db4be4cd8e09ed5d5fbc34f9c79 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sat, 29 Jul 2023 15:31:41 +0200 Subject: [PATCH 1383/1712] 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/en_GB.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/ru.po | 2 +- locale/sv.po | 2 +- locale/tr.po | 2 +- locale/zh_Latn_pinyin.po | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 45523b9085..302186b549 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -2082,7 +2082,7 @@ msgid "Too many channels in sample." msgstr "Terlalu banyak channel dalam sampel" #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/cs.po b/locale/cs.po index ed7a98bf0b..2a23f16976 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -2071,7 +2071,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/de_DE.po b/locale/de_DE.po index 42d8107441..349539049f 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -2114,7 +2114,7 @@ msgid "Too many channels in sample." msgstr "Zu viele Kanäle im sample." #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/el.po b/locale/el.po index db55e92252..f9b61bdeae 100644 --- a/locale/el.po +++ b/locale/el.po @@ -2085,7 +2085,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/en_GB.po b/locale/en_GB.po index 7b1646a846..bedbe3c09a 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -2087,7 +2087,7 @@ msgid "Too many channels in sample." msgstr "Too many channels in sample." #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/es.po b/locale/es.po index 070fe6cc41..208d6edca8 100644 --- a/locale/es.po +++ b/locale/es.po @@ -2126,7 +2126,7 @@ msgid "Too many channels in sample." msgstr "Demasiados canales en sample." #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/fil.po b/locale/fil.po index 8f0c316c0e..1d7373f63e 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -2072,7 +2072,7 @@ msgid "Too many channels in sample." msgstr "Sobra ang channels sa sample." #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/fr.po b/locale/fr.po index b6f111e30e..ffddbdf6f1 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -2133,7 +2133,7 @@ msgid "Too many channels in sample." msgstr "Trop de canaux dans l'échantillon." #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/hi.po b/locale/hi.po index 0f2d364447..18ed2bf5fc 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -2056,7 +2056,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/it_IT.po b/locale/it_IT.po index 9f469e92ed..4a0101fc47 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -2079,7 +2079,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/ja.po b/locale/ja.po index d20c5050a7..b3d7dd67b3 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -2072,7 +2072,7 @@ msgid "Too many channels in sample." msgstr "サンプルのチャンネル数が多すぎます" #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/ko.po b/locale/ko.po index e6d207ed28..1946d9572f 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -2059,7 +2059,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/nl.po b/locale/nl.po index ded4e7f621..ea4d0698b4 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -2077,7 +2077,7 @@ msgid "Too many channels in sample." msgstr "Teveel kanalen in sample." #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/pl.po b/locale/pl.po index 075faf0766..5817ac80c7 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -2064,7 +2064,7 @@ msgid "Too many channels in sample." msgstr "Zbyt wiele kanałów." #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 9eca832ae9..66f3f3c0b9 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -2121,7 +2121,7 @@ msgid "Too many channels in sample." msgstr "Muitos canais na amostra." #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/ru.po b/locale/ru.po index cf7d8724f1..043d802835 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -2119,7 +2119,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/sv.po b/locale/sv.po index 9b6b650966..7d1226f051 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -2098,7 +2098,7 @@ msgid "Too many channels in sample." msgstr "För många kanaler i sampling." #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/tr.po b/locale/tr.po index 0e2b0e1122..a58eb36211 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -2078,7 +2078,7 @@ msgid "Too many channels in sample." msgstr "" #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 3ebc8166f1..32527b4e8b 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -2103,7 +2103,7 @@ msgid "Too many channels in sample." msgstr "Chōuyàng zhōng de píndào tài duō." #: shared-module/displayio/__init__.c -msgid "Too many display busses; forgot display.release_displays() ?" +msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" #: shared-module/displayio/__init__.c From a9da9bc3035a7f84c4097a25afb52a1010f5b6d9 Mon Sep 17 00:00:00 2001 From: KB Sriram Date: Sat, 29 Jul 2023 18:11:48 -0700 Subject: [PATCH 1384/1712] docs: update sphinx conf.py to use cp_typing. - Adds circuitpython_typing to the intersphinx configuration. - Adds a workaround to resolve TypeAliased references. Fixes https://github.com/adafruit/circuitpython/issues/8119 --- conf.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/conf.py b/conf.py index e14c6ace83..645961c457 100644 --- a/conf.py +++ b/conf.py @@ -30,6 +30,7 @@ from collections import defaultdict from sphinx.transforms import SphinxTransform from docutils import nodes from sphinx import addnodes +from sphinx.ext import intersphinx tools_describe = str(pathlib.Path(__file__).parent / "tools/describe") @@ -441,7 +442,8 @@ texinfo_documents = [ # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {"cpython": ('https://docs.python.org/3/', None), - "register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None)} + "register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None), + "typing": ('https://circuitpython.readthedocs.io/projects/adafruit-circuitpython-typing/en/latest/', None)} # Adapted from sphinxcontrib-redirects from sphinx.builders import html as builders @@ -483,6 +485,26 @@ def generate_redirects(app): with open(redirected_filename, 'w') as f: f.write(TEMPLATE % urllib.parse.quote(to_path, '#/')) +def adafruit_typing_workaround(app, env, node, contnode): + # Sphinx marks a requesting node that uses circuitpython-typing + # as looking for a "class" definition, but unfortunately + # Sphinx doesn't recognize TypeAlias based types usefully from + # the typing library. + # (see: https://github.com/sphinx-doc/sphinx/issues/8934) + # Instead, it categorizes these types as "data". + # (see: python -m sphinx.ext.intersphinx \ + # https://docs.circuitpython.org/projects/adafruit-circuitpython-typing/en/latest/objects.inv) + # This workaround traps missing references, checks if + # they are likely to be in the circuitpython_typing package, + # and changes the requesting type from "class" to "data" if + # needed, and re-tries the reference resolver. + ref = node.get("reftarget", None) + if ref and ref.startswith("circuitpython_typing."): + dtype = node.get("reftype", None) + if dtype != "data": + node.attributes.update({"reftype": "data"}) + return intersphinx.missing_reference(app, env, node, contnode) + class CoreModuleTransform(SphinxTransform): default_priority = 870 @@ -519,4 +541,5 @@ def setup(app): app.add_js_file("filter.js") app.add_config_value('redirects_file', 'redirects', 'env') app.connect('builder-inited', generate_redirects) + app.connect('missing-reference', adafruit_typing_workaround) app.add_transform(CoreModuleTransform) From 88608ce1cb7786f83d7514b26454898c797052f3 Mon Sep 17 00:00:00 2001 From: Pablo Martinez Bernal Date: Sat, 29 Jul 2023 14:13:34 +0000 Subject: [PATCH 1385/1712] Translated using Weblate (Spanish) Currently translated at 100.0% (996 of 996 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/locale/es.po b/locale/es.po index 208d6edca8..f76b3d6534 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-07-16 04:32+0000\n" -"Last-Translator: Jose David M \n" +"PO-Revision-Date: 2023-07-30 11:47+0000\n" +"Last-Translator: Pablo Martinez Bernal \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" @@ -1810,7 +1810,7 @@ msgstr "Los pines deben compartir la división PWM" #: shared-module/usb/core/Device.c msgid "Pipe error" -msgstr "" +msgstr "Error de conexión" #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" @@ -2128,6 +2128,7 @@ msgstr "Demasiados canales en sample." #: shared-module/displayio/__init__.c msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" +"Demasiados buses para displays. Olvidaste displayio.release_displays() ?" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -2858,7 +2859,7 @@ msgstr "no se puede crear instancia" #: extmod/ulab/code/ndarray.c msgid "cannot delete array elements" -msgstr "" +msgstr "no se pudo eliminar elementos del array" #: py/runtime.c msgid "cannot import name %q" @@ -3323,11 +3324,11 @@ msgstr "ensamblador en línea debe ser una función" #: extmod/ulab/code/numpy/vector.c msgid "input and output dimensions differ" -msgstr "" +msgstr "dimensiones de entrada y salida distintas" #: extmod/ulab/code/numpy/vector.c msgid "input and output shapes differ" -msgstr "" +msgstr "formas de entrada y salida distintas" #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" @@ -3663,7 +3664,7 @@ msgstr "yield nativo" #: extmod/ulab/code/ndarray.c msgid "ndarray length overflows" -msgstr "" +msgstr "la longitud de ndarray desborda" #: py/runtime.c #, c-format @@ -3768,7 +3769,7 @@ msgstr "no esta implementado para complex dtype" #: extmod/ulab/code/numpy/bitwise.c msgid "not supported for input types" -msgstr "" +msgstr "no soportado para los tipos de entrada" #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" @@ -3920,11 +3921,11 @@ msgstr "La matriz de salida es demasiado pequeña" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for complex dtype" -msgstr "" +msgstr "out no soportado para el dtype 'complex'" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for function" -msgstr "" +msgstr "out no soportado para funciones" #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" @@ -3932,11 +3933,11 @@ msgstr "la matriz de salida debe ser densa de números float" #: extmod/ulab/code/numpy/vector.c msgid "out must be an ndarray" -msgstr "" +msgstr "out debe ser un ndarray" #: extmod/ulab/code/numpy/vector.c msgid "out must be of float dtype" -msgstr "" +msgstr "el dtype de out debe ser float" #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" From 9ff97b4c377d9059393c6c35c875666e848ee7bb Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Sat, 29 Jul 2023 18:20:29 +0000 Subject: [PATCH 1386/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (996 of 996 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 66f3f3c0b9..ed7b6ae9c4 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: 2023-07-29 12:56+0000\n" +"PO-Revision-Date: 2023-07-30 11:47+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -2123,6 +2123,8 @@ msgstr "Muitos canais na amostra." #: shared-module/displayio/__init__.c msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" +"Excesso de barramentos de exibição; esqueceu do displayio.release_displays() " +"?" #: shared-module/displayio/__init__.c msgid "Too many displays" From a32e933876fd1d0e78e8936cc5d8b28cf05131c5 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Sat, 29 Jul 2023 13:59:43 +0000 Subject: [PATCH 1387/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (996 of 996 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 7d1226f051..df519cab05 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-07-29 12:56+0000\n" +"PO-Revision-Date: 2023-07-30 11:47+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -2099,7 +2099,7 @@ msgstr "För många kanaler i sampling." #: shared-module/displayio/__init__.c msgid "Too many display busses; forgot displayio.release_displays() ?" -msgstr "" +msgstr "För många displaybussar; glömt displayio.release_displays() ?" #: shared-module/displayio/__init__.c msgid "Too many displays" From 4f30c178d6fde3796247a8f93b423b635dbc8826 Mon Sep 17 00:00:00 2001 From: Andi Chandler Date: Sat, 29 Jul 2023 23:30:40 +0000 Subject: [PATCH 1388/1712] Translated using Weblate (English (United Kingdom)) Currently translated at 100.0% (996 of 996 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/en_GB/ --- locale/en_GB.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/en_GB.po b/locale/en_GB.po index bedbe3c09a..0abf8ef25e 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-07-28 00:10+0000\n" +"PO-Revision-Date: 2023-07-30 11:47+0000\n" "Last-Translator: Andi Chandler \n" "Language-Team: none\n" "Language: en_GB\n" @@ -1779,7 +1779,7 @@ msgstr "Pins must share PWM slice" #: shared-module/usb/core/Device.c msgid "Pipe error" -msgstr "" +msgstr "Pipe error" #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" @@ -2088,7 +2088,7 @@ msgstr "Too many channels in sample." #: shared-module/displayio/__init__.c msgid "Too many display busses; forgot displayio.release_displays() ?" -msgstr "" +msgstr "Too many display busses; forgot displayio.release_displays() ?" #: shared-module/displayio/__init__.c msgid "Too many displays" From d5daa7ad27578ddad1920204afb844be6cd6b5c9 Mon Sep 17 00:00:00 2001 From: KB Sriram Date: Sun, 30 Jul 2023 22:13:10 -0700 Subject: [PATCH 1389/1712] boards/beetle-esp32-c3: fix sdkconfig minor typo. Fixes https://github.com/adafruit/circuitpython/issues/8239 --- ports/espressif/boards/beetle-esp32-c3/sdkconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/beetle-esp32-c3/sdkconfig b/ports/espressif/boards/beetle-esp32-c3/sdkconfig index 68be40df7a..69da6d30fd 100644 --- a/ports/espressif/boards/beetle-esp32-c3/sdkconfig +++ b/ports/espressif/boards/beetle-esp32-c3/sdkconfig @@ -1,5 +1,5 @@ # # LWIP # -CONFIG_LWIP_LOCAL_HOSTNAME="beetle-esp32-c3 +CONFIG_LWIP_LOCAL_HOSTNAME="beetle-esp32-c3" # end of LWIP From a9c828011a2c392779431496564785fff42d09b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Smitka?= Date: Mon, 31 Jul 2023 12:22:27 +0200 Subject: [PATCH 1390/1712] Fix RGB/BGR color order --- ports/raspberrypi/boards/pajenicko_picopad/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/pajenicko_picopad/board.c b/ports/raspberrypi/boards/pajenicko_picopad/board.c index 0d092a1f4d..e81525d0d8 100644 --- a/ports/raspberrypi/boards/pajenicko_picopad/board.c +++ b/ports/raspberrypi/boards/pajenicko_picopad/board.c @@ -39,7 +39,7 @@ displayio_fourwire_obj_t board_display_obj; uint8_t display_init_sequence[] = { 0x01, 0 | DELAY, 150, // SWRESET - 0x36, 1, 0x68, // MADCTL + 0x36, 1, 0x60, // MADCTL 0x35, 1, 0x00, // TEON 0xB2, 5, 0x0c, 0x0c, 0x00, 0x33, 0x33, // FRMCTR2 0x3A, 1, 0x05, // COLMOD From e8307a4c02750922d7864147555c85e3fc17a27f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 31 Jul 2023 10:21:53 -0500 Subject: [PATCH 1391/1712] enable-if-any/all deserve some commentary. --- py/circuitpy_mpconfig.mk | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 47025d564c..522d14af99 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -26,17 +26,18 @@ # Boards default to all modules enabled (with exceptions) # Manually disable by overriding in #mpconfigboard.mk +# These Makefile variables are used to implement the "any" and "all" functions. +# Make's "sort" will transform a mixed sequence of 0s and 1s to "0 1" (because +# it also eliminates duplicates), or a non-mixed sequence of "0" or "1" to just +# itself. Thus, if all the inputs are 1 then the first word will be 1; if any +# of the inputs are 1, then the last word will be 1. enable-if-any=$(lastword $(sort $(1) 0)) enable-if-all=$(firstword $(sort $(1) 1)) -#$(info enable-if-any 0 1 -> $(call enable-if-any,0 1)) -#$(info enable-if-any 1 0 -> $(call enable-if-any,1 0)) -#$(info enable-if-any 1 1 -> $(call enable-if-any,1 1)) -#$(info enable-if-any 0 0 -> $(call enable-if-any,0 0)) -#$(info enable-if-all 0 1 -> $(call enable-if-all,0 1)) -#$(info enable-if-all 1 0 -> $(call enable-if-all,1 0)) -#$(info enable-if-all 1 1 -> $(call enable-if-all,1 1)) -#$(info enable-if-all 0 0 -> $(call enable-if-all,0 0)) +# To use any/all, you "$(call)" it, with the values to test after a comma. +# Usually the values are other $(CIRCUITPY_foo) variables. The definition +# of CIRCUITPY_AUDIOCORE and CIRCUITPY_AUDIOMP3 below are typical of how +# any/all are expected to be used. # Always on. Present here to help generate documentation module support matrix for "builtins". CIRCUITPY = 1 From f3c4a981c31a307a3b21cc17ab2c1daf4ffad605 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 31 Jul 2023 10:22:54 -0500 Subject: [PATCH 1392/1712] be explicit about the prefix we expect to remove from frozen_path --- docs/shared_bindings_matrix.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 75f5e37337..ec23d4af7f 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -251,7 +251,8 @@ def frozen_modules_from_dirs(frozen_mpy_dirs, withurl): """ frozen_modules = [] for frozen_path in filter(lambda x: x, frozen_mpy_dirs.split(" ")): - source_dir = get_circuitpython_root_dir() / frozen_path[6:] + frozen_path = frozen_path.removeprefix('../../') + source_dir = get_circuitpython_root_dir() / frozen_path url_repository = get_repository_url(source_dir) for sub in source_dir.glob("*"): if sub.name in FROZEN_EXCLUDES: From 2e040b0d13ff5b185e9845ae9a9b908a422b938a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 31 Jul 2023 10:41:10 -0500 Subject: [PATCH 1393/1712] make starting with an unexpected prefix an exception --- docs/shared_bindings_matrix.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index ec23d4af7f..27c48fb293 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -239,6 +239,10 @@ def get_repository_url(directory): repository_urls[directory] = path return path +def remove_prefix(s, prefix): + if not s.startswith(prefix): + raise ValueError(f"{s=} does not start with {prefix=}") + return s.removeprefix(prefix) def frozen_modules_from_dirs(frozen_mpy_dirs, withurl): """ @@ -251,7 +255,7 @@ def frozen_modules_from_dirs(frozen_mpy_dirs, withurl): """ frozen_modules = [] for frozen_path in filter(lambda x: x, frozen_mpy_dirs.split(" ")): - frozen_path = frozen_path.removeprefix('../../') + frozen_path = remove_prefix(frozen_path, '../../') source_dir = get_circuitpython_root_dir() / frozen_path url_repository = get_repository_url(source_dir) for sub in source_dir.glob("*"): From cd181eb5b4801ca7bbf736df295c34e7f59db294 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 31 Jul 2023 10:44:06 -0500 Subject: [PATCH 1394/1712] expand on the 0/1 requirement --- py/circuitpy_mpconfig.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 522d14af99..d313746e13 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -27,6 +27,9 @@ # Manually disable by overriding in #mpconfigboard.mk # These Makefile variables are used to implement the "any" and "all" functions. +# Note that these only work when the arguments expand to "0" and/or "1" but not +# if they expand to other values like "yes", "/bin/sh", or "false". +# # Make's "sort" will transform a mixed sequence of 0s and 1s to "0 1" (because # it also eliminates duplicates), or a non-mixed sequence of "0" or "1" to just # itself. Thus, if all the inputs are 1 then the first word will be 1; if any From 539f34f7fdd170af92c7b17875da299299e04dc4 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 1 Aug 2023 13:16:38 -0700 Subject: [PATCH 1395/1712] Three small changes 1. Raise an exception when creating a USB device when host isn't initialized. 2. Mark RP2040 dtcm_bss as NOLOAD since it doesn't need to be loaded (just zeroed.) 3. Fix submodule location for ulab to Jeff's copy. --- .gitmodules | 2 +- locale/circuitpython.pot | 4 ++++ ports/raspberrypi/link.ld | 2 +- shared-module/usb/core/Device.c | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 5c29c41b9f..dcd9415759 100644 --- a/.gitmodules +++ b/.gitmodules @@ -106,7 +106,7 @@ url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git [submodule "extmod/ulab"] path = extmod/ulab - url = https://github.com/v923z/micropython-ulab + url = https://github.com/jepler/micropython-ulab [submodule "frozen/Adafruit_CircuitPython_ESP32SPI"] path = frozen/Adafruit_CircuitPython_ESP32SPI url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f32d14c409..8c32760ab5 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -1536,6 +1536,10 @@ msgstr "" msgid "No timer available" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" diff --git a/ports/raspberrypi/link.ld b/ports/raspberrypi/link.ld index 0e584c94ac..0e0e7a3c5c 100644 --- a/ports/raspberrypi/link.ld +++ b/ports/raspberrypi/link.ld @@ -211,7 +211,7 @@ SECTIONS _ld_dtcm_data_flash_copy = LOADADDR(.dtcm_data); _ld_dtcm_data_size = SIZEOF(.dtcm_data); - .dtcm_bss : + .dtcm_bss (NOLOAD) : { . = ALIGN(4); diff --git a/shared-module/usb/core/Device.c b/shared-module/usb/core/Device.c index faed49e383..b8c4e4fcd1 100644 --- a/shared-module/usb/core/Device.c +++ b/shared-module/usb/core/Device.c @@ -51,6 +51,10 @@ void tuh_umount_cb(uint8_t dev_addr) { STATIC xfer_result_t _xfer_result; STATIC size_t _actual_len; bool common_hal_usb_core_device_construct(usb_core_device_obj_t *self, uint8_t device_number) { + if (!tuh_inited()) { + mp_raise_RuntimeError(translate("No usb host port initialized")); + } + if (device_number == 0 || device_number > CFG_TUH_DEVICE_MAX + CFG_TUH_HUB) { return false; } From 2b0f1cd087bc75f3ee9472e8c1575063ddb28c86 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 2 Aug 2023 07:52:45 -0500 Subject: [PATCH 1396/1712] espressif: fix dependencies in esp-idf modules while developing esp-camera I had the problem that firmware.elf was not regenerated if the only file I edited was in the esp32-camera submodule. By telling make that $(IDF_CMAKE_TARGETS), the list of .a fliles produced by ninja-building esp-idf, depend on esp-idf-stamp and that firmware.elf in turn depends on these files, the ninja build is re-run on each make, which is reasonably quick if nothing needs to be rebuilt. --- ports/espressif/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 151c31c373..b1bfa4f8c7 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -446,11 +446,13 @@ else all: $(BUILD)/firmware.bin endif +$(IDF_CMAKE_TARGETS): esp-idf-stamp + .PHONY: esp-idf-stamp esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h $(Q)ninja -C $(BUILD)/esp-idf $(IDF_CMAKE_TARGETS) -$(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp +$(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp $(IDF_CMAKE_TARGETS) $(STEPECHO) "LINK $@" $(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) $(BUILD)/esp-idf/esp-idf/newlib/libnewlib.a -Wl,--end-group -u newlib_include_pthread_impl -u ld_include_highint_hdl -Wl,--start-group $(LIBS) -Wl,--end-group $(BUILD)/esp-idf/esp-idf/pthread/libpthread.a -u __cxx_fatal_exception From 4e01e6bbe513f99ffa22ec1de37a1eb18a34ce05 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 2 Aug 2023 08:09:13 -0500 Subject: [PATCH 1397/1712] adafruit-esp32s3-camera: set up backlight at boot & add solarize the backlight situation will be revisited with the next board prototype, but it's good to prove this can be done. Depends on https://github.com/adafruit/esp32-camera/pull/6 which should be merged before this. --- .../boards/adafruit_esp32s3_camera/board.c | 64 +++++++++++++++++++ ports/espressif/esp32-camera | 2 +- 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/board.c b/ports/espressif/boards/adafruit_esp32s3_camera/board.c index 0ec1046901..65042bcea5 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/board.c +++ b/ports/espressif/boards/adafruit_esp32s3_camera/board.c @@ -35,6 +35,8 @@ #include "shared-bindings/board/__init__.h" #include "esp_log.h" +#include "esp_err.h" +#include "driver/i2c.h" displayio_fourwire_obj_t board_display_obj; @@ -50,7 +52,69 @@ uint8_t display_init_sequence[] = { 0x29, 0 | DELAY, 5, // _DISPON }; +#define I2C_MASTER_SCL_IO 34 +#define I2C_MASTER_SDA_IO 33 +#define I2C_MASTER_NUM 0 +#define I2C_MASTER_FREQ_HZ 400000 +#define I2C_MASTER_TX_BUF_DISABLE 0 +#define I2C_MASTER_RX_BUF_DISABLE 0 +#define I2C_MASTER_TIMEOUT_MS 1000 +#define I2C_WAIT 40 // Timing (in microseconds) for I2C + +#define AW9523_ADDR (0x5B) +#define AW9523_REG_SOFTRESET (0x7f) +#define AW9523_REG_OUTPUT0 (0x02) +#define AW9523_REG_CONFIG0 (0x04) +#define AW9523_DEFAULT_OUTPUT (0) +#define AW9523_DEFAULT_CONFIG (0x2) + + +static void io_expander_backlight_init(void) { + int i2c_num = I2C_MASTER_NUM; + i2c_config_t conf = { + .mode = I2C_MODE_MASTER, + .sda_io_num = I2C_MASTER_SDA_IO, + .scl_io_num = I2C_MASTER_SCL_IO, + .sda_pullup_en = GPIO_PULLUP_ENABLE, + .scl_pullup_en = GPIO_PULLUP_ENABLE, + .master.clk_speed = I2C_MASTER_FREQ_HZ, + }; + i2c_param_config(i2c_num, &conf); + i2c_driver_install(i2c_num, conf.mode, I2C_MASTER_RX_BUF_DISABLE, I2C_MASTER_TX_BUF_DISABLE, 0); + i2c_cmd_handle_t cmd = i2c_cmd_link_create(); + i2c_master_start(cmd); + i2c_master_write_byte(cmd, AW9523_ADDR << 1 | I2C_MASTER_WRITE, true); + i2c_master_write_byte(cmd, AW9523_REG_SOFTRESET, true); + i2c_master_write_byte(cmd, 0, true); + i2c_master_stop(cmd); + i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_RATE_MS); + i2c_cmd_link_delete(cmd); + + cmd = i2c_cmd_link_create(); + i2c_master_start(cmd); + i2c_master_write_byte(cmd, AW9523_ADDR << 1 | I2C_MASTER_WRITE, true); + i2c_master_write_byte(cmd, AW9523_REG_CONFIG0, true); + i2c_master_write_byte(cmd, AW9523_DEFAULT_CONFIG >> 8, true); + i2c_master_write_byte(cmd, AW9523_DEFAULT_CONFIG & 0xff, true); + i2c_master_stop(cmd); + i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_RATE_MS); + i2c_cmd_link_delete(cmd); + + cmd = i2c_cmd_link_create(); + i2c_master_start(cmd); + i2c_master_write_byte(cmd, AW9523_ADDR << 1 | I2C_MASTER_WRITE, true); + i2c_master_write_byte(cmd, AW9523_REG_OUTPUT0, true); + i2c_master_write_byte(cmd, AW9523_DEFAULT_OUTPUT >> 8, true); + i2c_master_write_byte(cmd, AW9523_DEFAULT_OUTPUT & 0xff, true); + i2c_master_stop(cmd); + i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_RATE_MS); + i2c_cmd_link_delete(cmd); + + i2c_driver_delete(i2c_num); +} + void board_init(void) { + io_expander_backlight_init(); busio_spi_obj_t *spi = common_hal_board_create_spi(0); displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; bus->base.type = &displayio_fourwire_type; diff --git a/ports/espressif/esp32-camera b/ports/espressif/esp32-camera index 2cd2a6d69f..2758089a06 160000 --- a/ports/espressif/esp32-camera +++ b/ports/espressif/esp32-camera @@ -1 +1 @@ -Subproject commit 2cd2a6d69faaba9ebb6105814a50039d82e2f899 +Subproject commit 2758089a06ccae79d8fcab6c93e2ca3761646f9f From 94ed725fd30d5f878e2dda27510b97d605944154 Mon Sep 17 00:00:00 2001 From: Jeremy Littler <87398149+BrainBoardz@users.noreply.github.com> Date: Wed, 2 Aug 2023 10:24:58 -0400 Subject: [PATCH 1398/1712] Update mpconfigboard.h --- ports/espressif/boards/brainboardz_neuron/mpconfigboard.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h index 72cda83c9b..760041ddf4 100755 --- a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h +++ b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h @@ -35,6 +35,6 @@ #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) -#define DEFAULT_SPI_BUS_SCK (&pin_GPIO14) -#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO15) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO13) +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO40) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO41) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO39) From 1325e5e2b95ab9fb70444cc7fe7f264b7c083b3d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 2 Aug 2023 09:24:14 -0500 Subject: [PATCH 1399/1712] Add index.html as a redirect to README.html closes #8246 --- docs/redirects.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/redirects.txt b/docs/redirects.txt index b8282635ab..47ec20d577 100644 --- a/docs/redirects.txt +++ b/docs/redirects.txt @@ -1,3 +1,4 @@ +index.rst README.html shared-bindings//__init__.rst shared-bindings// shared-bindings/_bleio/Adapter.rst shared-bindings/_bleio/#_bleio.Adapter shared-bindings/_bleio/Address.rst shared-bindings/_bleio/#_bleio.Address From 37dbe3e24a841bc3a5969944171a0f37fd8823a8 Mon Sep 17 00:00:00 2001 From: Jeremy Littler <87398149+BrainBoardz@users.noreply.github.com> Date: Wed, 2 Aug 2023 10:32:40 -0400 Subject: [PATCH 1400/1712] Update pins.c --- .../boards/brainboardz_neuron/pins.c | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ports/espressif/boards/brainboardz_neuron/pins.c b/ports/espressif/boards/brainboardz_neuron/pins.c index 5c198c20a7..9b16f410ba 100755 --- a/ports/espressif/boards/brainboardz_neuron/pins.c +++ b/ports/espressif/boards/brainboardz_neuron/pins.c @@ -23,36 +23,33 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, - { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, - { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO21) }, - + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, - { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, - { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, - { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, - { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO40) }, + + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO41) }, + + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, @@ -61,7 +58,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, From 5e8c38c8f9d915b8bc51b2acec9efc9a23821ff3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 2 Aug 2023 09:24:14 -0500 Subject: [PATCH 1401/1712] Add index.html as a redirect to README.html closes #8246 --- docs/redirects.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/redirects.txt b/docs/redirects.txt index b8282635ab..47ec20d577 100644 --- a/docs/redirects.txt +++ b/docs/redirects.txt @@ -1,3 +1,4 @@ +index.rst README.html shared-bindings//__init__.rst shared-bindings// shared-bindings/_bleio/Adapter.rst shared-bindings/_bleio/#_bleio.Adapter shared-bindings/_bleio/Address.rst shared-bindings/_bleio/#_bleio.Address From b88e359b00e22d69fd2b83eea451c32e47fdeeaa Mon Sep 17 00:00:00 2001 From: Jeremy Littler <87398149+BrainBoardz@users.noreply.github.com> Date: Wed, 2 Aug 2023 10:41:46 -0400 Subject: [PATCH 1402/1712] Update pins.c --- ports/espressif/boards/brainboardz_neuron/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/brainboardz_neuron/pins.c b/ports/espressif/boards/brainboardz_neuron/pins.c index 9b16f410ba..e079854470 100755 --- a/ports/espressif/boards/brainboardz_neuron/pins.c +++ b/ports/espressif/boards/brainboardz_neuron/pins.c @@ -49,7 +49,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO42) }, - + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, From f9b98ce54d01e389c14db6cb56c3d142d75d4b6a Mon Sep 17 00:00:00 2001 From: Jeremy Littler <87398149+BrainBoardz@users.noreply.github.com> Date: Wed, 2 Aug 2023 10:57:46 -0400 Subject: [PATCH 1403/1712] Update pins.c --- ports/espressif/boards/brainboardz_neuron/pins.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/espressif/boards/brainboardz_neuron/pins.c b/ports/espressif/boards/brainboardz_neuron/pins.c index e079854470..6f564f1347 100755 --- a/ports/espressif/boards/brainboardz_neuron/pins.c +++ b/ports/espressif/boards/brainboardz_neuron/pins.c @@ -31,8 +31,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, - { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, - + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, From f7cc20e9369b92adaa16cb9b8c08b97593a8bd52 Mon Sep 17 00:00:00 2001 From: Jeremy Littler <87398149+BrainBoardz@users.noreply.github.com> Date: Wed, 2 Aug 2023 11:01:44 -0400 Subject: [PATCH 1404/1712] Update pins.c --- ports/espressif/boards/brainboardz_neuron/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/brainboardz_neuron/pins.c b/ports/espressif/boards/brainboardz_neuron/pins.c index 6f564f1347..62b95421f8 100755 --- a/ports/espressif/boards/brainboardz_neuron/pins.c +++ b/ports/espressif/boards/brainboardz_neuron/pins.c @@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, - { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, From 16937b8a0dcddd07c6dc2292924fb066495d72a2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 2 Aug 2023 10:54:47 -0500 Subject: [PATCH 1405/1712] Fix markup of bitmaptools.blit stubs this prevented bitmaptools.blit from properly appearing in documentation. --- shared-bindings/bitmaptools/__init__.c | 60 +++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index 5139a55645..2eb966ef8d 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -949,37 +949,37 @@ STATIC mp_obj_t bitmaptools_obj_draw_circle(size_t n_args, const mp_obj_t *pos_a MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_draw_circle_obj, 0, bitmaptools_obj_draw_circle); -//| def blit( -//| dest_bitmap: displayio.Bitmap, -//| source_bitmap: displayio.Bitmap, -//| x: int, -//| y: int, -//| *, -//| x1: int, -//| y1: int, -//| x2: int, -//| y2: int, -//| skip_source_index: int, -//| skip_dest_index: int -//| ) -> None: -//| """Inserts the source_bitmap region defined by rectangular boundaries -//| (x1,y1) and (x2,y2) into the bitmap at the specified (x,y) location. +//| def blit( +//| dest_bitmap: displayio.Bitmap, +//| source_bitmap: displayio.Bitmap, +//| x: int, +//| y: int, +//| *, +//| x1: int, +//| y1: int, +//| x2: int, +//| y2: int, +//| skip_source_index: int, +//| skip_dest_index: int +//| ) -> None: +//| """Inserts the source_bitmap region defined by rectangular boundaries +//| (x1,y1) and (x2,y2) into the bitmap at the specified (x,y) location. //| -//| :param bitmap dest_bitmap: Destination bitmap that the area will be copied into. -//| :param bitmap source_bitmap: Source bitmap that contains the graphical region to be copied -//| :param int x: Horizontal pixel location in bitmap where source_bitmap upper-left -//| corner will be placed -//| :param int y: Vertical pixel location in bitmap where source_bitmap upper-left -//| corner will be placed -//| :param int x1: Minimum x-value for rectangular bounding box to be copied from the source bitmap -//| :param int y1: Minimum y-value for rectangular bounding box to be copied from the source bitmap -//| :param int x2: Maximum x-value (exclusive) for rectangular bounding box to be copied from the source bitmap -//| :param int y2: Maximum y-value (exclusive) for rectangular bounding box to be copied from the source bitmap -//| :param int skip_source_index: bitmap palette index in the source that will not be copied, -//| set to None to copy all pixels -//| :param int skip_dest_index: bitmap palette index in the destination bitmap that will not get overwritten -//| by the pixels from the source""" -//| ... +//| :param bitmap dest_bitmap: Destination bitmap that the area will be copied into. +//| :param bitmap source_bitmap: Source bitmap that contains the graphical region to be copied +//| :param int x: Horizontal pixel location in bitmap where source_bitmap upper-left +//| corner will be placed +//| :param int y: Vertical pixel location in bitmap where source_bitmap upper-left +//| corner will be placed +//| :param int x1: Minimum x-value for rectangular bounding box to be copied from the source bitmap +//| :param int y1: Minimum y-value for rectangular bounding box to be copied from the source bitmap +//| :param int x2: Maximum x-value (exclusive) for rectangular bounding box to be copied from the source bitmap +//| :param int y2: Maximum y-value (exclusive) for rectangular bounding box to be copied from the source bitmap +//| :param int skip_source_index: bitmap palette index in the source that will not be copied, +//| set to None to copy all pixels +//| :param int skip_dest_index: bitmap palette index in the destination bitmap that will not get overwritten +//| by the pixels from the source""" +//| ... //| STATIC mp_obj_t bitmaptools_obj_blit(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum {ARG_destination, ARG_source, ARG_x, ARG_y, ARG_x1, ARG_y1, ARG_x2, ARG_y2, ARG_skip_source_index, ARG_skip_dest_index}; From af0245ab24314f41919bd0e91c8f8ab2bf6294e7 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 2 Aug 2023 11:11:30 -0700 Subject: [PATCH 1406/1712] Revert .gitmodules --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index dcd9415759..5c29c41b9f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -106,7 +106,7 @@ url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git [submodule "extmod/ulab"] path = extmod/ulab - url = https://github.com/jepler/micropython-ulab + url = https://github.com/v923z/micropython-ulab [submodule "frozen/Adafruit_CircuitPython_ESP32SPI"] path = frozen/Adafruit_CircuitPython_ESP32SPI url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI From 40e833c74667b400de9a81f1e31c4e83ecbbfeed Mon Sep 17 00:00:00 2001 From: elpekenin Date: Wed, 2 Aug 2023 20:13:52 +0200 Subject: [PATCH 1407/1712] [Fix] Wrong fix of cache use for STM32 --- ports/stm/supervisor/internal_flash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/stm/supervisor/internal_flash.c b/ports/stm/supervisor/internal_flash.c index c7b792616c..3bbc50ae74 100644 --- a/ports/stm/supervisor/internal_flash.c +++ b/ports/stm/supervisor/internal_flash.c @@ -302,9 +302,9 @@ mp_uint_t supervisor_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t n uint32_t sector_start_addr; flash_get_sector_info(src, §or_start_addr, §or_size); // Count how many blocks are left in the sector - uint32_t count = (sector_size - (src - sector_start_addr)) / FILESYSTEM_BLOCK_SIZE; + uint32_t blocks_left_in_sector = (sector_size - (src - sector_start_addr)) / FILESYSTEM_BLOCK_SIZE; - if (count <= num_blocks && _cache_flash_addr == sector_start_addr) { + if (num_blocks <= blocks_left_in_sector && _cache_flash_addr == sector_start_addr) { // Read is contained in the cache, so just read cache memcpy(dest, (_flash_cache + (src - sector_start_addr)), FILESYSTEM_BLOCK_SIZE * num_blocks); } else { From 59e6cab252214496cdb32473b571a1887256ed9b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 2 Aug 2023 11:03:43 -0700 Subject: [PATCH 1408/1712] Cache configuration descriptor We use it to open endpoints as they are used. Fetching the descriptor as needed can cause issues with devices that we're expecting a control packet while another transaction was ongoing. Specifically, a usb thumb drive didn't expect a control transaction while doing a SCSI transaction. This PR also aborts transactions on timeout or ctrl-c interrupt. It doesn't always recover though... --- locale/circuitpython.pot | 4 ++++ shared-bindings/usb/core/Device.c | 4 ++-- shared-module/usb/core/Device.c | 40 +++++++++++++++++++------------ shared-module/usb/core/Device.h | 3 ++- 4 files changed, 33 insertions(+), 18 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f32d14c409..b4469dcce8 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -1473,6 +1473,10 @@ msgstr "" msgid "No capture in progress" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "" diff --git a/shared-bindings/usb/core/Device.c b/shared-bindings/usb/core/Device.c index d5525431a3..7af131cde7 100644 --- a/shared-bindings/usb/core/Device.c +++ b/shared-bindings/usb/core/Device.c @@ -123,7 +123,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(usb_core_device_get_manufacturer_obj, usb_core_device_ MP_PROPERTY_GETTER(usb_core_device_manufacturer_obj, (mp_obj_t)&usb_core_device_get_manufacturer_obj); -//| def set_configuration(self, configuration=None): +//| def set_configuration(self, configuration=1): //| """Set the active configuration. //| //| The configuration parameter is the bConfigurationValue field of the @@ -136,7 +136,7 @@ MP_PROPERTY_GETTER(usb_core_device_manufacturer_obj, STATIC mp_obj_t usb_core_device_set_configuration(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_configuration }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_configuration, MP_ARG_INT, {.u_int = 0x100} }, + { MP_QSTR_configuration, MP_ARG_INT, {.u_int = 1} }, }; usb_core_device_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; diff --git a/shared-module/usb/core/Device.c b/shared-module/usb/core/Device.c index faed49e383..cc6de011dc 100644 --- a/shared-module/usb/core/Device.c +++ b/shared-module/usb/core/Device.c @@ -132,13 +132,23 @@ mp_obj_t common_hal_usb_core_device_get_manufacturer(usb_core_device_obj_t *self } void common_hal_usb_core_device_set_configuration(usb_core_device_obj_t *self, mp_int_t configuration) { - if (configuration == 0x100) { - tusb_desc_configuration_t desc; - if (!tuh_descriptor_get_configuration(self->device_number, 0, &desc, sizeof(desc), _transfer_done_cb, 0) || - !_wait_for_callback()) { - return; - } - configuration = desc.bConfigurationValue; + // We assume that the config index is one less than the value. + uint8_t config_index = configuration - 1; + // Get the configuration descriptor and cache it. We'll use it later to open + // endpoints. + + // Get only the config descriptor first. + tusb_desc_configuration_t desc; + if (!tuh_descriptor_get_configuration(self->device_number, config_index, &desc, sizeof(desc), _transfer_done_cb, 0) || + !_wait_for_callback()) { + return; + } + + // Get the config descriptor plus interfaces and endpoints. + self->configuration_descriptor = m_realloc(self->configuration_descriptor, desc.wTotalLength); + if (!tuh_descriptor_get_configuration(self->device_number, config_index, self->configuration_descriptor, desc.wTotalLength, _transfer_done_cb, 0) || + !_wait_for_callback()) { + return; } tuh_configuration_set(self->device_number, configuration, _transfer_done_cb, 0); _wait_for_callback(); @@ -159,6 +169,7 @@ STATIC size_t _xfer(tuh_xfer_t *xfer, mp_int_t timeout) { RUN_BACKGROUND_TASKS; } if (mp_hal_is_interrupted()) { + tuh_edpt_abort_xfer(xfer->daddr, xfer->ep_addr); return 0; } xfer_result_t result = _xfer_result; @@ -167,6 +178,7 @@ STATIC size_t _xfer(tuh_xfer_t *xfer, mp_int_t timeout) { mp_raise_usb_core_USBError(translate("Pipe error")); } if (result == 0xff) { + tuh_edpt_abort_xfer(xfer->daddr, xfer->ep_addr); mp_raise_usb_core_USBTimeoutError(); } if (result == XFER_RESULT_SUCCESS) { @@ -191,17 +203,13 @@ STATIC bool _open_endpoint(usb_core_device_obj_t *self, mp_int_t endpoint) { return true; } - // Fetch the full configuration descriptor and search for the endpoint's descriptor. - uint8_t desc_buf[128]; - if (!tuh_descriptor_get_configuration(self->device_number, self->configuration_index, &desc_buf, sizeof(desc_buf), _transfer_done_cb, 0) || - !_wait_for_callback()) { - return false; + if (self->configuration_descriptor == NULL) { + mp_raise_usb_core_USBError(translate("No configuration set")); } - tusb_desc_configuration_t *desc_cfg = (tusb_desc_configuration_t *)desc_buf; + + tusb_desc_configuration_t *desc_cfg = (tusb_desc_configuration_t *)self->configuration_descriptor; uint32_t total_length = tu_le16toh(desc_cfg->wTotalLength); - // Cap to the buffer size we requested. - total_length = MIN(total_length, sizeof(desc_buf)); uint8_t const *desc_end = ((uint8_t const *)desc_cfg) + total_length; uint8_t const *p_desc = tu_desc_next(desc_cfg); @@ -287,6 +295,7 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self, RUN_BACKGROUND_TASKS; } if (mp_hal_is_interrupted()) { + tuh_edpt_abort_xfer(xfer.daddr, xfer.ep_addr); return 0; } xfer_result_t result = _xfer_result; @@ -295,6 +304,7 @@ mp_int_t common_hal_usb_core_device_ctrl_transfer(usb_core_device_obj_t *self, mp_raise_usb_core_USBError(translate("Pipe error")); } if (result == 0xff) { + tuh_edpt_abort_xfer(xfer.daddr, xfer.ep_addr); mp_raise_usb_core_USBTimeoutError(); } if (result == XFER_RESULT_SUCCESS) { diff --git a/shared-module/usb/core/Device.h b/shared-module/usb/core/Device.h index bb32cb5766..b68a015f7a 100644 --- a/shared-module/usb/core/Device.h +++ b/shared-module/usb/core/Device.h @@ -32,7 +32,8 @@ typedef struct { mp_obj_base_t base; uint8_t device_number; - uint8_t configuration_index; // not number + uint8_t configuration_index; // not bConfigurationValue + uint8_t *configuration_descriptor; // Contains the length of the all descriptors. uint8_t open_endpoints[8]; } usb_core_device_obj_t; From 2e3b30a749aea275f8d4f99e7d58d3e93c7179c1 Mon Sep 17 00:00:00 2001 From: hexthat Date: Tue, 1 Aug 2023 22:00:58 +0000 Subject: [PATCH 1409/1712] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (996 of 996 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 32527b4e8b..f041b2e9d2 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-07-21 00:10+0000\n" +"PO-Revision-Date: 2023-08-02 22:07+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -1793,7 +1793,7 @@ msgstr "yǐn jiǎo bì xū gòng xiǎng PWM qiē piàn" #: shared-module/usb/core/Device.c msgid "Pipe error" -msgstr "" +msgstr "guǎndào cuòwù" #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" @@ -2104,7 +2104,7 @@ msgstr "Chōuyàng zhōng de píndào tài duō." #: shared-module/displayio/__init__.c msgid "Too many display busses; forgot displayio.release_displays() ?" -msgstr "" +msgstr "Xiǎnshì zǒngxiàn guòduō;wàngjì displayio.release_displays() ?" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -2828,7 +2828,7 @@ msgstr "wúfǎ chuàngjiàn shílì" #: extmod/ulab/code/ndarray.c msgid "cannot delete array elements" -msgstr "" +msgstr "wúfǎ shānchú shùzǔ yuánsù" #: py/runtime.c msgid "cannot import name %q" @@ -3296,11 +3296,11 @@ msgstr "nèi lián jíhé bìxū shì yīgè hánshù" #: extmod/ulab/code/numpy/vector.c msgid "input and output dimensions differ" -msgstr "" +msgstr "shūrù hé shūchū chǐcùn bùtóng" #: extmod/ulab/code/numpy/vector.c msgid "input and output shapes differ" -msgstr "" +msgstr "shūrù hé shūchū xíngzhuàng bùtóng" #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" @@ -3633,7 +3633,7 @@ msgstr "yuán chǎn" #: extmod/ulab/code/ndarray.c msgid "ndarray length overflows" -msgstr "" +msgstr "ndarray chángdù yìchū" #: py/runtime.c #, c-format @@ -3735,7 +3735,7 @@ msgstr "wèi zhēn duì fù zá de dtype shí xiàn" #: extmod/ulab/code/numpy/bitwise.c msgid "not supported for input types" -msgstr "" +msgstr "bù zhīchí shūrù lèixíng" #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" @@ -3887,11 +3887,11 @@ msgstr "chū zhèn liè tài xiǎo" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for complex dtype" -msgstr "" +msgstr "fùzá de dtype bù zhīchí out guānjiànzì" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for function" -msgstr "" +msgstr "hánshù bù zhīchí out guānjiànzì" #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" @@ -3899,11 +3899,11 @@ msgstr "chū bì xū shì yí gè fú dòng mì jí zhèn liè" #: extmod/ulab/code/numpy/vector.c msgid "out must be an ndarray" -msgstr "" +msgstr "shūchū bìxū shì ndarray" #: extmod/ulab/code/numpy/vector.c msgid "out must be of float dtype" -msgstr "" +msgstr "out bìxū shì fúdiǎn xíng dtype" #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" From aa638f8054c3fd30881cedfaa0ddddc3b71a3a7f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 3 Aug 2023 07:10:08 -0500 Subject: [PATCH 1410/1712] update ulab to fix fpclassify compiler diagnostic --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index 3728d22732..84f99f17fc 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 3728d22732dedc8a591b7df18a16d3ef1aed6a39 +Subproject commit 84f99f17fc02b03c13f99485d9cf68bc9d17c600 From 1fe70ba8a961a813814ed98430feafe66cd65bd0 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 3 Aug 2023 07:50:33 -0500 Subject: [PATCH 1411/1712] update messages --- locale/circuitpython.pot | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f32d14c409..c3f935348e 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -3259,6 +3259,10 @@ msgstr "" msgid "input dtype must be float or complex" msgstr "" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "" @@ -3304,10 +3308,6 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" From 9304d7ac8ec8f02fb88bf89f35c2c8c5efb110b5 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 3 Aug 2023 15:29:05 +0200 Subject: [PATCH 1412/1712] 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 | 11 +++++++---- locale/el.po | 8 ++++---- locale/en_GB.po | 11 +++++++---- locale/es.po | 11 +++++++---- 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 | 11 +++++++---- locale/pl.po | 8 ++++---- locale/pt_BR.po | 15 +++++++++------ locale/ru.po | 8 ++++---- locale/sv.po | 11 +++++++---- locale/tr.po | 8 ++++---- locale/zh_Latn_pinyin.po | 11 +++++++---- 19 files changed, 102 insertions(+), 78 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 302186b549..795848785a 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -3287,6 +3287,10 @@ msgstr "" msgid "input dtype must be float or complex" msgstr "" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "" @@ -3332,10 +3336,6 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 2a23f16976..c9c6b2bd72 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -3274,6 +3274,10 @@ msgstr "" msgid "input dtype must be float or complex" msgstr "" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "" @@ -3319,10 +3323,6 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 349539049f..394ab6875f 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -3347,6 +3347,10 @@ msgstr "Eingabedaten müssen iterierbar sein" msgid "input dtype must be float or complex" msgstr "Eingabe dtype muss float oder complex sein" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "Eingabematrix ist asymmetrisch" @@ -3392,10 +3396,6 @@ msgstr "Die Eingabe muss Tupel, Liste, Bereich oder Ndarray sein" msgid "input vectors must be of equal length" msgstr "Eingabevektoren müssen gleich lang sein" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "Eingaben sind nicht iterierbar" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "interp ist für 1D-Iterables gleicher Länge definiert" @@ -4463,6 +4463,9 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "inputs are not iterable" +#~ msgstr "Eingaben sind nicht iterierbar" + #~ msgid "Too many display busses" #~ msgstr "Zu viele Anzeigebusse" diff --git a/locale/el.po b/locale/el.po index f9b61bdeae..a6fccf1ae7 100644 --- a/locale/el.po +++ b/locale/el.po @@ -3288,6 +3288,10 @@ msgstr "" msgid "input dtype must be float or complex" msgstr "" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "" @@ -3333,10 +3337,6 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index 0abf8ef25e..42ed734f7a 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -3302,6 +3302,10 @@ msgstr "input data must be an iterable" msgid "input dtype must be float or complex" msgstr "input dtype must be float or complex" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "input matrix is asymmetric" @@ -3347,10 +3351,6 @@ msgstr "input must be tuple, list, range, or ndarray" msgid "input vectors must be of equal length" msgstr "input vectors must be of equal length" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "inputs are not iterable" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "interp is defined for 1D iterables of equal length" @@ -4404,6 +4404,9 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "inputs are not iterable" +#~ msgstr "inputs are not iterable" + #~ msgid "Too many display busses" #~ msgstr "Too many display busses" diff --git a/locale/es.po b/locale/es.po index f76b3d6534..8a6a67e02c 100644 --- a/locale/es.po +++ b/locale/es.po @@ -3350,6 +3350,10 @@ msgstr "los datos de entrada deben ser iterables" msgid "input dtype must be float or complex" msgstr "dtype de entrada debe ser float o complex" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "la matriz de entrada es asimétrica" @@ -3395,10 +3399,6 @@ msgstr "la entrada debe ser una tupla, lista, rango o ndarray" msgid "input vectors must be of equal length" msgstr "los vectores de entrada deben ser de igual tamaño" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "Entradas no son iterables" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "interp está definido para iterables 1D de igual tamaño" @@ -4460,6 +4460,9 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "inputs are not iterable" +#~ msgstr "Entradas no son iterables" + #~ msgid "Too many display busses" #~ msgstr "Demasiados buses de pantalla" diff --git a/locale/fil.po b/locale/fil.po index 1d7373f63e..15b2f87c02 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -3289,6 +3289,10 @@ msgstr "" msgid "input dtype must be float or complex" msgstr "" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "" @@ -3334,10 +3338,6 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index ffddbdf6f1..f99e183c0e 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -3368,6 +3368,10 @@ msgstr "les données d'entrée doivent être un itérable" msgid "input dtype must be float or complex" msgstr "le dtype d'entrée doit être un flottant ou un complexe" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "la matrice d'entrée est asymétrique" @@ -3413,10 +3417,6 @@ msgstr "l'entrée 'input' doit être tuple, list, range ou ndarray" msgid "input vectors must be of equal length" msgstr "les vecteurs d'entrée doivent être de longueur égale" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "les entrées ne sont pas itérables" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "interp n'est défini que pour les 1D itérables de taille identique" @@ -4482,6 +4482,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 "inputs are not iterable" +#~ msgstr "les entrées ne sont pas itérables" + #~ msgid "Too many display busses" #~ msgstr "Trop de bus d'affichage" diff --git a/locale/hi.po b/locale/hi.po index 18ed2bf5fc..a6bd1fc756 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -3259,6 +3259,10 @@ msgstr "" msgid "input dtype must be float or complex" msgstr "" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "" @@ -3304,10 +3308,6 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 4a0101fc47..3a82f92b53 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -3294,6 +3294,10 @@ msgstr "" msgid "input dtype must be float or complex" msgstr "" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "" @@ -3339,10 +3343,6 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index b3d7dd67b3..fe8a1440c4 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -3281,6 +3281,10 @@ msgstr "" msgid "input dtype must be float or complex" msgstr "" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "入力行列が非対称" @@ -3326,10 +3330,6 @@ msgstr "入力はtuple, list, range, ndarrayでなければなりません" msgid "input vectors must be of equal length" msgstr "" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 1946d9572f..a55f2a3588 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -3263,6 +3263,10 @@ msgstr "" msgid "input dtype must be float or complex" msgstr "" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "" @@ -3308,10 +3312,6 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index ea4d0698b4..4ece57854a 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -3290,6 +3290,10 @@ msgstr "invoerdata moet itereerbaar zijn" msgid "input dtype must be float or complex" msgstr "" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "invoermatrix is asymmetrisch" @@ -3335,10 +3339,6 @@ msgstr "invoer moet een tuple, lijst, bereik of ndarray zijn" msgid "input vectors must be of equal length" msgstr "invoervectors moeten van gelijke lengte zijn" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "invoer is niet itereerbaar" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" @@ -4395,6 +4395,9 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "inputs are not iterable" +#~ msgstr "invoer is niet itereerbaar" + #~ msgid "Too many display busses" #~ msgstr "Teveel beeldscherm bussen" diff --git a/locale/pl.po b/locale/pl.po index 5817ac80c7..1c6c1b16d5 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -3268,6 +3268,10 @@ msgstr "" msgid "input dtype must be float or complex" msgstr "" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "" @@ -3313,10 +3317,6 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "wektory wejściowe muszą być równej długości" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index ed7b6ae9c4..c3a7acdfd6 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -2123,8 +2123,8 @@ msgstr "Muitos canais na amostra." #: shared-module/displayio/__init__.c msgid "Too many display busses; forgot displayio.release_displays() ?" msgstr "" -"Excesso de barramentos de exibição; esqueceu do displayio.release_displays() " -"?" +"Excesso de barramentos de exibição; esqueceu do displayio." +"release_displays() ?" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -3350,6 +3350,10 @@ msgstr "os dados da entrada devem ser iteráveis" msgid "input dtype must be float or complex" msgstr "o tipo da entrada dtype deve ser flutuante ou complexo" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "a matriz da entrada é assimétrica" @@ -3395,10 +3399,6 @@ msgstr "A entrada deve ser tupla, lista, intervalo ou matriz" msgid "input vectors must be of equal length" msgstr "os vetores da entrada devem ter o mesmo comprimento" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "as entradas não são iteráveis" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "o interp é definido para iteráveis 1D com comprimento igual" @@ -4462,6 +4462,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 "inputs are not iterable" +#~ msgstr "as entradas não são iteráveis" + #~ msgid "Too many display busses" #~ msgstr "Muitos barramentos estão sendo exibidos" diff --git a/locale/ru.po b/locale/ru.po index 043d802835..8e354a4960 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -3322,6 +3322,10 @@ msgstr "" msgid "input dtype must be float or complex" msgstr "" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "" @@ -3367,10 +3371,6 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" diff --git a/locale/sv.po b/locale/sv.po index df519cab05..279c3fd9bc 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -3316,6 +3316,10 @@ msgstr "indata måste vara en iterable" msgid "input dtype must be float or complex" msgstr "indatatyp måste vara float eller complex" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "indatamatrisen är asymmetrisk" @@ -3361,10 +3365,6 @@ msgstr "indata måste vara tupel, lista, range, eller ndarray" msgid "input vectors must be of equal length" msgstr "indatavektorer måste ha samma längd" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "indata är inte iterbara" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "interp är definierad för 1D-iterabla med samma längd" @@ -4422,6 +4422,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 "inputs are not iterable" +#~ msgstr "indata är inte iterbara" + #~ msgid "Too many display busses" #~ msgstr "För många display-bussar" diff --git a/locale/tr.po b/locale/tr.po index a58eb36211..c741fce473 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -3281,6 +3281,10 @@ msgstr "" msgid "input dtype must be float or complex" msgstr "" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "" @@ -3326,10 +3330,6 @@ msgstr "" msgid "input vectors must be of equal length" msgstr "" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index f041b2e9d2..8171696471 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -3322,6 +3322,10 @@ msgstr "shūrù shùjù bìxū shì kě diédài de" msgid "input dtype must be float or complex" msgstr "shū rù dtype bì xū shì fú diǎn xíng huò fù shù" +#: extmod/ulab/code/numpy/poly.c +msgid "input is not iterable" +msgstr "" + #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" msgstr "shūrù jǔzhèn bù duìchèn" @@ -3367,10 +3371,6 @@ msgstr "shūrù bìxū shì yuán zǔ, lièbiǎo, fànwéi huò ndarray" msgid "input vectors must be of equal length" msgstr "shūrù xiàngliàng de chángdù bìxū xiāngděng" -#: extmod/ulab/code/numpy/poly.c -msgid "inputs are not iterable" -msgstr "shū rù bù kě yí dòng" - #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" msgstr "zhōng jiān wéi cháng dù xiāng děng de 1D kě yì jiāo qì dìng yì" @@ -4428,6 +4428,9 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "inputs are not iterable" +#~ msgstr "shū rù bù kě yí dòng" + #~ msgid "Too many display busses" #~ msgstr "Xiǎnshì zǒngxiàn tài duōle" From dbafba889dd36f09ba171dad8f9e7fb4d8be5f2b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 3 Aug 2023 08:55:56 -0500 Subject: [PATCH 1413/1712] include SRC_PATTERNS for ci_set_matrix Originally, all Makefile variables were implicitly included in settings[]. When I revised ci_set_matrix, only explicltly named variables are included. Depending on the set of changed files, ci_set_matrix needs the SRC_PATTERNS variable, so include it explicitly. Typical error, seen in the history of building this PR: ``` Traceback (most recent call last): File "/home/runner/work/circuitpython/circuitpython/tools/ci_set_matrix.py", line 309, in main() File "/home/runner/work/circuitpython/circuitpython/tools/ci_set_matrix.py", line 305, in main set_boards(run_all) File "/home/runner/work/circuitpython/circuitpython/tools/ci_set_matrix.py", line 215, in set_boards if module in settings["SRC_PATTERNS"]: ~~~~~~~~^^^^^^^^^^^^^^^^ KeyError: 'SRC_PATTERNS' Error: Process completed with exit code 1. ``` --- docs/shared_bindings_matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/shared_bindings_matrix.py b/docs/shared_bindings_matrix.py index 27c48fb293..92def05fbf 100644 --- a/docs/shared_bindings_matrix.py +++ b/docs/shared_bindings_matrix.py @@ -177,7 +177,7 @@ def get_settings_from_makefile(port_dir, board_name): in this script, something that has proved error-prone """ contents = subprocess.run( - ["make", "-C", port_dir, "-f", "Makefile", f"BOARD={board_name}", "print-CFLAGS", "print-CIRCUITPY_BUILD_EXTENSIONS", "print-FROZEN_MPY_DIRS"], + ["make", "-C", port_dir, "-f", "Makefile", f"BOARD={board_name}", "print-CFLAGS", "print-CIRCUITPY_BUILD_EXTENSIONS", "print-FROZEN_MPY_DIRS", "print-SRC_PATTERNS"], encoding="utf-8", errors="replace", stdout=subprocess.PIPE, From 67c5563eec5b34dd66d64685feedb058666fc0cb Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 3 Aug 2023 10:18:19 -0500 Subject: [PATCH 1414/1712] Apply -Wno-undef to just the needed file & remove incorrect -I arg --- ports/raspberrypi/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 9c7c8549ca..81af77706c 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -142,7 +142,6 @@ INC += \ -Isdk_config \ -I../../lib/tinyusb/src \ -I../../supervisor/shared/usb \ - -I../bindings/cyw43/__init__.h \ -I$(BUILD) # Pico specific configuration @@ -172,7 +171,7 @@ else endif # Remove -Wno-stringop-overflow after we can test with CI's GCC 10. Mac's looks weird. -DISABLE_WARNINGS = -Wno-stringop-overflow -Wno-cast-align -Wno-undef +DISABLE_WARNINGS = -Wno-stringop-overflow -Wno-cast-align CFLAGS += $(INC) -Wall -Werror -std=gnu11 -nostdlib -fshort-enums $(BASE_CFLAGS) $(CFLAGS_MOD) $(COPT) $(DISABLE_WARNINGS) -Werror=missing-prototypes @@ -237,6 +236,7 @@ SRC_SDK := \ SRC_SDK := $(addprefix sdk/, $(SRC_SDK)) $(patsubst %.c,$(BUILD)/%.o,$(SRC_SDK) $(SRC_CYW43)): CFLAGS += -Wno-missing-prototypes -Wno-undef -Wno-unused-function -Wno-nested-externs -Wno-strict-prototypes -Wno-double-promotion -Wno-sign-compare -Wno-unused-variable -Wno-strict-overflow -Ilib/cyw43-driver +$(BUILD)/sdk/src/rp2_common/pico_standard_link/crt0.o: CFLAGS += -Wno-undef SRC_C += \ boards/$(BOARD)/board.c \ From bcf0a56aaffb22377e226aa427b27edd66120ec5 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Thu, 3 Aug 2023 13:39:55 +0000 Subject: [PATCH 1415/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (996 of 996 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 279c3fd9bc..2f4914442a 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-07-30 11:47+0000\n" +"PO-Revision-Date: 2023-08-03 16:12+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -3318,7 +3318,7 @@ msgstr "indatatyp måste vara float eller complex" #: extmod/ulab/code/numpy/poly.c msgid "input is not iterable" -msgstr "" +msgstr "indata är inte itererbar" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" From 98d5d3af806419f0029f9f9460931d021fbb985e Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 3 Aug 2023 21:38:53 +0200 Subject: [PATCH 1416/1712] 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 | 4 ++++ locale/cs.po | 4 ++++ locale/de_DE.po | 4 ++++ locale/el.po | 4 ++++ locale/en_GB.po | 4 ++++ locale/es.po | 4 ++++ locale/fil.po | 4 ++++ locale/fr.po | 4 ++++ locale/hi.po | 4 ++++ locale/it_IT.po | 4 ++++ locale/ja.po | 4 ++++ locale/ko.po | 4 ++++ locale/nl.po | 4 ++++ locale/pl.po | 4 ++++ locale/pt_BR.po | 4 ++++ locale/ru.po | 4 ++++ locale/sv.po | 4 ++++ locale/tr.po | 4 ++++ locale/zh_Latn_pinyin.po | 4 ++++ 19 files changed, 76 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index 795848785a..ef97425b13 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -1548,6 +1548,10 @@ msgstr "Tidak ada file/direktori" msgid "No timer available" msgstr "Penghitung waktu tidak tersedia" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index c9c6b2bd72..ad6196b078 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -1548,6 +1548,10 @@ msgstr "Žádný takový soubor / adresář" msgid "No timer available" msgstr "Není k dispozici žádný časovač" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 394ab6875f..b09dfa93dd 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -1573,6 +1573,10 @@ msgstr "Keine solche Datei/Verzeichnis" msgid "No timer available" msgstr "Kein Timer verfügbar" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "Nordic System-Firmware kein Speicher verfügbar" diff --git a/locale/el.po b/locale/el.po index a6fccf1ae7..568a03aacd 100644 --- a/locale/el.po +++ b/locale/el.po @@ -1563,6 +1563,10 @@ msgstr "" msgid "No timer available" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index 42ed734f7a..db0bb1965b 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -1557,6 +1557,10 @@ msgstr "No such file/directory" msgid "No timer available" msgstr "No timer available" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "Nordic system firmware out of memory" diff --git a/locale/es.po b/locale/es.po index 8a6a67e02c..8c4b74ff9e 100644 --- a/locale/es.po +++ b/locale/es.po @@ -1585,6 +1585,10 @@ msgstr "No existe el archivo/directorio" msgid "No timer available" msgstr "No hay temporizador disponible" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "El firmware del sistema Nordic no tiene memoria" diff --git a/locale/fil.po b/locale/fil.po index 15b2f87c02..252a2c80a7 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -1548,6 +1548,10 @@ msgstr "Walang file/directory" msgid "No timer available" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index f99e183c0e..7f82c629ba 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -1595,6 +1595,10 @@ msgstr "Fichier/répertoire introuvable" msgid "No timer available" msgstr "Aucun minuteur disponible" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "Logiciel système Nordic n'a plus de mémoire" diff --git a/locale/hi.po b/locale/hi.po index a6bd1fc756..2f6d4d0fe4 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -1536,6 +1536,10 @@ msgstr "" msgid "No timer available" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 3a82f92b53..dc6d3f00e4 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -1551,6 +1551,10 @@ msgstr "Nessun file/directory esistente" msgid "No timer available" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index fe8a1440c4..eed64806b4 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -1549,6 +1549,10 @@ msgstr "指定されたファイル/ディレクトリはありません" msgid "No timer available" msgstr "利用できるタイマーなし" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index a55f2a3588..75fcc1647d 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -1539,6 +1539,10 @@ msgstr "" msgid "No timer available" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 4ece57854a..67f5250ed2 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -1544,6 +1544,10 @@ msgstr "Bestand/map bestaat niet" msgid "No timer available" msgstr "Geen timer beschikbaar" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" diff --git a/locale/pl.po b/locale/pl.po index 1c6c1b16d5..007e71afc5 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -1544,6 +1544,10 @@ msgstr "Brak pliku/katalogu" msgid "No timer available" msgstr "Brak dostępnego timera" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index c3a7acdfd6..15f88efa74 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -1580,6 +1580,10 @@ msgstr "Este arquivo/diretório não existe" msgid "No timer available" msgstr "Não há um temporizador disponível" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "O firmware do sistema nórdico está sem memória" diff --git a/locale/ru.po b/locale/ru.po index 8e354a4960..709cb812c3 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -1586,6 +1586,10 @@ msgstr "Файл/директория не существует" msgid "No timer available" msgstr "Нет доступного таймера" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" diff --git a/locale/sv.po b/locale/sv.po index 2f4914442a..b9d9053731 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -1564,6 +1564,10 @@ msgstr "Ingen sådan fil/katalog" msgid "No timer available" msgstr "Ingen timer tillgänglig" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "Nordic systemfirmware fick slut på minne" diff --git a/locale/tr.po b/locale/tr.po index c741fce473..5ea9735b0a 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -1555,6 +1555,10 @@ msgstr "" msgid "No timer available" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 8171696471..072637c669 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -1571,6 +1571,10 @@ msgstr "Méiyǒu cǐ lèi wénjiàn/mùlù" msgid "No timer available" msgstr "Méiyǒu jìshí qì" +#: shared-module/usb/core/Device.c +msgid "No usb host port initialized" +msgstr "" + #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" msgstr "běi ōu xì tǒng gù jiàn chū nèi cún" From b5a449ab14e971c03b77b46acaeb7955207f7aa3 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Thu, 3 Aug 2023 22:38:47 +0000 Subject: [PATCH 1417/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 15f88efa74..5d12c6796e 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: 2023-07-30 11:47+0000\n" +"PO-Revision-Date: 2023-08-04 02:36+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1582,7 +1582,7 @@ msgstr "Não há um temporizador disponível" #: shared-module/usb/core/Device.c msgid "No usb host port initialized" -msgstr "" +msgstr "Nenhuma porta do host usb foi inicializada" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" @@ -3356,7 +3356,7 @@ msgstr "o tipo da entrada dtype deve ser flutuante ou complexo" #: extmod/ulab/code/numpy/poly.c msgid "input is not iterable" -msgstr "" +msgstr "a entrada não é iterável" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" From 329f9b170a9f6d2e10e4909f8736a3dac5a16fab Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Thu, 3 Aug 2023 19:42:26 +0000 Subject: [PATCH 1418/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (997 of 997 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index b9d9053731..48e742e977 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-08-03 16:12+0000\n" +"PO-Revision-Date: 2023-08-04 02:36+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -1566,7 +1566,7 @@ msgstr "Ingen timer tillgänglig" #: shared-module/usb/core/Device.c msgid "No usb host port initialized" -msgstr "" +msgstr "Ingen usb värdport initialiserad" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" From 50eb62adb3284dd55ca6de3310749ef757c65f49 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Fri, 4 Aug 2023 04:36:05 +0200 Subject: [PATCH 1419/1712] 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 | 4 ++++ locale/cs.po | 4 ++++ locale/de_DE.po | 4 ++++ locale/el.po | 4 ++++ locale/en_GB.po | 4 ++++ locale/es.po | 4 ++++ locale/fil.po | 4 ++++ locale/fr.po | 4 ++++ locale/hi.po | 4 ++++ locale/it_IT.po | 4 ++++ locale/ja.po | 4 ++++ locale/ko.po | 4 ++++ locale/nl.po | 4 ++++ locale/pl.po | 4 ++++ locale/pt_BR.po | 4 ++++ locale/ru.po | 4 ++++ locale/sv.po | 4 ++++ locale/tr.po | 4 ++++ locale/zh_Latn_pinyin.po | 4 ++++ 19 files changed, 76 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index ef97425b13..2ca87027c2 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -1485,6 +1485,10 @@ msgstr "Tidak ada clocks yang tersedia" msgid "No capture in progress" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "Tidak ada koneksi: panjang tidak dapat ditentukan" diff --git a/locale/cs.po b/locale/cs.po index ad6196b078..04bf2aecc2 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -1485,6 +1485,10 @@ msgstr "Žádné dostupné hodiny" msgid "No capture in progress" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "Žádné připojení: nelze určit délku" diff --git a/locale/de_DE.po b/locale/de_DE.po index b09dfa93dd..70e0182b57 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -1510,6 +1510,10 @@ msgstr "Keine Taktgeber verfügbar" msgid "No capture in progress" msgstr "Kein laufende Aufzeichnung" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "Keine Verbindung: Länge kann nicht bestimmt werden" diff --git a/locale/el.po b/locale/el.po index 568a03aacd..44e8de1d4c 100644 --- a/locale/el.po +++ b/locale/el.po @@ -1500,6 +1500,10 @@ msgstr "" msgid "No capture in progress" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index db0bb1965b..289e53b9ae 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -1494,6 +1494,10 @@ msgstr "No available clocks" msgid "No capture in progress" msgstr "No capture in progress" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "No connection: length cannot be determined" diff --git a/locale/es.po b/locale/es.po index 8c4b74ff9e..7db37ec8c0 100644 --- a/locale/es.po +++ b/locale/es.po @@ -1522,6 +1522,10 @@ msgstr "Relojes no disponibles" msgid "No capture in progress" msgstr "No hay captura en marcha" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "Sin conexión: no se puede determinar la longitud" diff --git a/locale/fil.po b/locale/fil.po index 252a2c80a7..2d84f82afc 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -1485,6 +1485,10 @@ msgstr "" msgid "No capture in progress" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index 7f82c629ba..83cca9f61c 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -1532,6 +1532,10 @@ msgstr "Pas d'horloge disponible" msgid "No capture in progress" msgstr "Aucune capture en cours" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "Pas de connexion : la longueur ne peut pas être déterminée" diff --git a/locale/hi.po b/locale/hi.po index 2f6d4d0fe4..392e1bbf6d 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -1473,6 +1473,10 @@ msgstr "" msgid "No capture in progress" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index dc6d3f00e4..5de8a79ef9 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -1488,6 +1488,10 @@ msgstr "Nessun orologio a disposizione" msgid "No capture in progress" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index eed64806b4..14c9dd84d1 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -1486,6 +1486,10 @@ msgstr "利用できるクロックがありません" msgid "No capture in progress" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "接続なし: 長さが決定できません" diff --git a/locale/ko.po b/locale/ko.po index 75fcc1647d..dc3002a256 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -1476,6 +1476,10 @@ msgstr "" msgid "No capture in progress" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 67f5250ed2..c6e1decfc1 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -1481,6 +1481,10 @@ msgstr "Geen klokken beschikbaar" msgid "No capture in progress" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "Geen verbinding: lengte kan niet worden bepaald" diff --git a/locale/pl.po b/locale/pl.po index 007e71afc5..32ae38249f 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -1481,6 +1481,10 @@ msgstr "Brak wolnych zegarów" msgid "No capture in progress" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "Brak połączenia: nie można ustalić długości" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 5d12c6796e..f34a6a5d6d 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -1515,6 +1515,10 @@ msgstr "Nenhum clock disponível" msgid "No capture in progress" msgstr "Não há nenhuma captura em andamento" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "Sem conexão: o comprimento não pode ser determinado" diff --git a/locale/ru.po b/locale/ru.po index 709cb812c3..f1fd186a24 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -1521,6 +1521,10 @@ msgstr "" msgid "No capture in progress" msgstr "Захват не ведется" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "Нет соединения: длина не может быть определена" diff --git a/locale/sv.po b/locale/sv.po index 48e742e977..dfd8d2df6f 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -1501,6 +1501,10 @@ msgstr "Inga tillgängliga klockor" msgid "No capture in progress" msgstr "Ingen insamling pågår" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "Ingen anslutning: längden kan inte bestämmas" diff --git a/locale/tr.po b/locale/tr.po index 5ea9735b0a..3faed02135 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -1492,6 +1492,10 @@ msgstr "Kullanılabilir saat yok" msgid "No capture in progress" msgstr "" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 072637c669..930361eea9 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -1508,6 +1508,10 @@ msgstr "Méiyǒu kěyòng de shízhōng" msgid "No capture in progress" msgstr "zhèng zài jìn xíng zhōng de wèi bǔ huò" +#: shared-module/usb/core/Device.c +msgid "No configuration set" +msgstr "" + #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" msgstr "Wú liánjiē: Wúfǎ quèdìng chángdù" From 465d1c673ea67c5b4752fe0d0c7e1324bc24bd47 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 3 Aug 2023 23:29:00 -0400 Subject: [PATCH 1420/1712] wip --- extmod/moduhashlib.c | 1 - ports/espressif/common-hal/hashlib/Hash.c | 42 -------- ports/raspberrypi/common-hal/board/__init__.c | 8 -- ports/raspberrypi/mbedtls/mbedtls_config.h | 4 - .../peripherals/stm32f4/stm32f411xe/clocks.h | 26 ----- .../peripherals/stm32f4/stm32f412cx/clocks.h | 52 ---------- py/circuitpy_mpconfig.h | 13 ++- py/circuitpy_mpconfig.mk | 3 + py/makeqstrdefs.py | 28 +++--- py/makeversionhdr.py | 2 + py/mpconfig.h | 4 + py/objtuple.c | 3 - py/parse.c | 6 ++ py/py.mk | 1 - shared-module/keypad/EventQueue.h | 17 ---- shared-module/sdcardio/SDCard.h | 34 ------- shared-module/struct/__init__.h | 11 --- shared/runtime/pyexec.c | 99 ++++++------------- 18 files changed, 71 insertions(+), 283 deletions(-) diff --git a/extmod/moduhashlib.c b/extmod/moduhashlib.c index 42bfb8573e..c35af3d02b 100644 --- a/extmod/moduhashlib.c +++ b/extmod/moduhashlib.c @@ -124,7 +124,6 @@ static void check_not_unicode(const mp_obj_t arg) { #endif } -#if MICROPY_PY_UHASHLIB_SHA256 #include "lib/crypto-algorithms/sha256.c" STATIC mp_obj_t uhashlib_sha256_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { diff --git a/ports/espressif/common-hal/hashlib/Hash.c b/ports/espressif/common-hal/hashlib/Hash.c index 295fd0bdf8..8090128acb 100644 --- a/ports/espressif/common-hal/hashlib/Hash.c +++ b/ports/espressif/common-hal/hashlib/Hash.c @@ -3,12 +3,7 @@ * * The MIT License (MIT) * -<<<<<<<< HEAD:ports/espressif/common-hal/hashlib/Hash.c * Copyright (c) 2022 Scott Shawcroft for Adafruit Industries -======== - * Copyright (c) 2013, 2014 Damien P. George - * Copyright (c) 2022 Renesas Electronics Corporation ->>>>>>>> v1.19.1:ports/renesas-ra/moduos.c * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,7 +24,6 @@ * THE SOFTWARE. */ -<<<<<<<< HEAD:ports/espressif/common-hal/hashlib/Hash.c #include "shared-bindings/hashlib/Hash.h" #include "components/mbedtls/mbedtls/include/mbedtls/ssl.h" @@ -60,40 +54,4 @@ size_t common_hal_hashlib_hash_get_digest_size(hashlib_hash_obj_t *self) { return 20; } return 0; -======== -#include "py/runtime.h" -#include "uart.h" - -#if MICROPY_VFS_FAT -#include "lib/oofatfs/ff.h" -#include "lib/oofatfs/diskio.h" -#endif - -// sync() -// Sync all filesystems. -STATIC mp_obj_t mp_uos_sync(void) { - #if MICROPY_VFS_FAT - for (mp_vfs_mount_t *vfs = MP_STATE_VM(vfs_mount_table); vfs != NULL; vfs = vfs->next) { - // this assumes that vfs->obj is fs_user_mount_t with block device functions - disk_ioctl(MP_OBJ_TO_PTR(vfs->obj), CTRL_SYNC, NULL); - } - #endif - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_0(mp_uos_sync_obj, mp_uos_sync); - -bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream) { - const mp_obj_type_t *type = mp_obj_get_type(stream); - return type == &machine_uart_type; -} - -void mp_uos_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached) { - if (mp_obj_get_type(stream_detached) == &machine_uart_type) { - uart_attach_to_repl(MP_OBJ_TO_PTR(stream_detached), false); - } - - if (mp_obj_get_type(stream_attached) == &machine_uart_type) { - uart_attach_to_repl(MP_OBJ_TO_PTR(stream_attached), true); - } ->>>>>>>> v1.19.1:ports/renesas-ra/moduos.c } diff --git a/ports/raspberrypi/common-hal/board/__init__.c b/ports/raspberrypi/common-hal/board/__init__.c index 13462afe4d..3c7f30df22 100644 --- a/ports/raspberrypi/common-hal/board/__init__.c +++ b/ports/raspberrypi/common-hal/board/__init__.c @@ -30,13 +30,5 @@ #include "py/mphal.h" #include "common-hal/microcontroller/Pin.h" -<<<<<<<< HEAD:ports/raspberrypi/common-hal/board/__init__.c // Pins aren't actually defined here. They are in the board specific directory // such as boards/arduino_zero/pins.c. -======== -int allocate_dma_channel(void); -void free_dma_channel(int n); -void dma_init(void); - -#endif // MICROPY_INCLUDED_MIMXRT_DMACHANNEL_H ->>>>>>>> v1.19.1:ports/raspberrypi/dma_manager.h diff --git a/ports/raspberrypi/mbedtls/mbedtls_config.h b/ports/raspberrypi/mbedtls/mbedtls_config.h index c182bc2c6b..3791924a13 100644 --- a/ports/raspberrypi/mbedtls/mbedtls_config.h +++ b/ports/raspberrypi/mbedtls/mbedtls_config.h @@ -81,13 +81,9 @@ #define MBEDTLS_BIGNUM_C #define MBEDTLS_CIPHER_C #define MBEDTLS_CTR_DRBG_C -<<<<<<<< HEAD:ports/raspberrypi/mbedtls/mbedtls_config.h #define MBEDTLS_ECDH_C #define MBEDTLS_ECDSA_C #define MBEDTLS_ECP_C -======== -// #define MBEDTLS_ECP_C ->>>>>>>> v1.19.1:ports/stm32/mbedtls/mbedtls_config.h #define MBEDTLS_ENTROPY_C #define MBEDTLS_ERROR_C #define MBEDTLS_GCM_C diff --git a/ports/stm/peripherals/stm32f4/stm32f411xe/clocks.h b/ports/stm/peripherals/stm32f4/stm32f411xe/clocks.h index ea8b33cfff..0b38d610cb 100644 --- a/ports/stm/peripherals/stm32f4/stm32f411xe/clocks.h +++ b/ports/stm/peripherals/stm32f4/stm32f411xe/clocks.h @@ -3,11 +3,7 @@ * * The MIT License (MIT) * -<<<<<<<< HEAD:ports/stm/peripherals/stm32f4/stm32f411xe/clocks.h * Copyright (c) 2020 Lucian Copeland for Adafruit Industries -======== - * Copyright (c) 2022 Arduino SA ->>>>>>>> v1.19.1:ports/stm/boards/ARDUINO_PORTENTA_H7/bdev.c * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -28,7 +24,6 @@ * THE SOFTWARE. */ -<<<<<<<< HEAD:ports/stm/peripherals/stm32f4/stm32f411xe/clocks.h #include "stm32f4xx_hal.h" // Chip: STM32F411 @@ -70,24 +65,3 @@ #ifndef BOARD_HSE_SOURCE #define BOARD_HSE_SOURCE (RCC_HSE_ON) #endif -======== -#include "storage.h" -#include "qspi.h" - -#if MICROPY_HW_SPIFLASH_ENABLE_CACHE -// Shared cache for first and second SPI block devices -STATIC mp_spiflash_cache_t spi_bdev_cache; -#endif - -// First external SPI flash uses hardware QSPI interface -const mp_spiflash_config_t spiflash_config = { - .bus_kind = MP_SPIFLASH_BUS_QSPI, - .bus.u_qspi.data = NULL, - .bus.u_qspi.proto = &qspi_proto, - #if MICROPY_HW_SPIFLASH_ENABLE_CACHE - .cache = &spi_bdev_cache, - #endif -}; - -spi_bdev_t spi_bdev; ->>>>>>>> v1.19.1:ports/stm/boards/ARDUINO_PORTENTA_H7/bdev.c diff --git a/ports/stm/peripherals/stm32f4/stm32f412cx/clocks.h b/ports/stm/peripherals/stm32f4/stm32f412cx/clocks.h index ff8b2b5ce1..20a7b41ba3 100644 --- a/ports/stm/peripherals/stm32f4/stm32f412cx/clocks.h +++ b/ports/stm/peripherals/stm32f4/stm32f412cx/clocks.h @@ -3,11 +3,7 @@ * * The MIT License (MIT) * -<<<<<<<< HEAD:ports/stm/peripherals/stm32f4/stm32f412cx/clocks.h * Copyright (c) 2020 Lucian Copeland for Adafruit Industries -======== - * Copyright (c) 2013, 2014 Damien P. George ->>>>>>>> v1.19.1:ports/renesas-ra/gccollect.c * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -28,7 +24,6 @@ * THE SOFTWARE. */ -<<<<<<<< HEAD:ports/stm/peripherals/stm32f4/stm32f412cx/clocks.h #include "stm32f4xx_hal.h" // Chip: STM32F412Cx @@ -69,50 +64,3 @@ #ifndef BOARD_HSE_SOURCE #define BOARD_HSE_SOURCE (RCC_HSE_ON) #endif -======== -#include -#include - -#include "py/mpstate.h" -#include "py/gc.h" -#include "py/mpthread.h" -#include "shared/runtime/gchelper.h" -#include "gccollect.h" -#include "softtimer.h" -#include "systick.h" - -void gc_collect(void) { - // get current time, in case we want to time the GC - #if 0 - uint32_t start = mp_hal_ticks_us(); - #endif - - // start the GC - gc_collect_start(); - - // trace the stack and registers - gc_helper_collect_regs_and_stack(); - - // trace root pointers from any threads - #if MICROPY_PY_THREAD - mp_thread_gc_others(); - #endif - - // trace soft timer nodes - soft_timer_gc_mark_all(); - - // end the GC - gc_collect_end(); - - #if 0 - // print GC info - uint32_t ticks = mp_hal_ticks_us() - start; - gc_info_t info; - gc_info(&info); - printf("GC@%lu %lums\n", start, ticks); - printf(" " UINT_FMT " total\n", info.total); - printf(" " UINT_FMT " : " UINT_FMT "\n", info.used, info.free); - printf(" 1=" UINT_FMT " 2=" UINT_FMT " m=" UINT_FMT "\n", info.num_1block, info.num_2block, info.max_block); - #endif -} ->>>>>>>> v1.19.1:ports/renesas-ra/gccollect.c diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index e1909a064f..78fa340f5d 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -55,6 +55,16 @@ extern void common_hal_mcu_enable_interrupts(void); #define MICROPY_BEGIN_ATOMIC_SECTION() (common_hal_mcu_disable_interrupts(), 0) #define MICROPY_END_ATOMIC_SECTION(state) ((void)state, common_hal_mcu_enable_interrupts()) +// MicroPython-only options not used by CircuitPython, but present in various files +// inherited from MicroPython, especially in extmod/ +#define MICROPY_ENABLE_DYNRUNTIME (0) +#define MICROPY_PY_BLUETOOTH (0) +#define MICROPY_PY_LWIP_SLIP (0) +#define MICROPY_PY_OS_DUPTERM (0) +#define MICROPY_ROM_TEXT_COMPRESSION (0) +#define MICROPY_VFS_LFS1 (0) +#define MICROPY_VFS_LFS2 (0) + // Sorted alphabetically for easy finding. // // default is 128; consider raising to reduce fragmentation. @@ -73,6 +83,7 @@ extern void common_hal_mcu_enable_interrupts(void); #define MICROPY_ENABLE_DOC_STRING (0) #define MICROPY_ENABLE_FINALISER (1) #define MICROPY_ENABLE_GC (1) +#define MICROPY_ENABLE_PYSTACK (1) #define MICROPY_TRACKED_ALLOC (CIRCUITPY_SSL_MBEDTLS) #define MICROPY_ENABLE_SOURCE_LINE (1) #define MICROPY_EPOCH_IS_1970 (1) @@ -96,7 +107,6 @@ extern void common_hal_mcu_enable_interrupts(void); #define MICROPY_PY_ARRAY (CIRCUITPY_ARRAY) #define MICROPY_PY_ARRAY_SLICE_ASSIGN (1) #define MICROPY_PY_ATTRTUPLE (1) - #define MICROPY_PY_BUILTINS_BYTEARRAY (1) #define MICROPY_PY_BUILTINS_ENUMERATE (1) #define MICROPY_PY_BUILTINS_FILTER (1) @@ -144,7 +154,6 @@ extern void common_hal_mcu_enable_interrupts(void); #define MICROPY_QSTR_BYTES_IN_HASH (1) #define MICROPY_REPL_AUTO_INDENT (1) #define MICROPY_REPL_EVENT_DRIVEN (0) -#define MICROPY_ENABLE_PYSTACK (1) #define CIRCUITPY_SETTABLE_PYSTACK (1) #define MICROPY_STACK_CHECK (1) #define MICROPY_STREAMS_NON_BLOCK (1) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 639fae9bbc..1a16c9b0cf 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -45,6 +45,9 @@ CFLAGS += -DCIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE=$(CIRCUITPY_OPTIMIZE_PROPERTY MICROPY_PY_ASYNC_AWAIT ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DMICROPY_PY_ASYNC_AWAIT=$(MICROPY_PY_ASYNC_AWAIT) +# unused by CIRCUITPYTHON +MICROPY_ROM_TEXT_COMPRESSION = 0 + # uasyncio # By default, include uasyncio if async/await are available. MICROPY_PY_UASYNCIO ?= $(MICROPY_PY_ASYNC_AWAIT) diff --git a/py/makeqstrdefs.py b/py/makeqstrdefs.py index f8b5c82565..1bd5b3bbf0 100644 --- a/py/makeqstrdefs.py +++ b/py/makeqstrdefs.py @@ -60,6 +60,7 @@ _MODE_QSTR = "qstr" # Extract MP_COMPRESSED_ROM_TEXT("") macros. (Which come from MP_ERROR_TEXT) _MODE_COMPRESS = "compress" + # Extract MP_REGISTER_MODULE(...) macros. _MODE_MODULE = "module" @@ -120,7 +121,6 @@ def write_out(fname, output): with open(args.output_dir + "/" + fname + "." + args.mode, "w") as f: f.write("\n".join(output) + "\n") - def qstr_unescape(qstr): for name in name2codepoint: if "__" + name + "__" in qstr: @@ -131,12 +131,16 @@ def qstr_unescape(qstr): def process_file(f): - re_line = re.compile(r"#[line]*\s(\d+)\s\"([^\"]+)\"") - re_qstr = re.compile(r"MP_QSTR_[_a-zA-Z0-9]+") + re_line = re.compile(r"#[line]*\s\d+\s\"([^\"]+)\"") + if args.mode == _MODE_QSTR: + re_match = re.compile(r"MP_QSTR_[_a-zA-Z0-9]+") + elif args.mode == _MODE_COMPRESS: + re_match = re.compile(r'MP_COMPRESSED_ROM_TEXT\("([^"]*)"\)') + elif args.mode == _MODE_MODULE: + re_match = re.compile(r"MP_REGISTER_MODULE\(.*?,\s*.*?\);") re_translate = re.compile(r"translate\(\"((?:(?=(\\?))\2.)*?)\"\)") output = [] last_fname = None - lineno = 0 for line in f: if line.isspace(): continue @@ -144,8 +148,7 @@ def process_file(f): if line.startswith(("# ", "#line")): m = re_line.match(line) assert m is not None - lineno = int(m.group(1)) - fname = m.group(2) + fname = m.group(1) if os.path.splitext(fname)[1] not in [".c", ".cpp"]: continue if fname != last_fname: @@ -153,13 +156,16 @@ def process_file(f): output = [] last_fname = fname continue - for match in re_qstr.findall(line): - name = match.replace("MP_QSTR_", "") - if name not in QSTRING_BLOCK_LIST: - output.append("Q(" + qstr_unescape(name) + ")") + for match in re_match.findall(line): + if args.mode == _MODE_QSTR: + name = match.replace("MP_QSTR_", "") + if name not in QSTRING_BLOCK_LIST: + output.append("Q(" + qstr_unescape(name) + ")") + elif args.mode in (_MODE_COMPRESS, _MODE_MODULE): + output.append(match) + for match in re_translate.findall(line): output.append('TRANSLATE("' + match[0] + '")') - lineno += 1 if last_fname: write_out(last_fname, output) diff --git a/py/makeversionhdr.py b/py/makeversionhdr.py index b0d00a694e..11d162ecea 100644 --- a/py/makeversionhdr.py +++ b/py/makeversionhdr.py @@ -97,6 +97,8 @@ def make_version_header(filename): #define MICROPY_VERSION_MINOR (%s) #define MICROPY_VERSION_MICRO (%s) #define MICROPY_VERSION_STRING "%s" +// Combined version as a 32-bit number for convenience +#define MICROPY_VERSION (MICROPY_VERSION_MAJOR << 16 | MICROPY_VERSION_MINOR << 8 | MICROPY_VERSION_MICRO) #define MICROPY_FULL_VERSION_INFO "Adafruit CircuitPython " MICROPY_GIT_TAG " on " MICROPY_BUILD_DATE "; " MICROPY_HW_BOARD_NAME " with " MICROPY_HW_MCU_NAME """ % ( git_tag, diff --git a/py/mpconfig.h b/py/mpconfig.h index db349e451f..957cbde2af 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -26,6 +26,8 @@ #ifndef MICROPY_INCLUDED_PY_MPCONFIG_H #define MICROPY_INCLUDED_PY_MPCONFIG_H +// In CircuitPython, this is defined in genghdr/mpversion.h +#if !CIRCUITPY // Current version of MicroPython #define MICROPY_VERSION_MAJOR 1 #define MICROPY_VERSION_MINOR 19 @@ -42,6 +44,8 @@ MP_STRINGIFY(MICROPY_VERSION_MAJOR) "." \ MP_STRINGIFY(MICROPY_VERSION_MINOR) "." \ MP_STRINGIFY(MICROPY_VERSION_MICRO) +#endif + // This file contains default configuration settings for MicroPython. // You can override any of the options below using mpconfigport.h file diff --git a/py/objtuple.c b/py/objtuple.c index 9499b086c5..275a3e3ed9 100644 --- a/py/objtuple.c +++ b/py/objtuple.c @@ -34,9 +34,6 @@ #include "supervisor/shared/translate/translate.h" -// type check is done on getiter method to allow tuple, namedtuple, attrtuple -#define mp_obj_is_tuple_compatible(o) (mp_obj_get_type(o)->getiter == mp_obj_tuple_getiter) - /******************************************************************************/ /* tuple */ diff --git a/py/parse.c b/py/parse.c index 03c9b2cd13..314e94af60 100644 --- a/py/parse.c +++ b/py/parse.c @@ -645,11 +645,17 @@ STATIC MP_DEFINE_CONST_MAP(mp_constants_map, mp_constants_table); STATIC void push_result_rule(parser_t *parser, size_t src_line, uint8_t rule_id, size_t num_args); #if MICROPY_COMP_CONST_FOLDING +// CIRCUITPY: The compilers mentioned below are esp-2020r3. We are using minimum esp-2021r3 (ESP-IDF v4.4). +// See https://github.com/micropython/micropython/commit/f63b4f85aae1e0ade7a7c9f908debb5905cc144d +// and https://github.com/espressif/esp-idf/issues/9130 +// So disable this for CircuitPython. +/* #if MICROPY_COMP_CONST_FOLDING_COMPILER_WORKAROUND // Some versions of the xtensa-esp32-elf-gcc compiler generate wrong code if this // function is static, so provide a hook for them to work around this problem. MP_NOINLINE #endif +*/ STATIC bool fold_logical_constants(parser_t *parser, uint8_t rule_id, size_t *num_args) { if (rule_id == RULE_or_test || rule_id == RULE_and_test) { diff --git a/py/py.mk b/py/py.mk index f50451dc99..8a6b641ee7 100644 --- a/py/py.mk +++ b/py/py.mk @@ -197,7 +197,6 @@ PY_EXTMOD_O_BASENAME = \ extmod/modubinascii.o \ extmod/modurandom.o \ extmod/moduselect.o \ - extmod/modframebuf.o \ extmod/vfs.o \ extmod/vfs_blockdev.o \ extmod/vfs_reader.o \ diff --git a/shared-module/keypad/EventQueue.h b/shared-module/keypad/EventQueue.h index 207f3d7c87..b523b16cac 100644 --- a/shared-module/keypad/EventQueue.h +++ b/shared-module/keypad/EventQueue.h @@ -24,19 +24,12 @@ * THE SOFTWARE. */ -<<<<<<< HEAD:shared-module/keypad/EventQueue.h #ifndef MICROPY_INCLUDED_SHARED_MODULE_KEYPAD_EVENTQUEUE_H #define MICROPY_INCLUDED_SHARED_MODULE_KEYPAD_EVENTQUEUE_H -======= -#include "mpconfigport.h" - -#define CFG_TUSB_RHPORT0_MODE (OPT_MODE_DEVICE) ->>>>>>> v1.19.1:ports/rp2/tusb_config.h #include "py/obj.h" #include "py/ringbuf.h" -<<<<<<< HEAD:shared-module/keypad/EventQueue.h typedef struct _keypad_eventqueue_obj_t { mp_obj_base_t base; ringbuf_t encoded_events; @@ -46,13 +39,3 @@ typedef struct _keypad_eventqueue_obj_t { bool keypad_eventqueue_record(keypad_eventqueue_obj_t *self, mp_uint_t key_number, bool pressed, mp_obj_t timestamp); #endif // MICROPY_INCLUDED_SHARED_MODULE_KEYPAD_EVENTQUEUE_H -======= -#if MICROPY_HW_USB_MSC -// Board and hardware specific configuration -#define CFG_TUD_MSC (1) -// Set MSC EP buffer size to FatFS block size to avoid partial read/writes (offset arg). -#define CFG_TUD_MSC_BUFSIZE (MICROPY_FATFS_MAX_SS) -#endif - -#endif // MICROPY_INCLUDED_RP2_TUSB_CONFIG_H ->>>>>>> v1.19.1:ports/rp2/tusb_config.h diff --git a/shared-module/sdcardio/SDCard.h b/shared-module/sdcardio/SDCard.h index 994e655a98..ff89b89819 100644 --- a/shared-module/sdcardio/SDCard.h +++ b/shared-module/sdcardio/SDCard.h @@ -45,7 +45,6 @@ typedef struct { bool in_cmd25; } sdcardio_sdcard_obj_t; -<<<<<<< HEAD:shared-module/sdcardio/SDCard.h void common_hal_sdcardio_sdcard_construct(sdcardio_sdcard_obj_t *self, busio_spi_obj_t *spi, const mcu_pin_obj_t *cs, int baudrate); void common_hal_sdcardio_sdcard_deinit(sdcardio_sdcard_obj_t *self); void common_hal_sdcardio_sdcard_check_for_deinit(sdcardio_sdcard_obj_t *self); @@ -53,36 +52,3 @@ int common_hal_sdcardio_sdcard_get_blockcount(sdcardio_sdcard_obj_t *self); int common_hal_sdcardio_sdcard_readblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf); int common_hal_sdcardio_sdcard_sync(sdcardio_sdcard_obj_t *self); int common_hal_sdcardio_sdcard_writeblocks(sdcardio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *buf); -======= -static mp_obj_t microbit_repeat_iter_next(mp_obj_t iter_in) { - repeat_iterator_t *iter = (repeat_iterator_t *)iter_in; - iter->index++; - if (iter->index >= mp_obj_get_int(mp_obj_len(iter->iterable))) { - iter->index = 0; - } - return mp_obj_subscr(iter->iterable, MP_OBJ_NEW_SMALL_INT(iter->index), MP_OBJ_SENTINEL); -} - -const mp_obj_type_t microbit_repeat_iterator_type = { - { &mp_type_type }, - .name = MP_QSTR_iterator, - .print = NULL, - .make_new = NULL, - .call = NULL, - .unary_op = NULL, - .binary_op = NULL, - .attr = NULL, - .subscr = NULL, - .getiter = mp_identity_getiter, - .iternext = microbit_repeat_iter_next, - .buffer_p = {NULL}, - MP_OBJ_NULL -}; - -mp_obj_t microbit_repeat_iterator(mp_obj_t iterable) { - repeat_iterator_t *result = mp_obj_malloc(repeat_iterator_t, µbit_repeat_iterator_type); - result->iterable = iterable; - result->index = -1; - return result; -} ->>>>>>> v1.19.1:ports/nrf/boards/microbit/modules/iters.c diff --git a/shared-module/struct/__init__.h b/shared-module/struct/__init__.h index 7e27c0474f..637080b292 100644 --- a/shared-module/struct/__init__.h +++ b/shared-module/struct/__init__.h @@ -31,15 +31,4 @@ char get_fmt_type(const char **fmt); mp_uint_t get_fmt_num(const char **p); mp_uint_t calcsize_items(const char *fmt); -<<<<<<< HEAD:shared-module/struct/__init__.h -======= -// The main sleep implementation for the Windows port. -void msec_sleep(double msec); - -// Define usleep() because some of the unix port's code uses that. -// Mingw and the likes provide a definition of usleep(), note however -// that it's also just Sleep(usec/1000). -#ifdef _MSC_VER -int usleep(__int64 usec); ->>>>>>> v1.19.1:ports/windows/sleep.h #endif diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c index 417e443097..c858f63193 100644 --- a/shared/runtime/pyexec.c +++ b/shared/runtime/pyexec.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George + * Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -86,61 +86,40 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input nlr.ret_val = NULL; if (nlr_push(&nlr) == 0) { mp_obj_t module_fun; -<<<<<<< HEAD #if CIRCUITPY_ATEXIT if (!(exec_flags & EXEC_FLAG_SOURCE_IS_ATEXIT)) -======= - #if MICROPY_MODULE_FROZEN_MPY - if (exec_flags & EXEC_FLAG_SOURCE_IS_RAW_CODE) { - // source is a raw_code object, create the function - const mp_frozen_module_t *frozen = source; - mp_module_context_t *ctx = m_new_obj(mp_module_context_t); - ctx->module.globals = mp_globals_get(); - ctx->constants = frozen->constants; - module_fun = mp_make_function_from_raw_code(frozen->rc, ctx, NULL); - } else ->>>>>>> v1.19.1 - #endif + #endif { #if MICROPY_MODULE_FROZEN_MPY if (exec_flags & EXEC_FLAG_SOURCE_IS_RAW_CODE) { // source is a raw_code object, create the function - module_fun = mp_make_function_from_raw_code(source, MP_OBJ_NULL, MP_OBJ_NULL); - } else + const mp_frozen_module_t *frozen = source; + mp_module_context_t *ctx = m_new_obj(mp_module_context_t); + ctx->module.globals = mp_globals_get(); + ctx->constants = frozen->constants; + module_fun = mp_make_function_from_raw_code(frozen->rc, ctx, NULL); + } else + #endif + { + #if MICROPY_ENABLE_COMPILER + mp_lexer_t *lex; + if (exec_flags & EXEC_FLAG_SOURCE_IS_VSTR) { + const vstr_t *vstr = source; + lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, vstr->buf, vstr->len, 0); + } else if (exec_flags & EXEC_FLAG_SOURCE_IS_READER) { + lex = mp_lexer_new(MP_QSTR__lt_stdin_gt_, *(mp_reader_t *)source); + } else if (exec_flags & EXEC_FLAG_SOURCE_IS_FILENAME) { + lex = mp_lexer_new_from_file(source); + } else { + lex = (mp_lexer_t *)source; + } + // source is a lexer, parse and compile the script + qstr source_name = lex->source_name; + mp_parse_tree_t parse_tree = mp_parse(lex, input_kind); + module_fun = mp_compile(&parse_tree, source_name, exec_flags & EXEC_FLAG_IS_REPL); + #else + mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("script compilation not supported")); #endif - { - #if MICROPY_ENABLE_COMPILER - mp_lexer_t *lex; - if (exec_flags & EXEC_FLAG_SOURCE_IS_VSTR) { - const vstr_t *vstr = source; - lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, vstr->buf, vstr->len, 0); - } else if (exec_flags & EXEC_FLAG_SOURCE_IS_READER) { - lex = mp_lexer_new(MP_QSTR__lt_stdin_gt_, *(mp_reader_t *)source); - } else if (exec_flags & EXEC_FLAG_SOURCE_IS_FILENAME) { - lex = mp_lexer_new_from_file(source); - } else { - lex = (mp_lexer_t *)source; - } - // source is a lexer, parse and compile the script - qstr source_name = lex->source_name; - if (input_kind == MP_PARSE_FILE_INPUT) { - mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name)); - } - mp_parse_tree_t parse_tree = mp_parse(lex, input_kind); - module_fun = mp_compile(&parse_tree, source_name, exec_flags & EXEC_FLAG_IS_REPL); - // Clear the parse tree because it has a heap pointer we don't need anymore. - *((uint32_t volatile *)&parse_tree.chunk) = 0; - #else - mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("script compilation not supported")); - #endif - } - - // If the code was loaded from a file it's likely to be running for a while so we'll long - // live it and collect any garbage before running. - if (input_kind == MP_PARSE_FILE_INPUT) { - module_fun = make_obj_long_lived(module_fun, 6); - gc_collect(); - } } // execute code @@ -474,18 +453,9 @@ STATIC int pyexec_friendly_repl_process_char(int c) { } else if (ret == CHAR_CTRL_B) { // reset friendly REPL mp_hal_stdout_tx_str("\r\n"); -<<<<<<< HEAD mp_hal_stdout_tx_str(MICROPY_FULL_VERSION_INFO); mp_hal_stdout_tx_str("\r\n"); // mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n"); -======= - mp_hal_stdout_tx_str(MICROPY_BANNER_NAME_AND_VERSION); - mp_hal_stdout_tx_str("; " MICROPY_BANNER_MACHINE); - mp_hal_stdout_tx_str("\r\n"); - #if MICROPY_PY_BUILTINS_HELP - mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n"); - #endif ->>>>>>> v1.19.1 goto input_restart; } else if (ret == CHAR_CTRL_C) { // break @@ -633,19 +603,10 @@ int pyexec_friendly_repl(void) { vstr_init(&line, 32); friendly_repl_reset: -<<<<<<< HEAD mp_hal_stdout_tx_str("\r\n"); mp_hal_stdout_tx_str(MICROPY_FULL_VERSION_INFO); mp_hal_stdout_tx_str("\r\n"); // mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n"); -======= - mp_hal_stdout_tx_str(MICROPY_BANNER_NAME_AND_VERSION); - mp_hal_stdout_tx_str("; " MICROPY_BANNER_MACHINE); - mp_hal_stdout_tx_str("\r\n"); - #if MICROPY_PY_BUILTINS_HELP - mp_hal_stdout_tx_str("Type \"help()\" for more information.\r\n"); - #endif ->>>>>>> v1.19.1 // to test ctrl-C /* @@ -688,7 +649,6 @@ friendly_repl_reset: } vstr_reset(&line); -<<<<<<< HEAD nlr_buf_t nlr; nlr.ret_val = NULL; @@ -704,9 +664,6 @@ friendly_repl_reset: mp_hal_stdout_tx_str("\r\n"); mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val)); } -======= - int ret = readline(&line, mp_repl_get_ps1()); ->>>>>>> v1.19.1 mp_parse_input_kind_t parse_input_kind = MP_PARSE_SINGLE_INPUT; if (ret == CHAR_CTRL_A) { From 84d8224a54bf8e118414a199a93b4535e0a227c5 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 4 Aug 2023 08:38:07 -0500 Subject: [PATCH 1421/1712] set reserved psram for pycamera --- ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.h b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.h index daa9bc92e5..1e62da71c4 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.h @@ -40,3 +40,5 @@ #define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) #define DOUBLE_TAP_PIN (&pin_GPIO42) + +#define DEFAULT_RESERVED_PSRAM (1048576) From 46db0366b85b61ac103d3db0f18abb55ae8313aa Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 4 Aug 2023 09:25:52 -0500 Subject: [PATCH 1422/1712] OrderedDict.move_to_end: alternate implementation of #8234 this implementation is hoped to be smaller. (feather_m4_express/fr fits unlike the other PR; approximate savings ~600 bytes) Minor difference to standard Python: A `dict` object has a `move_to_end` method. However, calling this method always results in TypeError. Implementing it this way means that the method table can still be shared between OrderedDict and builtin dict. Closes #4408. --- py/objdict.c | 50 ++++++++++++++++++++++++++++++++++++ tests/basics/ordereddict2.py | 44 +++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 tests/basics/ordereddict2.py diff --git a/py/objdict.c b/py/objdict.c index b63ea89137..abe72e7839 100644 --- a/py/objdict.c +++ b/py/objdict.c @@ -421,6 +421,53 @@ STATIC mp_obj_t dict_update(size_t n_args, const mp_obj_t *args, mp_map_t *kwarg } STATIC MP_DEFINE_CONST_FUN_OBJ_KW(dict_update_obj, 1, dict_update); +#if MICROPY_PY_COLLECTIONS_ORDEREDDICT +STATIC mp_obj_t dict_move_to_end(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + mp_obj_dict_t *self = MP_OBJ_TO_PTR(pos_args[0]); + mp_arg_validate_type(self, &mp_type_ordereddict, MP_QSTR_self); + + // parse args + enum { ARG_key, ARG_last }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_key, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_rom_obj = MP_ROM_NONE } }, + { MP_QSTR_last, MP_ARG_BOOL, {.u_bool = true } } + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_obj_t *key = args[ARG_key].u_obj; + bool last = args[ARG_last].u_bool; + + mp_map_elem_t *elem = mp_map_lookup(&self->map, key, MP_MAP_LOOKUP); + if (!elem) { + mp_raise_type_arg(&mp_type_KeyError, key); + } + + mp_map_elem_t tmp = *elem; + mp_map_elem_t *table = self->map.table; + mp_map_elem_t *dest, *move_begin, *move_dest; + size_t move_count; + + if (last) { + mp_map_elem_t *top = &table[self->map.used]; + dest = top - 1; + move_begin = elem + 1; + move_dest = elem; + move_count = top - move_begin; + } else { + dest = &table[0]; + move_begin = table; + move_dest = table + 1; + move_count = elem - table; + } + memmove(move_dest, move_begin, move_count * sizeof(*elem)); + *dest = tmp; + + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(dict_move_to_end_obj, 1, dict_move_to_end); +#endif + /******************************************************************************/ /* dict views */ @@ -590,6 +637,9 @@ STATIC const mp_rom_map_elem_t dict_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_get), MP_ROM_PTR(&dict_get_obj) }, { MP_ROM_QSTR(MP_QSTR_items), MP_ROM_PTR(&dict_items_obj) }, { MP_ROM_QSTR(MP_QSTR_keys), MP_ROM_PTR(&dict_keys_obj) }, + #if MICROPY_PY_COLLECTIONS_ORDEREDDICT + { MP_ROM_QSTR(MP_QSTR_move_to_end), MP_ROM_PTR(&dict_move_to_end_obj) }, + #endif { MP_ROM_QSTR(MP_QSTR_pop), MP_ROM_PTR(&dict_pop_obj) }, { MP_ROM_QSTR(MP_QSTR_popitem), MP_ROM_PTR(&dict_popitem_obj) }, { MP_ROM_QSTR(MP_QSTR_setdefault), MP_ROM_PTR(&dict_setdefault_obj) }, diff --git a/tests/basics/ordereddict2.py b/tests/basics/ordereddict2.py new file mode 100644 index 0000000000..f85b08fea5 --- /dev/null +++ b/tests/basics/ordereddict2.py @@ -0,0 +1,44 @@ +try: + from collections import OrderedDict +except ImportError: + print("SKIP") + raise SystemExit + +try: + {'a': None}.move_to_end('a') +except (TypeError, AttributeError): + print("Exception") + +d = OrderedDict(a=1, b=2, c=3) +d.move_to_end('a') +print(list(d.items())) + +d = OrderedDict(a=1, b=2, c=3) +d.move_to_end('b') +print(list(d.items())) + +d = OrderedDict(a=1, b=2, c=3) +d.move_to_end('c') +print(list(d.items())) + +try: + d.move_to_end('x') +except KeyError: + print("KeyError") + +d = OrderedDict(a=1, b=2, c=3) +d.move_to_end('a', last=False) +print(list(d.items())) + +d = OrderedDict(a=1, b=2, c=3) +d.move_to_end('b', last=False) +print(list(d.items())) + +d = OrderedDict(a=1, b=2, c=3) +d.move_to_end('c', last=False) +print(list(d.items())) + +try: + d.move_to_end('x', last=False) +except KeyError: + print("KeyError") From 1d3b2b019a25a42b41327933feb8623619a7a21a Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Fri, 4 Aug 2023 08:54:22 -0700 Subject: [PATCH 1423/1712] Update settings to match micropython --- .../arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk | 2 +- .../boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig | 2 +- tools/ci_check_duplicate_usb_vid_pid.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk index c9af3af25e..925c4ab6e2 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x2341 -USB_PID = 0x0070 +USB_PID = 0x056B USB_PRODUCT = "Arduino Nano ESP32" USB_MANUFACTURER = "Arduino" diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig index 2acf08a4a7..26a26b5fe8 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig @@ -39,5 +39,5 @@ CONFIG_SPIRAM_MEMTEST=y # # LWIP # -CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +CONFIG_LWIP_LOCAL_HOSTNAME="nano-esp32" # end of LWIP diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index dd7531dbb6..5232f6dc7c 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -63,7 +63,7 @@ DEFAULT_CLUSTERLIST = { ], "0x239A:0x102E": ["weact_studio_pico", "weact_studio_pico_16mb"], "0x303A:0x8166": ["yd_esp32_s3_n8r8", "yd_esp32_s3_n16r8"], - "0x2341:0x0070": ["arduino_nano_esp32s3", "arduino_nano_esp32s3_inverted_statusled"], + "0x2341:0x056B": ["arduino_nano_esp32s3", "arduino_nano_esp32s3_inverted_statusled"], } cli_parser = argparse.ArgumentParser( From b9a9ae595c879d18c26a8b8c4d5475ba3192e40b Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Fri, 4 Aug 2023 12:26:24 +0000 Subject: [PATCH 1424/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (998 of 998 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index dfd8d2df6f..57164b7062 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-08-04 02:36+0000\n" +"PO-Revision-Date: 2023-08-04 16:42+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -1503,7 +1503,7 @@ msgstr "Ingen insamling pågår" #: shared-module/usb/core/Device.c msgid "No configuration set" -msgstr "" +msgstr "Ingen konfiguration gjord" #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" From ddeb27d335c1c292d5900b0ee9e823cde2de1a8f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 4 Aug 2023 18:40:30 -0500 Subject: [PATCH 1425/1712] the note is in its attack phase --- shared-bindings/synthio/__init__.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index 52d30cd2c4..48a4d407c7 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -45,6 +45,13 @@ #include "shared-module/synthio/LFO.h" +//| +//| """Support for multi-channel audio synthesis +//| +//| At least 2 simultaneous notes are supported. samd5x, mimxrt10xx and rp2040 platforms support up to 12 notes. +//| """ +//| + //| class EnvelopeState: //| ATTACK: EnvelopeState //| """The note is in its attack phase""" @@ -85,12 +92,6 @@ static const mp_arg_t envelope_properties[] = { { MP_QSTR_sustain_level, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = MP_OBJ_NULL } }, }; -//| -//| """Support for multi-channel audio synthesis -//| -//| At least 2 simultaneous notes are supported. samd5x, mimxrt10xx and rp2040 platforms support up to 12 notes. -//| """ -//| //| BlockInput = Union["Math", "LFO", float, None] //| """Blocks and Notes can take any of these types as inputs on certain attributes //| From a34d9b70e2a50608b54041eb4fa3d69b320e4071 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 4 Aug 2023 20:54:11 -0500 Subject: [PATCH 1426/1712] update protomatter to 1.5.10 --- lib/protomatter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/protomatter b/lib/protomatter index 5f0b40ed59..ed2e701871 160000 --- a/lib/protomatter +++ b/lib/protomatter @@ -1 +1 @@ -Subproject commit 5f0b40ed5991e22da63add5dbaeb7c194b72b607 +Subproject commit ed2e7018718caebba2b7550517b556e7734357ef From 8c45abbd8939e39bc78771326117a499dce7ef04 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 5 Aug 2023 14:23:26 -0500 Subject: [PATCH 1427/1712] pass correct may_exec buffer length --- ports/raspberrypi/bindings/rp2pio/StateMachine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index a885a844b9..ae89fcdffb 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -279,7 +279,7 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n bufinfo.buf, bufinfo.len / 2, args[ARG_frequency].u_int, init_bufinfo.buf, init_bufinfo.len / 2, - may_exec_bufinfo.buf, bufinfo.len / 2, + may_exec_bufinfo.buf, may_exec_bufinfo.len / 2, first_out_pin, out_pin_count, args[ARG_initial_out_pin_state].u_int, args[ARG_initial_out_pin_direction].u_int, first_in_pin, in_pin_count, args[ARG_pull_in_pin_up].u_int, args[ARG_pull_in_pin_down].u_int, first_set_pin, set_pin_count, args[ARG_initial_set_pin_state].u_int, args[ARG_initial_set_pin_direction].u_int, From a6e86199402c9e99191414bfc6c6fce65dbed961 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 5 Aug 2023 14:24:03 -0500 Subject: [PATCH 1428/1712] fix 'uses extra pin' message --- ports/raspberrypi/common-hal/rp2pio/StateMachine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index 20ff359461..fe392566c1 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -431,7 +431,7 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, uint16_t wait_source = (full_instruction & 0x0060) >> 5; uint16_t wait_index = full_instruction & 0x001f; if (wait_source == 0 && (state->pins_we_use & (1 << wait_index)) == 0) { // GPIO - mp_raise_ValueError_varg(translate("%q[%u] uses extra pin"), i); + mp_raise_ValueError_varg(translate("%q[%u] uses extra pin"), what, i); } if (wait_source == 1) { // Input pin if (state->has_in_pin) { From 9a354a4eb8120d6484db75618c34d9ef7935fb7f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 5 Aug 2023 14:24:11 -0500 Subject: [PATCH 1429/1712] fix checking for in-pin --- ports/raspberrypi/common-hal/rp2pio/StateMachine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index fe392566c1..7d9103d046 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -434,7 +434,7 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, mp_raise_ValueError_varg(translate("%q[%u] uses extra pin"), what, i); } if (wait_source == 1) { // Input pin - if (state->has_in_pin) { + if (!state->has_in_pin) { mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] waits based on pin"), what, i); } if (wait_index >= state->in_pin_count) { From c918d8048d287fc8e5dbdc088323228497d4881e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 5 Aug 2023 14:46:50 -0500 Subject: [PATCH 1430/1712] correct more error detection --- .../raspberrypi/common-hal/rp2pio/StateMachine.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index 7d9103d046..4ac57397e0 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -447,10 +447,10 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, uint16_t bit_count = full_instruction & 0x001f; if (source == 0) { if (!state->has_in_pin) { - mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] shifts in from pin(s)"), i); + mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] shifts in from pin(s)"), what, i); } if (bit_count > state->in_pin_count) { - mp_raise_ValueError_varg(translate("%q[%u] shifts in more bits than pin count"), i); + mp_raise_ValueError_varg(translate("%q[%u] shifts in more bits than pin count"), what, i); } } if (state->auto_push) { @@ -465,10 +465,10 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, // Check for pins or pindirs destination. if (destination == 0x0 || destination == 0x4) { if (!state->has_out_pin) { - mp_raise_ValueError_varg(translate("Missing first_out_pin. %q[%u] shifts out to pin(s)"), i); + mp_raise_ValueError_varg(translate("Missing first_out_pin. %q[%u] shifts out to pin(s)"), what, i); } if (bit_count > state->out_pin_count) { - mp_raise_ValueError_varg(translate("%q[%u] shifts out more bits than pin count"), i); + mp_raise_ValueError_varg(translate("%q[%u] shifts out more bits than pin count"), what, i); } } if (state->auto_pull) { @@ -481,7 +481,7 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, uint16_t destination = (full_instruction & 0x00e0) >> 5; // Check for pins or pindirs destination. if ((destination == 0x00 || destination == 0x4) && !state->has_set_pin) { - mp_raise_ValueError_varg(translate("Missing first_set_pin. %q[%u] sets pin(s)"), i); + mp_raise_ValueError_varg(translate("Missing first_set_pin. %q[%u] sets pin(s)"), what, i); } } if (instruction == pio_instr_bits_mov) { @@ -489,10 +489,10 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, uint16_t destination = (full_instruction & 0x00e0) >> 5; // Check for pins or pindirs destination. if (destination == 0x0 && !state->has_out_pin) { - mp_raise_ValueError_varg(translate("Missing first_out_pin. %q[%u] writes pin(s)"), i); + mp_raise_ValueError_varg(translate("Missing first_out_pin. %q[%u] writes pin(s)"), what, i); } - if (source == 0x0 && !state->has_out_pin) { - mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] reads pin(s)"), i); + if (source == 0x0 && !state->has_in_pin) { + mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] reads pin(s)"), what, i); } if (destination == 0x6) { state->in_loaded = true; From 432f928286c5278481e6b5904af84e79ceb49043 Mon Sep 17 00:00:00 2001 From: Blake Ramsdell Date: Sun, 6 Aug 2023 13:46:34 +0000 Subject: [PATCH 1431/1712] Add RUNMODE_UF2 handling for SAMD --- ports/atmel-samd/common-hal/microcontroller/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/common-hal/microcontroller/__init__.c b/ports/atmel-samd/common-hal/microcontroller/__init__.c index d1c02b360f..054d7ee7f8 100644 --- a/ports/atmel-samd/common-hal/microcontroller/__init__.c +++ b/ports/atmel-samd/common-hal/microcontroller/__init__.c @@ -63,7 +63,7 @@ void common_hal_mcu_enable_interrupts(void) { } void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { - if (runmode == RUNMODE_BOOTLOADER) { + if ((runmode == RUNMODE_BOOTLOADER) || (runmode == RUNMODE_UF2)) { if (!bootloader_available()) { mp_raise_ValueError(translate("Cannot reset into bootloader because no bootloader is present")); } From bcef82758e7c37adf2a783f53b8e2b0fec33fc4d Mon Sep 17 00:00:00 2001 From: Pablo Martinez Bernal Date: Fri, 4 Aug 2023 22:55:02 +0000 Subject: [PATCH 1432/1712] Translated using Weblate (Spanish) Currently translated at 100.0% (998 of 998 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/es.po b/locale/es.po index 7db37ec8c0..242242bbeb 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-07-30 11:47+0000\n" +"PO-Revision-Date: 2023-08-06 17:45+0000\n" "Last-Translator: Pablo Martinez Bernal \n" "Language-Team: \n" "Language: es\n" @@ -1524,7 +1524,7 @@ msgstr "No hay captura en marcha" #: shared-module/usb/core/Device.c msgid "No configuration set" -msgstr "" +msgstr "No hay configuración" #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" @@ -1591,7 +1591,7 @@ msgstr "No hay temporizador disponible" #: shared-module/usb/core/Device.c msgid "No usb host port initialized" -msgstr "" +msgstr "No hay ningún puerto USB host inicializado" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" @@ -3360,7 +3360,7 @@ msgstr "dtype de entrada debe ser float o complex" #: extmod/ulab/code/numpy/poly.c msgid "input is not iterable" -msgstr "" +msgstr "input no es iterable" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" From 9a9106f10797c82dc6aff5f4db82cea6614d7b46 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 4 Aug 2023 22:44:52 +0000 Subject: [PATCH 1433/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (998 of 998 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index f34a6a5d6d..f6bd115445 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: 2023-08-04 02:36+0000\n" +"PO-Revision-Date: 2023-08-06 17:45+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1517,7 +1517,7 @@ msgstr "Não há nenhuma captura em andamento" #: shared-module/usb/core/Device.c msgid "No configuration set" -msgstr "" +msgstr "Nenhum conjunto de configuração" #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" From 8ba261d51c86a66d464be59df5cd7d63e8ad3534 Mon Sep 17 00:00:00 2001 From: Andi Chandler Date: Sat, 5 Aug 2023 17:32:57 +0000 Subject: [PATCH 1434/1712] Translated using Weblate (English (United Kingdom)) Currently translated at 100.0% (998 of 998 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/en_GB/ --- locale/en_GB.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/en_GB.po b/locale/en_GB.po index 289e53b9ae..0971690f8d 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-07-30 11:47+0000\n" +"PO-Revision-Date: 2023-08-06 17:45+0000\n" "Last-Translator: Andi Chandler \n" "Language-Team: none\n" "Language: en_GB\n" @@ -1496,7 +1496,7 @@ msgstr "No capture in progress" #: shared-module/usb/core/Device.c msgid "No configuration set" -msgstr "" +msgstr "No configuration set" #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" @@ -1563,7 +1563,7 @@ msgstr "No timer available" #: shared-module/usb/core/Device.c msgid "No usb host port initialized" -msgstr "" +msgstr "No USB host port initialised" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" @@ -3312,7 +3312,7 @@ msgstr "input dtype must be float or complex" #: extmod/ulab/code/numpy/poly.c msgid "input is not iterable" -msgstr "" +msgstr "input is not iterable" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" From 1f010f95418530400e1f1015bc19e9b7d1294820 Mon Sep 17 00:00:00 2001 From: hexthat Date: Mon, 7 Aug 2023 06:18:17 +0000 Subject: [PATCH 1435/1712] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (998 of 998 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 930361eea9..9dc9b39c21 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-08-02 22:07+0000\n" +"PO-Revision-Date: 2023-08-07 14:52+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -1510,7 +1510,7 @@ msgstr "zhèng zài jìn xíng zhōng de wèi bǔ huò" #: shared-module/usb/core/Device.c msgid "No configuration set" -msgstr "" +msgstr "wèi shèzhì pèizhì" #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" @@ -1577,7 +1577,7 @@ msgstr "Méiyǒu jìshí qì" #: shared-module/usb/core/Device.c msgid "No usb host port initialized" -msgstr "" +msgstr "wèi chūshǐhuà USB zhǔjī duānkǒu" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" @@ -3332,7 +3332,7 @@ msgstr "shū rù dtype bì xū shì fú diǎn xíng huò fù shù" #: extmod/ulab/code/numpy/poly.c msgid "input is not iterable" -msgstr "" +msgstr "shūrù bùkě diédài" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" From 2077ac150b2b67955a4f3e573a3f6007b4c5a5db Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 7 Aug 2023 11:51:52 -0500 Subject: [PATCH 1436/1712] Apply suggestions from code review Co-authored-by: Scott Shawcroft --- ports/raspberrypi/common-hal/rp2pio/StateMachine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index 4ac57397e0..e2385d427d 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -410,7 +410,7 @@ typedef struct { bool tx_fifo, rx_fifo, in_loaded, out_loaded, in_used, out_used; } introspect_t; -static void consider_instruction(introspect_t *state, uint16_t full_instruction, qstr what, size_t i) { +static void consider_instruction(introspect_t *state, uint16_t full_instruction, qstr what_program, size_t i) { uint16_t instruction = full_instruction & 0xe000; if (instruction == 0x8000) { if ((full_instruction & 0xe080) == pio_instr_bits_push) { From 755fdfab7ada7a8503975ba36ac111a384c40976 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 7 Aug 2023 16:26:57 -0500 Subject: [PATCH 1437/1712] rename variable based on review --- .../common-hal/rp2pio/StateMachine.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index e2385d427d..c4e11133c2 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -424,21 +424,21 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, if (instruction == pio_instr_bits_jmp) { uint16_t condition = (full_instruction & 0x00e0) >> 5; if ((condition == 0x6) && !state->has_jmp_pin) { - mp_raise_ValueError_varg(translate("Missing jmp_pin. %q[%u] jumps on pin"), what, i); + mp_raise_ValueError_varg(translate("Missing jmp_pin. %q[%u] jumps on pin"), what_program, i); } } if (instruction == pio_instr_bits_wait) { uint16_t wait_source = (full_instruction & 0x0060) >> 5; uint16_t wait_index = full_instruction & 0x001f; if (wait_source == 0 && (state->pins_we_use & (1 << wait_index)) == 0) { // GPIO - mp_raise_ValueError_varg(translate("%q[%u] uses extra pin"), what, i); + mp_raise_ValueError_varg(translate("%q[%u] uses extra pin"), what_program, i); } if (wait_source == 1) { // Input pin if (!state->has_in_pin) { - mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] waits based on pin"), what, i); + mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] waits based on pin"), what_program, i); } if (wait_index >= state->in_pin_count) { - mp_raise_ValueError_varg(translate("%q[%u] waits on input outside of count"), what, i); + mp_raise_ValueError_varg(translate("%q[%u] waits on input outside of count"), what_program, i); } } } @@ -447,10 +447,10 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, uint16_t bit_count = full_instruction & 0x001f; if (source == 0) { if (!state->has_in_pin) { - mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] shifts in from pin(s)"), what, i); + mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] shifts in from pin(s)"), what_program, i); } if (bit_count > state->in_pin_count) { - mp_raise_ValueError_varg(translate("%q[%u] shifts in more bits than pin count"), what, i); + mp_raise_ValueError_varg(translate("%q[%u] shifts in more bits than pin count"), what_program, i); } } if (state->auto_push) { @@ -465,10 +465,10 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, // Check for pins or pindirs destination. if (destination == 0x0 || destination == 0x4) { if (!state->has_out_pin) { - mp_raise_ValueError_varg(translate("Missing first_out_pin. %q[%u] shifts out to pin(s)"), what, i); + mp_raise_ValueError_varg(translate("Missing first_out_pin. %q[%u] shifts out to pin(s)"), what_program, i); } if (bit_count > state->out_pin_count) { - mp_raise_ValueError_varg(translate("%q[%u] shifts out more bits than pin count"), what, i); + mp_raise_ValueError_varg(translate("%q[%u] shifts out more bits than pin count"), what_program, i); } } if (state->auto_pull) { @@ -481,7 +481,7 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, uint16_t destination = (full_instruction & 0x00e0) >> 5; // Check for pins or pindirs destination. if ((destination == 0x00 || destination == 0x4) && !state->has_set_pin) { - mp_raise_ValueError_varg(translate("Missing first_set_pin. %q[%u] sets pin(s)"), what, i); + mp_raise_ValueError_varg(translate("Missing first_set_pin. %q[%u] sets pin(s)"), what_program, i); } } if (instruction == pio_instr_bits_mov) { @@ -489,10 +489,10 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, uint16_t destination = (full_instruction & 0x00e0) >> 5; // Check for pins or pindirs destination. if (destination == 0x0 && !state->has_out_pin) { - mp_raise_ValueError_varg(translate("Missing first_out_pin. %q[%u] writes pin(s)"), what, i); + mp_raise_ValueError_varg(translate("Missing first_out_pin. %q[%u] writes pin(s)"), what_program, i); } if (source == 0x0 && !state->has_in_pin) { - mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] reads pin(s)"), what, i); + mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] reads pin(s)"), what_program, i); } if (destination == 0x6) { state->in_loaded = true; @@ -502,9 +502,9 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, } } -static void consider_program(introspect_t *state, const uint16_t *program, size_t program_len, qstr what) { +static void consider_program(introspect_t *state, const uint16_t *program, size_t program_len, qstr what_program) { for (size_t i = 0; i < program_len; i++) { - consider_instruction(state, program[i], what, i); + consider_instruction(state, program[i], what_program, i); } } From e06f836e952e96bb42d41fdea60d58b85415131a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 7 Aug 2023 16:28:35 -0500 Subject: [PATCH 1438/1712] add may_exec to parameter list --- ports/raspberrypi/bindings/rp2pio/StateMachine.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index ae89fcdffb..cce64ac8c3 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -62,6 +62,7 @@ //| program: ReadableBuffer, //| frequency: int, //| *, +//| may_exec: Optional[ReadableBuffer] = None, //| init: Optional[ReadableBuffer] = None, //| first_out_pin: Optional[microcontroller.Pin] = None, //| out_pin_count: int = 1, From 0d2c3c3f089d865c2920a4f442e24b3489b10b96 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 7 Aug 2023 20:45:57 -0400 Subject: [PATCH 1439/1712] wip: continuing compilation fixes; mp_obj_alloc everywhere --- devices/ble_hci/common-hal/_bleio/Adapter.c | 33 ++++------ .../ble_hci/common-hal/_bleio/Connection.c | 22 +++---- devices/ble_hci/common-hal/_bleio/Service.c | 3 +- extmod/moduhashlib.c | 2 +- ports/atmel-samd/bindings/samd/__init__.c | 2 +- .../usermods/_bhb/bhb.c | 2 +- ports/atmel-samd/common-hal/canio/Listener.c | 4 +- ports/broadcom/bindings/videocore/__init__.c | 2 +- ports/espressif/bindings/espcamera/Camera.c | 3 +- ports/espressif/bindings/espcamera/__init__.c | 2 +- ports/espressif/bindings/espnow/ESPNow.c | 3 +- ports/espressif/bindings/espnow/Peer.c | 3 +- ports/espressif/bindings/espnow/Peers.c | 3 +- ports/espressif/bindings/espnow/__init__.c | 2 +- ports/espressif/bindings/espulp/ULP.c | 3 +- ports/espressif/bindings/espulp/ULPAlarm.c | 3 +- ports/espressif/bindings/espulp/__init__.c | 2 +- ports/espressif/common-hal/_bleio/Adapter.c | 3 +- .../espressif/common-hal/_bleio/Connection.c | 49 ++++----------- ports/espressif/common-hal/canio/Listener.c | 4 +- ports/espressif/common-hal/espidf/__init__.c | 2 +- ports/espressif/common-hal/wifi/Radio.c | 6 +- .../common-hal/wifi/ScannedNetworks.c | 3 +- ports/nrf/boards/bluemicro833/mpconfigboard.h | 3 - ports/nrf/boards/pca10100/mpconfigboard.h | 3 - ports/nrf/common-hal/_bleio/Adapter.c | 3 +- ports/nrf/common-hal/_bleio/Connection.c | 22 +++---- ports/raspberrypi/bindings/cyw43/__init__.c | 2 +- ports/raspberrypi/bindings/picodvi/__init__.c | 2 +- .../bindings/rp2pio/StateMachine.c | 3 +- ports/raspberrypi/bindings/rp2pio/__init__.c | 2 +- ports/raspberrypi/common-hal/wifi/Radio.c | 3 +- .../common-hal/wifi/ScannedNetworks.c | 3 +- .../boards/devkit_xg24_brd2601b/sensor.c | 2 +- ports/silabs/common-hal/_bleio/Adapter.c | 3 +- ports/silabs/common-hal/_bleio/Connection.c | 3 +- ports/silabs/common-hal/_bleio/__init__.c | 26 ++------ ports/stm/common-hal/canio/Listener.c | 4 +- ports/unix/displayio_min.c | 2 +- py/builtin.h | 2 +- py/builtinimport.c | 2 + py/circuitpy_mpconfig.h | 8 --- py/gc_long_lived.c | 60 +++++++++---------- py/obj.c | 4 +- py/obj.h | 48 ++++++++++++--- py/objfun.h | 3 +- py/qstr.c | 24 ++------ py/qstr.h | 2 + shared-bindings/__future__/__init__.c | 2 +- shared-bindings/_bleio/Address.c | 3 +- shared-bindings/_bleio/Characteristic.c | 4 +- shared-bindings/_bleio/CharacteristicBuffer.c | 4 +- shared-bindings/_bleio/Descriptor.c | 3 +- shared-bindings/_bleio/PacketBuffer.c | 3 +- shared-bindings/_bleio/Service.c | 3 +- shared-bindings/_bleio/UUID.c | 3 +- shared-bindings/_bleio/__init__.c | 2 +- shared-bindings/_eve/__init__.c | 5 +- shared-bindings/_pew/PewPew.c | 3 +- shared-bindings/_pixelmap/PixelMap.c | 3 +- shared-bindings/_pixelmap/__init__.c | 2 +- shared-bindings/_stage/Layer.c | 3 +- shared-bindings/_stage/Text.c | 3 +- shared-bindings/_stage/__init__.c | 2 +- .../adafruit_bus_device/__init__.c | 6 +- .../i2c_device/I2CDevice.c | 4 +- .../spi_device/SPIDevice.c | 4 +- shared-bindings/adafruit_pixelbuf/PixelBuf.c | 3 +- shared-bindings/adafruit_pixelbuf/__init__.c | 2 +- shared-bindings/aesio/__init__.c | 2 +- shared-bindings/aesio/aes.c | 3 +- shared-bindings/alarm/__init__.c | 2 +- shared-bindings/alarm/pin/PinAlarm.c | 3 +- shared-bindings/alarm/time/TimeAlarm.c | 3 +- shared-bindings/alarm/touch/TouchAlarm.c | 3 +- shared-bindings/analogbufio/__init__.c | 2 +- shared-bindings/analogio/AnalogIn.c | 3 +- shared-bindings/analogio/AnalogOut.c | 3 +- shared-bindings/analogio/__init__.c | 2 +- shared-bindings/atexit/__init__.c | 2 +- shared-bindings/audiobusio/PDMIn.c | 3 +- shared-bindings/audiobusio/__init__.c | 2 +- shared-bindings/audiocore/RawSample.c | 3 +- shared-bindings/audiocore/WaveFile.c | 3 +- shared-bindings/audiocore/__init__.c | 2 +- shared-bindings/audioio/AudioOut.c | 3 +- shared-bindings/audioio/__init__.c | 2 +- shared-bindings/audiomixer/Mixer.c | 4 +- shared-bindings/audiomixer/MixerVoice.c | 3 +- shared-bindings/audiomixer/__init__.c | 2 +- shared-bindings/audiomp3/MP3Decoder.c | 3 +- shared-bindings/audiomp3/__init__.c | 2 +- shared-bindings/audiopwmio/__init__.c | 2 +- shared-bindings/bitbangio/I2C.c | 3 +- shared-bindings/bitbangio/SPI.c | 3 +- shared-bindings/bitbangio/__init__.c | 2 +- shared-bindings/bitmaptools/__init__.c | 2 +- shared-bindings/bitops/__init__.c | 2 +- shared-bindings/board/__init__.c | 2 +- shared-bindings/busio/I2C.c | 3 +- shared-bindings/busio/SPI.c | 3 +- shared-bindings/busio/__init__.c | 2 +- shared-bindings/camera/Camera.c | 3 +- shared-bindings/camera/__init__.c | 2 +- shared-bindings/canio/CAN.c | 3 +- shared-bindings/canio/Match.c | 3 +- shared-bindings/canio/Message.c | 3 +- .../canio/RemoteTransmissionRequest.c | 4 +- shared-bindings/canio/__init__.c | 2 +- shared-bindings/countio/__init__.c | 3 +- shared-bindings/digitalio/DigitalInOut.c | 3 +- shared-bindings/digitalio/__init__.c | 2 +- shared-bindings/displayio/Bitmap.c | 3 +- shared-bindings/displayio/ColorConverter.c | 3 +- shared-bindings/displayio/Group.c | 3 +- shared-bindings/displayio/OnDiskBitmap.c | 3 +- shared-bindings/displayio/Palette.c | 3 +- shared-bindings/displayio/Shape.c | 3 +- shared-bindings/displayio/TileGrid.c | 3 +- shared-bindings/displayio/__init__.c | 2 +- shared-bindings/dualbank/__init__.c | 2 +- shared-bindings/floppyio/__init__.c | 2 +- shared-bindings/fontio/__init__.c | 2 +- shared-bindings/framebufferio/__init__.c | 2 +- shared-bindings/frequencyio/FrequencyIn.c | 4 +- shared-bindings/frequencyio/__init__.c | 2 +- shared-bindings/getpass/__init__.c | 2 +- shared-bindings/gifio/GifWriter.c | 3 +- shared-bindings/gifio/OnDiskGif.c | 3 +- shared-bindings/gifio/__init__.c | 2 +- shared-bindings/gnss/GNSS.c | 3 +- shared-bindings/gnss/__init__.c | 2 +- shared-bindings/hashlib/__init__.c | 5 +- shared-bindings/i2ctarget/I2CTarget.c | 7 +-- shared-bindings/i2ctarget/__init__.c | 5 +- .../imagecapture/ParallelImageCapture.c | 4 +- shared-bindings/imagecapture/__init__.c | 2 +- shared-bindings/ipaddress/IPv4Address.c | 3 +- shared-bindings/ipaddress/__init__.c | 2 +- shared-bindings/is31fl3741/IS31FL3741.c | 3 +- shared-bindings/is31fl3741/__init__.c | 2 +- shared-bindings/keypad/Event.c | 3 +- shared-bindings/keypad/KeyMatrix.c | 3 +- shared-bindings/keypad/Keys.c | 3 +- shared-bindings/keypad/ShiftRegisterKeys.c | 4 +- shared-bindings/keypad/__init__.c | 2 +- shared-bindings/math/__init__.c | 2 +- shared-bindings/mdns/__init__.c | 2 +- shared-bindings/memorymap/AddressRange.c | 3 +- shared-bindings/memorymap/__init__.c | 2 +- .../memorymonitor/AllocationAlarm.c | 4 +- .../memorymonitor/AllocationSize.c | 4 +- shared-bindings/memorymonitor/__init__.c | 2 +- shared-bindings/microcontroller/__init__.c | 2 +- shared-bindings/msgpack/ExtType.c | 3 +- shared-bindings/msgpack/__init__.c | 2 +- shared-bindings/neopixel_write/__init__.c | 2 +- shared-bindings/nvm/__init__.c | 2 +- shared-bindings/onewireio/OneWire.c | 3 +- shared-bindings/onewireio/__init__.c | 2 +- shared-bindings/os/__init__.c | 2 +- shared-bindings/paralleldisplay/__init__.c | 2 +- shared-bindings/ps2io/Ps2.c | 3 +- shared-bindings/ps2io/__init__.c | 2 +- shared-bindings/pulseio/PulseOut.c | 3 +- shared-bindings/pulseio/__init__.c | 2 +- shared-bindings/pwmio/PWMOut.c | 3 +- shared-bindings/pwmio/__init__.c | 2 +- shared-bindings/qrio/QRDecoder.c | 3 +- shared-bindings/qrio/__init__.c | 2 +- shared-bindings/rainbowio/__init__.c | 2 +- shared-bindings/random/__init__.c | 2 +- shared-bindings/rgbmatrix/__init__.c | 2 +- shared-bindings/rotaryio/__init__.c | 2 +- shared-bindings/rtc/__init__.c | 2 +- shared-bindings/sdcardio/SDCard.c | 3 +- shared-bindings/sdcardio/__init__.c | 2 +- shared-bindings/sdioio/SDCard.c | 3 +- shared-bindings/sdioio/__init__.c | 2 +- shared-bindings/sharpdisplay/__init__.c | 2 +- shared-bindings/socketpool/__init__.c | 2 +- shared-bindings/ssl/SSLContext.c | 3 +- shared-bindings/ssl/__init__.c | 5 +- shared-bindings/storage/__init__.c | 2 +- shared-bindings/struct/__init__.c | 2 +- shared-bindings/supervisor/__init__.c | 5 +- shared-bindings/synthio/LFO.c | 3 +- shared-bindings/synthio/Math.c | 3 +- shared-bindings/synthio/MidiTrack.c | 3 +- shared-bindings/synthio/Note.c | 3 +- shared-bindings/synthio/Synthesizer.c | 3 +- shared-bindings/synthio/__init__.c | 5 +- shared-bindings/terminalio/Terminal.c | 3 +- shared-bindings/terminalio/__init__.c | 2 +- shared-bindings/time/__init__.c | 2 +- shared-bindings/touchio/TouchIn.c | 3 +- shared-bindings/touchio/__init__.c | 2 +- shared-bindings/traceback/__init__.c | 2 +- shared-bindings/uheap/__init__.c | 2 +- shared-bindings/usb/__init__.c | 2 +- shared-bindings/usb/core/__init__.c | 5 +- shared-bindings/usb_cdc/__init__.c | 2 +- shared-bindings/usb_hid/Device.c | 3 +- shared-bindings/usb_hid/__init__.c | 2 +- shared-bindings/usb_host/Port.c | 3 +- shared-bindings/usb_host/__init__.c | 2 +- shared-bindings/usb_midi/__init__.c | 2 +- shared-bindings/ustack/__init__.c | 2 +- shared-bindings/vectorio/Circle.c | 3 +- shared-bindings/vectorio/Polygon.c | 3 +- shared-bindings/vectorio/Rectangle.c | 3 +- shared-bindings/vectorio/VectorShape.c | 3 +- shared-bindings/vectorio/__init__.c | 2 +- shared-bindings/watchdog/__init__.c | 2 +- shared-bindings/wifi/Monitor.c | 3 +- shared-bindings/wifi/__init__.c | 2 +- shared-bindings/zlib/__init__.c | 2 +- shared-module/_bleio/ScanResults.c | 9 +-- shared-module/displayio/OnDiskBitmap.c | 7 +-- shared-module/gifio/OnDiskGif.c | 6 +- shared-module/ipaddress/__init__.c | 3 +- shared-module/keypad/EventQueue.c | 3 +- shared-module/keypad/KeyMatrix.c | 7 ++- shared-module/keypad/Keys.c | 4 +- shared-module/keypad/ShiftRegisterKeys.c | 12 ++-- shared-module/keypad/__init__.c | 3 +- shared-module/msgpack/__init__.c | 3 +- shared-module/touchio/TouchIn.c | 3 +- 228 files changed, 377 insertions(+), 544 deletions(-) diff --git a/devices/ble_hci/common-hal/_bleio/Adapter.c b/devices/ble_hci/common-hal/_bleio/Adapter.c index 843c143424..bd936f3687 100644 --- a/devices/ble_hci/common-hal/_bleio/Adapter.c +++ b/devices/ble_hci/common-hal/_bleio/Adapter.c @@ -82,28 +82,23 @@ STATIC void add_generic_services(bleio_adapter_obj_t *adapter) { // Generic Access Service setup. - bleio_uuid_obj_t *generic_access_service_uuid = m_new_obj(bleio_uuid_obj_t); - generic_access_service_uuid->base.type = &bleio_uuid_type; + bleio_uuid_obj_t *generic_access_service_uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); common_hal_bleio_uuid_construct(generic_access_service_uuid, 0x1800, NULL); - bleio_uuid_obj_t *device_name_characteristic_uuid = m_new_obj(bleio_uuid_obj_t); - device_name_characteristic_uuid->base.type = &bleio_uuid_type; + bleio_uuid_obj_t *device_name_characteristic_uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); common_hal_bleio_uuid_construct(device_name_characteristic_uuid, 0x2A00, NULL); - bleio_uuid_obj_t *appearance_characteristic_uuid = m_new_obj(bleio_uuid_obj_t); - appearance_characteristic_uuid->base.type = &bleio_uuid_type; + bleio_uuid_obj_t *appearance_characteristic_uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); common_hal_bleio_uuid_construct(appearance_characteristic_uuid, 0x2A01, NULL); // Not implemented: // Peripheral Preferred Connection Parameters // Central Address Resolution - bleio_service_obj_t *generic_access_service = m_new_obj(bleio_service_obj_t); - generic_access_service->base.type = &bleio_service_type; + bleio_service_obj_t *generic_access_service = mp_obj_malloc(bleio_service_obj_t, &bleio_service_type); common_hal_bleio_service_construct(generic_access_service, generic_access_service_uuid, false); - adapter->device_name_characteristic = m_new_obj(bleio_characteristic_obj_t); - adapter->device_name_characteristic->base.type = &bleio_characteristic_type; + adapter->device_name_characteristic = mp_obj_malloc(bleio_characteristic_obj_t, &bleio_characteristic_type); char generic_name[] = { 'C', 'I', 'R', 'C', 'U', 'I', 'T', 'P', 'Y', 'n', 'n', 'n', 'n' }; mp_buffer_info_t generic_name_bufinfo = { @@ -132,8 +127,7 @@ STATIC void add_generic_services(bleio_adapter_obj_t *adapter) { .len = sizeof(zero_16), }; - adapter->appearance_characteristic = m_new_obj(bleio_characteristic_obj_t); - adapter->appearance_characteristic->base.type = &bleio_characteristic_type; + adapter->appearance_characteristic = mp_obj_malloc(bleio_characteristic_obj_t, &bleio_characteristic_type); common_hal_bleio_characteristic_construct( adapter->appearance_characteristic, @@ -151,20 +145,16 @@ STATIC void add_generic_services(bleio_adapter_obj_t *adapter) { // Generic Attribute Service setup. - bleio_uuid_obj_t *generic_attribute_service_uuid = m_new_obj(bleio_uuid_obj_t); - generic_attribute_service_uuid->base.type = &bleio_uuid_type; + bleio_uuid_obj_t *generic_attribute_service_uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); common_hal_bleio_uuid_construct(generic_attribute_service_uuid, 0x1801, NULL); - bleio_uuid_obj_t *service_changed_characteristic_uuid = m_new_obj(bleio_uuid_obj_t); - service_changed_characteristic_uuid->base.type = &bleio_uuid_type; + bleio_uuid_obj_t *service_changed_characteristic_uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); common_hal_bleio_uuid_construct(service_changed_characteristic_uuid, 0x2A05, NULL); - bleio_service_obj_t *generic_attribute_service = m_new_obj(bleio_service_obj_t); - generic_attribute_service->base.type = &bleio_service_type; + bleio_service_obj_t *generic_attribute_service = mp_obj_malloc(bleio_service_obj_t, &bleio_service_type); common_hal_bleio_service_construct(generic_attribute_service, generic_attribute_service_uuid, false); - adapter->service_changed_characteristic = m_new_obj(bleio_characteristic_obj_t); - adapter->service_changed_characteristic->base.type = &bleio_characteristic_type; + adapter->service_changed_characteristic = mp_obj_malloc(bleio_characteristic_obj_t, &bleio_characteristic_type); uint32_t zero_32 = 0; mp_buffer_info_t zero_32_value = { @@ -416,8 +406,7 @@ bleio_address_obj_t *common_hal_bleio_adapter_get_address(bleio_adapter_obj_t *s bt_addr_t addr; hci_check_error(hci_read_bd_addr(&addr)); - bleio_address_obj_t *address = m_new_obj(bleio_address_obj_t); - address->base.type = &bleio_address_type; + bleio_address_obj_t *address = mp_obj_malloc(bleio_address_obj_t, &bleio_address_type); common_hal_bleio_address_construct(address, addr.val, BT_ADDR_LE_PUBLIC); return address; diff --git a/devices/ble_hci/common-hal/_bleio/Connection.c b/devices/ble_hci/common-hal/_bleio/Connection.c index e9e1254b43..b1e2ac6f39 100644 --- a/devices/ble_hci/common-hal/_bleio/Connection.c +++ b/devices/ble_hci/common-hal/_bleio/Connection.c @@ -453,8 +453,7 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern // for (size_t i = 0; i < response->count; ++i) { // ble_gattc_service_t *gattc_service = &response->services[i]; -// bleio_service_obj_t *service = m_new_obj(bleio_service_obj_t); -// service->base.type = &bleio_service_type; +// bleio_service_obj_t *service = mp_obj_malloc(bleio_service_obj_t, &bleio_service_type); // // Initialize several fields at once. // bleio_service_from_connection(service, bleio_connection_new_from_internal(connection)); @@ -466,8 +465,7 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern // if (gattc_service->uuid.type != BLE_UUID_TYPE_UNKNOWN) { // // Known service UUID. -// bleio_uuid_obj_t *uuid = m_new_obj(bleio_uuid_obj_t); -// uuid->base.type = &bleio_uuid_type; +// bleio_uuid_obj_t *uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); // bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_service->uuid); // service->uuid = uuid; // } else { @@ -491,15 +489,14 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern // for (size_t i = 0; i < response->count; ++i) { // ble_gattc_char_t *gattc_char = &response->chars[i]; -// bleio_characteristic_obj_t *characteristic = m_new_obj(bleio_characteristic_obj_t); -// characteristic->base.type = &bleio_characteristic_type; +// bleio_characteristic_obj_t *characteristic = +// mp_obj_malloc(bleio_characteristic_obj_t, &bleio_characteristic_type); // bleio_uuid_obj_t *uuid = NULL; // if (gattc_char->uuid.type != BLE_UUID_TYPE_UNKNOWN) { // // Known characteristic UUID. -// uuid = m_new_obj(bleio_uuid_obj_t); -// uuid->base.type = &bleio_uuid_type; +// uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); // bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_char->uuid); // } else { // // The discovery response contained a 128-bit UUID that has not yet been registered with the @@ -557,15 +554,13 @@ void common_hal_bleio_connection_set_connection_interval(bleio_connection_intern // break; // } -// bleio_descriptor_obj_t *descriptor = m_new_obj(bleio_descriptor_obj_t); -// descriptor->base.type = &bleio_descriptor_type; +// bleio_descriptor_obj_t *descriptor = mp_obj_malloc(bleio_descriptor_obj_t, &bleio_descriptor_type); // bleio_uuid_obj_t *uuid = NULL; // if (gattc_desc->uuid.type != BLE_UUID_TYPE_UNKNOWN) { // // Known descriptor UUID. -// uuid = m_new_obj(bleio_uuid_obj_t); -// uuid->base.type = &bleio_uuid_type; +// uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); // bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_desc->uuid); // } else { // // The discovery response contained a 128-bit UUID that has not yet been registered with the @@ -750,8 +745,7 @@ mp_obj_t bleio_connection_new_from_internal(bleio_connection_internal_t *interna if (internal->connection_obj != mp_const_none) { return internal->connection_obj; } - bleio_connection_obj_t *connection = m_new_obj(bleio_connection_obj_t); - connection->base.type = &bleio_connection_type; + bleio_connection_obj_t *connection = mp_obj_malloc(bleio_connection_obj_t, &bleio_connection_type); connection->connection = internal; internal->connection_obj = connection; diff --git a/devices/ble_hci/common-hal/_bleio/Service.c b/devices/ble_hci/common-hal/_bleio/Service.c index 11b7efd523..6aff981f8e 100644 --- a/devices/ble_hci/common-hal/_bleio/Service.c +++ b/devices/ble_hci/common-hal/_bleio/Service.c @@ -101,8 +101,7 @@ void common_hal_bleio_service_add_characteristic(bleio_service_obj_t *self, if (characteristic->props & (CHAR_PROP_NOTIFY | CHAR_PROP_INDICATE)) { // We need a CCCD if this characteristic is doing notify or indicate. - bleio_descriptor_obj_t *cccd = m_new_obj(bleio_descriptor_obj_t); - cccd->base.type = &bleio_descriptor_type; + bleio_descriptor_obj_t *cccd = mp_obj_malloc(bleio_descriptor_obj_t, &bleio_descriptor_type); uint16_t zero = 0; mp_buffer_info_t zero_cccd_value = { diff --git a/extmod/moduhashlib.c b/extmod/moduhashlib.c index c35af3d02b..11f8d1e03d 100644 --- a/extmod/moduhashlib.c +++ b/extmod/moduhashlib.c @@ -382,6 +382,6 @@ const mp_obj_module_t mp_module_uhashlib = { .globals = (mp_obj_dict_t *)&mp_module_uhashlib_globals, }; -MP_REGISTER_MODULE(MP_QSTR_uhashlib, mp_module_uhashlib, MICROPY_PY_UHASHLIB); +MP_REGISTER_MODULE(MP_QSTR_uhashlib, mp_module_uhashlib); #endif // MICROPY_PY_UHASHLIB diff --git a/ports/atmel-samd/bindings/samd/__init__.c b/ports/atmel-samd/bindings/samd/__init__.c index 29d12357d1..8f36452926 100644 --- a/ports/atmel-samd/bindings/samd/__init__.c +++ b/ports/atmel-samd/bindings/samd/__init__.c @@ -57,4 +57,4 @@ const mp_obj_module_t samd_module = { .globals = (mp_obj_dict_t *)&samd_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_samd, samd_module, CIRCUITPY_SAMD); +MP_REGISTER_MODULE(MP_QSTR_samd, samd_module); diff --git a/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/bhb.c b/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/bhb.c index 1a340ae226..8feca31817 100644 --- a/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/bhb.c +++ b/ports/atmel-samd/boards/winterbloom_big_honking_button/usermods/_bhb/bhb.c @@ -127,4 +127,4 @@ const mp_obj_module_t _bhb_user_cmodule = { .globals = (mp_obj_dict_t *)&_bhb_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR__bhb, _bhb_user_cmodule, MODULE_BHB_ENABLED); +MP_REGISTER_MODULE(MP_QSTR__bhb, _bhb_user_cmodule); diff --git a/ports/atmel-samd/common-hal/canio/Listener.c b/ports/atmel-samd/common-hal/canio/Listener.c index 5cdfafe9c0..28e82d7818 100644 --- a/ports/atmel-samd/common-hal/canio/Listener.c +++ b/ports/atmel-samd/common-hal/canio/Listener.c @@ -368,8 +368,8 @@ mp_obj_t common_hal_canio_listener_receive(canio_listener_obj_t *self) { int index = self->hw->RXFS.bit.F0GI; canio_can_rx_fifo_t *hw_message = &self->fifo[index]; bool rtr = hw_message->rxf0.bit.RTR; - canio_message_obj_t *message = m_new_obj(canio_message_obj_t); - message->base.type = rtr ? &canio_remote_transmission_request_type : &canio_message_type; + canio_message_obj_t *message = + mp_obj_malloc(canio_message_obj_t, rtr ? &canio_remote_transmission_request_type : &canio_message_type); message->extended = hw_message->rxf0.bit.XTD; if (message->extended) { message->id = hw_message->rxf0.bit.ID; diff --git a/ports/broadcom/bindings/videocore/__init__.c b/ports/broadcom/bindings/videocore/__init__.c index 9ec345dae7..ffb90680ef 100644 --- a/ports/broadcom/bindings/videocore/__init__.c +++ b/ports/broadcom/bindings/videocore/__init__.c @@ -45,4 +45,4 @@ const mp_obj_module_t videocore_module = { .globals = (mp_obj_dict_t *)&videocore_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_videocore, videocore_module, CIRCUITPY_VIDEOCORE); +MP_REGISTER_MODULE(MP_QSTR_videocore, videocore_module); diff --git a/ports/espressif/bindings/espcamera/Camera.c b/ports/espressif/bindings/espcamera/Camera.c index 5fb9576e58..109ed5cffe 100644 --- a/ports/espressif/bindings/espcamera/Camera.c +++ b/ports/espressif/bindings/espcamera/Camera.c @@ -143,8 +143,7 @@ STATIC mp_obj_t espcamera_camera_make_new(const mp_obj_type_t *type, size_t n_ar mp_int_t jpeg_quality = mp_arg_validate_int_range(args[ARG_jpeg_quality].u_int, 2, 55, MP_QSTR_jpeg_quality); mp_int_t framebuffer_count = mp_arg_validate_int_range(args[ARG_framebuffer_count].u_int, 1, 2, MP_QSTR_framebuffer_count); - espcamera_camera_obj_t *self = m_new_obj(espcamera_camera_obj_t); - self->base.type = &espcamera_camera_type; + espcamera_camera_obj_t *self = mp_obj_malloc(espcamera_camera_obj_t, &espcamera_camera_type); common_hal_espcamera_camera_construct( self, data_pins, diff --git a/ports/espressif/bindings/espcamera/__init__.c b/ports/espressif/bindings/espcamera/__init__.c index 633f547fe9..3963f46bfe 100644 --- a/ports/espressif/bindings/espcamera/__init__.c +++ b/ports/espressif/bindings/espcamera/__init__.c @@ -285,4 +285,4 @@ const mp_obj_module_t espcamera_module = { .globals = (mp_obj_dict_t *)&espcamera_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_espcamera, espcamera_module, CIRCUITPY_ESPCAMERA); +MP_REGISTER_MODULE(MP_QSTR_espcamera, espcamera_module); diff --git a/ports/espressif/bindings/espnow/ESPNow.c b/ports/espressif/bindings/espnow/ESPNow.c index 78d80924fd..2caabd13c3 100644 --- a/ports/espressif/bindings/espnow/ESPNow.c +++ b/ports/espressif/bindings/espnow/ESPNow.c @@ -78,8 +78,7 @@ STATIC mp_obj_t espnow_make_new(const mp_obj_type_t *type, size_t n_args, size_t } // Allocate a new object - self = m_new_obj(espnow_obj_t); - self->base.type = &espnow_type; + self = mp_obj_malloc(espnow_obj_t, &espnow_type); // Construct the object common_hal_espnow_construct(self, args[ARG_buffer_size].u_int, args[ARG_phy_rate].u_int); diff --git a/ports/espressif/bindings/espnow/Peer.c b/ports/espressif/bindings/espnow/Peer.c index f69bec01e6..98b65c5bdc 100644 --- a/ports/espressif/bindings/espnow/Peer.c +++ b/ports/espressif/bindings/espnow/Peer.c @@ -65,8 +65,7 @@ STATIC mp_obj_t espnow_peer_make_new(const mp_obj_type_t *type, size_t n_args, s mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - espnow_peer_obj_t *self = m_new_obj(espnow_peer_obj_t); - self->base.type = &espnow_peer_type; + espnow_peer_obj_t *self = mp_obj_malloc(espnow_peer_obj_t, &espnow_peer_type); self->peer_info = (esp_now_peer_info_t) { .channel = 0, .ifidx = WIFI_IF_STA, diff --git a/ports/espressif/bindings/espnow/Peers.c b/ports/espressif/bindings/espnow/Peers.c index 6fda9aed7a..096a5266a0 100644 --- a/ports/espressif/bindings/espnow/Peers.c +++ b/ports/espressif/bindings/espnow/Peers.c @@ -118,8 +118,7 @@ STATIC mp_obj_t espnow_peers_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_b } espnow_peers_obj_t *espnow_peers_new(void) { - espnow_peers_obj_t *self = m_new_obj(espnow_peers_obj_t); - self->base.type = &espnow_peers_type; + espnow_peers_obj_t *self = mp_obj_malloc(espnow_peers_obj_t, &espnow_peers_type); self->list = mp_obj_new_list(0, NULL); return self; } diff --git a/ports/espressif/bindings/espnow/__init__.c b/ports/espressif/bindings/espnow/__init__.c index 3135858601..e0493a2897 100644 --- a/ports/espressif/bindings/espnow/__init__.c +++ b/ports/espressif/bindings/espnow/__init__.c @@ -91,4 +91,4 @@ const mp_obj_module_t espnow_module = { .globals = (mp_obj_dict_t *)&espnow_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_espnow, espnow_module, CIRCUITPY_ESPNOW); +MP_REGISTER_MODULE(MP_QSTR_espnow, espnow_module); diff --git a/ports/espressif/bindings/espulp/ULP.c b/ports/espressif/bindings/espulp/ULP.c index c9666fb143..09453c9a09 100644 --- a/ports/espressif/bindings/espulp/ULP.c +++ b/ports/espressif/bindings/espulp/ULP.c @@ -52,8 +52,7 @@ STATIC mp_obj_t espulp_ulp_make_new(const mp_obj_type_t *type, size_t n_args, si const espulp_architecture_t arch = cp_enum_value(&espulp_architecture_type, args[ARG_arch].u_obj, MP_QSTR_arch); - espulp_ulp_obj_t *self = m_new_obj(espulp_ulp_obj_t); - self->base.type = &espulp_ulp_type; + espulp_ulp_obj_t *self = mp_obj_malloc(espulp_ulp_obj_t, &espulp_ulp_type); common_hal_espulp_ulp_construct(self, arch); diff --git a/ports/espressif/bindings/espulp/ULPAlarm.c b/ports/espressif/bindings/espulp/ULPAlarm.c index 6efd1c98ef..b8b0a7c122 100644 --- a/ports/espressif/bindings/espulp/ULPAlarm.c +++ b/ports/espressif/bindings/espulp/ULPAlarm.c @@ -50,8 +50,7 @@ STATIC mp_obj_t espulp_ulpalarm_make_new(const mp_obj_type_t *type, size_t n_arg mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - espulp_ulpalarm_obj_t *self = m_new_obj(espulp_ulpalarm_obj_t); - self->base.type = &espulp_ulpalarm_type; + espulp_ulpalarm_obj_t *self = mp_obj_malloc(espulp_ulpalarm_obj_t, &espulp_ulpalarm_type); espulp_ulp_obj_t *ulp = mp_arg_validate_type(args[ARG_ulp].u_obj, &espulp_ulp_type, MP_QSTR_ulp); diff --git a/ports/espressif/bindings/espulp/__init__.c b/ports/espressif/bindings/espulp/__init__.c index f2b688dda4..36f50e8949 100644 --- a/ports/espressif/bindings/espulp/__init__.c +++ b/ports/espressif/bindings/espulp/__init__.c @@ -91,4 +91,4 @@ const mp_obj_module_t espulp_module = { .globals = (mp_obj_dict_t *)&espulp_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_espulp, espulp_module, CIRCUITPY_ESPULP); +MP_REGISTER_MODULE(MP_QSTR_espulp, espulp_module); diff --git a/ports/espressif/common-hal/_bleio/Adapter.c b/ports/espressif/common-hal/_bleio/Adapter.c index 01adae3adb..24452993cb 100644 --- a/ports/espressif/common-hal/_bleio/Adapter.c +++ b/ports/espressif/common-hal/_bleio/Adapter.c @@ -142,8 +142,7 @@ bleio_address_obj_t *common_hal_bleio_adapter_get_address(bleio_adapter_obj_t *s return NULL; } - bleio_address_obj_t *address = m_new_obj(bleio_address_obj_t); - address->base.type = &bleio_address_type; + bleio_address_obj_t *address = mp_obj_malloc(bleio_address_obj_t, &bleio_address_type); common_hal_bleio_address_construct(address, address_bytes, BLEIO_ADDRESS_TYPE_RANDOM_STATIC); return address; } diff --git a/ports/espressif/common-hal/_bleio/Connection.c b/ports/espressif/common-hal/_bleio/Connection.c index 5e3e02d8e5..8861137210 100644 --- a/ports/espressif/common-hal/_bleio/Connection.c +++ b/ports/espressif/common-hal/_bleio/Connection.c @@ -176,12 +176,7 @@ STATIC int _discovered_service_cb(uint16_t conn_handle, if (_last_discovery_status != BLE_ERR_SUCCESS) { return 0; } - bleio_service_obj_t *service = m_new_obj(bleio_service_obj_t); - if (service == NULL) { - _last_discovery_status = BLE_ERR_MEM_CAPACITY; - return 0; - } - service->base.type = &bleio_service_type; + bleio_service_obj_t *service = mp_obj_malloc(bleio_service_obj_t, &bleio_service_type); // Initialize several fields at once. bleio_service_from_connection(service, bleio_connection_new_from_internal(self)); @@ -191,12 +186,8 @@ STATIC int _discovered_service_cb(uint16_t conn_handle, service->end_handle = svc->end_handle; service->handle = svc->start_handle; - bleio_uuid_obj_t *uuid = m_new_obj(bleio_uuid_obj_t); - if (uuid == NULL) { - _last_discovery_status = BLE_ERR_MEM_CAPACITY; - return 0; - } - uuid->base.type = &bleio_uuid_type; + bleio_uuid_obj_t *uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); + uuid->nimble_ble_uuid = svc->uuid; service->uuid = uuid; @@ -224,20 +215,12 @@ STATIC int _discovered_characteristic_cb(uint16_t conn_handle, return 0; } - bleio_characteristic_obj_t *characteristic = m_new_obj(bleio_characteristic_obj_t); - if (characteristic == NULL) { - _last_discovery_status = BLE_ERR_MEM_CAPACITY; - return 0; - } - characteristic->base.type = &bleio_characteristic_type; + bleio_characteristic_obj_t *characteristic = + mp_obj_malloc(bleio_characteristic_obj_t, &bleio_characteristic_type); // Known characteristic UUID. - bleio_uuid_obj_t *uuid = m_new_obj(bleio_uuid_obj_t); - if (uuid == NULL) { - _last_discovery_status = BLE_ERR_MEM_CAPACITY; - return 0; - } - uuid->base.type = &bleio_uuid_type; + bleio_uuid_obj_t *uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); + uuid->nimble_ble_uuid = chr->uuid; bleio_characteristic_properties_t props = @@ -301,19 +284,9 @@ STATIC int _discovered_descriptor_cb(uint16_t conn_handle, break; } - bleio_descriptor_obj_t *descriptor = m_new_obj(bleio_descriptor_obj_t); - if (descriptor == NULL) { - _last_discovery_status = BLE_ERR_MEM_CAPACITY; - return 0; - } - descriptor->base.type = &bleio_descriptor_type; + bleio_descriptor_obj_t *descriptor = mp_obj_malloc(bleio_descriptor_obj_t, &bleio_descriptor_type); - bleio_uuid_obj_t *uuid = m_new_obj(bleio_uuid_obj_t); - if (uuid == NULL) { - _last_discovery_status = BLE_ERR_MEM_CAPACITY; - return 0; - } - uuid->base.type = &bleio_uuid_type; + bleio_uuid_obj_t *uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); uuid->nimble_ble_uuid = dsc->uuid; common_hal_bleio_descriptor_construct( @@ -438,8 +411,8 @@ mp_obj_t bleio_connection_new_from_internal(bleio_connection_internal_t *interna if (internal->connection_obj != mp_const_none) { return internal->connection_obj; } - bleio_connection_obj_t *connection = m_new_obj(bleio_connection_obj_t); - connection->base.type = &bleio_connection_type; + bleio_connection_obj_t *connection = mp_obj_malloc(bleio_connection_obj_t, &bleio_connection_type); + connection->connection = internal; internal->connection_obj = connection; diff --git a/ports/espressif/common-hal/canio/Listener.c b/ports/espressif/common-hal/canio/Listener.c index eccddf6243..94bf03317c 100644 --- a/ports/espressif/common-hal/canio/Listener.c +++ b/ports/espressif/common-hal/canio/Listener.c @@ -162,8 +162,8 @@ mp_obj_t common_hal_canio_listener_receive(canio_listener_obj_t *self) { bool rtr = self->message_in.rtr; int dlc = self->message_in.data_length_code; - canio_message_obj_t *message = m_new_obj(canio_message_obj_t); - message->base.type = rtr ? &canio_remote_transmission_request_type : &canio_message_type; + canio_message_obj_t *message = + mp_obj_malloc(canio_message_obj_t,rtr ? &canio_remote_transmission_request_type : &canio_message_type); message->extended = self->message_in.extd; message->id = self->message_in.identifier; message->size = dlc; diff --git a/ports/espressif/common-hal/espidf/__init__.c b/ports/espressif/common-hal/espidf/__init__.c index d2d00ebc56..379d7c5ab4 100644 --- a/ports/espressif/common-hal/espidf/__init__.c +++ b/ports/espressif/common-hal/espidf/__init__.c @@ -198,4 +198,4 @@ void raise_esp_error(esp_err_t err) { mp_raise_msg_varg(exception_type, translate("%s error 0x%x"), group, err); } -MP_REGISTER_MODULE(MP_QSTR_espidf, espidf_module, CIRCUITPY_ESPIDF); +MP_REGISTER_MODULE(MP_QSTR_espidf, espidf_module); diff --git a/ports/espressif/common-hal/wifi/Radio.c b/ports/espressif/common-hal/wifi/Radio.c index d0592b718f..381606059c 100644 --- a/ports/espressif/common-hal/wifi/Radio.c +++ b/ports/espressif/common-hal/wifi/Radio.c @@ -175,8 +175,7 @@ mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self, u } set_mode_station(self, true); - wifi_scannednetworks_obj_t *scan = m_new_obj(wifi_scannednetworks_obj_t); - scan->base.type = &wifi_scannednetworks_type; + wifi_scannednetworks_obj_t *scan = mp_obj_malloc(wifi_scannednetworks_obj_t, &wifi_scannednetworks_type); self->current_scan = scan; scan->current_channel_index = 0; scan->start_channel = start_channel; @@ -366,8 +365,7 @@ mp_obj_t common_hal_wifi_radio_get_ap_info(wifi_radio_obj_t *self) { return mp_const_none; } - wifi_network_obj_t *ap_info = m_new_obj(wifi_network_obj_t); - ap_info->base.type = &wifi_network_type; + wifi_network_obj_t *ap_info = mp_obj_malloc(wifi_network_obj_t, &wifi_network_type); // From esp_wifi.h, the possible return values (typos theirs): // ESP_OK: succeed // ESP_ERR_WIFI_CONN: The station interface don't initialized diff --git a/ports/espressif/common-hal/wifi/ScannedNetworks.c b/ports/espressif/common-hal/wifi/ScannedNetworks.c index 50df9f8c95..e37bdc2f44 100644 --- a/ports/espressif/common-hal/wifi/ScannedNetworks.c +++ b/ports/espressif/common-hal/wifi/ScannedNetworks.c @@ -115,8 +115,7 @@ mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) self->channel_scan_in_progress = false; } - wifi_network_obj_t *entry = m_new_obj(wifi_network_obj_t); - entry->base.type = &wifi_network_type; + wifi_network_obj_t *entry = mp_obj_malloc(wifi_network_obj_t, &wifi_network_type); memcpy(&entry->record, &self->results[self->current_result], sizeof(wifi_ap_record_t)); self->current_result++; diff --git a/ports/nrf/boards/bluemicro833/mpconfigboard.h b/ports/nrf/boards/bluemicro833/mpconfigboard.h index 2340cdc988..8bfeb7cb98 100644 --- a/ports/nrf/boards/bluemicro833/mpconfigboard.h +++ b/ports/nrf/boards/bluemicro833/mpconfigboard.h @@ -42,9 +42,6 @@ #define BOARD_HAS_CRYSTAL 1 -// Take 1k RAM to save 1k flash. -#define CIRCUITPY_PRECOMPUTE_QSTR_ATTR (0) - // Reduce nRF SoftRadio memory usage #define BLEIO_VS_UUID_COUNT 10 #define BLEIO_HVN_TX_QUEUE_SIZE 2 diff --git a/ports/nrf/boards/pca10100/mpconfigboard.h b/ports/nrf/boards/pca10100/mpconfigboard.h index 8b1ff19a89..dca629b422 100644 --- a/ports/nrf/boards/pca10100/mpconfigboard.h +++ b/ports/nrf/boards/pca10100/mpconfigboard.h @@ -37,9 +37,6 @@ #define CIRCUITPY_BLE_CONFIG_SIZE (12 * 1024) -// Take 1k RAM to save 1k flash. -#define CIRCUITPY_PRECOMPUTE_QSTR_ATTR (0) - // Reduce nRF SoftRadio memory usage #define BLEIO_VS_UUID_COUNT 10 #define BLEIO_HVN_TX_QUEUE_SIZE 2 diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c index 828ff8806d..c442cf6936 100644 --- a/ports/nrf/common-hal/_bleio/Adapter.c +++ b/ports/nrf/common-hal/_bleio/Adapter.c @@ -429,8 +429,7 @@ bleio_address_obj_t *common_hal_bleio_adapter_get_address(bleio_adapter_obj_t *s ble_gap_addr_t local_address; get_address(self, &local_address); - bleio_address_obj_t *address = m_new_obj(bleio_address_obj_t); - address->base.type = &bleio_address_type; + bleio_address_obj_t *address = mp_obj_malloc(bleio_address_obj_t, &bleio_address_type); common_hal_bleio_address_construct(address, local_address.addr, local_address.addr_type); return address; diff --git a/ports/nrf/common-hal/_bleio/Connection.c b/ports/nrf/common-hal/_bleio/Connection.c index 69e6945d21..5f185de999 100644 --- a/ports/nrf/common-hal/_bleio/Connection.c +++ b/ports/nrf/common-hal/_bleio/Connection.c @@ -466,8 +466,7 @@ STATIC void on_primary_srv_discovery_rsp(ble_gattc_evt_prim_srvc_disc_rsp_t *res for (size_t i = 0; i < response->count; ++i) { ble_gattc_service_t *gattc_service = &response->services[i]; - bleio_service_obj_t *service = m_new_obj(bleio_service_obj_t); - service->base.type = &bleio_service_type; + bleio_service_obj_t *service = mp_obj_malloc(bleio_service_obj_t, &bleio_service_type); // Initialize several fields at once. bleio_service_from_connection(service, bleio_connection_new_from_internal(connection)); @@ -479,8 +478,7 @@ STATIC void on_primary_srv_discovery_rsp(ble_gattc_evt_prim_srvc_disc_rsp_t *res if (gattc_service->uuid.type != BLE_UUID_TYPE_UNKNOWN) { // Known service UUID. - bleio_uuid_obj_t *uuid = m_new_obj(bleio_uuid_obj_t); - uuid->base.type = &bleio_uuid_type; + bleio_uuid_obj_t *uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_service->uuid); service->uuid = uuid; } else { @@ -504,15 +502,14 @@ STATIC void on_char_discovery_rsp(ble_gattc_evt_char_disc_rsp_t *response, bleio for (size_t i = 0; i < response->count; ++i) { ble_gattc_char_t *gattc_char = &response->chars[i]; - bleio_characteristic_obj_t *characteristic = m_new_obj(bleio_characteristic_obj_t); - characteristic->base.type = &bleio_characteristic_type; + bleio_characteristic_obj_t *characteristic = + mp_obj_malloc(bleio_characteristic_obj_t, &bleio_characteristic_type); bleio_uuid_obj_t *uuid = NULL; if (gattc_char->uuid.type != BLE_UUID_TYPE_UNKNOWN) { // Known characteristic UUID. - uuid = m_new_obj(bleio_uuid_obj_t); - uuid->base.type = &bleio_uuid_type; + uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_char->uuid); } else { // The discovery response contained a 128-bit UUID that has not yet been registered with the @@ -571,15 +568,13 @@ STATIC void on_desc_discovery_rsp(ble_gattc_evt_desc_disc_rsp_t *response, bleio break; } - bleio_descriptor_obj_t *descriptor = m_new_obj(bleio_descriptor_obj_t); - descriptor->base.type = &bleio_descriptor_type; + bleio_descriptor_obj_t *descriptor = mp_obj_malloc(bleio_descriptor_obj_t, &bleio_descriptor_type); bleio_uuid_obj_t *uuid = NULL; if (gattc_desc->uuid.type != BLE_UUID_TYPE_UNKNOWN) { // Known descriptor UUID. - uuid = m_new_obj(bleio_uuid_obj_t); - uuid->base.type = &bleio_uuid_type; + uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); bleio_uuid_construct_from_nrf_ble_uuid(uuid, &gattc_desc->uuid); } else { // The discovery response contained a 128-bit UUID that has not yet been registered with the @@ -763,8 +758,7 @@ mp_obj_t bleio_connection_new_from_internal(bleio_connection_internal_t *interna if (internal->connection_obj != mp_const_none) { return internal->connection_obj; } - bleio_connection_obj_t *connection = m_new_obj(bleio_connection_obj_t); - connection->base.type = &bleio_connection_type; + bleio_connection_obj_t *connection = mp_obj_malloc(bleio_connection_obj_t, &bleio_connection_type); connection->connection = internal; internal->connection_obj = connection; diff --git a/ports/raspberrypi/bindings/cyw43/__init__.c b/ports/raspberrypi/bindings/cyw43/__init__.c index 520d10263c..d00612518e 100644 --- a/ports/raspberrypi/bindings/cyw43/__init__.c +++ b/ports/raspberrypi/bindings/cyw43/__init__.c @@ -155,4 +155,4 @@ const mp_obj_module_t cyw43_module = { .globals = (mp_obj_dict_t *)&cyw43_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_cyw43, cyw43_module, CIRCUITPY_CYW43); +MP_REGISTER_MODULE(MP_QSTR_cyw43, cyw43_module); diff --git a/ports/raspberrypi/bindings/picodvi/__init__.c b/ports/raspberrypi/bindings/picodvi/__init__.c index edfe7759c8..878da11d0c 100644 --- a/ports/raspberrypi/bindings/picodvi/__init__.c +++ b/ports/raspberrypi/bindings/picodvi/__init__.c @@ -45,4 +45,4 @@ const mp_obj_module_t picodvi_module = { .globals = (mp_obj_dict_t *)&picodvi_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_picodvi, picodvi_module, CIRCUITPY_PICODVI); +MP_REGISTER_MODULE(MP_QSTR_picodvi, picodvi_module); diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index bbf076ba68..b7dd548c76 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -150,8 +150,7 @@ //| ... STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - rp2pio_statemachine_obj_t *self = m_new_obj(rp2pio_statemachine_obj_t); - self->base.type = &rp2pio_statemachine_type; + rp2pio_statemachine_obj_t *self = mp_obj_malloc(rp2pio_statemachine_obj_t, &rp2pio_statemachine_type); enum { ARG_program, ARG_frequency, ARG_init, ARG_first_out_pin, ARG_out_pin_count, ARG_initial_out_pin_state, ARG_initial_out_pin_direction, ARG_first_in_pin, ARG_in_pin_count, diff --git a/ports/raspberrypi/bindings/rp2pio/__init__.c b/ports/raspberrypi/bindings/rp2pio/__init__.c index 193a3a2025..ed2eced8ea 100644 --- a/ports/raspberrypi/bindings/rp2pio/__init__.c +++ b/ports/raspberrypi/bindings/rp2pio/__init__.c @@ -72,4 +72,4 @@ const mp_obj_module_t rp2pio_module = { .globals = (mp_obj_dict_t *)&rp2pio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_rp2pio, rp2pio_module, CIRCUITPY_RP2PIO); +MP_REGISTER_MODULE(MP_QSTR_rp2pio, rp2pio_module); diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index c6ee5492ad..35dc9f3369 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -137,8 +137,7 @@ mp_obj_t common_hal_wifi_radio_start_scanning_networks(wifi_radio_obj_t *self, u if (!common_hal_wifi_radio_get_enabled(self)) { mp_raise_RuntimeError(translate("Wifi is not enabled")); } - wifi_scannednetworks_obj_t *scan = m_new_obj(wifi_scannednetworks_obj_t); - scan->base.type = &wifi_scannednetworks_type; + wifi_scannednetworks_obj_t *scan = mp_obj_malloc(wifi_scannednetworks_obj_t, &wifi_scannednetworks_type); mp_obj_t args[] = { mp_const_empty_tuple, MP_OBJ_NEW_SMALL_INT(16) }; scan->results = mp_type_deque.make_new(&mp_type_deque, 2, 0, args); self->current_scan = scan; diff --git a/ports/raspberrypi/common-hal/wifi/ScannedNetworks.c b/ports/raspberrypi/common-hal/wifi/ScannedNetworks.c index 97299e2f74..e2de56a6d6 100644 --- a/ports/raspberrypi/common-hal/wifi/ScannedNetworks.c +++ b/ports/raspberrypi/common-hal/wifi/ScannedNetworks.c @@ -97,8 +97,7 @@ mp_obj_t common_hal_wifi_scannednetworks_next(wifi_scannednetworks_obj_t *self) } - wifi_network_obj_t *entry = m_new_obj(wifi_network_obj_t); - entry->base.type = &wifi_network_type; + wifi_network_obj_t *entry = mp_obj_malloc(wifi_network_obj_t, &wifi_network_type); scan_result_get(&entry->record); return MP_OBJ_FROM_PTR(entry); diff --git a/ports/silabs/boards/devkit_xg24_brd2601b/sensor.c b/ports/silabs/boards/devkit_xg24_brd2601b/sensor.c index cdffa9f1e5..55011e556a 100644 --- a/ports/silabs/boards/devkit_xg24_brd2601b/sensor.c +++ b/ports/silabs/boards/devkit_xg24_brd2601b/sensor.c @@ -211,4 +211,4 @@ const mp_obj_module_t sensor_module = { .globals = (mp_obj_dict_t *)&sensor_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_sensor, sensor_module,1); +MP_REGISTER_MODULE(MP_QSTR_sensor, sensor_module); diff --git a/ports/silabs/common-hal/_bleio/Adapter.c b/ports/silabs/common-hal/_bleio/Adapter.c index ec2e6632ec..4d592f4422 100644 --- a/ports/silabs/common-hal/_bleio/Adapter.c +++ b/ports/silabs/common-hal/_bleio/Adapter.c @@ -127,8 +127,7 @@ bleio_address_obj_t *common_hal_bleio_adapter_get_address(bleio_adapter_obj_t *s return NULL; } - address = m_new_obj(bleio_address_obj_t); - address->base.type = &bleio_address_type; + address = mp_obj_malloc(bleio_address_obj_t, &bleio_address_type); common_hal_bleio_address_construct(address, get_address.addr, BLEIO_ADDRESS_TYPE_RANDOM_STATIC); return address; diff --git a/ports/silabs/common-hal/_bleio/Connection.c b/ports/silabs/common-hal/_bleio/Connection.c index ad3f6db198..f6cd664a57 100644 --- a/ports/silabs/common-hal/_bleio/Connection.c +++ b/ports/silabs/common-hal/_bleio/Connection.c @@ -251,8 +251,7 @@ mp_obj_t bleio_connection_new_from_internal( if (internal->connection_obj != mp_const_none) { return internal->connection_obj; } - connection = m_new_obj(bleio_connection_obj_t); - connection->base.type = &bleio_connection_type; + connection = mp_obj_malloc(bleio_connection_obj_t, &bleio_connection_type); connection->connection = internal; internal->connection_obj = connection; diff --git a/ports/silabs/common-hal/_bleio/__init__.c b/ports/silabs/common-hal/_bleio/__init__.c index 79a0b764e9..8b85f9ed6b 100644 --- a/ports/silabs/common-hal/_bleio/__init__.c +++ b/ports/silabs/common-hal/_bleio/__init__.c @@ -183,17 +183,12 @@ void sl_bt_on_event(sl_bt_msg_t *evt) { osMutexAcquire(bluetooth_connection_mutex_id, osWaitForever); connection = bleio_conn_handle_to_connection( evt->data.evt_gatt_service.connection); - service = m_new_obj(bleio_service_obj_t); - if (NULL == service) { - mp_raise_bleio_BluetoothError( - translate("Create new service obj fail")); - } - service->base.type = &bleio_service_type; + service = m_new_obj(bleio_service_obj_t, &bleio_service_type); bleio_service_from_connection(service, bleio_connection_new_from_internal(connection)); service->is_remote = true; service->handle = evt->data.evt_gatt_service.service; - uuid = m_new_obj(bleio_uuid_obj_t); + uuid = m_new_obj_maybe(bleio_uuid_obj_t); if (NULL == uuid) { osMutexRelease(bluetooth_connection_mutex_id); mp_raise_bleio_BluetoothError( @@ -231,21 +226,8 @@ void sl_bt_on_event(sl_bt_msg_t *evt) { service = MP_OBJ_TO_PTR(connection->remote_service_list->items[serv_idx - 1]); - characteristic = m_new_obj(bleio_characteristic_obj_t); - if (characteristic == NULL) { - mp_raise_bleio_BluetoothError( - translate("Create new characteristic obj fail.")); - } - - characteristic->base.type = &bleio_characteristic_type; - uuid = m_new_obj(bleio_uuid_obj_t); - if (uuid == NULL) { - mp_raise_bleio_BluetoothError( - translate("Create new characteristic uuid obj fail.")); - break; - } - - uuid->base.type = &bleio_uuid_type; + characteristic = mp_obj_malloc(bleio_characteristic_obj_t, &bleio_characteristic_type); + uuid = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); if (UUID16_LEN == evt->data.evt_gatt_characteristic.uuid.len) { uuid->efr_ble_uuid.uuid16.value &= 0x0000; uuid->efr_ble_uuid.uuid16.value diff --git a/ports/stm/common-hal/canio/Listener.c b/ports/stm/common-hal/canio/Listener.c index 0def8192f9..36c138ddd2 100644 --- a/ports/stm/common-hal/canio/Listener.c +++ b/ports/stm/common-hal/canio/Listener.c @@ -285,8 +285,8 @@ mp_obj_t common_hal_canio_listener_receive(canio_listener_obj_t *self) { uint32_t rdtr = self->mailbox->RDTR; bool rtr = rir & CAN_RI0R_RTR; - canio_message_obj_t *message = m_new_obj(canio_message_obj_t); - message->base.type = rtr ? &canio_remote_transmission_request_type : &canio_message_type; + canio_message_obj_t *message = + mp_obj_malloc(canio_message_obj_t, rtr ? &canio_remote_transmission_request_type : &canio_message_type); message->extended = rir & CAN_RI0R_IDE; if (message->extended) { message->id = rir >> 3; diff --git a/ports/unix/displayio_min.c b/ports/unix/displayio_min.c index debca1e088..45cfc1b73c 100644 --- a/ports/unix/displayio_min.c +++ b/ports/unix/displayio_min.c @@ -89,4 +89,4 @@ const mp_obj_module_t displayio_module = { .globals = (mp_obj_dict_t *)&displayio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_displayio, displayio_module, CIRCUITPY_DISPLAYIO_UNIX); +MP_REGISTER_MODULE(MP_QSTR_displayio, displayio_module); diff --git a/py/builtin.h b/py/builtin.h index db45f9841d..ab228278a7 100644 --- a/py/builtin.h +++ b/py/builtin.h @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George + * Copyright (c) 2013, 2014 Damien P. George * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/py/builtinimport.c b/py/builtinimport.c index 5ba4da0b43..a47211165b 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -236,6 +236,7 @@ STATIC void do_load(mp_module_context_t *module_obj, vstr_t *file) { } #endif } + #endif // MICROPY_MODULE_FROZEN // If we support loading .mpy files then check if the file extension is of @@ -463,6 +464,7 @@ STATIC mp_obj_t process_import_at_level(qstr full_mod_name, qstr level_mod_name, // because the file will not exist. } + //CIRCUITPY // Loading a module thrashes the heap significantly so we explicitly clean up // afterwards. gc_collect(); diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 78fa340f5d..02e796b4d1 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -214,7 +214,6 @@ typedef long mp_off_t; #define mp_type_fileio mp_type_vfs_fat_fileio #define mp_type_textio mp_type_vfs_fat_textio -#define mp_import_stat mp_vfs_import_stat #define mp_builtin_open_obj mp_vfs_open_obj @@ -492,13 +491,6 @@ void background_callback_run_all(void); #define CIRCUITPY_VERBOSE_BLE 0 -// This trades ~1k flash space (1) for that much in RAM plus the cost to compute -// the values once on init (0). Only turn it off, when you really need the flash -// space and are willing to trade the RAM. -#ifndef CIRCUITPY_PRECOMPUTE_QSTR_ATTR -#define CIRCUITPY_PRECOMPUTE_QSTR_ATTR (1) -#endif - // Display the Blinka logo in the REPL on displayio displays. #ifndef CIRCUITPY_REPL_LOGO #define CIRCUITPY_REPL_LOGO (1) diff --git a/py/gc_long_lived.c b/py/gc_long_lived.c index 647c4f75b7..6ceff0c1d4 100644 --- a/py/gc_long_lived.c +++ b/py/gc_long_lived.c @@ -37,38 +37,38 @@ mp_obj_fun_bc_t *make_fun_bc_long_lived(mp_obj_fun_bc_t *fun_bc, uint8_t max_dep return fun_bc; } fun_bc->bytecode = gc_make_long_lived((byte *)fun_bc->bytecode); - fun_bc->globals = make_dict_long_lived(fun_bc->globals, max_depth - 1); - for (uint32_t i = 0; i < gc_nbytes(fun_bc->const_table) / sizeof(mp_obj_t); i++) { - // Skip things that aren't allocated on the heap (and hence have zero bytes.) - if (gc_nbytes(MP_OBJ_TO_PTR(fun_bc->const_table[i])) == 0) { - continue; - } - // Try to detect raw code. - mp_raw_code_t *raw_code = MP_OBJ_TO_PTR(fun_bc->const_table[i]); - if (raw_code->kind == MP_CODE_BYTECODE) { - raw_code->fun_data = gc_make_long_lived((byte *)raw_code->fun_data); - raw_code->const_table = gc_make_long_lived((byte *)raw_code->const_table); - } - ((mp_uint_t *)fun_bc->const_table)[i] = (mp_uint_t)make_obj_long_lived( - (mp_obj_t)fun_bc->const_table[i], max_depth - 1); + fun_bc->context->module.globals = make_dict_long_lived(fun_bc->context->module.globals, max_depth - 1); + // for (uint32_t i = 0; i < gc_nbytes(fun_bc->const_table) / sizeof(mp_obj_t); i++) { + // // Skip things that aren't allocated on the heap (and hence have zero bytes.) + // if (gc_nbytes(MP_OBJ_TO_PTR(fun_bc->const_table[i])) == 0) { + // continue; + // } + // // Try to detect raw code. + // mp_raw_code_t *raw_code = MP_OBJ_TO_PTR(fun_bc->const_table[i]); + // if (raw_code->kind == MP_CODE_BYTECODE) { + // raw_code->fun_data = gc_make_long_lived((byte *)raw_code->fun_data); + // raw_code->const_table = gc_make_long_lived((byte *)raw_code->const_table); + // } + // ((mp_uint_t *)fun_bc->const_table)[i] = (mp_uint_t)make_obj_long_lived( + // (mp_obj_t)fun_bc->const_table[i], max_depth - 1); - } - fun_bc->const_table = gc_make_long_lived((mp_uint_t *)fun_bc->const_table); - // extra_args stores keyword only argument default values. - size_t words = gc_nbytes(fun_bc) / sizeof(mp_uint_t *); - // Functions (mp_obj_fun_bc_t) have four pointers (base, globals, bytecode and const_table) - // before the variable length extra_args so remove them from the length. - for (size_t i = 0; i < words - 4; i++) { - if (MP_OBJ_TO_PTR(fun_bc->extra_args[i]) == NULL) { - continue; - } - if (mp_obj_is_type(fun_bc->extra_args[i], &mp_type_dict)) { - fun_bc->extra_args[i] = MP_OBJ_FROM_PTR(make_dict_long_lived(MP_OBJ_TO_PTR(fun_bc->extra_args[i]), max_depth - 1)); - } else { - fun_bc->extra_args[i] = make_obj_long_lived(fun_bc->extra_args[i], max_depth - 1); - } + // } + // fun_bc->const_table = gc_make_long_lived((mp_uint_t *)fun_bc->const_table); + // // extra_args stores keyword only argument default values. + // size_t words = gc_nbytes(fun_bc) / sizeof(mp_uint_t *); + // // Functions (mp_obj_fun_bc_t) have four pointers (base, globals, bytecode and const_table) + // // before the variable length extra_args so remove them from the length. + // for (size_t i = 0; i < words - 4; i++) { + // if (MP_OBJ_TO_PTR(fun_bc->extra_args[i]) == NULL) { + // continue; + // } + // if (mp_obj_is_type(fun_bc->extra_args[i], &mp_type_dict)) { + // fun_bc->extra_args[i] = MP_OBJ_FROM_PTR(make_dict_long_lived(MP_OBJ_TO_PTR(fun_bc->extra_args[i]), max_depth - 1)); + // } else { + // fun_bc->extra_args[i] = make_obj_long_lived(fun_bc->extra_args[i], max_depth - 1); + // } - } + // } return gc_make_long_lived(fun_bc); } diff --git a/py/obj.c b/py/obj.c index 01efd8ad28..9e08e314a3 100644 --- a/py/obj.c +++ b/py/obj.c @@ -45,7 +45,7 @@ // Allocates an object and also sets type, for mp_obj_malloc{,_var} macros. void *mp_obj_malloc_helper(size_t num_bytes, const mp_obj_type_t *type) { - mp_obj_base_t *base = (mp_obj_base_t *)m_malloc(num_bytes); + mp_obj_base_t *base = (mp_obj_base_t *)m_malloc(num_bytes, false); base->type = type; return base; } @@ -346,7 +346,7 @@ mp_obj_t mp_obj_equal_not_equal(mp_binary_op_t op, mp_obj_t o1, mp_obj_t o2) { } // Try calling __eq__. - mp_obj_t r = type->binary_op(MP_BINARY_OP_EQUAL, o1, o2); + mp_obj_t r = binary_op(MP_BINARY_OP_EQUAL, o1, o2); if (r != MP_OBJ_NULL) { if (op == MP_BINARY_OP_EQUAL) { return r; diff --git a/py/obj.h b/py/obj.h index 9f5314e30d..1e08d2f3b4 100644 --- a/py/obj.h +++ b/py/obj.h @@ -460,7 +460,7 @@ typedef struct _mp_rom_map_elem_t { typedef struct _mp_map_t { size_t all_keys_are_qstrs : 1; size_t is_fixed : 1; // if set, table is fixed/read-only and can't be modified - size_t is_ordered : 1; / if set, table is an ordered array, not a hash map + size_t is_ordered : 1; // if set, table is an ordered array, not a hash map size_t scanning : 1; // true if we're in the middle of scanning linked dictionaries, // e.g., make_dict_long_lived() size_t used : (8 * sizeof(size_t) - 4); @@ -611,6 +611,39 @@ struct _mp_obj_type_ext { // One of disjoint protocols (interfaces), like mp_stream_p_t, etc. const void *protocol; +}; + +struct _mp_obj_type_t { + // A type is an object so must start with this entry, which points to mp_type_type. + mp_obj_base_t base; + + // Flags associated with this type. + uint16_t flags; + // The name of this type, a qstr. + uint16_t name; + + // A dict mapping qstrs to objects local methods/constants/etc. + struct _mp_obj_dict_t *locals_dict; + + // Corresponds to __new__ and __init__ special methods, to make an instance of the type. + mp_make_new_fun_t make_new; + + // Corresponds to __repr__ and __str__ special methods. + mp_print_fun_t print; + + // Implements load, store and delete attribute. + // + // dest[0] = MP_OBJ_NULL means load + // return: for fail, do nothing + // for fail but continue lookup in locals_dict, dest[1] = MP_OBJ_SENTINEL + // for attr, dest[0] = value + // for method, dest[0] = method, dest[1] = self + // + // dest[0,1] = {MP_OBJ_SENTINEL, MP_OBJ_NULL} means delete + // dest[0,1] = {MP_OBJ_SENTINEL, object} means store + // return: for fail, do nothing + // for success set dest[0] = MP_OBJ_NULL + mp_attr_fun_t attr; // A pointer to the parents of this type: // - 0 parents: pointer is NULL (object is implicitly the single parent) @@ -851,10 +884,6 @@ mp_obj_t mp_obj_new_exception_msg_vlist(const mp_obj_type_t *exc_type, const com #endif // Only use this string version from native MPY files with static error strings. mp_obj_t mp_obj_new_exception_msg_str(const mp_obj_type_t *exc_type, const char *msg); -mp_obj_t mp_obj_new_fun_bc(mp_obj_t def_args, mp_obj_t def_kw_args, const byte *code, const mp_uint_t *const_table); -mp_obj_t mp_obj_new_fun_native(mp_obj_t def_args_in, mp_obj_t def_kw_args, const void *fun_data, const mp_uint_t *const_table); -mp_obj_t mp_obj_new_fun_viper(size_t n_args, const void *fun_data, mp_uint_t type_sig); -mp_obj_t mp_obj_new_fun_asm(size_t n_args, const void *fun_data, mp_uint_t type_sig); mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun, bool is_coroutine); mp_obj_t mp_obj_new_closure(mp_obj_t fun, size_t n_closed, const mp_obj_t *closed); mp_obj_t mp_obj_new_tuple(size_t n, const mp_obj_t *items); @@ -928,6 +957,7 @@ bool mp_obj_exception_match(mp_obj_t exc, mp_const_obj_t exc_type); void mp_obj_exception_clear_traceback(mp_obj_t self_in); void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qstr block); void mp_obj_exception_get_traceback(mp_obj_t self_in, size_t *n, size_t **values); +mp_obj_t mp_obj_exception_get_traceback_obj(mp_obj_t self_in); mp_obj_t mp_obj_exception_get_value(mp_obj_t self_in); mp_obj_t mp_obj_exception_make_new(const mp_obj_type_t *type_in, size_t n_args, size_t n_kw, const mp_obj_t *args); mp_obj_t mp_alloc_emergency_exception_buf(mp_obj_t size_in); @@ -1003,6 +1033,7 @@ void mp_obj_tuple_del(mp_obj_t self_in); mp_int_t mp_obj_tuple_hash(mp_obj_t self_in); // list +mp_obj_t mp_obj_list_clear(mp_obj_t self_in); mp_obj_t mp_obj_list_append(mp_obj_t self_in, mp_obj_t arg); mp_obj_t mp_obj_list_remove(mp_obj_t self_in, mp_obj_t value); void mp_obj_list_get(mp_obj_t self_in, size_t *len, mp_obj_t **items); @@ -1022,7 +1053,7 @@ mp_obj_t mp_obj_dict_get(mp_obj_t self_in, mp_obj_t index); mp_obj_t mp_obj_dict_store(mp_obj_t self_in, mp_obj_t key, mp_obj_t value); mp_obj_t mp_obj_dict_delete(mp_obj_t self_in, mp_obj_t key); mp_obj_t mp_obj_dict_copy(mp_obj_t self_in); -static inline mp_map_t *mp_obj_dict_get_map(mp_obj_t dict) { +static MP_INLINE mp_map_t *mp_obj_dict_get_map(mp_obj_t dict) { return &((mp_obj_dict_t *)MP_OBJ_TO_PTR(dict))->map; } @@ -1082,9 +1113,8 @@ typedef struct _mp_obj_module_t { mp_obj_base_t base; mp_obj_dict_t *globals; } mp_obj_module_t; -static inline mp_obj_dict_t *mp_obj_module_get_globals(mp_obj_t module) { - return ((mp_obj_module_t *)MP_OBJ_TO_PTR(module))->globals; -} +mp_obj_dict_t *mp_obj_module_get_globals(mp_obj_t self_in); +void mp_obj_module_set_globals(mp_obj_t self_in, mp_obj_dict_t *globals); // check if given module object is a package bool mp_obj_is_package(mp_obj_t module); diff --git a/py/objfun.h b/py/objfun.h index 9de15b8841..6baea818f4 100644 --- a/py/objfun.h +++ b/py/objfun.h @@ -31,7 +31,8 @@ typedef struct _mp_obj_fun_bc_t { mp_obj_base_t base; - const mp_module_context_t *context; // context within which this function was defined + // CIRCUITPY - Long-lived conversions need to write into context, so un-const the field. + /*const*/ mp_module_context_t *context; // context within which this function was defined struct _mp_raw_code_t *const *child_table; // table of children const byte *bytecode; // bytecode for the function #if MICROPY_PY_SYS_SETTRACE diff --git a/py/qstr.c b/py/qstr.c index 19ade1b6a4..ca8d8597c5 100644 --- a/py/qstr.c +++ b/py/qstr.c @@ -76,27 +76,23 @@ mp_uint_t qstr_compute_hash(const byte *data, size_t len) { } return hash; } -#ifndef CIRCUITPY_PRECOMPUTE_QSTR_ATTR -#define CIRCUITPY_PRECOMPUTE_QSTR_ATTR (1) -#endif -#if CIRCUITPY_PRECOMPUTE_QSTR_ATTR == 1 -const qstr_attr_t mp_qstr_const_attr[MP_QSTRnumber_of] = { const qstr_hash_t mp_qstr_const_hashes[] = { #ifndef NO_QSTR #define QDEF(id, hash, len, str) hash, +#define TRANSLATION(id, length, compressed ...) #include "genhdr/qstrdefs.generated.h" +#undef TRANSLATION #undef QDEF #endif }; -#else -qstr_attr_t mp_qstr_const_attr[MP_QSTRnumber_of]; -#endif const qstr_len_t mp_qstr_const_lengths[] = { #ifndef NO_QSTR #define QDEF(id, hash, len, str) len, +#define TRANSLATION(id, length, compressed ...) #include "genhdr/qstrdefs.generated.h" +#undef TRANSLATION #undef QDEF #endif }; @@ -130,16 +126,6 @@ void qstr_init(void) { MP_STATE_VM(last_pool) = (qstr_pool_t *)&CONST_POOL; // we won't modify the const_pool since it has no allocated room left MP_STATE_VM(qstr_last_chunk) = NULL; - #if CIRCUITPY_PRECOMPUTE_QSTR_ATTR == 0 - if (mp_qstr_const_attr[MP_QSTR_circuitpython].len == 0) { - for (size_t i = 0; i < mp_qstr_const_pool.len; i++) { - size_t len = strlen(mp_qstr_const_pool.qstrs[i]); - mp_qstr_const_attr[i].hash = qstr_compute_hash((const byte *)mp_qstr_const_pool.qstrs[i], len); - mp_qstr_const_attr[i].len = len; - } - } - #endif - #if MICROPY_PY_THREAD && !MICROPY_PY_THREAD_GIL mp_thread_mutex_init(&MP_STATE_VM(qstr_mutex)); #endif @@ -170,7 +156,7 @@ STATIC qstr qstr_add(mp_uint_t hash, mp_uint_t len, const char *q_ptr) { #endif mp_uint_t pool_size = sizeof(qstr_pool_t) + (sizeof(const char *) + sizeof(qstr_hash_t) + sizeof(qstr_len_t)) * new_alloc; - qstr_pool_t *pool = (qstr_pool_t *)m_malloc_maybe(pool_size); + qstr_pool_t *pool = (qstr_pool_t *)m_malloc_maybe(pool_size, true); if (pool == NULL) { // Keep qstr_last_chunk consistent with qstr_pool_t: qstr_last_chunk is not scanned // at garbage collection since it's reachable from a qstr_pool_t. And the caller of diff --git a/py/qstr.h b/py/qstr.h index fa634f90b0..c6c9768d05 100644 --- a/py/qstr.h +++ b/py/qstr.h @@ -39,8 +39,10 @@ enum { #ifndef NO_QSTR #define QDEF(id, hash, len, str) id, +#define TRANSLATION(english_id, number) #include "genhdr/qstrdefs.generated.h" #undef QDEF +#undef TRANSLATION #endif MP_QSTRnumber_of, // no underscore so it can't clash with any of the above }; diff --git a/shared-bindings/__future__/__init__.c b/shared-bindings/__future__/__init__.c index ad1bb3b283..dfef2204ca 100644 --- a/shared-bindings/__future__/__init__.c +++ b/shared-bindings/__future__/__init__.c @@ -57,4 +57,4 @@ const mp_obj_module_t future_module = { .globals = (mp_obj_dict_t *)&future_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR___future__, future_module, CIRCUITPY_FUTURE); +MP_REGISTER_MODULE(MP_QSTR___future__, future_module); diff --git a/shared-bindings/_bleio/Address.c b/shared-bindings/_bleio/Address.c index 236ca9e39e..cae1b9a235 100644 --- a/shared-bindings/_bleio/Address.c +++ b/shared-bindings/_bleio/Address.c @@ -56,8 +56,7 @@ STATIC mp_obj_t bleio_address_make_new(const mp_obj_type_t *type, size_t n_args, mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - bleio_address_obj_t *self = m_new_obj(bleio_address_obj_t); - self->base.type = &bleio_address_type; + bleio_address_obj_t *self = mp_obj_malloc(bleio_address_obj_t, &bleio_address_type); const mp_obj_t address = args[ARG_address].u_obj; mp_buffer_info_t buf_info; diff --git a/shared-bindings/_bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c index 823250c365..faad911c80 100644 --- a/shared-bindings/_bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -141,8 +141,8 @@ STATIC mp_obj_t bleio_characteristic_add_to_service(size_t n_args, const mp_obj_ user_description = mp_obj_str_get_str(args[ARG_user_description].u_obj); } - bleio_characteristic_obj_t *characteristic = m_new_obj(bleio_characteristic_obj_t); - characteristic->base.type = &bleio_characteristic_type; + bleio_characteristic_obj_t *characteristic = + m_new_obj(bleio_characteristic_obj_t, &bleio_characteristic_type); // Range checking on max_length arg is done by the common_hal layer, because // it may vary depending on underlying BLE implementation. diff --git a/shared-bindings/_bleio/CharacteristicBuffer.c b/shared-bindings/_bleio/CharacteristicBuffer.c index 1efb992c72..842ea4cc58 100644 --- a/shared-bindings/_bleio/CharacteristicBuffer.c +++ b/shared-bindings/_bleio/CharacteristicBuffer.c @@ -74,8 +74,8 @@ STATIC mp_obj_t bleio_characteristic_buffer_make_new(const mp_obj_type_t *type, const mp_int_t buffer_size = mp_arg_validate_int_min(args[ARG_buffer_size].u_int, 1, MP_QSTR_buffer_size); - bleio_characteristic_buffer_obj_t *self = m_new_obj(bleio_characteristic_buffer_obj_t); - self->base.type = &bleio_characteristic_buffer_type; + bleio_characteristic_buffer_obj_t *self = + mp_obj_malloc(bleio_characteristic_buffer_obj_t, &bleio_characteristic_buffer_type); common_hal_bleio_characteristic_buffer_construct(self, characteristic, timeout, buffer_size); diff --git a/shared-bindings/_bleio/Descriptor.c b/shared-bindings/_bleio/Descriptor.c index 9ebe95432e..813ef8f9fe 100644 --- a/shared-bindings/_bleio/Descriptor.c +++ b/shared-bindings/_bleio/Descriptor.c @@ -122,8 +122,7 @@ STATIC mp_obj_t bleio_descriptor_add_to_characteristic(size_t n_args, const mp_o mp_raise_ValueError(translate("initial_value length is wrong")); } - bleio_descriptor_obj_t *descriptor = m_new_obj(bleio_descriptor_obj_t); - descriptor->base.type = &bleio_descriptor_type; + bleio_descriptor_obj_t *descriptor = mp_obj_malloc(bleio_descriptor_obj_t, &bleio_descriptor_type); // Range checking on max_length arg is done by the common_hal layer, because // it may vary depending on underlying BLE implementation. diff --git a/shared-bindings/_bleio/PacketBuffer.c b/shared-bindings/_bleio/PacketBuffer.c index 0ce74beff4..2c03a6855e 100644 --- a/shared-bindings/_bleio/PacketBuffer.c +++ b/shared-bindings/_bleio/PacketBuffer.c @@ -85,8 +85,7 @@ STATIC mp_obj_t bleio_packet_buffer_make_new(const mp_obj_type_t *type, size_t n max_packet_size = mp_obj_get_int(args[ARG_max_packet_size].u_obj); } - bleio_packet_buffer_obj_t *self = m_new_obj(bleio_packet_buffer_obj_t); - self->base.type = &bleio_packet_buffer_type; + bleio_packet_buffer_obj_t *self = mp_obj_malloc(bleio_packet_buffer_obj_t, &bleio_packet_buffer_type); common_hal_bleio_packet_buffer_construct(self, characteristic, buffer_size, max_packet_size); diff --git a/shared-bindings/_bleio/Service.c b/shared-bindings/_bleio/Service.c index 7b357882f0..f107b068e0 100644 --- a/shared-bindings/_bleio/Service.c +++ b/shared-bindings/_bleio/Service.c @@ -61,8 +61,7 @@ STATIC mp_obj_t bleio_service_make_new(const mp_obj_type_t *type, size_t n_args, const bool is_secondary = args[ARG_secondary].u_bool; - bleio_service_obj_t *service = m_new_obj(bleio_service_obj_t); - service->base.type = &bleio_service_type; + bleio_service_obj_t *service = mp_obj_malloc(bleio_service_obj_t, &bleio_service_type); common_hal_bleio_service_construct(service, uuid, is_secondary); diff --git a/shared-bindings/_bleio/UUID.c b/shared-bindings/_bleio/UUID.c index 922b1ac5fb..b7fc05fbc6 100644 --- a/shared-bindings/_bleio/UUID.c +++ b/shared-bindings/_bleio/UUID.c @@ -53,8 +53,7 @@ STATIC mp_obj_t bleio_uuid_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); - bleio_uuid_obj_t *self = m_new_obj(bleio_uuid_obj_t); - self->base.type = type; + bleio_uuid_obj_t *self = mp_obj_malloc(bleio_uuid_obj_t, &bleio_uuid_type); const mp_obj_t value = all_args[0]; uint8_t uuid128[16]; diff --git a/shared-bindings/_bleio/__init__.c b/shared-bindings/_bleio/__init__.c index f34d3af5c5..1131b52eb9 100644 --- a/shared-bindings/_bleio/__init__.c +++ b/shared-bindings/_bleio/__init__.c @@ -203,4 +203,4 @@ const mp_obj_module_t bleio_module = { .globals = (mp_obj_dict_t *)&bleio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR__bleio, bleio_module, CIRCUITPY_BLEIO); +MP_REGISTER_MODULE(MP_QSTR__bleio, bleio_module); diff --git a/shared-bindings/_eve/__init__.c b/shared-bindings/_eve/__init__.c index 5975ee1ca1..203a9cbfd2 100644 --- a/shared-bindings/_eve/__init__.c +++ b/shared-bindings/_eve/__init__.c @@ -1058,8 +1058,7 @@ STATIC MP_DEFINE_CONST_DICT(_EVE_locals_dict, _EVE_locals_dict_table); STATIC mp_obj_t _EVE_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { // mp_arg_check_num(n_args, kw_args, 1, 1, false); - mp_obj__EVE_t *o = m_new_obj(mp_obj__EVE_t); - o->base.type = &_EVE_type; + mp_obj__EVE_t *o = mp_obj_malloc(mp_obj__EVE_t, &_EVE_type); o->_eve.n = 0; o->_eve.vscale = 16; return MP_OBJ_FROM_PTR(o); @@ -1084,4 +1083,4 @@ const mp_obj_module_t _eve_module = { .globals = (mp_obj_dict_t *)&mp_module__eve_globals, }; -MP_REGISTER_MODULE(MP_QSTR__eve, _eve_module, CIRCUITPY__EVE); +MP_REGISTER_MODULE(MP_QSTR__eve, _eve_module); diff --git a/shared-bindings/_pew/PewPew.c b/shared-bindings/_pew/PewPew.c index 1a4356c719..d9cc325a0a 100644 --- a/shared-bindings/_pew/PewPew.c +++ b/shared-bindings/_pew/PewPew.c @@ -110,8 +110,7 @@ STATIC mp_obj_t pewpew_make_new(const mp_obj_type_t *type, size_t n_args, size_t pew_obj_t *pew = MP_STATE_VM(pew_singleton); if (!pew) { - pew = m_new_obj(pew_obj_t); - pew->base.type = &pewpew_type; + pew = mp_obj_malloc(pew_obj_t, &pewpew_type); pew = gc_make_long_lived(pew); MP_STATE_VM(pew_singleton) = pew; } diff --git a/shared-bindings/_pixelmap/PixelMap.c b/shared-bindings/_pixelmap/PixelMap.c index 94fa4d5c96..5de918bbbe 100644 --- a/shared-bindings/_pixelmap/PixelMap.c +++ b/shared-bindings/_pixelmap/PixelMap.c @@ -87,8 +87,7 @@ STATIC mp_obj_t pixelmap_pixelmap_make_new(const mp_obj_type_t *type, size_t n_a } } - pixelmap_pixelmap_obj_t *self = m_new_obj(pixelmap_pixelmap_obj_t); - self->base.type = &pixelmap_pixelmap_type; + pixelmap_pixelmap_obj_t *self = mp_obj_malloc(pixelmap_pixelmap_obj_t, &pixelmap_pixelmap_type); shared_module_pixelmap_pixelmap_construct(self, pixelbuf, indices); return MP_OBJ_FROM_PTR(self); diff --git a/shared-bindings/_pixelmap/__init__.c b/shared-bindings/_pixelmap/__init__.c index 13a09d69d2..9c71c5498a 100644 --- a/shared-bindings/_pixelmap/__init__.c +++ b/shared-bindings/_pixelmap/__init__.c @@ -59,4 +59,4 @@ const mp_obj_module_t pixelmap_module = { .globals = (mp_obj_dict_t *)&pixelmap_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR__pixelmap, pixelmap_module, CIRCUITPY_PIXELMAP); +MP_REGISTER_MODULE(MP_QSTR__pixelmap, pixelmap_module); diff --git a/shared-bindings/_stage/Layer.c b/shared-bindings/_stage/Layer.c index 81d76321f0..a5dd130dac 100644 --- a/shared-bindings/_stage/Layer.c +++ b/shared-bindings/_stage/Layer.c @@ -58,8 +58,7 @@ STATIC mp_obj_t layer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 4, 5, false); - layer_obj_t *self = m_new_obj(layer_obj_t); - self->base.type = type; + layer_obj_t *self = mp_obj_malloc(layer_obj_t, type); self->width = mp_obj_get_int(args[0]); self->height = mp_obj_get_int(args[1]); diff --git a/shared-bindings/_stage/Text.c b/shared-bindings/_stage/Text.c index c735669861..0c54f123d7 100644 --- a/shared-bindings/_stage/Text.c +++ b/shared-bindings/_stage/Text.c @@ -58,8 +58,7 @@ STATIC mp_obj_t text_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 5, 5, false); - text_obj_t *self = m_new_obj(text_obj_t); - self->base.type = type; + text_obj_t *self = mp_obj_malloc(text_obj_t, type); self->width = mp_obj_get_int(args[0]); self->height = mp_obj_get_int(args[1]); diff --git a/shared-bindings/_stage/__init__.c b/shared-bindings/_stage/__init__.c index b2542f9df4..46ae93f4ba 100644 --- a/shared-bindings/_stage/__init__.c +++ b/shared-bindings/_stage/__init__.c @@ -118,4 +118,4 @@ const mp_obj_module_t stage_module = { .globals = (mp_obj_dict_t *)&stage_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR__stage, stage_module, CIRCUITPY_STAGE); +MP_REGISTER_MODULE(MP_QSTR__stage, stage_module); diff --git a/shared-bindings/adafruit_bus_device/__init__.c b/shared-bindings/adafruit_bus_device/__init__.c index 410c6fb2f2..13993b18ff 100644 --- a/shared-bindings/adafruit_bus_device/__init__.c +++ b/shared-bindings/adafruit_bus_device/__init__.c @@ -76,6 +76,6 @@ const mp_obj_module_t adafruit_bus_device_module = { .globals = (mp_obj_dict_t *)&adafruit_bus_device_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_adafruit_bus_device, adafruit_bus_device_module, CIRCUITPY_BUSDEVICE); -MP_REGISTER_MODULE(MP_QSTR_adafruit_bus_device_dot_i2c_device, adafruit_bus_device_i2c_device_module, CIRCUITPY_BUSDEVICE); -MP_REGISTER_MODULE(MP_QSTR_adafruit_bus_device_dot_spi_device, adafruit_bus_device_spi_device_module, CIRCUITPY_BUSDEVICE); +MP_REGISTER_MODULE(MP_QSTR_adafruit_bus_device, adafruit_bus_device_module); +MP_REGISTER_MODULE(MP_QSTR_adafruit_bus_device_dot_i2c_device, adafruit_bus_device_i2c_device_module); +MP_REGISTER_MODULE(MP_QSTR_adafruit_bus_device_dot_spi_device, adafruit_bus_device_spi_device_module); diff --git a/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c b/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c index a77179c886..7dd5e09868 100644 --- a/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c +++ b/shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.c @@ -66,8 +66,8 @@ //| """ //| ... STATIC mp_obj_t adafruit_bus_device_i2cdevice_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - adafruit_bus_device_i2cdevice_obj_t *self = m_new_obj(adafruit_bus_device_i2cdevice_obj_t); - self->base.type = &adafruit_bus_device_i2cdevice_type; + adafruit_bus_device_i2cdevice_obj_t *self = + mp_obj_malloc(adafruit_bus_device_i2cdevice_obj_t, &adafruit_bus_device_i2cdevice_type); enum { ARG_i2c, ARG_device_address, ARG_probe }; static const mp_arg_t allowed_args[] = { { MP_QSTR_i2c, MP_ARG_REQUIRED | MP_ARG_OBJ }, diff --git a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c index 13b57477e4..47f93f3230 100644 --- a/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c +++ b/shared-bindings/adafruit_bus_device/spi_device/SPIDevice.c @@ -79,8 +79,8 @@ //| spi.write(bytes_read)""" //| ... STATIC mp_obj_t adafruit_bus_device_spidevice_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - adafruit_bus_device_spidevice_obj_t *self = m_new_obj(adafruit_bus_device_spidevice_obj_t); - self->base.type = &adafruit_bus_device_spidevice_type; + adafruit_bus_device_spidevice_obj_t *self = + mp_obj_malloc(adafruit_bus_device_spidevice_obj_t, &adafruit_bus_device_spidevice_type); enum { ARG_spi, ARG_chip_select, ARG_cs_active_value, ARG_baudrate, ARG_polarity, ARG_phase, ARG_extra_clocks }; static const mp_arg_t allowed_args[] = { { MP_QSTR_spi, MP_ARG_REQUIRED | MP_ARG_OBJ }, diff --git a/shared-bindings/adafruit_pixelbuf/PixelBuf.c b/shared-bindings/adafruit_pixelbuf/PixelBuf.c index 2848a02c62..d259b57dbb 100644 --- a/shared-bindings/adafruit_pixelbuf/PixelBuf.c +++ b/shared-bindings/adafruit_pixelbuf/PixelBuf.c @@ -120,8 +120,7 @@ STATIC mp_obj_t pixelbuf_pixelbuf_make_new(const mp_obj_type_t *type, size_t n_a } // Validation complete, allocate and populate object. - pixelbuf_pixelbuf_obj_t *self = m_new_obj(pixelbuf_pixelbuf_obj_t); - self->base.type = &pixelbuf_pixelbuf_type; + pixelbuf_pixelbuf_obj_t *self = mp_obj_malloc(pixelbuf_pixelbuf_obj_t, &pixelbuf_pixelbuf_type); common_hal_adafruit_pixelbuf_pixelbuf_construct(self, args[ARG_size].u_int, &byteorder_details, brightness, args[ARG_auto_write].u_bool, header_bufinfo.buf, header_bufinfo.len, trailer_bufinfo.buf, trailer_bufinfo.len); diff --git a/shared-bindings/adafruit_pixelbuf/__init__.c b/shared-bindings/adafruit_pixelbuf/__init__.c index fd2915ee0a..bb741e3da6 100644 --- a/shared-bindings/adafruit_pixelbuf/__init__.c +++ b/shared-bindings/adafruit_pixelbuf/__init__.c @@ -62,4 +62,4 @@ const mp_obj_module_t pixelbuf_module = { .globals = (mp_obj_dict_t *)&pixelbuf_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_adafruit_pixelbuf, pixelbuf_module, CIRCUITPY_PIXELBUF); +MP_REGISTER_MODULE(MP_QSTR_adafruit_pixelbuf, pixelbuf_module); diff --git a/shared-bindings/aesio/__init__.c b/shared-bindings/aesio/__init__.c index f3e1d7dd17..314ac847b6 100644 --- a/shared-bindings/aesio/__init__.c +++ b/shared-bindings/aesio/__init__.c @@ -68,4 +68,4 @@ const mp_obj_module_t aesio_module = { .globals = (mp_obj_dict_t *)&aesio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_aesio, aesio_module, CIRCUITPY_AESIO); +MP_REGISTER_MODULE(MP_QSTR_aesio, aesio_module); diff --git a/shared-bindings/aesio/aes.c b/shared-bindings/aesio/aes.c index c5c50515ea..78999b87f1 100644 --- a/shared-bindings/aesio/aes.c +++ b/shared-bindings/aesio/aes.c @@ -47,8 +47,7 @@ STATIC mp_obj_t aesio_aes_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - aesio_aes_obj_t *self = m_new_obj(aesio_aes_obj_t); - self->base.type = &aesio_aes_type; + aesio_aes_obj_t *self = mp_obj_malloc(aesio_aes_obj_t, &aesio_aes_type); enum { ARG_key, ARG_mode, ARG_IV, ARG_counter, ARG_segment_size }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/alarm/__init__.c b/shared-bindings/alarm/__init__.c index 94879e14d4..7f927df016 100644 --- a/shared-bindings/alarm/__init__.c +++ b/shared-bindings/alarm/__init__.c @@ -312,4 +312,4 @@ MP_WEAK void common_hal_alarm_pretending_deep_sleep(void) { port_idle_until_interrupt(); } -MP_REGISTER_MODULE(MP_QSTR_alarm, alarm_module, CIRCUITPY_ALARM); +MP_REGISTER_MODULE(MP_QSTR_alarm, alarm_module); diff --git a/shared-bindings/alarm/pin/PinAlarm.c b/shared-bindings/alarm/pin/PinAlarm.c index c75061b77a..b0e21771c5 100644 --- a/shared-bindings/alarm/pin/PinAlarm.c +++ b/shared-bindings/alarm/pin/PinAlarm.c @@ -62,8 +62,7 @@ //| """ //| ... STATIC mp_obj_t alarm_pin_pinalarm_make_new(const mp_obj_type_t *type, mp_uint_t n_args, size_t n_kw, const mp_obj_t *all_args) { - alarm_pin_pinalarm_obj_t *self = m_new_obj(alarm_pin_pinalarm_obj_t); - self->base.type = &alarm_pin_pinalarm_type; + alarm_pin_pinalarm_obj_t *self = mp_obj_malloc(alarm_pin_pinalarm_obj_t, &alarm_pin_pinalarm_type); enum { ARG_pin, ARG_value, ARG_edge, ARG_pull }; static const mp_arg_t allowed_args[] = { { MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, diff --git a/shared-bindings/alarm/time/TimeAlarm.c b/shared-bindings/alarm/time/TimeAlarm.c index 86c96de1d4..aed14613ea 100644 --- a/shared-bindings/alarm/time/TimeAlarm.c +++ b/shared-bindings/alarm/time/TimeAlarm.c @@ -61,8 +61,7 @@ mp_obj_t MP_WEAK rtc_get_time_source_time(void) { //| ... STATIC mp_obj_t alarm_time_timealarm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - alarm_time_timealarm_obj_t *self = m_new_obj(alarm_time_timealarm_obj_t); - self->base.type = &alarm_time_timealarm_type; + alarm_time_timealarm_obj_t *self = mp_obj_malloc(alarm_time_timealarm_obj_t, &alarm_time_timealarm_type); enum { ARG_monotonic_time, ARG_epoch_time }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/alarm/touch/TouchAlarm.c b/shared-bindings/alarm/touch/TouchAlarm.c index 20612cb106..71fcb67a4f 100644 --- a/shared-bindings/alarm/touch/TouchAlarm.c +++ b/shared-bindings/alarm/touch/TouchAlarm.c @@ -45,8 +45,7 @@ //| ... STATIC mp_obj_t alarm_touch_touchalarm_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - alarm_touch_touchalarm_obj_t *self = m_new_obj(alarm_touch_touchalarm_obj_t); - self->base.type = &alarm_touch_touchalarm_type; + alarm_touch_touchalarm_obj_t *self = mp_obj_malloc(alarm_touch_touchalarm_obj_t, &alarm_touch_touchalarm_type); enum { ARG_pin }; static const mp_arg_t allowed_args[] = { diff --git a/shared-bindings/analogbufio/__init__.c b/shared-bindings/analogbufio/__init__.c index 749f1aec09..552fc56b25 100644 --- a/shared-bindings/analogbufio/__init__.c +++ b/shared-bindings/analogbufio/__init__.c @@ -59,4 +59,4 @@ const mp_obj_module_t analogbufio_module = { .globals = (mp_obj_dict_t *)&analogbufio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_analogbufio, analogbufio_module, CIRCUITPY_ANALOGBUFIO); +MP_REGISTER_MODULE(MP_QSTR_analogbufio, analogbufio_module); diff --git a/shared-bindings/analogio/AnalogIn.c b/shared-bindings/analogio/AnalogIn.c index 3b71f688c8..faf085905e 100644 --- a/shared-bindings/analogio/AnalogIn.c +++ b/shared-bindings/analogio/AnalogIn.c @@ -65,8 +65,7 @@ STATIC mp_obj_t analogio_analogin_make_new(const mp_obj_type_t *type, // 1st argument is the pin const mcu_pin_obj_t *pin = common_hal_analogio_analogin_validate_pin(args[0]); - analogio_analogin_obj_t *self = m_new_obj(analogio_analogin_obj_t); - self->base.type = &analogio_analogin_type; + analogio_analogin_obj_t *self = mp_obj_malloc(analogio_analogin_obj_t, &analogio_analogin_type); common_hal_analogio_analogin_construct(self, pin); return MP_OBJ_FROM_PTR(self); diff --git a/shared-bindings/analogio/AnalogOut.c b/shared-bindings/analogio/AnalogOut.c index 6b10d37571..36a6532b7c 100644 --- a/shared-bindings/analogio/AnalogOut.c +++ b/shared-bindings/analogio/AnalogOut.c @@ -63,8 +63,7 @@ STATIC mp_obj_t analogio_analogout_make_new(const mp_obj_type_t *type, mp_uint_t const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0], MP_QSTR_pin); - analogio_analogout_obj_t *self = m_new_obj(analogio_analogout_obj_t); - self->base.type = &analogio_analogout_type; + analogio_analogout_obj_t *self = mp_obj_malloc(analogio_analogout_obj_t, &analogio_analogout_type); common_hal_analogio_analogout_construct(self, pin); return MP_OBJ_FROM_PTR(self); diff --git a/shared-bindings/analogio/__init__.c b/shared-bindings/analogio/__init__.c index 2e7ccf7115..e6bd2f1f4d 100644 --- a/shared-bindings/analogio/__init__.c +++ b/shared-bindings/analogio/__init__.c @@ -79,4 +79,4 @@ const mp_obj_module_t analogio_module = { .globals = (mp_obj_dict_t *)&analogio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_analogio, analogio_module, CIRCUITPY_ANALOGIO); +MP_REGISTER_MODULE(MP_QSTR_analogio, analogio_module); diff --git a/shared-bindings/atexit/__init__.c b/shared-bindings/atexit/__init__.c index 9a91e0bc80..b3fe1b6c01 100644 --- a/shared-bindings/atexit/__init__.c +++ b/shared-bindings/atexit/__init__.c @@ -93,4 +93,4 @@ const mp_obj_module_t atexit_module = { .globals = (mp_obj_dict_t *)&atexit_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_atexit, atexit_module, CIRCUITPY_ATEXIT); +MP_REGISTER_MODULE(MP_QSTR_atexit, atexit_module); diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index 1f0e500292..4529920c6d 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -116,8 +116,7 @@ STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_ar const mcu_pin_obj_t *data_pin = validate_obj_is_free_pin(args[ARG_data_pin].u_obj, MP_QSTR_data_pin); // create PDMIn object from the given pin - audiobusio_pdmin_obj_t *self = m_new_obj(audiobusio_pdmin_obj_t); - self->base.type = &audiobusio_pdmin_type; + audiobusio_pdmin_obj_t *self = mp_obj_malloc(audiobusio_pdmin_obj_t, &audiobusio_pdmin_type); uint32_t sample_rate = args[ARG_sample_rate].u_int; uint8_t bit_depth = args[ARG_bit_depth].u_int; diff --git a/shared-bindings/audiobusio/__init__.c b/shared-bindings/audiobusio/__init__.c index 937028ee1f..a7ae705170 100644 --- a/shared-bindings/audiobusio/__init__.c +++ b/shared-bindings/audiobusio/__init__.c @@ -58,4 +58,4 @@ const mp_obj_module_t audiobusio_module = { .globals = (mp_obj_dict_t *)&audiobusio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_audiobusio, audiobusio_module, CIRCUITPY_AUDIOBUSIO); +MP_REGISTER_MODULE(MP_QSTR_audiobusio, audiobusio_module); diff --git a/shared-bindings/audiocore/RawSample.c b/shared-bindings/audiocore/RawSample.c index 39992f87c1..58ec83fe35 100644 --- a/shared-bindings/audiocore/RawSample.c +++ b/shared-bindings/audiocore/RawSample.c @@ -80,8 +80,7 @@ STATIC mp_obj_t audioio_rawsample_make_new(const mp_obj_type_t *type, size_t n_a mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - audioio_rawsample_obj_t *self = m_new_obj(audioio_rawsample_obj_t); - self->base.type = &audioio_rawsample_type; + audioio_rawsample_obj_t *self = mp_obj_malloc(audioio_rawsample_obj_t, &audioio_rawsample_type); mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); uint8_t bytes_per_sample = 1; diff --git a/shared-bindings/audiocore/WaveFile.c b/shared-bindings/audiocore/WaveFile.c index 3a13db72a0..aa50321040 100644 --- a/shared-bindings/audiocore/WaveFile.c +++ b/shared-bindings/audiocore/WaveFile.c @@ -79,8 +79,7 @@ STATIC mp_obj_t audioio_wavefile_make_new(const mp_obj_type_t *type, size_t n_ar arg = mp_call_function_2(MP_OBJ_FROM_PTR(&mp_builtin_open_obj), arg, MP_ROM_QSTR(MP_QSTR_rb)); } - audioio_wavefile_obj_t *self = m_new_obj(audioio_wavefile_obj_t); - self->base.type = &audioio_wavefile_type; + audioio_wavefile_obj_t *self = mp_obj_malloc(audioio_wavefile_obj_t, &audioio_wavefile_type); if (!mp_obj_is_type(arg, &mp_type_fileio)) { mp_raise_TypeError(translate("file must be a file opened in byte mode")); } diff --git a/shared-bindings/audiocore/__init__.c b/shared-bindings/audiocore/__init__.c index 3ecd7391b6..1e90f370d3 100644 --- a/shared-bindings/audiocore/__init__.c +++ b/shared-bindings/audiocore/__init__.c @@ -112,4 +112,4 @@ const mp_obj_module_t audiocore_module = { .globals = (mp_obj_dict_t *)&audiocore_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_audiocore, audiocore_module, CIRCUITPY_AUDIOCORE); +MP_REGISTER_MODULE(MP_QSTR_audiocore, audiocore_module); diff --git a/shared-bindings/audioio/AudioOut.c b/shared-bindings/audioio/AudioOut.c index 7909176114..c66f109f9a 100644 --- a/shared-bindings/audioio/AudioOut.c +++ b/shared-bindings/audioio/AudioOut.c @@ -111,8 +111,7 @@ STATIC mp_obj_t audioio_audioout_make_new(const mp_obj_type_t *type, size_t n_ar validate_obj_is_free_pin_or_none(args[ARG_right_channel].u_obj, MP_QSTR_right_channel); // create AudioOut object from the given pin - audioio_audioout_obj_t *self = m_new_obj(audioio_audioout_obj_t); - self->base.type = &audioio_audioout_type; + audioio_audioout_obj_t *self = mp_obj_malloc(audioio_audioout_obj_t, &audioio_audioout_type); common_hal_audioio_audioout_construct(self, left_channel_pin, right_channel_pin, args[ARG_quiescent_value].u_int); return MP_OBJ_FROM_PTR(self); diff --git a/shared-bindings/audioio/__init__.c b/shared-bindings/audioio/__init__.c index b76b534a7d..89778d8f82 100644 --- a/shared-bindings/audioio/__init__.c +++ b/shared-bindings/audioio/__init__.c @@ -65,4 +65,4 @@ const mp_obj_module_t audioio_module = { .globals = (mp_obj_dict_t *)&audioio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_audioio, audioio_module, CIRCUITPY_AUDIOIO); +MP_REGISTER_MODULE(MP_QSTR_audioio, audioio_module); diff --git a/shared-bindings/audiomixer/Mixer.c b/shared-bindings/audiomixer/Mixer.c index 83fcc06712..adfc447589 100644 --- a/shared-bindings/audiomixer/Mixer.c +++ b/shared-bindings/audiomixer/Mixer.c @@ -103,8 +103,8 @@ STATIC mp_obj_t audiomixer_mixer_make_new(const mp_obj_type_t *type, size_t n_ar if (bits_per_sample != 8 && bits_per_sample != 16) { mp_raise_ValueError(translate("bits_per_sample must be 8 or 16")); } - audiomixer_mixer_obj_t *self = m_new_obj_var(audiomixer_mixer_obj_t, mp_obj_t, voice_count); - self->base.type = &audiomixer_mixer_type; + audiomixer_mixer_obj_t *self = + mp_obj_malloc_var(audiomixer_mixer_obj_t, mp_obj_t, voice_count, &audiomixer_mixer_type; common_hal_audiomixer_mixer_construct(self, voice_count, args[ARG_buffer_size].u_int, bits_per_sample, args[ARG_samples_signed].u_bool, channel_count, sample_rate); for (int v = 0; v < voice_count; v++) { diff --git a/shared-bindings/audiomixer/MixerVoice.c b/shared-bindings/audiomixer/MixerVoice.c index 1d6cd7f39a..74b9c6745d 100644 --- a/shared-bindings/audiomixer/MixerVoice.c +++ b/shared-bindings/audiomixer/MixerVoice.c @@ -46,8 +46,7 @@ // TODO: support mono or stereo voices STATIC mp_obj_t audiomixer_mixervoice_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { mp_arg_check_num(n_args, n_kw, 0, 0, false); - audiomixer_mixervoice_obj_t *self = m_new_obj(audiomixer_mixervoice_obj_t); - self->base.type = &audiomixer_mixervoice_type; + audiomixer_mixervoice_obj_t *self = mp_obj_malloc(audiomixer_mixervoice_obj_t, &audiomixer_mixervoice_type); common_hal_audiomixer_mixervoice_construct(self); diff --git a/shared-bindings/audiomixer/__init__.c b/shared-bindings/audiomixer/__init__.c index 4c8068172b..552cc55e0c 100644 --- a/shared-bindings/audiomixer/__init__.c +++ b/shared-bindings/audiomixer/__init__.c @@ -45,4 +45,4 @@ const mp_obj_module_t audiomixer_module = { .globals = (mp_obj_dict_t *)&audiomixer_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_audiomixer, audiomixer_module, CIRCUITPY_AUDIOMIXER); +MP_REGISTER_MODULE(MP_QSTR_audiomixer, audiomixer_module); diff --git a/shared-bindings/audiomp3/MP3Decoder.c b/shared-bindings/audiomp3/MP3Decoder.c index 68e78cb0d5..ef5445a1de 100644 --- a/shared-bindings/audiomp3/MP3Decoder.c +++ b/shared-bindings/audiomp3/MP3Decoder.c @@ -95,8 +95,7 @@ STATIC mp_obj_t audiomp3_mp3file_make_new(const mp_obj_type_t *type, size_t n_ar arg = mp_call_function_2(MP_OBJ_FROM_PTR(&mp_builtin_open_obj), arg, MP_ROM_QSTR(MP_QSTR_rb)); } - audiomp3_mp3file_obj_t *self = m_new_obj(audiomp3_mp3file_obj_t); - self->base.type = &audiomp3_mp3file_type; + audiomp3_mp3file_obj_t *self = mp_obj_malloc(audiomp3_mp3file_obj_t, &audiomp3_mp3file_type); if (!mp_obj_is_type(arg, &mp_type_fileio)) { mp_raise_TypeError(translate("file must be a file opened in byte mode")); } diff --git a/shared-bindings/audiomp3/__init__.c b/shared-bindings/audiomp3/__init__.c index 9fe525dfe2..09a3d4f886 100644 --- a/shared-bindings/audiomp3/__init__.c +++ b/shared-bindings/audiomp3/__init__.c @@ -50,4 +50,4 @@ const mp_obj_module_t audiomp3_module = { .globals = (mp_obj_dict_t *)&audiomp3_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_audiomp3, audiomp3_module, CIRCUITPY_AUDIOMP3); +MP_REGISTER_MODULE(MP_QSTR_audiomp3, audiomp3_module); diff --git a/shared-bindings/audiopwmio/__init__.c b/shared-bindings/audiopwmio/__init__.c index 441bca2132..f8d7c0e5cb 100644 --- a/shared-bindings/audiopwmio/__init__.c +++ b/shared-bindings/audiopwmio/__init__.c @@ -57,4 +57,4 @@ const mp_obj_module_t audiopwmio_module = { .globals = (mp_obj_dict_t *)&audiopwmio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_audiopwmio, audiopwmio_module, CIRCUITPY_AUDIOPWMIO); +MP_REGISTER_MODULE(MP_QSTR_audiopwmio, audiopwmio_module); diff --git a/shared-bindings/bitbangio/I2C.c b/shared-bindings/bitbangio/I2C.c index 9684b87df2..390e1c0c98 100644 --- a/shared-bindings/bitbangio/I2C.c +++ b/shared-bindings/bitbangio/I2C.c @@ -80,8 +80,7 @@ STATIC mp_obj_t bitbangio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, const mcu_pin_obj_t *scl = validate_obj_is_free_pin(args[ARG_scl].u_obj, MP_QSTR_scl); const mcu_pin_obj_t *sda = validate_obj_is_free_pin(args[ARG_sda].u_obj, MP_QSTR_sda); - bitbangio_i2c_obj_t *self = m_new_obj(bitbangio_i2c_obj_t); - self->base.type = &bitbangio_i2c_type; + bitbangio_i2c_obj_t *self = mp_obj_malloc(bitbangio_i2c_obj_t, &bitbangio_i2c_type); shared_module_bitbangio_i2c_construct(self, scl, sda, args[ARG_frequency].u_int, args[ARG_timeout].u_int); return (mp_obj_t)self; } diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c index cf4f34f0e4..dd452fc843 100644 --- a/shared-bindings/bitbangio/SPI.c +++ b/shared-bindings/bitbangio/SPI.c @@ -89,8 +89,7 @@ STATIC mp_obj_t bitbangio_spi_make_new(const mp_obj_type_t *type, size_t n_args, const mcu_pin_obj_t *mosi = validate_obj_is_free_pin_or_none(args[ARG_MOSI].u_obj, MP_QSTR_mosi); const mcu_pin_obj_t *miso = validate_obj_is_free_pin_or_none(args[ARG_MISO].u_obj, MP_QSTR_miso); - bitbangio_spi_obj_t *self = m_new_obj(bitbangio_spi_obj_t); - self->base.type = &bitbangio_spi_type; + bitbangio_spi_obj_t *self = mp_obj_malloc(bitbangio_spi_obj_t, &bitbangio_spi_type); shared_module_bitbangio_spi_construct(self, clock, mosi, miso); return (mp_obj_t)self; } diff --git a/shared-bindings/bitbangio/__init__.c b/shared-bindings/bitbangio/__init__.c index 1b13003e89..99bf6d26a7 100644 --- a/shared-bindings/bitbangio/__init__.c +++ b/shared-bindings/bitbangio/__init__.c @@ -80,4 +80,4 @@ const mp_obj_module_t bitbangio_module = { .globals = (mp_obj_dict_t *)&bitbangio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_bitbangio, bitbangio_module, CIRCUITPY_BITBANGIO); +MP_REGISTER_MODULE(MP_QSTR_bitbangio, bitbangio_module); diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index d0aea33ef9..5a70533ebe 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -970,4 +970,4 @@ const mp_obj_module_t bitmaptools_module = { .globals = (mp_obj_dict_t *)&bitmaptools_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_bitmaptools, bitmaptools_module, CIRCUITPY_BITMAPTOOLS); +MP_REGISTER_MODULE(MP_QSTR_bitmaptools, bitmaptools_module); diff --git a/shared-bindings/bitops/__init__.c b/shared-bindings/bitops/__init__.c index 3107b310db..48cf1df0d6 100644 --- a/shared-bindings/bitops/__init__.c +++ b/shared-bindings/bitops/__init__.c @@ -99,4 +99,4 @@ const mp_obj_module_t bitops_module = { .globals = (mp_obj_dict_t *)&bitops_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_bitops, bitops_module, CIRCUITPY_BITOPS); +MP_REGISTER_MODULE(MP_QSTR_bitops, bitops_module); diff --git a/shared-bindings/board/__init__.c b/shared-bindings/board/__init__.c index 99b99b37ea..273ef7ff90 100644 --- a/shared-bindings/board/__init__.c +++ b/shared-bindings/board/__init__.c @@ -119,4 +119,4 @@ const mp_obj_module_t board_module = { .globals = (mp_obj_dict_t *)&board_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_board, board_module, CIRCUITPY_BOARD); +MP_REGISTER_MODULE(MP_QSTR_board, board_module); diff --git a/shared-bindings/busio/I2C.c b/shared-bindings/busio/I2C.c index 5cf52eaa1a..14ec7093a5 100644 --- a/shared-bindings/busio/I2C.c +++ b/shared-bindings/busio/I2C.c @@ -68,8 +68,7 @@ //| """ //| ... STATIC mp_obj_t busio_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - busio_i2c_obj_t *self = m_new_obj(busio_i2c_obj_t); - self->base.type = &busio_i2c_type; + busio_i2c_obj_t *self = mp_obj_malloc(busio_i2c_obj_t, &busio_i2c_type); enum { ARG_scl, ARG_sda, ARG_frequency, ARG_timeout }; static const mp_arg_t allowed_args[] = { { MP_QSTR_scl, MP_ARG_REQUIRED | MP_ARG_OBJ }, diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index ccdceb5760..42c9d5b63b 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -91,8 +91,7 @@ // TODO(tannewt): Support LSB SPI. STATIC mp_obj_t busio_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { #if CIRCUITPY_BUSIO_SPI - busio_spi_obj_t *self = m_new_obj(busio_spi_obj_t); - self->base.type = &busio_spi_type; + busio_spi_obj_t *self = mp_obj_malloc(busio_spi_obj_t, &busio_spi_type); enum { ARG_clock, ARG_MOSI, ARG_MISO, ARG_half_duplex }; static const mp_arg_t allowed_args[] = { { MP_QSTR_clock, MP_ARG_REQUIRED | MP_ARG_OBJ }, diff --git a/shared-bindings/busio/__init__.c b/shared-bindings/busio/__init__.c index 4d62c8333e..5d6b60ac3f 100644 --- a/shared-bindings/busio/__init__.c +++ b/shared-bindings/busio/__init__.c @@ -93,4 +93,4 @@ const mp_obj_module_t busio_module = { .globals = (mp_obj_dict_t *)&busio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_busio, busio_module, CIRCUITPY_BUSIO); +MP_REGISTER_MODULE(MP_QSTR_busio, busio_module); diff --git a/shared-bindings/camera/Camera.c b/shared-bindings/camera/Camera.c index 4f6023c9fd..eea22a0d81 100644 --- a/shared-bindings/camera/Camera.c +++ b/shared-bindings/camera/Camera.c @@ -61,8 +61,7 @@ //| """Initialize camera.""" //| ... STATIC mp_obj_t camera_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - camera_obj_t *self = m_new_obj(camera_obj_t); - self->base.type = &camera_type; + camera_obj_t *self = mp_obj_malloc(camera_obj_t, &camera_type); // No arguments mp_arg_check_num(n_args, n_kw, 0, 0, false); diff --git a/shared-bindings/camera/__init__.c b/shared-bindings/camera/__init__.c index e4ee263f58..a2b15933c4 100644 --- a/shared-bindings/camera/__init__.c +++ b/shared-bindings/camera/__init__.c @@ -48,4 +48,4 @@ const mp_obj_module_t camera_module = { .globals = (mp_obj_dict_t *)&camera_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_camera, camera_module, CIRCUITPY_CAMERA); +MP_REGISTER_MODULE(MP_QSTR_camera, camera_module); diff --git a/shared-bindings/canio/CAN.c b/shared-bindings/canio/CAN.c index bce581f501..912255adf4 100644 --- a/shared-bindings/canio/CAN.c +++ b/shared-bindings/canio/CAN.c @@ -83,8 +83,7 @@ STATIC mp_obj_t canio_can_make_new(const mp_obj_type_t *type, size_t n_args, siz mp_raise_ValueError(translate("tx and rx cannot both be None")); } - canio_can_obj_t *self = m_new_obj(canio_can_obj_t); - self->base.type = &canio_can_type; + canio_can_obj_t *self = mp_obj_malloc(canio_can_obj_t, &canio_can_type); common_hal_canio_can_construct(self, tx_pin, rx_pin, args[ARG_baudrate].u_int, args[ARG_loopback].u_bool, args[ARG_silent].u_bool); common_hal_canio_can_auto_restart_set(self, args[ARG_auto_restart].u_bool); diff --git a/shared-bindings/canio/Match.c b/shared-bindings/canio/Match.c index 06729f9c54..1a9cd34916 100644 --- a/shared-bindings/canio/Match.c +++ b/shared-bindings/canio/Match.c @@ -64,8 +64,7 @@ STATIC mp_obj_t canio_match_make_new(const mp_obj_type_t *type, size_t n_args, s mp_raise_ValueError_varg(translate("%q out of range"), MP_QSTR_mask); } - canio_match_obj_t *self = m_new_obj(canio_match_obj_t); - self->base.type = &canio_match_type; + canio_match_obj_t *self = mp_obj_malloc(canio_match_obj_t, &canio_match_type); common_hal_canio_match_construct(self, id, mask, args[ARG_extended].u_bool); return self; } diff --git a/shared-bindings/canio/Message.c b/shared-bindings/canio/Message.c index c3857256bd..432b10b4e8 100644 --- a/shared-bindings/canio/Message.c +++ b/shared-bindings/canio/Message.c @@ -58,8 +58,7 @@ STATIC mp_obj_t canio_message_make_new(const mp_obj_type_t *type, size_t n_args, mp_arg_validate_length_range(data.len, 0, 8, MP_QSTR_data); - canio_message_obj_t *self = m_new_obj(canio_message_obj_t); - self->base.type = &canio_message_type; + canio_message_obj_t *self = mp_obj_malloc(canio_message_obj_t, &canio_message_type); common_hal_canio_message_construct(self, args[ARG_id].u_int, data.buf, data.len, args[ARG_extended].u_bool); return self; } diff --git a/shared-bindings/canio/RemoteTransmissionRequest.c b/shared-bindings/canio/RemoteTransmissionRequest.c index 1efc401909..4b55bf2e75 100644 --- a/shared-bindings/canio/RemoteTransmissionRequest.c +++ b/shared-bindings/canio/RemoteTransmissionRequest.c @@ -58,8 +58,8 @@ STATIC mp_obj_t canio_remote_transmission_request_make_new(const mp_obj_type_t * mp_raise_ValueError(translate("RemoteTransmissionRequests limited to 8 bytes")); } - canio_remote_transmission_request_obj_t *self = m_new_obj(canio_remote_transmission_request_obj_t); - self->base.type = &canio_remote_transmission_request_type; + canio_remote_transmission_request_obj_t *self = + mp_obj_malloc(canio_remote_transmission_request_obj_t, &canio_remote_transmission_request_type); common_hal_canio_remote_transmission_request_construct(self, args[ARG_id].u_int, length, args[ARG_extended].u_bool); return self; } diff --git a/shared-bindings/canio/__init__.c b/shared-bindings/canio/__init__.c index ecef7ebde6..f5de9af547 100644 --- a/shared-bindings/canio/__init__.c +++ b/shared-bindings/canio/__init__.c @@ -128,4 +128,4 @@ const mp_obj_module_t canio_module = { .globals = (mp_obj_dict_t *)&canio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_canio, canio_module, CIRCUITPY_CANIO); +MP_REGISTER_MODULE(MP_QSTR_canio, canio_module); diff --git a/shared-bindings/countio/__init__.c b/shared-bindings/countio/__init__.c index 0d412cc17f..9646e0879e 100644 --- a/shared-bindings/countio/__init__.c +++ b/shared-bindings/countio/__init__.c @@ -35,4 +35,5 @@ const mp_obj_module_t countio_module = { .globals = (mp_obj_dict_t *)&countio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_countio, countio_module, CIRCUITPY_COUNTIO); +MP_REGISTER_MODULE(MP_QSTR_countio, countio_module); +p diff --git a/shared-bindings/digitalio/DigitalInOut.c b/shared-bindings/digitalio/DigitalInOut.c index c0195115fa..832f16558a 100644 --- a/shared-bindings/digitalio/DigitalInOut.c +++ b/shared-bindings/digitalio/DigitalInOut.c @@ -90,8 +90,7 @@ STATIC mp_obj_t digitalio_digitalinout_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 1, 1, false); - digitalio_digitalinout_obj_t *self = m_new_obj(digitalio_digitalinout_obj_t); - self->base.type = &digitalio_digitalinout_type; + digitalio_digitalinout_obj_t *self = mp_obj_malloc(digitalio_digitalinout_obj_t, &digitalio_digitalinout_type); const mcu_pin_obj_t *pin = common_hal_digitalio_validate_pin(args[0]); common_hal_digitalio_digitalinout_construct(self, pin); diff --git a/shared-bindings/digitalio/__init__.c b/shared-bindings/digitalio/__init__.c index 9a9db69816..938b7df754 100644 --- a/shared-bindings/digitalio/__init__.c +++ b/shared-bindings/digitalio/__init__.c @@ -97,4 +97,4 @@ const mp_obj_module_t digitalio_module = { .globals = (mp_obj_dict_t *)&digitalio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_digitalio, digitalio_module, CIRCUITPY_DIGITALIO); +MP_REGISTER_MODULE(MP_QSTR_digitalio, digitalio_module); diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index 5b939c5892..86486210b0 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -75,8 +75,7 @@ STATIC mp_obj_t displayio_bitmap_make_new(const mp_obj_type_t *type, size_t n_ar } } - displayio_bitmap_t *self = m_new_obj(displayio_bitmap_t); - self->base.type = &displayio_bitmap_type; + displayio_bitmap_t *self = mp_obj_malloc(displayio_bitmap_t, &displayio_bitmap_type); common_hal_displayio_bitmap_construct(self, width, height, bits); return MP_OBJ_FROM_PTR(self); diff --git a/shared-bindings/displayio/ColorConverter.c b/shared-bindings/displayio/ColorConverter.c index 06de5a4b09..0ec78779ee 100644 --- a/shared-bindings/displayio/ColorConverter.c +++ b/shared-bindings/displayio/ColorConverter.c @@ -58,8 +58,7 @@ STATIC mp_obj_t displayio_colorconverter_make_new(const mp_obj_type_t *type, siz mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - displayio_colorconverter_t *self = m_new_obj(displayio_colorconverter_t); - self->base.type = &displayio_colorconverter_type; + displayio_colorconverter_t *self = mp_obj_malloc(displayio_colorconverter_t, &displayio_colorconverter_type); common_hal_displayio_colorconverter_construct(self, args[ARG_dither].u_bool, (displayio_colorspace_t)cp_enum_value(&displayio_colorspace_type, args[ARG_input_colorspace].u_obj, MP_QSTR_input_colorspace)); diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index 279e1f161b..b24acfd675 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -58,8 +58,7 @@ STATIC mp_obj_t displayio_group_make_new(const mp_obj_type_t *type, size_t n_arg mp_int_t scale = mp_arg_validate_int_range(args[ARG_scale].u_int, 1, 32767,MP_QSTR_scale); - displayio_group_t *self = m_new_obj(displayio_group_t); - self->base.type = &displayio_group_type; + displayio_group_t *self = mp_obj_malloc(displayio_group_t, &displayio_group_type); common_hal_displayio_group_construct(self, scale, args[ARG_x].u_int, args[ARG_y].u_int); return MP_OBJ_FROM_PTR(self); diff --git a/shared-bindings/displayio/OnDiskBitmap.c b/shared-bindings/displayio/OnDiskBitmap.c index a53196ef05..d0dcba2339 100644 --- a/shared-bindings/displayio/OnDiskBitmap.c +++ b/shared-bindings/displayio/OnDiskBitmap.c @@ -89,8 +89,7 @@ STATIC mp_obj_t displayio_ondiskbitmap_make_new(const mp_obj_type_t *type, size_ mp_raise_TypeError(translate("file must be a file opened in byte mode")); } - displayio_ondiskbitmap_t *self = m_new_obj(displayio_ondiskbitmap_t); - self->base.type = &displayio_ondiskbitmap_type; + displayio_ondiskbitmap_t *self = mp_obj_malloc(displayio_ondiskbitmap_t, &displayio_ondiskbitmap_type); common_hal_displayio_ondiskbitmap_construct(self, MP_OBJ_TO_PTR(arg)); return MP_OBJ_FROM_PTR(self); diff --git a/shared-bindings/displayio/Palette.c b/shared-bindings/displayio/Palette.c index 0c44ed0f60..abe5e369dd 100644 --- a/shared-bindings/displayio/Palette.c +++ b/shared-bindings/displayio/Palette.c @@ -59,8 +59,7 @@ STATIC mp_obj_t displayio_palette_make_new(const mp_obj_type_t *type, size_t n_a mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - displayio_palette_t *self = m_new_obj(displayio_palette_t); - self->base.type = &displayio_palette_type; + displayio_palette_t *self = mp_obj_malloc(displayio_palette_t, &displayio_palette_type); common_hal_displayio_palette_construct(self, mp_arg_validate_int_range(args[ARG_color_count].u_int, 1, 32767, MP_QSTR_color_count), args[ARG_dither].u_bool); return MP_OBJ_FROM_PTR(self); diff --git a/shared-bindings/displayio/Shape.c b/shared-bindings/displayio/Shape.c index c8b3959837..11b73c4463 100644 --- a/shared-bindings/displayio/Shape.c +++ b/shared-bindings/displayio/Shape.c @@ -62,8 +62,7 @@ STATIC mp_obj_t displayio_shape_make_new(const mp_obj_type_t *type, size_t n_arg mp_int_t width = mp_arg_validate_int_min(args[ARG_width].u_int, 1, MP_QSTR_width); mp_int_t height = mp_arg_validate_int_min(args[ARG_height].u_int, 1, MP_QSTR_height); - displayio_shape_t *self = m_new_obj(displayio_shape_t); - self->base.type = &displayio_shape_type; + displayio_shape_t *self = mp_obj_malloc(displayio_shape_t, &displayio_shape_type); common_hal_displayio_shape_construct(self, width, height, diff --git a/shared-bindings/displayio/TileGrid.c b/shared-bindings/displayio/TileGrid.c index f2e16985c3..5d27580fdf 100644 --- a/shared-bindings/displayio/TileGrid.c +++ b/shared-bindings/displayio/TileGrid.c @@ -139,8 +139,7 @@ STATIC mp_obj_t displayio_tilegrid_make_new(const mp_obj_type_t *type, size_t n_ int16_t x = args[ARG_x].u_int; int16_t y = args[ARG_y].u_int; - displayio_tilegrid_t *self = m_new_obj(displayio_tilegrid_t); - self->base.type = &displayio_tilegrid_type; + displayio_tilegrid_t *self = mp_obj_malloc(displayio_tilegrid_t, &displayio_tilegrid_type); common_hal_displayio_tilegrid_construct(self, native, bitmap_width / tile_width, bitmap_height / tile_height, pixel_shader, args[ARG_width].u_int, args[ARG_height].u_int, diff --git a/shared-bindings/displayio/__init__.c b/shared-bindings/displayio/__init__.c index 6b4dc6d895..e377a49dea 100644 --- a/shared-bindings/displayio/__init__.c +++ b/shared-bindings/displayio/__init__.c @@ -109,4 +109,4 @@ const mp_obj_module_t displayio_module = { .globals = (mp_obj_dict_t *)&displayio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_displayio, displayio_module, CIRCUITPY_DISPLAYIO); +MP_REGISTER_MODULE(MP_QSTR_displayio, displayio_module); diff --git a/shared-bindings/dualbank/__init__.c b/shared-bindings/dualbank/__init__.c index b77fb6d76b..0bb095ddac 100644 --- a/shared-bindings/dualbank/__init__.c +++ b/shared-bindings/dualbank/__init__.c @@ -141,4 +141,4 @@ const mp_obj_module_t dualbank_module = { .globals = (mp_obj_dict_t *)&dualbank_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_dualbank, dualbank_module, CIRCUITPY_DUALBANK); +MP_REGISTER_MODULE(MP_QSTR_dualbank, dualbank_module); diff --git a/shared-bindings/floppyio/__init__.c b/shared-bindings/floppyio/__init__.c index b114ab46dc..86c5813bdc 100644 --- a/shared-bindings/floppyio/__init__.c +++ b/shared-bindings/floppyio/__init__.c @@ -127,4 +127,4 @@ const mp_obj_module_t floppyio_module = { .globals = (mp_obj_dict_t *)&floppyio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_floppyio, floppyio_module, CIRCUITPY_FLOPPYIO); +MP_REGISTER_MODULE(MP_QSTR_floppyio, floppyio_module); diff --git a/shared-bindings/fontio/__init__.c b/shared-bindings/fontio/__init__.c index 24e1eb1e3b..d988ceda7f 100644 --- a/shared-bindings/fontio/__init__.c +++ b/shared-bindings/fontio/__init__.c @@ -56,4 +56,4 @@ const mp_obj_module_t fontio_module = { .globals = (mp_obj_dict_t *)&fontio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_fontio, fontio_module, CIRCUITPY_FONTIO); +MP_REGISTER_MODULE(MP_QSTR_fontio, fontio_module); diff --git a/shared-bindings/framebufferio/__init__.c b/shared-bindings/framebufferio/__init__.c index 324442268e..739c26f171 100644 --- a/shared-bindings/framebufferio/__init__.c +++ b/shared-bindings/framebufferio/__init__.c @@ -49,5 +49,5 @@ const mp_obj_module_t framebufferio_module = { .globals = (mp_obj_dict_t *)&framebufferio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_framebufferio, framebufferio_module, CIRCUITPY_FRAMEBUFFERIO); +MP_REGISTER_MODULE(MP_QSTR_framebufferio, framebufferio_module); #endif diff --git a/shared-bindings/frequencyio/FrequencyIn.c b/shared-bindings/frequencyio/FrequencyIn.c index bf09196e3d..c3ce5e94a7 100644 --- a/shared-bindings/frequencyio/FrequencyIn.c +++ b/shared-bindings/frequencyio/FrequencyIn.c @@ -73,8 +73,8 @@ STATIC mp_obj_t frequencyio_frequencyin_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { mp_arg_check_num(n_args, n_kw, 1, 1, true); - frequencyio_frequencyin_obj_t *self = m_new_obj(frequencyio_frequencyin_obj_t); - self->base.type = &frequencyio_frequencyin_type; + frequencyio_frequencyin_obj_t *self = + mp_obj_malloc(frequencyio_frequencyin_obj_t, &frequencyio_frequencyin_type); enum { ARG_pin, ARG_capture_period }; static const mp_arg_t allowed_args[] = { { MP_QSTR_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, diff --git a/shared-bindings/frequencyio/__init__.c b/shared-bindings/frequencyio/__init__.c index 18022c7f6e..80b60651de 100644 --- a/shared-bindings/frequencyio/__init__.c +++ b/shared-bindings/frequencyio/__init__.c @@ -71,4 +71,4 @@ const mp_obj_module_t frequencyio_module = { .globals = (mp_obj_dict_t *)&frequencyio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_frequencyio, frequencyio_module, CIRCUITPY_FREQUENCYIO); +MP_REGISTER_MODULE(MP_QSTR_frequencyio, frequencyio_module); diff --git a/shared-bindings/getpass/__init__.c b/shared-bindings/getpass/__init__.c index 811d78e03d..d6b65ec945 100644 --- a/shared-bindings/getpass/__init__.c +++ b/shared-bindings/getpass/__init__.c @@ -84,4 +84,4 @@ const mp_obj_module_t getpass_module = { .globals = (mp_obj_dict_t *)&getpass_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_getpass, getpass_module, CIRCUITPY_GETPASS); +MP_REGISTER_MODULE(MP_QSTR_getpass, getpass_module); diff --git a/shared-bindings/gifio/GifWriter.c b/shared-bindings/gifio/GifWriter.c index a0de52e2cc..e28d48bb99 100644 --- a/shared-bindings/gifio/GifWriter.c +++ b/shared-bindings/gifio/GifWriter.c @@ -73,8 +73,7 @@ static mp_obj_t gifio_gifwriter_make_new(const mp_obj_type_t *type, size_t n_arg own_file = true; } - gifio_gifwriter_t *self = m_new_obj(gifio_gifwriter_t); - self->base.type = &gifio_gifwriter_type; + gifio_gifwriter_t *self = mp_obj_malloc(gifio_gifwriter_t, &gifio_gifwriter_type); shared_module_gifio_gifwriter_construct( self, file, diff --git a/shared-bindings/gifio/OnDiskGif.c b/shared-bindings/gifio/OnDiskGif.c index e4335f9e44..ec120f5838 100644 --- a/shared-bindings/gifio/OnDiskGif.c +++ b/shared-bindings/gifio/OnDiskGif.c @@ -135,8 +135,7 @@ STATIC mp_obj_t gifio_ondiskgif_make_new(const mp_obj_type_t *type, size_t n_arg mp_raise_TypeError(translate("file must be a file opened in byte mode")); } - gifio_ondiskgif_t *self = m_new_obj(gifio_ondiskgif_t); - self->base.type = &gifio_ondiskgif_type; + gifio_ondiskgif_t *self = mp_obj_malloc(gifio_ondiskgif_t, &gifio_ondiskgif_type); common_hal_gifio_ondiskgif_construct(self, MP_OBJ_TO_PTR(filename), args[ARG_use_palette].u_bool); return MP_OBJ_FROM_PTR(self); diff --git a/shared-bindings/gifio/__init__.c b/shared-bindings/gifio/__init__.c index bfc87f0d99..7691a6cedb 100644 --- a/shared-bindings/gifio/__init__.c +++ b/shared-bindings/gifio/__init__.c @@ -45,4 +45,4 @@ const mp_obj_module_t gifio_module = { .globals = (mp_obj_dict_t *)&gifio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_gifio, gifio_module, CIRCUITPY_GIFIO); +MP_REGISTER_MODULE(MP_QSTR_gifio, gifio_module); diff --git a/shared-bindings/gnss/GNSS.c b/shared-bindings/gnss/GNSS.c index d3c9547787..54b3f0b46c 100644 --- a/shared-bindings/gnss/GNSS.c +++ b/shared-bindings/gnss/GNSS.c @@ -37,8 +37,7 @@ //| :param system: satellite system to use""" //| ... STATIC mp_obj_t gnss_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - gnss_obj_t *self = m_new_obj(gnss_obj_t); - self->base.type = &gnss_type; + gnss_obj_t *self = mp_obj_malloc(gnss_obj_t, &gnss_type); enum { ARG_system }; static const mp_arg_t allowed_args[] = { { MP_QSTR_system, MP_ARG_REQUIRED | MP_ARG_OBJ }, diff --git a/shared-bindings/gnss/__init__.c b/shared-bindings/gnss/__init__.c index 6029e1a54e..7fe1b06e16 100644 --- a/shared-bindings/gnss/__init__.c +++ b/shared-bindings/gnss/__init__.c @@ -29,4 +29,4 @@ const mp_obj_module_t gnss_module = { .globals = (mp_obj_dict_t *)&gnss_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_gnss, gnss_module, CIRCUITPY_GNSS); +MP_REGISTER_MODULE(MP_QSTR_gnss, gnss_modulex); diff --git a/shared-bindings/hashlib/__init__.c b/shared-bindings/hashlib/__init__.c index 424159f84c..87f6df495a 100644 --- a/shared-bindings/hashlib/__init__.c +++ b/shared-bindings/hashlib/__init__.c @@ -57,8 +57,7 @@ STATIC mp_obj_t hashlib_new(size_t n_args, const mp_obj_t *pos_args, mp_map_t *k const char *algorithm = mp_obj_str_get_str(args[ARG_name].u_obj); - hashlib_hash_obj_t *self = m_new_obj(hashlib_hash_obj_t); - self->base.type = &hashlib_hash_type; + hashlib_hash_obj_t *self = mp_obj_malloc(hashlib_hash_obj_t, &hashlib_hash_type); if (!common_hal_hashlib_new(self, algorithm)) { mp_raise_ValueError(translate("Unsupported hash algorithm")); @@ -87,4 +86,4 @@ const mp_obj_module_t hashlib_module = { .globals = (mp_obj_dict_t *)&hashlib_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_hashlib, hashlib_module, CIRCUITPY_HASHLIB); +MP_REGISTER_MODULE(MP_QSTR_hashlib, hashlib_module); diff --git a/shared-bindings/i2ctarget/I2CTarget.c b/shared-bindings/i2ctarget/I2CTarget.c index a07d038c6f..4346362632 100644 --- a/shared-bindings/i2ctarget/I2CTarget.c +++ b/shared-bindings/i2ctarget/I2CTarget.c @@ -40,8 +40,8 @@ #include "py/runtime.h" STATIC mp_obj_t mp_obj_new_i2ctarget_i2c_target_request(i2ctarget_i2c_target_obj_t *target, uint8_t address, bool is_read, bool is_restart) { - i2ctarget_i2c_target_request_obj_t *self = m_new_obj(i2ctarget_i2c_target_request_obj_t); - self->base.type = &i2ctarget_i2c_target_request_type; + i2ctarget_i2c_target_request_obj_t *self = + mp_obj_malloc(i2ctarget_i2c_target_request_obj_t, &i2ctarget_i2c_target_request_type) self->target = target; self->address = address; self->is_read = is_read; @@ -69,8 +69,7 @@ STATIC mp_obj_t mp_obj_new_i2ctarget_i2c_target_request(i2ctarget_i2c_target_obj //| :param bool smbus: Use SMBUS timings if the hardware supports it""" //| ... STATIC mp_obj_t i2ctarget_i2c_target_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - i2ctarget_i2c_target_obj_t *self = m_new_obj(i2ctarget_i2c_target_obj_t); - self->base.type = &i2ctarget_i2c_target_type; + i2ctarget_i2c_target_obj_t *self = mp_obj_malloc(i2ctarget_i2c_target_obj_t, &i2ctarget_i2c_target_type); enum { ARG_scl, ARG_sda, ARG_addresses, ARG_smbus }; static const mp_arg_t allowed_args[] = { { MP_QSTR_scl, MP_ARG_REQUIRED | MP_ARG_OBJ }, diff --git a/shared-bindings/i2ctarget/__init__.c b/shared-bindings/i2ctarget/__init__.c index 0fa7e50dd6..f9a358eef4 100644 --- a/shared-bindings/i2ctarget/__init__.c +++ b/shared-bindings/i2ctarget/__init__.c @@ -106,7 +106,4 @@ const mp_obj_module_t i2ctarget_module = { .globals = (mp_obj_dict_t *)&i2ctarget_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_i2ctarget, i2ctarget_module, CIRCUITPY_I2CTARGET); - -// TODO: Remove for CircuitPython 9.0.0 -MP_REGISTER_MODULE(MP_QSTR_i2cperipheral, i2ctarget_module, CIRCUITPY_I2CTARGET); +MP_REGISTER_MODULE(MP_QSTR_i2ctarget, i2ctarget_module); diff --git a/shared-bindings/imagecapture/ParallelImageCapture.c b/shared-bindings/imagecapture/ParallelImageCapture.c index d568da158f..56d7bfbc48 100644 --- a/shared-bindings/imagecapture/ParallelImageCapture.c +++ b/shared-bindings/imagecapture/ParallelImageCapture.c @@ -76,8 +76,8 @@ STATIC mp_obj_t imagecapture_parallelimagecapture_make_new(const mp_obj_type_t * const mcu_pin_obj_t *vsync = validate_obj_is_free_pin_or_none(args[ARG_vsync].u_obj, MP_QSTR_vsync); const mcu_pin_obj_t *href = validate_obj_is_free_pin_or_none(args[ARG_href].u_obj, MP_QSTR_href); - imagecapture_parallelimagecapture_obj_t *self = m_new_obj(imagecapture_parallelimagecapture_obj_t); - self->base.type = &imagecapture_parallelimagecapture_type; + imagecapture_parallelimagecapture_obj_t *self = + mp_obj_malloc(imagecapture_parallelimagecapture_obj_t, &imagecapture_parallelimagecapture_type); common_hal_imagecapture_parallelimagecapture_construct(self, pins, pin_count, clock, vsync, href); diff --git a/shared-bindings/imagecapture/__init__.c b/shared-bindings/imagecapture/__init__.c index 71d0b9125b..de30ec24ba 100644 --- a/shared-bindings/imagecapture/__init__.c +++ b/shared-bindings/imagecapture/__init__.c @@ -50,4 +50,4 @@ const mp_obj_module_t imagecapture_module = { .globals = (mp_obj_dict_t *)&imagecapture_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_imagecapture, imagecapture_module, CIRCUITPY_IMAGECAPTURE); +MP_REGISTER_MODULE(MP_QSTR_imagecapture, imagecapture_module); diff --git a/shared-bindings/ipaddress/IPv4Address.c b/shared-bindings/ipaddress/IPv4Address.c index b9a2363e09..4f7cfc3853 100644 --- a/shared-bindings/ipaddress/IPv4Address.c +++ b/shared-bindings/ipaddress/IPv4Address.c @@ -77,8 +77,7 @@ STATIC mp_obj_t ipaddress_ipv4address_make_new(const mp_obj_type_t *type, size_t } - ipaddress_ipv4address_obj_t *self = m_new_obj(ipaddress_ipv4address_obj_t); - self->base.type = &ipaddress_ipv4address_type; + ipaddress_ipv4address_obj_t *self = mp_obj_malloc(ipaddress_ipv4address_obj_t, &ipaddress_ipv4address_type); common_hal_ipaddress_ipv4address_construct(self, buf, 4); diff --git a/shared-bindings/ipaddress/__init__.c b/shared-bindings/ipaddress/__init__.c index 6da5a52299..eb2b8f8ff6 100644 --- a/shared-bindings/ipaddress/__init__.c +++ b/shared-bindings/ipaddress/__init__.c @@ -112,4 +112,4 @@ const mp_obj_module_t ipaddress_module = { .globals = (mp_obj_dict_t *)&ipaddress_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_ipaddress, ipaddress_module, CIRCUITPY_IPADDRESS); +MP_REGISTER_MODULE(MP_QSTR_ipaddress, ipaddress_module); diff --git a/shared-bindings/is31fl3741/IS31FL3741.c b/shared-bindings/is31fl3741/IS31FL3741.c index 17b12da67a..79982b4c90 100644 --- a/shared-bindings/is31fl3741/IS31FL3741.c +++ b/shared-bindings/is31fl3741/IS31FL3741.c @@ -57,8 +57,7 @@ STATIC mp_obj_t is31fl3741_IS31FL3741_make_new(const mp_obj_type_t *type, size_t mp_obj_t i2c = mp_arg_validate_type(args[ARG_i2c].u_obj, &busio_i2c_type, MP_QSTR_i2c_bus); - is31fl3741_IS31FL3741_obj_t *self = m_new_obj(is31fl3741_IS31FL3741_obj_t); - self->base.type = &is31fl3741_IS31FL3741_type; + is31fl3741_IS31FL3741_obj_t *self = mp_obj_malloc(is31fl3741_IS31FL3741_obj_t, &is31fl3741_IS31FL3741_type); common_hal_is31fl3741_IS31FL3741_construct(self, MP_OBJ_TO_PTR(i2c), diff --git a/shared-bindings/is31fl3741/__init__.c b/shared-bindings/is31fl3741/__init__.c index 605889700c..d7fbc5f6e6 100644 --- a/shared-bindings/is31fl3741/__init__.c +++ b/shared-bindings/is31fl3741/__init__.c @@ -47,4 +47,4 @@ const mp_obj_module_t is31fl3741_module = { .globals = (mp_obj_dict_t *)&is31fl3741_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_is31fl3741, is31fl3741_module, CIRCUITPY_IS31FL3741); +MP_REGISTER_MODULE(MP_QSTR_is31fl3741, is31fl3741_module); diff --git a/shared-bindings/keypad/Event.c b/shared-bindings/keypad/Event.c index 52c574e692..1a3db1c61f 100644 --- a/shared-bindings/keypad/Event.c +++ b/shared-bindings/keypad/Event.c @@ -45,8 +45,7 @@ //| """ //| ... STATIC mp_obj_t keypad_event_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - keypad_event_obj_t *self = m_new_obj(keypad_event_obj_t); - self->base.type = &keypad_event_type; + keypad_event_obj_t *self = mp_obj_malloc(keypad_event_obj_t, &keypad_event_type); enum { ARG_key_number, ARG_pressed, ARG_timestamp }; static const mp_arg_t allowed_args[] = { { MP_QSTR_key_number, MP_ARG_INT, {.u_int = 0} }, diff --git a/shared-bindings/keypad/KeyMatrix.c b/shared-bindings/keypad/KeyMatrix.c index 2209f3f68f..32787f8e9d 100644 --- a/shared-bindings/keypad/KeyMatrix.c +++ b/shared-bindings/keypad/KeyMatrix.c @@ -72,8 +72,7 @@ STATIC mp_obj_t keypad_keymatrix_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { #if CIRCUITPY_KEYPAD_KEYMATRIX - keypad_keymatrix_obj_t *self = m_new_obj(keypad_keymatrix_obj_t); - self->base.type = &keypad_keymatrix_type; + keypad_keymatrix_obj_t *self = mp_obj_malloc(keypad_keymatrix_obj_t, &keypad_keymatrix_type); enum { ARG_row_pins, ARG_column_pins, ARG_columns_to_anodes, ARG_interval, ARG_max_events }; static const mp_arg_t allowed_args[] = { { MP_QSTR_row_pins, MP_ARG_REQUIRED | MP_ARG_OBJ }, diff --git a/shared-bindings/keypad/Keys.c b/shared-bindings/keypad/Keys.c index 2481fedc6b..63a27425f5 100644 --- a/shared-bindings/keypad/Keys.c +++ b/shared-bindings/keypad/Keys.c @@ -74,8 +74,7 @@ STATIC mp_obj_t keypad_keys_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { #if CIRCUITPY_KEYPAD_KEYS - keypad_keys_obj_t *self = m_new_obj(keypad_keys_obj_t); - self->base.type = &keypad_keys_type; + keypad_keys_obj_t *self = mp_obj_malloc(keypad_keys_obj_t, &keypad_keys_type); enum { ARG_pins, ARG_value_when_pressed, ARG_pull, ARG_interval, ARG_max_events }; static const mp_arg_t allowed_args[] = { { MP_QSTR_pins, MP_ARG_REQUIRED | MP_ARG_OBJ }, diff --git a/shared-bindings/keypad/ShiftRegisterKeys.c b/shared-bindings/keypad/ShiftRegisterKeys.c index 1fcf517ac3..fc8ec64914 100644 --- a/shared-bindings/keypad/ShiftRegisterKeys.c +++ b/shared-bindings/keypad/ShiftRegisterKeys.c @@ -83,8 +83,8 @@ STATIC mp_obj_t keypad_shiftregisterkeys_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { #if CIRCUITPY_KEYPAD_SHIFTREGISTERKEYS - keypad_shiftregisterkeys_obj_t *self = m_new_obj(keypad_shiftregisterkeys_obj_t); - self->base.type = &keypad_shiftregisterkeys_type; + keypad_shiftregisterkeys_obj_t *self = + mp_obj_malloc(keypad_shiftregisterkeys_obj_t, &keypad_shiftregisterkeys_type); enum { ARG_clock, ARG_data, ARG_latch, ARG_value_to_latch, ARG_key_count, ARG_value_when_pressed, ARG_interval, ARG_max_events }; static const mp_arg_t allowed_args[] = { { MP_QSTR_clock, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ }, diff --git a/shared-bindings/keypad/__init__.c b/shared-bindings/keypad/__init__.c index 7dd76c1947..263e324b9b 100644 --- a/shared-bindings/keypad/__init__.c +++ b/shared-bindings/keypad/__init__.c @@ -107,4 +107,4 @@ const mp_obj_module_t keypad_module = { .globals = (mp_obj_dict_t *)&keypad_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_keypad, keypad_module, CIRCUITPY_KEYPAD); +MP_REGISTER_MODULE(MP_QSTR_keypad, keypad_module); diff --git a/shared-bindings/math/__init__.c b/shared-bindings/math/__init__.c index 8aee44ffb8..2c17532197 100644 --- a/shared-bindings/math/__init__.c +++ b/shared-bindings/math/__init__.c @@ -473,6 +473,6 @@ const mp_obj_module_t math_module = { .globals = (mp_obj_dict_t *)&mp_module_math_globals, }; -MP_REGISTER_MODULE(MP_QSTR_math, math_module, CIRCUITPY_MATH); +MP_REGISTER_MODULE(MP_QSTR_math, math_module); #endif // MICROPY_PY_BUILTINS_FLOAT diff --git a/shared-bindings/mdns/__init__.c b/shared-bindings/mdns/__init__.c index 73bd71c65c..2a8cd85e39 100644 --- a/shared-bindings/mdns/__init__.c +++ b/shared-bindings/mdns/__init__.c @@ -52,4 +52,4 @@ const mp_obj_module_t mdns_module = { .globals = (mp_obj_dict_t *)&mdns_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_mdns, mdns_module, CIRCUITPY_MDNS); +MP_REGISTER_MODULE(MP_QSTR_mdns, mdns_module); diff --git a/shared-bindings/memorymap/AddressRange.c b/shared-bindings/memorymap/AddressRange.c index fb55c07efe..7fd1062534 100644 --- a/shared-bindings/memorymap/AddressRange.c +++ b/shared-bindings/memorymap/AddressRange.c @@ -69,8 +69,7 @@ STATIC mp_obj_t memorymap_addressrange_make_new(const mp_obj_type_t *type, size_ mp_arg_validate_int_min(args[ARG_length].u_int, 1, MP_QSTR_length); - memorymap_addressrange_obj_t *self = m_new_obj(memorymap_addressrange_obj_t); - self->base.type = &memorymap_addressrange_type; + memorymap_addressrange_obj_t *self = mp_obj_malloc(memorymap_addressrange_obj_t, &memorymap_addressrange_type); common_hal_memorymap_addressrange_construct(self, (uint8_t *)start, length); diff --git a/shared-bindings/memorymap/__init__.c b/shared-bindings/memorymap/__init__.c index 576c7f1e1d..a276e371ba 100644 --- a/shared-bindings/memorymap/__init__.c +++ b/shared-bindings/memorymap/__init__.c @@ -49,4 +49,4 @@ const mp_obj_module_t memorymap_module = { .globals = (mp_obj_dict_t *)&memorymap_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_memorymap, memorymap_module, CIRCUITPY_MEMORYMAP); +MP_REGISTER_MODULE(MP_QSTR_memorymap, memorymap_module); diff --git a/shared-bindings/memorymonitor/AllocationAlarm.c b/shared-bindings/memorymonitor/AllocationAlarm.c index e279fa6854..a21a14b2f0 100644 --- a/shared-bindings/memorymonitor/AllocationAlarm.c +++ b/shared-bindings/memorymonitor/AllocationAlarm.c @@ -66,8 +66,8 @@ STATIC mp_obj_t memorymonitor_allocationalarm_make_new(const mp_obj_type_t *type mp_arg_validate_int_min(args[ARG_minimum_block_count].u_int, 1, MP_QSTR_minimum_block_count); - memorymonitor_allocationalarm_obj_t *self = m_new_obj(memorymonitor_allocationalarm_obj_t); - self->base.type = &memorymonitor_allocationalarm_type; + memorymonitor_allocationalarm_obj_t *self = + mp_obj_malloc(memorymonitor_allocationalarm_obj_t, &memorymonitor_allocationalarm_type); common_hal_memorymonitor_allocationalarm_construct(self, minimum_block_count); diff --git a/shared-bindings/memorymonitor/AllocationSize.c b/shared-bindings/memorymonitor/AllocationSize.c index dd3a1e03cf..3340f51615 100644 --- a/shared-bindings/memorymonitor/AllocationSize.c +++ b/shared-bindings/memorymonitor/AllocationSize.c @@ -62,8 +62,8 @@ //| """ //| ... STATIC mp_obj_t memorymonitor_allocationsize_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *all_args, mp_map_t *kw_args) { - memorymonitor_allocationsize_obj_t *self = m_new_obj(memorymonitor_allocationsize_obj_t); - self->base.type = &memorymonitor_allocationsize_type; + memorymonitor_allocationsize_obj_t *self = + m_new_obj(memorymonitor_allocationsize_obj_t, &memorymonitor_allocationsize_type); common_hal_memorymonitor_allocationsize_construct(self); diff --git a/shared-bindings/memorymonitor/__init__.c b/shared-bindings/memorymonitor/__init__.c index 7b05acd095..9ee0d46bf0 100644 --- a/shared-bindings/memorymonitor/__init__.c +++ b/shared-bindings/memorymonitor/__init__.c @@ -77,4 +77,4 @@ const mp_obj_module_t memorymonitor_module = { .globals = (mp_obj_dict_t *)&memorymonitor_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_memorymonitor, memorymonitor_module, CIRCUITPY_MEMORYMONITOR); +MP_REGISTER_MODULE(MP_QSTR_memorymonitor, memorymonitor_module); diff --git a/shared-bindings/microcontroller/__init__.c b/shared-bindings/microcontroller/__init__.c index 2c1fdd5b58..3858cad776 100644 --- a/shared-bindings/microcontroller/__init__.c +++ b/shared-bindings/microcontroller/__init__.c @@ -192,4 +192,4 @@ const mp_obj_module_t microcontroller_module = { .globals = (mp_obj_dict_t *)&mcu_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_microcontroller, microcontroller_module, CIRCUITPY_MICROCONTROLLER); +MP_REGISTER_MODULE(MP_QSTR_microcontroller, microcontroller_module); diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index 7bfe3bd8bd..15e30c1575 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -37,8 +37,7 @@ //| :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, size_t n_kw, const mp_obj_t *all_args) { - mod_msgpack_extype_obj_t *self = m_new_obj(mod_msgpack_extype_obj_t); - self->base.type = &mod_msgpack_exttype_type; + mod_msgpack_extype_obj_t *self = mp_obj_malloc(mod_msgpack_extype_obj_t, &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 }, diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 7773d6d190..fb4fe63304 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -174,4 +174,4 @@ const mp_obj_module_t msgpack_module = { .globals = (mp_obj_dict_t *)&msgpack_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_msgpack, msgpack_module, CIRCUITPY_MSGPACK); +MP_REGISTER_MODULE(MP_QSTR_msgpack, msgpack_module); diff --git a/shared-bindings/neopixel_write/__init__.c b/shared-bindings/neopixel_write/__init__.c index cc0e2a041a..8a471f26ff 100644 --- a/shared-bindings/neopixel_write/__init__.c +++ b/shared-bindings/neopixel_write/__init__.c @@ -140,4 +140,4 @@ const mp_obj_module_t neopixel_write_module = { .globals = (mp_obj_dict_t *)&neopixel_write_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_neopixel_write, neopixel_write_module, CIRCUITPY_NEOPIXEL_WRITE); +MP_REGISTER_MODULE(MP_QSTR_neopixel_write, neopixel_write_module); diff --git a/shared-bindings/nvm/__init__.c b/shared-bindings/nvm/__init__.c index 0ecadd9880..ff553741a9 100644 --- a/shared-bindings/nvm/__init__.c +++ b/shared-bindings/nvm/__init__.c @@ -51,4 +51,4 @@ const mp_obj_module_t nvm_module = { .globals = (mp_obj_dict_t *)&nvm_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_nvm, nvm_module, CIRCUITPY_NVM); +MP_REGISTER_MODULE(MP_QSTR_nvm, nvm_module); diff --git a/shared-bindings/onewireio/OneWire.c b/shared-bindings/onewireio/OneWire.c index 3f0dc87722..f52ebb4c6a 100644 --- a/shared-bindings/onewireio/OneWire.c +++ b/shared-bindings/onewireio/OneWire.c @@ -62,8 +62,7 @@ STATIC mp_obj_t onewireio_onewire_make_new(const mp_obj_type_t *type, size_t n_a mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj, MP_QSTR_pin); - onewireio_onewire_obj_t *self = m_new_obj(onewireio_onewire_obj_t); - self->base.type = &onewireio_onewire_type; + onewireio_onewire_obj_t *self = mp_obj_malloc(onewireio_onewire_obj_t, &onewireio_onewire_type); common_hal_onewireio_onewire_construct(self, pin); return MP_OBJ_FROM_PTR(self); diff --git a/shared-bindings/onewireio/__init__.c b/shared-bindings/onewireio/__init__.c index 282192179b..869300deba 100644 --- a/shared-bindings/onewireio/__init__.c +++ b/shared-bindings/onewireio/__init__.c @@ -51,4 +51,4 @@ const mp_obj_module_t onewireio_module = { .globals = (mp_obj_dict_t *)&onewireio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_onewireio, onewireio_module, CIRCUITPY_ONEWIREIO); +MP_REGISTER_MODULE(MP_QSTR_onewireio, onewireio_module); diff --git a/shared-bindings/os/__init__.c b/shared-bindings/os/__init__.c index e9e5f0885f..881c95d696 100644 --- a/shared-bindings/os/__init__.c +++ b/shared-bindings/os/__init__.c @@ -300,4 +300,4 @@ const mp_obj_module_t os_module = { .globals = (mp_obj_dict_t *)&os_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_os, os_module, CIRCUITPY_OS); +MP_REGISTER_MODULE(MP_QSTR_os, os_module); diff --git a/shared-bindings/paralleldisplay/__init__.c b/shared-bindings/paralleldisplay/__init__.c index e87479a9f9..de4492f550 100644 --- a/shared-bindings/paralleldisplay/__init__.c +++ b/shared-bindings/paralleldisplay/__init__.c @@ -48,4 +48,4 @@ const mp_obj_module_t paralleldisplay_module = { .globals = (mp_obj_dict_t *)¶lleldisplay_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_paralleldisplay, paralleldisplay_module, CIRCUITPY_PARALLELDISPLAY); +MP_REGISTER_MODULE(MP_QSTR_paralleldisplay, paralleldisplay_module); diff --git a/shared-bindings/ps2io/Ps2.c b/shared-bindings/ps2io/Ps2.c index 67cffc9f7b..789e1173c8 100644 --- a/shared-bindings/ps2io/Ps2.c +++ b/shared-bindings/ps2io/Ps2.c @@ -78,8 +78,7 @@ STATIC mp_obj_t ps2io_ps2_make_new(const mp_obj_type_t *type, size_t n_args, siz const mcu_pin_obj_t *clock_pin = validate_obj_is_free_pin(args[ARG_clock_pin].u_obj, MP_QSTR_clock_pin); const mcu_pin_obj_t *data_pin = validate_obj_is_free_pin(args[ARG_data_pin].u_obj, MP_QSTR_data_pin); - ps2io_ps2_obj_t *self = m_new_obj(ps2io_ps2_obj_t); - self->base.type = &ps2io_ps2_type; + ps2io_ps2_obj_t *self = mp_obj_malloc(ps2io_ps2_obj_t, &ps2io_ps2_type); common_hal_ps2io_ps2_construct(self, data_pin, clock_pin); diff --git a/shared-bindings/ps2io/__init__.c b/shared-bindings/ps2io/__init__.c index 6857744036..e6aed10955 100644 --- a/shared-bindings/ps2io/__init__.c +++ b/shared-bindings/ps2io/__init__.c @@ -57,4 +57,4 @@ const mp_obj_module_t ps2io_module = { .globals = (mp_obj_dict_t *)&ps2io_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_ps2io, ps2io_module, CIRCUITPY_PS2IO); +MP_REGISTER_MODULE(MP_QSTR_ps2io, ps2io_module); diff --git a/shared-bindings/pulseio/PulseOut.c b/shared-bindings/pulseio/PulseOut.c index 2af07a46d8..16777d9843 100644 --- a/shared-bindings/pulseio/PulseOut.c +++ b/shared-bindings/pulseio/PulseOut.c @@ -81,8 +81,7 @@ STATIC mp_obj_t pulseio_pulseout_make_new(const mp_obj_type_t *type, size_t n_ar mp_int_t frequency = args[ARG_frequency].u_int; mp_int_t duty_cycle = args[ARG_duty_cycle].u_int; - pulseio_pulseout_obj_t *self = m_new_obj(pulseio_pulseout_obj_t); - self->base.type = &pulseio_pulseout_type; + pulseio_pulseout_obj_t *self = mp_obj_malloc(pulseio_pulseout_obj_t, &pulseio_pulseout_type); common_hal_pulseio_pulseout_construct(self, pin, frequency, duty_cycle); return MP_OBJ_FROM_PTR(self); } diff --git a/shared-bindings/pulseio/__init__.c b/shared-bindings/pulseio/__init__.c index c062cedd11..b8a190ef5d 100644 --- a/shared-bindings/pulseio/__init__.c +++ b/shared-bindings/pulseio/__init__.c @@ -58,4 +58,4 @@ const mp_obj_module_t pulseio_module = { .globals = (mp_obj_dict_t *)&pulseio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_pulseio, pulseio_module, CIRCUITPY_PULSEIO); +MP_REGISTER_MODULE(MP_QSTR_pulseio, pulseio_module); diff --git a/shared-bindings/pwmio/PWMOut.c b/shared-bindings/pwmio/PWMOut.c index 784f87a025..0c99e26a7d 100644 --- a/shared-bindings/pwmio/PWMOut.c +++ b/shared-bindings/pwmio/PWMOut.c @@ -176,8 +176,7 @@ STATIC mp_obj_t pwmio_pwmout_make_new(const mp_obj_type_t *type, size_t n_args, bool variable_frequency = parsed_args[ARG_variable_frequency].u_bool; // create PWM object from the given pin - pwmio_pwmout_obj_t *self = m_new_obj(pwmio_pwmout_obj_t); - self->base.type = &pwmio_pwmout_type; + pwmio_pwmout_obj_t *self = mp_obj_malloc(pwmio_pwmout_obj_t, &pwmio_pwmout_type); pwmout_result_t result = common_hal_pwmio_pwmout_construct(self, pin, duty_cycle, frequency, variable_frequency); common_hal_pwmio_pwmout_raise_error(result); diff --git a/shared-bindings/pwmio/__init__.c b/shared-bindings/pwmio/__init__.c index 6aeaf9c3c8..38388fec84 100644 --- a/shared-bindings/pwmio/__init__.c +++ b/shared-bindings/pwmio/__init__.c @@ -74,4 +74,4 @@ const mp_obj_module_t pwmio_module = { .globals = (mp_obj_dict_t *)&pwmio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_pwmio, pwmio_module, CIRCUITPY_PWMIO); +MP_REGISTER_MODULE(MP_QSTR_pwmio, pwmio_module); diff --git a/shared-bindings/qrio/QRDecoder.c b/shared-bindings/qrio/QRDecoder.c index b37a14fd8f..e8cabade33 100644 --- a/shared-bindings/qrio/QRDecoder.c +++ b/shared-bindings/qrio/QRDecoder.c @@ -50,8 +50,7 @@ STATIC mp_obj_t qrio_qrdecoder_make_new(const mp_obj_type_t *type, size_t n_args mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, args_in, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - qrio_qrdecoder_obj_t *self = m_new_obj(qrio_qrdecoder_obj_t); - self->base.type = &qrio_qrdecoder_type_obj; + qrio_qrdecoder_obj_t *self = mp_obj_malloc(qrio_qrdecoder_obj_t, &qrio_qrdecoder_type_obj); shared_module_qrio_qrdecoder_construct(self, args[ARG_width].u_int, args[ARG_height].u_int); return self; diff --git a/shared-bindings/qrio/__init__.c b/shared-bindings/qrio/__init__.c index 18c74b9a88..3daee820ed 100644 --- a/shared-bindings/qrio/__init__.c +++ b/shared-bindings/qrio/__init__.c @@ -55,4 +55,4 @@ const mp_obj_module_t qrio_module = { .globals = (mp_obj_dict_t *)&qrio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_qrio, qrio_module, CIRCUITPY_QRIO); +MP_REGISTER_MODULE(MP_QSTR_qrio, qrio_module); diff --git a/shared-bindings/rainbowio/__init__.c b/shared-bindings/rainbowio/__init__.c index 324f43198e..b4a5536588 100644 --- a/shared-bindings/rainbowio/__init__.c +++ b/shared-bindings/rainbowio/__init__.c @@ -55,4 +55,4 @@ const mp_obj_module_t rainbowio_module = { .globals = (mp_obj_dict_t *)&rainbowio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_rainbowio, rainbowio_module, CIRCUITPY_RAINBOWIO); +MP_REGISTER_MODULE(MP_QSTR_rainbowio, rainbowio_module); diff --git a/shared-bindings/random/__init__.c b/shared-bindings/random/__init__.c index 33cd9e90d0..6fa9629f8c 100644 --- a/shared-bindings/random/__init__.c +++ b/shared-bindings/random/__init__.c @@ -189,4 +189,4 @@ const mp_obj_module_t random_module = { .globals = (mp_obj_dict_t *)&mp_module_random_globals, }; -MP_REGISTER_MODULE(MP_QSTR_random, random_module, CIRCUITPY_RANDOM); +MP_REGISTER_MODULE(MP_QSTR_random, random_module); diff --git a/shared-bindings/rgbmatrix/__init__.c b/shared-bindings/rgbmatrix/__init__.c index 1e9099adb6..d89abf17e3 100644 --- a/shared-bindings/rgbmatrix/__init__.c +++ b/shared-bindings/rgbmatrix/__init__.c @@ -45,4 +45,4 @@ const mp_obj_module_t rgbmatrix_module = { .globals = (mp_obj_dict_t *)&rgbmatrix_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_rgbmatrix, rgbmatrix_module, CIRCUITPY_RGBMATRIX); +MP_REGISTER_MODULE(MP_QSTR_rgbmatrix, rgbmatrix_module); diff --git a/shared-bindings/rotaryio/__init__.c b/shared-bindings/rotaryio/__init__.c index e549ecc75e..d8348eb958 100644 --- a/shared-bindings/rotaryio/__init__.c +++ b/shared-bindings/rotaryio/__init__.c @@ -59,4 +59,4 @@ const mp_obj_module_t rotaryio_module = { .globals = (mp_obj_dict_t *)&rotaryio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_rotaryio, rotaryio_module, CIRCUITPY_ROTARYIO); +MP_REGISTER_MODULE(MP_QSTR_rotaryio, rotaryio_module); diff --git a/shared-bindings/rtc/__init__.c b/shared-bindings/rtc/__init__.c index 0220745c0f..e1220841eb 100644 --- a/shared-bindings/rtc/__init__.c +++ b/shared-bindings/rtc/__init__.c @@ -87,4 +87,4 @@ const mp_obj_module_t rtc_module = { .globals = (mp_obj_dict_t *)&rtc_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_rtc, rtc_module, CIRCUITPY_RTC); +MP_REGISTER_MODULE(MP_QSTR_rtc, rtc_module); diff --git a/shared-bindings/sdcardio/SDCard.c b/shared-bindings/sdcardio/SDCard.c index ce67834774..4bceefba45 100644 --- a/shared-bindings/sdcardio/SDCard.c +++ b/shared-bindings/sdcardio/SDCard.c @@ -92,8 +92,7 @@ STATIC mp_obj_t sdcardio_sdcard_make_new(const mp_obj_type_t *type, size_t n_arg busio_spi_obj_t *spi = validate_obj_is_spi_bus(args[ARG_spi].u_obj, MP_QSTR_spi); const mcu_pin_obj_t *cs = validate_obj_is_free_pin(args[ARG_cs].u_obj, MP_QSTR_cs); - sdcardio_sdcard_obj_t *self = m_new_obj(sdcardio_sdcard_obj_t); - self->base.type = &sdcardio_SDCard_type; + sdcardio_sdcard_obj_t *self = mp_obj_malloc(sdcardio_sdcard_obj_t, &sdcardio_SDCard_type); common_hal_sdcardio_sdcard_construct(self, spi, cs, args[ARG_baudrate].u_int); diff --git a/shared-bindings/sdcardio/__init__.c b/shared-bindings/sdcardio/__init__.c index c64a8a38e4..da97af685c 100644 --- a/shared-bindings/sdcardio/__init__.c +++ b/shared-bindings/sdcardio/__init__.c @@ -46,4 +46,4 @@ const mp_obj_module_t sdcardio_module = { .globals = (mp_obj_dict_t *)&sdcardio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_sdcardio, sdcardio_module, CIRCUITPY_SDCARDIO); +MP_REGISTER_MODULE(MP_QSTR_sdcardio, sdcardio_module); diff --git a/shared-bindings/sdioio/SDCard.c b/shared-bindings/sdioio/SDCard.c index 776b20fafe..7ff4fb750a 100644 --- a/shared-bindings/sdioio/SDCard.c +++ b/shared-bindings/sdioio/SDCard.c @@ -84,8 +84,7 @@ //| ... STATIC mp_obj_t sdioio_sdcard_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - sdioio_sdcard_obj_t *self = m_new_obj(sdioio_sdcard_obj_t); - self->base.type = &sdioio_SDCard_type; + sdioio_sdcard_obj_t *self = mp_obj_malloc(sdioio_sdcard_obj_t, &sdioio_SDCard_type); enum { ARG_clock, ARG_command, ARG_data, ARG_frequency, NUM_ARGS }; static const mp_arg_t allowed_args[] = { { MP_QSTR_clock, MP_ARG_REQUIRED | MP_ARG_KW_ONLY | MP_ARG_OBJ }, diff --git a/shared-bindings/sdioio/__init__.c b/shared-bindings/sdioio/__init__.c index 5204da22a4..0d15a3e5d3 100644 --- a/shared-bindings/sdioio/__init__.c +++ b/shared-bindings/sdioio/__init__.c @@ -46,4 +46,4 @@ const mp_obj_module_t sdioio_module = { .globals = (mp_obj_dict_t *)&sdioio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_sdioio, sdioio_module, CIRCUITPY_SDIOIO); +MP_REGISTER_MODULE(MP_QSTR_sdioio, sdioio_module); diff --git a/shared-bindings/sharpdisplay/__init__.c b/shared-bindings/sharpdisplay/__init__.c index 4726e6ea1c..90e99eea1d 100644 --- a/shared-bindings/sharpdisplay/__init__.c +++ b/shared-bindings/sharpdisplay/__init__.c @@ -48,4 +48,4 @@ const mp_obj_module_t sharpdisplay_module = { .globals = (mp_obj_dict_t *)&sharpdisplay_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_sharpdisplay, sharpdisplay_module, CIRCUITPY_SHARPDISPLAY); +MP_REGISTER_MODULE(MP_QSTR_sharpdisplay, sharpdisplay_module); diff --git a/shared-bindings/socketpool/__init__.c b/shared-bindings/socketpool/__init__.c index 48cc00245f..53993a978c 100644 --- a/shared-bindings/socketpool/__init__.c +++ b/shared-bindings/socketpool/__init__.c @@ -54,4 +54,4 @@ const mp_obj_module_t socketpool_module = { .globals = (mp_obj_dict_t *)&socketpool_globals, }; -MP_REGISTER_MODULE(MP_QSTR_socketpool, socketpool_module, CIRCUITPY_SOCKETPOOL); +MP_REGISTER_MODULE(MP_QSTR_socketpool, socketpool_module); diff --git a/shared-bindings/ssl/SSLContext.c b/shared-bindings/ssl/SSLContext.c index ac5f7ad42d..cdb36685b3 100644 --- a/shared-bindings/ssl/SSLContext.c +++ b/shared-bindings/ssl/SSLContext.c @@ -45,8 +45,7 @@ STATIC mp_obj_t ssl_sslcontext_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { mp_arg_check_num(n_args, n_kw, 0, 1, false); - ssl_sslcontext_obj_t *s = m_new_obj(ssl_sslcontext_obj_t); - s->base.type = &ssl_sslcontext_type; + ssl_sslcontext_obj_t *s = mp_obj_malloc(ssl_sslcontext_obj_t, &ssl_sslcontext_type); common_hal_ssl_sslcontext_construct(s); diff --git a/shared-bindings/ssl/__init__.c b/shared-bindings/ssl/__init__.c index 6967860054..2e298163be 100644 --- a/shared-bindings/ssl/__init__.c +++ b/shared-bindings/ssl/__init__.c @@ -44,8 +44,7 @@ //| STATIC mp_obj_t ssl_create_default_context(void) { - ssl_sslcontext_obj_t *s = m_new_obj(ssl_sslcontext_obj_t); - s->base.type = &ssl_sslcontext_type; + ssl_sslcontext_obj_t *s = mp_obj_malloc(ssl_sslcontext_obj_t, &ssl_sslcontext_type); common_hal_ssl_create_default_context(s); return s; @@ -67,4 +66,4 @@ const mp_obj_module_t ssl_module = { .globals = (mp_obj_dict_t *)&ssl_globals, }; -MP_REGISTER_MODULE(MP_QSTR_ssl, ssl_module, CIRCUITPY_SSL); +MP_REGISTER_MODULE(MP_QSTR_ssl, ssl_module); diff --git a/shared-bindings/storage/__init__.c b/shared-bindings/storage/__init__.c index c4bd728f67..b774c5550e 100644 --- a/shared-bindings/storage/__init__.c +++ b/shared-bindings/storage/__init__.c @@ -314,4 +314,4 @@ const mp_obj_module_t storage_module = { .globals = (mp_obj_dict_t *)&storage_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_storage, storage_module, CIRCUITPY_STORAGE); +MP_REGISTER_MODULE(MP_QSTR_storage, storage_module); diff --git a/shared-bindings/struct/__init__.c b/shared-bindings/struct/__init__.c index 5b63a15f15..519b1ace66 100644 --- a/shared-bindings/struct/__init__.c +++ b/shared-bindings/struct/__init__.c @@ -178,4 +178,4 @@ const mp_obj_module_t struct_module = { .globals = (mp_obj_dict_t *)&mp_module_struct_globals, }; -MP_REGISTER_MODULE(MP_QSTR_struct, struct_module, CIRCUITPY_STRUCT); +MP_REGISTER_MODULE(MP_QSTR_struct, struct_module); diff --git a/shared-bindings/supervisor/__init__.c b/shared-bindings/supervisor/__init__.c index 491cac2f17..a1820e215e 100644 --- a/shared-bindings/supervisor/__init__.c +++ b/shared-bindings/supervisor/__init__.c @@ -233,8 +233,7 @@ STATIC mp_obj_t supervisor_get_previous_traceback(void) { if (prev_traceback_allocation) { size_t len = strlen((const char *)prev_traceback_allocation->ptr); if (len > 0) { - mp_obj_str_t *o = m_new_obj(mp_obj_str_t); - o->base.type = &mp_type_str; + mp_obj_str_t *o = mp_obj_malloc(mp_obj_str_t, &mp_type_str); o->len = len; // callers probably aren't going to compare this string, so skip computing the hash o->hash = 0; @@ -356,4 +355,4 @@ const mp_obj_module_t supervisor_module = { .globals = (mp_obj_dict_t *)&supervisor_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_supervisor, supervisor_module, CIRCUITPY_SUPERVISOR); +MP_REGISTER_MODULE(MP_QSTR_supervisor, supervisor_module); diff --git a/shared-bindings/synthio/LFO.c b/shared-bindings/synthio/LFO.c index 00be16a15c..86e32999cf 100644 --- a/shared-bindings/synthio/LFO.c +++ b/shared-bindings/synthio/LFO.c @@ -88,8 +88,7 @@ STATIC mp_obj_t synthio_lfo_make_new(const mp_obj_type_t *type_in, size_t n_args mp_arg_val_t args[MP_ARRAY_SIZE(lfo_properties)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(lfo_properties), lfo_properties, args); - synthio_lfo_obj_t *self = m_new_obj(synthio_lfo_obj_t); - self->base.base.type = &synthio_lfo_type; + synthio_lfo_obj_t *self = mp_obj_malloc(synthio_lfo_obj_t, &synthio_lfo_type); self->waveform_bufinfo = ((mp_buffer_info_t) {.buf = (void *)triangle, .len = MP_ARRAY_SIZE(triangle)}); if (args[ARG_waveform].u_obj != mp_const_none) { diff --git a/shared-bindings/synthio/Math.c b/shared-bindings/synthio/Math.c index 57902b0dd0..ea75b7c4bf 100644 --- a/shared-bindings/synthio/Math.c +++ b/shared-bindings/synthio/Math.c @@ -172,8 +172,7 @@ STATIC mp_obj_t synthio_math_make_new(const mp_obj_type_t *type_in, size_t n_arg } STATIC mp_obj_t synthio_math_make_new_common(mp_arg_val_t args[MP_ARRAY_SIZE(math_properties)]) { - synthio_math_obj_t *self = m_new_obj(synthio_math_obj_t); - self->base.base.type = &synthio_math_type; + synthio_math_obj_t *self = mp_obj_malloc(synthio_math_obj_t, &synthio_math_type); self->base.last_tick = synthio_global_tick; diff --git a/shared-bindings/synthio/MidiTrack.c b/shared-bindings/synthio/MidiTrack.c index 2d0d2ab69f..79af9e9744 100644 --- a/shared-bindings/synthio/MidiTrack.c +++ b/shared-bindings/synthio/MidiTrack.c @@ -88,8 +88,7 @@ STATIC mp_obj_t synthio_miditrack_make_new(const mp_obj_type_t *type, size_t n_a mp_buffer_info_t bufinfo; mp_get_buffer_raise(args[ARG_buffer].u_obj, &bufinfo, MP_BUFFER_READ); - synthio_miditrack_obj_t *self = m_new_obj(synthio_miditrack_obj_t); - self->base.type = &synthio_miditrack_type; + synthio_miditrack_obj_t *self = mp_obj_malloc(synthio_miditrack_obj_t, &synthio_miditrack_type); common_hal_synthio_miditrack_construct(self, (uint8_t *)bufinfo.buf, bufinfo.len, diff --git a/shared-bindings/synthio/Note.c b/shared-bindings/synthio/Note.c index 651bf8f33a..e6ce886054 100644 --- a/shared-bindings/synthio/Note.c +++ b/shared-bindings/synthio/Note.c @@ -70,8 +70,7 @@ STATIC mp_obj_t synthio_note_make_new(const mp_obj_type_t *type_in, size_t n_arg mp_arg_val_t args[MP_ARRAY_SIZE(note_properties)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(note_properties), note_properties, args); - synthio_note_obj_t *self = m_new_obj(synthio_note_obj_t); - self->base.type = &synthio_note_type; + synthio_note_obj_t *self = mp_obj_malloc(synthio_note_obj_t, &synthio_note_type); mp_obj_t result = MP_OBJ_FROM_PTR(self); properties_construct_helper(result, note_properties, args, MP_ARRAY_SIZE(note_properties)); diff --git a/shared-bindings/synthio/Synthesizer.c b/shared-bindings/synthio/Synthesizer.c index 84882fa657..acdc1a989a 100644 --- a/shared-bindings/synthio/Synthesizer.c +++ b/shared-bindings/synthio/Synthesizer.c @@ -80,8 +80,7 @@ STATIC mp_obj_t synthio_synthesizer_make_new(const mp_obj_type_t *type, size_t n mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - synthio_synthesizer_obj_t *self = m_new_obj(synthio_synthesizer_obj_t); - self->base.type = &synthio_synthesizer_type; + synthio_synthesizer_obj_t *self = mp_obj_malloc(synthio_synthesizer_obj_t, &synthio_synthesizer_type); common_hal_synthio_synthesizer_construct(self, args[ARG_sample_rate].u_int, diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index b6185051fc..f9d9de86c7 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -252,8 +252,7 @@ STATIC mp_obj_t synthio_from_file(size_t n_args, const mp_obj_t *pos_args, mp_ma mp_arg_error_invalid(MP_QSTR_file); } - synthio_miditrack_obj_t *result = m_new_obj(synthio_miditrack_obj_t); - result->base.type = &synthio_miditrack_type; + synthio_miditrack_obj_t *result = mp_obj_malloc(synthio_miditrack_obj_t, &synthio_miditrack_type); common_hal_synthio_miditrack_construct(result, buffer, track_size, tempo, args[ARG_sample_rate].u_int, args[ARG_waveform].u_obj, @@ -332,4 +331,4 @@ const mp_obj_module_t synthio_module = { .globals = (mp_obj_dict_t *)&synthio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_synthio, synthio_module, CIRCUITPY_SYNTHIO); +MP_REGISTER_MODULE(MP_QSTR_synthio, synthio_module); diff --git a/shared-bindings/terminalio/Terminal.c b/shared-bindings/terminalio/Terminal.c index 164999093a..05c10f2887 100644 --- a/shared-bindings/terminalio/Terminal.c +++ b/shared-bindings/terminalio/Terminal.c @@ -88,8 +88,7 @@ STATIC mp_obj_t terminalio_terminal_make_new(const mp_obj_type_t *type, size_t n mp_arg_validate_int_min(scroll_area->width_in_tiles, 2, MP_QSTR_scroll_area_width); mp_arg_validate_int_min(scroll_area->height_in_tiles, 2, MP_QSTR_scroll_area_height); - terminalio_terminal_obj_t *self = m_new_obj(terminalio_terminal_obj_t); - self->base.type = &terminalio_terminal_type; + terminalio_terminal_obj_t *self = mp_obj_malloc(terminalio_terminal_obj_t, &terminalio_terminal_type); common_hal_terminalio_terminal_construct(self, scroll_area, font, status_bar); return MP_OBJ_FROM_PTR(self); diff --git a/shared-bindings/terminalio/__init__.c b/shared-bindings/terminalio/__init__.c index a5980a8b9b..3492390e5a 100644 --- a/shared-bindings/terminalio/__init__.c +++ b/shared-bindings/terminalio/__init__.c @@ -61,4 +61,4 @@ const mp_obj_module_t terminalio_module = { .globals = (mp_obj_dict_t *)&terminalio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_terminalio, terminalio_module, CIRCUITPY_DISPLAYIO && CIRCUITPY_TERMINALIO); +MP_REGISTER_MODULE(MP_QSTR_terminalio, terminalio_module); diff --git a/shared-bindings/time/__init__.c b/shared-bindings/time/__init__.c index d02923f162..a4e5033def 100644 --- a/shared-bindings/time/__init__.c +++ b/shared-bindings/time/__init__.c @@ -343,4 +343,4 @@ const mp_obj_module_t time_module = { .globals = (mp_obj_dict_t *)&time_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_time, time_module, CIRCUITPY_TIME); +MP_REGISTER_MODULE(MP_QSTR_time, time_module); diff --git a/shared-bindings/touchio/TouchIn.c b/shared-bindings/touchio/TouchIn.c index 7f26149b00..64de6e18b0 100644 --- a/shared-bindings/touchio/TouchIn.c +++ b/shared-bindings/touchio/TouchIn.c @@ -65,8 +65,7 @@ STATIC mp_obj_t touchio_touchin_make_new(const mp_obj_type_t *type, // 1st argument is the pin const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[0], MP_QSTR_pin); - touchio_touchin_obj_t *self = m_new_obj(touchio_touchin_obj_t); - self->base.type = &touchio_touchin_type; + touchio_touchin_obj_t *self = mp_obj_malloc(touchio_touchin_obj_t, &touchio_touchin_type); common_hal_touchio_touchin_construct(self, pin); return (mp_obj_t)self; diff --git a/shared-bindings/touchio/__init__.c b/shared-bindings/touchio/__init__.c index 8501315ca7..502b3efa5a 100644 --- a/shared-bindings/touchio/__init__.c +++ b/shared-bindings/touchio/__init__.c @@ -71,4 +71,4 @@ const mp_obj_module_t touchio_module = { .globals = (mp_obj_dict_t *)&touchio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_touchio, touchio_module, CIRCUITPY_TOUCHIO); +MP_REGISTER_MODULE(MP_QSTR_touchio, touchio_module); diff --git a/shared-bindings/traceback/__init__.c b/shared-bindings/traceback/__init__.c index 3ad601eb39..df1d605524 100644 --- a/shared-bindings/traceback/__init__.c +++ b/shared-bindings/traceback/__init__.c @@ -216,4 +216,4 @@ const mp_obj_module_t traceback_module = { .globals = (mp_obj_dict_t *)&traceback_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_traceback, traceback_module, CIRCUITPY_TRACEBACK); +MP_REGISTER_MODULE(MP_QSTR_traceback, traceback_module); diff --git a/shared-bindings/uheap/__init__.c b/shared-bindings/uheap/__init__.c index 40aa869225..08a8592a4d 100644 --- a/shared-bindings/uheap/__init__.c +++ b/shared-bindings/uheap/__init__.c @@ -58,4 +58,4 @@ const mp_obj_module_t uheap_module = { .globals = (mp_obj_dict_t *)&uheap_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_uheap, uheap_module, CIRCUITPY_UHEAP); +MP_REGISTER_MODULE(MP_QSTR_uheap, uheap_module); diff --git a/shared-bindings/usb/__init__.c b/shared-bindings/usb/__init__.c index 443d5cf788..224f50a46c 100644 --- a/shared-bindings/usb/__init__.c +++ b/shared-bindings/usb/__init__.c @@ -48,4 +48,4 @@ const mp_obj_module_t usb_module = { .globals = (mp_obj_dict_t *)&usb_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_usb, usb_module, CIRCUITPY_USB_HOST); +MP_REGISTER_MODULE(MP_QSTR_usb, usb_module); diff --git a/shared-bindings/usb/core/__init__.c b/shared-bindings/usb/core/__init__.c index faeef23a88..6e7658aa27 100644 --- a/shared-bindings/usb/core/__init__.c +++ b/shared-bindings/usb/core/__init__.c @@ -100,8 +100,7 @@ STATIC mp_obj_t _next_device(usb_core_devices_obj_t *iter) { // We passed the filters. Now make a properly allocated object to // return to the user. - usb_core_device_obj_t *self = m_new_obj(usb_core_device_obj_t); - self->base.type = &usb_core_device_type; + usb_core_device_obj_t *self = mp_obj_malloc(usb_core_device_obj_t, &usb_core_device_type); common_hal_usb_core_device_construct(self, i); iter->next_index = i + 1; @@ -195,4 +194,4 @@ const mp_obj_module_t usb_core_module = { .globals = (mp_obj_dict_t *)&usb_core_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_usb_dot_core, usb_core_module, CIRCUITPY_USB_HOST); +MP_REGISTER_MODULE(MP_QSTR_usb_dot_core, usb_core_module); diff --git a/shared-bindings/usb_cdc/__init__.c b/shared-bindings/usb_cdc/__init__.c index b4e712e854..e7a13a768a 100644 --- a/shared-bindings/usb_cdc/__init__.c +++ b/shared-bindings/usb_cdc/__init__.c @@ -142,4 +142,4 @@ void usb_cdc_set_data(mp_obj_t serial_obj) { set_module_dict_entry(MP_ROM_QSTR(MP_QSTR_data), serial_obj); } -MP_REGISTER_MODULE(MP_QSTR_usb_cdc, usb_cdc_module, CIRCUITPY_USB_CDC); +MP_REGISTER_MODULE(MP_QSTR_usb_cdc, usb_cdc_module); diff --git a/shared-bindings/usb_hid/Device.c b/shared-bindings/usb_hid/Device.c index cb88766b3e..34b496a90e 100644 --- a/shared-bindings/usb_hid/Device.c +++ b/shared-bindings/usb_hid/Device.c @@ -91,8 +91,7 @@ //| Uses Report ID 3 for its IN report.""" STATIC mp_obj_t usb_hid_device_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { - usb_hid_device_obj_t *self = m_new_obj(usb_hid_device_obj_t); - self->base.type = &usb_hid_device_type; + usb_hid_device_obj_t *self = mp_obj_malloc(usb_hid_device_obj_t, &usb_hid_device_type); enum { ARG_report_descriptor, ARG_usage_page, ARG_usage, ARG_report_ids, ARG_in_report_lengths, ARG_out_report_lengths }; static const mp_arg_t allowed_args[] = { { MP_QSTR_report_descriptor, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ }, diff --git a/shared-bindings/usb_hid/__init__.c b/shared-bindings/usb_hid/__init__.c index 5c61cc52de..2f374084bb 100644 --- a/shared-bindings/usb_hid/__init__.c +++ b/shared-bindings/usb_hid/__init__.c @@ -182,4 +182,4 @@ void usb_hid_set_devices(mp_obj_t devices) { } } -MP_REGISTER_MODULE(MP_QSTR_usb_hid, usb_hid_module, CIRCUITPY_USB_HID); +MP_REGISTER_MODULE(MP_QSTR_usb_hid, usb_hid_module); diff --git a/shared-bindings/usb_host/Port.c b/shared-bindings/usb_host/Port.c index 53b1fec54f..fdb077d0e5 100644 --- a/shared-bindings/usb_host/Port.c +++ b/shared-bindings/usb_host/Port.c @@ -50,8 +50,7 @@ STATIC mp_obj_t usb_host_port_make_new(const mp_obj_type_t *type, const mcu_pin_obj_t *dp = validate_obj_is_free_pin(args[0], MP_QSTR_dp); const mcu_pin_obj_t *dm = validate_obj_is_free_pin(args[1], MP_QSTR_dm); - usb_host_port_obj_t *self = m_new_obj(usb_host_port_obj_t); - self->base.type = &usb_host_port_type; + usb_host_port_obj_t *self = mp_obj_malloc(usb_host_port_obj_t, &usb_host_port_type); common_hal_usb_host_port_construct(self, dp, dm); return (mp_obj_t)self; diff --git a/shared-bindings/usb_host/__init__.c b/shared-bindings/usb_host/__init__.c index 5c884b3ec2..f7337b1fce 100644 --- a/shared-bindings/usb_host/__init__.c +++ b/shared-bindings/usb_host/__init__.c @@ -49,4 +49,4 @@ const mp_obj_module_t usb_host_module = { .globals = (mp_obj_dict_t *)&usb_host_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_usb_host, usb_host_module, CIRCUITPY_USB_HOST); +MP_REGISTER_MODULE(MP_QSTR_usb_host, usb_host_module); diff --git a/shared-bindings/usb_midi/__init__.c b/shared-bindings/usb_midi/__init__.c index d3d5cf2626..651f4a51d1 100644 --- a/shared-bindings/usb_midi/__init__.c +++ b/shared-bindings/usb_midi/__init__.c @@ -96,4 +96,4 @@ const mp_obj_module_t usb_midi_module = { .globals = (mp_obj_dict_t *)&usb_midi_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_usb_midi, usb_midi_module, CIRCUITPY_USB_MIDI); +MP_REGISTER_MODULE(MP_QSTR_usb_midi, usb_midi_module); diff --git a/shared-bindings/ustack/__init__.c b/shared-bindings/ustack/__init__.c index 17bdcbb1c0..b3850e42ab 100644 --- a/shared-bindings/ustack/__init__.c +++ b/shared-bindings/ustack/__init__.c @@ -86,4 +86,4 @@ const mp_obj_module_t ustack_module = { .globals = (mp_obj_dict_t *)&ustack_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_ustack, ustack_module, CIRCUITPY_USTACK); +MP_REGISTER_MODULE(MP_QSTR_ustack, ustack_module); diff --git a/shared-bindings/vectorio/Circle.c b/shared-bindings/vectorio/Circle.c index 9896876a8a..308e828a02 100644 --- a/shared-bindings/vectorio/Circle.c +++ b/shared-bindings/vectorio/Circle.c @@ -41,8 +41,7 @@ static mp_obj_t vectorio_circle_make_new(const mp_obj_type_t *type, size_t n_arg mp_int_t radius = args[ARG_radius].u_int; mp_arg_validate_int_min(radius, 1, MP_QSTR_radius); - vectorio_circle_t *self = m_new_obj(vectorio_circle_t); - self->base.type = &vectorio_circle_type; + vectorio_circle_t *self = mp_obj_malloc(vectorio_circle_t, &vectorio_circle_type); uint16_t color_index = args[ARG_color_index].u_int; common_hal_vectorio_circle_construct(self, radius, color_index); diff --git a/shared-bindings/vectorio/Polygon.c b/shared-bindings/vectorio/Polygon.c index b188fc4955..452631eddc 100644 --- a/shared-bindings/vectorio/Polygon.c +++ b/shared-bindings/vectorio/Polygon.c @@ -48,8 +48,7 @@ static mp_obj_t vectorio_polygon_make_new(const mp_obj_type_t *type, size_t n_ar mp_obj_t points_list = mp_arg_validate_type(args[ARG_points_list].u_obj, &mp_type_list, MP_QSTR_points); - vectorio_polygon_t *self = m_new_obj(vectorio_polygon_t); - self->base.type = &vectorio_polygon_type; + vectorio_polygon_t *self = mp_obj_malloc(vectorio_polygon_t, &vectorio_polygon_type); uint16_t color_index = args[ARG_color_index].u_int; common_hal_vectorio_polygon_construct(self, points_list, color_index); diff --git a/shared-bindings/vectorio/Rectangle.c b/shared-bindings/vectorio/Rectangle.c index ad864f2c2d..01453693f8 100644 --- a/shared-bindings/vectorio/Rectangle.c +++ b/shared-bindings/vectorio/Rectangle.c @@ -45,8 +45,7 @@ static mp_obj_t vectorio_rectangle_make_new(const mp_obj_type_t *type, size_t n_ mp_int_t height = args[ARG_height].u_int; mp_arg_validate_int_min(height, 1, MP_QSTR_height); - vectorio_rectangle_t *self = m_new_obj(vectorio_rectangle_t); - self->base.type = &vectorio_rectangle_type; + vectorio_rectangle_t *self = mp_obj_malloc(vectorio_rectangle_t, &vectorio_rectangle_type); uint16_t color_index = args[ARG_color_index].u_int; common_hal_vectorio_rectangle_construct(self, width, height, color_index); diff --git a/shared-bindings/vectorio/VectorShape.c b/shared-bindings/vectorio/VectorShape.c index e5c806b943..06a8355e2d 100644 --- a/shared-bindings/vectorio/VectorShape.c +++ b/shared-bindings/vectorio/VectorShape.c @@ -47,8 +47,7 @@ mp_obj_t vectorio_vector_shape_make_new(const mp_obj_t shape, const mp_obj_t pix mp_raise_TypeError_varg(translate("unsupported %q type"), MP_QSTR_shape); } - vectorio_vector_shape_t *self = m_new_obj(vectorio_vector_shape_t); - self->base.type = &vectorio_vector_shape_type; + vectorio_vector_shape_t *self = mp_obj_malloc(vectorio_vector_shape_t, &vectorio_vector_shape_type); common_hal_vectorio_vector_shape_construct(self, ishape, pixel_shader, x, y ); diff --git a/shared-bindings/vectorio/__init__.c b/shared-bindings/vectorio/__init__.c index 7ad77da681..8e6c9766c3 100644 --- a/shared-bindings/vectorio/__init__.c +++ b/shared-bindings/vectorio/__init__.c @@ -45,4 +45,4 @@ const mp_obj_module_t vectorio_module = { .globals = (mp_obj_dict_t *)&vectorio_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_vectorio, vectorio_module, CIRCUITPY_VECTORIO); +MP_REGISTER_MODULE(MP_QSTR_vectorio, vectorio_module); diff --git a/shared-bindings/watchdog/__init__.c b/shared-bindings/watchdog/__init__.c index 5281f1c3fc..70aaddc8a5 100644 --- a/shared-bindings/watchdog/__init__.c +++ b/shared-bindings/watchdog/__init__.c @@ -106,4 +106,4 @@ const mp_obj_module_t watchdog_module = { .globals = (mp_obj_dict_t *)&watchdog_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_watchdog, watchdog_module, CIRCUITPY_WATCHDOG); +MP_REGISTER_MODULE(MP_QSTR_watchdog, watchdog_module); diff --git a/shared-bindings/wifi/Monitor.c b/shared-bindings/wifi/Monitor.c index d087ec587b..acbc63ec89 100644 --- a/shared-bindings/wifi/Monitor.c +++ b/shared-bindings/wifi/Monitor.c @@ -59,8 +59,7 @@ STATIC mp_obj_t wifi_monitor_make_new(const mp_obj_type_t *type, size_t n_args, wifi_monitor_obj_t *self = MP_STATE_VM(wifi_monitor_singleton); if (common_hal_wifi_monitor_deinited()) { - self = m_new_obj(wifi_monitor_obj_t); - self->base.type = &wifi_monitor_type; + self = mp_obj_malloc(wifi_monitor_obj_t, &wifi_monitor_type); common_hal_wifi_monitor_construct(self, channel, queue); MP_STATE_VM(wifi_monitor_singleton) = self; } diff --git a/shared-bindings/wifi/__init__.c b/shared-bindings/wifi/__init__.c index f7b66c68ca..9786c594bd 100644 --- a/shared-bindings/wifi/__init__.c +++ b/shared-bindings/wifi/__init__.c @@ -70,4 +70,4 @@ const mp_obj_module_t wifi_module = { .globals = (mp_obj_dict_t *)&wifi_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_wifi, wifi_module, CIRCUITPY_WIFI); +MP_REGISTER_MODULE(MP_QSTR_wifi, wifi_module); diff --git a/shared-bindings/zlib/__init__.c b/shared-bindings/zlib/__init__.c index ba02914638..b08b4a4a8e 100644 --- a/shared-bindings/zlib/__init__.c +++ b/shared-bindings/zlib/__init__.c @@ -94,4 +94,4 @@ const mp_obj_module_t zlib_module = { .globals = (mp_obj_dict_t *)&zlib_globals, }; -MP_REGISTER_MODULE(MP_QSTR_zlib, zlib_module, CIRCUITPY_ZLIB); +MP_REGISTER_MODULE(MP_QSTR_zlib, zlib_module); diff --git a/shared-module/_bleio/ScanResults.c b/shared-module/_bleio/ScanResults.c index 1f4dbff310..ad7841cfa9 100644 --- a/shared-module/_bleio/ScanResults.c +++ b/shared-module/_bleio/ScanResults.c @@ -35,8 +35,7 @@ #include "shared-bindings/_bleio/ScanResults.h" bleio_scanresults_obj_t *shared_module_bleio_new_scanresults(size_t buffer_size, uint8_t *prefixes, size_t prefixes_len, mp_int_t minimum_rssi) { - bleio_scanresults_obj_t *self = m_new_obj(bleio_scanresults_obj_t); - self->base.type = &bleio_scanresults_type; + bleio_scanresults_obj_t *self = mp_obj_malloc(bleio_scanresults_obj_t, &bleio_scanresults_type); ringbuf_alloc(&self->buf, buffer_size, false); self->prefixes = prefixes; self->prefix_length = prefixes_len; @@ -68,12 +67,10 @@ mp_obj_t common_hal_bleio_scanresults_next(bleio_scanresults_obj_t *self) { mp_obj_str_t *o = MP_OBJ_TO_PTR(mp_obj_new_bytes_of_zeros(len)); ringbuf_get_n(&self->buf, (uint8_t *)o->data, len); - bleio_scanentry_obj_t *entry = m_new_obj(bleio_scanentry_obj_t); - entry->base.type = &bleio_scanentry_type; + bleio_scanentry_obj_t *entry = mp_obj_malloc(bleio_scanentry_obj_t, &bleio_scanentry_type); entry->rssi = rssi; - bleio_address_obj_t *address = m_new_obj(bleio_address_obj_t); - address->base.type = &bleio_address_type; + bleio_address_obj_t *address = mp_obj_malloc(bleio_address_obj_t, &bleio_address_type); common_hal_bleio_address_construct(MP_OBJ_TO_PTR(address), peer_addr, addr_type); entry->address = address; diff --git a/shared-module/displayio/OnDiskBitmap.c b/shared-module/displayio/OnDiskBitmap.c index c9a9d7d9f2..98795a28ab 100644 --- a/shared-module/displayio/OnDiskBitmap.c +++ b/shared-module/displayio/OnDiskBitmap.c @@ -67,8 +67,8 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, self->width = read_word(bmp_header, 9); self->height = read_word(bmp_header, 11); - displayio_colorconverter_t *colorconverter = m_new_obj(displayio_colorconverter_t); - colorconverter->base.type = &displayio_colorconverter_type; + displayio_colorconverter_t *colorconverter = + mp_obj_malloc(displayio_colorconverter_t, &displayio_colorconverter_type; common_hal_displayio_colorconverter_construct(colorconverter, false, DISPLAYIO_COLORSPACE_RGB888); self->colorconverter = colorconverter; @@ -88,8 +88,7 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, number_of_colors = 1 << bits_per_pixel; } - displayio_palette_t *palette = m_new_obj(displayio_palette_t); - palette->base.type = &displayio_palette_type; + displayio_palette_t *palette = mp_obj_malloc(displayio_palette_t, &displayio_palette_type); common_hal_displayio_palette_construct(palette, number_of_colors, false); if (number_of_colors > 1) { diff --git a/shared-module/gifio/OnDiskGif.c b/shared-module/gifio/OnDiskGif.c index c1e6d1f2c2..4213f475a9 100644 --- a/shared-module/gifio/OnDiskGif.c +++ b/shared-module/gifio/OnDiskGif.c @@ -174,8 +174,7 @@ void common_hal_gifio_ondiskgif_construct(gifio_ondiskgif_t *self, pyb_file_obj_ int bpp = 16; if (use_palette == true) { - displayio_palette_t *palette = m_new_obj(displayio_palette_t); - palette->base.type = &displayio_palette_type; + displayio_palette_t *palette = mp_obj_malloc(displayio_palette_t, &displayio_palette_type); common_hal_displayio_palette_construct(palette, 256, false); self->palette = palette; bpp = 8; @@ -183,8 +182,7 @@ void common_hal_gifio_ondiskgif_construct(gifio_ondiskgif_t *self, pyb_file_obj_ self->palette = NULL; } - displayio_bitmap_t *bitmap = m_new_obj(displayio_bitmap_t); - bitmap->base.type = &displayio_bitmap_type; + displayio_bitmap_t *bitmap = mp_obj_malloc(displayio_bitmap_t, &displayio_bitmap_type); common_hal_displayio_bitmap_construct(bitmap, self->gif.iCanvasWidth, self->gif.iCanvasHeight, bpp); self->bitmap = bitmap; diff --git a/shared-module/ipaddress/__init__.c b/shared-module/ipaddress/__init__.c index 9d98c0eb7c..4801500f74 100644 --- a/shared-module/ipaddress/__init__.c +++ b/shared-module/ipaddress/__init__.c @@ -28,8 +28,7 @@ #include "shared-bindings/ipaddress/IPv4Address.h" mp_obj_t common_hal_ipaddress_new_ipv4address(uint32_t value) { - ipaddress_ipv4address_obj_t *self = m_new_obj(ipaddress_ipv4address_obj_t); - self->base.type = &ipaddress_ipv4address_type; + ipaddress_ipv4address_obj_t *self = mp_obj_malloc(ipaddress_ipv4address_obj_t, &ipaddress_ipv4address_type); common_hal_ipaddress_ipv4address_construct(self, (uint8_t *)&value, 4); return MP_OBJ_FROM_PTR(self); } diff --git a/shared-module/keypad/EventQueue.c b/shared-module/keypad/EventQueue.c index eeeceb78cf..d229eef264 100644 --- a/shared-module/keypad/EventQueue.c +++ b/shared-module/keypad/EventQueue.c @@ -53,8 +53,7 @@ bool common_hal_keypad_eventqueue_get_into(keypad_eventqueue_obj_t *self, keypad } mp_obj_t common_hal_keypad_eventqueue_get(keypad_eventqueue_obj_t *self) { - keypad_event_obj_t *event = m_new_obj(keypad_event_obj_t); - event->base.type = &keypad_event_type; + keypad_event_obj_t *event = mp_obj_malloc(keypad_event_obj_t, &keypad_event_type); bool result = common_hal_keypad_eventqueue_get_into(self, event); if (result) { return event; diff --git a/shared-module/keypad/KeyMatrix.c b/shared-module/keypad/KeyMatrix.c index b2520521cc..bab9fb3095 100644 --- a/shared-module/keypad/KeyMatrix.c +++ b/shared-module/keypad/KeyMatrix.c @@ -53,8 +53,8 @@ void common_hal_keypad_keymatrix_construct(keypad_keymatrix_obj_t *self, mp_uint mp_obj_t row_dios[num_row_pins]; for (size_t row = 0; row < num_row_pins; row++) { - digitalio_digitalinout_obj_t *dio = m_new_obj(digitalio_digitalinout_obj_t); - dio->base.type = &digitalio_digitalinout_type; + digitalio_digitalinout_obj_t *dio = + mp_obj_malloc(digitalio_digitalinout_obj_t, &digitalio_digitalinout_type); common_hal_digitalio_digitalinout_construct(dio, row_pins[row]); common_hal_digitalio_digitalinout_switch_to_input(dio, columns_to_anodes ? PULL_UP : PULL_DOWN); row_dios[row] = dio; @@ -63,7 +63,8 @@ void common_hal_keypad_keymatrix_construct(keypad_keymatrix_obj_t *self, mp_uint mp_obj_t column_dios[num_column_pins]; for (size_t column = 0; column < num_column_pins; column++) { - digitalio_digitalinout_obj_t *dio = m_new_obj(digitalio_digitalinout_obj_t); + digitalio_digitalinout_obj_t *dio = + mp_obj_malloc(digitalio_digitalinout_obj_t, &digitalio_digitalinout_type); dio->base.type = &digitalio_digitalinout_type; common_hal_digitalio_digitalinout_construct(dio, column_pins[column]); common_hal_digitalio_digitalinout_switch_to_input(dio, columns_to_anodes ? PULL_UP : PULL_DOWN); diff --git a/shared-module/keypad/Keys.c b/shared-module/keypad/Keys.c index d74a3ab859..aea7418b01 100644 --- a/shared-module/keypad/Keys.c +++ b/shared-module/keypad/Keys.c @@ -48,8 +48,8 @@ void common_hal_keypad_keys_construct(keypad_keys_obj_t *self, mp_uint_t num_pin mp_obj_t dios[num_pins]; for (size_t i = 0; i < num_pins; i++) { - digitalio_digitalinout_obj_t *dio = m_new_obj(digitalio_digitalinout_obj_t); - dio->base.type = &digitalio_digitalinout_type; + digitalio_digitalinout_obj_t *dio = + mp_obj_malloc(digitalio_digitalinout_obj_t, &digitalio_digitalinout_type); common_hal_digitalio_digitalinout_construct(dio, pins[i]); if (pull) { common_hal_digitalio_digitalinout_set_pull(dio, value_when_pressed ? PULL_DOWN : PULL_UP); diff --git a/shared-module/keypad/ShiftRegisterKeys.c b/shared-module/keypad/ShiftRegisterKeys.c index b2b10c65a2..bd3b53e622 100644 --- a/shared-module/keypad/ShiftRegisterKeys.c +++ b/shared-module/keypad/ShiftRegisterKeys.c @@ -46,20 +46,20 @@ static keypad_scanner_funcs_t shiftregisterkeys_funcs = { void common_hal_keypad_shiftregisterkeys_construct(keypad_shiftregisterkeys_obj_t *self, const mcu_pin_obj_t *clock_pin, const mcu_pin_obj_t *data_pin, const mcu_pin_obj_t *latch_pin, bool value_to_latch, size_t key_count, bool value_when_pressed, mp_float_t interval, size_t max_events) { - digitalio_digitalinout_obj_t *clock = m_new_obj(digitalio_digitalinout_obj_t); - clock->base.type = &digitalio_digitalinout_type; + digitalio_digitalinout_obj_t *clock = + mp_obj_malloc(digitalio_digitalinout_obj_t, &digitalio_digitalinout_type); common_hal_digitalio_digitalinout_construct(clock, clock_pin); common_hal_digitalio_digitalinout_switch_to_output(clock, false, DRIVE_MODE_PUSH_PULL); self->clock = clock; - digitalio_digitalinout_obj_t *data = m_new_obj(digitalio_digitalinout_obj_t); - data->base.type = &digitalio_digitalinout_type; + digitalio_digitalinout_obj_t *data = + mp_obj_malloc(digitalio_digitalinout_obj_t, &digitalio_digitalinout_type); common_hal_digitalio_digitalinout_construct(data, data_pin); common_hal_digitalio_digitalinout_switch_to_input(data, PULL_NONE); self->data = data; - digitalio_digitalinout_obj_t *latch = m_new_obj(digitalio_digitalinout_obj_t); - latch->base.type = &digitalio_digitalinout_type; + digitalio_digitalinout_obj_t *latch = + mp_obj_malloc(digitalio_digitalinout_obj_t, &digitalio_digitalinout_type); common_hal_digitalio_digitalinout_construct(latch, latch_pin); common_hal_digitalio_digitalinout_switch_to_output(latch, true, DRIVE_MODE_PUSH_PULL); diff --git a/shared-module/keypad/__init__.c b/shared-module/keypad/__init__.c index d2f5521a25..755dbb4f2d 100644 --- a/shared-module/keypad/__init__.c +++ b/shared-module/keypad/__init__.c @@ -106,8 +106,7 @@ void keypad_construct_common(keypad_scanner_obj_t *self, mp_float_t interval, si self->interval_ticks = (mp_uint_t)(interval * 1024); // interval * 1000 * (1024/1000) - keypad_eventqueue_obj_t *events = m_new_obj(keypad_eventqueue_obj_t); - events->base.type = &keypad_eventqueue_type; + keypad_eventqueue_obj_t *events = mp_obj_malloc(keypad_eventqueue_obj_t, &keypad_eventqueue_type); common_hal_keypad_eventqueue_construct(events, max_events); self->events = events; diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 3a34731d77..27416a29fd 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -385,8 +385,7 @@ STATIC mp_obj_t unpack_ext(msgpack_stream_t *s, size_t size, mp_obj_t ext_hook) 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; + mod_msgpack_extype_obj_t *o = mp_obj_malloc(mod_msgpack_extype_obj_t, &mod_msgpack_exttype_type); o->code = code; o->data = data; return MP_OBJ_FROM_PTR(o); diff --git a/shared-module/touchio/TouchIn.c b/shared-module/touchio/TouchIn.c index 35dd56a6e4..bc98fa05f7 100644 --- a/shared-module/touchio/TouchIn.c +++ b/shared-module/touchio/TouchIn.c @@ -71,8 +71,7 @@ static uint16_t get_raw_reading(touchio_touchin_obj_t *self) { void common_hal_touchio_touchin_construct(touchio_touchin_obj_t *self, const mcu_pin_obj_t *pin) { common_hal_mcu_pin_claim(pin); - self->digitalinout = m_new_obj(digitalio_digitalinout_obj_t); - self->digitalinout->base.type = &digitalio_digitalinout_type; + self->digitalinout = mp_obj_malloc(digitalio_digitalinout_obj_t, &digitalio_digitalinout_type); common_hal_digitalio_digitalinout_construct(self->digitalinout, pin); From 10330b273ce83f34aa370f9a2be078deb4741127 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 8 Aug 2023 10:44:12 -0500 Subject: [PATCH 1440/1712] Divide 'introspect_t' into inputs & outputs leave as a single structure because it's more efficient to call functions with 4 or fewer arguments, and having two struct pointers would make `consider_instruction` have 5 arguments instead. --- .../common-hal/rp2pio/StateMachine.c | 86 ++++++++++--------- 1 file changed, 46 insertions(+), 40 deletions(-) diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index c4e11133c2..0583e4f803 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -405,39 +405,43 @@ static uint32_t mask_and_rotate(const mcu_pin_obj_t *first_pin, uint32_t bit_cou } typedef struct { - uint32_t pins_we_use, in_pin_count, out_pin_count; - bool has_jmp_pin, auto_push, auto_pull, has_in_pin, has_out_pin, has_set_pin; - bool tx_fifo, rx_fifo, in_loaded, out_loaded, in_used, out_used; + struct { + uint32_t pins_we_use, in_pin_count, out_pin_count; + bool has_jmp_pin, auto_push, auto_pull, has_in_pin, has_out_pin, has_set_pin; + } inputs; + struct { + bool tx_fifo, rx_fifo, in_loaded, out_loaded, in_used, out_used; + } outputs; } introspect_t; static void consider_instruction(introspect_t *state, uint16_t full_instruction, qstr what_program, size_t i) { uint16_t instruction = full_instruction & 0xe000; if (instruction == 0x8000) { if ((full_instruction & 0xe080) == pio_instr_bits_push) { - state->rx_fifo = true; - state->in_loaded = true; + state->outputs.rx_fifo = true; + state->outputs.in_loaded = true; } else { // pull otherwise. - state->tx_fifo = true; - state->out_loaded = true; + state->outputs.tx_fifo = true; + state->outputs.out_loaded = true; } } if (instruction == pio_instr_bits_jmp) { uint16_t condition = (full_instruction & 0x00e0) >> 5; - if ((condition == 0x6) && !state->has_jmp_pin) { + if ((condition == 0x6) && !state->inputs.has_jmp_pin) { mp_raise_ValueError_varg(translate("Missing jmp_pin. %q[%u] jumps on pin"), what_program, i); } } if (instruction == pio_instr_bits_wait) { uint16_t wait_source = (full_instruction & 0x0060) >> 5; uint16_t wait_index = full_instruction & 0x001f; - if (wait_source == 0 && (state->pins_we_use & (1 << wait_index)) == 0) { // GPIO + if (wait_source == 0 && (state->inputs.pins_we_use & (1 << wait_index)) == 0) { // GPIO mp_raise_ValueError_varg(translate("%q[%u] uses extra pin"), what_program, i); } if (wait_source == 1) { // Input pin - if (!state->has_in_pin) { + if (!state->inputs.has_in_pin) { mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] waits based on pin"), what_program, i); } - if (wait_index >= state->in_pin_count) { + if (wait_index >= state->inputs.in_pin_count) { mp_raise_ValueError_varg(translate("%q[%u] waits on input outside of count"), what_program, i); } } @@ -446,41 +450,41 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, uint16_t source = (full_instruction & 0x00e0) >> 5; uint16_t bit_count = full_instruction & 0x001f; if (source == 0) { - if (!state->has_in_pin) { + if (!state->inputs.has_in_pin) { mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] shifts in from pin(s)"), what_program, i); } - if (bit_count > state->in_pin_count) { + if (bit_count > state->inputs.in_pin_count) { mp_raise_ValueError_varg(translate("%q[%u] shifts in more bits than pin count"), what_program, i); } } - if (state->auto_push) { - state->in_loaded = true; - state->rx_fifo = true; + if (state->inputs.auto_push) { + state->outputs.in_loaded = true; + state->outputs.rx_fifo = true; } - state->in_used = true; + state->outputs.in_used = true; } if (instruction == pio_instr_bits_out) { uint16_t bit_count = full_instruction & 0x001f; uint16_t destination = (full_instruction & 0x00e0) >> 5; // Check for pins or pindirs destination. if (destination == 0x0 || destination == 0x4) { - if (!state->has_out_pin) { + if (!state->inputs.has_out_pin) { mp_raise_ValueError_varg(translate("Missing first_out_pin. %q[%u] shifts out to pin(s)"), what_program, i); } - if (bit_count > state->out_pin_count) { + if (bit_count > state->inputs.out_pin_count) { mp_raise_ValueError_varg(translate("%q[%u] shifts out more bits than pin count"), what_program, i); } } - if (state->auto_pull) { - state->out_loaded = true; - state->tx_fifo = true; + if (state->inputs.auto_pull) { + state->outputs.out_loaded = true; + state->outputs.tx_fifo = true; } - state->out_used = true; + state->outputs.out_used = true; } if (instruction == pio_instr_bits_set) { uint16_t destination = (full_instruction & 0x00e0) >> 5; // Check for pins or pindirs destination. - if ((destination == 0x00 || destination == 0x4) && !state->has_set_pin) { + if ((destination == 0x00 || destination == 0x4) && !state->inputs.has_set_pin) { mp_raise_ValueError_varg(translate("Missing first_set_pin. %q[%u] sets pin(s)"), what_program, i); } } @@ -488,16 +492,16 @@ static void consider_instruction(introspect_t *state, uint16_t full_instruction, uint16_t source = full_instruction & 0x0007; uint16_t destination = (full_instruction & 0x00e0) >> 5; // Check for pins or pindirs destination. - if (destination == 0x0 && !state->has_out_pin) { + if (destination == 0x0 && !state->inputs.has_out_pin) { mp_raise_ValueError_varg(translate("Missing first_out_pin. %q[%u] writes pin(s)"), what_program, i); } - if (source == 0x0 && !state->has_in_pin) { + if (source == 0x0 && !state->inputs.has_in_pin) { mp_raise_ValueError_varg(translate("Missing first_in_pin. %q[%u] reads pin(s)"), what_program, i); } if (destination == 0x6) { - state->in_loaded = true; + state->outputs.in_loaded = true; } else if (destination == 0x7) { - state->out_loaded = true; + state->outputs.out_loaded = true; } } } @@ -539,24 +543,26 @@ void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, // Look through the program to see what we reference and make sure it was provided. introspect_t state = { - .pins_we_use = pins_we_use, - .has_jmp_pin = jmp_pin != NULL, - .has_in_pin = first_in_pin != NULL, - .has_out_pin = first_out_pin != NULL, - .has_set_pin = first_set_pin != NULL, - .in_pin_count = in_pin_count, - .out_pin_count = out_pin_count, - .auto_pull = auto_pull, - .auto_push = auto_push, + .inputs = { + .pins_we_use = pins_we_use, + .has_jmp_pin = jmp_pin != NULL, + .has_in_pin = first_in_pin != NULL, + .has_out_pin = first_out_pin != NULL, + .has_set_pin = first_set_pin != NULL, + .in_pin_count = in_pin_count, + .out_pin_count = out_pin_count, + .auto_pull = auto_pull, + .auto_push = auto_push, + } }; consider_program(&state, program, program_len, MP_QSTR_program); consider_program(&state, init, init_len, MP_QSTR_init); consider_program(&state, may_exec, may_exec_len, MP_QSTR_may_exec); - if (!state.in_loaded && state.in_used) { + if (!state.outputs.in_loaded && state.outputs.in_used) { mp_raise_ValueError_varg(translate("Program does IN without loading ISR")); } - if (!state.out_loaded && state.out_used) { + if (!state.outputs.out_loaded && state.outputs.out_used) { mp_raise_ValueError_varg(translate("Program does OUT without loading OSR")); } @@ -609,7 +615,7 @@ void common_hal_rp2pio_statemachine_construct(rp2pio_statemachine_obj_t *self, first_sideset_pin, sideset_pin_count, initial_pin_state, initial_pin_direction, jmp_pin, - pins_we_use, state.tx_fifo, state.rx_fifo, + pins_we_use, state.outputs.tx_fifo, state.outputs.rx_fifo, auto_pull, pull_threshold, out_shift_right, wait_for_txstall, auto_push, push_threshold, in_shift_right, From 549bbdc31cbe64a7a340ed069c36966563690fa2 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 8 Aug 2023 12:42:48 -0700 Subject: [PATCH 1441/1712] Alphablend changes --- shared-bindings/bitmaptools/__init__.c | 62 ++++++++++++++- shared-bindings/bitmaptools/__init__.h | 11 ++- shared-module/bitmaptools/__init__.c | 101 ++++++++++++++++++++----- 3 files changed, 153 insertions(+), 21 deletions(-) diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index 2eb966ef8d..505c3885de 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -273,6 +273,28 @@ STATIC mp_obj_t bitmaptools_obj_rotozoom(size_t n_args, const mp_obj_t *pos_args } MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom); + +MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, NORMAL, BITMAPTOOLS_BLENDMODE_NORMAL); +MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, SCREEN, BITMAPTOOLS_BLENDMODE_SCREEN); + +//| class BlendMode: +//| """The blend mode for `alphablend` to operate use""" +//| +//| NORMAL: Blendmode +//| """Blend with equal parts of the two source bitmaps""" +//| +//| SCREEN: Blendmode +//| """Blend based on the value in each color channel. The result keeps the lighter colors and discards darker colors.""" +//| +MAKE_ENUM_MAP(bitmaptools_blendmode) { + MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, NORMAL), + MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, SCREEN), +}; +STATIC MP_DEFINE_CONST_DICT(bitmaptools_blendmode_locals_dict, bitmaptools_blendmode_locals_table); + +MAKE_PRINTER(bitmaptools, bitmaptools_blendmode); +MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); + // requires at least 2 arguments (destination bitmap and source bitmap) //| def alphablend( @@ -282,6 +304,9 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom //| colorspace: displayio.Colorspace, //| factor1: float = 0.5, //| factor2: Optional[float] = None, +//| blendmode: Optional[Blendmode] = Blendmode.NORMAL, +//| skip_source1_index: int, +//| skip_source2_index: int, //| ) -> None: //| """Alpha blend the two source bitmaps into the destination. //| @@ -294,13 +319,18 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom //| :param float factor1: The proportion of bitmap 1 to mix in //| :param float factor2: The proportion of bitmap 2 to mix in. If specified as `None`, ``1-factor1`` is used. Usually the proportions should sum to 1. //| :param displayio.Colorspace colorspace: The colorspace of the bitmaps. They must all have the same colorspace. Only the following colorspaces are permitted: ``L8``, ``RGB565``, ``RGB565_SWAPPED``, ``BGR565`` and ``BGR565_SWAPPED``. +//| :param bitmaptools.BlendMode blendmode: The blend mode to use. Default is NORMAL. +//| :param int skip_source1_index: bitmap palette index in the source that will not be blended, +//| set to None to blended all pixels +//| :param int skip_source2_index: bitmap palette index in the source that will not be blended, +//| set to None to blended all pixels //| //| For the L8 colorspace, the bitmaps must have a bits-per-value of 8. //| For the RGB colorspaces, they must have a bits-per-value of 16.""" //| STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { - enum {ARG_dest_bitmap, ARG_source_bitmap_1, ARG_source_bitmap_2, ARG_colorspace, ARG_factor_1, ARG_factor_2}; + enum {ARG_dest_bitmap, ARG_source_bitmap_1, ARG_source_bitmap_2, ARG_colorspace, ARG_factor_1, ARG_factor_2, ARG_blendmode, ARG_skip_source1_index, ARG_skip_source2_index}; static const mp_arg_t allowed_args[] = { {MP_QSTR_dest_bitmap, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = NULL}}, @@ -309,6 +339,9 @@ STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args, {MP_QSTR_colorspace, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = NULL}}, {MP_QSTR_factor_1, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE}}, {MP_QSTR_factor_2, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE}}, + {MP_QSTR_blendmode, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = (void *)&bitmaptools_blendmode_NORMAL_obj}}, + {MP_QSTR_skip_source1_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + {MP_QSTR_skip_source2_index, 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); @@ -321,6 +354,7 @@ STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args, mp_float_t factor2 = (args[ARG_factor_2].u_obj == mp_const_none) ? 1 - factor1 : mp_obj_get_float(args[ARG_factor_2].u_obj); displayio_colorspace_t colorspace = (displayio_colorspace_t)cp_enum_value(&displayio_colorspace_type, args[ARG_colorspace].u_obj, MP_QSTR_colorspace); + bitmaptools_blendmode_t blendmode = (bitmaptools_blendmode_t)cp_enum_value(&bitmaptools_blendmode_type, args[ARG_blendmode].u_obj, MP_QSTR_blendmode); if (destination->width != source1->width || destination->height != source1->height @@ -352,7 +386,30 @@ STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args, mp_raise_ValueError(translate("Unsupported colorspace")); } - common_hal_bitmaptools_alphablend(destination, source1, source2, colorspace, factor1, factor2); + uint32_t skip_source1_index; + bool skip_source1_index_none; // flag whether skip_value was None + + if (args[ARG_skip_source1_index].u_obj == mp_const_none) { + skip_source1_index = 0; + skip_source1_index_none = true; + } else { + skip_source1_index = mp_obj_get_int(args[ARG_skip_source1_index].u_obj); + skip_source1_index_none = false; + } + + uint32_t skip_source2_index; + bool skip_source2_index_none; // flag whether skip_self_value was None + + if (args[ARG_skip_source2_index].u_obj == mp_const_none) { + skip_source2_index = 0; + skip_source2_index_none = true; + } else { + skip_source2_index = mp_obj_get_int(args[ARG_skip_source2_index].u_obj); + skip_source2_index_none = false; + } + + common_hal_bitmaptools_alphablend(destination, source1, source2, colorspace, factor1, factor2, blendmode, skip_source1_index, + skip_source1_index_none, skip_source2_index, skip_source2_index_none); return mp_const_none; } @@ -1080,6 +1137,7 @@ STATIC const mp_rom_map_elem_t bitmaptools_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&bitmaptools_readinto_obj) }, { MP_ROM_QSTR(MP_QSTR_rotozoom), MP_ROM_PTR(&bitmaptools_rotozoom_obj) }, { MP_ROM_QSTR(MP_QSTR_arrayblit), MP_ROM_PTR(&bitmaptools_arrayblit_obj) }, + { MP_ROM_QSTR(MP_QSTR_Blendmode), MP_ROM_PTR(&bitmaptools_blendmode_type) }, { MP_ROM_QSTR(MP_QSTR_alphablend), MP_ROM_PTR(&bitmaptools_alphablend_obj) }, { MP_ROM_QSTR(MP_QSTR_fill_region), MP_ROM_PTR(&bitmaptools_fill_region_obj) }, { MP_ROM_QSTR(MP_QSTR_boundary_fill), MP_ROM_PTR(&bitmaptools_boundary_fill_obj) }, diff --git a/shared-bindings/bitmaptools/__init__.h b/shared-bindings/bitmaptools/__init__.h index be0811cb80..c7a8df0c99 100644 --- a/shared-bindings/bitmaptools/__init__.h +++ b/shared-bindings/bitmaptools/__init__.h @@ -40,6 +40,11 @@ typedef enum { extern const mp_obj_type_t bitmaptools_dither_algorithm_type; +typedef enum bitmaptools_blendmode { + BITMAPTOOLS_BLENDMODE_NORMAL, + BITMAPTOOLS_BLENDMODE_SCREEN, +} bitmaptools_blendmode_t; + void common_hal_bitmaptools_rotozoom(displayio_bitmap_t *self, int16_t ox, int16_t oy, int16_t dest_clip0_x, int16_t dest_clip0_y, int16_t dest_clip1_x, int16_t dest_clip1_y, @@ -78,6 +83,10 @@ void common_hal_bitmaptools_readinto(displayio_bitmap_t *self, mp_obj_t *file, i void common_hal_bitmaptools_arrayblit(displayio_bitmap_t *self, void *data, int element_size, int x1, int y1, int x2, int y2, bool skip_specified, uint32_t skip_index); void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bitmap_t *source_bitmap, displayio_colorspace_t colorspace, bitmaptools_dither_algorithm_t algorithm); -void common_hal_bitmaptools_alphablend(displayio_bitmap_t *destination, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, mp_float_t factor1, mp_float_t factor2); +void common_hal_bitmaptools_alphablend(displayio_bitmap_t *destination, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, mp_float_t factor1, mp_float_t factor2, + bitmaptools_blendmode_t blendmode, uint32_t skip_source1_index, bool skip_source1_index_none, uint32_t skip_source2_index, bool skip_source2_index_none); + +extern const mp_obj_type_t bitmaptools_blendmode_type; +extern const cp_enum_obj_t bitmaptools_blendmode_NORMAL_obj; #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BITMAPTOOLS__INIT__H diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index e6c0a9439d..4497231785 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -861,26 +861,53 @@ void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bi displayio_bitmap_set_dirty_area(dest_bitmap, &a); } -void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, mp_float_t factor1, mp_float_t factor2) { +void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, mp_float_t factor1, mp_float_t factor2, + bitmaptools_blendmode_t blendmode, uint32_t skip_source1_index, bool skip_source1_index_none, uint32_t skip_source2_index, bool skip_source2_index_none) { displayio_area_t a = {0, 0, dest->width, dest->height, NULL}; displayio_bitmap_set_dirty_area(dest, &a); int ifactor1 = (int)(factor1 * 256); int ifactor2 = (int)(factor2 * 256); + bool blend_source1, blend_source2; if (colorspace == DISPLAYIO_COLORSPACE_L8) { for (int y = 0; y < dest->height; y++) { uint8_t *dptr = (uint8_t *)(dest->data + y * dest->stride); uint8_t *sptr1 = (uint8_t *)(source1->data + y * source1->stride); uint8_t *sptr2 = (uint8_t *)(source2->data + y * source2->stride); + int pixel; for (int x = 0; x < dest->width; x++) { - // This is round(l1*f1 + l2*f2) & clip to range in fixed-point - int pixel = (*sptr1++ *ifactor1 + *sptr2++ *ifactor2 + 128) / 256; + blend_source1 = skip_source1_index_none || *sptr1 != (uint8_t)skip_source1_index; + blend_source2 = skip_source2_index_none || *sptr2 != (uint8_t)skip_source2_index; + if (blend_source1 && blend_source2) { + // Premultiply by the alpha factor + int sca1 = *sptr1++ * ifactor1; + int sca2 = *sptr2++ * ifactor2; + // Blend + int blend; + if (blendmode == BITMAPTOOLS_BLENDMODE_SCREEN) { + blend = sca2 + sca1 - sca2 * sca1; + } else { + blend = sca2 + sca1 * (256 - ifactor2); + } + // Divide by the alpha factor + pixel = (blend / (256 * ifactor1 + 256 * ifactor2 - ifactor1 * ifactor2)); + } else if (blend_source1) { + // Apply iFactor1 to source1 only + pixel = *sptr1++ *ifactor1 / 256; + } else if (blend_source2) { + // Apply iFactor2 to source1 only + pixel = *sptr2++ *ifactor2 / 256; + } else { + // Use the destination value + pixel = *dptr; + } *dptr++ = MIN(255, MAX(0, pixel)); } } } else { bool swap = (colorspace == DISPLAYIO_COLORSPACE_RGB565_SWAPPED) || (colorspace == DISPLAYIO_COLORSPACE_BGR565_SWAPPED); + uint16_t pixel; for (int y = 0; y < dest->height; y++) { uint16_t *dptr = (uint16_t *)(dest->data + y * dest->stride); uint16_t *sptr1 = (uint16_t *)(source1->data + y * source1->stride); @@ -897,25 +924,63 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma const int g_mask = 0x07e0; const int b_mask = 0x001f; // (or r mask, if BGR) - // This is round(r1*f1 + r2*f2) & clip to range in fixed-point - // but avoiding shifting it down to start at bit 0 - int r = ((spix1 & r_mask) * ifactor1 - + (spix2 & r_mask) * ifactor2 + r_mask / 2) / 256; - r = MIN(r_mask, MAX(0, r)) & r_mask; + blend_source1 = skip_source1_index_none || spix1 != (int)skip_source1_index; + blend_source2 = skip_source2_index_none || spix2 != (int)skip_source2_index; - // ditto - int g = ((spix1 & g_mask) * ifactor1 - + (spix2 & g_mask) * ifactor2 + g_mask / 2) / 256; - g = MIN(g_mask, MAX(0, g)) & g_mask; + if (blend_source1 && blend_source2) { + // Blend based on the SVG alpha compositing specs + // https://dev.w3.org/SVG/modules/compositing/master/#alphaCompositing - int b = ((spix1 & b_mask) * ifactor1 - + (spix2 & b_mask) * ifactor2 + b_mask / 2) / 256; - b = MIN(b_mask, MAX(0, b)) & b_mask; + int ifactor_blend = ifactor1 + ifactor2 - ifactor1 * ifactor2 / 256; - uint16_t pixel = r | g | b; - if (swap) { - pixel = __builtin_bswap16(pixel); + // Premultiply the colors by the alpha factor + int red_sca1 = ((spix1 & r_mask) >> 11) * ifactor1; + int green_sca1 = ((spix1 & g_mask) >> 5) * ifactor1; + int blue_sca1 = (spix1 & b_mask) * ifactor1; + + int red_sca2 = ((spix2 & r_mask) >> 11) * ifactor2; + int green_sca2 = ((spix2 & g_mask) >> 5) * ifactor2; + int blue_sca2 = (spix2 & b_mask) * ifactor2; + + int red_blend, green_blend, blue_blend; + if (blendmode == BITMAPTOOLS_BLENDMODE_SCREEN) { + // Perform a screen blend + red_blend = red_sca2 + red_sca1 - (red_sca2 * red_sca1); + green_blend = green_sca2 + green_sca1 - (green_sca2 * green_sca1); + blue_blend = blue_sca2 + blue_sca1 - (blue_sca2 * blue_sca1); + } else { + // Perform a normal blend + red_blend = red_sca2 + red_sca1 * (256 - ifactor2) / 256; + green_blend = green_sca2 + green_sca1 * (256 - ifactor2) / 256; + blue_blend = blue_sca2 + blue_sca1 * (256 - ifactor2) / 256; + } + + // Divide by the alpha factor + int r = ((red_blend / ifactor_blend) << 11) & r_mask; + int g = ((green_blend / ifactor_blend) << 5) & g_mask; + int b = (blue_blend / ifactor_blend) & b_mask; + + // Clamp to the appropriate range + r = MIN(r_mask, MAX(0, r)) & r_mask; + g = MIN(g_mask, MAX(0, g)) & g_mask; + b = MIN(b_mask, MAX(0, b)) & b_mask; + + pixel = r | g | b; + + if (swap) { + pixel = __builtin_bswap16(pixel); + } + } else if (blend_source1) { + // Apply iFactor1 to source1 only + pixel = spix1 * ifactor1 / 256; + } else if (blend_source2) { + // Apply iFactor2 to source1 only + pixel = spix2 * ifactor2 / 256; + } else { + // Use the destination value + pixel = *dptr; } + *dptr++ = pixel; } } From b25d3131a3fd756e5b5784008092c4949109db47 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 8 Aug 2023 12:54:14 -0700 Subject: [PATCH 1442/1712] Update doc string --- shared-bindings/bitmaptools/__init__.c | 48 ++++++++++++-------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index 505c3885de..90ed663e5f 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -126,6 +126,27 @@ STATIC void validate_clip_region(displayio_bitmap_t *bitmap, mp_obj_t clip0_tupl } +MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, NORMAL, BITMAPTOOLS_BLENDMODE_NORMAL); +MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, SCREEN, BITMAPTOOLS_BLENDMODE_SCREEN); + +//| class BlendMode: +//| """The blend mode for `alphablend` to operate use""" +//| +//| NORMAL: Blendmode +//| """Blend with equal parts of the two source bitmaps""" +//| +//| SCREEN: Blendmode +//| """Blend based on the value in each color channel. The result keeps the lighter colors and discards darker colors.""" +//| +MAKE_ENUM_MAP(bitmaptools_blendmode) { + MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, NORMAL), + MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, SCREEN), +}; +STATIC MP_DEFINE_CONST_DICT(bitmaptools_blendmode_locals_dict, bitmaptools_blendmode_locals_table); + +MAKE_PRINTER(bitmaptools, bitmaptools_blendmode); +MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); + //| def rotozoom( //| dest_bitmap: displayio.Bitmap, //| source_bitmap: displayio.Bitmap, @@ -274,27 +295,6 @@ STATIC mp_obj_t bitmaptools_obj_rotozoom(size_t n_args, const mp_obj_t *pos_args MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom); -MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, NORMAL, BITMAPTOOLS_BLENDMODE_NORMAL); -MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, SCREEN, BITMAPTOOLS_BLENDMODE_SCREEN); - -//| class BlendMode: -//| """The blend mode for `alphablend` to operate use""" -//| -//| NORMAL: Blendmode -//| """Blend with equal parts of the two source bitmaps""" -//| -//| SCREEN: Blendmode -//| """Blend based on the value in each color channel. The result keeps the lighter colors and discards darker colors.""" -//| -MAKE_ENUM_MAP(bitmaptools_blendmode) { - MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, NORMAL), - MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, SCREEN), -}; -STATIC MP_DEFINE_CONST_DICT(bitmaptools_blendmode_locals_dict, bitmaptools_blendmode_locals_table); - -MAKE_PRINTER(bitmaptools, bitmaptools_blendmode); -MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); - // requires at least 2 arguments (destination bitmap and source bitmap) //| def alphablend( @@ -320,10 +320,8 @@ MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); //| :param float factor2: The proportion of bitmap 2 to mix in. If specified as `None`, ``1-factor1`` is used. Usually the proportions should sum to 1. //| :param displayio.Colorspace colorspace: The colorspace of the bitmaps. They must all have the same colorspace. Only the following colorspaces are permitted: ``L8``, ``RGB565``, ``RGB565_SWAPPED``, ``BGR565`` and ``BGR565_SWAPPED``. //| :param bitmaptools.BlendMode blendmode: The blend mode to use. Default is NORMAL. -//| :param int skip_source1_index: bitmap palette index in the source that will not be blended, -//| set to None to blended all pixels -//| :param int skip_source2_index: bitmap palette index in the source that will not be blended, -//| set to None to blended all pixels +//| :param int skip_source1_index: bitmap palette index in source_bitmap_1 that will not be blended, set to None to blend all pixels +//| :param int skip_source2_index: bitmap palette index in source_bitmap_2 that will not be blended, set to None to blend all pixels //| //| For the L8 colorspace, the bitmaps must have a bits-per-value of 8. //| For the RGB colorspaces, they must have a bits-per-value of 16.""" From c9c7f02ba40200812fe4c824ecf9235da17437aa Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 8 Aug 2023 13:03:09 -0700 Subject: [PATCH 1443/1712] Fix formatting --- shared-module/bitmaptools/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index 4497231785..5d120861fb 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -894,10 +894,10 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma pixel = (blend / (256 * ifactor1 + 256 * ifactor2 - ifactor1 * ifactor2)); } else if (blend_source1) { // Apply iFactor1 to source1 only - pixel = *sptr1++ *ifactor1 / 256; + pixel = *sptr1++ * ifactor1 / 256; } else if (blend_source2) { // Apply iFactor2 to source1 only - pixel = *sptr2++ *ifactor2 / 256; + pixel = *sptr2++ * ifactor2 / 256; } else { // Use the destination value pixel = *dptr; From 5393bc4ed0c9e666e6b2ad395c6eeabfcc5c7634 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 8 Aug 2023 13:07:50 -0700 Subject: [PATCH 1444/1712] More formatting --- shared-module/bitmaptools/__init__.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index 5d120861fb..ecfe10c01c 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -881,8 +881,8 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma blend_source2 = skip_source2_index_none || *sptr2 != (uint8_t)skip_source2_index; if (blend_source1 && blend_source2) { // Premultiply by the alpha factor - int sca1 = *sptr1++ * ifactor1; - int sca2 = *sptr2++ * ifactor2; + int sca1 = *sptr1++ *ifactor1; + int sca2 = *sptr2++ *ifactor2; // Blend int blend; if (blendmode == BITMAPTOOLS_BLENDMODE_SCREEN) { @@ -894,10 +894,10 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma pixel = (blend / (256 * ifactor1 + 256 * ifactor2 - ifactor1 * ifactor2)); } else if (blend_source1) { // Apply iFactor1 to source1 only - pixel = *sptr1++ * ifactor1 / 256; + pixel = *sptr1++ *ifactor1 / 256; } else if (blend_source2) { // Apply iFactor2 to source1 only - pixel = *sptr2++ * ifactor2 / 256; + pixel = *sptr2++ *ifactor2 / 256; } else { // Use the destination value pixel = *dptr; From ea39d7089f5c2971500b59f54967f4aa71ebb981 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 8 Aug 2023 14:21:55 -0700 Subject: [PATCH 1445/1712] Updated docstring stuff --- shared-bindings/bitmaptools/__init__.c | 54 +++++++++++++------------- shared-bindings/bitmaptools/__init__.h | 11 +++--- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index 90ed663e5f..c828e8e250 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -126,27 +126,6 @@ STATIC void validate_clip_region(displayio_bitmap_t *bitmap, mp_obj_t clip0_tupl } -MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, NORMAL, BITMAPTOOLS_BLENDMODE_NORMAL); -MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, SCREEN, BITMAPTOOLS_BLENDMODE_SCREEN); - -//| class BlendMode: -//| """The blend mode for `alphablend` to operate use""" -//| -//| NORMAL: Blendmode -//| """Blend with equal parts of the two source bitmaps""" -//| -//| SCREEN: Blendmode -//| """Blend based on the value in each color channel. The result keeps the lighter colors and discards darker colors.""" -//| -MAKE_ENUM_MAP(bitmaptools_blendmode) { - MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, NORMAL), - MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, SCREEN), -}; -STATIC MP_DEFINE_CONST_DICT(bitmaptools_blendmode_locals_dict, bitmaptools_blendmode_locals_table); - -MAKE_PRINTER(bitmaptools, bitmaptools_blendmode); -MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); - //| def rotozoom( //| dest_bitmap: displayio.Bitmap, //| source_bitmap: displayio.Bitmap, @@ -295,6 +274,27 @@ STATIC mp_obj_t bitmaptools_obj_rotozoom(size_t n_args, const mp_obj_t *pos_args MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom); +//| class BlendMode: +//| """The blend mode for `alphablend` to operate use""" +//| +//| Normal: BlendMode +//| """Blend with equal parts of the two source bitmaps""" +//| +//| Screen: BlendMode +//| """Blend based on the value in each color channel. The result keeps the lighter colors and discards darker colors.""" +//| +MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, Normal, BITMAPTOOLS_BLENDMODE_NORMAL); +MAKE_ENUM_VALUE(bitmaptools_blendmode_type, bitmaptools_blendmode, Screen, BITMAPTOOLS_BLENDMODE_SCREEN); + +MAKE_ENUM_MAP(bitmaptools_blendmode) { + MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, Normal), + MAKE_ENUM_MAP_ENTRY(bitmaptools_blendmode, Screen), +}; +STATIC MP_DEFINE_CONST_DICT(bitmaptools_blendmode_locals_dict, bitmaptools_blendmode_locals_table); + +MAKE_PRINTER(bitmaptools, bitmaptools_blendmode); +MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); + // requires at least 2 arguments (destination bitmap and source bitmap) //| def alphablend( @@ -304,9 +304,9 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom //| colorspace: displayio.Colorspace, //| factor1: float = 0.5, //| factor2: Optional[float] = None, -//| blendmode: Optional[Blendmode] = Blendmode.NORMAL, -//| skip_source1_index: int, -//| skip_source2_index: int, +//| blendmode: Optional[BlendMode] = BlendMode.Normal, +//| skip_source1_index: Union[int, None] = None, +//| skip_source2_index: Union[int, None] = None, //| ) -> None: //| """Alpha blend the two source bitmaps into the destination. //| @@ -319,7 +319,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(bitmaptools_rotozoom_obj, 0, bitmaptools_obj_rotozoom //| :param float factor1: The proportion of bitmap 1 to mix in //| :param float factor2: The proportion of bitmap 2 to mix in. If specified as `None`, ``1-factor1`` is used. Usually the proportions should sum to 1. //| :param displayio.Colorspace colorspace: The colorspace of the bitmaps. They must all have the same colorspace. Only the following colorspaces are permitted: ``L8``, ``RGB565``, ``RGB565_SWAPPED``, ``BGR565`` and ``BGR565_SWAPPED``. -//| :param bitmaptools.BlendMode blendmode: The blend mode to use. Default is NORMAL. +//| :param bitmaptools.BlendMode blendmode: The blend mode to use. Default is Normal. //| :param int skip_source1_index: bitmap palette index in source_bitmap_1 that will not be blended, set to None to blend all pixels //| :param int skip_source2_index: bitmap palette index in source_bitmap_2 that will not be blended, set to None to blend all pixels //| @@ -337,7 +337,7 @@ STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args, {MP_QSTR_colorspace, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = NULL}}, {MP_QSTR_factor_1, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE}}, {MP_QSTR_factor_2, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE}}, - {MP_QSTR_blendmode, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = (void *)&bitmaptools_blendmode_NORMAL_obj}}, + {MP_QSTR_blendmode, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = (void *)&bitmaptools_blendmode_Normal_obj}}, {MP_QSTR_skip_source1_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, {MP_QSTR_skip_source2_index, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, }; @@ -1135,7 +1135,6 @@ STATIC const mp_rom_map_elem_t bitmaptools_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_readinto), MP_ROM_PTR(&bitmaptools_readinto_obj) }, { MP_ROM_QSTR(MP_QSTR_rotozoom), MP_ROM_PTR(&bitmaptools_rotozoom_obj) }, { MP_ROM_QSTR(MP_QSTR_arrayblit), MP_ROM_PTR(&bitmaptools_arrayblit_obj) }, - { MP_ROM_QSTR(MP_QSTR_Blendmode), MP_ROM_PTR(&bitmaptools_blendmode_type) }, { MP_ROM_QSTR(MP_QSTR_alphablend), MP_ROM_PTR(&bitmaptools_alphablend_obj) }, { MP_ROM_QSTR(MP_QSTR_fill_region), MP_ROM_PTR(&bitmaptools_fill_region_obj) }, { MP_ROM_QSTR(MP_QSTR_boundary_fill), MP_ROM_PTR(&bitmaptools_boundary_fill_obj) }, @@ -1144,6 +1143,7 @@ STATIC const mp_rom_map_elem_t bitmaptools_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_draw_circle), MP_ROM_PTR(&bitmaptools_draw_circle_obj) }, { MP_ROM_QSTR(MP_QSTR_blit), MP_ROM_PTR(&bitmaptools_blit_obj) }, { MP_ROM_QSTR(MP_QSTR_dither), MP_ROM_PTR(&bitmaptools_dither_obj) }, + { MP_ROM_QSTR(MP_QSTR_BlendMode), MP_ROM_PTR(&bitmaptools_blendmode_type) }, { MP_ROM_QSTR(MP_QSTR_DitherAlgorithm), MP_ROM_PTR(&bitmaptools_dither_algorithm_type) }, }; STATIC MP_DEFINE_CONST_DICT(bitmaptools_module_globals, bitmaptools_module_globals_table); diff --git a/shared-bindings/bitmaptools/__init__.h b/shared-bindings/bitmaptools/__init__.h index c7a8df0c99..7e1011d06d 100644 --- a/shared-bindings/bitmaptools/__init__.h +++ b/shared-bindings/bitmaptools/__init__.h @@ -40,11 +40,13 @@ typedef enum { extern const mp_obj_type_t bitmaptools_dither_algorithm_type; -typedef enum bitmaptools_blendmode { - BITMAPTOOLS_BLENDMODE_NORMAL, - BITMAPTOOLS_BLENDMODE_SCREEN, +typedef enum { + BITMAPTOOLS_BLENDMODE_NORMAL, BITMAPTOOLS_BLENDMODE_SCREEN, } bitmaptools_blendmode_t; +extern const mp_obj_type_t bitmaptools_blendmode_type; +extern const cp_enum_obj_t bitmaptools_blendmode_Normal_obj; + void common_hal_bitmaptools_rotozoom(displayio_bitmap_t *self, int16_t ox, int16_t oy, int16_t dest_clip0_x, int16_t dest_clip0_y, int16_t dest_clip1_x, int16_t dest_clip1_y, @@ -86,7 +88,4 @@ void common_hal_bitmaptools_dither(displayio_bitmap_t *dest_bitmap, displayio_bi void common_hal_bitmaptools_alphablend(displayio_bitmap_t *destination, displayio_bitmap_t *source1, displayio_bitmap_t *source2, displayio_colorspace_t colorspace, mp_float_t factor1, mp_float_t factor2, bitmaptools_blendmode_t blendmode, uint32_t skip_source1_index, bool skip_source1_index_none, uint32_t skip_source2_index, bool skip_source2_index_none); -extern const mp_obj_type_t bitmaptools_blendmode_type; -extern const cp_enum_obj_t bitmaptools_blendmode_NORMAL_obj; - #endif // MICROPY_INCLUDED_SHARED_BINDINGS_BITMAPTOOLS__INIT__H From 2ff8667e75c6083680b012bda81d6e3c36957325 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 8 Aug 2023 20:41:17 -0400 Subject: [PATCH 1446/1712] wip; remove long-lived functionality; remove PR#2614 Trinket M0 compile has no compilation errors, but has link errors to fix. --- .../common-hal/_bleio/CharacteristicBuffer.c | 3 +- extmod/modubinascii.c | 4 +- extmod/vfs_fat_file.c | 2 +- ports/atmel-samd/common-hal/busio/UART.c | 9 +- ports/broadcom/common-hal/busio/UART.c | 8 +- ports/mimxrt10xx/common-hal/busio/UART.c | 2 +- ports/nrf/common-hal/_bleio/Adapter.c | 5 +- ports/nrf/common-hal/_bleio/Adapter.h | 2 +- ports/nrf/common-hal/busio/UART.c | 8 +- ports/raspberrypi/common-hal/busio/UART.c | 8 +- .../common-hal/socketpool/Socket.c | 3 +- ports/stm/common-hal/busio/UART.c | 8 +- py/builtinimport.c | 4 - py/gc.c | 229 ++++++------------ py/gc.h | 11 +- py/gc_long_lived.c | 149 ------------ py/gc_long_lived.h | 43 ---- py/malloc.c | 37 ++- py/misc.h | 91 +++++-- py/mpconfig.h | 22 +- py/mpstate.h | 5 +- py/obj.c | 2 +- py/obj.h | 6 +- py/objfun.h | 3 +- py/objgenerator.c | 71 +----- py/objmodule.c | 2 +- py/objtype.c | 5 +- py/py.mk | 1 - py/qstr.c | 6 +- py/ringbuf.c | 4 +- py/ringbuf.h | 2 +- shared-bindings/_pew/PewPew.c | 1 - shared-bindings/audiopwmio/PWMAudioOut.c | 7 +- shared-bindings/busio/UART.c | 6 +- shared-bindings/countio/Counter.c | 3 +- shared-bindings/pulseio/PulseIn.c | 3 +- shared-bindings/rotaryio/IncrementalEncoder.c | 3 +- shared-module/usb_hid/Device.c | 6 +- shared/runtime/pyexec.c | 49 ++-- supervisor/shared/memory.c | 2 +- tools/analyze_heap_dump.py | 14 +- 41 files changed, 244 insertions(+), 605 deletions(-) delete mode 100644 py/gc_long_lived.c delete mode 100644 py/gc_long_lived.h diff --git a/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c b/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c index 5c8c659e36..4150fcfaa0 100644 --- a/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c +++ b/devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c @@ -55,8 +55,7 @@ void common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buffe self->characteristic = characteristic; self->timeout_ms = timeout * 1000; // This is a macro. - // true means long-lived, so it won't be moved. - ringbuf_alloc(&self->ringbuf, buffer_size, true); + ringbuf_alloc(&self->ringbuf, buffer_size); bleio_characteristic_set_observer(characteristic, self); } diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c index dc5a6e29ec..b4d7c75251 100644 --- a/extmod/modubinascii.c +++ b/extmod/modubinascii.c @@ -33,6 +33,8 @@ #include "supervisor/shared/translate/translate.h" +#if MICROPY_PY_UBINASCII + static void check_not_unicode(const mp_obj_t arg) { #if MICROPY_CPYTHON_COMPAT if (mp_obj_is_str(arg)) { @@ -40,8 +42,6 @@ static void check_not_unicode(const mp_obj_t arg) { } #endif } -#if MICROPY_PY_UBINASCII - STATIC mp_obj_t mod_binascii_hexlify(size_t n_args, const mp_obj_t *args) { // First argument is the data to convert. // Second argument is an optional separator to be used between values. diff --git a/extmod/vfs_fat_file.c b/extmod/vfs_fat_file.c index 6abe638780..36070f1011 100644 --- a/extmod/vfs_fat_file.c +++ b/extmod/vfs_fat_file.c @@ -232,7 +232,7 @@ STATIC mp_obj_t file_open(fs_user_mount_t *vfs, const mp_obj_type_t *type, mp_ar DWORD size = (temp_table[0] + 1) * 2; // Now allocate the size and construct the map. - o->fp.cltbl = m_malloc_maybe(size * sizeof(DWORD), false); + o->fp.cltbl = m_malloc_maybe(size * sizeof(DWORD)); if (o->fp.cltbl != NULL) { o->fp.cltbl[0] = size; res = f_lseek(&o->fp, CREATE_LINKMAP); diff --git a/ports/atmel-samd/common-hal/busio/UART.c b/ports/atmel-samd/common-hal/busio/UART.c index 92dbc9757e..36c7f020bc 100644 --- a/ports/atmel-samd/common-hal/busio/UART.c +++ b/ports/atmel-samd/common-hal/busio/UART.c @@ -222,14 +222,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, if (NULL != receiver_buffer) { self->buffer = receiver_buffer; } else { - // Initially allocate the UART's buffer in the long-lived part of the - // heap. UARTs are generally long-lived objects, but the "make long- - // lived" machinery is incapable of moving internal pointers like - // self->buffer, so do it manually. (However, as long as internal - // pointers like this are NOT moved, allocating the buffer - // in the long-lived pool is not strictly necessary) - - self->buffer = (uint8_t *)gc_alloc(self->buffer_length * sizeof(uint8_t), false, true); + self->buffer = (uint8_t *)gc_alloc(self->buffer_length * sizeof(uint8_t), false); if (self->buffer == NULL) { common_hal_busio_uart_deinit(self); m_malloc_fail(self->buffer_length * sizeof(uint8_t)); diff --git a/ports/broadcom/common-hal/busio/UART.c b/ports/broadcom/common-hal/busio/UART.c index 5be098cf03..5ace629ad7 100644 --- a/ports/broadcom/common-hal/busio/UART.c +++ b/ports/broadcom/common-hal/busio/UART.c @@ -212,13 +212,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, if (receiver_buffer != NULL) { ringbuf_init(&self->ringbuf, receiver_buffer, receiver_buffer_size); } else { - // Initially allocate the UART's buffer in the long-lived part of the - // heap. UARTs are generally long-lived objects, but the "make long- - // lived" machinery is incapable of moving internal pointers like - // self->buffer, so do it manually. (However, as long as internal - // pointers like this are NOT moved, allocating the buffer - // in the long-lived pool is not strictly necessary) - if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size, true)) { + if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size)) { m_malloc_fail(receiver_buffer_size); } } diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c index e4d5fda6ae..1982624c6b 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.c +++ b/ports/mimxrt10xx/common-hal/busio/UART.c @@ -348,7 +348,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, if (self->rx != NULL) { if (receiver_buffer == NULL) { - self->ringbuf = gc_alloc(receiver_buffer_size, false, true /*long-lived*/); + self->ringbuf = gc_alloc(receiver_buffer_size, false); } else { self->ringbuf = receiver_buffer; } diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c index c442cf6936..1452eb56a9 100644 --- a/ports/nrf/common-hal/_bleio/Adapter.c +++ b/ports/nrf/common-hal/_bleio/Adapter.c @@ -908,12 +908,11 @@ void common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, bool } // The advertising data buffers must not move, because the SoftDevice depends on them. - // So make them long-lived and reuse them onwards. if (self->advertising_data == NULL) { - self->advertising_data = (uint8_t *)gc_alloc(BLE_GAP_ADV_SET_DATA_SIZE_EXTENDED_MAX_SUPPORTED * sizeof(uint8_t), false, true); + self->advertising_data = (uint8_t *)gc_alloc(BLE_GAP_ADV_SET_DATA_SIZE_EXTENDED_MAX_SUPPORTED * sizeof(uint8_t), false); } if (self->scan_response_data == NULL) { - self->scan_response_data = (uint8_t *)gc_alloc(BLE_GAP_ADV_SET_DATA_SIZE_EXTENDED_MAX_SUPPORTED * sizeof(uint8_t), false, true); + self->scan_response_data = (uint8_t *)gc_alloc(BLE_GAP_ADV_SET_DATA_SIZE_EXTENDED_MAX_SUPPORTED * sizeof(uint8_t), false); } memcpy(self->advertising_data, advertising_data_bufinfo->buf, advertising_data_bufinfo->len); diff --git a/ports/nrf/common-hal/_bleio/Adapter.h b/ports/nrf/common-hal/_bleio/Adapter.h index 4d3fac20c7..8f5b1e892d 100644 --- a/ports/nrf/common-hal/_bleio/Adapter.h +++ b/ports/nrf/common-hal/_bleio/Adapter.h @@ -45,7 +45,7 @@ extern bleio_connection_internal_t bleio_connections[BLEIO_TOTAL_CONNECTION_COUN typedef struct { mp_obj_base_t base; - // Pointer to buffers we maintain so that the data is long lived. + // We create buffers and copy the advertising data so it will live for as long as we need. uint8_t *advertising_data; uint8_t *scan_response_data; // Pointer to current data. diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index 10a34e09df..f916c28b7f 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -215,13 +215,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, if (receiver_buffer != NULL) { ringbuf_init(&self->ringbuf, receiver_buffer, receiver_buffer_size); } else { - // Initially allocate the UART's buffer in the long-lived part of the - // heap. UARTs are generally long-lived objects, but the "make long- - // lived" machinery is incapable of moving internal pointers like - // self->buffer, so do it manually. (However, as long as internal - // pointers like this are NOT moved, allocating the buffer - // in the long-lived pool is not strictly necessary) - if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size, true)) { + if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size)) { nrfx_uarte_uninit(self->uarte); m_malloc_fail(receiver_buffer_size); } diff --git a/ports/raspberrypi/common-hal/busio/UART.c b/ports/raspberrypi/common-hal/busio/UART.c index 156a5e11ce..0440806c17 100644 --- a/ports/raspberrypi/common-hal/busio/UART.c +++ b/ports/raspberrypi/common-hal/busio/UART.c @@ -159,13 +159,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, if (receiver_buffer != NULL) { ringbuf_init(&self->ringbuf, receiver_buffer, receiver_buffer_size); } else { - // Initially allocate the UART's buffer in the long-lived part of the - // heap. UARTs are generally long-lived objects, but the "make long- - // lived" machinery is incapable of moving internal pointers like - // self->buffer, so do it manually. (However, as long as internal - // pointers like this are NOT moved, allocating the buffer - // in the long-lived pool is not strictly necessary) - if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size, true)) { + if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size)) { uart_deinit(self->uart); m_malloc_fail(receiver_buffer_size); } diff --git a/ports/raspberrypi/common-hal/socketpool/Socket.c b/ports/raspberrypi/common-hal/socketpool/Socket.c index 0696cc7ae9..f2b84f9ccb 100644 --- a/ports/raspberrypi/common-hal/socketpool/Socket.c +++ b/ports/raspberrypi/common-hal/socketpool/Socket.c @@ -733,8 +733,7 @@ socketpool_socket_obj_t *common_hal_socketpool_socket(socketpool_socketpool_obj_ mp_raise_NotImplementedError(translate("Only IPv4 sockets supported")); } - // we must allocate sockets long-lived because we depend on their object-identity - socketpool_socket_obj_t *socket = m_new_ll_obj_with_finaliser(socketpool_socket_obj_t); + socketpool_socket_obj_t *socket = m_new_obj_with_finaliser(socketpool_socket_obj_t); socket->base.type = &socketpool_socket_type; if (!socketpool_socket(self, family, type, socket)) { diff --git a/ports/stm/common-hal/busio/UART.c b/ports/stm/common-hal/busio/UART.c index cdace31639..1f5788f27e 100644 --- a/ports/stm/common-hal/busio/UART.c +++ b/ports/stm/common-hal/busio/UART.c @@ -218,13 +218,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, if (receiver_buffer != NULL) { ringbuf_init(&self->ringbuf, receiver_buffer, receiver_buffer_size); } else { - // Initially allocate the UART's buffer in the long-lived part of the - // heap. UARTs are generally long-lived objects, but the "make long- - // lived" machinery is incapable of moving internal pointers like - // self->buffer, so do it manually. (However, as long as internal - // pointers like this are NOT moved, allocating the buffer - // in the long-lived pool is not strictly necessary) - if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size, true)) { + if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size)) { m_malloc_fail(receiver_buffer_size); } } diff --git a/py/builtinimport.c b/py/builtinimport.c index a47211165b..53336ac0e8 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -31,7 +31,6 @@ #include #include "py/compile.h" -#include "py/gc_long_lived.h" #include "py/gc.h" #include "py/objmodule.h" #include "py/persistentcode.h" @@ -159,7 +158,6 @@ STATIC void do_load_from_lexer(mp_module_context_t *context, mp_lexer_t *lex) { // parse, compile and execute the module in its context mp_obj_dict_t *mod_globals = context->module.globals; mp_parse_compile_execute(lex, MP_PARSE_FILE_INPUT, mod_globals, mod_globals); - mp_obj_module_set_globals(module_obj, make_dict_long_lived(mod_globals, 10)); } #endif @@ -189,8 +187,6 @@ STATIC void do_execute_raw_code(mp_module_context_t *context, const mp_raw_code_ // finish nlr block, restore context nlr_pop(); - mp_obj_module_set_globals(module_obj, - make_dict_long_lived(mp_obj_module_get_globals(module_obj), 10)); mp_globals_set(old_globals); mp_locals_set(old_locals); } else { diff --git a/py/gc.c b/py/gc.c index 3446f99f63..5fd3e97407 100644 --- a/py/gc.c +++ b/py/gc.c @@ -62,6 +62,9 @@ // detect untraced object still in use #define CLEAR_ON_SWEEP (0) +#define WORDS_PER_BLOCK ((MICROPY_BYTES_PER_GC_BLOCK) / MP_BYTES_PER_OBJ_WORD) +#define BYTES_PER_BLOCK (MICROPY_BYTES_PER_GC_BLOCK) + // ATB = allocation table byte // 0b00 = FREE -- free block // 0b01 = HEAD -- head of a chain of blocks @@ -74,6 +77,15 @@ #define AT_MARK (3) #define BLOCKS_PER_ATB (4) +#define ATB_MASK_0 (0x03) +#define ATB_MASK_1 (0x0c) +#define ATB_MASK_2 (0x30) +#define ATB_MASK_3 (0xc0) + +#define ATB_0_IS_FREE(a) (((a) & ATB_MASK_0) == 0) +#define ATB_1_IS_FREE(a) (((a) & ATB_MASK_1) == 0) +#define ATB_2_IS_FREE(a) (((a) & ATB_MASK_2) == 0) +#define ATB_3_IS_FREE(a) (((a) & ATB_MASK_3) == 0) #define BLOCK_SHIFT(block) (2 * ((block) & (BLOCKS_PER_ATB - 1))) #define ATB_GET_KIND(block) ((MP_STATE_MEM(gc_alloc_table_start)[(block) / BLOCKS_PER_ATB] >> BLOCK_SHIFT(block)) & 3) @@ -130,6 +142,7 @@ void gc_init(void *start, void *end) { // => T = A * (1 + BLOCKS_PER_ATB / BLOCKS_PER_FTB + BLOCKS_PER_ATB * BYTES_PER_BLOCK) size_t total_byte_len = (byte *)end - (byte *)start; #if MICROPY_ENABLE_FINALISER + // CIRCUITPY: https://github.com/adafruit/circuitpython/pull/5245 (bug fix) MP_STATE_MEM(gc_alloc_table_byte_len) = (total_byte_len - 1) * MP_BITS_PER_BYTE / (MP_BITS_PER_BYTE + MP_BITS_PER_BYTE * BLOCKS_PER_ATB / BLOCKS_PER_FTB + MP_BITS_PER_BYTE * BLOCKS_PER_ATB * BYTES_PER_BLOCK); #else MP_STATE_MEM(gc_alloc_table_byte_len) = total_byte_len / (1 + MP_BITS_PER_BYTE / 2 * BYTES_PER_BLOCK); @@ -138,7 +151,8 @@ void gc_init(void *start, void *end) { MP_STATE_MEM(gc_alloc_table_start) = (byte *)start; #if MICROPY_ENABLE_FINALISER - MP_STATE_MEM(gc_finaliser_table_start) = MP_STATE_MEM(gc_alloc_table_start) + MP_STATE_MEM(gc_alloc_table_byte_len) + 1; + size_t gc_finaliser_table_byte_len = (MP_STATE_MEM(gc_alloc_table_byte_len) * BLOCKS_PER_ATB + BLOCKS_PER_FTB - 1) / BLOCKS_PER_FTB; + MP_STATE_MEM(gc_finaliser_table_start) = MP_STATE_MEM(gc_alloc_table_start) + MP_STATE_MEM(gc_alloc_table_byte_len); #endif size_t gc_pool_block_len = MP_STATE_MEM(gc_alloc_table_byte_len) * BLOCKS_PER_ATB; @@ -146,34 +160,27 @@ void gc_init(void *start, void *end) { MP_STATE_MEM(gc_pool_end) = end; #if MICROPY_ENABLE_FINALISER - size_t gc_finaliser_table_byte_len = (MP_STATE_MEM(gc_alloc_table_byte_len) * BLOCKS_PER_ATB + BLOCKS_PER_FTB - 1) / BLOCKS_PER_FTB; + // CIRCUITPY: https://github.com/adafruit/circuitpython/pull/6397 (compiler diagnostic) (void)gc_finaliser_table_byte_len; // avoid unused variable diagnostic if asserts are disabled assert(MP_STATE_MEM(gc_pool_start) >= MP_STATE_MEM(gc_finaliser_table_start) + gc_finaliser_table_byte_len); #endif - // Clear ATBs & finalisers (if enabled). This also clears the extra byte - // which appears between ATBs and finalisers that ensures every chain in - // the ATB terminates, rather than erroneously using bits from the - // finalisers. - memset(MP_STATE_MEM(gc_alloc_table_start), 0, MP_STATE_MEM(gc_pool_start) - MP_STATE_MEM(gc_alloc_table_start)); + // clear ATBs + memset(MP_STATE_MEM(gc_alloc_table_start), 0, MP_STATE_MEM(gc_alloc_table_byte_len)); - // Set first free ATB index to the start of the heap. - for (size_t i = 0; i < MICROPY_ATB_INDICES; i++) { - MP_STATE_MEM(gc_first_free_atb_index)[i] = 0; - } + #if MICROPY_ENABLE_FINALISER + // clear FTBs + memset(MP_STATE_MEM(gc_finaliser_table_start), 0, gc_finaliser_table_byte_len); + #endif - // Set last free ATB index to the end of the heap. - MP_STATE_MEM(gc_last_free_atb_index) = MP_STATE_MEM(gc_alloc_table_byte_len) - 1; - - // Set the lowest long lived ptr to the end of the heap to start. This will be lowered as long - // lived objects are allocated. - MP_STATE_MEM(gc_lowest_long_lived_ptr) = (void *)PTR_FROM_BLOCK(MP_STATE_MEM(gc_alloc_table_byte_len * BLOCKS_PER_ATB)); + // set last free ATB index to start of heap + MP_STATE_MEM(gc_last_free_atb_index) = 0; // unlock the GC MP_STATE_THREAD(gc_lock_depth) = 0; // allow auto collection - MP_STATE_MEM(gc_auto_collect_enabled) = true; + MP_STATE_MEM(gc_auto_collect_enabled) = 1; #if MICROPY_GC_ALLOC_THRESHOLD // by default, maxuint for gc threshold, effectively turning gc-by-threshold off @@ -219,6 +226,8 @@ bool gc_is_locked(void) { return MP_STATE_THREAD(gc_lock_depth) != 0; } +// CIRCUITPY: VERIFY_PTR moved to gc.h to make it available elsewhere. + #ifndef TRACE_MARK #if DEBUG_PRINT #define TRACE_MARK(block, ptr) DEBUG_printf("gc_mark(%p)\n", ptr) @@ -231,7 +240,7 @@ bool gc_is_locked(void) { // children: mark the unmarked child blocks and put those newly marked // blocks on the stack. When all children have been checked, pop off the // topmost block on the stack and repeat with that one. -// We don't instrument these functions because they occur a lot during GC and +// CIRCUITPY: We don't instrument these functions because they occur a lot during GC and // fill up the output buffer quickly. STATIC void MP_NO_INSTRUMENT PLACE_IN_ITCM(gc_mark_subtree)(size_t block) { // Start with the block passed in the argument. @@ -412,7 +421,7 @@ void gc_collect_root(void **ptrs, size_t len) { for (size_t i = 0; i < len; i++) { MICROPY_GC_HOOK_LOOP void *ptr = gc_get_ptr(ptrs, i); - // CIRCUITPY changed i PR #1816 + // CIRCUITPY changed in PR #1816 gc_mark(ptr); } } @@ -420,10 +429,7 @@ void gc_collect_root(void **ptrs, size_t len) { void gc_collect_end(void) { gc_deal_with_stack_overflow(); gc_sweep(); - for (size_t i = 0; i < MICROPY_ATB_INDICES; i++) { - MP_STATE_MEM(gc_first_free_atb_index)[i] = 0; - } - MP_STATE_MEM(gc_last_free_atb_index) = MP_STATE_MEM(gc_alloc_table_byte_len) - 1; + MP_STATE_MEM(gc_last_free_atb_index) = 0; MP_STATE_THREAD(gc_lock_depth)--; GC_EXIT(); } @@ -503,9 +509,7 @@ bool gc_alloc_possible(void) { return MP_STATE_MEM(gc_pool_start) != 0; } -// We place long lived objects at the end of the heap rather than the start. This reduces -// fragmentation by localizing the heap churn to one portion of memory (the start of the heap.) -void *gc_alloc(size_t n_bytes, unsigned int alloc_flags, bool long_lived) { +void *gc_alloc(size_t n_bytes, unsigned int alloc_flags) { bool has_finaliser = alloc_flags & GC_ALLOC_FLAG_HAS_FINALISER; size_t n_blocks = ((n_bytes + BYTES_PER_BLOCK - 1) & (~(BYTES_PER_BLOCK - 1))) / BYTES_PER_BLOCK; DEBUG_printf("gc_alloc(" UINT_FMT " bytes -> " UINT_FMT " blocks)\n", n_bytes, n_blocks); @@ -526,11 +530,11 @@ void *gc_alloc(size_t n_bytes, unsigned int alloc_flags, bool long_lived) { GC_ENTER(); - size_t found_block = 0xffffffff; + size_t i; size_t end_block; size_t start_block; size_t n_free; - bool collected = !MP_STATE_MEM(gc_auto_collect_enabled); + int collected = !MP_STATE_MEM(gc_auto_collect_enabled); #if MICROPY_GC_ALLOC_THRESHOLD if (!collected && MP_STATE_MEM(gc_alloc_amount) >= MP_STATE_MEM(gc_alloc_threshold)) { @@ -541,49 +545,18 @@ void *gc_alloc(size_t n_bytes, unsigned int alloc_flags, bool long_lived) { } #endif - bool keep_looking = true; + for (;;) { - // When we start searching on the other side of the crossover block we make sure to - // perform a collect. That way we'll get the closest free block in our section. - size_t crossover_block = BLOCK_FROM_PTR(MP_STATE_MEM(gc_lowest_long_lived_ptr)); - while (keep_looking) { - int8_t direction = 1; - size_t bucket = MIN(n_blocks, MICROPY_ATB_INDICES) - 1; - size_t first_free = MP_STATE_MEM(gc_first_free_atb_index)[bucket]; - size_t start = first_free; - if (long_lived) { - direction = -1; - start = MP_STATE_MEM(gc_last_free_atb_index); - } - n_free = 0; // look for a run of n_blocks available blocks - for (size_t i = start; keep_looking && first_free <= i && i <= MP_STATE_MEM(gc_last_free_atb_index); i += direction) { + n_free = 0; + for (i = MP_STATE_MEM(gc_last_free_atb_index); i < MP_STATE_MEM(gc_alloc_table_byte_len); i++) { byte a = MP_STATE_MEM(gc_alloc_table_start)[i]; - // Four ATB states are packed into a single byte. - int j = 0; - if (direction == -1) { - j = 3; - } - for (; keep_looking && 0 <= j && j <= 3; j += direction) { - if ((a & (0x3 << (j * 2))) == 0) { - if (++n_free >= n_blocks) { - found_block = i * BLOCKS_PER_ATB + j; - keep_looking = false; - } - } else { - if (!collected) { - size_t block = i * BLOCKS_PER_ATB + j; - if ((direction == 1 && block >= crossover_block) || - (direction == -1 && block < crossover_block)) { - keep_looking = false; - } - } - n_free = 0; - } - } - } - if (n_free >= n_blocks) { - break; + // *FORMAT-OFF* + if (ATB_0_IS_FREE(a)) { if (++n_free >= n_blocks) { i = i * BLOCKS_PER_ATB + 0; goto found; } } else { n_free = 0; } + if (ATB_1_IS_FREE(a)) { if (++n_free >= n_blocks) { i = i * BLOCKS_PER_ATB + 1; goto found; } } else { n_free = 0; } + if (ATB_2_IS_FREE(a)) { if (++n_free >= n_blocks) { i = i * BLOCKS_PER_ATB + 2; goto found; } } else { n_free = 0; } + if (ATB_3_IS_FREE(a)) { if (++n_free >= n_blocks) { i = i * BLOCKS_PER_ATB + 3; goto found; } } else { n_free = 0; } + // *FORMAT-ON* } GC_EXIT(); @@ -593,35 +566,26 @@ void *gc_alloc(size_t n_bytes, unsigned int alloc_flags, bool long_lived) { } DEBUG_printf("gc_alloc(" UINT_FMT "): no free mem, triggering GC\n", n_bytes); gc_collect(); - collected = true; - // Try again since we've hopefully freed up space. - keep_looking = true; + collected = 1; GC_ENTER(); } - assert(found_block != 0xffffffff); - // Found free space ending at found_block inclusive. - // Also, set last free ATB index to block after last block we found, for start of - // next scan. Also, whenever we free or shrink a block we must check if this index needs - // adjusting (see gc_realloc and gc_free). - if (!long_lived) { - end_block = found_block; - start_block = found_block - n_free + 1; - if (n_blocks < MICROPY_ATB_INDICES) { - size_t next_free_atb = (found_block + n_blocks) / BLOCKS_PER_ATB; - // Update all atb indices for larger blocks too. - for (size_t i = n_blocks - 1; i < MICROPY_ATB_INDICES; i++) { - MP_STATE_MEM(gc_first_free_atb_index)[i] = next_free_atb; - } - } - } else { - start_block = found_block; - end_block = found_block + n_free - 1; - // Always update the bounds of the long lived area because we assume it is contiguous. (It - // can still be reset by a sweep.) - MP_STATE_MEM(gc_last_free_atb_index) = (found_block - 1) / BLOCKS_PER_ATB; + // found, ending at block i inclusive +found: + // get starting and end blocks, both inclusive + end_block = i; + start_block = i - n_free + 1; + + // Set last free ATB index to block after last block we found, for start of + // next scan. To reduce fragmentation, we only do this if we were looking + // for a single free block, which guarantees that there are no free blocks + // before this one. Also, whenever we free or shink a block we must check + // if this index needs adjusting (see gc_realloc and gc_free). + if (n_free == 1) { + MP_STATE_MEM(gc_last_free_atb_index) = (i + 1) / BLOCKS_PER_ATB; } + #ifdef LOG_HEAP_ACTIVITY gc_log_change(start_block, end_block - start_block + 1); #endif @@ -640,13 +604,6 @@ void *gc_alloc(size_t n_bytes, unsigned int alloc_flags, bool long_lived) { void *ret_ptr = (void *)(MP_STATE_MEM(gc_pool_start) + start_block * BYTES_PER_BLOCK); DEBUG_printf("gc_alloc(%p)\n", ret_ptr); - // If the allocation was long live then update the lowest value. Its used to trigger early - // collects when allocations fail in their respective section. Its also used to ignore calls to - // gc_make_long_lived where the pointer is already in the long lived section. - if (long_lived && ret_ptr < MP_STATE_MEM(gc_lowest_long_lived_ptr)) { - MP_STATE_MEM(gc_lowest_long_lived_ptr) = ret_ptr; - } - #if MICROPY_GC_ALLOC_THRESHOLD MP_STATE_MEM(gc_alloc_amount) += n_blocks; #endif @@ -714,42 +671,34 @@ void gc_free(void *ptr) { if (ptr == NULL) { GC_EXIT(); } else { + // CIRCUITPY extra checking if (MP_STATE_MEM(gc_pool_start) == 0) { reset_into_safe_mode(SAFE_MODE_GC_ALLOC_OUTSIDE_VM); } // get the GC block number corresponding to this pointer assert(VERIFY_PTR(ptr)); - size_t start_block = BLOCK_FROM_PTR(ptr); - assert(ATB_GET_KIND(start_block) == AT_HEAD); + size_t block = BLOCK_FROM_PTR(ptr); + assert(ATB_GET_KIND(block) == AT_HEAD); #if MICROPY_ENABLE_FINALISER - FTB_CLEAR(start_block); + FTB_CLEAR(block); #endif - // free head and all of its tail blocks + // set the last_free pointer to this block if it's earlier in the heap + if (block / BLOCKS_PER_ATB < MP_STATE_MEM(gc_last_free_atb_index)) { + MP_STATE_MEM(gc_last_free_atb_index) = block / BLOCKS_PER_ATB; + } + #ifdef LOG_HEAP_ACTIVITY gc_log_change(start_block, 0); #endif - size_t block = start_block; + + // free head and all of its tail blocks do { ATB_ANY_TO_FREE(block); block += 1; } while (ATB_GET_KIND(block) == AT_TAIL); - // Update the first free pointer for our size only. Not much calls gc_free directly so there - // is decent chance we'll want to allocate this size again. By only updating the specific - // size we don't risk something smaller fitting in. - size_t n_blocks = block - start_block; - size_t bucket = MIN(n_blocks, MICROPY_ATB_INDICES) - 1; - size_t new_free_atb = start_block / BLOCKS_PER_ATB; - if (new_free_atb < MP_STATE_MEM(gc_first_free_atb_index)[bucket]) { - MP_STATE_MEM(gc_first_free_atb_index)[bucket] = new_free_atb; - } - // set the last_free pointer to this block if it's earlier in the heap - if (new_free_atb > MP_STATE_MEM(gc_last_free_atb_index)) { - MP_STATE_MEM(gc_last_free_atb_index) = new_free_atb; - } - GC_EXIT(); #if EXTENSIVE_HEAP_PROFILING @@ -795,33 +744,6 @@ bool gc_has_finaliser(const void *ptr) { return false; } -void *gc_make_long_lived(void *old_ptr) { - // If its already in the long lived section then don't bother moving it. - if (old_ptr >= MP_STATE_MEM(gc_lowest_long_lived_ptr)) { - return old_ptr; - } - size_t n_bytes = gc_nbytes(old_ptr); - if (n_bytes == 0) { - return old_ptr; - } - bool has_finaliser = gc_has_finaliser(old_ptr); - - // Try and find a new area in the long lived section to copy the memory to. - void *new_ptr = gc_alloc(n_bytes, has_finaliser, true); - if (new_ptr == NULL) { - return old_ptr; - } else if (old_ptr > new_ptr) { - // Return the old pointer if the new one is lower in the heap and free the new space. - gc_free(new_ptr); - return old_ptr; - } - // We copy everything over and let the garbage collection process delete the old copy. That way - // we ensure we don't delete memory that has a second reference. (Though if there is we may - // confuse things when its mutable.) - memcpy(new_ptr, old_ptr, n_bytes); - return new_ptr; -} - #if 0 // old, simple realloc that didn't expand memory in place void *gc_realloc(void *ptr, mp_uint_t n_bytes) { @@ -854,7 +776,7 @@ void *gc_realloc(void *ptr, mp_uint_t n_bytes) { void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) { // check for pure allocation if (ptr_in == NULL) { - return gc_alloc(n_bytes, false, false); + return gc_alloc(n_bytes, false); } // check for pure free @@ -919,13 +841,8 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) { } // set the last_free pointer to end of this block if it's earlier in the heap - size_t new_free_atb = (block + new_blocks) / BLOCKS_PER_ATB; - size_t bucket = MIN(n_blocks - new_blocks, MICROPY_ATB_INDICES) - 1; - if (new_free_atb < MP_STATE_MEM(gc_first_free_atb_index)[bucket]) { - MP_STATE_MEM(gc_first_free_atb_index)[bucket] = new_free_atb; - } - if (new_free_atb > MP_STATE_MEM(gc_last_free_atb_index)) { - MP_STATE_MEM(gc_last_free_atb_index) = new_free_atb; + if ((block + new_blocks) / BLOCKS_PER_ATB < MP_STATE_MEM(gc_last_free_atb_index)) { + MP_STATE_MEM(gc_last_free_atb_index) = (block + new_blocks) / BLOCKS_PER_ATB; } GC_EXIT(); @@ -992,7 +909,7 @@ void *gc_realloc(void *ptr_in, size_t n_bytes, bool allow_move) { } // can't resize inplace; try to find a new contiguous chain - void *ptr_out = gc_alloc(n_bytes, ftb_state, false); + void *ptr_out = gc_alloc(n_bytes, ftb_state); // check that the alloc succeeded if (ptr_out == NULL) { @@ -1025,7 +942,7 @@ bool gc_never_free(void *ptr) { last_reference_block = current_reference_block; // keep a record of last "proper" reference block current_reference_block = current_reference_block[0]; } - void **next_block = gc_alloc(BYTES_PER_BLOCK, false, true); + void **next_block = gc_alloc(BYTES_PER_BLOCK, false); if (next_block == NULL) { return false; } diff --git a/py/gc.h b/py/gc.h index 25d5e52856..c88ac78006 100644 --- a/py/gc.h +++ b/py/gc.h @@ -26,15 +26,13 @@ #ifndef MICROPY_INCLUDED_PY_GC_H #define MICROPY_INCLUDED_PY_GC_H -#include +#include +#include #include "py/mpconfig.h" #include "py/mpstate.h" #include "py/misc.h" -#define WORDS_PER_BLOCK ((MICROPY_BYTES_PER_GC_BLOCK) / MP_BYTES_PER_OBJ_WORD) -#define BYTES_PER_BLOCK (MICROPY_BYTES_PER_GC_BLOCK) - #define HEAP_PTR(ptr) ( \ MP_STATE_MEM(gc_pool_start) != 0 /* Not on the heap if it isn't inited */ \ && ptr >= (void *)MP_STATE_MEM(gc_pool_start) /* must be above start of pool */ \ @@ -43,7 +41,7 @@ // ptr should be of type void* #define VERIFY_PTR(ptr) ( \ - ((uintptr_t)(ptr) & (BYTES_PER_BLOCK - 1)) == 0 /* must be aligned on a block */ \ + ((uintptr_t)(ptr) & (MICROPY_BYTES_PER_GC_BLOCK - 1)) == 0 /* must be aligned on a block */ \ && HEAP_PTR(ptr) \ ) @@ -73,11 +71,10 @@ enum { GC_ALLOC_FLAG_HAS_FINALISER = 1, }; -void *gc_alloc(size_t n_bytes, unsigned int alloc_flags, bool long_lived); +void *gc_alloc(size_t n_bytes, unsigned int alloc_flags); void gc_free(void *ptr); // does not call finaliser size_t gc_nbytes(const void *ptr); bool gc_has_finaliser(const void *ptr); -void *gc_make_long_lived(void *old_ptr); void *gc_realloc(void *ptr, size_t n_bytes, bool allow_move); // Prevents a pointer from ever being freed because it establishes a permanent reference to it. Use diff --git a/py/gc_long_lived.c b/py/gc_long_lived.c deleted file mode 100644 index 6ceff0c1d4..0000000000 --- a/py/gc_long_lived.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries LLC - * - * 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/emitglue.h" -#include "py/gc_long_lived.h" -#include "py/gc.h" -#include "py/mpstate.h" - -mp_obj_fun_bc_t *make_fun_bc_long_lived(mp_obj_fun_bc_t *fun_bc, uint8_t max_depth) { - #ifndef MICROPY_ENABLE_GC - return fun_bc; - #endif - if (fun_bc == NULL || MP_OBJ_FROM_PTR(fun_bc) == mp_const_none || max_depth == 0) { - return fun_bc; - } - fun_bc->bytecode = gc_make_long_lived((byte *)fun_bc->bytecode); - fun_bc->context->module.globals = make_dict_long_lived(fun_bc->context->module.globals, max_depth - 1); - // for (uint32_t i = 0; i < gc_nbytes(fun_bc->const_table) / sizeof(mp_obj_t); i++) { - // // Skip things that aren't allocated on the heap (and hence have zero bytes.) - // if (gc_nbytes(MP_OBJ_TO_PTR(fun_bc->const_table[i])) == 0) { - // continue; - // } - // // Try to detect raw code. - // mp_raw_code_t *raw_code = MP_OBJ_TO_PTR(fun_bc->const_table[i]); - // if (raw_code->kind == MP_CODE_BYTECODE) { - // raw_code->fun_data = gc_make_long_lived((byte *)raw_code->fun_data); - // raw_code->const_table = gc_make_long_lived((byte *)raw_code->const_table); - // } - // ((mp_uint_t *)fun_bc->const_table)[i] = (mp_uint_t)make_obj_long_lived( - // (mp_obj_t)fun_bc->const_table[i], max_depth - 1); - - // } - // fun_bc->const_table = gc_make_long_lived((mp_uint_t *)fun_bc->const_table); - // // extra_args stores keyword only argument default values. - // size_t words = gc_nbytes(fun_bc) / sizeof(mp_uint_t *); - // // Functions (mp_obj_fun_bc_t) have four pointers (base, globals, bytecode and const_table) - // // before the variable length extra_args so remove them from the length. - // for (size_t i = 0; i < words - 4; i++) { - // if (MP_OBJ_TO_PTR(fun_bc->extra_args[i]) == NULL) { - // continue; - // } - // if (mp_obj_is_type(fun_bc->extra_args[i], &mp_type_dict)) { - // fun_bc->extra_args[i] = MP_OBJ_FROM_PTR(make_dict_long_lived(MP_OBJ_TO_PTR(fun_bc->extra_args[i]), max_depth - 1)); - // } else { - // fun_bc->extra_args[i] = make_obj_long_lived(fun_bc->extra_args[i], max_depth - 1); - // } - - // } - return gc_make_long_lived(fun_bc); -} - -mp_obj_property_t *make_property_long_lived(mp_obj_property_t *prop, uint8_t max_depth) { - #ifndef MICROPY_ENABLE_GC - return prop; - #endif - if (max_depth == 0) { - return prop; - } - prop->proxy[0] = make_obj_long_lived(prop->proxy[0], max_depth - 1); - prop->proxy[1] = make_obj_long_lived(prop->proxy[1], max_depth - 1); - prop->proxy[2] = make_obj_long_lived(prop->proxy[2], max_depth - 1); - return gc_make_long_lived(prop); -} - -mp_obj_dict_t *make_dict_long_lived(mp_obj_dict_t *dict, uint8_t max_depth) { - #ifndef MICROPY_ENABLE_GC - return dict; - #endif - if (dict == NULL || max_depth == 0 || dict == &MP_STATE_VM(dict_main) || dict->map.is_fixed) { - return dict; - } - // Don't recurse unnecessarily. Return immediately if we've already seen this dict. - if (dict->map.scanning) { - return dict; - } - // Mark that we're processing this dict. - dict->map.scanning = 1; - - // Update all of the references first so that we reduce the chance of references to the old - // copies. - dict->map.table = gc_make_long_lived(dict->map.table); - for (size_t i = 0; i < dict->map.alloc; i++) { - if (mp_map_slot_is_filled(&dict->map, i)) { - mp_obj_t value = dict->map.table[i].value; - dict->map.table[i].value = make_obj_long_lived(value, max_depth - 1); - } - } - dict = gc_make_long_lived(dict); - // Done recursing through this dict. - dict->map.scanning = 0; - return dict; -} - -mp_obj_str_t *make_str_long_lived(mp_obj_str_t *str) { - str->data = gc_make_long_lived((byte *)str->data); - return gc_make_long_lived(str); -} - -mp_obj_t make_obj_long_lived(mp_obj_t obj, uint8_t max_depth) { - #ifndef MICROPY_ENABLE_GC - return obj; - #endif - if (MP_OBJ_TO_PTR(obj) == NULL) { - return obj; - } - // If not in the GC pool, do nothing. This can happen (at least) when - // there are frozen mp_type_bytes objects in ROM. - if (!VERIFY_PTR((void *)obj)) { - return obj; - } - if (mp_obj_is_type(obj, &mp_type_fun_bc)) { - mp_obj_fun_bc_t *fun_bc = MP_OBJ_TO_PTR(obj); - return MP_OBJ_FROM_PTR(make_fun_bc_long_lived(fun_bc, max_depth)); - } else if (mp_obj_is_type(obj, &mp_type_property)) { - mp_obj_property_t *prop = MP_OBJ_TO_PTR(obj); - return MP_OBJ_FROM_PTR(make_property_long_lived(prop, max_depth)); - } else if (mp_obj_is_type(obj, &mp_type_str) || mp_obj_is_type(obj, &mp_type_bytes)) { - mp_obj_str_t *str = MP_OBJ_TO_PTR(obj); - return MP_OBJ_FROM_PTR(make_str_long_lived(str)); - } else if (mp_obj_is_type(obj, &mp_type_type)) { - // Types are already long lived during creation. - return obj; - } else { - return MP_OBJ_FROM_PTR(gc_make_long_lived(MP_OBJ_TO_PTR(obj))); - } -} diff --git a/py/gc_long_lived.h b/py/gc_long_lived.h deleted file mode 100644 index 229bc73911..0000000000 --- a/py/gc_long_lived.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2018 Scott Shawcroft for Adafruit Industries LLC - * - * 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. - */ - -// These helpers move MicroPython objects and their sub-objects to the long lived portion of the -// heap. - -#ifndef MICROPY_INCLUDED_PY_GC_LONG_LIVED_H -#define MICROPY_INCLUDED_PY_GC_LONG_LIVED_H - -#include "py/objfun.h" -#include "py/objproperty.h" -#include "py/objstr.h" - -mp_obj_fun_bc_t *make_fun_bc_long_lived(mp_obj_fun_bc_t *fun_bc, uint8_t max_depth); -mp_obj_property_t *make_property_long_lived(mp_obj_property_t *prop, uint8_t max_depth); -mp_obj_dict_t *make_dict_long_lived(mp_obj_dict_t *dict, uint8_t max_depth); -mp_obj_str_t *make_str_long_lived(mp_obj_str_t *str); -mp_obj_t make_obj_long_lived(mp_obj_t obj, uint8_t max_depth); - -#endif // MICROPY_INCLUDED_PY_GC_LONG_LIVED_H diff --git a/py/malloc.c b/py/malloc.c index c60a5a541b..efdff75396 100644 --- a/py/malloc.c +++ b/py/malloc.c @@ -56,8 +56,8 @@ #undef malloc #undef free #undef realloc -#define malloc_ll(b, ll) gc_alloc((b), false, (ll)) -#define malloc_with_finaliser(b, ll) gc_alloc((b), true, (ll)) +#define malloc(b) gc_alloc((b), false) +#define malloc_with_finaliser(b) gc_alloc((b), true) #define free gc_free #define realloc(ptr, n) gc_realloc(ptr, n, true) #define realloc_ext(ptr, n, mv) gc_realloc(ptr, n, mv) @@ -69,9 +69,6 @@ #error MICROPY_ENABLE_FINALISER requires MICROPY_ENABLE_GC #endif -#define malloc_ll(b, ll) malloc(b) -#define malloc_with_finaliser(b) malloc((b)) - STATIC void *realloc_ext(void *ptr, size_t n_bytes, bool allow_move) { if (allow_move) { return realloc(ptr, n_bytes); @@ -85,8 +82,8 @@ STATIC void *realloc_ext(void *ptr, size_t n_bytes, bool allow_move) { #endif // MICROPY_ENABLE_GC -void *m_malloc(size_t num_bytes, bool long_lived) { - void *ptr = malloc_ll(num_bytes, long_lived); +void *m_malloc(size_t num_bytes) { + void *ptr = malloc(num_bytes); if (ptr == NULL && num_bytes != 0) { m_malloc_fail(num_bytes); } @@ -99,8 +96,8 @@ void *m_malloc(size_t num_bytes, bool long_lived) { return ptr; } -void *m_malloc_maybe(size_t num_bytes, bool long_lived) { - void *ptr = malloc_ll(num_bytes, long_lived); +void *m_malloc_maybe(size_t num_bytes) { + void *ptr = malloc(num_bytes); #if MICROPY_MEM_STATS MP_STATE_MEM(total_bytes_allocated) += num_bytes; MP_STATE_MEM(current_bytes_allocated) += num_bytes; @@ -111,8 +108,8 @@ void *m_malloc_maybe(size_t num_bytes, bool long_lived) { } #if MICROPY_ENABLE_FINALISER -void *m_malloc_with_finaliser(size_t num_bytes, bool long_lived) { - void *ptr = malloc_with_finaliser(num_bytes, long_lived); +void *m_malloc_with_finaliser(size_t num_bytes) { + void *ptr = malloc_with_finaliser(num_bytes); if (ptr == NULL && num_bytes != 0) { m_malloc_fail(num_bytes); } @@ -126,8 +123,8 @@ void *m_malloc_with_finaliser(size_t num_bytes, bool long_lived) { } #endif -void *m_malloc0(size_t num_bytes, bool long_lived) { - void *ptr = m_malloc(num_bytes, long_lived); +void *m_malloc0(size_t num_bytes) { + void *ptr = m_malloc(num_bytes); // If this config is set then the GC clears all memory, so we don't need to. #if !MICROPY_GC_CONSERVATIVE_CLEAR memset(ptr, 0, num_bytes); @@ -136,10 +133,11 @@ void *m_malloc0(size_t num_bytes, bool long_lived) { } #if MICROPY_MALLOC_USES_ALLOCATED_SIZE -void *m_realloc(void *ptr, size_t old_num_bytes, size_t new_num_bytes) { +void *m_realloc(void *ptr, size_t old_num_bytes, size_t new_num_bytes) #else -void *m_realloc(void *ptr, size_t new_num_bytes) { - #endif +void *m_realloc(void *ptr, size_t new_num_bytes) +#endif +{ void *new_ptr = realloc(ptr, new_num_bytes); if (new_ptr == NULL && new_num_bytes != 0) { m_malloc_fail(new_num_bytes); @@ -164,10 +162,11 @@ void *m_realloc(void *ptr, size_t new_num_bytes) { } #if MICROPY_MALLOC_USES_ALLOCATED_SIZE -void *m_realloc_maybe(void *ptr, size_t old_num_bytes, size_t new_num_bytes, bool allow_move) { +void *m_realloc_maybe(void *ptr, size_t old_num_bytes, size_t new_num_bytes, bool allow_move) #else -void *m_realloc_maybe(void *ptr, size_t new_num_bytes, bool allow_move) { - #endif +void *m_realloc_maybe(void *ptr, size_t new_num_bytes, bool allow_move) +#endif +{ void *new_ptr = realloc_ext(ptr, new_num_bytes, allow_move); #if MICROPY_MEM_STATS // At first thought, "Total bytes allocated" should only grow, diff --git a/py/misc.h b/py/misc.h index d0e6c3c303..d6d0a12776 100644 --- a/py/misc.h +++ b/py/misc.h @@ -63,26 +63,19 @@ typedef unsigned int uint; // TODO make a lazy m_renew that can increase by a smaller amount than requested (but by at least 1 more element) -#define m_new(type, num) ((type *)(m_malloc(sizeof(type) * (num), false))) -#define m_new_ll(type, num) ((type *)(m_malloc(sizeof(type) * (num), true))) -#define m_new_maybe(type, num) ((type *)(m_malloc_maybe(sizeof(type) * (num), false))) -#define m_new_ll_maybe(type, num) ((type *)(m_malloc_maybe(sizeof(type) * (num), true))) -#define m_new0(type, num) ((type *)(m_malloc0(sizeof(type) * (num), false))) -#define m_new0_ll(type, num) ((type *)(m_malloc0(sizeof(type) * (num), true))) +#define m_new(type, num) ((type *)(m_malloc(sizeof(type) * (num)))) +#define m_new_maybe(type, num) ((type *)(m_malloc_maybe(sizeof(type) * (num)))) +#define m_new0(type, num) ((type *)(m_malloc0(sizeof(type) * (num)))) #define m_new_obj(type) (m_new(type, 1)) -#define m_new_ll_obj(type) (m_new_ll(type, 1)) #define m_new_obj_maybe(type) (m_new_maybe(type, 1)) -#define m_new_obj_var(obj_type, var_type, var_num) ((obj_type *)m_malloc(sizeof(obj_type) + sizeof(var_type) * (var_num), false)) -#define m_new_obj_var_maybe(obj_type, var_type, var_num) ((obj_type *)m_malloc_maybe(sizeof(obj_type) + sizeof(var_type) * (var_num), false)) -#define m_new_ll_obj_var_maybe(obj_type, var_type, var_num) ((obj_type *)m_malloc_maybe(sizeof(obj_type) + sizeof(var_type) * (var_num), true)) +#define m_new_obj_var(obj_type, var_type, var_num) ((obj_type *)m_malloc(sizeof(obj_type) + sizeof(var_type) * (var_num))) +#define m_new_obj_var_maybe(obj_type, var_type, var_num) ((obj_type *)m_malloc_maybe(sizeof(obj_type) + sizeof(var_type) * (var_num))) #if MICROPY_ENABLE_FINALISER -#define m_new_obj_with_finaliser(type) ((type *)(m_malloc_with_finaliser(sizeof(type), false))) -#define m_new_obj_var_with_finaliser(type, var_type, var_num) ((type *)m_malloc_with_finaliser(sizeof(type) + sizeof(var_type) * (var_num), false)) -#define m_new_ll_obj_with_finaliser(type) ((type *)(m_malloc_with_finaliser(sizeof(type), true))) +#define m_new_obj_with_finaliser(type) ((type *)(m_malloc_with_finaliser(sizeof(type)))) +#define m_new_obj_var_with_finaliser(type, var_type, var_num) ((type *)m_malloc_with_finaliser(sizeof(type) + sizeof(var_type) * (var_num))) #else #define m_new_obj_with_finaliser(type) m_new_obj(type) #define m_new_obj_var_with_finaliser(type, var_type, var_num) m_new_obj_var(type, var_type, var_num) -#define m_new_ll_obj_with_finaliser(type) m_new_ll_obj(type) #endif #if MICROPY_MALLOC_USES_ALLOCATED_SIZE #define m_renew(type, ptr, old_num, new_num) ((type *)(m_realloc((ptr), sizeof(type) * (old_num), sizeof(type) * (new_num)))) @@ -97,10 +90,10 @@ typedef unsigned int uint; #endif #define m_del_obj(type, ptr) (m_del(type, ptr, 1)) -void *m_malloc(size_t num_bytes, bool long_lived); -void *m_malloc_maybe(size_t num_bytes, bool long_lived); -void *m_malloc_with_finaliser(size_t num_bytes, bool long_lived); -void *m_malloc0(size_t num_bytes, bool long_lived); +void *m_malloc(size_t num_bytes); +void *m_malloc_maybe(size_t num_bytes); +void *m_malloc_with_finaliser(size_t num_bytes); +void *m_malloc0(size_t num_bytes); #if MICROPY_MALLOC_USES_ALLOCATED_SIZE void *m_realloc(void *ptr, size_t old_num_bytes, size_t new_num_bytes); void *m_realloc_maybe(void *ptr, size_t old_num_bytes, size_t new_num_bytes, bool allow_move); @@ -279,4 +272,66 @@ typedef union _mp_float_union_t { #endif // MICROPY_PY_BUILTINS_FLOAT +/** ROM string compression *************/ + +#if MICROPY_ROM_TEXT_COMPRESSION + +#if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NONE +#error "MICROPY_ERROR_REPORTING_NONE requires MICROPY_ROM_TEXT_COMPRESSION disabled" +#endif + +#ifdef NO_QSTR + +// Compression enabled but doing QSTR extraction. +// So leave MP_COMPRESSED_ROM_TEXT in place for makeqstrdefs.py / makecompresseddata.py to find them. + +#else + +// Compression enabled and doing a regular build. +// Map MP_COMPRESSED_ROM_TEXT to the compressed strings. + +// Force usage of the MP_ERROR_TEXT macro by requiring an opaque type. +typedef struct { + #ifdef __clang__ + // Fix "error: empty struct has size 0 in C, size 1 in C++". + char dummy; + #endif +} *mp_rom_error_text_t; + +#include + +inline __attribute__((always_inline)) const char *MP_COMPRESSED_ROM_TEXT(const char *msg) { + // "genhdr/compressed.data.h" contains an invocation of the MP_MATCH_COMPRESSED macro for each compressed string. + // The giant if(strcmp) tree is optimized by the compiler, which turns this into a direct return of the compressed data. + #define MP_MATCH_COMPRESSED(a, b) if (strcmp(msg, a) == 0) { return b; } else + + // It also contains a single invocation of the MP_COMPRESSED_DATA macro, we don't need that here. + #define MP_COMPRESSED_DATA(x) + + #include "genhdr/compressed.data.h" + +#undef MP_COMPRESSED_DATA +#undef MP_MATCH_COMPRESSED + + return msg; +} + +#endif + +#else + +// Compression not enabled, just make it a no-op. + +typedef const char *mp_rom_error_text_t; +#define MP_COMPRESSED_ROM_TEXT(x) x + +#endif // MICROPY_ROM_TEXT_COMPRESSION + +// Might add more types of compressed text in the future. +// For now, forward directly to MP_COMPRESSED_ROM_TEXT. +// CIRCUITPY: MP_ERROR_TEXT() -> translate() +#if !CIRCUITPY +#define MP_ERROR_TEXT(x) (mp_rom_error_text_t)MP_COMPRESSED_ROM_TEXT(x) +#endif + #endif // MICROPY_INCLUDED_PY_MISC_H diff --git a/py/mpconfig.h b/py/mpconfig.h index 957cbde2af..f38a4fc647 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -26,7 +26,7 @@ #ifndef MICROPY_INCLUDED_PY_MPCONFIG_H #define MICROPY_INCLUDED_PY_MPCONFIG_H -// In CircuitPython, this is defined in genghdr/mpversion.h +// In CircuitPython, this is defined in genhdr/mpversion.h #if !CIRCUITPY // Current version of MicroPython #define MICROPY_VERSION_MAJOR 1 @@ -201,12 +201,6 @@ #define MICROPY_ALLOC_QSTR_CHUNK_INIT (128) #endif -// Max number of entries in newly allocated QSTR pools. Smaller numbers may make QSTR lookups -// slightly slower but reduce the waste of unused spots. -#ifndef MICROPY_QSTR_POOL_MAX_ENTRIES -#define MICROPY_QSTR_POOL_MAX_ENTRIES (64) -#endif - // Initial amount for lexer indentation level #ifndef MICROPY_ALLOC_LEXER_INDENT_INIT #define MICROPY_ALLOC_LEXER_INDENT_INIT (10) @@ -319,14 +313,6 @@ #define alloca(x) m_malloc(x) #endif -// Number of atb indices to cache. Allocations of fewer blocks will be faster -// because the search will be accelerated by the index cache. This only applies -// to short lived allocations because we assume the long lived allocations are -// contiguous. -#ifndef MICROPY_ATB_INDICES -#define MICROPY_ATB_INDICES (8) -#endif - /*****************************************************************************/ /* MicroPython emitters */ @@ -384,11 +370,6 @@ #define MICROPY_EMIT_INLINE_THUMB (0) #endif -// Whether to enable ARMv7-M instruction support in the Thumb2 inline assembler -#ifndef MICROPY_EMIT_INLINE_THUMB_ARMV7M -#define MICROPY_EMIT_INLINE_THUMB_ARMV7M (1) -#endif - // Whether to enable float support in the Thumb2 inline assembler #ifndef MICROPY_EMIT_INLINE_THUMB_FLOAT #define MICROPY_EMIT_INLINE_THUMB_FLOAT (1) @@ -807,6 +788,7 @@ typedef long long mp_longint_impl_t; #define MICROPY_CPYTHON_EXCEPTION_CHAIN (0) #endif +// CIRCUITPY // Whether the statically allocated GeneratorExit exception may be const #ifndef MICROPY_CONST_GENERATOREXIT_OBJ #define MICROPY_CONST_GENERATOREXIT_OBJ (!MICROPY_CPYTHON_EXCEPTION_CHAIN) diff --git a/py/mpstate.h b/py/mpstate.h index da0fc00ec3..04c3530736 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -87,12 +87,10 @@ typedef struct _mp_state_mem_t { byte *gc_pool_start; byte *gc_pool_end; - void *gc_lowest_long_lived_ptr; - int gc_stack_overflow; MICROPY_GC_STACK_ENTRY_TYPE gc_stack[MICROPY_ALLOC_GC_STACK_SIZE]; - // This variable controls auto garbage collection. If set to false then the + // This variable controls auto garbage collection. If set to 0 then the // GC won't automatically run when gc_alloc can't find enough blocks. But // you can still allocate/free memory and also explicitly call gc_collect. uint16_t gc_auto_collect_enabled; @@ -102,7 +100,6 @@ typedef struct _mp_state_mem_t { size_t gc_alloc_threshold; #endif - size_t gc_first_free_atb_index[MICROPY_ATB_INDICES]; size_t gc_last_free_atb_index; #if MICROPY_PY_GC_COLLECT_RETVAL diff --git a/py/obj.c b/py/obj.c index 9e08e314a3..3911280686 100644 --- a/py/obj.c +++ b/py/obj.c @@ -45,7 +45,7 @@ // Allocates an object and also sets type, for mp_obj_malloc{,_var} macros. void *mp_obj_malloc_helper(size_t num_bytes, const mp_obj_type_t *type) { - mp_obj_base_t *base = (mp_obj_base_t *)m_malloc(num_bytes, false); + mp_obj_base_t *base = (mp_obj_base_t *)m_malloc(num_bytes); base->type = type; return base; } diff --git a/py/obj.h b/py/obj.h index 1e08d2f3b4..d733138bb0 100644 --- a/py/obj.h +++ b/py/obj.h @@ -439,7 +439,6 @@ typedef struct _mp_rom_obj_t { mp_const_obj_t o; } mp_rom_obj_t; // Declare a module as a builtin, processed by makemoduledefs.py // param module_name: MP_QSTR_ // param obj_module: mp_obj_module_t instance -// param enabled_define: used as `#if (enabled_define) around entry` #ifndef NO_QSTR #define MP_REGISTER_MODULE(module_name, obj_module) @@ -461,9 +460,7 @@ typedef struct _mp_map_t { size_t all_keys_are_qstrs : 1; size_t is_fixed : 1; // if set, table is fixed/read-only and can't be modified size_t is_ordered : 1; // if set, table is an ordered array, not a hash map - size_t scanning : 1; // true if we're in the middle of scanning linked dictionaries, - // e.g., make_dict_long_lived() - size_t used : (8 * sizeof(size_t) - 4); + size_t used : (8 * sizeof(size_t) - 3); size_t alloc; mp_map_elem_t *table; } mp_map_t; @@ -1098,7 +1095,6 @@ typedef struct _mp_obj_fun_builtin_var_t { } mp_obj_fun_builtin_var_t; qstr mp_obj_fun_get_name(mp_const_obj_t fun); -qstr mp_obj_code_get_name(const byte *code_info); mp_obj_t mp_identity(mp_obj_t self); MP_DECLARE_CONST_FUN_OBJ_1(mp_identity_obj); diff --git a/py/objfun.h b/py/objfun.h index 6baea818f4..9de15b8841 100644 --- a/py/objfun.h +++ b/py/objfun.h @@ -31,8 +31,7 @@ typedef struct _mp_obj_fun_bc_t { mp_obj_base_t base; - // CIRCUITPY - Long-lived conversions need to write into context, so un-const the field. - /*const*/ mp_module_context_t *context; // context within which this function was defined + const mp_module_context_t *context; // context within which this function was defined struct _mp_raw_code_t *const *child_table; // table of children const byte *bytecode; // bytecode for the function #if MICROPY_PY_SYS_SETTRACE diff --git a/py/objgenerator.c b/py/objgenerator.c index 325386a137..f92e0285a3 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -38,6 +38,7 @@ #include "supervisor/shared/translate/translate.h" // Instance of GeneratorExit exception - needed by generator.close() +// CIRCUITPY: https://github.com/adafruit/circuitpython/pull/7069 fix #if MICROPY_CONST_GENERATOREXIT_OBJ const mp_obj_exception_t mp_static_GeneratorExit_obj = {{&mp_type_GeneratorExit}, (mp_obj_tuple_t *)&mp_const_empty_tuple_obj, (mp_obj_traceback_t *)&mp_const_empty_traceback_obj}; @@ -49,12 +50,6 @@ mp_obj_exception_t mp_static_GeneratorExit_obj; /******************************************************************************/ /* generator wrapper */ -typedef struct _mp_obj_gen_wrap_t { - mp_obj_base_t base; - mp_obj_t *fun; - bool coroutine_generator; -} mp_obj_gen_wrap_t; - typedef struct _mp_obj_gen_instance_t { mp_obj_base_t base; // mp_const_none: Not-running, no exception. @@ -89,11 +84,13 @@ const mp_obj_type_t mp_type_gen_wrap = { { &mp_type_type }, .flags = MP_TYPE_FLAG_BINDS_SELF, .name = MP_QSTR_generator, - .call = gen_wrap_call, - .unary_op = mp_generic_unary_op, #if MICROPY_PY_FUNCTION_ATTRS .attr = mp_obj_fun_bc_attr, #endif + MP_TYPE_EXTENDED_FIELDS( + .call = gen_wrap_call, + .unary_op = mp_generic_unary_op, + ), }; /******************************************************************************/ @@ -150,53 +147,9 @@ STATIC mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_k return MP_OBJ_FROM_PTR(o); } -#endif // MICROPY_EMIT_NATIVE - -STATIC mp_obj_t bc_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) { - mp_obj_gen_wrap_t *self = MP_OBJ_TO_PTR(self_in); - mp_obj_fun_bc_t *self_fun = (mp_obj_fun_bc_t *)self->fun; - assert(self_fun->base.type == &mp_type_fun_bc); - - // bytecode prelude: get state size and exception stack size - const uint8_t *ip = self_fun->bytecode; - MP_BC_PRELUDE_SIG_DECODE(ip); - - // allocate the generator object, with room for local stack and exception stack - mp_obj_gen_instance_t *o = m_new_obj_var(mp_obj_gen_instance_t, byte, - n_state * sizeof(mp_obj_t) + n_exc_stack * sizeof(mp_exc_stack_t)); - o->base.type = &mp_type_gen_instance; - - o->coroutine_generator = self->coroutine_generator; - o->pend_exc = mp_const_none; - o->code_state.fun_bc = self_fun; - o->code_state.ip = 0; - o->code_state.n_state = n_state; - mp_setup_code_state(&o->code_state, n_args, n_kw, args); - return MP_OBJ_FROM_PTR(o); -} - -STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) { - #if MICROPY_EMIT_NATIVE - mp_obj_gen_wrap_t *self = MP_OBJ_TO_PTR(self_in); - mp_obj_fun_bc_t *self_fun = (mp_obj_fun_bc_t *)self->fun; - if (self_fun->base.type == &mp_type_fun_native) { - return native_gen_wrap_call(self, n_args, n_kw, args); - } - #endif - return bc_gen_wrap_call(self_in, n_args, n_kw, args); -} - -#if MICROPY_PY_FUNCTION_ATTRS -static void gen_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { - mp_obj_gen_wrap_t *self = MP_OBJ_TO_PTR(self_in); - mp_obj_fun_bc_t *self_fun = (mp_obj_fun_bc_t *)self->fun; - mp_obj_fun_bc_attr(MP_OBJ_FROM_PTR(self_fun), attr, dest); -} -#endif - -const mp_obj_type_t mp_type_gen_wrap = { +const mp_obj_type_t mp_type_native_gen_wrap = { { &mp_type_type }, - .flags = MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_EXTENDED, + .flags = MP_TYPE_FLAG_BINDS_SELF, .name = MP_QSTR_generator, #if MICROPY_PY_FUNCTION_ATTRS .attr = gen_attr, @@ -207,14 +160,7 @@ const mp_obj_type_t mp_type_gen_wrap = { ), }; - -mp_obj_t mp_obj_new_gen_wrap(mp_obj_t fun, bool is_coroutine) { - mp_obj_gen_wrap_t *o = m_new_obj(mp_obj_gen_wrap_t); - o->base.type = &mp_type_gen_wrap; - o->fun = MP_OBJ_TO_PTR(fun); - o->coroutine_generator = is_coroutine; - return MP_OBJ_FROM_PTR(o); -} +#endif // MICROPY_EMIT_NATIVE /******************************************************************************/ /* generator instance */ @@ -363,7 +309,6 @@ STATIC mp_obj_t gen_resume_and_raise(mp_obj_t self_in, mp_obj_t send_value, mp_o STATIC mp_obj_t gen_instance_iternext(mp_obj_t self_in) { #if MICROPY_PY_ASYNC_AWAIT - // This translate is literally too much for m0 boards mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in); if (self->coroutine_generator) { mp_raise_TypeError(MP_ERROR_TEXT("'coroutine' object is not an iterator")); diff --git a/py/objmodule.c b/py/objmodule.c index 965636eb5e..783d6b0508 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -108,7 +108,7 @@ STATIC void module_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { #if MICROPY_CAN_OVERRIDE_BUILTINS if (dict == &mp_module_builtins_globals) { if (MP_STATE_VM(mp_module_builtins_override_dict) == NULL) { - MP_STATE_VM(mp_module_builtins_override_dict) = gc_make_long_lived(MP_OBJ_TO_PTR(mp_obj_new_dict(1))); + MP_STATE_VM(mp_module_builtins_override_dict) = MP_OBJ_TO_PTR(mp_obj_new_dict(1)); } dict = MP_STATE_VM(mp_module_builtins_override_dict); } else diff --git a/py/objtype.c b/py/objtype.c index 30899c2324..0d25aac4e9 100644 --- a/py/objtype.c +++ b/py/objtype.c @@ -30,7 +30,6 @@ #include #include -#include "py/gc_long_lived.h" #include "py/objtype.h" #include "py/runtime.h" @@ -1202,7 +1201,7 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict) #endif } - mp_obj_full_type_t *o = m_new0_ll(mp_obj_full_type_t, 1); + mp_obj_full_type_t *o = m_new0(mp_obj_full_type_t, 1); o->base.type = &mp_type_type; o->flags = base_flags; o->name = name; @@ -1235,7 +1234,7 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict) } } - o->locals_dict = make_dict_long_lived(MP_OBJ_TO_PTR(locals_dict), 10); + o->locals_dict = MP_OBJ_TO_PTR(locals_dict); #if ENABLE_SPECIAL_ACCESSORS // Check if the class has any special accessor methods diff --git a/py/py.mk b/py/py.mk index 8a6b641ee7..44f34aad89 100644 --- a/py/py.mk +++ b/py/py.mk @@ -72,7 +72,6 @@ PY_CORE_O_BASENAME = $(addprefix py/,\ nlrsetjmp.o \ malloc.o \ gc.o \ - gc_long_lived.o \ pystack.o \ qstr.o \ vstr.o \ diff --git a/py/qstr.c b/py/qstr.c index ca8d8597c5..5ff8b3bd54 100644 --- a/py/qstr.c +++ b/py/qstr.c @@ -156,7 +156,7 @@ STATIC qstr qstr_add(mp_uint_t hash, mp_uint_t len, const char *q_ptr) { #endif mp_uint_t pool_size = sizeof(qstr_pool_t) + (sizeof(const char *) + sizeof(qstr_hash_t) + sizeof(qstr_len_t)) * new_alloc; - qstr_pool_t *pool = (qstr_pool_t *)m_malloc_maybe(pool_size, true); + qstr_pool_t *pool = (qstr_pool_t *)m_malloc_maybe(pool_size); if (pool == NULL) { // Keep qstr_last_chunk consistent with qstr_pool_t: qstr_last_chunk is not scanned // at garbage collection since it's reachable from a qstr_pool_t. And the caller of @@ -244,10 +244,10 @@ qstr qstr_from_strn(const char *str, size_t len) { if (al < MICROPY_ALLOC_QSTR_CHUNK_INIT) { al = MICROPY_ALLOC_QSTR_CHUNK_INIT; } - MP_STATE_VM(qstr_last_chunk) = m_new_ll_maybe(char, al); + MP_STATE_VM(qstr_last_chunk) = m_new_maybe(char, al); if (MP_STATE_VM(qstr_last_chunk) == NULL) { // failed to allocate a large chunk so try with exact size - MP_STATE_VM(qstr_last_chunk) = m_new_ll_maybe(char, n_bytes); + MP_STATE_VM(qstr_last_chunk) = m_new_maybe(char, n_bytes); if (MP_STATE_VM(qstr_last_chunk) == NULL) { QSTR_EXIT(); m_malloc_fail(n_bytes); diff --git a/py/ringbuf.c b/py/ringbuf.c index 5936b64230..fcab8c0caa 100644 --- a/py/ringbuf.c +++ b/py/ringbuf.c @@ -37,8 +37,8 @@ bool ringbuf_init(ringbuf_t *r, uint8_t *buf, size_t size) { } // Dynamic initialization. This should be accessible from a root pointer.. -bool ringbuf_alloc(ringbuf_t *r, size_t size, bool long_lived) { - bool result = ringbuf_init(r, gc_alloc(size, false, long_lived), size); +bool ringbuf_alloc(ringbuf_t *r, size_t size) { + bool result = ringbuf_init(r, gc_alloc(size, false), size); return result; } diff --git a/py/ringbuf.h b/py/ringbuf.h index 2725bedcca..b6863599cc 100644 --- a/py/ringbuf.h +++ b/py/ringbuf.h @@ -43,7 +43,7 @@ typedef struct _ringbuf_t { bool ringbuf_init(ringbuf_t *r, uint8_t *buf, size_t capacity); // For allocation of a buffer on the heap, use ringbuf_alloc(). -bool ringbuf_alloc(ringbuf_t *r, size_t capacity, bool long_lived); +bool ringbuf_alloc(ringbuf_t *r, size_t capacity); // Mark ringbuf as no longer in use, and allow any heap storage to be freed by gc. void ringbuf_deinit(ringbuf_t *r); diff --git a/shared-bindings/_pew/PewPew.c b/shared-bindings/_pew/PewPew.c index d9cc325a0a..229fb24381 100644 --- a/shared-bindings/_pew/PewPew.c +++ b/shared-bindings/_pew/PewPew.c @@ -111,7 +111,6 @@ STATIC mp_obj_t pewpew_make_new(const mp_obj_type_t *type, size_t n_args, size_t pew_obj_t *pew = MP_STATE_VM(pew_singleton); if (!pew) { pew = mp_obj_malloc(pew_obj_t, &pewpew_type); - pew = gc_make_long_lived(pew); MP_STATE_VM(pew_singleton) = pew; } diff --git a/shared-bindings/audiopwmio/PWMAudioOut.c b/shared-bindings/audiopwmio/PWMAudioOut.c index f05fbfdfe9..ce35374618 100644 --- a/shared-bindings/audiopwmio/PWMAudioOut.c +++ b/shared-bindings/audiopwmio/PWMAudioOut.c @@ -118,12 +118,9 @@ STATIC mp_obj_t audiopwmio_pwmaudioout_make_new(const mp_obj_type_t *type, size_ validate_obj_is_free_pin_or_none(args[ARG_right_channel].u_obj, MP_QSTR_right_channel); // create AudioOut object from the given pin - // The object is made long-lived because many implementations keep - // a pointer to the object (e.g., for the interrupt handler), which - // will not work properly if the object is moved. It is created - // with a finaliser as some ports use these (rather than 'reset' functions) + // The object is created with a finaliser as some ports use these (rather than 'reset' functions) // to ensure resources are collected at interpreter shutdown. - audiopwmio_pwmaudioout_obj_t *self = m_new_ll_obj_with_finaliser(audiopwmio_pwmaudioout_obj_t); + audiopwmio_pwmaudioout_obj_t *self = m_new_obj_with_finaliser(audiopwmio_pwmaudioout_obj_t); self->base.type = &audiopwmio_pwmaudioout_type; common_hal_audiopwmio_pwmaudioout_construct(self, left_channel_pin, right_channel_pin, args[ARG_quiescent_value].u_int); diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index a10dc8efad..009c5cf0f5 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -155,11 +155,7 @@ STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, si const bool rs485_invert = args[ARG_rs485_invert].u_bool; - // Always initially allocate the UART object within the long-lived heap. - // This is needed to avoid crashes with certain UART implementations which - // cannot accommodate being moved after creation. (See - // https://github.com/adafruit/circuitpython/issues/1056) - busio_uart_obj_t *self = m_new_ll_obj_with_finaliser(busio_uart_obj_t); + busio_uart_obj_t *self = m_new_obj_with_finaliser(busio_uart_obj_t); self->base.type = &busio_uart_type; common_hal_busio_uart_construct(self, tx, rx, rts, cts, rs485_dir, rs485_invert, diff --git a/shared-bindings/countio/Counter.c b/shared-bindings/countio/Counter.c index fc60994f5c..7f63057092 100644 --- a/shared-bindings/countio/Counter.c +++ b/shared-bindings/countio/Counter.c @@ -56,8 +56,7 @@ STATIC mp_obj_t countio_counter_make_new(const mp_obj_type_t *type, size_t n_arg const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj, MP_QSTR_pin); const countio_edge_t edge = validate_edge(args[ARG_edge].u_obj, MP_QSTR_edge); const digitalio_pull_t pull = validate_pull(args[ARG_pull].u_obj, MP_QSTR_pull); - // Make long-lived because some implementations use a pointer to the object as interrupt-handler data. - countio_counter_obj_t *self = m_new_ll_obj_with_finaliser(countio_counter_obj_t); + countio_counter_obj_t *self = m_new_obj_with_finaliser(countio_counter_obj_t); self->base.type = &countio_counter_type; common_hal_countio_counter_construct(self, pin, edge, pull); diff --git a/shared-bindings/pulseio/PulseIn.c b/shared-bindings/pulseio/PulseIn.c index 3510f11289..d738726f1c 100644 --- a/shared-bindings/pulseio/PulseIn.c +++ b/shared-bindings/pulseio/PulseIn.c @@ -88,8 +88,7 @@ STATIC mp_obj_t pulseio_pulsein_make_new(const mp_obj_type_t *type, size_t n_arg mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); const mcu_pin_obj_t *pin = validate_obj_is_free_pin(args[ARG_pin].u_obj, MP_QSTR_pin); - // Make object long-lived to avoid moving between imports - pulseio_pulsein_obj_t *self = m_new_ll_obj_with_finaliser(pulseio_pulsein_obj_t); + pulseio_pulsein_obj_t *self = m_new_obj_with_finaliser(pulseio_pulsein_obj_t); self->base.type = &pulseio_pulsein_type; common_hal_pulseio_pulsein_construct(self, pin, args[ARG_maxlen].u_int, diff --git a/shared-bindings/rotaryio/IncrementalEncoder.c b/shared-bindings/rotaryio/IncrementalEncoder.c index 6b671194f6..24df2b2d15 100644 --- a/shared-bindings/rotaryio/IncrementalEncoder.c +++ b/shared-bindings/rotaryio/IncrementalEncoder.c @@ -75,8 +75,7 @@ STATIC mp_obj_t rotaryio_incrementalencoder_make_new(const mp_obj_type_t *type, const mcu_pin_obj_t *pin_a = validate_obj_is_free_pin(args[ARG_pin_a].u_obj, MP_QSTR_pin_a); const mcu_pin_obj_t *pin_b = validate_obj_is_free_pin(args[ARG_pin_b].u_obj, MP_QSTR_pin_b); - // Make long-lived because some implementations use a pointer to the object as interrupt-handler data. - rotaryio_incrementalencoder_obj_t *self = m_new_ll_obj_with_finaliser(rotaryio_incrementalencoder_obj_t); + rotaryio_incrementalencoder_obj_t *self = m_new_obj_with_finaliser(rotaryio_incrementalencoder_obj_t); self->base.type = &rotaryio_incrementalencoder_type; common_hal_rotaryio_incrementalencoder_construct(self, pin_a, pin_b); diff --git a/shared-module/usb_hid/Device.c b/shared-module/usb_hid/Device.c index 6f530bfef8..8691794955 100644 --- a/shared-module/usb_hid/Device.c +++ b/shared-module/usb_hid/Device.c @@ -198,7 +198,7 @@ void common_hal_usb_hid_device_construct(usb_hid_device_obj_t *self, mp_obj_t re // Copy the raw descriptor bytes into a heap obj. We don't keep the Python descriptor object. - uint8_t *descriptor_bytes = gc_alloc(bufinfo.len, false, false); + uint8_t *descriptor_bytes = gc_alloc(bufinfo.len, false); memcpy(descriptor_bytes, bufinfo.buf, bufinfo.len); self->report_descriptor = descriptor_bytes; @@ -255,12 +255,12 @@ void usb_hid_device_create_report_buffers(usb_hid_device_obj_t *self) { // which is an unusual case. Normally we can just pass the data directly with tud_hid_report(). self->in_report_buffers[i] = self->in_report_lengths[i] > 0 - ? gc_alloc(self->in_report_lengths[i], false, true /*long-lived*/) + ? gc_alloc(self->in_report_lengths[i], false) : NULL; self->out_report_buffers[i] = self->out_report_lengths[i] > 0 - ? gc_alloc(self->out_report_lengths[i], false, true /*long-lived*/) + ? gc_alloc(self->out_report_lengths[i], false) : NULL; } memset(self->out_report_buffers_updated, 0, sizeof(self->out_report_buffers_updated)); diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c index c858f63193..4f00207b7f 100644 --- a/shared/runtime/pyexec.c +++ b/shared/runtime/pyexec.c @@ -33,7 +33,6 @@ #include "py/runtime.h" #include "py/repl.h" #include "py/gc.h" -#include "py/gc_long_lived.h" #include "py/frozenmod.h" #include "py/mphal.h" #if MICROPY_HW_ENABLE_USB @@ -98,28 +97,34 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input ctx->module.globals = mp_globals_get(); ctx->constants = frozen->constants; module_fun = mp_make_function_from_raw_code(frozen->rc, ctx, NULL); - } else - #endif - { - #if MICROPY_ENABLE_COMPILER - mp_lexer_t *lex; - if (exec_flags & EXEC_FLAG_SOURCE_IS_VSTR) { - const vstr_t *vstr = source; - lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, vstr->buf, vstr->len, 0); - } else if (exec_flags & EXEC_FLAG_SOURCE_IS_READER) { - lex = mp_lexer_new(MP_QSTR__lt_stdin_gt_, *(mp_reader_t *)source); - } else if (exec_flags & EXEC_FLAG_SOURCE_IS_FILENAME) { - lex = mp_lexer_new_from_file(source); - } else { - lex = (mp_lexer_t *)source; - } - // source is a lexer, parse and compile the script - qstr source_name = lex->source_name; - mp_parse_tree_t parse_tree = mp_parse(lex, input_kind); - module_fun = mp_compile(&parse_tree, source_name, exec_flags & EXEC_FLAG_IS_REPL); - #else - mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("script compilation not supported")); + } else #endif + { + #if MICROPY_ENABLE_COMPILER + mp_lexer_t *lex; + if (exec_flags & EXEC_FLAG_SOURCE_IS_VSTR) { + const vstr_t *vstr = source; + lex = mp_lexer_new_from_str_len(MP_QSTR__lt_stdin_gt_, vstr->buf, vstr->len, 0); + } else if (exec_flags & EXEC_FLAG_SOURCE_IS_READER) { + lex = mp_lexer_new(MP_QSTR__lt_stdin_gt_, *(mp_reader_t *)source); + } else if (exec_flags & EXEC_FLAG_SOURCE_IS_FILENAME) { + lex = mp_lexer_new_from_file(source); + } else { + lex = (mp_lexer_t *)source; + } + // source is a lexer, parse and compile the script + qstr source_name = lex->source_name; + mp_parse_tree_t parse_tree = mp_parse(lex, input_kind); + module_fun = mp_compile(&parse_tree, source_name, exec_flags & EXEC_FLAG_IS_REPL); + #else + mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("script compilation not supported")); + #endif + } + + // If the code was loaded from a file, collect any garbage before running. + if (input_kind == MP_PARSE_FILE_INPUT) { + gc_collect(); + } } // execute code diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c index ec0b27a9a6..7420b2b0b8 100644 --- a/supervisor/shared/memory.c +++ b/supervisor/shared/memory.c @@ -212,7 +212,7 @@ static supervisor_allocation_node *allocate_memory_node(uint32_t length, bool hi if (!node) { // 4. GC allocation? if (movable && gc_alloc_possible()) { - node = m_malloc_maybe(sizeof(supervisor_allocation_node) + length, true); + node = m_malloc_maybe(sizeof(supervisor_allocation_node) + length); if (node) { node->next = MP_STATE_VM(first_embedded_allocation); MP_STATE_VM(first_embedded_allocation) = node; diff --git a/tools/analyze_heap_dump.py b/tools/analyze_heap_dump.py index ede990929d..18da11c456 100755 --- a/tools/analyze_heap_dump.py +++ b/tools/analyze_heap_dump.py @@ -288,10 +288,6 @@ def do_all_the_things( dynamic_type = 0x40000000 # placeholder, doesn't match any memory - long_lived_start = load_pointer( - mp_state_ctx + 272 - ) # (gdb) p &mp_state_ctx.mem.gc_lowest_long_lived_ptr - type_colors = { dict_type: "red", property_type: "yellow", @@ -368,10 +364,7 @@ def do_all_the_things( potential_type = None node = ownership_graph.get_node(address) node.attr["height"] = 0.25 * current_allocation - if address >= long_lived_start: - node.attr["fontcolor"] = "hotpink" - else: - node.attr["fontcolor"] = "black" + node.attr["fontcolor"] = "black" block_data[address] = data for k in range(len(data) // 4): word = struct.unpack_from("".join(wrapped) ) node.attr["fontname"] = "FiraCode-Bold" - if block >= long_lived_start: - node.attr["fontcolor"] = "hotpink" - else: - node.attr["fontcolor"] = "black" + node.attr["fontcolor"] = "black" node.attr["fontpath"] = "/Users/tannewt/Library/Fonts/" node.attr["fontsize"] = 8 From 78d1ebb52972e6e9d94cfc46ea88078239bc06ec Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 8 Aug 2023 18:33:09 -0700 Subject: [PATCH 1447/1712] Fix calculations --- shared-module/bitmaptools/__init__.c | 46 ++++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index ecfe10c01c..eebb7f7c24 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -881,17 +881,17 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma blend_source2 = skip_source2_index_none || *sptr2 != (uint8_t)skip_source2_index; if (blend_source1 && blend_source2) { // Premultiply by the alpha factor - int sca1 = *sptr1++ *ifactor1; - int sca2 = *sptr2++ *ifactor2; + int sda = *sptr1++ *ifactor1; + int sca = *sptr2++ *ifactor2; // Blend int blend; if (blendmode == BITMAPTOOLS_BLENDMODE_SCREEN) { - blend = sca2 + sca1 - sca2 * sca1; + blend = sca + sda - (sca * sda / 65536); } else { - blend = sca2 + sca1 * (256 - ifactor2); + blend = sca + sda * (256 - ifactor2) / 256; } // Divide by the alpha factor - pixel = (blend / (256 * ifactor1 + 256 * ifactor2 - ifactor1 * ifactor2)); + pixel = (blend / (ifactor1 + ifactor2 - ifactor1 * ifactor2 / 256)); } else if (blend_source1) { // Apply iFactor1 to source1 only pixel = *sptr1++ *ifactor1 / 256; @@ -934,31 +934,31 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma int ifactor_blend = ifactor1 + ifactor2 - ifactor1 * ifactor2 / 256; // Premultiply the colors by the alpha factor - int red_sca1 = ((spix1 & r_mask) >> 11) * ifactor1; - int green_sca1 = ((spix1 & g_mask) >> 5) * ifactor1; - int blue_sca1 = (spix1 & b_mask) * ifactor1; + int red_dca = ((spix1 & r_mask) >> 8) * ifactor1; + int grn_dca = ((spix1 & g_mask) >> 3) * ifactor1; + int blu_dca = ((spix1 & b_mask) << 3) * ifactor1; - int red_sca2 = ((spix2 & r_mask) >> 11) * ifactor2; - int green_sca2 = ((spix2 & g_mask) >> 5) * ifactor2; - int blue_sca2 = (spix2 & b_mask) * ifactor2; + int red_sca = ((spix2 & r_mask) >> 8) * ifactor2; + int grn_sca = ((spix2 & g_mask) >> 3) * ifactor2; + int blu_sca = ((spix2 & b_mask) << 3) * ifactor2; - int red_blend, green_blend, blue_blend; + int red_blend, grn_blend, blu_blend; if (blendmode == BITMAPTOOLS_BLENDMODE_SCREEN) { - // Perform a screen blend - red_blend = red_sca2 + red_sca1 - (red_sca2 * red_sca1); - green_blend = green_sca2 + green_sca1 - (green_sca2 * green_sca1); - blue_blend = blue_sca2 + blue_sca1 - (blue_sca2 * blue_sca1); + // Perform a screen blend Sca + Dca - Sca × Dca + red_blend = red_sca + red_dca - (red_sca * red_dca / 65536); + grn_blend = grn_sca + grn_dca - (grn_sca * grn_dca / 65536); + blu_blend = blu_sca + blu_dca - (blu_sca * blu_dca / 65536); } else { - // Perform a normal blend - red_blend = red_sca2 + red_sca1 * (256 - ifactor2) / 256; - green_blend = green_sca2 + green_sca1 * (256 - ifactor2) / 256; - blue_blend = blue_sca2 + blue_sca1 * (256 - ifactor2) / 256; + // Perform a normal (src-over) blend + red_blend = red_sca + red_dca * (256 - ifactor2) / 256; + grn_blend = grn_sca + grn_dca * (256 - ifactor2) / 256; + blu_blend = blu_sca + blu_dca * (256 - ifactor2) / 256; } // Divide by the alpha factor - int r = ((red_blend / ifactor_blend) << 11) & r_mask; - int g = ((green_blend / ifactor_blend) << 5) & g_mask; - int b = (blue_blend / ifactor_blend) & b_mask; + int r = ((red_blend / ifactor_blend) << 8) & r_mask; + int g = ((grn_blend / ifactor_blend) << 3) & g_mask; + int b = ((blu_blend / ifactor_blend) >> 3) & b_mask; // Clamp to the appropriate range r = MIN(r_mask, MAX(0, r)) & r_mask; From 3c66a55341fdb152b4031429482baa444871abaf Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 2 Aug 2023 12:06:47 +0800 Subject: [PATCH 1448/1712] raspberrypi: Allow build without audio Signed-off-by: Daniel Schaefer --- ports/raspberrypi/supervisor/internal_flash.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/raspberrypi/supervisor/internal_flash.c b/ports/raspberrypi/supervisor/internal_flash.c index 42223b29e3..f5dff80d72 100644 --- a/ports/raspberrypi/supervisor/internal_flash.c +++ b/ports/raspberrypi/supervisor/internal_flash.c @@ -99,11 +99,15 @@ void port_internal_flash_flush(void) { // Make sure we don't have an interrupt while we do flash operations. common_hal_mcu_disable_interrupts(); // and audio DMA must be paused as well + #if CIRCUITPY_AUDIOCORE uint32_t channel_mask = audio_dma_pause_all(); + #endif flash_range_erase(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, SECTOR_SIZE); flash_range_program(CIRCUITPY_CIRCUITPY_DRIVE_START_ADDR + _cache_lba, _cache, SECTOR_SIZE); _cache_lba = NO_CACHE; + #if CIRCUITPY_AUDIOCORE audio_dma_unpause_mask(channel_mask); + #endif common_hal_mcu_enable_interrupts(); } From 7a4edfaa9f790b0256eb706bb6e4a22e94dacbee Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 9 Aug 2023 08:19:34 -0700 Subject: [PATCH 1449/1712] Override D13 pin --- ports/espressif/boards/arduino_nano_esp32s3/board.c | 11 +++++++++++ .../arduino_nano_esp32s3_inverted_statusled/board.c | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/ports/espressif/boards/arduino_nano_esp32s3/board.c b/ports/espressif/boards/arduino_nano_esp32s3/board.c index 3b1f5efd87..0fc5bd1426 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3/board.c +++ b/ports/espressif/boards/arduino_nano_esp32s3/board.c @@ -27,6 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" void board_init(void) { // Debug UART @@ -36,4 +37,14 @@ void board_init(void) { #endif } +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + if (pin_number == 13) { + // Set D13 LED to output by default. + gpio_set_direction(pin_number, GPIO_MODE_DEF_OUTPUT); + return true; + } + + return false; +} + // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c index 3b1f5efd87..0fc5bd1426 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c @@ -27,6 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" void board_init(void) { // Debug UART @@ -36,4 +37,14 @@ void board_init(void) { #endif } +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + if (pin_number == 13) { + // Set D13 LED to output by default. + gpio_set_direction(pin_number, GPIO_MODE_DEF_OUTPUT); + return true; + } + + return false; +} + // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. From db23a9c9fe7198e207f6e262c6bb367b48f2934c Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Wed, 9 Aug 2023 09:15:17 -0700 Subject: [PATCH 1450/1712] Disable floppyio for feather m4 express + update docstring --- ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk | 1 + shared-bindings/bitmaptools/__init__.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk index c763fa44d5..d24e4c0deb 100644 --- a/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m4_express/mpconfigboard.mk @@ -11,6 +11,7 @@ EXTERNAL_FLASH_DEVICES = GD25Q16C LONGINT_IMPL = MPZ CIRCUITPY__EVE = 1 +CIRCUITPY_FLOPPYIO = 0 CIRCUITPY_SYNTHIO = 0 # We don't have room for the fonts for terminalio for certain languages, diff --git a/shared-bindings/bitmaptools/__init__.c b/shared-bindings/bitmaptools/__init__.c index c828e8e250..befa1b298e 100644 --- a/shared-bindings/bitmaptools/__init__.c +++ b/shared-bindings/bitmaptools/__init__.c @@ -320,8 +320,8 @@ MAKE_ENUM_TYPE(bitmaptools, BlendMode, bitmaptools_blendmode); //| :param float factor2: The proportion of bitmap 2 to mix in. If specified as `None`, ``1-factor1`` is used. Usually the proportions should sum to 1. //| :param displayio.Colorspace colorspace: The colorspace of the bitmaps. They must all have the same colorspace. Only the following colorspaces are permitted: ``L8``, ``RGB565``, ``RGB565_SWAPPED``, ``BGR565`` and ``BGR565_SWAPPED``. //| :param bitmaptools.BlendMode blendmode: The blend mode to use. Default is Normal. -//| :param int skip_source1_index: bitmap palette index in source_bitmap_1 that will not be blended, set to None to blend all pixels -//| :param int skip_source2_index: bitmap palette index in source_bitmap_2 that will not be blended, set to None to blend all pixels +//| :param int skip_source1_index: Bitmap palette or luminance index in source_bitmap_1 that will not be blended, set to None to blend all pixels +//| :param int skip_source2_index: Bitmap palette or luminance index in source_bitmap_2 that will not be blended, set to None to blend all pixels //| //| For the L8 colorspace, the bitmaps must have a bits-per-value of 8. //| For the RGB colorspaces, they must have a bits-per-value of 16.""" From 6cbbebbfb1f7daf88940ce7bdc49d4ebb89da943 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 9 Aug 2023 19:44:11 +0200 Subject: [PATCH 1451/1712] 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 | 57 +++++++---------- locale/cs.po | 57 +++++++---------- locale/de_DE.po | 115 +++++++++++++++++++++------------ locale/el.po | 57 +++++++---------- locale/en_GB.po | 115 +++++++++++++++++++++------------ locale/es.po | 130 +++++++++++++++++++++++-------------- locale/fil.po | 57 +++++++---------- locale/fr.po | 132 ++++++++++++++++++++++++-------------- locale/hi.po | 57 +++++++---------- locale/it_IT.po | 57 +++++++---------- locale/ja.po | 57 +++++++---------- locale/ko.po | 57 +++++++---------- locale/nl.po | 57 +++++++---------- locale/pl.po | 57 +++++++---------- locale/pt_BR.po | 115 +++++++++++++++++++++------------ locale/ru.po | 135 ++++++++++++++++++++++++--------------- locale/sv.po | 115 +++++++++++++++++++++------------ locale/tr.po | 73 +++++++++++---------- locale/zh_Latn_pinyin.po | 125 +++++++++++++++++++++++------------- 19 files changed, 895 insertions(+), 730 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 2ca87027c2..efbdd10479 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -254,6 +254,22 @@ msgstr "%q, %q, dan %q semuanya harus memiliki panjang yang sama" msgid "%q=%q" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1173,26 +1189,6 @@ msgstr "" msgid "Input/output error" msgstr "Kesalahan input/output" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Otentikasi tidak cukup" @@ -1364,38 +1360,31 @@ msgid "Mismatched swap flag" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c diff --git a/locale/cs.po b/locale/cs.po index 04bf2aecc2..62e9fd389e 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -255,6 +255,22 @@ msgstr "%q, %q, a %q musí mít všechny shodnou délku" msgid "%q=%q" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1173,26 +1189,6 @@ msgstr "Vstup trval příliš dlouho" msgid "Input/output error" msgstr "Vstupně/výstupní chyba" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Nedostatečná autentizace" @@ -1364,38 +1360,31 @@ msgid "Mismatched swap flag" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c diff --git a/locale/de_DE.po b/locale/de_DE.po index 70e0182b57..d30229687e 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -265,6 +265,22 @@ msgstr "%q, %q und %q müssen alle die gleiche Länge haben" msgid "%q=%q" msgstr "%q=%q" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1197,26 +1213,6 @@ msgstr "Input benötigt zu lange" msgid "Input/output error" msgstr "Eingabe-/Ausgabefehler" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "Anweisung %d verschiebt mehr Bits als die Anzahl der Pins" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "Der Befehl %d verschiebt mehr Bits als die Anzahl der Pins" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "Instruktion %d benötigt extra Pin" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "Anweisung %d wartet auf Eingaben außerhalb der vorhandenen Anzahl" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Unzureichende Authentifizierung" @@ -1389,39 +1385,32 @@ msgid "Mismatched swap flag" msgstr "Nicht übereinstimmendes Swap-Flag" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" -msgstr "Fehlender first_in_pin. Instruktion %d liest Pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" -msgstr "Fehlende first_in_pin. Anweisung %d verschiebt sich um Pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" -msgstr "Fehlende first_in_pin. Anweisung %d wartet basierend auf Pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" -msgstr "First_out_pin fehlt. Befehl %d verschiebt sich zu Pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" -msgstr "Fehlender first_out_pin. Instruktion %d schreibt Pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" -msgstr "Fehlender first_set_pin. Instruktion %d setzt Pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" -msgstr "jmp_pin fehlt. Befehl %d springt auf Pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" +msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -4471,6 +4460,50 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#, c-format +#~ msgid "Instruction %d shifts in more bits than pin count" +#~ msgstr "Anweisung %d verschiebt mehr Bits als die Anzahl der Pins" + +#, c-format +#~ msgid "Instruction %d shifts out more bits than pin count" +#~ msgstr "Der Befehl %d verschiebt mehr Bits als die Anzahl der Pins" + +#, c-format +#~ msgid "Instruction %d uses extra pin" +#~ msgstr "Instruktion %d benötigt extra Pin" + +#, c-format +#~ msgid "Instruction %d waits on input outside of count" +#~ msgstr "Anweisung %d wartet auf Eingaben außerhalb der vorhandenen Anzahl" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d reads pin(s)" +#~ msgstr "Fehlender first_in_pin. Instruktion %d liest Pin(s)" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +#~ msgstr "Fehlende first_in_pin. Anweisung %d verschiebt sich um Pin(s)" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d waits based on pin" +#~ msgstr "Fehlende first_in_pin. Anweisung %d wartet basierend auf Pin" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +#~ msgstr "First_out_pin fehlt. Befehl %d verschiebt sich zu Pin(s)" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d writes pin(s)" +#~ msgstr "Fehlender first_out_pin. Instruktion %d schreibt Pin(s)" + +#, c-format +#~ msgid "Missing first_set_pin. Instruction %d sets pin(s)" +#~ msgstr "Fehlender first_set_pin. Instruktion %d setzt Pin(s)" + +#, c-format +#~ msgid "Missing jmp_pin. Instruction %d jumps on pin" +#~ msgstr "jmp_pin fehlt. Befehl %d springt auf Pin" + #~ msgid "inputs are not iterable" #~ msgstr "Eingaben sind nicht iterierbar" diff --git a/locale/el.po b/locale/el.po index 44e8de1d4c..1c4eca2c6d 100644 --- a/locale/el.po +++ b/locale/el.po @@ -266,6 +266,22 @@ msgstr "%q, %q, και %q πρέπει να είναι όλα του ιδίου msgid "%q=%q" msgstr "%q=%q" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1188,26 +1204,6 @@ msgstr "" msgid "Input/output error" msgstr "" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "" @@ -1379,38 +1375,31 @@ msgid "Mismatched swap flag" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c diff --git a/locale/en_GB.po b/locale/en_GB.po index 0971690f8d..085c7e7b47 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -264,6 +264,22 @@ msgstr "%q, %q, and %q must all be the same length" msgid "%q=%q" msgstr "%q=%q" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1182,26 +1198,6 @@ msgstr "Input taking too long" msgid "Input/output error" msgstr "Input/output error" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "Instruction %d shifts in more bits than pin count" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "Instruction %d shifts out more bits than pin count" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "Instruction %d uses extra pin" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "Instruction %d waits on input outside of count" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Insufficient authentication" @@ -1373,39 +1369,32 @@ msgid "Mismatched swap flag" msgstr "Mismatched swap flag" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" -msgstr "Missing first_in_pin. Instruction %d reads pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" -msgstr "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" -msgstr "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" -msgstr "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" -msgstr "Missing first_out_pin. Instruction %d writes pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" -msgstr "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" -msgstr "Missing jmp_pin. Instruction %d jumps on pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" +msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -4412,6 +4401,50 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#, c-format +#~ msgid "Instruction %d shifts in more bits than pin count" +#~ msgstr "Instruction %d shifts in more bits than pin count" + +#, c-format +#~ msgid "Instruction %d shifts out more bits than pin count" +#~ msgstr "Instruction %d shifts out more bits than pin count" + +#, c-format +#~ msgid "Instruction %d uses extra pin" +#~ msgstr "Instruction %d uses extra pin" + +#, c-format +#~ msgid "Instruction %d waits on input outside of count" +#~ msgstr "Instruction %d waits on input outside of count" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d reads pin(s)" +#~ msgstr "Missing first_in_pin. Instruction %d reads pin(s)" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +#~ msgstr "Missing first_in_pin. Instruction %d shifts in from pin(s)" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d waits based on pin" +#~ msgstr "Missing first_in_pin. Instruction %d waits based on pin" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +#~ msgstr "Missing first_out_pin. Instruction %d shifts out to pin(s)" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d writes pin(s)" +#~ msgstr "Missing first_out_pin. Instruction %d writes pin(s)" + +#, c-format +#~ msgid "Missing first_set_pin. Instruction %d sets pin(s)" +#~ msgstr "Missing first_set_pin. Instruction %d sets pin(s)" + +#, c-format +#~ msgid "Missing jmp_pin. Instruction %d jumps on pin" +#~ msgstr "Missing jmp_pin. Instruction %d jumps on pin" + #~ msgid "inputs are not iterable" #~ msgstr "inputs are not iterable" diff --git a/locale/es.po b/locale/es.po index 242242bbeb..f7211f8926 100644 --- a/locale/es.po +++ b/locale/es.po @@ -266,6 +266,22 @@ msgstr "%q, %q, y %q deben tener la misma longitud" msgid "%q=%q" msgstr "%q=%q" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1206,26 +1222,6 @@ msgstr "La entrada está durando mucho tiempo" msgid "Input/output error" msgstr "error Input/output" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "La instruccion %d mueve mas bits que la cuenta del pin" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "La instrucción %d mueve mas bits que la cuenta del pin" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "La instrucción %d usa un pin extra" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "La instrucción %d espera una entrada fuera del conteo" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Autenticación insuficiente" @@ -1397,43 +1393,32 @@ msgid "Mismatched swap flag" msgstr "Inconsistencia en el flag de recambio" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" -msgstr "first-in-pin no encontrado. La instrucción %d lee el/los pin(es)" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" -msgstr "first_in_pin no encontrado. La instrucción %d desplaza de los pin(es)" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" -"first_in_pin no encontrado. La instrucción %d espera basada en este pin" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" -"first_in_pin no encontrado. La instrucción %d mueve hacia afuera hacia el/" -"los pin(es)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" -msgstr "first_in_pin no encontrado. La instrucción %d escribe pin(es)" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_in_pin. %q[%u] waits based on pin" msgstr "" -"first_set_pin no encontrado. La instrucción %d configura el/los pin(es)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" -msgstr "Falta el jmp_pin. La instrucción %d se dispara en el pin" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Missing first_out_pin. %q[%u] writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Missing first_set_pin. %q[%u] sets pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Missing jmp_pin. %q[%u] jumps on pin" +msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -4468,6 +4453,55 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#, c-format +#~ msgid "Instruction %d shifts in more bits than pin count" +#~ msgstr "La instruccion %d mueve mas bits que la cuenta del pin" + +#, c-format +#~ msgid "Instruction %d shifts out more bits than pin count" +#~ msgstr "La instrucción %d mueve mas bits que la cuenta del pin" + +#, c-format +#~ msgid "Instruction %d uses extra pin" +#~ msgstr "La instrucción %d usa un pin extra" + +#, c-format +#~ msgid "Instruction %d waits on input outside of count" +#~ msgstr "La instrucción %d espera una entrada fuera del conteo" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d reads pin(s)" +#~ msgstr "first-in-pin no encontrado. La instrucción %d lee el/los pin(es)" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +#~ msgstr "" +#~ "first_in_pin no encontrado. La instrucción %d desplaza de los pin(es)" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d waits based on pin" +#~ msgstr "" +#~ "first_in_pin no encontrado. La instrucción %d espera basada en este pin" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +#~ msgstr "" +#~ "first_in_pin no encontrado. La instrucción %d mueve hacia afuera hacia el/" +#~ "los pin(es)" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d writes pin(s)" +#~ msgstr "first_in_pin no encontrado. La instrucción %d escribe pin(es)" + +#, c-format +#~ msgid "Missing first_set_pin. Instruction %d sets pin(s)" +#~ msgstr "" +#~ "first_set_pin no encontrado. La instrucción %d configura el/los pin(es)" + +#, c-format +#~ msgid "Missing jmp_pin. Instruction %d jumps on pin" +#~ msgstr "Falta el jmp_pin. La instrucción %d se dispara en el pin" + #~ msgid "inputs are not iterable" #~ msgstr "Entradas no son iterables" diff --git a/locale/fil.po b/locale/fil.po index 2d84f82afc..51dc2ab776 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -253,6 +253,22 @@ msgstr "" msgid "%q=%q" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1173,26 +1189,6 @@ msgstr "" msgid "Input/output error" msgstr "May mali sa Input/Output" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "" @@ -1364,38 +1360,31 @@ msgid "Mismatched swap flag" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c diff --git a/locale/fr.po b/locale/fr.po index 83cca9f61c..da50428ded 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -266,6 +266,22 @@ msgstr "%q, %q, et %q doivent tous être de la même longueur" msgid "%q=%q" msgstr "%q=%q" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1211,30 +1227,6 @@ msgstr "L'entrée prend trop de temps" msgid "Input/output error" msgstr "Erreur d'entrée/sortie" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "" -"Instruction %d décale vers l'intérieur de plus de bits que le nombre de " -"broches" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "" -"instruction %d décale vers l'extérieur de plus de bits que le nombre de " -"broches" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "instruction %d utilise des broches supplémentaires" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "instruction %d attend sur une entrée hors du compte" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Authentification insuffisante" @@ -1408,41 +1400,32 @@ msgid "Mismatched swap flag" msgstr "Le drapeau d'échange ne correspond pas" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" -msgstr "first_in_pin manquant. Instruction %d lit une/des broche(s)" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" -"first_in_pin manquant. Instruction %d est déplacée par la/les broche(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" -msgstr "first_in_pin manquant. L'instruction %d attends dépends de la broche" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" -"first_out_pin manquant. Instruction %d est déplacée par la/les broche(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" -msgstr "first_out_pin manquant. Instruction %d écrit un/des broche(s)" +msgid "Missing first_in_pin. %q[%u] waits based on pin" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" -msgstr "first_set_pin manquant. L'instruction %d règle la/les broche(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" -msgstr "jmp_pin manquant. L'instruction %d va passer à la broche" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Missing first_set_pin. %q[%u] sets pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Missing jmp_pin. %q[%u] jumps on pin" +msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -4490,6 +4473,57 @@ 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)" +#, c-format +#~ msgid "Instruction %d shifts in more bits than pin count" +#~ msgstr "" +#~ "Instruction %d décale vers l'intérieur de plus de bits que le nombre de " +#~ "broches" + +#, c-format +#~ msgid "Instruction %d shifts out more bits than pin count" +#~ msgstr "" +#~ "instruction %d décale vers l'extérieur de plus de bits que le nombre de " +#~ "broches" + +#, c-format +#~ msgid "Instruction %d uses extra pin" +#~ msgstr "instruction %d utilise des broches supplémentaires" + +#, c-format +#~ msgid "Instruction %d waits on input outside of count" +#~ msgstr "instruction %d attend sur une entrée hors du compte" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d reads pin(s)" +#~ msgstr "first_in_pin manquant. Instruction %d lit une/des broche(s)" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +#~ msgstr "" +#~ "first_in_pin manquant. Instruction %d est déplacée par la/les broche(s)" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d waits based on pin" +#~ msgstr "" +#~ "first_in_pin manquant. L'instruction %d attends dépends de la broche" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +#~ msgstr "" +#~ "first_out_pin manquant. Instruction %d est déplacée par la/les broche(s)" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d writes pin(s)" +#~ msgstr "first_out_pin manquant. Instruction %d écrit un/des broche(s)" + +#, c-format +#~ msgid "Missing first_set_pin. Instruction %d sets pin(s)" +#~ msgstr "first_set_pin manquant. L'instruction %d règle la/les broche(s)" + +#, c-format +#~ msgid "Missing jmp_pin. Instruction %d jumps on pin" +#~ msgstr "jmp_pin manquant. L'instruction %d va passer à la broche" + #~ msgid "inputs are not iterable" #~ msgstr "les entrées ne sont pas itérables" diff --git a/locale/hi.po b/locale/hi.po index 392e1bbf6d..ee8317745f 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -251,6 +251,22 @@ msgstr "" msgid "%q=%q" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1161,26 +1177,6 @@ msgstr "" msgid "Input/output error" msgstr "" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "" @@ -1352,38 +1348,31 @@ msgid "Mismatched swap flag" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c diff --git a/locale/it_IT.po b/locale/it_IT.po index 5de8a79ef9..2e08d149ed 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -255,6 +255,22 @@ msgstr "" msgid "%q=%q" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1175,26 +1191,6 @@ msgstr "" msgid "Input/output error" msgstr "Errore input/output" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "" @@ -1367,38 +1363,31 @@ msgid "Mismatched swap flag" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c diff --git a/locale/ja.po b/locale/ja.po index 14c9dd84d1..ae1b71a8db 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -258,6 +258,22 @@ msgstr "" msgid "%q=%q" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1174,26 +1190,6 @@ msgstr "" msgid "Input/output error" msgstr "入力/出力エラー" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "認証が不十分" @@ -1365,38 +1361,31 @@ msgid "Mismatched swap flag" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c diff --git a/locale/ko.po b/locale/ko.po index dc3002a256..2fd584eb20 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -252,6 +252,22 @@ msgstr "" msgid "%q=%q" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1164,26 +1180,6 @@ msgstr "" msgid "Input/output error" msgstr "" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "" @@ -1355,38 +1351,31 @@ msgid "Mismatched swap flag" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c diff --git a/locale/nl.po b/locale/nl.po index c6e1decfc1..aa522ad111 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -251,6 +251,22 @@ msgstr "" msgid "%q=%q" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1169,26 +1185,6 @@ msgstr "Invoer duurt te lang" msgid "Input/output error" msgstr "Input/Output fout" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Onvoldoende authenticatie" @@ -1360,38 +1356,31 @@ msgid "Mismatched swap flag" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c diff --git a/locale/pl.po b/locale/pl.po index 32ae38249f..56ef448d61 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -253,6 +253,22 @@ msgstr "" msgid "%q=%q" msgstr "" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1169,26 +1185,6 @@ msgstr "" msgid "Input/output error" msgstr "Błąd I/O" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Niewystarczające uwierzytelnienie" @@ -1360,38 +1356,31 @@ msgid "Mismatched swap flag" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c diff --git a/locale/pt_BR.po b/locale/pt_BR.po index f6bd115445..49935b2c74 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -264,6 +264,22 @@ msgstr "todos os %q, %q, e %q devem ter mesmo comprimento" msgid "%q=%q" msgstr "%q=%q" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1203,26 +1219,6 @@ msgstr "A entrada está demorando demais" msgid "Input/output error" msgstr "Erro de entrada/saída" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "A instrução %d muda com mais bits do que a quantidade dos pinos" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "A instrução %d desloca mais bits do que a quantidade dos pinos" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "A instrução %d usa um pino extra" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "A instrução %d aguarda a entrada de fora da contagem" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Autenticação insuficiente" @@ -1394,39 +1390,32 @@ msgid "Mismatched swap flag" msgstr "Sinalizador de troca incompatível" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" -msgstr "Faltando first_in_pin. A instrução %d lê pinos(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" -msgstr "Faltando first_in_pin. A instrução %d muda a partir do(s) pino(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" -msgstr "Faltando first_in_pin. A instrução %d aguarda com base no pino" +msgid "Missing first_in_pin. %q[%u] waits based on pin" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" -msgstr "Faltando first_out_pin. A instrução %d muda para o(s) pinos(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" -msgstr "Faltando first_out_pin. A instrução %d escreve nos pinos(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" -msgstr "Faltando first_set_pin. A instrução %d define os pinos(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" -msgstr "Falta o jmp_pin. A instrução %d salta no pino" +msgid "Missing jmp_pin. %q[%u] jumps on pin" +msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -4470,6 +4459,50 @@ 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)" +#, c-format +#~ msgid "Instruction %d shifts in more bits than pin count" +#~ msgstr "A instrução %d muda com mais bits do que a quantidade dos pinos" + +#, c-format +#~ msgid "Instruction %d shifts out more bits than pin count" +#~ msgstr "A instrução %d desloca mais bits do que a quantidade dos pinos" + +#, c-format +#~ msgid "Instruction %d uses extra pin" +#~ msgstr "A instrução %d usa um pino extra" + +#, c-format +#~ msgid "Instruction %d waits on input outside of count" +#~ msgstr "A instrução %d aguarda a entrada de fora da contagem" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d reads pin(s)" +#~ msgstr "Faltando first_in_pin. A instrução %d lê pinos(s)" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +#~ msgstr "Faltando first_in_pin. A instrução %d muda a partir do(s) pino(s)" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d waits based on pin" +#~ msgstr "Faltando first_in_pin. A instrução %d aguarda com base no pino" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +#~ msgstr "Faltando first_out_pin. A instrução %d muda para o(s) pinos(s)" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d writes pin(s)" +#~ msgstr "Faltando first_out_pin. A instrução %d escreve nos pinos(s)" + +#, c-format +#~ msgid "Missing first_set_pin. Instruction %d sets pin(s)" +#~ msgstr "Faltando first_set_pin. A instrução %d define os pinos(s)" + +#, c-format +#~ msgid "Missing jmp_pin. Instruction %d jumps on pin" +#~ msgstr "Falta o jmp_pin. A instrução %d salta no pino" + #~ msgid "inputs are not iterable" #~ msgstr "as entradas não são iteráveis" diff --git a/locale/ru.po b/locale/ru.po index f1fd186a24..8d5739ae4d 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -258,6 +258,22 @@ msgstr "%q, %q, и %q должны быть одной длинны" msgid "%q=%q" msgstr "%q=%q" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1202,29 +1218,6 @@ msgstr "Ввод занимает слишком много времени" msgid "Input/output error" msgstr "Ошибка ввода/вывода" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "" -"Инструкция %d вводит (shifts in) большее количество бит, чем количество пинов" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "" -"Инструкция %d выводит (shifts out) большее количество бит, чем количество " -"пинов" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "Инструкция %d использует дополнительный пин" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "Инструкция %d ожидает ввода за пределами count" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Неполная аутентификация" @@ -1399,40 +1392,32 @@ msgid "Mismatched swap flag" msgstr "Несоответствие флага swap" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" -msgstr "Отсутствует first_in_pin. Инструкция %d читает состояние пина (-ов)" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" -msgstr "Отсутствует first_out_pin. Инструкция %d вводит (shifts out) на пин(ы)" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" -msgstr "Отсутствует first_in_pin. Инструкция %d ожидает на основе пина" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" -"Отсутствует first_out_pin. Инструкция %d выводит (shifts out) на пин(ы)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" -msgstr "Отсутствует first_out_pin. Инструкция %d записывает пин(ы)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" -msgstr "Отсутствует first_set_pin. Инструкция %d устанавливает пин(ы)" +msgid "Missing first_in_pin. %q[%u] waits based on pin" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" -msgstr "Отсутствует jmp_pin. Инструкция %d перепрыгивает на пин" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Missing first_out_pin. %q[%u] writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Missing first_set_pin. %q[%u] sets pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Missing jmp_pin. %q[%u] jumps on pin" +msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -4432,6 +4417,56 @@ msgstr "zi должно быть типа float" msgid "zi must be of shape (n_section, 2)" msgstr "zi должен иметь форму (n_section, 2)" +#, c-format +#~ msgid "Instruction %d shifts in more bits than pin count" +#~ msgstr "" +#~ "Инструкция %d вводит (shifts in) большее количество бит, чем количество " +#~ "пинов" + +#, c-format +#~ msgid "Instruction %d shifts out more bits than pin count" +#~ msgstr "" +#~ "Инструкция %d выводит (shifts out) большее количество бит, чем количество " +#~ "пинов" + +#, c-format +#~ msgid "Instruction %d uses extra pin" +#~ msgstr "Инструкция %d использует дополнительный пин" + +#, c-format +#~ msgid "Instruction %d waits on input outside of count" +#~ msgstr "Инструкция %d ожидает ввода за пределами count" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d reads pin(s)" +#~ msgstr "Отсутствует first_in_pin. Инструкция %d читает состояние пина (-ов)" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +#~ msgstr "" +#~ "Отсутствует first_out_pin. Инструкция %d вводит (shifts out) на пин(ы)" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d waits based on pin" +#~ msgstr "Отсутствует first_in_pin. Инструкция %d ожидает на основе пина" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +#~ msgstr "" +#~ "Отсутствует first_out_pin. Инструкция %d выводит (shifts out) на пин(ы)" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d writes pin(s)" +#~ msgstr "Отсутствует first_out_pin. Инструкция %d записывает пин(ы)" + +#, c-format +#~ msgid "Missing first_set_pin. Instruction %d sets pin(s)" +#~ msgstr "Отсутствует first_set_pin. Инструкция %d устанавливает пин(ы)" + +#, c-format +#~ msgid "Missing jmp_pin. Instruction %d jumps on pin" +#~ msgstr "Отсутствует jmp_pin. Инструкция %d перепрыгивает на пин" + #~ msgid "Cannot transfer without MOSI and MISO pins" #~ msgstr "Невозможно передать данные без пинов MOSI и MISO" diff --git a/locale/sv.po b/locale/sv.po index 57164b7062..cf72378e93 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -265,6 +265,22 @@ msgstr "%q, %q och %q måste vara lika långa" msgid "%q=%q" msgstr "%q=%q" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1188,26 +1204,6 @@ msgstr "Indata tar för lång tid" msgid "Input/output error" msgstr "Indata-/utdatafel" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "Instruktion %d skiftar fler bitar än antalet pinnar" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "Instruktion %d skiftar fler bitar än antal pinnar" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "Instruktion %d använder extra pinne" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "Instruktion %d väntar på inmatning utanför intervallet" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Otillräcklig autentisering" @@ -1380,39 +1376,32 @@ msgid "Mismatched swap flag" msgstr "Felaktig swapflagga" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" -msgstr "Saknad first_in_pin. Instruktion %d läser pinnar" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" -msgstr "Saknad first_in_pin. Instruktion %d skiftar in från pinnar" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" -msgstr "Saknad first_in_pin. Instruktion %d väntar baserat på pinne" +msgid "Missing first_in_pin. %q[%u] waits based on pin" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" -msgstr "Saknad first_out_pin. Instruktion %d skiftar ut till pinnar" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" -msgstr "Saknad first_out_pin. Instruktion %d skriver till pinnar" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" -msgstr "Saknad first_set_pin. Instruktion %d sätter pinnar" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" -msgstr "Saknar jmp_pin. Instruktion %d hoppar på pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" +msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -4430,6 +4419,50 @@ 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)" +#, c-format +#~ msgid "Instruction %d shifts in more bits than pin count" +#~ msgstr "Instruktion %d skiftar fler bitar än antalet pinnar" + +#, c-format +#~ msgid "Instruction %d shifts out more bits than pin count" +#~ msgstr "Instruktion %d skiftar fler bitar än antal pinnar" + +#, c-format +#~ msgid "Instruction %d uses extra pin" +#~ msgstr "Instruktion %d använder extra pinne" + +#, c-format +#~ msgid "Instruction %d waits on input outside of count" +#~ msgstr "Instruktion %d väntar på inmatning utanför intervallet" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d reads pin(s)" +#~ msgstr "Saknad first_in_pin. Instruktion %d läser pinnar" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +#~ msgstr "Saknad first_in_pin. Instruktion %d skiftar in från pinnar" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d waits based on pin" +#~ msgstr "Saknad first_in_pin. Instruktion %d väntar baserat på pinne" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +#~ msgstr "Saknad first_out_pin. Instruktion %d skiftar ut till pinnar" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d writes pin(s)" +#~ msgstr "Saknad first_out_pin. Instruktion %d skriver till pinnar" + +#, c-format +#~ msgid "Missing first_set_pin. Instruction %d sets pin(s)" +#~ msgstr "Saknad first_set_pin. Instruktion %d sätter pinnar" + +#, c-format +#~ msgid "Missing jmp_pin. Instruction %d jumps on pin" +#~ msgstr "Saknar jmp_pin. Instruktion %d hoppar på pin" + #~ msgid "inputs are not iterable" #~ msgstr "indata är inte iterbara" diff --git a/locale/tr.po b/locale/tr.po index 3faed02135..2a04dabdcf 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -259,6 +259,22 @@ msgstr "%q, %q ve %q aynı uzunlukta olmalıdır" msgid "%q=%q" msgstr "%q=%q" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1179,26 +1195,6 @@ msgstr "Giriş çok uzun sürüyor" msgid "Input/output error" msgstr "Giriş/çıkış hatası" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "Komut %d pin sayısından daha fazla bit içe kaydırıyor" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "Komut %d pin sayısından daha fazla bit dışa kaydırıyor" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "Komut %d extra pin kullanıyor" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "Komut %d sayım dışında, girişte bekler" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Yetersiz kimlik doğrulama" @@ -1371,38 +1367,31 @@ msgid "Mismatched swap flag" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] waits based on pin" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" +msgid "Missing first_set_pin. %q[%u] sets pin(s)" msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" +msgid "Missing jmp_pin. %q[%u] jumps on pin" msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c @@ -4391,6 +4380,22 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#, c-format +#~ msgid "Instruction %d shifts in more bits than pin count" +#~ msgstr "Komut %d pin sayısından daha fazla bit içe kaydırıyor" + +#, c-format +#~ msgid "Instruction %d shifts out more bits than pin count" +#~ msgstr "Komut %d pin sayısından daha fazla bit dışa kaydırıyor" + +#, c-format +#~ msgid "Instruction %d uses extra pin" +#~ msgstr "Komut %d extra pin kullanıyor" + +#, c-format +#~ msgid "Instruction %d waits on input outside of count" +#~ msgstr "Komut %d sayım dışında, girişte bekler" + #~ msgid "Cannot transfer without MOSI and MISO pins" #~ msgstr "MOSI ve MISO pinleri olmadan transfer edilemiyor" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 9dc9b39c21..c285611635 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -267,6 +267,22 @@ msgstr "%q, %q, hé %q bì xū cháng dù xiāng tóng" msgid "%q=%q" msgstr "%q=%q" +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts in more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] shifts out more bits than pin count" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] uses extra pin" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "%q[%u] waits on input outside of count" +msgstr "" + #: ports/espressif/common-hal/espidf/__init__.c #, c-format msgid "%s error 0x%x" @@ -1195,26 +1211,6 @@ msgstr "Shūrù shíjiānguò zhǎng" msgid "Input/output error" msgstr "Shūrù/shūchū cuòwù" -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts in more bits than pin count" -msgstr "zhǐ lìng %d yí wèi chāo guò yǐn jiǎo jì shù" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d shifts out more bits than pin count" -msgstr "zhǐ lìng %d yí chū de wèi bǐ yǐn jiǎo shù duō" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d uses extra pin" -msgstr "zhǐ lìng %d shǐ yòng é wài de yǐn jiǎo" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Instruction %d waits on input outside of count" -msgstr "zhǐ lìng %d děng dài jì shù zhī wài de shū rù" - #: ports/nrf/common-hal/_bleio/__init__.c msgid "Insufficient authentication" msgstr "Rènzhèng bùzú" @@ -1386,40 +1382,32 @@ msgid "Mismatched swap flag" msgstr "jiāohuàn biāozhì bù pǐpèi" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d reads pin(s)" -msgstr "shǒu xiān zài yǐn jiǎo zhōng quē shī. zhǐ lìng %d dú qǔ yǐn jiǎo" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" -msgstr "shǒu xiān zài yǐn jiǎo zhōng quē shī. zhǐ lìng %d cóng yǐn jiǎo yí wèi" - -#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_in_pin. Instruction %d waits based on pin" +msgid "Missing first_in_pin. %q[%u] reads pin(s)" msgstr "" -"shǒu xiān zài yǐn jiǎo zhōng quē shī. jī yú yǐn jiǎo de zhǐ lìng %d děng dài" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" -msgstr "xiān lòu chū yǐn jiǎo. zhǐ lìng %d yí chū dào yǐn jiǎo" +msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_out_pin. Instruction %d writes pin(s)" -msgstr "xiān lòu chū yǐn jiǎo. zhǐ lìng %d xiě rù yǐn jiǎo" +msgid "Missing first_in_pin. %q[%u] waits based on pin" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing first_set_pin. Instruction %d sets pin(s)" -msgstr "quē shǎo dì yī zǔ yǐn jiǎo. zhǐ lìng %d shè zhì yǐn jiǎo" +msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" +msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c -#, c-format -msgid "Missing jmp_pin. Instruction %d jumps on pin" -msgstr "shī zōng de jmp_pin. zhǐ lìng %d zài yǐn jiǎo shàng tiào yuè" +msgid "Missing first_out_pin. %q[%u] writes pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Missing first_set_pin. %q[%u] sets pin(s)" +msgstr "" + +#: ports/raspberrypi/common-hal/rp2pio/StateMachine.c +msgid "Missing jmp_pin. %q[%u] jumps on pin" +msgstr "" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -4436,6 +4424,53 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#, c-format +#~ msgid "Instruction %d shifts in more bits than pin count" +#~ msgstr "zhǐ lìng %d yí wèi chāo guò yǐn jiǎo jì shù" + +#, c-format +#~ msgid "Instruction %d shifts out more bits than pin count" +#~ msgstr "zhǐ lìng %d yí chū de wèi bǐ yǐn jiǎo shù duō" + +#, c-format +#~ msgid "Instruction %d uses extra pin" +#~ msgstr "zhǐ lìng %d shǐ yòng é wài de yǐn jiǎo" + +#, c-format +#~ msgid "Instruction %d waits on input outside of count" +#~ msgstr "zhǐ lìng %d děng dài jì shù zhī wài de shū rù" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d reads pin(s)" +#~ msgstr "shǒu xiān zài yǐn jiǎo zhōng quē shī. zhǐ lìng %d dú qǔ yǐn jiǎo" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d shifts in from pin(s)" +#~ msgstr "" +#~ "shǒu xiān zài yǐn jiǎo zhōng quē shī. zhǐ lìng %d cóng yǐn jiǎo yí wèi" + +#, c-format +#~ msgid "Missing first_in_pin. Instruction %d waits based on pin" +#~ msgstr "" +#~ "shǒu xiān zài yǐn jiǎo zhōng quē shī. jī yú yǐn jiǎo de zhǐ lìng %d děng " +#~ "dài" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d shifts out to pin(s)" +#~ msgstr "xiān lòu chū yǐn jiǎo. zhǐ lìng %d yí chū dào yǐn jiǎo" + +#, c-format +#~ msgid "Missing first_out_pin. Instruction %d writes pin(s)" +#~ msgstr "xiān lòu chū yǐn jiǎo. zhǐ lìng %d xiě rù yǐn jiǎo" + +#, c-format +#~ msgid "Missing first_set_pin. Instruction %d sets pin(s)" +#~ msgstr "quē shǎo dì yī zǔ yǐn jiǎo. zhǐ lìng %d shè zhì yǐn jiǎo" + +#, c-format +#~ msgid "Missing jmp_pin. Instruction %d jumps on pin" +#~ msgstr "shī zōng de jmp_pin. zhǐ lìng %d zài yǐn jiǎo shàng tiào yuè" + #~ msgid "inputs are not iterable" #~ msgstr "shū rù bù kě yí dòng" From 8a468354fef079fd7928f9848cdeebd22f0fd7e2 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Wed, 9 Aug 2023 17:48:14 +0000 Subject: [PATCH 1452/1712] Translated using Weblate (Swedish) Currently translated at 99.2% (991 of 998 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index cf72378e93..c0ea509420 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-08-04 16:42+0000\n" +"PO-Revision-Date: 2023-08-09 17:50+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -267,19 +267,19 @@ msgstr "%q=%q" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts in more bits than pin count" -msgstr "" +msgstr "%q[%u] skiftar in fler bita än antal pinnar" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts out more bits than pin count" -msgstr "" +msgstr "%q[%u] skiftar ut fler bits än antal pinnar" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] uses extra pin" -msgstr "" +msgstr "%q[%u] använder extra pinnar" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] waits on input outside of count" -msgstr "" +msgstr "%q[%u] väntar på input utanför count" #: ports/espressif/common-hal/espidf/__init__.c #, c-format From 0dca530b7058a91664d0409896e8e38917dfd5db Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 9 Aug 2023 15:20:10 -0400 Subject: [PATCH 1453/1712] wip; Trinket M0 compiles --- py/obj.c | 6 +++++- py/objexcept.c | 46 ++++++++++++++++++++-------------------------- py/objmodule.c | 12 ++++++++++++ py/runtime.c | 11 +++++++++++ 4 files changed, 48 insertions(+), 27 deletions(-) diff --git a/py/obj.c b/py/obj.c index 3911280686..31d469770c 100644 --- a/py/obj.c +++ b/py/obj.c @@ -231,7 +231,11 @@ void mp_obj_print_exception_with_limit(const mp_print_t *print, mp_obj_t exc, mp mp_print_str(print, "\n"); } -bool mp_obj_is_true(mp_obj_t arg) { +void mp_obj_print_exception(const mp_print_t *print, mp_obj_t exc) { + mp_obj_print_exception_with_limit(print, exc, 0); +} + +bool PLACE_IN_ITCM(mp_obj_is_true)(mp_obj_t arg) { if (arg == mp_const_false) { return 0; } else if (arg == mp_const_true) { diff --git a/py/objexcept.c b/py/objexcept.c index 6d209e0c34..b19844c0ad 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -325,54 +325,48 @@ MP_DEFINE_EXCEPTION(KeyboardInterrupt, BaseException) MP_DEFINE_EXCEPTION(ReloadException, BaseException) MP_DEFINE_EXCEPTION(GeneratorExit, BaseException) MP_DEFINE_EXCEPTION(Exception, BaseException) - #if MICROPY_PY_ASYNC_AWAIT +#if MICROPY_PY_ASYNC_AWAIT MP_DEFINE_EXCEPTION(StopAsyncIteration, Exception) - #endif +#endif MP_DEFINE_EXCEPTION(StopIteration, Exception) MP_DEFINE_EXCEPTION(ArithmeticError, Exception) - //MP_DEFINE_EXCEPTION(FloatingPointError, ArithmeticError) + // MP_DEFINE_EXCEPTION(FloatingPointError, ArithmeticError) MP_DEFINE_EXCEPTION(OverflowError, ArithmeticError) MP_DEFINE_EXCEPTION(ZeroDivisionError, ArithmeticError) MP_DEFINE_EXCEPTION(AssertionError, Exception) MP_DEFINE_EXCEPTION(AttributeError, Exception) - //MP_DEFINE_EXCEPTION(BufferError, Exception) + // MP_DEFINE_EXCEPTION(BufferError, Exception) + // MP_DEFINE_EXCEPTION(EnvironmentError, Exception) use OSError instead MP_DEFINE_EXCEPTION(EOFError, Exception) MP_DEFINE_EXCEPTION(ImportError, Exception) + // MP_DEFINE_EXCEPTION(IOError, Exception) use OSError instead MP_DEFINE_EXCEPTION(LookupError, Exception) MP_DEFINE_EXCEPTION(IndexError, LookupError) MP_DEFINE_EXCEPTION(KeyError, LookupError) MP_DEFINE_EXCEPTION(MemoryError, Exception) MP_DEFINE_EXCEPTION(NameError, Exception) - /* - MP_DEFINE_EXCEPTION(UnboundLocalError, NameError) - */ + // MP_DEFINE_EXCEPTION(UnboundLocalError, NameError) MP_DEFINE_EXCEPTION(OSError, Exception) - /* - MP_DEFINE_EXCEPTION(BlockingIOError, OSError) - MP_DEFINE_EXCEPTION(ChildProcessError, OSError) MP_DEFINE_EXCEPTION(ConnectionError, OSError) MP_DEFINE_EXCEPTION(BrokenPipeError, ConnectionError) - MP_DEFINE_EXCEPTION(ConnectionAbortedError, ConnectionError) - MP_DEFINE_EXCEPTION(ConnectionRefusedError, ConnectionError) - MP_DEFINE_EXCEPTION(ConnectionResetError, ConnectionError) - MP_DEFINE_EXCEPTION(InterruptedError, OSError) - MP_DEFINE_EXCEPTION(IsADirectoryError, OSError) - MP_DEFINE_EXCEPTION(NotADirectoryError, OSError) - MP_DEFINE_EXCEPTION(PermissionError, OSError) - MP_DEFINE_EXCEPTION(ProcessLookupError, OSError) - MP_DEFINE_EXCEPTION(TimeoutError, OSError) - MP_DEFINE_EXCEPTION(FileExistsError, OSError) + // MP_DEFINE_EXCEPTION(ConnectionAbortedError, ConnectionError) + // MP_DEFINE_EXCEPTION(ConnectionRefusedError, ConnectionError) + // MP_DEFINE_EXCEPTION(ConnectionResetError, ConnectionError) + // MP_DEFINE_EXCEPTION(FileExistsError, OSError) MP_DEFINE_EXCEPTION(FileNotFoundError, OSError) - MP_DEFINE_EXCEPTION(ReferenceError, Exception) - */ + // MP_DEFINE_EXCEPTION(InterruptedError, OSError) + // MP_DEFINE_EXCEPTION(IsADirectoryError, OSError) + // MP_DEFINE_EXCEPTION(NotADirectoryError, OSError) + // MP_DEFINE_EXCEPTION(PermissionError, OSError) + // MP_DEFINE_EXCEPTION(ProcessLookupError, OSError) + // MP_DEFINE_EXCEPTION(ReferenceError, Exception) + MP_DEFINE_EXCEPTION(TimeoutError, OSError) MP_DEFINE_EXCEPTION(RuntimeError, Exception) MP_DEFINE_EXCEPTION(NotImplementedError, RuntimeError) MP_DEFINE_EXCEPTION(SyntaxError, Exception) MP_DEFINE_EXCEPTION(IndentationError, SyntaxError) - /* - MP_DEFINE_EXCEPTION(TabError, IndentationError) - */ - //MP_DEFINE_EXCEPTION(SystemError, Exception) + // MP_DEFINE_EXCEPTION(TabError, IndentationError) + // MP_DEFINE_EXCEPTION(SystemError, Exception) MP_DEFINE_EXCEPTION(TypeError, Exception) #if MICROPY_EMIT_NATIVE MP_DEFINE_EXCEPTION(ViperTypeError, TypeError) diff --git a/py/objmodule.c b/py/objmodule.c index 783d6b0508..1c281793d6 100644 --- a/py/objmodule.c +++ b/py/objmodule.c @@ -161,6 +161,18 @@ mp_obj_t mp_obj_new_module(qstr module_name) { return MP_OBJ_FROM_PTR(o); } +mp_obj_dict_t *mp_obj_module_get_globals(mp_obj_t self_in) { + assert(mp_obj_is_type(self_in, &mp_type_module)); + mp_obj_module_t *self = MP_OBJ_TO_PTR(self_in); + return self->globals; +} + +void mp_obj_module_set_globals(mp_obj_t self_in, mp_obj_dict_t *globals) { + assert(mp_obj_is_type(self_in, &mp_type_module)); + mp_obj_module_t *self = MP_OBJ_TO_PTR(self_in); + self->globals = globals; +} + /******************************************************************************/ // Global module table and related functions diff --git a/py/runtime.c b/py/runtime.c index 2562621cc5..d03aa4103c 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -62,6 +62,8 @@ const mp_obj_module_t mp_module___main__ = { .globals = (mp_obj_dict_t *)&MP_STATE_VM(dict_main), }; +MP_REGISTER_MODULE(MP_QSTR___main__, mp_module___main__); + void mp_init(void) { qstr_init(); @@ -144,6 +146,11 @@ void mp_init(void) { MP_STATE_VM(sys_exitfunc) = mp_const_none; #endif + #if MICROPY_PY_SYS_PS1_PS2 + MP_STATE_VM(sys_mutable[MP_SYS_MUTABLE_PS1]) = MP_OBJ_NEW_QSTR(MP_QSTR__gt__gt__gt__space_); + MP_STATE_VM(sys_mutable[MP_SYS_MUTABLE_PS2]) = MP_OBJ_NEW_QSTR(MP_QSTR__dot__dot__dot__space_); + #endif + #if MICROPY_PY_SYS_SETTRACE MP_STATE_THREAD(prof_trace_callback) = MP_OBJ_NULL; MP_STATE_THREAD(prof_callback_is_executing) = false; @@ -1810,3 +1817,7 @@ NORETURN MP_COLD void mp_raise_recursion_depth(void) { mp_raise_RuntimeError(MP_ERROR_TEXT("maximum recursion depth exceeded")); } #endif + +NORETURN MP_COLD void mp_raise_ZeroDivisionError(void) { + mp_raise_msg(&mp_type_ZeroDivisionError, MP_ERROR_TEXT("division by zero")); +} From ce61fd857b721f7a044a25845c3e8ee3cee1e245 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Thu, 10 Aug 2023 08:15:18 -0700 Subject: [PATCH 1454/1712] Bug fix for skip on only one bmp --- shared-module/bitmaptools/__init__.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index eebb7f7c24..2054ff9cab 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -972,10 +972,16 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma } } else if (blend_source1) { // Apply iFactor1 to source1 only - pixel = spix1 * ifactor1 / 256; + int r = (spix1 & r_mask) * ifactor1 / 256; + int g = (spix1 & g_mask) * ifactor1 / 256; + int b = (spix1 & b_mask) * ifactor1 / 256; + pixel = r | g | b; } else if (blend_source2) { // Apply iFactor2 to source1 only - pixel = spix2 * ifactor2 / 256; + int r = (spix2 & r_mask) * ifactor2 / 256; + int g = (spix2 & g_mask) * ifactor2 / 256; + int b = (spix2 & b_mask) * ifactor2 / 256; + pixel = r | g | b; } else { // Use the destination value pixel = *dptr; From b650320f51a523c36d6387ee6d5b8fbb64f19b7c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 9 Aug 2023 21:32:26 +0000 Subject: [PATCH 1455/1712] Translated using Weblate (French) Currently translated at 95.5% (954 of 998 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index da50428ded..30e75859e9 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,14 +8,14 @@ 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: 2023-05-21 00:49+0000\n" -"Last-Translator: Scott Shawcroft \n" +"PO-Revision-Date: 2023-08-10 23:51+0000\n" +"Last-Translator: Jeff Epler \n" "Language: fr\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.18-dev\n" +"X-Generator: Weblate 5.0-dev\n" #: main.c msgid "" @@ -160,7 +160,7 @@ msgstr "échec de l'initialisation %q" #: ports/espressif/bindings/espnow/Peer.c shared-bindings/dualbank/__init__.c msgid "%q is %q" -msgstr "" +msgstr "%q est %q" #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "%q is read-only for this board" @@ -217,11 +217,11 @@ msgstr "%q doit être a bytearray ou array de type 'h', 'H', 'b', ou 'B'" #: ports/espressif/common-hal/analogbufio/BufferedIn.c msgid "%q must be array of type 'H'" -msgstr "" +msgstr "%q doit être array de type 'H'" #: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" -msgstr "" +msgstr "%q doit être array de type 'h'" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c @@ -268,19 +268,19 @@ msgstr "%q=%q" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts in more bits than pin count" -msgstr "" +msgstr "%q[%u] décale vers l'intérieur de plus de bits que le nombre de broches" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts out more bits than pin count" -msgstr "" +msgstr "%q[%u] décale vers l'extérieur de plus de bits que le nombre de broches" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] uses extra pin" -msgstr "" +msgstr "%q[%u] utilise des broches supplémentaires" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] waits on input outside of count" -msgstr "" +msgstr "%q[%u] attend sur une entrée hors du compte" #: ports/espressif/common-hal/espidf/__init__.c #, c-format @@ -507,7 +507,7 @@ msgstr "Tout les canaux sont utilisés" #: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All dma channels in use" -msgstr "" +msgstr "Toutes les canals DMA sont utilisées" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" From 9ec83cd896193870bf26f0df4098efb797ba94b9 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Wed, 9 Aug 2023 23:09:41 +0000 Subject: [PATCH 1456/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (998 of 998 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 49935b2c74..3b1a55297c 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: 2023-08-06 17:45+0000\n" +"PO-Revision-Date: 2023-08-10 23:51+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -266,19 +266,19 @@ msgstr "%q=%q" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts in more bits than pin count" -msgstr "" +msgstr "%q[%u] desloca mais bits na entrada do que a contagem de pinos" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts out more bits than pin count" -msgstr "" +msgstr "%q[%u] desloca mais bits na saída do que a contagem de pinos" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] uses extra pin" -msgstr "" +msgstr "%q[%u] usa pino extra" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] waits on input outside of count" -msgstr "" +msgstr "%q[%u] espera na entrada fora da contagem" #: ports/espressif/common-hal/espidf/__init__.c #, c-format @@ -1391,31 +1391,31 @@ msgstr "Sinalizador de troca incompatível" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] reads pin(s)" -msgstr "" +msgstr "Faltando first_in_pin. %q[%u] lê pino(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" -msgstr "" +msgstr "Faltando first_in_pin. %q[%u] muda de pino(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] waits based on pin" -msgstr "" +msgstr "Faltando first_in_pin. %q[%u] espera com base no pino" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" -msgstr "" +msgstr "Faltando first_out_pin. %q[%u] desloca para fora dos pino(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] writes pin(s)" -msgstr "" +msgstr "Faltando first_out_pin. %q[%u] escreve pino(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_set_pin. %q[%u] sets pin(s)" -msgstr "" +msgstr "Faltando first_set_pin. %q[%u] define pino(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing jmp_pin. %q[%u] jumps on pin" -msgstr "" +msgstr "Falta jmp_pin. %q[%u] jumper no pino" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." From 6c8bfe3386c1b6eb7c488142fc6b191dde8660a8 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Wed, 9 Aug 2023 17:51:59 +0000 Subject: [PATCH 1457/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (998 of 998 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index c0ea509420..a631e4fce0 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-08-09 17:50+0000\n" +"PO-Revision-Date: 2023-08-10 23:51+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -1377,31 +1377,31 @@ msgstr "Felaktig swapflagga" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] reads pin(s)" -msgstr "" +msgstr "Saknad first_in_pin. %q[%u] läser pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" -msgstr "" +msgstr "Saknad first_in_pin. %q[%u] skiftar in från pinne" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] waits based on pin" -msgstr "" +msgstr "Saknad first_in_pin. %q[%u] väntar baserat på pin" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" -msgstr "" +msgstr "Saknad first_in_pin. %q[%u] skiftar ut från pinne" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] writes pin(s)" -msgstr "" +msgstr "Saknad first_out_pin. %q[%u] skriver pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_set_pin. %q[%u] sets pin(s)" -msgstr "" +msgstr "Saknad first_set_pin. %q[%u] sätter pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing jmp_pin. %q[%u] jumps on pin" -msgstr "" +msgstr "Saknad jmp_pin. %q[%u] hoppar på pin" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." From fe0e2f13bccfb7508bd5cd53cabbe708ec43b316 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 10 Aug 2023 20:06:32 -0400 Subject: [PATCH 1458/1712] wip; fix qstr processing --- .../ble_hci/common-hal/_bleio/PacketBuffer.c | 6 +-- extmod/moduselect.c | 2 - mpy-cross/mpy-cross.mk | 2 +- ports/atmel-samd/Makefile | 5 ++ ports/atmel-samd/common-hal/pulseio/PulseIn.c | 2 +- ports/unix/Makefile | 2 + py/circuitpy_defns.mk | 2 +- py/makeqstrdata.py | 34 +++--------- py/mkenv.mk | 11 +++- py/mkrules.mk | 18 +------ py/moduerrno.c | 53 ++++++++++++++++++- py/mpconfig.h | 6 ++- py/mpstate.h | 6 +++ py/py.mk | 41 +++++++------- shared-bindings/_bleio/Characteristic.c | 2 +- shared-bindings/audiomixer/Mixer.c | 2 +- shared-bindings/countio/__init__.c | 1 - shared-bindings/displayio/EPaperDisplay.c | 2 +- shared-bindings/i2ctarget/I2CTarget.c | 2 +- shared-bindings/synthio/__init__.c | 2 +- shared-module/_bleio/ScanResults.c | 2 +- shared-module/adafruit_pixelbuf/PixelBuf.c | 2 +- shared-module/atexit/__init__.c | 2 +- shared-module/audiocore/WaveFile.c | 4 +- shared-module/audiomixer/Mixer.c | 4 +- shared-module/audiomp3/MP3Decoder.c | 6 +-- shared-module/displayio/Bitmap.c | 2 +- shared-module/displayio/OnDiskBitmap.c | 4 +- shared-module/displayio/Palette.c | 2 +- shared-module/displayio/Shape.c | 2 +- shared-module/displayio/TileGrid.c | 2 +- shared-module/gifio/GifWriter.c | 2 +- shared-module/keypad/EventQueue.c | 2 +- shared-module/keypad/KeyMatrix.c | 4 +- shared-module/keypad/Keys.c | 4 +- shared-module/keypad/__init__.c | 4 +- shared-module/qrio/quirc_alloc.h | 4 +- shared-module/synthio/__init__.c | 6 +-- .../shared/external_flash/external_flash.c | 4 +- supervisor/shared/translate/translate.c | 2 +- supervisor/supervisor.mk | 3 +- 41 files changed, 149 insertions(+), 119 deletions(-) diff --git a/devices/ble_hci/common-hal/_bleio/PacketBuffer.c b/devices/ble_hci/common-hal/_bleio/PacketBuffer.c index b690909029..24295b025e 100644 --- a/devices/ble_hci/common-hal/_bleio/PacketBuffer.c +++ b/devices/ble_hci/common-hal/_bleio/PacketBuffer.c @@ -101,7 +101,7 @@ void common_hal_bleio_packet_buffer_construct( } if (incoming) { - if (!ringbuf_alloc(&self->ringbuf, buffer_size * (sizeof(uint16_t) + max_packet_size), false)) { + if (!ringbuf_alloc(&self->ringbuf, buffer_size * (sizeof(uint16_t) + max_packet_size))) { mp_raise_ValueError(translate("Buffer too large and unable to allocate")); } } @@ -110,8 +110,8 @@ void common_hal_bleio_packet_buffer_construct( self->packet_queued = false; self->pending_index = 0; self->pending_size = 0; - self->outgoing[0] = m_malloc(max_packet_size, false); - self->outgoing[1] = m_malloc(max_packet_size, false); + self->outgoing[0] = m_malloc(max_packet_size); + self->outgoing[1] = m_malloc(max_packet_size); } else { self->outgoing[0] = NULL; self->outgoing[1] = NULL; diff --git a/extmod/moduselect.c b/extmod/moduselect.c index 98d9042ec8..b68d97bbe5 100644 --- a/extmod/moduselect.c +++ b/extmod/moduselect.c @@ -347,8 +347,6 @@ STATIC const mp_obj_type_t mp_type_poll = { { &mp_type_type }, .flags = MP_TYPE_FLAG_EXTENDED, .name = MP_QSTR_poll, - .getiter = mp_identity_getiter, - .iternext = poll_iternext, .locals_dict = (void *)&poll_locals_dict, MP_TYPE_EXTENDED_FIELDS( .getiter = mp_identity_getiter, diff --git a/mpy-cross/mpy-cross.mk b/mpy-cross/mpy-cross.mk index 452e2f3c1f..9461cf5748 100644 --- a/mpy-cross/mpy-cross.mk +++ b/mpy-cross/mpy-cross.mk @@ -78,6 +78,6 @@ endif OBJ = $(PY_CORE_O) OBJ += $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) -$(BUILD)/supervisor/shared/translate/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/compression.generated.h +$(BUILD)/supervisor/shared/translate/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/compressed_translations.generated.h include $(TOP)/py/mkrules.mk diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 4595998953..d732e7a9b2 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -171,7 +171,10 @@ endif # we know is ok. It's not clear how to give the compiler the info it needs so # disable the checks for now. # See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578 +GCCVERSIONGTEQ11 := $(shell expr `$(CC) -dumpversion` \>= 11) +ifeq ($(GCC_VERSION_GTEQ_11),1) CFLAGS += -Wno-stringop-overread -Wno-stringop-overflow +endif LDFLAGS = $(CFLAGS) -nostartfiles -Wl,-nostdlib -Wl,-T,$(GENERATED_LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections -specs=nano.specs @@ -350,10 +353,12 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o)) SRC_QSTR += $(HEADER_BUILD)/sdiodata.h +OBJ_EXTRA_ORDER_DEPS += $(HEADER_BUILD)/sioddata.h $(HEADER_BUILD)/sdiodata.h: tools/mksdiodata.py | $(HEADER_BUILD) $(Q)$(PYTHON) $< > $@ SRC_QSTR += $(HEADER_BUILD)/candata.h +OBJ_EXTRA_ORDER_DEPS += $(HEADER_BUILD)/candata.h $(HEADER_BUILD)/candata.h: tools/mkcandata.py | $(HEADER_BUILD) $(Q)$(PYTHON) $< > $@ diff --git a/ports/atmel-samd/common-hal/pulseio/PulseIn.c b/ports/atmel-samd/common-hal/pulseio/PulseIn.c index 8bf889bed3..cc2c1f4fe0 100644 --- a/ports/atmel-samd/common-hal/pulseio/PulseIn.c +++ b/ports/atmel-samd/common-hal/pulseio/PulseIn.c @@ -159,7 +159,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, mp_raise_RuntimeError(translate("EXTINT channel already in use")); } - self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t), false); + self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t)); if (self->buffer == NULL) { m_malloc_fail(maxlen * sizeof(uint16_t)); } diff --git a/ports/unix/Makefile b/ports/unix/Makefile index ac3e2ef11d..eee9f23634 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -366,3 +366,5 @@ install: $(PROG) uninstall: -rm $(BINDIR)/$(PROG) + +$(BUILD)/supervisor/shared/translate/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/compressed_translations.generated.h diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 106dd74945..4acbafef40 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -713,7 +713,7 @@ SRC_MOD += $(addprefix lib/mp3/src/, \ subband.c \ trigtabs.c \ ) -$(BUILD)/lib/mp3/src/buffers.o: CFLAGS += -include "py/misc.h" -D'MPDEC_ALLOCATOR(x)=m_malloc(x,0)' -D'MPDEC_FREE(x)=m_free(x)' +$(BUILD)/lib/mp3/src/buffers.o: CFLAGS += -include "py/misc.h" -D'MPDEC_ALLOCATOR(x)=m_malloc(x)' -D'MPDEC_FREE(x)=m_free(x)' endif ifeq ($(CIRCUITPY_RGBMATRIX),1) SRC_MOD += $(addprefix lib/protomatter/src/, \ diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index d16bb0d09a..f6f0d8abf1 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -249,7 +249,6 @@ static_qstr_list = [ "zip", ] - # this must match the equivalent function in qstr.c def compute_hash(qstr, bytes_hash): hash = 5381 @@ -351,13 +350,12 @@ def parse_input_headers(infiles): return qcfgs, qstrs, i18ns -def escape_bytes(qstr): +def escape_bytes(qstr, qbytes): if all(32 <= ord(c) <= 126 and c != "\\" and c != '"' for c in qstr): # qstr is all printable ASCII so render it as-is (for easier debugging) return qstr else: # qstr contains non-printable codes so render entire thing as hex pairs - qbytes = bytes_cons(qstr, "utf8") return "".join(("\\x%02x" % b) for b in qbytes) @@ -368,7 +366,7 @@ def make_bytes(cfg_bytes_len, cfg_bytes_hash, qstr): if qlen >= (1 << (8 * cfg_bytes_len)): print("qstr is too long:", qstr) assert False - qdata = escape_bytes(qstr) + qdata = escape_bytes(qstr, qbytes) return '%d, %d, "%s"' % (qhash, qlen, qdata) @@ -402,18 +400,10 @@ def print_qstr_data(qcfgs, qstrs, i18ns): print("// {} bytes worth of qstr".format(total_qstr_size)) -def print_qstr_enums(qstrs): - # print out the starter of the generated C header file - print("// This file was automatically generated by makeqstrdata.py") - print("") - - # add NULL qstr with no hash or data - print("QENUM(MP_QSTRnull)") - - # go through each qstr and print it out - for order, ident, qstr in sorted(qstrs.values(), key=lambda x: x[0]): - print("QENUM(MP_QSTR_%s)" % (ident,)) +def do_work(infiles): + qcfgs, qstrs, i18ns = parse_input_headers(infiles) + print_qstr_data(qcfgs, qstrs, i18ns) if __name__ == "__main__": import argparse @@ -424,19 +414,7 @@ if __name__ == "__main__": parser.add_argument( "infiles", metavar="N", type=str, nargs="+", help="an integer for the accumulator" ) - parser.add_argument( - "--output_type", - default="enums", - type=str, - help="output definitions", - choices=("enums", "data"), - ) args = parser.parse_args() - qcfgs, qstrs, i18ns = parse_input_headers(args.infiles) - if args.output_type == "data": - i18ns = sorted(i18ns) - print_qstr_data(qcfgs, qstrs, i18ns) - else: - print_qstr_enums(qstrs) + do_work(args.infiles) diff --git a/py/mkenv.mk b/py/mkenv.mk index e2cdb2ddb6..f74e557040 100644 --- a/py/mkenv.mk +++ b/py/mkenv.mk @@ -20,7 +20,7 @@ ifeq ("$(origin V)", "command line") BUILD_VERBOSE=$(V) endif ifndef BUILD_VERBOSE -$(info Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.) +$(info Use make V={1,2,3} or set BUILD_VERBOSE similarly in your environment to increase build verbosity.) BUILD_VERBOSE = 0 endif ifeq ($(BUILD_VERBOSE),0) @@ -30,10 +30,19 @@ else ifeq ($(BUILD_VERBOSE),1) Q = @ STEPECHO = @echo else +# BUILD_VERBOSE not 0 or 1 Q = STEPECHO = @echo endif +ifeq ($(BUILD_VERBOSE),3) +# This clever shell redefinition will print out the makefile line that is causing an action. +# Note that -j can cause the order to be confusing. +# https://www.cmcrossroads.com/article/tracing-rule-execution-gnu-make +OLD_SHELL := $(SHELL) +SHELL = $(warning BUILDING $@)$(OLD_SHELL) +endif + # default settings; can be overridden in main Makefile PY_SRC ?= $(TOP)/py diff --git a/py/mkrules.mk b/py/mkrules.mk index 74ab8dd78a..8d78d2e28b 100644 --- a/py/mkrules.mk +++ b/py/mkrules.mk @@ -75,7 +75,7 @@ $(Q)$(CXX) $(CXXFLAGS) -c -MD -o $@ $< $(RM) -f $(@:.o=.d) endef -vpath %.c . $(TOP) $(USER_C_MODULES) +vpath %.c . $(TOP) $(USER_C_MODULES) $(DEVICES_MODULES) $(BUILD)/%.o: %.c $(call compile_c) @@ -83,17 +83,6 @@ vpath %.cpp . $(TOP) $(USER_C_MODULES) $(BUILD)/%.o: %.cpp $(call compile_cxx) -QSTR_GEN_EXTRA_CFLAGS += -DNO_QSTR -x c - -# frozen.c and frozen_mpy.c are created in $(BUILD), so use our rule -# for those as well. -vpath %.c . $(BUILD) -$(BUILD)/%.o: %.c - $(call compile_c) - -QSTR_GEN_EXTRA_CFLAGS += -I$(BUILD)/tmp - -vpath %.c . $(TOP) $(USER_C_MODULES) $(DEVICES_MODULES) $(BUILD)/%.pp: %.c $(ECHO) "PreProcess $<" $(Q)$(CPP) $(CFLAGS) -Wp,-C,-dD,-dI -o $@ $< @@ -124,7 +113,7 @@ $(HEADER_BUILD)/qstr.split: $(HEADER_BUILD)/qstr.i.last $(Q)$(TOUCH) $@ $(QSTR_DEFS_COLLECTED): $(HEADER_BUILD)/qstr.split - $(STEPECHO) "GEN $@" + $(ECHO) "GEN $@" $(Q)$(PYTHON) $(PY_SRC)/makeqstrdefs.py cat qstr _ $(HEADER_BUILD)/qstr $@ # Module definitions via MP_REGISTER_MODULE. @@ -245,7 +234,4 @@ print-def: @$(CC) -E -Wp,-dM __empty__.c @$(RM) -f __empty__.c -tags: - ctags -e -R $(TOP) - -include $(OBJ:.o=.P) diff --git a/py/moduerrno.c b/py/moduerrno.c index bbfca93875..a132474e4c 100644 --- a/py/moduerrno.c +++ b/py/moduerrno.c @@ -32,8 +32,6 @@ #include "supervisor/shared/translate/translate.h" -#if MICROPY_PY_UERRNO - // This list can be defined per port in mpconfigport.h to tailor it to a // specific port's needs. If it's not defined then we provide a default. #ifndef MICROPY_PY_UERRNO_LIST @@ -63,6 +61,8 @@ #endif +#if MICROPY_PY_UERRNO + #if MICROPY_PY_UERRNO_ERRORCODE STATIC const mp_rom_map_elem_t errorcode_table[] = { #define X(e) { MP_ROM_INT(MP_##e), MP_ROM_QSTR(MP_QSTR_##e) }, @@ -129,3 +129,52 @@ qstr mp_errno_to_str(mp_obj_t errno_val) { } #endif // MICROPY_PY_UERRNO + + +// For commonly encountered errors, return human readable strings, otherwise try errno name +const char *mp_common_errno_to_str(mp_obj_t errno_val, char *buf, size_t len) { + if (!mp_obj_is_small_int(errno_val)) { + return NULL; + } + + const compressed_string_t *desc = NULL; + switch (MP_OBJ_SMALL_INT_VALUE(errno_val)) { + case EPERM: + desc = MP_ERROR_TEXT("Operation not permitted"); + break; + case ENOENT: + desc = MP_ERROR_TEXT("No such file/directory"); + break; + case EIO: + desc = MP_ERROR_TEXT("Input/output error"); + break; + case EACCES: + desc = MP_ERROR_TEXT("Permission denied"); + break; + case EEXIST: + desc = MP_ERROR_TEXT("File exists"); + break; + case ENODEV: + desc = MP_ERROR_TEXT("No such device"); + break; + case EINVAL: + desc = MP_ERROR_TEXT("Invalid argument"); + break; + case ENOSPC: + desc = MP_ERROR_TEXT("No space left on device"); + break; + case EROFS: + desc = MP_ERROR_TEXT("Read-only filesystem"); + break; + } + if (desc != NULL && decompress_length(desc) <= len) { + decompress(desc, buf); + return buf; + } + + const char *msg = ""; + #if MICROPY_PY_UERRNO + msg = qstr_str(mp_errno_to_str(errno_val)); + #endif + return msg[0] != '\0' ? msg : NULL; +} diff --git a/py/mpconfig.h b/py/mpconfig.h index f38a4fc647..f890f675e1 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -26,8 +26,10 @@ #ifndef MICROPY_INCLUDED_PY_MPCONFIG_H #define MICROPY_INCLUDED_PY_MPCONFIG_H -// In CircuitPython, this is defined in genhdr/mpversion.h -#if !CIRCUITPY +// In CircuitPython, version info is in genhdr/mpversion.h. +#if CIRCUITPY +#include "genhdr/mpversion.h" +#else // Current version of MicroPython #define MICROPY_VERSION_MAJOR 1 #define MICROPY_VERSION_MINOR 19 diff --git a/py/mpstate.h b/py/mpstate.h index 04c3530736..6871e2b40a 100644 --- a/py/mpstate.h +++ b/py/mpstate.h @@ -36,6 +36,12 @@ #include "py/objlist.h" #include "py/objexcept.h" +// #if CIRCUITPY +// #error CIRCUITPY is TRUE in mpstate.h. +// #else +// #error CIRCUITPY is **FALSE** in mpstate.h +// #endif + // This file contains structures defining the state of the MicroPython // memory system, runtime and virtual machine. The state is a global // variable, but in the future it is hoped that the state can become local. diff --git a/py/py.mk b/py/py.mk index 44f34aad89..32d0f734a1 100644 --- a/py/py.mk +++ b/py/py.mk @@ -223,10 +223,7 @@ endif # Sources that may contain qstrings SRC_QSTR_IGNORE = py/nlr% -SRC_QSTR_EMITNATIVE = py/emitn% SRC_QSTR += $(SRC_MOD) $(filter-out $(SRC_QSTR_IGNORE),$(PY_CORE_O_BASENAME:.o=.c)) $(PY_EXTMOD_O_BASENAME:.o=.c) -# Sources that only hold QSTRs after pre-processing. -SRC_QSTR_PREPROCESSOR = $(addprefix $(TOP)/, $(filter $(SRC_QSTR_EMITNATIVE),$(PY_CORE_O_BASENAME:.o=.c))) # Anything that depends on FORCE will be considered out-of-date FORCE: @@ -240,41 +237,38 @@ $(HEADER_BUILD)/mpversion.h: FORCE | $(HEADER_BUILD) # overall config, so they need to be caught MPCONFIGPORT_MK = $(wildcard mpconfigport.mk) -$(HEADER_BUILD)/$(TRANSLATION).mo: $(TOP)/locale/$(TRANSLATION).po | $(HEADER_BUILD) - $(Q)$(PYTHON) $(TOP)/tools/msgfmt.py -o $@ $^ - -$(HEADER_BUILD)/qstrdefs.preprocessed.h: $(PY_QSTR_DEFS) $(QSTR_DEFS) $(QSTR_DEFS_COLLECTED) mpconfigport.h $(MPCONFIGPORT_MK) $(PY_SRC)/mpconfig.h | $(HEADER_BUILD) - $(STEPECHO) "GEN $@" - $(Q)cat $(PY_QSTR_DEFS) $(QSTR_DEFS) $(QSTR_DEFS_COLLECTED) | $(SED) 's/^Q(.*)/"&"/' | $(CPP) $(CFLAGS) - | $(SED) 's/^"\(Q(.*)\)"/\1/' > $@ - # qstr data -$(HEADER_BUILD)/qstrdefs.enum.h: $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/qstrdefs.preprocessed.h - $(STEPECHO) "GEN $@" - $(Q)$(PYTHON) $(PY_SRC)/makeqstrdata.py --output_type=enums $(HEADER_BUILD)/qstrdefs.preprocessed.h > $@ - # Adding an order only dependency on $(HEADER_BUILD) causes $(HEADER_BUILD) to get # created before we run the script to generate the .h # Note: we need to protect the qstr names from the preprocessor, so we wrap # the lines in "" and then unwrap after the preprocessor is finished. -$(HEADER_BUILD)/qstrdefs.generated.h: $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/qstrdefs.preprocessed.h - $(STEPECHO) "GEN $@" - $(Q)$(PYTHON) $(PY_SRC)/makeqstrdata.py --output_type=data $(HEADER_BUILD)/qstrdefs.preprocessed.h > $@ +# See more information about this process in docs/develop/qstr.rst. +$(HEADER_BUILD)/qstrdefs.generated.h: $(PY_QSTR_DEFS) $(QSTR_DEFS) $(QSTR_DEFS_COLLECTED) $(PY_SRC)/makeqstrdata.py mpconfigport.h $(MPCONFIGPORT_MK) $(PY_SRC)/mpconfig.h | $(HEADER_BUILD) + $(ECHO) "GEN $@" + $(Q)$(CAT) $(PY_QSTR_DEFS) $(QSTR_DEFS) $(QSTR_DEFS_COLLECTED) | $(SED) 's/^Q(.*)/"&"/' | $(CPP) $(CFLAGS) - | $(SED) 's/^\"\(Q(.*)\)\"/\1/' > $(HEADER_BUILD)/qstrdefs.preprocessed.h + $(Q)$(PYTHON) $(PY_SRC)/makeqstrdata.py $(HEADER_BUILD)/qstrdefs.preprocessed.h > $@ -# Is generated as a side-effect of building compression.generated.h +$(HEADER_BUILD)/compressed.data.h: $(HEADER_BUILD)/compressed.collected + $(ECHO) "GEN $@" + $(Q)$(PYTHON) $(PY_SRC)/makecompresseddata.py $< > $@ + +// CIRCUITPY: for translations +$(HEADER_BUILD)/$(TRANSLATION).mo: $(TOP)/locale/$(TRANSLATION).po | $(HEADER_BUILD) + $(Q)$(PYTHON) $(TOP)/tools/msgfmt.py -o $@ $^ + +# translations-*.c is generated as a side-effect of building compression_translated.generated.h # Specifying both in a single rule actually causes the rule to be run twice! # This alternative makes it run just once. -$(PY_BUILD)/translations-$(TRANSLATION).c: $(HEADER_BUILD)/compression.generated.h +$(PY_BUILD)/translations-$(TRANSLATION).c: $(HEADER_BUILD)/compressed_translations.generated.h @true -$(HEADER_BUILD)/compression.generated.h: $(PY_SRC)/maketranslationdata.py $(HEADER_BUILD)/$(TRANSLATION).mo $(HEADER_BUILD)/qstrdefs.preprocessed.h +$(HEADER_BUILD)/compressed_translations.generated.h: $(PY_SRC)/maketranslationdata.py $(HEADER_BUILD)/$(TRANSLATION).mo $(HEADER_BUILD)/qstrdefs.generated.h $(STEPECHO) "GEN $@" $(Q)mkdir -p $(PY_BUILD) - $(Q)$(PYTHON) $(PY_SRC)/maketranslationdata.py --compression_filename $(HEADER_BUILD)/compression.generated.h --translation $(HEADER_BUILD)/$(TRANSLATION).mo --translation_filename $(PY_BUILD)/translations-$(TRANSLATION).c $(HEADER_BUILD)/qstrdefs.preprocessed.h + $(Q)$(PYTHON) $(PY_SRC)/maketranslationdata.py --compression_filename $(HEADER_BUILD)/compressed_translations.generated.h --translation $(HEADER_BUILD)/$(TRANSLATION).mo --translation_filename $(PY_BUILD)/translations-$(TRANSLATION).c $(HEADER_BUILD)/qstrdefs.preprocessed.h PY_CORE_O += $(PY_BUILD)/translations-$(TRANSLATION).o -$(PY_BUILD)/qstr.o: $(HEADER_BUILD)/qstrdefs.generated.h - # build a list of registered modules for py/objmodule.c. $(HEADER_BUILD)/moduledefs.h: $(HEADER_BUILD)/moduledefs.collected @$(ECHO) "GEN $@" @@ -289,6 +283,7 @@ $(BUILD)/shared/libc/string0.o: CFLAGS += $(CFLAGS_BUILTIN) # that the function preludes are of a minimal and predictable form. $(PY_BUILD)/nlr%.o: CFLAGS += -Os +# CIRCUITPY: separate SUPEROPT for gc.o and vm.o # optimising gc for speed; 5ms down to 4ms on pybv2 ifndef SUPEROPT_GC SUPEROPT_GC = 1 diff --git a/shared-bindings/_bleio/Characteristic.c b/shared-bindings/_bleio/Characteristic.c index faad911c80..1f752577c1 100644 --- a/shared-bindings/_bleio/Characteristic.c +++ b/shared-bindings/_bleio/Characteristic.c @@ -142,7 +142,7 @@ STATIC mp_obj_t bleio_characteristic_add_to_service(size_t n_args, const mp_obj_ } bleio_characteristic_obj_t *characteristic = - m_new_obj(bleio_characteristic_obj_t, &bleio_characteristic_type); + mp_obj_malloc(bleio_characteristic_obj_t, &bleio_characteristic_type); // Range checking on max_length arg is done by the common_hal layer, because // it may vary depending on underlying BLE implementation. diff --git a/shared-bindings/audiomixer/Mixer.c b/shared-bindings/audiomixer/Mixer.c index adfc447589..6ddc5c3641 100644 --- a/shared-bindings/audiomixer/Mixer.c +++ b/shared-bindings/audiomixer/Mixer.c @@ -104,7 +104,7 @@ STATIC mp_obj_t audiomixer_mixer_make_new(const mp_obj_type_t *type, size_t n_ar mp_raise_ValueError(translate("bits_per_sample must be 8 or 16")); } audiomixer_mixer_obj_t *self = - mp_obj_malloc_var(audiomixer_mixer_obj_t, mp_obj_t, voice_count, &audiomixer_mixer_type; + mp_obj_malloc_var(audiomixer_mixer_obj_t, mp_obj_t, voice_count, &audiomixer_mixer_type); common_hal_audiomixer_mixer_construct(self, voice_count, args[ARG_buffer_size].u_int, bits_per_sample, args[ARG_samples_signed].u_bool, channel_count, sample_rate); for (int v = 0; v < voice_count; v++) { diff --git a/shared-bindings/countio/__init__.c b/shared-bindings/countio/__init__.c index 9646e0879e..c8327c9a57 100644 --- a/shared-bindings/countio/__init__.c +++ b/shared-bindings/countio/__init__.c @@ -36,4 +36,3 @@ const mp_obj_module_t countio_module = { }; MP_REGISTER_MODULE(MP_QSTR_countio, countio_module); -p diff --git a/shared-bindings/displayio/EPaperDisplay.c b/shared-bindings/displayio/EPaperDisplay.c index f4f97ff971..cca8c919cc 100644 --- a/shared-bindings/displayio/EPaperDisplay.c +++ b/shared-bindings/displayio/EPaperDisplay.c @@ -206,7 +206,7 @@ STATIC mp_obj_t displayio_epaperdisplay_make_new(const mp_obj_type_t *type, size size_t refresh_buf_len = 0; mp_int_t refresh_command; if (mp_obj_get_int_maybe(refresh_obj, &refresh_command)) { - uint8_t *command_buf = m_malloc(3, true); + uint8_t *command_buf = m_malloc(3); command_buf[0] = refresh_command; command_buf[1] = 0; command_buf[2] = 0; diff --git a/shared-bindings/i2ctarget/I2CTarget.c b/shared-bindings/i2ctarget/I2CTarget.c index 4346362632..1bc672032d 100644 --- a/shared-bindings/i2ctarget/I2CTarget.c +++ b/shared-bindings/i2ctarget/I2CTarget.c @@ -41,7 +41,7 @@ STATIC mp_obj_t mp_obj_new_i2ctarget_i2c_target_request(i2ctarget_i2c_target_obj_t *target, uint8_t address, bool is_read, bool is_restart) { i2ctarget_i2c_target_request_obj_t *self = - mp_obj_malloc(i2ctarget_i2c_target_request_obj_t, &i2ctarget_i2c_target_request_type) + mp_obj_malloc(i2ctarget_i2c_target_request_obj_t, &i2ctarget_i2c_target_request_type); self->target = target; self->address = address; self->is_read = is_read; diff --git a/shared-bindings/synthio/__init__.c b/shared-bindings/synthio/__init__.c index f9d9de86c7..34e03419fa 100644 --- a/shared-bindings/synthio/__init__.c +++ b/shared-bindings/synthio/__init__.c @@ -244,7 +244,7 @@ STATIC mp_obj_t synthio_from_file(size_t n_args, const mp_obj_t *pos_args, mp_ma } uint32_t track_size = (chunk_header[4] << 24) | (chunk_header[5] << 16) | (chunk_header[6] << 8) | chunk_header[7]; - uint8_t *buffer = m_malloc(track_size, false); + uint8_t *buffer = m_malloc(track_size); if (f_read(&file->fp, buffer, track_size, &bytes_read) != FR_OK) { mp_raise_OSError(MP_EIO); } diff --git a/shared-module/_bleio/ScanResults.c b/shared-module/_bleio/ScanResults.c index ad7841cfa9..cf4357929b 100644 --- a/shared-module/_bleio/ScanResults.c +++ b/shared-module/_bleio/ScanResults.c @@ -36,7 +36,7 @@ bleio_scanresults_obj_t *shared_module_bleio_new_scanresults(size_t buffer_size, uint8_t *prefixes, size_t prefixes_len, mp_int_t minimum_rssi) { bleio_scanresults_obj_t *self = mp_obj_malloc(bleio_scanresults_obj_t, &bleio_scanresults_type); - ringbuf_alloc(&self->buf, buffer_size, false); + ringbuf_alloc(&self->buf, buffer_size); self->prefixes = prefixes; self->prefix_length = prefixes_len; self->minimum_rssi = minimum_rssi; diff --git a/shared-module/adafruit_pixelbuf/PixelBuf.c b/shared-module/adafruit_pixelbuf/PixelBuf.c index ca8f1c05b0..9c12dd68de 100644 --- a/shared-module/adafruit_pixelbuf/PixelBuf.c +++ b/shared-module/adafruit_pixelbuf/PixelBuf.c @@ -123,7 +123,7 @@ void common_hal_adafruit_pixelbuf_pixelbuf_set_brightness(mp_obj_t self_in, mp_f return; } else { if (self->pre_brightness_buffer == NULL) { - self->pre_brightness_buffer = m_malloc(pixel_len, false); + self->pre_brightness_buffer = m_malloc(pixel_len); memcpy(self->pre_brightness_buffer, self->post_brightness_buffer, pixel_len); } for (size_t i = 0; i < pixel_len; i++) { diff --git a/shared-module/atexit/__init__.c b/shared-module/atexit/__init__.c index 56271bbab8..02749a45a1 100644 --- a/shared-module/atexit/__init__.c +++ b/shared-module/atexit/__init__.c @@ -50,7 +50,7 @@ void shared_module_atexit_register(mp_obj_t *func, size_t n_args, const mp_obj_t .n_pos = 0, .n_kw = 0, .func = func, - .args = (n_args + n_kw_args) ? m_malloc((n_args + (n_kw_args * 2)) * sizeof(mp_obj_t), false) : NULL + .args = (n_args + n_kw_args) ? m_malloc((n_args + (n_kw_args * 2)) * sizeof(mp_obj_t)) : NULL }; for (; cb.n_pos < n_args; cb.n_pos++) { cb.args[cb.n_pos] = pos_args[cb.n_pos]; diff --git a/shared-module/audiocore/WaveFile.c b/shared-module/audiocore/WaveFile.c index 1b87532551..590148f5c3 100644 --- a/shared-module/audiocore/WaveFile.c +++ b/shared-module/audiocore/WaveFile.c @@ -118,13 +118,13 @@ void common_hal_audioio_wavefile_construct(audioio_wavefile_obj_t *self, self->second_buffer = buffer + self->len; } else { self->len = 256; - self->buffer = m_malloc(self->len, false); + self->buffer = m_malloc(self->len); if (self->buffer == NULL) { common_hal_audioio_wavefile_deinit(self); m_malloc_fail(self->len); } - self->second_buffer = m_malloc(self->len, false); + self->second_buffer = m_malloc(self->len); if (self->second_buffer == NULL) { common_hal_audioio_wavefile_deinit(self); m_malloc_fail(self->len); diff --git a/shared-module/audiomixer/Mixer.c b/shared-module/audiomixer/Mixer.c index 397a837133..5a0338cb4a 100644 --- a/shared-module/audiomixer/Mixer.c +++ b/shared-module/audiomixer/Mixer.c @@ -47,13 +47,13 @@ void common_hal_audiomixer_mixer_construct(audiomixer_mixer_obj_t *self, uint32_t sample_rate) { self->len = buffer_size / 2 / sizeof(uint32_t) * sizeof(uint32_t); - self->first_buffer = m_malloc(self->len, false); + self->first_buffer = m_malloc(self->len); if (self->first_buffer == NULL) { common_hal_audiomixer_mixer_deinit(self); m_malloc_fail(self->len); } - self->second_buffer = m_malloc(self->len, false); + self->second_buffer = m_malloc(self->len); if (self->second_buffer == NULL) { common_hal_audiomixer_mixer_deinit(self); m_malloc_fail(self->len); diff --git a/shared-module/audiomp3/MP3Decoder.c b/shared-module/audiomp3/MP3Decoder.c index 506ed5eff2..21385670a2 100644 --- a/shared-module/audiomp3/MP3Decoder.c +++ b/shared-module/audiomp3/MP3Decoder.c @@ -190,7 +190,7 @@ void common_hal_audiomp3_mp3file_construct(audiomp3_mp3file_obj_t *self, self->inbuf_length = 2048; self->inbuf_offset = self->inbuf_length; - self->inbuf = m_malloc(self->inbuf_length, false); + self->inbuf = m_malloc(self->inbuf_length); if (self->inbuf == NULL) { common_hal_audiomp3_mp3file_deinit(self); m_malloc_fail(self->inbuf_length); @@ -210,13 +210,13 @@ void common_hal_audiomp3_mp3file_construct(audiomp3_mp3file_obj_t *self, self->buffers[0] = (int16_t *)(void *)buffer; self->buffers[1] = (int16_t *)(void *)(buffer + MAX_BUFFER_LEN); } else { - self->buffers[0] = m_malloc(MAX_BUFFER_LEN, false); + self->buffers[0] = m_malloc(MAX_BUFFER_LEN); if (self->buffers[0] == NULL) { common_hal_audiomp3_mp3file_deinit(self); m_malloc_fail(MAX_BUFFER_LEN); } - self->buffers[1] = m_malloc(MAX_BUFFER_LEN, false); + self->buffers[1] = m_malloc(MAX_BUFFER_LEN); if (self->buffers[1] == NULL) { common_hal_audiomp3_mp3file_deinit(self); m_malloc_fail(MAX_BUFFER_LEN); diff --git a/shared-module/displayio/Bitmap.c b/shared-module/displayio/Bitmap.c index c9212f6a85..6c2072f3fd 100644 --- a/shared-module/displayio/Bitmap.c +++ b/shared-module/displayio/Bitmap.c @@ -51,7 +51,7 @@ void common_hal_displayio_bitmap_construct_from_buffer(displayio_bitmap_t *self, self->stride = stride(width, bits_per_value); self->data_alloc = false; if (!data) { - data = m_malloc(self->stride * height * sizeof(uint32_t), false); + data = m_malloc(self->stride * height * sizeof(uint32_t)); self->data_alloc = true; } self->data = data; diff --git a/shared-module/displayio/OnDiskBitmap.c b/shared-module/displayio/OnDiskBitmap.c index 98795a28ab..789b84787a 100644 --- a/shared-module/displayio/OnDiskBitmap.c +++ b/shared-module/displayio/OnDiskBitmap.c @@ -68,7 +68,7 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, self->height = read_word(bmp_header, 11); displayio_colorconverter_t *colorconverter = - mp_obj_malloc(displayio_colorconverter_t, &displayio_colorconverter_type; + mp_obj_malloc(displayio_colorconverter_t, &displayio_colorconverter_type); common_hal_displayio_colorconverter_construct(colorconverter, false, DISPLAYIO_COLORSPACE_RGB888); self->colorconverter = colorconverter; @@ -95,7 +95,7 @@ void common_hal_displayio_ondiskbitmap_construct(displayio_ondiskbitmap_t *self, uint16_t palette_size = number_of_colors * sizeof(uint32_t); uint16_t palette_offset = 0xe + header_size; - uint32_t *palette_data = m_malloc(palette_size, false); + uint32_t *palette_data = m_malloc(palette_size); f_rewind(&self->file->fp); f_lseek(&self->file->fp, palette_offset); diff --git a/shared-module/displayio/Palette.c b/shared-module/displayio/Palette.c index c61b9ebc82..8cd2da8973 100644 --- a/shared-module/displayio/Palette.c +++ b/shared-module/displayio/Palette.c @@ -30,7 +30,7 @@ void common_hal_displayio_palette_construct(displayio_palette_t *self, uint16_t color_count, bool dither) { self->color_count = color_count; - self->colors = (_displayio_color_t *)m_malloc(color_count * sizeof(_displayio_color_t), false); + self->colors = (_displayio_color_t *)m_malloc(color_count * sizeof(_displayio_color_t)); self->dither = dither; } diff --git a/shared-module/displayio/Shape.c b/shared-module/displayio/Shape.c index 1d6db5bd69..25c5d1527a 100644 --- a/shared-module/displayio/Shape.c +++ b/shared-module/displayio/Shape.c @@ -49,7 +49,7 @@ void common_hal_displayio_shape_construct(displayio_shape_t *self, uint32_t widt } self->half_height = height; - self->data = m_malloc(height * sizeof(uint32_t), false); + self->data = m_malloc(height * sizeof(uint32_t)); for (uint16_t i = 0; i < height; i++) { self->data[2 * i] = 0; diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index 723aa41682..0a000ca180 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -48,7 +48,7 @@ void common_hal_displayio_tilegrid_construct(displayio_tilegrid_t *self, mp_obj_ } self->inline_tiles = true; } else { - self->tiles = (uint8_t *)m_malloc(total_tiles, false); + self->tiles = (uint8_t *)m_malloc(total_tiles); for (uint32_t i = 0; i < total_tiles; i++) { self->tiles[i] = default_tile; } diff --git a/shared-module/gifio/GifWriter.c b/shared-module/gifio/GifWriter.c index c993a87d0a..9167de75a0 100644 --- a/shared-module/gifio/GifWriter.c +++ b/shared-module/gifio/GifWriter.c @@ -90,7 +90,7 @@ void shared_module_gifio_gifwriter_construct(gifio_gifwriter_t *self, mp_obj_t * size_t nblocks = (width * height + 125) / 126; self->size = nblocks * 128 + 4; - self->data = gc_alloc(self->size, 0, false); + self->data = m_malloc(self->size); self->cur = 0; self->error = 0; diff --git a/shared-module/keypad/EventQueue.c b/shared-module/keypad/EventQueue.c index d229eef264..36d7d9dff5 100644 --- a/shared-module/keypad/EventQueue.c +++ b/shared-module/keypad/EventQueue.c @@ -35,7 +35,7 @@ void common_hal_keypad_eventqueue_construct(keypad_eventqueue_obj_t *self, size_t max_events) { // Event queue is 16-bit values. - ringbuf_alloc(&self->encoded_events, max_events * (sizeof(uint16_t) + sizeof(mp_obj_t)), false); + ringbuf_alloc(&self->encoded_events, max_events * (sizeof(uint16_t) + sizeof(mp_obj_t))); self->overflowed = false; } diff --git a/shared-module/keypad/KeyMatrix.c b/shared-module/keypad/KeyMatrix.c index bab9fb3095..df5c55b3f7 100644 --- a/shared-module/keypad/KeyMatrix.c +++ b/shared-module/keypad/KeyMatrix.c @@ -72,8 +72,8 @@ void common_hal_keypad_keymatrix_construct(keypad_keymatrix_obj_t *self, mp_uint } self->column_digitalinouts = mp_obj_new_tuple(num_column_pins, column_dios); - self->currently_pressed = (bool *)gc_alloc(sizeof(bool) * num_row_pins * num_column_pins, false, false); - self->previously_pressed = (bool *)gc_alloc(sizeof(bool) * num_row_pins * num_column_pins, false, false); + self->currently_pressed = (bool *)m_malloc(sizeof(bool) * num_row_pins * num_column_pins); + self->previously_pressed = (bool *)m_malloc(sizeof(bool) * num_row_pins * num_column_pins); self->columns_to_anodes = columns_to_anodes; self->funcs = &keymatrix_funcs; diff --git a/shared-module/keypad/Keys.c b/shared-module/keypad/Keys.c index aea7418b01..22ad7cc7fb 100644 --- a/shared-module/keypad/Keys.c +++ b/shared-module/keypad/Keys.c @@ -58,8 +58,8 @@ void common_hal_keypad_keys_construct(keypad_keys_obj_t *self, mp_uint_t num_pin } self->digitalinouts = mp_obj_new_tuple(num_pins, dios); - self->currently_pressed = (bool *)gc_alloc(sizeof(bool) * num_pins, false, false); - self->previously_pressed = (bool *)gc_alloc(sizeof(bool) * num_pins, false, false); + self->currently_pressed = (bool *)m_malloc(sizeof(bool) * num_pins); + self->previously_pressed = (bool *)m_malloc(sizeof(bool) * num_pins); self->value_when_pressed = value_when_pressed; self->funcs = &keys_funcs; diff --git a/shared-module/keypad/__init__.c b/shared-module/keypad/__init__.c index 755dbb4f2d..68cde559fb 100644 --- a/shared-module/keypad/__init__.c +++ b/shared-module/keypad/__init__.c @@ -101,8 +101,8 @@ void keypad_deregister_scanner(keypad_scanner_obj_t *scanner) { void keypad_construct_common(keypad_scanner_obj_t *self, mp_float_t interval, size_t max_events) { size_t key_count = common_hal_keypad_generic_get_key_count(self); - self->currently_pressed = (bool *)gc_alloc(sizeof(bool) * key_count, false, false); - self->previously_pressed = (bool *)gc_alloc(sizeof(bool) * key_count, false, false); + self->currently_pressed = (bool *)m_malloc(sizeof(bool) * key_count); + self->previously_pressed = (bool *)m_malloc(sizeof(bool) * key_count); self->interval_ticks = (mp_uint_t)(interval * 1024); // interval * 1000 * (1024/1000) diff --git a/shared-module/qrio/quirc_alloc.h b/shared-module/qrio/quirc_alloc.h index b01fac5bfb..7521fc087d 100644 --- a/shared-module/qrio/quirc_alloc.h +++ b/shared-module/qrio/quirc_alloc.h @@ -7,8 +7,8 @@ #error Requires MICROPY_GC_CONSERVATIVE_CLEAR #endif -#define QUIRC_MALLOC(x) gc_alloc((x), 0, false) -#define QUIRC_CALLOC(x,y) gc_alloc((x) * (y), 0, false) +#define QUIRC_MALLOC(x) m_malloc((x)) +#define QUIRC_CALLOC(x,y) m_malloc((x) * (y)) #define QUIRC_FREE(x) gc_free((x)) #define QUIRC_SMALL_STACK (1) diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index 7c8e627404..3d034db88a 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -438,11 +438,11 @@ void synthio_synth_init(synthio_synth_t *synth, uint32_t sample_rate, int channe synthio_synth_parse_filter(&synth->filter_bufinfo, filter_obj); mp_arg_validate_int_range(channel_count, 1, 2, MP_QSTR_channel_count); synth->buffer_length = SYNTHIO_MAX_DUR * SYNTHIO_BYTES_PER_SAMPLE * channel_count; - synth->buffers[0] = m_malloc(synth->buffer_length, false); - synth->buffers[1] = m_malloc(synth->buffer_length, false); + synth->buffers[0] = m_malloc(synth->buffer_length); + synth->buffers[1] = m_malloc(synth->buffer_length); if (synth->filter_bufinfo.len) { synth->filter_buffer_length = (synth->filter_bufinfo.len + SYNTHIO_MAX_DUR) * channel_count * sizeof(int32_t); - synth->filter_buffer = m_malloc(synth->filter_buffer_length, false); + synth->filter_buffer = m_malloc(synth->filter_buffer_length); } synth->channel_count = channel_count; synth->other_channel = -1; diff --git a/supervisor/shared/external_flash/external_flash.c b/supervisor/shared/external_flash/external_flash.c index f72518ac50..8d6938713d 100644 --- a/supervisor/shared/external_flash/external_flash.c +++ b/supervisor/shared/external_flash/external_flash.c @@ -371,7 +371,7 @@ static bool allocate_ram_cache(void) { return false; } - MP_STATE_VM(flash_ram_cache) = m_malloc_maybe(blocks_per_sector * pages_per_block * sizeof(uint32_t), false); + MP_STATE_VM(flash_ram_cache) = m_malloc_maybe(blocks_per_sector * pages_per_block * sizeof(uint32_t)); if (MP_STATE_VM(flash_ram_cache) == NULL) { return false; } @@ -382,7 +382,7 @@ static bool allocate_ram_cache(void) { bool success = true; for (i = 0; i < blocks_per_sector; i++) { for (j = 0; j < pages_per_block; j++) { - uint8_t *page_cache = m_malloc_maybe(SPI_FLASH_PAGE_SIZE, false); + uint8_t *page_cache = m_malloc_maybe(SPI_FLASH_PAGE_SIZE); if (page_cache == NULL) { success = false; break; diff --git a/supervisor/shared/translate/translate.c b/supervisor/shared/translate/translate.c index b07aa584ca..fced90f058 100644 --- a/supervisor/shared/translate/translate.c +++ b/supervisor/shared/translate/translate.c @@ -31,7 +31,7 @@ #include #ifndef NO_QSTR -#include "genhdr/compression.generated.h" +#include "genhdr/compressed_translations.generated.h" #endif #include "py/misc.h" diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index c461c5353f..50722bb1a2 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -85,6 +85,7 @@ else SRC_SUPERVISOR += supervisor/qspi_flash.c supervisor/shared/external_flash/qspi_flash.c endif +OBJ_EXTRA_ORDER_DEPS += $(HEADER_BUILD)/devices.h $(HEADER_BUILD)/devices.h : ../../supervisor/shared/external_flash/devices.h.jinja ../../tools/gen_nvm_devices.py | $(HEADER_BUILD) $(STEPECHO) "GEN $@" $(Q)install -d $(BUILD)/genhdr @@ -224,7 +225,7 @@ endif USB_HIGHSPEED ?= 0 CFLAGS += -DUSB_HIGHSPEED=$(USB_HIGHSPEED) -$(BUILD)/supervisor/shared/translate/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/compression.generated.h +$(BUILD)/supervisor/shared/translate/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/compressed_translations.generated.h CIRCUITPY_DISPLAY_FONT ?= "../../tools/fonts/ter-u12n.bdf" From 10b94796c0ff2aa077f0ce9fd7c53f7cf2c12113 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 11 Aug 2023 00:30:34 -0400 Subject: [PATCH 1459/1712] wip; fix more m_malloc and gc_alloc --- devices/ble_hci/common-hal/_bleio/Adapter.c | 2 +- ports/cxd56/common-hal/pulseio/PulseIn.c | 2 +- ports/espressif/common-hal/_bleio/CharacteristicBuffer.c | 2 +- ports/espressif/common-hal/_bleio/PacketBuffer.c | 4 ++-- ports/espressif/common-hal/mdns/Server.c | 2 +- ports/espressif/common-hal/nvm/ByteArray.c | 2 +- ports/espressif/common-hal/pulseio/PulseIn.c | 2 +- ports/mimxrt10xx/common-hal/audiobusio/__init__.c | 2 +- ports/nrf/bluetooth/ble_drv.c | 2 +- ports/nrf/common-hal/_bleio/Adapter.c | 2 +- ports/nrf/common-hal/_bleio/Characteristic.c | 2 +- ports/nrf/common-hal/_bleio/CharacteristicBuffer.c | 2 +- ports/nrf/common-hal/_bleio/PacketBuffer.c | 6 +++--- ports/nrf/common-hal/audiobusio/I2SOut.c | 4 ++-- ports/nrf/common-hal/audiopwmio/PWMAudioOut.c | 4 ++-- ports/nrf/common-hal/busio/UART.c | 2 +- ports/nrf/common-hal/pulseio/PulseIn.c | 2 +- ports/raspberrypi/common-hal/mdns/Server.c | 2 +- ports/raspberrypi/common-hal/pulseio/PulseIn.c | 2 +- ports/silabs/common-hal/_bleio/CharacteristicBuffer.c | 2 +- ports/silabs/common-hal/_bleio/PacketBuffer.c | 6 +++--- ports/stm/common-hal/audiopwmio/PWMAudioOut.c | 4 ++-- ports/stm/common-hal/pulseio/PulseIn.c | 2 +- py/dynruntime.h | 2 +- py/py.mk | 2 +- py/ringbuf.c | 2 +- shared-bindings/audiocore/__init__.c | 2 +- 27 files changed, 35 insertions(+), 35 deletions(-) diff --git a/devices/ble_hci/common-hal/_bleio/Adapter.c b/devices/ble_hci/common-hal/_bleio/Adapter.c index bd936f3687..b1f71b8cde 100644 --- a/devices/ble_hci/common-hal/_bleio/Adapter.c +++ b/devices/ble_hci/common-hal/_bleio/Adapter.c @@ -479,7 +479,7 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t self->scan_results = shared_module_bleio_new_scanresults(buffer_size, prefixes, prefix_length, minimum_rssi); // size_t max_packet_size = extended ? BLE_GAP_SCAN_BUFFER_EXTENDED_MAX_SUPPORTED : BLE_GAP_SCAN_BUFFER_MAX; - // uint8_t *raw_data = m_malloc(sizeof(ble_data_t) + max_packet_size, false); + // uint8_t *raw_data = m_malloc(sizeof(ble_data_t) + max_packet_size); // ble_data_t * sd_data = (ble_data_t *) raw_data; // self->scan_results->common_hal_data = sd_data; // sd_data->len = max_packet_size; diff --git a/ports/cxd56/common-hal/pulseio/PulseIn.c b/ports/cxd56/common-hal/pulseio/PulseIn.c index 165e2a6ece..989acd491c 100644 --- a/ports/cxd56/common-hal/pulseio/PulseIn.c +++ b/ports/cxd56/common-hal/pulseio/PulseIn.c @@ -85,7 +85,7 @@ static int pulsein_interrupt_handler(int irq, FAR void *context, FAR void *arg) void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu_pin_obj_t *pin, uint16_t maxlen, bool idle_state) { - self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t), false); + self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t)); if (self->buffer == NULL) { m_malloc_fail(maxlen * sizeof(uint16_t)); } diff --git a/ports/espressif/common-hal/_bleio/CharacteristicBuffer.c b/ports/espressif/common-hal/_bleio/CharacteristicBuffer.c index cfc6018708..6838f1a8ff 100644 --- a/ports/espressif/common-hal/_bleio/CharacteristicBuffer.c +++ b/ports/espressif/common-hal/_bleio/CharacteristicBuffer.c @@ -103,7 +103,7 @@ void common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buffe bleio_characteristic_obj_t *characteristic, mp_float_t timeout, size_t buffer_size) { - uint8_t *buffer = m_malloc(buffer_size, true); + uint8_t *buffer = m_malloc(buffer_size); _common_hal_bleio_characteristic_buffer_construct(self, characteristic, timeout, buffer, buffer_size, NULL, false); } diff --git a/ports/espressif/common-hal/_bleio/PacketBuffer.c b/ports/espressif/common-hal/_bleio/PacketBuffer.c index d1d8c24123..4e2268f350 100644 --- a/ports/espressif/common-hal/_bleio/PacketBuffer.c +++ b/ports/espressif/common-hal/_bleio/PacketBuffer.c @@ -225,11 +225,11 @@ void common_hal_bleio_packet_buffer_construct( uint32_t *outgoing1 = NULL; uint32_t *outgoing2 = NULL; if (outgoing) { - outgoing1 = m_malloc(max_packet_size, false); + outgoing1 = m_malloc(max_packet_size); // Only allocate the second buffer if we are doing writes with responses. // Without responses, we just write as quickly as we can. if (outgoing == CHAR_PROP_WRITE) { - outgoing2 = m_malloc(max_packet_size, false); + outgoing2 = m_malloc(max_packet_size); } } diff --git a/ports/espressif/common-hal/mdns/Server.c b/ports/espressif/common-hal/mdns/Server.c index 18c0f0f5e4..9205f76087 100644 --- a/ports/espressif/common-hal/mdns/Server.c +++ b/ports/espressif/common-hal/mdns/Server.c @@ -190,7 +190,7 @@ mp_obj_t common_hal_mdns_server_find(mdns_server_obj_t *self, const char *servic // Don't error if we're out of memory. Instead, truncate the tuple. uint8_t added = 0; while (next != NULL) { - mdns_remoteservice_obj_t *service = gc_alloc(sizeof(mdns_remoteservice_obj_t), GC_ALLOC_FLAG_HAS_FINALISER, false); + mdns_remoteservice_obj_t *service = gc_alloc(sizeof(mdns_remoteservice_obj_t), GC_ALLOC_FLAG_HAS_FINALISER); if (service == NULL) { if (added == 0) { m_malloc_fail(sizeof(mdns_remoteservice_obj_t)); diff --git a/ports/espressif/common-hal/nvm/ByteArray.c b/ports/espressif/common-hal/nvm/ByteArray.c index a17e368249..77e3086b88 100644 --- a/ports/espressif/common-hal/nvm/ByteArray.c +++ b/ports/espressif/common-hal/nvm/ByteArray.c @@ -66,7 +66,7 @@ static esp_err_t get_bytes(nvs_handle_t handle, uint8_t **buf_out) { *buf_out = NULL; return result; } - buf = gc_alloc(size, 0, false); // this SHOULD be the same as + buf = m_m_alloc(size); // this SHOULD be the same as if (result == ESP_OK) { result = nvs_get_blob(handle, "data", buf, &size); } else { diff --git a/ports/espressif/common-hal/pulseio/PulseIn.c b/ports/espressif/common-hal/pulseio/PulseIn.c index 42db2f18bd..c873f13b4a 100644 --- a/ports/espressif/common-hal/pulseio/PulseIn.c +++ b/ports/espressif/common-hal/pulseio/PulseIn.c @@ -95,7 +95,7 @@ void pulsein_reset(void) { void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu_pin_obj_t *pin, uint16_t maxlen, bool idle_state) { - self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t), false); + self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t)); if (self->buffer == NULL) { m_malloc_fail(maxlen * sizeof(uint16_t)); } diff --git a/ports/mimxrt10xx/common-hal/audiobusio/__init__.c b/ports/mimxrt10xx/common-hal/audiobusio/__init__.c index 13ae64d27c..96f9ed8138 100644 --- a/ports/mimxrt10xx/common-hal/audiobusio/__init__.c +++ b/ports/mimxrt10xx/common-hal/audiobusio/__init__.c @@ -329,7 +329,7 @@ void port_i2s_initialize(i2s_t *self, int instance, sai_transceiver_t *config) { mp_raise_ValueError_varg(translate("Invalid %q"), MP_QSTR_I2SOut); } for (size_t i = 0; i < MP_ARRAY_SIZE(self->buffers); i++) { - self->buffers[i] = m_malloc(AUDIO_BUFFER_FRAME_COUNT * sizeof(uint32_t), false); + self->buffers[i] = m_malloc(AUDIO_BUFFER_FRAME_COUNT * sizeof(uint32_t)); } self->peripheral = peripheral; SAI_Init(self->peripheral); diff --git a/ports/nrf/bluetooth/ble_drv.c b/ports/nrf/bluetooth/ble_drv.c index cf3f9382d7..e3914e6a18 100644 --- a/ports/nrf/bluetooth/ble_drv.c +++ b/ports/nrf/bluetooth/ble_drv.c @@ -95,7 +95,7 @@ void ble_drv_add_event_handler(ble_drv_evt_handler_t func, void *param) { } // Add a new handler to the front of the list - ble_drv_evt_handler_entry_t *handler = m_new_ll(ble_drv_evt_handler_entry_t, 1); + ble_drv_evt_handler_entry_t *handler = m_new(ble_drv_evt_handler_entry_t, 1); ble_drv_add_event_handler_entry(handler, func, param); } diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c index 1452eb56a9..e3b8fc22f5 100644 --- a/ports/nrf/common-hal/_bleio/Adapter.c +++ b/ports/nrf/common-hal/_bleio/Adapter.c @@ -544,7 +544,7 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t } self->scan_results = shared_module_bleio_new_scanresults(buffer_size, prefixes, prefix_length, minimum_rssi); size_t max_packet_size = extended ? BLE_GAP_SCAN_BUFFER_EXTENDED_MAX_SUPPORTED : BLE_GAP_SCAN_BUFFER_MAX; - uint8_t *raw_data = m_malloc(sizeof(ble_data_t) + max_packet_size, false); + uint8_t *raw_data = m_malloc(sizeof(ble_data_t) + max_packet_size); ble_data_t *sd_data = (ble_data_t *)raw_data; self->scan_results->common_hal_data = sd_data; sd_data->len = max_packet_size; diff --git a/ports/nrf/common-hal/_bleio/Characteristic.c b/ports/nrf/common-hal/_bleio/Characteristic.c index e911e5a1e3..5a70fb9cea 100644 --- a/ports/nrf/common-hal/_bleio/Characteristic.c +++ b/ports/nrf/common-hal/_bleio/Characteristic.c @@ -102,7 +102,7 @@ void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self, self->initial_value_len = initial_value_bufinfo->len; if (gc_alloc_possible()) { if (gc_nbytes(initial_value_bufinfo->buf) > 0) { - uint8_t *initial_value = m_malloc(self->initial_value_len, false); + uint8_t *initial_value = m_malloc(self->initial_value_len); memcpy(initial_value, initial_value_bufinfo->buf, self->initial_value_len); self->initial_value = initial_value; } else { diff --git a/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c index 58dc94fe25..0c89a6f2a9 100644 --- a/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c +++ b/ports/nrf/common-hal/_bleio/CharacteristicBuffer.c @@ -116,7 +116,7 @@ void common_hal_bleio_characteristic_buffer_construct(bleio_characteristic_buffe bleio_characteristic_obj_t *characteristic, mp_float_t timeout, size_t buffer_size) { - uint8_t *buffer = m_malloc(buffer_size, true); + uint8_t *buffer = m_malloc(buffer_size); _common_hal_bleio_characteristic_buffer_construct(self, characteristic, timeout, buffer, buffer_size, NULL, false); } diff --git a/ports/nrf/common-hal/_bleio/PacketBuffer.c b/ports/nrf/common-hal/_bleio/PacketBuffer.c index 52402a93f1..7a2ccae673 100644 --- a/ports/nrf/common-hal/_bleio/PacketBuffer.c +++ b/ports/nrf/common-hal/_bleio/PacketBuffer.c @@ -298,14 +298,14 @@ void common_hal_bleio_packet_buffer_construct( uint32_t *incoming_buffer = NULL; if (incoming) { incoming_buffer_size = buffer_size * (sizeof(uint16_t) + max_packet_size); - incoming_buffer = m_malloc(incoming_buffer_size, false); + incoming_buffer = m_malloc(incoming_buffer_size); } uint32_t *outgoing1 = NULL; uint32_t *outgoing2 = NULL; if (outgoing) { - outgoing1 = m_malloc(max_packet_size, false); - outgoing2 = m_malloc(max_packet_size, false); + outgoing1 = m_malloc(max_packet_size); + outgoing2 = m_malloc(max_packet_size); } _common_hal_bleio_packet_buffer_construct(self, characteristic, incoming_buffer, incoming_buffer_size, diff --git a/ports/nrf/common-hal/audiobusio/I2SOut.c b/ports/nrf/common-hal/audiobusio/I2SOut.c index 6e68583a03..35e50162a2 100644 --- a/ports/nrf/common-hal/audiobusio/I2SOut.c +++ b/ports/nrf/common-hal/audiobusio/I2SOut.c @@ -286,8 +286,8 @@ void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t *self, self->buffer_length = sample_rate * buffer_length_ms * self->bytes_per_sample * self->channel_count / 1000; self->buffer_length = (self->buffer_length + 3) & ~3; - self->buffers[0] = m_malloc(self->buffer_length, false); - self->buffers[1] = m_malloc(self->buffer_length, false); + self->buffers[0] = m_malloc(self->buffer_length); + self->buffers[1] = m_malloc(self->buffer_length); audiosample_reset_buffer(self->sample, false, 0); diff --git a/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c b/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c index bc6302cb42..2334db851a 100644 --- a/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c +++ b/ports/nrf/common-hal/audiopwmio/PWMAudioOut.c @@ -266,9 +266,9 @@ void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t *self, mp_arg_validate_length_max(max_buffer_length, UINT16_MAX, MP_QSTR_buffer); uint16_t buffer_length = (uint16_t)max_buffer_length; - self->buffers[0] = m_malloc(buffer_length * 2 * sizeof(uint16_t), false); + self->buffers[0] = m_malloc(buffer_length * 2 * sizeof(uint16_t)); if (!self->single_buffer) { - self->buffers[1] = m_malloc(buffer_length * 2 * sizeof(uint16_t), false); + self->buffers[1] = m_malloc(buffer_length * 2 * sizeof(uint16_t)); } diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index f916c28b7f..012ca894fe 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -346,7 +346,7 @@ size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, if (!nrfx_is_in_ram(data)) { // Allocate long strings on the heap. if (len > 128 && gc_alloc_possible()) { - tx_buf = (uint8_t *)gc_alloc(len, false, false); + tx_buf = (uint8_t *)m_m_alloc(len); } else { tx_buf = alloca(len); } diff --git a/ports/nrf/common-hal/pulseio/PulseIn.c b/ports/nrf/common-hal/pulseio/PulseIn.c index 757c56a4ac..0c1452f5a0 100644 --- a/ports/nrf/common-hal/pulseio/PulseIn.c +++ b/ports/nrf/common-hal/pulseio/PulseIn.c @@ -127,7 +127,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu } _objs[idx] = self; - self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t), false); + self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t)); if (self->buffer == NULL) { m_malloc_fail(maxlen * sizeof(uint16_t)); } diff --git a/ports/raspberrypi/common-hal/mdns/Server.c b/ports/raspberrypi/common-hal/mdns/Server.c index ab0a7079af..c21d813040 100644 --- a/ports/raspberrypi/common-hal/mdns/Server.c +++ b/ports/raspberrypi/common-hal/mdns/Server.c @@ -230,7 +230,7 @@ STATIC void alloc_search_result_cb(struct mdns_answer *answer, const char *varpa if ((flags & MDNS_SEARCH_RESULT_FIRST) != 0) { // first - mdns_remoteservice_obj_t *service = gc_alloc(sizeof(mdns_remoteservice_obj_t), 0, false); + mdns_remoteservice_obj_t *service = m_malloc(sizeof(mdns_remoteservice_obj_t)); if (service == NULL) { // alloc fails mdns_search_stop(state->request_id); diff --git a/ports/raspberrypi/common-hal/pulseio/PulseIn.c b/ports/raspberrypi/common-hal/pulseio/PulseIn.c index 346c0951ed..2c33ad3ff5 100644 --- a/ports/raspberrypi/common-hal/pulseio/PulseIn.c +++ b/ports/raspberrypi/common-hal/pulseio/PulseIn.c @@ -47,7 +47,7 @@ static const uint16_t pulsein_program[] = { void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu_pin_obj_t *pin, uint16_t maxlen, bool idle_state) { - self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t), false); + self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t)); if (self->buffer == NULL) { m_malloc_fail(maxlen * sizeof(uint16_t)); } diff --git a/ports/silabs/common-hal/_bleio/CharacteristicBuffer.c b/ports/silabs/common-hal/_bleio/CharacteristicBuffer.c index 653de697cd..b7f4ff80e3 100644 --- a/ports/silabs/common-hal/_bleio/CharacteristicBuffer.c +++ b/ports/silabs/common-hal/_bleio/CharacteristicBuffer.c @@ -87,7 +87,7 @@ void common_hal_bleio_characteristic_buffer_construct( mp_float_t timeout, size_t buffer_size) { - uint8_t *buffer = m_malloc(buffer_size, true); + uint8_t *buffer = m_malloc(buffer_size); _common_hal_bleio_characteristic_buffer_construct(self, characteristic, timeout, diff --git a/ports/silabs/common-hal/_bleio/PacketBuffer.c b/ports/silabs/common-hal/_bleio/PacketBuffer.c index dd74e17099..f771983a61 100644 --- a/ports/silabs/common-hal/_bleio/PacketBuffer.c +++ b/ports/silabs/common-hal/_bleio/PacketBuffer.c @@ -223,12 +223,12 @@ void common_hal_bleio_packet_buffer_construct( if (incoming) { incoming_buffer_size = buffer_size * (sizeof(uint16_t) + max_packet_size); - incoming_buffer = m_malloc(incoming_buffer_size, false); + incoming_buffer = m_malloc(incoming_buffer_size); } if (outgoing) { - outgoing1 = m_malloc(max_packet_size, false); - outgoing2 = m_malloc(max_packet_size, false); + outgoing1 = m_malloc(max_packet_size); + outgoing2 = m_malloc(max_packet_size); } _common_hal_bleio_packet_buffer_construct(self, characteristic, incoming_buffer, incoming_buffer_size, diff --git a/ports/stm/common-hal/audiopwmio/PWMAudioOut.c b/ports/stm/common-hal/audiopwmio/PWMAudioOut.c index d7df155932..00a1bce488 100644 --- a/ports/stm/common-hal/audiopwmio/PWMAudioOut.c +++ b/ports/stm/common-hal/audiopwmio/PWMAudioOut.c @@ -284,10 +284,10 @@ void common_hal_audiopwmio_pwmaudioout_play(audiopwmio_pwmaudioout_obj_t *self, mp_raise_ValueError_varg(translate("Buffer length %d too big. It must be less than %d"), max_buffer_length, UINT16_MAX); } uint16_t buffer_length = (uint16_t)max_buffer_length / self->bytes_per_sample; - self->buffer[0] = m_malloc(buffer_length * sizeof(uint16_t), false); + self->buffer[0] = m_malloc(buffer_length * sizeof(uint16_t)); self->buffer_ptr[0] = self->buffer_length[0] = 0; if (self->pin[1]) { - self->buffer[1] = m_malloc(buffer_length * sizeof(uint16_t), false); + self->buffer[1] = m_malloc(buffer_length * sizeof(uint16_t)); self->buffer_ptr[1] = self->buffer_length[1] = 0; } diff --git a/ports/stm/common-hal/pulseio/PulseIn.c b/ports/stm/common-hal/pulseio/PulseIn.c index 5b7602d9bf..0754130e17 100644 --- a/ports/stm/common-hal/pulseio/PulseIn.c +++ b/ports/stm/common-hal/pulseio/PulseIn.c @@ -120,7 +120,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, const mcu } // Allocate pulse buffer - self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t), false); + self->buffer = (uint16_t *)m_malloc(maxlen * sizeof(uint16_t)); if (self->buffer == NULL) { // TODO: free the EXTI here? m_malloc_fail(maxlen * sizeof(uint16_t)); diff --git a/py/dynruntime.h b/py/dynruntime.h index 254d0fee78..da0317be6d 100644 --- a/py/dynruntime.h +++ b/py/dynruntime.h @@ -51,7 +51,7 @@ /******************************************************************************/ // Memory allocation -#define m_malloc(n,_) (m_malloc_dyn((n))) +#define m_malloc(n) (m_malloc_dyn((n))) #define m_free(ptr) (m_free_dyn((ptr))) #define m_realloc(ptr, new_num_bytes) (m_realloc_dyn((ptr), (new_num_bytes))) diff --git a/py/py.mk b/py/py.mk index 32d0f734a1..edf4e266b1 100644 --- a/py/py.mk +++ b/py/py.mk @@ -256,7 +256,7 @@ $(HEADER_BUILD)/compressed.data.h: $(HEADER_BUILD)/compressed.collected $(HEADER_BUILD)/$(TRANSLATION).mo: $(TOP)/locale/$(TRANSLATION).po | $(HEADER_BUILD) $(Q)$(PYTHON) $(TOP)/tools/msgfmt.py -o $@ $^ -# translations-*.c is generated as a side-effect of building compression_translated.generated.h +# translations-*.c is generated as a side-effect of building compressed_translations.generated.h # Specifying both in a single rule actually causes the rule to be run twice! # This alternative makes it run just once. $(PY_BUILD)/translations-$(TRANSLATION).c: $(HEADER_BUILD)/compressed_translations.generated.h diff --git a/py/ringbuf.c b/py/ringbuf.c index fcab8c0caa..19295afa44 100644 --- a/py/ringbuf.c +++ b/py/ringbuf.c @@ -38,7 +38,7 @@ bool ringbuf_init(ringbuf_t *r, uint8_t *buf, size_t size) { // Dynamic initialization. This should be accessible from a root pointer.. bool ringbuf_alloc(ringbuf_t *r, size_t size) { - bool result = ringbuf_init(r, gc_alloc(size, false), size); + bool result = ringbuf_init(r, m_malloc(size), size); return result; } diff --git a/shared-bindings/audiocore/__init__.c b/shared-bindings/audiocore/__init__.c index 1e90f370d3..7a39a55366 100644 --- a/shared-bindings/audiocore/__init__.c +++ b/shared-bindings/audiocore/__init__.c @@ -54,7 +54,7 @@ STATIC mp_obj_t audiocore_get_buffer(mp_obj_t sample_in) { uint8_t bits_per_sample = audiosample_bits_per_sample(sample_in); audiosample_get_buffer_structure(sample_in, false, &single_buffer, &samples_signed, &max_buffer_length, &spacing); // copies the data because the gc semantics of get_buffer are unclear - void *result_buf = gc_alloc(buffer_length, 0, false); + void *result_buf = m_malloc(buffer_length); memcpy(result_buf, buffer, buffer_length); char typecode = (bits_per_sample == 8 && samples_signed) ? 'b' : From 8a89a3d425cff02bb2eda05d91aae2a6a5cfc992 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 11 Aug 2023 13:36:03 -0400 Subject: [PATCH 1460/1712] sort TRANSLATION()'s --- py/makeqstrdata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index f6f0d8abf1..fd1b6a2b44 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -393,7 +393,7 @@ def print_qstr_data(qcfgs, qstrs, i18ns): print( "// Enumerate translated texts but don't actually include translations. Instead, the linker will link them in." ) - for i, original in enumerate(i18ns): + for i, original in enumerate(sorted(i18ns)): print('TRANSLATION("{}", {})'.format(original, i)) print() From 29a7a9e63ba9d0e17df21f2a191b1a9db7961e65 Mon Sep 17 00:00:00 2001 From: Luc Date: Fri, 11 Aug 2023 08:27:33 +0000 Subject: [PATCH 1461/1712] Translated using Weblate (German) Currently translated at 98.2% (981 of 998 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/de/ --- locale/de_DE.po | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/locale/de_DE.po b/locale/de_DE.po index d30229687e..f615ab9aa9 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-07-19 21:06+0000\n" +"PO-Revision-Date: 2023-08-12 10:50+0000\n" "Last-Translator: Luc \n" "Language: de_DE\n" "MIME-Version: 1.0\n" @@ -1501,7 +1501,7 @@ msgstr "Kein laufende Aufzeichnung" #: shared-module/usb/core/Device.c msgid "No configuration set" -msgstr "" +msgstr "Keine Konfiguration vorhanden" #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" @@ -2112,7 +2112,7 @@ msgstr "Zu viele Kanäle im sample." #: shared-module/displayio/__init__.c msgid "Too many display busses; forgot displayio.release_displays() ?" -msgstr "" +msgstr "Zu viele Display-Busse, displayio.release_displays() vergessen?" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -2849,7 +2849,7 @@ msgstr "Kann Instanz nicht erstellen" #: extmod/ulab/code/ndarray.c msgid "cannot delete array elements" -msgstr "" +msgstr "Array-Elemente können nicht gelöscht werden" #: py/runtime.c msgid "cannot import name %q" @@ -3318,7 +3318,7 @@ msgstr "inline assembler muss eine function sein" #: extmod/ulab/code/numpy/vector.c msgid "input and output dimensions differ" -msgstr "" +msgstr "Eingabe- und Ausgabedimensionen unterscheiden sich" #: extmod/ulab/code/numpy/vector.c msgid "input and output shapes differ" @@ -3764,7 +3764,7 @@ msgstr "nicht implementiert für komplexe dtype" #: extmod/ulab/code/numpy/bitwise.c msgid "not supported for input types" -msgstr "" +msgstr "nicht unterstützt für Eingabetypen" #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" @@ -3924,7 +3924,7 @@ msgstr "" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for function" -msgstr "" +msgstr "out-Schlüsselwort wird nicht unterstützt für Funktion" #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" @@ -3932,11 +3932,11 @@ msgstr "Ausgabe muss ein floatdichtes Array sein" #: extmod/ulab/code/numpy/vector.c msgid "out must be an ndarray" -msgstr "" +msgstr "out muss ein ndarray sein" #: extmod/ulab/code/numpy/vector.c msgid "out must be of float dtype" -msgstr "" +msgstr "out muss vom Typ dtype sein" #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" From 1b19ed4c393b1f1871743b675994d261716505fc Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 12 Aug 2023 11:08:59 -0400 Subject: [PATCH 1462/1712] change compilation verbosity options; fix mpy-cross --- mpy-cross/mpconfigport.h | 17 +++++++++-------- mpy-cross/mpy-cross.mk | 2 ++ py/emitinlinethumb.c | 2 +- py/mkenv.mk | 34 ++++++++++++++++++---------------- py/mkrules.mk | 9 +++++---- py/objgenerator.c | 3 +-- py/py.mk | 4 +++- 7 files changed, 39 insertions(+), 32 deletions(-) diff --git a/mpy-cross/mpconfigport.h b/mpy-cross/mpconfigport.h index c4c4c9a4b0..334cdda267 100644 --- a/mpy-cross/mpconfigport.h +++ b/mpy-cross/mpconfigport.h @@ -38,14 +38,15 @@ #endif #endif -#define MICROPY_EMIT_X64 (1) -#define MICROPY_EMIT_X86 (1) -#define MICROPY_EMIT_THUMB (1) -#define MICROPY_EMIT_INLINE_THUMB (1) -#define MICROPY_EMIT_ARM (1) -#define MICROPY_EMIT_XTENSA (1) -#define MICROPY_EMIT_INLINE_XTENSA (1) -#define MICROPY_EMIT_XTENSAWIN (1) +//CIRCUITPY: native emitters not supported +#define MICROPY_EMIT_X64 (!CIRCUITPY) +#define MICROPY_EMIT_X86 (!CIRCUITPY) +#define MICROPY_EMIT_THUMB (!CIRCUITPY) +#define MICROPY_EMIT_INLINE_THUMB (!CIRCUITPY) +#define MICROPY_EMIT_ARM (!CIRCUITPY) +#define MICROPY_EMIT_XTENSA (!CIRCUITPY) +#define MICROPY_EMIT_INLINE_XTENSA (!CIRCUITPY) +#define MICROPY_EMIT_XTENSAWIN (!CIRCUITPY) #define MICROPY_DYNAMIC_COMPILER (1) #define MICROPY_COMP_CONST_FOLDING (1) diff --git a/mpy-cross/mpy-cross.mk b/mpy-cross/mpy-cross.mk index 9461cf5748..db93f17123 100644 --- a/mpy-cross/mpy-cross.mk +++ b/mpy-cross/mpy-cross.mk @@ -60,6 +60,8 @@ ifdef STATIC_BUILD LDFLAGS += -static -static-libgcc -static-libstdc++ endif +CFLAGS += -DCIRCUITPY=1 + # source files SRC_C += \ main.c \ diff --git a/py/emitinlinethumb.c b/py/emitinlinethumb.c index 29487f1048..4bde921b99 100644 --- a/py/emitinlinethumb.c +++ b/py/emitinlinethumb.c @@ -74,7 +74,7 @@ static inline bool emit_inline_thumb_allow_float(emit_inline_asm_t *emit) { #endif -STATIC void emit_inline_thumb_error_msg(emit_inline_asm_t *emit, mp_rom_error_text_t msg) { +STATIC void emit_inline_thumb_error_msg(emit_inline_asm_t *emit, const compressed_string_t *msg) { *emit->error_slot = mp_obj_new_exception_msg(&mp_type_SyntaxError, msg); } diff --git a/py/mkenv.mk b/py/mkenv.mk index f74e557040..a53e030aed 100644 --- a/py/mkenv.mk +++ b/py/mkenv.mk @@ -13,29 +13,31 @@ THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST)) TOP := $(patsubst %/py/mkenv.mk,%,$(THIS_MAKEFILE)) # Turn on increased build verbosity by defining BUILD_VERBOSE in your main -# Makefile or in your environment. You can also use V=1 on the make command -# line. +# Makefile or in your environment. You can also use V="steps commands rules" or any combination thereof +# on the make command line. ifeq ("$(origin V)", "command line") BUILD_VERBOSE=$(V) endif + ifndef BUILD_VERBOSE -$(info Use make V={1,2,3} or set BUILD_VERBOSE similarly in your environment to increase build verbosity.) -BUILD_VERBOSE = 0 -endif -ifeq ($(BUILD_VERBOSE),0) -Q = @ -STEPECHO = @: -else ifeq ($(BUILD_VERBOSE),1) -Q = @ -STEPECHO = @echo -else -# BUILD_VERBOSE not 0 or 1 -Q = -STEPECHO = @echo +$(info - Verbosity options: any combination of "steps commands rules", as `make V=...` or env var BUILD_VERBOSE) +BUILD_VERBOSE = "" endif -ifeq ($(BUILD_VERBOSE),3) +ifneq ($(filter steps,$(BUILD_VERBOSE)),) +STEPECHO = @echo +else +STEPECHO = @: +endif + +ifneq ($(filter commands,$(BUILD_VERBOSE)),) +Q = +else +Q = @ +endif + +ifneq ($(filter rules,$(BUILD_VERBOSE)),) # This clever shell redefinition will print out the makefile line that is causing an action. # Note that -j can cause the order to be confusing. # https://www.cmcrossroads.com/article/tracing-rule-execution-gnu-make diff --git a/py/mkrules.mk b/py/mkrules.mk index 8d78d2e28b..ebba517138 100644 --- a/py/mkrules.mk +++ b/py/mkrules.mk @@ -75,7 +75,8 @@ $(Q)$(CXX) $(CXXFLAGS) -c -MD -o $@ $< $(RM) -f $(@:.o=.d) endef -vpath %.c . $(TOP) $(USER_C_MODULES) $(DEVICES_MODULES) +# frozen.c and frozen_mpy.c are created in $(BUILD), so add it to the vpath as well. +vpath %.c . $(TOP) $(USER_C_MODULES) $(DEVICES_MODULES) $(BUILD) $(BUILD)/%.o: %.c $(call compile_c) @@ -84,7 +85,7 @@ $(BUILD)/%.o: %.cpp $(call compile_cxx) $(BUILD)/%.pp: %.c - $(ECHO) "PreProcess $<" + $(STEPECHO) "PreProcess $<" $(Q)$(CPP) $(CFLAGS) -Wp,-C,-dD,-dI -o $@ $< # The following rule uses | to create an order only prerequisite. Order only @@ -108,12 +109,12 @@ $(HEADER_BUILD)/qstr.i.last: $(SRC_QSTR) $(QSTR_GLOBAL_DEPENDENCIES) | $(QSTR_GL $(Q)$(PYTHON) $(PY_SRC)/makeqstrdefs.py pp $(CPP) output $(HEADER_BUILD)/qstr.i.last cflags $(QSTR_GEN_CFLAGS) cxxflags $(QSTR_GEN_CXXFLAGS) sources $^ dependencies $(QSTR_GLOBAL_DEPENDENCIES) changed_sources $? $(HEADER_BUILD)/qstr.split: $(HEADER_BUILD)/qstr.i.last - $(ECHO) "GEN $@" + $(STEPECHO) "GEN $@" $(Q)$(PYTHON) $(PY_SRC)/makeqstrdefs.py split qstr $< $(HEADER_BUILD)/qstr _ $(Q)$(TOUCH) $@ $(QSTR_DEFS_COLLECTED): $(HEADER_BUILD)/qstr.split - $(ECHO) "GEN $@" + $(STEPECHO) "GEN $@" $(Q)$(PYTHON) $(PY_SRC)/makeqstrdefs.py cat qstr _ $(HEADER_BUILD)/qstr $@ # Module definitions via MP_REGISTER_MODULE. diff --git a/py/objgenerator.c b/py/objgenerator.c index f92e0285a3..485ee58322 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -55,8 +55,8 @@ typedef struct _mp_obj_gen_instance_t { // mp_const_none: Not-running, no exception. // MP_OBJ_NULL: Running, no exception. // other: Not running, pending exception. - mp_obj_t pend_exc; bool coroutine_generator; + mp_obj_t pend_exc; mp_code_state_t code_state; } mp_obj_gen_instance_t; @@ -126,7 +126,6 @@ STATIC mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_k mp_obj_gen_instance_native_t *o = mp_obj_malloc_var(mp_obj_gen_instance_native_t, byte, n_state * sizeof(mp_obj_t), &mp_type_gen_instance); // Parse the input arguments and set up the code state - o->coroutine_generator = self->coroutine_generator; o->pend_exc = mp_const_none; o->code_state.fun_bc = self_fun; o->code_state.ip = prelude_ptr; diff --git a/py/py.mk b/py/py.mk index edf4e266b1..2369dabe60 100644 --- a/py/py.mk +++ b/py/py.mk @@ -259,6 +259,8 @@ $(HEADER_BUILD)/$(TRANSLATION).mo: $(TOP)/locale/$(TRANSLATION).po | $(HEADER_BU # translations-*.c is generated as a side-effect of building compressed_translations.generated.h # Specifying both in a single rule actually causes the rule to be run twice! # This alternative makes it run just once. +# Another alternative is "grouped targets" (`a b &: c`), available in GNU make 4.3 and later. +# TODO: use grouped targets when we expect GNU make >= 4.3 is pervasive. $(PY_BUILD)/translations-$(TRANSLATION).c: $(HEADER_BUILD)/compressed_translations.generated.h @true @@ -271,7 +273,7 @@ PY_CORE_O += $(PY_BUILD)/translations-$(TRANSLATION).o # build a list of registered modules for py/objmodule.c. $(HEADER_BUILD)/moduledefs.h: $(HEADER_BUILD)/moduledefs.collected - @$(ECHO) "GEN $@" + @$(STEPECHO) "GEN $@" $(Q)$(PYTHON) $(PY_SRC)/makemoduledefs.py $< > $@ # Standard C functions like memset need to be compiled with special flags so From 48e404ab903ee994afe525f0e7620f0032cbf957 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 12 Aug 2023 15:44:27 -0400 Subject: [PATCH 1463/1712] wip; fix frozen; still need to fix -j1 for frozen --- py/circuitpy_defns.mk | 6 ------ py/makeqstrdata.py | 20 ++++++++++++-------- py/mkrules.mk | 2 +- tools/mpy-tool.py | 24 +++++++++++++++++++++++- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 4acbafef40..a80165f21a 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -84,12 +84,6 @@ CFLAGS += -DCIRCUITPY_TRANSLATE_OBJECT=$(CIRCUITPY_TRANSLATE_OBJECT) ### # Handle frozen modules. -ifneq ($(FROZEN_DIR),) -# To use frozen source modules, put your .py files in a subdirectory (eg scripts/) -# and then invoke make with FROZEN_DIR=scripts (be sure to build from scratch). -CFLAGS += -DMICROPY_MODULE_FROZEN_STR -endif - # To use frozen bytecode, put your .py files in a subdirectory (eg frozen/) and # then invoke make with FROZEN_MPY_DIR=frozen or FROZEN_MPY_DIRS="dir1 dir2" # (be sure to build from scratch). diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index fd1b6a2b44..5f63fa7c55 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -270,10 +270,10 @@ def qstr_escape(qst): return re.sub(r"[^A-Za-z0-9_]", esc_char, qst) -def parse_input_headers(infiles): +def parse_input_headers_with_translations(infiles): qcfgs = {} qstrs = {} - i18ns = set() + translations = set() # add static qstrs for qstr in static_qstr_list: @@ -305,7 +305,7 @@ def parse_input_headers(infiles): match = re.match(r'^TRANSLATE\("(.*)"\)$', line) if match: - i18ns.add(match.group(1)) + translations.add(match.group(1)) continue # is this a QSTR line? @@ -347,8 +347,12 @@ def parse_input_headers(infiles): sys.stderr.write("ERROR: Empty preprocessor output - check for errors above\n") sys.exit(1) - return qcfgs, qstrs, i18ns + return qcfgs, qstrs, translations +# Used externally by mpy-tool.py. Don't pass back translations. +def parse_input_headers(infiles): + qcfgs, qstrs, translations = parse_input_headers_with_translations(infiles) + return (qcfgs, qstrs) def escape_bytes(qstr, qbytes): if all(32 <= ord(c) <= 126 and c != "\\" and c != '"' for c in qstr): @@ -370,7 +374,7 @@ def make_bytes(cfg_bytes_len, cfg_bytes_hash, qstr): return '%d, %d, "%s"' % (qhash, qlen, qdata) -def print_qstr_data(qcfgs, qstrs, i18ns): +def print_qstr_data(qcfgs, qstrs, translations): # get config variables cfg_bytes_len = int(qcfgs["BYTES_IN_LEN"]) cfg_bytes_hash = int(qcfgs["BYTES_IN_HASH"]) @@ -393,7 +397,7 @@ def print_qstr_data(qcfgs, qstrs, i18ns): print( "// Enumerate translated texts but don't actually include translations. Instead, the linker will link them in." ) - for i, original in enumerate(sorted(i18ns)): + for i, original in enumerate(sorted(translations)): print('TRANSLATION("{}", {})'.format(original, i)) print() @@ -402,8 +406,8 @@ def print_qstr_data(qcfgs, qstrs, i18ns): def do_work(infiles): - qcfgs, qstrs, i18ns = parse_input_headers(infiles) - print_qstr_data(qcfgs, qstrs, i18ns) + qcfgs, qstrs, translations = parse_input_headers_with_translations(infiles) + print_qstr_data(qcfgs, qstrs, translations) if __name__ == "__main__": import argparse diff --git a/py/mkrules.mk b/py/mkrules.mk index ebba517138..730ac9704f 100644 --- a/py/mkrules.mk +++ b/py/mkrules.mk @@ -166,7 +166,7 @@ endif ifneq ($(FROZEN_MANIFEST),) # to build frozen_content.c from a manifest -$(BUILD)/frozen_content.c: FORCE $(BUILD)/genhdr/qstrdefs.generated.h | $(MICROPY_MPYCROSS_DEPENDENCY) +$(BUILD)/frozen_content.c: $(BUILD)/genhdr/qstrdefs.generated.h $(FROZEN_MANIFEST) | $(MICROPY_MPYCROSS_DEPENDENCY) $(Q)$(MAKE_MANIFEST) -o $@ -v "MPY_DIR=$(TOP)" -v "MPY_LIB_DIR=$(MPY_LIB_DIR)" -v "PORT_DIR=$(shell pwd)" -v "BOARD_DIR=$(BOARD_DIR)" -b "$(BUILD)" $(if $(MPY_CROSS_FLAGS),-f"$(MPY_CROSS_FLAGS)",) --mpy-tool-flags="$(MPY_TOOL_FLAGS)" $(FROZEN_MANIFEST) endif diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index 18d2b65c41..31212fd5bd 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -1,6 +1,28 @@ #!/usr/bin/env python3 # -# SPDX-License-Identifier: MIT +# This file is part of the MicroPython project, http://micropython.org/ +# +# The MIT License (MIT) +# +# Copyright (c) 2016-2019 Damien P. George +# +# 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. # Python 2/3 compatibility code from __future__ import print_function From 433059023d0fb317dfc7de3987121f764d115802 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 12 Aug 2023 16:49:03 -0400 Subject: [PATCH 1464/1712] fix -j1 builds, particularly CPX --- py/mkrules.mk | 1 + supervisor/supervisor.mk | 1 + 2 files changed, 2 insertions(+) diff --git a/py/mkrules.mk b/py/mkrules.mk index 730ac9704f..0121c3aefd 100644 --- a/py/mkrules.mk +++ b/py/mkrules.mk @@ -8,6 +8,7 @@ endif OBJ_EXTRA_ORDER_DEPS = # Generate moduledefs.h. +SRC_QSTR += $(HEADER_BUILD)/devices.h OBJ_EXTRA_ORDER_DEPS += $(HEADER_BUILD)/moduledefs.h ifeq ($(MICROPY_ROM_TEXT_COMPRESSION),1) diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index 50722bb1a2..859ead5da4 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -86,6 +86,7 @@ else endif OBJ_EXTRA_ORDER_DEPS += $(HEADER_BUILD)/devices.h +SRC_QSTR += $(HEADER_BUILD)/devices.h $(HEADER_BUILD)/devices.h : ../../supervisor/shared/external_flash/devices.h.jinja ../../tools/gen_nvm_devices.py | $(HEADER_BUILD) $(STEPECHO) "GEN $@" $(Q)install -d $(BUILD)/genhdr From 850877a85f200bdabce963a55cb95e59b33baad0 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 12 Aug 2023 17:28:32 -0400 Subject: [PATCH 1465/1712] wip; fix generators; typos --- py/circuitpy_mpconfig.mk | 2 +- py/mkrules.mk | 1 - py/objgenerator.c | 4 ++-- shared-bindings/gnss/__init__.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 1a16c9b0cf..595858bb08 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -628,6 +628,6 @@ $(BUILD)/frozen_mpy: $(FROZEN_MPY_DIRS) $(BUILD)/manifest.py: $(BUILD)/frozen_mpy | $(TOP)/py/circuitpy_mpconfig.mk mpconfigport.mk boards/$(BOARD)/mpconfigboard.mk $(ECHO) MKMANIFEST $(FROZEN_MPY_DIRS) - (cd $(BUILD)/frozen_mpy && find * -name \*.py -exec printf 'freeze_as_mpy("frozen_mpy", "%s")\n' {} \; )> $@.tmp && mv -f $@.tmp $@ + $(Q)(cd $(BUILD)/frozen_mpy && find * -name \*.py -exec printf 'freeze_as_mpy("frozen_mpy", "%s")\n' {} \; )> $@.tmp && mv -f $@.tmp $@ FROZEN_MANIFEST=$(BUILD)/manifest.py endif diff --git a/py/mkrules.mk b/py/mkrules.mk index 0121c3aefd..730ac9704f 100644 --- a/py/mkrules.mk +++ b/py/mkrules.mk @@ -8,7 +8,6 @@ endif OBJ_EXTRA_ORDER_DEPS = # Generate moduledefs.h. -SRC_QSTR += $(HEADER_BUILD)/devices.h OBJ_EXTRA_ORDER_DEPS += $(HEADER_BUILD)/moduledefs.h ifeq ($(MICROPY_ROM_TEXT_COMPRESSION),1) diff --git a/py/objgenerator.c b/py/objgenerator.c index 485ee58322..fce2c0bac7 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -82,7 +82,7 @@ STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, cons const mp_obj_type_t mp_type_gen_wrap = { { &mp_type_type }, - .flags = MP_TYPE_FLAG_BINDS_SELF, + .flags = MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_EXTENDED, .name = MP_QSTR_generator, #if MICROPY_PY_FUNCTION_ATTRS .attr = mp_obj_fun_bc_attr, @@ -148,7 +148,7 @@ STATIC mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_k const mp_obj_type_t mp_type_native_gen_wrap = { { &mp_type_type }, - .flags = MP_TYPE_FLAG_BINDS_SELF, + .flags = MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_EXTENDED, .name = MP_QSTR_generator, #if MICROPY_PY_FUNCTION_ATTRS .attr = gen_attr, diff --git a/shared-bindings/gnss/__init__.c b/shared-bindings/gnss/__init__.c index 7fe1b06e16..4409b0be1b 100644 --- a/shared-bindings/gnss/__init__.c +++ b/shared-bindings/gnss/__init__.c @@ -29,4 +29,4 @@ const mp_obj_module_t gnss_module = { .globals = (mp_obj_dict_t *)&gnss_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_gnss, gnss_modulex); +MP_REGISTER_MODULE(MP_QSTR_gnss, gnss_module); From d652c8d25cd54a6965e10a2b3a819c0079056168 Mon Sep 17 00:00:00 2001 From: Vladimir Smitka Date: Tue, 25 Jul 2023 14:40:53 +0200 Subject: [PATCH 1466/1712] Add PicoPad support --- .../boards/pajenicko_picopad/board.c | 114 ++++++++++++++++++ .../boards/pajenicko_picopad/link.ld | 1 + .../boards/pajenicko_picopad/mpconfigboard.h | 12 ++ .../boards/pajenicko_picopad/mpconfigboard.mk | 34 ++++++ .../pajenicko_picopad/pico-sdk-configboard.h | 1 + .../boards/pajenicko_picopad/pins.c | 113 +++++++++++++++++ 6 files changed, 275 insertions(+) create mode 100644 ports/raspberrypi/boards/pajenicko_picopad/board.c create mode 100644 ports/raspberrypi/boards/pajenicko_picopad/link.ld create mode 100644 ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/pajenicko_picopad/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/pajenicko_picopad/pins.c diff --git a/ports/raspberrypi/boards/pajenicko_picopad/board.c b/ports/raspberrypi/boards/pajenicko_picopad/board.c new file mode 100644 index 0000000000..0d092a1f4d --- /dev/null +++ b/ports/raspberrypi/boards/pajenicko_picopad/board.c @@ -0,0 +1,114 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" +#include "supervisor/shared/board.h" + +displayio_fourwire_obj_t board_display_obj; + +#define DELAY 0x80 + +uint8_t display_init_sequence[] = { + 0x01, 0 | DELAY, 150, // SWRESET + + 0x36, 1, 0x68, // MADCTL + 0x35, 1, 0x00, // TEON + 0xB2, 5, 0x0c, 0x0c, 0x00, 0x33, 0x33, // FRMCTR2 + 0x3A, 1, 0x05, // COLMOD + 0xB7, 1, 0x14, // GCTRL + 0xBB, 1, 0x37, // VCOMS + 0xC0, 1, 0x2c, // LCMCTRL + 0xC2, 1, 0x01, // VDVVRHEN + 0xC3, 1, 0x12, // VRHS + 0xC4, 1, 0x20, // VDVS + 0xD0, 2, 0xa4, 0xa1, // PWRCTRL1 + 0xC6, 1, 0x0f, // FRCTRL2 + 0xE0, 14, 0xd0, 0x04, 0x0d, 0x11, 0x13, 0x2b, 0x3f, 0x54, 0x4c, 0x18, 0x0d, 0x0b, 0x1f, 0x23, // GMCTRP1 + 0xE1, 14, 0xd0, 0x04, 0x0c, 0x11, 0x13, 0x2c, 0x3f, 0x44, 0x51, 0x2f, 0x1f, 0x1f, 0x20, 0x23, // GMCTRN1 + 0x21, 0, // INVON + + 0x11, 0 | DELAY, 255, // SLPOUT + 0x29, 0 | DELAY, 100, // DISPON + + 0x2a, 4, 0x00, 0, 0x00, 0xfe, // CASET + 0x2b, 4, 0x00, 0, 0x00, 0xfe, // RASET + 0x2c, 0, // RAMWR +}; + +void board_init(void) { + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO18, &pin_GPIO19, NULL, false); + common_hal_busio_spi_never_reset(spi); + + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_GPIO17, // TFT_DC Command or data + &pin_GPIO21, // TFT_CS Chip select + &pin_GPIO20, // TFT_RST Reset + 60000000, // Baudrate + 0, // Polarity + 0); // Phase + + displayio_display_obj_t *display = &allocate_display()->display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 320, // Width + 240, // Height + 0, // column start + 0, // row start + 0, // rotation + 16, // Color depth + false, // Grayscale + false, // pixels in a byte share a row. Only valid for depths < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_bytes_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 + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO16, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + true, // backlight_on_high + false, // SH1107_addressing + 50000); // backlight pwm frequency +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pajenicko_picopad/link.ld b/ports/raspberrypi/boards/pajenicko_picopad/link.ld new file mode 100644 index 0000000000..e814bead4c --- /dev/null +++ b/ports/raspberrypi/boards/pajenicko_picopad/link.ld @@ -0,0 +1 @@ +firmware_size = 1532k; diff --git a/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.h b/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.h new file mode 100644 index 0000000000..26b8447860 --- /dev/null +++ b/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.h @@ -0,0 +1,12 @@ +#define MICROPY_HW_BOARD_NAME "Pajenicko PicoPad" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1) +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1) + +#define MICROPY_HW_LED_STATUS (&pin_CYW0) + +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO0) +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO1) diff --git a/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk b/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk new file mode 100644 index 0000000000..2eeea9723f --- /dev/null +++ b/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk @@ -0,0 +1,34 @@ +USB_VID = 0x2E8A +USB_PID = 0x1063 + +USB_PRODUCT = "PicoPad" +USB_MANUFACTURER = "Pajenicko s.r.o." + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY_KEYPAD = 1 +CIRCUITPY_STAGE = 1 +CIRCUITPY_AUDIOIO = 1 + +CIRCUITPY__EVE = 1 + +CIRCUITPY_CYW43 = 1 +CIRCUITPY_SSL = 1 +CIRCUITPY_SSL_MBEDTLS = 1 +CIRCUITPY_HASHLIB = 1 +CIRCUITPY_WEB_WORKFLOW = 1 +CIRCUITPY_MDNS = 1 +CIRCUITPY_SOCKETPOOL = 1 +CIRCUITPY_WIFI = 1 + +CIRCUITPY_PICODVI = 1 + +# Pimoroni PicoSystem peripherals are compatible, we can use of existing ugame.py +FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/picosystem + +CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 +# Must be accompanied by a linker script change +CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' \ No newline at end of file diff --git a/ports/raspberrypi/boards/pajenicko_picopad/pico-sdk-configboard.h b/ports/raspberrypi/boards/pajenicko_picopad/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/pajenicko_picopad/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/pajenicko_picopad/pins.c b/ports/raspberrypi/boards/pajenicko_picopad/pins.c new file mode 100644 index 0000000000..de59502d69 --- /dev/null +++ b/ports/raspberrypi/boards/pajenicko_picopad/pins.c @@ -0,0 +1,113 @@ +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + //Default RPi Pico Pins + {MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0)}, + {MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1)}, + {MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2)}, + {MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3)}, + {MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4)}, + {MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5)}, + {MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6)}, + {MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7)}, + {MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8)}, + {MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9)}, + {MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10)}, + {MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11)}, + {MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12)}, + {MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13)}, + {MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14)}, + {MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15)}, + {MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16)}, + {MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17)}, + {MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18)}, + {MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19)}, + {MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20)}, + {MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21)}, + {MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22)}, + {MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26)}, + {MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27)}, + {MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28)}, + + //PicoPad external connector + /* + ┌──────┐ + GND -│1 2│- GND + 3V3 -│3 4│- VBAT + D5/A2 -│5 6│- ADC_VREF + D4/A1 -│7 8│- AGND + D3/TX/SDA -│9 10│- D0/A0 + D2/RX/SCL -│11 12│- D1 + └──────┘ + */ + + {MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO26)}, + {MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO14)}, + {MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO1)}, + {MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO0)}, + {MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO27)}, + {MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO28)}, + + {MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26)}, + {MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27)}, + {MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28)}, + + //PicoPad LCD + {MP_ROM_QSTR(MP_QSTR_LCD_RESET), MP_ROM_PTR(&pin_GPIO20)}, + {MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO21)}, + {MP_ROM_QSTR(MP_QSTR_LCD_SCLK), MP_ROM_PTR(&pin_GPIO18)}, + {MP_ROM_QSTR(MP_QSTR_LCD_MOSI), MP_ROM_PTR(&pin_GPIO19)}, + {MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO17)}, + {MP_ROM_QSTR(MP_QSTR_LCD_BL), MP_ROM_PTR(&pin_GPIO16)}, + + //PicoPad Audio + {MP_ROM_QSTR(MP_QSTR_AUDIO), MP_ROM_PTR(&pin_GPIO15)}, + + //PicoPad USR LED (yellow) + {MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO22)}, + + //PicoPad Buttons + {MP_ROM_QSTR(MP_QSTR_SW_X), MP_ROM_PTR(&pin_GPIO9)}, + {MP_ROM_QSTR(MP_QSTR_SW_Y), MP_ROM_PTR(&pin_GPIO8)}, + {MP_ROM_QSTR(MP_QSTR_SW_A), MP_ROM_PTR(&pin_GPIO7)}, + {MP_ROM_QSTR(MP_QSTR_SW_B), MP_ROM_PTR(&pin_GPIO6)}, + + {MP_ROM_QSTR(MP_QSTR_SW_DOWN), MP_ROM_PTR(&pin_GPIO5)}, + {MP_ROM_QSTR(MP_QSTR_SW_RIGHT), MP_ROM_PTR(&pin_GPIO2)}, + {MP_ROM_QSTR(MP_QSTR_SW_LEFT), MP_ROM_PTR(&pin_GPIO3)}, + {MP_ROM_QSTR(MP_QSTR_SW_UP), MP_ROM_PTR(&pin_GPIO4)}, + + //PicoPad SD Card + {MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO13)}, + {MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO10)}, + {MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO11)}, + {MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO12)}, + + //PicoPad Battery + {MP_ROM_QSTR(MP_QSTR_BAT_SENSE), MP_ROM_PTR(&pin_GPIO29)}, + + //PicoPad UART0 + {MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0)}, + {MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1)}, + + //PicoPad I2C0 + {MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO0)}, + {MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO1)}, + + //PicoPad I2C1 + {MP_ROM_QSTR(MP_QSTR_SDA_ALT), MP_ROM_PTR(&pin_GPIO14)}, + {MP_ROM_QSTR(MP_QSTR_SCL_ALT), MP_ROM_PTR(&pin_GPIO27)}, + + + {MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj)}, + {MP_ROM_QSTR(MP_QSTR_I2C_ALT), MP_ROM_PTR(&board_i2c_obj)}, + {MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj)}, + + {MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_CYW1)}, + {MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_CYW0)}, + {MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2)}, + {MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)}}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 2819c88207165f32e884e88e7619a77a511062c3 Mon Sep 17 00:00:00 2001 From: Vladimir Smitka Date: Tue, 25 Jul 2023 19:25:27 +0200 Subject: [PATCH 1467/1712] Formatting --- .../boards/pajenicko_picopad/mpconfigboard.mk | 2 +- .../boards/pajenicko_picopad/pins.c | 27 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk b/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk index 2eeea9723f..65ad4bba91 100644 --- a/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk +++ b/ports/raspberrypi/boards/pajenicko_picopad/mpconfigboard.mk @@ -31,4 +31,4 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/picosystem CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 # Must be accompanied by a linker script change -CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' \ No newline at end of file +CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' diff --git a/ports/raspberrypi/boards/pajenicko_picopad/pins.c b/ports/raspberrypi/boards/pajenicko_picopad/pins.c index de59502d69..da1fe3b9dc 100644 --- a/ports/raspberrypi/boards/pajenicko_picopad/pins.c +++ b/ports/raspberrypi/boards/pajenicko_picopad/pins.c @@ -3,7 +3,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS - //Default RPi Pico Pins + // Default RPi Pico Pins {MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0)}, {MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1)}, {MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2)}, @@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27)}, {MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28)}, - //PicoPad external connector + // PicoPad external connector /* ┌──────┐ GND -│1 2│- GND @@ -40,7 +40,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { D4/A1 -│7 8│- AGND D3/TX/SDA -│9 10│- D0/A0 D2/RX/SCL -│11 12│- D1 - └──────┘ + └──────┘ */ {MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO26)}, @@ -54,7 +54,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27)}, {MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28)}, - //PicoPad LCD + // PicoPad LCD {MP_ROM_QSTR(MP_QSTR_LCD_RESET), MP_ROM_PTR(&pin_GPIO20)}, {MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO21)}, {MP_ROM_QSTR(MP_QSTR_LCD_SCLK), MP_ROM_PTR(&pin_GPIO18)}, @@ -62,13 +62,13 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_LCD_DC), MP_ROM_PTR(&pin_GPIO17)}, {MP_ROM_QSTR(MP_QSTR_LCD_BL), MP_ROM_PTR(&pin_GPIO16)}, - //PicoPad Audio + // PicoPad Audio {MP_ROM_QSTR(MP_QSTR_AUDIO), MP_ROM_PTR(&pin_GPIO15)}, - //PicoPad USR LED (yellow) + // PicoPad USR LED (yellow) {MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO22)}, - //PicoPad Buttons + // PicoPad Buttons {MP_ROM_QSTR(MP_QSTR_SW_X), MP_ROM_PTR(&pin_GPIO9)}, {MP_ROM_QSTR(MP_QSTR_SW_Y), MP_ROM_PTR(&pin_GPIO8)}, {MP_ROM_QSTR(MP_QSTR_SW_A), MP_ROM_PTR(&pin_GPIO7)}, @@ -79,24 +79,24 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_SW_LEFT), MP_ROM_PTR(&pin_GPIO3)}, {MP_ROM_QSTR(MP_QSTR_SW_UP), MP_ROM_PTR(&pin_GPIO4)}, - //PicoPad SD Card + // PicoPad SD Card {MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO13)}, {MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO10)}, {MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO11)}, {MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO12)}, - //PicoPad Battery + // PicoPad Battery {MP_ROM_QSTR(MP_QSTR_BAT_SENSE), MP_ROM_PTR(&pin_GPIO29)}, - //PicoPad UART0 + // PicoPad UART0 {MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0)}, {MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1)}, - //PicoPad I2C0 + // PicoPad I2C0 {MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO0)}, {MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO1)}, - //PicoPad I2C1 + // PicoPad I2C1 {MP_ROM_QSTR(MP_QSTR_SDA_ALT), MP_ROM_PTR(&pin_GPIO14)}, {MP_ROM_QSTR(MP_QSTR_SCL_ALT), MP_ROM_PTR(&pin_GPIO27)}, @@ -108,6 +108,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { {MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_CYW1)}, {MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_CYW0)}, {MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2)}, - {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_module_globals_table); From acd889609403b2e3d6d0e20e07d132c9a2847180 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Smitka?= Date: Mon, 31 Jul 2023 12:22:27 +0200 Subject: [PATCH 1468/1712] Fix RGB/BGR color order --- ports/raspberrypi/boards/pajenicko_picopad/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/pajenicko_picopad/board.c b/ports/raspberrypi/boards/pajenicko_picopad/board.c index 0d092a1f4d..e81525d0d8 100644 --- a/ports/raspberrypi/boards/pajenicko_picopad/board.c +++ b/ports/raspberrypi/boards/pajenicko_picopad/board.c @@ -39,7 +39,7 @@ displayio_fourwire_obj_t board_display_obj; uint8_t display_init_sequence[] = { 0x01, 0 | DELAY, 150, // SWRESET - 0x36, 1, 0x68, // MADCTL + 0x36, 1, 0x60, // MADCTL 0x35, 1, 0x00, // TEON 0xB2, 5, 0x0c, 0x0c, 0x00, 0x33, 0x33, // FRMCTR2 0x3A, 1, 0x05, // COLMOD From 1b3993a29e6c98f37025976e50561db79f15d144 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Mon, 24 Jul 2023 18:41:52 -0700 Subject: [PATCH 1469/1712] Added initial Adafruit Metro ESP32-S3 --- .../boards/adafruit_metro_esp32s3/board.c | 29 ++++++++ .../adafruit_metro_esp32s3/mpconfigboard.h | 46 ++++++++++++ .../adafruit_metro_esp32s3/mpconfigboard.mk | 10 +++ .../boards/adafruit_metro_esp32s3/pins.c | 71 +++++++++++++++++++ .../boards/adafruit_metro_esp32s3/sdkconfig | 46 ++++++++++++ 5 files changed, 202 insertions(+) create mode 100644 ports/espressif/boards/adafruit_metro_esp32s3/board.c create mode 100644 ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.h create mode 100644 ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.mk create mode 100644 ports/espressif/boards/adafruit_metro_esp32s3/pins.c create mode 100644 ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/board.c b/ports/espressif/boards/adafruit_metro_esp32s3/board.c new file mode 100644 index 0000000000..164430c88c --- /dev/null +++ b/ports/espressif/boards/adafruit_metro_esp32s3/board.c @@ -0,0 +1,29 @@ +/* + * 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.h b/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.h new file mode 100644 index 0000000000..d1e0ba0c26 --- /dev/null +++ b/ports/espressif/boards/adafruit_metro_esp32s3/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 "Adafruit Metro ESP32S3" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO45) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO48) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO47) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO41) +#define DEFAULT_UART_BUS_TX (&pin_GPIO40) + +#define DOUBLE_TAP_PIN (&pin_GPIO38) diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.mk b/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.mk new file mode 100644 index 0000000000..039c689eaf --- /dev/null +++ b/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x239A +USB_PID = 0x0145 +USB_PRODUCT = "Metro ESP32-S3" +USB_MANUFACTURER = "Adafruit" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_SIZE = 16MB diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c new file mode 100644 index 0000000000..e27f72f3bb --- /dev/null +++ b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c @@ -0,0 +1,71 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_OBJ_NEW_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO17) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO18) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO1) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO40) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO41) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_GPIO47) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO47),MP_ROM_PTR(&pin_GPIO47) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_GPIO48) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO48),MP_ROM_PTR(&pin_GPIO48) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_GPIO35) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO35),MP_ROM_PTR(&pin_GPIO35) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_GPIO37) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO37),MP_ROM_PTR(&pin_GPIO37) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO45) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_RX), MP_ROM_PTR(&pin_GPIO44) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_TX), MP_ROM_PTR(&pin_GPIO43) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig b/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig new file mode 100644 index 0000000000..2d819ad274 --- /dev/null +++ b/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig @@ -0,0 +1,46 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=8388608 +# end of SPI RAM config + +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="Metro-ESP32S3" +# end of LWIP From 8dd52430b64a569dcae2ac5c01b3d05c09eb052d Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 25 Jul 2023 16:30:21 -0700 Subject: [PATCH 1470/1712] Change to octal ram --- ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig b/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig index 2d819ad274..2d72ed5391 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig +++ b/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig @@ -8,8 +8,8 @@ CONFIG_ESP32S3_SPIRAM_SUPPORT=y # # SPI RAM config # -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y CONFIG_SPIRAM_TYPE_AUTO=y # CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set # CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set From 4c62db2d055c20f3f5ddb06fa8e2a1bdfe3a0052 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Thu, 27 Jul 2023 16:46:15 -0700 Subject: [PATCH 1471/1712] Add D pins --- .../boards/adafruit_metro_esp32s3/pins.c | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c index e27f72f3bb..4ac6c49d29 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c +++ b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c @@ -27,18 +27,42 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO41) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_GPIO47) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO47),MP_ROM_PTR(&pin_GPIO47) }, @@ -55,8 +79,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_GPIO37) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO37),MP_ROM_PTR(&pin_GPIO37) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO45) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, From 9d69ddc583c5bea4a649fe448271b2371865f46a Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Thu, 27 Jul 2023 19:26:37 -0700 Subject: [PATCH 1472/1712] Add D0 and D1 --- ports/espressif/boards/adafruit_metro_esp32s3/pins.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c index 4ac6c49d29..dfad4381ef 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c +++ b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c @@ -21,12 +21,14 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO1) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO40) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, - + { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO41) }, { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO41) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO40) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO40) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, From 27c7807693954ade239814c3a02a8ac10be7bb7b Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 13 Aug 2023 19:05:09 -0400 Subject: [PATCH 1473/1712] silabs build needs work; other builds are working --- extmod/misc.h | 48 +++ extmod/ulab | 2 +- ports/atmel-samd/Makefile | 5 - ports/broadcom/Makefile | 6 - ports/cxd56/Makefile | 5 - ports/espressif/Makefile | 5 - ports/litex/Makefile | 5 - ports/mimxrt10xx/Makefile | 5 - ports/nrf/Makefile | 5 - ports/nrf/common-hal/busio/UART.c | 2 +- ports/raspberrypi/Makefile | 5 - ports/silabs/Makefile | 48 +-- .../boards/devkit_xg24_brd2601b/sensor.c | 3 +- ports/silabs/common-hal/_bleio/__init__.c | 2 +- ports/silabs/common-hal/busio/UART.c | 2 +- ports/stm/Makefile | 5 - ports/unix/main.c | 3 + ports/unix/modffi.c | 25 +- ports/unix/modos.c | 395 ++++++++++++++++++ ports/unix/moduos_vfs.c | 98 +++++ ports/unix/mpconfigport.h | 14 + ports/unix/mpconfigport.mk | 6 +- ports/unix/unix_mphal.c | 54 +++ py/mkrules.mk | 5 + py/modsys.c | 3 +- py/objexcept.c | 169 ++++++++ supervisor/shared/background_callback.c | 2 +- 27 files changed, 834 insertions(+), 93 deletions(-) create mode 100644 extmod/misc.h create mode 100644 ports/unix/modos.c create mode 100644 ports/unix/moduos_vfs.c diff --git a/extmod/misc.h b/extmod/misc.h new file mode 100644 index 0000000000..a9392aa10b --- /dev/null +++ b/extmod/misc.h @@ -0,0 +1,48 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2014-2016 Damien P. George + * Copyright (c) 2016 Paul Sokolovsky + * + * 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_EXTMOD_MISC_H +#define MICROPY_INCLUDED_EXTMOD_MISC_H + +// This file contains cumulative declarations for extmod/ . + +#include +#include "py/runtime.h" + +MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_uos_dupterm_obj); + +#if MICROPY_PY_OS_DUPTERM +bool mp_uos_dupterm_is_builtin_stream(mp_const_obj_t stream); +void mp_uos_dupterm_stream_detached_attached(mp_obj_t stream_detached, mp_obj_t stream_attached); +uintptr_t mp_uos_dupterm_poll(uintptr_t poll_flags); +int mp_uos_dupterm_rx_chr(void); +void mp_uos_dupterm_tx_strn(const char *str, size_t len); +void mp_uos_deactivate(size_t dupterm_idx, const char *msg, mp_obj_t exc); +#else +#define mp_uos_dupterm_tx_strn(s, l) +#endif + +#endif // MICROPY_INCLUDED_EXTMOD_MISC_H diff --git a/extmod/ulab b/extmod/ulab index 6619c20b3b..a05ec05351 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 6619c20b3b75864554fcee5f88846fac27df5701 +Subproject commit a05ec05351260cf48fefc347265b8d8bf29c03f1 diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index d732e7a9b2..0f01c789c6 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -387,8 +387,3 @@ $(BUILD)/firmware.uf2: $(BUILD)/firmware.bin $(Q)$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -c -o $@ $^ include $(TOP)/py/mkrules.mk - -# Print out the value of a make variable. -# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile -print-%: - @echo $* = $($*) diff --git a/ports/broadcom/Makefile b/ports/broadcom/Makefile index 9af0503fbb..bbafa26751 100644 --- a/ports/broadcom/Makefile +++ b/ports/broadcom/Makefile @@ -172,9 +172,3 @@ $(BUILD)/firmware.disk.img.zip: $(BUILD)/kernel$(SUFFIX).img $(Q)rm $(BUILD)/circuitpython-disk.img include $(TOP)/py/mkrules.mk - - -# Print out the value of a make variable. -# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile -print-%: - @echo $* = $($*) diff --git a/ports/cxd56/Makefile b/ports/cxd56/Makefile index 2fbb599c25..0e3a34af99 100644 --- a/ports/cxd56/Makefile +++ b/ports/cxd56/Makefile @@ -200,8 +200,3 @@ flash-bootloader: $(SPRESENSE_SDK) $(FIRMWARE) tools/flash_writer.py -s -c $(SERIAL) -d -b 115200 -n $(BOOTLOADER_FILES) include $(TOP)/py/mkrules.mk - -# Print out the value of a make variable. -# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile -print-%: - @echo $* = $($*) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 10ac738cac..288c24f1f5 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -484,8 +484,3 @@ monitor: $(BUILD)/firmware.elf idf.py monitor -p $(PORT) include $(TOP)/py/mkrules.mk - -# Print out the value of a make variable. -# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile -print-%: - @echo $* = $($*) diff --git a/ports/litex/Makefile b/ports/litex/Makefile index 47a18781f9..ce7805d067 100644 --- a/ports/litex/Makefile +++ b/ports/litex/Makefile @@ -157,8 +157,3 @@ $(BUILD)/firmware.dfu: $(BUILD)/firmware.bin $(PYTHON) $(TOP)/tools/dfu.py -b $^ -D 0x1209:0x5bf0 "$(BUILD)/firmware.dfu" include $(TOP)/py/mkrules.mk - -# Print out the value of a make variable. -# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile -print-%: - @echo $* = $($*) diff --git a/ports/mimxrt10xx/Makefile b/ports/mimxrt10xx/Makefile index c591cf189e..ddf51413a9 100644 --- a/ports/mimxrt10xx/Makefile +++ b/ports/mimxrt10xx/Makefile @@ -224,11 +224,6 @@ $(BUILD)/firmware.hex: $(BUILD)/firmware.elf include $(TOP)/py/mkrules.mk -# Print out the value of a make variable. -# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile -print-%: - @echo $* = $($*) - ifeq ($(CHIP_FAMILY), MIMXRT1062) PYOCD_TARGET = mimxrt1060 endif diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 8a8625bd95..5829b465a6 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -313,8 +313,3 @@ $(BUILD)/firmware.espruino.zip: $(BUILD)/firmware.hex espruino-dfu-gen: $(BUILD)/firmware.espruino.zip include $(TOP)/py/mkrules.mk - -# Print out the value of a make variable. -# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile -print-%: - @echo $* = $($*) diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index 012ca894fe..4bd5807fc0 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -346,7 +346,7 @@ size_t common_hal_busio_uart_write(busio_uart_obj_t *self, const uint8_t *data, if (!nrfx_is_in_ram(data)) { // Allocate long strings on the heap. if (len > 128 && gc_alloc_possible()) { - tx_buf = (uint8_t *)m_m_alloc(len); + tx_buf = (uint8_t *)m_malloc(len); } else { tx_buf = alloca(len); } diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 7eb67b77ba..062c65e491 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -453,8 +453,3 @@ $(BUILD)/firmware.uf2: $(BUILD)/firmware.bin $(Q)$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xe48bff56 -b 0x10000000 -c -o $@ $^ include $(TOP)/py/mkrules.mk - -# Print out the value of a make variable. -# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile -print-%: - @echo $* = $($*) diff --git a/ports/silabs/Makefile b/ports/silabs/Makefile index 66749b4320..8fd43067f1 100644 --- a/ports/silabs/Makefile +++ b/ports/silabs/Makefile @@ -38,8 +38,6 @@ PY_GEN_PINS_SRC ?= tools/make_pins.py # SLC tool path SLC_PATH = $(realpath $(CURDIR))/tools/slc_cli_linux -BUILD_VERBOSE ?= 1 - CFLAGS = $(INCLUDES) $(C_DEFS) $(C_FLAGS) \ -Wno-expansion-to-defined \ -Wno-unused-parameter \ @@ -95,23 +93,18 @@ endif SRC_S = boards/mp_efr32xg24_gchelper.s SRC_COMMON_HAL_EXPANDED = $(addprefix shared-bindings/, $(SRC_COMMON_HAL)) \ - $(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \ - $(addprefix common-hal/, $(SRC_COMMON_HAL)) + $(addprefix shared-bindings/, $(SRC_BINDINGS_ENUMS)) \ + $(addprefix common-hal/, $(SRC_COMMON_HAL)) SRC_SHARED_MODULE_EXPANDED = $(addprefix shared-bindings/, $(SRC_SHARED_MODULE)) \ - $(addprefix shared-module/, $(SRC_SHARED_MODULE)) \ - $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL)) + $(addprefix shared-module/, $(SRC_SHARED_MODULE)) \ + $(addprefix shared-module/, $(SRC_SHARED_MODULE_INTERNAL)) # There may be duplicates between SRC_COMMON_HAL_EXPANDED and SRC_SHARED_MODULE_EXPANDED, # because a few modules have files both in common-hal/ and shared-module/. # Doing a $(sort ...) removes duplicates as part of sorting. SRC_COMMON_HAL_SHARED_MODULE_EXPANDED = $(sort $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED)) -ifneq ($(FROZEN_MPY_DIR),) -FROZEN_MPY_PY_FILES := $(shell find -L $(FROZEN_MPY_DIR) -type f -name '*.py') -FROZEN_MPY_MPY_FILES := $(addprefix $(BUILD)/,$(FROZEN_MPY_PY_FILES:.py=.mpy)) -endif - OBJ += $(PY_O) $(SUPERVISOR_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_COMMON_HAL_SHARED_MODULE_EXPANDED:.c=.o)) ifeq ($(INTERNAL_LIBM),1) @@ -181,38 +174,37 @@ endif @sed -i 's/ autogen\// $(SILABS_BUILD)\/autogen\//g' $(SILABS_BUILD)/circuitpython_efr32.project.mak @sed -i 's/-T"autogen\//-T"$(SILABS_BUILD)\/autogen\//g' $(SILABS_BUILD)/circuitpython_efr32.project.mak -#Override ECHO +# tools/slc_cli_linux/bin/slc-cli/developer/exporter_templates/arm_gcc/arm_gcc.Makefile defines +# ECHO = @ +# which is not compatible with py/mkenv.mk: +# ECHO = @echo +# so override ECHO $(OBJS): ECHO = -$(OBJS): +#$(OBJS): $(OUTPUT_DIR)/%.o: %.c - @echo 'Building $<' + #@echo 'Building $<' @$(MKDIR_P) $(@D) - $(ECHO)$(CC) $(CFLAGS) -c -o $@ $< + @$(CC) $(CFLAGS) -c -o $@ $< $(OUTPUT_DIR)/%.o: %.cpp - @echo 'Building $<' + #@echo 'Building $<' @$(MKDIR_P) $(@D) - $(ECHO)$(CXX) $(CXXFLAGS) -c -o $@ $< + @$(CXX) $(CXXFLAGS) -c -o $@ $< $(OUTPUT_DIR)/%.o: %.cc - @echo 'Building $<' + #@echo 'Building $<' @$(MKDIR_P) $(@D) - $(ECHO)$(CXX) $(CXXFLAGS) -c -o $@ $< + @$(CXX) $(CXXFLAGS) -c -o $@ $< $(OUTPUT_DIR)/%.o: %.s - @echo 'Building $<' + #@echo 'Building $<' @$(MKDIR_P) $(@D) - $(ECHO)$(CC) $(ASMFLAGS) -c -o $@ $< + @$(CC) $(ASMFLAGS) -c -o $@ $< $(OUTPUT_DIR)/%.o: %.S - @echo 'Building $<' + #@echo 'Building $<' @$(MKDIR_P) $(@D) - $(ECHO)$(CC) $(ASMFLAGS) -c -o $@ $< + @$(CC) $(ASMFLAGS) -c -o $@ $< include $(TOP)/py/mkrules.mk - -# Print out the value of a make variable. -# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile -print-%: - @echo $* = $($*) diff --git a/ports/silabs/boards/devkit_xg24_brd2601b/sensor.c b/ports/silabs/boards/devkit_xg24_brd2601b/sensor.c index 55011e556a..2b0bf9b0bd 100644 --- a/ports/silabs/boards/devkit_xg24_brd2601b/sensor.c +++ b/ports/silabs/boards/devkit_xg24_brd2601b/sensor.c @@ -37,7 +37,8 @@ #include "sl_sensor_hall.h" #include "sl_sensor_pressure.h" -STATIC mp_obj_t sensor_init(busio_i2c_obj_t *i2c) { +STATIC mp_obj_t sensor_init(mp_obj_t i2c_in) { + // busio_i2c_obj_t *i2c = MP_OBJ_TO_PTR(i2c_in); sl_status_t sc; if (!common_hal_mcu_pin_is_free(&pin_PC9)) { diff --git a/ports/silabs/common-hal/_bleio/__init__.c b/ports/silabs/common-hal/_bleio/__init__.c index 8b85f9ed6b..a1f8927c8f 100644 --- a/ports/silabs/common-hal/_bleio/__init__.c +++ b/ports/silabs/common-hal/_bleio/__init__.c @@ -183,7 +183,7 @@ void sl_bt_on_event(sl_bt_msg_t *evt) { osMutexAcquire(bluetooth_connection_mutex_id, osWaitForever); connection = bleio_conn_handle_to_connection( evt->data.evt_gatt_service.connection); - service = m_new_obj(bleio_service_obj_t, &bleio_service_type); + service = mp_obj_malloc(bleio_service_obj_t, &bleio_service_type); bleio_service_from_connection(service, bleio_connection_new_from_internal(connection)); service->is_remote = true; diff --git a/ports/silabs/common-hal/busio/UART.c b/ports/silabs/common-hal/busio/UART.c index 8b1883d906..e066d3f732 100644 --- a/ports/silabs/common-hal/busio/UART.c +++ b/ports/silabs/common-hal/busio/UART.c @@ -123,7 +123,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, if (receiver_buffer != NULL) { ringbuf_init(&self->ringbuf, receiver_buffer, receiver_buffer_size); } else { - if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size, true)) { + if (!ringbuf_alloc(&self->ringbuf, receiver_buffer_size)) { m_malloc_fail(receiver_buffer_size); } } diff --git a/ports/stm/Makefile b/ports/stm/Makefile index b9709d0c2e..f8ac985ab9 100755 --- a/ports/stm/Makefile +++ b/ports/stm/Makefile @@ -291,8 +291,3 @@ flash: $(BUILD)/firmware.bin dfu-util -a 0 --dfuse-address $(BOOTLOADER_OFFSET) -D $(BUILD)/firmware.bin include $(TOP)/py/mkrules.mk - -# Print out the value of a make variable. -# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile -print-%: - @echo $* = $($*) diff --git a/ports/unix/main.c b/ports/unix/main.c index 959640dc8c..28a733d191 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -67,6 +67,9 @@ STATIC void stderr_print_strn(void *env, const char *str, size_t len) { (void)env; ssize_t ret; MP_HAL_RETRY_SYSCALL(ret, write(STDERR_FILENO, str, len), {}); + #if MICROPY_PY_OS_DUPTERM + mp_uos_dupterm_tx_strn(str, len); + #endif } const mp_print_t mp_stderr_print = {NULL, stderr_print_strn}; diff --git a/ports/unix/modffi.c b/ports/unix/modffi.c index 6ea3d29fd2..468006ba5d 100644 --- a/ports/unix/modffi.c +++ b/ports/unix/modffi.c @@ -505,19 +505,22 @@ STATIC mp_obj_t ffifunc_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const } else if (mp_obj_is_str(a)) { const char *s = mp_obj_str_get_str(a); values[i].ffi = (ffi_arg)(intptr_t)s; - } else if (((mp_obj_base_t *)MP_OBJ_TO_PTR(a))->type->buffer_p.get_buffer != NULL) { - mp_obj_base_t *o = (mp_obj_base_t *)MP_OBJ_TO_PTR(a); - mp_buffer_info_t bufinfo; - int ret = o->type->buffer_p.get_buffer(MP_OBJ_FROM_PTR(o), &bufinfo, MP_BUFFER_READ); // TODO: MP_BUFFER_READ? - if (ret != 0) { + } else { + mp_getbuffer_fun_t get_buffer = mp_type_get_getbuffer_slot(((mp_obj_base_t *)MP_OBJ_TO_PTR(a))->type); + if (get_buffer != NULL) { + mp_obj_base_t *o = (mp_obj_base_t *)MP_OBJ_TO_PTR(a); + mp_buffer_info_t bufinfo; + int ret = get_buffer(MP_OBJ_FROM_PTR(o), &bufinfo, MP_BUFFER_READ); // TODO: MP_BUFFER_READ? + if (ret != 0) { + goto error; + } + values[i].ffi = (ffi_arg)(intptr_t)bufinfo.buf; + } else if (mp_obj_is_type(a, &fficallback_type)) { + mp_obj_fficallback_t *p = MP_OBJ_TO_PTR(a); + values[i].ffi = (ffi_arg)(intptr_t)p->func; + } else { goto error; } - values[i].ffi = (ffi_arg)(intptr_t)bufinfo.buf; - } else if (mp_obj_is_type(a, &fficallback_type)) { - mp_obj_fficallback_t *p = MP_OBJ_TO_PTR(a); - values[i].ffi = (ffi_arg)(intptr_t)p->func; - } else { - goto error; } valueptrs[i] = &values[i]; } diff --git a/ports/unix/modos.c b/ports/unix/modos.c new file mode 100644 index 0000000000..8373c07a5c --- /dev/null +++ b/ports/unix/modos.c @@ -0,0 +1,395 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2014-2018 Paul Sokolovsky + * SPDX-FileCopyrightText: Copyright (c) 2014-2018 Damien P. George + * + * 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 +#include +#include +#include +#include +#include +#include +#ifdef _MSC_VER +#include // For mkdir +#endif +#include "py/mpconfig.h" + +#include "py/runtime.h" +#include "py/objtuple.h" +#include "py/mphal.h" +#include "py/mpthread.h" +#include "extmod/vfs.h" + +#ifdef __ANDROID__ +#define USE_STATFS 1 +#endif + +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) +#if __GLIBC_PREREQ(2, 25) +#include +#define _HAVE_GETRANDOM +#endif +#endif + +#if defined(MICROPY_UNIX_COVERAGE) +#include "py/objstr.h" +typedef int os_getenv_err_t; +mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_); +os_getenv_err_t common_hal_os_getenv_str(const char *key, char *value, size_t value_len); +os_getenv_err_t common_hal_os_getenv_int(const char *key, mp_int_t *value); +#endif + +STATIC mp_obj_t mod_os_urandom(mp_obj_t num) { + mp_int_t n = mp_obj_get_int(num); + vstr_t vstr; + vstr_init_len(&vstr, n); + #ifdef _HAVE_GETRANDOM + RAISE_ERRNO(getrandom(vstr.buf, n, 0), errno); + #else + int fd = open("/dev/urandom", O_RDONLY); + RAISE_ERRNO(fd, errno); + RAISE_ERRNO(read(fd, vstr.buf, n), errno); + close(fd); + #endif + return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_urandom_obj, mod_os_urandom); + +STATIC mp_obj_t mod_os_stat(mp_obj_t path_in) { + struct stat sb; + const char *path = mp_obj_str_get_str(path_in); + + int res; + MP_HAL_RETRY_SYSCALL(res, stat(path, &sb), mp_raise_OSError(err)); + + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL)); + t->items[0] = MP_OBJ_NEW_SMALL_INT(sb.st_mode); + t->items[1] = mp_obj_new_int_from_uint(sb.st_ino); + t->items[2] = mp_obj_new_int_from_uint(sb.st_dev); + t->items[3] = mp_obj_new_int_from_uint(sb.st_nlink); + t->items[4] = mp_obj_new_int_from_uint(sb.st_uid); + t->items[5] = mp_obj_new_int_from_uint(sb.st_gid); + t->items[6] = mp_obj_new_int_from_uint(sb.st_size); + t->items[7] = mp_obj_new_int_from_uint(sb.st_atime); + t->items[8] = mp_obj_new_int_from_uint(sb.st_mtime); + t->items[9] = mp_obj_new_int_from_uint(sb.st_ctime); + return MP_OBJ_FROM_PTR(t); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_stat_obj, mod_os_stat); + +#if MICROPY_PY_OS_STATVFS + +#if USE_STATFS +#include +#define STRUCT_STATVFS struct statfs +#define STATVFS statfs +#define F_FAVAIL sb.f_ffree +#define F_NAMEMAX sb.f_namelen +#define F_FLAG sb.f_flags +#else +#include +#define STRUCT_STATVFS struct statvfs +#define STATVFS statvfs +#define F_FAVAIL sb.f_favail +#define F_NAMEMAX sb.f_namemax +#define F_FLAG sb.f_flag +#endif + +STATIC mp_obj_t mod_os_statvfs(mp_obj_t path_in) { + STRUCT_STATVFS sb; + const char *path = mp_obj_str_get_str(path_in); + + int res; + MP_HAL_RETRY_SYSCALL(res, STATVFS(path, &sb), mp_raise_OSError(err)); + + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL)); + t->items[0] = MP_OBJ_NEW_SMALL_INT(sb.f_bsize); + t->items[1] = MP_OBJ_NEW_SMALL_INT(sb.f_frsize); + t->items[2] = MP_OBJ_NEW_SMALL_INT(sb.f_blocks); + t->items[3] = MP_OBJ_NEW_SMALL_INT(sb.f_bfree); + t->items[4] = MP_OBJ_NEW_SMALL_INT(sb.f_bavail); + t->items[5] = MP_OBJ_NEW_SMALL_INT(sb.f_files); + t->items[6] = MP_OBJ_NEW_SMALL_INT(sb.f_ffree); + t->items[7] = MP_OBJ_NEW_SMALL_INT(F_FAVAIL); + t->items[8] = MP_OBJ_NEW_SMALL_INT(F_FLAG); + t->items[9] = MP_OBJ_NEW_SMALL_INT(F_NAMEMAX); + return MP_OBJ_FROM_PTR(t); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_statvfs_obj, mod_os_statvfs); +#endif + +STATIC mp_obj_t mod_os_remove(mp_obj_t path_in) { + const char *path = mp_obj_str_get_str(path_in); + + // Note that POSIX requires remove() to be able to delete a directory + // too (act as rmdir()). This is POSIX extension to ANSI C semantics + // of that function. But Python remove() follows ANSI C, and explicitly + // required to raise exception on attempt to remove a directory. Thus, + // call POSIX unlink() here. + MP_THREAD_GIL_EXIT(); + int r = unlink(path); + MP_THREAD_GIL_ENTER(); + + RAISE_ERRNO(r, errno); + + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_remove_obj, mod_os_remove); + +STATIC mp_obj_t mod_os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) { + const char *old_path = mp_obj_str_get_str(old_path_in); + const char *new_path = mp_obj_str_get_str(new_path_in); + + MP_THREAD_GIL_EXIT(); + int r = rename(old_path, new_path); + MP_THREAD_GIL_ENTER(); + + RAISE_ERRNO(r, errno); + + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_os_rename_obj, mod_os_rename); + +STATIC mp_obj_t mod_os_rmdir(mp_obj_t path_in) { + const char *path = mp_obj_str_get_str(path_in); + + MP_THREAD_GIL_EXIT(); + int r = rmdir(path); + MP_THREAD_GIL_ENTER(); + + RAISE_ERRNO(r, errno); + + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_rmdir_obj, mod_os_rmdir); + +STATIC mp_obj_t mod_os_system(mp_obj_t cmd_in) { + const char *cmd = mp_obj_str_get_str(cmd_in); + + MP_THREAD_GIL_EXIT(); + int r = system(cmd); + MP_THREAD_GIL_ENTER(); + + RAISE_ERRNO(r, errno); + + return MP_OBJ_NEW_SMALL_INT(r); +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_os_system_obj, mod_os_system); + +STATIC mp_obj_t mod_os_getenv(mp_obj_t var_in) { + #if defined(MICROPY_UNIX_COVERAGE) + mp_obj_t result = common_hal_os_getenv(mp_obj_str_get_str(var_in), mp_const_none); + if (result != mp_const_none) { + return result; + } + #endif + const char *s = getenv(mp_obj_str_get_str(var_in)); + if (s == NULL) { + return mp_const_none; + } + return mp_obj_new_str(s, strlen(s)); +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_obj, mod_os_getenv); + +#if defined(MICROPY_UNIX_COVERAGE) +STATIC mp_obj_t mod_os_getenv_int(mp_obj_t var_in) { + mp_int_t value; + os_getenv_err_t result = common_hal_os_getenv_int(mp_obj_str_get_str(var_in), &value); + if (result == 0) { + return mp_obj_new_int(value); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_int_obj, mod_os_getenv_int); + +STATIC mp_obj_t mod_os_getenv_str(mp_obj_t var_in) { + char buf[4096]; + os_getenv_err_t result = common_hal_os_getenv_str(mp_obj_str_get_str(var_in), buf, sizeof(buf)); + if (result == 0) { + return mp_obj_new_str_copy(&mp_type_str, (byte *)buf, strlen(buf)); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_str_obj, mod_os_getenv_str); +#endif + +STATIC mp_obj_t mod_os_putenv(mp_obj_t key_in, mp_obj_t value_in) { + const char *key = mp_obj_str_get_str(key_in); + const char *value = mp_obj_str_get_str(value_in); + int ret; + + #if _WIN32 + ret = _putenv_s(key, value); + #else + ret = setenv(key, value, 1); + #endif + + if (ret == -1) { + mp_raise_OSError(errno); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(mod_os_putenv_obj, mod_os_putenv); + +STATIC mp_obj_t mod_os_unsetenv(mp_obj_t key_in) { + const char *key = mp_obj_str_get_str(key_in); + int ret; + + #if _WIN32 + ret = _putenv_s(key, ""); + #else + ret = unsetenv(key); + #endif + + if (ret == -1) { + mp_raise_OSError(errno); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_os_unsetenv_obj, mod_os_unsetenv); + +STATIC mp_obj_t mod_os_mkdir(mp_obj_t path_in) { + // TODO: Accept mode param + const char *path = mp_obj_str_get_str(path_in); + MP_THREAD_GIL_EXIT(); + #ifdef _WIN32 + int r = mkdir(path); + #else + int r = mkdir(path, 0777); + #endif + MP_THREAD_GIL_ENTER(); + RAISE_ERRNO(r, errno); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_mkdir_obj, mod_os_mkdir); + +typedef struct _mp_obj_listdir_t { + mp_obj_base_t base; + mp_fun_1_t iternext; + DIR *dir; +} mp_obj_listdir_t; + +STATIC mp_obj_t listdir_next(mp_obj_t self_in) { + mp_obj_listdir_t *self = MP_OBJ_TO_PTR(self_in); + + if (self->dir == NULL) { + goto done; + } + MP_THREAD_GIL_EXIT(); + struct dirent *dirent = readdir(self->dir); + if (dirent == NULL) { + closedir(self->dir); + MP_THREAD_GIL_ENTER(); + self->dir = NULL; + done: + return MP_OBJ_STOP_ITERATION; + } + MP_THREAD_GIL_ENTER(); + + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(3, NULL)); + t->items[0] = mp_obj_new_str(dirent->d_name, strlen(dirent->d_name)); + + #ifdef _DIRENT_HAVE_D_TYPE + #ifdef DTTOIF + t->items[1] = MP_OBJ_NEW_SMALL_INT(DTTOIF(dirent->d_type)); + #else + if (dirent->d_type == DT_DIR) { + t->items[1] = MP_OBJ_NEW_SMALL_INT(MP_S_IFDIR); + } else if (dirent->d_type == DT_REG) { + t->items[1] = MP_OBJ_NEW_SMALL_INT(MP_S_IFREG); + } else { + t->items[1] = MP_OBJ_NEW_SMALL_INT(dirent->d_type); + } + #endif + #else + // DT_UNKNOWN should have 0 value on any reasonable system + t->items[1] = MP_OBJ_NEW_SMALL_INT(0); + #endif + + #ifdef _DIRENT_HAVE_D_INO + t->items[2] = MP_OBJ_NEW_SMALL_INT(dirent->d_ino); + #else + t->items[2] = MP_OBJ_NEW_SMALL_INT(0); + #endif + return MP_OBJ_FROM_PTR(t); +} + +STATIC mp_obj_t mod_os_ilistdir(size_t n_args, const mp_obj_t *args) { + const char *path = "."; + if (n_args > 0) { + path = mp_obj_str_get_str(args[0]); + } + mp_obj_listdir_t *o = m_new_obj(mp_obj_listdir_t); + o->base.type = &mp_type_polymorph_iter; + MP_THREAD_GIL_EXIT(); + o->dir = opendir(path); + MP_THREAD_GIL_ENTER(); + o->iternext = listdir_next; + return MP_OBJ_FROM_PTR(o); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_ilistdir_obj, 0, 1, mod_os_ilistdir); + +STATIC mp_obj_t mod_os_errno(size_t n_args, const mp_obj_t *args) { + if (n_args == 0) { + return MP_OBJ_NEW_SMALL_INT(errno); + } + + errno = mp_obj_get_int(args[0]); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_errno_obj, 0, 1, mod_os_errno); + +STATIC const mp_rom_map_elem_t mp_module_os_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, + { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mod_os_errno_obj) }, + { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mod_os_stat_obj) }, + { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mod_os_urandom_obj) }, + #if MICROPY_PY_OS_STATVFS + { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mod_os_statvfs_obj) }, + #endif + { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mod_os_system_obj) }, + { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mod_os_remove_obj) }, + { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mod_os_rename_obj) }, + { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mod_os_rmdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mod_os_getenv_obj) }, + #if defined(MICROPY_UNIX_COVERAGE) + { MP_ROM_QSTR(MP_QSTR_getenv_int), MP_ROM_PTR(&mod_os_getenv_int_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv_str), MP_ROM_PTR(&mod_os_getenv_str_obj) }, + #endif + { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mod_os_putenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mod_os_unsetenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mod_os_mkdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mod_os_ilistdir_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(mp_module_os_globals, mp_module_os_globals_table); + +const mp_obj_module_t mp_module_os = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&mp_module_os_globals, +}; diff --git a/ports/unix/moduos_vfs.c b/ports/unix/moduos_vfs.c new file mode 100644 index 0000000000..495679290a --- /dev/null +++ b/ports/unix/moduos_vfs.c @@ -0,0 +1,98 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George + * + * 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 "extmod/vfs.h" +#include "extmod/vfs_posix.h" +#include "extmod/vfs_fat.h" +#include "extmod/vfs_lfs.h" + +#if MICROPY_VFS + +// These are defined in modos.c +MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_errno_obj); +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_obj); +#if defined(MICROPY_UNIX_COVERAGE) +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_int_obj); +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_str_obj); +#endif +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_putenv_obj); +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_unsetenv_obj); +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_system_obj); + +STATIC const mp_rom_map_elem_t uos_vfs_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos_vfs) }, + { MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) }, + + { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mod_os_errno_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mod_os_getenv_obj) }, + #if defined(MICROPY_UNIX_COVERAGE) + { MP_ROM_QSTR(MP_QSTR_getenv_int), MP_ROM_PTR(&mod_os_getenv_int_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv_str), MP_ROM_PTR(&mod_os_getenv_str_obj) }, + #endif + { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mod_os_putenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mod_os_unsetenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mod_os_system_obj) }, + + { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, + { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, + + { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, + { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, + { MP_ROM_QSTR(MP_QSTR_rename),MP_ROM_PTR(&mp_vfs_rename_obj) }, + { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, + { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, + { MP_ROM_QSTR(MP_QSTR_unlink), MP_ROM_PTR(&mp_vfs_remove_obj) }, // unlink aliases to remove + + #if MICROPY_VFS_POSIX + { MP_ROM_QSTR(MP_QSTR_VfsPosix), MP_ROM_PTR(&mp_type_vfs_posix) }, + #endif + #if MICROPY_VFS_FAT + { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, + #endif + #if MICROPY_VFS_LFS1 + { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, + #endif + #if MICROPY_VFS_LFS2 + { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, + #endif +}; + +STATIC MP_DEFINE_CONST_DICT(uos_vfs_module_globals, uos_vfs_module_globals_table); + +const mp_obj_module_t mp_module_uos_vfs = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&uos_vfs_module_globals, +}; + +#endif // MICROPY_VFS diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h index b1733f9c1a..58a214178a 100644 --- a/ports/unix/mpconfigport.h +++ b/ports/unix/mpconfigport.h @@ -34,6 +34,9 @@ // If we're building the minimal variant, ignore the rest of this file. #ifndef MICROPY_UNIX_MINIMAL +//CIRCUITPY +#define CIRCUITPY_MICROPYTHON_ADVANCED (1) + // If the variant did not set a feature level then configure a set of features. #ifndef MICROPY_CONFIG_ROM_LEVEL #define MICROPY_COMP_MODULE_CONST (1) @@ -104,6 +107,17 @@ #define MICROPY_ALLOC_PATH_MAX (PATH_MAX) #define MICROPY_PERSISTENT_CODE_LOAD (1) + +//CIRCUITPY: native emitters not supported +#define MICROPY_EMIT_X64 (!CIRCUITPY) +#define MICROPY_EMIT_X86 (!CIRCUITPY) +#define MICROPY_EMIT_THUMB (!CIRCUITPY) +#define MICROPY_EMIT_INLINE_THUMB (!CIRCUITPY) +#define MICROPY_EMIT_ARM (!CIRCUITPY) +#define MICROPY_EMIT_XTENSA (!CIRCUITPY) +#define MICROPY_EMIT_INLINE_XTENSA (!CIRCUITPY) +#define MICROPY_EMIT_XTENSAWIN (!CIRCUITPY) + #if !defined(MICROPY_EMIT_X64) && defined(__x86_64__) #define MICROPY_EMIT_X64 (1) #endif diff --git a/ports/unix/mpconfigport.mk b/ports/unix/mpconfigport.mk index 78a758b769..a0f654597b 100644 --- a/ports/unix/mpconfigport.mk +++ b/ports/unix/mpconfigport.mk @@ -9,7 +9,8 @@ MICROPY_FORCE_32BIT = 0 MICROPY_USE_READLINE = 1 # btree module using Berkeley DB 1.xx -MICROPY_PY_BTREE = 1 +# CIRCUITPY: not present +MICROPY_PY_BTREE = 0 # _thread module using pthreads MICROPY_PY_THREAD = 1 @@ -39,4 +40,7 @@ MICROPY_PY_JNI = 0 # as submodules (currently affects only libffi). MICROPY_STANDALONE = 0 +# CIRCUITPY CIRCUITPY_ULAB = 1 +MICROPY_EMIT_NATIVE = 0 +CFLAGS += -DCIRCUITPY=1 diff --git a/ports/unix/unix_mphal.c b/ports/unix/unix_mphal.c index 08d5d35723..665d038c0d 100644 --- a/ports/unix/unix_mphal.c +++ b/ports/unix/unix_mphal.c @@ -126,7 +126,58 @@ void mp_hal_stdio_mode_orig(void) { #endif +#if MICROPY_PY_OS_DUPTERM +static int call_dupterm_read(size_t idx) { + nlr_buf_t nlr; + if (nlr_push(&nlr) == 0) { + mp_obj_t read_m[3]; + mp_load_method(MP_STATE_VM(dupterm_objs[idx]), MP_QSTR_read, read_m); + read_m[2] = MP_OBJ_NEW_SMALL_INT(1); + mp_obj_t res = mp_call_method_n_kw(1, 0, read_m); + if (res == mp_const_none) { + return -2; + } + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(res, &bufinfo, MP_BUFFER_READ); + if (bufinfo.len == 0) { + mp_printf(&mp_plat_print, "dupterm: EOF received, deactivating\n"); + MP_STATE_VM(dupterm_objs[idx]) = MP_OBJ_NULL; + return -1; + } + nlr_pop(); + return *(byte *)bufinfo.buf; + } else { + // Temporarily disable dupterm to avoid infinite recursion + mp_obj_t save_term = MP_STATE_VM(dupterm_objs[idx]); + MP_STATE_VM(dupterm_objs[idx]) = NULL; + mp_printf(&mp_plat_print, "dupterm: "); + mp_obj_print_exception(&mp_plat_print, nlr.ret_val); + MP_STATE_VM(dupterm_objs[idx]) = save_term; + } + + return -1; +} +#endif + int mp_hal_stdin_rx_chr(void) { + #if MICROPY_PY_OS_DUPTERM + // TODO only support dupterm one slot at the moment + if (MP_STATE_VM(dupterm_objs[0]) != MP_OBJ_NULL) { + int c; + do { + c = call_dupterm_read(0); + } while (c == -2); + if (c == -1) { + goto main_term; + } + if (c == '\n') { + c = '\r'; + } + return c; + } +main_term:; + #endif + unsigned char c; ssize_t ret; MP_HAL_RETRY_SYSCALL(ret, read(STDIN_FILENO, &c, 1), {}); @@ -141,6 +192,9 @@ int mp_hal_stdin_rx_chr(void) { void mp_hal_stdout_tx_strn(const char *str, size_t len) { ssize_t ret; MP_HAL_RETRY_SYSCALL(ret, write(STDOUT_FILENO, str, len), {}); + #if MICROPY_PY_OS_DUPTERM + mp_uos_dupterm_tx_strn(str, len); + #endif } // cooked is same as uncooked because the terminal does some postprocessing diff --git a/py/mkrules.mk b/py/mkrules.mk index 730ac9704f..5b871af62b 100644 --- a/py/mkrules.mk +++ b/py/mkrules.mk @@ -236,3 +236,8 @@ print-def: @$(RM) -f __empty__.c -include $(OBJ:.o=.P) + +# Print out the value of a make variable. +# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile +print-%: + @echo $* = $($*) diff --git a/py/modsys.c b/py/modsys.c index 92779914b0..63fb654f05 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * SPDX-FileCopyrightText: Copyright (c) 2013, 2014 Damien P. George + * Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2014-2017 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -36,6 +36,7 @@ #include "py/smallint.h" #include "py/runtime.h" #include "py/persistentcode.h" +#include "extmod/moduplatform.h" #include "genhdr/mpversion.h" #if MICROPY_PY_SYS_SETTRACE diff --git a/py/objexcept.c b/py/objexcept.c index b19844c0ad..4aaa9ec592 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -659,3 +659,172 @@ void mp_obj_exception_get_traceback(mp_obj_t self_in, size_t *n, size_t **values *values = self->traceback->data; } } + +#if MICROPY_PY_SYS_EXC_INFO +STATIC const mp_obj_namedtuple_type_t code_type_obj = { + .base = { + .base = { + .type = &mp_type_type + }, + .flags = MP_TYPE_FLAG_EXTENDED, + .name = MP_QSTR_code, + .print = namedtuple_print, + .make_new = namedtuple_make_new, + .parent = &mp_type_tuple, + .attr = namedtuple_attr, + MP_TYPE_EXTENDED_FIELDS( + .unary_op = mp_obj_tuple_unary_op, + .binary_op = mp_obj_tuple_binary_op, + .subscr = mp_obj_tuple_subscr, + .getiter = mp_obj_tuple_getiter, + ), + }, + .n_fields = 15, + .fields = { + MP_QSTR_co_argcount, + MP_QSTR_co_kwonlyargcount, + MP_QSTR_co_nlocals, + MP_QSTR_co_stacksize, + MP_QSTR_co_flags, + MP_QSTR_co_code, + MP_QSTR_co_consts, + MP_QSTR_co_names, + MP_QSTR_co_varnames, + MP_QSTR_co_freevars, + MP_QSTR_co_cellvars, + MP_QSTR_co_filename, + MP_QSTR_co_name, + MP_QSTR_co_firstlineno, + MP_QSTR_co_lnotab, + }, +}; + +STATIC mp_obj_t code_make_new(qstr file, qstr block) { + mp_obj_t elems[15] = { + mp_obj_new_int(0), // co_argcount + mp_obj_new_int(0), // co_kwonlyargcount + mp_obj_new_int(0), // co_nlocals + mp_obj_new_int(0), // co_stacksize + mp_obj_new_int(0), // co_flags + mp_obj_new_bytearray(0, NULL), // co_code + mp_obj_new_tuple(0, NULL), // co_consts + mp_obj_new_tuple(0, NULL), // co_names + mp_obj_new_tuple(0, NULL), // co_varnames + mp_obj_new_tuple(0, NULL), // co_freevars + mp_obj_new_tuple(0, NULL), // co_cellvars + MP_OBJ_NEW_QSTR(file), // co_filename + MP_OBJ_NEW_QSTR(block), // co_name + mp_obj_new_int(1), // co_firstlineno + mp_obj_new_bytearray(0, NULL), // co_lnotab + }; + + return namedtuple_make_new((const mp_obj_type_t *)&code_type_obj, 15, 0, elems); +} + +STATIC const mp_obj_namedtuple_type_t frame_type_obj = { + .base = { + .base = { + .type = &mp_type_type + }, + .name = MP_QSTR_frame, + .print = namedtuple_print, + .make_new = namedtuple_make_new, + .parent = &mp_type_tuple, + .attr = namedtuple_attr, + MP_TYPE_EXTENDED_FIELDS( + .unary_op = mp_obj_tuple_unary_op, + .binary_op = mp_obj_tuple_binary_op, + .subscr = mp_obj_tuple_subscr, + .getiter = mp_obj_tuple_getiter, + ), + }, + .n_fields = 8, + .fields = { + MP_QSTR_f_back, + MP_QSTR_f_builtins, + MP_QSTR_f_code, + MP_QSTR_f_globals, + MP_QSTR_f_lasti, + MP_QSTR_f_lineno, + MP_QSTR_f_locals, + MP_QSTR_f_trace, + }, +}; + +STATIC mp_obj_t frame_make_new(mp_obj_t f_code, int f_lineno) { + mp_obj_t elems[8] = { + mp_const_none, // f_back + mp_obj_new_dict(0), // f_builtins + f_code, // f_code + mp_obj_new_dict(0), // f_globals + mp_obj_new_int(0), // f_lasti + mp_obj_new_int(f_lineno), // f_lineno + mp_obj_new_dict(0), // f_locals + mp_const_none, // f_trace + }; + + return namedtuple_make_new((const mp_obj_type_t *)&frame_type_obj, 8, 0, elems); +} + +STATIC const mp_obj_namedtuple_type_t traceback_type_obj = { + .base = { + .base = { + .type = &mp_type_type + }, + .flags = MP_TYPE_FLAG_EXTENDED, + .name = MP_QSTR_traceback, + .print = namedtuple_print, + .make_new = namedtuple_make_new, + .parent = &mp_type_tuple, + .attr = namedtuple_attr, + MP_TYPE_EXTENDED_FIELDS( + .unary_op = mp_obj_tuple_unary_op, + .binary_op = mp_obj_tuple_binary_op, + .subscr = mp_obj_tuple_subscr, + .getiter = mp_obj_tuple_getiter, + ), + }, + .n_fields = 4, + .fields = { + MP_QSTR_tb_frame, + MP_QSTR_tb_lasti, + MP_QSTR_tb_lineno, + MP_QSTR_tb_next, + }, +}; + +STATIC mp_obj_t traceback_from_values(size_t *values, mp_obj_t tb_next) { + int lineno = values[1]; + + mp_obj_t elems[4] = { + frame_make_new(code_make_new(values[0], values[2]), lineno), + mp_obj_new_int(0), + mp_obj_new_int(lineno), + tb_next, + }; + + return namedtuple_make_new((const mp_obj_type_t *)&traceback_type_obj, 4, 0, elems); +}; + +mp_obj_t mp_obj_exception_get_traceback_obj(mp_obj_t self_in) { + mp_obj_exception_t *self = MP_OBJ_TO_PTR(self_in); + + if (!mp_obj_is_exception_instance(self)) { + return mp_const_none; + } + + size_t n, *values; + mp_obj_exception_get_traceback(self, &n, &values); + if (n == 0) { + return mp_const_none; + } + + mp_obj_t tb_next = mp_const_none; + + for (size_t i = 0; i < n; i += 3) { + tb_next = traceback_from_values(&values[i], tb_next); + } + + return tb_next; +} +#endif diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c index 80f70b528a..cbfdec4797 100644 --- a/supervisor/shared/background_callback.c +++ b/supervisor/shared/background_callback.c @@ -68,7 +68,7 @@ void PLACE_IN_ITCM(background_callback_add)(background_callback_t * cb, backgrou background_callback_add_core(cb); } -bool inline background_callback_pending(void) { +inline bool background_callback_pending(void) { return callback_head != NULL; } From c0f39076dc52619a1f6cacb6b633c04ade0f5aa9 Mon Sep 17 00:00:00 2001 From: Andi Chandler Date: Sun, 13 Aug 2023 01:11:52 +0000 Subject: [PATCH 1474/1712] Translated using Weblate (English (United Kingdom)) Currently translated at 100.0% (998 of 998 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/en_GB/ --- locale/en_GB.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/locale/en_GB.po b/locale/en_GB.po index 085c7e7b47..90bea5884c 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-08-06 17:45+0000\n" +"PO-Revision-Date: 2023-08-14 01:48+0000\n" "Last-Translator: Andi Chandler \n" "Language-Team: none\n" "Language: en_GB\n" @@ -266,19 +266,19 @@ msgstr "%q=%q" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts in more bits than pin count" -msgstr "" +msgstr "%q[%u] shifts in more bits than pin count" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts out more bits than pin count" -msgstr "" +msgstr "%q[%u] shifts out more bits than pin count" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] uses extra pin" -msgstr "" +msgstr "%q[%u] uses extra pin" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] waits on input outside of count" -msgstr "" +msgstr "%q[%u] waits on input outside of count" #: ports/espressif/common-hal/espidf/__init__.c #, c-format @@ -1370,31 +1370,31 @@ msgstr "Mismatched swap flag" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] reads pin(s)" -msgstr "" +msgstr "Missing first_in_pin. %q[%u] reads pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" -msgstr "" +msgstr "Missing first_in_pin. %q[%u] shifts in from pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] waits based on pin" -msgstr "" +msgstr "Missing first_in_pin. %q[%u] waits based on pin" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" -msgstr "" +msgstr "Missing first_out_pin. %q[%u] shifts out to pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] writes pin(s)" -msgstr "" +msgstr "Missing first_out_pin. %q[%u] writes pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_set_pin. %q[%u] sets pin(s)" -msgstr "" +msgstr "Missing first_set_pin. %q[%u] sets pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing jmp_pin. %q[%u] jumps on pin" -msgstr "" +msgstr "Missing jmp_pin. %q[%u] jumps on pin" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." From d582407b066e2bc6ba9a91cec8d34f9afd0cacea Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Aug 2023 00:47:22 -0400 Subject: [PATCH 1475/1712] pre-commit fixes --- .codespell/ignore-words.txt | 4 + extmod/extmod.mk | 1 - extmod/moduasyncio.c | 2 +- extmod/moduplatform.h | 2 +- extmod/modure.c | 2 +- locale/circuitpython.pot | 108 +++++++++------- main.c | 8 +- mpy-cross/mpconfigport.h | 2 +- .../boards/circuitbrains_basic_m0/pins.c | 14 +- .../boards/circuitbrains_deluxe_m4/pins.c | 14 +- ports/atmel-samd/boards/datalore_ip_m4/pins.c | 18 +-- .../atmel-samd/boards/matrixportal_m4/pins.c | 52 ++++---- .../boards/metro_m4_airlift_lite/pins.c | 20 +-- .../atmel-samd/boards/metro_m4_express/pins.c | 20 +-- ports/atmel-samd/boards/picoplanet/pins.c | 14 +- ports/atmel-samd/boards/pyportal/pins.c | 16 +-- .../atmel-samd/boards/pyportal_titano/pins.c | 16 +-- ports/atmel-samd/boards/pyruler/pins.c | 4 +- ports/atmel-samd/boards/sam32/pins.c | 4 +- ports/atmel-samd/boards/trinket_m0/pins.c | 4 +- .../boards/trinket_m0_haxpress/pins.c | 4 +- ports/atmel-samd/boards/uartlogger2/pins.c | 18 +-- ports/atmel-samd/common-hal/alarm/__init__.c | 4 +- .../common-hal/digitalio/DigitalInOut.c | 2 +- .../common-hal/neopixel_write/__init__.c | 2 +- .../boards/diodes_delight_piunora/pins.c | 26 ++-- ports/espressif/bindings/espnow/ESPNow.c | 26 ++-- ports/espressif/bindings/espnow/__init__.c | 2 +- .../boards/adafruit_matrixportal_s3/pins.c | 44 +++---- .../boards/adafruit_metro_esp32s2/pins.c | 16 +-- .../boards/adafruit_metro_esp32s3/pins.c | 16 +-- ports/espressif/boards/m5stack_core2/board.c | 30 ++--- ports/espressif/boards/m5stack_core2/pins.c | 4 +- .../boards/m5stack_core_basic/board.c | 30 ++--- .../boards/m5stack_core_basic/pins.c | 2 +- .../boards/m5stack_core_fire/board.c | 30 ++--- .../espressif/boards/m5stack_core_fire/pins.c | 2 +- .../espressif/boards/m5stack_stick_c/board.c | 38 +++--- .../boards/m5stack_stick_c_plus/board.c | 38 +++--- .../espressif/boards/mixgo_ce_serial/board.c | 2 +- .../boards/odt_pixelwing_esp32_s2/pins.c | 4 +- ports/espressif/common-hal/alarm/__init__.c | 8 +- .../common-hal/analogbufio/BufferedIn.c | 22 ++-- ports/espressif/common-hal/canio/Listener.c | 4 +- .../espressif/common-hal/socketpool/Socket.c | 2 +- ports/espressif/i2s_lcd_esp32s2_driver.c | 4 +- ports/litex/irq.h | 4 +- ports/litex/supervisor/internal_flash.c | 4 +- .../boards/adafruit_metro_m7_1011_sd/pins.c | 4 +- ports/mimxrt10xx/boards/metro_m7_1011/pins.c | 4 +- ports/mimxrt10xx/boards/teensy40/board.c | 38 ------ ports/mimxrt10xx/common-hal/busio/UART.c | 2 +- .../mimxrt10xx/MIMXRT1015/clocks.c | 2 +- .../mimxrt10xx/MIMXRT1042/clocks.c | 2 +- .../mimxrt10xx/MIMXRT1052/clocks.c | 2 +- .../mimxrt10xx/MIMXRT1062/clocks.c | 2 +- .../mimxrt10xx/MIMXRT1176/clocks.c | 2 +- ports/mimxrt10xx/supervisor/port.c | 4 +- .../boards/Seeed_XIAO_nRF52840_Sense/pins.c | 8 +- .../nrf/boards/metro_nrf52840_express/pins.c | 2 +- .../nrf/boards/ssci_isp1807_dev_board/pins.c | 8 +- .../boards/ssci_isp1807_micro_board/pins.c | 24 ++-- ports/nrf/common-hal/alarm/__init__.c | 4 +- .../nrf/common-hal/microcontroller/__init__.c | 4 +- .../bindings/rp2pio/StateMachine.c | 2 +- ports/raspberrypi/common-hal/alarm/__init__.c | 4 +- .../raspberrypi/common-hal/pulseio/PulseIn.c | 14 +- .../common-hal/rp2pio/StateMachine.c | 2 +- .../boards/devkit_xg24_brd2601b/sensor.c | 24 ++-- .../silabs/common-hal/_bleio/Characteristic.c | 12 +- .../common-hal/_bleio/CharacteristicBuffer.c | 2 +- ports/silabs/common-hal/_bleio/Connection.c | 8 +- ports/silabs/common-hal/_bleio/__init__.c | 14 +- ports/silabs/common-hal/busio/UART.c | 6 +- .../common-hal/digitalio/DigitalInOut.c | 22 ++-- ports/silabs/common-hal/microcontroller/Pin.c | 4 +- ports/silabs/supervisor/internal_flash.c | 2 +- ports/stm/common-hal/alarm/__init__.c | 4 +- ports/stm/common-hal/alarm/pin/PinAlarm.c | 2 +- ports/stm/common-hal/alarm/time/TimeAlarm.c | 8 +- ports/stm/common-hal/analogio/AnalogIn.c | 4 +- ports/stm/common-hal/analogio/AnalogOut.c | 2 +- ports/stm/common-hal/busio/I2C.c | 4 +- ports/stm/common-hal/busio/SPI.c | 24 ++-- ports/stm/common-hal/busio/UART.c | 4 +- .../common-hal/microcontroller/Processor.c | 4 +- ports/stm/common-hal/os/__init__.c | 2 +- ports/stm/common-hal/sdioio/SDCard.c | 4 +- .../peripherals/stm32f4/stm32f401xe/gpio.c | 8 +- .../peripherals/stm32f4/stm32f401xe/pins.c | 32 ++--- .../peripherals/stm32f4/stm32f405xx/gpio.c | 10 +- .../peripherals/stm32f4/stm32f405xx/pins.c | 48 +++---- .../peripherals/stm32f4/stm32f407xx/gpio.c | 10 +- .../peripherals/stm32f4/stm32f407xx/pins.c | 48 +++---- .../peripherals/stm32f4/stm32f411xe/gpio.c | 8 +- .../peripherals/stm32f4/stm32f411xe/periph.c | 86 ++++++------- .../peripherals/stm32f4/stm32f412cx/gpio.c | 4 +- .../peripherals/stm32f4/stm32f412cx/pins.c | 20 +-- .../peripherals/stm32f4/stm32f412zx/gpio.c | 10 +- .../peripherals/stm32f4/stm32f412zx/periph.c | 120 +++++++++--------- .../peripherals/stm32f4/stm32f412zx/pins.c | 32 ++--- .../peripherals/stm32f7/stm32f746xx/gpio.c | 12 +- .../peripherals/stm32f7/stm32f767xx/gpio.c | 8 +- .../peripherals/stm32h7/stm32h743xx/gpio.c | 8 +- .../peripherals/stm32l4/stm32l4r5xx/gpio.c | 8 +- ports/stm/supervisor/serial.c | 4 +- ports/unix/main.c | 2 +- ports/unix/moduos_vfs.c | 2 +- ports/unix/mpconfigport.h | 4 +- py/builtinimport.c | 2 +- py/formatfloat.c | 2 +- py/gc.c | 6 +- py/makeqstrdata.py | 5 +- py/makeqstrdefs.py | 1 + py/parse.c | 4 +- py/runtime.c | 20 +-- shared-bindings/_bleio/__init__.c | 4 +- shared-bindings/audiobusio/PDMIn.c | 2 +- shared-bindings/bitbangio/SPI.c | 2 +- shared-bindings/busio/SPI.c | 2 +- shared-bindings/busio/UART.c | 2 +- shared-bindings/displayio/Bitmap.c | 2 +- shared-bindings/displayio/Group.c | 2 +- shared-bindings/memorymonitor/__init__.c | 2 +- shared-bindings/usb/core/Device.c | 2 +- shared-bindings/usb/core/__init__.c | 2 +- shared-bindings/usb_hid/Device.h | 2 +- shared-module/aesio/aes.c | 2 +- shared-module/bitmaptools/__init__.c | 2 +- shared-module/displayio/ColorConverter.c | 18 +-- shared-module/displayio/display_core.c | 2 +- shared-module/os/getenv.c | 2 +- shared-module/qrio/quirc_alloc.h | 2 +- shared-module/synthio/Math.c | 4 +- shared-module/synthio/__init__.c | 2 +- shared/runtime/pyexec.c | 4 +- supervisor/linker.h | 2 +- supervisor/shared/display.c | 2 +- supervisor/shared/safe_mode.c | 2 +- tools/ci.sh | 2 +- tools/codeformat.py | 8 +- 141 files changed, 800 insertions(+), 805 deletions(-) mode change 100755 => 100644 ports/atmel-samd/boards/circuitbrains_deluxe_m4/pins.c mode change 100755 => 100644 ports/espressif/boards/m5stack_core_fire/board.c mode change 100755 => 100644 ports/espressif/boards/m5stack_stick_c/board.c mode change 100755 => 100644 ports/espressif/boards/m5stack_stick_c_plus/board.c diff --git a/.codespell/ignore-words.txt b/.codespell/ignore-words.txt index f2a8dc2be5..87abbcf8e3 100644 --- a/.codespell/ignore-words.txt +++ b/.codespell/ignore-words.txt @@ -20,3 +20,7 @@ deques extint shs pass-thru +numer +arithmetics +ftbfs +straightaway diff --git a/extmod/extmod.mk b/extmod/extmod.mk index ff24a549a9..83b1854c1e 100644 --- a/extmod/extmod.mk +++ b/extmod/extmod.mk @@ -228,4 +228,3 @@ CFLAGS_MOD += -DMICROPY_PY_BTREE=1 $(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter $(BTREE_DEFS) $(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS) endif - diff --git a/extmod/moduasyncio.c b/extmod/moduasyncio.c index 4c0436b2db..014de0db27 100644 --- a/extmod/moduasyncio.c +++ b/extmod/moduasyncio.c @@ -266,7 +266,7 @@ STATIC void task_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) { dest[1] = self_in; } else if (attr == MP_QSTR_ph_key) { dest[0] = self->ph_key; - // CIRCUITPY provides __await__(). + // CIRCUITPY provides __await__(). } else if (attr == MP_QSTR___await__) { dest[0] = MP_OBJ_FROM_PTR(&task_await_obj); dest[1] = self_in; diff --git a/extmod/moduplatform.h b/extmod/moduplatform.h index 2b9ad3ae49..d52ad7da7d 100644 --- a/extmod/moduplatform.h +++ b/extmod/moduplatform.h @@ -29,7 +29,7 @@ #include "py/misc.h" // For MP_STRINGIFY. #include "py/mpconfig.h" -// Preprocessor directives indentifying the platform. +// Preprocessor directives identifying the platform. // The (u)platform module itself is guarded by MICROPY_PY_UPLATFORM, see the // .c file, but these are made available because they're generally usable. // TODO: Add more architectures, compilers and libraries. diff --git a/extmod/modure.c b/extmod/modure.c index bac8cd4550..805c23d4ad 100644 --- a/extmod/modure.c +++ b/extmod/modure.c @@ -39,7 +39,7 @@ #include "lib/re1.5/re1.5.h" -//CIRCUITPY +// CIRCUITPY #if MICROPY_PY_URE_DEBUG #define FLAG_DEBUG 0x1000 #endif diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 0759f70c0c..1ca523bae2 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -139,6 +139,10 @@ msgstr "" msgid "%q index out of range" msgstr "" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "" @@ -214,7 +218,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -417,6 +421,10 @@ msgstr "" msgid "'yield' outside function" msgstr "" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "" @@ -840,10 +848,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -1138,12 +1142,6 @@ msgstr "" msgid "In-buffer elements must be <= 4 bytes long" msgstr "" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "" @@ -1490,7 +1488,7 @@ msgstr "" msgid "No in or out in program" msgstr "" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "" @@ -2498,6 +2496,10 @@ msgstr "" msgid "array/bytes required on right side" msgstr "" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" @@ -2587,6 +2589,10 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2632,7 +2638,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2641,6 +2647,11 @@ msgstr "" msgid "can't convert %s to complex" msgstr "" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "" @@ -2650,11 +2661,11 @@ msgid "can't convert complex to float" msgstr "" #: py/obj.c -msgid "can't convert to %q" +msgid "can't convert to complex" msgstr "" #: py/obj.c -msgid "can't convert to complex" +msgid "can't convert to float" msgstr "" #: py/runtime.c @@ -2681,14 +2692,6 @@ msgstr "" msgid "can't do truncated division of a complex number" msgstr "" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "" @@ -2743,6 +2746,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "" @@ -2839,10 +2846,6 @@ msgstr "" msgid "compression header" msgstr "" -#: py/parse.c -msgid "constant must be an integer" -msgstr "" - #: py/emitnative.c msgid "conversion to object" msgstr "" @@ -3179,7 +3182,11 @@ msgid "import * not at module level" msgstr "" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" msgstr "" #: py/objstr.c @@ -3208,6 +3215,10 @@ msgstr "" msgid "index out of range" msgstr "" +#: py/obj.c +msgid "indices must be integers" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "" @@ -3341,10 +3352,6 @@ msgstr "" msgid "invalid exception" msgstr "" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "" - #: py/objstr.c msgid "invalid format specifier" msgstr "" @@ -3406,10 +3413,6 @@ msgstr "" msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "" -#: py/bc.c -msgid "keywords must be strings" -msgstr "" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "" @@ -3634,14 +3637,6 @@ msgstr "" msgid "non-hex digit found" msgstr "" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "" @@ -3654,6 +3649,10 @@ msgstr "" msgid "not a 128-bit UUID" msgstr "" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "" @@ -3892,6 +3891,14 @@ msgstr "" msgid "port must be >= 0" msgstr "" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "" @@ -3920,6 +3927,11 @@ msgstr "" msgid "relative import" msgstr "" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "" @@ -4114,6 +4126,10 @@ msgstr "" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "" @@ -4139,6 +4155,10 @@ msgstr "" msgid "trapz is defined for 1D iterables" msgstr "" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" diff --git a/main.c b/main.c index 122f079129..a22a7eba19 100644 --- a/main.c +++ b/main.c @@ -418,8 +418,8 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) { }; #if CIRCUITPY_FULL_BUILD static const char *const double_extension_filenames[] = { - "code.txt.py", "code.py.txt", "code.txt.txt","code.py.py", - "main.txt.py", "main.py.txt", "main.txt.txt","main.py.py" + "code.txt.py", "code.py.txt", "code.txt.txt", "code.py.py", + "main.txt.py", "main.py.txt", "main.txt.txt", "main.py.py" }; #endif @@ -992,9 +992,9 @@ int __attribute__((used)) main(void) { #if CIRCUITPY_BOOT_COUNTER // Increment counter before possibly entering safe mode - common_hal_nvm_bytearray_get_bytes(&common_hal_mcu_nvm_obj,0,1,&value_out); + common_hal_nvm_bytearray_get_bytes(&common_hal_mcu_nvm_obj, 0, 1, &value_out); ++value_out; - common_hal_nvm_bytearray_set_bytes(&common_hal_mcu_nvm_obj,0,&value_out,1); + common_hal_nvm_bytearray_set_bytes(&common_hal_mcu_nvm_obj, 0, &value_out, 1); #endif // Start the debug serial diff --git a/mpy-cross/mpconfigport.h b/mpy-cross/mpconfigport.h index 334cdda267..fd667e6617 100644 --- a/mpy-cross/mpconfigport.h +++ b/mpy-cross/mpconfigport.h @@ -38,7 +38,7 @@ #endif #endif -//CIRCUITPY: native emitters not supported +// CIRCUITPY: native emitters not supported #define MICROPY_EMIT_X64 (!CIRCUITPY) #define MICROPY_EMIT_X86 (!CIRCUITPY) #define MICROPY_EMIT_THUMB (!CIRCUITPY) diff --git a/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c b/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c index ee2b947077..0ecaf555eb 100644 --- a/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c +++ b/ports/atmel-samd/boards/circuitbrains_basic_m0/pins.c @@ -22,15 +22,15 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA15) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_PA14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_STATUS_LED),MP_ROM_PTR(&pin_PA14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_STATUS_LED), MP_ROM_PTR(&pin_PA14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PA04) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PA05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PA04) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PA05) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA11) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA10) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA09) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA11) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA10) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA09) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, diff --git a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/pins.c b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/pins.c old mode 100755 new mode 100644 index 55001af5f7..69f7ca050a --- a/ports/atmel-samd/boards/circuitbrains_deluxe_m4/pins.c +++ b/ports/atmel-samd/boards/circuitbrains_deluxe_m4/pins.c @@ -39,8 +39,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PB14) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_STATUS_LED),MP_ROM_PTR(&pin_PB13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_PB13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_STATUS_LED), MP_ROM_PTR(&pin_PB13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PB13) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_PB12) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_PB31) }, @@ -48,12 +48,12 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_PB23) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_PB22) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB02) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB03) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA14) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, diff --git a/ports/atmel-samd/boards/datalore_ip_m4/pins.c b/ports/atmel-samd/boards/datalore_ip_m4/pins.c index 8e52b20769..bd922755dc 100644 --- a/ports/atmel-samd/boards/datalore_ip_m4/pins.c +++ b/ports/atmel-samd/boards/datalore_ip_m4/pins.c @@ -28,19 +28,19 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA19) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA17) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA16) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB02) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB03) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL),MP_ROM_PTR(&pin_PB22) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB22) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED_RX),MP_ROM_PTR(&pin_PB06) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED_TX),MP_ROM_PTR(&pin_PA27) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED_RX), MP_ROM_PTR(&pin_PB06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED_TX), MP_ROM_PTR(&pin_PA27) }, { 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_UART), MP_ROM_PTR(&board_uart_obj) }, diff --git a/ports/atmel-samd/boards/matrixportal_m4/pins.c b/ports/atmel-samd/boards/matrixportal_m4/pins.c index 205cd6f3c6..05c2aeb134 100644 --- a/ports/atmel-samd/boards/matrixportal_m4/pins.c +++ b/ports/atmel-samd/boards/matrixportal_m4/pins.c @@ -9,8 +9,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA06) }, { MP_OBJ_NEW_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_PA07) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_TX),MP_ROM_PTR(&pin_PA00) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_RX),MP_ROM_PTR(&pin_PA01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_PA00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA01) }, // ESP control { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_CS), MP_ROM_PTR(&pin_PB17) }, @@ -21,41 +21,41 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PA13) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PA12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB30) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB31) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB30) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB31) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL),MP_ROM_PTR(&pin_PA23) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA23) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA16) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA19) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA17) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA19) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA17) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_R1),MP_ROM_PTR(&pin_PB00) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_G1),MP_ROM_PTR(&pin_PB01) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_B1),MP_ROM_PTR(&pin_PB02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_R1), MP_ROM_PTR(&pin_PB00) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_G1), MP_ROM_PTR(&pin_PB01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_B1), MP_ROM_PTR(&pin_PB02) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_R2),MP_ROM_PTR(&pin_PB03) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_G2),MP_ROM_PTR(&pin_PB04) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_B2),MP_ROM_PTR(&pin_PB05) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_R2), MP_ROM_PTR(&pin_PB03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_G2), MP_ROM_PTR(&pin_PB04) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_B2), MP_ROM_PTR(&pin_PB05) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRA),MP_ROM_PTR(&pin_PB07) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRB),MP_ROM_PTR(&pin_PB08) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRC),MP_ROM_PTR(&pin_PB09) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRD),MP_ROM_PTR(&pin_PB15) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRE),MP_ROM_PTR(&pin_PB13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRA), MP_ROM_PTR(&pin_PB07) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRB), MP_ROM_PTR(&pin_PB08) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRC), MP_ROM_PTR(&pin_PB09) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRD), MP_ROM_PTR(&pin_PB15) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRE), MP_ROM_PTR(&pin_PB13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_CLK),MP_ROM_PTR(&pin_PB06) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_LAT),MP_ROM_PTR(&pin_PB14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_OE),MP_ROM_PTR(&pin_PB12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_CLK), MP_ROM_PTR(&pin_PB06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_LAT), MP_ROM_PTR(&pin_PB14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_OE), MP_ROM_PTR(&pin_PB12) }, { MP_ROM_QSTR(MP_QSTR_ACCELEROMETER_INTERRUPT), MP_ROM_PTR(&pin_PA27) }, // Grounded when closed. - { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_UP),MP_ROM_PTR(&pin_PB22) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_DOWN),MP_ROM_PTR(&pin_PB23) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_UP), MP_ROM_PTR(&pin_PB22) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_DOWN), MP_ROM_PTR(&pin_PB23) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_PA14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_L),MP_ROM_PTR(&pin_PA14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_PA14) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, diff --git a/ports/atmel-samd/boards/metro_m4_airlift_lite/pins.c b/ports/atmel-samd/boards/metro_m4_airlift_lite/pins.c index dcb6774da8..5c496aa63b 100644 --- a/ports/atmel-samd/boards/metro_m4_airlift_lite/pins.c +++ b/ports/atmel-samd/boards/metro_m4_airlift_lite/pins.c @@ -29,8 +29,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA19) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA17) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_PA16) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA16) }, // ESP control { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_CS), MP_ROM_PTR(&pin_PA15) }, @@ -41,17 +41,17 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PA04) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PA07) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB02) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB03) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL),MP_ROM_PTR(&pin_PB22) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB22) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED_RX),MP_ROM_PTR(&pin_PB06) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED_TX),MP_ROM_PTR(&pin_PB07) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED_RX), MP_ROM_PTR(&pin_PB06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED_TX), MP_ROM_PTR(&pin_PB07) }, { 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_UART), MP_ROM_PTR(&board_uart_obj) }, diff --git a/ports/atmel-samd/boards/metro_m4_express/pins.c b/ports/atmel-samd/boards/metro_m4_express/pins.c index 1f96885cc1..f7e50f6453 100644 --- a/ports/atmel-samd/boards/metro_m4_express/pins.c +++ b/ports/atmel-samd/boards/metro_m4_express/pins.c @@ -29,20 +29,20 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA19) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA17) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_PA16) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA16) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB02) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB03) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL),MP_ROM_PTR(&pin_PB22) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB22) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED_RX),MP_ROM_PTR(&pin_PB06) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED_TX),MP_ROM_PTR(&pin_PA27) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED_RX), MP_ROM_PTR(&pin_PB06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED_TX), MP_ROM_PTR(&pin_PA27) }, { 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_UART), MP_ROM_PTR(&board_uart_obj) }, diff --git a/ports/atmel-samd/boards/picoplanet/pins.c b/ports/atmel-samd/boards/picoplanet/pins.c index 5a6abec10a..1691063fc9 100644 --- a/ports/atmel-samd/boards/picoplanet/pins.c +++ b/ports/atmel-samd/boards/picoplanet/pins.c @@ -7,15 +7,15 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA03) }, { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_PA04) }, - { MP_ROM_QSTR(MP_QSTR_D5),MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_GREEN_LED),MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_GREEN_LED), MP_ROM_PTR(&pin_PA05) }, - { MP_ROM_QSTR(MP_QSTR_D6),MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_RED_LED),MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_RED_LED), MP_ROM_PTR(&pin_PA06) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA06) }, - { MP_ROM_QSTR(MP_QSTR_D7),MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_BLUE_LED),MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_PA07) }, + { MP_ROM_QSTR(MP_QSTR_BLUE_LED), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_PA08) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_PA08) }, diff --git a/ports/atmel-samd/boards/pyportal/pins.c b/ports/atmel-samd/boards/pyportal/pins.c index 1fa05cc460..bdff2358ba 100644 --- a/ports/atmel-samd/boards/pyportal/pins.c +++ b/ports/atmel-samd/boards/pyportal/pins.c @@ -29,7 +29,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB23) }, { MP_OBJ_NEW_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_PB23) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL),MP_ROM_PTR(&pin_PB22) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB22) }, // LCD pins { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_PA00) }, @@ -65,17 +65,17 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PB13) }, // SPI - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA14) }, // I2C - { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB02) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB03) }, // SD Card - { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS),MP_ROM_PTR(&pin_PB30) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CARD_DETECT),MP_ROM_PTR(&pin_PA01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_PB30) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CARD_DETECT), MP_ROM_PTR(&pin_PA01) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, diff --git a/ports/atmel-samd/boards/pyportal_titano/pins.c b/ports/atmel-samd/boards/pyportal_titano/pins.c index 1fa05cc460..bdff2358ba 100644 --- a/ports/atmel-samd/boards/pyportal_titano/pins.c +++ b/ports/atmel-samd/boards/pyportal_titano/pins.c @@ -29,7 +29,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PB23) }, { MP_OBJ_NEW_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_PB23) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL),MP_ROM_PTR(&pin_PB22) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB22) }, // LCD pins { MP_OBJ_NEW_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_PA00) }, @@ -65,17 +65,17 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PB13) }, // SPI - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA14) }, // I2C - { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB02) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB03) }, // SD Card - { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS),MP_ROM_PTR(&pin_PB30) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CARD_DETECT),MP_ROM_PTR(&pin_PA01) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_PB30) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CARD_DETECT), MP_ROM_PTR(&pin_PA01) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, diff --git a/ports/atmel-samd/boards/pyruler/pins.c b/ports/atmel-samd/boards/pyruler/pins.c index 27583539f3..a607af30f9 100644 --- a/ports/atmel-samd/boards/pyruler/pins.c +++ b/ports/atmel-samd/boards/pyruler/pins.c @@ -41,8 +41,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA10) }, { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA00) }, { MP_ROM_QSTR(MP_QSTR_DOTSTAR_DATA), MP_ROM_PTR(&pin_PA00) }, diff --git a/ports/atmel-samd/boards/sam32/pins.c b/ports/atmel-samd/boards/sam32/pins.c index 68e4a13e95..33abb0d7aa 100644 --- a/ports/atmel-samd/boards/sam32/pins.c +++ b/ports/atmel-samd/boards/sam32/pins.c @@ -13,7 +13,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PB13) }, { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PB12) }, { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PB14) }, - { MP_ROM_QSTR(MP_QSTR_xSDCS),MP_ROM_PTR(&pin_PA04) }, + { MP_ROM_QSTR(MP_QSTR_xSDCS), MP_ROM_PTR(&pin_PA04) }, { MP_ROM_QSTR(MP_QSTR_DAC0), MP_ROM_PTR(&pin_PA02) }, { MP_ROM_QSTR(MP_QSTR_DAC1), MP_ROM_PTR(&pin_PA05) }, @@ -43,7 +43,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_TCK), MP_ROM_PTR(&pin_PB01) }, { MP_ROM_QSTR(MP_QSTR_TDI), MP_ROM_PTR(&pin_PB02) }, { MP_ROM_QSTR(MP_QSTR_TMS), MP_ROM_PTR(&pin_PB03) }, - { MP_ROM_QSTR(MP_QSTR_ESP_CS),MP_ROM_PTR(&pin_PB15) }, + { MP_ROM_QSTR(MP_QSTR_ESP_CS), MP_ROM_PTR(&pin_PB15) }, { MP_ROM_QSTR(MP_QSTR_TX1), MP_ROM_PTR(&pin_PA12) }, { MP_ROM_QSTR(MP_QSTR_RX1), MP_ROM_PTR(&pin_PA13) }, diff --git a/ports/atmel-samd/boards/trinket_m0/pins.c b/ports/atmel-samd/boards/trinket_m0/pins.c index f9db8ff994..1c93f935e3 100644 --- a/ports/atmel-samd/boards/trinket_m0/pins.c +++ b/ports/atmel-samd/boards/trinket_m0/pins.c @@ -25,8 +25,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA10) }, { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA00) }, { MP_ROM_QSTR(MP_QSTR_DOTSTAR_DATA), MP_ROM_PTR(&pin_PA00) }, diff --git a/ports/atmel-samd/boards/trinket_m0_haxpress/pins.c b/ports/atmel-samd/boards/trinket_m0_haxpress/pins.c index f9db8ff994..1c93f935e3 100644 --- a/ports/atmel-samd/boards/trinket_m0_haxpress/pins.c +++ b/ports/atmel-samd/boards/trinket_m0_haxpress/pins.c @@ -25,8 +25,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_PA07) }, { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA07) }, - { MP_ROM_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_PA10) }, - { MP_ROM_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PA10) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA10) }, { MP_ROM_QSTR(MP_QSTR_APA102_MOSI), MP_ROM_PTR(&pin_PA00) }, { MP_ROM_QSTR(MP_QSTR_DOTSTAR_DATA), MP_ROM_PTR(&pin_PA00) }, diff --git a/ports/atmel-samd/boards/uartlogger2/pins.c b/ports/atmel-samd/boards/uartlogger2/pins.c index 4af8871ff0..4dc3ee6e4f 100644 --- a/ports/atmel-samd/boards/uartlogger2/pins.c +++ b/ports/atmel-samd/boards/uartlogger2/pins.c @@ -28,7 +28,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_PA18) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_PA19) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA17) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_PA16) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_PA16) }, // ESP control { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_CS), MP_ROM_PTR(&pin_PA15) }, @@ -39,17 +39,17 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_PA04) }, { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_PA07) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_PB02) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_PB03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_PB02) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_PB03) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL),MP_ROM_PTR(&pin_PB22) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PB22) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCK),MP_ROM_PTR(&pin_PA13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_PA12) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_PA14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_PA13) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_PA12) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_PA14) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED_RX),MP_ROM_PTR(&pin_PB06) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED_TX),MP_ROM_PTR(&pin_PB07) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED_RX), MP_ROM_PTR(&pin_PB06) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED_TX), MP_ROM_PTR(&pin_PB07) }, { 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_UART), MP_ROM_PTR(&board_uart_obj) }, diff --git a/ports/atmel-samd/common-hal/alarm/__init__.c b/ports/atmel-samd/common-hal/alarm/__init__.c index 96d6d9694a..f71e3c1806 100644 --- a/ports/atmel-samd/common-hal/alarm/__init__.c +++ b/ports/atmel-samd/common-hal/alarm/__init__.c @@ -113,11 +113,11 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj RUN_BACKGROUND_TASKS; // Detect if interrupt was alarm or ctrl-C interrupt. if (alarm_time_timealarm_woke_this_cycle()) { - wake_alarm = alarm_time_timealarm_find_triggered_alarm(n_alarms,alarms); + wake_alarm = alarm_time_timealarm_find_triggered_alarm(n_alarms, alarms); break; } if (alarm_pin_pinalarm_woke_this_cycle()) { - wake_alarm = alarm_pin_pinalarm_find_triggered_alarm(n_alarms,alarms); + wake_alarm = alarm_pin_pinalarm_find_triggered_alarm(n_alarms, alarms); break; } diff --git a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c index dc770a2de3..5e8381e337 100644 --- a/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c +++ b/ports/atmel-samd/common-hal/digitalio/DigitalInOut.c @@ -112,7 +112,7 @@ void common_hal_digitalio_digitalinout_set_value( } } else { hri_port_set_DIR_DIR_bf(PORT, port, pin_mask); - hri_port_clear_OUT_OUT_bf(PORT,port, pin_mask); + hri_port_clear_OUT_OUT_bf(PORT, port, pin_mask); } } diff --git a/ports/atmel-samd/common-hal/neopixel_write/__init__.c b/ports/atmel-samd/common-hal/neopixel_write/__init__.c index ac9a804333..3520037afe 100644 --- a/ports/atmel-samd/common-hal/neopixel_write/__init__.c +++ b/ports/atmel-samd/common-hal/neopixel_write/__init__.c @@ -42,7 +42,7 @@ #include "hri/hri_nvmctrl_d51.h" #endif -__attribute__((naked,noinline,aligned(16))) +__attribute__((naked, noinline, aligned(16))) static void neopixel_send_buffer_core(volatile uint32_t *clraddr, uint32_t pinMask, const uint8_t *ptr, int numBytes); diff --git a/ports/broadcom/boards/diodes_delight_piunora/pins.c b/ports/broadcom/boards/diodes_delight_piunora/pins.c index c1098d1412..a6907d3985 100644 --- a/ports/broadcom/boards/diodes_delight_piunora/pins.c +++ b/ports/broadcom/boards/diodes_delight_piunora/pins.c @@ -27,40 +27,40 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_GPIO22), MP_ROM_PTR(&pin_GPIO22) }, { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO22) }, - { MP_ROM_QSTR(MP_QSTR_SDA6),MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_SDA6), MP_ROM_PTR(&pin_GPIO22) }, { MP_ROM_QSTR(MP_QSTR_GPIO23), MP_ROM_PTR(&pin_GPIO23) }, { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO23) }, - { MP_ROM_QSTR(MP_QSTR_SCL6),MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_SCL6), MP_ROM_PTR(&pin_GPIO23) }, { MP_ROM_QSTR(MP_QSTR_GPIO6), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO6) }, - { MP_ROM_QSTR(MP_QSTR_SDA4),MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_SDA4), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_GPIO7), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_SCL4),MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_SPI0_CE1),MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_SCL4), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_SPI0_CE1), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_GPIO8), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO8) }, - { MP_ROM_QSTR(MP_QSTR_SPI0_CE0),MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_SPI0_CE0), MP_ROM_PTR(&pin_GPIO8) }, { MP_ROM_QSTR(MP_QSTR_GPIO10), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO10) }, - { MP_ROM_QSTR(MP_QSTR_SPI0_MOSI),MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_SPI0_MOSI), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_GPIO9), MP_ROM_PTR(&pin_GPIO9) }, { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO9) }, - { MP_ROM_QSTR(MP_QSTR_SPI0_MISO),MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_SPI0_MISO), MP_ROM_PTR(&pin_GPIO9) }, { MP_ROM_QSTR(MP_QSTR_GPIO11), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_SPI0_SCLK),MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_SPI0_SCLK), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_SDA1),MP_ROM_PTR(&pin_GPIO2) }, - { MP_ROM_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_SDA1), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_GPIO12), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO12) }, diff --git a/ports/espressif/bindings/espnow/ESPNow.c b/ports/espressif/bindings/espnow/ESPNow.c index 2caabd13c3..6255e19f86 100644 --- a/ports/espressif/bindings/espnow/ESPNow.c +++ b/ports/espressif/bindings/espnow/ESPNow.c @@ -283,29 +283,29 @@ MP_PROPERTY_GETTER(espnow_peers_obj, STATIC const mp_rom_map_elem_t espnow_locals_dict_table[] = { // Context managers - { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) }, - { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&espnow___exit___obj) }, + { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&mp_identity_obj) }, + { MP_ROM_QSTR(MP_QSTR___exit__), MP_ROM_PTR(&espnow___exit___obj) }, // Deinit the object - { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&espnow_deinit_obj) }, + { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&espnow_deinit_obj) }, // Send messages - { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&espnow_send_obj) }, - { MP_ROM_QSTR(MP_QSTR_send_success),MP_ROM_PTR(&espnow_send_success_obj)}, - { MP_ROM_QSTR(MP_QSTR_send_failure),MP_ROM_PTR(&espnow_send_failure_obj)}, + { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&espnow_send_obj) }, + { MP_ROM_QSTR(MP_QSTR_send_success), MP_ROM_PTR(&espnow_send_success_obj)}, + { MP_ROM_QSTR(MP_QSTR_send_failure), MP_ROM_PTR(&espnow_send_failure_obj)}, // Read messages - { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&espnow_read_obj) }, - { MP_ROM_QSTR(MP_QSTR_read_success),MP_ROM_PTR(&espnow_read_success_obj)}, - { MP_ROM_QSTR(MP_QSTR_read_failure),MP_ROM_PTR(&espnow_read_failure_obj)}, + { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&espnow_read_obj) }, + { MP_ROM_QSTR(MP_QSTR_read_success), MP_ROM_PTR(&espnow_read_success_obj)}, + { MP_ROM_QSTR(MP_QSTR_read_failure), MP_ROM_PTR(&espnow_read_failure_obj)}, // Config parameters - { MP_ROM_QSTR(MP_QSTR_set_pmk), MP_ROM_PTR(&espnow_set_pmk_obj) }, - { MP_ROM_QSTR(MP_QSTR_buffer_size), MP_ROM_PTR(&espnow_buffer_size_obj) }, - { MP_ROM_QSTR(MP_QSTR_phy_rate), MP_ROM_PTR(&espnow_phy_rate_obj) }, + { MP_ROM_QSTR(MP_QSTR_set_pmk), MP_ROM_PTR(&espnow_set_pmk_obj) }, + { MP_ROM_QSTR(MP_QSTR_buffer_size), MP_ROM_PTR(&espnow_buffer_size_obj) }, + { MP_ROM_QSTR(MP_QSTR_phy_rate), MP_ROM_PTR(&espnow_phy_rate_obj) }, // Peer related properties - { MP_ROM_QSTR(MP_QSTR_peers), MP_ROM_PTR(&espnow_peers_obj) }, + { MP_ROM_QSTR(MP_QSTR_peers), MP_ROM_PTR(&espnow_peers_obj) }, }; STATIC MP_DEFINE_CONST_DICT(espnow_locals_dict, espnow_locals_dict_table); diff --git a/ports/espressif/bindings/espnow/__init__.c b/ports/espressif/bindings/espnow/__init__.c index e0493a2897..e44cd6b11f 100644 --- a/ports/espressif/bindings/espnow/__init__.c +++ b/ports/espressif/bindings/espnow/__init__.c @@ -80,7 +80,7 @@ STATIC const mp_rom_map_elem_t espnow_module_globals_table[] = { // module classes { MP_ROM_QSTR(MP_QSTR_ESPNow), MP_ROM_PTR(&espnow_type) }, - { MP_ROM_QSTR(MP_QSTR_ESPNowPacket),MP_ROM_PTR(&espnow_packet_type_obj) }, + { MP_ROM_QSTR(MP_QSTR_ESPNowPacket), MP_ROM_PTR(&espnow_packet_type_obj) }, { MP_ROM_QSTR(MP_QSTR_Peer), MP_ROM_PTR(&espnow_peer_type) }, { MP_ROM_QSTR(MP_QSTR_Peers), MP_ROM_PTR(&espnow_peers_type) }, }; diff --git a/ports/espressif/boards/adafruit_matrixportal_s3/pins.c b/ports/espressif/boards/adafruit_matrixportal_s3/pins.c index 5cdd9ab92c..3485bf0b68 100644 --- a/ports/espressif/boards/adafruit_matrixportal_s3/pins.c +++ b/ports/espressif/boards/adafruit_matrixportal_s3/pins.c @@ -28,10 +28,10 @@ STATIC const mp_rom_obj_tuple_t matrix_data_tuple = { }; STATIC const mp_rom_map_elem_t matrix_common_table[] = { - { MP_OBJ_NEW_QSTR(MP_QSTR_rgb_pins),MP_ROM_PTR(&matrix_data_tuple) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_clock_pin),MP_ROM_PTR(&pin_GPIO2) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_latch_pin),MP_ROM_PTR(&pin_GPIO47) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_output_enable_pin),MP_ROM_PTR(&pin_GPIO14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_rgb_pins), MP_ROM_PTR(&matrix_data_tuple) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_clock_pin), MP_ROM_PTR(&pin_GPIO2) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_latch_pin), MP_ROM_PTR(&pin_GPIO47) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_output_enable_pin), MP_ROM_PTR(&pin_GPIO14) }, }; MP_DEFINE_CONST_DICT(matrix_common_dict, matrix_common_table); @@ -66,32 +66,32 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRESS),MP_ROM_PTR(&matrix_addr_tuple) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_COMMON),MP_ROM_PTR(&matrix_common_dict) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRESS), MP_ROM_PTR(&matrix_addr_tuple) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_COMMON), MP_ROM_PTR(&matrix_common_dict) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_R1),MP_ROM_PTR(&pin_GPIO42) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_G1),MP_ROM_PTR(&pin_GPIO41) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_B1),MP_ROM_PTR(&pin_GPIO40) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_R1), MP_ROM_PTR(&pin_GPIO42) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_G1), MP_ROM_PTR(&pin_GPIO41) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_B1), MP_ROM_PTR(&pin_GPIO40) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_R2),MP_ROM_PTR(&pin_GPIO38) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_G2),MP_ROM_PTR(&pin_GPIO39) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_B2),MP_ROM_PTR(&pin_GPIO37) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_R2), MP_ROM_PTR(&pin_GPIO38) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_G2), MP_ROM_PTR(&pin_GPIO39) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_B2), MP_ROM_PTR(&pin_GPIO37) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRA),MP_ROM_PTR(&pin_GPIO45) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRB),MP_ROM_PTR(&pin_GPIO36) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRC),MP_ROM_PTR(&pin_GPIO48) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRD),MP_ROM_PTR(&pin_GPIO35) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRE),MP_ROM_PTR(&pin_GPIO21) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRA), MP_ROM_PTR(&pin_GPIO45) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRB), MP_ROM_PTR(&pin_GPIO36) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRC), MP_ROM_PTR(&pin_GPIO48) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRD), MP_ROM_PTR(&pin_GPIO35) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_ADDRE), MP_ROM_PTR(&pin_GPIO21) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_CLK),MP_ROM_PTR(&pin_GPIO2) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_LAT),MP_ROM_PTR(&pin_GPIO47) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_OE),MP_ROM_PTR(&pin_GPIO14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_CLK), MP_ROM_PTR(&pin_GPIO2) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_LAT), MP_ROM_PTR(&pin_GPIO47) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MTX_OE), MP_ROM_PTR(&pin_GPIO14) }, { MP_ROM_QSTR(MP_QSTR_ACCELEROMETER_INTERRUPT), MP_ROM_PTR(&pin_GPIO15) }, // Grounded when closed. - { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_UP),MP_ROM_PTR(&pin_GPIO6) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_DOWN),MP_ROM_PTR(&pin_GPIO7) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_UP), MP_ROM_PTR(&pin_GPIO6) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_BUTTON_DOWN), MP_ROM_PTR(&pin_GPIO7) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/pins.c b/ports/espressif/boards/adafruit_metro_esp32s2/pins.c index 1f024f6e8e..39b47466d0 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/pins.c +++ b/ports/espressif/boards/adafruit_metro_esp32s2/pins.c @@ -39,20 +39,20 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_GPIO33) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_IO33),MP_ROM_PTR(&pin_GPIO33) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO33) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_GPIO34) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_IO34),MP_ROM_PTR(&pin_GPIO34) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO34) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO34), MP_ROM_PTR(&pin_GPIO34) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_GPIO35) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_IO35),MP_ROM_PTR(&pin_GPIO35) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_GPIO37) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_IO37),MP_ROM_PTR(&pin_GPIO37) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO42) }, diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c index dfad4381ef..0f510737f7 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c +++ b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c @@ -66,20 +66,20 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_GPIO47) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_IO47),MP_ROM_PTR(&pin_GPIO47) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO47) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_GPIO48) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_IO48),MP_ROM_PTR(&pin_GPIO48) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO48) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI),MP_ROM_PTR(&pin_GPIO35) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_IO35),MP_ROM_PTR(&pin_GPIO35) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_MISO),MP_ROM_PTR(&pin_GPIO37) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_IO37),MP_ROM_PTR(&pin_GPIO37) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO45) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, diff --git a/ports/espressif/boards/m5stack_core2/board.c b/ports/espressif/boards/m5stack_core2/board.c index 5080617df4..e64ac35a7d 100644 --- a/ports/espressif/boards/m5stack_core2/board.c +++ b/ports/espressif/boards/m5stack_core2/board.c @@ -48,21 +48,21 @@ displayio_fourwire_obj_t board_display_obj; // display init sequence according to M5Gfx uint8_t display_init_sequence[] = { - 0x01,DELAY,0x80, // Software reset then delay 0x80 (128ms) - 0xC8,0x03,0xFF,0x93,0x42, // Turn on the external command - 0xC0,0x02,0x12, 0x12, // Power Control 1 - 0xC1,0x01,0x03, // Power Control 2 - 0xC5,0x01,0xF2, // VCOM Control 1 - 0xB0,0x01,0xE0, // RGB Interface SYNC Mode - 0xF6,0x03,0x01, 0x00, 0x00, // Interface control - 0XE0,0x0F,0x00,0x0C,0x11,0x04,0x11,0x08,0x37,0x89,0x4C,0x06,0x0C,0x0A,0x2E,0x34,0x0F, // Positive Gamma Correction - 0xE1,0x0F,0x00,0x0B,0x11,0x05,0x13,0x09,0x33,0x67,0x48,0x07,0x0E,0x0B,0x2E,0x33,0x0F, // Negative Gamma Correction - 0xB6,0x04,0x08,0x82,0x1D,0x04, // Display Function Control - 0x3A,0x01,0x55, // COLMOD: Pixel Format Set 16 bit - 0x21,0x00, // Display inversion ON - 0x36,0x01,0x08, // Memory Access Control: RGB order - 0x11,DELAY,0x78, // Exit Sleep then delay 0x78 (120ms) - 0x29,DELAY,0x78, // Display on then delay 0x78 (120ms) + 0x01, DELAY, 0x80, // Software reset then delay 0x80 (128ms) + 0xC8, 0x03, 0xFF, 0x93, 0x42, // Turn on the external command + 0xC0, 0x02, 0x12, 0x12, // Power Control 1 + 0xC1, 0x01, 0x03, // Power Control 2 + 0xC5, 0x01, 0xF2, // VCOM Control 1 + 0xB0, 0x01, 0xE0, // RGB Interface SYNC Mode + 0xF6, 0x03, 0x01, 0x00, 0x00, // Interface control + 0XE0, 0x0F, 0x00, 0x0C, 0x11, 0x04, 0x11, 0x08, 0x37, 0x89, 0x4C, 0x06, 0x0C, 0x0A, 0x2E, 0x34, 0x0F, // Positive Gamma Correction + 0xE1, 0x0F, 0x00, 0x0B, 0x11, 0x05, 0x13, 0x09, 0x33, 0x67, 0x48, 0x07, 0x0E, 0x0B, 0x2E, 0x33, 0x0F, // Negative Gamma Correction + 0xB6, 0x04, 0x08, 0x82, 0x1D, 0x04, // Display Function Control + 0x3A, 0x01, 0x55, // COLMOD: Pixel Format Set 16 bit + 0x21, 0x00, // Display inversion ON + 0x36, 0x01, 0x08, // Memory Access Control: RGB order + 0x11, DELAY, 0x78, // Exit Sleep then delay 0x78 (120ms) + 0x29, DELAY, 0x78, // Display on then delay 0x78 (120ms) }; static bool pmic_set_power_source(uint8_t source, busio_i2c_obj_t *i2c) { diff --git a/ports/espressif/boards/m5stack_core2/pins.c b/ports/espressif/boards/m5stack_core2/pins.c index ee8fe21ad9..bc936655fe 100644 --- a/ports/espressif/boards/m5stack_core2/pins.c +++ b/ports/espressif/boards/m5stack_core2/pins.c @@ -80,10 +80,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { // { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO32) }, AXP_DC3 // sd card - { MP_ROM_QSTR(MP_QSTR_SD_CS),MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO4) }, // touch screen - { MP_ROM_QSTR(MP_QSTR_TOUCH_INT),MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_TOUCH_INT), MP_ROM_PTR(&pin_GPIO39) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_PORTA_I2C), MP_ROM_PTR(&board_porta_i2c_obj) }, diff --git a/ports/espressif/boards/m5stack_core_basic/board.c b/ports/espressif/boards/m5stack_core_basic/board.c index 68eff30782..270f3a64ed 100644 --- a/ports/espressif/boards/m5stack_core_basic/board.c +++ b/ports/espressif/boards/m5stack_core_basic/board.c @@ -38,21 +38,21 @@ displayio_fourwire_obj_t board_display_obj; // display init sequence according to M5Gfx uint8_t display_init_sequence[] = { - 0x01,0x80,0x80, // Software reset then delay 0x80 (128ms) - 0xC8,0x03,0xFF,0x93,0x42, // Turn on the external command - 0xC0,0x02,0x12, 0x12, // Power Control 1 - 0xC1,0x01,0x03, // Power Control 2 - 0xC5,0x01,0xF2, // VCOM Control 1 - 0xB0,0x01,0xE0, // RGB Interface SYNC Mode - 0xF6,0x03,0x01, 0x00, 0x00, // Interface control - 0XE0,0x0F,0x00,0x0C,0x11,0x04,0x11,0x08,0x37,0x89,0x4C,0x06,0x0C,0x0A,0x2E,0x34,0x0F, // Positive Gamma Correction - 0xE1,0x0F,0x00,0x0B,0x11,0x05,0x13,0x09,0x33,0x67,0x48,0x07,0x0E,0x0B,0x2E,0x33,0x0F, // Negative Gamma Correction - 0xB6,0x04,0x08,0x82,0x1D,0x04, // Display Function Control - 0x3A,0x01,0x55, // COLMOD: Pixel Format Set 16 bit - 0x21,0x00, // Display inversion ON - 0x36,0x01,0x08, // Memory Access Control: RGB order - 0x11,0x80,0x78, // Exit Sleep then delay 0x78 (120ms) - 0x29,0x80,0x78, // Display on then delay 0x78 (120ms) + 0x01, 0x80, 0x80, // Software reset then delay 0x80 (128ms) + 0xC8, 0x03, 0xFF, 0x93, 0x42, // Turn on the external command + 0xC0, 0x02, 0x12, 0x12, // Power Control 1 + 0xC1, 0x01, 0x03, // Power Control 2 + 0xC5, 0x01, 0xF2, // VCOM Control 1 + 0xB0, 0x01, 0xE0, // RGB Interface SYNC Mode + 0xF6, 0x03, 0x01, 0x00, 0x00, // Interface control + 0XE0, 0x0F, 0x00, 0x0C, 0x11, 0x04, 0x11, 0x08, 0x37, 0x89, 0x4C, 0x06, 0x0C, 0x0A, 0x2E, 0x34, 0x0F, // Positive Gamma Correction + 0xE1, 0x0F, 0x00, 0x0B, 0x11, 0x05, 0x13, 0x09, 0x33, 0x67, 0x48, 0x07, 0x0E, 0x0B, 0x2E, 0x33, 0x0F, // Negative Gamma Correction + 0xB6, 0x04, 0x08, 0x82, 0x1D, 0x04, // Display Function Control + 0x3A, 0x01, 0x55, // COLMOD: Pixel Format Set 16 bit + 0x21, 0x00, // Display inversion ON + 0x36, 0x01, 0x08, // Memory Access Control: RGB order + 0x11, 0x80, 0x78, // Exit Sleep then delay 0x78 (120ms) + 0x29, 0x80, 0x78, // Display on then delay 0x78 (120ms) }; void board_init(void) { diff --git a/ports/espressif/boards/m5stack_core_basic/pins.c b/ports/espressif/boards/m5stack_core_basic/pins.c index b985231bea..b03ab55dbf 100644 --- a/ports/espressif/boards/m5stack_core_basic/pins.c +++ b/ports/espressif/boards/m5stack_core_basic/pins.c @@ -76,7 +76,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_BTN_C), MP_ROM_PTR(&pin_GPIO37) }, // sd card - { MP_ROM_QSTR(MP_QSTR_SD_CS),MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO4) }, // tft { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO14) }, diff --git a/ports/espressif/boards/m5stack_core_fire/board.c b/ports/espressif/boards/m5stack_core_fire/board.c old mode 100755 new mode 100644 index 68eff30782..270f3a64ed --- a/ports/espressif/boards/m5stack_core_fire/board.c +++ b/ports/espressif/boards/m5stack_core_fire/board.c @@ -38,21 +38,21 @@ displayio_fourwire_obj_t board_display_obj; // display init sequence according to M5Gfx uint8_t display_init_sequence[] = { - 0x01,0x80,0x80, // Software reset then delay 0x80 (128ms) - 0xC8,0x03,0xFF,0x93,0x42, // Turn on the external command - 0xC0,0x02,0x12, 0x12, // Power Control 1 - 0xC1,0x01,0x03, // Power Control 2 - 0xC5,0x01,0xF2, // VCOM Control 1 - 0xB0,0x01,0xE0, // RGB Interface SYNC Mode - 0xF6,0x03,0x01, 0x00, 0x00, // Interface control - 0XE0,0x0F,0x00,0x0C,0x11,0x04,0x11,0x08,0x37,0x89,0x4C,0x06,0x0C,0x0A,0x2E,0x34,0x0F, // Positive Gamma Correction - 0xE1,0x0F,0x00,0x0B,0x11,0x05,0x13,0x09,0x33,0x67,0x48,0x07,0x0E,0x0B,0x2E,0x33,0x0F, // Negative Gamma Correction - 0xB6,0x04,0x08,0x82,0x1D,0x04, // Display Function Control - 0x3A,0x01,0x55, // COLMOD: Pixel Format Set 16 bit - 0x21,0x00, // Display inversion ON - 0x36,0x01,0x08, // Memory Access Control: RGB order - 0x11,0x80,0x78, // Exit Sleep then delay 0x78 (120ms) - 0x29,0x80,0x78, // Display on then delay 0x78 (120ms) + 0x01, 0x80, 0x80, // Software reset then delay 0x80 (128ms) + 0xC8, 0x03, 0xFF, 0x93, 0x42, // Turn on the external command + 0xC0, 0x02, 0x12, 0x12, // Power Control 1 + 0xC1, 0x01, 0x03, // Power Control 2 + 0xC5, 0x01, 0xF2, // VCOM Control 1 + 0xB0, 0x01, 0xE0, // RGB Interface SYNC Mode + 0xF6, 0x03, 0x01, 0x00, 0x00, // Interface control + 0XE0, 0x0F, 0x00, 0x0C, 0x11, 0x04, 0x11, 0x08, 0x37, 0x89, 0x4C, 0x06, 0x0C, 0x0A, 0x2E, 0x34, 0x0F, // Positive Gamma Correction + 0xE1, 0x0F, 0x00, 0x0B, 0x11, 0x05, 0x13, 0x09, 0x33, 0x67, 0x48, 0x07, 0x0E, 0x0B, 0x2E, 0x33, 0x0F, // Negative Gamma Correction + 0xB6, 0x04, 0x08, 0x82, 0x1D, 0x04, // Display Function Control + 0x3A, 0x01, 0x55, // COLMOD: Pixel Format Set 16 bit + 0x21, 0x00, // Display inversion ON + 0x36, 0x01, 0x08, // Memory Access Control: RGB order + 0x11, 0x80, 0x78, // Exit Sleep then delay 0x78 (120ms) + 0x29, 0x80, 0x78, // Display on then delay 0x78 (120ms) }; void board_init(void) { diff --git a/ports/espressif/boards/m5stack_core_fire/pins.c b/ports/espressif/boards/m5stack_core_fire/pins.c index f26f96ac8e..6694e284d1 100644 --- a/ports/espressif/boards/m5stack_core_fire/pins.c +++ b/ports/espressif/boards/m5stack_core_fire/pins.c @@ -78,7 +78,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_BTN_C), MP_ROM_PTR(&pin_GPIO37) }, // sd card - { MP_ROM_QSTR(MP_QSTR_SD_CS),MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO4) }, // tft { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO14) }, diff --git a/ports/espressif/boards/m5stack_stick_c/board.c b/ports/espressif/boards/m5stack_stick_c/board.c old mode 100755 new mode 100644 index e6a0125fb4..779125a017 --- a/ports/espressif/boards/m5stack_stick_c/board.c +++ b/ports/espressif/boards/m5stack_stick_c/board.c @@ -41,25 +41,25 @@ // display init sequence according to adafruit_st7735r.py library uint8_t display_init_sequence[] = { - 0x01,0x80,0x96, // SWRESET and Delay 150ms - 0x11,0x80,0xff, // SLPOUT and Delay - 0xb1,0x03,0x01,0x2C,0x2D, // _FRMCTR1 - 0xb2,0x03,0x01,0x2C,0x2D, // _FRMCTR2 - 0xb3,0x06,0x01,0x2C,0x2D,0x01,0x2C,0x2D, // _FRMCTR3 - 0xb4,0x01,0x07, // _INVCTR line inversion - 0xc0,0x03,0xa2,0x02,0x84, // _PWCTR1 GVDD = 4.7V, 1.0uA - 0xc1,0x01,0xc5, // _PWCTR2 VGH=14.7V, VGL=-7.35V - 0xc2,0x02,0x0a,0x00, // _PWCTR3 Opamp current small, Boost frequency - 0xc3,0x02,0x8a,0x2a, - 0xc4,0x02,0x8a,0xee, - 0xc5,0x01,0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V - 0x36,0x01,0xc8, // MADCTL Rotate display - 0x21,0x00, // _INVON - 0x3a,0x01,0x05, // COLMOD - 16bit color - 0xe0,0x10,0x02,0x1c,0x07,0x12,0x37,0x32,0x29,0x2d,0x29,0x25,0x2B,0x39,0x00,0x01,0x03,0x10, // _GMCTRP1 Gamma - 0xe1,0x10,0x03,0x1d,0x07,0x06,0x2E,0x2C,0x29,0x2D,0x2E,0x2E,0x37,0x3F,0x00,0x00,0x02,0x10, // _GMCTRN1 - 0x13,0x80,0x0a, // _NORON - 0x29,0x80,0x64 // _DISPON + 0x01, 0x80, 0x96, // SWRESET and Delay 150ms + 0x11, 0x80, 0xff, // SLPOUT and Delay + 0xb1, 0x03, 0x01, 0x2C, 0x2D, // _FRMCTR1 + 0xb2, 0x03, 0x01, 0x2C, 0x2D, // _FRMCTR2 + 0xb3, 0x06, 0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D, // _FRMCTR3 + 0xb4, 0x01, 0x07, // _INVCTR line inversion + 0xc0, 0x03, 0xa2, 0x02, 0x84, // _PWCTR1 GVDD = 4.7V, 1.0uA + 0xc1, 0x01, 0xc5, // _PWCTR2 VGH=14.7V, VGL=-7.35V + 0xc2, 0x02, 0x0a, 0x00, // _PWCTR3 Opamp current small, Boost frequency + 0xc3, 0x02, 0x8a, 0x2a, + 0xc4, 0x02, 0x8a, 0xee, + 0xc5, 0x01, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V + 0x36, 0x01, 0xc8, // MADCTL Rotate display + 0x21, 0x00, // _INVON + 0x3a, 0x01, 0x05, // COLMOD - 16bit color + 0xe0, 0x10, 0x02, 0x1c, 0x07, 0x12, 0x37, 0x32, 0x29, 0x2d, 0x29, 0x25, 0x2B, 0x39, 0x00, 0x01, 0x03, 0x10, // _GMCTRP1 Gamma + 0xe1, 0x10, 0x03, 0x1d, 0x07, 0x06, 0x2E, 0x2C, 0x29, 0x2D, 0x2E, 0x2E, 0x37, 0x3F, 0x00, 0x00, 0x02, 0x10, // _GMCTRN1 + 0x13, 0x80, 0x0a, // _NORON + 0x29, 0x80, 0x64 // _DISPON }; static bool pmic_init(busio_i2c_obj_t *i2c) { diff --git a/ports/espressif/boards/m5stack_stick_c_plus/board.c b/ports/espressif/boards/m5stack_stick_c_plus/board.c old mode 100755 new mode 100644 index 8188ac9ded..ea43209c24 --- a/ports/espressif/boards/m5stack_stick_c_plus/board.c +++ b/ports/espressif/boards/m5stack_stick_c_plus/board.c @@ -41,25 +41,25 @@ // display init sequence according to adafruit_st7735r.py library uint8_t display_init_sequence[] = { - 0x01,0x80,0x96, // SWRESET and Delay 150ms - 0x11,0x80,0xff, // SLPOUT and Delay - 0xb1,0x03,0x01,0x2C,0x2D, // _FRMCTR1 - 0xb2,0x03,0x01,0x2C,0x2D, // _FRMCTR2 - 0xb3,0x06,0x01,0x2C,0x2D,0x01,0x2C,0x2D, // _FRMCTR3 - 0xb4,0x01,0x07, // _INVCTR line inversion - 0xc0,0x03,0xa2,0x02,0x84, // _PWCTR1 GVDD = 4.7V, 1.0uA - 0xc1,0x01,0xc5, // _PWCTR2 VGH=14.7V, VGL=-7.35V - 0xc2,0x02,0x0a,0x00, // _PWCTR3 Opamp current small, Boost frequency - 0xc3,0x02,0x8a,0x2a, - 0xc4,0x02,0x8a,0xee, - 0xc5,0x01,0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V - 0x36,0x01,0xc8, // MADCTL Rotate display - 0x21,0x00, // _INVON - 0x3a,0x01,0x05, // COLMOD - 16bit color - 0xe0,0x10,0x02,0x1c,0x07,0x12,0x37,0x32,0x29,0x2d,0x29,0x25,0x2B,0x39,0x00,0x01,0x03,0x10, // _GMCTRP1 Gamma - 0xe1,0x10,0x03,0x1d,0x07,0x06,0x2E,0x2C,0x29,0x2D,0x2E,0x2E,0x37,0x3F,0x00,0x00,0x02,0x10, // _GMCTRN1 - 0x13,0x80,0x0a, // _NORON - 0x29,0x80,0x64 // _DISPON + 0x01, 0x80, 0x96, // SWRESET and Delay 150ms + 0x11, 0x80, 0xff, // SLPOUT and Delay + 0xb1, 0x03, 0x01, 0x2C, 0x2D, // _FRMCTR1 + 0xb2, 0x03, 0x01, 0x2C, 0x2D, // _FRMCTR2 + 0xb3, 0x06, 0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D, // _FRMCTR3 + 0xb4, 0x01, 0x07, // _INVCTR line inversion + 0xc0, 0x03, 0xa2, 0x02, 0x84, // _PWCTR1 GVDD = 4.7V, 1.0uA + 0xc1, 0x01, 0xc5, // _PWCTR2 VGH=14.7V, VGL=-7.35V + 0xc2, 0x02, 0x0a, 0x00, // _PWCTR3 Opamp current small, Boost frequency + 0xc3, 0x02, 0x8a, 0x2a, + 0xc4, 0x02, 0x8a, 0xee, + 0xc5, 0x01, 0x0e, // _VMCTR1 VCOMH = 4V, VOML = -1.1V + 0x36, 0x01, 0xc8, // MADCTL Rotate display + 0x21, 0x00, // _INVON + 0x3a, 0x01, 0x05, // COLMOD - 16bit color + 0xe0, 0x10, 0x02, 0x1c, 0x07, 0x12, 0x37, 0x32, 0x29, 0x2d, 0x29, 0x25, 0x2B, 0x39, 0x00, 0x01, 0x03, 0x10, // _GMCTRP1 Gamma + 0xe1, 0x10, 0x03, 0x1d, 0x07, 0x06, 0x2E, 0x2C, 0x29, 0x2D, 0x2E, 0x2E, 0x37, 0x3F, 0x00, 0x00, 0x02, 0x10, // _GMCTRN1 + 0x13, 0x80, 0x0a, // _NORON + 0x29, 0x80, 0x64 // _DISPON }; static bool pmic_init(busio_i2c_obj_t *i2c) { diff --git a/ports/espressif/boards/mixgo_ce_serial/board.c b/ports/espressif/boards/mixgo_ce_serial/board.c index e6ffb553b1..fc592ce4c4 100644 --- a/ports/espressif/boards/mixgo_ce_serial/board.c +++ b/ports/espressif/boards/mixgo_ce_serial/board.c @@ -53,7 +53,7 @@ void board_init(void) { // Delete code.Py, use main.py mp_import_stat_t stat_c = mp_import_stat("code.py"); if (stat_c == MP_IMPORT_STAT_FILE) { - f_unlink(fatfs,"/code.py"); + f_unlink(fatfs, "/code.py"); } } diff --git a/ports/espressif/boards/odt_pixelwing_esp32_s2/pins.c b/ports/espressif/boards/odt_pixelwing_esp32_s2/pins.c index 4daec42ae4..0fbc5fa266 100644 --- a/ports/espressif/boards/odt_pixelwing_esp32_s2/pins.c +++ b/ports/espressif/boards/odt_pixelwing_esp32_s2/pins.c @@ -5,9 +5,9 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO21) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_GPIO33) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO33) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_GPIO34) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO34) }, { MP_OBJ_NEW_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO45) }, diff --git a/ports/espressif/common-hal/alarm/__init__.c b/ports/espressif/common-hal/alarm/__init__.c index 0c288d89b4..6fa205d01f 100644 --- a/ports/espressif/common-hal/alarm/__init__.c +++ b/ports/espressif/common-hal/alarm/__init__.c @@ -160,20 +160,20 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj esp_sleep_wakeup_cause_t cause = _get_wakeup_cause(false); switch (cause) { case ESP_SLEEP_WAKEUP_TIMER: { - wake_alarm = alarm_time_timealarm_find_triggered_alarm(n_alarms,alarms); + wake_alarm = alarm_time_timealarm_find_triggered_alarm(n_alarms, alarms); break; } case ESP_SLEEP_WAKEUP_GPIO: { - wake_alarm = alarm_pin_pinalarm_find_triggered_alarm(n_alarms,alarms); + wake_alarm = alarm_pin_pinalarm_find_triggered_alarm(n_alarms, alarms); break; } case ESP_SLEEP_WAKEUP_TOUCHPAD: { - wake_alarm = alarm_touch_touchalarm_find_triggered_alarm(n_alarms,alarms); + wake_alarm = alarm_touch_touchalarm_find_triggered_alarm(n_alarms, alarms); break; } #if CIRCUITPY_ESPULP case ESP_SLEEP_WAKEUP_ULP: { - wake_alarm = espulp_ulpalarm_find_triggered_alarm(n_alarms,alarms); + wake_alarm = espulp_ulpalarm_find_triggered_alarm(n_alarms, alarms); break; } #endif diff --git a/ports/espressif/common-hal/analogbufio/BufferedIn.c b/ports/espressif/common-hal/analogbufio/BufferedIn.c index 3a8d8d0def..9dd66bc9da 100644 --- a/ports/espressif/common-hal/analogbufio/BufferedIn.c +++ b/ports/espressif/common-hal/analogbufio/BufferedIn.c @@ -135,13 +135,13 @@ static void start_dma(analogbufio_bufferedin_obj_t *self, adc_digi_convert_mode_ }; #if defined(DEBUG_ANALOGBUFIO) - mp_printf(&mp_plat_print,"pin:%d, ADC channel:%d, ADC index:%d, adc1_chan_mask:0x%x, adc2_chan_mask:0x%x\n",pin->number,pin->adc_channel,pin->adc_index,adc1_chan_mask,adc2_chan_mask); + mp_printf(&mp_plat_print, "pin:%d, ADC channel:%d, ADC index:%d, adc1_chan_mask:0x%x, adc2_chan_mask:0x%x\n", pin->number, pin->adc_channel, pin->adc_index, adc1_chan_mask, adc2_chan_mask); #endif // DEBUG_ANALOGBUFIO esp_err_t err = adc_digi_initialize(&adc_dma_config); if (ESP_OK != err) { stop_dma(self); common_hal_analogbufio_bufferedin_deinit(self); - mp_raise_ValueError_varg(translate("Unable to initialize ADC DMA controller, ErrorCode:%d"),err); + mp_raise_ValueError_varg(translate("Unable to initialize ADC DMA controller, ErrorCode:%d"), err); } adc_digi_configuration_t dig_cfg = { @@ -154,7 +154,7 @@ static void start_dma(analogbufio_bufferedin_obj_t *self, adc_digi_convert_mode_ }; #if defined(DEBUG_ANALOGBUFIO) - mp_printf(&mp_plat_print,"conversion_mode:%d, format:%d, conv_limit_en:%d, sample_rate:%d\n",*convert_mode,*output_format,ADC_CONV_LIMIT_EN,sample_rate); + mp_printf(&mp_plat_print, "conversion_mode:%d, format:%d, conv_limit_en:%d, sample_rate:%d\n", *convert_mode, *output_format, ADC_CONV_LIMIT_EN, sample_rate); #endif // DEBUG_ANALOGBUFIO adc_digi_pattern_config_t adc_pattern[NUM_ADC_CHANNELS] = {0}; @@ -169,20 +169,20 @@ static void start_dma(analogbufio_bufferedin_obj_t *self, adc_digi_convert_mode_ dig_cfg.adc_pattern = adc_pattern; #if defined(DEBUG_ANALOGBUFIO) - mp_printf(&mp_plat_print,"adc_pattern[0].channel:%d, adc_pattern[0].unit:%d, adc_pattern[0].atten:%d\n",adc_pattern[0].channel,adc_pattern[0].unit,adc_pattern[0].atten); + mp_printf(&mp_plat_print, "adc_pattern[0].channel:%d, adc_pattern[0].unit:%d, adc_pattern[0].atten:%d\n", adc_pattern[0].channel, adc_pattern[0].unit, adc_pattern[0].atten); #endif // DEBUG_ANALOGBUFIO err = adc_digi_controller_configure(&dig_cfg); if (ESP_OK != err) { stop_dma(self); common_hal_analogbufio_bufferedin_deinit(self); - mp_raise_ValueError_varg(translate("Unable to configure ADC DMA controller, ErrorCode:%d"),err); + mp_raise_ValueError_varg(translate("Unable to configure ADC DMA controller, ErrorCode:%d"), err); } err = adc_digi_start(); if (ESP_OK != err) { stop_dma(self); common_hal_analogbufio_bufferedin_deinit(self); - mp_raise_ValueError_varg(translate("Unable to start ADC DMA controller, ErrorCode:%d"),err); + mp_raise_ValueError_varg(translate("Unable to start ADC DMA controller, ErrorCode:%d"), err); } } @@ -251,7 +251,7 @@ uint32_t common_hal_analogbufio_bufferedin_readinto(analogbufio_bufferedin_obj_t start_dma(self, &convert_mode, &output_format); #if defined(DEBUG_ANALOGBUFIO) - mp_printf(&mp_plat_print,"Required bytes: %d\n",len); + mp_printf(&mp_plat_print, "Required bytes: %d\n", len); #endif // DEBUG_ANALOGBUFIO while (captured_bytes < len) { @@ -284,7 +284,7 @@ uint32_t common_hal_analogbufio_bufferedin_readinto(analogbufio_bufferedin_obj_t // For all chips except for ESP32C3 we would receive samples only from one unit // For ESP32C3 we may receive sample from alternating units and need to ignore them #if defined(DEBUG_ANALOGBUFIO) - mp_printf(&mp_plat_print,"Invalid sample received: 0x%x\n",pResult->val); + mp_printf(&mp_plat_print, "Invalid sample received: 0x%x\n", pResult->val); #endif // DEBUG_ANALOGBUFIO stop_dma(self); return captured_samples; @@ -293,13 +293,13 @@ uint32_t common_hal_analogbufio_bufferedin_readinto(analogbufio_bufferedin_obj_t } } else if (ret == ESP_ERR_TIMEOUT) { #if defined(DEBUG_ANALOGBUFIO) - mp_printf(&mp_plat_print,"ADC Timeout\n"); + mp_printf(&mp_plat_print, "ADC Timeout\n"); #endif // DEBUG_ANALOGBUFIO stop_dma(self); return captured_samples; } else { #if defined(DEBUG_ANALOGBUFIO) - mp_printf(&mp_plat_print,"adc_digi_read_bytes failed error code:%d\n",ret); + mp_printf(&mp_plat_print, "adc_digi_read_bytes failed error code:%d\n", ret); #endif // DEBUG_ANALOGBUFIO stop_dma(self); return captured_samples; @@ -308,7 +308,7 @@ uint32_t common_hal_analogbufio_bufferedin_readinto(analogbufio_bufferedin_obj_t stop_dma(self); #if defined(DEBUG_ANALOGBUFIO) - mp_printf(&mp_plat_print,"Captured bytes: %d\n",captured_bytes); + mp_printf(&mp_plat_print, "Captured bytes: %d\n", captured_bytes); #endif // DEBUG_ANALOGBUFIO return captured_samples; } diff --git a/ports/espressif/common-hal/canio/Listener.c b/ports/espressif/common-hal/canio/Listener.c index 94bf03317c..66ce096970 100644 --- a/ports/espressif/common-hal/canio/Listener.c +++ b/ports/espressif/common-hal/canio/Listener.c @@ -77,7 +77,7 @@ STATIC void install_all_match_filter(canio_listener_obj_t *self) { self->standard = true; } -__attribute__((noinline,optimize("O0"))) +__attribute__((noinline, optimize("O0"))) STATIC void set_filters(canio_listener_obj_t *self, size_t nmatch, canio_match_obj_t **matches) { twai_ll_enter_reset_mode(&TWAI); @@ -163,7 +163,7 @@ mp_obj_t common_hal_canio_listener_receive(canio_listener_obj_t *self) { int dlc = self->message_in.data_length_code; canio_message_obj_t *message = - mp_obj_malloc(canio_message_obj_t,rtr ? &canio_remote_transmission_request_type : &canio_message_type); + mp_obj_malloc(canio_message_obj_t, rtr ? &canio_remote_transmission_request_type : &canio_message_type); message->extended = self->message_in.extd; message->id = self->message_in.identifier; message->size = dlc; diff --git a/ports/espressif/common-hal/socketpool/Socket.c b/ports/espressif/common-hal/socketpool/Socket.c index ef56480672..9d3c22aca8 100644 --- a/ports/espressif/common-hal/socketpool/Socket.c +++ b/ports/espressif/common-hal/socketpool/Socket.c @@ -411,7 +411,7 @@ void common_hal_socketpool_socket_connect(socketpool_socket_obj_t *self, // Switch to blocking mode for this one call int opts; - opts = lwip_fcntl(self->num,F_GETFL,0); + opts = lwip_fcntl(self->num, F_GETFL, 0); opts = opts & (~O_NONBLOCK); lwip_fcntl(self->num, F_SETFL, opts); diff --git a/ports/espressif/i2s_lcd_esp32s2_driver.c b/ports/espressif/i2s_lcd_esp32s2_driver.c index 3b74cc9eda..1bf8cd00f3 100644 --- a/ports/espressif/i2s_lcd_esp32s2_driver.c +++ b/ports/espressif/i2s_lcd_esp32s2_driver.c @@ -33,7 +33,7 @@ static const char *TAG = "ESP32S2_I2S_LCD"; #define I2S_CHECK(a, str, ret) if (!(a)) { \ - ESP_LOGE(TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ + ESP_LOGE(TAG, "%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ return ret; \ } @@ -401,7 +401,7 @@ i2s_lcd_handle_t i2s_lcd_driver_init(const i2s_lcd_config_t *config) { esp_err_t ret = lcd_cam_init(i2s_lcd_drv, config); if (ESP_OK != ret) { - ESP_LOGE(TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, "i2s lcd driver initialize failed"); + ESP_LOGE(TAG, "%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, "i2s lcd driver initialize failed"); heap_caps_free(i2s_lcd_drv); return NULL; } diff --git a/ports/litex/irq.h b/ports/litex/irq.h index 34c8b0a10a..a9814ac7f9 100644 --- a/ports/litex/irq.h +++ b/ports/litex/irq.h @@ -41,9 +41,9 @@ static inline unsigned int irq_getie(void) { static inline void irq_setie(unsigned int ie) { if (ie) { - csrs(mstatus,CSR_MSTATUS_MIE); + csrs(mstatus, CSR_MSTATUS_MIE); } else { - csrc(mstatus,CSR_MSTATUS_MIE); + csrc(mstatus, CSR_MSTATUS_MIE); } } diff --git a/ports/litex/supervisor/internal_flash.c b/ports/litex/supervisor/internal_flash.c index 5c58c7bc49..3b2b5957dc 100644 --- a/ports/litex/supervisor/internal_flash.c +++ b/ports/litex/supervisor/internal_flash.c @@ -92,9 +92,9 @@ static inline void bb_spi_en(unsigned int en) { __attribute__((section(".ramtext"))) static inline void bb_spi_irq_setie(unsigned int ie) { if (ie) { - csrs(mstatus,CSR_MSTATUS_MIE); + csrs(mstatus, CSR_MSTATUS_MIE); } else { - csrc(mstatus,CSR_MSTATUS_MIE); + csrc(mstatus, CSR_MSTATUS_MIE); } } diff --git a/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/pins.c b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/pins.c index 8096973aaf..a7256552e5 100644 --- a/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/pins.c +++ b/ports/mimxrt10xx/boards/adafruit_metro_m7_1011_sd/pins.c @@ -30,8 +30,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO_05) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO_04) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_GPIO_03) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_GPIO_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO_03) }, // SD control { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CD), MP_ROM_PTR(&pin_GPIO_AD_11) }, diff --git a/ports/mimxrt10xx/boards/metro_m7_1011/pins.c b/ports/mimxrt10xx/boards/metro_m7_1011/pins.c index fe03d09764..d3b29089cb 100644 --- a/ports/mimxrt10xx/boards/metro_m7_1011/pins.c +++ b/ports/mimxrt10xx/boards/metro_m7_1011/pins.c @@ -30,8 +30,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO_05) }, { MP_OBJ_NEW_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO_04) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_GPIO_03) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_D13),MP_ROM_PTR(&pin_GPIO_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO_03) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO_03) }, // ESP control { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_CS), MP_ROM_PTR(&pin_GPIO_AD_14) }, diff --git a/ports/mimxrt10xx/boards/teensy40/board.c b/ports/mimxrt10xx/boards/teensy40/board.c index 4f92b4f623..8ece1546d7 100644 --- a/ports/mimxrt10xx/boards/teensy40/board.c +++ b/ports/mimxrt10xx/boards/teensy40/board.c @@ -25,15 +25,8 @@ * THE SOFTWARE. */ -<<<<<<<< HEAD:ports/mimxrt10xx/boards/teensy40/board.c #include "supervisor/board.h" #include "shared-bindings/microcontroller/Pin.h" -======== -#include -#include "py/mpconfig.h" -#include "fsl_edma.h" -#include "dma_manager.h" ->>>>>>>> v1.19.1:ports/raspberrypi/dma_manager.c // These pins should never ever be reset; doing so could interfere with basic operation. // Used in common-hal/microcontroller/Pin.c @@ -61,35 +54,4 @@ const mcu_pin_obj_t *mimxrt10xx_reset_forbidden_pins[] = { NULL, // Must end in NULL. }; -<<<<<<<< HEAD:ports/mimxrt10xx/boards/teensy40/board.c // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. -======== -STATIC bool dma_initialized = false; - -// allocate_channel(): retrieve an available channel. Return the number or -1 -int allocate_dma_channel(void) { - for (int i = 0; i < ARRAY_SIZE(channel_list); i++) { - if (channel_list[i] == false) { // Channel available - channel_list[i] = true; - return i; - } - } - return -1; -} - -// free_channel(n): Declare channel as free -void free_dma_channel(int n) { - if (n >= 0 && n <= ARRAY_SIZE(channel_list)) { - channel_list[n] = false; - } -} - -void dma_init(void) { - if (!dma_initialized) { - edma_config_t dmaConfig; - EDMA_GetDefaultConfig(&dmaConfig); - EDMA_Init(DMA0, &dmaConfig); - dma_initialized = true; - } -} ->>>>>>>> v1.19.1:ports/raspberrypi/dma_manager.c diff --git a/ports/mimxrt10xx/common-hal/busio/UART.c b/ports/mimxrt10xx/common-hal/busio/UART.c index 21f478e6a7..c40b2601a0 100644 --- a/ports/mimxrt10xx/common-hal/busio/UART.c +++ b/ports/mimxrt10xx/common-hal/busio/UART.c @@ -47,7 +47,7 @@ #if ENABLE_DEBUG_PRINTING #define DBGPrintf mp_printf #else -#define DBGPrintf(p,...) +#define DBGPrintf(p, ...) #endif diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/clocks.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/clocks.c index bef213a7c7..9906454658 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/clocks.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/clocks.c @@ -305,7 +305,7 @@ void clocks_init(void) { /* Set SAI3 MCLK3 clock source. */ IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI3MClk3Sel, 0); /* Set MQS configuration. */ - IOMUXC_MQSConfig(IOMUXC_GPR,kIOMUXC_MqsPwmOverSampleRate32, 0); + IOMUXC_MQSConfig(IOMUXC_GPR, kIOMUXC_MqsPwmOverSampleRate32, 0); /* Set GPT1 High frequency reference clock source. */ IOMUXC_GPR->GPR5 &= ~IOMUXC_GPR_GPR5_VREF_1M_CLK_GPT1_MASK; /* Set GPT2 High frequency reference clock source. */ diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/clocks.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/clocks.c index f62f974bdd..95db72df45 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/clocks.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/clocks.c @@ -370,7 +370,7 @@ void clocks_init(void) { /* Set SAI3 MCLK3 clock source. */ IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI3MClk3Sel, 0); /* Set MQS configuration. */ - IOMUXC_MQSConfig(IOMUXC_GPR,kIOMUXC_MqsPwmOverSampleRate32, 0); + IOMUXC_MQSConfig(IOMUXC_GPR, kIOMUXC_MqsPwmOverSampleRate32, 0); /* Set ENET Ref clock source. */ IOMUXC_GPR->GPR1 &= ~IOMUXC_GPR_GPR1_ENET1_TX_CLK_DIR_MASK; /* Set GPT1 High frequency reference clock source. */ diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/clocks.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/clocks.c index 832ad9afac..de12bea6a0 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/clocks.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/clocks.c @@ -383,7 +383,7 @@ void clocks_init(void) { /* Set SAI3 MCLK3 clock source. */ IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI3MClk3Sel, 0); /* Set MQS configuration. */ - IOMUXC_MQSConfig(IOMUXC_GPR,kIOMUXC_MqsPwmOverSampleRate32, 0); + IOMUXC_MQSConfig(IOMUXC_GPR, kIOMUXC_MqsPwmOverSampleRate32, 0); /* Set ENET Ref clock source. */ #if defined(IOMUXC_GPR_GPR1_ENET_REF_CLK_DIR_MASK) IOMUXC_GPR->GPR1 &= ~IOMUXC_GPR_GPR1_ENET_REF_CLK_DIR_MASK; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/clocks.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/clocks.c index 0eb879053b..2f12124083 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/clocks.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/clocks.c @@ -318,7 +318,7 @@ void clocks_init(void) { /* Set SAI3 MCLK3 clock source. */ IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI3MClk3Sel, 0); /* Set MQS configuration. */ - IOMUXC_MQSConfig(IOMUXC_GPR,kIOMUXC_MqsPwmOverSampleRate32, 0); + IOMUXC_MQSConfig(IOMUXC_GPR, kIOMUXC_MqsPwmOverSampleRate32, 0); /* Set ENET1 Tx clock source. */ IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1RefClkMode, false); /* Set ENET2 Tx clock source. */ diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/clocks.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/clocks.c index 1252d48135..33ea37c2bd 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/clocks.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/clocks.c @@ -640,7 +640,7 @@ void clocks_init(void) { IOMUXC_SetSaiMClkClockSource(IOMUXC_GPR, kIOMUXC_GPR_SAI3MClk3Sel, 0); /* Set MQS configuration. */ - IOMUXC_MQSConfig(IOMUXC_GPR,kIOMUXC_MqsPwmOverSampleRate32, 0); + IOMUXC_MQSConfig(IOMUXC_GPR, kIOMUXC_MqsPwmOverSampleRate32, 0); /* Set ENET Ref clock source. */ IOMUXC_GPR->GPR4 &= ~IOMUXC_GPR_GPR4_ENET_REF_CLK_DIR_MASK; /* Set ENET_1G Tx clock source. */ diff --git a/ports/mimxrt10xx/supervisor/port.c b/ports/mimxrt10xx/supervisor/port.c index 997a97ba49..6f44928619 100644 --- a/ports/mimxrt10xx/supervisor/port.c +++ b/ports/mimxrt10xx/supervisor/port.c @@ -321,7 +321,7 @@ __attribute__((used, naked, no_instrument_function, optimize("no-tree-loop-distr main(); } -void __attribute__((no_instrument_function,section(".itcm.profile_enter"),long_call)) __cyg_profile_func_enter(void *this_fn, +void __attribute__((no_instrument_function, section(".itcm.profile_enter"), long_call)) __cyg_profile_func_enter(void *this_fn, void *call_site) { if ((ITM->TER & (1 << 3)) == 0) { return; @@ -333,7 +333,7 @@ void __attribute__((no_instrument_function,section(".itcm.profile_enter"),long_c ITM->PORT[3].u32 = addr; } -void __attribute__((no_instrument_function,section(".itcm.profile_exit"),long_call)) __cyg_profile_func_exit(void *this_fn, +void __attribute__((no_instrument_function, section(".itcm.profile_exit"), long_call)) __cyg_profile_func_exit(void *this_fn, void *call_site) { if ((ITM->TER & (1 << 4)) == 0) { return; diff --git a/ports/nrf/boards/Seeed_XIAO_nRF52840_Sense/pins.c b/ports/nrf/boards/Seeed_XIAO_nRF52840_Sense/pins.c index 8714f9bf8c..3d41fda40e 100644 --- a/ports/nrf/boards/Seeed_XIAO_nRF52840_Sense/pins.c +++ b/ports/nrf/boards/Seeed_XIAO_nRF52840_Sense/pins.c @@ -49,10 +49,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_PDM_CLK), MP_ROM_PTR(&pin_P1_00) }, { MP_ROM_QSTR(MP_QSTR_PDM_DATA), MP_ROM_PTR(&pin_P0_16) }, - {MP_ROM_QSTR(MP_QSTR_READ_BATT_ENABLE),MP_ROM_PTR(&pin_P0_14)}, - {MP_ROM_QSTR(MP_QSTR_VBATT),MP_ROM_PTR(&pin_P0_31)}, - {MP_ROM_QSTR(MP_QSTR_CHARGE_STATUS),MP_ROM_PTR(&pin_P0_17)}, - {MP_ROM_QSTR(MP_QSTR_CHARGE_RATE),MP_ROM_PTR(&pin_P0_13)}, + {MP_ROM_QSTR(MP_QSTR_READ_BATT_ENABLE), MP_ROM_PTR(&pin_P0_14)}, + {MP_ROM_QSTR(MP_QSTR_VBATT), MP_ROM_PTR(&pin_P0_31)}, + {MP_ROM_QSTR(MP_QSTR_CHARGE_STATUS), MP_ROM_PTR(&pin_P0_17)}, + {MP_ROM_QSTR(MP_QSTR_CHARGE_RATE), MP_ROM_PTR(&pin_P0_13)}, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, diff --git a/ports/nrf/boards/metro_nrf52840_express/pins.c b/ports/nrf/boards/metro_nrf52840_express/pins.c index 44e353ea4a..3ff4e1756c 100644 --- a/ports/nrf/boards/metro_nrf52840_express/pins.c +++ b/ports/nrf/boards/metro_nrf52840_express/pins.c @@ -39,7 +39,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_15) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_16) }, - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL),MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_13) }, { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_07) }, { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P1_08) }, diff --git a/ports/nrf/boards/ssci_isp1807_dev_board/pins.c b/ports/nrf/boards/ssci_isp1807_dev_board/pins.c index d3188c3644..3ae7dad707 100644 --- a/ports/nrf/boards/ssci_isp1807_dev_board/pins.c +++ b/ports/nrf/boards/ssci_isp1807_dev_board/pins.c @@ -37,11 +37,11 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_P0_30) }, { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_P0_31) }, - { MP_ROM_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_P0_06) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON),MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_P1_06) }, - { MP_ROM_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_P0_19) }, - { MP_ROM_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_P0_23) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_19) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_23) }, { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_10) }, { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_12) }, diff --git a/ports/nrf/boards/ssci_isp1807_micro_board/pins.c b/ports/nrf/boards/ssci_isp1807_micro_board/pins.c index 7b7b8833a4..9c5358a6a8 100644 --- a/ports/nrf/boards/ssci_isp1807_micro_board/pins.c +++ b/ports/nrf/boards/ssci_isp1807_micro_board/pins.c @@ -14,15 +14,15 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_P0_10) }, { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_P0_14) }, { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_26) }, - { MP_ROM_QSTR(MP_QSTR_D10),MP_ROM_PTR(&pin_P0_17) }, - { MP_ROM_QSTR(MP_QSTR_D14),MP_ROM_PTR(&pin_P0_08) }, - { MP_ROM_QSTR(MP_QSTR_D15),MP_ROM_PTR(&pin_P0_06) }, - { MP_ROM_QSTR(MP_QSTR_D16),MP_ROM_PTR(&pin_P0_13) }, - { MP_ROM_QSTR(MP_QSTR_D17),MP_ROM_PTR(&pin_P0_31) }, - { MP_ROM_QSTR(MP_QSTR_D18),MP_ROM_PTR(&pin_P0_02) }, - { MP_ROM_QSTR(MP_QSTR_D19),MP_ROM_PTR(&pin_P0_03) }, - { MP_ROM_QSTR(MP_QSTR_D20),MP_ROM_PTR(&pin_P0_04) }, - { MP_ROM_QSTR(MP_QSTR_D21),MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P0_17) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_P0_31) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_P0_03) }, + { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_P0_05) }, { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_02) }, { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_03) }, @@ -31,10 +31,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_29) }, { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_P0_30) }, - { MP_ROM_QSTR(MP_QSTR_LED),MP_ROM_PTR(&pin_P0_31) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_P0_31) }, - { MP_ROM_QSTR(MP_QSTR_SDA),MP_ROM_PTR(&pin_P0_29) }, - { MP_ROM_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_P0_23) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_23) }, { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) }, { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_08) }, diff --git a/ports/nrf/common-hal/alarm/__init__.c b/ports/nrf/common-hal/alarm/__init__.c index b3f9979ae0..0835522f48 100644 --- a/ports/nrf/common-hal/alarm/__init__.c +++ b/ports/nrf/common-hal/alarm/__init__.c @@ -233,11 +233,11 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj nrf_sleep_source_t cause = _get_wakeup_cause(); switch (cause) { case NRF_SLEEP_WAKEUP_TIMER: { - wake_alarm = alarm_time_timealarm_find_triggered_alarm(n_alarms,alarms); + wake_alarm = alarm_time_timealarm_find_triggered_alarm(n_alarms, alarms); break; } case NRF_SLEEP_WAKEUP_GPIO: { - wake_alarm = alarm_pin_pinalarm_find_triggered_alarm(n_alarms,alarms); + wake_alarm = alarm_pin_pinalarm_find_triggered_alarm(n_alarms, alarms); break; } default: diff --git a/ports/nrf/common-hal/microcontroller/__init__.c b/ports/nrf/common-hal/microcontroller/__init__.c index 7824175605..40f60f90de 100644 --- a/ports/nrf/common-hal/microcontroller/__init__.c +++ b/ports/nrf/common-hal/microcontroller/__init__.c @@ -82,9 +82,9 @@ void common_hal_mcu_enable_interrupts() { void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { enum { DFU_MAGIC_UF2_RESET = 0x57 }; if (runmode == RUNMODE_BOOTLOADER || runmode == RUNMODE_UF2) { - sd_power_gpregret_set(0,DFU_MAGIC_UF2_RESET); + sd_power_gpregret_set(0, DFU_MAGIC_UF2_RESET); } else { - sd_power_gpregret_set(0,0); + sd_power_gpregret_set(0, 0); } if (runmode == RUNMODE_SAFE_MODE) { safe_mode_on_next_reset(SAFE_MODE_PROGRAMMATIC); diff --git a/ports/raspberrypi/bindings/rp2pio/StateMachine.c b/ports/raspberrypi/bindings/rp2pio/StateMachine.c index 2d73068d62..d5924277c8 100644 --- a/ports/raspberrypi/bindings/rp2pio/StateMachine.c +++ b/ports/raspberrypi/bindings/rp2pio/StateMachine.c @@ -175,7 +175,7 @@ STATIC mp_obj_t rp2pio_statemachine_make_new(const mp_obj_type_t *type, size_t n ARG_user_interruptible, ARG_wrap_target, ARG_wrap, - ARG_offset,}; + ARG_offset, }; static const mp_arg_t allowed_args[] = { { MP_QSTR_program, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_frequency, MP_ARG_REQUIRED | MP_ARG_INT }, diff --git a/ports/raspberrypi/common-hal/alarm/__init__.c b/ports/raspberrypi/common-hal/alarm/__init__.c index f6d36f702e..da081351dc 100644 --- a/ports/raspberrypi/common-hal/alarm/__init__.c +++ b/ports/raspberrypi/common-hal/alarm/__init__.c @@ -168,11 +168,11 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj uint8_t cause = _get_wakeup_cause(); switch (cause) { case RP_SLEEP_WAKEUP_RTC: { - wake_alarm = alarm_time_timealarm_find_triggered_alarm(n_alarms,alarms); + wake_alarm = alarm_time_timealarm_find_triggered_alarm(n_alarms, alarms); break; } case RP_SLEEP_WAKEUP_GPIO: { - wake_alarm = alarm_pin_pinalarm_find_triggered_alarm(n_alarms,alarms); + wake_alarm = alarm_pin_pinalarm_find_triggered_alarm(n_alarms, alarms); break; } default: diff --git a/ports/raspberrypi/common-hal/pulseio/PulseIn.c b/ports/raspberrypi/common-hal/pulseio/PulseIn.c index 696a1f237a..a074ee3604 100644 --- a/ports/raspberrypi/common-hal/pulseio/PulseIn.c +++ b/ports/raspberrypi/common-hal/pulseio/PulseIn.c @@ -79,7 +79,7 @@ void common_hal_pulseio_pulsein_construct(pulseio_pulsein_obj_t *self, common_hal_pulseio_pulsein_pause(self); - common_hal_rp2pio_statemachine_set_interrupt_handler(&(self->state_machine),&common_hal_pulseio_pulsein_interrupt,self,PIO_IRQ0_INTE_SM0_RXNEMPTY_BITS); + common_hal_rp2pio_statemachine_set_interrupt_handler(&(self->state_machine), &common_hal_pulseio_pulsein_interrupt, self, PIO_IRQ0_INTE_SM0_RXNEMPTY_BITS); common_hal_pulseio_pulsein_resume(self, 0); } @@ -102,7 +102,7 @@ void common_hal_pulseio_pulsein_deinit(pulseio_pulsein_obj_t *self) { void common_hal_pulseio_pulsein_pause(pulseio_pulsein_obj_t *self) { pio_sm_restart(self->state_machine.pio, self->state_machine.state_machine); pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, false); - pio_sm_clear_fifos(self->state_machine.pio,self->state_machine.state_machine); + pio_sm_clear_fifos(self->state_machine.pio, self->state_machine.state_machine); self->last_level = self->idle_state; self->level_count = 0; self->paused = true; @@ -149,18 +149,18 @@ void common_hal_pulseio_pulsein_resume(pulseio_pulsein_obj_t *self, common_hal_pulseio_pulsein_pause(self); // Send the trigger pulse. if (trigger_duration > 0) { - gpio_set_function(self->pin,GPIO_FUNC_SIO); - gpio_set_dir(self->pin,true); + gpio_set_function(self->pin, GPIO_FUNC_SIO); + gpio_set_dir(self->pin, true); gpio_put(self->pin, !self->idle_state); common_hal_mcu_delay_us((uint32_t)trigger_duration); - gpio_set_function(self->pin,GPIO_FUNC_PIO0); + gpio_set_function(self->pin, GPIO_FUNC_PIO0); } // exec a wait for the selected pin to change state if (self->idle_state == true) { - pio_sm_exec(self->state_machine.pio,self->state_machine.state_machine,0x2020); + pio_sm_exec(self->state_machine.pio, self->state_machine.state_machine, 0x2020); } else { - pio_sm_exec(self->state_machine.pio,self->state_machine.state_machine,0x20a0); + pio_sm_exec(self->state_machine.pio, self->state_machine.state_machine, 0x20a0); } pio_sm_set_enabled(self->state_machine.pio, self->state_machine.state_machine, true); self->paused = false; diff --git a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c index 0583e4f803..629811ab9f 100644 --- a/ports/raspberrypi/common-hal/rp2pio/StateMachine.c +++ b/ports/raspberrypi/common-hal/rp2pio/StateMachine.c @@ -151,7 +151,7 @@ void reset_rp2pio_statemachine(void) { irq_handler_t int_handler = irq_get_exclusive_handler(irq); if (int_handler > 0) { irq_set_enabled(irq, false); - irq_remove_handler(irq,int_handler); + irq_remove_handler(irq, int_handler); } } } diff --git a/ports/silabs/boards/devkit_xg24_brd2601b/sensor.c b/ports/silabs/boards/devkit_xg24_brd2601b/sensor.c index 2b0bf9b0bd..d981f416ab 100644 --- a/ports/silabs/boards/devkit_xg24_brd2601b/sensor.c +++ b/ports/silabs/boards/devkit_xg24_brd2601b/sensor.c @@ -168,9 +168,9 @@ STATIC mp_obj_t sensor_imu_get(void) { avec_obj[0] = mp_obj_new_int(avec[0]); avec_obj[1] = mp_obj_new_int(avec[1]); avec_obj[2] = mp_obj_new_int(avec[2]); - ret[0] = mp_obj_new_list(3,ovec_obj); - ret[1] = mp_obj_new_list(3,avec_obj); - return mp_obj_new_tuple(2,ret); + ret[0] = mp_obj_new_list(3, ovec_obj); + ret[1] = mp_obj_new_list(3, avec_obj); + return mp_obj_new_tuple(2, ret); } STATIC mp_obj_t sensor_imu_calibrate(void) { @@ -182,15 +182,15 @@ STATIC mp_obj_t sensor_imu_calibrate(void) { return mp_const_true; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(sensor_init_obj,sensor_init); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_deinit_obj,sensor_deinit); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_get_temperature_obj,sensor_get_temperature); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_get_humidity_obj,sensor_get_humidity); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_get_lux_obj,sensor_get_lux); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_get_hall_obj,sensor_get_hall); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_get_pressure_obj,sensor_get_pressure); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_imu_get_obj,sensor_imu_get); -STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_imu_calibrate_obj,sensor_imu_calibrate); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(sensor_init_obj, sensor_init); +STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_deinit_obj, sensor_deinit); +STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_get_temperature_obj, sensor_get_temperature); +STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_get_humidity_obj, sensor_get_humidity); +STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_get_lux_obj, sensor_get_lux); +STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_get_hall_obj, sensor_get_hall); +STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_get_pressure_obj, sensor_get_pressure); +STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_imu_get_obj, sensor_imu_get); +STATIC MP_DEFINE_CONST_FUN_OBJ_0(sensor_imu_calibrate_obj, sensor_imu_calibrate); STATIC const mp_rom_map_elem_t sensor_globals_table[] = { diff --git a/ports/silabs/common-hal/_bleio/Characteristic.c b/ports/silabs/common-hal/_bleio/Characteristic.c index a39180b19b..d713e04d00 100644 --- a/ports/silabs/common-hal/_bleio/Characteristic.c +++ b/ports/silabs/common-hal/_bleio/Characteristic.c @@ -193,9 +193,9 @@ size_t common_hal_bleio_characteristic_get_value( if (common_hal_bleio_service_get_is_remote(self->service)) { // ble client gets characteristic value if (BT_GATT_CHRC_READ & self->props) { - sc = sl_bt_gatt_read_characteristic_value(conn_handle,self->handle); + sc = sl_bt_gatt_read_characteristic_value(conn_handle, self->handle); while (SL_STATUS_OK != sc && retry > 0) { - sc = sl_bt_gatt_read_characteristic_value(conn_handle,self->handle); + sc = sl_bt_gatt_read_characteristic_value(conn_handle, self->handle); vTaskDelay(100 / portTICK_PERIOD_MS); retry--; } @@ -372,7 +372,7 @@ void common_hal_bleio_characteristic_add_descriptor( // Set the remote characteristic’s CCCD to enable or disable notification and indication. void common_hal_bleio_characteristic_set_cccd(bleio_characteristic_obj_t *self, - bool notify,bool indicate) { + bool notify, bool indicate) { sl_status_t sc = SL_STATUS_FAIL; @@ -383,7 +383,7 @@ void common_hal_bleio_characteristic_set_cccd(bleio_characteristic_obj_t *self, indicate = 0; if (notify) { sc = sl_bt_gatt_set_characteristic_notification(conn_handle, - self->handle,sl_bt_gatt_notification); + self->handle, sl_bt_gatt_notification); if (SL_STATUS_OK != sc) { mp_raise_bleio_BluetoothError(translate("Notify fail")); } @@ -391,7 +391,7 @@ void common_hal_bleio_characteristic_set_cccd(bleio_characteristic_obj_t *self, if (indicate) { sc = sl_bt_gatt_set_characteristic_notification(conn_handle, - self->handle,sl_bt_gatt_indication); + self->handle, sl_bt_gatt_indication); if (SL_STATUS_OK != sc) { mp_raise_bleio_BluetoothError(translate("Indicate fail")); } @@ -399,7 +399,7 @@ void common_hal_bleio_characteristic_set_cccd(bleio_characteristic_obj_t *self, if (0 == notify && 0 == indicate) { sc = sl_bt_gatt_set_characteristic_notification(conn_handle, - self->handle,sl_bt_gatt_disable); + self->handle, sl_bt_gatt_disable); if (SL_STATUS_OK != sc) { mp_raise_bleio_BluetoothError(translate("Indicate fail")); } diff --git a/ports/silabs/common-hal/_bleio/CharacteristicBuffer.c b/ports/silabs/common-hal/_bleio/CharacteristicBuffer.c index b7f4ff80e3..2acb6b00fc 100644 --- a/ports/silabs/common-hal/_bleio/CharacteristicBuffer.c +++ b/ports/silabs/common-hal/_bleio/CharacteristicBuffer.c @@ -57,7 +57,7 @@ bool characteristic_buffer_on_ble_evt(uint16_t attribute, } } } else { - ringbuf_put_n(&bleio_characteristic_buffer_list.data[cindex]->ringbuf,data, len); + ringbuf_put_n(&bleio_characteristic_buffer_list.data[cindex]->ringbuf, data, len); } taskEXIT_CRITICAL(); diff --git a/ports/silabs/common-hal/_bleio/Connection.c b/ports/silabs/common-hal/_bleio/Connection.c index f6cd664a57..27adc49e91 100644 --- a/ports/silabs/common-hal/_bleio/Connection.c +++ b/ports/silabs/common-hal/_bleio/Connection.c @@ -101,7 +101,7 @@ mp_float_t common_hal_bleio_connection_get_connection_interval( mp_int_t common_hal_bleio_connection_get_max_packet_length( bleio_connection_internal_t *self) { - sl_status_t sc = sl_bt_gatt_server_get_mtu(self->conn_handle,&self->mtu); + sl_status_t sc = sl_bt_gatt_server_get_mtu(self->conn_handle, &self->mtu); if (sc != SL_STATUS_OK) { mp_raise_bleio_BluetoothError(translate("gatt_server_get_mtu fail.")); } @@ -136,7 +136,7 @@ mp_obj_tuple_t *common_hal_bleio_connection_discover_remote_services( xdiscovery_event = xEventGroupCreate(); if (xdiscovery_event != NULL) { - xEventGroupClearBits(xdiscovery_event,1 << 0); + xEventGroupClearBits(xdiscovery_event, 1 << 0); } self->connection->remote_service_list = mp_obj_new_list(0, NULL); bleio_connection_ensure_connected(self); @@ -161,7 +161,7 @@ mp_obj_tuple_t *common_hal_bleio_connection_discover_remote_services( ux_bits = xEventGroupWaitBits( xdiscovery_event, 1 << 0, - pdTRUE,pdFALSE, + pdTRUE, pdFALSE, DISCOVERY_TIMEOUT_MS / portTICK_PERIOD_MS); if ((ux_bits & (1 << 0)) == (1 << 0)) { @@ -189,7 +189,7 @@ mp_obj_tuple_t *common_hal_bleio_connection_discover_remote_services( uuid16_value[0] = uuid->efr_ble_uuid.uuid16.value & 0xff; uuid16_value[1] = uuid->efr_ble_uuid.uuid16.value >> 8; sc = sl_bt_gatt_discover_primary_services_by_uuid( - self->connection->conn_handle,2,uuid16_value); + self->connection->conn_handle, 2, uuid16_value); } else if (BLE_UUID_TYPE_128 == uuid->efr_ble_uuid.uuid.type) { sc = sl_bt_gatt_discover_primary_services_by_uuid( diff --git a/ports/silabs/common-hal/_bleio/__init__.c b/ports/silabs/common-hal/_bleio/__init__.c index a1f8927c8f..041fdc38b7 100644 --- a/ports/silabs/common-hal/_bleio/__init__.c +++ b/ports/silabs/common-hal/_bleio/__init__.c @@ -125,13 +125,13 @@ void sl_bt_on_event(sl_bt_msg_t *evt) { sl_bt_system_get_identity_address(&address, &address_type); snprintf((char *)device_name, 14 + 1, - "CIRCUITPY-%X%X",address.addr[1], address.addr[0]); + "CIRCUITPY-%X%X", address.addr[1], address.addr[0]); sl_bt_gatt_server_write_attribute_value(gattdb_device_name, - 0,14,device_name); + 0, 14, device_name); - sl_bt_sm_store_bonding_configuration(5,2); + sl_bt_sm_store_bonding_configuration(5, 2); - sl_bt_sm_configure(0x00,sl_bt_sm_io_capability_noinputnooutput); + sl_bt_sm_configure(0x00, sl_bt_sm_io_capability_noinputnooutput); sl_bt_sm_set_bondable_mode(1); break; @@ -162,7 +162,7 @@ void sl_bt_on_event(sl_bt_msg_t *evt) { &evt->data.evt_scanner_legacy_advertisement_report.data); if (xscan_event != NULL) { - xEventGroupSetBits(xscan_event,1 << 0); + xEventGroupSetBits(xscan_event, 1 << 0); } break; @@ -289,7 +289,7 @@ void sl_bt_on_event(sl_bt_msg_t *evt) { conn_state = RUNNING; serv_idx = 0; if (xdiscovery_event != NULL) { - xEventGroupSetBits(xdiscovery_event,1 << 0); + xEventGroupSetBits(xdiscovery_event, 1 << 0); } } } @@ -338,7 +338,7 @@ void sl_bt_on_event(sl_bt_msg_t *evt) { break; case sl_bt_evt_sm_confirm_bonding_id: - sl_bt_sm_bonding_confirm(evt->data.evt_sm_confirm_bonding.connection,1); + sl_bt_sm_bonding_confirm(evt->data.evt_sm_confirm_bonding.connection, 1); break; case sl_bt_evt_sm_bonded_id: diff --git a/ports/silabs/common-hal/busio/UART.c b/ports/silabs/common-hal/busio/UART.c index b0aaff9c47..813432e9aa 100644 --- a/ports/silabs/common-hal/busio/UART.c +++ b/ports/silabs/common-hal/busio/UART.c @@ -111,7 +111,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, uartdrv_usart_init.txQueue = (UARTDRV_Buffer_FifoQueue_t *) &uartdrv_usart_tx_buffer; - if (UARTDRV_InitUart(self->handle,&uartdrv_usart_init) + if (UARTDRV_InitUart(self->handle, &uartdrv_usart_init) != ECODE_EMDRV_UARTDRV_OK) { mp_raise_RuntimeError(translate("UART init")); } @@ -183,7 +183,7 @@ void UARTDRV_Receive_Callback(UARTDRV_Handle_t *handle, taskENTER_CRITICAL(); ringbuf_put_n(&context->ringbuf, &context->rx_char, 1); taskEXIT_CRITICAL(); - errflag = UARTDRV_Receive(context->handle,&context->rx_char,1, + errflag = UARTDRV_Receive(context->handle, &context->rx_char, 1, (UARTDRV_Callback_t)UARTDRV_Receive_Callback); if (context->sigint_enabled) { if (context->rx_char == CHAR_CTRL_C) { @@ -213,7 +213,7 @@ size_t common_hal_busio_uart_read(busio_uart_obj_t *self, uint8_t *data, RUN_BACKGROUND_TASKS; // restart if it failed in the callback if (errflag != ECODE_EMDRV_UARTDRV_OK) { - errflag = UARTDRV_Receive(self->handle,&self->rx_char,1, + errflag = UARTDRV_Receive(self->handle, &self->rx_char, 1, (UARTDRV_Callback_t)UARTDRV_Receive_Callback); } // Allow user to break out of a timeout with a KeyboardInterrupt. diff --git a/ports/silabs/common-hal/digitalio/DigitalInOut.c b/ports/silabs/common-hal/digitalio/DigitalInOut.c index 0f266bb41e..b673d392f2 100644 --- a/ports/silabs/common-hal/digitalio/DigitalInOut.c +++ b/ports/silabs/common-hal/digitalio/DigitalInOut.c @@ -64,11 +64,11 @@ void common_hal_digitalio_digitalinout_deinit( digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_input( digitalio_digitalinout_obj_t *self, digitalio_pull_t pull) { if (pull == PULL_NONE) { - GPIO_PinModeSet(self->pin->port,self->pin->number,gpioModeInput,1); + GPIO_PinModeSet(self->pin->port, self->pin->number, gpioModeInput, 1); } else if (pull == PULL_UP) { - GPIO_PinModeSet(self->pin->port,self->pin->number,gpioModeInputPull,1); + GPIO_PinModeSet(self->pin->port, self->pin->number, gpioModeInputPull, 1); } else { - GPIO_PinModeSet(self->pin->port,self->pin->number,gpioModeInputPull,0); + GPIO_PinModeSet(self->pin->port, self->pin->number, gpioModeInputPull, 0); } return DIGITALINOUT_OK; } @@ -78,11 +78,11 @@ digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output( digitalio_digitalinout_obj_t *self, bool value, digitalio_drive_mode_t drive_mode) { if (drive_mode == DRIVE_MODE_OPEN_DRAIN) { - GPIO_PinModeSet(self->pin->port,self->pin->number, - gpioModeWiredAnd,value); + GPIO_PinModeSet(self->pin->port, self->pin->number, + gpioModeWiredAnd, value); } else { - GPIO_PinModeSet(self->pin->port,self->pin->number, - gpioModePushPull,value); + GPIO_PinModeSet(self->pin->port, self->pin->number, + gpioModePushPull, value); } if (value) { @@ -97,7 +97,7 @@ digitalinout_result_t common_hal_digitalio_digitalinout_switch_to_output( // Get direction of the pin digitalio_direction_t common_hal_digitalio_digitalinout_get_direction( digitalio_digitalinout_obj_t *self) { - GPIO_Mode_TypeDef mode = GPIO_PinModeGet(self->pin->port,self->pin->number); + GPIO_Mode_TypeDef mode = GPIO_PinModeGet(self->pin->port, self->pin->number); if (mode >= gpioModePushPull) { return DIRECTION_OUTPUT; } @@ -129,9 +129,9 @@ digitalinout_result_t common_hal_digitalio_digitalinout_set_drive_mode( digitalio_digitalinout_obj_t *self, digitalio_drive_mode_t drive_mode) { if (drive_mode == DRIVE_MODE_OPEN_DRAIN) { - GPIO_PinModeSet(self->pin->port,self->pin->number,gpioModeWiredAnd,1); + GPIO_PinModeSet(self->pin->port, self->pin->number, gpioModeWiredAnd, 1); } else { - GPIO_PinModeSet(self->pin->port,self->pin->number,gpioModePushPull,1); + GPIO_PinModeSet(self->pin->port, self->pin->number, gpioModePushPull, 1); } return DIGITALINOUT_OK; } @@ -139,7 +139,7 @@ digitalinout_result_t common_hal_digitalio_digitalinout_set_drive_mode( // Get drive mode digitalio_drive_mode_t common_hal_digitalio_digitalinout_get_drive_mode( digitalio_digitalinout_obj_t *self) { - GPIO_Mode_TypeDef mode = GPIO_PinModeGet(self->pin->port,self->pin->number); + GPIO_Mode_TypeDef mode = GPIO_PinModeGet(self->pin->port, self->pin->number); if (mode >= gpioModeWiredAnd) { return DRIVE_MODE_OPEN_DRAIN; } diff --git a/ports/silabs/common-hal/microcontroller/Pin.c b/ports/silabs/common-hal/microcontroller/Pin.c index 24141522df..d22485c40d 100644 --- a/ports/silabs/common-hal/microcontroller/Pin.c +++ b/ports/silabs/common-hal/microcontroller/Pin.c @@ -47,9 +47,9 @@ void reset_all_pins(void) { for (port_num = 0; port_num < GPIO_PORT_COUNT; port_num++) { for (pin_num = 0; pin_num < 16; pin_num++) { - if (GPIO_PORT_PIN_VALID(ports[port_num],pin_num) + if (GPIO_PORT_PIN_VALID(ports[port_num], pin_num) && !(never_reset_pins[port_num] >> pin_num & 0x01)) { - GPIO_PinModeSet(ports[port_num], pin_num,gpioModeInput,1); + GPIO_PinModeSet(ports[port_num], pin_num, gpioModeInput, 1); } } } diff --git a/ports/silabs/supervisor/internal_flash.c b/ports/silabs/supervisor/internal_flash.c index c260649c63..bb2b16726d 100644 --- a/ports/silabs/supervisor/internal_flash.c +++ b/ports/silabs/supervisor/internal_flash.c @@ -86,7 +86,7 @@ void port_internal_flash_flush(void) { reset_into_safe_mode(SAFE_MODE_FLASH_WRITE_FAIL); } taskENTER_CRITICAL(); - ret = MSC_WriteWord((uint32_t *)_flash_page_addr,_flash_cache,FLASH_PAGE_SIZE); + ret = MSC_WriteWord((uint32_t *)_flash_page_addr, _flash_cache, FLASH_PAGE_SIZE); taskEXIT_CRITICAL(); if (mscReturnOk != ret) { reset_into_safe_mode(SAFE_MODE_FLASH_WRITE_FAIL); diff --git a/ports/stm/common-hal/alarm/__init__.c b/ports/stm/common-hal/alarm/__init__.c index 78d50b41a8..3d5f43a91a 100644 --- a/ports/stm/common-hal/alarm/__init__.c +++ b/ports/stm/common-hal/alarm/__init__.c @@ -122,11 +122,11 @@ mp_obj_t common_hal_alarm_light_sleep_until_alarms(size_t n_alarms, const mp_obj stm_sleep_source_t cause = alarm_get_wakeup_cause(); switch (cause) { case STM_WAKEUP_RTC: { - wake_alarm = alarm_time_timealarm_find_triggered_alarm(n_alarms,alarms); + wake_alarm = alarm_time_timealarm_find_triggered_alarm(n_alarms, alarms); break; } case STM_WAKEUP_GPIO: { - wake_alarm = alarm_pin_pinalarm_find_triggered_alarm(n_alarms,alarms); + wake_alarm = alarm_pin_pinalarm_find_triggered_alarm(n_alarms, alarms); break; } default: diff --git a/ports/stm/common-hal/alarm/pin/PinAlarm.c b/ports/stm/common-hal/alarm/pin/PinAlarm.c index 161bd9fea6..fe1f595f88 100644 --- a/ports/stm/common-hal/alarm/pin/PinAlarm.c +++ b/ports/stm/common-hal/alarm/pin/PinAlarm.c @@ -147,7 +147,7 @@ void alarm_pin_pinalarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_ob if (!stm_peripherals_exti_reserve(alarm->pin->number)) { mp_raise_RuntimeError(translate("Pin interrupt already in use")); } - stm_peripherals_exti_set_callback(pin_alarm_callback,alarm->pin->number); + stm_peripherals_exti_set_callback(pin_alarm_callback, alarm->pin->number); stm_peripherals_exti_enable(alarm->pin->number); reserved_alarms[alarm->pin->number] = true; } diff --git a/ports/stm/common-hal/alarm/time/TimeAlarm.c b/ports/stm/common-hal/alarm/time/TimeAlarm.c index 9ba6ed7658..e53b8160da 100644 --- a/ports/stm/common-hal/alarm/time/TimeAlarm.c +++ b/ports/stm/common-hal/alarm/time/TimeAlarm.c @@ -108,15 +108,15 @@ void alarm_time_timealarm_set_alarms(bool deep_sleep, size_t n_alarms, const mp_ // Use alarm B, since port reserves A // If true deep sleep is called, it will either ignore or overwrite this depending on // whether it is shorter or longer than the USB delay - stm32_peripherals_rtc_assign_alarm_callback(PERIPHERALS_ALARM_B,timer_callback); - stm32_peripherals_rtc_set_alarm(PERIPHERALS_ALARM_B,wakeup_in_ticks); + stm32_peripherals_rtc_assign_alarm_callback(PERIPHERALS_ALARM_B, timer_callback); + stm32_peripherals_rtc_set_alarm(PERIPHERALS_ALARM_B, wakeup_in_ticks); } void alarm_time_timealarm_prepare_for_deep_sleep(void) { if (deep_sleep_ticks) { // This is used for both fake and real deep sleep, so it still needs the callback - stm32_peripherals_rtc_assign_alarm_callback(PERIPHERALS_ALARM_B,timer_callback); - stm32_peripherals_rtc_set_alarm(PERIPHERALS_ALARM_B,deep_sleep_ticks); + stm32_peripherals_rtc_assign_alarm_callback(PERIPHERALS_ALARM_B, timer_callback); + stm32_peripherals_rtc_set_alarm(PERIPHERALS_ALARM_B, deep_sleep_ticks); deep_sleep_ticks = 0; } } diff --git a/ports/stm/common-hal/analogio/AnalogIn.c b/ports/stm/common-hal/analogio/AnalogIn.c index 7bed932c71..6a67720970 100644 --- a/ports/stm/common-hal/analogio/AnalogIn.c +++ b/ports/stm/common-hal/analogio/AnalogIn.c @@ -79,7 +79,7 @@ void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) { if (common_hal_analogio_analogin_deinited(self)) { return; } - reset_pin_number(self->pin->port,self->pin->number); + reset_pin_number(self->pin->port, self->pin->number); self->pin = NULL; } @@ -200,7 +200,7 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { if (HAL_ADC_Start(&AdcHandle) != HAL_OK) { return 0; } - HAL_ADC_PollForConversion(&AdcHandle,1); + HAL_ADC_PollForConversion(&AdcHandle, 1); uint16_t value = (uint16_t)HAL_ADC_GetValue(&AdcHandle); HAL_ADC_Stop(&AdcHandle); diff --git a/ports/stm/common-hal/analogio/AnalogOut.c b/ports/stm/common-hal/analogio/AnalogOut.c index 4dd8783545..129bb37266 100644 --- a/ports/stm/common-hal/analogio/AnalogOut.c +++ b/ports/stm/common-hal/analogio/AnalogOut.c @@ -105,7 +105,7 @@ bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) { void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) { #if HAS_DAC - reset_pin_number(self->pin->port,self->pin->number); + reset_pin_number(self->pin->port, self->pin->number); self->pin = NULL; dac_on[self->dac_index] = false; diff --git a/ports/stm/common-hal/busio/I2C.c b/ports/stm/common-hal/busio/I2C.c index 42c32b2b52..d565bd1633 100644 --- a/ports/stm/common-hal/busio/I2C.c +++ b/ports/stm/common-hal/busio/I2C.c @@ -208,8 +208,8 @@ void common_hal_busio_i2c_deinit(busio_i2c_obj_t *self) { reserved_i2c[self->sda->periph_index - 1] = false; never_reset_i2c[self->sda->periph_index - 1] = false; - reset_pin_number(self->sda->pin->port,self->sda->pin->number); - reset_pin_number(self->scl->pin->port,self->scl->pin->number); + reset_pin_number(self->sda->pin->port, self->sda->pin->number); + reset_pin_number(self->scl->pin->port, self->scl->pin->number); self->sda = NULL; self->scl = NULL; } diff --git a/ports/stm/common-hal/busio/SPI.c b/ports/stm/common-hal/busio/SPI.c index 2fea1149eb..54905d9d1e 100644 --- a/ports/stm/common-hal/busio/SPI.c +++ b/ports/stm/common-hal/busio/SPI.c @@ -73,14 +73,14 @@ STATIC uint32_t get_busclock(SPI_TypeDef *instance) { STATIC uint32_t stm32_baud_to_spi_div(uint32_t baudrate, uint16_t *prescaler, uint32_t busclock) { static const uint32_t baud_map[8][2] = { - {2,SPI_BAUDRATEPRESCALER_2}, - {4,SPI_BAUDRATEPRESCALER_4}, - {8,SPI_BAUDRATEPRESCALER_8}, - {16,SPI_BAUDRATEPRESCALER_16}, - {32,SPI_BAUDRATEPRESCALER_32}, - {64,SPI_BAUDRATEPRESCALER_64}, - {128,SPI_BAUDRATEPRESCALER_128}, - {256,SPI_BAUDRATEPRESCALER_256} + {2, SPI_BAUDRATEPRESCALER_2}, + {4, SPI_BAUDRATEPRESCALER_4}, + {8, SPI_BAUDRATEPRESCALER_8}, + {16, SPI_BAUDRATEPRESCALER_16}, + {32, SPI_BAUDRATEPRESCALER_32}, + {64, SPI_BAUDRATEPRESCALER_64}, + {128, SPI_BAUDRATEPRESCALER_128}, + {256, SPI_BAUDRATEPRESCALER_256} }; size_t i = 0; uint16_t divisor; @@ -267,12 +267,12 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) { reserved_spi[self->sck->periph_index - 1] = false; never_reset_spi[self->sck->periph_index - 1] = false; - reset_pin_number(self->sck->pin->port,self->sck->pin->number); + reset_pin_number(self->sck->pin->port, self->sck->pin->number); if (self->mosi != NULL) { - reset_pin_number(self->mosi->pin->port,self->mosi->pin->number); + reset_pin_number(self->mosi->pin->port, self->mosi->pin->number); } if (self->miso != NULL) { - reset_pin_number(self->miso->pin->port,self->miso->pin->number); + reset_pin_number(self->miso->pin->port, self->miso->pin->number); } self->sck = NULL; self->mosi = NULL; @@ -379,7 +379,7 @@ bool common_hal_busio_spi_transfer(busio_spi_obj_t *self, mp_raise_ValueError_varg(translate("No %q pin"), MP_QSTR_miso); } HAL_StatusTypeDef result = HAL_SPI_TransmitReceive(&self->handle, - (uint8_t *)data_out, data_in, (uint16_t)len,HAL_MAX_DELAY); + (uint8_t *)data_out, data_in, (uint16_t)len, HAL_MAX_DELAY); return result == HAL_OK; } diff --git a/ports/stm/common-hal/busio/UART.c b/ports/stm/common-hal/busio/UART.c index 4e6e1dbce3..5c9e05250a 100644 --- a/ports/stm/common-hal/busio/UART.c +++ b/ports/stm/common-hal/busio/UART.c @@ -274,11 +274,11 @@ void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { } if (self->tx) { - reset_pin_number(self->tx->pin->port,self->tx->pin->number); + reset_pin_number(self->tx->pin->port, self->tx->pin->number); self->tx = NULL; } if (self->rx) { - reset_pin_number(self->rx->pin->port,self->rx->pin->number); + reset_pin_number(self->rx->pin->port, self->rx->pin->number); self->rx = NULL; } diff --git a/ports/stm/common-hal/microcontroller/Processor.c b/ports/stm/common-hal/microcontroller/Processor.c index 8e21ca8d82..7b3e6a7232 100644 --- a/ports/stm/common-hal/microcontroller/Processor.c +++ b/ports/stm/common-hal/microcontroller/Processor.c @@ -86,7 +86,7 @@ float common_hal_mcu_processor_get_temperature(void) { HAL_ADC_ConfigChannel(&AdcHandle, &sConfig); HAL_ADC_Start(&AdcHandle); - if (HAL_ADC_PollForConversion(&AdcHandle,1) != HAL_OK) { + if (HAL_ADC_PollForConversion(&AdcHandle, 1) != HAL_OK) { mp_raise_RuntimeError(translate("Temperature read timed out")); } uint32_t value = (uint32_t)HAL_ADC_GetValue(&AdcHandle); @@ -118,7 +118,7 @@ float common_hal_mcu_processor_get_voltage(void) { HAL_ADC_ConfigChannel(&AdcHandle, &sConfig); HAL_ADC_Start(&AdcHandle); - if (HAL_ADC_PollForConversion(&AdcHandle,1) != HAL_OK) { + if (HAL_ADC_PollForConversion(&AdcHandle, 1) != HAL_OK) { mp_raise_RuntimeError(translate("Voltage read timed out")); } uint32_t value = (uint32_t)HAL_ADC_GetValue(&AdcHandle); diff --git a/ports/stm/common-hal/os/__init__.c b/ports/stm/common-hal/os/__init__.c index 66dfd9f768..fccaa00bcd 100644 --- a/ports/stm/common-hal/os/__init__.c +++ b/ports/stm/common-hal/os/__init__.c @@ -79,7 +79,7 @@ bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) { uint32_t new_random; uint32_t start = HAL_GetTick(); // the HAL function has a timeout, but it isn't long enough, and isn't adjustable - while (!(__HAL_RNG_GET_FLAG(&handle,RNG_FLAG_DRDY)) && ((HAL_GetTick() - start) < RNG_TIMEOUT)) { + while (!(__HAL_RNG_GET_FLAG(&handle, RNG_FLAG_DRDY)) && ((HAL_GetTick() - start) < RNG_TIMEOUT)) { ; } if (HAL_RNG_GenerateRandomNumber(&handle, &new_random) != HAL_OK) { diff --git a/ports/stm/common-hal/sdioio/SDCard.c b/ports/stm/common-hal/sdioio/SDCard.c index 6f3eb682df..5297c47748 100644 --- a/ports/stm/common-hal/sdioio/SDCard.c +++ b/ports/stm/common-hal/sdioio/SDCard.c @@ -269,13 +269,13 @@ bool common_hal_sdioio_sdcard_deinited(sdioio_sdcard_obj_t *self) { STATIC void never_reset_mcu_periph(const mcu_periph_obj_t *periph) { if (periph) { - never_reset_pin_number(periph->pin->port,periph->pin->number); + never_reset_pin_number(periph->pin->port, periph->pin->number); } } STATIC void reset_mcu_periph(const mcu_periph_obj_t *periph) { if (periph) { - reset_pin_number(periph->pin->port,periph->pin->number); + reset_pin_number(periph->pin->port, periph->pin->number); } } diff --git a/ports/stm/peripherals/stm32f4/stm32f401xe/gpio.c b/ports/stm/peripherals/stm32f4/stm32f401xe/gpio.c index 86634cf6c2..a7e01b70e9 100644 --- a/ports/stm/peripherals/stm32f4/stm32f401xe/gpio.c +++ b/ports/stm/peripherals/stm32f4/stm32f401xe/gpio.c @@ -37,8 +37,8 @@ void stm32_peripherals_gpio_init(void) { __HAL_RCC_GPIOH_CLK_ENABLE(); // Never reset pins - never_reset_pin_number(2,14); // PC14 OSC32_IN - never_reset_pin_number(2,15); // PC15 OSC32_OUT - never_reset_pin_number(0,13); // PA13 SWDIO - never_reset_pin_number(0,14); // PA14 SWCLK + never_reset_pin_number(2, 14); // PC14 OSC32_IN + never_reset_pin_number(2, 15); // PC15 OSC32_OUT + never_reset_pin_number(0, 13); // PA13 SWDIO + never_reset_pin_number(0, 14); // PA14 SWCLK } diff --git a/ports/stm/peripherals/stm32f4/stm32f401xe/pins.c b/ports/stm/peripherals/stm32f4/stm32f401xe/pins.c index a155970bb0..8593fc1517 100644 --- a/ports/stm/peripherals/stm32f4/stm32f401xe/pins.c +++ b/ports/stm/peripherals/stm32f4/stm32f401xe/pins.c @@ -38,25 +38,25 @@ const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); // anti-tamp const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); // OSC32_IN const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); // OSC32_OUT -const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1,10)); -const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1,11)); -const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_1,12)); -const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_1,13)); +const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1, 10)); +const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1, 11)); +const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_1, 12)); +const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_1, 13)); -const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1,0)); -const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1,1)); -const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1,2)); -const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1,3)); -const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1,4)); -const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1,5)); -const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1,6)); -const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1,7)); +const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1, 0)); +const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1, 1)); +const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1, 2)); +const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1, 3)); +const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1, 4)); +const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1, 5)); +const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1, 6)); +const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1, 7)); -const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_1,14)); -const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_1,15)); +const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_1, 14)); +const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_1, 15)); -const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1,8)); -const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1,9)); +const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1, 8)); +const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1, 9)); const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC); const mcu_pin_obj_t pin_PE07 = PIN(4, 7, NO_ADC); diff --git a/ports/stm/peripherals/stm32f4/stm32f405xx/gpio.c b/ports/stm/peripherals/stm32f4/stm32f405xx/gpio.c index 3857666232..dda96d57da 100644 --- a/ports/stm/peripherals/stm32f4/stm32f405xx/gpio.c +++ b/ports/stm/peripherals/stm32f4/stm32f405xx/gpio.c @@ -38,11 +38,11 @@ void stm32_peripherals_gpio_init(void) { __HAL_RCC_GPIOG_CLK_ENABLE(); // Never reset pins - never_reset_pin_number(2,13); // PC13 anti tamp - never_reset_pin_number(2,14); // PC14 OSC32_IN - never_reset_pin_number(2,15); // PC15 OSC32_OUT - never_reset_pin_number(0,13); // PA13 SWDIO - never_reset_pin_number(0,14); // PA14 SWCLK + never_reset_pin_number(2, 13); // PC13 anti tamp + never_reset_pin_number(2, 14); // PC14 OSC32_IN + never_reset_pin_number(2, 15); // PC15 OSC32_OUT + never_reset_pin_number(0, 13); // PA13 SWDIO + never_reset_pin_number(0, 14); // PA14 SWCLK // never_reset_pin_number(0,15); //PA15 JTDI // never_reset_pin_number(1,3); //PB3 JTDO // never_reset_pin_number(1,4); //PB4 JTRST diff --git a/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c b/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c index 9fef433ea2..0f519a9b82 100644 --- a/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c +++ b/ports/stm/peripherals/stm32f4/stm32f405xx/pins.c @@ -28,14 +28,14 @@ #include "py/mphal.h" #include "peripherals/pins.h" -const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_123,0)); -const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_123,1)); -const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_123,2)); -const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_123,3)); -const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_12,4)); -const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_12,5)); -const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_12,6)); -const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_12,7)); +const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_123, 0)); +const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_123, 1)); +const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_123, 2)); +const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_123, 3)); +const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_12, 4)); +const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_12, 5)); +const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_12, 6)); +const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_12, 7)); const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC); const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC); const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC); @@ -44,8 +44,8 @@ const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC); const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC); const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC); const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC); -const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_12,8)); -const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_12,9)); +const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_12, 8)); +const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_12, 9)); const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC); const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC); const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC); @@ -60,12 +60,12 @@ const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC); const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC); const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC); const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC); -const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_123,10)); -const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_123,11)); -const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_123,12)); -const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_123,13)); -const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_12,14)); -const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_12,15)); +const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_123, 10)); +const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_123, 11)); +const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_123, 12)); +const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_123, 13)); +const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_12, 14)); +const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_12, 15)); const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC); const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC); const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC); @@ -111,14 +111,14 @@ const mcu_pin_obj_t pin_PE15 = PIN(4, 15, NO_ADC); const mcu_pin_obj_t pin_PF00 = PIN(5, 0, NO_ADC); const mcu_pin_obj_t pin_PF01 = PIN(5, 1, NO_ADC); const mcu_pin_obj_t pin_PF02 = PIN(5, 2, NO_ADC); -const mcu_pin_obj_t pin_PF03 = PIN(5, 3, ADC_INPUT(ADC_3,9)); -const mcu_pin_obj_t pin_PF04 = PIN(5, 4, ADC_INPUT(ADC_3,14)); -const mcu_pin_obj_t pin_PF05 = PIN(5, 5, ADC_INPUT(ADC_3,15)); -const mcu_pin_obj_t pin_PF06 = PIN(5, 6, ADC_INPUT(ADC_3,4)); -const mcu_pin_obj_t pin_PF07 = PIN(5, 7, ADC_INPUT(ADC_3,5)); -const mcu_pin_obj_t pin_PF08 = PIN(5, 8, ADC_INPUT(ADC_3,6)); -const mcu_pin_obj_t pin_PF09 = PIN(5, 9, ADC_INPUT(ADC_3,7)); -const mcu_pin_obj_t pin_PF10 = PIN(5, 10, ADC_INPUT(ADC_3,8)); +const mcu_pin_obj_t pin_PF03 = PIN(5, 3, ADC_INPUT(ADC_3, 9)); +const mcu_pin_obj_t pin_PF04 = PIN(5, 4, ADC_INPUT(ADC_3, 14)); +const mcu_pin_obj_t pin_PF05 = PIN(5, 5, ADC_INPUT(ADC_3, 15)); +const mcu_pin_obj_t pin_PF06 = PIN(5, 6, ADC_INPUT(ADC_3, 4)); +const mcu_pin_obj_t pin_PF07 = PIN(5, 7, ADC_INPUT(ADC_3, 5)); +const mcu_pin_obj_t pin_PF08 = PIN(5, 8, ADC_INPUT(ADC_3, 6)); +const mcu_pin_obj_t pin_PF09 = PIN(5, 9, ADC_INPUT(ADC_3, 7)); +const mcu_pin_obj_t pin_PF10 = PIN(5, 10, ADC_INPUT(ADC_3, 8)); const mcu_pin_obj_t pin_PF11 = PIN(5, 11, NO_ADC); const mcu_pin_obj_t pin_PF12 = PIN(5, 12, NO_ADC); const mcu_pin_obj_t pin_PF13 = PIN(5, 13, NO_ADC); diff --git a/ports/stm/peripherals/stm32f4/stm32f407xx/gpio.c b/ports/stm/peripherals/stm32f4/stm32f407xx/gpio.c index 3857666232..dda96d57da 100644 --- a/ports/stm/peripherals/stm32f4/stm32f407xx/gpio.c +++ b/ports/stm/peripherals/stm32f4/stm32f407xx/gpio.c @@ -38,11 +38,11 @@ void stm32_peripherals_gpio_init(void) { __HAL_RCC_GPIOG_CLK_ENABLE(); // Never reset pins - never_reset_pin_number(2,13); // PC13 anti tamp - never_reset_pin_number(2,14); // PC14 OSC32_IN - never_reset_pin_number(2,15); // PC15 OSC32_OUT - never_reset_pin_number(0,13); // PA13 SWDIO - never_reset_pin_number(0,14); // PA14 SWCLK + never_reset_pin_number(2, 13); // PC13 anti tamp + never_reset_pin_number(2, 14); // PC14 OSC32_IN + never_reset_pin_number(2, 15); // PC15 OSC32_OUT + never_reset_pin_number(0, 13); // PA13 SWDIO + never_reset_pin_number(0, 14); // PA14 SWCLK // never_reset_pin_number(0,15); //PA15 JTDI // never_reset_pin_number(1,3); //PB3 JTDO // never_reset_pin_number(1,4); //PB4 JTRST diff --git a/ports/stm/peripherals/stm32f4/stm32f407xx/pins.c b/ports/stm/peripherals/stm32f4/stm32f407xx/pins.c index 9fef433ea2..0f519a9b82 100644 --- a/ports/stm/peripherals/stm32f4/stm32f407xx/pins.c +++ b/ports/stm/peripherals/stm32f4/stm32f407xx/pins.c @@ -28,14 +28,14 @@ #include "py/mphal.h" #include "peripherals/pins.h" -const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_123,0)); -const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_123,1)); -const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_123,2)); -const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_123,3)); -const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_12,4)); -const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_12,5)); -const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_12,6)); -const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_12,7)); +const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_123, 0)); +const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_123, 1)); +const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_123, 2)); +const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_123, 3)); +const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_12, 4)); +const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_12, 5)); +const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_12, 6)); +const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_12, 7)); const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC); const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC); const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC); @@ -44,8 +44,8 @@ const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC); const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC); const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC); const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC); -const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_12,8)); -const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_12,9)); +const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_12, 8)); +const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_12, 9)); const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC); const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC); const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC); @@ -60,12 +60,12 @@ const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC); const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC); const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC); const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC); -const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_123,10)); -const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_123,11)); -const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_123,12)); -const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_123,13)); -const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_12,14)); -const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_12,15)); +const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_123, 10)); +const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_123, 11)); +const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_123, 12)); +const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_123, 13)); +const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_12, 14)); +const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_12, 15)); const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC); const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC); const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC); @@ -111,14 +111,14 @@ const mcu_pin_obj_t pin_PE15 = PIN(4, 15, NO_ADC); const mcu_pin_obj_t pin_PF00 = PIN(5, 0, NO_ADC); const mcu_pin_obj_t pin_PF01 = PIN(5, 1, NO_ADC); const mcu_pin_obj_t pin_PF02 = PIN(5, 2, NO_ADC); -const mcu_pin_obj_t pin_PF03 = PIN(5, 3, ADC_INPUT(ADC_3,9)); -const mcu_pin_obj_t pin_PF04 = PIN(5, 4, ADC_INPUT(ADC_3,14)); -const mcu_pin_obj_t pin_PF05 = PIN(5, 5, ADC_INPUT(ADC_3,15)); -const mcu_pin_obj_t pin_PF06 = PIN(5, 6, ADC_INPUT(ADC_3,4)); -const mcu_pin_obj_t pin_PF07 = PIN(5, 7, ADC_INPUT(ADC_3,5)); -const mcu_pin_obj_t pin_PF08 = PIN(5, 8, ADC_INPUT(ADC_3,6)); -const mcu_pin_obj_t pin_PF09 = PIN(5, 9, ADC_INPUT(ADC_3,7)); -const mcu_pin_obj_t pin_PF10 = PIN(5, 10, ADC_INPUT(ADC_3,8)); +const mcu_pin_obj_t pin_PF03 = PIN(5, 3, ADC_INPUT(ADC_3, 9)); +const mcu_pin_obj_t pin_PF04 = PIN(5, 4, ADC_INPUT(ADC_3, 14)); +const mcu_pin_obj_t pin_PF05 = PIN(5, 5, ADC_INPUT(ADC_3, 15)); +const mcu_pin_obj_t pin_PF06 = PIN(5, 6, ADC_INPUT(ADC_3, 4)); +const mcu_pin_obj_t pin_PF07 = PIN(5, 7, ADC_INPUT(ADC_3, 5)); +const mcu_pin_obj_t pin_PF08 = PIN(5, 8, ADC_INPUT(ADC_3, 6)); +const mcu_pin_obj_t pin_PF09 = PIN(5, 9, ADC_INPUT(ADC_3, 7)); +const mcu_pin_obj_t pin_PF10 = PIN(5, 10, ADC_INPUT(ADC_3, 8)); const mcu_pin_obj_t pin_PF11 = PIN(5, 11, NO_ADC); const mcu_pin_obj_t pin_PF12 = PIN(5, 12, NO_ADC); const mcu_pin_obj_t pin_PF13 = PIN(5, 13, NO_ADC); diff --git a/ports/stm/peripherals/stm32f4/stm32f411xe/gpio.c b/ports/stm/peripherals/stm32f4/stm32f411xe/gpio.c index 351607a70e..e63e46d318 100644 --- a/ports/stm/peripherals/stm32f4/stm32f411xe/gpio.c +++ b/ports/stm/peripherals/stm32f4/stm32f411xe/gpio.c @@ -40,12 +40,12 @@ void stm32_peripherals_gpio_init(void) { // Never reset pins // TODO: Move this out of peripherals. These helpers shouldn't reference anything CircuitPython // specific. - never_reset_pin_number(2,14); // PC14 OSC32_IN - never_reset_pin_number(2,15); // PC15 OSC32_OUT + never_reset_pin_number(2, 14); // PC14 OSC32_IN + never_reset_pin_number(2, 15); // PC15 OSC32_OUT #if !(BOARD_OVERWRITE_SWD) - never_reset_pin_number(0,13); // PA13 SWDIO - never_reset_pin_number(0,14); // PA14 SWCLK + never_reset_pin_number(0, 13); // PA13 SWDIO + never_reset_pin_number(0, 14); // PA14 SWCLK #endif // Port H is not included in GPIO port array diff --git a/ports/stm/peripherals/stm32f4/stm32f411xe/periph.c b/ports/stm/peripherals/stm32f4/stm32f411xe/periph.c index dd9cb3d842..c47ecff271 100644 --- a/ports/stm/peripherals/stm32f4/stm32f411xe/periph.c +++ b/ports/stm/peripherals/stm32f4/stm32f411xe/periph.c @@ -148,47 +148,47 @@ TIM_TypeDef *mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, NULL TIM11, NULL, NULL, NULL}; const mcu_tim_pin_obj_t mcu_tim_pin_list[44] = { - TIM(2,1,1,&pin_PA00), - TIM(5,2,1,&pin_PA00), - TIM(2,1,2,&pin_PA01), - TIM(5,2,2,&pin_PA01), - TIM(2,1,3,&pin_PA02), - TIM(5,2,3,&pin_PA02), - TIM(2,1,4,&pin_PA03), - TIM(5,2,4,&pin_PA03), - TIM(9,3,1,&pin_PA02), - TIM(9,3,2,&pin_PA03), - TIM(3,2,1,&pin_PA06), - TIM(3,2,2,&pin_PA07), - TIM(1,1,1,&pin_PA08), - TIM(1,1,2,&pin_PA09), - TIM(1,1,3,&pin_PA10), - TIM(1,1,4,&pin_PA11), - TIM(2,1,1,&pin_PA15), - TIM(3,2,3,&pin_PB00), - TIM(3,2,4,&pin_PB01), - TIM(2,1,2,&pin_PB03), - TIM(3,2,1,&pin_PB04), - TIM(3,2,2,&pin_PB05), - TIM(4,2,1,&pin_PB06), - TIM(4,2,2,&pin_PB07), - TIM(4,2,3,&pin_PB08), - TIM(10,2,1,&pin_PB08), - TIM(4,2,4,&pin_PB09), - TIM(11,2,1,&pin_PB09), - TIM(2,1,3,&pin_PB10), - TIM(3,2,1,&pin_PC06), - TIM(3,2,2,&pin_PC07), - TIM(3,2,3,&pin_PC08), - TIM(3,2,4,&pin_PC09), - TIM(4,2,1,&pin_PD12), - TIM(4,2,2,&pin_PD13), - TIM(4,2,3,&pin_PD14), - TIM(4,2,4,&pin_PD15), - TIM(9,3,1,&pin_PE05), - TIM(9,3,2,&pin_PE06), - TIM(1,1,1,&pin_PE09), - TIM(1,1,2,&pin_PE11), - TIM(1,1,3,&pin_PE13), - TIM(1,1,4,&pin_PE14), + TIM(2, 1, 1, &pin_PA00), + TIM(5, 2, 1, &pin_PA00), + TIM(2, 1, 2, &pin_PA01), + TIM(5, 2, 2, &pin_PA01), + TIM(2, 1, 3, &pin_PA02), + TIM(5, 2, 3, &pin_PA02), + TIM(2, 1, 4, &pin_PA03), + TIM(5, 2, 4, &pin_PA03), + TIM(9, 3, 1, &pin_PA02), + TIM(9, 3, 2, &pin_PA03), + TIM(3, 2, 1, &pin_PA06), + TIM(3, 2, 2, &pin_PA07), + TIM(1, 1, 1, &pin_PA08), + TIM(1, 1, 2, &pin_PA09), + TIM(1, 1, 3, &pin_PA10), + TIM(1, 1, 4, &pin_PA11), + TIM(2, 1, 1, &pin_PA15), + TIM(3, 2, 3, &pin_PB00), + TIM(3, 2, 4, &pin_PB01), + TIM(2, 1, 2, &pin_PB03), + TIM(3, 2, 1, &pin_PB04), + TIM(3, 2, 2, &pin_PB05), + TIM(4, 2, 1, &pin_PB06), + TIM(4, 2, 2, &pin_PB07), + TIM(4, 2, 3, &pin_PB08), + TIM(10, 2, 1, &pin_PB08), + TIM(4, 2, 4, &pin_PB09), + TIM(11, 2, 1, &pin_PB09), + TIM(2, 1, 3, &pin_PB10), + TIM(3, 2, 1, &pin_PC06), + TIM(3, 2, 2, &pin_PC07), + TIM(3, 2, 3, &pin_PC08), + TIM(3, 2, 4, &pin_PC09), + TIM(4, 2, 1, &pin_PD12), + TIM(4, 2, 2, &pin_PD13), + TIM(4, 2, 3, &pin_PD14), + TIM(4, 2, 4, &pin_PD15), + TIM(9, 3, 1, &pin_PE05), + TIM(9, 3, 2, &pin_PE06), + TIM(1, 1, 1, &pin_PE09), + TIM(1, 1, 2, &pin_PE11), + TIM(1, 1, 3, &pin_PE13), + TIM(1, 1, 4, &pin_PE14), }; diff --git a/ports/stm/peripherals/stm32f4/stm32f412cx/gpio.c b/ports/stm/peripherals/stm32f4/stm32f412cx/gpio.c index f55b63f296..f686dc3b46 100644 --- a/ports/stm/peripherals/stm32f4/stm32f412cx/gpio.c +++ b/ports/stm/peripherals/stm32f4/stm32f412cx/gpio.c @@ -34,6 +34,6 @@ void stm32_peripherals_gpio_init(void) { __HAL_RCC_GPIOC_CLK_ENABLE(); // Never reset pins - never_reset_pin_number(0,13); // PA13 SWDIO - never_reset_pin_number(0,14); // PA14 SWCLK + never_reset_pin_number(0, 13); // PA13 SWDIO + never_reset_pin_number(0, 14); // PA14 SWCLK } diff --git a/ports/stm/peripherals/stm32f4/stm32f412cx/pins.c b/ports/stm/peripherals/stm32f4/stm32f412cx/pins.c index 57abacc99a..45c196ac6b 100644 --- a/ports/stm/peripherals/stm32f4/stm32f412cx/pins.c +++ b/ports/stm/peripherals/stm32f4/stm32f412cx/pins.c @@ -28,14 +28,14 @@ #include "py/mphal.h" #include "peripherals/pins.h" -const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1,0)); -const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1,1)); -const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1,2)); -const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1,3)); -const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1,4)); -const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1,5)); -const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1,6)); -const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1,7)); +const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1, 0)); +const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1, 1)); +const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1, 2)); +const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1, 3)); +const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1, 4)); +const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1, 5)); +const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1, 6)); +const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1, 7)); const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC); const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC); const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC); @@ -45,8 +45,8 @@ const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC); const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC); const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC); -const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1,8)); -const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1,9)); +const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1, 8)); +const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1, 9)); const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC); const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC); const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC); diff --git a/ports/stm/peripherals/stm32f4/stm32f412zx/gpio.c b/ports/stm/peripherals/stm32f4/stm32f412zx/gpio.c index 6fe7bbb9c7..13a7aca4af 100644 --- a/ports/stm/peripherals/stm32f4/stm32f412zx/gpio.c +++ b/ports/stm/peripherals/stm32f4/stm32f412zx/gpio.c @@ -39,11 +39,11 @@ void stm32_peripherals_gpio_init(void) { __HAL_RCC_GPIOD_CLK_ENABLE(); // Never reset pins - never_reset_pin_number(2,13); // PC13 anti tamp - never_reset_pin_number(2,14); // PC14 OSC32_IN - never_reset_pin_number(2,15); // PC15 OSC32_OUT - never_reset_pin_number(0,13); // PA13 SWDIO - never_reset_pin_number(0,14); // PA14 SWCLK + never_reset_pin_number(2, 13); // PC13 anti tamp + never_reset_pin_number(2, 14); // PC14 OSC32_IN + never_reset_pin_number(2, 15); // PC15 OSC32_OUT + never_reset_pin_number(0, 13); // PA13 SWDIO + never_reset_pin_number(0, 14); // PA14 SWCLK // never_reset_pin_number(0,15); //PA15 JTDI // never_reset_pin_number(1,3); //PB3 JTDO // never_reset_pin_number(1,4); //PB4 JTRST diff --git a/ports/stm/peripherals/stm32f4/stm32f412zx/periph.c b/ports/stm/peripherals/stm32f4/stm32f412zx/periph.c index 8cd61fd49d..2e1c3114ef 100644 --- a/ports/stm/peripherals/stm32f4/stm32f412zx/periph.c +++ b/ports/stm/peripherals/stm32f4/stm32f412zx/periph.c @@ -160,64 +160,64 @@ TIM_TypeDef *mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, TIM8 TIM11, TIM12, TIM13, TIM14}; const mcu_tim_pin_obj_t mcu_tim_pin_list[60] = { - TIM(2,1,1,&pin_PA00), - TIM(5,2,1,&pin_PA00), - TIM(2,1,2,&pin_PA01), - TIM(5,2,2,&pin_PA01), - TIM(2,1,3,&pin_PA02), - TIM(5,2,3,&pin_PA02), - TIM(2,1,4,&pin_PA03), - TIM(5,2,4,&pin_PA03), - TIM(9,3,1,&pin_PA02), - TIM(9,3,2,&pin_PA03), - TIM(3,2,1,&pin_PA06), - TIM(13,9,1,&pin_PA06), - TIM(3,2,2,&pin_PA07), - TIM(14,9,1,&pin_PA07), - TIM(1,1,1,&pin_PA08), - TIM(1,1,2,&pin_PA09), - TIM(1,1,3,&pin_PA10), - TIM(1,1,4,&pin_PA11), - TIM(2,1,1,&pin_PA15), - TIM(3,2,3,&pin_PB00), - TIM(3,2,4,&pin_PB01), - TIM(2,1,2,&pin_PB03), - TIM(3,2,1,&pin_PB04), - TIM(3,2,2,&pin_PB05), - TIM(4,2,1,&pin_PB06), - TIM(4,2,2,&pin_PB07), - TIM(4,2,3,&pin_PB08), - TIM(10,2,1,&pin_PB08), - TIM(4,2,4,&pin_PB09), - TIM(11,2,1,&pin_PB09), - TIM(2,1,3,&pin_PB10), - TIM(2,1,4,&pin_PB11), - TIM(12,9,1,&pin_PB14), - TIM(12,9,2,&pin_PB15), - TIM(3,2,1,&pin_PC06), - TIM(3,2,2,&pin_PC07), - TIM(3,2,3,&pin_PC08), - TIM(3,2,4,&pin_PC09), - TIM(8,3,1,&pin_PC06), - TIM(8,3,2,&pin_PC07), - TIM(8,3,3,&pin_PC08), - TIM(8,3,4,&pin_PC09), - TIM(4,2,1,&pin_PD12), - TIM(4,2,2,&pin_PD13), - TIM(4,2,3,&pin_PD14), - TIM(4,2,4,&pin_PD15), - TIM(9,3,1,&pin_PE05), - TIM(9,3,2,&pin_PE06), - TIM(1,1,1,&pin_PE09), - TIM(1,1,2,&pin_PE11), - TIM(1,1,3,&pin_PE13), - TIM(1,1,4,&pin_PE14), - TIM(10,3,1,&pin_PF06), - TIM(11,3,1,&pin_PF07), - TIM(13,9,1,&pin_PF08), - TIM(14,9,1,&pin_PF09), - TIM(5,2,1,&pin_PF03), - TIM(5,2,2,&pin_PF04), - TIM(5,2,3,&pin_PF05), - TIM(5,2,4,&pin_PF10), + TIM(2, 1, 1, &pin_PA00), + TIM(5, 2, 1, &pin_PA00), + TIM(2, 1, 2, &pin_PA01), + TIM(5, 2, 2, &pin_PA01), + TIM(2, 1, 3, &pin_PA02), + TIM(5, 2, 3, &pin_PA02), + TIM(2, 1, 4, &pin_PA03), + TIM(5, 2, 4, &pin_PA03), + TIM(9, 3, 1, &pin_PA02), + TIM(9, 3, 2, &pin_PA03), + TIM(3, 2, 1, &pin_PA06), + TIM(13, 9, 1, &pin_PA06), + TIM(3, 2, 2, &pin_PA07), + TIM(14, 9, 1, &pin_PA07), + TIM(1, 1, 1, &pin_PA08), + TIM(1, 1, 2, &pin_PA09), + TIM(1, 1, 3, &pin_PA10), + TIM(1, 1, 4, &pin_PA11), + TIM(2, 1, 1, &pin_PA15), + TIM(3, 2, 3, &pin_PB00), + TIM(3, 2, 4, &pin_PB01), + TIM(2, 1, 2, &pin_PB03), + TIM(3, 2, 1, &pin_PB04), + TIM(3, 2, 2, &pin_PB05), + TIM(4, 2, 1, &pin_PB06), + TIM(4, 2, 2, &pin_PB07), + TIM(4, 2, 3, &pin_PB08), + TIM(10, 2, 1, &pin_PB08), + TIM(4, 2, 4, &pin_PB09), + TIM(11, 2, 1, &pin_PB09), + TIM(2, 1, 3, &pin_PB10), + TIM(2, 1, 4, &pin_PB11), + TIM(12, 9, 1, &pin_PB14), + TIM(12, 9, 2, &pin_PB15), + TIM(3, 2, 1, &pin_PC06), + TIM(3, 2, 2, &pin_PC07), + TIM(3, 2, 3, &pin_PC08), + TIM(3, 2, 4, &pin_PC09), + TIM(8, 3, 1, &pin_PC06), + TIM(8, 3, 2, &pin_PC07), + TIM(8, 3, 3, &pin_PC08), + TIM(8, 3, 4, &pin_PC09), + TIM(4, 2, 1, &pin_PD12), + TIM(4, 2, 2, &pin_PD13), + TIM(4, 2, 3, &pin_PD14), + TIM(4, 2, 4, &pin_PD15), + TIM(9, 3, 1, &pin_PE05), + TIM(9, 3, 2, &pin_PE06), + TIM(1, 1, 1, &pin_PE09), + TIM(1, 1, 2, &pin_PE11), + TIM(1, 1, 3, &pin_PE13), + TIM(1, 1, 4, &pin_PE14), + TIM(10, 3, 1, &pin_PF06), + TIM(11, 3, 1, &pin_PF07), + TIM(13, 9, 1, &pin_PF08), + TIM(14, 9, 1, &pin_PF09), + TIM(5, 2, 1, &pin_PF03), + TIM(5, 2, 2, &pin_PF04), + TIM(5, 2, 3, &pin_PF05), + TIM(5, 2, 4, &pin_PF10), }; diff --git a/ports/stm/peripherals/stm32f4/stm32f412zx/pins.c b/ports/stm/peripherals/stm32f4/stm32f412zx/pins.c index 4fa70b5bd8..c0ee9e99e4 100644 --- a/ports/stm/peripherals/stm32f4/stm32f412zx/pins.c +++ b/ports/stm/peripherals/stm32f4/stm32f412zx/pins.c @@ -50,25 +50,25 @@ const mcu_pin_obj_t pin_PF08 = PIN(5, 8, NO_ADC); // 144 only const mcu_pin_obj_t pin_PF09 = PIN(5, 9, NO_ADC); // 144 only const mcu_pin_obj_t pin_PF10 = PIN(5, 10, NO_ADC); // 144 only -const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1,10)); -const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1,11)); -const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_1,12)); -const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_1,13)); +const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1, 10)); +const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1, 11)); +const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_1, 12)); +const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_1, 13)); -const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1,0)); -const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1,1)); -const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1,2)); -const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1,3)); -const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1,4)); -const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1,5)); -const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1,6)); -const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1,7)); +const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1, 0)); +const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1, 1)); +const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1, 2)); +const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1, 3)); +const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1, 4)); +const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1, 5)); +const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1, 6)); +const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1, 7)); -const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_1,14)); -const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_1,15)); +const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_1, 14)); +const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_1, 15)); -const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1,8)); -const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1,9)); +const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1, 8)); +const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1, 9)); const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC); const mcu_pin_obj_t pin_PF11 = PIN(5, 11, NO_ADC); // 144 only diff --git a/ports/stm/peripherals/stm32f7/stm32f746xx/gpio.c b/ports/stm/peripherals/stm32f7/stm32f746xx/gpio.c index b7cc0aad6e..7a6059eebc 100644 --- a/ports/stm/peripherals/stm32f7/stm32f746xx/gpio.c +++ b/ports/stm/peripherals/stm32f7/stm32f746xx/gpio.c @@ -43,10 +43,10 @@ void stm32_peripherals_gpio_init(void) { __HAL_RCC_GPIOK_CLK_ENABLE(); // Never reset pins - never_reset_pin_number(2,14); // PC14 OSC32_IN - never_reset_pin_number(2,15); // PC15 OSC32_OUT - never_reset_pin_number(0,13); // PA13 SWDIO - never_reset_pin_number(0,14); // PA14 SWCLK - never_reset_pin_number(7,0); // PH0 OSC_IN - never_reset_pin_number(7,1); // PH1 OSC_OUT + never_reset_pin_number(2, 14); // PC14 OSC32_IN + never_reset_pin_number(2, 15); // PC15 OSC32_OUT + never_reset_pin_number(0, 13); // PA13 SWDIO + never_reset_pin_number(0, 14); // PA14 SWCLK + never_reset_pin_number(7, 0); // PH0 OSC_IN + never_reset_pin_number(7, 1); // PH1 OSC_OUT } diff --git a/ports/stm/peripherals/stm32f7/stm32f767xx/gpio.c b/ports/stm/peripherals/stm32f7/stm32f767xx/gpio.c index f89af2714e..8b5fa5f3e1 100644 --- a/ports/stm/peripherals/stm32f7/stm32f767xx/gpio.c +++ b/ports/stm/peripherals/stm32f7/stm32f767xx/gpio.c @@ -39,8 +39,8 @@ void stm32_peripherals_gpio_init(void) { __HAL_RCC_GPIOD_CLK_ENABLE(); // Never reset pins - never_reset_pin_number(2,14); // PC14 OSC32_IN - never_reset_pin_number(2,15); // PC15 OSC32_OUT - never_reset_pin_number(0,13); // PA13 SWDIO - never_reset_pin_number(0,14); // PA14 SWCLK + never_reset_pin_number(2, 14); // PC14 OSC32_IN + never_reset_pin_number(2, 15); // PC15 OSC32_OUT + never_reset_pin_number(0, 13); // PA13 SWDIO + never_reset_pin_number(0, 14); // PA14 SWCLK } diff --git a/ports/stm/peripherals/stm32h7/stm32h743xx/gpio.c b/ports/stm/peripherals/stm32h7/stm32h743xx/gpio.c index f89af2714e..8b5fa5f3e1 100644 --- a/ports/stm/peripherals/stm32h7/stm32h743xx/gpio.c +++ b/ports/stm/peripherals/stm32h7/stm32h743xx/gpio.c @@ -39,8 +39,8 @@ void stm32_peripherals_gpio_init(void) { __HAL_RCC_GPIOD_CLK_ENABLE(); // Never reset pins - never_reset_pin_number(2,14); // PC14 OSC32_IN - never_reset_pin_number(2,15); // PC15 OSC32_OUT - never_reset_pin_number(0,13); // PA13 SWDIO - never_reset_pin_number(0,14); // PA14 SWCLK + never_reset_pin_number(2, 14); // PC14 OSC32_IN + never_reset_pin_number(2, 15); // PC15 OSC32_OUT + never_reset_pin_number(0, 13); // PA13 SWDIO + never_reset_pin_number(0, 14); // PA14 SWCLK } diff --git a/ports/stm/peripherals/stm32l4/stm32l4r5xx/gpio.c b/ports/stm/peripherals/stm32l4/stm32l4r5xx/gpio.c index e8b805dcec..a3f23ad009 100644 --- a/ports/stm/peripherals/stm32l4/stm32l4r5xx/gpio.c +++ b/ports/stm/peripherals/stm32l4/stm32l4r5xx/gpio.c @@ -42,10 +42,10 @@ void stm32_peripherals_gpio_init(void) { // __HAL_RCC_GPIOI_CLK_ENABLE(); // Never reset pins - never_reset_pin_number(2,14); // PC14 OSC32_IN - never_reset_pin_number(2,15); // PC15 OSC32_OUT - never_reset_pin_number(0,13); // PA13 SWDIO - never_reset_pin_number(0,14); // PA14 SWCLK + never_reset_pin_number(2, 14); // PC14 OSC32_IN + never_reset_pin_number(2, 15); // PC15 OSC32_OUT + never_reset_pin_number(0, 13); // PA13 SWDIO + never_reset_pin_number(0, 14); // PA14 SWCLK // never_reset_pin_number(0,15); //PA15 JTDI // never_reset_pin_number(1,3); //PB3 JTDO // never_reset_pin_number(1,4); //PB4 JTRST diff --git a/ports/stm/supervisor/serial.c b/ports/stm/supervisor/serial.c index 013381e4e3..10196fbc31 100644 --- a/ports/stm/supervisor/serial.c +++ b/ports/stm/supervisor/serial.c @@ -47,7 +47,7 @@ void port_serial_init(void) { huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE; huart2.Init.OverSampling = UART_OVERSAMPLING_16; if (HAL_UART_Init(&huart2) == HAL_OK) { - stm32f4_peripherals_status_led(1,1); + stm32f4_peripherals_status_led(1, 1); } #endif } @@ -59,7 +59,7 @@ bool port_serial_connected(void) { char port_serial_read(void) { #if CPY_STM32F4 uint8_t data; - HAL_UART_Receive(&huart2, &data, 1,500); + HAL_UART_Receive(&huart2, &data, 1, 500); return data; #else return -1; diff --git a/ports/unix/main.c b/ports/unix/main.c index 28a733d191..e2ea429439 100644 --- a/ports/unix/main.c +++ b/ports/unix/main.c @@ -410,7 +410,7 @@ STATIC void pre_process_options(int argc, char **argv) { #if MICROPY_PY_THREAD mp_thread_is_realtime_enabled = true; #endif - // main thread was already intialized before the option + // main thread was already initialized before the option // was parsed, so we have to enable realtime here. mp_thread_set_realtime(); #endif diff --git a/ports/unix/moduos_vfs.c b/ports/unix/moduos_vfs.c index 495679290a..e13474cc36 100644 --- a/ports/unix/moduos_vfs.c +++ b/ports/unix/moduos_vfs.c @@ -68,7 +68,7 @@ STATIC const mp_rom_map_elem_t uos_vfs_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename),MP_ROM_PTR(&mp_vfs_rename_obj) }, + { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mp_vfs_rename_obj) }, { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h index 58a214178a..9007a70afe 100644 --- a/ports/unix/mpconfigport.h +++ b/ports/unix/mpconfigport.h @@ -34,7 +34,7 @@ // If we're building the minimal variant, ignore the rest of this file. #ifndef MICROPY_UNIX_MINIMAL -//CIRCUITPY +// CIRCUITPY #define CIRCUITPY_MICROPYTHON_ADVANCED (1) // If the variant did not set a feature level then configure a set of features. @@ -108,7 +108,7 @@ #define MICROPY_ALLOC_PATH_MAX (PATH_MAX) #define MICROPY_PERSISTENT_CODE_LOAD (1) -//CIRCUITPY: native emitters not supported +// CIRCUITPY: native emitters not supported #define MICROPY_EMIT_X64 (!CIRCUITPY) #define MICROPY_EMIT_X86 (!CIRCUITPY) #define MICROPY_EMIT_THUMB (!CIRCUITPY) diff --git a/py/builtinimport.c b/py/builtinimport.c index 53336ac0e8..bf47b2567e 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -460,7 +460,7 @@ STATIC mp_obj_t process_import_at_level(qstr full_mod_name, qstr level_mod_name, // because the file will not exist. } - //CIRCUITPY + // CIRCUITPY // Loading a module thrashes the heap significantly so we explicitly clean up // afterwards. gc_collect(); diff --git a/py/formatfloat.c b/py/formatfloat.c index 58e5406eeb..854944976f 100644 --- a/py/formatfloat.c +++ b/py/formatfloat.c @@ -1,5 +1,5 @@ // CIRCUITPY: https://github.com/adafruit/circuitpython/pull/6722 -// post v1.19.1. Remove this comment during v1.20 merge. +// post v1.19.1. Remove this comment during v1.20 merge. /* * This file is part of the MicroPython project, http://micropython.org/ * diff --git a/py/gc.c b/py/gc.c index 5fd3e97407..d83fe2dfa8 100644 --- a/py/gc.c +++ b/py/gc.c @@ -165,11 +165,11 @@ void gc_init(void *start, void *end) { assert(MP_STATE_MEM(gc_pool_start) >= MP_STATE_MEM(gc_finaliser_table_start) + gc_finaliser_table_byte_len); #endif - // clear ATBs + // clear ATB's memset(MP_STATE_MEM(gc_alloc_table_start), 0, MP_STATE_MEM(gc_alloc_table_byte_len)); #if MICROPY_ENABLE_FINALISER - // clear FTBs + // clear FTB's memset(MP_STATE_MEM(gc_finaliser_table_start), 0, gc_finaliser_table_byte_len); #endif @@ -421,7 +421,7 @@ void gc_collect_root(void **ptrs, size_t len) { for (size_t i = 0; i < len; i++) { MICROPY_GC_HOOK_LOOP void *ptr = gc_get_ptr(ptrs, i); - // CIRCUITPY changed in PR #1816 + // CIRCUITPY changed in PR #1816 gc_mark(ptr); } } diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py index 5f63fa7c55..504fc31a15 100644 --- a/py/makeqstrdata.py +++ b/py/makeqstrdata.py @@ -249,6 +249,7 @@ static_qstr_list = [ "zip", ] + # this must match the equivalent function in qstr.c def compute_hash(qstr, bytes_hash): hash = 5381 @@ -349,11 +350,13 @@ def parse_input_headers_with_translations(infiles): return qcfgs, qstrs, translations + # Used externally by mpy-tool.py. Don't pass back translations. def parse_input_headers(infiles): qcfgs, qstrs, translations = parse_input_headers_with_translations(infiles) return (qcfgs, qstrs) + def escape_bytes(qstr, qbytes): if all(32 <= ord(c) <= 126 and c != "\\" and c != '"' for c in qstr): # qstr is all printable ASCII so render it as-is (for easier debugging) @@ -404,11 +407,11 @@ def print_qstr_data(qcfgs, qstrs, translations): print("// {} bytes worth of qstr".format(total_qstr_size)) - def do_work(infiles): qcfgs, qstrs, translations = parse_input_headers_with_translations(infiles) print_qstr_data(qcfgs, qstrs, translations) + if __name__ == "__main__": import argparse diff --git a/py/makeqstrdefs.py b/py/makeqstrdefs.py index 1bd5b3bbf0..adf6195389 100644 --- a/py/makeqstrdefs.py +++ b/py/makeqstrdefs.py @@ -121,6 +121,7 @@ def write_out(fname, output): with open(args.output_dir + "/" + fname + "." + args.mode, "w") as f: f.write("\n".join(output) + "\n") + def qstr_unescape(qstr): for name in name2codepoint: if "__" + name + "__" in qstr: diff --git a/py/parse.c b/py/parse.c index 314e94af60..c8a3b29bb5 100644 --- a/py/parse.c +++ b/py/parse.c @@ -551,7 +551,7 @@ STATIC mp_parse_node_t make_node_const_object(parser_t *parser, size_t src_line, return (mp_parse_node_t)pn; } -// Create a parse node represeting a constant object, possibly optimising the case of +// Create a parse node representing a constant object, possibly optimising the case of // an integer, by putting the (small) integer value directly in the parse node itself. STATIC mp_parse_node_t make_node_const_object_optimised(parser_t *parser, size_t src_line, mp_obj_t obj) { if (mp_obj_is_small_int(obj)) { @@ -1006,7 +1006,7 @@ STATIC void push_result_rule(parser_t *parser, size_t src_line, uint8_t rule_id, #if MICROPY_COMP_CONST_TUPLE if (build_tuple(parser, src_line, rule_id, num_args)) { - // we built a tuple from this rule so return straightaway + // we built a tuple from this rule so return straight away return; } #endif diff --git a/py/runtime.c b/py/runtime.c index a6c63eea25..da7343d0c6 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -914,7 +914,7 @@ mp_obj_t mp_call_method_n_kw_var(bool have_self, size_t n_args_n_kw, const mp_ob } // unpacked items are stored in reverse order into the array pointed to by items -void __attribute__((noinline,)) mp_unpack_sequence(mp_obj_t seq_in, size_t num, mp_obj_t *items) { +void __attribute__((noinline, )) mp_unpack_sequence(mp_obj_t seq_in, size_t num, mp_obj_t *items) { size_t seq_len; if (mp_obj_is_type(seq_in, &mp_type_tuple) || mp_obj_is_type(seq_in, &mp_type_list)) { mp_obj_t *seq_items; @@ -1537,7 +1537,7 @@ mp_obj_t mp_import_name(qstr name, mp_obj_t fromlist, mp_obj_t level) { return mp_builtin___import__(5, args); } -mp_obj_t __attribute__((noinline,)) mp_import_from(mp_obj_t module, qstr name) { +mp_obj_t __attribute__((noinline, )) mp_import_from(mp_obj_t module, qstr name) { DEBUG_printf("import from %p %s\n", module, qstr_str(name)); mp_obj_t dest[2]; @@ -1689,7 +1689,7 @@ NORETURN MP_COLD void mp_raise_msg_vlist(const mp_obj_type_t *exc_type, const co NORETURN MP_COLD void mp_raise_msg_varg(const mp_obj_type_t *exc_type, const compressed_string_t *fmt, ...) { va_list argptr; - va_start(argptr,fmt); + va_start(argptr, fmt); mp_raise_msg_vlist(exc_type, fmt, argptr); va_end(argptr); } @@ -1712,7 +1712,7 @@ NORETURN MP_COLD void mp_raise_RuntimeError(const compressed_string_t *msg) { NORETURN MP_COLD void mp_raise_RuntimeError_varg(const compressed_string_t *fmt, ...) { va_list argptr; - va_start(argptr,fmt); + va_start(argptr, fmt); mp_raise_msg_vlist(&mp_type_RuntimeError, fmt, argptr); va_end(argptr); } @@ -1727,7 +1727,7 @@ NORETURN MP_COLD void mp_raise_IndexError(const compressed_string_t *msg) { NORETURN MP_COLD void mp_raise_IndexError_varg(const compressed_string_t *fmt, ...) { va_list argptr; - va_start(argptr,fmt); + va_start(argptr, fmt); mp_raise_msg_vlist(&mp_type_IndexError, fmt, argptr); va_end(argptr); } @@ -1738,7 +1738,7 @@ NORETURN MP_COLD void mp_raise_ValueError(const compressed_string_t *msg) { NORETURN MP_COLD void mp_raise_ValueError_varg(const compressed_string_t *fmt, ...) { va_list argptr; - va_start(argptr,fmt); + va_start(argptr, fmt); mp_raise_msg_vlist(&mp_type_ValueError, fmt, argptr); va_end(argptr); } @@ -1749,7 +1749,7 @@ NORETURN MP_COLD void mp_raise_TypeError(const compressed_string_t *msg) { NORETURN MP_COLD void mp_raise_TypeError_varg(const compressed_string_t *fmt, ...) { va_list argptr; - va_start(argptr,fmt); + va_start(argptr, fmt); mp_raise_msg_vlist(&mp_type_TypeError, fmt, argptr); va_end(argptr); } @@ -1768,7 +1768,7 @@ NORETURN MP_COLD void mp_raise_OSError_errno_str(int errno_, mp_obj_t str) { NORETURN MP_COLD void mp_raise_OSError_msg_varg(const compressed_string_t *fmt, ...) { va_list argptr; - va_start(argptr,fmt); + va_start(argptr, fmt); mp_raise_msg_vlist(&mp_type_OSError, fmt, argptr); va_end(argptr); } @@ -1787,7 +1787,7 @@ NORETURN MP_COLD void mp_raise_NotImplementedError(const compressed_string_t *ms NORETURN MP_COLD void mp_raise_NotImplementedError_varg(const compressed_string_t *fmt, ...) { va_list argptr; - va_start(argptr,fmt); + va_start(argptr, fmt); mp_raise_msg_vlist(&mp_type_NotImplementedError, fmt, argptr); va_end(argptr); } @@ -1795,7 +1795,7 @@ NORETURN MP_COLD void mp_raise_NotImplementedError_varg(const compressed_string_ NORETURN MP_COLD void mp_raise_OverflowError_varg(const compressed_string_t *fmt, ...) { va_list argptr; - va_start(argptr,fmt); + va_start(argptr, fmt); mp_raise_msg_vlist(&mp_type_OverflowError, fmt, argptr); va_end(argptr); } diff --git a/shared-bindings/_bleio/__init__.c b/shared-bindings/_bleio/__init__.c index 1131b52eb9..ab41f8ff6f 100644 --- a/shared-bindings/_bleio/__init__.c +++ b/shared-bindings/_bleio/__init__.c @@ -68,7 +68,7 @@ MP_DEFINE_BLEIO_EXCEPTION(BluetoothError, Exception) NORETURN void mp_raise_bleio_BluetoothError(const compressed_string_t *fmt, ...) { va_list argptr; - va_start(argptr,fmt); + va_start(argptr, fmt); mp_obj_t exception = mp_obj_new_exception_msg_vlist(&mp_type_bleio_BluetoothError, fmt, argptr); va_end(argptr); nlr_raise(exception); @@ -93,7 +93,7 @@ NORETURN void mp_raise_bleio_RoleError(const compressed_string_t *msg) { MP_DEFINE_BLEIO_EXCEPTION(SecurityError, bleio_BluetoothError) NORETURN void mp_raise_bleio_SecurityError(const compressed_string_t *fmt, ...) { va_list argptr; - va_start(argptr,fmt); + va_start(argptr, fmt); mp_obj_t exception = mp_obj_new_exception_msg_vlist(&mp_type_bleio_SecurityError, fmt, argptr); va_end(argptr); nlr_raise(exception); diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index 4529920c6d..f5105b367a 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -102,7 +102,7 @@ STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_ar { MP_QSTR_data_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_sample_rate, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 16000} }, { MP_QSTR_bit_depth, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 8} }, - { MP_QSTR_mono, MP_ARG_KW_ONLY | MP_ARG_BOOL,{.u_bool = true} }, + { MP_QSTR_mono, MP_ARG_KW_ONLY | MP_ARG_BOOL, {.u_bool = true} }, { MP_QSTR_oversample, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 64} }, { MP_QSTR_startup_delay, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, }; diff --git a/shared-bindings/bitbangio/SPI.c b/shared-bindings/bitbangio/SPI.c index dd452fc843..2ec2220bef 100644 --- a/shared-bindings/bitbangio/SPI.c +++ b/shared-bindings/bitbangio/SPI.c @@ -273,7 +273,7 @@ STATIC mp_obj_t bitbangio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, - { MP_QSTR_write_value,MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_write_value, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, }; bitbangio_spi_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); check_for_deinit(self); diff --git a/shared-bindings/busio/SPI.c b/shared-bindings/busio/SPI.c index 42c9d5b63b..9d843a7500 100644 --- a/shared-bindings/busio/SPI.c +++ b/shared-bindings/busio/SPI.c @@ -318,7 +318,7 @@ STATIC mp_obj_t busio_spi_readinto(size_t n_args, const mp_obj_t *pos_args, mp_m { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, { MP_QSTR_end, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = INT_MAX} }, - { MP_QSTR_write_value,MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, + { MP_QSTR_write_value, MP_ARG_KW_ONLY | MP_ARG_INT, {.u_int = 0} }, }; busio_spi_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); check_for_deinit(self); diff --git a/shared-bindings/busio/UART.c b/shared-bindings/busio/UART.c index 009c5cf0f5..314a012d01 100644 --- a/shared-bindings/busio/UART.c +++ b/shared-bindings/busio/UART.c @@ -104,7 +104,7 @@ STATIC void validate_timeout(mp_float_t timeout) { STATIC mp_obj_t busio_uart_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { #if CIRCUITPY_BUSIO_UART enum { ARG_tx, ARG_rx, ARG_baudrate, ARG_bits, ARG_parity, ARG_stop, ARG_timeout, ARG_receiver_buffer_size, - ARG_rts, ARG_cts, ARG_rs485_dir,ARG_rs485_invert}; + ARG_rts, ARG_cts, ARG_rs485_dir, ARG_rs485_invert}; static const mp_arg_t allowed_args[] = { { MP_QSTR_tx, MP_ARG_OBJ, {.u_obj = mp_const_none} }, { MP_QSTR_rx, MP_ARG_OBJ, {.u_obj = mp_const_none} }, diff --git a/shared-bindings/displayio/Bitmap.c b/shared-bindings/displayio/Bitmap.c index 02f0072dfb..7a314f0098 100644 --- a/shared-bindings/displayio/Bitmap.c +++ b/shared-bindings/displayio/Bitmap.c @@ -207,7 +207,7 @@ STATIC mp_obj_t displayio_bitmap_obj_fill(mp_obj_t self_in, mp_obj_t value_obj) displayio_bitmap_t *self = MP_OBJ_TO_PTR(self_in); check_for_deinit(self); - mp_uint_t value = (mp_uint_t)mp_arg_validate_int_range(mp_obj_get_int(value_obj), 0,(1u << common_hal_displayio_bitmap_get_bits_per_value(self)) - 1,MP_QSTR_value); + mp_uint_t value = (mp_uint_t)mp_arg_validate_int_range(mp_obj_get_int(value_obj), 0, (1u << common_hal_displayio_bitmap_get_bits_per_value(self)) - 1, MP_QSTR_value); common_hal_displayio_bitmap_fill(self, value); return mp_const_none; diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c index b24acfd675..0800f4c861 100644 --- a/shared-bindings/displayio/Group.c +++ b/shared-bindings/displayio/Group.c @@ -56,7 +56,7 @@ STATIC mp_obj_t displayio_group_make_new(const mp_obj_type_t *type, size_t n_arg mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - mp_int_t scale = mp_arg_validate_int_range(args[ARG_scale].u_int, 1, 32767,MP_QSTR_scale); + mp_int_t scale = mp_arg_validate_int_range(args[ARG_scale].u_int, 1, 32767, MP_QSTR_scale); displayio_group_t *self = mp_obj_malloc(displayio_group_t, &displayio_group_type); common_hal_displayio_group_construct(self, scale, args[ARG_x].u_int, args[ARG_y].u_int); diff --git a/shared-bindings/memorymonitor/__init__.c b/shared-bindings/memorymonitor/__init__.c index 9ee0d46bf0..b7ed7566a4 100644 --- a/shared-bindings/memorymonitor/__init__.c +++ b/shared-bindings/memorymonitor/__init__.c @@ -45,7 +45,7 @@ MP_DEFINE_MEMORYMONITOR_EXCEPTION(AllocationError, Exception) NORETURN void mp_raise_memorymonitor_AllocationError(const compressed_string_t *fmt, ...) { va_list argptr; - va_start(argptr,fmt); + va_start(argptr, fmt); mp_obj_t exception = mp_obj_new_exception_msg_vlist(&mp_type_memorymonitor_AllocationError, fmt, argptr); va_end(argptr); nlr_raise(exception); diff --git a/shared-bindings/usb/core/Device.c b/shared-bindings/usb/core/Device.c index 7af131cde7..d700ccef86 100644 --- a/shared-bindings/usb/core/Device.c +++ b/shared-bindings/usb/core/Device.c @@ -319,7 +319,7 @@ STATIC const mp_rom_map_elem_t usb_core_device_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_product), MP_ROM_PTR(&usb_core_device_product_obj) }, { MP_ROM_QSTR(MP_QSTR_manufacturer), MP_ROM_PTR(&usb_core_device_manufacturer_obj) }, - { MP_ROM_QSTR(MP_QSTR_set_configuration),MP_ROM_PTR(&usb_core_device_set_configuration_obj) }, + { MP_ROM_QSTR(MP_QSTR_set_configuration), MP_ROM_PTR(&usb_core_device_set_configuration_obj) }, { MP_ROM_QSTR(MP_QSTR_write), MP_ROM_PTR(&usb_core_device_write_obj) }, { MP_ROM_QSTR(MP_QSTR_read), MP_ROM_PTR(&usb_core_device_read_obj) }, { MP_ROM_QSTR(MP_QSTR_ctrl_transfer), MP_ROM_PTR(&usb_core_device_ctrl_transfer_obj) }, diff --git a/shared-bindings/usb/core/__init__.c b/shared-bindings/usb/core/__init__.c index f6631dbc54..ab7e0a2020 100644 --- a/shared-bindings/usb/core/__init__.c +++ b/shared-bindings/usb/core/__init__.c @@ -54,7 +54,7 @@ NORETURN void mp_raise_usb_core_USBError(const compressed_string_t *fmt, ...) { exception = mp_obj_new_exception(&mp_type_usb_core_USBError); } else { va_list argptr; - va_start(argptr,fmt); + va_start(argptr, fmt); exception = mp_obj_new_exception_msg_vlist(&mp_type_usb_core_USBError, fmt, argptr); va_end(argptr); } diff --git a/shared-bindings/usb_hid/Device.h b/shared-bindings/usb_hid/Device.h index dde66e2700..b0df43858f 100644 --- a/shared-bindings/usb_hid/Device.h +++ b/shared-bindings/usb_hid/Device.h @@ -33,7 +33,7 @@ extern const mp_obj_type_t usb_hid_device_type; -void common_hal_usb_hid_device_construct(usb_hid_device_obj_t *self, mp_obj_t report_descriptor, uint16_t usage_page, uint16_t usage, size_t report_ids_count,uint8_t *report_ids, uint8_t *in_report_lengths, uint8_t *out_report_lengths); +void common_hal_usb_hid_device_construct(usb_hid_device_obj_t *self, mp_obj_t report_descriptor, uint16_t usage_page, uint16_t usage, size_t report_ids_count, uint8_t *report_ids, uint8_t *in_report_lengths, uint8_t *out_report_lengths); void common_hal_usb_hid_device_send_report(usb_hid_device_obj_t *self, uint8_t *report, uint8_t len, uint8_t report_id); mp_obj_t common_hal_usb_hid_device_get_last_received_report(usb_hid_device_obj_t *self, uint8_t report_id); uint16_t common_hal_usb_hid_device_get_usage_page(usb_hid_device_obj_t *self); diff --git a/shared-module/aesio/aes.c b/shared-module/aesio/aes.c index f417e76de6..70984a141f 100644 --- a/shared-module/aesio/aes.c +++ b/shared-module/aesio/aes.c @@ -293,7 +293,7 @@ void AES_ctx_set_iv(struct AES_ctx *ctx, const uint8_t *iv) { // This function adds the round key to state. The round key is added to the // state by an XOR function. static void AddRoundKey(uint8_t round, state_t *state, const uint8_t *RoundKey) { - uint8_t i,j; + uint8_t i, j; for (i = 0; i < 4; ++i) { for (j = 0; j < 4; ++j) diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index e6c0a9439d..f1db6bcfa3 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -103,7 +103,7 @@ void common_hal_bitmaptools_rotozoom(displayio_bitmap_t *self, int16_t ox, int16 // # */ - int16_t x,y; + int16_t x, y; int16_t minx = dest_clip1_x; int16_t miny = dest_clip1_y; diff --git a/shared-module/displayio/ColorConverter.c b/shared-module/displayio/ColorConverter.c index 112f7f9ad1..9c81ec27a1 100644 --- a/shared-module/displayio/ColorConverter.c +++ b/shared-module/displayio/ColorConverter.c @@ -263,23 +263,23 @@ uint32_t displayio_colorconverter_convert_pixel(displayio_colorspace_t colorspac void displayio_convert_color(const _displayio_colorspace_t *colorspace, bool dither, const displayio_input_pixel_t *input_pixel, displayio_output_pixel_t *output_color) { uint32_t pixel = input_pixel->pixel; if (dither) { - uint8_t randr = (displayio_colorconverter_dither_noise_2(input_pixel->tile_x,input_pixel->tile_y)); - uint8_t randg = (displayio_colorconverter_dither_noise_2(input_pixel->tile_x + 33,input_pixel->tile_y)); - uint8_t randb = (displayio_colorconverter_dither_noise_2(input_pixel->tile_x,input_pixel->tile_y + 33)); + uint8_t randr = (displayio_colorconverter_dither_noise_2(input_pixel->tile_x, input_pixel->tile_y)); + uint8_t randg = (displayio_colorconverter_dither_noise_2(input_pixel->tile_x + 33, input_pixel->tile_y)); + uint8_t randb = (displayio_colorconverter_dither_noise_2(input_pixel->tile_x, input_pixel->tile_y + 33)); uint32_t r8 = (pixel >> 16); uint32_t g8 = (pixel >> 8) & 0xff; uint32_t b8 = pixel & 0xff; if (colorspace->depth == 16) { - b8 = MIN(255,b8 + (randb & 0x07)); - r8 = MIN(255,r8 + (randr & 0x07)); - g8 = MIN(255,g8 + (randg & 0x03)); + b8 = MIN(255, b8 + (randb & 0x07)); + r8 = MIN(255, r8 + (randr & 0x07)); + g8 = MIN(255, g8 + (randg & 0x03)); } else { int bitmask = 0xFF >> colorspace->depth; - b8 = MIN(255,b8 + (randb & bitmask)); - r8 = MIN(255,r8 + (randr & bitmask)); - g8 = MIN(255,g8 + (randg & bitmask)); + b8 = MIN(255, b8 + (randb & bitmask)); + r8 = MIN(255, r8 + (randr & bitmask)); + g8 = MIN(255, g8 + (randg & bitmask)); } pixel = r8 << 16 | g8 << 8 | b8; } diff --git a/shared-module/displayio/display_core.c b/shared-module/displayio/display_core.c index 8e6d51084e..2af9b19fdb 100644 --- a/shared-module/displayio/display_core.c +++ b/shared-module/displayio/display_core.c @@ -378,7 +378,7 @@ void displayio_display_core_collect_ptrs(displayio_display_core_t *self) { bool displayio_display_core_fill_area(displayio_display_core_t *self, displayio_area_t *area, uint32_t *mask, uint32_t *buffer) { if (self->current_group != NULL) { - return displayio_group_fill_area(self->current_group,&self->colorspace, area, mask, buffer); + return displayio_group_fill_area(self->current_group, &self->colorspace, area, mask, buffer); } return false; } diff --git a/shared-module/os/getenv.c b/shared-module/os/getenv.c index 76cbf48dae..7b102fd3e5 100644 --- a/shared-module/os/getenv.c +++ b/shared-module/os/getenv.c @@ -316,7 +316,7 @@ STATIC os_getenv_err_t os_getenv_buf_terminated(const char *key, char *value, si STATIC void print_dont_raise(const mp_obj_type_t *exc_type, const compressed_string_t *fmt, ...) { va_list argptr; - va_start(argptr,fmt); + va_start(argptr, fmt); mp_vcprintf(&mp_plat_print, fmt, argptr); mp_printf(&mp_plat_print, "\n"); va_end(argptr); diff --git a/shared-module/qrio/quirc_alloc.h b/shared-module/qrio/quirc_alloc.h index 7521fc087d..a669dcea31 100644 --- a/shared-module/qrio/quirc_alloc.h +++ b/shared-module/qrio/quirc_alloc.h @@ -8,7 +8,7 @@ #endif #define QUIRC_MALLOC(x) m_malloc((x)) -#define QUIRC_CALLOC(x,y) m_malloc((x) * (y)) +#define QUIRC_CALLOC(x, y) m_malloc((x) * (y)) #define QUIRC_FREE(x) gc_free((x)) #define QUIRC_SMALL_STACK (1) diff --git a/shared-module/synthio/Math.c b/shared-module/synthio/Math.c index f1a67d29b5..c975dfbf06 100644 --- a/shared-module/synthio/Math.c +++ b/shared-module/synthio/Math.c @@ -112,9 +112,9 @@ mp_float_t common_hal_synthio_math_tick(mp_obj_t self_in) { } return c; case OP_MIN: - return MIN(a,MIN(b,c)); + return MIN(a, MIN(b, c)); case OP_MAX: - return MAX(a,MAX(b,c)); + return MAX(a, MAX(b, c)); case OP_ABS: break; } diff --git a/shared-module/synthio/__init__.c b/shared-module/synthio/__init__.c index f60676b2cd..c4f5b2f9b8 100644 --- a/shared-module/synthio/__init__.c +++ b/shared-module/synthio/__init__.c @@ -328,7 +328,7 @@ void synthio_synth_synthesize(synthio_synth_t *synth, uint8_t **bufptr, uint32_t continue; } - uint16_t loudness[2] = {synth->envelope_state[chan].level,synth->envelope_state[chan].level}; + uint16_t loudness[2] = {synth->envelope_state[chan].level, synth->envelope_state[chan].level}; if (!synth_note_into_buffer(synth, chan, tmp_buffer32, dur, loudness)) { // for some other reason, such as being above nyquist, note diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c index 4f00207b7f..0717bfc6a8 100644 --- a/shared/runtime/pyexec.c +++ b/shared/runtime/pyexec.c @@ -87,7 +87,7 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input mp_obj_t module_fun; #if CIRCUITPY_ATEXIT if (!(exec_flags & EXEC_FLAG_SOURCE_IS_ATEXIT)) - #endif + #endif { #if MICROPY_MODULE_FROZEN_MPY if (exec_flags & EXEC_FLAG_SOURCE_IS_RAW_CODE) { @@ -95,7 +95,7 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input const mp_frozen_module_t *frozen = source; mp_module_context_t *ctx = m_new_obj(mp_module_context_t); ctx->module.globals = mp_globals_get(); - ctx->constants = frozen->constants; + ctx->constants = frozen->constants; module_fun = mp_make_function_from_raw_code(frozen->rc, ctx, NULL); } else #endif diff --git a/supervisor/linker.h b/supervisor/linker.h index 2d88812da4..2106e167cf 100644 --- a/supervisor/linker.h +++ b/supervisor/linker.h @@ -33,7 +33,7 @@ #define PLACE_IN_DTCM_DATA(name) name __attribute__((section(".dtcm_data." #name))) #define PLACE_IN_DTCM_BSS(name) name __attribute__((section(".dtcm_bss." #name))) // Don't inline ITCM functions because that may pull them out of ITCM into other sections. -#define PLACE_IN_ITCM(name) __attribute__((section(".itcm." #name),noinline,aligned(4))) name +#define PLACE_IN_ITCM(name) __attribute__((section(".itcm." #name), noinline, aligned(4))) name #else #define PLACE_IN_DTCM_DATA(name) name #define PLACE_IN_DTCM_BSS(name) name diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index ce7d78c42c..93069b2717 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -214,7 +214,7 @@ mp_obj_list_t splash_children = { .items = members, }; #else -mp_obj_t members[] = { &supervisor_terminal_scroll_area_text_grid, &supervisor_terminal_status_bar_text_grid,}; +mp_obj_t members[] = { &supervisor_terminal_scroll_area_text_grid, &supervisor_terminal_status_bar_text_grid, }; mp_obj_list_t splash_children = { .base = {.type = &mp_type_list }, .alloc = 2, diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index 0ab97fc9a9..134952ca7f 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -127,7 +127,7 @@ void PLACE_IN_ITCM(safe_mode_on_next_reset)(safe_mode_t reason) { } // Don't inline this so it's easy to break on it from GDB. -void __attribute__((noinline,)) PLACE_IN_ITCM(reset_into_safe_mode)(safe_mode_t reason) { +void __attribute__((noinline, )) PLACE_IN_ITCM(reset_into_safe_mode)(safe_mode_t reason) { if (_safe_mode > SAFE_MODE_BROWNOUT && reason > SAFE_MODE_BROWNOUT) { while (true) { // This very bad because it means running in safe mode didn't save us. Only ignore brownout diff --git a/tools/ci.sh b/tools/ci.sh index f92db66d70..72e779c499 100755 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -35,7 +35,7 @@ function ci_code_formatting_run { function ci_commit_formatting_run { git remote add upstream https://github.com/micropython/micropython.git git fetch --depth=100 upstream master - # For a PR, upstream/master..HEAD ends with a merge commit into master, exlude that one. + # For a PR, upstream/master..HEAD ends with a merge commit into master, exclude that one. tools/verifygitlog.py -v upstream/master..HEAD --no-merges } diff --git a/tools/codeformat.py b/tools/codeformat.py index c4150d863d..f76e5f0681 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -197,7 +197,8 @@ def main(): cmd_parser.add_argument("-c", action="store_true", help="Format C code only") cmd_parser.add_argument("-p", action="store_true", help="Format Python code only") cmd_parser.add_argument("-v", action="store_true", help="Enable verbose output") - cmd_parser.add_argument("files", nargs="*", help="Run on specific globs") + cmd_parser.add_argument("--dry-run", action="store_true", help="Print, don't act") + cmd_parser.add_argument("files", nargs="+", help="Run on specific globs") args = cmd_parser.parse_args() if args.dry_run: @@ -216,6 +217,11 @@ def main(): if os.path.splitext(file)[1].lower() in exts: yield file + def bindings_files(): + for file in lang_files(C_EXTS): + if file.startswith("shared-bindings/") or "/bindings/" in file: + yield file + # Run tool on N files at a time (to avoid making the command line too long). def batch(cmd, files, N=200, check=False): while True: From 8cf5b6e707a550903c2a25397dab1a229e3d4670 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Aug 2023 09:51:52 -0400 Subject: [PATCH 1476/1712] fixes to unix port support; thanks @jepler --- ports/unix/coverage.c | 56 +++++++++++++++------------- py/obj.h | 10 +++++ shared-bindings/traceback/__init__.c | 2 + 3 files changed, 43 insertions(+), 25 deletions(-) diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c index 188fa5e937..06cb84b0e2 100644 --- a/ports/unix/coverage.c +++ b/ports/unix/coverage.c @@ -108,8 +108,11 @@ STATIC const mp_stream_p_t fileio_stream_p = { STATIC const mp_obj_type_t mp_type_stest_fileio = { { &mp_type_type }, - .protocol = &fileio_stream_p, + .flags = MP_TYPE_FLAG_EXTENDED, .locals_dict = (mp_obj_dict_t *)&rawfile_locals_dict, + MP_TYPE_EXTENDED_FIELDS( + .protocol = &fileio_stream_p, + ), }; // stream read returns non-blocking error @@ -128,6 +131,7 @@ STATIC const mp_rom_map_elem_t rawfile_locals_dict_table2[] = { STATIC MP_DEFINE_CONST_DICT(rawfile_locals_dict2, rawfile_locals_dict_table2); STATIC const mp_stream_p_t textio_stream_p2 = { + MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream) .read = stest_read2, .write = NULL, .is_text = true, @@ -135,8 +139,11 @@ STATIC const mp_stream_p_t textio_stream_p2 = { STATIC const mp_obj_type_t mp_type_stest_textio2 = { { &mp_type_type }, - .protocol = &textio_stream_p2, + .flags = MP_TYPE_FLAG_EXTENDED, .locals_dict = (mp_obj_dict_t *)&rawfile_locals_dict2, + MP_TYPE_EXTENDED_FIELDS( + .protocol = &textio_stream_p2, + ), }; // str/bytes objects without a valid hash @@ -571,47 +578,49 @@ STATIC mp_obj_t extra_coverage(void) { // ringbuf { - byte buf[100]; - ringbuf_t ringbuf = {buf, sizeof(buf), 0, 0}; + #define RINGBUF_SIZE 99 + + byte buf[RINGBUF_SIZE]; + ringbuf_t ringbuf; + ringbuf_init(&ringbuf, &buf[0], sizeof(buf)); mp_printf(&mp_plat_print, "# ringbuf\n"); // Single-byte put/get with empty ringbuf. - mp_printf(&mp_plat_print, "%d %d\n", ringbuf_free(&ringbuf), ringbuf_avail(&ringbuf)); + mp_printf(&mp_plat_print, "%d %d\n", ringbuf_num_empty(&ringbuf), ringbuf_num_filled(&ringbuf)); ringbuf_put(&ringbuf, 22); - mp_printf(&mp_plat_print, "%d %d\n", ringbuf_free(&ringbuf), ringbuf_avail(&ringbuf)); + mp_printf(&mp_plat_print, "%d %d\n", ringbuf_num_empty(&ringbuf), ringbuf_num_filled(&ringbuf)); mp_printf(&mp_plat_print, "%d\n", ringbuf_get(&ringbuf)); - mp_printf(&mp_plat_print, "%d %d\n", ringbuf_free(&ringbuf), ringbuf_avail(&ringbuf)); + mp_printf(&mp_plat_print, "%d %d\n", ringbuf_num_empty(&ringbuf), ringbuf_num_filled(&ringbuf)); // Two-byte put/get with empty ringbuf. ringbuf_put16(&ringbuf, 0xaa55); - mp_printf(&mp_plat_print, "%d %d\n", ringbuf_free(&ringbuf), ringbuf_avail(&ringbuf)); + mp_printf(&mp_plat_print, "%d %d\n", ringbuf_num_empty(&ringbuf), ringbuf_num_filled(&ringbuf)); mp_printf(&mp_plat_print, "%04x\n", ringbuf_get16(&ringbuf)); - mp_printf(&mp_plat_print, "%d %d\n", ringbuf_free(&ringbuf), ringbuf_avail(&ringbuf)); + mp_printf(&mp_plat_print, "%d %d\n", ringbuf_num_empty(&ringbuf), ringbuf_num_filled(&ringbuf)); // Two-byte put with full ringbuf. - for (int i = 0; i < 99; ++i) { + for (int i = 0; i < RINGBUF_SIZE; ++i) { ringbuf_put(&ringbuf, i); } - mp_printf(&mp_plat_print, "%d %d\n", ringbuf_free(&ringbuf), ringbuf_avail(&ringbuf)); + mp_printf(&mp_plat_print, "%d %d\n", ringbuf_num_empty(&ringbuf), ringbuf_num_filled(&ringbuf)); mp_printf(&mp_plat_print, "%d\n", ringbuf_put16(&ringbuf, 0x11bb)); // Two-byte put with one byte free. ringbuf_get(&ringbuf); - mp_printf(&mp_plat_print, "%d %d\n", ringbuf_free(&ringbuf), ringbuf_avail(&ringbuf)); + mp_printf(&mp_plat_print, "%d %d\n", ringbuf_num_empty(&ringbuf), ringbuf_num_filled(&ringbuf)); mp_printf(&mp_plat_print, "%d\n", ringbuf_put16(&ringbuf, 0x3377)); ringbuf_get(&ringbuf); - mp_printf(&mp_plat_print, "%d %d\n", ringbuf_free(&ringbuf), ringbuf_avail(&ringbuf)); + mp_printf(&mp_plat_print, "%d %d\n", ringbuf_num_empty(&ringbuf), ringbuf_num_filled(&ringbuf)); mp_printf(&mp_plat_print, "%d\n", ringbuf_put16(&ringbuf, 0xcc99)); - for (int i = 0; i < 97; ++i) { + for (int i = 0; i < RINGBUF_SIZE - 2; ++i) { ringbuf_get(&ringbuf); } mp_printf(&mp_plat_print, "%04x\n", ringbuf_get16(&ringbuf)); - mp_printf(&mp_plat_print, "%d %d\n", ringbuf_free(&ringbuf), ringbuf_avail(&ringbuf)); + mp_printf(&mp_plat_print, "%d %d\n", ringbuf_num_empty(&ringbuf), ringbuf_num_filled(&ringbuf)); // Two-byte put with wrap around on first byte: - ringbuf.iput = 0; - ringbuf.iget = 0; - for (int i = 0; i < 99; ++i) { + ringbuf_clear(&ringbuf); + for (int i = 0; i < RINGBUF_SIZE; ++i) { ringbuf_put(&ringbuf, i); ringbuf_get(&ringbuf); } @@ -619,9 +628,8 @@ STATIC mp_obj_t extra_coverage(void) { mp_printf(&mp_plat_print, "%04x\n", ringbuf_get16(&ringbuf)); // Two-byte put with wrap around on second byte: - ringbuf.iput = 0; - ringbuf.iget = 0; - for (int i = 0; i < 98; ++i) { + ringbuf_clear(&ringbuf); + for (int i = 0; i < RINGBUF_SIZE - 1; ++i) { ringbuf_put(&ringbuf, i); ringbuf_get(&ringbuf); } @@ -629,13 +637,11 @@ STATIC mp_obj_t extra_coverage(void) { mp_printf(&mp_plat_print, "%04x\n", ringbuf_get16(&ringbuf)); // Two-byte get from empty ringbuf. - ringbuf.iput = 0; - ringbuf.iget = 0; + ringbuf_clear(&ringbuf); mp_printf(&mp_plat_print, "%d\n", ringbuf_get16(&ringbuf)); // Two-byte get from ringbuf with one byte available. - ringbuf.iput = 0; - ringbuf.iget = 0; + ringbuf_clear(&ringbuf); ringbuf_put(&ringbuf, 0xaa); mp_printf(&mp_plat_print, "%d\n", ringbuf_get16(&ringbuf)); } diff --git a/py/obj.h b/py/obj.h index d733138bb0..81b0eab06c 100644 --- a/py/obj.h +++ b/py/obj.h @@ -107,8 +107,18 @@ static MP_INLINE bool mp_obj_is_immediate_obj(mp_const_obj_t o) { #if MICROPY_PY_BUILTINS_FLOAT #define mp_const_float_e MP_ROM_PTR(&mp_const_float_e_obj) #define mp_const_float_pi MP_ROM_PTR(&mp_const_float_pi_obj) +#if MICROPY_PY_MATH_CONSTANTS +#define mp_const_float_tau MP_ROM_PTR(&mp_const_float_tau_obj) +#define mp_const_float_inf MP_ROM_PTR(&mp_const_float_inf_obj) +#define mp_const_float_nan MP_ROM_PTR(&mp_const_float_nan_obj) +#endif extern const struct _mp_obj_float_t mp_const_float_e_obj; extern const struct _mp_obj_float_t mp_const_float_pi_obj; +#if MICROPY_PY_MATH_CONSTANTS +extern const struct _mp_obj_float_t mp_const_float_tau_obj; +extern const struct _mp_obj_float_t mp_const_float_inf_obj; +extern const struct _mp_obj_float_t mp_const_float_nan_obj; +#endif #define mp_obj_is_float(o) mp_obj_is_type((o), &mp_type_float) mp_float_t mp_obj_float_get(mp_obj_t self_in); diff --git a/shared-bindings/traceback/__init__.c b/shared-bindings/traceback/__init__.c index df1d605524..ca34161842 100644 --- a/shared-bindings/traceback/__init__.c +++ b/shared-bindings/traceback/__init__.c @@ -59,7 +59,9 @@ STATIC void traceback_exception_common(bool is_print_exception, mp_print_t *prin } mp_obj_t tb_obj = args[ARG_tb].u_obj; mp_obj_t limit_obj = args[ARG_limit].u_obj; + #if MICROPY_CPYTHON_EXCEPTION_CHAIN bool chain = args[ARG_chain].u_bool; + #endif if (args[ARG_file].u_obj != mp_const_none) { if (!is_print_exception) { From c823b9b2f6de49fa28b39bff5262f16f8c7c9f7d Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Aug 2023 11:28:13 -0400 Subject: [PATCH 1477/1712] force mpversion.h build early in silabs --- ports/silabs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/silabs/Makefile b/ports/silabs/Makefile index 8fd43067f1..71092afcbf 100644 --- a/ports/silabs/Makefile +++ b/ports/silabs/Makefile @@ -138,7 +138,7 @@ $(OUTPUT_DIR)/firmware.bin: $(SILABS_BUILD)/$(PROJECTNAME).Makefile $(OUTPUT_DIR @echo 'Done.' endif -$(SILABS_BUILD)/$(PROJECTNAME).Makefile: +$(SILABS_BUILD)/$(PROJECTNAME).Makefile: | $(HEADER_BUILD)/mpversion.h +@$(MAKE) --no-print-directory slc-generate $(OUTPUT_DIR)/firmware.out: $(SILABS_BUILD)/pin_functions.h $(SILABS_BUILD)/pins.c $(OBJ) $(OBJS) $(LIB_FILES) From 2f81f36c415e191bb50a498527b7604c537c97dd Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Aug 2023 11:37:41 -0400 Subject: [PATCH 1478/1712] fix windows mpy-cross builds; tnx @jepler --- extmod/moduasyncio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extmod/moduasyncio.c b/extmod/moduasyncio.c index 014de0db27..ea81fbc310 100644 --- a/extmod/moduasyncio.c +++ b/extmod/moduasyncio.c @@ -29,14 +29,14 @@ #include "py/pairheap.h" #include "py/mphal.h" +#if MICROPY_PY_UASYNCIO + #if CIRCUITPY && !(defined(__unix__) || defined(__APPLE__)) #include "shared-bindings/supervisor/__init__.h" #endif #include "supervisor/shared/translate/translate.h" -#if MICROPY_PY_UASYNCIO - // Used when task cannot be guaranteed to be non-NULL. #define TASK_PAIRHEAP(task) ((task) ? &(task)->pairheap : NULL) From 4a579f7242935b9fac5b6f56c93d5ed3c01c9098 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Aug 2023 12:34:00 -0400 Subject: [PATCH 1479/1712] fix doc build; reorganize placement of library docs --- conf.py | 2 +- docs/index.rst | 8 +- docs/library/binascii.rst | 2 +- docs/library/btree.rst | 161 ------------------------------------ docs/library/framebuf.rst | 170 -------------------------------------- docs/library/index.rst | 30 ++++--- 6 files changed, 26 insertions(+), 347 deletions(-) delete mode 100644 docs/library/btree.rst delete mode 100644 docs/library/framebuf.rst diff --git a/conf.py b/conf.py index 645961c457..29cf7981fc 100644 --- a/conf.py +++ b/conf.py @@ -441,7 +441,7 @@ texinfo_documents = [ # Example configuration for intersphinx: refer to the Python standard library. -intersphinx_mapping = {"cpython": ('https://docs.python.org/3/', None), +intersphinx_mapping = {"python": ('https://docs.python.org/3/', None), "register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None), "typing": ('https://circuitpython.readthedocs.io/projects/adafruit-circuitpython-typing/en/latest/', None)} diff --git a/docs/index.rst b/docs/index.rst index e49b74b4e3..ba40d18ec4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -19,6 +19,7 @@ Full Table of Contents :caption: API and Usage ../shared-bindings/index.rst + library/index.rst supported_ports.rst troubleshooting.rst libraries.rst @@ -32,13 +33,12 @@ Full Table of Contents design_guide porting common_hal + reference/mpyfiles.rst + reference/glossary.rst .. toctree:: :maxdepth: 2 - :caption: MicroPython specific - - library/index.rst - reference/glossary.rst + :caption: Python stand .. toctree:: :maxdepth: 1 diff --git a/docs/library/binascii.rst b/docs/library/binascii.rst index 296a4e9d85..1eba46652d 100644 --- a/docs/library/binascii.rst +++ b/docs/library/binascii.rst @@ -35,7 +35,7 @@ Functions Encode binary data in base64 format, as in `RFC 3548 `_. Returns the encoded data - followed by a newline character if ``newline``is true, as a bytes object. + followed by a newline character if ``newline`` is true, as a bytes object. .. function:: crc32(data, value=0, /) diff --git a/docs/library/btree.rst b/docs/library/btree.rst deleted file mode 100644 index 3d58abae6c..0000000000 --- a/docs/library/btree.rst +++ /dev/null @@ -1,161 +0,0 @@ -:mod:`btree` -- simple BTree database -===================================== - -.. include:: ../templates/unsupported_in_circuitpython.inc - -.. module:: btree - :synopsis: simple BTree database - -The ``btree`` module implements a simple key-value database using external -storage (disk files, or in general case, a random-access `stream`). Keys are -stored sorted in the database, and besides efficient retrieval by a key -value, a database also supports efficient ordered range scans (retrieval -of values with the keys in a given range). On the application interface -side, BTree database work as close a possible to a way standard `dict` -type works, one notable difference is that both keys and values must -be `bytes` objects (so, if you want to store objects of other types, you -need to serialize them to `bytes` first). - -The module is based on the well-known BerkelyDB library, version 1.xx. - -Example:: - - import btree - - # First, we need to open a stream which holds a database - # This is usually a file, but can be in-memory database - # using io.BytesIO, a raw flash partition, etc. - # Oftentimes, you want to create a database file if it doesn't - # exist and open if it exists. Idiom below takes care of this. - # DO NOT open database with "a+b" access mode. - try: - f = open("mydb", "r+b") - except OSError: - f = open("mydb", "w+b") - - # Now open a database itself - db = btree.open(f) - - # The keys you add will be sorted internally in the database - db[b"3"] = b"three" - db[b"1"] = b"one" - db[b"2"] = b"two" - - # Assume that any changes are cached in memory unless - # explicitly flushed (or database closed). Flush database - # at the end of each "transaction". - db.flush() - - # Prints b'two' - print(db[b"2"]) - - # Iterate over sorted keys in the database, starting from b"2" - # until the end of the database, returning only values. - # Mind that arguments passed to values() method are *key* values. - # Prints: - # b'two' - # b'three' - for word in db.values(b"2"): - print(word) - - del db[b"2"] - - # No longer true, prints False - print(b"2" in db) - - # Prints: - # b"1" - # b"3" - for key in db: - print(key) - - db.close() - - # Don't forget to close the underlying stream! - f.close() - - -Functions ---------- - -.. function:: open(stream, *, flags=0, pagesize=0, cachesize=0, minkeypage=0) - - Open a database from a random-access `stream` (like an open file). All - other parameters are optional and keyword-only, and allow to tweak advanced - parameters of the database operation (most users will not need them): - - * *flags* - Currently unused. - * *pagesize* - Page size used for the nodes in BTree. Acceptable range - is 512-65536. If 0, a port-specific default will be used, optimized for - port's memory usage and/or performance. - * *cachesize* - Suggested memory cache size in bytes. For a - board with enough memory using larger values may improve performance. - Cache policy is as follows: entire cache is not allocated at once; - instead, accessing a new page in database will allocate a memory buffer - for it, until value specified by *cachesize* is reached. Then, these - buffers will be managed using LRU (least recently used) policy. More - buffers may still be allocated if needed (e.g., if a database contains - big keys and/or values). Allocated cache buffers aren't reclaimed. - * *minkeypage* - Minimum number of keys to store per page. Default value - of 0 equivalent to 2. - - Returns a BTree object, which implements a dictionary protocol (set - of methods), and some additional methods described below. - -Methods -------- - -.. method:: btree.close() - - Close the database. It's mandatory to close the database at the end of - processing, as some unwritten data may be still in the cache. Note that - this does not close underlying stream with which the database was opened, - it should be closed separately (which is also mandatory to make sure that - data flushed from buffer to the underlying storage). - -.. method:: btree.flush() - - Flush any data in cache to the underlying stream. - -.. method:: btree.__getitem__(key) - btree.get(key, default=None, /) - btree.__setitem__(key, val) - btree.__delitem__(key) - btree.__contains__(key) - - Standard dictionary methods. - -.. method:: btree.__iter__() - - A BTree object can be iterated over directly (similar to a dictionary) - to get access to all keys in order. - -.. method:: btree.keys([start_key, [end_key, [flags]]]) - btree.values([start_key, [end_key, [flags]]]) - btree.items([start_key, [end_key, [flags]]]) - - These methods are similar to standard dictionary methods, but also can - take optional parameters to iterate over a key sub-range, instead of - the entire database. Note that for all 3 methods, *start_key* and - *end_key* arguments represent key values. For example, `values()` - method will iterate over values corresponding to they key range - given. None values for *start_key* means "from the first key", no - *end_key* or its value of None means "until the end of database". - By default, range is inclusive of *start_key* and exclusive of - *end_key*, you can include *end_key* in iteration by passing *flags* - of `btree.INCL`. You can iterate in descending key direction - by passing *flags* of `btree.DESC`. The flags values can be ORed - together. - -Constants ---------- - -.. data:: INCL - - A flag for `keys()`, `values()`, `items()` methods to specify that - scanning should be inclusive of the end key. - -.. data:: DESC - - A flag for `keys()`, `values()`, `items()` methods to specify that - scanning should be in descending direction of keys. diff --git a/docs/library/framebuf.rst b/docs/library/framebuf.rst deleted file mode 100644 index 421066b82d..0000000000 --- a/docs/library/framebuf.rst +++ /dev/null @@ -1,170 +0,0 @@ -:mod:`framebuf` --- frame buffer manipulation -============================================= - -.. include:: ../templates/unsupported_in_circuitpython.inc - -.. module:: framebuf - :synopsis: Frame buffer manipulation - -This module provides a general frame buffer which can be used to create -bitmap images, which can then be sent to a display. - -class FrameBuffer ------------------ - -The FrameBuffer class provides a pixel buffer which can be drawn upon with -pixels, lines, rectangles, text and even other FrameBuffer's. It is useful -when generating output for displays. - -For example:: - - import framebuf - - # FrameBuffer needs 2 bytes for every RGB565 pixel - fbuf = framebuf.FrameBuffer(bytearray(100 * 10 * 2), 100, 10, framebuf.RGB565) - - fbuf.fill(0) - fbuf.text('MicroPython!', 0, 0, 0xffff) - fbuf.hline(0, 9, 96, 0xffff) - -Constructors ------------- - -.. class:: FrameBuffer(buffer, width, height, format, stride=width, /) - - Construct a FrameBuffer object. The parameters are: - - - *buffer* is an object with a buffer protocol which must be large - enough to contain every pixel defined by the width, height and - format of the FrameBuffer. - - *width* is the width of the FrameBuffer in pixels - - *height* is the height of the FrameBuffer in pixels - - *format* specifies the type of pixel used in the FrameBuffer; - permissible values are listed under Constants below. These set the - number of bits used to encode a color value and the layout of these - bits in *buffer*. - Where a color value c is passed to a method, c is a small integer - with an encoding that is dependent on the format of the FrameBuffer. - - *stride* is the number of pixels between each horizontal line - of pixels in the FrameBuffer. This defaults to *width* but may - need adjustments when implementing a FrameBuffer within another - larger FrameBuffer or screen. The *buffer* size must accommodate - an increased step size. - - One must specify valid *buffer*, *width*, *height*, *format* and - optionally *stride*. Invalid *buffer* size or dimensions may lead to - unexpected errors. - -Drawing primitive shapes ------------------------- - -The following methods draw shapes onto the FrameBuffer. - -.. method:: FrameBuffer.fill(c) - - Fill the entire FrameBuffer with the specified color. - -.. method:: FrameBuffer.pixel(x, y[, c]) - - If *c* is not given, get the color value of the specified pixel. - If *c* is given, set the specified pixel to the given color. - -.. method:: FrameBuffer.hline(x, y, w, c) -.. method:: FrameBuffer.vline(x, y, h, c) -.. method:: FrameBuffer.line(x1, y1, x2, y2, c) - - Draw a line from a set of coordinates using the given color and - a thickness of 1 pixel. The `line` method draws the line up to - a second set of coordinates whereas the `hline` and `vline` - methods draw horizontal and vertical lines respectively up to - a given length. - -.. method:: FrameBuffer.rect(x, y, w, h, c) -.. method:: FrameBuffer.fill_rect(x, y, w, h, c) - - Draw a rectangle at the given location, size and color. The `rect` - method draws only a 1 pixel outline whereas the `fill_rect` method - draws both the outline and interior. - -Drawing text ------------- - -.. method:: FrameBuffer.text(s, x, y[, c]) - - Write text to the FrameBuffer using the the coordinates as the upper-left - corner of the text. The color of the text can be defined by the optional - argument but is otherwise a default value of 1. All characters have - dimensions of 8x8 pixels and there is currently no way to change the font. - - -Other methods -------------- - -.. method:: FrameBuffer.scroll(xstep, ystep) - - Shift the contents of the FrameBuffer by the given vector. This may - leave a footprint of the previous colors in the FrameBuffer. - -.. method:: FrameBuffer.blit(fbuf, x, y, key=-1, palette=None) - - Draw another FrameBuffer on top of the current one at the given coordinates. - If *key* is specified then it should be a color integer and the - corresponding color will be considered transparent: all pixels with that - color value will not be drawn. - - The *palette* argument enables blitting between FrameBuffers with differing - formats. Typical usage is to render a monochrome or grayscale glyph/icon to - a color display. The *palette* is a FrameBuffer instance whose format is - that of the current FrameBuffer. The *palette* height is one pixel and its - pixel width is the number of colors in the source FrameBuffer. The *palette* - for an N-bit source needs 2**N pixels; the *palette* for a monochrome source - would have 2 pixels representing background and foreground colors. The - application assigns a color to each pixel in the *palette*. The color of the - current pixel will be that of that *palette* pixel whose x position is the - color of the corresponding source pixel. - -Constants ---------- - -.. data:: framebuf.MONO_VLSB - - Monochrome (1-bit) color format - This defines a mapping where the bits in a byte are vertically mapped with - bit 0 being nearest the top of the screen. Consequently each byte occupies - 8 vertical pixels. Subsequent bytes appear at successive horizontal - locations until the rightmost edge is reached. Further bytes are rendered - at locations starting at the leftmost edge, 8 pixels lower. - -.. data:: framebuf.MONO_HLSB - - Monochrome (1-bit) color format - This defines a mapping where the bits in a byte are horizontally mapped. - Each byte occupies 8 horizontal pixels with bit 7 being the leftmost. - Subsequent bytes appear at successive horizontal locations until the - rightmost edge is reached. Further bytes are rendered on the next row, one - pixel lower. - -.. data:: framebuf.MONO_HMSB - - Monochrome (1-bit) color format - This defines a mapping where the bits in a byte are horizontally mapped. - Each byte occupies 8 horizontal pixels with bit 0 being the leftmost. - Subsequent bytes appear at successive horizontal locations until the - rightmost edge is reached. Further bytes are rendered on the next row, one - pixel lower. - -.. data:: framebuf.RGB565 - - Red Green Blue (16-bit, 5+6+5) color format - -.. data:: framebuf.GS2_HMSB - - Grayscale (2-bit) color format - -.. data:: framebuf.GS4_HMSB - - Grayscale (4-bit) color format - -.. data:: framebuf.GS8 - - Grayscale (8-bit) color format diff --git a/docs/library/index.rst b/docs/library/index.rst index 48b87a7721..7fda1abd60 100644 --- a/docs/library/index.rst +++ b/docs/library/index.rst @@ -1,15 +1,13 @@ .. _micropython_lib: -MicroPython libraries -===================== +Standard Libraries +================== -Python standard libraries and micro-libraries ---------------------------------------------- +Python standard libraries +------------------------- -The libraries below are inherited from MicroPython. -They are similar to the standard Python libraries with the same name. -They implement a subset of or a variant of the corresponding -standard Python library. +The libraries below implement a subset of the corresponding +standard Python (CPython) library. They are implemented in C, not Python. CircuitPython's long-term goal is that code written in CircuitPython using Python standard libraries will be runnable on CPython without changes. @@ -38,10 +36,22 @@ These libraries are not currently enabled in any CircuitPython build, but may be ctypes.rst select.rst -Omitted functions in the ``string`` library -------------------------------------------- +Omitted ``string`` functions +---------------------------- A few string operations are not enabled on small builds due to limited flash memory: ``string.center()``, ``string.partition()``, ``string.splitlines()``, ``string.reversed()``. + + +CircuitPython/MicroPython-specific libraries +-------------------------------------------- + +Functionality specific to the CircuitPython/MicroPython implementations is available in +the following libraries. + +.. toctree:: + :maxdepth: 1 + + micropython.rst From b73f05fe641fa5a5de2e74c92623dd924a933763 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Aug 2023 16:43:07 -0400 Subject: [PATCH 1480/1712] turn off viper tests; thanks jepler --- ports/unix/mpconfigport.h | 10 ---------- py/objgenerator.c | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h index 9007a70afe..bcf5ffe5a0 100644 --- a/ports/unix/mpconfigport.h +++ b/ports/unix/mpconfigport.h @@ -108,16 +108,6 @@ #define MICROPY_ALLOC_PATH_MAX (PATH_MAX) #define MICROPY_PERSISTENT_CODE_LOAD (1) -// CIRCUITPY: native emitters not supported -#define MICROPY_EMIT_X64 (!CIRCUITPY) -#define MICROPY_EMIT_X86 (!CIRCUITPY) -#define MICROPY_EMIT_THUMB (!CIRCUITPY) -#define MICROPY_EMIT_INLINE_THUMB (!CIRCUITPY) -#define MICROPY_EMIT_ARM (!CIRCUITPY) -#define MICROPY_EMIT_XTENSA (!CIRCUITPY) -#define MICROPY_EMIT_INLINE_XTENSA (!CIRCUITPY) -#define MICROPY_EMIT_XTENSAWIN (!CIRCUITPY) - #if !defined(MICROPY_EMIT_X64) && defined(__x86_64__) #define MICROPY_EMIT_X64 (1) #endif diff --git a/py/objgenerator.c b/py/objgenerator.c index fce2c0bac7..32f4af43c7 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -151,10 +151,10 @@ const mp_obj_type_t mp_type_native_gen_wrap = { .flags = MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_EXTENDED, .name = MP_QSTR_generator, #if MICROPY_PY_FUNCTION_ATTRS - .attr = gen_attr, + .attr = mp_obj_fun_bc_attr, #endif MP_TYPE_EXTENDED_FIELDS( - .call = gen_wrap_call, + .call = native_gen_wrap_call, .unary_op = mp_generic_unary_op, ), }; From 5ad35004cb3705967060b637ebcbd48d50f1b80f Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Aug 2023 17:53:38 -0400 Subject: [PATCH 1481/1712] jepler: fix 18 tests --- ports/unix/Makefile | 3 +- ports/unix/modos.c | 395 ---------------------------------------- ports/unix/moduos.c | 38 +++- ports/unix/moduos_vfs.c | 98 ---------- 4 files changed, 38 insertions(+), 496 deletions(-) delete mode 100644 ports/unix/modos.c delete mode 100644 ports/unix/moduos_vfs.c diff --git a/ports/unix/Makefile b/ports/unix/Makefile index eee9f23634..a17e46b25e 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -28,6 +28,7 @@ UNAME_S := $(shell uname -s) # include py core make definitions include $(TOP)/py/py.mk +include $(TOP)/extmod/extmod.mk GIT_SUBMODULES += lib/axtls lib/berkeley-db-1.xx lib/libffi @@ -224,8 +225,6 @@ SRC_C += \ unix_mphal.c \ mpthreadport.c \ input.c \ - modos.c \ - moduos_vfs.c \ modtime.c \ moduselect.c \ alloc.c \ diff --git a/ports/unix/modos.c b/ports/unix/modos.c deleted file mode 100644 index 8373c07a5c..0000000000 --- a/ports/unix/modos.c +++ /dev/null @@ -1,395 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * SPDX-FileCopyrightText: Copyright (c) 2014-2018 Paul Sokolovsky - * SPDX-FileCopyrightText: Copyright (c) 2014-2018 Damien P. George - * - * 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 -#include -#include -#include -#include -#include -#include -#ifdef _MSC_VER -#include // For mkdir -#endif -#include "py/mpconfig.h" - -#include "py/runtime.h" -#include "py/objtuple.h" -#include "py/mphal.h" -#include "py/mpthread.h" -#include "extmod/vfs.h" - -#ifdef __ANDROID__ -#define USE_STATFS 1 -#endif - -#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) -#if __GLIBC_PREREQ(2, 25) -#include -#define _HAVE_GETRANDOM -#endif -#endif - -#if defined(MICROPY_UNIX_COVERAGE) -#include "py/objstr.h" -typedef int os_getenv_err_t; -mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_); -os_getenv_err_t common_hal_os_getenv_str(const char *key, char *value, size_t value_len); -os_getenv_err_t common_hal_os_getenv_int(const char *key, mp_int_t *value); -#endif - -STATIC mp_obj_t mod_os_urandom(mp_obj_t num) { - mp_int_t n = mp_obj_get_int(num); - vstr_t vstr; - vstr_init_len(&vstr, n); - #ifdef _HAVE_GETRANDOM - RAISE_ERRNO(getrandom(vstr.buf, n, 0), errno); - #else - int fd = open("/dev/urandom", O_RDONLY); - RAISE_ERRNO(fd, errno); - RAISE_ERRNO(read(fd, vstr.buf, n), errno); - close(fd); - #endif - return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_urandom_obj, mod_os_urandom); - -STATIC mp_obj_t mod_os_stat(mp_obj_t path_in) { - struct stat sb; - const char *path = mp_obj_str_get_str(path_in); - - int res; - MP_HAL_RETRY_SYSCALL(res, stat(path, &sb), mp_raise_OSError(err)); - - mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL)); - t->items[0] = MP_OBJ_NEW_SMALL_INT(sb.st_mode); - t->items[1] = mp_obj_new_int_from_uint(sb.st_ino); - t->items[2] = mp_obj_new_int_from_uint(sb.st_dev); - t->items[3] = mp_obj_new_int_from_uint(sb.st_nlink); - t->items[4] = mp_obj_new_int_from_uint(sb.st_uid); - t->items[5] = mp_obj_new_int_from_uint(sb.st_gid); - t->items[6] = mp_obj_new_int_from_uint(sb.st_size); - t->items[7] = mp_obj_new_int_from_uint(sb.st_atime); - t->items[8] = mp_obj_new_int_from_uint(sb.st_mtime); - t->items[9] = mp_obj_new_int_from_uint(sb.st_ctime); - return MP_OBJ_FROM_PTR(t); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_stat_obj, mod_os_stat); - -#if MICROPY_PY_OS_STATVFS - -#if USE_STATFS -#include -#define STRUCT_STATVFS struct statfs -#define STATVFS statfs -#define F_FAVAIL sb.f_ffree -#define F_NAMEMAX sb.f_namelen -#define F_FLAG sb.f_flags -#else -#include -#define STRUCT_STATVFS struct statvfs -#define STATVFS statvfs -#define F_FAVAIL sb.f_favail -#define F_NAMEMAX sb.f_namemax -#define F_FLAG sb.f_flag -#endif - -STATIC mp_obj_t mod_os_statvfs(mp_obj_t path_in) { - STRUCT_STATVFS sb; - const char *path = mp_obj_str_get_str(path_in); - - int res; - MP_HAL_RETRY_SYSCALL(res, STATVFS(path, &sb), mp_raise_OSError(err)); - - mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL)); - t->items[0] = MP_OBJ_NEW_SMALL_INT(sb.f_bsize); - t->items[1] = MP_OBJ_NEW_SMALL_INT(sb.f_frsize); - t->items[2] = MP_OBJ_NEW_SMALL_INT(sb.f_blocks); - t->items[3] = MP_OBJ_NEW_SMALL_INT(sb.f_bfree); - t->items[4] = MP_OBJ_NEW_SMALL_INT(sb.f_bavail); - t->items[5] = MP_OBJ_NEW_SMALL_INT(sb.f_files); - t->items[6] = MP_OBJ_NEW_SMALL_INT(sb.f_ffree); - t->items[7] = MP_OBJ_NEW_SMALL_INT(F_FAVAIL); - t->items[8] = MP_OBJ_NEW_SMALL_INT(F_FLAG); - t->items[9] = MP_OBJ_NEW_SMALL_INT(F_NAMEMAX); - return MP_OBJ_FROM_PTR(t); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_statvfs_obj, mod_os_statvfs); -#endif - -STATIC mp_obj_t mod_os_remove(mp_obj_t path_in) { - const char *path = mp_obj_str_get_str(path_in); - - // Note that POSIX requires remove() to be able to delete a directory - // too (act as rmdir()). This is POSIX extension to ANSI C semantics - // of that function. But Python remove() follows ANSI C, and explicitly - // required to raise exception on attempt to remove a directory. Thus, - // call POSIX unlink() here. - MP_THREAD_GIL_EXIT(); - int r = unlink(path); - MP_THREAD_GIL_ENTER(); - - RAISE_ERRNO(r, errno); - - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_remove_obj, mod_os_remove); - -STATIC mp_obj_t mod_os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) { - const char *old_path = mp_obj_str_get_str(old_path_in); - const char *new_path = mp_obj_str_get_str(new_path_in); - - MP_THREAD_GIL_EXIT(); - int r = rename(old_path, new_path); - MP_THREAD_GIL_ENTER(); - - RAISE_ERRNO(r, errno); - - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_os_rename_obj, mod_os_rename); - -STATIC mp_obj_t mod_os_rmdir(mp_obj_t path_in) { - const char *path = mp_obj_str_get_str(path_in); - - MP_THREAD_GIL_EXIT(); - int r = rmdir(path); - MP_THREAD_GIL_ENTER(); - - RAISE_ERRNO(r, errno); - - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_rmdir_obj, mod_os_rmdir); - -STATIC mp_obj_t mod_os_system(mp_obj_t cmd_in) { - const char *cmd = mp_obj_str_get_str(cmd_in); - - MP_THREAD_GIL_EXIT(); - int r = system(cmd); - MP_THREAD_GIL_ENTER(); - - RAISE_ERRNO(r, errno); - - return MP_OBJ_NEW_SMALL_INT(r); -} -MP_DEFINE_CONST_FUN_OBJ_1(mod_os_system_obj, mod_os_system); - -STATIC mp_obj_t mod_os_getenv(mp_obj_t var_in) { - #if defined(MICROPY_UNIX_COVERAGE) - mp_obj_t result = common_hal_os_getenv(mp_obj_str_get_str(var_in), mp_const_none); - if (result != mp_const_none) { - return result; - } - #endif - const char *s = getenv(mp_obj_str_get_str(var_in)); - if (s == NULL) { - return mp_const_none; - } - return mp_obj_new_str(s, strlen(s)); -} -MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_obj, mod_os_getenv); - -#if defined(MICROPY_UNIX_COVERAGE) -STATIC mp_obj_t mod_os_getenv_int(mp_obj_t var_in) { - mp_int_t value; - os_getenv_err_t result = common_hal_os_getenv_int(mp_obj_str_get_str(var_in), &value); - if (result == 0) { - return mp_obj_new_int(value); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_int_obj, mod_os_getenv_int); - -STATIC mp_obj_t mod_os_getenv_str(mp_obj_t var_in) { - char buf[4096]; - os_getenv_err_t result = common_hal_os_getenv_str(mp_obj_str_get_str(var_in), buf, sizeof(buf)); - if (result == 0) { - return mp_obj_new_str_copy(&mp_type_str, (byte *)buf, strlen(buf)); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_str_obj, mod_os_getenv_str); -#endif - -STATIC mp_obj_t mod_os_putenv(mp_obj_t key_in, mp_obj_t value_in) { - const char *key = mp_obj_str_get_str(key_in); - const char *value = mp_obj_str_get_str(value_in); - int ret; - - #if _WIN32 - ret = _putenv_s(key, value); - #else - ret = setenv(key, value, 1); - #endif - - if (ret == -1) { - mp_raise_OSError(errno); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(mod_os_putenv_obj, mod_os_putenv); - -STATIC mp_obj_t mod_os_unsetenv(mp_obj_t key_in) { - const char *key = mp_obj_str_get_str(key_in); - int ret; - - #if _WIN32 - ret = _putenv_s(key, ""); - #else - ret = unsetenv(key); - #endif - - if (ret == -1) { - mp_raise_OSError(errno); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(mod_os_unsetenv_obj, mod_os_unsetenv); - -STATIC mp_obj_t mod_os_mkdir(mp_obj_t path_in) { - // TODO: Accept mode param - const char *path = mp_obj_str_get_str(path_in); - MP_THREAD_GIL_EXIT(); - #ifdef _WIN32 - int r = mkdir(path); - #else - int r = mkdir(path, 0777); - #endif - MP_THREAD_GIL_ENTER(); - RAISE_ERRNO(r, errno); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_mkdir_obj, mod_os_mkdir); - -typedef struct _mp_obj_listdir_t { - mp_obj_base_t base; - mp_fun_1_t iternext; - DIR *dir; -} mp_obj_listdir_t; - -STATIC mp_obj_t listdir_next(mp_obj_t self_in) { - mp_obj_listdir_t *self = MP_OBJ_TO_PTR(self_in); - - if (self->dir == NULL) { - goto done; - } - MP_THREAD_GIL_EXIT(); - struct dirent *dirent = readdir(self->dir); - if (dirent == NULL) { - closedir(self->dir); - MP_THREAD_GIL_ENTER(); - self->dir = NULL; - done: - return MP_OBJ_STOP_ITERATION; - } - MP_THREAD_GIL_ENTER(); - - mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(3, NULL)); - t->items[0] = mp_obj_new_str(dirent->d_name, strlen(dirent->d_name)); - - #ifdef _DIRENT_HAVE_D_TYPE - #ifdef DTTOIF - t->items[1] = MP_OBJ_NEW_SMALL_INT(DTTOIF(dirent->d_type)); - #else - if (dirent->d_type == DT_DIR) { - t->items[1] = MP_OBJ_NEW_SMALL_INT(MP_S_IFDIR); - } else if (dirent->d_type == DT_REG) { - t->items[1] = MP_OBJ_NEW_SMALL_INT(MP_S_IFREG); - } else { - t->items[1] = MP_OBJ_NEW_SMALL_INT(dirent->d_type); - } - #endif - #else - // DT_UNKNOWN should have 0 value on any reasonable system - t->items[1] = MP_OBJ_NEW_SMALL_INT(0); - #endif - - #ifdef _DIRENT_HAVE_D_INO - t->items[2] = MP_OBJ_NEW_SMALL_INT(dirent->d_ino); - #else - t->items[2] = MP_OBJ_NEW_SMALL_INT(0); - #endif - return MP_OBJ_FROM_PTR(t); -} - -STATIC mp_obj_t mod_os_ilistdir(size_t n_args, const mp_obj_t *args) { - const char *path = "."; - if (n_args > 0) { - path = mp_obj_str_get_str(args[0]); - } - mp_obj_listdir_t *o = m_new_obj(mp_obj_listdir_t); - o->base.type = &mp_type_polymorph_iter; - MP_THREAD_GIL_EXIT(); - o->dir = opendir(path); - MP_THREAD_GIL_ENTER(); - o->iternext = listdir_next; - return MP_OBJ_FROM_PTR(o); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_ilistdir_obj, 0, 1, mod_os_ilistdir); - -STATIC mp_obj_t mod_os_errno(size_t n_args, const mp_obj_t *args) { - if (n_args == 0) { - return MP_OBJ_NEW_SMALL_INT(errno); - } - - errno = mp_obj_get_int(args[0]); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_errno_obj, 0, 1, mod_os_errno); - -STATIC const mp_rom_map_elem_t mp_module_os_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, - { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mod_os_errno_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mod_os_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mod_os_urandom_obj) }, - #if MICROPY_PY_OS_STATVFS - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mod_os_statvfs_obj) }, - #endif - { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mod_os_system_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mod_os_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mod_os_rename_obj) }, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mod_os_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mod_os_getenv_obj) }, - #if defined(MICROPY_UNIX_COVERAGE) - { MP_ROM_QSTR(MP_QSTR_getenv_int), MP_ROM_PTR(&mod_os_getenv_int_obj) }, - { MP_ROM_QSTR(MP_QSTR_getenv_str), MP_ROM_PTR(&mod_os_getenv_str_obj) }, - #endif - { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mod_os_putenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mod_os_unsetenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mod_os_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mod_os_ilistdir_obj) }, -}; - -STATIC MP_DEFINE_CONST_DICT(mp_module_os_globals, mp_module_os_globals_table); - -const mp_obj_module_t mp_module_os = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_os_globals, -}; diff --git a/ports/unix/moduos.c b/ports/unix/moduos.c index 848a3612d1..e352b9f27b 100644 --- a/ports/unix/moduos.c +++ b/ports/unix/moduos.c @@ -31,14 +31,50 @@ #include "py/runtime.h" #include "py/mphal.h" +#if defined(MICROPY_UNIX_COVERAGE) +#include "py/objstr.h" +typedef int os_getenv_err_t; +mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_); +os_getenv_err_t common_hal_os_getenv_str(const char *key, char *value, size_t value_len); +os_getenv_err_t common_hal_os_getenv_int(const char *key, mp_int_t *value); +#endif + STATIC mp_obj_t mp_uos_getenv(mp_obj_t var_in) { + #if defined(MICROPY_UNIX_COVERAGE) + mp_obj_t result = common_hal_os_getenv(mp_obj_str_get_str(var_in), mp_const_none); + if (result != mp_const_none) { + return result; + } + #endif const char *s = getenv(mp_obj_str_get_str(var_in)); if (s == NULL) { return mp_const_none; } return mp_obj_new_str(s, strlen(s)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_getenv_obj, mp_uos_getenv); +MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_getenv_obj, mp_uos_getenv); + +#if defined(MICROPY_UNIX_COVERAGE) +STATIC mp_obj_t mp_uos_getenv_int(mp_obj_t var_in) { + mp_int_t value; + os_getenv_err_t result = common_hal_os_getenv_int(mp_obj_str_get_str(var_in), &value); + if (result == 0) { + return mp_obj_new_int(value); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_getenv_int_obj, mp_uos_getenv_int); + +STATIC mp_obj_t mp_uos_getenv_str(mp_obj_t var_in) { + char buf[4096]; + os_getenv_err_t result = common_hal_os_getenv_str(mp_obj_str_get_str(var_in), buf, sizeof(buf)); + if (result == 0) { + return mp_obj_new_str_copy(&mp_type_str, (byte *)buf, strlen(buf)); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_getenv_str_obj, mp_uos_getenv_str); +#endif STATIC mp_obj_t mp_uos_putenv(mp_obj_t key_in, mp_obj_t value_in) { const char *key = mp_obj_str_get_str(key_in); diff --git a/ports/unix/moduos_vfs.c b/ports/unix/moduos_vfs.c deleted file mode 100644 index e13474cc36..0000000000 --- a/ports/unix/moduos_vfs.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George - * - * 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 "extmod/vfs.h" -#include "extmod/vfs_posix.h" -#include "extmod/vfs_fat.h" -#include "extmod/vfs_lfs.h" - -#if MICROPY_VFS - -// These are defined in modos.c -MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_errno_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_obj); -#if defined(MICROPY_UNIX_COVERAGE) -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_int_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_str_obj); -#endif -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_putenv_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_unsetenv_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_system_obj); - -STATIC const mp_rom_map_elem_t uos_vfs_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos_vfs) }, - { MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) }, - - { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mod_os_errno_obj) }, - { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mod_os_getenv_obj) }, - #if defined(MICROPY_UNIX_COVERAGE) - { MP_ROM_QSTR(MP_QSTR_getenv_int), MP_ROM_PTR(&mod_os_getenv_int_obj) }, - { MP_ROM_QSTR(MP_QSTR_getenv_str), MP_ROM_PTR(&mod_os_getenv_str_obj) }, - #endif - { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mod_os_putenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mod_os_unsetenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mod_os_system_obj) }, - - { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, - { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, - - { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mp_vfs_rename_obj) }, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, - { MP_ROM_QSTR(MP_QSTR_unlink), MP_ROM_PTR(&mp_vfs_remove_obj) }, // unlink aliases to remove - - #if MICROPY_VFS_POSIX - { MP_ROM_QSTR(MP_QSTR_VfsPosix), MP_ROM_PTR(&mp_type_vfs_posix) }, - #endif - #if MICROPY_VFS_FAT - { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, - #endif - #if MICROPY_VFS_LFS1 - { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, - #endif - #if MICROPY_VFS_LFS2 - { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, - #endif -}; - -STATIC MP_DEFINE_CONST_DICT(uos_vfs_module_globals, uos_vfs_module_globals_table); - -const mp_obj_module_t mp_module_uos_vfs = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&uos_vfs_module_globals, -}; - -#endif // MICROPY_VFS From 545d4342390dee9f2105741d1265e358efafe273 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Aug 2023 18:21:50 -0400 Subject: [PATCH 1482/1712] Revert "jepler: fix 18 tests" This reverts commit 5ad35004cb3705967060b637ebcbd48d50f1b80f. --- ports/unix/Makefile | 3 +- ports/unix/modos.c | 395 ++++++++++++++++++++++++++++++++++++++++ ports/unix/moduos.c | 38 +--- ports/unix/moduos_vfs.c | 98 ++++++++++ 4 files changed, 496 insertions(+), 38 deletions(-) create mode 100644 ports/unix/modos.c create mode 100644 ports/unix/moduos_vfs.c diff --git a/ports/unix/Makefile b/ports/unix/Makefile index a17e46b25e..eee9f23634 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -28,7 +28,6 @@ UNAME_S := $(shell uname -s) # include py core make definitions include $(TOP)/py/py.mk -include $(TOP)/extmod/extmod.mk GIT_SUBMODULES += lib/axtls lib/berkeley-db-1.xx lib/libffi @@ -225,6 +224,8 @@ SRC_C += \ unix_mphal.c \ mpthreadport.c \ input.c \ + modos.c \ + moduos_vfs.c \ modtime.c \ moduselect.c \ alloc.c \ diff --git a/ports/unix/modos.c b/ports/unix/modos.c new file mode 100644 index 0000000000..8373c07a5c --- /dev/null +++ b/ports/unix/modos.c @@ -0,0 +1,395 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2014-2018 Paul Sokolovsky + * SPDX-FileCopyrightText: Copyright (c) 2014-2018 Damien P. George + * + * 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 +#include +#include +#include +#include +#include +#include +#ifdef _MSC_VER +#include // For mkdir +#endif +#include "py/mpconfig.h" + +#include "py/runtime.h" +#include "py/objtuple.h" +#include "py/mphal.h" +#include "py/mpthread.h" +#include "extmod/vfs.h" + +#ifdef __ANDROID__ +#define USE_STATFS 1 +#endif + +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) +#if __GLIBC_PREREQ(2, 25) +#include +#define _HAVE_GETRANDOM +#endif +#endif + +#if defined(MICROPY_UNIX_COVERAGE) +#include "py/objstr.h" +typedef int os_getenv_err_t; +mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_); +os_getenv_err_t common_hal_os_getenv_str(const char *key, char *value, size_t value_len); +os_getenv_err_t common_hal_os_getenv_int(const char *key, mp_int_t *value); +#endif + +STATIC mp_obj_t mod_os_urandom(mp_obj_t num) { + mp_int_t n = mp_obj_get_int(num); + vstr_t vstr; + vstr_init_len(&vstr, n); + #ifdef _HAVE_GETRANDOM + RAISE_ERRNO(getrandom(vstr.buf, n, 0), errno); + #else + int fd = open("/dev/urandom", O_RDONLY); + RAISE_ERRNO(fd, errno); + RAISE_ERRNO(read(fd, vstr.buf, n), errno); + close(fd); + #endif + return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_urandom_obj, mod_os_urandom); + +STATIC mp_obj_t mod_os_stat(mp_obj_t path_in) { + struct stat sb; + const char *path = mp_obj_str_get_str(path_in); + + int res; + MP_HAL_RETRY_SYSCALL(res, stat(path, &sb), mp_raise_OSError(err)); + + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL)); + t->items[0] = MP_OBJ_NEW_SMALL_INT(sb.st_mode); + t->items[1] = mp_obj_new_int_from_uint(sb.st_ino); + t->items[2] = mp_obj_new_int_from_uint(sb.st_dev); + t->items[3] = mp_obj_new_int_from_uint(sb.st_nlink); + t->items[4] = mp_obj_new_int_from_uint(sb.st_uid); + t->items[5] = mp_obj_new_int_from_uint(sb.st_gid); + t->items[6] = mp_obj_new_int_from_uint(sb.st_size); + t->items[7] = mp_obj_new_int_from_uint(sb.st_atime); + t->items[8] = mp_obj_new_int_from_uint(sb.st_mtime); + t->items[9] = mp_obj_new_int_from_uint(sb.st_ctime); + return MP_OBJ_FROM_PTR(t); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_stat_obj, mod_os_stat); + +#if MICROPY_PY_OS_STATVFS + +#if USE_STATFS +#include +#define STRUCT_STATVFS struct statfs +#define STATVFS statfs +#define F_FAVAIL sb.f_ffree +#define F_NAMEMAX sb.f_namelen +#define F_FLAG sb.f_flags +#else +#include +#define STRUCT_STATVFS struct statvfs +#define STATVFS statvfs +#define F_FAVAIL sb.f_favail +#define F_NAMEMAX sb.f_namemax +#define F_FLAG sb.f_flag +#endif + +STATIC mp_obj_t mod_os_statvfs(mp_obj_t path_in) { + STRUCT_STATVFS sb; + const char *path = mp_obj_str_get_str(path_in); + + int res; + MP_HAL_RETRY_SYSCALL(res, STATVFS(path, &sb), mp_raise_OSError(err)); + + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL)); + t->items[0] = MP_OBJ_NEW_SMALL_INT(sb.f_bsize); + t->items[1] = MP_OBJ_NEW_SMALL_INT(sb.f_frsize); + t->items[2] = MP_OBJ_NEW_SMALL_INT(sb.f_blocks); + t->items[3] = MP_OBJ_NEW_SMALL_INT(sb.f_bfree); + t->items[4] = MP_OBJ_NEW_SMALL_INT(sb.f_bavail); + t->items[5] = MP_OBJ_NEW_SMALL_INT(sb.f_files); + t->items[6] = MP_OBJ_NEW_SMALL_INT(sb.f_ffree); + t->items[7] = MP_OBJ_NEW_SMALL_INT(F_FAVAIL); + t->items[8] = MP_OBJ_NEW_SMALL_INT(F_FLAG); + t->items[9] = MP_OBJ_NEW_SMALL_INT(F_NAMEMAX); + return MP_OBJ_FROM_PTR(t); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_statvfs_obj, mod_os_statvfs); +#endif + +STATIC mp_obj_t mod_os_remove(mp_obj_t path_in) { + const char *path = mp_obj_str_get_str(path_in); + + // Note that POSIX requires remove() to be able to delete a directory + // too (act as rmdir()). This is POSIX extension to ANSI C semantics + // of that function. But Python remove() follows ANSI C, and explicitly + // required to raise exception on attempt to remove a directory. Thus, + // call POSIX unlink() here. + MP_THREAD_GIL_EXIT(); + int r = unlink(path); + MP_THREAD_GIL_ENTER(); + + RAISE_ERRNO(r, errno); + + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_remove_obj, mod_os_remove); + +STATIC mp_obj_t mod_os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) { + const char *old_path = mp_obj_str_get_str(old_path_in); + const char *new_path = mp_obj_str_get_str(new_path_in); + + MP_THREAD_GIL_EXIT(); + int r = rename(old_path, new_path); + MP_THREAD_GIL_ENTER(); + + RAISE_ERRNO(r, errno); + + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_os_rename_obj, mod_os_rename); + +STATIC mp_obj_t mod_os_rmdir(mp_obj_t path_in) { + const char *path = mp_obj_str_get_str(path_in); + + MP_THREAD_GIL_EXIT(); + int r = rmdir(path); + MP_THREAD_GIL_ENTER(); + + RAISE_ERRNO(r, errno); + + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_rmdir_obj, mod_os_rmdir); + +STATIC mp_obj_t mod_os_system(mp_obj_t cmd_in) { + const char *cmd = mp_obj_str_get_str(cmd_in); + + MP_THREAD_GIL_EXIT(); + int r = system(cmd); + MP_THREAD_GIL_ENTER(); + + RAISE_ERRNO(r, errno); + + return MP_OBJ_NEW_SMALL_INT(r); +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_os_system_obj, mod_os_system); + +STATIC mp_obj_t mod_os_getenv(mp_obj_t var_in) { + #if defined(MICROPY_UNIX_COVERAGE) + mp_obj_t result = common_hal_os_getenv(mp_obj_str_get_str(var_in), mp_const_none); + if (result != mp_const_none) { + return result; + } + #endif + const char *s = getenv(mp_obj_str_get_str(var_in)); + if (s == NULL) { + return mp_const_none; + } + return mp_obj_new_str(s, strlen(s)); +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_obj, mod_os_getenv); + +#if defined(MICROPY_UNIX_COVERAGE) +STATIC mp_obj_t mod_os_getenv_int(mp_obj_t var_in) { + mp_int_t value; + os_getenv_err_t result = common_hal_os_getenv_int(mp_obj_str_get_str(var_in), &value); + if (result == 0) { + return mp_obj_new_int(value); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_int_obj, mod_os_getenv_int); + +STATIC mp_obj_t mod_os_getenv_str(mp_obj_t var_in) { + char buf[4096]; + os_getenv_err_t result = common_hal_os_getenv_str(mp_obj_str_get_str(var_in), buf, sizeof(buf)); + if (result == 0) { + return mp_obj_new_str_copy(&mp_type_str, (byte *)buf, strlen(buf)); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_str_obj, mod_os_getenv_str); +#endif + +STATIC mp_obj_t mod_os_putenv(mp_obj_t key_in, mp_obj_t value_in) { + const char *key = mp_obj_str_get_str(key_in); + const char *value = mp_obj_str_get_str(value_in); + int ret; + + #if _WIN32 + ret = _putenv_s(key, value); + #else + ret = setenv(key, value, 1); + #endif + + if (ret == -1) { + mp_raise_OSError(errno); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(mod_os_putenv_obj, mod_os_putenv); + +STATIC mp_obj_t mod_os_unsetenv(mp_obj_t key_in) { + const char *key = mp_obj_str_get_str(key_in); + int ret; + + #if _WIN32 + ret = _putenv_s(key, ""); + #else + ret = unsetenv(key); + #endif + + if (ret == -1) { + mp_raise_OSError(errno); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_os_unsetenv_obj, mod_os_unsetenv); + +STATIC mp_obj_t mod_os_mkdir(mp_obj_t path_in) { + // TODO: Accept mode param + const char *path = mp_obj_str_get_str(path_in); + MP_THREAD_GIL_EXIT(); + #ifdef _WIN32 + int r = mkdir(path); + #else + int r = mkdir(path, 0777); + #endif + MP_THREAD_GIL_ENTER(); + RAISE_ERRNO(r, errno); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_mkdir_obj, mod_os_mkdir); + +typedef struct _mp_obj_listdir_t { + mp_obj_base_t base; + mp_fun_1_t iternext; + DIR *dir; +} mp_obj_listdir_t; + +STATIC mp_obj_t listdir_next(mp_obj_t self_in) { + mp_obj_listdir_t *self = MP_OBJ_TO_PTR(self_in); + + if (self->dir == NULL) { + goto done; + } + MP_THREAD_GIL_EXIT(); + struct dirent *dirent = readdir(self->dir); + if (dirent == NULL) { + closedir(self->dir); + MP_THREAD_GIL_ENTER(); + self->dir = NULL; + done: + return MP_OBJ_STOP_ITERATION; + } + MP_THREAD_GIL_ENTER(); + + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(3, NULL)); + t->items[0] = mp_obj_new_str(dirent->d_name, strlen(dirent->d_name)); + + #ifdef _DIRENT_HAVE_D_TYPE + #ifdef DTTOIF + t->items[1] = MP_OBJ_NEW_SMALL_INT(DTTOIF(dirent->d_type)); + #else + if (dirent->d_type == DT_DIR) { + t->items[1] = MP_OBJ_NEW_SMALL_INT(MP_S_IFDIR); + } else if (dirent->d_type == DT_REG) { + t->items[1] = MP_OBJ_NEW_SMALL_INT(MP_S_IFREG); + } else { + t->items[1] = MP_OBJ_NEW_SMALL_INT(dirent->d_type); + } + #endif + #else + // DT_UNKNOWN should have 0 value on any reasonable system + t->items[1] = MP_OBJ_NEW_SMALL_INT(0); + #endif + + #ifdef _DIRENT_HAVE_D_INO + t->items[2] = MP_OBJ_NEW_SMALL_INT(dirent->d_ino); + #else + t->items[2] = MP_OBJ_NEW_SMALL_INT(0); + #endif + return MP_OBJ_FROM_PTR(t); +} + +STATIC mp_obj_t mod_os_ilistdir(size_t n_args, const mp_obj_t *args) { + const char *path = "."; + if (n_args > 0) { + path = mp_obj_str_get_str(args[0]); + } + mp_obj_listdir_t *o = m_new_obj(mp_obj_listdir_t); + o->base.type = &mp_type_polymorph_iter; + MP_THREAD_GIL_EXIT(); + o->dir = opendir(path); + MP_THREAD_GIL_ENTER(); + o->iternext = listdir_next; + return MP_OBJ_FROM_PTR(o); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_ilistdir_obj, 0, 1, mod_os_ilistdir); + +STATIC mp_obj_t mod_os_errno(size_t n_args, const mp_obj_t *args) { + if (n_args == 0) { + return MP_OBJ_NEW_SMALL_INT(errno); + } + + errno = mp_obj_get_int(args[0]); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_errno_obj, 0, 1, mod_os_errno); + +STATIC const mp_rom_map_elem_t mp_module_os_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, + { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mod_os_errno_obj) }, + { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mod_os_stat_obj) }, + { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mod_os_urandom_obj) }, + #if MICROPY_PY_OS_STATVFS + { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mod_os_statvfs_obj) }, + #endif + { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mod_os_system_obj) }, + { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mod_os_remove_obj) }, + { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mod_os_rename_obj) }, + { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mod_os_rmdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mod_os_getenv_obj) }, + #if defined(MICROPY_UNIX_COVERAGE) + { MP_ROM_QSTR(MP_QSTR_getenv_int), MP_ROM_PTR(&mod_os_getenv_int_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv_str), MP_ROM_PTR(&mod_os_getenv_str_obj) }, + #endif + { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mod_os_putenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mod_os_unsetenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mod_os_mkdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mod_os_ilistdir_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(mp_module_os_globals, mp_module_os_globals_table); + +const mp_obj_module_t mp_module_os = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&mp_module_os_globals, +}; diff --git a/ports/unix/moduos.c b/ports/unix/moduos.c index e352b9f27b..848a3612d1 100644 --- a/ports/unix/moduos.c +++ b/ports/unix/moduos.c @@ -31,50 +31,14 @@ #include "py/runtime.h" #include "py/mphal.h" -#if defined(MICROPY_UNIX_COVERAGE) -#include "py/objstr.h" -typedef int os_getenv_err_t; -mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_); -os_getenv_err_t common_hal_os_getenv_str(const char *key, char *value, size_t value_len); -os_getenv_err_t common_hal_os_getenv_int(const char *key, mp_int_t *value); -#endif - STATIC mp_obj_t mp_uos_getenv(mp_obj_t var_in) { - #if defined(MICROPY_UNIX_COVERAGE) - mp_obj_t result = common_hal_os_getenv(mp_obj_str_get_str(var_in), mp_const_none); - if (result != mp_const_none) { - return result; - } - #endif const char *s = getenv(mp_obj_str_get_str(var_in)); if (s == NULL) { return mp_const_none; } return mp_obj_new_str(s, strlen(s)); } -MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_getenv_obj, mp_uos_getenv); - -#if defined(MICROPY_UNIX_COVERAGE) -STATIC mp_obj_t mp_uos_getenv_int(mp_obj_t var_in) { - mp_int_t value; - os_getenv_err_t result = common_hal_os_getenv_int(mp_obj_str_get_str(var_in), &value); - if (result == 0) { - return mp_obj_new_int(value); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_getenv_int_obj, mp_uos_getenv_int); - -STATIC mp_obj_t mp_uos_getenv_str(mp_obj_t var_in) { - char buf[4096]; - os_getenv_err_t result = common_hal_os_getenv_str(mp_obj_str_get_str(var_in), buf, sizeof(buf)); - if (result == 0) { - return mp_obj_new_str_copy(&mp_type_str, (byte *)buf, strlen(buf)); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_getenv_str_obj, mp_uos_getenv_str); -#endif +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_getenv_obj, mp_uos_getenv); STATIC mp_obj_t mp_uos_putenv(mp_obj_t key_in, mp_obj_t value_in) { const char *key = mp_obj_str_get_str(key_in); diff --git a/ports/unix/moduos_vfs.c b/ports/unix/moduos_vfs.c new file mode 100644 index 0000000000..e13474cc36 --- /dev/null +++ b/ports/unix/moduos_vfs.c @@ -0,0 +1,98 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George + * + * 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 "extmod/vfs.h" +#include "extmod/vfs_posix.h" +#include "extmod/vfs_fat.h" +#include "extmod/vfs_lfs.h" + +#if MICROPY_VFS + +// These are defined in modos.c +MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_errno_obj); +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_obj); +#if defined(MICROPY_UNIX_COVERAGE) +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_int_obj); +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_str_obj); +#endif +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_putenv_obj); +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_unsetenv_obj); +MP_DECLARE_CONST_FUN_OBJ_1(mod_os_system_obj); + +STATIC const mp_rom_map_elem_t uos_vfs_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos_vfs) }, + { MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) }, + + { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mod_os_errno_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mod_os_getenv_obj) }, + #if defined(MICROPY_UNIX_COVERAGE) + { MP_ROM_QSTR(MP_QSTR_getenv_int), MP_ROM_PTR(&mod_os_getenv_int_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv_str), MP_ROM_PTR(&mod_os_getenv_str_obj) }, + #endif + { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mod_os_putenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mod_os_unsetenv_obj) }, + { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mod_os_system_obj) }, + + { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, + { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, + + { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, + { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, + { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mp_vfs_rename_obj) }, + { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, + { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, + { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, + { MP_ROM_QSTR(MP_QSTR_unlink), MP_ROM_PTR(&mp_vfs_remove_obj) }, // unlink aliases to remove + + #if MICROPY_VFS_POSIX + { MP_ROM_QSTR(MP_QSTR_VfsPosix), MP_ROM_PTR(&mp_type_vfs_posix) }, + #endif + #if MICROPY_VFS_FAT + { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, + #endif + #if MICROPY_VFS_LFS1 + { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, + #endif + #if MICROPY_VFS_LFS2 + { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, + #endif +}; + +STATIC MP_DEFINE_CONST_DICT(uos_vfs_module_globals, uos_vfs_module_globals_table); + +const mp_obj_module_t mp_module_uos_vfs = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&uos_vfs_module_globals, +}; + +#endif // MICROPY_VFS From 3d48e87e6092dd42eec6aed42bf4557364cbf6ee Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 14 Aug 2023 18:34:32 -0400 Subject: [PATCH 1483/1712] jepler: fix 18 tests (redo commit to be correct) --- extmod/moduos.c | 5 + ports/unix/Makefile | 3 +- ports/unix/modos.c | 395 ---------------------------------------- ports/unix/moduos.c | 38 +++- ports/unix/moduos_vfs.c | 98 ---------- py/mpconfig.h | 8 + py/py.mk | 1 + 7 files changed, 52 insertions(+), 496 deletions(-) delete mode 100644 ports/unix/modos.c delete mode 100644 ports/unix/moduos_vfs.c diff --git a/extmod/moduos.c b/extmod/moduos.c index 87a611148d..a1752deb4a 100644 --- a/extmod/moduos.c +++ b/extmod/moduos.c @@ -107,6 +107,11 @@ STATIC const mp_rom_map_elem_t os_module_globals_table[] = { #if MICROPY_PY_UOS_GETENV_PUTENV_UNSETENV { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mp_uos_getenv_obj) }, + #if defined(MICROPY_UNIX_COVERAGE) + { MP_ROM_QSTR(MP_QSTR_getenv_int), MP_ROM_PTR(&mp_uos_getenv_int_obj) }, + { MP_ROM_QSTR(MP_QSTR_getenv_str), MP_ROM_PTR(&mp_uos_getenv_str_obj) }, + #endif + { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mp_uos_putenv_obj) }, { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mp_uos_unsetenv_obj) }, #endif diff --git a/ports/unix/Makefile b/ports/unix/Makefile index eee9f23634..a17e46b25e 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -28,6 +28,7 @@ UNAME_S := $(shell uname -s) # include py core make definitions include $(TOP)/py/py.mk +include $(TOP)/extmod/extmod.mk GIT_SUBMODULES += lib/axtls lib/berkeley-db-1.xx lib/libffi @@ -224,8 +225,6 @@ SRC_C += \ unix_mphal.c \ mpthreadport.c \ input.c \ - modos.c \ - moduos_vfs.c \ modtime.c \ moduselect.c \ alloc.c \ diff --git a/ports/unix/modos.c b/ports/unix/modos.c deleted file mode 100644 index 8373c07a5c..0000000000 --- a/ports/unix/modos.c +++ /dev/null @@ -1,395 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * SPDX-FileCopyrightText: Copyright (c) 2014-2018 Paul Sokolovsky - * SPDX-FileCopyrightText: Copyright (c) 2014-2018 Damien P. George - * - * 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 -#include -#include -#include -#include -#include -#include -#ifdef _MSC_VER -#include // For mkdir -#endif -#include "py/mpconfig.h" - -#include "py/runtime.h" -#include "py/objtuple.h" -#include "py/mphal.h" -#include "py/mpthread.h" -#include "extmod/vfs.h" - -#ifdef __ANDROID__ -#define USE_STATFS 1 -#endif - -#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) -#if __GLIBC_PREREQ(2, 25) -#include -#define _HAVE_GETRANDOM -#endif -#endif - -#if defined(MICROPY_UNIX_COVERAGE) -#include "py/objstr.h" -typedef int os_getenv_err_t; -mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_); -os_getenv_err_t common_hal_os_getenv_str(const char *key, char *value, size_t value_len); -os_getenv_err_t common_hal_os_getenv_int(const char *key, mp_int_t *value); -#endif - -STATIC mp_obj_t mod_os_urandom(mp_obj_t num) { - mp_int_t n = mp_obj_get_int(num); - vstr_t vstr; - vstr_init_len(&vstr, n); - #ifdef _HAVE_GETRANDOM - RAISE_ERRNO(getrandom(vstr.buf, n, 0), errno); - #else - int fd = open("/dev/urandom", O_RDONLY); - RAISE_ERRNO(fd, errno); - RAISE_ERRNO(read(fd, vstr.buf, n), errno); - close(fd); - #endif - return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_urandom_obj, mod_os_urandom); - -STATIC mp_obj_t mod_os_stat(mp_obj_t path_in) { - struct stat sb; - const char *path = mp_obj_str_get_str(path_in); - - int res; - MP_HAL_RETRY_SYSCALL(res, stat(path, &sb), mp_raise_OSError(err)); - - mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL)); - t->items[0] = MP_OBJ_NEW_SMALL_INT(sb.st_mode); - t->items[1] = mp_obj_new_int_from_uint(sb.st_ino); - t->items[2] = mp_obj_new_int_from_uint(sb.st_dev); - t->items[3] = mp_obj_new_int_from_uint(sb.st_nlink); - t->items[4] = mp_obj_new_int_from_uint(sb.st_uid); - t->items[5] = mp_obj_new_int_from_uint(sb.st_gid); - t->items[6] = mp_obj_new_int_from_uint(sb.st_size); - t->items[7] = mp_obj_new_int_from_uint(sb.st_atime); - t->items[8] = mp_obj_new_int_from_uint(sb.st_mtime); - t->items[9] = mp_obj_new_int_from_uint(sb.st_ctime); - return MP_OBJ_FROM_PTR(t); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_stat_obj, mod_os_stat); - -#if MICROPY_PY_OS_STATVFS - -#if USE_STATFS -#include -#define STRUCT_STATVFS struct statfs -#define STATVFS statfs -#define F_FAVAIL sb.f_ffree -#define F_NAMEMAX sb.f_namelen -#define F_FLAG sb.f_flags -#else -#include -#define STRUCT_STATVFS struct statvfs -#define STATVFS statvfs -#define F_FAVAIL sb.f_favail -#define F_NAMEMAX sb.f_namemax -#define F_FLAG sb.f_flag -#endif - -STATIC mp_obj_t mod_os_statvfs(mp_obj_t path_in) { - STRUCT_STATVFS sb; - const char *path = mp_obj_str_get_str(path_in); - - int res; - MP_HAL_RETRY_SYSCALL(res, STATVFS(path, &sb), mp_raise_OSError(err)); - - mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(10, NULL)); - t->items[0] = MP_OBJ_NEW_SMALL_INT(sb.f_bsize); - t->items[1] = MP_OBJ_NEW_SMALL_INT(sb.f_frsize); - t->items[2] = MP_OBJ_NEW_SMALL_INT(sb.f_blocks); - t->items[3] = MP_OBJ_NEW_SMALL_INT(sb.f_bfree); - t->items[4] = MP_OBJ_NEW_SMALL_INT(sb.f_bavail); - t->items[5] = MP_OBJ_NEW_SMALL_INT(sb.f_files); - t->items[6] = MP_OBJ_NEW_SMALL_INT(sb.f_ffree); - t->items[7] = MP_OBJ_NEW_SMALL_INT(F_FAVAIL); - t->items[8] = MP_OBJ_NEW_SMALL_INT(F_FLAG); - t->items[9] = MP_OBJ_NEW_SMALL_INT(F_NAMEMAX); - return MP_OBJ_FROM_PTR(t); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_statvfs_obj, mod_os_statvfs); -#endif - -STATIC mp_obj_t mod_os_remove(mp_obj_t path_in) { - const char *path = mp_obj_str_get_str(path_in); - - // Note that POSIX requires remove() to be able to delete a directory - // too (act as rmdir()). This is POSIX extension to ANSI C semantics - // of that function. But Python remove() follows ANSI C, and explicitly - // required to raise exception on attempt to remove a directory. Thus, - // call POSIX unlink() here. - MP_THREAD_GIL_EXIT(); - int r = unlink(path); - MP_THREAD_GIL_ENTER(); - - RAISE_ERRNO(r, errno); - - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_remove_obj, mod_os_remove); - -STATIC mp_obj_t mod_os_rename(mp_obj_t old_path_in, mp_obj_t new_path_in) { - const char *old_path = mp_obj_str_get_str(old_path_in); - const char *new_path = mp_obj_str_get_str(new_path_in); - - MP_THREAD_GIL_EXIT(); - int r = rename(old_path, new_path); - MP_THREAD_GIL_ENTER(); - - RAISE_ERRNO(r, errno); - - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_os_rename_obj, mod_os_rename); - -STATIC mp_obj_t mod_os_rmdir(mp_obj_t path_in) { - const char *path = mp_obj_str_get_str(path_in); - - MP_THREAD_GIL_EXIT(); - int r = rmdir(path); - MP_THREAD_GIL_ENTER(); - - RAISE_ERRNO(r, errno); - - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_rmdir_obj, mod_os_rmdir); - -STATIC mp_obj_t mod_os_system(mp_obj_t cmd_in) { - const char *cmd = mp_obj_str_get_str(cmd_in); - - MP_THREAD_GIL_EXIT(); - int r = system(cmd); - MP_THREAD_GIL_ENTER(); - - RAISE_ERRNO(r, errno); - - return MP_OBJ_NEW_SMALL_INT(r); -} -MP_DEFINE_CONST_FUN_OBJ_1(mod_os_system_obj, mod_os_system); - -STATIC mp_obj_t mod_os_getenv(mp_obj_t var_in) { - #if defined(MICROPY_UNIX_COVERAGE) - mp_obj_t result = common_hal_os_getenv(mp_obj_str_get_str(var_in), mp_const_none); - if (result != mp_const_none) { - return result; - } - #endif - const char *s = getenv(mp_obj_str_get_str(var_in)); - if (s == NULL) { - return mp_const_none; - } - return mp_obj_new_str(s, strlen(s)); -} -MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_obj, mod_os_getenv); - -#if defined(MICROPY_UNIX_COVERAGE) -STATIC mp_obj_t mod_os_getenv_int(mp_obj_t var_in) { - mp_int_t value; - os_getenv_err_t result = common_hal_os_getenv_int(mp_obj_str_get_str(var_in), &value); - if (result == 0) { - return mp_obj_new_int(value); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_int_obj, mod_os_getenv_int); - -STATIC mp_obj_t mod_os_getenv_str(mp_obj_t var_in) { - char buf[4096]; - os_getenv_err_t result = common_hal_os_getenv_str(mp_obj_str_get_str(var_in), buf, sizeof(buf)); - if (result == 0) { - return mp_obj_new_str_copy(&mp_type_str, (byte *)buf, strlen(buf)); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(mod_os_getenv_str_obj, mod_os_getenv_str); -#endif - -STATIC mp_obj_t mod_os_putenv(mp_obj_t key_in, mp_obj_t value_in) { - const char *key = mp_obj_str_get_str(key_in); - const char *value = mp_obj_str_get_str(value_in); - int ret; - - #if _WIN32 - ret = _putenv_s(key, value); - #else - ret = setenv(key, value, 1); - #endif - - if (ret == -1) { - mp_raise_OSError(errno); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_2(mod_os_putenv_obj, mod_os_putenv); - -STATIC mp_obj_t mod_os_unsetenv(mp_obj_t key_in) { - const char *key = mp_obj_str_get_str(key_in); - int ret; - - #if _WIN32 - ret = _putenv_s(key, ""); - #else - ret = unsetenv(key); - #endif - - if (ret == -1) { - mp_raise_OSError(errno); - } - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_1(mod_os_unsetenv_obj, mod_os_unsetenv); - -STATIC mp_obj_t mod_os_mkdir(mp_obj_t path_in) { - // TODO: Accept mode param - const char *path = mp_obj_str_get_str(path_in); - MP_THREAD_GIL_EXIT(); - #ifdef _WIN32 - int r = mkdir(path); - #else - int r = mkdir(path, 0777); - #endif - MP_THREAD_GIL_ENTER(); - RAISE_ERRNO(r, errno); - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_os_mkdir_obj, mod_os_mkdir); - -typedef struct _mp_obj_listdir_t { - mp_obj_base_t base; - mp_fun_1_t iternext; - DIR *dir; -} mp_obj_listdir_t; - -STATIC mp_obj_t listdir_next(mp_obj_t self_in) { - mp_obj_listdir_t *self = MP_OBJ_TO_PTR(self_in); - - if (self->dir == NULL) { - goto done; - } - MP_THREAD_GIL_EXIT(); - struct dirent *dirent = readdir(self->dir); - if (dirent == NULL) { - closedir(self->dir); - MP_THREAD_GIL_ENTER(); - self->dir = NULL; - done: - return MP_OBJ_STOP_ITERATION; - } - MP_THREAD_GIL_ENTER(); - - mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(3, NULL)); - t->items[0] = mp_obj_new_str(dirent->d_name, strlen(dirent->d_name)); - - #ifdef _DIRENT_HAVE_D_TYPE - #ifdef DTTOIF - t->items[1] = MP_OBJ_NEW_SMALL_INT(DTTOIF(dirent->d_type)); - #else - if (dirent->d_type == DT_DIR) { - t->items[1] = MP_OBJ_NEW_SMALL_INT(MP_S_IFDIR); - } else if (dirent->d_type == DT_REG) { - t->items[1] = MP_OBJ_NEW_SMALL_INT(MP_S_IFREG); - } else { - t->items[1] = MP_OBJ_NEW_SMALL_INT(dirent->d_type); - } - #endif - #else - // DT_UNKNOWN should have 0 value on any reasonable system - t->items[1] = MP_OBJ_NEW_SMALL_INT(0); - #endif - - #ifdef _DIRENT_HAVE_D_INO - t->items[2] = MP_OBJ_NEW_SMALL_INT(dirent->d_ino); - #else - t->items[2] = MP_OBJ_NEW_SMALL_INT(0); - #endif - return MP_OBJ_FROM_PTR(t); -} - -STATIC mp_obj_t mod_os_ilistdir(size_t n_args, const mp_obj_t *args) { - const char *path = "."; - if (n_args > 0) { - path = mp_obj_str_get_str(args[0]); - } - mp_obj_listdir_t *o = m_new_obj(mp_obj_listdir_t); - o->base.type = &mp_type_polymorph_iter; - MP_THREAD_GIL_EXIT(); - o->dir = opendir(path); - MP_THREAD_GIL_ENTER(); - o->iternext = listdir_next; - return MP_OBJ_FROM_PTR(o); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_ilistdir_obj, 0, 1, mod_os_ilistdir); - -STATIC mp_obj_t mod_os_errno(size_t n_args, const mp_obj_t *args) { - if (n_args == 0) { - return MP_OBJ_NEW_SMALL_INT(errno); - } - - errno = mp_obj_get_int(args[0]); - return mp_const_none; -} -MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_errno_obj, 0, 1, mod_os_errno); - -STATIC const mp_rom_map_elem_t mp_module_os_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos) }, - { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mod_os_errno_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mod_os_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_urandom), MP_ROM_PTR(&mod_os_urandom_obj) }, - #if MICROPY_PY_OS_STATVFS - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mod_os_statvfs_obj) }, - #endif - { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mod_os_system_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mod_os_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mod_os_rename_obj) }, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mod_os_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mod_os_getenv_obj) }, - #if defined(MICROPY_UNIX_COVERAGE) - { MP_ROM_QSTR(MP_QSTR_getenv_int), MP_ROM_PTR(&mod_os_getenv_int_obj) }, - { MP_ROM_QSTR(MP_QSTR_getenv_str), MP_ROM_PTR(&mod_os_getenv_str_obj) }, - #endif - { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mod_os_putenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mod_os_unsetenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mod_os_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mod_os_ilistdir_obj) }, -}; - -STATIC MP_DEFINE_CONST_DICT(mp_module_os_globals, mp_module_os_globals_table); - -const mp_obj_module_t mp_module_os = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_os_globals, -}; diff --git a/ports/unix/moduos.c b/ports/unix/moduos.c index 848a3612d1..e352b9f27b 100644 --- a/ports/unix/moduos.c +++ b/ports/unix/moduos.c @@ -31,14 +31,50 @@ #include "py/runtime.h" #include "py/mphal.h" +#if defined(MICROPY_UNIX_COVERAGE) +#include "py/objstr.h" +typedef int os_getenv_err_t; +mp_obj_t common_hal_os_getenv(const char *key, mp_obj_t default_); +os_getenv_err_t common_hal_os_getenv_str(const char *key, char *value, size_t value_len); +os_getenv_err_t common_hal_os_getenv_int(const char *key, mp_int_t *value); +#endif + STATIC mp_obj_t mp_uos_getenv(mp_obj_t var_in) { + #if defined(MICROPY_UNIX_COVERAGE) + mp_obj_t result = common_hal_os_getenv(mp_obj_str_get_str(var_in), mp_const_none); + if (result != mp_const_none) { + return result; + } + #endif const char *s = getenv(mp_obj_str_get_str(var_in)); if (s == NULL) { return mp_const_none; } return mp_obj_new_str(s, strlen(s)); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_getenv_obj, mp_uos_getenv); +MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_getenv_obj, mp_uos_getenv); + +#if defined(MICROPY_UNIX_COVERAGE) +STATIC mp_obj_t mp_uos_getenv_int(mp_obj_t var_in) { + mp_int_t value; + os_getenv_err_t result = common_hal_os_getenv_int(mp_obj_str_get_str(var_in), &value); + if (result == 0) { + return mp_obj_new_int(value); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_getenv_int_obj, mp_uos_getenv_int); + +STATIC mp_obj_t mp_uos_getenv_str(mp_obj_t var_in) { + char buf[4096]; + os_getenv_err_t result = common_hal_os_getenv_str(mp_obj_str_get_str(var_in), buf, sizeof(buf)); + if (result == 0) { + return mp_obj_new_str_copy(&mp_type_str, (byte *)buf, strlen(buf)); + } + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_getenv_str_obj, mp_uos_getenv_str); +#endif STATIC mp_obj_t mp_uos_putenv(mp_obj_t key_in, mp_obj_t value_in) { const char *key = mp_obj_str_get_str(key_in); diff --git a/ports/unix/moduos_vfs.c b/ports/unix/moduos_vfs.c deleted file mode 100644 index e13474cc36..0000000000 --- a/ports/unix/moduos_vfs.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * SPDX-FileCopyrightText: Copyright (c) 2017 Damien P. George - * - * 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 "extmod/vfs.h" -#include "extmod/vfs_posix.h" -#include "extmod/vfs_fat.h" -#include "extmod/vfs_lfs.h" - -#if MICROPY_VFS - -// These are defined in modos.c -MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mod_os_errno_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_obj); -#if defined(MICROPY_UNIX_COVERAGE) -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_int_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_getenv_str_obj); -#endif -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_putenv_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_unsetenv_obj); -MP_DECLARE_CONST_FUN_OBJ_1(mod_os_system_obj); - -STATIC const mp_rom_map_elem_t uos_vfs_module_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_uos_vfs) }, - { MP_ROM_QSTR(MP_QSTR_sep), MP_ROM_QSTR(MP_QSTR__slash_) }, - - { MP_ROM_QSTR(MP_QSTR_errno), MP_ROM_PTR(&mod_os_errno_obj) }, - { MP_ROM_QSTR(MP_QSTR_getenv), MP_ROM_PTR(&mod_os_getenv_obj) }, - #if defined(MICROPY_UNIX_COVERAGE) - { MP_ROM_QSTR(MP_QSTR_getenv_int), MP_ROM_PTR(&mod_os_getenv_int_obj) }, - { MP_ROM_QSTR(MP_QSTR_getenv_str), MP_ROM_PTR(&mod_os_getenv_str_obj) }, - #endif - { MP_ROM_QSTR(MP_QSTR_putenv), MP_ROM_PTR(&mod_os_putenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_unsetenv), MP_ROM_PTR(&mod_os_unsetenv_obj) }, - { MP_ROM_QSTR(MP_QSTR_system), MP_ROM_PTR(&mod_os_system_obj) }, - - { MP_ROM_QSTR(MP_QSTR_mount), MP_ROM_PTR(&mp_vfs_mount_obj) }, - { MP_ROM_QSTR(MP_QSTR_umount), MP_ROM_PTR(&mp_vfs_umount_obj) }, - - { MP_ROM_QSTR(MP_QSTR_chdir), MP_ROM_PTR(&mp_vfs_chdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_getcwd), MP_ROM_PTR(&mp_vfs_getcwd_obj) }, - { MP_ROM_QSTR(MP_QSTR_ilistdir), MP_ROM_PTR(&mp_vfs_ilistdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mp_vfs_listdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_mkdir), MP_ROM_PTR(&mp_vfs_mkdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&mp_vfs_remove_obj) }, - { MP_ROM_QSTR(MP_QSTR_rename), MP_ROM_PTR(&mp_vfs_rename_obj) }, - { MP_ROM_QSTR(MP_QSTR_rmdir), MP_ROM_PTR(&mp_vfs_rmdir_obj) }, - { MP_ROM_QSTR(MP_QSTR_stat), MP_ROM_PTR(&mp_vfs_stat_obj) }, - { MP_ROM_QSTR(MP_QSTR_statvfs), MP_ROM_PTR(&mp_vfs_statvfs_obj) }, - { MP_ROM_QSTR(MP_QSTR_unlink), MP_ROM_PTR(&mp_vfs_remove_obj) }, // unlink aliases to remove - - #if MICROPY_VFS_POSIX - { MP_ROM_QSTR(MP_QSTR_VfsPosix), MP_ROM_PTR(&mp_type_vfs_posix) }, - #endif - #if MICROPY_VFS_FAT - { MP_ROM_QSTR(MP_QSTR_VfsFat), MP_ROM_PTR(&mp_fat_vfs_type) }, - #endif - #if MICROPY_VFS_LFS1 - { MP_ROM_QSTR(MP_QSTR_VfsLfs1), MP_ROM_PTR(&mp_type_vfs_lfs1) }, - #endif - #if MICROPY_VFS_LFS2 - { MP_ROM_QSTR(MP_QSTR_VfsLfs2), MP_ROM_PTR(&mp_type_vfs_lfs2) }, - #endif -}; - -STATIC MP_DEFINE_CONST_DICT(uos_vfs_module_globals, uos_vfs_module_globals_table); - -const mp_obj_module_t mp_module_uos_vfs = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&uos_vfs_module_globals, -}; - -#endif // MICROPY_VFS diff --git a/py/mpconfig.h b/py/mpconfig.h index f890f675e1..0c4b924ef9 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -1538,6 +1538,14 @@ typedef double mp_float_t; #define MICROPY_PY_UJSON_SEPARATORS (1) #endif +#ifndef MICROPY_PY_UOS +#define MICROPY_PY_UOS (MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES) +#endif + +#ifndef MICROPY_PY_UOS_STATVFS +#define MICROPY_PY_UOS_STATVFS (MICROPY_PY_UOS) +#endif + #ifndef CIRCUITPY_ULAB #define CIRCUITPY_ULAB (0) #endif diff --git a/py/py.mk b/py/py.mk index db47031f6f..81da81ba0f 100644 --- a/py/py.mk +++ b/py/py.mk @@ -191,6 +191,7 @@ PY_EXTMOD_O_BASENAME = \ extmod/moduasyncio.o \ extmod/moductypes.o \ extmod/modujson.o \ + extmod/moduos.o \ extmod/modure.o \ extmod/moduzlib.o \ extmod/moduheapq.o \ From f0a8d449c1762e80d4e75dd6de11fb329a842603 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 15 Aug 2023 07:41:59 -0500 Subject: [PATCH 1484/1712] fix vfs_fat_case --- tests/extmod/vfs_fat_case.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/extmod/vfs_fat_case.py b/tests/extmod/vfs_fat_case.py index 40d67da9b8..cb02264dcb 100644 --- a/tests/extmod/vfs_fat_case.py +++ b/tests/extmod/vfs_fat_case.py @@ -1,15 +1,9 @@ -try: - import uerrno - import uos -except ImportError: - print("missing u") - print("SKIP") - raise SystemExit +import errno as uerrno +import os as uos try: uos.VfsFat except AttributeError: - print("missing VfsFat") print("SKIP") raise SystemExit From df1dd6ad3cfe57958f726b9ef455def005f41397 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 15 Aug 2023 07:52:16 -0500 Subject: [PATCH 1485/1712] make 'import uerrno' work again in unix port this fixes tests that 'import uerrno'. --- py/moduerrno.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/py/moduerrno.c b/py/moduerrno.c index a132474e4c..cf3cbe064f 100644 --- a/py/moduerrno.c +++ b/py/moduerrno.c @@ -105,7 +105,11 @@ const mp_obj_module_t mp_module_uerrno = { .globals = (mp_obj_dict_t *)&mp_module_uerrno_globals, }; +#if defined(MICROPY_UNIX_COVERAGE) +MP_REGISTER_MODULE(MP_QSTR_uerrno, mp_module_uerrno); +#else MP_REGISTER_MODULE(MP_QSTR_errno, mp_module_uerrno); +#endif qstr mp_errno_to_str(mp_obj_t errno_val) { // Otherwise, return the Exxxx string for that error code From 94b89b7e57c039865331afa466f919df23444c0a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 15 Aug 2023 11:54:48 -0500 Subject: [PATCH 1486/1712] enable exception chaining so we can run the test --- ports/unix/variants/coverage/mpconfigvariant.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/unix/variants/coverage/mpconfigvariant.mk b/ports/unix/variants/coverage/mpconfigvariant.mk index 9289e9cb4d..656fd77289 100644 --- a/ports/unix/variants/coverage/mpconfigvariant.mk +++ b/ports/unix/variants/coverage/mpconfigvariant.mk @@ -8,6 +8,7 @@ CFLAGS += \ -Wformat -Wmissing-declarations -Wmissing-prototypes \ -Wold-style-definition -Wpointer-arith -Wshadow -Wuninitialized -Wunused-parameter \ -DMICROPY_UNIX_COVERAGE \ + -DMICROPY_CPYTHON_EXCEPTION_CHAIN=1 \ -DMODULE_CEXAMPLE_ENABLED=1 -DMODULE_CPPEXAMPLE_ENABLED=1 LDFLAGS += -fprofile-arcs -ftest-coverage From d766795c58f0c3776c364fcdf2f4adb0239208cf Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 15 Aug 2023 11:56:22 -0500 Subject: [PATCH 1487/1712] endorse new test output --- tests/basics/errno1.py.exp | 2 +- tests/micropython/heapalloc_exc_compressed.py | 2 +- tests/micropython/heapalloc_exc_compressed.py.exp | 4 ++-- tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/basics/errno1.py.exp b/tests/basics/errno1.py.exp index ac3619161f..594486b0f9 100644 --- a/tests/basics/errno1.py.exp +++ b/tests/basics/errno1.py.exp @@ -3,4 +3,4 @@ [Errno error: details ( , 'details', 'more details') 9999 -uerrno +errno diff --git a/tests/micropython/heapalloc_exc_compressed.py b/tests/micropython/heapalloc_exc_compressed.py index aa071d641c..cddc0f7b40 100644 --- a/tests/micropython/heapalloc_exc_compressed.py +++ b/tests/micropython/heapalloc_exc_compressed.py @@ -4,7 +4,7 @@ import micropython # mp_obj_new_exception_msg_varg (exception requires decompression at raise-time to format) # mp_obj_new_exception_msg (decompression can be deferred) -# NameError uses mp_obj_new_exception_msg_varg for NameError("name '%q' isn't defined") +# NameError uses mp_obj_new_exception_msg_varg for NameError("name '%q' is not defined") # `raise 0` uses mp_obj_new_exception_msg for TypeError("exceptions must derive from BaseException") # Tests that deferred decompression works both via print(e) and accessing the message directly via e.args. diff --git a/tests/micropython/heapalloc_exc_compressed.py.exp b/tests/micropython/heapalloc_exc_compressed.py.exp index c3e6e5dd9f..c2690353b0 100644 --- a/tests/micropython/heapalloc_exc_compressed.py.exp +++ b/tests/micropython/heapalloc_exc_compressed.py.exp @@ -1,6 +1,6 @@ -NameError name 'name' isn't defined +NameError name 'name' is not defined TypeError exceptions must derive from BaseException -name 'name' isn't defined +name 'name' is not defined exceptions must derive from BaseException NameError TypeError diff --git a/tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp b/tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp index 1fc8109339..c3974250d4 100644 --- a/tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp +++ b/tests/micropython/heapalloc_exc_compressed_emg_exc.py.exp @@ -1,4 +1,4 @@ -NameError name 'name' isn't defined +NameError name 'name' is not defined TypeError exceptions must derive from BaseException -name 'name' isn't defined +name 'name' is not defined exceptions must derive from BaseException From 8d5e844b00a65e759d5d1ea7a3558176a4d3ed14 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 15 Aug 2023 13:10:31 -0500 Subject: [PATCH 1488/1712] Implement traceback length limit --- py/objexcept.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/py/objexcept.c b/py/objexcept.c index 4aaa9ec592..282740ae44 100644 --- a/py/objexcept.c +++ b/py/objexcept.c @@ -589,6 +589,16 @@ void mp_obj_exception_clear_traceback(mp_obj_t self_in) { void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, size_t line, qstr block) { mp_obj_exception_t *self = mp_obj_exception_get_native(self_in); + #if MICROPY_PY_SYS_TRACEBACKLIMIT + mp_int_t max_traceback = MP_OBJ_SMALL_INT_VALUE(MP_STATE_VM(sys_mutable[MP_SYS_MUTABLE_TRACEBACKLIMIT])); + if (max_traceback <= 0) { + return; + } else if (self->traceback != NULL && self->traceback->len >= max_traceback * TRACEBACK_ENTRY_LEN) { + self->traceback->len -= TRACEBACK_ENTRY_LEN; + memmove(self->traceback->data, self->traceback->data + TRACEBACK_ENTRY_LEN, self->traceback->len * sizeof(self->traceback->data[0])); + } + #endif + // Try to allocate memory for the traceback, with fallback to emergency traceback object if (self->traceback == NULL || self->traceback == (mp_obj_traceback_t *)&mp_const_empty_traceback_obj) { self->traceback = m_new_obj_maybe(mp_obj_traceback_t); From 8fd2d8262228b250e58941cef231cf57b768993c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 15 Aug 2023 13:19:43 -0500 Subject: [PATCH 1489/1712] fix ubinascii test --- extmod/modubinascii.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c index b4d7c75251..d95f6f5554 100644 --- a/extmod/modubinascii.c +++ b/extmod/modubinascii.c @@ -184,6 +184,7 @@ STATIC mp_obj_t mod_binascii_b2a_base64(size_t n_args, const mp_obj_t *pos_args, mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); uint8_t newline = args[ARG_newline].u_bool; + check_not_unicode(pos_args[0]); mp_buffer_info_t bufinfo; mp_get_buffer_raise(pos_args[0], &bufinfo, MP_BUFFER_READ); From 843fdbb2508cd9cbafc5043046e26cd29a8461ee Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 15 Aug 2023 13:25:25 -0500 Subject: [PATCH 1490/1712] Add a missing MP_PROTO_IMPLEMENT --- ports/unix/coverage.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c index 06cb84b0e2..d2f730a602 100644 --- a/ports/unix/coverage.c +++ b/ports/unix/coverage.c @@ -101,6 +101,7 @@ STATIC const mp_rom_map_elem_t rawfile_locals_dict_table[] = { STATIC MP_DEFINE_CONST_DICT(rawfile_locals_dict, rawfile_locals_dict_table); STATIC const mp_stream_p_t fileio_stream_p = { + MP_PROTO_IMPLEMENT(MP_QSTR_protocol_stream) .read = stest_read, .write = stest_write, .ioctl = stest_ioctl, From 3012c275e747b9fd40ffd4c83c6820c4bf4965ef Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Tue, 15 Aug 2023 18:09:42 -0400 Subject: [PATCH 1491/1712] Add SD_CS pin. --- ports/espressif/boards/adafruit_metro_esp32s3/pins.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c index dfad4381ef..3e0f65d335 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c +++ b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c @@ -72,6 +72,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_GPIO48) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO48),MP_ROM_PTR(&pin_GPIO48) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS),MP_ROM_PTR(&pin_GPIO21) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, From 8b147ac74834eef8c6fd4e1be0c3422e194ef437 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Tue, 15 Aug 2023 18:30:59 -0400 Subject: [PATCH 1492/1712] Add SD_CS pin to Metro ESP32-S3 board definition. --- ports/espressif/boards/adafruit_metro_esp32s3/pins.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c index dfad4381ef..87ae5ba31b 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c +++ b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c @@ -72,6 +72,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_SCL),MP_ROM_PTR(&pin_GPIO48) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO48),MP_ROM_PTR(&pin_GPIO48) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO21) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, From 8c5c73df38ea71dc89eb0382988fa5e2939ffbdc Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 17 Aug 2023 11:39:14 -0700 Subject: [PATCH 1493/1712] Add I2S MCLK support to iMX RT --- ports/atmel-samd/common-hal/audiobusio/I2SOut.c | 5 ++++- ports/espressif/common-hal/audiobusio/I2SOut.c | 6 ++++-- ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c | 16 +++++++++++++++- ports/mimxrt10xx/common-hal/audiobusio/I2SOut.h | 2 ++ .../peripherals/mimxrt10xx/MIMXRT1011/periph.c | 6 ++++++ .../peripherals/mimxrt10xx/MIMXRT1011/periph.h | 1 + .../peripherals/mimxrt10xx/MIMXRT1015/periph.c | 10 ++++++++++ .../peripherals/mimxrt10xx/MIMXRT1015/periph.h | 1 + .../peripherals/mimxrt10xx/MIMXRT1021/periph.c | 14 ++++++++++++++ .../peripherals/mimxrt10xx/MIMXRT1021/periph.h | 1 + .../peripherals/mimxrt10xx/MIMXRT1042/periph.c | 11 +++++++++++ .../peripherals/mimxrt10xx/MIMXRT1042/periph.h | 1 + .../peripherals/mimxrt10xx/MIMXRT1052/periph.c | 11 +++++++++++ .../peripherals/mimxrt10xx/MIMXRT1052/periph.h | 1 + .../peripherals/mimxrt10xx/MIMXRT1062/periph.c | 12 ++++++++++++ .../peripherals/mimxrt10xx/MIMXRT1062/periph.h | 1 + .../peripherals/mimxrt10xx/MIMXRT1176/periph.c | 9 +++++++++ .../peripherals/mimxrt10xx/MIMXRT1176/periph.h | 1 + ports/mimxrt10xx/tools/gen_peripherals_data.py | 2 +- ports/nrf/common-hal/audiobusio/I2SOut.c | 5 ++++- ports/raspberrypi/common-hal/audiobusio/I2SOut.c | 5 ++++- shared-bindings/audiobusio/I2SOut.c | 10 +++++++--- shared-bindings/audiobusio/I2SOut.h | 2 +- 23 files changed, 122 insertions(+), 11 deletions(-) diff --git a/ports/atmel-samd/common-hal/audiobusio/I2SOut.c b/ports/atmel-samd/common-hal/audiobusio/I2SOut.c index 447252aace..9c1a00c052 100644 --- a/ports/atmel-samd/common-hal/audiobusio/I2SOut.c +++ b/ports/atmel-samd/common-hal/audiobusio/I2SOut.c @@ -98,7 +98,10 @@ void i2sout_reset(void) { // 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) { + const mcu_pin_obj_t *data, const mcu_pin_obj_t *main_clock, bool left_justified) { + if (main_clock != NULL) { + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_main_clock); + } uint8_t serializer = 0xff; uint8_t bc_clock_unit = 0xff; uint8_t ws_clock_unit = 0xff; diff --git a/ports/espressif/common-hal/audiobusio/I2SOut.c b/ports/espressif/common-hal/audiobusio/I2SOut.c index 440151e881..8b03a534a4 100644 --- a/ports/espressif/common-hal/audiobusio/I2SOut.c +++ b/ports/espressif/common-hal/audiobusio/I2SOut.c @@ -49,8 +49,10 @@ // 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) { - + const mcu_pin_obj_t *data, const mcu_pin_obj_t *main_clock, bool left_justified) { + if (main_clock != NULL) { + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_main_clock); + } port_i2s_allocate_init(&self->peripheral, left_justified); i2s_pin_config_t i2s_pin_config = { diff --git a/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c b/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c index 9ba2762f1c..cba857a495 100644 --- a/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c +++ b/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c @@ -74,13 +74,22 @@ STATIC void config_periph_pin(const mcu_periph_obj_t *periph) { // 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) { + const mcu_pin_obj_t *data, const mcu_pin_obj_t *main_clock, bool left_justified) { int instance = -1; const mcu_periph_obj_t *bclk_periph = find_pin_function(mcu_i2s_tx_bclk_list, bit_clock, &instance, MP_QSTR_bit_clock); const mcu_periph_obj_t *sync_periph = find_pin_function(mcu_i2s_tx_sync_list, word_select, &instance, MP_QSTR_word_select); const mcu_periph_obj_t *data_periph = find_pin_function(mcu_i2s_tx_data0_list, data, &instance, MP_QSTR_data); + if (main_clock != NULL) { + const mcu_periph_obj_t *mclk_periph = find_pin_function(mcu_i2s_mclk_list, main_clock, &instance, MP_QSTR_main_clock); + self->mclk = main_clock; + claim_pin(main_clock); + config_periph_pin(mclk_periph); + IOMUXC_GPR->GPR1 |= IOMUXC_GPR_GPR1_SAI1_MCLK_DIR_MASK << (instance - 1); + } + self->instance = instance; + sai_transceiver_t config; SAI_GetClassicI2SConfig(&config, 16, kSAI_Stereo, 1); config.syncMode = kSAI_ModeAsync; @@ -121,6 +130,11 @@ void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t *self) { common_hal_reset_pin(self->data); self->data = NULL; + + IOMUXC_GPR->GPR1 &= ~(IOMUXC_GPR_GPR1_SAI1_MCLK_DIR_MASK << (self->instance - 1)); + + common_hal_reset_pin(self->mclk); + self->mclk = NULL; } void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t *self, diff --git a/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.h b/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.h index 319e52c159..3a2ed49b9a 100644 --- a/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.h +++ b/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.h @@ -39,6 +39,8 @@ typedef struct { const mcu_pin_obj_t *bit_clock; const mcu_pin_obj_t *word_select; const mcu_pin_obj_t *data; + const mcu_pin_obj_t *mclk; + uint8_t instance; } audiobusio_i2sout_obj_t; #endif diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c index a1468971dc..8a2e95b194 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.c @@ -174,6 +174,12 @@ const mcu_periph_obj_t mcu_i2s_tx_sync_list[2] = { PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_SD_00), }; +const mcu_periph_obj_t mcu_i2s_mclk_list[2] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_08), + + PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_00), +}; + const mcu_periph_obj_t mcu_mqs_left_list[1] = { PERIPH_PIN(3, 4, 0, 0, &pin_GPIO_AD_01), }; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h index f3bee9e464..b854ebe585 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1011/periph.h @@ -56,6 +56,7 @@ extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[2]; extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[2]; extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[2]; extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[2]; +extern const mcu_periph_obj_t mcu_i2s_mclk_list[2]; extern const mcu_periph_obj_t mcu_mqs_left_list[1]; extern const mcu_periph_obj_t mcu_mqs_right_list[1]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.c index c6b2c6b872..669109a858 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.c @@ -159,6 +159,16 @@ const mcu_periph_obj_t mcu_i2s_tx_sync_list[4] = { PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B1_07), }; +const mcu_periph_obj_t mcu_i2s_mclk_list[5] = { + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_EMC_20), + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B0_03), + + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_EMC_16), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_17), + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_SD_B1_05), +}; + const mcu_periph_obj_t mcu_mqs_left_list[2] = { PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_17), PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_07), diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.h index cef33f1ffa..51295b8965 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1015/periph.h @@ -56,6 +56,7 @@ extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[3]; extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[4]; extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[4]; extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[4]; +extern const mcu_periph_obj_t mcu_i2s_mclk_list[5]; extern const mcu_periph_obj_t mcu_mqs_left_list[2]; extern const mcu_periph_obj_t mcu_mqs_right_list[2]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c index 9129c64272..13a1ab41b2 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.c @@ -268,6 +268,20 @@ const mcu_periph_obj_t mcu_i2s_tx_sync_list[7] = { PERIPH_PIN(3, 3, kIOMUXC_SAI3_TX_SYNC_SELECT_INPUT, 1, &pin_GPIO_EMC_34), }; +const mcu_periph_obj_t mcu_i2s_mclk_list[9] = { + PERIPH_PIN(1, 2, kIOMUXC_SAI1_MCLK_SELECT_INPUT, 0, &pin_GPIO_SD_B0_00), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_MCLK_SELECT_INPUT, 1, &pin_GPIO_AD_B0_03), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_MCLK_SELECT_INPUT, 2, &pin_GPIO_AD_B1_00), + PERIPH_PIN(1, 3, kIOMUXC_SAI1_MCLK_SELECT_INPUT, 3, &pin_GPIO_EMC_20), + + PERIPH_PIN(2, 3, kIOMUXC_SAI2_MCLK_SELECT_INPUT, 0, &pin_GPIO_SD_B0_00), + PERIPH_PIN(2, 3, kIOMUXC_SAI2_MCLK_SELECT_INPUT, 1, &pin_GPIO_EMC_16), + + PERIPH_PIN(3, 3, kIOMUXC_SAI3_MCLK_SELECT_INPUT, 0, &pin_GPIO_SD_B1_05), + PERIPH_PIN(3, 3, kIOMUXC_SAI3_MCLK_SELECT_INPUT, 1, &pin_GPIO_EMC_17), + PERIPH_PIN(3, 3, kIOMUXC_SAI3_MCLK_SELECT_INPUT, 2, &pin_GPIO_EMC_28), +}; + const mcu_periph_obj_t mcu_mqs_left_list[3] = { PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_17), PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_38), diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h index 3dea33fa00..bb90c24250 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/periph.h @@ -56,6 +56,7 @@ extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[7]; extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[7]; extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[7]; extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[7]; +extern const mcu_periph_obj_t mcu_i2s_mclk_list[9]; extern const mcu_periph_obj_t mcu_mqs_left_list[3]; extern const mcu_periph_obj_t mcu_mqs_right_list[3]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.c index 104960b417..506e9b6fe6 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.c @@ -254,6 +254,17 @@ const mcu_periph_obj_t mcu_i2s_tx_sync_list[6] = { PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_02), }; +const mcu_periph_obj_t mcu_i2s_mclk_list[6] = { + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_B0_13), + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_SD_B1_03), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_07), + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_AD_B0_10), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_37), + PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_04), +}; + const mcu_periph_obj_t mcu_mqs_left_list[3] = { PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_14), PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_05), diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.h index 3df1a06d98..ef65ad582a 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1042/periph.h @@ -56,6 +56,7 @@ extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[6]; extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[6]; extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[6]; extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[6]; +extern const mcu_periph_obj_t mcu_i2s_mclk_list[6]; extern const mcu_periph_obj_t mcu_mqs_left_list[3]; extern const mcu_periph_obj_t mcu_mqs_right_list[3]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.c index 3ff474d7f4..de0bf66129 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.c @@ -267,6 +267,17 @@ const mcu_periph_obj_t mcu_i2s_tx_sync_list[6] = { PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_39), }; +const mcu_periph_obj_t mcu_i2s_mclk_list[6] = { + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_09), + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_B0_13), + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_SD_B1_03), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_07), + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_AD_B0_10), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_37), +}; + const mcu_periph_obj_t mcu_mqs_left_list[3] = { PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_14), PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_05), diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.h index 7d428eae1c..31c8c7b7f7 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1052/periph.h @@ -56,6 +56,7 @@ extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[6]; extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[6]; extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[6]; extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[6]; +extern const mcu_periph_obj_t mcu_i2s_mclk_list[6]; extern const mcu_periph_obj_t mcu_mqs_left_list[3]; extern const mcu_periph_obj_t mcu_mqs_right_list[3]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c index ab8fb2b4d8..b995910dc1 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.c @@ -272,6 +272,18 @@ const mcu_periph_obj_t mcu_i2s_tx_sync_list[7] = { PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_02), }; +const mcu_periph_obj_t mcu_i2s_mclk_list[7] = { + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_AD_B1_09), + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_B0_13), + PERIPH_PIN(1, 3, 0, 0, &pin_GPIO_SD_B1_03), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_07), + PERIPH_PIN(2, 3, 0, 0, &pin_GPIO_AD_B0_10), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_37), + PERIPH_PIN(3, 8, 0, 0, &pin_GPIO_SD_B1_04), +}; + const mcu_periph_obj_t mcu_mqs_left_list[3] = { PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_14), PERIPH_PIN(3, 1, 0, 0, &pin_GPIO_AD_B0_05), diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h index 36a42eba64..b6372646f6 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1062/periph.h @@ -56,6 +56,7 @@ extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[7]; extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[7]; extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[7]; extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[7]; +extern const mcu_periph_obj_t mcu_i2s_mclk_list[7]; extern const mcu_periph_obj_t mcu_mqs_left_list[3]; extern const mcu_periph_obj_t mcu_mqs_right_list[3]; diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.c b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.c index f53136c94f..f5172a252a 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.c +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.c @@ -237,6 +237,15 @@ const mcu_periph_obj_t mcu_i2s_tx_sync_list[4] = { PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_B2_16), }; +const mcu_periph_obj_t mcu_i2s_mclk_list[4] = { + PERIPH_PIN(1, 0, 0, 0, &pin_GPIO_AD_17), + PERIPH_PIN(1, 4, 0, 0, &pin_GPIO_DISP_B2_03), + + PERIPH_PIN(2, 2, 0, 0, &pin_GPIO_EMC_B2_04), + + PERIPH_PIN(3, 3, 0, 0, &pin_GPIO_EMC_B2_17), +}; + const mcu_periph_obj_t mcu_mqs_left_list[2] = { PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_EMC_B1_41), PERIPH_PIN(3, 2, 0, 0, &pin_GPIO_DISP_B2_01), diff --git a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.h b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.h index 266300df18..63e6da95f6 100644 --- a/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.h +++ b/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1176/periph.h @@ -56,6 +56,7 @@ extern const mcu_periph_obj_t mcu_i2s_rx_sync_list[4]; extern const mcu_periph_obj_t mcu_i2s_tx_bclk_list[4]; extern const mcu_periph_obj_t mcu_i2s_tx_data0_list[4]; extern const mcu_periph_obj_t mcu_i2s_tx_sync_list[4]; +extern const mcu_periph_obj_t mcu_i2s_mclk_list[4]; extern const mcu_periph_obj_t mcu_mqs_left_list[2]; extern const mcu_periph_obj_t mcu_mqs_right_list[2]; diff --git a/ports/mimxrt10xx/tools/gen_peripherals_data.py b/ports/mimxrt10xx/tools/gen_peripherals_data.py index d87e9022b2..1062bfe91c 100644 --- a/ports/mimxrt10xx/tools/gen_peripherals_data.py +++ b/ports/mimxrt10xx/tools/gen_peripherals_data.py @@ -6,7 +6,7 @@ SIGNALS = { "LPI2C": ["SDA", "SCL"], "LPSPI": ["SCK", "SDO", "SDI"], "LPUART": ["RX", "TX", "RTS", "CTS"], - "I2S": ["RX_DATA0", "RX_SYNC", "TX_BCLK", "TX_DATA0", "TX_SYNC"], + "I2S": ["RX_DATA0", "RX_SYNC", "TX_BCLK", "TX_DATA0", "TX_SYNC", "MCLK"], "MQS": ["LEFT", "RIGHT"], } diff --git a/ports/nrf/common-hal/audiobusio/I2SOut.c b/ports/nrf/common-hal/audiobusio/I2SOut.c index 6e68583a03..b03b8fb11e 100644 --- a/ports/nrf/common-hal/audiobusio/I2SOut.c +++ b/ports/nrf/common-hal/audiobusio/I2SOut.c @@ -202,7 +202,10 @@ static void i2s_buffer_fill(audiobusio_i2sout_obj_t *self) { 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) { + const mcu_pin_obj_t *data, const mcu_pin_obj_t *main_clock, bool left_justified) { + if (main_clock != NULL) { + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_main_clock); + } if (instance) { mp_raise_RuntimeError(translate("Device in use")); } diff --git a/ports/raspberrypi/common-hal/audiobusio/I2SOut.c b/ports/raspberrypi/common-hal/audiobusio/I2SOut.c index 62d4058d1d..d9c5027cbd 100644 --- a/ports/raspberrypi/common-hal/audiobusio/I2SOut.c +++ b/ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -103,7 +103,10 @@ void i2sout_reset(void) { // 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) { + const mcu_pin_obj_t *data, const mcu_pin_obj_t *main_clock, bool left_justified) { + if (main_clock != NULL) { + mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_main_clock); + } if (bit_clock->number != word_select->number - 1) { mp_raise_ValueError(translate("Bit clock and word select must be sequential pins")); } diff --git a/shared-bindings/audiobusio/I2SOut.c b/shared-bindings/audiobusio/I2SOut.c index 8c6f1a3a7a..3f697c35eb 100644 --- a/shared-bindings/audiobusio/I2SOut.c +++ b/shared-bindings/audiobusio/I2SOut.c @@ -44,13 +44,15 @@ //| word_select: microcontroller.Pin, //| data: microcontroller.Pin, //| *, -//| left_justified: bool +//| main_clock: microcontroller.Pin = None, +//| left_justified: bool = False //| ) -> None: //| """Create a I2SOut object associated with the given pins. //| //| :param ~microcontroller.Pin bit_clock: The bit clock (or serial clock) pin //| :param ~microcontroller.Pin word_select: The word select (or left/right clock) pin //| :param ~microcontroller.Pin data: The data pin +//| :param ~microcontroller.Pin main_clock: The main clock pin //| :param bool left_justified: True when data bits are aligned with the word select clock. False //| when they are shifted by one to match classic I2S protocol. //| @@ -100,11 +102,12 @@ STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_a mp_raise_NotImplementedError_varg(translate("%q"), MP_QSTR_I2SOut); return NULL; // Not reachable. #else - enum { ARG_bit_clock, ARG_word_select, ARG_data, ARG_left_justified }; + enum { ARG_bit_clock, ARG_word_select, ARG_data, ARG_main_clock, ARG_left_justified }; static const mp_arg_t allowed_args[] = { { MP_QSTR_bit_clock, MP_ARG_OBJ | MP_ARG_REQUIRED }, { MP_QSTR_word_select, MP_ARG_OBJ | MP_ARG_REQUIRED }, { MP_QSTR_data, MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_main_clock, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} }, { MP_QSTR_left_justified, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_bool = false} }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; @@ -113,10 +116,11 @@ STATIC mp_obj_t audiobusio_i2sout_make_new(const mp_obj_type_t *type, size_t n_a const mcu_pin_obj_t *bit_clock = validate_obj_is_free_pin(args[ARG_bit_clock].u_obj, MP_QSTR_bit_clock); const mcu_pin_obj_t *word_select = validate_obj_is_free_pin(args[ARG_word_select].u_obj, MP_QSTR_word_select); const mcu_pin_obj_t *data = validate_obj_is_free_pin(args[ARG_data].u_obj, MP_QSTR_data); + const mcu_pin_obj_t *main_clock = validate_obj_is_free_pin_or_none(args[ARG_main_clock].u_obj, MP_QSTR_main_clock); audiobusio_i2sout_obj_t *self = m_new_obj_with_finaliser(audiobusio_i2sout_obj_t); self->base.type = &audiobusio_i2sout_type; - common_hal_audiobusio_i2sout_construct(self, bit_clock, word_select, data, args[ARG_left_justified].u_bool); + common_hal_audiobusio_i2sout_construct(self, bit_clock, word_select, data, main_clock, args[ARG_left_justified].u_bool); return MP_OBJ_FROM_PTR(self); #endif diff --git a/shared-bindings/audiobusio/I2SOut.h b/shared-bindings/audiobusio/I2SOut.h index 64dcc3bf68..4fa56b5472 100644 --- a/shared-bindings/audiobusio/I2SOut.h +++ b/shared-bindings/audiobusio/I2SOut.h @@ -37,7 +37,7 @@ extern const mp_obj_type_t audiobusio_i2sout_type; 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); + const mcu_pin_obj_t *main_clock, bool left_justified); void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t *self); bool common_hal_audiobusio_i2sout_deinited(audiobusio_i2sout_obj_t *self); From df19aa1646c491ea9f9eb31713322088eea55461 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 17 Aug 2023 11:42:16 -0700 Subject: [PATCH 1494/1712] Update TinyUSB to improve abort handling --- lib/tinyusb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tinyusb b/lib/tinyusb index db59494b1b..1fdf29075d 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit db59494b1b24f7dad26c5c66c85a195a2cf09466 +Subproject commit 1fdf29075d4e613eacfa881166015263797db0f6 From 37d807509fe6dc91d5c50e98658ef526b0c125f2 Mon Sep 17 00:00:00 2001 From: Jozsef Kiraly Date: Thu, 17 Aug 2023 19:00:17 +0100 Subject: [PATCH 1495/1712] port: Add M5Stack M5Paper board target --- .../espressif/boards/m5stack_m5paper/board.c | 100 ++++++++++++++++++ .../boards/m5stack_m5paper/mpconfigboard.h | 51 +++++++++ .../boards/m5stack_m5paper/mpconfigboard.mk | 9 ++ ports/espressif/boards/m5stack_m5paper/pins.c | 63 +++++++++++ .../boards/m5stack_m5paper/sdkconfig | 58 ++++++++++ 5 files changed, 281 insertions(+) create mode 100644 ports/espressif/boards/m5stack_m5paper/board.c create mode 100644 ports/espressif/boards/m5stack_m5paper/mpconfigboard.h create mode 100644 ports/espressif/boards/m5stack_m5paper/mpconfigboard.mk create mode 100644 ports/espressif/boards/m5stack_m5paper/pins.c create mode 100644 ports/espressif/boards/m5stack_m5paper/sdkconfig diff --git a/ports/espressif/boards/m5stack_m5paper/board.c b/ports/espressif/boards/m5stack_m5paper/board.c new file mode 100644 index 0000000000..97dee2ac1c --- /dev/null +++ b/ports/espressif/boards/m5stack_m5paper/board.c @@ -0,0 +1,100 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 fonix232 + * + * 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 "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-bindings/board/__init__.h" + + +const uint8_t display_start_sequence[] = { }; + +const uint8_t display_stop_sequence[] = { }; + +const uint8_t display_refresh_sequence[] = { }; + + +void board_init(void) { + + // TODO: Investigate how to initialise display + + // // Set up the SPI object used to control the display + // busio_spi_obj_t *spi = common_hal_board_create_spi(0); + // common_hal_busio_spi_never_reset(spi); + + // // Set up the DisplayIO pin object + // displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + // bus->base.type = &displayio_fourwire_type; + // common_hal_displayio_fourwire_construct(bus, + // spi, + // &pin_GPIO20, // EPD_DC Command or data + // &pin_GPIO15, // EPD_CS Chip select + // &pin_GPIO23, // EPD_RST Reset + // 1200000, // Baudrate + // 0, // Polarity + // 0); // Phase + + // displayio_epaperdisplay_obj_t *display = &allocate_display()->epaper_display; + // display->base.type = &displayio_epaperdisplay_type; + + // common_hal_displayio_epaperdisplay_construct( + // display, + // bus, + // display_start_sequence, sizeof(display_start_sequence), + // 1.0, // start up time + // display_stop_sequence, sizeof(display_stop_sequence), + // 540, // width + // 960, // height + // 540, // ram_width + // 960, // ram_height + // 0, // colstart + // 0, // rowstart + // 90, // rotation + // NO_COMMAND, // set_column_window_command + // NO_COMMAND, // set_row_window_command + // NO_COMMAND, // set_current_column_command + // NO_COMMAND, // set_current_row_command + // NO_COMMAND, // write_black_ram_command + // false, // black_bits_inverted + // NO_COMMAND, // write_color_ram_command + // false, // color_bits_inverted + // 0x000000, // highlight_color + // refresh_sequence, sizeof(refresh_sequence), + // 28.0, // refresh_time + // &pin_GPIO27, // busy_pin + // false, // busy_state + // 30.0, // seconds_per_frame + // false, // always_toggle_chip_select + // false, // grayscale + // true, // acep + // false, // two_byte_sequence_length + // false // address_little_endian + // ); +} diff --git a/ports/espressif/boards/m5stack_m5paper/mpconfigboard.h b/ports/espressif/boards/m5stack_m5paper/mpconfigboard.h new file mode 100644 index 0000000000..012cb58761 --- /dev/null +++ b/ports/espressif/boards/m5stack_m5paper/mpconfigboard.h @@ -0,0 +1,51 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 fonix232 + * + * 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 "M5Stack M5Paper" +#define MICROPY_HW_MCU_NAME "ESP32" + +#define CIRCUITPY_BOARD_I2C (2) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO22, .sda = &pin_GPIO21}, \ + {.scl = &pin_GPIO32, .sda = &pin_GPIO25}} + +#define CIRCUITPY_BOARD_SPI (1) +#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO14, .mosi = &pin_GPIO12, .miso = &pin_GPIO13}} + +// GPIO16 & GPIO17 are used for PSRAM +// #define CIRCUITPY_BOARD_UART (1) +// #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO17, .rx = &pin_GPIO16}} + +// For entering safe mode +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO39) + +// Explanation of how a user got into safe mode +#define BOARD_USER_SAFE_MODE_ACTION translate("You pressed button DOWN at start up.") + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO3) diff --git a/ports/espressif/boards/m5stack_m5paper/mpconfigboard.mk b/ports/espressif/boards/m5stack_m5paper/mpconfigboard.mk new file mode 100644 index 0000000000..d3e2bb2aac --- /dev/null +++ b/ports/espressif/boards/m5stack_m5paper/mpconfigboard.mk @@ -0,0 +1,9 @@ +CIRCUITPY_CREATOR_ID = 0x10151015 +CIRCUITPY_CREATION_ID = 0x0032000B + +IDF_TARGET = esp32 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 16MB +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_m5paper/pins.c b/ports/espressif/boards/m5stack_m5paper/pins.c new file mode 100644 index 0000000000..5b7ce7a138 --- /dev/null +++ b/ports/espressif/boards/m5stack_m5paper/pins.c @@ -0,0 +1,63 @@ +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + // Power MAIN + { MP_ROM_QSTR(MP_QSTR_POWER_MAIN),MP_ROM_PTR(&pin_GPIO2) }, + + // sd card + { MP_ROM_QSTR(MP_QSTR_SD_CS),MP_ROM_PTR(&pin_GPIO4) }, + + // Power EXT + { MP_ROM_QSTR(MP_QSTR_SD_CS),MP_ROM_PTR(&pin_GPIO5) }, + + // SPI Internal + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO14) }, + + // IT8951 + { MP_ROM_QSTR(MP_QSTR_IT8951_CS), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IT8951_RESET), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_IT8951_BUSY), MP_ROM_PTR(&pin_GPIO27) }, + + // Port C + { MP_ROM_QSTR(MP_QSTR_PORTC_RX), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_PORTC_TX), MP_ROM_PTR(&pin_GPIO19) }, + + // I2C + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO22) }, + + // EPD Power + { MP_ROM_QSTR(MP_QSTR_IT8951_POWER), MP_ROM_PTR(&pin_GPIO23) }, + + // Port A + { MP_ROM_QSTR(MP_QSTR_PORTA_SDA), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_PORTA_SCL), MP_ROM_PTR(&pin_GPIO32) }, + + // Port B + { MP_ROM_QSTR(MP_QSTR_PORTB_IN), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_PORTB_OUT), MP_ROM_PTR(&pin_GPIO33) }, + + // Battery voltage + { MP_ROM_QSTR(MP_QSTR_BATTERY_VOLTAGE), MP_ROM_PTR(&pin_GPIO35) }, + + // Touch + { MP_ROM_QSTR(MP_QSTR_TOUCH_INT), MP_ROM_PTR(&pin_GPIO36) }, + + // buttons + { MP_ROM_QSTR(MP_QSTR_BTN_UP), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_BTN_CENTER), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_BTN_DOWN), 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_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/m5stack_m5paper/sdkconfig b/ports/espressif/boards/m5stack_m5paper/sdkconfig new file mode 100644 index 0000000000..d77fe64525 --- /dev/null +++ b/ports/espressif/boards/m5stack_m5paper/sdkconfig @@ -0,0 +1,58 @@ +CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y +CONFIG_ESP32_SPIRAM_SUPPORT=y +CONFIG_ESP32_REV_MIN_3=y + +# +# SPI RAM config +# +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +#CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=8388608 +# end of SPI RAM config + +# +# PSRAM clock and cs IO for ESP32 +# +CONFIG_D0WD_PSRAM_CLK_IO=17 +CONFIG_D0WD_PSRAM_CS_IO=16 +# end of PSRAM clock and cs IO for ESP32 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +# CONFIG_SPIRAM_SPEED_26M is not set +# CONFIG_SPIRAM_SPEED_20M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskCoreFire" +# end of LWIP + +# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins +### # +### # ESP System Settings +### # +### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y +### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set +### CONFIG_ESP_CONSOLE_UART_CUSTOM=y +### CONFIG_ESP_CONSOLE_NONE is not set +### CONFIG_ESP_CONSOLE_UART=y +### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set +### CONFIG_ESP_CONSOLE_UART_NUM=0 +### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 +### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 +### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +### # end of ESP System Settings From f93022b14203dfe6606ef626a1f52d495e2beffd Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 17 Aug 2023 14:28:33 -0700 Subject: [PATCH 1496/1712] Two tweaks to mclk --- ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c | 8 +++++--- shared-bindings/audiobusio/I2SOut.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c b/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c index cba857a495..43074acc09 100644 --- a/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c +++ b/ports/mimxrt10xx/common-hal/audiobusio/I2SOut.c @@ -131,10 +131,12 @@ void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t *self) { common_hal_reset_pin(self->data); self->data = NULL; - IOMUXC_GPR->GPR1 &= ~(IOMUXC_GPR_GPR1_SAI1_MCLK_DIR_MASK << (self->instance - 1)); + if (self->mclk != NULL) { + IOMUXC_GPR->GPR1 &= ~(IOMUXC_GPR_GPR1_SAI1_MCLK_DIR_MASK << (self->instance - 1)); - common_hal_reset_pin(self->mclk); - self->mclk = NULL; + common_hal_reset_pin(self->mclk); + self->mclk = NULL; + } } void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t *self, diff --git a/shared-bindings/audiobusio/I2SOut.c b/shared-bindings/audiobusio/I2SOut.c index 3f697c35eb..34e18e9cf2 100644 --- a/shared-bindings/audiobusio/I2SOut.c +++ b/shared-bindings/audiobusio/I2SOut.c @@ -44,7 +44,7 @@ //| word_select: microcontroller.Pin, //| data: microcontroller.Pin, //| *, -//| main_clock: microcontroller.Pin = None, +//| main_clock: Optional[microcontroller.Pin] = None, //| left_justified: bool = False //| ) -> None: //| """Create a I2SOut object associated with the given pins. From 37352cf7ec092c9afcf0eb29da929c7751dc7f88 Mon Sep 17 00:00:00 2001 From: Jozsef Kiraly Date: Fri, 18 Aug 2023 11:22:26 +0100 Subject: [PATCH 1497/1712] fix: Apply pre-commit patch --- locale/circuitpython.pot | 4 ++++ ports/espressif/boards/m5stack_m5paper/board.c | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 0759f70c0c..e479a8aa62 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2377,6 +2377,10 @@ msgstr "" msgid "You pressed button A at start up." msgstr "" +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "" diff --git a/ports/espressif/boards/m5stack_m5paper/board.c b/ports/espressif/boards/m5stack_m5paper/board.c index 97dee2ac1c..55d1f3e349 100644 --- a/ports/espressif/boards/m5stack_m5paper/board.c +++ b/ports/espressif/boards/m5stack_m5paper/board.c @@ -60,10 +60,10 @@ void board_init(void) { // 1200000, // Baudrate // 0, // Polarity // 0); // Phase - + // displayio_epaperdisplay_obj_t *display = &allocate_display()->epaper_display; // display->base.type = &displayio_epaperdisplay_type; - + // common_hal_displayio_epaperdisplay_construct( // display, // bus, @@ -96,5 +96,5 @@ void board_init(void) { // true, // acep // false, // two_byte_sequence_length // false // address_little_endian - // ); + // ); } From bfccb77ec1afe9d0634f6868e36ffad8b5914181 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 18 Aug 2023 13:16:16 -0400 Subject: [PATCH 1498/1712] asyncio test fixes and asyncio library updates --- extmod/moduselect.c | 2 +- frozen/Adafruit_CircuitPython_asyncio | 2 +- ports/unix/mpconfigport.h | 1 + py/emitglue.c | 7 +- py/obj.h | 4 + py/objgenerator.c | 103 +++++++++++++------- py/runtime.c | 3 +- tests/extmod/uasyncio_threadsafeflag.py | 79 +++++++++++++++ tests/extmod/uasyncio_threadsafeflag.py.exp | 21 ++++ tests/extmod/websocket_basic.py.exp | 14 --- 10 files changed, 183 insertions(+), 53 deletions(-) create mode 100644 tests/extmod/uasyncio_threadsafeflag.py create mode 100644 tests/extmod/uasyncio_threadsafeflag.py.exp delete mode 100644 tests/extmod/websocket_basic.py.exp diff --git a/extmod/moduselect.c b/extmod/moduselect.c index b68d97bbe5..e41adbc791 100644 --- a/extmod/moduselect.c +++ b/extmod/moduselect.c @@ -383,6 +383,6 @@ const mp_obj_module_t mp_module_uselect = { .globals = (mp_obj_dict_t *)&mp_module_select_globals, }; -MP_REGISTER_MODULE(MP_QSTR_uselect, mp_module_uselect); +MP_REGISTER_MODULE(MP_QSTR_select, mp_module_uselect); #endif // MICROPY_PY_USELECT diff --git a/frozen/Adafruit_CircuitPython_asyncio b/frozen/Adafruit_CircuitPython_asyncio index 596cc896e5..510d4a3bb9 160000 --- a/frozen/Adafruit_CircuitPython_asyncio +++ b/frozen/Adafruit_CircuitPython_asyncio @@ -1 +1 @@ -Subproject commit 596cc896e5c8815caa2a6f405560833193848149 +Subproject commit 510d4a3bb9326a31105622fe1905301a4f543a2c diff --git a/ports/unix/mpconfigport.h b/ports/unix/mpconfigport.h index bcf5ffe5a0..a9e6cf9885 100644 --- a/ports/unix/mpconfigport.h +++ b/ports/unix/mpconfigport.h @@ -36,6 +36,7 @@ // CIRCUITPY #define CIRCUITPY_MICROPYTHON_ADVANCED (1) +#define MICROPY_PY_ASYNC_AWAIT (1) // If the variant did not set a feature level then configure a set of features. #ifndef MICROPY_CONFIG_ROM_LEVEL diff --git a/py/emitglue.c b/py/emitglue.c index 95be7f661a..ed30ea35f2 100644 --- a/py/emitglue.c +++ b/py/emitglue.c @@ -191,6 +191,7 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, const mp_module if ((rc->scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0) { ((mp_obj_base_t *)MP_OBJ_TO_PTR(fun))->type = &mp_type_native_gen_wrap; } + // CIRCUITPY: no support for mp_type_native_coro_wrap, native coroutine objects (yet). break; #endif #if MICROPY_EMIT_INLINE_ASM @@ -203,7 +204,11 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, const mp_module assert(rc->kind == MP_CODE_BYTECODE); fun = mp_obj_new_fun_bc(def_args, rc->fun_data, context, rc->children); // check for generator functions and if so change the type of the object - if ((rc->scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0) { + // A generator is MP_SCOPE_FLAG_ASYNC | MP_SCOPE_FLAG_GENERATOR, + // so check for ASYNC first. + if ((rc->scope_flags & MP_SCOPE_FLAG_ASYNC) != 0) { + ((mp_obj_base_t *)MP_OBJ_TO_PTR(fun))->type = &mp_type_coro_wrap; + } else if ((rc->scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0) { ((mp_obj_base_t *)MP_OBJ_TO_PTR(fun))->type = &mp_type_gen_wrap; } diff --git a/py/obj.h b/py/obj.h index 81b0eab06c..f28563dfe4 100644 --- a/py/obj.h +++ b/py/obj.h @@ -738,6 +738,10 @@ extern const mp_obj_type_t mp_type_super; extern const mp_obj_type_t mp_type_gen_wrap; extern const mp_obj_type_t mp_type_native_gen_wrap; extern const mp_obj_type_t mp_type_gen_instance; +// CIRCUITPY +extern const mp_obj_type_t mp_type_coro_wrap; +// CIRCUITPY +extern const mp_obj_type_t mp_type_coro_instance; extern const mp_obj_type_t mp_type_fun_builtin_0; extern const mp_obj_type_t mp_type_fun_builtin_1; extern const mp_obj_type_t mp_type_fun_builtin_2; diff --git a/py/objgenerator.c b/py/objgenerator.c index 32f4af43c7..4040cd291d 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -55,23 +55,23 @@ typedef struct _mp_obj_gen_instance_t { // mp_const_none: Not-running, no exception. // MP_OBJ_NULL: Running, no exception. // other: Not running, pending exception. - bool coroutine_generator; mp_obj_t pend_exc; mp_code_state_t code_state; } mp_obj_gen_instance_t; STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) { - // A generating function is just a bytecode function with type mp_type_gen_wrap + // A generating or coroutine function is just a bytecode function + // with type mp_type_gen_wrap or mp_type_coro_wrap. mp_obj_fun_bc_t *self_fun = MP_OBJ_TO_PTR(self_in); // bytecode prelude: get state size and exception stack size const uint8_t *ip = self_fun->bytecode; MP_BC_PRELUDE_SIG_DECODE(ip); - // allocate the generator object, with room for local stack and exception stack + // allocate the generator or coroutine object, with room for local stack and exception stack mp_obj_gen_instance_t *o = mp_obj_malloc_var(mp_obj_gen_instance_t, byte, n_state * sizeof(mp_obj_t) + n_exc_stack * sizeof(mp_exc_stack_t), - &mp_type_gen_instance); + self_fun->base.type == &mp_type_gen_wrap ? &mp_type_gen_instance : &mp_type_coro_instance); o->pend_exc = mp_const_none; o->code_state.fun_bc = self_fun; @@ -93,6 +93,19 @@ const mp_obj_type_t mp_type_gen_wrap = { ), }; +const mp_obj_type_t mp_type_coro_wrap = { + { &mp_type_type }, + .flags = MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_EXTENDED, + .name = MP_QSTR_coroutine, + #if MICROPY_PY_FUNCTION_ATTRS + .attr = mp_obj_fun_bc_attr, + #endif + MP_TYPE_EXTENDED_FIELDS( + .call = gen_wrap_call, + .unary_op = mp_generic_unary_op, + ), +}; + /******************************************************************************/ // native generator wrapper @@ -167,20 +180,26 @@ const mp_obj_type_t mp_type_native_gen_wrap = { STATIC void gen_instance_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { (void)kind; mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in); - #if MICROPY_PY_ASYNC_AWAIT - if (self->coroutine_generator) { - mp_printf(print, "<%q object '%q' at %p>", MP_QSTR_coroutine, mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self); - } else { - mp_printf(print, "<%q object '%q' at %p>", MP_QSTR_generator, mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self); - } - #else mp_printf(print, "", mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self); - #endif } +// CIRCUITPY +#if MICROPY_PY_ASYNC_AWAIT +STATIC void coro_instance_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) { + (void)kind; + mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in); + mp_printf(print, "", mp_obj_fun_get_name(MP_OBJ_FROM_PTR(self->code_state.fun_bc)), self); +} +#endif + mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_value, mp_obj_t throw_value, mp_obj_t *ret_val) { MP_STACK_CHECK(); - mp_check_self(mp_obj_is_type(self_in, &mp_type_gen_instance)); + // CIRCUITPY + // note that self may have as its type either gen or coro, + // both of which are stored as an mp_obj_gen_instance_t . + mp_check_self( + mp_obj_is_type(self_in, &mp_type_gen_instance) || + mp_obj_is_type(self_in, &mp_type_coro_instance)); mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in); if (self->code_state.ip == 0) { // Trying to resume an already stopped generator. @@ -188,7 +207,6 @@ mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_value, mp_ *ret_val = mp_const_none; return MP_VM_RETURN_NORMAL; } - // Ensure the generator cannot be reentered during execution if (self->pend_exc == MP_OBJ_NULL) { mp_raise_ValueError(MP_ERROR_TEXT("generator already executing")); @@ -285,6 +303,7 @@ mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_value, mp_ STATIC mp_obj_t gen_resume_and_raise(mp_obj_t self_in, mp_obj_t send_value, mp_obj_t throw_value, bool raise_stop_iteration) { mp_obj_t ret; switch (mp_obj_gen_resume(self_in, send_value, throw_value, &ret)) { + case MP_VM_RETURN_NORMAL: default: // A normal return is a StopIteration, either raise it or return @@ -307,12 +326,6 @@ STATIC mp_obj_t gen_resume_and_raise(mp_obj_t self_in, mp_obj_t send_value, mp_o } STATIC mp_obj_t gen_instance_iternext(mp_obj_t self_in) { - #if MICROPY_PY_ASYNC_AWAIT - mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in); - if (self->coroutine_generator) { - mp_raise_TypeError(MP_ERROR_TEXT("'coroutine' object is not an iterator")); - } - #endif return gen_resume_and_raise(self_in, mp_const_none, MP_OBJ_NULL, false); } @@ -322,21 +335,12 @@ STATIC mp_obj_t gen_instance_send(mp_obj_t self_in, mp_obj_t send_value) { STATIC MP_DEFINE_CONST_FUN_OBJ_2(gen_instance_send_obj, gen_instance_send); #if MICROPY_PY_ASYNC_AWAIT -STATIC mp_obj_t gen_instance_await(mp_obj_t self_in) { - mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in); - if (!self->coroutine_generator) { - // Pretend like a generator does not have this coroutine behavior. - // Pay no attention to the dir() behind the curtain - mp_raise_msg_varg(&mp_type_AttributeError, MP_ERROR_TEXT("type object '%q' has no attribute '%q'"), - MP_QSTR_generator, MP_QSTR___await__); - } - // You can directly call send on a coroutine generator or you can __await__ then send on the return of that. - return self; +STATIC mp_obj_t coro_instance_await(mp_obj_t self_in) { + return self_in; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(gen_instance_await_obj, gen_instance_await); +STATIC MP_DEFINE_CONST_FUN_OBJ_1(coro_instance_await_obj, coro_instance_await); #endif -STATIC mp_obj_t gen_instance_close(mp_obj_t self_in); STATIC mp_obj_t gen_instance_throw(size_t n_args, const mp_obj_t *args) { // The signature of this function is: throw(type[, value[, traceback]]) // CPython will pass all given arguments through the call chain and process them @@ -408,9 +412,6 @@ STATIC const mp_rom_map_elem_t gen_instance_locals_dict_table[] = { #if MICROPY_PY_GENERATOR_PEND_THROW { MP_ROM_QSTR(MP_QSTR_pend_throw), MP_ROM_PTR(&gen_instance_pend_throw_obj) }, #endif - #if MICROPY_PY_ASYNC_AWAIT - { MP_ROM_QSTR(MP_QSTR___await__), MP_ROM_PTR(&gen_instance_await_obj) }, - #endif }; STATIC MP_DEFINE_CONST_DICT(gen_instance_locals_dict, gen_instance_locals_dict_table); @@ -427,3 +428,35 @@ const mp_obj_type_t mp_type_gen_instance = { .iternext = gen_instance_iternext, ), }; + +#if MICROPY_PY_ASYNC_AWAIT +// CIRCUITPY +// coroutine instance locals dict and type +// same as generator, but with addition of __await()__. +STATIC const mp_rom_map_elem_t coro_instance_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&gen_instance_close_obj) }, + { MP_ROM_QSTR(MP_QSTR_send), MP_ROM_PTR(&gen_instance_send_obj) }, + { MP_ROM_QSTR(MP_QSTR_throw), MP_ROM_PTR(&gen_instance_throw_obj) }, + #if MICROPY_PY_GENERATOR_PEND_THROW + { MP_ROM_QSTR(MP_QSTR_pend_throw), MP_ROM_PTR(&gen_instance_pend_throw_obj) }, + #endif + #if MICROPY_PY_ASYNC_AWAIT + { MP_ROM_QSTR(MP_QSTR___await__), MP_ROM_PTR(&coro_instance_await_obj) }, + #endif +}; + +STATIC MP_DEFINE_CONST_DICT(coro_instance_locals_dict, coro_instance_locals_dict_table); + +const mp_obj_type_t mp_type_coro_instance = { + { &mp_type_type }, + .flags = MP_TYPE_FLAG_EXTENDED, + .name = MP_QSTR_coroutine, + .print = coro_instance_print, + .locals_dict = (mp_obj_dict_t *)&coro_instance_locals_dict, + MP_TYPE_EXTENDED_FIELDS( + .unary_op = mp_generic_unary_op, + .getiter = mp_identity_getiter, + .iternext = gen_instance_iternext, + ), +}; +#endif diff --git a/py/runtime.c b/py/runtime.c index da7343d0c6..aeb9a7954b 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -1415,7 +1415,8 @@ mp_vm_return_kind_t mp_resume(mp_obj_t self_in, mp_obj_t send_value, mp_obj_t th assert((send_value != MP_OBJ_NULL) ^ (throw_value != MP_OBJ_NULL)); const mp_obj_type_t *type = mp_obj_get_type(self_in); - if (type == &mp_type_gen_instance) { + // CIRCUITPY distinguishes generators and coroutines. + if (type == &mp_type_gen_instance || type == &mp_type_coro_instance) { return mp_obj_gen_resume(self_in, send_value, throw_value, ret_val); } diff --git a/tests/extmod/uasyncio_threadsafeflag.py b/tests/extmod/uasyncio_threadsafeflag.py new file mode 100644 index 0000000000..4e002a3d2a --- /dev/null +++ b/tests/extmod/uasyncio_threadsafeflag.py @@ -0,0 +1,79 @@ +# Test Event class + +try: + import uasyncio as asyncio +except ImportError: + print("SKIP") + raise SystemExit + + +import micropython + +try: + micropython.schedule +except AttributeError: + print("SKIP") + raise SystemExit + + +try: + # Unix port can't select/poll on user-defined types. + import uselect as select + + poller = select.poll() + poller.register(asyncio.ThreadSafeFlag()) +except TypeError: + print("SKIP") + raise SystemExit + + +async def task(id, flag): + print("task", id) + await flag.wait() + print("task", id, "done") + + +def set_from_schedule(flag): + print("schedule") + flag.set() + print("schedule done") + + +async def main(): + flag = asyncio.ThreadSafeFlag() + + # Set the flag from within the loop. + t = asyncio.create_task(task(1, flag)) + print("yield") + await asyncio.sleep(0) + print("set event") + flag.set() + print("yield") + await asyncio.sleep(0) + print("wait task") + await t + + # Set the flag from scheduler context. + print("----") + t = asyncio.create_task(task(2, flag)) + print("yield") + await asyncio.sleep(0) + print("set event") + micropython.schedule(set_from_schedule, flag) + print("yield") + await asyncio.sleep(0) + print("wait task") + await t + + # Flag already set. + print("----") + print("set event") + flag.set() + t = asyncio.create_task(task(3, flag)) + print("yield") + await asyncio.sleep(0) + print("wait task") + await t + + +asyncio.run(main()) diff --git a/tests/extmod/uasyncio_threadsafeflag.py.exp b/tests/extmod/uasyncio_threadsafeflag.py.exp new file mode 100644 index 0000000000..aef4e479ba --- /dev/null +++ b/tests/extmod/uasyncio_threadsafeflag.py.exp @@ -0,0 +1,21 @@ +yield +task 1 +set event +yield +wait task +task 1 done +---- +yield +task 2 +set event +yield +schedule +schedule done +wait task +task 2 done +---- +set event +yield +task 3 +task 3 done +wait task diff --git a/tests/extmod/websocket_basic.py.exp b/tests/extmod/websocket_basic.py.exp deleted file mode 100644 index 2d7657b535..0000000000 --- a/tests/extmod/websocket_basic.py.exp +++ /dev/null @@ -1,14 +0,0 @@ -b'ping' -b'ping' -b'\x81\x04pong' -b'pingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingpingping' -b'\x81~\x00\x80pongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpongpong' -b'\x00\x00\x00\x00' -b'' -b'\x81\x02\x88\x00' -b'ping' -b'pong' -0 -1 -2 -ioctl: EINVAL: True From d9ed21ea07b04f7ec61129a64ab5c7f8c7c9043f Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 18 Aug 2023 13:30:45 -0400 Subject: [PATCH 1499/1712] pre-commit --- ports/espressif/boards/adafruit_metro_esp32s3/pins.c | 2 +- ports/stm/common-hal/digitalio/DigitalInOut.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c index 3fc348311e..ccc9d6fc6f 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s3/pins.c +++ b/ports/espressif/boards/adafruit_metro_esp32s3/pins.c @@ -72,7 +72,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO48) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS),MP_ROM_PTR(&pin_GPIO21) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO21) }, { MP_OBJ_NEW_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, { MP_OBJ_NEW_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, diff --git a/ports/stm/common-hal/digitalio/DigitalInOut.c b/ports/stm/common-hal/digitalio/DigitalInOut.c index 51b05907f7..a57790cd1b 100644 --- a/ports/stm/common-hal/digitalio/DigitalInOut.c +++ b/ports/stm/common-hal/digitalio/DigitalInOut.c @@ -142,13 +142,13 @@ digitalinout_result_t common_hal_digitalio_digitalinout_set_pull( switch (pull) { case PULL_UP: - LL_GPIO_SetPinPull(pin_port(self->pin->port), pin_mask(self->pin->number),LL_GPIO_PULL_UP); + LL_GPIO_SetPinPull(pin_port(self->pin->port), pin_mask(self->pin->number), LL_GPIO_PULL_UP); break; case PULL_DOWN: - LL_GPIO_SetPinPull(pin_port(self->pin->port), pin_mask(self->pin->number),LL_GPIO_PULL_DOWN); + LL_GPIO_SetPinPull(pin_port(self->pin->port), pin_mask(self->pin->number), LL_GPIO_PULL_DOWN); break; case PULL_NONE: - LL_GPIO_SetPinPull(pin_port(self->pin->port), pin_mask(self->pin->number),LL_GPIO_PULL_NO); + LL_GPIO_SetPinPull(pin_port(self->pin->port), pin_mask(self->pin->number), LL_GPIO_PULL_NO); break; default: break; From 9c91448bc2936062ad5136210ad6038c93318898 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 16 Aug 2023 09:05:21 -0500 Subject: [PATCH 1500/1712] Re-add usercmodule sources & endorse new extra_coverage output --- examples/usercmodule/cexample/examplemodule.c | 34 ++++++++++++++ .../usercmodule/cexample/micropython.cmake | 15 +++++++ examples/usercmodule/cexample/micropython.mk | 9 ++++ examples/usercmodule/cppexample/example.cpp | 17 +++++++ .../usercmodule/cppexample/examplemodule.c | 25 +++++++++++ .../usercmodule/cppexample/examplemodule.h | 5 +++ .../usercmodule/cppexample/micropython.cmake | 16 +++++++ .../usercmodule/cppexample/micropython.mk | 12 +++++ examples/usercmodule/micropython.cmake | 10 +++++ tests/unix/extra_coverage.py.exp | 44 ++++++++++--------- 10 files changed, 167 insertions(+), 20 deletions(-) create mode 100644 examples/usercmodule/cexample/examplemodule.c create mode 100644 examples/usercmodule/cexample/micropython.cmake create mode 100644 examples/usercmodule/cexample/micropython.mk create mode 100644 examples/usercmodule/cppexample/example.cpp create mode 100644 examples/usercmodule/cppexample/examplemodule.c create mode 100644 examples/usercmodule/cppexample/examplemodule.h create mode 100644 examples/usercmodule/cppexample/micropython.cmake create mode 100644 examples/usercmodule/cppexample/micropython.mk create mode 100644 examples/usercmodule/micropython.cmake diff --git a/examples/usercmodule/cexample/examplemodule.c b/examples/usercmodule/cexample/examplemodule.c new file mode 100644 index 0000000000..93a58be2ed --- /dev/null +++ b/examples/usercmodule/cexample/examplemodule.c @@ -0,0 +1,34 @@ +// Include MicroPython API. +#include "py/runtime.h" + +// This is the function which will be called from Python as cexample.add_ints(a, b). +STATIC mp_obj_t example_add_ints(mp_obj_t a_obj, mp_obj_t b_obj) { + // Extract the ints from the micropython input objects. + int a = mp_obj_get_int(a_obj); + int b = mp_obj_get_int(b_obj); + + // Calculate the addition and convert to MicroPython object. + return mp_obj_new_int(a + b); +} +// Define a Python reference to the function above. +STATIC MP_DEFINE_CONST_FUN_OBJ_2(example_add_ints_obj, example_add_ints); + +// Define all properties of the module. +// Table entries are key/value pairs of the attribute name (a string) +// and the MicroPython object reference. +// All identifiers and strings are written as MP_QSTR_xxx and will be +// optimized to word-sized integers by the build system (interned strings). +STATIC const mp_rom_map_elem_t example_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cexample) }, + { MP_ROM_QSTR(MP_QSTR_add_ints), MP_ROM_PTR(&example_add_ints_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(example_module_globals, example_module_globals_table); + +// Define module object. +const mp_obj_module_t example_user_cmodule = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&example_module_globals, +}; + +// Register the module to make it available in Python. +MP_REGISTER_MODULE(MP_QSTR_cexample, example_user_cmodule); diff --git a/examples/usercmodule/cexample/micropython.cmake b/examples/usercmodule/cexample/micropython.cmake new file mode 100644 index 0000000000..ba076a16b2 --- /dev/null +++ b/examples/usercmodule/cexample/micropython.cmake @@ -0,0 +1,15 @@ +# Create an INTERFACE library for our C module. +add_library(usermod_cexample INTERFACE) + +# Add our source files to the lib +target_sources(usermod_cexample INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/examplemodule.c +) + +# Add the current directory as an include directory. +target_include_directories(usermod_cexample INTERFACE + ${CMAKE_CURRENT_LIST_DIR} +) + +# Link our INTERFACE library to the usermod target. +target_link_libraries(usermod INTERFACE usermod_cexample) diff --git a/examples/usercmodule/cexample/micropython.mk b/examples/usercmodule/cexample/micropython.mk new file mode 100644 index 0000000000..dbfe3c5cbd --- /dev/null +++ b/examples/usercmodule/cexample/micropython.mk @@ -0,0 +1,9 @@ +EXAMPLE_MOD_DIR := $(USERMOD_DIR) + +# Add all C files to SRC_USERMOD. +SRC_USERMOD += $(EXAMPLE_MOD_DIR)/examplemodule.c + +# We can add our module folder to include paths if needed +# This is not actually needed in this example. +CFLAGS_USERMOD += -I$(EXAMPLE_MOD_DIR) +CEXAMPLE_MOD_DIR := $(USERMOD_DIR) diff --git a/examples/usercmodule/cppexample/example.cpp b/examples/usercmodule/cppexample/example.cpp new file mode 100644 index 0000000000..06809732a4 --- /dev/null +++ b/examples/usercmodule/cppexample/example.cpp @@ -0,0 +1,17 @@ +extern "C" { +#include + +// Here we implement the function using C++ code, but since it's +// declaration has to be compatible with C everything goes in extern "C" scope. +mp_obj_t cppfunc(mp_obj_t a_obj, mp_obj_t b_obj) { + // Prove we have (at least) C++11 features. + const auto a = mp_obj_get_int(a_obj); + const auto b = mp_obj_get_int(b_obj); + const auto sum = [&]() { + return mp_obj_new_int(a + b); + } (); + // Prove we're being scanned for QSTRs. + mp_obj_t tup[] = {sum, MP_ROM_QSTR(MP_QSTR_hellocpp)}; + return mp_obj_new_tuple(2, tup); +} +} diff --git a/examples/usercmodule/cppexample/examplemodule.c b/examples/usercmodule/cppexample/examplemodule.c new file mode 100644 index 0000000000..5c84eccd79 --- /dev/null +++ b/examples/usercmodule/cppexample/examplemodule.c @@ -0,0 +1,25 @@ +#include + +// Define a Python reference to the function we'll make available. +// See example.cpp for the definition. +STATIC MP_DEFINE_CONST_FUN_OBJ_2(cppfunc_obj, cppfunc); + +// Define all properties of the module. +// Table entries are key/value pairs of the attribute name (a string) +// and the MicroPython object reference. +// All identifiers and strings are written as MP_QSTR_xxx and will be +// optimized to word-sized integers by the build system (interned strings). +STATIC const mp_rom_map_elem_t cppexample_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_cppexample) }, + { MP_ROM_QSTR(MP_QSTR_cppfunc), MP_ROM_PTR(&cppfunc_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(cppexample_module_globals, cppexample_module_globals_table); + +// Define module object. +const mp_obj_module_t cppexample_user_cmodule = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&cppexample_module_globals, +}; + +// Register the module to make it available in Python. +MP_REGISTER_MODULE(MP_QSTR_cppexample, cppexample_user_cmodule); diff --git a/examples/usercmodule/cppexample/examplemodule.h b/examples/usercmodule/cppexample/examplemodule.h new file mode 100644 index 0000000000..d89384a630 --- /dev/null +++ b/examples/usercmodule/cppexample/examplemodule.h @@ -0,0 +1,5 @@ +// Include MicroPython API. +#include "py/runtime.h" + +// Declare the function we'll make available in Python as cppexample.cppfunc(). +extern mp_obj_t cppfunc(mp_obj_t a_obj, mp_obj_t b_obj); diff --git a/examples/usercmodule/cppexample/micropython.cmake b/examples/usercmodule/cppexample/micropython.cmake new file mode 100644 index 0000000000..6da972c94e --- /dev/null +++ b/examples/usercmodule/cppexample/micropython.cmake @@ -0,0 +1,16 @@ +# Create an INTERFACE library for our CPP module. +add_library(usermod_cppexample INTERFACE) + +# Add our source files to the library. +target_sources(usermod_cppexample INTERFACE + ${CMAKE_CURRENT_LIST_DIR}/example.cpp + ${CMAKE_CURRENT_LIST_DIR}/examplemodule.c +) + +# Add the current directory as an include directory. +target_include_directories(usermod_cppexample INTERFACE + ${CMAKE_CURRENT_LIST_DIR} +) + +# Link our INTERFACE library to the usermod target. +target_link_libraries(usermod INTERFACE usermod_cppexample) diff --git a/examples/usercmodule/cppexample/micropython.mk b/examples/usercmodule/cppexample/micropython.mk new file mode 100644 index 0000000000..0071d4fcc7 --- /dev/null +++ b/examples/usercmodule/cppexample/micropython.mk @@ -0,0 +1,12 @@ +CPPEXAMPLE_MOD_DIR := $(USERMOD_DIR) + +# Add our source files to the respective variables. +SRC_USERMOD += $(CPPEXAMPLE_MOD_DIR)/examplemodule.c +SRC_USERMOD_CXX += $(CPPEXAMPLE_MOD_DIR)/example.cpp + +# Add our module directory to the include path. +CFLAGS_USERMOD += -I$(CPPEXAMPLE_MOD_DIR) +CXXFLAGS_USERMOD += -I$(CPPEXAMPLE_MOD_DIR) -std=c++11 + +# We use C++ features so have to link against the standard library. +LDFLAGS_USERMOD += -lstdc++ diff --git a/examples/usercmodule/micropython.cmake b/examples/usercmodule/micropython.cmake new file mode 100644 index 0000000000..b9802401fa --- /dev/null +++ b/examples/usercmodule/micropython.cmake @@ -0,0 +1,10 @@ +# This top-level micropython.cmake is responsible for listing +# the individual modules we want to include. +# Paths are absolute, and ${CMAKE_CURRENT_LIST_DIR} can be +# used to prefix subdirectories. + +# Add the C example. +include(${CMAKE_CURRENT_LIST_DIR}/cexample/micropython.cmake) + +# Add the CPP example. +include(${CMAKE_CURRENT_LIST_DIR}/cppexample/micropython.cmake) diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index 8de06a2fdc..b9742461e4 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -18,7 +18,7 @@ abc 0x0 0x0 # tracked allocation -m_tracked_head = 0 +m_tracked_head = 0x0 0 1 1 1 2 1 @@ -35,7 +35,7 @@ m_tracked_head = 0 5 1 6 1 7 1 -m_tracked_head = 0 +m_tracked_head = 0x0 # vstr tests sts @@ -48,30 +48,29 @@ RuntimeError: ame__ mport -builtins micropython __future__ _asyncio -_thread _uasyncio aesio array -audiocore audiomixer binascii bitmaptools -btree cexample cmath collections -cppexample displayio errno ffi -framebuf gc hashlib json -math qrio rainbowio re -struct synthio sys termios -traceback ubinascii uctypes uerrno -uheapq uio ujson ulab -ulab.numpy ulab.numpy.fft ulab.numpy.linalg -ulab.scipy ulab.scipy.linalg -ulab.scipy.optimize ulab.scipy.signal -ulab.scipy.special ulab.utils uos -urandom ure uselect utime -utimeq uzlib zlib +builtins micropython __future__ _thread +_uasyncio aesio array audiocore +audiomixer bitmaptools cexample cmath +collections cppexample displayio gc +math qrio rainbowio struct +synthio termios traceback ubinascii +uctypes uerrno uhashlib uheapq +uio ujson ulab ulab.numpy +ulab.numpy.fft ulab.numpy.linalg ulab.scipy +ulab.scipy.linalg ulab.scipy.optimize +ulab.scipy.signal ulab.scipy.special +ulab.utils uos urandom ure +uselect usys utime utimeq +uzlib zlib ime utime utimeq argv atexit byteorder exc_info exit getsizeof implementation maxsize -modules path platform stderr -stdin stdout version version_info +modules path platform print_exception +ps1 ps2 stderr stdin +stdout tracebacklimit version version_info ementation # attrtuple (start=1, stop=2, step=3) @@ -199,4 +198,9 @@ frzstr_pkg2.mod frzmpy_pkg2.mod 1 ZeroDivisionError +\ + +X +'\x1b' +b'\x00\xff' NULL From 73d231c54c8bf6eb09d9d840198591dd3228d3b3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 16 Aug 2023 09:16:15 -0500 Subject: [PATCH 1501/1712] update invalid-mpy test and result --- tests/micropython/import_mpy_invalid.py.exp | 7 +++---- tests/micropython/import_mpy_native.py | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/micropython/import_mpy_invalid.py.exp b/tests/micropython/import_mpy_invalid.py.exp index 432287028e..1727ea1cea 100644 --- a/tests/micropython/import_mpy_invalid.py.exp +++ b/tests/micropython/import_mpy_invalid.py.exp @@ -1,4 +1,3 @@ -mod0 RuntimeError Corrupt .mpy file -mod1 RuntimeError Corrupt .mpy file -mod2 ValueError Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info. -mod3 ValueError Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info. +mod0 ValueError incompatible .mpy file +mod1 ValueError incompatible .mpy file +mod2 ValueError incompatible .mpy file diff --git a/tests/micropython/import_mpy_native.py b/tests/micropython/import_mpy_native.py index 24ea0a17e3..69e1c40798 100644 --- a/tests/micropython/import_mpy_native.py +++ b/tests/micropython/import_mpy_native.py @@ -109,7 +109,7 @@ user_files = { # create and mount a user filesystem uos.mount(UserFS(user_files), "/userfs") -usys.path.append("/userfs") +sys.path.append("/userfs") # import .mpy files from the user filesystem for i in range(len(user_files)): @@ -122,4 +122,4 @@ for i in range(len(user_files)): # unmount and undo path addition uos.umount("/userfs") -usys.path.pop() +sys.path.pop() From 4a9632d154c8299e43b69fa6c3f412898850fd51 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 16 Aug 2023 09:17:07 -0500 Subject: [PATCH 1502/1712] update test result --- tests/micropython/import_mpy_native.py.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/micropython/import_mpy_native.py.exp b/tests/micropython/import_mpy_native.py.exp index 0b478aa77f..320cac09d8 100644 --- a/tests/micropython/import_mpy_native.py.exp +++ b/tests/micropython/import_mpy_native.py.exp @@ -1,3 +1,3 @@ -mod0 ValueError incompatible native .mpy architecture +mod0 ValueError incompatible .mpy arch mod1 OK mod2 OK From 49159efe557b46de318a23b3f151585792a03d8c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 16 Aug 2023 10:11:35 -0500 Subject: [PATCH 1503/1712] Allow natmods to build again (they don't work, however) --- supervisor/shared/translate/translate.h | 4 +--- tools/mpy_ld.py | 14 -------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/supervisor/shared/translate/translate.h b/supervisor/shared/translate/translate.h index 8bb343cabe..8779fb6310 100644 --- a/supervisor/shared/translate/translate.h +++ b/supervisor/shared/translate/translate.h @@ -33,9 +33,7 @@ #include "supervisor/shared/translate/compressed_string.h" // Map MicroPython's error messages to our translations. -#if defined(MICROPY_ENABLE_DYNRUNTIME) && MICROPY_ENABLE_DYNRUNTIME -#define MP_ERROR_TEXT(x) (x) -#else +#if !defined(MICROPY_ENABLE_DYNRUNTIME) || !MICROPY_ENABLE_DYNRUNTIME #define MP_ERROR_TEXT(x) translate(x) #endif diff --git a/tools/mpy_ld.py b/tools/mpy_ld.py index 3b50aef8c4..09ea90dcd1 100755 --- a/tools/mpy_ld.py +++ b/tools/mpy_ld.py @@ -757,7 +757,6 @@ def link_objects(env, native_qstr_vals_len, native_qstr_objs_len): bytearray(native_qstr_vals_len * env.arch.qstr_entry_size), env.arch.qstr_entry_size, ) - env.sections.append(env.qstr_val_section) # Create section to contain mp_native_obj_table env.obj_table_section = Section( @@ -765,7 +764,6 @@ def link_objects(env, native_qstr_vals_len, native_qstr_objs_len): bytearray(native_qstr_objs_len * env.arch.word_size), env.arch.word_size, ) - env.sections.append(env.qstr_obj_section) # Resolve unknown symbols mp_fun_table_sec = Section(".external.mp_fun_table", b"", 0) @@ -944,17 +942,6 @@ def build_mpy(env, entry_offset, fmpy, native_qstr_vals, native_qstr_objs): # MPY: machine code out.write_bytes(env.full_text) - # MPY: n_qstr_link (assumes little endian) - out.write_uint(len(native_qstr_vals) + len(native_qstr_objs)) - for q in range(len(native_qstr_vals)): - off = env.qstr_val_section.addr + q * env.arch.qstr_entry_size - out.write_uint(off << 2) - out.write_qstr(native_qstr_vals[q]) - for q in range(len(native_qstr_objs)): - off = env.qstr_obj_section.addr + q * env.arch.word_size - out.write_uint(off << 2 | 3) - out.write_qstr(native_qstr_objs[q]) - # MPY: scope_flags scope_flags = MP_SCOPE_FLAG_VIPERRELOC if len(env.full_rodata): @@ -967,7 +954,6 @@ def build_mpy(env, entry_offset, fmpy, native_qstr_vals, native_qstr_objs): if len(env.full_rodata): rodata_const_table_idx = 1 out.write_uint(len(env.full_rodata)) - out.write_bytes(env.full_rodata) if len(env.full_bss): bss_const_table_idx = 2 out.write_uint(len(env.full_bss)) From ca057618ff8a5a43dce14071d28dc9379ee5bdc1 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 16 Aug 2023 10:12:41 -0500 Subject: [PATCH 1504/1712] Skip the import_mpy_native_gc test, it is known to be broken As CircuitPython does not ship any builds with native modules enabled, this is not something to spend time on right now. --- tests/micropython/import_mpy_native_gc.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/micropython/import_mpy_native_gc.py b/tests/micropython/import_mpy_native_gc.py index bc8dcafdc7..4c496585bb 100644 --- a/tests/micropython/import_mpy_native_gc.py +++ b/tests/micropython/import_mpy_native_gc.py @@ -1,5 +1,9 @@ # Test that native code loaded from a .mpy file is retained after a GC. +# This is known not to work in CircuitPython. Fixes welcome. +print("SKIP") +raise SystemExit + try: import gc, sys, uio, uos From 100de9e5b9b321d2010e63668c26b91755fad057 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 18 Aug 2023 12:27:49 -0500 Subject: [PATCH 1505/1712] add a script to make it easy to endorse test output Invoke it on the "out" file and it's moved to the correct "exp" file, ready to git add & git commit. --- tests/endorse.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 tests/endorse.py diff --git a/tests/endorse.py b/tests/endorse.py new file mode 100755 index 0000000000..c87424329f --- /dev/null +++ b/tests/endorse.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +import os +import sys +import pathlib + +for f in sys.argv[1:]: + if not f.endswith(".out"): + print(f"{f}:0: Not a .out file") + continue + p = pathlib.Path(f).stem + a, _, b = p.partition("_") + print(a, b) + p = pathlib.Path(a) / (b + ".exp") + print(f"{p}: Updating expected result from {f}") + os.rename(f, p) From a42e03c188d80192e5aad1d3666a9746e792d619 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 18 Aug 2023 13:02:43 -0500 Subject: [PATCH 1506/1712] fetch additional submodules during testing --- tools/ci_fetch_deps.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/ci_fetch_deps.py b/tools/ci_fetch_deps.py index 15ef6a51cd..caaea8cea8 100644 --- a/tools/ci_fetch_deps.py +++ b/tools/ci_fetch_deps.py @@ -79,6 +79,10 @@ def main(): submodules = ["extmod/ulab", "lib/", "tools/"] elif TARGET == "tests": submodules = ["extmod/ulab", "lib/", "tools/"] + submodules_tags = [ + "frozen/Adafruit_CircuitPython_asyncio", + "frozen/Adafruit_CircuitPython_Ticks", + ] elif TARGET == "docs": # used in .readthedocs.yml to generate RTD submodules = ["extmod/ulab"] From 1a47c5f326ce6973db227c0430acb38eeb6606a8 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Fri, 18 Aug 2023 22:05:29 +0200 Subject: [PATCH 1507/1712] Reset cwd before looking for files to run Make sure we only look for the files in the root directory. --- main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.c b/main.c index d70e718b6d..2a448490a5 100644 --- a/main.c +++ b/main.c @@ -68,6 +68,8 @@ #include "shared-bindings/microcontroller/Processor.h" #include "shared-bindings/supervisor/Runtime.h" +#include "shared-bindings/os/__init__.h" + #if CIRCUITPY_ALARM #include "shared-bindings/alarm/__init__.h" #endif @@ -408,6 +410,9 @@ STATIC bool run_code_py(safe_mode_t safe_mode, bool *simulate_reset) { usb_setup_with_vm(); #endif + // Make sure we are in the root directory before looking at files. + common_hal_os_chdir("/"); + // Check if a different run file has been allocated if (next_code_allocation) { next_code_info_t *info = ((next_code_info_t *)next_code_allocation->ptr); From e43c2fb7badb7b2dd33757fe5c4ad9d780e3f20c Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 18 Aug 2023 22:53:14 -0400 Subject: [PATCH 1508/1712] pre-commit uncrustify --- ports/cxd56/mkspk/elf32.h | 4 ++-- ports/espressif/bindings/espnow/Peer.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ports/cxd56/mkspk/elf32.h b/ports/cxd56/mkspk/elf32.h index e19ce210a6..96cb51c195 100644 --- a/ports/cxd56/mkspk/elf32.h +++ b/ports/cxd56/mkspk/elf32.h @@ -53,13 +53,13 @@ #define ELF32_ST_BIND(i) ((i) >> 4) #define ELF32_ST_TYPE(i) ((i) & 0xf) -#define ELF32_ST_INFO(b,t) (((b) << 4) | ((t) & 0xf)) +#define ELF32_ST_INFO(b, t) (((b) << 4) | ((t) & 0xf)) /* Definitions for Elf32_Rel*::r_info */ #define ELF32_R_SYM(i) ((i) >> 8) #define ELF32_R_TYPE(i) ((i) & 0xff) -#define ELF32_R_INFO(s,t) (((s) << 8) | ((t) & 0xff)) +#define ELF32_R_INFO(s, t) (((s) << 8) | ((t) & 0xff)) #define ELF_R_SYM(i) ELF32_R_SYM(i) diff --git a/ports/espressif/bindings/espnow/Peer.c b/ports/espressif/bindings/espnow/Peer.c index 98b65c5bdc..4cceec1498 100644 --- a/ports/espressif/bindings/espnow/Peer.c +++ b/ports/espressif/bindings/espnow/Peer.c @@ -55,11 +55,11 @@ STATIC mp_obj_t espnow_peer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_mac, ARG_lmk, ARG_channel, ARG_interface, ARG_encrypted }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_mac, MP_ARG_OBJ | MP_ARG_REQUIRED }, - { MP_QSTR_lmk, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = mp_const_none } }, - { MP_QSTR_channel, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 0 } }, - { MP_QSTR_interface,MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 0 } }, - { MP_QSTR_encrypted,MP_ARG_BOOL | MP_ARG_KW_ONLY,{ .u_bool = false } }, + { MP_QSTR_mac, MP_ARG_OBJ | MP_ARG_REQUIRED }, + { MP_QSTR_lmk, MP_ARG_OBJ | MP_ARG_KW_ONLY, { .u_obj = mp_const_none } }, + { MP_QSTR_channel, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 0 } }, + { MP_QSTR_interface, MP_ARG_INT | MP_ARG_KW_ONLY, { .u_int = 0 } }, + { MP_QSTR_encrypted, MP_ARG_BOOL | MP_ARG_KW_ONLY, { .u_bool = false } }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; From 7933bb0ebee16700b0d8e67fcd5fc66e994cd4f3 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 19 Aug 2023 10:07:46 -0400 Subject: [PATCH 1509/1712] improve hard fault message --- locale/circuitpython.pot | 13 +++++-------- supervisor/shared/safe_mode.c | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 282d229856..ab31c53e02 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -182,6 +182,7 @@ msgid "%q must be 1 when %q is True" msgstr "" #: py/argcheck.c shared-bindings/gifio/GifWriter.c +#: shared-module/gifio/OnDiskGif.c msgid "%q must be <= %d" msgstr "" @@ -1006,10 +1007,6 @@ msgstr "" msgid "Failed to write internal flash." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "" @@ -1085,6 +1082,10 @@ msgstr "" msgid "Half duplex SPI is not implemented" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/canio/CAN.c #: ports/stm/common-hal/sdioio/SDCard.c @@ -1950,10 +1951,6 @@ msgstr "" msgid "Size not supported" msgstr "" -#: ports/raspberrypi/common-hal/alarm/SleepMemory.c -msgid "Sleep Memory not available" -msgstr "" - #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index 0ab97fc9a9..62280c7d82 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -209,7 +209,7 @@ void print_safe_mode_message(safe_mode_t reason) { message = translate("Failed to write internal flash."); break; case SAFE_MODE_HARD_FAULT: - message = translate("Fault detected by hardware."); + message = translate("Hard fault: memory access or instruction error."); break; case SAFE_MODE_INTERRUPT_ERROR: message = translate("Interrupt error."); From 10a022db87ae67f0fb0f05677d572e38b0096a1f Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 19 Aug 2023 12:14:58 -0400 Subject: [PATCH 1510/1712] consolidate and shorten some error messages --- locale/circuitpython.pot | 30 ++++++++----------- ports/cxd56/common-hal/camera/Camera.c | 2 +- shared-bindings/displayio/Display.c | 2 +- shared-bindings/displayio/TileGrid.c | 2 +- .../framebufferio/FramebufferDisplay.c | 2 +- shared-bindings/struct/__init__.c | 4 +-- shared-bindings/vectorio/VectorShape.c | 2 +- shared-module/struct/__init__.c | 2 +- supervisor/shared/safe_mode.c | 4 +-- 9 files changed, 23 insertions(+), 27 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index ab31c53e02..cdbb5fa24a 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -31,8 +31,8 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" #: supervisor/shared/safe_mode.c @@ -633,11 +633,6 @@ msgstr "" msgid "Buffer is not a bytearray." msgstr "" -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -657,6 +652,12 @@ msgstr "" msgid "Buffer too short by %d bytes" msgstr "" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "" @@ -1786,6 +1787,10 @@ msgstr "" msgid "Polygon needs at least 3 points" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "" @@ -2016,10 +2021,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "" @@ -2605,8 +2606,7 @@ msgstr "" msgid "buffer slices must be of equal length" msgstr "" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "" @@ -3863,10 +3863,6 @@ msgstr "" msgid "pixel coordinates out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" diff --git a/ports/cxd56/common-hal/camera/Camera.c b/ports/cxd56/common-hal/camera/Camera.c index 606ad0f1e6..37b5f63d17 100644 --- a/ports/cxd56/common-hal/camera/Camera.c +++ b/ports/cxd56/common-hal/camera/Camera.c @@ -184,7 +184,7 @@ size_t common_hal_camera_take_picture(camera_obj_t *self, uint8_t *buffer, size_ mp_raise_ValueError(translate("Size not supported")); } if (!camera_check_buffer_length(width, height, format, len)) { - mp_raise_ValueError(translate("Buffer is too small")); + mp_raise_ValueError(translate("Buffer too small")); } if (!camera_check_format(format)) { mp_raise_ValueError(translate("Format not supported")); diff --git a/shared-bindings/displayio/Display.c b/shared-bindings/displayio/Display.c index c7fb6dadf4..5576e2cbfc 100644 --- a/shared-bindings/displayio/Display.c +++ b/shared-bindings/displayio/Display.c @@ -506,7 +506,7 @@ STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *po displayio_display_core_fill_area(&self->core, &area, mask, result_buffer); return result; } else { - mp_raise_ValueError(translate("Buffer is too small")); + mp_raise_ValueError(translate("Buffer too small")); } } MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_fill_row_obj, 1, displayio_display_obj_fill_row); diff --git a/shared-bindings/displayio/TileGrid.c b/shared-bindings/displayio/TileGrid.c index f2e16985c3..e9eeea40ff 100644 --- a/shared-bindings/displayio/TileGrid.c +++ b/shared-bindings/displayio/TileGrid.c @@ -351,7 +351,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(displayio_tilegrid_get_pixel_shader_obj, displayio_til STATIC mp_obj_t displayio_tilegrid_obj_set_pixel_shader(mp_obj_t self_in, mp_obj_t pixel_shader) { displayio_tilegrid_t *self = native_tilegrid(self_in); if (!mp_obj_is_type(pixel_shader, &displayio_palette_type) && !mp_obj_is_type(pixel_shader, &displayio_colorconverter_type)) { - mp_raise_TypeError(translate("pixel_shader must be displayio.Palette or displayio.ColorConverter")); + mp_raise_TypeError_varg(translate("unsupported %q type"), MP_QSTR_pixel_shader); } common_hal_displayio_tilegrid_set_pixel_shader(self, pixel_shader); diff --git a/shared-bindings/framebufferio/FramebufferDisplay.c b/shared-bindings/framebufferio/FramebufferDisplay.c index a1ad6a0bac..d57081e16f 100644 --- a/shared-bindings/framebufferio/FramebufferDisplay.c +++ b/shared-bindings/framebufferio/FramebufferDisplay.c @@ -317,7 +317,7 @@ STATIC mp_obj_t framebufferio_framebufferdisplay_obj_fill_row(size_t n_args, con displayio_display_core_fill_area(&self->core, &area, mask, result_buffer); return result; } else { - mp_raise_ValueError(translate("Buffer is too small")); + mp_raise_ValueError(translate("Buffer too small")); } } MP_DEFINE_CONST_FUN_OBJ_KW(framebufferio_framebufferdisplay_fill_row_obj, 1, framebufferio_framebufferdisplay_obj_fill_row); diff --git a/shared-bindings/struct/__init__.c b/shared-bindings/struct/__init__.c index 5b63a15f15..61d90dc8bb 100644 --- a/shared-bindings/struct/__init__.c +++ b/shared-bindings/struct/__init__.c @@ -92,7 +92,7 @@ STATIC mp_obj_t struct_pack_into(size_t n_args, const mp_obj_t *args) { // negative offsets are relative to the end of the buffer offset = (mp_int_t)bufinfo.len + offset; if (offset < 0) { - mp_raise_RuntimeError(translate("buffer too small")); + mp_raise_RuntimeError(translate("Buffer too small")); } } byte *p = (byte *)bufinfo.buf; @@ -151,7 +151,7 @@ STATIC mp_obj_t struct_unpack_from(size_t n_args, const mp_obj_t *pos_args, mp_m // negative offsets are relative to the end of the buffer offset = bufinfo.len + offset; if (offset < 0) { - mp_raise_RuntimeError(translate("buffer too small")); + mp_raise_RuntimeError(translate("Buffer too small")); } } p += offset; diff --git a/shared-bindings/vectorio/VectorShape.c b/shared-bindings/vectorio/VectorShape.c index e5c806b943..a7bfde4744 100644 --- a/shared-bindings/vectorio/VectorShape.c +++ b/shared-bindings/vectorio/VectorShape.c @@ -226,7 +226,7 @@ STATIC mp_obj_t vectorio_vector_shape_obj_set_pixel_shader(mp_obj_t wrapper_shap vectorio_vector_shape_t *self = MP_OBJ_TO_PTR(draw_protocol->draw_get_protocol_self(wrapper_shape)); if (!mp_obj_is_type(pixel_shader, &displayio_palette_type) && !mp_obj_is_type(pixel_shader, &displayio_colorconverter_type)) { - mp_raise_TypeError(translate("pixel_shader must be displayio.Palette or displayio.ColorConverter")); + mp_raise_TypeError_varg(translate("unsupported %q type"), MP_QSTR_pixel_shader); } common_hal_vectorio_vector_shape_set_pixel_shader(self, pixel_shader); diff --git a/shared-module/struct/__init__.c b/shared-module/struct/__init__.c index 11e122915c..5fc3d30f25 100644 --- a/shared-module/struct/__init__.c +++ b/shared-module/struct/__init__.c @@ -126,7 +126,7 @@ void shared_modules_struct_pack_into(mp_obj_t fmt_in, byte *p, byte *end_p, size const mp_uint_t total_sz = shared_modules_struct_calcsize(fmt_in); if (p + total_sz > end_p) { - mp_raise_RuntimeError(translate("buffer too small")); + mp_raise_RuntimeError(translate("Buffer too small")); } size_t i = 0; diff --git a/supervisor/shared/safe_mode.c b/supervisor/shared/safe_mode.c index 62280c7d82..6507b77e97 100644 --- a/supervisor/shared/safe_mode.c +++ b/supervisor/shared/safe_mode.c @@ -154,7 +154,7 @@ void print_safe_mode_message(safe_mode_t reason) { switch (reason) { case SAFE_MODE_BROWNOUT: - message = translate("The power dipped. Make sure you are providing enough power."); + message = translate("Power dipped. Make sure you are providing enough power."); break; case SAFE_MODE_USER: #if defined(BOARD_USER_SAFE_MODE_ACTION) @@ -228,7 +228,7 @@ void print_safe_mode_message(safe_mode_t reason) { break; } serial_write_compressed(message); - serial_write_compressed(translate("\nPlease file an issue with your program at https://github.com/adafruit/circuitpython/issues.")); + serial_write_compressed(translate("\nPlease file an issue with your program at github.com/adafruit/circuitpython/issues.")); } // Always tell user how to get out of safe mode. From 994bd2371fa89f4075cd83614f9e2d359fa32747 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 19 Aug 2023 12:07:07 -0500 Subject: [PATCH 1511/1712] canio: add a doc note about boards like CAN feather that use mcp2515 --- conf.py | 1 + shared-bindings/canio/__init__.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/conf.py b/conf.py index 645961c457..ba6e01f6a9 100644 --- a/conf.py +++ b/conf.py @@ -443,6 +443,7 @@ texinfo_documents = [ # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = {"cpython": ('https://docs.python.org/3/', None), "register": ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None), + "mcp2515": ('https://circuitpython.readthedocs.io/projects/mcp2515/en/latest/', None), "typing": ('https://circuitpython.readthedocs.io/projects/adafruit-circuitpython-typing/en/latest/', None)} # Adapted from sphinxcontrib-redirects diff --git a/shared-bindings/canio/__init__.c b/shared-bindings/canio/__init__.c index ecef7ebde6..42edd68e38 100644 --- a/shared-bindings/canio/__init__.c +++ b/shared-bindings/canio/__init__.c @@ -27,7 +27,10 @@ //| """CAN bus access //| //| The `canio` module contains low level classes to support the CAN bus -//| protocol. +//| protocol on microcontrollers that have built-in CAN peripherals. +//| +//| Boards like the Adafruit RP2040 CAN Bus Feather that use an MCP2515 or +//| compatible chip use the `mcp2515:adafruit_mcp2515` module instead. //| //| CAN and Listener classes change hardware state and should be deinitialized when they //| are no longer needed if the program continues after use. To do so, either From 412e242d28f9377b852ed8721068f63f935073f4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 19 Aug 2023 13:44:04 -0500 Subject: [PATCH 1512/1712] Fix `mpy-cross -X native` --- mpy-cross/mpconfigport.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/mpy-cross/mpconfigport.h b/mpy-cross/mpconfigport.h index fd667e6617..099c372fdd 100644 --- a/mpy-cross/mpconfigport.h +++ b/mpy-cross/mpconfigport.h @@ -38,15 +38,16 @@ #endif #endif -// CIRCUITPY: native emitters not supported -#define MICROPY_EMIT_X64 (!CIRCUITPY) -#define MICROPY_EMIT_X86 (!CIRCUITPY) -#define MICROPY_EMIT_THUMB (!CIRCUITPY) -#define MICROPY_EMIT_INLINE_THUMB (!CIRCUITPY) -#define MICROPY_EMIT_ARM (!CIRCUITPY) -#define MICROPY_EMIT_XTENSA (!CIRCUITPY) -#define MICROPY_EMIT_INLINE_XTENSA (!CIRCUITPY) -#define MICROPY_EMIT_XTENSAWIN (!CIRCUITPY) +#define MICROPY_EMIT_X64 (1) +#define MICROPY_EMIT_X86 (1) +#define MICROPY_EMIT_THUMB (1) +#define MICROPY_EMIT_INLINE_THUMB (1) +#define MICROPY_EMIT_INLINE_THUMB_ARMV7M (1) +#define MICROPY_EMIT_INLINE_THUMB_FLOAT (1) +#define MICROPY_EMIT_ARM (1) +#define MICROPY_EMIT_XTENSA (1) +#define MICROPY_EMIT_INLINE_XTENSA (1) +#define MICROPY_EMIT_XTENSAWIN (1) #define MICROPY_DYNAMIC_COMPILER (1) #define MICROPY_COMP_CONST_FOLDING (1) From 6598fc0c429350d726c83f0f2103555177d29945 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 19 Aug 2023 13:45:06 -0500 Subject: [PATCH 1513/1712] pre-commit modifies these additional files on my system (WHY?) --- .../peripherals/stm32f4/stm32f401xe/periph.c | 86 +++++++++---------- .../peripherals/stm32f4/stm32f411xe/pins.c | 32 +++---- .../peripherals/stm32l4/stm32l4r5xx/pins.c | 32 +++---- 3 files changed, 75 insertions(+), 75 deletions(-) diff --git a/ports/stm/peripherals/stm32f4/stm32f401xe/periph.c b/ports/stm/peripherals/stm32f4/stm32f401xe/periph.c index 23664999b0..582a3f27ca 100644 --- a/ports/stm/peripherals/stm32f4/stm32f401xe/periph.c +++ b/ports/stm/peripherals/stm32f4/stm32f401xe/periph.c @@ -127,47 +127,47 @@ TIM_TypeDef *mcu_tim_banks[14] = {TIM1, TIM2, TIM3, TIM4, TIM5, NULL, NULL, NULL // #define TIM(index, alt, channel, tim_pin) const mcu_tim_pin_obj_t mcu_tim_pin_list[44] = { - TIM(2,1,1,&pin_PA00), - TIM(5,2,1,&pin_PA00), - TIM(2,1,2,&pin_PA01), - TIM(5,2,2,&pin_PA01), - TIM(2,1,3,&pin_PA02), - TIM(5,2,3,&pin_PA02), - TIM(2,1,4,&pin_PA03), - TIM(5,2,4,&pin_PA03), - TIM(9,3,1,&pin_PA02), - TIM(9,3,2,&pin_PA03), - TIM(3,2,1,&pin_PA06), - TIM(3,2,2,&pin_PA07), - TIM(1,1,1,&pin_PA08), - TIM(1,1,2,&pin_PA09), - TIM(1,1,3,&pin_PA10), - TIM(1,1,4,&pin_PA11), - TIM(2,1,1,&pin_PA15), - TIM(3,2,3,&pin_PB00), - TIM(3,2,4,&pin_PB01), - TIM(2,1,2,&pin_PB03), - TIM(3,2,1,&pin_PB04), - TIM(3,2,2,&pin_PB05), - TIM(4,2,1,&pin_PB06), - TIM(4,2,2,&pin_PB07), - TIM(4,2,3,&pin_PB08), - TIM(10,2,1,&pin_PB08), - TIM(4,2,4,&pin_PB09), - TIM(11,2,1,&pin_PB09), - TIM(2,1,3,&pin_PB10), - TIM(3,2,1,&pin_PC06), - TIM(3,2,2,&pin_PC07), - TIM(3,2,3,&pin_PC08), - TIM(3,2,4,&pin_PC09), - TIM(4,2,1,&pin_PD12), - TIM(4,2,2,&pin_PD13), - TIM(4,2,3,&pin_PD14), - TIM(4,2,4,&pin_PD15), - TIM(9,3,1,&pin_PE05), - TIM(9,3,2,&pin_PE06), - TIM(1,1,1,&pin_PE09), - TIM(1,1,2,&pin_PE11), - TIM(1,1,3,&pin_PE13), - TIM(1,1,4,&pin_PE14), + TIM(2, 1, 1, &pin_PA00), + TIM(5, 2, 1, &pin_PA00), + TIM(2, 1, 2, &pin_PA01), + TIM(5, 2, 2, &pin_PA01), + TIM(2, 1, 3, &pin_PA02), + TIM(5, 2, 3, &pin_PA02), + TIM(2, 1, 4, &pin_PA03), + TIM(5, 2, 4, &pin_PA03), + TIM(9, 3, 1, &pin_PA02), + TIM(9, 3, 2, &pin_PA03), + TIM(3, 2, 1, &pin_PA06), + TIM(3, 2, 2, &pin_PA07), + TIM(1, 1, 1, &pin_PA08), + TIM(1, 1, 2, &pin_PA09), + TIM(1, 1, 3, &pin_PA10), + TIM(1, 1, 4, &pin_PA11), + TIM(2, 1, 1, &pin_PA15), + TIM(3, 2, 3, &pin_PB00), + TIM(3, 2, 4, &pin_PB01), + TIM(2, 1, 2, &pin_PB03), + TIM(3, 2, 1, &pin_PB04), + TIM(3, 2, 2, &pin_PB05), + TIM(4, 2, 1, &pin_PB06), + TIM(4, 2, 2, &pin_PB07), + TIM(4, 2, 3, &pin_PB08), + TIM(10, 2, 1, &pin_PB08), + TIM(4, 2, 4, &pin_PB09), + TIM(11, 2, 1, &pin_PB09), + TIM(2, 1, 3, &pin_PB10), + TIM(3, 2, 1, &pin_PC06), + TIM(3, 2, 2, &pin_PC07), + TIM(3, 2, 3, &pin_PC08), + TIM(3, 2, 4, &pin_PC09), + TIM(4, 2, 1, &pin_PD12), + TIM(4, 2, 2, &pin_PD13), + TIM(4, 2, 3, &pin_PD14), + TIM(4, 2, 4, &pin_PD15), + TIM(9, 3, 1, &pin_PE05), + TIM(9, 3, 2, &pin_PE06), + TIM(1, 1, 1, &pin_PE09), + TIM(1, 1, 2, &pin_PE11), + TIM(1, 1, 3, &pin_PE13), + TIM(1, 1, 4, &pin_PE14), }; diff --git a/ports/stm/peripherals/stm32f4/stm32f411xe/pins.c b/ports/stm/peripherals/stm32f4/stm32f411xe/pins.c index a155970bb0..8593fc1517 100644 --- a/ports/stm/peripherals/stm32f4/stm32f411xe/pins.c +++ b/ports/stm/peripherals/stm32f4/stm32f411xe/pins.c @@ -38,25 +38,25 @@ const mcu_pin_obj_t pin_PC13 = PIN(2, 13, NO_ADC); // anti-tamp const mcu_pin_obj_t pin_PC14 = PIN(2, 14, NO_ADC); // OSC32_IN const mcu_pin_obj_t pin_PC15 = PIN(2, 15, NO_ADC); // OSC32_OUT -const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1,10)); -const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1,11)); -const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_1,12)); -const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_1,13)); +const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1, 10)); +const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1, 11)); +const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_1, 12)); +const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_1, 13)); -const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1,0)); -const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1,1)); -const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1,2)); -const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1,3)); -const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1,4)); -const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1,5)); -const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1,6)); -const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1,7)); +const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1, 0)); +const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1, 1)); +const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1, 2)); +const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1, 3)); +const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1, 4)); +const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1, 5)); +const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1, 6)); +const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1, 7)); -const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_1,14)); -const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_1,15)); +const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_1, 14)); +const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_1, 15)); -const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1,8)); -const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1,9)); +const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1, 8)); +const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1, 9)); const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC); const mcu_pin_obj_t pin_PE07 = PIN(4, 7, NO_ADC); diff --git a/ports/stm/peripherals/stm32l4/stm32l4r5xx/pins.c b/ports/stm/peripherals/stm32l4/stm32l4r5xx/pins.c index e6ef178c52..82fdb45554 100644 --- a/ports/stm/peripherals/stm32l4/stm32l4r5xx/pins.c +++ b/ports/stm/peripherals/stm32l4/stm32l4r5xx/pins.c @@ -30,14 +30,14 @@ #include STM32_HAL_H -const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1,5)); -const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1,6)); -const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1,7)); -const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1,8)); -const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1,9)); -const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1,10)); -const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1,11)); -const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1,12)); +const mcu_pin_obj_t pin_PA00 = PIN(0, 0, ADC_INPUT(ADC_1, 5)); +const mcu_pin_obj_t pin_PA01 = PIN(0, 1, ADC_INPUT(ADC_1, 6)); +const mcu_pin_obj_t pin_PA02 = PIN(0, 2, ADC_INPUT(ADC_1, 7)); +const mcu_pin_obj_t pin_PA03 = PIN(0, 3, ADC_INPUT(ADC_1, 8)); +const mcu_pin_obj_t pin_PA04 = PIN(0, 4, ADC_INPUT(ADC_1, 9)); +const mcu_pin_obj_t pin_PA05 = PIN(0, 5, ADC_INPUT(ADC_1, 10)); +const mcu_pin_obj_t pin_PA06 = PIN(0, 6, ADC_INPUT(ADC_1, 11)); +const mcu_pin_obj_t pin_PA07 = PIN(0, 7, ADC_INPUT(ADC_1, 12)); const mcu_pin_obj_t pin_PA08 = PIN(0, 8, NO_ADC); const mcu_pin_obj_t pin_PA09 = PIN(0, 9, NO_ADC); const mcu_pin_obj_t pin_PA10 = PIN(0, 10, NO_ADC); @@ -46,8 +46,8 @@ const mcu_pin_obj_t pin_PA12 = PIN(0, 12, NO_ADC); const mcu_pin_obj_t pin_PA13 = PIN(0, 13, NO_ADC); const mcu_pin_obj_t pin_PA14 = PIN(0, 14, NO_ADC); const mcu_pin_obj_t pin_PA15 = PIN(0, 15, NO_ADC); -const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1,15)); -const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1,16)); +const mcu_pin_obj_t pin_PB00 = PIN(1, 0, ADC_INPUT(ADC_1, 15)); +const mcu_pin_obj_t pin_PB01 = PIN(1, 1, ADC_INPUT(ADC_1, 16)); const mcu_pin_obj_t pin_PB02 = PIN(1, 2, NO_ADC); const mcu_pin_obj_t pin_PB03 = PIN(1, 3, NO_ADC); const mcu_pin_obj_t pin_PB04 = PIN(1, 4, NO_ADC); @@ -62,12 +62,12 @@ const mcu_pin_obj_t pin_PB12 = PIN(1, 12, NO_ADC); const mcu_pin_obj_t pin_PB13 = PIN(1, 13, NO_ADC); const mcu_pin_obj_t pin_PB14 = PIN(1, 14, NO_ADC); const mcu_pin_obj_t pin_PB15 = PIN(1, 15, NO_ADC); -const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1,1)); -const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1,2)); -const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_1,3)); -const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_1,4)); -const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_1,13)); -const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_1,14)); +const mcu_pin_obj_t pin_PC00 = PIN(2, 0, ADC_INPUT(ADC_1, 1)); +const mcu_pin_obj_t pin_PC01 = PIN(2, 1, ADC_INPUT(ADC_1, 2)); +const mcu_pin_obj_t pin_PC02 = PIN(2, 2, ADC_INPUT(ADC_1, 3)); +const mcu_pin_obj_t pin_PC03 = PIN(2, 3, ADC_INPUT(ADC_1, 4)); +const mcu_pin_obj_t pin_PC04 = PIN(2, 4, ADC_INPUT(ADC_1, 13)); +const mcu_pin_obj_t pin_PC05 = PIN(2, 5, ADC_INPUT(ADC_1, 14)); const mcu_pin_obj_t pin_PC06 = PIN(2, 6, NO_ADC); const mcu_pin_obj_t pin_PC07 = PIN(2, 7, NO_ADC); const mcu_pin_obj_t pin_PC08 = PIN(2, 8, NO_ADC); From a94301122a1cdc3fb85fb0667576f31b709b2ee6 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 19 Aug 2023 16:50:04 -0500 Subject: [PATCH 1514/1712] Make natmods work again. And put back our magic number, because our bytecode format differs from upstream drop btree & framebuf natmods, they had additional problems I didn't want to fix right now. --- .github/workflows/run-tests.yml | 2 - docs/reference/mpyfiles.rst | 4 +- examples/natmod/.gitignore | 1 + examples/natmod/features0/Makefile | 14 +++ examples/natmod/features0/features0.c | 40 ++++++++ examples/natmod/features1/Makefile | 14 +++ examples/natmod/features1/features1.c | 106 ++++++++++++++++++++++ examples/natmod/features2/Makefile | 14 +++ examples/natmod/features2/main.c | 83 +++++++++++++++++ examples/natmod/features2/prod.c | 9 ++ examples/natmod/features2/prod.h | 1 + examples/natmod/features2/test.py | 29 ++++++ examples/natmod/features3/Makefile | 14 +++ examples/natmod/features3/features3.c | 60 ++++++++++++ examples/natmod/uheapq/Makefile | 13 +++ examples/natmod/uheapq/uheapq.c | 16 ++++ examples/natmod/urandom/Makefile | 13 +++ examples/natmod/urandom/urandom.c | 33 +++++++ examples/natmod/ure/Makefile | 13 +++ examples/natmod/ure/ure.c | 78 ++++++++++++++++ examples/natmod/uzlib/Makefile | 13 +++ examples/natmod/uzlib/uzlib.c | 40 ++++++++ py/dynruntime.h | 6 ++ py/persistentcode.c | 6 +- py/runtime0.h | 1 + tests/micropython/import_mpy_invalid.py | 4 +- tests/micropython/import_mpy_native.py | 6 +- tests/micropython/import_mpy_native_gc.py | 8 +- tools/analyze_mpy.py | 4 +- tools/mpy-tool.py | 5 +- tools/mpy_ld.py | 12 ++- tools/pyboard.py | 2 +- 32 files changed, 636 insertions(+), 28 deletions(-) create mode 100644 examples/natmod/.gitignore create mode 100644 examples/natmod/features0/Makefile create mode 100644 examples/natmod/features0/features0.c create mode 100644 examples/natmod/features1/Makefile create mode 100644 examples/natmod/features1/features1.c create mode 100644 examples/natmod/features2/Makefile create mode 100644 examples/natmod/features2/main.c create mode 100644 examples/natmod/features2/prod.c create mode 100644 examples/natmod/features2/prod.h create mode 100644 examples/natmod/features2/test.py create mode 100644 examples/natmod/features3/Makefile create mode 100644 examples/natmod/features3/features3.c create mode 100644 examples/natmod/uheapq/Makefile create mode 100644 examples/natmod/uheapq/uheapq.c create mode 100644 examples/natmod/urandom/Makefile create mode 100644 examples/natmod/urandom/urandom.c create mode 100644 examples/natmod/ure/Makefile create mode 100644 examples/natmod/ure/ure.c create mode 100644 examples/natmod/uzlib/Makefile create mode 100644 examples/natmod/uzlib/uzlib.c diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 44146662f2..76422b1c3d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -55,8 +55,6 @@ jobs: run: | make -C examples/natmod/features1 make -C examples/natmod/features2 - make -C examples/natmod/btree - make -C examples/natmod/framebuf make -C examples/natmod/uheapq make -C examples/natmod/urandom make -C examples/natmod/ure diff --git a/docs/reference/mpyfiles.rst b/docs/reference/mpyfiles.rst index 4995672b52..b65f62f9ca 100644 --- a/docs/reference/mpyfiles.rst +++ b/docs/reference/mpyfiles.rst @@ -66,7 +66,7 @@ If importing an .mpy file fails then try the following: print() * Check the validity of the .mpy file by inspecting the first two bytes of - the file. The first byte should be an uppercase 'M' and the second byte + the file. The first byte should be an uppercase 'C' and the second byte will be the version number, which should match the system version from above. If it doesn't match then rebuild the .mpy file. @@ -144,7 +144,7 @@ The .mpy header is: ====== ================================ size field ====== ================================ -byte value 0x4d (ASCII 'M') +byte value 0x43 (ASCII 'C') byte .mpy version number byte feature flags byte number of bits in a small int diff --git a/examples/natmod/.gitignore b/examples/natmod/.gitignore new file mode 100644 index 0000000000..4815d20f06 --- /dev/null +++ b/examples/natmod/.gitignore @@ -0,0 +1 @@ +*.mpy diff --git a/examples/natmod/features0/Makefile b/examples/natmod/features0/Makefile new file mode 100644 index 0000000000..57490df90a --- /dev/null +++ b/examples/natmod/features0/Makefile @@ -0,0 +1,14 @@ +# Location of top-level MicroPython directory +MPY_DIR = ../../.. + +# Name of module +MOD = features0 + +# Source files (.c or .py) +SRC = features0.c + +# Architecture to build for (x86, x64, armv7m, xtensa, xtensawin) +ARCH = x64 + +# Include to get the rules for compiling and linking the module +include $(MPY_DIR)/py/dynruntime.mk diff --git a/examples/natmod/features0/features0.c b/examples/natmod/features0/features0.c new file mode 100644 index 0000000000..1b1867a3bc --- /dev/null +++ b/examples/natmod/features0/features0.c @@ -0,0 +1,40 @@ +/* This example demonstrates the following features in a native module: + - defining a simple function exposed to Python + - defining a local, helper C function + - getting and creating integer objects +*/ + +// Include the header file to get access to the MicroPython API +#include "py/dynruntime.h" + +// Helper function to compute factorial +STATIC mp_int_t factorial_helper(mp_int_t x) { + if (x == 0) { + return 1; + } + return x * factorial_helper(x - 1); +} + +// This is the function which will be called from Python, as factorial(x) +STATIC mp_obj_t factorial(mp_obj_t x_obj) { + // Extract the integer from the MicroPython input object + mp_int_t x = mp_obj_get_int(x_obj); + // Calculate the factorial + mp_int_t result = factorial_helper(x); + // Convert the result to a MicroPython integer object and return it + return mp_obj_new_int(result); +} +// Define a Python reference to the function above +STATIC MP_DEFINE_CONST_FUN_OBJ_1(factorial_obj, factorial); + +// This is the entry point and is called when the module is imported +mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { + // This must be first, it sets up the globals dict and other things + MP_DYNRUNTIME_INIT_ENTRY + + // Make the function available in the module's namespace + mp_store_global(MP_QSTR_factorial, MP_OBJ_FROM_PTR(&factorial_obj)); + + // This must be last, it restores the globals dict + MP_DYNRUNTIME_INIT_EXIT +} diff --git a/examples/natmod/features1/Makefile b/examples/natmod/features1/Makefile new file mode 100644 index 0000000000..010640daf9 --- /dev/null +++ b/examples/natmod/features1/Makefile @@ -0,0 +1,14 @@ +# Location of top-level MicroPython directory +MPY_DIR = ../../.. + +# Name of module +MOD = features1 + +# Source files (.c or .py) +SRC = features1.c + +# Architecture to build for (x86, x64, armv7m, xtensa, xtensawin) +ARCH = x64 + +# Include to get the rules for compiling and linking the module +include $(MPY_DIR)/py/dynruntime.mk diff --git a/examples/natmod/features1/features1.c b/examples/natmod/features1/features1.c new file mode 100644 index 0000000000..a5e82252a1 --- /dev/null +++ b/examples/natmod/features1/features1.c @@ -0,0 +1,106 @@ +/* This example demonstrates the following features in a native module: + - defining simple functions exposed to Python + - defining local, helper C functions + - defining constant integers and strings exposed to Python + - getting and creating integer objects + - creating Python lists + - raising exceptions + - allocating memory + - BSS and constant data (rodata) + - relocated pointers in rodata +*/ + +// Include the header file to get access to the MicroPython API +#include "py/dynruntime.h" + +// BSS (zero) data +uint16_t data16[4]; + +// Constant data (rodata) +const uint8_t table8[] = { 0, 1, 1, 2, 3, 5, 8, 13 }; +const uint16_t table16[] = { 0x1000, 0x2000 }; + +// Constant data pointing to BSS/constant data +uint16_t *const table_ptr16a[] = { &data16[0], &data16[1], &data16[2], &data16[3] }; +const uint16_t *const table_ptr16b[] = { &table16[0], &table16[1] }; + +// A simple function that adds its 2 arguments (must be integers) +STATIC mp_obj_t add(mp_obj_t x_in, mp_obj_t y_in) { + mp_int_t x = mp_obj_get_int(x_in); + mp_int_t y = mp_obj_get_int(y_in); + return mp_obj_new_int(x + y); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(add_obj, add); + +// A local helper function (not exposed to Python) +STATIC mp_int_t fibonacci_helper(mp_int_t x) { + if (x < MP_ARRAY_SIZE(table8)) { + return table8[x]; + } else { + return fibonacci_helper(x - 1) + fibonacci_helper(x - 2); + } +} + +// A function which computes Fibonacci numbers +STATIC mp_obj_t fibonacci(mp_obj_t x_in) { + mp_int_t x = mp_obj_get_int(x_in); + if (x < 0) { + mp_raise_ValueError(MP_ERROR_TEXT("can't compute negative Fibonacci number")); + } + return mp_obj_new_int(fibonacci_helper(x)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(fibonacci_obj, fibonacci); + +// A function that accesses the BSS data +STATIC mp_obj_t access(size_t n_args, const mp_obj_t *args) { + if (n_args == 0) { + // Create a list holding all items from data16 + mp_obj_list_t *lst = MP_OBJ_TO_PTR(mp_obj_new_list(MP_ARRAY_SIZE(data16), NULL)); + for (int i = 0; i < MP_ARRAY_SIZE(data16); ++i) { + lst->items[i] = mp_obj_new_int(data16[i]); + } + return MP_OBJ_FROM_PTR(lst); + } else if (n_args == 1) { + // Get one item from data16 + mp_int_t idx = mp_obj_get_int(args[0]) & 3; + return mp_obj_new_int(data16[idx]); + } else { + // Set one item in data16 (via table_ptr16a) + mp_int_t idx = mp_obj_get_int(args[0]) & 3; + *table_ptr16a[idx] = mp_obj_get_int(args[1]); + return mp_const_none; + } +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(access_obj, 0, 2, access); + +// A function that allocates memory and creates a bytearray +STATIC mp_obj_t make_array(void) { + uint16_t *ptr = m_new(uint16_t, MP_ARRAY_SIZE(table_ptr16b)); + for (int i = 0; i < MP_ARRAY_SIZE(table_ptr16b); ++i) { + ptr[i] = *table_ptr16b[i]; + } + return mp_obj_new_bytearray_by_ref(sizeof(uint16_t) * MP_ARRAY_SIZE(table_ptr16b), ptr); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(make_array_obj, make_array); + +// This is the entry point and is called when the module is imported +mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { + // This must be first, it sets up the globals dict and other things + MP_DYNRUNTIME_INIT_ENTRY + + // Messages can be printed as usually + mp_printf(&mp_plat_print, "initialising module self=%p\n", self); + + // Make the functions available in the module's namespace + mp_store_global(MP_QSTR_add, MP_OBJ_FROM_PTR(&add_obj)); + mp_store_global(MP_QSTR_fibonacci, MP_OBJ_FROM_PTR(&fibonacci_obj)); + mp_store_global(MP_QSTR_access, MP_OBJ_FROM_PTR(&access_obj)); + mp_store_global(MP_QSTR_make_array, MP_OBJ_FROM_PTR(&make_array_obj)); + + // Add some constants to the module's namespace + mp_store_global(MP_QSTR_VAL, MP_OBJ_NEW_SMALL_INT(42)); + mp_store_global(MP_QSTR_MSG, MP_OBJ_NEW_QSTR(MP_QSTR_HELLO_MICROPYTHON)); + + // This must be last, it restores the globals dict + MP_DYNRUNTIME_INIT_EXIT +} diff --git a/examples/natmod/features2/Makefile b/examples/natmod/features2/Makefile new file mode 100644 index 0000000000..4fd23c6879 --- /dev/null +++ b/examples/natmod/features2/Makefile @@ -0,0 +1,14 @@ +# Location of top-level MicroPython directory +MPY_DIR = ../../.. + +# Name of module +MOD = features2 + +# Source files (.c or .py) +SRC = main.c prod.c test.py + +# Architecture to build for (x86, x64, armv7m, xtensa, xtensawin) +ARCH = x64 + +# Include to get the rules for compiling and linking the module +include $(MPY_DIR)/py/dynruntime.mk diff --git a/examples/natmod/features2/main.c b/examples/natmod/features2/main.c new file mode 100644 index 0000000000..1a39700dc4 --- /dev/null +++ b/examples/natmod/features2/main.c @@ -0,0 +1,83 @@ +/* This example demonstrates the following features in a native module: + - using floats + - defining additional code in Python (see test.py) + - have extra C code in a separate file (see prod.c) +*/ + +// Include the header file to get access to the MicroPython API +#include "py/dynruntime.h" + +// Include the header for auxiliary C code for this module +#include "prod.h" + +// Automatically detect if this module should include double-precision code. +// If double precision is supported by the target architecture then it can +// be used in native module regardless of what float setting the target +// MicroPython runtime uses (being none, float or double). +#if defined(__i386__) || defined(__x86_64__) || (defined(__ARM_FP) && (__ARM_FP & 8)) +#define USE_DOUBLE 1 +#else +#define USE_DOUBLE 0 +#endif + +// A function that uses the default float type configured for the current target +// This default can be overridden by specifying MICROPY_FLOAT_IMPL at the make level +STATIC mp_obj_t add(mp_obj_t x, mp_obj_t y) { + return mp_obj_new_float(mp_obj_get_float(x) + mp_obj_get_float(y)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(add_obj, add); + +// A function that explicitly uses single precision floats +STATIC mp_obj_t add_f(mp_obj_t x, mp_obj_t y) { + return mp_obj_new_float_from_f(mp_obj_get_float_to_f(x) + mp_obj_get_float_to_f(y)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(add_f_obj, add_f); + +#if USE_DOUBLE +// A function that explicitly uses double precision floats +STATIC mp_obj_t add_d(mp_obj_t x, mp_obj_t y) { + return mp_obj_new_float_from_d(mp_obj_get_float_to_d(x) + mp_obj_get_float_to_d(y)); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(add_d_obj, add_d); +#endif + +// A function that computes the product of floats in an array. +// This function uses the most general C argument interface, which is more difficult +// to use but has access to the globals dict of the module via self->globals. +STATIC mp_obj_t productf(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { + // Check number of arguments is valid + mp_arg_check_num(n_args, n_kw, 1, 1, false); + + // Extract buffer pointer and verify typecode + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(args[0], &bufinfo, MP_BUFFER_RW); + if (bufinfo.typecode != 'f') { + mp_raise_ValueError(MP_ERROR_TEXT("expecting float array")); + } + + // Compute product, store result back in first element of array + float *ptr = bufinfo.buf; + float prod = prod_array(bufinfo.len / sizeof(*ptr), ptr); + ptr[0] = prod; + + return mp_const_none; +} + +// This is the entry point and is called when the module is imported +mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { + // This must be first, it sets up the globals dict and other things + MP_DYNRUNTIME_INIT_ENTRY + + // Make the functions available in the module's namespace + mp_store_global(MP_QSTR_add, MP_OBJ_FROM_PTR(&add_obj)); + mp_store_global(MP_QSTR_add_f, MP_OBJ_FROM_PTR(&add_f_obj)); + #if USE_DOUBLE + mp_store_global(MP_QSTR_add_d, MP_OBJ_FROM_PTR(&add_d_obj)); + #endif + + // The productf function uses the most general C argument interface + mp_store_global(MP_QSTR_productf, MP_DYNRUNTIME_MAKE_FUNCTION(productf)); + + // This must be last, it restores the globals dict + MP_DYNRUNTIME_INIT_EXIT +} diff --git a/examples/natmod/features2/prod.c b/examples/natmod/features2/prod.c new file mode 100644 index 0000000000..7791dcad1d --- /dev/null +++ b/examples/natmod/features2/prod.c @@ -0,0 +1,9 @@ +#include "prod.h" + +float prod_array(int n, float *ar) { + float ans = 1; + for (int i = 0; i < n; ++i) { + ans *= ar[i]; + } + return ans; +} diff --git a/examples/natmod/features2/prod.h b/examples/natmod/features2/prod.h new file mode 100644 index 0000000000..f27dd8d033 --- /dev/null +++ b/examples/natmod/features2/prod.h @@ -0,0 +1 @@ +float prod_array(int n, float *ar); diff --git a/examples/natmod/features2/test.py b/examples/natmod/features2/test.py new file mode 100644 index 0000000000..5ac80120d7 --- /dev/null +++ b/examples/natmod/features2/test.py @@ -0,0 +1,29 @@ +# This Python code will be merged with the C code in main.c + +import array + + +def isclose(a, b): + return abs(a - b) < 1e-3 + + +def test(): + tests = [ + isclose(add(0.1, 0.2), 0.3), + isclose(add_f(0.1, 0.2), 0.3), + ] + + ar = array.array("f", [1, 2, 3.5]) + productf(ar) + tests.append(isclose(ar[0], 7)) + + if "add_d" in globals(): + tests.append(isclose(add_d(0.1, 0.2), 0.3)) + + print(tests) + + if not all(tests): + raise SystemExit(1) + + +test() diff --git a/examples/natmod/features3/Makefile b/examples/natmod/features3/Makefile new file mode 100644 index 0000000000..4a5f71b8f2 --- /dev/null +++ b/examples/natmod/features3/Makefile @@ -0,0 +1,14 @@ +# Location of top-level MicroPython directory +MPY_DIR = ../../.. + +# Name of module +MOD = features3 + +# Source files (.c or .py) +SRC = features3.c + +# Architecture to build for (x86, x64, armv7m, xtensa, xtensawin) +ARCH = x64 + +# Include to get the rules for compiling and linking the module +include $(MPY_DIR)/py/dynruntime.mk diff --git a/examples/natmod/features3/features3.c b/examples/natmod/features3/features3.c new file mode 100644 index 0000000000..20efd67cdc --- /dev/null +++ b/examples/natmod/features3/features3.c @@ -0,0 +1,60 @@ +/* This example demonstrates the following features in a native module: + - using types + - using constant objects + - creating dictionaries +*/ + +// Include the header file to get access to the MicroPython API. +#include "py/dynruntime.h" + +// A function that returns a tuple of object types. +STATIC mp_obj_t get_types(void) { + return mp_obj_new_tuple(9, ((mp_obj_t []) { + MP_OBJ_FROM_PTR(&mp_type_type), + MP_OBJ_FROM_PTR(&mp_type_NoneType), + MP_OBJ_FROM_PTR(&mp_type_bool), + MP_OBJ_FROM_PTR(&mp_type_int), + MP_OBJ_FROM_PTR(&mp_type_str), + MP_OBJ_FROM_PTR(&mp_type_bytes), + MP_OBJ_FROM_PTR(&mp_type_tuple), + MP_OBJ_FROM_PTR(&mp_type_list), + MP_OBJ_FROM_PTR(&mp_type_dict), + })); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(get_types_obj, get_types); + +// A function that returns a tuple of constant objects. +STATIC mp_obj_t get_const_objects(void) { + return mp_obj_new_tuple(5, ((mp_obj_t []) { + mp_const_none, + mp_const_false, + mp_const_true, + mp_const_empty_bytes, + mp_const_empty_tuple, + })); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(get_const_objects_obj, get_const_objects); + +// A function that creates a dictionary from the given arguments. +STATIC mp_obj_t make_dict(size_t n_args, const mp_obj_t *args) { + mp_obj_t dict = mp_obj_new_dict(n_args / 2); + for (; n_args >= 2; n_args -= 2, args += 2) { + mp_obj_dict_store(dict, args[0], args[1]); + } + return dict; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(make_dict_obj, 0, MP_OBJ_FUN_ARGS_MAX, make_dict); + +// This is the entry point and is called when the module is imported. +mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { + // This must be first, it sets up the globals dict and other things. + MP_DYNRUNTIME_INIT_ENTRY + + // Make the functions available in the module's namespace. + mp_store_global(MP_QSTR_make_dict, MP_OBJ_FROM_PTR(&make_dict_obj)); + mp_store_global(MP_QSTR_get_types, MP_OBJ_FROM_PTR(&get_types_obj)); + mp_store_global(MP_QSTR_get_const_objects, MP_OBJ_FROM_PTR(&get_const_objects_obj)); + + // This must be last, it restores the globals dict. + MP_DYNRUNTIME_INIT_EXIT +} diff --git a/examples/natmod/uheapq/Makefile b/examples/natmod/uheapq/Makefile new file mode 100644 index 0000000000..55de3cc081 --- /dev/null +++ b/examples/natmod/uheapq/Makefile @@ -0,0 +1,13 @@ +# Location of top-level MicroPython directory +MPY_DIR = ../../.. + +# Name of module (different to built-in uheapq so it can coexist) +MOD = uheapq_$(ARCH) + +# Source files (.c or .py) +SRC = uheapq.c + +# Architecture to build for (x86, x64, armv7m, xtensa, xtensawin) +ARCH = x64 + +include $(MPY_DIR)/py/dynruntime.mk diff --git a/examples/natmod/uheapq/uheapq.c b/examples/natmod/uheapq/uheapq.c new file mode 100644 index 0000000000..9da6bb4ada --- /dev/null +++ b/examples/natmod/uheapq/uheapq.c @@ -0,0 +1,16 @@ +#define MICROPY_PY_UHEAPQ (1) + +#include "py/dynruntime.h" + +#include "extmod/moduheapq.c" + +mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { + MP_DYNRUNTIME_INIT_ENTRY + + mp_store_global(MP_QSTR___name__, MP_OBJ_NEW_QSTR(MP_QSTR_uheapq)); + mp_store_global(MP_QSTR_heappush, MP_OBJ_FROM_PTR(&mod_uheapq_heappush_obj)); + mp_store_global(MP_QSTR_heappop, MP_OBJ_FROM_PTR(&mod_uheapq_heappop_obj)); + mp_store_global(MP_QSTR_heapify, MP_OBJ_FROM_PTR(&mod_uheapq_heapify_obj)); + + MP_DYNRUNTIME_INIT_EXIT +} diff --git a/examples/natmod/urandom/Makefile b/examples/natmod/urandom/Makefile new file mode 100644 index 0000000000..3f018baaf7 --- /dev/null +++ b/examples/natmod/urandom/Makefile @@ -0,0 +1,13 @@ +# Location of top-level MicroPython directory +MPY_DIR = ../../.. + +# Name of module (different to built-in urandom so it can coexist) +MOD = urandom_$(ARCH) + +# Source files (.c or .py) +SRC = urandom.c + +# Architecture to build for (x86, x64, armv7m, xtensa, xtensawin) +ARCH = x64 + +include $(MPY_DIR)/py/dynruntime.mk diff --git a/examples/natmod/urandom/urandom.c b/examples/natmod/urandom/urandom.c new file mode 100644 index 0000000000..e1fed6a554 --- /dev/null +++ b/examples/natmod/urandom/urandom.c @@ -0,0 +1,33 @@ +#define MICROPY_PY_URANDOM (1) +#define MICROPY_PY_URANDOM_EXTRA_FUNCS (1) + +#include "py/dynruntime.h" + +// Dynamic native modules don't support a data section so these must go in the BSS +uint32_t yasmarang_pad, yasmarang_n, yasmarang_d; +uint8_t yasmarang_dat; + +#include "extmod/modurandom.c" + +mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { + MP_DYNRUNTIME_INIT_ENTRY + + yasmarang_pad = 0xeda4baba; + yasmarang_n = 69; + yasmarang_d = 233; + + mp_store_global(MP_QSTR___name__, MP_OBJ_NEW_QSTR(MP_QSTR_urandom)); + mp_store_global(MP_QSTR_getrandbits, MP_OBJ_FROM_PTR(&mod_urandom_getrandbits_obj)); + mp_store_global(MP_QSTR_seed, MP_OBJ_FROM_PTR(&mod_urandom_seed_obj)); + #if MICROPY_PY_URANDOM_EXTRA_FUNCS + mp_store_global(MP_QSTR_randrange, MP_OBJ_FROM_PTR(&mod_urandom_randrange_obj)); + mp_store_global(MP_QSTR_randint, MP_OBJ_FROM_PTR(&mod_urandom_randint_obj)); + mp_store_global(MP_QSTR_choice, MP_OBJ_FROM_PTR(&mod_urandom_choice_obj)); + #if MICROPY_PY_BUILTINS_FLOAT + mp_store_global(MP_QSTR_random, MP_OBJ_FROM_PTR(&mod_urandom_random_obj)); + mp_store_global(MP_QSTR_uniform, MP_OBJ_FROM_PTR(&mod_urandom_uniform_obj)); + #endif + #endif + + MP_DYNRUNTIME_INIT_EXIT +} diff --git a/examples/natmod/ure/Makefile b/examples/natmod/ure/Makefile new file mode 100644 index 0000000000..f5254298fd --- /dev/null +++ b/examples/natmod/ure/Makefile @@ -0,0 +1,13 @@ +# Location of top-level MicroPython directory +MPY_DIR = ../../.. + +# Name of module (different to built-in ure so it can coexist) +MOD = ure_$(ARCH) + +# Source files (.c or .py) +SRC = ure.c + +# Architecture to build for (x86, x64, armv7m, xtensa, xtensawin) +ARCH = x64 + +include $(MPY_DIR)/py/dynruntime.mk diff --git a/examples/natmod/ure/ure.c b/examples/natmod/ure/ure.c new file mode 100644 index 0000000000..175b93e395 --- /dev/null +++ b/examples/natmod/ure/ure.c @@ -0,0 +1,78 @@ +#define MICROPY_STACK_CHECK (1) +#define MICROPY_PY_URE (1) +#define MICROPY_PY_URE_MATCH_GROUPS (1) +#define MICROPY_PY_URE_MATCH_SPAN_START_END (1) +#define MICROPY_PY_URE_SUB (0) // requires vstr interface + +#include +#include "py/dynruntime.h" + +#define STACK_LIMIT (2048) + +const char *stack_top; + +void mp_stack_check(void) { + // Assumes descending stack on target + volatile char dummy; + if (stack_top - &dummy >= STACK_LIMIT) { + mp_raise_msg(&mp_type_RuntimeError, MP_ERROR_TEXT("maximum recursion depth exceeded")); + } +} + +#if !defined(__linux__) +void *memcpy(void *dst, const void *src, size_t n) { + return mp_fun_table.memmove_(dst, src, n); +} +void *memset(void *s, int c, size_t n) { + return mp_fun_table.memset_(s, c, n); +} +#endif + +void *memmove(void *dest, const void *src, size_t n) { + return mp_fun_table.memmove_(dest, src, n); +} + +mp_obj_type_t match_type; +mp_obj_type_t re_type; + +#include "extmod/modure.c" + +mp_map_elem_t match_locals_dict_table[5]; +STATIC MP_DEFINE_CONST_DICT(match_locals_dict, match_locals_dict_table); + +mp_map_elem_t re_locals_dict_table[3]; +STATIC MP_DEFINE_CONST_DICT(re_locals_dict, re_locals_dict_table); + +mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { + MP_DYNRUNTIME_INIT_ENTRY + + char dummy; + stack_top = &dummy; + + // Because MP_QSTR_start/end/split are static, xtensa and xtensawin will make a small data section + // to copy in this key/value pair if they are specified as a struct, so assign them separately. + + match_type.base.type = (void*)&mp_fun_table.type_type; + match_type.name = MP_QSTR_match; + match_type.print = match_print; + match_locals_dict_table[0] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_group), MP_OBJ_FROM_PTR(&match_group_obj) }; + match_locals_dict_table[1] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_groups), MP_OBJ_FROM_PTR(&match_groups_obj) }; + match_locals_dict_table[2] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_span), MP_OBJ_FROM_PTR(&match_span_obj) }; + match_locals_dict_table[3] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_start), MP_OBJ_FROM_PTR(&match_start_obj) }; + match_locals_dict_table[4] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_end), MP_OBJ_FROM_PTR(&match_end_obj) }; + match_type.locals_dict = (void*)&match_locals_dict; + + re_type.base.type = (void*)&mp_fun_table.type_type; + re_type.name = MP_QSTR_ure; + re_type.print = re_print; + re_locals_dict_table[0] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_match), MP_OBJ_FROM_PTR(&re_match_obj) }; + re_locals_dict_table[1] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_search), MP_OBJ_FROM_PTR(&re_search_obj) }; + re_locals_dict_table[2] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_split), MP_OBJ_FROM_PTR(&re_split_obj) }; + re_type.locals_dict = (void*)&re_locals_dict; + + mp_store_global(MP_QSTR_compile, MP_OBJ_FROM_PTR(&mod_re_compile_obj)); + mp_store_global(MP_QSTR_match, MP_OBJ_FROM_PTR(&re_match_obj)); + mp_store_global(MP_QSTR_search, MP_OBJ_FROM_PTR(&re_search_obj)); + + MP_DYNRUNTIME_INIT_EXIT +} diff --git a/examples/natmod/uzlib/Makefile b/examples/natmod/uzlib/Makefile new file mode 100644 index 0000000000..8761caf2dd --- /dev/null +++ b/examples/natmod/uzlib/Makefile @@ -0,0 +1,13 @@ +# Location of top-level MicroPython directory +MPY_DIR = ../../.. + +# Name of module (different to built-in uzlib so it can coexist) +MOD = uzlib_$(ARCH) + +# Source files (.c or .py) +SRC = uzlib.c + +# Architecture to build for (x86, x64, armv7m, xtensa, xtensawin) +ARCH = x64 + +include $(MPY_DIR)/py/dynruntime.mk diff --git a/examples/natmod/uzlib/uzlib.c b/examples/natmod/uzlib/uzlib.c new file mode 100644 index 0000000000..6df9944d6a --- /dev/null +++ b/examples/natmod/uzlib/uzlib.c @@ -0,0 +1,40 @@ +#define MICROPY_PY_UZLIB (1) + +#include "py/dynruntime.h" + +#if !defined(__linux__) +void *memset(void *s, int c, size_t n) { + return mp_fun_table.memset_(s, c, n); +} +#endif + +mp_obj_full_type_t decompio_type; +mp_stream_p_t decompio_stream_p; + +#include "extmod/moduzlib.c" + +mp_map_elem_t decompio_locals_dict_table[3]; +STATIC MP_DEFINE_CONST_DICT(decompio_locals_dict, decompio_locals_dict_table); + +mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) { + MP_DYNRUNTIME_INIT_ENTRY + + decompio_stream_p.name = MP_QSTR_protocol_stream; + decompio_stream_p.read = decompio_read; + + decompio_type.base.type = mp_fun_table.type_type; + decompio_type.flags = MP_TYPE_FLAG_EXTENDED; + decompio_type.name = MP_QSTR_DecompIO; + decompio_type.make_new = decompio_make_new; + decompio_type.ext[0].protocol = &decompio_stream_p; + decompio_locals_dict_table[0] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_read), MP_OBJ_FROM_PTR(&mp_stream_read_obj) }; + decompio_locals_dict_table[1] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_readinto), MP_OBJ_FROM_PTR(&mp_stream_readinto_obj) }; + decompio_locals_dict_table[2] = (mp_map_elem_t){ MP_OBJ_NEW_QSTR(MP_QSTR_readline), MP_OBJ_FROM_PTR(&mp_stream_unbuffered_readline_obj) }; + decompio_type.locals_dict = (void*)&decompio_locals_dict; + + mp_store_global(MP_QSTR___name__, MP_OBJ_NEW_QSTR(MP_QSTR_uzlib)); + mp_store_global(MP_QSTR_decompress, MP_OBJ_FROM_PTR(&mod_uzlib_decompress_obj)); + mp_store_global(MP_QSTR_DecompIO, MP_OBJ_FROM_PTR(&decompio_type)); + + MP_DYNRUNTIME_INIT_EXIT +} diff --git a/py/dynruntime.h b/py/dynruntime.h index da0317be6d..b7a9a89156 100644 --- a/py/dynruntime.h +++ b/py/dynruntime.h @@ -175,6 +175,12 @@ static inline mp_obj_t mp_obj_len_dyn(mp_obj_t o) { return mp_fun_table.call_function_n_kw(mp_fun_table.load_name(MP_QSTR_len), 1, &o); } +static inline void *mp_obj_malloc_helper_dyn(size_t num_bytes, const mp_obj_type_t *type) { + mp_obj_base_t *base = (mp_obj_base_t *)m_malloc(num_bytes); + base->type = type; + return base; +} + /******************************************************************************/ // General runtime functions diff --git a/py/persistentcode.c b/py/persistentcode.c index e15dcffdea..74b26cb285 100644 --- a/py/persistentcode.c +++ b/py/persistentcode.c @@ -389,7 +389,7 @@ STATIC mp_raw_code_t *load_raw_code(mp_reader_t *reader, mp_module_context_t *co mp_compiled_module_t mp_raw_code_load(mp_reader_t *reader, mp_module_context_t *context) { byte header[4]; read_bytes(reader, header, sizeof(header)); - if (header[0] != 'M' + if (header[0] != 'C' || header[1] != MPY_VERSION || MPY_FEATURE_DECODE_FLAGS(header[2]) != MPY_FEATURE_FLAGS || header[3] > MP_SMALL_INT_BITS) { @@ -579,12 +579,12 @@ STATIC void save_raw_code(mp_print_t *print, const mp_raw_code_t *rc) { void mp_raw_code_save(mp_compiled_module_t *cm, mp_print_t *print) { // header contains: - // byte 'M' + // byte 'C' // byte version // byte feature flags // byte number of bits in a small int byte header[4] = { - 'M', + 'C', MPY_VERSION, MPY_FEATURE_ENCODE_FLAGS(MPY_FEATURE_FLAGS_DYNAMIC), #if MICROPY_DYNAMIC_COMPILER diff --git a/py/runtime0.h b/py/runtime0.h index ab048701c4..218820fd70 100644 --- a/py/runtime0.h +++ b/py/runtime0.h @@ -29,6 +29,7 @@ // The first four must fit in 8 bits, see emitbc.c // The remaining must fit in 16 bits, see scope.h +// and must match definitions in mpy-tool.py and mpy_ld.py #define MP_SCOPE_FLAG_ALL_SIG (0x1f) #define MP_SCOPE_FLAG_GENERATOR (0x01) #define MP_SCOPE_FLAG_VARKEYWORDS (0x02) diff --git a/tests/micropython/import_mpy_invalid.py b/tests/micropython/import_mpy_invalid.py index 7bf9417329..894fc582ce 100644 --- a/tests/micropython/import_mpy_invalid.py +++ b/tests/micropython/import_mpy_invalid.py @@ -50,8 +50,8 @@ class UserFS: # these are the test .mpy files user_files = { "/mod0.mpy": b"", # empty file - "/mod1.mpy": b"M", # too short header - "/mod2.mpy": b"M\x00\x00\x00", # bad version + "/mod1.mpy": b"C", # too short header + "/mod2.mpy": b"C\x00\x00\x00", # bad version } # create and mount a user filesystem diff --git a/tests/micropython/import_mpy_native.py b/tests/micropython/import_mpy_native.py index 69e1c40798..0dfbca9086 100644 --- a/tests/micropython/import_mpy_native.py +++ b/tests/micropython/import_mpy_native.py @@ -50,11 +50,11 @@ class UserFS: # these are the test .mpy files -valid_header = bytes([77, 6, mpy_arch, 31]) +valid_header = bytes([ord("C"), 6, mpy_arch, 31]) # fmt: off user_files = { # bad architecture - '/mod0.mpy': b'M\x06\xfc\x1f', + '/mod0.mpy': b'C\x06\xfc\x1f', # test loading of viper and asm '/mod1.mpy': valid_header + ( @@ -99,7 +99,7 @@ user_files = { b'\x22' # 4 bytes, no children, viper code b'\x00\x00\x00\x00' # dummy machine code - b'\x70' # scope_flags: VIPERBSS | VIPERRODATA | VIPERRELOC + b'\xe0' # scope_flags: VIPERBSS | VIPERRODATA | VIPERRELOC b'\x06\x04' # rodata=6 bytes, bss=4 bytes b'rodata' # rodata content b'\x03\x01\x00' # dummy relocation of rodata diff --git a/tests/micropython/import_mpy_native_gc.py b/tests/micropython/import_mpy_native_gc.py index 4c496585bb..1234184aed 100644 --- a/tests/micropython/import_mpy_native_gc.py +++ b/tests/micropython/import_mpy_native_gc.py @@ -1,9 +1,5 @@ # Test that native code loaded from a .mpy file is retained after a GC. -# This is known not to work in CircuitPython. Fixes welcome. -print("SKIP") -raise SystemExit - try: import gc, sys, uio, uos @@ -53,9 +49,9 @@ class UserFS: # by the required value of sys.implementation._mpy. features0_file_contents = { # -march=x64 - 0x806: b'M\x06\x08\x1f\x02\x004build/features0.native.mpy\x00\x12factorial\x00\x8a\x02\xe9/\x00\x00\x00SH\x8b\x1d\x83\x00\x00\x00\xbe\x02\x00\x00\x00\xffS\x18\xbf\x01\x00\x00\x00H\x85\xc0u\x0cH\x8bC \xbe\x02\x00\x00\x00[\xff\xe0H\x0f\xaf\xf8H\xff\xc8\xeb\xe6ATUSH\x8b\x1dQ\x00\x00\x00H\x8bG\x08L\x8bc(H\x8bx\x08A\xff\xd4H\x8d5+\x00\x00\x00H\x89\xc5H\x8b\x059\x00\x00\x00\x0f\xb7x\x02\xffShH\x89\xefA\xff\xd4H\x8b\x03[]A\\\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x11$\r&\xa3 \x01"\xff', + 0x806: b'C\x06\x08\x1f\x02\x004build/features0.native.mpy\x00\x12factorial\x00\x8a\x02\xe9/\x00\x00\x00SH\x8b\x1d\x83\x00\x00\x00\xbe\x02\x00\x00\x00\xffS\x18\xbf\x01\x00\x00\x00H\x85\xc0u\x0cH\x8bC \xbe\x02\x00\x00\x00[\xff\xe0H\x0f\xaf\xf8H\xff\xc8\xeb\xe6ATUSH\x8b\x1dQ\x00\x00\x00H\x8bG\x08L\x8bc(H\x8bx\x08A\xff\xd4H\x8d5+\x00\x00\x00H\x89\xc5H\x8b\x059\x00\x00\x00\x0f\xb7x\x02\xffShH\x89\xefA\xff\xd4H\x8b\x03[]A\\\xc3\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x11$\r&\xa5 \x01"\xff', # -march=armv6m - 0x1006: b"M\x06\x10\x1f\x02\x004build/features0.native.mpy\x00\x12factorial\x00\x88\x02\x18\xe0\x00\x00\x10\xb5\tK\tJ{D\x9cX\x02!\xe3h\x98G\x03\x00\x01 \x00+\x02\xd0XC\x01;\xfa\xe7\x02!#i\x98G\x10\xbd\xc0Fj\x00\x00\x00\x00\x00\x00\x00\xf8\xb5\nN\nK~D\xf4XChgiXh\xb8G\x05\x00\x07K\x08I\xf3XyDX\x88ck\x98G(\x00\xb8G h\xf8\xbd\xc0F:\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x1e\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x11<\r>\xa38\x01:\xff", + 0x1006: b'C\x06\x14\x1f\x02\x004build/features0.native.mpy\x00\x12factorial\x00\x88"\x1a\xe0\x00\x00\x13\xb5\nK\nJ{D\x9cX\x02!\xe3h\x98G\x03F\x01 3\xb9\x02!#i\x01\x93\x02\xb0\xbd\xe8\x10@\x18GXC\x01;\xf4\xe7\x00\xbfn\x00\x00\x00\x00\x00\x00\x00\xf8\xb5\nN\nK~D\xf4XChgiXh\xb8G\x05F\x07K\x08I\xf2XyDP\x88ck\x98G(F\xb8G h\xf8\xbd\x00\xbf:\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x1e\x00\x00\x00\x00\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x11>\r@\xa5:\x01<\xff', } # Populate armv7m-derived archs based on armv6m. diff --git a/tools/analyze_mpy.py b/tools/analyze_mpy.py index 8c2056e030..3f212e2679 100755 --- a/tools/analyze_mpy.py +++ b/tools/analyze_mpy.py @@ -316,8 +316,8 @@ class mpyFile: def __init__(self, encoded_mpy): # this matches mp-raw_code_save in py/persistentcode.c first_byte = encoded_mpy.read(1) - if first_byte != b"M": - raise ValueError("Not a valid first byte. Should be 'M' but is {}".format(first_byte)) + if first_byte != b"C": + raise ValueError("Not a valid first byte. Should be 'C' but is {}".format(first_byte)) self.version = encoded_mpy.read(1)[0] self.feature_flags = encoded_mpy.read(1)[0] self.small_int_bits = encoded_mpy.read(1)[0] diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index 31212fd5bd..c5f56386c9 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -125,6 +125,7 @@ MP_PERSISTENT_OBJ_FLOAT = 8 MP_PERSISTENT_OBJ_COMPLEX = 9 MP_PERSISTENT_OBJ_TUPLE = 10 +# Circuitpython: this does not match upstream because we added MP_SCOPE_FLAG_ASYNC MP_SCOPE_FLAG_VIPERRELOC = 0x10 MP_SCOPE_FLAG_VIPERRODATA = 0x20 MP_SCOPE_FLAG_VIPERBSS = 0x40 @@ -1328,7 +1329,7 @@ def read_mpy(filename): # Read and verify the header. header = reader.read_bytes(4) - if header[0] != ord("M"): + if header[0] != ord("C"): raise MPYReadError(filename, "not a valid .mpy file") if header[1] != config.MPY_VERSION: raise MPYReadError(filename, "incompatible .mpy version") @@ -1668,7 +1669,7 @@ def merge_mpy(compiled_modules, output_file): compiled_modules.insert(0, compiled_modules.pop(main_cm_idx)) header = bytearray(4) - header[0] = ord("M") + header[0] = ord("C") header[1] = config.MPY_VERSION header[2] = config.native_arch << 2 header[3] = config.mp_small_int_bits diff --git a/tools/mpy_ld.py b/tools/mpy_ld.py index 09ea90dcd1..4d01f52df8 100755 --- a/tools/mpy_ld.py +++ b/tools/mpy_ld.py @@ -47,9 +47,10 @@ MP_NATIVE_ARCH_ARMV7EMDP = 8 MP_NATIVE_ARCH_XTENSA = 9 MP_NATIVE_ARCH_XTENSAWIN = 10 MP_PERSISTENT_OBJ_STR = 5 -MP_SCOPE_FLAG_VIPERRELOC = 0x10 -MP_SCOPE_FLAG_VIPERRODATA = 0x20 -MP_SCOPE_FLAG_VIPERBSS = 0x40 +# Circuitpython: this does not match upstream because we added MP_SCOPE_FLAG_ASYNC +MP_SCOPE_FLAG_VIPERRELOC = 0x20 +MP_SCOPE_FLAG_VIPERRODATA = 0x40 +MP_SCOPE_FLAG_VIPERBSS = 0x80 MP_SMALL_INT_BITS = 31 # ELF constants @@ -768,7 +769,8 @@ def link_objects(env, native_qstr_vals_len, native_qstr_objs_len): # Resolve unknown symbols mp_fun_table_sec = Section(".external.mp_fun_table", b"", 0) fun_table = { - key: 67 + idx + # Circuitpython: this does not match upstream because we added an item in _mp_fnu_table_t + key: 68 + idx for idx, key in enumerate( [ "mp_type_type", @@ -917,7 +919,7 @@ def build_mpy(env, entry_offset, fmpy, native_qstr_vals, native_qstr_objs): out.open(fmpy) # MPY: header - out.write_bytes(bytearray([ord("M"), MPY_VERSION, env.arch.mpy_feature, MP_SMALL_INT_BITS])) + out.write_bytes(bytearray([ord("C"), MPY_VERSION, env.arch.mpy_feature, MP_SMALL_INT_BITS])) # MPY: n_qstr out.write_uint(1 + len(native_qstr_vals)) diff --git a/tools/pyboard.py b/tools/pyboard.py index d2813ad5ad..a521a04a2e 100755 --- a/tools/pyboard.py +++ b/tools/pyboard.py @@ -748,7 +748,7 @@ def main(): for filename in args.files: with open(filename, "rb") as f: pyfile = f.read() - if filename.endswith(".mpy") and pyfile[0] == ord("M"): + if filename.endswith(".mpy") and pyfile[0] == ord("C"): pyb.exec_("_injected_buf=" + repr(pyfile)) pyfile = _injected_import_hook_code execbuffer(pyfile) From 5606d49e4dca7ab60873ef02d47de051b9a71be9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 19 Aug 2023 17:03:44 -0500 Subject: [PATCH 1515/1712] skip async_basic with native emitter, it doesn't work --- tests/run-tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-tests.py b/tests/run-tests.py index 45b4ebf536..8492943566 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -505,7 +505,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): {"basics/%s.py" % t for t in "gen_yield_from_close generator_name".split()} ) # require raise_varargs, generator name skip_tests.update( - {"basics/async_%s.py" % t for t in "with with2 with_break with_return".split()} + {"basics/async_%s.py" % t for t in "await with with2 with_break with_return".split()} ) # require async_with skip_tests.update( {"basics/%s.py" % t for t in "try_reraise try_reraise2".split()} From b0bf36ef3bd7407585c6223038c3d8a48ed76b5e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 19 Aug 2023 17:17:50 -0500 Subject: [PATCH 1516/1712] Fix building with !MICROPY_PY_ASYNC_AWAIT --- py/obj.h | 2 ++ py/objgenerator.c | 14 +++++++++++--- py/runtime.c | 6 +++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/py/obj.h b/py/obj.h index f28563dfe4..ef8b7a0351 100644 --- a/py/obj.h +++ b/py/obj.h @@ -741,7 +741,9 @@ extern const mp_obj_type_t mp_type_gen_instance; // CIRCUITPY extern const mp_obj_type_t mp_type_coro_wrap; // CIRCUITPY +#if MICROPY_PY_ASYNC_AWAIT extern const mp_obj_type_t mp_type_coro_instance; +#endif extern const mp_obj_type_t mp_type_fun_builtin_0; extern const mp_obj_type_t mp_type_fun_builtin_1; extern const mp_obj_type_t mp_type_fun_builtin_2; diff --git a/py/objgenerator.c b/py/objgenerator.c index 4040cd291d..05daaf31f7 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -71,7 +71,12 @@ STATIC mp_obj_t gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_kw, cons // allocate the generator or coroutine object, with room for local stack and exception stack mp_obj_gen_instance_t *o = mp_obj_malloc_var(mp_obj_gen_instance_t, byte, n_state * sizeof(mp_obj_t) + n_exc_stack * sizeof(mp_exc_stack_t), - self_fun->base.type == &mp_type_gen_wrap ? &mp_type_gen_instance : &mp_type_coro_instance); + #if MICROPY_PY_ASYNC_AWAIT + self_fun->base.type == &mp_type_gen_wrap ? &mp_type_gen_instance : &mp_type_coro_instance + #else + &mp_type_gen_instance + #endif + ); o->pend_exc = mp_const_none; o->code_state.fun_bc = self_fun; @@ -198,8 +203,11 @@ mp_vm_return_kind_t mp_obj_gen_resume(mp_obj_t self_in, mp_obj_t send_value, mp_ // note that self may have as its type either gen or coro, // both of which are stored as an mp_obj_gen_instance_t . mp_check_self( - mp_obj_is_type(self_in, &mp_type_gen_instance) || - mp_obj_is_type(self_in, &mp_type_coro_instance)); + mp_obj_is_type(self_in, &mp_type_gen_instance) + #if MICROPY_PY_ASYNC_AWAIT + || mp_obj_is_type(self_in, &mp_type_coro_instance) + #endif + ); mp_obj_gen_instance_t *self = MP_OBJ_TO_PTR(self_in); if (self->code_state.ip == 0) { // Trying to resume an already stopped generator. diff --git a/py/runtime.c b/py/runtime.c index aeb9a7954b..eaeb9eb0ac 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -1416,7 +1416,11 @@ mp_vm_return_kind_t mp_resume(mp_obj_t self_in, mp_obj_t send_value, mp_obj_t th const mp_obj_type_t *type = mp_obj_get_type(self_in); // CIRCUITPY distinguishes generators and coroutines. - if (type == &mp_type_gen_instance || type == &mp_type_coro_instance) { + if (type == &mp_type_gen_instance + #if MICROPY_PY_ASYNC_AWAIT + || type == &mp_type_coro_instance + #endif + ) { return mp_obj_gen_resume(self_in, send_value, throw_value, ret_val); } From b50a7fb9137383737fcc8f635a714b45f41e20ad Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sun, 20 Aug 2023 00:21:33 +0200 Subject: [PATCH 1517/1712] Fix displayio when CIRCUITPY_REPL_LOGO is disabled We have to make room for the status bar no matter if the logo is enabled or not. We probably should add a similar option for disabling the status bar. This makes the PewPew M4 port stop crashing. --- supervisor/shared/display.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index ce7d78c42c..4e24175a1f 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -128,10 +128,8 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { status_bar->full_change = true; scroll_area->width_in_tiles = width_in_tiles; - scroll_area->height_in_tiles = height_in_tiles; - #if CIRCUITPY_REPL_LOGO - scroll_area->height_in_tiles -= 1; - #endif + // Leave space for the status bar, no matter if we have logo or not. + scroll_area->height_in_tiles = height_in_tiles - 1; scroll_area->pixel_width = scroll_area->width_in_tiles * scroll_area->tile_width; scroll_area->pixel_height = scroll_area->height_in_tiles * scroll_area->tile_height; // Right align the scroll area to give margin to the start of each line. From 3120bd3d7d7f678fc4199ecfa3d3fba922d28112 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sun, 20 Aug 2023 00:21:33 +0200 Subject: [PATCH 1518/1712] Fix displayio when CIRCUITPY_REPL_LOGO is disabled We have to make room for the status bar no matter if the logo is enabled or not. We probably should add a similar option for disabling the status bar. This makes the PewPew M4 port stop crashing. (cherry picked from commit b50a7fb9137383737fcc8f635a714b45f41e20ad) --- supervisor/shared/display.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/supervisor/shared/display.c b/supervisor/shared/display.c index ce7d78c42c..4e24175a1f 100644 --- a/supervisor/shared/display.c +++ b/supervisor/shared/display.c @@ -128,10 +128,8 @@ void supervisor_start_terminal(uint16_t width_px, uint16_t height_px) { status_bar->full_change = true; scroll_area->width_in_tiles = width_in_tiles; - scroll_area->height_in_tiles = height_in_tiles; - #if CIRCUITPY_REPL_LOGO - scroll_area->height_in_tiles -= 1; - #endif + // Leave space for the status bar, no matter if we have logo or not. + scroll_area->height_in_tiles = height_in_tiles - 1; scroll_area->pixel_width = scroll_area->width_in_tiles * scroll_area->tile_width; scroll_area->pixel_height = scroll_area->height_in_tiles * scroll_area->tile_height; // Right align the scroll area to give margin to the start of each line. From b93b1d0e75fd7d263a94c56c8bf53e84f5d9aa1a Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sun, 20 Aug 2023 01:20:05 +0200 Subject: [PATCH 1519/1712] Fix the SRC_SUPERVISOR setting check --- tools/ci_set_matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci_set_matrix.py b/tools/ci_set_matrix.py index f549b6f6f1..7df8199335 100755 --- a/tools/ci_set_matrix.py +++ b/tools/ci_set_matrix.py @@ -195,7 +195,7 @@ def set_boards(build_all: bool): # Check supervisor files # This is useful for limiting workflow changes to the relevant boards if file.startswith("supervisor"): - if file in settings["SRC_SUPERVISOR"]: + if file in settings.get("SRC_SUPERVISOR", ""): boards_to_build.add(board) continue From 562520e158c2d1e38dd8c62d28b0233c54ef5f1c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 08:02:31 -0500 Subject: [PATCH 1520/1712] Skip these tests when using --emit native .. in which case the __await__ attribute is not available due to "CIRCUITPY: no support for mp_type_native_coro_wrap" (emitglue.c) --- tests/extmod/uasyncio_await_return.py | 7 +++++++ tests/extmod/uasyncio_basic.py | 10 ++++++++++ tests/extmod/uasyncio_event_fair.py | 11 +++++++++++ tests/extmod/uasyncio_gather.py | 11 +++++++++++ tests/extmod/uasyncio_gather_notimpl.py | 11 +++++++++++ tests/extmod/uasyncio_lock_cancel.py | 11 +++++++++++ tests/extmod/uasyncio_wait_for_fwd.py | 11 +++++++++++ 7 files changed, 72 insertions(+) diff --git a/tests/extmod/uasyncio_await_return.py b/tests/extmod/uasyncio_await_return.py index d375c9ea97..4a45d9b9c0 100644 --- a/tests/extmod/uasyncio_await_return.py +++ b/tests/extmod/uasyncio_await_return.py @@ -14,6 +14,13 @@ async def foo(): return 42 +try: + foo().__await__ +except AttributeError: + print("SKIP") + raise SystemExit + + async def main(): # Call function directly via an await print(await foo()) diff --git a/tests/extmod/uasyncio_basic.py b/tests/extmod/uasyncio_basic.py index 20c0a82e47..baf9d193fe 100644 --- a/tests/extmod/uasyncio_basic.py +++ b/tests/extmod/uasyncio_basic.py @@ -8,6 +8,16 @@ except ImportError: raise SystemExit +async def foo(): + return 42 + + +try: + foo().__await__ +except AttributeError: + print("SKIP") + raise SystemExit + try: import utime diff --git a/tests/extmod/uasyncio_event_fair.py b/tests/extmod/uasyncio_event_fair.py index 37eca5faef..1eee0bd7e8 100644 --- a/tests/extmod/uasyncio_event_fair.py +++ b/tests/extmod/uasyncio_event_fair.py @@ -11,6 +11,17 @@ except ImportError: raise SystemExit +async def foo(): + return 42 + + +try: + foo().__await__ +except AttributeError: + print("SKIP") + raise SystemExit + + async def task1(id): for i in range(4): print("sleep", id) diff --git a/tests/extmod/uasyncio_gather.py b/tests/extmod/uasyncio_gather.py index c081221c9f..e34176a31d 100644 --- a/tests/extmod/uasyncio_gather.py +++ b/tests/extmod/uasyncio_gather.py @@ -10,6 +10,17 @@ except ImportError: raise SystemExit +async def foo(): + return 42 + + +try: + foo().__await__ +except AttributeError: + print("SKIP") + raise SystemExit + + async def factorial(name, number): f = 1 for i in range(2, number + 1): diff --git a/tests/extmod/uasyncio_gather_notimpl.py b/tests/extmod/uasyncio_gather_notimpl.py index 3ebab9bad6..63ba645d24 100644 --- a/tests/extmod/uasyncio_gather_notimpl.py +++ b/tests/extmod/uasyncio_gather_notimpl.py @@ -10,6 +10,17 @@ except ImportError: raise SystemExit +async def foo(): + return 42 + + +try: + foo().__await__ +except AttributeError: + print("SKIP") + raise SystemExit + + def custom_handler(loop, context): print(repr(context["exception"])) diff --git a/tests/extmod/uasyncio_lock_cancel.py b/tests/extmod/uasyncio_lock_cancel.py index 85b8df8483..27428da80b 100644 --- a/tests/extmod/uasyncio_lock_cancel.py +++ b/tests/extmod/uasyncio_lock_cancel.py @@ -10,6 +10,17 @@ except ImportError: raise SystemExit +async def foo(): + return 42 + + +try: + foo().__await__ +except AttributeError: + print("SKIP") + raise SystemExit + + async def task(i, lock, lock_flag): print("task", i, "start") try: diff --git a/tests/extmod/uasyncio_wait_for_fwd.py b/tests/extmod/uasyncio_wait_for_fwd.py index 33738085ce..e608f63f6b 100644 --- a/tests/extmod/uasyncio_wait_for_fwd.py +++ b/tests/extmod/uasyncio_wait_for_fwd.py @@ -10,6 +10,17 @@ except ImportError: raise SystemExit +async def foo(): + return 42 + + +try: + foo().__await__ +except AttributeError: + print("SKIP") + raise SystemExit + + async def awaiting(t, return_if_fail): try: print("awaiting started") From 7e38b79e217a3e41f6ea9a8209d7a2f6ce03b553 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 09:45:43 -0500 Subject: [PATCH 1521/1712] Add mp_type_native_coro_wrap --- py/emitglue.c | 10 +++++++--- py/obj.h | 6 ++++-- py/objgenerator.c | 25 ++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/py/emitglue.c b/py/emitglue.c index ed30ea35f2..bb68f3d44b 100644 --- a/py/emitglue.c +++ b/py/emitglue.c @@ -188,10 +188,11 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, const mp_module case MP_CODE_NATIVE_VIPER: fun = mp_obj_new_fun_native(def_args, rc->fun_data, context, rc->children); // Check for a generator function, and if so change the type of the object - if ((rc->scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0) { + if ((rc->scope_flags & MP_SCOPE_FLAG_ASYNC) != 0) { + ((mp_obj_base_t *)MP_OBJ_TO_PTR(fun))->type = &mp_type_native_coro_wrap; + } else if ((rc->scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0) { ((mp_obj_base_t *)MP_OBJ_TO_PTR(fun))->type = &mp_type_native_gen_wrap; } - // CIRCUITPY: no support for mp_type_native_coro_wrap, native coroutine objects (yet). break; #endif #if MICROPY_EMIT_INLINE_ASM @@ -206,9 +207,12 @@ mp_obj_t mp_make_function_from_raw_code(const mp_raw_code_t *rc, const mp_module // check for generator functions and if so change the type of the object // A generator is MP_SCOPE_FLAG_ASYNC | MP_SCOPE_FLAG_GENERATOR, // so check for ASYNC first. + #if MICROPY_PY_ASYNC_AWAIT if ((rc->scope_flags & MP_SCOPE_FLAG_ASYNC) != 0) { ((mp_obj_base_t *)MP_OBJ_TO_PTR(fun))->type = &mp_type_coro_wrap; - } else if ((rc->scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0) { + } else + #endif + if ((rc->scope_flags & MP_SCOPE_FLAG_GENERATOR) != 0) { ((mp_obj_base_t *)MP_OBJ_TO_PTR(fun))->type = &mp_type_gen_wrap; } diff --git a/py/obj.h b/py/obj.h index ef8b7a0351..78a50ff219 100644 --- a/py/obj.h +++ b/py/obj.h @@ -739,9 +739,11 @@ extern const mp_obj_type_t mp_type_gen_wrap; extern const mp_obj_type_t mp_type_native_gen_wrap; extern const mp_obj_type_t mp_type_gen_instance; // CIRCUITPY -extern const mp_obj_type_t mp_type_coro_wrap; -// CIRCUITPY #if MICROPY_PY_ASYNC_AWAIT +extern const mp_obj_type_t mp_type_coro_wrap; +#if MICROPY_EMIT_NATIVE +extern const mp_obj_type_t mp_type_native_coro_wrap; +#endif extern const mp_obj_type_t mp_type_coro_instance; #endif extern const mp_obj_type_t mp_type_fun_builtin_0; diff --git a/py/objgenerator.c b/py/objgenerator.c index 05daaf31f7..88c029a3dc 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -98,6 +98,7 @@ const mp_obj_type_t mp_type_gen_wrap = { ), }; +#if MICROPY_PY_ASYNC_AWAIT const mp_obj_type_t mp_type_coro_wrap = { { &mp_type_type }, .flags = MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_EXTENDED, @@ -110,6 +111,7 @@ const mp_obj_type_t mp_type_coro_wrap = { .unary_op = mp_generic_unary_op, ), }; +#endif /******************************************************************************/ // native generator wrapper @@ -141,7 +143,13 @@ STATIC mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_k MP_BC_PRELUDE_SIG_DECODE(ip); // Allocate the generator object, with room for local stack (exception stack not needed). - mp_obj_gen_instance_native_t *o = mp_obj_malloc_var(mp_obj_gen_instance_native_t, byte, n_state * sizeof(mp_obj_t), &mp_type_gen_instance); + mp_obj_gen_instance_native_t *o = mp_obj_malloc_var(mp_obj_gen_instance_native_t, byte, n_state * sizeof(mp_obj_t), + #if MICROPY_PY_ASYNC_AWAIT + (self_fun->base.type == &mp_type_native_gen_wrap) ? &mp_type_gen_instance : &mp_type_coro_instance + #else + &mp_type_gen_instance + #endif + ); // Parse the input arguments and set up the code state o->pend_exc = mp_const_none; @@ -177,6 +185,21 @@ const mp_obj_type_t mp_type_native_gen_wrap = { ), }; +#if MICROPY_PY_ASYNC_AWAIT +const mp_obj_type_t mp_type_native_coro_wrap = { + { &mp_type_type }, + .flags = MP_TYPE_FLAG_BINDS_SELF | MP_TYPE_FLAG_EXTENDED, + .name = MP_QSTR_coroutine, + #if MICROPY_PY_FUNCTION_ATTRS + .attr = mp_obj_fun_bc_attr, + #endif + MP_TYPE_EXTENDED_FIELDS( + .call = native_gen_wrap_call, + .unary_op = mp_generic_unary_op, + ), +}; +#endif + #endif // MICROPY_EMIT_NATIVE /******************************************************************************/ From d8484df07575f3e0e7cd4cdeff829ea153141e1f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 09:54:36 -0500 Subject: [PATCH 1522/1712] basic async_with test passes under native code --- tests/run-tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-tests.py b/tests/run-tests.py index 8492943566..45b4ebf536 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -505,7 +505,7 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): {"basics/%s.py" % t for t in "gen_yield_from_close generator_name".split()} ) # require raise_varargs, generator name skip_tests.update( - {"basics/async_%s.py" % t for t in "await with with2 with_break with_return".split()} + {"basics/async_%s.py" % t for t in "with with2 with_break with_return".split()} ) # require async_with skip_tests.update( {"basics/%s.py" % t for t in "try_reraise try_reraise2".split()} From d277294a1460ce623b0c39241e31ca5acc848636 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 10:07:06 -0500 Subject: [PATCH 1523/1712] Alias m_new_ll to m_new this saves changing uses of it in ports/ and if we re-add ll later, it'll make it easier to find the places that needed long-lived allocation. --- py/misc.h | 1 + 1 file changed, 1 insertion(+) diff --git a/py/misc.h b/py/misc.h index d6d0a12776..7c8d83e876 100644 --- a/py/misc.h +++ b/py/misc.h @@ -64,6 +64,7 @@ typedef unsigned int uint; // TODO make a lazy m_renew that can increase by a smaller amount than requested (but by at least 1 more element) #define m_new(type, num) ((type *)(m_malloc(sizeof(type) * (num)))) +#define m_new_ll(type, num) m_new(type, num) // CIRCUITPY: clue to long-lived allocator #define m_new_maybe(type, num) ((type *)(m_malloc_maybe(sizeof(type) * (num)))) #define m_new0(type, num) ((type *)(m_malloc0(sizeof(type) * (num)))) #define m_new_obj(type) (m_new(type, 1)) From d9022343dc998e35f9539322d3f01629e136ea37 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 10:07:32 -0500 Subject: [PATCH 1524/1712] Allow freezing 31-bit ints --- tools/mpy-tool.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/mpy-tool.py b/tools/mpy-tool.py index c5f56386c9..3a59ac6590 100755 --- a/tools/mpy-tool.py +++ b/tools/mpy-tool.py @@ -327,11 +327,9 @@ class Opcode: self.extra_arg = extra_arg -# This definition of a small int covers all possible targets, in the sense that every -# target can encode as a small int, an integer that passes this test. The minimum is set -# by MICROPY_OBJ_REPR_B on a 16-bit machine, where there are 14 bits for the small int. +# CIRCUITPY: we assume MICROPY_OBJ_REPR_C def mp_small_int_fits(i): - return -0x2000 <= i <= 0x1FFF + return -0x4_000_000 <= i <= 0x3_FFF_FFF def mp_encode_uint(val, signed=False): From a3a9c7a09831dd802eb8ce571f9e2056280367eb Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 10:07:41 -0500 Subject: [PATCH 1525/1712] fix typo --- ports/espressif/common-hal/nvm/ByteArray.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/common-hal/nvm/ByteArray.c b/ports/espressif/common-hal/nvm/ByteArray.c index 77e3086b88..d74de38164 100644 --- a/ports/espressif/common-hal/nvm/ByteArray.c +++ b/ports/espressif/common-hal/nvm/ByteArray.c @@ -66,7 +66,7 @@ static esp_err_t get_bytes(nvs_handle_t handle, uint8_t **buf_out) { *buf_out = NULL; return result; } - buf = m_m_alloc(size); // this SHOULD be the same as + buf = m_malloc(size); // this SHOULD be the same as if (result == ESP_OK) { result = nvs_get_blob(handle, "data", buf, &size); } else { From e74ef8b960a51112cb46ecfcf8469e23685e2992 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 10:07:48 -0500 Subject: [PATCH 1526/1712] ringbuf_alloc no longer has a long-lived argument --- ports/espressif/common-hal/espnow/ESPNow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/common-hal/espnow/ESPNow.c b/ports/espressif/common-hal/espnow/ESPNow.c index a048c7f9f1..ff07497a30 100644 --- a/ports/espressif/common-hal/espnow/ESPNow.c +++ b/ports/espressif/common-hal/espnow/ESPNow.c @@ -143,7 +143,7 @@ void common_hal_espnow_init(espnow_obj_t *self) { } self->recv_buffer = m_new_obj(ringbuf_t); - if (!ringbuf_alloc(self->recv_buffer, self->recv_buffer_size, true)) { + if (!ringbuf_alloc(self->recv_buffer, self->recv_buffer_size /*, true*/)) { m_malloc_fail(self->recv_buffer_size); } From d5d566dc65f31541ac159b3345e460b7002decad Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 10:15:43 -0500 Subject: [PATCH 1527/1712] Don't assume __ICACHE_PRESENT is defined This seems to only be defined in cmsis files for M7 family MCUs, so it's not for e.g., makerdiary_m60_keyboard which enables loading of native code. Lower MCUs don't ever have icache, so the default is "off". --- py/emitglue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/emitglue.c b/py/emitglue.c index bb68f3d44b..d4d8439881 100644 --- a/py/emitglue.c +++ b/py/emitglue.c @@ -110,7 +110,7 @@ void mp_emit_glue_assign_native(mp_raw_code_t *rc, mp_raw_code_kind_t kind, void // so that the generated native code which was created in data RAM will // be available for execution from instruction RAM. #if MICROPY_EMIT_THUMB || MICROPY_EMIT_INLINE_THUMB - #if __ICACHE_PRESENT == 1 + #if defined(__ICACHE_PRESENT) && __ICACHE_PRESENT == 1 // Flush D-cache, so the code emitted is stored in RAM. MP_HAL_CLEAN_DCACHE(fun_data, fun_len); // Invalidate I-cache, so the newly-created code is reloaded from RAM. From 44c26d9d41771c1af11e285064f0b5151b44efad Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 11:08:43 -0500 Subject: [PATCH 1528/1712] Ensure sdkconfig.h is built early, by making Makefile depend on it Here's why this helps fix the build error: If this file does not exist or is out of date, then it is generated and then the Makefile is re-read. I don't know why this worked before but stopped now; it must have to do with the rework of header generation in the MP build system. --- ports/espressif/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index e87805ba03..a335115f0f 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -353,6 +353,7 @@ endif # create the config headers .PHONY: do-sdkconfig do-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h +Makefile: $(BUILD)/esp-idf/config/sdkconfig.h $(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig CMakeLists.txt | $(BUILD)/esp-idf IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA) From d94ff9d1cf15843f37acccf788253cb74dfe768d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 11:14:41 -0500 Subject: [PATCH 1529/1712] turn off audiopwmio to save flash space --- ports/nrf/boards/bluemicro833/mpconfigboard.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/nrf/boards/bluemicro833/mpconfigboard.mk b/ports/nrf/boards/bluemicro833/mpconfigboard.mk index 9b230e9a53..27224e5d1d 100644 --- a/ports/nrf/boards/bluemicro833/mpconfigboard.mk +++ b/ports/nrf/boards/bluemicro833/mpconfigboard.mk @@ -8,10 +8,11 @@ MCU_CHIP = nrf52833 INTERNAL_FLASH_FILESYSTEM = 1 CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_AUDIOPWMIO = 0 CIRCUITPY_AUDIOMIXER = 0 CIRCUITPY_KEYPAD = 1 CIRCUITPY_NVM = 0 CIRCUITPY_ONEWIREIO = 0 -CIRCUITPY_PIXELBUF = 1 +CIRCUITPY_PIXELBUF = 1 CIRCUITPY_PIXELMAP = 0 CIRCUITPY_TOUCHIO = 0 From bb8e0ae76e8899f5db19a4367439e9e46da3b084 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 11:18:46 -0500 Subject: [PATCH 1530/1712] turn off some modules to save flash space --- ports/nrf/boards/pca10100/mpconfigboard.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/nrf/boards/pca10100/mpconfigboard.mk b/ports/nrf/boards/pca10100/mpconfigboard.mk index 356eb16f11..a081a0db47 100644 --- a/ports/nrf/boards/pca10100/mpconfigboard.mk +++ b/ports/nrf/boards/pca10100/mpconfigboard.mk @@ -6,3 +6,6 @@ USB_MANUFACTURER = "Nordic Semiconductor" MCU_CHIP = nrf52833 INTERNAL_FLASH_FILESYSTEM = 1 + +CIRCUITPY_ONEWIREIO = 0 +CIRCUITPY_AUDIOMIXER = 0 From c122ca18fdd8cb5dc2f96566e7d4da4acdf3ce6e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 11:20:57 -0500 Subject: [PATCH 1531/1712] restore missing board.c file --- ports/stm/boards/stm32f746g_discovery/board.c | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 ports/stm/boards/stm32f746g_discovery/board.c diff --git a/ports/stm/boards/stm32f746g_discovery/board.c b/ports/stm/boards/stm32f746g_discovery/board.c new file mode 100644 index 0000000000..56c90bd8c6 --- /dev/null +++ b/ports/stm/boards/stm32f746g_discovery/board.c @@ -0,0 +1,51 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2020 Mark Olsson + * + * 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 "stm32f7xx_hal.h" +#include "common-hal/microcontroller/Pin.h" + +void board_init(void) { + GPIO_InitTypeDef GPIO_InitStructure; + + __HAL_RCC_GPIOK_CLK_ENABLE(); + + /* + * Turn off the backlight as it is distracting during development. + * LCD_BL_CTRL = PK3 + */ + GPIO_InitStructure.Pin = GPIO_PIN_3; + GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; + GPIO_InitStructure.Pull = GPIO_PULLUP; + GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + HAL_GPIO_Init(GPIOK, &GPIO_InitStructure); + HAL_GPIO_WritePin(GPIOK, GPIO_PIN_3, GPIO_PIN_RESET); + + never_reset_pin_number(10, 3); +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. From f9e99bd3c3012a2e74e0e9e6d39108b1ed58a978 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 11:30:36 -0500 Subject: [PATCH 1532/1712] Fix picow build --- ports/raspberrypi/Makefile | 2 +- py/misc.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 41a447ef98..4ae03bff52 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -39,7 +39,7 @@ INC_CYW43 := \ -isystem sdk/src/rp2_common/pico_lwip/include/ \ -isystem sdk/src/rp2_common/pico_rand/include/ \ -CFLAGS_CYW43 := -DCYW43_LWIP=1 -DPICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1 -DCYW43_USE_SPI -DIGNORE_GPIO25 -DIGNORE_GPIO23 -DIGNORE_GPIO24 -DCYW43_LOGIC_DEBUG=0 -DCYW43_NETUTILS=1 +CFLAGS_CYW43 := -DCYW43_LWIP=1 -DPICO_CYW43_ARCH_THREADSAFE_BACKGROUND=1 -DCYW43_USE_SPI -DIGNORE_GPIO25 -DIGNORE_GPIO23 -DIGNORE_GPIO24 -DCYW43_LOGIC_DEBUG=0 -DCYW43_NETUTILS=1 -DPICO_BUILD SRC_SDK_CYW43 := \ src/common/pico_sync/sem.c \ src/rp2_common/pico_async_context/async_context_base.c \ diff --git a/py/misc.h b/py/misc.h index 7c8d83e876..816d6446b1 100644 --- a/py/misc.h +++ b/py/misc.h @@ -73,6 +73,7 @@ typedef unsigned int uint; #define m_new_obj_var_maybe(obj_type, var_type, var_num) ((obj_type *)m_malloc_maybe(sizeof(obj_type) + sizeof(var_type) * (var_num))) #if MICROPY_ENABLE_FINALISER #define m_new_obj_with_finaliser(type) ((type *)(m_malloc_with_finaliser(sizeof(type)))) +#define m_new_ll_obj_with_finaliser(type) m_new_obj_with_finaliser(type) // CIRCUITPY: clue to long-lived allocator #define m_new_obj_var_with_finaliser(type, var_type, var_num) ((type *)m_malloc_with_finaliser(sizeof(type) + sizeof(var_type) * (var_num))) #else #define m_new_obj_with_finaliser(type) m_new_obj(type) From 1399d0f25b4c7bf4935231c47621a3b6d3f8029a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 14:26:27 -0500 Subject: [PATCH 1533/1712] guard mp_type_native_gen_wrap declaration with MICROPY_EMIT_NATIVE --- py/obj.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/py/obj.h b/py/obj.h index 78a50ff219..d1874a8cd2 100644 --- a/py/obj.h +++ b/py/obj.h @@ -736,7 +736,9 @@ extern const mp_obj_type_t mp_type_zip; extern const mp_obj_type_t mp_type_array; extern const mp_obj_type_t mp_type_super; extern const mp_obj_type_t mp_type_gen_wrap; +#if MICROPY_EMIT_NATIVE extern const mp_obj_type_t mp_type_native_gen_wrap; +#endif extern const mp_obj_type_t mp_type_gen_instance; // CIRCUITPY #if MICROPY_PY_ASYNC_AWAIT From 0cab3359dfb3b1ad1ed4fd84cfc6819bc2046250 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 20 Aug 2023 14:26:48 -0500 Subject: [PATCH 1534/1712] ignore some cast-align diagnostics --- py/objgenerator.c | 3 +++ py/persistentcode.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/py/objgenerator.c b/py/objgenerator.c index 88c029a3dc..4443f81ce1 100644 --- a/py/objgenerator.c +++ b/py/objgenerator.c @@ -130,7 +130,10 @@ STATIC mp_obj_t native_gen_wrap_call(mp_obj_t self_in, size_t n_args, size_t n_k mp_obj_fun_bc_t *self_fun = MP_OBJ_TO_PTR(self_in); // Determine start of prelude. + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" uintptr_t prelude_ptr_index = ((uintptr_t *)self_fun->bytecode)[0]; + #pragma GCC diagnostic pop const uint8_t *prelude_ptr; if (prelude_ptr_index == 0) { prelude_ptr = (void *)self_fun->child_table; diff --git a/py/persistentcode.c b/py/persistentcode.c index 74b26cb285..272298274f 100644 --- a/py/persistentcode.c +++ b/py/persistentcode.c @@ -87,10 +87,16 @@ void mp_native_relocate(void *ri_in, uint8_t *text, uintptr_t reloc_text) { size_t addr = read_uint(ri->reader); if ((addr & 1) == 0) { // Point to somewhere in text + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" addr_to_adjust = &((uintptr_t *)text)[addr >> 1]; + #pragma GCC diagnostic pop } else { // Point to somewhere in rodata + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wcast-align" addr_to_adjust = &((uintptr_t *)ri->rodata)[addr >> 1]; + #pragma GCC diagnostic pop } } op >>= 1; From cb4d7822bfc9428a10a901f1528d9857ec9f6cb7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 21 Aug 2023 15:29:08 -0500 Subject: [PATCH 1535/1712] support old names for push/pop methods in TaskQueue .. and update asyncio to a version that uses the old names but has other new asyncio improvements. --- extmod/moduasyncio.c | 5 +++++ frozen/Adafruit_CircuitPython_asyncio | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/extmod/moduasyncio.c b/extmod/moduasyncio.c index ea81fbc310..2ba8efb1fe 100644 --- a/extmod/moduasyncio.c +++ b/extmod/moduasyncio.c @@ -160,6 +160,11 @@ STATIC const mp_rom_map_elem_t task_queue_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_push), MP_ROM_PTR(&task_queue_push_obj) }, { MP_ROM_QSTR(MP_QSTR_pop), MP_ROM_PTR(&task_queue_pop_obj) }, { MP_ROM_QSTR(MP_QSTR_remove), MP_ROM_PTR(&task_queue_remove_obj) }, + + // CIRCUITPYTHON: remove these after the bundle need not support 8.x + { MP_ROM_QSTR(MP_QSTR_push_head), MP_ROM_PTR(&task_queue_push_obj) }, + { MP_ROM_QSTR(MP_QSTR_push_sorted), MP_ROM_PTR(&task_queue_push_obj) }, + { MP_ROM_QSTR(MP_QSTR_pop_head), MP_ROM_PTR(&task_queue_pop_obj) }, }; STATIC MP_DEFINE_CONST_DICT(task_queue_locals_dict, task_queue_locals_dict_table); diff --git a/frozen/Adafruit_CircuitPython_asyncio b/frozen/Adafruit_CircuitPython_asyncio index 510d4a3bb9..7c25d09be0 160000 --- a/frozen/Adafruit_CircuitPython_asyncio +++ b/frozen/Adafruit_CircuitPython_asyncio @@ -1 +1 @@ -Subproject commit 510d4a3bb9326a31105622fe1905301a4f543a2c +Subproject commit 7c25d09be04a2979bcfb43b801de57594112808d From a5578cf0678625a246c3e2864aac27f75bf651a0 Mon Sep 17 00:00:00 2001 From: Ciro Cattuto Date: Mon, 21 Aug 2023 22:47:09 +0200 Subject: [PATCH 1536/1712] Fixed compilion error when FF_MAX_SS != FF_MIN_SS --- supervisor/shared/usb/usb_msc_flash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/usb/usb_msc_flash.c b/supervisor/shared/usb/usb_msc_flash.c index f1830332d4..f212d55270 100644 --- a/supervisor/shared/usb/usb_msc_flash.c +++ b/supervisor/shared/usb/usb_msc_flash.c @@ -195,7 +195,7 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t * // MicroPython let's update the cached FatFs sector if it's the one // we just wrote. #if FF_MAX_SS != FF_MIN_SS - if (vfs->ssize == MSC_FLASH_BLOCK_SIZE) { + if (vfs->fatfs.ssize == MSC_FLASH_BLOCK_SIZE) { #else // The compiler can optimize this away. if (FF_MAX_SS == FILESYSTEM_BLOCK_SIZE) { From d23ddff97160ff5d1e9d7baff0ed360fa3b6a2d9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 21 Aug 2023 15:57:45 -0500 Subject: [PATCH 1537/1712] Add several constants needed to use multicast UDP This was verified by @todbot to work on esp32 s2 and s3; the constant should match any system that uses LWIP numbering. --- shared-bindings/socketpool/SocketPool.c | 6 ++++++ shared-bindings/socketpool/SocketPool.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/shared-bindings/socketpool/SocketPool.c b/shared-bindings/socketpool/SocketPool.c index 3023721378..381291fbaf 100644 --- a/shared-bindings/socketpool/SocketPool.c +++ b/shared-bindings/socketpool/SocketPool.c @@ -82,6 +82,10 @@ MP_DEFINE_EXCEPTION(gaierror, OSError) //| TCP_NODELAY: int //| //| IPPROTO_TCP: int +//| IPPROTO_IP: int +//| +//| IP_MULTICAST_TTL: int +//| //| def socket(self, family: int = AF_INET, type: int = SOCK_STREAM) -> socketpool.Socket: //| """Create a new socket //| @@ -182,6 +186,8 @@ STATIC const mp_rom_map_elem_t socketpool_socketpool_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_TCP_NODELAY), MP_ROM_INT(SOCKETPOOL_TCP_NODELAY) }, { MP_ROM_QSTR(MP_QSTR_IPPROTO_TCP), MP_ROM_INT(SOCKETPOOL_IPPROTO_TCP) }, + { MP_ROM_QSTR(MP_QSTR_IPPROTO_IP), MP_ROM_INT(SOCKETPOOL_IPPROTO_IP) }, + { MP_ROM_QSTR(MP_QSTR_IP_MULTICAST_TTL), MP_ROM_INT(SOCKETPOOL_IP_MULTICAST_TTL) }, { MP_ROM_QSTR(MP_QSTR_EAI_NONAME), MP_ROM_INT(SOCKETPOOL_EAI_NONAME) }, }; diff --git a/shared-bindings/socketpool/SocketPool.h b/shared-bindings/socketpool/SocketPool.h index 6409f8c763..9e9d7fde4f 100644 --- a/shared-bindings/socketpool/SocketPool.h +++ b/shared-bindings/socketpool/SocketPool.h @@ -45,6 +45,7 @@ typedef enum { } socketpool_socketpool_addressfamily_t; typedef enum { + SOCKETPOOL_IPPROTO_IP = 0, SOCKETPOOL_IPPROTO_TCP = 6, } socketpool_socketpool_ipproto_t; @@ -52,6 +53,10 @@ typedef enum { SOCKETPOOL_TCP_NODELAY = 1, } socketpool_socketpool_tcpopt_t; +typedef enum { + SOCKETPOOL_IP_MULTICAST_TTL = 5, +} socketpool_socketpool_ipopt_t; + typedef enum { SOCKETPOOL_EAI_NONAME = -2, } socketpool_eai_t; From 0de6ced98a7f7fb6c210ac51cb4ffdbc86ac323c Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 22 Aug 2023 01:24:50 +0200 Subject: [PATCH 1538/1712] 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 | 141 +++++++++++++++++++----------- locale/cs.po | 123 +++++++++++++++----------- locale/de_DE.po | 172 ++++++++++++++++++++++--------------- locale/el.po | 114 ++++++++++++++---------- locale/en_GB.po | 166 +++++++++++++++++++++-------------- locale/es.po | 179 ++++++++++++++++++++++---------------- locale/fil.po | 161 +++++++++++++++++++--------------- locale/fr.po | 181 +++++++++++++++++++++++---------------- locale/hi.po | 108 +++++++++++++---------- locale/it_IT.po | 161 +++++++++++++++++++--------------- locale/ja.po | 153 +++++++++++++++++++++------------ locale/ko.po | 114 ++++++++++++++---------- locale/nl.po | 167 +++++++++++++++++++++--------------- locale/pl.po | 164 ++++++++++++++++++++--------------- locale/pt_BR.po | 175 ++++++++++++++++++++++--------------- locale/ru.po | 123 +++++++++++++++----------- locale/sv.po | 175 ++++++++++++++++++++++--------------- locale/tr.po | 123 +++++++++++++++----------- locale/zh_Latn_pinyin.po | 175 ++++++++++++++++++++++--------------- 19 files changed, 1727 insertions(+), 1148 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index efbdd10479..c1c0f13d5b 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -142,6 +142,10 @@ msgstr "%q sedang digunakan" msgid "%q index out of range" msgstr "%q indeks di luar batas" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "indeks %q harus bilangan bulat, bukan %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "" @@ -217,7 +221,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -420,6 +424,10 @@ msgstr "'yield from' di dalam fungsi async" msgid "'yield' outside function" msgstr "'yield' diluar fungsi" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x harus menjadi target assignment" @@ -850,10 +858,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "File .mpy rusak" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -1148,14 +1152,6 @@ msgstr "" msgid "In-buffer elements must be <= 4 bytes long" msgstr "" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"File .mpy tidak kompatibel. Perbarui semua file .mpy. Lihat http://adafru.it/" -"mpy-update untuk info lebih lanjut." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "Ukuran penyangga salah" @@ -1502,7 +1498,7 @@ msgstr "" msgid "No in or out in program" msgstr "" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "Tidak ada dukungan bilangan bulat yang panjang" @@ -2526,6 +2522,10 @@ msgstr "" msgid "array/bytes required on right side" msgstr "diperlukan array/byte di sisi kanan" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" @@ -2615,6 +2615,10 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2660,7 +2664,7 @@ msgstr "tidak dapat menetapkan ke ekspresi" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2669,6 +2673,11 @@ msgstr "" msgid "can't convert %s to complex" msgstr "" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "" @@ -2678,11 +2687,11 @@ msgid "can't convert complex to float" msgstr "" #: py/obj.c -msgid "can't convert to %q" +msgid "can't convert to complex" msgstr "" #: py/obj.c -msgid "can't convert to complex" +msgid "can't convert to float" msgstr "" #: py/runtime.c @@ -2709,14 +2718,6 @@ msgstr "" msgid "can't do truncated division of a complex number" msgstr "" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "tidak bisa memiliki **x ganda" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "tidak bisa memiliki *x ganda" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "" @@ -2771,6 +2772,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "" @@ -2867,10 +2872,6 @@ msgstr "" msgid "compression header" msgstr "kompresi header" -#: py/parse.c -msgid "constant must be an integer" -msgstr "" - #: py/emitnative.c msgid "conversion to object" msgstr "" @@ -3207,7 +3208,11 @@ msgid "import * not at module level" msgstr "" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" msgstr "" #: py/objstr.c @@ -3236,6 +3241,10 @@ msgstr "" msgid "index out of range" msgstr "index keluar dari jangkauan" +#: py/obj.c +msgid "indices must be integers" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "" @@ -3369,10 +3378,6 @@ msgstr "" msgid "invalid exception" msgstr "" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "format tidak valid" - #: py/objstr.c msgid "invalid format specifier" msgstr "" @@ -3434,10 +3439,6 @@ msgstr "" msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "argumen keyword belum diimplementasi - gunakan args normal" -#: py/bc.c -msgid "keywords must be strings" -msgstr "keyword harus berupa string" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "" @@ -3662,14 +3663,6 @@ msgstr "argumen non-default mengikuti argumen standar(default)" msgid "non-hex digit found" msgstr "digit non-hex ditemukan" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "non-keyword arg setelah */**" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "non-keyword arg setelah keyword arg" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "" @@ -3682,6 +3675,10 @@ msgstr "" msgid "not a 128-bit UUID" msgstr "" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "" @@ -3921,6 +3918,14 @@ msgstr "" msgid "port must be >= 0" msgstr "" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "" @@ -3949,6 +3954,11 @@ msgstr "" msgid "relative import" msgstr "relative import" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "" @@ -4143,6 +4153,10 @@ msgstr "" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "" @@ -4168,6 +4182,10 @@ msgstr "" msgid "trapz is defined for 1D iterables" msgstr "" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4387,6 +4405,34 @@ msgstr "zi harus berjenis float" msgid "zi must be of shape (n_section, 2)" msgstr "Zi harus berbentuk (n_section, 2)" +#~ msgid "Corrupt .mpy file" +#~ msgstr "File .mpy rusak" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "File .mpy tidak kompatibel. Perbarui semua file .mpy. Lihat http://adafru." +#~ "it/mpy-update untuk info lebih lanjut." + +#~ msgid "can't have multiple **x" +#~ msgstr "tidak bisa memiliki **x ganda" + +#~ msgid "can't have multiple *x" +#~ msgstr "tidak bisa memiliki *x ganda" + +#~ msgid "invalid format" +#~ msgstr "format tidak valid" + +#~ msgid "keywords must be strings" +#~ msgstr "keyword harus berupa string" + +#~ msgid "non-keyword arg after */**" +#~ msgstr "non-keyword arg setelah */**" + +#~ msgid "non-keyword arg after keyword arg" +#~ msgstr "non-keyword arg setelah keyword arg" + #~ msgid "Too many display busses" #~ msgstr "Terlalu banyak tampilan bus" @@ -4476,9 +4522,6 @@ msgstr "Zi harus berbentuk (n_section, 2)" #~ msgid "zero step" #~ msgstr "nol langkah" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "indeks %q harus bilangan bulat, bukan %s" - #~ msgid "To exit, please reset the board without " #~ msgstr "Untuk keluar, silahkan reset board tanpa " diff --git a/locale/cs.po b/locale/cs.po index 62e9fd389e..6fb252a268 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -143,6 +143,10 @@ msgstr "%q se právě používá" msgid "%q index out of range" msgstr "Index %q je mimo rozsah" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "Indexy %q musí být celá čísla, nikoli %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "Inicializace %q selhala" @@ -218,7 +222,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -421,6 +425,10 @@ msgstr "'yield from' volán uvnitř funkce async" msgid "'yield' outside function" msgstr "'yield' je volán mimo funkci" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "" @@ -848,10 +856,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "Poškozený soubor .mpy" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -1148,14 +1152,6 @@ msgstr "Periférie I2C je používána" msgid "In-buffer elements must be <= 4 bytes long" msgstr "" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"Nekompatibilní soubor .mpy. Aktualizujte prosím všechny soubory .mpy. Další " -"informace naleznete na adrese http://adafru.it/mpy-update." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "Nesprávná velikost vyrovnávací paměti" @@ -1502,7 +1498,7 @@ msgstr "" msgid "No in or out in program" msgstr "" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "" @@ -2513,6 +2509,10 @@ msgstr "" msgid "array/bytes required on right side" msgstr "" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" @@ -2602,6 +2602,10 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2647,7 +2651,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2656,6 +2660,11 @@ msgstr "" msgid "can't convert %s to complex" msgstr "" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "" @@ -2665,11 +2674,11 @@ msgid "can't convert complex to float" msgstr "" #: py/obj.c -msgid "can't convert to %q" +msgid "can't convert to complex" msgstr "" #: py/obj.c -msgid "can't convert to complex" +msgid "can't convert to float" msgstr "" #: py/runtime.c @@ -2696,14 +2705,6 @@ msgstr "" msgid "can't do truncated division of a complex number" msgstr "" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "" @@ -2758,6 +2759,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "" @@ -2854,10 +2859,6 @@ msgstr "" msgid "compression header" msgstr "" -#: py/parse.c -msgid "constant must be an integer" -msgstr "" - #: py/emitnative.c msgid "conversion to object" msgstr "" @@ -3194,7 +3195,11 @@ msgid "import * not at module level" msgstr "" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" msgstr "" #: py/objstr.c @@ -3223,6 +3228,10 @@ msgstr "" msgid "index out of range" msgstr "" +#: py/obj.c +msgid "indices must be integers" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "" @@ -3356,10 +3365,6 @@ msgstr "" msgid "invalid exception" msgstr "" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "" - #: py/objstr.c msgid "invalid format specifier" msgstr "" @@ -3421,10 +3426,6 @@ msgstr "" msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "" -#: py/bc.c -msgid "keywords must be strings" -msgstr "" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "" @@ -3649,14 +3650,6 @@ msgstr "" msgid "non-hex digit found" msgstr "" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "" @@ -3669,6 +3662,10 @@ msgstr "" msgid "not a 128-bit UUID" msgstr "" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "" @@ -3907,6 +3904,14 @@ msgstr "" msgid "port must be >= 0" msgstr "" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "" @@ -3935,6 +3940,11 @@ msgstr "" msgid "relative import" msgstr "" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "" @@ -4129,6 +4139,10 @@ msgstr "" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "" @@ -4154,6 +4168,10 @@ msgstr "" msgid "trapz is defined for 1D iterables" msgstr "" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4373,6 +4391,16 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Corrupt .mpy file" +#~ msgstr "Poškozený soubor .mpy" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "Nekompatibilní soubor .mpy. Aktualizujte prosím všechny soubory .mpy. " +#~ "Další informace naleznete na adrese http://adafru.it/mpy-update." + #~ msgid "Hardware busy, try alternative pins" #~ msgstr "Hardware je zaneprázdněn, zkuste alternativní piny" @@ -4482,9 +4510,6 @@ msgstr "" #~ msgid "No more than %d HID devices allowed" #~ msgstr "Ne více než %d HID zařízení je povoleno" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "Indexy %q musí být celá čísla, nikoli %s" - #~ msgid "Firmware image is invalid" #~ msgstr "Obraz firmwaru je nevalidní" diff --git a/locale/de_DE.po b/locale/de_DE.po index f615ab9aa9..5b59af8741 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -151,6 +151,10 @@ msgstr "%q in Benutzung" msgid "%q index out of range" msgstr "Der Index %q befindet sich außerhalb des Bereiches" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "%q Indizes müssen Integer sein, nicht %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "%q Initialisierung ist gescheitert" @@ -227,7 +231,7 @@ msgstr "%q muss ein Array vom Typ 'h' sein" msgid "%q must be of type %q or %q, not %q" msgstr "%q muss von Typ %q oder %q sein, nicht %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q muss von Typ %q sein, nicht %q" @@ -431,6 +435,10 @@ msgstr "'yield from' innerhalb einer async Funktion" msgid "'yield' outside function" msgstr "'yield' außerhalb einer Funktion" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x muss Zuordnungsziel sein" @@ -862,10 +870,6 @@ msgstr "Koordinaten-Arrays haben unterschiedliche Längen" msgid "Coordinate arrays types have different sizes" msgstr "Typen der Koordinaten-Arrays haben unterschiedliche Längen" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "Beschädigte .mpy Datei" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Clock konnte nicht ermittelt werden" @@ -1168,14 +1172,6 @@ msgstr "I2C Peripherie in Verwendung" msgid "In-buffer elements must be <= 4 bytes long" msgstr "In-Puffer-Elemente müssen <= 4 Bytes lang sein" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"Inkompatible .mpy-Datei. Bitte aktualisiere alle .mpy-Dateien. Siehe http://" -"adafru.it/mpy-update für weitere Informationen." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "Inkorrekte Puffergröße" @@ -1527,7 +1523,7 @@ msgstr "Nicht in Programm" msgid "No in or out in program" msgstr "Kein Ein oder Aus in Programm" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "Keine langen Integer (long) unterstützt" @@ -2570,6 +2566,10 @@ msgstr "Array ist zu groß" msgid "array/bytes required on right side" msgstr "Array/Bytes auf der rechten Seite erforderlich" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "Versuch (arg)min/(arg)max einer leeren Sequenz zu holen" @@ -2659,6 +2659,10 @@ msgstr "Puffer zu klein" msgid "buffer too small for requested bytes" msgstr "Der Puffer ist zu klein für die angefragten Bytes" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "Byte-Länge ist kein vielfaches der Item-Größe" @@ -2706,7 +2710,7 @@ msgstr "kann keinem Ausdruck zuweisen" msgid "can't cancel self" msgstr "kann self nicht abbrechen" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "kann %q nicht zu %q konvertieren" @@ -2715,6 +2719,11 @@ msgstr "kann %q nicht zu %q konvertieren" msgid "can't convert %s to complex" msgstr "kann %s nicht nach complex konvertieren" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "kann %s nicht nach float konvertieren" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "Kann '%q' Objekt nicht implizit nach %q konvertieren" @@ -2723,14 +2732,14 @@ msgstr "Kann '%q' Objekt nicht implizit nach %q konvertieren" msgid "can't convert complex to float" msgstr "Complex kann nicht in Float konvertiert werden" -#: py/obj.c -msgid "can't convert to %q" -msgstr "kann nicht zu %q konvertieren" - #: py/obj.c msgid "can't convert to complex" msgstr "kann nicht nach complex konvertieren" +#: py/obj.c +msgid "can't convert to float" +msgstr "kann nicht nach float konvertieren" + #: py/runtime.c msgid "can't convert to int" msgstr "kann nicht nach int konvertieren" @@ -2755,14 +2764,6 @@ msgstr "Eine binäre Operation zwischen '%q' und '%q' ist nicht möglich" msgid "can't do truncated division of a complex number" msgstr "kann mit einer komplexen Zahl keine abgeschnittene Division ausführen" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "mehrere **x sind nicht gestattet" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "mehrere *x sind nicht gestattet" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "Kann '%q' nicht implizit nach 'bool' konvertieren" @@ -2823,6 +2824,10 @@ msgstr "" "kann nicht von der manuellen Feldspezifikation zur automatischen " "Feldnummerierung wechseln" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "Kann neue shape nicht zuweisen" @@ -2921,10 +2926,6 @@ msgstr "Komplexe Zahlen nicht unterstützt" msgid "compression header" msgstr "kompression header" -#: py/parse.c -msgid "constant must be an integer" -msgstr "constant muss ein integer sein" - #: py/emitnative.c msgid "conversion to object" msgstr "Umwandlung zu Objekt" @@ -3267,8 +3268,12 @@ msgid "import * not at module level" msgstr "import * nicht auf Modulebene" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" -msgstr "inkompatible native .mpy-Architektur" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" +msgstr "" #: py/objstr.c msgid "incomplete format" @@ -3296,6 +3301,10 @@ msgstr "Index muss tuple oder int sein" msgid "index out of range" msgstr "index außerhalb der Reichweite" +#: py/obj.c +msgid "indices must be integers" +msgstr "Indizes müssen Integer sein" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "Indizes müssen Integer, Slices oder Boolesche Listen sein" @@ -3429,10 +3438,6 @@ msgstr "ungültige Elementgröße %d, muss 1, 2 oder 4 sein" msgid "invalid exception" msgstr "ungültige Ausnahme" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "ungültiges Format" - #: py/objstr.c msgid "invalid format specifier" msgstr "ungültiger Formatbezeichner" @@ -3498,10 +3503,6 @@ msgstr "" "Schlüsselwort-Argument(e) noch nicht implementiert - verwende stattdessen " "normale Argumente" -#: py/bc.c -msgid "keywords must be strings" -msgstr "Schlüsselwörter müssen Zeichenfolgen sein" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "Label '%q' nicht definiert" @@ -3728,14 +3729,6 @@ msgstr "ein non-default argument folgt auf ein default argument" msgid "non-hex digit found" msgstr "eine nicht-hex zahl wurde gefunden" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "Nicht-Schlüsselwort arg nach * / **" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "Nicht-Schlüsselwort-Argument nach Schlüsselwort-Argument" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "Timeout ungleich Null muss > 0,01 sein" @@ -3748,6 +3741,10 @@ msgstr "Timeout ungleich Null muss >= Intervall sein" msgid "not a 128-bit UUID" msgstr "keine 128-bit UUID" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "" @@ -3992,6 +3989,14 @@ msgstr "Pop aus leerem %q" msgid "port must be >= 0" msgstr "Port muss >= 0 sein" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "pow() drittes Argument darf nicht 0 sein" @@ -4020,6 +4025,11 @@ msgstr "Real- und Imaginärteile müssen gleich lang sein" msgid "relative import" msgstr "relativer Import" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "die ersuchte Länge ist %d, aber das Objekt hat eine Länge von %d" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "Ergebnisse können nicht in den angegebenen Typ umgewandelt werden" @@ -4214,6 +4224,10 @@ msgstr "Zeitstempel außerhalb des Bereichs für Plattform time_t" msgid "tobytes can be invoked for dense arrays only" msgstr "tobytes kann nur für dichte Arrays aufgerufen werden" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "zu viele Dimensionen" @@ -4239,6 +4253,10 @@ msgstr "trapz ist für 1D-Arrays gleicher Länge definiert" msgid "trapz is defined for 1D iterables" msgstr "trapz ist für 1D-Iterables definiert" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "tupel/list hat falsche Länge" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4460,6 +4478,43 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "Corrupt .mpy file" +#~ msgstr "Beschädigte .mpy Datei" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "Inkompatible .mpy-Datei. Bitte aktualisiere alle .mpy-Dateien. Siehe " +#~ "http://adafru.it/mpy-update für weitere Informationen." + +#~ msgid "can't convert to %q" +#~ msgstr "kann nicht zu %q konvertieren" + +#~ msgid "can't have multiple **x" +#~ msgstr "mehrere **x sind nicht gestattet" + +#~ msgid "can't have multiple *x" +#~ msgstr "mehrere *x sind nicht gestattet" + +#~ msgid "constant must be an integer" +#~ msgstr "constant muss ein integer sein" + +#~ msgid "incompatible native .mpy architecture" +#~ msgstr "inkompatible native .mpy-Architektur" + +#~ msgid "invalid format" +#~ msgstr "ungültiges Format" + +#~ msgid "keywords must be strings" +#~ msgstr "Schlüsselwörter müssen Zeichenfolgen sein" + +#~ msgid "non-keyword arg after */**" +#~ msgstr "Nicht-Schlüsselwort arg nach * / **" + +#~ msgid "non-keyword arg after keyword arg" +#~ msgstr "Nicht-Schlüsselwort-Argument nach Schlüsselwort-Argument" + #, c-format #~ msgid "Instruction %d shifts in more bits than pin count" #~ msgstr "Anweisung %d verschiebt mehr Bits als die Anzahl der Pins" @@ -4805,22 +4860,12 @@ msgstr "zi muss die Form (n_section, 2) haben" #~ msgid "invalid traceback" #~ msgstr "ungültiger Traceback" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "%q Indizes müssen Integer sein, nicht %s" - #~ msgid "WatchDogTimer.timeout must be greater than 0" #~ msgstr "WatchDogTimer.timeout muss größer als 0 sein" -#~ msgid "indices must be integers" -#~ msgstr "Indizes müssen Integer sein" - #~ msgid "non-Device in %q" #~ msgstr "Nicht-Gerät in %q" -#, c-format -#~ msgid "requested length %d but object has length %d" -#~ msgstr "die ersuchte Länge ist %d, aber das Objekt hat eine Länge von %d" - #~ msgid "single '}' encountered in format string" #~ msgstr "einzelne '}' in Formatierungs-String gefunden" @@ -4830,9 +4875,6 @@ msgstr "zi muss die Form (n_section, 2) haben" #~ msgid "timeout must be 0.0-100.0 seconds" #~ msgstr "Das Zeitlimit muss 0,0-100,0 Sekunden betragen" -#~ msgid "tuple/list has wrong length" -#~ msgstr "tupel/list hat falsche Länge" - #~ msgid "unmatched '{' in format" #~ msgstr "'{' ohne passende Zuordnung im Format" @@ -5736,9 +5778,6 @@ msgstr "zi muss die Form (n_section, 2) haben" #~ msgid "__init__() should return None, not '%s'" #~ msgstr "__init__() sollte None zurückgeben, nicht '%s'" -#~ msgid "can't convert %s to float" -#~ msgstr "kann %s nicht nach float konvertieren" - #~ msgid "can't convert %s to int" #~ msgstr "kann %s nicht nach int konvertieren" @@ -5751,9 +5790,6 @@ msgstr "zi muss die Form (n_section, 2) haben" #~ msgid "can't convert inf to int" #~ msgstr "kann inf nicht nach int konvertieren" -#~ msgid "can't convert to float" -#~ msgstr "kann nicht nach float konvertieren" - #~ msgid "object '%s' is not a tuple or list" #~ msgstr "Objekt '%s' ist weder tupel noch list" diff --git a/locale/el.po b/locale/el.po index 1c4eca2c6d..9a15d4af5c 100644 --- a/locale/el.po +++ b/locale/el.po @@ -154,6 +154,10 @@ msgstr "%q είναι σε χρήση" msgid "%q index out of range" msgstr "%q δείκτης εκτός εμβέλειας" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "%q δείκτες πρέπει να είναι ακέραιοι, όχι %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "%q εκκίνηση απέτυχε" @@ -229,7 +233,7 @@ msgstr "%q πρέπει να είναι λίστα τύπου 'h'" msgid "%q must be of type %q or %q, not %q" msgstr "%q πρέπει να είναι τύπου %q ή %q, όχι %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -432,6 +436,10 @@ msgstr "'yield from' εκτός ασύνχρονης συνάρτησης" msgid "'yield' outside function" msgstr "'yield' εκτός συνάρτησης" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x πρέπει να είναι στόχος ανάθεσης" @@ -867,10 +875,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "Κατεστραμένο .mpy αρχείο" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Δεν μπόρεσε να ανακληθεί το ρολόι" @@ -1165,12 +1169,6 @@ msgstr "" msgid "In-buffer elements must be <= 4 bytes long" msgstr "" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "" @@ -1517,7 +1515,7 @@ msgstr "" msgid "No in or out in program" msgstr "" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "" @@ -2527,6 +2525,10 @@ msgstr "" msgid "array/bytes required on right side" msgstr "" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" @@ -2616,6 +2618,10 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2661,7 +2667,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2670,6 +2676,11 @@ msgstr "" msgid "can't convert %s to complex" msgstr "" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "" @@ -2679,11 +2690,11 @@ msgid "can't convert complex to float" msgstr "" #: py/obj.c -msgid "can't convert to %q" +msgid "can't convert to complex" msgstr "" #: py/obj.c -msgid "can't convert to complex" +msgid "can't convert to float" msgstr "" #: py/runtime.c @@ -2710,14 +2721,6 @@ msgstr "" msgid "can't do truncated division of a complex number" msgstr "" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "" @@ -2772,6 +2775,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "" @@ -2868,10 +2875,6 @@ msgstr "" msgid "compression header" msgstr "" -#: py/parse.c -msgid "constant must be an integer" -msgstr "" - #: py/emitnative.c msgid "conversion to object" msgstr "" @@ -3208,7 +3211,11 @@ msgid "import * not at module level" msgstr "" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" msgstr "" #: py/objstr.c @@ -3237,6 +3244,10 @@ msgstr "" msgid "index out of range" msgstr "" +#: py/obj.c +msgid "indices must be integers" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "" @@ -3370,10 +3381,6 @@ msgstr "" msgid "invalid exception" msgstr "" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "" - #: py/objstr.c msgid "invalid format specifier" msgstr "" @@ -3435,10 +3442,6 @@ msgstr "" msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "" -#: py/bc.c -msgid "keywords must be strings" -msgstr "" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "" @@ -3663,14 +3666,6 @@ msgstr "" msgid "non-hex digit found" msgstr "" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "" @@ -3683,6 +3678,10 @@ msgstr "" msgid "not a 128-bit UUID" msgstr "" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "" @@ -3921,6 +3920,14 @@ msgstr "" msgid "port must be >= 0" msgstr "" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "" @@ -3949,6 +3956,11 @@ msgstr "" msgid "relative import" msgstr "" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "" @@ -4143,6 +4155,10 @@ msgstr "" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "" @@ -4168,6 +4184,10 @@ msgstr "" msgid "trapz is defined for 1D iterables" msgstr "" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4387,6 +4407,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Corrupt .mpy file" +#~ msgstr "Κατεστραμένο .mpy αρχείο" + #~ msgid "Cannot transfer without MOSI and MISO pins" #~ msgstr "Δεν μπορεί να γίνει μεταφορά χωρίς MOSI και MISO pins" @@ -4443,9 +4466,6 @@ msgstr "" #~ msgid "At most %d %q may be specified (not %d)" #~ msgstr "Το πολύ %d %q μπορεί να είναι καθορισμένα (όχι %d)" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "%q δείκτες πρέπει να είναι ακέραιοι, όχι %s" - #~ msgid "%q must be >= 0" #~ msgstr "%q πρέπει να είναι >= 0" diff --git a/locale/en_GB.po b/locale/en_GB.po index 90bea5884c..6801196cb8 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -152,6 +152,10 @@ msgstr "%q in use" msgid "%q index out of range" msgstr "%q index out of range" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "%q indices must be integers, not %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "%q init failed" @@ -227,7 +231,7 @@ msgstr "%q must be array of type 'h'" msgid "%q must be of type %q or %q, not %q" msgstr "%q must be of type %q or %q, not %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q must be of type %q, not %q" @@ -430,6 +434,10 @@ msgstr "'yield from' inside async function" msgid "'yield' outside function" msgstr "'yield' outside function" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x must be assignment target" @@ -857,10 +865,6 @@ msgstr "Coordinate arrays have different lengths" msgid "Coordinate arrays types have different sizes" msgstr "Coordinate arrays types have different sizes" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "Corrupt .mpy file" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Could not retrieve clock" @@ -1157,14 +1161,6 @@ msgstr "I2C peripheral in use" msgid "In-buffer elements must be <= 4 bytes long" msgstr "In-buffer elements must be <= 4 bytes long" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"Incompatible .mpy file. Please update all .mpy files. See https://adafru.it/" -"mpy-update for more info." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "Incorrect buffer size" @@ -1511,7 +1507,7 @@ msgstr "No in in program" msgid "No in or out in program" msgstr "No in or out in program" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "No long integer support" @@ -2536,6 +2532,10 @@ msgstr "array is too big" msgid "array/bytes required on right side" msgstr "array/bytes required on right side" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "attempt to get (arg)min/(arg)max of empty sequence" @@ -2625,6 +2625,10 @@ msgstr "Buffer too small" msgid "buffer too small for requested bytes" msgstr "Buffer too small for requested bytes" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "Bytes length not a multiple of item size" @@ -2670,7 +2674,7 @@ msgstr "Can't assign to expression" msgid "can't cancel self" msgstr "can't cancel self" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "Can't convert %q to %q" @@ -2679,6 +2683,11 @@ msgstr "Can't convert %q to %q" msgid "can't convert %s to complex" msgstr "can't convert %s to complex" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "Can't convert '%q' object to %q implicitly" @@ -2687,14 +2696,14 @@ msgstr "Can't convert '%q' object to %q implicitly" msgid "can't convert complex to float" msgstr "can't convert complex to float" -#: py/obj.c -msgid "can't convert to %q" -msgstr "Can't convert to %q" - #: py/obj.c msgid "can't convert to complex" msgstr "can't convert to complex" +#: py/obj.c +msgid "can't convert to float" +msgstr "" + #: py/runtime.c msgid "can't convert to int" msgstr "can't convert to int" @@ -2719,14 +2728,6 @@ msgstr "Can't do binary op between '%q' and '%q'" msgid "can't do truncated division of a complex number" msgstr "Can't do truncated division of a complex number" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "can't have multiple **x" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "can't have multiple *x" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "can't implicitly convert '%q' to 'bool'" @@ -2783,6 +2784,10 @@ msgid "" msgstr "" "can't switch from manual field specification to automatic field numbering" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "cannot assign new shape" @@ -2879,10 +2884,6 @@ msgstr "complex values not supported" msgid "compression header" msgstr "compression header" -#: py/parse.c -msgid "constant must be an integer" -msgstr "constant must be an integer" - #: py/emitnative.c msgid "conversion to object" msgstr "conversion to object" @@ -3222,8 +3223,12 @@ msgid "import * not at module level" msgstr "import * not at module level" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" -msgstr "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" +msgstr "" #: py/objstr.c msgid "incomplete format" @@ -3251,6 +3256,10 @@ msgstr "index must be tuple or int" msgid "index out of range" msgstr "index out of range" +#: py/obj.c +msgid "indices must be integers" +msgstr "indices must be integers" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "indices must be integers, slices, or Boolean lists" @@ -3384,10 +3393,6 @@ msgstr "invalid element_size %d, must be, 1, 2, or 4" msgid "invalid exception" msgstr "invalid exception" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "invalid format" - #: py/objstr.c msgid "invalid format specifier" msgstr "invalid format specifier" @@ -3449,10 +3454,6 @@ msgstr "join expects a list of str/bytes objects consistent with self object" msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "keyword argument(s) not yet implemented - use normal args instead" -#: py/bc.c -msgid "keywords must be strings" -msgstr "keywords must be strings" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "label '%q' not defined" @@ -3677,14 +3678,6 @@ msgstr "non-default argument follows default argument" msgid "non-hex digit found" msgstr "non-hex digit found" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "non-keyword arg after */**" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "non-keyword arg after keyword arg" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "non-zero timeout must be > 0.01" @@ -3697,6 +3690,10 @@ msgstr "non-zero timeout must be >= interval" msgid "not a 128-bit UUID" msgstr "not a 128-bit UUID" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "not all arguments converted during string formatting" @@ -3935,6 +3932,14 @@ msgstr "pop from empty %q" msgid "port must be >= 0" msgstr "port must be >= 0" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "pow() 3rd argument cannot be 0" @@ -3963,6 +3968,11 @@ msgstr "real and imaginary parts must be of equal length" msgid "relative import" msgstr "relative import" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "requested length %d but object has length %d" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "results cannot be cast to specified type" @@ -4157,6 +4167,10 @@ msgstr "timestamp out of range for platform time_t" msgid "tobytes can be invoked for dense arrays only" msgstr "tobytes can be invoked for dense arrays only" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "too many dimensions" @@ -4182,6 +4196,10 @@ msgstr "trapz is defined for 1D arrays of equal length" msgid "trapz is defined for 1D iterables" msgstr "trapz is defined for 1D iterables" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "tuple/list has wrong length" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4401,6 +4419,43 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "Corrupt .mpy file" +#~ msgstr "Corrupt .mpy file" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "Incompatible .mpy file. Please update all .mpy files. See https://adafru." +#~ "it/mpy-update for more info." + +#~ msgid "can't convert to %q" +#~ msgstr "Can't convert to %q" + +#~ msgid "can't have multiple **x" +#~ msgstr "can't have multiple **x" + +#~ msgid "can't have multiple *x" +#~ msgstr "can't have multiple *x" + +#~ msgid "constant must be an integer" +#~ msgstr "constant must be an integer" + +#~ msgid "incompatible native .mpy architecture" +#~ msgstr "incompatible native .mpy architecture" + +#~ msgid "invalid format" +#~ msgstr "invalid format" + +#~ msgid "keywords must be strings" +#~ msgstr "keywords must be strings" + +#~ msgid "non-keyword arg after */**" +#~ msgstr "non-keyword arg after */**" + +#~ msgid "non-keyword arg after keyword arg" +#~ msgstr "non-keyword arg after keyword arg" + #, c-format #~ msgid "Instruction %d shifts in more bits than pin count" #~ msgstr "Instruction %d shifts in more bits than pin count" @@ -4669,22 +4724,12 @@ msgstr "zi must be of shape (n_section, 2)" #~ msgid "invalid traceback" #~ msgstr "invalid traceback" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "%q indices must be integers, not %s" - #~ msgid "WatchDogTimer.timeout must be greater than 0" #~ msgstr "WatchDogTimer.timeout must be greater than 0" -#~ msgid "indices must be integers" -#~ msgstr "indices must be integers" - #~ msgid "non-Device in %q" #~ msgstr "non-Device in %q" -#, c-format -#~ msgid "requested length %d but object has length %d" -#~ msgstr "requested length %d but object has length %d" - #~ msgid "single '}' encountered in format string" #~ msgstr "single '}' encountered in format string" @@ -4694,9 +4739,6 @@ msgstr "zi must be of shape (n_section, 2)" #~ msgid "timeout must be 0.0-100.0 seconds" #~ msgstr "timeout must be 0.0-100.0 seconds" -#~ msgid "tuple/list has wrong length" -#~ msgstr "tuple/list has wrong length" - #~ msgid "unmatched '{' in format" #~ msgstr "unmatched '{' in format" diff --git a/locale/es.po b/locale/es.po index f7211f8926..650c063651 100644 --- a/locale/es.po +++ b/locale/es.po @@ -154,6 +154,10 @@ msgstr "%q está siendo utilizado" msgid "%q index out of range" msgstr "%q índice fuera de rango" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "%q indices deben ser enteros, no %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "%q inicializado fallido" @@ -229,7 +233,7 @@ msgstr "%q debe ser una matriz de tipo 'h'" msgid "%q must be of type %q or %q, not %q" msgstr "%q debe ser del tipo %q o %q, y no %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q debe ser del tipo %q, y no %q" @@ -432,6 +436,10 @@ msgstr "'yield from' dentro de una función asincrónica" msgid "'yield' outside function" msgstr "'yield' fuera de una función" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x debe ser objetivo de la tarea" @@ -868,10 +876,6 @@ msgstr "Las matrices de coordenadas tienen diferentes longitudes" msgid "Coordinate arrays types have different sizes" msgstr "Las matrices de coordenadas tienen diferentes tamaños" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "Archivo .mpy corrupto" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "No puedo traer el reloj" @@ -1175,14 +1179,6 @@ msgid "In-buffer elements must be <= 4 bytes long" msgstr "" "Los elementos del búfer de entrada deben ser de una longitud <= 4 bytes" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"Archivo .mpy incompatible. Actualice todos los archivos .mpy. Consulte " -"http://adafru.it/mpy-update para más información." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "Tamaño incorrecto del buffer" @@ -1535,7 +1531,7 @@ msgstr "No hay \"in\" en el programa" msgid "No in or out in program" msgstr "No hay \"in\" o \"out\" en el programa" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "No hay soporte de entero largo" @@ -2576,6 +2572,10 @@ msgstr "el arreglo es muy grande" msgid "array/bytes required on right side" msgstr "array/bytes requeridos en el lado derecho" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "Intendo de obteber (arg)min/(arg)max de secuencia vacía" @@ -2665,6 +2665,10 @@ msgstr "buffer demasiado pequeño" msgid "buffer too small for requested bytes" msgstr "búfer muy pequeño para los bytes solicitados" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "el tamaño en bytes no es un múltiplo del tamaño del item" @@ -2710,7 +2714,7 @@ msgstr "no se puede asignar a la expresión" msgid "can't cancel self" msgstr "no se puede cancelar a si mismo" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "no puede convertir %q a %q" @@ -2719,6 +2723,11 @@ msgstr "no puede convertir %q a %q" msgid "can't convert %s to complex" msgstr "no se puede convertir %s a complejo" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "no se puede convertir %s a float" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "no se puede convertir el objeto '%q' a %q implícitamente" @@ -2727,14 +2736,14 @@ msgstr "no se puede convertir el objeto '%q' a %q implícitamente" msgid "can't convert complex to float" msgstr "no se puede convertir complejo a float" -#: py/obj.c -msgid "can't convert to %q" -msgstr "no puede convertir a %q" - #: py/obj.c msgid "can't convert to complex" msgstr "no se puede convertir a complejo" +#: py/obj.c +msgid "can't convert to float" +msgstr "no se puede convertir a float" + #: py/runtime.c msgid "can't convert to int" msgstr "no se puede convertir a int" @@ -2759,14 +2768,6 @@ msgstr "no se puede hacer una operacion binaria entre '%q' y '%q'" msgid "can't do truncated division of a complex number" msgstr "no se puede hacer la división truncada de un número complejo" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "no puede tener multiples *x" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "no puede tener multiples *x" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "no se puede convertir implícitamente '%q' a 'bool'" @@ -2826,6 +2827,10 @@ msgstr "" "no se puede cambiar de especificación de campo manual a numeración " "automática de campos" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "no se puede asignar una nueva forma" @@ -2922,10 +2927,6 @@ msgstr "valores complejos no soportados" msgid "compression header" msgstr "encabezado de compresión" -#: py/parse.c -msgid "constant must be an integer" -msgstr "constant debe ser un entero" - #: py/emitnative.c msgid "conversion to object" msgstr "conversión a objeto" @@ -3266,8 +3267,12 @@ msgid "import * not at module level" msgstr "import * no a nivel de módulo" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" -msgstr "arquitectura nativa de .mpy incompatible" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" +msgstr "archivo .mpy incompatible" #: py/objstr.c msgid "incomplete format" @@ -3295,6 +3300,10 @@ msgstr "el indice debe ser tuple o int" msgid "index out of range" msgstr "index fuera de rango" +#: py/obj.c +msgid "indices must be integers" +msgstr "indices deben ser enteros" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "los índices deben ser enteros, particiones o listas de booleanos" @@ -3428,10 +3437,6 @@ msgstr "el element_size %d,no es valido, debe ser 1,2 ó 4" msgid "invalid exception" msgstr "excepcion invalida" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "formato inválido" - #: py/objstr.c msgid "invalid format specifier" msgstr "especificador de formato inválido" @@ -3496,10 +3501,6 @@ msgstr "" "argumento(s) por palabra clave aún no implementados - usa argumentos " "normales en su lugar" -#: py/bc.c -msgid "keywords must be strings" -msgstr "palabras clave deben ser strings" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "etiqueta '%q' no definida" @@ -3725,16 +3726,6 @@ msgstr "argumento no predeterminado sigue argumento predeterminado" msgid "non-hex digit found" msgstr "digito non-hex encontrado" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "no deberia estar/tener agumento por palabra clave despues de */**" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "" -"no deberia estar/tener agumento por palabra clave despues de argumento por " -"palabra clave" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "el tiempo de espera non-zero deber ser > 0.01" @@ -3747,6 +3738,10 @@ msgstr "el tiempo de espera non-zero debe ser >= intervalo" msgid "not a 128-bit UUID" msgstr "no es 128-bit UUID" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "" @@ -3986,6 +3981,14 @@ msgstr "pop desde %q vacía" msgid "port must be >= 0" msgstr "port debe ser be >= 0" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "el 3er argumento de pow() no puede ser 0" @@ -4014,6 +4017,11 @@ msgstr "las partes reales e imaginarias deben ser de igual longitud" msgid "relative import" msgstr "import relativo" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "longitud solicitada %d pero el objeto tiene longitud %d" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "resultados no pueden aplicar cast a un tipo específico" @@ -4209,6 +4217,10 @@ msgstr "timestamp fuera de rango para plataform time_t" msgid "tobytes can be invoked for dense arrays only" msgstr "tobytes solo pueden ser invocados por arrays densos" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "demasiadas dimensiones" @@ -4234,6 +4246,10 @@ msgstr "trapz está definido para arreglos 1D de igual tamaño" msgid "trapz is defined for 1D iterables" msgstr "trapz está definido para iterables 1D" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "tupla/lista tiene una longitud incorrecta" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4453,6 +4469,45 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Corrupt .mpy file" +#~ msgstr "Archivo .mpy corrupto" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "Archivo .mpy incompatible. Actualice todos los archivos .mpy. Consulte " +#~ "http://adafru.it/mpy-update para más información." + +#~ msgid "can't convert to %q" +#~ msgstr "no puede convertir a %q" + +#~ msgid "can't have multiple **x" +#~ msgstr "no puede tener multiples *x" + +#~ msgid "can't have multiple *x" +#~ msgstr "no puede tener multiples *x" + +#~ msgid "constant must be an integer" +#~ msgstr "constant debe ser un entero" + +#~ msgid "incompatible native .mpy architecture" +#~ msgstr "arquitectura nativa de .mpy incompatible" + +#~ msgid "invalid format" +#~ msgstr "formato inválido" + +#~ msgid "keywords must be strings" +#~ msgstr "palabras clave deben ser strings" + +#~ msgid "non-keyword arg after */**" +#~ msgstr "no deberia estar/tener agumento por palabra clave despues de */**" + +#~ msgid "non-keyword arg after keyword arg" +#~ msgstr "" +#~ "no deberia estar/tener agumento por palabra clave despues de argumento " +#~ "por palabra clave" + #, c-format #~ msgid "Instruction %d shifts in more bits than pin count" #~ msgstr "La instruccion %d mueve mas bits que la cuenta del pin" @@ -4783,22 +4838,12 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgid "zero step" #~ msgstr "paso cero" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "%q indices deben ser enteros, no %s" - #~ msgid "WatchDogTimer.timeout must be greater than 0" #~ msgstr "WatchDogTimer.timeout debe ser mayor a 0" -#~ msgid "indices must be integers" -#~ msgstr "indices deben ser enteros" - #~ msgid "non-Device in %q" #~ msgstr "hay un no-Device en %q" -#, c-format -#~ msgid "requested length %d but object has length %d" -#~ msgstr "longitud solicitada %d pero el objeto tiene longitud %d" - #~ msgid "single '}' encountered in format string" #~ msgstr "un solo '}' encontrado en format string" @@ -4808,9 +4853,6 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgid "timeout must be 0.0-100.0 seconds" #~ msgstr "el tiempo de espera debe ser 0.0-100.0 segundos" -#~ msgid "tuple/list has wrong length" -#~ msgstr "tupla/lista tiene una longitud incorrecta" - #~ msgid "unmatched '{' in format" #~ msgstr "No coinciden '{' en format" @@ -5479,9 +5521,6 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgid "Length must be non-negative" #~ msgstr "Length no deberia ser negativa" -#~ msgid "incompatible .mpy file" -#~ msgstr "archivo .mpy incompatible" - #~ msgid "invalid decorator" #~ msgstr "decorador invalido" @@ -5803,9 +5842,6 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgid "__init__() should return None, not '%s'" #~ msgstr "__init__() deberia devolver None, no '%s'" -#~ msgid "can't convert %s to float" -#~ msgstr "no se puede convertir %s a float" - #~ msgid "can't convert %s to int" #~ msgstr "no se puede convertir %s a int" @@ -5818,9 +5854,6 @@ msgstr "zi debe ser una forma (n_section,2)" #~ msgid "can't convert inf to int" #~ msgstr "no se puede convertir inf en int" -#~ msgid "can't convert to float" -#~ msgstr "no se puede convertir a float" - #~ msgid "object '%s' is not a tuple or list" #~ msgstr "el objeto '%s' no es una tupla o lista" diff --git a/locale/fil.po b/locale/fil.po index 51dc2ab776..f38a83830d 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -140,6 +140,10 @@ msgstr "%q ay ginagamit" msgid "%q index out of range" msgstr "%q indeks wala sa sakop" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "%q indeks ay dapat integers, hindi %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "" @@ -215,7 +219,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -419,6 +423,10 @@ msgstr "" msgid "'yield' outside function" msgstr "'yield' sa labas ng function" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x ay dapat na assignment target" @@ -847,10 +855,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -1148,14 +1152,6 @@ msgstr "" msgid "In-buffer elements must be <= 4 bytes long" msgstr "" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -".mpy file hindi compatible. Maaring i-update lahat ng .mpy files. See http://" -"adafru.it/mpy-update for more info." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "" @@ -1502,7 +1498,7 @@ msgstr "" msgid "No in or out in program" msgstr "" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "" @@ -2516,6 +2512,10 @@ msgstr "" msgid "array/bytes required on right side" msgstr "array/bytes kinakailangan sa kanang bahagi" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" @@ -2606,6 +2606,10 @@ msgstr "masyadong maliit ang buffer" msgid "buffer too small for requested bytes" msgstr "" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2652,7 +2656,7 @@ msgstr "hindi ma i-assign sa expression" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2661,6 +2665,11 @@ msgstr "" msgid "can't convert %s to complex" msgstr "hindi ma-convert %s sa complex" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "hindi ma-convert %s sa int" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "hindi maaaring i-convert ang '%q' na bagay sa %q nang walang pahiwatig" @@ -2669,14 +2678,14 @@ msgstr "hindi maaaring i-convert ang '%q' na bagay sa %q nang walang pahiwatig" msgid "can't convert complex to float" msgstr "" -#: py/obj.c -msgid "can't convert to %q" -msgstr "" - #: py/obj.c msgid "can't convert to complex" msgstr "hindi ma-convert sa complex" +#: py/obj.c +msgid "can't convert to float" +msgstr "hindi ma-convert sa float" + #: py/runtime.c msgid "can't convert to int" msgstr "hindi ma-convert sa int" @@ -2702,14 +2711,6 @@ msgid "can't do truncated division of a complex number" msgstr "" "hindi maaaring gawin ang truncated division ng isang kumplikadong numero" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "hindi puede ang maraming **x" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "hindi puede ang maraming *x" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "hindi maaaring ma-convert ang ' %q' sa 'bool'" @@ -2768,6 +2769,10 @@ msgstr "" "hindi mapalitan ang manual field specification sa awtomatikong field " "numbering" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "" @@ -2864,10 +2869,6 @@ msgstr "kumplikadong values hindi sinusuportahan" msgid "compression header" msgstr "compression header" -#: py/parse.c -msgid "constant must be an integer" -msgstr "constant ay dapat na integer" - #: py/emitnative.c msgid "conversion to object" msgstr "kombersyon to object" @@ -3209,7 +3210,11 @@ msgid "import * not at module level" msgstr "" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" msgstr "" #: py/objstr.c @@ -3238,6 +3243,10 @@ msgstr "" msgid "index out of range" msgstr "index wala sa sakop" +#: py/obj.c +msgid "indices must be integers" +msgstr "ang mga indeks ay dapat na integer" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "" @@ -3371,10 +3380,6 @@ msgstr "" msgid "invalid exception" msgstr "" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "hindi wastong pag-format" - #: py/objstr.c msgid "invalid format specifier" msgstr "mali ang format specifier" @@ -3440,10 +3445,6 @@ msgstr "" "kindi pa ipinapatupad ang (mga) argument(s) ng keyword - gumamit ng normal " "args" -#: py/bc.c -msgid "keywords must be strings" -msgstr "ang keywords dapat strings" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "label '%d' kailangan na i-define" @@ -3668,14 +3669,6 @@ msgstr "non-default argument sumusunod sa default argument" msgid "non-hex digit found" msgstr "non-hex digit nahanap" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "non-keyword arg sa huli ng */**" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "non-keyword arg sa huli ng keyword arg" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "" @@ -3688,6 +3681,10 @@ msgstr "" msgid "not a 128-bit UUID" msgstr "" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "hindi lahat ng arguments na i-convert habang string formatting" @@ -3928,6 +3925,14 @@ msgstr "" msgid "port must be >= 0" msgstr "" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "pow() 3rd argument ay hindi maaring 0" @@ -3956,6 +3961,11 @@ msgstr "" msgid "relative import" msgstr "relative import" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "hiniling ang haba %d ngunit may haba ang object na %d" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "" @@ -4150,6 +4160,10 @@ msgstr "wala sa sakop ng timestamp ang platform time_t" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "" @@ -4175,6 +4189,10 @@ msgstr "" msgid "trapz is defined for 1D iterables" msgstr "" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "mali ang haba ng tuple/list" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4394,6 +4412,34 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ ".mpy file hindi compatible. Maaring i-update lahat ng .mpy files. See " +#~ "http://adafru.it/mpy-update for more info." + +#~ msgid "can't have multiple **x" +#~ msgstr "hindi puede ang maraming **x" + +#~ msgid "can't have multiple *x" +#~ msgstr "hindi puede ang maraming *x" + +#~ msgid "constant must be an integer" +#~ msgstr "constant ay dapat na integer" + +#~ msgid "invalid format" +#~ msgstr "hindi wastong pag-format" + +#~ msgid "keywords must be strings" +#~ msgstr "ang keywords dapat strings" + +#~ msgid "non-keyword arg after */**" +#~ msgstr "non-keyword arg sa huli ng */**" + +#~ msgid "non-keyword arg after keyword arg" +#~ msgstr "non-keyword arg sa huli ng keyword arg" + #~ msgid "No RX pin" #~ msgstr "Walang RX pin" @@ -4442,25 +4488,12 @@ msgstr "" #~ msgid "zero step" #~ msgstr "zero step" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "%q indeks ay dapat integers, hindi %s" - -#~ msgid "indices must be integers" -#~ msgstr "ang mga indeks ay dapat na integer" - -#, c-format -#~ msgid "requested length %d but object has length %d" -#~ msgstr "hiniling ang haba %d ngunit may haba ang object na %d" - #~ msgid "single '}' encountered in format string" #~ msgstr "isang '}' nasalubong sa format string" #~ msgid "threshold must be in the range 0-65536" #~ msgstr "ang threshold ay dapat sa range 0-65536" -#~ msgid "tuple/list has wrong length" -#~ msgstr "mali ang haba ng tuple/list" - #~ msgid "unmatched '{' in format" #~ msgstr "hindi tugma ang '{' sa format" @@ -4821,9 +4854,6 @@ msgstr "" #~ msgid "__init__() should return None, not '%s'" #~ msgstr "__init__() dapat magbalink na None, hindi '%s'" -#~ msgid "can't convert %s to float" -#~ msgstr "hindi ma-convert %s sa int" - #~ msgid "can't convert %s to int" #~ msgstr "hindi ma-convert %s sa int" @@ -4836,9 +4866,6 @@ msgstr "" #~ msgid "can't convert inf to int" #~ msgstr "hindi ma i-convert inf sa int" -#~ msgid "can't convert to float" -#~ msgstr "hindi ma-convert sa float" - #~ msgid "object '%s' is not a tuple or list" #~ msgstr "object '%s' ay hindi tuple o list" diff --git a/locale/fr.po b/locale/fr.po index 30e75859e9..297cc5b800 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -154,6 +154,10 @@ msgstr "%q en cours d'utilisation" msgid "%q index out of range" msgstr "index %q hors de portée" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "les indices %q doivent être des entiers, pas %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "échec de l'initialisation %q" @@ -229,7 +233,7 @@ msgstr "%q doit être array de type 'h'" msgid "%q must be of type %q or %q, not %q" msgstr "%q doit être de type %q ou %q, pas %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q doit être de type %q, pas %q" @@ -268,11 +272,13 @@ msgstr "%q=%q" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts in more bits than pin count" -msgstr "%q[%u] décale vers l'intérieur de plus de bits que le nombre de broches" +msgstr "" +"%q[%u] décale vers l'intérieur de plus de bits que le nombre de broches" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts out more bits than pin count" -msgstr "%q[%u] décale vers l'extérieur de plus de bits que le nombre de broches" +msgstr "" +"%q[%u] décale vers l'extérieur de plus de bits que le nombre de broches" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] uses extra pin" @@ -432,6 +438,10 @@ msgstr "'yield from' dans une fonction async" msgid "'yield' outside function" msgstr "'yield' dehors d'une fonction" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x doit être la cible de l'assignement" @@ -873,10 +883,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "Fichier .mpy corrompu" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Impossible d'obtenir l'horloge" @@ -1181,14 +1187,6 @@ msgstr "Périphérique I2C utilisé" msgid "In-buffer elements must be <= 4 bytes long" msgstr "Éléments dans le tampon doivent être <= à 4 octets" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"Fichier .mpy incompatible. Merci de mettre à jour tous les fichiers .mpy. " -"Voir http://adafru.it/mpy-update pour plus d'informations." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "Taille de tampon incorrecte" @@ -1543,7 +1541,7 @@ msgstr "Programme n'a pas de \"in\"" msgid "No in or out in program" msgstr "Programme n'a aucun \"in\" ni \"out\"" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "Pas de support pour chiffre entier long" @@ -2585,6 +2583,10 @@ msgstr "matrice trop grande" msgid "array/bytes required on right side" msgstr "matrice/octets requis à la droite" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "tentative d'obtenir (arg)min/(arg)max d'une séquence vide" @@ -2674,6 +2676,10 @@ msgstr "tampon trop petit" msgid "buffer too small for requested bytes" msgstr "tampon trop petit pour le nombre d'octets demandé" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "bytes length n'est pas un multiple de la taille d'un élément" @@ -2720,7 +2726,7 @@ msgstr "ne peut pas assigner à une expression" msgid "can't cancel self" msgstr "ne peut pas s'annuler soi-même" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "impossible de convertir %q en %q" @@ -2729,6 +2735,11 @@ msgstr "impossible de convertir %q en %q" msgid "can't convert %s to complex" msgstr "ne peut convertir %s en nombre complexe" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "ne peut convertir %s en nombre à virgule flottante 'float'" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "impossible de convertir l'objet '%q' en '%q' implicitement" @@ -2737,14 +2748,14 @@ msgstr "impossible de convertir l'objet '%q' en '%q' implicitement" msgid "can't convert complex to float" msgstr "ne peut convertir un complexe en flottant" -#: py/obj.c -msgid "can't convert to %q" -msgstr "impossible de convertir en %q" - #: py/obj.c msgid "can't convert to complex" msgstr "ne peut convertir en nombre complexe" +#: py/obj.c +msgid "can't convert to float" +msgstr "ne peut convertir en nombre à virgule flottante 'float'" + #: py/runtime.c msgid "can't convert to int" msgstr "ne peut convertir en entier 'int'" @@ -2769,14 +2780,6 @@ msgstr "opération binaire impossible entre '%q' et '%q'" msgid "can't do truncated division of a complex number" msgstr "on ne peut pas faire de division tronquée de nombres complexes" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "il ne peut y avoir de **x multiples" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "il ne peut y avoir de *x multiples" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "impossible de convertir implicitement '%q' en 'bool'" @@ -2837,6 +2840,10 @@ msgstr "" "impossible de passer d'une spécification manuelle des champs à une " "énumération auto" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "ne peut assigner une nouvelle forme" @@ -2936,10 +2943,6 @@ msgstr "valeurs complexes non supportées" msgid "compression header" msgstr "entête de compression" -#: py/parse.c -msgid "constant must be an integer" -msgstr "constante doit être un entier" - #: py/emitnative.c msgid "conversion to object" msgstr "conversion en objet" @@ -3281,8 +3284,12 @@ msgid "import * not at module level" msgstr "import * n'est pas au niveau du module" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" -msgstr "architecture native .mpy incompatible" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" +msgstr "Fichier .mpy incompatible" #: py/objstr.c msgid "incomplete format" @@ -3310,6 +3317,10 @@ msgstr "l'index doit être un tuple ou entier" msgid "index out of range" msgstr "index est hors bornes" +#: py/obj.c +msgid "indices must be integers" +msgstr "les indices doivent être des entiers" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "" @@ -3445,10 +3456,6 @@ msgstr "element_size %d est invalide, doit être 1, 2 ou 4" msgid "invalid exception" msgstr "exception invalide" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "format invalide" - #: py/objstr.c msgid "invalid format specifier" msgstr "spécification de format invalide" @@ -3515,10 +3522,6 @@ msgstr "" "argument(s) nommé(s) pas encore implémenté(s) - utilisez les arguments " "normaux" -#: py/bc.c -msgid "keywords must be strings" -msgstr "les noms doivent être des chaînes de caractères" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "label '%q' non supporté" @@ -3744,14 +3747,6 @@ msgstr "" msgid "non-hex digit found" msgstr "chiffre non-héxadécimale trouvé" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "argument non-nommé après */**" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "argument non-nommé après argument nommé" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "le délai non-zéro doit être > 0.01" @@ -3764,6 +3759,10 @@ msgstr "le délai non-zéro doit être >= interval" msgid "not a 128-bit UUID" msgstr "n'est pas un UUID 128 bits" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "" @@ -4006,6 +4005,14 @@ msgstr "pop sur %q vide" msgid "port must be >= 0" msgstr "port doit être >= 0" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "le 3e argument de pow() ne peut être 0" @@ -4034,6 +4041,11 @@ msgstr "les parties réelles et imaginaires doivent être de longueur égale" msgid "relative import" msgstr "import relatif" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "la longueur requise est %d mais l'objet est long de %d" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "résultats ne peuvent être transformé au type spécifié" @@ -4229,6 +4241,10 @@ msgstr "timestamp hors bornes pour 'time_t' de la plateforme" msgid "tobytes can be invoked for dense arrays only" msgstr "tobytes ne peut être appelée que pour des matrices dense" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "Trop de dimensions" @@ -4254,6 +4270,10 @@ msgstr "trapz n'est défini que pour des matrices 1D de longueur égales" msgid "trapz is defined for 1D iterables" msgstr "trapz est défini pour les 1D itérables" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "tuple/liste a une mauvaise longueur" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4473,6 +4493,43 @@ 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 "Corrupt .mpy file" +#~ msgstr "Fichier .mpy corrompu" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "Fichier .mpy incompatible. Merci de mettre à jour tous les fichiers .mpy. " +#~ "Voir http://adafru.it/mpy-update pour plus d'informations." + +#~ msgid "can't convert to %q" +#~ msgstr "impossible de convertir en %q" + +#~ msgid "can't have multiple **x" +#~ msgstr "il ne peut y avoir de **x multiples" + +#~ msgid "can't have multiple *x" +#~ msgstr "il ne peut y avoir de *x multiples" + +#~ msgid "constant must be an integer" +#~ msgstr "constante doit être un entier" + +#~ msgid "incompatible native .mpy architecture" +#~ msgstr "architecture native .mpy incompatible" + +#~ msgid "invalid format" +#~ msgstr "format invalide" + +#~ msgid "keywords must be strings" +#~ msgstr "les noms doivent être des chaînes de caractères" + +#~ msgid "non-keyword arg after */**" +#~ msgstr "argument non-nommé après */**" + +#~ msgid "non-keyword arg after keyword arg" +#~ msgstr "argument non-nommé après argument nommé" + #, c-format #~ msgid "Instruction %d shifts in more bits than pin count" #~ msgstr "" @@ -4825,22 +4882,12 @@ msgstr "zi doit être de forme (n_section, 2)" #~ msgid "invalid traceback" #~ msgstr "traceback invalide" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "les indices %q doivent être des entiers, pas %s" - #~ msgid "WatchDogTimer.timeout must be greater than 0" #~ msgstr "WatchDogTimer.timeout doit être supérieur à 0" -#~ msgid "indices must be integers" -#~ msgstr "les indices doivent être des entiers" - #~ msgid "non-Device in %q" #~ msgstr "aucun appareil dans %q" -#, c-format -#~ msgid "requested length %d but object has length %d" -#~ msgstr "la longueur requise est %d mais l'objet est long de %d" - #~ msgid "single '}' encountered in format string" #~ msgstr "'}' seule rencontrée dans une chaîne de format" @@ -4850,9 +4897,6 @@ msgstr "zi doit être de forme (n_section, 2)" #~ msgid "timeout must be 0.0-100.0 seconds" #~ msgstr "le délai doit être compris entre 0.0 et 100.0 secondes" -#~ msgid "tuple/list has wrong length" -#~ msgstr "tuple/liste a une mauvaise longueur" - #~ msgid "unmatched '{' in format" #~ msgstr "'{' sans correspondance dans le format" @@ -5539,9 +5583,6 @@ msgstr "zi doit être de forme (n_section, 2)" #~ msgid "Length must be non-negative" #~ msgstr "Length ne doit pas être négatif" -#~ msgid "incompatible .mpy file" -#~ msgstr "Fichier .mpy incompatible" - #~ msgid "invalid decorator" #~ msgstr "décorateur invalide" @@ -5869,9 +5910,6 @@ msgstr "zi doit être de forme (n_section, 2)" #~ msgid "__init__() should return None, not '%s'" #~ msgstr "__init__() doit retourner None, pas '%s'" -#~ msgid "can't convert %s to float" -#~ msgstr "ne peut convertir %s en nombre à virgule flottante 'float'" - #~ msgid "can't convert %s to int" #~ msgstr "ne peut convertir %s en entier 'int'" @@ -5884,9 +5922,6 @@ msgstr "zi doit être de forme (n_section, 2)" #~ msgid "can't convert inf to int" #~ msgstr "on ne peut convertir l'infini 'inf' en entier 'int'" -#~ msgid "can't convert to float" -#~ msgstr "ne peut convertir en nombre à virgule flottante 'float'" - #~ msgid "object '%s' is not a tuple or list" #~ msgstr "l'objet '%s' n'est pas un tuple ou une liste" diff --git a/locale/hi.po b/locale/hi.po index ee8317745f..d0c8e3e366 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -139,6 +139,10 @@ msgstr "" msgid "%q index out of range" msgstr "" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "" @@ -214,7 +218,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -417,6 +421,10 @@ msgstr "" msgid "'yield' outside function" msgstr "" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "" @@ -840,10 +848,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -1138,12 +1142,6 @@ msgstr "" msgid "In-buffer elements must be <= 4 bytes long" msgstr "" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "" @@ -1490,7 +1488,7 @@ msgstr "" msgid "No in or out in program" msgstr "" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "" @@ -2498,6 +2496,10 @@ msgstr "" msgid "array/bytes required on right side" msgstr "" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" @@ -2587,6 +2589,10 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2632,7 +2638,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2641,6 +2647,11 @@ msgstr "" msgid "can't convert %s to complex" msgstr "" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "" @@ -2650,11 +2661,11 @@ msgid "can't convert complex to float" msgstr "" #: py/obj.c -msgid "can't convert to %q" +msgid "can't convert to complex" msgstr "" #: py/obj.c -msgid "can't convert to complex" +msgid "can't convert to float" msgstr "" #: py/runtime.c @@ -2681,14 +2692,6 @@ msgstr "" msgid "can't do truncated division of a complex number" msgstr "" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "" @@ -2743,6 +2746,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "" @@ -2839,10 +2846,6 @@ msgstr "" msgid "compression header" msgstr "" -#: py/parse.c -msgid "constant must be an integer" -msgstr "" - #: py/emitnative.c msgid "conversion to object" msgstr "" @@ -3179,7 +3182,11 @@ msgid "import * not at module level" msgstr "" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" msgstr "" #: py/objstr.c @@ -3208,6 +3215,10 @@ msgstr "" msgid "index out of range" msgstr "" +#: py/obj.c +msgid "indices must be integers" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "" @@ -3341,10 +3352,6 @@ msgstr "" msgid "invalid exception" msgstr "" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "" - #: py/objstr.c msgid "invalid format specifier" msgstr "" @@ -3406,10 +3413,6 @@ msgstr "" msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "" -#: py/bc.c -msgid "keywords must be strings" -msgstr "" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "" @@ -3634,14 +3637,6 @@ msgstr "" msgid "non-hex digit found" msgstr "" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "" @@ -3654,6 +3649,10 @@ msgstr "" msgid "not a 128-bit UUID" msgstr "" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "" @@ -3892,6 +3891,14 @@ msgstr "" msgid "port must be >= 0" msgstr "" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "" @@ -3920,6 +3927,11 @@ msgstr "" msgid "relative import" msgstr "" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "" @@ -4114,6 +4126,10 @@ msgstr "" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "" @@ -4139,6 +4155,10 @@ msgstr "" msgid "trapz is defined for 1D iterables" msgstr "" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" diff --git a/locale/it_IT.po b/locale/it_IT.po index 2e08d149ed..ceacac5e81 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -143,6 +143,10 @@ msgstr "%q in uso" msgid "%q index out of range" msgstr "indice %q fuori intervallo" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "gli indici %q devono essere interi, non %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "" @@ -218,7 +222,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -422,6 +426,10 @@ msgstr "'yield from' è nella funzione sincronizzazione" msgid "'yield' outside function" msgstr "'yield' al di fuori della funzione" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x deve essere il bersaglio del assegnamento" @@ -850,10 +858,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -1150,14 +1154,6 @@ msgstr "" msgid "In-buffer elements must be <= 4 bytes long" msgstr "" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"File .mpy incompatibile. Aggiorna tutti i file .mpy. Vedi http://adafru.it/" -"mpy-update per più informazioni." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "" @@ -1505,7 +1501,7 @@ msgstr "" msgid "No in or out in program" msgstr "" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "" @@ -2523,6 +2519,10 @@ msgstr "" msgid "array/bytes required on right side" msgstr "" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" @@ -2615,6 +2615,10 @@ msgstr "buffer troppo piccolo" msgid "buffer too small for requested bytes" msgstr "" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2661,7 +2665,7 @@ msgstr "impossibile assegnare all'espressione" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2670,6 +2674,11 @@ msgstr "" msgid "can't convert %s to complex" msgstr "non è possibile convertire a complex" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "non è possibile convertire %s a float" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "impossibile convertire l'oggetto '%q' implicitamente in %q" @@ -2678,14 +2687,14 @@ msgstr "impossibile convertire l'oggetto '%q' implicitamente in %q" msgid "can't convert complex to float" msgstr "" -#: py/obj.c -msgid "can't convert to %q" -msgstr "" - #: py/obj.c msgid "can't convert to complex" msgstr "non è possibile convertire a complex" +#: py/obj.c +msgid "can't convert to float" +msgstr "non è possibile convertire a float" + #: py/runtime.c msgid "can't convert to int" msgstr "non è possibile convertire a int" @@ -2710,14 +2719,6 @@ msgstr "impossibile eseguire operazione binaria tra '%q' e '%q'" msgid "can't do truncated division of a complex number" msgstr "impossibile fare il modulo di un numero complesso" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "impossibile usare **x multipli" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "impossibile usare *x multipli" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "non è possibile convertire implicitamente '%q' in 'bool'" @@ -2772,6 +2773,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "" @@ -2870,10 +2875,6 @@ msgstr "valori complessi non supportai" msgid "compression header" msgstr "compressione dell'header" -#: py/parse.c -msgid "constant must be an integer" -msgstr "la costante deve essere un intero" - #: py/emitnative.c msgid "conversion to object" msgstr "conversione in oggetto" @@ -3214,7 +3215,11 @@ msgid "import * not at module level" msgstr "" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" msgstr "" #: py/objstr.c @@ -3243,6 +3248,10 @@ msgstr "" msgid "index out of range" msgstr "indice fuori intervallo" +#: py/obj.c +msgid "indices must be integers" +msgstr "gli indici devono essere interi" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "" @@ -3376,10 +3385,6 @@ msgstr "" msgid "invalid exception" msgstr "" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "formato non valido" - #: py/objstr.c msgid "invalid format specifier" msgstr "specificatore di formato non valido" @@ -3446,10 +3451,6 @@ msgstr "" "argomento(i) nominati non ancora implementati - usare invece argomenti " "normali" -#: py/bc.c -msgid "keywords must be strings" -msgstr "argomenti nominati devono essere stringhe" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "etichetta '%q' non definita" @@ -3674,14 +3675,6 @@ msgstr "argomento non predefinito segue argmoento predfinito" msgid "non-hex digit found" msgstr "trovata cifra non esadecimale" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "argomento non nominato dopo */**" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "argomento non nominato seguito da argomento nominato" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "" @@ -3694,6 +3687,10 @@ msgstr "" msgid "not a 128-bit UUID" msgstr "" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "" @@ -3938,6 +3935,14 @@ msgstr "" msgid "port must be >= 0" msgstr "" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "il terzo argomento di pow() non può essere 0" @@ -3966,6 +3971,11 @@ msgstr "" msgid "relative import" msgstr "importazione relativa" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "lunghezza %d richiesta ma l'oggetto ha lunghezza %d" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "" @@ -4160,6 +4170,10 @@ msgstr "timestamp è fuori intervallo per il time_t della piattaforma" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "" @@ -4185,6 +4199,10 @@ msgstr "" msgid "trapz is defined for 1D iterables" msgstr "" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "tupla/lista ha la lunghezza sbagliata" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4404,6 +4422,34 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "File .mpy incompatibile. Aggiorna tutti i file .mpy. Vedi http://adafru." +#~ "it/mpy-update per più informazioni." + +#~ msgid "can't have multiple **x" +#~ msgstr "impossibile usare **x multipli" + +#~ msgid "can't have multiple *x" +#~ msgstr "impossibile usare *x multipli" + +#~ msgid "constant must be an integer" +#~ msgstr "la costante deve essere un intero" + +#~ msgid "invalid format" +#~ msgstr "formato non valido" + +#~ msgid "keywords must be strings" +#~ msgstr "argomenti nominati devono essere stringhe" + +#~ msgid "non-keyword arg after */**" +#~ msgstr "argomento non nominato dopo */**" + +#~ msgid "non-keyword arg after keyword arg" +#~ msgstr "argomento non nominato seguito da argomento nominato" + #~ msgid "No RX pin" #~ msgstr "Nessun pin RX" @@ -4474,25 +4520,12 @@ msgstr "" #~ msgid "zero step" #~ msgstr "zero step" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "gli indici %q devono essere interi, non %s" - -#~ msgid "indices must be integers" -#~ msgstr "gli indici devono essere interi" - -#, c-format -#~ msgid "requested length %d but object has length %d" -#~ msgstr "lunghezza %d richiesta ma l'oggetto ha lunghezza %d" - #~ msgid "single '}' encountered in format string" #~ msgstr "'}' singolo presente nella stringa di formattazione" #~ msgid "threshold must be in the range 0-65536" #~ msgstr "la soglia deve essere nell'intervallo 0-65536" -#~ msgid "tuple/list has wrong length" -#~ msgstr "tupla/lista ha la lunghezza sbagliata" - #~ msgid "unmatched '{' in format" #~ msgstr "'{' spaiato nella stringa di formattazione" @@ -4870,9 +4903,6 @@ msgstr "" #~ msgid "__init__() should return None, not '%s'" #~ msgstr "__init__() deve ritornare None, non '%s'" -#~ msgid "can't convert %s to float" -#~ msgstr "non è possibile convertire %s a float" - #~ msgid "can't convert %s to int" #~ msgstr "non è possibile convertire %s a int" @@ -4885,9 +4915,6 @@ msgstr "" #~ msgid "can't convert inf to int" #~ msgstr "impossibile convertire inf in int" -#~ msgid "can't convert to float" -#~ msgstr "non è possibile convertire a float" - #~ msgid "object '%s' is not a tuple or list" #~ msgstr "oggetto '%s' non è una tupla o una lista" diff --git a/locale/ja.po b/locale/ja.po index ae1b71a8db..72fca62efd 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -146,6 +146,10 @@ msgstr "%qは使用中" msgid "%q index out of range" msgstr "%q インデックスは範囲外" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "%qは初期化には失敗" @@ -221,7 +225,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -424,6 +428,10 @@ msgstr "" msgid "'yield' outside function" msgstr "関数外でのyield" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*xは代入先でなければなりません" @@ -851,10 +859,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "破損した .mpy ファイル" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -1149,14 +1153,6 @@ msgstr "" msgid "In-buffer elements must be <= 4 bytes long" msgstr "" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"非互換の.mpyファイル。全.mpyファイルを更新してください。詳細は http://adafru." -"it/mpy-update を参照" - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "バッファサイズが正しくありません" @@ -1503,7 +1499,7 @@ msgstr "" msgid "No in or out in program" msgstr "" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "long integerに対応していません" @@ -2515,6 +2511,10 @@ msgstr "" msgid "array/bytes required on right side" msgstr "右辺にはarray/bytesが必要" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" @@ -2604,6 +2604,10 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2649,7 +2653,7 @@ msgstr "式には代入できません" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "%qを%qに変換できません" @@ -2658,6 +2662,11 @@ msgstr "%qを%qに変換できません" msgid "can't convert %s to complex" msgstr "" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "オブジェクト '%q' を %q に暗黙に変換できません" @@ -2667,11 +2676,11 @@ msgid "can't convert complex to float" msgstr "" #: py/obj.c -msgid "can't convert to %q" -msgstr "%q に変換できません" +msgid "can't convert to complex" +msgstr "" #: py/obj.c -msgid "can't convert to complex" +msgid "can't convert to float" msgstr "" #: py/runtime.c @@ -2698,14 +2707,6 @@ msgstr "" msgid "can't do truncated division of a complex number" msgstr "複素数の切り捨て除算はできません" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "複数の **x は持てません" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "複数の *x は持てません" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "" @@ -2760,6 +2761,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "手動と自動のフィールド指定は混在できません" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "" @@ -2858,10 +2863,6 @@ msgstr "" msgid "compression header" msgstr "圧縮ヘッダー" -#: py/parse.c -msgid "constant must be an integer" -msgstr "定数は整数でなければなりません" - #: py/emitnative.c msgid "conversion to object" msgstr "" @@ -3200,7 +3201,11 @@ msgid "import * not at module level" msgstr "" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" msgstr "" #: py/objstr.c @@ -3229,6 +3234,10 @@ msgstr "" msgid "index out of range" msgstr "インデクスが範囲外" +#: py/obj.c +msgid "indices must be integers" +msgstr "インデクスは整数でなければなりません" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "" @@ -3363,10 +3372,6 @@ msgstr "" msgid "invalid exception" msgstr "" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "" - #: py/objstr.c msgid "invalid format specifier" msgstr "" @@ -3428,10 +3433,6 @@ msgstr "joinには str/bytes (のうち自身と一致した型の) リストが msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "キーワード引数は未実装。通常の引数を使ってください" -#: py/bc.c -msgid "keywords must be strings" -msgstr "キーワードは文字列でなければなりません" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "ラベル'%q'は定義されていません" @@ -3656,14 +3657,6 @@ msgstr "デフォルト引数の後に通常の引数は置けません" msgid "non-hex digit found" msgstr "16進数以外の桁があります" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "*/** の後に非キーワード引数は置けません" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "キーワード引数の後に非キーワード引数は置けません" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "" @@ -3676,6 +3669,10 @@ msgstr "" msgid "not a 128-bit UUID" msgstr "128ビットのUUIDではありません" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "文字列書式化で全ての引数が使われていません" @@ -3916,6 +3913,14 @@ msgstr "" msgid "port must be >= 0" msgstr "" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "pow()の3つ目の引数は0にできません" @@ -3944,6 +3949,11 @@ msgstr "実数部と虚数部は同じ長さでなければなりません" msgid "relative import" msgstr "相対インポート" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "必要な長さは%dですがオブジェクトの長さは%d" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "" @@ -4138,6 +4148,10 @@ msgstr "timestampがプラットフォームのtime_tの範囲外" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "" @@ -4163,6 +4177,10 @@ msgstr "trapzは同じ長さの1次元arrayに対して定義されています" msgid "trapz is defined for 1D iterables" msgstr "" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "タプル/リストの長さが正しくありません" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4382,6 +4400,37 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Corrupt .mpy file" +#~ msgstr "破損した .mpy ファイル" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "非互換の.mpyファイル。全.mpyファイルを更新してください。詳細は http://" +#~ "adafru.it/mpy-update を参照" + +#~ msgid "can't convert to %q" +#~ msgstr "%q に変換できません" + +#~ msgid "can't have multiple **x" +#~ msgstr "複数の **x は持てません" + +#~ msgid "can't have multiple *x" +#~ msgstr "複数の *x は持てません" + +#~ msgid "constant must be an integer" +#~ msgstr "定数は整数でなければなりません" + +#~ msgid "keywords must be strings" +#~ msgstr "キーワードは文字列でなければなりません" + +#~ msgid "non-keyword arg after */**" +#~ msgstr "*/** の後に非キーワード引数は置けません" + +#~ msgid "non-keyword arg after keyword arg" +#~ msgstr "キーワード引数の後に非キーワード引数は置けません" + #~ msgid "Hardware busy, try alternative pins" #~ msgstr "ハードウェアビジー。代替のピンを試してください" @@ -4497,13 +4546,6 @@ msgstr "" #~ msgid "WatchDogTimer.timeout must be greater than 0" #~ msgstr "WatchDogTimer.timeoutは0以上でなければなりません" -#~ msgid "indices must be integers" -#~ msgstr "インデクスは整数でなければなりません" - -#, c-format -#~ msgid "requested length %d but object has length %d" -#~ msgstr "必要な長さは%dですがオブジェクトの長さは%d" - #~ msgid "single '}' encountered in format string" #~ msgstr "文字列フォーマット中に孤立した '}' があります" @@ -4513,9 +4555,6 @@ msgstr "" #~ msgid "timeout must be 0.0-100.0 seconds" #~ msgstr "timeoutは0.0〜100.0秒でなければなりません" -#~ msgid "tuple/list has wrong length" -#~ msgstr "タプル/リストの長さが正しくありません" - #~ msgid "unmatched '{' in format" #~ msgstr "書式中にマッチしない '{' があります" diff --git a/locale/ko.po b/locale/ko.po index 2fd584eb20..3440a5263b 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -140,6 +140,10 @@ msgstr "%q 사용 중입니다" msgid "%q index out of range" msgstr "%q 인덱스 범위를 벗어났습니다" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "%q 인덱스는 %s 가 아닌 정수 여야합니다" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "" @@ -215,7 +219,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -418,6 +422,10 @@ msgstr "" msgid "'yield' outside function" msgstr "'yield' 는 함수 외부에 존재합니다" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "" @@ -843,10 +851,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -1141,12 +1145,6 @@ msgstr "" msgid "In-buffer elements must be <= 4 bytes long" msgstr "" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "" @@ -1493,7 +1491,7 @@ msgstr "" msgid "No in or out in program" msgstr "" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "" @@ -2502,6 +2500,10 @@ msgstr "" msgid "array/bytes required on right side" msgstr "" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" @@ -2591,6 +2593,10 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2636,7 +2642,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2645,6 +2651,11 @@ msgstr "" msgid "can't convert %s to complex" msgstr "" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "" @@ -2654,11 +2665,11 @@ msgid "can't convert complex to float" msgstr "" #: py/obj.c -msgid "can't convert to %q" +msgid "can't convert to complex" msgstr "" #: py/obj.c -msgid "can't convert to complex" +msgid "can't convert to float" msgstr "" #: py/runtime.c @@ -2685,14 +2696,6 @@ msgstr "" msgid "can't do truncated division of a complex number" msgstr "" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "" @@ -2747,6 +2750,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "" @@ -2843,10 +2850,6 @@ msgstr "" msgid "compression header" msgstr "" -#: py/parse.c -msgid "constant must be an integer" -msgstr "" - #: py/emitnative.c msgid "conversion to object" msgstr "" @@ -3183,7 +3186,11 @@ msgid "import * not at module level" msgstr "" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" msgstr "" #: py/objstr.c @@ -3212,6 +3219,10 @@ msgstr "" msgid "index out of range" msgstr "" +#: py/obj.c +msgid "indices must be integers" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "" @@ -3345,10 +3356,6 @@ msgstr "" msgid "invalid exception" msgstr "" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "형식가 유효하지 않습니다" - #: py/objstr.c msgid "invalid format specifier" msgstr "형식 지정자(format specifier)가 유효하지 않습니다" @@ -3410,10 +3417,6 @@ msgstr "" msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "" -#: py/bc.c -msgid "keywords must be strings" -msgstr "" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "" @@ -3638,14 +3641,6 @@ msgstr "" msgid "non-hex digit found" msgstr "" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "" @@ -3658,6 +3653,10 @@ msgstr "" msgid "not a 128-bit UUID" msgstr "" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "" @@ -3896,6 +3895,14 @@ msgstr "" msgid "port must be >= 0" msgstr "" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "" @@ -3924,6 +3931,11 @@ msgstr "" msgid "relative import" msgstr "" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "" @@ -4118,6 +4130,10 @@ msgstr "" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "" @@ -4143,6 +4159,10 @@ msgstr "" msgid "trapz is defined for 1D iterables" msgstr "" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4362,15 +4382,15 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "invalid format" +#~ msgstr "형식가 유효하지 않습니다" + #~ msgid "Expected a %q" #~ msgstr "%q 이 예상되었습니다." #~ msgid "Invalid pins" #~ msgstr "핀이 유효하지 않습니다" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "%q 인덱스는 %s 가 아닌 정수 여야합니다" - #~ msgid "%q must be >= 1" #~ msgstr "%q 는 >=1이어야합니다" diff --git a/locale/nl.po b/locale/nl.po index aa522ad111..c7ef29adab 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -139,6 +139,10 @@ msgstr "%q in gebruik" msgid "%q index out of range" msgstr "%q index buiten bereik" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "%q indexen moeten integers zijn, niet %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "" @@ -214,7 +218,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -417,6 +421,10 @@ msgstr "'yield from' binnen asynchrone functie" msgid "'yield' outside function" msgstr "'yield' buiten de functie" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x moet een assignment target zijn" @@ -845,10 +853,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "Corrupt .mpy bestand" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Kon klok niet ophalen" @@ -1144,14 +1148,6 @@ msgstr "" msgid "In-buffer elements must be <= 4 bytes long" msgstr "" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"Incompatibel .mpy bestand. Update alle .mpy bestanden. Zie http://adafru.it/" -"mpy-update voor meer informatie." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "Incorrecte buffer grootte" @@ -1498,7 +1494,7 @@ msgstr "" msgid "No in or out in program" msgstr "" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "Geen lange integer ondersteuning" @@ -2525,6 +2521,10 @@ msgstr "" msgid "array/bytes required on right side" msgstr "array/bytes vereist aan de rechterkant" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "verzoek om (arg)min.(arg)max te krijgen van lege reeks" @@ -2614,6 +2614,10 @@ msgstr "buffer te klein" msgid "buffer too small for requested bytes" msgstr "buffer te klein voor gevraagde bytes" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "bytes lengte is geen veelvoud van itemgrootte" @@ -2660,7 +2664,7 @@ msgstr "kan niet toewijzen aan expressie" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "kan %q niet naar %q converteren" @@ -2669,6 +2673,11 @@ msgstr "kan %q niet naar %q converteren" msgid "can't convert %s to complex" msgstr "kan %s niet converteren naar een complex" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "kan %s niet omzetten naar een float" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "kan '%q' object niet omzetten naar %q impliciet" @@ -2677,14 +2686,14 @@ msgstr "kan '%q' object niet omzetten naar %q impliciet" msgid "can't convert complex to float" msgstr "" -#: py/obj.c -msgid "can't convert to %q" -msgstr "kan niet naar %q converteren" - #: py/obj.c msgid "can't convert to complex" msgstr "kan niet omzetten naar complex" +#: py/obj.c +msgid "can't convert to float" +msgstr "kan niet omzetten naar float" + #: py/runtime.c msgid "can't convert to int" msgstr "kan niet omzetten naar int" @@ -2709,14 +2718,6 @@ msgstr "kan geen een binaire operatie doen tussen '%q' en '%q'" msgid "can't do truncated division of a complex number" msgstr "kan geen afgekapte deling doen van een comlex nummer" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "kan niet meerdere **x hebben" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "kan geen meerdere *x hebben" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "kan '%q niet impliciet converteren naar 'bool'" @@ -2771,6 +2772,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "kan niet schakelen tussen handmatige en automatische veld specificatie" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "" @@ -2867,10 +2872,6 @@ msgstr "complexe waardes niet ondersteund" msgid "compression header" msgstr "compressie header" -#: py/parse.c -msgid "constant must be an integer" -msgstr "constant moet een integer zijn" - #: py/emitnative.c msgid "conversion to object" msgstr "conversie naar object" @@ -3210,7 +3211,11 @@ msgid "import * not at module level" msgstr "" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" msgstr "" #: py/objstr.c @@ -3239,6 +3244,10 @@ msgstr "" msgid "index out of range" msgstr "index is buiten bereik" +#: py/obj.c +msgid "indices must be integers" +msgstr "indices moeten integers zijn" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "indices moeten integers, segmenten (slices) of Boolean lijsten zijn" @@ -3372,10 +3381,6 @@ msgstr "" msgid "invalid exception" msgstr "" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "ongeldig formaat" - #: py/objstr.c msgid "invalid format specifier" msgstr "ongeldige formaatspecificatie" @@ -3440,10 +3445,6 @@ msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "" "trefwoord argument(en) zijn niet geïmplementeerd, gebruik normale argumenten" -#: py/bc.c -msgid "keywords must be strings" -msgstr "trefwoorden moeten van type string zijn" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "label '%q' is niet gedefinieerd" @@ -3668,14 +3669,6 @@ msgstr "niet-standaard argument volgt op een standaard argument" msgid "non-hex digit found" msgstr "er werd een niet-hexadecimaal cijfer gevonden" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "niet-trefwoord argument na */**" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "niet-trefwoord argument na trefwoord argument" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "" @@ -3688,6 +3681,10 @@ msgstr "" msgid "not a 128-bit UUID" msgstr "geen 128-bit UUID" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "niet alle argumenten omgezet bij formattering van string" @@ -3926,6 +3923,14 @@ msgstr "pop van een lege %q" msgid "port must be >= 0" msgstr "" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "derde argument van pow() mag geen 0 zijn" @@ -3954,6 +3959,11 @@ msgstr "reëel en imaginair deel moeten gelijke lengte hebben" msgid "relative import" msgstr "relatieve import" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "gevraagde lengte is %d maar object heeft lengte %d" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "resultaat kan niet naar gespecificeerd type geconverteerd worden" @@ -4148,6 +4158,10 @@ msgstr "timestamp buiten bereik voor platform time_t" msgid "tobytes can be invoked for dense arrays only" msgstr "tobytes kunnen alleen ingeroepen worden voor gesloten arrays" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "" @@ -4173,6 +4187,10 @@ msgstr "trapz is gedefinieerd voor eendimensionale arrays van gelijke lengte" msgid "trapz is defined for 1D iterables" msgstr "" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "tuple of lijst heeft onjuiste lengte" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4392,6 +4410,40 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "Corrupt .mpy file" +#~ msgstr "Corrupt .mpy bestand" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "Incompatibel .mpy bestand. Update alle .mpy bestanden. Zie http://adafru." +#~ "it/mpy-update voor meer informatie." + +#~ msgid "can't convert to %q" +#~ msgstr "kan niet naar %q converteren" + +#~ msgid "can't have multiple **x" +#~ msgstr "kan niet meerdere **x hebben" + +#~ msgid "can't have multiple *x" +#~ msgstr "kan geen meerdere *x hebben" + +#~ msgid "constant must be an integer" +#~ msgstr "constant moet een integer zijn" + +#~ msgid "invalid format" +#~ msgstr "ongeldig formaat" + +#~ msgid "keywords must be strings" +#~ msgstr "trefwoorden moeten van type string zijn" + +#~ msgid "non-keyword arg after */**" +#~ msgstr "niet-trefwoord argument na */**" + +#~ msgid "non-keyword arg after keyword arg" +#~ msgstr "niet-trefwoord argument na trefwoord argument" + #~ msgid "inputs are not iterable" #~ msgstr "invoer is niet itereerbaar" @@ -4535,19 +4587,9 @@ msgstr "zi moet vorm (n_section, 2) hebben" #~ msgid "zero step" #~ msgstr "nul-stap" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "%q indexen moeten integers zijn, niet %s" - #~ msgid "WatchDogTimer.timeout must be greater than 0" #~ msgstr "WatchDogTimer.timeout moet groter dan 0 zijn" -#~ msgid "indices must be integers" -#~ msgstr "indices moeten integers zijn" - -#, c-format -#~ msgid "requested length %d but object has length %d" -#~ msgstr "gevraagde lengte is %d maar object heeft lengte %d" - #~ msgid "single '}' encountered in format string" #~ msgstr "enkele '}' aangetroffen in formaat tekenreeks (string)" @@ -4557,9 +4599,6 @@ msgstr "zi moet vorm (n_section, 2) hebben" #~ msgid "timeout must be 0.0-100.0 seconds" #~ msgstr "timeout moet tussen 0.0 en 100.0 seconden zijn" -#~ msgid "tuple/list has wrong length" -#~ msgstr "tuple of lijst heeft onjuiste lengte" - #~ msgid "unmatched '{' in format" #~ msgstr "'{' zonder overeenkomst in formaat" @@ -5413,9 +5452,6 @@ msgstr "zi moet vorm (n_section, 2) hebben" #~ msgid "__init__() should return None, not '%s'" #~ msgstr "__init __ () zou None moeten retouneren, niet '%s'" -#~ msgid "can't convert %s to float" -#~ msgstr "kan %s niet omzetten naar een float" - #~ msgid "can't convert %s to int" #~ msgstr "kan %s niet omzetten naar een int" @@ -5428,9 +5464,6 @@ msgstr "zi moet vorm (n_section, 2) hebben" #~ msgid "can't convert inf to int" #~ msgstr "kan inf niet omzetten naar int" -#~ msgid "can't convert to float" -#~ msgstr "kan niet omzetten naar float" - #~ msgid "object '%s' is not a tuple or list" #~ msgstr "object '%s' is geen tuple of lijst" diff --git a/locale/pl.po b/locale/pl.po index 56ef448d61..35929938e0 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -141,6 +141,10 @@ msgstr "%q w użyciu" msgid "%q index out of range" msgstr "%q poza zakresem" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "%q indeks musi być liczbą całkowitą, a nie %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "" @@ -216,7 +220,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -419,6 +423,10 @@ msgstr "'yield from' wewnątrz funkcji asynchronicznej" msgid "'yield' outside function" msgstr "'yield' poza funkcją" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x musi być obiektem przypisania" @@ -846,10 +854,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "Uszkodzony plik .mpy" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -1144,14 +1148,6 @@ msgstr "" msgid "In-buffer elements must be <= 4 bytes long" msgstr "" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"Niekompatybilny plik .mpy. Proszę odświeżyć wszystkie pliki .mpy. Więcej " -"informacji na http://adafrui.it/mpy-update." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "Niewłaściwa wielkość bufora" @@ -1498,7 +1494,7 @@ msgstr "" msgid "No in or out in program" msgstr "" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "" @@ -2506,6 +2502,10 @@ msgstr "" msgid "array/bytes required on right side" msgstr "tablica/bytes wymagane po prawej stronie" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" @@ -2595,6 +2595,10 @@ msgstr "zbyt mały bufor" msgid "buffer too small for requested bytes" msgstr "" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2640,7 +2644,7 @@ msgstr "przypisanie do wyrażenia" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "nie można dokonać konwersji %q na %q" @@ -2649,6 +2653,11 @@ msgstr "nie można dokonać konwersji %q na %q" msgid "can't convert %s to complex" msgstr "nie można skonwertować %s do complex" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "nie można skonwertować %s do float" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "nie można automatycznie skonwertować '%q' do '%q'" @@ -2657,14 +2666,14 @@ msgstr "nie można automatycznie skonwertować '%q' do '%q'" msgid "can't convert complex to float" msgstr "" -#: py/obj.c -msgid "can't convert to %q" -msgstr "" - #: py/obj.c msgid "can't convert to complex" msgstr "nie można skonwertować do complex" +#: py/obj.c +msgid "can't convert to float" +msgstr "nie można skonwertować do float" + #: py/runtime.c msgid "can't convert to int" msgstr "nie można skonwertować do int" @@ -2689,14 +2698,6 @@ msgstr "nie można użyć operatora pomiędzy '%q' a '%q'" msgid "can't do truncated division of a complex number" msgstr "nie można wykonać dzielenia całkowitego na liczbie zespolonej" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "nie można mieć wielu **x" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "nie można mieć wielu *x" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "nie można automatyczne skonwertować '%q' do 'bool'" @@ -2751,6 +2752,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "nie można zmienić z ręcznego numerowaniu pól do automatycznego" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "" @@ -2847,10 +2852,6 @@ msgstr "wartości zespolone nieobsługiwane" msgid "compression header" msgstr "nagłówek kompresji" -#: py/parse.c -msgid "constant must be an integer" -msgstr "stała musi być liczbą całkowitą" - #: py/emitnative.c msgid "conversion to object" msgstr "konwersja do obiektu" @@ -3188,7 +3189,11 @@ msgid "import * not at module level" msgstr "" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" msgstr "" #: py/objstr.c @@ -3217,6 +3222,10 @@ msgstr "" msgid "index out of range" msgstr "indeks poza zakresem" +#: py/obj.c +msgid "indices must be integers" +msgstr "indeksy muszą być całkowite" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "" @@ -3350,10 +3359,6 @@ msgstr "" msgid "invalid exception" msgstr "" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "zły format" - #: py/objstr.c msgid "invalid format specifier" msgstr "zła specyfikacja formatu" @@ -3415,10 +3420,6 @@ msgstr "join oczekuje listy str/bytes zgodnych z self" msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "argumenty nazwane nieobsługiwane - proszę użyć zwykłych argumentów" -#: py/bc.c -msgid "keywords must be strings" -msgstr "słowa kluczowe muszą być łańcuchami" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "etykieta '%q' niezdefiniowana" @@ -3643,14 +3644,6 @@ msgstr "argument z wartością domyślną przed argumentem bez" msgid "non-hex digit found" msgstr "cyfra nieszesnastkowa" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "argument nienazwany po */**" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "argument nienazwany po nazwanym" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "" @@ -3663,6 +3656,10 @@ msgstr "" msgid "not a 128-bit UUID" msgstr "to nie jest 128-bitowy UUID" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "nie wszystkie argumenty wykorzystane w formatowaniu" @@ -3902,6 +3899,14 @@ msgstr "" msgid "port must be >= 0" msgstr "" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "trzeci argument pow() nie może być 0" @@ -3930,6 +3935,11 @@ msgstr "rzeczywiste i urojone części muszą mieć jednakową długość" msgid "relative import" msgstr "relatywny import" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "zażądano długości %d ale obiekt ma długość %d" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "" @@ -4124,6 +4134,10 @@ msgstr "timestamp poza zakresem dla time_t na tej platformie" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "" @@ -4149,6 +4163,10 @@ msgstr "" msgid "trapz is defined for 1D iterables" msgstr "" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "krotka/lista ma złą długość" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4368,6 +4386,37 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Corrupt .mpy file" +#~ msgstr "Uszkodzony plik .mpy" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "Niekompatybilny plik .mpy. Proszę odświeżyć wszystkie pliki .mpy. Więcej " +#~ "informacji na http://adafrui.it/mpy-update." + +#~ msgid "can't have multiple **x" +#~ msgstr "nie można mieć wielu **x" + +#~ msgid "can't have multiple *x" +#~ msgstr "nie można mieć wielu *x" + +#~ msgid "constant must be an integer" +#~ msgstr "stała musi być liczbą całkowitą" + +#~ msgid "invalid format" +#~ msgstr "zły format" + +#~ msgid "keywords must be strings" +#~ msgstr "słowa kluczowe muszą być łańcuchami" + +#~ msgid "non-keyword arg after */**" +#~ msgstr "argument nienazwany po */**" + +#~ msgid "non-keyword arg after keyword arg" +#~ msgstr "argument nienazwany po nazwanym" + #~ msgid "Too many display busses" #~ msgstr "Zbyt wiele magistrali" @@ -4475,28 +4524,15 @@ msgstr "" #~ msgid "zero step" #~ msgstr "zerowy krok" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "%q indeks musi być liczbą całkowitą, a nie %s" - #~ msgid "WatchDogTimer.timeout must be greater than 0" #~ msgstr "WatchDogTimer.timeout musi być większe od 0" -#~ msgid "indices must be integers" -#~ msgstr "indeksy muszą być całkowite" - -#, c-format -#~ msgid "requested length %d but object has length %d" -#~ msgstr "zażądano długości %d ale obiekt ma długość %d" - #~ msgid "single '}' encountered in format string" #~ msgstr "pojedynczy '}' w specyfikacji formatu" #~ msgid "threshold must be in the range 0-65536" #~ msgstr "threshold musi być w zakresie 0-65536" -#~ msgid "tuple/list has wrong length" -#~ msgstr "krotka/lista ma złą długość" - #~ msgid "unmatched '{' in format" #~ msgstr "niepasujące '{' for formacie" @@ -5032,9 +5068,6 @@ msgstr "" #~ msgid "__init__() should return None, not '%s'" #~ msgstr "__init__() powinien zwracać None, nie '%s'" -#~ msgid "can't convert %s to float" -#~ msgstr "nie można skonwertować %s do float" - #~ msgid "can't convert %s to int" #~ msgstr "nie można skonwertować %s do int" @@ -5047,9 +5080,6 @@ msgstr "" #~ msgid "can't convert inf to int" #~ msgstr "nie można skonwertować inf do int" -#~ msgid "can't convert to float" -#~ msgstr "nie można skonwertować do float" - #~ msgid "object '%s' is not a tuple or list" #~ msgstr "obiekt '%s' nie jest krotką ani listą" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 3b1a55297c..22d4ff7e78 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -152,6 +152,10 @@ msgstr "%q em uso" msgid "%q index out of range" msgstr "O índice %q está fora do intervalo" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "Os índices %q devem ser inteiros, e não %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "a inicialização do %q falhou" @@ -227,7 +231,7 @@ msgstr "%q deve ser uma matriz do tipo 'h'" msgid "%q must be of type %q or %q, not %q" msgstr "%q deve ser do tipo %q ou %q e não %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q deve ser do tipo %q e não %q" @@ -434,6 +438,10 @@ msgstr "'yield a partir' de dentro da função async" msgid "'yield' outside function" msgstr "função externa 'yield'" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x deve ser o destino da atribuição" @@ -868,10 +876,6 @@ msgstr "As coordenadas das matrizes possuem comprimentos diferentes" msgid "Coordinate arrays types have different sizes" msgstr "Os tipos das coordenadas das matrizes possuem tamanhos diferentes" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "Arquivo .mpy corrompido" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Não foi possível recuperar o clock" @@ -1172,14 +1176,6 @@ msgstr "Periférico I2C em uso" msgid "In-buffer elements must be <= 4 bytes long" msgstr "Os elementos In-buffer devem ter um comprimento de <= 4 bytes" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"Arquivo .mpy incompatível. Atualize todos os arquivos .mpy. Consulte http://" -"adafru.it/mpy-update para mais informações." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "O tamanho do buffer está incorreto" @@ -1532,7 +1528,7 @@ msgstr "Sem entrada no programa" msgid "No in or out in program" msgstr "Sem entrada ou saída no programa" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "Não há compatibilidade com inteiro longo" @@ -2577,6 +2573,10 @@ msgstr "a array é grande demais" msgid "array/bytes required on right side" msgstr "matriz/bytes são necessários no lado direito" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "tentativa de obter (arg)min/(arg)max da sequência vazia" @@ -2666,6 +2666,10 @@ msgstr "o buffer é muito pequeno" msgid "buffer too small for requested bytes" msgstr "o buffer é pequeno demais para os bytes requisitados" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "o comprimento dos bytes não é um múltiplo do tamanho do item" @@ -2711,7 +2715,7 @@ msgstr "a expressão não pode ser atribuída" msgid "can't cancel self" msgstr "não é possível cancelar a si mesmo" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "não é possível converter %q para %q" @@ -2720,6 +2724,11 @@ msgstr "não é possível converter %q para %q" msgid "can't convert %s to complex" msgstr "Não é possível converter %s para complex" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "Não é possível converter %s para float" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "não é possível converter implicitamente o objeto '%q' para %q" @@ -2728,14 +2737,14 @@ msgstr "não é possível converter implicitamente o objeto '%q' para %q" msgid "can't convert complex to float" msgstr "não foi possível converter complexo em flutuante" -#: py/obj.c -msgid "can't convert to %q" -msgstr "não é possível converter para %q" - #: py/obj.c msgid "can't convert to complex" msgstr "não é possível converter para complex" +#: py/obj.c +msgid "can't convert to float" +msgstr "não é possível converter para float" + #: py/runtime.c msgid "can't convert to int" msgstr "não é possível converter para int" @@ -2760,14 +2769,6 @@ msgstr "não é possível executar uma operação binária entre '%q' e '%q'" msgid "can't do truncated division of a complex number" msgstr "não é possível fazer a divisão truncada de um número complexo" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "não pode haver vários **x" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "não pode haver vários *x" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "não é possível converter implicitamente '%q' em 'bool'" @@ -2826,6 +2827,10 @@ msgid "" msgstr "" "não é possível alternar da especificação de campo manual para a automática" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "não é possível atribuir uma nova forma" @@ -2924,10 +2929,6 @@ msgstr "os valores complexos não compatíveis" msgid "compression header" msgstr "compressão do cabeçalho" -#: py/parse.c -msgid "constant must be an integer" -msgstr "constante deve ser um inteiro" - #: py/emitnative.c msgid "conversion to object" msgstr "conversão para o objeto" @@ -3269,8 +3270,12 @@ msgid "import * not at module level" msgstr "importação * não está no nível do módulo" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" -msgstr "arquivo .mpy com arquitetura nativa incompatível" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" +msgstr "arquivo .mpy incompatível" #: py/objstr.c msgid "incomplete format" @@ -3298,6 +3303,10 @@ msgstr "o índice deve ser tupla ou int" msgid "index out of range" msgstr "Índice fora do intervalo" +#: py/obj.c +msgid "indices must be integers" +msgstr "os índices devem ser inteiros" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "os índices devem ser números inteiros, fatias ou listas booleanas" @@ -3432,10 +3441,6 @@ msgstr "element_size %d é inválido, deve ser, 1, 2, ou 4" msgid "invalid exception" msgstr "exceção inválida" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "formato inválido" - #: py/objstr.c msgid "invalid format specifier" msgstr "o especificador do formato é inválido" @@ -3500,10 +3505,6 @@ msgstr "" "o(s) argumento(s) de palavra-chave ainda não foi implementado - em vez " "disso, use argumentos normais" -#: py/bc.c -msgid "keywords must be strings" -msgstr "as palavras-chave devem ser uma cadeia de caracteres" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "o rótulo '%q' não foi definido" @@ -3730,14 +3731,6 @@ msgstr "o argumento não predefinido segue o argumento predefinido" msgid "non-hex digit found" msgstr "um dígito não hexadecimal foi encontrado" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "um arg sem palavra-chave após */ **" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "um arg não-palavra-chave após a palavra-chave arg" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "o tempo limite não zero deve ser > 0.01" @@ -3750,6 +3743,10 @@ msgstr "o tempo limite não zero deve ser >= intervalo" msgid "not a 128-bit UUID" msgstr "não é um UUID com 128 bits" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "nem todos os argumentos são convertidos durante a formatação da string" @@ -3993,6 +3990,14 @@ msgstr "pop a partir do %q vazio" msgid "port must be >= 0" msgstr "a porta deve ser > = 0" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "O terceiro argumento pow() não pode ser 0" @@ -4021,6 +4026,11 @@ msgstr "partes reais e imaginárias devem ter o mesmo comprimento" msgid "relative import" msgstr "importação relativa" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "o comprimento solicitado %d, porém o objeto tem comprimento %d" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "os resultados não podem ser lançados para um determinado tipo" @@ -4215,6 +4225,10 @@ msgstr "timestamp fora do intervalo para a plataforma time_t" msgid "tobytes can be invoked for dense arrays only" msgstr "os tobytes podem ser invocados apenas nas matrizes densas" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "dimensões demais" @@ -4240,6 +4254,10 @@ msgstr "o trapz está definido para 1D arrays de igual tamanho" msgid "trapz is defined for 1D iterables" msgstr "o trapz é definido para iteráveis 1D" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "a tupla/lista está com tamanho incorreto" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4459,6 +4477,43 @@ 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 "Corrupt .mpy file" +#~ msgstr "Arquivo .mpy corrompido" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "Arquivo .mpy incompatível. Atualize todos os arquivos .mpy. Consulte " +#~ "http://adafru.it/mpy-update para mais informações." + +#~ msgid "can't convert to %q" +#~ msgstr "não é possível converter para %q" + +#~ msgid "can't have multiple **x" +#~ msgstr "não pode haver vários **x" + +#~ msgid "can't have multiple *x" +#~ msgstr "não pode haver vários *x" + +#~ msgid "constant must be an integer" +#~ msgstr "constante deve ser um inteiro" + +#~ msgid "incompatible native .mpy architecture" +#~ msgstr "arquivo .mpy com arquitetura nativa incompatível" + +#~ msgid "invalid format" +#~ msgstr "formato inválido" + +#~ msgid "keywords must be strings" +#~ msgstr "as palavras-chave devem ser uma cadeia de caracteres" + +#~ msgid "non-keyword arg after */**" +#~ msgstr "um arg sem palavra-chave após */ **" + +#~ msgid "non-keyword arg after keyword arg" +#~ msgstr "um arg não-palavra-chave após a palavra-chave arg" + #, c-format #~ msgid "Instruction %d shifts in more bits than pin count" #~ msgstr "A instrução %d muda com mais bits do que a quantidade dos pinos" @@ -4809,22 +4864,12 @@ msgstr "zi deve estar na forma (n_section, 2)" #~ msgid "invalid traceback" #~ msgstr "rastreamento inválido" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "Os índices %q devem ser inteiros, e não %s" - #~ msgid "WatchDogTimer.timeout must be greater than 0" #~ msgstr "O WatchDogTimer.timeout deve ser maior que 0" -#~ msgid "indices must be integers" -#~ msgstr "os índices devem ser inteiros" - #~ msgid "non-Device in %q" #~ msgstr "não dispositivo em %q" -#, c-format -#~ msgid "requested length %d but object has length %d" -#~ msgstr "o comprimento solicitado %d, porém o objeto tem comprimento %d" - #~ msgid "single '}' encountered in format string" #~ msgstr "único '}' encontrado na string do formato" @@ -4834,9 +4879,6 @@ msgstr "zi deve estar na forma (n_section, 2)" #~ msgid "timeout must be 0.0-100.0 seconds" #~ msgstr "o tempo limite deve ser entre 0.0 a 100.0 segundos" -#~ msgid "tuple/list has wrong length" -#~ msgstr "a tupla/lista está com tamanho incorreto" - #~ msgid "unmatched '{' in format" #~ msgstr "um '{' sem par no formato" @@ -5569,9 +5611,6 @@ msgstr "zi deve estar na forma (n_section, 2)" #~ msgid "Length must be non-negative" #~ msgstr "O comprimento deve ser positivo" -#~ msgid "incompatible .mpy file" -#~ msgstr "arquivo .mpy incompatível" - #~ msgid "invalid decorator" #~ msgstr "decorador inválido" @@ -5921,9 +5960,6 @@ msgstr "zi deve estar na forma (n_section, 2)" #~ msgid "__init__() should return None, not '%s'" #~ msgstr "O __init__() deve retornar Nenhum, não '%s'" -#~ msgid "can't convert %s to float" -#~ msgstr "Não é possível converter %s para float" - #~ msgid "can't convert %s to int" #~ msgstr "Não é possível converter %s para int" @@ -5936,9 +5972,6 @@ msgstr "zi deve estar na forma (n_section, 2)" #~ msgid "can't convert inf to int" #~ msgstr "não é possível converter inf para int" -#~ msgid "can't convert to float" -#~ msgstr "não é possível converter para float" - #~ msgid "object '%s' is not a tuple or list" #~ msgstr "o objeto '%s' não é uma tupla ou uma lista" diff --git a/locale/ru.po b/locale/ru.po index 8d5739ae4d..ee512bdd65 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -146,6 +146,10 @@ msgstr "%q используется" msgid "%q index out of range" msgstr "Индекс %q вне диапазона" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "Индексы %q должны быть целыми числами, а не %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "Инициализация %q не удалась" @@ -221,7 +225,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -424,6 +428,10 @@ msgstr "'yield from' внутри асинхронной функции" msgid "'yield' outside function" msgstr "'yield' вне функции" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x должно быть целью назначения" @@ -865,10 +873,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "Файл .mpy поврежден" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Не удалось извлечь тактирование" @@ -1175,14 +1179,6 @@ msgstr "Периферийное устройство I2C уже использ msgid "In-buffer elements must be <= 4 bytes long" msgstr "Элементы буфера должны быть длиной <= 4 байта" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"Несовместимый файл .mpy. Пожалуйста, обновите все файлы .mpy. См. http://" -"adafru.it/mpy-update для получения дополнительной информации." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "Неправильный размер буфера" @@ -1534,7 +1530,7 @@ msgstr "Нет in в программе" msgid "No in or out in program" msgstr "В программе отсутствует ввод или вывод" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "Нет поддержки длинных целых чисел (long integer)" @@ -2557,6 +2553,10 @@ msgstr "" msgid "array/bytes required on right side" msgstr "" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" @@ -2646,6 +2646,10 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2691,7 +2695,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2700,6 +2704,11 @@ msgstr "" msgid "can't convert %s to complex" msgstr "" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "" @@ -2709,11 +2718,11 @@ msgid "can't convert complex to float" msgstr "" #: py/obj.c -msgid "can't convert to %q" +msgid "can't convert to complex" msgstr "" #: py/obj.c -msgid "can't convert to complex" +msgid "can't convert to float" msgstr "" #: py/runtime.c @@ -2740,14 +2749,6 @@ msgstr "" msgid "can't do truncated division of a complex number" msgstr "" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "" @@ -2802,6 +2803,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "" @@ -2898,10 +2903,6 @@ msgstr "" msgid "compression header" msgstr "" -#: py/parse.c -msgid "constant must be an integer" -msgstr "" - #: py/emitnative.c msgid "conversion to object" msgstr "" @@ -3238,7 +3239,11 @@ msgid "import * not at module level" msgstr "" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" msgstr "" #: py/objstr.c @@ -3267,6 +3272,10 @@ msgstr "" msgid "index out of range" msgstr "" +#: py/obj.c +msgid "indices must be integers" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "" @@ -3400,10 +3409,6 @@ msgstr "" msgid "invalid exception" msgstr "" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "" - #: py/objstr.c msgid "invalid format specifier" msgstr "" @@ -3465,10 +3470,6 @@ msgstr "" msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "" -#: py/bc.c -msgid "keywords must be strings" -msgstr "" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "" @@ -3693,14 +3694,6 @@ msgstr "" msgid "non-hex digit found" msgstr "" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "" @@ -3713,6 +3706,10 @@ msgstr "" msgid "not a 128-bit UUID" msgstr "" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "" @@ -3951,6 +3948,14 @@ msgstr "" msgid "port must be >= 0" msgstr "" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "" @@ -3979,6 +3984,11 @@ msgstr "" msgid "relative import" msgstr "" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "" @@ -4173,6 +4183,10 @@ msgstr "" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "" @@ -4198,6 +4212,10 @@ msgstr "" msgid "trapz is defined for 1D iterables" msgstr "" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4417,6 +4435,16 @@ msgstr "zi должно быть типа float" msgid "zi must be of shape (n_section, 2)" msgstr "zi должен иметь форму (n_section, 2)" +#~ msgid "Corrupt .mpy file" +#~ msgstr "Файл .mpy поврежден" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "Несовместимый файл .mpy. Пожалуйста, обновите все файлы .mpy. См. http://" +#~ "adafru.it/mpy-update для получения дополнительной информации." + #, c-format #~ msgid "Instruction %d shifts in more bits than pin count" #~ msgstr "" @@ -4611,9 +4639,6 @@ msgstr "zi должен иметь форму (n_section, 2)" #~ msgid "No more than %d HID devices allowed" #~ msgstr "Допускается не более %d HID устройств" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "Индексы %q должны быть целыми числами, а не %s" - #~ msgid "Firmware image is invalid" #~ msgstr "Образ прошивки неправильный" diff --git a/locale/sv.po b/locale/sv.po index a631e4fce0..6507055f56 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -151,6 +151,10 @@ msgstr "%q används redan" msgid "%q index out of range" msgstr "Index %q ligger utanför intervallet" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "Indexet %q måste vara ett heltal, inte %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "%q init misslyckades" @@ -228,7 +232,7 @@ msgstr "%q måste vara en matris av typen 'h'" msgid "%q must be of type %q or %q, not %q" msgstr "%q måste vara av typen %q eller %q, inte %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q måste vara av typen %q, inte %q" @@ -431,6 +435,10 @@ msgstr "'yield from' i async-funktion" msgid "'yield' outside function" msgstr "'yield' utanför funktion" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x måste vara mål för tilldelning" @@ -860,10 +868,6 @@ msgstr "Arrayer för koordinater har olika längd" msgid "Coordinate arrays types have different sizes" msgstr "Arrayer för koordinater har olika storlek" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "Skadad .mpy-fil" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "Kunde inte hämta klocka" @@ -1161,14 +1165,6 @@ msgstr "I2C-enhet används redan" msgid "In-buffer elements must be <= 4 bytes long" msgstr "Antal element i buffert måste vara <= 4 byte" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"Inkompatibel .mpy-fil. Uppdatera alla .mpy-filer. Se http://adafru.it/mpy-" -"update för mer information." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "Fel buffertstorlek" @@ -1518,7 +1514,7 @@ msgstr "Inget in i programmet" msgid "No in or out in program" msgstr "Inget in eller ut i programmet" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "Inget stöd för långt heltal" @@ -2548,6 +2544,10 @@ msgstr "matrisen är för stor" msgid "array/bytes required on right side" msgstr "array/bytes krävs på höger sida" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "försök att läsa (arg)min/(arg)max av tom sekvens" @@ -2637,6 +2637,10 @@ msgstr "buffert för liten" msgid "buffer too small for requested bytes" msgstr "buffert för liten för begärd längd" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "bytelängd inte en multipel av storlek" @@ -2682,7 +2686,7 @@ msgstr "kan inte tilldela uttryck" msgid "can't cancel self" msgstr "kan inte avbryta sig själv" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "kan inte konvertera %q till %q" @@ -2691,6 +2695,11 @@ msgstr "kan inte konvertera %q till %q" msgid "can't convert %s to complex" msgstr "kan inte konvertera %s till komplex" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "kan inte konvertera %s till float" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "kan inte konvertera '%q' objekt implicit till %q" @@ -2699,14 +2708,14 @@ msgstr "kan inte konvertera '%q' objekt implicit till %q" msgid "can't convert complex to float" msgstr "kan inte konvertera complex till float" -#: py/obj.c -msgid "can't convert to %q" -msgstr "kan inte konvertera till %q" - #: py/obj.c msgid "can't convert to complex" msgstr "kan inte konvertera till komplex" +#: py/obj.c +msgid "can't convert to float" +msgstr "kan inte konvertera till float" + #: py/runtime.c msgid "can't convert to int" msgstr "kan inte konvertera till int" @@ -2731,14 +2740,6 @@ msgstr "kan inte göra binära op mellan '%q' och '%q'" msgid "can't do truncated division of a complex number" msgstr "kan inte göra trunkerad division av komplext tal" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "kan inte ha flera **x" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "kan inte ha flera *x" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "kan inte implicit konvertera '%q' till 'bool'" @@ -2795,6 +2796,10 @@ msgid "" msgstr "" "kan inte byta från manuell fältspecifikation till automatisk fältnumrering" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "kan inte tilldela en ny form" @@ -2891,10 +2896,6 @@ msgstr "komplexa värden stöds inte" msgid "compression header" msgstr "komprimeringsheader" -#: py/parse.c -msgid "constant must be an integer" -msgstr "konstant måste vara ett heltal" - #: py/emitnative.c msgid "conversion to object" msgstr "konvertering till objekt" @@ -3236,8 +3237,12 @@ msgid "import * not at module level" msgstr "import * inte på modulnivå" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" -msgstr "inkompatibel nativ .mpy-arkitektur" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" +msgstr "inkompatibel .mpy-fil" #: py/objstr.c msgid "incomplete format" @@ -3265,6 +3270,10 @@ msgstr "index måste vara tuple eller int" msgid "index out of range" msgstr "index utanför intervallet" +#: py/obj.c +msgid "indices must be integers" +msgstr "index måste vara heltal" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "index måste vara heltal, slices, eller Boolean-listor" @@ -3398,10 +3407,6 @@ msgstr "ogiltig element_size %d, måste vara, 1, 2 eller 4" msgid "invalid exception" msgstr "Ogiltig exception" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "ogiltigt format" - #: py/objstr.c msgid "invalid format specifier" msgstr "ogiltig formatspecificerare" @@ -3466,10 +3471,6 @@ msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "" "nyckelordsargument är ännu inte implementerade - använd vanliga argument" -#: py/bc.c -msgid "keywords must be strings" -msgstr "nyckelord måste vara strängar" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "etiketten '%q' har inte definierats" @@ -3694,14 +3695,6 @@ msgstr "icke-standard argument följer standard argument" msgid "non-hex digit found" msgstr "icke-hexnummer hittade" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "icke nyckelord arg efter * / **" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "icke nyckelord arg efter nyckelord arg" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "Icke-noll timeout måste vara > 0.01" @@ -3714,6 +3707,10 @@ msgstr "Icke-noll timeout måste vara >= intervall" msgid "not a 128-bit UUID" msgstr "inte en 128-bitars UUID" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "inte alla argument omvandlade under strängformatering" @@ -3953,6 +3950,14 @@ msgstr "pop från tom %q" msgid "port must be >= 0" msgstr "port måste vara >= 0" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "pow() 3: e argument kan inte vara 0" @@ -3981,6 +3986,11 @@ msgstr "verkliga och imaginära delar måste ha samma längd" msgid "relative import" msgstr "relativ import" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "begärd längd %d men objektet har längden %d" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "resultaten kan inte castas till angiven typ" @@ -4175,6 +4185,10 @@ msgstr "timestamp utom räckvidd för plattformens \"time_t\"" msgid "tobytes can be invoked for dense arrays only" msgstr "tobyte kan enbart anropas för täta matriser" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "för många dimensioner" @@ -4200,6 +4214,10 @@ msgstr "trapz är definierad för 1D-matriser med samma längd" msgid "trapz is defined for 1D iterables" msgstr "trapz är definierat för 1D-iterabla" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "tupel/lista har fel längd" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4419,6 +4437,43 @@ 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 "Corrupt .mpy file" +#~ msgstr "Skadad .mpy-fil" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "Inkompatibel .mpy-fil. Uppdatera alla .mpy-filer. Se http://adafru.it/mpy-" +#~ "update för mer information." + +#~ msgid "can't convert to %q" +#~ msgstr "kan inte konvertera till %q" + +#~ msgid "can't have multiple **x" +#~ msgstr "kan inte ha flera **x" + +#~ msgid "can't have multiple *x" +#~ msgstr "kan inte ha flera *x" + +#~ msgid "constant must be an integer" +#~ msgstr "konstant måste vara ett heltal" + +#~ msgid "incompatible native .mpy architecture" +#~ msgstr "inkompatibel nativ .mpy-arkitektur" + +#~ msgid "invalid format" +#~ msgstr "ogiltigt format" + +#~ msgid "keywords must be strings" +#~ msgstr "nyckelord måste vara strängar" + +#~ msgid "non-keyword arg after */**" +#~ msgstr "icke nyckelord arg efter * / **" + +#~ msgid "non-keyword arg after keyword arg" +#~ msgstr "icke nyckelord arg efter nyckelord arg" + #, c-format #~ msgid "Instruction %d shifts in more bits than pin count" #~ msgstr "Instruktion %d skiftar fler bitar än antalet pinnar" @@ -4766,22 +4821,12 @@ msgstr "zi måste vara i formen (n_section, 2)" #~ msgid "invalid traceback" #~ msgstr "Ogilitig källspårning" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "Indexet %q måste vara ett heltal, inte %s" - #~ msgid "WatchDogTimer.timeout must be greater than 0" #~ msgstr "WatchDogTimer.timeout måste vara större än 0" -#~ msgid "indices must be integers" -#~ msgstr "index måste vara heltal" - #~ msgid "non-Device in %q" #~ msgstr "icke-enhet i %q" -#, c-format -#~ msgid "requested length %d but object has length %d" -#~ msgstr "begärd längd %d men objektet har längden %d" - #~ msgid "single '}' encountered in format string" #~ msgstr "Enkelt '}' påträffades i formatsträngen" @@ -4791,9 +4836,6 @@ msgstr "zi måste vara i formen (n_section, 2)" #~ msgid "timeout must be 0.0-100.0 seconds" #~ msgstr "timeout måste vara 0.0-100.0 sekunder" -#~ msgid "tuple/list has wrong length" -#~ msgstr "tupel/lista har fel längd" - #~ msgid "unmatched '{' in format" #~ msgstr "omatchad '{' i format" @@ -5523,9 +5565,6 @@ msgstr "zi måste vara i formen (n_section, 2)" #~ msgid "Length must be non-negative" #~ msgstr "Length måste vara positiv" -#~ msgid "incompatible .mpy file" -#~ msgstr "inkompatibel .mpy-fil" - #~ msgid "invalid decorator" #~ msgstr "ogiltig dekorator" @@ -5855,9 +5894,6 @@ msgstr "zi måste vara i formen (n_section, 2)" #~ msgid "__init__() should return None, not '%s'" #~ msgstr "__init __ () ska returnera None, inte '%s'" -#~ msgid "can't convert %s to float" -#~ msgstr "kan inte konvertera %s till float" - #~ msgid "can't convert %s to int" #~ msgstr "kan inte konvertera %s till int" @@ -5870,9 +5906,6 @@ msgstr "zi måste vara i formen (n_section, 2)" #~ msgid "can't convert inf to int" #~ msgstr "kan inte konvertera inf till int" -#~ msgid "can't convert to float" -#~ msgstr "kan inte konvertera till float" - #~ msgid "object '%s' is not a tuple or list" #~ msgstr "objektet '%s' är inte en tupel eller lista" diff --git a/locale/tr.po b/locale/tr.po index 2a04dabdcf..e0d4a32179 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -147,6 +147,10 @@ msgstr "%q kullanımda" msgid "%q index out of range" msgstr "%q indeksi aralık dışında" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "%q indeksleri integer olmalı, %s değil" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "%q init başarısız oldu" @@ -222,7 +226,7 @@ msgstr "" msgid "%q must be of type %q or %q, not %q" msgstr "" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "" @@ -426,6 +430,10 @@ msgstr "asenkron fonksiyon içinde 'yield from'" msgid "'yield' outside function" msgstr "fonksiyon dışında 'yield'" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x atama hedefi olmalıdır" @@ -852,10 +860,6 @@ msgstr "" msgid "Coordinate arrays types have different sizes" msgstr "" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "Bozuk .mpy dosyası" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "" @@ -1154,14 +1158,6 @@ msgstr "I2C çevre cihazı kullanımda" msgid "In-buffer elements must be <= 4 bytes long" msgstr "Buffer öğeleri <=4 bayt uzunluğunda olmalı" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"Uyumsuz .mpy dosyası. Lütfen tüm .mpy dosyalarını güncelleyin. Daha fazla " -"bilgi için http://adafru.it/mpy-update ." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "Yanlış buffer size" @@ -1509,7 +1505,7 @@ msgstr "" msgid "No in or out in program" msgstr "" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "" @@ -2520,6 +2516,10 @@ msgstr "" msgid "array/bytes required on right side" msgstr "" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "" @@ -2609,6 +2609,10 @@ msgstr "" msgid "buffer too small for requested bytes" msgstr "" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "" @@ -2654,7 +2658,7 @@ msgstr "" msgid "can't cancel self" msgstr "" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "" @@ -2663,6 +2667,11 @@ msgstr "" msgid "can't convert %s to complex" msgstr "" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "" @@ -2672,11 +2681,11 @@ msgid "can't convert complex to float" msgstr "" #: py/obj.c -msgid "can't convert to %q" +msgid "can't convert to complex" msgstr "" #: py/obj.c -msgid "can't convert to complex" +msgid "can't convert to float" msgstr "" #: py/runtime.c @@ -2703,14 +2712,6 @@ msgstr "" msgid "can't do truncated division of a complex number" msgstr "" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "" @@ -2765,6 +2766,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "" @@ -2861,10 +2866,6 @@ msgstr "" msgid "compression header" msgstr "" -#: py/parse.c -msgid "constant must be an integer" -msgstr "" - #: py/emitnative.c msgid "conversion to object" msgstr "" @@ -3201,7 +3202,11 @@ msgid "import * not at module level" msgstr "" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" msgstr "" #: py/objstr.c @@ -3230,6 +3235,10 @@ msgstr "" msgid "index out of range" msgstr "" +#: py/obj.c +msgid "indices must be integers" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "" @@ -3363,10 +3372,6 @@ msgstr "" msgid "invalid exception" msgstr "" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "" - #: py/objstr.c msgid "invalid format specifier" msgstr "" @@ -3428,10 +3433,6 @@ msgstr "" msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "" -#: py/bc.c -msgid "keywords must be strings" -msgstr "" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "" @@ -3656,14 +3657,6 @@ msgstr "" msgid "non-hex digit found" msgstr "" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "" @@ -3676,6 +3669,10 @@ msgstr "" msgid "not a 128-bit UUID" msgstr "" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "" @@ -3914,6 +3911,14 @@ msgstr "" msgid "port must be >= 0" msgstr "" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "" @@ -3942,6 +3947,11 @@ msgstr "" msgid "relative import" msgstr "" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "" @@ -4136,6 +4146,10 @@ msgstr "" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "" @@ -4161,6 +4175,10 @@ msgstr "" msgid "trapz is defined for 1D iterables" msgstr "" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4380,6 +4398,16 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Corrupt .mpy file" +#~ msgstr "Bozuk .mpy dosyası" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "Uyumsuz .mpy dosyası. Lütfen tüm .mpy dosyalarını güncelleyin. Daha fazla " +#~ "bilgi için http://adafru.it/mpy-update ." + #, c-format #~ msgid "Instruction %d shifts in more bits than pin count" #~ msgstr "Komut %d pin sayısından daha fazla bit içe kaydırıyor" @@ -4505,9 +4533,6 @@ msgstr "" #~ msgid "At most %d %q may be specified (not %d)" #~ msgstr "En az %d %q belirtilmeli (%d değil)" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "%q indeksleri integer olmalı, %s değil" - #~ msgid "%q must be >= 0" #~ msgstr "%q >= 0 olmalıdır" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index c285611635..3ec08ea439 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -154,6 +154,10 @@ msgstr "%q zhèngzài bèi shǐyòng" msgid "%q index out of range" msgstr "%q suǒyǐn chāochū fànwéi" +#: py/obj.c +msgid "%q indices must be integers, not %s" +msgstr "%q suǒyǐn bìxū shì zhěngshù, ér bùshì %s" + #: shared-module/bitbangio/SPI.c msgid "%q init failed" msgstr "%q chūshǐhuà shībài" @@ -230,7 +234,7 @@ msgstr "%q bìxū shì lèixíng wéi 'h' de shùzǔ" msgid "%q must be of type %q or %q, not %q" msgstr "%q de lèi xíng bì xū shì %q huò %q, ér bù shì %q" -#: py/argcheck.c py/obj.c py/objstrunicode.c shared-module/synthio/__init__.c +#: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" msgstr "%q de lèi xíng bì xū shì %q, ér bù shì %q" @@ -433,6 +437,10 @@ msgstr "Yìbù hánshù zhōng cúnzài 'yield from'" msgid "'yield' outside function" msgstr "'yield' wèiyú hánshù zhīwài" +#: py/compile.c +msgid "* arg after **" +msgstr "" + #: py/compile.c msgid "*x must be assignment target" msgstr "*x bìxū shì bèi fùzhí de duìxiàng" @@ -861,10 +869,6 @@ msgstr "zuòbiāo shùzǔ jùyǒu bùtóng de chángdù" msgid "Coordinate arrays types have different sizes" msgstr "zuòbiāo shùzǔ lèixíng jùyǒu bùtóng de dàxiǎo" -#: py/persistentcode.c -msgid "Corrupt .mpy file" -msgstr "sǔnhuài de .mpy wénjiàn" - #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" msgstr "wúfǎ jiǎnsuǒ shízhōng" @@ -1165,14 +1169,6 @@ msgstr "I2C wài shè zhèng zài shǐ yòng zhōng" msgid "In-buffer elements must be <= 4 bytes long" msgstr "huǎn chōng nèi yuán sù bì xū <= 4 zì jié cháng" -#: py/persistentcode.c -msgid "" -"Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/" -"mpy-update for more info." -msgstr "" -"Bù jiānróng.Mpy wénjiàn. Qǐng gēngxīn suǒyǒu.Mpy wénjiàn. Yǒuguān xiángxì " -"xìnxī, qǐng cānyuè http://Adafru.It/mpy-update." - #: shared-bindings/_pew/PewPew.c msgid "Incorrect buffer size" msgstr "Huǎnchōng qū dàxiǎo bù zhèngquè" @@ -1524,7 +1520,7 @@ msgstr "chéng xù zhōng méi yǒu" msgid "No in or out in program" msgstr "chéng xù zhōng méi yǒu jìn chū" -#: shared-bindings/time/__init__.c +#: py/objint.c shared-bindings/time/__init__.c msgid "No long integer support" msgstr "Méiyǒu zhǎng zhěngshù zhīchí" @@ -2552,6 +2548,10 @@ msgstr "zhèn liè tài dà" msgid "array/bytes required on right side" msgstr "yòu cè xūyào shùzǔ/zì jié" +#: py/asmxtensa.c +msgid "asm overflow" +msgstr "" + #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" msgstr "cháng shì huò qǔ (arg) zuì xiǎo zhí /(arg) zuì dà kōng xù liè" @@ -2641,6 +2641,10 @@ msgstr "huǎnchōng qū tài xiǎo" msgid "buffer too small for requested bytes" msgstr "huǎn chōng qū tài xiǎo, duì yú qǐng qiú de zì jié" +#: py/emitbc.c +msgid "bytecode overflow" +msgstr "" + #: py/objarray.c msgid "bytes length not a multiple of item size" msgstr "zì jié chángdù, bùshì xiàngmù dàxiǎo de bèishù" @@ -2686,7 +2690,7 @@ msgstr "bùnéng fēnpèi dào biǎodá shì" msgid "can't cancel self" msgstr "bù néng qǔ xiāo zì wǒ" -#: py/obj.c py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c +#: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" msgstr "Wúfǎ jiāng %q zhuǎnhuàn wèi %q" @@ -2695,6 +2699,11 @@ msgstr "Wúfǎ jiāng %q zhuǎnhuàn wèi %q" msgid "can't convert %s to complex" msgstr "wúfǎ zhuǎnhuàn%s dào fùzá" +#: py/obj.c +#, c-format +msgid "can't convert %s to float" +msgstr "wúfǎ zhuǎnhuàn %s dào fú diǎn xíng biànliàng" + #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" msgstr "wúfǎ jiāng '%q' duìxiàng zhuǎnhuàn wèi %q yǐn hán" @@ -2703,14 +2712,14 @@ msgstr "wúfǎ jiāng '%q' duìxiàng zhuǎnhuàn wèi %q yǐn hán" msgid "can't convert complex to float" msgstr "wú fǎ jiāng fù zá zhuǎn huàn wéi fú dòng" -#: py/obj.c -msgid "can't convert to %q" -msgstr "wúfǎ zhuǎnhuàn wèi %q" - #: py/obj.c msgid "can't convert to complex" msgstr "bùnéng zhuǎnhuàn wèi fùzá" +#: py/obj.c +msgid "can't convert to float" +msgstr "bùnéng zhuǎnhuàn wèi fú diǎn" + #: py/runtime.c msgid "can't convert to int" msgstr "bùnéng zhuǎnhuàn wèi int" @@ -2735,14 +2744,6 @@ msgstr "bùnéng zài '%q' hé '%q' zhī jiān jìnxíng èr yuán yùnsuàn" msgid "can't do truncated division of a complex number" msgstr "bùnéng fēnjiě fùzá de shùzì" -#: py/compile.c -msgid "can't have multiple **x" -msgstr "wúfǎ yǒu duō gè **x" - -#: py/compile.c -msgid "can't have multiple *x" -msgstr "wúfǎ yǒu duō gè *x" - #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" msgstr "bùnéng yǐn hán de jiāng '%q' zhuǎnhuàn wèi 'bool'" @@ -2797,6 +2798,10 @@ msgid "" "can't switch from manual field specification to automatic field numbering" msgstr "wúfǎ cóng shǒudòng zìduàn guīgé qiēhuàn dào zìdòng zìduàn biānhào" +#: extmod/moduasyncio.c +msgid "can't wait" +msgstr "" + #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" msgstr "wú fǎ fēn pèi xīn xíng zhuàng" @@ -2897,10 +2902,6 @@ msgstr "bù zhīchí fùzá de zhí" msgid "compression header" msgstr "yāsuō tóu bù" -#: py/parse.c -msgid "constant must be an integer" -msgstr "chángshù bìxū shì yīgè zhěngshù" - #: py/emitnative.c msgid "conversion to object" msgstr "zhuǎnhuàn wèi duìxiàng" @@ -3241,8 +3242,12 @@ msgid "import * not at module level" msgstr "dǎo rù * bú zài mó kuài jí bié" #: py/persistentcode.c -msgid "incompatible native .mpy architecture" -msgstr "bù jiān róng de yuán shēng .mpy jià gòu" +msgid "incompatible .mpy arch" +msgstr "" + +#: py/persistentcode.c +msgid "incompatible .mpy file" +msgstr "bù jiān róng .mpy wén jiàn" #: py/objstr.c msgid "incomplete format" @@ -3270,6 +3275,10 @@ msgstr "suǒ yǐn bì xū shì yuán zǔ huò zhěng shù" msgid "index out of range" msgstr "suǒyǐn chāochū fànwéi" +#: py/obj.c +msgid "indices must be integers" +msgstr "suǒyǐn bìxū shì zhěngshù" + #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" msgstr "suǒyǐn bìxū shì zhěngshù, qiēpiàn huò bù'ěr zhí lièbiǎo" @@ -3403,10 +3412,6 @@ msgstr "wú xiào element_size %d, bì xū shì, 1, 2, huò 4" msgid "invalid exception" msgstr "wú xiào lì wài" -#: extmod/modframebuf.c -msgid "invalid format" -msgstr "wúxiào géshì" - #: py/objstr.c msgid "invalid format specifier" msgstr "wúxiào de géshì biāozhù" @@ -3469,10 +3474,6 @@ msgstr "" msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "guānjiàn zì cānshù shàngwèi shíxiàn - qǐng shǐyòng chángguī cānshù" -#: py/bc.c -msgid "keywords must be strings" -msgstr "guānjiàn zì bìxū shì zìfú chuàn" - #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" msgstr "biāoqiān '%q' wèi dìngyì" @@ -3697,14 +3698,6 @@ msgstr "bùshì mòrèn cānshù zūnxún mòrèn cānshù" msgid "non-hex digit found" msgstr "zhǎodào fēi shíliù jìn zhì shùzì" -#: py/compile.c -msgid "non-keyword arg after */**" -msgstr "zài */** zhīhòu fēi guānjiàn cí cānshù" - -#: py/compile.c -msgid "non-keyword arg after keyword arg" -msgstr "guānjiàn zì cānshù zhīhòu de fēi guānjiàn zì cānshù" - #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" msgstr "fēi líng chāo shí bì xū > 0.01" @@ -3717,6 +3710,10 @@ msgstr "fēi líng chāo shí bì xū wéi >= jiàn gé" msgid "not a 128-bit UUID" msgstr "bùshì 128 wèi UUID" +#: py/parse.c +msgid "not a constant" +msgstr "" + #: py/objstr.c msgid "not all arguments converted during string formatting" msgstr "bùshì zì chuàn géshì huà guòchéng zhōng zhuǎnhuàn de suǒyǒu cānshù" @@ -3955,6 +3952,14 @@ msgstr "cóng kōng %q dànchū" msgid "port must be >= 0" msgstr "duān kǒu bì xū wéi >= 0" +#: py/compile.c +msgid "positional arg after **" +msgstr "" + +#: py/compile.c +msgid "positional arg after keyword arg" +msgstr "" + #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" msgstr "pow() 3 cān shǔ bùnéng wéi 0" @@ -3983,6 +3988,11 @@ msgstr "shí bù hé xū bù bìxū děng zhǎng" msgid "relative import" msgstr "xiāngduì dǎorù" +#: py/obj.c +#, c-format +msgid "requested length %d but object has length %d" +msgstr "qǐngqiú chángdù %d dàn duìxiàng chángdù %d" + #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" msgstr "wú fǎ jiāng jié guǒ qiáng zhì zhuǎn huàn dào zhǐ dìng lèi xíng" @@ -4180,6 +4190,10 @@ msgstr "time_t shíjiān chuō chāochū píngtái fànwéi" msgid "tobytes can be invoked for dense arrays only" msgstr "tobytes zhǐ néng duì mì jí shù zǔ diào yòng" +#: py/compile.c +msgid "too many args" +msgstr "" + #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" msgstr "chǐ cùn tài duō" @@ -4205,6 +4219,10 @@ msgstr "Trapz shì wèi děng zhǎng de 1D shùzǔ dìngyì de" msgid "trapz is defined for 1D iterables" msgstr "tī xíng dìng yì wéi yì wéi kě dié dài duì xiàng" +#: py/obj.c +msgid "tuple/list has wrong length" +msgstr "yuán zǔ/lièbiǎo chángdù cuòwù" + #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" @@ -4424,6 +4442,43 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Corrupt .mpy file" +#~ msgstr "sǔnhuài de .mpy wénjiàn" + +#~ msgid "" +#~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." +#~ "it/mpy-update for more info." +#~ msgstr "" +#~ "Bù jiānróng.Mpy wénjiàn. Qǐng gēngxīn suǒyǒu.Mpy wénjiàn. Yǒuguān xiángxì " +#~ "xìnxī, qǐng cānyuè http://Adafru.It/mpy-update." + +#~ msgid "can't convert to %q" +#~ msgstr "wúfǎ zhuǎnhuàn wèi %q" + +#~ msgid "can't have multiple **x" +#~ msgstr "wúfǎ yǒu duō gè **x" + +#~ msgid "can't have multiple *x" +#~ msgstr "wúfǎ yǒu duō gè *x" + +#~ msgid "constant must be an integer" +#~ msgstr "chángshù bìxū shì yīgè zhěngshù" + +#~ msgid "incompatible native .mpy architecture" +#~ msgstr "bù jiān róng de yuán shēng .mpy jià gòu" + +#~ msgid "invalid format" +#~ msgstr "wúxiào géshì" + +#~ msgid "keywords must be strings" +#~ msgstr "guānjiàn zì bìxū shì zìfú chuàn" + +#~ msgid "non-keyword arg after */**" +#~ msgstr "zài */** zhīhòu fēi guānjiàn cí cānshù" + +#~ msgid "non-keyword arg after keyword arg" +#~ msgstr "guānjiàn zì cānshù zhīhòu de fēi guānjiàn zì cānshù" + #, c-format #~ msgid "Instruction %d shifts in more bits than pin count" #~ msgstr "zhǐ lìng %d yí wèi chāo guò yǐn jiǎo jì shù" @@ -4771,22 +4826,12 @@ msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" #~ msgid "invalid traceback" #~ msgstr "wú xiào zhuī sù" -#~ msgid "%q indices must be integers, not %s" -#~ msgstr "%q suǒyǐn bìxū shì zhěngshù, ér bùshì %s" - #~ msgid "WatchDogTimer.timeout must be greater than 0" #~ msgstr "WatchDogTimer.Timeout bìxū dàyú 0" -#~ msgid "indices must be integers" -#~ msgstr "suǒyǐn bìxū shì zhěngshù" - #~ msgid "non-Device in %q" #~ msgstr "fēi shè bèi zài %q" -#, c-format -#~ msgid "requested length %d but object has length %d" -#~ msgstr "qǐngqiú chángdù %d dàn duìxiàng chángdù %d" - #~ msgid "single '}' encountered in format string" #~ msgstr "zài géshì zìfú chuàn zhōng yù dào de dāngè '}'" @@ -4796,9 +4841,6 @@ msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" #~ msgid "timeout must be 0.0-100.0 seconds" #~ msgstr "Chāo shí shíjiān bìxū wèi 0.0 Dào 100.0 Miǎo" -#~ msgid "tuple/list has wrong length" -#~ msgstr "yuán zǔ/lièbiǎo chángdù cuòwù" - #~ msgid "unmatched '{' in format" #~ msgstr "géshì wèi pǐpèi '{'" @@ -5506,9 +5548,6 @@ msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" #~ msgid "Length must be non-negative" #~ msgstr "Chángdù bìxū shìfēi fùshù" -#~ msgid "incompatible .mpy file" -#~ msgstr "bù jiān róng .mpy wén jiàn" - #~ msgid "invalid decorator" #~ msgstr "wú xiào zhuāng shì" @@ -5806,9 +5845,6 @@ msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" #~ msgid "__init__() should return None, not '%s'" #~ msgstr "__Init__() yīnggāi fǎnhuí not, ér bùshì '%s'" -#~ msgid "can't convert %s to float" -#~ msgstr "wúfǎ zhuǎnhuàn %s dào fú diǎn xíng biànliàng" - #~ msgid "can't convert %s to int" #~ msgstr "wúfǎ zhuǎnhuàn%s dào int" @@ -5821,9 +5857,6 @@ msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" #~ msgid "can't convert inf to int" #~ msgstr "bùnéng jiāng inf zhuǎnhuàn wèi int" -#~ msgid "can't convert to float" -#~ msgstr "bùnéng zhuǎnhuàn wèi fú diǎn" - #~ msgid "object '%s' is not a tuple or list" #~ msgstr "duìxiàng '%s' bùshì yuán zǔ huò lièbiǎo" From eba1f9d4fed3a1cd160bab9c68c79cda3c5f4bee Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 21 Aug 2023 19:36:28 -0400 Subject: [PATCH 1539/1712] fix framebuffer size for pimoroni dvi base --- ports/raspberrypi/boards/pimoroni_pico_dv_base/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base/board.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base/board.c index bc5878bf24..ee86bb3651 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base/board.c +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base/board.c @@ -33,7 +33,7 @@ void board_init(void) { picodvi_framebuffer_obj_t *fb = &allocate_display_bus()->picodvi; fb->base.type = &picodvi_framebuffer_type; - common_hal_picodvi_framebuffer_construct(fb, 640, 480, + common_hal_picodvi_framebuffer_construct(fb, 320, 240, &pin_GPIO7, &pin_GPIO6, &pin_GPIO9, &pin_GPIO8, &pin_GPIO11, &pin_GPIO10, From d62bf6631b497ec3e6a50f7d56a0ef6ef6266755 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 21 Aug 2023 20:48:17 -0500 Subject: [PATCH 1540/1712] Use a different way to force building sdkconfig early the `Makefile:...` version broke the shared bindings matrix generation, as it would fail if esp-idf wasn't in the environment (and we wouldn't want it to do that much work anyway) --- ports/espressif/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index a335115f0f..ed4b95828b 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -353,7 +353,7 @@ endif # create the config headers .PHONY: do-sdkconfig do-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h -Makefile: $(BUILD)/esp-idf/config/sdkconfig.h +$(BUILD)/genhdr/qstr.i.last: $(BUILD)/esp-idf/config/sdkconfig.h $(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig CMakeLists.txt | $(BUILD)/esp-idf IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA) From 3cd667a0a1a488ae9858f91811e7e72f3f1f1101 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 21 Aug 2023 20:58:12 -0500 Subject: [PATCH 1541/1712] Ensure doc build is tested when a Makefile or .mk file is changed This can affect whether the shared-bindings-matrix works, as in the case of this PR. --- tools/ci_set_matrix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci_set_matrix.py b/tools/ci_set_matrix.py index 7df8199335..e3527bc90d 100755 --- a/tools/ci_set_matrix.py +++ b/tools/ci_set_matrix.py @@ -55,7 +55,7 @@ IGNORE_BOARD = { PATTERN_DOCS = ( r"^(?:\.github|docs|extmod\/ulab)|" r"^(?:(?:ports\/\w+\/bindings|shared-bindings)\S+\.c|tools\/extract_pyi\.py|\.readthedocs\.yml|conf\.py|requirements-doc\.txt)$|" - r"(?:-stubs|\.(?:md|MD|rst|RST))$" + r"(?:-stubs|\.(?:md|MD|mk|rst|RST)|/Makefile)$" ) PATTERN_WINDOWS = { From 2fc413db24bf4ed3513bcfda0b02f11122f28d16 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 21 Aug 2023 21:34:14 -0500 Subject: [PATCH 1542/1712] Use the ".. jinja" tag to render support_matrix template .. and remove the substring check for the file. this fixes the problem with sphinx 7.2.2 that the "docname" can be None (see https://github.com/sphinx-doc/sphinx/issues/11620) --- docs/rstjinja.py | 4 +--- shared-bindings/support_matrix.rst | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/rstjinja.py b/docs/rstjinja.py index 5cac1a5e15..7d5fff5c6c 100644 --- a/docs/rstjinja.py +++ b/docs/rstjinja.py @@ -4,9 +4,7 @@ import re def render_with_jinja(docname, source): - if "shared-bindings/support_matrix" in docname: - return True - if re.search('^\s+.. jinja$', source[0], re.M): + if re.search('^\s*.. jinja$', source[0], re.M): return True return False diff --git a/shared-bindings/support_matrix.rst b/shared-bindings/support_matrix.rst index 3d5e544ea0..e3428ac5bc 100644 --- a/shared-bindings/support_matrix.rst +++ b/shared-bindings/support_matrix.rst @@ -11,6 +11,8 @@ Only those boards that provide those modules will be listed. To exclude boards that provide a module, type a "-" in front of the module name. You can also type a regular expression as a filter. +.. jinja + .. raw:: html

(all)

From 2ec145ba6c7105272b22924c0860ac579fe40a89 Mon Sep 17 00:00:00 2001 From: Jozsef Kiraly Date: Tue, 22 Aug 2023 11:44:52 +0100 Subject: [PATCH 1543/1712] fix: Minor fixes for M5Paper --- .../boards/m5stack_m5paper/mpconfigboard.h | 5 +-- ports/espressif/boards/m5stack_m5paper/pins.c | 37 +++++++++++++------ .../boards/m5stack_m5paper/sdkconfig | 2 +- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/ports/espressif/boards/m5stack_m5paper/mpconfigboard.h b/ports/espressif/boards/m5stack_m5paper/mpconfigboard.h index 012cb58761..f80bf4b550 100644 --- a/ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +++ b/ports/espressif/boards/m5stack_m5paper/mpconfigboard.h @@ -36,9 +36,8 @@ #define CIRCUITPY_BOARD_SPI (1) #define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO14, .mosi = &pin_GPIO12, .miso = &pin_GPIO13}} -// GPIO16 & GPIO17 are used for PSRAM -// #define CIRCUITPY_BOARD_UART (1) -// #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO17, .rx = &pin_GPIO16}} +#define CIRCUITPY_BOARD_UART (1) +#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO19, .rx = &pin_GPIO18}} // For entering safe mode #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO39) diff --git a/ports/espressif/boards/m5stack_m5paper/pins.c b/ports/espressif/boards/m5stack_m5paper/pins.c index 5b7ce7a138..ead95d968f 100644 --- a/ports/espressif/boards/m5stack_m5paper/pins.c +++ b/ports/espressif/boards/m5stack_m5paper/pins.c @@ -1,17 +1,19 @@ #include "shared-bindings/board/__init__.h" #include "shared-module/displayio/__init__.h" +CIRCUITPY_BOARD_BUS_SINGLETON(porta_i2c, i2c, 1) + STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS // Power MAIN - { MP_ROM_QSTR(MP_QSTR_POWER_MAIN),MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_POWER_MAIN), MP_ROM_PTR(&pin_GPIO2) }, // sd card - { MP_ROM_QSTR(MP_QSTR_SD_CS),MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO4) }, - // Power EXT - { MP_ROM_QSTR(MP_QSTR_SD_CS),MP_ROM_PTR(&pin_GPIO5) }, + // Power EXT - Controls 5V rail on Port A, B and C + { MP_ROM_QSTR(MP_QSTR_POWER_EXT), MP_ROM_PTR(&pin_GPIO5) }, // SPI Internal { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO12) }, @@ -21,26 +23,38 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { // IT8951 { MP_ROM_QSTR(MP_QSTR_IT8951_CS), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_IT8951_RESET), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_IT8951_POWER), MP_ROM_PTR(&pin_GPIO23) }, { MP_ROM_QSTR(MP_QSTR_IT8951_BUSY), MP_ROM_PTR(&pin_GPIO27) }, - // Port C + // Port C - UART Mode - External pins { MP_ROM_QSTR(MP_QSTR_PORTC_RX), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_RX2), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_PORTC_TX), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_TX2), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO19) }, // I2C { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) }, - // EPD Power - { MP_ROM_QSTR(MP_QSTR_IT8951_POWER), MP_ROM_PTR(&pin_GPIO23) }, - - // Port A + // Port A - I2C Mode - External pins { MP_ROM_QSTR(MP_QSTR_PORTA_SDA), MP_ROM_PTR(&pin_GPIO25) }, - { MP_ROM_QSTR(MP_QSTR_PORTA_SCL), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) }, - // Port B + { MP_ROM_QSTR(MP_QSTR_PORTA_SCL), MP_ROM_PTR(&pin_GPIO32) }, + { MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32) }, + + // Port B - Generic I/O Mode - External pins { MP_ROM_QSTR(MP_QSTR_PORTB_IN), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_PORTB_OUT), MP_ROM_PTR(&pin_GPIO33) }, + { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, // Battery voltage { MP_ROM_QSTR(MP_QSTR_BATTERY_VOLTAGE), MP_ROM_PTR(&pin_GPIO35) }, @@ -55,6 +69,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_PORTA_I2C), MP_ROM_PTR(&board_porta_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, diff --git a/ports/espressif/boards/m5stack_m5paper/sdkconfig b/ports/espressif/boards/m5stack_m5paper/sdkconfig index d77fe64525..afbee57d19 100644 --- a/ports/espressif/boards/m5stack_m5paper/sdkconfig +++ b/ports/espressif/boards/m5stack_m5paper/sdkconfig @@ -36,7 +36,7 @@ CONFIG_SPIRAM_MEMTEST=y # # LWIP # -CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskCoreFire" +CONFIG_LWIP_LOCAL_HOSTNAME="M5Paper" # end of LWIP # Uncomment (remove ###) to send ESP_LOG output to TX/RX pins From 648ec1c0ed79871d0d8875d14e52eb0e5d0b5b60 Mon Sep 17 00:00:00 2001 From: Jozsef Kiraly Date: Sat, 29 Oct 2022 17:27:21 +0100 Subject: [PATCH 1544/1712] feat: Add support for Waveshare RP2040-Plus --- .../boards/waveshare_rp2040_plus/board.c | 29 ++++++++++ .../waveshare_rp2040_plus/mpconfigboard.h | 2 + .../waveshare_rp2040_plus/mpconfigboard.mk | 11 ++++ .../pico-sdk-configboard.h | 1 + .../boards/waveshare_rp2040_plus/pins.c | 54 +++++++++++++++++++ 5 files changed, 97 insertions(+) create mode 100644 ports/raspberrypi/boards/waveshare_rp2040_plus/board.c create mode 100644 ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/waveshare_rp2040_plus/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/waveshare_rp2040_plus/pins.c diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus/board.c b/ports/raspberrypi/boards/waveshare_rp2040_plus/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.h b/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.h new file mode 100644 index 0000000000..0dbaf070a4 --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.h @@ -0,0 +1,2 @@ +#define MICROPY_HW_BOARD_NAME "Waveshare RP2040-Plus" +#define MICROPY_HW_MCU_NAME "rp2040" diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk b/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk new file mode 100644 index 0000000000..99bcfc51e7 --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x2E8A +USB_PID = 0x101D +USB_PRODUCT = "RP2040-Plus" +USB_MANUFACTURER = "Waveshare Electronics" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q32JVxQ" + +CIRCUITPY__EVE = 1 diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus/pico-sdk-configboard.h b/ports/raspberrypi/boards/waveshare_rp2040_plus/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus/pins.c b/ports/raspberrypi/boards/waveshare_rp2040_plus/pins.c new file mode 100644 index 0000000000..87ff27fa46 --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus/pins.c @@ -0,0 +1,54 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 127f09b28c91d5aa0be785f848ba1bb911931f2a Mon Sep 17 00:00:00 2001 From: Jozsef Kiraly Date: Sat, 29 Oct 2022 19:17:06 +0100 Subject: [PATCH 1545/1712] Update ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk --- ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk b/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk index 99bcfc51e7..9cf2a724be 100644 --- a/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x2E8A -USB_PID = 0x101D +USB_PID = 0x0005 USB_PRODUCT = "RP2040-Plus" USB_MANUFACTURER = "Waveshare Electronics" From 9a140dc3ee7a0659a3f717a770cb4fd904d5bdba Mon Sep 17 00:00:00 2001 From: Jozsef Kiraly Date: Wed, 11 Jan 2023 12:21:15 +0000 Subject: [PATCH 1546/1712] Update ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk Co-authored-by: Scott Shawcroft --- ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk b/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk index 9cf2a724be..2b0647dca4 100644 --- a/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x2E8A -USB_PID = 0x0005 +USB_PID = 0x1020 USB_PRODUCT = "RP2040-Plus" USB_MANUFACTURER = "Waveshare Electronics" From bb1b827f55173a813d2e001d75cf4ea3971b56cb Mon Sep 17 00:00:00 2001 From: Jozsef Kiraly Date: Tue, 22 Aug 2023 15:06:37 +0100 Subject: [PATCH 1547/1712] fix: Split 16M and 4M variants --- .../waveshare_rp2040_plus/mpconfigboard.h | 2 - .../board.c | 0 .../mpconfigboard.h | 2 + .../mpconfigboard.mk | 11 ++++ .../pico-sdk-configboard.h | 0 .../pins.c | 0 .../boards/waveshare_rp2040_plus_4mb/board.c | 29 ++++++++++ .../waveshare_rp2040_plus_4mb/mpconfigboard.h | 2 + .../mpconfigboard.mk | 2 +- .../pico-sdk-configboard.h | 1 + .../boards/waveshare_rp2040_plus_4mb/pins.c | 54 +++++++++++++++++++ 11 files changed, 100 insertions(+), 3 deletions(-) delete mode 100644 ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.h rename ports/raspberrypi/boards/{waveshare_rp2040_plus => waveshare_rp2040_plus_16mb}/board.c (100%) create mode 100644 ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/mpconfigboard.mk rename ports/raspberrypi/boards/{waveshare_rp2040_plus => waveshare_rp2040_plus_16mb}/pico-sdk-configboard.h (100%) rename ports/raspberrypi/boards/{waveshare_rp2040_plus => waveshare_rp2040_plus_16mb}/pins.c (100%) create mode 100644 ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/board.c create mode 100644 ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/mpconfigboard.h rename ports/raspberrypi/boards/{waveshare_rp2040_plus => waveshare_rp2040_plus_4mb}/mpconfigboard.mk (83%) create mode 100644 ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/pins.c diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.h b/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.h deleted file mode 100644 index 0dbaf070a4..0000000000 --- a/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.h +++ /dev/null @@ -1,2 +0,0 @@ -#define MICROPY_HW_BOARD_NAME "Waveshare RP2040-Plus" -#define MICROPY_HW_MCU_NAME "rp2040" diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus/board.c b/ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/board.c similarity index 100% rename from ports/raspberrypi/boards/waveshare_rp2040_plus/board.c rename to ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/board.c diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/mpconfigboard.h b/ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/mpconfigboard.h new file mode 100644 index 0000000000..1dd18e30eb --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/mpconfigboard.h @@ -0,0 +1,2 @@ +#define MICROPY_HW_BOARD_NAME "Waveshare RP2040-Plus (16MB)" +#define MICROPY_HW_MCU_NAME "rp2040" diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/mpconfigboard.mk b/ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/mpconfigboard.mk new file mode 100644 index 0000000000..b4f84bf09b --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x2E8A +USB_PID = 0x1020 +USB_PRODUCT = "RP2040-Plus (16MB)" +USB_MANUFACTURER = "Waveshare Electronics" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q128JVxQ" + +CIRCUITPY__EVE = 1 diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus/pico-sdk-configboard.h b/ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/pico-sdk-configboard.h similarity index 100% rename from ports/raspberrypi/boards/waveshare_rp2040_plus/pico-sdk-configboard.h rename to ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/pico-sdk-configboard.h diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus/pins.c b/ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/pins.c similarity index 100% rename from ports/raspberrypi/boards/waveshare_rp2040_plus/pins.c rename to ports/raspberrypi/boards/waveshare_rp2040_plus_16mb/pins.c diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/board.c b/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/board.c new file mode 100644 index 0000000000..331653173e --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/mpconfigboard.h b/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/mpconfigboard.h new file mode 100644 index 0000000000..3cf1f16066 --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/mpconfigboard.h @@ -0,0 +1,2 @@ +#define MICROPY_HW_BOARD_NAME "Waveshare RP2040-Plus (4MB)" +#define MICROPY_HW_MCU_NAME "rp2040" diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk b/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/mpconfigboard.mk similarity index 83% rename from ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk rename to ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/mpconfigboard.mk index 2b0647dca4..78b729ef58 100644 --- a/ports/raspberrypi/boards/waveshare_rp2040_plus/mpconfigboard.mk +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/mpconfigboard.mk @@ -1,6 +1,6 @@ USB_VID = 0x2E8A USB_PID = 0x1020 -USB_PRODUCT = "RP2040-Plus" +USB_PRODUCT = "RP2040-Plus (4MB)" USB_MANUFACTURER = "Waveshare Electronics" CHIP_VARIANT = RP2040 diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/pico-sdk-configboard.h b/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/pico-sdk-configboard.h new file mode 100644 index 0000000000..36da55d457 --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/pico-sdk-configboard.h @@ -0,0 +1 @@ +// Put board-specific pico-sdk definitions here. This file must exist. diff --git a/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/pins.c b/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/pins.c new file mode 100644 index 0000000000..87ff27fa46 --- /dev/null +++ b/ports/raspberrypi/boards/waveshare_rp2040_plus_4mb/pins.c @@ -0,0 +1,54 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_GP23), MP_ROM_PTR(&pin_GPIO23) }, + + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_GP24), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO25) }, + { MP_ROM_QSTR(MP_QSTR_GP25), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 4f7e66df08cb011272422c131ff1d922c0c0c810 Mon Sep 17 00:00:00 2001 From: Jozsef Kiraly Date: Tue, 22 Aug 2023 15:17:40 +0100 Subject: [PATCH 1548/1712] fix: pre-commit --- ports/espressif/boards/m5stack_m5paper/pins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/m5stack_m5paper/pins.c b/ports/espressif/boards/m5stack_m5paper/pins.c index ead95d968f..ca5f18baac 100644 --- a/ports/espressif/boards/m5stack_m5paper/pins.c +++ b/ports/espressif/boards/m5stack_m5paper/pins.c @@ -52,7 +52,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { // Port B - Generic I/O Mode - External pins { MP_ROM_QSTR(MP_QSTR_PORTB_IN), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) }, - + { MP_ROM_QSTR(MP_QSTR_PORTB_OUT), MP_ROM_PTR(&pin_GPIO33) }, { MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) }, From 485924896edc917dbfbf60313a1796388bf046ee Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 22 Aug 2023 10:30:57 -0500 Subject: [PATCH 1549/1712] RGBMatrix: document constructor arguments Closes: #8283 --- shared-bindings/rgbmatrix/RGBMatrix.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 0f5cc91fc7..9166241a24 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -186,7 +186,22 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ //| flicker during updates. //| //| A RGBMatrix is often used in conjunction with a -//| `framebufferio.FramebufferDisplay`.""" +//| `framebufferio.FramebufferDisplay`. +//| +//| :param int width: The overall width of the display in pixels +//| :param int height: The overall height of all displays in pixels +//| :param int tile: In a multi-row display, the number of rows of panels +//| :param int bit_depth: The color depth of the display. A value of 1 gives 8 colors, a value of 2 gives 64 colors, and so on. Increasing bit depth increases the CPU and RAM usage of the RGBMatrix, and may lower the panel refresh rate. The framebuffer is always in RGB565 format regardless of the bit depth setting +//| :param bool serpentine: In a multi-row display, True when alternate rows are rotated 180°, which can reduce wiring length +//| :param Sequence[digitalio.DigitalInOut] rgb_pins: The display's "RGB pins" +//| :param Sequence[digitalio.DigitalInOut] addr_pins: The display's "address pins" +//| :param digitalio.DigitalInOut clock_pin: The display's "clock pin" +//| :param digitalio.DigitalInOut latch_pin: The display's "latch pin" +//| :param digitalio.DigitalInOut output_enable_pin: The display's "output enable" pin +//| :param bool doublebuffer: True if the output is double-buffered +//| :param Optional[WriteableBuffer] framebuffer: A pre-allocated framebuffer to use. If unspecified, a framebuffer is allocated +//| +//| """ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_width, ARG_bit_depth, ARG_rgb_list, ARG_addr_list, From 81ad2e05bae637c99546b7940b72e2c500dfa622 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 22 Aug 2023 10:44:35 -0500 Subject: [PATCH 1550/1712] address review comments --- shared-bindings/rgbmatrix/RGBMatrix.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 9166241a24..0aa7e581b0 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -188,16 +188,16 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ //| A RGBMatrix is often used in conjunction with a //| `framebufferio.FramebufferDisplay`. //| -//| :param int width: The overall width of the display in pixels -//| :param int height: The overall height of all displays in pixels -//| :param int tile: In a multi-row display, the number of rows of panels -//| :param int bit_depth: The color depth of the display. A value of 1 gives 8 colors, a value of 2 gives 64 colors, and so on. Increasing bit depth increases the CPU and RAM usage of the RGBMatrix, and may lower the panel refresh rate. The framebuffer is always in RGB565 format regardless of the bit depth setting -//| :param bool serpentine: In a multi-row display, True when alternate rows are rotated 180°, which can reduce wiring length -//| :param Sequence[digitalio.DigitalInOut] rgb_pins: The display's "RGB pins" -//| :param Sequence[digitalio.DigitalInOut] addr_pins: The display's "address pins" -//| :param digitalio.DigitalInOut clock_pin: The display's "clock pin" -//| :param digitalio.DigitalInOut latch_pin: The display's "latch pin" -//| :param digitalio.DigitalInOut output_enable_pin: The display's "output enable" pin +//| :param int width: The overall width of the whole matrix in pixels +//| :param int height: The overall height of the whole matrix in pixels +//| :param int tile: In a multi-row matrix, the number of rows of panels +//| :param int bit_depth: The color depth of the matrix. A value of 1 gives 8 colors, a value of 2 gives 64 colors, and so on. Increasing bit depth increases the CPU and RAM usage of the RGBMatrix, and may lower the panel refresh rate. The framebuffer is always in RGB565 format regardless of the bit depth setting +//| :param bool serpentine: In a multi-row matrix, True when alternate rows of panels are rotated 180°, which can reduce wiring length +//| :param Sequence[digitalio.DigitalInOut] rgb_pins: The matrix's RGB pins +//| :param Sequence[digitalio.DigitalInOut] addr_pins: The matrix's address pins +//| :param digitalio.DigitalInOut clock_pin: The matrix's clock pin +//| :param digitalio.DigitalInOut latch_pin: The matrix's latch pin +//| :param digitalio.DigitalInOut output_enable_pin: The matrix's output enable pin //| :param bool doublebuffer: True if the output is double-buffered //| :param Optional[WriteableBuffer] framebuffer: A pre-allocated framebuffer to use. If unspecified, a framebuffer is allocated //| From 2dcc0d2a62c20ad7684e53db6b9d5c8b832e2511 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 22 Aug 2023 10:46:34 -0500 Subject: [PATCH 1551/1712] further explain width and height, it can't hurt --- shared-bindings/rgbmatrix/RGBMatrix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 0aa7e581b0..4b044eac5a 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -188,8 +188,8 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ //| A RGBMatrix is often used in conjunction with a //| `framebufferio.FramebufferDisplay`. //| -//| :param int width: The overall width of the whole matrix in pixels -//| :param int height: The overall height of the whole matrix in pixels +//| :param int width: The overall width of the whole matrix in pixels. For a matrix with multiple panels in row, this is the width of a single panel times the number of panels across. +//| :param int height: The overall height of the whole matrix in pixels. For a matrix with multiple rows of panels, this is the height of a single panel times the number of panels down. //| :param int tile: In a multi-row matrix, the number of rows of panels //| :param int bit_depth: The color depth of the matrix. A value of 1 gives 8 colors, a value of 2 gives 64 colors, and so on. Increasing bit depth increases the CPU and RAM usage of the RGBMatrix, and may lower the panel refresh rate. The framebuffer is always in RGB565 format regardless of the bit depth setting //| :param bool serpentine: In a multi-row matrix, True when alternate rows of panels are rotated 180°, which can reduce wiring length From e336dc90cf15ef61b235e3d6ad4fc435e6c61320 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 22 Aug 2023 10:53:10 -0500 Subject: [PATCH 1552/1712] update explanation of height; it is optional --- shared-bindings/rgbmatrix/RGBMatrix.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/shared-bindings/rgbmatrix/RGBMatrix.c b/shared-bindings/rgbmatrix/RGBMatrix.c index 4b044eac5a..c68798e352 100644 --- a/shared-bindings/rgbmatrix/RGBMatrix.c +++ b/shared-bindings/rgbmatrix/RGBMatrix.c @@ -189,7 +189,6 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ //| `framebufferio.FramebufferDisplay`. //| //| :param int width: The overall width of the whole matrix in pixels. For a matrix with multiple panels in row, this is the width of a single panel times the number of panels across. -//| :param int height: The overall height of the whole matrix in pixels. For a matrix with multiple rows of panels, this is the height of a single panel times the number of panels down. //| :param int tile: In a multi-row matrix, the number of rows of panels //| :param int bit_depth: The color depth of the matrix. A value of 1 gives 8 colors, a value of 2 gives 64 colors, and so on. Increasing bit depth increases the CPU and RAM usage of the RGBMatrix, and may lower the panel refresh rate. The framebuffer is always in RGB565 format regardless of the bit depth setting //| :param bool serpentine: In a multi-row matrix, True when alternate rows of panels are rotated 180°, which can reduce wiring length @@ -200,7 +199,7 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_ //| :param digitalio.DigitalInOut output_enable_pin: The matrix's output enable pin //| :param bool doublebuffer: True if the output is double-buffered //| :param Optional[WriteableBuffer] framebuffer: A pre-allocated framebuffer to use. If unspecified, a framebuffer is allocated -//| +//| :param int height: The optional overall height of the whole matrix in pixels. This value is not required because it can be calculated as described above. //| """ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { From c1dce99be97aa8a12d8e12f3a9d634e660e555c7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 22 Aug 2023 10:55:55 -0500 Subject: [PATCH 1553/1712] Link to dedicated guide for rgbmatrix --- shared-bindings/rgbmatrix/__init__.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/shared-bindings/rgbmatrix/__init__.c b/shared-bindings/rgbmatrix/__init__.c index 1e9099adb6..62fb4abd59 100644 --- a/shared-bindings/rgbmatrix/__init__.c +++ b/shared-bindings/rgbmatrix/__init__.c @@ -31,7 +31,11 @@ #include "shared-bindings/rgbmatrix/RGBMatrix.h" -//| """Low-level routines for bitbanged LED matrices""" +//| """Low-level routines for bitbanged LED matrices +//| +//| For more information about working with RGB matrix panels in CircuitPython, see +//| `the dedicated learn guide `_. +//| """ STATIC const mp_rom_map_elem_t rgbmatrix_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_rgbmatrix) }, From 88c22d5052407d5e00a946748ef798c76ad1e0ce Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 22 Aug 2023 11:15:46 -0400 Subject: [PATCH 1554/1712] remove last uses of 'u' prefix --- extmod/moduasyncio.c | 2 +- extmod/modubinascii.c | 2 +- extmod/moduhashlib.c | 2 +- extmod/moduheapq.c | 2 +- extmod/modujson.c | 2 +- extmod/moduos.c | 2 +- extmod/moduplatform.c | 2 +- extmod/modurandom.c | 2 +- extmod/modure.c | 2 +- extmod/modutimeq.c | 239 ------------------ extmod/moduzlib.c | 2 +- ports/unix/coverage.c | 6 +- ports/unix/modtime.c | 2 +- ports/unix/moduselect.c | 2 +- py/modio.c | 2 +- py/modsys.c | 2 +- py/moduerrno.c | 4 - py/py.mk | 1 - tests/basics/array1.py | 9 +- tests/basics/array_add.py | 9 +- tests/basics/array_micropython.py | 9 +- tests/basics/bytes_add_array.py | 9 +- tests/basics/bytes_add_endian.py | 9 +- tests/basics/bytes_compare_array.py | 9 +- tests/basics/dict_fixed.py | 22 +- tests/basics/errno1.py | 14 +- tests/basics/io_buffered_writer.py | 2 +- tests/basics/io_bytesio_cow.py | 5 +- tests/basics/io_bytesio_ext.py | 5 +- tests/basics/io_bytesio_ext2.py | 5 +- tests/basics/io_iobase.py | 5 +- tests/basics/io_stringio1.py | 5 +- tests/basics/io_stringio_with.py | 5 +- tests/basics/io_write_ext.py | 6 +- tests/basics/memoryview1.py | 9 +- tests/basics/memoryview_slice_assign.py | 9 +- tests/basics/struct1.py | 11 +- tests/basics/struct1_intbig.py | 11 +- tests/basics/struct2.py | 11 +- tests/basics/struct_endian.py | 11 +- tests/basics/struct_overflow.py | 11 +- tests/basics/sys_path.py | 5 +- tests/basics/sys_tracebacklimit.py | 8 +- tests/basics/sys_tracebacklimit.py.exp | 30 +-- .../bitmaptools/_bmp16.py | 5 +- tests/circuitpython/getenv.py | 12 +- tests/circuitpython/zlib_decompress.py | 7 +- tests/cmdline/repl_micropyinspect | 4 +- tests/cmdline/repl_sys_ps1_ps2.py | 6 +- tests/cmdline/repl_sys_ps1_ps2.py.exp | 6 +- tests/extmod/btree1.py | 89 ------- tests/extmod/btree1.py.exp | 40 --- tests/extmod/btree_error.py | 42 --- tests/extmod/btree_error.py.exp | 6 - tests/extmod/btree_gc.py | 26 -- tests/extmod/btree_gc.py.exp | 80 ------ tests/extmod/framebuf1.py | 111 -------- tests/extmod/framebuf1.py.exp | 68 ----- tests/extmod/framebuf16.py | 66 ----- tests/extmod/framebuf16.py.exp | 57 ----- tests/extmod/framebuf2.py | 64 ----- tests/extmod/framebuf2.py.exp | 57 ----- tests/extmod/framebuf4.py | 55 ---- tests/extmod/framebuf4.py.exp | 112 -------- tests/extmod/framebuf8.py | 34 --- tests/extmod/framebuf8.py.exp | 15 -- tests/extmod/framebuf_palette.py | 35 --- tests/extmod/framebuf_palette.py.exp | 5 - tests/extmod/framebuf_subclass.py | 51 ---- tests/extmod/framebuf_subclass.py.exp | 4 - tests/extmod/ticks_diff.py | 2 +- tests/extmod/time_ms_us.py | 28 +- tests/extmod/uasyncio_await_return.py | 9 +- tests/extmod/uasyncio_basic.py | 15 +- tests/extmod/uasyncio_basic2.py | 9 +- tests/extmod/uasyncio_cancel_fair.py | 9 +- tests/extmod/uasyncio_cancel_fair2.py | 9 +- tests/extmod/uasyncio_cancel_self.py | 9 +- tests/extmod/uasyncio_cancel_task.py | 9 +- .../uasyncio_cancel_wait_on_finished.py | 9 +- tests/extmod/uasyncio_current_task.py | 9 +- tests/extmod/uasyncio_event.py | 9 +- tests/extmod/uasyncio_event_fair.py | 9 +- tests/extmod/uasyncio_exception.py | 9 +- tests/extmod/uasyncio_fair.py | 9 +- tests/extmod/uasyncio_gather.py | 11 +- tests/extmod/uasyncio_gather_notimpl.py | 11 +- tests/extmod/uasyncio_get_event_loop.py | 9 +- tests/extmod/uasyncio_heaplock.py | 11 +- tests/extmod/uasyncio_lock.py | 9 +- tests/extmod/uasyncio_lock_cancel.py | 9 +- tests/extmod/uasyncio_loop_stop.py | 9 +- tests/extmod/uasyncio_micropython.py | 18 +- tests/extmod/uasyncio_new_event_loop.py | 9 +- .../extmod/uasyncio_set_exception_handler.py | 9 +- tests/extmod/uasyncio_task_done.py | 9 +- tests/extmod/uasyncio_task_exception.py | 9 +- tests/extmod/uasyncio_threadsafeflag.py | 5 +- tests/extmod/uasyncio_wait_for.py | 9 +- tests/extmod/uasyncio_wait_for_fwd.py | 9 +- tests/extmod/uasyncio_wait_task.py | 15 +- tests/extmod/ubinascii_a2b_base64.py | 5 +- tests/extmod/ubinascii_b2a_base64.py | 5 +- tests/extmod/ubinascii_crc32.py | 5 +- tests/extmod/ubinascii_hexlify.py | 5 +- tests/extmod/ubinascii_micropython.py | 5 +- tests/extmod/ubinascii_unhexlify.py | 5 +- tests/extmod/ucryptolib_aes128_cbc.py | 16 -- tests/extmod/ucryptolib_aes128_cbc.py.exp | 2 - tests/extmod/ucryptolib_aes128_ctr.py | 28 -- tests/extmod/ucryptolib_aes128_ctr.py.exp | 3 - tests/extmod/ucryptolib_aes128_ecb.py | 16 -- tests/extmod/ucryptolib_aes128_ecb.py.exp | 2 - tests/extmod/ucryptolib_aes128_ecb_enc.py | 17 -- tests/extmod/ucryptolib_aes128_ecb_enc.py.exp | 1 - tests/extmod/ucryptolib_aes128_ecb_inpl.py | 15 -- .../extmod/ucryptolib_aes128_ecb_inpl.py.exp | 2 - tests/extmod/ucryptolib_aes128_ecb_into.py | 16 -- .../extmod/ucryptolib_aes128_ecb_into.py.exp | 2 - tests/extmod/ucryptolib_aes256_cbc.py | 16 -- tests/extmod/ucryptolib_aes256_cbc.py.exp | 2 - tests/extmod/ucryptolib_aes256_ecb.py | 16 -- tests/extmod/ucryptolib_aes256_ecb.py.exp | 2 - tests/extmod/uctypes_sizeof_od.py | 2 +- tests/extmod/uhashlib_final.py | 4 +- tests/extmod/uhashlib_md5.py | 13 +- tests/extmod/uhashlib_sha1.py | 13 +- tests/extmod/uhashlib_sha256.py | 13 +- tests/extmod/uheapq1.py | 11 +- tests/extmod/ujson_dump.py | 14 +- tests/extmod/ujson_dump_iobase.py | 12 +- tests/extmod/ujson_dump_separators.py | 14 +- tests/extmod/ujson_dumps.py | 9 +- tests/extmod/ujson_dumps_extra.py | 6 +- tests/extmod/ujson_dumps_float.py | 9 +- tests/extmod/ujson_dumps_ordereddict.py | 12 +- tests/extmod/ujson_dumps_separators.py | 9 +- tests/extmod/ujson_load.py | 14 +- tests/extmod/ujson_load_readinto.py | 2 +- tests/extmod/ujson_loads.py | 9 +- tests/extmod/ujson_loads_bytes.py | 9 +- tests/extmod/ujson_loads_float.py | 9 +- tests/extmod/umsgpack_pack.py | 14 +- tests/extmod/urandom_basic.py | 2 +- tests/extmod/urandom_extra.py | 9 +- tests/extmod/urandom_extra_float.py | 9 +- tests/extmod/urandom_seed_default.py | 9 +- tests/extmod/ure1.py | 9 +- tests/extmod/ure_debug.py | 6 +- tests/extmod/ure_error.py | 9 +- tests/extmod/ure_group.py | 9 +- tests/extmod/ure_groups.py | 9 +- tests/extmod/ure_limit.py | 4 +- tests/extmod/ure_namedclass.py | 9 +- tests/extmod/ure_span.py | 9 +- tests/extmod/ure_split.py | 9 +- tests/extmod/ure_split_empty.py | 6 +- tests/extmod/ure_split_notimpl.py | 2 +- tests/extmod/ure_stack_overflow.py | 9 +- tests/extmod/ure_sub.py | 11 +- tests/extmod/ure_sub_unmatched.py | 9 +- tests/extmod/uselect_poll_basic.py | 42 --- tests/extmod/uselect_poll_udp.py | 30 --- tests/extmod/usocket_tcp_basic.py | 17 -- tests/extmod/usocket_udp_nonblock.py | 20 -- tests/extmod/ussl_basic.py | 60 ----- tests/extmod/ussl_basic.py.exp | 7 - tests/extmod/ussl_keycert.py | 28 -- tests/extmod/ussl_keycert.py.exp | 3 - tests/extmod/utime_res.py | 16 +- tests/extmod/utime_time_ns.py | 14 +- tests/extmod/utimeq1.py | 146 ----------- tests/extmod/utimeq1.py.exp | 1 - tests/extmod/utimeq_stable.py | 22 -- tests/extmod/utimeq_stable.py.exp | 1 - tests/extmod/uzlib_decompio.py | 10 +- tests/extmod/uzlib_decompio_gz.py | 10 +- tests/extmod/uzlib_decompress.py | 7 +- tests/extmod/vfs_basic.py | 104 ++++---- tests/extmod/vfs_blockdev.py | 10 +- tests/extmod/vfs_fat_case.py | 22 +- tests/extmod/vfs_fat_fileio1.py | 24 +- tests/extmod/vfs_fat_fileio2.py | 28 +- tests/extmod/vfs_fat_finaliser.py | 8 +- tests/extmod/vfs_fat_more.py | 86 +++---- tests/extmod/vfs_fat_mtime.py | 14 +- tests/extmod/vfs_fat_oldproto.py | 12 +- tests/extmod/vfs_fat_ramdisk.py | 22 +- tests/extmod/vfs_fat_ramdisklarge.py | 12 +- tests/extmod/vfs_lfs.py | 12 +- tests/extmod/vfs_lfs_corrupt.py | 10 +- tests/extmod/vfs_lfs_error.py | 10 +- tests/extmod/vfs_lfs_file.py | 10 +- tests/extmod/vfs_lfs_mount.py | 32 +-- tests/extmod/vfs_lfs_mtime.py | 20 +- tests/extmod/vfs_lfs_superblock.py | 12 +- tests/extmod/vfs_posix.py | 40 +-- tests/extmod/vfs_userfs.py | 16 +- .../{uio_module.py => io_module.py} | 4 +- .../{uio_module.py.exp => io_module.py.exp} | 0 tests/float/float2int_doubleprec_intbig.py | 5 +- tests/float/float2int_fp30_intbig.py | 5 +- tests/float/float2int_intbig.py | 5 +- tests/float/float_struct.py | 5 +- tests/inlineasm/asmsum.py | 2 +- tests/io/open_append.py | 5 +- tests/io/open_plus.py | 5 +- tests/micropython/emg_exc.py | 2 +- tests/micropython/heapalloc_bytesio2.py | 4 +- tests/micropython/heapalloc_iter.py | 9 +- tests/micropython/import_mpy_invalid.py | 12 +- tests/micropython/import_mpy_native.py | 12 +- tests/micropython/import_mpy_native_gc.py | 12 +- tests/micropython/opt_level.py | 2 +- tests/perf_bench/bm_hexiom.py | 5 +- tests/perf_bench/core_import_mpy_multi.py | 10 +- tests/perf_bench/core_import_mpy_single.py | 10 +- tests/run-natmodtests.py | 10 +- tests/run-tests-exp.py | 2 +- tests/run-tests.py | 6 +- tests/stress/recursive_data.py | 2 +- tests/thread/stress_aes.py | 5 +- tests/thread/stress_heap.py | 5 +- tests/thread/thread_exit1.py | 5 +- tests/thread/thread_exit2.py | 5 +- tests/thread/thread_lock2.py | 5 +- tests/thread/thread_lock4.py | 5 +- tests/thread/thread_qstr1.py | 5 +- tests/thread/thread_start1.py | 5 +- tests/thread/thread_start2.py | 5 +- tests/unix/extra_coverage.py | 10 +- tests/unix/extra_coverage.py.exp | 30 +-- tests/unix/time.py | 5 +- 233 files changed, 739 insertions(+), 2839 deletions(-) delete mode 100644 extmod/modutimeq.c delete mode 100644 tests/extmod/btree1.py delete mode 100644 tests/extmod/btree1.py.exp delete mode 100644 tests/extmod/btree_error.py delete mode 100644 tests/extmod/btree_error.py.exp delete mode 100644 tests/extmod/btree_gc.py delete mode 100644 tests/extmod/btree_gc.py.exp delete mode 100644 tests/extmod/framebuf1.py delete mode 100644 tests/extmod/framebuf1.py.exp delete mode 100644 tests/extmod/framebuf16.py delete mode 100644 tests/extmod/framebuf16.py.exp delete mode 100644 tests/extmod/framebuf2.py delete mode 100644 tests/extmod/framebuf2.py.exp delete mode 100644 tests/extmod/framebuf4.py delete mode 100644 tests/extmod/framebuf4.py.exp delete mode 100644 tests/extmod/framebuf8.py delete mode 100644 tests/extmod/framebuf8.py.exp delete mode 100644 tests/extmod/framebuf_palette.py delete mode 100644 tests/extmod/framebuf_palette.py.exp delete mode 100644 tests/extmod/framebuf_subclass.py delete mode 100644 tests/extmod/framebuf_subclass.py.exp delete mode 100644 tests/extmod/ucryptolib_aes128_cbc.py delete mode 100644 tests/extmod/ucryptolib_aes128_cbc.py.exp delete mode 100644 tests/extmod/ucryptolib_aes128_ctr.py delete mode 100644 tests/extmod/ucryptolib_aes128_ctr.py.exp delete mode 100644 tests/extmod/ucryptolib_aes128_ecb.py delete mode 100644 tests/extmod/ucryptolib_aes128_ecb.py.exp delete mode 100644 tests/extmod/ucryptolib_aes128_ecb_enc.py delete mode 100644 tests/extmod/ucryptolib_aes128_ecb_enc.py.exp delete mode 100644 tests/extmod/ucryptolib_aes128_ecb_inpl.py delete mode 100644 tests/extmod/ucryptolib_aes128_ecb_inpl.py.exp delete mode 100644 tests/extmod/ucryptolib_aes128_ecb_into.py delete mode 100644 tests/extmod/ucryptolib_aes128_ecb_into.py.exp delete mode 100644 tests/extmod/ucryptolib_aes256_cbc.py delete mode 100644 tests/extmod/ucryptolib_aes256_cbc.py.exp delete mode 100644 tests/extmod/ucryptolib_aes256_ecb.py delete mode 100644 tests/extmod/ucryptolib_aes256_ecb.py.exp delete mode 100644 tests/extmod/uselect_poll_basic.py delete mode 100644 tests/extmod/uselect_poll_udp.py delete mode 100644 tests/extmod/usocket_tcp_basic.py delete mode 100644 tests/extmod/usocket_udp_nonblock.py delete mode 100644 tests/extmod/ussl_basic.py delete mode 100644 tests/extmod/ussl_basic.py.exp delete mode 100644 tests/extmod/ussl_keycert.py delete mode 100644 tests/extmod/ussl_keycert.py.exp delete mode 100644 tests/extmod/utimeq1.py delete mode 100644 tests/extmod/utimeq1.py.exp delete mode 100644 tests/extmod/utimeq_stable.py delete mode 100644 tests/extmod/utimeq_stable.py.exp rename tests/feature_check/{uio_module.py => io_module.py} (56%) rename tests/feature_check/{uio_module.py.exp => io_module.py.exp} (100%) diff --git a/extmod/moduasyncio.c b/extmod/moduasyncio.c index 2ba8efb1fe..4bd612d37b 100644 --- a/extmod/moduasyncio.c +++ b/extmod/moduasyncio.c @@ -357,6 +357,6 @@ const mp_obj_module_t mp_module_uasyncio = { .globals = (mp_obj_dict_t *)&mp_module_uasyncio_globals, }; -MP_REGISTER_MODULE(MP_QSTR__uasyncio, mp_module_uasyncio); +MP_REGISTER_MODULE(MP_QSTR__asyncio, mp_module_uasyncio); #endif // MICROPY_PY_UASYNCIO diff --git a/extmod/modubinascii.c b/extmod/modubinascii.c index d95f6f5554..6346b23e62 100644 --- a/extmod/modubinascii.c +++ b/extmod/modubinascii.c @@ -330,6 +330,6 @@ const mp_obj_module_t mp_module_ubinascii = { .globals = (mp_obj_dict_t *)&mp_module_binascii_globals, }; -MP_REGISTER_MODULE(MP_QSTR_ubinascii, mp_module_ubinascii); +MP_REGISTER_MODULE(MP_QSTR_binascii, mp_module_ubinascii); #endif // MICROPY_PY_UBINASCII diff --git a/extmod/moduhashlib.c b/extmod/moduhashlib.c index 11f8d1e03d..64100bb499 100644 --- a/extmod/moduhashlib.c +++ b/extmod/moduhashlib.c @@ -382,6 +382,6 @@ const mp_obj_module_t mp_module_uhashlib = { .globals = (mp_obj_dict_t *)&mp_module_uhashlib_globals, }; -MP_REGISTER_MODULE(MP_QSTR_uhashlib, mp_module_uhashlib); +MP_REGISTER_MODULE(MP_QSTR_hashlib, mp_module_uhashlib); #endif // MICROPY_PY_UHASHLIB diff --git a/extmod/moduheapq.c b/extmod/moduheapq.c index f48d9bceb1..c102e830ff 100644 --- a/extmod/moduheapq.c +++ b/extmod/moduheapq.c @@ -120,7 +120,7 @@ const mp_obj_module_t mp_module_uheapq = { .globals = (mp_obj_dict_t *)&mp_module_uheapq_globals, }; -MP_REGISTER_MODULE(MP_QSTR_uheapq, mp_module_uheapq); +MP_REGISTER_MODULE(MP_QSTR_heapq, mp_module_uheapq); #endif #endif // MICROPY_PY_UHEAPQ diff --git a/extmod/modujson.c b/extmod/modujson.c index 14e45e2cc1..26241fa230 100644 --- a/extmod/modujson.c +++ b/extmod/modujson.c @@ -458,6 +458,6 @@ const mp_obj_module_t mp_module_ujson = { .globals = (mp_obj_dict_t *)&mp_module_ujson_globals, }; -MP_REGISTER_MODULE(MP_QSTR_ujson, mp_module_ujson); +MP_REGISTER_MODULE(MP_QSTR_json, mp_module_ujson); #endif // MICROPY_PY_UJSON diff --git a/extmod/moduos.c b/extmod/moduos.c index a1752deb4a..4cbdf72627 100644 --- a/extmod/moduos.c +++ b/extmod/moduos.c @@ -181,6 +181,6 @@ const mp_obj_module_t mp_module_uos = { .globals = (mp_obj_dict_t *)&os_module_globals, }; -MP_REGISTER_MODULE(MP_QSTR_uos, mp_module_uos); +MP_REGISTER_MODULE(MP_QSTR_os, mp_module_uos); #endif // MICROPY_PY_UOS diff --git a/extmod/moduplatform.c b/extmod/moduplatform.c index 1b35b08aa7..3590943bb1 100644 --- a/extmod/moduplatform.c +++ b/extmod/moduplatform.c @@ -75,6 +75,6 @@ const mp_obj_module_t mp_module_uplatform = { .globals = (mp_obj_dict_t *)&modplatform_globals, }; -MP_REGISTER_MODULE(MP_QSTR_uplatform, mp_module_uplatform); +MP_REGISTER_MODULE(MP_QSTR_platform, mp_module_uplatform); #endif // MICROPY_PY_UPLATFORM diff --git a/extmod/modurandom.c b/extmod/modurandom.c index b661627190..68ebed32d3 100644 --- a/extmod/modurandom.c +++ b/extmod/modurandom.c @@ -255,7 +255,7 @@ const mp_obj_module_t mp_module_urandom = { .globals = (mp_obj_dict_t *)&mp_module_urandom_globals, }; -MP_REGISTER_MODULE(MP_QSTR_urandom, mp_module_urandom); +MP_REGISTER_MODULE(MP_QSTR_random, mp_module_urandom); #endif #endif // MICROPY_PY_URANDOM diff --git a/extmod/modure.c b/extmod/modure.c index 805c23d4ad..7ad6ccabce 100644 --- a/extmod/modure.c +++ b/extmod/modure.c @@ -491,7 +491,7 @@ const mp_obj_module_t mp_module_ure = { .globals = (mp_obj_dict_t *)&mp_module_re_globals, }; -MP_REGISTER_MODULE(MP_QSTR_ure, mp_module_ure); +MP_REGISTER_MODULE(MP_QSTR_re, mp_module_ure); #endif // Source files #include'd here to make sure they're compiled in diff --git a/extmod/modutimeq.c b/extmod/modutimeq.c deleted file mode 100644 index 7cabfee4be..0000000000 --- a/extmod/modutimeq.c +++ /dev/null @@ -1,239 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2014 Damien P. George - * Copyright (c) 2016-2017 Paul Sokolovsky - * - * 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/objlist.h" -#include "py/runtime.h" -#include "py/smallint.h" - -#include "supervisor/shared/translate/translate.h" - -#if MICROPY_PY_UTIMEQ - -#define MODULO MICROPY_PY_UTIME_TICKS_PERIOD - -#define DEBUG 0 - -// the algorithm here is modelled on CPython's heapq.py - -struct qentry { - mp_uint_t time; - mp_uint_t id; - mp_obj_t callback; - mp_obj_t args; -}; - -typedef struct _mp_obj_utimeq_t { - mp_obj_base_t base; - mp_uint_t alloc; - mp_uint_t len; - struct qentry items[]; -} mp_obj_utimeq_t; - -STATIC mp_uint_t utimeq_id; - -STATIC mp_obj_utimeq_t *utimeq_get_heap(mp_obj_t heap_in) { - return MP_OBJ_TO_PTR(heap_in); -} - -STATIC bool time_less_than(struct qentry *item, struct qentry *parent) { - mp_uint_t item_tm = item->time; - mp_uint_t parent_tm = parent->time; - mp_uint_t res = parent_tm - item_tm; - if (res == 0) { - // TODO: This actually should use the same "ring" logic - // as for time, to avoid artifacts when id's overflow. - return item->id < parent->id; - } - if ((mp_int_t)res < 0) { - res += MODULO; - } - return res && res < (MODULO / 2); -} - -STATIC mp_obj_t utimeq_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) { - mp_arg_check_num(n_args, n_kw, 1, 1, false); - mp_uint_t alloc = mp_obj_get_int(args[0]); - mp_obj_utimeq_t *o = mp_obj_malloc_var(mp_obj_utimeq_t, struct qentry, alloc, type); - memset(o->items, 0, sizeof(*o->items) * alloc); - o->alloc = alloc; - o->len = 0; - return MP_OBJ_FROM_PTR(o); -} - -STATIC void utimeq_heap_siftdown(mp_obj_utimeq_t *heap, mp_uint_t start_pos, mp_uint_t pos) { - struct qentry item = heap->items[pos]; - while (pos > start_pos) { - mp_uint_t parent_pos = (pos - 1) >> 1; - struct qentry *parent = &heap->items[parent_pos]; - bool lessthan = time_less_than(&item, parent); - if (lessthan) { - heap->items[pos] = *parent; - pos = parent_pos; - } else { - break; - } - } - heap->items[pos] = item; -} - -STATIC void utimeq_heap_siftup(mp_obj_utimeq_t *heap, mp_uint_t pos) { - mp_uint_t start_pos = pos; - mp_uint_t end_pos = heap->len; - struct qentry item = heap->items[pos]; - for (mp_uint_t child_pos = 2 * pos + 1; child_pos < end_pos; child_pos = 2 * pos + 1) { - // choose right child if it's <= left child - if (child_pos + 1 < end_pos) { - bool lessthan = time_less_than(&heap->items[child_pos], &heap->items[child_pos + 1]); - if (!lessthan) { - child_pos += 1; - } - } - // bubble up the smaller child - heap->items[pos] = heap->items[child_pos]; - pos = child_pos; - } - heap->items[pos] = item; - utimeq_heap_siftdown(heap, start_pos, pos); -} - -STATIC mp_obj_t mod_utimeq_heappush(size_t n_args, const mp_obj_t *args) { - (void)n_args; - mp_obj_t heap_in = args[0]; - mp_obj_utimeq_t *heap = utimeq_get_heap(heap_in); - if (heap->len == heap->alloc) { - mp_raise_IndexError(MP_ERROR_TEXT("queue overflow")); - } - mp_uint_t l = heap->len; - heap->items[l].time = MP_OBJ_SMALL_INT_VALUE(args[1]); - heap->items[l].id = utimeq_id++; - heap->items[l].callback = args[2]; - heap->items[l].args = args[3]; - utimeq_heap_siftdown(heap, 0, heap->len); - heap->len++; - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_utimeq_heappush_obj, 4, 4, mod_utimeq_heappush); - -STATIC mp_obj_t mod_utimeq_heappop(mp_obj_t heap_in, mp_obj_t list_ref) { - mp_obj_utimeq_t *heap = utimeq_get_heap(heap_in); - if (heap->len == 0) { - mp_raise_IndexError(MP_ERROR_TEXT("empty heap")); - } - mp_obj_list_t *ret = MP_OBJ_TO_PTR(list_ref); - if (!mp_obj_is_type(list_ref, &mp_type_list) || ret->len < 3) { - mp_raise_TypeError(NULL); - } - - struct qentry *item = &heap->items[0]; - ret->items[0] = MP_OBJ_NEW_SMALL_INT(item->time); - ret->items[1] = item->callback; - ret->items[2] = item->args; - heap->len -= 1; - heap->items[0] = heap->items[heap->len]; - heap->items[heap->len].callback = MP_OBJ_NULL; // so we don't retain a pointer - heap->items[heap->len].args = MP_OBJ_NULL; - if (heap->len) { - utimeq_heap_siftup(heap, 0); - } - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_utimeq_heappop_obj, mod_utimeq_heappop); - -STATIC mp_obj_t mod_utimeq_peektime(mp_obj_t heap_in) { - mp_obj_utimeq_t *heap = utimeq_get_heap(heap_in); - if (heap->len == 0) { - mp_raise_IndexError(MP_ERROR_TEXT("empty heap")); - } - - struct qentry *item = &heap->items[0]; - return MP_OBJ_NEW_SMALL_INT(item->time); -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_utimeq_peektime_obj, mod_utimeq_peektime); - -#if DEBUG -STATIC mp_obj_t mod_utimeq_dump(mp_obj_t heap_in) { - mp_obj_utimeq_t *heap = utimeq_get_heap(heap_in); - for (int i = 0; i < heap->len; i++) { - printf(UINT_FMT "\t%p\t%p\n", heap->items[i].time, - MP_OBJ_TO_PTR(heap->items[i].callback), MP_OBJ_TO_PTR(heap->items[i].args)); - } - return mp_const_none; -} -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_utimeq_dump_obj, mod_utimeq_dump); -#endif - -STATIC mp_obj_t utimeq_unary_op(mp_unary_op_t op, mp_obj_t self_in) { - mp_obj_utimeq_t *self = MP_OBJ_TO_PTR(self_in); - switch (op) { - case MP_UNARY_OP_BOOL: - return mp_obj_new_bool(self->len != 0); - case MP_UNARY_OP_LEN: - return MP_OBJ_NEW_SMALL_INT(self->len); - default: - return MP_OBJ_NULL; // op not supported - } -} - -STATIC const mp_rom_map_elem_t utimeq_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_push), MP_ROM_PTR(&mod_utimeq_heappush_obj) }, - { MP_ROM_QSTR(MP_QSTR_pop), MP_ROM_PTR(&mod_utimeq_heappop_obj) }, - { MP_ROM_QSTR(MP_QSTR_peektime), MP_ROM_PTR(&mod_utimeq_peektime_obj) }, - #if DEBUG - { MP_ROM_QSTR(MP_QSTR_dump), MP_ROM_PTR(&mod_utimeq_dump_obj) }, - #endif -}; - -STATIC MP_DEFINE_CONST_DICT(utimeq_locals_dict, utimeq_locals_dict_table); - -STATIC const mp_obj_type_t utimeq_type = { - { &mp_type_type }, - .flags = MP_TYPE_FLAG_EXTENDED, - .name = MP_QSTR_utimeq, - .make_new = utimeq_make_new, - .locals_dict = (void *)&utimeq_locals_dict, - MP_TYPE_EXTENDED_FIELDS( - .unary_op = utimeq_unary_op, - ), -}; - -STATIC const mp_rom_map_elem_t mp_module_utimeq_globals_table[] = { - { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_utimeq) }, - { MP_ROM_QSTR(MP_QSTR_utimeq), MP_ROM_PTR(&utimeq_type) }, -}; - -STATIC MP_DEFINE_CONST_DICT(mp_module_utimeq_globals, mp_module_utimeq_globals_table); - -const mp_obj_module_t mp_module_utimeq = { - .base = { &mp_type_module }, - .globals = (mp_obj_dict_t *)&mp_module_utimeq_globals, -}; - -MP_REGISTER_MODULE(MP_QSTR_utimeq, mp_module_utimeq); - -#endif // MICROPY_PY_UTIMEQ diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c index 5c16ea732c..b2f5b5af33 100644 --- a/extmod/moduzlib.c +++ b/extmod/moduzlib.c @@ -230,7 +230,7 @@ const mp_obj_module_t mp_module_uzlib = { }; -MP_REGISTER_MODULE(MP_QSTR_uzlib, mp_module_uzlib); +MP_REGISTER_MODULE(MP_QSTR_zlib, mp_module_uzlib); #endif // Source files #include'd here to make sure they're compiled in diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c index d2f730a602..058abab5ce 100644 --- a/ports/unix/coverage.c +++ b/ports/unix/coverage.c @@ -326,12 +326,12 @@ STATIC mp_obj_t extra_coverage(void) { size_t len = mp_repl_autocomplete("__n", 3, &mp_plat_print, &str); mp_printf(&mp_plat_print, "%.*s\n", (int)len, str); - len = mp_repl_autocomplete("i", 1, &mp_plat_print, &str); + len = mp_repl_autocomplete("im", 2, &mp_plat_print, &str); mp_printf(&mp_plat_print, "%.*s\n", (int)len, str); mp_repl_autocomplete("import ", 7, &mp_plat_print, &str); - len = mp_repl_autocomplete("import ut", 9, &mp_plat_print, &str); + len = mp_repl_autocomplete("import ti", 9, &mp_plat_print, &str); mp_printf(&mp_plat_print, "%.*s\n", (int)len, str); - mp_repl_autocomplete("import utime", 12, &mp_plat_print, &str); + mp_repl_autocomplete("import ra", 9, &mp_plat_print, &str); mp_store_global(MP_QSTR_sys, mp_import_name(MP_QSTR_sys, mp_const_none, MP_OBJ_NEW_SMALL_INT(0))); mp_repl_autocomplete("sys.", 4, &mp_plat_print, &str); diff --git a/ports/unix/modtime.c b/ports/unix/modtime.c index c9eb09c15b..cec8baa8cd 100644 --- a/ports/unix/modtime.c +++ b/ports/unix/modtime.c @@ -232,6 +232,6 @@ const mp_obj_module_t mp_module_time = { .globals = (mp_obj_dict_t *)&mp_module_time_globals, }; -MP_REGISTER_MODULE(MP_QSTR_utime, mp_module_time); +MP_REGISTER_MODULE(MP_QSTR_time, mp_module_time); #endif // MICROPY_PY_UTIME diff --git a/ports/unix/moduselect.c b/ports/unix/moduselect.c index 7bfcf8fc56..8295f3d8b5 100644 --- a/ports/unix/moduselect.c +++ b/ports/unix/moduselect.c @@ -354,6 +354,6 @@ const mp_obj_module_t mp_module_uselect = { .globals = (mp_obj_dict_t *)&mp_module_select_globals, }; -MP_REGISTER_MODULE(MP_QSTR_uselect, mp_module_uselect); +MP_REGISTER_MODULE(MP_QSTR_select, mp_module_uselect); #endif // MICROPY_PY_USELECT_POSIX diff --git a/py/modio.c b/py/modio.c index 836d04fb11..985903ffe7 100644 --- a/py/modio.c +++ b/py/modio.c @@ -245,6 +245,6 @@ const mp_obj_module_t mp_module_io = { .globals = (mp_obj_dict_t *)&mp_module_io_globals, }; -MP_REGISTER_MODULE(MP_QSTR_uio, mp_module_io); +MP_REGISTER_MODULE(MP_QSTR_io, mp_module_io); #endif diff --git a/py/modsys.c b/py/modsys.c index 63fb654f05..68d254641a 100644 --- a/py/modsys.c +++ b/py/modsys.c @@ -282,6 +282,6 @@ const mp_obj_module_t mp_module_sys = { .globals = (mp_obj_dict_t *)&mp_module_sys_globals, }; -MP_REGISTER_MODULE(MP_QSTR_usys, mp_module_sys); +MP_REGISTER_MODULE(MP_QSTR_sys, mp_module_sys); #endif diff --git a/py/moduerrno.c b/py/moduerrno.c index cf3cbe064f..a132474e4c 100644 --- a/py/moduerrno.c +++ b/py/moduerrno.c @@ -105,11 +105,7 @@ const mp_obj_module_t mp_module_uerrno = { .globals = (mp_obj_dict_t *)&mp_module_uerrno_globals, }; -#if defined(MICROPY_UNIX_COVERAGE) -MP_REGISTER_MODULE(MP_QSTR_uerrno, mp_module_uerrno); -#else MP_REGISTER_MODULE(MP_QSTR_errno, mp_module_uerrno); -#endif qstr mp_errno_to_str(mp_obj_t errno_val) { // Otherwise, return the Exxxx string for that error code diff --git a/py/py.mk b/py/py.mk index 81da81ba0f..d26b8752a4 100644 --- a/py/py.mk +++ b/py/py.mk @@ -195,7 +195,6 @@ PY_EXTMOD_O_BASENAME = \ extmod/modure.o \ extmod/moduzlib.o \ extmod/moduheapq.o \ - extmod/modutimeq.o \ extmod/moduhashlib.o \ extmod/modubinascii.o \ extmod/modurandom.o \ diff --git a/tests/basics/array1.py b/tests/basics/array1.py index f21ad4bd75..5c5d13a581 100644 --- a/tests/basics/array1.py +++ b/tests/basics/array1.py @@ -1,11 +1,8 @@ try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit a = array.array('B', [1, 2, 3]) print(a, len(a)) diff --git a/tests/basics/array_add.py b/tests/basics/array_add.py index 8335eb6b82..76ce59f761 100644 --- a/tests/basics/array_add.py +++ b/tests/basics/array_add.py @@ -1,12 +1,9 @@ # test array + array try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit a1 = array.array('I', [1]) a2 = array.array('I', [2]) diff --git a/tests/basics/array_micropython.py b/tests/basics/array_micropython.py index 44dc1d83d8..771a7d709c 100644 --- a/tests/basics/array_micropython.py +++ b/tests/basics/array_micropython.py @@ -1,12 +1,9 @@ # test MicroPython-specific features of array.array try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # arrays of objects a = array.array('O') diff --git a/tests/basics/bytes_add_array.py b/tests/basics/bytes_add_array.py index c6382bed74..b17556d83c 100644 --- a/tests/basics/bytes_add_array.py +++ b/tests/basics/bytes_add_array.py @@ -1,12 +1,9 @@ # test bytes + other try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # should be byteorder-neutral print(b"123" + array.array('h', [0x1515])) diff --git a/tests/basics/bytes_add_endian.py b/tests/basics/bytes_add_endian.py index 40b3de7d61..8cfffa7b6a 100644 --- a/tests/basics/bytes_add_endian.py +++ b/tests/basics/bytes_add_endian.py @@ -1,11 +1,8 @@ # test bytes + other try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(b"123" + array.array('i', [1])) diff --git a/tests/basics/bytes_compare_array.py b/tests/basics/bytes_compare_array.py index 6bad50b55a..ad378de70c 100644 --- a/tests/basics/bytes_compare_array.py +++ b/tests/basics/bytes_compare_array.py @@ -1,11 +1,8 @@ try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(array.array('b', [1, 2]) in b'\x01\x02\x03') # CPython gives False here diff --git a/tests/basics/dict_fixed.py b/tests/basics/dict_fixed.py index 4261a06557..cfd3b71f57 100644 --- a/tests/basics/dict_fixed.py +++ b/tests/basics/dict_fixed.py @@ -1,48 +1,48 @@ # test that fixed dictionaries cannot be modified try: - import uerrno + import errno except ImportError: print("SKIP") raise SystemExit -# Save a copy of uerrno.errorcode, so we can check later +# Save a copy of errno.errorcode, so we can check later # that it hasn't been modified. -errorcode_copy = uerrno.errorcode.copy() +errorcode_copy = errno.errorcode.copy() try: - uerrno.errorcode.popitem() + errno.errorcode.popitem() except TypeError: print("TypeError") try: - uerrno.errorcode.pop(0) + errno.errorcode.pop(0) except TypeError: print("TypeError") try: - uerrno.errorcode.setdefault(0, 0) + errno.errorcode.setdefault(0, 0) except TypeError: print("TypeError") try: - uerrno.errorcode.update([(1, 2)]) + errno.errorcode.update([(1, 2)]) except TypeError: print("TypeError") try: - del uerrno.errorcode[1] + del errno.errorcode[1] except TypeError: print("TypeError") try: - uerrno.errorcode[1] = 'foo' + errno.errorcode[1] = 'foo' except TypeError: print("TypeError") try: - uerrno.errorcode.clear() + errno.errorcode.clear() except TypeError: print("TypeError") -assert uerrno.errorcode == errorcode_copy +assert errno.errorcode == errorcode_copy diff --git a/tests/basics/errno1.py b/tests/basics/errno1.py index d9a895a972..0773c926fd 100644 --- a/tests/basics/errno1.py +++ b/tests/basics/errno1.py @@ -1,25 +1,25 @@ -# test errno's and uerrno module +# test errno's and errno module try: - import uerrno + import errno except ImportError: print("SKIP") raise SystemExit # check that constants exist and are integers -print(type(uerrno.EIO)) +print(type(errno.EIO)) # check that errors are rendered in a nice way -msg = str(OSError(uerrno.EIO)) +msg = str(OSError(errno.EIO)) print(msg[:7], msg[-5:]) -msg = str(OSError(uerrno.EIO, "details")) +msg = str(OSError(errno.EIO, "details")) print(msg[:7], msg[-14:]) -msg = str(OSError(uerrno.EIO, "details", "more details")) +msg = str(OSError(errno.EIO, "details", "more details")) print(msg[:1], msg[-28:]) # check that unknown errno is still rendered print(str(OSError(9999))) # this tests a failed constant lookup in errno -errno = uerrno +errno = errno print(errno.__name__) diff --git a/tests/basics/io_buffered_writer.py b/tests/basics/io_buffered_writer.py index 64e5fa1ee7..b3bab54900 100644 --- a/tests/basics/io_buffered_writer.py +++ b/tests/basics/io_buffered_writer.py @@ -1,4 +1,4 @@ -import uio as io +import io try: io.BytesIO diff --git a/tests/basics/io_bytesio_cow.py b/tests/basics/io_bytesio_cow.py index 92654a0003..543dd484ab 100644 --- a/tests/basics/io_bytesio_cow.py +++ b/tests/basics/io_bytesio_cow.py @@ -1,9 +1,6 @@ # Make sure that write operations on io.BytesIO don't # change original object it was constructed from. -try: - import uio as io -except ImportError: - import io +import io b = b"foobar" diff --git a/tests/basics/io_bytesio_ext.py b/tests/basics/io_bytesio_ext.py index e454b2fd9f..eee20baf3b 100644 --- a/tests/basics/io_bytesio_ext.py +++ b/tests/basics/io_bytesio_ext.py @@ -1,8 +1,5 @@ # Extended stream operations on io.BytesIO -try: - import uio as io -except ImportError: - import io +import io a = io.BytesIO(b"foobar") a.seek(10) diff --git a/tests/basics/io_bytesio_ext2.py b/tests/basics/io_bytesio_ext2.py index 8f624fd58c..5bede33f58 100644 --- a/tests/basics/io_bytesio_ext2.py +++ b/tests/basics/io_bytesio_ext2.py @@ -1,7 +1,4 @@ -try: - import uio as io -except ImportError: - import io +import io a = io.BytesIO(b"foobar") try: diff --git a/tests/basics/io_iobase.py b/tests/basics/io_iobase.py index 667e629858..6d27fe1e74 100644 --- a/tests/basics/io_iobase.py +++ b/tests/basics/io_iobase.py @@ -1,7 +1,4 @@ -try: - import uio as io -except: - import io +import io try: io.IOBase diff --git a/tests/basics/io_stringio1.py b/tests/basics/io_stringio1.py index c4ac9ec076..2174db00cd 100644 --- a/tests/basics/io_stringio1.py +++ b/tests/basics/io_stringio1.py @@ -1,7 +1,4 @@ -try: - import uio as io -except ImportError: - import io +import io a = io.StringIO() print("io.StringIO" in repr(a)) diff --git a/tests/basics/io_stringio_with.py b/tests/basics/io_stringio_with.py index c35975445d..b30395672c 100644 --- a/tests/basics/io_stringio_with.py +++ b/tests/basics/io_stringio_with.py @@ -1,7 +1,4 @@ -try: - import uio as io -except ImportError: - import io +import io # test __enter__/__exit__ with io.StringIO() as b: diff --git a/tests/basics/io_write_ext.py b/tests/basics/io_write_ext.py index 18cd75ddb6..79f7450954 100644 --- a/tests/basics/io_write_ext.py +++ b/tests/basics/io_write_ext.py @@ -1,14 +1,14 @@ # This tests extended (MicroPython-specific) form of write: # write(buf, len) and write(buf, offset, len) -import uio +import io try: - uio.BytesIO + io.BytesIO except AttributeError: print("SKIP") raise SystemExit -buf = uio.BytesIO() +buf = io.BytesIO() buf.write(b"foo", 2) print(buf.getvalue()) diff --git a/tests/basics/memoryview1.py b/tests/basics/memoryview1.py index 4c20c91f49..1ebfbc53b9 100644 --- a/tests/basics/memoryview1.py +++ b/tests/basics/memoryview1.py @@ -5,13 +5,10 @@ except: print("SKIP") raise SystemExit try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # test reading from bytes b = b'1234' diff --git a/tests/basics/memoryview_slice_assign.py b/tests/basics/memoryview_slice_assign.py index 74f6fae6f7..94f8073f0a 100644 --- a/tests/basics/memoryview_slice_assign.py +++ b/tests/basics/memoryview_slice_assign.py @@ -7,13 +7,10 @@ except (NameError, TypeError): raise SystemExit try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # test slice assignment between memoryviews b1 = bytearray(b'1234') diff --git a/tests/basics/struct1.py b/tests/basics/struct1.py index 2ac900bbc7..f6c521d6ce 100644 --- a/tests/basics/struct1.py +++ b/tests/basics/struct1.py @@ -1,11 +1,8 @@ try: - import ustruct as struct -except: - try: - import struct - except ImportError: - print("SKIP") - raise SystemExit + import struct +except ImportError: + print("SKIP") + raise SystemExit print(struct.calcsize(">> # test changing ps1/ps2 ->>> import usys ->>> usys.ps1 = "PS1" -PS1usys.ps2 = "PS2" +>>> import sys +>>> sys.ps1 = "PS1" +PS1sys.ps2 = "PS2" PS1(1 + PS22) 3 diff --git a/tests/extmod/btree1.py b/tests/extmod/btree1.py deleted file mode 100644 index 1f4853eaa3..0000000000 --- a/tests/extmod/btree1.py +++ /dev/null @@ -1,89 +0,0 @@ -try: - import btree - import uio - import uerrno -except ImportError: - print("SKIP") - raise SystemExit - -# f = open("_test.db", "w+b") -f = uio.BytesIO() -db = btree.open(f, pagesize=512) - -db[b"foo3"] = b"bar3" -db[b"foo1"] = b"bar1" -db[b"foo2"] = b"bar2" -db[b"bar1"] = b"foo1" - -dbstr = str(db) -print(dbstr[:7], dbstr[-1:]) - -print(db[b"foo2"]) -try: - print(db[b"foo"]) -except KeyError: - print("KeyError") -print(db.get(b"foo")) -print(db.get(b"foo", b"dflt")) - -del db[b"foo2"] -try: - del db[b"foo"] -except KeyError: - print("KeyError") - -for k, v in db.items(): - print((k, v)) - -print("---") -for k, v in db.items(None, None): - print((k, v)) - -print("---") -for k, v in db.items(b"f"): - print((k, v)) - -print("---") -for k, v in db.items(b"f", b"foo3"): - print((k, v)) - -print("---") -for k, v in db.items(None, b"foo3"): - print((k, v)) - -print("---") -for k, v in db.items(b"f", b"foo3", btree.INCL): - print((k, v)) - -print("---") -for k, v in db.items(None, None, btree.DESC): - print((k, v)) - -print(db.seq(1, b"foo1")) -print(db.seq(1, b"qux")) - -try: - db.seq(b"foo1") -except OSError as e: - print(e.errno == uerrno.EINVAL) - -print(list(db.keys())) -print(list(db.values())) - -for k in db: - print(k) - -db.put(b"baz1", b"qux1") - -print("foo1", "foo1" in db) -print("foo2", "foo2" in db) -print("baz1", "baz1" in db) - -try: - print(db + db[b"foo1"]) -except TypeError: - print("TypeError") - -db.flush() -db.close() -f.close() diff --git a/tests/extmod/btree1.py.exp b/tests/extmod/btree1.py.exp deleted file mode 100644 index a467252300..0000000000 --- a/tests/extmod/btree1.py.exp +++ /dev/null @@ -1,40 +0,0 @@ - -b'bar2' -KeyError -None -b'dflt' -KeyError -(b'bar1', b'foo1') -(b'foo1', b'bar1') -(b'foo3', b'bar3') ---- -(b'bar1', b'foo1') -(b'foo1', b'bar1') -(b'foo3', b'bar3') ---- -(b'foo1', b'bar1') -(b'foo3', b'bar3') ---- -(b'foo1', b'bar1') ---- -(b'bar1', b'foo1') -(b'foo1', b'bar1') ---- -(b'foo1', b'bar1') -(b'foo3', b'bar3') ---- -(b'foo3', b'bar3') -(b'foo1', b'bar1') -(b'bar1', b'foo1') -(b'foo1', b'bar1') -None -True -[b'bar1', b'foo1', b'foo3'] -[b'foo1', b'bar1', b'bar3'] -b'bar1' -b'foo1' -b'foo3' -foo1 True -foo2 False -baz1 True -TypeError diff --git a/tests/extmod/btree_error.py b/tests/extmod/btree_error.py deleted file mode 100644 index b64769e884..0000000000 --- a/tests/extmod/btree_error.py +++ /dev/null @@ -1,42 +0,0 @@ -# Test that errno's propagate correctly through btree module. - -try: - import btree, uio, uerrno - - uio.IOBase -except (ImportError, AttributeError): - print("SKIP") - raise SystemExit - - -class Device(uio.IOBase): - def __init__(self, read_ret=0, ioctl_ret=0): - self.read_ret = read_ret - self.ioctl_ret = ioctl_ret - - def readinto(self, buf): - print("read", len(buf)) - return self.read_ret - - def ioctl(self, cmd, arg): - print("ioctl", cmd) - return self.ioctl_ret - - -# Invalid pagesize; errno comes from btree library -try: - db = btree.open(Device(), pagesize=511) -except OSError as er: - print("OSError", er.errno == uerrno.EINVAL) - -# Valid pagesize, device returns error on read; errno comes from Device.readinto -try: - db = btree.open(Device(-1000), pagesize=512) -except OSError as er: - print(repr(er)) - -# Valid pagesize, device returns error on seek; errno comes from Device.ioctl -try: - db = btree.open(Device(0, -1001), pagesize=512) -except OSError as er: - print(repr(er)) diff --git a/tests/extmod/btree_error.py.exp b/tests/extmod/btree_error.py.exp deleted file mode 100644 index 168adb80c5..0000000000 --- a/tests/extmod/btree_error.py.exp +++ /dev/null @@ -1,6 +0,0 @@ -OSError True -read 24 -OSError(1000,) -read 24 -ioctl 2 -OSError(1001,) diff --git a/tests/extmod/btree_gc.py b/tests/extmod/btree_gc.py deleted file mode 100644 index 1845aa0640..0000000000 --- a/tests/extmod/btree_gc.py +++ /dev/null @@ -1,26 +0,0 @@ -# Test btree interaction with the garbage collector. - -try: - import btree, uio, gc -except ImportError: - print("SKIP") - raise SystemExit - -N = 80 - -# Create a BytesIO but don't keep a reference to it. -db = btree.open(uio.BytesIO(), pagesize=512) - -# Overwrite lots of the Python stack to make sure no reference to the BytesIO remains. -x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] - -# Write lots of key/value pairs, which fill up the DB and also allocate temporary heap -# memory due to the string addition, and do a GC collect to verify that the BytesIO -# is not collected. -for i in range(N): - db[b"thekey" + str(i)] = b"thelongvalue" + str(i) - print(db[b"thekey" + str(i)]) - gc.collect() - -# Reclaim memory allocated by the db object. -db.close() diff --git a/tests/extmod/btree_gc.py.exp b/tests/extmod/btree_gc.py.exp deleted file mode 100644 index e7b8d56729..0000000000 --- a/tests/extmod/btree_gc.py.exp +++ /dev/null @@ -1,80 +0,0 @@ -b'thelongvalue0' -b'thelongvalue1' -b'thelongvalue2' -b'thelongvalue3' -b'thelongvalue4' -b'thelongvalue5' -b'thelongvalue6' -b'thelongvalue7' -b'thelongvalue8' -b'thelongvalue9' -b'thelongvalue10' -b'thelongvalue11' -b'thelongvalue12' -b'thelongvalue13' -b'thelongvalue14' -b'thelongvalue15' -b'thelongvalue16' -b'thelongvalue17' -b'thelongvalue18' -b'thelongvalue19' -b'thelongvalue20' -b'thelongvalue21' -b'thelongvalue22' -b'thelongvalue23' -b'thelongvalue24' -b'thelongvalue25' -b'thelongvalue26' -b'thelongvalue27' -b'thelongvalue28' -b'thelongvalue29' -b'thelongvalue30' -b'thelongvalue31' -b'thelongvalue32' -b'thelongvalue33' -b'thelongvalue34' -b'thelongvalue35' -b'thelongvalue36' -b'thelongvalue37' -b'thelongvalue38' -b'thelongvalue39' -b'thelongvalue40' -b'thelongvalue41' -b'thelongvalue42' -b'thelongvalue43' -b'thelongvalue44' -b'thelongvalue45' -b'thelongvalue46' -b'thelongvalue47' -b'thelongvalue48' -b'thelongvalue49' -b'thelongvalue50' -b'thelongvalue51' -b'thelongvalue52' -b'thelongvalue53' -b'thelongvalue54' -b'thelongvalue55' -b'thelongvalue56' -b'thelongvalue57' -b'thelongvalue58' -b'thelongvalue59' -b'thelongvalue60' -b'thelongvalue61' -b'thelongvalue62' -b'thelongvalue63' -b'thelongvalue64' -b'thelongvalue65' -b'thelongvalue66' -b'thelongvalue67' -b'thelongvalue68' -b'thelongvalue69' -b'thelongvalue70' -b'thelongvalue71' -b'thelongvalue72' -b'thelongvalue73' -b'thelongvalue74' -b'thelongvalue75' -b'thelongvalue76' -b'thelongvalue77' -b'thelongvalue78' -b'thelongvalue79' diff --git a/tests/extmod/framebuf1.py b/tests/extmod/framebuf1.py deleted file mode 100644 index c8e0132265..0000000000 --- a/tests/extmod/framebuf1.py +++ /dev/null @@ -1,111 +0,0 @@ -try: - import framebuf -except ImportError: - print("SKIP") - raise SystemExit - -w = 5 -h = 16 -size = w * h // 8 -buf = bytearray(size) -maps = { - framebuf.MONO_VLSB: "MONO_VLSB", - framebuf.MONO_HLSB: "MONO_HLSB", - framebuf.MONO_HMSB: "MONO_HMSB", -} - -for mapping in maps.keys(): - for x in range(size): - buf[x] = 0 - fbuf = framebuf.FrameBuffer(buf, w, h, mapping) - print(maps[mapping]) - # access as buffer - print(memoryview(fbuf)[0]) - - # fill - fbuf.fill(1) - print(buf) - fbuf.fill(0) - print(buf) - - # put pixel - fbuf.pixel(0, 0, 1) - fbuf.pixel(4, 0, 1) - fbuf.pixel(0, 15, 1) - fbuf.pixel(4, 15, 1) - print(buf) - - # clear pixel - fbuf.pixel(4, 15, 0) - print(buf) - - # get pixel - print(fbuf.pixel(0, 0), fbuf.pixel(1, 1)) - - # hline - fbuf.fill(0) - fbuf.hline(0, 1, w, 1) - print("hline", buf) - - # vline - fbuf.fill(0) - fbuf.vline(1, 0, h, 1) - print("vline", buf) - - # rect - fbuf.fill(0) - fbuf.rect(1, 1, 3, 3, 1) - print("rect", buf) - - # fill rect - fbuf.fill(0) - fbuf.fill_rect(0, 0, 0, 3, 1) # zero width, no-operation - fbuf.fill_rect(1, 1, 3, 3, 1) - print("fill_rect", buf) - - # line - fbuf.fill(0) - fbuf.line(1, 1, 3, 3, 1) - print("line", buf) - - # line steep negative gradient - fbuf.fill(0) - fbuf.line(3, 3, 2, 1, 1) - print("line", buf) - - # scroll - fbuf.fill(0) - fbuf.pixel(2, 7, 1) - fbuf.scroll(0, 1) - print(buf) - fbuf.scroll(0, -2) - print(buf) - fbuf.scroll(1, 0) - print(buf) - fbuf.scroll(-1, 0) - print(buf) - fbuf.scroll(2, 2) - print(buf) - - # print text - fbuf.fill(0) - fbuf.text("hello", 0, 0, 1) - print(buf) - fbuf.text("hello", 0, 0, 0) # clear - print(buf) - - # char out of font range set to chr(127) - fbuf.text(str(chr(31)), 0, 0) - print(buf) - print() - -# test invalid constructor, and stride argument -try: - fbuf = framebuf.FrameBuffer(buf, w, h, -1, w) -except ValueError: - print("ValueError") - -# test legacy constructor -fbuf = framebuf.FrameBuffer1(buf, w, h) -fbuf = framebuf.FrameBuffer1(buf, w, h, w) -print(framebuf.MVLSB == framebuf.MONO_VLSB) diff --git a/tests/extmod/framebuf1.py.exp b/tests/extmod/framebuf1.py.exp deleted file mode 100644 index d954623dee..0000000000 --- a/tests/extmod/framebuf1.py.exp +++ /dev/null @@ -1,68 +0,0 @@ -MONO_VLSB -0 -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x01\x00\x00\x00\x01\x80\x00\x00\x00\x80') -bytearray(b'\x01\x00\x00\x00\x01\x80\x00\x00\x00\x00') -1 0 -hline bytearray(b'\x02\x02\x02\x02\x02\x00\x00\x00\x00\x00') -vline bytearray(b'\x00\xff\x00\x00\x00\x00\xff\x00\x00\x00') -rect bytearray(b'\x00\x0e\n\x0e\x00\x00\x00\x00\x00\x00') -fill_rect bytearray(b'\x00\x0e\x0e\x0e\x00\x00\x00\x00\x00\x00') -line bytearray(b'\x00\x02\x04\x08\x00\x00\x00\x00\x00\x00') -line bytearray(b'\x00\x00\x06\x08\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00') -bytearray(b'\x00\x00@\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00@\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00@\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01') -bytearray(b'\x00\x7f\x7f\x04\x04\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\xaaU\xaaU\xaa\x00\x00\x00\x00\x00') - -MONO_HLSB -0 -bytearray(b'\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8\xf8') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00') -1 0 -hline bytearray(b'\x00\xf8\x00\x00\x00\x00\x00\x00\x00\x00') -vline bytearray(b'@@@@@@@@@@') -rect bytearray(b'\x00pPp\x00\x00\x00\x00\x00\x00') -fill_rect bytearray(b'\x00ppp\x00\x00\x00\x00\x00\x00') -line bytearray(b'\x00@ \x10\x00\x00\x00\x00\x00\x00') -line bytearray(b'\x00 \x10\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00 \x00') -bytearray(b'\x00\x00\x00\x00\x00\x00 \x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x10\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00 \x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x08\x00') -bytearray(b'``x````\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'P\xa8P\xa8P\xa8P\xa8\x00\x00') - -MONO_HMSB -0 -bytearray(b'\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00') -1 0 -hline bytearray(b'\x00\x1f\x00\x00\x00\x00\x00\x00\x00\x00') -vline bytearray(b'\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02') -rect bytearray(b'\x00\x0e\n\x0e\x00\x00\x00\x00\x00\x00') -fill_rect bytearray(b'\x00\x0e\x0e\x0e\x00\x00\x00\x00\x00\x00') -line bytearray(b'\x00\x02\x04\x08\x00\x00\x00\x00\x00\x00') -line bytearray(b'\x00\x04\x04\x08\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x08\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00') -bytearray(b'\x06\x06\x1e\x06\x06\x06\x06\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\n\x15\n\x15\n\x15\n\x15\x00\x00') - -ValueError -True diff --git a/tests/extmod/framebuf16.py b/tests/extmod/framebuf16.py deleted file mode 100644 index cd7f5ec015..0000000000 --- a/tests/extmod/framebuf16.py +++ /dev/null @@ -1,66 +0,0 @@ -try: - import framebuf, usys -except ImportError: - print("SKIP") - raise SystemExit - -# This test and its .exp file is based on a little-endian architecture. -if usys.byteorder != "little": - print("SKIP") - raise SystemExit - - -def printbuf(): - print("--8<--") - for y in range(h): - print(buf[y * w * 2 : (y + 1) * w * 2]) - print("-->8--") - - -w = 4 -h = 5 -buf = bytearray(w * h * 2) -fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.RGB565) - -# fill -fbuf.fill(0xFFFF) -printbuf() -fbuf.fill(0x0000) -printbuf() - -# put pixel -fbuf.pixel(0, 0, 0xEEEE) -fbuf.pixel(3, 0, 0xEE00) -fbuf.pixel(0, 4, 0x00EE) -fbuf.pixel(3, 4, 0x0EE0) -printbuf() - -# get pixel -print(fbuf.pixel(0, 4), fbuf.pixel(1, 1)) - -# scroll -fbuf.fill(0x0000) -fbuf.pixel(2, 2, 0xFFFF) -printbuf() -fbuf.scroll(0, 1) -printbuf() -fbuf.scroll(1, 0) -printbuf() -fbuf.scroll(-1, -2) -printbuf() - -w2 = 2 -h2 = 3 -buf2 = bytearray(w2 * h2 * 2) -fbuf2 = framebuf.FrameBuffer(buf2, w2, h2, framebuf.RGB565) - -fbuf2.fill(0x0000) -fbuf2.pixel(0, 0, 0x0EE0) -fbuf2.pixel(0, 2, 0xEE00) -fbuf2.pixel(1, 0, 0x00EE) -fbuf2.pixel(1, 2, 0xE00E) -fbuf.fill(0xFFFF) -fbuf.blit(fbuf2, 3, 3, 0x0000) -fbuf.blit(fbuf2, -1, -1, 0x0000) -fbuf.blit(fbuf2, 16, 16, 0x0000) -printbuf() diff --git a/tests/extmod/framebuf16.py.exp b/tests/extmod/framebuf16.py.exp deleted file mode 100644 index c41dc19d07..0000000000 --- a/tests/extmod/framebuf16.py.exp +++ /dev/null @@ -1,57 +0,0 @@ ---8<-- -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') --->8-- ---8<-- -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') --->8-- ---8<-- -bytearray(b'\xee\xee\x00\x00\x00\x00\x00\xee') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\xee\x00\x00\x00\x00\x00\xe0\x0e') --->8-- -238 0 ---8<-- -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\xff\xff\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') --->8-- ---8<-- -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\xff\xff\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') --->8-- ---8<-- -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\xff\xff') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') --->8-- ---8<-- -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\xff\xff\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\xff\xff') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') --->8-- ---8<-- -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\x0e\xe0\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xe0\x0e') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') --->8-- diff --git a/tests/extmod/framebuf2.py b/tests/extmod/framebuf2.py deleted file mode 100644 index 097057fe96..0000000000 --- a/tests/extmod/framebuf2.py +++ /dev/null @@ -1,64 +0,0 @@ -try: - import framebuf -except ImportError: - print("SKIP") - raise SystemExit - - -def printbuf(): - print("--8<--") - for y in range(h): - for x in range(w): - print("%u" % ((buf[(x + y * w) // 4] >> ((x & 3) << 1)) & 3), end="") - print() - print("-->8--") - - -w = 8 -h = 5 -buf = bytearray(w * h // 4) -fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS2_HMSB) - -# fill -fbuf.fill(3) -printbuf() -fbuf.fill(0) -printbuf() - -# put pixel -fbuf.pixel(0, 0, 1) -fbuf.pixel(3, 0, 2) -fbuf.pixel(0, 4, 3) -fbuf.pixel(3, 4, 2) -printbuf() - -# get pixel -print(fbuf.pixel(0, 4), fbuf.pixel(1, 1)) - -# scroll -fbuf.fill(0) -fbuf.pixel(2, 2, 3) -printbuf() -fbuf.scroll(0, 1) -printbuf() -fbuf.scroll(1, 0) -printbuf() -fbuf.scroll(-1, -2) -printbuf() - -w2 = 2 -h2 = 3 -buf2 = bytearray(w2 * h2 // 4) -fbuf2 = framebuf.FrameBuffer(buf2, w2, h2, framebuf.GS2_HMSB) - -# blit -fbuf2.fill(0) -fbuf2.pixel(0, 0, 1) -fbuf2.pixel(0, 2, 2) -fbuf2.pixel(1, 0, 1) -fbuf2.pixel(1, 2, 2) -fbuf.fill(3) -fbuf.blit(fbuf2, 3, 3, 0) -fbuf.blit(fbuf2, -1, -1, 0) -fbuf.blit(fbuf2, 16, 16, 0) -printbuf() diff --git a/tests/extmod/framebuf2.py.exp b/tests/extmod/framebuf2.py.exp deleted file mode 100644 index c53e518a6e..0000000000 --- a/tests/extmod/framebuf2.py.exp +++ /dev/null @@ -1,57 +0,0 @@ ---8<-- -33333333 -33333333 -33333333 -33333333 -33333333 --->8-- ---8<-- -00000000 -00000000 -00000000 -00000000 -00000000 --->8-- ---8<-- -10020000 -00000000 -00000000 -00000000 -30020000 --->8-- -3 0 ---8<-- -00000000 -00000000 -00300000 -00000000 -00000000 --->8-- ---8<-- -00000000 -00000000 -00000000 -00300000 -00000000 --->8-- ---8<-- -00000000 -00000000 -00000000 -00030000 -00000000 --->8-- ---8<-- -00000000 -00300000 -00000000 -00030000 -00000000 --->8-- ---8<-- -33333333 -23333333 -33333333 -33311333 -33333333 --->8-- diff --git a/tests/extmod/framebuf4.py b/tests/extmod/framebuf4.py deleted file mode 100644 index 56593ee155..0000000000 --- a/tests/extmod/framebuf4.py +++ /dev/null @@ -1,55 +0,0 @@ -try: - import framebuf -except ImportError: - print("SKIP") - raise SystemExit - - -def printbuf(): - print("--8<--") - for y in range(h): - print(buf[y * w // 2 : (y + 1) * w // 2]) - print("-->8--") - - -w = 16 -h = 8 -buf = bytearray(w * h // 2) -fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS4_HMSB) - -# fill -fbuf.fill(0x0F) -printbuf() -fbuf.fill(0xA0) -printbuf() - -# put pixel -fbuf.pixel(0, 0, 0x01) -printbuf() -fbuf.pixel(w - 1, 0, 0x02) -printbuf() -fbuf.pixel(w - 1, h - 1, 0x03) -printbuf() -fbuf.pixel(0, h - 1, 0x04) -printbuf() - -# get pixel -print(fbuf.pixel(0, 0), fbuf.pixel(w - 1, 0), fbuf.pixel(w - 1, h - 1), fbuf.pixel(0, h - 1)) -print(fbuf.pixel(1, 0), fbuf.pixel(w - 2, 0), fbuf.pixel(w - 2, h - 1), fbuf.pixel(1, h - 1)) - -# fill rect -fbuf.fill_rect(0, 0, w, h, 0x0F) -printbuf() -fbuf.fill_rect(0, 0, w, h, 0xF0) -fbuf.fill_rect(1, 0, w // 2 + 1, 1, 0xF1) -printbuf() -fbuf.fill_rect(1, 0, w // 2 + 1, 1, 0x10) -fbuf.fill_rect(1, 0, w // 2, 1, 0xF1) -printbuf() -fbuf.fill_rect(1, 0, w // 2, 1, 0x10) -fbuf.fill_rect(0, h - 4, w // 2 + 1, 4, 0xAF) -printbuf() -fbuf.fill_rect(0, h - 4, w // 2 + 1, 4, 0xB0) -fbuf.fill_rect(0, h - 4, w // 2, 4, 0xAF) -printbuf() -fbuf.fill_rect(0, h - 4, w // 2, 4, 0xB0) diff --git a/tests/extmod/framebuf4.py.exp b/tests/extmod/framebuf4.py.exp deleted file mode 100644 index 0865470a07..0000000000 --- a/tests/extmod/framebuf4.py.exp +++ /dev/null @@ -1,112 +0,0 @@ ---8<-- -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') --->8-- ---8<-- -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') --->8-- ---8<-- -bytearray(b'\x10\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') --->8-- ---8<-- -bytearray(b'\x10\x00\x00\x00\x00\x00\x00\x02') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') --->8-- ---8<-- -bytearray(b'\x10\x00\x00\x00\x00\x00\x00\x02') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x03') --->8-- ---8<-- -bytearray(b'\x10\x00\x00\x00\x00\x00\x00\x02') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'@\x00\x00\x00\x00\x00\x00\x03') --->8-- -1 2 3 4 -0 0 0 0 ---8<-- -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') -bytearray(b'\xff\xff\xff\xff\xff\xff\xff\xff') --->8-- ---8<-- -bytearray(b'\x01\x11\x11\x11\x11\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') --->8-- ---8<-- -bytearray(b'\x01\x11\x11\x11\x10\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') --->8-- ---8<-- -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\xff\xff\xff\xff\xf0\x00\x00\x00') -bytearray(b'\xff\xff\xff\xff\xf0\x00\x00\x00') -bytearray(b'\xff\xff\xff\xff\xf0\x00\x00\x00') -bytearray(b'\xff\xff\xff\xff\xf0\x00\x00\x00') --->8-- ---8<-- -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00') -bytearray(b'\xff\xff\xff\xff\x00\x00\x00\x00') -bytearray(b'\xff\xff\xff\xff\x00\x00\x00\x00') -bytearray(b'\xff\xff\xff\xff\x00\x00\x00\x00') -bytearray(b'\xff\xff\xff\xff\x00\x00\x00\x00') --->8-- diff --git a/tests/extmod/framebuf8.py b/tests/extmod/framebuf8.py deleted file mode 100644 index a3ca6fcd4f..0000000000 --- a/tests/extmod/framebuf8.py +++ /dev/null @@ -1,34 +0,0 @@ -try: - import framebuf -except ImportError: - print("SKIP") - raise SystemExit - - -def printbuf(): - print("--8<--") - for y in range(h): - for x in range(w): - print("%02x" % buf[(x + y * w)], end="") - print() - print("-->8--") - - -w = 8 -h = 5 -buf = bytearray(w * h) -fbuf = framebuf.FrameBuffer(buf, w, h, framebuf.GS8) - -# fill -fbuf.fill(0x55) -printbuf() - -# put pixel -fbuf.pixel(0, 0, 0x11) -fbuf.pixel(w - 1, 0, 0x22) -fbuf.pixel(0, h - 1, 0x33) -fbuf.pixel(w - 1, h - 1, 0xFF) -printbuf() - -# get pixel -print(hex(fbuf.pixel(0, h - 1)), hex(fbuf.pixel(1, 1))) diff --git a/tests/extmod/framebuf8.py.exp b/tests/extmod/framebuf8.py.exp deleted file mode 100644 index 01d8976fec..0000000000 --- a/tests/extmod/framebuf8.py.exp +++ /dev/null @@ -1,15 +0,0 @@ ---8<-- -5555555555555555 -5555555555555555 -5555555555555555 -5555555555555555 -5555555555555555 --->8-- ---8<-- -1155555555555522 -5555555555555555 -5555555555555555 -5555555555555555 -33555555555555ff --->8-- -0x33 0x55 diff --git a/tests/extmod/framebuf_palette.py b/tests/extmod/framebuf_palette.py deleted file mode 100644 index f5b15fda73..0000000000 --- a/tests/extmod/framebuf_palette.py +++ /dev/null @@ -1,35 +0,0 @@ -# Test blit between different color spaces -try: - import framebuf, usys -except ImportError: - print("SKIP") - raise SystemExit - -# Monochrome glyph/icon -w = 8 -h = 8 -cbuf = bytearray(w * h // 8) -fbc = framebuf.FrameBuffer(cbuf, w, h, framebuf.MONO_HLSB) -fbc.line(0, 0, 7, 7, 1) - -# RGB565 destination -wd = 16 -hd = 16 -dest = bytearray(wd * hd * 2) -fbd = framebuf.FrameBuffer(dest, wd, hd, framebuf.RGB565) - -wp = 2 -bg = 0x1234 -fg = 0xF800 -pal = bytearray(wp * 2) -palette = framebuf.FrameBuffer(pal, wp, 1, framebuf.RGB565) -palette.pixel(0, 0, bg) -palette.pixel(1, 0, fg) - -fbd.blit(fbc, 0, 0, -1, palette) - -print(fbd.pixel(0, 0) == fg) -print(fbd.pixel(7, 7) == fg) -print(fbd.pixel(8, 8) == 0) # Outside blit -print(fbd.pixel(0, 1) == bg) -print(fbd.pixel(1, 0) == bg) diff --git a/tests/extmod/framebuf_palette.py.exp b/tests/extmod/framebuf_palette.py.exp deleted file mode 100644 index 2e883c51de..0000000000 --- a/tests/extmod/framebuf_palette.py.exp +++ /dev/null @@ -1,5 +0,0 @@ -True -True -True -True -True diff --git a/tests/extmod/framebuf_subclass.py b/tests/extmod/framebuf_subclass.py deleted file mode 100644 index 4cd9ea4eb5..0000000000 --- a/tests/extmod/framebuf_subclass.py +++ /dev/null @@ -1,51 +0,0 @@ -# test subclassing framebuf.FrameBuffer - -try: - import framebuf, usys -except ImportError: - print("SKIP") - raise SystemExit - -# This test and its .exp file is based on a little-endian architecture. -if usys.byteorder != "little": - print("SKIP") - raise SystemExit - - -class FB(framebuf.FrameBuffer): - def __init__(self, n): - self.n = n - super().__init__(bytearray(2 * n * n), n, n, framebuf.RGB565) - - def foo(self): - self.hline(0, 2, self.n, 0x0304) - - -fb = FB(n=3) -fb.pixel(0, 0, 0x0102) -fb.foo() -print(bytes(fb)) - -# Test that blitting a subclass works. -fb2 = framebuf.FrameBuffer(bytearray(2 * 3 * 3), 3, 3, framebuf.RGB565) -fb.fill(0) -fb.pixel(0, 0, 0x0506) -fb.pixel(2, 2, 0x0708) -fb2.blit(fb, 0, 0) -print(bytes(fb2)) - - -# Test that blitting something that isn't a subclass fails with TypeError. -class NotAFrameBuf: - pass - - -try: - fb.blit(NotAFrameBuf(), 0, 0) -except TypeError: - print("TypeError") - -try: - fb.blit(None, 0, 0) -except TypeError: - print("TypeError") diff --git a/tests/extmod/framebuf_subclass.py.exp b/tests/extmod/framebuf_subclass.py.exp deleted file mode 100644 index 58e311fee5..0000000000 --- a/tests/extmod/framebuf_subclass.py.exp +++ /dev/null @@ -1,4 +0,0 @@ -b'\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x03\x04\x03\x04\x03' -b'\x06\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08\x07' -TypeError -TypeError diff --git a/tests/extmod/ticks_diff.py b/tests/extmod/ticks_diff.py index de45a557af..b2445f0d62 100644 --- a/tests/extmod/ticks_diff.py +++ b/tests/extmod/ticks_diff.py @@ -1,5 +1,5 @@ try: - from utime import ticks_diff, ticks_add + from time import ticks_diff, ticks_add except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/time_ms_us.py b/tests/extmod/time_ms_us.py index ac2ed8be27..67c469d0a3 100644 --- a/tests/extmod/time_ms_us.py +++ b/tests/extmod/time_ms_us.py @@ -1,23 +1,23 @@ try: - import utime + import time - utime.sleep_ms, utime.sleep_us, utime.ticks_diff, utime.ticks_ms, utime.ticks_us, utime.ticks_cpu + time.sleep_ms, time.sleep_us, time.ticks_diff, time.ticks_ms, time.ticks_us, time.ticks_cpu except (ImportError, AttributeError): print("SKIP") raise SystemExit -utime.sleep_ms(1) -utime.sleep_us(1) +time.sleep_ms(1) +time.sleep_us(1) -t0 = utime.ticks_ms() -t1 = utime.ticks_ms() -print(0 <= utime.ticks_diff(t1, t0) <= 1) +t0 = time.ticks_ms() +t1 = time.ticks_ms() +print(0 <= time.ticks_diff(t1, t0) <= 1) -t0 = utime.ticks_us() -t1 = utime.ticks_us() -print(0 <= utime.ticks_diff(t1, t0) <= 500) +t0 = time.ticks_us() +t1 = time.ticks_us() +print(0 <= time.ticks_diff(t1, t0) <= 500) -# ticks_cpu may not be implemented, at least make sure it doesn't decrease -t0 = utime.ticks_cpu() -t1 = utime.ticks_cpu() -print(utime.ticks_diff(t1, t0) >= 0) +# ticks_cpu may not be implemented, at least make sre it doesn't decrease +t0 = time.ticks_cpu() +t1 = time.ticks_cpu() +print(time.ticks_diff(t1, t0) >= 0) diff --git a/tests/extmod/uasyncio_await_return.py b/tests/extmod/uasyncio_await_return.py index 4a45d9b9c0..8042b5488d 100644 --- a/tests/extmod/uasyncio_await_return.py +++ b/tests/extmod/uasyncio_await_return.py @@ -1,13 +1,10 @@ # Test that tasks return their value correctly to the caller try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def foo(): diff --git a/tests/extmod/uasyncio_basic.py b/tests/extmod/uasyncio_basic.py index baf9d193fe..148a361b4b 100644 --- a/tests/extmod/uasyncio_basic.py +++ b/tests/extmod/uasyncio_basic.py @@ -1,11 +1,8 @@ try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def foo(): @@ -19,10 +16,10 @@ except AttributeError: raise SystemExit try: - import utime + import time - ticks = utime.ticks_ms - ticks_diff = utime.ticks_diff + ticks = time.ticks_ms + ticks_diff = time.ticks_diff except: import time diff --git a/tests/extmod/uasyncio_basic2.py b/tests/extmod/uasyncio_basic2.py index a2167e48ee..3040b6aa51 100644 --- a/tests/extmod/uasyncio_basic2.py +++ b/tests/extmod/uasyncio_basic2.py @@ -1,11 +1,8 @@ try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def forever(): diff --git a/tests/extmod/uasyncio_cancel_fair.py b/tests/extmod/uasyncio_cancel_fair.py index 9a7b35c161..a1e35f82ba 100644 --- a/tests/extmod/uasyncio_cancel_fair.py +++ b/tests/extmod/uasyncio_cancel_fair.py @@ -2,13 +2,10 @@ # That tasks which continuously cancel each other don't take over the scheduler try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def task(id, other): diff --git a/tests/extmod/uasyncio_cancel_fair2.py b/tests/extmod/uasyncio_cancel_fair2.py index 46e40f71b1..577823204f 100644 --- a/tests/extmod/uasyncio_cancel_fair2.py +++ b/tests/extmod/uasyncio_cancel_fair2.py @@ -2,13 +2,10 @@ # That tasks which keeps being cancelled by multiple other tasks gets a chance to run try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def task_a(): diff --git a/tests/extmod/uasyncio_cancel_self.py b/tests/extmod/uasyncio_cancel_self.py index 660ae66389..a437edb540 100644 --- a/tests/extmod/uasyncio_cancel_self.py +++ b/tests/extmod/uasyncio_cancel_self.py @@ -1,13 +1,10 @@ # Test a task cancelling itself (currently unsupported) try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def task(): diff --git a/tests/extmod/uasyncio_cancel_task.py b/tests/extmod/uasyncio_cancel_task.py index ec60d85545..9250f46b51 100644 --- a/tests/extmod/uasyncio_cancel_task.py +++ b/tests/extmod/uasyncio_cancel_task.py @@ -1,13 +1,10 @@ # Test cancelling a task try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def task(s, allow_cancel): diff --git a/tests/extmod/uasyncio_cancel_wait_on_finished.py b/tests/extmod/uasyncio_cancel_wait_on_finished.py index 66b36dd60d..c3529b8d7a 100644 --- a/tests/extmod/uasyncio_cancel_wait_on_finished.py +++ b/tests/extmod/uasyncio_cancel_wait_on_finished.py @@ -1,13 +1,10 @@ # Test cancelling a task that is waiting on a task that just finishes. try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def sleep_task(): diff --git a/tests/extmod/uasyncio_current_task.py b/tests/extmod/uasyncio_current_task.py index 3165a2cf16..18058230f2 100644 --- a/tests/extmod/uasyncio_current_task.py +++ b/tests/extmod/uasyncio_current_task.py @@ -1,13 +1,10 @@ # Test current_task() function try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def task(result): diff --git a/tests/extmod/uasyncio_event.py b/tests/extmod/uasyncio_event.py index fb8eb9ffa4..290323a7de 100644 --- a/tests/extmod/uasyncio_event.py +++ b/tests/extmod/uasyncio_event.py @@ -1,13 +1,10 @@ # Test Event class try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def task(id, ev): diff --git a/tests/extmod/uasyncio_event_fair.py b/tests/extmod/uasyncio_event_fair.py index 1eee0bd7e8..1029b54c5f 100644 --- a/tests/extmod/uasyncio_event_fair.py +++ b/tests/extmod/uasyncio_event_fair.py @@ -2,13 +2,10 @@ # That tasks which continuously wait on events don't take over the scheduler try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def foo(): diff --git a/tests/extmod/uasyncio_exception.py b/tests/extmod/uasyncio_exception.py index 4e4f978dc2..6f19509bac 100644 --- a/tests/extmod/uasyncio_exception.py +++ b/tests/extmod/uasyncio_exception.py @@ -1,13 +1,10 @@ # Test general exception handling try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit # main task raising an exception diff --git a/tests/extmod/uasyncio_fair.py b/tests/extmod/uasyncio_fair.py index e225706054..43076fef1d 100644 --- a/tests/extmod/uasyncio_fair.py +++ b/tests/extmod/uasyncio_fair.py @@ -1,13 +1,10 @@ # Test fairness of scheduler try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def task(id, t): diff --git a/tests/extmod/uasyncio_gather.py b/tests/extmod/uasyncio_gather.py index e34176a31d..c666ff6b17 100644 --- a/tests/extmod/uasyncio_gather.py +++ b/tests/extmod/uasyncio_gather.py @@ -1,13 +1,10 @@ -# test uasyncio.gather() function +# test asyncio.gather() function try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def foo(): diff --git a/tests/extmod/uasyncio_gather_notimpl.py b/tests/extmod/uasyncio_gather_notimpl.py index 63ba645d24..0b12bb804b 100644 --- a/tests/extmod/uasyncio_gather_notimpl.py +++ b/tests/extmod/uasyncio_gather_notimpl.py @@ -1,13 +1,10 @@ -# Test uasyncio.gather() function, features that are not implemented. +# Test asyncio.gather() function, featres that are not implemented. try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def foo(): diff --git a/tests/extmod/uasyncio_get_event_loop.py b/tests/extmod/uasyncio_get_event_loop.py index 8ccbd6814e..b2d50e3cba 100644 --- a/tests/extmod/uasyncio_get_event_loop.py +++ b/tests/extmod/uasyncio_get_event_loop.py @@ -1,13 +1,10 @@ # Test get_event_loop() try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def main(): diff --git a/tests/extmod/uasyncio_heaplock.py b/tests/extmod/uasyncio_heaplock.py index 34a51cd370..482e7319ff 100644 --- a/tests/extmod/uasyncio_heaplock.py +++ b/tests/extmod/uasyncio_heaplock.py @@ -1,4 +1,4 @@ -# test that basic scheduling of tasks, and uasyncio.sleep_ms, does not use the heap +# test that basic scheduling of tasks, and asyncio.sleep_ms, does not use the heap import micropython @@ -13,13 +13,10 @@ except RuntimeError: raise SystemExit try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def task(id, n, t): diff --git a/tests/extmod/uasyncio_lock.py b/tests/extmod/uasyncio_lock.py index 096a8c82be..f565adb03f 100644 --- a/tests/extmod/uasyncio_lock.py +++ b/tests/extmod/uasyncio_lock.py @@ -1,13 +1,10 @@ # Test Lock class try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def task_loop(id, lock): diff --git a/tests/extmod/uasyncio_lock_cancel.py b/tests/extmod/uasyncio_lock_cancel.py index 27428da80b..a501185e90 100644 --- a/tests/extmod/uasyncio_lock_cancel.py +++ b/tests/extmod/uasyncio_lock_cancel.py @@ -1,13 +1,10 @@ # Test that locks work when cancelling multiple waiters on the lock try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def foo(): diff --git a/tests/extmod/uasyncio_loop_stop.py b/tests/extmod/uasyncio_loop_stop.py index 23507f9a7e..b4bd0c74ad 100644 --- a/tests/extmod/uasyncio_loop_stop.py +++ b/tests/extmod/uasyncio_loop_stop.py @@ -1,13 +1,10 @@ # Test Loop.stop() to stop the event loop try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def task(): diff --git a/tests/extmod/uasyncio_micropython.py b/tests/extmod/uasyncio_micropython.py index 69e5fa3224..c27a134cd9 100644 --- a/tests/extmod/uasyncio_micropython.py +++ b/tests/extmod/uasyncio_micropython.py @@ -3,7 +3,7 @@ # - wait_for_ms try: - import utime, uasyncio + import time, asyncio except ImportError: print("SKIP") raise SystemExit @@ -11,27 +11,27 @@ except ImportError: async def task(id, t): print("task start", id) - await uasyncio.sleep_ms(t) + await asyncio.sleep_ms(t) print("task end", id) return id * 2 async def main(): # Simple sleep_ms - t0 = utime.ticks_ms() - await uasyncio.sleep_ms(1) - print(utime.ticks_diff(utime.ticks_ms(), t0) < 100) + t0 = time.ticks_ms() + await asyncio.sleep_ms(1) + print(time.ticks_diff(time.ticks_ms(), t0) < 100) # When task finished before the timeout - print(await uasyncio.wait_for_ms(task(1, 5), 50)) + print(await asyncio.wait_for_ms(task(1, 5), 50)) # When timeout passes and task is cancelled try: - print(await uasyncio.wait_for_ms(task(2, 50), 5)) - except uasyncio.TimeoutError: + print(await asyncio.wait_for_ms(task(2, 50), 5)) + except asyncio.TimeoutError: print("timeout") print("finish") -uasyncio.run(main()) +asyncio.run(main()) diff --git a/tests/extmod/uasyncio_new_event_loop.py b/tests/extmod/uasyncio_new_event_loop.py index b711befba9..a3feb02126 100644 --- a/tests/extmod/uasyncio_new_event_loop.py +++ b/tests/extmod/uasyncio_new_event_loop.py @@ -1,13 +1,10 @@ # Test Loop.new_event_loop() try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def task(): diff --git a/tests/extmod/uasyncio_set_exception_handler.py b/tests/extmod/uasyncio_set_exception_handler.py index fe7b83eb4d..5935f0f4eb 100644 --- a/tests/extmod/uasyncio_set_exception_handler.py +++ b/tests/extmod/uasyncio_set_exception_handler.py @@ -1,13 +1,10 @@ # Test that tasks return their value correctly to the caller try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit def custom_handler(loop, context): diff --git a/tests/extmod/uasyncio_task_done.py b/tests/extmod/uasyncio_task_done.py index 2700da8c34..7cc493a122 100644 --- a/tests/extmod/uasyncio_task_done.py +++ b/tests/extmod/uasyncio_task_done.py @@ -1,13 +1,10 @@ # Test the Task.done() method try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def task(t, exc=None): diff --git a/tests/extmod/uasyncio_task_exception.py b/tests/extmod/uasyncio_task_exception.py index 6bf99dc93c..9fb26857b5 100644 --- a/tests/extmod/uasyncio_task_exception.py +++ b/tests/extmod/uasyncio_task_exception.py @@ -8,13 +8,10 @@ # raising. try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit def custom_handler(loop, context): diff --git a/tests/extmod/uasyncio_threadsafeflag.py b/tests/extmod/uasyncio_threadsafeflag.py index 4e002a3d2a..32eafae8bc 100644 --- a/tests/extmod/uasyncio_threadsafeflag.py +++ b/tests/extmod/uasyncio_threadsafeflag.py @@ -1,7 +1,7 @@ # Test Event class try: - import uasyncio as asyncio + import asyncio except ImportError: print("SKIP") raise SystemExit @@ -11,6 +11,7 @@ import micropython try: micropython.schedule + asyncio.ThreadSafeFlag except AttributeError: print("SKIP") raise SystemExit @@ -18,7 +19,7 @@ except AttributeError: try: # Unix port can't select/poll on user-defined types. - import uselect as select + import select poller = select.poll() poller.register(asyncio.ThreadSafeFlag()) diff --git a/tests/extmod/uasyncio_wait_for.py b/tests/extmod/uasyncio_wait_for.py index c636c7dd74..f973e46f4c 100644 --- a/tests/extmod/uasyncio_wait_for.py +++ b/tests/extmod/uasyncio_wait_for.py @@ -1,13 +1,10 @@ # Test asyncio.wait_for try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def task(id, t): diff --git a/tests/extmod/uasyncio_wait_for_fwd.py b/tests/extmod/uasyncio_wait_for_fwd.py index e608f63f6b..fd74ed01d5 100644 --- a/tests/extmod/uasyncio_wait_for_fwd.py +++ b/tests/extmod/uasyncio_wait_for_fwd.py @@ -1,13 +1,10 @@ # Test asyncio.wait_for, with forwarding cancellation try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit async def foo(): diff --git a/tests/extmod/uasyncio_wait_task.py b/tests/extmod/uasyncio_wait_task.py index e19e29903c..1b1762befe 100644 --- a/tests/extmod/uasyncio_wait_task.py +++ b/tests/extmod/uasyncio_wait_task.py @@ -1,20 +1,17 @@ # Test waiting on a task try: - import uasyncio as asyncio + import asyncio except ImportError: - try: - import asyncio - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: - import utime + import time - ticks = utime.ticks_ms - ticks_diff = utime.ticks_diff + ticks = time.ticks_ms + ticks_diff = time.ticks_diff except: import time diff --git a/tests/extmod/ubinascii_a2b_base64.py b/tests/extmod/ubinascii_a2b_base64.py index c65d69ddbe..f29330b6fc 100644 --- a/tests/extmod/ubinascii_a2b_base64.py +++ b/tests/extmod/ubinascii_a2b_base64.py @@ -1,8 +1,5 @@ try: - try: - import ubinascii as binascii - except ImportError: - import binascii + import binascii except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ubinascii_b2a_base64.py b/tests/extmod/ubinascii_b2a_base64.py index 34f2f57055..a6072d50ec 100644 --- a/tests/extmod/ubinascii_b2a_base64.py +++ b/tests/extmod/ubinascii_b2a_base64.py @@ -1,8 +1,5 @@ try: - try: - import ubinascii as binascii - except ImportError: - import binascii + import binascii except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ubinascii_crc32.py b/tests/extmod/ubinascii_crc32.py index 186bd699ae..b2f73d9475 100644 --- a/tests/extmod/ubinascii_crc32.py +++ b/tests/extmod/ubinascii_crc32.py @@ -1,8 +1,5 @@ try: - try: - import ubinascii as binascii - except ImportError: - import binascii + import binascii except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ubinascii_hexlify.py b/tests/extmod/ubinascii_hexlify.py index 3dcf0c4271..260010237c 100644 --- a/tests/extmod/ubinascii_hexlify.py +++ b/tests/extmod/ubinascii_hexlify.py @@ -1,8 +1,5 @@ try: - try: - import ubinascii as binascii - except ImportError: - import binascii + import binascii except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ubinascii_micropython.py b/tests/extmod/ubinascii_micropython.py index 94e8daa557..87c69b5838 100644 --- a/tests/extmod/ubinascii_micropython.py +++ b/tests/extmod/ubinascii_micropython.py @@ -1,8 +1,5 @@ try: - try: - import ubinascii as binascii - except ImportError: - import binascii + import binascii except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ubinascii_unhexlify.py b/tests/extmod/ubinascii_unhexlify.py index f656bcd758..63994c11f1 100644 --- a/tests/extmod/ubinascii_unhexlify.py +++ b/tests/extmod/ubinascii_unhexlify.py @@ -1,8 +1,5 @@ try: - try: - import ubinascii as binascii - except ImportError: - import binascii + import binascii except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ucryptolib_aes128_cbc.py b/tests/extmod/ucryptolib_aes128_cbc.py deleted file mode 100644 index d861d2c6bf..0000000000 --- a/tests/extmod/ucryptolib_aes128_cbc.py +++ /dev/null @@ -1,16 +0,0 @@ -try: - from Crypto.Cipher import AES - - aes = AES.new -except ImportError: - try: - from ucryptolib import aes - except ImportError: - print("SKIP") - raise SystemExit - -crypto = aes(b"1234" * 4, 2, b"5678" * 4) -enc = crypto.encrypt(bytes(range(32))) -print(enc) -crypto = aes(b"1234" * 4, 2, b"5678" * 4) -print(crypto.decrypt(enc)) diff --git a/tests/extmod/ucryptolib_aes128_cbc.py.exp b/tests/extmod/ucryptolib_aes128_cbc.py.exp deleted file mode 100644 index cc73553b2a..0000000000 --- a/tests/extmod/ucryptolib_aes128_cbc.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -b'\x1d\x84\xfa\xaa%\x0e9\x143\x8b6\xf8\xdf^yh\xd0\x94g\xf4\xcf\x1d\xa0I)\x8a\xa0\x00u0+C' -b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f' diff --git a/tests/extmod/ucryptolib_aes128_ctr.py b/tests/extmod/ucryptolib_aes128_ctr.py deleted file mode 100644 index 538d9606e9..0000000000 --- a/tests/extmod/ucryptolib_aes128_ctr.py +++ /dev/null @@ -1,28 +0,0 @@ -try: - from ucryptolib import aes -except ImportError: - print("SKIP") - raise SystemExit - - -def _new(k, ctr_initial): - return aes(k, 6, ctr_initial) - - -try: - _new(b"x" * 16, b"x" * 16) -except ValueError as e: - # is CTR support disabled? - if e.args[0] == "mode": - print("SKIP") - raise SystemExit - raise e - -crypto = _new(b"1234" * 4, b"5678" * 4) -enc = crypto.encrypt(b"a") -print(enc) -enc += crypto.encrypt(b"b" * 1000) -print(enc) - -crypto = _new(b"1234" * 4, b"5678" * 4) -print(crypto.decrypt(enc)) diff --git a/tests/extmod/ucryptolib_aes128_ctr.py.exp b/tests/extmod/ucryptolib_aes128_ctr.py.exp deleted file mode 100644 index 92e090fd39..0000000000 --- a/tests/extmod/ucryptolib_aes128_ctr.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -b'\x06' -b'\x06(F\x08\xc3hB\xfdO\x05;\xf6\x96\xfe\xad\xe0\xca\xe6\xd1\xa2m\t\x91v>|\xee\xe0q\xbc]\x9a`\xfal\x87\xa6e\xfb\x8a\xf4\xb2-\xc4x,\xfc@=,\x90\xf4\xe9h\xf0\xfc\xfb\xe6\x03\xf0d\xb6\xcdObZ\xde\x1b\xe2\x84-%=\xa9\xe4\x05\xab\xd7\x044\xf4$\xd0)\xfd\xd6\xdbL\xdd\xe6\x0cp\xca^p\xaaA\x8b\xb3!\xe3\x13\xfa\x7f#\xfa0\xbd\x0b\x9cX\xec\xed\x1c\xbc\x06\xa4\xa8\x17\xbfg\x98dW\xb9~\x04\xec\xe6lZ\xb0\xab\xd5\xc6v\xe4\x8f\x98G\xff\x9b\x8a\xae\xfd\xe5\xed\x96\x1b\xe2\x99u3\xeb\x9faYr;\xf0g\xf2\x9cq\x8dI\x1cL\xc9\xa8\xb0\xdeD\xd5\x06\x87u=\xcd\x10\x1c\xab\x14\x06n\x99\x13\x89\x9f5\xea\xd2\x08\x9e\xef$?\xb9\xdeQ\x0b\x90CH\xea@V\x94\x1a\xdd\x7f\x1dz\x82\xaay\xea$Lv\x07\x8e\xce\xb8oN\x15\xf8,\x05\x00\xd9H\xf4\xbe\xb8\xee\x0e\xd6Hjh\xc6\x11\xf8:\xfe\xed\xba_\xaf\x8e\'\x0c\x7fZ\xd5\xb7\xbc\xba\xd3+\xf1\x98i\xab\x0c-\xd9\xe6>\x9e\xd0\xe6>\x9f\xebn\xf0\x15\xd9:\xec\xf7aXa\xb2,CAB7\x18g\xcc#\xbc\xb8\xf9\xa7\xf4V\xba\x0baN\x88\xb1\xea\x94\x05\x0cV\x99_\xc4\xe6\xb2\xd1|\x92\x05*@U\xe4\\\x8dR\x98\xdf\xbfS\x97\x12^\tr\x1f\x12\x8f\xdfi\x8e=\xc4I\xfcB\r\x99f\xe3\xe31\xee\xa9\xcd\x91\x1a\x1ei\xfd\xf4\x84\xc6\xda\x9e\xf3\x8aKn\xaa\xf7\x9eS\xcc\xbaXZ\x0cpbk\x18\x1f\x9aAl>y\xad\xcb\xcf\xe1Wm\xe7\xdd\xcc\x10eW\xe4h\x1dY\xb5Zs\xf1\xe7\x16_\xdc:I1R\xd3\xfe\xb1)\t\xddE\xbax\x06R\xdc\x1dSdlu\xd1\x9c\x00\xaf\x87\x8d1\xbf$\x08\xc6/y\xdf\x1f\x97z(\xff\xb9\xcb\xf2,\x91\xd7\xa0W\xfc\xe3\xe2\x905\x17O\xaf\x18\xc7\xb8?\x94^\xf5@\x80\x8d\xaa*p\xbeR0i\x17\x1e\'-\xfa\xd9\xb2\x03\xb8\x1fY\x13\xc1{\x7f\xa9\x86\t\x99\xee\xa2\xba\xab\xc1\xbb\x07a\xa5J\x01\x98\xe8\x8e\xa1\x8aV\xc1)^A\xd9\xe7\xfej`\xb4\xe9\xd3C\xab\xd4\xdb\xb1\x8c\x83\xaa&\xf1\xe2\xfc\xa1Lb\xa8\xbb\xd6\x83\xb7\xd8\xc5\x9e\xb5\xed\x1b\xe6\x91\x90\xe4\xfa\xfdD\xc2\xcb\xb7U\xb3|?(\x86=\xc2\xff\xd3P\xd2\xc5y\x93\x13r\xcd>5\x80\xde\xdaJ\xdd\x8b\xfa\x14\xd1\x85\xa8P\x06(F\xb3?\xefm\x8e\xe5C\xfe\x98\xaf\xed\xd1!(\x1f.\xc6M\xba\x00\xcb\xbfg5\xc8\x9d\x97+\x14\x87\xf5\x9d4\xb4l\xd5\xc5>\x90\xf2\x06\xa2\xc1R\x89\xf0P\xb4\xe5\x97\xdb\x07\xd3\xc6q\x08\xb9\xe7\r\xf9\x13\x8215\xcb\x92\xed\x99\xc7"\x1e\xe3Zsh\x0e\xe7\xae\x10Xs&)\x1d\xe5\xd5\xbc\x95\x8e\xa3\xd6k[k\x9c\xa0%\xd4\x83%\x88}\x90\xf0\xa7\xc7\xa4(\xdaE\xb9~\xae\x05\xbd}\xe2\xd0\xa5Y\xc1aV[\xab\x93S\xa6\xacg\r\x14\xc6\xe2J\xd6\xcck"\xcc\xfb\xb3\x97\x14\x13\x0b\xd1\xf5\xe7)_\x1e\x0b\xbb\x01\xf7\x11u\x85b\xdf\xab\xe3\xbb:\x84zF\x14u\xfe\x89\x90\xbc\xcaF\x15y\xa3\xa4[\xce\xcf-\xae\x18\x97N\xaa\xed\x84A\xfc\x9e\xeb\xb3\xfcH\x8ej\xcc\x9f \x1b\xc1\x1f}\'q.\xc0^\xd99\x1e\x91b-\xf9\xed\xfd\x9a\x7f\xb6\rO\xea\xc8\x94\xea\xf6\xb4\xdb\xf5\xc7\xb3\xef\xf6D\x12>5\xf3\x9d*\xc9\xf8\x9f]\xb01{d\xe7\'\x8f\xc0\xfbKB\x8dd\xb1\x84\x804\xbe\xe2?AT\x14\xdb4eJ\x96\xc5\xb9%\xe5\x1c\xc0L\xae\xd6O\xde\x1fjJIRD\x96\xa2\xdb\xfc\xc6t\xce\xe6\xe8"\x81\xe6\xc7\x7fuz\xb3\x91\'D\xac\xb2\x93O\xee\x14\xaa7yT\xcf\x81p\x0b(\xa1d\xda\xf8\xcb\x01\x98\x07\'\xfe/\xe4\xca\xab\x03uR"zY\xfb\x1f\x02\xc5\x9c\xa0\'\x89\xffO\x88cK\xac\xb1+S0]%E\x1a\xeb\x04\xf7\x0b\xba\xa0\xbb\xbd|\x06@T\xee\xe7\x17\xa1T\xe3"\x07\x07q' -b'abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' diff --git a/tests/extmod/ucryptolib_aes128_ecb.py b/tests/extmod/ucryptolib_aes128_ecb.py deleted file mode 100644 index 5c0e179986..0000000000 --- a/tests/extmod/ucryptolib_aes128_ecb.py +++ /dev/null @@ -1,16 +0,0 @@ -try: - from Crypto.Cipher import AES - - aes = AES.new -except ImportError: - try: - from ucryptolib import aes - except ImportError: - print("SKIP") - raise SystemExit - -crypto = aes(b"1234" * 4, 1) -enc = crypto.encrypt(bytes(range(32))) -print(enc) -crypto = aes(b"1234" * 4, 1) -print(crypto.decrypt(enc)) diff --git a/tests/extmod/ucryptolib_aes128_ecb.py.exp b/tests/extmod/ucryptolib_aes128_ecb.py.exp deleted file mode 100644 index b0fd15b447..0000000000 --- a/tests/extmod/ucryptolib_aes128_ecb.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -b'Iz\xfe9\x17\xac\xa4X\x12\x04\x10\xf5K~#\xc7\xac;\xf9\xc6E\xa8\xca~\xf1\xee\xd3f%\xf1\x8d\xfe' -b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f' diff --git a/tests/extmod/ucryptolib_aes128_ecb_enc.py b/tests/extmod/ucryptolib_aes128_ecb_enc.py deleted file mode 100644 index 1d4484b0bc..0000000000 --- a/tests/extmod/ucryptolib_aes128_ecb_enc.py +++ /dev/null @@ -1,17 +0,0 @@ -# This tests minimal configuration of ucrypto module, which is -# AES128 encryption (anything else, including AES128 decryption, -# is optional). -try: - from Crypto.Cipher import AES - - aes = AES.new -except ImportError: - try: - from ucryptolib import aes - except ImportError: - print("SKIP") - raise SystemExit - -crypto = aes(b"1234" * 4, 1) -enc = crypto.encrypt(bytes(range(32))) -print(enc) diff --git a/tests/extmod/ucryptolib_aes128_ecb_enc.py.exp b/tests/extmod/ucryptolib_aes128_ecb_enc.py.exp deleted file mode 100644 index 9921d4b83a..0000000000 --- a/tests/extmod/ucryptolib_aes128_ecb_enc.py.exp +++ /dev/null @@ -1 +0,0 @@ -b'Iz\xfe9\x17\xac\xa4X\x12\x04\x10\xf5K~#\xc7\xac;\xf9\xc6E\xa8\xca~\xf1\xee\xd3f%\xf1\x8d\xfe' diff --git a/tests/extmod/ucryptolib_aes128_ecb_inpl.py b/tests/extmod/ucryptolib_aes128_ecb_inpl.py deleted file mode 100644 index 88ccb02daf..0000000000 --- a/tests/extmod/ucryptolib_aes128_ecb_inpl.py +++ /dev/null @@ -1,15 +0,0 @@ -# Inplace operations (input and output buffer is the same) -try: - from ucryptolib import aes -except ImportError: - print("SKIP") - raise SystemExit - -crypto = aes(b"1234" * 4, 1) -buf = bytearray(bytes(range(32))) -crypto.encrypt(buf, buf) -print(buf) - -crypto = aes(b"1234" * 4, 1) -crypto.decrypt(buf, buf) -print(buf) diff --git a/tests/extmod/ucryptolib_aes128_ecb_inpl.py.exp b/tests/extmod/ucryptolib_aes128_ecb_inpl.py.exp deleted file mode 100644 index b7f7bf5409..0000000000 --- a/tests/extmod/ucryptolib_aes128_ecb_inpl.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -bytearray(b'Iz\xfe9\x17\xac\xa4X\x12\x04\x10\xf5K~#\xc7\xac;\xf9\xc6E\xa8\xca~\xf1\xee\xd3f%\xf1\x8d\xfe') -bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f') diff --git a/tests/extmod/ucryptolib_aes128_ecb_into.py b/tests/extmod/ucryptolib_aes128_ecb_into.py deleted file mode 100644 index ff832d7ef3..0000000000 --- a/tests/extmod/ucryptolib_aes128_ecb_into.py +++ /dev/null @@ -1,16 +0,0 @@ -# Operations with pre-allocated output buffer -try: - from ucryptolib import aes -except ImportError: - print("SKIP") - raise SystemExit - -crypto = aes(b"1234" * 4, 1) -enc = bytearray(32) -crypto.encrypt(bytes(range(32)), enc) -print(enc) - -crypto = aes(b"1234" * 4, 1) -dec = bytearray(32) -crypto.decrypt(enc, dec) -print(dec) diff --git a/tests/extmod/ucryptolib_aes128_ecb_into.py.exp b/tests/extmod/ucryptolib_aes128_ecb_into.py.exp deleted file mode 100644 index b7f7bf5409..0000000000 --- a/tests/extmod/ucryptolib_aes128_ecb_into.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -bytearray(b'Iz\xfe9\x17\xac\xa4X\x12\x04\x10\xf5K~#\xc7\xac;\xf9\xc6E\xa8\xca~\xf1\xee\xd3f%\xf1\x8d\xfe') -bytearray(b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f') diff --git a/tests/extmod/ucryptolib_aes256_cbc.py b/tests/extmod/ucryptolib_aes256_cbc.py deleted file mode 100644 index c01846f199..0000000000 --- a/tests/extmod/ucryptolib_aes256_cbc.py +++ /dev/null @@ -1,16 +0,0 @@ -try: - from Crypto.Cipher import AES - - aes = AES.new -except ImportError: - try: - from ucryptolib import aes - except ImportError: - print("SKIP") - raise SystemExit - -crypto = aes(b"1234" * 8, 2, b"5678" * 4) -enc = crypto.encrypt(bytes(range(32))) -print(enc) -crypto = aes(b"1234" * 8, 2, b"5678" * 4) -print(crypto.decrypt(enc)) diff --git a/tests/extmod/ucryptolib_aes256_cbc.py.exp b/tests/extmod/ucryptolib_aes256_cbc.py.exp deleted file mode 100644 index 51262db9c6..0000000000 --- a/tests/extmod/ucryptolib_aes256_cbc.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -b'\xb4\x0b\xff\xdd\xfc\xb5\x03\x88[m\xc1\x01+:\x03M\x18\xb03\x0f\x971g\x10\xb1\x98>\x9b\x17\xb7-\xb2' -b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f' diff --git a/tests/extmod/ucryptolib_aes256_ecb.py b/tests/extmod/ucryptolib_aes256_ecb.py deleted file mode 100644 index 0760063c14..0000000000 --- a/tests/extmod/ucryptolib_aes256_ecb.py +++ /dev/null @@ -1,16 +0,0 @@ -try: - from Crypto.Cipher import AES - - aes = AES.new -except ImportError: - try: - from ucryptolib import aes - except ImportError: - print("SKIP") - raise SystemExit - -crypto = aes(b"1234" * 8, 1) -enc = crypto.encrypt(bytes(range(32))) -print(enc) -crypto = aes(b"1234" * 8, 1) -print(crypto.decrypt(enc)) diff --git a/tests/extmod/ucryptolib_aes256_ecb.py.exp b/tests/extmod/ucryptolib_aes256_ecb.py.exp deleted file mode 100644 index a00a4eb2f5..0000000000 --- a/tests/extmod/ucryptolib_aes256_ecb.py.exp +++ /dev/null @@ -1,2 +0,0 @@ -b'\xe2\xe0\xdd\xef\xc3\xcd\x88/!>\xf6\xa2\xef/\xd15z+`\xb2\xb2\xd7}!:V>\xeb\x19\xbf|\xea' -b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f' diff --git a/tests/extmod/uctypes_sizeof_od.py b/tests/extmod/uctypes_sizeof_od.py index 2f070095b5..375f05f5e2 100644 --- a/tests/extmod/uctypes_sizeof_od.py +++ b/tests/extmod/uctypes_sizeof_od.py @@ -1,5 +1,5 @@ try: - from ucollections import OrderedDict + from collections import OrderedDict import uctypes except ImportError: print("SKIP") diff --git a/tests/extmod/uhashlib_final.py b/tests/extmod/uhashlib_final.py index f562cc1780..c8fdac9234 100644 --- a/tests/extmod/uhashlib_final.py +++ b/tests/extmod/uhashlib_final.py @@ -1,12 +1,12 @@ try: - import uhashlib + import hashlib except ImportError: print("SKIP") raise SystemExit for algo_name in ("md5", "sha1", "sha256"): - algo = getattr(uhashlib, algo_name, None) + algo = getattr(hashlib, algo_name, None) if not algo: continue diff --git a/tests/extmod/uhashlib_md5.py b/tests/extmod/uhashlib_md5.py index 07d5f31692..5f925fc97d 100644 --- a/tests/extmod/uhashlib_md5.py +++ b/tests/extmod/uhashlib_md5.py @@ -1,13 +1,10 @@ try: - import uhashlib as hashlib + import hashlib except ImportError: - try: - import hashlib - except ImportError: - # This is neither uPy, nor cPy, so must be uPy with - # uhashlib module disabled. - print("SKIP") - raise SystemExit + # This is neither uPy, nor cPy, so must be uPy with + # hashlib module disabled. + print("SKIP") + raise SystemExit try: hashlib.md5 diff --git a/tests/extmod/uhashlib_sha1.py b/tests/extmod/uhashlib_sha1.py index e6e6e30dc1..882f570843 100644 --- a/tests/extmod/uhashlib_sha1.py +++ b/tests/extmod/uhashlib_sha1.py @@ -1,13 +1,10 @@ try: - import uhashlib as hashlib + import hashlib except ImportError: - try: - import hashlib - except ImportError: - # This is neither uPy, nor cPy, so must be uPy with - # uhashlib module disabled. - print("SKIP") - raise SystemExit + # This is neither uPy, nor cPy, so must be uPy with + # hashlib module disabled. + print("SKIP") + raise SystemExit try: hashlib.sha1 diff --git a/tests/extmod/uhashlib_sha256.py b/tests/extmod/uhashlib_sha256.py index 5c6dfd0a75..a0629dbc47 100644 --- a/tests/extmod/uhashlib_sha256.py +++ b/tests/extmod/uhashlib_sha256.py @@ -1,13 +1,10 @@ try: - import uhashlib as hashlib + import hashlib except ImportError: - try: - import hashlib - except ImportError: - # This is neither uPy, nor cPy, so must be uPy with - # uhashlib module disabled. - print("SKIP") - raise SystemExit + # This is neither uPy, nor cPy, so must be uPy with + # hashlib module disabled. + print("SKIP") + raise SystemExit h = hashlib.sha256() diff --git a/tests/extmod/uheapq1.py b/tests/extmod/uheapq1.py index a470bb6f71..efe208dac3 100644 --- a/tests/extmod/uheapq1.py +++ b/tests/extmod/uheapq1.py @@ -1,11 +1,8 @@ try: - import uheapq as heapq -except: - try: - import heapq - except ImportError: - print("SKIP") - raise SystemExit + import heapq +except ImportError: + print("SKIP") + raise SystemExit try: heapq.heappop([]) diff --git a/tests/extmod/ujson_dump.py b/tests/extmod/ujson_dump.py index feda8a47dd..897d33cc81 100644 --- a/tests/extmod/ujson_dump.py +++ b/tests/extmod/ujson_dump.py @@ -1,13 +1,9 @@ try: - from uio import StringIO - import ujson as json -except: - try: - from io import StringIO - import json - except ImportError: - print("SKIP") - raise SystemExit + from io import StringIO + import json +except ImportError: + print("SKIP") + raise SystemExit s = StringIO() json.dump(False, s) diff --git a/tests/extmod/ujson_dump_iobase.py b/tests/extmod/ujson_dump_iobase.py index 7ecf23afb6..94d317b879 100644 --- a/tests/extmod/ujson_dump_iobase.py +++ b/tests/extmod/ujson_dump_iobase.py @@ -1,14 +1,10 @@ -# test ujson.dump in combination with uio.IOBase +# test json.dump in combination with io.IOBase try: - import uio as io - import ujson as json + import io, json except ImportError: - try: - import io, json - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit if not hasattr(io, "IOBase"): print("SKIP") diff --git a/tests/extmod/ujson_dump_separators.py b/tests/extmod/ujson_dump_separators.py index e19b99a26d..4f8e56dceb 100644 --- a/tests/extmod/ujson_dump_separators.py +++ b/tests/extmod/ujson_dump_separators.py @@ -1,13 +1,9 @@ try: - from uio import StringIO - import ujson as json -except: - try: - from io import StringIO - import json - except ImportError: - print("SKIP") - raise SystemExit + from io import StringIO + import json +except ImportError: + print("SKIP") + raise SystemExit for sep in [ None, diff --git a/tests/extmod/ujson_dumps.py b/tests/extmod/ujson_dumps.py index 251b268755..16f144e44f 100644 --- a/tests/extmod/ujson_dumps.py +++ b/tests/extmod/ujson_dumps.py @@ -1,11 +1,8 @@ try: - import ujson as json + import json except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(json.dumps(False)) print(json.dumps(True)) diff --git a/tests/extmod/ujson_dumps_extra.py b/tests/extmod/ujson_dumps_extra.py index f2aa7f249f..9074416a99 100644 --- a/tests/extmod/ujson_dumps_extra.py +++ b/tests/extmod/ujson_dumps_extra.py @@ -1,9 +1,9 @@ -# test uPy ujson behaviour that's not valid in CPy +# test uPy json behaviour that's not valid in CPy try: - import ujson + import json except ImportError: print("SKIP") raise SystemExit -print(ujson.dumps(b"1234")) +print(json.dumps(b"1234")) diff --git a/tests/extmod/ujson_dumps_float.py b/tests/extmod/ujson_dumps_float.py index 25681d0c23..25fbc5c512 100644 --- a/tests/extmod/ujson_dumps_float.py +++ b/tests/extmod/ujson_dumps_float.py @@ -1,11 +1,8 @@ try: - import ujson as json + import json except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(json.dumps(1.2)) print(json.dumps({1.5: "hi"})) diff --git a/tests/extmod/ujson_dumps_ordereddict.py b/tests/extmod/ujson_dumps_ordereddict.py index c6f4a8fcb7..e1fa2a659c 100644 --- a/tests/extmod/ujson_dumps_ordereddict.py +++ b/tests/extmod/ujson_dumps_ordereddict.py @@ -1,12 +1,8 @@ try: - import ujson as json - from ucollections import OrderedDict + import json + from collections import OrderedDict except ImportError: - try: - import json - from collections import OrderedDict - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(json.dumps(OrderedDict(((1, 2), (3, 4))))) diff --git a/tests/extmod/ujson_dumps_separators.py b/tests/extmod/ujson_dumps_separators.py index efb541fe8b..a3a9ec308f 100644 --- a/tests/extmod/ujson_dumps_separators.py +++ b/tests/extmod/ujson_dumps_separators.py @@ -1,11 +1,8 @@ try: - import ujson as json + import json except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit for sep in [ None, diff --git a/tests/extmod/ujson_load.py b/tests/extmod/ujson_load.py index 7cec9246b8..b2c7733282 100644 --- a/tests/extmod/ujson_load.py +++ b/tests/extmod/ujson_load.py @@ -1,13 +1,9 @@ try: - from uio import StringIO - import ujson as json -except: - try: - from io import StringIO - import json - except ImportError: - print("SKIP") - raise SystemExit + from io import StringIO + import json +except ImportError: + print("SKIP") + raise SystemExit print(json.load(StringIO("null"))) print(json.load(StringIO('"abc\\u0064e"'))) diff --git a/tests/extmod/ujson_load_readinto.py b/tests/extmod/ujson_load_readinto.py index 001aa4fb2c..25e5c6cc0c 100644 --- a/tests/extmod/ujson_load_readinto.py +++ b/tests/extmod/ujson_load_readinto.py @@ -1,4 +1,4 @@ -import ujson as json +import json # Test that json can load from any object with readinto diff --git a/tests/extmod/ujson_loads.py b/tests/extmod/ujson_loads.py index 2de9cdcbc1..f9073c121e 100644 --- a/tests/extmod/ujson_loads.py +++ b/tests/extmod/ujson_loads.py @@ -1,11 +1,8 @@ try: - import ujson as json + import json except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit def my_print(o): diff --git a/tests/extmod/ujson_loads_bytes.py b/tests/extmod/ujson_loads_bytes.py index 3ee87bbcd5..45cd0a35c5 100644 --- a/tests/extmod/ujson_loads_bytes.py +++ b/tests/extmod/ujson_loads_bytes.py @@ -1,13 +1,10 @@ # test loading from bytes and bytearray (introduced in Python 3.6) try: - import ujson as json + import json except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit print(json.loads(b"[1,2]")) print(json.loads(bytearray(b"[null]"))) diff --git a/tests/extmod/ujson_loads_float.py b/tests/extmod/ujson_loads_float.py index 842718f37d..2a8402dc6a 100644 --- a/tests/extmod/ujson_loads_float.py +++ b/tests/extmod/ujson_loads_float.py @@ -1,11 +1,8 @@ try: - import ujson as json + import json except ImportError: - try: - import json - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit def my_print(o): diff --git a/tests/extmod/umsgpack_pack.py b/tests/extmod/umsgpack_pack.py index 7ea5ae8d6a..511ee642dd 100644 --- a/tests/extmod/umsgpack_pack.py +++ b/tests/extmod/umsgpack_pack.py @@ -1,13 +1,9 @@ try: - from uio import BytesIO - import umsgpack as msgpack -except: - try: - from io import BytesIO - import msgpack - except ImportError: - print("SKIP") - raise SystemExit + from io import BytesIO + import msgpack +except ImportError: + print("SKIP") + raise SystemExit b = BytesIO() msgpack.pack(False, s) diff --git a/tests/extmod/urandom_basic.py b/tests/extmod/urandom_basic.py index f7f5a6d691..e42373e30d 100644 --- a/tests/extmod/urandom_basic.py +++ b/tests/extmod/urandom_basic.py @@ -1,5 +1,5 @@ try: - import urandom as random + import random except ImportError: try: import random diff --git a/tests/extmod/urandom_extra.py b/tests/extmod/urandom_extra.py index 78e17379dc..aa05053377 100644 --- a/tests/extmod/urandom_extra.py +++ b/tests/extmod/urandom_extra.py @@ -1,11 +1,8 @@ try: - import urandom as random + import random except ImportError: - try: - import random - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: random.randint diff --git a/tests/extmod/urandom_extra_float.py b/tests/extmod/urandom_extra_float.py index 65918da136..3b37ed8dce 100644 --- a/tests/extmod/urandom_extra_float.py +++ b/tests/extmod/urandom_extra_float.py @@ -1,11 +1,8 @@ try: - import urandom as random + import random except ImportError: - try: - import random - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: random.randint diff --git a/tests/extmod/urandom_seed_default.py b/tests/extmod/urandom_seed_default.py index a032b9362b..241649c14b 100644 --- a/tests/extmod/urandom_seed_default.py +++ b/tests/extmod/urandom_seed_default.py @@ -1,13 +1,10 @@ # test urandom.seed() without any arguments try: - import urandom as random + import random except ImportError: - try: - import random - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: random.seed() diff --git a/tests/extmod/ure1.py b/tests/extmod/ure1.py index a75b2e8b70..32a71acc21 100644 --- a/tests/extmod/ure1.py +++ b/tests/extmod/ure1.py @@ -1,11 +1,8 @@ try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit r = re.compile(".+") m = r.match("abc") diff --git a/tests/extmod/ure_debug.py b/tests/extmod/ure_debug.py index 7a07ede2d4..0f4c95551f 100644 --- a/tests/extmod/ure_debug.py +++ b/tests/extmod/ure_debug.py @@ -1,10 +1,10 @@ # test printing debugging info when compiling try: - import ure + import re - ure.DEBUG + re.DEBUG except (ImportError, AttributeError): print("SKIP") raise SystemExit -ure.compile("^a|b[0-9]\w$", ure.DEBUG) +re.compile("^a|b[0-9]\w$", re.DEBUG) diff --git a/tests/extmod/ure_error.py b/tests/extmod/ure_error.py index 52a96b7c03..f61d091328 100644 --- a/tests/extmod/ure_error.py +++ b/tests/extmod/ure_error.py @@ -1,13 +1,10 @@ # test errors in regex try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit def test_re(r): diff --git a/tests/extmod/ure_group.py b/tests/extmod/ure_group.py index 41425dd623..06c9ccfb2d 100644 --- a/tests/extmod/ure_group.py +++ b/tests/extmod/ure_group.py @@ -1,13 +1,10 @@ # test groups, and nested groups try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit def print_groups(match): diff --git a/tests/extmod/ure_groups.py b/tests/extmod/ure_groups.py index 7da072a920..840a4b1af1 100644 --- a/tests/extmod/ure_groups.py +++ b/tests/extmod/ure_groups.py @@ -1,13 +1,10 @@ # test match.groups() try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: m = re.match(".", "a") diff --git a/tests/extmod/ure_limit.py b/tests/extmod/ure_limit.py index 99c6a818e8..e0531afbdc 100644 --- a/tests/extmod/ure_limit.py +++ b/tests/extmod/ure_limit.py @@ -1,7 +1,7 @@ -# Test overflow in ure.compile output code. +# Test overflow in re.compile output code. try: - import ure as re + import re except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ure_namedclass.py b/tests/extmod/ure_namedclass.py index 00d58ad98a..d2df7f23af 100644 --- a/tests/extmod/ure_namedclass.py +++ b/tests/extmod/ure_namedclass.py @@ -1,13 +1,10 @@ # test named char classes try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit def print_groups(match): diff --git a/tests/extmod/ure_span.py b/tests/extmod/ure_span.py index 03a3fef9f3..d00ef957a1 100644 --- a/tests/extmod/ure_span.py +++ b/tests/extmod/ure_span.py @@ -1,13 +1,10 @@ # test match.span(), and nested spans try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: m = re.match(".", "a") diff --git a/tests/extmod/ure_split.py b/tests/extmod/ure_split.py index 7e6ef3990f..7769e1a121 100644 --- a/tests/extmod/ure_split.py +++ b/tests/extmod/ure_split.py @@ -1,11 +1,8 @@ try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit r = re.compile(" ") s = r.split("a b c foobar") diff --git a/tests/extmod/ure_split_empty.py b/tests/extmod/ure_split_empty.py index 76ce97ea67..d386672308 100644 --- a/tests/extmod/ure_split_empty.py +++ b/tests/extmod/ure_split_empty.py @@ -1,11 +1,11 @@ # test splitting with pattern matches that can be empty # -# CPython 3.5 issues a FutureWarning for these tests because their -# behaviour will change in a future version. MicroPython just stops +# CPython 3.5 issues a FutreWarning for these tests because their +# behaviour will change in a futre version. MicroPython just stops # splitting as soon as an empty match is found. try: - import ure as re + import re except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ure_split_notimpl.py b/tests/extmod/ure_split_notimpl.py index 51bad791ef..7ddec9fa03 100644 --- a/tests/extmod/ure_split_notimpl.py +++ b/tests/extmod/ure_split_notimpl.py @@ -1,5 +1,5 @@ try: - import ure as re + import re except ImportError: print("SKIP") raise SystemExit diff --git a/tests/extmod/ure_stack_overflow.py b/tests/extmod/ure_stack_overflow.py index d3ce0c5a7b..90fb8296b1 100644 --- a/tests/extmod/ure_stack_overflow.py +++ b/tests/extmod/ure_stack_overflow.py @@ -1,11 +1,8 @@ try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: re.match("(a*)*", "aaa") diff --git a/tests/extmod/ure_sub.py b/tests/extmod/ure_sub.py index 806c389576..253b2dc482 100644 --- a/tests/extmod/ure_sub.py +++ b/tests/extmod/ure_sub.py @@ -1,11 +1,8 @@ try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: re.sub @@ -76,6 +73,6 @@ except TypeError: # Include \ in the sub replacement print(re.sub("b", "\\\\b", "abc")) -# Using ^, make sure it doesn't repeatedly match +# Using ^, make sre it doesn't repeatedly match print(re.sub("^ab", "*", "abababcabab")) print(re.sub("^ab|cab", "*", "abababcabab")) diff --git a/tests/extmod/ure_sub_unmatched.py b/tests/extmod/ure_sub_unmatched.py index d6312bfc2c..c238a7ed64 100644 --- a/tests/extmod/ure_sub_unmatched.py +++ b/tests/extmod/ure_sub_unmatched.py @@ -1,13 +1,10 @@ # test re.sub with unmatched groups, behaviour changed in CPython 3.5 try: - import ure as re + import re except ImportError: - try: - import re - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: re.sub diff --git a/tests/extmod/uselect_poll_basic.py b/tests/extmod/uselect_poll_basic.py deleted file mode 100644 index 97fbd6fd15..0000000000 --- a/tests/extmod/uselect_poll_basic.py +++ /dev/null @@ -1,42 +0,0 @@ -try: - import usocket as socket, uselect as select, uerrno as errno -except ImportError: - try: - import socket, select, errno - - select.poll # Raises AttributeError for CPython implementations without poll() - except (ImportError, AttributeError): - print("SKIP") - raise SystemExit - - -poller = select.poll() - -s = socket.socket() - -poller.register(s) -# https://docs.python.org/3/library/select.html#select.poll.register -# "Registering a file descriptor that’s already registered is not an error, -# and has the same effect as registering the descriptor exactly once." -poller.register(s) - -# 2 args are mandatory unlike register() -try: - poller.modify(s) -except TypeError: - print("modify:TypeError") - -poller.modify(s, select.POLLIN) - -poller.unregister(s) - -try: - poller.modify(s, select.POLLIN) -except OSError as e: - assert e.errno == errno.ENOENT - -# poll after closing the socket, should return POLLNVAL -poller.register(s) -s.close() -p = poller.poll(0) -print(len(p), p[0][-1]) diff --git a/tests/extmod/uselect_poll_udp.py b/tests/extmod/uselect_poll_udp.py deleted file mode 100644 index 2a56a122b5..0000000000 --- a/tests/extmod/uselect_poll_udp.py +++ /dev/null @@ -1,30 +0,0 @@ -# test select.poll on UDP sockets - -try: - import usocket as socket, uselect as select -except ImportError: - try: - import socket, select - - select.poll # Raises AttributeError for CPython implementations without poll() - except (ImportError, AttributeError): - print("SKIP") - raise SystemExit - - -s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) -s.bind(socket.getaddrinfo("127.0.0.1", 8000)[0][-1]) -poll = select.poll() - -# UDP socket should not be readable -poll.register(s, select.POLLIN) -print(len(poll.poll(0))) - -# UDP socket should be writable -poll.modify(s, select.POLLOUT) -print(poll.poll(0)[0][1] == select.POLLOUT) - -# same test for select.select, but just skip it if the function isn't available -if hasattr(select, "select"): - r, w, e = select.select([s], [], [], 0) - assert not r and not w and not e diff --git a/tests/extmod/usocket_tcp_basic.py b/tests/extmod/usocket_tcp_basic.py deleted file mode 100644 index c2fe8cd14c..0000000000 --- a/tests/extmod/usocket_tcp_basic.py +++ /dev/null @@ -1,17 +0,0 @@ -# Test basic, stand-alone TCP socket functionality - -try: - import usocket as socket, uerrno as errno -except ImportError: - try: - import socket, errno - except ImportError: - print("SKIP") - raise SystemExit - -# recv() on a fresh socket should raise ENOTCONN -s = socket.socket() -try: - s.recv(1) -except OSError as er: - print("ENOTCONN:", er.errno == errno.ENOTCONN) diff --git a/tests/extmod/usocket_udp_nonblock.py b/tests/extmod/usocket_udp_nonblock.py deleted file mode 100644 index bc560de142..0000000000 --- a/tests/extmod/usocket_udp_nonblock.py +++ /dev/null @@ -1,20 +0,0 @@ -# test non-blocking UDP sockets - -try: - import usocket as socket, uerrno as errno -except ImportError: - try: - import socket, errno - except ImportError: - print("SKIP") - raise SystemExit - - -s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) -s.bind(socket.getaddrinfo("127.0.0.1", 8000)[0][-1]) -s.settimeout(0) - -try: - s.recv(1) -except OSError as er: - print("EAGAIN:", er.errno == errno.EAGAIN) diff --git a/tests/extmod/ussl_basic.py b/tests/extmod/ussl_basic.py deleted file mode 100644 index 9e1821dca9..0000000000 --- a/tests/extmod/ussl_basic.py +++ /dev/null @@ -1,60 +0,0 @@ -# very basic test of ssl module, just to test the methods exist - -try: - import uio as io - import ussl as ssl -except ImportError: - print("SKIP") - raise SystemExit - -# create in client mode -try: - ss = ssl.wrap_socket(io.BytesIO(), server_hostname="test.example.com") -except OSError as er: - print("wrap_socket:", repr(er)) - -# create in server mode (can use this object for further tests) -socket = io.BytesIO() -ss = ssl.wrap_socket(socket, server_side=1) - -# print -print(repr(ss)[:12]) - -# setblocking() propagates call to the underlying stream object, and -# io.BytesIO doesn't have setblocking() (in CPython too). -# try: -# ss.setblocking(False) -# except NotImplementedError: -# print('setblocking: NotImplementedError') -# ss.setblocking(True) - -# write -print(ss.write(b"aaaa")) - -# read (underlying socket has no data) -print(ss.read(8)) - -# read (underlying socket has data, but it's bad data) -socket.write(b"aaaaaaaaaaaaaaaa") -socket.seek(0) -try: - ss.read(8) -except OSError as er: - print("read:", repr(er)) - -# close -ss.close() -# close 2nd time -ss.close() - -# read on closed socket -try: - ss.read(10) -except OSError as er: - print("read:", repr(er)) - -# write on closed socket -try: - ss.write(b"aaaa") -except OSError as er: - print("write:", repr(er)) diff --git a/tests/extmod/ussl_basic.py.exp b/tests/extmod/ussl_basic.py.exp deleted file mode 100644 index eb7df855aa..0000000000 --- a/tests/extmod/ussl_basic.py.exp +++ /dev/null @@ -1,7 +0,0 @@ -wrap_socket: OSError(-256, 'CONN_LOST') -<_SSLSocket -4 -b'' -read: OSError(-261,) -read: OSError(9,) -write: OSError(9,) diff --git a/tests/extmod/ussl_keycert.py b/tests/extmod/ussl_keycert.py deleted file mode 100644 index 87a40a1e55..0000000000 --- a/tests/extmod/ussl_keycert.py +++ /dev/null @@ -1,28 +0,0 @@ -# Test ussl with key/cert passed in - -try: - import uio as io - import ussl as ssl -except ImportError: - print("SKIP") - raise SystemExit - -key = b"0\x82\x019\x02\x01\x00\x02A\x00\xf9\xe0}\xbd\xd7\x9cI\x18\x06\xc3\xcb\xb5\xec@r\xfbD\x18\x80\xaaWoZ{\xcc\xa3\xeb!\"\x0fY\x9e]-\xee\xe4\t!BY\x9f{7\xf3\xf2\x8f}}\r|.\xa8<\ta\xb2\xd7W\xb3\xc9\x19A\xc39\x02\x03\x01\x00\x01\x02@\x07:\x9fh\xa6\x9c6\xe1#\x10\xf7\x0b\xc4Q\xf9\x01\x9b\xee\xb9\x8a4\r\\\xa8\xc8:\xd5\xca\x97\x99\xaa\x16\x04)\xa8\xf9\x13\xdeq\x0ev`\xa7\x83\xc5\x8b`\xdb\xef \x9d\x93\xe8g\x84\x96\xfaV\\\xf4R\xda\xd0\xa1\x02!\x00\xfeR\xbf\n\x91Su\x87L\x98{\xeb%\xed\xfb\x06u)@\xfe\x1b\xde\xa0\xc6@\xab\xc5\xedg\x8e\x10[\x02!\x00\xfb\x86=\x85\xa4'\xde\x85\xb5L\xe0)\x99\xfaL\x8c3A\x02\xa8<\xdew\xad\x00\xe3\x1d\x05\xd8\xb4N\xfb\x02 \x08\xb0M\x04\x90hx\x88q\xcew\xd5U\xcbf\x9b\x16\xdf\x9c\xef\xd1\x85\xee\x9a7Ug\x02\xb0Z\x03'\x02 9\xa0D\xe2$|\xf9\xefz]5\x92rs\xb5+\xfd\xe6,\x1c\xadmn\xcf\xd5?3|\x0em)\x17\x02 5Z\xcc/\xa5?\n\x04%\x9b{N\x9dX\xddI\xbe\xd2\xb0\xa0\x03BQ\x02\x82\xc2\xe0u)\xbd\xb8\xaf" - -# Invalid key -try: - ssl.wrap_socket(io.BytesIO(), key=b"!") -except ValueError as er: - print(repr(er)) - -# Valid key, no cert -try: - ssl.wrap_socket(io.BytesIO(), key=key) -except TypeError as er: - print(repr(er)) - -# Valid key, invalid cert -try: - ssl.wrap_socket(io.BytesIO(), key=key, cert=b"!") -except ValueError as er: - print(repr(er)) diff --git a/tests/extmod/ussl_keycert.py.exp b/tests/extmod/ussl_keycert.py.exp deleted file mode 100644 index b72d319c6a..0000000000 --- a/tests/extmod/ussl_keycert.py.exp +++ /dev/null @@ -1,3 +0,0 @@ -ValueError('invalid key',) -TypeError("can't convert 'NoneType' object to str implicitly",) -ValueError('invalid cert',) diff --git a/tests/extmod/utime_res.py b/tests/extmod/utime_res.py index 4b62433483..548bef1f17 100644 --- a/tests/extmod/utime_res.py +++ b/tests/extmod/utime_res.py @@ -1,18 +1,18 @@ -# test utime resolutions +# test time resolutions try: - import utime + import time except ImportError: print("SKIP") raise SystemExit def gmtime_time(): - return utime.gmtime(utime.time()) + return time.gmtime(time.time()) def localtime_time(): - return utime.localtime(utime.time()) + return time.localtime(time.time()) def test(): @@ -32,12 +32,12 @@ def test(): # call time functions results_map = {} - end_time = utime.ticks_ms() + TEST_TIME - while utime.ticks_diff(end_time, utime.ticks_ms()) > 0: - utime.sleep_ms(100) + end_time = time.ticks_ms() + TEST_TIME + while time.ticks_diff(end_time, time.ticks_ms()) > 0: + time.sleep_ms(100) for func_name, _ in EXPECTED_MAP: try: - time_func = getattr(utime, func_name, None) or globals()[func_name] + time_func = getattr(time, func_name, None) or globals()[func_name] now = time_func() # may raise AttributeError except (KeyError, AttributeError): continue diff --git a/tests/extmod/utime_time_ns.py b/tests/extmod/utime_time_ns.py index 0d13f839d4..3ef58e56a9 100644 --- a/tests/extmod/utime_time_ns.py +++ b/tests/extmod/utime_time_ns.py @@ -1,18 +1,18 @@ -# test utime.time_ns() +# test time.time_ns() try: - import utime + import time - utime.sleep_us - utime.time_ns + time.sleep_us + time.time_ns except (ImportError, AttributeError): print("SKIP") raise SystemExit -t0 = utime.time_ns() -utime.sleep_us(5000) -t1 = utime.time_ns() +t0 = time.time_ns() +time.sleep_us(5000) +t1 = time.time_ns() # Check that time_ns increases. print(t0 < t1) diff --git a/tests/extmod/utimeq1.py b/tests/extmod/utimeq1.py deleted file mode 100644 index 688e5b834f..0000000000 --- a/tests/extmod/utimeq1.py +++ /dev/null @@ -1,146 +0,0 @@ -# Test for utimeq module which implements task queue with support for -# wraparound time (utime.ticks_ms() style). -try: - from utime import ticks_add, ticks_diff - from utimeq import utimeq -except ImportError: - print("SKIP") - raise SystemExit - -DEBUG = 0 - -MAX = ticks_add(0, -1) -MODULO_HALF = MAX // 2 + 1 - -if DEBUG: - - def dprint(*v): - print(*v) - -else: - - def dprint(*v): - pass - - -# Try not to crash on invalid data -h = utimeq(10) -try: - h.push(1) - assert False -except TypeError: - pass - -try: - h.pop(1) - assert False -except IndexError: - pass - -# unsupported unary op -try: - ~h - assert False -except TypeError: - pass - -# pushing on full queue -h = utimeq(1) -h.push(1, 0, 0) -try: - h.push(2, 0, 0) - assert False -except IndexError: - pass - -# popping into invalid type -try: - h.pop([]) - assert False -except TypeError: - pass - -# length -assert len(h) == 1 - -# peektime -assert h.peektime() == 1 - -# peektime with empty queue -try: - utimeq(1).peektime() - assert False -except IndexError: - pass - - -def pop_all(h): - l = [] - while h: - item = [0, 0, 0] - h.pop(item) - # print("!", item) - l.append(tuple(item)) - dprint(l) - return l - - -def add(h, v): - h.push(v, 0, 0) - dprint("-----") - # h.dump() - dprint("-----") - - -h = utimeq(10) -add(h, 0) -add(h, MAX) -add(h, MAX - 1) -add(h, 101) -add(h, 100) -add(h, MAX - 2) -dprint(h) -l = pop_all(h) -for i in range(len(l) - 1): - diff = ticks_diff(l[i + 1][0], l[i][0]) - assert diff > 0 - - -def edge_case(edge, offset): - h = utimeq(10) - add(h, ticks_add(0, offset)) - add(h, ticks_add(edge, offset)) - dprint(h) - l = pop_all(h) - diff = ticks_diff(l[1][0], l[0][0]) - dprint(diff, diff > 0) - return diff - - -dprint("===") -diff = edge_case(MODULO_HALF - 1, 0) -assert diff == MODULO_HALF - 1 -assert edge_case(MODULO_HALF - 1, 100) == diff -assert edge_case(MODULO_HALF - 1, -100) == diff - -# We expect diff to be always positive, per the definition of heappop() which should return -# the smallest value. -# This is the edge case where this invariant breaks, due to asymmetry of two's-complement -# range - there's one more negative integer than positive, so heappushing values like below -# will then make ticks_diff() return the minimum negative value. We could make heappop -# return them in a different order, but ticks_diff() result would be the same. Conclusion: -# never add to a heap values where (a - b) == MODULO_HALF (and which are >= MODULO_HALF -# ticks apart in real time of course). -dprint("===") -diff = edge_case(MODULO_HALF, 0) -assert diff == -MODULO_HALF -assert edge_case(MODULO_HALF, 100) == diff -assert edge_case(MODULO_HALF, -100) == diff - -dprint("===") -diff = edge_case(MODULO_HALF + 1, 0) -assert diff == MODULO_HALF - 1 -assert edge_case(MODULO_HALF + 1, 100) == diff -assert edge_case(MODULO_HALF + 1, -100) == diff - -print("OK") diff --git a/tests/extmod/utimeq1.py.exp b/tests/extmod/utimeq1.py.exp deleted file mode 100644 index d86bac9de5..0000000000 --- a/tests/extmod/utimeq1.py.exp +++ /dev/null @@ -1 +0,0 @@ -OK diff --git a/tests/extmod/utimeq_stable.py b/tests/extmod/utimeq_stable.py deleted file mode 100644 index 9fb522d514..0000000000 --- a/tests/extmod/utimeq_stable.py +++ /dev/null @@ -1,22 +0,0 @@ -try: - from utimeq import utimeq -except ImportError: - print("SKIP") - raise SystemExit - -h = utimeq(10) - -# Check that for 2 same-key items, the queue is stable (pops items -# in the same order they were pushed). Unfortunately, this no longer -# holds for more same-key values, as the underlying heap structure -# is not stable itself. -h.push(100, 20, 0) -h.push(100, 10, 0) - -res = [0, 0, 0] -h.pop(res) -assert res == [100, 20, 0] -h.pop(res) -assert res == [100, 10, 0] - -print("OK") diff --git a/tests/extmod/utimeq_stable.py.exp b/tests/extmod/utimeq_stable.py.exp deleted file mode 100644 index d86bac9de5..0000000000 --- a/tests/extmod/utimeq_stable.py.exp +++ /dev/null @@ -1 +0,0 @@ -OK diff --git a/tests/extmod/uzlib_decompio.py b/tests/extmod/uzlib_decompio.py index 6a0aae8bcd..ce3b7f4a99 100644 --- a/tests/extmod/uzlib_decompio.py +++ b/tests/extmod/uzlib_decompio.py @@ -1,10 +1,16 @@ try: - import uzlib as zlib - import uio as io + import zlib + import io except ImportError: print("SKIP") raise SystemExit +try: + zlib.decompIO +except AttributeError: + print("SKIP") + raise SystemExit + # Raw DEFLATE bitstream buf = io.BytesIO(b"\xcbH\xcd\xc9\xc9\x07\x00") diff --git a/tests/extmod/uzlib_decompio_gz.py b/tests/extmod/uzlib_decompio_gz.py index 1bc8ba885b..348bf2678d 100644 --- a/tests/extmod/uzlib_decompio_gz.py +++ b/tests/extmod/uzlib_decompio_gz.py @@ -1,10 +1,16 @@ try: - import uzlib as zlib - import uio as io + import zlib + import io except ImportError: print("SKIP") raise SystemExit +try: + zlib.decompIO +except AttributeError: + print("SKIP") + raise SystemExit + # gzip bitstream buf = io.BytesIO( diff --git a/tests/extmod/uzlib_decompress.py b/tests/extmod/uzlib_decompress.py index 8d4a9640b4..b72ee96ea8 100644 --- a/tests/extmod/uzlib_decompress.py +++ b/tests/extmod/uzlib_decompress.py @@ -1,11 +1,8 @@ try: import zlib except ImportError: - try: - import uzlib as zlib - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit PATTERNS = [ # Packed results produced by CPy's zlib.compress() diff --git a/tests/extmod/vfs_basic.py b/tests/extmod/vfs_basic.py index 9a9ef2ca61..028846406a 100644 --- a/tests/extmod/vfs_basic.py +++ b/tests/extmod/vfs_basic.py @@ -1,9 +1,9 @@ # test VFS functionality without any particular filesystem type try: - import uos + import os - uos.mount + os.mount except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -59,35 +59,35 @@ class Filesystem: # first we umount any existing mount points the target may have try: - uos.umount("/") + os.umount("/") except OSError: pass -for path in uos.listdir("/"): - uos.umount("/" + path) +for path in os.listdir("/"): + os.umount("/" + path) # stat root dir -print(uos.stat("/")) +print(os.stat("/")) # statvfs root dir; verify that f_namemax has a sensible size -print(uos.statvfs("/")[9] >= 32) +print(os.statvfs("/")[9] >= 32) # getcwd when in root dir -print(uos.getcwd()) +print(os.getcwd()) # test operations on the root directory with nothing mounted, they should all fail for func in ("chdir", "listdir", "mkdir", "remove", "rmdir", "stat"): for arg in ("x", "/x"): try: - getattr(uos, func)(arg) + getattr(os, func)(arg) except OSError: print(func, arg, "OSError") # basic mounting and listdir -uos.mount(Filesystem(1), "/test_mnt") -print(uos.listdir()) +os.mount(Filesystem(1), "/test_mnt") +print(os.listdir()) # ilistdir -i = uos.ilistdir() +i = os.ilistdir() print(next(i)) try: next(i) @@ -99,88 +99,88 @@ except StopIteration: print("StopIteration") # referencing the mount point in different ways -print(uos.listdir("test_mnt")) -print(uos.listdir("/test_mnt")) +print(os.listdir("test_mnt")) +print(os.listdir("/test_mnt")) # mounting another filesystem -uos.mount(Filesystem(2), "/test_mnt2", readonly=True) -print(uos.listdir()) -print(uos.listdir("/test_mnt2")) +os.mount(Filesystem(2), "/test_mnt2", readonly=True) +print(os.listdir()) +print(os.listdir("/test_mnt2")) # mounting over an existing mount point try: - uos.mount(Filesystem(3), "/test_mnt2") + os.mount(Filesystem(3), "/test_mnt2") except OSError: print("OSError") # mkdir of a mount point try: - uos.mkdir("/test_mnt") + os.mkdir("/test_mnt") except OSError: print("OSError") # rename across a filesystem try: - uos.rename("/test_mnt/a", "/test_mnt2/b") + os.rename("/test_mnt/a", "/test_mnt2/b") except OSError: print("OSError") # delegating to mounted filesystem -uos.chdir("test_mnt") -print(uos.listdir()) -print(uos.getcwd()) -uos.mkdir("test_dir") -uos.remove("test_file") -uos.rename("test_file", "test_file2") -uos.rmdir("test_dir") -print(uos.stat("test_file")) -print(uos.statvfs("/test_mnt")) +os.chdir("test_mnt") +print(os.listdir()) +print(os.getcwd()) +os.mkdir("test_dir") +os.remove("test_file") +os.rename("test_file", "test_file2") +os.rmdir("test_dir") +print(os.stat("test_file")) +print(os.statvfs("/test_mnt")) open("test_file") open("test_file", "wb") # umount -uos.umount("/test_mnt") -uos.umount("/test_mnt2") +os.umount("/test_mnt") +os.umount("/test_mnt2") # umount a non-existent mount point try: - uos.umount("/test_mnt") + os.umount("/test_mnt") except OSError: print("OSError") # root dir -uos.mount(Filesystem(3), "/") -print(uos.stat("/")) -print(uos.statvfs("/")) -print(uos.listdir()) +os.mount(Filesystem(3), "/") +print(os.stat("/")) +print(os.statvfs("/")) +print(os.listdir()) open("test") -uos.mount(Filesystem(4), "/mnt") -print(uos.listdir()) -print(uos.listdir("/mnt")) -uos.chdir("/mnt") -print(uos.listdir()) +os.mount(Filesystem(4), "/mnt") +print(os.listdir()) +print(os.listdir("/mnt")) +os.chdir("/mnt") +print(os.listdir()) # chdir to a subdir within root-mounted vfs, and then listdir -uos.chdir("/subdir") -print(uos.listdir()) -uos.chdir("/") +os.chdir("/subdir") +print(os.listdir()) +os.chdir("/") -uos.umount("/") -print(uos.listdir("/")) -uos.umount("/mnt") +os.umount("/") +print(os.listdir("/")) +os.umount("/mnt") # chdir to a non-existent mount point (current directory should remain unchanged) try: - uos.chdir("/foo") + os.chdir("/foo") except OSError: print("OSError") -print(uos.getcwd()) +print(os.getcwd()) # chdir to a non-existent subdirectory in a mounted filesystem -uos.mount(Filesystem(5, 1), "/mnt") +os.mount(Filesystem(5, 1), "/mnt") try: - uos.chdir("/mnt/subdir") + os.chdir("/mnt/subdir") except OSError: print("OSError") -print(uos.getcwd()) +print(os.getcwd()) diff --git a/tests/extmod/vfs_blockdev.py b/tests/extmod/vfs_blockdev.py index e24169ba93..333ac7f183 100644 --- a/tests/extmod/vfs_blockdev.py +++ b/tests/extmod/vfs_blockdev.py @@ -1,10 +1,10 @@ # Test for behaviour of combined standard and extended block device try: - import uos + import os - uos.VfsFat - uos.VfsLfs2 + os.VfsFat + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -70,5 +70,5 @@ except MemoryError: print("SKIP") raise SystemExit -test(bdev, uos.VfsFat) -test(bdev, uos.VfsLfs2) +test(bdev, os.VfsFat) +test(bdev, os.VfsLfs2) diff --git a/tests/extmod/vfs_fat_case.py b/tests/extmod/vfs_fat_case.py index cb02264dcb..bf2c18ea69 100644 --- a/tests/extmod/vfs_fat_case.py +++ b/tests/extmod/vfs_fat_case.py @@ -1,8 +1,8 @@ -import errno as uerrno -import os as uos +import errno +import os as os try: - uos.VfsFat + os.VfsFat except AttributeError: print("SKIP") raise SystemExit @@ -40,10 +40,10 @@ except MemoryError: print("SKIP") raise SystemExit -uos.VfsFat.mkfs(bdev) -vfs = uos.VfsFat(bdev) -uos.mount(vfs, "/ramdisk") -uos.chdir("/ramdisk") +os.VfsFat.mkfs(bdev) +vfs = os.VfsFat(bdev) +os.mount(vfs, "/ramdisk") +os.chdir("/ramdisk") vfs.label = "labelæ" # This label would normally be LABELÆ but our limited upper casing does "LABELæ" @@ -51,22 +51,22 @@ print(vfs.label) # Check ASCII case-insensitivity vfs.mkdir("fooaz") -print(uos.listdir("")) +print(os.listdir("")) vfs.rmdir("fOOAZ") # Check ASCII case-insensitivity for long names (8+ characters) vfs.mkdir("123456789fooaz") -print(uos.listdir("")) +print(os.listdir("")) vfs.rmdir("123456789fOOAZ") # Characters outside of a-z are case sensitive. vfs.mkdir("extended_æ") -print(uos.listdir("")) +print(os.listdir("")) # Normally this would work ok. With our limited uppercasing, it won't. try: vfs.rmdir("extended_Æ") except OSError as e: - print(e.errno == uerrno.ENOENT) + print(e.errno == errno.ENOENT) vfs.rmdir("extended_æ") diff --git a/tests/extmod/vfs_fat_fileio1.py b/tests/extmod/vfs_fat_fileio1.py index 935f01d24f..3bc85af9f8 100644 --- a/tests/extmod/vfs_fat_fileio1.py +++ b/tests/extmod/vfs_fat_fileio1.py @@ -1,12 +1,12 @@ try: - import uerrno - import uos + import errno + import os except ImportError: print("SKIP") raise SystemExit try: - uos.VfsFat + os.VfsFat except AttributeError: print("SKIP") raise SystemExit @@ -43,10 +43,10 @@ except MemoryError: print("SKIP") raise SystemExit -uos.VfsFat.mkfs(bdev) -vfs = uos.VfsFat(bdev) -uos.mount(vfs, "/ramdisk") -uos.chdir("/ramdisk") +os.VfsFat.mkfs(bdev) +vfs = os.VfsFat(bdev) +os.mount(vfs, "/ramdisk") +os.chdir("/ramdisk") # file IO f = open("foo_file.txt", "w") @@ -58,22 +58,22 @@ f.close() # allowed try: f.write("world!") except OSError as e: - print(e.errno == uerrno.EINVAL) + print(e.errno == errno.EINVAL) try: f.read() except OSError as e: - print(e.errno == uerrno.EINVAL) + print(e.errno == errno.EINVAL) try: f.flush() except OSError as e: - print(e.errno == uerrno.EINVAL) + print(e.errno == errno.EINVAL) try: open("foo_file.txt", "x") except OSError as e: - print(e.errno == uerrno.EEXIST) + print(e.errno == errno.EEXIST) with open("foo_file.txt", "a") as f: f.write("world!") @@ -105,7 +105,7 @@ vfs.mkdir("foo_dir") try: vfs.rmdir("foo_file.txt") except OSError as e: - print(e.errno == 20) # uerrno.ENOTDIR + print(e.errno == 20) # errno.ENOTDIR vfs.remove("foo_file.txt") print(list(vfs.ilistdir())) diff --git a/tests/extmod/vfs_fat_fileio2.py b/tests/extmod/vfs_fat_fileio2.py index 6094b5a6f1..e243f2839b 100644 --- a/tests/extmod/vfs_fat_fileio2.py +++ b/tests/extmod/vfs_fat_fileio2.py @@ -1,12 +1,12 @@ try: - import uerrno - import uos + import errno + import os except ImportError: print("SKIP") raise SystemExit try: - uos.VfsFat + os.VfsFat except AttributeError: print("SKIP") raise SystemExit @@ -44,35 +44,35 @@ except MemoryError: print("SKIP") raise SystemExit -uos.VfsFat.mkfs(bdev) -vfs = uos.VfsFat(bdev) -uos.mount(vfs, "/ramdisk") -uos.chdir("/ramdisk") +os.VfsFat.mkfs(bdev) +vfs = os.VfsFat(bdev) +os.mount(vfs, "/ramdisk") +os.chdir("/ramdisk") try: vfs.mkdir("foo_dir") except OSError as e: - print(e.errno == uerrno.EEXIST) + print(e.errno == errno.EEXIST) try: vfs.remove("foo_dir") except OSError as e: - print(e.errno == uerrno.EISDIR) + print(e.errno == errno.EISDIR) try: vfs.remove("no_file.txt") except OSError as e: - print(e.errno == uerrno.ENOENT) + print(e.errno == errno.ENOENT) try: vfs.rename("foo_dir", "/null/file") except OSError as e: - print(e.errno == uerrno.ENOENT) + print(e.errno == errno.ENOENT) try: vfs.rename("foo_dir", "foo_dir/inside_itself") except OSError as e: - print(e.errno == uerrno.EINVAL) + print(e.errno == errno.EINVAL) # file in dir with open("foo_dir/file-in-dir.txt", "w+t") as f: @@ -88,7 +88,7 @@ with open("foo_dir/sub_file.txt", "w") as f: try: vfs.rmdir("foo_dir") except OSError as e: - print(e.errno == uerrno.EACCES) + print(e.errno == errno.EACCES) # trim full path vfs.rename("foo_dir/file-in-dir.txt", "foo_dir/file.txt") @@ -117,5 +117,5 @@ try: f = open("large_file.txt", "wb") f.write(bytearray(bsize * free)) except OSError as e: - print("ENOSPC:", e.errno == 28) # uerrno.ENOSPC + print("ENOSPC:", e.errno == 28) # errno.ENOSPC f.close() diff --git a/tests/extmod/vfs_fat_finaliser.py b/tests/extmod/vfs_fat_finaliser.py index 91cce2c95b..37929fd1e3 100644 --- a/tests/extmod/vfs_fat_finaliser.py +++ b/tests/extmod/vfs_fat_finaliser.py @@ -1,9 +1,9 @@ # Test VfsFat class and its finaliser try: - import uerrno, uos + import errno, os - uos.VfsFat + os.VfsFat except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -37,8 +37,8 @@ except MemoryError: raise SystemExit # Format block device and create VFS object -uos.VfsFat.mkfs(bdev) -vfs = uos.VfsFat(bdev) +os.VfsFat.mkfs(bdev) +vfs = os.VfsFat(bdev) # Here we test that opening a file with the heap locked fails correctly. This # is a special case because file objects use a finaliser and allocating with a diff --git a/tests/extmod/vfs_fat_more.py b/tests/extmod/vfs_fat_more.py index f5de729402..9096024c4a 100644 --- a/tests/extmod/vfs_fat_more.py +++ b/tests/extmod/vfs_fat_more.py @@ -1,11 +1,11 @@ try: - import uos + import os except ImportError: print("SKIP") raise SystemExit try: - uos.VfsFat + os.VfsFat except AttributeError: print("SKIP") raise SystemExit @@ -46,70 +46,70 @@ except MemoryError: # first we umount any existing mount points the target may have try: - uos.umount("/") + os.umount("/") except OSError: pass -for path in uos.listdir("/"): - uos.umount("/" + path) +for path in os.listdir("/"): + os.umount("/" + path) -uos.VfsFat.mkfs(bdev) -uos.mount(bdev, "/") +os.VfsFat.mkfs(bdev) +os.mount(bdev, "/") -print(uos.getcwd()) +print(os.getcwd()) f = open("test.txt", "w") f.write("hello") f.close() -print(uos.listdir()) -print(uos.listdir("/")) -print(uos.stat("")[:-3]) -print(uos.stat("/")[:-3]) -print(uos.stat("test.txt")[:-3]) -print(uos.stat("/test.txt")[:-3]) +print(os.listdir()) +print(os.listdir("/")) +print(os.stat("")[:-3]) +print(os.stat("/")[:-3]) +print(os.stat("test.txt")[:-3]) +print(os.stat("/test.txt")[:-3]) f = open("/test.txt") print(f.read()) f.close() -uos.rename("test.txt", "test2.txt") -print(uos.listdir()) -uos.rename("test2.txt", "/test3.txt") -print(uos.listdir()) -uos.rename("/test3.txt", "test4.txt") -print(uos.listdir()) -uos.rename("/test4.txt", "/test5.txt") -print(uos.listdir()) +os.rename("test.txt", "test2.txt") +print(os.listdir()) +os.rename("test2.txt", "/test3.txt") +print(os.listdir()) +os.rename("/test3.txt", "test4.txt") +print(os.listdir()) +os.rename("/test4.txt", "/test5.txt") +print(os.listdir()) -uos.mkdir("dir") -print(uos.listdir()) -uos.mkdir("/dir2") -print(uos.listdir()) -uos.mkdir("dir/subdir") -print(uos.listdir("dir")) +os.mkdir("dir") +print(os.listdir()) +os.mkdir("/dir2") +print(os.listdir()) +os.mkdir("dir/subdir") +print(os.listdir("dir")) for exist in ("", "/", "dir", "/dir", "dir/subdir"): try: - uos.mkdir(exist) + os.mkdir(exist) except OSError as er: print("mkdir OSError", er.errno == 17) # EEXIST -uos.chdir("/") -print(uos.stat("test5.txt")[:-3]) +os.chdir("/") +print(os.stat("test5.txt")[:-3]) -uos.VfsFat.mkfs(bdev2) -uos.mount(bdev2, "/sys") -print(uos.listdir()) -print(uos.listdir("sys")) -print(uos.listdir("/sys")) +os.VfsFat.mkfs(bdev2) +os.mount(bdev2, "/sys") +print(os.listdir()) +print(os.listdir("sys")) +print(os.listdir("/sys")) -uos.rmdir("dir2") -uos.remove("test5.txt") -print(uos.listdir()) +os.rmdir("dir2") +os.remove("test5.txt") +print(os.listdir()) -uos.umount("/") -print(uos.getcwd()) -print(uos.listdir()) -print(uos.listdir("sys")) +os.umount("/") +print(os.getcwd()) +print(os.listdir()) +print(os.listdir("sys")) # test importing a file from a mounted FS import sys diff --git a/tests/extmod/vfs_fat_mtime.py b/tests/extmod/vfs_fat_mtime.py index d8fd66b75f..1ceb611364 100644 --- a/tests/extmod/vfs_fat_mtime.py +++ b/tests/extmod/vfs_fat_mtime.py @@ -1,11 +1,11 @@ # Test for VfsFat using a RAM device, mtime feature try: - import utime, uos + import time, os - utime.time - utime.sleep - uos.VfsFat + time.time + time.sleep + os.VfsFat except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -44,11 +44,11 @@ def test(bdev, vfs_class): vfs = vfs_class(bdev) # Create an empty file, should have a timestamp. - current_time = int(utime.time()) + current_time = int(time.time()) vfs.open("test1", "wt").close() # Wait 2 seconds so mtime will increase (FAT has 2 second resolution). - utime.sleep(2) + time.sleep(2) # Create another empty file, should have a timestamp. vfs.open("test2", "wt").close() @@ -71,4 +71,4 @@ def test(bdev, vfs_class): bdev = RAMBlockDevice(50) -test(bdev, uos.VfsFat) +test(bdev, os.VfsFat) diff --git a/tests/extmod/vfs_fat_oldproto.py b/tests/extmod/vfs_fat_oldproto.py index 1998319dbe..df8a13c96e 100644 --- a/tests/extmod/vfs_fat_oldproto.py +++ b/tests/extmod/vfs_fat_oldproto.py @@ -1,12 +1,12 @@ try: - import uerrno - import uos + import errno + import os except ImportError: print("SKIP") raise SystemExit try: - uos.VfsFat + os.VfsFat except AttributeError: print("SKIP") raise SystemExit @@ -43,9 +43,9 @@ except MemoryError: print("SKIP") raise SystemExit -uos.VfsFat.mkfs(bdev) -vfs = uos.VfsFat(bdev) -uos.mount(vfs, "/ramdisk") +os.VfsFat.mkfs(bdev) +vfs = os.VfsFat(bdev) +os.mount(vfs, "/ramdisk") # file io with vfs.open("file.txt", "w") as f: diff --git a/tests/extmod/vfs_fat_ramdisk.py b/tests/extmod/vfs_fat_ramdisk.py index a22d480dfd..9a5c49a6cc 100644 --- a/tests/extmod/vfs_fat_ramdisk.py +++ b/tests/extmod/vfs_fat_ramdisk.py @@ -1,12 +1,12 @@ try: - import uerrno - import uos + import errno + import os except ImportError: print("SKIP") raise SystemExit try: - uos.VfsFat + os.VfsFat except AttributeError: print("SKIP") raise SystemExit @@ -44,13 +44,13 @@ except MemoryError: print("SKIP") raise SystemExit -uos.VfsFat.mkfs(bdev) +os.VfsFat.mkfs(bdev) print(b"FOO_FILETXT" not in bdev.data) print(b"hello!" not in bdev.data) -vfs = uos.VfsFat(bdev) -uos.mount(vfs, "/ramdisk") +vfs = os.VfsFat(bdev) +os.mount(vfs, "/ramdisk") vfs.label = "label test" print("label:", vfs.label) @@ -60,7 +60,7 @@ print("getcwd:", vfs.getcwd()) try: vfs.stat("no_file.txt") except OSError as e: - print(e.errno == uerrno.ENOENT) + print(e.errno == errno.ENOENT) with vfs.open("foo_file.txt", "w") as f: f.write("hello!") @@ -83,18 +83,18 @@ with vfs.open("sub_file.txt", "w") as f: try: vfs.chdir("sub_file.txt") except OSError as e: - print(e.errno == uerrno.ENOENT) + print(e.errno == errno.ENOENT) vfs.chdir("..") print("getcwd:", vfs.getcwd()) -uos.umount(vfs) +os.umount(vfs) -vfs = uos.VfsFat(bdev) +vfs = os.VfsFat(bdev) print(list(vfs.ilistdir(b""))) # list a non-existent directory try: vfs.ilistdir(b"no_exist") except OSError as e: - print("ENOENT:", e.errno == uerrno.ENOENT) + print("ENOENT:", e.errno == errno.ENOENT) diff --git a/tests/extmod/vfs_fat_ramdisklarge.py b/tests/extmod/vfs_fat_ramdisklarge.py index 649a53db14..40cba9ee43 100644 --- a/tests/extmod/vfs_fat_ramdisklarge.py +++ b/tests/extmod/vfs_fat_ramdisklarge.py @@ -1,13 +1,13 @@ # test making a FAT filesystem on a very large block device try: - import uos + import os except ImportError: print("SKIP") raise SystemExit try: - uos.VfsFat + os.VfsFat except AttributeError: print("SKIP") raise SystemExit @@ -46,13 +46,13 @@ class RAMBDevSparse: try: bdev = RAMBDevSparse(4 * 1024 * 1024 * 1024 // RAMBDevSparse.SEC_SIZE) - uos.VfsFat.mkfs(bdev) + os.VfsFat.mkfs(bdev) except MemoryError: print("SKIP") raise SystemExit -vfs = uos.VfsFat(bdev) -uos.mount(vfs, "/ramdisk") +vfs = os.VfsFat(bdev) +os.mount(vfs, "/ramdisk") print("statvfs:", vfs.statvfs("/ramdisk")) @@ -66,4 +66,4 @@ f = open("/ramdisk/test.txt") print(f.read()) f.close() -uos.umount(vfs) +os.umount(vfs) diff --git a/tests/extmod/vfs_lfs.py b/tests/extmod/vfs_lfs.py index 8e56400df3..f555e00b8c 100644 --- a/tests/extmod/vfs_lfs.py +++ b/tests/extmod/vfs_lfs.py @@ -1,10 +1,10 @@ # Test for VfsLittle using a RAM device try: - import uos + import os - uos.VfsLfs1 - uos.VfsLfs2 + os.VfsLfs1 + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -115,7 +115,7 @@ def test(bdev, vfs_class): vfs.chdir("/testdir") print(vfs.getcwd()) - # create file in directory to make sure paths are relative + # create file in directory to make sre paths are relative vfs.open("test2", "w").close() print_stat(vfs.stat("test2")) print_stat(vfs.stat("/testdir/test2")) @@ -150,5 +150,5 @@ def test(bdev, vfs_class): bdev = RAMBlockDevice(30) -test(bdev, uos.VfsLfs1) -test(bdev, uos.VfsLfs2) +test(bdev, os.VfsLfs1) +test(bdev, os.VfsLfs2) diff --git a/tests/extmod/vfs_lfs_corrupt.py b/tests/extmod/vfs_lfs_corrupt.py index 330458709a..c49dcad92b 100644 --- a/tests/extmod/vfs_lfs_corrupt.py +++ b/tests/extmod/vfs_lfs_corrupt.py @@ -1,10 +1,10 @@ # Test for VfsLittle using a RAM device, testing error handling from corrupt block device try: - import uos + import os - uos.VfsLfs1 - uos.VfsLfs2 + os.VfsLfs1 + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -108,5 +108,5 @@ def test(bdev, vfs_class): bdev = RAMBlockDevice(30) -test(bdev, uos.VfsLfs1) -test(bdev, uos.VfsLfs2) +test(bdev, os.VfsLfs1) +test(bdev, os.VfsLfs2) diff --git a/tests/extmod/vfs_lfs_error.py b/tests/extmod/vfs_lfs_error.py index 717284ea01..32b76b2821 100644 --- a/tests/extmod/vfs_lfs_error.py +++ b/tests/extmod/vfs_lfs_error.py @@ -1,10 +1,10 @@ # Test for VfsLittle using a RAM device, testing error handling try: - import uos + import os - uos.VfsLfs1 - uos.VfsLfs2 + os.VfsLfs1 + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -117,5 +117,5 @@ def test(bdev, vfs_class): bdev = RAMBlockDevice(30) -test(bdev, uos.VfsLfs1) -test(bdev, uos.VfsLfs2) +test(bdev, os.VfsLfs1) +test(bdev, os.VfsLfs2) diff --git a/tests/extmod/vfs_lfs_file.py b/tests/extmod/vfs_lfs_file.py index 0920173200..574ce1eecb 100644 --- a/tests/extmod/vfs_lfs_file.py +++ b/tests/extmod/vfs_lfs_file.py @@ -1,10 +1,10 @@ # Test for VfsLittle using a RAM device, file IO try: - import uos + import os - uos.VfsLfs1 - uos.VfsLfs2 + os.VfsLfs1 + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -117,5 +117,5 @@ def test(bdev, vfs_class): bdev = RAMBlockDevice(30) -test(bdev, uos.VfsLfs1) -test(bdev, uos.VfsLfs2) +test(bdev, os.VfsLfs1) +test(bdev, os.VfsLfs2) diff --git a/tests/extmod/vfs_lfs_mount.py b/tests/extmod/vfs_lfs_mount.py index c9926708c6..4ebd9ac623 100644 --- a/tests/extmod/vfs_lfs_mount.py +++ b/tests/extmod/vfs_lfs_mount.py @@ -1,10 +1,10 @@ # Test for VfsLittle using a RAM device, with mount/umount try: - import uos + import os - uos.VfsLfs1 - uos.VfsLfs2 + os.VfsLfs1 + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -42,7 +42,7 @@ def test(vfs_class): # mount bdev unformatted try: - uos.mount(bdev, "/lfs") + os.mount(bdev, "/lfs") except Exception as er: print(repr(er)) @@ -53,7 +53,7 @@ def test(vfs_class): vfs = vfs_class(bdev) # mount - uos.mount(vfs, "/lfs") + os.mount(vfs, "/lfs") # import with open("/lfs/lfsmod.py", "w") as f: @@ -61,23 +61,23 @@ def test(vfs_class): import lfsmod # import package - uos.mkdir("/lfs/lfspkg") + os.mkdir("/lfs/lfspkg") with open("/lfs/lfspkg/__init__.py", "w") as f: f.write('print("package")\n') import lfspkg # chdir and import module from current directory (needs "" in sys.path) - uos.mkdir("/lfs/subdir") - uos.chdir("/lfs/subdir") - uos.rename("/lfs/lfsmod.py", "/lfs/subdir/lfsmod2.py") + os.mkdir("/lfs/subdir") + os.chdir("/lfs/subdir") + os.rename("/lfs/lfsmod.py", "/lfs/subdir/lfsmod2.py") import lfsmod2 # umount - uos.umount("/lfs") + os.umount("/lfs") # mount read-only vfs = vfs_class(bdev) - uos.mount(vfs, "/lfs", readonly=True) + os.mount(vfs, "/lfs", readonly=True) # test reading works with open("/lfs/subdir/lfsmod2.py") as f: @@ -90,13 +90,13 @@ def test(vfs_class): print(repr(er)) # umount - uos.umount("/lfs") + os.umount("/lfs") # mount bdev again - uos.mount(bdev, "/lfs") + os.mount(bdev, "/lfs") # umount - uos.umount("/lfs") + os.umount("/lfs") # clear imported modules sys.modules.clear() @@ -110,5 +110,5 @@ sys.path.append("/lfs") sys.path.append("") # run tests -test(uos.VfsLfs1) -test(uos.VfsLfs2) +test(os.VfsLfs1) +test(os.VfsLfs2) diff --git a/tests/extmod/vfs_lfs_mtime.py b/tests/extmod/vfs_lfs_mtime.py index bacdd2246c..bd8ae7b2a2 100644 --- a/tests/extmod/vfs_lfs_mtime.py +++ b/tests/extmod/vfs_lfs_mtime.py @@ -1,11 +1,11 @@ # Test for VfsLfs using a RAM device, mtime feature try: - import utime, uos + import time, os - utime.time - utime.sleep - uos.VfsLfs2 + time.time + time.sleep + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -47,11 +47,11 @@ def test(bdev, vfs_class): vfs = vfs_class(bdev, mtime=True) # Create an empty file, should have a timestamp. - current_time = int(utime.time()) + current_time = int(time.time()) vfs.open("test1", "wt").close() # Wait 1 second so mtime will increase by at least 1. - utime.sleep(1) + time.sleep(1) # Create another empty file, should have a timestamp. vfs.open("test2", "wt").close() @@ -68,13 +68,13 @@ def test(bdev, vfs_class): print(stat1[8] < stat2[8]) # Wait 1 second so mtime will increase by at least 1. - utime.sleep(1) + time.sleep(1) - # Open test1 for reading and ensure mtime did not change. + # Open test1 for reading and ensre mtime did not change. vfs.open("test1", "rt").close() print(vfs.stat("test1") == stat1) - # Open test1 for writing and ensure mtime increased from the previous value. + # Open test1 for writing and ensre mtime increased from the previous value. vfs.open("test1", "wt").close() stat1_old = stat1 stat1 = vfs.stat("test1") @@ -102,4 +102,4 @@ def test(bdev, vfs_class): bdev = RAMBlockDevice(30) -test(bdev, uos.VfsLfs2) +test(bdev, os.VfsLfs2) diff --git a/tests/extmod/vfs_lfs_superblock.py b/tests/extmod/vfs_lfs_superblock.py index 1ac5675554..b8a8ec60b9 100644 --- a/tests/extmod/vfs_lfs_superblock.py +++ b/tests/extmod/vfs_lfs_superblock.py @@ -1,9 +1,9 @@ # Test for VfsLfs using a RAM device, when the first superblock does not exist try: - import uos + import os - uos.VfsLfs2 + os.VfsLfs2 except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -36,12 +36,12 @@ lfs2_data = b"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x bdev = RAMBlockDevice(64, lfs2_data) # Create the VFS explicitly, no auto-detection is needed for this. -vfs = uos.VfsLfs2(bdev) +vfs = os.VfsLfs2(bdev) print(list(vfs.ilistdir())) # Mount the block device directly; this relies on auto-detection. -uos.mount(bdev, "/userfs") -print(uos.listdir("/userfs")) +os.mount(bdev, "/userfs") +print(os.listdir("/userfs")) # Clean up. -uos.umount("/userfs") +os.umount("/userfs") diff --git a/tests/extmod/vfs_posix.py b/tests/extmod/vfs_posix.py index 2a14fc2076..61c948cf5b 100644 --- a/tests/extmod/vfs_posix.py +++ b/tests/extmod/vfs_posix.py @@ -1,9 +1,9 @@ # Test for VfsPosix try: - import uos + import os - uos.VfsPosix + os.VfsPosix except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -12,27 +12,27 @@ except (ImportError, AttributeError): # Skip the test if it does exist. temp_dir = "micropy_test_dir" try: - uos.stat(temp_dir) + os.stat(temp_dir) print("SKIP") raise SystemExit except OSError: pass # getcwd and chdir -curdir = uos.getcwd() -uos.chdir("/") -print(uos.getcwd()) -uos.chdir(curdir) -print(uos.getcwd() == curdir) +curdir = os.getcwd() +os.chdir("/") +print(os.getcwd()) +os.chdir(curdir) +print(os.getcwd() == curdir) # stat -print(type(uos.stat("/"))) +print(type(os.stat("/"))) # listdir and ilistdir -print(type(uos.listdir("/"))) +print(type(os.listdir("/"))) # mkdir -uos.mkdir(temp_dir) +os.mkdir(temp_dir) # file create f = open(temp_dir + "/test", "w") @@ -52,11 +52,11 @@ print(f.read()) f.close() # rename -uos.rename(temp_dir + "/test", temp_dir + "/test2") -print(uos.listdir(temp_dir)) +os.rename(temp_dir + "/test", temp_dir + "/test2") +print(os.listdir(temp_dir)) # construct new VfsPosix with path argument -vfs = uos.VfsPosix(temp_dir) +vfs = os.VfsPosix(temp_dir) print(list(i[0] for i in vfs.ilistdir("."))) # stat, statvfs (statvfs may not exist) @@ -69,21 +69,21 @@ print(type(list(vfs.ilistdir("."))[0][0])) print(type(list(vfs.ilistdir(b"."))[0][0])) # remove -uos.remove(temp_dir + "/test2") -print(uos.listdir(temp_dir)) +os.remove(temp_dir + "/test2") +print(os.listdir(temp_dir)) # remove with error try: - uos.remove(temp_dir + "/test2") + os.remove(temp_dir + "/test2") except OSError: print("remove OSError") # rmdir -uos.rmdir(temp_dir) -print(temp_dir in uos.listdir()) +os.rmdir(temp_dir) +print(temp_dir in os.listdir()) # rmdir with error try: - uos.rmdir(temp_dir) + os.rmdir(temp_dir) except OSError: print("rmdir OSError") diff --git a/tests/extmod/vfs_userfs.py b/tests/extmod/vfs_userfs.py index 3cdfe82eea..518373c70a 100644 --- a/tests/extmod/vfs_userfs.py +++ b/tests/extmod/vfs_userfs.py @@ -1,21 +1,21 @@ # test VFS functionality with a user-defined filesystem -# also tests parts of uio.IOBase implementation +# also tests parts of io.IOBase implementation import sys try: - import uio + import io - uio.IOBase - import uos + io.IOBase + import os - uos.mount + os.mount except (ImportError, AttributeError): print("SKIP") raise SystemExit -class UserFile(uio.IOBase): +class UserFile(io.IOBase): def __init__(self, mode, data): assert isinstance(data, bytes) self.is_text = mode.find("b") == -1 @@ -69,7 +69,7 @@ user_files = { "/usermod1.py": b"print('in usermod1')\nimport usermod2", "/usermod2.py": b"print('in usermod2')", } -uos.mount(UserFS(user_files), "/userfs") +os.mount(UserFS(user_files), "/userfs") # open and read a file f = open("/userfs/data.txt") @@ -80,5 +80,5 @@ sys.path.append("/userfs") import usermod1 # unmount and undo path addition -uos.umount("/userfs") +os.umount("/userfs") sys.path.pop() diff --git a/tests/feature_check/uio_module.py b/tests/feature_check/io_module.py similarity index 56% rename from tests/feature_check/uio_module.py rename to tests/feature_check/io_module.py index bad8d7c95b..9094e60531 100644 --- a/tests/feature_check/uio_module.py +++ b/tests/feature_check/io_module.py @@ -1,6 +1,6 @@ try: - import uio + import io - print("uio") + print("io") except ImportError: print("no") diff --git a/tests/feature_check/uio_module.py.exp b/tests/feature_check/io_module.py.exp similarity index 100% rename from tests/feature_check/uio_module.py.exp rename to tests/feature_check/io_module.py.exp diff --git a/tests/float/float2int_doubleprec_intbig.py b/tests/float/float2int_doubleprec_intbig.py index 1226b39ca9..e2876f5d7c 100644 --- a/tests/float/float2int_doubleprec_intbig.py +++ b/tests/float/float2int_doubleprec_intbig.py @@ -1,9 +1,6 @@ # check cases converting float to int, requiring double precision float -try: - import ustruct as struct -except: - import struct +import struct import sys diff --git a/tests/float/float2int_fp30_intbig.py b/tests/float/float2int_fp30_intbig.py index a1bfe67046..3d3795f94d 100644 --- a/tests/float/float2int_fp30_intbig.py +++ b/tests/float/float2int_fp30_intbig.py @@ -1,9 +1,6 @@ # check cases converting float to int, relying only on single precision float -try: - import ustruct as struct -except: - import struct +import struct import sys diff --git a/tests/float/float2int_intbig.py b/tests/float/float2int_intbig.py index 06b651bb72..a9d7b57211 100644 --- a/tests/float/float2int_intbig.py +++ b/tests/float/float2int_intbig.py @@ -1,9 +1,6 @@ # check cases converting float to int, relying only on single precision float -try: - import ustruct as struct -except: - import struct +import struct import sys diff --git a/tests/float/float_struct.py b/tests/float/float_struct.py index 18893af0e0..47fe405018 100644 --- a/tests/float/float_struct.py +++ b/tests/float/float_struct.py @@ -1,9 +1,6 @@ # test struct package with floats try: - try: - import ustruct as struct - except: - import struct + import struct except ImportError: print("SKIP") raise SystemExit diff --git a/tests/inlineasm/asmsum.py b/tests/inlineasm/asmsum.py index 208709a25f..51613ef6ac 100644 --- a/tests/inlineasm/asmsum.py +++ b/tests/inlineasm/asmsum.py @@ -46,7 +46,7 @@ def asm_sum_bytes(r0, r1): mov(r0, r2) -import uarray as array +import array b = array.array("l", (100, 200, 300, 400)) n = asm_sum_words(len(b), b) diff --git a/tests/io/open_append.py b/tests/io/open_append.py index 49cdd094b3..80a9422d81 100644 --- a/tests/io/open_append.py +++ b/tests/io/open_append.py @@ -1,7 +1,4 @@ -try: - import uos as os -except ImportError: - import os +import os if not hasattr(os, "remove"): print("SKIP") diff --git a/tests/io/open_plus.py b/tests/io/open_plus.py index 3cb2330eed..5199861a4e 100644 --- a/tests/io/open_plus.py +++ b/tests/io/open_plus.py @@ -1,7 +1,4 @@ -try: - import uos as os -except ImportError: - import os +import os if not hasattr(os, "remove"): print("SKIP") diff --git a/tests/micropython/emg_exc.py b/tests/micropython/emg_exc.py index acc39c5dc9..e26fd62e49 100644 --- a/tests/micropython/emg_exc.py +++ b/tests/micropython/emg_exc.py @@ -4,7 +4,7 @@ import micropython import sys try: - import uio + import io except ImportError: print("SKIP") raise SystemExit diff --git a/tests/micropython/heapalloc_bytesio2.py b/tests/micropython/heapalloc_bytesio2.py index 3b9f141270..05c384a516 100644 --- a/tests/micropython/heapalloc_bytesio2.py +++ b/tests/micropython/heapalloc_bytesio2.py @@ -1,7 +1,7 @@ # Creating BytesIO from immutable object should not immediately # copy its content. try: - import uio + import io import micropython micropython.mem_total @@ -14,7 +14,7 @@ data = b"1234" * 256 before = micropython.mem_total() -buf = uio.BytesIO(data) +buf = io.BytesIO(data) after = micropython.mem_total() diff --git a/tests/micropython/heapalloc_iter.py b/tests/micropython/heapalloc_iter.py index 18f5322ee1..bd1ba4db79 100644 --- a/tests/micropython/heapalloc_iter.py +++ b/tests/micropython/heapalloc_iter.py @@ -5,13 +5,10 @@ except NameError: print("SKIP") raise SystemExit try: - import uarray as array + import array except ImportError: - try: - import array - except ImportError: - print("SKIP") - raise SystemExit + print("SKIP") + raise SystemExit try: from micropython import heap_lock, heap_unlock diff --git a/tests/micropython/import_mpy_invalid.py b/tests/micropython/import_mpy_invalid.py index 894fc582ce..d2f0c9db28 100644 --- a/tests/micropython/import_mpy_invalid.py +++ b/tests/micropython/import_mpy_invalid.py @@ -1,16 +1,16 @@ # test importing of invalid .mpy files try: - import sys, uio, uos + import sys, io, os - uio.IOBase - uos.mount + io.IOBase + os.mount except (ImportError, AttributeError): print("SKIP") raise SystemExit -class UserFile(uio.IOBase): +class UserFile(io.IOBase): def __init__(self, data): self.data = memoryview(data) self.pos = 0 @@ -55,7 +55,7 @@ user_files = { } # create and mount a user filesystem -uos.mount(UserFS(user_files), "/userfs") +os.mount(UserFS(user_files), "/userfs") sys.path.append("/userfs") # import .mpy files from the user filesystem @@ -67,5 +67,5 @@ for i in range(len(user_files)): print(mod, type(e).__name__, e) # unmount and undo path addition -uos.umount("/userfs") +os.umount("/userfs") sys.path.pop() diff --git a/tests/micropython/import_mpy_native.py b/tests/micropython/import_mpy_native.py index 0dfbca9086..2829de47aa 100644 --- a/tests/micropython/import_mpy_native.py +++ b/tests/micropython/import_mpy_native.py @@ -1,10 +1,10 @@ # test importing of .mpy files with native code (x64 only) try: - import sys, uio, uos + import sys, io, os - uio.IOBase - uos.mount + io.IOBase + os.mount except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -15,7 +15,7 @@ if mpy_arch == 0: raise SystemExit -class UserFile(uio.IOBase): +class UserFile(io.IOBase): def __init__(self, data): self.data = memoryview(data) self.pos = 0 @@ -108,7 +108,7 @@ user_files = { # fmt: on # create and mount a user filesystem -uos.mount(UserFS(user_files), "/userfs") +os.mount(UserFS(user_files), "/userfs") sys.path.append("/userfs") # import .mpy files from the user filesystem @@ -121,5 +121,5 @@ for i in range(len(user_files)): print(mod, "ValueError", er) # unmount and undo path addition -uos.umount("/userfs") +os.umount("/userfs") sys.path.pop() diff --git a/tests/micropython/import_mpy_native_gc.py b/tests/micropython/import_mpy_native_gc.py index 1234184aed..39d7740216 100644 --- a/tests/micropython/import_mpy_native_gc.py +++ b/tests/micropython/import_mpy_native_gc.py @@ -1,17 +1,17 @@ # Test that native code loaded from a .mpy file is retained after a GC. try: - import gc, sys, uio, uos + import gc, sys, io, os sys.implementation._mpy - uio.IOBase - uos.mount + io.IOBase + os.mount except (ImportError, AttributeError): print("SKIP") raise SystemExit -class UserFile(uio.IOBase): +class UserFile(io.IOBase): def __init__(self, data): self.data = memoryview(data) self.pos = 0 @@ -66,7 +66,7 @@ if sys.implementation._mpy not in features0_file_contents: user_files = {"/features0.mpy": features0_file_contents[sys.implementation._mpy]} # Create and mount a user filesystem. -uos.mount(UserFS(user_files), "/userfs") +os.mount(UserFS(user_files), "/userfs") sys.path.append("/userfs") # Import the native function. @@ -87,5 +87,5 @@ for i in range(1000): print(factorial(10)) # Unmount and undo path addition. -uos.umount("/userfs") +os.umount("/userfs") sys.path.pop() diff --git a/tests/micropython/opt_level.py b/tests/micropython/opt_level.py index dd5493a7a3..8ba7b3a228 100644 --- a/tests/micropython/opt_level.py +++ b/tests/micropython/opt_level.py @@ -1,4 +1,4 @@ -import micropython as micropython +import micropython # check we can get and set the level micropython.opt_level(0) diff --git a/tests/perf_bench/bm_hexiom.py b/tests/perf_bench/bm_hexiom.py index 84eda9a909..e36fc234cd 100644 --- a/tests/perf_bench/bm_hexiom.py +++ b/tests/perf_bench/bm_hexiom.py @@ -632,10 +632,7 @@ bm_params = { def bm_setup(params): - try: - import uio as io - except ImportError: - import io + import io loops, level, order, strategy = params diff --git a/tests/perf_bench/core_import_mpy_multi.py b/tests/perf_bench/core_import_mpy_multi.py index 682c36328a..4e098eef81 100644 --- a/tests/perf_bench/core_import_mpy_multi.py +++ b/tests/perf_bench/core_import_mpy_multi.py @@ -1,8 +1,8 @@ # Test performance of importing an .mpy file many times. -import usys, uio, uos +import usys, io, os -if not (hasattr(uio, "IOBase") and hasattr(uos, "mount")): +if not (hasattr(io, "IOBase") and hasattr(os, "mount")): print("SKIP") raise SystemExit @@ -26,7 +26,7 @@ result = 123 file_data = b'M\x06\x00\x1f\x14\x03\x0etest.py\x00\x0f\x02A\x00\x02f\x00\x0cresult\x00/-5#\x82I\x81{\x81w\x82/\x81\x05\x81\x17Iom\x82\x13\x06arg\x00\x05\x1cthis will be a string object\x00\x06\x1bthis will be a bytes object\x00\n\x07\x05\x0bconst tuple\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\x81\\\x10\n\x01\x89\x07d`T2\x00\x10\x024\x02\x16\x022\x01\x16\x03"\x80{\x16\x04Qc\x02\x81d\x00\x08\x02(DD\x11\x05\x16\x06\x10\x02\x16\x072\x00\x16\x082\x01\x16\t2\x02\x16\nQc\x03`\x1a\x08\x08\x12\x13@\xb1\xb0\x18\x13Qc@\t\x08\t\x12` Qc@\t\x08\n\x12``Qc\x82@ \x0e\x03\x80\x08+)##\x12\x0b\x12\x0c\x12\r\x12\x0e*\x04Y\x12\x0f\x12\x10\x12\x11*\x03Y#\x00\xc0#\x01\xc0#\x02\xc0Qc' -class File(uio.IOBase): +class File(io.IOBase): def __init__(self): self.off = 0 @@ -57,8 +57,8 @@ class FS: def mount(): - uos.mount(FS(), "/__remote") - uos.chdir("/__remote") + os.mount(FS(), "/__remote") + os.chdir("/__remote") def test(r): diff --git a/tests/perf_bench/core_import_mpy_single.py b/tests/perf_bench/core_import_mpy_single.py index af3f4a29b2..1b411fc3fb 100644 --- a/tests/perf_bench/core_import_mpy_single.py +++ b/tests/perf_bench/core_import_mpy_single.py @@ -2,9 +2,9 @@ # The first import of a module will intern strings that don't already exist, and # this test should be representative of what happens in a real application. -import uio, uos +import io, os -if not (hasattr(uio, "IOBase") and hasattr(uos, "mount")): +if not (hasattr(io, "IOBase") and hasattr(os, "mount")): print("SKIP") raise SystemExit @@ -81,7 +81,7 @@ result = 123 file_data = b"M\x06\x00\x1f\x81=\x1e\x0etest.py\x00\x0f\x04A0\x00\x04A1\x00\x04f0\x00\x04f1\x00\x0cresult\x00/-5\x04a0\x00\x04a1\x00\x04a2\x00\x04a3\x00\x13\x15\x17\x19\x1b\x1d\x1f!#%')+1379;=?ACEGIKMOQSUWY[]_acegikmoqsuwy{}\x7f\x81\x01\x81\x03\x81\x05\x81\x07\x81\t\x81\x0b\x81\r\x81\x0f\x81\x11\x81\x13\x81\x15\x81\x17\x81\x19\x81\x1b\x81\x1d\x81\x1f\x81!\x81#\x81%\x81'\x81)\x81+\x81-\x81/\x811\x813\x815\x817\x819\x81;\x81=\x81?\x81A\x81C\x81E\x81G\x81I\x81K\x81M\x81O\x81Q\x81S\x81U\x81W\x81Y\x81[\x81]\x81_\x81a\x81c\x81e\x81g\x81i\x81k\x81m\x81o\x81q\x81s\x81u\x81w\x81y\x81{\x81}\x81\x7f\x82\x01\x82\x03\x82\x05\x82\x07\x82\t\x82\x0b\x82\r\x82\x0f\x82\x11\x82\x13\x82\x15\x82\x17\x82\x19\x82\x1b\x82\x1d\x82\x1f\x82!\x82#\x82%\x82'\x82)\x82+\x82-\x82/\x821\x823\x825\x827\x829\x82;\x82=\x82?\x82A\x82E\x82G\x82I\x82K\nname0\x00\nname1\x00\nname2\x00\nname3\x00\nname4\x00\nname5\x00\nname6\x00\nname7\x00\nname8\x00\nname9\x00$quite_a_long_name0\x00$quite_a_long_name1\x00$quite_a_long_name2\x00$quite_a_long_name3\x00$quite_a_long_name4\x00$quite_a_long_name5\x00$quite_a_long_name6\x00$quite_a_long_name7\x00$quite_a_long_name8\x00$quite_a_long_name9\x00&quite_a_long_name10\x00&quite_a_long_name11\x00\x05\x1ethis will be a string object 0\x00\x05\x1ethis will be a string object 1\x00\x05\x1ethis will be a string object 2\x00\x05\x1ethis will be a string object 3\x00\x05\x1ethis will be a string object 4\x00\x05\x1ethis will be a string object 5\x00\x05\x1ethis will be a string object 6\x00\x05\x1ethis will be a string object 7\x00\x05\x1ethis will be a string object 8\x00\x05\x1ethis will be a string object 9\x00\x06\x1dthis will be a bytes object 0\x00\x06\x1dthis will be a bytes object 1\x00\x06\x1dthis will be a bytes object 2\x00\x06\x1dthis will be a bytes object 3\x00\x06\x1dthis will be a bytes object 4\x00\x06\x1dthis will be a bytes object 5\x00\x06\x1dthis will be a bytes object 6\x00\x06\x1dthis will be a bytes object 7\x00\x06\x1dthis will be a bytes object 8\x00\x06\x1dthis will be a bytes object 9\x00\n\x07\x05\rconst tuple 0\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 1\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 2\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 3\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 4\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 5\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 6\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 7\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 8\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\n\x07\x05\rconst tuple 9\x00\x01\x02\x03\x07\x011\x07\x012\x07\x013\x82d\x10\x12\x01i@i@\x84\x18\x84\x1fT2\x00\x10\x024\x02\x16\x02T2\x01\x10\x034\x02\x16\x032\x02\x16\x042\x03\x16\x05\"\x80{\x16\x06Qc\x04\x82\x0c\x00\n\x02($$$\x11\x07\x16\x08\x10\x02\x16\t2\x00\x16\n2\x01\x16\x0b2\x02\x16\x0c2\x03\x16\rQc\x04@\t\x08\n\x81\x0b Qc@\t\x08\x0b\x81\x0b@Qc@\t\x08\x0c\x81\x0b`QcH\t\n\r\x81\x0b` Qc\x82\x14\x00\x0c\x03h`$$$\x11\x07\x16\x08\x10\x03\x16\t2\x00\x16\n2\x01\x16\x0b2\x02\x16\x0c2\x03\x16\rQc\x04H\t\n\n\x81\x0b``QcH\t\n\x0b\x81\x0b\x80\x07QcH\t\n\x0c\x81\x0b\x80\x08QcH\t\n\r\x81\x0b\x80\tQc\xa08P:\x04\x80\x0b13///---997799<\x1f%\x1f\"\x1f%)\x1f\"//\x12\x0e\x12\x0f\x12\x10\x12\x11\x12\x12\x12\x13\x12\x14*\x07Y\x12\x15\x12\x16\x12\x17\x12\x18\x12\x19\x12\x1a\x12\x08\x12\x07*\x08Y\x12\x1b\x12\x1c\x12\t\x12\x1d\x12\x1e\x12\x1f*\x06Y\x12 \x12!\x12\"\x12#\x12$\x12%*\x06Y\x12&\x12'\x12(\x12)\x12*\x12+*\x06Y\x12,\x12-\x12.\x12/\x120*\x05Y\x121\x122\x123\x124\x125*\x05Y\x126\x127\x128\x129\x12:*\x05Y\x12;\x12<\x12=\x12>\x12?\x12@\x12A\x12B\x12C\x12D\x12E*\x0bY\x12F\x12G\x12H\x12I\x12J\x12K\x12L\x12M\x12N\x12O\x12P*\x0bY\x12Q\x12R\x12S\x12T\x12U\x12V\x12W\x12X\x12Y\x12Z*\nY\x12[\x12\\\x12]\x12^\x12_\x12`\x12a\x12b\x12c\x12d*\nY\x12e\x12f\x12g\x12h\x12i\x12j\x12k\x12l\x12m\x12n\x12o*\x0bY\x12p\x12q\x12r\x12s\x12t\x12u\x12v\x12w\x12x\x12y\x12z*\x0bY\x12{\x12|\x12}\x12~\x12\x7f\x12\x81\x00\x12\x81\x01\x12\x81\x02\x12\x81\x03\x12\x81\x04*\nY\x12\x81\x05\x12\x81\x06\x12\x81\x07\x12\x81\x08\x12\x81\t\x12\x81\n\x12\x81\x0b\x12\x81\x0c\x12\x81\r\x12\x81\x0e\x12\x81\x0f*\x0bY\x12\x81\x10\x12\x81\x11\x12\x81\x12\x12\x81\x13\x12\x81\x14\x12\x81\x15\x12\x81\x16\x12\x81\x17\x12\x81\x18\x12\x81\x19*\nY\x12\x81\x1a\x12\x81\x1b\x12\x81\x1c\x12\x81\x1d\x12\x81\x1e\x12\x81\x1f\x12\x81 \x12\x81!\x12\x81\"\x12\x81#\x12\x81$*\x0bY\x12\x81%\x12\x81&*\x02Y\x12\x81'\x12\x81(\x12\x81)\x12\x81*\x12\x81+\x12\x81,\x12\x81-\x12\x81.\x12\x81/\x12\x810*\nY\x12\x811\x12\x812\x12\x813\x12\x814*\x04Y\x12\x815\x12\x816\x12\x817\x12\x818*\x04Y\x12\x819\x12\x81:\x12\x81;\x12\x81<*\x04YQc\x87p\x08@\x05\x80###############################\x00\xc0#\x01\xc0#\x02\xc0#\x03\xc0#\x04\xc0#\x05\xc0#\x06\xc0#\x07\xc0#\x08\xc0#\t\xc0#\n\xc0#\x0b\xc0#\x0c\xc0#\r\xc0#\x0e\xc0#\x0f\xc0#\x10\xc0#\x11\xc0#\x12\xc0#\x13\xc0#\x14\xc0#\x15\xc0#\x16\xc0#\x17\xc0#\x18\xc0#\x19\xc0#\x1a\xc0#\x1b\xc0#\x1c\xc0#\x1d\xc0Qc" -class File(uio.IOBase): +class File(io.IOBase): def __init__(self): self.off = 0 @@ -112,8 +112,8 @@ class FS: def mount(): - uos.mount(FS(), "/__remote") - uos.chdir("/__remote") + os.mount(FS(), "/__remote") + os.chdir("/__remote") def test(): diff --git a/tests/run-natmodtests.py b/tests/run-natmodtests.py index a957fbb6b6..2a0997c185 100755 --- a/tests/run-natmodtests.py +++ b/tests/run-natmodtests.py @@ -22,13 +22,13 @@ TEST_MAPPINGS = { "uheapq": "uheapq/uheapq_$(ARCH).mpy", "urandom": "urandom/urandom_$(ARCH).mpy", "ure": "ure/ure_$(ARCH).mpy", - "uzlib": "uzlib/uzlib_$(ARCH).mpy", + "zlib": "zlib/zlib_$(ARCH).mpy", } # Code to allow a target MicroPython to import an .mpy from RAM injected_import_hook_code = """\ -import sys, uos, uio -class __File(uio.IOBase): +import sys, os, io +class __File(io.IOBase): def __init__(self): self.off = 0 def ioctl(self, request, arg): @@ -49,8 +49,8 @@ class __FS: raise OSError(-2) # ENOENT def open(self, path, mode): return __File() -uos.mount(__FS(), '/__remote') -uos.chdir('/__remote') +os.mount(__FS(), '/__remote') +os.chdir('/__remote') sys.modules['{}'] = __import__('__injected') """ diff --git a/tests/run-tests-exp.py b/tests/run-tests-exp.py index bf8ce32ea8..bbb057f4ce 100644 --- a/tests/run-tests-exp.py +++ b/tests/run-tests-exp.py @@ -6,7 +6,7 @@ # which is to be tested, so should use minimal language functionality. # import sys -import uos as os +import os tests = ["basics", "micropython", "float", "import", "io", " misc", "unicode", "extmod", "unix"] diff --git a/tests/run-tests.py b/tests/run-tests.py index 45b4ebf536..9f55f0ebab 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -355,9 +355,9 @@ def run_tests(pyb, tests, args, result_dir, num_threads=1): if output == b"TypeError\n": skip_revops = True - # Check if uio module exists, and skip such tests if it doesn't - output = run_feature_check(pyb, args, base_path, "uio_module.py") - if output != b"uio\n": + # Check if io module exists, and skip such tests if it doesn't + output = run_feature_check(pyb, args, base_path, "io_module.py") + if output != b"io\n": skip_io_module = True # Check if fstring feature is enabled, and skip such tests if it doesn't diff --git a/tests/stress/recursive_data.py b/tests/stress/recursive_data.py index 3b7fa50952..6e01319ed3 100644 --- a/tests/stress/recursive_data.py +++ b/tests/stress/recursive_data.py @@ -1,6 +1,6 @@ # This tests that printing recursive data structure doesn't lead to segfault. try: - import uio as io + import io except ImportError: print("SKIP") raise SystemExit diff --git a/tests/thread/stress_aes.py b/tests/thread/stress_aes.py index 0ff5544aa8..319087c487 100644 --- a/tests/thread/stress_aes.py +++ b/tests/thread/stress_aes.py @@ -218,10 +218,7 @@ class AES: ################################################################## # test code -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/stress_heap.py b/tests/thread/stress_heap.py index 41dfa5f376..9487b310ac 100644 --- a/tests/thread/stress_heap.py +++ b/tests/thread/stress_heap.py @@ -5,10 +5,7 @@ # # SPDX-License-Identifier: MIT -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/thread_exit1.py b/tests/thread/thread_exit1.py index a6b00ca1f7..8e405c0d0f 100644 --- a/tests/thread/thread_exit1.py +++ b/tests/thread/thread_exit1.py @@ -4,10 +4,7 @@ # # SPDX-License-Identifier: MIT -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/thread_exit2.py b/tests/thread/thread_exit2.py index 2381fa5ebc..842eabf895 100644 --- a/tests/thread/thread_exit2.py +++ b/tests/thread/thread_exit2.py @@ -4,10 +4,7 @@ # # SPDX-License-Identifier: MIT -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/thread_lock2.py b/tests/thread/thread_lock2.py index c43b4b18d1..b476de2f7c 100644 --- a/tests/thread/thread_lock2.py +++ b/tests/thread/thread_lock2.py @@ -4,10 +4,7 @@ # # SPDX-License-Identifier: MIT -try: - import utime as time -except ImportError: - import time +import time import _thread lock = _thread.allocate_lock() diff --git a/tests/thread/thread_lock4.py b/tests/thread/thread_lock4.py index 7637d10b96..faa1fd724a 100644 --- a/tests/thread/thread_lock4.py +++ b/tests/thread/thread_lock4.py @@ -4,10 +4,7 @@ # # SPDX-License-Identifier: MIT -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/thread_qstr1.py b/tests/thread/thread_qstr1.py index 9e7d7f0326..97783bd090 100644 --- a/tests/thread/thread_qstr1.py +++ b/tests/thread/thread_qstr1.py @@ -4,10 +4,7 @@ # # SPDX-License-Identifier: MIT -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/thread_start1.py b/tests/thread/thread_start1.py index 6f08a135e4..673e46261b 100644 --- a/tests/thread/thread_start1.py +++ b/tests/thread/thread_start1.py @@ -4,10 +4,7 @@ # # SPDX-License-Identifier: MIT -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/thread/thread_start2.py b/tests/thread/thread_start2.py index 40f8a05227..114a1025e2 100644 --- a/tests/thread/thread_start2.py +++ b/tests/thread/thread_start2.py @@ -4,10 +4,7 @@ # # SPDX-License-Identifier: MIT -try: - import utime as time -except ImportError: - import time +import time import _thread diff --git a/tests/unix/extra_coverage.py b/tests/unix/extra_coverage.py index bb22485026..32b8d90892 100644 --- a/tests/unix/extra_coverage.py +++ b/tests/unix/extra_coverage.py @@ -4,8 +4,8 @@ except NameError: print("SKIP") raise SystemExit -import uerrno -import uio +import errno +import io data = extra_coverage() @@ -18,7 +18,7 @@ print(hash(str(data[1], "utf8"))) # test streams stream = data[2] # has set_error and set_buf. Write always returns error -stream.set_error(uerrno.EAGAIN) # non-blocking error +stream.set_error(errno.EAGAIN) # non-blocking error print(stream.read()) # read all encounters non-blocking error print(stream.read(1)) # read 1 byte encounters non-blocking error print(stream.readline()) # readline encounters non-blocking error @@ -42,8 +42,8 @@ stream2 = data[3] # is textio print(stream2.read(1)) # read 1 byte encounters non-blocking error with textio stream # test BufferedWriter with stream errors -stream.set_error(uerrno.EAGAIN) -buf = uio.BufferedWriter(stream, 8) +stream.set_error(errno.EAGAIN) +buf = io.BufferedWriter(stream, 8) print(buf.write(bytearray(16))) # function defined in C++ code diff --git a/tests/unix/extra_coverage.py.exp b/tests/unix/extra_coverage.py.exp index b9742461e4..f91b64db3e 100644 --- a/tests/unix/extra_coverage.py.exp +++ b/tests/unix/extra_coverage.py.exp @@ -46,25 +46,25 @@ RuntimeError: RuntimeError: # repl ame__ -mport +port -builtins micropython __future__ _thread -_uasyncio aesio array audiocore -audiomixer bitmaptools cexample cmath -collections cppexample displayio gc -math qrio rainbowio struct -synthio termios traceback ubinascii -uctypes uerrno uhashlib uheapq -uio ujson ulab ulab.numpy -ulab.numpy.fft ulab.numpy.linalg ulab.scipy +builtins micropython __future__ _asyncio +_thread aesio array audiocore +audiomixer binascii bitmaptools cexample +cmath collections cppexample displayio +errno gc hashlib heapq +io json math os +qrio rainbowio random re +select struct synthio sys +termios time traceback uctypes +ulab ulab.numpy ulab.numpy.fft +ulab.numpy.linalg ulab.scipy ulab.scipy.linalg ulab.scipy.optimize ulab.scipy.signal ulab.scipy.special -ulab.utils uos urandom ure -uselect usys utime utimeq -uzlib zlib -ime +ulab.utils zlib +me -utime utimeq +rainbowio random argv atexit byteorder exc_info exit getsizeof implementation maxsize diff --git a/tests/unix/time.py b/tests/unix/time.py index 55a4b18aae..d1c03c103d 100644 --- a/tests/unix/time.py +++ b/tests/unix/time.py @@ -1,7 +1,4 @@ -try: - import utime as time -except ImportError: - import time +import time DAYS_PER_MONTH = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] From 4a6266517529c76a3363be8fd8b372104b04f061 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 22 Aug 2023 12:57:42 -0400 Subject: [PATCH 1555/1712] fix native tests --- .github/workflows/run-tests.yml | 2 +- tests/run-natmodtests.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 76422b1c3d..71f10339f3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -61,5 +61,5 @@ jobs: make -C examples/natmod/uzlib - name: Test native modules if: matrix.test == 'all' - run: ./run-natmodtests.py extmod/{btree*,framebuf*,uheapq*,ure*,uzlib*}.py + run: ./run-natmodtests.py extmod/{uheapq*,ure*,uzlib*}.py working-directory: tests diff --git a/tests/run-natmodtests.py b/tests/run-natmodtests.py index 2a0997c185..0942918d90 100755 --- a/tests/run-natmodtests.py +++ b/tests/run-natmodtests.py @@ -17,8 +17,6 @@ NATMOD_EXAMPLE_DIR = "../examples/natmod/" # Supported tests and their corresponding mpy module TEST_MAPPINGS = { - "btree": "btree/btree_$(ARCH).mpy", - "framebuf": "framebuf/framebuf_$(ARCH).mpy", "uheapq": "uheapq/uheapq_$(ARCH).mpy", "urandom": "urandom/urandom_$(ARCH).mpy", "ure": "ure/ure_$(ARCH).mpy", From e9208b9c2315ece4351801245f4f25852d5b3430 Mon Sep 17 00:00:00 2001 From: Jozsef Kiraly Date: Tue, 22 Aug 2023 18:00:18 +0100 Subject: [PATCH 1556/1712] fix: Allow duplicate PID for 4MB and 16MB variant --- tools/ci_check_duplicate_usb_vid_pid.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index f20630e886..e8cdb2d443 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -63,6 +63,7 @@ DEFAULT_CLUSTERLIST = { ], "0x239A:0x102E": ["weact_studio_pico", "weact_studio_pico_16mb"], "0x303A:0x8166": ["yd_esp32_s3_n8r8", "yd_esp32_s3_n16r8"], + "0x2E8A:0x1020": [ "waveshare_rp2040_plus_4mb", "waveshare_rp2040_plus_16mb"], } cli_parser = argparse.ArgumentParser( From ac5cb716fa680ecde0d3df382c733be23e52c484 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 22 Aug 2023 07:39:57 +0000 Subject: [PATCH 1557/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (1003 of 1003 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 22d4ff7e78..d0a815cd11 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: 2023-08-10 23:51+0000\n" +"PO-Revision-Date: 2023-08-22 21:28+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -440,7 +440,7 @@ msgstr "função externa 'yield'" #: py/compile.c msgid "* arg after **" -msgstr "" +msgstr "* arg após **" #: py/compile.c msgid "*x must be assignment target" @@ -2575,7 +2575,7 @@ msgstr "matriz/bytes são necessários no lado direito" #: py/asmxtensa.c msgid "asm overflow" -msgstr "" +msgstr "estouro asm" #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" @@ -2668,7 +2668,7 @@ msgstr "o buffer é pequeno demais para os bytes requisitados" #: py/emitbc.c msgid "bytecode overflow" -msgstr "" +msgstr "estouro bytecode" #: py/objarray.c msgid "bytes length not a multiple of item size" @@ -2829,7 +2829,7 @@ msgstr "" #: extmod/moduasyncio.c msgid "can't wait" -msgstr "" +msgstr "não vejo a hora" #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" @@ -3271,7 +3271,7 @@ msgstr "importação * não está no nível do módulo" #: py/persistentcode.c msgid "incompatible .mpy arch" -msgstr "" +msgstr "é incompatível com arquivo .mpy" #: py/persistentcode.c msgid "incompatible .mpy file" @@ -3745,7 +3745,7 @@ msgstr "não é um UUID com 128 bits" #: py/parse.c msgid "not a constant" -msgstr "" +msgstr "não é uma constante" #: py/objstr.c msgid "not all arguments converted during string formatting" @@ -3992,11 +3992,11 @@ msgstr "a porta deve ser > = 0" #: py/compile.c msgid "positional arg after **" -msgstr "" +msgstr "arg posicional após **" #: py/compile.c msgid "positional arg after keyword arg" -msgstr "" +msgstr "arg posicional após o arg de palavra-chave" #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" @@ -4227,7 +4227,7 @@ msgstr "os tobytes podem ser invocados apenas nas matrizes densas" #: py/compile.c msgid "too many args" -msgstr "" +msgstr "args demais" #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" From eeb524edbeb05fd9bb7d5deda511d388ea7502d2 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Tue, 22 Aug 2023 08:03:15 +0000 Subject: [PATCH 1558/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (1003 of 1003 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 6507055f56..3fe6408229 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-08-10 23:51+0000\n" +"PO-Revision-Date: 2023-08-22 21:28+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -437,7 +437,7 @@ msgstr "'yield' utanför funktion" #: py/compile.c msgid "* arg after **" -msgstr "" +msgstr "* arg efter **" #: py/compile.c msgid "*x must be assignment target" @@ -2546,7 +2546,7 @@ msgstr "array/bytes krävs på höger sida" #: py/asmxtensa.c msgid "asm overflow" -msgstr "" +msgstr "asm overflow" #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" @@ -2639,7 +2639,7 @@ msgstr "buffert för liten för begärd längd" #: py/emitbc.c msgid "bytecode overflow" -msgstr "" +msgstr "bytecode overflow" #: py/objarray.c msgid "bytes length not a multiple of item size" @@ -2798,7 +2798,7 @@ msgstr "" #: extmod/moduasyncio.c msgid "can't wait" -msgstr "" +msgstr "kan inte vänta" #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" @@ -3238,7 +3238,7 @@ msgstr "import * inte på modulnivå" #: py/persistentcode.c msgid "incompatible .mpy arch" -msgstr "" +msgstr "inkompatibel .mpy-arkitektur" #: py/persistentcode.c msgid "incompatible .mpy file" @@ -3709,7 +3709,7 @@ msgstr "inte en 128-bitars UUID" #: py/parse.c msgid "not a constant" -msgstr "" +msgstr "inte en konstant" #: py/objstr.c msgid "not all arguments converted during string formatting" @@ -3952,11 +3952,11 @@ msgstr "port måste vara >= 0" #: py/compile.c msgid "positional arg after **" -msgstr "" +msgstr "positionsargument efter **" #: py/compile.c msgid "positional arg after keyword arg" -msgstr "" +msgstr "positionsargument efter nyckelord arg" #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" @@ -4187,7 +4187,7 @@ msgstr "tobyte kan enbart anropas för täta matriser" #: py/compile.c msgid "too many args" -msgstr "" +msgstr "för mpnga argument" #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" From cb3badc9960d52951c95a29415a2d120cceb4029 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 22 Aug 2023 23:28:42 +0200 Subject: [PATCH 1559/1712] 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 | 47 +++++++++++-------------- locale/cs.po | 50 +++++++++++++------------- locale/de_DE.po | 76 ++++++++++++++++++++++++---------------- locale/el.po | 63 ++++++++++++++++++--------------- locale/en_GB.po | 71 ++++++++++++++++++++++--------------- locale/es.po | 73 ++++++++++++++++++++++---------------- locale/fil.po | 47 +++++++++++-------------- locale/fr.po | 71 +++++++++++++++++++++---------------- locale/hi.po | 44 ++++++++++------------- locale/it_IT.po | 54 ++++++++++++++-------------- locale/ja.po | 57 +++++++++++++++--------------- locale/ko.po | 44 ++++++++++------------- locale/nl.po | 54 ++++++++++++++-------------- locale/pl.po | 52 +++++++++++++-------------- locale/pt_BR.po | 74 ++++++++++++++++++++++---------------- locale/ru.po | 50 +++++++++++++------------- locale/sv.po | 73 ++++++++++++++++++++++---------------- locale/tr.po | 50 +++++++++++++------------- locale/zh_Latn_pinyin.po | 72 ++++++++++++++++++++++--------------- 19 files changed, 595 insertions(+), 527 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index c1c0f13d5b..742939386f 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -33,8 +33,8 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" #: supervisor/shared/safe_mode.c @@ -396,10 +396,6 @@ msgstr "'break' diluar loop" msgid "'continue' outside loop" msgstr "'continue' diluar loop" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' membutuhkan setidaknya 2 argumen" @@ -669,11 +665,6 @@ msgstr "" msgid "Buffer is not a bytearray." msgstr "Buffer bukan bytearray." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Buffer terlalu kecil" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -693,6 +684,12 @@ msgstr "" msgid "Buffer too short by %d bytes" msgstr "Buffer terlalu pendek untuk %d byte" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "" @@ -1040,10 +1037,6 @@ msgstr "Gagal melepaskan mutex, err 0x%04x" msgid "Failed to write internal flash." msgstr "Gagal menulis flash internal." -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "File sudah ada" @@ -1119,6 +1112,10 @@ msgstr "Grup sudah digunakan" msgid "Half duplex SPI is not implemented" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1775,6 +1772,10 @@ msgstr "Tambahkan module apapun pada filesystem\n" msgid "Polygon needs at least 3 points" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "Buffer awalan harus ada di heap" @@ -2010,10 +2011,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "Sampel bits_per_sampel tidak cocok dengan mixer" @@ -2606,8 +2603,7 @@ msgstr "ukuran buffer harus sesuai dengan format" msgid "buffer slices must be of equal length" msgstr "" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "" @@ -3893,10 +3889,6 @@ msgstr "parameter harus menjadi register dalam urutan r0 sampai r3" msgid "pixel coordinates out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" @@ -4208,7 +4200,7 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" @@ -4405,6 +4397,9 @@ msgstr "zi harus berjenis float" msgid "zi must be of shape (n_section, 2)" msgstr "Zi harus berbentuk (n_section, 2)" +#~ msgid "Buffer is too small" +#~ msgstr "Buffer terlalu kecil" + #~ msgid "Corrupt .mpy file" #~ msgstr "File .mpy rusak" diff --git a/locale/cs.po b/locale/cs.po index 6fb252a268..372fb71e74 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -35,8 +35,8 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" #: supervisor/shared/safe_mode.c @@ -397,10 +397,6 @@ msgstr "'break' je volán vně cyklu" msgid "'continue' outside loop" msgstr "'continue' je volán vně cyklu" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "Objekt 'coroutine' není iterátor" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' vyžaduje nejméně 2 argumenty" @@ -670,11 +666,6 @@ msgstr "Prvky bufferu musí být 4 bajty dlouhé nebo méně" msgid "Buffer is not a bytearray." msgstr "Buffer není bytearray." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Vyrovnávací paměť je příliš malá" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -694,6 +685,12 @@ msgstr "Buffer musí být násobkem 512 bajtů" msgid "Buffer too short by %d bytes" msgstr "Buffer je příliš krátký o %d bajtů" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "Buffery musí mít stejnou velikost" @@ -1038,10 +1035,6 @@ msgstr "" msgid "Failed to write internal flash." msgstr "Nepodařilo se zapsat do interní paměti." -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "soubor existuje" @@ -1119,6 +1112,10 @@ msgstr "Skupina již byla použita" msgid "Half duplex SPI is not implemented" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1766,6 +1763,10 @@ msgstr "" msgid "Polygon needs at least 3 points" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "" @@ -1999,10 +2000,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "" @@ -2593,8 +2590,7 @@ msgstr "" msgid "buffer slices must be of equal length" msgstr "" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "" @@ -3879,10 +3875,6 @@ msgstr "" msgid "pixel coordinates out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" @@ -4194,7 +4186,7 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" @@ -4391,6 +4383,12 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "Objekt 'coroutine' není iterátor" + +#~ msgid "Buffer is too small" +#~ msgstr "Vyrovnávací paměť je příliš malá" + #~ msgid "Corrupt .mpy file" #~ msgstr "Poškozený soubor .mpy" diff --git a/locale/de_DE.po b/locale/de_DE.po index 5b59af8741..b6bbdaa773 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -34,12 +34,9 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" -"\n" -"Bitte erstellen Sie ein Problem (Issue) für Ihr Programm unter https://" -"github.com/adafruit/circuitpython/issues." #: supervisor/shared/safe_mode.c msgid "" @@ -407,10 +404,6 @@ msgstr "'break' außerhalb einer Schleife" msgid "'continue' outside loop" msgstr "'continue' außerhalb einer Schleife" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "'coroutine' Objekt ist kein Iterator" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' erfordert mindestens zwei Argumente" @@ -680,11 +673,6 @@ msgstr "Puffer-Elemente müssen 4 Bytes lang oder kürzer sein" msgid "Buffer is not a bytearray." msgstr "Der Buffer ist kein Byte-Array." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Der Puffer ist zu klein" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -704,6 +692,12 @@ msgstr "Der Puffer muss ein vielfaches von 512 bytes sein" msgid "Buffer too short by %d bytes" msgstr "Puffer um %d Bytes zu kurz" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "Buffers müssen gleiche Größe haben" @@ -1055,10 +1049,6 @@ msgstr "Mutex konnte nicht freigegeben werden. Status: 0x%04x" msgid "Failed to write internal flash." msgstr "Interner Flash konnte nicht geschrieben werden." -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "Hardware hat Fehler festgestellt." - #: py/moduerrno.c msgid "File exists" msgstr "Datei existiert" @@ -1138,6 +1128,10 @@ msgstr "Gruppe schon benutzt" msgid "Half duplex SPI is not implemented" msgstr "Hald-Duplex SPI is tnicht implementiert" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1799,6 +1793,10 @@ msgstr "und alle Module im Dateisystem\n" msgid "Polygon needs at least 3 points" msgstr "Polygone brauchen mindestens 3 Punkte" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "Präfix-Puffer muss sich auf dem Heap befinden" @@ -2036,12 +2034,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "Die Länge von rgb_pins muss 6, 12, 18, 24 oder 30 betragen" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" -"Die Spannung ist eingebrochen. Stelle sicher, dass genügend Leistung " -"verfügbar ist." - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "" @@ -2650,8 +2642,7 @@ msgstr "Die Puffergröße muss zum Format passen" msgid "buffer slices must be of equal length" msgstr "Puffersegmente müssen gleich lang sein" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "Puffer zu klein" @@ -3964,10 +3955,6 @@ msgstr "Parameter müssen Register im Bereich von r0 bis r3 sein" msgid "pixel coordinates out of bounds" msgstr "Pixelkoordinaten außerhalb der Grenzen" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "pixel_shader muss displayio.Palette oder displayio.ColorConverter sein" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "Abfrage der Datei unter Win32 nicht verfügbar" @@ -4279,7 +4266,7 @@ msgstr "Typ '%q' ist kein akzeptierter Basis-Typ" msgid "type is not an acceptable base type" msgstr "Typ ist kein akzeptierter Basis-Typ" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "Typ-Objekt '%q' hat kein Attribut '%q'" @@ -4478,6 +4465,33 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "" +#~ "\n" +#~ "Please file an issue with your program at https://github.com/adafruit/" +#~ "circuitpython/issues." +#~ msgstr "" +#~ "\n" +#~ "Bitte erstellen Sie ein Problem (Issue) für Ihr Programm unter https://" +#~ "github.com/adafruit/circuitpython/issues." + +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "'coroutine' Objekt ist kein Iterator" + +#~ msgid "Buffer is too small" +#~ msgstr "Der Puffer ist zu klein" + +#~ msgid "Fault detected by hardware." +#~ msgstr "Hardware hat Fehler festgestellt." + +#~ msgid "The power dipped. Make sure you are providing enough power." +#~ msgstr "" +#~ "Die Spannung ist eingebrochen. Stelle sicher, dass genügend Leistung " +#~ "verfügbar ist." + +#~ msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" +#~ msgstr "" +#~ "pixel_shader muss displayio.Palette oder displayio.ColorConverter sein" + #~ msgid "Corrupt .mpy file" #~ msgstr "Beschädigte .mpy Datei" diff --git a/locale/el.po b/locale/el.po index 9a15d4af5c..8ecc871685 100644 --- a/locale/el.po +++ b/locale/el.po @@ -38,12 +38,9 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" -"\n" -"Παρακαλώ δημιουργήστε ένα πρόβλημα στο https://github.com/adafruit/" -"circuitpython/issues με το πρόγραμμά σας." #: supervisor/shared/safe_mode.c msgid "" @@ -408,10 +405,6 @@ msgstr "'break' εκτός επανάληψης" msgid "'continue' outside loop" msgstr "'continue' εκτός επανάληψης" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "'coroutine' αντικείμενο δεν μπορεί να χρησιμοποιηθεί σαν επαναλήπτης" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' απαιτεί τουλάχιστον 2 παραμέτρους" @@ -681,11 +674,6 @@ msgstr "Στοιχεία του buffer πρέπει να είναι το πολ msgid "Buffer is not a bytearray." msgstr "Το buffer δεν είναι ένα bytearray." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Πολύ μικρό buffer" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -705,6 +693,12 @@ msgstr "Buffer πρέπει να είναι πολλαπλάσιο των 512 by msgid "Buffer too short by %d bytes" msgstr "Buffer πολύ μικρό κατα %d bytes" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "Τα Buffers πρέπει να είναι του ιδίου μεγέθους" @@ -1057,10 +1051,6 @@ msgstr "" msgid "Failed to write internal flash." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "" @@ -1136,6 +1126,10 @@ msgstr "" msgid "Half duplex SPI is not implemented" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1782,6 +1776,10 @@ msgstr "" msgid "Polygon needs at least 3 points" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "" @@ -2015,10 +2013,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "" @@ -2609,8 +2603,7 @@ msgstr "" msgid "buffer slices must be of equal length" msgstr "" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "" @@ -3895,10 +3888,6 @@ msgstr "" msgid "pixel coordinates out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" @@ -4210,7 +4199,7 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" @@ -4407,6 +4396,22 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "" +#~ "\n" +#~ "Please file an issue with your program at https://github.com/adafruit/" +#~ "circuitpython/issues." +#~ msgstr "" +#~ "\n" +#~ "Παρακαλώ δημιουργήστε ένα πρόβλημα στο https://github.com/adafruit/" +#~ "circuitpython/issues με το πρόγραμμά σας." + +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "" +#~ "'coroutine' αντικείμενο δεν μπορεί να χρησιμοποιηθεί σαν επαναλήπτης" + +#~ msgid "Buffer is too small" +#~ msgstr "Πολύ μικρό buffer" + #~ msgid "Corrupt .mpy file" #~ msgstr "Κατεστραμένο .mpy αρχείο" diff --git a/locale/en_GB.po b/locale/en_GB.po index 6801196cb8..d48bbffe5b 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -36,12 +36,9 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" -"\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." #: supervisor/shared/safe_mode.c msgid "" @@ -406,10 +403,6 @@ msgstr "'break' outside loop" msgid "'continue' outside loop" msgstr "'continue' outside loop" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "'coroutine' object is not an iterator" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' requires at least 2 arguments" @@ -679,11 +672,6 @@ msgstr "Buffer elements must be 4 bytes long or less" msgid "Buffer is not a bytearray." msgstr "Buffer is not a bytearray." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Buffer is too small" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -703,6 +691,12 @@ msgstr "Buffer must be a multiple of 512 bytes" msgid "Buffer too short by %d bytes" msgstr "Buffer too short by %d bytes" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "Buffers must be same size" @@ -1047,10 +1041,6 @@ msgstr "Failed to release mutex, err 0x%04x" msgid "Failed to write internal flash." msgstr "Failed to write internal flash." -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "Fault detected by hardware." - #: py/moduerrno.c msgid "File exists" msgstr "File exists" @@ -1127,6 +1117,10 @@ msgstr "Group already used" msgid "Half duplex SPI is not implemented" msgstr "Half duplex SPI is not implemented" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1782,6 +1776,10 @@ msgstr "Plus any modules on the filesystem\n" msgid "Polygon needs at least 3 points" msgstr "Polygon needs at least 3 points" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "Prefix buffer must be on the heap" @@ -2013,10 +2011,6 @@ msgstr "The above exception was the direct cause of the following exception:" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "The length of rgb_pins must be 6, 12, 18, 24, or 30" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "The power dipped. Make sure you are providing enough power." - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "The sample's bits_per_sample does not match the mixer's" @@ -2616,8 +2610,7 @@ msgstr "Buffer size must match format" msgid "buffer slices must be of equal length" msgstr "Buffer slices must be of equal length" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "Buffer too small" @@ -3907,10 +3900,6 @@ msgstr "parameters must be registers in sequence r0 to r3" msgid "pixel coordinates out of bounds" msgstr "pixel coordinates out of bounds" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "pixel_shader must be displayio.Palette or displayio.ColorConverter" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "poll on file not available on win32" @@ -4222,7 +4211,7 @@ msgstr "type '%q' is not an acceptable base type" msgid "type is not an acceptable base type" msgstr "type is not an acceptable base type" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "type object '%q' has no attribute '%q'" @@ -4419,6 +4408,30 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "" +#~ "\n" +#~ "Please file an issue with your program at https://github.com/adafruit/" +#~ "circuitpython/issues." +#~ msgstr "" +#~ "\n" +#~ "Please file an issue with your program at https://github.com/adafruit/" +#~ "circuitpython/issues." + +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "'coroutine' object is not an iterator" + +#~ msgid "Buffer is too small" +#~ msgstr "Buffer is too small" + +#~ msgid "Fault detected by hardware." +#~ msgstr "Fault detected by hardware." + +#~ msgid "The power dipped. Make sure you are providing enough power." +#~ msgstr "The power dipped. Make sure you are providing enough power." + +#~ msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" +#~ msgstr "pixel_shader must be displayio.Palette or displayio.ColorConverter" + #~ msgid "Corrupt .mpy file" #~ msgstr "Corrupt .mpy file" diff --git a/locale/es.po b/locale/es.po index 650c063651..31fea47431 100644 --- a/locale/es.po +++ b/locale/es.po @@ -37,12 +37,9 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." -msgstr "" -"\n" -"Por favor describa su problema en https://github.com/adafruit/circuitpython/" +"Please file an issue with your program at github.com/adafruit/circuitpython/" "issues." +msgstr "" #: supervisor/shared/safe_mode.c msgid "" @@ -408,10 +405,6 @@ msgstr "'break' fuera de un bucle" msgid "'continue' outside loop" msgstr "'continue' fuera de un bucle" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "el objeto 'coroutine' no es un iterador" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' requiere como mínimo 2 argumentos" @@ -683,11 +676,6 @@ msgstr "Los elementos del buffer deben tener una longitud de 4 bytes o menos" msgid "Buffer is not a bytearray." msgstr "Buffer no es un bytearray." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Buffer es muy pequeño" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -708,6 +696,12 @@ msgstr "El buffer deber ser un múltiplo de 512 bytes" msgid "Buffer too short by %d bytes" msgstr "Buffer muy corto por %d bytes" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "Los buffers deben ser del mismo tamaño" @@ -1059,10 +1053,6 @@ msgstr "No se puede liberar el mutex, err 0x%04x" msgid "Failed to write internal flash." msgstr "Error al escribir el flash interno." -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "Falló detectado por el hardware." - #: py/moduerrno.c msgid "File exists" msgstr "El archivo ya existe" @@ -1144,6 +1134,10 @@ msgstr "Grupo ya está siendo utilizado" msgid "Half duplex SPI is not implemented" msgstr "SPI Half Duplex no está implementado" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1809,6 +1803,10 @@ msgstr "Además de cualquier módulo en el sistema de archivos\n" msgid "Polygon needs at least 3 points" msgstr "El polígono necesita al menos 3 puntos" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "El prefijo del buffer debe estar en el heap" @@ -2045,11 +2043,6 @@ msgstr "La excepción fue la causa directa de la excepción siguiente:" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "La longitud de rgb_pins debe ser 6, 12, 18, 24, o 30" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" -"La potencia calló. Asegúrese que está suministrando suficiente energía." - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "Los bits_per_sample del sample no igualan a los del mixer" @@ -2656,8 +2649,7 @@ msgstr "el tamaño del buffer debe de coincidir con el formato" msgid "buffer slices must be of equal length" msgstr "Las secciones del buffer necesitan tener longitud igual" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "buffer demasiado pequeño" @@ -3956,10 +3948,6 @@ msgstr "los parametros deben ser registros en secuencia del r0 al r3" msgid "pixel coordinates out of bounds" msgstr "coordenadas del pixel fuera de límites" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "pixel_shader debe ser displayio.Palette o displayio.ColorConverter" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "el sondeo del archivo no esta disponible en win32" @@ -4272,7 +4260,7 @@ msgstr "type '%q' no es un tipo de base aceptable" msgid "type is not an acceptable base type" msgstr "type no es un tipo de base aceptable" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "objeto de tipo '%q' no tiene atributo '%q'" @@ -4469,6 +4457,31 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "" +#~ "\n" +#~ "Please file an issue with your program at https://github.com/adafruit/" +#~ "circuitpython/issues." +#~ msgstr "" +#~ "\n" +#~ "Por favor describa su problema en https://github.com/adafruit/" +#~ "circuitpython/issues." + +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "el objeto 'coroutine' no es un iterador" + +#~ msgid "Buffer is too small" +#~ msgstr "Buffer es muy pequeño" + +#~ msgid "Fault detected by hardware." +#~ msgstr "Falló detectado por el hardware." + +#~ msgid "The power dipped. Make sure you are providing enough power." +#~ msgstr "" +#~ "La potencia calló. Asegúrese que está suministrando suficiente energía." + +#~ msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" +#~ msgstr "pixel_shader debe ser displayio.Palette o displayio.ColorConverter" + #~ msgid "Corrupt .mpy file" #~ msgstr "Archivo .mpy corrupto" diff --git a/locale/fil.po b/locale/fil.po index f38a83830d..fc3e801581 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -32,8 +32,8 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" #: supervisor/shared/safe_mode.c @@ -395,10 +395,6 @@ msgstr "'break' sa labas ng loop" msgid "'continue' outside loop" msgstr "'continue' sa labas ng loop" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' kailangan ng hindi bababa sa 2 argument" @@ -669,11 +665,6 @@ msgstr "" msgid "Buffer is not a bytearray." msgstr "" -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -693,6 +684,12 @@ msgstr "" msgid "Buffer too short by %d bytes" msgstr "" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "" @@ -1040,10 +1037,6 @@ msgstr "Nabigo sa pagrelease ng mutex, status: 0x%08lX" msgid "Failed to write internal flash." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "Mayroong file" @@ -1119,6 +1112,10 @@ msgstr "" msgid "Half duplex SPI is not implemented" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1769,6 +1766,10 @@ msgstr "Kasama ang kung ano pang modules na sa filesystem\n" msgid "Polygon needs at least 3 points" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "" @@ -2000,10 +2001,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "Ang bits_per_sample ng sample ay hindi tugma sa mixer" @@ -2597,8 +2594,7 @@ msgstr "aarehas na haba dapat ang buffer slices" msgid "buffer slices must be of equal length" msgstr "aarehas na haba dapat ang buffer slices" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "masyadong maliit ang buffer" @@ -3900,10 +3896,6 @@ msgstr "ang mga parameter ay dapat na nagrerehistro sa sequence r0 hanggang r3" msgid "pixel coordinates out of bounds" msgstr "wala sa sakop ang address" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "pixel_shader ay dapat displayio.Palette o displayio.ColorConverter" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" @@ -4215,7 +4207,7 @@ msgstr "hindi maari ang type na '%q' para sa base type" msgid "type is not an acceptable base type" msgstr "hindi puede ang type para sa base type" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "type object '%q' ay walang attribute '%q'" @@ -4412,6 +4404,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" +#~ msgstr "pixel_shader ay dapat displayio.Palette o displayio.ColorConverter" + #~ msgid "" #~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." #~ "it/mpy-update for more info." diff --git a/locale/fr.po b/locale/fr.po index 297cc5b800..1d246a9de0 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -37,12 +37,9 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" -"\n" -"Veuillez signaler un problème avec votre programme sur https://github.com/" -"adafruit/circuitpython/issues." #: supervisor/shared/safe_mode.c msgid "" @@ -410,10 +407,6 @@ msgstr "'break' dehors d'une boucle" msgid "'continue' outside loop" msgstr "'continue' dehors d'une boucle" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "L'objet \"coroutine\" n'est pas un itérateur" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' nécessite au moins 2 paramètres" @@ -685,11 +678,6 @@ msgstr "Les éléments du tampon doivent faire 4 octets ou moins" msgid "Buffer is not a bytearray." msgstr "Le tampon n'est pas un 'bytearray'." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Le tampon est trop petit" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -709,6 +697,12 @@ msgstr "La mémoire tampon doit être un multiple de 512" msgid "Buffer too short by %d bytes" msgstr "Tampon trop court de %d octets" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "Les tampons doivent avoir la même taille" @@ -1068,10 +1062,6 @@ msgstr "Impossible de libérer mutex, err 0x%04x" msgid "Failed to write internal flash." msgstr "Échec de l'écriture vers flash interne." -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "Le fichier existe" @@ -1154,6 +1144,10 @@ msgstr "Groupe déjà utilisé" msgid "Half duplex SPI is not implemented" msgstr "Le half duplex du SPI n'est pas implémenté" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1819,6 +1813,10 @@ msgstr "Ainsi que tout autres modules présents sur le système de fichiers\n" msgid "Polygon needs at least 3 points" msgstr "Polygon a besoin d'au moins 3 points" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "Le tampon de préfixe doit être sur la pile" @@ -2054,10 +2052,6 @@ msgstr "L'exception précédente est la cause directe de l'exception suivante:" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "La taille de rgb_pins doit être 6, 12, 18, 24 ou 30" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "La puissance a chu. Assurez vous de fournir assez de puissance." - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "" @@ -2667,8 +2661,7 @@ msgstr "la taille du tampon doit correspondre au format" msgid "buffer slices must be of equal length" msgstr "les tranches de tampon doivent être de longueurs égales" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "tampon trop petit" @@ -3979,11 +3972,6 @@ msgstr "les paramètres doivent être des registres dans la séquence r0 à r3" msgid "pixel coordinates out of bounds" msgstr "coordonnées de pixel hors limites" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" -"pixel_shader doit être un objet displayio.Palette ou displayio.ColorConverter" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "le polling sur un fichier n'est pas disponible sous win32" @@ -4296,7 +4284,7 @@ msgstr "le type '%q' n'est pas un type de base accepté" msgid "type is not an acceptable base type" msgstr "le type n'est pas un type de base accepté" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "l'objet de type '%q' n'a pas d'attribut '%q'" @@ -4493,6 +4481,29 @@ 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 "" +#~ "\n" +#~ "Please file an issue with your program at https://github.com/adafruit/" +#~ "circuitpython/issues." +#~ msgstr "" +#~ "\n" +#~ "Veuillez signaler un problème avec votre programme sur https://github.com/" +#~ "adafruit/circuitpython/issues." + +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "L'objet \"coroutine\" n'est pas un itérateur" + +#~ msgid "Buffer is too small" +#~ msgstr "Le tampon est trop petit" + +#~ msgid "The power dipped. Make sure you are providing enough power." +#~ msgstr "La puissance a chu. Assurez vous de fournir assez de puissance." + +#~ msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" +#~ msgstr "" +#~ "pixel_shader doit être un objet displayio.Palette ou displayio." +#~ "ColorConverter" + #~ msgid "Corrupt .mpy file" #~ msgstr "Fichier .mpy corrompu" diff --git a/locale/hi.po b/locale/hi.po index d0c8e3e366..f3633dbd78 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -31,8 +31,8 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" #: supervisor/shared/safe_mode.c @@ -393,10 +393,6 @@ msgstr "" msgid "'continue' outside loop" msgstr "" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "" @@ -664,11 +660,6 @@ msgstr "" msgid "Buffer is not a bytearray." msgstr "" -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -688,6 +679,12 @@ msgstr "" msgid "Buffer too short by %d bytes" msgstr "" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "" @@ -1030,10 +1027,6 @@ msgstr "" msgid "Failed to write internal flash." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "" @@ -1109,6 +1102,10 @@ msgstr "" msgid "Half duplex SPI is not implemented" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1755,6 +1752,10 @@ msgstr "" msgid "Polygon needs at least 3 points" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "" @@ -1986,10 +1987,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "" @@ -2580,8 +2577,7 @@ msgstr "" msgid "buffer slices must be of equal length" msgstr "" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "" @@ -3866,10 +3862,6 @@ msgstr "" msgid "pixel coordinates out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" @@ -4181,7 +4173,7 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index ceacac5e81..f865aee666 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -34,8 +34,8 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" #: supervisor/shared/safe_mode.c @@ -398,10 +398,6 @@ msgstr "'break' fuori del ciclo" msgid "'continue' outside loop" msgstr "'continue' fuori del ciclo" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "L'oggetto 'coroutine' non è un iteratore" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' richiede almeno 2 argomenti" @@ -673,11 +669,6 @@ msgstr "" msgid "Buffer is not a bytearray." msgstr "Buffer non è un array di bites." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Buffer troppo piccolo" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -697,6 +688,12 @@ msgstr "Il buffer deve essere un multiplo di 512 bytes" msgid "Buffer too short by %d bytes" msgstr "Buffer troppo piccolo di %d bytes" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "" @@ -1042,10 +1039,6 @@ msgstr "Impossibile rilasciare il mutex, err 0x%04x" msgid "Failed to write internal flash." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "File esistente" @@ -1121,6 +1114,10 @@ msgstr "" msgid "Half duplex SPI is not implemented" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1776,6 +1773,10 @@ msgstr "Imposssibile rimontare il filesystem" msgid "Polygon needs at least 3 points" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "" @@ -2007,10 +2008,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "" @@ -2606,8 +2603,7 @@ msgstr "slice del buffer devono essere della stessa lunghezza" msgid "buffer slices must be of equal length" msgstr "slice del buffer devono essere della stessa lunghezza" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "buffer troppo piccolo" @@ -3910,10 +3906,6 @@ msgstr "parametri devono essere i registri in sequenza da a2 a a5" msgid "pixel coordinates out of bounds" msgstr "indirizzo fuori limite" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "pixel_shader deve essere displayio.Palette o displayio.ColorConverter" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" @@ -4225,7 +4217,7 @@ msgstr "il tipo '%q' non è un tipo di base accettabile" msgid "type is not an acceptable base type" msgstr "il tipo non è un tipo di base accettabile" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "l'oggetto di tipo '%q' non ha l'attributo '%q'" @@ -4422,6 +4414,16 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "L'oggetto 'coroutine' non è un iteratore" + +#~ msgid "Buffer is too small" +#~ msgstr "Buffer troppo piccolo" + +#~ msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" +#~ msgstr "" +#~ "pixel_shader deve essere displayio.Palette o displayio.ColorConverter" + #~ msgid "" #~ "Incompatible .mpy file. Please update all .mpy files. See http://adafru." #~ "it/mpy-update for more info." diff --git a/locale/ja.po b/locale/ja.po index 72fca62efd..c74f672a03 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -37,8 +37,8 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" #: supervisor/shared/safe_mode.c @@ -400,10 +400,6 @@ msgstr "ループ外でのbreak" msgid "'continue' outside loop" msgstr "ループ外でのcontinue" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "'coroutine' オブジェクトはイテレータではありません" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data'には少なくとも2つの引数が必要" @@ -673,11 +669,6 @@ msgstr "" msgid "Buffer is not a bytearray." msgstr "バッファがbytearrayではありません" -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "バッファが小さすぎます" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -697,6 +688,12 @@ msgstr "バッファは512の倍数でなければなりません" msgid "Buffer too short by %d bytes" msgstr "バッファが %d バイト足りません" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "" @@ -1041,10 +1038,6 @@ msgstr "ミューテックスの開放に失敗。エラー 0x%04x" msgid "Failed to write internal flash." msgstr "内部フラッシュ書き込みに失敗" -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "ファイルが存在します" @@ -1120,6 +1113,10 @@ msgstr "グループはすでに使われています" msgid "Half duplex SPI is not implemented" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1768,6 +1765,10 @@ msgstr "" msgid "Polygon needs at least 3 points" msgstr "ポリゴンには少なくとも3つの点が必要" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "Prefixバッファはヒープ上になければなりません" @@ -2000,10 +2001,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "サンプルのbits_per_sampleがミキサーのそれと一致しません" @@ -2595,8 +2592,7 @@ msgstr "" msgid "buffer slices must be of equal length" msgstr "バッファのスライスは同じ長さでなければなりません" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "" @@ -3886,12 +3882,6 @@ msgstr "" msgid "pixel coordinates out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" -"pixel_shaderはdisplayio.Paletteかdisplayio.ColorConverterのどちらかでなければ" -"なりません" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" @@ -4203,7 +4193,7 @@ msgstr "型'%q'はベース型として使えません" msgid "type is not an acceptable base type" msgstr "この型はベース型にできません" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" @@ -4400,6 +4390,17 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "'coroutine' オブジェクトはイテレータではありません" + +#~ msgid "Buffer is too small" +#~ msgstr "バッファが小さすぎます" + +#~ msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" +#~ msgstr "" +#~ "pixel_shaderはdisplayio.Paletteかdisplayio.ColorConverterのどちらかでなけ" +#~ "ればなりません" + #~ msgid "Corrupt .mpy file" #~ msgstr "破損した .mpy ファイル" diff --git a/locale/ko.po b/locale/ko.po index 3440a5263b..09ae2f0120 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -32,8 +32,8 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" #: supervisor/shared/safe_mode.c @@ -394,10 +394,6 @@ msgstr "'break' 는 루프 외부에 있습니다" msgid "'continue' outside loop" msgstr "'continue' 는 루프 외부에 있습니다" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' 에는 >=2 개의 독립변수가 필요합니다" @@ -667,11 +663,6 @@ msgstr "" msgid "Buffer is not a bytearray." msgstr "" -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -691,6 +682,12 @@ msgstr "" msgid "Buffer too short by %d bytes" msgstr "" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "" @@ -1033,10 +1030,6 @@ msgstr "" msgid "Failed to write internal flash." msgstr "" -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "" @@ -1112,6 +1105,10 @@ msgstr "" msgid "Half duplex SPI is not implemented" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1758,6 +1755,10 @@ msgstr "" msgid "Polygon needs at least 3 points" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "" @@ -1989,10 +1990,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "" @@ -2584,8 +2581,7 @@ msgstr "" msgid "buffer slices must be of equal length" msgstr "" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "" @@ -3870,10 +3866,6 @@ msgstr "" msgid "pixel coordinates out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" @@ -4185,7 +4177,7 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index c7ef29adab..befcd1f2c3 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -31,8 +31,8 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" #: supervisor/shared/safe_mode.c @@ -393,10 +393,6 @@ msgstr "'break' buiten de loop" msgid "'continue' outside loop" msgstr "'continue' buiten de loop" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "'coroutine' object is geen iterator" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' vereist op zijn minst 2 argumenten" @@ -666,11 +662,6 @@ msgstr "" msgid "Buffer is not a bytearray." msgstr "Buffer is geen bytearray." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Buffer is te klein" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -690,6 +681,12 @@ msgstr "Buffer moet een veelvoud van 512 bytes zijn" msgid "Buffer too short by %d bytes" msgstr "Buffer is %d bytes te klein" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "" @@ -1035,10 +1032,6 @@ msgstr "Mislukt mutex los te laten, err 0x%04x" msgid "Failed to write internal flash." msgstr "Schrijven naar interne flash mislukt." -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "Bestand bestaat" @@ -1115,6 +1108,10 @@ msgstr "Groep al gebruikt" msgid "Half duplex SPI is not implemented" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1772,6 +1769,10 @@ msgstr "En iedere module in het bestandssysteem\n" msgid "Polygon needs at least 3 points" msgstr "Polygon heeft op zijn minst 3 punten nodig" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "Prefix buffer moet op de heap zijn" @@ -2005,10 +2006,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "De lengte van rgb_pins moet 6, 12, 18, 24 of 30 zijn" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "De sample's bits_per_sample komen niet overeen met die van de mixer" @@ -2605,8 +2602,7 @@ msgstr "grootte van de buffer moet overeenkomen met het formaat" msgid "buffer slices must be of equal length" msgstr "buffer slices moeten van gelijke grootte zijn" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "buffer te klein" @@ -3898,10 +3894,6 @@ msgstr "parameters moeten registers zijn in de volgorde r0 tot r3" msgid "pixel coordinates out of bounds" msgstr "pixel coördinaten buiten bereik" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "pixel_shader moet displayio.Palette of displayio.ColorConverter zijn" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" @@ -4213,7 +4205,7 @@ msgstr "type '%q' is geen aanvaardbaar basistype" msgid "type is not an acceptable base type" msgstr "type is geen aanvaardbaar basistype" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "objecttype '%q' heeft geen attribuut '%q'" @@ -4410,6 +4402,16 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "'coroutine' object is geen iterator" + +#~ msgid "Buffer is too small" +#~ msgstr "Buffer is te klein" + +#~ msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" +#~ msgstr "" +#~ "pixel_shader moet displayio.Palette of displayio.ColorConverter zijn" + #~ msgid "Corrupt .mpy file" #~ msgstr "Corrupt .mpy bestand" diff --git a/locale/pl.po b/locale/pl.po index 35929938e0..a58820be9d 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -33,8 +33,8 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" #: supervisor/shared/safe_mode.c @@ -395,10 +395,6 @@ msgstr "'break' poza pętlą" msgid "'continue' outside loop" msgstr "'continue' poza pętlą" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' wymaga 2 lub więcej argumentów" @@ -668,11 +664,6 @@ msgstr "" msgid "Buffer is not a bytearray." msgstr "" -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Bufor jest za mały" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -692,6 +683,12 @@ msgstr "Bufor musi być wielokrotnością 512 bajtów" msgid "Buffer too short by %d bytes" msgstr "Bufor za krótki o %d bajtów" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "" @@ -1036,10 +1033,6 @@ msgstr "Nie udało się zwolnić blokady, błąd 0x%04x" msgid "Failed to write internal flash." msgstr "Nie udało się zapisać wewnętrznej pamięci flash." -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "Plik istnieje" @@ -1115,6 +1108,10 @@ msgstr "Grupa już używana" msgid "Half duplex SPI is not implemented" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1761,6 +1758,10 @@ msgstr "Oraz moduły w systemie plików\n" msgid "Polygon needs at least 3 points" msgstr "Wielokąt musi mieć co najmniej 3 punkty" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "" @@ -1992,10 +1993,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "Wartość bits_per_sample nie pasuje do miksera" @@ -2586,8 +2583,7 @@ msgstr "wielkość bufora musi pasować do formatu" msgid "buffer slices must be of equal length" msgstr "fragmenty bufora muszą mieć tę samą długość" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "zbyt mały bufor" @@ -3873,11 +3869,6 @@ msgstr "parametry muszą być rejestrami w kolejności r0 do r3" msgid "pixel coordinates out of bounds" msgstr "współrzędne piksela poza zakresem" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" -"pixel_shader musi być typu displayio.Palette lub dispalyio.ColorConverter" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" @@ -4189,7 +4180,7 @@ msgstr "typ '%q' nie może być bazowy" msgid "type is not an acceptable base type" msgstr "typ nie może być bazowy" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "typ '%q' nie ma atrybutu '%q'" @@ -4386,6 +4377,13 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "Buffer is too small" +#~ msgstr "Bufor jest za mały" + +#~ msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" +#~ msgstr "" +#~ "pixel_shader musi być typu displayio.Palette lub dispalyio.ColorConverter" + #~ msgid "Corrupt .mpy file" #~ msgstr "Uszkodzony plik .mpy" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index d0a815cd11..258a06738c 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -35,12 +35,9 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" -"\n" -"Relate o problema com seu programa em https://github.com/adafruit/" -"circuitpython/issues." #: supervisor/shared/safe_mode.c msgid "" @@ -410,10 +407,6 @@ msgstr "'break' fora do loop" msgid "'continue' outside loop" msgstr "'continue' fora do loop" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "O objeto 'corrotina' não é um iterador" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' exige pelo menos 2 argumentos" @@ -685,11 +678,6 @@ msgstr "Os elementos do buffer devem ter 4 bytes de comprimento ou menos" msgid "Buffer is not a bytearray." msgstr "O buffer não é um bytearray." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "O buffer é muito pequeno" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -709,6 +697,12 @@ msgstr "O buffer deve ser um múltiplo de 512 bytes" msgid "Buffer too short by %d bytes" msgstr "O buffer é muito curto em %d bytes" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "Os buffers devem ter o mesmo tamanho" @@ -1058,10 +1052,6 @@ msgstr "Houve uma falha ao liberar o mutex, err 0x%04x" msgid "Failed to write internal flash." msgstr "Falha ao gravar o flash interno." -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "Falha detectada pelo hardware." - #: py/moduerrno.c msgid "File exists" msgstr "Arquivo já existe" @@ -1141,6 +1131,10 @@ msgstr "O grupo já está em uso" msgid "Half duplex SPI is not implemented" msgstr "O SPI half duplex ainda não está implementado" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1807,6 +1801,10 @@ msgstr "Além de quaisquer módulos no sistema de arquivos\n" msgid "Polygon needs at least 3 points" msgstr "O Polígono precisa de pelo menos 3 pontos" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "" @@ -2044,11 +2042,6 @@ msgstr "A exceção acima foi a causa direta da seguinte exceção:" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "O comprimento dos rgb_pins devem ser 6, 12, 18, 24, ou 30" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" -"A alimentação foi reduzida. Certifique-se de fornecer energia suficiente." - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "A amostragem bits_per_sample não coincide com a do mixer" @@ -2657,8 +2650,7 @@ msgstr "o tamanho do buffer deve coincidir com o formato" msgid "buffer slices must be of equal length" msgstr "as fatias do buffer devem ter o mesmo comprimento" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "o buffer é muito pequeno" @@ -3965,10 +3957,6 @@ msgstr "os parâmetros devem ser registradores na sequência r0 até r3" msgid "pixel coordinates out of bounds" msgstr "as coordenadas do pixel estão fora dos limites" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "o pixel_shader deve ser displayio.Palette ou displayio.ColorConverter" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "a sondagem no arquivo não está disponível no win32" @@ -4280,7 +4268,7 @@ msgstr "o tipo '%q' não é um tipo base aceitável" msgid "type is not an acceptable base type" msgstr "tipo não é um tipo base aceitável" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "o objeto tipo '%q' não possuí atributo '%q'" @@ -4477,6 +4465,32 @@ 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 "" +#~ "\n" +#~ "Please file an issue with your program at https://github.com/adafruit/" +#~ "circuitpython/issues." +#~ msgstr "" +#~ "\n" +#~ "Relate o problema com seu programa em https://github.com/adafruit/" +#~ "circuitpython/issues." + +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "O objeto 'corrotina' não é um iterador" + +#~ msgid "Buffer is too small" +#~ msgstr "O buffer é muito pequeno" + +#~ msgid "Fault detected by hardware." +#~ msgstr "Falha detectada pelo hardware." + +#~ msgid "The power dipped. Make sure you are providing enough power." +#~ msgstr "" +#~ "A alimentação foi reduzida. Certifique-se de fornecer energia suficiente." + +#~ msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" +#~ msgstr "" +#~ "o pixel_shader deve ser displayio.Palette ou displayio.ColorConverter" + #~ msgid "Corrupt .mpy file" #~ msgstr "Arquivo .mpy corrompido" diff --git a/locale/ru.po b/locale/ru.po index ee512bdd65..789dc004de 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -37,8 +37,8 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" #: supervisor/shared/safe_mode.c @@ -400,10 +400,6 @@ msgstr "'break' вне цикла" msgid "'continue' outside loop" msgstr "'continue' вне цикла" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "Объект 'coroutine' не является итератором" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' требует как минимум 2 аргумента" @@ -677,11 +673,6 @@ msgstr "Элементы буфера должны иметь длину не б msgid "Buffer is not a bytearray." msgstr "Буфер не является байтовым массивом (bytearray)." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Буфер слишком мал" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -701,6 +692,12 @@ msgstr "Буфер должен быть кратен 512" msgid "Buffer too short by %d bytes" msgstr "Буфер слишком короткий на %d байт" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "Буферы должны быть одинакового размера" @@ -1059,10 +1056,6 @@ msgstr "Не удалось освободить mutex, ошибка 0x%04x" msgid "Failed to write internal flash." msgstr "Не удалось записать внутреннюю флэш-память." -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "Файл существует" @@ -1146,6 +1139,10 @@ msgstr "Группа уже используется" msgid "Half duplex SPI is not implemented" msgstr "Полудуплексный SPI не реализован" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1808,6 +1805,10 @@ msgstr "" msgid "Polygon needs at least 3 points" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "" @@ -2041,10 +2042,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "Длина rgb_pins должна быть 6, 12, 18, 24 или 30" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "" @@ -2637,8 +2634,7 @@ msgstr "" msgid "buffer slices must be of equal length" msgstr "" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "" @@ -3923,10 +3919,6 @@ msgstr "" msgid "pixel coordinates out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" @@ -4238,7 +4230,7 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" @@ -4435,6 +4427,12 @@ msgstr "zi должно быть типа float" msgid "zi must be of shape (n_section, 2)" msgstr "zi должен иметь форму (n_section, 2)" +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "Объект 'coroutine' не является итератором" + +#~ msgid "Buffer is too small" +#~ msgstr "Буфер слишком мал" + #~ msgid "Corrupt .mpy file" #~ msgstr "Файл .mpy поврежден" diff --git a/locale/sv.po b/locale/sv.po index 3fe6408229..fea4e31f55 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -35,12 +35,9 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" -"\n" -"Skicka in ett ärende med ditt program till https://github.com/adafruit/" -"circuitpython/issues." #: supervisor/shared/safe_mode.c msgid "" @@ -407,10 +404,6 @@ msgstr "'break' utanför loop" msgid "'continue' outside loop" msgstr "'continue' utanför loop" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "objektet 'coroutine\" är inte en iterator" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' kräver minst 2 argument" @@ -680,11 +673,6 @@ msgstr "Buffertelement måste vara fyra byte långa eller mindre" msgid "Buffer is not a bytearray." msgstr "Buffert är inte en bytearray." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Bufferten är för liten" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -704,6 +692,12 @@ msgstr "Bufferten måste vara en multipel av 512 byte" msgid "Buffer too short by %d bytes" msgstr "Buffert är %d bytes för kort" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "Buffertarna måste ha samma storlek" @@ -1051,10 +1045,6 @@ msgstr "Det gick inte att frigöra mutex, fel 0x%04x" msgid "Failed to write internal flash." msgstr "Det gick inte att skriva till intern flash." -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "Fel upptäckt av hårdvara." - #: py/moduerrno.c msgid "File exists" msgstr "Filen finns redan" @@ -1132,6 +1122,10 @@ msgstr "Grupp används redan" msgid "Half duplex SPI is not implemented" msgstr "Halvduplex SPI är inte implementerat" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1791,6 +1785,10 @@ msgstr "Plus eventuella moduler i filsystemet\n" msgid "Polygon needs at least 3 points" msgstr "Polygonen behöver minst 3 punkter" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "Prefixbufferten måste finnas på heap" @@ -2024,10 +2022,6 @@ msgstr "Ovanstående undantag var den direkta orsaken till följande undantag:" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "Längden på rgb_pins vara 6, 12, 18, 24 eller 30" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "Spänningen sjönk. Se till att du ger tillräckligt med ström." - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "Samplingens bits_per_sample matchar inte mixerns" @@ -2628,8 +2622,7 @@ msgstr "buffertstorleken måste matcha formatet" msgid "buffer slices must be of equal length" msgstr "buffertsegmenten måste vara lika långa" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "buffert för liten" @@ -3924,11 +3917,6 @@ msgstr "parametrarna måste registreras i följd r0-r3" msgid "pixel coordinates out of bounds" msgstr "pixelkoordinater utanför gränserna" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" -"pixel_shader måste vara displayio.Palette eller displayio.ColorConverter" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "filbevakning är inte tillgänglig på win32" @@ -4240,7 +4228,7 @@ msgstr "typ '%q' är inte en acceptabel bastyp" msgid "type is not an acceptable base type" msgstr "typ är inte en acceptabel bastyp" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "typobjektet '%q' har inget attribut '%q'" @@ -4437,6 +4425,31 @@ 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 "" +#~ "\n" +#~ "Please file an issue with your program at https://github.com/adafruit/" +#~ "circuitpython/issues." +#~ msgstr "" +#~ "\n" +#~ "Skicka in ett ärende med ditt program till https://github.com/adafruit/" +#~ "circuitpython/issues." + +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "objektet 'coroutine\" är inte en iterator" + +#~ msgid "Buffer is too small" +#~ msgstr "Bufferten är för liten" + +#~ msgid "Fault detected by hardware." +#~ msgstr "Fel upptäckt av hårdvara." + +#~ msgid "The power dipped. Make sure you are providing enough power." +#~ msgstr "Spänningen sjönk. Se till att du ger tillräckligt med ström." + +#~ msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" +#~ msgstr "" +#~ "pixel_shader måste vara displayio.Palette eller displayio.ColorConverter" + #~ msgid "Corrupt .mpy file" #~ msgstr "Skadad .mpy-fil" diff --git a/locale/tr.po b/locale/tr.po index e0d4a32179..919e433e85 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -37,8 +37,8 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" #: supervisor/shared/safe_mode.c @@ -402,10 +402,6 @@ msgstr "döngü dışında 'break'" msgid "'continue' outside loop" msgstr "döngü dışında 'continue'" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "'coroutine' nesnesi bir iteratör değildir" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' en az 2 argümana ihtiyaç duyar" @@ -675,11 +671,6 @@ msgstr "Buffer elementleri 4 bit olmak zorunda" msgid "Buffer is not a bytearray." msgstr "Buffer bir bytearray değil." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Arabellek çok küçük" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -699,6 +690,12 @@ msgstr "Buffer 512 bitin katı olmalı" msgid "Buffer too short by %d bytes" msgstr "Buffer bitten %d daha az" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "Arabellek boyutları aynı olmalı" @@ -1042,10 +1039,6 @@ msgstr "Muteks serbest bırakılamadı, err 0x%04x" msgid "Failed to write internal flash." msgstr "Dahili flaş yazılamadı." -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "" - #: py/moduerrno.c msgid "File exists" msgstr "Dosya var" @@ -1125,6 +1118,10 @@ msgstr "Grup zaten kullanılıyor" msgid "Half duplex SPI is not implemented" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1772,6 +1769,10 @@ msgstr "" msgid "Polygon needs at least 3 points" msgstr "" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "" @@ -2006,10 +2007,6 @@ msgstr "" msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "" - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "" @@ -2600,8 +2597,7 @@ msgstr "" msgid "buffer slices must be of equal length" msgstr "" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "" @@ -3886,10 +3882,6 @@ msgstr "" msgid "pixel coordinates out of bounds" msgstr "" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "" @@ -4201,7 +4193,7 @@ msgstr "" msgid "type is not an acceptable base type" msgstr "" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "" @@ -4398,6 +4390,12 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "'coroutine' nesnesi bir iteratör değildir" + +#~ msgid "Buffer is too small" +#~ msgstr "Arabellek çok küçük" + #~ msgid "Corrupt .mpy file" #~ msgstr "Bozuk .mpy dosyası" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 3ec08ea439..9bcd6a4fbc 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -37,12 +37,9 @@ msgstr "" #: supervisor/shared/safe_mode.c msgid "" "\n" -"Please file an issue with your program at https://github.com/adafruit/" -"circuitpython/issues." +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." msgstr "" -"\n" -"qǐng zài https://github.com/adafruit/circuitpython/issues tí jiāo nín de " -"chéng xù wèn tí." #: supervisor/shared/safe_mode.c msgid "" @@ -409,10 +406,6 @@ msgstr "'break' wèiyú xúnhuán zhīwài" msgid "'continue' outside loop" msgstr "'continue' wèiyú xúnhuán zhīwài" -#: py/objgenerator.c -msgid "'coroutine' object is not an iterator" -msgstr "'coroutine' duìxiàng búshì yígè diédàiqì" - #: py/compile.c msgid "'data' requires at least 2 arguments" msgstr "'data' xūyào zhìshǎo 2 gè cānshù" @@ -682,11 +675,6 @@ msgstr "huǎnchōngqū de yuánsù bìxū wéi 4 zìjié cháng huò gèngshǎo" msgid "Buffer is not a bytearray." msgstr "Huǎnchōng qū bùshì bytearray." -#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c -#: shared-bindings/framebufferio/FramebufferDisplay.c -msgid "Buffer is too small" -msgstr "Huǎnchōng qū tài xiǎo" - #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format msgid "Buffer length %d too big. It must be less than %d" @@ -706,6 +694,12 @@ msgstr "Huǎnchōngqū bìxū shì 512 zìjié de bèishù" msgid "Buffer too short by %d bytes" msgstr "Huǎnchōngqū tàiduǎn , mùqián zhǐyǒu %d zìjié" +#: ports/cxd56/common-hal/camera/Camera.c shared-bindings/displayio/Display.c +#: shared-bindings/framebufferio/FramebufferDisplay.c +#: shared-bindings/struct/__init__.c shared-module/struct/__init__.c +msgid "Buffer too small" +msgstr "" + #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" msgstr "huǎnchōng qū bìxū dàxiǎo xiāngtóng" @@ -1053,10 +1047,6 @@ msgstr "Wúfǎ shìfàng mutex, err 0x%04x" msgid "Failed to write internal flash." msgstr "Wúfǎ xiě rù nèibù shǎncún." -#: supervisor/shared/safe_mode.c -msgid "Fault detected by hardware." -msgstr "yìng jiàn jiǎn cè dào gù zhàng." - #: py/moduerrno.c msgid "File exists" msgstr "Wénjiàn cúnzài" @@ -1136,6 +1126,10 @@ msgstr "Jítuán yǐjīng shǐyòngguò" msgid "Half duplex SPI is not implemented" msgstr "wèi shí xiàn bàn shuāng gōng SPI" +#: supervisor/shared/safe_mode.c +msgid "Hard fault: memory access or instruction error." +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c #: ports/stm/common-hal/busio/SPI.c ports/stm/common-hal/busio/UART.c @@ -1795,6 +1789,10 @@ msgstr "Zài wénjiàn xìtǒng shàng tiānjiā rènhé mókuài\n" msgid "Polygon needs at least 3 points" msgstr "Duōbiānxíng zhìshǎo xūyào 3 diǎn" +#: supervisor/shared/safe_mode.c +msgid "Power dipped. Make sure you are providing enough power." +msgstr "" + #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" msgstr "Qiánzhuì huǎnchōng qū bìxū zài duī shàng" @@ -2028,10 +2026,6 @@ msgstr "shàng shù yì cháng shì yǐ xià yì cháng de zhí jiē yuán yīn: msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" msgstr "Rgb_pins de chángdù bìxū wèi 6,12,18,24 huò 30" -#: supervisor/shared/safe_mode.c -msgid "The power dipped. Make sure you are providing enough power." -msgstr "lì liàng xià jiàng le. què bǎo nín tí gòng zú gòu de diàn lì." - #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" msgstr "Yàngběn de bits_per_sample yǔ hǔn yīn qì bù pǐpèi" @@ -2632,8 +2626,7 @@ msgstr "huǎnchōng qū dàxiǎo bìxū pǐpèi géshì" msgid "buffer slices must be of equal length" msgstr "huǎnchōng qū qiēpiàn bìxū chángdù xiāngděng" -#: py/modstruct.c shared-bindings/struct/__init__.c -#: shared-module/struct/__init__.c +#: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" msgstr "huǎnchōng qū tài xiǎo" @@ -3927,10 +3920,6 @@ msgstr "cānshù bìxū shì xùliè r0 zhì r3 de dēngjì qì" msgid "pixel coordinates out of bounds" msgstr "xiàngsù zuòbiāo chāochū biānjiè" -#: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c -msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" -msgstr "pixel_shader bìxū shì displayio.Palette huò displayio.ColorConverter" - #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" msgstr "zài win32 shàng bù tí gōng wén jiàn tóu piào" @@ -4245,7 +4234,7 @@ msgstr "lèixíng '%q' bùshì kě jiēshòu de jīchǔ lèixíng" msgid "type is not an acceptable base type" msgstr "lèixíng bùshì kě jiēshòu de jīchǔ lèixíng" -#: py/objgenerator.c py/runtime.c +#: py/runtime.c msgid "type object '%q' has no attribute '%q'" msgstr "lèixíng duìxiàng '%q' méiyǒu shǔxìng '%q'" @@ -4442,6 +4431,31 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "" +#~ "\n" +#~ "Please file an issue with your program at https://github.com/adafruit/" +#~ "circuitpython/issues." +#~ msgstr "" +#~ "\n" +#~ "qǐng zài https://github.com/adafruit/circuitpython/issues tí jiāo nín de " +#~ "chéng xù wèn tí." + +#~ msgid "'coroutine' object is not an iterator" +#~ msgstr "'coroutine' duìxiàng búshì yígè diédàiqì" + +#~ msgid "Buffer is too small" +#~ msgstr "Huǎnchōng qū tài xiǎo" + +#~ msgid "Fault detected by hardware." +#~ msgstr "yìng jiàn jiǎn cè dào gù zhàng." + +#~ msgid "The power dipped. Make sure you are providing enough power." +#~ msgstr "lì liàng xià jiàng le. què bǎo nín tí gòng zú gòu de diàn lì." + +#~ msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" +#~ msgstr "" +#~ "pixel_shader bìxū shì displayio.Palette huò displayio.ColorConverter" + #~ msgid "Corrupt .mpy file" #~ msgstr "sǔnhuài de .mpy wénjiàn" From 96a3b884f62b745c481259e201ecfcb49120586a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 22 Aug 2023 21:04:49 -0500 Subject: [PATCH 1560/1712] Unconditionally use sphinx_rtd_theme when building docs This is a speculative fix for the latest build failure on RTD, https://readthedocs.org/projects/circuitpython/builds/21689508/ which appears to be due to a change in RTD's "conf.py.tmpl" https://github.com/readthedocs/readthedocs.org/commit/2066e3486a25bbd76431e1f8c20be3da0043f03a ``` Traceback (most recent call last): File "/home/docs/checkouts/readthedocs.org/user_builds/circuitpython/envs/latest/lib/python3.11/site-packages/sphinx/config.py", line 358, in eval_config_file exec(code, namespace) # NoQA: S102 ^^^^^^^^^^^^^^^^^^^^^ File "/home/docs/checkouts/readthedocs.org/user_builds/circuitpython/checkouts/latest/conf.py", line 600, in 'html_theme': html_theme, ^^^^^^^^^^ NameError: name 'html_theme' is not defined ``` --- conf.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/conf.py b/conf.py index e14c6ace83..dd2de7b899 100644 --- a/conf.py +++ b/conf.py @@ -265,19 +265,9 @@ rst_epilog = """ # -- Options for HTML output ---------------------------------------------- -# on_rtd is whether we are on readthedocs.org -on_rtd = os.environ.get('READTHEDOCS', None) == 'True' - -if not on_rtd: # only import and set the theme if we're building docs locally - try: - import sphinx_rtd_theme - html_theme = 'sphinx_rtd_theme' - html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.'] - except: - html_theme = 'default' - html_theme_path = ['.'] -else: - html_theme_path = ['.'] +import sphinx_rtd_theme +html_theme = 'sphinx_rtd_theme' +html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.'] # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the From 6eccdd9e7d39e21974161969f80466c9b3e790ff Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Tue, 22 Aug 2023 23:10:07 -0400 Subject: [PATCH 1561/1712] Pimoroni PICO DV Base w/Pico W (network disabled) --- .../boards/pimoroni_pico_dv_base_w/board.c | 52 ++++++++++++ .../boards/pimoroni_pico_dv_base_w/link.ld | 1 + .../pimoroni_pico_dv_base_w/mpconfigboard.h | 9 ++ .../pimoroni_pico_dv_base_w/mpconfigboard.mk | 18 ++++ .../pico-sdk-configboard.h | 4 + .../boards/pimoroni_pico_dv_base_w/pins.c | 82 +++++++++++++++++++ 6 files changed, 166 insertions(+) create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/link.ld create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c new file mode 100644 index 0000000000..ee86bb3651 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c @@ -0,0 +1,52 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "bindings/picodvi/Framebuffer.h" +#include "shared-module/displayio/__init__.h" +#include "shared-bindings/framebufferio/FramebufferDisplay.h" + +void board_init(void) { + picodvi_framebuffer_obj_t *fb = &allocate_display_bus()->picodvi; + fb->base.type = &picodvi_framebuffer_type; + common_hal_picodvi_framebuffer_construct(fb, 320, 240, + &pin_GPIO7, &pin_GPIO6, + &pin_GPIO9, &pin_GPIO8, + &pin_GPIO11, &pin_GPIO10, + &pin_GPIO13, &pin_GPIO12, + 8); + + framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; + display->base.type = &framebufferio_framebufferdisplay_type; + common_hal_framebufferio_framebufferdisplay_construct( + display, + MP_OBJ_FROM_PTR(fb), + 0, + true); +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/link.ld b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/link.ld new file mode 100644 index 0000000000..e814bead4c --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/link.ld @@ -0,0 +1 @@ +firmware_size = 1532k; diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h new file mode 100644 index 0000000000..50e8c0ca9d --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h @@ -0,0 +1,9 @@ +#define MICROPY_HW_BOARD_NAME "Pimoroni Pico DV Base W" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1) +#define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO1) +#define DEFAULT_UART_BUS_TX (&pin_GPIO0) + diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk new file mode 100644 index 0000000000..66cee41e07 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk @@ -0,0 +1,18 @@ +USB_VID = 0x2E8A +USB_PID = 0x105A +USB_PRODUCT = "Pimoroni Pico DV Demo Base for Pico W" +USB_MANUFACTURER = "Pimoroni" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" + +CIRCUITPY__EVE = 1 +CIRCUITPY_PICODVI = 1 + +# Must be accompanied by a linker script change +CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h new file mode 100644 index 0000000000..a41131dd22 --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h @@ -0,0 +1,4 @@ +// Put board-specific pico-sdk definitions here. This file must exist. + +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c new file mode 100644 index 0000000000..98a593310f --- /dev/null +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c @@ -0,0 +1,82 @@ +#include "shared-bindings/board/__init__.h" + +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_GP1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_GP9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_B), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_C), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_GP18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_GP19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_GP20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_GP21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_GP22), MP_ROM_PTR(&pin_GPIO22) }, + + // SD Card + { MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO5)}, + { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO18)}, + { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO19)}, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO22)}, + + { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_BIT_CLOCK), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27_A1), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_GP27), MP_ROM_PTR(&pin_GPIO27) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO27) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_DATA), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28_A2), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_GP28), MP_ROM_PTR(&pin_GPIO28) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO28) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO29) }, + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO29) }, + + // DVI VIDEO + { MP_ROM_QSTR(MP_QSTR_DV_CEC), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_DV_SCL), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_DV_SDA), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_CKN), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_CKP), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D0N), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D0P), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D1N), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D1P), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D2N), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D2P), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_DV_HPD), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].framebuffer_display)}, +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From d333ae9f5d673d61bb2db47e81ee518532a438eb Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Tue, 22 Aug 2023 23:46:43 -0400 Subject: [PATCH 1562/1712] Local pre-commit run changes --- ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h index 50e8c0ca9d..917fa85ab7 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h @@ -6,4 +6,3 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO1) #define DEFAULT_UART_BUS_TX (&pin_GPIO0) - From 9064c6e7cb163e0b310827285c2dbe56076db8da Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 23 Aug 2023 07:22:28 -0500 Subject: [PATCH 1563/1712] ci_set_matrix: changing conf.py should not rebuild all boards --- tools/ci_set_matrix.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ci_set_matrix.py b/tools/ci_set_matrix.py index f549b6f6f1..51876d9b2b 100755 --- a/tools/ci_set_matrix.py +++ b/tools/ci_set_matrix.py @@ -45,6 +45,7 @@ from shared_bindings_matrix import ( # Files that never influence board builds IGNORE_BOARD = { ".devcontainer", + "conf.py", "docs", "tests", "tools/ci_changes_per_commit.py", From 2cc05f7ac8e95863286e3bd92e0275a6d2508b52 Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Wed, 23 Aug 2023 20:04:51 +0300 Subject: [PATCH 1564/1712] Picow-ap wifi improvements --- locale/circuitpython.pot | 16 ++---- ports/raspberrypi/common-hal/wifi/Radio.c | 64 ++++++++++++++--------- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index e0e3149866..8f55044e81 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -447,6 +447,10 @@ msgstr "" msgid "ADC2 is being used by WiFi" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1959,10 +1963,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "" @@ -2337,14 +2337,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "" - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "" - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "" diff --git a/ports/raspberrypi/common-hal/wifi/Radio.c b/ports/raspberrypi/common-hal/wifi/Radio.c index 7ccb41c0d6..1508b764a2 100644 --- a/ports/raspberrypi/common-hal/wifi/Radio.c +++ b/ports/raspberrypi/common-hal/wifi/Radio.c @@ -157,11 +157,6 @@ void common_hal_wifi_radio_start_station(wifi_radio_obj_t *self) { void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self) { cyw43_wifi_leave(&cyw43_state, CYW43_ITF_STA); - // This is wrong, but without this call the state of ITF_STA is still - // reported as CYW43_LINK_JOIN (by wifi_link_status) and CYW43_LINK_UP - // (by tcpip_link_status). However since ap disconnection isn't working - // either, this is not an issue. - cyw43_wifi_leave(&cyw43_state, CYW43_ITF_AP); const size_t timeout_ms = 500; uint64_t start = port_get_raw_ticks(NULL); uint64_t deadline = start + timeout_ms; @@ -179,9 +174,15 @@ void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_ mp_raise_RuntimeError(translate("Wifi is not enabled")); } - if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_DOWN) { - mp_raise_RuntimeError(translate("Wifi is in station mode.")); - } + /* TODO: If the AP is stopped once it cannot be restarted. + * This means that if if the user does: + * + * wifi.radio.start_ap(...) + * wifi.radio.stop_ap() + * wifi.radio.start_ap(...) + * + * The second start_ap will fail. + */ common_hal_wifi_radio_stop_ap(self); @@ -189,10 +190,29 @@ void common_hal_wifi_radio_start_ap(wifi_radio_obj_t *self, uint8_t *ssid, size_ // Defaults to 1 if not set or invalid (i.e. 13) cyw43_wifi_ap_set_channel(&cyw43_state, (const uint32_t)channel); - cyw43_arch_enable_ap_mode((const char *)ssid, (const char *)password, CYW43_AUTH_WPA2_AES_PSK); + if (password_len) { + cyw43_arch_enable_ap_mode((const char *)ssid, (const char *)password, CYW43_AUTH_WPA2_AES_PSK); + } else { + cyw43_arch_enable_ap_mode((const char *)ssid, NULL, CYW43_AUTH_OPEN); + } // TODO: Implement authmode check like in espressif bindings_cyw43_wifi_enforce_pm(); + + const size_t timeout_ms = 500; + uint64_t start = port_get_raw_ticks(NULL); + uint64_t deadline = start + timeout_ms; + while (port_get_raw_ticks(NULL) < deadline && (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_AP) != CYW43_LINK_UP)) { + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + break; + } + } + if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_AP) != CYW43_LINK_UP) { + common_hal_wifi_radio_stop_ap(self); + // This is needed since it leaves a broken AP up. + mp_raise_RuntimeError(translate("AP could not be started")); + } } bool common_hal_wifi_radio_get_ap_active(wifi_radio_obj_t *self) { @@ -204,19 +224,19 @@ void common_hal_wifi_radio_stop_ap(wifi_radio_obj_t *self) { mp_raise_RuntimeError(translate("wifi is not enabled")); } - if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_AP) != CYW43_LINK_DOWN) { - mp_raise_NotImplementedError(translate("Stopping AP is not supported.")); + cyw43_arch_disable_ap_mode(); + + const size_t timeout_ms = 500; + uint64_t start = port_get_raw_ticks(NULL); + uint64_t deadline = start + timeout_ms; + while (port_get_raw_ticks(NULL) < deadline && (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_AP) != CYW43_LINK_DOWN)) { + RUN_BACKGROUND_TASKS; + if (mp_hal_is_interrupted()) { + break; + } } - /* - * AP cannot be disconnected. cyw43_wifi_leave is broken. - * This code snippet should work, but doesn't. - * - * cyw43_wifi_leave(&cyw43_state, CYW43_ITF_AP); - * cyw43_wifi_leave(&cyw43_state, CYW43_ITF_STA); - * - * bindings_cyw43_wifi_enforce_pm(); - */ + bindings_cyw43_wifi_enforce_pm(); } static bool connection_unchanged(wifi_radio_obj_t *self, const uint8_t *ssid, size_t ssid_len) { @@ -237,10 +257,6 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t mp_raise_RuntimeError(translate("Wifi is not enabled")); } - if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_AP) != CYW43_LINK_DOWN) { - mp_raise_RuntimeError(translate("Wifi is in access point mode.")); - } - if (ssid_len > 32) { return WIFI_RADIO_ERROR_CONNECTION_FAIL; } From e3314ef7a6507bb406ae06e3f7df1c99e9acf30e Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Wed, 23 Aug 2023 22:12:19 +0300 Subject: [PATCH 1565/1712] Add new picow doc notes --- shared-bindings/wifi/Radio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 495e7fd13b..798c7c6d2e 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -332,8 +332,9 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station); //| //| **Limitations:** On Espressif, ``authmode`` with a non-empty password must include //| `wifi.AuthMode.PSK`, and one or both of `wifi.AuthMode.WPA` and `wifi.AuthMode.WPA2`. -//| On Pi Pico W, ``authmode`` is ignored; it is always ``(wifi.AuthMode.WPA2, wifi.AuthMode.PSK)` -//| with a non-empty password, or ``(wifi.AuthMode.OPEN,)`` when no password is given. +//| On Pi Pico W, ``authmode`` is ignored; it is always ``(wifi.AuthMode.WPA2, wifi.AuthMode.PSK)`` +//| with a non-empty password, or ``(wifi.AuthMode.OPEN)``, when no password is given. +//| On Pi Pico W, the AP can be started and stopped only once per reboot. //| //| The length of ``password`` must be 8-63 characters if it is ASCII, //| or exactly 64 hexadecimal characters if it is the hex form of the 256-bit key. From 4d8b354c131632fe49aa5f8123d80fb80b81aea6 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 23 Aug 2023 14:01:02 -0500 Subject: [PATCH 1566/1712] Use qstrs to improve compression any qstr of >= 3 chars long is a candidate for use; the input byte value (1) is used to indicate a fixed-length qstr number follows. Before accounting for the code size changes, this saves ~100 bytes on trinket m0, but it may end up being a wash due to added code. A cutoff of length>2 is slightly better for ja and ru and worse for others. This has to do with the relative frequency of latin characters vs non-latin characters, is my guess. lang after before change (- = more free space) en_US 3132 2996 -134 fr 2136 2060 -76 ja 1916 1724 -232 ru 2196 2000 -196 --- py/maketranslationdata.py | 188 +++++++++++++----------- py/py.mk | 2 +- supervisor/shared/translate/translate.c | 54 +++++-- 3 files changed, 144 insertions(+), 100 deletions(-) diff --git a/py/maketranslationdata.py b/py/maketranslationdata.py index a07f70265c..9b75e06996 100644 --- a/py/maketranslationdata.py +++ b/py/maketranslationdata.py @@ -1,7 +1,9 @@ """ Process raw qstr file and output qstr data with length, hash and data bytes. -This script works with Python 2.7, 3.3 and 3.4. +This script is only regularly tested with the same version of Python used +during CI, typically the latest "3.x". However, incompatibilities with any +supported CPython version are unintended. For documentation about the format of compressed translated strings, see supervisor/shared/translate/translate.h @@ -16,31 +18,16 @@ import sys import collections import gettext -import os.path +import pathlib if hasattr(sys.stdout, "reconfigure"): sys.stdout.reconfigure(encoding="utf-8") sys.stderr.reconfigure(errors="backslashreplace") -py = os.path.dirname(sys.argv[0]) -top = os.path.dirname(py) - -sys.path.append(os.path.join(top, "tools/huffman")) +sys.path.append(str(pathlib.Path(__file__).parent.parent / "tools/huffman")) import huffman - -# Python 2/3 compatibility: -# - iterating through bytes is different -# - codepoint2name lives in a different module -import platform - -if platform.python_version_tuple()[0] == "2": - bytes_cons = lambda val, enc=None: bytearray(val) - from htmlentitydefs import codepoint2name -elif platform.python_version_tuple()[0] == "3": - bytes_cons = bytes - from html.entities import codepoint2name -# end compatibility code +from html.entities import codepoint2name codepoint2name[ord("-")] = "hyphen" @@ -182,9 +169,15 @@ class EncodingTable: extractor: object apply_offset: object remove_offset: object + translation_qstr_bits: int + qstrs: object + qstrs_inv: object -def compute_huffman_coding(translation_name, translations, f): +def compute_huffman_coding(qstrs, translation_name, translations, f): + # possible future improvement: some languages are better when consider len(k) > 2. try both? + qstrs = dict((k, v) for k, v in qstrs.items() if len(k) > 3) + qstr_strs = list(qstrs.keys()) texts = [t[1] for t in translations] words = [] @@ -234,10 +227,12 @@ def compute_huffman_coding(translation_name, translations, f): # if "the" is in words then not only will "the" not be considered # again, neither will "there" or "wither", since they have "the" # as substrings. - extractor = TextSplitter(words) + extractor = TextSplitter(words + qstr_strs) counter = collections.Counter() for t in texts: for atom in extractor.iter(t): + if atom in qstrs: + atom = "\1" counter[atom] += 1 cb = huffman.codebook(counter.items()) lengths = sorted(dict((v, len(cb[k])) for k, v in counter.items()).items()) @@ -304,10 +299,14 @@ def compute_huffman_coding(translation_name, translations, f): words.append(word) words.sort(key=len) - extractor = TextSplitter(words) + extractor = TextSplitter(words + qstr_strs) counter = collections.Counter() + used_qstr = 0 for t in texts: for atom in extractor.iter(t): + if atom in qstrs: + used_qstr = max(used_qstr, qstrs[atom]) + atom = "\1" counter[atom] += 1 cb = huffman.codebook(counter.items()) @@ -322,6 +321,8 @@ def compute_huffman_coding(translation_name, translations, f): last_length = None canonical = {} for atom, code in sorted(cb.items(), key=lambda x: (len(x[1]), x[0])): + if atom in qstr_strs: + atom = "\1" values.append(atom) length = len(code) if length not in length_count: @@ -359,6 +360,8 @@ def compute_huffman_coding(translation_name, translations, f): minlen = len(words[0]) wlencount = [len([None for w in words if len(w) == l]) for l in range(minlen, maxlen + 1)] + translation_qstr_bits = used_qstr.bit_length() + f.write("typedef {} mchar_t;\n".format(values_type)) f.write("const uint8_t lengths[] = {{ {} }};\n".format(", ".join(map(str, lengths)))) f.write( @@ -383,34 +386,44 @@ def compute_huffman_coding(translation_name, translations, f): f.write("#define maxlen {}\n".format(maxlen)) f.write("#define translation_offstart {}\n".format(offstart)) f.write("#define translation_offset {}\n".format(offset)) + f.write("#define translation_qstr_bits {}\n".format(translation_qstr_bits)) - return EncodingTable(values, lengths, words, canonical, extractor, apply_offset, remove_offset) + qstrs_inv = dict((v, k) for k, v in qstrs.items()) + return EncodingTable( + values, + lengths, + words, + canonical, + extractor, + apply_offset, + remove_offset, + translation_qstr_bits, + qstrs, + qstrs_inv, + ) def decompress(encoding_table, encoded, encoded_length_bits): + qstrs_inv = encoding_table.qstrs_inv values = encoding_table.values lengths = encoding_table.lengths words = encoding_table.words - dec = [] - this_byte = 0 - this_bit = 7 - b = encoded[this_byte] - bits = 0 - for i in range(encoded_length_bits): - bits <<= 1 - if 0x80 & b: - bits |= 1 + def bititer(): + for byte in encoded: + for bit in (0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1): + yield bool(byte & bit) - b <<= 1 - if this_bit == 0: - this_bit = 7 - this_byte += 1 - if this_byte < len(encoded): - b = encoded[this_byte] - else: - this_bit -= 1 - length = bits + nextbit = bititer().__next__ + + def getnbits(n): + bits = 0 + for i in range(n): + bits = (bits << 1) | nextbit() + return bits + + dec = [] + length = getnbits(encoded_length_bits) i = 0 while i < length: @@ -419,19 +432,8 @@ def decompress(encoding_table, encoded, encoded_length_bits): max_code = lengths[0] searched_length = lengths[0] while True: - bits <<= 1 - if 0x80 & b: - bits |= 1 - - b <<= 1 + bits = (bits << 1) | nextbit() bit_length += 1 - if this_bit == 0: - this_bit = 7 - this_byte += 1 - if this_byte < len(encoded): - b = encoded[this_byte] - else: - this_bit -= 1 if max_code > 0 and bits < max_code: # print('{0:0{width}b}'.format(bits, width=bit_length)) break @@ -439,7 +441,10 @@ def decompress(encoding_table, encoded, encoded_length_bits): searched_length += lengths[bit_length] v = values[searched_length + bits - max_code] - if v >= chr(0x80) and v < chr(0x80 + len(words)): + if v == chr(1): + qstr_idx = getnbits(encoding_table.translation_qstr_bits) + v = qstrs_inv[qstr_idx] + elif v >= chr(0x80) and v < chr(0x80 + len(words)): v = words[ord(v) - 0x80] i += len(v.encode("utf-8")) dec.append(v) @@ -449,36 +454,37 @@ def decompress(encoding_table, encoded, encoded_length_bits): def compress(encoding_table, decompressed, encoded_length_bits, len_translation_encoded): if not isinstance(decompressed, str): raise TypeError() + qstrs = encoding_table.qstrs canonical = encoding_table.canonical extractor = encoding_table.extractor - enc = bytearray(len(decompressed) * 3) - current_bit = 7 - current_byte = 0 + enc = 1 - bits = encoded_length_bits + 1 - for i in range(bits - 1, 0, -1): - if len_translation_encoded & (1 << (i - 1)): - enc[current_byte] |= 1 << current_bit - if current_bit == 0: - current_bit = 7 - current_byte += 1 - else: - current_bit -= 1 + def put_bit(enc, b): + return (enc << 1) | bool(b) + + def put_bits(enc, b, n): + for i in range(n - 1, -1, -1): + enc = put_bit(enc, b & (1 << i)) + return enc + + enc = put_bits(enc, len_translation_encoded, encoded_length_bits) for atom in extractor.iter(decompressed): - for b in canonical[atom]: - if b == "1": - enc[current_byte] |= 1 << current_bit - if current_bit == 0: - current_bit = 7 - current_byte += 1 - else: - current_bit -= 1 + if atom in qstrs: + can = canonical["\1"] + else: + can = canonical[atom] + for b in can: + enc = put_bit(enc, b == "1") + if atom in qstrs: + enc = put_bits(enc, qstrs[atom], encoding_table.translation_qstr_bits) - if current_bit != 7: - current_byte += 1 - return enc[:current_byte] + while enc.bit_length() % 8 != 1: + enc = put_bit(enc, 0) + + r = enc.to_bytes((enc.bit_length() + 7) // 8, "big") + return r[1:] def qstr_escape(qst): @@ -493,10 +499,20 @@ def qstr_escape(qst): return re.sub(r"[^A-Za-z0-9_]", esc_char, qst) +def parse_qstrs(infile): + r = {} + rx = re.compile(r'QDEF\([A-Za-z0-9_]+,\s*\d+,\s*\d+,\s*(?P"(?:[^"\\\\]*|\\.)")\)') + content = infile.read() + for i, mat in enumerate(rx.findall(content, re.M)): + mat = eval(mat) + r[mat] = i + return r + + def parse_input_headers(infiles): i18ns = set() - # read the qstrs in from the input files + # read the TRANSLATE strings in from the input files for infile in infiles: with open(infile, "rt") as f: for line in f: @@ -516,12 +532,12 @@ def escape_bytes(qstr): return qstr else: # qstr contains non-printable codes so render entire thing as hex pairs - qbytes = bytes_cons(qstr, "utf8") + qbytes = bytes(qstr, "utf8") return "".join(("\\x%02x" % b) for b in qbytes) def make_bytes(cfg_bytes_len, cfg_bytes_hash, qstr): - qbytes = bytes_cons(qstr, "utf8") + qbytes = bytes(qstr, "utf8") qlen = len(qbytes) qhash = compute_hash(qbytes, cfg_bytes_hash) if qlen >= (1 << (8 * cfg_bytes_len)): @@ -551,7 +567,7 @@ def output_translation_data(encoding_table, i18ns, out): ) total_text_compressed_size += len(compressed) decompressed = decompress(encoding_table, compressed, encoded_length_bits) - assert decompressed == translation + assert decompressed == translation, (decompressed, translation) for c in C_ESCAPES: decompressed = decompressed.replace(c, C_ESCAPES[c]) formatted = ["{:d}".format(x) for x in compressed] @@ -572,7 +588,7 @@ if __name__ == "__main__": import argparse parser = argparse.ArgumentParser( - description="Process QSTR definitions into headers for compilation" + description="Process TRANSLATE strings into headers for compilation" ) parser.add_argument( "infiles", metavar="N", type=str, nargs="+", help="an integer for the accumulator" @@ -590,13 +606,19 @@ if __name__ == "__main__": type=argparse.FileType("w", encoding="UTF-8"), help="c file for translation data", ) + parser.add_argument( + "--qstrdefs_filename", + type=argparse.FileType("r", encoding="UTF-8"), + help="", + ) args = parser.parse_args() + qstrs = parse_qstrs(args.qstrdefs_filename) i18ns = parse_input_headers(args.infiles) i18ns = sorted(i18ns) translations = translate(args.translation, i18ns) encoding_table = compute_huffman_coding( - args.translation, translations, args.compression_filename + qstrs, args.translation, translations, args.compression_filename ) output_translation_data(encoding_table, translations, args.translation_filename) diff --git a/py/py.mk b/py/py.mk index d26b8752a4..5cbc213414 100644 --- a/py/py.mk +++ b/py/py.mk @@ -270,7 +270,7 @@ $(PY_BUILD)/translations-$(TRANSLATION).c: $(HEADER_BUILD)/compressed_translatio $(HEADER_BUILD)/compressed_translations.generated.h: $(PY_SRC)/maketranslationdata.py $(HEADER_BUILD)/$(TRANSLATION).mo $(HEADER_BUILD)/qstrdefs.generated.h $(STEPECHO) "GEN $@" $(Q)mkdir -p $(PY_BUILD) - $(Q)$(PYTHON) $(PY_SRC)/maketranslationdata.py --compression_filename $(HEADER_BUILD)/compressed_translations.generated.h --translation $(HEADER_BUILD)/$(TRANSLATION).mo --translation_filename $(PY_BUILD)/translations-$(TRANSLATION).c $(HEADER_BUILD)/qstrdefs.preprocessed.h + $(Q)$(PYTHON) $(PY_SRC)/maketranslationdata.py --compression_filename $(HEADER_BUILD)/compressed_translations.generated.h --translation $(HEADER_BUILD)/$(TRANSLATION).mo --translation_filename $(PY_BUILD)/translations-$(TRANSLATION).c --qstrdefs_filename $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/qstrdefs.preprocessed.h PY_CORE_O += $(PY_BUILD)/translations-$(TRANSLATION).o diff --git a/supervisor/shared/translate/translate.c b/supervisor/shared/translate/translate.c index fced90f058..7d57ab3bf2 100644 --- a/supervisor/shared/translate/translate.c +++ b/supervisor/shared/translate/translate.c @@ -25,6 +25,7 @@ */ #include "supervisor/shared/translate/translate.h" +#include "py/qstr.h" #include #include @@ -99,10 +100,34 @@ uint16_t decompress_length(const compressed_string_t *compressed) { #endif } +typedef struct { + const uint8_t *ptr; + uint8_t bit; +} bitstream_state_t; + +static bool next_bit(bitstream_state_t *st) { + bool r = *st->ptr & st->bit; + st->bit >>= 1; + if (!st->bit) { + st->bit = 0x80; + st->ptr++; + } + return r; +} + +static int get_nbits(bitstream_state_t *st, int n) { + int r = 0; + while (n--) { + r = (r << 1) | next_bit(st); + } + return r; +} + char *decompress(const compressed_string_t *compressed, char *decompressed) { - uint8_t this_byte = compress_max_length_bits / 8; - uint8_t this_bit = 7 - compress_max_length_bits % 8; - uint8_t b = (&compressed->data)[this_byte] << (compress_max_length_bits % 8); + bitstream_state_t b = { + .ptr = &(compressed->data) + (compress_max_length_bits >> 3), + .bit = 1 << (7 - ((compress_max_length_bits) & 0x7)), + }; uint16_t length = decompress_length(compressed); // Stop one early because the last byte is always NULL. @@ -112,26 +137,23 @@ char *decompress(const compressed_string_t *compressed, char *decompressed) { uint32_t max_code = lengths[0]; uint32_t searched_length = lengths[0]; while (true) { - bits <<= 1; - if ((0x80 & b) != 0) { - bits |= 1; - } - b <<= 1; + bits = (bits << 1) | next_bit(&b); bit_length += 1; - if (this_bit == 0) { - this_bit = 7; - this_byte += 1; - b = (&compressed->data)[this_byte]; // This may read past the end but its never used. - } else { - this_bit -= 1; - } if (max_code > 0 && bits < max_code) { break; } max_code = (max_code << 1) + lengths[bit_length]; searched_length += lengths[bit_length]; } - i += put_utf8(decompressed + i, values[searched_length + bits - max_code]); + int v = values[searched_length + bits - max_code]; + if (v == 1) { + qstr q = get_nbits(&b, translation_qstr_bits) + 1; // honestly no idea why "+1"... + for (const char *qc = qstr_str(q); *qc;) { + decompressed[i++] = *qc++; + } + } else { + i += put_utf8(decompressed + i, v); + } } decompressed[length - 1] = '\0'; From 2991cc4174cb5e370bcb128ebc8ae16091009a45 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Wed, 23 Aug 2023 10:21:12 +0000 Subject: [PATCH 1567/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (1001 of 1001 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 258a06738c..53b11b70c5 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: 2023-08-22 21:28+0000\n" +"PO-Revision-Date: 2023-08-24 15:48+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 5.0-dev\n" +"X-Generator: Weblate 5.0\n" #: main.c msgid "" @@ -38,6 +38,9 @@ msgid "" "Please file an issue with your program at github.com/adafruit/circuitpython/" "issues." msgstr "" +"\n" +"Registre um problema com o seu programa em github.com/adafruit/circuitpython/" +"issues." #: supervisor/shared/safe_mode.c msgid "" @@ -701,7 +704,7 @@ msgstr "O buffer é muito curto em %d bytes" #: shared-bindings/framebufferio/FramebufferDisplay.c #: shared-bindings/struct/__init__.c shared-module/struct/__init__.c msgid "Buffer too small" -msgstr "" +msgstr "Buffer pequeno demais" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" @@ -1133,7 +1136,7 @@ msgstr "O SPI half duplex ainda não está implementado" #: supervisor/shared/safe_mode.c msgid "Hard fault: memory access or instruction error." -msgstr "" +msgstr "Falha grave: acesso à memória ou erro de instrução." #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c @@ -1803,7 +1806,7 @@ msgstr "O Polígono precisa de pelo menos 3 pontos" #: supervisor/shared/safe_mode.c msgid "Power dipped. Make sure you are providing enough power." -msgstr "" +msgstr "Falta de energia. Certifique-se que está fornecendo energia suficiente." #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" From 499951b675ef38275fe477e0145cecaf0390787a Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Wed, 23 Aug 2023 15:36:22 +0000 Subject: [PATCH 1568/1712] Translated using Weblate (Swedish) Currently translated at 99.9% (1000 of 1001 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index fea4e31f55..80f5342a58 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-08-22 21:28+0000\n" +"PO-Revision-Date: 2023-08-24 15:48+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 5.0-dev\n" +"X-Generator: Weblate 5.0\n" #: main.c msgid "" @@ -38,6 +38,9 @@ msgid "" "Please file an issue with your program at github.com/adafruit/circuitpython/" "issues." msgstr "" +"\n" +"Skapa ett ärende med ditt program på https://github.com/adafruit/" +"circuitpython/issues." #: supervisor/shared/safe_mode.c msgid "" @@ -696,7 +699,7 @@ msgstr "Buffert är %d bytes för kort" #: shared-bindings/framebufferio/FramebufferDisplay.c #: shared-bindings/struct/__init__.c shared-module/struct/__init__.c msgid "Buffer too small" -msgstr "" +msgstr "Buffert för liten" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" @@ -1124,7 +1127,7 @@ msgstr "Halvduplex SPI är inte implementerat" #: supervisor/shared/safe_mode.c msgid "Hard fault: memory access or instruction error." -msgstr "" +msgstr "Hårt fel: minnesåtkomst eller instruktionsfel." #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c @@ -1786,8 +1789,9 @@ msgid "Polygon needs at least 3 points" msgstr "Polygonen behöver minst 3 punkter" #: supervisor/shared/safe_mode.c +#, fuzzy msgid "Power dipped. Make sure you are providing enough power." -msgstr "" +msgstr "Spänningen sjönk. Se till att du ger tillräckligt med ström." #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" From 8fbde14286a6dd0433136ee1396f23797e964de8 Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Thu, 24 Aug 2023 14:50:23 -0400 Subject: [PATCH 1569/1712] utilize CIRCUITPY_CONSOLE_UART_BAUDRATE parameter --- supervisor/shared/serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/serial.c b/supervisor/shared/serial.c index 7bf10ae530..a78ed77f1f 100644 --- a/supervisor/shared/serial.c +++ b/supervisor/shared/serial.c @@ -140,7 +140,7 @@ void serial_early_init(void) { const mcu_pin_obj_t *console_tx = MP_OBJ_TO_PTR(CIRCUITPY_CONSOLE_UART_TX); common_hal_busio_uart_construct(&console_uart, console_tx, console_rx, NULL, NULL, NULL, - false, 115200, 8, BUSIO_UART_PARITY_NONE, 1, 1.0f, sizeof(console_uart_rx_buf), + false, CIRCUITPY_CONSOLE_UART_BAUDRATE, 8, BUSIO_UART_PARITY_NONE, 1, 1.0f, sizeof(console_uart_rx_buf), console_uart_rx_buf, true); common_hal_busio_uart_never_reset(&console_uart); From a6f2615c75deef0ca04fcb69a334e07c2b10084a Mon Sep 17 00:00:00 2001 From: Pablo Martinez Bernal Date: Thu, 24 Aug 2023 17:07:42 +0000 Subject: [PATCH 1570/1712] Translated using Weblate (Spanish) Currently translated at 100.0% (1001 of 1001 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/es/ --- locale/es.po | 53 +++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/locale/es.po b/locale/es.po index 31fea47431..c5bc279dba 100644 --- a/locale/es.po +++ b/locale/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-08-06 17:45+0000\n" +"PO-Revision-Date: 2023-08-24 22:46+0000\n" "Last-Translator: Pablo Martinez Bernal \n" "Language-Team: \n" "Language: es\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 5.0-dev\n" +"X-Generator: Weblate 5.0\n" #: main.c msgid "" @@ -40,6 +40,9 @@ msgid "" "Please file an issue with your program at github.com/adafruit/circuitpython/" "issues." msgstr "" +"\n" +"Por favor abre una issue con tu programa en github.com/adafruit/" +"circuitpython/issues." #: supervisor/shared/safe_mode.c msgid "" @@ -269,19 +272,19 @@ msgstr "%q=%q" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts in more bits than pin count" -msgstr "" +msgstr "%q[%u] lee mas bits que la cantidad de pines" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts out more bits than pin count" -msgstr "" +msgstr "%q[%u] escribe mas bits que la cantidad de pines" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] uses extra pin" -msgstr "" +msgstr "%q[%u] usa un pin extra" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] waits on input outside of count" -msgstr "" +msgstr "%q[%u] espera entrada fuera del contador" #: ports/espressif/common-hal/espidf/__init__.c #, c-format @@ -431,7 +434,7 @@ msgstr "'yield' fuera de una función" #: py/compile.c msgid "* arg after **" -msgstr "" +msgstr "* argumento tras **" #: py/compile.c msgid "*x must be assignment target" @@ -700,7 +703,7 @@ msgstr "Buffer muy corto por %d bytes" #: shared-bindings/framebufferio/FramebufferDisplay.c #: shared-bindings/struct/__init__.c shared-module/struct/__init__.c msgid "Buffer too small" -msgstr "" +msgstr "Buffer demasiado pequeño" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" @@ -1136,7 +1139,7 @@ msgstr "SPI Half Duplex no está implementado" #: supervisor/shared/safe_mode.c msgid "Hard fault: memory access or instruction error." -msgstr "" +msgstr "Fallo grave: error de acceso a memoria o de instrucción." #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c @@ -1384,31 +1387,31 @@ msgstr "Inconsistencia en el flag de recambio" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] reads pin(s)" -msgstr "" +msgstr "Falta first_in_pin. %q[%u] lee pin(es)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" -msgstr "" +msgstr "Falta first_in_pin. %q[%u] mueve desde pin(es)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] waits based on pin" -msgstr "" +msgstr "Falta first_in_pin. %q[%u] espera basado en un pin" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" -msgstr "" +msgstr "Falta first_out_pin. %q[%u] mueve hacia pin(es)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] writes pin(s)" -msgstr "" +msgstr "Falta first_out_pin. %q[%u] escribe en pin(es)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_set_pin. %q[%u] sets pin(s)" -msgstr "" +msgstr "Falta first_set_pin. %q[%u] configura pin(es)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing jmp_pin. %q[%u] jumps on pin" -msgstr "" +msgstr "Falta jmp_pin. %q[%u] salta en pin" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -1805,7 +1808,7 @@ msgstr "El polígono necesita al menos 3 puntos" #: supervisor/shared/safe_mode.c msgid "Power dipped. Make sure you are providing enough power." -msgstr "" +msgstr "Falta de potencia. Asegura que estás suministrando suficiente potencia." #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" @@ -2567,7 +2570,7 @@ msgstr "array/bytes requeridos en el lado derecho" #: py/asmxtensa.c msgid "asm overflow" -msgstr "" +msgstr "desborde de asm" #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" @@ -2659,7 +2662,7 @@ msgstr "búfer muy pequeño para los bytes solicitados" #: py/emitbc.c msgid "bytecode overflow" -msgstr "" +msgstr "desborde de bytecode" #: py/objarray.c msgid "bytes length not a multiple of item size" @@ -2821,7 +2824,7 @@ msgstr "" #: extmod/moduasyncio.c msgid "can't wait" -msgstr "" +msgstr "no se puede esperar" #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" @@ -3260,7 +3263,7 @@ msgstr "import * no a nivel de módulo" #: py/persistentcode.c msgid "incompatible .mpy arch" -msgstr "" +msgstr "arquitectura de .mpy incompatible" #: py/persistentcode.c msgid "incompatible .mpy file" @@ -3732,7 +3735,7 @@ msgstr "no es 128-bit UUID" #: py/parse.c msgid "not a constant" -msgstr "" +msgstr "no es una constante" #: py/objstr.c msgid "not all arguments converted during string formatting" @@ -3971,11 +3974,11 @@ msgstr "port debe ser be >= 0" #: py/compile.c msgid "positional arg after **" -msgstr "" +msgstr "argumento posicional tras **" #: py/compile.c msgid "positional arg after keyword arg" -msgstr "" +msgstr "argumento posicional tras argumento con nombre" #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" @@ -4207,7 +4210,7 @@ msgstr "tobytes solo pueden ser invocados por arrays densos" #: py/compile.c msgid "too many args" -msgstr "" +msgstr "demasiados argumentos" #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" From 74fc5faf8897fc0efe8baab846f2b27392d94f71 Mon Sep 17 00:00:00 2001 From: hexthat Date: Fri, 25 Aug 2023 16:10:48 +0000 Subject: [PATCH 1571/1712] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (1001 of 1001 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 52 +++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 9bcd6a4fbc..d528bea8c0 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-08-07 14:52+0000\n" +"PO-Revision-Date: 2023-08-25 16:38+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -15,7 +15,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 5.0-dev\n" +"X-Generator: Weblate 5.0.1-dev\n" #: main.c msgid "" @@ -40,6 +40,8 @@ msgid "" "Please file an issue with your program at github.com/adafruit/circuitpython/" "issues." msgstr "" +"\n" +"qǐngzài github.com/adafruit/circuitpython/issues tíjiāo nínde chéngxù wèntí." #: supervisor/shared/safe_mode.c msgid "" @@ -270,19 +272,19 @@ msgstr "%q=%q" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts in more bits than pin count" -msgstr "" +msgstr "%q[%u] piānyí de wèishù duōyú yǐnjiǎo shù" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts out more bits than pin count" -msgstr "" +msgstr "%q[%u] yíchū de wèishù duōyú yǐnjiǎo shù" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] uses extra pin" -msgstr "" +msgstr "%q[%u] shǐyòng éwài de yǐnjiǎo" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] waits on input outside of count" -msgstr "" +msgstr "%q[%u] děngdài jìshù zhīwài de shūrù" #: ports/espressif/common-hal/espidf/__init__.c #, c-format @@ -432,7 +434,7 @@ msgstr "'yield' wèiyú hánshù zhīwài" #: py/compile.c msgid "* arg after **" -msgstr "" +msgstr "* cānshùhòu **" #: py/compile.c msgid "*x must be assignment target" @@ -698,7 +700,7 @@ msgstr "Huǎnchōngqū tàiduǎn , mùqián zhǐyǒu %d zìjié" #: shared-bindings/framebufferio/FramebufferDisplay.c #: shared-bindings/struct/__init__.c shared-module/struct/__init__.c msgid "Buffer too small" -msgstr "" +msgstr "huǎnchōngqū tàixiǎo" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" @@ -1128,7 +1130,7 @@ msgstr "wèi shí xiàn bàn shuāng gōng SPI" #: supervisor/shared/safe_mode.c msgid "Hard fault: memory access or instruction error." -msgstr "" +msgstr "yìng gùzhàng: nèicún fǎngwèn huò zhǐlìng cuòwù." #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c @@ -1373,31 +1375,31 @@ msgstr "jiāohuàn biāozhì bù pǐpèi" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] reads pin(s)" -msgstr "" +msgstr "quēshǎo first_in_pin. %q[%u] dúqǔ yǐnjiǎo" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" -msgstr "" +msgstr "quēshǎo first_in_pin. %q[%u] cóng yǐnjiǎo yírù" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] waits based on pin" -msgstr "" +msgstr "quēshǎo first_in_pin. %q[%u] jīyú yǐnjiǎo děngdài" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" -msgstr "" +msgstr "quēshǎo first_out_pin. %q[%u] yí chūdào yǐnjiǎo" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] writes pin(s)" -msgstr "" +msgstr "quēshǎo first_out_pin. %q[%u] xiěrù yǐnjiǎo" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_set_pin. %q[%u] sets pin(s)" -msgstr "" +msgstr "quēshǎo first_set_pin. %q[%u] shèzhì yǐnjiǎo" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing jmp_pin. %q[%u] jumps on pin" -msgstr "" +msgstr "quēshǎo jmp_pin. %q[%u] tiàodào yǐn jiǎoshàng" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -1791,7 +1793,7 @@ msgstr "Duōbiānxíng zhìshǎo xūyào 3 diǎn" #: supervisor/shared/safe_mode.c msgid "Power dipped. Make sure you are providing enough power." -msgstr "" +msgstr "gōnglǜ xiàjiàng. quèbǎo nín tígòng zúgòu de diànlì." #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" @@ -2544,7 +2546,7 @@ msgstr "yòu cè xūyào shùzǔ/zì jié" #: py/asmxtensa.c msgid "asm overflow" -msgstr "" +msgstr "gètǐ hé xiǎoxíng cāngkù guǎnlǐjú yìchū" #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" @@ -2636,7 +2638,7 @@ msgstr "huǎn chōng qū tài xiǎo, duì yú qǐng qiú de zì jié" #: py/emitbc.c msgid "bytecode overflow" -msgstr "" +msgstr "zìjiémǎ yìchū" #: py/objarray.c msgid "bytes length not a multiple of item size" @@ -2793,7 +2795,7 @@ msgstr "wúfǎ cóng shǒudòng zìduàn guīgé qiēhuàn dào zìdòng zìduà #: extmod/moduasyncio.c msgid "can't wait" -msgstr "" +msgstr "děngbùjí" #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" @@ -3236,7 +3238,7 @@ msgstr "dǎo rù * bú zài mó kuài jí bié" #: py/persistentcode.c msgid "incompatible .mpy arch" -msgstr "" +msgstr "bù jiānróng de .mpy gǒngmén" #: py/persistentcode.c msgid "incompatible .mpy file" @@ -3705,7 +3707,7 @@ msgstr "bùshì 128 wèi UUID" #: py/parse.c msgid "not a constant" -msgstr "" +msgstr "búshì chángshù" #: py/objstr.c msgid "not all arguments converted during string formatting" @@ -3943,11 +3945,11 @@ msgstr "duān kǒu bì xū wéi >= 0" #: py/compile.c msgid "positional arg after **" -msgstr "" +msgstr "** zhīhòu de wèizhì cānshù" #: py/compile.c msgid "positional arg after keyword arg" -msgstr "" +msgstr "guānjiànzì cānshù hòude wèizhì cānshù" #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" @@ -4181,7 +4183,7 @@ msgstr "tobytes zhǐ néng duì mì jí shù zǔ diào yòng" #: py/compile.c msgid "too many args" -msgstr "" +msgstr "cānshù tàiduō" #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" From f2d38099f1c9108b6f06cb49ffa8594cb9f858a9 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Fri, 25 Aug 2023 18:49:11 +0200 Subject: [PATCH 1572/1712] 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 | 16 ++++------------ locale/cs.po | 16 ++++------------ locale/de_DE.po | 25 +++++++++++++------------ locale/el.po | 16 ++++------------ locale/en_GB.po | 25 +++++++++++++------------ locale/es.po | 28 +++++++++++++++------------- locale/fil.po | 16 ++++------------ locale/fr.po | 25 +++++++++++++------------ locale/hi.po | 16 ++++------------ locale/it_IT.po | 16 ++++------------ locale/ja.po | 16 ++++------------ locale/ko.po | 16 ++++------------ locale/nl.po | 16 ++++------------ locale/pl.po | 16 ++++------------ locale/pt_BR.po | 28 +++++++++++++++------------- locale/ru.po | 16 ++++------------ locale/sv.po | 25 +++++++++++++------------ locale/tr.po | 16 ++++------------ locale/zh_Latn_pinyin.po | 25 +++++++++++++------------ 19 files changed, 143 insertions(+), 230 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 742939386f..f573a4faa2 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -450,6 +450,10 @@ msgstr "Sebuah channel hardware interrupt sedang digunakan" msgid "ADC2 is being used by WiFi" msgstr "ADC2 sedang digunakan oleh WiFi" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1983,10 +1987,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "" @@ -2363,14 +2363,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "" - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "" - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 372fb71e74..17478d6e82 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -451,6 +451,10 @@ msgstr "Kanál hardwarového přerušení je již používán" msgid "ADC2 is being used by WiFi" msgstr "WiFi používá ADC2" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1972,10 +1976,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "" @@ -2350,14 +2350,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "" - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "" - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index b6bbdaa773..e5dc6c7c35 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -458,6 +458,10 @@ msgstr "Ein Hardware Interrupt Kanal wird schon benutzt" msgid "ADC2 is being used by WiFi" msgstr "ADC2 wird vom WiFi benutzt" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -2003,10 +2007,6 @@ msgstr "Stereo links muss sich auf PWM-Kanal A befinden" msgid "Stereo right must be on PWM channel B" msgstr "Stereo rechts muss sich auf PWM-Kanal B befinden" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "Das Stoppen des AP wird nicht unterstützt." - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "Gib entweder monotonic_time oder epoch_time an" @@ -2402,14 +2402,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "Wi-Fi: " -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "Das Wifi ist im Accesspoint-Modus." - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "Das Wifi ist im Station-Modus." - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "WLAN ist nicht aktiviert" @@ -4465,6 +4457,15 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "Stopping AP is not supported." +#~ msgstr "Das Stoppen des AP wird nicht unterstützt." + +#~ msgid "Wifi is in access point mode." +#~ msgstr "Das Wifi ist im Accesspoint-Modus." + +#~ msgid "Wifi is in station mode." +#~ msgstr "Das Wifi ist im Station-Modus." + #~ msgid "" #~ "\n" #~ "Please file an issue with your program at https://github.com/adafruit/" diff --git a/locale/el.po b/locale/el.po index 8ecc871685..face200222 100644 --- a/locale/el.po +++ b/locale/el.po @@ -459,6 +459,10 @@ msgstr "Ένα κανάλι interrupt υλικού είναι ήδη σε χρή msgid "ADC2 is being used by WiFi" msgstr "Το ADC2 χρησιμοποιείται απο το WIFI" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1985,10 +1989,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "" @@ -2363,14 +2363,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "" - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "" - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index d48bbffe5b..107d911124 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -457,6 +457,10 @@ msgstr "A hardware interrupt channel is already in use" msgid "ADC2 is being used by WiFi" msgstr "ADC2 is being used by WiFi" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1983,10 +1987,6 @@ msgstr "Stereo left must be on PWM channel A" msgid "Stereo right must be on PWM channel B" msgstr "Stereo right must be on PWM channel B" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "Stopping AP is not supported." - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "Supply one of monotonic_time or epoch_time" @@ -2370,14 +2370,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "Wi-Fi: " -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "Wifi is in access point mode." - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "Wifi is in station mode." - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "Wifi is not enabled" @@ -4408,6 +4400,15 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "Stopping AP is not supported." +#~ msgstr "Stopping AP is not supported." + +#~ msgid "Wifi is in access point mode." +#~ msgstr "Wifi is in access point mode." + +#~ msgid "Wifi is in station mode." +#~ msgstr "Wifi is in station mode." + #~ msgid "" #~ "\n" #~ "Please file an issue with your program at https://github.com/adafruit/" diff --git a/locale/es.po b/locale/es.po index c5bc279dba..4a2ac848ff 100644 --- a/locale/es.po +++ b/locale/es.po @@ -462,6 +462,10 @@ msgstr "Un canal de interrupción por hardware ya está en uso" msgid "ADC2 is being used by WiFi" msgstr "ADC2 está siendo usado por WiFi" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1808,7 +1812,8 @@ msgstr "El polígono necesita al menos 3 puntos" #: supervisor/shared/safe_mode.c msgid "Power dipped. Make sure you are providing enough power." -msgstr "Falta de potencia. Asegura que estás suministrando suficiente potencia." +msgstr "" +"Falta de potencia. Asegura que estás suministrando suficiente potencia." #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" @@ -2017,10 +2022,6 @@ msgstr "Estéreo izquierdo debe estar en el canal PWM A" msgid "Stereo right must be on PWM channel B" msgstr "Estéreo derecho debe estar en el canal PWM B" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "Parar el AP no esta soportado." - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "Suministre monotonic_time o epoch_time" @@ -2412,14 +2413,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "Wi-Fi: " -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "Wifi est en modo de access point." - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "Wifi esta en modo station." - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "Wifi no esta activado" @@ -4460,6 +4453,15 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Stopping AP is not supported." +#~ msgstr "Parar el AP no esta soportado." + +#~ msgid "Wifi is in access point mode." +#~ msgstr "Wifi est en modo de access point." + +#~ msgid "Wifi is in station mode." +#~ msgstr "Wifi esta en modo station." + #~ msgid "" #~ "\n" #~ "Please file an issue with your program at https://github.com/adafruit/" diff --git a/locale/fil.po b/locale/fil.po index fc3e801581..da5152e69e 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -449,6 +449,10 @@ msgstr "Isang channel ng hardware interrupt ay ginagamit na" msgid "ADC2 is being used by WiFi" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, fuzzy, c-format msgid "Address must be %d bytes long" @@ -1973,10 +1977,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "" @@ -2353,14 +2353,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "" - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "" - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index 1d246a9de0..d530b5e12b 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -461,6 +461,10 @@ msgstr "Un canal d'interruptions matériel est déjà utilisé" msgid "ADC2 is being used by WiFi" msgstr "ADC2 est utilisé pars le Wifi" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -2024,10 +2028,6 @@ msgstr "Canal stéréo gauche doit être sur le canal PWM A" msgid "Stereo right must be on PWM channel B" msgstr "Canal stéréo droit doit être sur le canal PWM B" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "Stopper n'est pas supporté." - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "Fournissez l'un de monotonic_time ou epoch_time" @@ -2421,14 +2421,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "Wi-Fi : " -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "Wifi en mode point d'accès." - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "Wifi en mode station." - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "Le wifi n'est pas activé" @@ -4481,6 +4473,15 @@ 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 "Stopping AP is not supported." +#~ msgstr "Stopper n'est pas supporté." + +#~ msgid "Wifi is in access point mode." +#~ msgstr "Wifi en mode point d'accès." + +#~ msgid "Wifi is in station mode." +#~ msgstr "Wifi en mode station." + #~ msgid "" #~ "\n" #~ "Please file an issue with your program at https://github.com/adafruit/" diff --git a/locale/hi.po b/locale/hi.po index f3633dbd78..3be12ce751 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -447,6 +447,10 @@ msgstr "" msgid "ADC2 is being used by WiFi" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1959,10 +1963,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "" @@ -2337,14 +2337,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "" - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "" - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index f865aee666..438f0a7c0b 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -452,6 +452,10 @@ msgstr "Un canale di interruzione hardware è già in uso" msgid "ADC2 is being used by WiFi" msgstr "ADC2 sta usando il WiFi" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1980,10 +1984,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "" @@ -2360,14 +2360,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "" - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "" - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index c74f672a03..c22d0fb3d4 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -454,6 +454,10 @@ msgstr "ハードウェア割り込みチャネルは使用中" msgid "ADC2 is being used by WiFi" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1973,10 +1977,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "" @@ -2352,14 +2352,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "" - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "" - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 09ae2f0120..0fe6441d4c 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -448,6 +448,10 @@ msgstr "" msgid "ADC2 is being used by WiFi" msgstr "" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1962,10 +1966,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "" @@ -2341,14 +2341,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "" - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "" - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index befcd1f2c3..7ea1ba3821 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -447,6 +447,10 @@ msgstr "Een hardware interrupt kanaal is al in gebruik" msgid "ADC2 is being used by WiFi" msgstr "ADC2 wordt gebruikt door WiFi" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1978,10 +1982,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "Geef monotonic_time of epoch_time" @@ -2362,14 +2362,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "" - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "" - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "" diff --git a/locale/pl.po b/locale/pl.po index a58820be9d..a18fd1c8af 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -449,6 +449,10 @@ msgstr "Kanał przerwań sprzętowych w użyciu" msgid "ADC2 is being used by WiFi" msgstr "ADC2 jest używany przez WiFi" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1965,10 +1969,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "" @@ -2343,14 +2343,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "" - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "" - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 53b11b70c5..b1a6417d4d 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -464,6 +464,10 @@ msgstr "Um canal de interrupção de hardware já está em uso" msgid "ADC2 is being used by WiFi" msgstr "O ADC2 está sendo usado pelo WiFi" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1806,7 +1810,8 @@ msgstr "O Polígono precisa de pelo menos 3 pontos" #: supervisor/shared/safe_mode.c msgid "Power dipped. Make sure you are providing enough power." -msgstr "Falta de energia. Certifique-se que está fornecendo energia suficiente." +msgstr "" +"Falta de energia. Certifique-se que está fornecendo energia suficiente." #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" @@ -2016,10 +2021,6 @@ msgstr "O estéreo à esquerda deve estar no canal PWM A" msgid "Stereo right must be on PWM channel B" msgstr "O estéreo à direita deve estar no canal PWM B" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "Não há suporte para a interrupção do AP." - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "Forneça um de monotonic_time ou de epoch_time" @@ -2413,14 +2414,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "Wi-Fi: " -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "O Wi-Fi está em modo de ponto de acesso." - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "O Wi-Fi está em modo estação." - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "O Wi-Fi não está ativado" @@ -4468,6 +4461,15 @@ 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 "Stopping AP is not supported." +#~ msgstr "Não há suporte para a interrupção do AP." + +#~ msgid "Wifi is in access point mode." +#~ msgstr "O Wi-Fi está em modo de ponto de acesso." + +#~ msgid "Wifi is in station mode." +#~ msgstr "O Wi-Fi está em modo estação." + #~ msgid "" #~ "\n" #~ "Please file an issue with your program at https://github.com/adafruit/" diff --git a/locale/ru.po b/locale/ru.po index 789dc004de..dc946a1bf3 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -454,6 +454,10 @@ msgstr "Канал аппаратного прерывания уже испол msgid "ADC2 is being used by WiFi" msgstr "ADC2 используется WiFi" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -2014,10 +2018,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "" @@ -2394,14 +2394,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "" - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "" - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "" diff --git a/locale/sv.po b/locale/sv.po index 80f5342a58..0ef02f77f1 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -461,6 +461,10 @@ msgstr "En kanal för hårdvaruavbrott används redan" msgid "ADC2 is being used by WiFi" msgstr "ADC2 används av WiFi" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1998,10 +2002,6 @@ msgstr "Vänster stereokanal måste använda PWM kanal A" msgid "Stereo right must be on PWM channel B" msgstr "Höger stereokanal måste använda PWM kanal B" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "Stoppa AP stöds inte." - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "Ange en av monotonic_time eller epoch_time" @@ -2386,14 +2386,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "Wi-Fi: " -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "WiFi är i accesspunktläge." - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "WiFi är i stationsläge." - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "WiFi är inte aktiverat" @@ -4429,6 +4421,15 @@ 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 "Stopping AP is not supported." +#~ msgstr "Stoppa AP stöds inte." + +#~ msgid "Wifi is in access point mode." +#~ msgstr "WiFi är i accesspunktläge." + +#~ msgid "Wifi is in station mode." +#~ msgstr "WiFi är i stationsläge." + #~ msgid "" #~ "\n" #~ "Please file an issue with your program at https://github.com/adafruit/" diff --git a/locale/tr.po b/locale/tr.po index 919e433e85..388413d570 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -456,6 +456,10 @@ msgstr "Bir donanım kesme kanalı halihazırda kullanılmaktadır" msgid "ADC2 is being used by WiFi" msgstr "ADC2, WiFi tarafından kullanılmaktadır" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -1979,10 +1983,6 @@ msgstr "" msgid "Stereo right must be on PWM channel B" msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "" - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "" @@ -2357,14 +2357,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "" - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "" - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index d528bea8c0..db626a4b8c 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -462,6 +462,10 @@ msgstr "Yìngjiàn zhōngduàn tōngdào yǐ zài shǐyòng zhōng" msgid "ADC2 is being used by WiFi" msgstr "ADC2 zhèngzài bèi WiFi shǐ yòng" +#: ports/raspberrypi/common-hal/wifi/Radio.c +msgid "AP could not be started" +msgstr "" + #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format msgid "Address must be %d bytes long" @@ -2000,10 +2004,6 @@ msgstr "lì tǐ shēng zuǒ bì xū shì zài PWM tōng dào A" msgid "Stereo right must be on PWM channel B" msgstr "lì tǐ shēng yòu cè bì xū zài PWM tōng dào B shàng" -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Stopping AP is not supported." -msgstr "bù zhī chí tíng zhǐ AP." - #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" msgstr "tí gòng qí zhōng yī monotonic_time huò epoch_time" @@ -2388,14 +2388,6 @@ msgstr "" msgid "Wi-Fi: " msgstr "Wi-Fi: " -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in access point mode." -msgstr "Wú xiàn wǎng luò chǔ yú jiē rù diǎn mó shì." - -#: ports/raspberrypi/common-hal/wifi/Radio.c -msgid "Wifi is in station mode." -msgstr "Wú xiàn wǎng luò chǔ yú gōng zuò zhàn mó shì." - #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" msgstr "wú xiàn wǎng luò wèi qǐ yòng" @@ -4433,6 +4425,15 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Stopping AP is not supported." +#~ msgstr "bù zhī chí tíng zhǐ AP." + +#~ msgid "Wifi is in access point mode." +#~ msgstr "Wú xiàn wǎng luò chǔ yú jiē rù diǎn mó shì." + +#~ msgid "Wifi is in station mode." +#~ msgstr "Wú xiàn wǎng luò chǔ yú gōng zuò zhàn mó shì." + #~ msgid "" #~ "\n" #~ "Please file an issue with your program at https://github.com/adafruit/" From b9b04fcefa610efd7309bb7e8c6f48f2e06c9b81 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sun, 20 Aug 2023 14:21:56 +0200 Subject: [PATCH 1573/1712] Add new board uGame22 Information about the board: https://hackaday.io/project/186921-game-22 Hardware design repository: https://github.com/python-ugame/ugame-22 --- data/nvm.toml | 2 +- frozen/circuitpython-stage | 2 +- ports/raspberrypi/boards/ugame22/board.c | 122 ++++++++++++++++++ .../boards/ugame22/mpconfigboard.h | 5 + .../boards/ugame22/mpconfigboard.mk | 16 +++ .../boards/ugame22/pico-sdk-configboard.h | 4 + ports/raspberrypi/boards/ugame22/pins.c | 32 +++++ 7 files changed, 181 insertions(+), 2 deletions(-) create mode 100644 ports/raspberrypi/boards/ugame22/board.c create mode 100644 ports/raspberrypi/boards/ugame22/mpconfigboard.h create mode 100644 ports/raspberrypi/boards/ugame22/mpconfigboard.mk create mode 100644 ports/raspberrypi/boards/ugame22/pico-sdk-configboard.h create mode 100644 ports/raspberrypi/boards/ugame22/pins.c diff --git a/data/nvm.toml b/data/nvm.toml index 427cc92397..d17b999f46 160000 --- a/data/nvm.toml +++ b/data/nvm.toml @@ -1 +1 @@ -Subproject commit 427cc923976229bcb981ca6f218ebe8efd636df6 +Subproject commit d17b999f46fd148ac192ad692b8a4639f81add38 diff --git a/frozen/circuitpython-stage b/frozen/circuitpython-stage index 4124dfbdaa..25e35a8620 160000 --- a/frozen/circuitpython-stage +++ b/frozen/circuitpython-stage @@ -1 +1 @@ -Subproject commit 4124dfbdaadce1966f457d7d6c6984e9832999bf +Subproject commit 25e35a8620bfab08ff4ec30bf89667dca0b05fcf diff --git a/ports/raspberrypi/boards/ugame22/board.c b/ports/raspberrypi/boards/ugame22/board.c new file mode 100644 index 0000000000..e816c5e100 --- /dev/null +++ b/ports/raspberrypi/boards/ugame22/board.c @@ -0,0 +1,122 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 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 "shared-bindings/microcontroller/Pin.h" +#include "src/rp2_common/hardware_gpio/include/hardware/gpio.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" + + +uint8_t display_init_sequence[] = { + 0x01, 0x80, 0x80, // Software reset then delay 0x80 (128ms) + 0xEF, 0x03, 0x03, 0x80, 0x02, + 0xCF, 0x03, 0x00, 0xC1, 0x30, + 0xED, 0x04, 0x64, 0x03, 0x12, 0x81, + 0xE8, 0x03, 0x85, 0x00, 0x78, + 0xCB, 0x05, 0x39, 0x2C, 0x00, 0x34, 0x02, + 0xF7, 0x01, 0x20, + 0xEA, 0x02, 0x00, 0x00, + 0xc0, 0x01, 0x23, // Power control VRH[5:0] + 0xc1, 0x01, 0x10, // Power control SAP[2:0];BT[3:0] + 0xc5, 0x02, 0x3e, 0x28, // VCM control + 0xc7, 0x01, 0x86, // VCM control2 + 0x36, 0x01, 0x38, // Memory Access Control + 0x37, 0x01, 0x00, // Vertical scroll zero + 0x3a, 0x01, 0x55, // COLMOD: Pixel Format Set + 0xb1, 0x02, 0x00, 0x18, // Frame Rate Control (In Normal Mode/Full Colors) + 0xb6, 0x03, 0x08, 0x82, 0x27, // Display Function Control + 0xF2, 0x01, 0x00, // 3Gamma Function Disable + 0x26, 0x01, 0x01, // Gamma curve selected + 0xe0, 0x0f, 0x0F, 0x31, 0x2B, 0x0C, 0x0E, 0x08, 0x4E, 0xF1, 0x37, 0x07, + 0x10, 0x03, 0x0E, 0x09, 0x00, // Set Gamma + 0xe1, 0x0f, 0x00, 0x0E, 0x14, 0x03, 0x11, 0x07, 0x31, 0xC1, 0x48, 0x08, + 0x0F, 0x0C, 0x31, 0x36, 0x0F, // Set Gamma + 0x11, 0x80, 0x78, // Exit Sleep then delay 0x78 (120ms) + 0x29, 0x80, 0x78, // Display on then delay 0x78 (120ms) +}; + +void board_init(void) { + displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; + busio_spi_obj_t *spi = &bus->inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO2, &pin_GPIO3, NULL, false); + common_hal_busio_spi_never_reset(spi); + + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_GPIO4, // TFT_DC Command or data + &pin_GPIO5, // TFT_CS Chip select + &pin_GPIO1, // TFT_RST Reset + 80000000L, // Baudrate + 0, // Polarity + 0); // Phase + + displayio_display_obj_t *display = &allocate_display()->display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 320, // Width (after rotation) + 240, // Height (after rotation) + 0, // column start + 0, // row start + 0, // rotation + 16, // Color depth + false, // grayscale + false, // pixels in byte share 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 + display_init_sequence, + sizeof(display_init_sequence), + NULL, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness + false, // single_byte_bounds + false, // data_as_commands + false, // auto_refresh + 20, // native_frames_per_second + true, // backlight_on_high + false, // SH1107_addressing + 50000); // backlight pwm frequency +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} + +void board_deinit(void) { +} diff --git a/ports/raspberrypi/boards/ugame22/mpconfigboard.h b/ports/raspberrypi/boards/ugame22/mpconfigboard.h new file mode 100644 index 0000000000..8f52b7f461 --- /dev/null +++ b/ports/raspberrypi/boards/ugame22/mpconfigboard.h @@ -0,0 +1,5 @@ +#define MICROPY_HW_BOARD_NAME "uGame22" +#define MICROPY_HW_MCU_NAME "rp2040" + +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO14) +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO15) diff --git a/ports/raspberrypi/boards/ugame22/mpconfigboard.mk b/ports/raspberrypi/boards/ugame22/mpconfigboard.mk new file mode 100644 index 0000000000..f3aa21adff --- /dev/null +++ b/ports/raspberrypi/boards/ugame22/mpconfigboard.mk @@ -0,0 +1,16 @@ +USB_VID = 0x1209 +USB_PID = 0xD1B6 +USB_PRODUCT = "uGame22" +USB_MANUFACTURER = "Radomir Dopieralski" + +CHIP_VARIANT = RP2040 +CHIP_FAMILY = rp2 + +EXTERNAL_FLASH_DEVICES = "W25Q16JVxM" + +CIRCUITPY_STAGE = 1 +CIRCUITPY_AUDIOIO = 1 +CIRCUITPY_AUDIOPWMIO = 1 +CIRCUITPY_KEYPAD = 1 + +FROZEN_MPY_DIRS += $(TOP)/frozen/circuitpython-stage/ugame22 diff --git a/ports/raspberrypi/boards/ugame22/pico-sdk-configboard.h b/ports/raspberrypi/boards/ugame22/pico-sdk-configboard.h new file mode 100644 index 0000000000..a41131dd22 --- /dev/null +++ b/ports/raspberrypi/boards/ugame22/pico-sdk-configboard.h @@ -0,0 +1,4 @@ +// Put board-specific pico-sdk definitions here. This file must exist. + +// Allow extra time for xosc to start. +#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/ugame22/pins.c b/ports/raspberrypi/boards/ugame22/pins.c new file mode 100644 index 0000000000..19385b97bc --- /dev/null +++ b/ports/raspberrypi/boards/ugame22/pins.c @@ -0,0 +1,32 @@ +#include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_TFT_RST), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_TFT_SCK), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_TFT_MOSI), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON_Z), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_X), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_DOWN), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_O), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_RIGHT), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_UP), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_LEFT), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_GAIN), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_I2S_DIN), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_I2S_BCLK), MP_ROM_PTR(&pin_GPIO24) }, + { MP_ROM_QSTR(MP_QSTR_I2S_LRCLK), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_OBJ_NEW_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO14) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 8d25faf30af18435279942361b99c08b6bb0f511 Mon Sep 17 00:00:00 2001 From: Michael Bishop Date: Mon, 21 Aug 2023 17:47:10 -0300 Subject: [PATCH 1574/1712] raise kernel load addr and slip stack under kernel on both 32bit and 64bit --- ports/broadcom/Makefile | 9 +++++++++ ports/broadcom/config.txt | 1 + ports/broadcom/peripherals | 2 +- ports/broadcom/supervisor/port.c | 14 +------------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/ports/broadcom/Makefile b/ports/broadcom/Makefile index 9af0503fbb..57d3aca029 100644 --- a/ports/broadcom/Makefile +++ b/ports/broadcom/Makefile @@ -171,6 +171,15 @@ $(BUILD)/firmware.disk.img.zip: $(BUILD)/kernel$(SUFFIX).img $(Q)zip $@ $(BUILD)/circuitpython-disk.img $(Q)rm $(BUILD)/circuitpython-disk.img +.PHONY: $(BUILD)/rpiboot rpiboot +rpiboot: $(BUILD)/rpiboot +$(BUILD)/rpiboot: $(BUILD)/kernel$(SUFFIX).img + mkdir -vp $@ + cp -vf $(BUILD)/kernel$(SUFFIX).img $@/ + cp -vfr config.txt firmware/bootcode.bin firmware/fixup* firmware/start* firmware/*.dtb $@/ + #sed -i -e "s/BOOT_UART=0/BOOT_UART=1/" $@/bootcode.bin $@/bootcode.bin + echo uart_2ndstage=1 >> $@/config.txt + include $(TOP)/py/mkrules.mk diff --git a/ports/broadcom/config.txt b/ports/broadcom/config.txt index 36fd6308cf..1c12196b98 100644 --- a/ports/broadcom/config.txt +++ b/ports/broadcom/config.txt @@ -7,3 +7,4 @@ enable_jtag_gpio=1 # hdmi_group=1 # hdmi_mode=16 gpu_mem=16 +kernel_address=0x100000 diff --git a/ports/broadcom/peripherals b/ports/broadcom/peripherals index d3a6b50a21..ec1043800f 160000 --- a/ports/broadcom/peripherals +++ b/ports/broadcom/peripherals @@ -1 +1 @@ -Subproject commit d3a6b50a21e7dd49ba4bfa0374da3407594caa50 +Subproject commit ec1043800fc987f7067fc07615193439843695d6 diff --git a/ports/broadcom/supervisor/port.c b/ports/broadcom/supervisor/port.c index ec6feb8703..d12b96aa5e 100644 --- a/ports/broadcom/supervisor/port.c +++ b/ports/broadcom/supervisor/port.c @@ -124,30 +124,18 @@ void reset_cpu(void) { } bool port_has_fixed_stack(void) { - #ifdef __aarch64__ return true; - #else - return false; - #endif } // From the linker script extern uint32_t __bss_end; extern uint32_t _ld_ram_end; uint32_t *port_stack_get_limit(void) { - #ifdef __aarch64__ return (uint32_t *)0x4; - #else - return &__bss_end; - #endif } uint32_t *port_stack_get_top(void) { - #ifdef __aarch64__ - return (uint32_t *)0x80000; - #else - return &_ld_ram_end; - #endif + return (uint32_t *)0x100000; } uint32_t *port_heap_get_bottom(void) { From 9eb61ef6675ed8348c062a8c3d51cfd6f73bdf1a Mon Sep 17 00:00:00 2001 From: RetiredWizard Date: Sat, 26 Aug 2023 11:00:37 -0400 Subject: [PATCH 1575/1712] Enable WiFi, leave DV enable to usercode --- .../boards/pimoroni_pico_dv_base_w/board.c | 23 ------------------- .../pimoroni_pico_dv_base_w/mpconfigboard.h | 2 ++ .../pimoroni_pico_dv_base_w/mpconfigboard.mk | 11 +++++++++ .../pico-sdk-configboard.h | 3 --- .../boards/pimoroni_pico_dv_base_w/pins.c | 8 +++++-- 5 files changed, 19 insertions(+), 28 deletions(-) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c index ee86bb3651..331653173e 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/board.c @@ -26,27 +26,4 @@ #include "supervisor/board.h" -#include "bindings/picodvi/Framebuffer.h" -#include "shared-module/displayio/__init__.h" -#include "shared-bindings/framebufferio/FramebufferDisplay.h" - -void board_init(void) { - picodvi_framebuffer_obj_t *fb = &allocate_display_bus()->picodvi; - fb->base.type = &picodvi_framebuffer_type; - common_hal_picodvi_framebuffer_construct(fb, 320, 240, - &pin_GPIO7, &pin_GPIO6, - &pin_GPIO9, &pin_GPIO8, - &pin_GPIO11, &pin_GPIO10, - &pin_GPIO13, &pin_GPIO12, - 8); - - framebufferio_framebufferdisplay_obj_t *display = &displays[0].framebuffer_display; - display->base.type = &framebufferio_framebufferdisplay_type; - common_hal_framebufferio_framebufferdisplay_construct( - display, - MP_OBJ_FROM_PTR(fb), - 0, - true); -} - // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h index 917fa85ab7..648b3529f5 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.h @@ -6,3 +6,5 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO1) #define DEFAULT_UART_BUS_TX (&pin_GPIO0) + +#define MICROPY_HW_LED_STATUS (&pin_CYW0) diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk index 66cee41e07..b7919a1847 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/mpconfigboard.mk @@ -9,8 +9,19 @@ CHIP_FAMILY = rp2 EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ" CIRCUITPY__EVE = 1 + +CIRCUITPY_CYW43 = 1 +CIRCUITPY_SSL = 1 +CIRCUITPY_SSL_MBEDTLS = 1 +CIRCUITPY_HASHLIB = 1 +CIRCUITPY_WEB_WORKFLOW = 1 +CIRCUITPY_MDNS = 1 +CIRCUITPY_SOCKETPOOL = 1 +CIRCUITPY_WIFI = 1 + CIRCUITPY_PICODVI = 1 +CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0 # Must be accompanied by a linker script change CFLAGS += -DCIRCUITPY_FIRMWARE_SIZE='(1536 * 1024)' diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h index a41131dd22..36da55d457 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pico-sdk-configboard.h @@ -1,4 +1 @@ // Put board-specific pico-sdk definitions here. This file must exist. - -// Allow extra time for xosc to start. -#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64 diff --git a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c index 98a593310f..8e0545b689 100644 --- a/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c +++ b/ports/raspberrypi/boards/pimoroni_pico_dv_base_w/pins.c @@ -44,6 +44,12 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO19)}, { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO22)}, + { MP_ROM_QSTR(MP_QSTR_SMPS_MODE), MP_ROM_PTR(&pin_CYW1) }, + + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_CYW0) }, + + { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_CYW2) }, + { MP_ROM_QSTR(MP_QSTR_I2S_WORD_SELECT), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_GP26_A0), MP_ROM_PTR(&pin_GPIO26) }, { MP_ROM_QSTR(MP_QSTR_GP26), MP_ROM_PTR(&pin_GPIO26) }, @@ -75,8 +81,6 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D2N), MP_ROM_PTR(&pin_GPIO12) }, { MP_ROM_QSTR(MP_QSTR_D2P), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_DV_HPD), MP_ROM_PTR(&pin_GPIO17) }, - - { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].framebuffer_display)}, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 36c0d81af84b5af3b1ebef95323fd406b68e91de Mon Sep 17 00:00:00 2001 From: Bobby Jap Date: Sat, 26 Aug 2023 18:50:35 -0700 Subject: [PATCH 1576/1712] Fix gzip Decompression Support --- extmod/moduzlib.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/extmod/moduzlib.c b/extmod/moduzlib.c index b2f5b5af33..4276c366cd 100644 --- a/extmod/moduzlib.c +++ b/extmod/moduzlib.c @@ -175,13 +175,18 @@ STATIC mp_obj_t mod_uzlib_decompress(size_t n_args, const mp_obj_t *args) { decomp->source_limit = (byte *)bufinfo.buf + bufinfo.len; int st; - bool is_zlib = true; + mp_int_t wbits = 0; - if (n_args > 1 && MP_OBJ_SMALL_INT_VALUE(args[1]) < 0) { - is_zlib = false; + if (n_args > 1) { + wbits = MP_OBJ_SMALL_INT_VALUE(args[1]); } - if (is_zlib) { + if (wbits >= 16) { + st = uzlib_gzip_parse_header(decomp); + if (st < 0) { + goto error; + } + } else if (wbits >= 0) { st = uzlib_zlib_parse_header(decomp); if (st < 0) { goto error; From 296dd12624964f710d0f3cb4823ddf20aa8e1a63 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 25 Aug 2023 21:16:35 +0000 Subject: [PATCH 1577/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (999 of 999 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index b1a6417d4d..07d07b2397 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: 2023-08-24 15:48+0000\n" +"PO-Revision-Date: 2023-08-27 15:54+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 5.0\n" +"X-Generator: Weblate 5.0.1-dev\n" #: main.c msgid "" @@ -466,7 +466,7 @@ msgstr "O ADC2 está sendo usado pelo WiFi" #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "AP could not be started" -msgstr "" +msgstr "Não foi possível iniciar o AP" #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format From 80d132fc955d974693c4ef85d86af655e5903e94 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Fri, 25 Aug 2023 19:16:03 +0000 Subject: [PATCH 1578/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (999 of 999 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 0ef02f77f1..4286d0af98 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-08-24 15:48+0000\n" +"PO-Revision-Date: 2023-08-27 15:54+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 5.0\n" +"X-Generator: Weblate 5.0.1-dev\n" #: main.c msgid "" @@ -463,7 +463,7 @@ msgstr "ADC2 används av WiFi" #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "AP could not be started" -msgstr "" +msgstr "Kunde inte starta AP" #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format @@ -1793,7 +1793,6 @@ msgid "Polygon needs at least 3 points" msgstr "Polygonen behöver minst 3 punkter" #: supervisor/shared/safe_mode.c -#, fuzzy msgid "Power dipped. Make sure you are providing enough power." msgstr "Spänningen sjönk. Se till att du ger tillräckligt med ström." From 8723cbf4322b43ea7148087d9eab26500e5ccf86 Mon Sep 17 00:00:00 2001 From: hexthat Date: Sat, 26 Aug 2023 15:06:38 +0000 Subject: [PATCH 1579/1712] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (999 of 999 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index db626a4b8c..abf4a02857 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-08-25 16:38+0000\n" +"PO-Revision-Date: 2023-08-27 15:54+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -464,7 +464,7 @@ msgstr "ADC2 zhèngzài bèi WiFi shǐ yòng" #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "AP could not be started" -msgstr "" +msgstr "wúfǎ qǐdòng AP" #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format From 55fbbdcb52592db702099de3a05a88c5dbcfa632 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sun, 27 Aug 2023 19:28:44 +0200 Subject: [PATCH 1580/1712] Allow enabling async on samd21 It was just disabled, possibly because of size considerations, but it's useful to be able to enable it explicitly for selected boards. This requires some of the settings to use ?= instead of =, and fixing a bug in the traceback module, where the chain variable is unused if exception chaining is not enabled. --- ports/atmel-samd/mpconfigport.mk | 4 ++-- shared-bindings/traceback/__init__.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/mpconfigport.mk b/ports/atmel-samd/mpconfigport.mk index 032e49ce36..3cdca9a4eb 100644 --- a/ports/atmel-samd/mpconfigport.mk +++ b/ports/atmel-samd/mpconfigport.mk @@ -48,7 +48,7 @@ CIRCUITPY_RE ?= 0 CIRCUITPY_SDCARDIO ?= 0 CIRCUITPY_SYNTHIO ?= 0 CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1 -CIRCUITPY_TRACEBACK = 0 +CIRCUITPY_TRACEBACK ?= 0 CIRCUITPY_ULAB = 0 CIRCUITPY_VECTORIO = 0 CIRCUITPY_ZLIB = 0 @@ -61,7 +61,7 @@ CIRCUITPY_SAFEMODE_PY ?= 0 CIRCUITPY_USB_IDENTIFICATION ?= 0 endif -MICROPY_PY_ASYNC_AWAIT = 0 +MICROPY_PY_ASYNC_AWAIT ?= 0 # We don't have room for the fonts for terminalio for certain languages, # so turn off terminalio, and if it's off and displayio is on, diff --git a/shared-bindings/traceback/__init__.c b/shared-bindings/traceback/__init__.c index 3ad601eb39..ca5c54716a 100644 --- a/shared-bindings/traceback/__init__.c +++ b/shared-bindings/traceback/__init__.c @@ -59,7 +59,6 @@ STATIC void traceback_exception_common(bool is_print_exception, mp_print_t *prin } mp_obj_t tb_obj = args[ARG_tb].u_obj; mp_obj_t limit_obj = args[ARG_limit].u_obj; - bool chain = args[ARG_chain].u_bool; if (args[ARG_file].u_obj != mp_const_none) { if (!is_print_exception) { @@ -93,6 +92,8 @@ STATIC void traceback_exception_common(bool is_print_exception, mp_print_t *prin mp_obj_exception_t *exc = mp_obj_exception_get_native(value); mp_obj_traceback_t *trace_backup = exc->traceback; #if MICROPY_CPYTHON_EXCEPTION_CHAIN + bool chain = args[ARG_chain].u_bool; + mp_obj_exception_t *context_backup = exc->context; mp_obj_exception_t *cause_backup = exc->cause; From fc17e9ef391259ad738b462b18cecbbe7c28c3f8 Mon Sep 17 00:00:00 2001 From: Radomir Dopieralski Date: Sun, 27 Aug 2023 19:34:06 +0200 Subject: [PATCH 1581/1712] Update __init__.c --- shared-bindings/traceback/__init__.c | 1 - 1 file changed, 1 deletion(-) diff --git a/shared-bindings/traceback/__init__.c b/shared-bindings/traceback/__init__.c index a1a9556bdc..ca34161842 100644 --- a/shared-bindings/traceback/__init__.c +++ b/shared-bindings/traceback/__init__.c @@ -95,7 +95,6 @@ STATIC void traceback_exception_common(bool is_print_exception, mp_print_t *prin mp_obj_exception_t *exc = mp_obj_exception_get_native(value); mp_obj_traceback_t *trace_backup = exc->traceback; #if MICROPY_CPYTHON_EXCEPTION_CHAIN - mp_obj_exception_t *context_backup = exc->context; mp_obj_exception_t *cause_backup = exc->cause; From 57ac916ccd6c923c9dae7b6ae5be5886e0fbc440 Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Sun, 27 Aug 2023 23:29:08 +0300 Subject: [PATCH 1582/1712] .Trash-1000 on filesystem creation --- supervisor/shared/filesystem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c index 345f55f2f1..d70505531b 100644 --- a/supervisor/shared/filesystem.c +++ b/supervisor/shared/filesystem.c @@ -129,6 +129,7 @@ bool filesystem_init(bool create_allowed, bool force_create) { } make_empty_file(&vfs_fat->fatfs, "/.metadata_never_index"); make_empty_file(&vfs_fat->fatfs, "/.Trashes"); + make_empty_file(&vfs_fat->fatfs, "/.Trash-1000"); make_empty_file(&vfs_fat->fatfs, "/.fseventsd/no_log"); #if CIRCUITPY_OS_GETENV make_empty_file(&vfs_fat->fatfs, "/settings.toml"); From b0967cb1a4867a386c4e2116a77d89df81dd7ba3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sun, 27 Aug 2023 16:09:17 -0500 Subject: [PATCH 1583/1712] Use QSTR_GLOBAL_REQUIREMENTS to give explicit dependency for qstr generation I investigated and found that this seems to be the best way to specify a file that must be generated before "qstr processing" can occur. Closes #8337 --- ports/atmel-samd/Makefile | 2 +- ports/espressif/Makefile | 5 +---- ports/raspberrypi/Makefile | 3 ++- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ports/atmel-samd/Makefile b/ports/atmel-samd/Makefile index 0f01c789c6..9457486959 100644 --- a/ports/atmel-samd/Makefile +++ b/ports/atmel-samd/Makefile @@ -352,7 +352,7 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_CIRCUITPY_COMMON:.c=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o)) OBJ += $(addprefix $(BUILD)/, $(SRC_MOD:.c=.o)) -SRC_QSTR += $(HEADER_BUILD)/sdiodata.h +QSTR_GLOBAL_REQUIREMENTS += $(HEADER_BUILD)/sdiodata.h OBJ_EXTRA_ORDER_DEPS += $(HEADER_BUILD)/sioddata.h $(HEADER_BUILD)/sdiodata.h: tools/mksdiodata.py | $(HEADER_BUILD) $(Q)$(PYTHON) $< > $@ diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index ed4b95828b..320fda78fc 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -353,7 +353,7 @@ endif # create the config headers .PHONY: do-sdkconfig do-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h -$(BUILD)/genhdr/qstr.i.last: $(BUILD)/esp-idf/config/sdkconfig.h +QSTR_GLOBAL_REQUIREMENTS += $(BUILD)/esp-idf/config/sdkconfig.h $(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig CMakeLists.txt | $(BUILD)/esp-idf IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA) @@ -378,9 +378,6 @@ menuconfig: $(BUILD)/esp-idf/config $(BUILD)/esp-idf/config/sdkconfig.h # We should use that when available. For now, we sort out everything. python tools/update_sdkconfig.py --board=$(BOARD) --debug=$(DEBUG) -# qstr builds include headers so we need to make sure they are up to date -$(HEADER_BUILD)/qstr.split: | $(BUILD)/esp-idf/config/sdkconfig.h - BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS)) ifeq ($(IDF_TARGET),esp32) diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 2e5d69dabf..1a9cd35f55 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -424,7 +424,8 @@ $(BUILD)/stage2.c: stage2.c.jinja gen_stage2.py | $(BUILD)/ $(STEPECHO) "GEN $<" $(Q)$(PYTHON) gen_stage2.py $< $@ $(EXTERNAL_FLASH_DEVICES) -$(HEADER_BUILD)/flash_info.h: flash_info.h.jinja gen_stage2.py | $(HEADER_BUILD)/ +QSTR_GLOBAL_REQUIREMENTS += $(HEADER_BUILD)/flash_info.h +$(HEADER_BUILD)/flash_info.h: flash_info.h.jinja gen_stage2.py $(STEPECHO) "GEN $<" $(Q)$(PYTHON) gen_stage2.py $< $@ $(EXTERNAL_FLASH_DEVICES) From 029c912bf0f19062426922962deaf12d9785c5bc Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Mon, 28 Aug 2023 17:03:32 +0300 Subject: [PATCH 1584/1712] Comment and reorder the files creation. --- supervisor/shared/filesystem.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c index d70505531b..f6ade7cbba 100644 --- a/supervisor/shared/filesystem.c +++ b/supervisor/shared/filesystem.c @@ -127,10 +127,15 @@ bool filesystem_init(bool create_allowed, bool force_create) { if (res != FR_OK) { return false; } - make_empty_file(&vfs_fat->fatfs, "/.metadata_never_index"); - make_empty_file(&vfs_fat->fatfs, "/.Trashes"); - make_empty_file(&vfs_fat->fatfs, "/.Trash-1000"); make_empty_file(&vfs_fat->fatfs, "/.fseventsd/no_log"); + make_empty_file(&vfs_fat->fatfs, "/.metadata_never_index"); + + // Prevent storing trash on all OSes. + make_empty_file(&vfs_fat->fatfs, "/.Trashes"); // MacOS + make_empty_file(&vfs_fat->fatfs, "/.Trash-1000"); // Linux, XDG trash spec: + // https://specifications.freedesktop.org/trash-spec/trashspec-latest.html + + #if CIRCUITPY_OS_GETENV make_empty_file(&vfs_fat->fatfs, "/settings.toml"); #endif From c1144e66a857c265c918251b2c91294ebb40022d Mon Sep 17 00:00:00 2001 From: Jeremy Littler <87398149+BrainBoardz@users.noreply.github.com> Date: Mon, 28 Aug 2023 10:09:06 -0400 Subject: [PATCH 1585/1712] Add files via upload --- .../boards/brainboardz_neuron/pins.c | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/ports/espressif/boards/brainboardz_neuron/pins.c b/ports/espressif/boards/brainboardz_neuron/pins.c index 5c198c20a7..62b95421f8 100755 --- a/ports/espressif/boards/brainboardz_neuron/pins.c +++ b/ports/espressif/boards/brainboardz_neuron/pins.c @@ -23,35 +23,31 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, - { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO14) }, - { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, - { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO21) }, - { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO42) }, { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, @@ -61,7 +57,10 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO45), MP_ROM_PTR(&pin_GPIO45) }, { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_IO47), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_IO48), MP_ROM_PTR(&pin_GPIO48) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, From 9bdb57635151c3ef6976eca642f4868e01e64fd9 Mon Sep 17 00:00:00 2001 From: Jeremy Littler <87398149+BrainBoardz@users.noreply.github.com> Date: Mon, 28 Aug 2023 10:10:04 -0400 Subject: [PATCH 1586/1712] Add files via upload --- ports/espressif/boards/brainboardz_neuron/mpconfigboard.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h index 72cda83c9b..760041ddf4 100755 --- a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h +++ b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.h @@ -35,6 +35,6 @@ #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) -#define DEFAULT_SPI_BUS_SCK (&pin_GPIO14) -#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO15) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO13) +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO40) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO41) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO39) From adfd90f022e23ba6eb546b563c4eb824f6e8296e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 28 Aug 2023 13:57:44 -0500 Subject: [PATCH 1587/1712] add missing space --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index c07591ef3b..f9717dd691 100644 --- a/README.rst +++ b/README.rst @@ -155,7 +155,7 @@ Behavior - Re-runs ``code.py`` or other main file after file system writes by a workflow. (Disable with ``supervisor.disable_autoreload()``) - Autoreload is disabled while the REPL is active. -- ``code.py`` may also be named``code.txt``, ``main.py``, or ``main.txt``. +- ``code.py`` may also be named ``code.txt``, ``main.py``, or ``main.txt``. - ``boot.py`` may also be named ``boot.txt``. - ``safemode.py`` may also be named ``safemode.txt``. From d7cf11d3ef736ceb56b950279163d889bf83040d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 28 Aug 2023 13:59:34 -0500 Subject: [PATCH 1588/1712] Add repl.py support --- README.rst | 2 ++ main.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/README.rst b/README.rst index f9717dd691..fb0518bfbd 100644 --- a/README.rst +++ b/README.rst @@ -133,6 +133,8 @@ Behavior ``code.py`` **in the REPL anymore, as the REPL is a fresh vm.** CircuitPython's goal for this change includes reducing confusion about pins and memory being used. - After the main code is finished the REPL can be entered by pressing any key. + - If the file ``repl.py`` exists, it is executed before the REPL Prompt is shown + - In safe mode this functionality is disabled, to ensure the REPL Prompt can always be reached - Autoreload state will be maintained across reload. - Adds a safe mode that does not run user code after a hard crash or brown out. This makes it diff --git a/main.c b/main.c index 122f079129..af9f664672 100644 --- a/main.c +++ b/main.c @@ -929,6 +929,11 @@ STATIC int run_repl(safe_mode_t safe_mode) { autoreload_suspend(AUTORELOAD_SUSPEND_REPL); + if (get_safe_mode() == SAFE_MODE_NONE) { + const char *const filenames[] = { "repl.py" }; + (void)maybe_run_list(filenames, MP_ARRAY_SIZE(filenames)); + } + // Set the status LED to the REPL color before running the REPL. For // NeoPixels and DotStars this will be sticky but for PWM or single LED it // won't. This simplifies pin sharing because they won't be in use when From 5188166949cd017890d27b10d366ed89cac9971e Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Mon, 28 Aug 2023 21:53:45 +0200 Subject: [PATCH 1589/1712] 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 | 4 ++++ locale/cs.po | 4 ++++ locale/de_DE.po | 4 ++++ locale/el.po | 4 ++++ locale/en_GB.po | 4 ++++ locale/es.po | 4 ++++ locale/fil.po | 4 ++++ locale/fr.po | 4 ++++ locale/hi.po | 4 ++++ locale/it_IT.po | 4 ++++ locale/ja.po | 4 ++++ locale/ko.po | 4 ++++ locale/nl.po | 4 ++++ locale/pl.po | 4 ++++ locale/pt_BR.po | 4 ++++ locale/ru.po | 4 ++++ locale/sv.po | 4 ++++ locale/tr.po | 4 ++++ locale/zh_Latn_pinyin.po | 4 ++++ 19 files changed, 76 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index f573a4faa2..19484df074 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -2390,6 +2390,10 @@ msgstr "" msgid "You pressed button A at start up." msgstr "" +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index 17478d6e82..0c22cfffbe 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -2377,6 +2377,10 @@ msgstr "" msgid "You pressed button A at start up." msgstr "" +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index e5dc6c7c35..26ab1022ce 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -2429,6 +2429,10 @@ msgstr "Beide Knöpfe wurden beim Starten gedrückt." msgid "You pressed button A at start up." msgstr "Knopf A wurde beim Starten gedrückt." +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "Der BOOT-Knopf wurde beim Starten gedrückt" diff --git a/locale/el.po b/locale/el.po index face200222..657ab83f20 100644 --- a/locale/el.po +++ b/locale/el.po @@ -2390,6 +2390,10 @@ msgstr "" msgid "You pressed button A at start up." msgstr "" +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index 107d911124..73b5028849 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -2397,6 +2397,10 @@ msgstr "You pressed both buttons at start up." msgid "You pressed button A at start up." msgstr "You pressed button A at start up." +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "You pressed the BOOT button at start up" diff --git a/locale/es.po b/locale/es.po index 4a2ac848ff..8066a3bba5 100644 --- a/locale/es.po +++ b/locale/es.po @@ -2440,6 +2440,10 @@ msgstr "Usted presionó ambos botones al iniciar." msgid "You pressed button A at start up." msgstr "Usted presionó el botón A al iniciar." +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "Usted presionó el botón BOOT al iniciar" diff --git a/locale/fil.po b/locale/fil.po index da5152e69e..226de0e449 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -2380,6 +2380,10 @@ msgstr "" msgid "You pressed button A at start up." msgstr "" +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index d530b5e12b..55e1cad427 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -2448,6 +2448,10 @@ msgstr "Vous avez appuyé les deux boutons au démarrage." msgid "You pressed button A at start up." msgstr "Vous avez appuyé le bouton A au démarrage." +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "Vous avez appuyé le bouton BOOT au démarrage" diff --git a/locale/hi.po b/locale/hi.po index 3be12ce751..8b6daab54f 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -2364,6 +2364,10 @@ msgstr "" msgid "You pressed button A at start up." msgstr "" +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 438f0a7c0b..e0f719cb5a 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -2387,6 +2387,10 @@ msgstr "" msgid "You pressed button A at start up." msgstr "" +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index c22d0fb3d4..90608bca7e 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -2379,6 +2379,10 @@ msgstr "" msgid "You pressed button A at start up." msgstr "" +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 0fe6441d4c..0f1329a029 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -2368,6 +2368,10 @@ msgstr "" msgid "You pressed button A at start up." msgstr "" +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 7ea1ba3821..424b229068 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -2389,6 +2389,10 @@ msgstr "" msgid "You pressed button A at start up." msgstr "" +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "" diff --git a/locale/pl.po b/locale/pl.po index a18fd1c8af..80067e391b 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -2370,6 +2370,10 @@ msgstr "" msgid "You pressed button A at start up." msgstr "" +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 07d07b2397..0b1e0aeac6 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -2441,6 +2441,10 @@ msgstr "Você pressionou os dois botões durante a inicialização." msgid "You pressed button A at start up." msgstr "Você pressionou o botão A na inicialização." +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "Você pressionou o botão BOOT na inicialização" diff --git a/locale/ru.po b/locale/ru.po index dc946a1bf3..1ae155ffdf 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -2421,6 +2421,10 @@ msgstr "" msgid "You pressed button A at start up." msgstr "" +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "" diff --git a/locale/sv.po b/locale/sv.po index 4286d0af98..ecf245428d 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -2412,6 +2412,10 @@ msgstr "Du tryckte ner båda knapparna vid start." msgid "You pressed button A at start up." msgstr "Du tryckte ner knapp A vid start." +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "Du tryckte ner BOOT-knappen vid start" diff --git a/locale/tr.po b/locale/tr.po index 388413d570..6f245c9862 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -2384,6 +2384,10 @@ msgstr "" msgid "You pressed button A at start up." msgstr "" +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index abf4a02857..a601c3d0f2 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -2415,6 +2415,10 @@ msgstr "nín zài qǐ dòng shí àn xià le liǎng gè àn niǔ." msgid "You pressed button A at start up." msgstr "nín zài qǐ dòng shí àn xià le àn niǔ A." +#: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h +msgid "You pressed button DOWN at start up." +msgstr "" + #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" msgstr "nín zài qǐ dòng shí àn xià le qǐ dòng àn niǔ" From 9daccc08c5f8ef26c9ef537875e4c2bee800cbbd Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 28 Aug 2023 15:43:45 -0700 Subject: [PATCH 1590/1712] Forbidden pins are now correctly "in use" on ESP This removes duplicate code to make debug UART pins in use via never reset. It is done through forbidden pins automatically now. Fixes #8288 --- .gitmodules | 2 +- .../boards/adafruit_funhouse/board.c | 6 ------ .../espressif/boards/adafruit_funhouse/pins.c | 4 ++-- .../adafruit_magtag_2.9_grayscale/board.c | 6 ------ .../board.c | 10 --------- .../adafruit_qtpy_esp32s3_nopsram/board.c | 10 --------- .../boards/ai_thinker_esp32-c3s-2m/board.c | 6 ------ .../boards/ai_thinker_esp32-c3s/board.c | 6 ------ .../boards/ai_thinker_esp_12k_nodemcu/board.c | 10 --------- ports/espressif/boards/artisense_rd00/board.c | 6 ------ .../boards/atmegazero_esp32s2/board.c | 10 --------- ports/espressif/boards/bpi_bit_s2/board.c | 9 -------- ports/espressif/boards/bpi_leaf_s3/board.c | 10 --------- ports/espressif/boards/bpi_picow_s3/board.c | 10 --------- .../boards/brainboardz_neuron/board.c | 10 --------- .../boards/crumpspace_crumps2/board.c | 10 --------- .../boards/electroniccats_bastwifi/board.c | 10 --------- .../espressif_esp32c3_devkitm_1_n4/board.c | 9 -------- .../espressif_esp32s2_devkitc_1_n4/board.c | 10 --------- .../espressif_esp32s2_devkitc_1_n4r2/board.c | 10 --------- .../espressif_esp32s2_devkitc_1_n8r2/board.c | 10 --------- .../boards/espressif_esp32s3_box/board.c | 6 ------ .../boards/espressif_esp32s3_box_lite/board.c | 6 ------ .../espressif_esp32s3_devkitc_1_n32r8/board.c | 21 +------------------ .../espressif_esp32s3_devkitc_1_n8/board.c | 10 --------- .../espressif_esp32s3_devkitc_1_n8r2/board.c | 10 --------- .../espressif_esp32s3_devkitc_1_n8r8/board.c | 10 --------- .../espressif_esp32s3_devkitm_1_n8/board.c | 10 --------- .../espressif_esp32s3_usb_otg_n8/board.c | 4 ---- .../boards/espressif_kaluga_1.3/board.c | 10 --------- .../boards/espressif_kaluga_1/board.c | 10 --------- .../boards/espressif_saola_1_wroom/board.c | 10 --------- .../boards/espressif_saola_1_wrover/board.c | 10 --------- .../boards/franzininho_wifi_wroom/board.c | 10 --------- .../boards/franzininho_wifi_wrover/board.c | 10 --------- .../boards/gravitech_cucumber_m/board.c | 10 --------- .../boards/gravitech_cucumber_ms/board.c | 10 --------- .../boards/gravitech_cucumber_r/board.c | 10 --------- .../boards/gravitech_cucumber_rs/board.c | 10 --------- ports/espressif/boards/hiibot_iots2/board.c | 19 ----------------- .../boards/lilygo_tembed_esp32s3/board.c | 6 ------ .../boards/lilygo_ttgo_t-01c3/board.c | 11 ---------- .../boards/lilygo_ttgo_t-oi-plus/board.c | 11 ---------- .../lilygo_ttgo_t8_esp32_s2_wroom/board.c | 10 --------- .../boards/lilygo_ttgo_t8_s2/board.c | 10 --------- .../boards/lilygo_ttgo_t8_s2_st7789/board.c | 6 ------ ports/espressif/boards/lolin_s2_mini/board.c | 10 --------- ports/espressif/boards/lolin_s2_pico/board.c | 5 ----- ports/espressif/boards/lolin_s3_mini/board.c | 10 --------- ports/espressif/boards/maker_badge/board.c | 10 --------- .../boards/microdev_micro_c3/board.c | 9 -------- .../boards/microdev_micro_s2/board.c | 12 ----------- .../espressif/boards/mixgo_ce_serial/board.c | 6 ------ ports/espressif/boards/mixgo_ce_udisk/board.c | 10 --------- .../boards/morpheans_morphesp-240/board.c | 6 ------ .../boards/muselab_nanoesp32_s2_wroom/board.c | 10 --------- .../muselab_nanoesp32_s2_wrover/board.c | 10 --------- .../boards/seeed_xiao_esp32c3/board.c | 11 ---------- .../smartbeedesigns_bee_data_logger/board.c | 10 --------- .../smartbeedesigns_bee_motion_s3/board.c | 10 --------- .../boards/smartbeedesigns_bee_s3/board.c | 10 --------- .../boards/targett_module_clip_wroom/board.c | 6 ------ .../boards/targett_module_clip_wrover/board.c | 6 ------ .../boards/unexpectedmaker_feathers2/board.c | 10 --------- .../unexpectedmaker_feathers2_neo/board.c | 10 --------- .../board.c | 10 --------- .../boards/unexpectedmaker_feathers3/board.c | 10 --------- .../boards/unexpectedmaker_nanos3/board.c | 10 +-------- .../boards/unexpectedmaker_pros3/board.c | 10 +-------- .../boards/unexpectedmaker_tinys2/board.c | 10 --------- .../boards/unexpectedmaker_tinys3/board.c | 10 --------- .../waveshare_esp32_s2_pico_lcd/board.c | 6 ------ .../boards/waveshare_esp32s2_pico/board.c | 10 --------- .../boards/yd_esp32_s3_n16r8/board.c | 10 --------- .../espressif/boards/yd_esp32_s3_n8r8/board.c | 10 --------- .../common-hal/microcontroller/Pin.c | 9 ++++++-- ports/espressif/peripherals/esp32s3/pins.c | 2 ++ ports/espressif/peripherals/pins.h | 2 +- 78 files changed, 16 insertions(+), 688 deletions(-) diff --git a/.gitmodules b/.gitmodules index 91afffe6a6..7cb54a92dc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -340,4 +340,4 @@ url = https://github.com/bablokb/circuitpython-pcf85063a [submodule "frozen/Adafruit_CircuitPython_Wave"] path = frozen/Adafruit_CircuitPython_Wave - url = http://github.com/adafruit/Adafruit_CircuitPython_Wave.git + url = https://github.com/adafruit/Adafruit_CircuitPython_Wave.git diff --git a/ports/espressif/boards/adafruit_funhouse/board.c b/ports/espressif/boards/adafruit_funhouse/board.c index b1a01b2dcb..daa4aa474e 100644 --- a/ports/espressif/boards/adafruit_funhouse/board.c +++ b/ports/espressif/boards/adafruit_funhouse/board.c @@ -50,12 +50,6 @@ uint8_t display_init_sequence[] = { }; void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO37); - common_hal_never_reset_pin(&pin_GPIO38); - #endif /* DEBUG */ - displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL, false); diff --git a/ports/espressif/boards/adafruit_funhouse/pins.c b/ports/espressif/boards/adafruit_funhouse/pins.c index 17c2ac4256..c94aeebf20 100644 --- a/ports/espressif/boards/adafruit_funhouse/pins.c +++ b/ports/espressif/boards/adafruit_funhouse/pins.c @@ -44,8 +44,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO33) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO34) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_TX), MP_ROM_PTR(&pin_GPIO37) }, - { MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_RX), MP_ROM_PTR(&pin_GPIO38) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_OBJ_NEW_QSTR(MP_QSTR_DEBUG_RX), MP_ROM_PTR(&pin_GPIO44) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c index da070688ed..bd5ad77c93 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/board.c @@ -114,12 +114,6 @@ const uint8_t refresh_sequence[] = { }; void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ - displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; busio_spi_obj_t *spi = &bus->inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL, false); diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/board.c b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/board.c index 3b1f5efd87..164430c88c 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/board.c +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/board.c b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/board.c index 3b1f5efd87..164430c88c 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/board.c +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/board.c b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/board.c index 2e09e7d9a4..0118b6d8ea 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/board.c +++ b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/board.c @@ -32,12 +32,6 @@ #include "soc/usb_serial_jtag_struct.h" void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO20); - common_hal_never_reset_pin(&pin_GPIO21); - #endif - // This board has LEDs connected to the USB pins USB_SERIAL_JTAG.conf0.usb_pad_enable = 0; USB_SERIAL_JTAG.conf0.dp_pullup = 0; diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s/board.c b/ports/espressif/boards/ai_thinker_esp32-c3s/board.c index 2e09e7d9a4..0118b6d8ea 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s/board.c +++ b/ports/espressif/boards/ai_thinker_esp32-c3s/board.c @@ -32,12 +32,6 @@ #include "soc/usb_serial_jtag_struct.h" void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO20); - common_hal_never_reset_pin(&pin_GPIO21); - #endif - // This board has LEDs connected to the USB pins USB_SERIAL_JTAG.conf0.usb_pad_enable = 0; USB_SERIAL_JTAG.conf0.dp_pullup = 0; diff --git a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/board.c b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/board.c +++ b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/artisense_rd00/board.c b/ports/espressif/boards/artisense_rd00/board.c index fb3f6befc9..a23fe0765b 100644 --- a/ports/espressif/boards/artisense_rd00/board.c +++ b/ports/espressif/boards/artisense_rd00/board.c @@ -29,12 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ - // Crystal common_hal_never_reset_pin(&pin_GPIO15); common_hal_never_reset_pin(&pin_GPIO16); diff --git a/ports/espressif/boards/atmegazero_esp32s2/board.c b/ports/espressif/boards/atmegazero_esp32s2/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/atmegazero_esp32s2/board.c +++ b/ports/espressif/boards/atmegazero_esp32s2/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/bpi_bit_s2/board.c b/ports/espressif/boards/bpi_bit_s2/board.c index 22cdb31898..164430c88c 100644 --- a/ports/espressif/boards/bpi_bit_s2/board.c +++ b/ports/espressif/boards/bpi_bit_s2/board.c @@ -25,14 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/bpi_leaf_s3/board.c b/ports/espressif/boards/bpi_leaf_s3/board.c index 3b1f5efd87..164430c88c 100644 --- a/ports/espressif/boards/bpi_leaf_s3/board.c +++ b/ports/espressif/boards/bpi_leaf_s3/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/bpi_picow_s3/board.c b/ports/espressif/boards/bpi_picow_s3/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/bpi_picow_s3/board.c +++ b/ports/espressif/boards/bpi_picow_s3/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/brainboardz_neuron/board.c b/ports/espressif/boards/brainboardz_neuron/board.c index 3b1f5efd87..164430c88c 100755 --- a/ports/espressif/boards/brainboardz_neuron/board.c +++ b/ports/espressif/boards/brainboardz_neuron/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/crumpspace_crumps2/board.c b/ports/espressif/boards/crumpspace_crumps2/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/crumpspace_crumps2/board.c +++ b/ports/espressif/boards/crumpspace_crumps2/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/electroniccats_bastwifi/board.c b/ports/espressif/boards/electroniccats_bastwifi/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/electroniccats_bastwifi/board.c +++ b/ports/espressif/boards/electroniccats_bastwifi/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/board.c b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/board.c index b155ed7a7b..f749ee60d2 100644 --- a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/board.c +++ b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/board.c @@ -24,15 +24,6 @@ * THE SOFTWARE. */ -#include "shared-bindings/microcontroller/Pin.h" #include "supervisor/board.h" -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO20); - common_hal_never_reset_pin(&pin_GPIO21); - #endif -} - // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/board.c b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/board.c +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/board.c b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/board.c +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/board.c b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/board.c +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_box/board.c b/ports/espressif/boards/espressif_esp32s3_box/board.c index a91a924d04..4a2ce0efed 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/board.c +++ b/ports/espressif/boards/espressif_esp32s3_box/board.c @@ -88,12 +88,6 @@ void board_init(void) { true, // backlight_on_high false, // SH1107_addressing 50000); // backlight pwm frequency - - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/board.c b/ports/espressif/boards/espressif_esp32s3_box_lite/board.c index ddfab49797..1917e6df4c 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/board.c +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/board.c @@ -89,12 +89,6 @@ void board_init(void) { false, // backlight_on_high false, // SH1107_addressing 50000); // backlight pwm frequency - - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/board.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/board.c index ff9418ec86..164430c88c 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/board.c +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/board.c @@ -25,24 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} - -void board_deinit(void) { -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/board.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/board.c index 3b1f5efd87..164430c88c 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/board.c +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/board.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/board.c index 3b1f5efd87..164430c88c 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/board.c +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/board.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/board.c index 3b1f5efd87..164430c88c 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/board.c +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/board.c b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/board.c index 3b1f5efd87..164430c88c 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/board.c +++ b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/board.c b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/board.c index afbb5ae8fb..197dea0a49 100644 --- a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/board.c +++ b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/board.c @@ -116,10 +116,6 @@ void board_init(void) { true, // backlight_on_high false, // SH1107_addressing 50000); // backlight pwm frequency - - #if CIRCUITPY_DEBUG - common_hal_never_reset_pin(DEFAULT_UART_BUS_TX); - #endif } bool espressif_board_reset_pin_number(gpio_num_t pin_number) { diff --git a/ports/espressif/boards/espressif_kaluga_1.3/board.c b/ports/espressif/boards/espressif_kaluga_1.3/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/espressif_kaluga_1.3/board.c +++ b/ports/espressif/boards/espressif_kaluga_1.3/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_kaluga_1/board.c b/ports/espressif/boards/espressif_kaluga_1/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/espressif_kaluga_1/board.c +++ b/ports/espressif/boards/espressif_kaluga_1/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_saola_1_wroom/board.c b/ports/espressif/boards/espressif_saola_1_wroom/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/espressif_saola_1_wroom/board.c +++ b/ports/espressif/boards/espressif_saola_1_wroom/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_saola_1_wrover/board.c b/ports/espressif/boards/espressif_saola_1_wrover/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/espressif_saola_1_wrover/board.c +++ b/ports/espressif/boards/espressif_saola_1_wrover/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/franzininho_wifi_wroom/board.c b/ports/espressif/boards/franzininho_wifi_wroom/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/franzininho_wifi_wroom/board.c +++ b/ports/espressif/boards/franzininho_wifi_wroom/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/franzininho_wifi_wrover/board.c b/ports/espressif/boards/franzininho_wifi_wrover/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/franzininho_wifi_wrover/board.c +++ b/ports/espressif/boards/franzininho_wifi_wrover/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/gravitech_cucumber_m/board.c b/ports/espressif/boards/gravitech_cucumber_m/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/gravitech_cucumber_m/board.c +++ b/ports/espressif/boards/gravitech_cucumber_m/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/gravitech_cucumber_ms/board.c b/ports/espressif/boards/gravitech_cucumber_ms/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/gravitech_cucumber_ms/board.c +++ b/ports/espressif/boards/gravitech_cucumber_ms/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/gravitech_cucumber_r/board.c b/ports/espressif/boards/gravitech_cucumber_r/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/gravitech_cucumber_r/board.c +++ b/ports/espressif/boards/gravitech_cucumber_r/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/gravitech_cucumber_rs/board.c b/ports/espressif/boards/gravitech_cucumber_rs/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/gravitech_cucumber_rs/board.c +++ b/ports/espressif/boards/gravitech_cucumber_rs/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/hiibot_iots2/board.c b/ports/espressif/boards/hiibot_iots2/board.c index 87ee7d0b14..8524c80202 100644 --- a/ports/espressif/boards/hiibot_iots2/board.c +++ b/ports/espressif/boards/hiibot_iots2/board.c @@ -126,25 +126,6 @@ static void display_init(void) { } 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 - - // SPI Flash and RAM - common_hal_never_reset_pin(&pin_GPIO26); - common_hal_never_reset_pin(&pin_GPIO27); - common_hal_never_reset_pin(&pin_GPIO28); - common_hal_never_reset_pin(&pin_GPIO29); - common_hal_never_reset_pin(&pin_GPIO30); - common_hal_never_reset_pin(&pin_GPIO31); - common_hal_never_reset_pin(&pin_GPIO32); - // Display display_init(); } diff --git a/ports/espressif/boards/lilygo_tembed_esp32s3/board.c b/ports/espressif/boards/lilygo_tembed_esp32s3/board.c index 03a86a48d4..ee48d50288 100644 --- a/ports/espressif/boards/lilygo_tembed_esp32s3/board.c +++ b/ports/espressif/boards/lilygo_tembed_esp32s3/board.c @@ -88,12 +88,6 @@ void board_init(void) { true, // backlight_on_high false, // SH1107_addressing 50000); // backlight pwm frequency - - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c b/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c index 67b05e5cd2..e8fec80c7c 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t-01c3/board.c @@ -1,14 +1,3 @@ -#include "shared-bindings/microcontroller/Pin.h" #include "supervisor/board.h" -#include "components/driver/include/driver/gpio.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO20); - common_hal_never_reset_pin(&pin_GPIO21); - #endif -} - // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c index 7bcdcdba25..164430c88c 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/board.c @@ -24,17 +24,6 @@ * THE SOFTWARE. */ -#include "shared-bindings/microcontroller/Pin.h" #include "supervisor/board.h" -#include "components/driver/include/driver/gpio.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO20); - common_hal_never_reset_pin(&pin_GPIO21); - #endif -} - // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/board.c b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/board.c index 6597b51c5f..76973aee30 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2/board.c b/ports/espressif/boards/lilygo_ttgo_t8_s2/board.c index 6597b51c5f..76973aee30 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c index 7ba109dfce..f6ac6ede2d 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/board.c @@ -126,12 +126,6 @@ static void display_init(void) { } void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ - // Display display_init(); } diff --git a/ports/espressif/boards/lolin_s2_mini/board.c b/ports/espressif/boards/lolin_s2_mini/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/lolin_s2_mini/board.c +++ b/ports/espressif/boards/lolin_s2_mini/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lolin_s2_pico/board.c b/ports/espressif/boards/lolin_s2_pico/board.c index 2f987799ad..dfac8d0f57 100644 --- a/ports/espressif/boards/lolin_s2_pico/board.c +++ b/ports/espressif/boards/lolin_s2_pico/board.c @@ -97,11 +97,6 @@ static void display_init(void) { void board_init(void) { // init display display_init(); - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/lolin_s3_mini/board.c b/ports/espressif/boards/lolin_s3_mini/board.c index 9731a30366..00ae21ace8 100644 --- a/ports/espressif/boards/lolin_s3_mini/board.c +++ b/ports/espressif/boards/lolin_s3_mini/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/maker_badge/board.c b/ports/espressif/boards/maker_badge/board.c index 19dba31c57..45a7be2380 100644 --- a/ports/espressif/boards/maker_badge/board.c +++ b/ports/espressif/boards/maker_badge/board.c @@ -37,16 +37,6 @@ #define DELAY 0x80 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 */ - } bool board_requests_safe_mode(void) { diff --git a/ports/espressif/boards/microdev_micro_c3/board.c b/ports/espressif/boards/microdev_micro_c3/board.c index b155ed7a7b..f749ee60d2 100644 --- a/ports/espressif/boards/microdev_micro_c3/board.c +++ b/ports/espressif/boards/microdev_micro_c3/board.c @@ -24,15 +24,6 @@ * THE SOFTWARE. */ -#include "shared-bindings/microcontroller/Pin.h" #include "supervisor/board.h" -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO20); - common_hal_never_reset_pin(&pin_GPIO21); - #endif -} - // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/microdev_micro_s2/board.c b/ports/espressif/boards/microdev_micro_s2/board.c index 65bb19aced..f749ee60d2 100644 --- a/ports/espressif/boards/microdev_micro_s2/board.c +++ b/ports/espressif/boards/microdev_micro_s2/board.c @@ -25,17 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -#include "components/driver/include/driver/gpio.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/mixgo_ce_serial/board.c b/ports/espressif/boards/mixgo_ce_serial/board.c index e6ffb553b1..187596b3b0 100644 --- a/ports/espressif/boards/mixgo_ce_serial/board.c +++ b/ports/espressif/boards/mixgo_ce_serial/board.c @@ -34,12 +34,6 @@ #include "supervisor/filesystem.h" void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ - mp_import_stat_t stat_b = mp_import_stat("boot.py"); if (stat_b != MP_IMPORT_STAT_FILE) { FATFS *fatfs = filesystem_circuitpy(); diff --git a/ports/espressif/boards/mixgo_ce_udisk/board.c b/ports/espressif/boards/mixgo_ce_udisk/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/mixgo_ce_udisk/board.c +++ b/ports/espressif/boards/mixgo_ce_udisk/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/morpheans_morphesp-240/board.c b/ports/espressif/boards/morpheans_morphesp-240/board.c index 9491902161..b4c0db304a 100644 --- a/ports/espressif/boards/morpheans_morphesp-240/board.c +++ b/ports/espressif/boards/morpheans_morphesp-240/board.c @@ -139,12 +139,6 @@ uint8_t display_init_sequence[] = { void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO6); - common_hal_never_reset_pin(&pin_GPIO7); - #endif /* DEBUG */ - // Display displayio_fourwire_obj_t *bus = &allocate_display_bus()->fourwire_bus; diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/board.c b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/board.c +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/board.c b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/board.c +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/seeed_xiao_esp32c3/board.c b/ports/espressif/boards/seeed_xiao_esp32c3/board.c index 7bcdcdba25..164430c88c 100644 --- a/ports/espressif/boards/seeed_xiao_esp32c3/board.c +++ b/ports/espressif/boards/seeed_xiao_esp32c3/board.c @@ -24,17 +24,6 @@ * THE SOFTWARE. */ -#include "shared-bindings/microcontroller/Pin.h" #include "supervisor/board.h" -#include "components/driver/include/driver/gpio.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO20); - common_hal_never_reset_pin(&pin_GPIO21); - #endif -} - // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/smartbeedesigns_bee_data_logger/board.c b/ports/espressif/boards/smartbeedesigns_bee_data_logger/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/smartbeedesigns_bee_data_logger/board.c +++ b/ports/espressif/boards/smartbeedesigns_bee_data_logger/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/board.c b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/board.c +++ b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/smartbeedesigns_bee_s3/board.c b/ports/espressif/boards/smartbeedesigns_bee_s3/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/smartbeedesigns_bee_s3/board.c +++ b/ports/espressif/boards/smartbeedesigns_bee_s3/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/targett_module_clip_wroom/board.c b/ports/espressif/boards/targett_module_clip_wroom/board.c index ce5a770920..3168e9a0aa 100644 --- a/ports/espressif/boards/targett_module_clip_wroom/board.c +++ b/ports/espressif/boards/targett_module_clip_wroom/board.c @@ -29,12 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ - // Crystal common_hal_never_reset_pin(&pin_GPIO15); common_hal_never_reset_pin(&pin_GPIO16); diff --git a/ports/espressif/boards/targett_module_clip_wrover/board.c b/ports/espressif/boards/targett_module_clip_wrover/board.c index ce5a770920..3168e9a0aa 100644 --- a/ports/espressif/boards/targett_module_clip_wrover/board.c +++ b/ports/espressif/boards/targett_module_clip_wrover/board.c @@ -29,12 +29,6 @@ #include "shared-bindings/microcontroller/Pin.h" void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ - // Crystal common_hal_never_reset_pin(&pin_GPIO15); common_hal_never_reset_pin(&pin_GPIO16); diff --git a/ports/espressif/boards/unexpectedmaker_feathers2/board.c b/ports/espressif/boards/unexpectedmaker_feathers2/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2/board.c +++ b/ports/espressif/boards/unexpectedmaker_feathers2/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_neo/board.c b/ports/espressif/boards/unexpectedmaker_feathers2_neo/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_neo/board.c +++ b/ports/espressif/boards/unexpectedmaker_feathers2_neo/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/board.c b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/board.c +++ b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/board.c b/ports/espressif/boards/unexpectedmaker_feathers3/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/board.c +++ b/ports/espressif/boards/unexpectedmaker_feathers3/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/unexpectedmaker_nanos3/board.c b/ports/espressif/boards/unexpectedmaker_nanos3/board.c index 8fd94f6c8b..164430c88c 100644 --- a/ports/espressif/boards/unexpectedmaker_nanos3/board.c +++ b/ports/espressif/boards/unexpectedmaker_nanos3/board.c @@ -25,13 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/unexpectedmaker_pros3/board.c b/ports/espressif/boards/unexpectedmaker_pros3/board.c index 8fd94f6c8b..164430c88c 100644 --- a/ports/espressif/boards/unexpectedmaker_pros3/board.c +++ b/ports/espressif/boards/unexpectedmaker_pros3/board.c @@ -25,13 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/unexpectedmaker_tinys2/board.c b/ports/espressif/boards/unexpectedmaker_tinys2/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys2/board.c +++ b/ports/espressif/boards/unexpectedmaker_tinys2/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/unexpectedmaker_tinys3/board.c b/ports/espressif/boards/unexpectedmaker_tinys3/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys3/board.c +++ b/ports/espressif/boards/unexpectedmaker_tinys3/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/board.c b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/board.c index 2898f675c8..c49e1b8d45 100644 --- a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/board.c +++ b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/board.c @@ -126,12 +126,6 @@ static void display_init(void) { void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ - // Display display_init(); } diff --git a/ports/espressif/boards/waveshare_esp32s2_pico/board.c b/ports/espressif/boards/waveshare_esp32s2_pico/board.c index b3c8cb4191..164430c88c 100644 --- a/ports/espressif/boards/waveshare_esp32s2_pico/board.c +++ b/ports/espressif/boards/waveshare_esp32s2_pico/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif /* DEBUG */ -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/yd_esp32_s3_n16r8/board.c b/ports/espressif/boards/yd_esp32_s3_n16r8/board.c index e218345f59..70ff11b067 100644 --- a/ports/espressif/boards/yd_esp32_s3_n16r8/board.c +++ b/ports/espressif/boards/yd_esp32_s3_n16r8/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/yd_esp32_s3_n8r8/board.c b/ports/espressif/boards/yd_esp32_s3_n8r8/board.c index e218345f59..70ff11b067 100644 --- a/ports/espressif/boards/yd_esp32_s3_n8r8/board.c +++ b/ports/espressif/boards/yd_esp32_s3_n8r8/board.c @@ -25,15 +25,5 @@ */ #include "supervisor/board.h" -#include "mpconfigboard.h" -#include "shared-bindings/microcontroller/Pin.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index 4e1efa868f..86bd35fa43 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -38,7 +38,7 @@ STATIC uint64_t _skip_reset_once_pin_mask; STATIC uint64_t _preserved_pin_mask; STATIC uint64_t _in_use_pin_mask; -// Bit mask of all pins that should never EVER be reset. +// Bit mask of all pins that should never EVER be reset or used by user code. // Typically these are SPI flash and PSRAM control pins, and communication pins. // "Reset forbidden" is stronger than "never reset" below, which may only be temporary. static const uint64_t pin_mask_reset_forbidden = @@ -98,6 +98,11 @@ static const uint64_t pin_mask_reset_forbidden = GPIO_SEL_19 | // USB D- GPIO_SEL_20 | // USB D+ #endif + #if defined(CONFIG_ESP_CONSOLE_UART_DEFAULT) && CONFIG_ESP_CONSOLE_UART_DEFAULT && CONFIG_ESP_CONSOLE_UART_NUM == 0 + // Don't reset/use the IDF UART console. + GPIO_SEL_43 | // UART TX + GPIO_SEL_44 | // UART RX + #endif #endif // ESP32S2, ESP32S3 0; // Terminate last "|". @@ -244,7 +249,7 @@ void reset_all_pins(void) { } _reset_pin(i); } - _in_use_pin_mask = _never_reset_pin_mask; + _in_use_pin_mask = _never_reset_pin_mask | pin_mask_reset_forbidden; // Don't continue to skip resetting these pins. _skip_reset_once_pin_mask = 0; } diff --git a/ports/espressif/peripherals/esp32s3/pins.c b/ports/espressif/peripherals/esp32s3/pins.c index 891cc398ae..ef5b2462c6 100644 --- a/ports/espressif/peripherals/esp32s3/pins.c +++ b/ports/espressif/peripherals/esp32s3/pins.c @@ -26,6 +26,8 @@ #include "peripherals/pins.h" +// NOTE: These numbers do NOT always match the package and module pin number. +// These are by solely by GPIO numbers. const mcu_pin_obj_t pin_GPIO0 = PIN(0, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); const mcu_pin_obj_t pin_GPIO1 = PIN(1, ADC_UNIT_1, ADC_CHANNEL_0, TOUCH_PAD_NUM1); const mcu_pin_obj_t pin_GPIO2 = PIN(2, ADC_UNIT_1, ADC_CHANNEL_1, TOUCH_PAD_NUM2); diff --git a/ports/espressif/peripherals/pins.h b/ports/espressif/peripherals/pins.h index 9edad560c8..043bc8becc 100644 --- a/ports/espressif/peripherals/pins.h +++ b/ports/espressif/peripherals/pins.h @@ -54,7 +54,7 @@ extern const mp_obj_type_t mcu_pin_type; #define NO_TOUCH_CHANNEL TOUCH_PAD_MAX -// This macro is used to simplify pin definition in boards//pins.c +// This macro is used to simplify pin definition in peripherals//pins.c #define PIN(p_number, p_adc_index, p_adc_channel, p_touch_channel) \ { \ { &mcu_pin_type }, \ From ae181d69afcc34ff88e9e82952cdf28e5488615f Mon Sep 17 00:00:00 2001 From: Bobby Jap Date: Mon, 28 Aug 2023 21:36:32 -0700 Subject: [PATCH 1591/1712] Update wrappers to use new gzip changes --- shared-bindings/zlib/__init__.c | 8 ++++---- shared-bindings/zlib/__init__.h | 2 +- shared-module/zlib/__init__.c | 9 +++++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/shared-bindings/zlib/__init__.c b/shared-bindings/zlib/__init__.c index d0fd803d3a..1b38d59ff4 100644 --- a/shared-bindings/zlib/__init__.c +++ b/shared-bindings/zlib/__init__.c @@ -71,12 +71,12 @@ //| ... //| STATIC mp_obj_t zlib_decompress(size_t n_args, const mp_obj_t *args) { - bool is_zlib = true; - if (n_args > 1 && MP_OBJ_SMALL_INT_VALUE(args[1]) < 0) { - is_zlib = false; + mp_int_t wbits = 0; + if (n_args > 1) { + wbits = MP_OBJ_SMALL_INT_VALUE(args[1]); } - return common_hal_zlib_decompress(args[0], is_zlib); + return common_hal_zlib_decompress(args[0], wbits); } STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(zlib_decompress_obj, 1, 3, zlib_decompress); diff --git a/shared-bindings/zlib/__init__.h b/shared-bindings/zlib/__init__.h index 232d08e294..06ffb4aef6 100644 --- a/shared-bindings/zlib/__init__.h +++ b/shared-bindings/zlib/__init__.h @@ -27,6 +27,6 @@ #ifndef MICROPY_INCLUDED_SHARED_BINDINGS_ZLIB___INIT___H #define MICROPY_INCLUDED_SHARED_BINDINGS_ZLIB___INIT___H -mp_obj_t common_hal_zlib_decompress(mp_obj_t data, bool is_zlib); +mp_obj_t common_hal_zlib_decompress(mp_obj_t data, mp_int_t wbits); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_ZLIB___INIT___H diff --git a/shared-module/zlib/__init__.c b/shared-module/zlib/__init__.c index a057e6e2f7..082464fad2 100644 --- a/shared-module/zlib/__init__.c +++ b/shared-module/zlib/__init__.c @@ -48,7 +48,7 @@ #define DEBUG_printf(...) (void)0 #endif -mp_obj_t common_hal_zlib_decompress(mp_obj_t data, bool is_zlib) { +mp_obj_t common_hal_zlib_decompress(mp_obj_t data, mp_int_t wbits) { mp_buffer_info_t bufinfo; mp_get_buffer_raise(data, &bufinfo, MP_BUFFER_READ); @@ -66,7 +66,12 @@ mp_obj_t common_hal_zlib_decompress(mp_obj_t data, bool is_zlib) { decomp->source_limit = (unsigned char *)bufinfo.buf + bufinfo.len; int st; - if (is_zlib) { + if (wbits >= 16) { + st = uzlib_gzip_parse_header(decomp); + if (st < 0) { + goto error; + } + } else if (wbits >= 0) { st = uzlib_zlib_parse_header(decomp); if (st < 0) { goto error; From f204b1716450eb6ffce68f9f5891706e1d332a23 Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Tue, 29 Aug 2023 17:23:17 +0300 Subject: [PATCH 1592/1712] Disable dotfiles on boards without native usb --- supervisor/shared/filesystem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c index f6ade7cbba..2eff0b47aa 100644 --- a/supervisor/shared/filesystem.c +++ b/supervisor/shared/filesystem.c @@ -122,6 +122,7 @@ bool filesystem_init(bool create_allowed, bool force_create) { return false; } + #if CIRCUITPY_USB // inhibit file indexing on MacOS res = f_mkdir(&vfs_fat->fatfs, "/.fseventsd"); if (res != FR_OK) { @@ -134,7 +135,7 @@ bool filesystem_init(bool create_allowed, bool force_create) { make_empty_file(&vfs_fat->fatfs, "/.Trashes"); // MacOS make_empty_file(&vfs_fat->fatfs, "/.Trash-1000"); // Linux, XDG trash spec: // https://specifications.freedesktop.org/trash-spec/trashspec-latest.html - + #endif #if CIRCUITPY_OS_GETENV make_empty_file(&vfs_fat->fatfs, "/settings.toml"); From b1504f79b77cbc74a433fdbdad21a97a5309b528 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Mon, 28 Aug 2023 20:22:06 +0000 Subject: [PATCH 1593/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (1000 of 1000 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 0b1e0aeac6..18dfbc65ce 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: 2023-08-27 15:54+0000\n" +"PO-Revision-Date: 2023-08-29 18:34+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -2443,7 +2443,7 @@ msgstr "Você pressionou o botão A na inicialização." #: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h msgid "You pressed button DOWN at start up." -msgstr "" +msgstr "Você pressionou o botão DOWN na inicialização." #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" From 0d75bee3cf32d5f79fd241b91b4e075cbc45030c Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Tue, 29 Aug 2023 06:50:33 +0000 Subject: [PATCH 1594/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (1000 of 1000 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index ecf245428d..10ff982bad 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-08-27 15:54+0000\n" +"PO-Revision-Date: 2023-08-29 18:34+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -2414,7 +2414,7 @@ msgstr "Du tryckte ner knapp A vid start." #: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h msgid "You pressed button DOWN at start up." -msgstr "" +msgstr "Du tryckte ner knapp NER vid start." #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" From a76be7cfa532aee2a77bd3cdb02b19ef387132e6 Mon Sep 17 00:00:00 2001 From: hexthat Date: Mon, 28 Aug 2023 22:57:09 +0000 Subject: [PATCH 1595/1712] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (1000 of 1000 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index a601c3d0f2..245a4cc759 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-08-27 15:54+0000\n" +"PO-Revision-Date: 2023-08-29 18:34+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -2417,7 +2417,7 @@ msgstr "nín zài qǐ dòng shí àn xià le àn niǔ A." #: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h msgid "You pressed button DOWN at start up." -msgstr "" +msgstr "Nínzài qǐdòngshí ànxià le ànniǔ." #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" From b08b8876f9a0ddf9447ba1b0e1193f174a45f1cb Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 29 Aug 2023 11:38:12 -0700 Subject: [PATCH 1596/1712] Update tools/ci_check_duplicate_usb_vid_pid.py Co-authored-by: RetiredWizard --- tools/ci_check_duplicate_usb_vid_pid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index e8cdb2d443..2f66076086 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -63,7 +63,7 @@ DEFAULT_CLUSTERLIST = { ], "0x239A:0x102E": ["weact_studio_pico", "weact_studio_pico_16mb"], "0x303A:0x8166": ["yd_esp32_s3_n8r8", "yd_esp32_s3_n16r8"], - "0x2E8A:0x1020": [ "waveshare_rp2040_plus_4mb", "waveshare_rp2040_plus_16mb"], + "0x2E8A:0x1020": ["waveshare_rp2040_plus_4mb", "waveshare_rp2040_plus_16mb"], } cli_parser = argparse.ArgumentParser( From 17015b48ad8e04ad7466f8b58263b86731dfe14c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 10 Aug 2023 09:22:10 -0500 Subject: [PATCH 1597/1712] translations don't always use unicode code points now --- supervisor/shared/translate/compressed_string.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/supervisor/shared/translate/compressed_string.h b/supervisor/shared/translate/compressed_string.h index f524010db5..7e706c549d 100644 --- a/supervisor/shared/translate/compressed_string.h +++ b/supervisor/shared/translate/compressed_string.h @@ -38,12 +38,18 @@ // 9 in some translations sometime in the future. This length excludes // the trailing NUL, though notably decompress_length includes it. // -// - followed by the huffman encoding of the individual UTF-16 code +// - followed by the huffman encoding of the individual code // points that make up the string. The trailing "\0" is not // represented by a huffman code, but is implied by the length. // (building the huffman encoding on UTF-16 code points gave better // compression than building it on UTF-8 bytes) // +// - If possible, the code points are represented as uint8_t values, with +// 0..127 representing themselves and 160..255 representing another range +// of Unicode, controlled by translation_offset and translation_offstart. +// If this is not possible, uint16_t values are used. At present, no translation +// requires code points not in the BMP, so this is adequate. +// // - code points starting at 128 (word_start) and potentially extending // to 255 (word_end) (but never interfering with the target // language's used code points) stand for dictionary entries in a From ed9cacf41d883ddae7fb724ba3fffc8aeba5f82c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 9 Aug 2023 09:33:20 -0500 Subject: [PATCH 1598/1712] Add DotClockFramebuffer --- locale/circuitpython.pot | 11 +- ports/espressif/CMakeLists.txt | 6 +- ports/espressif/Makefile | 10 +- .../espressif_esp32s3_lcd_ev/mpconfigboard.mk | 13 + .../dotclockframebuffer/DotClockFramebuffer.c | 256 +++++++++++++ .../dotclockframebuffer/DotClockFramebuffer.h | 45 +++ .../common-hal/dotclockframebuffer/__init__.c | 0 .../common-hal/dotclockframebuffer/__init__.h | 0 .../common-hal/microcontroller/Pin.c | 8 + .../common-hal/microcontroller/Pin.h | 2 + ports/espressif/esp-idf | 2 +- ports/espressif/mpconfigport.mk | 1 + ports/espressif/supervisor/port.c | 14 + py/circuitpy_defns.mk | 5 + py/circuitpy_mpconfig.mk | 5 + .../dotclockframebuffer/DotClockFramebuffer.c | 338 ++++++++++++++++++ .../dotclockframebuffer/DotClockFramebuffer.h | 57 +++ .../dotclockframebuffer/__init__.c | 51 +++ .../dotclockframebuffer/__init__.h | 27 ++ shared-module/displayio/__init__.h | 6 + 20 files changed, 849 insertions(+), 8 deletions(-) create mode 100644 ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk create mode 100644 ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c create mode 100644 ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.h create mode 100644 ports/espressif/common-hal/dotclockframebuffer/__init__.c create mode 100644 ports/espressif/common-hal/dotclockframebuffer/__init__.h create mode 100644 shared-bindings/dotclockframebuffer/DotClockFramebuffer.c create mode 100644 shared-bindings/dotclockframebuffer/DotClockFramebuffer.h create mode 100644 shared-bindings/dotclockframebuffer/__init__.c create mode 100644 shared-bindings/dotclockframebuffer/__init__.h diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index c744c6d3cb..42e576dd9d 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -1224,6 +1224,7 @@ msgid "Invalid %q" msgstr "" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1378,6 +1379,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "" @@ -2948,7 +2953,7 @@ msgstr "" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "" @@ -3899,10 +3904,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" diff --git a/ports/espressif/CMakeLists.txt b/ports/espressif/CMakeLists.txt index ce2935a502..b30b32d2b8 100644 --- a/ports/espressif/CMakeLists.txt +++ b/ports/espressif/CMakeLists.txt @@ -12,7 +12,11 @@ if("${CIRCUITPY_ESPCAMERA}") message("Including esp32-camera") set(EXTRA_COMPONENT_DIRS "esp32-camera") list(APPEND COMPONENTS "esp32-camera") -message("COMPONENTS = ${COMPONENTS}") +endif() + +if("${CIRCUITPY_DOTCLOCKFRAMEBUFFER}") +message("Including esp32-camera") +list(APPEND COMPONENTS "esp_lcd") endif() include($ENV{IDF_PATH}/tools/cmake/project.cmake) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 320fda78fc..70ea4c0658 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -257,6 +257,11 @@ ifneq ($(CIRCUITPY_BLEIO),0) SRC_C += common-hal/_bleio/ble_events.c endif +ifneq ($(CIRCUITPY_DOTCLOCKFRAMEBUFFER),0) +CFLAGS += -isystem esp-idf/components/esp_lcd/include +CFLAGS += -isystem esp-idf/components/esp_lcd/interface +endif + ifneq ($(CIRCUITPY_ESPCAMERA),0) SRC_CAMERA := \ $(wildcard common-hal/espcamera/*.c) \ @@ -355,7 +360,7 @@ endif do-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h QSTR_GLOBAL_REQUIREMENTS += $(BUILD)/esp-idf/config/sdkconfig.h $(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig CMakeLists.txt | $(BUILD)/esp-idf - IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA) + IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA) -DCIRCUITPY_DOTCLOCKFRAMEBUFFER=$(CIRCUITPY_DOTCLOCKFRAMEBUFFER) # build a lib # Adding -d explain -j 1 -v to the ninja line will output debug info @@ -393,6 +398,9 @@ endif ifneq ($(CIRCUITPY_ESPULP),0) ESP_IDF_COMPONENTS_LINK += ulp endif +ifneq ($(CIRCUITPY_DOTCLOCKFRAMEBUFFER),0) + ESP_IDF_COMPONENTS_LINK += esp_lcd +endif ESP_IDF_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a) diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk new file mode 100644 index 0000000000..a6b9038928 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk @@ -0,0 +1,13 @@ +USB_VID = 0x303A +USB_PID = 0x7003 +USB_PRODUCT = "ESP32-S3-EV-LCD-Board" +USB_MANUFACTURER = "Espressif" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1 +UF2_BOOTLOADER = 0 diff --git a/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c b/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c new file mode 100644 index 0000000000..bf6021f0c4 --- /dev/null +++ b/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c @@ -0,0 +1,256 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "esp_intr_alloc.h" +#include "esp_lcd_panel_interface.h" +#include "esp_lcd_panel_rgb.h" +#include "esp_pm.h" +#include "esp_private/gdma.h" +#include "hal/dma_types.h" +#include "hal/lcd_hal.h" +#include "hal/lcd_ll.h" +#include "soc/lcd_periph.h" + +// extract from esp-idf esp_lcd_rgb_panel.c +typedef struct +{ + esp_lcd_panel_t base; // Base class of generic lcd panel + int panel_id; // LCD panel ID + lcd_hal_context_t hal; // Hal layer object + size_t data_width; // Number of data lines (e.g. for RGB565, the data width is 16) + size_t sram_trans_align; // Alignment for framebuffer that allocated in SRAM + size_t psram_trans_align; // Alignment for framebuffer that allocated in PSRAM + int disp_gpio_num; // Display control GPIO, which is used to perform action like "disp_off" + intr_handle_t intr; // LCD peripheral interrupt handle + esp_pm_lock_handle_t pm_lock; // Power management lock + size_t num_dma_nodes; // Number of DMA descriptors that used to carry the frame buffer + uint8_t *fb; // Frame buffer + size_t fb_size; // Size of frame buffer + int data_gpio_nums[SOC_LCD_RGB_DATA_WIDTH]; // GPIOs used for data lines, we keep these GPIOs for action like "invert_color" + size_t resolution_hz; // Peripheral clock resolution + esp_lcd_rgb_timing_t timings; // RGB timing parameters (e.g. pclk, sync pulse, porch width) + gdma_channel_handle_t dma_chan; // DMA channel handle + esp_lcd_rgb_panel_frame_trans_done_cb_t on_frame_trans_done; // Callback, invoked after frame trans done + void *user_ctx; // Reserved user's data of callback functions + int x_gap; // Extra gap in x coordinate, it's used when calculate the flush window + int y_gap; // Extra gap in y coordinate, it's used when calculate the flush window + struct + { + unsigned int disp_en_level : 1; // The level which can turn on the screen by `disp_gpio_num` + unsigned int stream_mode : 1; // If set, the LCD transfers data continuously, otherwise, it stops refreshing the LCD when transaction done + unsigned int fb_in_psram : 1; // Whether the frame buffer is in PSRAM + } flags; + dma_descriptor_t dma_nodes[]; // DMA descriptor pool of size `num_dma_nodes` +} esp_rgb_panel_t; + + +#include "esp_log.h" +#define TAG "LCD" + +#include "components/esp_rom/include/esp_rom_sys.h" + + +#include "py/objarray.h" +#include "shared-bindings/dotclockframebuffer/DotClockFramebuffer.h" +#include "common-hal/dotclockframebuffer/DotClockFramebuffer.h" +#include "bindings/espidf/__init__.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "py/runtime.h" +#include "components/driver/include/driver/gpio.h" +#include "components/driver/include/driver/periph_ctrl.h" +#include "components/driver/include/esp_private/gdma.h" +#include "components/esp_rom/include/esp_rom_gpio.h" +#include "components/hal/esp32s3/include/hal/lcd_ll.h" +#include "components/hal/include/hal/gpio_hal.h" +#include "components/soc/esp32s3/include/soc/lcd_cam_struct.h" +#include "esp_heap_caps.h" + +// should be from rom/cache.h but it wasn't working +int Cache_WriteBack_Addr(uint32_t addr, uint32_t size); + +#define LCD_RGB_ISR_IRAM_SAFE (1) +#define LCD_RGB_INTR_ALLOC_FLAGS (ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_INTRDISABLED) + +#define common_hal_mcu_pin_number_maybe(x) ((x) ? common_hal_mcu_pin_number((x)) : -1) + +static void claim_and_record(const mcu_pin_obj_t *pin, uint64_t *used_pins_mask) { + if (pin) { + int number = common_hal_mcu_pin_number(pin); + *used_pins_mask |= (UINT64_C(1) << number); + claim_pin_number(number); + never_reset_pin_number(number); + } +} + +static int valid_pin(const mcu_pin_obj_t *pin, qstr name) { + int result = common_hal_mcu_pin_number(pin); + if (result == NO_PIN) { + mp_raise_ValueError_varg(translate("Invalid %q pin"), name); + } + return result; +} + +void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_framebuffer_obj_t *self, + const mcu_pin_obj_t *de, + const mcu_pin_obj_t *vsync, + const mcu_pin_obj_t *hsync, + const mcu_pin_obj_t *dclk, + const mcu_pin_obj_t **red, uint8_t num_red, + const mcu_pin_obj_t **green, uint8_t num_green, + const mcu_pin_obj_t **blue, uint8_t num_blue, + int frequency, int width, int height, + int hsync_pulse_width, int hsync_back_porch, int hsync_front_porch, bool hsync_idle_low, + int vsync_pulse_width, int vsync_back_porch, int vsync_front_porch, bool vsync_idle_low, + bool de_idle_high, bool pclk_active_high, bool pclk_idle_high) { + + if (num_red != 5 || num_green != 6 || num_blue != 5) { + mp_raise_ValueError(translate("Must provide 5/6/5 RGB pins")); + } + + claim_and_record(de, &self->used_pins_mask); + claim_and_record(vsync, &self->used_pins_mask); + claim_and_record(hsync, &self->used_pins_mask); + claim_and_record(dclk, &self->used_pins_mask); + + for (size_t i = 0; i < num_red; i++) { + claim_and_record(red[i], &self->used_pins_mask); + } + for (size_t i = 0; i < num_green; i++) { + claim_and_record(green[i], &self->used_pins_mask); + } + for (size_t i = 0; i < num_blue; i++) { + claim_and_record(blue[i], &self->used_pins_mask); + } + + esp_lcd_rgb_panel_config_t *cfg = &self->panel_config; + cfg->timings.pclk_hz = frequency; + cfg->timings.h_res = width; + cfg->timings.v_res = height; + cfg->timings.hsync_pulse_width = hsync_pulse_width; + cfg->timings.hsync_back_porch = hsync_back_porch; + cfg->timings.hsync_front_porch = hsync_front_porch; + cfg->timings.vsync_pulse_width = vsync_pulse_width; + cfg->timings.vsync_back_porch = vsync_back_porch; + cfg->timings.vsync_front_porch = vsync_front_porch; + cfg->timings.flags.hsync_idle_low = hsync_idle_low; + cfg->timings.flags.vsync_idle_low = hsync_idle_low; + cfg->timings.flags.de_idle_high = de_idle_high; + cfg->timings.flags.pclk_active_neg = !pclk_active_high; + cfg->timings.flags.pclk_idle_high = pclk_idle_high; + + cfg->data_width = 16; + cfg->sram_trans_align = 8; + cfg->psram_trans_align = 64; + cfg->hsync_gpio_num = valid_pin(hsync, MP_QSTR_hsync); + cfg->vsync_gpio_num = valid_pin(vsync, MP_QSTR_vsync); + cfg->de_gpio_num = valid_pin(de, MP_QSTR_de); + cfg->pclk_gpio_num = valid_pin(dclk, MP_QSTR_dclk); + + cfg->data_gpio_nums[0] = valid_pin(blue[0], MP_QSTR_blue); + cfg->data_gpio_nums[1] = valid_pin(blue[1], MP_QSTR_blue); + cfg->data_gpio_nums[2] = valid_pin(blue[2], MP_QSTR_blue); + cfg->data_gpio_nums[3] = valid_pin(blue[3], MP_QSTR_blue); + cfg->data_gpio_nums[4] = valid_pin(blue[4], MP_QSTR_blue); + + cfg->data_gpio_nums[5] = valid_pin(green[0], MP_QSTR_green); + cfg->data_gpio_nums[6] = valid_pin(green[1], MP_QSTR_green); + cfg->data_gpio_nums[7] = valid_pin(green[2], MP_QSTR_green); + cfg->data_gpio_nums[8] = valid_pin(green[3], MP_QSTR_green); + cfg->data_gpio_nums[9] = valid_pin(green[4], MP_QSTR_green); + cfg->data_gpio_nums[10] = valid_pin(green[5], MP_QSTR_green); + + cfg->data_gpio_nums[11] = valid_pin(red[0], MP_QSTR_red); + cfg->data_gpio_nums[12] = valid_pin(red[1], MP_QSTR_red); + cfg->data_gpio_nums[13] = valid_pin(red[2], MP_QSTR_red); + cfg->data_gpio_nums[14] = valid_pin(red[3], MP_QSTR_red); + cfg->data_gpio_nums[15] = valid_pin(red[4], MP_QSTR_red); + + cfg->disp_gpio_num = GPIO_NUM_NC; + + cfg->flags.disp_active_low = 0; + cfg->flags.relax_on_idle = 0; + cfg->flags.fb_in_psram = 1; // allocate frame buffer in PSRAM + + ESP_ERROR_CHECK(esp_lcd_new_rgb_panel(&self->panel_config, &self->panel_handle)); + ESP_ERROR_CHECK(esp_lcd_panel_reset(self->panel_handle)); + ESP_ERROR_CHECK(esp_lcd_panel_init(self->panel_handle)); + + uint16_t color = 0; + ESP_ERROR_CHECK(self->panel_handle->draw_bitmap(self->panel_handle, 0, 0, 1, 1, &color)); + + esp_rgb_panel_t *_rgb_panel = __containerof(self->panel_handle, esp_rgb_panel_t, base); + + self->frequency = frequency; + self->refresh_rate = frequency / (width + hsync_front_porch + hsync_back_porch) / (height + vsync_front_porch + vsync_back_porch); + self->bufinfo.buf = _rgb_panel->fb; + self->bufinfo.len = 2 * width * height; + self->bufinfo.typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW; + + memset(self->bufinfo.buf, 0xaa, width * height); + memset(self->bufinfo.buf + width * height, 0x55, width * height); + +// LCD_CAM.lcd_ctrl2.lcd_vsync_idle_pol = _vsync_polarity; +// LCD_CAM.lcd_ctrl2.lcd_hsync_idle_pol = _hsync_polarity; + +} + + +void common_hal_dotclockframebuffer_framebuffer_deinit(dotclockframebuffer_framebuffer_obj_t *self) { + if (common_hal_dotclockframebuffer_framebuffer_deinitialized(self)) { + return; + } + + reset_pin_mask(self->used_pins_mask); + self->used_pins_mask = 0; + esp_lcd_panel_del(self->panel_handle); +} + +bool common_hal_dotclockframebuffer_framebuffer_deinitialized(dotclockframebuffer_framebuffer_obj_t *self) { + return self->used_pins_mask == 0; +} + + +mp_int_t common_hal_dotclockframebuffer_framebuffer_get_width(dotclockframebuffer_framebuffer_obj_t *self) { + return self->panel_config.timings.h_res; +} + +mp_int_t common_hal_dotclockframebuffer_framebuffer_get_height(dotclockframebuffer_framebuffer_obj_t *self) { + return self->panel_config.timings.v_res; +} + +mp_int_t common_hal_dotclockframebuffer_framebuffer_get_frequency(dotclockframebuffer_framebuffer_obj_t *self) { + return self->frequency; +} + +void common_hal_dotclockframebuffer_framebuffer_refresh(dotclockframebuffer_framebuffer_obj_t *self) { + Cache_WriteBack_Addr((uint32_t)(self->bufinfo.buf), self->bufinfo.len); +} + +mp_int_t common_hal_dotclockframebuffer_framebuffer_get_refresh_rate(dotclockframebuffer_framebuffer_obj_t *self) { + return self->refresh_rate; +} diff --git a/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.h b/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.h new file mode 100644 index 0000000000..386b9fc586 --- /dev/null +++ b/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.h @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 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 "esp_lcd_panel_io.h" +#include "esp_lcd_panel_rgb.h" +#include "esp_lcd_panel_vendor.h" +#include "esp_lcd_panel_ops.h" +#include "esp_lcd_panel_interface.h" + +typedef struct dotclockframebuffer_framebuffer_obj { + mp_obj_base_t base; + mp_buffer_info_t bufinfo; + uint32_t frequency, refresh_rate; + uint64_t used_pins_mask; + volatile int32_t frame_count; + esp_lcd_rgb_panel_config_t panel_config; + esp_lcd_panel_handle_t panel_handle; +} dotclockframebuffer_framebuffer_obj_t; diff --git a/ports/espressif/common-hal/dotclockframebuffer/__init__.c b/ports/espressif/common-hal/dotclockframebuffer/__init__.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/espressif/common-hal/dotclockframebuffer/__init__.h b/ports/espressif/common-hal/dotclockframebuffer/__init__.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index 4e1efa868f..2ba805eaab 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -218,6 +218,14 @@ void reset_pin_number(gpio_num_t pin_number) { _reset_pin(pin_number); } +void reset_pin_mask(uint64_t mask) { + for (int i = 0; i < 64; i++, mask >>= 1) { + if (mask & 1) { + reset_pin_number(i); + } + } +} + void common_hal_mcu_pin_reset_number(uint8_t i) { reset_pin_number((gpio_num_t)i); } diff --git a/ports/espressif/common-hal/microcontroller/Pin.h b/ports/espressif/common-hal/microcontroller/Pin.h index 05c8fe880d..8551a29a95 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.h +++ b/ports/espressif/common-hal/microcontroller/Pin.h @@ -41,6 +41,8 @@ extern void reset_all_pins(void); // reset_pin_number takes the pin number instead of the pointer so that objects don't // need to store a full pointer. extern void reset_pin_number(gpio_num_t pin_number); +// reset all pins in `bitmask` +extern void reset_pin_mask(uint64_t bitmask); extern void skip_reset_once_pin_number(gpio_num_t pin_number); extern void claim_pin(const mcu_pin_obj_t *pin); extern void claim_pin_number(gpio_num_t pin_number); diff --git a/ports/espressif/esp-idf b/ports/espressif/esp-idf index 630c2724fc..69f9a4f566 160000 --- a/ports/espressif/esp-idf +++ b/ports/espressif/esp-idf @@ -1 +1 @@ -Subproject commit 630c2724fc8c69eeaaa1bb025de52b99c5cb11aa +Subproject commit 69f9a4f566d49afe97fd8b47444bd394af005e23 diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 982e3bde36..01cb22d39a 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -21,6 +21,7 @@ CIRCUITPY_BLEIO ?= 1 CIRCUITPY_BLEIO_HCI = 0 CIRCUITPY_CANIO ?= 1 CIRCUITPY_COUNTIO ?= 1 +CIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION = 0 CIRCUITPY_DUALBANK ?= 1 CIRCUITPY_ESPCAMERA ?= 1 CIRCUITPY_ESPIDF ?= 1 diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index db4a436b13..e9f23de99b 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -25,12 +25,15 @@ * THE SOFTWARE. */ +#include #include #include #include "supervisor/board.h" #include "supervisor/port.h" #include "supervisor/filesystem.h" #include "supervisor/shared/reload.h" +#include "supervisor/serial.h" +#include "py/mpprint.h" #include "py/runtime.h" #include "freertos/FreeRTOS.h" @@ -537,6 +540,17 @@ void port_post_boot_py(bool heap_valid) { } } + +static int vprintf_adapter(const char *fmt, va_list ap) { + return mp_vprintf(&mp_plat_print, fmt, ap); +} + +#if CIRCUITPY_CONSOLE_UART +void port_serial_early_init(void) { + esp_log_set_vprintf(vprintf_adapter); +} +#endif + // Wrap main in app_main that the IDF expects. extern void main(void); extern void app_main(void); diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 8186d24b2a..8be49dca0d 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -296,6 +296,9 @@ endif ifeq ($(CIRCUITPY_RGBMATRIX),1) SRC_PATTERNS += rgbmatrix/% endif +ifeq ($(CIRCUITPY_DOTCLOCKFRAMEBUFFER),1) +SRC_PATTERNS += dotclockframebuffer/% +endif ifeq ($(CIRCUITPY_RP2PIO),1) SRC_PATTERNS += rp2pio/% endif @@ -435,6 +438,8 @@ SRC_COMMON_HAL_ALL = \ countio/__init__.c \ digitalio/DigitalInOut.c \ digitalio/__init__.c \ + dotclockframebuffer/DotClockFramebuffer.c \ + dotclockframebuffer/__init__.c \ dualbank/__init__.c \ frequencyio/FrequencyIn.c \ frequencyio/__init__.c \ diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 5ba3f8640b..c400707ac1 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -206,6 +206,11 @@ CIRCUITPY_PARALLELDISPLAY = 0 endif CFLAGS += -DCIRCUITPY_PARALLELDISPLAY=$(CIRCUITPY_PARALLELDISPLAY) +CIRCUITPY_DOTCLOCKFRAMEBUFFER ?= 0 +CFLAGS += -DCIRCUITPY_DOTCLOCKFRAMEBUFFER=$(CIRCUITPY_DOTCLOCKFRAMEBUFFER) +CIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION ?= 1 +CFLAGS += -DCIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION=$(CIRCUITPY_DOTCLOCKFRAMEBUFFER_USES_SUPERVISOR_ALLOCATION) + # bitmaptools and framebufferio rely on displayio CIRCUITPY_BITMAPTOOLS ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_DISPLAYIO)) CIRCUITPY_FRAMEBUFFERIO ?= $(call enable-if-all,$(CIRCUITPY_FULL_BUILD) $(CIRCUITPY_DISPLAYIO)) diff --git a/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c new file mode 100644 index 0000000000..995bab246e --- /dev/null +++ b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c @@ -0,0 +1,338 @@ +/* + * This file is part of the Micro Python 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. + */ + +#include "shared-bindings/dotclockframebuffer/DotClockFramebuffer.h" + +#include "py/binary.h" +#include "py/objarray.h" +#include "py/objproperty.h" +#include "py/runtime.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/util.h" +#include "shared-module/displayio/__init__.h" +#include "supervisor/shared/translate/translate.h" + +//| class DotClockFramebuffer: +//| """Manage updating a 'dot-clock' framebuffer in the background while Python code runs. +//| It doesn't handle display initialization.""" +//| +//| def __init__( +//| self, +//| *, +//| de: microcontroller.Pin, +//| vsync: microcontroller.Pin, +//| hsync: microcontroller.Pin, +//| dclk: microcontroller.Pin, +//| red: Tuple[microcontroller.Pin], +//| green: Tuple[microcontroller.Pin], +//| blue: Tuple[microcontroller.Pin], +//| frequency: int, +//| width: int, +//| height: int, +//| hsync_pulse_width: int, +//| hsync_back_porch: int, +//| hsync_front_porch: int, +//| hsync_idle_low: bool, +//| vsync_back_porch: int, +//| vsync_front_porch: int, +//| vsync_idle_low: bool, +//| de_idle_high: bool, +//| pclk_active_high: bool, +//| pclk_idle_high: bool, +//| ) -> None: +//| """Create a DotClockFramebuffer object associated with the given pins. +//| +//| The pins are then in use by the display until `displayio.release_displays()` +//| is called even after a reload. (It does this so CircuitPython can use the display after your +//| code is done.) So, the first time you initialize a display bus in code.py you should call +//| :py:func:`displayio.release_displays` first, otherwise it will error after the first code.py run. +//| +//| When a board has dedicated dot clock framebuffer pins and/or timings, they are intended to be used in the constructor with ``**`` dictionary unpacking like so: +//| ``DotClockFramebuffer(**board.TFT_PINS, **board.TFT_TIMINGS)`` +//| +//| On Espressif-family microcontrollers, this driver requires that the +//| ``CIRCUITPY_RESERVED_PSRAM`` in ``settings.toml`` be large enough to hold the +//| framebuffer. Generally, boards with built-in displays or display connectors +//| will have a default setting that is large enough for typical use. If the +//| constructor raises a MemoryError or an IDFError, this probably indicates the +//| setting is too small and should be increased. +//| +//| TFT connection parameters: +//| +//| :param microcontroller.Pin de: The "data enable" input to the display +//| :param microcontroller.Pin vsync: The "vertical sync" input to the display +//| :param microcontroller.Pin hsync: The "horizontal sync" input to the display +//| :param microcontroller.Pin dclk: The "data clock" input to the display +//| :param ~tuple red: The red data pins, most significant pin first. +//| :param ~tuple green: The green data pins, most significant pin first. +//| :param ~tuple blue: The blue data pins, most significant pin first. +//| +//| TFT timing parameters: +//| +//| :param int frequency: The requested data clock frequency in Hz. +//| :param int width: The visible width of the display, in pixels +//| :param int height: The visible height of the display, in pixels +//| :param int hsync_pulse_width: Horizontal sync width in pixels +//| :param int hsync_back_porch: Horizontal back porch, number of pixels between hsync and start of line active data +//| :param int hsync_front_porch: Horizontal front porch, number of pixels between the end of active data and the next hsync +//| :param int vsync_back_porch: Vertical back porch, number of lines between vsync and start of frame +//| :param int vsync_front_porch: Vertical front porch, number of lines between the end of frame and the next vsync +//| :param bool hsync_idle_low: True if the hsync signal is low in IDLE state +//| :param bool vsync_idle_low: True if the vsync signal is low in IDLE state +//| :param bool de_idle_high: True if the de signal is high in IDLE state +//| :param bool pclk_active_high: True if the display data is clocked out at the rising edge of dclk +//| :param bool pclk_idle_high: True if the dclk stays at high level in IDLE phase +//| """ +//| ... +STATIC mp_obj_t dotclockframebuffer_framebuffer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { + enum { ARG_de, ARG_vsync, ARG_hsync, ARG_dclk, ARG_red, ARG_green, ARG_blue, + ARG_frequency, ARG_width, ARG_height, + ARG_hsync_pulse_width, ARG_hsync_back_porch, ARG_hsync_front_porch, ARG_hsync_idle_low, + ARG_vsync_pulse_width, ARG_vsync_back_porch, ARG_vsync_front_porch, ARG_vsync_idle_low, + ARG_de_idle_high, ARG_pclk_active_high, ARG_pclk_idle_high, }; + + static const mp_arg_t allowed_args[] = { + { MP_QSTR_de, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } }, + { MP_QSTR_vsync, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } }, + { MP_QSTR_hsync, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } }, + { MP_QSTR_dclk, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } }, + { MP_QSTR_red, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } }, + { MP_QSTR_green, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } }, + { MP_QSTR_blue, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } }, + + { MP_QSTR_frequency, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } }, + { MP_QSTR_width, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } }, + { MP_QSTR_height, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } }, + + { MP_QSTR_hsync_pulse_width, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } }, + { MP_QSTR_hsync_back_porch, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } }, + { MP_QSTR_hsync_front_porch, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } }, + { MP_QSTR_hsync_idle_low, MP_ARG_BOOL | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_bool = false } }, + + { MP_QSTR_vsync_pulse_width, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } }, + { MP_QSTR_vsync_back_porch, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } }, + { MP_QSTR_vsync_front_porch, MP_ARG_INT | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_int = 0 } }, + { MP_QSTR_vsync_idle_low, MP_ARG_BOOL | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_bool = false } }, + + { MP_QSTR_de_idle_high, MP_ARG_BOOL | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_bool = false } }, + { MP_QSTR_pclk_active_high, MP_ARG_BOOL | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_bool = false } }, + { MP_QSTR_pclk_idle_high, MP_ARG_BOOL | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_bool = false } }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + const mcu_pin_obj_t *de = validate_obj_is_free_pin(args[ARG_de].u_obj, MP_QSTR_de); + const mcu_pin_obj_t *vsync = validate_obj_is_free_pin(args[ARG_vsync].u_obj, MP_QSTR_vsync); + const mcu_pin_obj_t *hsync = validate_obj_is_free_pin(args[ARG_hsync].u_obj, MP_QSTR_hsync); + const mcu_pin_obj_t *dclk = validate_obj_is_free_pin(args[ARG_dclk].u_obj, MP_QSTR_dclk); + + uint8_t num_red, num_green, num_blue; + const mcu_pin_obj_t *red_pins[8], *green_pins[8], *blue_pins[8]; + + validate_list_is_free_pins(MP_QSTR_red, red_pins, (mp_int_t)MP_ARRAY_SIZE(red_pins), args[ARG_red].u_obj, &num_red); + validate_list_is_free_pins(MP_QSTR_green, green_pins, (mp_int_t)MP_ARRAY_SIZE(green_pins), args[ARG_green].u_obj, &num_green); + validate_list_is_free_pins(MP_QSTR_blue, blue_pins, (mp_int_t)MP_ARRAY_SIZE(blue_pins), args[ARG_blue].u_obj, &num_blue); + + mp_printf(&mp_plat_print, "#red=%d #green=%d #blue=%d\n", num_red, num_green, num_blue); + + dotclockframebuffer_framebuffer_obj_t *self = &allocate_display_bus_or_raise()->dotclock; + self->base.type = &dotclockframebuffer_framebuffer_type; + + common_hal_dotclockframebuffer_framebuffer_construct( + self, de, vsync, hsync, dclk, red_pins, num_red, green_pins, num_green, blue_pins, num_blue, + args[ARG_frequency].u_int, args[ARG_width].u_int, args[ARG_height].u_int, + args[ARG_hsync_pulse_width].u_int, args[ARG_hsync_back_porch].u_int, args[ARG_hsync_front_porch].u_int, args[ARG_hsync_idle_low].u_bool, + args[ARG_vsync_pulse_width].u_int, args[ARG_vsync_back_porch].u_int, args[ARG_vsync_front_porch].u_int, args[ARG_vsync_idle_low].u_bool, + args[ARG_de_idle_high].u_bool, + args[ARG_pclk_active_high].u_bool, + args[ARG_pclk_idle_high].u_bool + ); + + return self; +} + +static void check_for_deinit(dotclockframebuffer_framebuffer_obj_t *self) { + if (common_hal_dotclockframebuffer_framebuffer_deinitialized(self)) { + raise_deinited_error(); + } +} + +//| def refresh(self) -> None: +//| """Transmits the color data in the buffer to the pixels so that +//| they are shown. +//| +//| If this function is not called, the results are unpredictable; updates may be partially shown. +//| """ +//| ... +STATIC mp_obj_t dotclockframebuffer_framebuffer_refresh(mp_obj_t self_in) { + dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in; + check_for_deinit(self); + common_hal_dotclockframebuffer_framebuffer_refresh(self); + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_refresh_obj, dotclockframebuffer_framebuffer_refresh); + + +//| refresh_rate: float +//| """The pixel refresh rate of the display, in Hz""" +STATIC mp_obj_t dotclockframebuffer_framebuffer_get_refresh_rate(mp_obj_t self_in) { + dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in; + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_dotclockframebuffer_framebuffer_get_refresh_rate(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_get_refresh_rate_obj, dotclockframebuffer_framebuffer_get_refresh_rate); +MP_PROPERTY_GETTER(dotclockframebuffer_framebuffer_refresh_rate_obj, + (mp_obj_t)&dotclockframebuffer_framebuffer_get_refresh_rate_obj); + +//| frequency: int +//| """The pixel frequency of the display, in Hz""" +STATIC mp_obj_t dotclockframebuffer_framebuffer_get_frequency(mp_obj_t self_in) { + dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in; + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_dotclockframebuffer_framebuffer_get_frequency(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_get_frequency_obj, dotclockframebuffer_framebuffer_get_frequency); +MP_PROPERTY_GETTER(dotclockframebuffer_framebuffer_frequency_obj, + (mp_obj_t)&dotclockframebuffer_framebuffer_get_frequency_obj); + +//| width: int +//| """The width of the display, in pixels""" +STATIC mp_obj_t dotclockframebuffer_framebuffer_get_width(mp_obj_t self_in) { + dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in; + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_dotclockframebuffer_framebuffer_get_width(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_get_width_obj, dotclockframebuffer_framebuffer_get_width); +MP_PROPERTY_GETTER(dotclockframebuffer_framebuffer_width_obj, + (mp_obj_t)&dotclockframebuffer_framebuffer_get_width_obj); + +//| height: int +//| """The height of the display, in pixels""" +//| +STATIC mp_obj_t dotclockframebuffer_framebuffer_get_height(mp_obj_t self_in) { + dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in; + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_dotclockframebuffer_framebuffer_get_height(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_get_height_obj, dotclockframebuffer_framebuffer_get_height); + +MP_PROPERTY_GETTER(dotclockframebuffer_framebuffer_height_obj, + (mp_obj_t)&dotclockframebuffer_framebuffer_get_height_obj); + +STATIC mp_int_t dotclockframebuffer_framebuffer_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) { + dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in; + // a readonly framebuffer would be unusual but not impossible + if ((flags & MP_BUFFER_WRITE) && !(self->bufinfo.typecode & MP_OBJ_ARRAY_TYPECODE_FLAG_RW)) { + return 1; + } + *bufinfo = self->bufinfo; + bufinfo->typecode = 'H'; + return 0; +} + +// These version exists so that the prototype matches the protocol, +// avoiding a type cast that can hide errors +STATIC void dotclockframebuffer_framebuffer_swapbuffers(mp_obj_t self_in, uint8_t *dirty_row_bitmap) { + (void)dirty_row_bitmap; + dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in; + common_hal_dotclockframebuffer_framebuffer_refresh(self); +} + +STATIC void dotclockframebuffer_framebuffer_deinit_proto(mp_obj_t self_in) { + common_hal_dotclockframebuffer_framebuffer_deinit(self_in); +} + +STATIC float dotclockframebuffer_framebuffer_get_brightness_proto(mp_obj_t self_in) { + return 1.0f; +} + +STATIC bool dotclockframebuffer_framebuffer_set_brightness_proto(mp_obj_t self_in, mp_float_t value) { + return false; +} + +STATIC int dotclockframebuffer_framebuffer_get_width_proto(mp_obj_t self_in) { + return common_hal_dotclockframebuffer_framebuffer_get_width(self_in); +} + +STATIC int dotclockframebuffer_framebuffer_get_height_proto(mp_obj_t self_in) { + return common_hal_dotclockframebuffer_framebuffer_get_height(self_in); +} + +STATIC int dotclockframebuffer_framebuffer_get_color_depth_proto(mp_obj_t self_in) { + return 16; +} + +STATIC int dotclockframebuffer_framebuffer_get_bytes_per_cell_proto(mp_obj_t self_in) { + return 1; +} + +STATIC int dotclockframebuffer_framebuffer_get_native_frames_per_second_proto(mp_obj_t self_in) { + return common_hal_dotclockframebuffer_framebuffer_get_refresh_rate(self_in); +} + +STATIC void dotclockframebuffer_framebuffer_get_bufinfo(mp_obj_t self_in, mp_buffer_info_t *bufinfo) { + dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in; + + *bufinfo = self->bufinfo; +} + + +STATIC const framebuffer_p_t dotclockframebuffer_framebuffer_proto = { + MP_PROTO_IMPLEMENT(MP_QSTR_protocol_framebuffer) + .get_bufinfo = dotclockframebuffer_framebuffer_get_bufinfo, + .set_brightness = dotclockframebuffer_framebuffer_set_brightness_proto, + .get_brightness = dotclockframebuffer_framebuffer_get_brightness_proto, + .get_width = dotclockframebuffer_framebuffer_get_width_proto, + .get_height = dotclockframebuffer_framebuffer_get_height_proto, + .get_color_depth = dotclockframebuffer_framebuffer_get_color_depth_proto, + .get_bytes_per_cell = dotclockframebuffer_framebuffer_get_bytes_per_cell_proto, + .get_native_frames_per_second = dotclockframebuffer_framebuffer_get_native_frames_per_second_proto, + .swapbuffers = dotclockframebuffer_framebuffer_swapbuffers, + .deinit = dotclockframebuffer_framebuffer_deinit_proto, +}; + + +STATIC const mp_rom_map_elem_t dotclockframebuffer_framebuffer_locals_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&dotclockframebuffer_framebuffer_width_obj) }, + { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&dotclockframebuffer_framebuffer_height_obj) }, + { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_PTR(&dotclockframebuffer_framebuffer_frequency_obj) }, + { MP_ROM_QSTR(MP_QSTR_refresh_rate), MP_ROM_PTR(&dotclockframebuffer_framebuffer_refresh_rate_obj) }, + { MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&dotclockframebuffer_framebuffer_refresh_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(dotclockframebuffer_framebuffer_locals_dict, dotclockframebuffer_framebuffer_locals_dict_table); + +const mp_obj_type_t dotclockframebuffer_framebuffer_type = { + { &mp_type_type }, + .flags = MP_TYPE_FLAG_EXTENDED, + .name = MP_QSTR_DotClockFramebuffer, + .make_new = dotclockframebuffer_framebuffer_make_new, + .locals_dict = (mp_obj_dict_t *)&dotclockframebuffer_framebuffer_locals_dict, + MP_TYPE_EXTENDED_FIELDS( + .buffer_p = { .get_buffer = dotclockframebuffer_framebuffer_get_buffer, }, + .protocol = &dotclockframebuffer_framebuffer_proto, + ), +}; diff --git a/shared-bindings/dotclockframebuffer/DotClockFramebuffer.h b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.h new file mode 100644 index 0000000000..acb44d083a --- /dev/null +++ b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.h @@ -0,0 +1,57 @@ +/* + * This file is part of the Micro Python 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. + */ + +#pragma once + +#include "common-hal/microcontroller/Pin.h" +#include "shared-bindings/displayio/__init__.h" +#include "shared-module/displayio/Group.h" + +typedef struct dotclockframebuffer_framebuffer_obj dotclockframebuffer_framebuffer_obj_t; + +extern const mp_obj_type_t dotclockframebuffer_framebuffer_type; + +void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_framebuffer_obj_t *self, + const mcu_pin_obj_t *de, + const mcu_pin_obj_t *vsync, + const mcu_pin_obj_t *hsync, + const mcu_pin_obj_t *dclk, + const mcu_pin_obj_t **red, uint8_t num_red, + const mcu_pin_obj_t **green, uint8_t num_green, + const mcu_pin_obj_t **blue, uint8_t num_blue, + int frequency, int width, int height, + int hsync_pulse_width, int hsync_back_porch, int hsync_front_porch, bool hsync_idle_low, + int vsync_pulse_width, int vsync_back_porch, int vsync_front_porch, bool vsync_idle_low, + bool de_idle_high, bool pclk_active_high, bool pclk_idle_high); + +void common_hal_dotclockframebuffer_framebuffer_deinit(dotclockframebuffer_framebuffer_obj_t *self); +bool common_hal_dotclockframebuffer_framebuffer_deinitialized(dotclockframebuffer_framebuffer_obj_t *self); + +mp_int_t common_hal_dotclockframebuffer_framebuffer_get_width(dotclockframebuffer_framebuffer_obj_t *self); +mp_int_t common_hal_dotclockframebuffer_framebuffer_get_height(dotclockframebuffer_framebuffer_obj_t *self); +mp_int_t common_hal_dotclockframebuffer_framebuffer_get_frequency(dotclockframebuffer_framebuffer_obj_t *self); +mp_int_t common_hal_dotclockframebuffer_framebuffer_get_refresh_rate(dotclockframebuffer_framebuffer_obj_t *self); +void common_hal_dotclockframebuffer_framebuffer_refresh(dotclockframebuffer_framebuffer_obj_t *self); diff --git a/shared-bindings/dotclockframebuffer/__init__.c b/shared-bindings/dotclockframebuffer/__init__.c new file mode 100644 index 0000000000..a91964988a --- /dev/null +++ b/shared-bindings/dotclockframebuffer/__init__.c @@ -0,0 +1,51 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 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 + +#include "py/enum.h" +#include "py/obj.h" +#include "py/runtime.h" + +#include "shared-bindings/dotclockframebuffer/__init__.h" +#include "shared-bindings/dotclockframebuffer/DotClockFramebuffer.h" + +//| """Native helpers for driving parallel displays""" + + +STATIC const mp_rom_map_elem_t dotclockframebuffer_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_dotclockframebuffer) }, + { MP_ROM_QSTR(MP_QSTR_DotClockFramebuffer), MP_ROM_PTR(&dotclockframebuffer_framebuffer_type) }, +}; + +STATIC MP_DEFINE_CONST_DICT(dotclockframebuffer_module_globals, dotclockframebuffer_module_globals_table); + +const mp_obj_module_t dotclockframebuffer_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t *)&dotclockframebuffer_module_globals, +}; + +MP_REGISTER_MODULE(MP_QSTR_dotclockframebuffer, dotclockframebuffer_module); diff --git a/shared-bindings/dotclockframebuffer/__init__.h b/shared-bindings/dotclockframebuffer/__init__.h new file mode 100644 index 0000000000..f7b42875a1 --- /dev/null +++ b/shared-bindings/dotclockframebuffer/__init__.h @@ -0,0 +1,27 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2018 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. + */ + +#pragma once diff --git a/shared-module/displayio/__init__.h b/shared-module/displayio/__init__.h index 1add0133b6..0695b950ac 100644 --- a/shared-module/displayio/__init__.h +++ b/shared-module/displayio/__init__.h @@ -47,6 +47,9 @@ #if CIRCUITPY_SHARPDISPLAY #include "shared-module/sharpdisplay/SharpMemoryFramebuffer.h" #endif +#if CIRCUITPY_DOTCLOCKFRAMEBUFFER +#include "common-hal/dotclockframebuffer/DotClockFramebuffer.h" +#endif // Port unique frame buffers. #if CIRCUITPY_VIDEOCORE #include "bindings/videocore/Framebuffer.h" @@ -78,6 +81,9 @@ typedef struct { #if CIRCUITPY_PICODVI picodvi_framebuffer_obj_t picodvi; #endif + #if CIRCUITPY_DOTCLOCKFRAMEBUFFER + dotclockframebuffer_framebuffer_obj_t dotclock; + #endif }; } primary_display_bus_t; From 494aee62b3df847b110d350f9713d99d12d40afa Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 30 Aug 2023 10:30:54 -0500 Subject: [PATCH 1599/1712] Add makerfabs 7" 800x480 TFT this is working, though it has to be down-clocked to 6.5MHz to prevent display glitching --- ports/espressif/boards/makerfabs_tft7/board.c | 34 ++++++ .../boards/makerfabs_tft7/mpconfigboard.h | 44 +++++++ .../boards/makerfabs_tft7/mpconfigboard.mk | 12 ++ ports/espressif/boards/makerfabs_tft7/pins.c | 108 ++++++++++++++++++ .../espressif/boards/makerfabs_tft7/sdkconfig | 41 +++++++ 5 files changed, 239 insertions(+) create mode 100644 ports/espressif/boards/makerfabs_tft7/board.c create mode 100644 ports/espressif/boards/makerfabs_tft7/mpconfigboard.h create mode 100644 ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk create mode 100644 ports/espressif/boards/makerfabs_tft7/pins.c create mode 100644 ports/espressif/boards/makerfabs_tft7/sdkconfig diff --git a/ports/espressif/boards/makerfabs_tft7/board.c b/ports/espressif/boards/makerfabs_tft7/board.c new file mode 100644 index 0000000000..0639737c35 --- /dev/null +++ b/ports/espressif/boards/makerfabs_tft7/board.c @@ -0,0 +1,34 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/makerfabs_tft7/mpconfigboard.h b/ports/espressif/boards/makerfabs_tft7/mpconfigboard.h new file mode 100644 index 0000000000..6dc58e9ef3 --- /dev/null +++ b/ports/espressif/boards/makerfabs_tft7/mpconfigboard.h @@ -0,0 +1,44 @@ +/* + * 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 "MakerFabs-ESP32-S3-Parallel-TFT-With-Touch-7inch" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO17) +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO18) + +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO11) +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO12) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO13) + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO43) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO44) + +// a 1024x768 16BPP framebuffer + some breathing room +#define DEFAULT_RESERVED_PSRAM (1024 * 1024 * 2) diff --git a/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk b/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk new file mode 100644 index 0000000000..5db7f461af --- /dev/null +++ b/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk @@ -0,0 +1,12 @@ +USB_VID = 0x303A +USB_PID = 0x7003 +USB_PRODUCT = "MakerFabs-ESP32-S3-Parallel-TFT-With-Touch-7inch" +USB_MANUFACTURER = "MakerFabs" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1 diff --git a/ports/espressif/boards/makerfabs_tft7/pins.c b/ports/espressif/boards/makerfabs_tft7/pins.c new file mode 100644 index 0000000000..c75304739d --- /dev/null +++ b/ports/espressif/boards/makerfabs_tft7/pins.c @@ -0,0 +1,108 @@ +#include "py/objtuple.h" +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_obj_tuple_t tft_r_pins = { + {&mp_type_tuple}, + 5, + { + MP_ROM_PTR(&pin_GPIO14), + MP_ROM_PTR(&pin_GPIO21), + MP_ROM_PTR(&pin_GPIO47), + MP_ROM_PTR(&pin_GPIO48), + MP_ROM_PTR(&pin_GPIO45), + } +}; + +STATIC const mp_rom_obj_tuple_t tft_g_pins = { + {&mp_type_tuple}, + 6, + { + MP_ROM_PTR(&pin_GPIO4), + MP_ROM_PTR(&pin_GPIO16), + MP_ROM_PTR(&pin_GPIO15), + MP_ROM_PTR(&pin_GPIO7), + MP_ROM_PTR(&pin_GPIO6), + MP_ROM_PTR(&pin_GPIO5), + } +}; + +STATIC const mp_rom_obj_tuple_t tft_b_pins = { + {&mp_type_tuple}, + 5, + { + MP_ROM_PTR(&pin_GPIO1), + MP_ROM_PTR(&pin_GPIO9), + MP_ROM_PTR(&pin_GPIO46), + MP_ROM_PTR(&pin_GPIO3), + MP_ROM_PTR(&pin_GPIO8), + } +}; + +STATIC const mp_rom_map_elem_t tft_table[] = { + { MP_ROM_QSTR(MP_QSTR_de), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_vsync), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_hsync), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_dclk), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_red), MP_ROM_PTR(&tft_r_pins) }, + { MP_ROM_QSTR(MP_QSTR_green), MP_ROM_PTR(&tft_g_pins) }, + { MP_ROM_QSTR(MP_QSTR_blue), MP_ROM_PTR(&tft_b_pins) }, +}; +MP_DEFINE_CONST_DICT(tft_dict, tft_table); + +#if 0 +Arduino_RPi_DPI_RGBPanel *gfx = new Arduino_RPi_DPI_RGBPanel( + bus, + 800 /* width */, 0 /* hsync_polarity */, 210 /* hsync_front_porch */, 30 /* hsync_pulse_width */, 16 /* hsync_back_porch */, + 480 /* height */, 0 /* vsync_polarity */, 22 /* vsync_front_porch */, 13 /* vsync_pulse_width */, 10 /* vsync_back_porch */, + 1 /* pclk_active_neg */, 16000000 /* prefer_speed */, true /* auto_flush */); +#endif + +STATIC const mp_rom_map_elem_t timings800_table[] = { + { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_INT(16000000) }, + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_INT(800) }, + { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_INT(480) }, + { MP_ROM_QSTR(MP_QSTR_hsync_pulse_width), MP_ROM_INT(30) }, + { MP_ROM_QSTR(MP_QSTR_hsync_front_porch), MP_ROM_INT(210) }, + { MP_ROM_QSTR(MP_QSTR_hsync_back_porch), MP_ROM_INT(16) }, + { MP_ROM_QSTR(MP_QSTR_hsync_idle_low), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_vsync_pulse_width), MP_ROM_INT(13) }, + { MP_ROM_QSTR(MP_QSTR_vsync_front_porch), MP_ROM_INT(22) }, + { MP_ROM_QSTR(MP_QSTR_vsync_back_porch), MP_ROM_INT(10) }, + { MP_ROM_QSTR(MP_QSTR_vsync_idle_low), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_de_active_high), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_pclk_active_high), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_pclk_idle_high), MP_ROM_FALSE }, +}; +MP_DEFINE_CONST_DICT(timings800_dict, timings800_table); + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_TFT), MP_ROM_PTR(&tft_dict) }, + { MP_ROM_QSTR(MP_QSTR_TIMINGS800), MP_ROM_PTR(&timings800_dict) }, + { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_SCK), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_I2S_WS), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_I2S_SDO), MP_ROM_PTR(&pin_GPIO19) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO12) }, + + // boot mode button can be used in SW as well + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO1) }, + + // IO10 <> SD_CS is cut at factory (non-placed resistor position R34) and pulled up. + // Permanent SDIO 1-bit mode? + + { 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_module_globals_table); diff --git a/ports/espressif/boards/makerfabs_tft7/sdkconfig b/ports/espressif/boards/makerfabs_tft7/sdkconfig new file mode 100644 index 0000000000..4449c672e1 --- /dev/null +++ b/ports/espressif/boards/makerfabs_tft7/sdkconfig @@ -0,0 +1,41 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_TYPE_AUTO=y +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="matouch-tft" +# end of LWIP +# +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +CONFIG_ESP_CONSOLE_UART_CUSTOM=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 +CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 +CONFIG_ESP_CONSOLE_UART=y From 9e0993af5b77e39a3782e2211aea0a5d2f201c11 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 30 Aug 2023 10:31:47 -0500 Subject: [PATCH 1600/1712] Add espressif esp32s3 lcd devkit This is not working/tested. The display requires an initialization sequence, and its SPI bus is on the other side of an I2C GPIO expander making things more difficult. --- .../boards/espressif_esp32s3_lcd_ev/board.c | 34 ++++++++ .../espressif_esp32s3_lcd_ev/mpconfigboard.h | 42 ++++++++++ .../boards/espressif_esp32s3_lcd_ev/pins.c | 79 +++++++++++++++++++ .../boards/espressif_esp32s3_lcd_ev/sdkconfig | 41 ++++++++++ 4 files changed, 196 insertions(+) create mode 100644 ports/espressif/boards/espressif_esp32s3_lcd_ev/board.c create mode 100644 ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.h create mode 100644 ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c create mode 100644 ports/espressif/boards/espressif_esp32s3_lcd_ev/sdkconfig diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/board.c b/ports/espressif/boards/espressif_esp32s3_lcd_ev/board.c new file mode 100644 index 0000000000..0639737c35 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/board.c @@ -0,0 +1,34 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.h new file mode 100644 index 0000000000..98b0e04122 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.h @@ -0,0 +1,42 @@ +/* + * 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 "Espressif-ESP32-S3-LCD-EV-Board" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO4) + +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO18) + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO43) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO44) + +// a 1024x768 16BPP framebuffer + some breathing room +#define DEFAULT_RESERVED_PSRAM (1024 * 1024 * 2) diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c b/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c new file mode 100644 index 0000000000..59da0cb910 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c @@ -0,0 +1,79 @@ +#include "py/objtuple.h" +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_obj_tuple_t tft_r_pins = { + {&mp_type_tuple}, + 5, + { + MP_ROM_PTR(&pin_GPIO10), + MP_ROM_PTR(&pin_GPIO11), + MP_ROM_PTR(&pin_GPIO12), + MP_ROM_PTR(&pin_GPIO13), + MP_ROM_PTR(&pin_GPIO14), + } +}; + +STATIC const mp_rom_obj_tuple_t tft_g_pins = { + {&mp_type_tuple}, + 6, + { + MP_ROM_PTR(&pin_GPIO21), + MP_ROM_PTR(&pin_GPIO47), + MP_ROM_PTR(&pin_GPIO48), + MP_ROM_PTR(&pin_GPIO45), + MP_ROM_PTR(&pin_GPIO38), + MP_ROM_PTR(&pin_GPIO39), + } +}; + +STATIC const mp_rom_obj_tuple_t tft_b_pins = { + {&mp_type_tuple}, + 5, + { + MP_ROM_PTR(&pin_GPIO40), + MP_ROM_PTR(&pin_GPIO41), + MP_ROM_PTR(&pin_GPIO42), + MP_ROM_PTR(&pin_GPIO2), + MP_ROM_PTR(&pin_GPIO1), + } +}; + +STATIC const mp_rom_map_elem_t tft_table[] = { + { MP_ROM_QSTR(MP_QSTR_de), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_vsync), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_hsync), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_dclk), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_red), MP_ROM_PTR(&tft_r_pins) }, + { MP_ROM_QSTR(MP_QSTR_green), MP_ROM_PTR(&tft_g_pins) }, + { MP_ROM_QSTR(MP_QSTR_blue), MP_ROM_PTR(&tft_b_pins) }, + { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_INT(9000000) }, +}; +MP_DEFINE_CONST_DICT(tft_dict, tft_table); + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_TFT), MP_ROM_PTR(&tft_dict) }, + { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_I2S_SCK), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_I2S_WS), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_I2S_SDO), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(DEFAULT_I2C_BUS_SCL) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(DEFAULT_I2C_BUS_SDA) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO12) }, + + // boot mode button can be used in SW as well + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, + + { 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_module_globals_table); diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/sdkconfig b/ports/espressif/boards/espressif_esp32s3_lcd_ev/sdkconfig new file mode 100644 index 0000000000..bc1b20063b --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/sdkconfig @@ -0,0 +1,41 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_TYPE_AUTO=y +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="circuitpy" +# end of LWIP +# +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +CONFIG_ESP_CONSOLE_UART_CUSTOM=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 +CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 +CONFIG_ESP_CONSOLE_UART=y From fb15c7ca5115eea5df6573950b352702bf105dd4 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 30 Aug 2023 10:50:16 -0500 Subject: [PATCH 1601/1712] Fix timings table & remove redundant comment --- ports/espressif/boards/makerfabs_tft7/pins.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/ports/espressif/boards/makerfabs_tft7/pins.c b/ports/espressif/boards/makerfabs_tft7/pins.c index c75304739d..1a170035c2 100644 --- a/ports/espressif/boards/makerfabs_tft7/pins.c +++ b/ports/espressif/boards/makerfabs_tft7/pins.c @@ -49,16 +49,8 @@ STATIC const mp_rom_map_elem_t tft_table[] = { }; MP_DEFINE_CONST_DICT(tft_dict, tft_table); -#if 0 -Arduino_RPi_DPI_RGBPanel *gfx = new Arduino_RPi_DPI_RGBPanel( - bus, - 800 /* width */, 0 /* hsync_polarity */, 210 /* hsync_front_porch */, 30 /* hsync_pulse_width */, 16 /* hsync_back_porch */, - 480 /* height */, 0 /* vsync_polarity */, 22 /* vsync_front_porch */, 13 /* vsync_pulse_width */, 10 /* vsync_back_porch */, - 1 /* pclk_active_neg */, 16000000 /* prefer_speed */, true /* auto_flush */); -#endif - STATIC const mp_rom_map_elem_t timings800_table[] = { - { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_INT(16000000) }, + { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_INT(6500000) }, // nominal 16MHz, but display is unstable/tears at that frequency { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_INT(800) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_INT(480) }, { MP_ROM_QSTR(MP_QSTR_hsync_pulse_width), MP_ROM_INT(30) }, @@ -69,7 +61,7 @@ STATIC const mp_rom_map_elem_t timings800_table[] = { { MP_ROM_QSTR(MP_QSTR_vsync_front_porch), MP_ROM_INT(22) }, { MP_ROM_QSTR(MP_QSTR_vsync_back_porch), MP_ROM_INT(10) }, { MP_ROM_QSTR(MP_QSTR_vsync_idle_low), MP_ROM_FALSE }, - { MP_ROM_QSTR(MP_QSTR_de_active_high), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_de_idle_high), MP_ROM_FALSE }, { MP_ROM_QSTR(MP_QSTR_pclk_active_high), MP_ROM_FALSE }, { MP_ROM_QSTR(MP_QSTR_pclk_idle_high), MP_ROM_FALSE }, }; From 227fa8cfc0c9394f45aa94722ad6ed92ab3760c2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 30 Aug 2023 10:54:43 -0500 Subject: [PATCH 1602/1712] add a link to the faq about this --- tools/ci_check_duplicate_usb_vid_pid.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index 2f66076086..5078215d54 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -137,7 +137,8 @@ def check_vid_pid(files, clusterlist): f"Duplicate VID/PID usage found!\n{duplicates}\n" f"If you are open source maker, then you can request a PID from http://pid.codes\n" f"For boards without native USB, you can request a Creator ID from https://github.com/creationid/creators/\n" - f"Otherwise, companies should pay the USB-IF for a vendor ID: https://www.usb.org/getting-vendor-id" + f"Otherwise, companies should pay the USB-IF for a vendor ID: https://www.usb.org/getting-vendor-id\n" + f"FAQ: Why does CircuitPython require a unique VID:PID for every board definition? https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython/frequently-asked-questions#faq-3130480" ) sys.exit(duplicate_message) From 9dcc0b5056b1fce358e95bdf49c52e657632de56 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 30 Aug 2023 10:58:52 -0500 Subject: [PATCH 1603/1712] fix those pesky pid/vid duplicates --- .../boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk | 2 +- .../boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk | 4 ++-- ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk index 78423955bb..d58b1ec7b4 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk @@ -7,4 +7,4 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE=dout CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=32MB +CIRCUITPY_ESP_FLASH_SIZE=16MB diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk index a6b9038928..cec65ead85 100644 --- a/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk @@ -1,5 +1,5 @@ -USB_VID = 0x303A -USB_PID = 0x7003 +USB_VID = 0x239A +USB_PID = 0x814C USB_PRODUCT = "ESP32-S3-EV-LCD-Board" USB_MANUFACTURER = "Espressif" diff --git a/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk b/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk index 5db7f461af..e6efc34ef7 100644 --- a/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk +++ b/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk @@ -1,5 +1,5 @@ -USB_VID = 0x303A -USB_PID = 0x7003 +USB_VID = 0x239A +USB_PID = 0x814A USB_PRODUCT = "MakerFabs-ESP32-S3-Parallel-TFT-With-Touch-7inch" USB_MANUFACTURER = "MakerFabs" From 7dbf9a9b56eb37b974e75cc10156bb3ec4ce0e8b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 30 Aug 2023 11:34:01 -0500 Subject: [PATCH 1604/1712] fix vprintf_adapter build error --- ports/espressif/supervisor/port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index e9f23de99b..37d67595ee 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -541,11 +541,11 @@ void port_post_boot_py(bool heap_valid) { } +#if CIRCUITPY_CONSOLE_UART static int vprintf_adapter(const char *fmt, va_list ap) { return mp_vprintf(&mp_plat_print, fmt, ap); } -#if CIRCUITPY_CONSOLE_UART void port_serial_early_init(void) { esp_log_set_vprintf(vprintf_adapter); } From 1ef4e3c7383fab0b68f3c5915861d13ab9b6f073 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 30 Aug 2023 15:02:39 -0500 Subject: [PATCH 1605/1712] Add Adafruit TFT Experiment (rev A) There will be a revision but get the basics in for now. This successfully displays on a TL040HDS20-B1502A screen with: ``` import board from framebufferio import FramebufferDisplay from dotclockframebuffer import DotClockFramebuffer from displayio import release_displays tft_pins = board.TFT tft_timings = { "frequency": 6_500_000, "width": 720, "height": 720, "hsync_pulse_width": 20, "hsync_front_porch": 40, "hsync_back_porch": 40, "vsync_pulse_width": 10, "vsync_front_porch": 40, "vsync_back_porch": 40, "hsync_idle_low": False, "vsync_idle_low": False, "de_idle_high": False, "pclk_active_high": False, "pclk_idle_high": False, } release_displays() fb = DotClockFramebuffer(**tft_pins, **tft_timings) disp = FramebufferDisplay(fb) ``` --- .../board.c | 34 ++++++++ .../mpconfigboard.h | 48 +++++++++++ .../mpconfigboard.mk | 12 +++ .../pins.c | 80 +++++++++++++++++++ .../sdkconfig | 41 ++++++++++ 5 files changed, 215 insertions(+) create mode 100644 ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/board.c create mode 100644 ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.h create mode 100644 ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.mk create mode 100644 ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/pins.c create mode 100644 ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/sdkconfig diff --git a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/board.c b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/board.c new file mode 100644 index 0000000000..0639737c35 --- /dev/null +++ b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/board.c @@ -0,0 +1,34 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.h b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.h new file mode 100644 index 0000000000..e93af63614 --- /dev/null +++ b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.h @@ -0,0 +1,48 @@ +/* + * 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 "Adafruit-ESP32-S3-RGB-TFT-Experiment" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO6) + +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO7) +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO6) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO16) + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO43) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO44) + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO4) + +#define DOUBLE_TAP_PIN (&pin_GPIO5) + +// a 1024x768 16BPP framebuffer + some breathing room +#define DEFAULT_RESERVED_PSRAM (1024 * 1024 * 2) diff --git a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.mk new file mode 100644 index 0000000000..9e66fc4359 --- /dev/null +++ b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.mk @@ -0,0 +1,12 @@ +USB_VID = 0x239A +USB_PID = 0x8148 +USB_PRODUCT = "Adafruit-ESP32-S3-RGB-TFT-Experiment" +USB_MANUFACTURER = "Adafruit" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1 diff --git a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/pins.c b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/pins.c new file mode 100644 index 0000000000..6b1e17f766 --- /dev/null +++ b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/pins.c @@ -0,0 +1,80 @@ +#include "py/objtuple.h" +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_obj_tuple_t tft_r_pins = { + {&mp_type_tuple}, + 5, + { + MP_ROM_PTR(&pin_GPIO13), + MP_ROM_PTR(&pin_GPIO12), + MP_ROM_PTR(&pin_GPIO11), + MP_ROM_PTR(&pin_GPIO10), + MP_ROM_PTR(&pin_GPIO46), + } +}; + +STATIC const mp_rom_obj_tuple_t tft_g_pins = { + {&mp_type_tuple}, + 6, + { + MP_ROM_PTR(&pin_GPIO5), // XXX fixed in rev b + MP_ROM_PTR(&pin_GPIO45), + MP_ROM_PTR(&pin_GPIO48), + MP_ROM_PTR(&pin_GPIO47), + MP_ROM_PTR(&pin_GPIO21), + MP_ROM_PTR(&pin_GPIO14), + } +}; + +STATIC const mp_rom_obj_tuple_t tft_b_pins = { + {&mp_type_tuple}, + 5, + { + MP_ROM_PTR(&pin_GPIO5), // XXX fixed in rev b + MP_ROM_PTR(&pin_GPIO5), // XXX fixed in rev b + MP_ROM_PTR(&pin_GPIO40), + MP_ROM_PTR(&pin_GPIO39), + MP_ROM_PTR(&pin_GPIO38), + } +}; + +STATIC const mp_rom_map_elem_t tft_table[] = { + { MP_ROM_QSTR(MP_QSTR_de), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_vsync), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_hsync), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_dclk), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_red), MP_ROM_PTR(&tft_r_pins) }, + { MP_ROM_QSTR(MP_QSTR_green), MP_ROM_PTR(&tft_g_pins) }, + { MP_ROM_QSTR(MP_QSTR_blue), MP_ROM_PTR(&tft_b_pins) }, +}; +MP_DEFINE_CONST_DICT(tft_dict, tft_table); + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_TFT), MP_ROM_PTR(&tft_dict) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(MICROPY_HW_NEOPIXEL) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(DEFAULT_I2C_BUS_SDA) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(DEFAULT_I2C_BUS_SCL) }, + + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(DEFAULT_SPI_BUS_MOSI) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(DEFAULT_SPI_BUS_MISO) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(DEFAULT_SPI_BUS_SCK) }, + { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO16) }, + + // boot mode button can be used in SW as well + { MP_ROM_QSTR(MP_QSTR_BUTTON_UP), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_BUTTON_DOWN), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_TP_IRQ), MP_ROM_PTR(&pin_GPIO9) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_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_module_globals_table); diff --git a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/sdkconfig b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/sdkconfig new file mode 100644 index 0000000000..4449c672e1 --- /dev/null +++ b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/sdkconfig @@ -0,0 +1,41 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_TYPE_AUTO=y +# end of SPI RAM config + +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="matouch-tft" +# end of LWIP +# +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +CONFIG_ESP_CONSOLE_UART_CUSTOM=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 +CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 +CONFIG_ESP_CONSOLE_UART=y From da3dfd7b5addc73b339eb29891cba88a012bf03a Mon Sep 17 00:00:00 2001 From: Tirtharaj Sinha Date: Thu, 31 Aug 2023 04:15:25 +0530 Subject: [PATCH 1606/1712] added new board - esp32 s3 pico --- locale/circuitpython.pot | 12 ++--- .../boards/waveshare_esp32_s3_pico/board.c | 40 +++++++++++++++ .../waveshare_esp32_s3_pico/mpconfigboard.h | 37 ++++++++++++++ .../waveshare_esp32_s3_pico/mpconfigboard.mk | 10 ++++ .../boards/waveshare_esp32_s3_pico/pins.c | 51 +++++++++++++++++++ .../boards/waveshare_esp32_s3_pico/sdkconfig | 47 +++++++++++++++++ 6 files changed, 191 insertions(+), 6 deletions(-) create mode 100644 ports/espressif/boards/waveshare_esp32_s3_pico/board.c create mode 100644 ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.h create mode 100644 ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk create mode 100644 ports/espressif/boards/waveshare_esp32_s3_pico/pins.c create mode 100644 ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index c744c6d3cb..b61c7b0f4c 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -89,13 +89,17 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -2948,7 +2952,7 @@ msgstr "" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "" @@ -3899,10 +3903,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/board.c b/ports/espressif/boards/waveshare_esp32_s3_pico/board.c new file mode 100644 index 0000000000..5031686be4 --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/board.c @@ -0,0 +1,40 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.h b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.h new file mode 100644 index 0000000000..dfec09b8aa --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.h @@ -0,0 +1,37 @@ +/* + * 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 "Waveshare ESP32-S3-Pico" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO21) + +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO12) +#define DEFAULT_UART_BUS_TX (&pin_GPIO11) diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk new file mode 100644 index 0000000000..116a998b74 --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk @@ -0,0 +1,10 @@ +USB_VID = 0x303a +USB_PID = 0x81A3 +USB_PRODUCT = "ESP32-S3-Pico" +USB_MANUFACTURER = "Waveshare Electronics" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 16MB diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c b/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c new file mode 100644 index 0000000000..884f4cf9e5 --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c @@ -0,0 +1,51 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + + + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + + + + + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig b/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig new file mode 100644 index 0000000000..3e366f0172 --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig @@ -0,0 +1,47 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM16=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP + +# end of Component config From 06ccd41294730566c4f3a924702c0fca22c2c399 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Tue, 29 Aug 2023 14:34:01 -0700 Subject: [PATCH 1607/1712] Remove frozen libs from Funhouse --- ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk index 7d5c91f154..808154b78c 100644 --- a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk @@ -12,8 +12,4 @@ CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESPCAMERA = 0 # Include these Python libraries in firmware. -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_PortalBase -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_FakeRequests -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Text From 5c23e28208646fc16be335cd23c0759f314348eb Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 31 Aug 2023 13:27:16 -0500 Subject: [PATCH 1608/1712] add explanation for newer compression features --- supervisor/shared/translate/compressed_string.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/supervisor/shared/translate/compressed_string.h b/supervisor/shared/translate/compressed_string.h index f524010db5..ac7517b9f6 100644 --- a/supervisor/shared/translate/compressed_string.h +++ b/supervisor/shared/translate/compressed_string.h @@ -53,6 +53,13 @@ // speaking, words. They're just spans of code points that frequently // occur together. They are ordered shortest to longest. // +// - If the translation uses a lot of code points or widely spaced code points, +// then the huffman table entries are UTF-16 code points. But if the translation +// uses only ASCII 7-bit code points plus a SMALL range of higher code points that +// still fit in 8 bits, translation_offset and translation_offstart are used to +// renumber the code points so that they still fit within 8 bits. (it's very beneficial +// for mchar_t to be 8 bits instead of 16!) +// // - dictionary entries are non-overlapping, and the _ending_ index of each // entry is stored in an array. A count of words of each length, from // minlen to maxlen, is given in the array called wlencount. From @@ -60,6 +67,14 @@ // calculated by an efficient, small loop. (A bit of time is traded // to reduce the size of this table indicating lengths) // +// - Value 1 ('\1') is used to indicate that a QSTR number follows. the +// QSTR is encoded as a fixed number of bits (translation_qstr_bits), e.g., +// 10 bits if the highest core qstr is from 512 to 1023 inclusive. +// (maketranslationdata uses a simple heuristic where any qstr >= 3 +// characters long is encoded in this way; this is simple but probably not +// optimal. In fact, the rule of >= 2 characters is better for SOME languages +// on SOME boards.) +// // The "data" / "tail" construct is so that the struct's last member is a // "flexible array". However, the _only_ member is not permitted to be // a flexible member, so we have to declare the first byte as a separate From 80a1d1a20a59aba9beb4d76251864453ed85025b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 31 Aug 2023 14:52:26 -0500 Subject: [PATCH 1609/1712] Add support for a non-displayed left portion of screen --- .../dotclockframebuffer/DotClockFramebuffer.c | 16 ++++---- .../dotclockframebuffer/DotClockFramebuffer.h | 1 + .../dotclockframebuffer/DotClockFramebuffer.c | 38 ++++++++++++++++++- .../dotclockframebuffer/DotClockFramebuffer.h | 4 +- 4 files changed, 49 insertions(+), 10 deletions(-) diff --git a/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c b/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c index bf6021f0c4..e9809da38c 100644 --- a/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +++ b/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c @@ -126,7 +126,7 @@ void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_fr int frequency, int width, int height, int hsync_pulse_width, int hsync_back_porch, int hsync_front_porch, bool hsync_idle_low, int vsync_pulse_width, int vsync_back_porch, int vsync_front_porch, bool vsync_idle_low, - bool de_idle_high, bool pclk_active_high, bool pclk_idle_high) { + bool de_idle_high, bool pclk_active_high, bool pclk_idle_high, int overscan_left) { if (num_red != 5 || num_green != 6 || num_blue != 5) { mp_raise_ValueError(translate("Must provide 5/6/5 RGB pins")); @@ -149,7 +149,7 @@ void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_fr esp_lcd_rgb_panel_config_t *cfg = &self->panel_config; cfg->timings.pclk_hz = frequency; - cfg->timings.h_res = width; + cfg->timings.h_res = width + overscan_left; cfg->timings.v_res = height; cfg->timings.hsync_pulse_width = hsync_pulse_width; cfg->timings.hsync_back_porch = hsync_back_porch; @@ -206,14 +206,12 @@ void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_fr esp_rgb_panel_t *_rgb_panel = __containerof(self->panel_handle, esp_rgb_panel_t, base); self->frequency = frequency; + self->row_stride = 2 * (width + overscan_left); self->refresh_rate = frequency / (width + hsync_front_porch + hsync_back_porch) / (height + vsync_front_porch + vsync_back_porch); - self->bufinfo.buf = _rgb_panel->fb; - self->bufinfo.len = 2 * width * height; + self->bufinfo.buf = (uint8_t *)_rgb_panel->fb + 2 * overscan_left; // first line starts ater overscan_left pixels + self->bufinfo.len = 2 * (cfg->timings.h_res * cfg->timings.v_res - overscan_left); // no overscan after last line self->bufinfo.typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW; - memset(self->bufinfo.buf, 0xaa, width * height); - memset(self->bufinfo.buf + width * height, 0x55, width * height); - // LCD_CAM.lcd_ctrl2.lcd_vsync_idle_pol = _vsync_polarity; // LCD_CAM.lcd_ctrl2.lcd_hsync_idle_pol = _hsync_polarity; @@ -247,6 +245,10 @@ mp_int_t common_hal_dotclockframebuffer_framebuffer_get_frequency(dotclockframeb return self->frequency; } +mp_int_t common_hal_dotclockframebuffer_framebuffer_get_row_stride(dotclockframebuffer_framebuffer_obj_t *self) { + return self->row_stride; +} + void common_hal_dotclockframebuffer_framebuffer_refresh(dotclockframebuffer_framebuffer_obj_t *self) { Cache_WriteBack_Addr((uint32_t)(self->bufinfo.buf), self->bufinfo.len); } diff --git a/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.h b/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.h index 386b9fc586..a40f28ea52 100644 --- a/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.h +++ b/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.h @@ -37,6 +37,7 @@ typedef struct dotclockframebuffer_framebuffer_obj { mp_obj_base_t base; mp_buffer_info_t bufinfo; + mp_int_t row_stride; uint32_t frequency, refresh_rate; uint64_t used_pins_mask; volatile int32_t frame_count; diff --git a/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c index 995bab246e..fb0df57db5 100644 --- a/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c +++ b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c @@ -62,6 +62,7 @@ //| de_idle_high: bool, //| pclk_active_high: bool, //| pclk_idle_high: bool, +//| overscan_left: int = 0, //| ) -> None: //| """Create a DotClockFramebuffer object associated with the given pins. //| @@ -105,14 +106,20 @@ //| :param bool de_idle_high: True if the de signal is high in IDLE state //| :param bool pclk_active_high: True if the display data is clocked out at the rising edge of dclk //| :param bool pclk_idle_high: True if the dclk stays at high level in IDLE phase +//| +//| :param int overscan_left: Allocate additional non-visible columns left of the first display column //| """ +//| #:param int overscan_top: Allocate additional non-visible rows above the first display row +//| #:param int overscan_right: Allocate additional non-visible columns right of the last display column +//| #:param int overscan_bottom: Allocate additional non-visible rows below the last display row //| ... STATIC mp_obj_t dotclockframebuffer_framebuffer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_de, ARG_vsync, ARG_hsync, ARG_dclk, ARG_red, ARG_green, ARG_blue, ARG_frequency, ARG_width, ARG_height, ARG_hsync_pulse_width, ARG_hsync_back_porch, ARG_hsync_front_porch, ARG_hsync_idle_low, ARG_vsync_pulse_width, ARG_vsync_back_porch, ARG_vsync_front_porch, ARG_vsync_idle_low, - ARG_de_idle_high, ARG_pclk_active_high, ARG_pclk_idle_high, }; + ARG_de_idle_high, ARG_pclk_active_high, ARG_pclk_idle_high, + ARG_overscan_left}; static const mp_arg_t allowed_args[] = { { MP_QSTR_de, MP_ARG_OBJ | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_obj = mp_const_none } }, @@ -140,6 +147,8 @@ STATIC mp_obj_t dotclockframebuffer_framebuffer_make_new(const mp_obj_type_t *ty { MP_QSTR_de_idle_high, MP_ARG_BOOL | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_bool = false } }, { MP_QSTR_pclk_active_high, MP_ARG_BOOL | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_bool = false } }, { MP_QSTR_pclk_idle_high, MP_ARG_BOOL | MP_ARG_KW_ONLY | MP_ARG_REQUIRED, {.u_bool = false } }, + + { MP_QSTR_overscan_left, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = 0 } }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; @@ -169,7 +178,8 @@ STATIC mp_obj_t dotclockframebuffer_framebuffer_make_new(const mp_obj_type_t *ty args[ARG_vsync_pulse_width].u_int, args[ARG_vsync_back_porch].u_int, args[ARG_vsync_front_porch].u_int, args[ARG_vsync_idle_low].u_bool, args[ARG_de_idle_high].u_bool, args[ARG_pclk_active_high].u_bool, - args[ARG_pclk_idle_high].u_bool + args[ARG_pclk_idle_high].u_bool, + args[ARG_overscan_left].u_int ); return self; @@ -243,6 +253,24 @@ MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_get_height_obj, dotclo MP_PROPERTY_GETTER(dotclockframebuffer_framebuffer_height_obj, (mp_obj_t)&dotclockframebuffer_framebuffer_get_height_obj); +//| row_stride: int +//| """The row_stride of the display, in bytes +//| +//| Due to overscan or alignment requirements, the memory address for row N+1 may not be exactly ``2*width`` bytes after the memory address for row N. +//| This property gives the stride in **bytes**. +//| +//| On Espressif this value is **guaranteed** to be a multiple of the 2 (i.e., it is a whole number of pixels)""" +//| +STATIC mp_obj_t dotclockframebuffer_framebuffer_get_row_stride(mp_obj_t self_in) { + dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in; + check_for_deinit(self); + return MP_OBJ_NEW_SMALL_INT(common_hal_dotclockframebuffer_framebuffer_get_row_stride(self)); +} +MP_DEFINE_CONST_FUN_OBJ_1(dotclockframebuffer_framebuffer_get_row_stride_obj, dotclockframebuffer_framebuffer_get_row_stride); + +MP_PROPERTY_GETTER(dotclockframebuffer_framebuffer_row_stride_obj, + (mp_obj_t)&dotclockframebuffer_framebuffer_get_row_stride_obj); + STATIC mp_int_t dotclockframebuffer_framebuffer_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags) { dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in; // a readonly framebuffer would be unusual but not impossible @@ -300,6 +328,10 @@ STATIC void dotclockframebuffer_framebuffer_get_bufinfo(mp_obj_t self_in, mp_buf *bufinfo = self->bufinfo; } +STATIC int dotclockframebuffer_framebuffer_get_row_stride_proto(mp_obj_t self_in) { + dotclockframebuffer_framebuffer_obj_t *self = (dotclockframebuffer_framebuffer_obj_t *)self_in; + return common_hal_dotclockframebuffer_framebuffer_get_row_stride(self); +} STATIC const framebuffer_p_t dotclockframebuffer_framebuffer_proto = { MP_PROTO_IMPLEMENT(MP_QSTR_protocol_framebuffer) @@ -309,6 +341,7 @@ STATIC const framebuffer_p_t dotclockframebuffer_framebuffer_proto = { .get_width = dotclockframebuffer_framebuffer_get_width_proto, .get_height = dotclockframebuffer_framebuffer_get_height_proto, .get_color_depth = dotclockframebuffer_framebuffer_get_color_depth_proto, + .get_row_stride = dotclockframebuffer_framebuffer_get_row_stride_proto, .get_bytes_per_cell = dotclockframebuffer_framebuffer_get_bytes_per_cell_proto, .get_native_frames_per_second = dotclockframebuffer_framebuffer_get_native_frames_per_second_proto, .swapbuffers = dotclockframebuffer_framebuffer_swapbuffers, @@ -319,6 +352,7 @@ STATIC const framebuffer_p_t dotclockframebuffer_framebuffer_proto = { STATIC const mp_rom_map_elem_t dotclockframebuffer_framebuffer_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_PTR(&dotclockframebuffer_framebuffer_width_obj) }, { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&dotclockframebuffer_framebuffer_height_obj) }, + { MP_ROM_QSTR(MP_QSTR_row_stride), MP_ROM_PTR(&dotclockframebuffer_framebuffer_row_stride_obj) }, { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_PTR(&dotclockframebuffer_framebuffer_frequency_obj) }, { MP_ROM_QSTR(MP_QSTR_refresh_rate), MP_ROM_PTR(&dotclockframebuffer_framebuffer_refresh_rate_obj) }, { MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&dotclockframebuffer_framebuffer_refresh_obj) }, diff --git a/shared-bindings/dotclockframebuffer/DotClockFramebuffer.h b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.h index acb44d083a..074625c4c0 100644 --- a/shared-bindings/dotclockframebuffer/DotClockFramebuffer.h +++ b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.h @@ -45,7 +45,8 @@ void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_fr int frequency, int width, int height, int hsync_pulse_width, int hsync_back_porch, int hsync_front_porch, bool hsync_idle_low, int vsync_pulse_width, int vsync_back_porch, int vsync_front_porch, bool vsync_idle_low, - bool de_idle_high, bool pclk_active_high, bool pclk_idle_high); + bool de_idle_high, bool pclk_active_high, bool pclk_idle_high, + int overscan_left); void common_hal_dotclockframebuffer_framebuffer_deinit(dotclockframebuffer_framebuffer_obj_t *self); bool common_hal_dotclockframebuffer_framebuffer_deinitialized(dotclockframebuffer_framebuffer_obj_t *self); @@ -54,4 +55,5 @@ mp_int_t common_hal_dotclockframebuffer_framebuffer_get_width(dotclockframebuffe mp_int_t common_hal_dotclockframebuffer_framebuffer_get_height(dotclockframebuffer_framebuffer_obj_t *self); mp_int_t common_hal_dotclockframebuffer_framebuffer_get_frequency(dotclockframebuffer_framebuffer_obj_t *self); mp_int_t common_hal_dotclockframebuffer_framebuffer_get_refresh_rate(dotclockframebuffer_framebuffer_obj_t *self); +mp_int_t common_hal_dotclockframebuffer_framebuffer_get_row_stride(dotclockframebuffer_framebuffer_obj_t *self); void common_hal_dotclockframebuffer_framebuffer_refresh(dotclockframebuffer_framebuffer_obj_t *self); From 554f529fdfb7ed3820ae5111259f3f8d6df2421a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 31 Aug 2023 14:52:54 -0500 Subject: [PATCH 1610/1712] Per review notes, make esp_lcd and esp32-camera unconditional --- ports/espressif/CMakeLists.txt | 13 ++----------- ports/espressif/Makefile | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/ports/espressif/CMakeLists.txt b/ports/espressif/CMakeLists.txt index b30b32d2b8..c6d180b57d 100644 --- a/ports/espressif/CMakeLists.txt +++ b/ports/espressif/CMakeLists.txt @@ -6,18 +6,9 @@ set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf) # The component list here determines what options we get in menuconfig and what the ninja file # can build. -set(COMPONENTS esptool_py soc driver log main esp-tls mbedtls mdns esp_event esp_adc_cal esp_netif esp_wifi lwip ulp wpa_supplicant freertos bt usb) +set(COMPONENTS esptool_py soc driver log main esp-tls mbedtls mdns esp_event esp_adc_cal esp_netif esp_wifi lwip ulp wpa_supplicant freertos bt usb esp32-camera esp_lcd) -if("${CIRCUITPY_ESPCAMERA}") -message("Including esp32-camera") -set(EXTRA_COMPONENT_DIRS "esp32-camera") -list(APPEND COMPONENTS "esp32-camera") -endif() - -if("${CIRCUITPY_DOTCLOCKFRAMEBUFFER}") -message("Including esp32-camera") -list(APPEND COMPONENTS "esp_lcd") -endif() +list(APPEND EXTRA_COMPONENT_DIRS "esp32-camera") include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(circuitpython) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 70ea4c0658..c103a79217 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -360,7 +360,7 @@ endif do-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h QSTR_GLOBAL_REQUIREMENTS += $(BUILD)/esp-idf/config/sdkconfig.h $(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig CMakeLists.txt | $(BUILD)/esp-idf - IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA) -DCIRCUITPY_DOTCLOCKFRAMEBUFFER=$(CIRCUITPY_DOTCLOCKFRAMEBUFFER) + IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja # build a lib # Adding -d explain -j 1 -v to the ninja line will output debug info From 5f12e0f9b83dca2f1a64737bfdb297a3ddca3b1b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 31 Aug 2023 14:53:31 -0500 Subject: [PATCH 1611/1712] Revert mistaken change --- .../boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk index d58b1ec7b4..78423955bb 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk @@ -7,4 +7,4 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE=dout CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=16MB +CIRCUITPY_ESP_FLASH_SIZE=32MB From 66b3eccaf6663e6dbbe171fba2a19821026c993f Mon Sep 17 00:00:00 2001 From: Bob Abeles Date: Thu, 31 Aug 2023 20:25:20 -0700 Subject: [PATCH 1612/1712] 8334: RP2040 lacks raw memory map access --- locale/circuitpython.pot | 29 ++-- .../common-hal/memorymap/AddressRange.c | 4 +- ports/nrf/common-hal/memorymap/AddressRange.c | 4 +- .../common-hal/memorymap/AddressRange.c | 136 ++++++++++++++++++ .../common-hal/memorymap/AddressRange.h | 49 +++++++ .../common-hal/memorymap/__init__.c | 1 + ports/raspberrypi/mpconfigport.mk | 1 + py/argcheck.c | 2 + py/obj.c | 15 ++ py/obj.h | 1 + py/runtime.h | 2 + shared-bindings/memorymap/AddressRange.c | 26 ++-- shared-bindings/memorymap/AddressRange.h | 8 +- 13 files changed, 245 insertions(+), 33 deletions(-) create mode 100644 ports/raspberrypi/common-hal/memorymap/AddressRange.c create mode 100644 ports/raspberrypi/common-hal/memorymap/AddressRange.h create mode 100644 ports/raspberrypi/common-hal/memorymap/__init__.c diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index c744c6d3cb..2007eb8b9b 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -89,13 +89,17 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -458,9 +462,14 @@ msgstr "" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" @@ -2127,6 +2136,10 @@ msgstr "" msgid "UUID value is not str, int or byte buffer" msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaliged IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2180,14 +2193,14 @@ msgstr "" msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "" @@ -2948,7 +2961,7 @@ msgstr "" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "" @@ -3899,10 +3912,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" diff --git a/ports/espressif/common-hal/memorymap/AddressRange.c b/ports/espressif/common-hal/memorymap/AddressRange.c index ed46c159bb..b05283b700 100644 --- a/ports/espressif/common-hal/memorymap/AddressRange.c +++ b/ports/espressif/common-hal/memorymap/AddressRange.c @@ -66,7 +66,7 @@ size_t common_hal_memorymap_addressrange_get_length(const memorymap_addressrange return self->len; } -bool common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_obj_t *self, +void common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_obj_t *self, size_t start_index, uint8_t *values, size_t len) { uint8_t *address = self->start_address + start_index; #pragma GCC diagnostic push @@ -83,8 +83,6 @@ bool common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_ob memcpy(address, values, len); } #pragma GCC diagnostic pop - - return true; } void common_hal_memorymap_addressrange_get_bytes(const memorymap_addressrange_obj_t *self, diff --git a/ports/nrf/common-hal/memorymap/AddressRange.c b/ports/nrf/common-hal/memorymap/AddressRange.c index eaef202d0d..11986f2cf5 100644 --- a/ports/nrf/common-hal/memorymap/AddressRange.c +++ b/ports/nrf/common-hal/memorymap/AddressRange.c @@ -95,7 +95,7 @@ uint32_t common_hal_memorymap_addressrange_get_length(const memorymap_addressran } -bool common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_obj_t *self, +void common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_obj_t *self, uint32_t start_index, uint8_t *values, uint32_t len) { uint8_t *address = self->start_address + start_index; #pragma GCC diagnostic push @@ -112,8 +112,6 @@ bool common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_ob memcpy(address, values, len); } #pragma GCC diagnostic pop - - return true; } void common_hal_memorymap_addressrange_get_bytes(const memorymap_addressrange_obj_t *self, diff --git a/ports/raspberrypi/common-hal/memorymap/AddressRange.c b/ports/raspberrypi/common-hal/memorymap/AddressRange.c new file mode 100644 index 0000000000..3eac27fa63 --- /dev/null +++ b/ports/raspberrypi/common-hal/memorymap/AddressRange.c @@ -0,0 +1,136 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * Copyright (c) 2023 Bob Abeles + * + * 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 "shared-bindings/memorymap/AddressRange.h" + +#include "py/runtime.h" + +#include "hardware/regs/addressmap.h" + +// RP2 address map ranges, must be arranged in order by ascending start address +addressmap_rp2_range_t rp2_ranges[] = { + {(uint8_t *)ROM_BASE, 0x00004000, ROM}, // boot ROM + {(uint8_t *)XIP_BASE, 0x00100000, XIP}, // XIP normal cache operation + {(uint8_t *)XIP_NOALLOC_BASE, 0x00100000, XIP}, // XIP check for hit, no update on miss + {(uint8_t *)XIP_NOCACHE_BASE, 0x00100000, XIP}, // XIP don't check for hit, no update on miss + {(uint8_t *)XIP_NOCACHE_NOALLOC_BASE, 0x00100000, XIP}, // XIP bypass cache completely + {(uint8_t *)XIP_CTRL_BASE, 0x00004000, IO}, // XIP control registers + {(uint8_t *)XIP_SRAM_BASE, 0x00004000, SRAM}, // XIP SRAM 16KB XIP cache + {(uint8_t *)XIP_SSI_BASE, 0x00004000, IO}, // XIP SSI registers + {(uint8_t *)SRAM_BASE, 0x00042000, SRAM}, // SRAM 256KB striped plus 16KB contiguous + {(uint8_t *)SRAM0_BASE, 0x00040000, SRAM}, // SRAM0 to SRAM3 256KB non-striped + {(uint8_t *)SYSINFO_BASE, 0x00070000, IO}, // APB peripherals + {(uint8_t *)DMA_BASE, 0x00004000, IO}, // DMA registers + {(uint8_t *)USBCTRL_DPRAM_BASE, 0x00001000, SRAM}, // USB DPSRAM 4KB + {(uint8_t *)USBCTRL_REGS_BASE, 0x00004000, IO}, // USB registers + {(uint8_t *)PIO0_BASE, 0x00004000, IO}, // PIO0 registers + {(uint8_t *)PIO1_BASE, 0x00004000, IO}, // PIO1 registers + {(uint8_t *)SIO_BASE, 0x00001000, IO}, // SIO registers, no aliases + {(uint8_t *)PPB_BASE, 0x00004000, IO} // PPB registers +}; + +void common_hal_memorymap_addressrange_construct(memorymap_addressrange_obj_t *self, + uint8_t *start_address, size_t length) { + for (size_t i = 0; i < MP_ARRAY_SIZE(rp2_ranges); i++) { + if (start_address <= rp2_ranges[i].start_address) { + uint8_t *range_end_address = rp2_ranges[i].start_address + rp2_ranges[i].len - 1; + uint8_t *end_address = start_address + length - 1; + if (start_address > range_end_address || end_address > range_end_address) { + break; + } + self->start_address = start_address; + self->len = length; + self->type = rp2_ranges[i].type; + return; + } + } + + mp_raise_ValueError(translate("Address range not allowed")); +} + +size_t common_hal_memorymap_addressrange_get_length(const memorymap_addressrange_obj_t *self) { + return self->len; +} + +void common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_obj_t *self, + size_t start_index, uint8_t *values, size_t len) { + uint8_t *dest_addr = self->start_address + start_index; + switch (self->type) { + case SRAM: + // Writes to SRAM may be arbitrary length and alignment. We use memcpy() which + // may optimize aligned writes depending on CIRCUITPY_FULL_BUILD of the CP build. + memcpy(dest_addr, values, len); + break; + case IO: + if ((size_t)dest_addr & 0x03 || len & 0x03) { + // Unaligned access or unaligned length not supported by RP2 for IO registers + mp_raise_RuntimeError(translate("Unable to access unaliged IO register")); + } else { + // Aligned access and length, use 32-bit writes + uint32_t *dest_addr32 = (uint32_t *)dest_addr; + size_t len32 = len >> 2; + for (size_t i = 0; i < len32; i++) { + *dest_addr32++ = ((uint32_t *)values)[i << 2]; + } + } + break; + case XIP: + case ROM: + // XIP and ROM are read-only + mp_raise_RuntimeError(translate("Unable to write to read-only memory")); + break; + } +} + +void common_hal_memorymap_addressrange_get_bytes(const memorymap_addressrange_obj_t *self, + size_t start_index, size_t len, uint8_t *values) { + uint8_t *src_addr = self->start_address + start_index; + switch (self->type) { + case SRAM: + case XIP: + case ROM: + // Reads from these sources may be arbitrary length and alignment. We use memcpy() + // which may optimize aligned writes depending on CIRCUITPY_FULL_BUILD of the CP build. + memcpy(values, src_addr, len); + break; + case IO: + if ((size_t)src_addr & 0x03 || len & 0x03) { + // Unaligned access or unaligned length not supported by RP2 for IO registers + mp_raise_RuntimeError(translate("Unable to access unaliged IO register")); + } else { + // Aligned access and length, use 32-bit writes + uint32_t *src_addr32 = (uint32_t *)src_addr; + size_t len32 = len >> 2; + for (size_t i = 0; i < len32; i++) { + ((uint32_t *)values)[i] = *src_addr32++; + } + } + break; + } +} diff --git a/ports/raspberrypi/common-hal/memorymap/AddressRange.h b/ports/raspberrypi/common-hal/memorymap/AddressRange.h new file mode 100644 index 0000000000..0e929c4305 --- /dev/null +++ b/ports/raspberrypi/common-hal/memorymap/AddressRange.h @@ -0,0 +1,49 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 microDev + * Copyright (c) 2023 Bob Abeles + * + * 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_RASPBERRYPI_COMMON_HAL_MEMORYMAP_ADDRESSRANGE_H +#define MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MEMORYMAP_ADDRESSRANGE_H + +#include "py/obj.h" + +// depending on the section memory type, different access methods and rules apply +typedef enum { SRAM, ROM, XIP, IO } memorymap_rp2_section_t; + +typedef struct { + mp_obj_base_t base; + uint8_t *start_address; + size_t len; + memorymap_rp2_section_t type; +} memorymap_addressrange_obj_t; + +typedef struct { + uint8_t *start_address; + size_t len; + memorymap_rp2_section_t type; +} addressmap_rp2_range_t; + +#endif // MICROPY_INCLUDED_RASPBERRYPI_COMMON_HAL_MEMORYMAP_ADDRESSRANGE_H diff --git a/ports/raspberrypi/common-hal/memorymap/__init__.c b/ports/raspberrypi/common-hal/memorymap/__init__.c new file mode 100644 index 0000000000..c15b17f451 --- /dev/null +++ b/ports/raspberrypi/common-hal/memorymap/__init__.c @@ -0,0 +1 @@ +// No memorymap module functions. diff --git a/ports/raspberrypi/mpconfigport.mk b/ports/raspberrypi/mpconfigport.mk index fdc2b0922a..d5e7734be1 100644 --- a/ports/raspberrypi/mpconfigport.mk +++ b/ports/raspberrypi/mpconfigport.mk @@ -15,6 +15,7 @@ CIRCUITPY_FULL_BUILD ?= 1 CIRCUITPY_AUDIOMP3 ?= 1 CIRCUITPY_BITOPS ?= 1 CIRCUITPY_IMAGECAPTURE ?= 1 +CIRCUITPY_MEMORYMAP ?= 1 CIRCUITPY_PWMIO ?= 1 CIRCUITPY_RGBMATRIX ?= $(CIRCUITPY_DISPLAYIO) CIRCUITPY_ROTARYIO ?= 1 diff --git a/py/argcheck.c b/py/argcheck.c index c3bde804d4..ff939ad828 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -115,6 +115,8 @@ void mp_arg_parse_all(size_t n_pos, const mp_obj_t *pos, mp_map_t *kws, size_t n out_vals[i].u_bool = mp_obj_is_true(given_arg); } else if ((allowed[i].flags & MP_ARG_KIND_MASK) == MP_ARG_INT) { out_vals[i].u_int = mp_obj_get_int(given_arg); + } else if ((allowed[i].flags & MP_ARG_KIND_MASK) == MP_ARG_UINT) { + out_vals[i].u_uint = mp_obj_get_uint(given_arg); } else { assert((allowed[i].flags & MP_ARG_KIND_MASK) == MP_ARG_OBJ); out_vals[i].u_obj = given_arg; diff --git a/py/obj.c b/py/obj.c index 31d469770c..a8702713d3 100644 --- a/py/obj.c +++ b/py/obj.c @@ -420,6 +420,21 @@ bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value) { return true; } +mp_uint_t mp_obj_get_uint(mp_const_obj_t arg) { + if (arg == mp_const_false) { + return 0; + } else if (arg == mp_const_true) { + return 1; + } else if (mp_obj_is_small_int(arg)) { + return MP_OBJ_SMALL_INT_VALUE(arg); + } else if (mp_obj_is_type(arg, &mp_type_int)) { + return mp_obj_int_get_uint_checked(arg); + } else { + mp_obj_t res = mp_unary_op(MP_UNARY_OP_INT, (mp_obj_t)arg); + return mp_obj_int_get_uint_checked(res); + } +} + #if MICROPY_PY_BUILTINS_FLOAT bool mp_obj_get_float_maybe(mp_obj_t arg, mp_float_t *value) { mp_float_t val; diff --git a/py/obj.h b/py/obj.h index d1874a8cd2..0b9f812e0b 100644 --- a/py/obj.h +++ b/py/obj.h @@ -939,6 +939,7 @@ static MP_INLINE bool mp_obj_is_integer(mp_const_obj_t o) { mp_int_t mp_obj_get_int(mp_const_obj_t arg); mp_int_t mp_obj_get_int_truncated(mp_const_obj_t arg); bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value); +mp_uint_t mp_obj_get_uint(mp_const_obj_t arg); #if MICROPY_PY_BUILTINS_FLOAT mp_float_t mp_obj_get_float(mp_obj_t self_in); bool mp_obj_get_float_maybe(mp_obj_t arg, mp_float_t *value); diff --git a/py/runtime.h b/py/runtime.h index 5ecab91e99..688d8b03fe 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -45,6 +45,7 @@ typedef enum { MP_ARG_BOOL = 0x001, MP_ARG_INT = 0x002, MP_ARG_OBJ = 0x003, + MP_ARG_UINT = 0x004, MP_ARG_KIND_MASK = 0x0ff, MP_ARG_REQUIRED = 0x100, MP_ARG_KW_ONLY = 0x200, @@ -53,6 +54,7 @@ typedef enum { typedef union _mp_arg_val_t { bool u_bool; mp_int_t u_int; + mp_uint_t u_uint; mp_obj_t u_obj; mp_rom_obj_t u_rom_obj; } mp_arg_val_t; diff --git a/shared-bindings/memorymap/AddressRange.c b/shared-bindings/memorymap/AddressRange.c index 7fd1062534..f2f5c28ee4 100644 --- a/shared-bindings/memorymap/AddressRange.c +++ b/shared-bindings/memorymap/AddressRange.c @@ -51,23 +51,25 @@ //| def __init__(self, *, start, length) -> None: //| """Constructs an address range starting at ``start`` and ending at -//| ``start + length``. An exception will be raised if any of the +//| ``start + length - 1``. An exception will be raised if any of the //| addresses are invalid or protected.""" //| ... STATIC mp_obj_t memorymap_addressrange_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_start, ARG_length }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_UINT }, { MP_QSTR_length, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - size_t start = - mp_arg_validate_int_min(args[ARG_start].u_int, 0, MP_QSTR_start); + size_t start = args[ARG_start].u_uint; size_t length = mp_arg_validate_int_min(args[ARG_length].u_int, 1, MP_QSTR_length); - + // Check for address range wrap here as this can break port-specific code due to size_t overflow. + if (start + length - 1 < start) { + mp_raise_ValueError(translate("Address range wraps around")); + } memorymap_addressrange_obj_t *self = mp_obj_malloc(memorymap_addressrange_obj_t, &memorymap_addressrange_type); @@ -104,7 +106,8 @@ STATIC MP_DEFINE_CONST_DICT(memorymap_addressrange_locals_dict, memorymap_addres //| def __getitem__(self, index: int) -> int: //| """Returns the value(s) at the given index. //| -//| 1, 2, 4 and 8 byte aligned reads will be done in one transaction. +//| 1, 2, 4 and 8 byte aligned reads will be done in one transaction +//| when possible. //| All others may use multiple transactions.""" //| ... //| @overload @@ -113,7 +116,8 @@ STATIC MP_DEFINE_CONST_DICT(memorymap_addressrange_locals_dict, memorymap_addres //| def __setitem__(self, index: int, value: int) -> None: //| """Set the value(s) at the given index. //| -//| 1, 2, 4 and 8 byte aligned writes will be done in one transaction. +//| 1, 2, 4 and 8 byte aligned writes will be done in one transaction +//| when possible. //| All others may use multiple transactions.""" //| ... //| @@ -154,9 +158,7 @@ STATIC mp_obj_t memorymap_addressrange_subscr(mp_obj_t self_in, mp_obj_t index_i mp_raise_NotImplementedError(translate("array/bytes required on right side")); } - if (!common_hal_memorymap_addressrange_set_bytes(self, slice.start, src_items, src_len)) { - mp_raise_RuntimeError(translate("Unable to write to address.")); - } + common_hal_memorymap_addressrange_set_bytes(self, slice.start, src_items, src_len); return mp_const_none; #else return MP_OBJ_NULL; // op not supported @@ -184,9 +186,7 @@ STATIC mp_obj_t memorymap_addressrange_subscr(mp_obj_t self_in, mp_obj_t index_i mp_arg_validate_int_range(byte_value, 0, 255, MP_QSTR_bytes); uint8_t short_value = byte_value; - if (!common_hal_memorymap_addressrange_set_bytes(self, index, &short_value, 1)) { - mp_raise_RuntimeError(translate("Unable to write to address.")); - } + common_hal_memorymap_addressrange_set_bytes(self, index, &short_value, 1); return mp_const_none; } } diff --git a/shared-bindings/memorymap/AddressRange.h b/shared-bindings/memorymap/AddressRange.h index 74a214d949..93c082c8eb 100644 --- a/shared-bindings/memorymap/AddressRange.h +++ b/shared-bindings/memorymap/AddressRange.h @@ -33,14 +33,14 @@ extern const mp_obj_type_t memorymap_addressrange_type; void common_hal_memorymap_addressrange_construct(memorymap_addressrange_obj_t *self, uint8_t *start_address, size_t length); -uint32_t common_hal_memorymap_addressrange_get_length(const memorymap_addressrange_obj_t *self); +size_t common_hal_memorymap_addressrange_get_length(const memorymap_addressrange_obj_t *self); -bool common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_obj_t *self, - uint32_t start_index, uint8_t *values, uint32_t len); +void common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_obj_t *self, + size_t start_index, uint8_t *values, size_t len); // len and values are intentionally swapped to signify values is an output and // also leverage the compiler to validate uses are expected. void common_hal_memorymap_addressrange_get_bytes(const memorymap_addressrange_obj_t *self, - uint32_t start_index, uint32_t len, uint8_t *values); + size_t start_index, size_t len, uint8_t *values); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_MEMORYMAP_ADDRESSRANGE_H From 398b2158c626c75a0cab6f9aca4b302088f018aa Mon Sep 17 00:00:00 2001 From: Deleted User Date: Thu, 31 Aug 2023 16:34:31 +0000 Subject: [PATCH 1613/1712] Translated using Weblate (Russian) Currently translated at 100.0% (1000 of 1000 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ru/ --- locale/ru.po | 196 ++++++++++++++++++++++++++------------------------- 1 file changed, 99 insertions(+), 97 deletions(-) diff --git a/locale/ru.po b/locale/ru.po index 1ae155ffdf..d74f93e70e 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -7,16 +7,16 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-05-21 00:49+0000\n" -"Last-Translator: Scott Shawcroft \n" +"PO-Revision-Date: 2023-09-01 11:54+0000\n" +"Last-Translator: Deleted User \n" "Language-Team: none\n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 4.18-dev\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 5.0.1-dev\n" #: main.c msgid "" @@ -40,18 +40,26 @@ msgid "" "Please file an issue with your program at github.com/adafruit/circuitpython/" "issues." msgstr "" +"\n" +"Пожалуйста, подайте вопрос с вашей программой на github.com/adafruit/" +"circuitpython/issues." #: supervisor/shared/safe_mode.c msgid "" "\n" "Press reset to exit safe mode.\n" msgstr "" +"\n" +"Нажмите на сброс, чтобы выйти из безопасного режима.\n" +".\n" #: supervisor/shared/safe_mode.c msgid "" "\n" "You are in safe mode because:\n" msgstr "" +"\n" +"Вы в безопасном режиме, потому что:\n" #: py/obj.c msgid " File \"%q\"" @@ -129,7 +137,7 @@ msgstr "%q сбой: %d" #: py/argcheck.c msgid "%q in %q must be of type %q, not %q" -msgstr "" +msgstr "%q в %q должно быть типа %q, а не %q" #: ports/espressif/common-hal/espulp/ULP.c #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c @@ -160,7 +168,7 @@ msgstr "%q является %q" #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "%q is read-only for this board" -msgstr "" +msgstr "%q читается только для этой доски" #: py/argcheck.c shared-bindings/usb_hid/Device.c msgid "%q length must be %d" @@ -213,21 +221,21 @@ msgstr "%q должно быть bytearray или array типа 'h', 'H', 'b', #: ports/espressif/common-hal/analogbufio/BufferedIn.c msgid "%q must be array of type 'H'" -msgstr "" +msgstr "%q должен быть массивом типа 'H \"" #: shared-module/synthio/__init__.c msgid "%q must be array of type 'h'" -msgstr "" +msgstr "%q должен быть массивом типа 'h \"" #: ports/raspberrypi/bindings/cyw43/__init__.c py/argcheck.c py/objexcept.c #: shared-bindings/canio/CAN.c shared-bindings/digitalio/Pull.c #: shared-module/synthio/Synthesizer.c msgid "%q must be of type %q or %q, not %q" -msgstr "" +msgstr "%q должно быть типа%q или%q, а не%q" #: py/argcheck.c py/objstrunicode.c shared-module/synthio/__init__.c msgid "%q must be of type %q, not %q" -msgstr "" +msgstr "%q должно быть типа %q, а не %q" #: ports/atmel-samd/common-hal/busio/UART.c msgid "%q must be power of 2" @@ -264,19 +272,19 @@ msgstr "%q=%q" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts in more bits than pin count" -msgstr "" +msgstr "%q [%u] смещается в большем количестве, чем количество пинов" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts out more bits than pin count" -msgstr "" +msgstr "%q[%u] смещает больше битов, чем количество выводов" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] uses extra pin" -msgstr "" +msgstr "%q[%u] использует дополнительный контакт" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] waits on input outside of count" -msgstr "" +msgstr "%q [%u] ожидает ввода за пределами графа" #: ports/espressif/common-hal/espidf/__init__.c #, c-format @@ -426,7 +434,7 @@ msgstr "'yield' вне функции" #: py/compile.c msgid "* arg after **" -msgstr "" +msgstr "* arg после **" #: py/compile.c msgid "*x must be assignment target" @@ -456,7 +464,7 @@ msgstr "ADC2 используется WiFi" #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "AP could not be started" -msgstr "" +msgstr "AP не может быть запущен" #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format @@ -507,7 +515,7 @@ msgstr "Все каналы уже используются" #: ports/raspberrypi/common-hal/usb_host/Port.c msgid "All dma channels in use" -msgstr "" +msgstr "Все используемые каналы dma" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "All event channels in use" @@ -569,7 +577,7 @@ msgstr "Поиск сетей wifi уже происходит" #: shared-module/os/getenv.c #, c-format msgid "An error occurred while retrieving '%s':\n" -msgstr "" +msgstr "Произошла ошибка при получении '%s':\n" #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" @@ -649,7 +657,7 @@ msgstr "Размер bitmap и количество бит-на-значение #: supervisor/shared/safe_mode.c msgid "Boot device must be first (interface #0)." -msgstr "" +msgstr "Загрузочное устройство должно быть первым (интерфейс #0)." #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" @@ -700,7 +708,7 @@ msgstr "Буфер слишком короткий на %d байт" #: shared-bindings/framebufferio/FramebufferDisplay.c #: shared-bindings/struct/__init__.c shared-module/struct/__init__.c msgid "Buffer too small" -msgstr "" +msgstr "Слишком маленький буфер" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" @@ -832,11 +840,8 @@ msgid "Cannot vary frequency on a timer that is already in use" msgstr "Невозможно изменить частоту на таймере, который уже используется" #: ports/nrf/common-hal/alarm/pin/PinAlarm.c -#, fuzzy msgid "Cannot wake on pin edge, only level" -msgstr "" -"Невозможно проснуться по изменению логического уровня (CHANGE), только по " -"уровню (LEVEL)" +msgstr "Невозможно проснуться по изменению логического уровня, только по уровню" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." @@ -868,11 +873,11 @@ msgstr "" #: shared-bindings/bitmaptools/__init__.c msgid "Coordinate arrays have different lengths" -msgstr "" +msgstr "Координатные массивы имеют разные длины" #: shared-bindings/bitmaptools/__init__.c msgid "Coordinate arrays types have different sizes" -msgstr "" +msgstr "Типы координат имеют разные размеры" #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" @@ -959,10 +964,9 @@ msgid "Drive mode not used when direction is input." msgstr "Drive mode не используется, когда направление является входным." #: py/obj.c -#, fuzzy msgid "During handling of the above exception, another exception occurred:" msgstr "" -"Во время обработки вышеупомянутого исключения произошло другое исключение:" +"При обращении с вышеуказанным исключением произошло еще одно исключение:" #: shared-bindings/aesio/aes.c msgid "ECB only operates on 16 bytes at a time" @@ -986,7 +990,7 @@ msgstr "Ошибка в регулярном выражении(regex)" #: supervisor/shared/safe_mode.c msgid "Error in safemode.py." -msgstr "" +msgstr "Ошибка в сейфе. py." #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "Error: Failure to bind" @@ -994,7 +998,7 @@ msgstr "Ошибка: Сбой привязки" #: shared-bindings/alarm/__init__.c msgid "Expected a kind of %q" -msgstr "" +msgstr "Ожидаемый вид %q" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -1075,14 +1079,12 @@ msgid "Filters too complex" msgstr "Фильтры слишком сложные" #: ports/espressif/common-hal/dualbank/__init__.c -#, fuzzy msgid "Firmware is duplicate" -msgstr "Прошивка является дубликатом" +msgstr "Прошивка дублируется" #: ports/espressif/common-hal/dualbank/__init__.c -#, fuzzy msgid "Firmware is invalid" -msgstr "Прошивка является неправильной" +msgstr "Недопустимая прошивка" #: ports/espressif/common-hal/dualbank/__init__.c msgid "Firmware is too big" @@ -1145,7 +1147,7 @@ msgstr "Полудуплексный SPI не реализован" #: supervisor/shared/safe_mode.c msgid "Hard fault: memory access or instruction error." -msgstr "" +msgstr "Жесткая ошибка: доступ к памяти или ошибка инструкции." #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c @@ -1156,12 +1158,14 @@ msgstr "Оборудование используется, попробуйте #: supervisor/shared/safe_mode.c msgid "Heap allocation when VM not running." -msgstr "" +msgstr "Выделение кучи, когда виртуальная машина не запущена." #: supervisor/shared/safe_mode.c msgid "" "Heap was corrupted because the stack was too small. Increase stack size." msgstr "" +"Куча была повреждена, потому что стек был слишком маленьким. Увеличьте " +"размер стека." #: extmod/vfs_posix_file.c py/objstringio.c msgid "I/O operation on closed file" @@ -1246,13 +1250,12 @@ msgid "Internal error #%d" msgstr "Внутренняя ошибка #%d" #: supervisor/shared/safe_mode.c -#, fuzzy msgid "Internal watchdog timer expired." msgstr "Внутренний сторожевой таймер истек." #: supervisor/shared/safe_mode.c msgid "Interrupt error." -msgstr "" +msgstr "Прерванная ошибка." #: ports/mimxrt10xx/common-hal/audiobusio/__init__.c #: ports/mimxrt10xx/common-hal/pwmio/PWMOut.c @@ -1284,7 +1287,7 @@ msgstr "Неверный BSSID" #: main.c msgid "Invalid CIRCUITPY_PYSTACK_SIZE\n" -msgstr "" +msgstr "Недопустимый CIRCUITPY_PYSTACK_SIZE\n" #: shared-bindings/wifi/Radio.c msgid "Invalid MAC address" @@ -1310,7 +1313,7 @@ msgstr "Неверный data_pins[%d]" #: shared-module/msgpack/__init__.c msgid "Invalid format" -msgstr "" +msgstr "Недопустимый формат" #: shared-module/audiocore/WaveFile.c msgid "Invalid format chunk size" @@ -1318,7 +1321,7 @@ msgstr "Неверный размер блока формата" #: shared-bindings/wifi/Radio.c msgid "Invalid hex password" -msgstr "" +msgstr "Неверный шестнадцатеричный пароль" #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" @@ -1339,7 +1342,7 @@ msgstr "Неверное состояние" #: shared-module/os/getenv.c msgid "Invalid unicode escape" -msgstr "" +msgstr "Недопустимое экранирование Юникода" #: shared-bindings/aesio/aes.c msgid "Key must be 16, 24, or 32 bytes long" @@ -1351,19 +1354,17 @@ msgstr "Ключ не найден" #: shared-module/is31fl3741/FrameBuffer.c msgid "LED mappings must match display size" -msgstr "" +msgstr "Светодиодные сопоставления должны соответствовать размеру дисплея" #: py/compile.c msgid "LHS of keyword arg must be an id" msgstr "LHS ключевого слова arg должен быть идентификатором(id)" #: shared-module/displayio/Group.c -#, fuzzy msgid "Layer already in a group" msgstr "Слой уже в группе (Group)" #: shared-module/displayio/Group.c -#, fuzzy msgid "Layer must be a Group or TileGrid subclass" msgstr "Слой должен быть группой (Group) или субклассом TileGrid." @@ -1373,7 +1374,7 @@ msgstr "MAC адрес был недействительным" #: shared-bindings/is31fl3741/IS31FL3741.c msgid "Mapping must be a tuple" -msgstr "" +msgstr "Сопоставление должно быть кортежом" #: shared-bindings/audiobusio/PDMIn.c msgid "Microphone startup delay must be in range 0.0 to 1.0" @@ -1390,31 +1391,31 @@ msgstr "Несоответствие флага swap" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] reads pin(s)" -msgstr "" +msgstr "Пропущенный первый_in_pin.%q [%u] читает пин (s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" -msgstr "" +msgstr "Отсутствует first_in_pin. %q[%u] смещается от контакта (контактов)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] waits based on pin" -msgstr "" +msgstr "Отсутствует first_in_pin. Инструкция %d ожидает на основе пина" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] shifts out to pin(s)" -msgstr "" +msgstr "Отсутствует first_out_pin. %q[%u] переключается на контакты" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] writes pin(s)" -msgstr "" +msgstr "Отсутствует first_out_pin. %q[%u] записывает pin(s)" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_set_pin. %q[%u] sets pin(s)" -msgstr "" +msgstr "Отсутствует first_set_pin. %q[%u] устанавливает контакты" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing jmp_pin. %q[%u] jumps on pin" -msgstr "" +msgstr "Не хватает jmp_pin.%q [%u] прыгает на пин" #: shared-bindings/busio/UART.c shared-bindings/displayio/Group.c msgid "Must be a %q subclass." @@ -1439,7 +1440,7 @@ msgstr "Ошибка NVS" #: shared-bindings/socketpool/SocketPool.c msgid "Name or service not known" -msgstr "" +msgstr "Имя или услуга не известны" #: py/qstr.c msgid "Name too long" @@ -1451,7 +1452,7 @@ msgstr "Новый bitmap должен быть того же размера ч #: ports/espressif/common-hal/_bleio/__init__.c msgid "Nimble out of memory" -msgstr "" +msgstr "Изображение памяти" #: ports/atmel-samd/common-hal/busio/UART.c #: ports/espressif/common-hal/busio/SPI.c @@ -1484,12 +1485,12 @@ msgstr "Канал DMA не найден" #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "No DMA pacing timer found" -msgstr "" +msgstr "Таймер стимуляции DMA не найден" #: shared-module/adafruit_bus_device/i2c_device/I2CDevice.c -#, fuzzy, c-format +#, c-format msgid "No I2C device at address: 0x%x" -msgstr "Не найдено устройство I2C по адресу: %x" +msgstr "Нет устройства I2C по адресу: %x" #: supervisor/shared/web_workflow/web_workflow.c msgid "No IP" @@ -1497,7 +1498,7 @@ msgstr "Нет IP" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c msgid "No available clocks" -msgstr "" +msgstr "Нет доступных часов" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "No capture in progress" @@ -1505,7 +1506,7 @@ msgstr "Захват не ведется" #: shared-module/usb/core/Device.c msgid "No configuration set" -msgstr "" +msgstr "Нет конфигураций" #: shared-bindings/_bleio/PacketBuffer.c msgid "No connection: length cannot be determined" @@ -1560,7 +1561,6 @@ msgid "No space left on device" msgstr "На устройстве не осталось свободного места" #: py/moduerrno.c -#, fuzzy msgid "No such device" msgstr "Нет такого устройства" @@ -1574,11 +1574,11 @@ msgstr "Нет доступного таймера" #: shared-module/usb/core/Device.c msgid "No usb host port initialized" -msgstr "" +msgstr "Порт USB-хоста не инициализирован" #: ports/nrf/common-hal/_bleio/__init__.c msgid "Nordic system firmware out of memory" -msgstr "" +msgstr "Скандинавская система прошивки из памяти" #: shared-bindings/ipaddress/IPv4Address.c shared-bindings/ipaddress/__init__.c msgid "Not a valid IP string" @@ -1592,7 +1592,6 @@ msgstr "Не подключено" #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audioio/AudioOut.c #: shared-bindings/audiopwmio/PWMAudioOut.c -#, fuzzy msgid "Not playing" msgstr "Не воспроизводится (Not playing)" @@ -1610,16 +1609,15 @@ msgstr "" #: ports/nrf/common-hal/busio/UART.c msgid "Odd parity is not supported" -msgstr "" +msgstr "Нечетная четность не поддерживается" #: supervisor/shared/bluetooth/bluetooth.c msgid "Off" msgstr "Выключено" #: supervisor/shared/bluetooth/bluetooth.c -#, fuzzy msgid "Ok" -msgstr "Ok" +msgstr "Да" #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c @@ -1646,15 +1644,15 @@ msgstr "" #: shared-bindings/_bleio/Adapter.c msgid "Only connectable advertisements can be directed" -msgstr "" +msgstr "Только подключаемые объявления могут быть направлены" #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Only edge detection is available on this hardware" -msgstr "" +msgstr "На этом аппаратном обеспечении доступно только обнаружение края" #: shared-bindings/ipaddress/__init__.c msgid "Only int or string supported for ip" -msgstr "" +msgstr "Только int или строка поддерживается для ip" #: shared-module/displayio/OnDiskBitmap.c #, c-format @@ -1662,6 +1660,8 @@ msgid "" "Only monochrome, indexed 4bpp or 8bpp, and 16bpp or greater BMPs supported: " "%d bpp given" msgstr "" +"Только монохром, индексированный 4bpp или 8bpp, и 16bpp или больше BMP " +"поддерживаются: %d bpp" #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." @@ -1669,85 +1669,87 @@ msgstr "Только один %q может быть погружен в глу #: ports/espressif/common-hal/espulp/ULPAlarm.c msgid "Only one %q can be set." -msgstr "" +msgstr "Можно установить только один %q." #: ports/espressif/common-hal/i2ctarget/I2CTarget.c #: ports/raspberrypi/common-hal/i2ctarget/I2CTarget.c msgid "Only one address is allowed" -msgstr "" +msgstr "Разрешен только один адрес" #: ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c #: ports/nrf/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set" -msgstr "" +msgstr "Можно установить только один сигнал тревоги.время" #: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." -msgstr "" +msgstr "Можно установить только один будильник alarm.time." #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" -msgstr "" +msgstr "Только один цвет может быть прозрачным одновременно" #: py/moduerrno.c msgid "Operation not permitted" -msgstr "" +msgstr "Операция не разрешена" #: ports/espressif/common-hal/espidf/__init__.c msgid "Operation or feature not supported" -msgstr "" +msgstr "Операция или функция, не поддерживаемые" #: ports/espressif/common-hal/espidf/__init__.c msgid "Operation timed out" -msgstr "" +msgstr "Истекло время ожидания операции" #: ports/raspberrypi/common-hal/mdns/Server.c msgid "Out of MDNS service slots" -msgstr "" +msgstr "Отсутствуют сервисные слоты MDNS" #: ports/espressif/common-hal/espidf/__init__.c msgid "Out of memory" -msgstr "" +msgstr "Не хватает памяти" #: ports/espressif/common-hal/socketpool/Socket.c #: ports/raspberrypi/common-hal/socketpool/Socket.c msgid "Out of sockets" -msgstr "" +msgstr "Вне розеток" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Out-buffer elements must be <= 4 bytes long" -msgstr "" +msgstr "Элементы буфера должны быть длиной <= 4 байта" #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." -msgstr "" +msgstr "Передискретизация должна быть кратна 8." #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" +"Частота ШИМ не записывается, если variable_frequency имеет значение False " +"при построении." #: ports/stm/common-hal/pwmio/PWMOut.c msgid "PWM restart" -msgstr "" +msgstr "PWM перезагрузка" #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice already in use" -msgstr "" +msgstr "PWM уже используется" #: ports/raspberrypi/common-hal/countio/Counter.c msgid "PWM slice channel A already in use" -msgstr "" +msgstr "PWM канал среза A уже используется" #: ports/espressif/common-hal/audiobusio/__init__.c msgid "Peripheral in use" -msgstr "" +msgstr "Периферийные устройства в использовании" #: py/moduerrno.c msgid "Permission denied" -msgstr "" +msgstr "Отказано в разрешении" #: ports/stm/common-hal/alarm/pin/PinAlarm.c msgid "Pin cannot wake from Deep Sleep" @@ -1799,19 +1801,19 @@ msgstr "Пины должны иметь общий срез ШИМ" #: shared-module/usb/core/Device.c msgid "Pipe error" -msgstr "" +msgstr "Ошибка трубопровода" #: py/builtinhelp.c msgid "Plus any modules on the filesystem\n" -msgstr "" +msgstr "Плюс любые модули в файловой системе\n" #: shared-module/vectorio/Polygon.c msgid "Polygon needs at least 3 points" -msgstr "" +msgstr "Полигон нуждается не менее 3 пунктов" #: supervisor/shared/safe_mode.c msgid "Power dipped. Make sure you are providing enough power." -msgstr "" +msgstr "Мощность просела. Убедитесь, что вы обеспечиваете достаточную мощность." #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" @@ -4389,19 +4391,19 @@ msgstr "" #: extmod/ulab/code/numpy/transform.c msgid "wrong length of condition array" -msgstr "" +msgstr "неправильная длина массива состояния" #: extmod/ulab/code/numpy/transform.c msgid "wrong length of index array" -msgstr "" +msgstr "неправильная длина массива индексов" #: extmod/ulab/code/numpy/create.c py/objarray.c py/objstr.c msgid "wrong number of arguments" -msgstr "" +msgstr "неправильное количество аргументов" #: py/runtime.c msgid "wrong number of values to unpack" -msgstr "" +msgstr "Неправильное количество значений для распаковки" #: extmod/ulab/code/numpy/vector.c msgid "wrong output type" From 7259413be060199222c212f343453089c3b9da18 Mon Sep 17 00:00:00 2001 From: xXx Date: Fri, 1 Sep 2023 01:00:28 +0000 Subject: [PATCH 1614/1712] Translated using Weblate (Russian) Currently translated at 100.0% (1000 of 1000 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ru/ --- locale/ru.po | 1199 ++++++++++++++++++++++++++------------------------ 1 file changed, 616 insertions(+), 583 deletions(-) diff --git a/locale/ru.po b/locale/ru.po index d74f93e70e..957ebf66e2 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2023-09-01 11:54+0000\n" -"Last-Translator: Deleted User \n" +"Last-Translator: xXx \n" "Language-Team: none\n" "Language: ru\n" "MIME-Version: 1.0\n" @@ -1817,7 +1817,7 @@ msgstr "Мощность просела. Убедитесь, что вы обе #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" -msgstr "" +msgstr "Буфер префикса должен находиться в куче" #: main.c msgid "Press any key to enter the REPL. Use CTRL-D to reload.\n" @@ -1827,182 +1827,183 @@ msgstr "" #: main.c msgid "Pretending to deep sleep until alarm, CTRL-C or file write.\n" -msgstr "Притворяюсь глубоко спать до сигнала, CTRL-C или запись в файл.\n" +msgstr "" +"Притворяюсь глубоким сном до сигнала тревоги, CTRL-C или записи файла.\n" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Program does IN without loading ISR" -msgstr "" +msgstr "Программа делает IN без загрузки ISR" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Program does OUT without loading OSR" -msgstr "" +msgstr "Программа делает OUT без загрузки OSR" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" -msgstr "" +msgstr "Недопустимый размер программы" #: ports/espressif/common-hal/espulp/ULP.c msgid "Program too long" -msgstr "" +msgstr "Слишком длинная программа" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." -msgstr "" +msgstr "Вытягивание не используется при выводе направления." #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "RAISE mode is not implemented" -msgstr "" +msgstr "Режим RAISE не реализован" #: ports/raspberrypi/common-hal/countio/Counter.c msgid "RISE_AND_FALL not available on this chip" -msgstr "" +msgstr "RISE_AND_FALL недоступен на этом чипе" #: ports/stm/common-hal/os/__init__.c msgid "RNG DeInit Error" -msgstr "" +msgstr "Ошибка деинициализации генератора случайных чисел" #: ports/stm/common-hal/os/__init__.c msgid "RNG Init Error" -msgstr "" +msgstr "Ошибка инициализации RNG" #: ports/atmel-samd/common-hal/busio/UART.c ports/cxd56/common-hal/busio/UART.c #: ports/nrf/common-hal/busio/UART.c ports/stm/common-hal/busio/UART.c msgid "RS485" -msgstr "" +msgstr "RS485" #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "RS485 inversion specified when not in RS485 mode" -msgstr "" +msgstr "Инверсия RS485 указана, когда она не находится в режиме RS485" #: shared-bindings/alarm/time/TimeAlarm.c shared-bindings/time/__init__.c msgid "RTC is not supported on this board" -msgstr "" +msgstr "RTC не поддерживается на этой плате" #: ports/stm/common-hal/os/__init__.c msgid "Random number generation error" -msgstr "" +msgstr "Ошибка генерации случайных чисел" #: shared-bindings/_bleio/__init__.c #: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c shared-module/bitmaptools/__init__.c #: shared-module/displayio/Bitmap.c msgid "Read-only" -msgstr "" +msgstr "Только для чтения" #: extmod/vfs_fat.c py/moduerrno.c msgid "Read-only filesystem" -msgstr "" +msgstr "Файловая система только для чтения" #: ports/espressif/common-hal/espidf/__init__.c msgid "Received response was invalid" -msgstr "" +msgstr "Полученный ответ недействителен" #: supervisor/shared/bluetooth/bluetooth.c msgid "Reconnecting" -msgstr "" +msgstr "Повторное соединение" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" -msgstr "" +msgstr "Слишком раннее обновление" #: shared-bindings/canio/RemoteTransmissionRequest.c msgid "RemoteTransmissionRequests limited to 8 bytes" -msgstr "" +msgstr "RemoteTransmissionRequests ограничен 8 байтами" #: shared-bindings/aesio/aes.c msgid "Requested AES mode is unsupported" -msgstr "" +msgstr "Запрошенный режим AES не поддерживается" #: ports/espressif/common-hal/espidf/__init__.c msgid "Requested resource not found" -msgstr "" +msgstr "Запрошенный ресурс не найден" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" -msgstr "" +msgstr "Правый канал не поддерживается" #: main.c msgid "Running in safe mode! Not running saved code.\n" -msgstr "" +msgstr "Работает в безопасном режиме! Сохраненный код не выполняется.\n" #: shared-module/sdcardio/SDCard.c msgid "SD card CSD format not supported" -msgstr "" +msgstr "Формат CSD SD-карты не поддерживается" #: ports/cxd56/common-hal/sdioio/SDCard.c msgid "SDCard init" -msgstr "" +msgstr "Инициализация SDCard" #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" -msgstr "" +msgstr "Ошибка SDIO GetCardInfo %d" #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO Init Error %d" -msgstr "" +msgstr "Ошибка инициализации SDIO %d" #: ports/espressif/common-hal/busio/SPI.c msgid "SPI configuration failed" -msgstr "" +msgstr "Сбой конфигурации SPI" #: ports/stm/common-hal/busio/SPI.c msgid "SPI init error" -msgstr "" +msgstr "Ошибка инициализации SPI" #: ports/raspberrypi/common-hal/busio/SPI.c msgid "SPI peripheral in use" -msgstr "" +msgstr "Используемое периферийное устройство SPI" #: ports/stm/common-hal/busio/SPI.c msgid "SPI re-init" -msgstr "" +msgstr "Повторная инициализация SPI" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "Scale dimensions must divide by 3" -msgstr "" +msgstr "Размеры шкалы необходимо разделить на 3" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Scan already in progress. Stop with stop_scan." -msgstr "" +msgstr "Сканирование уже выполняется. Остановитесь на stop_scan." #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Serializer in use" -msgstr "" +msgstr "Используемый сериализатор" #: shared-bindings/ssl/SSLContext.c msgid "Server side context cannot have hostname" -msgstr "" +msgstr "Контекст на стороне сервера не может иметь имя хоста" #: ports/cxd56/common-hal/camera/Camera.c msgid "Size not supported" -msgstr "" +msgstr "Размер не поддерживается" #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "Slice and value different lengths." -msgstr "" +msgstr "Нарежьте и оцените разную длину." #: shared-bindings/displayio/Bitmap.c shared-bindings/displayio/Group.c #: shared-bindings/displayio/TileGrid.c #: shared-bindings/memorymonitor/AllocationSize.c #: shared-bindings/pulseio/PulseIn.c msgid "Slices not supported" -msgstr "" +msgstr "Фрагменты не поддерживаются" #: ports/espressif/common-hal/socketpool/SocketPool.c #: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" -msgstr "" +msgstr "Socket Бассейн можно использовать только с Wifi. радио" #: shared-bindings/aesio/aes.c msgid "Source and destination buffers must be the same length" -msgstr "" +msgstr "Исходный и конечный буферы должны иметь одинаковую длину" #: shared-bindings/paralleldisplay/ParallelBus.c msgid "Specify exactly one of data0 or data_pins" @@ -2010,35 +2011,37 @@ msgstr "Укажите точно один из data0 или data_pins" #: extmod/modure.c msgid "Splitting with sub-captures" -msgstr "" +msgstr "Разделение с помощью субзахватов" #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo left must be on PWM channel A" -msgstr "" +msgstr "Стерео слева должно быть на PWM-канале A" #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Stereo right must be on PWM channel B" -msgstr "" +msgstr "Стерео справа должно быть на PWM-канале B" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Supply one of monotonic_time or epoch_time" -msgstr "" +msgstr "Поставьте один из monotonic_time или epoch_time" #: shared-bindings/gnss/GNSS.c msgid "System entry must be gnss.SatelliteSystem" -msgstr "" +msgstr "Системная запись должна быть gnss. Спутниковая система" #: ports/stm/common-hal/microcontroller/Processor.c msgid "Temperature read timed out" -msgstr "" +msgstr "Истекло время ожидания считывания температуры" #: supervisor/shared/safe_mode.c msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" +"Модуль «микроконтроллер» был использован для загрузки в безопасный режим." #: py/obj.c msgid "The above exception was the direct cause of the following exception:" msgstr "" +"Вышеупомянутое исключение является прямой причиной следующего исключения:" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" @@ -2046,27 +2049,27 @@ msgstr "Длина rgb_pins должна быть 6, 12, 18, 24 или 30" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" -msgstr "" +msgstr "bits_per_sample образца не совпадает с смесителя" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's channel count does not match the mixer's" -msgstr "" +msgstr "Количество каналов образца не совпадает с количеством каналов микшера" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's sample rate does not match the mixer's" -msgstr "" +msgstr "Частота дискретизации образца не совпадает с частотой микшера" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's signedness does not match the mixer's" -msgstr "" +msgstr "Частота дискретизации образца не совпадает с частотой микшера" #: supervisor/shared/safe_mode.c msgid "Third-party firmware fatal error." -msgstr "" +msgstr "Неустранимая ошибка прошивки стороннего производителя." #: shared-module/imagecapture/ParallelImageCapture.c msgid "This microcontroller does not support continuous capture." -msgstr "" +msgstr "Этот микроконтроллер не поддерживает непрерывный захват." #: shared-module/paralleldisplay/ParallelBus.c msgid "" @@ -2078,309 +2081,315 @@ msgstr "" #: shared-bindings/displayio/TileGrid.c msgid "Tile height must exactly divide bitmap height" -msgstr "" +msgstr "Высота фрагмента должна в точности делить высоту растрового изображения" #: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" -msgstr "" +msgstr "Выход индекса плитки за пределы" #: shared-bindings/displayio/TileGrid.c msgid "Tile width must exactly divide bitmap width" -msgstr "" +msgstr "Ширина плитки должна точно делить ширину растрового изображения" #: shared-bindings/alarm/time/TimeAlarm.c msgid "Time is in the past." -msgstr "" +msgstr "Время осталось в прошлом." #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c #, c-format msgid "Timeout is too long: Maximum timeout length is %d seconds" -msgstr "" +msgstr "Таймаут слишком длинный: максимальная длина таймаута %d секунд" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample" -msgstr "" +msgstr "Слишком много каналов в выборке" #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." -msgstr "" +msgstr "Слишком много каналов в выборке" #: shared-module/displayio/__init__.c msgid "Too many display busses; forgot displayio.release_displays() ?" -msgstr "" +msgstr "Слишком много дисплеев; забыли Displayio.release_displays()?" #: shared-module/displayio/__init__.c msgid "Too many displays" -msgstr "" +msgstr "Слишком много дисплеев" #: ports/espressif/common-hal/_bleio/PacketBuffer.c #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Total data to write is larger than %q" -msgstr "" +msgstr "Общий объем записываемых данных превышает %q" #: ports/atmel-samd/common-hal/alarm/touch/TouchAlarm.c #: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c #: ports/stm/common-hal/alarm/touch/TouchAlarm.c msgid "Touch alarms not available" -msgstr "" +msgstr "Сенсорные сигналы тревоги недоступны" #: py/obj.c msgid "Traceback (most recent call last):\n" -msgstr "" +msgstr "Трассировка (последний вызов):\n" #: shared-bindings/time/__init__.c msgid "Tuple or struct_time argument required" -msgstr "" +msgstr "Требуется кортеж или struct_time аргумент" #: ports/stm/common-hal/busio/UART.c msgid "UART de-init" -msgstr "" +msgstr "Деинициализация UART" #: ports/cxd56/common-hal/busio/UART.c ports/espressif/common-hal/busio/UART.c #: ports/stm/common-hal/busio/UART.c msgid "UART init" -msgstr "" +msgstr "Инициализация UART" #: ports/raspberrypi/common-hal/busio/UART.c msgid "UART peripheral in use" -msgstr "" +msgstr "Используемое периферийное устройство UART" #: ports/stm/common-hal/busio/UART.c msgid "UART re-init" -msgstr "" +msgstr "Повторная инициализация UART" #: ports/stm/common-hal/busio/UART.c msgid "UART write" -msgstr "" +msgstr "Запись UART" #: main.c msgid "UID:" -msgstr "" +msgstr "UID:" #: shared-module/usb_hid/Device.c msgid "USB busy" -msgstr "" +msgstr "USB занят" #: supervisor/shared/safe_mode.c msgid "USB devices need more endpoints than are available." -msgstr "" +msgstr "USB-устройствам требуется больше конечных точек, чем доступно." #: supervisor/shared/safe_mode.c msgid "USB devices specify too many interface names." -msgstr "" +msgstr "USB-устройства указывают слишком много имен интерфейсов." #: shared-module/usb_hid/Device.c msgid "USB error" -msgstr "" +msgstr "Ошибка USB" #: shared-bindings/_bleio/UUID.c msgid "UUID integer value must be 0-0xffff" -msgstr "" +msgstr "Целое значение UUID должно быть равно 0-0xffff" #: shared-bindings/_bleio/UUID.c msgid "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" -msgstr "" +msgstr "UUID строка не 'xxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxxxxx \"" #: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" -msgstr "" +msgstr "Значение UUID не является str, int или байтовым буфером" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Unable to allocate buffers for signed conversion" -msgstr "" +msgstr "Не удается выделить буферы для подписанного преобразования" #: supervisor/shared/safe_mode.c msgid "Unable to allocate the heap." -msgstr "" +msgstr "Невозможно выделить кучу." #: ports/espressif/common-hal/analogbufio/BufferedIn.c #, c-format msgid "Unable to configure ADC DMA controller, ErrorCode:%d" -msgstr "" +msgstr "Невозможно настроить контроллер ADC DMA, ErrorCode:%d" #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" -msgstr "" +msgstr "Не удается создать блокировку" #: shared-module/displayio/I2CDisplay.c shared-module/is31fl3741/IS31FL3741.c #, c-format msgid "Unable to find I2C Display at %x" -msgstr "" +msgstr "Не удается найти дисплей I2C в %x" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Unable to find free GCLK" -msgstr "" +msgstr "Не удается найти бесплатный GCLK" #: py/parse.c msgid "Unable to init parser" -msgstr "" +msgstr "Не удается инициировать синтаксический анализатор" #: ports/espressif/common-hal/analogbufio/BufferedIn.c #, c-format msgid "Unable to initialize ADC DMA controller, ErrorCode:%d" -msgstr "" +msgstr "Не удается инициализировать контроллер ADC DMA, ErrorCode:%d" #: shared-module/displayio/OnDiskBitmap.c msgid "Unable to read color palette data" -msgstr "" +msgstr "Не удается прочитать данные цветовой палитры" #: ports/espressif/common-hal/analogbufio/BufferedIn.c #, c-format msgid "Unable to start ADC DMA controller, ErrorCode:%d" -msgstr "" +msgstr "Не удается запустить контроллер ADC DMA, код ошибки:%d" #: ports/espressif/common-hal/mdns/Server.c #: ports/raspberrypi/common-hal/mdns/Server.c msgid "Unable to start mDNS query" -msgstr "" +msgstr "Не удается запустить запрос mDNS" #: shared-bindings/memorymap/AddressRange.c msgid "Unable to write to address." -msgstr "" +msgstr "Невозможно написать на адрес." #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." -msgstr "" +msgstr "Невозможно выполнить запись в nvm." #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." -msgstr "" +msgstr "Не удается написать sleep_memory." #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" -msgstr "" +msgstr "Неожиданный тип nrfx uuid" #: ports/espressif/common-hal/ssl/SSLSocket.c #, c-format msgid "Unhandled ESP TLS error %d %d %x %d" -msgstr "" +msgstr "Необработанная ошибка ESP TLS %d %d %x %d" #: ports/espressif/common-hal/_bleio/__init__.c #, c-format msgid "Unknown BLE error at %s:%d: %d" -msgstr "" +msgstr "Неизвестная ошибка BLE в %s:%d: %d" #: ports/espressif/common-hal/_bleio/__init__.c #, c-format msgid "Unknown BLE error: %d" -msgstr "" +msgstr "Неизвестная ошибка BLE: %d" #: ports/raspberrypi/common-hal/wifi/__init__.c #, c-format msgid "Unknown error code %d" -msgstr "" +msgstr "Неизвестный код ошибки %d" #: shared-bindings/wifi/Radio.c #, c-format msgid "Unknown failure %d" -msgstr "" +msgstr "Неизвестный сбой %d" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Unknown gatt error: 0x%04x" -msgstr "" +msgstr "Неизвестная ошибка gatt: 0x%04x" #: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: supervisor/shared/safe_mode.c msgid "Unknown reason." -msgstr "" +msgstr "Причина неизвестна." #: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Unknown security error: 0x%04x" -msgstr "" +msgstr "Неизвестная ошибка безопасности: 0x%04x" #: ports/espressif/common-hal/_bleio/__init__.c #, c-format msgid "Unknown system firmware error at %s:%d: %d" -msgstr "" +msgstr "Неизвестная системная ошибка прошивки на %s:%d: %d" #: ports/nrf/common-hal/_bleio/__init__.c #, c-format msgid "Unknown system firmware error: %04x" -msgstr "" +msgstr "Неизвестная системная ошибка прошивки: %04x" #: ports/espressif/common-hal/_bleio/__init__.c #, c-format msgid "Unknown system firmware error: %d" -msgstr "" +msgstr "Неизвестная ошибка прошивки системы: %d" #: shared-bindings/adafruit_pixelbuf/PixelBuf.c #: shared-module/_pixelmap/PixelMap.c #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "" +"Непревзойдённое количество элементов на RHS (ожидаемый %d, полученный %d)." #: ports/nrf/common-hal/_bleio/__init__.c msgid "" "Unspecified issue. Can be that the pairing prompt on the other device was " "declined or ignored." msgstr "" +"Неопределенная проблема. Может случиться так, что запрос на сопряжение на " +"другом устройстве был отклонен или проигнорирован." #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" -msgstr "" +msgstr "Неподдерживаемое цветовое пространство" #: shared-module/displayio/display_core.c msgid "Unsupported display bus type" -msgstr "" +msgstr "Неподдерживаемый тип шины дисплея" #: shared-module/audiocore/WaveFile.c msgid "Unsupported format" -msgstr "" +msgstr "Неподдерживаемый формат" #: shared-bindings/hashlib/__init__.c msgid "Unsupported hash algorithm" -msgstr "" +msgstr "Неподдерживаемый алгоритм хеширования" #: ports/espressif/common-hal/dualbank/__init__.c msgid "Update Failed" -msgstr "" +msgstr "Ошибка обновления" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" -msgstr "" +msgstr "Значение length != требуемая фиксированная длина" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length > max_length" -msgstr "" +msgstr "Длина значения > максимальная_длина" #: ports/espressif/common-hal/espidf/__init__.c msgid "Version was invalid" -msgstr "" +msgstr "Версия была недействительной" #: ports/stm/common-hal/microcontroller/Processor.c msgid "Voltage read timed out" -msgstr "" +msgstr "Истекло время ожидания считывания напряжения" #: main.c msgid "WARNING: Your code filename has two extensions\n" -msgstr "" +msgstr "ВНИМАНИЕ: Имя файла кода имеет два расширения\n" #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/nrf/common-hal/watchdog/WatchDogTimer.c #: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" +"WatchDogTimer не может быть деинициализирован после установки режима RESET" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer is not currently running" -msgstr "" +msgstr "WatchDogTimer в настоящее время не запущен" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer.mode cannot be changed once set to WatchDogMode.RESET" msgstr "" +"WatchDogTimer.mode не может быть изменен после установки значения " +"WatchDogMode.RESET" #: py/builtinhelp.c #, c-format @@ -2391,551 +2400,559 @@ msgid "" "\n" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" +"Добро пожаловать в Adafruit CircuitPython %s! Посетите circuitpython.org для " +"получения дополнительной информации. Чтобы получить список встроенных " +"модулей, введите 'help(\"modules\")'.\n" #: supervisor/shared/web_workflow/web_workflow.c msgid "Wi-Fi: " -msgstr "" +msgstr "Wi-Fi: " #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "Wifi is not enabled" -msgstr "" +msgstr "Wifi не включен" #: main.c msgid "Woken up by alarm.\n" -msgstr "" +msgstr "Проснулся по тревоге.\n" #: ports/espressif/common-hal/_bleio/PacketBuffer.c #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Writes not supported on Characteristic" -msgstr "" +msgstr "Запись не поддерживается в Характеристика" #: ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.h #: ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.h #: ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.h #: ports/atmel-samd/boards/meowmeow/mpconfigboard.h msgid "You pressed both buttons at start up." -msgstr "" +msgstr "Вы нажали обе кнопки при запуске." #: ports/espressif/boards/m5stack_core_basic/mpconfigboard.h #: ports/espressif/boards/m5stack_core_fire/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c/mpconfigboard.h #: ports/espressif/boards/m5stack_stick_c_plus/mpconfigboard.h msgid "You pressed button A at start up." -msgstr "" +msgstr "Вы нажали кнопку A при запуске." #: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h msgid "You pressed button DOWN at start up." -msgstr "" +msgstr "Вы нажали кнопку ВНИЗ при запуске." #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" -msgstr "" +msgstr "Вы нажали кнопку BOOT при запуске" #: ports/espressif/boards/adafruit_huzzah32_breakout/mpconfigboard.h msgid "You pressed the GPIO0 button at start up." -msgstr "" +msgstr "Вы нажали кнопку GPIO0 при запуске." #: ports/espressif/boards/espressif_esp32_lyrat/mpconfigboard.h msgid "You pressed the Rec button at start up." -msgstr "" +msgstr "Вы нажали кнопку «Запись» при запуске." #: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h msgid "You pressed the SW38 button at start up." -msgstr "" +msgstr "Вы нажали кнопку SW38 при запуске." #: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h msgid "You pressed the VOLUME button at start up." -msgstr "" +msgstr "Вы нажали кнопку ГРОМКОСТЬ при запуске." #: ports/espressif/boards/m5stack_atom_echo/mpconfigboard.h #: ports/espressif/boards/m5stack_atom_lite/mpconfigboard.h #: ports/espressif/boards/m5stack_atom_matrix/mpconfigboard.h #: ports/espressif/boards/m5stack_atom_u/mpconfigboard.h msgid "You pressed the central button at start up." -msgstr "" +msgstr "Вы нажали центральную кнопку при запуске." #: ports/nrf/boards/aramcon2_badge/mpconfigboard.h msgid "You pressed the left button at start up." -msgstr "" +msgstr "Вы нажали левую кнопку при запуске." #: supervisor/shared/safe_mode.c msgid "You pressed the reset button during boot." -msgstr "" +msgstr "Вы нажали кнопку сброса во время загрузки." #: supervisor/shared/micropython.c msgid "[truncated due to length]" -msgstr "" +msgstr "[отрезается по длине]" #: py/objtype.c msgid "__init__() should return None" -msgstr "" +msgstr "__init__() должен возвращать значение None" #: py/objtype.c msgid "__init__() should return None, not '%q'" -msgstr "" +msgstr "__init__() должен возвращать None, а не '%q'" #: py/objobject.c msgid "__new__ arg must be a user-type" -msgstr "" +msgstr "__new__ arg должен быть пользовательского типа" #: extmod/modubinascii.c extmod/moduhashlib.c py/objarray.c msgid "a bytes-like object is required" -msgstr "" +msgstr "Требуется байтоподобный объект" #: shared-bindings/i2ctarget/I2CTarget.c msgid "addresses is empty" -msgstr "" +msgstr "адреса пусты" #: py/compile.c msgid "annotation must be an identifier" -msgstr "" +msgstr "Аннотация должна быть идентификатором" #: extmod/ulab/code/numpy/create.c msgid "arange: cannot compute length" -msgstr "" +msgstr "arange: не удается вычислить длину" #: py/modbuiltins.c msgid "arg is an empty sequence" -msgstr "" +msgstr "arg — пустая последовательность" #: py/objobject.c msgid "arg must be user-type" -msgstr "" +msgstr "ARG должен быть пользовательского типа" #: extmod/ulab/code/numpy/numerical.c msgid "argsort argument must be an ndarray" -msgstr "" +msgstr "Аргумент argsort должен быть ndarray" #: extmod/ulab/code/numpy/numerical.c msgid "argsort is not implemented for flattened arrays" -msgstr "" +msgstr "argsort не реализован для сведенных массивов" #: py/runtime.c shared-bindings/supervisor/__init__.c msgid "argument has wrong type" -msgstr "" +msgstr "аргумент имеет неправильный тип" #: py/compile.c msgid "argument name reused" -msgstr "" +msgstr "Повторное использование имени аргумента" #: py/argcheck.c shared-bindings/_stage/__init__.c #: shared-bindings/digitalio/DigitalInOut.c msgid "argument num/types mismatch" -msgstr "" +msgstr "Аргумент Несоответствие числа/типов" #: py/runtime.c msgid "argument should be a '%q' not a '%q'" -msgstr "" +msgstr "аргумент должен быть '%q', а не '%q'" #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/numpy/transform.c msgid "arguments must be ndarrays" -msgstr "" +msgstr "Аргументы должны быть ndarrays" #: extmod/ulab/code/ndarray.c msgid "array and index length must be equal" -msgstr "" +msgstr "Длина массива и индекса должна быть равна" #: extmod/ulab/code/numpy/io/io.c msgid "array has too many dimensions" -msgstr "" +msgstr "Массив имеет слишком много измерений" #: extmod/ulab/code/ndarray.c msgid "array is too big" -msgstr "" +msgstr "массив слишком велик" #: py/objarray.c shared-bindings/alarm/SleepMemory.c #: shared-bindings/memorymap/AddressRange.c shared-bindings/nvm/ByteArray.c msgid "array/bytes required on right side" -msgstr "" +msgstr "массив/байты, необходимые справа" #: py/asmxtensa.c msgid "asm overflow" -msgstr "" +msgstr "Переполнение ASM" #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" -msgstr "" +msgstr "Попытка получить (arg)min/(arg)max пустой последовательности" #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" -msgstr "" +msgstr "Попытка получить (arg)min/(arg)max пустой последовательности" #: py/objstr.c msgid "attributes not supported yet" -msgstr "" +msgstr "Атрибуты пока не поддерживаются" #: extmod/ulab/code/ulab_tools.c msgid "axis is out of bounds" -msgstr "" +msgstr "Ось выходит за пределы" #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c msgid "axis must be None, or an integer" -msgstr "" +msgstr "ось должна иметь значение None или целое число" #: extmod/ulab/code/numpy/numerical.c msgid "axis too long" -msgstr "" +msgstr "Слишком длинная ось" #: shared-bindings/bitmaptools/__init__.c msgid "background value out of range of target" -msgstr "" +msgstr "Фоновое значение вне диапазона цели" #: py/builtinevex.c msgid "bad compile mode" -msgstr "" +msgstr "Неверный режим компиляции" #: py/objstr.c msgid "bad conversion specifier" -msgstr "" +msgstr "Неверный спецификатор преобразования" #: py/objstr.c msgid "bad format string" -msgstr "" +msgstr "Строка неверного формата" #: py/binary.c py/objarray.c msgid "bad typecode" -msgstr "" +msgstr "Неверный шрифт" #: py/emitnative.c msgid "binary op %q not implemented" -msgstr "" +msgstr "Двоичный op %q не реализован" #: shared-bindings/bitmaptools/__init__.c msgid "bitmap sizes must match" -msgstr "" +msgstr "Размеры растровых изображений должны совпадать" #: extmod/modurandom.c msgid "bits must be 32 or less" -msgstr "" +msgstr "биты должны быть 32 или менее" #: shared-bindings/audiomixer/Mixer.c msgid "bits_per_sample must be 8 or 16" -msgstr "" +msgstr "bits_per_sample должно быть 8 или 16" #: py/emitinlinethumb.c msgid "branch not in range" -msgstr "" +msgstr "Ветвь не в пределах досягаемости" #: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c msgid "buffer is smaller than requested size" -msgstr "" +msgstr "Размер буфера меньше запрошенного" #: extmod/ulab/code/numpy/create.c extmod/ulab/code/utils/utils.c msgid "buffer size must be a multiple of element size" -msgstr "" +msgstr "Размер буфера должен быть кратен размеру элемента" #: shared-module/struct/__init__.c msgid "buffer size must match format" -msgstr "" +msgstr "Размер буфера должен соответствовать формату" #: shared-bindings/bitbangio/SPI.c shared-bindings/busio/SPI.c msgid "buffer slices must be of equal length" -msgstr "" +msgstr "Буферные фрагменты должны быть одинаковой длины" #: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" -msgstr "" +msgstr "Слишком маленький буфер" #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "buffer too small for requested bytes" -msgstr "" +msgstr "Слишком маленький буфер для запрашиваемых байтов" #: py/emitbc.c msgid "bytecode overflow" -msgstr "" +msgstr "Переполнение байт-кода" #: py/objarray.c msgid "bytes length not a multiple of item size" -msgstr "" +msgstr "длина байтов, не кратная размеру элемента" #: py/objstr.c msgid "bytes value out of range" -msgstr "" +msgstr "Значение байтов вне диапазона" #: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is out of range" -msgstr "" +msgstr "Калибровка выходит за пределы допустимого диапазона" #: ports/atmel-samd/bindings/samd/Clock.c msgid "calibration is read only" -msgstr "" +msgstr "Калибровка доступна только для чтения" #: shared-module/vectorio/Circle.c shared-module/vectorio/Polygon.c #: shared-module/vectorio/Rectangle.c msgid "can only have one parent" -msgstr "" +msgstr "может иметь только одного родителя" #: py/emitinlinethumb.c msgid "can only have up to 4 parameters to Thumb assembly" -msgstr "" +msgstr "может иметь только до 4 параметров для сборки большого пальца" #: py/emitinlinextensa.c msgid "can only have up to 4 parameters to Xtensa assembly" -msgstr "" +msgstr "может иметь только до 4 параметров для сборки Xtensa" #: extmod/ulab/code/ndarray.c msgid "can only specify one unknown dimension" -msgstr "" +msgstr "Можно указать только одно неизвестное измерение" #: py/objtype.c msgid "can't add special method to already-subclassed class" -msgstr "" +msgstr "Не удается добавить специальный метод к уже имеющемуся подклассу классу" #: py/compile.c msgid "can't assign to expression" -msgstr "" +msgstr "Не удается назначить выражение" #: extmod/moduasyncio.c msgid "can't cancel self" -msgstr "" +msgstr "Не могу отменить себя" #: py/objint.c py/runtime.c shared-module/adafruit_pixelbuf/PixelBuf.c msgid "can't convert %q to %q" -msgstr "" +msgstr "Не удается преобразовать %q в %q" #: py/obj.c #, c-format msgid "can't convert %s to complex" -msgstr "" +msgstr "не может преобразовать %s в сложный" #: py/obj.c #, c-format msgid "can't convert %s to float" -msgstr "" +msgstr "Не удается преобразовать %s в float" #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" -msgstr "" +msgstr "не может конвертировать «%q» в% q косвенно" #: extmod/ulab/code/numpy/vector.c msgid "can't convert complex to float" -msgstr "" +msgstr "Не может преобразовать сложный в плавающий" #: py/obj.c msgid "can't convert to complex" -msgstr "" +msgstr "не может быть преобразован в сложный" #: py/obj.c msgid "can't convert to float" -msgstr "" +msgstr "Не удается преобразовать в float" #: py/runtime.c msgid "can't convert to int" -msgstr "" +msgstr "Не удается преобразовать в int" #: py/objstr.c msgid "can't convert to str implicitly" -msgstr "" +msgstr "не может превратиться в полосу неявно" #: py/compile.c msgid "can't declare nonlocal in outer code" -msgstr "" +msgstr "не может объявить нелокальный во внешнем коде" #: py/compile.c msgid "can't delete expression" -msgstr "" +msgstr "Не удается удалить выражение" #: py/emitnative.c msgid "can't do binary op between '%q' and '%q'" -msgstr "" +msgstr "Не могу выполнить двоичную операцию между '%q' и '%q'" #: py/objcomplex.c msgid "can't do truncated division of a complex number" -msgstr "" +msgstr "Не могу сделать усеченное деление комплексного числа" #: py/emitnative.c msgid "can't implicitly convert '%q' to 'bool'" -msgstr "" +msgstr "не может неявно преобразовать '%q' в 'bool'" #: py/emitnative.c msgid "can't load from '%q'" -msgstr "" +msgstr "Не удается загрузить из '%q'" #: py/emitnative.c msgid "can't load with '%q' index" -msgstr "" +msgstr "Не удается загрузить с индексом '%q'" #: py/builtinimport.c msgid "can't perform relative import" -msgstr "" +msgstr "Не удается выполнить относительный импорт" #: py/objgenerator.c msgid "can't send non-None value to a just-started generator" msgstr "" +"не может отправить значение, отличное от None, только что запущенному " +"генератору" #: shared-module/sdcardio/SDCard.c msgid "can't set 512 block size" -msgstr "" +msgstr "Не удается установить размер блока 512" #: py/objexcept.c py/objnamedtuple.c msgid "can't set attribute" -msgstr "" +msgstr "Не удается установить атрибут" #: py/runtime.c shared-bindings/supervisor/Runtime.c msgid "can't set attribute '%q'" -msgstr "" +msgstr "Не удается установить атрибут" #: py/emitnative.c msgid "can't store '%q'" -msgstr "" +msgstr "Не удается сохранить '%q'" #: py/emitnative.c msgid "can't store to '%q'" -msgstr "" +msgstr "Не удается сохранить '%q'" #: py/emitnative.c msgid "can't store with '%q' index" -msgstr "" +msgstr "не может хранить с индексом%q" #: py/objstr.c msgid "" "can't switch from automatic field numbering to manual field specification" msgstr "" +"Не удается переключиться с автоматической нумерации полей на ручную " +"спецификацию полей" #: py/objstr.c msgid "" "can't switch from manual field specification to automatic field numbering" -msgstr "" +msgstr "не может переключаться с ручного поля на автоматическую нумерацию поля" #: extmod/moduasyncio.c msgid "can't wait" -msgstr "" +msgstr "не может ждать" #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" -msgstr "" +msgstr "Не удается назначить новую фигуру" #: extmod/ulab/code/ndarray_operators.c msgid "cannot cast output with casting rule" -msgstr "" +msgstr "Не удается привести выходные данные с помощью правила приведения" #: extmod/ulab/code/ndarray.c msgid "cannot convert complex to dtype" -msgstr "" +msgstr "Не удается преобразовать complex в dtype" #: extmod/ulab/code/ndarray.c msgid "cannot convert complex type" -msgstr "" +msgstr "Не удается преобразовать сложный тип" #: py/objtype.c msgid "cannot create '%q' instances" -msgstr "" +msgstr "Не удается создать экземпляры '%q'" #: py/objtype.c msgid "cannot create instance" -msgstr "" +msgstr "Не удается создать экземпляр" #: extmod/ulab/code/ndarray.c msgid "cannot delete array elements" -msgstr "" +msgstr "Не удается удалить элементы массива" #: py/runtime.c msgid "cannot import name %q" -msgstr "" +msgstr "Не удается импортировать имя %Q" #: extmod/ulab/code/ndarray.c msgid "cannot reshape array" -msgstr "" +msgstr "Не удается изменить форму массива" #: extmod/moductypes.c msgid "cannot unambiguously get sizeof scalar" -msgstr "" +msgstr "не может однозначно получить размер скаляра" #: py/emitnative.c msgid "casting" -msgstr "" +msgstr "кастинг" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "channel re-init" -msgstr "" +msgstr "Реинициализация канала" #: shared-bindings/_stage/Text.c msgid "chars buffer too small" -msgstr "" +msgstr "Слишком маленький буфер символов" #: py/modbuiltins.c msgid "chr() arg not in range(0x110000)" -msgstr "" +msgstr "chr() arg отсутствует в диапазоне(0x110000)" #: py/modbuiltins.c msgid "chr() arg not in range(256)" -msgstr "" +msgstr "chr() arg не в диапазоне(256)" #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" -msgstr "" +msgstr "Точка клипа должна быть кортежом (X,Y)" #: shared-bindings/msgpack/ExtType.c msgid "code outside range 0~127" -msgstr "" +msgstr "код вне диапазона 0~127" #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" -msgstr "" +msgstr "цветовой буфер должен быть 3 байта (RGB) или 4 байта (RGB + байт пэда)" #: shared-bindings/displayio/Palette.c msgid "color buffer must be a buffer, tuple, list, or int" -msgstr "" +msgstr "Цветовой буфер должен быть буфером, кортежом, списком или целым числом" #: shared-bindings/displayio/Palette.c msgid "color buffer must be a bytearray or array of type 'b' or 'B'" msgstr "" +"цветовой буфер должен быть предплечьем или массивом типа \"b\" или \"B\"" #: shared-bindings/displayio/Palette.c msgid "color must be between 0x000000 and 0xffffff" -msgstr "" +msgstr "Цвет должен быть от 0x000000 до 0xffffff" #: py/emitnative.c msgid "comparison of int and uint" -msgstr "" +msgstr "сравнение int и uint" #: py/objfloat.c py/parsenum.c msgid "complex values not supported" -msgstr "" +msgstr "Комплексные значения не поддерживаются" #: extmod/moduzlib.c msgid "compression header" -msgstr "" +msgstr "Заголовок сжатия" #: py/emitnative.c msgid "conversion to object" -msgstr "" +msgstr "Преобразование в объект" #: extmod/ulab/code/numpy/filter.c msgid "convolve arguments must be linear arrays" -msgstr "" +msgstr "Аргументы свертки должны быть линейными массивами" #: extmod/ulab/code/numpy/filter.c msgid "convolve arguments must be ndarrays" -msgstr "" +msgstr "Аргументы свертки должны быть линейными массивами" #: extmod/ulab/code/numpy/filter.c msgid "convolve arguments must not be empty" -msgstr "" +msgstr "Аргументы convolve не должны быть пустыми" #: extmod/ulab/code/numpy/io/io.c msgid "corrupted file" -msgstr "" +msgstr "Поврежденный файл" #: extmod/ulab/code/numpy/poly.c msgid "could not invert Vandermonde matrix" -msgstr "" +msgstr "не удалось инвертировать матрицу Вандермонда" #: shared-module/sdcardio/SDCard.c msgid "couldn't determine SD card version" -msgstr "" +msgstr "Не удалось определить версию SD-карты" #: extmod/ulab/code/numpy/numerical.c msgid "cross is defined for 1D arrays of length 3" -msgstr "" +msgstr "крест определяется для 1D массивов длины 3" #: extmod/ulab/code/scipy/optimize/optimize.c msgid "data must be iterable" -msgstr "" +msgstr "Данные должны быть итерируемыми" #: extmod/ulab/code/scipy/optimize/optimize.c msgid "data must be of equal length" -msgstr "" +msgstr "Данные должны быть одинаковой длины" #: ports/atmel-samd/common-hal/imagecapture/ParallelImageCapture.c #, c-format @@ -2944,986 +2961,1000 @@ msgstr "data-пин #%d уже используется" #: extmod/ulab/code/ndarray.c msgid "data type not understood" -msgstr "" +msgstr "Тип данных не понят" #: py/parsenum.c msgid "decimal numbers not supported" -msgstr "" +msgstr "Десятичные числа не поддерживаются" #: py/compile.c msgid "default 'except' must be last" -msgstr "" +msgstr "по умолчанию \"за исключением\" должно быть последним" #: shared-bindings/msgpack/__init__.c msgid "default is not a function" -msgstr "" +msgstr "По умолчанию не является функцией" #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" msgstr "" +"буфер назначения должен быть байтером или массивом типа \"B\" для " +"бит_глубины = 8" #: shared-bindings/audiobusio/PDMIn.c msgid "destination buffer must be an array of type 'H' for bit_depth = 16" -msgstr "" +msgstr "буфер назначения должен быть массивом типа 'H' для bit_depth = 16" #: py/objdict.c msgid "dict update sequence has wrong length" -msgstr "" +msgstr "последовательность обновления дикта имеет неправильную длину" #: extmod/ulab/code/numpy/numerical.c msgid "diff argument must be an ndarray" -msgstr "" +msgstr "дифф-аргумент, должно быть, ndarray" #: extmod/ulab/code/numpy/numerical.c msgid "differentiation order out of range" -msgstr "" +msgstr "Порядок дифференциации вне диапазона" #: extmod/ulab/code/numpy/transform.c msgid "dimensions do not match" -msgstr "" +msgstr "Размеры не совпадают" #: py/emitnative.c msgid "div/mod not implemented for uint" -msgstr "" +msgstr "div/mod не реализован для uint" #: extmod/ulab/code/numpy/create.c msgid "divide by zero" -msgstr "" +msgstr "Делим на ноль" #: py/runtime.c msgid "division by zero" -msgstr "" +msgstr "Деление на ноль" #: extmod/ulab/code/numpy/vector.c msgid "dtype must be float, or complex" -msgstr "" +msgstr "dtype должен быть поплавком или сложным" #: py/objdeque.c msgid "empty" -msgstr "" +msgstr "пусто" #: extmod/ulab/code/numpy/io/io.c msgid "empty file" -msgstr "" +msgstr "пустой файл" #: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c msgid "empty heap" -msgstr "" +msgstr "пустая куча" #: py/objstr.c msgid "empty separator" -msgstr "" +msgstr "пустой сепаратор" #: shared-bindings/random/__init__.c msgid "empty sequence" -msgstr "" +msgstr "пустая последовательность" #: py/objstr.c msgid "end of format while looking for conversion specifier" -msgstr "" +msgstr "конец формата при поиске спецификатора преобразования" #: shared-bindings/alarm/time/TimeAlarm.c msgid "epoch_time not supported on this board" -msgstr "" +msgstr "epoch_time не поддерживается на этой плате" #: ports/nrf/common-hal/busio/UART.c #, c-format msgid "error = 0x%08lX" -msgstr "" +msgstr "ошибка = 0x%08lX" #: ports/espressif/common-hal/espcamera/Camera.c msgid "" "espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" +"Эспкамера. Камера требует настройки зарезервированной PSRAM. Инструкции см. " +"в документации." #: py/runtime.c msgid "exceptions must derive from BaseException" -msgstr "" +msgstr "исключения должны быть производными от BaseException" #: py/objstr.c msgid "expected ':' after format specifier" -msgstr "" +msgstr "Ожидаемый ':' после спецификатора формата" #: py/obj.c msgid "expected tuple/list" -msgstr "" +msgstr "Ожидаемый кортеж/список" #: py/modthread.c msgid "expecting a dict for keyword args" -msgstr "" +msgstr "Ожидание дикта для args ключевых слов" #: py/compile.c msgid "expecting an assembler instruction" -msgstr "" +msgstr "Ожидание инструкции ассемблера" #: py/compile.c msgid "expecting just a value for set" -msgstr "" +msgstr "ожидание только значения для набора" #: py/compile.c msgid "expecting key:value for dict" -msgstr "" +msgstr "ожидание ключа: значение для дикта" #: shared-bindings/msgpack/__init__.c msgid "ext_hook is not a function" -msgstr "" +msgstr "ext_hook не является функцией" #: py/argcheck.c msgid "extra keyword arguments given" -msgstr "" +msgstr "Приведены дополнительные аргументы ключевых слов" #: py/argcheck.c msgid "extra positional arguments given" -msgstr "" +msgstr "Приведены дополнительные позиционные аргументы" #: shared-bindings/audiocore/WaveFile.c shared-bindings/audiomp3/MP3Decoder.c #: shared-bindings/displayio/OnDiskBitmap.c shared-bindings/gifio/OnDiskGif.c #: shared-bindings/synthio/__init__.c shared-module/gifio/GifWriter.c msgid "file must be a file opened in byte mode" -msgstr "" +msgstr "Файл должен быть файлом, открытым в байтовом режиме" #: shared-bindings/traceback/__init__.c msgid "file write is not available" -msgstr "" +msgstr "Запись файлов недоступна" #: shared-bindings/storage/__init__.c msgid "filesystem must provide mount method" -msgstr "" +msgstr "Файловая система должна предусматривать метод монтирования" #: extmod/ulab/code/numpy/vector.c msgid "first argument must be a callable" -msgstr "" +msgstr "Первый аргумент должен быть вызываемым" #: extmod/ulab/code/scipy/optimize/optimize.c msgid "first argument must be a function" -msgstr "" +msgstr "первый аргумент должен быть функцией" #: extmod/ulab/code/numpy/create.c msgid "first argument must be a tuple of ndarrays" -msgstr "" +msgstr "Первым аргументом должен быть кортеж ндарреев" #: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" -msgstr "" +msgstr "Первым аргументом должен быть Ндаррей" #: py/objtype.c msgid "first argument to super() must be type" -msgstr "" +msgstr "первый аргумент супер() должен быть типом" #: extmod/ulab/code/scipy/linalg/linalg.c msgid "first two arguments must be ndarrays" -msgstr "" +msgstr "первые два аргумента должны быть ndarrays" #: extmod/ulab/code/ndarray.c msgid "flattening order must be either 'C', or 'F'" -msgstr "" +msgstr "порядок сглаживания должен быть либо 'C', либо 'F'" #: extmod/ulab/code/numpy/numerical.c msgid "flip argument must be an ndarray" -msgstr "" +msgstr "Аргумент flip должен быть ndarray" #: py/objint.c msgid "float too big" -msgstr "" +msgstr "Поплавок слишком большой" #: py/nativeglue.c msgid "float unsupported" -msgstr "" +msgstr "Плавающий без поддержки" #: shared-bindings/_stage/Text.c msgid "font must be 2048 bytes long" -msgstr "" +msgstr "Длина шрифта должна составлять 2048 байт" #: py/objstr.c msgid "format requires a dict" -msgstr "" +msgstr "Формат требует диктата" #: py/objdeque.c msgid "full" -msgstr "" +msgstr "полный" #: py/argcheck.c msgid "function doesn't take keyword arguments" -msgstr "" +msgstr "функция не принимает аргументы ключевых слов" #: py/argcheck.c #, c-format msgid "function expected at most %d arguments, got %d" -msgstr "" +msgstr "функция, ожидаемая в большинстве %d аргументов, получила %d" #: py/bc.c py/objnamedtuple.c msgid "function got multiple values for argument '%q'" -msgstr "" +msgstr "функция имеет несколько значений для аргументации%q \"" #: extmod/ulab/code/scipy/optimize/optimize.c msgid "function has the same sign at the ends of interval" -msgstr "" +msgstr "функция имеет один и тот же знак в конце интервала" #: extmod/ulab/code/ndarray.c msgid "function is defined for ndarrays only" -msgstr "" +msgstr "функция определяется только для ndarrays" #: extmod/ulab/code/numpy/carray/carray.c msgid "function is implemented for ndarrays only" -msgstr "" +msgstr "функция реализована только для ndarrays" #: py/argcheck.c #, c-format msgid "function missing %d required positional arguments" -msgstr "" +msgstr "Функция отсутствует %d обязательные позиционные аргументы" #: py/bc.c msgid "function missing keyword-only argument" -msgstr "" +msgstr "функция отсутствует аргумент только по ключевому слову" #: py/bc.c msgid "function missing required keyword argument '%q'" -msgstr "" +msgstr "В функции отсутствует обязательный аргумент ключевого слова '%q'" #: py/bc.c #, c-format msgid "function missing required positional argument #%d" -msgstr "" +msgstr "В функции отсутствует обязательный позиционный аргумент #%d" #: py/argcheck.c py/bc.c py/objnamedtuple.c shared-bindings/time/__init__.c #, c-format msgid "function takes %d positional arguments but %d were given" -msgstr "" +msgstr "функция принимает %d позиционные аргументы, но %d были заданы" #: shared-bindings/time/__init__.c msgid "function takes exactly 9 arguments" -msgstr "" +msgstr "функция принимает ровно 9 аргументов" #: py/objgenerator.c msgid "generator already executing" -msgstr "" +msgstr "генератор уже работает" #: py/objgenerator.c msgid "generator ignored GeneratorExit" -msgstr "" +msgstr "генератор проигнорировал Выход" #: py/objgenerator.c py/runtime.c msgid "generator raised StopIteration" -msgstr "" +msgstr "генератор поднял StopIteration" #: shared-bindings/_stage/Layer.c msgid "graphic must be 2048 bytes long" -msgstr "" +msgstr "Длина рисунка должна составлять 2048 байт" #: extmod/moduhashlib.c msgid "hash is final" -msgstr "" +msgstr "хэш является окончательным" #: extmod/moduheapq.c msgid "heap must be a list" -msgstr "" +msgstr "куча должна быть списком;" #: py/compile.c msgid "identifier redefined as global" -msgstr "" +msgstr "идентификатор переопределен как глобальный" #: py/compile.c msgid "identifier redefined as nonlocal" -msgstr "" +msgstr "идентификатор переопределен как нелокальный" #: py/compile.c msgid "import * not at module level" -msgstr "" +msgstr "Импорт * не на уровне модуля" #: py/persistentcode.c msgid "incompatible .mpy arch" -msgstr "" +msgstr "несовместимые .mpy арка" #: py/persistentcode.c msgid "incompatible .mpy file" -msgstr "" +msgstr "несовместимый файл .mpy" #: py/objstr.c msgid "incomplete format" -msgstr "" +msgstr "Неполный формат" #: py/objstr.c msgid "incomplete format key" -msgstr "" +msgstr "Неполный ключ форматирования" #: extmod/modubinascii.c msgid "incorrect padding" -msgstr "" +msgstr "Неправильная набивка" #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/transform.c msgid "index is out of bounds" -msgstr "" +msgstr "индекс выходит из границ" #: shared-bindings/_pixelmap/PixelMap.c msgid "index must be tuple or int" -msgstr "" +msgstr "Индекс должен быть кортежом или целым кортежом" #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c #: ports/espressif/common-hal/pulseio/PulseIn.c #: shared-bindings/bitmaptools/__init__.c msgid "index out of range" -msgstr "" +msgstr "индекс вне диапазона" #: py/obj.c msgid "indices must be integers" -msgstr "" +msgstr "индексы должны быть целыми числами" #: extmod/ulab/code/ndarray.c msgid "indices must be integers, slices, or Boolean lists" -msgstr "" +msgstr "индексы должны быть целыми числами, срезами или логическими списками" #: ports/espressif/common-hal/busio/I2C.c msgid "init I2C" -msgstr "" +msgstr "инициализация I2C" #: extmod/ulab/code/scipy/optimize/optimize.c msgid "initial values must be iterable" -msgstr "" +msgstr "Начальные значения должны быть итерируемыми" #: shared-bindings/_bleio/Characteristic.c shared-bindings/_bleio/Descriptor.c msgid "initial_value length is wrong" -msgstr "" +msgstr "длина первоначального_значения ошибочна" #: py/compile.c msgid "inline assembler must be a function" -msgstr "" +msgstr "Встроенный ассемблер должен быть функцией" #: extmod/ulab/code/numpy/vector.c msgid "input and output dimensions differ" -msgstr "" +msgstr "Входные и выходные размеры различаются" #: extmod/ulab/code/numpy/vector.c msgid "input and output shapes differ" -msgstr "" +msgstr "Входные и выходные формы различаются" #: extmod/ulab/code/numpy/create.c msgid "input argument must be an integer, a tuple, or a list" -msgstr "" +msgstr "Входной аргумент должен быть целым числом, кортежом или списком" #: extmod/ulab/code/numpy/fft/fft_tools.c msgid "input array length must be power of 2" -msgstr "" +msgstr "Длина входного массива должна быть равна степени 2" #: extmod/ulab/code/numpy/create.c msgid "input arrays are not compatible" -msgstr "" +msgstr "Входные массивы несовместимы" #: extmod/ulab/code/numpy/poly.c msgid "input data must be an iterable" -msgstr "" +msgstr "Входные данные должны быть итерируемыми" #: extmod/ulab/code/numpy/vector.c msgid "input dtype must be float or complex" -msgstr "" +msgstr "Входной тип dtype должен быть плавающим или сложным" #: extmod/ulab/code/numpy/poly.c msgid "input is not iterable" -msgstr "" +msgstr "Ввод не является итерируемым" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "input matrix is asymmetric" -msgstr "" +msgstr "Входная матрица асимметрична" #: extmod/ulab/code/numpy/linalg/linalg.c #: extmod/ulab/code/scipy/linalg/linalg.c msgid "input matrix is singular" -msgstr "" +msgstr "Входная матрица является сингулярной" #: extmod/ulab/code/numpy/create.c msgid "input must be 1- or 2-d" -msgstr "" +msgstr "Вход должен быть 1- или 2-D" #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" -msgstr "" +msgstr "входные данные должны быть 1D ndarray" #: extmod/ulab/code/scipy/linalg/linalg.c extmod/ulab/code/user/user.c msgid "input must be a dense ndarray" -msgstr "" +msgstr "Входные данные должны быть плотным ndarray" #: extmod/ulab/code/user/user.c msgid "input must be an ndarray" -msgstr "" +msgstr "Входные данные должны быть ndarray" #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be an ndarray, or a scalar" msgstr "" +"Входные данные должны быть входными данными, должны быть ndarray или " +"скалярными" #: extmod/ulab/code/scipy/signal/signal.c msgid "input must be one-dimensional" -msgstr "" +msgstr "Входные данные должны быть одномерными" #: extmod/ulab/code/ulab_tools.c msgid "input must be square matrix" -msgstr "" +msgstr "Входные данные должны быть квадратной матрицей" #: extmod/ulab/code/numpy/numerical.c msgid "input must be tuple, list, range, or ndarray" -msgstr "" +msgstr "Входные данные должны быть кортежом, списком, диапазоном или ndarray" #: extmod/ulab/code/numpy/poly.c msgid "input vectors must be of equal length" -msgstr "" +msgstr "Входные векторы должны быть одинаковой длины" #: extmod/ulab/code/numpy/approx.c msgid "interp is defined for 1D iterables of equal length" -msgstr "" +msgstr "interp определен для 1D-итераций одинаковой длины" #: shared-bindings/_bleio/Adapter.c #, c-format msgid "interval must be in range %s-%s" -msgstr "" +msgstr "Интервал должен находиться в диапазоне %S-%S" #: py/compile.c msgid "invalid architecture" -msgstr "" +msgstr "Недопустимая архитектура" #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" -msgstr "" +msgstr "Недопустимые bits_per_pixel %d, должно быть, 1, 2, 4, 8, 16, 24 или 32" #: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "invalid cert" -msgstr "" +msgstr "Неверный сертификат" #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" -msgstr "" +msgstr "Недопустимый размер элемента %d для bits_per_pixel %d\n" #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element_size %d, must be, 1, 2, or 4" -msgstr "" +msgstr "аннулированный элемент_размер %d, должен быть, 1, 2 или 4" #: shared-bindings/traceback/__init__.c msgid "invalid exception" -msgstr "" +msgstr "Недопустимое исключение" #: py/objstr.c msgid "invalid format specifier" -msgstr "" +msgstr "Недопустимый спецификатор формата" #: shared-bindings/wifi/Radio.c msgid "invalid hostname" -msgstr "" +msgstr "Недопустимое имя хоста" #: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "invalid key" -msgstr "" +msgstr "Неверный ключ." #: py/compile.c msgid "invalid micropython decorator" -msgstr "" +msgstr "Недопустимый декоратор MicroPython" #: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" -msgstr "" +msgstr "Недопустимый параметр" #: shared-bindings/random/__init__.c msgid "invalid step" -msgstr "" +msgstr "недействительный шаг" #: py/compile.c py/parse.c msgid "invalid syntax" -msgstr "" +msgstr "недействительный синтаксис" #: py/parsenum.c msgid "invalid syntax for integer" -msgstr "" +msgstr "недействительный синтаксис для целых чисел" #: py/parsenum.c #, c-format msgid "invalid syntax for integer with base %d" -msgstr "" +msgstr "недействительный синтаксис для целых чисел с основанием %d" #: py/parsenum.c msgid "invalid syntax for number" -msgstr "" +msgstr "недействительный синтаксис для номера" #: py/objtype.c msgid "issubclass() arg 1 must be a class" -msgstr "" +msgstr "issubclass() arg 1 должен быть классом" #: py/objtype.c msgid "issubclass() arg 2 must be a class or a tuple of classes" -msgstr "" +msgstr "issubclass() arg 2 должен быть классом или кортежом классов" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "iterations did not converge" -msgstr "" +msgstr "итерации не сходятся" #: py/objstr.c msgid "join expects a list of str/bytes objects consistent with self object" msgstr "" +"присоединяйтесь к ожидающему список стр/байт объектов, совместимых с " +"самообъектом" #: py/argcheck.c msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "" +"аргумент(ы) ключевых слов еще не реализован - вместо этого используйте " +"обычные арги" #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" -msgstr "" +msgstr "Метка '%q' не определена" #: py/compile.c msgid "label redefined" -msgstr "" +msgstr "Метка переопределена" #: py/stream.c msgid "length argument not allowed for this type" -msgstr "" +msgstr "аргумент длины не допускается для этого типа" #: shared-bindings/audiomixer/MixerVoice.c msgid "level must be between 0 and 1" -msgstr "" +msgstr "уровень должен быть между 0 и 1" #: py/objarray.c msgid "lhs and rhs should be compatible" -msgstr "" +msgstr "lhs и rhs должны быть совместимыми" #: py/emitnative.c msgid "local '%q' has type '%q' but source is '%q'" -msgstr "" +msgstr "Локальный '%q' имеет тип '%q', но источник '%q'" #: py/emitnative.c msgid "local '%q' used before type known" -msgstr "" +msgstr "местный '%q' используется перед типом" #: py/vm.c msgid "local variable referenced before assignment" -msgstr "" +msgstr "локальная переменная, на которую ссылается перед присвоением" #: ports/espressif/common-hal/canio/CAN.c msgid "loopback + silent mode not supported by peripheral" msgstr "" +"Замыкание на себя + бесшумный режим, не поддерживаемый периферийными " +"устройствами" #: ports/espressif/common-hal/mdns/Server.c #: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS already initialized" -msgstr "" +msgstr "mDNS уже инициализирован" #: ports/espressif/common-hal/mdns/Server.c #: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" -msgstr "" +msgstr "mDNS работает только со встроенным Wi-Fi" #: py/parse.c msgid "malformed f-string" -msgstr "" +msgstr "Неправильно сформированная F-строка" #: shared-bindings/_stage/Layer.c msgid "map buffer too small" -msgstr "" +msgstr "Слишком маленький буфер карты" #: py/modmath.c shared-bindings/math/__init__.c msgid "math domain error" -msgstr "" +msgstr "Ошибка математической области" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "matrix is not positive definite" -msgstr "" +msgstr "матрица не является положительно определенной" #: ports/espressif/common-hal/_bleio/Descriptor.c #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" -msgstr "" +msgstr "max_длина должна быть 0-%d, когда фиксированная длина %s" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is " -msgstr "" +msgstr "Максимальное количество измерений составляет " #: py/runtime.c msgid "maximum recursion depth exceeded" -msgstr "" +msgstr "Превышена максимальная глубина рекурсии" #: extmod/ulab/code/scipy/optimize/optimize.c msgid "maxiter must be > 0" -msgstr "" +msgstr "maxiter должен быть > 0" #: extmod/ulab/code/scipy/optimize/optimize.c msgid "maxiter should be > 0" -msgstr "" +msgstr "макситер должен быть > 0" #: extmod/ulab/code/numpy/numerical.c msgid "median argument must be an ndarray" -msgstr "" +msgstr "Медианный аргумент должен быть ndarray" #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" -msgstr "" +msgstr "Сбой выделения памяти, выделение %U байт" #: py/runtime.c msgid "memory allocation failed, heap is locked" -msgstr "" +msgstr "Не удалось выделить память, куча заблокирована" #: py/objarray.c msgid "memoryview: length is not a multiple of itemsize" -msgstr "" +msgstr "вид памяти: длина не является множеством элементов" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "mode must be complete, or reduced" -msgstr "" +msgstr "Режим должен быть завершенным или уменьшенным" #: py/builtinimport.c msgid "module not found" -msgstr "" +msgstr "модуль не найден" #: ports/espressif/common-hal/wifi/Monitor.c msgid "monitor init failed" -msgstr "" +msgstr "Сбой инициализации монитора" #: extmod/ulab/code/numpy/poly.c msgid "more degrees of freedom than data points" -msgstr "" +msgstr "Больше степеней свободы, чем точек данных" #: py/compile.c msgid "multiple *x in assignment" -msgstr "" +msgstr "Несколько *x в назначении" #: py/objtype.c msgid "multiple bases have instance lay-out conflict" -msgstr "" +msgstr "Несколько баз имеют конфликт расположения экземпляров" #: py/objtype.c msgid "multiple inheritance not supported" -msgstr "" +msgstr "Множественное наследование не поддерживается" #: py/emitnative.c msgid "must raise an object" -msgstr "" +msgstr "должен поднять объект" #: py/modbuiltins.c msgid "must use keyword argument for key function" -msgstr "" +msgstr "Необходимо использовать аргумент ключевого слова для ключевой функции" #: py/runtime.c msgid "name '%q' is not defined" -msgstr "" +msgstr "Имя '%q' не определено" #: py/runtime.c msgid "name not defined" -msgstr "" +msgstr "Имя не определено" #: py/asmthumb.c msgid "native method too big" -msgstr "" +msgstr "родной метод слишком большой" #: py/emitnative.c msgid "native yield" -msgstr "" +msgstr "родной урожай" #: extmod/ulab/code/ndarray.c msgid "ndarray length overflows" -msgstr "" +msgstr "Длина Ндаррея переливается" #: py/runtime.c #, c-format msgid "need more than %d values to unpack" -msgstr "" +msgstr "Для распаковки требуется более % значений %d" #: py/modmath.c msgid "negative factorial" -msgstr "" +msgstr "отрицательный факториал" #: py/objint_longlong.c py/objint_mpz.c py/runtime.c msgid "negative power with no float support" -msgstr "" +msgstr "Отрицательная мощность без поплавковой опоры" #: py/objint_mpz.c py/runtime.c msgid "negative shift count" -msgstr "" +msgstr "Количество отрицательных сдвигов" #: shared-bindings/_pixelmap/PixelMap.c msgid "nested index must be int" -msgstr "" +msgstr "вложенный индекс должен быть int" #: shared-module/sdcardio/SDCard.c msgid "no SD card" -msgstr "" +msgstr "нет SD-карты" #: py/vm.c msgid "no active exception to reraise" -msgstr "" +msgstr "Нет активного исключения для повторного создания" #: py/compile.c msgid "no binding for nonlocal found" -msgstr "" +msgstr "Привязка для нелокальных не найдена" #: shared-module/msgpack/__init__.c msgid "no default packer" -msgstr "" +msgstr "Нет упаковщика по умолчанию" #: extmod/modurandom.c msgid "no default seed" -msgstr "" +msgstr "Нет начального числа по умолчанию" #: py/builtinimport.c msgid "no module named '%q'" -msgstr "" +msgstr "Нет модуля с именем '%Q'" #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" -msgstr "" +msgstr "нет ответа с SD-карты" #: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" -msgstr "" +msgstr "нет такого атрибута" #: ports/espressif/common-hal/_bleio/Connection.c #: ports/nrf/common-hal/_bleio/Connection.c msgid "non-UUID found in service_uuids_whitelist" -msgstr "" +msgstr "неUUID найден в service_uuids_whitelist" #: py/compile.c msgid "non-default argument follows default argument" msgstr "" +"Аргумент, отличный от аргумента по умолчанию, следует за аргументом по " +"умолчанию" #: extmod/modubinascii.c msgid "non-hex digit found" -msgstr "" +msgstr "Ненайдена шестнадцатеричная цифра" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "non-zero timeout must be > 0.01" -msgstr "" +msgstr "Ненулевое время ожидания должно быть > 0,01" #: shared-bindings/_bleio/Adapter.c msgid "non-zero timeout must be >= interval" -msgstr "" +msgstr "Ненулевое время ожидания должно быть >= интервал" #: shared-bindings/_bleio/UUID.c msgid "not a 128-bit UUID" -msgstr "" +msgstr "не 128-битный UUID" #: py/parse.c msgid "not a constant" -msgstr "" +msgstr "не константа" #: py/objstr.c msgid "not all arguments converted during string formatting" -msgstr "" +msgstr "Не все аргументы преобразуются при форматировании строки" #: py/objstr.c msgid "not enough arguments for format string" -msgstr "" +msgstr "Недостаточно аргументов для строки форматирования" #: extmod/ulab/code/numpy/carray/carray_tools.c msgid "not implemented for complex dtype" -msgstr "" +msgstr "Не реализовано для сложного DTYPE" #: extmod/ulab/code/numpy/bitwise.c msgid "not supported for input types" -msgstr "" +msgstr "Не поддерживается для типов ввода" #: extmod/ulab/code/numpy/create.c msgid "number of points must be at least 2" -msgstr "" +msgstr "Количество баллов должно быть не менее 2" #: py/builtinhelp.c msgid "object " -msgstr "" +msgstr "объект " #: py/obj.c #, c-format msgid "object '%s' isn't a tuple or list" -msgstr "" +msgstr "Объект \"%S\" не является кортежом или списком" #: py/obj.c msgid "object doesn't support item assignment" -msgstr "" +msgstr "Объект не поддерживает назначение элементов" #: py/obj.c msgid "object doesn't support item deletion" -msgstr "" +msgstr "Объект не поддерживает удаление элементов" #: py/obj.c msgid "object has no len" -msgstr "" +msgstr "Объект не имеет объектива" #: py/obj.c msgid "object isn't subscriptable" -msgstr "" +msgstr "Объект не имеет индекса" #: py/runtime.c msgid "object not an iterator" -msgstr "" +msgstr "объект не итератор" #: py/objtype.c py/runtime.c msgid "object not callable" -msgstr "" +msgstr "Объект не вызывается" #: py/sequence.c shared-bindings/displayio/Group.c msgid "object not in sequence" -msgstr "" +msgstr "объект не в последовательности" #: py/runtime.c msgid "object not iterable" -msgstr "" +msgstr "Объект не итерируемый" #: py/obj.c #, c-format msgid "object of type '%s' has no len()" -msgstr "" +msgstr "объект типа «%s» не имеет len()" #: py/obj.c msgid "object with buffer protocol required" -msgstr "" +msgstr "Объект с обязательным буферным протоколом" #: extmod/modubinascii.c msgid "odd-length string" -msgstr "" +msgstr "Строка нечетной длины" #: supervisor/shared/web_workflow/web_workflow.c msgid "off" -msgstr "" +msgstr "выключить" #: extmod/ulab/code/utils/utils.c msgid "offset is too large" -msgstr "" +msgstr "Смещение слишком большое" #: shared-bindings/dualbank/__init__.c msgid "offset must be >= 0" -msgstr "" +msgstr "Смещение должно быть >= 0" #: extmod/ulab/code/numpy/create.c msgid "offset must be non-negative and no greater than buffer length" -msgstr "" +msgstr "Смещение должно быть неотрицательным и не превышать длину буфера" #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" -msgstr "" +msgstr "Смещение за пределы" #: ports/nrf/common-hal/audiobusio/PDMIn.c #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only bit_depth=16 is supported" -msgstr "" +msgstr "поддерживается только bit_depth=16" #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only mono is supported" -msgstr "" +msgstr "Поддерживается только моно" #: extmod/ulab/code/numpy/create.c msgid "only ndarrays can be concatenated" -msgstr "" +msgstr "Только ндарреи могут быть объединены" #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" -msgstr "" +msgstr "поддерживается только oversample=64" #: ports/nrf/common-hal/audiobusio/PDMIn.c #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only sample_rate=16000 is supported" -msgstr "" +msgstr "только образец_рейт=16000 поддерживается" #: py/objarray.c py/objstr.c py/objstrunicode.c py/objtuple.c #: shared-bindings/alarm/SleepMemory.c shared-bindings/memorymap/AddressRange.c #: shared-bindings/nvm/ByteArray.c msgid "only slices with step=1 (aka None) are supported" -msgstr "" +msgstr "поддерживаются только срезы с шагом = 1 (так как нет)" #: py/vm.c msgid "opcode" -msgstr "" +msgstr "код операции" #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/bitwise.c #: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/vector.c msgid "operands could not be broadcast together" -msgstr "" +msgstr "Операнды не могут транслироваться вместе" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "operation is defined for 2D arrays only" -msgstr "" +msgstr "операция определена только для 2D-массивов" #: extmod/ulab/code/numpy/linalg/linalg.c msgid "operation is defined for ndarrays only" -msgstr "" +msgstr "Операция определена только для ndarrays" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" -msgstr "" +msgstr "операция реализована только для 1D логических массивов" #: extmod/ulab/code/numpy/numerical.c msgid "operation is not implemented on ndarrays" -msgstr "" +msgstr "Операция не реализована на ndarrays" #: extmod/ulab/code/ndarray.c msgid "operation is not supported for given type" -msgstr "" +msgstr "Операция не поддерживается для данного типа" #: py/modbuiltins.c msgid "ord expects a character" -msgstr "" +msgstr "Орд ожидает персонажа" #: py/modbuiltins.c #, c-format msgid "ord() expected a character, but string of length %d found" -msgstr "" +msgstr "ord() ожидал символ, но строка длины %d найдена" #: extmod/ulab/code/utils/utils.c msgid "out array is too small" -msgstr "" +msgstr "Наш массив слишком мал" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for complex dtype" -msgstr "" +msgstr "ключевое слово не поддерживается для сложного dtype" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for function" -msgstr "" +msgstr "ключевое слово не поддерживается для функции" #: extmod/ulab/code/utils/utils.c msgid "out must be a float dense array" -msgstr "" +msgstr "Out должен быть плотным массивом с плавающей запятой" #: extmod/ulab/code/numpy/vector.c msgid "out must be an ndarray" -msgstr "" +msgstr "Входные данные должны быть ndarray" #: extmod/ulab/code/numpy/vector.c msgid "out must be of float dtype" -msgstr "" +msgstr "Выход должен быть поплавкового типа" #: shared-bindings/bitmaptools/__init__.c msgid "out of range of target" -msgstr "" +msgstr "вне досягаемости цели" #: py/objint_mpz.c msgid "overflow converting long int to machine word" -msgstr "" +msgstr "переполнение, преобразование длинного int в машинное слово" #: py/modstruct.c #, c-format msgid "pack expected %d items for packing (got %d)" -msgstr "" +msgstr "Упаковка ожидаемых %d товаров для упаковки (получил %d)" #: shared-bindings/_stage/Layer.c shared-bindings/_stage/Text.c msgid "palette must be 32 bytes long" -msgstr "" +msgstr "Длина палитры должна составлять 32 байта" #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" -msgstr "" +msgstr "Параметры должны быть регистрами в последовательности от A2 до A5" #: py/emitinlinethumb.c msgid "parameters must be registers in sequence r0 to r3" -msgstr "" +msgstr "Параметры должны быть регистрами в последовательности от R0 до R3" #: shared-bindings/bitmaptools/__init__.c msgid "pixel coordinates out of bounds" -msgstr "" +msgstr "пиксельные координаты за пределами границ" #: extmod/vfs_posix_file.c msgid "poll on file not available on win32" -msgstr "" +msgstr "Опрос в файле недоступен в Win32" #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" -msgstr "" +msgstr "поп из пустого PulseIn" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c @@ -3932,64 +3963,64 @@ msgstr "" #: ports/stm/common-hal/pulseio/PulseIn.c py/objdict.c py/objlist.c py/objset.c #: shared-bindings/ps2io/Ps2.c msgid "pop from empty %q" -msgstr "" +msgstr "Всплывающее окно из пустого %q" #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "port must be >= 0" -msgstr "" +msgstr "порт должен быть >= 0" #: py/compile.c msgid "positional arg after **" -msgstr "" +msgstr "позиционный arg после **" #: py/compile.c msgid "positional arg after keyword arg" -msgstr "" +msgstr "позиционный arg после ключевого слова arg" #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" -msgstr "" +msgstr "3-й аргумент pow() не может быть равен 0" #: py/objint_mpz.c msgid "pow() with 3 arguments requires integers" -msgstr "" +msgstr "pow() с 3 аргументами требует целых чисел" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "pull masks conflict with direction masks" -msgstr "" +msgstr "Маски вытягивания конфликтуют с масками направления" #: extmod/modutimeq.c msgid "queue overflow" -msgstr "" +msgstr "Переполнение очереди" #: py/parse.c msgid "raw f-strings are not supported" -msgstr "" +msgstr "Необработанные F-строки не поддерживаются" #: extmod/ulab/code/numpy/fft/fft_tools.c msgid "real and imaginary parts must be of equal length" -msgstr "" +msgstr "реальные и воображаемые части должны быть одинаковой длины" #: py/builtinimport.c msgid "relative import" -msgstr "" +msgstr "Относительный импорт" #: py/obj.c #, c-format msgid "requested length %d but object has length %d" -msgstr "" +msgstr "запрашиваемая длина %d, но объект имеет длину %d" #: extmod/ulab/code/ndarray_operators.c msgid "results cannot be cast to specified type" -msgstr "" +msgstr "Результаты не могут быть приведены к указанному типу" #: py/compile.c msgid "return annotation must be an identifier" -msgstr "" +msgstr "Возвращаемая аннотация должна быть идентификатором" #: py/emitnative.c msgid "return expected '%q' but got '%q'" -msgstr "" +msgstr "Возврат ожидался '%q', но получил '%q'" #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format @@ -4003,144 +4034,144 @@ msgstr "rgb_pins[%d] не находится на том же порту, что #: extmod/ulab/code/numpy/numerical.c msgid "roll argument must be an ndarray" -msgstr "" +msgstr "Аргумент roll должен быть массивом ND" #: py/objstr.c msgid "rsplit(None,n)" -msgstr "" +msgstr "rsplit(Нет;n)" #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c #: ports/raspberrypi/common-hal/audiobusio/PDMIn.c msgid "sampling rate out of range" -msgstr "" +msgstr "Частота дискретизации выходит за пределы допустимого диапазона" #: py/modmicropython.c msgid "schedule queue full" -msgstr "" +msgstr "Расписание Очередь заполнена" #: py/builtinimport.c msgid "script compilation not supported" -msgstr "" +msgstr "Компиляция скриптов не поддерживается" #: py/nativeglue.c msgid "set unsupported" -msgstr "" +msgstr "Установить не поддерживается" #: extmod/ulab/code/ndarray.c msgid "shape must be integer or tuple of integers" -msgstr "" +msgstr "фигура должна быть целым числом или кортежом целых чисел" #: shared-module/msgpack/__init__.c msgid "short read" -msgstr "" +msgstr "короткое чтение" #: py/objstr.c msgid "sign not allowed in string format specifier" -msgstr "" +msgstr "Знак не разрешен в спецификаторе строкового формата" #: py/objstr.c msgid "sign not allowed with integer format specifier 'c'" -msgstr "" +msgstr "Знак не разрешен со спецификатором целочисленного формата 'c'" #: extmod/ulab/code/ulab_tools.c msgid "size is defined for ndarrays only" -msgstr "" +msgstr "Размер определяется только для массивов ND" #: shared-bindings/time/__init__.c msgid "sleep length must be non-negative" -msgstr "" +msgstr "Продолжительность сна должна быть неотрицательной" #: extmod/ulab/code/ndarray.c msgid "slice step can't be zero" -msgstr "" +msgstr "Шаг среза не может быть равен нулю" #: py/nativeglue.c msgid "slice unsupported" -msgstr "" +msgstr "Фрагмент не поддерживается" #: py/objint.c py/sequence.c msgid "small int overflow" -msgstr "" +msgstr "Маленькое переполнение int" #: main.c msgid "soft reboot\n" -msgstr "" +msgstr "Мягкая перезагрузка\n" #: extmod/ulab/code/numpy/numerical.c msgid "sort argument must be an ndarray" -msgstr "" +msgstr "Аргумент sort должен быть массивом ND" #: extmod/ulab/code/scipy/signal/signal.c msgid "sos array must be of shape (n_section, 6)" -msgstr "" +msgstr "Массив SOS должен иметь форму (n_section, 6)" #: extmod/ulab/code/scipy/signal/signal.c msgid "sos[:, 3] should be all ones" -msgstr "" +msgstr "sos[:, 3] должны быть все единицы" #: extmod/ulab/code/scipy/signal/signal.c msgid "sosfilt requires iterable arguments" -msgstr "" +msgstr "Sosfilt требует итерируемых аргументов" #: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" -msgstr "" +msgstr "Исходная палитра слишком велика" #: shared-bindings/bitmaptools/__init__.c msgid "source_bitmap must have value_count of 2 or 65536" -msgstr "" +msgstr "source_bitmap должен иметь значение_счет 2 или 65536" #: shared-bindings/bitmaptools/__init__.c msgid "source_bitmap must have value_count of 65536" -msgstr "" +msgstr "source_bitmap должен иметь значение_счет 65536" #: shared-bindings/bitmaptools/__init__.c msgid "source_bitmap must have value_count of 8" -msgstr "" +msgstr "source_bitmap должен иметь значение_счет 8" #: py/objstr.c msgid "start/end indices" -msgstr "" +msgstr "Начальные/конечные индексы" #: shared-bindings/random/__init__.c msgid "stop not reachable from start" -msgstr "" +msgstr "Остановка недоступна с начального запуска" #: py/stream.c shared-bindings/getpass/__init__.c msgid "stream operation not supported" -msgstr "" +msgstr "Потоковая операция не поддерживается" #: py/stream.c msgid "string not supported; use bytes or bytearray" -msgstr "" +msgstr "строка не поддерживается; Использование байтов или массива байтов" #: extmod/moductypes.c msgid "struct: can't index" -msgstr "" +msgstr "struct: не может индексировать" #: extmod/moductypes.c msgid "struct: index out of range" -msgstr "" +msgstr "struct: индекс вне диапазона" #: extmod/moductypes.c msgid "struct: no fields" -msgstr "" +msgstr "Структура: Нет полей" #: py/objarray.c py/objstr.c msgid "substring not found" -msgstr "" +msgstr "Подстрока не найдена" #: py/compile.c msgid "super() can't find self" -msgstr "" +msgstr "super() не может найти себя" #: extmod/modujson.c msgid "syntax error in JSON" -msgstr "" +msgstr "синтаксис ошибка в JSON" #: extmod/moductypes.c msgid "syntax error in uctypes descriptor" -msgstr "" +msgstr "Синтаксическая ошибка в дескрипторе UCTYPES" #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/espressif/common-hal/watchdog/WatchDogTimer.c @@ -4148,246 +4179,248 @@ msgstr "" #: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" +"Продолжительность тайм-аута превысила максимальное поддерживаемое значение" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "timeout must be < 655.35 secs" -msgstr "" +msgstr "тайм-аут должен быть < 655.35 сек" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" -msgstr "" +msgstr "Тайм-аут в ожидании карты V1" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v2 card" -msgstr "" +msgstr "Тайм-аут ожидания карты V2" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "timer re-init" -msgstr "" +msgstr "Повторное инициализация таймера" #: shared-bindings/time/__init__.c msgid "timestamp out of range for platform time_t" msgstr "" +"Временная метка выходит за пределы допустимого диапазона для платформы time_t" #: extmod/ulab/code/ndarray.c msgid "tobytes can be invoked for dense arrays only" -msgstr "" +msgstr "Тобайты могут быть вызваны только для плотных массивов" #: py/compile.c msgid "too many args" -msgstr "" +msgstr "Слишком много ARG" #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" -msgstr "" +msgstr "Слишком много измерений" #: extmod/ulab/code/ndarray.c msgid "too many indices" -msgstr "" +msgstr "Слишком много индексов" #: py/asmthumb.c msgid "too many locals for native method" -msgstr "" +msgstr "Слишком много местных жителей для нативного метода" #: py/runtime.c #, c-format msgid "too many values to unpack (expected %d)" -msgstr "" +msgstr "Слишком много значений для распаковки (ожидаемый %d)" #: extmod/ulab/code/numpy/approx.c msgid "trapz is defined for 1D arrays of equal length" -msgstr "" +msgstr "trapz определяется для 1D-массивов одинаковой длины" #: extmod/ulab/code/numpy/approx.c msgid "trapz is defined for 1D iterables" -msgstr "" +msgstr "trapz определен для 1D-итераций" #: py/obj.c msgid "tuple/list has wrong length" -msgstr "" +msgstr "Кортеж/список имеет неправильную длину" #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_driver_install returned esp-idf error #%d" -msgstr "" +msgstr "twai_driver_install вернул ошибку esp-idf #%d" #: ports/espressif/common-hal/canio/CAN.c #, c-format msgid "twai_start returned esp-idf error #%d" -msgstr "" +msgstr "twai_start вернул ошибку esp-idf #%d" #: shared-bindings/busio/UART.c shared-bindings/canio/CAN.c msgid "tx and rx cannot both be None" -msgstr "" +msgstr "tx и rx не могут быть одновременно None" #: py/objtype.c msgid "type '%q' is not an acceptable base type" -msgstr "" +msgstr "Тип '%Q' не является допустимым базовым типом" #: py/objtype.c msgid "type is not an acceptable base type" -msgstr "" +msgstr "Тип не является приемлемым базовым типом" #: py/runtime.c msgid "type object '%q' has no attribute '%q'" -msgstr "" +msgstr "тип объекта '%q' не имеет атрибута '%q \"" #: py/objtype.c msgid "type takes 1 or 3 arguments" -msgstr "" +msgstr "тип занимает 1 или 3 аргумента" #: py/objint_longlong.c msgid "ulonglong too large" -msgstr "" +msgstr "ulonglong слишком большой" #: py/emitnative.c msgid "unary op %q not implemented" -msgstr "" +msgstr "Двоичный op %q не реализован" #: py/parse.c msgid "unexpected indent" -msgstr "" +msgstr "Неожиданный отступ" #: py/bc.c msgid "unexpected keyword argument" -msgstr "" +msgstr "Неожиданный аргумент ключевого слова" #: py/bc.c py/objnamedtuple.c shared-bindings/traceback/__init__.c msgid "unexpected keyword argument '%q'" -msgstr "" +msgstr "неожиданный аргумент ключевого слова '%q'" #: py/lexer.c msgid "unicode name escapes" -msgstr "" +msgstr "Экранирование имен в Юникоде" #: py/parse.c msgid "unindent doesn't match any outer indent level" -msgstr "" +msgstr "Отступ не совпадает ни с одним уровнем внешнего отступа" #: py/objstr.c #, c-format msgid "unknown conversion specifier %c" -msgstr "" +msgstr "Неизвестный спецификатор преобразования %C" #: py/objstr.c msgid "unknown format code '%c' for object of type '%q'" -msgstr "" +msgstr "Неизвестный код формата '%c' для объекта типа '%q'" #: py/compile.c msgid "unknown type" -msgstr "" +msgstr "Неизвестный тип" #: py/compile.c msgid "unknown type '%q'" -msgstr "" +msgstr "Неизвестный тип '%q'" #: py/objstr.c #, c-format msgid "unmatched '%c' in format" -msgstr "" +msgstr "Несовпадающий '%c' в формате" #: py/objtype.c py/runtime.c msgid "unreadable attribute" -msgstr "" +msgstr "Нечитаемый атрибут" #: shared-bindings/displayio/TileGrid.c shared-bindings/vectorio/VectorShape.c msgid "unsupported %q type" -msgstr "" +msgstr "Неподдерживаемый тип %Q" #: py/emitinlinethumb.c #, c-format msgid "unsupported Thumb instruction '%s' with %d arguments" -msgstr "" +msgstr "неподдерживаемая инструкция Thumb '%s' с аргументами %d" #: py/emitinlinextensa.c #, c-format msgid "unsupported Xtensa instruction '%s' with %d arguments" -msgstr "" +msgstr "неподдерживаемая инструкция Xtensa '%s' с аргументами %d" #: shared-module/gifio/GifWriter.c msgid "unsupported colorspace for GifWriter" -msgstr "" +msgstr "неподдерживаемое цветовое пространство для GifWriter" #: shared-bindings/bitmaptools/__init__.c msgid "unsupported colorspace for dither" -msgstr "" +msgstr "Неподдерживаемое цветовое пространство для дизеринга" #: py/objstr.c #, c-format msgid "unsupported format character '%c' (0x%x) at index %d" -msgstr "" +msgstr "Неподдерживаемый символ формата '%c' (0x%x) при индексе %d" #: py/runtime.c msgid "unsupported type for %q: '%q'" -msgstr "" +msgstr "Неподдерживаемый тип для %q: '%q'" #: py/runtime.c msgid "unsupported type for operator" -msgstr "" +msgstr "Неподдерживаемый тип для оператора" #: py/runtime.c msgid "unsupported types for %q: '%q', '%q'" -msgstr "" +msgstr "Неподдерживаемые типы для %q: '%q', '%q'" #: extmod/ulab/code/numpy/io/io.c msgid "usecols is too high" -msgstr "" +msgstr "Usecols слишком высок" #: extmod/ulab/code/numpy/io/io.c msgid "usecols keyword must be specified" -msgstr "" +msgstr "Ключевое слово usecols должно быть указано" #: py/objint.c #, c-format msgid "value must fit in %d byte(s)" -msgstr "" +msgstr "Значение должно совпадать с байтами %d" #: shared-bindings/bitmaptools/__init__.c msgid "value out of range of target" -msgstr "" +msgstr "Величина, выходящая за пределы диапазона цели" #: ports/espressif/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" -msgstr "" +msgstr "Сторожевой таймер не инициализирован" #: shared-bindings/is31fl3741/FrameBuffer.c msgid "width must be greater than zero" -msgstr "" +msgstr "ширина должна быть больше нуля" #: ports/espressif/common-hal/wifi/Radio.c #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "wifi is not enabled" -msgstr "" +msgstr "Wi-Fi не включен" #: ports/raspberrypi/common-hal/wifi/Monitor.c msgid "wifi.Monitor not available" -msgstr "" +msgstr "Wi-Fi. Монитор недоступен" #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" -msgstr "" +msgstr "окно должно быть" #: extmod/ulab/code/numpy/numerical.c msgid "wrong axis index" -msgstr "" +msgstr "Неправильный индекс оси" #: extmod/ulab/code/numpy/create.c msgid "wrong axis specified" -msgstr "" +msgstr "Указана неправильная ось" #: extmod/ulab/code/numpy/io/io.c msgid "wrong dtype" -msgstr "" +msgstr "Неправильный тип" #: extmod/ulab/code/numpy/transform.c msgid "wrong index type" -msgstr "" +msgstr "Неправильный тип индекса" #: extmod/ulab/code/numpy/compare.c extmod/ulab/code/numpy/create.c #: extmod/ulab/code/numpy/io/io.c extmod/ulab/code/numpy/transform.c #: extmod/ulab/code/numpy/vector.c msgid "wrong input type" -msgstr "" +msgstr "Неправильный тип ввода" #: extmod/ulab/code/numpy/transform.c msgid "wrong length of condition array" From ab59e366137eadde54a6739786c8e93c46c7935d Mon Sep 17 00:00:00 2001 From: Bob Abeles Date: Fri, 1 Sep 2023 08:34:53 -0700 Subject: [PATCH 1615/1712] Correct problems found by CI --- ports/nrf/common-hal/memorymap/AddressRange.c | 6 +++--- py/objint.c | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ports/nrf/common-hal/memorymap/AddressRange.c b/ports/nrf/common-hal/memorymap/AddressRange.c index 11986f2cf5..b829cbb253 100644 --- a/ports/nrf/common-hal/memorymap/AddressRange.c +++ b/ports/nrf/common-hal/memorymap/AddressRange.c @@ -90,13 +90,13 @@ void common_hal_memorymap_addressrange_construct(memorymap_addressrange_obj_t *s self->len = length; } -uint32_t common_hal_memorymap_addressrange_get_length(const memorymap_addressrange_obj_t *self) { +size_t common_hal_memorymap_addressrange_get_length(const memorymap_addressrange_obj_t *self) { return self->len; } void common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_obj_t *self, - uint32_t start_index, uint8_t *values, uint32_t len) { + size_t start_index, uint8_t *values, size_t len) { uint8_t *address = self->start_address + start_index; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-align" @@ -115,7 +115,7 @@ void common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_ob } void common_hal_memorymap_addressrange_get_bytes(const memorymap_addressrange_obj_t *self, - uint32_t start_index, uint32_t len, uint8_t *values) { + size_t start_index, size_t len, uint8_t *values) { uint8_t *address = self->start_address + start_index; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wcast-align" diff --git a/py/objint.c b/py/objint.c index 83987d690a..7cc6376733 100644 --- a/py/objint.c +++ b/py/objint.c @@ -438,6 +438,11 @@ mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) { return MP_OBJ_SMALL_INT_VALUE(self_in); } +mp_uint_t mp_obj_int_get_uint_checked(mp_const_obj_t self_in) { + return MP_OBJ_SMALL_INT_VALUE(self_in); +} + + #endif // MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE // This dispatcher function is expected to be independent of the implementation of long int From 84aadf3a6492e40c1ade2a3f6783be5d3383011e Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 9 Aug 2023 09:33:20 -0500 Subject: [PATCH 1616/1712] Update TFT experiment for rev b --- .../mpconfigboard.h | 12 +++---- .../pins.c | 34 +++++++++---------- 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.h b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.h index e93af63614..2762cd4208 100644 --- a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.h @@ -29,20 +29,16 @@ #define MICROPY_HW_BOARD_NAME "Adafruit-ESP32-S3-RGB-TFT-Experiment" #define MICROPY_HW_MCU_NAME "ESP32S3" -#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) -#define DEFAULT_I2C_BUS_SCL (&pin_GPIO6) - -#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO7) -#define DEFAULT_SPI_BUS_SCK (&pin_GPIO6) -#define DEFAULT_SPI_BUS_MISO (&pin_GPIO16) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO18) // UART pins attached to the USB-serial converter chip #define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO43) #define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO44) -#define MICROPY_HW_NEOPIXEL (&pin_GPIO4) +#define MICROPY_HW_NEOPIXEL (&pin_GPIO4) // also DBLTAP -#define DOUBLE_TAP_PIN (&pin_GPIO5) +#define DOUBLE_TAP_PIN (&pin_GPIO4) // also NEOPIXEL // a 1024x768 16BPP framebuffer + some breathing room #define DEFAULT_RESERVED_PSRAM (1024 * 1024 * 2) diff --git a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/pins.c b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/pins.c index 6b1e17f766..4bd25d26cb 100644 --- a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/pins.c +++ b/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/pins.c @@ -5,11 +5,11 @@ STATIC const mp_rom_obj_tuple_t tft_r_pins = { {&mp_type_tuple}, 5, { - MP_ROM_PTR(&pin_GPIO13), - MP_ROM_PTR(&pin_GPIO12), MP_ROM_PTR(&pin_GPIO11), MP_ROM_PTR(&pin_GPIO10), + MP_ROM_PTR(&pin_GPIO9), MP_ROM_PTR(&pin_GPIO46), + MP_ROM_PTR(&pin_GPIO3), } }; @@ -17,12 +17,12 @@ STATIC const mp_rom_obj_tuple_t tft_g_pins = { {&mp_type_tuple}, 6, { - MP_ROM_PTR(&pin_GPIO5), // XXX fixed in rev b - MP_ROM_PTR(&pin_GPIO45), MP_ROM_PTR(&pin_GPIO48), MP_ROM_PTR(&pin_GPIO47), MP_ROM_PTR(&pin_GPIO21), MP_ROM_PTR(&pin_GPIO14), + MP_ROM_PTR(&pin_GPIO13), + MP_ROM_PTR(&pin_GPIO12), } }; @@ -30,11 +30,11 @@ STATIC const mp_rom_obj_tuple_t tft_b_pins = { {&mp_type_tuple}, 5, { - MP_ROM_PTR(&pin_GPIO5), // XXX fixed in rev b - MP_ROM_PTR(&pin_GPIO5), // XXX fixed in rev b MP_ROM_PTR(&pin_GPIO40), MP_ROM_PTR(&pin_GPIO39), MP_ROM_PTR(&pin_GPIO38), + MP_ROM_PTR(&pin_GPIO0), + MP_ROM_PTR(&pin_GPIO45), } }; @@ -59,22 +59,20 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(DEFAULT_I2C_BUS_SDA) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(DEFAULT_I2C_BUS_SDA) }, { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(DEFAULT_I2C_BUS_SCL) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(DEFAULT_SPI_BUS_MOSI) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(DEFAULT_SPI_BUS_MISO) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(DEFAULT_SPI_BUS_SCK) }, - { MP_ROM_QSTR(MP_QSTR_LCD_CS), MP_ROM_PTR(&pin_GPIO16) }, - - // boot mode button can be used in SW as well - { MP_ROM_QSTR(MP_QSTR_BUTTON_UP), MP_ROM_PTR(&pin_GPIO0) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON_DOWN), MP_ROM_PTR(&pin_GPIO5) }, - - { MP_ROM_QSTR(MP_QSTR_TP_IRQ), MP_ROM_PTR(&pin_GPIO9) }, + // I/O expander pin numbers + { MP_ROM_QSTR(MP_QSTR_TFT_SCK), MP_ROM_INT(0) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_INT(1) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_INT(2) }, + { MP_ROM_QSTR(MP_QSTR_TP_IRQ), MP_ROM_INT(3) }, + { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_INT(4) }, + { MP_ROM_QSTR(MP_QSTR_BTN_UP), MP_ROM_INT(5) }, + { MP_ROM_QSTR(MP_QSTR_BTN_DN), MP_ROM_INT(6) }, + { MP_ROM_QSTR(MP_QSTR_TFT_MOSI), MP_ROM_INT(7) }, { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_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_module_globals_table); From 1648a3db1efae2554f61d8c472bca6fe581000a5 Mon Sep 17 00:00:00 2001 From: Bob Abeles Date: Fri, 1 Sep 2023 11:23:30 -0700 Subject: [PATCH 1617/1712] Fix IO register stores of multiple words --- .../raspberrypi/common-hal/memorymap/AddressRange.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ports/raspberrypi/common-hal/memorymap/AddressRange.c b/ports/raspberrypi/common-hal/memorymap/AddressRange.c index 3eac27fa63..6f6731a5ec 100644 --- a/ports/raspberrypi/common-hal/memorymap/AddressRange.c +++ b/ports/raspberrypi/common-hal/memorymap/AddressRange.c @@ -94,9 +94,9 @@ void common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_ob } else { // Aligned access and length, use 32-bit writes uint32_t *dest_addr32 = (uint32_t *)dest_addr; - size_t len32 = len >> 2; - for (size_t i = 0; i < len32; i++) { - *dest_addr32++ = ((uint32_t *)values)[i << 2]; + size_t access_count = len >> 2; + for (size_t i = 0; i < access_count; i++) { + *dest_addr32++ = ((uint32_t *)values)[i]; } } break; @@ -124,10 +124,10 @@ void common_hal_memorymap_addressrange_get_bytes(const memorymap_addressrange_ob // Unaligned access or unaligned length not supported by RP2 for IO registers mp_raise_RuntimeError(translate("Unable to access unaliged IO register")); } else { - // Aligned access and length, use 32-bit writes + // Aligned access and length, use 32-bit reads uint32_t *src_addr32 = (uint32_t *)src_addr; - size_t len32 = len >> 2; - for (size_t i = 0; i < len32; i++) { + size_t access_count = len >> 2; + for (size_t i = 0; i < access_count; i++) { ((uint32_t *)values)[i] = *src_addr32++; } } From 5eb18d3a7a4b268331b62cfb72d3f5f9a230ed84 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Fri, 1 Sep 2023 14:35:14 -0700 Subject: [PATCH 1618/1712] Merge conflict resolved --- tools/ci_check_duplicate_usb_vid_pid.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index 5232f6dc7c..f22225007b 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -64,6 +64,7 @@ DEFAULT_CLUSTERLIST = { "0x239A:0x102E": ["weact_studio_pico", "weact_studio_pico_16mb"], "0x303A:0x8166": ["yd_esp32_s3_n8r8", "yd_esp32_s3_n16r8"], "0x2341:0x056B": ["arduino_nano_esp32s3", "arduino_nano_esp32s3_inverted_statusled"], + "0x2E8A:0x1020": ["waveshare_rp2040_plus_4mb", "waveshare_rp2040_plus_16mb"], } cli_parser = argparse.ArgumentParser( From 7fe6cf5ed6469d6aa528551d59eb994f68fb0e2e Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Fri, 1 Sep 2023 15:03:08 -0700 Subject: [PATCH 1619/1712] Set D13 to input with Pulldown --- ports/espressif/boards/arduino_nano_esp32s3/board.c | 5 +++-- .../boards/arduino_nano_esp32s3_inverted_statusled/board.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ports/espressif/boards/arduino_nano_esp32s3/board.c b/ports/espressif/boards/arduino_nano_esp32s3/board.c index 0fc5bd1426..8952a19c5d 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3/board.c +++ b/ports/espressif/boards/arduino_nano_esp32s3/board.c @@ -39,8 +39,9 @@ void board_init(void) { bool espressif_board_reset_pin_number(gpio_num_t pin_number) { if (pin_number == 13) { - // Set D13 LED to output by default. - gpio_set_direction(pin_number, GPIO_MODE_DEF_OUTPUT); + // Set D13 LED to input when not in use + gpio_set_direction(pin_number, GPIO_MODE_DEF_INPUT); + gpio_set_pull_mode(pin_number, GPIO_PULLDOWN_ONLY); return true; } diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c index 0fc5bd1426..8952a19c5d 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c @@ -39,8 +39,9 @@ void board_init(void) { bool espressif_board_reset_pin_number(gpio_num_t pin_number) { if (pin_number == 13) { - // Set D13 LED to output by default. - gpio_set_direction(pin_number, GPIO_MODE_DEF_OUTPUT); + // Set D13 LED to input when not in use + gpio_set_direction(pin_number, GPIO_MODE_DEF_INPUT); + gpio_set_pull_mode(pin_number, GPIO_PULLDOWN_ONLY); return true; } From b8c6fce6f28489cf23edbfae6257d83c3c0c3ef1 Mon Sep 17 00:00:00 2001 From: xXx Date: Fri, 1 Sep 2023 14:16:15 +0000 Subject: [PATCH 1620/1712] Translated using Weblate (Russian) Currently translated at 100.0% (1000 of 1000 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ru/ --- locale/ru.po | 451 ++++++++++++++++++++++++++------------------------- 1 file changed, 229 insertions(+), 222 deletions(-) diff --git a/locale/ru.po b/locale/ru.po index 957ebf66e2..5fd796a4c3 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-09-01 11:54+0000\n" +"PO-Revision-Date: 2023-09-03 02:59+0000\n" "Last-Translator: xXx \n" "Language-Team: none\n" "Language: ru\n" @@ -41,7 +41,7 @@ msgid "" "issues." msgstr "" "\n" -"Пожалуйста, подайте вопрос с вашей программой на github.com/adafruit/" +"Пожалуйста подайте вопрос с вашей программой на github.com/adafruit/" "circuitpython/issues." #: supervisor/shared/safe_mode.c @@ -50,8 +50,7 @@ msgid "" "Press reset to exit safe mode.\n" msgstr "" "\n" -"Нажмите на сброс, чтобы выйти из безопасного режима.\n" -".\n" +"Нажмите на сброс чтобы выйти из безопасного режима.\n" #: supervisor/shared/safe_mode.c msgid "" @@ -59,7 +58,7 @@ msgid "" "You are in safe mode because:\n" msgstr "" "\n" -"Вы в безопасном режиме, потому что:\n" +"Вы в безопасном режиме потому что:\n" #: py/obj.c msgid " File \"%q\"" @@ -101,7 +100,8 @@ msgstr "" msgid "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" msgstr "" -"%d адресных пинов, %d rgb пинов и %d тайлов указывают высоту %d а не %d" +"Адресные контакты %d, контакты rgb %d и плитки %d обозначают высоту %d, а не " +"%d" #: ports/atmel-samd/common-hal/alarm/__init__.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c @@ -121,7 +121,7 @@ msgstr "%q" #: shared-bindings/microcontroller/Pin.c msgid "%q and %q contain duplicate pins" -msgstr "%q и %q содержат пины-дупликаты" +msgstr "%q и %q содержат пины дупликаты" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "%q and %q must be different" @@ -129,7 +129,7 @@ msgstr "%q и %q должны быть разными" #: shared-bindings/microcontroller/Pin.c msgid "%q contains duplicate pins" -msgstr "%q содержит пины-дупликаты" +msgstr "%q содержит пины дупликаты" #: ports/atmel-samd/common-hal/sdioio/SDCard.c msgid "%q failure: %d" @@ -200,7 +200,7 @@ msgstr "%q должно быть %d-%d" #: shared-bindings/displayio/Display.c msgid "%q must be 1 when %q is True" -msgstr "%q должно быть 1 когда %q is True" +msgstr "%q должен быть равен 1, если %q имеет значение True" #: py/argcheck.c shared-bindings/gifio/GifWriter.c #: shared-module/gifio/OnDiskGif.c @@ -213,11 +213,11 @@ msgstr "%q должно быть >= %d" #: shared-bindings/analogbufio/BufferedIn.c msgid "%q must be a bytearray or array of type 'H' or 'B'" -msgstr "%q должно быть bytearray или array типа 'H' или 'B'" +msgstr "%q должен быть массивом байтов или массивом типа «H» или «B»" #: shared-bindings/audiocore/RawSample.c msgid "%q must be a bytearray or array of type 'h', 'H', 'b', or 'B'" -msgstr "%q должно быть bytearray или array типа 'h', 'H', 'b', или 'B'" +msgstr "%q должен быть массивом байтов или массивом типа «h», «H», «b» или «B»" #: ports/espressif/common-hal/analogbufio/BufferedIn.c msgid "%q must be array of type 'H'" @@ -272,11 +272,11 @@ msgstr "%q=%q" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts in more bits than pin count" -msgstr "%q [%u] смещается в большем количестве, чем количество пинов" +msgstr "%q [%u] смещается в большем количестве чем количество пинов" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] shifts out more bits than pin count" -msgstr "%q[%u] смещает больше битов, чем количество выводов" +msgstr "%q[%u] смещает больше битов чем количество выводов" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "%q[%u] uses extra pin" @@ -390,51 +390,52 @@ msgstr "'S' и 'O' не являются поддерживаемыми типа #: py/compile.c msgid "'align' requires 1 argument" -msgstr "'align' требует 1 аргумент" +msgstr "«выравнивание» требует 1 аргумента" #: py/compile.c msgid "'await' outside function" -msgstr "'await' вне функции" +msgstr "«ожидание» внешняя функция" #: py/compile.c msgid "'await', 'async for' or 'async with' outside async function" -msgstr "'await', 'async for' или 'async with' вне асинхронной функции" +msgstr "" +"«ожидание», «асинхронность для» или «асинхронность с» вне асинхронной функции" #: py/compile.c msgid "'break' outside loop" -msgstr "'break' вне цикла" +msgstr "«разорвать» внешний цикл" #: py/compile.c msgid "'continue' outside loop" -msgstr "'continue' вне цикла" +msgstr "«продолжить» вне цикла" #: py/compile.c msgid "'data' requires at least 2 arguments" -msgstr "'data' требует как минимум 2 аргумента" +msgstr "«данные» требуют как минимум 2 аргумента" #: py/compile.c msgid "'data' requires integer arguments" -msgstr "'data' требует целочисленные аргументы" +msgstr "«данные» требуют целочисленных аргументов" #: py/compile.c msgid "'label' requires 1 argument" -msgstr "'label' требует 1 аргумент" +msgstr "«метка» требует 1 аргумент" #: py/compile.c msgid "'return' outside function" -msgstr "'return' вне функции" +msgstr "«возврат» внешняя функция" #: py/compile.c msgid "'yield from' inside async function" -msgstr "'yield from' внутри асинхронной функции" +msgstr "«выход из» внутри асинхронной функции" #: py/compile.c msgid "'yield' outside function" -msgstr "'yield' вне функции" +msgstr "внешняя функция \"выход\"" #: py/compile.c msgid "* arg after **" -msgstr "* arg после **" +msgstr "* аргумент после **" #: py/compile.c msgid "*x must be assignment target" @@ -450,7 +451,7 @@ msgstr "0.0 в комплексную степень" #: py/modbuiltins.c msgid "3-arg pow() not supported" -msgstr "3-аргументный pow() не поддерживается" +msgstr "Pow() с 3 аргументами не поддерживается" #: ports/atmel-samd/common-hal/alarm/pin/PinAlarm.c #: ports/atmel-samd/common-hal/countio/Counter.c @@ -556,7 +557,7 @@ msgstr "Все таймеры уже используются" #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Already advertising." -msgstr "Уже объявляемся (advertising)." +msgstr "Уже реклама." #: ports/atmel-samd/common-hal/canio/Listener.c msgid "Already have all-matches listener" @@ -581,7 +582,7 @@ msgstr "Произошла ошибка при получении '%s':\n" #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c msgid "Another PWMAudioOut is already active" -msgstr "Другой PWMAudioOut уже активен" +msgstr "Другой аудиовыход PWM уже активен" #: ports/atmel-samd/common-hal/pulseio/PulseOut.c #: ports/cxd56/common-hal/pulseio/PulseOut.c @@ -628,8 +629,7 @@ msgstr "" #: ports/espressif/common-hal/canio/CAN.c msgid "Baudrate not supported by peripheral" -msgstr "" -"Скорость обмена данными (Baudrate) не поддерживается периферийным устройством" +msgstr "Скорость передачи данных не поддерживается периферийным устройством" #: shared-module/displayio/Display.c #: shared-module/framebufferio/FramebufferDisplay.c @@ -653,7 +653,8 @@ msgstr "Битовая глубина должна быть кратна 8." #: shared-bindings/bitmaptools/__init__.c msgid "Bitmap size and bits per value must match" -msgstr "Размер bitmap и количество бит-на-значение должны совпадать" +msgstr "" +"Размер растрового изображения и число битов на значение должны совпадать" #: supervisor/shared/safe_mode.c msgid "Boot device must be first (interface #0)." @@ -661,7 +662,7 @@ msgstr "Загрузочное устройство должно быть пер #: ports/mimxrt10xx/common-hal/busio/UART.c msgid "Both RX and TX required for flow control" -msgstr "Для управления потоком требуется как RX, так и TX" +msgstr "Для управления потоком требуется как RX так и TX" #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "Both pins must support hardware interrupts" @@ -683,7 +684,7 @@ msgstr "Элементы буфера должны иметь длину не б #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Buffer is not a bytearray." -msgstr "Буфер не является байтовым массивом (bytearray)." +msgstr "Буфер не является байтовым массивом." #: ports/stm/common-hal/audiopwmio/PWMAudioOut.c #, c-format @@ -720,7 +721,7 @@ msgstr "Буферы должны быть одинакового размера #: ports/raspberrypi/common-hal/paralleldisplay/ParallelBus.c #, c-format msgid "Bus pin %d is already in use" -msgstr "Пин шины %d уже используется" +msgstr "Вывод шины %d уже используется" #: shared-bindings/_bleio/UUID.c msgid "Byte buffer must be 16 bytes." @@ -732,7 +733,7 @@ msgstr "Блоки CBC должны быть кратны 16 байтам" #: supervisor/shared/safe_mode.c msgid "CIRCUITPY drive could not be found or created." -msgstr "Не удалось найти или создать диск CIRCUITPY." +msgstr "Диск CIRCUTPY не удалось найти или создать." #: ports/espressif/common-hal/espidf/__init__.c msgid "CRC or checksum was invalid" @@ -740,7 +741,7 @@ msgstr "CRC или контрольная сумма неправильная" #: py/objtype.c msgid "Call super().__init__() before accessing native object." -msgstr "Вызовите super().__init__() перед обращением к родному объекту." +msgstr "Вызовите super().__init__() перед доступом к собственному объекту." #: ports/cxd56/common-hal/camera/Camera.c msgid "Camera init" @@ -748,29 +749,27 @@ msgstr "Иницализация камеры" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on RTC IO from deep sleep." -msgstr "Сигнал из глубокого сна может подаваться только на пине RTC IO." +msgstr "Возможен только сигнал тревоги по RTC IO из глубокого сна." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on one low pin while others alarm high from deep sleep." msgstr "" -"Сигнал из глубокого сна может подаваться по низкому уровню только на одном " -"пане, пока остальные подают сигнал по высокому уровню." +"Может сигнализировать только по одному низкому контакту в то время как " +"другие сигнализируют о высоком уровне после глубокого сна." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on two low pins from deep sleep." -msgstr "" -"Сигнал из глубокого сна может подаваться только на двух пинах по низкому " -"уровню." +msgstr "Из глубокого сна может сигнализировать только по двум низким контактам." #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "Can't set CCCD on local Characteristic" -msgstr "Невозможно установить CCCD на локальную Characteristic" +msgstr "Невозможно установить CCCD для локальной характеристики" #: shared-bindings/storage/__init__.c shared-bindings/usb_cdc/__init__.c #: shared-bindings/usb_hid/__init__.c shared-bindings/usb_midi/__init__.c msgid "Cannot change USB devices now" -msgstr "Сейчас невозможно изменить USB-устройства" +msgstr "Невозможно изменить USB устройство сейчас" #: shared-bindings/_bleio/Adapter.c msgid "Cannot create a new Adapter; use _bleio.adapter;" @@ -787,7 +786,7 @@ msgstr "Невозможно удалить значения" #: ports/nrf/common-hal/digitalio/DigitalInOut.c #: ports/raspberrypi/common-hal/digitalio/DigitalInOut.c msgid "Cannot get pull while in output mode" -msgstr "Невозможно установить подтяжку в режиме output" +msgstr "Невозможно получить pull в режиме вывода" #: ports/nrf/common-hal/microcontroller/Processor.c msgid "Cannot get temperature" @@ -796,13 +795,12 @@ msgstr "Невозможно получить температуру" #: shared-bindings/_bleio/Adapter.c msgid "Cannot have scan responses for extended, connectable advertisements." msgstr "" -"Невозможно иметь ответы сканирования для расширенных, подключаемых " -"объявлений (advertisements)." +"Не может быть ответов на сканирование для расширенных подключаемых рекламных " +"объявлений." #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot pull on input-only pin." -msgstr "" -"Невозможно установить подтяжку на пине, предназначенном только для ввода." +msgstr "Невозможно вытащить контакт только для ввода." #: shared-bindings/audiobusio/PDMIn.c msgid "Cannot record to a file" @@ -824,7 +822,7 @@ msgstr "Невозможно установить параметры сокет #: shared-bindings/digitalio/DigitalInOut.c msgid "Cannot set value when direction is input." -msgstr "Невозможно установить значение в режиме input." +msgstr "Невозможно установить значение при вводе направления." #: ports/espressif/common-hal/busio/UART.c #: ports/mimxrt10xx/common-hal/busio/UART.c @@ -833,11 +831,11 @@ msgstr "Невозможно указать RTS или CTS в режиме RS485 #: py/objslice.c msgid "Cannot subclass slice" -msgstr "Срез субкласса невозможен" +msgstr "Невозможно создать подкласс среза" #: shared-bindings/pwmio/PWMOut.c msgid "Cannot vary frequency on a timer that is already in use" -msgstr "Невозможно изменить частоту на таймере, который уже используется" +msgstr "Невозможно изменить частоту на таймере который уже используется" #: ports/nrf/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge, only level" @@ -845,15 +843,15 @@ msgstr "Невозможно проснуться по изменению лог #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." -msgstr "Невозможно проснуться по спаду/росту на пине. Только по уровню." +msgstr "Невозможно проснуться по спаду росту на пине. Только по уровню." #: shared-bindings/_bleio/CharacteristicBuffer.c msgid "CharacteristicBuffer writing not provided" -msgstr "Запись в CharacteristicBuffer не предусмотрена" +msgstr "ХарактеристикаЗапись в буфер не предусмотрена" #: supervisor/shared/safe_mode.c msgid "CircuitPython core code crashed hard. Whoops!\n" -msgstr "Код ядра CircuitPython сильно крашнулся. Упс!\n" +msgstr "Основной код CircuitPython сильно разбился. Упс!\n" #: shared-module/bitbangio/I2C.c msgid "Clock stretch too long" @@ -889,7 +887,7 @@ msgstr "Не удалось задать адрес" #: shared-bindings/pwmio/PWMOut.c msgid "Could not start PWM" -msgstr "Не удалось запустить ШИМ" +msgstr "Не удалось запустить PWM" #: ports/stm/common-hal/busio/UART.c msgid "Could not start interrupt, RX busy" @@ -901,15 +899,15 @@ msgstr "Не удалось выделить место для декодера" #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Channel Init Error" -msgstr "Ошибка инициализации канала ЦАП" +msgstr "Ошибка инициализации канала DAC" #: ports/stm/common-hal/analogio/AnalogOut.c msgid "DAC Device Init Error" -msgstr "Ошибка инициализации устройства ЦАП" +msgstr "Ошибка инициализации устройства DAC" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "DAC already in use" -msgstr "ЦАП уже используется" +msgstr "DAC уже используется" #: ports/atmel-samd/common-hal/paralleldisplay/ParallelBus.c #: ports/nrf/common-hal/paralleldisplay/ParallelBus.c @@ -938,7 +936,7 @@ msgstr "" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." -msgstr "Емкость destination меньше, чем destination_length." +msgstr "Емкость места назначения меньше чем Destination_length." #: ports/nrf/common-hal/audiobusio/I2SOut.c msgid "Device in use" @@ -947,7 +945,7 @@ msgstr "Устройство используется" #: shared-bindings/displayio/Display.c #: shared-bindings/framebufferio/FramebufferDisplay.c msgid "Display must have a 16 bit colorspace." -msgstr "Дисплей должен иметь 16-битное цветовое пространство." +msgstr "Дисплей должен иметь 16 битное цветовое пространство." #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c @@ -961,7 +959,7 @@ msgstr "Выполнено" #: shared-bindings/digitalio/DigitalInOut.c msgid "Drive mode not used when direction is input." -msgstr "Drive mode не используется, когда направление является входным." +msgstr "Режим движения не используется при вводе направления." #: py/obj.c msgid "During handling of the above exception, another exception occurred:" @@ -986,7 +984,7 @@ msgstr "Канал EXTINT уже используется" #: extmod/modure.c msgid "Error in regex" -msgstr "Ошибка в регулярном выражении(regex)" +msgstr "Ошибка в регулярном выражении" #: supervisor/shared/safe_mode.c msgid "Error in safemode.py." @@ -1007,15 +1005,15 @@ msgstr "Расширенные объявления с ответом скани #: extmod/ulab/code/numpy/fft/fft_tools.c msgid "FFT is defined for ndarrays only" -msgstr "БПФ определено только для ndarrays" +msgstr "FFT определено только для массивов nd" #: extmod/ulab/code/numpy/fft/fft_tools.c msgid "FFT is implemented for linear arrays only" -msgstr "БПФ реализовано только для линейных массивов" +msgstr "FFT реализовано только для линейных массивов" #: ports/espressif/common-hal/ssl/SSLSocket.c msgid "Failed SSL handshake" -msgstr "Не удался SSL handshake" +msgstr "Не удалось установить соединение SSL" #: shared-bindings/ps2io/Ps2.c msgid "Failed sending command." @@ -1049,7 +1047,7 @@ msgstr "Не удалось подключиться: внутренняя ош #: ports/nrf/common-hal/_bleio/Adapter.c msgid "Failed to connect: timeout" -msgstr "Не удалось подключиться: тайм-аут" +msgstr "Не удалось подключиться: таймаут" #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" @@ -1093,12 +1091,14 @@ msgstr "Прошивка слишком большая" #: shared-bindings/bitmaptools/__init__.c msgid "For L8 colorspace, input bitmap must have 8 bits per pixel" msgstr "" -"Для цветового пространства L8 входной bitmap должен иметь 8 бит на пиксель" +"Для цветового пространства L8 входное растровое изображение должно иметь 8 " +"бит на пиксель" #: shared-bindings/bitmaptools/__init__.c msgid "For RGB colorspaces, input bitmap must have 16 bits per pixel" msgstr "" -"Для цветового пространства RGB входной bitmap должен иметь 16 бит на пиксель" +"Для цветовых пространств RGB входное растровое изображение должно иметь 16 " +"бит на пиксель" #: ports/cxd56/common-hal/camera/Camera.c msgid "Format not supported" @@ -1114,8 +1114,8 @@ msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" -"Частота должна соответствовать существующему PWMOut, использующему этот " -"таймер" +"Частота должна соответствовать существующему PWMOut с использованием этого " +"таймера" #: shared-bindings/bitbangio/I2C.c shared-bindings/bitbangio/SPI.c #: shared-bindings/busio/I2C.c shared-bindings/busio/SPI.c @@ -1195,12 +1195,14 @@ msgstr "Неверный размер программы инициализац #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Initial set pin direction conflicts with initial out pin direction" msgstr "" -"Начальное направление пина set конфликтует с начальным направлением пина out" +"Исходное установленное направление штифта конфликтует с исходным " +"направлением вывода" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Initial set pin state conflicts with initial out pin state" msgstr "" -"Начальное состояние пина set конфликтует с начальным состоянием пина out" +"Исходное установленное состояние контакта конфликтует с исходным состоянием " +"выхода" #: ports/espressif/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" @@ -1209,7 +1211,7 @@ msgstr "Инициализация не удалась из-за нехватк #: shared-bindings/bitops/__init__.c #, c-format msgid "Input buffer length (%d) must be a multiple of the strand count (%d)" -msgstr "Длина входного буфера (%d) должна быть кратна количеству strand (%d)" +msgstr "Длина входного буфера (%d) должна быть кратна количеству цепочек (%d)" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -1274,7 +1276,7 @@ msgstr "Недопустимый пин %q" #: ports/stm/common-hal/analogio/AnalogIn.c msgid "Invalid ADC Unit value" -msgstr "Недопустимое значение единицы АЦП" +msgstr "Недопустимое значение единицы ADC" #: ports/espressif/common-hal/_bleio/__init__.c #: ports/nrf/common-hal/_bleio/__init__.c @@ -1325,7 +1327,7 @@ msgstr "Неверный шестнадцатеричный пароль" #: ports/espressif/common-hal/wifi/Radio.c msgid "Invalid multicast MAC address" -msgstr "Неверный MAC-адрес multicast" +msgstr "Неверный MAC-адрес многоадресной рассылки" #: ports/espressif/common-hal/espidf/__init__.c msgid "Invalid size" @@ -1366,7 +1368,7 @@ msgstr "Слой уже в группе (Group)" #: shared-module/displayio/Group.c msgid "Layer must be a Group or TileGrid subclass" -msgstr "Слой должен быть группой (Group) или субклассом TileGrid." +msgstr "Слой должен быть группой (Group) или субклассом TileGrid" #: ports/espressif/common-hal/espidf/__init__.c msgid "MAC address was invalid" @@ -1387,11 +1389,11 @@ msgstr "Размер данных различается" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Mismatched swap flag" -msgstr "Несоответствие флага swap" +msgstr "Несоответствующий флаг подкачки" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] reads pin(s)" -msgstr "Пропущенный первый_in_pin.%q [%u] читает пин (s)" +msgstr "Отсутствует first_in_pin. %q[%u] читает выводы" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_in_pin. %q[%u] shifts in from pin(s)" @@ -1407,7 +1409,7 @@ msgstr "Отсутствует first_out_pin. %q[%u] переключается #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_out_pin. %q[%u] writes pin(s)" -msgstr "Отсутствует first_out_pin. %q[%u] записывает pin(s)" +msgstr "Отсутствует first_out_pin. %q[%u] записывает выводы" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Missing first_set_pin. %q[%u] sets pin(s)" @@ -1432,7 +1434,7 @@ msgstr "Количество используемых rgb-пинов должн #: supervisor/shared/safe_mode.c msgid "NLR jump failed. Likely memory corruption." -msgstr "Не удалось выполнить NLR jump. Вероятно, повреждение памяти." +msgstr "Прыжок NLR не удался. Вероятно повреждение памяти." #: ports/espressif/common-hal/nvm/ByteArray.c msgid "NVS Error" @@ -1448,7 +1450,9 @@ msgstr "Имя слишком длинное" #: shared-bindings/displayio/TileGrid.c msgid "New bitmap must be same size as old bitmap" -msgstr "Новый bitmap должен быть того же размера что и старый" +msgstr "" +"Новое растровое изображение должно быть того же размера, что и старое " +"растровое изображение" #: ports/espressif/common-hal/_bleio/__init__.c msgid "Nimble out of memory" @@ -1469,12 +1473,12 @@ msgstr "Нет пина %q" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c msgid "No CCCD for this Characteristic" -msgstr "Нет CCCD для этой Characteristic" +msgstr "Для этой характеристики нет CCCD" #: ports/atmel-samd/common-hal/analogio/AnalogOut.c #: ports/stm/common-hal/analogio/AnalogOut.c msgid "No DAC on chip" -msgstr "ЦАП отсутствует на чипе" +msgstr "DAC отсутствует на чипе" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -1526,7 +1530,7 @@ msgstr "Отсутствует аппаратный генератор случ #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in in program" -msgstr "Нет in в программе" +msgstr "Нет в программе" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "No in or out in program" @@ -1549,8 +1553,7 @@ msgstr "В программе отсутствует вывод" #: ports/mimxrt10xx/common-hal/busio/I2C.c ports/nrf/common-hal/busio/I2C.c #: ports/raspberrypi/common-hal/busio/I2C.c msgid "No pull up found on SDA or SCL; check your wiring" -msgstr "" -"Подтяжка на выводах SDA или SCL не обнаружена; проверь схему подключения" +msgstr "На SDA или SCL не обнаружено подтягивания; проверь свою проводку" #: shared-module/touchio/TouchIn.c msgid "No pulldown on pin; 1Mohm recommended" @@ -1652,7 +1655,7 @@ msgstr "На этом аппаратном обеспечении доступн #: shared-bindings/ipaddress/__init__.c msgid "Only int or string supported for ip" -msgstr "Только int или строка поддерживается для ip" +msgstr "Для IP поддерживаются только int или строка" #: shared-module/displayio/OnDiskBitmap.c #, c-format @@ -1665,7 +1668,7 @@ msgstr "" #: ports/espressif/common-hal/alarm/touch/TouchAlarm.c msgid "Only one %q can be set in deep sleep." -msgstr "Только один %q может быть погружен в глубокий сон." +msgstr "Только один %q может быть переведен в режим глубокого сна." #: ports/espressif/common-hal/espulp/ULPAlarm.c msgid "Only one %q can be set." @@ -1680,7 +1683,7 @@ msgstr "Разрешен только один адрес" #: ports/nrf/common-hal/alarm/time/TimeAlarm.c #: ports/stm/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set" -msgstr "Можно установить только один сигнал тревоги.время" +msgstr "Можно установить только один будильник" #: ports/espressif/common-hal/alarm/time/TimeAlarm.c #: ports/raspberrypi/common-hal/alarm/time/TimeAlarm.c @@ -1718,7 +1721,7 @@ msgstr "Вне розеток" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Out-buffer elements must be <= 4 bytes long" -msgstr "Элементы буфера должны быть длиной <= 4 байта" +msgstr "Элементы вне буфера должны иметь длину <= 4 байта" #: shared-bindings/audiobusio/PDMIn.c msgid "Oversample must be multiple of 8." @@ -1728,7 +1731,7 @@ msgstr "Передискретизация должна быть кратна 8. msgid "" "PWM frequency not writable when variable_frequency is False on construction." msgstr "" -"Частота ШИМ не записывается, если variable_frequency имеет значение False " +"Частота PWM не записывается, если variable_frequency имеет значение False " "при построении." #: ports/stm/common-hal/pwmio/PWMOut.c @@ -1783,9 +1786,8 @@ msgid "" "bytes. If this cannot be avoided, pass allow_inefficient=True to the " "constructor" msgstr "" -"Pinout использует %d байт на элемент, что потребляет больше, чем идеальные " -"%d байт. Если этого нельзя избежать, передайте allow_inefficient=True в " -"конструктор" +"Распиновка использует %d байт на элемент, что превышает идеальное %d байт. " +"Если этого нельзя избежать, передайте конструктору allow_inefficient=True" #: ports/raspberrypi/common-hal/imagecapture/ParallelImageCapture.c msgid "Pins must be sequential" @@ -1797,7 +1799,7 @@ msgstr "Пины должны быть последовательными выв #: ports/raspberrypi/common-hal/audiopwmio/PWMAudioOut.c msgid "Pins must share PWM slice" -msgstr "Пины должны иметь общий срез ШИМ" +msgstr "Пины должны иметь общий срез PWM" #: shared-module/usb/core/Device.c msgid "Pipe error" @@ -1809,7 +1811,7 @@ msgstr "Плюс любые модули в файловой системе\n" #: shared-module/vectorio/Polygon.c msgid "Polygon needs at least 3 points" -msgstr "Полигон нуждается не менее 3 пунктов" +msgstr "Полигону необходимо как минимум 3 точки" #: supervisor/shared/safe_mode.c msgid "Power dipped. Make sure you are providing enough power." @@ -1832,11 +1834,11 @@ msgstr "" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Program does IN without loading ISR" -msgstr "Программа делает IN без загрузки ISR" +msgstr "Программа выполняет IN без загрузки ISR" #: ports/raspberrypi/common-hal/rp2pio/StateMachine.c msgid "Program does OUT without loading OSR" -msgstr "Программа делает OUT без загрузки OSR" +msgstr "Программа выполняет ВЫХОД без загрузки OSR" #: ports/raspberrypi/bindings/rp2pio/StateMachine.c msgid "Program size invalid" @@ -1848,7 +1850,7 @@ msgstr "Слишком длинная программа" #: shared-bindings/digitalio/DigitalInOut.c msgid "Pull not used when direction is output." -msgstr "Вытягивание не используется при выводе направления." +msgstr "Тяга не используется, когда выводится направление." #: ports/atmel-samd/common-hal/watchdog/WatchDogTimer.c #: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c @@ -1910,7 +1912,7 @@ msgstr "Слишком раннее обновление" #: shared-bindings/canio/RemoteTransmissionRequest.c msgid "RemoteTransmissionRequests limited to 8 bytes" -msgstr "RemoteTransmissionRequests ограничен 8 байтами" +msgstr "Запросы на удаленную передачу ограничены 8 байтами" #: shared-bindings/aesio/aes.c msgid "Requested AES mode is unsupported" @@ -1934,12 +1936,12 @@ msgstr "Формат CSD SD-карты не поддерживается" #: ports/cxd56/common-hal/sdioio/SDCard.c msgid "SDCard init" -msgstr "Инициализация SDCard" +msgstr "Инициализация SD-карты" #: ports/stm/common-hal/sdioio/SDCard.c #, c-format msgid "SDIO GetCardInfo Error %d" -msgstr "Ошибка SDIO GetCardInfo %d" +msgstr "Ошибка получения информации о карте SDIO %d" #: ports/stm/common-hal/sdioio/SDCard.c #, c-format @@ -1974,7 +1976,7 @@ msgstr "Сканирование уже выполняется. Останови #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audiobusio/PDMIn.c msgid "Serializer in use" -msgstr "Используемый сериализатор" +msgstr "Сериализатор используется" #: shared-bindings/ssl/SSLContext.c msgid "Server side context cannot have hostname" @@ -1999,7 +2001,7 @@ msgstr "Фрагменты не поддерживаются" #: ports/espressif/common-hal/socketpool/SocketPool.c #: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" -msgstr "Socket Бассейн можно использовать только с Wifi. радио" +msgstr "Пул сокетов можно использовать только с wifi.radio" #: shared-bindings/aesio/aes.c msgid "Source and destination buffers must be the same length" @@ -2036,12 +2038,13 @@ msgstr "Истекло время ожидания считывания темп #: supervisor/shared/safe_mode.c msgid "The `microcontroller` module was used to boot into safe mode." msgstr "" -"Модуль «микроконтроллер» был использован для загрузки в безопасный режим." +"Модуль «микроконтроллер» использовался для загрузки в безопасном режиме." #: py/obj.c msgid "The above exception was the direct cause of the following exception:" msgstr "" -"Вышеупомянутое исключение является прямой причиной следующего исключения:" +"Вышеупомянутое исключение было непосредственной причиной следующего " +"исключения:" #: shared-bindings/rgbmatrix/RGBMatrix.c msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30" @@ -2049,7 +2052,7 @@ msgstr "Длина rgb_pins должна быть 6, 12, 18, 24 или 30" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's bits_per_sample does not match the mixer's" -msgstr "bits_per_sample образца не совпадает с смесителя" +msgstr "Bits_per_sample сэмпла не соответствует битам микшера" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's channel count does not match the mixer's" @@ -2057,11 +2060,11 @@ msgstr "Количество каналов образца не совпадае #: shared-module/audiomixer/MixerVoice.c msgid "The sample's sample rate does not match the mixer's" -msgstr "Частота дискретизации образца не совпадает с частотой микшера" +msgstr "Частота дискретизации семпла не соответствует частоте микшера" #: shared-module/audiomixer/MixerVoice.c msgid "The sample's signedness does not match the mixer's" -msgstr "Частота дискретизации образца не совпадает с частотой микшера" +msgstr "Подпись семпла не совпадает с подписью микшера" #: supervisor/shared/safe_mode.c msgid "Third-party firmware fatal error." @@ -2081,7 +2084,7 @@ msgstr "" #: shared-bindings/displayio/TileGrid.c msgid "Tile height must exactly divide bitmap height" -msgstr "Высота фрагмента должна в точности делить высоту растрового изображения" +msgstr "Высота плитки должна точно делить высоту растрового изображения" #: shared-bindings/displayio/TileGrid.c shared-module/displayio/TileGrid.c msgid "Tile index out of bounds" @@ -2093,7 +2096,7 @@ msgstr "Ширина плитки должна точно делить шири #: shared-bindings/alarm/time/TimeAlarm.c msgid "Time is in the past." -msgstr "Время осталось в прошлом." +msgstr "Время в прошлом." #: ports/espressif/common-hal/_bleio/Adapter.c #: ports/nrf/common-hal/_bleio/Adapter.c @@ -2107,11 +2110,11 @@ msgstr "Слишком много каналов в выборке" #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c msgid "Too many channels in sample." -msgstr "Слишком много каналов в выборке" +msgstr "Слишком много каналов в выборке." #: shared-module/displayio/__init__.c msgid "Too many display busses; forgot displayio.release_displays() ?" -msgstr "Слишком много дисплеев; забыли Displayio.release_displays()?" +msgstr "Слишком много шин дисплея; забыл displayio.release_displays()?" #: shared-module/displayio/__init__.c msgid "Too many displays" @@ -2120,13 +2123,13 @@ msgstr "Слишком много дисплеев" #: ports/espressif/common-hal/_bleio/PacketBuffer.c #: ports/nrf/common-hal/_bleio/PacketBuffer.c msgid "Total data to write is larger than %q" -msgstr "Общий объем записываемых данных превышает %q" +msgstr "Общее количество данных для записи превышает %q" #: ports/atmel-samd/common-hal/alarm/touch/TouchAlarm.c #: ports/raspberrypi/common-hal/alarm/touch/TouchAlarm.c #: ports/stm/common-hal/alarm/touch/TouchAlarm.c msgid "Touch alarms not available" -msgstr "Сенсорные сигналы тревоги недоступны" +msgstr "Сенсорные сигналы недоступны" #: py/obj.c msgid "Traceback (most recent call last):\n" @@ -2187,7 +2190,7 @@ msgstr "UUID строка не 'xxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxxxxx #: shared-bindings/_bleio/UUID.c msgid "UUID value is not str, int or byte buffer" -msgstr "Значение UUID не является str, int или байтовым буфером" +msgstr "Значение UUID не является строковым, целым или байтовым буфером" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -2203,7 +2206,7 @@ msgstr "Невозможно выделить кучу." #: ports/espressif/common-hal/analogbufio/BufferedIn.c #, c-format msgid "Unable to configure ADC DMA controller, ErrorCode:%d" -msgstr "Невозможно настроить контроллер ADC DMA, ErrorCode:%d" +msgstr "Невозможно настроить контроллер ADC DMA, код ошибки:%d" #: ports/espressif/common-hal/busio/I2C.c msgid "Unable to create lock" @@ -2226,7 +2229,7 @@ msgstr "Не удается инициировать синтаксически #: ports/espressif/common-hal/analogbufio/BufferedIn.c #, c-format msgid "Unable to initialize ADC DMA controller, ErrorCode:%d" -msgstr "Не удается инициализировать контроллер ADC DMA, ErrorCode:%d" +msgstr "Невозможно инициализировать контроллер ADC DMA, код ошибки:%d" #: shared-module/displayio/OnDiskBitmap.c msgid "Unable to read color palette data" @@ -2252,7 +2255,7 @@ msgstr "Невозможно выполнить запись в nvm." #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." -msgstr "Не удается написать sleep_memory." +msgstr "Невозможно записать в Sleep_memory." #: ports/nrf/common-hal/_bleio/UUID.c msgid "Unexpected nrfx uuid type" @@ -2318,15 +2321,15 @@ msgstr "Неизвестная ошибка прошивки системы: %d" #, c-format msgid "Unmatched number of items on RHS (expected %d, got %d)." msgstr "" -"Непревзойдённое количество элементов на RHS (ожидаемый %d, полученный %d)." +"Непревзойденное количество элементов на RHS (ожидалось %d, получено %d)." #: ports/nrf/common-hal/_bleio/__init__.c msgid "" "Unspecified issue. Can be that the pairing prompt on the other device was " "declined or ignored." msgstr "" -"Неопределенная проблема. Может случиться так, что запрос на сопряжение на " -"другом устройстве был отклонен или проигнорирован." +"Неуказанная проблема. Возможно, запрос на сопряжение на другом устройстве " +"был отклонен или проигнорирован." #: shared-bindings/bitmaptools/__init__.c msgid "Unsupported colorspace" @@ -2353,7 +2356,7 @@ msgstr "Ошибка обновления" #: ports/nrf/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Descriptor.c msgid "Value length != required fixed length" -msgstr "Значение length != требуемая фиксированная длина" +msgstr "Длина значения! = требуемая фиксированная длина" #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/espressif/common-hal/_bleio/Descriptor.c @@ -2379,11 +2382,12 @@ msgstr "ВНИМАНИЕ: Имя файла кода имеет два расш #: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "WatchDogTimer cannot be deinitialized once mode is set to RESET" msgstr "" -"WatchDogTimer не может быть деинициализирован после установки режима RESET" +"Сторожевой таймер не может быть деинициализирован, если установлен режим " +"RESET" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer is not currently running" -msgstr "WatchDogTimer в настоящее время не запущен" +msgstr "Таймер Watch Dog в настоящее время не работает" #: shared-bindings/watchdog/WatchDogTimer.c msgid "WatchDogTimer.mode cannot be changed once set to WatchDogMode.RESET" @@ -2400,9 +2404,11 @@ msgid "" "\n" "To list built-in modules type `help(\"modules\")`.\n" msgstr "" -"Добро пожаловать в Adafruit CircuitPython %s! Посетите circuitpython.org для " -"получения дополнительной информации. Чтобы получить список встроенных " -"модулей, введите 'help(\"modules\")'.\n" +"Добро пожаловать в Adafruit CircuitPython %s! \n" +"\n" +"Посетите circuitpython.org для получения дополнительной информации. \n" +"\n" +"Чтобы получить список встроенных модулей, введите 'help(\"modules\")'.\n" #: supervisor/shared/web_workflow/web_workflow.c msgid "Wi-Fi: " @@ -2516,11 +2522,11 @@ msgstr "ARG должен быть пользовательского типа" #: extmod/ulab/code/numpy/numerical.c msgid "argsort argument must be an ndarray" -msgstr "Аргумент argsort должен быть ndarray" +msgstr "Аргумент сортировки arg должен быть массивом nd" #: extmod/ulab/code/numpy/numerical.c msgid "argsort is not implemented for flattened arrays" -msgstr "argsort не реализован для сведенных массивов" +msgstr "сортировка arg не реализована для сглаженных массивов" #: py/runtime.c shared-bindings/supervisor/__init__.c msgid "argument has wrong type" @@ -2541,7 +2547,7 @@ msgstr "аргумент должен быть '%q', а не '%q'" #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/numpy/transform.c msgid "arguments must be ndarrays" -msgstr "Аргументы должны быть ndarrays" +msgstr "аргументы должны быть массивами" #: extmod/ulab/code/ndarray.c msgid "array and index length must be equal" @@ -2570,7 +2576,7 @@ msgstr "Попытка получить (arg)min/(arg)max пустой посл #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" -msgstr "Попытка получить (arg)min/(arg)max пустой последовательности" +msgstr "Попытка получить argmin/argmax пустой последовательности" #: py/objstr.c msgid "attributes not supported yet" @@ -2582,7 +2588,7 @@ msgstr "Ось выходит за пределы" #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/ulab_tools.c msgid "axis must be None, or an integer" -msgstr "ось должна иметь значение None или целое число" +msgstr "ось должна быть None или целым числом" #: extmod/ulab/code/numpy/numerical.c msgid "axis too long" @@ -2610,7 +2616,7 @@ msgstr "Неверный шрифт" #: py/emitnative.c msgid "binary op %q not implemented" -msgstr "Двоичный op %q не реализован" +msgstr "двоичная операция %q не реализована" #: shared-bindings/bitmaptools/__init__.c msgid "bitmap sizes must match" @@ -2646,7 +2652,7 @@ msgstr "Буферные фрагменты должны быть одинако #: py/modstruct.c shared-module/struct/__init__.c msgid "buffer too small" -msgstr "Слишком маленький буфер" +msgstr "буфер слишком мал" #: shared-bindings/socketpool/Socket.c shared-bindings/ssl/SSLSocket.c msgid "buffer too small for requested bytes" @@ -2713,7 +2719,7 @@ msgstr "не может преобразовать %s в сложный" #: py/obj.c #, c-format msgid "can't convert %s to float" -msgstr "Не удается преобразовать %s в float" +msgstr "не могу преобразовать %s в число с плавающей запятой" #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" @@ -2787,7 +2793,7 @@ msgstr "Не удается установить атрибут" #: py/runtime.c shared-bindings/supervisor/Runtime.c msgid "can't set attribute '%q'" -msgstr "Не удается установить атрибут" +msgstr "Не удается установить атрибут '%q'" #: py/emitnative.c msgid "can't store '%q'" @@ -2795,7 +2801,7 @@ msgstr "Не удается сохранить '%q'" #: py/emitnative.c msgid "can't store to '%q'" -msgstr "Не удается сохранить '%q'" +msgstr "невозможно сохранить в «%q»" #: py/emitnative.c msgid "can't store with '%q' index" @@ -2827,7 +2833,7 @@ msgstr "Не удается привести выходные данные с п #: extmod/ulab/code/ndarray.c msgid "cannot convert complex to dtype" -msgstr "Не удается преобразовать complex в dtype" +msgstr "невозможно преобразовать комплекс в тип d" #: extmod/ulab/code/ndarray.c msgid "cannot convert complex type" @@ -2871,15 +2877,15 @@ msgstr "Слишком маленький буфер символов" #: py/modbuiltins.c msgid "chr() arg not in range(0x110000)" -msgstr "chr() arg отсутствует в диапазоне(0x110000)" +msgstr "chr() аргумент вне диапазона (0x110000)" #: py/modbuiltins.c msgid "chr() arg not in range(256)" -msgstr "chr() arg не в диапазоне(256)" +msgstr "chr() аргумент вне диапазона (256)" #: shared-bindings/bitmaptools/__init__.c msgid "clip point must be (x,y) tuple" -msgstr "Точка клипа должна быть кортежом (X,Y)" +msgstr "Точка клипа должна быть кортежом (x,y)" #: shared-bindings/msgpack/ExtType.c msgid "code outside range 0~127" @@ -2887,7 +2893,9 @@ msgstr "код вне диапазона 0~127" #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" -msgstr "цветовой буфер должен быть 3 байта (RGB) или 4 байта (RGB + байт пэда)" +msgstr "" +"Цветовой буфер должен иметь размер 3 байта (RGB) или 4 байта (RGB + байт " +"заполнения)" #: shared-bindings/displayio/Palette.c msgid "color buffer must be a buffer, tuple, list, or int" @@ -2924,11 +2932,11 @@ msgstr "Аргументы свертки должны быть линейным #: extmod/ulab/code/numpy/filter.c msgid "convolve arguments must be ndarrays" -msgstr "Аргументы свертки должны быть линейными массивами" +msgstr "Аргументы свертки должны быть линейными массивами nd" #: extmod/ulab/code/numpy/filter.c msgid "convolve arguments must not be empty" -msgstr "Аргументы convolve не должны быть пустыми" +msgstr "аргументы свертки не должны быть пустыми" #: extmod/ulab/code/numpy/io/io.c msgid "corrupted file" @@ -2940,7 +2948,7 @@ msgstr "не удалось инвертировать матрицу Ванде #: shared-module/sdcardio/SDCard.c msgid "couldn't determine SD card version" -msgstr "Не удалось определить версию SD-карты" +msgstr "Не удалось определить версию SD карты" #: extmod/ulab/code/numpy/numerical.c msgid "cross is defined for 1D arrays of length 3" @@ -2984,7 +2992,7 @@ msgstr "" #: shared-bindings/audiobusio/PDMIn.c msgid "destination buffer must be an array of type 'H' for bit_depth = 16" -msgstr "буфер назначения должен быть массивом типа 'H' для bit_depth = 16" +msgstr "буфер назначения должен быть массивом типа «H» для битовой_глубины = 16" #: py/objdict.c msgid "dict update sequence has wrong length" @@ -2992,7 +3000,7 @@ msgstr "последовательность обновления дикта и #: extmod/ulab/code/numpy/numerical.c msgid "diff argument must be an ndarray" -msgstr "дифф-аргумент, должно быть, ndarray" +msgstr "Аргумент diff должен быть массивом nd" #: extmod/ulab/code/numpy/numerical.c msgid "differentiation order out of range" @@ -3016,7 +3024,7 @@ msgstr "Деление на ноль" #: extmod/ulab/code/numpy/vector.c msgid "dtype must be float, or complex" -msgstr "dtype должен быть поплавком или сложным" +msgstr "Тип d должен быть плавающим или сложным" #: py/objdeque.c msgid "empty" @@ -3056,12 +3064,12 @@ msgid "" "espcamera.Camera requires reserved PSRAM to be configured. See the " "documentation for instructions." msgstr "" -"Эспкамера. Камера требует настройки зарезервированной PSRAM. Инструкции см. " -"в документации." +"espcamera.Для настройки камеры требуется зарезервированная PSRAM. Инструкции " +"см. в документации." #: py/runtime.c msgid "exceptions must derive from BaseException" -msgstr "исключения должны быть производными от BaseException" +msgstr "исключения должны быть производными от базового исключения" #: py/objstr.c msgid "expected ':' after format specifier" @@ -3073,7 +3081,7 @@ msgstr "Ожидаемый кортеж/список" #: py/modthread.c msgid "expecting a dict for keyword args" -msgstr "Ожидание дикта для args ключевых слов" +msgstr "ожидание определения аргументов ключевых слов" #: py/compile.c msgid "expecting an assembler instruction" @@ -3123,11 +3131,11 @@ msgstr "первый аргумент должен быть функцией" #: extmod/ulab/code/numpy/create.c msgid "first argument must be a tuple of ndarrays" -msgstr "Первым аргументом должен быть кортеж ндарреев" +msgstr "первый аргумент должен быть кортежем из nd массивов" #: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" -msgstr "Первым аргументом должен быть Ндаррей" +msgstr "первый аргумент должен быть массивом nd" #: py/objtype.c msgid "first argument to super() must be type" @@ -3135,7 +3143,7 @@ msgstr "первый аргумент супер() должен быть тип #: extmod/ulab/code/scipy/linalg/linalg.c msgid "first two arguments must be ndarrays" -msgstr "первые два аргумента должны быть ndarrays" +msgstr "первые два аргумента должны быть массивами nd" #: extmod/ulab/code/ndarray.c msgid "flattening order must be either 'C', or 'F'" @@ -3143,7 +3151,7 @@ msgstr "порядок сглаживания должен быть либо 'C' #: extmod/ulab/code/numpy/numerical.c msgid "flip argument must be an ndarray" -msgstr "Аргумент flip должен быть ndarray" +msgstr "аргумент переворота должен быть массивом nd" #: py/objint.c msgid "float too big" @@ -3184,11 +3192,11 @@ msgstr "функция имеет один и тот же знак в конце #: extmod/ulab/code/ndarray.c msgid "function is defined for ndarrays only" -msgstr "функция определяется только для ndarrays" +msgstr "функция определена только для массивов nd" #: extmod/ulab/code/numpy/carray/carray.c msgid "function is implemented for ndarrays only" -msgstr "функция реализована только для ndarrays" +msgstr "функция реализована только для массивов nd" #: py/argcheck.c #, c-format @@ -3227,7 +3235,7 @@ msgstr "генератор проигнорировал Выход" #: py/objgenerator.c py/runtime.c msgid "generator raised StopIteration" -msgstr "генератор поднял StopIteration" +msgstr "генератор поднят Остановить итерацию" #: shared-bindings/_stage/Layer.c msgid "graphic must be 2048 bytes long" @@ -3239,7 +3247,7 @@ msgstr "хэш является окончательным" #: extmod/moduheapq.c msgid "heap must be a list" -msgstr "куча должна быть списком;" +msgstr "куча должна быть списком" #: py/compile.c msgid "identifier redefined as global" @@ -3358,21 +3366,19 @@ msgstr "Вход должен быть 1- или 2-D" #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" -msgstr "входные данные должны быть 1D ndarray" +msgstr "входные данные должны быть 1D-массивом nd" #: extmod/ulab/code/scipy/linalg/linalg.c extmod/ulab/code/user/user.c msgid "input must be a dense ndarray" -msgstr "Входные данные должны быть плотным ndarray" +msgstr "входные данные должны быть плотным массивом nd" #: extmod/ulab/code/user/user.c msgid "input must be an ndarray" -msgstr "Входные данные должны быть ndarray" +msgstr "ввод должен быть массивом nd" #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be an ndarray, or a scalar" -msgstr "" -"Входные данные должны быть входными данными, должны быть ndarray или " -"скалярными" +msgstr "входные данные должны быть массивом nd или скаляром" #: extmod/ulab/code/scipy/signal/signal.c msgid "input must be one-dimensional" @@ -3384,7 +3390,8 @@ msgstr "Входные данные должны быть квадратной #: extmod/ulab/code/numpy/numerical.c msgid "input must be tuple, list, range, or ndarray" -msgstr "Входные данные должны быть кортежом, списком, диапазоном или ndarray" +msgstr "" +"входные данные должны быть кортежем, списком, диапазоном или массивом nd" #: extmod/ulab/code/numpy/poly.c msgid "input vectors must be of equal length" @@ -3397,7 +3404,7 @@ msgstr "interp определен для 1D-итераций одинаково #: shared-bindings/_bleio/Adapter.c #, c-format msgid "interval must be in range %s-%s" -msgstr "Интервал должен находиться в диапазоне %S-%S" +msgstr "Интервал должен находиться в диапазоне %s-%s" #: py/compile.c msgid "invalid architecture" @@ -3406,7 +3413,7 @@ msgstr "Недопустимая архитектура" #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid bits_per_pixel %d, must be, 1, 2, 4, 8, 16, 24, or 32" -msgstr "Недопустимые bits_per_pixel %d, должно быть, 1, 2, 4, 8, 16, 24 или 32" +msgstr "неверный бит_на_пиксель %d, должно быть 1, 2, 4, 8, 16, 24 или 32" #: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "invalid cert" @@ -3415,7 +3422,7 @@ msgstr "Неверный сертификат" #: shared-bindings/bitmaptools/__init__.c #, c-format msgid "invalid element size %d for bits_per_pixel %d\n" -msgstr "Недопустимый размер элемента %d для bits_per_pixel %d\n" +msgstr "недопустимый размер элемента %d для битов на_пиксель %d\n" #: shared-bindings/bitmaptools/__init__.c #, c-format @@ -3436,11 +3443,11 @@ msgstr "Недопустимое имя хоста" #: ports/raspberrypi/common-hal/ssl/SSLSocket.c msgid "invalid key" -msgstr "Неверный ключ." +msgstr "Неверный ключ" #: py/compile.c msgid "invalid micropython decorator" -msgstr "Недопустимый декоратор MicroPython" +msgstr "неверный декоратор микропитона" #: ports/espressif/common-hal/espcamera/Camera.c msgid "invalid setting" @@ -3488,8 +3495,8 @@ msgstr "" #: py/argcheck.c msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "" -"аргумент(ы) ключевых слов еще не реализован - вместо этого используйте " -"обычные арги" +"Аргументы ключевого слова еще не реализованы — вместо этого используйте " +"обычные аргументы" #: py/emitinlinethumb.c py/emitinlinextensa.c msgid "label '%q' not defined" @@ -3560,7 +3567,7 @@ msgstr "матрица не является положительно опред #: ports/nrf/common-hal/_bleio/Descriptor.c #, c-format msgid "max_length must be 0-%d when fixed_length is %s" -msgstr "max_длина должна быть 0-%d, когда фиксированная длина %s" +msgstr "максимальная_длина должна быть 0-%d когда фиксированная длина %s" #: extmod/ulab/code/ndarray.c msgid "maximum number of dimensions is " @@ -3580,12 +3587,12 @@ msgstr "макситер должен быть > 0" #: extmod/ulab/code/numpy/numerical.c msgid "median argument must be an ndarray" -msgstr "Медианный аргумент должен быть ndarray" +msgstr "Медианный аргумент должен быть массивом nd" #: py/runtime.c #, c-format msgid "memory allocation failed, allocating %u bytes" -msgstr "Сбой выделения памяти, выделение %U байт" +msgstr "Сбой выделения памяти, выделение %u байт" #: py/runtime.c msgid "memory allocation failed, heap is locked" @@ -3609,7 +3616,7 @@ msgstr "Сбой инициализации монитора" #: extmod/ulab/code/numpy/poly.c msgid "more degrees of freedom than data points" -msgstr "Больше степеней свободы, чем точек данных" +msgstr "Больше степеней свободы чем точек данных" #: py/compile.c msgid "multiple *x in assignment" @@ -3649,12 +3656,12 @@ msgstr "родной урожай" #: extmod/ulab/code/ndarray.c msgid "ndarray length overflows" -msgstr "Длина Ндаррея переливается" +msgstr "Переполнение длины массива nd" #: py/runtime.c #, c-format msgid "need more than %d values to unpack" -msgstr "Для распаковки требуется более % значений %d" +msgstr "Для распаковки требуется более значений %d" #: py/modmath.c msgid "negative factorial" @@ -3674,7 +3681,7 @@ msgstr "вложенный индекс должен быть int" #: shared-module/sdcardio/SDCard.c msgid "no SD card" -msgstr "нет SD-карты" +msgstr "нет SD карты" #: py/vm.c msgid "no active exception to reraise" @@ -3698,7 +3705,7 @@ msgstr "Нет модуля с именем '%Q'" #: shared-module/sdcardio/SDCard.c msgid "no response from SD card" -msgstr "нет ответа с SD-карты" +msgstr "нет ответа с SD карты" #: ports/espressif/common-hal/espcamera/Camera.c py/objobject.c py/runtime.c msgid "no such attribute" @@ -3707,12 +3714,12 @@ msgstr "нет такого атрибута" #: ports/espressif/common-hal/_bleio/Connection.c #: ports/nrf/common-hal/_bleio/Connection.c msgid "non-UUID found in service_uuids_whitelist" -msgstr "неUUID найден в service_uuids_whitelist" +msgstr "не-UUID найден в service_uuids_whitelist" #: py/compile.c msgid "non-default argument follows default argument" msgstr "" -"Аргумент, отличный от аргумента по умолчанию, следует за аргументом по " +"Аргумент отличный от аргумента по умолчанию следует за аргументом по " "умолчанию" #: extmod/modubinascii.c @@ -3745,7 +3752,7 @@ msgstr "Недостаточно аргументов для строки фор #: extmod/ulab/code/numpy/carray/carray_tools.c msgid "not implemented for complex dtype" -msgstr "Не реализовано для сложного DTYPE" +msgstr "не реализовано для сложного типа d" #: extmod/ulab/code/numpy/bitwise.c msgid "not supported for input types" @@ -3762,7 +3769,7 @@ msgstr "объект " #: py/obj.c #, c-format msgid "object '%s' isn't a tuple or list" -msgstr "Объект \"%S\" не является кортежом или списком" +msgstr "Объект \"%s\" не является кортежом или списком" #: py/obj.c msgid "object doesn't support item assignment" @@ -3832,7 +3839,7 @@ msgstr "Смещение за пределы" #: ports/nrf/common-hal/audiobusio/PDMIn.c #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only bit_depth=16 is supported" -msgstr "поддерживается только bit_depth=16" +msgstr "поддерживается только бит_глубина=16" #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only mono is supported" @@ -3840,11 +3847,11 @@ msgstr "Поддерживается только моно" #: extmod/ulab/code/numpy/create.c msgid "only ndarrays can be concatenated" -msgstr "Только ндарреи могут быть объединены" +msgstr "только nd массивы могут быть объединены" #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" -msgstr "поддерживается только oversample=64" +msgstr "поддерживается только выборка = 64" #: ports/nrf/common-hal/audiobusio/PDMIn.c #: ports/stm/common-hal/audiobusio/PDMIn.c @@ -3872,7 +3879,7 @@ msgstr "операция определена только для 2D-масси #: extmod/ulab/code/numpy/linalg/linalg.c msgid "operation is defined for ndarrays only" -msgstr "Операция определена только для ndarrays" +msgstr "операция определена только для массивов nd" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" @@ -3880,7 +3887,7 @@ msgstr "операция реализована только для 1D логи #: extmod/ulab/code/numpy/numerical.c msgid "operation is not implemented on ndarrays" -msgstr "Операция не реализована на ndarrays" +msgstr "операция не реализована на массивах nd" #: extmod/ulab/code/ndarray.c msgid "operation is not supported for given type" @@ -3901,7 +3908,7 @@ msgstr "Наш массив слишком мал" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for complex dtype" -msgstr "ключевое слово не поддерживается для сложного dtype" +msgstr "Ключевое слово out не поддерживается для сложного типа d" #: extmod/ulab/code/numpy/vector.c msgid "out keyword is not supported for function" @@ -3913,7 +3920,7 @@ msgstr "Out должен быть плотным массивом с плава #: extmod/ulab/code/numpy/vector.c msgid "out must be an ndarray" -msgstr "Входные данные должны быть ndarray" +msgstr "Входные данные должны быть массивом nd" #: extmod/ulab/code/numpy/vector.c msgid "out must be of float dtype" @@ -3925,7 +3932,7 @@ msgstr "вне досягаемости цели" #: py/objint_mpz.c msgid "overflow converting long int to machine word" -msgstr "переполнение, преобразование длинного int в машинное слово" +msgstr "переполнение преобразование длинного целого в машинное слово" #: py/modstruct.c #, c-format @@ -3938,11 +3945,11 @@ msgstr "Длина палитры должна составлять 32 байт #: py/emitinlinextensa.c msgid "parameters must be registers in sequence a2 to a5" -msgstr "Параметры должны быть регистрами в последовательности от A2 до A5" +msgstr "Параметры должны быть регистрами в последовательности от a2 до a5" #: py/emitinlinethumb.c msgid "parameters must be registers in sequence r0 to r3" -msgstr "Параметры должны быть регистрами в последовательности от R0 до R3" +msgstr "Параметры должны быть регистрами в последовательности от r0 до r3" #: shared-bindings/bitmaptools/__init__.c msgid "pixel coordinates out of bounds" @@ -3954,7 +3961,7 @@ msgstr "Опрос в файле недоступен в Win32" #: ports/espressif/common-hal/pulseio/PulseIn.c msgid "pop from an empty PulseIn" -msgstr "поп из пустого PulseIn" +msgstr "вытолкнуть из пустого импульсного входа" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c #: ports/cxd56/common-hal/pulseio/PulseIn.c @@ -3971,11 +3978,11 @@ msgstr "порт должен быть >= 0" #: py/compile.c msgid "positional arg after **" -msgstr "позиционный arg после **" +msgstr "позиционный аргумент после **" #: py/compile.c msgid "positional arg after keyword arg" -msgstr "позиционный arg после ключевого слова arg" +msgstr "позиционный аргумент после ключевого слова аргумента" #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" @@ -4030,11 +4037,11 @@ msgstr "rgb_pins[%d] дублирует другое назначение пин #: shared-bindings/rgbmatrix/RGBMatrix.c #, c-format msgid "rgb_pins[%d] is not on the same port as clock" -msgstr "rgb_pins[%d] не находится на том же порту, что и clock" +msgstr "rgb_pins[%d] не находится на том же порту что и часы" #: extmod/ulab/code/numpy/numerical.c msgid "roll argument must be an ndarray" -msgstr "Аргумент roll должен быть массивом ND" +msgstr "Аргумент roll должен быть массивом nd" #: py/objstr.c msgid "rsplit(None,n)" @@ -4075,7 +4082,7 @@ msgstr "Знак не разрешен со спецификатором цел #: extmod/ulab/code/ulab_tools.c msgid "size is defined for ndarrays only" -msgstr "Размер определяется только для массивов ND" +msgstr "Размер определяется только для массивов nd" #: shared-bindings/time/__init__.c msgid "sleep length must be non-negative" @@ -4099,7 +4106,7 @@ msgstr "Мягкая перезагрузка\n" #: extmod/ulab/code/numpy/numerical.c msgid "sort argument must be an ndarray" -msgstr "Аргумент sort должен быть массивом ND" +msgstr "Аргумент сортировки должен быть массивом nd" #: extmod/ulab/code/scipy/signal/signal.c msgid "sos array must be of shape (n_section, 6)" @@ -4111,7 +4118,7 @@ msgstr "sos[:, 3] должны быть все единицы" #: extmod/ulab/code/scipy/signal/signal.c msgid "sosfilt requires iterable arguments" -msgstr "Sosfilt требует итерируемых аргументов" +msgstr "sosфильтр требует повторяющихся аргументов" #: shared-bindings/bitmaptools/__init__.c msgid "source palette too large" @@ -4147,11 +4154,11 @@ msgstr "строка не поддерживается; Использовани #: extmod/moductypes.c msgid "struct: can't index" -msgstr "struct: не может индексировать" +msgstr "структура: невозможно индексировать" #: extmod/moductypes.c msgid "struct: index out of range" -msgstr "struct: индекс вне диапазона" +msgstr "структура: индекс вне диапазона" #: extmod/moductypes.c msgid "struct: no fields" @@ -4179,19 +4186,19 @@ msgstr "Синтаксическая ошибка в дескрипторе UCTY #: ports/raspberrypi/common-hal/watchdog/WatchDogTimer.c msgid "timeout duration exceeded the maximum supported value" msgstr "" -"Продолжительность тайм-аута превысила максимальное поддерживаемое значение" +"Продолжительность таймаута превысила максимальное поддерживаемое значение" #: ports/nrf/common-hal/_bleio/Adapter.c msgid "timeout must be < 655.35 secs" -msgstr "тайм-аут должен быть < 655.35 сек" +msgstr "таймаут должен быть < 655.35 сек" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v1 card" -msgstr "Тайм-аут в ожидании карты V1" +msgstr "Таймаут в ожидании карты v1" #: shared-module/sdcardio/SDCard.c msgid "timeout waiting for v2 card" -msgstr "Тайм-аут ожидания карты V2" +msgstr "Таймаут ожидания карты v2" #: ports/stm/common-hal/pwmio/PWMOut.c msgid "timer re-init" @@ -4208,7 +4215,7 @@ msgstr "Тобайты могут быть вызваны только для п #: py/compile.c msgid "too many args" -msgstr "Слишком много ARG" +msgstr "слишком много аргументов" #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" @@ -4229,11 +4236,11 @@ msgstr "Слишком много значений для распаковки ( #: extmod/ulab/code/numpy/approx.c msgid "trapz is defined for 1D arrays of equal length" -msgstr "trapz определяется для 1D-массивов одинаковой длины" +msgstr "ловушка определена для одномерных 1D массивов одинаковой длины" #: extmod/ulab/code/numpy/approx.c msgid "trapz is defined for 1D iterables" -msgstr "trapz определен для 1D-итераций" +msgstr "ловушка определена для одномерных 1D итераций" #: py/obj.c msgid "tuple/list has wrong length" @@ -4271,11 +4278,11 @@ msgstr "тип занимает 1 или 3 аргумента" #: py/objint_longlong.c msgid "ulonglong too large" -msgstr "ulonglong слишком большой" +msgstr "голова длинная слишком большая" #: py/emitnative.c msgid "unary op %q not implemented" -msgstr "Двоичный op %q не реализован" +msgstr "унарная операция %q не реализована" #: py/parse.c msgid "unexpected indent" @@ -4300,7 +4307,7 @@ msgstr "Отступ не совпадает ни с одним уровнем #: py/objstr.c #, c-format msgid "unknown conversion specifier %c" -msgstr "Неизвестный спецификатор преобразования %C" +msgstr "Неизвестный спецификатор преобразования %c" #: py/objstr.c msgid "unknown format code '%c' for object of type '%q'" @@ -4377,7 +4384,7 @@ msgstr "Значение должно совпадать с байтами %d" #: shared-bindings/bitmaptools/__init__.c msgid "value out of range of target" -msgstr "Величина, выходящая за пределы диапазона цели" +msgstr "Величина выходящая за пределы диапазона цели" #: ports/espressif/common-hal/watchdog/WatchDogTimer.c msgid "watchdog not initialized" @@ -4398,7 +4405,7 @@ msgstr "Wi-Fi. Монитор недоступен" #: shared-bindings/_bleio/Adapter.c msgid "window must be <= interval" -msgstr "окно должно быть" +msgstr "окно должно быть <= интервал" #: extmod/ulab/code/numpy/numerical.c msgid "wrong axis index" @@ -4444,11 +4451,11 @@ msgstr "неверный тип вывода" #: ports/espressif/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" -msgstr "xTaskCreate провалился" +msgstr "x Создать задачу не удалось" #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" -msgstr "zi должен быть bytearray" +msgstr "zi должен быть массивом nd" #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be of float type" From 9eaae37dfc79459a6de1929e4597d6ae4d265b2f Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Tue, 5 Sep 2023 19:31:18 +0300 Subject: [PATCH 1621/1712] When no password is passed, connect to wifi but do not init web_workflow. --- supervisor/shared/web_workflow/web_workflow.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index 3e61eee360..15c60a1cbf 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -315,6 +315,15 @@ bool supervisor_start_web_workflow(void) { // (leaves new_port unchanged on any failure) (void)common_hal_os_getenv_int("CIRCUITPY_WEB_API_PORT", &web_api_port); + const size_t api_password_len = sizeof(_api_password) - 1; + result = common_hal_os_getenv_str("CIRCUITPY_WEB_API_PASSWORD", _api_password + 1, api_password_len); + if (result == GETENV_OK) { + _api_password[0] = ':'; + _base64_in_place(_api_password, strlen(_api_password), sizeof(_api_password) - 1); + } else { + return false; + } + bool first_start = pool.base.type != &socketpool_socketpool_type; if (first_start) { @@ -346,13 +355,6 @@ bool supervisor_start_web_workflow(void) { } #endif - const size_t api_password_len = sizeof(_api_password) - 1; - result = common_hal_os_getenv_str("CIRCUITPY_WEB_API_PASSWORD", _api_password + 1, api_password_len); - if (result == GETENV_OK) { - _api_password[0] = ':'; - _base64_in_place(_api_password, strlen(_api_password), sizeof(_api_password) - 1); - } - if (common_hal_socketpool_socket_get_closed(&listening)) { socketpool_socket(&pool, SOCKETPOOL_AF_INET, SOCKETPOOL_SOCK_STREAM, &listening); common_hal_socketpool_socket_settimeout(&listening, 0); From 6784e0e720d2e59e6bb08ae18b86ebb2b0619f14 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 5 Sep 2023 11:59:35 -0500 Subject: [PATCH 1622/1712] Ensure debug is defined earlier --- ports/espressif/supervisor/port.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index 37d67595ee..a314ce58fe 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -246,16 +246,17 @@ safe_mode_t port_init(void) { circuitpython_task = xTaskGetCurrentTaskHandle(); + #if !defined(DEBUG) + #define DEBUG (0) + #endif + // Send the ROM output out of the UART. This includes early logs. - #ifdef DEBUG + #if DEBUG ets_install_uart_printf(); #endif heap = NULL; - - #ifndef DEBUG - #define DEBUG (0) - #endif + heap_size = 0; #define pin_GPIOn(n) pin_GPIO##n #define pin_GPIOn_EXPAND(x) pin_GPIOn(x) From b7d1147f67b7169202939dd6567b73c8d327a01b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 5 Sep 2023 11:59:13 -0500 Subject: [PATCH 1623/1712] Bump the stack size of the uart task With DEBUG build and a consle UART, this would occur early during startup on makerfabs tft7: ``` I (0) cpu_start: Starting scheduler on APP CPU. I (10) uart: queue free spaces: 20 ***ERROR*** A stack overflow in task uart_event_task has been detected. Backtrace: 0x403786f2:0x3fce9f40 0x403820a9:0x3fce9f60 0x403850da:0x3fce9f80 0x40383a7d:0x3fcea000 0x40382158:0x3fcea030 0x4038214e:0xa5a5a5a5 |<-CORRUPTED ``` Decoded backtrace was not enlightening: ``` 0x403786f2: panic_abort at /home/jepler/src/circuitpython/ports/espressif/build-makerfabs_tft7/esp-idf/../../esp-idf/components/esp_system/panic.c:408 0x403820a9: esp_system_abort at /home/jepler/src/circuitpython/ports/espressif/build-makerfabs_tft7/esp-idf/../../esp-idf/components/esp_system/esp_system.c:137 0x403850da: vApplicationStackOverflowHook at /home/jepler/src/circuitpython/ports/espressif/build-makerfabs_tft7/esp-idf/../../esp-idf/components/freertos/port/xtensa/port.c:407 0x40383a7d: vTaskSwitchContext at /home/jepler/src/circuitpython/ports/espressif/build-makerfabs_tft7/esp-idf/../../esp-idf/components/freertos/tasks.c:3505 0x40382158: _frxt_dispatch at /home/jepler/src/circuitpython/ports/espressif/build-makerfabs_tft7/esp-idf/../../esp-idf/components/freertos/port/xtensa/portasm.S:436 0x4038214e: _frxt_int_exit at /home/jepler/src/circuitpython/ports/espressif/build-makerfabs_tft7/esp-idf/../../esp-idf/components/freertos/port/xtensa/portasm.S:231 0x00000000: ?? ??:0 ``` Adding an additional 512 bytes of stack allowed CircuitPython to start successfully. --- ports/espressif/common-hal/busio/UART.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/common-hal/busio/UART.c b/ports/espressif/common-hal/busio/UART.c index 37e0092726..bee199fb17 100644 --- a/ports/espressif/common-hal/busio/UART.c +++ b/ports/espressif/common-hal/busio/UART.c @@ -175,7 +175,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, xTaskCreatePinnedToCore( uart_event_task, "uart_event_task", - configMINIMAL_STACK_SIZE, + configMINIMAL_STACK_SIZE + 512, self, CONFIG_PTHREAD_TASK_PRIO_DEFAULT, &self->event_task, From 5e26862b2c1dcdb6579d007437762462b602dba3 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 5 Sep 2023 12:08:05 -0500 Subject: [PATCH 1624/1712] Allow use of CONFIG_SPIRAM_USE_CAPS_ALLOC .. and switch makerfabs tft7 over to it as a test. We have our existing way of "reserving" PSRAM for esp-idf (we actually control it all but add back the "reserved" part). However, this does not work with off the shelf esp_lcd, which only will allocate a framebuffer in PSRAM if CONFIG_SPIRAM_USE_CAPS_ALLOC (or CONFIG_SPIRAM_USE_ALLOC) is defined, not if CONFIG_SPIRAM_USE_MEMMAP is. This new way is possibly compatible with more esp-idf code, but it complicates CircuitPython's initial startup since nothing until port_heap_init is permitted to use the CP heap or supervisor allocator. In practice this seems to be OK today. Right now this doesn't change the setting across all boards with PSRAM and so it does not revert esp-idf to its prior state. Instead, what I'm thinking is that we can do it during or just after the IDF5 update when sdkconfig files will be getting an overhaul anyway. --- main.c | 11 +++ .../espressif/boards/makerfabs_tft7/sdkconfig | 4 +- ports/espressif/common-hal/espidf/__init__.c | 2 +- ports/espressif/supervisor/port.c | 81 ++++++++++++------- supervisor/port.h | 5 ++ 5 files changed, 70 insertions(+), 33 deletions(-) diff --git a/main.c b/main.c index c37c17dab2..d89777bc5e 100644 --- a/main.c +++ b/main.c @@ -1042,6 +1042,10 @@ int __attribute__((used)) main(void) { set_safe_mode(SAFE_MODE_NO_CIRCUITPY); } + // We maybe can't initialize the heap until here, because on espressif port we need to be able to check for reserved psram in settings.toml + // (but it's OK if this is a no-op due to the heap beinig initialized in port_init()) + set_safe_mode(port_heap_init(get_safe_mode())); + #if CIRCUITPY_ALARM // Record which alarm woke us up, if any. // common_hal_alarm_record_wake_alarm() should return a static, non-heap object @@ -1171,6 +1175,13 @@ void gc_collect(void) { MP_WEAK void port_gc_collect() { } +// A port may initialize the heap in port_init but if it cannot (for instance +// in espressif it must be done after CIRCUITPY is mounted) then it must provde +// an implementation of this function. +MP_WEAK safe_mode_t port_heap_init(safe_mode_t safe_mode_in) { + return safe_mode_in; +} + void NORETURN nlr_jump_fail(void *val) { reset_into_safe_mode(SAFE_MODE_NLR_JUMP_FAIL); while (true) { diff --git a/ports/espressif/boards/makerfabs_tft7/sdkconfig b/ports/espressif/boards/makerfabs_tft7/sdkconfig index 4449c672e1..2514dd506b 100644 --- a/ports/espressif/boards/makerfabs_tft7/sdkconfig +++ b/ports/espressif/boards/makerfabs_tft7/sdkconfig @@ -21,8 +21,8 @@ CONFIG_SPIRAM_SPEED_80M=y CONFIG_SPIRAM=y CONFIG_SPIRAM_BOOT_INIT=y # CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +#CONFIG_SPIRAM_USE_MEMMAP=y +CONFIG_SPIRAM_USE_CAPS_ALLOC=y # CONFIG_SPIRAM_USE_MALLOC is not set CONFIG_SPIRAM_MEMTEST=y # diff --git a/ports/espressif/common-hal/espidf/__init__.c b/ports/espressif/common-hal/espidf/__init__.c index 379d7c5ab4..7acf912077 100644 --- a/ports/espressif/common-hal/espidf/__init__.c +++ b/ports/espressif/common-hal/espidf/__init__.c @@ -79,7 +79,7 @@ bool common_hal_espidf_set_reserved_psram(size_t amount) { supervisor_allocation *psram_for_idf; void common_hal_espidf_reserve_psram(void) { - #ifdef CONFIG_SPIRAM + #ifdef CONFIG_SPIRAM_USE_MEMMAP if (!psram_for_idf) { ESP_LOGI(TAG, "Reserving %d bytes of psram", reserved_psram); if (reserved_psram == 0) { diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index a314ce58fe..688ceafcae 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -299,33 +299,8 @@ safe_mode_t port_init(void) { #endif #endif - #ifdef CONFIG_SPIRAM - { - intptr_t heap_start = common_hal_espidf_get_psram_start(); - intptr_t heap_end = common_hal_espidf_get_psram_end(); - size_t spiram_size = heap_end - heap_start; - if (spiram_size > 0) { - heap = (uint32_t *)heap_start; - heap_size = (heap_end - heap_start) / sizeof(uint32_t); - } else { - ESP_LOGE(TAG, "CONFIG_SPIRAM enabled but no spiram heap available"); - } - } - #endif - _never_reset_spi_ram_flash(); - if (heap == NULL) { - size_t heap_total = heap_caps_get_total_size(MALLOC_CAP_8BIT); - heap_size = MIN(heap_caps_get_largest_free_block(MALLOC_CAP_8BIT), heap_total / 2); - heap = malloc(heap_size); - heap_size = heap_size / sizeof(uint32_t); - } - if (heap == NULL) { - heap_size = 0; - return SAFE_MODE_NO_HEAP; - } - esp_reset_reason_t reason = esp_reset_reason(); switch (reason) { case ESP_RST_BROWNOUT: @@ -344,6 +319,57 @@ safe_mode_t port_init(void) { return SAFE_MODE_NONE; } +safe_mode_t port_heap_init(safe_mode_t sm) { + mp_int_t reserved = 0; + if (filesystem_present() && common_hal_os_getenv_int("CIRCUITPY_RESERVED_PSRAM", &reserved) == GETENV_OK) { + common_hal_espidf_set_reserved_psram(reserved); + } + + #ifdef CONFIG_SPIRAM_USE_MEMMAP + { + intptr_t heap_start = common_hal_espidf_get_psram_start(); + intptr_t heap_end = common_hal_espidf_get_psram_end(); + size_t spiram_size = heap_end - heap_start; + if (spiram_size > 0) { + heap = (uint32_t *)heap_start; + heap_size = (heap_end - heap_start) / sizeof(uint32_t); + common_hal_espidf_reserve_psram(); + } else { + ESP_LOGE(TAG, "CONFIG_SPIRAM_USE_MMAP enabled but no spiram heap available"); + } + } + #elif CONFIG_SPIRAM_USE_CAPS_ALLOC + { + intptr_t psram_start = common_hal_espidf_get_psram_start(); + intptr_t psram_end = common_hal_espidf_get_psram_end(); + size_t psram_amount = psram_end - psram_start; + size_t biggest_block = heap_caps_get_largest_free_block(MALLOC_CAP_SPIRAM); + size_t try_alloc = MIN(biggest_block, psram_amount - common_hal_espidf_get_reserved_psram()); + heap = heap_caps_malloc(try_alloc, MALLOC_CAP_SPIRAM); + + if (heap) { + heap_size = try_alloc; + } else { + ESP_LOGE(TAG, "CONFIG_SPIRAM_USE_CAPS_ALLOC but no spiram heap available"); + } + } + #endif + + if (heap == NULL) { + size_t heap_total = heap_caps_get_total_size(MALLOC_CAP_8BIT); + heap_size = MIN(heap_caps_get_largest_free_block(MALLOC_CAP_8BIT), heap_total / 2); + heap = malloc(heap_size); + heap_size = heap_size / sizeof(uint32_t); + } + if (heap == NULL) { + heap_size = 0; + return SAFE_MODE_NO_HEAP; + } + + return sm; + +} + void reset_port(void) { // TODO deinit for esp32-camera #if CIRCUITPY_ESPCAMERA @@ -533,11 +559,6 @@ void port_idle_until_interrupt(void) { void port_post_boot_py(bool heap_valid) { if (!heap_valid && filesystem_present()) { - mp_int_t reserved; - if (common_hal_os_getenv_int("CIRCUITPY_RESERVED_PSRAM", &reserved) == GETENV_OK) { - common_hal_espidf_set_reserved_psram(reserved); - } - common_hal_espidf_reserve_psram(); } } diff --git a/supervisor/port.h b/supervisor/port.h index 7b48a3f13b..ebfa8473f2 100644 --- a/supervisor/port.h +++ b/supervisor/port.h @@ -43,6 +43,11 @@ extern uint32_t _ebss; safe_mode_t port_init(void); +// If the port does not initialize the heap during port_init(), it must provide +// this function which is called after CIRCUITPY is mounted. +// If not required, a default (weak) implementation that does nothing is used. +safe_mode_t port_heap_init(safe_mode_t); + // Reset the microcontroller completely. void reset_cpu(void) NORETURN; From 5869af395e45d61e19b4602c159d81fee2a9420d Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Tue, 5 Sep 2023 22:39:41 +0300 Subject: [PATCH 1625/1712] Wifi fully seperate from web-workflow --- docs/workflows.md | 14 ++- supervisor/shared/web_workflow/web_workflow.c | 113 ++++++++++-------- supervisor/shared/web_workflow/web_workflow.h | 2 +- supervisor/shared/workflow.c | 5 +- 4 files changed, 72 insertions(+), 62 deletions(-) diff --git a/docs/workflows.md b/docs/workflows.md index 10d2897870..30fa07df9f 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -68,12 +68,14 @@ conflicts with user created NUS services. Read-only characteristic that returns the UTF-8 encoded version string. ## Web +If the keys `CIRCUITPY_WIFI_SSID` and `CIRCUITPY_WIFI_PASSWORD` are set in `settings.toml`, +CircuitPython will automatically connect to the given Wi-Fi network on boot and upon reload. -The web workflow is depends on adding Wi-Fi credentials into the `settings.toml` file. The keys are -`CIRCUITPY_WIFI_SSID` and `CIRCUITPY_WIFI_PASSWORD`. Once these are defined, CircuitPython will -automatically connect to the network and start the webserver used for the workflow. The webserver -is on port 80 unless overridden by `CIRCUITPY_WEB_API_PORT`. It also enables MDNS. The name -of the board as advertised to the network can be overridden by `CIRCUITPY_WEB_INSTANCE_NAME`. +If `CIRCUITPY_WEB_API_PASSWORD` is also set, the web workflow will also start. +The web workflow will only be enabled if the Wi-Fi connection succeeds upon boot. + +The webserver is on port 80 unless overridden by `CIRCUITPY_WEB_API_PORT`. It also enables MDNS. +The name of the board as advertised to the network can be overridden by `CIRCUITPY_WEB_INSTANCE_NAME`. Here is an example `/settings.toml`: @@ -82,7 +84,7 @@ Here is an example `/settings.toml`: CIRCUITPY_WIFI_SSID="scottswifi" CIRCUITPY_WIFI_PASSWORD="secretpassword" -# To enable modifying files from the web. Change this too! +# To enable the the webserver. Change this too! # Leave the User field blank in the browser. CIRCUITPY_WEB_API_PASSWORD="passw0rd" diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index 15c60a1cbf..2a8133a562 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -258,19 +258,9 @@ void supervisor_web_workflow_status(void) { } #endif -bool supervisor_start_web_workflow(void) { +bool supervisor_start_web_workflow(bool reload) { #if CIRCUITPY_WEB_WORKFLOW && CIRCUITPY_WIFI && CIRCUITPY_OS_GETENV - // Skip starting the workflow if we're not starting from power on or reset. - const mcu_reset_reason_t reset_reason = common_hal_mcu_processor_get_reset_reason(); - if (reset_reason != RESET_REASON_POWER_ON && - reset_reason != RESET_REASON_RESET_PIN && - reset_reason != RESET_REASON_DEEP_SLEEP_ALARM && - reset_reason != RESET_REASON_UNKNOWN && - reset_reason != RESET_REASON_SOFTWARE) { - return false; - } - char ssid[33]; char password[64]; @@ -287,11 +277,6 @@ bool supervisor_start_web_workflow(void) { return false; } - result = common_hal_os_getenv_str("CIRCUITPY_WEB_INSTANCE_NAME", web_instance_name, sizeof(web_instance_name)); - if (result != GETENV_OK || web_instance_name[0] == '\0') { - strcpy(web_instance_name, MICROPY_HW_BOARD_NAME); - } - if (!common_hal_wifi_radio_get_enabled(&common_hal_wifi_radio_obj)) { common_hal_wifi_init(false); common_hal_wifi_radio_set_enabled(&common_hal_wifi_radio_obj, true); @@ -303,6 +288,7 @@ bool supervisor_start_web_workflow(void) { // We can all connect again because it will return early if we're already connected to the // network. If we are connected to a different network, then it will disconnect before // attempting to connect to the given network. + _wifi_status = common_hal_wifi_radio_connect( &common_hal_wifi_radio_obj, (uint8_t *)ssid, strlen(ssid), (uint8_t *)password, strlen(password), 0, 8, NULL, 0); @@ -312,21 +298,36 @@ bool supervisor_start_web_workflow(void) { return false; } - // (leaves new_port unchanged on any failure) - (void)common_hal_os_getenv_int("CIRCUITPY_WEB_API_PORT", &web_api_port); - - const size_t api_password_len = sizeof(_api_password) - 1; - result = common_hal_os_getenv_str("CIRCUITPY_WEB_API_PASSWORD", _api_password + 1, api_password_len); - if (result == GETENV_OK) { - _api_password[0] = ':'; - _base64_in_place(_api_password, strlen(_api_password), sizeof(_api_password) - 1); - } else { + // Skip starting the workflow if we're not starting from power on or reset. + const mcu_reset_reason_t reset_reason = common_hal_mcu_processor_get_reset_reason(); + if (reset_reason != RESET_REASON_POWER_ON && + reset_reason != RESET_REASON_RESET_PIN && + reset_reason != RESET_REASON_DEEP_SLEEP_ALARM && + reset_reason != RESET_REASON_UNKNOWN && + reset_reason != RESET_REASON_SOFTWARE) { return false; } - bool first_start = pool.base.type != &socketpool_socketpool_type; + bool initialized = pool.base.type == &socketpool_socketpool_type; + + if (!initialized && !reload) { + result = common_hal_os_getenv_str("CIRCUITPY_WEB_INSTANCE_NAME", web_instance_name, sizeof(web_instance_name)); + if (result != GETENV_OK || web_instance_name[0] == '\0') { + strcpy(web_instance_name, MICROPY_HW_BOARD_NAME); + } + + // (leaves new_port unchanged on any failure) + (void)common_hal_os_getenv_int("CIRCUITPY_WEB_API_PORT", &web_api_port); + + const size_t api_password_len = sizeof(_api_password) - 1; + result = common_hal_os_getenv_str("CIRCUITPY_WEB_API_PASSWORD", _api_password + 1, api_password_len); + if (result == GETENV_OK) { + _api_password[0] = ':'; + _base64_in_place(_api_password, strlen(_api_password), sizeof(_api_password) - 1); + } else { // Skip starting web-workflow when no password is passed. + return false; + } - if (first_start) { pool.base.type = &socketpool_socketpool_type; common_hal_socketpool_socketpool_construct(&pool, &common_hal_wifi_radio_obj); @@ -336,36 +337,42 @@ bool supervisor_start_web_workflow(void) { websocket_init(); } - if (!common_hal_socketpool_socket_get_closed(&active)) { - common_hal_socketpool_socket_close(&active); - } + initialized = pool.base.type == &socketpool_socketpool_type; - #if CIRCUITPY_MDNS - // Try to start MDNS if the user deinited it. - if (mdns.base.type != &mdns_server_type || - common_hal_mdns_server_deinited(&mdns)) { - mdns_server_construct(&mdns, true); - mdns.base.type = &mdns_server_type; - if (!common_hal_mdns_server_deinited(&mdns)) { - common_hal_mdns_server_set_instance_name(&mdns, web_instance_name); + if (initialized){ + if (!common_hal_socketpool_socket_get_closed(&active)) { + common_hal_socketpool_socket_close(&active); } - } - if (!common_hal_mdns_server_deinited(&mdns)) { - common_hal_mdns_server_advertise_service(&mdns, "_circuitpython", "_tcp", web_api_port); - } - #endif - if (common_hal_socketpool_socket_get_closed(&listening)) { - socketpool_socket(&pool, SOCKETPOOL_AF_INET, SOCKETPOOL_SOCK_STREAM, &listening); - common_hal_socketpool_socket_settimeout(&listening, 0); - // Bind to any ip. (Not checking for failures) - common_hal_socketpool_socket_bind(&listening, "", 0, web_api_port); - common_hal_socketpool_socket_listen(&listening, 1); + #if CIRCUITPY_MDNS + // Try to start MDNS if the user deinited it. + if (mdns.base.type != &mdns_server_type || + common_hal_mdns_server_deinited(&mdns) || + reload) { // Always reconstruct on reload, since we don't know if the net changed. + mdns_server_construct(&mdns, true); + mdns.base.type = &mdns_server_type; + if (!common_hal_mdns_server_deinited(&mdns)) { + common_hal_mdns_server_set_instance_name(&mdns, web_instance_name); + } + } + if (!common_hal_mdns_server_deinited(&mdns)) { + common_hal_mdns_server_advertise_service(&mdns, "_circuitpython", "_tcp", web_api_port); + } + #endif + + if (common_hal_socketpool_socket_get_closed(&listening)) { + socketpool_socket(&pool, SOCKETPOOL_AF_INET, SOCKETPOOL_SOCK_STREAM, &listening); + common_hal_socketpool_socket_settimeout(&listening, 0); + // Bind to any ip. (Not checking for failures) + common_hal_socketpool_socket_bind(&listening, "", 0, web_api_port); + common_hal_socketpool_socket_listen(&listening, 1); + } + // Wake polling thread (maybe) + socketpool_socket_poll_resume(); + #endif + return true; } - // Wake polling thread (maybe) - socketpool_socket_poll_resume(); - #endif - return true; + return false; } void web_workflow_send_raw(socketpool_socket_obj_t *socket, const uint8_t *buf, int len) { diff --git a/supervisor/shared/web_workflow/web_workflow.h b/supervisor/shared/web_workflow/web_workflow.h index c325c0ff5d..a3b8f45c20 100644 --- a/supervisor/shared/web_workflow/web_workflow.h +++ b/supervisor/shared/web_workflow/web_workflow.h @@ -36,7 +36,7 @@ void supervisor_web_workflow_background(void *data); bool supervisor_web_workflow_status_dirty(void); void supervisor_web_workflow_status(void); -bool supervisor_start_web_workflow(void); +bool supervisor_start_web_workflow(bool); void supervisor_stop_web_workflow(void); // Share the MDNS object with user code. diff --git a/supervisor/shared/workflow.c b/supervisor/shared/workflow.c index b4e7852b2a..10af20f0cf 100644 --- a/supervisor/shared/workflow.c +++ b/supervisor/shared/workflow.c @@ -56,8 +56,9 @@ void supervisor_workflow_reset(void) { #endif #if CIRCUITPY_WEB_WORKFLOW + bool result = supervisor_start_web_workflow(true); if (workflow_background_cb.fun) { - if (supervisor_start_web_workflow()) { + if (result) { supervisor_workflow_request_background(); } } @@ -105,7 +106,7 @@ void supervisor_workflow_start(void) { #endif #if CIRCUITPY_WEB_WORKFLOW - if (supervisor_start_web_workflow()) { + if (supervisor_start_web_workflow(false)) { // Enable background callbacks if web_workflow startup successful memset(&workflow_background_cb, 0, sizeof(workflow_background_cb)); workflow_background_cb.fun = supervisor_web_workflow_background; From 9d191b52232959309e83981b7d7ccce2979a6fac Mon Sep 17 00:00:00 2001 From: xXx Date: Mon, 4 Sep 2023 08:44:23 +0000 Subject: [PATCH 1626/1712] Translated using Weblate (Russian) Currently translated at 100.0% (1000 of 1000 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ru/ --- locale/ru.po | 89 +++++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 43 deletions(-) diff --git a/locale/ru.po b/locale/ru.po index 5fd796a4c3..e1a5d75074 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-09-03 02:59+0000\n" +"PO-Revision-Date: 2023-09-05 20:12+0000\n" "Last-Translator: xXx \n" "Language-Team: none\n" "Language: ru\n" @@ -609,7 +609,7 @@ msgstr "Преобразование звука не реализовано" #: shared-bindings/wifi/Radio.c msgid "AuthMode.OPEN is not used with password" -msgstr "AuthMode.OPEN не используется с паролем" +msgstr "Режим авторизации.OPEN не используется с паролем" #: shared-bindings/wifi/Radio.c supervisor/shared/web_workflow/web_workflow.c msgid "Authentication failure" @@ -875,7 +875,7 @@ msgstr "Координатные массивы имеют разные длин #: shared-bindings/bitmaptools/__init__.c msgid "Coordinate arrays types have different sizes" -msgstr "Типы координат имеют разные размеры" +msgstr "Типы массивов координат имеют разные размеры" #: ports/espressif/common-hal/neopixel_write/__init__.c msgid "Could not retrieve clock" @@ -936,7 +936,7 @@ msgstr "" #: shared-bindings/audiobusio/PDMIn.c msgid "Destination capacity is smaller than destination_length." -msgstr "Емкость места назначения меньше чем Destination_length." +msgstr "Емкость места назначения меньше длины места назначения." #: ports/nrf/common-hal/audiobusio/I2SOut.c msgid "Device in use" @@ -1005,7 +1005,7 @@ msgstr "Расширенные объявления с ответом скани #: extmod/ulab/code/numpy/fft/fft_tools.c msgid "FFT is defined for ndarrays only" -msgstr "FFT определено только для массивов nd" +msgstr "FFT определено только для массивов ndarrays" #: extmod/ulab/code/numpy/fft/fft_tools.c msgid "FFT is implemented for linear arrays only" @@ -1114,8 +1114,8 @@ msgstr "" #: shared-bindings/pwmio/PWMOut.c msgid "Frequency must match existing PWMOut using this timer" msgstr "" -"Частота должна соответствовать существующему PWMOut с использованием этого " -"таймера" +"Частота должна соответствовать существующему выходу PWM с использованием " +"этого таймера" #: shared-bindings/bitbangio/I2C.c shared-bindings/bitbangio/SPI.c #: shared-bindings/busio/I2C.c shared-bindings/busio/SPI.c @@ -2001,7 +2001,7 @@ msgstr "Фрагменты не поддерживаются" #: ports/espressif/common-hal/socketpool/SocketPool.c #: ports/raspberrypi/common-hal/socketpool/SocketPool.c msgid "SocketPool can only be used with wifi.radio" -msgstr "Пул сокетов можно использовать только с wifi.radio" +msgstr "SocketPool можно использовать только с wifi.radio" #: shared-bindings/aesio/aes.c msgid "Source and destination buffers must be the same length" @@ -2518,11 +2518,11 @@ msgstr "arg — пустая последовательность" #: py/objobject.c msgid "arg must be user-type" -msgstr "ARG должен быть пользовательского типа" +msgstr "arg должен быть пользовательского типа" #: extmod/ulab/code/numpy/numerical.c msgid "argsort argument must be an ndarray" -msgstr "Аргумент сортировки arg должен быть массивом nd" +msgstr "аргумент сортировки должен быть аргументом массива ndarray" #: extmod/ulab/code/numpy/numerical.c msgid "argsort is not implemented for flattened arrays" @@ -2547,7 +2547,7 @@ msgstr "аргумент должен быть '%q', а не '%q'" #: extmod/ulab/code/numpy/numerical.c extmod/ulab/code/numpy/transform.c msgid "arguments must be ndarrays" -msgstr "аргументы должны быть массивами" +msgstr "Аргументы должны быть массивами ndarrays" #: extmod/ulab/code/ndarray.c msgid "array and index length must be equal" @@ -2572,11 +2572,15 @@ msgstr "Переполнение ASM" #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" -msgstr "Попытка получить (arg)min/(arg)max пустой последовательности" +msgstr "" +"Попытка получить (аргумент)минимальный/(аргумент)максимальный пустой " +"последовательности" #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get argmin/argmax of an empty sequence" -msgstr "Попытка получить argmin/argmax пустой последовательности" +msgstr "" +"Попытка получить аргумент минимальный/аргумент максимальный пустой " +"последовательности" #: py/objstr.c msgid "attributes not supported yet" @@ -2833,7 +2837,7 @@ msgstr "Не удается привести выходные данные с п #: extmod/ulab/code/ndarray.c msgid "cannot convert complex to dtype" -msgstr "невозможно преобразовать комплекс в тип d" +msgstr "не может превратить комплекс в dtype" #: extmod/ulab/code/ndarray.c msgid "cannot convert complex type" @@ -2904,7 +2908,7 @@ msgstr "Цветовой буфер должен быть буфером, кор #: shared-bindings/displayio/Palette.c msgid "color buffer must be a bytearray or array of type 'b' or 'B'" msgstr "" -"цветовой буфер должен быть предплечьем или массивом типа \"b\" или \"B\"" +"цветовой буфер должен быть байтом массива или массивом типа \"b\" или \"B\"" #: shared-bindings/displayio/Palette.c msgid "color must be between 0x000000 and 0xffffff" @@ -2932,7 +2936,7 @@ msgstr "Аргументы свертки должны быть линейным #: extmod/ulab/code/numpy/filter.c msgid "convolve arguments must be ndarrays" -msgstr "Аргументы свертки должны быть линейными массивами nd" +msgstr "переплетение аргументов должно быть массивами ndarrays" #: extmod/ulab/code/numpy/filter.c msgid "convolve arguments must not be empty" @@ -2987,7 +2991,7 @@ msgstr "По умолчанию не является функцией" msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" msgstr "" -"буфер назначения должен быть байтером или массивом типа \"B\" для " +"буфер назначения должен быть байтоммассива или массивом типа \"B\" для " "бит_глубины = 8" #: shared-bindings/audiobusio/PDMIn.c @@ -3000,7 +3004,7 @@ msgstr "последовательность обновления дикта и #: extmod/ulab/code/numpy/numerical.c msgid "diff argument must be an ndarray" -msgstr "Аргумент diff должен быть массивом nd" +msgstr "аргумент DIFF должен быть массивом ndarray" #: extmod/ulab/code/numpy/numerical.c msgid "differentiation order out of range" @@ -3131,11 +3135,11 @@ msgstr "первый аргумент должен быть функцией" #: extmod/ulab/code/numpy/create.c msgid "first argument must be a tuple of ndarrays" -msgstr "первый аргумент должен быть кортежем из nd массивов" +msgstr "Первый аргумент должен быть кортежом массива ndarrays" #: extmod/ulab/code/numpy/transform.c extmod/ulab/code/numpy/vector.c msgid "first argument must be an ndarray" -msgstr "первый аргумент должен быть массивом nd" +msgstr "Первым аргументом должен быть массивом ndarray" #: py/objtype.c msgid "first argument to super() must be type" @@ -3143,7 +3147,7 @@ msgstr "первый аргумент супер() должен быть тип #: extmod/ulab/code/scipy/linalg/linalg.c msgid "first two arguments must be ndarrays" -msgstr "первые два аргумента должны быть массивами nd" +msgstr "Первые два аргумента должны быть массивами ndarrays" #: extmod/ulab/code/ndarray.c msgid "flattening order must be either 'C', or 'F'" @@ -3151,7 +3155,7 @@ msgstr "порядок сглаживания должен быть либо 'C' #: extmod/ulab/code/numpy/numerical.c msgid "flip argument must be an ndarray" -msgstr "аргумент переворота должен быть массивом nd" +msgstr "Флип -аргумент должен быть массивом ndarray" #: py/objint.c msgid "float too big" @@ -3192,11 +3196,11 @@ msgstr "функция имеет один и тот же знак в конце #: extmod/ulab/code/ndarray.c msgid "function is defined for ndarrays only" -msgstr "функция определена только для массивов nd" +msgstr "Функция определяется только для массивов ndarrays" #: extmod/ulab/code/numpy/carray/carray.c msgid "function is implemented for ndarrays only" -msgstr "функция реализована только для массивов nd" +msgstr "Функция реализована только для массивов ndarrays" #: py/argcheck.c #, c-format @@ -3366,19 +3370,19 @@ msgstr "Вход должен быть 1- или 2-D" #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be a 1D ndarray" -msgstr "входные данные должны быть 1D-массивом nd" +msgstr "Ввод должен быть 1D массивом ndarray" #: extmod/ulab/code/scipy/linalg/linalg.c extmod/ulab/code/user/user.c msgid "input must be a dense ndarray" -msgstr "входные данные должны быть плотным массивом nd" +msgstr "Ввод должен быть плотным массивом ndarray" #: extmod/ulab/code/user/user.c msgid "input must be an ndarray" -msgstr "ввод должен быть массивом nd" +msgstr "Ввод должен быть массивом ndarray" #: extmod/ulab/code/numpy/carray/carray.c msgid "input must be an ndarray, or a scalar" -msgstr "входные данные должны быть массивом nd или скаляром" +msgstr "Ввод должен быть массивом ndarray или скаляр" #: extmod/ulab/code/scipy/signal/signal.c msgid "input must be one-dimensional" @@ -3390,8 +3394,7 @@ msgstr "Входные данные должны быть квадратной #: extmod/ulab/code/numpy/numerical.c msgid "input must be tuple, list, range, or ndarray" -msgstr "" -"входные данные должны быть кортежем, списком, диапазоном или массивом nd" +msgstr "Ввод должен быть кортеж, список, диапазон или массивом ndarray" #: extmod/ulab/code/numpy/poly.c msgid "input vectors must be of equal length" @@ -3544,7 +3547,7 @@ msgstr "mDNS уже инициализирован" #: ports/espressif/common-hal/mdns/Server.c #: ports/raspberrypi/common-hal/mdns/Server.c msgid "mDNS only works with built-in WiFi" -msgstr "mDNS работает только со встроенным Wi-Fi" +msgstr "mDNS работает только со встроенным WiFi" #: py/parse.c msgid "malformed f-string" @@ -3587,7 +3590,7 @@ msgstr "макситер должен быть > 0" #: extmod/ulab/code/numpy/numerical.c msgid "median argument must be an ndarray" -msgstr "Медианный аргумент должен быть массивом nd" +msgstr "Средний аргумент должен быть массивом ndarray" #: py/runtime.c #, c-format @@ -3656,7 +3659,7 @@ msgstr "родной урожай" #: extmod/ulab/code/ndarray.c msgid "ndarray length overflows" -msgstr "Переполнение длины массива nd" +msgstr "Переполнение длины массива ndarray" #: py/runtime.c #, c-format @@ -3714,7 +3717,7 @@ msgstr "нет такого атрибута" #: ports/espressif/common-hal/_bleio/Connection.c #: ports/nrf/common-hal/_bleio/Connection.c msgid "non-UUID found in service_uuids_whitelist" -msgstr "не-UUID найден в service_uuids_whitelist" +msgstr "не-UUID найден в сервисе_uuids_белый список" #: py/compile.c msgid "non-default argument follows default argument" @@ -3847,7 +3850,7 @@ msgstr "Поддерживается только моно" #: extmod/ulab/code/numpy/create.c msgid "only ndarrays can be concatenated" -msgstr "только nd массивы могут быть объединены" +msgstr "только массивы ndarrays могут быть объединены" #: ports/stm/common-hal/audiobusio/PDMIn.c msgid "only oversample=64 is supported" @@ -3879,7 +3882,7 @@ msgstr "операция определена только для 2D-масси #: extmod/ulab/code/numpy/linalg/linalg.c msgid "operation is defined for ndarrays only" -msgstr "операция определена только для массивов nd" +msgstr "операция определена только для массивов ndarrays" #: extmod/ulab/code/ndarray.c msgid "operation is implemented for 1D Boolean arrays only" @@ -3887,7 +3890,7 @@ msgstr "операция реализована только для 1D логи #: extmod/ulab/code/numpy/numerical.c msgid "operation is not implemented on ndarrays" -msgstr "операция не реализована на массивах nd" +msgstr "операция не реализована на массивах ndarrays" #: extmod/ulab/code/ndarray.c msgid "operation is not supported for given type" @@ -3920,7 +3923,7 @@ msgstr "Out должен быть плотным массивом с плава #: extmod/ulab/code/numpy/vector.c msgid "out must be an ndarray" -msgstr "Входные данные должны быть массивом nd" +msgstr "out должен быть массивом ndarray" #: extmod/ulab/code/numpy/vector.c msgid "out must be of float dtype" @@ -4041,7 +4044,7 @@ msgstr "rgb_pins[%d] не находится на том же порту что #: extmod/ulab/code/numpy/numerical.c msgid "roll argument must be an ndarray" -msgstr "Аргумент roll должен быть массивом nd" +msgstr "аргумент roll должен быть массивом ndarray" #: py/objstr.c msgid "rsplit(None,n)" @@ -4082,7 +4085,7 @@ msgstr "Знак не разрешен со спецификатором цел #: extmod/ulab/code/ulab_tools.c msgid "size is defined for ndarrays only" -msgstr "Размер определяется только для массивов nd" +msgstr "размер определен только для массива ndarrays" #: shared-bindings/time/__init__.c msgid "sleep length must be non-negative" @@ -4106,11 +4109,11 @@ msgstr "Мягкая перезагрузка\n" #: extmod/ulab/code/numpy/numerical.c msgid "sort argument must be an ndarray" -msgstr "Аргумент сортировки должен быть массивом nd" +msgstr "аргумент сортировки должен быть массивом ndarray" #: extmod/ulab/code/scipy/signal/signal.c msgid "sos array must be of shape (n_section, 6)" -msgstr "Массив SOS должен иметь форму (n_section, 6)" +msgstr "Массив sos должен иметь форму (n_section, 6)" #: extmod/ulab/code/scipy/signal/signal.c msgid "sos[:, 3] should be all ones" @@ -4455,7 +4458,7 @@ msgstr "x Создать задачу не удалось" #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be an ndarray" -msgstr "zi должен быть массивом nd" +msgstr "зи, должно быть, массивом ndarray" #: extmod/ulab/code/scipy/signal/signal.c msgid "zi must be of float type" From a75996a98cd2c7c9c2a8aeb9e3515816eebbdbeb Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 5 Sep 2023 23:29:27 +0200 Subject: [PATCH 1627/1712] 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 | 15 +++++++++------ locale/cs.po | 12 ++++++------ locale/de_DE.po | 15 +++++++++------ locale/el.po | 12 ++++++------ locale/en_GB.po | 15 +++++++++------ locale/es.po | 15 +++++++++------ locale/fil.po | 15 +++++++++------ locale/fr.po | 15 +++++++++------ locale/hi.po | 12 ++++++------ locale/it_IT.po | 15 +++++++++------ locale/ja.po | 15 +++++++++------ locale/ko.po | 12 ++++++------ locale/nl.po | 15 +++++++++------ locale/pl.po | 15 +++++++++------ locale/pt_BR.po | 15 +++++++++------ locale/ru.po | 34 +++++++++++++++++++++------------- locale/sv.po | 15 +++++++++------ locale/tr.po | 12 ++++++------ locale/zh_Latn_pinyin.po | 15 +++++++++------ 19 files changed, 168 insertions(+), 121 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 19484df074..e4b9559f65 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -92,13 +92,17 @@ msgstr "" "%d pin alamat, %d rgb pin dan %d ubin menunjukkan ketinggian %d, bukan %d" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -2974,7 +2978,7 @@ msgstr "" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "heap kosong" @@ -3926,10 +3930,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "antrian meluap (overflow)" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" @@ -4393,6 +4393,9 @@ msgstr "zi harus berjenis float" msgid "zi must be of shape (n_section, 2)" msgstr "Zi harus berbentuk (n_section, 2)" +#~ msgid "queue overflow" +#~ msgstr "antrian meluap (overflow)" + #~ msgid "Buffer is too small" #~ msgstr "Buffer terlalu kecil" diff --git a/locale/cs.po b/locale/cs.po index 0c22cfffbe..a71c63adea 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -93,13 +93,17 @@ msgid "" msgstr "%d adresní pin, %d rgb pin a %d dlaždice indikuje výšku %d, ne %d" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -2961,7 +2965,7 @@ msgstr "" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "" @@ -3912,10 +3916,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 26ab1022ce..5ad4b0ba95 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -98,13 +98,17 @@ msgstr "" "nicht %d" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -3025,7 +3029,7 @@ msgstr "leer" msgid "empty file" msgstr "Leere Datei" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "leerer heap" @@ -3992,10 +3996,6 @@ msgstr "pow() mit 3 Argumenten erfordert ganze Zahlen" msgid "pull masks conflict with direction masks" msgstr "Pull-Masken kollidieren mit Richtungsmasken" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "Warteschlangenüberlauf" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "unformatierte F-Strings werden nicht unterstützt" @@ -4461,6 +4461,9 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "queue overflow" +#~ msgstr "Warteschlangenüberlauf" + #~ msgid "Stopping AP is not supported." #~ msgstr "Das Stoppen des AP wird nicht unterstützt." diff --git a/locale/el.po b/locale/el.po index 657ab83f20..e2fa69ec51 100644 --- a/locale/el.po +++ b/locale/el.po @@ -101,13 +101,17 @@ msgstr "" "%d pin διεύθυνσης, %d rgb ping και %d πλακίδια αναδεικνύουν ύψος %d, όχι %d" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -2974,7 +2978,7 @@ msgstr "" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "" @@ -3925,10 +3929,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index 73b5028849..fd18f4812a 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -99,13 +99,17 @@ msgstr "" "%d address pins, %d rgb pins and %d tiles indicate a height of %d, not %d" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -2984,7 +2988,7 @@ msgstr "empty" msgid "empty file" msgstr "empty file" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "empty heap" @@ -3937,10 +3941,6 @@ msgstr "pow() with 3 arguments requires integers" msgid "pull masks conflict with direction masks" msgstr "pull masks conflict with direction masks" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "queue overflow" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "raw f-strings are not supported" @@ -4404,6 +4404,9 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "queue overflow" +#~ msgstr "queue overflow" + #~ msgid "Stopping AP is not supported." #~ msgstr "Stopping AP is not supported." diff --git a/locale/es.po b/locale/es.po index 8066a3bba5..a4cc31a820 100644 --- a/locale/es.po +++ b/locale/es.po @@ -104,13 +104,17 @@ msgstr "" "no de %d" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -3031,7 +3035,7 @@ msgstr "vacío" msgid "empty file" msgstr "archivo vacio" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "heap vacío" @@ -3989,10 +3993,6 @@ msgstr "pow() con 3 argumentos requiere enteros" msgid "pull masks conflict with direction masks" msgstr "máscara de pull en conflicto con máscara de dirección" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "desbordamiento de cola(queue)" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "raw f-strings no esta soportadas" @@ -4457,6 +4457,9 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "queue overflow" +#~ msgstr "desbordamiento de cola(queue)" + #~ msgid "Stopping AP is not supported." #~ msgstr "Parar el AP no esta soportado." diff --git a/locale/fil.po b/locale/fil.po index 226de0e449..123d399267 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -90,13 +90,17 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -2975,7 +2979,7 @@ msgstr "walang laman" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "walang laman ang heap" @@ -3933,10 +3937,6 @@ msgstr "pow() na may 3 argumento kailangan ng integers" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "puno na ang pila (overflow)" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" @@ -4400,6 +4400,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "queue overflow" +#~ msgstr "puno na ang pila (overflow)" + #~ msgid "pixel_shader must be displayio.Palette or displayio.ColorConverter" #~ msgstr "pixel_shader ay dapat displayio.Palette o displayio.ColorConverter" diff --git a/locale/fr.po b/locale/fr.po index 55e1cad427..fe501834dd 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -101,13 +101,17 @@ msgstr "" "%d, et non %d" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -3045,7 +3049,7 @@ msgstr "vide" msgid "empty file" msgstr "fichier vide" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "tas vide" @@ -4009,10 +4013,6 @@ msgstr "pow() avec 3 arguments nécessite des entiers" msgid "pull masks conflict with direction masks" msgstr "masque pull est en conflit avec les masques de direction" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "dépassement de file" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "les f-strings bruts ne sont pas supportées" @@ -4477,6 +4477,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 "queue overflow" +#~ msgstr "dépassement de file" + #~ msgid "Stopping AP is not supported." #~ msgstr "Stopper n'est pas supporté." diff --git a/locale/hi.po b/locale/hi.po index 8b6daab54f..b2041ad82e 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -89,13 +89,17 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -2948,7 +2952,7 @@ msgstr "" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "" @@ -3899,10 +3903,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index e0f719cb5a..4801b2e158 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -93,13 +93,17 @@ msgstr "" "%d pin indirizzo, %d pin rgb e %d tessere indicano l'altezza di %d, non %d" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -2980,7 +2984,7 @@ msgstr "vuoto" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "heap vuoto" @@ -3943,10 +3947,6 @@ msgstr "pow() con 3 argomenti richiede interi" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "overflow della coda" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" @@ -4410,6 +4410,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "queue overflow" +#~ msgstr "overflow della coda" + #~ msgid "'coroutine' object is not an iterator" #~ msgstr "L'oggetto 'coroutine' non è un iteratore" diff --git a/locale/ja.po b/locale/ja.po index 90608bca7e..aa5bf7a2f5 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -95,13 +95,17 @@ msgid "" msgstr "%dアドレスピン、%dRGBピン、%dタイルは%dの高さを指示する。%dではない。" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -2967,7 +2971,7 @@ msgstr "" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "" @@ -3919,10 +3923,6 @@ msgstr "pow()の第3引数には整数が必要" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "キューがオーバーフローしました" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" @@ -4386,6 +4386,9 @@ msgstr "ziはfloat値でなければなりません" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "queue overflow" +#~ msgstr "キューがオーバーフローしました" + #~ msgid "'coroutine' object is not an iterator" #~ msgstr "'coroutine' オブジェクトはイテレータではありません" diff --git a/locale/ko.po b/locale/ko.po index 0f1329a029..4ee9a3e872 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -90,13 +90,17 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -2952,7 +2956,7 @@ msgstr "" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "" @@ -3903,10 +3907,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 424b229068..edfc54cfe8 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -89,13 +89,17 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -2976,7 +2980,7 @@ msgstr "leeg" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "lege heap" @@ -3931,10 +3935,6 @@ msgstr "pow() met 3 argumenten vereist integers" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "wachtrij overloop" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" @@ -4398,6 +4398,9 @@ msgstr "zi moet van type float zijn" msgid "zi must be of shape (n_section, 2)" msgstr "zi moet vorm (n_section, 2) hebben" +#~ msgid "queue overflow" +#~ msgstr "wachtrij overloop" + #~ msgid "'coroutine' object is not an iterator" #~ msgstr "'coroutine' object is geen iterator" diff --git a/locale/pl.po b/locale/pl.po index 80067e391b..f918f5a345 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -91,13 +91,17 @@ msgid "" msgstr "" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -2955,7 +2959,7 @@ msgstr "puste" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "pusta sterta" @@ -3906,10 +3910,6 @@ msgstr "trzyargumentowe pow() wymaga liczb całkowitych" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "przepełnienie kolejki" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" @@ -4373,6 +4373,9 @@ msgstr "" msgid "zi must be of shape (n_section, 2)" msgstr "" +#~ msgid "queue overflow" +#~ msgstr "przepełnienie kolejki" + #~ msgid "Buffer is too small" #~ msgstr "Bufor jest za mały" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 18dfbc65ce..83f1a4a95a 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -102,13 +102,17 @@ msgstr "" "não %d" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -3034,7 +3038,7 @@ msgstr "vazio" msgid "empty file" msgstr "arquivo vazio" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "a área de alocação dinâmica de variáveis (heap) está vazia" @@ -3998,10 +4002,6 @@ msgstr "o pow() com 3 argumentos requer números inteiros" msgid "pull masks conflict with direction masks" msgstr "puxe as máscaras em conflito com as máscaras de direção" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "estouro de fila" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "os f-strings brutos não são suportados" @@ -4465,6 +4465,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 "queue overflow" +#~ msgstr "estouro de fila" + #~ msgid "Stopping AP is not supported." #~ msgstr "Não há suporte para a interrupção do AP." diff --git a/locale/ru.po b/locale/ru.po index e1a5d75074..9991c01e7f 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " -"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 5.0.1-dev\n" #: main.c @@ -104,13 +104,17 @@ msgstr "" "%d" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -759,7 +763,8 @@ msgstr "" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Can only alarm on two low pins from deep sleep." -msgstr "Из глубокого сна может сигнализировать только по двум низким контактам." +msgstr "" +"Из глубокого сна может сигнализировать только по двум низким контактам." #: ports/espressif/common-hal/_bleio/Characteristic.c #: ports/nrf/common-hal/_bleio/Characteristic.c @@ -839,7 +844,8 @@ msgstr "Невозможно изменить частоту на таймере #: ports/nrf/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge, only level" -msgstr "Невозможно проснуться по изменению логического уровня, только по уровню" +msgstr "" +"Невозможно проснуться по изменению логического уровня, только по уровню" #: ports/espressif/common-hal/alarm/pin/PinAlarm.c msgid "Cannot wake on pin edge. Only level." @@ -1815,7 +1821,8 @@ msgstr "Полигону необходимо как минимум 3 точки #: supervisor/shared/safe_mode.c msgid "Power dipped. Make sure you are providing enough power." -msgstr "Мощность просела. Убедитесь, что вы обеспечиваете достаточную мощность." +msgstr "" +"Мощность просела. Убедитесь, что вы обеспечиваете достаточную мощность." #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" @@ -2701,7 +2708,8 @@ msgstr "Можно указать только одно неизвестное #: py/objtype.c msgid "can't add special method to already-subclassed class" -msgstr "Не удается добавить специальный метод к уже имеющемуся подклассу классу" +msgstr "" +"Не удается добавить специальный метод к уже имеющемуся подклассу классу" #: py/compile.c msgid "can't assign to expression" @@ -2996,7 +3004,8 @@ msgstr "" #: shared-bindings/audiobusio/PDMIn.c msgid "destination buffer must be an array of type 'H' for bit_depth = 16" -msgstr "буфер назначения должен быть массивом типа «H» для битовой_глубины = 16" +msgstr "" +"буфер назначения должен быть массивом типа «H» для битовой_глубины = 16" #: py/objdict.c msgid "dict update sequence has wrong length" @@ -3038,7 +3047,7 @@ msgstr "пусто" msgid "empty file" msgstr "пустой файл" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "пустая куча" @@ -3999,10 +4008,6 @@ msgstr "pow() с 3 аргументами требует целых чисел" msgid "pull masks conflict with direction masks" msgstr "Маски вытягивания конфликтуют с масками направления" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "Переполнение очереди" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "Необработанные F-строки не поддерживаются" @@ -4468,6 +4473,9 @@ msgstr "zi должно быть типа float" msgid "zi must be of shape (n_section, 2)" msgstr "zi должен иметь форму (n_section, 2)" +#~ msgid "queue overflow" +#~ msgstr "Переполнение очереди" + #~ msgid "'coroutine' object is not an iterator" #~ msgstr "Объект 'coroutine' не является итератором" diff --git a/locale/sv.po b/locale/sv.po index 10ff982bad..44dec9a9e8 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -101,13 +101,17 @@ msgstr "" "%d adresspinnar, %d rgb-pinnar och %d brickor anger en höjd på %d, inte %d" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -3001,7 +3005,7 @@ msgstr "tom" msgid "empty file" msgstr "tom fil" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "tom heap" @@ -3957,10 +3961,6 @@ msgstr "pow() med 3 argument kräver heltal" msgid "pull masks conflict with direction masks" msgstr "pull-mask är i konflikt med riktnings-mask" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "köstorlek överskreds" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "råa f-strängar stöds inte" @@ -4424,6 +4424,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 "queue overflow" +#~ msgstr "köstorlek överskreds" + #~ msgid "Stopping AP is not supported." #~ msgstr "Stoppa AP stöds inte." diff --git a/locale/tr.po b/locale/tr.po index 6f245c9862..c55b90b95d 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -97,13 +97,17 @@ msgstr "" "gösterir, %d'nin değil" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -2968,7 +2972,7 @@ msgstr "" msgid "empty file" msgstr "" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "" @@ -3919,10 +3923,6 @@ msgstr "" msgid "pull masks conflict with direction masks" msgstr "" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 245a4cc759..2e92a3c292 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -103,13 +103,17 @@ msgstr "" "bù shì %d" #: ports/atmel-samd/common-hal/alarm/__init__.c +#: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/cxd56/common-hal/analogio/AnalogOut.c ports/cxd56/common-hal/rtc/RTC.c +#: ports/espressif/common-hal/audiobusio/I2SOut.c #: ports/espressif/common-hal/rtc/RTC.c #: ports/mimxrt10xx/common-hal/analogio/AnalogOut.c #: ports/mimxrt10xx/common-hal/rtc/RTC.c ports/nrf/common-hal/alarm/__init__.c -#: ports/nrf/common-hal/analogio/AnalogOut.c ports/nrf/common-hal/rtc/RTC.c +#: ports/nrf/common-hal/analogio/AnalogOut.c +#: ports/nrf/common-hal/audiobusio/I2SOut.c ports/nrf/common-hal/rtc/RTC.c #: ports/raspberrypi/common-hal/alarm/__init__.c #: ports/raspberrypi/common-hal/analogio/AnalogOut.c +#: ports/raspberrypi/common-hal/audiobusio/I2SOut.c #: ports/raspberrypi/common-hal/rtc/RTC.c ports/stm/common-hal/alarm/__init__.c #: ports/stm/common-hal/canio/Listener.c ports/stm/common-hal/rtc/RTC.c #: shared-bindings/audiobusio/I2SOut.c shared-bindings/audiobusio/PDMIn.c @@ -3005,7 +3009,7 @@ msgstr "kòngxián" msgid "empty file" msgstr "kōng de wénjiàn" -#: extmod/moduasyncio.c extmod/moduheapq.c extmod/modutimeq.c +#: extmod/moduasyncio.c extmod/moduheapq.c msgid "empty heap" msgstr "kōng yīn yīnxiào" @@ -3959,10 +3963,6 @@ msgstr "pow() yǒu 3 cānshù xūyào zhěngshù" msgid "pull masks conflict with direction masks" msgstr "lā kǒu zhào yǔ fāng xiàng miàn mó chōng tū" -#: extmod/modutimeq.c -msgid "queue overflow" -msgstr "duìliè yìchū" - #: py/parse.c msgid "raw f-strings are not supported" msgstr "bù zhī chí yuán shǐ f-strings" @@ -4429,6 +4429,9 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "queue overflow" +#~ msgstr "duìliè yìchū" + #~ msgid "Stopping AP is not supported." #~ msgstr "bù zhī chí tíng zhǐ AP." From 6153d23ed8eff6b09d1a2c3a079c587de667d46d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 5 Sep 2023 21:30:35 -0500 Subject: [PATCH 1628/1712] Fix build with no psram these are conditionally-defined identifiers so have to use if defined. --- ports/espressif/supervisor/port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index 688ceafcae..0224fe0073 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -325,7 +325,7 @@ safe_mode_t port_heap_init(safe_mode_t sm) { common_hal_espidf_set_reserved_psram(reserved); } - #ifdef CONFIG_SPIRAM_USE_MEMMAP + #if defined(CONFIG_SPIRAM_USE_MEMMAP) { intptr_t heap_start = common_hal_espidf_get_psram_start(); intptr_t heap_end = common_hal_espidf_get_psram_end(); @@ -338,7 +338,7 @@ safe_mode_t port_heap_init(safe_mode_t sm) { ESP_LOGE(TAG, "CONFIG_SPIRAM_USE_MMAP enabled but no spiram heap available"); } } - #elif CONFIG_SPIRAM_USE_CAPS_ALLOC + #elif defined(CONFIG_SPIRAM_USE_CAPS_ALLOC) { intptr_t psram_start = common_hal_espidf_get_psram_start(); intptr_t psram_end = common_hal_espidf_get_psram_end(); From 258141a9b32d01f76f1d7674d5ae24fdce493069 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 6 Sep 2023 13:55:53 +0000 Subject: [PATCH 1629/1712] Translated using Weblate (Russian) Currently translated at 100.0% (999 of 999 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ru/ --- locale/ru.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/ru.po b/locale/ru.po index 9991c01e7f..720e1fad0c 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -7,15 +7,15 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-09-05 20:12+0000\n" -"Last-Translator: xXx \n" +"PO-Revision-Date: 2023-09-06 13:57+0000\n" +"Last-Translator: Jeff Epler \n" "Language-Team: none\n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 5.0.1-dev\n" #: main.c @@ -2521,7 +2521,7 @@ msgstr "arange: не удается вычислить длину" #: py/modbuiltins.c msgid "arg is an empty sequence" -msgstr "arg — пустая последовательность" +msgstr "arg - пустая последовательность" #: py/objobject.c msgid "arg must be user-type" @@ -3507,7 +3507,7 @@ msgstr "" #: py/argcheck.c msgid "keyword argument(s) not yet implemented - use normal args instead" msgstr "" -"Аргументы ключевого слова еще не реализованы — вместо этого используйте " +"Аргументы ключевого слова еще не реализованы - вместо этого используйте " "обычные аргументы" #: py/emitinlinethumb.c py/emitinlinextensa.c From 0c0b927843de46cca2c12557aec149efb1d186e8 Mon Sep 17 00:00:00 2001 From: Tirtharaj Sinha Date: Wed, 6 Sep 2023 21:48:41 +0530 Subject: [PATCH 1630/1712] added waveshare_esp32_s3_pico for circuitpython version 8.2.x --- .../boards/waveshare_esp32_s3_pico/board.c | 39 +++++++++++++++ .../waveshare_esp32_s3_pico/mpconfigboard.h | 35 ++++++++++++++ .../waveshare_esp32_s3_pico/mpconfigboard.mk | 11 +++++ .../boards/waveshare_esp32_s3_pico/pins.c | 44 +++++++++++++++++ .../boards/waveshare_esp32_s3_pico/sdkconfig | 47 +++++++++++++++++++ 5 files changed, 176 insertions(+) create mode 100644 ports/espressif/boards/waveshare_esp32_s3_pico/board.c create mode 100644 ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.h create mode 100644 ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk create mode 100644 ports/espressif/boards/waveshare_esp32_s3_pico/pins.c create mode 100644 ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/board.c b/ports/espressif/boards/waveshare_esp32_s3_pico/board.c new file mode 100644 index 0000000000..3b1f5efd87 --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/board.c @@ -0,0 +1,39 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.h b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.h new file mode 100644 index 0000000000..61f4213b3b --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.h @@ -0,0 +1,35 @@ +/* + * 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 "ESP32-S3-Pico" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO21) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk new file mode 100644 index 0000000000..c5bd5e350f --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x303a +USB_PID = 0x81A3 +USB_PRODUCT = "ESP32-S3-Pico" +USB_MANUFACTURER = "Waveshare Electronics" + + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 16MB diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c b/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c new file mode 100644 index 0000000000..c7a984161b --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c @@ -0,0 +1,44 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig b/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig new file mode 100644 index 0000000000..3e366f0172 --- /dev/null +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig @@ -0,0 +1,47 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM16=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SIZE=2097152 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP + +# end of Component config From 1eb8822febe25919cec2e19a91cf48f28f0e5eb6 Mon Sep 17 00:00:00 2001 From: Tirtharaj Sinha Date: Wed, 6 Sep 2023 22:47:34 +0530 Subject: [PATCH 1631/1712] added SCL and SDA --- .../boards/waveshare_esp32_s3_pico/mpconfigboard.h | 3 +++ ports/espressif/boards/waveshare_esp32_s3_pico/pins.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.h b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.h index 61f4213b3b..0217374f3a 100644 --- a/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.h +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.h @@ -33,3 +33,6 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO44) #define DEFAULT_UART_BUS_TX (&pin_GPIO43) + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO18) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO17) diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c b/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c index c7a984161b..1f16d0a800 100644 --- a/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c @@ -38,7 +38,14 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO12) }, - + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + + }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 896be9edb31bfa34cab53712132a1457af40d58e Mon Sep 17 00:00:00 2001 From: Tirtharaj Sinha Date: Wed, 6 Sep 2023 23:12:47 +0530 Subject: [PATCH 1632/1712] added precommit --- ports/espressif/boards/waveshare_esp32_s3_pico/pins.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c b/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c index 1f16d0a800..213294aaae 100644 --- a/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/pins.c @@ -33,19 +33,17 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, - + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO12) }, - + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, - + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO17) }, - - { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From d7edec67ce2b405e7bf91f5b1d5e9d3b5ff5ab58 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 5 Sep 2023 14:31:08 -0700 Subject: [PATCH 1633/1712] 8.2.x backport Added Arduino Nano ESP32-S3 --- .../boards/arduino_nano_esp32s3/board.c | 51 +++++++++++++++ .../arduino_nano_esp32s3/mpconfigboard.h | 57 +++++++++++++++++ .../arduino_nano_esp32s3/mpconfigboard.mk | 17 +++++ .../boards/arduino_nano_esp32s3/pins.c | 64 +++++++++++++++++++ .../boards/arduino_nano_esp32s3/sdkconfig | 43 +++++++++++++ .../board.c | 51 +++++++++++++++ .../mpconfigboard.h | 54 ++++++++++++++++ .../mpconfigboard.mk | 17 +++++ .../pins.c | 64 +++++++++++++++++++ .../sdkconfig | 43 +++++++++++++ tools/ci_check_duplicate_usb_vid_pid.py | 2 + 11 files changed, 463 insertions(+) create mode 100644 ports/espressif/boards/arduino_nano_esp32s3/board.c create mode 100644 ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h create mode 100644 ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk create mode 100644 ports/espressif/boards/arduino_nano_esp32s3/pins.c create mode 100644 ports/espressif/boards/arduino_nano_esp32s3/sdkconfig create mode 100644 ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c create mode 100644 ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.h create mode 100644 ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk create mode 100644 ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/pins.c create mode 100644 ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig diff --git a/ports/espressif/boards/arduino_nano_esp32s3/board.c b/ports/espressif/boards/arduino_nano_esp32s3/board.c new file mode 100644 index 0000000000..8952a19c5d --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3/board.c @@ -0,0 +1,51 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + if (pin_number == 13) { + // Set D13 LED to input when not in use + gpio_set_direction(pin_number, GPIO_MODE_DEF_INPUT); + gpio_set_pull_mode(pin_number, GPIO_PULLDOWN_ONLY); + return true; + } + + return false; +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h new file mode 100644 index 0000000000..7c046d9b72 --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.h @@ -0,0 +1,57 @@ +/* + * 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 "Arduino Nano ESP32" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +// Status LED +#define CIRCUITPY_RGB_STATUS_INVERTED_PWM +#define CIRCUITPY_RGB_STATUS_R (&pin_GPIO46) +#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO0) +#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO45) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#if QSPI_FLASH_FILESYSTEM +#define MICROPY_QSPI_DATA0 (&pin_GPIO32) +#define MICROPY_QSPI_DATA1 (&pin_GPIO31) +#define MICROPY_QSPI_DATA2 (&pin_GPIO28) +#define MICROPY_QSPI_DATA3 (&pin_GPIO27) +#define MICROPY_QSPI_SCK (&pin_GPIO30) +#define MICROPY_QSPI_CS (&pin_GPIO29) +#endif + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO12) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO11) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO48) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO38) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO47) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) diff --git a/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk new file mode 100644 index 0000000000..c9af3af25e --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x2341 +USB_PID = 0x0070 + +USB_PRODUCT = "Arduino Nano ESP32" +USB_MANUFACTURER = "Arduino" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB + +INTERNAL_FLASH_FILESYSTEM = 0 +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICES = GD25WQ128E + +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/arduino_nano_esp32s3/pins.c b/ports/espressif/boards/arduino_nano_esp32s3/pins.c new file mode 100644 index 0000000000..ca56c8900c --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3/pins.c @@ -0,0 +1,64 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_B0), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO47) }, + + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO48) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO45) }, + + { 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_module_globals_table); diff --git a/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig b/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig new file mode 100644 index 0000000000..2acf08a4a7 --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig @@ -0,0 +1,43 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y + +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c new file mode 100644 index 0000000000..8952a19c5d --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c @@ -0,0 +1,51 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +bool espressif_board_reset_pin_number(gpio_num_t pin_number) { + if (pin_number == 13) { + // Set D13 LED to input when not in use + gpio_set_direction(pin_number, GPIO_MODE_DEF_INPUT); + gpio_set_pull_mode(pin_number, GPIO_PULLDOWN_ONLY); + return true; + } + + return false; +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.h b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.h new file mode 100644 index 0000000000..4d4adcf1cb --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.h @@ -0,0 +1,54 @@ +/* + * 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 "Arduino Nano ESP32" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +// Status LED +#define CIRCUITPY_RGB_STATUS_INVERTED_PWM +#define CIRCUITPY_RGB_STATUS_R (&pin_GPIO46) +#define CIRCUITPY_RGB_STATUS_G (&pin_GPIO45) +#define CIRCUITPY_RGB_STATUS_B (&pin_GPIO0) + +#define MICROPY_HW_LED_STATUS (&pin_GPIO13) + +#if QSPI_FLASH_FILESYSTEM +#define MICROPY_QSPI_DATA0 (&pin_GPIO32) +#define MICROPY_QSPI_DATA1 (&pin_GPIO31) +#define MICROPY_QSPI_DATA2 (&pin_GPIO28) +#define MICROPY_QSPI_DATA3 (&pin_GPIO27) +#define MICROPY_QSPI_SCK (&pin_GPIO30) +#define MICROPY_QSPI_CS (&pin_GPIO29) +#endif + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO12) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO11) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO48) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO38) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO47) diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk new file mode 100644 index 0000000000..925c4ab6e2 --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x2341 +USB_PID = 0x056B + +USB_PRODUCT = "Arduino Nano ESP32" +USB_MANUFACTURER = "Arduino" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB + +INTERNAL_FLASH_FILESYSTEM = 0 +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICES = GD25WQ128E + +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/pins.c b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/pins.c new file mode 100644 index 0000000000..aa89a58ee4 --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/pins.c @@ -0,0 +1,64 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_B0), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_B1), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO47) }, + + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO48) }, + + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_D20), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO11) }, + + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D24), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_GPIO0) }, + + { 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_module_globals_table); diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig new file mode 100644 index 0000000000..26a26b5fe8 --- /dev/null +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig @@ -0,0 +1,43 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y + +# +# SPI RAM config +# +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="nano-esp32" +# end of LWIP diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index f20630e886..f22225007b 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -63,6 +63,8 @@ DEFAULT_CLUSTERLIST = { ], "0x239A:0x102E": ["weact_studio_pico", "weact_studio_pico_16mb"], "0x303A:0x8166": ["yd_esp32_s3_n8r8", "yd_esp32_s3_n16r8"], + "0x2341:0x056B": ["arduino_nano_esp32s3", "arduino_nano_esp32s3_inverted_statusled"], + "0x2E8A:0x1020": ["waveshare_rp2040_plus_4mb", "waveshare_rp2040_plus_16mb"], } cli_parser = argparse.ArgumentParser( From d871bc37c560db18971c3eea4e3d0ce043f95721 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 6 Sep 2023 15:49:51 -0400 Subject: [PATCH 1634/1712] remove lib/certificates/nina-fw submodule --- .gitmodules | 3 --- lib/certificates/README.md | 3 --- lib/certificates/nina-fw | 1 - 3 files changed, 7 deletions(-) delete mode 100644 lib/certificates/README.md delete mode 160000 lib/certificates/nina-fw diff --git a/.gitmodules b/.gitmodules index 7cb54a92dc..4ddbc618b7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -144,9 +144,6 @@ path = ports/espressif/esp-idf url = https://github.com/adafruit/esp-idf.git branch = release/v4.4-circuitpython -[submodule "ports/espressif/certificates/nina-fw"] - path = lib/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 diff --git a/lib/certificates/README.md b/lib/certificates/README.md deleted file mode 100644 index dd5cf25b00..0000000000 --- a/lib/certificates/README.md +++ /dev/null @@ -1,3 +0,0 @@ -We share root certificates with the nina-fw to ensure they both use the same roots. - -https://github.com/adafruit/nina-fw diff --git a/lib/certificates/nina-fw b/lib/certificates/nina-fw deleted file mode 160000 index 21205e4005..0000000000 --- a/lib/certificates/nina-fw +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 21205e400515a698266abaaea902bd1ea897bb5d From 58a21326b2da50ad47d14c353f884f8d5213541b Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 6 Sep 2023 16:22:42 -0400 Subject: [PATCH 1635/1712] Update to new certificates submodule. --- .gitmodules | 3 +++ lib/certificates | 1 + ports/espressif/esp-idf-config/sdkconfig-esp32.defaults | 2 +- ports/espressif/esp-idf-config/sdkconfig.defaults | 2 +- ports/raspberrypi/Makefile | 2 +- tools/ci_fetch_deps.py | 4 ++-- 6 files changed, 9 insertions(+), 5 deletions(-) create mode 160000 lib/certificates diff --git a/.gitmodules b/.gitmodules index 4ddbc618b7..e4b59e8e42 100644 --- a/.gitmodules +++ b/.gitmodules @@ -338,3 +338,6 @@ [submodule "frozen/Adafruit_CircuitPython_Wave"] path = frozen/Adafruit_CircuitPython_Wave url = https://github.com/adafruit/Adafruit_CircuitPython_Wave.git +[submodule "lib/certificates"] + path = lib/certificates + url = https://github.com/adafruit/certificates diff --git a/lib/certificates b/lib/certificates new file mode 160000 index 0000000000..5c85c604a0 --- /dev/null +++ b/lib/certificates @@ -0,0 +1 @@ +Subproject commit 5c85c604a0d77a08df93435e4afad5f541c38923 diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults index b6c5a938b1..54e800cd62 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults @@ -776,7 +776,7 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE=y CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y -CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/nina-fw/data/roots.pem" +CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/data/roots.pem" # end of Certificate Bundle CONFIG_MBEDTLS_ECP_RESTARTABLE=y diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index b183cd630d..b27d846f2c 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -572,7 +572,7 @@ CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y # CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE=y CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y -CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/nina-fw/data/roots.pem" +CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/data/roots.pem" # end of Certificate Bundle CONFIG_MBEDTLS_ECP_RESTARTABLE=y diff --git a/ports/raspberrypi/Makefile b/ports/raspberrypi/Makefile index 7eb67b77ba..e6cbcfbbce 100644 --- a/ports/raspberrypi/Makefile +++ b/ports/raspberrypi/Makefile @@ -345,7 +345,7 @@ CFLAGS += \ -isystem $(TOP)/lib/mbedtls/include \ -DMBEDTLS_CONFIG_FILE='"mbedtls/mbedtls_config.h"' \ -$(BUILD)/x509_crt_bundle.S: $(TOP)/lib/certificates/nina-fw/data/roots.pem $(TOP)/tools/gen_crt_bundle.py +$(BUILD)/x509_crt_bundle.S: $(TOP)/lib/certificates/data/roots.pem $(TOP)/tools/gen_crt_bundle.py $(Q)$(PYTHON) $(TOP)/tools/gen_crt_bundle.py -i $< -o $@ --asm OBJ_MBEDTLS := $(BUILD)/x509_crt_bundle.o $(patsubst %.c,$(BUILD)/%.o,$(SRC_MBEDTLS))): CFLAGS += -Wno-suggest-attribute=format diff --git a/tools/ci_fetch_deps.py b/tools/ci_fetch_deps.py index 15ef6a51cd..30ab7ca5a4 100644 --- a/tools/ci_fetch_deps.py +++ b/tools/ci_fetch_deps.py @@ -24,7 +24,7 @@ PORT_DEPS = { "cxd56": ["extmod/ulab/", "lib/tinyusb/"], "espressif": [ "extmod/ulab/", - "lib/certificates/nina-fw/", + "lib/certificates/", "lib/protomatter/", "lib/quirc/", "lib/tinyusb/", @@ -37,7 +37,7 @@ PORT_DEPS = { "lib/adafruit_floppy/", "lib/mbedtls/", "lib/mp3/", - "lib/certificates/nina-fw/", + "lib/certificates/", "lib/protomatter/", "lib/quirc/", "lib/tinyusb/", From e71c39736e05d599918749a1e81d731218180bde Mon Sep 17 00:00:00 2001 From: Seon Rozenblum Date: Thu, 7 Sep 2023 12:13:37 +1000 Subject: [PATCH 1636/1712] Added UM FeatherS3 second I2C STEMMAQT --- .../unexpectedmaker_feathers3/mpconfigboard.h | 5 +-- .../boards/unexpectedmaker_feathers3/pins.c | 32 +++++++++++++++---- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h index 67054b8664..1d51cb77d9 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h +++ b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.h @@ -34,8 +34,9 @@ #define MICROPY_HW_LED_STATUS (&pin_GPIO13) -#define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) -#define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) +#define CIRCUITPY_BOARD_I2C (2) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO9, .sda = &pin_GPIO8}, \ + {.scl = &pin_GPIO15, .sda = &pin_GPIO16}} #define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/pins.c b/ports/espressif/boards/unexpectedmaker_feathers3/pins.c index 9a2fde5a0c..5cdfc69ed2 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/pins.c +++ b/ports/espressif/boards/unexpectedmaker_feathers3/pins.c @@ -1,5 +1,7 @@ #include "shared-bindings/board/__init__.h" +CIRCUITPY_BOARD_BUS_SINGLETON(stemma_i2c, i2c, 1) + STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS @@ -89,11 +91,16 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO11) }, { MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, // Blue LED + // Blue LED + { MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) }, + + // STEMMA QT Vertical Connector I2C IO + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_SCL2), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_SDA2), MP_ROM_PTR(&pin_GPIO16) }, // Battery voltage sense pin - // I really don't know what name to use here. Adafruit use BATTERY & VOLTAGE_MONITOR - // I prefer VBAT or VBAT_SENSE { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_GPIO2) }, { MP_ROM_QSTR(MP_QSTR_VBAT_SENSE), MP_ROM_PTR(&pin_GPIO2) }, @@ -103,18 +110,29 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_VBUS), MP_ROM_PTR(&pin_GPIO34) }, { MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO34) }, + // Neopixel pins { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO39) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO40) }, - { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, // Ambient Light Sensor - { MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, // Ambient Light Sensor + // Ambient Light Sensor + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_AMB), MP_ROM_PTR(&pin_GPIO4) }, - { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO39) }, // Second LDO Enable control - { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, // Second LDO Enable control + // Second LDO Enable control + { MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + // I2C { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_VERTICAL_I2C), MP_ROM_PTR(&board_stemma_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_STEMMA_I2C2), MP_ROM_PTR(&board_stemma_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C2), MP_ROM_PTR(&board_stemma_i2c_obj) }, + + // SPI { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + + // UART { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, }; MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); From 1e178318cf19adc18ff9f656cdc0c5a27ee755d6 Mon Sep 17 00:00:00 2001 From: Bob Abeles Date: Wed, 6 Sep 2023 19:59:40 -0700 Subject: [PATCH 1637/1712] review update, add RP2040 example --- locale/circuitpython.pot | 8 ++++ .../common-hal/memorymap/AddressRange.c | 2 +- py/argcheck.c | 2 - py/obj.c | 15 ------- py/obj.h | 1 - py/objint.c | 4 -- py/runtime.h | 1 - shared-bindings/memorymap/AddressRange.c | 41 +++++++++++++++++-- 8 files changed, 47 insertions(+), 27 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 2007eb8b9b..0d814b0ee6 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2140,6 +2140,10 @@ msgstr "" msgid "Unable to access unaliged IO register" msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -4048,6 +4052,10 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "start must be an int" +msgstr "" + #: py/objstr.c msgid "start/end indices" msgstr "" diff --git a/ports/raspberrypi/common-hal/memorymap/AddressRange.c b/ports/raspberrypi/common-hal/memorymap/AddressRange.c index 6f6731a5ec..1defb0389f 100644 --- a/ports/raspberrypi/common-hal/memorymap/AddressRange.c +++ b/ports/raspberrypi/common-hal/memorymap/AddressRange.c @@ -90,7 +90,7 @@ void common_hal_memorymap_addressrange_set_bytes(const memorymap_addressrange_ob case IO: if ((size_t)dest_addr & 0x03 || len & 0x03) { // Unaligned access or unaligned length not supported by RP2 for IO registers - mp_raise_RuntimeError(translate("Unable to access unaliged IO register")); + mp_raise_RuntimeError(translate("Unable to access unaligned IO register")); } else { // Aligned access and length, use 32-bit writes uint32_t *dest_addr32 = (uint32_t *)dest_addr; diff --git a/py/argcheck.c b/py/argcheck.c index ff939ad828..c3bde804d4 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -115,8 +115,6 @@ void mp_arg_parse_all(size_t n_pos, const mp_obj_t *pos, mp_map_t *kws, size_t n out_vals[i].u_bool = mp_obj_is_true(given_arg); } else if ((allowed[i].flags & MP_ARG_KIND_MASK) == MP_ARG_INT) { out_vals[i].u_int = mp_obj_get_int(given_arg); - } else if ((allowed[i].flags & MP_ARG_KIND_MASK) == MP_ARG_UINT) { - out_vals[i].u_uint = mp_obj_get_uint(given_arg); } else { assert((allowed[i].flags & MP_ARG_KIND_MASK) == MP_ARG_OBJ); out_vals[i].u_obj = given_arg; diff --git a/py/obj.c b/py/obj.c index a8702713d3..31d469770c 100644 --- a/py/obj.c +++ b/py/obj.c @@ -420,21 +420,6 @@ bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value) { return true; } -mp_uint_t mp_obj_get_uint(mp_const_obj_t arg) { - if (arg == mp_const_false) { - return 0; - } else if (arg == mp_const_true) { - return 1; - } else if (mp_obj_is_small_int(arg)) { - return MP_OBJ_SMALL_INT_VALUE(arg); - } else if (mp_obj_is_type(arg, &mp_type_int)) { - return mp_obj_int_get_uint_checked(arg); - } else { - mp_obj_t res = mp_unary_op(MP_UNARY_OP_INT, (mp_obj_t)arg); - return mp_obj_int_get_uint_checked(res); - } -} - #if MICROPY_PY_BUILTINS_FLOAT bool mp_obj_get_float_maybe(mp_obj_t arg, mp_float_t *value) { mp_float_t val; diff --git a/py/obj.h b/py/obj.h index 0b9f812e0b..d1874a8cd2 100644 --- a/py/obj.h +++ b/py/obj.h @@ -939,7 +939,6 @@ static MP_INLINE bool mp_obj_is_integer(mp_const_obj_t o) { mp_int_t mp_obj_get_int(mp_const_obj_t arg); mp_int_t mp_obj_get_int_truncated(mp_const_obj_t arg); bool mp_obj_get_int_maybe(mp_const_obj_t arg, mp_int_t *value); -mp_uint_t mp_obj_get_uint(mp_const_obj_t arg); #if MICROPY_PY_BUILTINS_FLOAT mp_float_t mp_obj_get_float(mp_obj_t self_in); bool mp_obj_get_float_maybe(mp_obj_t arg, mp_float_t *value); diff --git a/py/objint.c b/py/objint.c index 7cc6376733..b5de5ebdc5 100644 --- a/py/objint.c +++ b/py/objint.c @@ -438,10 +438,6 @@ mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) { return MP_OBJ_SMALL_INT_VALUE(self_in); } -mp_uint_t mp_obj_int_get_uint_checked(mp_const_obj_t self_in) { - return MP_OBJ_SMALL_INT_VALUE(self_in); -} - #endif // MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE diff --git a/py/runtime.h b/py/runtime.h index 688d8b03fe..4a00752402 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -45,7 +45,6 @@ typedef enum { MP_ARG_BOOL = 0x001, MP_ARG_INT = 0x002, MP_ARG_OBJ = 0x003, - MP_ARG_UINT = 0x004, MP_ARG_KIND_MASK = 0x0ff, MP_ARG_REQUIRED = 0x100, MP_ARG_KW_ONLY = 0x200, diff --git a/shared-bindings/memorymap/AddressRange.c b/shared-bindings/memorymap/AddressRange.c index f2f5c28ee4..74df9efecf 100644 --- a/shared-bindings/memorymap/AddressRange.c +++ b/shared-bindings/memorymap/AddressRange.c @@ -47,23 +47,58 @@ //| import memorymap //| rtc_slow_mem = memorymap.AddressRange(start=0x50000000, length=0x2000) //| rtc_slow_mem[0:3] = b"\xcc\x10\x00" +//| +//| Example I/O register usage on RP2040:: +//| +//| import binascii +//| import board +//| import digitalio +//| import memorymap +//| +//| def rp2040_set_pad_drive(p, d): +//| pads_bank0 = memorymap.AddressRange(start=0x4001C000, length=0x4000) +//| pad_ctrl = int.from_bytes(pads_bank0[p*4+4:p*4+8], "little") +//| # Pad control register is updated using an MP-safe atomic XOR +//| pad_ctrl ^= (d << 4) +//| pad_ctrl &= 0x00000030 +//| pads_bank0[p*4+0x3004:p*4+0x3008] = pad_ctrl.to_bytes(4, "little") +//| +//| def rp2040_get_pad_drive(p): +//| pads_bank0 = memorymap.AddressRange(start=0x4001C000, length=0x4000) +//| pad_ctrl = int.from_bytes(pads_bank0[p*4+4:p*4+8], "little") +//| return (pad_ctrl >> 4) & 0x3 +//| +//| # set GPIO16 pad drive strength to 12 mA +//| rp2040_set_pad_drive(16, 3) +//| +//| # print GPIO16 pad drive strength +//| print(rp2040_get_pad_drive(16)) //| """ //| def __init__(self, *, start, length) -> None: //| """Constructs an address range starting at ``start`` and ending at -//| ``start + length - 1``. An exception will be raised if any of the +//| ``start + length``. An exception will be raised if any of the //| addresses are invalid or protected.""" //| ... STATIC mp_obj_t memorymap_addressrange_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) { enum { ARG_start, ARG_length }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_UINT }, + { MP_QSTR_start, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_OBJ }, { MP_QSTR_length, MP_ARG_KW_ONLY | MP_ARG_REQUIRED | MP_ARG_INT }, }; mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); - size_t start = args[ARG_start].u_uint; + // Argument start is a pointer into the address map, so we validate it here because a + // signed int argument will overflow if it is in the upper half of the map. + size_t start; + if (mp_obj_is_small_int(args[ARG_start].u_obj)) { + start = MP_OBJ_SMALL_INT_VALUE(args[ARG_start].u_obj); + } else if (mp_obj_is_type(args[ARG_start].u_obj, &mp_type_int)) { + start = mp_obj_int_get_uint_checked(args[ARG_start].u_obj); + } else { + mp_raise_TypeError(translate("start must be an int")); + } size_t length = mp_arg_validate_int_min(args[ARG_length].u_int, 1, MP_QSTR_length); // Check for address range wrap here as this can break port-specific code due to size_t overflow. From 65fc79e31f186ffd6ae7ca153c4ce3a453bedea3 Mon Sep 17 00:00:00 2001 From: Bob Abeles Date: Wed, 6 Sep 2023 20:25:39 -0700 Subject: [PATCH 1638/1712] backout remaining changes to py --- py/objint.c | 1 - py/runtime.h | 1 - 2 files changed, 2 deletions(-) diff --git a/py/objint.c b/py/objint.c index b5de5ebdc5..83987d690a 100644 --- a/py/objint.c +++ b/py/objint.c @@ -438,7 +438,6 @@ mp_int_t mp_obj_int_get_checked(mp_const_obj_t self_in) { return MP_OBJ_SMALL_INT_VALUE(self_in); } - #endif // MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE // This dispatcher function is expected to be independent of the implementation of long int diff --git a/py/runtime.h b/py/runtime.h index 4a00752402..5ecab91e99 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -53,7 +53,6 @@ typedef enum { typedef union _mp_arg_val_t { bool u_bool; mp_int_t u_int; - mp_uint_t u_uint; mp_obj_t u_obj; mp_rom_obj_t u_rom_obj; } mp_arg_val_t; From c5bc59e692ddc91fd442bc29979c4ea0c9c20728 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 7 Sep 2023 08:32:21 -0400 Subject: [PATCH 1639/1712] update protomatter to 1.6.1 (used for RGBMatrix) --- lib/protomatter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/protomatter b/lib/protomatter index ed2e701871..c9c1189e9d 160000 --- a/lib/protomatter +++ b/lib/protomatter @@ -1 +1 @@ -Subproject commit ed2e7018718caebba2b7550517b556e7734357ef +Subproject commit c9c1189e9d6200bb09bf4a87d84be9459cae481b From 79edcbe97ded330706b2b32303f4afab5da7e91f Mon Sep 17 00:00:00 2001 From: Bob Abeles Date: Thu, 7 Sep 2023 09:25:02 -0700 Subject: [PATCH 1640/1712] second instance of misspelled 'unaligned' --- ports/raspberrypi/common-hal/memorymap/AddressRange.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/raspberrypi/common-hal/memorymap/AddressRange.c b/ports/raspberrypi/common-hal/memorymap/AddressRange.c index 1defb0389f..185be10ab4 100644 --- a/ports/raspberrypi/common-hal/memorymap/AddressRange.c +++ b/ports/raspberrypi/common-hal/memorymap/AddressRange.c @@ -122,7 +122,7 @@ void common_hal_memorymap_addressrange_get_bytes(const memorymap_addressrange_ob case IO: if ((size_t)src_addr & 0x03 || len & 0x03) { // Unaligned access or unaligned length not supported by RP2 for IO registers - mp_raise_RuntimeError(translate("Unable to access unaliged IO register")); + mp_raise_RuntimeError(translate("Unable to access unaligned IO register")); } else { // Aligned access and length, use 32-bit reads uint32_t *src_addr32 = (uint32_t *)src_addr; From c3c2b8458457c1095d80f2d16410c3be441fdf20 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Sep 2023 12:57:45 -0500 Subject: [PATCH 1641/1712] fix typo, copyright notice --- main.c | 2 +- shared-bindings/dotclockframebuffer/DotClockFramebuffer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index d89777bc5e..72f9fd6fab 100644 --- a/main.c +++ b/main.c @@ -1043,7 +1043,7 @@ int __attribute__((used)) main(void) { } // We maybe can't initialize the heap until here, because on espressif port we need to be able to check for reserved psram in settings.toml - // (but it's OK if this is a no-op due to the heap beinig initialized in port_init()) + // (but it's OK if this is a no-op due to the heap being initialized in port_init()) set_safe_mode(port_heap_init(get_safe_mode())); #if CIRCUITPY_ALARM diff --git a/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c index fb0df57db5..aac695e3ee 100644 --- a/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c +++ b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * Copyright (c) 2023 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 From eb060184c2acfdf51032032de59ccb9ac46e779b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Sep 2023 12:59:42 -0500 Subject: [PATCH 1642/1712] Add hack tablet --- .../board.c | 39 ++++++ .../mpconfigboard.h | 42 ++++++ .../mpconfigboard.mk | 12 ++ .../pins.c | 122 ++++++++++++++++++ .../sdkconfig | 62 +++++++++ tools/ci_check_duplicate_usb_vid_pid.py | 1 + 6 files changed, 278 insertions(+) create mode 100644 ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/board.c create mode 100644 ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.h create mode 100644 ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.mk create mode 100644 ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/pins.c create mode 100644 ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/sdkconfig diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/board.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/board.c new file mode 100644 index 0000000000..3b1f5efd87 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/board.c @@ -0,0 +1,39 @@ +/* + * 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 "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // Debug UART + #ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif +} + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.h new file mode 100644 index 0000000000..093a2ffc8c --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.h @@ -0,0 +1,42 @@ +/* + * 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 "ESP32-S3-DevKitC-1-N8R8-with-HACKTABLET" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO48) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO44) +#define DEFAULT_UART_BUS_TX (&pin_GPIO43) + +// UART pins attached to the USB-serial converter chip +#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO43) +#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO44) + +// a 1024x768 16BPP framebuffer + some breathing room +#define DEFAULT_RESERVED_PSRAM (1024 * 1024 * 2) diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.mk new file mode 100644 index 0000000000..1bd9c0ac8d --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.mk @@ -0,0 +1,12 @@ +USB_VID = 0x303A +USB_PID = 0x7003 +USB_PRODUCT = "ESP32-S3-DevKitC-1-N8R8" +USB_MANUFACTURER = "Espressif" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB + +CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/pins.c b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/pins.c new file mode 100644 index 0000000000..8f792769e5 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/pins.c @@ -0,0 +1,122 @@ +#include "py/objtuple.h" +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_obj_tuple_t tft_r_pins = { + {&mp_type_tuple}, + 5, + { + MP_ROM_PTR(&pin_GPIO14), + MP_ROM_PTR(&pin_GPIO15), + MP_ROM_PTR(&pin_GPIO16), + MP_ROM_PTR(&pin_GPIO17), + MP_ROM_PTR(&pin_GPIO18), + } +}; + +STATIC const mp_rom_obj_tuple_t tft_g_pins = { + {&mp_type_tuple}, + 6, + { + MP_ROM_PTR(&pin_GPIO8), + MP_ROM_PTR(&pin_GPIO9), + MP_ROM_PTR(&pin_GPIO10), + MP_ROM_PTR(&pin_GPIO11), + MP_ROM_PTR(&pin_GPIO12), + MP_ROM_PTR(&pin_GPIO13), + } +}; + +STATIC const mp_rom_obj_tuple_t tft_b_pins = { + {&mp_type_tuple}, + 5, + { + MP_ROM_PTR(&pin_GPIO3), + MP_ROM_PTR(&pin_GPIO4), + MP_ROM_PTR(&pin_GPIO5), + MP_ROM_PTR(&pin_GPIO6), + MP_ROM_PTR(&pin_GPIO7), + } +}; + +STATIC const mp_rom_map_elem_t tft_table[] = { + { MP_ROM_QSTR(MP_QSTR_de), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_vsync), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_hsync), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_dclk), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_red), MP_ROM_PTR(&tft_r_pins) }, + { MP_ROM_QSTR(MP_QSTR_green), MP_ROM_PTR(&tft_g_pins) }, + { MP_ROM_QSTR(MP_QSTR_blue), MP_ROM_PTR(&tft_b_pins) }, +}; +MP_DEFINE_CONST_DICT(tft_dict, tft_table); + +STATIC const mp_rom_map_elem_t timings800_table[] = { + { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_INT(6500000) }, // nominal 16MHz, but display is unstable/tears at that frequency + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_INT(800) }, + { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_INT(480) }, + { MP_ROM_QSTR(MP_QSTR_hsync_pulse_width), MP_ROM_INT(30) }, + { MP_ROM_QSTR(MP_QSTR_hsync_front_porch), MP_ROM_INT(210) }, + { MP_ROM_QSTR(MP_QSTR_hsync_back_porch), MP_ROM_INT(16) }, + { MP_ROM_QSTR(MP_QSTR_hsync_idle_low), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_vsync_pulse_width), MP_ROM_INT(13) }, + { MP_ROM_QSTR(MP_QSTR_vsync_front_porch), MP_ROM_INT(22) }, + { MP_ROM_QSTR(MP_QSTR_vsync_back_porch), MP_ROM_INT(10) }, + { MP_ROM_QSTR(MP_QSTR_vsync_idle_low), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_de_idle_high), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_pclk_active_high), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_pclk_idle_high), MP_ROM_FALSE }, +}; +MP_DEFINE_CONST_DICT(timings800_dict, timings800_table); + + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_TFT), MP_ROM_PTR(&tft_dict) }, + { MP_ROM_QSTR(MP_QSTR_TIMINGS800), MP_ROM_PTR(&timings800_dict) }, + { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_TFTB1), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_TFTB2), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_TFTB3), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_TFTB4), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_TFTB5), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_TFTG1), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_TFTG2), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_TFTG3), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_TFTG4), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_TFTG5), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_TFTG6), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_TFTR1), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_TFTR2), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_TFTR3), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_TFTR4), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_TFTR5), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_dclk), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_IO36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_IO37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_IO42), MP_ROM_PTR(&pin_GPIO42) }, + { MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) }, + { MP_ROM_QSTR(MP_QSTR_de), MP_ROM_PTR(&pin_GPIO45) }, + { MP_ROM_QSTR(MP_QSTR_IO46), MP_ROM_PTR(&pin_GPIO46) }, + { MP_ROM_QSTR(MP_QSTR_hsync), MP_ROM_PTR(&pin_GPIO47) }, + { MP_ROM_QSTR(MP_QSTR_vsync), MP_ROM_PTR(&pin_GPIO48) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO48) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/sdkconfig new file mode 100644 index 0000000000..40da78d506 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/sdkconfig @@ -0,0 +1,62 @@ +# +# Component config +# +# +# ESP32S3-Specific +# +CONFIG_ESP32S3_SPIRAM_SUPPORT=y +# +# SPI RAM config +# +#CONFIG_SPIRAM_MODE_QUAD=y +### NEW ### +CONFIG_SPIRAM_MODE_OCT=y +CONFIG_SPIRAM_TYPE_AUTO=y +####### +# CONFIG_SPIRAM_MODE_OCT is not set +# CONFIG_SPIRAM_TYPE_AUTO is not set +#CONFIG_SPIRAM_TYPE_ESPPSRAM16=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +#CONFIG_SPIRAM_SIZE=2097152 +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y +# end of SPI RAM config + +# end of ESP32S3-Specific + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3-hacktablet" +# end of LWIP + +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +CONFIG_ESP_CONSOLE_UART_CUSTOM=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 +CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 +CONFIG_ESP_CONSOLE_UART=y + +# end of Component config diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index 5078215d54..f52a85d5b9 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -55,6 +55,7 @@ DEFAULT_CLUSTERLIST = { "espressif_esp32s3_devkitc_1_n8r2", "espressif_esp32s3_devkitc_1_n8r8", "espressif_esp32s3_devkitc_1_n32r8", + "espressif_esp32s3_devkitc_1_n8r8_hacktablet", ], "0x303A:0x7009": [ "espressif_esp32s2_devkitc_1_n4", From 0196401d08c8825b2dbb51ee8e5246df5109034c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Sep 2023 13:01:16 -0500 Subject: [PATCH 1643/1712] reduce reserved psram --- .../mpconfigboard.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.h b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.h index 093a2ffc8c..e39cbaad98 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.h +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.h @@ -38,5 +38,5 @@ #define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO43) #define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO44) -// a 1024x768 16BPP framebuffer + some breathing room -#define DEFAULT_RESERVED_PSRAM (1024 * 1024 * 2) +// a 800x480 16BPP framebuffer + some breathing room +#define DEFAULT_RESERVED_PSRAM (800 * 800 * 2) From 67843f6cfe55ae15e90b95671562bb5fa19393b4 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 7 Sep 2023 22:21:41 +0200 Subject: [PATCH 1644/1712] 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 | 5 +++++ locale/cs.po | 5 +++++ locale/de_DE.po | 5 +++++ locale/el.po | 5 +++++ locale/en_GB.po | 5 +++++ locale/es.po | 5 +++++ locale/fil.po | 5 +++++ locale/fr.po | 5 +++++ locale/hi.po | 5 +++++ locale/it_IT.po | 5 +++++ locale/ja.po | 5 +++++ locale/ko.po | 5 +++++ locale/nl.po | 5 +++++ locale/pl.po | 5 +++++ locale/pt_BR.po | 5 +++++ locale/ru.po | 9 +++++++-- locale/sv.po | 5 +++++ locale/tr.po | 5 +++++ locale/zh_Latn_pinyin.po | 5 +++++ 19 files changed, 97 insertions(+), 2 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index e4b9559f65..0fbd6c2a51 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -1238,6 +1238,7 @@ msgid "Invalid %q" msgstr "" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1392,6 +1393,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "Harus berupa subclass %q." +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "Harus menyediakan pin MISO atau MOSI" diff --git a/locale/cs.po b/locale/cs.po index a71c63adea..e6659f7aea 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -1238,6 +1238,7 @@ msgid "Invalid %q" msgstr "" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1392,6 +1393,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "Musí být podtřída %q." +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "Musí poskytnout pin MISO nebo MOSI" diff --git a/locale/de_DE.po b/locale/de_DE.po index 5ad4b0ba95..41eb8dcf22 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -1259,6 +1259,7 @@ msgid "Invalid %q" msgstr "Ungültiger %q" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1414,6 +1415,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "Muss eine %q Unterklasse sein." +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "Muss MISO- oder MOSI-Pin bereitstellen" diff --git a/locale/el.po b/locale/el.po index e2fa69ec51..20ee429652 100644 --- a/locale/el.po +++ b/locale/el.po @@ -1252,6 +1252,7 @@ msgid "Invalid %q" msgstr "" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1406,6 +1407,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index fd18f4812a..9b8f7e6ee9 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -1244,6 +1244,7 @@ msgid "Invalid %q" msgstr "Invalid %q" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1398,6 +1399,10 @@ msgstr "Missing jmp_pin. %q[%u] jumps on pin" msgid "Must be a %q subclass." msgstr "Must be a %q subclass." +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "Must provide MISO or MOSI pin" diff --git a/locale/es.po b/locale/es.po index a4cc31a820..7e267f12b1 100644 --- a/locale/es.po +++ b/locale/es.po @@ -1271,6 +1271,7 @@ msgid "Invalid %q" msgstr "%q inválido" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1425,6 +1426,10 @@ msgstr "Falta jmp_pin. %q[%u] salta en pin" msgid "Must be a %q subclass." msgstr "Debe de ser una subclase de %q." +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "Debe proporcionar un pin MISO o MOSI" diff --git a/locale/fil.po b/locale/fil.po index 123d399267..6aac262576 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -1238,6 +1238,7 @@ msgid "Invalid %q" msgstr "" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1392,6 +1393,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "" diff --git a/locale/fr.po b/locale/fr.po index fe501834dd..2beabfa3a4 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -1276,6 +1276,7 @@ msgid "Invalid %q" msgstr "%q invalide" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1431,6 +1432,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "Doit être une sous-classe de %q." +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "Doit fournir une broche MISO ou MOSI" diff --git a/locale/hi.po b/locale/hi.po index b2041ad82e..93f039352e 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -1228,6 +1228,7 @@ msgid "Invalid %q" msgstr "" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1382,6 +1383,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 4801b2e158..d05baee044 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -1240,6 +1240,7 @@ msgid "Invalid %q" msgstr "" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1395,6 +1396,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "" diff --git a/locale/ja.po b/locale/ja.po index aa5bf7a2f5..b107a4bc18 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -1239,6 +1239,7 @@ msgid "Invalid %q" msgstr "不正な %q" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1393,6 +1394,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "%q のサブクラスでなければなりません" +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "MISOピンまたはMOSIピンが必要" diff --git a/locale/ko.po b/locale/ko.po index 4ee9a3e872..6b9ca9f1b0 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -1231,6 +1231,7 @@ msgid "Invalid %q" msgstr "" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1385,6 +1386,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index edfc54cfe8..7d070b4348 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -1234,6 +1234,7 @@ msgid "Invalid %q" msgstr "Ongeldige %q" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1388,6 +1389,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "%q moet een subklasse zijn." +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "MISO of MOSI moeten worden gegeven" diff --git a/locale/pl.po b/locale/pl.po index f918f5a345..1c06559739 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -1234,6 +1234,7 @@ msgid "Invalid %q" msgstr "Nieprawidłowe %q" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1388,6 +1389,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "Należy podać pin MISO lub MOSI" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 83f1a4a95a..daf77c1c94 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -1268,6 +1268,7 @@ msgid "Invalid %q" msgstr "%q Inválido" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1422,6 +1423,10 @@ msgstr "Falta jmp_pin. %q[%u] jumper no pino" msgid "Must be a %q subclass." msgstr "Deve ser uma subclasse %q." +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "Deve informar os pinos MISO ou MOSI" diff --git a/locale/ru.po b/locale/ru.po index 720e1fad0c..6ddf967794 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " -"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 5.0.1-dev\n" #: main.c @@ -1275,6 +1275,7 @@ msgid "Invalid %q" msgstr "Недопустимый %q" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1429,6 +1430,10 @@ msgstr "Не хватает jmp_pin.%q [%u] прыгает на пин" msgid "Must be a %q subclass." msgstr "Должен быть субклассом %q." +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "Пин MISO или MOSI должен быть предоставлен" diff --git a/locale/sv.po b/locale/sv.po index 44dec9a9e8..eadb239290 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -1253,6 +1253,7 @@ msgid "Invalid %q" msgstr "Ogiltig %q" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1408,6 +1409,10 @@ msgstr "Saknad jmp_pin. %q[%u] hoppar på pin" msgid "Must be a %q subclass." msgstr "Måste vara en %q-subklass." +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "Måste ange MISO- eller MOSI-pinne" diff --git a/locale/tr.po b/locale/tr.po index c55b90b95d..ec87faadcb 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -1244,6 +1244,7 @@ msgid "Invalid %q" msgstr "Geçersiz %q" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1399,6 +1400,10 @@ msgstr "" msgid "Must be a %q subclass." msgstr "" +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 2e92a3c292..e805fff144 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -1259,6 +1259,7 @@ msgid "Invalid %q" msgstr "wú xiào %q" #: ports/atmel-samd/common-hal/microcontroller/Pin.c +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c #: ports/mimxrt10xx/common-hal/microcontroller/Pin.c #: shared-bindings/microcontroller/Pin.c msgid "Invalid %q pin" @@ -1413,6 +1414,10 @@ msgstr "quēshǎo jmp_pin. %q[%u] tiàodào yǐn jiǎoshàng" msgid "Must be a %q subclass." msgstr "Bìxū shì %q zi lèi." +#: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +msgid "Must provide 5/6/5 RGB pins" +msgstr "" + #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" msgstr "Bìxū tígōng MISO huò MOSI yǐn jiǎo" From 0e0941d6fdd90adc0b638d4e19d3b59d17b338b4 Mon Sep 17 00:00:00 2001 From: Bob Abeles Date: Thu, 7 Sep 2023 16:45:45 -0700 Subject: [PATCH 1645/1712] Review changes --- locale/circuitpython.pot | 8 -------- shared-bindings/memorymap/AddressRange.c | 3 ++- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 0d814b0ee6..21c69ff393 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2136,10 +2136,6 @@ msgstr "" msgid "UUID value is not str, int or byte buffer" msgstr "" -#: ports/raspberrypi/common-hal/memorymap/AddressRange.c -msgid "Unable to access unaliged IO register" -msgstr "" - #: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Unable to access unaligned IO register" msgstr "" @@ -4052,10 +4048,6 @@ msgstr "" msgid "source_bitmap must have value_count of 8" msgstr "" -#: shared-bindings/memorymap/AddressRange.c -msgid "start must be an int" -msgstr "" - #: py/objstr.c msgid "start/end indices" msgstr "" diff --git a/shared-bindings/memorymap/AddressRange.c b/shared-bindings/memorymap/AddressRange.c index 74df9efecf..4ea7c680f5 100644 --- a/shared-bindings/memorymap/AddressRange.c +++ b/shared-bindings/memorymap/AddressRange.c @@ -97,7 +97,8 @@ STATIC mp_obj_t memorymap_addressrange_make_new(const mp_obj_type_t *type, size_ } else if (mp_obj_is_type(args[ARG_start].u_obj, &mp_type_int)) { start = mp_obj_int_get_uint_checked(args[ARG_start].u_obj); } else { - mp_raise_TypeError(translate("start must be an int")); + mp_obj_t arg = mp_unary_op(MP_UNARY_OP_INT, args[ARG_start].u_obj); + start = mp_obj_int_get_uint_checked(arg); } size_t length = mp_arg_validate_int_min(args[ARG_length].u_int, 1, MP_QSTR_length); From 34ccee686d94d7d4da154236519b24869145b5cf Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Thu, 7 Sep 2023 21:05:38 +0000 Subject: [PATCH 1646/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (1000 of 1000 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index eadb239290..0d47864de6 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-08-29 18:34+0000\n" +"PO-Revision-Date: 2023-09-08 12:22+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -1411,7 +1411,7 @@ msgstr "Måste vara en %q-subklass." #: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c msgid "Must provide 5/6/5 RGB pins" -msgstr "" +msgstr "Måset ange 5/6/5 RGB-pinnar" #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" From 756815d1276a92d3c0a36536d4279f4b9df7a6bb Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 8 Sep 2023 16:15:04 +0000 Subject: [PATCH 1647/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (1000 of 1000 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index daf77c1c94..467ec8f1e4 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: 2023-08-29 18:34+0000\n" +"PO-Revision-Date: 2023-09-08 18:28+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -1425,7 +1425,7 @@ msgstr "Deve ser uma subclasse %q." #: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c msgid "Must provide 5/6/5 RGB pins" -msgstr "" +msgstr "É preciso fornecer os pinos RGB 5/6/5" #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" From afff8e51eb01b8b6ba7f2a2b16d6cd5ec5f02adf Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Fri, 8 Sep 2023 20:28:25 +0200 Subject: [PATCH 1648/1712] 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 | 17 +++++++++++++---- locale/cs.po | 17 +++++++++++++---- locale/de_DE.po | 20 ++++++++++++++++---- locale/el.po | 17 +++++++++++++---- locale/en_GB.po | 20 ++++++++++++++++---- locale/es.po | 20 ++++++++++++++++---- locale/fil.po | 17 +++++++++++++---- locale/fr.po | 20 ++++++++++++++++---- locale/hi.po | 17 +++++++++++++---- locale/it_IT.po | 17 +++++++++++++---- locale/ja.po | 17 +++++++++++++---- locale/ko.po | 17 +++++++++++++---- locale/nl.po | 17 +++++++++++++---- locale/pl.po | 17 +++++++++++++---- locale/pt_BR.po | 20 ++++++++++++++++---- locale/ru.po | 20 ++++++++++++++++---- locale/sv.po | 20 ++++++++++++++++---- locale/tr.po | 17 +++++++++++++---- locale/zh_Latn_pinyin.po | 20 ++++++++++++++++---- 19 files changed, 271 insertions(+), 76 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 0fbd6c2a51..9bbc16b76e 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -465,9 +465,14 @@ msgstr "Alamat harus sepanjang %d byte" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" @@ -2160,6 +2165,10 @@ msgstr "String UUID bukan 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgid "UUID value is not str, int or byte buffer" msgstr "Nilai UUID bukan str, int atau byte buffer" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2213,14 +2222,14 @@ msgstr "" msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Tidak dapat menulis ke nvm." +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "" diff --git a/locale/cs.po b/locale/cs.po index e6659f7aea..564fdb4689 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -466,9 +466,14 @@ msgstr "Adresa musí být %d bajtů dlouhá" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Všechny CAN periferie jsou používány" @@ -2149,6 +2154,10 @@ msgstr "" msgid "UUID value is not str, int or byte buffer" msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2202,14 +2211,14 @@ msgstr "" msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index 41eb8dcf22..7282d7a399 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -473,9 +473,14 @@ msgstr "Die Adresse muss %d Bytes lang sein" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Adressbereich nicht erlaubt" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Alle CAN-Schnittstellen sind in Benutzung" @@ -2187,6 +2192,10 @@ msgstr "UUID string ist nicht 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgid "UUID value is not str, int or byte buffer" msgstr "Der UUID-Wert ist kein str-, int- oder Byte-Puffer" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2240,14 +2249,14 @@ msgstr "ADC-DMA-Controller konnte nicht gestartet werden, Fehlercode: %d" msgid "Unable to start mDNS query" msgstr "mDNS-Abfrage kann nicht gestartet werden" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "An die Adresse kann nicht geschrieben werden." - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Schreiben in nvm nicht möglich." +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "Schreiben in sleep_memory nicht möglich." @@ -4466,6 +4475,9 @@ msgstr "zi muss eine Gleitkommazahl sein" msgid "zi must be of shape (n_section, 2)" msgstr "zi muss die Form (n_section, 2) haben" +#~ msgid "Unable to write to address." +#~ msgstr "An die Adresse kann nicht geschrieben werden." + #~ msgid "queue overflow" #~ msgstr "Warteschlangenüberlauf" diff --git a/locale/el.po b/locale/el.po index 20ee429652..350c6cf713 100644 --- a/locale/el.po +++ b/locale/el.po @@ -474,9 +474,14 @@ msgstr "Η διεύθυνση πρέπει να είναι %d bytes μεγάλη #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Όλα τα περιφεριακά CAN είναι σε χρήση" @@ -2162,6 +2167,10 @@ msgstr "" msgid "UUID value is not str, int or byte buffer" msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2215,14 +2224,14 @@ msgstr "" msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "" diff --git a/locale/en_GB.po b/locale/en_GB.po index 9b8f7e6ee9..c79e5056f1 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -472,9 +472,14 @@ msgstr "Address must be %d bytes long" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Address range not allowed" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "All CAN peripherals are in use" @@ -2162,6 +2167,10 @@ msgstr "UUID string not 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgid "UUID value is not str, int or byte buffer" msgstr "UUID value is not str, int or byte buffer" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2215,14 +2224,14 @@ msgstr "Unable to start ADC DMA controller, ErrorCode:%d" msgid "Unable to start mDNS query" msgstr "Unable to start mDNS query" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "Unable to write to address." - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Unable to write to nvm." +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "Unable to write to sleep_memory." @@ -4409,6 +4418,9 @@ msgstr "zi must be of float type" msgid "zi must be of shape (n_section, 2)" msgstr "zi must be of shape (n_section, 2)" +#~ msgid "Unable to write to address." +#~ msgstr "Unable to write to address." + #~ msgid "queue overflow" #~ msgstr "queue overflow" diff --git a/locale/es.po b/locale/es.po index 7e267f12b1..d1f2891c54 100644 --- a/locale/es.po +++ b/locale/es.po @@ -477,9 +477,14 @@ msgstr "La dirección debe tener %d bytes de longitud" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Rango de dirección no permitido" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Todos los periféricos CAN están en uso" @@ -2201,6 +2206,10 @@ msgstr "UUID string no es 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgid "UUID value is not str, int or byte buffer" msgstr "UUID valor no es un str, int o byte buffer" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2255,14 +2264,14 @@ msgstr "Imposible de iniciar el controlador ADC DMA, código de error:%d" msgid "Unable to start mDNS query" msgstr "Imposible de incializar una consulta mDNS" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "Imposible de escribir en esa dirección." - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Imposible escribir en nvm." +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "Imposible de escribir en sleep_memory." @@ -4462,6 +4471,9 @@ msgstr "zi debe ser de tipo flotante" msgid "zi must be of shape (n_section, 2)" msgstr "zi debe ser una forma (n_section,2)" +#~ msgid "Unable to write to address." +#~ msgstr "Imposible de escribir en esa dirección." + #~ msgid "queue overflow" #~ msgstr "desbordamiento de cola(queue)" diff --git a/locale/fil.po b/locale/fil.po index 6aac262576..739d957998 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -464,9 +464,14 @@ msgstr "ang palette ay dapat 32 bytes ang haba" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" @@ -2150,6 +2155,10 @@ msgstr "" msgid "UUID value is not str, int or byte buffer" msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2203,14 +2212,14 @@ msgstr "" msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Hindi ma i-sulat sa NVM." +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "" diff --git a/locale/fr.po b/locale/fr.po index 2beabfa3a4..10b20a3d51 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -476,9 +476,14 @@ msgstr "L'adresse doit être longue de %d octets" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Plage d'adresses non autorisée" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Tous les périphériques CAN sont utilisés" @@ -2208,6 +2213,10 @@ msgstr "" "La valeur de l'UUID n'est pas une chaîne de caractères, un chiffre entier ou " "un tampon d'octets" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2261,14 +2270,14 @@ msgstr "" msgid "Unable to start mDNS query" msgstr "Impossible de lancer la requête mDNS" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "L'écriture a échoué." - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Écriture impossible vers nvm." +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "Écriture impossible vers sleep_memory." @@ -4482,6 +4491,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 "Unable to write to address." +#~ msgstr "L'écriture a échoué." + #~ msgid "queue overflow" #~ msgstr "dépassement de file" diff --git a/locale/hi.po b/locale/hi.po index 93f039352e..87f0f9ec35 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -462,9 +462,14 @@ msgstr "" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" @@ -2136,6 +2141,10 @@ msgstr "" msgid "UUID value is not str, int or byte buffer" msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2189,14 +2198,14 @@ msgstr "" msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index d05baee044..f4b862ac4c 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -467,9 +467,14 @@ msgstr "L'indirizzo deve essere lungo %d byte" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Tutte le periferiche CAN sono in uso" @@ -2157,6 +2162,10 @@ msgstr "" msgid "UUID value is not str, int or byte buffer" msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2210,14 +2219,14 @@ msgstr "" msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Imposibile scrivere su nvm." +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "" diff --git a/locale/ja.po b/locale/ja.po index b107a4bc18..efe1ba664e 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -469,9 +469,14 @@ msgstr "アドレスは、%dバイト長でなければなりません" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "全てのCAN周辺機器が使用中" @@ -2151,6 +2156,10 @@ msgstr "" msgid "UUID value is not str, int or byte buffer" msgstr "UUIDの値がstr, int, bufferのいずれでもありません" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2204,14 +2213,14 @@ msgstr "" msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "nvmに書き込みできません" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "" diff --git a/locale/ko.po b/locale/ko.po index 6b9ca9f1b0..1ff7ddc557 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -463,9 +463,14 @@ msgstr "" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" @@ -2140,6 +2145,10 @@ msgid "UUID value is not str, int or byte buffer" msgstr "" "UUID값이 문자열(str), 정수(int) 또는 바이트버퍼가(byte buffer) 아닙니다" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2193,14 +2202,14 @@ msgstr "" msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 7d070b4348..6ddb299e45 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -462,9 +462,14 @@ msgstr "Adres moet %d bytes lang zijn" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Alle CAN-peripherals zijn in gebruik" @@ -2155,6 +2160,10 @@ msgstr "UUID string is niet 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgid "UUID value is not str, int or byte buffer" msgstr "UUID waarde is geen str, int, of byte buffer" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2208,14 +2217,14 @@ msgstr "" msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Niet in staat om naar nvm te schrijven." +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "Kan niet naar sleep_memory schrijven." diff --git a/locale/pl.po b/locale/pl.po index 1c06559739..77e5af1268 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -464,9 +464,14 @@ msgstr "Adres musi mieć %d bajtów" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "" @@ -2142,6 +2147,10 @@ msgstr "UUID inny, niż `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgid "UUID value is not str, int or byte buffer" msgstr "UUID nie jest typu str, int lub bytes" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2195,14 +2204,14 @@ msgstr "" msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Błąd zapisu do NVM." +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 467ec8f1e4..b03adde224 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -479,9 +479,14 @@ msgstr "O endereço deve ter %d bytes de comprimento" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Intervalo de endereços não permitido" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Todos os periféricos CAN estão em uso" @@ -2202,6 +2207,10 @@ msgstr "A cadeia de caracteres UUID não 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgid "UUID value is not str, int or byte buffer" msgstr "O valor UUID não é um buffer str, int ou byte" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2255,14 +2264,14 @@ msgstr "Não foi possível iniciar o controlador ADC DMA, ErrorCode:%d" msgid "Unable to start mDNS query" msgstr "Não é possível iniciar a consulta mDNS" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "Não é possível gravar no endereço." - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Não é possível gravar no nvm." +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "Não foi possível escrever no sleep_memory." @@ -4470,6 +4479,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 "Unable to write to address." +#~ msgstr "Não é possível gravar no endereço." + #~ msgid "queue overflow" #~ msgstr "estouro de fila" diff --git a/locale/ru.po b/locale/ru.po index 6ddf967794..a1f4452d95 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -478,9 +478,14 @@ msgstr "Адрес должен быть длиной %d байт" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Диапазон адресов не разрешен" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Все периферийные устройства CAN уже используются" @@ -2204,6 +2209,10 @@ msgstr "UUID строка не 'xxxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxxxxx msgid "UUID value is not str, int or byte buffer" msgstr "Значение UUID не является строковым, целым или байтовым буфером" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2257,14 +2266,14 @@ msgstr "Не удается запустить контроллер ADC DMA, к msgid "Unable to start mDNS query" msgstr "Не удается запустить запрос mDNS" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "Невозможно написать на адрес." - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Невозможно выполнить запись в nvm." +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "Невозможно записать в Sleep_memory." @@ -4478,6 +4487,9 @@ msgstr "zi должно быть типа float" msgid "zi must be of shape (n_section, 2)" msgstr "zi должен иметь форму (n_section, 2)" +#~ msgid "Unable to write to address." +#~ msgstr "Невозможно написать на адрес." + #~ msgid "queue overflow" #~ msgstr "Переполнение очереди" diff --git a/locale/sv.po b/locale/sv.po index 0d47864de6..0311244e6d 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -476,9 +476,14 @@ msgstr "Adressen måste vara %d byte lång" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "Adressintervallet är inte tillåtet" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "All CAN-kringutrustning används" @@ -2176,6 +2181,10 @@ msgstr "UUID-sträng inte \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"" msgid "UUID value is not str, int or byte buffer" msgstr "UUID-värdet är inte str, int eller byte-buffert" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2229,14 +2238,14 @@ msgstr "Kan inte starta ADC DMA controller, Felkod:%d" msgid "Unable to start mDNS query" msgstr "Det gick inte att starta mDNS-frågan" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "Det går inte att skriva till adress." - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Det gick inte att skriva till nvm." +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "Det gick inte att skriva till sleep_memory." @@ -4429,6 +4438,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 "Unable to write to address." +#~ msgstr "Det går inte att skriva till adress." + #~ msgid "queue overflow" #~ msgstr "köstorlek överskreds" diff --git a/locale/tr.po b/locale/tr.po index ec87faadcb..66aee1321d 100644 --- a/locale/tr.po +++ b/locale/tr.po @@ -471,9 +471,14 @@ msgstr "Adres %d byte uzunluğunda olmalıdır" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "Tüm CAN çevre birimleri kullanımda" @@ -2156,6 +2161,10 @@ msgstr "" msgid "UUID value is not str, int or byte buffer" msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2209,14 +2218,14 @@ msgstr "" msgid "Unable to start mDNS query" msgstr "" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "" - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index e805fff144..09527f8b87 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -477,9 +477,14 @@ msgstr "dìzhǐ chángdù bìxū shì %d zìjié" #: ports/espressif/common-hal/memorymap/AddressRange.c #: ports/nrf/common-hal/memorymap/AddressRange.c +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Address range not allowed" msgstr "bù yǔn xǔ de dì zhǐ fàn wéi" +#: shared-bindings/memorymap/AddressRange.c +msgid "Address range wraps around" +msgstr "" + #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" msgstr "suǒyǒu CAN wàishè dōu zài shǐyòng zhōng" @@ -2179,6 +2184,10 @@ msgstr "UUID Zìfú chuàn bùshì 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'" msgid "UUID value is not str, int or byte buffer" msgstr "UUID zhí bùshì str,int huò zì jié huǎnchōng qū" +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to access unaligned IO register" +msgstr "" + #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c #: ports/raspberrypi/common-hal/audiobusio/I2SOut.c @@ -2232,14 +2241,14 @@ msgstr "wú fǎ qǐ dòng ADC DMA kòng zhì qì, cuò wù dài mǎ:%d" msgid "Unable to start mDNS query" msgstr "wú fǎ qǐ dòng mDNS chá xún" -#: shared-bindings/memorymap/AddressRange.c -msgid "Unable to write to address." -msgstr "Wú fǎ xiě rù dì zhǐ." - #: shared-bindings/nvm/ByteArray.c msgid "Unable to write to nvm." msgstr "Wúfǎ xiě rù nvm." +#: ports/raspberrypi/common-hal/memorymap/AddressRange.c +msgid "Unable to write to read-only memory" +msgstr "" + #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." msgstr "wú fǎ xiě rù sleep_memory." @@ -4434,6 +4443,9 @@ msgstr "zi bìxū wèi fú diǎn xíng" msgid "zi must be of shape (n_section, 2)" msgstr "zi bìxū jùyǒu xíngzhuàng (n_section,2)" +#~ msgid "Unable to write to address." +#~ msgstr "Wú fǎ xiě rù dì zhǐ." + #~ msgid "queue overflow" #~ msgstr "duìliè yìchū" From 92eaf6236f73f3b1b52a1dd9121b16607284b0b6 Mon Sep 17 00:00:00 2001 From: Elviss Kustans Date: Sat, 9 Sep 2023 01:38:08 +0000 Subject: [PATCH 1649/1712] Add M5Stack AtomS3U --- .../espressif/boards/m5stack_atoms3u/board.c | 29 ++++++++++++++ .../boards/m5stack_atoms3u/mpconfigboard.h | 35 +++++++++++++++++ .../boards/m5stack_atoms3u/mpconfigboard.mk | 11 ++++++ ports/espressif/boards/m5stack_atoms3u/pins.c | 38 +++++++++++++++++++ .../boards/m5stack_atoms3u/sdkconfig | 7 ++++ 5 files changed, 120 insertions(+) create mode 100644 ports/espressif/boards/m5stack_atoms3u/board.c create mode 100644 ports/espressif/boards/m5stack_atoms3u/mpconfigboard.h create mode 100644 ports/espressif/boards/m5stack_atoms3u/mpconfigboard.mk create mode 100644 ports/espressif/boards/m5stack_atoms3u/pins.c create mode 100644 ports/espressif/boards/m5stack_atoms3u/sdkconfig diff --git a/ports/espressif/boards/m5stack_atoms3u/board.c b/ports/espressif/boards/m5stack_atoms3u/board.c new file mode 100644 index 0000000000..164430c88c --- /dev/null +++ b/ports/espressif/boards/m5stack_atoms3u/board.c @@ -0,0 +1,29 @@ +/* + * 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/m5stack_atoms3u/mpconfigboard.h b/ports/espressif/boards/m5stack_atoms3u/mpconfigboard.h new file mode 100644 index 0000000000..1c3376cee4 --- /dev/null +++ b/ports/espressif/boards/m5stack_atoms3u/mpconfigboard.h @@ -0,0 +1,35 @@ +/* + * 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 "M5Stack AtomS3U" +#define MICROPY_HW_MCU_NAME "ESP32S3" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO35) + +#define CIRCUITPY_BOARD_I2C (1) +#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO1, .sda = &pin_GPIO2}} diff --git a/ports/espressif/boards/m5stack_atoms3u/mpconfigboard.mk b/ports/espressif/boards/m5stack_atoms3u/mpconfigboard.mk new file mode 100644 index 0000000000..dc65fefc4b --- /dev/null +++ b/ports/espressif/boards/m5stack_atoms3u/mpconfigboard.mk @@ -0,0 +1,11 @@ +USB_VID = 0x303A +USB_PID = 0x8187 +USB_PRODUCT = "M5Stack AtomS3U" +USB_MANUFACTURER = "M5Stack" + +IDF_TARGET = esp32s3 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_atoms3u/pins.c b/ports/espressif/boards/m5stack_atoms3u/pins.c new file mode 100644 index 0000000000..716efa593b --- /dev/null +++ b/ports/espressif/boards/m5stack_atoms3u/pins.c @@ -0,0 +1,38 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_PORTA_SCL), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_D1), MP_ROM_PTR(&pin_GPIO1) }, + + { MP_ROM_QSTR(MP_QSTR_PORTA_SCL), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO2) }, + + { MP_ROM_QSTR(MP_QSTR_A14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_A17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_D40), MP_ROM_PTR(&pin_GPIO40) }, + + { MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_GPIO42) }, + + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_BTN), MP_ROM_PTR(&pin_GPIO41) }, + + { MP_ROM_QSTR(MP_QSTR_IR_LED), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_PDM_MIC_CLK), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_PDM_MIC_DATA), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_PORTA_I2C), MP_ROM_PTR(&board_i2c_obj) }, +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/m5stack_atoms3u/sdkconfig b/ports/espressif/boards/m5stack_atoms3u/sdkconfig new file mode 100644 index 0000000000..9d924272ec --- /dev/null +++ b/ports/espressif/boards/m5stack_atoms3u/sdkconfig @@ -0,0 +1,7 @@ +CONFIG_ESP32S3_SPIRAM_SUPPORT=n + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP From 0391983c96c0cb7d2842cd9e283262d159be50c9 Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Fri, 8 Sep 2023 23:43:05 +0000 Subject: [PATCH 1650/1712] Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (1002 of 1002 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index b03adde224..a3bbce9653 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: 2023-09-08 18:28+0000\n" +"PO-Revision-Date: 2023-09-10 08:50+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -485,7 +485,7 @@ msgstr "Intervalo de endereços não permitido" #: shared-bindings/memorymap/AddressRange.c msgid "Address range wraps around" -msgstr "" +msgstr "O intervalo de endereços envolve" #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" @@ -2209,7 +2209,7 @@ msgstr "O valor UUID não é um buffer str, int ou byte" #: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Unable to access unaligned IO register" -msgstr "" +msgstr "Não foi possível acessar o registro IO não solicitado" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -2270,7 +2270,7 @@ msgstr "Não é possível gravar no nvm." #: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Unable to write to read-only memory" -msgstr "" +msgstr "Não foi possível escrever na memória de somente leitura" #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." From b6c5858e9603c13f1809f2e049ead0a2c60ade25 Mon Sep 17 00:00:00 2001 From: Jonny Bergdahl Date: Fri, 8 Sep 2023 18:39:22 +0000 Subject: [PATCH 1651/1712] Translated using Weblate (Swedish) Currently translated at 100.0% (1002 of 1002 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/sv/ --- locale/sv.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/locale/sv.po b/locale/sv.po index 0311244e6d..90ba90457a 100644 --- a/locale/sv.po +++ b/locale/sv.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: 2023-09-08 12:22+0000\n" +"PO-Revision-Date: 2023-09-10 08:50+0000\n" "Last-Translator: Jonny Bergdahl \n" "Language-Team: LANGUAGE \n" "Language: sv\n" @@ -482,7 +482,7 @@ msgstr "Adressintervallet är inte tillåtet" #: shared-bindings/memorymap/AddressRange.c msgid "Address range wraps around" -msgstr "" +msgstr "Adressintervall ger överflödesfel" #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" @@ -2183,7 +2183,7 @@ msgstr "UUID-värdet är inte str, int eller byte-buffert" #: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Unable to access unaligned IO register" -msgstr "" +msgstr "Kan inte komma åt ojusterat IO-register" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -2244,7 +2244,7 @@ msgstr "Det gick inte att skriva till nvm." #: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Unable to write to read-only memory" -msgstr "" +msgstr "Kan inte skriva till skrivskyddat minne" #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." From 485929bab9c43c0169de7af4c3a26c87340d3faa Mon Sep 17 00:00:00 2001 From: Andi Chandler Date: Fri, 8 Sep 2023 21:10:38 +0000 Subject: [PATCH 1652/1712] Translated using Weblate (English (United Kingdom)) Currently translated at 100.0% (1002 of 1002 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/en_GB/ --- locale/en_GB.po | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/locale/en_GB.po b/locale/en_GB.po index c79e5056f1..158b5a1c9c 100644 --- a/locale/en_GB.po +++ b/locale/en_GB.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-08-14 01:48+0000\n" +"PO-Revision-Date: 2023-09-10 08:50+0000\n" "Last-Translator: Andi Chandler \n" "Language-Team: none\n" "Language: en_GB\n" @@ -15,7 +15,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 5.0-dev\n" +"X-Generator: Weblate 5.0.1-dev\n" #: main.c msgid "" @@ -39,6 +39,9 @@ msgid "" "Please file an issue with your program at github.com/adafruit/circuitpython/" "issues." msgstr "" +"\n" +"Please file an issue with your program at github.com/adafruit/circuitpython/" +"issues." #: supervisor/shared/safe_mode.c msgid "" @@ -433,7 +436,7 @@ msgstr "'yield' outside function" #: py/compile.c msgid "* arg after **" -msgstr "" +msgstr "* arg after **" #: py/compile.c msgid "*x must be assignment target" @@ -463,7 +466,7 @@ msgstr "ADC2 is being used by WiFi" #: ports/raspberrypi/common-hal/wifi/Radio.c msgid "AP could not be started" -msgstr "" +msgstr "AP could not be started" #: shared-bindings/_bleio/Address.c shared-bindings/ipaddress/IPv4Address.c #, c-format @@ -478,7 +481,7 @@ msgstr "Address range not allowed" #: shared-bindings/memorymap/AddressRange.c msgid "Address range wraps around" -msgstr "" +msgstr "Address range wraps around" #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" @@ -708,7 +711,7 @@ msgstr "Buffer too short by %d bytes" #: shared-bindings/framebufferio/FramebufferDisplay.c #: shared-bindings/struct/__init__.c shared-module/struct/__init__.c msgid "Buffer too small" -msgstr "" +msgstr "Buffer too small" #: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c msgid "Buffers must be same size" @@ -1132,7 +1135,7 @@ msgstr "Half duplex SPI is not implemented" #: supervisor/shared/safe_mode.c msgid "Hard fault: memory access or instruction error." -msgstr "" +msgstr "Hard fault: memory access or instruction error." #: ports/mimxrt10xx/common-hal/busio/SPI.c #: ports/mimxrt10xx/common-hal/busio/UART.c ports/stm/common-hal/busio/I2C.c @@ -1406,7 +1409,7 @@ msgstr "Must be a %q subclass." #: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c msgid "Must provide 5/6/5 RGB pins" -msgstr "" +msgstr "Must provide 5/6/5 RGB pins" #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" @@ -1796,7 +1799,7 @@ msgstr "Polygon needs at least 3 points" #: supervisor/shared/safe_mode.c msgid "Power dipped. Make sure you are providing enough power." -msgstr "" +msgstr "Power dipped. Make sure you are providing enough power." #: shared-bindings/_bleio/Adapter.c msgid "Prefix buffer must be on the heap" @@ -2169,7 +2172,7 @@ msgstr "UUID value is not str, int or byte buffer" #: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Unable to access unaligned IO register" -msgstr "" +msgstr "Unable to access unaligned IO register" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -2230,7 +2233,7 @@ msgstr "Unable to write to nvm." #: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Unable to write to read-only memory" -msgstr "" +msgstr "Unable to write to read-only memory" #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." @@ -2417,7 +2420,7 @@ msgstr "You pressed button A at start up." #: ports/espressif/boards/m5stack_m5paper/mpconfigboard.h msgid "You pressed button DOWN at start up." -msgstr "" +msgstr "You pressed button DOWN at start up." #: supervisor/shared/safe_mode.c msgid "You pressed the BOOT button at start up" @@ -2542,7 +2545,7 @@ msgstr "array/bytes required on right side" #: py/asmxtensa.c msgid "asm overflow" -msgstr "" +msgstr "asm overflow" #: extmod/ulab/code/numpy/numerical.c msgid "attempt to get (arg)min/(arg)max of empty sequence" @@ -2634,7 +2637,7 @@ msgstr "Buffer too small for requested bytes" #: py/emitbc.c msgid "bytecode overflow" -msgstr "" +msgstr "bytecode overflow" #: py/objarray.c msgid "bytes length not a multiple of item size" @@ -2693,7 +2696,7 @@ msgstr "can't convert %s to complex" #: py/obj.c #, c-format msgid "can't convert %s to float" -msgstr "" +msgstr "can't convert %s to float" #: py/objstr.c msgid "can't convert '%q' object to %q implicitly" @@ -2709,7 +2712,7 @@ msgstr "can't convert to complex" #: py/obj.c msgid "can't convert to float" -msgstr "" +msgstr "can't convert to float" #: py/runtime.c msgid "can't convert to int" @@ -2793,7 +2796,7 @@ msgstr "" #: extmod/moduasyncio.c msgid "can't wait" -msgstr "" +msgstr "can't wait" #: extmod/ulab/code/ndarray.c msgid "cannot assign new shape" @@ -3231,11 +3234,11 @@ msgstr "import * not at module level" #: py/persistentcode.c msgid "incompatible .mpy arch" -msgstr "" +msgstr "incompatible .mpy arch" #: py/persistentcode.c msgid "incompatible .mpy file" -msgstr "" +msgstr "incompatible .mpy file" #: py/objstr.c msgid "incomplete format" @@ -3699,7 +3702,7 @@ msgstr "not a 128-bit UUID" #: py/parse.c msgid "not a constant" -msgstr "" +msgstr "not a constant" #: py/objstr.c msgid "not all arguments converted during string formatting" @@ -3937,11 +3940,11 @@ msgstr "port must be >= 0" #: py/compile.c msgid "positional arg after **" -msgstr "" +msgstr "positional arg after **" #: py/compile.c msgid "positional arg after keyword arg" -msgstr "" +msgstr "positional arg after keyword arg" #: py/objint_mpz.c msgid "pow() 3rd argument cannot be 0" @@ -4168,7 +4171,7 @@ msgstr "tobytes can be invoked for dense arrays only" #: py/compile.c msgid "too many args" -msgstr "" +msgstr "too many args" #: extmod/ulab/code/ndarray.c extmod/ulab/code/numpy/create.c msgid "too many dimensions" From 2003d237c4ecae1de8d30c1a875798e0b1082b1b Mon Sep 17 00:00:00 2001 From: xXx Date: Sat, 9 Sep 2023 08:47:13 +0000 Subject: [PATCH 1653/1712] Translated using Weblate (Russian) Currently translated at 100.0% (1002 of 1002 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ru/ --- locale/ru.po | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/locale/ru.po b/locale/ru.po index a1f4452d95..7f4b6088bb 100644 --- a/locale/ru.po +++ b/locale/ru.po @@ -7,15 +7,15 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2023-09-06 13:57+0000\n" -"Last-Translator: Jeff Epler \n" +"PO-Revision-Date: 2023-09-10 08:50+0000\n" +"Last-Translator: xXx \n" "Language-Team: none\n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" -"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "X-Generator: Weblate 5.0.1-dev\n" #: main.c @@ -484,7 +484,7 @@ msgstr "Диапазон адресов не разрешен" #: shared-bindings/memorymap/AddressRange.c msgid "Address range wraps around" -msgstr "" +msgstr "Обертывание диапазона адресов" #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" @@ -1437,7 +1437,7 @@ msgstr "Должен быть субклассом %q." #: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c msgid "Must provide 5/6/5 RGB pins" -msgstr "" +msgstr "Должен иметь 5/6/5 контактов RGB" #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" @@ -2211,7 +2211,7 @@ msgstr "Значение UUID не является строковым, целы #: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Unable to access unaligned IO register" -msgstr "" +msgstr "Невозможно получить доступ к невыровненному регистру ввода-вывода" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -2272,7 +2272,7 @@ msgstr "Невозможно выполнить запись в nvm." #: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Unable to write to read-only memory" -msgstr "" +msgstr "Невозможно записать в постоянную память" #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." From 722d64b0e7a53b240eaa395a5716e6cbbb482ae4 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 11 Sep 2023 12:07:45 -0400 Subject: [PATCH 1654/1712] Add root cert DST Root CA X3 for Let's Encrypt --- lib/certificates | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/certificates b/lib/certificates index 5c85c604a0..cbb33c111f 160000 --- a/lib/certificates +++ b/lib/certificates @@ -1 +1 @@ -Subproject commit 5c85c604a0d77a08df93435e4afad5f541c38923 +Subproject commit cbb33c111f245411370c1e571012472323df3f07 From 5a966960256884459de11203cf9e5774851a6a5a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 11 Sep 2023 13:46:08 -0500 Subject: [PATCH 1655/1712] This board got a KICKIN marketing name --- .../board.c | 0 .../mpconfigboard.h | 2 +- .../mpconfigboard.mk | 2 +- .../pins.c | 0 .../sdkconfig | 2 +- 5 files changed, 3 insertions(+), 3 deletions(-) rename ports/espressif/boards/{adafruit_esp32s3_rgb_tft_experiment => adafruit_qualia_s3_rgb666}/board.c (100%) rename ports/espressif/boards/{adafruit_esp32s3_rgb_tft_experiment => adafruit_qualia_s3_rgb666}/mpconfigboard.h (95%) rename ports/espressif/boards/{adafruit_esp32s3_rgb_tft_experiment => adafruit_qualia_s3_rgb666}/mpconfigboard.mk (80%) rename ports/espressif/boards/{adafruit_esp32s3_rgb_tft_experiment => adafruit_qualia_s3_rgb666}/pins.c (100%) rename ports/espressif/boards/{adafruit_esp32s3_rgb_tft_experiment => adafruit_qualia_s3_rgb666}/sdkconfig (95%) diff --git a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/board.c b/ports/espressif/boards/adafruit_qualia_s3_rgb666/board.c similarity index 100% rename from ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/board.c rename to ports/espressif/boards/adafruit_qualia_s3_rgb666/board.c diff --git a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.h b/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.h similarity index 95% rename from ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.h rename to ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.h index 2762cd4208..9acfe8cf06 100644 --- a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.h @@ -26,7 +26,7 @@ // Micropython setup -#define MICROPY_HW_BOARD_NAME "Adafruit-ESP32-S3-RGB-TFT-Experiment" +#define MICROPY_HW_BOARD_NAME "Adafruit-Qualia-S3-RGB666" #define MICROPY_HW_MCU_NAME "ESP32S3" #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.mk b/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk similarity index 80% rename from ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.mk rename to ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk index 9e66fc4359..1bde6abfe4 100644 --- a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk @@ -1,6 +1,6 @@ USB_VID = 0x239A USB_PID = 0x8148 -USB_PRODUCT = "Adafruit-ESP32-S3-RGB-TFT-Experiment" +USB_PRODUCT = "Qualia-S3-RGB666" USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 diff --git a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/pins.c b/ports/espressif/boards/adafruit_qualia_s3_rgb666/pins.c similarity index 100% rename from ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/pins.c rename to ports/espressif/boards/adafruit_qualia_s3_rgb666/pins.c diff --git a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/sdkconfig b/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig similarity index 95% rename from ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/sdkconfig rename to ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig index 4449c672e1..79d78825fc 100644 --- a/ports/espressif/boards/adafruit_esp32s3_rgb_tft_experiment/sdkconfig +++ b/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig @@ -28,7 +28,7 @@ CONFIG_SPIRAM_MEMTEST=y # # LWIP # -CONFIG_LWIP_LOCAL_HOSTNAME="matouch-tft" +CONFIG_LWIP_LOCAL_HOSTNAME="qualia" # end of LWIP # # CONFIG_ESP_CONSOLE_NONE is not set From 6e9c21baba423958893d14aa7b3945563628e0b0 Mon Sep 17 00:00:00 2001 From: Bill Sideris Date: Mon, 11 Sep 2023 23:35:54 +0300 Subject: [PATCH 1656/1712] Deinit all the pins. --- ports/espressif/common-hal/espcamera/Camera.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/espressif/common-hal/espcamera/Camera.c b/ports/espressif/common-hal/espcamera/Camera.c index 574b4e846b..7db8a4b4c1 100644 --- a/ports/espressif/common-hal/espcamera/Camera.c +++ b/ports/espressif/common-hal/espcamera/Camera.c @@ -161,6 +161,10 @@ extern void common_hal_espcamera_camera_deinit(espcamera_camera_obj_t *self) { esp_camera_deinit(); + reset_pin_number(self->camera_config.pin_pclk); + reset_pin_number(self->camera_config.pin_vsync); + reset_pin_number(self->camera_config.pin_href); + self->camera_config.xclk_freq_hz = 0; } From 05267948b4639316b87899428a0bdf112bdb53f4 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 12 Sep 2023 11:24:02 -0400 Subject: [PATCH 1657/1712] Revert "formatting" (from #8089) This reverts commit 4bb475b930d4237f09f26ac3a6f841fbd690d026. --- ports/nrf/common-hal/busio/UART.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index 626956946f..94201774de 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -266,7 +266,7 @@ bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) { } void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { - volatile uint32_t *power_cycle = (void *)(self->uarte->p_reg) + 0xFFC; + volatile uint32_t *power_cycle = (void*)(self->uarte->p_reg) + 0xFFC; if (!common_hal_busio_uart_deinited(self)) { nrfx_uarte_rx_abort(self->uarte); nrfx_uarte_tx_abort(self->uarte); From 46bcd103a7a52cc1c80aedbc20928422115b2345 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 12 Sep 2023 11:24:49 -0400 Subject: [PATCH 1658/1712] Revert "Reset UART on deinit, reduces power consumption" (from #8089) This reverts commit ec1e7a03b38c625664a4615e60d26956205d7a67. --- ports/nrf/common-hal/busio/UART.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/ports/nrf/common-hal/busio/UART.c b/ports/nrf/common-hal/busio/UART.c index 94201774de..10a34e09df 100644 --- a/ports/nrf/common-hal/busio/UART.c +++ b/ports/nrf/common-hal/busio/UART.c @@ -266,15 +266,8 @@ bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) { } void common_hal_busio_uart_deinit(busio_uart_obj_t *self) { - volatile uint32_t *power_cycle = (void*)(self->uarte->p_reg) + 0xFFC; if (!common_hal_busio_uart_deinited(self)) { - nrfx_uarte_rx_abort(self->uarte); - nrfx_uarte_tx_abort(self->uarte); nrfx_uarte_uninit(self->uarte); - // power cycle the peripheral as per https://devzone.nordicsemi.com/f/nordic-q-a/26030/how-to-reach-nrf52840-uarte-current-supply-specification/102605#102605 - *power_cycle = 0; - *power_cycle; - *power_cycle = 1; reset_pin_number(self->tx_pin_number); reset_pin_number(self->rx_pin_number); reset_pin_number(self->rts_pin_number); From d8aeceb70686d5e23a121be8bf92715d6105c21f Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 12 Sep 2023 12:45:46 -0400 Subject: [PATCH 1659/1712] SSLContext.load_verify_locations - no kw-only args --- shared-bindings/ssl/SSLContext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/ssl/SSLContext.c b/shared-bindings/ssl/SSLContext.c index ac5f7ad42d..5695cf1b9b 100644 --- a/shared-bindings/ssl/SSLContext.c +++ b/shared-bindings/ssl/SSLContext.c @@ -101,7 +101,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ssl_sslcontext_load_cert_chain_obj, 1, ssl_ssl STATIC mp_obj_t ssl_sslcontext_load_verify_locations(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_cadata }; static const mp_arg_t allowed_args[] = { - { MP_QSTR_cadata, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} }, + { MP_QSTR_cadata, MP_ARG_OBJ, {.u_obj = mp_const_none} }, }; ssl_sslcontext_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]); From c65dbf3f0d8a073549dc53fe9174086145664a2a Mon Sep 17 00:00:00 2001 From: hexthat Date: Tue, 12 Sep 2023 16:55:15 +0000 Subject: [PATCH 1660/1712] Translated using Weblate (Chinese (Pinyin)) Currently translated at 100.0% (1002 of 1002 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/zh_Latn/ --- locale/zh_Latn_pinyin.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 09527f8b87..3cf7b93b0d 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: circuitpython-cn\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2023-08-29 18:34+0000\n" +"PO-Revision-Date: 2023-09-13 17:49+0000\n" "Last-Translator: hexthat \n" "Language-Team: Chinese Hanyu Pinyin\n" "Language: zh_Latn_pinyin\n" @@ -483,7 +483,7 @@ msgstr "bù yǔn xǔ de dì zhǐ fàn wéi" #: shared-bindings/memorymap/AddressRange.c msgid "Address range wraps around" -msgstr "" +msgstr "dìzhǐ fànwéi huánrào" #: ports/espressif/common-hal/canio/CAN.c msgid "All CAN peripherals are in use" @@ -1421,7 +1421,7 @@ msgstr "Bìxū shì %q zi lèi." #: ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c msgid "Must provide 5/6/5 RGB pins" -msgstr "" +msgstr "bìxū tígòng 5/6/5RGB yǐnjiǎo" #: ports/mimxrt10xx/common-hal/busio/SPI.c shared-bindings/busio/SPI.c msgid "Must provide MISO or MOSI pin" @@ -2186,7 +2186,7 @@ msgstr "UUID zhí bùshì str,int huò zì jié huǎnchōng qū" #: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Unable to access unaligned IO register" -msgstr "" +msgstr "wúfǎ fǎngwèn wèi duìqí de IO jìcúnqì" #: ports/atmel-samd/common-hal/audiobusio/I2SOut.c #: ports/atmel-samd/common-hal/audioio/AudioOut.c @@ -2247,7 +2247,7 @@ msgstr "Wúfǎ xiě rù nvm." #: ports/raspberrypi/common-hal/memorymap/AddressRange.c msgid "Unable to write to read-only memory" -msgstr "" +msgstr "wúfǎ xiěrù zhǐdú nèicún" #: shared-bindings/alarm/SleepMemory.c msgid "Unable to write to sleep_memory." From a18e015888a347f182161458666c1447c1e29efc Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Fri, 6 Jan 2023 12:15:06 +0530 Subject: [PATCH 1661/1712] update idf to v5.0 --- .gitmodules | 15 +- ports/espressif/CMakeLists.txt | 8 +- ports/espressif/Makefile | 66 +- ports/espressif/README.rst | 2 +- ports/espressif/common-hal/_bleio/Adapter.c | 1 - .../espressif/common-hal/alarm/pin/PinAlarm.c | 4 +- .../espressif/common-hal/analogio/AnalogIn.c | 7 +- .../common-hal/audiobusio/__init__.c | 12 +- ports/espressif/common-hal/busio/SPI.c | 2 +- ports/espressif/common-hal/countio/Counter.c | 2 + .../espressif/common-hal/dualbank/__init__.c | 5 +- ports/espressif/common-hal/espidf/__init__.c | 10 +- ports/espressif/common-hal/espulp/ULP.c | 17 +- ports/espressif/common-hal/espulp/ULPAlarm.c | 4 +- .../common-hal/frequencyio/FrequencyIn.c | 20 +- ports/espressif/common-hal/hashlib/Hash.c | 4 +- ports/espressif/common-hal/hashlib/__init__.c | 2 +- .../espressif/common-hal/mdns/RemoteService.h | 2 +- ports/espressif/common-hal/mdns/Server.c | 29 +- .../common-hal/memorymap/AddressRange.c | 2 - .../common-hal/microcontroller/Pin.c | 58 +- .../common-hal/microcontroller/Processor.c | 18 +- .../common-hal/neopixel_write/__init__.c | 1 - ports/espressif/common-hal/os/__init__.c | 3 +- .../common-hal/paralleldisplay/ParallelBus.c | 9 +- ports/espressif/common-hal/pulseio/PulseIn.h | 1 - ports/espressif/common-hal/pulseio/PulseOut.h | 1 - ports/espressif/common-hal/pwmio/PWMOut.c | 5 +- .../espressif/common-hal/socketpool/Socket.c | 4 +- .../espressif/common-hal/socketpool/Socket.h | 1 + .../common-hal/socketpool/SocketPool.c | 4 +- ports/espressif/common-hal/ssl/SSLContext.c | 1 + ports/espressif/common-hal/ssl/SSLSocket.c | 5 +- ports/espressif/common-hal/ssl/SSLSocket.h | 1 + .../common-hal/watchdog/WatchDogTimer.c | 7 +- ports/espressif/common-hal/wifi/Radio.c | 2 +- ports/espressif/common-hal/wifi/Radio.h | 2 + ports/espressif/common-hal/wifi/__init__.c | 2 +- ports/espressif/esp-idf | 2 +- .../esp-idf-config/sdkconfig-esp32c3.defaults | 171 +--- .../esp-idf-config/sdkconfig-esp32s2.defaults | 166 +--- .../esp-idf-config/sdkconfig-esp32s3.defaults | 221 +---- .../esp-idf-config/sdkconfig-opt.defaults | 113 +-- .../esp-idf-config/sdkconfig.defaults | 879 +----------------- ports/espressif/esp-iot-solution | 1 + ports/espressif/esp-protocols | 1 + ports/espressif/esp32-camera | 2 +- ports/espressif/esp32c3_fix.h | 42 - ports/espressif/i2s_lcd_driver.h | 135 --- ports/espressif/i2s_lcd_esp32s2_driver.c | 489 ---------- ports/espressif/mpconfigport.mk | 2 + ports/espressif/peripherals/i2c.c | 4 +- ports/espressif/peripherals/pins.h | 2 +- ports/espressif/peripherals/rmt.h | 6 +- ports/espressif/peripherals/timer.h | 1 + ports/espressif/supervisor/port.c | 13 +- ports/espressif/supervisor/usb.c | 4 +- 57 files changed, 261 insertions(+), 2332 deletions(-) create mode 160000 ports/espressif/esp-iot-solution create mode 160000 ports/espressif/esp-protocols delete mode 100644 ports/espressif/esp32c3_fix.h delete mode 100644 ports/espressif/i2s_lcd_esp32s2_driver.c diff --git a/.gitmodules b/.gitmodules index 32105e4744..80fcc99133 100644 --- a/.gitmodules +++ b/.gitmodules @@ -143,7 +143,16 @@ [submodule "ports/espressif/esp-idf"] path = ports/espressif/esp-idf url = https://github.com/adafruit/esp-idf.git - branch = release/v4.4-circuitpython +[submodule "ports/espressif/esp-protocols"] + path = ports/espressif/esp-protocols + url = https://github.com/espressif/esp-protocols.git +[submodule "ports/espressif/esp-iot-solution"] + path = ports/espressif/esp-iot-solution + url = https://github.com/espressif/esp-iot-solution.git +[submodule "ports/espressif/esp-camera"] + path = ports/espressif/esp-camera + url = https://github.com/espressif/esp32-camera.git + branch = circuitpython [submodule "frozen/Adafruit_CircuitPython_ST7789"] path = frozen/Adafruit_CircuitPython_ST7789 url = https://github.com/adafruit/Adafruit_CircuitPython_ST7789 @@ -297,10 +306,6 @@ [submodule "frozen/circuitpython_picoed"] path = frozen/circuitpython_picoed url = https://github.com/elecfreaks/circuitpython_picoed.git -[submodule "ports/espressif/esp32-camera"] - path = ports/espressif/esp32-camera - url = https://github.com/adafruit/esp32-camera/ - branch = circuitpython [submodule "ports/raspberrypi/lib/cyw43-driver"] path = ports/raspberrypi/lib/cyw43-driver url = https://github.com/georgerobotics/cyw43-driver.git diff --git a/ports/espressif/CMakeLists.txt b/ports/espressif/CMakeLists.txt index c6d180b57d..f129b8b4bf 100644 --- a/ports/espressif/CMakeLists.txt +++ b/ports/espressif/CMakeLists.txt @@ -1,12 +1,12 @@ # The following five lines of boilerplate have to be in your project's # CMakeLists in this exact order for cmake to work correctly -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.16) set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf) -# The component list here determines what options we get in menuconfig and what the ninja file -# can build. -set(COMPONENTS esptool_py soc driver log main esp-tls mbedtls mdns esp_event esp_adc_cal esp_netif esp_wifi lwip ulp wpa_supplicant freertos bt usb esp32-camera esp_lcd) +# The component list here determines what options we get in menuconfig and what the ninja file can build. +set(COMPONENTS bt driver esp-tls esp_adc_cal esp_event esp_netif esp_psram esp_wifi esptool_py freertos log lwip main mbedtls mdns soc ulp usb wpa_supplicant esp_lcd) +set(EXTRA_COMPONENT_DIRS esp-protocols/components/mdns) list(APPEND EXTRA_COMPONENT_DIRS "esp32-camera") diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index c103a79217..6397a95e44 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -51,6 +51,7 @@ INC += \ -isystem esp-idf \ -isystem esp-idf/components/app_update/include \ -isystem esp-idf/components/bootloader_support/include \ + -isystem esp-idf/components/bootloader_support/bootloader_flash/include \ -isystem esp-idf/components/bt/include/$(IDF_TARGET)/include \ -isystem esp-idf/components/bt/host/nimble/esp-hci/include \ -isystem esp-idf/components/bt/host/nimble/nimble/nimble/controller/include \ @@ -62,28 +63,31 @@ INC += \ -isystem esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/include \ -isystem esp-idf/components/bt/host/nimble/port/include \ -isystem esp-idf/components/driver/include \ + -isystem esp-idf/components/driver/deprecated \ -isystem esp-idf/components/driver/$(IDF_TARGET)/include \ -isystem esp-idf/components/efuse/include \ -isystem esp-idf/components/efuse/$(IDF_TARGET)/include \ -isystem esp-idf/components/$(IDF_TARGET)/include \ - -isystem esp-idf/components/esp_adc_cal/include \ + -isystem esp-idf/components/esp_adc/deprecated/include \ + -isystem esp-idf/components/esp_app_format/include \ -isystem esp-idf/components/esp_common/include \ -isystem esp-idf/components/esp_event/include \ -isystem esp-idf/components/esp_hw_support/include \ -isystem esp-idf/components/esp_hw_support/include/soc \ - -isystem esp-idf/components/esp_ipc/include \ -isystem esp-idf/components/esp_netif/include \ + -isystem esp-idf/components/esp_partition/include \ -isystem esp-idf/components/esp_pm/include \ + -isystem esp-idf/components/esp_psram/include \ -isystem esp-idf/components/esp_ringbuf/include \ -isystem esp-idf/components/esp_rom/include \ -isystem esp-idf/components/esp_system/include \ -isystem esp-idf/components/esp_timer/include \ -isystem esp-idf/components/esp_wifi/include \ - -isystem esp-idf/components/freertos/include \ - -isystem esp-idf/components/freertos/include/freertos \ - -isystem esp-idf/components/freertos/include/esp_additions \ - -isystem esp-idf/components/freertos/include/esp_additions/freertos \ - -isystem esp-idf/components/freertos/port/$(IDF_TARGET_ARCH)/include \ + -isystem esp-idf/components/freertos/esp_additions/include \ + -isystem esp-idf/components/freertos/esp_additions/include/freertos \ + -isystem esp-idf/components/freertos/FreeRTOS-Kernel/include \ + -isystem esp-idf/components/freertos/FreeRTOS-Kernel/include/freertos \ + -isystem esp-idf/components/freertos/FreeRTOS-Kernel/portable/$(IDF_TARGET_ARCH)/include \ -isystem esp-idf/components/hal/include \ -isystem esp-idf/components/hal/$(IDF_TARGET)/include \ -isystem esp-idf/components/hal/platform_port/include \ @@ -100,13 +104,13 @@ INC += \ -isystem esp-idf/components/soc/include \ -isystem esp-idf/components/soc/$(IDF_TARGET)/include \ -isystem esp-idf/components/spi_flash/include \ + -isystem esp-idf/components/ulp/include \ + -isystem esp-idf/components/ulp/ulp_riscv/include \ + -isystem esp-idf/components/ulp/ulp_common/include \ + -isystem esp-idf/components/ulp/ulp_common/include/$(IDF_TARGET) \ -isystem esp-idf/components/$(IDF_TARGET_ARCH)/include \ - -isystem esp-idf/components/$(IDF_TARGET_ARCH)/$(IDF_TARGET)/include - -# See https://github.com/espressif/esp-idf/issues/6906 -ifeq ($(IDF_TARGET),esp32c3) -CFLAGS += -include "esp32c3_fix.h" -endif + -isystem esp-idf/components/$(IDF_TARGET_ARCH)/$(IDF_TARGET)/include \ + -isystem esp-protocols/components/mdns/include CFLAGS += \ -DHAVE_CONFIG_H \ @@ -232,22 +236,15 @@ SRC_C += \ peripherals/timer.c \ peripherals/$(IDF_TARGET)/pins.c -ifneq ($(IDF_TARGET),esp32c3) +SRC_C += $(wildcard common-hal/espidf/*.c) + +ifeq ($(IDF_TARGET),esp32c3) +SRC_C += supervisor/usb_serial_jtag.c +else SRC_C += \ peripherals/pcnt.c \ peripherals/touch.c -ifeq ($(IDF_TARGET),esp32s2) -SRC_C += \ - i2s_lcd_esp32s2_driver.c endif -endif - -ifeq ($(IDF_TARGET),esp32c3) -SRC_C += \ - supervisor/usb_serial_jtag.c -endif - -$(BUILD)/i2s_lcd_esp32s2_driver.o: CFLAGS += -Wno-sign-compare ifneq ($(CIRCUITPY_USB),0) SRC_C += lib/tinyusb/src/portable/espressif/esp32sx/dcd_esp32sx.c @@ -257,6 +254,17 @@ ifneq ($(CIRCUITPY_BLEIO),0) SRC_C += common-hal/_bleio/ble_events.c endif +ifneq ($(CIRCUITPY_PARALLELDISPLAY),0) +ifeq ($(IDF_TARGET),esp32s3) +LCD_SRC = 8080_lcd_$(IDF_TARGET) +else +LCD_SRC = i2s_lcd_$(IDF_TARGET)_driver +endif +SRC_C += esp-iot-solution/components/bus/$(LCD_SRC).c +$(BUILD)/esp-iot-solution/components/bus/$(LCD_SRC).o: CFLAGS += -Wno-sign-compare +CFLAGS += -isystem esp-iot-solution/components/bus/include +endif + ifneq ($(CIRCUITPY_DOTCLOCKFRAMEBUFFER),0) CFLAGS += -isystem esp-idf/components/esp_lcd/include CFLAGS += -isystem esp-idf/components/esp_lcd/interface @@ -290,8 +298,6 @@ SRC_ULP := \ $(wildcard common-hal/espulp/*.c) \ $(wildcard bindings/espulp/*.c) SRC_C += $(SRC_ULP) -CFLAGS += -isystem esp-idf/components/ulp/include -CFLAGS += -isystem esp-idf/components/ulp/ulp_riscv/include endif SRC_COMMON_HAL_EXPANDED = \ @@ -389,7 +395,7 @@ ifeq ($(IDF_TARGET),esp32) BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/librtc.a endif -ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc_cal esp_common esp_event esp_hw_support esp_ipc esp_netif esp_pm esp_phy esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant +ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc esp_app_format esp_common esp_event esp_hw_support esp_netif esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant ifneq ($(CIRCUITPY_BLEIO),0) ESP_IDF_COMPONENTS_LINK += bt BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libbtbb.a \ @@ -440,8 +446,6 @@ IDF_CMAKE_TARGETS = \ PARTITION_TABLE_OFFSET = 0x8000 FIRMWARE_OFFSET = 0x10000 -ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/$(IDF_TARGET)/$(IDF_TARGET)_out.ld $(BUILD)/esp-idf/esp-idf/$(IDF_TARGET)/ld/$(IDF_TARGET).project.ld - FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE) ESPTOOL_FLAGS ?= --before=default_reset --after=no_reset --baud 921600 @@ -460,7 +464,7 @@ esp-idf-stamp: $(BUILD)/esp-idf/config/sdkconfig.h $(BUILD)/firmware.elf: $(OBJ) | esp-idf-stamp $(IDF_CMAKE_TARGETS) $(STEPECHO) "LINK $@" - $(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) $(BUILD)/esp-idf/esp-idf/newlib/libnewlib.a -Wl,--end-group -u newlib_include_pthread_impl -u ld_include_highint_hdl -Wl,--start-group $(LIBS) -Wl,--end-group $(BUILD)/esp-idf/esp-idf/pthread/libpthread.a -u __cxx_fatal_exception + $(Q)$(CC) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(ESP_IDF_COMPONENTS_EXPANDED) $(BINARY_BLOBS) $(MBEDTLS_COMPONENTS_LINK_EXPANDED) $(LIBS) -Wl,--end-group -u newlib_include_pthread_impl -u ld_include_highint_hdl -u __cxx_fatal_exception $(BUILD)/circuitpython-firmware.bin: $(BUILD)/firmware.elf | tools/build_memory_info.py $(STEPECHO) "Create $@" diff --git a/ports/espressif/README.rst b/ports/espressif/README.rst index 49f372359b..b8b0a097aa 100644 --- a/ports/espressif/README.rst +++ b/ports/espressif/README.rst @@ -9,7 +9,7 @@ Support Status: .. csv-table:: :header: SoC, Status - ESP, "beta" + ESP32, "beta" ESP32-C3, "beta" ESP32-S2, "stable" ESP32-S3, "beta" diff --git a/ports/espressif/common-hal/_bleio/Adapter.c b/ports/espressif/common-hal/_bleio/Adapter.c index 24452993cb..b03bf7c439 100644 --- a/ports/espressif/common-hal/_bleio/Adapter.c +++ b/ports/espressif/common-hal/_bleio/Adapter.c @@ -95,7 +95,6 @@ void common_hal_bleio_adapter_set_enabled(bleio_adapter_obj_t *self, bool enable } if (enabled) { - esp_nimble_hci_and_controller_init(); nimble_port_init(); // ble_hs_cfg.reset_cb = blecent_on_reset; ble_hs_cfg.sync_cb = _on_sync; diff --git a/ports/espressif/common-hal/alarm/pin/PinAlarm.c b/ports/espressif/common-hal/alarm/pin/PinAlarm.c index 6db184a4dd..7d35b66d0c 100644 --- a/ports/espressif/common-hal/alarm/pin/PinAlarm.c +++ b/ports/espressif/common-hal/alarm/pin/PinAlarm.c @@ -36,8 +36,8 @@ #include "hal/gpio_ll.h" #include "esp_debug_helpers.h" -#include "components/driver/include/driver/rtc_io.h" -#include "components/freertos/include/freertos/FreeRTOS.h" +#include "driver/rtc_io.h" +#include "freertos/FreeRTOS.h" void common_hal_alarm_pin_pinalarm_construct(alarm_pin_pinalarm_obj_t *self, const mcu_pin_obj_t *pin, bool value, bool edge, bool pull) { if (edge) { diff --git a/ports/espressif/common-hal/analogio/AnalogIn.c b/ports/espressif/common-hal/analogio/AnalogIn.c index fb2e098cb4..6af0ace1d2 100644 --- a/ports/espressif/common-hal/analogio/AnalogIn.c +++ b/ports/espressif/common-hal/analogio/AnalogIn.c @@ -30,8 +30,9 @@ #include "py/runtime.h" #include "supervisor/shared/translate/translate.h" -#include "components/driver/include/driver/adc_common.h" -#include "components/esp_adc_cal/include/esp_adc_cal.h" +#include "driver/adc.h" +#include "driver/gpio.h" +#include "esp_adc_cal.h" #include "shared-bindings/microcontroller/Pin.h" @@ -54,7 +55,7 @@ void common_hal_analogio_analogin_construct(analogio_analogin_obj_t *self, const mcu_pin_obj_t *pin) { - if (pin->adc_index == 0 || pin->adc_channel == ADC_CHANNEL_MAX) { + if (pin->adc_index == 0 || pin->adc_channel == NO_ADC_CHANNEL) { raise_ValueError_invalid_pin(); } common_hal_mcu_pin_claim(pin); diff --git a/ports/espressif/common-hal/audiobusio/__init__.c b/ports/espressif/common-hal/audiobusio/__init__.c index e58aeefe88..ff86fded7f 100644 --- a/ports/espressif/common-hal/audiobusio/__init__.c +++ b/ports/espressif/common-hal/audiobusio/__init__.c @@ -37,9 +37,9 @@ #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 i2s_t *i2s_instance[I2S_NUM_AUTO]; +static QueueHandle_t i2s_queues[I2S_NUM_AUTO]; +static TaskHandle_t i2s_tasks[I2S_NUM_AUTO]; void port_i2s_allocate_i2s0(void) { if (!i2s_instance[0]) { @@ -64,7 +64,7 @@ static int8_t port_i2s_allocate(void) { } void port_i2s_reset_instance(int i) { - assert(i >= 0 && i < I2S_NUM_MAX); + assert(i >= 0 && i < I2S_NUM_AUTO); if (i2s_tasks[i]) { vTaskDelete(i2s_tasks[i]); } @@ -75,7 +75,7 @@ void port_i2s_reset_instance(int i) { } void i2s_reset(void) { - for (int i = 0; i < I2S_NUM_MAX; i++) { + for (int i = 0; i < I2S_NUM_AUTO; i++) { port_i2s_reset_instance(i); } } @@ -83,7 +83,7 @@ void i2s_reset(void) { #define I2S_WRITE_DELAY pdMS_TO_TICKS(1) static void i2s_fill_buffer(i2s_t *self) { - if (self->instance < 0 || self->instance >= I2S_NUM_MAX) { + if (self->instance < 0 || self->instance >= I2S_NUM_AUTO) { return; } #define STACK_BUFFER_SIZE (4096) diff --git a/ports/espressif/common-hal/busio/SPI.c b/ports/espressif/common-hal/busio/SPI.c index 0b6b395c51..96a2226553 100644 --- a/ports/espressif/common-hal/busio/SPI.c +++ b/ports/espressif/common-hal/busio/SPI.c @@ -30,7 +30,7 @@ #include "shared-bindings/busio/SPI.h" #include "shared-bindings/microcontroller/Pin.h" -#include "driver/spi_common_internal.h" +#include "esp_private/spi_common_internal.h" #define SPI_MAX_DMA_BITS (SPI_MAX_DMA_LEN * 8) #define MAX_SPI_TRANSACTIONS 10 diff --git a/ports/espressif/common-hal/countio/Counter.c b/ports/espressif/common-hal/countio/Counter.c index cc4c067266..1cf6d8e707 100644 --- a/ports/espressif/common-hal/countio/Counter.c +++ b/ports/espressif/common-hal/countio/Counter.c @@ -31,6 +31,8 @@ #include "py/runtime.h" #include "supervisor/shared/translate/translate.h" +#include "driver/gpio.h" + void common_hal_countio_counter_construct(countio_counter_obj_t *self, const mcu_pin_obj_t *pin, countio_edge_t edge, digitalio_pull_t pull) { claim_pin(pin); diff --git a/ports/espressif/common-hal/dualbank/__init__.c b/ports/espressif/common-hal/dualbank/__init__.c index 9e3fb38627..b3151f268d 100644 --- a/ports/espressif/common-hal/dualbank/__init__.c +++ b/ports/espressif/common-hal/dualbank/__init__.c @@ -31,6 +31,7 @@ #include "esp_log.h" #include "esp_ota_ops.h" +#include "esp_app_format.h" static const esp_partition_t *update_partition = NULL; static esp_ota_handle_t update_handle = 0; @@ -59,10 +60,10 @@ void common_hal_dualbank_flash(const void *buf, const size_t len, const size_t o update_partition = esp_ota_get_next_update_partition(NULL); assert(update_partition != NULL); - ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)", + ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08lu)", running->type, running->subtype, running->address); - ESP_LOGI(TAG, "Writing partition type %d subtype %d (offset 0x%08x)\n", + ESP_LOGI(TAG, "Writing partition type %d subtype %d (offset 0x%08lu)\n", update_partition->type, update_partition->subtype, update_partition->address); } diff --git a/ports/espressif/common-hal/espidf/__init__.c b/ports/espressif/common-hal/espidf/__init__.c index 7acf912077..bbf60f9dc3 100644 --- a/ports/espressif/common-hal/espidf/__init__.c +++ b/ports/espressif/common-hal/espidf/__init__.c @@ -35,7 +35,7 @@ #define TAG "espidf" #ifdef CONFIG_SPIRAM -#include "esp32/spiram.h" +#include "esp_psram.h" #include "esp_heap_caps.h" #include "esp_heap_caps_init.h" #include "soc/soc.h" @@ -51,7 +51,7 @@ size_t reserved_psram = DEFAULT_RESERVED_PSRAM; static size_t psram_size_usable(void) { #ifdef CONFIG_SPIRAM /* PSRAM chip may be larger than the size we can map into address space */ - size_t s = MIN(esp_spiram_get_size(), SOC_EXTRAM_DATA_SIZE); + size_t s = MIN(esp_psram_get_size(), SOC_EXTRAM_DATA_SIZE); return s - esp_himem_reserved_area_size(); #else return 0; @@ -60,7 +60,7 @@ static size_t psram_size_usable(void) { bool common_hal_espidf_set_reserved_psram(size_t amount) { #ifdef CONFIG_SPIRAM - if (!esp_spiram_is_initialized()) { + if (!esp_psram_is_initialized()) { return false; } if (!ok_to_reserve_psram) { @@ -112,7 +112,7 @@ size_t common_hal_espidf_get_total_psram(void) { intptr_t common_hal_espidf_get_psram_start(void) { #ifdef CONFIG_SPIRAM - if (esp_spiram_is_initialized()) { + if (esp_psram_is_initialized()) { #ifdef CONFIG_IDF_TARGET_ESP32 return SOC_EXTRAM_DATA_LOW; #else @@ -125,7 +125,7 @@ intptr_t common_hal_espidf_get_psram_start(void) { intptr_t common_hal_espidf_get_psram_end(void) { #ifdef CONFIG_SPIRAM - if (esp_spiram_is_initialized()) { + if (esp_psram_is_initialized()) { return common_hal_espidf_get_psram_start() + psram_size_usable(); } #endif diff --git a/ports/espressif/common-hal/espulp/ULP.c b/ports/espressif/common-hal/espulp/ULP.c index 3350f6d45c..e8400d77e7 100644 --- a/ports/espressif/common-hal/espulp/ULP.c +++ b/ports/espressif/common-hal/espulp/ULP.c @@ -28,7 +28,6 @@ #include "bindings/espulp/ULP.h" #include "py/runtime.h" - #include "shared-bindings/microcontroller/Pin.h" #if defined(CONFIG_IDF_TARGET_ESP32) @@ -56,7 +55,7 @@ void espulp_reset(void) { } void common_hal_espulp_ulp_run(espulp_ulp_obj_t *self, uint32_t *program, size_t length, uint32_t pin_mask) { - if (length > ULP_COPROC_RESERVE_MEM) { + if (length > CONFIG_ULP_COPROC_RESERVE_MEM) { mp_raise_ValueError(translate("Program too long")); } @@ -111,18 +110,8 @@ void common_hal_espulp_ulp_halt(espulp_ulp_obj_t *self) { #ifdef CONFIG_IDF_TARGET_ESP32 mp_raise_NotImplementedError(NULL); #else - // To-do idf v5.0: use following functions - // ulp_riscv_timer_stop(); - // ulp_riscv_halt(); - - // stop the ulp timer so that it doesn't restart the cpu - CLEAR_PERI_REG_MASK(RTC_CNTL_ULP_CP_TIMER_REG, RTC_CNTL_ULP_CP_SLP_TIMER_EN); - - // suspends the ulp operation - SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_DONE); - - // resets the processor - SET_PERI_REG_MASK(RTC_CNTL_COCPU_CTRL_REG, RTC_CNTL_COCPU_SHUT_RESET_EN); + ulp_riscv_timer_stop(); + ulp_riscv_halt(); #endif // Release pins we were using. diff --git a/ports/espressif/common-hal/espulp/ULPAlarm.c b/ports/espressif/common-hal/espulp/ULPAlarm.c index 3717d2ab71..f6c3de66b7 100644 --- a/ports/espressif/common-hal/espulp/ULPAlarm.c +++ b/ports/espressif/common-hal/espulp/ULPAlarm.c @@ -29,7 +29,7 @@ #include "common-hal/alarm/__init__.h" #include "supervisor/port.h" -#include "driver/rtc_cntl.h" +#include "esp_private/rtc_ctrl.h" #include "soc/rtc_cntl_reg.h" #include "esp_sleep.h" @@ -117,7 +117,9 @@ void espulp_ulpalarm_prepare_for_deep_sleep(void) { // enable ulp wakeup esp_sleep_enable_ulp_wakeup(); + #if defined(SOC_PM_SUPPORT_RTC_SLOW_MEM_PD) && SOC_PM_SUPPORT_RTC_SLOW_MEM_PD esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON); + #endif } bool espulp_ulpalarm_woke_this_cycle(void) { diff --git a/ports/espressif/common-hal/frequencyio/FrequencyIn.c b/ports/espressif/common-hal/frequencyio/FrequencyIn.c index d35614ea19..1a82b90f45 100644 --- a/ports/espressif/common-hal/frequencyio/FrequencyIn.c +++ b/ports/espressif/common-hal/frequencyio/FrequencyIn.c @@ -28,6 +28,10 @@ #include "py/runtime.h" +#include "driver/gpio.h" +#include "driver/timer.h" +#include "soc/timer_group_struct.h" + static void IRAM_ATTR pcnt_overflow_handler(void *self_in) { frequencyio_frequencyin_obj_t *self = self_in; // reset counter @@ -56,28 +60,16 @@ static void IRAM_ATTR timer_interrupt_handler(void *self_in) { // reset interrupt timg_dev_t *device = self->timer.group ? &(TIMERG1) : &(TIMERG0); - #if defined(CONFIG_IDF_TARGET_ESP32) - if (self->timer.idx) { - device->int_clr_timers.t1 = 1; - } else { - device->int_clr_timers.t0 = 1; - } - #else if (self->timer.idx) { device->int_clr_timers.t1_int_clr = 1; } else { device->int_clr_timers.t0_int_clr = 1; } - #endif - #if defined(CONFIG_IDF_TARGET_ESP32) - device->hw_timer[self->timer.idx].config.alarm_en = 1; - #elif defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C2) - device->hw_timer[self->timer.idx].config.tx_alarm_en = 1; - #elif defined(CONFIG_IDF_TARGET_ESP32S3) + #if defined(CONFIG_IDF_TARGET_ESP32S3) device->hw_timer[self->timer.idx].config.tn_alarm_en = 1; #else - #error No known CONFIG_IDF_TARGET_xxx found + device->hw_timer[self->timer.idx].config.tx_alarm_en = 1; #endif } diff --git a/ports/espressif/common-hal/hashlib/Hash.c b/ports/espressif/common-hal/hashlib/Hash.c index 8090128acb..5aed82817a 100644 --- a/ports/espressif/common-hal/hashlib/Hash.c +++ b/ports/espressif/common-hal/hashlib/Hash.c @@ -30,7 +30,7 @@ void common_hal_hashlib_hash_update(hashlib_hash_obj_t *self, const uint8_t *data, size_t datalen) { if (self->hash_type == MBEDTLS_SSL_HASH_SHA1) { - mbedtls_sha1_update_ret(&self->sha1, data, datalen); + mbedtls_sha1_update(&self->sha1, data, datalen); return; } } @@ -44,7 +44,7 @@ void common_hal_hashlib_hash_digest(hashlib_hash_obj_t *self, uint8_t *data, siz // the digest a second time. mbedtls_sha1_context copy; mbedtls_sha1_clone(©, &self->sha1); - mbedtls_sha1_finish_ret(&self->sha1, data); + mbedtls_sha1_finish(&self->sha1, data); mbedtls_sha1_clone(&self->sha1, ©); } } diff --git a/ports/espressif/common-hal/hashlib/__init__.c b/ports/espressif/common-hal/hashlib/__init__.c index 1e6b2a4802..7dd147be5f 100644 --- a/ports/espressif/common-hal/hashlib/__init__.c +++ b/ports/espressif/common-hal/hashlib/__init__.c @@ -33,7 +33,7 @@ bool common_hal_hashlib_new(hashlib_hash_obj_t *self, const char *algorithm) { if (strcmp(algorithm, "sha1") == 0) { self->hash_type = MBEDTLS_SSL_HASH_SHA1; mbedtls_sha1_init(&self->sha1); - mbedtls_sha1_starts_ret(&self->sha1); + mbedtls_sha1_starts(&self->sha1); return true; } return false; diff --git a/ports/espressif/common-hal/mdns/RemoteService.h b/ports/espressif/common-hal/mdns/RemoteService.h index ca59f5ece6..b577938024 100644 --- a/ports/espressif/common-hal/mdns/RemoteService.h +++ b/ports/espressif/common-hal/mdns/RemoteService.h @@ -26,7 +26,7 @@ #pragma once -#include "components/mdns/include/mdns.h" +#include "mdns.h" typedef struct { mp_obj_base_t base; diff --git a/ports/espressif/common-hal/mdns/Server.c b/ports/espressif/common-hal/mdns/Server.c index 9205f76087..0246a39587 100644 --- a/ports/espressif/common-hal/mdns/Server.c +++ b/ports/espressif/common-hal/mdns/Server.c @@ -31,7 +31,7 @@ #include "shared-bindings/mdns/RemoteService.h" #include "shared-bindings/wifi/__init__.h" -#include "components/mdns/include/mdns.h" +#include "mdns.h" // Track whether the underlying IDF mdns has been started so that we only // create a single inited MDNS object to CircuitPython. (After deinit, another @@ -125,22 +125,13 @@ size_t mdns_server_find(mdns_server_obj_t *self, const char *service_type, const if (search == NULL) { return 0; } + uint8_t num_results; mdns_result_t *results; - while (!mdns_query_async_get_results(search, 1, &results)) { + while (!mdns_query_async_get_results(search, 1, &results, &num_results)) { RUN_BACKGROUND_TASKS; } mdns_query_async_delete(search); - // Count how many results we got. - // TODO: Remove this loop when moving off 4.4. Newer APIs will give us num_results - // back directly. mdns_result_t *next = results; - uint8_t num_results = 0; - while (next != NULL) { - num_results++; - next = next->next; - } - - next = results; // Don't error if we're out of memory. Instead, truncate the tuple. uint8_t added = 0; while (next != NULL && added < out_len) { @@ -166,27 +157,19 @@ mp_obj_t common_hal_mdns_server_find(mdns_server_obj_t *self, const char *servic if (search == NULL) { mp_raise_RuntimeError(translate("Unable to start mDNS query")); } + uint8_t num_results; mdns_result_t *results; - while (!mdns_query_async_get_results(search, 1, &results)) { + while (!mdns_query_async_get_results(search, 1, &results, &num_results)) { RUN_BACKGROUND_TASKS; } mdns_query_async_delete(search); - // Count how many results we got. - // TODO: Remove this loop when moving off 4.4. Newer APIs will give us num_results - // back directly. - mdns_result_t *next = results; - uint8_t num_results = 0; - while (next != NULL) { - num_results++; - next = next->next; - } mp_obj_tuple_t *tuple = MP_OBJ_TO_PTR(mp_obj_new_tuple(num_results, NULL)); // The empty tuple object is shared and stored in flash so return early if // we got it. Without this we'll crash when trying to set len below. if (num_results == 0) { return MP_OBJ_FROM_PTR(tuple); } - next = results; + mdns_result_t *next = results; // Don't error if we're out of memory. Instead, truncate the tuple. uint8_t added = 0; while (next != NULL) { diff --git a/ports/espressif/common-hal/memorymap/AddressRange.c b/ports/espressif/common-hal/memorymap/AddressRange.c index b05283b700..9e87e5384b 100644 --- a/ports/espressif/common-hal/memorymap/AddressRange.c +++ b/ports/espressif/common-hal/memorymap/AddressRange.c @@ -29,7 +29,6 @@ #include "shared-bindings/memorymap/AddressRange.h" #include "py/runtime.h" - #include "soc/soc.h" size_t allow_ranges[][2] = { @@ -39,7 +38,6 @@ size_t allow_ranges[][2] = { {SOC_RTC_DRAM_LOW, SOC_RTC_DRAM_HIGH}, // RTC peripheral registers {0x60008000, 0x60009000} - }; void common_hal_memorymap_addressrange_construct(memorymap_addressrange_obj_t *self, uint8_t *start_address, size_t length) { diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index 75d67d6662..eeda6862db 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -38,7 +38,63 @@ STATIC uint64_t _skip_reset_once_pin_mask; STATIC uint64_t _preserved_pin_mask; STATIC uint64_t _in_use_pin_mask; -// Bit mask of all pins that should never EVER be reset or used by user code. +#define GPIO_SEL_0 (BIT(0)) /*!< Pin 0 selected */ +#define GPIO_SEL_1 (BIT(1)) /*!< Pin 1 selected */ +#define GPIO_SEL_2 (BIT(2)) /*!< Pin 2 selected */ +#define GPIO_SEL_3 (BIT(3)) /*!< Pin 3 selected */ +#define GPIO_SEL_4 (BIT(4)) /*!< Pin 4 selected */ +#define GPIO_SEL_5 (BIT(5)) /*!< Pin 5 selected */ +#define GPIO_SEL_6 (BIT(6)) /*!< Pin 6 selected */ +#define GPIO_SEL_7 (BIT(7)) /*!< Pin 7 selected */ +#define GPIO_SEL_8 (BIT(8)) /*!< Pin 8 selected */ +#define GPIO_SEL_9 (BIT(9)) /*!< Pin 9 selected */ +#define GPIO_SEL_10 (BIT(10)) /*!< Pin 10 selected */ +#define GPIO_SEL_11 (BIT(11)) /*!< Pin 11 selected */ +#define GPIO_SEL_12 (BIT(12)) /*!< Pin 12 selected */ +#define GPIO_SEL_13 (BIT(13)) /*!< Pin 13 selected */ +#define GPIO_SEL_14 (BIT(14)) /*!< Pin 14 selected */ +#define GPIO_SEL_15 (BIT(15)) /*!< Pin 15 selected */ +#define GPIO_SEL_16 (BIT(16)) /*!< Pin 16 selected */ +#define GPIO_SEL_17 (BIT(17)) /*!< Pin 17 selected */ +#define GPIO_SEL_18 (BIT(18)) /*!< Pin 18 selected */ +#define GPIO_SEL_19 (BIT(19)) /*!< Pin 19 selected */ +#define GPIO_SEL_20 (BIT(20)) /*!< Pin 20 selected */ +#define GPIO_SEL_21 (BIT(21)) /*!< Pin 21 selected */ +#if defined(CONFIG_IDF_TARGET_ESP32) +#define GPIO_SEL_22 (BIT(22)) /*!< Pin 22 selected */ +#define GPIO_SEL_23 (BIT(23)) /*!< Pin 23 selected */ + +#define GPIO_SEL_25 (BIT(25)) /*!< Pin 25 selected */ +#endif +#define GPIO_SEL_26 (BIT(26)) /*!< Pin 26 selected */ +#define GPIO_SEL_27 (BIT(27)) /*!< Pin 27 selected */ +#define GPIO_SEL_28 (BIT(28)) /*!< Pin 28 selected */ +#define GPIO_SEL_29 (BIT(29)) /*!< Pin 29 selected */ +#define GPIO_SEL_30 (BIT(30)) /*!< Pin 30 selected */ +#define GPIO_SEL_31 (BIT(31)) /*!< Pin 31 selected */ +#define GPIO_SEL_32 ((uint64_t)PIN_BIT(32)) /*!< Pin 32 selected */ +#define GPIO_SEL_33 ((uint64_t)PIN_BIT(33)) /*!< Pin 33 selected */ +#define GPIO_SEL_34 ((uint64_t)PIN_BIT(34)) /*!< Pin 34 selected */ +#define GPIO_SEL_35 ((uint64_t)PIN_BIT(35)) /*!< Pin 35 selected */ +#define GPIO_SEL_36 ((uint64_t)PIN_BIT(36)) /*!< Pin 36 selected */ +#define GPIO_SEL_37 ((uint64_t)PIN_BIT(37)) /*!< Pin 37 selected */ +#define GPIO_SEL_38 ((uint64_t)PIN_BIT(38)) /*!< Pin 38 selected */ +#define GPIO_SEL_39 ((uint64_t)PIN_BIT(39)) /*!< Pin 39 selected */ +#if SOC_GPIO_PIN_COUNT > 40 +#define GPIO_SEL_40 ((uint64_t)PIN_BIT(40)) /*!< Pin 40 selected */ +#define GPIO_SEL_41 ((uint64_t)PIN_BIT(41)) /*!< Pin 41 selected */ +#define GPIO_SEL_42 ((uint64_t)PIN_BIT(42)) /*!< Pin 42 selected */ +#define GPIO_SEL_43 ((uint64_t)PIN_BIT(43)) /*!< Pin 43 selected */ +#define GPIO_SEL_44 ((uint64_t)PIN_BIT(44)) /*!< Pin 44 selected */ +#define GPIO_SEL_45 ((uint64_t)PIN_BIT(45)) /*!< Pin 45 selected */ +#define GPIO_SEL_46 ((uint64_t)PIN_BIT(46)) /*!< Pin 46 selected */ +#if defined(CONFIG_IDF_TARGET_ESP32S3) +#define GPIO_SEL_47 ((uint64_t)PIN_BIT(47)) /*!< Pin 47 selected */ +#define GPIO_SEL_48 ((uint64_t)PIN_BIT(48)) /*!< Pin 48 selected */ +#endif +#endif + +// Bit mask of all pins that should never EVER be reset. // Typically these are SPI flash and PSRAM control pins, and communication pins. // "Reset forbidden" is stronger than "never reset" below, which may only be temporary. static const uint64_t pin_mask_reset_forbidden = diff --git a/ports/espressif/common-hal/microcontroller/Processor.c b/ports/espressif/common-hal/microcontroller/Processor.c index 5b7463c9ff..8e8196ea0e 100644 --- a/ports/espressif/common-hal/microcontroller/Processor.c +++ b/ports/espressif/common-hal/microcontroller/Processor.c @@ -41,21 +41,23 @@ #include "soc/efuse_reg.h" #if !defined(CONFIG_IDF_TARGET_ESP32) -#include "driver/temp_sensor.h" +#include "driver/temperature_sensor.h" #endif float common_hal_mcu_processor_get_temperature(void) { - float tsens_out; + float tsens_value; #if defined(CONFIG_IDF_TARGET_ESP32) return NAN; #else - temp_sensor_config_t temp_sensor = TSENS_CONFIG_DEFAULT(); // DEFAULT: range:-10℃ ~ 80℃, error < 1℃. - temp_sensor_set_config(temp_sensor); - temp_sensor_start(); - temp_sensor_read_celsius(&tsens_out); - temp_sensor_stop(); + temperature_sensor_handle_t temp_sensor = NULL; + temperature_sensor_config_t temp_sensor_config = TEMPERATURE_SENSOR_CONFIG_DEFAULT(-10, 80); // DEFAULT: range:-10℃ ~ 80℃, error < 1℃. + temperature_sensor_install(&temp_sensor_config, &temp_sensor); + temperature_sensor_enable(temp_sensor); + temperature_sensor_get_celsius(temp_sensor, &tsens_value); + temperature_sensor_disable(temp_sensor); + temperature_sensor_uninstall(temp_sensor); #endif - return tsens_out; + return tsens_value; } float common_hal_mcu_processor_get_voltage(void) { diff --git a/ports/espressif/common-hal/neopixel_write/__init__.c b/ports/espressif/common-hal/neopixel_write/__init__.c index 148b47aeb0..6d91cc7766 100644 --- a/ports/espressif/common-hal/neopixel_write/__init__.c +++ b/ports/espressif/common-hal/neopixel_write/__init__.c @@ -44,7 +44,6 @@ #include "py/runtime.h" #include "shared-bindings/neopixel_write/__init__.h" #include "supervisor/port.h" -#include "components/driver/include/driver/rmt.h" #include "peripherals/rmt.h" // Use closer to WS2812-style timings instead of WS2812B, to accommodate more varieties. diff --git a/ports/espressif/common-hal/os/__init__.c b/ports/espressif/common-hal/os/__init__.c index 1dcd3e46e0..bc18c838ae 100644 --- a/ports/espressif/common-hal/os/__init__.c +++ b/ports/espressif/common-hal/os/__init__.c @@ -33,6 +33,7 @@ #include "shared-bindings/os/__init__.h" #include "esp_system.h" +#include "esp_random.h" STATIC const qstr os_uname_info_fields[] = { MP_QSTR_sysname, MP_QSTR_nodename, @@ -60,7 +61,7 @@ mp_obj_t common_hal_os_uname(void) { return (mp_obj_t)&os_uname_info_obj; } -bool common_hal_os_urandom(uint8_t *buffer, uint32_t length) { +bool common_hal_os_urandom(uint8_t *buffer, mp_uint_t length) { uint32_t i = 0; while (i < length) { uint32_t new_random = esp_random(); diff --git a/ports/espressif/common-hal/paralleldisplay/ParallelBus.c b/ports/espressif/common-hal/paralleldisplay/ParallelBus.c index c9ba3edd06..49008948b7 100644 --- a/ports/espressif/common-hal/paralleldisplay/ParallelBus.c +++ b/ports/espressif/common-hal/paralleldisplay/ParallelBus.c @@ -36,8 +36,8 @@ #include "common-hal/microcontroller/Pin.h" #include "py/runtime.h" -#include "i2s_lcd_driver.h" #include "driver/gpio.h" + /* * Current pin limitations for ESP32-S2 ParallelBus: * - data0 pin must be byte aligned @@ -166,11 +166,12 @@ bool common_hal_paralleldisplay_parallelbus_bus_free(mp_obj_t obj) { bool common_hal_paralleldisplay_parallelbus_begin_transaction(mp_obj_t obj) { paralleldisplay_parallelbus_obj_t *self = MP_OBJ_TO_PTR(obj); - bool r = i2s_lcd_acquire_nonblocking(self->handle, 1); - if (r) { + bool lock_acquired = false; + i2s_lcd_acquire_nonblocking(self->handle, 1, &lock_acquired); + if (lock_acquired) { gpio_set_level(self->config.pin_num_cs, false); } - return r; + return lock_acquired; } void common_hal_paralleldisplay_parallelbus_send(mp_obj_t obj, display_byte_type_t byte_type, diff --git a/ports/espressif/common-hal/pulseio/PulseIn.h b/ports/espressif/common-hal/pulseio/PulseIn.h index 55714b04b2..92db65f772 100644 --- a/ports/espressif/common-hal/pulseio/PulseIn.h +++ b/ports/espressif/common-hal/pulseio/PulseIn.h @@ -30,7 +30,6 @@ #include "common-hal/microcontroller/Pin.h" #include "py/obj.h" -#include "components/driver/include/driver/rmt.h" #include "peripherals/rmt.h" typedef struct { diff --git a/ports/espressif/common-hal/pulseio/PulseOut.h b/ports/espressif/common-hal/pulseio/PulseOut.h index 359280a86f..66b01df318 100644 --- a/ports/espressif/common-hal/pulseio/PulseOut.h +++ b/ports/espressif/common-hal/pulseio/PulseOut.h @@ -28,7 +28,6 @@ #define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_PULSEIO_PULSEOUT_H #include "common-hal/microcontroller/Pin.h" -#include "components/driver/include/driver/rmt.h" #include "peripherals/rmt.h" #include "py/obj.h" diff --git a/ports/espressif/common-hal/pwmio/PWMOut.c b/ports/espressif/common-hal/pwmio/PWMOut.c index 519885a032..225560b34a 100644 --- a/ports/espressif/common-hal/pwmio/PWMOut.c +++ b/ports/espressif/common-hal/pwmio/PWMOut.c @@ -28,7 +28,8 @@ #include "common-hal/pwmio/PWMOut.h" #include "shared-bindings/pwmio/PWMOut.h" #include "py/runtime.h" -#include "components/driver/include/driver/ledc.h" +#include "driver/ledc.h" +#include "soc/soc.h" #define INDEX_EMPTY 0xFF @@ -40,7 +41,7 @@ STATIC bool never_reset_chan[LEDC_CHANNEL_MAX]; STATIC uint32_t calculate_duty_cycle(uint32_t frequency) { uint32_t duty_bits = 0; - uint32_t interval = LEDC_APB_CLK_HZ / frequency; + uint32_t interval = APB_CLK_FREQ / frequency; for (size_t i = 0; i < 32; i++) { if (!(interval >> i)) { duty_bits = i - 1; diff --git a/ports/espressif/common-hal/socketpool/Socket.c b/ports/espressif/common-hal/socketpool/Socket.c index 9d3c22aca8..f063873df9 100644 --- a/ports/espressif/common-hal/socketpool/Socket.c +++ b/ports/espressif/common-hal/socketpool/Socket.c @@ -402,7 +402,7 @@ void common_hal_socketpool_socket_connect(socketpool_socket_obj_t *self, #pragma GCC diagnostic ignored "-Wcast-align" dest_addr.sin_addr.s_addr = ((struct sockaddr_in *)result_i->ai_addr)->sin_addr.s_addr; #pragma GCC diagnostic pop - freeaddrinfo(result_i); + lwip_freeaddrinfo(result_i); dest_addr.sin_family = AF_INET; dest_addr.sin_port = htons(port); @@ -582,7 +582,7 @@ mp_uint_t common_hal_socketpool_socket_sendto(socketpool_socket_obj_t *self, #pragma GCC diagnostic ignored "-Wcast-align" dest_addr.sin_addr.s_addr = ((struct sockaddr_in *)result_i->ai_addr)->sin_addr.s_addr; #pragma GCC diagnostic pop - freeaddrinfo(result_i); + lwip_freeaddrinfo(result_i); dest_addr.sin_family = AF_INET; dest_addr.sin_port = htons(port); diff --git a/ports/espressif/common-hal/socketpool/Socket.h b/ports/espressif/common-hal/socketpool/Socket.h index dfd1cbfc11..4c86c9b379 100644 --- a/ports/espressif/common-hal/socketpool/Socket.h +++ b/ports/espressif/common-hal/socketpool/Socket.h @@ -32,6 +32,7 @@ #include "common-hal/ssl/SSLContext.h" #include "components/esp-tls/esp_tls.h" +#include "components/lwip/lwip/src/include/lwip/sockets.h" typedef struct ssl_sslsocket_obj ssl_sslsocket_obj_t; diff --git a/ports/espressif/common-hal/socketpool/SocketPool.c b/ports/espressif/common-hal/socketpool/SocketPool.c index 780e90c42c..9137ac3c8f 100644 --- a/ports/espressif/common-hal/socketpool/SocketPool.c +++ b/ports/espressif/common-hal/socketpool/SocketPool.c @@ -60,7 +60,7 @@ mp_obj_t common_hal_socketpool_socketpool_gethostbyname(socketpool_socketpool_ob .ai_socktype = SOCK_STREAM, }; struct addrinfo *res; - int err = getaddrinfo(host, NULL, &hints, &res); + int err = lwip_getaddrinfo(host, NULL, &hints, &res); if (err != 0 || res == NULL) { return mp_const_none; } @@ -72,7 +72,7 @@ mp_obj_t common_hal_socketpool_socketpool_gethostbyname(socketpool_socketpool_ob char ip_str[IP4ADDR_STRLEN_MAX]; inet_ntoa_r(*addr, ip_str, IP4ADDR_STRLEN_MAX); mp_obj_t ip_obj = mp_obj_new_str(ip_str, strlen(ip_str)); - freeaddrinfo(res); + lwip_freeaddrinfo(res); return ip_obj; } diff --git a/ports/espressif/common-hal/ssl/SSLContext.c b/ports/espressif/common-hal/ssl/SSLContext.c index 1923a9c2a9..c583cecaa7 100644 --- a/ports/espressif/common-hal/ssl/SSLContext.c +++ b/ports/espressif/common-hal/ssl/SSLContext.c @@ -32,6 +32,7 @@ #include "components/mbedtls/esp_crt_bundle/include/esp_crt_bundle.h" #include "py/runtime.h" +#include "lwip/sockets.h" void common_hal_ssl_sslcontext_construct(ssl_sslcontext_obj_t *self) { diff --git a/ports/espressif/common-hal/ssl/SSLSocket.c b/ports/espressif/common-hal/ssl/SSLSocket.c index 2446ce3005..9413fc7def 100644 --- a/ports/espressif/common-hal/ssl/SSLSocket.c +++ b/ports/espressif/common-hal/ssl/SSLSocket.c @@ -34,6 +34,7 @@ #include "py/mperrno.h" #include "py/runtime.h" #include "supervisor/shared/tick.h" +#include "lwip/sockets.h" ssl_sslsocket_obj_t *common_hal_ssl_sslsocket_accept(ssl_sslsocket_obj_t *self, uint8_t *ip, uint32_t *port) { @@ -60,7 +61,7 @@ void common_hal_ssl_sslsocket_connect(ssl_sslsocket_obj_t *self, if (result < 0) { int esp_tls_code; int flags; - esp_err_t err = esp_tls_get_and_clear_last_error(self->tls->error_handle, &esp_tls_code, &flags); + esp_err_t err = esp_tls_get_and_clear_last_error(self->tls_error_handle, &esp_tls_code, &flags); if (err == ESP_ERR_MBEDTLS_SSL_SETUP_FAILED) { mp_raise_espidf_MemoryError(); @@ -154,7 +155,7 @@ mp_uint_t common_hal_ssl_sslsocket_send(ssl_sslsocket_obj_t *self, const uint8_t if (sent < 0) { int esp_tls_code; int flags; - esp_err_t err = esp_tls_get_and_clear_last_error(self->tls->error_handle, &esp_tls_code, &flags); + esp_err_t err = esp_tls_get_and_clear_last_error(self->tls_error_handle, &esp_tls_code, &flags); if (err == ESP_ERR_MBEDTLS_SSL_SETUP_FAILED) { mp_raise_espidf_MemoryError(); diff --git a/ports/espressif/common-hal/ssl/SSLSocket.h b/ports/espressif/common-hal/ssl/SSLSocket.h index 6b65a56223..a7977db746 100644 --- a/ports/espressif/common-hal/ssl/SSLSocket.h +++ b/ports/espressif/common-hal/ssl/SSLSocket.h @@ -38,6 +38,7 @@ typedef struct ssl_sslsocket_obj { mp_obj_base_t base; socketpool_socket_obj_t *sock; esp_tls_t *tls; + esp_tls_error_handle_t tls_error_handle; ssl_sslcontext_obj_t *ssl_context; esp_tls_cfg_t ssl_config; } ssl_sslsocket_obj_t; diff --git a/ports/espressif/common-hal/watchdog/WatchDogTimer.c b/ports/espressif/common-hal/watchdog/WatchDogTimer.c index 159c99458f..78c04ba533 100644 --- a/ports/espressif/common-hal/watchdog/WatchDogTimer.c +++ b/ports/espressif/common-hal/watchdog/WatchDogTimer.c @@ -62,7 +62,12 @@ void watchdog_reset(void) { static void wdt_config(watchdog_watchdogtimer_obj_t *self) { // enable panic hanler in WATCHDOGMODE_RESET mode // initialize Task Watchdog Timer (TWDT) - if (esp_task_wdt_init((uint32_t)self->timeout, (self->mode == WATCHDOGMODE_RESET)) != ESP_OK) { + esp_task_wdt_config_t twdt_config = { + .timeout_ms = (uint32_t)self->timeout, + .idle_core_mask = (1 << portNUM_PROCESSORS) - 1, // Bitmask of all cores + .trigger_panic = (self->mode == WATCHDOGMODE_RESET), + }; + if (esp_task_wdt_init(&twdt_config) != ESP_OK) { mp_raise_RuntimeError(translate("Initialization failed due to lack of memory")); } esp_task_wdt_add(NULL); diff --git a/ports/espressif/common-hal/wifi/Radio.c b/ports/espressif/common-hal/wifi/Radio.c index e6385ee1e5..b96c76adff 100644 --- a/ports/espressif/common-hal/wifi/Radio.c +++ b/ports/espressif/common-hal/wifi/Radio.c @@ -44,7 +44,7 @@ #include "components/lwip/include/apps/ping/ping_sock.h" #if CIRCUITPY_MDNS -#include "components/mdns/include/mdns.h" +#include "mdns.h" #endif #define MAC_ADDRESS_LENGTH 6 diff --git a/ports/espressif/common-hal/wifi/Radio.h b/ports/espressif/common-hal/wifi/Radio.h index 3c0828bf0b..ddab4b2a5b 100644 --- a/ports/espressif/common-hal/wifi/Radio.h +++ b/ports/espressif/common-hal/wifi/Radio.h @@ -34,6 +34,8 @@ #include "shared-bindings/wifi/ScannedNetworks.h" #include "shared-bindings/wifi/Network.h" +#include "esp_netif_types.h" + // Event bits for the Radio event group. #define WIFI_SCAN_DONE_BIT BIT0 #define WIFI_CONNECTED_BIT BIT1 diff --git a/ports/espressif/common-hal/wifi/__init__.c b/ports/espressif/common-hal/wifi/__init__.c index cfcfaf024b..1ffc768002 100644 --- a/ports/espressif/common-hal/wifi/__init__.c +++ b/ports/espressif/common-hal/wifi/__init__.c @@ -121,7 +121,7 @@ static void event_handler(void *arg, esp_event_base_t event_base, // Cases to handle later. // case WIFI_EVENT_STA_AUTHMODE_CHANGE: default: { - ESP_LOGW(TAG, "event %d 0x%02x", event_id, event_id); + ESP_LOGW(TAG, "event %ld 0x%02ld", event_id, event_id); break; } } diff --git a/ports/espressif/esp-idf b/ports/espressif/esp-idf index 69f9a4f566..f2ee41e622 160000 --- a/ports/espressif/esp-idf +++ b/ports/espressif/esp-idf @@ -1 +1 @@ -Subproject commit 69f9a4f566d49afe97fd8b47444bd394af005e23 +Subproject commit f2ee41e622694ead7caa3dcac0d04c96c5a7b027 diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults index 5fdb766add..c913025124 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults @@ -1,171 +1,4 @@ -CONFIG_IDF_TARGET_ARCH_RISCV=y -CONFIG_IDF_TARGET="esp32c3" -CONFIG_IDF_TARGET_ESP32C3=y -CONFIG_IDF_FIRMWARE_CHIP_ID=0x0005 +# This file was generated using idf.py save-defconfig. It can be edited manually. +# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration # -# SDK tool configuration -# -CONFIG_SDK_TOOLPREFIX="riscv32-esp-elf-" -# end of SDK tool configuration - -# -# Bootloader config -# -CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x0 -# end of Bootloader config - -# -# Component config -# -# -# Bluetooth -# -CONFIG_BT_SOC_SUPPORT_5_0=y -# -# NimBLE Options -# -CONFIG_BT_NIMBLE_PINNED_TO_CORE=0 -# end of NimBLE Options - -# end of Bluetooth - -# -# ESP32C3-Specific -# -# CONFIG_ESP32C3_DEFAULT_CPU_FREQ_80 is not set -CONFIG_ESP32C3_DEFAULT_CPU_FREQ_160=y -CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ=160 -# CONFIG_ESP32C3_REV_MIN_0 is not set -# CONFIG_ESP32C3_REV_MIN_1 is not set -# CONFIG_ESP32C3_REV_MIN_2 is not set -CONFIG_ESP32C3_REV_MIN_3=y -CONFIG_ESP32C3_REV_MIN=3 -CONFIG_ESP32C3_DEBUG_OCDAWARE=y -CONFIG_ESP32C3_BROWNOUT_DET=y -CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_7=y -# CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_4 is not set -# CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_3 is not set -# CONFIG_ESP32C3_BROWNOUT_DET_LVL_SEL_2 is not set -CONFIG_ESP32C3_BROWNOUT_DET_LVL=7 -CONFIG_ESP32C3_TIME_SYSCALL_USE_RTC_SYSTIMER=y -# CONFIG_ESP32C3_TIME_SYSCALL_USE_RTC is not set -# CONFIG_ESP32C3_TIME_SYSCALL_USE_SYSTIMER is not set -# CONFIG_ESP32C3_TIME_SYSCALL_USE_NONE is not set -CONFIG_ESP32C3_RTC_CLK_SRC_INT_RC=y -# CONFIG_ESP32C3_RTC_CLK_SRC_EXT_CRYS is not set -# CONFIG_ESP32C3_RTC_CLK_SRC_EXT_OSC is not set -# CONFIG_ESP32C3_RTC_CLK_SRC_INT_8MD256 is not set -CONFIG_ESP32C3_RTC_CLK_CAL_CYCLES=1024 -# end of ESP32C3-Specific - -# -# Hardware Settings -# -# -# MAC Config -# -# CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES_TWO is not set -CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP32C3_UNIVERSAL_MAC_ADDRESSES=4 -# end of MAC Config - -# -# Sleep Config -# -CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y -CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y -# end of Sleep Config - -# end of Hardware Settings - -# -# PHY -# -CONFIG_ESP_PHY_ENABLE_USB=y -# end of PHY - -# -# ESP System Settings -# -CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE=y -# -# Memory protection -# -CONFIG_ESP_SYSTEM_MEMPROT_DEPCHECK=y -CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=y -CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK=y -CONFIG_ESP_SYSTEM_MEMPROT_CPU_PREFETCH_PAD_SIZE=16 -CONFIG_ESP_SYSTEM_MEMPROT_MEM_ALIGN_SIZE=512 -# end of Memory protection - -CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y -# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 - CONFIG_ESP_CONSOLE_SECONDARY_NONE=y -# CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG is not set -# end of ESP System Settings - - -# -# Wi-Fi -# -CONFIG_ESP32_WIFI_ENABLED=y -CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 -# CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y -CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 -# CONFIG_ESP32_WIFI_CSI_ENABLED is not set -CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y -CONFIG_ESP32_WIFI_TX_BA_WIN=6 -CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y -CONFIG_ESP32_WIFI_RX_BA_WIN=6 -# CONFIG_ESP32_WIFI_NVS_ENABLED is not set -CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 -CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 -CONFIG_ESP32_WIFI_IRAM_OPT=y -CONFIG_ESP32_WIFI_RX_IRAM_OPT=y -# CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE is not set -# end of Wi-Fi - -# -# FreeRTOS -# -CONFIG_FREERTOS_UNICORE=y -CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y -# end of FreeRTOS - -# end of Component config - -# -# Deprecated options for backward compatibility -# -CONFIG_TOOLPREFIX="riscv32-esp-elf-" -# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set -CONFIG_ESP32_APPTRACE_DEST_NONE=y -CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y -CONFIG_NIMBLE_PINNED_TO_CORE=0 -CONFIG_ESP_SYSTEM_PD_FLASH=y -CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND=y -CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP32_PHY_MAX_TX_POWER=20 -CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP=y -CONFIG_ESP32H2_MEMPROT_FEATURE=y -CONFIG_ESP32H2_MEMPROT_FEATURE_LOCK=y -# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set -# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set -# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set -CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y -CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_ESP32_PTHREAD_STACK_MIN=768 -CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" -# end of Deprecated options for backward compatibility diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults index bfd64ef90e..6bcded2a0d 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults @@ -1,167 +1,11 @@ -# -# Espressif IoT Development Framework (ESP-IDF) Project Configuration -# -CONFIG_IDF_TARGET_ARCH_XTENSA=y -CONFIG_IDF_TARGET="esp32s2" -CONFIG_IDF_TARGET_ESP32S2=y -CONFIG_IDF_FIRMWARE_CHIP_ID=0x0002 -# end of Espressif IoT Development Framework (ESP-IDF) Project Configuration - -CONFIG_SDK_TOOLPREFIX="xtensa-esp32s2-elf-" -# -# Bootloader config -# -CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000 -# end of Bootloader config - -# CONFIG_ESP32S2_DEFAULT_CPU_FREQ_80 is not set -# -# ESP32S2-specific -# -# CONFIG_ESP32S2_DEFAULT_CPU_FREQ_160 is not set -CONFIG_ESP32S2_DEFAULT_CPU_FREQ_240=y -CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ=240 -# end of ESP32S2-specific - -# CONFIG_ESP32S2_INSTRUCTION_CACHE_8KB is not set -# -# Cache config +# This file was generated using idf.py save-defconfig. It can be edited manually. +# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration # CONFIG_ESP32S2_INSTRUCTION_CACHE_16KB=y -# CONFIG_ESP32S2_INSTRUCTION_CACHE_LINE_16B is not set -CONFIG_ESP32S2_INSTRUCTION_CACHE_LINE_32B=y -# CONFIG_ESP32S2_DATA_CACHE_0KB is not set -# CONFIG_ESP32S2_DATA_CACHE_8KB is not set CONFIG_ESP32S2_DATA_CACHE_16KB=y -# CONFIG_ESP32S2_DATA_CACHE_LINE_16B is not set -CONFIG_ESP32S2_DATA_CACHE_LINE_32B=y -# CONFIG_ESP32S2_INSTRUCTION_CACHE_WRAP is not set -# CONFIG_ESP32S2_DATA_CACHE_WRAP is not set -# end of Cache config -# CONFIG_ESP32S2_TRAX is not set -CONFIG_ESP32S2_TRACEMEM_RESERVE_DRAM=0x0 -CONFIG_ESP32S2_ULP_COPROC_ENABLED=y -CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM=8176 -CONFIG_ESP32S2_ULP_COPROC_RISCV=y -CONFIG_ESP32S2_DEBUG_OCDAWARE=y -# CONFIG_ESP32S2_DEBUG_STUBS_ENABLE is not set -CONFIG_ESP32S2_BROWNOUT_DET=y -CONFIG_ESP32S2_BROWNOUT_DET_LVL_SEL_7=y -# CONFIG_ESP32S2_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP32S2_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_ESP32S2_BROWNOUT_DET_LVL_SEL_4 is not set -# CONFIG_ESP32S2_BROWNOUT_DET_LVL_SEL_3 is not set -# CONFIG_ESP32S2_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_ESP32S2_BROWNOUT_DET_LVL_SEL_1 is not set -CONFIG_ESP32S2_BROWNOUT_DET_LVL=7 -CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC_FRC1=y -# CONFIG_ESP32S2_TIME_SYSCALL_USE_RTC is not set -# CONFIG_ESP32S2_TIME_SYSCALL_USE_FRC1 is not set -# CONFIG_ESP32S2_TIME_SYSCALL_USE_NONE is not set -CONFIG_ESP32S2_RTC_CLK_SRC_INT_RC=y -# CONFIG_ESP32S2_RTC_CLK_SRC_EXT_CRYS is not set -# CONFIG_ESP32S2_RTC_CLK_SRC_EXT_OSC is not set -# CONFIG_ESP32S2_RTC_CLK_SRC_INT_8MD256 is not set -CONFIG_ESP32S2_RTC_CLK_CAL_CYCLES=576 -# CONFIG_ESP32S2_NO_BLOBS is not set -# CONFIG_ESP32S2_KEEP_USB_ALIVE is not set CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM=y -# CONFIG_ESP32S2_USE_FIXED_STATIC_RAM_SIZE is not set -# -# MAC Config -# -# CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES_ONE is not set -CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES_TWO=y -CONFIG_ESP32S2_UNIVERSAL_MAC_ADDRESSES=2 -# end of MAC Config -CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y -# -# Sleep Config -# -# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set -# end of Sleep Config - -# -# PHY -# -# CONFIG_ESP_PHY_ENABLE_USB is not set -# end of PHY - -CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE=y -# -# Memory protection -# -CONFIG_ESP_SYSTEM_MEMPROT_FEATURE=y -CONFIG_ESP_SYSTEM_MEMPROT_FEATURE_LOCK=y -CONFIG_ESP_SYSTEM_MEMPROT_CPU_PREFETCH_PAD_SIZE=16 -CONFIG_ESP_SYSTEM_MEMPROT_MEM_ALIGN_SIZE=4 -# end of Memory protection - -CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y -# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 -# -# Wi-Fi -# -CONFIG_ESP32_WIFI_ENABLED=y -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 -# CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y -CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 -CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 -# CONFIG_ESP32_WIFI_CSI_ENABLED is not set -CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y -CONFIG_ESP32_WIFI_TX_BA_WIN=6 -CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y -CONFIG_ESP32_WIFI_RX_BA_WIN=6 -# CONFIG_ESP32_WIFI_NVS_ENABLED is not set -CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 -CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 -CONFIG_ESP32_WIFI_IRAM_OPT=y -CONFIG_ESP32_WIFI_RX_IRAM_OPT=y -# CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE is not set -# CONFIG_ESP_WIFI_EXTERNAL_COEXIST_ENABLE is not set -# end of Wi-Fi - -CONFIG_FREERTOS_UNICORE=y -# -# FreeRTOS -# -CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER=y -CONFIG_FREERTOS_CORETIMER_0=y -# CONFIG_FREERTOS_CORETIMER_1 is not set -CONFIG_FREERTOS_SYSTICK_USES_CCOUNT=y -CONFIG_FREERTOS_OPTIMIZED_SCHEDULER=y -# end of FreeRTOS - -CONFIG_MBEDTLS_HARDWARE_GCM=y -# -# Deprecated options for backward compatibility -# -CONFIG_TOOLPREFIX="xtensa-esp32s2-elf-" -# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set -CONFIG_ESP32_APPTRACE_DEST_NONE=y -CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y -CONFIG_ESP_SYSTEM_PD_FLASH=y -# CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND is not set -CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP32_PHY_MAX_TX_POWER=20 -CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP=y -CONFIG_ESP32H2_MEMPROT_FEATURE=y -CONFIG_ESP32H2_MEMPROT_FEATURE_LOCK=y -# CONFIG_EXTERNAL_COEX_ENABLE is not set -# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set -# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set -CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y -CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_ESP32_PTHREAD_STACK_MIN=768 -CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" -# end of Deprecated options for backward compatibility +CONFIG_ULP_COPROC_ENABLED=y +CONFIG_ULP_COPROC_TYPE_RISCV=y +CONFIG_ULP_COPROC_RESERVE_MEM=8176 diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults index f6fb80c752..30dea89201 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults @@ -1,221 +1,12 @@ -CONFIG_IDF_TARGET_ARCH_XTENSA=y -CONFIG_IDF_TARGET="esp32s3" -CONFIG_IDF_TARGET_ESP32S3=y -CONFIG_IDF_FIRMWARE_CHIP_ID=0x0009 +# This file was generated using idf.py save-defconfig. It can be edited manually. +# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration # -# SDK tool configuration -# -CONFIG_SDK_TOOLPREFIX="xtensa-esp32s3-elf-" -# end of SDK tool configuration - -# -# Bootloader config -# -CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x0 -# end of Bootloader config - -# -# Component config -# -# -# Bluetooth -# -CONFIG_BT_SOC_SUPPORT_5_0=y -# -# NimBLE Options -# -# CONFIG_BT_NIMBLE_PINNED_TO_CORE_0 is not set CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=y -CONFIG_BT_NIMBLE_PINNED_TO_CORE=1 -# end of NimBLE Options -# end of Bluetooth - -# -# ESP32S3-Specific -# -# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_80 is not set -# CONFIG_ESP32S3_DEFAULT_CPU_FREQ_160 is not set -CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240=y -CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ=240 -# -# Cache config -# -CONFIG_ESP32S3_INSTRUCTION_CACHE_16KB=y -# CONFIG_ESP32S3_INSTRUCTION_CACHE_32KB is not set -CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE=0x4000 -# CONFIG_ESP32S3_INSTRUCTION_CACHE_4WAYS is not set -CONFIG_ESP32S3_INSTRUCTION_CACHE_8WAYS=y -CONFIG_ESP32S3_ICACHE_ASSOCIATED_WAYS=8 -# CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_16B is not set -CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_32B=y -CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_SIZE=32 -# CONFIG_ESP32S3_INSTRUCTION_CACHE_WRAP is not set -# CONFIG_ESP32S3_DATA_CACHE_16KB is not set -CONFIG_ESP32S3_DATA_CACHE_32KB=y -# CONFIG_ESP32S3_DATA_CACHE_64KB is not set -CONFIG_ESP32S3_DATA_CACHE_SIZE=0x8000 -# CONFIG_ESP32S3_DATA_CACHE_4WAYS is not set -CONFIG_ESP32S3_DATA_CACHE_8WAYS=y -CONFIG_ESP32S3_DCACHE_ASSOCIATED_WAYS=8 -# CONFIG_ESP32S3_DATA_CACHE_LINE_16B is not set -CONFIG_ESP32S3_DATA_CACHE_LINE_32B=y -# CONFIG_ESP32S3_DATA_CACHE_LINE_64B is not set -CONFIG_ESP32S3_DATA_CACHE_LINE_SIZE=32 -# CONFIG_ESP32S3_DATA_CACHE_WRAP is not set -# end of Cache config - -# CONFIG_ESP32S3_TRAX is not set -CONFIG_ESP32S3_TRACEMEM_RESERVE_DRAM=0x0 -CONFIG_ESP32S3_ULP_COPROC_ENABLED=y -CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM=8176 -CONFIG_ESP32S3_ULP_COPROC_RISCV=y -CONFIG_ESP32S3_BROWNOUT_DET=y -CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_7=y -# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_4 is not set -# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_3 is not set -# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_ESP32S3_BROWNOUT_DET_LVL_SEL_1 is not set -CONFIG_ESP32S3_BROWNOUT_DET_LVL=7 -CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC_FRC1=y -# CONFIG_ESP32S3_TIME_SYSCALL_USE_RTC is not set -# CONFIG_ESP32S3_TIME_SYSCALL_USE_FRC1 is not set -# CONFIG_ESP32S3_TIME_SYSCALL_USE_NONE is not set -CONFIG_ESP32S3_RTC_CLK_SRC_INT_RC=y -# CONFIG_ESP32S3_RTC_CLK_SRC_EXT_CRYS is not set -# CONFIG_ESP32S3_RTC_CLK_SRC_EXT_OSC is not set -# CONFIG_ESP32S3_RTC_CLK_SRC_INT_8MD256 is not set -CONFIG_ESP32S3_RTC_CLK_CAL_CYCLES=1024 -CONFIG_ESP32S3_DEEP_SLEEP_WAKEUP_DELAY=2000 -CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM=y -# CONFIG_ESP32S3_USE_FIXED_STATIC_RAM_SIZE is not set -# end of ESP32S3-Specific - -# -# Hardware Settings -# -# -# MAC Config -# -# CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_TWO is not set -CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP32S3_UNIVERSAL_MAC_ADDRESSES=4 -# end of MAC Config - -# -# Sleep Config -# -CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND=y -# end of Sleep Config - -# end of Hardware Settings - -# -# PHY -# -CONFIG_ESP_PHY_ENABLE_USB=y -# end of PHY - -# -# ESP System Settings -# -# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0 is not set CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1=y -# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_ESP_MAIN_TASK_AFFINITY=0x1 -# end of ESP System Settings -# -# Wi-Fi -# -CONFIG_ESP32_WIFI_ENABLED=y -CONFIG_ESP32_WIFI_SW_COEXIST_ENABLE=y -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 -# CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y -CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1 -CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 -# CONFIG_ESP32_WIFI_CSI_ENABLED is not set -CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y -CONFIG_ESP32_WIFI_TX_BA_WIN=6 -CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y -CONFIG_ESP32_WIFI_RX_BA_WIN=6 -# CONFIG_ESP32_WIFI_AMSDU_TX_ENABLED is not set -# CONFIG_ESP32_WIFI_NVS_ENABLED is not set -CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y -# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set -CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 -CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 -CONFIG_ESP32_WIFI_IRAM_OPT=y -CONFIG_ESP32_WIFI_RX_IRAM_OPT=y -# CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE is not set -# end of Wi-Fi +CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM=y -# -# FreeRTOS -# -# CONFIG_FREERTOS_UNICORE is not set -# end of FreeRTOS - -# end of Component config - -# -# Deprecated options for backward compatibility -# -CONFIG_TOOLPREFIX="xtensa-esp32s3-elf-" -# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set -CONFIG_ESP32_APPTRACE_DEST_NONE=y -CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y -# CONFIG_NIMBLE_PINNED_TO_CORE_0 is not set -CONFIG_NIMBLE_PINNED_TO_CORE_1=y -CONFIG_NIMBLE_PINNED_TO_CORE=1 -CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND=y -CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP32_PHY_MAX_TX_POWER=20 -CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP=y -# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set -# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set -# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set -CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y -CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_ESP32_PTHREAD_STACK_MIN=768 -CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y -# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0 is not set -# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1 is not set -CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" -# end of Deprecated options for backward compatibility - -# -# Camera configuration -# -CONFIG_OV7670_SUPPORT=y -# CONFIG_OV7725_SUPPORT is not set -# CONFIG_NT99141_SUPPORT is not set -CONFIG_OV2640_SUPPORT=y -CONFIG_OV3660_SUPPORT=y -CONFIG_OV5640_SUPPORT=y -# CONFIG_GC2145_SUPPORT is not set -# CONFIG_GC032A_SUPPORT is not set -# CONFIG_GC0308_SUPPORT is not set -# CONFIG_BF3005_SUPPORT is not set -# CONFIG_BF20A6_SUPPORT is not set -# CONFIG_SC101IOT_SUPPORT is not set -# CONFIG_SC030IOT_SUPPORT is not set -# CONFIG_SCCB_HARDWARE_I2C_PORT0 is not set -CONFIG_SCCB_HARDWARE_I2C_PORT1=y -CONFIG_SCCB_CLK_FREQ=100000 -CONFIG_CAMERA_CORE0=y -# CONFIG_CAMERA_CORE1 is not set -# CONFIG_CAMERA_NO_AFFINITY is not set -CONFIG_CAMERA_DMA_BUFFER_SIZE_MAX=32768 -# CONFIG_CAMERA_CONVERTER_ENABLED is not set -# end of Camera configuration -# end of Component config +CONFIG_ULP_COPROC_ENABLED=y +CONFIG_ULP_COPROC_TYPE_RISCV=y +CONFIG_ULP_COPROC_RESERVE_MEM=8176 diff --git a/ports/espressif/esp-idf-config/sdkconfig-opt.defaults b/ports/espressif/esp-idf-config/sdkconfig-opt.defaults index 1ccd6478fe..ca38be15f2 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-opt.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-opt.defaults @@ -1,118 +1,15 @@ +# This file was generated using idf.py save-defconfig. It can be edited manually. +# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration # -# Bootloader config -# -CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y -# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -# end of Bootloader config -# -# Compiler options -# -# CONFIG_COMPILER_OPTIMIZATION_DEFAULT is not set -CONFIG_COMPILER_OPTIMIZATION_SIZE=y -# CONFIG_COMPILER_OPTIMIZATION_PERF is not set -# CONFIG_COMPILER_OPTIMIZATION_NONE is not set -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE is not set CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set -CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=1 -# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set -# end of Compiler options +CONFIG_COMPILER_OPTIMIZATION_SIZE=y -# -# Component config -# -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_DEBUG_OCDAWARE=y -# end of ESP32S3-Specific - -# -# Common ESP-related -# -# CONFIG_ESP_ERR_TO_NAME_LOOKUP is not set -# end of Common ESP-related - -# -# ESP System Settings -# -# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set -# CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT is not set -CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y -# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set -# CONFIG_ESP_CONSOLE_UART_DEFAULT is not set -# CONFIG_ESP_CONSOLE_USB_CDC is not set -# CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG is not set -# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set CONFIG_ESP_CONSOLE_NONE=y -# CONFIG_ESP_CONSOLE_SECONDARY_NONE is not set -CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG=y -CONFIG_ESP_CONSOLE_MULTIPLE_UART=y -CONFIG_ESP_CONSOLE_UART_NUM=-1 -# end of ESP System Settings -# -# FreeRTOS -# -CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y -CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y -# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set -# CONFIG_FREERTOS_ASSERT_DISABLE is not set -CONFIG_FREERTOS_DEBUG_OCDAWARE=y -# end of FreeRTOS +CONFIG_ESP_ERR_TO_NAME_LOOKUP=n -# -# Hardware Abstraction Layer (HAL) and Low Level (LL) -# -CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y -# CONFIG_HAL_ASSERTION_DISABLE is not set -# CONFIG_HAL_ASSERTION_SILIENT is not set -CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=1 -# end of Hardware Abstraction Layer (HAL) and Low Level (LL) +CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y -# -# Log output -# CONFIG_LOG_DEFAULT_LEVEL_NONE=y -# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set -# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -# CONFIG_LOG_DEFAULT_LEVEL_INFO is not set -# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set -# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -# end of Log output - -# -# LWIP -# -CONFIG_LWIP_ESP_LWIP_ASSERT=y -# end of LWIP - -# end of Component config - -# -# Deprecated options for backward compatibility -# -# CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set -CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y -# CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED is not set -CONFIG_OPTIMIZATION_ASSERTIONS_SILENT=y -# CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set -CONFIG_OPTIMIZATION_ASSERTION_LEVEL=1 -# CONFIG_ESP32S2_PANIC_PRINT_HALT is not set -# CONFIG_ESP32S2_PANIC_PRINT_REBOOT is not set -CONFIG_ESP32S2_PANIC_SILENT_REBOOT=y -# CONFIG_ESP32S2_PANIC_GDBSTUB is not set -# CONFIG_CONSOLE_UART_DEFAULT is not set -# CONFIG_CONSOLE_UART_CUSTOM is not set -CONFIG_ESP_CONSOLE_UART_NONE=y -CONFIG_CONSOLE_UART_NUM=-1 -# end of Deprecated options for backward compatibility diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index b27d846f2c..a7bcc25081 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -1,877 +1,56 @@ -CONFIG_IDF_CMAKE=y +# This file was generated using idf.py save-defconfig. It can be edited manually. +# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration # -# SDK tool configuration -# -# CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set -# end of SDK tool configuration +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y -# -# Build type -# -CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y -# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set -CONFIG_APP_BUILD_GENERATE_BINARIES=y -CONFIG_APP_BUILD_BOOTLOADER=y -CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y -# end of Build type - -# -# Application manager -# -CONFIG_APP_COMPILE_TIME_DATE=y -# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set -# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set -# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set -CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 -# end of Application manager - -# -# Bootloader config -# -# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y -# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=3 -# CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set -CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y -# CONFIG_BOOTLOADER_FACTORY_RESET is not set -# CONFIG_BOOTLOADER_APP_TEST is not set -CONFIG_BOOTLOADER_WDT_ENABLE=y -# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set -CONFIG_BOOTLOADER_WDT_TIME_MS=9000 -# CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS is not set -CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 -# CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set -CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y -# end of Bootloader config - -# -# Security features -# -CONFIG_SECURE_BOOT_SUPPORTS_RSA=y -CONFIG_SECURE_TARGET_HAS_SECURE_ROM_DL_MODE=y -# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set -# CONFIG_SECURE_BOOT is not set -# CONFIG_SECURE_FLASH_ENC_ENABLED is not set -# end of Security features - -# -# Boot ROM Behavior -# -CONFIG_BOOT_ROM_LOG_ALWAYS_ON=y -# CONFIG_BOOT_ROM_LOG_ALWAYS_OFF is not set -# CONFIG_BOOT_ROM_LOG_ON_GPIO_HIGH is not set -# CONFIG_BOOT_ROM_LOG_ON_GPIO_LOW is not set -# end of Boot ROM Behavior - -# -# Serial flasher config -# -CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 -# CONFIG_ESPTOOLPY_NO_STUB is not set -# CONFIG_ESPTOOLPY_OCT_FLASH is not set -# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set -# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set -CONFIG_ESPTOOLPY_FLASHMODE_DIO=y -# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set -CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y -CONFIG_ESPTOOLPY_FLASHMODE="dio" -# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set -# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set -CONFIG_ESPTOOLPY_FLASHFREQ_40M=y -# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set -CONFIG_ESPTOOLPY_FLASHFREQ="40m" -CONFIG_ESPTOOLPY_BEFORE_RESET=y -# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set -CONFIG_ESPTOOLPY_BEFORE="default_reset" -CONFIG_ESPTOOLPY_AFTER_RESET=y -# CONFIG_ESPTOOLPY_AFTER_NORESET is not set -CONFIG_ESPTOOLPY_AFTER="hard_reset" -# CONFIG_ESPTOOLPY_MONITOR_BAUD_CONSOLE is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 -# end of Serial flasher config - -# -# Partition Table -# -# CONFIG_PARTITION_TABLE_SINGLE_APP is not set -# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set -# CONFIG_PARTITION_TABLE_TWO_OTA is not set -CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_PARTITION_TABLE_OFFSET=0x8000 -CONFIG_PARTITION_TABLE_MD5=y -# end of Partition Table - -# -# Compiler options -# -CONFIG_COMPILER_HIDE_PATHS_MACROS=y -# CONFIG_COMPILER_CXX_EXCEPTIONS is not set -# CONFIG_COMPILER_CXX_RTTI is not set -CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y -# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set -# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set -# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set -# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set -# CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set -# CONFIG_COMPILER_DUMP_RTL_FILES is not set -# end of Compiler options - -# -# Component config -# -# -# Application Level Tracing -# -# CONFIG_APPTRACE_DEST_JTAG is not set -CONFIG_APPTRACE_DEST_NONE=y -CONFIG_APPTRACE_LOCK_ENABLE=y -# end of Application Level Tracing - -# CONFIG_BLE_MESH is not set -# -# Driver configurations -# -# -# ADC configuration -# -# CONFIG_ADC_FORCE_XPD_FSM is not set -CONFIG_ADC_DISABLE_DAC=y -# end of ADC configuration - -# -# MCPWM configuration -# -# CONFIG_MCPWM_ISR_IN_IRAM is not set -# end of MCPWM configuration - -# -# SPI configuration -# -# CONFIG_SPI_MASTER_IN_IRAM is not set -CONFIG_SPI_MASTER_ISR_IN_IRAM=y -# CONFIG_SPI_SLAVE_IN_IRAM is not set -CONFIG_SPI_SLAVE_ISR_IN_IRAM=y -# end of SPI configuration - -# -# TWAI configuration -# -# CONFIG_TWAI_ISR_IN_IRAM is not set -# end of TWAI configuration - -# -# UART configuration -# -# CONFIG_UART_ISR_IN_IRAM is not set -# end of UART configuration - -# -# GDMA Configuration -# -# CONFIG_GDMA_CTRL_FUNC_IN_IRAM is not set -# CONFIG_GDMA_ISR_IRAM_SAFE is not set -# end of GDMA Configuration - -# end of Driver configurations - -# -# eFuse Bit Manager -# -# CONFIG_EFUSE_CUSTOM_TABLE is not set -# CONFIG_EFUSE_VIRTUAL is not set -CONFIG_EFUSE_MAX_BLK_LEN=256 -# end of eFuse Bit Manager - -# -# ESP-TLS -# -CONFIG_ESP_TLS_USING_MBEDTLS=y -CONFIG_ESP_TLS_USE_DS_PERIPHERAL=y -CONFIG_ESP_TLS_SERVER=y -# CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set -# CONFIG_ESP_TLS_SERVER_SESSION_TICKETS is not set -# CONFIG_ESP_TLS_PSK_VERIFICATION is not set -# CONFIG_ESP_TLS_INSECURE is not set -# end of ESP-TLS - -# -# Ethernet -# -# CONFIG_ETH_USE_SPI_ETHERNET is not set -# CONFIG_ETH_USE_OPENETH is not set -# end of Ethernet - -# -# Event Loop Library -# -# CONFIG_ESP_EVENT_LOOP_PROFILING is not set -CONFIG_ESP_EVENT_POST_FROM_ISR=y -CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y -# end of Event Loop Library - -# -# Hardware Settings -# -# -# MAC Config -# -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y -# end of MAC Config - -# -# Sleep Config -# -CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y -# CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND is not set -# CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND is not set -# end of Sleep Config - -# -# RTC Clock Config -# -CONFIG_RTC_CLOCK_BBPLL_POWER_ON_WITH_USB=y -# end of RTC Clock Config - -# end of Hardware Settings - -# -# IPC (Inter-Processor Call) -# CONFIG_ESP_IPC_TASK_STACK_SIZE=1536 -CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y -CONFIG_ESP_IPC_ISR_ENABLE=y -# end of IPC (Inter-Processor Call) - -# -# ESP NETIF Adapter -# -CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 -CONFIG_ESP_NETIF_TCPIP_LWIP=y -# CONFIG_ESP_NETIF_LOOPBACK is not set -# CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER is not set -# end of ESP NETIF Adapter - -# -# PHY -# -CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP_PHY_MAX_TX_POWER=20 -# end of PHY - -# -# Power Management -# -# CONFIG_PM_ENABLE is not set -CONFIG_PM_POWER_DOWN_CPU_IN_LIGHT_SLEEP=y -CONFIG_PM_POWER_DOWN_TAGMEM_IN_LIGHT_SLEEP=y -# end of Power Management - -# -# ESP System Settings -# -# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set -CONFIG_ESP_SYSTEM_RTC_FAST_MEM_AS_HEAP_DEPCHECK=y -CONFIG_ESP_SYSTEM_ALLOW_RTC_FAST_MEM_AS_HEAP=y -CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384 -CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 -CONFIG_ESP_INT_WDT=y -CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 -CONFIG_ESP_INT_WDT_CHECK_CPU1=y -# CONFIG_ESP_TASK_WDT is not set -# CONFIG_ESP_PANIC_HANDLER_IRAM is not set -# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set -CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y -# end of ESP System Settings -# -# High resolution timer (esp_timer) -# -# CONFIG_ESP_TIMER_PROFILING is not set -CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y -CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y -CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584 -CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 -# CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set -CONFIG_ESP_TIMER_IMPL_SYSTIMER=y -# end of High resolution timer (esp_timer) +CONFIG_ESP_TASK_WDT=n -# -# Wi-Fi -# -# CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set -# CONFIG_ESP_WIFI_FTM_ENABLE is not set -# CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set -# CONFIG_ESP_WIFI_GCMP_SUPPORT is not set -# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set -CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y -# end of Wi-Fi +CONFIG_ESP_TLS_SERVER=y -# -# Core dump -# -# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set -# CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set -CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y -# end of Core dump - -# -# FreeRTOS -# -CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_TICK_SUPPORT_SYSTIMER=y -CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL1=y -# CONFIG_FREERTOS_CORETIMER_SYSTIMER_LVL3 is not set -CONFIG_FREERTOS_SYSTICK_USES_SYSTIMER=y -CONFIG_FREERTOS_HZ=100 -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set -CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y -# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set -CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y -CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 -CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1536 -CONFIG_FREERTOS_ISR_STACKSIZE=1536 -# CONFIG_FREERTOS_LEGACY_HOOKS is not set -CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 -CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y -# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set -CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 -CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 -CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 -CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 -# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set -# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set -CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y -# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set -# CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set -CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y -# CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH is not set -# end of FreeRTOS - -# -# Heap memory debugging -# -CONFIG_HEAP_POISONING_DISABLED=y -# CONFIG_HEAP_POISONING_LIGHT is not set -# CONFIG_HEAP_POISONING_COMPREHENSIVE is not set -CONFIG_HEAP_TRACING_OFF=y -# CONFIG_HEAP_TRACING_STANDALONE is not set -# CONFIG_HEAP_TRACING_TOHOST is not set -# CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set -# end of Heap memory debugging - -# -# Log output -# -# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set -# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set -# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_LOG_DEFAULT_LEVEL_INFO=y -# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set -# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -CONFIG_LOG_DEFAULT_LEVEL=3 -CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y -# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set -# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set -CONFIG_LOG_MAXIMUM_LEVEL=3 -CONFIG_LOG_COLORS=y -CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y -# CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set -# end of Log output - -# -# LWIP -# -# CONFIG_LWIP_NETIF_API is not set -# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set -CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y -# CONFIG_LWIP_L2_TO_L3_COPY is not set -# CONFIG_LWIP_IRAM_OPTIMIZATION is not set -CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=8 -# CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set -# CONFIG_LWIP_SO_LINGER is not set -CONFIG_LWIP_SO_REUSE=y -CONFIG_LWIP_SO_REUSE_RXTOALL=y -CONFIG_LWIP_SO_RCVBUF=y -# CONFIG_LWIP_NETBUF_RECVINFO is not set -CONFIG_LWIP_IP4_FRAG=y -CONFIG_LWIP_IP6_FRAG=y -# CONFIG_LWIP_IP4_REASSEMBLY is not set -# CONFIG_LWIP_IP6_REASSEMBLY is not set -# CONFIG_LWIP_IP_FORWARD is not set -# CONFIG_LWIP_STATS is not set -# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set -CONFIG_LWIP_ESP_GRATUITOUS_ARP=y -CONFIG_LWIP_GARP_TMR_INTERVAL=60 -CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 -CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y -# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set -CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y -# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set -CONFIG_LWIP_DHCP_OPTIONS_LEN=68 -# -# DHCP server -# -CONFIG_LWIP_DHCPS=y -CONFIG_LWIP_DHCPS_LEASE_UNIT=60 -CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 -# end of DHCP server - -# CONFIG_LWIP_AUTOIP is not set -CONFIG_LWIP_IPV6=y -# CONFIG_LWIP_IPV6_AUTOCONFIG is not set -CONFIG_LWIP_IPV6_NUM_ADDRESSES=3 -# CONFIG_LWIP_IPV6_FORWARD is not set -# CONFIG_LWIP_NETIF_STATUS_CALLBACK is not set -CONFIG_LWIP_NETIF_LOOPBACK=y -CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 -# -# TCP -# CONFIG_LWIP_MAX_ACTIVE_TCP=4 CONFIG_LWIP_MAX_LISTENING_TCP=4 -CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y -CONFIG_LWIP_TCP_MAXRTX=12 -CONFIG_LWIP_TCP_SYNMAXRTX=6 -CONFIG_LWIP_TCP_MSS=1440 -CONFIG_LWIP_TCP_TMR_INTERVAL=250 -CONFIG_LWIP_TCP_MSL=60000 -CONFIG_LWIP_TCP_SND_BUF_DEFAULT=2880 -CONFIG_LWIP_TCP_WND_DEFAULT=2880 -CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 -CONFIG_LWIP_TCP_QUEUE_OOSEQ=y -# CONFIG_LWIP_TCP_SACK_OUT is not set -# CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set -CONFIG_LWIP_TCP_OVERSIZE_MSS=y -# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set -# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set +CONFIG_LWIP_MAX_SOCKETS=8 +CONFIG_LWIP_SO_RCVBUF=y + CONFIG_LWIP_TCP_RTO_TIME=3000 -# end of TCP -# -# UDP -# -CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 -# end of UDP +CONFIG_LWIP_TCP_SND_BUF_DEFAULT=2880 +CONFIG_LWIP_TCP_SYNMAXRTX=6 +CONFIG_LWIP_TCP_WND_DEFAULT=2880 -# -# Checksums -# -# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set -# CONFIG_LWIP_CHECKSUM_CHECK_UDP is not set -CONFIG_LWIP_CHECKSUM_CHECK_ICMP=y -# end of Checksums - -CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072 -CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set -# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU1 is not set -CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF -# CONFIG_LWIP_PPP_SUPPORT is not set -CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3 -CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5 -# CONFIG_LWIP_SLIP_SUPPORT is not set -# -# ICMP -# -CONFIG_LWIP_ICMP=y -# CONFIG_LWIP_MULTICAST_PING is not set -# CONFIG_LWIP_BROADCAST_PING is not set -# end of ICMP - -# -# LWIP RAW API -# -CONFIG_LWIP_MAX_RAW_PCBS=16 -# end of LWIP RAW API - -# -# SNTP -# -CONFIG_LWIP_SNTP_MAX_SERVERS=1 -# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set -CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 -# end of SNTP - -# -# Hooks -# -# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set -CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y -# CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM is not set -CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y -# CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set -# CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set -CONFIG_LWIP_HOOK_ND6_GET_GW_NONE=y -# CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT is not set -# CONFIG_LWIP_HOOK_ND6_GET_GW_CUSTOM is not set -CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y -# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set -# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set -# end of Hooks - -# CONFIG_LWIP_DEBUG is not set -# end of LWIP - -# -# mbedTLS -# -CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y -# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set -# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set -CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y -CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 -# CONFIG_MBEDTLS_DEBUG is not set -# -# mbedTLS v2.28.x related -# -# CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set -CONFIG_MBEDTLS_ECDH_LEGACY_CONTEXT=y -# CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set -# CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set -CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y -# -# DTLS-based configurations -# -# CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID is not set -# CONFIG_MBEDTLS_SSL_DTLS_SRTP is not set -# end of DTLS-based configurations - -# end of mbedTLS v2.28.x related - -# -# Certificate Bundle -# -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL is not set -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE=y +CONFIG_MBEDTLS_CMAC_C=y + CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/data/roots.pem" # end of Certificate Bundle CONFIG_MBEDTLS_ECP_RESTARTABLE=y -CONFIG_MBEDTLS_CMAC_C=y -CONFIG_MBEDTLS_HARDWARE_AES=y -CONFIG_MBEDTLS_AES_USE_INTERRUPT=y -CONFIG_MBEDTLS_HARDWARE_MPI=y -CONFIG_MBEDTLS_HARDWARE_SHA=y -CONFIG_MBEDTLS_ROM_MD5=y -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set -CONFIG_MBEDTLS_HAVE_TIME=y -# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set -CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y -CONFIG_MBEDTLS_SHA512_C=y -CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y -# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set -# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set -# CONFIG_MBEDTLS_TLS_DISABLED is not set -CONFIG_MBEDTLS_TLS_SERVER=y -CONFIG_MBEDTLS_TLS_CLIENT=y -CONFIG_MBEDTLS_TLS_ENABLED=y -# -# TLS Key Exchange Methods -# -CONFIG_MBEDTLS_PSK_MODES=y -CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y -CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK=y + CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y +CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y -CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y -# end of TLS Key Exchange Methods +CONFIG_MBEDTLS_PSK_MODES=y -CONFIG_MBEDTLS_SSL_RENEGOTIATION=y -# CONFIG_MBEDTLS_SSL_PROTO_SSL3 is not set -# CONFIG_MBEDTLS_SSL_PROTO_TLS1 is not set -# CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 is not set -CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y -# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set +CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 CONFIG_MBEDTLS_SSL_PROTO_DTLS=y -CONFIG_MBEDTLS_SSL_ALPN=y -CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y -CONFIG_MBEDTLS_X509_CHECK_KEY_USAGE=y -CONFIG_MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE=y -CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y -# -# Symmetric Ciphers -# -CONFIG_MBEDTLS_AES_C=y -# CONFIG_MBEDTLS_CAMELLIA_C is not set -# CONFIG_MBEDTLS_DES_C is not set -CONFIG_MBEDTLS_RC4_DISABLED=y -# CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT is not set -# CONFIG_MBEDTLS_RC4_ENABLED is not set -# CONFIG_MBEDTLS_BLOWFISH_C is not set -# CONFIG_MBEDTLS_XTEA_C is not set -CONFIG_MBEDTLS_CCM_C=y -CONFIG_MBEDTLS_GCM_C=y -# CONFIG_MBEDTLS_NIST_KW_C is not set -# end of Symmetric Ciphers -# CONFIG_MBEDTLS_RIPEMD160_C is not set -# -# Certificates -# -CONFIG_MBEDTLS_PEM_PARSE_C=y -CONFIG_MBEDTLS_PEM_WRITE_C=y -CONFIG_MBEDTLS_X509_CRL_PARSE_C=y -CONFIG_MBEDTLS_X509_CSR_PARSE_C=y -# end of Certificates +CONFIG_PARTITION_TABLE_CUSTOM=y -CONFIG_MBEDTLS_ECP_C=y -CONFIG_MBEDTLS_ECDH_C=y -CONFIG_MBEDTLS_ECDSA_C=y -# CONFIG_MBEDTLS_ECJPAKE_C is not set -CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y -CONFIG_MBEDTLS_ECP_NIST_OPTIM=y -# CONFIG_MBEDTLS_POLY1305_C is not set -# CONFIG_MBEDTLS_CHACHA20_C is not set -# CONFIG_MBEDTLS_HKDF_C is not set -# CONFIG_MBEDTLS_THREADING_C is not set -# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set -# CONFIG_MBEDTLS_SECURITY_RISKS is not set -# end of mbedTLS - -# -# mDNS -# -CONFIG_MDNS_MAX_SERVICES=10 -CONFIG_MDNS_TASK_PRIORITY=1 -CONFIG_MDNS_TASK_STACK_SIZE=4096 -# CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_MDNS_TASK_AFFINITY_CPU0=y -# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set -CONFIG_MDNS_TASK_AFFINITY=0x0 -CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 -# CONFIG_MDNS_STRICT_MODE is not set -CONFIG_MDNS_TIMER_PERIOD_MS=100 -# CONFIG_MDNS_NETWORKING_SOCKET is not set -CONFIG_MDNS_MULTIPLE_INSTANCE=y -# end of mDNS - -# -# Newlib -# -CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y -# CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF is not set -# CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR is not set -# CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF is not set -# CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set -CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y -# CONFIG_NEWLIB_NANO_FORMAT is not set -# end of Newlib - -# -# OpenThread -# -# CONFIG_OPENTHREAD_ENABLED is not set -# end of OpenThread - -# -# PThreads -# -CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_PTHREAD_STACK_MIN=768 -CONFIG_PTHREAD_DEFAULT_CORE_NO_AFFINITY=y -# CONFIG_PTHREAD_DEFAULT_CORE_0 is not set -# CONFIG_PTHREAD_DEFAULT_CORE_1 is not set -CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" -# end of PThreads - -# -# SPI Flash driver -# -# CONFIG_SPI_FLASH_VERIFY_WRITE is not set -# CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set -CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y -# CONFIG_SPI_FLASH_ROM_IMPL is not set -CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y -# CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set -# CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set -# CONFIG_SPI_FLASH_USE_LEGACY_IMPL is not set -# CONFIG_SPI_FLASH_SHARE_SPI1_BUS is not set -# CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set -# CONFIG_SPI_FLASH_YIELD_DURING_ERASE is not set CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 -# CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set -# CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set -# CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST is not set -# -# Auto-detect flash chips -# -CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_TH_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_MXIC_OPI_CHIP=y -# end of Auto-detect flash chips +CONFIG_SPI_FLASH_YIELD_DURING_ERASE=n -CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y -# end of SPI Flash driver +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 +CONFIG_ESP32_WIFI_NVS_ENABLED=n -# -# Virtual file system -# -CONFIG_VFS_SUPPORT_IO=y -CONFIG_VFS_SUPPORT_DIR=y -CONFIG_VFS_SUPPORT_SELECT=y -CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y -CONFIG_VFS_SUPPORT_TERMIOS=y -# -# Host File System I/O (Semihosting) -# -CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -CONFIG_VFS_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 -# end of Host File System I/O (Semihosting) - -# end of Virtual file system - -# -# Supplicant -# -CONFIG_WPA_MBEDTLS_CRYPTO=y -# CONFIG_WPA_WAPI_PSK is not set -# CONFIG_WPA_SUITE_B_192 is not set -# CONFIG_WPA_DEBUG_PRINT is not set -# CONFIG_WPA_TESTING_OPTIONS is not set -# CONFIG_WPA_WPS_STRICT is not set -# CONFIG_WPA_11KV_SUPPORT is not set -# end of Supplicant - -# end of Component config - -# -# Compatibility options -# -# CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set -# end of Compatibility options - -# -# Deprecated options for backward compatibility -# -# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y -# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=3 -# CONFIG_APP_ROLLBACK_ENABLE is not set -# CONFIG_FLASH_ENCRYPTION_ENABLED is not set -CONFIG_FLASHMODE_QIO=y -# CONFIG_FLASHMODE_QOUT is not set -# CONFIG_FLASHMODE_DIO is not set -# CONFIG_FLASHMODE_DOUT is not set -# CONFIG_MONITOR_BAUD_9600B is not set -# CONFIG_MONITOR_BAUD_57600B is not set -CONFIG_MONITOR_BAUD_115200B=y -# CONFIG_MONITOR_BAUD_230400B is not set -# CONFIG_MONITOR_BAUD_921600B is not set -# CONFIG_MONITOR_BAUD_2MB is not set -# CONFIG_MONITOR_BAUD_OTHER is not set -CONFIG_MONITOR_BAUD_OTHER_VAL=115200 -CONFIG_MONITOR_BAUD=115200 -# CONFIG_CXX_EXCEPTIONS is not set -CONFIG_STACK_CHECK_NONE=y -# CONFIG_STACK_CHECK_NORM is not set -# CONFIG_STACK_CHECK_STRONG is not set -# CONFIG_STACK_CHECK_ALL is not set -# CONFIG_WARN_WRITE_STRINGS is not set -# CONFIG_DISABLE_GCC8_WARNINGS is not set -CONFIG_ADC2_DISABLE_DAC=y -# CONFIG_EVENT_LOOP_PROFILING is not set -CONFIG_POST_EVENTS_FROM_ISR=y -CONFIG_POST_EVENTS_FROM_IRAM_ISR=y -CONFIG_IPC_TASK_STACK_SIZE=1536 -CONFIG_ESP_SYSTEM_PM_POWER_DOWN_CPU=y -CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_MAIN_TASK_STACK_SIZE=8192 -CONFIG_INT_WDT=y -CONFIG_INT_WDT_TIMEOUT_MS=300 -CONFIG_INT_WDT_CHECK_CPU1=y -# CONFIG_TASK_WDT is not set -CONFIG_TIMER_TASK_STACK_SIZE=3584 -# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set -CONFIG_TIMER_TASK_PRIORITY=1 -CONFIG_TIMER_TASK_STACK_DEPTH=2048 -CONFIG_TIMER_QUEUE_LENGTH=10 -# CONFIG_L2_TO_L3_COPY is not set -# CONFIG_USE_ONLY_LWIP_SELECT is not set -CONFIG_ESP_GRATUITOUS_ARP=y -CONFIG_GARP_TMR_INTERVAL=60 -CONFIG_TCPIP_RECVMBOX_SIZE=32 -CONFIG_TCP_MAXRTX=12 -CONFIG_TCP_SYNMAXRTX=6 -CONFIG_TCP_MSS=1440 -CONFIG_TCP_MSL=60000 -CONFIG_TCP_SND_BUF_DEFAULT=2880 -CONFIG_TCP_WND_DEFAULT=2880 -CONFIG_TCP_RECVMBOX_SIZE=6 -CONFIG_TCP_QUEUE_OOSEQ=y -# CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set -CONFIG_TCP_OVERSIZE_MSS=y -# CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set -# CONFIG_TCP_OVERSIZE_DISABLE is not set -CONFIG_UDP_RECVMBOX_SIZE=6 -CONFIG_TCPIP_TASK_STACK_SIZE=3072 -CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_TCPIP_TASK_AFFINITY_CPU0 is not set -# CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set -CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF -# CONFIG_PPP_SUPPORT is not set -CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y -# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set -# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set -CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y -CONFIG_SUPPORT_TERMIOS=y -CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 -# end of Deprecated options for backward compatibility +CONFIG_ADC_SUPPRESS_DEPRECATE_WARN=y +CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y +CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y +CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN=y +CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y diff --git a/ports/espressif/esp-iot-solution b/ports/espressif/esp-iot-solution new file mode 160000 index 0000000000..d07eb2733c --- /dev/null +++ b/ports/espressif/esp-iot-solution @@ -0,0 +1 @@ +Subproject commit d07eb2733ca5d3379578f3952de04b4a4d188f36 diff --git a/ports/espressif/esp-protocols b/ports/espressif/esp-protocols new file mode 160000 index 0000000000..457f8335bb --- /dev/null +++ b/ports/espressif/esp-protocols @@ -0,0 +1 @@ +Subproject commit 457f8335bb876b8af80a65b096e5381f49f29878 diff --git a/ports/espressif/esp32-camera b/ports/espressif/esp32-camera index 2758089a06..75035312ed 160000 --- a/ports/espressif/esp32-camera +++ b/ports/espressif/esp32-camera @@ -1 +1 @@ -Subproject commit 2758089a06ccae79d8fcab6c93e2ca3761646f9f +Subproject commit 75035312ed9427557acfee1cd32af2b8e1f13f72 diff --git a/ports/espressif/esp32c3_fix.h b/ports/espressif/esp32c3_fix.h deleted file mode 100644 index cbd36ef2fb..0000000000 --- a/ports/espressif/esp32c3_fix.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2021 microDev - * - * 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. - */ - -// See https://github.com/espressif/esp-idf/issues/6906 - -#ifndef MICROPY_INCLUDED_ESPRESSIF_ESP32C3_FIX_H -#define MICROPY_INCLUDED_ESPRESSIF_ESP32C3_FIX_H - -#ifdef __riscv - -#undef __INT32_TYPE__ -#define __INT32_TYPE__ int - -#undef __UINT32_TYPE__ -#define __UINT32_TYPE__ unsigned int - -#endif // __riscv - -#endif // MICROPY_INCLUDED_ESPRESSIF_ESP32C3_FIX_H diff --git a/ports/espressif/i2s_lcd_driver.h b/ports/espressif/i2s_lcd_driver.h index 27c4e66b06..e69de29bb2 100644 --- a/ports/espressif/i2s_lcd_driver.h +++ b/ports/espressif/i2s_lcd_driver.h @@ -1,135 +0,0 @@ -/* *INDENT-OFF* */ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -#ifndef __I2S_LCD_DRIVER_H__ -#define __I2S_LCD_DRIVER_H__ - -#include "driver/i2s.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -#define LCD_CMD_LEV (0) -#define LCD_DATA_LEV (1) - -typedef void *i2s_lcd_handle_t; /** Handle of i2s lcd driver */ - -/** - * @brief Configuration of i2s lcd mode - * - */ -typedef struct { - int8_t data_width; /*!< Parallel data width, 16bit or 8bit available */ - int8_t pin_data_num[16]; /*!< Parallel data output IO*/ - int8_t pin_num_cs; /*!< CS io num */ - int8_t pin_num_wr; /*!< Write clk io*/ - int8_t pin_num_rs; /*!< RS io num */ - int clk_freq; /*!< I2s clock frequency */ - i2s_port_t i2s_port; /*!< I2S port number */ - bool swap_data; /*!< Swap the 2 bytes of RGB565 color */ - uint32_t buffer_size; /*!< DMA buffer size */ -} i2s_lcd_config_t; - -/** - * @brief Initialize i2s lcd driver. - * - * @param config configuration of i2s - * - * @return A handle to the created i2s lcd driver, or NULL in case of error. - */ -i2s_lcd_handle_t i2s_lcd_driver_init(const i2s_lcd_config_t *config); - -/** - * @brief Deinit i2s lcd driver. - * - * @param handle i2s lcd driver handle to deinitilize - * - * @return - * - ESP_OK on success - * - ESP_ERR_INVALID_ARG handle is invalid - */ -esp_err_t i2s_lcd_driver_deinit(i2s_lcd_handle_t handle); - -/** - * @brief Write a data to LCD - * - * @param handle i2s lcd driver handle - * @param data Data to write - * - * @return - * - ESP_OK on success - * - ESP_ERR_INVALID_ARG handle is invalid - */ -esp_err_t i2s_lcd_write_data(i2s_lcd_handle_t handle, uint16_t data); - -/** - * @brief Write a command to LCD - * - * @param handle Handle of i2s lcd driver - * @param cmd command to write - * - * @return - * - ESP_OK on success - * - ESP_ERR_INVALID_ARG handle is invalid - */ -esp_err_t i2s_lcd_write_cmd(i2s_lcd_handle_t handle, uint16_t cmd); - -/** - * @brief Write block data to LCD - * - * @param handle Handle of i2s lcd driver - * @param data Pointer of data - * @param length length of data - * - * @return - * - ESP_OK on success - * - ESP_ERR_INVALID_ARG handle is invalid - */ -esp_err_t i2s_lcd_write(i2s_lcd_handle_t handle, const uint8_t *data, uint32_t length); - -/** - * @brief acquire a lock - * - * @param handle Handle of i2s lcd driver - * - * @return Always return ESP_OK - */ -esp_err_t i2s_lcd_acquire(i2s_lcd_handle_t handle); - -/** - * @brief acquire a lock, but only wait a certain period of time - * - * @param handle Handle of i2s lcd driver - * - * @return true if the lock was acquired, false otherwise - */ -bool i2s_lcd_acquire_nonblocking(i2s_lcd_handle_t handle, TickType_t ticks_to_wait); - -/** - * @brief release a lock - * - * @param handle Handle of i2s lcd driver - * - * @return Always return ESP_OK - */ -esp_err_t i2s_lcd_release(i2s_lcd_handle_t handle); - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ports/espressif/i2s_lcd_esp32s2_driver.c b/ports/espressif/i2s_lcd_esp32s2_driver.c deleted file mode 100644 index 1bf8cd00f3..0000000000 --- a/ports/espressif/i2s_lcd_esp32s2_driver.c +++ /dev/null @@ -1,489 +0,0 @@ -/* *INDENT-OFF* */ -// Copyright 2015-2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at - -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "sdkconfig.h" -#if CONFIG_IDF_TARGET_ESP32S2 - -#include -#include -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "freertos/semphr.h" -#include "esp_log.h" -#include "driver/gpio.h" -#include "driver/i2s.h" -#include "esp_heap_caps.h" -#include "esp32s2/rom/lldesc.h" -#include "soc/system_reg.h" -#include "i2s_lcd_driver.h" - - -static const char *TAG = "ESP32S2_I2S_LCD"; - -#define I2S_CHECK(a, str, ret) if (!(a)) { \ - ESP_LOGE(TAG, "%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ - return ret; \ -} - -#define LCD_CAM_DMA_NODE_BUFFER_MAX_SIZE (4000) // 4-byte aligned -#define LCD_DATA_MAX_WIDTH (24) /*!< Maximum width of LCD data bus */ - -typedef struct { - uint32_t dma_buffer_size; - uint32_t dma_half_buffer_size; - uint32_t dma_node_buffer_size; - uint32_t dma_node_cnt; - uint32_t dma_half_node_cnt; - lldesc_t *dma; - uint8_t *dma_buffer; - QueueHandle_t event_queue; - uint8_t width; - bool swap_data; -} lcd_obj_t; - -typedef struct { - lcd_obj_t lcd; - intr_handle_t lcd_cam_intr_handle; - i2s_dev_t *i2s_dev; -} lcd_cam_obj_t; - -typedef struct { - int rs_io_num; - lcd_cam_obj_t *lcd_cam_obj; - SemaphoreHandle_t mutex; -} i2s_lcd_driver_t; - -static void IRAM_ATTR i2s_isr(void *arg) { - BaseType_t HPTaskAwoken = pdFALSE; - lcd_cam_obj_t *lcd_cam_obj = (lcd_cam_obj_t *)arg; - i2s_dev_t *i2s_dev = lcd_cam_obj->i2s_dev; - - typeof(i2s_dev->int_st) status = i2s_dev->int_st; - i2s_dev->int_clr.val = status.val; - if (status.val == 0) { - return; - } - - if (status.out_eof) { - xQueueSendFromISR(lcd_cam_obj->lcd.event_queue, (void *)&status.val, &HPTaskAwoken); - } - - if (HPTaskAwoken == pdTRUE) { - portYIELD_FROM_ISR(); - } -} - - -static void lcd_dma_set_int(lcd_cam_obj_t *lcd_cam_obj) { - // Generate a data DMA linked list - for (int x = 0; x < lcd_cam_obj->lcd.dma_node_cnt; x++) { - lcd_cam_obj->lcd.dma[x].size = lcd_cam_obj->lcd.dma_node_buffer_size; - lcd_cam_obj->lcd.dma[x].length = lcd_cam_obj->lcd.dma_node_buffer_size; - lcd_cam_obj->lcd.dma[x].buf = (lcd_cam_obj->lcd.dma_buffer + lcd_cam_obj->lcd.dma_node_buffer_size * x); - lcd_cam_obj->lcd.dma[x].eof = !((x + 1) % lcd_cam_obj->lcd.dma_half_node_cnt); - lcd_cam_obj->lcd.dma[x].empty = (uint32_t)&lcd_cam_obj->lcd.dma[(x + 1) % lcd_cam_obj->lcd.dma_node_cnt]; - } - lcd_cam_obj->lcd.dma[lcd_cam_obj->lcd.dma_half_node_cnt - 1].empty = (uint32_t)NULL; - lcd_cam_obj->lcd.dma[lcd_cam_obj->lcd.dma_node_cnt - 1].empty = (uint32_t)NULL; -} - -static void lcd_dma_set_left(lcd_cam_obj_t *lcd_cam_obj, int pos, size_t len) { - int end_pos = 0, size = 0; - // Processing data length is an integer multiple of lcd_cam_obj->lcd.dma_node_buffer_size - if (len % lcd_cam_obj->lcd.dma_node_buffer_size) { - end_pos = (pos % 2) * lcd_cam_obj->lcd.dma_half_node_cnt + len / lcd_cam_obj->lcd.dma_node_buffer_size; - size = len % lcd_cam_obj->lcd.dma_node_buffer_size; - } else { - end_pos = (pos % 2) * lcd_cam_obj->lcd.dma_half_node_cnt + len / lcd_cam_obj->lcd.dma_node_buffer_size - 1; - size = lcd_cam_obj->lcd.dma_node_buffer_size; - } - // Process the tail node to make it a DMA tail - lcd_cam_obj->lcd.dma[end_pos].size = size; - lcd_cam_obj->lcd.dma[end_pos].length = size; - lcd_cam_obj->lcd.dma[end_pos].eof = 1; - lcd_cam_obj->lcd.dma[end_pos].empty = (uint32_t)NULL; -} - -static void lcd_i2s_start(i2s_dev_t *i2s_dev, uint32_t addr, size_t len) { - while (!i2s_dev->state.tx_idle) { - ; - } - i2s_dev->conf.tx_reset = 1; - i2s_dev->conf.tx_reset = 0; - i2s_dev->conf.tx_fifo_reset = 1; - i2s_dev->conf.tx_fifo_reset = 0; - i2s_dev->out_link.addr = addr; - i2s_dev->out_link.start = 1; - ets_delay_us(1); - i2s_dev->conf.tx_start = 1; -} - -static void i2s_write_data(lcd_cam_obj_t *lcd_cam_obj, uint8_t *data, size_t len) { - int event = 0; - int x = 0, y = 0, left = 0, cnt = 0; - if (len <= 0) { - ESP_LOGE(TAG, "wrong len!"); - return; - } - lcd_dma_set_int(lcd_cam_obj); - cnt = len / lcd_cam_obj->lcd.dma_half_buffer_size; - // Start signal - xQueueSend(lcd_cam_obj->lcd.event_queue, &event, 0); - // Process a complete piece of data, ping-pong operation - for (x = 0; x < cnt; x++) { - uint8_t *out = (uint8_t *)lcd_cam_obj->lcd.dma[(x % 2) * lcd_cam_obj->lcd.dma_half_node_cnt].buf; - uint8_t *in = data; - if (lcd_cam_obj->lcd.swap_data) { - for (y = 0; y < lcd_cam_obj->lcd.dma_half_buffer_size; y += 2) { - out[y + 1] = in[y + 0]; - out[y + 0] = in[y + 1]; - } - } else { - memcpy(out, in, lcd_cam_obj->lcd.dma_half_buffer_size); - } - data += lcd_cam_obj->lcd.dma_half_buffer_size; - xQueueReceive(lcd_cam_obj->lcd.event_queue, (void *)&event, portMAX_DELAY); - lcd_i2s_start(lcd_cam_obj->i2s_dev, ((uint32_t)&lcd_cam_obj->lcd.dma[(x % 2) * lcd_cam_obj->lcd.dma_half_node_cnt]) & 0xfffff, lcd_cam_obj->lcd.dma_half_buffer_size); - } - left = len % lcd_cam_obj->lcd.dma_half_buffer_size; - // Process remaining incomplete segment data - if (left) { - uint8_t *out = (uint8_t *)lcd_cam_obj->lcd.dma[(x % 2) * lcd_cam_obj->lcd.dma_half_node_cnt].buf; - uint8_t *in = data; - cnt = left - left % 2; - if (cnt) { - if (lcd_cam_obj->lcd.swap_data) { - for (y = 0; y < cnt; y += 2) { - out[y + 1] = in[y + 0]; - out[y + 0] = in[y + 1]; - } - } else { - memcpy(out, in, cnt); - } - } - - if (left % 2) { - out[cnt] = in[cnt]; - } - lcd_dma_set_left(lcd_cam_obj, x, left); - xQueueReceive(lcd_cam_obj->lcd.event_queue, (void *)&event, portMAX_DELAY); - lcd_i2s_start(lcd_cam_obj->i2s_dev, ((uint32_t)&lcd_cam_obj->lcd.dma[(x % 2) * lcd_cam_obj->lcd.dma_half_node_cnt]) & 0xfffff, left); - } - xQueueReceive(lcd_cam_obj->lcd.event_queue, (void *)&event, portMAX_DELAY); -} - - -static esp_err_t i2s_lcd_reg_config(i2s_dev_t *i2s_dev, uint16_t data_width, uint32_t clk_freq) { - // Configure the clock - i2s_dev->clkm_conf.clkm_div_num = 2; // 160MHz / 2 = 80MHz - i2s_dev->clkm_conf.clkm_div_b = 0; - i2s_dev->clkm_conf.clkm_div_a = 0; - i2s_dev->clkm_conf.clk_sel = 2; // PLL_160M_CLK - i2s_dev->clkm_conf.clk_en = 1; - - i2s_dev->conf.val = 0; - i2s_dev->fifo_conf.val = 0; - i2s_dev->fifo_conf.dscr_en = 1; - - i2s_dev->lc_conf.ahbm_fifo_rst = 1; - i2s_dev->lc_conf.ahbm_fifo_rst = 0; - i2s_dev->lc_conf.ahbm_rst = 1; - i2s_dev->lc_conf.ahbm_rst = 0; - i2s_dev->lc_conf.check_owner = 0; - - i2s_dev->timing.val = 0; - - i2s_dev->int_ena.val = 0; - i2s_dev->int_clr.val = ~0; - - i2s_dev->conf2.lcd_en = 1; - - // Configure sampling rate - // The datasheet states that Fws = Fbck / (W*2), but empirically storing - // 1 in the register gives the highest value of 20MHz, storing 2 gives - // 10MHz, (and storing 0 causes a freeze instead of acting as though 64 was - // specified). - int div_num = (20000000 + clk_freq - 1) / clk_freq; - if (div_num == 0) { - div_num = 1; - } - if (div_num > 63) { - div_num = 63; - } - i2s_dev->sample_rate_conf.tx_bck_div_num = div_num; - i2s_dev->sample_rate_conf.tx_bits_mod = data_width; - // Configuration data format - - i2s_dev->conf.tx_right_first = 1; - i2s_dev->conf.tx_msb_right = 1; - i2s_dev->conf.tx_dma_equal = 1; - - i2s_dev->conf1.tx_pcm_bypass = 1; - i2s_dev->conf1.tx_stop_en = 1; - - i2s_dev->conf2.lcd_en = 1; - - i2s_dev->conf_chan.tx_chan_mod = 1; - - i2s_dev->fifo_conf.tx_fifo_mod_force_en = 1; - i2s_dev->fifo_conf.tx_data_num = 32; - i2s_dev->fifo_conf.tx_fifo_mod = 2; - i2s_dev->fifo_conf.tx_24msb_en = 0; - - i2s_dev->lc_conf.out_rst = 1; - i2s_dev->lc_conf.out_rst = 0; - - i2s_dev->int_ena.out_eof = 1; - - - return ESP_OK; -} - -static esp_err_t lcd_set_pin(const i2s_lcd_config_t *config) { - PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[config->pin_num_wr], PIN_FUNC_GPIO); - gpio_set_direction(config->pin_num_wr, GPIO_MODE_OUTPUT); - gpio_set_pull_mode(config->pin_num_wr, GPIO_FLOATING); - gpio_matrix_out(config->pin_num_wr, I2S0O_WS_OUT_IDX, true, false); - - for (int i = 0; i < config->data_width; i++) { - PIN_FUNC_SELECT(GPIO_PIN_MUX_REG[config->pin_data_num[i]], PIN_FUNC_GPIO); - gpio_set_direction(config->pin_data_num[i], GPIO_MODE_OUTPUT); - gpio_set_pull_mode(config->pin_data_num[i], GPIO_FLOATING); - // High bit aligned, OUT23 is always the highest bit - gpio_matrix_out(config->pin_data_num[i], I2S0O_DATA_OUT0_IDX + (LCD_DATA_MAX_WIDTH - config->data_width) + i, false, false); - } - - return ESP_OK; -} - -static esp_err_t lcd_dma_config(lcd_cam_obj_t *lcd_cam_obj, uint32_t max_dma_buffer_size) { - int cnt = 0; - if (LCD_CAM_DMA_NODE_BUFFER_MAX_SIZE % 2 != 0) { - ESP_LOGE(TAG, "ESP32 only supports 2-byte aligned data length"); - return ESP_FAIL; - } - if (max_dma_buffer_size >= LCD_CAM_DMA_NODE_BUFFER_MAX_SIZE * 2) { - lcd_cam_obj->lcd.dma_node_buffer_size = LCD_CAM_DMA_NODE_BUFFER_MAX_SIZE; - for (cnt = 0; cnt < max_dma_buffer_size - 8; cnt++) { // Find a buffer size that can divide dma_size - if ((max_dma_buffer_size - cnt) % (lcd_cam_obj->lcd.dma_node_buffer_size * 2) == 0) { - break; - } - } - lcd_cam_obj->lcd.dma_buffer_size = max_dma_buffer_size - cnt; - } else { - lcd_cam_obj->lcd.dma_node_buffer_size = max_dma_buffer_size / 2; - lcd_cam_obj->lcd.dma_buffer_size = lcd_cam_obj->lcd.dma_node_buffer_size * 2; - } - - lcd_cam_obj->lcd.dma_half_buffer_size = lcd_cam_obj->lcd.dma_buffer_size / 2; - lcd_cam_obj->lcd.dma_node_cnt = (lcd_cam_obj->lcd.dma_buffer_size) / lcd_cam_obj->lcd.dma_node_buffer_size; // Number of DMA nodes - lcd_cam_obj->lcd.dma_half_node_cnt = lcd_cam_obj->lcd.dma_node_cnt / 2; - - ESP_LOGI(TAG, "lcd_buffer_size: %d, lcd_dma_size: %d, lcd_dma_node_cnt: %d", lcd_cam_obj->lcd.dma_buffer_size, lcd_cam_obj->lcd.dma_node_buffer_size, lcd_cam_obj->lcd.dma_node_cnt); - - lcd_cam_obj->lcd.dma = (lldesc_t *)heap_caps_malloc(lcd_cam_obj->lcd.dma_node_cnt * sizeof(lldesc_t), MALLOC_CAP_DMA | MALLOC_CAP_8BIT); - lcd_cam_obj->lcd.dma_buffer = (uint8_t *)heap_caps_malloc(lcd_cam_obj->lcd.dma_buffer_size * sizeof(uint8_t), MALLOC_CAP_DMA | MALLOC_CAP_8BIT); - return ESP_OK; -} - -static esp_err_t lcd_cam_deinit(i2s_lcd_driver_t *drv) { - if (!drv->lcd_cam_obj) { - return ESP_FAIL; - } - - if (drv->lcd_cam_obj->lcd.event_queue) { - vQueueDelete(drv->lcd_cam_obj->lcd.event_queue); - } - if (drv->lcd_cam_obj->lcd.dma) { - heap_caps_free(drv->lcd_cam_obj->lcd.dma); - } - if (drv->lcd_cam_obj->lcd.dma_buffer) { - heap_caps_free(drv->lcd_cam_obj->lcd.dma_buffer); - } - - if (drv->lcd_cam_obj->lcd_cam_intr_handle) { - esp_intr_free(drv->lcd_cam_obj->lcd_cam_intr_handle); - } - - heap_caps_free(drv->lcd_cam_obj); - drv->lcd_cam_obj = NULL; - return ESP_OK; -} - -static esp_err_t lcd_cam_init(i2s_lcd_driver_t *drv, const i2s_lcd_config_t *config) { - esp_err_t ret = ESP_OK; - - lcd_cam_obj_t *lcd_cam_obj = (lcd_cam_obj_t *)heap_caps_calloc(1, sizeof(lcd_cam_obj_t), MALLOC_CAP_DMA); - if (lcd_cam_obj == NULL) { - ESP_LOGE(TAG, "lcd_cam object malloc error"); - return ESP_ERR_NO_MEM; - } - drv->lcd_cam_obj = lcd_cam_obj; - - if (I2S_NUM_0 == config->i2s_port) { - lcd_cam_obj->i2s_dev = &I2S0; - periph_module_enable(PERIPH_I2S0_MODULE); - } else { - ESP_LOGE(TAG, "Designated I2S peripheral not found"); - } - - ret |= i2s_lcd_reg_config(lcd_cam_obj->i2s_dev, config->data_width, config->clk_freq); - - if (ret != ESP_OK) { - ESP_LOGE(TAG, "lcd_cam config fail!"); - lcd_cam_deinit(drv); - return ESP_FAIL; - } - - ret |= lcd_set_pin(config); - ret |= lcd_dma_config(lcd_cam_obj, config->buffer_size); - - if (ret != ESP_OK) { - ESP_LOGE(TAG, "lcd config fail!"); - lcd_cam_deinit(drv); - return ESP_FAIL; - } - - lcd_cam_obj->lcd.event_queue = xQueueCreate(1, sizeof(int)); - lcd_cam_obj->lcd.width = config->data_width; - lcd_cam_obj->lcd.swap_data = config->swap_data; - - if (lcd_cam_obj->lcd.event_queue == NULL) { - ESP_LOGE(TAG, "lcd config fail!"); - lcd_cam_deinit(drv); - return ESP_FAIL; - } - - ret |= esp_intr_alloc(ETS_I2S0_INTR_SOURCE, ESP_INTR_FLAG_LOWMED | ESP_INTR_FLAG_IRAM, i2s_isr, lcd_cam_obj, &lcd_cam_obj->lcd_cam_intr_handle); - - if (ret != ESP_OK) { - ESP_LOGE(TAG, "lcd_cam intr alloc fail!"); - lcd_cam_deinit(drv); - return ESP_FAIL; - } - - ESP_LOGI(TAG, "lcd init ok"); - - return ESP_OK; -} - - -/**< Public functions */ - -i2s_lcd_handle_t i2s_lcd_driver_init(const i2s_lcd_config_t *config) { - I2S_CHECK(NULL != config, "config pointer invalid", NULL); - I2S_CHECK(GPIO_IS_VALID_GPIO(config->pin_num_wr), "GPIO WR invalid", NULL); - I2S_CHECK(GPIO_IS_VALID_GPIO(config->pin_num_rs), "GPIO RS invalid", NULL); - I2S_CHECK(config->data_width > 0 && config->data_width <= 16, "Bit width out of range", NULL); - I2S_CHECK(0 == (config->data_width % 8), "Bit width must be a multiple of 8", NULL); - uint64_t pin_mask = 0; - for (size_t i = 0; i < config->data_width; i++) { - uint64_t mask = 1ULL << config->pin_data_num[i]; - I2S_CHECK(!(pin_mask & mask), "Data bus GPIO has a duplicate", NULL); - I2S_CHECK(GPIO_IS_VALID_GPIO(config->pin_data_num[i]), "Data bus gpio invalid", NULL); - pin_mask |= mask; - } - - i2s_lcd_driver_t *i2s_lcd_drv = (i2s_lcd_driver_t *)heap_caps_malloc(sizeof(i2s_lcd_driver_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); - I2S_CHECK(NULL != i2s_lcd_drv, "Error malloc handle of i2s lcd driver", NULL); - - esp_err_t ret = lcd_cam_init(i2s_lcd_drv, config); - if (ESP_OK != ret) { - ESP_LOGE(TAG, "%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, "i2s lcd driver initialize failed"); - heap_caps_free(i2s_lcd_drv); - return NULL; - } - - i2s_lcd_drv->mutex = xSemaphoreCreateMutex(); - if (i2s_lcd_drv->mutex == NULL) { - ESP_LOGE(TAG, "%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, "lcd create mutex failed"); - lcd_cam_deinit(i2s_lcd_drv); - heap_caps_free(i2s_lcd_drv); - return NULL; - } - - if (config->pin_num_cs >= 0) { - gpio_pad_select_gpio(config->pin_num_cs); - gpio_set_direction(config->pin_num_cs, GPIO_MODE_OUTPUT); - gpio_set_level(config->pin_num_cs, 0); - } - - gpio_pad_select_gpio(config->pin_num_rs); - gpio_set_direction(config->pin_num_rs, GPIO_MODE_OUTPUT); - i2s_lcd_drv->rs_io_num = config->pin_num_rs; - return (i2s_lcd_handle_t)i2s_lcd_drv; -} - -esp_err_t i2s_lcd_driver_deinit(i2s_lcd_handle_t handle) { - i2s_lcd_driver_t *i2s_lcd_drv = (i2s_lcd_driver_t *)handle; - I2S_CHECK(NULL != i2s_lcd_drv, "handle pointer invalid", ESP_ERR_INVALID_ARG); - lcd_cam_deinit(i2s_lcd_drv); - vSemaphoreDelete(i2s_lcd_drv->mutex); - heap_caps_free(handle); - return ESP_OK; -} - -esp_err_t i2s_lcd_write_data(i2s_lcd_handle_t handle, uint16_t data) { - i2s_lcd_driver_t *i2s_lcd_drv = (i2s_lcd_driver_t *)handle; - I2S_CHECK(NULL != i2s_lcd_drv, "handle pointer invalid", ESP_ERR_INVALID_ARG); - i2s_write_data(i2s_lcd_drv->lcd_cam_obj, (uint8_t *)&data, 2); - return ESP_OK; -} - -esp_err_t i2s_lcd_write_cmd(i2s_lcd_handle_t handle, uint16_t cmd) { - i2s_lcd_driver_t *i2s_lcd_drv = (i2s_lcd_driver_t *)handle; - I2S_CHECK(NULL != i2s_lcd_drv, "handle pointer invalid", ESP_ERR_INVALID_ARG); - gpio_set_level(i2s_lcd_drv->rs_io_num, LCD_CMD_LEV); - i2s_write_data(i2s_lcd_drv->lcd_cam_obj, (uint8_t *)&cmd, 2); - gpio_set_level(i2s_lcd_drv->rs_io_num, LCD_DATA_LEV); - return ESP_OK; -} - -esp_err_t i2s_lcd_write(i2s_lcd_handle_t handle, const uint8_t *data, uint32_t length) { - i2s_lcd_driver_t *i2s_lcd_drv = (i2s_lcd_driver_t *)handle; - I2S_CHECK(NULL != i2s_lcd_drv, "handle pointer invalid", ESP_ERR_INVALID_ARG); - i2s_write_data(i2s_lcd_drv->lcd_cam_obj, (uint8_t *)data, length); - - return ESP_OK; -} - -esp_err_t i2s_lcd_acquire(i2s_lcd_handle_t handle) { - i2s_lcd_driver_t *i2s_lcd_drv = (i2s_lcd_driver_t *)handle; - I2S_CHECK(NULL != i2s_lcd_drv, "handle pointer invalid", ESP_ERR_INVALID_ARG); - BaseType_t ret = xSemaphoreTake(i2s_lcd_drv->mutex, portMAX_DELAY); - I2S_CHECK(pdTRUE == ret, "Take semaphore failed", ESP_FAIL); - return ESP_OK; -} - -bool i2s_lcd_acquire_nonblocking(i2s_lcd_handle_t handle, TickType_t ticks_to_wait) { - i2s_lcd_driver_t *i2s_lcd_drv = (i2s_lcd_driver_t *)handle; - return xSemaphoreTake(i2s_lcd_drv->mutex, ticks_to_wait); -} - -esp_err_t i2s_lcd_release(i2s_lcd_handle_t handle) { - i2s_lcd_driver_t *i2s_lcd_drv = (i2s_lcd_driver_t *)handle; - I2S_CHECK(NULL != i2s_lcd_drv, "handle pointer invalid", ESP_ERR_INVALID_ARG); - i2s_dev_t *i2s_dev = &I2S0; -// at this point, the DMA is done but there could still be data in the FIFO. so we need -// to wait for I2S_TX_IDLE so that it's safe e.g., for calling code to deassert CS - while (!i2s_dev->state.tx_idle) { - ; - } - BaseType_t ret = xSemaphoreGive(i2s_lcd_drv->mutex); - I2S_CHECK(pdTRUE == ret, "Give semaphore failed", ESP_FAIL); - return ESP_OK; -} - -#endif // CONFIG_IDF_TARGET_ESP32S2 diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 01cb22d39a..d3b55b5b42 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -45,6 +45,8 @@ CIRCUITPY_WIFI ?= 1 ifeq ($(IDF_TARGET),esp32) # Modules CIRCUITPY_BLEIO = 0 +CIRCUITPY_ESPULP = 0 +CIRCUITPY_MEMORYMAP = 0 CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_RGBMATRIX = 0 # Features diff --git a/ports/espressif/peripherals/i2c.c b/ports/espressif/peripherals/i2c.c index 7a85349f96..1f8565ca01 100644 --- a/ports/espressif/peripherals/i2c.c +++ b/ports/espressif/peripherals/i2c.c @@ -35,7 +35,7 @@ typedef enum { static i2c_status_t i2c_status[I2C_NUM_MAX]; void i2c_reset(void) { - for (i2c_port_t num = 0; num < I2C_NUM_MAX; num++) { + for (i2c_port_t num = 0; num < (int)I2C_NUM_MAX; num++) { if (i2c_status[num] == STATUS_IN_USE) { i2c_driver_delete(num); i2c_status[num] = STATUS_FREE; @@ -70,7 +70,7 @@ void peripherals_i2c_deinit(i2c_port_t num) { i2c_port_t peripherals_i2c_get_free_num(void) { i2c_port_t i2c_num = I2C_NUM_MAX; - for (i2c_port_t num = 0; num < I2C_NUM_MAX; num++) { + for (i2c_port_t num = 0; num < (int)I2C_NUM_MAX; num++) { if (i2c_status[num] == STATUS_FREE) { i2c_num = num; break; diff --git a/ports/espressif/peripherals/pins.h b/ports/espressif/peripherals/pins.h index 043bc8becc..911e5f271b 100644 --- a/ports/espressif/peripherals/pins.h +++ b/ports/espressif/peripherals/pins.h @@ -50,7 +50,7 @@ extern const mp_obj_type_t mcu_pin_type; #define NO_PIN (GPIO_NUM_NC) #define NO_ADC 0 -#define NO_ADC_CHANNEL ADC_CHANNEL_MAX +#define NO_ADC_CHANNEL SOC_ADC_MAX_CHANNEL_NUM #define NO_TOUCH_CHANNEL TOUCH_PAD_MAX diff --git a/ports/espressif/peripherals/rmt.h b/ports/espressif/peripherals/rmt.h index 24a4383789..08a446636e 100644 --- a/ports/espressif/peripherals/rmt.h +++ b/ports/espressif/peripherals/rmt.h @@ -27,9 +27,11 @@ #ifndef MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_RMT_H #define MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_RMT_H -#include "py/mphal.h" -#include "components/driver/include/driver/rmt.h" #include + +#include "py/mphal.h" +#include "driver/rmt.h" + #define TRANSMIT_MODE true #define RECEIVE_MODE false diff --git a/ports/espressif/peripherals/timer.h b/ports/espressif/peripherals/timer.h index c968b0f400..82dcc7838a 100644 --- a/ports/espressif/peripherals/timer.h +++ b/ports/espressif/peripherals/timer.h @@ -28,6 +28,7 @@ #define MICROPY_INCLUDED_ESPRESSIF_PERIPHERALS_TIMER_HANDLER_H #include "driver/timer.h" +#include "soc/timer_group_struct.h" typedef struct { timg_dev_t *hw; diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index 0224fe0073..2d2089a587 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -86,21 +86,20 @@ #include "esp_camera.h" #endif -#ifndef CONFIG_IDF_TARGET_ESP32 -#include "soc/cache_memory.h" -#endif - #include "soc/efuse_reg.h" #include "soc/rtc_cntl_reg.h" - -#include "esp_debug_helpers.h" +#include "soc/spi_pins.h" #include "bootloader_flash_config.h" + +#include "esp_debug_helpers.h" #include "esp_efuse.h" #include "esp_ipc.h" #include "esp_rom_efuse.h" +#include "esp_timer.h" #ifdef CONFIG_IDF_TARGET_ESP32 +#include "hal/efuse_hal.h" #include "esp32/rom/efuse.h" #endif @@ -187,7 +186,7 @@ static void _never_reset_spi_ram_flash(void) { if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5) { never_reset_pin_number(D2WD_PSRAM_CLK_IO); never_reset_pin_number(D2WD_PSRAM_CS_IO); - } else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4 && esp_efuse_get_chip_ver() >= 3) { + } else if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4 && efuse_hal_get_major_chip_version() >= 3) { // This chip is ESP32-PICO-V3 and doesn't have PSRAM. } else if ((pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2) || (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4)) { never_reset_pin_number(PICO_PSRAM_CLK_IO); diff --git a/ports/espressif/supervisor/usb.c b/ports/espressif/supervisor/usb.c index 61e6b5f09d..ad4c950333 100644 --- a/ports/espressif/supervisor/usb.c +++ b/ports/espressif/supervisor/usb.c @@ -35,8 +35,8 @@ #include "hal/usb_hal.h" #include "soc/usb_periph.h" -#include "components/driver/include/driver/gpio.h" -#include "components/driver/include/driver/periph_ctrl.h" +#include "driver/gpio.h" +#include "esp_private/periph_ctrl.h" #ifdef CONFIG_IDF_TARGET_ESP32C3 #include "components/esp_rom/include/esp32c3/rom/gpio.h" From 931ed7c6e5ee8f791dd1e22e3bfb672921057cff Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Fri, 6 Jan 2023 13:53:44 +0530 Subject: [PATCH 1662/1712] conditionally include `esp_psram` and fix sdkconfig --- ports/espressif/Makefile | 5 ++++- .../mpconfigboard.mk | 2 ++ .../adafruit_feather_esp32_v2/sdkconfig | 1 - .../adafruit_feather_esp32s2/mpconfigboard.mk | 2 ++ .../boards/adafruit_feather_esp32s2/sdkconfig | 2 -- .../mpconfigboard.mk | 2 ++ .../mpconfigboard.mk | 2 ++ .../adafruit_feather_esp32s2_tft/sdkconfig | 1 - .../sdkconfig | 5 +++++ .../mpconfigboard.mk | 3 +++ .../sdkconfig | 2 -- .../sdkconfig | 2 -- .../mpconfigboard.mk | 3 +++ .../adafruit_feather_esp32s3_tft/sdkconfig | 2 -- .../adafruit_feather_huzzah32/sdkconfig | 1 - .../boards/adafruit_funhouse/mpconfigboard.mk | 2 ++ .../boards/adafruit_funhouse/sdkconfig | 1 - .../mpconfigboard.mk | 2 ++ .../adafruit_magtag_2.9_grayscale/sdkconfig | 1 - .../adafruit_metro_esp32s2/mpconfigboard.mk | 2 ++ .../boards/adafruit_metro_esp32s2/sdkconfig | 1 - .../adafruit_qtpy_esp32_pico/mpconfigboard.mk | 2 ++ .../boards/adafruit_qtpy_esp32_pico/sdkconfig | 1 - .../adafruit_qtpy_esp32s2/mpconfigboard.mk | 2 ++ .../boards/adafruit_qtpy_esp32s2/sdkconfig | 1 - .../adafruit_qtpy_esp32s3_nopsram/sdkconfig | 2 -- .../mpconfigboard.mk | 2 ++ .../ai_thinker_esp_12k_nodemcu/sdkconfig | 1 - .../boards/artisense_rd00/mpconfigboard.mk | 2 ++ .../espressif/boards/artisense_rd00/sdkconfig | 1 - .../atmegazero_esp32s2/mpconfigboard.mk | 2 ++ .../boards/atmegazero_esp32s2/sdkconfig | 1 - .../boards/bpi_bit_s2/mpconfigboard.mk | 2 ++ ports/espressif/boards/bpi_bit_s2/sdkconfig | 1 - .../boards/bpi_leaf_s3/mpconfigboard.mk | 2 ++ ports/espressif/boards/bpi_leaf_s3/sdkconfig | 2 -- .../boards/bpi_picow_s3/mpconfigboard.mk | 2 ++ ports/espressif/boards/bpi_picow_s3/sdkconfig | 2 -- .../boards/crcibernetica-ideaboard/sdkconfig | 1 - .../crumpspace_crumps2/mpconfigboard.mk | 2 ++ .../boards/crumpspace_crumps2/sdkconfig | 1 - .../mpconfigboard.mk | 2 ++ .../cytron_maker_feather_aiot_s3/sdkconfig | 1 - .../boards/doit_esp32_devkit_v1/sdkconfig | 1 - .../boards/electroniccats_bastwifi/sdkconfig | 1 - .../espressif_esp32_eye/mpconfigboard.mk | 2 ++ .../boards/espressif_esp32_eye/sdkconfig | 2 -- .../mpconfigboard.mk | 2 ++ .../sdkconfig | 1 - .../mpconfigboard.mk | 2 ++ .../sdkconfig | 1 - .../espressif_esp32s3_box/mpconfigboard.mk | 2 ++ .../boards/espressif_esp32s3_box/sdkconfig | 22 +++++++++++++++++-- .../mpconfigboard.mk | 2 ++ .../espressif_esp32s3_box_lite/sdkconfig | 22 +++++++++++++++++-- .../espressif_esp32s3_devkitc_1_n8/sdkconfig | 1 - .../mpconfigboard.mk | 2 ++ .../sdkconfig | 2 -- .../mpconfigboard.mk | 2 ++ .../sdkconfig | 1 - .../espressif_esp32s3_devkitm_1_n8/sdkconfig | 1 - .../espressif_esp32s3_eye/mpconfigboard.mk | 2 ++ .../boards/espressif_esp32s3_eye/sdkconfig | 1 - .../espressif_esp32s3_usb_otg_n8/sdkconfig | 1 - .../espressif_hmi_devkit_1/mpconfigboard.mk | 2 ++ .../boards/espressif_hmi_devkit_1/sdkconfig | 1 - .../espressif_kaluga_1.3/mpconfigboard.mk | 2 ++ .../boards/espressif_kaluga_1.3/sdkconfig | 1 - .../espressif_kaluga_1/mpconfigboard.mk | 2 ++ .../boards/espressif_kaluga_1/sdkconfig | 1 - .../boards/espressif_saola_1_wroom/sdkconfig | 1 - .../espressif_saola_1_wrover/mpconfigboard.mk | 2 ++ .../boards/espressif_saola_1_wrover/sdkconfig | 1 - .../boards/franzininho_wifi_wroom/sdkconfig | 1 - .../franzininho_wifi_wrover/mpconfigboard.mk | 2 ++ .../boards/franzininho_wifi_wrover/sdkconfig | 1 - .../boards/gravitech_cucumber_m/sdkconfig | 1 - .../boards/gravitech_cucumber_ms/sdkconfig | 1 - .../gravitech_cucumber_r/mpconfigboard.mk | 2 ++ .../boards/gravitech_cucumber_r/sdkconfig | 1 - .../gravitech_cucumber_rs/mpconfigboard.mk | 2 ++ .../boards/gravitech_cucumber_rs/sdkconfig | 1 - .../hardkernel_odroid_go/mpconfigboard.mk | 2 ++ .../boards/hardkernel_odroid_go/sdkconfig | 1 - .../boards/hexky_s2/mpconfigboard.mk | 2 ++ ports/espressif/boards/hexky_s2/sdkconfig | 1 - .../boards/hiibot_iots2/mpconfigboard.mk | 2 ++ ports/espressif/boards/hiibot_iots2/sdkconfig | 2 -- .../lilygo_ttgo_t8_esp32_s2_wroom/sdkconfig | 1 - .../boards/lilygo_ttgo_t8_s2/mpconfigboard.mk | 2 ++ .../boards/lilygo_ttgo_t8_s2/sdkconfig | 1 - .../lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk | 2 ++ .../boards/lilygo_ttgo_t8_s2_st7789/sdkconfig | 1 - .../boards/lolin_s2_mini/mpconfigboard.mk | 2 ++ .../espressif/boards/lolin_s2_mini/sdkconfig | 1 - .../boards/lolin_s2_pico/mpconfigboard.mk | 2 ++ .../espressif/boards/lolin_s2_pico/sdkconfig | 1 - .../boards/lolin_s3/mpconfigboard.mk | 3 +++ ports/espressif/boards/lolin_s3/sdkconfig | 2 -- .../boards/m5stack_atom_echo/sdkconfig | 1 - .../boards/m5stack_atom_lite/sdkconfig | 1 - .../boards/m5stack_atom_matrix/sdkconfig | 1 - .../espressif/boards/m5stack_atom_u/sdkconfig | 1 - .../boards/m5stack_core_basic/sdkconfig | 1 - .../boards/m5stack_core_fire/mpconfigboard.mk | 2 ++ .../boards/m5stack_core_fire/sdkconfig | 1 - ports/espressif/boards/maker_badge/sdkconfig | 2 -- .../boards/microdev_micro_s2/mpconfigboard.mk | 2 ++ .../boards/microdev_micro_s2/sdkconfig | 1 - .../boards/mixgo_ce_serial/sdkconfig | 1 - .../espressif/boards/mixgo_ce_udisk/sdkconfig | 1 - .../boards/morpheans_morphesp-240/sdkconfig | 1 - .../muselab_nanoesp32_s2_wroom/sdkconfig | 1 - .../mpconfigboard.mk | 2 ++ .../muselab_nanoesp32_s2_wrover/sdkconfig | 2 -- .../odt_pixelwing_esp32_s2/mpconfigboard.mk | 2 ++ .../boards/odt_pixelwing_esp32_s2/sdkconfig | 1 - .../smartbeedesigns_bee_motion_s3/sdkconfig | 1 - .../boards/smartbeedesigns_bee_s3/sdkconfig | 1 - .../targett_module_clip_wroom/sdkconfig | 1 - .../mpconfigboard.mk | 2 ++ .../targett_module_clip_wrover/sdkconfig | 1 - .../mpconfigboard.mk | 2 ++ .../unexpectedmaker_feathers2/sdkconfig | 1 - .../mpconfigboard.mk | 2 ++ .../unexpectedmaker_feathers2_neo/sdkconfig | 1 - .../mpconfigboard.mk | 2 ++ .../sdkconfig | 1 - .../mpconfigboard.mk | 2 ++ .../unexpectedmaker_feathers3/sdkconfig | 1 - .../unexpectedmaker_pros3/mpconfigboard.mk | 2 ++ .../boards/unexpectedmaker_pros3/sdkconfig | 1 - .../unexpectedmaker_tinypico/mpconfigboard.mk | 2 ++ .../boards/unexpectedmaker_tinypico/sdkconfig | 1 - .../mpconfigboard.mk | 2 ++ .../unexpectedmaker_tinypico_nano/sdkconfig | 1 - .../unexpectedmaker_tinys2/mpconfigboard.mk | 2 ++ .../boards/unexpectedmaker_tinys2/sdkconfig | 1 - .../unexpectedmaker_tinys3/mpconfigboard.mk | 2 ++ .../boards/unexpectedmaker_tinys3/sdkconfig | 1 - .../mpconfigboard.mk | 2 ++ .../waveshare_esp32_s2_pico_lcd/sdkconfig | 1 - .../waveshare_esp32s2_pico/mpconfigboard.mk | 2 ++ ports/espressif/mpconfigport.mk | 3 +++ 144 files changed, 171 insertions(+), 99 deletions(-) create mode 100644 ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 6397a95e44..4cf27b47e3 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -395,7 +395,7 @@ ifeq ($(IDF_TARGET),esp32) BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/librtc.a endif -ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc esp_app_format esp_common esp_event esp_hw_support esp_netif esp_partition esp_phy esp_pm esp_psram esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant +ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc esp_app_format esp_common esp_event esp_hw_support esp_netif esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant ifneq ($(CIRCUITPY_BLEIO),0) ESP_IDF_COMPONENTS_LINK += bt BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libbtbb.a \ @@ -404,6 +404,9 @@ endif ifneq ($(CIRCUITPY_ESPULP),0) ESP_IDF_COMPONENTS_LINK += ulp endif +ifneq ($(CIRCUITPY_ESP_PSRAM_SIZE),0) + ESP_IDF_COMPONENTS_LINK += esp_psram +endif ifneq ($(CIRCUITPY_DOTCLOCKFRAMEBUFFER),0) ESP_IDF_COMPONENTS_LINK += esp_lcd endif diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.mk index 38d689d08a..554d64d1a1 100644 --- a/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 8MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig index c09d8c409a..0a81b10c16 100644 --- a/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32_SPIRAM_SUPPORT=y # SPI RAM config # # CONFIG_SPIRAM_TYPE_AUTO is not set diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.mk index 3ba91e62fd..ed6ae99976 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig index 37fd534249..05ba1165ce 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig @@ -4,8 +4,6 @@ # # ESP32S2-specific # -CONFIG_ESP32S2_SPIRAM_SUPPORT=y -# # SPI RAM config # # CONFIG_SPIRAM_TYPE_AUTO is not set diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk index 920b748e3d..cbe6bb2442 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk @@ -9,3 +9,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.mk index 4b559ff1ee..691480c790 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.mk @@ -9,3 +9,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2_tft/sdkconfig index f19afafa3d..1dd865e63c 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig new file mode 100644 index 0000000000..3525371bc7 --- /dev/null +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig @@ -0,0 +1,5 @@ +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif" +# end of LWIP diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk index 6d78999532..4f7eaab71e 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk @@ -9,4 +9,7 @@ CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB +OPTIMIZATION_FLAGS = -Os CIRCUITPY_ESPCAMERA = 0 + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig index 9a05ab0205..c57eb874f5 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig @@ -4,8 +4,6 @@ # # ESP32S3-Specific # -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# # SPI RAM config # CONFIG_SPIRAM_MODE_QUAD=y diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/sdkconfig index 9d924272ec..1a7d20d834 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/sdkconfig @@ -1,5 +1,3 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=n - # # LWIP # diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk index d801afd493..fdb5d8b5c0 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk @@ -10,4 +10,7 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB +OPTIMIZATION_FLAGS = -Os CIRCUITPY_ESPCAMERA = 0 + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig index 9a05ab0205..c57eb874f5 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig @@ -4,8 +4,6 @@ # # ESP32S3-Specific # -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# # SPI RAM config # CONFIG_SPIRAM_MODE_QUAD=y diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig b/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig index 6c0168c829..645ab76c47 100644 --- a/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig @@ -1,5 +1,4 @@ CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y -CONFIG_ESP32_SPIRAM_SUPPORT=n # Uncomment (remove ###) to send ESP_LOG output to TX/RX pins ### # diff --git a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk index 808154b78c..f2276ad9b6 100644 --- a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk @@ -13,3 +13,5 @@ CIRCUITPY_ESPCAMERA = 0 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/adafruit_funhouse/sdkconfig b/ports/espressif/boards/adafruit_funhouse/sdkconfig index f19afafa3d..1dd865e63c 100644 --- a/ports/espressif/boards/adafruit_funhouse/sdkconfig +++ b/ports/espressif/boards/adafruit_funhouse/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk index d941039078..06b5a1c68d 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk @@ -18,3 +18,5 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Text FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/sdkconfig b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/sdkconfig index f19afafa3d..1dd865e63c 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/sdkconfig +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk index 8f139315c8..5e77442d13 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/sdkconfig b/ports/espressif/boards/adafruit_metro_esp32s2/sdkconfig index 9ad9e6c3bb..7fc45aa53c 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/sdkconfig +++ b/ports/espressif/boards/adafruit_metro_esp32s2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.mk index de41053146..8d001428cc 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 8MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig index bec9e436b7..ac74f0f06c 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig +++ b/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig @@ -21,7 +21,6 @@ CONFIG_SPIRAM_CACHE_WORKAROUND=y # # SPI RAM config # -CONFIG_ESP32_SPIRAM_SUPPORT=y # CONFIG_SPIRAM_TYPE_AUTO is not set # CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set # CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.mk index f1bd7652fe..2285f8d594 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.mk @@ -9,3 +9,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s2/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32s2/sdkconfig index f19afafa3d..1dd865e63c 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s2/sdkconfig +++ b/ports/espressif/boards/adafruit_qtpy_esp32s2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/sdkconfig index 9d924272ec..1a7d20d834 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/sdkconfig +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/sdkconfig @@ -1,5 +1,3 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=n - # # LWIP # diff --git a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.mk b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.mk index 4ec2175eca..aef03973c0 100644 --- a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.mk +++ b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/sdkconfig b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/sdkconfig index 49ee336ed4..2f49953401 100644 --- a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/sdkconfig +++ b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/artisense_rd00/mpconfigboard.mk b/ports/espressif/boards/artisense_rd00/mpconfigboard.mk index 1011143972..8602034d4a 100644 --- a/ports/espressif/boards/artisense_rd00/mpconfigboard.mk +++ b/ports/espressif/boards/artisense_rd00/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/artisense_rd00/sdkconfig b/ports/espressif/boards/artisense_rd00/sdkconfig index cd57f0d118..9e0661d58c 100644 --- a/ports/espressif/boards/artisense_rd00/sdkconfig +++ b/ports/espressif/boards/artisense_rd00/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.mk b/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.mk index 53593be38b..b39623ae94 100644 --- a/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.mk +++ b/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/atmegazero_esp32s2/sdkconfig b/ports/espressif/boards/atmegazero_esp32s2/sdkconfig index b528b9f343..bbff53d4ea 100644 --- a/ports/espressif/boards/atmegazero_esp32s2/sdkconfig +++ b/ports/espressif/boards/atmegazero_esp32s2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/bpi_bit_s2/mpconfigboard.mk b/ports/espressif/boards/bpi_bit_s2/mpconfigboard.mk index 2c793ba5fb..6f9f3eeab7 100644 --- a/ports/espressif/boards/bpi_bit_s2/mpconfigboard.mk +++ b/ports/espressif/boards/bpi_bit_s2/mpconfigboard.mk @@ -11,3 +11,5 @@ CIRCUITPY_ESP_FLASH_SIZE=4MB # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/bpi_bit_s2/sdkconfig b/ports/espressif/boards/bpi_bit_s2/sdkconfig index 91758051d3..eae059c787 100644 --- a/ports/espressif/boards/bpi_bit_s2/sdkconfig +++ b/ports/espressif/boards/bpi_bit_s2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.mk b/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.mk index e2cd188059..42a5901d97 100644 --- a/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.mk +++ b/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.mk @@ -11,3 +11,5 @@ CIRCUITPY_ESP_FLASH_SIZE=8MB # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/bpi_leaf_s3/sdkconfig b/ports/espressif/boards/bpi_leaf_s3/sdkconfig index e9c767ea85..c7a8bab198 100644 --- a/ports/espressif/boards/bpi_leaf_s3/sdkconfig +++ b/ports/espressif/boards/bpi_leaf_s3/sdkconfig @@ -4,8 +4,6 @@ # # ESP32S3-Specific # -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# # SPI RAM config # CONFIG_SPIRAM_MODE_QUAD=y diff --git a/ports/espressif/boards/bpi_picow_s3/mpconfigboard.mk b/ports/espressif/boards/bpi_picow_s3/mpconfigboard.mk index 6d77a94b08..36aa247870 100644 --- a/ports/espressif/boards/bpi_picow_s3/mpconfigboard.mk +++ b/ports/espressif/boards/bpi_picow_s3/mpconfigboard.mk @@ -18,3 +18,5 @@ CIRCUITPY_ESP_FLASH_SIZE = 8MB # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/bpi_picow_s3/sdkconfig b/ports/espressif/boards/bpi_picow_s3/sdkconfig index 04ab118924..9d42f33f56 100644 --- a/ports/espressif/boards/bpi_picow_s3/sdkconfig +++ b/ports/espressif/boards/bpi_picow_s3/sdkconfig @@ -4,8 +4,6 @@ # # ESP32S3-Specific # -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# # SPI RAM config # CONFIG_SPIRAM_MODE_QUAD=y diff --git a/ports/espressif/boards/crcibernetica-ideaboard/sdkconfig b/ports/espressif/boards/crcibernetica-ideaboard/sdkconfig index 6c0168c829..645ab76c47 100644 --- a/ports/espressif/boards/crcibernetica-ideaboard/sdkconfig +++ b/ports/espressif/boards/crcibernetica-ideaboard/sdkconfig @@ -1,5 +1,4 @@ CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y -CONFIG_ESP32_SPIRAM_SUPPORT=n # Uncomment (remove ###) to send ESP_LOG output to TX/RX pins ### # diff --git a/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.mk b/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.mk index aca5950f9d..871f68c452 100644 --- a/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.mk +++ b/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.mk @@ -13,3 +13,5 @@ CIRCUITPY_BITBANG_APA102 = 1 # Include these Python libraries in firmware. # FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/crumpspace_crumps2/sdkconfig b/ports/espressif/boards/crumpspace_crumps2/sdkconfig index 94158d85c5..af05b7fbf2 100644 --- a/ports/espressif/boards/crumpspace_crumps2/sdkconfig +++ b/ports/espressif/boards/crumpspace_crumps2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.mk b/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.mk index 53e9750463..a37170ba67 100644 --- a/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.mk +++ b/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.mk @@ -11,3 +11,5 @@ CIRCUITPY_ESP_FLASH_SIZE = 8MB # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/cytron_maker_feather_aiot_s3/sdkconfig b/ports/espressif/boards/cytron_maker_feather_aiot_s3/sdkconfig index f508f4a67c..e7c5b643b2 100644 --- a/ports/espressif/boards/cytron_maker_feather_aiot_s3/sdkconfig +++ b/ports/espressif/boards/cytron_maker_feather_aiot_s3/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/doit_esp32_devkit_v1/sdkconfig b/ports/espressif/boards/doit_esp32_devkit_v1/sdkconfig index 6c0168c829..645ab76c47 100644 --- a/ports/espressif/boards/doit_esp32_devkit_v1/sdkconfig +++ b/ports/espressif/boards/doit_esp32_devkit_v1/sdkconfig @@ -1,5 +1,4 @@ CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y -CONFIG_ESP32_SPIRAM_SUPPORT=n # Uncomment (remove ###) to send ESP_LOG output to TX/RX pins ### # diff --git a/ports/espressif/boards/electroniccats_bastwifi/sdkconfig b/ports/espressif/boards/electroniccats_bastwifi/sdkconfig index 5b9c86dcc3..3525371bc7 100644 --- a/ports/espressif/boards/electroniccats_bastwifi/sdkconfig +++ b/ports/espressif/boards/electroniccats_bastwifi/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.mk index e29ca687c6..c59c277d45 100644 --- a/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 0MB diff --git a/ports/espressif/boards/espressif_esp32_eye/sdkconfig b/ports/espressif/boards/espressif_esp32_eye/sdkconfig index 26db1e8087..0e53c6bbd1 100644 --- a/ports/espressif/boards/espressif_esp32_eye/sdkconfig +++ b/ports/espressif/boards/espressif_esp32_eye/sdkconfig @@ -7,8 +7,6 @@ # # ESP32-specific # -CONFIG_ESP32_SPIRAM_SUPPORT=y -# # SPI RAM config # CONFIG_SPIRAM_TYPE_AUTO=y diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk index aef3ce0dc7..874a1341a4 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/sdkconfig b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/sdkconfig index 926a7813ba..8c82c9c70d 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.mk index 883df304f4..ce2b45ccd3 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE=dio CIRCUITPY_ESP_FLASH_FREQ=40m CIRCUITPY_ESP_FLASH_SIZE=8MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig index 926a7813ba..8c82c9c70d 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk index 5a2a4794bd..fbacf3fa3a 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk @@ -9,4 +9,6 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 16MB +CIRCUITPY_ESP_PSRAM_SIZE = 8MB + CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_box/sdkconfig b/ports/espressif/boards/espressif_esp32s3_box/sdkconfig index 6884299abe..99432b359a 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_box/sdkconfig @@ -1,11 +1,29 @@ CONFIG_ESP32S3_SPIRAM_SUPPORT=y CONFIG_SPIRAM=y CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_SPEED_80M=y -CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +# end of SPI RAM config +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y # # LWIP diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk index a4bd29fa52..4da1ab8ed3 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk @@ -9,4 +9,6 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 16MB +CIRCUITPY_ESP_PSRAM_SIZE = 8MB + CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig index 6884299abe..99432b359a 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig @@ -1,11 +1,29 @@ CONFIG_ESP32S3_SPIRAM_SUPPORT=y CONFIG_SPIRAM=y CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_SPEED_80M=y -CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y +CONFIG_SPIRAM_SIZE=8388608 +# end of SPI RAM config +CONFIG_DEFAULT_PSRAM_CLK_IO=30 +# +# PSRAM Clock and CS IO for ESP32S3 +# +CONFIG_DEFAULT_PSRAM_CS_IO=26 +# end of PSRAM Clock and CS IO for ESP32S3 + +# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set +# CONFIG_SPIRAM_RODATA is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM=y CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set CONFIG_SPIRAM_USE_MEMMAP=y +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +# CONFIG_SPIRAM_USE_MALLOC is not set +CONFIG_SPIRAM_MEMTEST=y # # LWIP diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/sdkconfig index a0a61d8392..1a7d20d834 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S3_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.mk index 7d5afe9a9f..cd531b902f 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig index 3e366f0172..3a99cc3c44 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig @@ -4,8 +4,6 @@ # # ESP32S3-Specific # -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# # SPI RAM config # CONFIG_SPIRAM_MODE_QUAD=y diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.mk index 95fa2d0324..08ad0aee90 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/sdkconfig index f508f4a67c..e7c5b643b2 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/sdkconfig index a0a61d8392..1a7d20d834 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S3_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.mk index 4711f28aaf..3d57e485ae 100644 --- a/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig b/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig index 1a24832767..18eca34cb2 100644 --- a/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/sdkconfig index a0a61d8392..1a7d20d834 100644 --- a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S3_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.mk b/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.mk index 60ff9fd5a1..8ce04357bf 100644 --- a/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/espressif_hmi_devkit_1/sdkconfig b/ports/espressif/boards/espressif_hmi_devkit_1/sdkconfig index f19afafa3d..1dd865e63c 100644 --- a/ports/espressif/boards/espressif_hmi_devkit_1/sdkconfig +++ b/ports/espressif/boards/espressif_hmi_devkit_1/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.mk b/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.mk index 23578067ac..975189924d 100644 --- a/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/espressif_kaluga_1.3/sdkconfig b/ports/espressif/boards/espressif_kaluga_1.3/sdkconfig index f19afafa3d..1dd865e63c 100644 --- a/ports/espressif/boards/espressif_kaluga_1.3/sdkconfig +++ b/ports/espressif/boards/espressif_kaluga_1.3/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.mk b/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.mk index 23578067ac..975189924d 100644 --- a/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/espressif_kaluga_1/sdkconfig b/ports/espressif/boards/espressif_kaluga_1/sdkconfig index f19afafa3d..1dd865e63c 100644 --- a/ports/espressif/boards/espressif_kaluga_1/sdkconfig +++ b/ports/espressif/boards/espressif_kaluga_1/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/espressif_saola_1_wroom/sdkconfig b/ports/espressif/boards/espressif_saola_1_wroom/sdkconfig index 5b9c86dcc3..3525371bc7 100644 --- a/ports/espressif/boards/espressif_saola_1_wroom/sdkconfig +++ b/ports/espressif/boards/espressif_saola_1_wroom/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.mk b/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.mk index 5156a5b6ce..a31c4d7498 100644 --- a/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/espressif_saola_1_wrover/sdkconfig b/ports/espressif/boards/espressif_saola_1_wrover/sdkconfig index f19afafa3d..1dd865e63c 100644 --- a/ports/espressif/boards/espressif_saola_1_wrover/sdkconfig +++ b/ports/espressif/boards/espressif_saola_1_wrover/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/franzininho_wifi_wroom/sdkconfig b/ports/espressif/boards/franzininho_wifi_wroom/sdkconfig index 5b9c86dcc3..3525371bc7 100644 --- a/ports/espressif/boards/franzininho_wifi_wroom/sdkconfig +++ b/ports/espressif/boards/franzininho_wifi_wroom/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.mk b/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.mk index 2a09bc99eb..d9c04b8b6c 100644 --- a/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.mk +++ b/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/franzininho_wifi_wrover/sdkconfig b/ports/espressif/boards/franzininho_wifi_wrover/sdkconfig index f19afafa3d..1dd865e63c 100644 --- a/ports/espressif/boards/franzininho_wifi_wrover/sdkconfig +++ b/ports/espressif/boards/franzininho_wifi_wrover/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/gravitech_cucumber_m/sdkconfig b/ports/espressif/boards/gravitech_cucumber_m/sdkconfig index 7b07033d7b..af73f6d885 100644 --- a/ports/espressif/boards/gravitech_cucumber_m/sdkconfig +++ b/ports/espressif/boards/gravitech_cucumber_m/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/gravitech_cucumber_ms/sdkconfig b/ports/espressif/boards/gravitech_cucumber_ms/sdkconfig index b31dd447e1..cbdd787aa7 100644 --- a/ports/espressif/boards/gravitech_cucumber_ms/sdkconfig +++ b/ports/espressif/boards/gravitech_cucumber_ms/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.mk b/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.mk index d3e40f2df6..aa06644643 100644 --- a/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.mk +++ b/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/gravitech_cucumber_r/sdkconfig b/ports/espressif/boards/gravitech_cucumber_r/sdkconfig index fe0857c4fb..41e00d746a 100644 --- a/ports/espressif/boards/gravitech_cucumber_r/sdkconfig +++ b/ports/espressif/boards/gravitech_cucumber_r/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.mk b/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.mk index e0b3f35d44..f7b0cb2390 100644 --- a/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.mk +++ b/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/gravitech_cucumber_rs/sdkconfig b/ports/espressif/boards/gravitech_cucumber_rs/sdkconfig index 23b3eea78d..45f96a6600 100644 --- a/ports/espressif/boards/gravitech_cucumber_rs/sdkconfig +++ b/ports/espressif/boards/gravitech_cucumber_rs/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk b/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk index ead48189fa..76817b1cee 100644 --- a/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk +++ b/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 4MB diff --git a/ports/espressif/boards/hardkernel_odroid_go/sdkconfig b/ports/espressif/boards/hardkernel_odroid_go/sdkconfig index f4fea0c732..45da77ed9f 100644 --- a/ports/espressif/boards/hardkernel_odroid_go/sdkconfig +++ b/ports/espressif/boards/hardkernel_odroid_go/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32_SPIRAM_SUPPORT=y # SPI RAM config # # CONFIG_SPIRAM_TYPE_AUTO is not set diff --git a/ports/espressif/boards/hexky_s2/mpconfigboard.mk b/ports/espressif/boards/hexky_s2/mpconfigboard.mk index 043dec5824..d6809e5c01 100644 --- a/ports/espressif/boards/hexky_s2/mpconfigboard.mk +++ b/ports/espressif/boards/hexky_s2/mpconfigboard.mk @@ -11,3 +11,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/hexky_s2/sdkconfig b/ports/espressif/boards/hexky_s2/sdkconfig index f19afafa3d..1dd865e63c 100644 --- a/ports/espressif/boards/hexky_s2/sdkconfig +++ b/ports/espressif/boards/hexky_s2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/hiibot_iots2/mpconfigboard.mk b/ports/espressif/boards/hiibot_iots2/mpconfigboard.mk index a60d894665..411275a1ba 100644 --- a/ports/espressif/boards/hiibot_iots2/mpconfigboard.mk +++ b/ports/espressif/boards/hiibot_iots2/mpconfigboard.mk @@ -9,3 +9,5 @@ CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 8MB #CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/hiibot_iots2/sdkconfig b/ports/espressif/boards/hiibot_iots2/sdkconfig index 5ef7020a72..1120f8099f 100644 --- a/ports/espressif/boards/hiibot_iots2/sdkconfig +++ b/ports/espressif/boards/hiibot_iots2/sdkconfig @@ -1,5 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y - # # SPI RAM config # diff --git a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/sdkconfig index 5b9c86dcc3..3525371bc7 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/sdkconfig +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk index e7d70c671a..2bfc8fb2c8 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig index 8c401a6ff3..9e7a21dee3 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk index 865dbe2661..e9e333d497 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig index 8c401a6ff3..9e7a21dee3 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/lolin_s2_mini/mpconfigboard.mk b/ports/espressif/boards/lolin_s2_mini/mpconfigboard.mk index 24f88d9abf..a3bbcaf2a5 100644 --- a/ports/espressif/boards/lolin_s2_mini/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s2_mini/mpconfigboard.mk @@ -12,3 +12,5 @@ CIRCUITPY_ESP_FLASH_SIZE = 4MB # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/lolin_s2_mini/sdkconfig b/ports/espressif/boards/lolin_s2_mini/sdkconfig index deb0dadcb9..a6ec1f0078 100644 --- a/ports/espressif/boards/lolin_s2_mini/sdkconfig +++ b/ports/espressif/boards/lolin_s2_mini/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/lolin_s2_pico/mpconfigboard.mk b/ports/espressif/boards/lolin_s2_pico/mpconfigboard.mk index bf946a483f..5b027e6732 100644 --- a/ports/espressif/boards/lolin_s2_pico/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s2_pico/mpconfigboard.mk @@ -12,3 +12,5 @@ CIRCUITPY_ESP_FLASH_SIZE = 4MB # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/lolin_s2_pico/sdkconfig b/ports/espressif/boards/lolin_s2_pico/sdkconfig index 5ce352a98d..b090e8f7e2 100644 --- a/ports/espressif/boards/lolin_s2_pico/sdkconfig +++ b/ports/espressif/boards/lolin_s2_pico/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/lolin_s3/mpconfigboard.mk b/ports/espressif/boards/lolin_s3/mpconfigboard.mk index 56b42a419c..a377fb0b56 100644 --- a/ports/espressif/boards/lolin_s3/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s3/mpconfigboard.mk @@ -9,4 +9,7 @@ CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB +OPTIMIZATION_FLAGS = -Os CIRCUITPY_ESPCAMERA = 0 + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/lolin_s3/sdkconfig b/ports/espressif/boards/lolin_s3/sdkconfig index 23d005edd9..975a05bfc2 100644 --- a/ports/espressif/boards/lolin_s3/sdkconfig +++ b/ports/espressif/boards/lolin_s3/sdkconfig @@ -4,8 +4,6 @@ # # ESP32S3-Specific # -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# # SPI RAM config # CONFIG_SPIRAM_MODE_QUAD=y diff --git a/ports/espressif/boards/m5stack_atom_echo/sdkconfig b/ports/espressif/boards/m5stack_atom_echo/sdkconfig index 3879222bab..c86eaa11fe 100644 --- a/ports/espressif/boards/m5stack_atom_echo/sdkconfig +++ b/ports/espressif/boards/m5stack_atom_echo/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32_SPIRAM_SUPPORT=n # CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # diff --git a/ports/espressif/boards/m5stack_atom_lite/sdkconfig b/ports/espressif/boards/m5stack_atom_lite/sdkconfig index 8a9fb07019..50e85a6afe 100644 --- a/ports/espressif/boards/m5stack_atom_lite/sdkconfig +++ b/ports/espressif/boards/m5stack_atom_lite/sdkconfig @@ -1,5 +1,4 @@ CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y -CONFIG_ESP32_SPIRAM_SUPPORT=n # CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # diff --git a/ports/espressif/boards/m5stack_atom_matrix/sdkconfig b/ports/espressif/boards/m5stack_atom_matrix/sdkconfig index 474a760b56..55e5bd3a94 100644 --- a/ports/espressif/boards/m5stack_atom_matrix/sdkconfig +++ b/ports/espressif/boards/m5stack_atom_matrix/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32_SPIRAM_SUPPORT=n # CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # diff --git a/ports/espressif/boards/m5stack_atom_u/sdkconfig b/ports/espressif/boards/m5stack_atom_u/sdkconfig index 90c99459a8..9d47d05b4f 100644 --- a/ports/espressif/boards/m5stack_atom_u/sdkconfig +++ b/ports/espressif/boards/m5stack_atom_u/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32_SPIRAM_SUPPORT=n # CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # diff --git a/ports/espressif/boards/m5stack_core_basic/sdkconfig b/ports/espressif/boards/m5stack_core_basic/sdkconfig index a4cedd8e81..44896d5883 100644 --- a/ports/espressif/boards/m5stack_core_basic/sdkconfig +++ b/ports/espressif/boards/m5stack_core_basic/sdkconfig @@ -1,5 +1,4 @@ CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y -CONFIG_ESP32_SPIRAM_SUPPORT=n CONFIG_ESP32_REV_MIN_3=y # CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set diff --git a/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk b/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk index 82e462012c..50e57c1c3c 100644 --- a/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk @@ -7,3 +7,5 @@ CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESPCAMERA = 0 + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/m5stack_core_fire/sdkconfig b/ports/espressif/boards/m5stack_core_fire/sdkconfig index d77fe64525..f228750600 100644 --- a/ports/espressif/boards/m5stack_core_fire/sdkconfig +++ b/ports/espressif/boards/m5stack_core_fire/sdkconfig @@ -1,5 +1,4 @@ CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y -CONFIG_ESP32_SPIRAM_SUPPORT=y CONFIG_ESP32_REV_MIN_3=y # diff --git a/ports/espressif/boards/maker_badge/sdkconfig b/ports/espressif/boards/maker_badge/sdkconfig index 68689ed79e..8af8e2c9d2 100644 --- a/ports/espressif/boards/maker_badge/sdkconfig +++ b/ports/espressif/boards/maker_badge/sdkconfig @@ -1,5 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=n - # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="Maker_badge" diff --git a/ports/espressif/boards/microdev_micro_s2/mpconfigboard.mk b/ports/espressif/boards/microdev_micro_s2/mpconfigboard.mk index e5a7f05462..226d901a3a 100644 --- a/ports/espressif/boards/microdev_micro_s2/mpconfigboard.mk +++ b/ports/espressif/boards/microdev_micro_s2/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/microdev_micro_s2/sdkconfig b/ports/espressif/boards/microdev_micro_s2/sdkconfig index 4b617fee71..5d4c11ef15 100644 --- a/ports/espressif/boards/microdev_micro_s2/sdkconfig +++ b/ports/espressif/boards/microdev_micro_s2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/mixgo_ce_serial/sdkconfig b/ports/espressif/boards/mixgo_ce_serial/sdkconfig index 5b9c86dcc3..3525371bc7 100644 --- a/ports/espressif/boards/mixgo_ce_serial/sdkconfig +++ b/ports/espressif/boards/mixgo_ce_serial/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/mixgo_ce_udisk/sdkconfig b/ports/espressif/boards/mixgo_ce_udisk/sdkconfig index 5b9c86dcc3..3525371bc7 100644 --- a/ports/espressif/boards/mixgo_ce_udisk/sdkconfig +++ b/ports/espressif/boards/mixgo_ce_udisk/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/morpheans_morphesp-240/sdkconfig b/ports/espressif/boards/morpheans_morphesp-240/sdkconfig index 6de15d1556..55199905be 100644 --- a/ports/espressif/boards/morpheans_morphesp-240/sdkconfig +++ b/ports/espressif/boards/morpheans_morphesp-240/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/sdkconfig b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/sdkconfig index 5b9c86dcc3..3525371bc7 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/sdkconfig +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.mk b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.mk index f008241e19..2071da3fed 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.mk +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/sdkconfig b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/sdkconfig index 9b513fcf5a..ec22fcdb44 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/sdkconfig +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/sdkconfig @@ -1,5 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y - # # SPI RAM config # diff --git a/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.mk b/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.mk index 44546fc09f..26722a30ea 100644 --- a/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.mk +++ b/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/odt_pixelwing_esp32_s2/sdkconfig b/ports/espressif/boards/odt_pixelwing_esp32_s2/sdkconfig index 17c1995cd3..9268947220 100644 --- a/ports/espressif/boards/odt_pixelwing_esp32_s2/sdkconfig +++ b/ports/espressif/boards/odt_pixelwing_esp32_s2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/sdkconfig b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/sdkconfig index 84cf45aa83..8457338560 100644 --- a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/sdkconfig +++ b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S3_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/smartbeedesigns_bee_s3/sdkconfig b/ports/espressif/boards/smartbeedesigns_bee_s3/sdkconfig index b7bb11fdd5..6eda3c0adb 100644 --- a/ports/espressif/boards/smartbeedesigns_bee_s3/sdkconfig +++ b/ports/espressif/boards/smartbeedesigns_bee_s3/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S3_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/targett_module_clip_wroom/sdkconfig b/ports/espressif/boards/targett_module_clip_wroom/sdkconfig index 5b9c86dcc3..3525371bc7 100644 --- a/ports/espressif/boards/targett_module_clip_wroom/sdkconfig +++ b/ports/espressif/boards/targett_module_clip_wroom/sdkconfig @@ -1,4 +1,3 @@ -# CONFIG_ESP32S2_SPIRAM_SUPPORT is not set # # LWIP # diff --git a/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.mk b/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.mk index 6ef620ac50..2fd0d3e909 100644 --- a/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.mk +++ b/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/targett_module_clip_wrover/sdkconfig b/ports/espressif/boards/targett_module_clip_wrover/sdkconfig index f19afafa3d..1dd865e63c 100644 --- a/ports/espressif/boards/targett_module_clip_wrover/sdkconfig +++ b/ports/espressif/boards/targett_module_clip_wrover/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.mk index 1d48ea1076..2d6c60b5e2 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.mk @@ -13,3 +13,5 @@ CIRCUITPY_BITBANG_APA102 = 1 # Include these Python libraries in firmware. # FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/unexpectedmaker_feathers2/sdkconfig b/ports/espressif/boards/unexpectedmaker_feathers2/sdkconfig index 8d785a6004..bb19189a5c 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_feathers2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.mk index 2b78e51635..e72ee2f6cd 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.mk @@ -13,3 +13,5 @@ CIRCUITPY_BITBANG_NEOPIXEL = 1 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_neo/sdkconfig b/ports/espressif/boards/unexpectedmaker_feathers2_neo/sdkconfig index 4a5990b91d..c336cdb290 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_neo/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_feathers2_neo/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.mk index 1d48ea1076..2d6c60b5e2 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.mk @@ -13,3 +13,5 @@ CIRCUITPY_BITBANG_APA102 = 1 # Include these Python libraries in firmware. # FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/sdkconfig b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/sdkconfig index 8d785a6004..bb19189a5c 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.mk index 666185b6fd..cb8a4124f3 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.mk @@ -13,3 +13,5 @@ CIRCUITPY_ESP_FLASH_SIZE = 16MB # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig b/ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig index ec989c08fc..0c8ea2c5ec 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # # SPI RAM config diff --git a/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.mk index bf6e7a5105..26e59a8edd 100644 --- a/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.mk @@ -13,3 +13,5 @@ CIRCUITPY_ESP_FLASH_SIZE = 16MB # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/unexpectedmaker_pros3/sdkconfig b/ports/espressif/boards/unexpectedmaker_pros3/sdkconfig index eeb103fb7d..1a228e03d0 100644 --- a/ports/espressif/boards/unexpectedmaker_pros3/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_pros3/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # # SPI RAM config diff --git a/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.mk index e26981465b..61d34359dd 100644 --- a/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/unexpectedmaker_tinypico/sdkconfig b/ports/espressif/boards/unexpectedmaker_tinypico/sdkconfig index 2d4d0d4ecc..6f14e60fc1 100644 --- a/ports/espressif/boards/unexpectedmaker_tinypico/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_tinypico/sdkconfig @@ -6,7 +6,6 @@ # CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set CONFIG_SPIRAM_TYPE_ESPPSRAM64=y # CONFIG_SPIRAM_SIZE is not set -CONFIG_ESP32_SPIRAM_SUPPORT=y CONFIG_SPIRAM_SPEED_80M=y CONFIG_SPIRAM=y CONFIG_SPIRAM_BOOT_INIT=y diff --git a/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.mk index f3d9ea4c92..68879b1cd3 100644 --- a/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/unexpectedmaker_tinypico_nano/sdkconfig b/ports/espressif/boards/unexpectedmaker_tinypico_nano/sdkconfig index 2d4d0d4ecc..6f14e60fc1 100644 --- a/ports/espressif/boards/unexpectedmaker_tinypico_nano/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_tinypico_nano/sdkconfig @@ -6,7 +6,6 @@ # CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set CONFIG_SPIRAM_TYPE_ESPPSRAM64=y # CONFIG_SPIRAM_SIZE is not set -CONFIG_ESP32_SPIRAM_SUPPORT=y CONFIG_SPIRAM_SPEED_80M=y CONFIG_SPIRAM=y CONFIG_SPIRAM_BOOT_INIT=y diff --git a/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.mk index 39a9c38b36..eec4bc1bbf 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.mk @@ -15,3 +15,5 @@ CIRCUITPY_STAGE = 1 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/unexpectedmaker_tinys2/sdkconfig b/ports/espressif/boards/unexpectedmaker_tinys2/sdkconfig index 8539cb7519..d3c9bace86 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys2/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_tinys2/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.mk index 716a45b5ca..a66db4d19d 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.mk @@ -15,3 +15,5 @@ CIRCUITPY_STAGE = 1 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig b/ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig index 0ac438450d..15249009ea 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # # SPI RAM config diff --git a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.mk b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.mk index e65760ec68..a6b9c35b52 100644 --- a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.mk +++ b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.mk @@ -9,3 +9,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE=dio CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig index 836fd46764..cf10a34d5b 100644 --- a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig +++ b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # diff --git a/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk b/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk index 2db911fb26..7e4fdbb3c2 100644 --- a/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk +++ b/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index d3b55b5b42..6f2b730e36 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -7,6 +7,9 @@ INTERNAL_LIBM = 1 # Longints can be implemented as mpz, as longlong, or not LONGINT_IMPL = MPZ +# Default to no-psram +CIRCUITPY_ESP_PSRAM_SIZE ?= 0 + # Enable more features CIRCUITPY_FULL_BUILD ?= 1 From 7b9c87e43239425f572b823d60c2d19adb1cd2d7 Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Thu, 2 Mar 2023 11:48:42 +0530 Subject: [PATCH 1663/1712] update espressif ble sdkconfig --- .../esp-idf-config/sdkconfig-ble.defaults | 164 +----------------- 1 file changed, 8 insertions(+), 156 deletions(-) diff --git a/ports/espressif/esp-idf-config/sdkconfig-ble.defaults b/ports/espressif/esp-idf-config/sdkconfig-ble.defaults index 8180786fbf..a2ff691212 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-ble.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-ble.defaults @@ -1,164 +1,16 @@ -# -# Component config -# -# -# Bluetooth +# This file was generated using idf.py save-defconfig. It can be edited manually. +# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration # CONFIG_BT_ENABLED=y -# -# Bluetooth controller -# -CONFIG_BT_CTRL_MODE_EFF=1 -CONFIG_BT_CTRL_BLE_MAX_ACT=10 -CONFIG_BT_CTRL_BLE_MAX_ACT_EFF=10 -CONFIG_BT_CTRL_BLE_STATIC_ACL_TX_BUF_NB=0 -CONFIG_BT_CTRL_PINNED_TO_CORE=0 -CONFIG_BT_CTRL_HCI_MODE_VHCI=y -# CONFIG_BT_CTRL_HCI_MODE_UART_H4 is not set -CONFIG_BT_CTRL_HCI_TL=1 -CONFIG_BT_CTRL_ADV_DUP_FILT_MAX=30 -# CONFIG_BT_CTRL_HW_CCA is not set -CONFIG_BT_CTRL_HW_CCA_VAL=20 -CONFIG_BT_CTRL_HW_CCA_EFF=0 -CONFIG_BT_CTRL_CE_LENGTH_TYPE_ORIG=y -# CONFIG_BT_CTRL_CE_LENGTH_TYPE_CE is not set -# CONFIG_BT_CTRL_CE_LENGTH_TYPE_SD is not set -CONFIG_BT_CTRL_CE_LENGTH_TYPE_EFF=0 -CONFIG_BT_CTRL_TX_ANTENNA_INDEX_0=y -# CONFIG_BT_CTRL_TX_ANTENNA_INDEX_1 is not set -CONFIG_BT_CTRL_TX_ANTENNA_INDEX_EFF=0 -CONFIG_BT_CTRL_RX_ANTENNA_INDEX_0=y -# CONFIG_BT_CTRL_RX_ANTENNA_INDEX_1 is not set -CONFIG_BT_CTRL_RX_ANTENNA_INDEX_EFF=0 -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N27 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N24 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N21 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N18 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N15 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N12 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N9 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N6 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N3 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_N0 is not set -CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P3=y -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P6 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P9 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P12 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P15 is not set -# CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_P18 is not set -CONFIG_BT_CTRL_DFT_TX_POWER_LEVEL_EFF=10 -CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_SUPP=y -CONFIG_BT_CTRL_BLE_ADV_REPORT_FLOW_CTRL_NUM=100 -CONFIG_BT_CTRL_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 -# CONFIG_BT_CTRL_BLE_SCAN_DUPL is not set -# CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EN is not set -CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_DIS=y -CONFIG_BT_CTRL_COEX_PHY_CODED_TX_RX_TLIM_EFF=0 -# -# MODEM SLEEP Options -# -# CONFIG_BT_CTRL_MODEM_SLEEP is not set -# end of MODEM SLEEP Options - -CONFIG_BT_CTRL_SLEEP_MODE_EFF=0 -CONFIG_BT_CTRL_SLEEP_CLOCK_EFF=0 -CONFIG_BT_CTRL_HCI_TL_EFF=1 -# CONFIG_BT_CTRL_AGC_RECORRECT_EN is not set -# end of Bluetooth controller - -# CONFIG_BT_BLUEDROID_ENABLED is not set CONFIG_BT_NIMBLE_ENABLED=y -# CONFIG_BT_CONTROLLER_ONLY is not set -# -# NimBLE Options -# -CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_INTERNAL=y -# CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_DEFAULT is not set -# CONFIG_BT_NIMBLE_LOG_LEVEL_NONE is not set -# CONFIG_BT_NIMBLE_LOG_LEVEL_ERROR is not set -# CONFIG_BT_NIMBLE_LOG_LEVEL_WARNING is not set -CONFIG_BT_NIMBLE_LOG_LEVEL_INFO=y -# CONFIG_BT_NIMBLE_LOG_LEVEL_DEBUG is not set -CONFIG_BT_NIMBLE_LOG_LEVEL=1 -CONFIG_BT_NIMBLE_MAX_CONNECTIONS=3 -CONFIG_BT_NIMBLE_MAX_BONDS=3 -CONFIG_BT_NIMBLE_MAX_CCCDS=8 -CONFIG_BT_NIMBLE_L2CAP_COC_MAX_NUM=0 -CONFIG_BT_NIMBLE_TASK_STACK_SIZE=4096 -CONFIG_BT_NIMBLE_ROLE_CENTRAL=y -CONFIG_BT_NIMBLE_ROLE_PERIPHERAL=y -CONFIG_BT_NIMBLE_ROLE_BROADCASTER=y -CONFIG_BT_NIMBLE_ROLE_OBSERVER=y + +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y + CONFIG_BT_NIMBLE_NVS_PERSIST=y -CONFIG_BT_NIMBLE_SM_LEGACY=y -CONFIG_BT_NIMBLE_SM_SC=y -# CONFIG_BT_NIMBLE_DEBUG is not set -# CONFIG_BT_NIMBLE_SM_SC_DEBUG_KEYS is not set -CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME="nimble" -CONFIG_BT_NIMBLE_GAP_DEVICE_NAME_MAX_LEN=31 -CONFIG_BT_NIMBLE_ATT_PREFERRED_MTU=256 -CONFIG_BT_NIMBLE_SVC_GAP_APPEARANCE=0 + CONFIG_BT_NIMBLE_ACL_BUF_COUNT=20 -CONFIG_BT_NIMBLE_ACL_BUF_SIZE=255 CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 -CONFIG_BT_NIMBLE_HCI_EVT_HI_BUF_COUNT=30 -CONFIG_BT_NIMBLE_HCI_EVT_LO_BUF_COUNT=8 -CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT=12 -# CONFIG_BT_NIMBLE_HS_FLOW_CTRL is not set -CONFIG_BT_NIMBLE_RPA_TIMEOUT=900 -# CONFIG_BT_NIMBLE_MESH is not set -CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS=y -CONFIG_BT_NIMBLE_HS_STOP_TIMEOUT_MS=2000 -# CONFIG_BT_NIMBLE_HOST_BASED_PRIVACY is not set -CONFIG_BT_NIMBLE_ENABLE_CONN_REATTEMPT=y -CONFIG_BT_NIMBLE_MAX_CONN_REATTEMPT=3 + CONFIG_BT_NIMBLE_EXT_ADV=y -CONFIG_BT_NIMBLE_MAX_EXT_ADV_INSTANCES=1 -CONFIG_BT_NIMBLE_MAX_EXT_ADV_DATA_LEN=1650 -CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV=y -CONFIG_BT_NIMBLE_MAX_PERIODIC_SYNCS=1 -# CONFIG_BT_NIMBLE_BLUFI_ENABLE is not set -CONFIG_BT_NIMBLE_USE_ESP_TIMER=y -# end of NimBLE Options -# end of Bluetooth - -# end of Component config - -# -# Deprecated options for backward compatibility -# -# CONFIG_BLUEDROID_ENABLED is not set -CONFIG_NIMBLE_ENABLED=y -CONFIG_NIMBLE_MEM_ALLOC_MODE_INTERNAL=y -# CONFIG_NIMBLE_MEM_ALLOC_MODE_DEFAULT is not set -CONFIG_NIMBLE_MAX_CONNECTIONS=3 -CONFIG_NIMBLE_MAX_BONDS=3 -CONFIG_NIMBLE_MAX_CCCDS=8 -CONFIG_NIMBLE_L2CAP_COC_MAX_NUM=0 -CONFIG_NIMBLE_TASK_STACK_SIZE=4096 -CONFIG_NIMBLE_ROLE_CENTRAL=y -CONFIG_NIMBLE_ROLE_PERIPHERAL=y -CONFIG_NIMBLE_ROLE_BROADCASTER=y -CONFIG_NIMBLE_ROLE_OBSERVER=y -CONFIG_NIMBLE_NVS_PERSIST=y -CONFIG_NIMBLE_SM_LEGACY=y -CONFIG_NIMBLE_SM_SC=y -# CONFIG_NIMBLE_DEBUG is not set -# CONFIG_NIMBLE_SM_SC_DEBUG_KEYS is not set -CONFIG_NIMBLE_SVC_GAP_DEVICE_NAME="nimble" -CONFIG_NIMBLE_GAP_DEVICE_NAME_MAX_LEN=31 -CONFIG_NIMBLE_ATT_PREFERRED_MTU=256 -CONFIG_NIMBLE_SVC_GAP_APPEARANCE=0 -CONFIG_NIMBLE_ACL_BUF_COUNT=20 -CONFIG_NIMBLE_ACL_BUF_SIZE=255 -CONFIG_NIMBLE_HCI_EVT_BUF_SIZE=70 -CONFIG_NIMBLE_HCI_EVT_HI_BUF_COUNT=30 -CONFIG_NIMBLE_HCI_EVT_LO_BUF_COUNT=8 -CONFIG_NIMBLE_MSYS1_BLOCK_COUNT=12 -# CONFIG_NIMBLE_HS_FLOW_CTRL is not set -CONFIG_NIMBLE_RPA_TIMEOUT=900 -# CONFIG_NIMBLE_MESH is not set -CONFIG_NIMBLE_CRYPTO_STACK_MBEDTLS=y -CONFIG_SW_COEXIST_ENABLE=y -# end of Deprecated options for backward compatibility +CONFIG_BT_CTRL_BLE_SCAN_DUPL=n From 242a720593285aad911ca504a07bbfd2500f16e3 Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Thu, 2 Mar 2023 11:50:12 +0530 Subject: [PATCH 1664/1712] fix psram crash --- ports/espressif/common-hal/espidf/__init__.c | 10 +--------- .../espressif/esp-idf-config/sdkconfig-debug.defaults | 2 +- ports/espressif/esp-idf-config/sdkconfig.defaults | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/ports/espressif/common-hal/espidf/__init__.c b/ports/espressif/common-hal/espidf/__init__.c index bbf60f9dc3..a45964054d 100644 --- a/ports/espressif/common-hal/espidf/__init__.c +++ b/ports/espressif/common-hal/espidf/__init__.c @@ -44,7 +44,6 @@ #else #define esp_himem_reserved_area_size() (0) #endif -bool ok_to_reserve_psram = true; size_t reserved_psram = DEFAULT_RESERVED_PSRAM; #endif @@ -63,9 +62,6 @@ bool common_hal_espidf_set_reserved_psram(size_t amount) { if (!esp_psram_is_initialized()) { return false; } - if (!ok_to_reserve_psram) { - return false; - } if (amount > psram_size_usable()) { return false; } @@ -113,11 +109,7 @@ size_t common_hal_espidf_get_total_psram(void) { intptr_t common_hal_espidf_get_psram_start(void) { #ifdef CONFIG_SPIRAM if (esp_psram_is_initialized()) { - #ifdef CONFIG_IDF_TARGET_ESP32 return SOC_EXTRAM_DATA_LOW; - #else - return SOC_EXTRAM_DATA_HIGH - psram_size_usable(); - #endif } #endif return 0; @@ -126,7 +118,7 @@ intptr_t common_hal_espidf_get_psram_start(void) { intptr_t common_hal_espidf_get_psram_end(void) { #ifdef CONFIG_SPIRAM if (esp_psram_is_initialized()) { - return common_hal_espidf_get_psram_start() + psram_size_usable(); + return SOC_EXTRAM_DATA_LOW + psram_size_usable(); } #endif return 0; diff --git a/ports/espressif/esp-idf-config/sdkconfig-debug.defaults b/ports/espressif/esp-idf-config/sdkconfig-debug.defaults index bef5ee5fe8..69f4d43289 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-debug.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-debug.defaults @@ -61,7 +61,7 @@ CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y # Hardware Abstraction Layer (HAL) and Low Level (LL) # # CONFIG_HAL_ASSERTION_DISABLE is not set -# CONFIG_HAL_ASSERTION_SILIENT is not set +# CONFIG_HAL_ASSERTION_SILENT is not set # CONFIG_HAL_ASSERTION_ENABLE is not set CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 # end of Hardware Abstraction Layer (HAL) and Low Level (LL) diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index a7bcc25081..c3c32a1fa3 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -6,7 +6,7 @@ CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_ESP_IPC_TASK_STACK_SIZE=1536 CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384 -CONFIG_ESP_TASK_WDT=n +CONFIG_ESP_TASK_WDT_INIT=n CONFIG_ESP_TLS_SERVER=y From c38972b51ce6f1e2c9f3b57ddd0f1269a9b94824 Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Thu, 2 Mar 2023 15:38:58 +0530 Subject: [PATCH 1665/1712] update ulp implementation --- ports/espressif/Makefile | 2 +- ports/espressif/common-hal/espulp/ULP.c | 45 ++++++++++++++----- ports/espressif/common-hal/espulp/ULPAlarm.c | 16 ++++--- .../esp-idf-config/sdkconfig-esp32s2.defaults | 1 - .../esp-idf-config/sdkconfig-esp32s3.defaults | 1 - ports/espressif/mpconfigport.mk | 2 - 6 files changed, 44 insertions(+), 23 deletions(-) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 4cf27b47e3..3a92d0b9b6 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -104,7 +104,7 @@ INC += \ -isystem esp-idf/components/soc/include \ -isystem esp-idf/components/soc/$(IDF_TARGET)/include \ -isystem esp-idf/components/spi_flash/include \ - -isystem esp-idf/components/ulp/include \ + -isystem esp-idf/components/ulp/ulp_fsm/include \ -isystem esp-idf/components/ulp/ulp_riscv/include \ -isystem esp-idf/components/ulp/ulp_common/include \ -isystem esp-idf/components/ulp/ulp_common/include/$(IDF_TARGET) \ diff --git a/ports/espressif/common-hal/espulp/ULP.c b/ports/espressif/common-hal/espulp/ULP.c index e8400d77e7..2af3142ff2 100644 --- a/ports/espressif/common-hal/espulp/ULP.c +++ b/ports/espressif/common-hal/espulp/ULP.c @@ -90,16 +90,18 @@ void common_hal_espulp_ulp_run(espulp_ulp_obj_t *self, uint32_t *program, size_t ulp_set_wakeup_period(0, 20000); switch (self->arch) { + #ifdef CONFIG_ULP_COPROC_TYPE_FSM case FSM: ulp_load_binary(0, (const uint8_t *)program, length); ulp_run(0); break; + #endif + #ifdef CONFIG_ULP_COPROC_TYPE_RISCV case RISCV: - #ifndef CONFIG_IDF_TARGET_ESP32 ulp_riscv_load_binary((const uint8_t *)program, length); ulp_riscv_run(); break; - #endif + #endif default: mp_raise_NotImplementedError(NULL); break; @@ -107,12 +109,23 @@ void common_hal_espulp_ulp_run(espulp_ulp_obj_t *self, uint32_t *program, size_t } void common_hal_espulp_ulp_halt(espulp_ulp_obj_t *self) { - #ifdef CONFIG_IDF_TARGET_ESP32 - mp_raise_NotImplementedError(NULL); - #else - ulp_riscv_timer_stop(); - ulp_riscv_halt(); - #endif + switch (self->arch) { + /* + #ifdef CONFIG_ULP_COPROC_TYPE_FSM + case FSM: + break; + #endif + */ + #ifdef CONFIG_ULP_COPROC_TYPE_RISCV + case RISCV: + ulp_riscv_timer_stop(); + ulp_riscv_halt(); + break; + #endif + default: + mp_raise_NotImplementedError(NULL); + break; + } // Release pins we were using. for (uint8_t i = 0; i < 32; i++) { @@ -130,11 +143,19 @@ void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self, espulp_architecture mp_raise_ValueError_varg(translate("%q in use"), MP_QSTR_ULP); } - #ifdef CONFIG_IDF_TARGET_ESP32 - if (self->arch == RISCV) { - mp_raise_NotImplementedError(NULL); + switch (self->arch) { + #ifdef CONFIG_ULP_COPROC_TYPE_FSM + case FSM: + break; + #endif + #ifdef CONFIG_ULP_COPROC_TYPE_RISCV + case RISCV: + break; + #endif + default: + mp_raise_NotImplementedError(NULL); + break; } - #endif self->arch = arch; self->inited = true; diff --git a/ports/espressif/common-hal/espulp/ULPAlarm.c b/ports/espressif/common-hal/espulp/ULPAlarm.c index f6c3de66b7..798d86ce29 100644 --- a/ports/espressif/common-hal/espulp/ULPAlarm.c +++ b/ports/espressif/common-hal/espulp/ULPAlarm.c @@ -81,20 +81,22 @@ void espulp_ulpalarm_set_alarm(const bool deep_sleep, const size_t n_alarms, con // enable ulp interrupt switch (alarm->ulp->arch) { + #ifdef CONFIG_ULP_COPROC_TYPE_FSM case FSM: #ifdef CONFIG_IDF_TARGET_ESP32 - rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_ULP_CP_INT_RAW); + rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_ULP_CP_INT_RAW, 0); #else - rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_ULP_CP_INT_ST); + rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_ULP_CP_INT_ST, 0); #endif REG_SET_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_ULP_CP_INT_ENA); break; + #endif + #ifdef CONFIG_ULP_COPROC_TYPE_RISCV case RISCV: - #ifndef CONFIG_IDF_TARGET_ESP32 - rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_COCPU_INT_ST); + rtc_isr_register(&ulp_interrupt, NULL, RTC_CNTL_COCPU_INT_ST, 0); REG_SET_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_COCPU_INT_ENA); break; - #endif + #endif default: mp_raise_NotImplementedError(NULL); break; @@ -110,8 +112,10 @@ void espulp_ulpalarm_prepare_for_deep_sleep(void) { // disable ulp interrupt rtc_isr_deregister(&ulp_interrupt, NULL); + #ifdef CONFIG_ULP_COPROC_TYPE_FSM REG_CLR_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_ULP_CP_INT_ENA); - #ifndef CONFIG_IDF_TARGET_ESP32 + #endif + #ifdef CONFIG_ULP_COPROC_TYPE_RISCV REG_CLR_BIT(RTC_CNTL_INT_ENA_REG, RTC_CNTL_COCPU_INT_ENA); #endif diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults index 6bcded2a0d..527ab89e58 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults @@ -7,5 +7,4 @@ CONFIG_ESP32S2_DATA_CACHE_16KB=y CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM=y CONFIG_ULP_COPROC_ENABLED=y -CONFIG_ULP_COPROC_TYPE_RISCV=y CONFIG_ULP_COPROC_RESERVE_MEM=8176 diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults index 30dea89201..747d2ba729 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults @@ -8,5 +8,4 @@ CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1=y CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM=y CONFIG_ULP_COPROC_ENABLED=y -CONFIG_ULP_COPROC_TYPE_RISCV=y CONFIG_ULP_COPROC_RESERVE_MEM=8176 diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 6f2b730e36..52399b1640 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -48,8 +48,6 @@ CIRCUITPY_WIFI ?= 1 ifeq ($(IDF_TARGET),esp32) # Modules CIRCUITPY_BLEIO = 0 -CIRCUITPY_ESPULP = 0 -CIRCUITPY_MEMORYMAP = 0 CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_RGBMATRIX = 0 # Features From 02da5ca22f6c1dea3a875ff14c841487015a315e Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Thu, 2 Mar 2023 15:42:45 +0530 Subject: [PATCH 1666/1712] update espressif ci --- .github/actions/deps/external/action.yml | 6 +----- requirements-dev.txt | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/actions/deps/external/action.yml b/.github/actions/deps/external/action.yml index a26579b53d..2d6f65eeff 100644 --- a/.github/actions/deps/external/action.yml +++ b/.github/actions/deps/external/action.yml @@ -37,11 +37,7 @@ runs: - name: Install IDF tools if: inputs.port == 'espressif' run: | - echo "Installing ESP-IDF tools" - $IDF_PATH/tools/idf_tools.py --non-interactive install required - $IDF_PATH/tools/idf_tools.py --non-interactive install cmake - echo "Installing Python environment and packages" - $IDF_PATH/tools/idf_tools.py --non-interactive install-python-env + $IDF_PATH/install.sh rm -rf $IDF_TOOLS_PATH/dist shell: bash - name: Set environment diff --git a/requirements-dev.txt b/requirements-dev.txt index 5efa084652..7d5766ec5a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -25,7 +25,8 @@ intelhex pyelftools # for mbedtls certificate store -cryptography +# version limit due to espressif +cryptography<36.1,>=2.1.4 # for web workflow minify minify_html From 8feb3bad29960d69fcba7e4a05cbab4b71f9456b Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Thu, 2 Mar 2023 17:15:57 +0530 Subject: [PATCH 1667/1712] refactor board config files --- .../boards/adafruit_feather_esp32s2/sdkconfig | 4 ++-- .../adafruit_feather_esp32s2_reverse_tft/sdkconfig | 5 ++--- .../boards/adafruit_feather_esp32s2_tft/sdkconfig | 4 ++-- .../sdkconfig | 4 ++-- .../mpconfigboard.mk | 1 + .../adafruit_feather_esp32s3_reverse_tft/sdkconfig | 11 ++--------- .../boards/adafruit_feather_esp32s3_tft/sdkconfig | 4 ++-- ports/espressif/boards/adafruit_funhouse/sdkconfig | 4 ++-- .../boards/adafruit_huzzah32_breakout/sdkconfig | 1 - .../boards/adafruit_magtag_2.9_grayscale/sdkconfig | 4 ++-- .../espressif/boards/adafruit_metro_esp32s2/sdkconfig | 4 ++-- .../espressif/boards/adafruit_qtpy_esp32s2/sdkconfig | 4 ++-- .../boards/ai_thinker_esp_12k_nodemcu/sdkconfig | 4 ++-- ports/espressif/boards/artisense_rd00/sdkconfig | 4 ++-- ports/espressif/boards/atmegazero_esp32s2/sdkconfig | 4 ++-- ports/espressif/boards/bpi_bit_s2/sdkconfig | 4 ++-- ports/espressif/boards/bpi_leaf_s3/sdkconfig | 4 ++-- ports/espressif/boards/bpi_picow_s3/sdkconfig | 4 ++-- .../boards/brainboardz_neuron/mpconfigboard.mk | 8 +++++--- ports/espressif/boards/brainboardz_neuron/sdkconfig | 5 ++--- ports/espressif/boards/crumpspace_crumps2/sdkconfig | 4 ++-- .../boards/cytron_maker_feather_aiot_s3/sdkconfig | 4 ++-- ports/espressif/boards/deneyap_mini_v2/sdkconfig | 4 ++-- .../boards/espressif_esp32_lyrat/mpconfigboard.mk | 2 ++ .../espressif/boards/espressif_esp32_lyrat/sdkconfig | 1 - .../boards/espressif_esp32s2_devkitc_1_n4r2/sdkconfig | 4 ++-- .../boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig | 4 ++-- .../espressif/boards/espressif_esp32s3_box/sdkconfig | 4 ++-- .../boards/espressif_esp32s3_box_lite/sdkconfig | 4 ++-- .../mpconfigboard.mk | 8 +++++--- .../espressif_esp32s3_devkitc_1_n32r8/sdkconfig | 5 ++--- .../boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig | 4 ++-- .../boards/espressif_esp32s3_devkitc_1_n8r8/sdkconfig | 4 ++-- .../espressif/boards/espressif_esp32s3_eye/sdkconfig | 4 ++-- .../espressif/boards/espressif_hmi_devkit_1/sdkconfig | 4 ++-- ports/espressif/boards/espressif_kaluga_1.3/sdkconfig | 4 ++-- ports/espressif/boards/espressif_kaluga_1/sdkconfig | 4 ++-- .../boards/espressif_saola_1_wrover/sdkconfig | 4 ++-- .../boards/franzininho_wifi_wrover/sdkconfig | 4 ++-- ports/espressif/boards/gravitech_cucumber_r/sdkconfig | 4 ++-- .../espressif/boards/gravitech_cucumber_rs/sdkconfig | 4 ++-- ports/espressif/boards/hexky_s2/sdkconfig | 4 ++-- ports/espressif/boards/hiibot_iots2/sdkconfig | 4 ++-- .../boards/lilygo_tembed_esp32s3/mpconfigboard.mk | 2 ++ .../espressif/boards/lilygo_tembed_esp32s3/sdkconfig | 5 ++--- ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig | 4 ++-- .../boards/lilygo_ttgo_t8_s2_st7789/sdkconfig | 4 ++-- ports/espressif/boards/lolin_s2_mini/sdkconfig | 4 ++-- ports/espressif/boards/lolin_s2_pico/sdkconfig | 4 ++-- ports/espressif/boards/lolin_s3/sdkconfig | 4 ++-- ports/espressif/boards/m5stack_stick_c/sdkconfig | 3 --- ports/espressif/boards/microdev_micro_s2/sdkconfig | 4 ++-- .../boards/muselab_nanoesp32_s2_wrover/sdkconfig | 4 ++-- .../espressif/boards/odt_pixelwing_esp32_s2/sdkconfig | 4 ++-- .../boards/targett_module_clip_wrover/sdkconfig | 4 ++-- .../boards/unexpectedmaker_feathers2/sdkconfig | 4 ++-- .../boards/unexpectedmaker_feathers2_neo/sdkconfig | 4 ++-- .../unexpectedmaker_feathers2_prerelease/sdkconfig | 4 ++-- .../boards/unexpectedmaker_feathers3/sdkconfig | 4 ++-- .../espressif/boards/unexpectedmaker_pros3/sdkconfig | 4 ++-- .../espressif/boards/unexpectedmaker_tinys2/sdkconfig | 4 ++-- .../espressif/boards/unexpectedmaker_tinys3/sdkconfig | 4 ++-- .../boards/waveshare_esp32_s2_pico_lcd/sdkconfig | 4 ++-- .../espressif/boards/waveshare_esp32s2_pico/sdkconfig | 4 ++-- 64 files changed, 127 insertions(+), 134 deletions(-) diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig index 05ba1165ce..0d9f0ca518 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig @@ -14,8 +14,8 @@ CONFIG_SPIRAM_SIZE=2097152 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig index f19afafa3d..d151cecdfb 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # # SPI RAM config # @@ -9,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2_tft/sdkconfig index 1dd865e63c..d151cecdfb 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig index c57eb874f5..5d5860b546 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig @@ -16,8 +16,8 @@ CONFIG_SPIRAM_SIZE=2097152 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk index d027443f56..1f9a938a4a 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk @@ -11,3 +11,4 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESPCAMERA = 0 +CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/sdkconfig index 9a05ab0205..abdca6408c 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/sdkconfig @@ -1,11 +1,4 @@ # -# Component config -# -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# # SPI RAM config # CONFIG_SPIRAM_MODE_QUAD=y @@ -18,8 +11,8 @@ CONFIG_SPIRAM_SIZE=2097152 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig index c57eb874f5..5d5860b546 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig @@ -16,8 +16,8 @@ CONFIG_SPIRAM_SIZE=2097152 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/adafruit_funhouse/sdkconfig b/ports/espressif/boards/adafruit_funhouse/sdkconfig index 1dd865e63c..d151cecdfb 100644 --- a/ports/espressif/boards/adafruit_funhouse/sdkconfig +++ b/ports/espressif/boards/adafruit_funhouse/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/adafruit_huzzah32_breakout/sdkconfig b/ports/espressif/boards/adafruit_huzzah32_breakout/sdkconfig index 6c0168c829..645ab76c47 100644 --- a/ports/espressif/boards/adafruit_huzzah32_breakout/sdkconfig +++ b/ports/espressif/boards/adafruit_huzzah32_breakout/sdkconfig @@ -1,5 +1,4 @@ CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y -CONFIG_ESP32_SPIRAM_SUPPORT=n # Uncomment (remove ###) to send ESP_LOG output to TX/RX pins ### # diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/sdkconfig b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/sdkconfig index 1dd865e63c..d151cecdfb 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/sdkconfig +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/sdkconfig b/ports/espressif/boards/adafruit_metro_esp32s2/sdkconfig index 7fc45aa53c..1113345a50 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/sdkconfig +++ b/ports/espressif/boards/adafruit_metro_esp32s2/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s2/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32s2/sdkconfig index 1dd865e63c..d151cecdfb 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s2/sdkconfig +++ b/ports/espressif/boards/adafruit_qtpy_esp32s2/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/sdkconfig b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/sdkconfig index 2f49953401..eacb2e75aa 100644 --- a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/sdkconfig +++ b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/artisense_rd00/sdkconfig b/ports/espressif/boards/artisense_rd00/sdkconfig index 9e0661d58c..f776ea85a1 100644 --- a/ports/espressif/boards/artisense_rd00/sdkconfig +++ b/ports/espressif/boards/artisense_rd00/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/atmegazero_esp32s2/sdkconfig b/ports/espressif/boards/atmegazero_esp32s2/sdkconfig index bbff53d4ea..6fa27c4eb2 100644 --- a/ports/espressif/boards/atmegazero_esp32s2/sdkconfig +++ b/ports/espressif/boards/atmegazero_esp32s2/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/bpi_bit_s2/sdkconfig b/ports/espressif/boards/bpi_bit_s2/sdkconfig index eae059c787..7f9c6f5138 100644 --- a/ports/espressif/boards/bpi_bit_s2/sdkconfig +++ b/ports/espressif/boards/bpi_bit_s2/sdkconfig @@ -10,11 +10,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/bpi_leaf_s3/sdkconfig b/ports/espressif/boards/bpi_leaf_s3/sdkconfig index c7a8bab198..ee0414205d 100644 --- a/ports/espressif/boards/bpi_leaf_s3/sdkconfig +++ b/ports/espressif/boards/bpi_leaf_s3/sdkconfig @@ -16,8 +16,8 @@ CONFIG_SPIRAM_SIZE=2097152 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/bpi_picow_s3/sdkconfig b/ports/espressif/boards/bpi_picow_s3/sdkconfig index 9d42f33f56..6a97d1351c 100644 --- a/ports/espressif/boards/bpi_picow_s3/sdkconfig +++ b/ports/espressif/boards/bpi_picow_s3/sdkconfig @@ -16,8 +16,8 @@ CONFIG_SPIRAM_SIZE=2097152 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk index 1083b18264..05a5eb3367 100755 --- a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk +++ b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk @@ -6,6 +6,8 @@ USB_MANUFACTURER = "BrainBoardz" IDF_TARGET = esp32s3 -CIRCUITPY_ESP_FLASH_MODE=dio -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=8MB +CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/brainboardz_neuron/sdkconfig b/ports/espressif/boards/brainboardz_neuron/sdkconfig index 39bd2cdb4e..16c84dd988 100755 --- a/ports/espressif/boards/brainboardz_neuron/sdkconfig +++ b/ports/espressif/boards/brainboardz_neuron/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # # SPI RAM config # @@ -9,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/crumpspace_crumps2/sdkconfig b/ports/espressif/boards/crumpspace_crumps2/sdkconfig index af05b7fbf2..9fa2385f37 100644 --- a/ports/espressif/boards/crumpspace_crumps2/sdkconfig +++ b/ports/espressif/boards/crumpspace_crumps2/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/cytron_maker_feather_aiot_s3/sdkconfig b/ports/espressif/boards/cytron_maker_feather_aiot_s3/sdkconfig index e7c5b643b2..d9cbd73072 100644 --- a/ports/espressif/boards/cytron_maker_feather_aiot_s3/sdkconfig +++ b/ports/espressif/boards/cytron_maker_feather_aiot_s3/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/deneyap_mini_v2/sdkconfig b/ports/espressif/boards/deneyap_mini_v2/sdkconfig index 613b744ef2..f202775431 100644 --- a/ports/espressif/boards/deneyap_mini_v2/sdkconfig +++ b/ports/espressif/boards/deneyap_mini_v2/sdkconfig @@ -9,11 +9,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/espressif_esp32_lyrat/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32_lyrat/mpconfigboard.mk index e9fcd24e61..f618b436c4 100644 --- a/ports/espressif/boards/espressif_esp32_lyrat/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32_lyrat/mpconfigboard.mk @@ -7,4 +7,6 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP_PSRAM_SIZE = 4MB + CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32_lyrat/sdkconfig b/ports/espressif/boards/espressif_esp32_lyrat/sdkconfig index 4b2981ba62..e0db0b9800 100644 --- a/ports/espressif/boards/espressif_esp32_lyrat/sdkconfig +++ b/ports/espressif/boards/espressif_esp32_lyrat/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32_SPIRAM_SUPPORT=y # SPI RAM config # CONFIG_SPIRAM_TYPE_AUTO=y diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/sdkconfig b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/sdkconfig index 8c82c9c70d..705eeb1a61 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/sdkconfig @@ -10,11 +10,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig index 8c82c9c70d..705eeb1a61 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig @@ -10,11 +10,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/espressif_esp32s3_box/sdkconfig b/ports/espressif/boards/espressif_esp32s3_box/sdkconfig index 99432b359a..5fd3cc3b49 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_box/sdkconfig @@ -6,11 +6,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig index 99432b359a..5fd3cc3b49 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig @@ -6,11 +6,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk index 78423955bb..2fa3a5d115 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk @@ -5,6 +5,8 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 -CIRCUITPY_ESP_FLASH_MODE=dout -CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=32MB +CIRCUITPY_ESP_FLASH_MODE = dout +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 32MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig index f915462e11..0b6abf41cf 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # # SPI RAM config # @@ -9,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig index 3a99cc3c44..ad74ab5f04 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig @@ -16,8 +16,8 @@ CONFIG_SPIRAM_SIZE=2097152 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/sdkconfig index e7c5b643b2..d9cbd73072 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig b/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig index 18eca34cb2..285e2879bb 100644 --- a/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/espressif_hmi_devkit_1/sdkconfig b/ports/espressif/boards/espressif_hmi_devkit_1/sdkconfig index 1dd865e63c..d151cecdfb 100644 --- a/ports/espressif/boards/espressif_hmi_devkit_1/sdkconfig +++ b/ports/espressif/boards/espressif_hmi_devkit_1/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/espressif_kaluga_1.3/sdkconfig b/ports/espressif/boards/espressif_kaluga_1.3/sdkconfig index 1dd865e63c..d151cecdfb 100644 --- a/ports/espressif/boards/espressif_kaluga_1.3/sdkconfig +++ b/ports/espressif/boards/espressif_kaluga_1.3/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/espressif_kaluga_1/sdkconfig b/ports/espressif/boards/espressif_kaluga_1/sdkconfig index 1dd865e63c..d151cecdfb 100644 --- a/ports/espressif/boards/espressif_kaluga_1/sdkconfig +++ b/ports/espressif/boards/espressif_kaluga_1/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/espressif_saola_1_wrover/sdkconfig b/ports/espressif/boards/espressif_saola_1_wrover/sdkconfig index 1dd865e63c..d151cecdfb 100644 --- a/ports/espressif/boards/espressif_saola_1_wrover/sdkconfig +++ b/ports/espressif/boards/espressif_saola_1_wrover/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/franzininho_wifi_wrover/sdkconfig b/ports/espressif/boards/franzininho_wifi_wrover/sdkconfig index 1dd865e63c..d151cecdfb 100644 --- a/ports/espressif/boards/franzininho_wifi_wrover/sdkconfig +++ b/ports/espressif/boards/franzininho_wifi_wrover/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/gravitech_cucumber_r/sdkconfig b/ports/espressif/boards/gravitech_cucumber_r/sdkconfig index 41e00d746a..a7be128ca5 100644 --- a/ports/espressif/boards/gravitech_cucumber_r/sdkconfig +++ b/ports/espressif/boards/gravitech_cucumber_r/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/gravitech_cucumber_rs/sdkconfig b/ports/espressif/boards/gravitech_cucumber_rs/sdkconfig index 45f96a6600..e176aa8613 100644 --- a/ports/espressif/boards/gravitech_cucumber_rs/sdkconfig +++ b/ports/espressif/boards/gravitech_cucumber_rs/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/hexky_s2/sdkconfig b/ports/espressif/boards/hexky_s2/sdkconfig index 1dd865e63c..d151cecdfb 100644 --- a/ports/espressif/boards/hexky_s2/sdkconfig +++ b/ports/espressif/boards/hexky_s2/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/hiibot_iots2/sdkconfig b/ports/espressif/boards/hiibot_iots2/sdkconfig index 1120f8099f..05249a050c 100644 --- a/ports/espressif/boards/hiibot_iots2/sdkconfig +++ b/ports/espressif/boards/hiibot_iots2/sdkconfig @@ -11,8 +11,8 @@ CONFIG_SPIRAM_SIZE=8388608 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/lilygo_tembed_esp32s3/mpconfigboard.mk b/ports/espressif/boards/lilygo_tembed_esp32s3/mpconfigboard.mk index 2b8f67b560..8fb5099d61 100644 --- a/ports/espressif/boards/lilygo_tembed_esp32s3/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_tembed_esp32s3/mpconfigboard.mk @@ -8,3 +8,5 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/lilygo_tembed_esp32s3/sdkconfig b/ports/espressif/boards/lilygo_tembed_esp32s3/sdkconfig index f508f4a67c..d9cbd73072 100644 --- a/ports/espressif/boards/lilygo_tembed_esp32s3/sdkconfig +++ b/ports/espressif/boards/lilygo_tembed_esp32s3/sdkconfig @@ -1,4 +1,3 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # # SPI RAM config # @@ -9,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM Clock and CS IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig index 9e7a21dee3..924d863dad 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig index 9e7a21dee3..924d863dad 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/lolin_s2_mini/sdkconfig b/ports/espressif/boards/lolin_s2_mini/sdkconfig index a6ec1f0078..0db55cbb67 100644 --- a/ports/espressif/boards/lolin_s2_mini/sdkconfig +++ b/ports/espressif/boards/lolin_s2_mini/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/lolin_s2_pico/sdkconfig b/ports/espressif/boards/lolin_s2_pico/sdkconfig index b090e8f7e2..8c5ca132d3 100644 --- a/ports/espressif/boards/lolin_s2_pico/sdkconfig +++ b/ports/espressif/boards/lolin_s2_pico/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/lolin_s3/sdkconfig b/ports/espressif/boards/lolin_s3/sdkconfig index 975a05bfc2..77612d5c27 100644 --- a/ports/espressif/boards/lolin_s3/sdkconfig +++ b/ports/espressif/boards/lolin_s3/sdkconfig @@ -16,8 +16,8 @@ CONFIG_SPIRAM_SIZE=8388608 # # PSRAM Clock and CS IO for ESP32S3 # -# CONFIG_DEFAULT_PSRAM_CLK_IO=30 -# CONFIG_DEFAULT_PSRAM_CS_IO=26 +# CONFIG_SPIRAM_CLK_IO=30 +# CONFIG_SPIRAM_CS_IO=26 # end of PSRAM Clock and CS IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/m5stack_stick_c/sdkconfig b/ports/espressif/boards/m5stack_stick_c/sdkconfig index 7ec6f90c15..7f8426e4cb 100644 --- a/ports/espressif/boards/m5stack_stick_c/sdkconfig +++ b/ports/espressif/boards/m5stack_stick_c/sdkconfig @@ -1,6 +1,3 @@ -CONFIG_ESP32_SPIRAM_SUPPORT=n - -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # diff --git a/ports/espressif/boards/microdev_micro_s2/sdkconfig b/ports/espressif/boards/microdev_micro_s2/sdkconfig index 5d4c11ef15..fbb7f22e95 100644 --- a/ports/espressif/boards/microdev_micro_s2/sdkconfig +++ b/ports/espressif/boards/microdev_micro_s2/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/sdkconfig b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/sdkconfig index ec22fcdb44..ff7d57ac57 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/sdkconfig +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/sdkconfig @@ -8,8 +8,8 @@ CONFIG_SPIRAM_SIZE=2097152 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 CONFIG_SPIRAM_SPEED_40M=y diff --git a/ports/espressif/boards/odt_pixelwing_esp32_s2/sdkconfig b/ports/espressif/boards/odt_pixelwing_esp32_s2/sdkconfig index 9268947220..6ff95dec02 100644 --- a/ports/espressif/boards/odt_pixelwing_esp32_s2/sdkconfig +++ b/ports/espressif/boards/odt_pixelwing_esp32_s2/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/targett_module_clip_wrover/sdkconfig b/ports/espressif/boards/targett_module_clip_wrover/sdkconfig index 1dd865e63c..d151cecdfb 100644 --- a/ports/espressif/boards/targett_module_clip_wrover/sdkconfig +++ b/ports/espressif/boards/targett_module_clip_wrover/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/unexpectedmaker_feathers2/sdkconfig b/ports/espressif/boards/unexpectedmaker_feathers2/sdkconfig index bb19189a5c..28690986cc 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_feathers2/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_neo/sdkconfig b/ports/espressif/boards/unexpectedmaker_feathers2_neo/sdkconfig index c336cdb290..9f3970ffd4 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_neo/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_feathers2_neo/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/sdkconfig b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/sdkconfig index bb19189a5c..28690986cc 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig b/ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig index 0c8ea2c5ec..33c772e712 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig @@ -11,8 +11,8 @@ CONFIG_SPIRAM_SIZE=8388608 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/unexpectedmaker_pros3/sdkconfig b/ports/espressif/boards/unexpectedmaker_pros3/sdkconfig index 1a228e03d0..39a822ffc3 100644 --- a/ports/espressif/boards/unexpectedmaker_pros3/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_pros3/sdkconfig @@ -11,8 +11,8 @@ CONFIG_SPIRAM_SIZE=8388608 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/unexpectedmaker_tinys2/sdkconfig b/ports/espressif/boards/unexpectedmaker_tinys2/sdkconfig index d3c9bace86..7732382bee 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys2/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_tinys2/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM16=y CONFIG_SPIRAM_SIZE=2097152 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig b/ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig index 15249009ea..8eb0875155 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig @@ -13,8 +13,8 @@ CONFIG_SPIRAM_SIZE=8388608 # # PSRAM clock and cs IO for ESP32S3 # -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S3 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig index cf10a34d5b..c6ec24e77c 100644 --- a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig +++ b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig @@ -8,11 +8,11 @@ CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_SIZE=8388608 # end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 +CONFIG_SPIRAM_CLK_IO=30 # # PSRAM clock and cs IO for ESP32S2 # -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CS_IO=26 # end of PSRAM clock and cs IO for ESP32S2 # CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set diff --git a/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig b/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig index c81fbb4837..8172e82e3c 100644 --- a/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig +++ b/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig @@ -2,8 +2,8 @@ # SPI RAM config # CONFIG_ESP32S2_SPIRAM_SUPPORT=y -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 +CONFIG_SPIRAM_CLK_IO=30 +CONFIG_SPIRAM_CS_IO=26 CONFIG_SPIRAM_TYPE_ESPPSRAM64=y CONFIG_SPIRAM_MODE_QUAD=y CONFIG_SPIRAM_SIZE=8388608 From 3d2cfa162a63949dae34c4dbc4f7dbf224e5f05b Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Sun, 12 Mar 2023 01:22:22 +0530 Subject: [PATCH 1668/1712] enable `paralleldisplay` on `esp32` and `esp32s3` --- ports/espressif/bindings/espnow/Peer.h | 2 +- ports/espressif/common-hal/espnow/ESPNow.c | 4 ++-- ports/espressif/mpconfigport.mk | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ports/espressif/bindings/espnow/Peer.h b/ports/espressif/bindings/espnow/Peer.h index e4cb828472..8afab8e493 100644 --- a/ports/espressif/bindings/espnow/Peer.h +++ b/ports/espressif/bindings/espnow/Peer.h @@ -34,4 +34,4 @@ typedef struct { esp_now_peer_info_t peer_info; } espnow_peer_obj_t; -const mp_obj_type_t espnow_peer_type; +extern const mp_obj_type_t espnow_peer_type; diff --git a/ports/espressif/common-hal/espnow/ESPNow.c b/ports/espressif/common-hal/espnow/ESPNow.c index ff07497a30..814499b1c0 100644 --- a/ports/espressif/common-hal/espnow/ESPNow.c +++ b/ports/espressif/common-hal/espnow/ESPNow.c @@ -88,7 +88,7 @@ static void send_cb(const uint8_t *mac, esp_now_send_status_t status) { // Callback triggered when an ESP-NOW packet is received. // Write the peer MAC address and the message into the recv_buffer as an ESPNow packet. // If the buffer is full, drop the message and increment the dropped count. -static void recv_cb(const uint8_t *mac, const uint8_t *msg, int msg_len) { +static void recv_cb(const esp_now_recv_info_t *esp_now_info, const uint8_t *msg, int msg_len) { espnow_obj_t *self = MP_STATE_PORT(espnow_singleton); ringbuf_t *buf = self->recv_buffer; @@ -117,7 +117,7 @@ static void recv_cb(const uint8_t *mac, const uint8_t *msg, int msg_len) { header.time_ms = mp_hal_ticks_ms(); ringbuf_put_n(buf, (uint8_t *)&header, sizeof(header)); - ringbuf_put_n(buf, mac, ESP_NOW_ETH_ALEN); + ringbuf_put_n(buf, esp_now_info->src_addr, ESP_NOW_ETH_ALEN); ringbuf_put_n(buf, msg, msg_len); self->read_success++; diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 52399b1640..c8bfb6f7e7 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -48,7 +48,6 @@ CIRCUITPY_WIFI ?= 1 ifeq ($(IDF_TARGET),esp32) # Modules CIRCUITPY_BLEIO = 0 -CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_RGBMATRIX = 0 # Features CIRCUITPY_USB = 0 From ba22633fb080ed6bdf9e93ebf037a2511e5523d9 Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Sun, 12 Mar 2023 01:23:47 +0530 Subject: [PATCH 1669/1712] temporarily disable `rgbmatrix` on `espressif` --- ports/espressif/mpconfigport.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index c8bfb6f7e7..21fc50c874 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -37,7 +37,8 @@ CIRCUITPY_IMAGECAPTURE = 0 CIRCUITPY_MEMORYMAP ?= 1 CIRCUITPY_NVM ?= 1 CIRCUITPY_PS2IO ?= 1 -CIRCUITPY_RGBMATRIX ?= 1 +# Disabled temporarily +CIRCUITPY_RGBMATRIX ?= 0 CIRCUITPY_ROTARYIO ?= 1 CIRCUITPY_SYNTHIO_MAX_CHANNELS ?= 12 CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1 From 7a7f1e6efa4c6e0ca12478d16d5bab46ced5b731 Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+microdev1@users.noreply.github.com> Date: Tue, 21 Mar 2023 07:15:31 +0530 Subject: [PATCH 1670/1712] fix arch switch statement in ulp Co-authored-by: Casey Webb --- ports/espressif/common-hal/espulp/ULP.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/common-hal/espulp/ULP.c b/ports/espressif/common-hal/espulp/ULP.c index 2af3142ff2..9db001a506 100644 --- a/ports/espressif/common-hal/espulp/ULP.c +++ b/ports/espressif/common-hal/espulp/ULP.c @@ -143,7 +143,7 @@ void common_hal_espulp_ulp_construct(espulp_ulp_obj_t *self, espulp_architecture mp_raise_ValueError_varg(translate("%q in use"), MP_QSTR_ULP); } - switch (self->arch) { + switch (arch) { #ifdef CONFIG_ULP_COPROC_TYPE_FSM case FSM: break; From e90c07ed878a01eae639bd1a99242b2a736c3a2c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 11 Aug 2023 17:38:59 -0700 Subject: [PATCH 1671/1712] More esp fixing --- ports/espressif/CMakeLists.txt | 2 +- ports/espressif/boards/adafruit_esp32s3_camera/board.c | 6 +++--- .../boards/adafruit_esp32s3_camera/mpconfigboard.mk | 1 + ports/espressif/common-hal/espulp/ULP.c | 4 ++-- ports/espressif/i2s_lcd_driver.h | 0 5 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 ports/espressif/i2s_lcd_driver.h diff --git a/ports/espressif/CMakeLists.txt b/ports/espressif/CMakeLists.txt index f129b8b4bf..588539f9f9 100644 --- a/ports/espressif/CMakeLists.txt +++ b/ports/espressif/CMakeLists.txt @@ -6,7 +6,7 @@ set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf) # The component list here determines what options we get in menuconfig and what the ninja file can build. set(COMPONENTS bt driver esp-tls esp_adc_cal esp_event esp_netif esp_psram esp_wifi esptool_py freertos log lwip main mbedtls mdns soc ulp usb wpa_supplicant esp_lcd) -set(EXTRA_COMPONENT_DIRS esp-protocols/components/mdns) +set(EXTRA_COMPONENT_DIRS "esp-protocols/components/mdns") list(APPEND EXTRA_COMPONENT_DIRS "esp32-camera") diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/board.c b/ports/espressif/boards/adafruit_esp32s3_camera/board.c index 65042bcea5..83396b81a2 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/board.c +++ b/ports/espressif/boards/adafruit_esp32s3_camera/board.c @@ -87,7 +87,7 @@ static void io_expander_backlight_init(void) { i2c_master_write_byte(cmd, AW9523_REG_SOFTRESET, true); i2c_master_write_byte(cmd, 0, true); i2c_master_stop(cmd); - i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_RATE_MS); + i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_PERIOD_MS); i2c_cmd_link_delete(cmd); cmd = i2c_cmd_link_create(); @@ -97,7 +97,7 @@ static void io_expander_backlight_init(void) { i2c_master_write_byte(cmd, AW9523_DEFAULT_CONFIG >> 8, true); i2c_master_write_byte(cmd, AW9523_DEFAULT_CONFIG & 0xff, true); i2c_master_stop(cmd); - i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_RATE_MS); + i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_PERIOD_MS); i2c_cmd_link_delete(cmd); cmd = i2c_cmd_link_create(); @@ -107,7 +107,7 @@ static void io_expander_backlight_init(void) { i2c_master_write_byte(cmd, AW9523_DEFAULT_OUTPUT >> 8, true); i2c_master_write_byte(cmd, AW9523_DEFAULT_OUTPUT & 0xff, true); i2c_master_stop(cmd); - i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_RATE_MS); + i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_PERIOD_MS); i2c_cmd_link_delete(cmd); i2c_driver_delete(i2c_num); diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk index 6b94c979dc..d6538cb8f0 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk @@ -8,6 +8,7 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP_PSRAM_SIZE = 2MB FLASH_SDKCONFIG = esp-idf-config/sdkconfig-4MB-1ota.defaults CIRCUITPY_AUDIOBUSIO = 0 diff --git a/ports/espressif/common-hal/espulp/ULP.c b/ports/espressif/common-hal/espulp/ULP.c index 9db001a506..d8bb0be597 100644 --- a/ports/espressif/common-hal/espulp/ULP.c +++ b/ports/espressif/common-hal/espulp/ULP.c @@ -35,11 +35,11 @@ #define ULP_COPROC_RESERVE_MEM (CONFIG_ESP32_ULP_COPROC_RESERVE_MEM) #elif defined(CONFIG_IDF_TARGET_ESP32S2) #include "esp32s2/ulp.h" -#include "esp32s2/ulp_riscv.h" +#include "ulp_riscv.h" #define ULP_COPROC_RESERVE_MEM (CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM) #elif defined(CONFIG_IDF_TARGET_ESP32S3) #include "esp32s3/ulp.h" -#include "esp32s3/ulp_riscv.h" +#include "ulp_riscv.h" #define ULP_COPROC_RESERVE_MEM (CONFIG_ESP32S3_ULP_COPROC_RESERVE_MEM) #endif diff --git a/ports/espressif/i2s_lcd_driver.h b/ports/espressif/i2s_lcd_driver.h deleted file mode 100644 index e69de29bb2..0000000000 From feabf7b6ceff37cef7b7fed265d36972c0b30d6f Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 16 Aug 2023 10:57:25 -0700 Subject: [PATCH 1672/1712] Use kconfiglib in sdkconfig update script --- ports/espressif/tools/update_sdkconfig.py | 192 ++++++++++++++++------ 1 file changed, 146 insertions(+), 46 deletions(-) diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index 9639e06435..f1f8612fba 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -4,6 +4,8 @@ import pathlib import click import copy +import kconfiglib +import os OPT_SETTINGS = [ "CONFIG_ESP_ERR_TO_NAME_LOOKUP", @@ -21,17 +23,14 @@ OPT_SETTINGS = [ "CONFIG_OPTIMIZATION_ASSERTION_LEVEL", "CONFIG_OPTIMIZATION_ASSERTIONS_", "CONFIG_HAL_DEFAULT_ASSERTION_LEVEL", + "CONFIG_BOOTLOADER_LOG_LEVEL", + "LOG_DEFAULT_LEVEL", ] TARGET_SETTINGS = [ "CONFIG_IDF_TARGET", "CONFIG_IDF_FIRMWARE_CHIP_ID", "CONFIG_BOOTLOADER_OFFSET_IN_FLASH", - "CONFIG_ESP32_", - "CONFIG_ESP32C3_", - "CONFIG_ESP32S2_", - "CONFIG_ESP32S3_", - "CONFIG_ESP32H2_", "CONFIG_ESP_SLEEP_POWER_DOWN_FLASH", "CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE", "CONFIG_ESP_SYSTEM_MEMPROT_", @@ -57,7 +56,6 @@ TARGET_SETTINGS = [ ] BOARD_SETTINGS = [ - "PSRAM clock and cs IO for ESP32S3", "CONFIG_SPIRAM", "CONFIG_DEFAULT_PSRAM_", "_SPIRAM_SUPPORT", @@ -102,6 +100,33 @@ def add_group(lines, last_group, current_group): return last_group +def sym_default(sym): + # Skip symbols that cannot be changed. Only check + # non-choice symbols, as selects don't affect choice + # symbols. + if not sym.choice and sym.visibility <= kconfiglib.expr_value(sym.rev_dep): + return True + + # Skip symbols whose value matches their default + if sym.str_value == sym._str_default(): + return True + + # Skip symbols that would be selected by default in a + # choice, unless the choice is optional or the symbol type + # isn't bool (it might be possible to set the choice mode + # to n or the symbol to m in those cases). + if ( + sym.choice + and not sym.choice.is_optional + and sym.choice._selection_from_defaults() is sym + and sym.orig_type is kconfiglib.BOOL + and sym.tri_value == 2 + ): + return True + + return False + + @click.command() @click.option("--debug") @click.option("--board") @@ -122,7 +147,20 @@ def update(debug, board, update_all): elif line.startswith("CIRCUITPY_ESP_FLASH_SIZE"): flash = line.split("=")[1].strip() + os.environ["IDF_TARGET"] = target + os.environ[ + "COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE" + ] = f"build-{board}/esp-idf/kconfigs_projbuild.in" + os.environ["COMPONENT_KCONFIGS_SOURCE_FILE"] = f"build-{board}/esp-idf/kconfigs.in" + + kconfig_path = pathlib.Path(f"build-{board}/esp-idf/kconfigs.in") + + kconfig_path = pathlib.Path(f"esp-idf/Kconfig") + kconfig = kconfiglib.Kconfig(kconfig_path) + input_config = pathlib.Path(f"build-{board}/esp-idf/sdkconfig") + kconfig.load_config(input_config) + default_config = pathlib.Path("esp-idf-config/sdkconfig.defaults") if debug: opt_config = pathlib.Path("esp-idf-config/sdkconfig-debug.defaults") @@ -133,11 +171,9 @@ def update(debug, board, update_all): ble_config = pathlib.Path(f"esp-idf-config/sdkconfig-ble.defaults") board_config = pathlib.Path(f"boards/{board}/sdkconfig") - defaults = default_config.read_text().split("\n") - defaults.extend(opt_config.read_text().split("\n")) - defaults.extend(flash_config.read_text().split("\n")) - defaults.extend(target_config.read_text().split("\n")) - defaults.extend(ble_config.read_text().split("\n")) + cp_kconfig_defaults = kconfiglib.Kconfig(kconfig_path) + for default_file in (default_config, opt_config, flash_config, target_config, ble_config): + cp_kconfig_defaults.load_config(default_file, replace=False) board_settings = [] last_board_group = None @@ -151,43 +187,107 @@ def update(debug, board, update_all): last_ble_group = None default_settings = [] last_default_group = None + current_group = [] - for line in input_config.read_text().split("\n"): - # Normalize the deprecated section labels. - if line == "# End of deprecated options": - line = "# end of Deprecated options for backward compatibility" - if ( - line.startswith("# ") - and "CONFIG_" not in line - and "DO NOT EDIT" not in line - and "Project Configuration" not in line - and len(line) > 3 - ): - if line.startswith("# end of"): - current_group.pop() + + for sym in kconfig.unique_defined_syms: + sym._visited = False + + # This merges the normal `write_config`, `write_min_config` and CP settings to split into + # different files. + pending_nodes = [kconfig.top_node] + i = 0 + while pending_nodes: + node = pending_nodes.pop() + if node is None: + current_group.pop() + continue + + if node.item is kconfiglib.MENU: + if node.prompt: + print(" " * len(current_group), i, node.prompt[0]) + i += 1 + if node.next: + pending_nodes.append(node.next) + + # if i > 300: + # break + + # We have a configuration item. + item = node.item + if isinstance(item, kconfiglib.Symbol): + if item._visited: + continue + item._visited = True + + config_string = item.config_string.strip() + if not config_string: + continue + + if node.list: + pending_nodes.append(node.list) + + matches_cp_default = cp_kconfig_defaults.syms[item.name].str_value == item.str_value + matches_esp_default = sym_default(item) + + if not matches_esp_default: + print(" " * len(current_group), i, config_string.strip()) + + target_reference = False + for referenced in item.referenced: + if referenced.name.startswith("IDF_TARGET"): + # print(item.name, "references", referenced.name) + target_reference = True + break + + if (not update_all and not matches_cp_default) or ( + update_all + and matches_group(config_string, BOARD_SETTINGS) + and not matches_esp_default + ): + print(" " * (len(current_group) + 1), "board") + last_board_group = add_group(board_settings, last_board_group, current_group) + board_settings.append(config_string) + elif update_all and not matches_esp_default: + if matches_group(config_string, OPT_SETTINGS): + print(" " * (len(current_group) + 1), "opt") + last_opt_group = add_group(opt_settings, last_opt_group, current_group) + opt_settings.append(config_string) + elif matches_group(config_string, FLASH_SETTINGS): + print(" " * (len(current_group) + 1), "flash") + last_flash_group = add_group(flash_settings, last_flash_group, current_group) + flash_settings.append(config_string) + elif target_reference or matches_group(config_string, TARGET_SETTINGS): + print(" " * (len(current_group) + 1), "target") + last_target_group = add_group( + target_settings, last_target_group, current_group + ) + target_settings.append(config_string) + elif matches_group(config_string, BLE_SETTINGS): + print(" " * (len(current_group) + 1), "ble") + last_ble_group = add_group(ble_settings, last_ble_group, current_group) + ble_settings.append(config_string) + else: + print(" " * (len(current_group) + 1), "all") + last_default_group = add_group( + default_settings, last_default_group, current_group + ) + default_settings.append(config_string) + + elif kconfiglib.expr_value(node.dep): + if item is kconfiglib.COMMENT: + print("comment", repr(item)) + elif item is kconfiglib.MENU: + # This menu isn't visible so skip to the next node. + if kconfiglib.expr_value(node.visibility) and node.list: + current_group.append(node.prompt[0]) + pending_nodes.append(None) + pending_nodes.append(node.list) + elif isinstance(item, kconfiglib.Choice): + # Choices are made up of individual symbols that we need to check. + pending_nodes.append(node.list) else: - current_group.append(line[2:]) - elif (not update_all and line not in defaults) or ( - update_all and matches_group(line, BOARD_SETTINGS) - ): - last_board_group = add_group(board_settings, last_board_group, current_group) - board_settings.append(line) - elif update_all: - if matches_group(line, OPT_SETTINGS): - last_opt_group = add_group(opt_settings, last_opt_group, current_group) - opt_settings.append(line) - elif matches_group(line, FLASH_SETTINGS): - last_flash_group = add_group(flash_settings, last_flash_group, current_group) - flash_settings.append(line) - elif matches_group(line, TARGET_SETTINGS): - last_target_group = add_group(target_settings, last_target_group, current_group) - target_settings.append(line) - elif matches_group(line, BLE_SETTINGS): - last_ble_group = add_group(ble_settings, last_ble_group, current_group) - ble_settings.append(line) - elif "CONFIG_" in line: - last_default_group = add_group(default_settings, last_default_group, current_group) - default_settings.append(line) + print("unknown", repr(item)) add_group(board_settings, last_board_group, current_group) add_group(opt_settings, last_opt_group, current_group) From 6043874969a3e12c2997be8d3d3e2aac8fbaffd2 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 24 Aug 2023 15:06:16 -0700 Subject: [PATCH 1673/1712] Split out ram dependent configs --- ports/espressif/tools/update_sdkconfig.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index f1f8612fba..1f91becd2b 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -234,15 +234,18 @@ def update(debug, board, update_all): print(" " * len(current_group), i, config_string.strip()) target_reference = False + board_reference = False for referenced in item.referenced: if referenced.name.startswith("IDF_TARGET"): # print(item.name, "references", referenced.name) target_reference = True break + if referenced.name == "SPIRAM": + board_reference = True if (not update_all and not matches_cp_default) or ( update_all - and matches_group(config_string, BOARD_SETTINGS) + and (matches_group(config_string, BOARD_SETTINGS) or board_reference) and not matches_esp_default ): print(" " * (len(current_group) + 1), "board") From 73e04e84a28bed61649a2c249ea658d33292095a Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 29 Aug 2023 16:00:27 -0700 Subject: [PATCH 1674/1712] Split out flash and psram settings from sdkconfig --- ports/espressif/CMakeLists.txt | 6 +- ports/espressif/Makefile | 46 +- .../adafruit_esp32s3_camera/mpconfigboard.mk | 2 + .../boards/adafruit_esp32s3_camera/sdkconfig | 59 +- .../mpconfigboard.mk | 2 + .../adafruit_feather_esp32_v2/sdkconfig | 36 - .../mpconfigboard.mk | 7 +- .../sdkconfig | 33 +- .../mpconfigboard.mk | 4 +- .../adafruit_feather_esp32s3_tft/sdkconfig | 40 +- .../adafruit_matrixportal_s3/mpconfigboard.mk | 6 +- .../boards/adafruit_matrixportal_s3/sdkconfig | 42 +- .../adafruit_metro_esp32s2/mpconfigboard.mk | 4 +- .../adafruit_metro_esp32s3/mpconfigboard.mk | 8 +- .../boards/adafruit_metro_esp32s3/sdkconfig | 45 +- .../esp-idf-config/sdkconfig-ble.defaults | 33 +- .../esp-idf-config/sdkconfig-esp32.defaults | 1108 +---------------- .../esp-idf-config/sdkconfig-esp32s3.defaults | 44 +- ...s => sdkconfig-flash-16MB-no-uf2.defaults} | 0 ...defaults => sdkconfig-flash-16MB.defaults} | 11 +- ...dkconfig-flash-2MB-no-ota-no-uf2.defaults} | 0 ...defaults => sdkconfig-flash-32MB.defaults} | 0 .../sdkconfig-flash-40m.defaults | 10 + ...ults => sdkconfig-flash-4MB-1ota.defaults} | 0 ...ts => sdkconfig-flash-4MB-no-uf2.defaults} | 0 ....defaults => sdkconfig-flash-4MB.defaults} | 11 +- .../sdkconfig-flash-80m.defaults | 10 + ...ts => sdkconfig-flash-8MB-no-uf2.defaults} | 0 ....defaults => sdkconfig-flash-8MB.defaults} | 9 +- .../sdkconfig-flash-dio.defaults | 6 + .../sdkconfig-flash-qio.defaults | 6 + .../esp-idf-config/sdkconfig-opt.defaults | 38 +- .../sdkconfig-psram-2MB.defaults | 4 + .../sdkconfig-psram-40m.defaults | 2 + .../sdkconfig-psram-80m.defaults | 3 + .../sdkconfig-psram-8MB.defaults | 0 .../sdkconfig-psram-opi.defaults | 2 + .../sdkconfig-psram-qio.defaults | 1 + .../esp-idf-config/sdkconfig-psram.defaults | 27 + .../esp-idf-config/sdkconfig.defaults | 149 ++- ports/espressif/tools/update_sdkconfig.py | 154 ++- 41 files changed, 547 insertions(+), 1421 deletions(-) rename ports/espressif/esp-idf-config/{sdkconfig-16MB-no-uf2.defaults => sdkconfig-flash-16MB-no-uf2.defaults} (100%) rename ports/espressif/esp-idf-config/{sdkconfig-16MB.defaults => sdkconfig-flash-16MB.defaults} (66%) rename ports/espressif/esp-idf-config/{sdkconfig-2MB-no-ota-no-uf2.defaults => sdkconfig-flash-2MB-no-ota-no-uf2.defaults} (100%) rename ports/espressif/esp-idf-config/{sdkconfig-32MB.defaults => sdkconfig-flash-32MB.defaults} (100%) create mode 100644 ports/espressif/esp-idf-config/sdkconfig-flash-40m.defaults rename ports/espressif/esp-idf-config/{sdkconfig-4MB-1ota.defaults => sdkconfig-flash-4MB-1ota.defaults} (100%) rename ports/espressif/esp-idf-config/{sdkconfig-4MB-no-uf2.defaults => sdkconfig-flash-4MB-no-uf2.defaults} (100%) rename ports/espressif/esp-idf-config/{sdkconfig-4MB.defaults => sdkconfig-flash-4MB.defaults} (66%) create mode 100644 ports/espressif/esp-idf-config/sdkconfig-flash-80m.defaults rename ports/espressif/esp-idf-config/{sdkconfig-8MB-no-uf2.defaults => sdkconfig-flash-8MB-no-uf2.defaults} (100%) rename ports/espressif/esp-idf-config/{sdkconfig-8MB.defaults => sdkconfig-flash-8MB.defaults} (66%) create mode 100644 ports/espressif/esp-idf-config/sdkconfig-flash-dio.defaults create mode 100644 ports/espressif/esp-idf-config/sdkconfig-flash-qio.defaults create mode 100644 ports/espressif/esp-idf-config/sdkconfig-psram-2MB.defaults create mode 100644 ports/espressif/esp-idf-config/sdkconfig-psram-40m.defaults create mode 100644 ports/espressif/esp-idf-config/sdkconfig-psram-80m.defaults create mode 100644 ports/espressif/esp-idf-config/sdkconfig-psram-8MB.defaults create mode 100644 ports/espressif/esp-idf-config/sdkconfig-psram-opi.defaults create mode 100644 ports/espressif/esp-idf-config/sdkconfig-psram-qio.defaults create mode 100644 ports/espressif/esp-idf-config/sdkconfig-psram.defaults diff --git a/ports/espressif/CMakeLists.txt b/ports/espressif/CMakeLists.txt index 588539f9f9..de163638da 100644 --- a/ports/espressif/CMakeLists.txt +++ b/ports/espressif/CMakeLists.txt @@ -5,10 +5,8 @@ cmake_minimum_required(VERSION 3.16) set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf) # The component list here determines what options we get in menuconfig and what the ninja file can build. -set(COMPONENTS bt driver esp-tls esp_adc_cal esp_event esp_netif esp_psram esp_wifi esptool_py freertos log lwip main mbedtls mdns soc ulp usb wpa_supplicant esp_lcd) -set(EXTRA_COMPONENT_DIRS "esp-protocols/components/mdns") - -list(APPEND EXTRA_COMPONENT_DIRS "esp32-camera") +set(COMPONENTS bt driver esp-tls esp_adc_cal esp_event esp_netif esp_psram esp_wifi esptool_py freertos log lwip main mbedtls mdns soc ulp usb wpa_supplicant esp32-camera esp_lcd) +set(EXTRA_COMPONENT_DIRS "esp-protocols/components/mdns" "esp32-camera") include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(circuitpython) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 3a92d0b9b6..5c61e55fbe 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -340,16 +340,26 @@ $(BUILD)/esp-idf: TARGET_SDKCONFIG = esp-idf-config/sdkconfig-$(IDF_TARGET).defaults + ifeq ($(CIRCUITPY_ESP_FLASH_SIZE), 2MB) - FLASH_SDKCONFIG ?= esp-idf-config/sdkconfig-$(CIRCUITPY_ESP_FLASH_SIZE)-no-ota-no-uf2.defaults + FLASH_SIZE_SDKCONFIG ?= esp-idf-config/sdkconfig-flash-$(CIRCUITPY_ESP_FLASH_SIZE)-no-ota-no-uf2.defaults else UF2_BOOTLOADER ?= $(CIRCUITPY_USB) ifeq ($(UF2_BOOTLOADER), 1) - FLASH_SDKCONFIG ?= esp-idf-config/sdkconfig-$(CIRCUITPY_ESP_FLASH_SIZE).defaults + FLASH_SIZE_SDKCONFIG ?= esp-idf-config/sdkconfig-flash-$(CIRCUITPY_ESP_FLASH_SIZE).defaults else - FLASH_SDKCONFIG ?= esp-idf-config/sdkconfig-$(CIRCUITPY_ESP_FLASH_SIZE)-no-uf2.defaults + FLASH_SIZE_SDKCONFIG ?= esp-idf-config/sdkconfig-flash-$(CIRCUITPY_ESP_FLASH_SIZE)-no-uf2.defaults endif endif +FLASH_MODE_SDKCONFIG ?= esp-idf-config/sdkconfig-flash-$(CIRCUITPY_ESP_FLASH_MODE).defaults +FLASH_SPEED_SDKCONFIG ?= esp-idf-config/sdkconfig-flash-$(CIRCUITPY_ESP_FLASH_FREQ).defaults + +ifneq ($(CIRCUITPY_ESP_PSRAM_SIZE), 0) + PSRAM_SDKCONFIG = esp-idf-config/sdkconfig-psram.defaults + PSRAM_SIZE_SDKCONFIG = esp-idf-config/sdkconfig-psram-$(CIRCUITPY_ESP_PSRAM_SIZE).defaults + PSRAM_MODE_SDKCONFIG = esp-idf-config/sdkconfig-psram-$(CIRCUITPY_ESP_PSRAM_MODE).defaults + PSRAM_SPEED_SDKCONFIG = esp-idf-config/sdkconfig-psram-$(CIRCUITPY_ESP_PSRAM_FREQ).defaults +endif ifeq ($(DEBUG), 1) DEBUG_SDKCONFIG = esp-idf-config/sdkconfig-debug.defaults @@ -357,7 +367,7 @@ else DEBUG_SDKCONFIG = esp-idf-config/sdkconfig-opt.defaults endif -SDKCONFIGS := esp-idf-config/sdkconfig.defaults;$(DEBUG_SDKCONFIG);$(FLASH_SDKCONFIG);$(TARGET_SDKCONFIG);boards/$(BOARD)/sdkconfig +SDKCONFIGS := esp-idf-config/sdkconfig.defaults;$(DEBUG_SDKCONFIG);$(FLASH_SIZE_SDKCONFIG);$(FLASH_MODE_SDKCONFIG);$(FLASH_SPEED_SDKCONFIG);$(PSRAM_SDKCONFIG);$(PSRAM_SIZE_SDKCONFIG);$(PSRAM_MODE_SDKCONFIG);$(PSRAM_SPEED_SDKCONFIG);$(TARGET_SDKCONFIG);boards/$(BOARD)/sdkconfig ifneq ($(CIRCUITPY_BLEIO),0) SDKCONFIGS := esp-idf-config/sdkconfig-ble.defaults;$(SDKCONFIGS) endif @@ -365,7 +375,7 @@ endif .PHONY: do-sdkconfig do-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h QSTR_GLOBAL_REQUIREMENTS += $(BUILD)/esp-idf/config/sdkconfig.h -$(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig CMakeLists.txt | $(BUILD)/esp-idf +$(BUILD)/esp-idf/config/sdkconfig.h: boards/$(BOARD)/sdkconfig boards/$(BOARD)/mpconfigboard.mk CMakeLists.txt | $(BUILD)/esp-idf IDF_PATH=$(IDF_PATH) cmake -S . -B $(BUILD)/esp-idf -DSDKCONFIG=$(BUILD)/esp-idf/sdkconfig -DSDKCONFIG_DEFAULTS="$(SDKCONFIGS)" -DCMAKE_TOOLCHAIN_FILE=$(IDF_PATH)/tools/cmake/toolchain-$(IDF_TARGET).cmake -DIDF_TARGET=$(IDF_TARGET) -GNinja # build a lib @@ -385,10 +395,11 @@ $(BUILD)/esp-idf/partition_table/partition-table.bin: $(BUILD)/esp-idf/config/sd # run menuconfig and then remove standard settings menuconfig: $(BUILD)/esp-idf/config $(BUILD)/esp-idf/config/sdkconfig.h $(Q)ninja -C $(BUILD)/esp-idf menuconfig - # Newer versions of the idf will have save-defconfig that will only include non-default values. - # We should use that when available. For now, we sort out everything. python tools/update_sdkconfig.py --board=$(BOARD) --debug=$(DEBUG) +update-all-sdkconfigs: $(BUILD)/esp-idf/config/sdkconfig.h + python tools/update_sdkconfig.py --update_all --board=$(BOARD) --debug=$(DEBUG) + BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS)) ifeq ($(IDF_TARGET),esp32) @@ -449,7 +460,26 @@ IDF_CMAKE_TARGETS = \ PARTITION_TABLE_OFFSET = 0x8000 FIRMWARE_OFFSET = 0x10000 -FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE) +# Map the flash's run mode to flashing mode (only dual is supported by the early bootloaders). +# https://github.com/espressif/esp-idf/blob/82cceabc6e6a0a2d8c40e2249bc59917cc5e577a/components/esptool_py/Kconfig.projbuild#L74-L87 +ifeq ($(CIRCUITPY_ESP_FLASH_MODE),dout) + ESPTOOLPY_FLASHMODE = "dout" +endif +ifeq ($(CIRCUITPY_ESP_FLASH_MODE),opi) + ESPTOOLPY_FLASHMODE = "dout" +endif +# Most modes can flash with dio +ESPTOOLPY_FLASHMODE ?= "dio" + +# Cap the flash speed to 80m. +# https://github.com/espressif/esp-idf/blob/82cceabc6e6a0a2d8c40e2249bc59917cc5e577a/components/esptool_py/Kconfig.projbuild#L74-L87 +ifeq ($(CIRCUITPY_ESP_FLASH_FREQ),120m) + ESPTOOLPY_FLASHFREQ = "80m" +else + ESPTOOLPY_FLASHFREQ = $(CIRCUITPY_ESP_FLASH_FREQ) +endif + +FLASH_FLAGS = --flash_mode $(ESPTOOLPY_FLASHMODE) --flash_freq $(ESPTOOLPY_FLASHFREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE) ESPTOOL_FLAGS ?= --before=default_reset --after=no_reset --baud 921600 diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk index d6538cb8f0..02f776f15d 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk @@ -9,6 +9,8 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m FLASH_SDKCONFIG = esp-idf-config/sdkconfig-4MB-1ota.defaults CIRCUITPY_AUDIOBUSIO = 0 diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig b/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig index cf6a6def7c..f5ef797681 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig +++ b/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig @@ -1,62 +1,15 @@ +# +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_SPIRAM_SUPPORT=y - -# -# SPI RAM config -# -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 - -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP -# CONFIG_OV7670_SUPPORT is not set -# CONFIG_NT99141_SUPPORT is not set -CONFIG_OV3360_SUPPORT=n -# CONFIG_OV2640_SUPPORT is not set -CONFIG_OV5640_SUPPORT=y -# CONFIG_GC2145_SUPPORT is not set -# CONFIG_GC032A_SUPPORT is not set -# CONFIG_GC0308_SUPPORT is not set -# CONFIG_BF3005_SUPPORT is not set -# CONFIG_BF20A6_SUPPORT is not set -# CONFIG_SC101IOT_SUPPORT is not set -# CONFIG_SC030IOT_SUPPORT is not set # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.mk index 554d64d1a1..73b5b00959 100644 --- a/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.mk @@ -8,3 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig index 0a81b10c16..e69de29bb2 100644 --- a/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/sdkconfig @@ -1,36 +0,0 @@ -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -CONFIG_SPIRAM_SPEED_40M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_IGNORE_NOTFOUND=y -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set -CONFIG_SPIRAM_CACHE_WORKAROUND=y - -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### # CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=8 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=7 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk index 1f9a938a4a..a4e5dbf1e9 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk @@ -7,8 +7,11 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio -CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESPCAMERA = 0 CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m + +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/sdkconfig index abdca6408c..f5ef797681 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/sdkconfig @@ -1,36 +1,9 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 # -# PSRAM Clock and CS IO for ESP32S3 +# Component config # -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # @@ -38,3 +11,5 @@ CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk index fdb5d8b5c0..a94670910b 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/mpconfigboard.mk @@ -7,10 +7,12 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio -CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB OPTIMIZATION_FLAGS = -Os CIRCUITPY_ESPCAMERA = 0 CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig index 5d5860b546..f5ef797681 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s3_tft/sdkconfig @@ -1,41 +1,9 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -# SPI RAM config -# -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # @@ -43,3 +11,5 @@ CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.mk b/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.mk index 865fc06d96..3488f22d61 100644 --- a/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_matrixportal_s3/mpconfigboard.mk @@ -6,7 +6,11 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio -CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m + CIRCUITPY_ESP32_CAMERA = 0 diff --git a/ports/espressif/boards/adafruit_matrixportal_s3/sdkconfig b/ports/espressif/boards/adafruit_matrixportal_s3/sdkconfig index 2b65102e5a..db95a623aa 100644 --- a/ports/espressif/boards/adafruit_matrixportal_s3/sdkconfig +++ b/ports/espressif/boards/adafruit_matrixportal_s3/sdkconfig @@ -1,39 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # # -# ESP32S3-Specific +# LWIP # -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# -# SPI RAM config -# -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - CONFIG_LWIP_LOCAL_HOSTNAME="matrixportal-s3" +# end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk index 5e77442d13..96bd76ec27 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 40m diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.mk b/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.mk index 039c689eaf..2fd5a40f25 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_metro_esp32s3/mpconfigboard.mk @@ -5,6 +5,10 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 -CIRCUITPY_ESP_FLASH_MODE = dio -CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m +CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig b/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig index 2d72ed5391..4b1cfa3641 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig +++ b/ports/espressif/boards/adafruit_metro_esp32s3/sdkconfig @@ -1,46 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# -# SPI RAM config -# -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="Metro-ESP32S3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-ble.defaults b/ports/espressif/esp-idf-config/sdkconfig-ble.defaults index a2ff691212..c260c38016 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-ble.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-ble.defaults @@ -1,16 +1,37 @@ -# This file was generated using idf.py save-defconfig. It can be edited manually. -# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# Bluetooth # CONFIG_BT_ENABLED=y CONFIG_BT_NIMBLE_ENABLED=y - +# +# NimBLE Options +# CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y - CONFIG_BT_NIMBLE_NVS_PERSIST=y - +# +# Memory Settings +# CONFIG_BT_NIMBLE_ACL_BUF_COUNT=20 CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 +# end of Memory Settings CONFIG_BT_NIMBLE_EXT_ADV=y +# end of NimBLE Options -CONFIG_BT_CTRL_BLE_SCAN_DUPL=n +# +# Controller Options +# +# CONFIG_BT_CTRL_BLE_SCAN_DUPL is not set +# end of Controller Options + +# end of Bluetooth + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults index 54e800cd62..0aa6343a06 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults @@ -1,1143 +1,55 @@ # -# Espressif IoT Development Framework (ESP-IDF) Project Configuration +# Espressif IoT Development Framework Configuration # -CONFIG_IDF_TARGET_ARCH_XTENSA=y -CONFIG_IDF_TARGET="esp32" -CONFIG_IDF_TARGET_ESP32=y -CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 - -# -# SDK tool configuration -# -CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-" -# CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set -# end of SDK tool configuration - -# -# Build type -# -CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y -# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set -CONFIG_APP_BUILD_GENERATE_BINARIES=y -CONFIG_APP_BUILD_BOOTLOADER=y -CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y -# end of Build type - -# -# Application manager -# -CONFIG_APP_COMPILE_TIME_DATE=y -# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set -# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set -# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set -CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 -# end of Application manager - -# -# Bootloader config -# -CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000 -CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set -CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y -# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=0 -# CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set -CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y -# CONFIG_BOOTLOADER_FACTORY_RESET is not set -# CONFIG_BOOTLOADER_APP_TEST is not set -CONFIG_BOOTLOADER_WDT_ENABLE=y -# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set -CONFIG_BOOTLOADER_WDT_TIME_MS=9000 -# CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON is not set -# CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS is not set -CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 -# CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set -CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y -# end of Bootloader config - -# -# Security features -# -# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set -# CONFIG_SECURE_BOOT is not set -# CONFIG_SECURE_FLASH_ENC_ENABLED is not set -# end of Security features - -# -# Serial flasher config -# -CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 -# CONFIG_ESPTOOLPY_NO_STUB is not set -# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set -# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set -CONFIG_ESPTOOLPY_FLASHMODE_DIO=y -# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set -CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y -CONFIG_ESPTOOLPY_FLASHMODE="dio" -# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set -CONFIG_ESPTOOLPY_FLASHFREQ_40M=y -# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set -# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set -CONFIG_ESPTOOLPY_FLASHFREQ="40m" -# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y -CONFIG_ESPTOOLPY_BEFORE_RESET=y -# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set -CONFIG_ESPTOOLPY_BEFORE="default_reset" -CONFIG_ESPTOOLPY_AFTER_RESET=y -# CONFIG_ESPTOOLPY_AFTER_NORESET is not set -CONFIG_ESPTOOLPY_AFTER="hard_reset" -# CONFIG_ESPTOOLPY_MONITOR_BAUD_CONSOLE is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 -# end of Serial flasher config - -# -# Compiler options -# -# CONFIG_COMPILER_OPTIMIZATION_DEFAULT is not set -CONFIG_COMPILER_OPTIMIZATION_SIZE=y -# CONFIG_COMPILER_OPTIMIZATION_PERF is not set -# CONFIG_COMPILER_OPTIMIZATION_NONE is not set -CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set -CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 -# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set -CONFIG_COMPILER_HIDE_PATHS_MACROS=y -# CONFIG_COMPILER_CXX_EXCEPTIONS is not set -# CONFIG_COMPILER_CXX_RTTI is not set -CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y -# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set -# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set -# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set -# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set -# CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set -# CONFIG_COMPILER_DUMP_RTL_FILES is not set -# end of Compiler options - # # Component config # - # -# Application Level Tracing +# Driver Configurations # -# CONFIG_APPTRACE_DEST_JTAG is not set -CONFIG_APPTRACE_DEST_NONE=y -CONFIG_APPTRACE_LOCK_ENABLE=y -# end of Application Level Tracing - # -# Bluetooth +# TWAI Configuration # -# CONFIG_BT_ENABLED is not set -# end of Bluetooth - -# -# Driver configurations -# - -# -# ADC configuration -# -# CONFIG_ADC_FORCE_XPD_FSM is not set -CONFIG_ADC_DISABLE_DAC=y -# end of ADC configuration - -# -# MCPWM configuration -# -# CONFIG_MCPWM_ISR_IN_IRAM is not set -# end of MCPWM configuration - -# -# SPI configuration -# -# CONFIG_SPI_MASTER_IN_IRAM is not set -CONFIG_SPI_MASTER_ISR_IN_IRAM=y -# CONFIG_SPI_SLAVE_IN_IRAM is not set -CONFIG_SPI_SLAVE_ISR_IN_IRAM=y -# end of SPI configuration - -# -# TWAI configuration -# -# CONFIG_TWAI_ISR_IN_IRAM is not set # CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC is not set # CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST is not set # CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID is not set # CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT is not set -# end of TWAI configuration +# end of TWAI Configuration -# -# UART configuration -# -CONFIG_UART_ISR_IN_IRAM=y -# end of UART configuration - -# -# RTCIO configuration -# -# CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC is not set -# end of RTCIO configuration - -# -# GPIO Configuration -# -# CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL is not set -# end of GPIO Configuration - -# -# GDMA Configuration -# -# CONFIG_GDMA_CTRL_FUNC_IN_IRAM is not set -# CONFIG_GDMA_ISR_IRAM_SAFE is not set -# end of GDMA Configuration -# end of Driver configurations - -# -# eFuse Bit Manager -# -# CONFIG_EFUSE_CUSTOM_TABLE is not set -# CONFIG_EFUSE_VIRTUAL is not set -# CONFIG_EFUSE_CODE_SCHEME_COMPAT_NONE is not set -CONFIG_EFUSE_CODE_SCHEME_COMPAT_3_4=y -# CONFIG_EFUSE_CODE_SCHEME_COMPAT_REPEAT is not set -CONFIG_EFUSE_MAX_BLK_LEN=192 -# end of eFuse Bit Manager - -# -# ESP-TLS -# -CONFIG_ESP_TLS_USING_MBEDTLS=y -# CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set -# CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set -CONFIG_ESP_TLS_SERVER=y -# CONFIG_ESP_TLS_SERVER_SESSION_TICKETS is not set -# CONFIG_ESP_TLS_SERVER_MIN_AUTH_MODE_OPTIONAL is not set -# CONFIG_ESP_TLS_PSK_VERIFICATION is not set -# CONFIG_ESP_TLS_INSECURE is not set -# end of ESP-TLS - -# -# ESP32-specific -# -CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y -CONFIG_ESP32_REV_MIN_0=y -# CONFIG_ESP32_REV_MIN_1 is not set -# CONFIG_ESP32_REV_MIN_2 is not set -# CONFIG_ESP32_REV_MIN_3 is not set -CONFIG_ESP32_REV_MIN=0 -CONFIG_ESP32_DPORT_WORKAROUND=y -# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set -# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set -CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y -CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 -# CONFIG_ESP32_SPIRAM_SUPPORT is not set - -# -# SPIRAM cache workaround debugging -# -CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW=y -# CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST is not set -# CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS is not set -# end of SPIRAM cache workaround debugging - -# -# SPIRAM workaround libraries placement -# -CONFIG_SPIRAM_CACHE_LIBJMP_IN_IRAM=y -CONFIG_SPIRAM_CACHE_LIBMATH_IN_IRAM=y -CONFIG_SPIRAM_CACHE_LIBNUMPARSER_IN_IRAM=y -CONFIG_SPIRAM_CACHE_LIBIO_IN_IRAM=y -CONFIG_SPIRAM_CACHE_LIBTIME_IN_IRAM=y -CONFIG_SPIRAM_CACHE_LIBCHAR_IN_IRAM=y -CONFIG_SPIRAM_CACHE_LIBMEM_IN_IRAM=y -CONFIG_SPIRAM_CACHE_LIBSTR_IN_IRAM=y -CONFIG_SPIRAM_CACHE_LIBRAND_IN_IRAM=y -CONFIG_SPIRAM_CACHE_LIBENV_IN_IRAM=y -CONFIG_SPIRAM_CACHE_LIBFILE_IN_IRAM=y -CONFIG_SPIRAM_CACHE_LIBMISC_IN_IRAM=y -# end of SPIRAM workaround libraries placement - -CONFIG_SPIRAM_BANKSWITCH_ENABLE=n - -# -# PSRAM clock and cs IO for ESP32-DOWD -# -CONFIG_D0WD_PSRAM_CLK_IO=17 -CONFIG_D0WD_PSRAM_CS_IO=16 -# end of PSRAM clock and cs IO for ESP32-DOWD - -# -# PSRAM clock and cs IO for ESP32-D2WD -# -CONFIG_D2WD_PSRAM_CLK_IO=9 -CONFIG_D2WD_PSRAM_CS_IO=10 -# end of PSRAM clock and cs IO for ESP32-D2WD - -# -# PSRAM clock and cs IO for ESP32-PICO -# -CONFIG_PICO_PSRAM_CS_IO=10 -# end of PSRAM clock and cs IO for ESP32-PICO - -# CONFIG_SPIRAM_CUSTOM_SPIWP_SD3_PIN is not set -CONFIG_SPIRAM_SPIWP_SD3_PIN=7 -# CONFIG_SPIRAM_2T_MODE is not set -# end of SPI RAM config - -# CONFIG_ESP32_TRAX is not set -CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 -CONFIG_ESP32_ULP_COPROC_ENABLED=y -CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=4080 -CONFIG_ESP32_DEBUG_OCDAWARE=y -CONFIG_ESP32_BROWNOUT_DET=y -CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set -CONFIG_ESP32_BROWNOUT_DET_LVL=0 -CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y -# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set -CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y -# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set -# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set -# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set -CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 -CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 -CONFIG_ESP32_XTAL_FREQ_40=y -# CONFIG_ESP32_XTAL_FREQ_26 is not set -# CONFIG_ESP32_XTAL_FREQ_AUTO is not set -CONFIG_ESP32_XTAL_FREQ=40 -# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_ESP32_NO_BLOBS is not set -# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set -# CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set -# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set -CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5 -# end of ESP32-specific - -# -# ADC-Calibration -# -CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y -CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y -CONFIG_ADC_CAL_LUT_ENABLE=y -# end of ADC-Calibration - -# -# Common ESP-related -# -CONFIG_ESP_ERR_TO_NAME_LOOKUP=y -# end of Common ESP-related - -# -# Ethernet -# -# CONFIG_ETH_USE_ESP32_EMAC is not set -# CONFIG_ETH_USE_SPI_ETHERNET is not set -# CONFIG_ETH_USE_OPENETH is not set -# end of Ethernet - -# -# Event Loop Library -# -# CONFIG_ESP_EVENT_LOOP_PROFILING is not set -CONFIG_ESP_EVENT_POST_FROM_ISR=y -CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y -# end of Event Loop Library - -# -# GDB Stub -# -# end of GDB Stub - -# -# Hardware Settings -# - -# -# MAC Config -# -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y -# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 -# end of MAC Config - -# -# Sleep Config -# -CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y -# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set -# CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND is not set -# CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND is not set -# end of Sleep Config - -# -# RTC Clock Config -# -# end of RTC Clock Config -# end of Hardware Settings +# end of Driver Configurations # # IPC (Inter-Processor Call) # CONFIG_ESP_IPC_TASK_STACK_SIZE=1536 -CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y -CONFIG_ESP_IPC_ISR_ENABLE=y # end of IPC (Inter-Processor Call) -# -# ESP NETIF Adapter -# -CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 -CONFIG_ESP_NETIF_TCPIP_LWIP=y -# CONFIG_ESP_NETIF_LOOPBACK is not set -# CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER is not set -# end of ESP NETIF Adapter - -# -# PHY -# -CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP_PHY_MAX_TX_POWER=20 -CONFIG_ESP_PHY_REDUCE_TX_POWER=y -# end of PHY - -# -# Power Management -# -# CONFIG_PM_ENABLE is not set -# end of Power Management - -# -# ESP System Settings -# -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 -# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set - -# -# Memory protection -# -# end of Memory protection - -CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y -# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set -# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 -CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 -# CONFIG_ESP_CONSOLE_UART_DEFAULT is not set -# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set -CONFIG_ESP_CONSOLE_NONE=y -CONFIG_ESP_CONSOLE_MULTIPLE_UART=y -CONFIG_ESP_CONSOLE_UART_NUM=-1 -CONFIG_ESP_INT_WDT=y -CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 -CONFIG_ESP_INT_WDT_CHECK_CPU1=y -# CONFIG_ESP_TASK_WDT is not set -# CONFIG_ESP_PANIC_HANDLER_IRAM is not set -# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set -# CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y -# end of ESP System Settings - -# -# High resolution timer (esp_timer) -# -# CONFIG_ESP_TIMER_PROFILING is not set -CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y -CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y -CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584 -CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 -# CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set -# CONFIG_ESP_TIMER_IMPL_FRC2 is not set -CONFIG_ESP_TIMER_IMPL_TG0_LAC=y -# end of High resolution timer (esp_timer) - # # Wi-Fi # -CONFIG_ESP32_WIFI_ENABLED=y -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32 CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y -# CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER is not set -CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=0 -CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=16 -CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=32 -# CONFIG_ESP32_WIFI_CSI_ENABLED is not set -CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y -CONFIG_ESP32_WIFI_TX_BA_WIN=6 -CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y -CONFIG_ESP32_WIFI_RX_BA_WIN=6 -# CONFIG_ESP32_WIFI_AMSDU_TX_ENABLED is not set -CONFIG_ESP32_WIFI_NVS_ENABLED=y -CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y -# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set -CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 -CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 -CONFIG_ESP32_WIFI_IRAM_OPT=y -CONFIG_ESP32_WIFI_RX_IRAM_OPT=y -CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y -# CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set +CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 # CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set -# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set -CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y # end of Wi-Fi -# -# Core dump -# -# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set -# CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set -CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y -# end of Core dump - -# -# FreeRTOS -# -# CONFIG_FREERTOS_UNICORE is not set -CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER=y -CONFIG_FREERTOS_CORETIMER_0=y -# CONFIG_FREERTOS_CORETIMER_1 is not set -CONFIG_FREERTOS_SYSTICK_USES_CCOUNT=y -CONFIG_FREERTOS_HZ=100 -CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set -# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set -CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y -# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set -CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y -CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 -CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y -# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set -# CONFIG_FREERTOS_ASSERT_DISABLE is not set -CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1536 -CONFIG_FREERTOS_ISR_STACKSIZE=1536 -# CONFIG_FREERTOS_LEGACY_HOOKS is not set -CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16 -CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y -# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set -CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 -CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048 -CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10 -CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 -# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set -# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set -CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y -# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set -# CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH is not set -CONFIG_FREERTOS_DEBUG_OCDAWARE=y -# CONFIG_FREERTOS_FPU_IN_ISR is not set -CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y -# CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH is not set -# end of FreeRTOS - -# -# Hardware Abstraction Layer (HAL) and Low Level (LL) -# -CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y -# CONFIG_HAL_ASSERTION_DISABLE is not set -# CONFIG_HAL_ASSERTION_SILIENT is not set -# CONFIG_HAL_ASSERTION_ENABLE is not set -CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 -# end of Hardware Abstraction Layer (HAL) and Low Level (LL) - -# -# Heap memory debugging -# -CONFIG_HEAP_POISONING_DISABLED=y -# CONFIG_HEAP_POISONING_LIGHT is not set -# CONFIG_HEAP_POISONING_COMPREHENSIVE is not set -CONFIG_HEAP_TRACING_OFF=y -# CONFIG_HEAP_TRACING_STANDALONE is not set -# CONFIG_HEAP_TRACING_TOHOST is not set -# CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set -# end of Heap memory debugging - - -# -# LWIP -# -# CONFIG_LWIP_NETIF_API is not set -# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set -CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y -# CONFIG_LWIP_L2_TO_L3_COPY is not set -# CONFIG_LWIP_IRAM_OPTIMIZATION is not set -CONFIG_LWIP_TIMERS_ONDEMAND=y -CONFIG_LWIP_MAX_SOCKETS=8 -# CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set -# CONFIG_LWIP_SO_LINGER is not set -CONFIG_LWIP_SO_REUSE=y -CONFIG_LWIP_SO_REUSE_RXTOALL=y -CONFIG_LWIP_SO_RCVBUF=y -# CONFIG_LWIP_NETBUF_RECVINFO is not set -CONFIG_LWIP_IP4_FRAG=y -CONFIG_LWIP_IP6_FRAG=y -# CONFIG_LWIP_IP4_REASSEMBLY is not set -# CONFIG_LWIP_IP6_REASSEMBLY is not set -# CONFIG_LWIP_IP_FORWARD is not set -# CONFIG_LWIP_STATS is not set -# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set -CONFIG_LWIP_ESP_GRATUITOUS_ARP=y -CONFIG_LWIP_GARP_TMR_INTERVAL=60 -CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 -CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y -# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set -CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y -# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set -CONFIG_LWIP_DHCP_OPTIONS_LEN=68 - -# -# DHCP server -# -CONFIG_LWIP_DHCPS=y -CONFIG_LWIP_DHCPS_LEASE_UNIT=60 -CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 -# end of DHCP server - -# CONFIG_LWIP_AUTOIP is not set -CONFIG_LWIP_IPV6=y -# CONFIG_LWIP_IPV6_AUTOCONFIG is not set -CONFIG_LWIP_IPV6_NUM_ADDRESSES=3 -# CONFIG_LWIP_IPV6_FORWARD is not set -# CONFIG_LWIP_NETIF_STATUS_CALLBACK is not set -CONFIG_LWIP_NETIF_LOOPBACK=y -CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 - -# -# TCP -# -CONFIG_LWIP_MAX_ACTIVE_TCP=4 -CONFIG_LWIP_MAX_LISTENING_TCP=4 -CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y -CONFIG_LWIP_TCP_MAXRTX=12 -CONFIG_LWIP_TCP_SYNMAXRTX=6 -CONFIG_LWIP_TCP_MSS=1440 -CONFIG_LWIP_TCP_TMR_INTERVAL=250 -CONFIG_LWIP_TCP_MSL=60000 -CONFIG_LWIP_TCP_SND_BUF_DEFAULT=2880 -CONFIG_LWIP_TCP_WND_DEFAULT=2880 -CONFIG_LWIP_TCP_RECVMBOX_SIZE=6 -CONFIG_LWIP_TCP_QUEUE_OOSEQ=y -# CONFIG_LWIP_TCP_SACK_OUT is not set -# CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set -CONFIG_LWIP_TCP_OVERSIZE_MSS=y -# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set -# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set -CONFIG_LWIP_TCP_RTO_TIME=3000 -# end of TCP - -# -# UDP -# -CONFIG_LWIP_MAX_UDP_PCBS=16 -CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 -# end of UDP - -# -# Checksums -# -# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set -# CONFIG_LWIP_CHECKSUM_CHECK_UDP is not set -CONFIG_LWIP_CHECKSUM_CHECK_ICMP=y -# end of Checksums - -CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072 -CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set -# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU1 is not set -CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF -# CONFIG_LWIP_PPP_SUPPORT is not set -CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3 -CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5 -# CONFIG_LWIP_SLIP_SUPPORT is not set - -# -# ICMP -# -CONFIG_LWIP_ICMP=y -# CONFIG_LWIP_MULTICAST_PING is not set -# CONFIG_LWIP_BROADCAST_PING is not set -# end of ICMP - -# -# LWIP RAW API -# -CONFIG_LWIP_MAX_RAW_PCBS=16 -# end of LWIP RAW API - -# -# SNTP -# -CONFIG_LWIP_SNTP_MAX_SERVERS=1 -# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set -CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 -# end of SNTP - -CONFIG_LWIP_ESP_LWIP_ASSERT=y - -# -# Hooks -# -# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set -CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y -# CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM is not set -CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y -# CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set -# CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set -CONFIG_LWIP_HOOK_ND6_GET_GW_NONE=y -# CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT is not set -# CONFIG_LWIP_HOOK_ND6_GET_GW_CUSTOM is not set -CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y -# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set -# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set -# end of Hooks - -# CONFIG_LWIP_DEBUG is not set -# end of LWIP - -# -# mbedTLS -# -CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y -# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set -# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set -CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y -CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 -# CONFIG_MBEDTLS_DEBUG is not set - -# -# mbedTLS v2.28.x related -# -# CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set -CONFIG_MBEDTLS_ECDH_LEGACY_CONTEXT=y -# CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set -# CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set -CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y - -# -# DTLS-based configurations -# -# CONFIG_MBEDTLS_SSL_DTLS_CONNECTION_ID is not set -# CONFIG_MBEDTLS_SSL_DTLS_SRTP is not set -# end of DTLS-based configurations -# end of mbedTLS v2.28.x related - -# -# Certificate Bundle -# -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_FULL is not set -# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_CMN is not set -CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE=y -CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y -CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/data/roots.pem" -# end of Certificate Bundle - -CONFIG_MBEDTLS_ECP_RESTARTABLE=y -CONFIG_MBEDTLS_CMAC_C=y -CONFIG_MBEDTLS_HARDWARE_AES=y -CONFIG_MBEDTLS_HARDWARE_MPI=y -CONFIG_MBEDTLS_HARDWARE_SHA=y -CONFIG_MBEDTLS_ROM_MD5=y -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set -# CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set -CONFIG_MBEDTLS_HAVE_TIME=y -# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set -CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y -CONFIG_MBEDTLS_SHA512_C=y -CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y -# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set -# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set -# CONFIG_MBEDTLS_TLS_DISABLED is not set -CONFIG_MBEDTLS_TLS_SERVER=y -CONFIG_MBEDTLS_TLS_CLIENT=y -CONFIG_MBEDTLS_TLS_ENABLED=y - -# -# TLS Key Exchange Methods -# -CONFIG_MBEDTLS_PSK_MODES=y -CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y -CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y -CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y -CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y -# end of TLS Key Exchange Methods - -CONFIG_MBEDTLS_SSL_RENEGOTIATION=y -# CONFIG_MBEDTLS_SSL_PROTO_SSL3 is not set -# CONFIG_MBEDTLS_SSL_PROTO_TLS1 is not set -# CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 is not set -CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y -# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set -CONFIG_MBEDTLS_SSL_PROTO_DTLS=y -CONFIG_MBEDTLS_SSL_ALPN=y -CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y -CONFIG_MBEDTLS_X509_CHECK_KEY_USAGE=y -CONFIG_MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE=y -CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y - -# -# Symmetric Ciphers -# -CONFIG_MBEDTLS_AES_C=y -# CONFIG_MBEDTLS_CAMELLIA_C is not set -# CONFIG_MBEDTLS_DES_C is not set -CONFIG_MBEDTLS_RC4_DISABLED=y -# CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT is not set -# CONFIG_MBEDTLS_RC4_ENABLED is not set -# CONFIG_MBEDTLS_BLOWFISH_C is not set -# CONFIG_MBEDTLS_XTEA_C is not set -CONFIG_MBEDTLS_CCM_C=y -CONFIG_MBEDTLS_GCM_C=y -# CONFIG_MBEDTLS_NIST_KW_C is not set -# end of Symmetric Ciphers - -# CONFIG_MBEDTLS_RIPEMD160_C is not set - -# -# Certificates -# -CONFIG_MBEDTLS_PEM_PARSE_C=y -CONFIG_MBEDTLS_PEM_WRITE_C=y -CONFIG_MBEDTLS_X509_CRL_PARSE_C=y -CONFIG_MBEDTLS_X509_CSR_PARSE_C=y -# end of Certificates - -CONFIG_MBEDTLS_ECP_C=y -CONFIG_MBEDTLS_ECDH_C=y -CONFIG_MBEDTLS_ECDSA_C=y -# CONFIG_MBEDTLS_ECJPAKE_C is not set -CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y -CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y -CONFIG_MBEDTLS_ECP_NIST_OPTIM=y -# CONFIG_MBEDTLS_POLY1305_C is not set -# CONFIG_MBEDTLS_CHACHA20_C is not set -# CONFIG_MBEDTLS_HKDF_C is not set -# CONFIG_MBEDTLS_THREADING_C is not set -# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set -# CONFIG_MBEDTLS_SECURITY_RISKS is not set -# end of mbedTLS - -# -# mDNS -# -CONFIG_MDNS_MAX_SERVICES=10 -CONFIG_MDNS_TASK_PRIORITY=1 -CONFIG_MDNS_TASK_STACK_SIZE=4096 -# CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_MDNS_TASK_AFFINITY_CPU0=y -# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set -CONFIG_MDNS_TASK_AFFINITY=0x0 -CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 -# CONFIG_MDNS_STRICT_MODE is not set -CONFIG_MDNS_TIMER_PERIOD_MS=100 -# CONFIG_MDNS_NETWORKING_SOCKET is not set -CONFIG_MDNS_MULTIPLE_INSTANCE=y -# end of mDNS - -# -# Newlib -# -CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y -# CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF is not set -# CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR is not set -# CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF is not set -# CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set -CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y -# CONFIG_NEWLIB_NANO_FORMAT is not set -# end of Newlib - -# -# NVS -# -# end of NVS - -# -# OpenThread -# -# CONFIG_OPENTHREAD_ENABLED is not set -# end of OpenThread - -# -# PThreads -# -CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_PTHREAD_STACK_MIN=768 -CONFIG_PTHREAD_DEFAULT_CORE_NO_AFFINITY=y -# CONFIG_PTHREAD_DEFAULT_CORE_0 is not set -# CONFIG_PTHREAD_DEFAULT_CORE_1 is not set -CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" -# end of PThreads - # # SPI Flash driver # -# CONFIG_SPI_FLASH_VERIFY_WRITE is not set -# CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set -CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y -CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y -# CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set -# CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set -# CONFIG_SPI_FLASH_USE_LEGACY_IMPL is not set -# CONFIG_SPI_FLASH_SHARE_SPI1_BUS is not set -# CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set -# CONFIG_SPI_FLASH_YIELD_DURING_ERASE is not set -CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 -# CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set -# CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set -# CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST is not set - # # Auto-detect flash chips # -CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y -CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP=y CONFIG_SPI_FLASH_SUPPORT_TH_CHIP=y # end of Auto-detect flash chips -CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y # end of SPI Flash driver # -# Virtual file system +# Ultra Low Power (ULP) Co-processor # -CONFIG_VFS_SUPPORT_IO=y -CONFIG_VFS_SUPPORT_DIR=y -CONFIG_VFS_SUPPORT_SELECT=y -CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y -CONFIG_VFS_SUPPORT_TERMIOS=y +CONFIG_ULP_COPROC_RESERVE_MEM=4080 +# end of Ultra Low Power (ULP) Co-processor -# -# Host File System I/O (Semihosting) -# -CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -CONFIG_VFS_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 -# end of Host File System I/O (Semihosting) -# end of Virtual file system - -# -# Supplicant -# -CONFIG_WPA_MBEDTLS_CRYPTO=y -# CONFIG_WPA_WAPI_PSK is not set -# CONFIG_WPA_SUITE_B_192 is not set -# CONFIG_WPA_DEBUG_PRINT is not set -# CONFIG_WPA_TESTING_OPTIONS is not set -# CONFIG_WPA_WPS_STRICT is not set -# CONFIG_WPA_11KV_SUPPORT is not set -# CONFIG_WPA_MBO_SUPPORT is not set -# CONFIG_WPA_DPP_SUPPORT is not set -# end of Supplicant # end of Component config -# -# Compatibility options -# -# CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set -# end of Compatibility options - -# Deprecated options for backward compatibility -CONFIG_TOOLPREFIX="xtensa-esp32-elf-" -CONFIG_LOG_BOOTLOADER_LEVEL_NONE=y -# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=0 -# CONFIG_APP_ROLLBACK_ENABLE is not set -# CONFIG_FLASH_ENCRYPTION_ENABLED is not set -# CONFIG_FLASHMODE_QIO is not set -# CONFIG_FLASHMODE_QOUT is not set -CONFIG_FLASHMODE_DIO=y -# CONFIG_FLASHMODE_DOUT is not set -# CONFIG_MONITOR_BAUD_9600B is not set -# CONFIG_MONITOR_BAUD_57600B is not set -CONFIG_MONITOR_BAUD_115200B=y -# CONFIG_MONITOR_BAUD_230400B is not set -# CONFIG_MONITOR_BAUD_921600B is not set -# CONFIG_MONITOR_BAUD_2MB is not set -# CONFIG_MONITOR_BAUD_OTHER is not set -CONFIG_MONITOR_BAUD_OTHER_VAL=115200 -CONFIG_MONITOR_BAUD=115200 -# CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set -CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE=y -CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y -# CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set -# CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set -CONFIG_OPTIMIZATION_ASSERTION_LEVEL=2 -# CONFIG_CXX_EXCEPTIONS is not set -CONFIG_STACK_CHECK_NONE=y -# CONFIG_STACK_CHECK_NORM is not set -# CONFIG_STACK_CHECK_STRONG is not set -# CONFIG_STACK_CHECK_ALL is not set -# CONFIG_WARN_WRITE_STRINGS is not set -# CONFIG_DISABLE_GCC8_WARNINGS is not set -# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set -CONFIG_ESP32_APPTRACE_DEST_NONE=y -CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y -CONFIG_ADC2_DISABLE_DAC=y -CONFIG_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_ULP_COPROC_ENABLED is not set -CONFIG_ULP_COPROC_RESERVE_MEM=0 -CONFIG_BROWNOUT_DET=y -CONFIG_BROWNOUT_DET_LVL_SEL_0=y -# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_4 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set -CONFIG_BROWNOUT_DET_LVL=0 -CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y -# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set -# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set -# CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set -# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_NO_BLOBS is not set -# CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set -# CONFIG_EVENT_LOOP_PROFILING is not set -CONFIG_POST_EVENTS_FROM_ISR=y -CONFIG_POST_EVENTS_FROM_IRAM_ISR=y -# CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set -CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y -CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 -# CONFIG_ESP32C3_LIGHTSLEEP_GPIO_RESET_WORKAROUND is not set -CONFIG_IPC_TASK_STACK_SIZE=1536 -CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP32_PHY_MAX_TX_POWER=20 -CONFIG_ESP32_REDUCE_PHY_TX_POWER=y -CONFIG_ESP32S2_PANIC_PRINT_HALT=y -# CONFIG_ESP32S2_PANIC_PRINT_REBOOT is not set -# CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP32S2_PANIC_GDBSTUB is not set -CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -# CONFIG_CONSOLE_UART_DEFAULT is not set -# CONFIG_CONSOLE_UART_CUSTOM is not set -CONFIG_ESP_CONSOLE_UART_NONE=y -CONFIG_CONSOLE_UART_NUM=-1 -CONFIG_INT_WDT=y -CONFIG_INT_WDT_TIMEOUT_MS=300 -CONFIG_INT_WDT_CHECK_CPU1=y -# CONFIG_TASK_WDT is not set -# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set -CONFIG_TIMER_TASK_STACK_SIZE=3584 -# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set -# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set -CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y -# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set -CONFIG_TIMER_TASK_PRIORITY=1 -CONFIG_TIMER_TASK_STACK_DEPTH=2048 -CONFIG_TIMER_QUEUE_LENGTH=10 -# CONFIG_L2_TO_L3_COPY is not set -# CONFIG_USE_ONLY_LWIP_SELECT is not set -CONFIG_ESP_GRATUITOUS_ARP=y -CONFIG_GARP_TMR_INTERVAL=60 -CONFIG_TCPIP_RECVMBOX_SIZE=32 -CONFIG_TCP_MAXRTX=12 -CONFIG_TCP_SYNMAXRTX=6 -CONFIG_TCP_MSS=1440 -CONFIG_TCP_MSL=60000 -CONFIG_TCP_SND_BUF_DEFAULT=2880 -CONFIG_TCP_WND_DEFAULT=2880 -CONFIG_TCP_RECVMBOX_SIZE=6 -CONFIG_TCP_QUEUE_OOSEQ=y -# CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set -CONFIG_TCP_OVERSIZE_MSS=y -# CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set -# CONFIG_TCP_OVERSIZE_DISABLE is not set -CONFIG_UDP_RECVMBOX_SIZE=6 -CONFIG_TCPIP_TASK_STACK_SIZE=3072 -CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_TCPIP_TASK_AFFINITY_CPU0 is not set -# CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set -CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF -# CONFIG_PPP_SUPPORT is not set -CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 -CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 -CONFIG_ESP32_PTHREAD_STACK_MIN=768 -CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y -# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0 is not set -# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1 is not set -CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 -CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" -CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y -# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set -# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set -CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y -CONFIG_SUPPORT_TERMIOS=y -CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 -# End of deprecated options +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults index 747d2ba729..310a95b86b 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults @@ -1,11 +1,47 @@ -# This file was generated using idf.py save-defconfig. It can be edited manually. -# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# Bluetooth +# +# +# NimBLE Options # CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=y +# end of NimBLE Options +# end of Bluetooth + +# +# ESP System Settings +# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1=y +# end of ESP System Settings -CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM=y +# +# IPC (Inter-Processor Call) +# +CONFIG_ESP_IPC_TASK_STACK_SIZE=1536 +# end of IPC (Inter-Processor Call) -CONFIG_ULP_COPROC_ENABLED=y +# +# Wi-Fi +# +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 +# CONFIG_ESP32_WIFI_NVS_ENABLED is not set +# end of Wi-Fi + +# +# Ultra Low Power (ULP) Co-processor +# CONFIG_ULP_COPROC_RESERVE_MEM=8176 +# end of Ultra Low Power (ULP) Co-processor + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-16MB-no-uf2.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-16MB-no-uf2.defaults similarity index 100% rename from ports/espressif/esp-idf-config/sdkconfig-16MB-no-uf2.defaults rename to ports/espressif/esp-idf-config/sdkconfig-flash-16MB-no-uf2.defaults diff --git a/ports/espressif/esp-idf-config/sdkconfig-16MB.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-16MB.defaults similarity index 66% rename from ports/espressif/esp-idf-config/sdkconfig-16MB.defaults rename to ports/espressif/esp-idf-config/sdkconfig-flash-16MB.defaults index fac8ba1cad..cc5d54fec4 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-16MB.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-16MB.defaults @@ -1,4 +1,7 @@ # +# Espressif IoT Development Framework Configuration +# +# # Serial flasher config # # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set @@ -6,13 +9,17 @@ # CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set CONFIG_ESPTOOLPY_FLASHSIZE_16MB=y +# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set CONFIG_ESPTOOLPY_FLASHSIZE="16MB" -CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y # end of Serial flasher config -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-16MB.csv" # # Partition Table # +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-16MB.csv" CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-16MB.csv" # end of Partition Table + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-2MB-no-ota-no-uf2.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-2MB-no-ota-no-uf2.defaults similarity index 100% rename from ports/espressif/esp-idf-config/sdkconfig-2MB-no-ota-no-uf2.defaults rename to ports/espressif/esp-idf-config/sdkconfig-flash-2MB-no-ota-no-uf2.defaults diff --git a/ports/espressif/esp-idf-config/sdkconfig-32MB.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-32MB.defaults similarity index 100% rename from ports/espressif/esp-idf-config/sdkconfig-32MB.defaults rename to ports/espressif/esp-idf-config/sdkconfig-flash-32MB.defaults diff --git a/ports/espressif/esp-idf-config/sdkconfig-flash-40m.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-40m.defaults new file mode 100644 index 0000000000..2900c10879 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-40m.defaults @@ -0,0 +1,10 @@ +# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_60M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_48M is not set +CONFIG_ESPTOOLPY_FLASHFREQ_40M=y +# CONFIG_ESPTOOLPY_FLASHFREQ_30M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_24M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_15M is not set diff --git a/ports/espressif/esp-idf-config/sdkconfig-4MB-1ota.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-4MB-1ota.defaults similarity index 100% rename from ports/espressif/esp-idf-config/sdkconfig-4MB-1ota.defaults rename to ports/espressif/esp-idf-config/sdkconfig-flash-4MB-1ota.defaults diff --git a/ports/espressif/esp-idf-config/sdkconfig-4MB-no-uf2.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-4MB-no-uf2.defaults similarity index 100% rename from ports/espressif/esp-idf-config/sdkconfig-4MB-no-uf2.defaults rename to ports/espressif/esp-idf-config/sdkconfig-flash-4MB-no-uf2.defaults diff --git a/ports/espressif/esp-idf-config/sdkconfig-4MB.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-4MB.defaults similarity index 66% rename from ports/espressif/esp-idf-config/sdkconfig-4MB.defaults rename to ports/espressif/esp-idf-config/sdkconfig-flash-4MB.defaults index 69f15ebe7b..811c9ea37d 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-4MB.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-4MB.defaults @@ -1,4 +1,7 @@ # +# Espressif IoT Development Framework Configuration +# +# # Serial flasher config # # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set @@ -6,13 +9,17 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set CONFIG_ESPTOOLPY_FLASHSIZE="4MB" -CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y # end of Serial flasher config -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB.csv" # # Partition Table # +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB.csv" CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB.csv" # end of Partition Table + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-flash-80m.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-80m.defaults new file mode 100644 index 0000000000..949113b7cf --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-80m.defaults @@ -0,0 +1,10 @@ +# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set +CONFIG_ESPTOOLPY_FLASHFREQ_80M=y +# CONFIG_ESPTOOLPY_FLASHFREQ_60M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_48M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_30M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_24M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_15M is not set diff --git a/ports/espressif/esp-idf-config/sdkconfig-8MB-no-uf2.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-8MB-no-uf2.defaults similarity index 100% rename from ports/espressif/esp-idf-config/sdkconfig-8MB-no-uf2.defaults rename to ports/espressif/esp-idf-config/sdkconfig-flash-8MB-no-uf2.defaults diff --git a/ports/espressif/esp-idf-config/sdkconfig-8MB.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-8MB.defaults similarity index 66% rename from ports/espressif/esp-idf-config/sdkconfig-8MB.defaults rename to ports/espressif/esp-idf-config/sdkconfig-flash-8MB.defaults index 1ecb1b4c16..c64775aa1c 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-8MB.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-8MB.defaults @@ -1,4 +1,7 @@ # +# Espressif IoT Development Framework Configuration +# +# # Serial flasher config # # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set @@ -6,8 +9,10 @@ # CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set CONFIG_ESPTOOLPY_FLASHSIZE="8MB" -CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y # end of Serial flasher config # @@ -16,3 +21,5 @@ CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-8MB.csv" CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-8MB.csv" # end of Partition Table + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-flash-dio.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-dio.defaults new file mode 100644 index 0000000000..12ef8ad896 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-dio.defaults @@ -0,0 +1,6 @@ +# CONFIG_ESPTOOLPY_OCT_FLASH is not set +# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set +# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set +CONFIG_ESPTOOLPY_FLASHMODE_DIO=y +# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +# CONFIG_ESPTOOLPY_FLASHMODE_OPI is not set diff --git a/ports/espressif/esp-idf-config/sdkconfig-flash-qio.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-qio.defaults new file mode 100644 index 0000000000..647dd84dda --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-qio.defaults @@ -0,0 +1,6 @@ +# CONFIG_ESPTOOLPY_OCT_FLASH is not set +CONFIG_ESPTOOLPY_FLASHMODE_QIO=y +# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set +# CONFIG_ESPTOOLPY_FLASHMODE_DIO is not set +# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +# CONFIG_ESPTOOLPY_FLASHMODE_OPI is not set diff --git a/ports/espressif/esp-idf-config/sdkconfig-opt.defaults b/ports/espressif/esp-idf-config/sdkconfig-opt.defaults index ca38be15f2..46efd79e45 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-opt.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-opt.defaults @@ -1,15 +1,41 @@ -# This file was generated using idf.py save-defconfig. It can be edited manually. -# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration +# +# Espressif IoT Development Framework Configuration +# +# +# Bootloader config # CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y +# end of Bootloader config -CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y +# +# Compiler options +# CONFIG_COMPILER_OPTIMIZATION_SIZE=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y +# end of Compiler options -CONFIG_ESP_CONSOLE_NONE=y - -CONFIG_ESP_ERR_TO_NAME_LOOKUP=n +# +# Component config +# +# +# Common ESP-related +# +# CONFIG_ESP_ERR_TO_NAME_LOOKUP is not set +# end of Common ESP-related +# +# ESP System Settings +# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y +CONFIG_ESP_CONSOLE_NONE=y +# end of ESP System Settings +# +# Log output +# CONFIG_LOG_DEFAULT_LEVEL_NONE=y +# end of Log output + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram-2MB.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram-2MB.defaults new file mode 100644 index 0000000000..296f7112cb --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-psram-2MB.defaults @@ -0,0 +1,4 @@ +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram-40m.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram-40m.defaults new file mode 100644 index 0000000000..344bca55ee --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-psram-40m.defaults @@ -0,0 +1,2 @@ +CONFIG_SPIRAM_SPEED_40M=y +# CONFIG_SPIRAM_SPEED_80M is not set diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram-80m.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram-80m.defaults new file mode 100644 index 0000000000..7a2e500409 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-psram-80m.defaults @@ -0,0 +1,3 @@ +# CONFIG_SPIRAM_SPEED_120M is not set +CONFIG_SPIRAM_SPEED_80M=y +# CONFIG_SPIRAM_SPEED_40M is not set diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram-8MB.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram-8MB.defaults new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram-opi.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram-opi.defaults new file mode 100644 index 0000000000..05133e84c4 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-psram-opi.defaults @@ -0,0 +1,2 @@ +# CONFIG_SPIRAM_MODE_QUAD is not set +CONFIG_SPIRAM_MODE_OCT=y diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram-qio.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram-qio.defaults new file mode 100644 index 0000000000..d93069e02b --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-psram-qio.defaults @@ -0,0 +1 @@ +CONFIG_SPIRAM_MODE_QUAD=y diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram.defaults new file mode 100644 index 0000000000..0da8eaf53d --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-psram.defaults @@ -0,0 +1,27 @@ +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# ESP PSRAM +# +CONFIG_SPIRAM=y +# +# SPI RAM config +# +CONFIG_SPIRAM_USE_MEMMAP=y +# end of SPI RAM config + +# end of ESP PSRAM + +# +# Wi-Fi +# +CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 +# end of Wi-Fi + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index c3c32a1fa3..3b52c2a565 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -1,56 +1,137 @@ -# This file was generated using idf.py save-defconfig. It can be edited manually. -# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration +# +# Espressif IoT Development Framework Configuration +# +# +# Partition Table +# +CONFIG_PARTITION_TABLE_CUSTOM=y +# end of Partition Table + +# +# Component config +# +# +# Driver Configurations +# +# +# Legacy ADC Configuration +# +CONFIG_ADC_SUPPRESS_DEPRECATE_WARN=y +# end of Legacy ADC Configuration + +# +# GPTimer Configuration +# +CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN=y +# end of GPTimer Configuration + +# +# PCNT Configuration +# +CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y +# end of PCNT Configuration + +# +# RMT Configuration +# +CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y +# end of RMT Configuration + +# +# I2S Configuration +# +CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y +# end of I2S Configuration + +# end of Driver Configurations + +# +# ESP-TLS +# +CONFIG_ESP_TLS_SERVER=y +# end of ESP-TLS + +# +# ESP System Settings # CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +# +# Memory +# +CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM=y +# end of Memory -CONFIG_ESP_IPC_TASK_STACK_SIZE=1536 CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384 +# CONFIG_ESP_TASK_WDT_INIT is not set +# end of ESP System Settings -CONFIG_ESP_TASK_WDT_INIT=n - -CONFIG_ESP_TLS_SERVER=y - -CONFIG_LWIP_MAX_ACTIVE_TCP=4 -CONFIG_LWIP_MAX_LISTENING_TCP=4 +# +# LWIP +# CONFIG_LWIP_MAX_SOCKETS=8 CONFIG_LWIP_SO_RCVBUF=y - -CONFIG_LWIP_TCP_RTO_TIME=3000 - -CONFIG_LWIP_TCP_SND_BUF_DEFAULT=2880 +# +# TCP +# +CONFIG_LWIP_MAX_ACTIVE_TCP=4 +CONFIG_LWIP_MAX_LISTENING_TCP=4 CONFIG_LWIP_TCP_SYNMAXRTX=6 +CONFIG_LWIP_TCP_SND_BUF_DEFAULT=2880 CONFIG_LWIP_TCP_WND_DEFAULT=2880 +CONFIG_LWIP_TCP_RTO_TIME=3000 +# end of TCP +# end of LWIP + +# +# mbedTLS +# +CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 +# +# Certificate Bundle +# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE_DEFAULT_NONE=y -CONFIG_MBEDTLS_CMAC_C=y - CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/data/roots.pem" # end of Certificate Bundle -CONFIG_MBEDTLS_ECP_RESTARTABLE=y - -CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y -CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y -CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y +# +# TLS Key Exchange Methods +# CONFIG_MBEDTLS_PSK_MODES=y +CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y +# end of TLS Key Exchange Methods -CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 CONFIG_MBEDTLS_SSL_PROTO_DTLS=y +# end of mbedTLS -CONFIG_PARTITION_TABLE_CUSTOM=y - +# +# SPI Flash driver +# +# CONFIG_SPI_FLASH_YIELD_DURING_ERASE is not set CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 -CONFIG_SPI_FLASH_YIELD_DURING_ERASE=n +# end of SPI Flash driver -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 -CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 -CONFIG_ESP32_WIFI_NVS_ENABLED=n +# +# Ultra Low Power (ULP) Co-processor +# +CONFIG_ULP_COPROC_ENABLED=y +# end of Ultra Low Power (ULP) Co-processor -CONFIG_ADC_SUPPRESS_DEPRECATE_WARN=y -CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y -CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y -CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN=y -CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y +# +# Camera configuration +# +# CONFIG_OV7670_SUPPORT is not set +# CONFIG_NT99141_SUPPORT is not set +# CONFIG_OV2640_SUPPORT is not set +# CONFIG_GC2145_SUPPORT is not set +# CONFIG_GC032A_SUPPORT is not set +# CONFIG_GC0308_SUPPORT is not set +# CONFIG_BF3005_SUPPORT is not set +# CONFIG_BF20A6_SUPPORT is not set +# CONFIG_SC030IOT_SUPPORT is not set +# end of Camera configuration + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index 1f91becd2b..24f580944f 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -53,21 +53,42 @@ TARGET_SETTINGS = [ "CONFIG_NIMBLE_PINNED_TO_CORE", "CONFIG_BT_NIMBLE_PINNED_TO_CORE", "CONFIG_BT_CTRL_PINNED_TO_CORE", + "CONFIG_SPIRAM_SPEED_2", + "CONFIG_SPIRAM_BANKSWITCH_ENABLE", # For ESP32 ] BOARD_SETTINGS = [ - "CONFIG_SPIRAM", - "CONFIG_DEFAULT_PSRAM_", - "_SPIRAM_SUPPORT", "CONFIG_LWIP_LOCAL_HOSTNAME", ] -FLASH_SETTINGS = [ +FLASH_SIZE_SETTINGS = [ "CONFIG_ESPTOOLPY_FLASHSIZE", "CONFIG_PARTITION_TABLE_CUSTOM_FILENAME", "CONFIG_PARTITION_TABLE_FILENAME", ] +FLASH_MODE_SETTINGS = [ + "CONFIG_ESPTOOLPY_FLASHMODE_", + "CONFIG_ESPTOOLPY_OCT_FLASH", + "CONFIG_ESPTOOLPY_FLASH_SAMBLE_MODE_", +] + +FLASH_FREQ_SETTINGS = [ + "CONFIG_ESPTOOLPY_FLASHFREQ_", +] + +PSRAM_SETTINGS = ["CONFIG_SPIRAM"] + +PSRAM_SIZE_SETTINGS = ["CONFIG_SPIRAM_TYPE_"] + +PSRAM_MODE_SETTINGS = ["CONFIG_SPIRAM_MODE_"] + +PSRAM_FREQ_SETTINGS = ["CONFIG_SPIRAM_SPEED_"] + +# Some settings are target dependent but we want to always include them anyway +# because the files they are in will be used across targets. +ALWAYS_INCLUDE = FLASH_MODE_SETTINGS + FLASH_FREQ_SETTINGS + PSRAM_FREQ_SETTINGS + BLE_SETTINGS = ["CONFIG_BT_", "CONFIG_BLUEDROID_", "CONFIG_NIMBLE_", "CONFIG_SW_COEXIST_ENABLE"] # boards/lilygo_ttgo_t8_s2_st7789/sdkconfig @@ -141,11 +162,27 @@ def update(debug, board, update_all): was likely modified by menuconfig.""" board_make = pathlib.Path(f"boards/{board}/mpconfigboard.mk") + psram_size = "0" for line in board_make.read_text().split("\n"): - if line.startswith("IDF_TARGET"): - target = line.split("=")[1].strip() - elif line.startswith("CIRCUITPY_ESP_FLASH_SIZE"): - flash = line.split("=")[1].strip() + if "=" not in line or line.startswith("#"): + continue + key, value = line.split("=", maxsplit=1) + key = key.strip() + value = value.strip() + if key == "IDF_TARGET": + target = value + elif key == "CIRCUITPY_ESP_FLASH_SIZE": + flash_size = value + elif key == "CIRCUITPY_ESP_FLASH_MODE": + flash_mode = value + elif key == "CIRCUITPY_ESP_FLASH_FREQ": + flash_freq = value + elif key == "CIRCUITPY_ESP_PSRAM_SIZE": + psram_size = value + elif key == "CIRCUITPY_ESP_PSRAM_MODE": + psram_mode = value + elif key == "CIRCUITPY_ESP_PSRAM_FREQ": + psram_freq = value os.environ["IDF_TARGET"] = target os.environ[ @@ -161,24 +198,47 @@ def update(debug, board, update_all): input_config = pathlib.Path(f"build-{board}/esp-idf/sdkconfig") kconfig.load_config(input_config) + sdkconfigs = [] default_config = pathlib.Path("esp-idf-config/sdkconfig.defaults") + sdkconfigs.append(default_config) if debug: opt_config = pathlib.Path("esp-idf-config/sdkconfig-debug.defaults") else: opt_config = pathlib.Path("esp-idf-config/sdkconfig-opt.defaults") - flash_config = pathlib.Path(f"esp-idf-config/sdkconfig-{flash}.defaults") + sdkconfigs.append(opt_config) + flash_size_config = pathlib.Path(f"esp-idf-config/sdkconfig-flash-{flash_size}.defaults") + flash_mode_config = pathlib.Path(f"esp-idf-config/sdkconfig-flash-{flash_mode}.defaults") + flash_freq_config = pathlib.Path(f"esp-idf-config/sdkconfig-flash-{flash_freq}.defaults") + sdkconfigs.extend((flash_size_config, flash_mode_config, flash_freq_config)) + + if psram_size != "0": + psram_config = pathlib.Path(f"esp-idf-config/sdkconfig-psram.defaults") + psram_size_config = pathlib.Path(f"esp-idf-config/sdkconfig-psram-{psram_size}.defaults") + psram_mode_config = pathlib.Path(f"esp-idf-config/sdkconfig-psram-{psram_mode}.defaults") + psram_freq_config = pathlib.Path(f"esp-idf-config/sdkconfig-psram-{psram_freq}.defaults") + sdkconfigs.extend((psram_config, psram_size_config, psram_mode_config, psram_freq_config)) target_config = pathlib.Path(f"esp-idf-config/sdkconfig-{target}.defaults") + sdkconfigs.append(target_config) ble_config = pathlib.Path(f"esp-idf-config/sdkconfig-ble.defaults") + sdkconfigs.append(ble_config) board_config = pathlib.Path(f"boards/{board}/sdkconfig") + sdkconfigs.append(board_config) cp_kconfig_defaults = kconfiglib.Kconfig(kconfig_path) - for default_file in (default_config, opt_config, flash_config, target_config, ble_config): + for default_file in sdkconfigs: cp_kconfig_defaults.load_config(default_file, replace=False) board_settings = [] last_board_group = None - flash_settings = [] - last_flash_group = None + flash_size_settings = [] + last_flash_size_group = None + flash_mode_settings = [] + flash_freq_settings = [] + psram_settings = [] + last_psram_group = None + psram_size_settings = [] + psram_mode_settings = [] + psram_freq_settings = [] opt_settings = [] last_opt_group = None target_settings = [] @@ -222,7 +282,11 @@ def update(debug, board, update_all): config_string = item.config_string.strip() if not config_string: - continue + if matches_group("CONFIG_" + item.name, ALWAYS_INCLUDE): + config_string = f"# CONFIG_{item.name} is not set" + print(config_string) + else: + continue if node.list: pending_nodes.append(node.list) @@ -234,33 +298,65 @@ def update(debug, board, update_all): print(" " * len(current_group), i, config_string.strip()) target_reference = False - board_reference = False + psram_reference = False for referenced in item.referenced: if referenced.name.startswith("IDF_TARGET"): # print(item.name, "references", referenced.name) target_reference = True break if referenced.name == "SPIRAM": - board_reference = True + psram_reference = True if (not update_all and not matches_cp_default) or ( update_all - and (matches_group(config_string, BOARD_SETTINGS) or board_reference) + and matches_group(config_string, BOARD_SETTINGS) and not matches_esp_default ): print(" " * (len(current_group) + 1), "board") last_board_group = add_group(board_settings, last_board_group, current_group) board_settings.append(config_string) - elif update_all and not matches_esp_default: - if matches_group(config_string, OPT_SETTINGS): + elif update_all: + target_setting = target_reference or matches_group(config_string, TARGET_SETTINGS) + if matches_group(config_string, FLASH_SIZE_SETTINGS): + print(" " * (len(current_group) + 1), "flash size") + last_flash_size_group = add_group( + flash_size_settings, last_flash_size_group, current_group + ) + flash_size_settings.append(config_string) + elif matches_group(config_string, FLASH_MODE_SETTINGS): + print(" " * (len(current_group) + 1), "flash mode") + flash_mode_settings.append(config_string) + elif matches_group(config_string, FLASH_FREQ_SETTINGS): + print(" " * (len(current_group) + 1), "flash freq") + flash_freq_settings.append(config_string) + elif matches_group(config_string, PSRAM_SIZE_SETTINGS): + print(" " * (len(current_group) + 1), "psram size") + psram_size_settings.append(config_string) + elif matches_group(config_string, PSRAM_MODE_SETTINGS): + print(" " * (len(current_group) + 1), "psram mode") + psram_mode_settings.append(config_string) + elif matches_group(config_string, PSRAM_FREQ_SETTINGS) and not target_setting: + # The ESP32S2 has two frequencies that aren't on the S3 or ESP32. So, put those + # in target settings. + print(" " * (len(current_group) + 1), "psram freq") + psram_freq_settings.append(config_string) + elif matches_esp_default: + # Always document the above settings. Settings below should + # be non-default. + pass + elif ( + (matches_group(config_string, PSRAM_SETTINGS) or psram_reference) + and not target_reference + and not target_setting + ): + print(" " * (len(current_group) + 1), "psram shared") + last_psram_group = add_group(psram_settings, last_psram_group, current_group) + psram_settings.append(config_string) + elif matches_group(config_string, OPT_SETTINGS): print(" " * (len(current_group) + 1), "opt") last_opt_group = add_group(opt_settings, last_opt_group, current_group) opt_settings.append(config_string) - elif matches_group(config_string, FLASH_SETTINGS): - print(" " * (len(current_group) + 1), "flash") - last_flash_group = add_group(flash_settings, last_flash_group, current_group) - flash_settings.append(config_string) - elif target_reference or matches_group(config_string, TARGET_SETTINGS): + elif target_setting: print(" " * (len(current_group) + 1), "target") last_target_group = add_group( target_settings, last_target_group, current_group @@ -294,14 +390,22 @@ def update(debug, board, update_all): add_group(board_settings, last_board_group, current_group) add_group(opt_settings, last_opt_group, current_group) - add_group(flash_settings, last_flash_group, current_group) + add_group(flash_size_settings, last_flash_size_group, current_group) + add_group(psram_settings, last_psram_group, current_group) add_group(target_settings, last_target_group, current_group) add_group(ble_settings, last_ble_group, current_group) add_group(default_settings, last_default_group, current_group) board_config.write_text("\n".join(board_settings)) if update_all: - flash_config.write_text("\n".join(flash_settings)) + flash_size_config.write_text("\n".join(flash_size_settings)) + flash_mode_config.write_text("\n".join(flash_mode_settings)) + flash_freq_config.write_text("\n".join(flash_freq_settings)) + if psram_size != "0": + psram_config.write_text("\n".join(psram_settings)) + psram_size_config.write_text("\n".join(psram_size_settings)) + psram_mode_config.write_text("\n".join(psram_mode_settings)) + psram_freq_config.write_text("\n".join(psram_freq_settings)) opt_config.write_text("\n".join(opt_settings)) default_config.write_text("\n".join(default_settings)) target_config.write_text("\n".join(target_settings)) From 1ab083fab73dc4987542fd90abb18f67d7eb47d7 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 8 Sep 2023 12:10:49 -0700 Subject: [PATCH 1675/1712] Support target specific kconfig source --- ports/espressif/CMakeLists.txt | 4 +- .../adafruit_esp32s3_camera/mpconfigboard.mk | 2 +- .../adafruit_feather_esp32s2/mpconfigboard.mk | 2 + ports/espressif/{esp32-camera => esp-camera} | 0 .../esp-idf-config/sdkconfig-esp32.defaults | 25 ++++++ .../sdkconfig-psram-2MB.defaults | 4 +- ports/espressif/tools/update_sdkconfig.py | 84 +++++++++++++++---- 7 files changed, 98 insertions(+), 23 deletions(-) rename ports/espressif/{esp32-camera => esp-camera} (100%) diff --git a/ports/espressif/CMakeLists.txt b/ports/espressif/CMakeLists.txt index de163638da..995f8eb76a 100644 --- a/ports/espressif/CMakeLists.txt +++ b/ports/espressif/CMakeLists.txt @@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.16) set(ENV{IDF_PATH} ${CMAKE_SOURCE_DIR}/esp-idf) # The component list here determines what options we get in menuconfig and what the ninja file can build. -set(COMPONENTS bt driver esp-tls esp_adc_cal esp_event esp_netif esp_psram esp_wifi esptool_py freertos log lwip main mbedtls mdns soc ulp usb wpa_supplicant esp32-camera esp_lcd) -set(EXTRA_COMPONENT_DIRS "esp-protocols/components/mdns" "esp32-camera") +set(COMPONENTS bt driver esp-tls esp_adc_cal esp_event esp_netif esp_psram esp_wifi esptool_py freertos log lwip main mbedtls mdns soc ulp usb wpa_supplicant esp-camera esp_lcd) +set(EXTRA_COMPONENT_DIRS "esp-protocols/components/mdns" "esp-camera") include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(circuitpython) diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk index 02f776f15d..57087cf0e0 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk @@ -6,7 +6,7 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio -CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB CIRCUITPY_ESP_PSRAM_MODE = qio diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.mk index ed6ae99976..a5ee61ed55 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s2/mpconfigboard.mk @@ -10,3 +10,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/esp32-camera b/ports/espressif/esp-camera similarity index 100% rename from ports/espressif/esp32-camera rename to ports/espressif/esp-camera diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults index 0aa6343a06..980619b7a6 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults @@ -16,8 +16,32 @@ # CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT is not set # end of TWAI Configuration +# +# PCNT Configuration +# +CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y +# end of PCNT Configuration + +# +# RMT Configuration +# +CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y +# end of RMT Configuration + +# +# I2S Configuration +# +CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y +# end of I2S Configuration + # end of Driver Configurations +# +# ESP System Settings +# +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +# end of ESP System Settings + # # IPC (Inter-Processor Call) # @@ -47,6 +71,7 @@ CONFIG_SPI_FLASH_SUPPORT_TH_CHIP=y # # Ultra Low Power (ULP) Co-processor # +CONFIG_ULP_COPROC_ENABLED=y CONFIG_ULP_COPROC_RESERVE_MEM=4080 # end of Ultra Low Power (ULP) Co-processor diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram-2MB.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram-2MB.defaults index 296f7112cb..154e9517e5 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-psram-2MB.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-psram-2MB.defaults @@ -1,4 +1,4 @@ -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_AUTO is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM16=y # CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set # CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index 24f580944f..f8e4b5a4f3 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -248,6 +248,9 @@ def update(debug, board, update_all): default_settings = [] last_default_group = None + target_kconfig_snippets = set() + target_symbols = set() + current_group = [] for sym in kconfig.unique_defined_syms: @@ -282,11 +285,11 @@ def update(debug, board, update_all): config_string = item.config_string.strip() if not config_string: - if matches_group("CONFIG_" + item.name, ALWAYS_INCLUDE): + cp_sym = cp_kconfig_defaults.syms[item.name] + if cp_sym.str_value == "n": config_string = f"# CONFIG_{item.name} is not set" - print(config_string) else: - continue + config_string = "" if node.list: pending_nodes.append(node.list) @@ -294,14 +297,51 @@ def update(debug, board, update_all): matches_cp_default = cp_kconfig_defaults.syms[item.name].str_value == item.str_value matches_esp_default = sym_default(item) - if not matches_esp_default: + print_debug = not matches_esp_default + if print_debug: print(" " * len(current_group), i, config_string.strip()) - target_reference = False + # Some files are `rsource`d into another kconfig with $IDF_TARGET as + # part of the path. kconfiglib doesn't show this as a reference so + # we have to look ourselves. + target_reference = target in item.name_and_loc + if target_reference: + loc = item.name_and_loc.split("defined at ")[1].split(":")[0].replace(target, "*") + if loc not in target_kconfig_snippets: + differing_keys = set() + shared_keys = {} + first = True + for path in pathlib.Path(".").glob(loc): + kc = kconfiglib.Kconfig(path) + all_file_syms = set() + for sym in kc.unique_defined_syms: + all_file_syms.add(sym) + if sym.name in differing_keys: + continue + if first: + shared_keys[sym.name] = sym.str_value + elif ( + sym.name not in shared_keys + or shared_keys[sym.name] != sym.str_value + ): + differing_keys.add(sym.name) + if sym.name in shared_keys: + del shared_keys[sym.name] + # Any settings missing from a file are *not* shared. + shared_syms = set(shared_keys.keys()) + for missing in shared_syms - all_file_syms: + differing_keys.add(missing) + del shared_keys[missing] + first = False + target_kconfig_snippets.add(loc) + target_symbols = target_symbols.union(differing_keys) psram_reference = False for referenced in item.referenced: if referenced.name.startswith("IDF_TARGET"): - # print(item.name, "references", referenced.name) + target_reference = True + break + if referenced.name in target_symbols: + # Implicit target symbols target_reference = True break if referenced.name == "SPIRAM": @@ -335,20 +375,22 @@ def update(debug, board, update_all): elif matches_group(config_string, PSRAM_MODE_SETTINGS): print(" " * (len(current_group) + 1), "psram mode") psram_mode_settings.append(config_string) - elif matches_group(config_string, PSRAM_FREQ_SETTINGS) and not target_setting: - # The ESP32S2 has two frequencies that aren't on the S3 or ESP32. So, put those - # in target settings. + elif ( + matches_group(config_string, PSRAM_FREQ_SETTINGS) + and "26M" not in config_string + and "20M" not in config_string + ): + # The ESP32S2 has two frequencies (20M and 26M) that aren't on the S3 or ESP32. + # So, put those in target settings. print(" " * (len(current_group) + 1), "psram freq") psram_freq_settings.append(config_string) elif matches_esp_default: + if print_debug: + print(" " * (len(current_group) + 1), "default") # Always document the above settings. Settings below should # be non-default. pass - elif ( - (matches_group(config_string, PSRAM_SETTINGS) or psram_reference) - and not target_reference - and not target_setting - ): + elif matches_group(config_string, PSRAM_SETTINGS) or psram_reference: print(" " * (len(current_group) + 1), "psram shared") last_psram_group = add_group(psram_settings, last_psram_group, current_group) psram_settings.append(config_string) @@ -373,12 +415,11 @@ def update(debug, board, update_all): ) default_settings.append(config_string) - elif kconfiglib.expr_value(node.dep): + else: if item is kconfiglib.COMMENT: print("comment", repr(item)) elif item is kconfiglib.MENU: - # This menu isn't visible so skip to the next node. - if kconfiglib.expr_value(node.visibility) and node.list: + if node.list: current_group.append(node.prompt[0]) pending_nodes.append(None) pending_nodes.append(node.list) @@ -398,10 +439,16 @@ def update(debug, board, update_all): board_config.write_text("\n".join(board_settings)) if update_all: + # Add empty strings to get trailing newlines + flash_mode_settings.append("") + flash_freq_settings.append("") flash_size_config.write_text("\n".join(flash_size_settings)) flash_mode_config.write_text("\n".join(flash_mode_settings)) flash_freq_config.write_text("\n".join(flash_freq_settings)) if psram_size != "0": + psram_size_settings.append("") + psram_mode_settings.append("") + psram_freq_settings.append("") psram_config.write_text("\n".join(psram_settings)) psram_size_config.write_text("\n".join(psram_size_settings)) psram_mode_config.write_text("\n".join(psram_mode_settings)) @@ -409,7 +456,8 @@ def update(debug, board, update_all): opt_config.write_text("\n".join(opt_settings)) default_config.write_text("\n".join(default_settings)) target_config.write_text("\n".join(target_settings)) - ble_config.write_text("\n".join(ble_settings)) + if ble_settings: + ble_config.write_text("\n".join(ble_settings)) if __name__ == "__main__": From 4b29862d30a3050d2bda23cb175e6910168ab8ff Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 8 Sep 2023 16:18:32 -0700 Subject: [PATCH 1676/1712] Clean up more s2 sdkconfig --- ports/espressif/Makefile | 3 + .../boards/01space_lcd042_esp32c3/sdkconfig | 11 +++- .../boards/adafruit_feather_esp32s2/sdkconfig | 45 --------------- .../mpconfigboard.mk | 2 + .../sdkconfig | 36 ------------ .../mpconfigboard.mk | 2 + .../adafruit_feather_esp32s2_tft/sdkconfig | 36 ------------ .../boards/adafruit_funhouse/mpconfigboard.mk | 2 + .../boards/adafruit_funhouse/sdkconfig | 36 ------------ .../mpconfigboard.mk | 2 + .../adafruit_magtag_2.9_grayscale/sdkconfig | 36 ------------ .../adafruit_metro_esp32s2/mpconfigboard.mk | 4 +- .../boards/adafruit_metro_esp32s2/sdkconfig | 36 ------------ .../adafruit_qtpy_esp32s2/mpconfigboard.mk | 2 + .../boards/adafruit_qtpy_esp32s2/sdkconfig | 36 ------------ .../boards/artisense_rd00/mpconfigboard.mk | 2 + .../espressif/boards/artisense_rd00/sdkconfig | 33 ++--------- .../atmegazero_esp32s2/mpconfigboard.mk | 2 + .../boards/atmegazero_esp32s2/sdkconfig | 33 ++--------- .../boards/bpi_bit_s2/mpconfigboard.mk | 2 + ports/espressif/boards/bpi_bit_s2/sdkconfig | 33 ++--------- .../crumpspace_crumps2/mpconfigboard.mk | 2 + .../boards/crumpspace_crumps2/sdkconfig | 33 ++--------- ports/espressif/boards/deneyap_mini/sdkconfig | 11 ++++ .../boards/deneyap_mini_v2/mpconfigboard.mk | 6 +- .../boards/deneyap_mini_v2/sdkconfig | 34 ++--------- .../boards/electroniccats_bastwifi/sdkconfig | 5 -- .../espressif_esp32s2_devkitc_1_n4/sdkconfig | 10 ++++ .../mpconfigboard.mk | 2 + .../sdkconfig | 33 ++--------- .../mpconfigboard.mk | 2 + .../sdkconfig | 33 ++--------- .../espressif_hmi_devkit_1/mpconfigboard.mk | 2 + .../boards/espressif_hmi_devkit_1/sdkconfig | 36 ------------ .../espressif_kaluga_1.3/mpconfigboard.mk | 2 + .../boards/espressif_kaluga_1.3/sdkconfig | 36 ------------ .../espressif_kaluga_1/mpconfigboard.mk | 2 + .../boards/espressif_kaluga_1/sdkconfig | 36 ------------ .../boards/espressif_saola_1_wroom/sdkconfig | 5 -- .../espressif_saola_1_wrover/mpconfigboard.mk | 2 + .../boards/espressif_saola_1_wrover/sdkconfig | 36 ------------ .../boards/franzininho_wifi_wroom/sdkconfig | 5 -- .../franzininho_wifi_wrover/mpconfigboard.mk | 2 + .../boards/franzininho_wifi_wrover/sdkconfig | 36 ------------ .../boards/gravitech_cucumber_m/sdkconfig | 10 ++++ .../boards/gravitech_cucumber_ms/sdkconfig | 10 ++++ .../gravitech_cucumber_r/mpconfigboard.mk | 2 + .../boards/gravitech_cucumber_r/sdkconfig | 33 ++--------- .../gravitech_cucumber_rs/mpconfigboard.mk | 2 + .../boards/gravitech_cucumber_rs/sdkconfig | 33 ++--------- .../boards/hexky_s2/mpconfigboard.mk | 2 + ports/espressif/boards/hexky_s2/sdkconfig | 36 ------------ .../boards/hiibot_iots2/mpconfigboard.mk | 2 + ports/espressif/boards/hiibot_iots2/sdkconfig | 35 ++---------- .../esp-idf-config/sdkconfig-esp32c3.defaults | 56 ++++++++++++++++++- .../esp-idf-config/sdkconfig-esp32s2.defaults | 52 ++++++++++++++++- .../esp-idf-config/sdkconfig-esp32s3.defaults | 50 +++++++++++++++++ .../sdkconfig-psram-40m.defaults | 2 +- .../sdkconfig-psram-8MB.defaults | 4 ++ .../esp-idf-config/sdkconfig-psram.defaults | 17 ++++-- .../esp-idf-config/sdkconfig.defaults | 31 ---------- ports/espressif/tools/update_sdkconfig.py | 6 +- 62 files changed, 334 insertions(+), 814 deletions(-) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 5c61e55fbe..acdddebc30 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -400,6 +400,9 @@ menuconfig: $(BUILD)/esp-idf/config $(BUILD)/esp-idf/config/sdkconfig.h update-all-sdkconfigs: $(BUILD)/esp-idf/config/sdkconfig.h python tools/update_sdkconfig.py --update_all --board=$(BOARD) --debug=$(DEBUG) +update-board-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h + python tools/update_sdkconfig.py --board=$(BOARD) --debug=$(DEBUG) + BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS)) ifeq ($(IDF_TARGET),esp32) diff --git a/ports/espressif/boards/01space_lcd042_esp32c3/sdkconfig b/ports/espressif/boards/01space_lcd042_esp32c3/sdkconfig index 24f7d625ea..3a08db70d5 100644 --- a/ports/espressif/boards/01space_lcd042_esp32c3/sdkconfig +++ b/ports/espressif/boards/01space_lcd042_esp32c3/sdkconfig @@ -1,6 +1,15 @@ -# chip is ESP32-C3 FH4 +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="01Space-LCD042-ESP32C3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig index 0d9f0ca518..e69de29bb2 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s2/sdkconfig @@ -1,45 +0,0 @@ -# -# Component config -# -# -# ESP32S2-specific -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# end of SPI RAM config - -# end of ESP32S2-specific - -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP - -# end of Component config diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk index cbe6bb2442..be2d2fb4e8 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/mpconfigboard.mk @@ -11,3 +11,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig index d151cecdfb..e69de29bb2 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s2_reverse_tft/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.mk index 691480c790..1a4d00e34b 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/mpconfigboard.mk @@ -11,3 +11,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tft/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2_tft/sdkconfig index d151cecdfb..e69de29bb2 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tft/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s2_tft/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk index f2276ad9b6..ce85924ef7 100644 --- a/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_funhouse/mpconfigboard.mk @@ -15,3 +15,5 @@ CIRCUITPY_ESPCAMERA = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/adafruit_funhouse/sdkconfig b/ports/espressif/boards/adafruit_funhouse/sdkconfig index d151cecdfb..e69de29bb2 100644 --- a/ports/espressif/boards/adafruit_funhouse/sdkconfig +++ b/ports/espressif/boards/adafruit_funhouse/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk index 06b5a1c68d..de31f60d76 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.mk @@ -20,3 +20,5 @@ FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Text FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LIS3DH CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/sdkconfig b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/sdkconfig index d151cecdfb..e69de29bb2 100644 --- a/ports/espressif/boards/adafruit_magtag_2.9_grayscale/sdkconfig +++ b/ports/espressif/boards/adafruit_magtag_2.9_grayscale/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk index 96bd76ec27..1bf5fd818b 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_metro_esp32s2/mpconfigboard.mk @@ -10,5 +10,5 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_PSRAM_SIZE = 2MB -CIRCUITPY_ESP_FLASH_MODE = qio -CIRCUITPY_ESP_FLASH_FREQ = 40m +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/adafruit_metro_esp32s2/sdkconfig b/ports/espressif/boards/adafruit_metro_esp32s2/sdkconfig index 1113345a50..e69de29bb2 100644 --- a/ports/espressif/boards/adafruit_metro_esp32s2/sdkconfig +++ b/ports/espressif/boards/adafruit_metro_esp32s2/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="Metro-ESP32S2" -# end of LWIP diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.mk index 2285f8d594..1460667b9e 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.mk @@ -11,3 +11,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s2/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32s2/sdkconfig index d151cecdfb..e69de29bb2 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s2/sdkconfig +++ b/ports/espressif/boards/adafruit_qtpy_esp32s2/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/artisense_rd00/mpconfigboard.mk b/ports/espressif/boards/artisense_rd00/mpconfigboard.mk index 8602034d4a..307169412f 100644 --- a/ports/espressif/boards/artisense_rd00/mpconfigboard.mk +++ b/ports/espressif/boards/artisense_rd00/mpconfigboard.mk @@ -10,3 +10,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/artisense_rd00/sdkconfig b/ports/espressif/boards/artisense_rd00/sdkconfig index f776ea85a1..36749a928b 100644 --- a/ports/espressif/boards/artisense_rd00/sdkconfig +++ b/ports/espressif/boards/artisense_rd00/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="RD00-ESP32S2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.mk b/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.mk index b39623ae94..aea0315c7a 100644 --- a/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.mk +++ b/ports/espressif/boards/atmegazero_esp32s2/mpconfigboard.mk @@ -10,3 +10,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/atmegazero_esp32s2/sdkconfig b/ports/espressif/boards/atmegazero_esp32s2/sdkconfig index 6fa27c4eb2..0748a66c5c 100644 --- a/ports/espressif/boards/atmegazero_esp32s2/sdkconfig +++ b/ports/espressif/boards/atmegazero_esp32s2/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="ATMegaZero-Esp32s2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/bpi_bit_s2/mpconfigboard.mk b/ports/espressif/boards/bpi_bit_s2/mpconfigboard.mk index 6f9f3eeab7..ca2d074434 100644 --- a/ports/espressif/boards/bpi_bit_s2/mpconfigboard.mk +++ b/ports/espressif/boards/bpi_bit_s2/mpconfigboard.mk @@ -13,3 +13,5 @@ CIRCUITPY_ESP_FLASH_SIZE=4MB FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/bpi_bit_s2/sdkconfig b/ports/espressif/boards/bpi_bit_s2/sdkconfig index 7f9c6f5138..c9b6f75868 100644 --- a/ports/espressif/boards/bpi_bit_s2/sdkconfig +++ b/ports/espressif/boards/bpi_bit_s2/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM Clock and CS IO for ESP32S3 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="BPI-BIT-S2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.mk b/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.mk index 871f68c452..a57c81fdf2 100644 --- a/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.mk +++ b/ports/espressif/boards/crumpspace_crumps2/mpconfigboard.mk @@ -15,3 +15,5 @@ CIRCUITPY_BITBANG_APA102 = 1 # FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/crumpspace_crumps2/sdkconfig b/ports/espressif/boards/crumpspace_crumps2/sdkconfig index 9fa2385f37..e1f568a2d8 100644 --- a/ports/espressif/boards/crumpspace_crumps2/sdkconfig +++ b/ports/espressif/boards/crumpspace_crumps2/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="CrumpS2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/deneyap_mini/sdkconfig b/ports/espressif/boards/deneyap_mini/sdkconfig index 7dfaf3052c..3bcde1ab9e 100644 --- a/ports/espressif/boards/deneyap_mini/sdkconfig +++ b/ports/espressif/boards/deneyap_mini/sdkconfig @@ -1,4 +1,15 @@ +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="DeneyapMini" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/deneyap_mini_v2/mpconfigboard.mk b/ports/espressif/boards/deneyap_mini_v2/mpconfigboard.mk index fa9c6b40ea..08d5f8a7dd 100644 --- a/ports/espressif/boards/deneyap_mini_v2/mpconfigboard.mk +++ b/ports/espressif/boards/deneyap_mini_v2/mpconfigboard.mk @@ -6,6 +6,10 @@ USB_MANUFACTURER = "Turkish Technology Team Foundation" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/deneyap_mini_v2/sdkconfig b/ports/espressif/boards/deneyap_mini_v2/sdkconfig index f202775431..be30fb4463 100644 --- a/ports/espressif/boards/deneyap_mini_v2/sdkconfig +++ b/ports/espressif/boards/deneyap_mini_v2/sdkconfig @@ -1,37 +1,15 @@ -CONFIG_ESP32S2_SPIRAM_SUPPORT=y # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="DeneyapMini_v2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/electroniccats_bastwifi/sdkconfig b/ports/espressif/boards/electroniccats_bastwifi/sdkconfig index 3525371bc7..e69de29bb2 100644 --- a/ports/espressif/boards/electroniccats_bastwifi/sdkconfig +++ b/ports/espressif/boards/electroniccats_bastwifi/sdkconfig @@ -1,5 +0,0 @@ -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/sdkconfig b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/sdkconfig index 1aad0eadd1..57f0da698a 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk index 874a1341a4..83a41e8f3f 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk @@ -10,3 +10,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/sdkconfig b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/sdkconfig index 705eeb1a61..57f0da698a 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM Clock and CS IO for ESP32S3 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.mk index ce2b45ccd3..d274e3e6dd 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/mpconfigboard.mk @@ -10,3 +10,5 @@ CIRCUITPY_ESP_FLASH_FREQ=40m CIRCUITPY_ESP_FLASH_SIZE=8MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig index 705eeb1a61..57f0da698a 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n8r2/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM Clock and CS IO for ESP32S3 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.mk b/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.mk index 8ce04357bf..7203fe0db2 100644 --- a/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_hmi_devkit_1/mpconfigboard.mk @@ -10,3 +10,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/espressif_hmi_devkit_1/sdkconfig b/ports/espressif/boards/espressif_hmi_devkit_1/sdkconfig index d151cecdfb..e69de29bb2 100644 --- a/ports/espressif/boards/espressif_hmi_devkit_1/sdkconfig +++ b/ports/espressif/boards/espressif_hmi_devkit_1/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.mk b/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.mk index 975189924d..c442581bdd 100644 --- a/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_kaluga_1.3/mpconfigboard.mk @@ -10,3 +10,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/espressif_kaluga_1.3/sdkconfig b/ports/espressif/boards/espressif_kaluga_1.3/sdkconfig index d151cecdfb..e69de29bb2 100644 --- a/ports/espressif/boards/espressif_kaluga_1.3/sdkconfig +++ b/ports/espressif/boards/espressif_kaluga_1.3/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.mk b/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.mk index 975189924d..c442581bdd 100644 --- a/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_kaluga_1/mpconfigboard.mk @@ -10,3 +10,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/espressif_kaluga_1/sdkconfig b/ports/espressif/boards/espressif_kaluga_1/sdkconfig index d151cecdfb..e69de29bb2 100644 --- a/ports/espressif/boards/espressif_kaluga_1/sdkconfig +++ b/ports/espressif/boards/espressif_kaluga_1/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/espressif_saola_1_wroom/sdkconfig b/ports/espressif/boards/espressif_saola_1_wroom/sdkconfig index 3525371bc7..e69de29bb2 100644 --- a/ports/espressif/boards/espressif_saola_1_wroom/sdkconfig +++ b/ports/espressif/boards/espressif_saola_1_wroom/sdkconfig @@ -1,5 +0,0 @@ -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.mk b/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.mk index a31c4d7498..b1614e6582 100644 --- a/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_saola_1_wrover/mpconfigboard.mk @@ -10,3 +10,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/espressif_saola_1_wrover/sdkconfig b/ports/espressif/boards/espressif_saola_1_wrover/sdkconfig index d151cecdfb..e69de29bb2 100644 --- a/ports/espressif/boards/espressif_saola_1_wrover/sdkconfig +++ b/ports/espressif/boards/espressif_saola_1_wrover/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/franzininho_wifi_wroom/sdkconfig b/ports/espressif/boards/franzininho_wifi_wroom/sdkconfig index 3525371bc7..e69de29bb2 100644 --- a/ports/espressif/boards/franzininho_wifi_wroom/sdkconfig +++ b/ports/espressif/boards/franzininho_wifi_wroom/sdkconfig @@ -1,5 +0,0 @@ -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.mk b/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.mk index d9c04b8b6c..a14512cb74 100644 --- a/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.mk +++ b/ports/espressif/boards/franzininho_wifi_wrover/mpconfigboard.mk @@ -10,3 +10,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/franzininho_wifi_wrover/sdkconfig b/ports/espressif/boards/franzininho_wifi_wrover/sdkconfig index d151cecdfb..e69de29bb2 100644 --- a/ports/espressif/boards/franzininho_wifi_wrover/sdkconfig +++ b/ports/espressif/boards/franzininho_wifi_wrover/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/gravitech_cucumber_m/sdkconfig b/ports/espressif/boards/gravitech_cucumber_m/sdkconfig index af73f6d885..ec6db5c72e 100644 --- a/ports/espressif/boards/gravitech_cucumber_m/sdkconfig +++ b/ports/espressif/boards/gravitech_cucumber_m/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="cucumber_m" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/gravitech_cucumber_ms/sdkconfig b/ports/espressif/boards/gravitech_cucumber_ms/sdkconfig index cbdd787aa7..f3cc39cc67 100644 --- a/ports/espressif/boards/gravitech_cucumber_ms/sdkconfig +++ b/ports/espressif/boards/gravitech_cucumber_ms/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="cucumber_ms" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.mk b/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.mk index aa06644643..88729e7a44 100644 --- a/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.mk +++ b/ports/espressif/boards/gravitech_cucumber_r/mpconfigboard.mk @@ -10,3 +10,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/gravitech_cucumber_r/sdkconfig b/ports/espressif/boards/gravitech_cucumber_r/sdkconfig index a7be128ca5..e817a86205 100644 --- a/ports/espressif/boards/gravitech_cucumber_r/sdkconfig +++ b/ports/espressif/boards/gravitech_cucumber_r/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="cucumber_r" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.mk b/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.mk index f7b0cb2390..9ef503886d 100644 --- a/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.mk +++ b/ports/espressif/boards/gravitech_cucumber_rs/mpconfigboard.mk @@ -10,3 +10,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/gravitech_cucumber_rs/sdkconfig b/ports/espressif/boards/gravitech_cucumber_rs/sdkconfig index e176aa8613..873eb7207a 100644 --- a/ports/espressif/boards/gravitech_cucumber_rs/sdkconfig +++ b/ports/espressif/boards/gravitech_cucumber_rs/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="cucumber_rs" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/hexky_s2/mpconfigboard.mk b/ports/espressif/boards/hexky_s2/mpconfigboard.mk index d6809e5c01..fa7ae64a24 100644 --- a/ports/espressif/boards/hexky_s2/mpconfigboard.mk +++ b/ports/espressif/boards/hexky_s2/mpconfigboard.mk @@ -13,3 +13,5 @@ CIRCUITPY_ESP_FLASH_SIZE = 4MB FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/hexky_s2/sdkconfig b/ports/espressif/boards/hexky_s2/sdkconfig index d151cecdfb..e69de29bb2 100644 --- a/ports/espressif/boards/hexky_s2/sdkconfig +++ b/ports/espressif/boards/hexky_s2/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/hiibot_iots2/mpconfigboard.mk b/ports/espressif/boards/hiibot_iots2/mpconfigboard.mk index 411275a1ba..84a49c256f 100644 --- a/ports/espressif/boards/hiibot_iots2/mpconfigboard.mk +++ b/ports/espressif/boards/hiibot_iots2/mpconfigboard.mk @@ -11,3 +11,5 @@ CIRCUITPY_ESP_FLASH_SIZE = 8MB #CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/hiibot_iots2/sdkconfig b/ports/espressif/boards/hiibot_iots2/sdkconfig index 05249a050c..b2b83eb6e6 100644 --- a/ports/espressif/boards/hiibot_iots2/sdkconfig +++ b/ports/espressif/boards/hiibot_iots2/sdkconfig @@ -1,38 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32=y -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# CONFIG_SPIRAM_SIZE=2097152 - # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# end of SPI RAM config - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="HiiBot_IoTs2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults index c913025124..1f328c0179 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults @@ -1,4 +1,54 @@ -# This file was generated using idf.py save-defconfig. It can be edited manually. -# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration # -CONFIG_ESP_CONSOLE_SECONDARY_NONE=y +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# Bluetooth +# +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +# +# NimBLE Options +# +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +CONFIG_BT_NIMBLE_NVS_PERSIST=y +# +# Memory Settings +# +CONFIG_BT_NIMBLE_ACL_BUF_COUNT=20 +CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 +# end of Memory Settings + +CONFIG_BT_NIMBLE_EXT_ADV=y +# end of NimBLE Options + +# +# Controller Options +# +# CONFIG_BT_CTRL_BLE_SCAN_DUPL is not set +# end of Controller Options + +# end of Bluetooth + +# +# Driver Configurations +# +# +# RMT Configuration +# +CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y +# end of RMT Configuration + +# +# I2S Configuration +# +CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y +# end of I2S Configuration + +# end of Driver Configurations + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults index 527ab89e58..9afec598c4 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults @@ -1,10 +1,58 @@ -# This file was generated using idf.py save-defconfig. It can be edited manually. -# Espressif IoT Development Framework (ESP-IDF) Project Minimal Configuration +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# Driver Configurations +# +# +# PCNT Configuration +# +CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y +# end of PCNT Configuration + +# +# RMT Configuration +# +CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y +# end of RMT Configuration + +# +# I2S Configuration +# +CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y +# end of I2S Configuration + +# end of Driver Configurations + +# +# ESP System Settings +# +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +# +# Cache config # CONFIG_ESP32S2_INSTRUCTION_CACHE_16KB=y CONFIG_ESP32S2_DATA_CACHE_16KB=y +# end of Cache config +# +# Memory +# CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM=y +# end of Memory +# end of ESP System Settings + +# +# Ultra Low Power (ULP) Co-processor +# CONFIG_ULP_COPROC_ENABLED=y CONFIG_ULP_COPROC_RESERVE_MEM=8176 +# end of Ultra Low Power (ULP) Co-processor + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults index 310a95b86b..437aec9119 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults @@ -7,17 +7,65 @@ # # Bluetooth # +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y # # NimBLE Options # +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y CONFIG_BT_NIMBLE_PINNED_TO_CORE_1=y +CONFIG_BT_NIMBLE_NVS_PERSIST=y +# +# Memory Settings +# +CONFIG_BT_NIMBLE_ACL_BUF_COUNT=20 +CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 +# end of Memory Settings + +CONFIG_BT_NIMBLE_EXT_ADV=y # end of NimBLE Options +# +# Controller Options +# +# CONFIG_BT_CTRL_BLE_SCAN_DUPL is not set +# end of Controller Options + # end of Bluetooth +# +# Driver Configurations +# +# +# PCNT Configuration +# +CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y +# end of PCNT Configuration + +# +# RMT Configuration +# +CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y +# end of RMT Configuration + +# +# I2S Configuration +# +CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y +# end of I2S Configuration + +# end of Driver Configurations + # # ESP System Settings # +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +# +# Memory +# +CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM=y +# end of Memory + CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1=y # end of ESP System Settings @@ -32,6 +80,7 @@ CONFIG_ESP_IPC_TASK_STACK_SIZE=1536 # CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 # CONFIG_ESP32_WIFI_NVS_ENABLED is not set # end of Wi-Fi @@ -39,6 +88,7 @@ CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 # # Ultra Low Power (ULP) Co-processor # +CONFIG_ULP_COPROC_ENABLED=y CONFIG_ULP_COPROC_RESERVE_MEM=8176 # end of Ultra Low Power (ULP) Co-processor diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram-40m.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram-40m.defaults index 344bca55ee..5dba8c6d55 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-psram-40m.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-psram-40m.defaults @@ -1,2 +1,2 @@ -CONFIG_SPIRAM_SPEED_40M=y # CONFIG_SPIRAM_SPEED_80M is not set +CONFIG_SPIRAM_SPEED_40M=y diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram-8MB.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram-8MB.defaults index e69de29bb2..b842862762 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-psram-8MB.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-psram-8MB.defaults @@ -0,0 +1,4 @@ +# CONFIG_SPIRAM_TYPE_AUTO is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM64=y diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram.defaults index 0da8eaf53d..d00b1f3d2a 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-psram.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-psram.defaults @@ -4,6 +4,17 @@ # # Component config # +# +# Hardware Settings +# +# +# Sleep Config +# +# CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND is not set +# end of Sleep Config + +# end of Hardware Settings + # # ESP PSRAM # @@ -16,12 +27,6 @@ CONFIG_SPIRAM_USE_MEMMAP=y # end of ESP PSRAM -# -# Wi-Fi -# -CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 -# end of Wi-Fi - # end of Component config # end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index 3b52c2a565..f06c874efc 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -25,24 +25,6 @@ CONFIG_ADC_SUPPRESS_DEPRECATE_WARN=y CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN=y # end of GPTimer Configuration -# -# PCNT Configuration -# -CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y -# end of PCNT Configuration - -# -# RMT Configuration -# -CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y -# end of RMT Configuration - -# -# I2S Configuration -# -CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y -# end of I2S Configuration - # end of Driver Configurations # @@ -54,13 +36,6 @@ CONFIG_ESP_TLS_SERVER=y # # ESP System Settings # -CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y -# -# Memory -# -CONFIG_ESP32S3_RTCDATA_IN_FAST_MEM=y -# end of Memory - CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384 # CONFIG_ESP_TASK_WDT_INIT is not set # end of ESP System Settings @@ -112,12 +87,6 @@ CONFIG_MBEDTLS_SSL_PROTO_DTLS=y CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 # end of SPI Flash driver -# -# Ultra Low Power (ULP) Co-processor -# -CONFIG_ULP_COPROC_ENABLED=y -# end of Ultra Low Power (ULP) Co-processor - # # Camera configuration # diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index f8e4b5a4f3..7dc568f951 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -222,7 +222,8 @@ def update(debug, board, update_all): ble_config = pathlib.Path(f"esp-idf-config/sdkconfig-ble.defaults") sdkconfigs.append(ble_config) board_config = pathlib.Path(f"boards/{board}/sdkconfig") - sdkconfigs.append(board_config) + # Don't include the board file in cp defaults. The board may have custom + # overrides. cp_kconfig_defaults = kconfiglib.Kconfig(kconfig_path) for default_file in sdkconfigs: @@ -297,9 +298,10 @@ def update(debug, board, update_all): matches_cp_default = cp_kconfig_defaults.syms[item.name].str_value == item.str_value matches_esp_default = sym_default(item) - print_debug = not matches_esp_default + print_debug = not matches_esp_default or (not update_all and not matches_cp_default) if print_debug: print(" " * len(current_group), i, config_string.strip()) + print("default", cp_kconfig_defaults.syms[item.name].str_value, item.str_value) # Some files are `rsource`d into another kconfig with $IDF_TARGET as # part of the path. kconfiglib doesn't show this as a reference so From 2a45d95f9d8e6baf9654e3eaf0db0618b7c5bcd3 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 8 Sep 2023 16:28:03 -0700 Subject: [PATCH 1677/1712] Use correct flash defaults --- .../boards/adafruit_feather_esp32s3_nopsram/sdkconfig | 10 ++++++++++ ports/espressif/boards/adafruit_qtpy_esp32c3/sdkconfig | 10 ++++++++++ .../boards/adafruit_qtpy_esp32s3_nopsram/sdkconfig | 10 ++++++++++ .../espressif/boards/ai_thinker_esp32-c3s-2m/sdkconfig | 10 ++++++++++ ports/espressif/boards/ai_thinker_esp32-c3s/sdkconfig | 10 ++++++++++ ports/espressif/boards/beetle-esp32-c3/sdkconfig | 10 ++++++++++ .../boards/espressif_esp32c3_devkitm_1_n4/sdkconfig | 10 ++++++++++ .../boards/espressif_esp32s3_devkitc_1_n8/sdkconfig | 10 ++++++++++ .../boards/espressif_esp32s3_devkitm_1_n8/sdkconfig | 10 ++++++++++ .../boards/espressif_esp32s3_usb_otg_n8/sdkconfig | 10 ++++++++++ ports/espressif/tools/update_sdkconfig.py | 10 +++++++++- 11 files changed, 109 insertions(+), 1 deletion(-) diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/sdkconfig index 1a7d20d834..f5ef797681 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/adafruit_qtpy_esp32c3/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32c3/sdkconfig index b47420753c..aa82df2b81 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32c3/sdkconfig +++ b/ports/espressif/boards/adafruit_qtpy_esp32c3/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="Adafruit-QTPy-ESP32C3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/sdkconfig index 1a7d20d834..f5ef797681 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/sdkconfig +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_nopsram/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/sdkconfig b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/sdkconfig index 60d8719596..411bc17724 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/sdkconfig +++ b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="AIThinker-ESP32C3S-2M" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s/sdkconfig b/ports/espressif/boards/ai_thinker_esp32-c3s/sdkconfig index 88467d9c9e..435604eb4b 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s/sdkconfig +++ b/ports/espressif/boards/ai_thinker_esp32-c3s/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="AIThinker-ESP32C3S" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/beetle-esp32-c3/sdkconfig b/ports/espressif/boards/beetle-esp32-c3/sdkconfig index 69da6d30fd..2b4299082a 100644 --- a/ports/espressif/boards/beetle-esp32-c3/sdkconfig +++ b/ports/espressif/boards/beetle-esp32-c3/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="beetle-esp32-c3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/sdkconfig b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/sdkconfig index 0e24f8dc77..c4def86e69 100644 --- a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/sdkconfig +++ b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="ESP32-C3-DevKitM-1" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/sdkconfig index 1a7d20d834..f5ef797681 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/sdkconfig index 1a7d20d834..f5ef797681 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitm_1_n8/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/sdkconfig index 1a7d20d834..f5ef797681 100644 --- a/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_usb_otg_n8/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index 7dc568f951..ef8d3c0b87 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -206,7 +206,15 @@ def update(debug, board, update_all): else: opt_config = pathlib.Path("esp-idf-config/sdkconfig-opt.defaults") sdkconfigs.append(opt_config) - flash_size_config = pathlib.Path(f"esp-idf-config/sdkconfig-flash-{flash_size}.defaults") + size_options = "" + if flash_size == "2MB": + size_options = "-no-ota-no-uf2" + elif target in ("esp32", "esp32c3"): + # These boards don't have native USB. + size_options = "-no-uf2" + flash_size_config = pathlib.Path( + f"esp-idf-config/sdkconfig-flash-{flash_size}{size_options}.defaults" + ) flash_mode_config = pathlib.Path(f"esp-idf-config/sdkconfig-flash-{flash_mode}.defaults") flash_freq_config = pathlib.Path(f"esp-idf-config/sdkconfig-flash-{flash_freq}.defaults") sdkconfigs.extend((flash_size_config, flash_mode_config, flash_freq_config)) From 5937f4c0c0cf478418a985ea882b081bab242f6a Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 11 Sep 2023 15:27:16 -0700 Subject: [PATCH 1678/1712] Hopefully finish updating kconfig --- .../adafruit_feather_huzzah32/sdkconfig | 19 ------ .../adafruit_huzzah32_breakout/sdkconfig | 19 ------ .../mpconfigboard.mk | 4 ++ .../sdkconfig | 42 ++----------- .../boards/crcibernetica-ideaboard/sdkconfig | 19 ------ .../boards/deneyap_kart/mpconfigboard.mk | 4 ++ ports/espressif/boards/deneyap_kart/sdkconfig | 19 ------ .../boards/deneyap_kart_1a/mpconfigboard.mk | 4 ++ .../boards/deneyap_kart_1a/sdkconfig | 19 ------ .../deneyap_kart_1a_v2/mpconfigboard.mk | 5 ++ .../boards/deneyap_kart_1a_v2/sdkconfig | 42 ++----------- .../espressif/boards/deneyap_kart_g/sdkconfig | 10 ++++ .../boards/doit_esp32_devkit_v1/sdkconfig | 19 ------ .../espressif/boards/es3ink/mpconfigboard.mk | 4 ++ ports/espressif/boards/es3ink/sdkconfig | 29 +++++---- .../boards/lilygo_ttgo_t-01c3/sdkconfig | 10 ++++ .../boards/lilygo_ttgo_t-oi-plus/sdkconfig | 10 ++++ .../lilygo_ttgo_t8_esp32_s2_wroom/sdkconfig | 5 -- .../lilygo_ttgo_tdisplay_esp32_16m/sdkconfig | 10 ++++ .../lilygo_twatch_2020_v3/mpconfigboard.mk | 4 ++ .../boards/lilygo_twatch_2020_v3/sdkconfig | 27 +++------ .../espressif/boards/lolin_c3_mini/sdkconfig | 10 ++++ .../espressif/boards/lolin_c3_pico/sdkconfig | 10 ++++ .../boards/lolin_s3_mini/mpconfigboard.mk | 4 ++ .../espressif/boards/lolin_s3_mini/sdkconfig | 43 ++------------ .../boards/luatos_core_esp32c3/sdkconfig | 10 ++++ .../luatos_core_esp32c3_ch343/sdkconfig | 10 ++++ .../boards/m5stack_atom_echo/sdkconfig | 28 +++------ .../boards/m5stack_atom_lite/sdkconfig | 29 +++------ .../boards/m5stack_atom_matrix/sdkconfig | 28 +++------ .../espressif/boards/m5stack_atom_u/sdkconfig | 28 +++------ .../boards/m5stack_atoms3_lite/sdkconfig | 12 +++- .../boards/m5stack_core2/mpconfigboard.mk | 4 ++ .../espressif/boards/m5stack_core2/sdkconfig | 59 +++++++++++-------- .../boards/m5stack_core_basic/sdkconfig | 50 +++++++++------- .../boards/m5stack_stamp_c3/sdkconfig | 10 ++++ .../boards/m5stack_stick_c/sdkconfig | 26 +++----- .../boards/m5stack_stick_c_plus/sdkconfig | 29 +++------ .../m5stack_timer_camera_x/mpconfigboard.mk | 4 ++ .../boards/m5stack_timer_camera_x/sdkconfig | 54 ++++++++++------- ports/espressif/boards/maker_badge/sdkconfig | 11 ++++ .../boards/microdev_micro_c3/sdkconfig | 10 ++++ .../boards/mixgo_ce_serial/sdkconfig | 5 -- .../espressif/boards/mixgo_ce_udisk/sdkconfig | 5 -- .../boards/morpheans_morphesp-240/sdkconfig | 10 ++++ .../muselab_nanoesp32_s2_wroom/sdkconfig | 5 -- .../boards/seeed_xiao_esp32c3/sdkconfig | 10 ++++ .../smartbeedesigns_bee_data_logger/sdkconfig | 11 +++- .../smartbeedesigns_bee_motion_s3/sdkconfig | 10 ++++ .../boards/smartbeedesigns_bee_s3/sdkconfig | 10 ++++ .../targett_module_clip_wroom/sdkconfig | 5 -- .../unexpectedmaker_nanos3/mpconfigboard.mk | 4 ++ .../boards/unexpectedmaker_nanos3/sdkconfig | 36 ++--------- .../boards/yd_esp32_s3_n16r8/mpconfigboard.mk | 4 ++ .../boards/yd_esp32_s3_n16r8/sdkconfig | 29 +++++---- .../boards/yd_esp32_s3_n8r8/mpconfigboard.mk | 4 ++ .../boards/yd_esp32_s3_n8r8/sdkconfig | 29 +++++---- ports/espressif/mpconfigport.mk | 1 - ports/espressif/tools/update_sdkconfig.py | 3 +- 59 files changed, 443 insertions(+), 531 deletions(-) diff --git a/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig b/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig index 645ab76c47..e69de29bb2 100644 --- a/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig @@ -1,19 +0,0 @@ -CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y - -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings diff --git a/ports/espressif/boards/adafruit_huzzah32_breakout/sdkconfig b/ports/espressif/boards/adafruit_huzzah32_breakout/sdkconfig index 645ab76c47..e69de29bb2 100644 --- a/ports/espressif/boards/adafruit_huzzah32_breakout/sdkconfig +++ b/ports/espressif/boards/adafruit_huzzah32_breakout/sdkconfig @@ -1,19 +0,0 @@ -CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y - -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk index 50b1394a25..60ed676f44 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk @@ -10,4 +10,8 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m + CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/sdkconfig index 9a05ab0205..f5ef797681 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/sdkconfig +++ b/ports/espressif/boards/adafruit_qtpy_esp32s3_4mbflash_2mbpsram/sdkconfig @@ -1,43 +1,9 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# -# SPI RAM config -# -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # @@ -45,3 +11,5 @@ CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/crcibernetica-ideaboard/sdkconfig b/ports/espressif/boards/crcibernetica-ideaboard/sdkconfig index 645ab76c47..e69de29bb2 100644 --- a/ports/espressif/boards/crcibernetica-ideaboard/sdkconfig +++ b/ports/espressif/boards/crcibernetica-ideaboard/sdkconfig @@ -1,19 +0,0 @@ -CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y - -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings diff --git a/ports/espressif/boards/deneyap_kart/mpconfigboard.mk b/ports/espressif/boards/deneyap_kart/mpconfigboard.mk index ea8c9a8522..c0667ee4fe 100644 --- a/ports/espressif/boards/deneyap_kart/mpconfigboard.mk +++ b/ports/espressif/boards/deneyap_kart/mpconfigboard.mk @@ -6,3 +6,7 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/deneyap_kart/sdkconfig b/ports/espressif/boards/deneyap_kart/sdkconfig index 7ec0461dcf..e69de29bb2 100644 --- a/ports/espressif/boards/deneyap_kart/sdkconfig +++ b/ports/espressif/boards/deneyap_kart/sdkconfig @@ -1,19 +0,0 @@ -CONFIG_ESP32_SPIRAM_SUPPORT=y -# -# SPI RAM config -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=8388608 -CONFIG_SPIRAM_SPEED_80M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_IGNORE_NOTFOUND=y -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set -CONFIG_SPIRAM_CACHE_WORKAROUND=y diff --git a/ports/espressif/boards/deneyap_kart_1a/mpconfigboard.mk b/ports/espressif/boards/deneyap_kart_1a/mpconfigboard.mk index 976083217e..423ee1e3e5 100644 --- a/ports/espressif/boards/deneyap_kart_1a/mpconfigboard.mk +++ b/ports/espressif/boards/deneyap_kart_1a/mpconfigboard.mk @@ -6,3 +6,7 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/deneyap_kart_1a/sdkconfig b/ports/espressif/boards/deneyap_kart_1a/sdkconfig index 7ec0461dcf..e69de29bb2 100644 --- a/ports/espressif/boards/deneyap_kart_1a/sdkconfig +++ b/ports/espressif/boards/deneyap_kart_1a/sdkconfig @@ -1,19 +0,0 @@ -CONFIG_ESP32_SPIRAM_SUPPORT=y -# -# SPI RAM config -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=8388608 -CONFIG_SPIRAM_SPEED_80M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_IGNORE_NOTFOUND=y -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set -CONFIG_SPIRAM_CACHE_WORKAROUND=y diff --git a/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk b/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk index 5fa5d4822f..fc1cf53139 100644 --- a/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk +++ b/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk @@ -9,4 +9,9 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m + CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/deneyap_kart_1a_v2/sdkconfig b/ports/espressif/boards/deneyap_kart_1a_v2/sdkconfig index 2cdb172e06..2d5e06f985 100644 --- a/ports/espressif/boards/deneyap_kart_1a_v2/sdkconfig +++ b/ports/espressif/boards/deneyap_kart_1a_v2/sdkconfig @@ -1,43 +1,9 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# -# SPI RAM config -# -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # @@ -45,3 +11,5 @@ CONFIG_LWIP_LOCAL_HOSTNAME="DeneyapKart1A_v2" # end of LWIP # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/deneyap_kart_g/sdkconfig b/ports/espressif/boards/deneyap_kart_g/sdkconfig index a988de5fea..f239c31405 100644 --- a/ports/espressif/boards/deneyap_kart_g/sdkconfig +++ b/ports/espressif/boards/deneyap_kart_g/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="DeneyapKartG" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/doit_esp32_devkit_v1/sdkconfig b/ports/espressif/boards/doit_esp32_devkit_v1/sdkconfig index 645ab76c47..e69de29bb2 100644 --- a/ports/espressif/boards/doit_esp32_devkit_v1/sdkconfig +++ b/ports/espressif/boards/doit_esp32_devkit_v1/sdkconfig @@ -1,19 +0,0 @@ -CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y - -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings diff --git a/ports/espressif/boards/es3ink/mpconfigboard.mk b/ports/espressif/boards/es3ink/mpconfigboard.mk index bd55e68379..bb102bf202 100644 --- a/ports/espressif/boards/es3ink/mpconfigboard.mk +++ b/ports/espressif/boards/es3ink/mpconfigboard.mk @@ -8,3 +8,7 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE=dio CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/es3ink/sdkconfig b/ports/espressif/boards/es3ink/sdkconfig index 89d29d8ea9..b023c59d03 100644 --- a/ports/espressif/boards/es3ink/sdkconfig +++ b/ports/espressif/boards/es3ink/sdkconfig @@ -1,16 +1,15 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y - -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_SPEED_80M=y - -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 - -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_USE_MEMMAP=y -CONFIG_SPIRAM_MEMTEST=y - +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# LWIP +# CONFIG_LWIP_LOCAL_HOSTNAME="es3ink" +# end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/lilygo_ttgo_t-01c3/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t-01c3/sdkconfig index 9d906d3c3b..54105bd51b 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-01c3/sdkconfig +++ b/ports/espressif/boards/lilygo_ttgo_t-01c3/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="LILYGO TTGO T-01C3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/sdkconfig index 7c85db8776..fc0f5c6edd 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/sdkconfig +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="LILYGO TTGO T-OI PLUS" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/sdkconfig index 3525371bc7..e69de29bb2 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/sdkconfig +++ b/ports/espressif/boards/lilygo_ttgo_t8_esp32_s2_wroom/sdkconfig @@ -1,5 +0,0 @@ -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/lilygo_ttgo_tdisplay_esp32_16m/sdkconfig b/ports/espressif/boards/lilygo_ttgo_tdisplay_esp32_16m/sdkconfig index 55052e98ca..61beea449b 100644 --- a/ports/espressif/boards/lilygo_ttgo_tdisplay_esp32_16m/sdkconfig +++ b/ports/espressif/boards/lilygo_ttgo_tdisplay_esp32_16m/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="TTGO-TDISPLAY" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/lilygo_twatch_2020_v3/mpconfigboard.mk b/ports/espressif/boards/lilygo_twatch_2020_v3/mpconfigboard.mk index 9d6c8dc25b..f881eddc13 100644 --- a/ports/espressif/boards/lilygo_twatch_2020_v3/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_twatch_2020_v3/mpconfigboard.mk @@ -6,3 +6,7 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/lilygo_twatch_2020_v3/sdkconfig b/ports/espressif/boards/lilygo_twatch_2020_v3/sdkconfig index 89647ab5a1..d1e302072a 100644 --- a/ports/espressif/boards/lilygo_twatch_2020_v3/sdkconfig +++ b/ports/espressif/boards/lilygo_twatch_2020_v3/sdkconfig @@ -1,31 +1,22 @@ -# SPI RAM config # -CONFIG_ESP32_SPIRAM_SUPPORT=y -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -CONFIG_SPIRAM_SPEED_80M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND=y -CONFIG_SPIRAM_USE_MEMMAP=y -CONFIG_SPIRAM_MEMTEST=y -CONFIG_SPIRAM_CACHE_WORKAROUND=y - -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins +# Espressif IoT Development Framework Configuration +# +# +# Component config +# # # ESP System Settings # -CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set CONFIG_ESP_CONSOLE_UART_CUSTOM=y # CONFIG_ESP_CONSOLE_NONE is not set CONFIG_ESP_CONSOLE_UART=y CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -# CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set CONFIG_ESP_CONSOLE_UART_NUM=0 CONFIG_ESP_CONSOLE_UART_TX_GPIO=1 CONFIG_ESP_CONSOLE_UART_RX_GPIO=3 CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -# CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set # end of ESP System Settings + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/lolin_c3_mini/sdkconfig b/ports/espressif/boards/lolin_c3_mini/sdkconfig index 833f8368fa..932a4a2cbd 100644 --- a/ports/espressif/boards/lolin_c3_mini/sdkconfig +++ b/ports/espressif/boards/lolin_c3_mini/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="lolin-c3-mini" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/lolin_c3_pico/sdkconfig b/ports/espressif/boards/lolin_c3_pico/sdkconfig index b801dac1e2..00134fd0f2 100644 --- a/ports/espressif/boards/lolin_c3_pico/sdkconfig +++ b/ports/espressif/boards/lolin_c3_pico/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="lolin-c3-pico" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk index 2a02d7f231..4c54787bbb 100644 --- a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk @@ -9,6 +9,10 @@ CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m + # OPTIMIZATION_FLAGS = -Os CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/lolin_s3_mini/sdkconfig b/ports/espressif/boards/lolin_s3_mini/sdkconfig index c9fa5f3e51..36be9c760e 100644 --- a/ports/espressif/boards/lolin_s3_mini/sdkconfig +++ b/ports/espressif/boards/lolin_s3_mini/sdkconfig @@ -1,44 +1,9 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# -# SPI RAM config -# -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -# CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -# CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_MODE_OCT=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # @@ -46,3 +11,5 @@ CONFIG_LWIP_LOCAL_HOSTNAME="LOLIN-S3-MINI" # end of LWIP # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/luatos_core_esp32c3/sdkconfig b/ports/espressif/boards/luatos_core_esp32c3/sdkconfig index ccc70917b5..7d94db0b5b 100644 --- a/ports/espressif/boards/luatos_core_esp32c3/sdkconfig +++ b/ports/espressif/boards/luatos_core_esp32c3/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="luatos-core-esp32c3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/luatos_core_esp32c3_ch343/sdkconfig b/ports/espressif/boards/luatos_core_esp32c3_ch343/sdkconfig index ccc70917b5..7d94db0b5b 100644 --- a/ports/espressif/boards/luatos_core_esp32c3_ch343/sdkconfig +++ b/ports/espressif/boards/luatos_core_esp32c3_ch343/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="luatos-core-esp32c3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_atom_echo/sdkconfig b/ports/espressif/boards/m5stack_atom_echo/sdkconfig index c86eaa11fe..861e4ebad3 100644 --- a/ports/espressif/boards/m5stack_atom_echo/sdkconfig +++ b/ports/espressif/boards/m5stack_atom_echo/sdkconfig @@ -1,25 +1,15 @@ - -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskAtomEcho" # end of LWIP -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_atom_lite/sdkconfig b/ports/espressif/boards/m5stack_atom_lite/sdkconfig index 50e85a6afe..eaaf716a15 100644 --- a/ports/espressif/boards/m5stack_atom_lite/sdkconfig +++ b/ports/espressif/boards/m5stack_atom_lite/sdkconfig @@ -1,26 +1,15 @@ -CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y - -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskAtomLite" # end of LWIP -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_atom_matrix/sdkconfig b/ports/espressif/boards/m5stack_atom_matrix/sdkconfig index 55e5bd3a94..730f17de0e 100644 --- a/ports/espressif/boards/m5stack_atom_matrix/sdkconfig +++ b/ports/espressif/boards/m5stack_atom_matrix/sdkconfig @@ -1,25 +1,15 @@ - -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskAtomMatrix" # end of LWIP -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_atom_u/sdkconfig b/ports/espressif/boards/m5stack_atom_u/sdkconfig index 9d47d05b4f..06d0f01693 100644 --- a/ports/espressif/boards/m5stack_atom_u/sdkconfig +++ b/ports/espressif/boards/m5stack_atom_u/sdkconfig @@ -1,25 +1,15 @@ - -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskAtomU" # end of LWIP -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_atoms3_lite/sdkconfig b/ports/espressif/boards/m5stack_atoms3_lite/sdkconfig index 9d924272ec..f5ef797681 100644 --- a/ports/espressif/boards/m5stack_atoms3_lite/sdkconfig +++ b/ports/espressif/boards/m5stack_atoms3_lite/sdkconfig @@ -1,7 +1,15 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=n - +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_core2/mpconfigboard.mk b/ports/espressif/boards/m5stack_core2/mpconfigboard.mk index 74ed5bcb83..c8954579ee 100644 --- a/ports/espressif/boards/m5stack_core2/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_core2/mpconfigboard.mk @@ -7,6 +7,10 @@ CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m + M5STACK_CORE2_5V_OUTPUT_ENABLE_DEFAULT = 1 CFLAGS += -DM5STACK_CORE2_5V_OUTPUT_ENABLE_DEFAULT=$(M5STACK_CORE2_5V_OUTPUT_ENABLE_DEFAULT) diff --git a/ports/espressif/boards/m5stack_core2/sdkconfig b/ports/espressif/boards/m5stack_core2/sdkconfig index 47a0a18a5e..b8a37f0d84 100644 --- a/ports/espressif/boards/m5stack_core2/sdkconfig +++ b/ports/espressif/boards/m5stack_core2/sdkconfig @@ -1,6 +1,36 @@ -CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y -CONFIG_ESP32_SPIRAM_SUPPORT=y +# +# Espressif IoT Development Framework Configuration +# +# +# Security features +# +CONFIG_SECURE_BOOT_V2_RSA_SUPPORTED=y +CONFIG_SECURE_BOOT_V2_PREFERRED=y +# end of Security features + +# +# Component config +# +# +# Hardware Settings +# +# +# Chip revision +# +# CONFIG_ESP32_REV_MIN_0 is not set CONFIG_ESP32_REV_MIN_3=y +CONFIG_ESP32_REV_MIN=3 +CONFIG_ESP32_REV_MIN_FULL=300 +CONFIG_ESP_REV_MIN_FULL=300 +# end of Chip revision + +# +# Sleep Config +# +CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND=y +# end of Sleep Config + +# end of Hardware Settings # # LWIP @@ -8,27 +38,6 @@ CONFIG_ESP32_REV_MIN_3=y CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskCore2" # end of LWIP -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config +# end of Component config -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_core_basic/sdkconfig b/ports/espressif/boards/m5stack_core_basic/sdkconfig index 44896d5883..5b7ecf8709 100644 --- a/ports/espressif/boards/m5stack_core_basic/sdkconfig +++ b/ports/espressif/boards/m5stack_core_basic/sdkconfig @@ -1,27 +1,37 @@ -CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y -CONFIG_ESP32_REV_MIN_3=y +# +# Espressif IoT Development Framework Configuration +# +# +# Security features +# +CONFIG_SECURE_BOOT_V2_RSA_SUPPORTED=y +CONFIG_SECURE_BOOT_V2_PREFERRED=y +# end of Security features + +# +# Component config +# +# +# Hardware Settings +# +# +# Chip revision +# +# CONFIG_ESP32_REV_MIN_0 is not set +CONFIG_ESP32_REV_MIN_3=y +CONFIG_ESP32_REV_MIN=3 +CONFIG_ESP32_REV_MIN_FULL=300 +CONFIG_ESP_REV_MIN_FULL=300 +# end of Chip revision + +# end of Hardware Settings -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskCoreBasic" # end of LWIP -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_stamp_c3/sdkconfig b/ports/espressif/boards/m5stack_stamp_c3/sdkconfig index 34260aa7f2..87330ec13b 100644 --- a/ports/espressif/boards/m5stack_stamp_c3/sdkconfig +++ b/ports/espressif/boards/m5stack_stamp_c3/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="m5stack-stamp-c3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_stick_c/sdkconfig b/ports/espressif/boards/m5stack_stick_c/sdkconfig index 7f8426e4cb..2e72fdb216 100644 --- a/ports/espressif/boards/m5stack_stick_c/sdkconfig +++ b/ports/espressif/boards/m5stack_stick_c/sdkconfig @@ -1,23 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskStickC" # end of LWIP -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_stick_c_plus/sdkconfig b/ports/espressif/boards/m5stack_stick_c_plus/sdkconfig index a37e88cedf..54f50db25c 100644 --- a/ports/espressif/boards/m5stack_stick_c_plus/sdkconfig +++ b/ports/espressif/boards/m5stack_stick_c_plus/sdkconfig @@ -1,26 +1,15 @@ -CONFIG_ESP32_SPIRAM_SUPPORT=n - -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskStickCPlus" # end of LWIP -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk b/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk index 6339db806b..7f48c05863 100644 --- a/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk @@ -6,3 +6,7 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/m5stack_timer_camera_x/sdkconfig b/ports/espressif/boards/m5stack_timer_camera_x/sdkconfig index 06cce7a595..a600e00b31 100644 --- a/ports/espressif/boards/m5stack_timer_camera_x/sdkconfig +++ b/ports/espressif/boards/m5stack_timer_camera_x/sdkconfig @@ -1,27 +1,37 @@ -# ESP32-D0WDQ6-V3 (revision 3) -CONFIG_ESP32_SPIRAM_SUPPORT=y -CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y +# +# Espressif IoT Development Framework Configuration +# +# +# Security features +# +CONFIG_SECURE_BOOT_V2_RSA_SUPPORTED=y +CONFIG_SECURE_BOOT_V2_PREFERRED=y +# end of Security features + +# +# Component config +# +# +# Hardware Settings +# +# +# Chip revision +# +# CONFIG_ESP32_REV_MIN_0 is not set CONFIG_ESP32_REV_MIN_3=y +CONFIG_ESP32_REV_MIN=3 +CONFIG_ESP32_REV_MIN_FULL=300 +CONFIG_ESP_REV_MIN_FULL=300 +# end of Chip revision -# PSRAM -CONFIG_D0WD_PSRAM_CLK_IO=17 -CONFIG_D0WD_PSRAM_CS_IO=16 +# end of Hardware Settings -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -CONFIG_SPIRAM_SPEED_80M=y - -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_USE_MEMMAP=y -CONFIG_SPIRAM_MEMTEST=y - -# Hostname +# +# LWIP +# CONFIG_LWIP_LOCAL_HOSTNAME="M5StackTimerX" +# end of LWIP -# Camera -CONFIG_OV3660_SUPPORT=y -CONFIG_GC_SENSOR_SUBSAMPLE_MODE=y -CONFIG_CAMERA_CORE0=y -CONFIG_CAMERA_DMA_BUFFER_SIZE_MAX=32768 +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/maker_badge/sdkconfig b/ports/espressif/boards/maker_badge/sdkconfig index 8af8e2c9d2..d62227df74 100644 --- a/ports/espressif/boards/maker_badge/sdkconfig +++ b/ports/espressif/boards/maker_badge/sdkconfig @@ -1,4 +1,15 @@ +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="Maker_badge" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/microdev_micro_c3/sdkconfig b/ports/espressif/boards/microdev_micro_c3/sdkconfig index f6f038a77c..9b13279bd3 100644 --- a/ports/espressif/boards/microdev_micro_c3/sdkconfig +++ b/ports/espressif/boards/microdev_micro_c3/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="MicroDev-microC3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/mixgo_ce_serial/sdkconfig b/ports/espressif/boards/mixgo_ce_serial/sdkconfig index 3525371bc7..e69de29bb2 100644 --- a/ports/espressif/boards/mixgo_ce_serial/sdkconfig +++ b/ports/espressif/boards/mixgo_ce_serial/sdkconfig @@ -1,5 +0,0 @@ -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/mixgo_ce_udisk/sdkconfig b/ports/espressif/boards/mixgo_ce_udisk/sdkconfig index 3525371bc7..e69de29bb2 100644 --- a/ports/espressif/boards/mixgo_ce_udisk/sdkconfig +++ b/ports/espressif/boards/mixgo_ce_udisk/sdkconfig @@ -1,5 +0,0 @@ -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/morpheans_morphesp-240/sdkconfig b/ports/espressif/boards/morpheans_morphesp-240/sdkconfig index 55199905be..b0a838eacc 100644 --- a/ports/espressif/boards/morpheans_morphesp-240/sdkconfig +++ b/ports/espressif/boards/morpheans_morphesp-240/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="MORPHESP-240" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/sdkconfig b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/sdkconfig index 3525371bc7..e69de29bb2 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wroom/sdkconfig +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wroom/sdkconfig @@ -1,5 +0,0 @@ -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/seeed_xiao_esp32c3/sdkconfig b/ports/espressif/boards/seeed_xiao_esp32c3/sdkconfig index b2c9bc0fe6..a593f1d173 100644 --- a/ports/espressif/boards/seeed_xiao_esp32c3/sdkconfig +++ b/ports/espressif/boards/seeed_xiao_esp32c3/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="seeed-xiao-esp32c3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/smartbeedesigns_bee_data_logger/sdkconfig b/ports/espressif/boards/smartbeedesigns_bee_data_logger/sdkconfig index 4008263f8d..deb1b88d7c 100644 --- a/ports/espressif/boards/smartbeedesigns_bee_data_logger/sdkconfig +++ b/ports/espressif/boards/smartbeedesigns_bee_data_logger/sdkconfig @@ -1,6 +1,15 @@ -# CONFIG_ESP32S3_SPIRAM_SUPPORT is not set +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="smartbeedesigns_bee_data_logger" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/sdkconfig b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/sdkconfig index 8457338560..fe95b60d4c 100644 --- a/ports/espressif/boards/smartbeedesigns_bee_motion_s3/sdkconfig +++ b/ports/espressif/boards/smartbeedesigns_bee_motion_s3/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="smartbeedesigns_bee_motion_s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/smartbeedesigns_bee_s3/sdkconfig b/ports/espressif/boards/smartbeedesigns_bee_s3/sdkconfig index 6eda3c0adb..2c7a057567 100644 --- a/ports/espressif/boards/smartbeedesigns_bee_s3/sdkconfig +++ b/ports/espressif/boards/smartbeedesigns_bee_s3/sdkconfig @@ -1,5 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="smartbeedesigns_bee_s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/targett_module_clip_wroom/sdkconfig b/ports/espressif/boards/targett_module_clip_wroom/sdkconfig index 3525371bc7..e69de29bb2 100644 --- a/ports/espressif/boards/targett_module_clip_wroom/sdkconfig +++ b/ports/espressif/boards/targett_module_clip_wroom/sdkconfig @@ -1,5 +0,0 @@ -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/unexpectedmaker_nanos3/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_nanos3/mpconfigboard.mk index c61654bfc3..9fd196d4bf 100644 --- a/ports/espressif/boards/unexpectedmaker_nanos3/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_nanos3/mpconfigboard.mk @@ -9,6 +9,10 @@ CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m + # CIRCUITPY_BITBANG_NEOPIXEL = 1 # Include these Python libraries in firmware. diff --git a/ports/espressif/boards/unexpectedmaker_nanos3/sdkconfig b/ports/espressif/boards/unexpectedmaker_nanos3/sdkconfig index c1dee83717..815f002d38 100644 --- a/ports/espressif/boards/unexpectedmaker_nanos3/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_nanos3/sdkconfig @@ -1,39 +1,15 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y - # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 - # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -# CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# end of SPI RAM config - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="UMNanoS3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/yd_esp32_s3_n16r8/mpconfigboard.mk b/ports/espressif/boards/yd_esp32_s3_n16r8/mpconfigboard.mk index 2120ba97cb..be875cd895 100644 --- a/ports/espressif/boards/yd_esp32_s3_n16r8/mpconfigboard.mk +++ b/ports/espressif/boards/yd_esp32_s3_n16r8/mpconfigboard.mk @@ -9,5 +9,9 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m + # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/espressif/boards/yd_esp32_s3_n16r8/sdkconfig b/ports/espressif/boards/yd_esp32_s3_n16r8/sdkconfig index 5aff7f49b1..f5ef797681 100644 --- a/ports/espressif/boards/yd_esp32_s3_n16r8/sdkconfig +++ b/ports/espressif/boards/yd_esp32_s3_n16r8/sdkconfig @@ -1,16 +1,15 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y - -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_SPEED_80M=y - -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 - -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_USE_MEMMAP=y -CONFIG_SPIRAM_MEMTEST=y - +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# LWIP +# CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/yd_esp32_s3_n8r8/mpconfigboard.mk b/ports/espressif/boards/yd_esp32_s3_n8r8/mpconfigboard.mk index 766e71dc2d..6ff5cada7c 100644 --- a/ports/espressif/boards/yd_esp32_s3_n8r8/mpconfigboard.mk +++ b/ports/espressif/boards/yd_esp32_s3_n8r8/mpconfigboard.mk @@ -9,5 +9,9 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m + # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/espressif/boards/yd_esp32_s3_n8r8/sdkconfig b/ports/espressif/boards/yd_esp32_s3_n8r8/sdkconfig index 5aff7f49b1..f5ef797681 100644 --- a/ports/espressif/boards/yd_esp32_s3_n8r8/sdkconfig +++ b/ports/espressif/boards/yd_esp32_s3_n8r8/sdkconfig @@ -1,16 +1,15 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y - -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_SPEED_80M=y - -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 - -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_USE_MEMMAP=y -CONFIG_SPIRAM_MEMTEST=y - +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# LWIP +# CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" +# end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 21fc50c874..2c358637cc 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -48,7 +48,6 @@ CIRCUITPY_WIFI ?= 1 # Conditionally turn off modules/features ifeq ($(IDF_TARGET),esp32) # Modules -CIRCUITPY_BLEIO = 0 CIRCUITPY_RGBMATRIX = 0 # Features CIRCUITPY_USB = 0 diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index ef8d3c0b87..898c8979eb 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -298,7 +298,7 @@ def update(debug, board, update_all): if cp_sym.str_value == "n": config_string = f"# CONFIG_{item.name} is not set" else: - config_string = "" + continue if node.list: pending_nodes.append(node.list) @@ -309,7 +309,6 @@ def update(debug, board, update_all): print_debug = not matches_esp_default or (not update_all and not matches_cp_default) if print_debug: print(" " * len(current_group), i, config_string.strip()) - print("default", cp_kconfig_defaults.syms[item.name].str_value, item.str_value) # Some files are `rsource`d into another kconfig with $IDF_TARGET as # part of the path. kconfiglib doesn't show this as a reference so From cb6b4d0d4a820bd4066ace2d89a8d516a0480b51 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 11 Sep 2023 15:57:09 -0700 Subject: [PATCH 1679/1712] Fix esp-camera. 32 was dropped so the path doesn't have esp32 in it. --- ports/espressif/Makefile | 6 +++--- ports/espressif/common-hal/espcamera/Camera.c | 2 +- ports/espressif/esp-idf-config/sdkconfig-psram-qio.defaults | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index acdddebc30..69b2ff1a38 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -275,8 +275,8 @@ SRC_CAMERA := \ $(wildcard common-hal/espcamera/*.c) \ $(wildcard bindings/espcamera/*.c) SRC_C += $(SRC_CAMERA) -CFLAGS += -isystem esp32-camera/driver/include -CFLAGS += -isystem esp32-camera/conversions/include +CFLAGS += -isystem esp-camera/driver/include +CFLAGS += -isystem esp-camera/conversions/include endif ifneq ($(CIRCUITPY_ESPIDF),0) @@ -436,7 +436,7 @@ ESP_IDF_COMPONENTS_EXPANDED += esp-idf/components/xtensa/$(IDF_TARGET)/libxt_hal endif ifneq ($(CIRCUITPY_ESPCAMERA),0) -ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/esp32-camera/libesp32-camera.a +ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/esp-camera/libesp-camera.a #$(error $(ESP_IDF_COMPONENTS_EXPANDED)) endif diff --git a/ports/espressif/common-hal/espcamera/Camera.c b/ports/espressif/common-hal/espcamera/Camera.c index 7db8a4b4c1..cdf7ab63c8 100644 --- a/ports/espressif/common-hal/espcamera/Camera.c +++ b/ports/espressif/common-hal/espcamera/Camera.c @@ -35,7 +35,7 @@ #include "shared-bindings/util.h" #include "common-hal/microcontroller/Pin.h" -#include "esp32-camera/driver/private_include/cam_hal.h" +#include "esp-camera/driver/private_include/cam_hal.h" #if !CONFIG_SPIRAM #error espcamera only works on boards configured with spiram, disable it in mpconfigboard.mk diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram-qio.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram-qio.defaults index d93069e02b..ad262b4918 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-psram-qio.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-psram-qio.defaults @@ -1 +1,2 @@ CONFIG_SPIRAM_MODE_QUAD=y +# CONFIG_SPIRAM_MODE_OCT is not set From 0a9ae1f6bafd18e3e736ae7352feab93059e4c87 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 11 Sep 2023 15:58:07 -0700 Subject: [PATCH 1680/1712] Code size optimizations --- .../esp-idf-config/sdkconfig-opt.defaults | 1 + .../esp-idf-config/sdkconfig.defaults | 26 +++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ports/espressif/esp-idf-config/sdkconfig-opt.defaults b/ports/espressif/esp-idf-config/sdkconfig-opt.defaults index 46efd79e45..ebf294736a 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-opt.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-opt.defaults @@ -12,6 +12,7 @@ CONFIG_BOOTLOADER_LOG_LEVEL_NONE=y # CONFIG_COMPILER_OPTIMIZATION_SIZE=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y +CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y # end of Compiler options # diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index f06c874efc..279c23c2c5 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -27,17 +27,12 @@ CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN=y # end of Driver Configurations -# -# ESP-TLS -# -CONFIG_ESP_TLS_SERVER=y -# end of ESP-TLS - # # ESP System Settings # CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384 # CONFIG_ESP_TASK_WDT_INIT is not set +# CONFIG_ESP_DEBUG_OCDAWARE is not set # end of ESP System Settings # @@ -70,14 +65,29 @@ CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/data/roots.pem" # end of Certificate Bundle +CONFIG_MBEDTLS_TLS_CLIENT_ONLY=y # # TLS Key Exchange Methods # -CONFIG_MBEDTLS_PSK_MODES=y -CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y +# CONFIG_MBEDTLS_KEY_EXCHANGE_RSA is not set # end of TLS Key Exchange Methods CONFIG_MBEDTLS_SSL_PROTO_DTLS=y +# +# Certificates +# +# CONFIG_MBEDTLS_PEM_WRITE_C is not set +# end of Certificates + +# CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED is not set +# CONFIG_MBEDTLS_ECP_NIST_OPTIM is not set # end of mbedTLS # From 18fd0045f69183538f1fb29e09aef55a936bb963 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 11 Sep 2023 16:53:14 -0700 Subject: [PATCH 1681/1712] More kconfig updates --- .../sdkconfig | 5 -- .../mpconfigboard.mk | 8 +- .../sdkconfig | 40 ++-------- .../adafruit_qtpy_esp32_pico/mpconfigboard.mk | 4 +- .../boards/adafruit_qtpy_esp32_pico/sdkconfig | 44 ----------- .../mpconfigboard.mk | 4 +- .../ai_thinker_esp_12k_nodemcu/sdkconfig | 36 --------- .../boards/bpi_leaf_s3/mpconfigboard.mk | 8 +- ports/espressif/boards/bpi_leaf_s3/sdkconfig | 40 ++-------- .../boards/bpi_picow_s3/mpconfigboard.mk | 8 +- ports/espressif/boards/bpi_picow_s3/sdkconfig | 40 ++-------- .../brainboardz_neuron/mpconfigboard.mk | 4 +- .../boards/brainboardz_neuron/sdkconfig | 30 ++------ .../mpconfigboard.mk | 8 +- .../cytron_maker_feather_aiot_s3/sdkconfig | 30 ++------ .../espressif_esp32_eye/mpconfigboard.mk | 6 +- .../boards/espressif_esp32_eye/sdkconfig | 54 +++---------- .../espressif_esp32_lyrat/mpconfigboard.mk | 4 +- .../boards/espressif_esp32_lyrat/sdkconfig | 36 --------- .../espressif_esp32s3_box/mpconfigboard.mk | 4 +- .../boards/espressif_esp32s3_box/sdkconfig | 33 ++------ .../mpconfigboard.mk | 4 +- .../espressif_esp32s3_box_lite/sdkconfig | 33 ++------ .../mpconfigboard.mk | 6 +- .../sdkconfig | 73 ++---------------- .../mpconfigboard.mk | 4 +- .../sdkconfig | 40 ++-------- .../mpconfigboard.mk | 4 +- .../sdkconfig | 30 ++------ .../espressif_esp32s3_eye/mpconfigboard.mk | 4 +- .../boards/espressif_esp32s3_eye/sdkconfig | 30 ++------ .../hardkernel_odroid_go/mpconfigboard.mk | 4 +- .../boards/hardkernel_odroid_go/sdkconfig | 36 --------- .../lilygo_tembed_esp32s3/mpconfigboard.mk | 4 +- .../boards/lilygo_tembed_esp32s3/sdkconfig | 30 ++------ .../boards/lilygo_ttgo_t8_s2/mpconfigboard.mk | 4 +- .../boards/lilygo_ttgo_t8_s2/sdkconfig | 33 ++------ .../lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk | 4 +- .../boards/lilygo_ttgo_t8_s2_st7789/sdkconfig | 33 ++------ .../boards/lolin_s2_mini/mpconfigboard.mk | 7 +- .../espressif/boards/lolin_s2_mini/sdkconfig | 33 ++------ .../boards/lolin_s2_pico/mpconfigboard.mk | 7 +- .../espressif/boards/lolin_s2_pico/sdkconfig | 33 ++------ .../boards/lolin_s3/mpconfigboard.mk | 8 +- ports/espressif/boards/lolin_s3/sdkconfig | 41 ++-------- .../boards/m5stack_core_fire/mpconfigboard.mk | 7 +- .../boards/m5stack_core_fire/sdkconfig | 76 +++++++------------ .../boards/microdev_micro_s2/mpconfigboard.mk | 4 +- .../boards/microdev_micro_s2/sdkconfig | 33 ++------ .../mpconfigboard.mk | 4 +- .../muselab_nanoesp32_s2_wrover/sdkconfig | 25 ------ .../odt_pixelwing_esp32_s2/mpconfigboard.mk | 4 +- .../boards/odt_pixelwing_esp32_s2/sdkconfig | 33 ++------ .../mpconfigboard.mk | 1 + .../mpconfigboard.mk | 4 +- .../targett_module_clip_wrover/sdkconfig | 36 --------- .../mpconfigboard.mk | 8 +- .../unexpectedmaker_feathers2/sdkconfig | 33 ++------ .../mpconfigboard.mk | 8 +- .../unexpectedmaker_feathers2_neo/sdkconfig | 33 ++------ .../mpconfigboard.mk | 8 +- .../sdkconfig | 33 ++------ .../mpconfigboard.mk | 8 +- .../unexpectedmaker_feathers3/sdkconfig | 35 ++------- .../unexpectedmaker_pros3/mpconfigboard.mk | 8 +- .../boards/unexpectedmaker_pros3/sdkconfig | 35 ++------- .../unexpectedmaker_tinypico/mpconfigboard.mk | 4 +- .../boards/unexpectedmaker_tinypico/sdkconfig | 19 ----- .../mpconfigboard.mk | 4 +- .../unexpectedmaker_tinypico_nano/sdkconfig | 19 ----- .../unexpectedmaker_tinys2/mpconfigboard.mk | 8 +- .../boards/unexpectedmaker_tinys2/sdkconfig | 33 ++------ .../unexpectedmaker_tinys3/mpconfigboard.mk | 8 +- .../boards/unexpectedmaker_tinys3/sdkconfig | 37 ++------- .../mpconfigboard.mk | 4 +- .../waveshare_esp32_s2_pico_lcd/sdkconfig | 33 ++------ .../waveshare_esp32s2_pico/mpconfigboard.mk | 4 +- .../boards/waveshare_esp32s2_pico/sdkconfig | 21 ++--- .../sdkconfig-flash-dout.defaults | 6 ++ .../sdkconfig-flash-opi.defaults | 6 ++ .../sdkconfig-psram-120m.defaults | 3 + .../sdkconfig-psram-4MB.defaults | 4 + .../tools/update_all_board_sdkconfig.py | 20 +++++ 83 files changed, 391 insertions(+), 1229 deletions(-) delete mode 100644 ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig create mode 100644 ports/espressif/esp-idf-config/sdkconfig-flash-dout.defaults create mode 100644 ports/espressif/esp-idf-config/sdkconfig-flash-opi.defaults create mode 100644 ports/espressif/esp-idf-config/sdkconfig-psram-120m.defaults create mode 100644 ports/espressif/esp-idf-config/sdkconfig-psram-4MB.defaults create mode 100644 ports/espressif/tools/update_all_board_sdkconfig.py diff --git a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig deleted file mode 100644 index 3525371bc7..0000000000 --- a/ports/espressif/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig +++ /dev/null @@ -1,5 +0,0 @@ -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk index 4f7eaab71e..e45e4bc707 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk @@ -5,11 +5,13 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m OPTIMIZATION_FLAGS = -Os CIRCUITPY_ESPCAMERA = 0 - -CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig index 5d5860b546..f5ef797681 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig @@ -1,41 +1,9 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -# SPI RAM config -# -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # @@ -43,3 +11,5 @@ CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.mk index 8d001428cc..829acb46f9 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.mk @@ -3,8 +3,10 @@ CIRCUITPY_CREATION_ID = 0x00320003 IDF_TARGET = esp32 +CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig b/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig index ac74f0f06c..e69de29bb2 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig +++ b/ports/espressif/boards/adafruit_qtpy_esp32_pico/sdkconfig @@ -1,44 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -CONFIG_SPIRAM_SPEED_40M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_IGNORE_NOTFOUND=y -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set -CONFIG_SPIRAM_CACHE_WORKAROUND=y - -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set - -### # Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### # CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=32 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=7 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings diff --git a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.mk b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.mk index aef03973c0..fdb03078d4 100644 --- a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.mk +++ b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "Ai-Thinker" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/sdkconfig b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/sdkconfig index eacb2e75aa..e69de29bb2 100644 --- a/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/sdkconfig +++ b/ports/espressif/boards/ai_thinker_esp_12k_nodemcu/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.mk b/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.mk index 42a5901d97..705577187e 100644 --- a/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.mk +++ b/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.mk @@ -5,11 +5,13 @@ USB_MANUFACTURER = "BananaPi" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE=8MB CIRCUITPY_ESP_FLASH_MODE=dio CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=8MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel - -CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/bpi_leaf_s3/sdkconfig b/ports/espressif/boards/bpi_leaf_s3/sdkconfig index ee0414205d..6b3f2584c7 100644 --- a/ports/espressif/boards/bpi_leaf_s3/sdkconfig +++ b/ports/espressif/boards/bpi_leaf_s3/sdkconfig @@ -1,41 +1,9 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -# SPI RAM config -# -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # @@ -43,3 +11,5 @@ CONFIG_LWIP_LOCAL_HOSTNAME="BPI-Leaf-S3" # end of LWIP # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/bpi_picow_s3/mpconfigboard.mk b/ports/espressif/boards/bpi_picow_s3/mpconfigboard.mk index 36aa247870..02969c05c2 100644 --- a/ports/espressif/boards/bpi_picow_s3/mpconfigboard.mk +++ b/ports/espressif/boards/bpi_picow_s3/mpconfigboard.mk @@ -12,11 +12,13 @@ LONGINT_IMPL = MPZ # so increase it to 32. CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 +CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 8MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel - -CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/bpi_picow_s3/sdkconfig b/ports/espressif/boards/bpi_picow_s3/sdkconfig index 6a97d1351c..914b077264 100644 --- a/ports/espressif/boards/bpi_picow_s3/sdkconfig +++ b/ports/espressif/boards/bpi_picow_s3/sdkconfig @@ -1,41 +1,9 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -# SPI RAM config -# -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # @@ -43,3 +11,5 @@ CONFIG_LWIP_LOCAL_HOSTNAME="BPI-PicoW-S3" # end of LWIP # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk index 05a5eb3367..c7ee91cb3e 100755 --- a/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk +++ b/ports/espressif/boards/brainboardz_neuron/mpconfigboard.mk @@ -6,8 +6,10 @@ USB_MANUFACTURER = "BrainBoardz" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/brainboardz_neuron/sdkconfig b/ports/espressif/boards/brainboardz_neuron/sdkconfig index 16c84dd988..e553af1776 100755 --- a/ports/espressif/boards/brainboardz_neuron/sdkconfig +++ b/ports/espressif/boards/brainboardz_neuron/sdkconfig @@ -1,33 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM Clock and CS IO for ESP32S3 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="BrainBoardzNeuron" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.mk b/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.mk index a37170ba67..98ed6a50fc 100644 --- a/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.mk +++ b/ports/espressif/boards/cytron_maker_feather_aiot_s3/mpconfigboard.mk @@ -5,11 +5,13 @@ USB_MANUFACTURER = "Cytron" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 8MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel - -CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/cytron_maker_feather_aiot_s3/sdkconfig b/ports/espressif/boards/cytron_maker_feather_aiot_s3/sdkconfig index d9cbd73072..f5ef797681 100644 --- a/ports/espressif/boards/cytron_maker_feather_aiot_s3/sdkconfig +++ b/ports/espressif/boards/cytron_maker_feather_aiot_s3/sdkconfig @@ -1,33 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM Clock and CS IO for ESP32S3 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.mk index c59c277d45..65198b8936 100644 --- a/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32_eye/mpconfigboard.mk @@ -3,8 +3,10 @@ CIRCUITPY_CREATION_ID = 0x00320001 IDF_TARGET = esp32 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB -CIRCUITPY_ESP_PSRAM_SIZE = 0MB +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/espressif_esp32_eye/sdkconfig b/ports/espressif/boards/espressif_esp32_eye/sdkconfig index 0e53c6bbd1..0ff3ef839f 100644 --- a/ports/espressif/boards/espressif_esp32_eye/sdkconfig +++ b/ports/espressif/boards/espressif_esp32_eye/sdkconfig @@ -1,69 +1,35 @@ -# Automatically generated file. DO NOT EDIT. -# Espressif IoT Development Framework (ESP-IDF) Project Configuration +# +# Espressif IoT Development Framework Configuration # # # Component config # # -# ESP32-specific +# Hardware Settings # -# SPI RAM config # -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=-1 -CONFIG_SPIRAM_SPEED_40M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_IGNORE_NOTFOUND=y -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set -CONFIG_SPIRAM_CACHE_WORKAROUND=y -# CONFIG_SPIRAM_BANKSWITCH_ENABLE is not set -# end of SPI RAM config +# Sleep Config +# +CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND=y +# end of Sleep Config -# end of ESP32-specific - -# -# NVS -# -# CONFIG_NVS_ASSERT_ERROR_CHECK is not set -# end of NVS +# end of Hardware Settings # # Camera configuration # CONFIG_OV7670_SUPPORT=y -CONFIG_OV7725_SUPPORT=y CONFIG_NT99141_SUPPORT=y CONFIG_OV2640_SUPPORT=y -CONFIG_OV3660_SUPPORT=y -CONFIG_OV5640_SUPPORT=y CONFIG_GC2145_SUPPORT=y CONFIG_GC032A_SUPPORT=y CONFIG_GC0308_SUPPORT=y CONFIG_BF3005_SUPPORT=y CONFIG_BF20A6_SUPPORT=y -# CONFIG_SC101IOT_SUPPORT is not set CONFIG_SC030IOT_SUPPORT=y -# CONFIG_SCCB_HARDWARE_I2C_PORT0 is not set -CONFIG_SCCB_HARDWARE_I2C_PORT1=y -CONFIG_SCCB_CLK_FREQ=100000 -# CONFIG_GC_SENSOR_WINDOWING_MODE is not set CONFIG_GC_SENSOR_SUBSAMPLE_MODE=y -CONFIG_CAMERA_CORE0=y -# CONFIG_CAMERA_CORE1 is not set -# CONFIG_CAMERA_NO_AFFINITY is not set -CONFIG_CAMERA_DMA_BUFFER_SIZE_MAX=32768 # end of Camera configuration # end of Component config -# -CONFIG_ESP_CONSOLE_UART_TX_GPIO=1 -CONFIG_ESP_CONSOLE_UART_RX_GPIO=3 + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32_lyrat/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32_lyrat/mpconfigboard.mk index f618b436c4..57f3f8da81 100644 --- a/ports/espressif/boards/espressif_esp32_lyrat/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32_lyrat/mpconfigboard.mk @@ -3,10 +3,12 @@ CIRCUITPY_CREATION_ID = 0x0032A000 IDF_TARGET = esp32 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 4MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32_lyrat/sdkconfig b/ports/espressif/boards/espressif_esp32_lyrat/sdkconfig index e0db0b9800..e69de29bb2 100644 --- a/ports/espressif/boards/espressif_esp32_lyrat/sdkconfig +++ b/ports/espressif/boards/espressif_esp32_lyrat/sdkconfig @@ -1,36 +0,0 @@ -# SPI RAM config -# -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=4194304 -CONFIG_SPIRAM_SPEED_40M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_IGNORE_NOTFOUND=y -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set -CONFIG_SPIRAM_CACHE_WORKAROUND=y - -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### # CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=8 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=7 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings diff --git a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk index fbacf3fa3a..5f357ec503 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_box/mpconfigboard.mk @@ -5,10 +5,12 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_box/sdkconfig b/ports/espressif/boards/espressif_esp32s3_box/sdkconfig index 5fd3cc3b49..f5ef797681 100644 --- a/ports/espressif/boards/espressif_esp32s3_box/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_box/sdkconfig @@ -1,32 +1,15 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_MODE_OCT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM Clock and CS IO for ESP32S3 +# Espressif IoT Development Framework Configuration +# +# +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk index 4da1ab8ed3..af4d8840a0 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/mpconfigboard.mk @@ -5,10 +5,12 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig index 5fd3cc3b49..f5ef797681 100644 --- a/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_box_lite/sdkconfig @@ -1,32 +1,15 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_MODE_OCT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM Clock and CS IO for ESP32S3 +# Espressif IoT Development Framework Configuration +# +# +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk index 2fa3a5d115..223c3af6bf 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 -CIRCUITPY_ESP_FLASH_MODE = dout -CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 32MB +CIRCUITPY_ESP_FLASH_MODE = opi +CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig index 0b6abf41cf..f5ef797681 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n32r8/sdkconfig @@ -1,76 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM Clock and CS IO for ESP32S3 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y - -# -# Serial flasher config -# -CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 -# CONFIG_ESPTOOLPY_NO_STUB is not set -CONFIG_ESPTOOLPY_OCT_FLASH=y -CONFIG_ESPTOOLPY_FLASHMODE_OPI=y -# CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR is not set -CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_DTR=y -CONFIG_ESPTOOLPY_FLASHMODE="dout" -CONFIG_ESPTOOLPY_FLASHFREQ_80M=y -# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set -# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set -CONFIG_ESPTOOLPY_FLASHFREQ="80m" -# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE_32MB=y -# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set -# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set -CONFIG_ESPTOOLPY_FLASHSIZE="32MB" -CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y -CONFIG_ESPTOOLPY_BEFORE_RESET=y -# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set -CONFIG_ESPTOOLPY_BEFORE="default_reset" -CONFIG_ESPTOOLPY_AFTER_RESET=y -# CONFIG_ESPTOOLPY_AFTER_NORESET is not set -CONFIG_ESPTOOLPY_AFTER="hard_reset" -# CONFIG_ESPTOOLPY_MONITOR_BAUD_CONSOLE is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 -CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 -# end of Serial flasher config - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.mk index cd531b902f..bcc614c500 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig index ad74ab5f04..f5ef797681 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r2/sdkconfig @@ -1,41 +1,9 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -# SPI RAM config -# -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # @@ -43,3 +11,5 @@ CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.mk index 08ad0aee90..b71b354839 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/sdkconfig index d9cbd73072..f5ef797681 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8/sdkconfig @@ -1,33 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM Clock and CS IO for ESP32S3 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.mk index 3d57e485ae..0619284e83 100644 --- a/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_eye/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig b/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig index 285e2879bb..71778c5e6e 100644 --- a/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_eye/sdkconfig @@ -1,33 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM Clock and CS IO for ESP32S3 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3-eye" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk b/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk index 76817b1cee..83fc7650fd 100644 --- a/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk +++ b/ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.mk @@ -3,8 +3,10 @@ CIRCUITPY_CREATION_ID = 0x00320060 IDF_TARGET = esp32 +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_PSRAM_SIZE = 4MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/hardkernel_odroid_go/sdkconfig b/ports/espressif/boards/hardkernel_odroid_go/sdkconfig index 45da77ed9f..e69de29bb2 100644 --- a/ports/espressif/boards/hardkernel_odroid_go/sdkconfig +++ b/ports/espressif/boards/hardkernel_odroid_go/sdkconfig @@ -1,36 +0,0 @@ -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM32=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=4194304 -CONFIG_SPIRAM_SPEED_40M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_IGNORE_NOTFOUND=y -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set -CONFIG_SPIRAM_CACHE_WORKAROUND=y - -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### # CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### nCONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=12 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=15 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings diff --git a/ports/espressif/boards/lilygo_tembed_esp32s3/mpconfigboard.mk b/ports/espressif/boards/lilygo_tembed_esp32s3/mpconfigboard.mk index 8fb5099d61..bb7847cf27 100644 --- a/ports/espressif/boards/lilygo_tembed_esp32s3/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_tembed_esp32s3/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "LILYGO" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/lilygo_tembed_esp32s3/sdkconfig b/ports/espressif/boards/lilygo_tembed_esp32s3/sdkconfig index d9cbd73072..f5ef797681 100644 --- a/ports/espressif/boards/lilygo_tembed_esp32s3/sdkconfig +++ b/ports/espressif/boards/lilygo_tembed_esp32s3/sdkconfig @@ -1,33 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM Clock and CS IO for ESP32S3 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk index 2bfc8fb2c8..2af499b5c6 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "LILYGO" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig index 924d863dad..23f6593f1b 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="TTGO-T8-ESP32-S2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk index e9e333d497..052c1e5417 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "LILYGO" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig index 924d863dad..23f6593f1b 100644 --- a/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig +++ b/ports/espressif/boards/lilygo_ttgo_t8_s2_st7789/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="TTGO-T8-ESP32-S2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/lolin_s2_mini/mpconfigboard.mk b/ports/espressif/boards/lolin_s2_mini/mpconfigboard.mk index a3bbcaf2a5..a1b5333cf0 100644 --- a/ports/espressif/boards/lolin_s2_mini/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s2_mini/mpconfigboard.mk @@ -5,12 +5,13 @@ USB_MANUFACTURER = "Lolin" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel - -CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/lolin_s2_mini/sdkconfig b/ports/espressif/boards/lolin_s2_mini/sdkconfig index 0db55cbb67..ac239ca333 100644 --- a/ports/espressif/boards/lolin_s2_mini/sdkconfig +++ b/ports/espressif/boards/lolin_s2_mini/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="LS2Mini" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/lolin_s2_pico/mpconfigboard.mk b/ports/espressif/boards/lolin_s2_pico/mpconfigboard.mk index 5b027e6732..830c39e691 100644 --- a/ports/espressif/boards/lolin_s2_pico/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s2_pico/mpconfigboard.mk @@ -5,12 +5,13 @@ USB_MANUFACTURER = "Lolin" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel - -CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/lolin_s2_pico/sdkconfig b/ports/espressif/boards/lolin_s2_pico/sdkconfig index 8c5ca132d3..c2238c6814 100644 --- a/ports/espressif/boards/lolin_s2_pico/sdkconfig +++ b/ports/espressif/boards/lolin_s2_pico/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="Lolin-S2Pico" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/lolin_s3/mpconfigboard.mk b/ports/espressif/boards/lolin_s3/mpconfigboard.mk index a377fb0b56..fce42cef8d 100644 --- a/ports/espressif/boards/lolin_s3/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s3/mpconfigboard.mk @@ -5,11 +5,13 @@ USB_MANUFACTURER = "WEMOS" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m OPTIMIZATION_FLAGS = -Os CIRCUITPY_ESPCAMERA = 0 - -CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/lolin_s3/sdkconfig b/ports/espressif/boards/lolin_s3/sdkconfig index 77612d5c27..b90e3fa57e 100644 --- a/ports/espressif/boards/lolin_s3/sdkconfig +++ b/ports/espressif/boards/lolin_s3/sdkconfig @@ -1,42 +1,9 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -# SPI RAM config -# -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=8388608 -# -# PSRAM Clock and CS IO for ESP32S3 -# -# CONFIG_SPIRAM_CLK_IO=30 -# CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -CONFIG_SPIRAM_MODE_OCT=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # @@ -44,3 +11,5 @@ CONFIG_LWIP_LOCAL_HOSTNAME="LOLIN-S3" # end of LWIP # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk b/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk index 50e57c1c3c..591c596bbc 100644 --- a/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_core_fire/mpconfigboard.mk @@ -3,9 +3,12 @@ CIRCUITPY_CREATION_ID = 0x00320001 IDF_TARGET = esp32 +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESPCAMERA = 0 CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m + +CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_core_fire/sdkconfig b/ports/espressif/boards/m5stack_core_fire/sdkconfig index f228750600..0e7b970938 100644 --- a/ports/espressif/boards/m5stack_core_fire/sdkconfig +++ b/ports/espressif/boards/m5stack_core_fire/sdkconfig @@ -1,57 +1,37 @@ -CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y +# +# Espressif IoT Development Framework Configuration +# +# +# Security features +# +CONFIG_SECURE_BOOT_V2_RSA_SUPPORTED=y +CONFIG_SECURE_BOOT_V2_PREFERRED=y +# end of Security features + +# +# Component config +# +# +# Hardware Settings +# +# +# Chip revision +# +# CONFIG_ESP32_REV_MIN_0 is not set CONFIG_ESP32_REV_MIN_3=y +CONFIG_ESP32_REV_MIN=3 +CONFIG_ESP32_REV_MIN_FULL=300 +CONFIG_ESP_REV_MIN_FULL=300 +# end of Chip revision -# -# SPI RAM config -# -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -#CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config +# end of Hardware Settings -# -# PSRAM clock and cs IO for ESP32 -# -CONFIG_D0WD_PSRAM_CLK_IO=17 -CONFIG_D0WD_PSRAM_CS_IO=16 -# end of PSRAM clock and cs IO for ESP32 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="M5StaskCoreFire" # end of LWIP -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/microdev_micro_s2/mpconfigboard.mk b/ports/espressif/boards/microdev_micro_s2/mpconfigboard.mk index 226d901a3a..c090c69aac 100644 --- a/ports/espressif/boards/microdev_micro_s2/mpconfigboard.mk +++ b/ports/espressif/boards/microdev_micro_s2/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "MicroDev" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/microdev_micro_s2/sdkconfig b/ports/espressif/boards/microdev_micro_s2/sdkconfig index fbb7f22e95..f6158eac3e 100644 --- a/ports/espressif/boards/microdev_micro_s2/sdkconfig +++ b/ports/espressif/boards/microdev_micro_s2/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="MicroDev-microS2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.mk b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.mk index 2071da3fed..1707d32706 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.mk +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "Muselab" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/sdkconfig b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/sdkconfig index ff7d57ac57..e69de29bb2 100644 --- a/ports/espressif/boards/muselab_nanoesp32_s2_wrover/sdkconfig +++ b/ports/espressif/boards/muselab_nanoesp32_s2_wrover/sdkconfig @@ -1,25 +0,0 @@ -# -# SPI RAM config -# -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -CONFIG_SPIRAM_SPEED_40M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_USE_MEMMAP=y -CONFIG_SPIRAM_MEMTEST=y - -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.mk b/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.mk index 26722a30ea..f0a39b8a20 100644 --- a/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.mk +++ b/ports/espressif/boards/odt_pixelwing_esp32_s2/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "Oak Dev Tech" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/odt_pixelwing_esp32_s2/sdkconfig b/ports/espressif/boards/odt_pixelwing_esp32_s2/sdkconfig index 6ff95dec02..3017a9532f 100644 --- a/ports/espressif/boards/odt_pixelwing_esp32_s2/sdkconfig +++ b/ports/espressif/boards/odt_pixelwing_esp32_s2/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="PixelWing-ESP32S2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk b/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk index e13c654aa6..2422ee60ef 100644 --- a/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk +++ b/ports/espressif/boards/targett_module_clip_wroom/mpconfigboard.mk @@ -8,4 +8,5 @@ IDF_TARGET = esp32s2 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB + CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.mk b/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.mk index 2fd0d3e909..a2e862fa02 100644 --- a/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.mk +++ b/ports/espressif/boards/targett_module_clip_wrover/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "Targett" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m diff --git a/ports/espressif/boards/targett_module_clip_wrover/sdkconfig b/ports/espressif/boards/targett_module_clip_wrover/sdkconfig index d151cecdfb..e69de29bb2 100644 --- a/ports/espressif/boards/targett_module_clip_wrover/sdkconfig +++ b/ports/espressif/boards/targett_module_clip_wrover/sdkconfig @@ -1,36 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 -# -# PSRAM clock and cs IO for ESP32S2 -# -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# -# LWIP -# -CONFIG_LWIP_LOCAL_HOSTNAME="espressif" -# end of LWIP diff --git a/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.mk index 2d6c60b5e2..fda8f7bb22 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_feathers2/mpconfigboard.mk @@ -5,13 +5,15 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m CIRCUITPY_BITBANG_APA102 = 1 # Include these Python libraries in firmware. # FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar - -CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/unexpectedmaker_feathers2/sdkconfig b/ports/espressif/boards/unexpectedmaker_feathers2/sdkconfig index 28690986cc..a1e5e03b76 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_feathers2/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="UMFeatherS2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.mk index e72ee2f6cd..4f3ea4afac 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_feathers2_neo/mpconfigboard.mk @@ -5,13 +5,15 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m CIRCUITPY_BITBANG_NEOPIXEL = 1 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel - -CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_neo/sdkconfig b/ports/espressif/boards/unexpectedmaker_feathers2_neo/sdkconfig index 9f3970ffd4..cc781c9a3d 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_neo/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_feathers2_neo/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="UMFeatherS2Neo" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.mk index 2d6c60b5e2..fda8f7bb22 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/mpconfigboard.mk @@ -5,13 +5,15 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 40m -CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m CIRCUITPY_BITBANG_APA102 = 1 # Include these Python libraries in firmware. # FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DotStar - -CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/sdkconfig b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/sdkconfig index 28690986cc..a1e5e03b76 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_feathers2_prerelease/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="UMFeatherS2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.mk index cb8a4124f3..887ca5a122 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_feathers3/mpconfigboard.mk @@ -5,13 +5,15 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m #CIRCUITPY_BITBANG_NEOPIXEL = 1 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel - -CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig b/ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig index 33c772e712..3ccd3175c6 100644 --- a/ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig @@ -1,38 +1,15 @@ - # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 - # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -# CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# end of SPI RAM config - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="UMFeatherS3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.mk index 26e59a8edd..be2a711c6c 100644 --- a/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.mk @@ -5,13 +5,15 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m # CIRCUITPY_BITBANG_NEOPIXEL = 1 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel - -CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/unexpectedmaker_pros3/sdkconfig b/ports/espressif/boards/unexpectedmaker_pros3/sdkconfig index 39a822ffc3..21b91a2199 100644 --- a/ports/espressif/boards/unexpectedmaker_pros3/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_pros3/sdkconfig @@ -1,38 +1,15 @@ - # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 - # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -# CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# end of SPI RAM config - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="UMProS3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.mk index 61d34359dd..d600ce4d30 100644 --- a/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_tinypico/mpconfigboard.mk @@ -3,8 +3,10 @@ CIRCUITPY_CREATION_ID = 0x00000001 IDF_TARGET = esp32 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/unexpectedmaker_tinypico/sdkconfig b/ports/espressif/boards/unexpectedmaker_tinypico/sdkconfig index 6f14e60fc1..e69de29bb2 100644 --- a/ports/espressif/boards/unexpectedmaker_tinypico/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_tinypico/sdkconfig @@ -1,19 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -# CONFIG_SPIRAM_SIZE is not set -CONFIG_SPIRAM_SPEED_80M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_IGNORE_NOTFOUND=y -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set -CONFIG_SPIRAM_CACHE_WORKAROUND=y diff --git a/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.mk index 68879b1cd3..5f83793213 100644 --- a/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_tinypico_nano/mpconfigboard.mk @@ -3,8 +3,10 @@ CIRCUITPY_CREATION_ID = 0x00000002 IDF_TARGET = esp32 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/unexpectedmaker_tinypico_nano/sdkconfig b/ports/espressif/boards/unexpectedmaker_tinypico_nano/sdkconfig index 6f14e60fc1..e69de29bb2 100644 --- a/ports/espressif/boards/unexpectedmaker_tinypico_nano/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_tinypico_nano/sdkconfig @@ -1,19 +0,0 @@ -# -# SPI RAM config -# -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -# CONFIG_SPIRAM_SIZE is not set -CONFIG_SPIRAM_SPEED_80M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_IGNORE_NOTFOUND=y -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set -CONFIG_SPIRAM_CACHE_WORKAROUND=y diff --git a/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.mk index eec4bc1bbf..6b61ef12b7 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_tinys2/mpconfigboard.mk @@ -5,9 +5,13 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 40m CIRCUITPY_BITBANG_NEOPIXEL = 1 @@ -15,5 +19,3 @@ CIRCUITPY_STAGE = 1 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel - -CIRCUITPY_ESP_PSRAM_SIZE = 2MB diff --git a/ports/espressif/boards/unexpectedmaker_tinys2/sdkconfig b/ports/espressif/boards/unexpectedmaker_tinys2/sdkconfig index 7732382bee..647e33d8f5 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys2/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_tinys2/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_80M is not set -CONFIG_SPIRAM_SPEED_40M=y -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="UMTinyS2" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.mk b/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.mk index a66db4d19d..bf3521ed53 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.mk +++ b/ports/espressif/boards/unexpectedmaker_tinys3/mpconfigboard.mk @@ -5,9 +5,13 @@ USB_MANUFACTURER = "UnexpectedMaker" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 8MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 8MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m # CIRCUITPY_BITBANG_NEOPIXEL = 1 @@ -15,5 +19,3 @@ CIRCUITPY_STAGE = 1 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel - -CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig b/ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig index 8eb0875155..d08f76926e 100644 --- a/ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig +++ b/ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig @@ -1,40 +1,15 @@ - # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_MODE_OCT is not set -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 - # -# PSRAM clock and cs IO for ESP32S3 +# Component config # -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -# CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -# end of SPI RAM config - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="UMTinyS3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.mk b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.mk index a6b9c35b52..64987d2c13 100644 --- a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.mk +++ b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/mpconfigboard.mk @@ -6,8 +6,10 @@ USB_MANUFACTURER = "Waveshare Electronics" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_ESP_FLASH_MODE=dio CIRCUITPY_ESP_FLASH_FREQ=80m -CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig index c6ec24e77c..7c86f9f8e3 100644 --- a/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig +++ b/ports/espressif/boards/waveshare_esp32_s2_pico_lcd/sdkconfig @@ -1,36 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_TYPE_AUTO is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config - -CONFIG_SPIRAM_CLK_IO=30 # -# PSRAM clock and cs IO for ESP32S2 +# Component config # -CONFIG_SPIRAM_CS_IO=26 -# end of PSRAM clock and cs IO for ESP32S2 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="waveshare" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk b/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk index 7e4fdbb3c2..e845f33327 100644 --- a/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk +++ b/ports/espressif/boards/waveshare_esp32s2_pico/mpconfigboard.mk @@ -5,8 +5,10 @@ USB_MANUFACTURER = "Waveshare Electronics" IDF_TARGET = esp32s2 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 120m diff --git a/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig b/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig index 8172e82e3c..7c86f9f8e3 100644 --- a/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig +++ b/ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig @@ -1,20 +1,15 @@ # -# SPI RAM config +# Espressif IoT Development Framework Configuration +# +# +# Component config # -CONFIG_ESP32S2_SPIRAM_SUPPORT=y -CONFIG_SPIRAM_CLK_IO=30 -CONFIG_SPIRAM_CS_IO=26 -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_MODE_QUAD=y -CONFIG_SPIRAM_SIZE=8388608 -CONFIG_SPIRAM_SPEED_120M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -CONFIG_SPIRAM_USE_MEMMAP=y -CONFIG_SPIRAM_MEMTEST=y - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="waveshare" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-flash-dout.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-dout.defaults new file mode 100644 index 0000000000..e0f319ce39 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-dout.defaults @@ -0,0 +1,6 @@ +# CONFIG_ESPTOOLPY_OCT_FLASH is not set +# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set +# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set +# CONFIG_ESPTOOLPY_FLASHMODE_DIO is not set +CONFIG_ESPTOOLPY_FLASHMODE_DOUT=y +# CONFIG_ESPTOOLPY_FLASHMODE_OPI is not set diff --git a/ports/espressif/esp-idf-config/sdkconfig-flash-opi.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-opi.defaults new file mode 100644 index 0000000000..90e1291cc8 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-opi.defaults @@ -0,0 +1,6 @@ +CONFIG_ESPTOOLPY_OCT_FLASH=y +# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set +# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set +# CONFIG_ESPTOOLPY_FLASHMODE_DIO is not set +# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +# CONFIG_ESPTOOLPY_FLASHMODE_OPI is not set diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram-120m.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram-120m.defaults new file mode 100644 index 0000000000..4ff192db3a --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-psram-120m.defaults @@ -0,0 +1,3 @@ +CONFIG_SPIRAM_SPEED_120M=y +# CONFIG_SPIRAM_SPEED_80M is not set +# CONFIG_SPIRAM_SPEED_40M is not set diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram-4MB.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram-4MB.defaults new file mode 100644 index 0000000000..86ef9bcf4b --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-psram-4MB.defaults @@ -0,0 +1,4 @@ +# CONFIG_SPIRAM_TYPE_AUTO is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +CONFIG_SPIRAM_TYPE_ESPPSRAM32=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set diff --git a/ports/espressif/tools/update_all_board_sdkconfig.py b/ports/espressif/tools/update_all_board_sdkconfig.py new file mode 100644 index 0000000000..60f7c7e045 --- /dev/null +++ b/ports/espressif/tools/update_all_board_sdkconfig.py @@ -0,0 +1,20 @@ +import pathlib +import sys +import shlex +import subprocess + + +def run(cmd): + proc = subprocess.run(shlex.split(cmd), capture_output=True) + return proc.returncode == 0 + + +failed_count = 0 +for board in sorted(list(pathlib.Path("boards/").glob("*/"))): + board = board.name + print(board) + if not run(f"make BOARD={board} clean update-board-sdkconfig"): + print(" Failed!") + failed_count += 1 + +print(f"{failed_count} boards failed") From 99726e255d55b9073fcf3d23ec94a41c2f162fa0 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 12 Sep 2023 12:18:21 -0700 Subject: [PATCH 1682/1712] Switch to newlib nano --- ports/espressif/Makefile | 13 +++++++++++-- .../boards/adafruit_esp32s3_camera/sdkconfig | 7 +++++++ .../esp-idf-config/sdkconfig-esp32.defaults | 6 ++++++ .../esp-idf-config/sdkconfig-esp32c3.defaults | 6 ++++++ .../esp-idf-config/sdkconfig-esp32s2.defaults | 6 ++++++ .../esp-idf-config/sdkconfig-esp32s3.defaults | 6 ++++++ .../sdkconfig-flash-4MB-no-uf2.defaults | 11 +++++++++-- .../sdkconfig-flash-8MB-no-uf2.defaults | 11 +++++++++-- ports/espressif/mpconfigport.mk | 1 + 9 files changed, 61 insertions(+), 6 deletions(-) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 69b2ff1a38..b400cd06b7 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -135,7 +135,7 @@ ifeq ($(DEBUG), 1) # You may want to enable these flags to make setting breakpoints easier. # CFLAGS += -fno-inline -fno-ipa-sra else - CFLAGS += -DNDEBUG -ggdb3 + CFLAGS += -DNDEBUG # RISC-V is larger than xtensa # Use -Os for RISC-V when it overflows ifeq ($(IDF_TARGET_ARCH),riscv) @@ -150,6 +150,11 @@ CFLAGS += $(OPTIMIZATION_FLAGS) CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_DEFS) $(CFLAGS_MOD) $(COPT) -Werror=missing-prototypes +# Most current ESPs have nano versions of newlib in ROM so we use them. +ifneq ($(IDF_TARGET),esp32c6) + CFLAGS += --specs=nano.specs +endif + ifeq ($(IDF_TARGET_ARCH),xtensa) CFLAGS += -mlongcalls else ifeq ($(IDF_TARGET_ARCH),riscv) @@ -412,8 +417,12 @@ endif ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc esp_app_format esp_common esp_event esp_hw_support esp_netif esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant ifneq ($(CIRCUITPY_BLEIO),0) ESP_IDF_COMPONENTS_LINK += bt + ifeq ($(IDF_TARGET),esp32) + BINARY_BLOBS += esp-idf/components/bt/controller/lib_esp32/$(IDF_TARGET)/libbtdm_app.a + else BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libbtbb.a \ - esp-idf/components/bt/controller/lib_esp32c3_family/$(IDF_TARGET)/libbtdm_app.a + esp-idf/components/bt/controller/lib_esp32c3_family/$(IDF_TARGET)/libbtdm_app.a + endif endif ifneq ($(CIRCUITPY_ESPULP),0) ESP_IDF_COMPONENTS_LINK += ulp diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig b/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig index f5ef797681..1bddb7a89f 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig +++ b/ports/espressif/boards/adafruit_esp32s3_camera/sdkconfig @@ -10,6 +10,13 @@ CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP +# +# Camera configuration +# +# CONFIG_OV7725_SUPPORT is not set +# CONFIG_OV3660_SUPPORT is not set +# end of Camera configuration + # end of Component config # end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults index 980619b7a6..5ae4d4c6b5 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults @@ -56,6 +56,12 @@ CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 # CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set # end of Wi-Fi +# +# Newlib +# +CONFIG_NEWLIB_NANO_FORMAT=y +# end of Newlib + # # SPI Flash driver # diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults index 1f328c0179..1a47619e52 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults @@ -49,6 +49,12 @@ CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y # end of Driver Configurations +# +# Newlib +# +CONFIG_NEWLIB_NANO_FORMAT=y +# end of Newlib + # end of Component config # end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults index 9afec598c4..6f3d004785 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults @@ -46,6 +46,12 @@ CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM=y # end of ESP System Settings +# +# Newlib +# +CONFIG_NEWLIB_NANO_FORMAT=y +# end of Newlib + # # Ultra Low Power (ULP) Co-processor # diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults index 437aec9119..c13240cff0 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults @@ -85,6 +85,12 @@ CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 # CONFIG_ESP32_WIFI_NVS_ENABLED is not set # end of Wi-Fi +# +# Newlib +# +CONFIG_NEWLIB_NANO_FORMAT=y +# end of Newlib + # # Ultra Low Power (ULP) Co-processor # diff --git a/ports/espressif/esp-idf-config/sdkconfig-flash-4MB-no-uf2.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-4MB-no-uf2.defaults index 2325a67296..d24998167e 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-flash-4MB-no-uf2.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-4MB-no-uf2.defaults @@ -1,4 +1,7 @@ # +# Espressif IoT Development Framework Configuration +# +# # Serial flasher config # # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set @@ -6,13 +9,17 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set CONFIG_ESPTOOLPY_FLASHSIZE="4MB" -CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y # end of Serial flasher config -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB-no-uf2.csv" # # Partition Table # +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-4MB-no-uf2.csv" CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-4MB-no-uf2.csv" # end of Partition Table + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-flash-8MB-no-uf2.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-8MB-no-uf2.defaults index 2a2548ba04..eda2a71c62 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-flash-8MB-no-uf2.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-8MB-no-uf2.defaults @@ -1,4 +1,7 @@ # +# Espressif IoT Development Framework Configuration +# +# # Serial flasher config # # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set @@ -6,13 +9,17 @@ # CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set CONFIG_ESPTOOLPY_FLASHSIZE="8MB" -CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y # end of Serial flasher config -CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv" # # Partition Table # +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv" CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv" # end of Partition Table + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index 2c358637cc..bb15fce92b 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -49,6 +49,7 @@ CIRCUITPY_WIFI ?= 1 ifeq ($(IDF_TARGET),esp32) # Modules CIRCUITPY_RGBMATRIX = 0 +CIRCUITPY_BLEIO = 0 # Features CIRCUITPY_USB = 0 From f357f4a3af11c813564538c3e816752eb0640226 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 12 Sep 2023 13:30:34 -0700 Subject: [PATCH 1683/1712] Size optimize 3 more boards --- .../adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk | 2 ++ ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk | 2 ++ ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk index a4e5dbf1e9..56dd344dbf 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_feather_esp32s3_reverse_tft/mpconfigboard.mk @@ -15,3 +15,5 @@ CIRCUITPY_ESP_PSRAM_MODE = qio CIRCUITPY_ESP_PSRAM_FREQ = 80m CIRCUITPY_ESPCAMERA = 0 + +OPTIMIZATION_FLAGS = -Os diff --git a/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk b/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk index fc1cf53139..a8b3e35118 100644 --- a/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk +++ b/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk @@ -15,3 +15,5 @@ CIRCUITPY_ESP_PSRAM_MODE = qio CIRCUITPY_ESP_PSRAM_FREQ = 80m CIRCUITPY_ESPCAMERA = 0 + +OPTIMIZATION_FLAGS = -Os diff --git a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk index 4c54787bbb..2bd303adb3 100644 --- a/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_s3_mini/mpconfigboard.mk @@ -13,7 +13,7 @@ CIRCUITPY_ESP_PSRAM_SIZE = 2MB CIRCUITPY_ESP_PSRAM_MODE = qio CIRCUITPY_ESP_PSRAM_FREQ = 40m -# OPTIMIZATION_FLAGS = -Os +OPTIMIZATION_FLAGS = -Os CIRCUITPY_ESPCAMERA = 0 # Include these Python libraries in firmware. From a3d37122a7f40a507c2bccbd3154b7ed40c8f5ec Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 13 Sep 2023 11:26:26 -0700 Subject: [PATCH 1684/1712] Fix PSRAM address --- ports/espressif/common-hal/espidf/__init__.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ports/espressif/common-hal/espidf/__init__.c b/ports/espressif/common-hal/espidf/__init__.c index a45964054d..7ab5ab9efb 100644 --- a/ports/espressif/common-hal/espidf/__init__.c +++ b/ports/espressif/common-hal/espidf/__init__.c @@ -108,9 +108,7 @@ size_t common_hal_espidf_get_total_psram(void) { intptr_t common_hal_espidf_get_psram_start(void) { #ifdef CONFIG_SPIRAM - if (esp_psram_is_initialized()) { - return SOC_EXTRAM_DATA_LOW; - } + return (intptr_t)esp_psram_get_address(); #endif return 0; } @@ -118,7 +116,7 @@ intptr_t common_hal_espidf_get_psram_start(void) { intptr_t common_hal_espidf_get_psram_end(void) { #ifdef CONFIG_SPIRAM if (esp_psram_is_initialized()) { - return SOC_EXTRAM_DATA_LOW + psram_size_usable(); + return common_hal_espidf_get_psram_start() + psram_size_usable(); } #endif return 0; From 952118f6c3b593c9ebfd573cba7ce68374abc97b Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 14 Sep 2023 11:19:38 -0700 Subject: [PATCH 1685/1712] Update new boards. Reduce memory use in S2 --- .gitmodules | 2 +- .../adafruit_esp32s3_camera/mpconfigboard.mk | 3 +- .../mpconfigboard.mk | 6 +- .../adafruit_qualia_s3_rgb666/sdkconfig | 48 +++++------- .../arduino_nano_esp32s3/mpconfigboard.mk | 10 ++- .../boards/arduino_nano_esp32s3/sdkconfig | 42 ++-------- .../mpconfigboard.mk | 10 ++- .../sdkconfig | 42 ++-------- .../boards/espressif_esp32_eye/sdkconfig | 11 --- .../mpconfigboard.mk | 6 +- .../mpconfigboard.mk | 4 + .../sdkconfig | 64 ++++----------- .../boards/m5stack_atoms3u/sdkconfig | 12 ++- .../espressif/boards/m5stack_core2/sdkconfig | 6 -- .../boards/m5stack_m5paper/mpconfigboard.mk | 5 ++ .../boards/m5stack_m5paper/sdkconfig | 77 +++++++------------ .../boards/makerfabs_tft7/mpconfigboard.mk | 4 + .../espressif/boards/makerfabs_tft7/sdkconfig | 53 +++++-------- .../waveshare_esp32_s3_pico/mpconfigboard.mk | 4 + .../boards/waveshare_esp32_s3_pico/sdkconfig | 42 ++-------- ports/espressif/common-hal/ssl/SSLSocket.c | 11 ++- ports/espressif/common-hal/ssl/SSLSocket.h | 1 - ports/espressif/common-hal/wifi/__init__.c | 14 +++- .../esp-idf-config/sdkconfig-esp32s2.defaults | 11 +++ .../esp-idf-config/sdkconfig-psram.defaults | 11 --- .../esp-idf-config/sdkconfig.defaults | 7 +- ports/espressif/supervisor/port.c | 2 +- ports/espressif/tools/update_sdkconfig.py | 7 +- 28 files changed, 200 insertions(+), 315 deletions(-) diff --git a/.gitmodules b/.gitmodules index 80fcc99133..16fdbcf5a1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -342,7 +342,7 @@ url = https://github.com/bablokb/circuitpython-pcf85063a [submodule "frozen/Adafruit_CircuitPython_Wave"] path = frozen/Adafruit_CircuitPython_Wave - url = http://github.com/adafruit/Adafruit_CircuitPython_Wave.git + url = https://github.com/adafruit/Adafruit_CircuitPython_Wave.git [submodule "ports/raspberrypi/lib/Pico-PIO-USB"] path = ports/raspberrypi/lib/Pico-PIO-USB url = https://github.com/sekigon-gonnoc/Pico-PIO-USB.git diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk index 57087cf0e0..0b9deaaf10 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk @@ -5,9 +5,10 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 4MB + CIRCUITPY_ESP_PSRAM_SIZE = 2MB CIRCUITPY_ESP_PSRAM_MODE = qio CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk b/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk index 1bde6abfe4..3db489c5de 100644 --- a/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk @@ -5,8 +5,12 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 +CIRCUITPY_ESP_FLASH_SIZE = 16MB CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1 diff --git a/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig b/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig index 79d78825fc..e9dc0663bd 100644 --- a/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig +++ b/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig @@ -1,41 +1,29 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # -# SPI RAM config +# Espressif IoT Development Framework Configuration +# +# +# Component config # -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_TYPE_AUTO=y -# end of SPI RAM config -CONFIG_DEFAULT_PSRAM_CLK_IO=30 # -# PSRAM Clock and CS IO for ESP32S3 +# ESP System Settings # -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 +CONFIG_ESP_CONSOLE_UART_CUSTOM=y +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART=y +CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 +CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +# end of ESP System Settings -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="qualia" # end of LWIP -# -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -CONFIG_ESP_CONSOLE_UART_CUSTOM=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 -CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 -CONFIG_ESP_CONSOLE_UART=y + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk index c9af3af25e..c342e5e2cb 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk +++ b/ports/espressif/boards/arduino_nano_esp32s3/mpconfigboard.mk @@ -6,9 +6,17 @@ USB_MANUFACTURER = "Arduino" IDF_TARGET = esp32s3 +# This has a u-blox® NORA-W106-10B module. + +# This flash lives outside the module. CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP_FLASH_SIZE = 16MB + +# This PSRAM is in the module. +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m INTERNAL_FLASH_FILESYSTEM = 0 QSPI_FLASH_FILESYSTEM = 1 diff --git a/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig b/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig index 2acf08a4a7..f5ef797681 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig +++ b/ports/espressif/boards/arduino_nano_esp32s3/sdkconfig @@ -1,43 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_SPIRAM_SUPPORT=y - -# -# SPI RAM config -# -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk index 925c4ab6e2..70b2abfede 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/mpconfigboard.mk @@ -6,9 +6,17 @@ USB_MANUFACTURER = "Arduino" IDF_TARGET = esp32s3 +# This has a u-blox® NORA-W106-10B module. + +# This flash lives outside the module. CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m -CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP_FLASH_SIZE = 16MB + +# This PSRAM is in the module. +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m INTERNAL_FLASH_FILESYSTEM = 0 QSPI_FLASH_FILESYSTEM = 1 diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig index 26a26b5fe8..b2e5c546b8 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/sdkconfig @@ -1,43 +1,15 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_SPIRAM_SUPPORT=y - -# -# SPI RAM config -# -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="nano-esp32" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32_eye/sdkconfig b/ports/espressif/boards/espressif_esp32_eye/sdkconfig index 0ff3ef839f..dc4ef1fc52 100644 --- a/ports/espressif/boards/espressif_esp32_eye/sdkconfig +++ b/ports/espressif/boards/espressif_esp32_eye/sdkconfig @@ -4,17 +4,6 @@ # # Component config # -# -# Hardware Settings -# -# -# Sleep Config -# -CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND=y -# end of Sleep Config - -# end of Hardware Settings - # # Camera configuration # diff --git a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk index 83a41e8f3f..51abedf36a 100644 --- a/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s2_devkitc_1_n4r2/mpconfigboard.mk @@ -5,10 +5,10 @@ USB_MANUFACTURER = "Espressif" IDF_TARGET = esp32s2 -CIRCUITPY_ESP_FLASH_MODE = dio -CIRCUITPY_ESP_FLASH_FREQ = 40m CIRCUITPY_ESP_FLASH_SIZE = 4MB +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_PSRAM_SIZE = 2MB CIRCUITPY_ESP_PSRAM_MODE = qio -CIRCUITPY_ESP_PSRAM_FREQ = 40m +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.mk index 1bd9c0ac8d..99daa4ab98 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/mpconfigboard.mk @@ -9,4 +9,8 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m + CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1 diff --git a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/sdkconfig b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/sdkconfig index 40da78d506..0452053c1e 100644 --- a/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_devkitc_1_n8r8_hacktablet/sdkconfig @@ -1,48 +1,21 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # # -# ESP32S3-Specific +# ESP System Settings # -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# -# SPI RAM config -# -#CONFIG_SPIRAM_MODE_QUAD=y -### NEW ### -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_TYPE_AUTO=y -####### -# CONFIG_SPIRAM_MODE_OCT is not set -# CONFIG_SPIRAM_TYPE_AUTO is not set -#CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -#CONFIG_SPIRAM_SIZE=2097152 -CONFIG_SPIRAM_TYPE_ESPPSRAM64=y -CONFIG_SPIRAM_SIZE=8388608 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific +CONFIG_ESP_CONSOLE_UART_CUSTOM=y +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART=y +CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 +CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +# end of ESP System Settings # # LWIP @@ -50,13 +23,6 @@ CONFIG_SPIRAM_MEMTEST=y CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3-hacktablet" # end of LWIP -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -CONFIG_ESP_CONSOLE_UART_CUSTOM=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 -CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 -CONFIG_ESP_CONSOLE_UART=y - # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_atoms3u/sdkconfig b/ports/espressif/boards/m5stack_atoms3u/sdkconfig index 9d924272ec..f5ef797681 100644 --- a/ports/espressif/boards/m5stack_atoms3u/sdkconfig +++ b/ports/espressif/boards/m5stack_atoms3u/sdkconfig @@ -1,7 +1,15 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=n - +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/m5stack_core2/sdkconfig b/ports/espressif/boards/m5stack_core2/sdkconfig index b8a37f0d84..c8ac5f43ac 100644 --- a/ports/espressif/boards/m5stack_core2/sdkconfig +++ b/ports/espressif/boards/m5stack_core2/sdkconfig @@ -24,12 +24,6 @@ CONFIG_ESP32_REV_MIN_FULL=300 CONFIG_ESP_REV_MIN_FULL=300 # end of Chip revision -# -# Sleep Config -# -CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND=y -# end of Sleep Config - # end of Hardware Settings # diff --git a/ports/espressif/boards/m5stack_m5paper/mpconfigboard.mk b/ports/espressif/boards/m5stack_m5paper/mpconfigboard.mk index d3e2bb2aac..bacf270a66 100644 --- a/ports/espressif/boards/m5stack_m5paper/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_m5paper/mpconfigboard.mk @@ -6,4 +6,9 @@ IDF_TARGET = esp32 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m + CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_m5paper/sdkconfig b/ports/espressif/boards/m5stack_m5paper/sdkconfig index afbee57d19..fbf94f2749 100644 --- a/ports/espressif/boards/m5stack_m5paper/sdkconfig +++ b/ports/espressif/boards/m5stack_m5paper/sdkconfig @@ -1,58 +1,37 @@ -CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y -CONFIG_ESP32_SPIRAM_SUPPORT=y +# +# Espressif IoT Development Framework Configuration +# +# +# Security features +# +CONFIG_SECURE_BOOT_V2_RSA_SUPPORTED=y +CONFIG_SECURE_BOOT_V2_PREFERRED=y +# end of Security features + +# +# Component config +# +# +# Hardware Settings +# +# +# Chip revision +# +# CONFIG_ESP32_REV_MIN_0 is not set CONFIG_ESP32_REV_MIN_3=y +CONFIG_ESP32_REV_MIN=3 +CONFIG_ESP32_REV_MIN_FULL=300 +CONFIG_ESP_REV_MIN_FULL=300 +# end of Chip revision -# -# SPI RAM config -# -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -#CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=8388608 -# end of SPI RAM config +# end of Hardware Settings -# -# PSRAM clock and cs IO for ESP32 -# -CONFIG_D0WD_PSRAM_CLK_IO=17 -CONFIG_D0WD_PSRAM_CS_IO=16 -# end of PSRAM clock and cs IO for ESP32 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -# CONFIG_SPIRAM_SPEED_26M is not set -# CONFIG_SPIRAM_SPEED_20M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="M5Paper" # end of LWIP -# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins -### # -### # ESP System Settings -### # -### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y -### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -### CONFIG_ESP_CONSOLE_UART_CUSTOM=y -### CONFIG_ESP_CONSOLE_NONE is not set -### CONFIG_ESP_CONSOLE_UART=y -### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set -### CONFIG_ESP_CONSOLE_UART_NUM=0 -### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17 -### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16 -### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set -### # end of ESP System Settings +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk b/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk index e6efc34ef7..dbe7940c7e 100644 --- a/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk +++ b/ports/espressif/boards/makerfabs_tft7/mpconfigboard.mk @@ -9,4 +9,8 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m + CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1 diff --git a/ports/espressif/boards/makerfabs_tft7/sdkconfig b/ports/espressif/boards/makerfabs_tft7/sdkconfig index 2514dd506b..e05ead7960 100644 --- a/ports/espressif/boards/makerfabs_tft7/sdkconfig +++ b/ports/espressif/boards/makerfabs_tft7/sdkconfig @@ -1,41 +1,28 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_TYPE_AUTO=y -# end of SPI RAM config +# +# Component config +# +# +# ESP System Settings +# +CONFIG_ESP_CONSOLE_UART_CUSTOM=y +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART=y +CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 +CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +# end of ESP System Settings -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -#CONFIG_SPIRAM_USE_MEMMAP=y -CONFIG_SPIRAM_USE_CAPS_ALLOC=y -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="matouch-tft" # end of LWIP -# -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -CONFIG_ESP_CONSOLE_UART_CUSTOM=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 -CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 -CONFIG_ESP_CONSOLE_UART=y + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk index 116a998b74..76b6eb2206 100644 --- a/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/mpconfigboard.mk @@ -8,3 +8,7 @@ IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB + +CIRCUITPY_ESP_PSRAM_SIZE = 2MB +CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig b/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig index 3e366f0172..f5ef797681 100644 --- a/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig +++ b/ports/espressif/boards/waveshare_esp32_s3_pico/sdkconfig @@ -1,43 +1,9 @@ # +# Espressif IoT Development Framework Configuration +# +# # Component config # -# -# ESP32S3-Specific -# -CONFIG_ESP32S3_SPIRAM_SUPPORT=y -# -# SPI RAM config -# -CONFIG_SPIRAM_MODE_QUAD=y -# CONFIG_SPIRAM_MODE_OCT is not set -# CONFIG_SPIRAM_TYPE_AUTO is not set -CONFIG_SPIRAM_TYPE_ESPPSRAM16=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=2097152 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -# CONFIG_SPIRAM_SPEED_120M is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y -# end of SPI RAM config - -# end of ESP32S3-Specific - # # LWIP # @@ -45,3 +11,5 @@ CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32s3" # end of LWIP # end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/common-hal/ssl/SSLSocket.c b/ports/espressif/common-hal/ssl/SSLSocket.c index 9413fc7def..b94924000b 100644 --- a/ports/espressif/common-hal/ssl/SSLSocket.c +++ b/ports/espressif/common-hal/ssl/SSLSocket.c @@ -33,6 +33,7 @@ #include "shared/runtime/interrupt_char.h" #include "py/mperrno.h" #include "py/runtime.h" +#include "supervisor/port.h" #include "supervisor/shared/tick.h" #include "lwip/sockets.h" @@ -56,12 +57,16 @@ void common_hal_ssl_sslsocket_close(ssl_sslsocket_obj_t *self) { void common_hal_ssl_sslsocket_connect(ssl_sslsocket_obj_t *self, const char *host, size_t hostlen, uint32_t port) { + // Yield briefly so that the IDF can clean up memory before we need more. + port_yield(); int result = esp_tls_conn_new_sync(host, hostlen, port, &self->ssl_config, self->tls); self->sock->connected = result >= 0; if (result < 0) { int esp_tls_code; int flags; - esp_err_t err = esp_tls_get_and_clear_last_error(self->tls_error_handle, &esp_tls_code, &flags); + esp_tls_error_handle_t tls_error_handle; + esp_tls_get_error_handle(self->tls, &tls_error_handle); + esp_err_t err = esp_tls_get_and_clear_last_error(tls_error_handle, &esp_tls_code, &flags); if (err == ESP_ERR_MBEDTLS_SSL_SETUP_FAILED) { mp_raise_espidf_MemoryError(); @@ -155,7 +160,9 @@ mp_uint_t common_hal_ssl_sslsocket_send(ssl_sslsocket_obj_t *self, const uint8_t if (sent < 0) { int esp_tls_code; int flags; - esp_err_t err = esp_tls_get_and_clear_last_error(self->tls_error_handle, &esp_tls_code, &flags); + esp_tls_error_handle_t tls_error_handle; + esp_tls_get_error_handle(self->tls, &tls_error_handle); + esp_err_t err = esp_tls_get_and_clear_last_error(tls_error_handle, &esp_tls_code, &flags); if (err == ESP_ERR_MBEDTLS_SSL_SETUP_FAILED) { mp_raise_espidf_MemoryError(); diff --git a/ports/espressif/common-hal/ssl/SSLSocket.h b/ports/espressif/common-hal/ssl/SSLSocket.h index a7977db746..6b65a56223 100644 --- a/ports/espressif/common-hal/ssl/SSLSocket.h +++ b/ports/espressif/common-hal/ssl/SSLSocket.h @@ -38,7 +38,6 @@ typedef struct ssl_sslsocket_obj { mp_obj_base_t base; socketpool_socket_obj_t *sock; esp_tls_t *tls; - esp_tls_error_handle_t tls_error_handle; ssl_sslcontext_obj_t *ssl_context; esp_tls_cfg_t ssl_config; } ssl_sslsocket_obj_t; diff --git a/ports/espressif/common-hal/wifi/__init__.c b/ports/espressif/common-hal/wifi/__init__.c index 1ffc768002..769ed8ab04 100644 --- a/ports/espressif/common-hal/wifi/__init__.c +++ b/ports/espressif/common-hal/wifi/__init__.c @@ -32,6 +32,7 @@ #include "shared-bindings/wifi/Monitor.h" #include "shared-bindings/wifi/Radio.h" +#include "py/gc.h" #include "py/mpstate.h" #include "py/runtime.h" @@ -162,8 +163,8 @@ void common_hal_wifi_init(bool user_initiated) { if (!wifi_ever_inited) { ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); + wifi_ever_inited = true; } - wifi_ever_inited = true; self->netif = esp_netif_create_default_wifi_sta(); self->ap_netif = esp_netif_create_default_wifi_ap(); @@ -201,9 +202,16 @@ void common_hal_wifi_init(bool user_initiated) { #endif esp_err_t result = esp_wifi_init(&config); if (result == ESP_ERR_NO_MEM) { - mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate Wifi memory")); + if (gc_alloc_possible()) { + mp_raise_msg(&mp_type_MemoryError, translate("Failed to allocate Wifi memory")); + } + ESP_LOGE(TAG, "Failed to allocate Wifi memory"); } else if (result != ESP_OK) { - raise_esp_error(result); + if (gc_alloc_possible()) { + raise_esp_error(result); + } + ESP_LOGE(TAG, "WiFi error code: %d", result); + return; } // set station mode to avoid the default SoftAP common_hal_wifi_radio_start_station(self); diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults index 6f3d004785..09c5a69663 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults @@ -46,6 +46,17 @@ CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM=y # end of ESP System Settings +# +# Wi-Fi +# +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_RX_BA_WIN=4 +# CONFIG_ESP32_WIFI_NVS_ENABLED is not set +# end of Wi-Fi + # # Newlib # diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram.defaults index d00b1f3d2a..f1bc476a9f 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-psram.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-psram.defaults @@ -4,17 +4,6 @@ # # Component config # -# -# Hardware Settings -# -# -# Sleep Config -# -# CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND is not set -# end of Sleep Config - -# end of Hardware Settings - # # ESP PSRAM # diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index 279c23c2c5..55a8e3cc06 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -57,6 +57,12 @@ CONFIG_LWIP_TCP_RTO_TIME=3000 # mbedTLS # CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=2048 +# +# mbedTLS v3.x related +# +# CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE is not set +# end of mbedTLS v3.x related + # # Certificate Bundle # @@ -65,7 +71,6 @@ CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE=y CONFIG_MBEDTLS_CUSTOM_CERTIFICATE_BUNDLE_PATH="../../lib/certificates/data/roots.pem" # end of Certificate Bundle -CONFIG_MBEDTLS_TLS_CLIENT_ONLY=y # # TLS Key Exchange Methods # diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index 2d2089a587..d605dc2b79 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -251,7 +251,7 @@ safe_mode_t port_init(void) { // Send the ROM output out of the UART. This includes early logs. #if DEBUG - ets_install_uart_printf(); + esp_rom_install_uart_printf(); #endif heap = NULL; diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index 898c8979eb..42500412e0 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -163,6 +163,7 @@ def update(debug, board, update_all): board_make = pathlib.Path(f"boards/{board}/mpconfigboard.mk") psram_size = "0" + uf2_bootloader = None for line in board_make.read_text().split("\n"): if "=" not in line or line.startswith("#"): continue @@ -171,6 +172,8 @@ def update(debug, board, update_all): value = value.strip() if key == "IDF_TARGET": target = value + if uf2_bootloader is None: + uf2_bootloader = target not in ("esp32", "esp32c3") elif key == "CIRCUITPY_ESP_FLASH_SIZE": flash_size = value elif key == "CIRCUITPY_ESP_FLASH_MODE": @@ -183,6 +186,8 @@ def update(debug, board, update_all): psram_mode = value elif key == "CIRCUITPY_ESP_PSRAM_FREQ": psram_freq = value + elif key == "UF2_BOOTLOADER": + uf2_bootloader = not (value == "0") os.environ["IDF_TARGET"] = target os.environ[ @@ -209,7 +214,7 @@ def update(debug, board, update_all): size_options = "" if flash_size == "2MB": size_options = "-no-ota-no-uf2" - elif target in ("esp32", "esp32c3"): + elif not uf2_bootloader: # These boards don't have native USB. size_options = "-no-uf2" flash_size_config = pathlib.Path( From 4b41fdb586f71df283126b012f589b2b746bca12 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 14 Sep 2023 14:20:37 -0500 Subject: [PATCH 1686/1712] Fast(ish) special purpose bitbang spi over i2c with the i2c bus operating at 400kHz this achieves a 4.8kHz SPI clock rate which could be worse. It accepts the same style of init sequence as displayio. tested by scoping the pins on the espressif lcd dev kit with a dummy init sequence: ```python dotclockframebuffer.ioexpander_send_init_sequence( bus=bus, i2c_address=expander_addr, gpio_address=1, gpio_data_len=1, gpio_data=0xff, cs_bit=1, mosi_bit=3, clk_bit=2, init_sequence=init_sequence) ``` --- py/circuitpy_defns.mk | 1 + .../dotclockframebuffer/__init__.c | 93 +++++++++++++++++++ .../dotclockframebuffer/__init__.h | 29 ++++++ shared-module/dotclockframebuffer/__init__.c | 75 +++++++++++++++ 4 files changed, 198 insertions(+) create mode 100644 shared-module/dotclockframebuffer/__init__.c diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 8be49dca0d..c819d46db8 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -603,6 +603,7 @@ SRC_SHARED_MODULE_ALL = \ displayio/TileGrid.c \ displayio/area.c \ displayio/__init__.c \ + dotclockframebuffer/__init__.c \ floppyio/__init__.c \ fontio/BuiltinFont.c \ fontio/__init__.c \ diff --git a/shared-bindings/dotclockframebuffer/__init__.c b/shared-bindings/dotclockframebuffer/__init__.c index a91964988a..07f9f826dd 100644 --- a/shared-bindings/dotclockframebuffer/__init__.c +++ b/shared-bindings/dotclockframebuffer/__init__.c @@ -34,11 +34,104 @@ #include "shared-bindings/dotclockframebuffer/DotClockFramebuffer.h" //| """Native helpers for driving parallel displays""" +//| +//| Length = typing.Literal[1, 2] +//| +//| def ioexpander_send_init_sequence( +//| bus: busio.I2C, +//| i2c_address: int, +//| reg_addr: int, +//| gpio_data_len: Length, +//| gpio_address: int, +//| gpio_data: int, +//| cs_bit: int, +//| mosi_bit: int, +//| clk_bit: int, +//| init_sequence: ReadableBuffer, +//| ): +//| """Send a displayio-style initialization sequence over an I2C I/O expander +//| +//| This function is highly generic in order to support various I/O expanders. +//| What's assumed is that all the GPIO can be updated by writing to a single I2C register. +//| Normal output polarity is assumed (CS and CLK are active low, data is not inverted). +//| Only 8-bit I2C addresses are supported. +//| 8- and 16-bit I2C addresses and data registers are supported. +//| The Data/Command bit is sent as part of the serial data. +//| +//| Normally this function is used via a convenience library that is specific to the display & I/O expander in use. +//| +//| :param busio.I2C bus: The I2C bus where the I/O expander resides +//| :param busio.i2c_address: int: The I2C bus address of the I/O expander +//| :param int gpio_address: The address portion of the I2C transaction (1 byte) +//| :param int gpio_data_len: The size of the data portion of the I2C transaction, 1 or 2 bytes +//| :param int gpio_data: The output value for all GPIO bits other than cs, mosi, and clk (needed because GPIO expanders may be unable to read back the current output value) +//| :param int cs_bit: The bit number (from 0 to 7, or from 0 to 15) of the chip select bit in the GPIO register +//| :param int mosi_value: The bit number (from 0 to 7, or from 0 to 15) of the data out bit in the GPIO register +//| :param int clk_value: The bit number (from 0 to 7, or from 0 to 15) of the clock out bit in the GPIO register +//| """ +//| +STATIC mp_obj_t ioexpander_send_init_sequence(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_bus, ARG_i2c_address, ARG_gpio_address, ARG_gpio_data_len, ARG_gpio_data, ARG_cs_bit, ARG_mosi_bit, ARG_clk_bit, ARG_init_sequence, NUM_ARGS }; + + static const mp_arg_t allowed_args[] = { + { MP_QSTR_bus, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_i2c_address, MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_gpio_address, MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_gpio_data_len, MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_gpio_data, MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_cs_bit, MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_mosi_bit, MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_clk_bit, MP_ARG_REQUIRED | MP_ARG_INT }, + { MP_QSTR_init_sequence, MP_ARG_REQUIRED | MP_ARG_OBJ }, + }; + + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + MP_STATIC_ASSERT(MP_ARRAY_SIZE(allowed_args) == NUM_ARGS); + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_obj_t bus_obj = mp_arg_validate_type(args[ARG_bus].u_obj, &busio_i2c_type, MP_QSTR_bus); + mp_int_t i2c_address = args[ARG_i2c_address].u_int; + mp_int_t gpio_address = args[ARG_gpio_address].u_int; + mp_int_t gpio_data_len = args[ARG_gpio_data_len].u_int; + mp_int_t gpio_data = args[ARG_gpio_data].u_int; + mp_int_t cs_bit = args[ARG_cs_bit].u_int; + mp_int_t mosi_bit = args[ARG_mosi_bit].u_int; + mp_int_t clk_bit = args[ARG_clk_bit].u_int; + + mp_buffer_info_t bufinfo; + mp_get_buffer_raise(args[ARG_init_sequence].u_obj, &bufinfo, MP_BUFFER_READ); + + mp_arg_validate_int_range(i2c_address, 0, 127, MP_QSTR_i2c_address); + mp_arg_validate_int_range(gpio_data_len, 1, 2, MP_QSTR_gpio_dat_len); + + int max_bit = gpio_data_len * 8 - 1; + mp_arg_validate_int_range(cs_bit, 0, max_bit, MP_QSTR_cs_bit); + mp_arg_validate_int_range(mosi_bit, 0, max_bit, MP_QSTR_mosi_bit); + mp_arg_validate_int_range(clk_bit, 0, max_bit, MP_QSTR_clk_bit); + mp_arg_validate_int_range(gpio_data, 0, (1 << (max_bit * 8)) - 1, MP_QSTR_gpio_data); + + dotclockframebuffer_ioexpander_spi_bus b = { + .bus = bus_obj, + .i2c_device_address = i2c_address, + .i2c_write_size = 1 + gpio_data_len, + // ASSERT(LITTLE_ENDIAN, "don't have to differentiate 8- vs 16-bits here") + .addr_reg_shadow = { .u32 = gpio_address | (gpio_data << 8) }, + .cs_mask = 0x100 << cs_bit, + .mosi_mask = 0x100 << mosi_bit, + .clk_mask = 0x100 << clk_bit, + }; + + dotclockframebuffer_ioexpander_send_init_sequence(&b, bufinfo.buf, bufinfo.len); + return mp_const_none; +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(ioexpander_send_init_sequence_obj, 0, ioexpander_send_init_sequence); STATIC const mp_rom_map_elem_t dotclockframebuffer_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_dotclockframebuffer) }, { MP_ROM_QSTR(MP_QSTR_DotClockFramebuffer), MP_ROM_PTR(&dotclockframebuffer_framebuffer_type) }, + { MP_ROM_QSTR(MP_QSTR_ioexpander_send_init_sequence), MP_ROM_PTR(&ioexpander_send_init_sequence_obj) }, }; STATIC MP_DEFINE_CONST_DICT(dotclockframebuffer_module_globals, dotclockframebuffer_module_globals_table); diff --git a/shared-bindings/dotclockframebuffer/__init__.h b/shared-bindings/dotclockframebuffer/__init__.h index f7b42875a1..e51b5b9a86 100644 --- a/shared-bindings/dotclockframebuffer/__init__.h +++ b/shared-bindings/dotclockframebuffer/__init__.h @@ -25,3 +25,32 @@ */ #pragma once + +#include "py/obj.h" +#include "shared-bindings/busio/I2C.h" + +typedef union { + struct { + uint8_t addr, data; + } a8d8; + struct { + uint16_t addr, data; // in little endian + } a16d16; + struct { + uint8_t addr; + uint16_t data; // in little endian + } __attribute__((packed)) a8d16; + uint32_t u32; +} dotclockframebuffer_ioexpander_addr_reg_t; + +typedef struct { + busio_i2c_obj_t *bus; + uint8_t i2c_device_address; + uint8_t i2c_write_size; + dotclockframebuffer_ioexpander_addr_reg_t addr_reg_shadow; + uint32_t cs_mask; + uint32_t mosi_mask; + uint32_t clk_mask; +} dotclockframebuffer_ioexpander_spi_bus; + +void dotclockframebuffer_ioexpander_send_init_sequence(dotclockframebuffer_ioexpander_spi_bus *bus, uint8_t *init_sequence, uint16_t init_sequence_len); diff --git a/shared-module/dotclockframebuffer/__init__.c b/shared-module/dotclockframebuffer/__init__.c new file mode 100644 index 0000000000..55329a87f6 --- /dev/null +++ b/shared-module/dotclockframebuffer/__init__.c @@ -0,0 +1,75 @@ +#include "shared-bindings/dotclockframebuffer/__init__.h" + +#include +#include +#include + +#define DELAY (0x80) + +static void pin_change(dotclockframebuffer_ioexpander_spi_bus *bus, uint32_t set_bits, uint32_t clear_bits) { + uint32_t data = (bus->addr_reg_shadow.u32 & ~clear_bits) | set_bits; + // no way to signal failure to caller! + (void)common_hal_busio_i2c_write(bus->bus, bus->i2c_device_address, (uint8_t *)&data, bus->i2c_write_size); + bus->addr_reg_shadow.u32 = data; +} + +static void ioexpander_bus_send(dotclockframebuffer_ioexpander_spi_bus *bus, + bool is_command, + const uint8_t *data, uint32_t data_length) { + + int dc_mask = is_command ? 0 : 0x100; + for (uint32_t i = 0; i < data_length; i++) { + int bits = data[i] | dc_mask; + + for (uint32_t j = 0; j < 9; j++) { + // CPOL=CPHA=0: output fresh data on falling edge of clk or cs + if (bits & 0x100) { + pin_change(bus, /* set */ bus->mosi_mask, /* clear */ bus->clk_mask | bus->cs_mask); + } else { + pin_change(bus, /* set */ 0, /* clear */ bus->mosi_mask | bus->clk_mask | bus->cs_mask); + } + // Display latches bit on rising edge of CLK + pin_change(bus, /* set */ bus->clk_mask, /* clear */ 0); + + // next bit + bits <<= 1; + } + } +} + +// Send a circuitpython-style display initialization sequence over an i2c-attached bus expander +// This always assumes +// * 9-bit SPI (no DC pin) +// * CPOL=CPHA=0 +// * CS deasserted after each init sequence step, but not otherwise just like +// displayio fourwire bus without data_as_commands +void dotclockframebuffer_ioexpander_send_init_sequence(dotclockframebuffer_ioexpander_spi_bus *bus, uint8_t *init_sequence, uint16_t init_sequence_len) { + while (!common_hal_busio_i2c_try_lock(bus->bus)) { + RUN_BACKGROUND_TASKS; + } + for (uint32_t i = 0; i < init_sequence_len; /* NO INCREMENT */) { + uint8_t *cmd = init_sequence + i; + uint8_t data_size = *(cmd + 1); + bool delay = (data_size & DELAY) != 0; + data_size &= ~DELAY; + uint8_t *data = cmd + 2; + + ioexpander_bus_send(bus, true, cmd, 1); + ioexpander_bus_send(bus, false, data, data_size); + + // deassert CS + pin_change(bus, /* set */ bus->cs_mask, /* clear */ 0); + + uint16_t delay_length_ms = 10; + if (delay) { + data_size++; + delay_length_ms = *(cmd + 1 + data_size); + if (delay_length_ms == 255) { + delay_length_ms = 500; + } + } + mp_hal_delay_ms(delay_length_ms); + i += 2 + data_size; + } + common_hal_busio_i2c_unlock(bus->bus); +} From ef9f75ead15b7c68c795b350dd77dd0a8796f920 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 14 Sep 2023 14:56:39 -0500 Subject: [PATCH 1687/1712] Correct idle status of SCK pin --- shared-module/dotclockframebuffer/__init__.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shared-module/dotclockframebuffer/__init__.c b/shared-module/dotclockframebuffer/__init__.c index 55329a87f6..34ab84aa0f 100644 --- a/shared-module/dotclockframebuffer/__init__.c +++ b/shared-module/dotclockframebuffer/__init__.c @@ -47,6 +47,10 @@ void dotclockframebuffer_ioexpander_send_init_sequence(dotclockframebuffer_ioexp while (!common_hal_busio_i2c_try_lock(bus->bus)) { RUN_BACKGROUND_TASKS; } + + // ensure deasserted CS and idle CLK + pin_change(bus, /* set */ bus->cs_mask, /* clear */ bus->clk_mask); + for (uint32_t i = 0; i < init_sequence_len; /* NO INCREMENT */) { uint8_t *cmd = init_sequence + i; uint8_t data_size = *(cmd + 1); @@ -57,8 +61,10 @@ void dotclockframebuffer_ioexpander_send_init_sequence(dotclockframebuffer_ioexp ioexpander_bus_send(bus, true, cmd, 1); ioexpander_bus_send(bus, false, data, data_size); + // idle CLK + pin_change(bus, 0, /* clear */ bus->clk_mask); // deassert CS - pin_change(bus, /* set */ bus->cs_mask, /* clear */ 0); + pin_change(bus, /* set */ bus->cs_mask, 0); uint16_t delay_length_ms = 10; if (delay) { From 4087960dfd694f6e907ca0d6452b1d1c0749d963 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 14 Sep 2023 15:04:07 -0700 Subject: [PATCH 1688/1712] Fix MDNS. C3 works --- .../espressif_esp32c3_devkitm_1_n4/mpconfigboard.mk | 2 +- .../boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk | 4 ++++ ports/espressif/common-hal/wifi/__init__.c | 5 +++-- .../espressif/esp-idf-config/sdkconfig-esp32c3.defaults | 9 +++++++++ .../espressif/esp-idf-config/sdkconfig-esp32s3.defaults | 1 + supervisor/shared/web_workflow/web_workflow.c | 3 +-- 6 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.mk index cd517e75b4..a67c8e38e4 100644 --- a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.mk @@ -3,6 +3,6 @@ CIRCUITPY_CREATION_ID = 0x00C30001 IDF_TARGET = esp32c3 -CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk index cec65ead85..2315d4e20f 100644 --- a/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/mpconfigboard.mk @@ -9,5 +9,9 @@ CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 16MB +CIRCUITPY_ESP_PSRAM_SIZE = 8MB +CIRCUITPY_ESP_PSRAM_MODE = opi +CIRCUITPY_ESP_PSRAM_FREQ = 80m + CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1 UF2_BOOTLOADER = 0 diff --git a/ports/espressif/common-hal/wifi/__init__.c b/ports/espressif/common-hal/wifi/__init__.c index 769ed8ab04..970eb8eb04 100644 --- a/ports/espressif/common-hal/wifi/__init__.c +++ b/ports/espressif/common-hal/wifi/__init__.c @@ -190,7 +190,8 @@ void common_hal_wifi_init(bool user_initiated) { &self->handler_instance_got_ip)); wifi_init_config_t config = WIFI_INIT_CONFIG_DEFAULT(); - #ifdef CONFIG_IDF_TARGET_ESP32 + #ifdef CONFIG_ESP32_WIFI_NVS_ENABLED + // Generally we don't use this because we store ssid and passwords ourselves in the filesystem. esp_err_t err = nvs_flash_init(); if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) { // NVS partition was truncated and needs to be erased @@ -210,7 +211,7 @@ void common_hal_wifi_init(bool user_initiated) { if (gc_alloc_possible()) { raise_esp_error(result); } - ESP_LOGE(TAG, "WiFi error code: %d", result); + ESP_LOGE(TAG, "WiFi error code: %x", result); return; } // set station mode to avoid the default SoftAP diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults index 1a47619e52..a41a780e68 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults @@ -49,6 +49,15 @@ CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y # end of Driver Configurations +# +# Wi-Fi +# +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 +# CONFIG_ESP32_WIFI_NVS_ENABLED is not set +# end of Wi-Fi + # # Newlib # diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults index c13240cff0..2bfd87be1e 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults @@ -23,6 +23,7 @@ CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 # end of Memory Settings CONFIG_BT_NIMBLE_EXT_ADV=y +# CONFIG_BT_NIMBLE_ENABLE_PERIODIC_ADV is not set # end of NimBLE Options # diff --git a/supervisor/shared/web_workflow/web_workflow.c b/supervisor/shared/web_workflow/web_workflow.c index 2a8133a562..ecf83b8bcb 100644 --- a/supervisor/shared/web_workflow/web_workflow.c +++ b/supervisor/shared/web_workflow/web_workflow.c @@ -347,8 +347,7 @@ bool supervisor_start_web_workflow(bool reload) { #if CIRCUITPY_MDNS // Try to start MDNS if the user deinited it. if (mdns.base.type != &mdns_server_type || - common_hal_mdns_server_deinited(&mdns) || - reload) { // Always reconstruct on reload, since we don't know if the net changed. + common_hal_mdns_server_deinited(&mdns)) { mdns_server_construct(&mdns, true); mdns.base.type = &mdns_server_type; if (!common_hal_mdns_server_deinited(&mdns)) { From 970e61c8b4f19a87f7ef85d1c0b3cf9ee903c10e Mon Sep 17 00:00:00 2001 From: Wind-stormger Date: Thu, 14 Sep 2023 09:42:26 +0000 Subject: [PATCH 1689/1712] Update bpi_leaf_s3 --- ports/espressif/boards/bpi_leaf_s3/mpconfigboard.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.h b/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.h index fd6aae04ea..4deba7de0c 100644 --- a/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.h +++ b/ports/espressif/boards/bpi_leaf_s3/mpconfigboard.h @@ -40,3 +40,5 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO44) #define DEFAULT_UART_BUS_TX (&pin_GPIO43) + +#define DOUBLE_TAP_PIN (&pin_GPIO34) From a8b81ce9438f2ed448c7b6c4f9d7f3054c599948 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 15 Sep 2023 10:39:14 -0500 Subject: [PATCH 1690/1712] Enhance unexpected keyword argument detection Before, incorrect use when calling a core function would just say "extra keyword arguments given"; now, it will name the argument: ```python >>> Synthesizer(bad_kwarg="boo") TypeError: unexpected keyword argument 'bad_kwarg' ``` --- py/argcheck.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/py/argcheck.c b/py/argcheck.c index c3bde804d4..76c84e83b0 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -133,7 +133,28 @@ void mp_arg_parse_all(size_t n_pos, const mp_obj_t *pos, mp_map_t *kws, size_t n #if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE mp_arg_error_terse_mismatch(); #else - // TODO better error message + #if CIRCUITPY_FULL_BUILD + mp_map_elem_t *elem = kws->table; + size_t alloc = kws->alloc; + for (size_t i = 0; i < alloc; i++) { + mp_obj_t key = elem[i].key; + if (key == MP_OBJ_NULL) { + continue; + } + bool seen = false; + for (size_t j = n_pos; j < n_allowed; j++) { + if (mp_obj_equal(MP_OBJ_NEW_QSTR(allowed[j].qst), key)) { + seen = true; + break; + } + } + if (!seen) { + mp_raise_msg_varg(&mp_type_TypeError, + MP_ERROR_TEXT("unexpected keyword argument '%q'"), mp_obj_str_get_qstr(key)); + } + } + #endif + // (for the !FULL_BUILD case, and as a fallthrough for the FULL_BUILD case, even though it SHOULD be unreachable in that case) mp_raise_TypeError(MP_ERROR_TEXT("extra keyword arguments given")); #endif } From c7b7e22195f84ffbac63614d84b76d5a1ba01256 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 15 Sep 2023 11:16:43 -0500 Subject: [PATCH 1691/1712] remove debug print --- shared-bindings/dotclockframebuffer/DotClockFramebuffer.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c index aac695e3ee..e214351414 100644 --- a/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c +++ b/shared-bindings/dotclockframebuffer/DotClockFramebuffer.c @@ -166,8 +166,6 @@ STATIC mp_obj_t dotclockframebuffer_framebuffer_make_new(const mp_obj_type_t *ty validate_list_is_free_pins(MP_QSTR_green, green_pins, (mp_int_t)MP_ARRAY_SIZE(green_pins), args[ARG_green].u_obj, &num_green); validate_list_is_free_pins(MP_QSTR_blue, blue_pins, (mp_int_t)MP_ARRAY_SIZE(blue_pins), args[ARG_blue].u_obj, &num_blue); - mp_printf(&mp_plat_print, "#red=%d #green=%d #blue=%d\n", num_red, num_green, num_blue); - dotclockframebuffer_framebuffer_obj_t *self = &allocate_display_bus_or_raise()->dotclock; self->base.type = &dotclockframebuffer_framebuffer_type; From cff65bbbe29f94552e7c2acc455612d938e024da Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 15 Sep 2023 14:10:32 -0500 Subject: [PATCH 1692/1712] esp32 lcd ev: fix pin assignments --- .../boards/espressif_esp32s3_lcd_ev/pins.c | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c b/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c index 59da0cb910..1bb555fd1d 100644 --- a/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c @@ -5,11 +5,11 @@ STATIC const mp_rom_obj_tuple_t tft_r_pins = { {&mp_type_tuple}, 5, { - MP_ROM_PTR(&pin_GPIO10), - MP_ROM_PTR(&pin_GPIO11), - MP_ROM_PTR(&pin_GPIO12), - MP_ROM_PTR(&pin_GPIO13), - MP_ROM_PTR(&pin_GPIO14), + MP_ROM_PTR(&pin_GPIO1), + MP_ROM_PTR(&pin_GPIO2), + MP_ROM_PTR(&pin_GPIO42), + MP_ROM_PTR(&pin_GPIO41), + MP_ROM_PTR(&pin_GPIO40), } }; @@ -30,23 +30,22 @@ STATIC const mp_rom_obj_tuple_t tft_b_pins = { {&mp_type_tuple}, 5, { - MP_ROM_PTR(&pin_GPIO40), - MP_ROM_PTR(&pin_GPIO41), - MP_ROM_PTR(&pin_GPIO42), - MP_ROM_PTR(&pin_GPIO2), - MP_ROM_PTR(&pin_GPIO1), + MP_ROM_PTR(&pin_GPIO10), + MP_ROM_PTR(&pin_GPIO11), + MP_ROM_PTR(&pin_GPIO12), + MP_ROM_PTR(&pin_GPIO13), + MP_ROM_PTR(&pin_GPIO14), } }; STATIC const mp_rom_map_elem_t tft_table[] = { { MP_ROM_QSTR(MP_QSTR_de), MP_ROM_PTR(&pin_GPIO17) }, - { MP_ROM_QSTR(MP_QSTR_vsync), MP_ROM_PTR(&pin_GPIO46) }, - { MP_ROM_QSTR(MP_QSTR_hsync), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_vsync), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_hsync), MP_ROM_PTR(&pin_GPIO46) }, { MP_ROM_QSTR(MP_QSTR_dclk), MP_ROM_PTR(&pin_GPIO9) }, { MP_ROM_QSTR(MP_QSTR_red), MP_ROM_PTR(&tft_r_pins) }, { MP_ROM_QSTR(MP_QSTR_green), MP_ROM_PTR(&tft_g_pins) }, { MP_ROM_QSTR(MP_QSTR_blue), MP_ROM_PTR(&tft_b_pins) }, - { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_INT(9000000) }, }; MP_DEFINE_CONST_DICT(tft_dict, tft_table); @@ -54,11 +53,11 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS { MP_ROM_QSTR(MP_QSTR_TFT), MP_ROM_PTR(&tft_dict) }, - { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_GPIO10) }, - { MP_ROM_QSTR(MP_QSTR_I2S_SCK), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_I2S_SCK), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_I2S_MCLK), MP_ROM_PTR(&pin_GPIO5) }, { MP_ROM_QSTR(MP_QSTR_I2S_WS), MP_ROM_PTR(&pin_GPIO7) }, - { MP_ROM_QSTR(MP_QSTR_I2S_SDO), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_I2S_SDO), MP_ROM_PTR(&pin_GPIO6) }, { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO43) }, { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) }, @@ -66,14 +65,9 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(DEFAULT_I2C_BUS_SCL) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(DEFAULT_I2C_BUS_SDA) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO11) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO13) }, - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO12) }, - // boot mode button can be used in SW as well { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, { 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_module_globals_table); From 91b98dc9d59e258f23d046ea2f27cb5da48e0905 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 15 Sep 2023 14:45:53 -0500 Subject: [PATCH 1693/1712] fix constness --- shared-bindings/dotclockframebuffer/__init__.h | 2 +- shared-module/dotclockframebuffer/__init__.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shared-bindings/dotclockframebuffer/__init__.h b/shared-bindings/dotclockframebuffer/__init__.h index e51b5b9a86..de69021a1b 100644 --- a/shared-bindings/dotclockframebuffer/__init__.h +++ b/shared-bindings/dotclockframebuffer/__init__.h @@ -53,4 +53,4 @@ typedef struct { uint32_t clk_mask; } dotclockframebuffer_ioexpander_spi_bus; -void dotclockframebuffer_ioexpander_send_init_sequence(dotclockframebuffer_ioexpander_spi_bus *bus, uint8_t *init_sequence, uint16_t init_sequence_len); +void dotclockframebuffer_ioexpander_send_init_sequence(dotclockframebuffer_ioexpander_spi_bus *bus, const uint8_t *init_sequence, uint16_t init_sequence_len); diff --git a/shared-module/dotclockframebuffer/__init__.c b/shared-module/dotclockframebuffer/__init__.c index 34ab84aa0f..674c824af5 100644 --- a/shared-module/dotclockframebuffer/__init__.c +++ b/shared-module/dotclockframebuffer/__init__.c @@ -43,7 +43,7 @@ static void ioexpander_bus_send(dotclockframebuffer_ioexpander_spi_bus *bus, // * CPOL=CPHA=0 // * CS deasserted after each init sequence step, but not otherwise just like // displayio fourwire bus without data_as_commands -void dotclockframebuffer_ioexpander_send_init_sequence(dotclockframebuffer_ioexpander_spi_bus *bus, uint8_t *init_sequence, uint16_t init_sequence_len) { +void dotclockframebuffer_ioexpander_send_init_sequence(dotclockframebuffer_ioexpander_spi_bus *bus, const uint8_t *init_sequence, uint16_t init_sequence_len) { while (!common_hal_busio_i2c_try_lock(bus->bus)) { RUN_BACKGROUND_TASKS; } @@ -52,11 +52,11 @@ void dotclockframebuffer_ioexpander_send_init_sequence(dotclockframebuffer_ioexp pin_change(bus, /* set */ bus->cs_mask, /* clear */ bus->clk_mask); for (uint32_t i = 0; i < init_sequence_len; /* NO INCREMENT */) { - uint8_t *cmd = init_sequence + i; + const uint8_t *cmd = init_sequence + i; uint8_t data_size = *(cmd + 1); bool delay = (data_size & DELAY) != 0; data_size &= ~DELAY; - uint8_t *data = cmd + 2; + const uint8_t *data = cmd + 2; ioexpander_bus_send(bus, true, cmd, 1); ioexpander_bus_send(bus, false, data, data_size); From 68af5543af50716a9ae61fa516ec756e9302e020 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 15 Sep 2023 14:46:28 -0500 Subject: [PATCH 1694/1712] set up display at reset (yayay!) --- .../boards/espressif_esp32s3_lcd_ev/board.c | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/board.c b/ports/espressif/boards/espressif_esp32s3_lcd_ev/board.c index 0639737c35..ed06698583 100644 --- a/ports/espressif/boards/espressif_esp32s3_lcd_ev/board.c +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/board.c @@ -26,9 +26,131 @@ #include "supervisor/board.h" #include "mpconfigboard.h" +#include "shared-bindings/board/__init__.h" +#include "shared-bindings/busio/I2C.h" +#include "shared-bindings/dotclockframebuffer/DotClockFramebuffer.h" +#include "shared-bindings/dotclockframebuffer/__init__.h" +#include "shared-bindings/framebufferio/FramebufferDisplay.h" #include "shared-bindings/microcontroller/Pin.h" +#include "shared-module/displayio/__init__.h" +static const uint8_t display_init_sequence[] = { + 0xf0, 5, 0x55, 0xaa, 0x52, 0x08, 0x00, + 0xf6, 2, 0x5a, 0x87, + 0xc1, 1, 0x3f, + 0xc2, 1, 0x0e, + 0xc6, 1, 0xf8, + 0xc9, 1, 0x10, + 0xcd, 1, 0x25, + 0xf8, 1, 0x8a, + 0xac, 1, 0x45, + 0xa0, 1, 0xdd, + 0xa7, 1, 0x47, + 0xfa, 4, 0x00, 0x00, 0x00, 0x04, + 0x86, 4, 0x99, 0xa3, 0xa3, 0x51, + 0xa3, 1, 0xee, + 0xfd, 3, 0x3c, 0x3c, 0x00, + 0x71, 1, 0x48, + 0x72, 1, 0x48, + 0x73, 2, 0x00, 0x44, + 0x97, 1, 0xee, + 0x83, 1, 0x93, + 0x9a, 1, 0x72, + 0x9b, 1, 0x5a, + 0x82, 2, 0x2c, 0x2c, + 0xb1, 1, 0x10, + 0x6d, 32, 0x00, 0x1f, 0x19, 0x1a, 0x10, 0x0e, 0x0c, 0x0a, 0x02, 0x07, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x08, 0x01, 0x09, 0x0b, 0x0d, 0x0f, 0x1a, 0x19, 0x1f, 0x00, + 0x64, 16, 0x38, 0x05, 0x01, 0xdb, 0x03, 0x03, 0x38, 0x04, 0x01, 0xdc, 0x03, 0x03, 0x7a, 0x7a, 0x7a, 0x7a, + 0x65, 16, 0x38, 0x03, 0x01, 0xdd, 0x03, 0x03, 0x38, 0x02, 0x01, 0xde, 0x03, 0x03, 0x7a, 0x7a, 0x7a, 0x7a, + 0x66, 16, 0x38, 0x01, 0x01, 0xdf, 0x03, 0x03, 0x38, 0x00, 0x01, 0xe0, 0x03, 0x03, 0x7a, 0x7a, 0x7a, 0x7a, + 0x67, 16, 0x30, 0x01, 0x01, 0xe1, 0x03, 0x03, 0x30, 0x02, 0x01, 0xe2, 0x03, 0x03, 0x7a, 0x7a, 0x7a, 0x7a, + 0x68, 13, 0x00, 0x08, 0x15, 0x08, 0x15, 0x7a, 0x7a, 0x08, 0x15, 0x08, 0x15, 0x7a, 0x7a, + 0x60, 8, 0x38, 0x08, 0x7a, 0x7a, 0x38, 0x09, 0x7a, 0x7a, + 0x63, 8, 0x31, 0xe4, 0x7a, 0x7a, 0x31, 0xe5, 0x7a, 0x7a, + 0x69, 7, 0x04, 0x22, 0x14, 0x22, 0x14, 0x22, 0x08, + 0x6b, 1, 0x07, + 0x7a, 2, 0x08, 0x13, + 0x7b, 2, 0x08, 0x13, + 0xd1, 52, 0x00, 0x00, 0x00, 0x04, 0x00, 0x12, 0x00, 0x18, 0x00, 0x21, 0x00, 0x2a, 0x00, 0x35, 0x00, 0x47, 0x00, 0x56, 0x00, 0x90, 0x00, 0xe5, 0x01, 0x68, 0x01, 0xd5, 0x01, 0xd7, 0x02, 0x36, 0x02, 0xa6, 0x02, 0xee, 0x03, 0x48, 0x03, 0xa0, 0x03, 0xba, 0x03, 0xc5, 0x03, 0xd0, 0x03, 0xe0, 0x03, 0xea, 0x03, 0xfa, 0x03, 0xff, + 0xd2, 52, 0x00, 0x00, 0x00, 0x04, 0x00, 0x12, 0x00, 0x18, 0x00, 0x21, 0x00, 0x2a, 0x00, 0x35, 0x00, 0x47, 0x00, 0x56, 0x00, 0x90, 0x00, 0xe5, 0x01, 0x68, 0x01, 0xd5, 0x01, 0xd7, 0x02, 0x36, 0x02, 0xa6, 0x02, 0xee, 0x03, 0x48, 0x03, 0xa0, 0x03, 0xba, 0x03, 0xc5, 0x03, 0xd0, 0x03, 0xe0, 0x03, 0xea, 0x03, 0xfa, 0x03, 0xff, + 0xd3, 52, 0x00, 0x00, 0x00, 0x04, 0x00, 0x12, 0x00, 0x18, 0x00, 0x21, 0x00, 0x2a, 0x00, 0x35, 0x00, 0x47, 0x00, 0x56, 0x00, 0x90, 0x00, 0xe5, 0x01, 0x68, 0x01, 0xd5, 0x01, 0xd7, 0x02, 0x36, 0x02, 0xa6, 0x02, 0xee, 0x03, 0x48, 0x03, 0xa0, 0x03, 0xba, 0x03, 0xc5, 0x03, 0xd0, 0x03, 0xe0, 0x03, 0xea, 0x03, 0xfa, 0x03, 0xff, + 0xd4, 52, 0x00, 0x00, 0x00, 0x04, 0x00, 0x12, 0x00, 0x18, 0x00, 0x21, 0x00, 0x2a, 0x00, 0x35, 0x00, 0x47, 0x00, 0x56, 0x00, 0x90, 0x00, 0xe5, 0x01, 0x68, 0x01, 0xd5, 0x01, 0xd7, 0x02, 0x36, 0x02, 0xa6, 0x02, 0xee, 0x03, 0x48, 0x03, 0xa0, 0x03, 0xba, 0x03, 0xc5, 0x03, 0xd0, 0x03, 0xe0, 0x03, 0xea, 0x03, 0xfa, 0x03, 0xff, + 0xd5, 52, 0x00, 0x00, 0x00, 0x04, 0x00, 0x12, 0x00, 0x18, 0x00, 0x21, 0x00, 0x2a, 0x00, 0x35, 0x00, 0x47, 0x00, 0x56, 0x00, 0x90, 0x00, 0xe5, 0x01, 0x68, 0x01, 0xd5, 0x01, 0xd7, 0x02, 0x36, 0x02, 0xa6, 0x02, 0xee, 0x03, 0x48, 0x03, 0xa0, 0x03, 0xba, 0x03, 0xc5, 0x03, 0xd0, 0x03, 0xe0, 0x03, 0xea, 0x03, 0xfa, 0x03, 0xff, + 0xd6, 52, 0x00, 0x00, 0x00, 0x04, 0x00, 0x12, 0x00, 0x18, 0x00, 0x21, 0x00, 0x2a, 0x00, 0x35, 0x00, 0x47, 0x00, 0x56, 0x00, 0x90, 0x00, 0xe5, 0x01, 0x68, 0x01, 0xd5, 0x01, 0xd7, 0x02, 0x36, 0x02, 0xa6, 0x02, 0xee, 0x03, 0x48, 0x03, 0xa0, 0x03, 0xba, 0x03, 0xc5, 0x03, 0xd0, 0x03, 0xe0, 0x03, 0xea, 0x03, 0xfa, 0x03, 0xff, + 0x3a, 1, 0x66, + 0x3a, 1, 0x66, + 0x11, 0x80, 120, + 0x29, 0x80, 20 +}; + +static const mcu_pin_obj_t *red_pins[] = { + &pin_GPIO1, &pin_GPIO2, &pin_GPIO42, &pin_GPIO41, &pin_GPIO40 +}; +static const mcu_pin_obj_t *green_pins[] = { + &pin_GPIO21, &pin_GPIO47, &pin_GPIO48, &pin_GPIO45, &pin_GPIO38, &pin_GPIO39 +}; +static const mcu_pin_obj_t *blue_pins[] = { + &pin_GPIO10, &pin_GPIO11, &pin_GPIO12, &pin_GPIO13, &pin_GPIO14 +}; void board_init(void) { + dotclockframebuffer_framebuffer_obj_t *framebuffer = &allocate_display_bus_or_raise()->dotclock; + framebuffer->base.type = &dotclockframebuffer_framebuffer_type; + + common_hal_dotclockframebuffer_framebuffer_construct( + framebuffer, + /* de */ &pin_GPIO17, + /* vsync */ &pin_GPIO3, + /* hsync */ &pin_GPIO46, + /* dclk */ &pin_GPIO9, + /* data */ red_pins, MP_ARRAY_SIZE(red_pins), green_pins, MP_ARRAY_SIZE(green_pins), blue_pins, MP_ARRAY_SIZE(blue_pins), + /* frequency */ 6500000, + /* width x height */ 480, 480, + /* horizontal: pulse, back & front porch, idle */ 13, 20, 40, false, + /* vertical: pulse, back & front porch, idle */ 15, 20, 40, false, + /* de_idle_high */ false, + /* pclk_active_high */ true, + /* pclk_idle_high */ false, + /* overscan_left */ 0 + ); + + framebufferio_framebufferdisplay_obj_t *disp = &allocate_display_or_raise()->framebuffer_display; + disp->base.type = &framebufferio_framebufferdisplay_type; + common_hal_framebufferio_framebufferdisplay_construct( + disp, + framebuffer, + 0, + true + ); + + busio_i2c_obj_t *i2c = common_hal_board_create_i2c(0); + const int i2c_device_address = 32; + + common_hal_busio_i2c_try_lock(i2c); + + { + uint8_t buf[2] = {3, 0xf1}; // set GPIO direction + common_hal_busio_i2c_write(i2c, i2c_device_address, buf, sizeof(buf)); + } + + { + uint8_t buf[2] = {2, 0}; // set all output pins low initially + common_hal_busio_i2c_write(i2c, i2c_device_address, buf, sizeof(buf)); + } + + common_hal_busio_i2c_unlock(i2c); + + dotclockframebuffer_ioexpander_spi_bus spibus = { + .bus = i2c, + .i2c_device_address = i2c_device_address, + .i2c_write_size = 2, + .addr_reg_shadow = { .u32 = 1 }, // GPIO data at register 1 + .cs_mask = 0x100 << 1, // data payload is at byte 2 + .mosi_mask = 0x100 << 3, + .clk_mask = 0x100 << 2, + }; + + dotclockframebuffer_ioexpander_send_init_sequence(&spibus, display_init_sequence, sizeof(display_init_sequence)); + } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. From 2a78d16b54e56c661b2f7dc02a8dadd756b46c6a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 15 Sep 2023 14:49:29 -0500 Subject: [PATCH 1695/1712] add board.DISPLAY --- ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c b/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c index 1bb555fd1d..13fcc7b873 100644 --- a/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c @@ -65,6 +65,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(DEFAULT_I2C_BUS_SCL) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(DEFAULT_I2C_BUS_SDA) }, + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} + // boot mode button can be used in SW as well { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, From 0547ef61f9698b58334b6860cb2c0a52e62a26af Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 15 Sep 2023 14:43:37 -0700 Subject: [PATCH 1696/1712] Update dotclock for IDF 5.0 --- ports/espressif/bindings/espidf/__init__.h | 2 + .../adafruit_esp32s3_camera/mpconfigboard.mk | 2 + .../mpconfigboard.mk | 2 +- .../dotclockframebuffer/DotClockFramebuffer.c | 56 ++++--------------- ports/espressif/common-hal/espidf/__init__.c | 7 +++ ports/espressif/common-hal/espidf/__init__.h | 2 +- ports/espressif/esp-idf | 2 +- ports/espressif/supervisor/port.c | 1 + 8 files changed, 27 insertions(+), 47 deletions(-) diff --git a/ports/espressif/bindings/espidf/__init__.h b/ports/espressif/bindings/espidf/__init__.h index e091a5c477..5ace1b3ada 100644 --- a/ports/espressif/bindings/espidf/__init__.h +++ b/ports/espressif/bindings/espidf/__init__.h @@ -31,6 +31,8 @@ #include "py/mpconfig.h" #include "py/obj.h" +#include "common-hal/espidf/__init__.h" + extern const mp_obj_type_t mp_type_espidf_IDFError; extern const mp_obj_type_t mp_type_espidf_MemoryError; diff --git a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk index 0b9deaaf10..9ead7e4f21 100644 --- a/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_esp32s3_camera/mpconfigboard.mk @@ -23,3 +23,5 @@ CIRCUITPY_ONEWIREIO = 0 CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_ROTARYIO = 0 + +OPTIMIZATION_FLAGS = -Os diff --git a/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk b/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk index 3db489c5de..65c872cf74 100644 --- a/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.mk @@ -6,7 +6,7 @@ USB_MANUFACTURER = "Adafruit" IDF_TARGET = esp32s3 CIRCUITPY_ESP_FLASH_SIZE = 16MB -CIRCUITPY_ESP_FLASH_MODE = dio +CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_PSRAM_SIZE = 8MB diff --git a/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c b/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c index e9809da38c..61045d713d 100644 --- a/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +++ b/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c @@ -36,54 +36,19 @@ #include "hal/lcd_ll.h" #include "soc/lcd_periph.h" -// extract from esp-idf esp_lcd_rgb_panel.c -typedef struct -{ - esp_lcd_panel_t base; // Base class of generic lcd panel - int panel_id; // LCD panel ID - lcd_hal_context_t hal; // Hal layer object - size_t data_width; // Number of data lines (e.g. for RGB565, the data width is 16) - size_t sram_trans_align; // Alignment for framebuffer that allocated in SRAM - size_t psram_trans_align; // Alignment for framebuffer that allocated in PSRAM - int disp_gpio_num; // Display control GPIO, which is used to perform action like "disp_off" - intr_handle_t intr; // LCD peripheral interrupt handle - esp_pm_lock_handle_t pm_lock; // Power management lock - size_t num_dma_nodes; // Number of DMA descriptors that used to carry the frame buffer - uint8_t *fb; // Frame buffer - size_t fb_size; // Size of frame buffer - int data_gpio_nums[SOC_LCD_RGB_DATA_WIDTH]; // GPIOs used for data lines, we keep these GPIOs for action like "invert_color" - size_t resolution_hz; // Peripheral clock resolution - esp_lcd_rgb_timing_t timings; // RGB timing parameters (e.g. pclk, sync pulse, porch width) - gdma_channel_handle_t dma_chan; // DMA channel handle - esp_lcd_rgb_panel_frame_trans_done_cb_t on_frame_trans_done; // Callback, invoked after frame trans done - void *user_ctx; // Reserved user's data of callback functions - int x_gap; // Extra gap in x coordinate, it's used when calculate the flush window - int y_gap; // Extra gap in y coordinate, it's used when calculate the flush window - struct - { - unsigned int disp_en_level : 1; // The level which can turn on the screen by `disp_gpio_num` - unsigned int stream_mode : 1; // If set, the LCD transfers data continuously, otherwise, it stops refreshing the LCD when transaction done - unsigned int fb_in_psram : 1; // Whether the frame buffer is in PSRAM - } flags; - dma_descriptor_t dma_nodes[]; // DMA descriptor pool of size `num_dma_nodes` -} esp_rgb_panel_t; - - #include "esp_log.h" #define TAG "LCD" #include "components/esp_rom/include/esp_rom_sys.h" - +#include "bindings/espidf/__init__.h" #include "py/objarray.h" #include "shared-bindings/dotclockframebuffer/DotClockFramebuffer.h" #include "common-hal/dotclockframebuffer/DotClockFramebuffer.h" -#include "bindings/espidf/__init__.h" +#include "common-hal/espidf/__init__.h" #include "shared-bindings/microcontroller/Pin.h" #include "py/runtime.h" #include "components/driver/include/driver/gpio.h" -#include "components/driver/include/driver/periph_ctrl.h" -#include "components/driver/include/esp_private/gdma.h" #include "components/esp_rom/include/esp_rom_gpio.h" #include "components/hal/esp32s3/include/hal/lcd_ll.h" #include "components/hal/include/hal/gpio_hal.h" @@ -170,6 +135,7 @@ void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_fr cfg->vsync_gpio_num = valid_pin(vsync, MP_QSTR_vsync); cfg->de_gpio_num = valid_pin(de, MP_QSTR_de); cfg->pclk_gpio_num = valid_pin(dclk, MP_QSTR_dclk); + cfg->clk_src = LCD_CLK_SRC_DEFAULT; cfg->data_gpio_nums[0] = valid_pin(blue[0], MP_QSTR_blue); cfg->data_gpio_nums[1] = valid_pin(blue[1], MP_QSTR_blue); @@ -193,22 +159,24 @@ void common_hal_dotclockframebuffer_framebuffer_construct(dotclockframebuffer_fr cfg->disp_gpio_num = GPIO_NUM_NC; cfg->flags.disp_active_low = 0; - cfg->flags.relax_on_idle = 0; + cfg->flags.refresh_on_demand = 0; cfg->flags.fb_in_psram = 1; // allocate frame buffer in PSRAM - ESP_ERROR_CHECK(esp_lcd_new_rgb_panel(&self->panel_config, &self->panel_handle)); - ESP_ERROR_CHECK(esp_lcd_panel_reset(self->panel_handle)); - ESP_ERROR_CHECK(esp_lcd_panel_init(self->panel_handle)); + esp_err_t ret = esp_lcd_new_rgb_panel(&self->panel_config, &self->panel_handle); + cp_check_esp_error(ret); + cp_check_esp_error(esp_lcd_panel_reset(self->panel_handle)); + cp_check_esp_error(esp_lcd_panel_init(self->panel_handle)); uint16_t color = 0; - ESP_ERROR_CHECK(self->panel_handle->draw_bitmap(self->panel_handle, 0, 0, 1, 1, &color)); + cp_check_esp_error(self->panel_handle->draw_bitmap(self->panel_handle, 0, 0, 1, 1, &color)); - esp_rgb_panel_t *_rgb_panel = __containerof(self->panel_handle, esp_rgb_panel_t, base); + void *fb; + cp_check_esp_error(esp_lcd_rgb_panel_get_frame_buffer(self->panel_handle, 1, &fb)); self->frequency = frequency; self->row_stride = 2 * (width + overscan_left); self->refresh_rate = frequency / (width + hsync_front_porch + hsync_back_porch) / (height + vsync_front_porch + vsync_back_porch); - self->bufinfo.buf = (uint8_t *)_rgb_panel->fb + 2 * overscan_left; // first line starts ater overscan_left pixels + self->bufinfo.buf = (uint8_t *)fb + 2 * overscan_left; // first line starts after overscan_left pixels self->bufinfo.len = 2 * (cfg->timings.h_res * cfg->timings.v_res - overscan_left); // no overscan after last line self->bufinfo.typecode = 'H' | MP_OBJ_ARRAY_TYPECODE_FLAG_RW; diff --git a/ports/espressif/common-hal/espidf/__init__.c b/ports/espressif/common-hal/espidf/__init__.c index 7ab5ab9efb..e5f866b906 100644 --- a/ports/espressif/common-hal/espidf/__init__.c +++ b/ports/espressif/common-hal/espidf/__init__.c @@ -188,4 +188,11 @@ void raise_esp_error(esp_err_t err) { mp_raise_msg_varg(exception_type, translate("%s error 0x%x"), group, err); } +void cp_check_esp_error(esp_err_t err) { + if (err == ESP_OK) { + return; + } + raise_esp_error(err); +} + MP_REGISTER_MODULE(MP_QSTR_espidf, espidf_module); diff --git a/ports/espressif/common-hal/espidf/__init__.h b/ports/espressif/common-hal/espidf/__init__.h index 0d168b105c..337ad7ef99 100644 --- a/ports/espressif/common-hal/espidf/__init__.h +++ b/ports/espressif/common-hal/espidf/__init__.h @@ -26,4 +26,4 @@ #pragma once -#include "bindings/espidf/__init__.h" +void cp_check_esp_error(esp_err_t err); diff --git a/ports/espressif/esp-idf b/ports/espressif/esp-idf index f2ee41e622..dc6c0b46ab 160000 --- a/ports/espressif/esp-idf +++ b/ports/espressif/esp-idf @@ -1 +1 @@ -Subproject commit f2ee41e622694ead7caa3dcac0d04c96c5a7b027 +Subproject commit dc6c0b46ab9edc9c5ee6667c07eb87200b4f7ca5 diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index d605dc2b79..a18ce77dfb 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -284,6 +284,7 @@ safe_mode_t port_init(void) { #endif #if ENABLE_JTAG + ESP_LOGI(TAG, "Marking JTAG pins never_reset") // JTAG #ifdef CONFIG_IDF_TARGET_ESP32C3 common_hal_never_reset_pin(&pin_GPIO4); From 4c682262e66e16d37d8f662dd75fdcb987b68a31 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 18 Sep 2023 10:35:05 -0500 Subject: [PATCH 1697/1712] lcd_ev: fix compile error --- ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c b/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c index 13fcc7b873..56fcece8b6 100644 --- a/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c @@ -1,5 +1,6 @@ #include "py/objtuple.h" #include "shared-bindings/board/__init__.h" +#include "shared-module/displayio/__init__.h" STATIC const mp_rom_obj_tuple_t tft_r_pins = { {&mp_type_tuple}, @@ -65,7 +66,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(DEFAULT_I2C_BUS_SCL) }, { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(DEFAULT_I2C_BUS_SDA) }, - { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display) }, // boot mode button can be used in SW as well { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) }, From 75ba82cdb02e9f9eb2e5b2f57b78b33beb882be5 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 18 Sep 2023 10:35:36 -0500 Subject: [PATCH 1698/1712] lcd_ev: add timings; rename TFT -> TFT_PINS --- .../boards/espressif_esp32s3_lcd_ev/pins.c | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c b/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c index 56fcece8b6..d66fc534a4 100644 --- a/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/pins.c @@ -39,7 +39,7 @@ STATIC const mp_rom_obj_tuple_t tft_b_pins = { } }; -STATIC const mp_rom_map_elem_t tft_table[] = { +STATIC const mp_rom_map_elem_t tft_pins_table[] = { { MP_ROM_QSTR(MP_QSTR_de), MP_ROM_PTR(&pin_GPIO17) }, { MP_ROM_QSTR(MP_QSTR_vsync), MP_ROM_PTR(&pin_GPIO3) }, { MP_ROM_QSTR(MP_QSTR_hsync), MP_ROM_PTR(&pin_GPIO46) }, @@ -48,12 +48,31 @@ STATIC const mp_rom_map_elem_t tft_table[] = { { MP_ROM_QSTR(MP_QSTR_green), MP_ROM_PTR(&tft_g_pins) }, { MP_ROM_QSTR(MP_QSTR_blue), MP_ROM_PTR(&tft_b_pins) }, }; -MP_DEFINE_CONST_DICT(tft_dict, tft_table); +MP_DEFINE_CONST_DICT(tft_pins_dict, tft_pins_table); + +STATIC const mp_rom_map_elem_t tft_timings_table[] = { + { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_INT(6500000) }, // nominal 16MHz, but display is unstable/tears at that frequency + { MP_ROM_QSTR(MP_QSTR_width), MP_ROM_INT(480) }, + { MP_ROM_QSTR(MP_QSTR_height), MP_ROM_INT(480) }, + { MP_ROM_QSTR(MP_QSTR_hsync_pulse_width), MP_ROM_INT(13) }, + { MP_ROM_QSTR(MP_QSTR_hsync_front_porch), MP_ROM_INT(20) }, + { MP_ROM_QSTR(MP_QSTR_hsync_back_porch), MP_ROM_INT(40) }, + { MP_ROM_QSTR(MP_QSTR_hsync_idle_low), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_vsync_pulse_width), MP_ROM_INT(15) }, + { MP_ROM_QSTR(MP_QSTR_vsync_front_porch), MP_ROM_INT(20) }, + { MP_ROM_QSTR(MP_QSTR_vsync_back_porch), MP_ROM_INT(40) }, + { MP_ROM_QSTR(MP_QSTR_vsync_idle_low), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_de_idle_high), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_pclk_active_high), MP_ROM_FALSE }, + { MP_ROM_QSTR(MP_QSTR_pclk_idle_high), MP_ROM_FALSE }, +}; +MP_DEFINE_CONST_DICT(tft_timings_dict, tft_timings_table); STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS - { MP_ROM_QSTR(MP_QSTR_TFT), MP_ROM_PTR(&tft_dict) }, + { MP_ROM_QSTR(MP_QSTR_TFT_PINS), MP_ROM_PTR(&tft_pins_dict) }, + { MP_ROM_QSTR(MP_QSTR_TFT_TIMINGS), MP_ROM_PTR(&tft_timings_dict) }, { MP_ROM_QSTR(MP_QSTR_I2S_SCK), MP_ROM_PTR(&pin_GPIO16) }, { MP_ROM_QSTR(MP_QSTR_I2S_MCLK), MP_ROM_PTR(&pin_GPIO5) }, From 67e15bb6a20bb7110a6ece010276a8bf03db492d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 18 Sep 2023 10:35:49 -0500 Subject: [PATCH 1699/1712] makerfabs_tft7: rename properties to match docs --- ports/espressif/boards/makerfabs_tft7/pins.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ports/espressif/boards/makerfabs_tft7/pins.c b/ports/espressif/boards/makerfabs_tft7/pins.c index 1a170035c2..88738d3c99 100644 --- a/ports/espressif/boards/makerfabs_tft7/pins.c +++ b/ports/espressif/boards/makerfabs_tft7/pins.c @@ -38,7 +38,7 @@ STATIC const mp_rom_obj_tuple_t tft_b_pins = { } }; -STATIC const mp_rom_map_elem_t tft_table[] = { +STATIC const mp_rom_map_elem_t tft_pins_table[] = { { MP_ROM_QSTR(MP_QSTR_de), MP_ROM_PTR(&pin_GPIO40) }, { MP_ROM_QSTR(MP_QSTR_vsync), MP_ROM_PTR(&pin_GPIO41) }, { MP_ROM_QSTR(MP_QSTR_hsync), MP_ROM_PTR(&pin_GPIO39) }, @@ -47,7 +47,7 @@ STATIC const mp_rom_map_elem_t tft_table[] = { { MP_ROM_QSTR(MP_QSTR_green), MP_ROM_PTR(&tft_g_pins) }, { MP_ROM_QSTR(MP_QSTR_blue), MP_ROM_PTR(&tft_b_pins) }, }; -MP_DEFINE_CONST_DICT(tft_dict, tft_table); +MP_DEFINE_CONST_DICT(tft_pins_dict, tft_pins_table); STATIC const mp_rom_map_elem_t timings800_table[] = { { MP_ROM_QSTR(MP_QSTR_frequency), MP_ROM_INT(6500000) }, // nominal 16MHz, but display is unstable/tears at that frequency @@ -70,8 +70,8 @@ MP_DEFINE_CONST_DICT(timings800_dict, timings800_table); STATIC const mp_rom_map_elem_t board_module_globals_table[] = { CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS - { MP_ROM_QSTR(MP_QSTR_TFT), MP_ROM_PTR(&tft_dict) }, - { MP_ROM_QSTR(MP_QSTR_TIMINGS800), MP_ROM_PTR(&timings800_dict) }, + { MP_ROM_QSTR(MP_QSTR_TFT_PINS), MP_ROM_PTR(&tft_pins_dict) }, + { MP_ROM_QSTR(MP_QSTR_TFT_TIMINGS_800x480), MP_ROM_PTR(&timings800_dict) }, { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_GPIO10) }, { MP_ROM_QSTR(MP_QSTR_I2S_SCK), MP_ROM_PTR(&pin_GPIO20) }, From 5a60b8d573cfb2c40014d23614809d825198dc15 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 18 Sep 2023 12:58:54 -0500 Subject: [PATCH 1700/1712] Only delay when explicitly called for --- shared-module/dotclockframebuffer/__init__.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/shared-module/dotclockframebuffer/__init__.c b/shared-module/dotclockframebuffer/__init__.c index 674c824af5..9bea7c2897 100644 --- a/shared-module/dotclockframebuffer/__init__.c +++ b/shared-module/dotclockframebuffer/__init__.c @@ -66,15 +66,14 @@ void dotclockframebuffer_ioexpander_send_init_sequence(dotclockframebuffer_ioexp // deassert CS pin_change(bus, /* set */ bus->cs_mask, 0); - uint16_t delay_length_ms = 10; if (delay) { data_size++; - delay_length_ms = *(cmd + 1 + data_size); + uint16_t delay_length_ms = *(cmd + 1 + data_size); if (delay_length_ms == 255) { delay_length_ms = 500; } + mp_hal_delay_ms(delay_length_ms); } - mp_hal_delay_ms(delay_length_ms); i += 2 + data_size; } common_hal_busio_i2c_unlock(bus->bus); From faa6887050e71a3ed129d5cfd9d7889cb615ee1c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 18 Sep 2023 12:59:43 -0500 Subject: [PATCH 1701/1712] Use faster bus & remove final delay this pushes the LCD initialization down to about 1.3s. --- .../boards/espressif_esp32s3_lcd_ev/board.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/board.c b/ports/espressif/boards/espressif_esp32s3_lcd_ev/board.c index ed06698583..86d4d0960d 100644 --- a/ports/espressif/boards/espressif_esp32s3_lcd_ev/board.c +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/board.c @@ -80,7 +80,7 @@ static const uint8_t display_init_sequence[] = { 0x3a, 1, 0x66, 0x3a, 1, 0x66, 0x11, 0x80, 120, - 0x29, 0x80, 20 + 0x29, 0x0 }; static const mcu_pin_obj_t *red_pins[] = { @@ -122,25 +122,27 @@ void board_init(void) { true ); - busio_i2c_obj_t *i2c = common_hal_board_create_i2c(0); + busio_i2c_obj_t i2c; + i2c.base.type = &busio_i2c_type; + common_hal_busio_i2c_construct(&i2c, DEFAULT_I2C_BUS_SCL, DEFAULT_I2C_BUS_SDA, 400000, 255); const int i2c_device_address = 32; - common_hal_busio_i2c_try_lock(i2c); + common_hal_busio_i2c_try_lock(&i2c); { uint8_t buf[2] = {3, 0xf1}; // set GPIO direction - common_hal_busio_i2c_write(i2c, i2c_device_address, buf, sizeof(buf)); + common_hal_busio_i2c_write(&i2c, i2c_device_address, buf, sizeof(buf)); } { uint8_t buf[2] = {2, 0}; // set all output pins low initially - common_hal_busio_i2c_write(i2c, i2c_device_address, buf, sizeof(buf)); + common_hal_busio_i2c_write(&i2c, i2c_device_address, buf, sizeof(buf)); } - common_hal_busio_i2c_unlock(i2c); + common_hal_busio_i2c_unlock(&i2c); dotclockframebuffer_ioexpander_spi_bus spibus = { - .bus = i2c, + .bus = &i2c, .i2c_device_address = i2c_device_address, .i2c_write_size = 2, .addr_reg_shadow = { .u32 = 1 }, // GPIO data at register 1 @@ -151,6 +153,7 @@ void board_init(void) { dotclockframebuffer_ioexpander_send_init_sequence(&spibus, display_init_sequence, sizeof(display_init_sequence)); + common_hal_busio_i2c_deinit(&i2c); } // Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. From c86b3ae19f58dc1420f6924272a24cb380eb6021 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Mon, 18 Sep 2023 11:18:04 -0700 Subject: [PATCH 1702/1712] Update to merged idf changes --- ports/espressif/esp-idf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/espressif/esp-idf b/ports/espressif/esp-idf index dc6c0b46ab..6f0c9319c5 160000 --- a/ports/espressif/esp-idf +++ b/ports/espressif/esp-idf @@ -1 +1 @@ -Subproject commit dc6c0b46ab9edc9c5ee6667c07eb87200b4f7ca5 +Subproject commit 6f0c9319c5b09ce12ef81e6428d3b6f23a9487e5 From d4000023d8f18100d01af5250521c42f5657537f Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 20 Sep 2023 11:45:45 -0700 Subject: [PATCH 1703/1712] Fix board def mistakes and cast --- ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk | 2 +- ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk | 2 +- ports/espressif/peripherals/i2c.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk b/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk index a8b3e35118..fb36bbf0db 100644 --- a/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk +++ b/ports/espressif/boards/deneyap_kart_1a_v2/mpconfigboard.mk @@ -11,7 +11,7 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB -CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_MODE = opi CIRCUITPY_ESP_PSRAM_FREQ = 80m CIRCUITPY_ESPCAMERA = 0 diff --git a/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk b/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk index 7f48c05863..e17f5061d9 100644 --- a/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_timer_camera_x/mpconfigboard.mk @@ -8,5 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_PSRAM_SIZE = 8MB -CIRCUITPY_ESP_PSRAM_MODE = qio +CIRCUITPY_ESP_PSRAM_MODE = opi CIRCUITPY_ESP_PSRAM_FREQ = 80m diff --git a/ports/espressif/peripherals/i2c.c b/ports/espressif/peripherals/i2c.c index 1f8565ca01..d16f165d38 100644 --- a/ports/espressif/peripherals/i2c.c +++ b/ports/espressif/peripherals/i2c.c @@ -35,7 +35,7 @@ typedef enum { static i2c_status_t i2c_status[I2C_NUM_MAX]; void i2c_reset(void) { - for (i2c_port_t num = 0; num < (int)I2C_NUM_MAX; num++) { + for (i2c_port_t num = 0; num < (i2c_port_t)I2C_NUM_MAX; num++) { if (i2c_status[num] == STATUS_IN_USE) { i2c_driver_delete(num); i2c_status[num] = STATUS_FREE; From 65e514ee491e4cb8a055ec1ddca470c14a49c238 Mon Sep 17 00:00:00 2001 From: Reppad Date: Wed, 20 Sep 2023 22:36:10 +0200 Subject: [PATCH 1704/1712] Fix codespace --- .devcontainer/cortex-m/on-create.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/cortex-m/on-create.sh b/.devcontainer/cortex-m/on-create.sh index 8c4bd0cfed..3db1ff3f38 100755 --- a/.devcontainer/cortex-m/on-create.sh +++ b/.devcontainer/cortex-m/on-create.sh @@ -34,7 +34,7 @@ rm -fr /workspaces/dosfstools-4.2 /workspaces/dosfstools-4.2.tar.gz # prepare source-code tree cd /workspaces/circuitpython/ echo -e "[on-create.sh] fetching submodules" -make fetch-submodules +make fetch-all-submodules echo -e "[on-create.sh] fetching tags" git fetch --tags --recurse-submodules=no --shallow-since="2021-07-01" https://github.com/adafruit/circuitpython HEAD From e22eefabd7fef719f8c2616d9e161527bbe550d1 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 15 Sep 2023 16:19:34 -0700 Subject: [PATCH 1705/1712] First stab at 5.1 update --- .gitmodules | 1 + ports/espressif/Makefile | 29 +++++++++++++++---- ports/espressif/bindings/espnow/Peer.c | 6 ++-- ports/espressif/bindings/espnow/Peer.h | 1 + .../adafruit_qualia_s3_rgb666/mpconfigboard.h | 4 --- .../adafruit_qualia_s3_rgb666/sdkconfig | 13 --------- ports/espressif/common-hal/alarm/__init__.c | 6 ++-- ports/espressif/common-hal/busio/I2C.c | 2 +- ports/espressif/common-hal/busio/UART.c | 2 +- .../common-hal/digitalio/DigitalInOut.c | 2 +- .../dotclockframebuffer/DotClockFramebuffer.c | 2 +- .../common-hal/microcontroller/Pin.c | 2 +- ports/espressif/common-hal/pwmio/PWMOut.h | 2 +- ports/espressif/esp-camera | 2 +- ports/espressif/esp-idf | 2 +- ports/espressif/supervisor/port.c | 2 +- 16 files changed, 43 insertions(+), 35 deletions(-) diff --git a/.gitmodules b/.gitmodules index 16fdbcf5a1..a0ecce0c75 100644 --- a/.gitmodules +++ b/.gitmodules @@ -143,6 +143,7 @@ [submodule "ports/espressif/esp-idf"] path = ports/espressif/esp-idf url = https://github.com/adafruit/esp-idf.git + branch = circuitpython-v5.1 [submodule "ports/espressif/esp-protocols"] path = ports/espressif/esp-protocols url = https://github.com/espressif/esp-protocols.git diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index b400cd06b7..c2ec9e43bc 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -32,6 +32,12 @@ IDF_TARGET_ARCH = xtensa CROSS_COMPILE = xtensa-$(IDF_TARGET)-elf- endif +ifeq ($(IDF_TARGET),esp32s3) +BT_IDF_TARGET = esp32c3 +else +BT_IDF_TARGET = $(IDF_TARGET) +endif + ####################################### # CFLAGS ####################################### @@ -52,19 +58,29 @@ INC += \ -isystem esp-idf/components/app_update/include \ -isystem esp-idf/components/bootloader_support/include \ -isystem esp-idf/components/bootloader_support/bootloader_flash/include \ - -isystem esp-idf/components/bt/include/$(IDF_TARGET)/include \ + -isystem esp-idf/components/bt/include/$(BT_IDF_TARGET)/include \ -isystem esp-idf/components/bt/host/nimble/esp-hci/include \ -isystem esp-idf/components/bt/host/nimble/nimble/nimble/controller/include \ -isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/include \ -isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/services/gap/include \ -isystem esp-idf/components/bt/host/nimble/nimble/nimble/include \ -isystem esp-idf/components/bt/host/nimble/nimble/nimble/host/util/include \ + -isystem esp-idf/components/bt/host/nimble/nimble/nimble/transport/include \ -isystem esp-idf/components/bt/host/nimble/nimble/porting/nimble/include \ -isystem esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/include \ -isystem esp-idf/components/bt/host/nimble/port/include \ -isystem esp-idf/components/driver/include \ -isystem esp-idf/components/driver/deprecated \ + -isystem esp-idf/components/driver/gpio/include \ + -isystem esp-idf/components/driver/i2c/include \ + -isystem esp-idf/components/driver/i2s/include \ -isystem esp-idf/components/driver/$(IDF_TARGET)/include \ + -isystem esp-idf/components/driver/ledc/include \ + -isystem esp-idf/components/driver/spi/include \ + -isystem esp-idf/components/driver/temperature_sensor/include \ + -isystem esp-idf/components/driver/touch_sensor/include \ + -isystem esp-idf/components/driver/touch_sensor/$(IDF_TARGET)/include \ + -isystem esp-idf/components/driver/twai/include \ -isystem esp-idf/components/efuse/include \ -isystem esp-idf/components/efuse/$(IDF_TARGET)/include \ -isystem esp-idf/components/$(IDF_TARGET)/include \ @@ -85,6 +101,7 @@ INC += \ -isystem esp-idf/components/esp_wifi/include \ -isystem esp-idf/components/freertos/esp_additions/include \ -isystem esp-idf/components/freertos/esp_additions/include/freertos \ + -isystem esp-idf/components/freertos/esp_additions/arch/$(IDF_TARGET_ARCH)/include \ -isystem esp-idf/components/freertos/FreeRTOS-Kernel/include \ -isystem esp-idf/components/freertos/FreeRTOS-Kernel/include/freertos \ -isystem esp-idf/components/freertos/FreeRTOS-Kernel/portable/$(IDF_TARGET_ARCH)/include \ @@ -95,7 +112,9 @@ INC += \ -isystem esp-idf/components/log/include \ -isystem esp-idf/components/lwip/include \ -isystem esp-idf/components/lwip/lwip/src/include \ - -isystem esp-idf/components/lwip/port/esp32/include \ + -isystem esp-idf/components/lwip/port/include \ + -isystem esp-idf/components/lwip/port/esp32xx/include \ + -isystem esp-idf/components/lwip/port/freertos/include \ -isystem esp-idf/components/mbedtls/esp_crt_bundle/include \ -isystem esp-idf/components/mbedtls/mbedtls/include \ -isystem esp-idf/components/mbedtls/port/include \ @@ -408,13 +427,13 @@ update-all-sdkconfigs: $(BUILD)/esp-idf/config/sdkconfig.h update-board-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h python tools/update_sdkconfig.py --board=$(BOARD) --debug=$(DEBUG) -BINARY_WIFI_BLOBS = libcoexist.a libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a -BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS)) +BINARY_WIFI_BLOBS = libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a +BINARY_BLOBS = esp-idf/components/esp_coex/lib/$(IDF_TARGET)/libcoexist.a esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS)) ifeq ($(IDF_TARGET),esp32) BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/librtc.a endif -ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc esp_app_format esp_common esp_event esp_hw_support esp_netif esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant +ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc esp_app_format esp_coex esp_common esp_event esp_hw_support esp_mm esp_netif esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant ifneq ($(CIRCUITPY_BLEIO),0) ESP_IDF_COMPONENTS_LINK += bt ifeq ($(IDF_TARGET),esp32) diff --git a/ports/espressif/bindings/espnow/Peer.c b/ports/espressif/bindings/espnow/Peer.c index 4cceec1498..6515cb4eeb 100644 --- a/ports/espressif/bindings/espnow/Peer.c +++ b/ports/espressif/bindings/espnow/Peer.c @@ -79,11 +79,13 @@ STATIC mp_obj_t espnow_peer_make_new(const mp_obj_type_t *type, size_t n_args, s self->peer_info.ifidx = (wifi_interface_t)mp_arg_validate_int_range(args[ARG_interface].u_int, 0, 1, MP_QSTR_interface); self->peer_info.encrypt = args[ARG_encrypted].u_bool; + self->lmk_set = false; const mp_obj_t lmk = args[ARG_lmk].u_obj; if (lmk != mp_const_none) { + self->lmk_set = true; memcpy(self->peer_info.lmk, common_hal_espnow_get_bytes_len(lmk, ESP_NOW_KEY_LEN), ESP_NOW_KEY_LEN); - } else if (self->peer_info.encrypt && !self->peer_info.lmk) { + } else if (self->peer_info.encrypt) { mp_raise_ValueError_varg(translate("%q is %q"), MP_QSTR_lmk, MP_QSTR_None); } @@ -196,7 +198,7 @@ STATIC mp_obj_t espnow_peer_set_encrypted(const mp_obj_t self_in, const mp_obj_t self->peer_info.encrypt = mp_obj_is_true(value); - if (!self->peer_info.lmk) { + if (!self->lmk_set) { mp_raise_ValueError_varg(translate("%q is %q"), MP_QSTR_lmk, MP_QSTR_None); } diff --git a/ports/espressif/bindings/espnow/Peer.h b/ports/espressif/bindings/espnow/Peer.h index 8afab8e493..23a691b3bc 100644 --- a/ports/espressif/bindings/espnow/Peer.h +++ b/ports/espressif/bindings/espnow/Peer.h @@ -32,6 +32,7 @@ typedef struct { mp_obj_base_t base; esp_now_peer_info_t peer_info; + bool lmk_set; } espnow_peer_obj_t; extern const mp_obj_type_t espnow_peer_type; diff --git a/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.h b/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.h index 9acfe8cf06..04527bb0a1 100644 --- a/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_qualia_s3_rgb666/mpconfigboard.h @@ -32,10 +32,6 @@ #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO18) -// UART pins attached to the USB-serial converter chip -#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO43) -#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO44) - #define MICROPY_HW_NEOPIXEL (&pin_GPIO4) // also DBLTAP #define DOUBLE_TAP_PIN (&pin_GPIO4) // also NEOPIXEL diff --git a/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig b/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig index e9dc0663bd..912dd14b11 100644 --- a/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig +++ b/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig @@ -5,19 +5,6 @@ # Component config # -# -# ESP System Settings -# -CONFIG_ESP_CONSOLE_UART_CUSTOM=y -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART=y -CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 -CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -# end of ESP System Settings - # # LWIP # diff --git a/ports/espressif/common-hal/alarm/__init__.c b/ports/espressif/common-hal/alarm/__init__.c index 6fa205d01f..6590bcc8e4 100644 --- a/ports/espressif/common-hal/alarm/__init__.c +++ b/ports/espressif/common-hal/alarm/__init__.c @@ -51,8 +51,8 @@ #include "esp_sleep.h" #include "soc/rtc_cntl_reg.h" -#include "components/driver/include/driver/gpio.h" -#include "components/driver/include/driver/uart.h" +#include "components/driver/gpio/include/driver/gpio.h" +#include "components/driver/uart/include/driver/uart.h" // Singleton instance of SleepMemory. const alarm_sleep_memory_obj_t alarm_sleep_memory_obj = { @@ -213,6 +213,8 @@ void NORETURN common_hal_alarm_enter_deep_sleep(void) { // The ESP-IDF caches the deep sleep settings and applies them before sleep. // We don't need to worry about resetting them in the interim. esp_deep_sleep_start(); + + reset_into_safe_mode(SAFE_MODE_HARD_FAULT); } void common_hal_alarm_gc_collect(void) { diff --git a/ports/espressif/common-hal/busio/I2C.c b/ports/espressif/common-hal/busio/I2C.c index 92bd4fb157..b9775adfd7 100644 --- a/ports/espressif/common-hal/busio/I2C.c +++ b/ports/espressif/common-hal/busio/I2C.c @@ -28,7 +28,7 @@ #include "py/mperrno.h" #include "py/runtime.h" -#include "components/driver/include/driver/i2c.h" +#include "components/driver/i2c/include/driver/i2c.h" #include "shared-bindings/microcontroller/__init__.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/espressif/common-hal/busio/UART.c b/ports/espressif/common-hal/busio/UART.c index bee199fb17..797d00697d 100644 --- a/ports/espressif/common-hal/busio/UART.c +++ b/ports/espressif/common-hal/busio/UART.c @@ -28,7 +28,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/busio/UART.h" -#include "components/driver/include/driver/uart.h" +#include "components/driver/uart/include/driver/uart.h" #include "mpconfigport.h" #include "shared/readline/readline.h" diff --git a/ports/espressif/common-hal/digitalio/DigitalInOut.c b/ports/espressif/common-hal/digitalio/DigitalInOut.c index 61671dadb9..4b6c966da3 100644 --- a/ports/espressif/common-hal/digitalio/DigitalInOut.c +++ b/ports/espressif/common-hal/digitalio/DigitalInOut.c @@ -28,7 +28,7 @@ #include "py/runtime.h" #include "supervisor/shared/translate/translate.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" diff --git a/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c b/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c index 61045d713d..d9e8d97da8 100644 --- a/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c +++ b/ports/espressif/common-hal/dotclockframebuffer/DotClockFramebuffer.c @@ -48,7 +48,7 @@ #include "common-hal/espidf/__init__.h" #include "shared-bindings/microcontroller/Pin.h" #include "py/runtime.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/esp_rom/include/esp_rom_gpio.h" #include "components/hal/esp32s3/include/hal/lcd_ll.h" #include "components/hal/include/hal/gpio_hal.h" diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index eeda6862db..4c01d988a9 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -30,7 +30,7 @@ #include "py/mphal.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" STATIC uint64_t _never_reset_pin_mask; diff --git a/ports/espressif/common-hal/pwmio/PWMOut.h b/ports/espressif/common-hal/pwmio/PWMOut.h index cde579ce89..a7711ebf07 100644 --- a/ports/espressif/common-hal/pwmio/PWMOut.h +++ b/ports/espressif/common-hal/pwmio/PWMOut.h @@ -28,7 +28,7 @@ #define MICROPY_INCLUDED_ESPRESSIF_COMMON_HAL_PWMIO_PWMOUT_H #include "common-hal/microcontroller/Pin.h" -#include "components/driver/include/driver/ledc.h" +#include "components/driver/ledc/include/driver/ledc.h" typedef struct { mp_obj_base_t base; diff --git a/ports/espressif/esp-camera b/ports/espressif/esp-camera index 75035312ed..8f3f2cc8cf 160000 --- a/ports/espressif/esp-camera +++ b/ports/espressif/esp-camera @@ -1 +1 @@ -Subproject commit 75035312ed9427557acfee1cd32af2b8e1f13f72 +Subproject commit 8f3f2cc8cfb2e4371870b0c5a974d40468114a9e diff --git a/ports/espressif/esp-idf b/ports/espressif/esp-idf index 6f0c9319c5..fb07ab7f00 160000 --- a/ports/espressif/esp-idf +++ b/ports/espressif/esp-idf @@ -1 +1 @@ -Subproject commit 6f0c9319c5b09ce12ef81e6428d3b6f23a9487e5 +Subproject commit fb07ab7f0007549d38081cfc6d83348780526a28 diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index a18ce77dfb..462cf9e361 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -284,7 +284,7 @@ safe_mode_t port_init(void) { #endif #if ENABLE_JTAG - ESP_LOGI(TAG, "Marking JTAG pins never_reset") + ESP_LOGI(TAG, "Marking JTAG pins never_reset"); // JTAG #ifdef CONFIG_IDF_TARGET_ESP32C3 common_hal_never_reset_pin(&pin_GPIO4); From 7bad82a2192b2b590054c912f8e9b010a5d3afcc Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Tue, 19 Sep 2023 16:27:00 -0700 Subject: [PATCH 1706/1712] C6 compiles, runs but wifi crashes --- .gitmodules | 2 +- ports/espressif/Makefile | 59 +++++++-- .../01space_lcd042_esp32c3/mpconfigboard.h | 2 - .../01space_lcd042_esp32c3/mpconfigboard.mk | 2 + .../adafruit_qtpy_esp32c3/mpconfigboard.h | 2 - .../adafruit_qtpy_esp32c3/mpconfigboard.mk | 2 + .../ai_thinker_esp32-c3s-2m/mpconfigboard.mk | 2 + .../ai_thinker_esp32-c3s/mpconfigboard.mk | 2 + .../boards/beetle-esp32-c3/mpconfigboard.h | 2 - .../boards/beetle-esp32-c3/mpconfigboard.mk | 2 + .../boards/deneyap_kart_g/mpconfigboard.h | 2 - .../boards/deneyap_kart_g/mpconfigboard.mk | 2 + .../espressif_esp32c6_devkitc_1_n8/board.c | 29 +++++ .../mpconfigboard.h | 35 +++++ .../mpconfigboard.mk | 8 ++ .../espressif_esp32c6_devkitc_1_n8/pins.c | 36 ++++++ .../espressif_esp32c6_devkitc_1_n8/sdkconfig | 15 +++ .../espressif_esp32c6_devkitm_1_n4/board.c | 29 +++++ .../mpconfigboard.h | 37 ++++++ .../mpconfigboard.mk | 8 ++ .../espressif_esp32c6_devkitm_1_n4/pins.c | 61 +++++++++ .../espressif_esp32c6_devkitm_1_n4/sdkconfig | 15 +++ .../boards/lolin_c3_mini/mpconfigboard.h | 2 - .../boards/lolin_c3_mini/mpconfigboard.mk | 2 + .../boards/lolin_c3_pico/mpconfigboard.h | 2 - .../boards/lolin_c3_pico/mpconfigboard.mk | 2 + .../luatos_core_esp32c3/mpconfigboard.h | 2 - .../luatos_core_esp32c3/mpconfigboard.mk | 2 + .../mpconfigboard.mk | 2 + .../boards/m5stack_stamp_c3/mpconfigboard.h | 2 - .../boards/m5stack_stamp_c3/mpconfigboard.mk | 2 + .../boards/microdev_micro_c3/mpconfigboard.h | 3 - .../boards/microdev_micro_c3/mpconfigboard.mk | 2 + .../boards/seeed_xiao_esp32c3/mpconfigboard.h | 2 - .../seeed_xiao_esp32c3/mpconfigboard.mk | 2 + .../common-hal/analogbufio/BufferedIn.c | 11 +- .../espressif/common-hal/analogio/AnalogIn.c | 122 +++++++++++++----- ports/espressif/common-hal/busio/UART.c | 2 +- ports/espressif/common-hal/canio/Listener.c | 25 +--- .../common-hal/frequencyio/FrequencyIn.c | 8 +- .../common-hal/microcontroller/Pin.c | 38 +++++- .../common-hal/microcontroller/Processor.c | 12 +- .../common-hal/microcontroller/__init__.c | 23 +++- .../esp-idf-config/sdkconfig-esp32c6.defaults | 66 ++++++++++ .../sdkconfig-flash-80m.defaults | 4 + .../esp-idf-config/sdkconfig.defaults | 8 ++ ports/espressif/mpconfigport.h | 14 +- ports/espressif/mpconfigport.mk | 22 +++- ports/espressif/mphalport.c | 10 +- ports/espressif/peripherals/esp32c6/pins.c | 59 +++++++++ ports/espressif/peripherals/esp32c6/pins.h | 94 ++++++++++++++ ports/espressif/peripherals/pins.h | 4 + ports/espressif/supervisor/port.c | 13 +- ports/espressif/tools/build_memory_info.py | 15 +++ ports/espressif/tools/update_sdkconfig.py | 2 +- py/circuitpy_mpconfig.mk | 3 + py/makeqstrdefs.py | 5 +- 57 files changed, 815 insertions(+), 126 deletions(-) create mode 100644 ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/board.c create mode 100644 ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/mpconfigboard.h create mode 100644 ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/mpconfigboard.mk create mode 100644 ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/pins.c create mode 100644 ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/sdkconfig create mode 100644 ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/board.c create mode 100644 ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.h create mode 100644 ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.mk create mode 100644 ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/pins.c create mode 100644 ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/sdkconfig create mode 100644 ports/espressif/esp-idf-config/sdkconfig-esp32c6.defaults create mode 100644 ports/espressif/peripherals/esp32c6/pins.c create mode 100644 ports/espressif/peripherals/esp32c6/pins.h diff --git a/.gitmodules b/.gitmodules index a0ecce0c75..9693f68421 100644 --- a/.gitmodules +++ b/.gitmodules @@ -152,7 +152,7 @@ url = https://github.com/espressif/esp-iot-solution.git [submodule "ports/espressif/esp-camera"] path = ports/espressif/esp-camera - url = https://github.com/espressif/esp32-camera.git + url = https://github.com/adafruit/esp32-camera.git branch = circuitpython [submodule "frozen/Adafruit_CircuitPython_ST7789"] path = frozen/Adafruit_CircuitPython_ST7789 diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index c2ec9e43bc..4e2953b495 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -27,6 +27,9 @@ include ../../py/circuitpy_mkenv.mk ifeq ($(IDF_TARGET),esp32c3) IDF_TARGET_ARCH = riscv CROSS_COMPILE = riscv32-esp-elf- +else ifeq ($(IDF_TARGET),esp32c6) +IDF_TARGET_ARCH = riscv +CROSS_COMPILE = riscv32-esp-elf- else IDF_TARGET_ARCH = xtensa CROSS_COMPILE = xtensa-$(IDF_TARGET)-elf- @@ -84,7 +87,8 @@ INC += \ -isystem esp-idf/components/efuse/include \ -isystem esp-idf/components/efuse/$(IDF_TARGET)/include \ -isystem esp-idf/components/$(IDF_TARGET)/include \ - -isystem esp-idf/components/esp_adc/deprecated/include \ + -isystem esp-idf/components/esp_adc/include \ + -isystem esp-idf/components/esp_adc/$(IDF_TARGET)/include \ -isystem esp-idf/components/esp_app_format/include \ -isystem esp-idf/components/esp_common/include \ -isystem esp-idf/components/esp_event/include \ @@ -172,6 +176,7 @@ CFLAGS += $(INC) -Werror -Wall -std=gnu11 -Wl,--gc-sections $(BASE_CFLAGS) $(C_D # Most current ESPs have nano versions of newlib in ROM so we use them. ifneq ($(IDF_TARGET),esp32c6) CFLAGS += --specs=nano.specs + LDFLAGS += -T$(IDF_TARGET).rom.newlib-nano.ld endif ifeq ($(IDF_TARGET_ARCH),xtensa) @@ -192,7 +197,6 @@ LDFLAGS += \ -T$(IDF_TARGET).rom.ld \ -T$(IDF_TARGET).rom.api.ld \ -T$(IDF_TARGET).rom.libgcc.ld \ - -T$(IDF_TARGET).rom.newlib-nano.ld \ -Wl,-Bstatic \ -Wl,--no-warn-mismatch \ -Wl,--build-id=none \ @@ -208,6 +212,15 @@ LDFLAGS += \ -Tesp32c3.rom.newlib.ld \ -Tesp32c3.rom.version.ld \ -Tesp32c3.rom.eco3.ld +else ifeq ($(IDF_TARGET),esp32c6) +LDFLAGS += \ + -Tesp32c6.rom.phy.ld \ + -Tesp32c6.rom.pp.ld \ + -Tesp32c6.rom.net80211.ld \ + -Tesp32c6.rom.newlib.ld \ + -Tesp32c6.rom.coexist.ld \ + -Tesp32c6.rom.heap.ld \ + -Tesp32c6.rom.wdt.ld else ifeq ($(IDF_TARGET),esp32s2) LDFLAGS += \ -T$(IDF_TARGET).rom.newlib-data.ld \ @@ -222,7 +235,7 @@ endif LIBS := -lgcc -lc -lstdc++ # Use toolchain libm if we're not using our own. -ifndef INTERNAL_LIBM +ifneq ($(INTERNAL_LIBM),1) LIBS += -lm endif @@ -262,12 +275,16 @@ SRC_C += \ SRC_C += $(wildcard common-hal/espidf/*.c) -ifeq ($(IDF_TARGET),esp32c3) +ifneq ($(CIRCUITPY_ESP_USB_SERIAL_JTAG),0) SRC_C += supervisor/usb_serial_jtag.c -else -SRC_C += \ - peripherals/pcnt.c \ - peripherals/touch.c +endif + +ifneq ($(CIRCUITPY_COUNTIO),0) +SRC_C += peripherals/pcnt.c +endif + +ifneq ($(CIRCUITPY_TOUCHIO_USE_NATIVE),0) +SRC_C += peripherals/touch.c endif ifneq ($(CIRCUITPY_USB),0) @@ -435,13 +452,28 @@ endif ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc esp_app_format esp_coex esp_common esp_event esp_hw_support esp_mm esp_netif esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant ifneq ($(CIRCUITPY_BLEIO),0) + BLE_IMPL_esp32 := esp32 + BLE_IMPL_esp32s3 := esp32c3 + BLE_IMPL_esp32c2 := libble + BLE_IMPL_esp32c3 := esp32c3 + BLE_IMPL_esp32c6 := libble + BLE_IMPL_esp32h2 := libble + BLE_IMPL = $(BLE_IMPL_$(IDF_TARGET)) + ESP_IDF_COMPONENTS_LINK += bt - ifeq ($(IDF_TARGET),esp32) - BINARY_BLOBS += esp-idf/components/bt/controller/lib_esp32/$(IDF_TARGET)/libbtdm_app.a - else + ifeq ($(BLE_IMPL),esp32) + BINARY_BLOBS += esp-idf/components/bt/controller/lib_esp32/$(IDF_TARGET)/libbtdm_app.a + endif + + ifeq ($(BLE_IMPL),esp32c3) BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libbtbb.a \ esp-idf/components/bt/controller/lib_esp32c3_family/$(IDF_TARGET)/libbtdm_app.a endif + + ifeq ($(BLE_IMPL),libble) + BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libbtbb.a \ + esp-idf/components/bt/controller/lib_$(IDF_TARGET)/$(IDF_TARGET)-bt-lib/libble_app.a + endif endif ifneq ($(CIRCUITPY_ESPULP),0) ESP_IDF_COMPONENTS_LINK += ulp @@ -469,11 +501,16 @@ ESP_IDF_COMPONENTS_EXPANDED += $(BUILD)/esp-idf/esp-idf/esp-camera/libesp-camera endif ifneq ($(VALID_BOARD),) +# From esp-idf/components/bootloader/Kconfig.projbuild # BOOTLOADER_OFFSET is determined by chip type, based on the ROM bootloader, and is not changeable. ifeq ($(IDF_TARGET),esp32) BOOTLOADER_OFFSET = 0x1000 +else ifeq ($(IDF_TARGET),esp32h2) +BOOTLOADER_OFFSET = 0x0 else ifeq ($(IDF_TARGET),esp32c3) BOOTLOADER_OFFSET = 0x0 +else ifeq ($(IDF_TARGET),esp32c6) +BOOTLOADER_OFFSET = 0x0 else ifeq ($(IDF_TARGET),esp32s3) BOOTLOADER_OFFSET = 0x0 else ifeq ($(IDF_TARGET),esp32s2) diff --git a/ports/espressif/boards/01space_lcd042_esp32c3/mpconfigboard.h b/ports/espressif/boards/01space_lcd042_esp32c3/mpconfigboard.h index cae80fa78c..7ff1fb17ca 100644 --- a/ports/espressif/boards/01space_lcd042_esp32c3/mpconfigboard.h +++ b/ports/espressif/boards/01space_lcd042_esp32c3/mpconfigboard.h @@ -36,5 +36,3 @@ // For entering safe mode #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9) - -#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) diff --git a/ports/espressif/boards/01space_lcd042_esp32c3/mpconfigboard.mk b/ports/espressif/boards/01space_lcd042_esp32c3/mpconfigboard.mk index e4467a3bbf..e0aee0c478 100644 --- a/ports/espressif/boards/01space_lcd042_esp32c3/mpconfigboard.mk +++ b/ports/espressif/boards/01space_lcd042_esp32c3/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 diff --git a/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h b/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h index 32b0940881..9a9ccd8124 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h +++ b/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h @@ -43,5 +43,3 @@ // For entering safe mode #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9) - -#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) diff --git a/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk index e2ce1e438d..a8b7315c11 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk index 054810a088..2fb409d247 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk +++ b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk @@ -8,3 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 2MB CIRCUITPY_DUALBANK = 0 + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 0 diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk index 3597166303..9bcaa3473a 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk +++ b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 0 diff --git a/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h b/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h index 2cdf48fad3..7b93665cee 100644 --- a/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h +++ b/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h @@ -40,5 +40,3 @@ #define CIRCUITPY_BOARD_UART (1) #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} - -#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) diff --git a/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.mk b/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.mk index b3fc9f5252..5ad71b2da5 100644 --- a/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.mk +++ b/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.mk @@ -7,3 +7,5 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE=qio CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 diff --git a/ports/espressif/boards/deneyap_kart_g/mpconfigboard.h b/ports/espressif/boards/deneyap_kart_g/mpconfigboard.h index ce2969bbda..d882e10861 100644 --- a/ports/espressif/boards/deneyap_kart_g/mpconfigboard.h +++ b/ports/espressif/boards/deneyap_kart_g/mpconfigboard.h @@ -40,5 +40,3 @@ // For entering safe mode #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9) - -#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) diff --git a/ports/espressif/boards/deneyap_kart_g/mpconfigboard.mk b/ports/espressif/boards/deneyap_kart_g/mpconfigboard.mk index a470d7a088..1743090e0e 100644 --- a/ports/espressif/boards/deneyap_kart_g/mpconfigboard.mk +++ b/ports/espressif/boards/deneyap_kart_g/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 diff --git a/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/board.c b/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/board.c new file mode 100644 index 0000000000..164430c88c --- /dev/null +++ b/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/board.c @@ -0,0 +1,29 @@ +/* + * 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/mpconfigboard.h b/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/mpconfigboard.h new file mode 100644 index 0000000000..68fa84c75c --- /dev/null +++ b/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/mpconfigboard.h @@ -0,0 +1,35 @@ +/* + * 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 "ESP32-C6-DevKitC-1-N8" +#define MICROPY_HW_MCU_NAME "ESP32C6" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO8) + +#define DEFAULT_UART_BUS_RX (&pin_GPIO17) +#define DEFAULT_UART_BUS_TX (&pin_GPIO16) diff --git a/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/mpconfigboard.mk new file mode 100644 index 0000000000..e15d2bf41e --- /dev/null +++ b/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0x000C303A +CIRCUITPY_CREATION_ID = 0x00C60002 + +IDF_TARGET = esp32c6 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 8MB diff --git a/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/pins.c b/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/pins.c new file mode 100644 index 0000000000..441bf33909 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/pins.c @@ -0,0 +1,36 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + { MP_ROM_QSTR(MP_QSTR_IO13), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_IO15), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_IO22), MP_ROM_PTR(&pin_GPIO22) }, + { MP_ROM_QSTR(MP_QSTR_IO23), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/sdkconfig b/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/sdkconfig new file mode 100644 index 0000000000..54a5473075 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32c6_devkitc_1_n8/sdkconfig @@ -0,0 +1,15 @@ +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif-esp32c6" +# end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/board.c b/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/board.c new file mode 100644 index 0000000000..f749ee60d2 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 microDev + * + * 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.h b/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.h new file mode 100644 index 0000000000..dd6b260e51 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.h @@ -0,0 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 microDev + * + * 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. + */ + +// Board setup +#define MICROPY_HW_BOARD_NAME "ESP32-C6-DevKitM-1" +#define MICROPY_HW_MCU_NAME "ESP32-C6N4" + +// Status LED +#define MICROPY_HW_NEOPIXEL (&pin_GPIO8) +#define MICROPY_HW_NEOPIXEL_COUNT (1) + +// Default bus pins +#define DEFAULT_UART_BUS_RX (&pin_GPIO16) +#define DEFAULT_UART_BUS_TX (&pin_GPIO17) diff --git a/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.mk new file mode 100644 index 0000000000..75e097afa8 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.mk @@ -0,0 +1,8 @@ +CIRCUITPY_CREATOR_ID = 0x000C303A +CIRCUITPY_CREATION_ID = 0x00C60001 + +IDF_TARGET = esp32c6 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 80m +CIRCUITPY_ESP_FLASH_SIZE = 4MB diff --git a/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/pins.c b/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/pins.c new file mode 100644 index 0000000000..243b6040d0 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/pins.c @@ -0,0 +1,61 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 microDev + * + * 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 "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) }, + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) }, + { MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) }, + + { MP_ROM_QSTR(MP_QSTR_MTMS), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_MTDI), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_MTCK), MP_ROM_PTR(&pin_GPIO6) }, + { MP_ROM_QSTR(MP_QSTR_MTDO), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/sdkconfig b/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/sdkconfig new file mode 100644 index 0000000000..30a4bea2cc --- /dev/null +++ b/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/sdkconfig @@ -0,0 +1,15 @@ +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="ESP32-C6-DevKitM-1" +# end of LWIP + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/boards/lolin_c3_mini/mpconfigboard.h b/ports/espressif/boards/lolin_c3_mini/mpconfigboard.h index 2a90d91845..315384627b 100644 --- a/ports/espressif/boards/lolin_c3_mini/mpconfigboard.h +++ b/ports/espressif/boards/lolin_c3_mini/mpconfigboard.h @@ -44,5 +44,3 @@ #define CIRCUITPY_BOARD_UART (1) #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} - -#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) diff --git a/ports/espressif/boards/lolin_c3_mini/mpconfigboard.mk b/ports/espressif/boards/lolin_c3_mini/mpconfigboard.mk index d1cd0129fd..99c910e6d2 100644 --- a/ports/espressif/boards/lolin_c3_mini/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_c3_mini/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE=qio CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 diff --git a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h index 3e68e6adf9..ce0643e787 100644 --- a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h +++ b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.h @@ -44,5 +44,3 @@ #define CIRCUITPY_BOARD_UART (1) #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} - -#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) diff --git a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk index a202fd8ad3..6778550a2d 100644 --- a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk @@ -7,5 +7,7 @@ CIRCUITPY_ESP_FLASH_MODE=qio CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB +CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 + # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.h b/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.h index 23bb5ee9b2..6d33513e3c 100644 --- a/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.h +++ b/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.h @@ -34,5 +34,3 @@ #define CIRCUITPY_BOARD_UART (1) #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} - -#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) diff --git a/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.mk b/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.mk index e0df58f756..03f5171a31 100644 --- a/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.mk +++ b/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE=dio CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 diff --git a/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk b/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk index 6a19c783f1..9e777889c0 100644 --- a/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk +++ b/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE=dio CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 0 diff --git a/ports/espressif/boards/m5stack_stamp_c3/mpconfigboard.h b/ports/espressif/boards/m5stack_stamp_c3/mpconfigboard.h index 3e8be96d7d..90174f60ff 100644 --- a/ports/espressif/boards/m5stack_stamp_c3/mpconfigboard.h +++ b/ports/espressif/boards/m5stack_stamp_c3/mpconfigboard.h @@ -35,8 +35,6 @@ #define CIRCUITPY_BOARD_UART (1) #define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}} -// #define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) - // Serial over UART #define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO20) #define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO21) diff --git a/ports/espressif/boards/m5stack_stamp_c3/mpconfigboard.mk b/ports/espressif/boards/m5stack_stamp_c3/mpconfigboard.mk index 25a6f87428..2f3b62f90f 100644 --- a/ports/espressif/boards/m5stack_stamp_c3/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_stamp_c3/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE=qio CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 0 diff --git a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h index 2153513306..0ed8ea8925 100644 --- a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h +++ b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.h @@ -45,8 +45,5 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO20) #define DEFAULT_UART_BUS_TX (&pin_GPIO21) -// For REPL over built-in USB Serial -#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) - // For entering safe mode #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9) diff --git a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.mk b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.mk index 94c64a8273..1bb9d0835f 100644 --- a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.mk +++ b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 diff --git a/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.h b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.h index 638be9d197..26fa6b7f83 100644 --- a/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.h +++ b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.h @@ -10,5 +10,3 @@ #define DEFAULT_UART_BUS_RX (&pin_GPIO20) #define DEFAULT_UART_BUS_TX (&pin_GPIO21) - -#define CIRCUITPY_ESP_USB_SERIAL_JTAG (1) diff --git a/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk index d7325cf44e..4bec24347e 100644 --- a/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk +++ b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 diff --git a/ports/espressif/common-hal/analogbufio/BufferedIn.c b/ports/espressif/common-hal/analogbufio/BufferedIn.c index 9dd66bc9da..567c10c963 100644 --- a/ports/espressif/common-hal/analogbufio/BufferedIn.c +++ b/ports/espressif/common-hal/analogbufio/BufferedIn.c @@ -56,12 +56,14 @@ #elif defined(CONFIG_IDF_TARGET_ESP32S2) #define ADC_RESULT_BYTE 2 #define ADC_CONV_LIMIT_EN 0 -#elif defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32H2) +#elif defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2) #define ADC_RESULT_BYTE 4 #define ADC_CONV_LIMIT_EN 0 #elif defined(CONFIG_IDF_TARGET_ESP32S3) #define ADC_RESULT_BYTE 4 #define ADC_CONV_LIMIT_EN 0 +#else +#error No known CONFIG_IDF_TARGET_xxx found #endif static void start_dma(analogbufio_bufferedin_obj_t *self, adc_digi_convert_mode_t *convert_mode, adc_digi_output_format_t *output_format); @@ -205,7 +207,12 @@ void common_hal_analogbufio_bufferedin_deinit(analogbufio_bufferedin_obj_t *self } static bool check_valid_data(const adc_digi_output_data_t *data, const mcu_pin_obj_t *pin, adc_digi_convert_mode_t convert_mode, adc_digi_output_format_t output_format) { - unsigned int unit = data->type2.unit; + unsigned int unit; + #if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 + unit = 0; + #else + unit = data->type2.unit; + #endif if (output_format == ADC_DIGI_OUTPUT_FORMAT_TYPE2) { if (data->type2.channel >= SOC_ADC_CHANNEL_NUM(unit)) { return false; diff --git a/ports/espressif/common-hal/analogio/AnalogIn.c b/ports/espressif/common-hal/analogio/AnalogIn.c index 6af0ace1d2..983e2dd754 100644 --- a/ports/espressif/common-hal/analogio/AnalogIn.c +++ b/ports/espressif/common-hal/analogio/AnalogIn.c @@ -25,14 +25,18 @@ */ #include "common-hal/analogio/AnalogIn.h" + +#include "bindings/espidf/__init__.h" #include "shared-bindings/analogio/AnalogIn.h" #include "py/mperrno.h" #include "py/runtime.h" #include "supervisor/shared/translate/translate.h" -#include "driver/adc.h" +#include "adc_cali_schemes.h" +#include "esp_adc/adc_oneshot.h" +#include "esp_adc/adc_cali.h" #include "driver/gpio.h" -#include "esp_adc_cal.h" +#include "hal/adc_types.h" #include "shared-bindings/microcontroller/Pin.h" @@ -42,13 +46,17 @@ #define NO_OF_SAMPLES 2 #define ATTENUATION ADC_ATTEN_DB_11 #if defined(CONFIG_IDF_TARGET_ESP32) -#define DATA_WIDTH ADC_WIDTH_BIT_12 +#define DATA_WIDTH ADC_BITWIDTH_12 #elif defined(CONFIG_IDF_TARGET_ESP32C3) -#define DATA_WIDTH ADC_WIDTH_BIT_12 +#define DATA_WIDTH ADC_BITWIDTH_12 +#elif defined(CONFIG_IDF_TARGET_ESP32C6) +#define DATA_WIDTH ADC_BITWIDTH_12 #elif defined(CONFIG_IDF_TARGET_ESP32S2) -#define DATA_WIDTH ADC_WIDTH_BIT_13 +#define DATA_WIDTH ADC_BITWIDTH_13 #elif defined(CONFIG_IDF_TARGET_ESP32S3) -#define DATA_WIDTH ADC_WIDTH_BIT_12 +#define DATA_WIDTH ADC_BITWIDTH_12 +#elif defined(CONFIG_IDF_TARGET_ESP32H2) +#define DATA_WIDTH ADC_BITWIDTH_12 #else #error No known CONFIG_IDF_TARGET_xxx found #endif @@ -79,38 +87,86 @@ void common_hal_analogio_analogin_deinit(analogio_analogin_obj_t *self) { } uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { - if (self->pin->adc_index == ADC_UNIT_1) { - adc1_config_width(DATA_WIDTH); - adc1_config_channel_atten((adc1_channel_t)self->pin->adc_channel, ATTENUATION); - } else if (self->pin->adc_index == ADC_UNIT_2) { - adc2_config_channel_atten((adc2_channel_t)self->pin->adc_channel, ATTENUATION); - } else { - raise_ValueError_invalid_pin(); + adc_oneshot_unit_handle_t adc_handle; + adc_oneshot_unit_init_cfg_t adc_config = { + .unit_id = self->pin->adc_index, + .ulp_mode = ADC_ULP_MODE_DISABLE + }; + cp_check_esp_error(adc_oneshot_new_unit(&adc_config, &adc_handle)); + + adc_oneshot_chan_cfg_t channel_config = { + .atten = ATTENUATION, + .bitwidth = DATA_WIDTH + }; + adc_channel_t channel = (adc_channel_t)self->pin->adc_channel; + adc_oneshot_config_channel(adc_handle, channel, &channel_config); + + adc_cali_scheme_ver_t supported_schemes; + adc_cali_check_scheme(&supported_schemes); + adc_cali_scheme_ver_t calibration_scheme; + adc_cali_handle_t calibration; + + #if defined(ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED) && ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED + adc_cali_curve_fitting_config_t config = { + .unit_id = self->pin->adc_index, + .chan = channel, + .atten = ATTENUATION, + .bitwidth = DATA_WIDTH + }; + if (adc_cali_create_scheme_curve_fitting(&config, &calibration) == ESP_OK) { + calibration_scheme = ADC_CALI_SCHEME_VER_CURVE_FITTING; } - - // Automatically select calibration process depending on status of efuse - esp_adc_cal_characteristics_t adc_chars; - memset(&adc_chars, 0, sizeof(adc_chars)); - esp_adc_cal_characterize(self->pin->adc_index, ATTENUATION, DATA_WIDTH, DEFAULT_VREF, &adc_chars); - - uint32_t adc_reading = 0; - // Multisampling - for (int i = 0; i < NO_OF_SAMPLES; i++) { - if (self->pin->adc_index == ADC_UNIT_1) { - adc_reading += adc1_get_raw((adc1_channel_t)self->pin->adc_channel); - } else { - int raw; - esp_err_t r = adc2_get_raw((adc2_channel_t)self->pin->adc_channel, DATA_WIDTH, &raw); - if (r != ESP_OK) { - mp_raise_ValueError(translate("ADC2 is being used by WiFi")); - } - adc_reading += raw; + #endif + #if defined(ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED) && ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED + if (calibration_scheme == 0) { + adc_cali_line_fitting_config_t config = { + .unit_id = self->pin->adc_index, + .atten = ATTENUATION, + .bitwidth = DATA_WIDTH, + #ifdef CONFIG_IDF_TARGET_ESP32 + .default_vref = DEFAULT_VREF; + #endif + }; + if (adc_cali_create_scheme_line_fitting(&config, &calibration) == ESP_OK) { + calibration_scheme = ADC_CALI_SCHEME_VER_LINE_FITTING; } } - adc_reading /= NO_OF_SAMPLES; + #endif + + uint32_t adc_reading = 0; + size_t sample_count = 0; + // Multisampling + esp_err_t ret = ESP_OK; + for (int i = 0; i < NO_OF_SAMPLES; i++) { + int raw; + ret = adc_oneshot_read(adc_handle, channel, &raw); + if (ret != ESP_OK) { + continue; + } + adc_reading += raw; + sample_count += 1; + } + if (sample_count == 0) { + raise_esp_error(ret); + } + adc_reading /= sample_count; // This corrects non-linear regions of the ADC range with a LUT, so it's a better reading than raw - uint32_t voltage = esp_adc_cal_raw_to_voltage(adc_reading, &adc_chars); + int voltage; + adc_cali_raw_to_voltage(calibration, adc_reading, &voltage); + + + #if defined(ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED) && ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED + if (calibration_scheme == ADC_CALI_SCHEME_VER_CURVE_FITTING) { + adc_cali_delete_scheme_curve_fitting(calibration); + } + #endif + #if defined(ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED) && ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED + if (calibration_scheme == ADC_CALI_SCHEME_VER_LINE_FITTING) { + adc_cali_delete_scheme_line_fitting(calibration); + } + #endif + adc_oneshot_del_unit(adc_handle); return voltage * ((1 << 16) - 1) / 3300; } diff --git a/ports/espressif/common-hal/busio/UART.c b/ports/espressif/common-hal/busio/UART.c index 797d00697d..e96861191f 100644 --- a/ports/espressif/common-hal/busio/UART.c +++ b/ports/espressif/common-hal/busio/UART.c @@ -230,7 +230,7 @@ void common_hal_busio_uart_construct(busio_uart_obj_t *self, uart_config.stop_bits = UART_STOP_BITS_2; } // uart_set_stop_bits(self->uart_num, stop_bits); - uart_config.source_clk = UART_SCLK_APB; // guessing here... + uart_config.source_clk = UART_SCLK_DEFAULT; // config all in one? if (uart_param_config(self->uart_num, &uart_config) != ESP_OK) { diff --git a/ports/espressif/common-hal/canio/Listener.c b/ports/espressif/common-hal/canio/Listener.c index 66ce096970..c884bd46a1 100644 --- a/ports/espressif/common-hal/canio/Listener.c +++ b/ports/espressif/common-hal/canio/Listener.c @@ -39,40 +39,29 @@ #include "hal/twai_ll.h" +#if SOC_TWAI_CONTROLLER_NUM > 1 +#define TWAI TWAI0 +#endif + // IDE = "extended ID" flag of packet header. We always add this bit to the // mask because a match is always for just one kind of address length #define FILTER16_IDE (1 << 3) #define FILTER32_IDE (1 << 2) -// Work around a problem reported at -// https://github.com/espressif/esp-idf/issues/6020 where -// twai_ll_set_acc_filter does not work under -Os optimization -__attribute__((optimize("O0"))) -__attribute__((noinline)) -static void canio_set_acc_filter(twai_dev_t *hw, uint32_t code, uint32_t mask, bool single_filter) { - uint32_t code_swapped = __builtin_bswap32(code); - uint32_t mask_swapped = __builtin_bswap32(mask); - for (int i = 0; i < 4; i++) { - hw->acceptance_filter.acr[i].val = ((code_swapped >> (i * 8)) & 0xFF); - hw->acceptance_filter.amr[i].val = ((mask_swapped >> (i * 8)) & 0xFF); - } - hw->mode_reg.afm = single_filter; -} - STATIC void install_standard_filter(canio_listener_obj_t *self, canio_match_obj_t *match) { - canio_set_acc_filter(&TWAI, match->id << 21, ~(match->mask << 21), true); + twai_ll_set_acc_filter(&TWAI, match->id << 21, ~(match->mask << 21), true); self->extended = false; self->standard = true; } STATIC void install_extended_filter(canio_listener_obj_t *self, canio_match_obj_t *match) { - canio_set_acc_filter(&TWAI, match->id << 3, ~(match->mask << 3), true); + twai_ll_set_acc_filter(&TWAI, match->id << 3, ~(match->mask << 3), true); self->extended = true; self->standard = false; } STATIC void install_all_match_filter(canio_listener_obj_t *self) { - canio_set_acc_filter(&TWAI, 0u, ~0u, true); + twai_ll_set_acc_filter(&TWAI, 0u, ~0u, true); self->extended = true; self->standard = true; } diff --git a/ports/espressif/common-hal/frequencyio/FrequencyIn.c b/ports/espressif/common-hal/frequencyio/FrequencyIn.c index 1a82b90f45..92e76f1207 100644 --- a/ports/espressif/common-hal/frequencyio/FrequencyIn.c +++ b/ports/espressif/common-hal/frequencyio/FrequencyIn.c @@ -60,11 +60,15 @@ static void IRAM_ATTR timer_interrupt_handler(void *self_in) { // reset interrupt timg_dev_t *device = self->timer.group ? &(TIMERG1) : &(TIMERG0); + #if SOC_TIMER_GROUP_TIMERS_PER_GROUP > 1 if (self->timer.idx) { device->int_clr_timers.t1_int_clr = 1; } else { - device->int_clr_timers.t0_int_clr = 1; - } + #endif + device->int_clr_timers.t0_int_clr = 1; + #if SOC_TIMER_GROUP_TIMERS_PER_GROUP > 1 +} + #endif #if defined(CONFIG_IDF_TARGET_ESP32S3) device->hw_timer[self->timer.idx].config.tn_alarm_en = 1; diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index 4c01d988a9..a3226415b2 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -59,15 +59,18 @@ STATIC uint64_t _in_use_pin_mask; #define GPIO_SEL_18 (BIT(18)) /*!< Pin 18 selected */ #define GPIO_SEL_19 (BIT(19)) /*!< Pin 19 selected */ #define GPIO_SEL_20 (BIT(20)) /*!< Pin 20 selected */ +#if SOC_GPIO_PIN_COUNT > 21 #define GPIO_SEL_21 (BIT(21)) /*!< Pin 21 selected */ -#if defined(CONFIG_IDF_TARGET_ESP32) +#endif +#if SOC_GPIO_PIN_COUNT > 22 #define GPIO_SEL_22 (BIT(22)) /*!< Pin 22 selected */ #define GPIO_SEL_23 (BIT(23)) /*!< Pin 23 selected */ - +#define GPIO_SEL_24 (BIT(24)) /*!< Pin 24 selected */ #define GPIO_SEL_25 (BIT(25)) /*!< Pin 25 selected */ -#endif #define GPIO_SEL_26 (BIT(26)) /*!< Pin 26 selected */ #define GPIO_SEL_27 (BIT(27)) /*!< Pin 27 selected */ +#endif +#if SOC_GPIO_PIN_COUNT > 28 #define GPIO_SEL_28 (BIT(28)) /*!< Pin 28 selected */ #define GPIO_SEL_29 (BIT(29)) /*!< Pin 29 selected */ #define GPIO_SEL_30 (BIT(30)) /*!< Pin 30 selected */ @@ -80,6 +83,7 @@ STATIC uint64_t _in_use_pin_mask; #define GPIO_SEL_37 ((uint64_t)PIN_BIT(37)) /*!< Pin 37 selected */ #define GPIO_SEL_38 ((uint64_t)PIN_BIT(38)) /*!< Pin 38 selected */ #define GPIO_SEL_39 ((uint64_t)PIN_BIT(39)) /*!< Pin 39 selected */ +#endif #if SOC_GPIO_PIN_COUNT > 40 #define GPIO_SEL_40 ((uint64_t)PIN_BIT(40)) /*!< Pin 40 selected */ #define GPIO_SEL_41 ((uint64_t)PIN_BIT(41)) /*!< Pin 41 selected */ @@ -88,11 +92,11 @@ STATIC uint64_t _in_use_pin_mask; #define GPIO_SEL_44 ((uint64_t)PIN_BIT(44)) /*!< Pin 44 selected */ #define GPIO_SEL_45 ((uint64_t)PIN_BIT(45)) /*!< Pin 45 selected */ #define GPIO_SEL_46 ((uint64_t)PIN_BIT(46)) /*!< Pin 46 selected */ -#if defined(CONFIG_IDF_TARGET_ESP32S3) +#endif +#if SOC_GPIO_PIN_COUNT > 47 #define GPIO_SEL_47 ((uint64_t)PIN_BIT(47)) /*!< Pin 47 selected */ #define GPIO_SEL_48 ((uint64_t)PIN_BIT(48)) /*!< Pin 48 selected */ #endif -#endif // Bit mask of all pins that should never EVER be reset. // Typically these are SPI flash and PSRAM control pins, and communication pins. @@ -126,6 +130,26 @@ static const uint64_t pin_mask_reset_forbidden = #endif #endif // ESP32C3 + #if defined(CONFIG_IDF_TARGET_ESP32C6) + // Never ever reset pins used to communicate with SPI flash. + GPIO_SEL_24 | // SPICS0 + GPIO_SEL_25 | // SPIQ + GPIO_SEL_26 | // SPIWP + GPIO_SEL_28 | // SPIHD + GPIO_SEL_29 | // SPICLK + GPIO_SEL_30 | // SPID + #if CIRCUITPY_ESP_USB_SERIAL_JTAG + // Never ever reset serial/JTAG communication pins. + GPIO_SEL_12 | // USB D- + GPIO_SEL_13 | // USB D+ + #endif + #if defined(CONFIG_ESP_CONSOLE_UART_DEFAULT) && CONFIG_ESP_CONSOLE_UART_DEFAULT && CONFIG_ESP_CONSOLE_UART_NUM == 0 + // Never reset debug UART/console pins. + GPIO_SEL_16 | + GPIO_SEL_17 | + #endif + #endif // ESP32C6 + #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) // Never ever reset pins used to communicate with SPI flash and PSRAM. GPIO_SEL_19 | // USB D- @@ -254,10 +278,12 @@ void preserve_pin_number(gpio_num_t pin_number) { _preserved_pin_mask |= PIN_BIT(pin_number); } if (_preserved_pin_mask) { + #if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP // Allow pin holds to work during deep sleep. This increases power consumption noticeably // during deep sleep, so enable holds only if we actually are holding some pins. // 270uA or so extra current is consumed even with no pins held. gpio_deep_sleep_hold_en(); + #endif } } @@ -301,7 +327,9 @@ void common_hal_reset_pin(const mcu_pin_obj_t *pin) { void reset_all_pins(void) { // Undo deep sleep holds in case we woke up from deep sleep. // We still need to unhold individual pins, which is done by _reset_pin. + #if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP gpio_deep_sleep_hold_dis(); + #endif for (uint8_t i = 0; i < GPIO_PIN_COUNT; i++) { uint32_t iomux_address = GPIO_PIN_MUX_REG[i]; diff --git a/ports/espressif/common-hal/microcontroller/Processor.c b/ports/espressif/common-hal/microcontroller/Processor.c index 8e8196ea0e..7112937ab1 100644 --- a/ports/espressif/common-hal/microcontroller/Processor.c +++ b/ports/espressif/common-hal/microcontroller/Processor.c @@ -65,17 +65,7 @@ float common_hal_mcu_processor_get_voltage(void) { } uint32_t common_hal_mcu_processor_get_frequency(void) { - #if defined(CONFIG_IDF_TARGET_ESP32) - return CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ * 1000000; - #elif defined(CONFIG_IDF_TARGET_ESP32C3) - return CONFIG_ESP32C3_DEFAULT_CPU_FREQ_MHZ * 1000000; - #elif defined(CONFIG_IDF_TARGET_ESP32S2) - return CONFIG_ESP32S2_DEFAULT_CPU_FREQ_MHZ * 1000000; - #elif defined(CONFIG_IDF_TARGET_ESP32S3) - return CONFIG_ESP32S3_DEFAULT_CPU_FREQ_MHZ * 1000000; - #else - #error No known CONFIG_IDF_TARGET_xxx found - #endif + return CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ * 1000000; } STATIC uint8_t swap_nibbles(uint8_t v) { diff --git a/ports/espressif/common-hal/microcontroller/__init__.c b/ports/espressif/common-hal/microcontroller/__init__.c index 7ec9b215f1..6ef1d77764 100644 --- a/ports/espressif/common-hal/microcontroller/__init__.c +++ b/ports/espressif/common-hal/microcontroller/__init__.c @@ -42,21 +42,30 @@ #include "freertos/FreeRTOS.h" -#include "soc/rtc_cntl_reg.h" #include "esp_private/system_internal.h" #if defined(CONFIG_IDF_TARGET_ESP32) +#include "soc/rtc_cntl_reg.h" #include "esp32/rom/rtc.h" #elif defined(CONFIG_IDF_TARGET_ESP32C3) +#include "soc/rtc_cntl_reg.h" #include "esp32c3/rom/rtc.h" +#elif defined(CONFIG_IDF_TARGET_ESP32C6) +#include "soc/lp_aon_reg.h" +#include "esp32c6/rom/rtc.h" #elif defined(CONFIG_IDF_TARGET_ESP32S2) +#include "soc/rtc_cntl_reg.h" #include "esp32s2/rom/rtc.h" #include "esp32s2/rom/usb/usb_persist.h" #include "esp32s2/rom/usb/chip_usb_dw_wrapper.h" #elif defined(CONFIG_IDF_TARGET_ESP32S3) +#include "soc/rtc_cntl_reg.h" #include "esp32s3/rom/rtc.h" #include "esp32s3/rom/usb/usb_persist.h" #include "esp32s3/rom/usb/chip_usb_dw_wrapper.h" +#elif defined(CONFIG_IDF_TARGET_ESP32H) +#include "soc/lp_aon_reg.h" +#include "esp32h2/rom/rtc.h" #else #error No known CONFIG_IDF_TARGET_xxx found #endif @@ -101,10 +110,18 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) REG_WRITE(RTC_RESET_CAUSE_REG, 0); // reset uf2 #endif + #if SOC_LP_AON_SUPPORTED + REG_WRITE(LP_AON_STORE0_REG, 0); // reset safe mode + #else REG_WRITE(RTC_CNTL_STORE0_REG, 0); // reset safe mode + #endif #if !defined(CONFIG_IDF_TARGET_ESP32) + #if SOC_LP_AON_SUPPORTED + REG_WRITE(LP_AON_SYS_CFG_REG, 0); // reset bootloader + #else REG_WRITE(RTC_CNTL_OPTION1_REG, 0); // reset bootloader #endif + #endif break; case RUNMODE_SAFE_MODE: // enter safe mode on next boot @@ -118,8 +135,12 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) chip_usb_set_persist_flags(USBDC_BOOT_DFU); #endif + #if SOC_LP_AON_SUPPORTED + REG_WRITE(LP_AON_SYS_CFG_REG, LP_AON_FORCE_DOWNLOAD_BOOT); + #else REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT); #endif + #endif break; default: break; diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32c6.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32c6.defaults new file mode 100644 index 0000000000..02516de4e4 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32c6.defaults @@ -0,0 +1,66 @@ +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# Bluetooth +# +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +# +# NimBLE Options +# +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +CONFIG_BT_NIMBLE_NVS_PERSIST=y +# +# Memory Settings +# +CONFIG_BT_NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT=20 +CONFIG_BT_NIMBLE_TRANSPORT_EVT_SIZE=70 +# end of Memory Settings + +CONFIG_BT_NIMBLE_EXT_ADV=y +# end of NimBLE Options + +# end of Bluetooth + +# +# Driver Configurations +# +# +# PCNT Configuration +# +CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y +# end of PCNT Configuration + +# +# RMT Configuration +# +CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y +# end of RMT Configuration + +# +# I2S Configuration +# +CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y +# end of I2S Configuration + +# end of Driver Configurations + +# +# PHY +# +CONFIG_ESP_PHY_ENABLE_USB=y +# end of PHY + +# +# Wi-Fi +# +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=4 +# end of Wi-Fi + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-flash-80m.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-80m.defaults index 949113b7cf..2ea4419003 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-flash-80m.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-80m.defaults @@ -1,10 +1,14 @@ # CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set CONFIG_ESPTOOLPY_FLASHFREQ_80M=y +# CONFIG_ESPTOOLPY_FLASHFREQ_64M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_60M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_48M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_32M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_30M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_24M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_16M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_15M is not set +CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT=y diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index 55a8e3cc06..d613b0f785 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -35,6 +35,14 @@ CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384 # CONFIG_ESP_DEBUG_OCDAWARE is not set # end of ESP System Settings +# +# Wi-Fi +# +CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=16 +# CONFIG_ESP_WIFI_NVS_ENABLED is not set +# end of Wi-Fi + # # LWIP # diff --git a/ports/espressif/mpconfigport.h b/ports/espressif/mpconfigport.h index e4733356bb..bb333ae4ac 100644 --- a/ports/espressif/mpconfigport.h +++ b/ports/espressif/mpconfigport.h @@ -59,12 +59,10 @@ // Nearly all boards have this because it is used to enter the ROM bootloader. #ifndef CIRCUITPY_BOOT_BUTTON - #ifdef CONFIG_IDF_TARGET_ESP32C3 + #if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2) #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO9) - #else - #ifndef CONFIG_IDF_TARGET_ESP32 - #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) - #endif + #elif !defined(CONFIG_IDF_TARGET_ESP32) + #define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) #endif #endif @@ -90,12 +88,6 @@ #define CIRCUITPY_I2C_ALLOW_INTERNAL_PULL_UP (0) #endif -// Define to (1) in mpconfigboard.h if the board uses the internal USB to -// Serial/JTAG to connect do USB. -#ifndef CIRCUITPY_ESP_USB_SERIAL_JTAG -#define CIRCUITPY_ESP_USB_SERIAL_JTAG (0) -#endif - #ifndef DEFAULT_RESERVED_PSRAM #define DEFAULT_RESERVED_PSRAM (0) #endif diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index bb15fce92b..bc5a0533ff 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -2,7 +2,7 @@ INTERNAL_FLASH_FILESYSTEM = 1 # Internal math library is substantially smaller than toolchain one -INTERNAL_LIBM = 1 +INTERNAL_LIBM = 0 # Longints can be implemented as mpz, as longlong, or not LONGINT_IMPL = MPZ @@ -68,16 +68,36 @@ CIRCUITPY_TOUCHIO ?= 1 CIRCUITPY_TOUCHIO_USE_NATIVE = 0 # Features CIRCUITPY_USB = 0 +CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 1 + +else ifeq ($(IDF_TARGET),esp32c6) +# Modules +CIRCUITPY_ALARM = 0 +CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_ESPCAMERA = 0 +CIRCUITPY_ESPULP = 0 +CIRCUITPY_MEMORYMAP = 0 +CIRCUITPY_PARALLELDISPLAY = 0 +CIRCUITPY_TOUCHIO ?= 1 +CIRCUITPY_TOUCHIO_USE_NATIVE = 0 +# Features +CIRCUITPY_USB = 0 +CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 1 else ifeq ($(IDF_TARGET),esp32s2) # Modules CIRCUITPY_BLEIO = 0 CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION = 0 +CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 0 + else ifeq ($(IDF_TARGET),esp32s3) # Modules CIRCUITPY_PARALLELDISPLAY = 0 CIRCUITPY_RGBMATRIX_USES_SUPERVISOR_ALLOCATION = 0 + +CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 0 + endif # No room for dualbank on boards with 2MB flash diff --git a/ports/espressif/mphalport.c b/ports/espressif/mphalport.c index 76d2c05cc3..0342c56c11 100644 --- a/ports/espressif/mphalport.c +++ b/ports/espressif/mphalport.c @@ -32,10 +32,16 @@ #include "components/esp_rom/include/esp32/rom/ets_sys.h" #elif defined(CONFIG_IDF_TARGET_ESP32C3) #include "components/esp_rom/include/esp32c3/rom/ets_sys.h" +#elif defined(CONFIG_IDF_TARGET_ESP32C6) +#include "components/esp_rom/include/esp32c6/rom/ets_sys.h" +#elif defined(CONFIG_IDF_TARGET_ESP32H2) +#include "components/esp_rom/include/esp32h2/rom/ets_sys.h" #elif defined(CONFIG_IDF_TARGET_ESP32S2) #include "components/esp_rom/include/esp32s2/rom/ets_sys.h" #elif defined(CONFIG_IDF_TARGET_ESP32S3) #include "components/esp_rom/include/esp32s3/rom/ets_sys.h" +#else +#error Unknown CONFIG_IDF_TARGET_xxx #endif void mp_hal_delay_us(mp_uint_t delay) { @@ -43,7 +49,7 @@ void mp_hal_delay_us(mp_uint_t delay) { } // This is provided by the esp-idf/components/xtensa/esp32s2/libhal.a binary blob. -#ifndef CONFIG_IDF_TARGET_ESP32C3 +#ifndef CONFIG_IDF_TARGET_ARCH_RISCV extern void xthal_window_spill(void); #endif @@ -61,7 +67,7 @@ mp_uint_t cpu_get_regs_and_sp(mp_uint_t *regs) { // there is a HAL call to do it. There is a bit of a race condition here // because the register value could change after it's been restored but that // is unlikely to happen with a heap pointer while we do a GC. - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #ifndef CONFIG_IDF_TARGET_ARCH_RISCV xthal_window_spill(); #endif return (mp_uint_t)__builtin_frame_address(0); diff --git a/ports/espressif/peripherals/esp32c6/pins.c b/ports/espressif/peripherals/esp32c6/pins.c new file mode 100644 index 0000000000..51f68777c6 --- /dev/null +++ b/ports/espressif/peripherals/esp32c6/pins.c @@ -0,0 +1,59 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 microDev + * + * 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 "peripherals/pins.h" + +const mcu_pin_obj_t pin_GPIO0 = PIN(0, ADC_UNIT_1, ADC_CHANNEL_0, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO1 = PIN(1, ADC_UNIT_1, ADC_CHANNEL_1, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO2 = PIN(2, ADC_UNIT_1, ADC_CHANNEL_2, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO3 = PIN(3, ADC_UNIT_1, ADC_CHANNEL_3, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO4 = PIN(4, ADC_UNIT_1, ADC_CHANNEL_4, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO5 = PIN(5, ADC_UNIT_1, ADC_CHANNEL_5, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO6 = PIN(6, ADC_UNIT_1, ADC_CHANNEL_6, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO7 = PIN(7, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO8 = PIN(8, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO9 = PIN(9, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO10 = PIN(10, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO11 = PIN(11, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO12 = PIN(12, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO13 = PIN(13, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO14 = PIN(14, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO15 = PIN(15, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO16 = PIN(16, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO17 = PIN(17, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO18 = PIN(18, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO19 = PIN(19, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO20 = PIN(20, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO21 = PIN(21, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO22 = PIN(22, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO23 = PIN(23, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO24 = PIN(24, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO25 = PIN(25, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO26 = PIN(26, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO27 = PIN(27, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO28 = PIN(28, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO29 = PIN(29, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO30 = PIN(30, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); diff --git a/ports/espressif/peripherals/esp32c6/pins.h b/ports/espressif/peripherals/esp32c6/pins.h new file mode 100644 index 0000000000..4c2b4390e7 --- /dev/null +++ b/ports/espressif/peripherals/esp32c6/pins.h @@ -0,0 +1,94 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 Scott Shawcroft for Adafruit Industries LLC + * + * 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. + */ + +// DO NOT include this file directly. +// Use shared-bindings/microcontroller/Pin.h instead. +// This ensures that all necessary includes are already included. + +#pragma once + +#define GPIO0_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO0; +#define GPIO1_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO1; +#define GPIO2_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO2; +#define GPIO3_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO3; +#define GPIO4_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO4; +#define GPIO5_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO5; +#define GPIO6_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO6; +#define GPIO7_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO7; +#define GPIO8_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO8; +#define GPIO9_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO9; +#define GPIO10_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO10; +#define GPIO11_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO11; +#define GPIO12_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO12; +#define GPIO13_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO13; +#define GPIO14_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO14; +#define GPIO15_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO15; +#define GPIO16_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO16; +#define GPIO17_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO17; +#define GPIO18_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO18; +#define GPIO19_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO19; +#define GPIO20_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO20; +#define GPIO21_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO21; +#define GPIO22_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO22; +#define GPIO23_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO23; +#define GPIO24_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO24; +#define GPIO25_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO25; +#define GPIO26_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO26; +#define GPIO27_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO27; +#define GPIO28_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO28; +#define GPIO29_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO29; +#define GPIO30_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO30; diff --git a/ports/espressif/peripherals/pins.h b/ports/espressif/peripherals/pins.h index 911e5f271b..e5a6539f61 100644 --- a/ports/espressif/peripherals/pins.h +++ b/ports/espressif/peripherals/pins.h @@ -69,6 +69,10 @@ extern const mp_obj_type_t mcu_pin_type; #include "esp32/pins.h" #elif defined(CONFIG_IDF_TARGET_ESP32C3) #include "esp32c3/pins.h" +#elif defined(CONFIG_IDF_TARGET_ESP32C6) +#include "esp32c6/pins.h" +#elif defined(CONFIG_IDF_TARGET_ESP32H2) +#include "esp32h2/pins.h" #elif defined(CONFIG_IDF_TARGET_ESP32S2) #include "esp32s2/pins.h" #elif defined(CONFIG_IDF_TARGET_ESP32S3) diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index 462cf9e361..09f90b506d 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -87,7 +87,13 @@ #endif #include "soc/efuse_reg.h" +#if defined(CONFIG_IDF_TARGET_ESP3H2) || defined(CONFIG_IDF_TARGET_ESP32C6) +#include "soc/lp_aon_reg.h" +#define CP_SAVED_WORD_REGISTER LP_AON_STORE0_REG +#else #include "soc/rtc_cntl_reg.h" +#define CP_SAVED_WORD_REGISTER RTC_CNTL_STORE0_REG +#endif #include "soc/spi_pins.h" #include "bootloader_flash_config.h" @@ -451,7 +457,7 @@ void reset_to_bootloader(void) { } void reset_cpu(void) { - #ifndef CONFIG_IDF_TARGET_ESP32C3 + #ifndef CONFIG_IDF_TARGET_ARCH_RISCV esp_backtrace_print(100); #endif esp_restart(); @@ -491,13 +497,12 @@ bool port_has_fixed_stack(void) { return true; } -// Place the word to save just after our BSS section that gets blanked. void port_set_saved_word(uint32_t value) { - REG_WRITE(RTC_CNTL_STORE0_REG, value); + REG_WRITE(CP_SAVED_WORD_REGISTER, value); } uint32_t port_get_saved_word(void) { - return REG_READ(RTC_CNTL_STORE0_REG); + return REG_READ(CP_SAVED_WORD_REGISTER); } uint64_t port_get_raw_ticks(uint8_t *subticks) { diff --git a/ports/espressif/tools/build_memory_info.py b/ports/espressif/tools/build_memory_info.py index bbcd3d2df7..04ed04331a 100644 --- a/ports/espressif/tools/build_memory_info.py +++ b/ports/espressif/tools/build_memory_info.py @@ -38,12 +38,27 @@ internal_memory = { ("Internal SRAM 1", (0x3FC8_0000, 0x4037_8000), 416 * 1024), ("Internal SRAM 2", (0x3FCF_0000,), 64 * 1024), ], + "esp32c2": [ + # Name, Start, Length + ("Internal SRAM 0", (0x4037_C000,), 16 * 1024), + ("Internal SRAM 1", (0x3FCA_0000, 0x4038_0000), 256 * 1024), + ], "esp32c3": [ # Name, Start, Length ("RTC Fast Memory", (0x5000_0000,), 8 * 1024), ("Internal SRAM 0", (0x4037_C000,), 16 * 1024), ("Internal SRAM 1", (0x3FC8_0000, 0x4038_0000), 384 * 1024), ], + "esp32c6": [ + # Name, Start, Length + ("LP SRAM", (0x5000_0000,), 16 * 1024), + ("HP SRAM", (0x4080_0000,), 512 * 1024), + ], + "esp32h2": [ + # Name, Start, Length + ("LP SRAM", (0x5000_0000,), 4 * 1024), + ("HP SRAM", (0x4080_0000,), 320 * 1024), + ], } diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index 42500412e0..3c247d67c8 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -173,7 +173,7 @@ def update(debug, board, update_all): if key == "IDF_TARGET": target = value if uf2_bootloader is None: - uf2_bootloader = target not in ("esp32", "esp32c3") + uf2_bootloader = target not in ("esp32", "esp32c3", "esp32c6", "esp32h2") elif key == "CIRCUITPY_ESP_FLASH_SIZE": flash_size = value elif key == "CIRCUITPY_ESP_FLASH_MODE": diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index c400707ac1..e15383cc5f 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -243,6 +243,9 @@ CFLAGS += -DCIRCUITPY_ESPNOW=$(CIRCUITPY_ESPNOW) CIRCUITPY_ESPULP ?= 0 CFLAGS += -DCIRCUITPY_ESPULP=$(CIRCUITPY_ESPULP) +CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 0 +CFLAGS += -DCIRCUITPY_ESP_USB_SERIAL_JTAG=$(CIRCUITPY_ESP_USB_SERIAL_JTAG) + CIRCUITPY_ESPCAMERA ?= 0 CFLAGS += -DCIRCUITPY_ESPCAMERA=$(CIRCUITPY_ESPCAMERA) diff --git a/py/makeqstrdefs.py b/py/makeqstrdefs.py index adf6195389..178149c688 100644 --- a/py/makeqstrdefs.py +++ b/py/makeqstrdefs.py @@ -94,7 +94,10 @@ def preprocess(): def pp(flags): def run(files): - return subprocess.check_output(args.pp + flags + files) + completed = subprocess.run(args.pp + flags + files, stdout=subprocess.PIPE) + if completed.returncode != 0: + raise RuntimeError() + return completed.stdout return run From 39192cc896d09cb72794bdf5d81726a8a6bfb520 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 20 Sep 2023 11:20:11 -0700 Subject: [PATCH 1707/1712] C6 works --- ports/espressif/Makefile | 2 +- ports/espressif/esp-idf-config/sdkconfig.defaults | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 4e2953b495..4488a334fd 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -182,7 +182,7 @@ endif ifeq ($(IDF_TARGET_ARCH),xtensa) CFLAGS += -mlongcalls else ifeq ($(IDF_TARGET_ARCH),riscv) -CFLAGS += -march=rv32imc +CFLAGS += -march=rv32imac_zicsr_zifencei endif LDFLAGS = $(CFLAGS) -Wl,-nostdlib -Wl,-Map=$@.map -Wl,-cref -Wl,--undefined=uxTopUsedPriority diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index d613b0f785..93d771e1aa 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -27,6 +27,12 @@ CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN=y # end of Driver Configurations +# +# PHY +# +# CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE is not set +# end of PHY + # # ESP System Settings # From 6649b17fb5b98efed97e9234c670bb16cdf6cac3 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 21 Sep 2023 10:58:53 -0700 Subject: [PATCH 1708/1712] H2 works --- ports/espressif/Makefile | 18 ++++- .../mpconfigboard.mk | 4 ++ .../mpconfigboard.mk | 2 + .../espressif_esp32h2_devkitm_1_n4/board.c | 29 ++++++++ .../mpconfigboard.h | 37 ++++++++++ .../mpconfigboard.mk | 10 +++ .../espressif_esp32h2_devkitm_1_n4/pins.c | 62 ++++++++++++++++ .../espressif_esp32h2_devkitm_1_n4/sdkconfig | 16 +++++ .../common-hal/analogbufio/BufferedIn.c | 2 +- ports/espressif/common-hal/canio/Listener.c | 2 +- .../common-hal/microcontroller/Pin.c | 29 +++++++- .../common-hal/microcontroller/Processor.c | 4 ++ .../common-hal/microcontroller/__init__.c | 8 +-- .../esp-idf-config/sdkconfig-esp32h2.defaults | 66 +++++++++++++++++ .../sdkconfig-flash-48m.defaults | 14 ++++ ports/espressif/mpconfigport.mk | 19 +++++ ports/espressif/peripherals/esp32h2/pins.c | 47 +++++++++++++ ports/espressif/peripherals/esp32h2/pins.h | 70 +++++++++++++++++++ ports/espressif/supervisor/port.c | 2 +- 19 files changed, 430 insertions(+), 11 deletions(-) create mode 100644 ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/board.c create mode 100644 ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/mpconfigboard.h create mode 100644 ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/mpconfigboard.mk create mode 100644 ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/pins.c create mode 100644 ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/sdkconfig create mode 100644 ports/espressif/esp-idf-config/sdkconfig-esp32h2.defaults create mode 100644 ports/espressif/esp-idf-config/sdkconfig-flash-48m.defaults create mode 100644 ports/espressif/peripherals/esp32h2/pins.c create mode 100644 ports/espressif/peripherals/esp32h2/pins.h diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 4488a334fd..80f3b18497 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -30,6 +30,9 @@ CROSS_COMPILE = riscv32-esp-elf- else ifeq ($(IDF_TARGET),esp32c6) IDF_TARGET_ARCH = riscv CROSS_COMPILE = riscv32-esp-elf- +else ifeq ($(IDF_TARGET),esp32h2) +IDF_TARGET_ARCH = riscv +CROSS_COMPILE = riscv32-esp-elf- else IDF_TARGET_ARCH = xtensa CROSS_COMPILE = xtensa-$(IDF_TARGET)-elf- @@ -221,6 +224,11 @@ LDFLAGS += \ -Tesp32c6.rom.coexist.ld \ -Tesp32c6.rom.heap.ld \ -Tesp32c6.rom.wdt.ld +else ifeq ($(IDF_TARGET),esp32h2) +LDFLAGS += \ + -Tesp32h2.rom.heap.ld \ + -Tesp32h2.rom.newlib.ld \ + -Tesp32h2.rom.wdt.ld else ifeq ($(IDF_TARGET),esp32s2) LDFLAGS += \ -T$(IDF_TARGET).rom.newlib-data.ld \ @@ -445,12 +453,18 @@ update-board-sdkconfig: $(BUILD)/esp-idf/config/sdkconfig.h python tools/update_sdkconfig.py --board=$(BOARD) --debug=$(DEBUG) BINARY_WIFI_BLOBS = libcore.a libespnow.a libmesh.a libnet80211.a libpp.a libsmartconfig.a libwapi.a -BINARY_BLOBS = esp-idf/components/esp_coex/lib/$(IDF_TARGET)/libcoexist.a esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS)) +BINARY_BLOBS = esp-idf/components/esp_phy/lib/$(IDF_TARGET)/libphy.a +ifneq ($(CIRCUITPY_WIFI),0) + BINARY_BLOBS += esp-idf/components/esp_coex/lib/$(IDF_TARGET)/libcoexist.a $(addprefix esp-idf/components/esp_wifi/lib/$(IDF_TARGET)/, $(BINARY_WIFI_BLOBS)) +endif ifeq ($(IDF_TARGET),esp32) BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/librtc.a endif -ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc esp_app_format esp_coex esp_common esp_event esp_hw_support esp_mm esp_netif esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant +ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc esp_app_format esp_common esp_event esp_hw_support esp_mm esp_partition esp_phy esp_pm esp_ringbuf esp_rom esp_system esp_timer freertos hal heap log newlib nvs_flash pthread soc spi_flash vfs +ifneq ($(CIRCUITPY_WIFI),0) + ESP_IDF_COMPONENTS_LINK += esp_coex esp_netif esp-tls esp_wifi lwip mbedtls mdns wpa_supplicant +endif ifneq ($(CIRCUITPY_BLEIO),0) BLE_IMPL_esp32 := esp32 BLE_IMPL_esp32s3 := esp32c3 diff --git a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.mk index a67c8e38e4..c3e0b6001d 100644 --- a/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32c3_devkitm_1_n4/mpconfigboard.mk @@ -6,3 +6,7 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 0 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.mk index 75e097afa8..3588556427 100644 --- a/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.mk @@ -6,3 +6,5 @@ IDF_TARGET = esp32c6 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/board.c b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/board.c new file mode 100644 index 0000000000..f749ee60d2 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/board.c @@ -0,0 +1,29 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 microDev + * + * 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" + +// Use the MP_WEAK supervisor/shared/board.c versions of routines not defined here. diff --git a/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/mpconfigboard.h b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/mpconfigboard.h new file mode 100644 index 0000000000..1536f4296d --- /dev/null +++ b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/mpconfigboard.h @@ -0,0 +1,37 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 microDev + * + * 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. + */ + +// Board setup +#define MICROPY_HW_BOARD_NAME "ESP32-H2-DevKitM-1" +#define MICROPY_HW_MCU_NAME "ESP32-H2N4" + +// Status LED +#define MICROPY_HW_NEOPIXEL (&pin_GPIO8) +#define MICROPY_HW_NEOPIXEL_COUNT (1) + +// Default bus pins +#define DEFAULT_UART_BUS_RX (&pin_GPIO23) +#define DEFAULT_UART_BUS_TX (&pin_GPIO24) diff --git a/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/mpconfigboard.mk new file mode 100644 index 0000000000..a4398b4918 --- /dev/null +++ b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/mpconfigboard.mk @@ -0,0 +1,10 @@ +CIRCUITPY_CREATOR_ID = 0x000C303A +CIRCUITPY_CREATION_ID = 0x01420001 + +IDF_TARGET = esp32h2 + +CIRCUITPY_ESP_FLASH_MODE = qio +CIRCUITPY_ESP_FLASH_FREQ = 48m +CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/pins.c b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/pins.c new file mode 100644 index 0000000000..466962a34f --- /dev/null +++ b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/pins.c @@ -0,0 +1,62 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 microDev + * + * 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 "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS + + { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) }, + { MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) }, + { MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_IO22), MP_ROM_PTR(&pin_GPIO22) }, + + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO23) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO24) }, + + { MP_ROM_QSTR(MP_QSTR_IO25), MP_ROM_PTR(&pin_GPIO25) }, + + { MP_ROM_QSTR(MP_QSTR_MTMS), MP_ROM_PTR(&pin_GPIO2) }, + { MP_ROM_QSTR(MP_QSTR_MTDO), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_MTCK), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_MTDI), MP_ROM_PTR(&pin_GPIO5) }, + + { MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/sdkconfig b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/sdkconfig new file mode 100644 index 0000000000..1fb757bf0f --- /dev/null +++ b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/sdkconfig @@ -0,0 +1,16 @@ +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# ESP System Settings +# +CONFIG_ESP_CONSOLE_SECONDARY_NONE=y +# CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG is not set +# end of ESP System Settings + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/common-hal/analogbufio/BufferedIn.c b/ports/espressif/common-hal/analogbufio/BufferedIn.c index 567c10c963..fb517b3623 100644 --- a/ports/espressif/common-hal/analogbufio/BufferedIn.c +++ b/ports/espressif/common-hal/analogbufio/BufferedIn.c @@ -208,7 +208,7 @@ void common_hal_analogbufio_bufferedin_deinit(analogbufio_bufferedin_obj_t *self static bool check_valid_data(const adc_digi_output_data_t *data, const mcu_pin_obj_t *pin, adc_digi_convert_mode_t convert_mode, adc_digi_output_format_t output_format) { unsigned int unit; - #if CONFIG_IDF_TARGET_ESP32C6 || CONFIG_IDF_TARGET_ESP32H2 + #if SOC_ADC_PERIPH_NUM == 1 unit = 0; #else unit = data->type2.unit; diff --git a/ports/espressif/common-hal/canio/Listener.c b/ports/espressif/common-hal/canio/Listener.c index c884bd46a1..2bf385b3dd 100644 --- a/ports/espressif/common-hal/canio/Listener.c +++ b/ports/espressif/common-hal/canio/Listener.c @@ -39,7 +39,7 @@ #include "hal/twai_ll.h" -#if SOC_TWAI_CONTROLLER_NUM > 1 +#if SOC_TWAI_CONTROLLER_NUM > 1 || !defined(TWAI) #define TWAI TWAI0 #endif diff --git a/ports/espressif/common-hal/microcontroller/Pin.c b/ports/espressif/common-hal/microcontroller/Pin.c index a3226415b2..5c2724e103 100644 --- a/ports/espressif/common-hal/microcontroller/Pin.c +++ b/ports/espressif/common-hal/microcontroller/Pin.c @@ -150,6 +150,31 @@ static const uint64_t pin_mask_reset_forbidden = #endif #endif // ESP32C6 + #if defined(CONFIG_IDF_TARGET_ESP32H2) + // Never ever reset pins used to communicate with the in-package SPI flash. + GPIO_SEL_15 | + GPIO_SEL_16 | + GPIO_SEL_17 | + GPIO_SEL_18 | + GPIO_SEL_19 | + GPIO_SEL_20 | + GPIO_SEL_21 | + // It isn't clear what these are used for but they aren't broken out for + // user use. + GPIO_SEL_6 | + GPIO_SEL_7 | + #if CIRCUITPY_ESP_USB_SERIAL_JTAG + // Never ever reset serial/JTAG communication pins. + GPIO_SEL_26 | // USB D- + GPIO_SEL_27 | // USB D+ + #endif + #if defined(CONFIG_ESP_CONSOLE_UART_DEFAULT) && CONFIG_ESP_CONSOLE_UART_DEFAULT && CONFIG_ESP_CONSOLE_UART_NUM == 0 + // Never reset debug UART/console pins. + GPIO_SEL_23 | + GPIO_SEL_24 | + #endif + #endif // ESP32C6 + #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) // Never ever reset pins used to communicate with SPI flash and PSRAM. GPIO_SEL_19 | // USB D- @@ -278,7 +303,7 @@ void preserve_pin_number(gpio_num_t pin_number) { _preserved_pin_mask |= PIN_BIT(pin_number); } if (_preserved_pin_mask) { - #if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP + #if defined(SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP) && !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP // Allow pin holds to work during deep sleep. This increases power consumption noticeably // during deep sleep, so enable holds only if we actually are holding some pins. // 270uA or so extra current is consumed even with no pins held. @@ -327,7 +352,7 @@ void common_hal_reset_pin(const mcu_pin_obj_t *pin) { void reset_all_pins(void) { // Undo deep sleep holds in case we woke up from deep sleep. // We still need to unhold individual pins, which is done by _reset_pin. - #if !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP + #if defined(SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP) && !SOC_GPIO_SUPPORT_HOLD_SINGLE_IO_IN_DSLP gpio_deep_sleep_hold_dis(); #endif diff --git a/ports/espressif/common-hal/microcontroller/Processor.c b/ports/espressif/common-hal/microcontroller/Processor.c index 7112937ab1..4248a972f4 100644 --- a/ports/espressif/common-hal/microcontroller/Processor.c +++ b/ports/espressif/common-hal/microcontroller/Processor.c @@ -80,6 +80,8 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { #if defined(CONFIG_IDF_TARGET_ESP32) uint32_t mac_address_part = REG_READ(EFUSE_BLK0_RDATA1_REG); + #elif defined(CONFIG_IDF_TARGET_ESP32H2) + uint32_t mac_address_part = REG_READ(EFUSE_RD_MAC_SYS_0_REG); #else uint32_t mac_address_part = REG_READ(EFUSE_RD_MAC_SPI_SYS_0_REG); #endif @@ -95,6 +97,8 @@ void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) { // and 16 in the high order word #if defined(CONFIG_IDF_TARGET_ESP32) mac_address_part = REG_READ(EFUSE_BLK0_RDATA2_REG); + #elif defined(CONFIG_IDF_TARGET_ESP32H2) + mac_address_part = REG_READ(EFUSE_RD_MAC_SYS_1_REG); #else mac_address_part = REG_READ(EFUSE_RD_MAC_SPI_SYS_1_REG); #endif diff --git a/ports/espressif/common-hal/microcontroller/__init__.c b/ports/espressif/common-hal/microcontroller/__init__.c index 6ef1d77764..470bebae58 100644 --- a/ports/espressif/common-hal/microcontroller/__init__.c +++ b/ports/espressif/common-hal/microcontroller/__init__.c @@ -63,7 +63,7 @@ #include "esp32s3/rom/rtc.h" #include "esp32s3/rom/usb/usb_persist.h" #include "esp32s3/rom/usb/chip_usb_dw_wrapper.h" -#elif defined(CONFIG_IDF_TARGET_ESP32H) +#elif defined(CONFIG_IDF_TARGET_ESP32H2) #include "soc/lp_aon_reg.h" #include "esp32h2/rom/rtc.h" #else @@ -110,13 +110,13 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) REG_WRITE(RTC_RESET_CAUSE_REG, 0); // reset uf2 #endif - #if SOC_LP_AON_SUPPORTED + #ifdef SOC_LP_AON_SUPPORTED REG_WRITE(LP_AON_STORE0_REG, 0); // reset safe mode #else REG_WRITE(RTC_CNTL_STORE0_REG, 0); // reset safe mode #endif #if !defined(CONFIG_IDF_TARGET_ESP32) - #if SOC_LP_AON_SUPPORTED + #ifdef SOC_LP_AON_SUPPORTED REG_WRITE(LP_AON_SYS_CFG_REG, 0); // reset bootloader #else REG_WRITE(RTC_CNTL_OPTION1_REG, 0); // reset bootloader @@ -135,7 +135,7 @@ void common_hal_mcu_on_next_reset(mcu_runmode_t runmode) { #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) chip_usb_set_persist_flags(USBDC_BOOT_DFU); #endif - #if SOC_LP_AON_SUPPORTED + #ifdef SOC_LP_AON_SUPPORTED REG_WRITE(LP_AON_SYS_CFG_REG, LP_AON_FORCE_DOWNLOAD_BOOT); #else REG_WRITE(RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT); diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32h2.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32h2.defaults new file mode 100644 index 0000000000..02516de4e4 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32h2.defaults @@ -0,0 +1,66 @@ +# +# Espressif IoT Development Framework Configuration +# +# +# Component config +# +# +# Bluetooth +# +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y +# +# NimBLE Options +# +CONFIG_BT_NIMBLE_LOG_LEVEL_NONE=y +CONFIG_BT_NIMBLE_NVS_PERSIST=y +# +# Memory Settings +# +CONFIG_BT_NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT=20 +CONFIG_BT_NIMBLE_TRANSPORT_EVT_SIZE=70 +# end of Memory Settings + +CONFIG_BT_NIMBLE_EXT_ADV=y +# end of NimBLE Options + +# end of Bluetooth + +# +# Driver Configurations +# +# +# PCNT Configuration +# +CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN=y +# end of PCNT Configuration + +# +# RMT Configuration +# +CONFIG_RMT_SUPPRESS_DEPRECATE_WARN=y +# end of RMT Configuration + +# +# I2S Configuration +# +CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y +# end of I2S Configuration + +# end of Driver Configurations + +# +# PHY +# +CONFIG_ESP_PHY_ENABLE_USB=y +# end of PHY + +# +# Wi-Fi +# +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=4 +# end of Wi-Fi + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-flash-48m.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-48m.defaults new file mode 100644 index 0000000000..b710fd2255 --- /dev/null +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-48m.defaults @@ -0,0 +1,14 @@ +# CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_64M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_60M is not set +CONFIG_ESPTOOLPY_FLASHFREQ_48M=y +# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_32M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_30M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_24M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_16M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_15M is not set +CONFIG_ESPTOOLPY_FLASHFREQ_48M_DEFAULT=y diff --git a/ports/espressif/mpconfigport.mk b/ports/espressif/mpconfigport.mk index bc5a0533ff..e537ba3ed4 100644 --- a/ports/espressif/mpconfigport.mk +++ b/ports/espressif/mpconfigport.mk @@ -84,6 +84,25 @@ CIRCUITPY_TOUCHIO_USE_NATIVE = 0 CIRCUITPY_USB = 0 CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 1 +else ifeq ($(IDF_TARGET),esp32h2) +# Modules +CIRCUITPY_ALARM = 0 +# Turn off analogio because calibration is currently supported. +# https://github.com/espressif/esp-idf/issues/11038 +CIRCUITPY_ANALOGIO = 0 +CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_ESPCAMERA = 0 +CIRCUITPY_ESPULP = 0 +CIRCUITPY_MEMORYMAP = 0 +CIRCUITPY_PARALLELDISPLAY = 0 +CIRCUITPY_RGBMATRIX = 0 +CIRCUITPY_TOUCHIO ?= 1 +CIRCUITPY_TOUCHIO_USE_NATIVE = 0 +# Features +CIRCUITPY_USB = 0 +CIRCUITPY_ESP_USB_SERIAL_JTAG ?= 1 +CIRCUITPY_WIFI = 0 + else ifeq ($(IDF_TARGET),esp32s2) # Modules CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/peripherals/esp32h2/pins.c b/ports/espressif/peripherals/esp32h2/pins.c new file mode 100644 index 0000000000..a085ca09ae --- /dev/null +++ b/ports/espressif/peripherals/esp32h2/pins.c @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2021 microDev + * + * 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 "peripherals/pins.h" + +const mcu_pin_obj_t pin_GPIO0 = PIN(0, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO1 = PIN(1, ADC_UNIT_1, ADC_CHANNEL_0, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO2 = PIN(2, ADC_UNIT_1, ADC_CHANNEL_1, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO3 = PIN(3, ADC_UNIT_1, ADC_CHANNEL_2, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO4 = PIN(4, ADC_UNIT_1, ADC_CHANNEL_3, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO5 = PIN(5, ADC_UNIT_1, ADC_CHANNEL_4, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO8 = PIN(8, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO9 = PIN(9, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO10 = PIN(10, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO11 = PIN(11, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO12 = PIN(12, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO13 = PIN(13, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO14 = PIN(14, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO22 = PIN(22, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO23 = PIN(23, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO24 = PIN(24, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO25 = PIN(25, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO26 = PIN(26, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); +const mcu_pin_obj_t pin_GPIO27 = PIN(27, NO_ADC, NO_ADC_CHANNEL, NO_TOUCH_CHANNEL); diff --git a/ports/espressif/peripherals/esp32h2/pins.h b/ports/espressif/peripherals/esp32h2/pins.h new file mode 100644 index 0000000000..7d781ff733 --- /dev/null +++ b/ports/espressif/peripherals/esp32h2/pins.h @@ -0,0 +1,70 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2023 Scott Shawcroft for Adafruit Industries LLC + * + * 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. + */ + +// DO NOT include this file directly. +// Use shared-bindings/microcontroller/Pin.h instead. +// This ensures that all necessary includes are already included. + +#pragma once + +#define GPIO0_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO0; +#define GPIO1_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO1; +#define GPIO2_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO2; +#define GPIO3_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO3; +#define GPIO4_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO4; +#define GPIO5_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO5; +#define GPIO8_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO8; +#define GPIO9_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO9; +#define GPIO10_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO10; +#define GPIO11_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO11; +#define GPIO12_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO12; +#define GPIO13_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO13; +#define GPIO14_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO14; +#define GPIO22_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO22; +#define GPIO23_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO23; +#define GPIO24_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO24; +#define GPIO25_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO25; +#define GPIO26_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO26; +#define GPIO27_EXISTS 1 +extern const mcu_pin_obj_t pin_GPIO27; diff --git a/ports/espressif/supervisor/port.c b/ports/espressif/supervisor/port.c index 09f90b506d..609096cc3f 100644 --- a/ports/espressif/supervisor/port.c +++ b/ports/espressif/supervisor/port.c @@ -87,7 +87,7 @@ #endif #include "soc/efuse_reg.h" -#if defined(CONFIG_IDF_TARGET_ESP3H2) || defined(CONFIG_IDF_TARGET_ESP32C6) +#if defined(SOC_LP_AON_SUPPORTED) #include "soc/lp_aon_reg.h" #define CP_SAVED_WORD_REGISTER LP_AON_STORE0_REG #else From 16d1dc2be07ee7f35079515b081dd817319ab311 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 21 Sep 2023 13:52:47 -0700 Subject: [PATCH 1709/1712] Update all target sdkconfig --- ports/espressif/Makefile | 1 + .../boards/adafruit_feather_esp32_v2/board.c | 2 +- .../adafruit_qualia_s3_rgb666/sdkconfig | 1 - .../boards/espressif_esp32s3_lcd_ev/sdkconfig | 53 +++++------- .../espressif/common-hal/alarm/SleepMemory.h | 6 +- .../espressif/common-hal/analogio/AnalogIn.c | 4 +- .../espressif/common-hal/analogio/AnalogOut.c | 58 +++++++------ .../espressif/common-hal/analogio/AnalogOut.h | 7 +- ports/espressif/common-hal/canio/Listener.c | 2 +- .../esp-idf-config/sdkconfig-debug.defaults | 86 ++----------------- .../esp-idf-config/sdkconfig-esp32.defaults | 2 - .../esp-idf-config/sdkconfig-esp32c3.defaults | 9 +- .../esp-idf-config/sdkconfig-esp32s2.defaults | 9 +- .../esp-idf-config/sdkconfig-esp32s3.defaults | 11 +-- .../sdkconfig-flash-40m.defaults | 4 + .../esp-idf-config/sdkconfig-psram.defaults | 6 ++ .../esp-idf-config/sdkconfig.defaults | 3 +- ports/espressif/tools/update_sdkconfig.py | 33 +++++-- tools/ci_check_duplicate_usb_vid_pid.py | 4 +- 19 files changed, 127 insertions(+), 174 deletions(-) diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 80f3b18497..c9c29ce2f7 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -77,6 +77,7 @@ INC += \ -isystem esp-idf/components/bt/host/nimble/port/include \ -isystem esp-idf/components/driver/include \ -isystem esp-idf/components/driver/deprecated \ + -isystem esp-idf/components/driver/dac/include \ -isystem esp-idf/components/driver/gpio/include \ -isystem esp-idf/components/driver/i2c/include \ -isystem esp-idf/components/driver/i2s/include \ diff --git a/ports/espressif/boards/adafruit_feather_esp32_v2/board.c b/ports/espressif/boards/adafruit_feather_esp32_v2/board.c index 78341beb3b..02c3cb2ff4 100644 --- a/ports/espressif/boards/adafruit_feather_esp32_v2/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32_v2/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig b/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig index 912dd14b11..8e26f268e7 100644 --- a/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig +++ b/ports/espressif/boards/adafruit_qualia_s3_rgb666/sdkconfig @@ -4,7 +4,6 @@ # # Component config # - # # LWIP # diff --git a/ports/espressif/boards/espressif_esp32s3_lcd_ev/sdkconfig b/ports/espressif/boards/espressif_esp32s3_lcd_ev/sdkconfig index bc1b20063b..ec582be223 100644 --- a/ports/espressif/boards/espressif_esp32s3_lcd_ev/sdkconfig +++ b/ports/espressif/boards/espressif_esp32s3_lcd_ev/sdkconfig @@ -1,41 +1,28 @@ -CONFIG_ESP32S3_SPIRAM_SUPPORT=y # -# SPI RAM config +# Espressif IoT Development Framework Configuration # -# CONFIG_SPIRAM_MODE_QUAD is not set -CONFIG_SPIRAM_MODE_OCT=y -CONFIG_SPIRAM_TYPE_AUTO=y -# end of SPI RAM config +# +# Component config +# +# +# ESP System Settings +# +CONFIG_ESP_CONSOLE_UART_CUSTOM=y +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART=y +CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 +CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +# end of ESP System Settings -CONFIG_DEFAULT_PSRAM_CLK_IO=30 -# -# PSRAM Clock and CS IO for ESP32S3 -# -CONFIG_DEFAULT_PSRAM_CS_IO=26 -# end of PSRAM Clock and CS IO for ESP32S3 - -# CONFIG_SPIRAM_FETCH_INSTRUCTIONS is not set -# CONFIG_SPIRAM_RODATA is not set -CONFIG_SPIRAM_SPEED_80M=y -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -CONFIG_SPIRAM_USE_MEMMAP=y -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -# CONFIG_SPIRAM_USE_MALLOC is not set -CONFIG_SPIRAM_MEMTEST=y # # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="circuitpy" # end of LWIP -# -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y -CONFIG_ESP_CONSOLE_UART_CUSTOM=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_RX_GPIO=44 -CONFIG_ESP_CONSOLE_UART_TX_GPIO=43 -CONFIG_ESP_CONSOLE_UART=y + +# end of Component config + +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/common-hal/alarm/SleepMemory.h b/ports/espressif/common-hal/alarm/SleepMemory.h index 626f748a67..68e9a7d1a6 100644 --- a/ports/espressif/common-hal/alarm/SleepMemory.h +++ b/ports/espressif/common-hal/alarm/SleepMemory.h @@ -41,7 +41,11 @@ // is set. Any memory not allocated by us can be used by the ESP-IDF for heap or other purposes. // Use half of RTC_SLOW_MEM or RTC_FAST_MEM. -#define SLEEP_MEMORY_LENGTH (4096) +#ifdef CONFIG_IDF_TARGET_ESP32 +#define SLEEP_MEMORY_LENGTH (3 * 1024) +#else +#define SLEEP_MEMORY_LENGTH (4 * 1024) +#endif typedef struct { mp_obj_base_t base; diff --git a/ports/espressif/common-hal/analogio/AnalogIn.c b/ports/espressif/common-hal/analogio/AnalogIn.c index 983e2dd754..ea322690f7 100644 --- a/ports/espressif/common-hal/analogio/AnalogIn.c +++ b/ports/espressif/common-hal/analogio/AnalogIn.c @@ -103,7 +103,7 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { adc_cali_scheme_ver_t supported_schemes; adc_cali_check_scheme(&supported_schemes); - adc_cali_scheme_ver_t calibration_scheme; + adc_cali_scheme_ver_t calibration_scheme = 0; adc_cali_handle_t calibration; #if defined(ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED) && ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED @@ -124,7 +124,7 @@ uint16_t common_hal_analogio_analogin_get_value(analogio_analogin_obj_t *self) { .atten = ATTENUATION, .bitwidth = DATA_WIDTH, #ifdef CONFIG_IDF_TARGET_ESP32 - .default_vref = DEFAULT_VREF; + .default_vref = DEFAULT_VREF, #endif }; if (adc_cali_create_scheme_line_fitting(&config, &calibration) == ESP_OK) { diff --git a/ports/espressif/common-hal/analogio/AnalogOut.c b/ports/espressif/common-hal/analogio/AnalogOut.c index 1a1e74391b..d3a3349af6 100644 --- a/ports/espressif/common-hal/analogio/AnalogOut.c +++ b/ports/espressif/common-hal/analogio/AnalogOut.c @@ -35,63 +35,69 @@ #include "shared-bindings/microcontroller/Pin.h" #include "supervisor/shared/translate/translate.h" -#if defined(CONFIG_IDF_TARGET_ESP32) || defined(CONFIG_IDF_TARGET_ESP32S2) -#include "components/driver/include/driver/dac_common.h" -#define HAS_DAC 1 +#ifdef SOC_DAC_SUPPORTED +#include "driver/dac_oneshot.h" + #if defined(CONFIG_IDF_TARGET_ESP32) -#define pin_CHANNEL_1 pin_GPIO25 -#define pin_CHANNEL_2 pin_GPIO26 +#define pin_CHANNEL_0 pin_GPIO25 +#define pin_CHANNEL_1 pin_GPIO26 #elif defined(CONFIG_IDF_TARGET_ESP32S2) -#define pin_CHANNEL_1 pin_GPIO17 -#define pin_CHANNEL_2 pin_GPIO18 +#define pin_CHANNEL_0 pin_GPIO17 +#define pin_CHANNEL_1 pin_GPIO18 #endif -#else -#define HAS_DAC 0 +static dac_oneshot_handle_t _active_handles[SOC_DAC_CHAN_NUM]; #endif + void common_hal_analogio_analogout_construct(analogio_analogout_obj_t *self, const mcu_pin_obj_t *pin) { - #if HAS_DAC - if (pin == &pin_CHANNEL_1) { - self->channel = DAC_CHANNEL_1; - } else if (pin == &pin_CHANNEL_2) { - self->channel = DAC_CHANNEL_2; + #ifdef SOC_DAC_SUPPORTED + if (pin == &pin_CHANNEL_0) { + self->channel = DAC_CHAN_0; + } else if (pin == &pin_CHANNEL_1) { + self->channel = DAC_CHAN_1; } else { raise_ValueError_invalid_pin(); } - dac_output_enable(self->channel); + dac_oneshot_config_t config = { + .chan_id = self->channel + }; + dac_oneshot_new_channel(&config, &self->handle); + _active_handles[self->channel] = self->handle; #else mp_raise_NotImplementedError(NULL); #endif } bool common_hal_analogio_analogout_deinited(analogio_analogout_obj_t *self) { - #if HAS_DAC - return self->channel == DAC_CHANNEL_MAX; + #ifdef SOC_DAC_SUPPORTED + return self->handle == NULL; #else return false; #endif } void common_hal_analogio_analogout_deinit(analogio_analogout_obj_t *self) { - #if HAS_DAC - dac_output_disable(self->channel); - self->channel = DAC_CHANNEL_MAX; + #ifdef SOC_DAC_SUPPORTED + dac_oneshot_del_channel(self->handle); + self->handle = NULL; + _active_handles[self->channel] = NULL; #endif } void common_hal_analogio_analogout_set_value(analogio_analogout_obj_t *self, uint16_t value) { - #if HAS_DAC + #ifdef SOC_DAC_SUPPORTED uint8_t dac_value = (value * 255) / 65535; - dac_output_enable(self->channel); - dac_output_voltage(self->channel, dac_value); + dac_oneshot_output_voltage(self->handle, dac_value); #endif } void analogout_reset(void) { - #if HAS_DAC - dac_output_disable(DAC_CHANNEL_1); - dac_output_disable(DAC_CHANNEL_2); + #ifdef SOC_DAC_SUPPORTED + for (uint8_t c = 0; c < SOC_DAC_CHAN_NUM; c++) { + dac_oneshot_del_channel(_active_handles[c]); + _active_handles[c] = NULL; + } #endif } diff --git a/ports/espressif/common-hal/analogio/AnalogOut.h b/ports/espressif/common-hal/analogio/AnalogOut.h index 085c4e6783..26cdd08675 100644 --- a/ports/espressif/common-hal/analogio/AnalogOut.h +++ b/ports/espressif/common-hal/analogio/AnalogOut.h @@ -30,12 +30,17 @@ #include "common-hal/microcontroller/Pin.h" +#ifdef SOC_DAC_SUPPORTED +#include "esp-idf/components/driver/dac/include/driver/dac_oneshot.h" +#endif #include "py/obj.h" typedef struct { mp_obj_base_t base; - const mcu_pin_obj_t *pin; + #ifdef SOC_DAC_SUPPORTED + dac_oneshot_handle_t handle; uint8_t channel; + #endif } analogio_analogout_obj_t; void analogout_reset(void); diff --git a/ports/espressif/common-hal/canio/Listener.c b/ports/espressif/common-hal/canio/Listener.c index 2bf385b3dd..0df8ee1b8d 100644 --- a/ports/espressif/common-hal/canio/Listener.c +++ b/ports/espressif/common-hal/canio/Listener.c @@ -39,7 +39,7 @@ #include "hal/twai_ll.h" -#if SOC_TWAI_CONTROLLER_NUM > 1 || !defined(TWAI) +#if !defined(TWAI) && defined(TWAI0) #define TWAI TWAI0 #endif diff --git a/ports/espressif/esp-idf-config/sdkconfig-debug.defaults b/ports/espressif/esp-idf-config/sdkconfig-debug.defaults index 69f4d43289..5976192600 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-debug.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-debug.defaults @@ -1,95 +1,21 @@ # -# Bootloader config +# Espressif IoT Development Framework Configuration # -CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set -# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y -# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -# end of Bootloader config - -# CONFIG_COMPILER_OPTIMIZATION_DEFAULT is not set # # Compiler options # CONFIG_COMPILER_OPTIMIZATION_SIZE=y -# CONFIG_COMPILER_OPTIMIZATION_PERF is not set -# CONFIG_COMPILER_OPTIMIZATION_NONE is not set -CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set -# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set -CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 -# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set # end of Compiler options -CONFIG_ESP_ERR_TO_NAME_LOOKUP=y +# +# Component config +# # # ESP System Settings # 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 # end of ESP System Settings -CONFIG_ESP_CONSOLE_UART_DEFAULT=y -# CONFIG_ESP_CONSOLE_USB_CDC is not set -# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART=y -CONFIG_ESP_CONSOLE_MULTIPLE_UART=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -# -# FreeRTOS -# -CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y -CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y -# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set -# CONFIG_FREERTOS_ASSERT_DISABLE is not set -CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y -CONFIG_FREERTOS_DEBUG_OCDAWARE=y -# end of FreeRTOS +# end of Component config -CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y -# -# Hardware Abstraction Layer (HAL) and Low Level (LL) -# -# CONFIG_HAL_ASSERTION_DISABLE is not set -# CONFIG_HAL_ASSERTION_SILENT is not set -# CONFIG_HAL_ASSERTION_ENABLE is not set -CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 -# end of Hardware Abstraction Layer (HAL) and Low Level (LL) - -# -# Log output -# -# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set -# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set -# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_LOG_DEFAULT_LEVEL_INFO=y -# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set -# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set -# end of Log output - -CONFIG_LWIP_ESP_LWIP_ASSERT=y -# -# Deprecated options for backward compatibility -# -CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y -# CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set -CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y -# CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set -# CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set -CONFIG_OPTIMIZATION_ASSERTION_LEVEL=2 -CONFIG_CONSOLE_UART_DEFAULT=y -# CONFIG_CONSOLE_UART_CUSTOM is not set -# CONFIG_ESP_CONSOLE_UART_NONE is not set -CONFIG_CONSOLE_UART_NUM=0 -CONFIG_CONSOLE_UART_BAUDRATE=115200 -# end of Deprecated options for backward compatibility +# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults index 5ae4d4c6b5..9bcb508016 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32.defaults @@ -51,8 +51,6 @@ CONFIG_ESP_IPC_TASK_STACK_SIZE=1536 # # Wi-Fi # -CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y -CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 # CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set # end of Wi-Fi diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults index a41a780e68..ea0223c3e4 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32c3.defaults @@ -17,8 +17,8 @@ CONFIG_BT_NIMBLE_NVS_PERSIST=y # # Memory Settings # -CONFIG_BT_NIMBLE_ACL_BUF_COUNT=20 -CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 +CONFIG_BT_NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT=20 +CONFIG_BT_NIMBLE_TRANSPORT_EVT_SIZE=70 # end of Memory Settings CONFIG_BT_NIMBLE_EXT_ADV=y @@ -52,10 +52,7 @@ CONFIG_I2S_SUPPRESS_DEPRECATE_WARN=y # # Wi-Fi # -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 -# CONFIG_ESP32_WIFI_NVS_ENABLED is not set +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=4 # end of Wi-Fi # diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults index 09c5a69663..232772a4af 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s2.defaults @@ -49,12 +49,9 @@ CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM=y # # Wi-Fi # -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 -CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=8 -CONFIG_ESP32_WIFI_RX_BA_WIN=4 -# CONFIG_ESP32_WIFI_NVS_ENABLED is not set +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=16 +CONFIG_ESP_WIFI_RX_BA_WIN=4 # end of Wi-Fi # diff --git a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults index 2bfd87be1e..7975246ee4 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-esp32s3.defaults @@ -18,8 +18,8 @@ CONFIG_BT_NIMBLE_NVS_PERSIST=y # # Memory Settings # -CONFIG_BT_NIMBLE_ACL_BUF_COUNT=20 -CONFIG_BT_NIMBLE_HCI_EVT_BUF_SIZE=70 +CONFIG_BT_NIMBLE_TRANSPORT_ACL_FROM_LL_COUNT=20 +CONFIG_BT_NIMBLE_TRANSPORT_EVT_SIZE=70 # end of Memory Settings CONFIG_BT_NIMBLE_EXT_ADV=y @@ -79,11 +79,8 @@ CONFIG_ESP_IPC_TASK_STACK_SIZE=1536 # # Wi-Fi # -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=4 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=8 -CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=16 -CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=16 -# CONFIG_ESP32_WIFI_NVS_ENABLED is not set +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=4 +CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=16 # end of Wi-Fi # diff --git a/ports/espressif/esp-idf-config/sdkconfig-flash-40m.defaults b/ports/espressif/esp-idf-config/sdkconfig-flash-40m.defaults index 2900c10879..235a62a57e 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-flash-40m.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-flash-40m.defaults @@ -1,10 +1,14 @@ # CONFIG_ESPTOOLPY_FLASHFREQ_120M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_64M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_60M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_48M is not set CONFIG_ESPTOOLPY_FLASHFREQ_40M=y +# CONFIG_ESPTOOLPY_FLASHFREQ_32M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_30M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_24M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_16M is not set # CONFIG_ESPTOOLPY_FLASHFREQ_15M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT is not set diff --git a/ports/espressif/esp-idf-config/sdkconfig-psram.defaults b/ports/espressif/esp-idf-config/sdkconfig-psram.defaults index f1bc476a9f..0ac0e6c7bc 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-psram.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-psram.defaults @@ -16,6 +16,12 @@ CONFIG_SPIRAM_USE_MEMMAP=y # end of ESP PSRAM +# +# Wi-Fi +# +CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=16 +# end of Wi-Fi + # end of Component config # end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig.defaults b/ports/espressif/esp-idf-config/sdkconfig.defaults index 93d771e1aa..811d35eb51 100644 --- a/ports/espressif/esp-idf-config/sdkconfig.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig.defaults @@ -45,7 +45,7 @@ CONFIG_ESP_MAIN_TASK_STACK_SIZE=16384 # Wi-Fi # CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=8 -CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER_NUM=16 +CONFIG_ESP_WIFI_STATIC_TX_BUFFER=y # CONFIG_ESP_WIFI_NVS_ENABLED is not set # end of Wi-Fi @@ -132,4 +132,5 @@ CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=4096 # end of Component config +CONFIG_IDF_EXPERIMENTAL_FEATURES=y # end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/tools/update_sdkconfig.py b/ports/espressif/tools/update_sdkconfig.py index 3c247d67c8..efae6a4dc1 100644 --- a/ports/espressif/tools/update_sdkconfig.py +++ b/ports/espressif/tools/update_sdkconfig.py @@ -164,6 +164,7 @@ def update(debug, board, update_all): board_make = pathlib.Path(f"boards/{board}/mpconfigboard.mk") psram_size = "0" uf2_bootloader = None + ble_enabled = None for line in board_make.read_text().split("\n"): if "=" not in line or line.startswith("#"): continue @@ -174,6 +175,11 @@ def update(debug, board, update_all): target = value if uf2_bootloader is None: uf2_bootloader = target not in ("esp32", "esp32c3", "esp32c6", "esp32h2") + if ble_enabled is None: + ble_enabled = target not in ( + "esp32", + "esp32s2", + ) # ESP32 is disabled by us. S2 doesn't support it. elif key == "CIRCUITPY_ESP_FLASH_SIZE": flash_size = value elif key == "CIRCUITPY_ESP_FLASH_MODE": @@ -188,6 +194,8 @@ def update(debug, board, update_all): psram_freq = value elif key == "UF2_BOOTLOADER": uf2_bootloader = not (value == "0") + elif key == "CIRCUITPY_BLEIO": + ble_enabled = not (value == "0") os.environ["IDF_TARGET"] = target os.environ[ @@ -232,8 +240,9 @@ def update(debug, board, update_all): sdkconfigs.extend((psram_config, psram_size_config, psram_mode_config, psram_freq_config)) target_config = pathlib.Path(f"esp-idf-config/sdkconfig-{target}.defaults") sdkconfigs.append(target_config) - ble_config = pathlib.Path(f"esp-idf-config/sdkconfig-ble.defaults") - sdkconfigs.append(ble_config) + if ble_enabled: + ble_config = pathlib.Path(f"esp-idf-config/sdkconfig-ble.defaults") + sdkconfigs.append(ble_config) board_config = pathlib.Path(f"boards/{board}/sdkconfig") # Don't include the board file in cp defaults. The board may have custom # overrides. @@ -349,15 +358,29 @@ def update(debug, board, update_all): first = False target_kconfig_snippets.add(loc) target_symbols = target_symbols.union(differing_keys) + + # kconfig settings can be set by others. item.referenced doesn't + # know this. So we collect all things that reference this using + # rev_dep. + all_references = set(item.referenced) + to_unpack = [item.rev_dep] + while to_unpack: + rdep = to_unpack.pop() + if isinstance(rdep, tuple): + to_unpack.extend(rdep) + elif isinstance(rdep, int): + # skip logic + pass + else: + all_references.add(rdep) + all_references.update(rdep.referenced) psram_reference = False - for referenced in item.referenced: + for referenced in all_references: if referenced.name.startswith("IDF_TARGET"): target_reference = True - break if referenced.name in target_symbols: # Implicit target symbols target_reference = True - break if referenced.name == "SPIRAM": psram_reference = True diff --git a/tools/ci_check_duplicate_usb_vid_pid.py b/tools/ci_check_duplicate_usb_vid_pid.py index c311f1fd3a..b8170aa9e3 100644 --- a/tools/ci_check_duplicate_usb_vid_pid.py +++ b/tools/ci_check_duplicate_usb_vid_pid.py @@ -95,7 +95,9 @@ def check_vid_pid(files, clusterlist): if duplicates are found, and lists the duplicates. """ - usb_pattern = re.compile(r"^CIRCUITPY_USB\s*=\s*0$|^IDF_TARGET = (esp32|esp32c3)$", flags=re.M) + usb_pattern = re.compile( + r"^CIRCUITPY_USB\s*=\s*0$|^IDF_TARGET = (esp32|esp32c3|esp32c6|esp32h2)$", flags=re.M + ) usb_ids = defaultdict(set) for board_config in files: From 1480d70d17cd75ffef4daf9b22b87730790a6552 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 21 Sep 2023 16:02:41 -0700 Subject: [PATCH 1710/1712] Fix builds * Disable bleio on C3 with 4MB flash. * Fix gpio include path in board.c's that use it. --- .../boards/01space_lcd042_esp32c3/mpconfigboard.mk | 2 ++ .../espressif/boards/adafruit_feather_esp32s2/board.c | 2 +- .../adafruit_feather_esp32s3_4mbflash_2mbpsram/board.c | 2 +- .../boards/adafruit_feather_esp32s3_nopsram/board.c | 2 +- .../espressif/boards/adafruit_matrixportal_s3/board.c | 2 +- .../espressif/boards/adafruit_qtpy_esp32_pico/board.c | 2 +- .../boards/adafruit_qtpy_esp32c3/mpconfigboard.mk | 2 ++ ports/espressif/boards/ai_thinker_esp32-c3s-2m/board.c | 2 +- ports/espressif/boards/ai_thinker_esp32-c3s/board.c | 2 +- .../boards/ai_thinker_esp32-c3s/mpconfigboard.mk | 2 ++ ports/espressif/boards/arduino_nano_esp32s3/board.c | 10 +--------- .../arduino_nano_esp32s3_inverted_statusled/board.c | 10 +--------- .../espressif/boards/beetle-esp32-c3/mpconfigboard.mk | 2 ++ .../boards/cytron_maker_feather_aiot_s3/board.c | 2 +- ports/espressif/boards/deneyap_kart/board.c | 2 +- ports/espressif/boards/deneyap_kart_1a/board.c | 2 +- ports/espressif/boards/deneyap_kart_g/mpconfigboard.mk | 2 ++ ports/espressif/boards/espressif_esp32_eye/board.c | 2 +- ports/espressif/boards/espressif_esp32_lyrat/board.c | 2 +- ports/espressif/boards/lolin_c3_mini/mpconfigboard.mk | 2 ++ ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk | 2 ++ .../boards/luatos_core_esp32c3/mpconfigboard.mk | 2 ++ .../boards/luatos_core_esp32c3_ch343/mpconfigboard.mk | 2 ++ ports/espressif/boards/m5stack_core2/board.c | 2 +- .../espressif/boards/m5stack_stamp_c3/mpconfigboard.mk | 2 ++ ports/espressif/boards/m5stack_stick_c/board.c | 2 +- ports/espressif/boards/m5stack_stick_c_plus/board.c | 2 +- ports/espressif/boards/m5stack_timer_camera_x/board.c | 2 +- .../boards/microdev_micro_c3/mpconfigboard.mk | 2 ++ .../boards/seeed_xiao_esp32c3/mpconfigboard.mk | 2 ++ .../espressif/boards/unexpectedmaker_tinypico/board.c | 2 +- .../boards/unexpectedmaker_tinypico_nano/board.c | 2 +- ports/espressif/common-hal/canio/Listener.c | 3 ++- 33 files changed, 46 insertions(+), 37 deletions(-) diff --git a/ports/espressif/boards/01space_lcd042_esp32c3/mpconfigboard.mk b/ports/espressif/boards/01space_lcd042_esp32c3/mpconfigboard.mk index e0aee0c478..5f37ab5fac 100644 --- a/ports/espressif/boards/01space_lcd042_esp32c3/mpconfigboard.mk +++ b/ports/espressif/boards/01space_lcd042_esp32c3/mpconfigboard.mk @@ -8,3 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/adafruit_feather_esp32s2/board.c b/ports/espressif/boards/adafruit_feather_esp32s2/board.c index f701d18442..4d64c316e1 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s2/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s2/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/board.c b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/board.c index 983d62a911..ba228d7b12 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/board.c b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/board.c index 983d62a911..ba228d7b12 100644 --- a/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/board.c +++ b/ports/espressif/boards/adafruit_feather_esp32s3_nopsram/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/adafruit_matrixportal_s3/board.c b/ports/espressif/boards/adafruit_matrixportal_s3/board.c index a023845eb0..a5067b98fd 100644 --- a/ports/espressif/boards/adafruit_matrixportal_s3/board.c +++ b/ports/espressif/boards/adafruit_matrixportal_s3/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/adafruit_qtpy_esp32_pico/board.c b/ports/espressif/boards/adafruit_qtpy_esp32_pico/board.c index b714fd41f0..0e4504e8b8 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32_pico/board.c +++ b/ports/espressif/boards/adafruit_qtpy_esp32_pico/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk b/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk index a8b7315c11..df1a53faba 100644 --- a/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk +++ b/ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.mk @@ -8,3 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/board.c b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/board.c index 0118b6d8ea..9e9b34a237 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/board.c +++ b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/board.c @@ -28,7 +28,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "supervisor/board.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "soc/usb_serial_jtag_struct.h" void board_init(void) { diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s/board.c b/ports/espressif/boards/ai_thinker_esp32-c3s/board.c index 0118b6d8ea..9e9b34a237 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s/board.c +++ b/ports/espressif/boards/ai_thinker_esp32-c3s/board.c @@ -28,7 +28,7 @@ #include "shared-bindings/microcontroller/Pin.h" #include "supervisor/board.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "soc/usb_serial_jtag_struct.h" void board_init(void) { diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk index 9bcaa3473a..8bc9948aee 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk +++ b/ports/espressif/boards/ai_thinker_esp32-c3s/mpconfigboard.mk @@ -8,3 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_USB_SERIAL_JTAG = 0 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/arduino_nano_esp32s3/board.c b/ports/espressif/boards/arduino_nano_esp32s3/board.c index 8952a19c5d..58432f9811 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3/board.c +++ b/ports/espressif/boards/arduino_nano_esp32s3/board.c @@ -27,15 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} +#include "components/driver/gpio/include/driver/gpio.h" bool espressif_board_reset_pin_number(gpio_num_t pin_number) { if (pin_number == 13) { diff --git a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c index 8952a19c5d..58432f9811 100644 --- a/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c +++ b/ports/espressif/boards/arduino_nano_esp32s3_inverted_statusled/board.c @@ -27,15 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" - -void board_init(void) { - // Debug UART - #ifdef DEBUG - common_hal_never_reset_pin(&pin_GPIO43); - common_hal_never_reset_pin(&pin_GPIO44); - #endif -} +#include "components/driver/gpio/include/driver/gpio.h" bool espressif_board_reset_pin_number(gpio_num_t pin_number) { if (pin_number == 13) { diff --git a/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.mk b/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.mk index 5ad71b2da5..034d94bb5f 100644 --- a/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.mk +++ b/ports/espressif/boards/beetle-esp32-c3/mpconfigboard.mk @@ -9,3 +9,5 @@ CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/cytron_maker_feather_aiot_s3/board.c b/ports/espressif/boards/cytron_maker_feather_aiot_s3/board.c index 1f9ef3c4e7..8f1a584194 100644 --- a/ports/espressif/boards/cytron_maker_feather_aiot_s3/board.c +++ b/ports/espressif/boards/cytron_maker_feather_aiot_s3/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/deneyap_kart/board.c b/ports/espressif/boards/deneyap_kart/board.c index 8c0c8b8b0b..12d8928cd5 100644 --- a/ports/espressif/boards/deneyap_kart/board.c +++ b/ports/espressif/boards/deneyap_kart/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/deneyap_kart_1a/board.c b/ports/espressif/boards/deneyap_kart_1a/board.c index 8c0c8b8b0b..12d8928cd5 100644 --- a/ports/espressif/boards/deneyap_kart_1a/board.c +++ b/ports/espressif/boards/deneyap_kart_1a/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/deneyap_kart_g/mpconfigboard.mk b/ports/espressif/boards/deneyap_kart_g/mpconfigboard.mk index 1743090e0e..98e4e4c9a5 100644 --- a/ports/espressif/boards/deneyap_kart_g/mpconfigboard.mk +++ b/ports/espressif/boards/deneyap_kart_g/mpconfigboard.mk @@ -8,3 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/espressif_esp32_eye/board.c b/ports/espressif/boards/espressif_esp32_eye/board.c index 1c09fb1316..b37123db04 100644 --- a/ports/espressif/boards/espressif_esp32_eye/board.c +++ b/ports/espressif/boards/espressif_esp32_eye/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/espressif_esp32_lyrat/board.c b/ports/espressif/boards/espressif_esp32_lyrat/board.c index 8c0c8b8b0b..12d8928cd5 100644 --- a/ports/espressif/boards/espressif_esp32_lyrat/board.c +++ b/ports/espressif/boards/espressif_esp32_lyrat/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/lolin_c3_mini/mpconfigboard.mk b/ports/espressif/boards/lolin_c3_mini/mpconfigboard.mk index 99c910e6d2..b6dea28098 100644 --- a/ports/espressif/boards/lolin_c3_mini/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_c3_mini/mpconfigboard.mk @@ -8,3 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk index 6778550a2d..56c03ddf68 100644 --- a/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk +++ b/ports/espressif/boards/lolin_c3_pico/mpconfigboard.mk @@ -9,5 +9,7 @@ CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 +CIRCUITPY_BLEIO = 0 + # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel diff --git a/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.mk b/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.mk index 03f5171a31..dfd8ff63de 100644 --- a/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.mk +++ b/ports/espressif/boards/luatos_core_esp32c3/mpconfigboard.mk @@ -8,3 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk b/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk index 9e777889c0..8a425a75cb 100644 --- a/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk +++ b/ports/espressif/boards/luatos_core_esp32c3_ch343/mpconfigboard.mk @@ -8,3 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_ESP_USB_SERIAL_JTAG = 0 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/m5stack_core2/board.c b/ports/espressif/boards/m5stack_core2/board.c index e64ac35a7d..29011638b2 100644 --- a/ports/espressif/boards/m5stack_core2/board.c +++ b/ports/espressif/boards/m5stack_core2/board.c @@ -34,7 +34,7 @@ #include "shared-bindings/board/__init__.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/m5stack_stamp_c3/mpconfigboard.mk b/ports/espressif/boards/m5stack_stamp_c3/mpconfigboard.mk index 2f3b62f90f..e360567a0a 100644 --- a/ports/espressif/boards/m5stack_stamp_c3/mpconfigboard.mk +++ b/ports/espressif/boards/m5stack_stamp_c3/mpconfigboard.mk @@ -8,3 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ=80m CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_ESP_USB_SERIAL_JTAG = 0 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/m5stack_stick_c/board.c b/ports/espressif/boards/m5stack_stick_c/board.c index 779125a017..7f9b5a54f4 100644 --- a/ports/espressif/boards/m5stack_stick_c/board.c +++ b/ports/espressif/boards/m5stack_stick_c/board.c @@ -33,7 +33,7 @@ #include "shared-module/displayio/mipi_constants.h" #include "shared-bindings/board/__init__.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/m5stack_stick_c_plus/board.c b/ports/espressif/boards/m5stack_stick_c_plus/board.c index ea43209c24..5901f8cea8 100644 --- a/ports/espressif/boards/m5stack_stick_c_plus/board.c +++ b/ports/espressif/boards/m5stack_stick_c_plus/board.c @@ -33,7 +33,7 @@ #include "shared-module/displayio/mipi_constants.h" #include "shared-bindings/board/__init__.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/m5stack_timer_camera_x/board.c b/ports/espressif/boards/m5stack_timer_camera_x/board.c index 65b857c3ae..162ad40a80 100755 --- a/ports/espressif/boards/m5stack_timer_camera_x/board.c +++ b/ports/espressif/boards/m5stack_timer_camera_x/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.mk b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.mk index 1bb9d0835f..dd3e159386 100644 --- a/ports/espressif/boards/microdev_micro_c3/mpconfigboard.mk +++ b/ports/espressif/boards/microdev_micro_c3/mpconfigboard.mk @@ -8,3 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk index 4bec24347e..3e2c97dab9 100644 --- a/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk +++ b/ports/espressif/boards/seeed_xiao_esp32c3/mpconfigboard.mk @@ -8,3 +8,5 @@ CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/unexpectedmaker_tinypico/board.c b/ports/espressif/boards/unexpectedmaker_tinypico/board.c index e59af9528d..530c27f776 100644 --- a/ports/espressif/boards/unexpectedmaker_tinypico/board.c +++ b/ports/espressif/boards/unexpectedmaker_tinypico/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/boards/unexpectedmaker_tinypico_nano/board.c b/ports/espressif/boards/unexpectedmaker_tinypico_nano/board.c index d66ab9e5f1..551058611e 100644 --- a/ports/espressif/boards/unexpectedmaker_tinypico_nano/board.c +++ b/ports/espressif/boards/unexpectedmaker_tinypico_nano/board.c @@ -27,7 +27,7 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" +#include "components/driver/gpio/include/driver/gpio.h" #include "components/hal/include/hal/gpio_hal.h" #include "common-hal/microcontroller/Pin.h" diff --git a/ports/espressif/common-hal/canio/Listener.c b/ports/espressif/common-hal/canio/Listener.c index 0df8ee1b8d..a6c0dbf90c 100644 --- a/ports/espressif/common-hal/canio/Listener.c +++ b/ports/espressif/common-hal/canio/Listener.c @@ -39,7 +39,8 @@ #include "hal/twai_ll.h" -#if !defined(TWAI) && defined(TWAI0) +// There is no logic that dictates TWAI vs TWAI0 +#if defined(CONFIG_IDF_TARGET_ESP32H2) || defined(CONFIG_IDF_TARGET_ESP32C6) #define TWAI TWAI0 #endif From faa445e347d4508d7bb6bf2b8cb175702cea2d63 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 22 Sep 2023 09:58:32 -0700 Subject: [PATCH 1711/1712] Three more board fixes --- .../espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk | 2 ++ ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.mk | 4 ++++ ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk index 2fb409d247..fec39d79f3 100644 --- a/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk +++ b/ports/espressif/boards/ai_thinker_esp32-c3s-2m/mpconfigboard.mk @@ -10,3 +10,5 @@ CIRCUITPY_ESP_FLASH_SIZE = 2MB CIRCUITPY_DUALBANK = 0 CIRCUITPY_ESP_USB_SERIAL_JTAG = 0 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.mk index 2ca19f332c..de5601680c 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t-01c3/mpconfigboard.mk @@ -6,3 +6,7 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 0 + +CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk index 7a80145217..ede6428e8b 100644 --- a/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk +++ b/ports/espressif/boards/lilygo_ttgo_t-oi-plus/mpconfigboard.mk @@ -6,3 +6,7 @@ IDF_TARGET = esp32c3 CIRCUITPY_ESP_FLASH_MODE = dio CIRCUITPY_ESP_FLASH_FREQ = 80m CIRCUITPY_ESP_FLASH_SIZE = 4MB + +CIRCUITPY_ESP_USB_SERIAL_JTAG = 0 + +CIRCUITPY_BLEIO = 0 From c726e87344b1d1a6a90e7ca9666e122163a462b0 Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Fri, 22 Sep 2023 15:05:20 -0700 Subject: [PATCH 1712/1712] Enable BLE on H2 devkit --- .../mpconfigboard.mk | 2 -- .../espressif_esp32h2_devkitm_1_n4/sdkconfig | 16 ---------------- .../esp-idf-config/sdkconfig-opt.defaults | 1 + 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/mpconfigboard.mk b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/mpconfigboard.mk index a4398b4918..82eb611bdf 100644 --- a/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/mpconfigboard.mk +++ b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/mpconfigboard.mk @@ -6,5 +6,3 @@ IDF_TARGET = esp32h2 CIRCUITPY_ESP_FLASH_MODE = qio CIRCUITPY_ESP_FLASH_FREQ = 48m CIRCUITPY_ESP_FLASH_SIZE = 4MB - -CIRCUITPY_BLEIO = 0 diff --git a/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/sdkconfig b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/sdkconfig index 1fb757bf0f..e69de29bb2 100644 --- a/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/sdkconfig +++ b/ports/espressif/boards/espressif_esp32h2_devkitm_1_n4/sdkconfig @@ -1,16 +0,0 @@ -# -# Espressif IoT Development Framework Configuration -# -# -# Component config -# -# -# ESP System Settings -# -CONFIG_ESP_CONSOLE_SECONDARY_NONE=y -# CONFIG_ESP_CONSOLE_SECONDARY_USB_SERIAL_JTAG is not set -# end of ESP System Settings - -# end of Component config - -# end of Espressif IoT Development Framework Configuration diff --git a/ports/espressif/esp-idf-config/sdkconfig-opt.defaults b/ports/espressif/esp-idf-config/sdkconfig-opt.defaults index ebf294736a..74502488dc 100644 --- a/ports/espressif/esp-idf-config/sdkconfig-opt.defaults +++ b/ports/espressif/esp-idf-config/sdkconfig-opt.defaults @@ -29,6 +29,7 @@ CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT=y # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT=y CONFIG_ESP_CONSOLE_NONE=y +CONFIG_ESP_CONSOLE_SECONDARY_NONE=y # end of ESP System Settings #