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++) {
|
||||
if (uart_obj_created[instance]) {
|
||||
common_hal_busio_uart_deinit(&uart_obj[instance]);
|
||||
uart_obj_created[instance] = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user