Merge remote-tracking branch 'origin/main' into espressif-camera-2
This commit is contained in:
commit
1da8065d6b
@ -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-07-24 22:22+0000\n"
|
||||
"PO-Revision-Date: 2022-08-05 14:18+0000\n"
|
||||
"Last-Translator: Wellington Terumi Uemura <wellingtonuemura@gmail.com>\n"
|
||||
"Language-Team: \n"
|
||||
"Language: pt_BR\n"
|
||||
@ -3860,7 +3860,7 @@ msgstr "o pow() com 3 argumentos requer números inteiros"
|
||||
|
||||
#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h
|
||||
msgid "pressing BOOT button at start up.\n"
|
||||
msgstr ""
|
||||
msgstr "pressionando o botão BOOT na inicialização.\n"
|
||||
|
||||
#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h
|
||||
msgid "pressing SW38 button at start up.\n"
|
||||
@ -3868,7 +3868,7 @@ msgstr "pressionando o botão SW38 na inicialização.\n"
|
||||
|
||||
#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h
|
||||
msgid "pressing VOLUME button at start up.\n"
|
||||
msgstr ""
|
||||
msgstr "pressionando o botão VOLUME na inicialização.\n"
|
||||
|
||||
#: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h
|
||||
#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h
|
||||
|
@ -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-07-21 20:15+0000\n"
|
||||
"PO-Revision-Date: 2022-08-05 14:18+0000\n"
|
||||
"Last-Translator: Jonny Bergdahl <jonny@bergdahl.it>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"Language: sv\n"
|
||||
@ -3819,7 +3819,7 @@ msgstr "pow() med 3 argument kräver heltal"
|
||||
|
||||
#: ports/espressif/boards/adafruit_qtpy_esp32_pico/mpconfigboard.h
|
||||
msgid "pressing BOOT button at start up.\n"
|
||||
msgstr ""
|
||||
msgstr "genom att trycka på BOOT-knappen vid start.\n"
|
||||
|
||||
#: ports/espressif/boards/adafruit_feather_esp32_v2/mpconfigboard.h
|
||||
msgid "pressing SW38 button at start up.\n"
|
||||
@ -3827,7 +3827,7 @@ msgstr "genom att trycka på SW38-knappen vid start.\n"
|
||||
|
||||
#: ports/espressif/boards/hardkernel_odroid_go/mpconfigboard.h
|
||||
msgid "pressing VOLUME button at start up.\n"
|
||||
msgstr ""
|
||||
msgstr "genom att trycka på VOLUME-knappen vid start.\n"
|
||||
|
||||
#: ports/espressif/boards/adafruit_qtpy_esp32c3/mpconfigboard.h
|
||||
#: ports/espressif/boards/beetle-esp32-c3/mpconfigboard.h
|
||||
|
@ -7,15 +7,15 @@ msgstr ""
|
||||
"Project-Id-Version: circuitpython-cn\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-01-04 12:55-0600\n"
|
||||
"PO-Revision-Date: 2022-04-23 21:13+0000\n"
|
||||
"Last-Translator: hexthat <hexthat@gmail.com>\n"
|
||||
"PO-Revision-Date: 2022-08-05 14:18+0000\n"
|
||||
"Last-Translator: River Wang <urfdvw@gmail.com>\n"
|
||||
"Language-Team: Chinese Hanyu Pinyin\n"
|
||||
"Language: zh_Latn_pinyin\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Weblate 4.12.1-dev\n"
|
||||
"X-Generator: Weblate 4.14-dev\n"
|
||||
|
||||
#: main.c
|
||||
msgid ""
|
||||
@ -634,9 +634,9 @@ msgid "Buffer must be a multiple of 512 bytes"
|
||||
msgstr "Huǎnchōngqū bìxū shì 512 zìjié de bèishù"
|
||||
|
||||
#: shared-bindings/_bleio/PacketBuffer.c
|
||||
#, fuzzy, c-format
|
||||
#, c-format
|
||||
msgid "Buffer too short by %d bytes"
|
||||
msgstr "Huǎn chōng qū tài duǎn , àn %d zì jié"
|
||||
msgstr "Huǎnchōngqū tàiduǎn , mùqián zhǐyǒu %d zìjié"
|
||||
|
||||
#: ports/espressif/common-hal/imagecapture/ParallelImageCapture.c
|
||||
msgid "Buffers must be same size"
|
||||
@ -742,15 +742,15 @@ msgstr "tōng guò USB kě jiàn shí wú fǎ chóng xīn ān zhuāng '/'."
|
||||
#: ports/cxd56/common-hal/microcontroller/__init__.c
|
||||
#: ports/mimxrt10xx/common-hal/microcontroller/__init__.c
|
||||
msgid "Cannot reset into bootloader because no bootloader is present"
|
||||
msgstr ""
|
||||
msgstr "wúfǎ chóngxīn qǐdòng dào yǐdǎo chéngxù, yīnwéi yǐdǎo chéngxù bù cúnzài."
|
||||
|
||||
#: ports/espressif/common-hal/socketpool/Socket.c
|
||||
msgid "Cannot set socket options"
|
||||
msgstr "wú fǎ shè zhì tào jiē zì xuǎn xiàng"
|
||||
msgstr "wúfǎ shèzhì tàojiēzì xuǎnxiàng"
|
||||
|
||||
#: shared-bindings/digitalio/DigitalInOut.c
|
||||
msgid "Cannot set value when direction is input."
|
||||
msgstr "Dāng fāngxiàng xiàng nèi shí, bùnéng shèzhì gāi zhí."
|
||||
msgstr "Dāng fāngxiàng wéi shūrù shí, bùnéng shèzhì zhí."
|
||||
|
||||
#: ports/espressif/common-hal/busio/UART.c
|
||||
#: ports/mimxrt10xx/common-hal/busio/UART.c
|
||||
|
@ -1,11 +1,4 @@
|
||||
#
|
||||
# Partition Table
|
||||
#
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv"
|
||||
# end of Partition Table
|
||||
|
||||
#
|
||||
CONFIG_ESP32_SPIRAM_SUPPORT=y
|
||||
# SPI RAM config
|
||||
#
|
||||
# CONFIG_SPIRAM_TYPE_AUTO is not set
|
||||
@ -25,15 +18,7 @@ CONFIG_SPIRAM_MEMTEST=y
|
||||
# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set
|
||||
CONFIG_SPIRAM_CACHE_WORKAROUND=y
|
||||
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
CONFIG_ESP32_SPIRAM_SUPPORT=y
|
||||
# CONFIG_SPIRAM_TYPE_AUTO is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
|
||||
|
||||
### # Uncomment to send log output to TX/RX pins on Feather ESP32V2
|
||||
# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins
|
||||
### #
|
||||
### # ESP System Settings
|
||||
### #
|
||||
|
45
ports/espressif/boards/adafruit_feather_huzzah32/board.c
Normal file
45
ports/espressif/boards/adafruit_feather_huzzah32/board.c
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2020 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "supervisor/board.h"
|
||||
#include "mpconfigboard.h"
|
||||
#include "shared-bindings/microcontroller/Pin.h"
|
||||
#include "components/driver/include/driver/gpio.h"
|
||||
#include "components/hal/include/hal/gpio_hal.h"
|
||||
#include "common-hal/microcontroller/Pin.h"
|
||||
|
||||
void board_init(void) {
|
||||
}
|
||||
|
||||
bool board_requests_safe_mode(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void reset_board(void) {
|
||||
}
|
||||
|
||||
void board_deinit(void) {
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2022 Dan Halbert for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// Micropython setup
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "Adafruit Feather HUZZAH32"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32"
|
||||
|
||||
#define MICROPY_HW_LED_STATUS (&pin_GPIO13)
|
||||
|
||||
#define CIRCUITPY_BOARD_I2C (1)
|
||||
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO22, .sda = &pin_GPIO23}}
|
||||
|
||||
#define CIRCUITPY_BOARD_SPI (1)
|
||||
#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO5, .mosi = &pin_GPIO18, .miso = &pin_GPIO19}}
|
||||
|
||||
#define CIRCUITPY_BOARD_UART (1)
|
||||
#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO17, .rx = &pin_GPIO16}}
|
||||
|
||||
// UART pins attached to the USB-serial converter chip
|
||||
#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO1)
|
||||
#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO3)
|
@ -0,0 +1,18 @@
|
||||
CIRCUITPY_CREATOR_ID = 0x0000239A
|
||||
CIRCUITPY_CREATION_ID = 0x00320002
|
||||
|
||||
IDF_TARGET = esp32
|
||||
|
||||
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_STATUS_BAR = 0
|
||||
CIRCUITPY_WEB_WORKFLOW = 0
|
||||
|
||||
CIRCUITPY_ESP_FLASH_MODE = dio
|
||||
CIRCUITPY_ESP_FLASH_FREQ = 40m
|
||||
CIRCUITPY_ESP_FLASH_SIZE = 4MB
|
79
ports/espressif/boards/adafruit_feather_huzzah32/pins.c
Normal file
79
ports/espressif/boards/adafruit_feather_huzzah32/pins.c
Normal file
@ -0,0 +1,79 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
|
||||
// External pins are in silkscreen order, from top to bottom, left side, then right side
|
||||
{ MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO26) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D26), MP_ROM_PTR(&pin_GPIO26) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO25) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D25), MP_ROM_PTR(&pin_GPIO25) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO34) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D34), MP_ROM_PTR(&pin_GPIO34) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO36) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO4) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO5) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO18) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO19) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D19), MP_ROM_PTR(&pin_GPIO19) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO17) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_GPIO21) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A12), MP_ROM_PTR(&pin_GPIO13) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A11), MP_ROM_PTR(&pin_GPIO12) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_GPIO27) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A10), MP_ROM_PTR(&pin_GPIO27) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D33), MP_ROM_PTR(&pin_GPIO33) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A9), MP_ROM_PTR(&pin_GPIO33) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A8), MP_ROM_PTR(&pin_GPIO15) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D32), MP_ROM_PTR(&pin_GPIO32) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A7), MP_ROM_PTR(&pin_GPIO32) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_GPIO14) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO22) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D22), MP_ROM_PTR(&pin_GPIO22) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO23) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_D23), MP_ROM_PTR(&pin_GPIO23) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO35) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO0) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
20
ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig
Normal file
20
ports/espressif/boards/adafruit_feather_huzzah32/sdkconfig
Normal file
@ -0,0 +1,20 @@
|
||||
CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y
|
||||
CONFIG_ESP32_SPIRAM_SUPPORT=n
|
||||
|
||||
# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins
|
||||
### #
|
||||
### # ESP System Settings
|
||||
### #
|
||||
### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y
|
||||
### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set
|
||||
### CONFIG_ESP_CONSOLE_UART_CUSTOM=y
|
||||
### CONFIG_ESP_CONSOLE_NONE is not set
|
||||
### CONFIG_ESP_CONSOLE_UART=y
|
||||
### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y
|
||||
### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set
|
||||
### CONFIG_ESP_CONSOLE_UART_NUM=0
|
||||
### CONFIG_ESP_CONSOLE_UART_TX_GPIO=17
|
||||
### CONFIG_ESP_CONSOLE_UART_RX_GPIO=16
|
||||
### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
|
||||
### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set
|
||||
### # end of ESP System Settings
|
@ -1,10 +1,3 @@
|
||||
#
|
||||
# Partition Table
|
||||
#
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv"
|
||||
# end of Partition Table
|
||||
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
@ -33,7 +26,7 @@ CONFIG_ESP32_SPIRAM_SUPPORT=y
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
|
||||
|
||||
### # Uncomment to send log output to TX/RX pins on Feather ESP32V2
|
||||
### # Uncomment (remove ###) to send ESP_LOG output to TX/RX pins
|
||||
### #
|
||||
### # ESP System Settings
|
||||
### #
|
||||
@ -45,7 +38,7 @@ CONFIG_ESP32_SPIRAM_SUPPORT=y
|
||||
### CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y
|
||||
### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set
|
||||
### CONFIG_ESP_CONSOLE_UART_NUM=0
|
||||
### CONFIG_ESP_CONSOLE_UART_TX_GPIO=8
|
||||
### CONFIG_ESP_CONSOLE_UART_TX_GPIO=32
|
||||
### CONFIG_ESP_CONSOLE_UART_RX_GPIO=7
|
||||
### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
|
||||
### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set
|
||||
|
@ -1,13 +1,4 @@
|
||||
#
|
||||
# Partition Table
|
||||
#
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-16MB-no-uf2.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-16MB-no-uf2.csv"
|
||||
# end of Partition Table
|
||||
|
||||
CONFIG_ESP_INT_WDT_TIMEOUT_MS=3000
|
||||
|
||||
#
|
||||
CONFIG_ESP32_SPIRAM_SUPPORT=y
|
||||
# SPI RAM config
|
||||
#
|
||||
# CONFIG_SPIRAM_TYPE_AUTO is not set
|
||||
@ -27,28 +18,20 @@ CONFIG_SPIRAM_MEMTEST=y
|
||||
# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set
|
||||
CONFIG_SPIRAM_CACHE_WORKAROUND=y
|
||||
|
||||
#
|
||||
# SPI RAM config
|
||||
#
|
||||
CONFIG_ESP32_SPIRAM_SUPPORT=y
|
||||
# CONFIG_SPIRAM_TYPE_AUTO is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set
|
||||
# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set
|
||||
|
||||
### # Uncomment to send log output to TX/RX pins on Feather ESP32V2
|
||||
# Uncomment (remove ###) to send ESP_LOG output to TX/RX pins
|
||||
### #
|
||||
### # ESP System Settings
|
||||
### #
|
||||
CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y
|
||||
### CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y
|
||||
### # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set
|
||||
CONFIG_ESP_CONSOLE_UART_CUSTOM=y
|
||||
### CONFIG_ESP_CONSOLE_UART_CUSTOM=y
|
||||
### # CONFIG_ESP_CONSOLE_NONE is not set
|
||||
CONFIG_ESP_CONSOLE_UART=y
|
||||
CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y
|
||||
### CONFIG_ESP_CONSOLE_UART=y
|
||||
### nCONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y
|
||||
### # CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set
|
||||
CONFIG_ESP_CONSOLE_UART_NUM=0
|
||||
CONFIG_ESP_CONSOLE_UART_TX_GPIO=12
|
||||
CONFIG_ESP_CONSOLE_UART_RX_GPIO=15
|
||||
CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
|
||||
### CONFIG_ESP_CONSOLE_UART_NUM=0
|
||||
### CONFIG_ESP_CONSOLE_UART_TX_GPIO=12
|
||||
### CONFIG_ESP_CONSOLE_UART_RX_GPIO=15
|
||||
### CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
|
||||
### # CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set
|
||||
### # end of ESP System Settings
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "lib/oofatfs/ff.h"
|
||||
#include "extmod/vfs_fat.h"
|
||||
#include "py/mpstate.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
|
||||
void board_init(void) {
|
||||
// Debug UART
|
||||
@ -41,7 +42,7 @@ void board_init(void) {
|
||||
|
||||
mp_import_stat_t stat_b = mp_import_stat("boot.py");
|
||||
if (stat_b != MP_IMPORT_STAT_FILE) {
|
||||
FATFS *fatfs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fatfs = filesystem_circuitpy();
|
||||
FIL fs;
|
||||
UINT char_written = 0;
|
||||
const byte buffer[] = "#Serial port upload mode\nimport storage\nstorage.remount(\"/\", False)\nstorage.disable_usb_drive()\n";
|
||||
|
48
ports/espressif/boards/waveshare_esp32s2_pico/board.c
Normal file
48
ports/espressif/boards/waveshare_esp32s2_pico/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,32 @@
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// Micropython setup
|
||||
|
||||
#define MICROPY_HW_BOARD_NAME "Waveshare ESP32-S2-Pico"
|
||||
#define MICROPY_HW_MCU_NAME "ESP32S2"
|
||||
|
||||
#define CIRCUITPY_STATUS_LED_POWER (&pin_GPIO9)
|
@ -0,0 +1,17 @@
|
||||
USB_VID = 0x303a
|
||||
USB_PID = 0x810a
|
||||
USB_PRODUCT = "ESP32-S2-Pico"
|
||||
USB_MANUFACTURER = "Waveshare Electronics"
|
||||
|
||||
IDF_TARGET = esp32s2
|
||||
|
||||
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 = 4MB
|
43
ports/espressif/boards/waveshare_esp32s2_pico/pins.c
Normal file
43
ports/espressif/boards/waveshare_esp32s2_pico/pins.c
Normal file
@ -0,0 +1,43 @@
|
||||
#include "shared-bindings/board/__init__.h"
|
||||
|
||||
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
|
||||
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_GPIO0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_BOOT0), MP_ROM_PTR(&pin_GPIO0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP0), MP_ROM_PTR(&pin_GPIO0) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP3), MP_ROM_PTR(&pin_GPIO3) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP4), MP_ROM_PTR(&pin_GPIO4) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP5), MP_ROM_PTR(&pin_GPIO5) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP6), MP_ROM_PTR(&pin_GPIO6) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP7), MP_ROM_PTR(&pin_GPIO7) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP8), MP_ROM_PTR(&pin_GPIO8) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO9) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP10), MP_ROM_PTR(&pin_GPIO10) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP11), MP_ROM_PTR(&pin_GPIO11) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP12), MP_ROM_PTR(&pin_GPIO12) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP13), MP_ROM_PTR(&pin_GPIO13) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP14), MP_ROM_PTR(&pin_GPIO14) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP15), MP_ROM_PTR(&pin_GPIO15) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP16), MP_ROM_PTR(&pin_GPIO16) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP17), MP_ROM_PTR(&pin_GPIO17) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP34), MP_ROM_PTR(&pin_GPIO34) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP35), MP_ROM_PTR(&pin_GPIO35) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP36), MP_ROM_PTR(&pin_GPIO36) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP37), MP_ROM_PTR(&pin_GPIO37) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP38), MP_ROM_PTR(&pin_GPIO38) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_IO39), MP_ROM_PTR(&pin_GPIO39) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO40) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO41) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP42), MP_ROM_PTR(&pin_GPIO42) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP43), MP_ROM_PTR(&pin_GPIO43) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_GP44), MP_ROM_PTR(&pin_GPIO44) }
|
||||
};
|
||||
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
|
17
ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig
Normal file
17
ports/espressif/boards/waveshare_esp32s2_pico/sdkconfig
Normal file
@ -0,0 +1,17 @@
|
||||
CONFIG_ESP32S2_SPIRAM_SUPPORT=y
|
||||
|
||||
CONFIG_DEFAULT_PSRAM_CLK_IO=30
|
||||
CONFIG_DEFAULT_PSRAM_CS_IO=26
|
||||
|
||||
CONFIG_SPIRAM_TYPE_ESPPSRAM64=y
|
||||
CONFIG_SPIRAM_SPEED_80M=y
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_SPIRAM_BOOT_INIT=y
|
||||
CONFIG_SPIRAM_USE_MEMMAP=y
|
||||
CONFIG_SPIRAM_MEMTEST=y
|
||||
|
||||
#
|
||||
# LWIP
|
||||
#
|
||||
CONFIG_LWIP_LOCAL_HOSTNAME="waveshare"
|
||||
# end of LWIP
|
@ -1 +1 @@
|
||||
Subproject commit ddb7ddbcb613a582e0a91eda8b1d2510dd0a2d83
|
||||
Subproject commit d51f7d882187afa4b39c2613fd0fe2ac2fea1145
|
@ -1,3 +1,6 @@
|
||||
#
|
||||
# Espressif IoT Development Framework (ESP-IDF) Project Configuration
|
||||
#
|
||||
CONFIG_IDF_TARGET_ARCH_XTENSA=y
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
CONFIG_IDF_TARGET_ESP32=y
|
||||
@ -112,19 +115,6 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
|
||||
# end of Serial flasher config
|
||||
|
||||
#
|
||||
# Partition Table
|
||||
#
|
||||
# CONFIG_PARTITION_TABLE_SINGLE_APP is not set
|
||||
# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set
|
||||
# CONFIG_PARTITION_TABLE_TWO_OTA is not set
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
# CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv"
|
||||
# CONFIG_PARTITION_TABLE_FILENAME="esp-idf-config/partitions-8MB-no-uf2.csv"
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||
CONFIG_PARTITION_TABLE_MD5=y
|
||||
# end of Partition Table
|
||||
|
||||
#
|
||||
# Compiler options
|
||||
#
|
||||
@ -480,16 +470,10 @@ CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y
|
||||
CONFIG_ESP_MAIN_TASK_AFFINITY=0x0
|
||||
CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048
|
||||
# CONFIG_ESP_CONSOLE_UART_DEFAULT is not set
|
||||
CONFIG_ESP_CONSOLE_UART_CUSTOM=y
|
||||
# CONFIG_ESP_CONSOLE_NONE is not set
|
||||
CONFIG_ESP_CONSOLE_UART=y
|
||||
# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set
|
||||
CONFIG_ESP_CONSOLE_NONE=y
|
||||
CONFIG_ESP_CONSOLE_MULTIPLE_UART=y
|
||||
CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_0=y
|
||||
# CONFIG_ESP_CONSOLE_UART_CUSTOM_NUM_1 is not set
|
||||
CONFIG_ESP_CONSOLE_UART_NUM=0
|
||||
CONFIG_ESP_CONSOLE_UART_TX_GPIO=8
|
||||
CONFIG_ESP_CONSOLE_UART_RX_GPIO=7
|
||||
CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
|
||||
CONFIG_ESP_CONSOLE_UART_NUM=-1
|
||||
CONFIG_ESP_INT_WDT=y
|
||||
CONFIG_ESP_INT_WDT_TIMEOUT_MS=300
|
||||
CONFIG_ESP_INT_WDT_CHECK_CPU1=y
|
||||
@ -1081,7 +1065,6 @@ CONFIG_STACK_CHECK_NONE=y
|
||||
CONFIG_ESP32_APPTRACE_DEST_NONE=y
|
||||
CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y
|
||||
CONFIG_ADC2_DISABLE_DAC=y
|
||||
CONFIG_SPIRAM_SUPPORT=y
|
||||
CONFIG_TRACEMEM_RESERVE_DRAM=0x0
|
||||
# CONFIG_ULP_COPROC_ENABLED is not set
|
||||
CONFIG_ULP_COPROC_RESERVE_MEM=0
|
||||
|
@ -151,6 +151,7 @@ void sleep_timer_cb(void *arg);
|
||||
#define PSRAM_HSPI_SPIWP_SD3_IO 2
|
||||
#define PSRAM_HSPI_SPIHD_SD2_IO 4
|
||||
|
||||
#ifdef CONFIG_SPIRAM
|
||||
// PSRAM clock and cs IO should be configured based on hardware design.
|
||||
// For ESP32-WROVER or ESP32-WROVER-B module, the clock IO is IO17, the cs IO is IO16,
|
||||
// they are the default value for these two configs.
|
||||
@ -171,9 +172,11 @@ void sleep_timer_cb(void *arg);
|
||||
|
||||
#define PICO_V3_02_PSRAM_CLK_IO 10
|
||||
#define PICO_V3_02_PSRAM_CS_IO 9
|
||||
#endif // CONFIG_SPIRAM
|
||||
|
||||
static void _never_reset_spi_ram_flash(void) {
|
||||
#if defined(CONFIG_IDF_TARGET_ESP32)
|
||||
#if defined(CONFIG_SPIRAM)
|
||||
uint32_t pkg_ver = esp_efuse_get_pkg_ver();
|
||||
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5) {
|
||||
never_reset_pin_number(D2WD_PSRAM_CLK_IO);
|
||||
@ -193,6 +196,7 @@ static void _never_reset_spi_ram_flash(void) {
|
||||
never_reset_pin_number(D0WDR2_V3_PSRAM_CLK_IO);
|
||||
never_reset_pin_number(D0WDR2_V3_PSRAM_CS_IO);
|
||||
}
|
||||
#endif // CONFIG_SPIRAM
|
||||
|
||||
const uint32_t spiconfig = esp_rom_efuse_get_flash_gpio_info();
|
||||
if (spiconfig == ESP_ROM_EFUSE_FLASH_DEFAULT_SPI) {
|
||||
@ -217,7 +221,7 @@ static void _never_reset_spi_ram_flash(void) {
|
||||
never_reset_pin_number(EFUSE_SPICONFIG_RET_SPIHD(spiconfig));
|
||||
never_reset_pin_number(bootloader_flash_get_wp_pin());
|
||||
}
|
||||
#endif
|
||||
#endif // CONFIG_IDF_TARGET_ESP32
|
||||
}
|
||||
|
||||
safe_mode_t port_init(void) {
|
||||
|
@ -89,6 +89,8 @@ STATIC mp_obj_t adafruit_bus_device_spidevice_make_new(const mp_obj_type_t *type
|
||||
|
||||
busio_spi_obj_t *spi = args[ARG_spi].u_obj;
|
||||
|
||||
mp_arg_validate_type(args[ARG_chip_select].u_obj, &digitalio_digitalinout_type, MP_QSTR_chip_select);
|
||||
|
||||
common_hal_adafruit_bus_device_spidevice_construct(MP_OBJ_TO_PTR(self), spi, args[ARG_chip_select].u_obj, args[ARG_cs_active_value].u_bool, args[ARG_baudrate].u_int, args[ARG_polarity].u_int,
|
||||
args[ARG_phase].u_int, args[ARG_extra_clocks].u_int);
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "extmod/vfs_fat.h"
|
||||
#include "py/mpstate.h"
|
||||
#include "py/objstr.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
|
||||
STATIC uint8_t consume_spaces(FIL *active_file) {
|
||||
uint8_t character = ' ';
|
||||
@ -189,7 +190,7 @@ STATIC mp_int_t read_value(FIL *active_file, char *value, size_t value_len) {
|
||||
|
||||
mp_int_t dotenv_get_key(const char *path, const char *key, char *value, mp_int_t value_len) {
|
||||
FIL active_file;
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
FRESULT result = f_open(fs, &active_file, path, FA_READ);
|
||||
if (result != FR_OK) {
|
||||
return -1;
|
||||
|
@ -45,4 +45,6 @@ void filesystem_set_concurrent_write_protection(fs_user_mount_t *vfs, bool concu
|
||||
bool filesystem_is_writable_by_python(fs_user_mount_t *vfs);
|
||||
bool filesystem_is_writable_by_usb(fs_user_mount_t *vfs);
|
||||
|
||||
FATFS *filesystem_circuitpy(void);
|
||||
|
||||
#endif // MICROPY_INCLUDED_SUPERVISOR_FILESYSTEM_H
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "common-hal/_bleio/__init__.h"
|
||||
|
||||
#include "supervisor/fatfs_port.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "supervisor/shared/reload.h"
|
||||
#include "supervisor/shared/bluetooth/file_transfer.h"
|
||||
#include "supervisor/shared/bluetooth/file_transfer_protocol.h"
|
||||
@ -172,7 +173,7 @@ STATIC uint8_t _process_read(const uint8_t *raw_buf, size_t command_len) {
|
||||
char *path = (char *)((uint8_t *)command) + header_size;
|
||||
path[command->path_length] = '\0';
|
||||
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
FRESULT result = f_open(fs, &active_file, path, FA_READ);
|
||||
if (result != FR_OK) {
|
||||
response.status = STATUS_ERROR;
|
||||
@ -289,7 +290,7 @@ STATIC uint8_t _process_write(const uint8_t *raw_buf, size_t command_len) {
|
||||
return ANY_COMMAND;
|
||||
}
|
||||
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
DWORD fattime;
|
||||
_truncated_time = truncate_time(command->modification_time, &fattime);
|
||||
override_fattime(fattime);
|
||||
@ -438,7 +439,7 @@ STATIC uint8_t _process_delete(const uint8_t *raw_buf, size_t command_len) {
|
||||
if (command_len < header_size + command->path_length) {
|
||||
return THIS_COMMAND;
|
||||
}
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
char *path = (char *)((uint8_t *)command) + header_size;
|
||||
path[command->path_length] = '\0';
|
||||
FILINFO file;
|
||||
@ -495,7 +496,7 @@ STATIC uint8_t _process_mkdir(const uint8_t *raw_buf, size_t command_len) {
|
||||
if (command_len < header_size + command->path_length) {
|
||||
return THIS_COMMAND;
|
||||
}
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
char *path = (char *)command->path;
|
||||
_terminate_path(path, command->path_length);
|
||||
|
||||
@ -552,7 +553,7 @@ STATIC uint8_t _process_listdir(uint8_t *raw_buf, size_t command_len) {
|
||||
return THIS_COMMAND;
|
||||
}
|
||||
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
char *path = (char *)&command->path;
|
||||
_terminate_path(path, command->path_length);
|
||||
// mp_printf(&mp_plat_print, "list %s\n", path);
|
||||
@ -640,7 +641,7 @@ STATIC uint8_t _process_move(const uint8_t *raw_buf, size_t command_len) {
|
||||
if (command_len < header_size + total_path_length) {
|
||||
return THIS_COMMAND;
|
||||
}
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
char *old_path = (char *)command->paths;
|
||||
old_path[command->old_path_length] = '\0';
|
||||
|
||||
|
@ -92,6 +92,9 @@ bool filesystem_init(bool create_allowed, bool force_create) {
|
||||
vfs_fat->blockdev.flags = 0;
|
||||
supervisor_flash_init_vfs(vfs_fat);
|
||||
|
||||
mp_vfs_mount_t *vfs = &_mp_vfs;
|
||||
vfs->len = 0;
|
||||
|
||||
// try to mount the flash
|
||||
FRESULT res = f_mount(&vfs_fat->fatfs);
|
||||
if ((res == FR_NO_FILESYSTEM && create_allowed) || force_create) {
|
||||
@ -140,7 +143,6 @@ bool filesystem_init(bool create_allowed, bool force_create) {
|
||||
} else if (res != FR_OK) {
|
||||
return false;
|
||||
}
|
||||
mp_vfs_mount_t *vfs = &_mp_vfs;
|
||||
vfs->str = "/";
|
||||
vfs->len = 1;
|
||||
vfs->obj = MP_OBJ_FROM_PTR(vfs_fat);
|
||||
@ -199,5 +201,12 @@ void filesystem_set_concurrent_write_protection(fs_user_mount_t *vfs, bool concu
|
||||
}
|
||||
|
||||
bool filesystem_present(void) {
|
||||
return true;
|
||||
return _mp_vfs.len > 0;
|
||||
}
|
||||
|
||||
FATFS *filesystem_circuitpy(void) {
|
||||
if (!filesystem_present()) {
|
||||
return NULL;
|
||||
}
|
||||
return &_internal_vfs.fatfs;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "shared-module/storage/__init__.h"
|
||||
#include "shared/timeutils/timeutils.h"
|
||||
#include "supervisor/fatfs_port.h"
|
||||
#include "supervisor/filesystem.h"
|
||||
#include "supervisor/shared/reload.h"
|
||||
#include "supervisor/shared/translate/translate.h"
|
||||
#include "supervisor/shared/web_workflow/web_workflow.h"
|
||||
@ -575,7 +576,7 @@ static void _reply_redirect(socketpool_socket_obj_t *socket, _request *request,
|
||||
lwip_setsockopt(socket->num, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay));
|
||||
const char *hostname = common_hal_mdns_server_get_hostname(&mdns);
|
||||
_send_strs(socket,
|
||||
"HTTP/1.1 301 Moved Permanently\r\n",
|
||||
"HTTP/1.1 307 Temporary Redirect\r\n",
|
||||
"Connection: close\r\n",
|
||||
"Content-Length: 0\r\n",
|
||||
"Location: ", NULL);
|
||||
@ -979,7 +980,7 @@ static bool _reply(socketpool_socket_obj_t *socket, _request *request) {
|
||||
} else {
|
||||
char *path = request->path + 3;
|
||||
size_t pathlen = strlen(path);
|
||||
FATFS *fs = &((fs_user_mount_t *)MP_STATE_VM(vfs_mount_table)->obj)->fatfs;
|
||||
FATFS *fs = filesystem_circuitpy();
|
||||
// Trailing / is a directory.
|
||||
bool directory = false;
|
||||
if (path[pathlen - 1] == '/') {
|
||||
|
Loading…
Reference in New Issue
Block a user