Merge remote-tracking branch 'upstream/main' into jerryn_gpio

This commit is contained in:
jerryneedell 2021-12-29 12:58:41 -05:00
commit 7cdffba09f
54 changed files with 178 additions and 127 deletions

@ -1 +1 @@
Subproject commit ca141954c0b39cc0343c63bedb64c02f307159b9
Subproject commit 0ec87891f9a28ee3c5ae3b020b60d361684f466d

View File

@ -669,6 +669,10 @@ msgstr "Bytes harus di antara 0 dan 255."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr "Blok CBC harus merupakan kelipatan 16 byte"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr ""

View File

@ -659,6 +659,10 @@ msgstr ""
msgid "CBC blocks must be multiples of 16 bytes"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr ""

View File

@ -668,6 +668,10 @@ msgstr ""
msgid "CBC blocks must be multiples of 16 bytes"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr ""

View File

@ -670,6 +670,10 @@ msgstr "Ein Bytes kann nur Werte zwischen 0 und 255 annehmen."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr "CBC-Blöcke müssen ein Vielfaches von 16 Bytes sein"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr "CRC oder Checksumme ungültig"

View File

@ -659,6 +659,10 @@ msgstr ""
msgid "CBC blocks must be multiples of 16 bytes"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr ""

View File

@ -670,6 +670,10 @@ msgstr "Bytes must be between 0 and 255."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr "CBC blocks must be multiples of 16 bytes"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr "CRC or checksum was invalid"

View File

@ -675,6 +675,10 @@ msgstr "Bytes debe estar entre 0 y 255."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr "Los bloques CBC deben ser múltiplos de 16 bytes"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr "CRC o suma de comprobación inválida"

View File

@ -667,6 +667,10 @@ msgstr "Sa gitna ng 0 o 255 dapat ang bytes."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr ""

View File

@ -676,6 +676,10 @@ msgstr "Les octets 'bytes' doivent être entre 0 et 255."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr "Les blocs CBC doivent être des multiples de 16 octets"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr "CRC ou somme de contrôle invalide"

View File

@ -659,6 +659,10 @@ msgstr ""
msgid "CBC blocks must be multiples of 16 bytes"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr ""

View File

@ -674,6 +674,10 @@ msgstr "I byte devono essere compresi tra 0 e 255."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr "I blocchi CBC devono essere multipli di 16 bytes"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr "CRC o controllo totale è risultato non valido"

View File

@ -666,6 +666,10 @@ msgstr "バイト値は0から255の間でなければなりません"
msgid "CBC blocks must be multiples of 16 bytes"
msgstr "CBCブロックは16バイトの整数倍でなければなりません"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr ""

View File

@ -662,6 +662,10 @@ msgstr "바이트는 0에서 255 사이 여야합니다."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr ""
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr ""

View File

@ -664,6 +664,10 @@ msgstr "Bytes moeten tussen 0 en 255 liggen."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr "CBC blocks moeten meervouden van 16 bytes zijn"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr ""

View File

@ -666,6 +666,10 @@ msgstr "Bytes musi być między 0 a 255."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr "Bloki CBC muszą być wielokrotnościami 16 bajtów"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr ""

View File

@ -679,6 +679,10 @@ msgstr "Os bytes devem estar entre 0 e 255."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr "Os blocos CBC devem ter múltiplos de 16 bytes"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr "CRC ou checksum inválido"

View File

@ -677,6 +677,10 @@ msgstr "Bytes должен быть в диапазоне от 0 до 255."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr "Блоки CBC должны быть кратны 16 байтам"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr "CRC или контрольная сумма неправильная"

View File

@ -669,6 +669,10 @@ msgstr "Bytes måste vara mellan 0 och 255."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr "CBC-block måste vara multiplar om 16 byte"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr "CRC eller checksumma var ogiltig"

View File

