Merge remote-tracking branch 'adafruit/main' into i2c-common-hal-write-read
This commit is contained in:
commit
d5740c8ad9
@ -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: 2022-01-25 05:55+0000\n"
|
||||
"PO-Revision-Date: 2022-01-31 05:55+0000\n"
|
||||
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: pt_BR\n"
|
||||
@ -1629,7 +1629,7 @@ msgstr "Nome muito longo"
|
||||
|
||||
#: ports/espressif/common-hal/_bleio/__init__.c
|
||||
msgid "Nimble out of memory"
|
||||
msgstr ""
|
||||
msgstr "Ágil fora da memória"
|
||||
|
||||
#: ports/nrf/common-hal/_bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
@ -2509,7 +2509,7 @@ msgstr "Erro de segurança desconhecido: 0x%04x"
|
||||
#: ports/espressif/common-hal/_bleio/__init__.c
|
||||
#, c-format
|
||||
msgid "Unknown system firmware error at %s:%d: %d"
|
||||
msgstr ""
|
||||
msgstr "Ocorreu um erro desconhecido no firmware do sistema em %s:%d: %d"
|
||||
|
||||
#: ports/nrf/common-hal/_bleio/__init__.c
|
||||
#, c-format
|
||||
@ -2519,7 +2519,7 @@ msgstr "Erro desconhecido do firmware: %04x"
|
||||
#: ports/espressif/common-hal/_bleio/__init__.c
|
||||
#, c-format
|
||||
msgid "Unknown system firmware error: %d"
|
||||
msgstr ""
|
||||
msgstr "Ocorreu um erro desconhecido no firmware do sistema: %d"
|
||||
|
||||
#: shared-bindings/adafruit_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
|
@ -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: 2022-01-23 15:53+0000\n"
|
||||
"PO-Revision-Date: 2022-01-29 07:53+0000\n"
|
||||
"Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: sv\n"
|
||||
@ -1612,7 +1612,7 @@ msgstr "Name är för långt"
|
||||
|
||||
#: ports/espressif/common-hal/_bleio/__init__.c
|
||||
msgid "Nimble out of memory"
|
||||
msgstr ""
|
||||
msgstr "Nimble har inget minne kvar"
|
||||
|
||||
#: ports/nrf/common-hal/_bleio/Characteristic.c
|
||||
msgid "No CCCD for this Characteristic"
|
||||
@ -2480,7 +2480,7 @@ msgstr "Okänt säkerhetsfel: 0x%04x"
|
||||
#: ports/espressif/common-hal/_bleio/__init__.c
|
||||
#, c-format
|
||||
msgid "Unknown system firmware error at %s:%d: %d"
|
||||
msgstr ""
|
||||
msgstr "Okänt fel i systemets firmware vid %s:%d: %d"
|
||||
|
||||
#: ports/nrf/common-hal/_bleio/__init__.c
|
||||
#, c-format
|
||||
@ -2490,7 +2490,7 @@ msgstr "Okänt systemfirmwarefel: %04x"
|
||||
#: ports/espressif/common-hal/_bleio/__init__.c
|
||||
#, c-format
|
||||
msgid "Unknown system firmware error: %d"
|
||||
msgstr ""
|
||||
msgstr "Okänt fel i systemets firmware: %d"
|
||||
|
||||
#: shared-bindings/adafruit_pixelbuf/PixelBuf.c
|
||||
#, c-format
|
||||
|
@ -9,3 +9,5 @@ CHIP_FAMILY = samd21
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
CIRCUITPY_FULL_BUILD = 0
|
||||
|
||||
CIRCUITPY_ONEWIREIO = 0
|
||||
|
@ -9,3 +9,5 @@ CHIP_FAMILY = samd21
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = NONE
|
||||
CIRCUITPY_FULL_BUILD = 0
|
||||
|
||||
CIRCUITPY_ONEWIREIO = 0
|
||||
|
@ -20,6 +20,7 @@ ifeq ($(CHIP_FAMILY),samd21)
|
||||
# fit in 256kB of flash
|
||||
|
||||
CIRCUITPY_AESIO ?= 0
|
||||
CIRCUITPY_ATEXIT ?= 0
|
||||
CIRCUITPY_AUDIOMIXER ?= 0
|
||||
CIRCUITPY_BINASCII ?= 0
|
||||
CIRCUITPY_BITBANGIO ?= 0
|
||||
@ -33,6 +34,7 @@ CIRCUITPY_COUNTIO ?= 0
|
||||
# Not enough RAM for framebuffers
|
||||
CIRCUITPY_FRAMEBUFFERIO ?= 0
|
||||
CIRCUITPY_FREQUENCYIO ?= 0
|
||||
CIRCUITPY_GETPASS ?= 0
|
||||
CIRCUITPY_GIFIO ?= 0
|
||||
CIRCUITPY_I2CPERIPHERAL ?= 0
|
||||
CIRCUITPY_JSON ?= 0
|
||||
|
48
ports/espressif/boards/unexpectedmaker_feathers3/board.c
Normal file
48
ports/espressif/boards/unexpectedmaker_feathers3/board.c
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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 */
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
}
|
@ -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
|
||||
*
|
||||
* 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 "FeatherS3"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S3"
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_GPIO40)
|
||||
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO39)
|
||||
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
|
||||
#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n")
|
||||
|
||||
#define AUTORESET_DELAY_MS 500
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_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)
|
||||
|
||||
#define DOUBLE_TAP_PIN (&pin_GPIO47)
|
@ -0,0 +1,22 @@
|
||||
USB_VID = 0x303A
|
||||
USB_PID = 0x80D7
|
||||
USB_PRODUCT = "FeatherS3"
|
||||
USB_MANUFACTURER = "UnexpectedMaker"
|
||||
|
||||
IDF_TARGET = esp32s3
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# The default queue depth of 16 overflows on release builds,
|
||||
# so increase it to 32.
|
||||
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
|
||||
|
||||
CIRCUITPY_ESP_FLASH_MODE=dio
|
||||
CIRCUITPY_ESP_FLASH_FREQ=80m
|
||||
CIRCUITPY_ESP_FLASH_SIZE=16MB
|
||||
|
||||
#CIRCUITPY_BITBANG_NEOPIXEL = 1
|
||||
|
||||
# Include these Python libraries in firmware.
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
|
119
ports/espressif/boards/unexpectedmaker_feathers3/pins.c
Normal file
119
ports/espressif/boards/unexpectedmaker_feathers3/pins.c
Normal file
@ -0,0 +1,119 @@
|
||||
#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_D4), MP_ROM_PTR(&pin_GPIO0) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO18) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO17), MP_ROM_PTR(&pin_GPIO17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO17) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO14) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO12), MP_ROM_PTR(&pin_GPIO12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO12) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO6) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO6) },
|
||||
|
||||
{ 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_D19), MP_ROM_PTR(&pin_GPIO5) },
|
||||
|
||||
{ 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_D25), MP_ROM_PTR(&pin_GPIO36) },
|
||||
|
||||
{ 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_D24), 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_D23), MP_ROM_PTR(&pin_GPIO37) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO44), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ 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_IO43), MP_ROM_PTR(&pin_GPIO43) },
|
||||
{ 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_IO42), MP_ROM_PTR(&pin_GPIO42) },
|
||||
// { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_GPIO42) },
|
||||
|
||||
{ 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_A11), MP_ROM_PTR(&pin_GPIO8) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D21), 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_A12), MP_ROM_PTR(&pin_GPIO8) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO9) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO33), MP_ROM_PTR(&pin_GPIO33) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO33) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO38), MP_ROM_PTR(&pin_GPIO38) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO38) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO1), MP_ROM_PTR(&pin_GPIO1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO1) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO1) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO3) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO3) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO7) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO7) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO10) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO11), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ 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
|
||||
|
||||
// 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) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO2) },
|
||||
|
||||
// 5V present sense pin
|
||||
{ MP_ROM_QSTR(MP_QSTR_VBUS), MP_ROM_PTR(&pin_GPIO34) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO34) },
|
||||
|
||||
{ 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
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO39) }, // Second LDO Enable control
|
||||
{ MP_ROM_QSTR(MP_QSTR_I39), MP_ROM_PTR(&pin_GPIO39) }, // Second LDO Enable control
|
||||
|
||||
{ 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);
|
39
ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig
Normal file
39
ports/espressif/boards/unexpectedmaker_feathers3/sdkconfig
Normal file
@ -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="UMFeatherS3"
|
||||
# end of LWIP
|
48
ports/espressif/boards/unexpectedmaker_pros3/board.c
Normal file
48
ports/espressif/boards/unexpectedmaker_pros3/board.c
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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 */
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
}
|
49
ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.h
Normal file
49
ports/espressif/boards/unexpectedmaker_pros3/mpconfigboard.h
Normal file
@ -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
|
||||
*
|
||||
* 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 "ProS3"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S3"
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_GPIO18)
|
||||
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO17)
|
||||
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
|
||||
#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n")
|
||||
|
||||
#define AUTORESET_DELAY_MS 500
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_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)
|
||||
|
||||
#define DOUBLE_TAP_PIN (&pin_GPIO47)
|
@ -0,0 +1,22 @@
|
||||
USB_VID = 0x303A
|
||||
USB_PID = 0x80D4
|
||||
USB_PRODUCT = "ProS3"
|
||||
USB_MANUFACTURER = "UnexpectedMaker"
|
||||
|
||||
IDF_TARGET = esp32s3
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# The default queue depth of 16 overflows on release builds,
|
||||
# so increase it to 32.
|
||||
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
|
||||
|
||||
CIRCUITPY_ESP_FLASH_MODE=qio
|
||||
CIRCUITPY_ESP_FLASH_FREQ=80m
|
||||
CIRCUITPY_ESP_FLASH_SIZE=16MB
|
||||
|
||||
# CIRCUITPY_BITBANG_NEOPIXEL = 1
|
||||
|
||||
# Include these Python libraries in firmware.
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
|
139
ports/espressif/boards/unexpectedmaker_pros3/pins.c
Normal file
139
ports/espressif/boards/unexpectedmaker_pros3/pins.c
Normal file
@ -0,0 +1,139 @@
|
||||
#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_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_IO21), MP_ROM_PTR(&pin_GPIO21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) },
|
||||
|
||||
{ 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_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_MTCK), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO40), MP_ROM_PTR(&pin_GPIO40) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MTDO), MP_ROM_PTR(&pin_GPIO40) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D40), MP_ROM_PTR(&pin_GPIO40) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO41), MP_ROM_PTR(&pin_GPIO41) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_MTDI), 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_MTMS), MP_ROM_PTR(&pin_GPIO42) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D42), MP_ROM_PTR(&pin_GPIO42) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO43), MP_ROM_PTR(&pin_GPIO43) },
|
||||
{ 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_IO44), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) },
|
||||
|
||||
// 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_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VBAT_SENSE), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO10) },
|
||||
|
||||
// 5V present sense pin
|
||||
{ MP_ROM_QSTR(MP_QSTR_VBUS), MP_ROM_PTR(&pin_GPIO33) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO33) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO18) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_LDO2), MP_ROM_PTR(&pin_GPIO17) }, // Second LDO Enable control
|
||||
{ MP_ROM_QSTR(MP_QSTR_I17), MP_ROM_PTR(&pin_GPIO17) }, // Second LDO Enable control
|
||||
|
||||
{ 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);
|
39
ports/espressif/boards/unexpectedmaker_pros3/sdkconfig
Normal file
39
ports/espressif/boards/unexpectedmaker_pros3/sdkconfig
Normal file
@ -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="UMProS3"
|
||||
# end of LWIP
|
48
ports/espressif/boards/unexpectedmaker_tinys3/board.c
Normal file
48
ports/espressif/boards/unexpectedmaker_tinys3/board.c
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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 */
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
}
|
@ -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
|
||||
*
|
||||
* 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 "TinyS3"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S3"
|
||||
|
||||
#define MICROPY_HW_NEOPIXEL (&pin_GPIO18)
|
||||
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO17)
|
||||
#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0)
|
||||
#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n")
|
||||
|
||||
#define AUTORESET_DELAY_MS 500
|
||||
|
||||
#define DEFAULT_I2C_BUS_SCL (&pin_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)
|
||||
|
||||
#define DOUBLE_TAP_PIN (&pin_GPIO47)
|
@ -0,0 +1,24 @@
|
||||
USB_VID = 0x303A
|
||||
USB_PID = 0x80D1
|
||||
USB_PRODUCT = "TinyS3"
|
||||
USB_MANUFACTURER = "UnexpectedMaker"
|
||||
|
||||
IDF_TARGET = esp32s3
|
||||
|
||||
INTERNAL_FLASH_FILESYSTEM = 1
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
# The default queue depth of 16 overflows on release builds,
|
||||
# so increase it to 32.
|
||||
CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32
|
||||
|
||||
CIRCUITPY_ESP_FLASH_MODE=dio
|
||||
CIRCUITPY_ESP_FLASH_FREQ=80m
|
||||
CIRCUITPY_ESP_FLASH_SIZE=8MB
|
||||
|
||||
# CIRCUITPY_BITBANG_NEOPIXEL = 1
|
||||
|
||||
CIRCUITPY_STAGE = 1
|
||||
|
||||
# Include these Python libraries in firmware.
|
||||
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel
|
96
ports/espressif/boards/unexpectedmaker_tinys3/pins.c
Normal file
96
ports/espressif/boards/unexpectedmaker_tinys3/pins.c
Normal file
@ -0,0 +1,96 @@
|
||||
#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_IO21), MP_ROM_PTR(&pin_GPIO21) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) },
|
||||
|
||||
{ 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_D1), 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_D0), MP_ROM_PTR(&pin_GPIO44) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO44) },
|
||||
|
||||
// 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_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VBAT), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VBAT_SENSE), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO10) },
|
||||
|
||||
// 5V present sense pin
|
||||
{ MP_ROM_QSTR(MP_QSTR_VBUS), MP_ROM_PTR(&pin_GPIO33) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VBUS_SENSE), MP_ROM_PTR(&pin_GPIO33) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO18) },
|
||||
|
||||
{ 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);
|
41
ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig
Normal file
41
ports/espressif/boards/unexpectedmaker_tinys3/sdkconfig
Normal file
@ -0,0 +1,41 @@
|
||||
CONFIG_ESP32S3_SPIRAM_SUPPORT=y
|
||||
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
# 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
|
||||
#
|
||||
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_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
|
@ -250,7 +250,7 @@ void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) {
|
||||
}
|
||||
|
||||
bool common_hal_busio_spi_deinited(busio_spi_obj_t *self) {
|
||||
return self->sck->pin == NULL;
|
||||
return self->sck == NULL;
|
||||
}
|
||||
|
||||
void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
|
||||
|
@ -259,7 +259,7 @@ void common_hal_busio_uart_never_reset(busio_uart_obj_t *self) {
|
||||
}
|
||||
|
||||
bool common_hal_busio_uart_deinited(busio_uart_obj_t *self) {
|
||||
return self->tx->pin == NULL && self->rx->pin == NULL;
|
||||
return self->tx == NULL && self->rx == NULL;
|
||||
}
|
||||
|
||||
void common_hal_busio_uart_deinit(busio_uart_obj_t *self) {
|
||||
|
@ -72,7 +72,6 @@
|
||||
//| Playing a wave file from flash::
|
||||
//|
|
||||
//| import board
|
||||
//| import audioio
|
||||
//| import audiocore
|
||||
//| import audiobusio
|
||||
//| import digitalio
|
||||
|
@ -29,8 +29,15 @@
|
||||
#include "py/mphal.h"
|
||||
#include "py/runtime.h"
|
||||
#include "shared-bindings/digitalio/DigitalInOut.h"
|
||||
#include "shared-bindings/util.h"
|
||||
#include "supervisor/shared/translate.h"
|
||||
|
||||
STATIC void check_for_deinit(digitalio_digitalinout_obj_t *self) {
|
||||
if (common_hal_digitalio_digitalinout_deinited(self)) {
|
||||
raise_deinited_error();
|
||||
}
|
||||
}
|
||||
|
||||
//| """Low-level neopixel implementation
|
||||
//|
|
||||
//| The `neopixel_write` module contains a helper method to write out bytes in
|
||||
@ -60,8 +67,13 @@ STATIC mp_obj_t neopixel_write_neopixel_write_(mp_obj_t digitalinout_obj, mp_obj
|
||||
if (!mp_obj_is_type(digitalinout_obj, &digitalio_digitalinout_type)) {
|
||||
mp_raise_TypeError_varg(translate("Expected a %q"), digitalio_digitalinout_type.name);
|
||||
}
|
||||
|
||||
// Convert parameters into expected types.
|
||||
const digitalio_digitalinout_obj_t *digitalinout = MP_OBJ_TO_PTR(digitalinout_obj);
|
||||
|
||||
// Check to see if the NeoPixel has been deinited before writing to it.
|
||||
check_for_deinit(digitalinout_obj);
|
||||
|
||||
mp_buffer_info_t bufinfo;
|
||||
mp_get_buffer_raise(buf, &bufinfo, MP_BUFFER_READ);
|
||||
// Call platform's neopixel write function with provided buffer and options.
|
||||
|
@ -304,7 +304,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_ap_obj, wifi_radio_stop_ap);
|
||||
//| *,
|
||||
//| channel: Optional[int] = 0,
|
||||
//| bssid: Optional[ReadableBuffer] = b"",
|
||||
//| timeout: Optional[float] = None) -> bool:
|
||||
//| timeout: Optional[float] = None) -> None:
|
||||
//| """Connects to the given ssid and waits for an ip address. Reconnections are handled
|
||||
//| automatically once one connection succeeds.
|
||||
//|
|
||||
@ -507,7 +507,7 @@ const mp_obj_property_t wifi_radio_ap_info_obj = {
|
||||
MP_ROM_NONE },
|
||||
};
|
||||
|
||||
//| def ping(self, ip: ipaddress.IPv4Address, *, timeout: Optional[float] = 0.5) -> float:
|
||||
//| def ping(self, ip: ipaddress.IPv4Address, *, timeout: Optional[float] = 0.5) -> Optional[float]:
|
||||
//| """Ping an IP to test connectivity. Returns echo time in seconds.
|
||||
//| Returns None when it times out."""
|
||||
//| ...
|
||||
|
@ -57,6 +57,7 @@ typedef struct {
|
||||
|
||||
static const board_i2c_pin_t i2c_pin[CIRCUITPY_BOARD_I2C] = CIRCUITPY_BOARD_I2C_PIN;
|
||||
static busio_i2c_obj_t i2c_obj[CIRCUITPY_BOARD_I2C];
|
||||
static bool i2c_obj_created[CIRCUITPY_BOARD_I2C];
|
||||
|
||||
bool common_hal_board_is_i2c(mp_obj_t obj) {
|
||||
for (uint8_t instance = 0; instance < CIRCUITPY_BOARD_I2C; instance++) {
|
||||
@ -68,7 +69,7 @@ bool common_hal_board_is_i2c(mp_obj_t obj) {
|
||||
}
|
||||
|
||||
mp_obj_t common_hal_board_get_i2c(const mp_int_t instance) {
|
||||
return &i2c_obj[instance];
|
||||
return i2c_obj_created[instance] ? &i2c_obj[instance] : NULL;
|
||||
}
|
||||
|
||||
mp_obj_t common_hal_board_create_i2c(const mp_int_t instance) {
|
||||
@ -85,6 +86,7 @@ mp_obj_t common_hal_board_create_i2c(const mp_int_t instance) {
|
||||
|
||||
common_hal_busio_i2c_construct(self, i2c_pin[instance].scl, i2c_pin[instance].sda, 100000, 255);
|
||||
|
||||
i2c_obj_created[instance] = true;
|
||||
return &i2c_obj[instance];
|
||||
}
|
||||
#endif
|
||||
@ -101,6 +103,7 @@ typedef struct {
|
||||
|
||||
static const board_spi_pin_t spi_pin[CIRCUITPY_BOARD_SPI] = CIRCUITPY_BOARD_SPI_PIN;
|
||||
static busio_spi_obj_t spi_obj[CIRCUITPY_BOARD_SPI];
|
||||
static bool spi_obj_created[CIRCUITPY_BOARD_SPI];
|
||||
|
||||
bool common_hal_board_is_spi(mp_obj_t obj) {
|
||||
for (uint8_t instance = 0; instance < CIRCUITPY_BOARD_SPI; instance++) {
|
||||
@ -112,7 +115,7 @@ bool common_hal_board_is_spi(mp_obj_t obj) {
|
||||
}
|
||||
|
||||
mp_obj_t common_hal_board_get_spi(const mp_int_t instance) {
|
||||
return &spi_obj[instance];
|
||||
return spi_obj_created[instance] ? &spi_obj[instance] : NULL;
|
||||
}
|
||||
|
||||
mp_obj_t common_hal_board_create_spi(const mp_int_t instance) {
|
||||
@ -130,6 +133,7 @@ mp_obj_t common_hal_board_create_spi(const mp_int_t instance) {
|
||||
|
||||
common_hal_busio_spi_construct(self, spi_pin[instance].clock, spi_pin[instance].mosi, spi_pin[instance].miso);
|
||||
|
||||
spi_obj_created[instance] = true;
|
||||
return &spi_obj[instance];
|
||||
}
|
||||
#endif
|
||||
@ -143,6 +147,7 @@ typedef struct {
|
||||
|
||||
static const board_uart_pin_t uart_pin[CIRCUITPY_BOARD_UART] = CIRCUITPY_BOARD_UART_PIN;
|
||||
static busio_uart_obj_t uart_obj[CIRCUITPY_BOARD_UART];
|
||||
static bool uart_obj_created[CIRCUITPY_BOARD_UART];
|
||||
|
||||
bool common_hal_board_is_uart(mp_obj_t obj) {
|
||||
for (uint8_t instance = 0; instance < CIRCUITPY_BOARD_UART; instance++) {
|
||||
@ -154,7 +159,7 @@ bool common_hal_board_is_uart(mp_obj_t obj) {
|
||||
}
|
||||
|
||||
mp_obj_t common_hal_board_get_uart(const mp_int_t instance) {
|
||||
return &uart_obj[instance];
|
||||
return uart_obj_created[instance] ? &uart_obj[instance] : NULL;
|
||||
}
|
||||
|
||||
mp_obj_t common_hal_board_create_uart(const mp_int_t instance) {
|
||||
@ -174,6 +179,7 @@ mp_obj_t common_hal_board_create_uart(const mp_int_t instance) {
|
||||
common_hal_busio_uart_construct(self, uart_pin[instance].tx, uart_pin[instance].rx,
|
||||
NULL, NULL, NULL, false, 9600, 8, BUSIO_UART_PARITY_NONE, 1, 1.0f, 64, NULL, false);
|
||||
|
||||
uart_obj_created[instance] = true;
|
||||
return &uart_obj[instance];
|
||||
}
|
||||
#endif
|
||||
@ -190,11 +196,12 @@ void reset_board_buses(void) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (!common_hal_busio_i2c_deinited(&i2c_obj[instance])) {
|
||||
if (i2c_obj_created[instance]) {
|
||||
// make sure I2C lock is not held over a soft reset
|
||||
common_hal_busio_i2c_unlock(&i2c_obj[instance]);
|
||||
if (!display_using_i2c) {
|
||||
common_hal_busio_i2c_deinit(&i2c_obj[instance]);
|
||||
i2c_obj_created[instance] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -217,18 +224,22 @@ void reset_board_buses(void) {
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (!common_hal_busio_spi_deinited(&spi_obj[instance])) {
|
||||
if (spi_obj_created[instance]) {
|
||||
// make sure SPI lock is not held over a soft reset
|
||||
common_hal_busio_spi_unlock(&spi_obj[instance]);
|
||||
if (!display_using_spi) {
|
||||
common_hal_busio_spi_deinit(&spi_obj[instance]);
|
||||
spi_obj_created[instance] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if CIRCUITPY_BOARD_UART
|
||||
for (uint8_t instance = 0; instance < CIRCUITPY_BOARD_UART; instance++) {
|
||||
common_hal_busio_uart_deinit(&uart_obj[instance]);
|
||||
if (uart_obj_created[instance]) {
|
||||
common_hal_busio_uart_deinit(&uart_obj[instance]);
|
||||
uart_obj_created[instance] = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ length = 8000 // 440
|
||||
# signed 16 bit
|
||||
s16 = array.array("h", [0] * length)
|
||||
for i in range(length):
|
||||
s16[i] = int(math.sin(math.pi * 2 * i / length) * (2 ** 15))
|
||||
s16[i] = int(math.sin(math.pi * 2 * i / length) * (2**15))
|
||||
print(s16[i])
|
||||
|
||||
sample = audiocore.RawSample(s16, sample_rate=8000)
|
||||
|
@ -19,21 +19,21 @@ sample_names = ["unsigned 8 bit", "signed 8 bit", "unsigned 16 bit", "signed 16
|
||||
# unsigned 8 bit
|
||||
u8 = array.array("B", [0] * length)
|
||||
for i in range(length):
|
||||
u8[i] = int(math.sin(math.pi * 2 * i / length) * (2 ** 7) + 2 ** 7)
|
||||
u8[i] = int(math.sin(math.pi * 2 * i / length) * (2**7) + 2**7)
|
||||
|
||||
samples.append(audiocore.RawSample(u8, sample_rate=4000))
|
||||
|
||||
# signed 8 bit
|
||||
s8 = array.array("b", [0] * length)
|
||||
for i in range(length):
|
||||
s8[i] = int(math.sin(math.pi * 2 * i / length) * (2 ** 7))
|
||||
s8[i] = int(math.sin(math.pi * 2 * i / length) * (2**7))
|
||||
|
||||
samples.append(audiocore.RawSample(s8, sample_rate=16000))
|
||||
|
||||
# unsigned 16 bit
|
||||
u16 = array.array("H", [0] * length)
|
||||
for i in range(length):
|
||||
u16[i] = int(math.sin(math.pi * 2 * i / length) * (2 ** 15) + 2 ** 15)
|
||||
u16[i] = int(math.sin(math.pi * 2 * i / length) * (2**15) + 2**15)
|
||||
|
||||
samples.append(audiocore.RawSample(u16, sample_rate=8000))
|
||||
|
||||
@ -41,7 +41,7 @@ samples.append(audiocore.RawSample(u16, sample_rate=8000))
|
||||
# signed 16 bit
|
||||
s16 = array.array("h", [0] * length)
|
||||
for i in range(length):
|
||||
s16[i] = int(math.sin(math.pi * 2 * i / length) * (2 ** 15))
|
||||
s16[i] = int(math.sin(math.pi * 2 * i / length) * (2**15))
|
||||
|
||||
samples.append(audiocore.RawSample(s16, sample_rate=8000))
|
||||
|
||||
|
@ -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))
|
||||
|
@ -22,7 +22,7 @@ print(sha1.digest())
|
||||
|
||||
sha1 = hashlib.sha1(b"hello")
|
||||
try:
|
||||
sha1.update(u"world")
|
||||
sha1.update("world")
|
||||
except TypeError as e:
|
||||
print("TypeError")
|
||||
print(sha1.digest())
|
||||
|
@ -28,7 +28,7 @@ print(hashlib.sha256(b"\xff" * 56).digest())
|
||||
|
||||
sha256 = hashlib.sha256(b"hello")
|
||||
try:
|
||||
sha256.update(u"world")
|
||||
sha256.update("world")
|
||||
except TypeError as e:
|
||||
print("TypeError")
|
||||
print(sha256.digest())
|
||||
|
@ -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")
|
||||
|
@ -88,7 +88,7 @@ except ZeroDivisionError:
|
||||
print("ZeroDivisionError")
|
||||
|
||||
try:
|
||||
0.0 ** -1
|
||||
0.0**-1
|
||||
except ZeroDivisionError:
|
||||
print("ZeroDivisionError")
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -4,6 +4,6 @@ except ZeroDivisionError:
|
||||
print("ZeroDivisionError")
|
||||
|
||||
try:
|
||||
0 ** -1
|
||||
0**-1
|
||||
except ZeroDivisionError:
|
||||
print("ZeroDivisionError")
|
||||
|
@ -1,7 +1,7 @@
|
||||
# negative power should produce float
|
||||
|
||||
x = 2
|
||||
print(x ** -2)
|
||||
print(x**-2)
|
||||
|
||||
x = 3
|
||||
x **= -2
|
||||
|
@ -11,7 +11,7 @@ except (ImportError, AttributeError):
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
if not (sys.platform == "linux" and sys.maxsize > 2 ** 32):
|
||||
if not (sys.platform == "linux" and sys.maxsize > 2**32):
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
|
@ -9,7 +9,7 @@ except (ImportError, AttributeError):
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
if not (sys.platform == "linux" and sys.maxsize > 2 ** 32):
|
||||
if not (sys.platform == "linux" and sys.maxsize > 2**32):
|
||||
print("SKIP")
|
||||
raise SystemExit
|
||||
|
||||
|
@ -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
|
||||
|
@ -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(
|
||||
|
@ -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:
|
||||
|
@ -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(
|
||||
|
@ -446,7 +446,7 @@ def do_all_the_things(elf_filename):
|
||||
if "size" not in symbol:
|
||||
print(symbol)
|
||||
size = symbol["size"] / 8
|
||||
square_size = size ** 0.5
|
||||
square_size = size**0.5
|
||||
if text_width_ish > square_size:
|
||||
w = text_width_ish
|
||||
h = size / text_width_ish
|
||||
|
Loading…
Reference in New Issue
Block a user