Merge branch 'adafruit:main' into seeed_xiao_esp32s3
This commit is contained in:
commit
66920801a2
45 changed files with 180 additions and 45 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -344,8 +344,7 @@
|
|||
url = https://github.com/adafruit/Adafruit_CircuitPython_Wave.git
|
||||
[submodule "ports/raspberrypi/lib/Pico-PIO-USB"]
|
||||
path = ports/raspberrypi/lib/Pico-PIO-USB
|
||||
url = https://github.com/adafruit/Pico-PIO-USB.git
|
||||
branch = sdk2_fix
|
||||
url = https://github.com/sekigon-gonnoc/Pico-PIO-USB.git
|
||||
[submodule "lib/micropython-lib"]
|
||||
path = lib/micropython-lib
|
||||
url = https://github.com/micropython/micropython-lib.git
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"PO-Revision-Date: 2024-08-10 14:09+0000\n"
|
||||
"PO-Revision-Date: 2024-08-28 18:09+0000\n"
|
||||
"Last-Translator: Andi Chandler <andi@gowling.com>\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: en_GB\n"
|
||||
|
|
@ -15,7 +15,7 @@ msgstr ""
|
|||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: Weblate 5.7-dev\n"
|
||||
"X-Generator: Weblate 5.7.1-dev\n"
|
||||
|
||||
#: main.c
|
||||
msgid ""
|
||||
|
|
@ -3553,7 +3553,7 @@ msgstr "name not defined"
|
|||
|
||||
#: py/qstr.c
|
||||
msgid "name too long"
|
||||
msgstr ""
|
||||
msgstr "name too long"
|
||||
|
||||
#: py/persistentcode.c
|
||||
msgid "native code in .mpy unsupported"
|
||||
|
|
|
|||
|
|
@ -9,3 +9,6 @@ CHIP_FAMILY = samd21
|
|||
SPI_FLASH_FILESYSTEM = 1
|
||||
EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ"
|
||||
LONGINT_IMPL = MPZ
|
||||
|
||||
CIRCUITPY_CODEOP = 0
|
||||
CIRCUITPY_PARALLELDISPLAYBUS = 0
|
||||
|
|
|
|||
|
|
@ -147,6 +147,9 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
|
|||
}
|
||||
|
||||
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
|
||||
if (common_hal_busio_i2c_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
CRITICAL_SECTION_ENTER()
|
||||
if (!self->has_lock) {
|
||||
|
|
|
|||
|
|
@ -222,6 +222,9 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
|
|||
}
|
||||
|
||||
bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
|
||||
if (common_hal_busio_spi_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
CRITICAL_SECTION_ENTER()
|
||||
if (!self->has_lock) {
|
||||
|
|
|
|||
|
|
@ -109,6 +109,9 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
|
|||
}
|
||||
|
||||
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
|
||||
if (common_hal_busio_i2c_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
if (!self->has_lock) {
|
||||
grabbed_lock = true;
|
||||
|
|
|
|||
|
|
@ -200,6 +200,9 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
|
|||
}
|
||||
|
||||
bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
|
||||
if (common_hal_busio_spi_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
if (!self->has_lock) {
|
||||
grabbed_lock = true;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ bool common_hal_busio_i2c_deinited(busio_i2c_obj_t *self) {
|
|||
}
|
||||
|
||||
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
|
||||
if (common_hal_busio_i2c_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
if (!self->has_lock) {
|
||||
grabbed_lock = true;
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self, uint32_t baudrate, ui
|
|||
}
|
||||
|
||||
bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
|
||||
if (common_hal_busio_spi_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
if (!self->has_lock) {
|
||||
grabbed_lock = true;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#include "py/objproperty.h"
|
||||
|
||||
//| class ULP:
|
||||
//| def __init__(self, arch: Architecture = Architecture.FSM):
|
||||
//| def __init__(self, arch: Architecture = Architecture.FSM) -> None:
|
||||
//| """The ultra-low-power processor.
|
||||
//|
|
||||
//| Raises an exception if another ULP has been instantiated. This
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ IDF_TARGET = esp32s3
|
|||
|
||||
CIRCUITPY_ESP_FLASH_SIZE = 16MB
|
||||
CIRCUITPY_ESP_FLASH_MODE = qio
|
||||
CIRCUITPY_ESP_FLASH_FREQ = 80m
|
||||
CIRCUITPY_ESP_FLASH_FREQ = 120m
|
||||
|
||||
CIRCUITPY_ESP_PSRAM_SIZE = 8MB
|
||||
CIRCUITPY_ESP_PSRAM_MODE = opi
|
||||
CIRCUITPY_ESP_PSRAM_FREQ = 80m
|
||||
CIRCUITPY_ESP_PSRAM_FREQ = 120m
|
||||
|
||||
CIRCUITPY_DOTCLOCKFRAMEBUFFER = 1
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ void common_hal_analogbufio_bufferedin_construct(analogbufio_bufferedin_obj_t *s
|
|||
}
|
||||
#endif
|
||||
|
||||
mp_arg_validate_int_range(sample_rate, SOC_ADC_SAMPLE_FREQ_THRES_LOW, SOC_ADC_SAMPLE_FREQ_THRES_HIGH, MP_QSTR_sample_rate);
|
||||
|
||||
common_hal_mcu_pin_claim(pin);
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +111,7 @@ static void start_dma(analogbufio_bufferedin_obj_t *self, adc_digi_convert_mode_
|
|||
};
|
||||
|
||||
#if defined(DEBUG_ANALOGBUFIO)
|
||||
mp_printf(&mp_plat_print, "pin:%d, ADC channel:%d, ADC index:%d, adc1_chan_mask:0x%x, adc2_chan_mask:0x%x\n", pin->number, pin->adc_channel, pin->adc_index, adc1_chan_mask, adc2_chan_mask);
|
||||
mp_printf(&mp_plat_print, "pin:%d, ADC channel:%d, ADC index:%d\n", pin->number, pin->adc_channel, pin->adc_index);
|
||||
#endif // DEBUG_ANALOGBUFIO
|
||||
esp_err_t err = adc_continuous_new_handle(&adc_dma_config, &self->handle);
|
||||
if (ESP_OK != err) {
|
||||
|
|
|
|||
|
|
@ -141,6 +141,9 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
|
|||
}
|
||||
|
||||
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
|
||||
if (common_hal_busio_i2c_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
if (self->has_lock) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
15
ports/espressif/esp-idf-config/sdkconfig-flash-120m.defaults
Normal file
15
ports/espressif/esp-idf-config/sdkconfig-flash-120m.defaults
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
CONFIG_ESPTOOLPY_FLASHFREQ_120M=y
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_64M is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_60M is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_48M is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_32M is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_30M is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_24M is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_16M is not set
|
||||
# CONFIG_ESPTOOLPY_FLASHFREQ_15M is not set
|
||||
CONFIG_ESPTOOLPY_FLASHFREQ_80M_DEFAULT=y
|
||||
CONFIG_SPI_FLASH_UNDER_HIGH_FREQ=y
|
||||
|
|
@ -489,16 +489,6 @@ void port_post_boot_py(bool heap_valid) {
|
|||
}
|
||||
|
||||
|
||||
#if CIRCUITPY_CONSOLE_UART
|
||||
static int vprintf_adapter(const char *fmt, va_list ap) {
|
||||
return mp_vprintf(&mp_plat_print, fmt, ap);
|
||||
}
|
||||
|
||||
void port_serial_early_init(void) {
|
||||
esp_log_set_vprintf(vprintf_adapter);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Wrap main in app_main that the IDF expects.
|
||||
extern void main(void);
|
||||
extern void app_main(void);
|
||||
|
|
|
|||
|
|
@ -76,9 +76,7 @@ FLASH_MODE_SETTINGS = [
|
|||
"CONFIG_ESPTOOLPY_FLASH_SAMBLE_MODE_",
|
||||
]
|
||||
|
||||
FLASH_FREQ_SETTINGS = [
|
||||
"CONFIG_ESPTOOLPY_FLASHFREQ_",
|
||||
]
|
||||
FLASH_FREQ_SETTINGS = ["CONFIG_ESPTOOLPY_FLASHFREQ_", "CONFIG_SPI_FLASH_UNDER_HIGH_FREQ"]
|
||||
|
||||
PSRAM_SETTINGS = ["CONFIG_SPIRAM"]
|
||||
|
||||
|
|
|
|||
|
|
@ -187,6 +187,9 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
|
|||
}
|
||||
|
||||
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
|
||||
if (common_hal_busio_i2c_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
// CRITICAL_SECTION_ENTER()
|
||||
if (!self->has_lock) {
|
||||
|
|
|
|||
|
|
@ -272,6 +272,9 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
|
|||
}
|
||||
|
||||
bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
|
||||
if (common_hal_busio_spi_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
// CRITICAL_SECTION_ENTER()
|
||||
if (!self->has_lock) {
|
||||
|
|
|
|||
|
|
@ -216,6 +216,9 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
|
|||
}
|
||||
|
||||
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
|
||||
if (common_hal_busio_i2c_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
// NRFX_CRITICAL_SECTION_ENTER();
|
||||
if (!self->has_lock) {
|
||||
|
|
|
|||
|
|
@ -213,6 +213,9 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self, uint32_t baudrate, ui
|
|||
}
|
||||
|
||||
bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
|
||||
if (common_hal_busio_spi_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
// NRFX_CRITICAL_SECTION_ENTER();
|
||||
if (!self->has_lock) {
|
||||
|
|
|
|||
|
|
@ -130,6 +130,9 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
|
|||
}
|
||||
|
||||
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
|
||||
if (common_hal_busio_i2c_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
if (!self->has_lock) {
|
||||
grabbed_lock = true;
|
||||
|
|
|
|||
|
|
@ -150,6 +150,9 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
|
|||
}
|
||||
|
||||
bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
|
||||
if (common_hal_busio_spi_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
if (!self->has_lock) {
|
||||
grabbed_lock = true;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 0a14a34f7f31efb03c8435ade7f9f7122b19936c
|
||||
Subproject commit fe9133fc513b82cc3dc62c67cb51f2339cf29ef7
|
||||
|
|
@ -31,6 +31,9 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
|
|||
}
|
||||
|
||||
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
|
||||
if (common_hal_busio_i2c_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
|
|||
}
|
||||
|
||||
bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
|
||||
if (common_hal_busio_spi_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -125,6 +125,9 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
|
|||
|
||||
// Lock I2C bus
|
||||
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
|
||||
if (common_hal_busio_i2c_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
|
||||
if (!self->has_lock) {
|
||||
|
|
|
|||
|
|
@ -186,6 +186,9 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
|
|||
|
||||
// Lock SPI bus
|
||||
bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
|
||||
if (common_hal_busio_spi_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
if (!self->has_lock) {
|
||||
grabbed_lock = true;
|
||||
|
|
|
|||
|
|
@ -198,6 +198,9 @@ bool common_hal_busio_i2c_probe(busio_i2c_obj_t *self, uint8_t addr) {
|
|||
}
|
||||
|
||||
bool common_hal_busio_i2c_try_lock(busio_i2c_obj_t *self) {
|
||||
if (common_hal_busio_i2c_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
|
||||
// Critical section code that may be required at some point.
|
||||
|
|
|
|||
|
|
@ -297,6 +297,9 @@ bool common_hal_busio_spi_configure(busio_spi_obj_t *self,
|
|||
}
|
||||
|
||||
bool common_hal_busio_spi_try_lock(busio_spi_obj_t *self) {
|
||||
if (common_hal_busio_spi_deinited(self)) {
|
||||
return false;
|
||||
}
|
||||
bool grabbed_lock = false;
|
||||
|
||||
// Critical section code that may be required at some point.
|
||||
|
|
|
|||
|
|
@ -80,9 +80,11 @@ static void check_for_deinit(bleio_characteristic_buffer_obj_t *self) {
|
|||
//| :rtype: bytes or None"""
|
||||
//| ...
|
||||
//|
|
||||
//| def readinto(self, buf: WriteableBuffer) -> Optional[int]:
|
||||
//| def readinto(self, buf: WriteableBuffer, nbytes: Optional[int] = None) -> Optional[int]:
|
||||
//| """Read bytes into the ``buf``. Read at most ``len(buf)`` bytes.
|
||||
//|
|
||||
//| You may reduce this maximum read using the ``nbytes`` argument.
|
||||
//|
|
||||
//| :return: number of bytes read and stored into ``buf``
|
||||
//| :rtype: int or None (on a non-blocking error)"""
|
||||
//| ...
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
//| """Cannot be instantiated directly. Use `_bleio.Adapter.start_scan`."""
|
||||
//| ...
|
||||
//|
|
||||
//| def matches(self, prefixes: ScanEntry, *, match_all: bool = True) -> bool:
|
||||
//| def matches(self, prefixes: ReadableBuffer, *, match_all: bool = True) -> bool:
|
||||
//| """Returns True if the ScanEntry matches all prefixes when ``match_all`` is True. This is stricter
|
||||
//| than the scan filtering which accepts any advertisements that match any of the prefixes
|
||||
//| where ``match_all`` is False."""
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
//| mul: float | None = None,
|
||||
//| add: float = 0,
|
||||
//| mask: displayio.Bitmap | None = None,
|
||||
//| threshold=False,
|
||||
//| threshold: bool = False,
|
||||
//| offset: int = 0,
|
||||
//| invert: bool = False,
|
||||
//| ) -> displayio.Bitmap:
|
||||
|
|
@ -406,7 +406,11 @@ static mp_obj_t bitmapfilter_mix(size_t n_args, const mp_obj_t *pos_args, mp_map
|
|||
}
|
||||
MP_DEFINE_CONST_FUN_OBJ_KW(bitmapfilter_mix_obj, 0, bitmapfilter_mix);
|
||||
|
||||
//| def solarize(bitmap, threshold: float = 0.5, mask: displayio.Bitmap | None = None):
|
||||
//| def solarize(
|
||||
//| bitmap: displayio.Bitmap,
|
||||
//| threshold: float = 0.5,
|
||||
//| mask: displayio.Bitmap | None = None,
|
||||
//| ) -> displayio.Bitmap:
|
||||
//| """Create a "solarization" effect on an image
|
||||
//|
|
||||
//| This filter inverts pixels with brightness values above ``threshold``, while leaving
|
||||
|
|
|
|||
|
|
@ -16,8 +16,12 @@ static const char *get_arg_str(mp_obj_t arg, qstr name) {
|
|||
|
||||
//| """Utilities to compile possibly incomplete Python source code."""
|
||||
//|
|
||||
//| from types import CodeType
|
||||
//|
|
||||
|
||||
//| def compile_command(source: str, filename: str = "<input>", symbol: str = "single"):
|
||||
//| def compile_command(
|
||||
//| source: str, filename: str = "<input>", symbol: str = "single"
|
||||
//| ) -> CodeType:
|
||||
//| """Compile a command and determine whether it is incomplete
|
||||
//|
|
||||
//| The 'completeness' determination is slightly different than in standard Python
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
//| mosi_bit: int,
|
||||
//| clk_bit: int,
|
||||
//| reset_bit: Optional[int],
|
||||
//| ):
|
||||
//| ) -> None:
|
||||
//| """Send a displayio-style initialization sequence over an I2C I/O expander
|
||||
//|
|
||||
//| This function is highly generic in order to support various I/O expanders.
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
//| buffer: WriteableBuffer,
|
||||
//| data: digitalio.DigitalInOut,
|
||||
//| index: digitalio.DigitalInOut,
|
||||
//| index_wait=0.220,
|
||||
//| index_wait: float = 0.220,
|
||||
//| ) -> int:
|
||||
//| """Read flux transition information into the buffer.
|
||||
//|
|
||||
|
|
|
|||
|
|
@ -328,6 +328,34 @@ MATH_FUN_1(gamma, tgamma)
|
|||
//| ...
|
||||
//|
|
||||
MATH_FUN_1(lgamma, lgamma)
|
||||
|
||||
//| def dist(p: tuple, q: tuple) -> float:
|
||||
//| """Return the Euclidean distance between two points ``p`` and ``q``.
|
||||
//|
|
||||
//| May not be available on some boards.
|
||||
//| """
|
||||
//| ...
|
||||
//|
|
||||
static mp_obj_t mp_math_dist(mp_obj_t p_obj, mp_obj_t q_obj) {
|
||||
mp_obj_t *p_items;
|
||||
mp_obj_get_array_fixed_n(p_obj, 2, &p_items);
|
||||
|
||||
mp_obj_t *q_items;
|
||||
mp_obj_get_array_fixed_n(q_obj, 2, &q_items);
|
||||
|
||||
mp_float_t px_in = mp_obj_get_float(p_items[0]);
|
||||
mp_float_t py_in = mp_obj_get_float(p_items[1]);
|
||||
|
||||
mp_float_t qx_in = mp_obj_get_float(q_items[0]);
|
||||
mp_float_t qy_in = mp_obj_get_float(q_items[1]);
|
||||
|
||||
mp_float_t dist_x = px_in - qx_in;
|
||||
mp_float_t dist_y = py_in - qy_in;
|
||||
|
||||
return mp_obj_new_float(sqrtf((dist_x * dist_x) + (dist_y * dist_y)));
|
||||
}
|
||||
static MP_DEFINE_CONST_FUN_OBJ_2(mp_math_dist_obj, mp_math_dist);
|
||||
|
||||
#endif
|
||||
// TODO: factorial, fsum
|
||||
|
||||
|
|
@ -415,6 +443,7 @@ static const mp_rom_map_elem_t mp_module_math_globals_table[] = {
|
|||
{ MP_ROM_QSTR(MP_QSTR_acosh), MP_ROM_PTR(&mp_math_acosh_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_asinh), MP_ROM_PTR(&mp_math_asinh_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_atanh), MP_ROM_PTR(&mp_math_atanh_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_dist), MP_ROM_PTR(&mp_math_dist_obj) },
|
||||
#endif
|
||||
{ MP_ROM_QSTR(MP_QSTR_cos), MP_ROM_PTR(&mp_math_cos_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_sin), MP_ROM_PTR(&mp_math_sin_obj) },
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
//| """
|
||||
//|
|
||||
|
||||
//| def __init__(self, *, start, length) -> None:
|
||||
//| def __init__(self, *, start: int, length: int) -> None:
|
||||
//| """Constructs an address range starting at ``start`` and ending at
|
||||
//| ``start + length``. An exception will be raised if any of the
|
||||
//| addresses are invalid or protected."""
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
//| class IncrementalEncoder:
|
||||
//| """IncrementalEncoder determines the relative rotational position based on two series of pulses.
|
||||
//| It assumes that the encoder's common pin(s) are connected to ground,and enables pull-ups on
|
||||
//| pin_a and pin_b."""
|
||||
//| It assumes that the encoder's common pin(s) are connected to ground,and enables pull-ups on
|
||||
//| pin_a and pin_b."""
|
||||
//|
|
||||
//| def __init__(
|
||||
//| self, pin_a: microcontroller.Pin, pin_b: microcontroller.Pin, divisor: int = 4
|
||||
|
|
|
|||
|
|
@ -74,9 +74,9 @@ static const uint16_t triangle[] = {0, 32767, 0, -32767};
|
|||
//| scale: BlockInput = 1.0,
|
||||
//| offset: BlockInput = 0.0,
|
||||
//| phase_offset: BlockInput = 0.0,
|
||||
//| once=False,
|
||||
//| interpolate=True
|
||||
//| ):
|
||||
//| once: bool = False,
|
||||
//| interpolate: bool = True,
|
||||
//| ) -> None:
|
||||
//| pass
|
||||
static const mp_arg_t lfo_properties[] = {
|
||||
{ MP_QSTR_waveform, MP_ARG_OBJ, {.u_obj = MP_ROM_NONE } },
|
||||
|
|
@ -268,7 +268,7 @@ MP_PROPERTY_GETTER(synthio_lfo_value_obj,
|
|||
|
||||
|
||||
//|
|
||||
//| def retrigger(self):
|
||||
//| def retrigger(self) -> None:
|
||||
//| """Reset the LFO's internal index to the start of the waveform. Most useful when it its `once` property is `True`."""
|
||||
//|
|
||||
static mp_obj_t synthio_lfo_retrigger(mp_obj_t self_in) {
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ MAKE_ENUM_TYPE(synthio, MathOperation, synthio_math_operation,
|
|||
//| a: BlockInput,
|
||||
//| b: BlockInput = 0.0,
|
||||
//| c: BlockInput = 1.0,
|
||||
//| ):
|
||||
//| ) -> None:
|
||||
//| pass
|
||||
static const mp_arg_t math_properties[] = {
|
||||
{ MP_QSTR_operation, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_obj = NULL } },
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ static MP_DEFINE_CONST_FUN_OBJ_2(synthio_synthesizer_release_obj, synthio_synthe
|
|||
//| self,
|
||||
//| release: NoteOrNoteSequence = (),
|
||||
//| press: NoteOrNoteSequence = (),
|
||||
//| retrigger=LFOOrLFOSequence,
|
||||
//| retrigger: LFOOrLFOSequence = (),
|
||||
//| ) -> None:
|
||||
//| """Start notes, stop them, and/or re-trigger some LFOs.
|
||||
//|
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(usb_core_device_get_manufacturer_obj, usb_core_device_
|
|||
MP_PROPERTY_GETTER(usb_core_device_manufacturer_obj,
|
||||
(mp_obj_t)&usb_core_device_get_manufacturer_obj);
|
||||
|
||||
//| def set_configuration(self, configuration=1):
|
||||
//| def set_configuration(self, configuration: int = 1) -> None:
|
||||
//| """Set the active configuration.
|
||||
//|
|
||||
//| The configuration parameter is the bConfigurationValue field of the
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ static void check_for_deinit(usb_video_uvcframebuffer_obj_t *self) {
|
|||
//| it also supports the ``WritableBuffer`` protocol and can be accessed
|
||||
//| as an array of ``H`` (unsigned 16-bit values)."""
|
||||
//|
|
||||
//| def __new__(self):
|
||||
//| def __init__(self) -> None:
|
||||
//| """Returns the singleton framebuffer object, if USB video is enabled"""
|
||||
static mp_obj_t usb_video_uvcframebuffer_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
|
||||
static const mp_arg_t allowed_args[] = {};
|
||||
|
|
|
|||
|
|
@ -90,6 +90,10 @@ bool displayio_display_bus_is_free(displayio_display_bus_t *self) {
|
|||
}
|
||||
|
||||
bool displayio_display_bus_begin_transaction(displayio_display_bus_t *self) {
|
||||
mp_obj_base_t *bus_base = MP_OBJ_TO_PTR(self->bus);
|
||||
if (bus_base->type == &mp_type_NoneType) {
|
||||
return false;
|
||||
}
|
||||
return self->begin_transaction(self->bus);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ def get_board_pins(pin_filename):
|
|||
continue
|
||||
|
||||
board_member = search.group(1)
|
||||
extra_typing = None
|
||||
|
||||
board_type_search = re.search(r"MP_ROM_PTR\(&pin_(.*?)\)", line)
|
||||
if board_type_search:
|
||||
|
|
@ -38,8 +39,18 @@ def get_board_pins(pin_filename):
|
|||
board_type_search = re.search(
|
||||
r"MP_ROM_PTR\(&(.*?)\[0\].[display|epaper_display]", line
|
||||
)
|
||||
|
||||
if board_type_search is None:
|
||||
records.append(["unmapped", None, line])
|
||||
board_type_search = re.search(r"MP_ROM_PTR\(&(.*?)_tuple", line)
|
||||
if board_type_search is not None:
|
||||
extra_typing = "Tuple[Any]"
|
||||
if board_type_search is None:
|
||||
board_type_search = re.search(r"MP_ROM_PTR\(&(.*?)_dict", line)
|
||||
if board_type_search is not None:
|
||||
extra_typing = "Dict[str, Any]"
|
||||
|
||||
if board_type_search is None:
|
||||
records.append(["unmapped", None, line, extra_typing])
|
||||
continue
|
||||
|
||||
board_type = board_type_search.group(1)
|
||||
|
|
@ -56,7 +67,7 @@ def get_board_pins(pin_filename):
|
|||
if extra_search:
|
||||
extra = extra_search.group(1)
|
||||
|
||||
records.append([board_type, board_member, extra])
|
||||
records.append([board_type, board_member, extra, extra_typing])
|
||||
|
||||
return records
|
||||
|
||||
|
|
@ -69,8 +80,10 @@ def create_board_stubs(board_id, records, mappings, board_filename):
|
|||
needs_busio = False
|
||||
needs_displayio = False
|
||||
needs_microcontroller = False
|
||||
needs_dict = False
|
||||
needs_tuple = False
|
||||
|
||||
for board_type, board_member, extra in records:
|
||||
for board_type, board_member, extra, extra_typing in records:
|
||||
if board_type == "pin":
|
||||
needs_microcontroller = True
|
||||
comment = f" # {extra}"
|
||||
|
|
@ -121,6 +134,13 @@ def create_board_stubs(board_id, records, mappings, board_filename):
|
|||
member_data += f"{board_member}: {class_name}\n"
|
||||
members.append(member_data)
|
||||
|
||||
elif extra_typing is not None:
|
||||
if "Dict" in extra_typing:
|
||||
needs_dict = True
|
||||
elif "Tuple" in extra_typing:
|
||||
needs_tuple = True
|
||||
members.append(f"{board_member}: {extra_typing}\n")
|
||||
|
||||
elif board_type == "unmapped":
|
||||
unmapped.append(extra)
|
||||
|
||||
|
|
@ -152,6 +172,14 @@ def create_board_stubs(board_id, records, mappings, board_filename):
|
|||
if needs_microcontroller:
|
||||
boards_file.write("import microcontroller\n")
|
||||
|
||||
if needs_dict:
|
||||
if needs_tuple:
|
||||
boards_file.write("from typing import Any, Dict, Tuple\n")
|
||||
else:
|
||||
boards_file.write("from typing import Any, Dict\n")
|
||||
elif needs_tuple:
|
||||
boards_file.write("from typing import Any, Tuple\n")
|
||||
|
||||
boards_file.write("\n\n")
|
||||
boards_file.write("# Board Info:\n")
|
||||
boards_file.write("board_id: str\n")
|
||||
|
|
@ -200,7 +228,7 @@ def process(board_mappings, export_dir):
|
|||
records = get_board_pins(pin_filename)
|
||||
create_board_stubs(board_id, records, mappings, f"{sub_dir}/__init__.pyi")
|
||||
|
||||
for board_type, board_member, extra in records:
|
||||
for board_type, board_member, extra, extra_typing in records:
|
||||
if board_type == "pin":
|
||||
total_pins += 1
|
||||
elif board_type == "unmapped":
|
||||
|
|
|
|||
Loading…
Reference in a new issue