@ -648,7 +648,7 @@ msgid "Buffer must be at least length 1"
msgstr "Huǎnchōng qū bìxū zhìshǎo chángdù wéi 1"
#: shared-bindings/_bleio/PacketBuffer.c
#, c-format, fuzzy
#, fuzzy, c-format
msgid "Buffer too short by %d bytes"
msgstr "Huǎn chōng qū tài duǎn , àn %d zì jié"
@ -676,6 +676,10 @@ msgstr "Zìjié bìxū jiè yú 0 dào 255 zhījiān."
msgid "CBC blocks must be multiples of 16 bytes"
msgstr "CBC kuài bìxū shì 16 zìjié de bèishù"
#: supervisor/shared/safe_mode.c
msgid "CIRCUITPY drive could not be found or created."
msgstr ""
#: ports/espressif/bindings/espidf/__init__.c ports/espressif/esp_error.c
msgid "CRC or checksum was invalid"
msgstr "CRC huò jiàoyàn hé wúxiào"

6
main.c
View File

@ -811,7 +811,11 @@ int __attribute__((used)) main(void) {
// Create a new filesystem only if we're not in a safe mode.
// A power brownout here could make it appear as if there's
// no SPI flash filesystem, and we might erase the existing one.
filesystem_init(safe_mode == NO_SAFE_MODE, false);
// Check whether CIRCUITPY is available. Don't check if it already hasn't been found.
if ((safe_mode != NO_CIRCUITPY) && !filesystem_init(safe_mode == NO_SAFE_MODE, false)) {
reset_into_safe_mode(NO_CIRCUITPY);
}
// displays init after filesystem, since they could share the flash SPI
board_init();

View File

@ -8,6 +8,7 @@ CHIP_FAMILY = samd51
QSPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICES = "W25Q128JVxM"
LONGINT_IMPL = MPZ
# No I2S on SAMD51G.
CIRCUITPY_AUDIOBUSIO = 0

View File

@ -2,22 +2,6 @@
# parameters that vary based on chip and/or board.
LD_TEMPLATE_FILE = boards/common.template.ld
# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
ifeq ($(LONGINT_IMPL),NONE)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=none
endif
ifeq ($(LONGINT_IMPL),MPZ)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
endif
ifeq ($(LONGINT_IMPL),LONGLONG)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=longlong
endif
INTERNAL_LIBM = 1
# Number of USB endpoint pairs.

View File

@ -1,19 +1,3 @@
# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
ifeq ($(LONGINT_IMPL),NONE)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=none
endif
ifeq ($(LONGINT_IMPL),MPZ)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
endif
ifeq ($(LONGINT_IMPL),LONGLONG)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=longlong
endif
# All broadcom ports have longints.
LONGINT_IMPL = MPZ

View File

@ -3,11 +3,6 @@ USB_HIGHSPEED = 1
# Number of USB endpoint pairs.
USB_NUM_ENDPOINT_PAIRS = 6
# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
# Longints can be implemented as mpz, as longlong, or not
LONGINT_IMPL = MPZ

View File

@ -27,6 +27,7 @@
#include "supervisor/board.h"
#include "mpconfigboard.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "components/driver/include/driver/gpio.h"
void board_init(void) {
// USB
@ -39,7 +40,9 @@ bool board_requests_safe_mode(void) {
}
void reset_board(void) {
// Turn on I2C power by default.
gpio_set_direction(7, GPIO_MODE_DEF_OUTPUT);
gpio_set_level(7, false);
}
void board_deinit(void) {

View File

@ -14,8 +14,8 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_I2C_POWER_INVERTED), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_D7), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) },

View File

@ -1,8 +1,3 @@
# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
# Internal math library is substantially smaller than toolchain one
INTERNAL_LIBM = 1

View File

@ -1,8 +1,3 @@
# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
# Internal math library is substantially smaller than toolchain one
INTERNAL_LIBM = 1

View File

@ -1,17 +1,5 @@
LD_FILE = $(FLASH).ld $(CHIP_FAMILY).ld imxrt10xx.ld
ifeq ($(LONGINT_IMPL),NONE)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=none
endif
ifeq ($(LONGINT_IMPL),MPZ)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
endif
ifeq ($(LONGINT_IMPL),LONGLONG)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=longlong
endif
INTERNAL_LIBM = 1
USB_HIGHSPEED = 1

View File

@ -2,11 +2,6 @@
# parameters that vary based on chip and/or board.
LD_TEMPLATE_FILE = boards/common.template.ld
# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
INTERNAL_LIBM = 1
# Number of USB endpoint pairs.

View File

@ -33,6 +33,7 @@
#include "shared-module/rgbmatrix/RGBMatrix.h"
#include "src/rp2_common/hardware_pwm/include/hardware/pwm.h"
#include "src/rp2_common/hardware_irq/include/hardware/irq.h"
void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self) {
// Choose a PWM channel based on the first RGB pin
@ -58,6 +59,8 @@ void common_hal_rgbmatrix_timer_enable(void *ptr) {
void common_hal_rgbmatrix_timer_disable(void *ptr) {
int8_t slice = ((intptr_t)ptr) & 0xff;
pwm_set_enabled(slice, false);
irq_set_enabled(PWM_IRQ_WRAP, false);
pwm_clear_irq(slice);
}
void common_hal_rgbmatrix_timer_free(void *ptr) {
@ -65,6 +68,8 @@ void common_hal_rgbmatrix_timer_free(void *ptr) {
uint8_t slice = value & 0xff;
uint8_t channel = value >> 8;
pwm_set_enabled(slice, false);
irq_set_enabled(PWM_IRQ_WRAP, false);
pwm_clear_irq(slice);
pwmout_free(slice, channel);
return;
}

View File

@ -1,19 +1,3 @@
# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
ifeq ($(LONGINT_IMPL),NONE)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=none
endif
ifeq ($(LONGINT_IMPL),MPZ)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
endif
ifeq ($(LONGINT_IMPL),LONGLONG)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=longlong
endif
# All raspberrypi ports have longints.
LONGINT_IMPL = MPZ

View File

@ -1,4 +1,3 @@
MPY_TOOL_LONGINT_IMPL ?= -mlongint-impl=mpz
LONGINT_IMPL ?= MPZ
INTERNAL_LIBM ?= 1

View File

@ -85,23 +85,6 @@ CFLAGS += -DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
CFLAGS += -DMICROPY_MODULE_FROZEN_MPY
endif
###
# Propagate longint choice from .mk to C. There's no easy string comparison
# in cpp conditionals, so we #define separate names for each.
ifeq ($(LONGINT_IMPL),NONE)
CFLAGS += -DLONGINT_IMPL_NONE
endif
ifeq ($(LONGINT_IMPL),MPZ)
CFLAGS += -DLONGINT_IMPL_MPZ
endif
ifeq ($(LONGINT_IMPL),LONGLONG)
CFLAGS += -DLONGINT_IMPL_LONGLONG
endif
###
# Select which builtin modules to compile and include.
@ -524,8 +507,8 @@ SRC_SHARED_MODULE_ALL = \
bitops/__init__.c \
board/__init__.c \
adafruit_bus_device/__init__.c \
adafruit_bus_device/I2CDevice.c \
adafruit_bus_device/SPIDevice.c \
adafruit_bus_device/i2c_device/I2CDevice.c \
adafruit_bus_device/spi_device/SPIDevice.c \
canio/Match.c \
canio/Message.c \
canio/RemoteTransmissionRequest.c \

View File

@ -462,3 +462,31 @@ CFLAGS += -DCIRCUITPY_WATCHDOG=$(CIRCUITPY_WATCHDOG)
CIRCUITPY_WIFI ?= 0
CFLAGS += -DCIRCUITPY_WIFI=$(CIRCUITPY_WIFI)
# Define an equivalent for MICROPY_LONGINT_IMPL, to pass to $(MPY-TOOL) in py/mkrules.mk
# $(MPY-TOOL) needs to know what kind of longint to use (if any) to freeze long integers.
# This should correspond to the MICROPY_LONGINT_IMPL definition in mpconfigport.h.
#
# Also propagate longint choice from .mk to C. There's no easy string comparison
# in cpp conditionals, so we #define separate names for each.
ifeq ($(LONGINT_IMPL),NONE)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=none
CFLAGS += -DLONGINT_IMPL_NONE
else ifeq ($(LONGINT_IMPL),MPZ)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=mpz
CFLAGS += -DLONGINT_IMPL_MPZ
else ifeq ($(LONGINT_IMPL),LONGLONG)
MPY_TOOL_LONGINT_IMPL = -mlongint-impl=longlong
CFLAGS += -DLONGINT_IMPL_LONGLONG
else
$(error LONGINT_IMPL set to surprising value: "$(LONGINT_IMPL)")
endif
###
ifeq ($(LONGINT_IMPL),NONE)
else ifeq ($(LONGINT_IMPL),MPZ)
else ifeq ($(LONGINT_IMPL),LONGLONG)
else
$(error LONGINT_IMPL set to surprising value: "$(LONGINT_IMPL)")
endif

View File

@ -6,6 +6,7 @@ twine
wheel
astroid
setuptools
setuptools_scm
# For sphinx
sphinx>=4.0.0

View File

@ -32,8 +32,8 @@
#include "py/objproperty.h"
#include "shared-bindings/adafruit_bus_device/__init__.h"
#include "shared-bindings/adafruit_bus_device/I2CDevice.h"
#include "shared-bindings/adafruit_bus_device/SPIDevice.h"
#include "shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.h"
#include "shared-bindings/adafruit_bus_device/spi_device/SPIDevice.h"
STATIC const mp_rom_map_elem_t adafruit_bus_device_i2c_device_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_i2c_device) },

View File

@ -28,9 +28,9 @@
// busio.I2C class.
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/adafruit_bus_device/I2CDevice.h"
#include "shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.h"
#include "shared-bindings/util.h"
#include "shared-module/adafruit_bus_device/I2CDevice.h"
#include "shared-module/adafruit_bus_device/i2c_device/I2CDevice.h"
#include "shared/runtime/buffer_helper.h"
#include "shared/runtime/context_manager_helpers.h"

View File

@ -36,7 +36,7 @@
#include "py/obj.h"
#include "shared-module/adafruit_bus_device/I2CDevice.h"
#include "shared-module/adafruit_bus_device/i2c_device/I2CDevice.h"
// #include "shared-bindings/busio/I2C.h"
// Type object used in Python. Should be shared between ports.

View File

@ -25,9 +25,9 @@
*/
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/adafruit_bus_device/SPIDevice.h"
#include "shared-bindings/adafruit_bus_device/spi_device/SPIDevice.h"
#include "shared-bindings/util.h"
#include "shared-module/adafruit_bus_device/SPIDevice.h"
#include "shared-module/adafruit_bus_device/spi_device/SPIDevice.h"
#include "common-hal/digitalio/DigitalInOut.h"
#include "shared-bindings/digitalio/DigitalInOut.h"

View File

@ -36,7 +36,7 @@
#include "py/obj.h"
#include "shared-module/adafruit_bus_device/SPIDevice.h"
#include "shared-module/adafruit_bus_device/spi_device/SPIDevice.h"
// Type object used in Python. Should be shared between ports.
extern const mp_obj_type_t adafruit_bus_device_spidevice_type;

View File

@ -36,6 +36,25 @@
#include "shared-bindings/util.h"
#include "supervisor/shared/translate.h"
//| from typing_extensions import Protocol # for compat with python < 3.8
//|
//| class FontProtocol(Protocol):
//| """A protocol shared by `BuiltinFont` and classes in ``adafruit_bitmap_font``"""
//| def get_bounding_box(self) -> Union[Tuple[int, int], Tuple[int, int, int, int]]:
//| """Retrieve the maximum bounding box of any glyph in the font.
//|
//| The four element version is ``(width, height, x_offset, y_offset)``.
//| The two element version is ``(width, height)``, in which
//| ``x_offset`` and ``y_offset`` are assumed to be zero."""
//| pass
//|
//| def get_glyph(self, codepoint: int) -> Optional[Glyph]:
//| """Retrieve the Glyph for a given code point
//|
//| If the code point is not present in the font, `None` is returned."""
//| pass
//|
//| class BuiltinFont:
//| """A font built into CircuitPython"""
//|

View File

@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
#include "shared-bindings/adafruit_bus_device/I2CDevice.h"
#include "shared-bindings/adafruit_bus_device/i2c_device/I2CDevice.h"
#include "shared-bindings/busio/I2C.h"
#include "py/mperrno.h"
#include "py/nlr.h"

View File

@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
#include "shared-bindings/adafruit_bus_device/SPIDevice.h"
#include "shared-bindings/adafruit_bus_device/spi_device/SPIDevice.h"
#include "shared-bindings/busio/SPI.h"
#include "shared-bindings/digitalio/DigitalInOut.h"
#include "py/mperrno.h"

View File

@ -271,7 +271,7 @@ void common_hal_storage_erase_filesystem(void) {
usb_disconnect();
#endif
mp_hal_delay_ms(1000);
filesystem_init(false, true); // Force a re-format.
(void)filesystem_init(false, true); // Force a re-format. Ignore failure.
common_hal_mcu_reset();
// We won't actually get here, since we're resetting.
}

View File

@ -35,7 +35,7 @@ extern volatile bool filesystem_flush_requested;
void filesystem_background(void);
void filesystem_tick(void);
void filesystem_init(bool create_allowed, bool force_create);
bool filesystem_init(bool create_allowed, bool force_create);
void filesystem_flush(void);
bool filesystem_present(void);
void filesystem_set_internal_writable_by_usb(bool usb_writable);

View File

@ -86,7 +86,7 @@ static void make_sample_code_file(FATFS *fatfs) {
// we don't make this function static because it needs a lot of stack and we
// want it to be executed without using stack within main() function
void filesystem_init(bool create_allowed, bool force_create) {
bool filesystem_init(bool create_allowed, bool force_create) {
// init the vfs object
fs_user_mount_t *vfs_fat = &_internal_vfs;
vfs_fat->blockdev.flags = 0;
@ -102,11 +102,11 @@ void filesystem_init(bool create_allowed, bool force_create) {
formats |= FM_EXFAT | FM_FAT32;
#endif
res = f_mkfs(&vfs_fat->fatfs, formats, 0, working_buf, sizeof(working_buf));
if (res != FR_OK) {
return false;
}
// Flush the new file system to make sure it's repaired immediately.
supervisor_flash_flush();
if (res != FR_OK) {
return;
}
// set label
#ifdef CIRCUITPY_DRIVE_LABEL
@ -115,13 +115,13 @@ void filesystem_init(bool create_allowed, bool force_create) {
res = f_setlabel(&vfs_fat->fatfs, "CIRCUITPY");
#endif
if (res != FR_OK) {
return;
return false;
}
// inhibit file indexing on MacOS
res = f_mkdir(&vfs_fat->fatfs, "/.fseventsd");
if (res != FR_OK) {
return;
return false;
}
make_empty_file(&vfs_fat->fatfs, "/.metadata_never_index");
make_empty_file(&vfs_fat->fatfs, "/.Trashes");
@ -132,13 +132,13 @@ void filesystem_init(bool create_allowed, bool force_create) {
// create empty lib directory
res = f_mkdir(&vfs_fat->fatfs, "/lib");
if (res != FR_OK) {
return;
return false;
}
// and ensure everything is flushed
supervisor_flash_flush();
} else if (res != FR_OK) {
return;
return false;
}
mp_vfs_mount_t *vfs = &_mp_vfs;
vfs->str = "/";
@ -150,6 +150,8 @@ void filesystem_init(bool create_allowed, bool force_create) {
// The current directory is used as the boot up directory.
// It is set to the internal flash filesystem by default.
MP_STATE_PORT(vfs_cur) = vfs;
return true;
}
void filesystem_flush(void) {

View File

@ -175,6 +175,9 @@ void print_safe_mode_message(safe_mode_t reason) {
case WATCHDOG_RESET:
message = translate("Watchdog timer expired.");
break;
case NO_CIRCUITPY:
message = translate("CIRCUITPY drive could not be found or created.");
break;
default:
break;
}

View File

@ -48,6 +48,7 @@ typedef enum {
USB_TOO_MANY_INTERFACE_NAMES,
USB_BOOT_DEVICE_NOT_INTERFACE_ZERO,
NO_HEAP,
NO_CIRCUITPY,
} safe_mode_t;
safe_mode_t wait_for_safe_mode_reset(void);

View File

@ -26,9 +26,10 @@
#include "supervisor/filesystem.h"
void filesystem_init(bool create_allowed, bool force_create) {
bool filesystem_init(bool create_allowed, bool force_create) {
(void)create_allowed;
(void)force_create;
return true;
}
void filesystem_flush(void) {

View File

@ -49,7 +49,12 @@ def copy_and_process(in_dir, out_dir):
# Skip library examples directory and subfolders.
relative_path_parts = Path(root).relative_to(in_dir).parts
if relative_path_parts and relative_path_parts[0] in ["examples", "docs", "tests"]:
if relative_path_parts and relative_path_parts[0] in [
"examples",
"docs",
"tests",
"utils",
]:
del subdirs[:]
continue